예제 #1
0
 public function createGuild($name, $character)
 {
     $ots = POT::getInstance();
     $ots->connect(POT::DB_MYSQL, connection());
     $player = new OTS_Player();
     $player->load($character);
     $new_guild = new OTS_Guild();
     $new_guild->setCreationData(time());
     $new_guild->setName($name);
     $new_guild->setOwner($player);
     $new_guild->save();
     $new_guild->setCustomField('motd', 'New guild. Leader must edit this text :)');
     $new_guild->setCustomField('creationdata', time());
     $new_guild->setCustomField('world_id', $player->getWorld());
     $ranks = $new_guild->getGuildRanksList();
     $ranks->orderBy('level', POT::ORDER_DESC);
     foreach ($ranks as $rank) {
         if ($rank->getLevel() == 3) {
             $player->setRank($rank);
             $player->save();
         }
     }
     $ide = new IDE();
     $ide->redirect(WEBSITE . "/index.php/guilds/view/" . $new_guild->getId());
     success("{$name} has been created.");
 }
예제 #2
0
파일: driver.php 프로젝트: Tobbebror/POT
 public function submitRequest(OTS_Player $player)
 {
     $rank = null;
     // finds normal member rank
     foreach ($this->guild->getGuildRanks() as $guildRank) {
         if ($guildRank->getLevel() == 1) {
             $rank = $guildRank;
             break;
         }
     }
     $player->setRank($rank);
     $player->save();
     // clears invitation
     $this->deleteRequest($player);
 }
예제 #3
0
 public function submitRequest(OTS_Player $player)
 {
     $rank = null;
     // finds normal member rank
     foreach ($this->guild as $guildRank) {
         if ($guildRank->level == 1) {
             $rank = $guildRank;
             break;
         }
     }
     if (empty($rank)) {
         $rank = new OTS_GuildRank();
         $rank->setGuild($this->guild);
         $rank->setName('New Members');
         $rank->setLevel(1);
         $rank->save();
     }
     $player->setRank($rank);
     $player->save();
     // clears invitation
     $this->deleteRequest($player);
 }
예제 #4
0
 public function join($guild_name, $player_name)
 {
     $guild_name = (int) $guild_name;
     $player_name = (int) $player_name;
     $ide = new IDE();
     if (empty($guild_name) or empty($player_name)) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     $ots = POT::getInstance();
     $ots->connect(POT::DB_MYSQL, connection());
     $guild = $ots->createObject('Guild');
     $guild->load($guild_name);
     if (!$guild->isLoaded()) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     $player = new OTS_Player();
     $player->load($player_name);
     if (!$player->isLoaded()) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     if ($player->getAccount()->getId() != $_SESSION['account_id']) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     require_once 'system/application/libraries/POT/InvitesDriver.php';
     new InvitesDriver($guild);
     $invited_list = $guild->listInvites();
     if (!in_array($player->getId(), $invited_list)) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     $guild->acceptInvite($player);
     $ide->redirect(WEBSITE . "/index.php/guilds/view/" . $guild->getId() . "/1");
 }
예제 #5
0
 /**
  * Deletes player from VIP list.
  * 
  * @version 0.1.4
  * @since 0.1.3
  * @param OTS_Player $player Player to be deleted.
  * @throws E_OTS_NotLoaded If player is not loaded.
  * @throws PDOException On PDO operation error.
  */
 public function deleteVIP(OTS_Player $player)
 {
     if (!isset($this->data['id'])) {
         throw new E_OTS_NotLoaded();
     }
     $this->db->query('DELETE FROM ' . $this->db->tableName('player_viplist') . ' WHERE ' . $this->db->fieldName('player_id') . ' = ' . $this->data['id'] . ' AND ' . $this->db->fieldName('vip_id') . ' = ' . $player->getId());
 }
