当前位置: 首页>>代码示例>>PHP>>正文


PHP Player::isLoaded方法代码示例

本文整理汇总了PHP中Player::isLoaded方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::isLoaded方法的具体用法?PHP Player::isLoaded怎么用?PHP Player::isLoaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::isLoaded方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: elseif

 } elseif ($action == "change") {
     $newchar_errors = array();
     $newchar_name = ucwords(strtolower(trim($_REQUEST['new_name'])));
     if (empty($newchar_name)) {
         $newchar_errors[] = 'Please enter a new name for your character!';
     }
     if (!check_name_new_char($newchar_name)) {
         $newchar_errors[] = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
     }
     $check_name_in_database = new 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) {
开发者ID:s3kk,项目名称:Gesior1.x,代码行数:31,代码来源:changename.php

示例2: elseif

    } elseif ($action == 'setnewpassword') {
        $newpassword = $_REQUEST['passor'];
        $code = $_REQUEST['code'];
        $character = $_REQUEST['character'];
        $main_content .= '';
        if (empty($code) || empty($character) || empty($newpassword)) {
            $main_content .= '<font color="red"><b>Error. Try again.</b></font><br />Please enter code from e-mail and name of one character from account. Then press Submit.<BR>
					<BR><FORM ACTION="?subtopic=lostaccount&action=checkcode" METHOD=post>
					<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
					<INPUT TYPE=image NAME="Back" ALT="Back" SRC="' . $layout_name . '/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
					</TD></TR></FORM></TABLE></TABLE>';
        } else {
            $player = new Player();
            $account = new Account();
            $player->find($character);
            if ($player->isLoaded()) {
                $account = $player->getAccount();
            }
            if ($account->isLoaded()) {
                if ($account->getCustomField('email_code') == $code) {
                    if (check_password($newpassword)) {
                        $account->setPassword($newpassword);
                        $account->set('email_code', '');
                        $account->save();
                        $main_content .= 'New password to your account is below. Now you can login.<BR>
						<INPUT TYPE="hidden" NAME="character" VALUE="' . htmlspecialchars($character) . '">
						<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
						<TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" CLASS=white><B>Changed password</B></TD></TR>
						<TR><TD BGCOLOR="' . $config['site']['darkborder'] . '">
						New password:&nbsp;<b>' . htmlspecialchars($newpassword) . '</b><BR />
						Account name:&nbsp;&nbsp;&nbsp;<i>(Already on your e-mail)</i><BR />';
开发者ID:aottibia,项目名称:www,代码行数:31,代码来源:lostaccount.php

示例3: nick

            if (empty($buy_from)) {
                $buy_from = 'Anonymous';
            }
            if (empty($buy_id)) {
                $errormessage .= 'Please <a href="?subtopic=shopsystem">select item</a> first.';
            } else {
                if (!check_name($buy_from)) {
                    $errormessage .= 'Invalid nick ("from player") format. Please <a href="?subtopic=shopsystem&action=select_player&buy_id=' . $buy_id . '">select other name</a> or contact with administrator.';
                } else {
                    $buy_offer = getItemByID($buy_id);
                    if (isset($buy_offer['id'])) {
                        if ($user_premium_points >= $buy_offer['points']) {
                            if (check_name($buy_name)) {
                                $buy_player = new Player();
                                $buy_player->find($buy_name);
                                if ($buy_player->isLoaded()) {
                                    $buy_player_account = $buy_player->getAccount();
                                    if ($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') {
                                        if ($buy_offer['type'] == 'item') {
                                            $sql = 'INSERT INTO ' . $SQL->tableName('z_ots_comunication') . ' (' . $SQL->fieldName('id') . ',' . $SQL->fieldName('name') . ',' . $SQL->fieldName('type') . ',' . $SQL->fieldName('action') . ',' . $SQL->fieldName('param1') . ',' . $SQL->fieldName('param2') . ',' . $SQL->fieldName('param3') . ',' . $SQL->fieldName('param4') . ',' . $SQL->fieldName('param5') . ',' . $SQL->fieldName('param6') . ',' . $SQL->fieldName('param7') . ',' . $SQL->fieldName('delete_it') . ') VALUES (NULL, ' . $SQL->quote($buy_player->getName()) . ', ' . $SQL->quote('login') . ', ' . $SQL->quote('give_item') . ', ' . $SQL->quote($buy_offer['item_id']) . ', ' . $SQL->quote($buy_offer['item_count']) . ', ' . $SQL->quote('') . ', ' . $SQL->quote('') . ', ' . $SQL->quote('item') . ', ' . $SQL->quote($buy_offer['name']) . ', ' . $SQL->quote($buy_offer['id']) . ', ' . $SQL->quote(1) . ');';
                                            $SQL->query($sql);
                                            $save_transaction = 'INSERT INTO ' . $SQL->tableName('z_shop_history_item') . ' (' . $SQL->fieldName('id') . ',' . $SQL->fieldName('to_name') . ',' . $SQL->fieldName('to_account') . ',' . $SQL->fieldName('from_nick') . ',' . $SQL->fieldName('from_account') . ',' . $SQL->fieldName('price') . ',' . $SQL->fieldName('offer_id') . ',' . $SQL->fieldName('trans_state') . ',' . $SQL->fieldName('trans_start') . ',' . $SQL->fieldName('trans_real') . ') VALUES (' . $SQL->lastInsertId() . ', ' . $SQL->quote($buy_player->getName()) . ', ' . $SQL->quote($buy_player_account->getId()) . ', ' . $SQL->quote($buy_from) . ',  ' . $SQL->quote($account_logged->getId()) . ', ' . $SQL->quote($buy_offer['points']) . ', ' . $SQL->quote($buy_offer['name']) . ', ' . $SQL->quote('wait') . ', ' . $SQL->quote(time()) . ', ' . $SQL->quote(0) . ');';
                                            $SQL->query($save_transaction);
                                            $account_logged->setCustomField('premium_points', $user_premium_points - $buy_offer['points']);
                                            $user_premium_points = $user_premium_points - $buy_offer['points'];
                                            $main_content .= '<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
<TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" ALIGN=left CLASS=white><B>Item added!</B></TD></TR>
<TR><TD BGCOLOR="' . $config['site']['lightborder'] . '" ALIGN=left><b>' . htmlspecialchars($buy_offer['name']) . '</b> added to player <b>' . htmlspecialchars($buy_player->getName()) . '</b> items (he will get this items after relog) for <b>' . $buy_offer['points'] . ' premium points</b> from your account.<br />Now you have <b>' . $user_premium_points . ' premium points</b>.<br /><a href="?subtopic=shopsystem">GO TO MAIN SHOP SITE</a></TD></TR>
</table>';
                                        } elseif ($buy_offer['type'] == 'mount') {
                                            $account_id = $buy_player->getCustomField('id');
开发者ID:s3kk,项目名称:Gesior1.x,代码行数:31,代码来源:shopsystem.php

示例4: Player

 if (empty($newchar_errors)) {
     $check_name_in_database = new 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!';
     }
     $number_of_players_on_account = $account_logged->getPlayersList()->count();
     if ($number_of_players_on_account >= $config['site']['max_players_per_account']) {
         $newchar_errors[] .= 'You have too many characters on your account <b>(' . $number_of_players_on_account . '/' . $config['site']['max_players_per_account'] . ')</b>!';
     }
 }
 if (empty($newchar_errors)) {
     $char_to_copy_name = $config['site']['newchar_vocations'][$world_id][$newchar_vocation];
     $char_to_copy = new Player();
     $char_to_copy->find($char_to_copy_name);
     if (!$char_to_copy->isLoaded()) {
         $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);
开发者ID:Pietia10,项目名称:Gesior-for-OTServ,代码行数:31,代码来源:accountmanagement.php

示例5: Account

 $samplePlayers[2] = 'Druid Sample';
 $samplePlayers[3] = 'Paladin Sample';
 $samplePlayers[4] = 'Knight Sample';
 $account = new Account(1, Account::LOADTYPE_NAME);
 if (!$account->isLoaded()) {
     $account->setName(1);
     $account->setPassword(1);
     $account->setMail(rand(0, 999999) . '@gmail.com');
     $account->setPageAccess(3);
     $account->setFlag('unknown');
     $account->setCreateIP(Visitor::getIP());
     $account->setCreateDate(time());
     $account->save();
 }
 $newPlayer = new Player('Account Manager', Player::LOADTYPE_NAME);
 if (!$newPlayer->isLoaded()) {
     $newPlayer->setComment('');
     $newPlayer->setName('Account Manager');
     $newPlayer->setAccountID($account->getID());
     $newPlayer->setLevel(8);
     $newPlayer->setExperience(4200);
     $newPlayer->setGroupID(1);
     $newPlayer->setVocation(0);
     $newPlayer->setHealth(185);
     $newPlayer->setHealthMax(185);
     $newPlayer->setMana(35);
     $newPlayer->setManaMax(35);
     $newPlayer->setTown(1);
     $newPlayer->setSoul(100);
     $newPlayer->setCapacity(420);
     $newPlayer->setSave(1);
开发者ID:s3kk,项目名称:Gesior1.x,代码行数:31,代码来源:install.php

示例6: kickPlayer

 public function kickPlayer($playerId)
 {
     if ($playerId == $this->getOwnerID()) {
         $this->delete();
     } else {
         $player = new Player($playerId);
         if ($player->isLoaded()) {
             $player->setRankID(0);
             $player->save();
         }
     }
 }
开发者ID:Pietia10,项目名称:Gesior-for-OTServ,代码行数:12,代码来源:guild.php

示例7: House

 if (Visitor::isLogged()) {
     $houseOwned = $SQL->query('SELECT `houses`.`id` house_id, `players`.`id` owner_id FROM `houses`, `players` WHERE `players`.`id` = `houses`.`owner` AND `players`.`account_id` = ' . Visitor::getAccount()->getID() . ' LIMIT 1')->fetch();
     if ($houseOwned === false) {
         if (isset($_REQUEST['house'])) {
             $house = new House((int) $_REQUEST['house']);
             if ($house->isLoaded()) {
                 if ($house->getOwner() == 0) {
                     if ($house->getBidEnd() == 0 || $house->getBidEnd() > time()) {
                         $houseBidded = $SQL->query('SELECT `houses`.`id` house_id, `players`.`id` bidder_id FROM `houses`, `players` WHERE `players`.`id` = `houses`.`highest_bidder` AND `players`.`account_id` = ' . Visitor::getAccount()->getID())->fetch();
                         if ($houseBidded === false || $houseBidded['house_id'] == $house->getID()) {
                             $bidded = false;
                             if (isset($_REQUEST['do_bid'])) {
                                 if (isset($_REQUEST['bid']) && isset($_REQUEST['bidder'])) {
                                     $bidder = new Player($_REQUEST['bidder']);
                                     $bid = (int) $_REQUEST['bid'];
                                     if ($bidder->isLoaded() && $bidder->getAccountID() == Visitor::getAccount()->getID()) {
                                         if ($bidder->getBalance() >= $bid) {
                                             // jesli przebija swoja oferte to nie musi dawac wiecej
                                             // moze tylko zmieniac postac ktora zostanie, a nawet obnizac maksymalna
                                             if ($bid > 0 && ($bid > $house->getBid() || $houseBidded !== false)) {
                                                 // jesli przebija sam siebie to nie podnosi ceny aktualnej
                                                 if ($houseBidded === false) {
                                                     // ustawia cene na cene przed przebiciem + 1 gold
                                                     // moze to podniesc z 0 do 1 gold przy nowym domku
                                                     // lub ustawic wartosc maksymalna osoby co licytowala wczesniej + 1
                                                     $house->setLastBid($house->getBid() + 1);
                                                 }
                                                 // ustawic najwyzsza oferowana kwote na podana
                                                 // jesli przebija swoja aukcje kwota mniejsza niz aktualna to nie zmieniaj!
                                                 // jak ktos inny przebija to i tak bid bedzie wiekszy-rowny od aktualnego
                                                 // (nawet jak o 1 gp przebija - 6 linijek wyzej ustawia ...
开发者ID:aottibia,项目名称:www,代码行数:31,代码来源:houses.php

示例8: Player

        exit;
    }
}
for ($i = 0; $i < strlen($name); $i++) {
    if ($name[$i] == $name[$i + 1] && $name[$i] == $name[$i + 2]) {
        echo '<font color="red">Name can\'t contain 3 same letters one by one.</font><br /><font color="green"><u>Good:</u> M<b>oo</b>nster</font><font color="red"><br />Wrong: M<b>ooo</b>nster</font>';
        exit;
    }
}
for ($i = 0; $i < strlen($name); $i++) {
    if ($name[$i - 1] == ' ' && $name[$i + 1] == ' ') {
        echo '<font color="red">Use normal name format.</font><br /><font color="green"><u>Good:</u> <b>Gesior</b></font><font color="red"><br />Wrong: <b>G e s ior</b></font>';
        exit;
    }
}
if (substr($name, 1, 1) == ' ') {
    echo '<font color="red">Use normal name format.</font><br /><font color="green"><u>Good:</u> <b>Gesior</b></font><font color="red"><br />Wrong: <b>G esior</b></font>';
    exit;
}
if (substr($name, -2, 1) == " ") {
    echo '<font color="red">Use normal name format.</font><br /><font color="green"><u>Good:</u> <b>Gesior</b></font><font color="red"><br />Wrong: <b>Gesio r</b></font>';
    exit;
}
$name_db = new Player();
$name_db->find($name);
if ($name_db->isLoaded()) {
    echo '<font color="red"><b>Player with this name already exist.</b></font>';
} else {
    echo '<font color="green">Good. Your name will be:<br />"<b>' . htmlspecialchars(ucwords($name)) . '</b>"</font>';
}
exit;
开发者ID:aottibia,项目名称:www,代码行数:31,代码来源:ajax_check_name.php


注:本文中的Player::isLoaded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。