本文整理汇总了PHP中Player::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::setName方法的具体用法?PHP Player::setName怎么用?PHP Player::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::setName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildPlayerGroup
private function buildPlayerGroup($tech, $fleets)
{
$playerObj = new Player(1);
$playerObj->setName('bot');
$playerObj->setTech($tech['weapons'], $tech['shields'], $tech['armour']);
foreach ($fleets as $idFleet => $fleet) {
$fleetObj = new Fleet($idFleet);
foreach ($fleet as $id => $count) {
$count = floor($count);
$id = floor($id);
if ($count > 0 && $id > 0) {
$fleetObj->addShipType($this->getShipType($id, $count));
}
}
if (!$fleetObj->isEmpty()) {
$playerObj->addFleet($fleetObj);
}
}
if ($playerObj->isEmpty()) {
die("<meta http-equiv=\"refresh\" content=2;\"WebTest.php\">There should be at least an attacker and defender");
}
$playerGroupObj = new PlayerGroup();
$playerGroupObj->addPlayer($playerObj);
return $playerGroupObj;
}
示例2: getAsObject
protected function getAsObject($row)
{
$result = new Player();
$result->setNew(false);
$result->setPlayerId(Singleton::create("NullConverter")->fromDBtoDOM($row["playerId"]));
$result->setName(Singleton::create("NullConverter")->fromDBtoDOM($row["name"]));
$result->setTeamId(Singleton::create("NullConverter")->fromDBtoDOM($row["teamId"]));
return $result;
}
示例3: Player
$check_name_in_database->find($newchar_name);
if ($check_name_in_database->isLoaded()) {
$newchar_errors[] = 'This name is already used. Please choose another name!';
}
$charToEdit = new Player($_REQUEST['player_id']);
if (!$charToEdit->isLoaded()) {
$newchar_errors[] = 'This player does not exist.';
}
if ($charToEdit->isOnline()) {
$newchar_errors[] = 'This player is ONLINE. Logout first.';
} elseif ($account_logged->getID() != $charToEdit->getAccountID()) {
$newchar_errors[] = 'This player is not on your account.';
}
if (empty($newchar_errors)) {
echo 'Name of character <b>' . htmlspecialchars($charToEdit->getName()) . '</b> changed to <b>' . htmlspecialchars($newchar_name) . '</b>';
$charToEdit->setName($newchar_name);
$charToEdit->save();
$account_logged->setCustomField('premium_points', $account_logged->getCustomField('premium_points') - $changeNameCost);
} else {
echo 'Some errors occured:<br />';
foreach ($newchar_errors as $e) {
echo '<li>' . $e . '</li>';
}
echo '<br /><a href="?subtopic=changename"><b>BACK</b></a>';
}
}
} else {
echo 'You don\'t have premium points. You need ' . $changeNameCost . '.';
}
} else {
echo 'You must login first.';
示例4: htmlspecialchars
$newchar_errors[] .= 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config/config.php and set valid characters to copy names. Character to copy <b>' . htmlspecialchars($char_to_copy_name) . '</b> doesn\'t exist.';
}
}
if (empty($newchar_errors)) {
// load items and skills of player before we change ID
$char_to_copy->getItems()->load();
$char_to_copy->loadSkills();
if ($newchar_sex == "0") {
$char_to_copy->setLookType(136);
}
$char_to_copy->setID(null);
// save as new character
$char_to_copy->setLastIP(0);
$char_to_copy->setLastLogin(0);
$char_to_copy->setLastLogout(0);
$char_to_copy->setName($newchar_name);
$char_to_copy->setAccount($account_logged);
$char_to_copy->setSex($newchar_sex);
$char_to_copy->setTown($newchar_town);
$char_to_copy->setPosX(0);
$char_to_copy->setPosY(0);
$char_to_copy->setPosZ(0);
$char_to_copy->setWorldID((int) $world_id);
$char_to_copy->setCreateIP(Visitor::getIP());
$char_to_copy->setCreateDate(time());
$char_to_copy->setSave();
// make character saveable
$char_to_copy->save();
// now it will load 'id' of new player
if ($char_to_copy->isLoaded()) {
$char_to_copy->saveItems();
示例5: foreach
$newPlayer->setSkillCount(1, 0);
$newPlayer->setSkillCount(2, 0);
$newPlayer->setSkillCount(3, 0);
$newPlayer->setSkillCount(4, 0);
$newPlayer->setSkillCount(5, 0);
$newPlayer->setSkillCount(6, 0);
$newPlayer->save();
}
if ($newPlayer->isLoaded()) {
foreach ($samplePlayers as $vocationID => $name) {
$samplePlayer = new Player($name, Player::LOADTYPE_NAME);
if (!$samplePlayer->isLoaded()) {
$samplePlayer = new Player('Account Manager', Player::LOADTYPE_NAME);
$samplePlayer->setID(null);
// save as new player, not edited
$samplePlayer->setName($name);
$samplePlayer->setVocation($vocationID);
$samplePlayer->setGroupID(1);
$samplePlayer->setLookType(128);
$samplePlayer->save();
echo '<span style="color:green">Added sample character: </span><span style="color:green;font-weight:bold">' . $name . '</span><br/>';
} else {
echo 'Sample character: <span style="font-weight:bold">' . $name . '</span> already exist in database<br/>';
}
}
} else {
new Error_Critic('', 'Character <i>Account Manager</i> does not exist. Cannot install sample characters!');
}
} elseif ($step == 5) {
echo '<h1>STEP ' . $step . '</h1>Set Admin Account<br>';
if (empty($_REQUEST['saveaccpassword'])) {
示例6: getPlayerGroupFromQuery
function getPlayerGroupFromQuery($result, $targetUser = false)
{
$playerGroup = new PlayerGroup();
while ($fleetRow = mysql_fetch_assoc($result)) {
//making the current fleet object
$serializedTypes = explode(';', $fleetRow['fleet_array']);
$idPlayer = $fleetRow['fleet_owner'];
$fleet = new Fleet($fleetRow['fleet_id']);
foreach ($serializedTypes as $serializedType) {
list($id, $count) = explode(',', $serializedType);
if ($id != 0 && $count != 0) {
$fleet->addShipType(getShipType($id, $count));
}
}
//making the player object and add it to playerGroup object
if (!$playerGroup->existPlayer($idPlayer)) {
$player_info = $targetUser !== false && $targetUser['id'] == $idPlayer ? $targetUser : doquery("SELECT * FROM {{table}} WHERE id ={$idPlayer}", 'users', true);
$player = new Player($idPlayer, array($fleet));
$player->setTech($player_info['military_tech'], $player_info['shield_tech'], $player_info['defence_tech']);
$player->setName($player_info['name']);
$playerGroup->addPlayer($player);
} else {
$playerGroup->getPlayer($idPlayer)->addFleet($fleet);
}
}
return $playerGroup;
}
示例7: getPlayerGroupFromQuery
/**
* getPlayerGroupFromQuery
*
* @param array $result Result
* @param boolean $target_user Target User
*
* @return \PlayerGroup
*/
private function getPlayerGroupFromQuery($result, $target_user = false)
{
$playerGroup = new PlayerGroup();
while ($fleet_row = parent::$db->fetch_assoc($result)) {
//making the current fleet object
$serializedTypes = explode(';', $fleet_row['fleet_array']);
$idPlayer = $fleet_row['fleet_owner'];
$fleet = new Fleet($fleet_row['fleet_id']);
foreach ($serializedTypes as $serializedType) {
if (!empty($serializedType)) {
list($id, $count) = explode(',', $serializedType);
if ($id != 0 && $count != 0) {
$fleet->addShipType($this->getShipType($id, $count));
}
}
}
//making the player object and add it to playerGroup object
if (!$playerGroup->existPlayer($idPlayer)) {
if ($target_user !== false && $target_user['user_id'] == $idPlayer) {
$player_info = $target_user;
} else {
$player_info = parent::$db->query_fetch("SELECT u.user_name,\n r.research_weapons_technology,\n r.research_shielding_technology,\n r.research_armour_technology\n FROM " . USERS . " AS u\n INNER JOIN " . RESEARCH . " AS r ON r.research_user_id = u.user_id\n WHERE u.user_id = '" . $idPlayer . "';");
}
$player = new Player($idPlayer, array($fleet));
$player->setTech($player_info['research_weapons_technology'], $player_info['research_shielding_technology'], $player_info['research_armour_technology']);
$player->setName($player_info['user_name']);
$playerGroup->addPlayer($player);
} else {
$playerGroup->getPlayer($idPlayer)->addFleet($fleet);
}
}
return $playerGroup;
}