/** * @param Session $session * @param int $kitid * @param mixed[][] $rows */ public function __construct(Session $session, $kitid, array $rows) { $this->uid = $session->getUid(); $this->kitid = $kitid; foreach ($rows as $row) { $slot = $row["slot"]; $name = $row["name"]; $value = $row["value"]; if ($slot === self::SLOT_SPECIAL_REAL_SIZE) { $this->realSize = $value; } elseif ($slot === self::SLOT_SPECIAL_ABSTRACT_SIZE) { $this->abstractSize = $value; } elseif ($slot === self::SLOT_SPECIAL_NAME) { $this->name = $name; } elseif ($slot < self::ARMOR_STARTS_AT) { $this->realSlots[$slot] = new KitEntry($this, $slot, $name, $value, $session->getPurchase($value)); } elseif ($slot < self::ABSTRACT_STARTS_AT) { $this->armorSlots[$slot - self::ARMOR_STARTS_AT] = new KitEntry($this, $slot, $name, $value, $session->getPurchase($value)); } else { $this->abstractSlots[$slot - self::ABSTRACT_STARTS_AT] = new KitEntry($this, $slot, $name, $value, $session->getPurchase($value)); } } for ($i = 0; $i < $this->realSize; $i++) { if (!isset($this->realSlots[$i])) { $this->realSize[$i] = new KitEntry($this, $i, "Slot " . ($i + 1), 0, null, false); } } for ($i = 0; $i < $this->abstractSize; $i++) { if (!isset($this->abstractSlots[$i])) { $this->abstractSlots[$i] = new KitEntry($this, $i + self::ABSTRACT_STARTS_AT, "Slot " . ($i + 1), 0, null, false); } } }
public function __construct(BasePlugin $main, Session $session, $teamName) { $this->teamName = $teamName; $this->uid = $session->getUid(); $this->playerName = $session->getInGameName(); parent::__construct($main); }
/** * @param Session $session * @param int $status * @return mixed[][]|mixed[] */ protected function getColumns(Session $session, $status) { $coins = $session->getCoins(); $this->coinsDelta = $session->getAndUpdateCoinsDelta(); $skin = $session->getCurrentFaceSkin(); return ["uid" => ["v" => $session->getUid(), "noupdate" => true], "name" => ["v" => strtolower($session->getPlayer()->getName())], "nicks" => "|" . implode("|", $session->getNicks()) . "|", "lastip" => $session->getPlayer()->getAddress(), "status" => $status, "lastses" => Settings::$LOCALIZE_CLASS, "authuuid" => $session->getPlayer()->getUniqueId(), "coins" => ["v" => $coins, "noupdate" => true], "hash" => ["v" => $session->getPasswordHash(), "noupdate" => true], "pwprefix" => ["v" => $session->getPasswordPrefix(), "noupdate" => true], "pwlen" => ["v" => $session->getPasswordLength(), "noupdate" => true], "registration" => ["v" => $session->getRegisterTime(), "noupdate" => true], "laston" => time(), "ontime" => (int) $session->getAndUpdateOntime(), "config" => $session->getAllSettings(), "skin1" => ["v" => substr($skin, 0, 128), "bin" => true], "skin2" => ["v" => substr($skin, 128, 128), "bin" => true], "lastgrind" => $session->getLastGrind(), "rank" => ["v" => $session->getRank(), "noupdate" => true], "warnpts" => $session->getWarningPoints(), "lastwarn" => $session->getLastWarnTime(), "tid" => $session->getTeamId(), "teamrank" => $session->getTeamRank(), "teamjoin" => $session->getTeamJoinTime(), "ignorelist" => "," . implode(",", $session->getIgnoreList()) . ","]; }
public function __construct(BasePlugin $main, Session $issuer, $name) { $this->issuerName = $issuer->getPlayer()->getName(); $this->issuerUid = $issuer->getUid(); $this->tid = $issuer->getTeamId(); $this->teamName = $issuer->getTeamName(); $this->queriedTargetName = $name; parent::__construct($main); }
protected function run(array $args, Session $sender) { if ($sender->getTeamId() === -1) { return $sender->translate(Phrases::CMD_TEAM_ERR_ALREADY_IN_TEAM); } if (!isset($args[0])) { return false; } $team = array_shift($args); new JoinTeamQuery($this->getMain(), $sender->getUid(), $team); return $sender->translate(Phrases::CMD_TEAM_LOADING); }
protected function run(array $args, Session $sender) { if (!isset($args[0])) { return false; } $name = array_shift($args); if (strtolower($name) === strtolower($sender->getPlayer()->getName())) { return false; } new SetFriendQuery($this->getMain(), $name, $sender->getUid(), $this->level); return true; }
protected function run(array $args, Session $sender) { if ($sender->getTeamId() !== -1) { return $sender->translate(Phrases::CMD_TEAM_ERR_ALREADY_IN_TEAM); } $name = array_shift($args); if ($name === null) { return false; } if (!preg_match('/^[A-Za-z0-9_]{5,}$/', $name)) { $sender->send(Phrases::CMD_TEAM_CREATE_INVALID_NAME); return true; } new CreateTeamQuery($this->getMain(), $sender->getUid(), $name); return $sender->translate(Phrases::CMD_TEAM_LOADING); }
public function __construct(Session $session, $lid) { $this->uid = $session->getUid(); $this->lid = $lid; parent::__construct($session->getMain()); }
public function __construct(BasePlugin $main, $name, Session $session) { $this->name = $name; $this->uid = $session->getUid(); parent::__construct($main); }
/** * @param Session $session * @param MuteIssue|null $mute * @return bool */ public function isMuted(Session $session, &$mute = null) { $uid = $session->getUid(); $ip = $session->getPlayer()->getAddress(); /** @noinspection PhpDeprecationInspection */ $cid = $session->getPlayer()->getClientId(); foreach ($this->mutes as $k => $mute) { if (time() > $mute->since + $mute->length) { unset($this->mutes[$k]); continue; } if ($mute->uid === $uid or $mute->ip === $ip or $mute->cid === $cid) { return true; } } return false; }
public function __construct(BasePlugin $main, Session $session) { $this->session = $session; $this->uid = $session->getUid(); parent::__construct($this->main = $main); }