예제 #6
0
파일: guilds.php 프로젝트: s3kk/Gesior
            $main_content .= "0 guilds found.";
        }
    } else {
        $main_content .= "You are not logged in.";
    }
    $main_content .= "<center><h3><a href=\"?subtopic=guilds\">BACK</a></h3></center>";
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if ($action == 'change_nick') {
    if ($logged) {
        $player_n = stripslashes($_REQUEST['name']);
        $new_nick = stripslashes($_REQUEST['nick']);
        $player = new OTS_Player();
        $player->find($player_n);
        $player_from_account = FALSE;
        if (strlen($new_nick) <= 40) {
            if ($player->isLoaded()) {
                $account_players = $account_logged->getPlayersList();
                if (count($account_players)) {
                    foreach ($account_players as $acc_player) {
                        if ($acc_player->getId() == $player->getId()) {
                            $player_from_account = TRUE;
                        }
                    }
                    if ($player_from_account) {
                        $player->setGuildNick($new_nick);
                        $player->save();
                        $main_content .= 'Guild nick of player <b>' . $player->getName() . '</b> changed to <b>' . htmlentities($new_nick) . '</b>.';
예제 #7
0
 /**
  * @version 0.1.0
  * @return array Array of OTS_Player objects from given account.
  * @throws E_OTS_NotLoaded If account is not loaded.
  * @deprecated 0.0.5 Use getPlayersList().
  */
 public function getPlayers()
 {
     if (!isset($this->data['id'])) {
         throw new E_OTS_NotLoaded();
     }
     $players = array();
     foreach ($this->db->query('SELECT ' . $this->db->fieldName('id') . ' FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('account_id') . ' = ' . $this->data['id'])->fetchAll() as $player) {
         // creates new object
         $object = new OTS_Player();
         $object->load($player['id']);
         $players[] = $object;
     }
     return $players;
 }
예제 #8
0
						  <tr><td><B>Enter verify code: </B></td><td><INPUT id="verify" NAME="verify_code" VALUE="" SIZE=30></td></tr>';
    }
    $main_content .= '<tr><td></td><td><input type="submit" value="Check Code" /></td></tr></table></form>';
} elseif ($_REQUEST['system'] == 'dotpay' && $config['dotpay_active']) {
    #################################################################################
    $sms_type = (int) $_POST['sms_type'];
    $posted_code = trim($_POST['code']);
    $to_user = trim($_POST['to_user']);
    $verify_code = trim($_POST['verify_code']);
    #################################################################################
    if (!empty($to_user)) {
        if (is_numeric($to_user)) {
            $account = new OTS_Account();
            $account->find($to_user);
        } else {
            $player = new OTS_Player();
            $player->find($to_user);
            if ($player->isLoaded()) {
                $account = $player->getAccount();
            } else {
                $account = new OTS_Account();
            }
        }
        if (empty($posted_code)) {
            $errors[] = 'Prosze wpisac kod z SMSa/przelewu.';
        }
        if (!$account->isLoaded()) {
            $errors[] = 'Konto/konto postaci o podanym nicku nie istnieje.';
        }
        if (count($errors) == 0) {
            if ($config['site']['verify_code_shop']) {
     }
 }
 if (empty($newchar_errors)) {
     $check_name_in_database = $ots->createObject('Player');
     $check_name_in_database->find($newchar_name);
     if ($check_name_in_database->isLoaded()) {
         $newchar_errors[] .= 'Esse nome já está em uso. Por favor escolha um outro nome!';
     }
     $number_of_players_on_account = $account_logged->getPlayersList()->count();
     if ($number_of_players_on_account >= $config['site']['max_players_per_account']) {
         $newchar_errors[] .= 'Você tem muitos personagens em sua conta <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 OTS_Player();
     $char_to_copy->find($char_to_copy_name);
     if (!$char_to_copy->isLoaded()) {
         $newchar_errors[] .= 'Configuração de caracteres inválida. O caractere <b>' . $char_to_copy_name . '</b> não existe.';
     }
 }
 if (empty($newchar_errors)) {
     if ($newchar_sex == "0") {
         $char_to_copy->setLookType(136);
     }
     $player = $ots->createObject('Player');
     $player->setName($newchar_name);
     $player->setAccount($account_logged);
     $player->setGroup($char_to_copy->getGroup());
     $player->setSex($newchar_sex);
     $player->setVocation($char_to_copy->getVocation());
예제 #10
0
function delete_player($name)
{
    $SQL = $GLOBALS['SQL'];
    $player = new OTS_Player();
    $player->find($name);
    if ($player->isLoaded()) {
        try {
            $SQL->query("DELETE FROM player_skills WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM guild_invites WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_items WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_depotitems WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_spells WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_storage WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_viplist WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_deaths WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_deaths WHERE killed_by = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        $rank = $player->getRank();
        if (!empty($rank)) {
            $guild = $rank->getGuild();
            if ($guild->getOwner()->getId() == $player->getId()) {
                $rank_list = $guild->getGuildRanksList();
                if (count($rank_list) > 0) {
                    $rank_list->orderBy('level');
                    foreach ($rank_list as $rank_in_guild) {
                        $players_with_rank = $rank_in_guild->getPlayersList();
                        $players_with_rank->orderBy('name');
                        $players_with_rank_number = count($players_with_rank);
                        if ($players_with_rank_number > 0) {
                            foreach ($players_with_rank as $player_in_guild) {
                                $player_in_guild->setRank();
                                $player_in_guild->save();
                            }
                        }
                        $rank_in_guild->delete();
                    }
                    $guild->delete();
                }
            }
        }
        $player->delete();
        return TRUE;
    }
}
예제 #11
0
 if ($buy_offer['type'] == 'changename') {
     if (!check_name_new_char($buy_from)) {
         $main_content .= 'Invalid name format of new name.';
     }
 } else {
     $buy_offer = getItemByID($buy_id);
     $check_name_in_database = $ots->createObject('Player');
     $check_name_in_database->find($buy_from);
     if ($buy_offer['type'] == 'changename') {
         if (!$check_name_in_database->isLoaded()) {
         }
     }
     if (isset($buy_offer['id'])) {
         if ($user_premium_points >= $buy_offer['points']) {
             if (check_name($buy_name)) {
                 $buy_player = new OTS_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') {
                         # pacc
                         if ($buy_offer['type'] == 'pacc') {
                             $player_premdays = $buy_player_account->getCustomField('premdays');
                             $player_lastlogin = $buy_player_account->getCustomField('lastday');
                             $save_transaction = 'INSERT INTO ' . $SQL->tableName('z_shop_history_pacc') . ' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, ' . $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['days']) . ', \'realized\', ' . $SQL->quote(time()) . ', ' . $SQL->quote(time() + $buy_offer['days'] * 24 * 60 * 60) . ');';
                             $SQL->query($save_transaction);
                             $buy_player_account->setCustomField('premdays', $player_premdays + $buy_offer['days']);
                             $account_logged->setCustomField('premium_points', $user_premium_points - $buy_offer['points']);
                             $user_premium_points = $user_premium_points - $buy_offer['points'];
                             if ($player_premdays == 0) {
                                 $buy_player_account->setCustomField('lastday', time());
예제 #12
0
파일: lostaccount.php 프로젝트: s3kk/Gesior
					<INPUT TYPE=image NAME="Submit" ALT="Submit" SRC="' . $layout_name . '/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
					</TD></TR></FORM></TABLE></TABLE>';
        }
    } elseif ($action == 'setnewpassword') {
        $newpassword = $_REQUEST['passor'];
        $code = $_REQUEST['code'];
        $character = stripslashes($_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 OTS_Player();
            $account = new OTS_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(password_ency($newpassword));
                        $account->save();
                        $account->setCustomField('email_code', '');
                        $main_content .= 'New password to your account is below. Now you can login.<BR>
					<INPUT TYPE=hidden NAME="character" VALUE="' . $character . '">
					<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
					<TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" CLASS=white><B>Changed password</B></TD></TR>
예제 #13
0
파일: customs.php 프로젝트: Tobbebror/POT
<?php

// to not repeat all that stuff
include 'quickstart.php';
// creates new OTS_Player object
$player = new OTS_Player();
// sets basic fields
$player->setName('Wrzasq');
$player->setSex(POT::SEX_MALE);
$player->setVocation(POT::VOCATION_KNIGHT);
/* etc... */
/*
this is bad! we can't call this now as we dont have object ID assinged yet

$player->setCustomField('my_field', 2);

must save before that to get automatic ID:
*/
$player->save();
// now we can call that:
// 2 won't be quoted - it's integer
$player->setCustomField('my_field', 2);
// 3 will be quoted - '3' is a string!
$player->setCustomField('another_field', '3');
예제 #14
0
파일: delete.php 프로젝트: Tobbebror/POT
<?php

// to not repeat all that stuff
include 'quickstart.php';
// creates new player object
$player = new OTS_Player('Wrzasq');
// deletes player
$player->delete();
// as player was deleted this will insert new row into database but all data will be restored
$player->save();
예제 #15
0
 /**
  * @version 0.0.5
  * @param OTS_Player $player Player to be deleted.
  * @deprecated 0.0.5 Use OTS_Player->delete().
  */
 public function deletePlayer(OTS_Player $player)
 {
     $this->db->query('DELETE FROM ' . $this->db->tableName('players') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $player->getId());
 }
예제 #16
0
 /**
  * Sets house auction player_id winner.
  * 
  * <p>
  * This method only updates object state. To save changes in database you need to use {@link OTS_House::save() save() method} to flush changes to database.
  * </p>
  * 
  * @version 0.1.0
  * @since 0.2.0b+SVN
  * @param OTS_Player $player House auction player_id winner
  * @throws E_OTS_NotLoaded If given <var>$player</var> object is not loaded.
  */
 public function setPlayerId(OTS_Player $player)
 {
     $this->data['player_id'] = $player->getId();
 }
예제 #17
0
 public function view($name = null)
 {
     $ide = new IDE();
     if (!empty($name)) {
         $data['character'] = $name;
         $ots = POT::getInstance();
         $ots->connect(POT::DB_MYSQL, connection());
         $player = $ots->createObject('Player');
         $player->find($name);
         if (!$player->isLoaded()) {
             $ide->redirect("../../character/view/");
         } else {
             $data['player'] = $player;
             $data['account'] = $player->getAccount();
         }
         $this->load->view('view_character.php', $data);
     } else {
         $this->load->helper("form");
         if ($_POST) {
             $name = $_POST['name'];
             $ots = POT::getInstance();
             $ots->connect(POT::DB_MYSQL, connection());
             $player = new OTS_Player();
             $player->find($name);
             if ($player->isLoaded()) {
                 $ide->redirect("../character/view/{$name}");
             } else {
                 error("{$name} could not be found.");
             }
         }
         $this->load->view('character_search.php');
     }
 }
예제 #18
0
if (isset($server_config['mysqlHost'])) {
    //new (0.2.6+) ots config.lua file
    $mysqlhost = $server_config['mysqlHost'];
    $mysqluser = $server_config['mysqlUser'];
    $mysqlpass = $server_config['mysqlPass'];
    $mysqldatabase = $server_config['mysqlDatabase'];
    $sqlitefile = $server_config['sqliteDatabase'];
} elseif (isset($server_config['sqlHost'])) {
    //old (0.2.4) ots config.lua file
    $mysqlhost = $server_config['sqlHost'];
    $mysqluser = $server_config['sqlUser'];
    $mysqlpass = $server_config['sqlPass'];
    $mysqldatabase = $server_config['sqlDatabase'];
    $sqlitefile = $server_config['sqliteDatabase'];
}
// loads #####POT mainfile#####
include '../pot/OTS.php';
// PDO and POT connects to database
$ots = POT::getInstance();
if ($server_config['sqlType'] == "mysql") {
    $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase));
} elseif ($server_config['sqlType'] == "sqlite") {
    $ots->connect(POT::DB_SQLITE, array('database' => $config_ini['server_path'] . $sqlitefile));
}
$name_db = new OTS_Player();
$name_db->find($name);
if ($name_db->isLoaded()) {
    echo '<font color="red"><b>Já existe um personagem com esse nome.</b></font>';
} else {
    echo '<font color="green">O seu nome será: "<b>' . ucwords($name) . '</b>"</font>';
}
예제 #19
0
// Give the equipments a background.
$MadGD->setEquipmentBackground(BASEPATH_SIGNATURE . 'images/equipments.png');
// Give the signature a default font style.
$MadGD->setDefaultStyle(BASEPATH_SIGNATURE . 'data/fonts/arial.ttf', BASEPATH_SIGNATURE . 'data/fonts/arialbd.ttf', 8);
// Secure the name against SQL injections.
$name = isset($_GET['name']) ? $_GET['name'] : null;
// Create a few necessary variables.
list($row, $height) = array(0.5, 14);
// Instantiate a new POT object.
$ots = POT::getInstance();
// Connect to the database.
$ots->connect(POT::DB_MYSQL, connection());
// Create a variable holding the database handle.
$SQL = POT::getInstance()->getDBHandle();
// Instantiate a new OTS_PLAYER object.
$character = new OTS_Player();
// Find a player.
$character->find($name);
// Return false in case a player was not found.
if (!$character->isLoaded()) {
    // Send the headers.
    header('Content-type: image/png');
    // Include the cache file.
    include BASEPATH_SIGNATURE . 'images/false-character.png';
    exit;
}
// Get all the cache images.
$cacheImages = scandir(BASEPATH_SIGNATURE . 'cache/');
// Loop through all of the cache images.
foreach ($cacheImages as $cacheImage) {
    // Continue along until you find a matching cache image.
예제 #20
0
파일: items.php 프로젝트: Tobbebror/POT
<?php

// to not repeat all that stuff
include 'quickstart.php';
// loads item typing information
// dont use POT::getInstance() anymore
POT::loadItems('/path/to/your/ots/data/items');
// creates new player object
$player = new OTS_Player();
$player->find('Wrzasq');
/*
    Items loading example.
*/
// loading item from ammunition slot
$item = $player->getSlot(POT::SLOT_AMMO);
echo $player->getName(), ' has item with id ', $item->getId(), ' in his/her ammo slot.', "\n";
// checks if item is a container
if ($item instanceof OTS_Container) {
    // list backpack content
    foreach ($item as $inside) {
        echo 'Container contains item with id ', $inside->getId(), '.', "\n";
    }
}
/*
    Items tree composing example.
*/
// creates container - here it would be a depot locker (we pass ID of item to create)
$container = new OTS_Container(2590);
// now let's create depot chest
$chest = new OTS_Container(2594);
// let's put chest inside locker
예제 #21
0
파일: adminpanel.php 프로젝트: s3kk/Gesior
                }
            }
        }
        $main_content .= '<div id="form" style="background: ' . $config['site']['darkborder'] . ';border: 1px solid black;margin: 5px auto;width: 80%;padding: 5px;"><center><b>Form place.</b></center></div>';
        $main_content .= '<table border="0" CELLPADDING=4 CELLSPACING=1 style="border: 1px solid black;margin: 0 auto;width: 80%;">
<TR BGCOLOR="' . $config['site']['vdarkborder'] . '" style="color: white;">
<tr bgcolor=\'#505050\'><td colspan=\'2\' class=\'white\'><center><b>Other systems</b></center></td></tr>
<tr bgcolor=' . $config['site']['lightborder'] . '><td width="150"><b><a href="?subtopic=adminpanel&action=install_monsters">Reload Monsters</a></b></td><td><small><b>Load information about monsters from directory "/data/monsters/".</b></small> <b><small>[Delete old mosters configuration!]</small></b></td></tr>
<tr bgcolor=' . $config['site']['darkborder'] . '><td width="150"><b><a href="?subtopic=adminpanel&action=install_spells">Reload Spells</a></b></td><td><small><b>Load information about spells from file "/data/spells/spells.xml".</b></small><br/><b><small>[Delete old spells configuration!]</small></b></td></tr>
<tr bgcolor=' . $config['site']['darkborder'] . '><td width="150"><b><a href="?subtopic=adminpanel&action=npc_check_by_mappingfor&lng=en">Check NPCs</a> [EN]</b></td><td><b><small>Check items prices.</small></b></td></tr>
</table><br/>';
    }
    if (!empty($_GET['name'])) {
        $name = $_GET['name'];
        $name_new = $_GET['name_new'];
        $player = new OTS_Player();
        $player->find($name);
        if ($player->isLoaded() && $player->isNameLocked()) {
            if ($name_new == $player->getOldName()) {
                if ($action == 'accept') {
                    $main_content .= '<font color="green">Changed name from <b>' . $player->getName() . '</b> to <b>' . $player->getOldName() . '</b>.</font>';
                    $player->setCustomField('old_name', $player->getName());
                    $player->setCustomField('name', $player->getOldName());
                    $player->setCustomField('nick_verify', 1);
                    $player->removeNameLock();
                } elseif ($action == 'reject') {
                    $main_content .= '<font color="green">Rejected proposition of change name from <b>' . $player->getName() . '</b> to <b>' . $player->getOldName() . '</b>.</font>';
                    $player->setCustomField('old_name', '');
                }
            } else {
                $main_content .= '<font color="red">Invalid new name. Try again.</font><br>';
예제 #22
0
 } else {
     $bgcolor = $config['site']['lightborder'];
 }
 $number_of_rows++;
 $main_content .= '<TR BGCOLOR="' . $bgcolor . '"><TD>Sex:</TD><TD>';
 $main_content .= $player->getSex() == 0 ? 'female' : 'male';
 $main_content .= '</TD></TR>';
 if ($config['site']['show_marriage_info']) {
     if (is_int($number_of_rows / 2)) {
         $bgcolor = $config['site']['darkborder'];
     } else {
         $bgcolor = $config['site']['lightborder'];
     }
     $number_of_rows++;
     $main_content .= '<TR BGCOLOR="' . $bgcolor . '"><TD>Marital status:</TD><TD>';
     $marriage = new OTS_Player();
     $marriage->load($player->getMarriage());
     if ($marriage->isLoaded()) {
         $main_content .= 'married to <a href="?subtopic=characters&name=' . urlencode($marriage->getName()) . '"><b>' . $marriage->getName() . '</b></a></TD></TR>';
     } else {
         $main_content .= 'single</TD></TR>';
     }
 }
 if (is_int($number_of_rows / 2)) {
     $bgcolor = $config['site']['darkborder'];
 } else {
     $bgcolor = $config['site']['lightborder'];
 }
 $number_of_rows++;
 $main_content .= '<TR BGCOLOR="' . $bgcolor . '"><TD>Profession:</TD><TD>' . $vocation_name[$player->getWorld()][$player->getPromotion()][$player->getVocation()] . '</TD></TR>';
 if (is_int($number_of_rows / 2)) {
예제 #23
0
 /**
  * Assigns guild to owner.
  * 
  * <p>
  * This method only updates object state. To save changes in database you need to use {@link OTS_Guild::save() save() method} to flush changed to database.
  * </p>
  * 
  * @param OTS_Player $owner Owning player.
  * @throws E_OTS_NotLoaded If given <var>$owner</var> object is not loaded.
  */
 public function setOwner(OTS_Player $owner)
 {
     $this->data['ownerid'] = $owner->getId();
 }
예제 #24
0
</table>
</center>';
                        }
                    } else {
                        $buy_offer = getItemByID($buy_id);
                        $check_name_in_database = $ots->createObject('Player');
                        $check_name_in_database->find($buy_from);
                        if ($buy_offer['type'] == 'changename') {
                            if (!$check_name_in_database->isLoaded()) {
                            }
                        }
                        if (isset($buy_offer['id'])) {
                            //item exist in database
                            if ($user_premium_points >= $buy_offer['points']) {
                                if (check_name($buy_name)) {
                                    $buy_player = new OTS_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'] == 'pacc') {
                                                $player_premdays = $buy_player_account->getCustomField('premdays');
                                                $player_lastlogin = $buy_player_account->getCustomField('lastday');
                                                $save_transaction = 'INSERT INTO ' . $SQL->tableName('z_shop_history_pacc') . ' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, ' . $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['days']) . ', \'realized\', ' . $SQL->quote(time()) . ', ' . $SQL->quote(time()) . ');';
                                                $SQL->query($save_transaction);
                                                $buy_player_account->setCustomField('premdays', $player_premdays + $buy_offer['days']);
                                                $account_logged->setCustomField('premium_points', $user_premium_points - $buy_offer['points']);
                                                $user_premium_points = $user_premium_points - $buy_offer['points'];
                                                $color1 = 'green';
                                                $color2 = 'green';
                                                $color3 = 'green';
예제 #25
0
파일: player.php 프로젝트: Tobbebror/POT
<?php

// to not repeat all that stuff
include 'quickstart.php';
// creates new player object
$player = new OTS_Player();
// loads player
$player->find('Wrzasq');
// this does the same
$player2 = new OTS_Player('Wrzasq');
// checks if player exists
if ($player->isLoaded()) {
    // prints character info
    echo 'Player \'' . $player->getName() . '\' has ' . $player->getLevel() . ' level.', "\n";
    // example of retriving associated objects
    echo 'Player \'' . $player->getName() . '\' is member of ' . $player->getGroup()->getName() . ' group.', "\n";
} else {
    echo 'Player does not exists.', "\n";
}
예제 #26
0
            $main_content .= "Nenhuma guild foi encontrada.";
        }
    } else {
        $main_content .= "Você não está logado.";
    }
    $main_content .= '<br><br><center><form action="index.php?subtopic=guilds" METHOD=post><INPUT TYPE=image NAME="Back" ALT="Back" SRC="' . $layout_name . '/images/buttons/sbutton_back.gif" BORDER="0" WIDTH="120" HEIGHT="18"></FORM></center>';
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if ($action == 'change_nick') {
    if ($logged) {
        $player_n = stripslashes($_REQUEST['name']);
        $new_nick = stripslashes($_REQUEST['nick']);
        $player = new OTS_Player();
        $player->find($player_n);
        $player_from_account = FALSE;
        if (strlen($new_nick) <= 40) {
            if ($player->isLoaded()) {
                $account_players = $account_logged->getPlayersList();
                if (count($account_players)) {
                    foreach ($account_players as $acc_player) {
                        if ($acc_player->getId() == $player->getId()) {
                            $player_from_account = TRUE;
                        }
                    }
                    if ($player_from_account) {
                        $player->setGuildNick($new_nick);
                        $player->save();
                        $main_content .= '<TABLE BORDER="0" CELLSPACING="1" CELLPADDING="5" WIDTH="100%">
예제 #27
0
파일: OTS_Death.php 프로젝트: Tobbebror/POT
 /**
  * Sets death's victim.
  * 
  * <p>
  * This method only updates object state. To save changes in database you need to use {@link OTS_Death::save() save() method} to flush changes to database.
  * </p>
  * 
  * <p>
  * This method also automaticly sets level to player's level, so you don't need to call {@link OTS_Death::setLevel() setLevel() method} by yourself.
  * </p>
  * 
  * @version 0.2.0+SVN
  * @since 0.2.0+SVN
  * @param OTS_Player $player Victim.
  */
 public function setPlayer(OTS_Player $player)
 {
     $this->data['player_id'] = $player->getId();
     $this->data['level'] = $player->getLevel();
 }