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'; $color4 = 'green'; $color5 = 'green'; $main_content .= ' <div id="ProgressBar" > <center><h2>Comprar Item</h2></center> <div id="MainContainer" > <div id="BackgroundContainer" > <img id="BackgroundContainerLeftEnd" src="' . $layout_name . '/images/vips/stonebar-left-end.gif" />
<?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
$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)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder'];
$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>.'; $addtolink = '&action=show&guild=' . $player->getRank()->getGuild()->getId(); } else { $main_content .= 'This player is not from your account.'; } } else { $main_content .= 'This player is not from your account.'; } } else { $main_content .= 'Unknow error occured.'; } } else { $main_content .= 'Too long guild nick. Max. 30 chars, your: ' . strlen($new_nick); } } else { $main_content .= 'You are not logged.';
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()); } $main_content .= '<h2>PACC added!</h2><b>' . $buy_offer['days'] . ' days</b> of Premium Account added to account of player <b>' . $buy_player->getName() . '</b> 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="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a>'; } elseif ($buy_offer['type'] == 'unban') { $my_acc_id = $account_logged->getCustomField('id'); $datadata = $SQL->query('SELECT * FROM ' . $SQL->tableName('bans') . ' WHERE value = ' . $my_acc_id . ';')->fetch(); if ($datadata['value'] == $my_acc_id) { if ($SQL->query('DELETE FROM bans WHERE value= ' . $my_acc_id . ' LIMIT 1;')) { } else { $SQL->query('DELETE FROM bans WHERE account= ' . $my_acc_id . ' LIMIT 1;');
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 = '" . str_replace("'", "\\'", $player->getName()) . "';"); } 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; } }
$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%"> <tr BGCOLOR="' . $config['site']['vdarkborder'] . '"> <td CLASS="white"><b><center>Mensagem</center></b></td> </tr> <tr BGCOLOR=' . $config['site']['darkborder'] . '> <td><center>O nick do membro <b>' . $player->getName() . '</b> foi trocada para <b>' . htmlentities($new_nick) . '</b></center>.</td> </tr> </TABLE>'; $addtolink = '&action=show&guild=' . $player->getRank()->getGuild()->getId(); } else { $main_content .= 'Esse personagem não é da sua conta.'; } } else { $main_content .= 'Esse personagem não é da sua conta.'; } } else { $main_content .= 'Erro. Contate um admin pelo ticket de atendimento.'; } } else { $main_content .= 'Esse nick é muito longo. Máximo: 30 letras. Você escreveu: ' . strlen($new_nick) . ' letras.'; }
<?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"; }
<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>'; } } else { $main_content .= '<font color="red">Player with this name doesn\'t exist or isn\'t namelocked.</font><br>'; } }
// Check if the lastUpdate + the cache update time is more than the current time. if ($pieces[0] + $cacheTime > time()) { // Send the headers. header('Content-type: image/png'); // Include the cache file. include BASEPATH_SIGNATURE . 'cache/' . $cacheImage; exit; } else { // Remove the current cache file. unlink(BASEPATH_SIGNATURE . 'cache/' . $cacheImage); break; } } // Player Name $MadGD->addText('Name:', $MadGD->textBold)->setPosition(10, $row * $height); $MadGD->addText($character->getName(), $character->isOnline() ? array('color' => '5df82d') : array())->setPosition(); $row++; // Player Sex $MadGD->addText('Sex:', $MadGD->textBold)->setPosition(10, $row * $height); $MadGD->addText($character->getSex() == 1 ? 'male' : 'female')->setPosition(); $row++; // Player Profession $MadGD->addText('Profession:', $MadGD->textBold)->setPosition(10, $row * $height); $MadGD->addText($config['vocations'][$character->getVocation()])->setPosition(); $row++; // Player Level $MadGD->addText('Level:', $MadGD->textBold)->setPosition(10, $row * $height); $MadGD->addText($character->getLevel())->setPosition(); $row++; // Player World $MadGD->addText('World:', $MadGD->textBold)->setPosition(10, $row * $height);