"beta5/player" )); } public function run($player, $name) { // Check if the player ID is not null if (is_null($player)) { return self::playerNotFound; } $player = (int) $player; // Check if the player is valid $playerRecord = $this->players->call('get', $player); if (is_null($playerRecord)) { return self::playerNotFound; } if ($this->players->call('isOnVacation', $player)) { return self::playerOnVacation; } // Check the name of the player to ban $name = preg_replace('/\s+/', ' ', trim($name)); if ($name == "") { return self::emptyName; } elseif (strlen($name) > 15) { return self::invalidName; } // Examine the player to ban $toBan = $this->players->call("getPlayerId", $name); if (is_null($toBan)) { return self::targetNotFound; } elseif ($toBan == $player) { return self::targetIsPlayer; } // Check if the target player is already banned if ($this->players->call('checkTAListBan', $toBan, $player)) { return self::alreadyBanned; } // Remove the current player from the banned player's TA list $reverseList = $this->players->call('isAllyOf', $player); foreach ($reverseList as $id => $data) { if ($id == $toBan) { $this->players->call('removeAlly', $toBan, $reverseList[$toBan]['level']); $this->players->call('reorderAllies', $toBan); break; } } // Add the ban $this->players->call('addTAListBan', $player, $toBan); return $this->game->action("getTrustedAllies", $player); } } ?>