function movenpc() { // select an NPC/creature to move - let's pick the one that hasn't moved in the longest time $result = mysql_query("SELECT id FROM phaos_characters WHERE username='******' ORDER BY stamina_time LIMIT 1"); if ($row = mysql_fetch_array($result)) { $npc = new character($row["id"]); defined('DEBUG') and DEBUG and $GLOBALS['debugmsgs'][] = " trying to relocate {$npc->name}({$npc->id}) at {$npc->location} with stamina_time={$npc->stamina_time}"; // let NPC heal HP and stamina if ($npc->hit_points < $npc->max_hp) { $npc->hit_points += (int) ($npc->max_hp / 5); // heal 20% if ($npc->hit_points > $npc->max_hp) { $npc->hit_points = $npc->max_hp; } } if ($npc->stamina_points < $npc->max_stamina) { $npc->stamina_points += 3; // 3 at a time -- perhaps this should be calc another way if ($npc->stamina_points > $npc->max_stamina) { $npc->stamina_points = $npc->max_stamina; } } // reset stamina and regen time $npc->stamina_time = time() + 1000; // FIXME: using 1000 as temp amount $npc->regen_time = time() + 1000; // FIXME: using 1000 as temp amount if ($npc->location != 0) { $npc->relocate((int) rand(1, 8)); } if ($npc->location == 0) { $condition_pass = $npc->sql_may_pass(); // how did he get here?? -- let's put him at a random location defined('DEBUG') and DEBUG and $GLOBALS['debugmsgs'][] = " trying to relocate {$npc->name}({$npc->id}) at {$npc->location} with stamina_time={$npc->stamina_time}"; $result = mysql_query("SELECT `id` FROM phaos_locations WHERE {$condition_pass} ORDER BY RAND() LIMIT 1") or die(mysql_error()); list($newloc) = mysql_fetch_array($result); $npc->place($newloc); } // now we can update the DB $query = "UPDATE phaos_characters SET\n\t\t\thit_points\t=" . $npc->hit_points . ",\n\t\t\tstamina\t\t=" . $npc->stamina_points . ",\n\t\t\tstamina_time\t=" . $npc->stamina_time . ",\n\t\t\tregen_time\t=" . $npc->regen_time . "\n\t\t\tWHERE id\t='" . $npc->id . "'"; $result = mysql_query($query); if (!$result) { echo "{$query}:<B>Error " . mysql_errno() . " :</B> " . mysql_error() . ""; exit; } } else { // didn't set $row from sql query die("why could we not select a creature to move?"); } }
function __construct($id) { global $config, $mysql, $_SYSTEM; $this->id = -1; $r = $mysql->getRow("SELECT guild.guildid as id,guild.name,guild.leaderguid,characters.race,characters.class,characters.name as leader,characters.guid as leader_guid,mid(lpad( hex( CAST(substring_index(substring_index(characters.data,' ',23),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `guild` inner join `characters` on guild.leaderguid = characters.guid where guild.guildid = ?1", $id, 'char'); if ($r['id']) { $this->id = $r['id']; } else { return; } $this->name = $r['name']; $this->leader_guid = $r['leader_guid']; $this->leader = $r['leader']; $this->faction = character::getAlliance($r['race']); $this->leader_race = $r['race']; $this->leader_class = $r['class']; $this->leader_gender = $r['gender']; $this->realm = $_SYSTEM->Realms[$_SYSTEM->Realm]; $this->realmID = $_SYSTEM->Realm; $this->members = mysql_result($mysql->query("SELECT count(*) FROM `guild_member` WHERE guildid = ?1", $this->id, 'char'), 0) or $this->members = 0; $r = $mysql->getRows("select rname,rid from guild_rank where guildid = ?1", $this->id, 'char'); if ($r) { foreach ($r as $row) { $this->ranks[$row['rid']] = $row['rname']; } } $r = $mysql->getRows("select guid,race,class,?3 as level,?4 as gender,name from characters where ?1 = ?2", SQL_template(CHAR_GUILD_OFFSET), $this->id, SQL_template(CHAR_LEVEL_OFFSET), CHAR_GENDER_OFFSET, 'char'); if ($r) { foreach ($r as $key => $row) { foreach ($row as $c => $col) { $this->membersList[$key][$c] = $col; } } } }
public function __unset($var) { $var = null; if ($var = script_variable::get($this->script_name, $var, character::current()->id, false)) { $var->remove(); } }
function load_arenateams() { global $config, $mysql; $this->Types = array(2, 3, 5); foreach ($this->Types as $t) { $this->ArenaTeams[$t] = array(); $r[$t] = $mysql->getRows("select arena_team.arenateamid, arena_team.name, arena_team.type, arena_team.captainguid, characters.race from arena_team inner join characters on arena_team.captainguid = characters.guid where type = ?1 limit 50", $t, 'char'); if (!$r[$t]) { continue; } foreach ($r[$t] as $i => $row) { $arenalist .= $row['arenateamid'] . ','; foreach ($row as $key => $value) { if ($key == 'race') { $this->ArenaTeams[$t][$i]['faction'] = character::getAlliance($value); } else { $this->ArenaTeams[$t][$i][$key] = $value; } } } } $this->load_arena_members($arenalist); $this->load_arena_stats($arenalist); $this->arena_sort(); }
public function log_out_action() { account::log_out(); //is the character still logged in? if yes, log it out if (character::selected()) { character::unselect(); } page::redirect(); }
function getStatisticsList($cat) { global $character, $mysql; $r = $mysql->getRows("select * from achievement where categoryId = ?1 AND (factionFlag = ?2 OR factionFlag = '-1') order by OrderInCategory", $cat, $character->getAlliance(), 'armory'); if (!$r) { exit; } foreach ($r as $row) { $achi[$row['id']]['ref'] = $row['refAchievement'] ? $row['refAchievement'] : $row['id']; $crit .= $achi[$row['id']]['ref'] . ','; $achi[$row['id']]['date'] = $character->achievement[$row['id']]; $achi[$row['id']]['progress'] = $character->achievement_progress; $achi[$row['id']]['name'] = $row['name']; $achi[$row['id']]['sort'] = $row['OrderInCategory']; $achi[$row['id']]['criteria'] = array(); $achi[$row['id']]['show'] = 1; $achi[$row['id']]['parent'] = $row['unk1']; } $r = $mysql->getRows("select * from achievement_criteria where referredAchievement IN (?1-1)", $crit, 'armory'); foreach ($achi as $key => $a) { foreach ($r as $row) { if ($row['referredAchievement'] == $a['ref']) { array_push($achi[$key]['criteria'], $row); } } } $r = $mysql->getRow("select name from achievement_category where id = ?1", $cat, 'armory'); echo '<div class="cat_header">' . $r['name'] . '</div>'; foreach ($achi as $achi_id => $a) { $i++; $pr = 0; if (count($a['criteria']) == 1) { foreach ($a['criteria'] as $crit) { $pr = $a['progress'][$crit['id']]['counter'] ? $a['progress'][$crit['id']]['counter'] : '--'; } } else { foreach ($a['criteria'] as $crit) { if (!$crit['name'] && $a['progress'][$crit['id']]['counter'] >= $crit['value']) { $pr++; } else { if ($crit['name'] && $cat != 147) { $pr += $a['progress'][$crit['id']]['counter']; } else { if ($crit['name'] && $a['progress'][$crit['id']]['counter'] >= $crit['value']) { $pr = $crit['name']; } } } } } if (in_array($achi_id, array(328, 753, 326, 333, 919, 334, 921, 1146, 1147, 1148, 331, 332, 1150))) { $pr = character::getGold($pr); } echo '<div class="stat_row ' . ($i % 2 ? 'zebra' : '') . '"><div style="float: right;"> ' . $pr . '</div>' . $a['name'] . '</div>'; } }
public static function apply($name, array $args = array(), $char = null) { $char = character::get($char); $callbacks = static::callbacks(); if (!$callbacks || !isset($callbacks[$name])) { return false; } $callback = $callbacks[$name]; $callback($args, $char); }
public function index_action() { $char = character::current(); $mapId = $char->map_id; $map = map::load_one($mapId); if (!$map) { page::redirect('/world/map-not-found'); } $this->set('map', $map); }
public static function create($name, $character = null) { $char = character::get($character); $build = new static(); $build->char_id = $char->id; $build->name = $name; $build->strength = 5; $build->dexterity = 5; $build->wisdom = 5; $build->vitality = 5; $build->save(); return $build; }
function makeAllTrees($classId) { $className = str_replace(' ', '', character::classToString($classId)); for ($i = 0; $i < 3; $i++) { $TreeData = self::getTreeData($classId, $i); $TreeData['nameESC'] = str_replace(array(' ', "'"), '', $TreeData['name']); $output .= '<div class="talentTree" id="' . $className . $TreeData['nameESC'] . '_tree" style="margin-right: 0px; background-image: url(\'images/talents/bg/' . $className . $TreeData['nameESC'] . '.jpg\')">'; $output .= self::makeTree($className, $TreeData); $output .= '<a class="subtleResetButton" href="javascript:void(0)" onclick="resetTalents(\'' . $className . $TreeData['nameESC'] . '_tree\', true);"><span>Reset</span></a> <div class="talentTreeInfo" style=""> <span id="treeName_' . $className . $TreeData['nameESC'] . '_tree" style="font-weight: bold;">' . $TreeData['name'] . '</span> <span id="treespent_' . $className . $TreeData['nameESC'] . '_tree">0</span> </div> </div>'; } return $output; }
function __construct($id) { global $config, $mysql, $_SYSTEM; $this->id = -1; $r = $mysql->getRow("SELECT guild.guildid as id,guild.name,guild.leaderguid,characters.race,characters.class,characters.name as leader,characters.guid as leader_guid,mid(lpad( hex( CAST(substring_index(substring_index(characters.data,' ',23),' ',-1) as unsigned) ),8,'0'),4,1) as gender FROM `guild` inner join `characters` on guild.leaderguid = characters.guid where guild.guildid = ?1", $id, 'char'); if ($r['id']) { $this->id = $r['id']; } else { return; } $this->name = $r['name']; $this->leader_guid = $r['leader_guid']; $this->leader = $r['leader']; $this->faction = character::getAlliance($r['race']); $this->leader_race = $r['race']; $this->leader_class = $r['class']; $this->leader_gender = $r['gender']; $this->realm = $_SYSTEM->Realms[$_SYSTEM->Realm]; $this->realmID = $_SYSTEM->Realm; $this->members = mysql_result($mysql->query("SELECT count(*) FROM `guild` WHERE guildid = ?1", $this->id, 'char'), 0) or $this->members = 0; }
public function select_action($id) { character::unselect(); if (!account::logged_in()) { page::redirect('/account/not-logged-in'); } if ($id) { $id = (int) $id; $q = db::query('select count(*) from ' . character::table_name() . ' where id=? and account_id=?', $id, account::current()->id); $count = $q->fetchColumn(0); if (!$count) { //character doesn't exist or this isn't your character, reload //the character selection (AND DONT TRY TO F**K WITH ME!) page::redirect('/character/select'); } character::select($id); page::redirect('/world'); } $characters = character::load(account::current()->id, 'account_id'); $this->set('characters', $characters->fetchAll()); }
public static function format($string, $character = null) { if (!$character) { if (!character::selected()) { return $string; } $character = character::current(); } static $tokens = null; if (!$tokens) { $tokens = static::format_tokens(); } $text = preg_replace_callback('#\\{(?<token>[^\\}]+)\\}#', function ($result) use($tokens, $character) { $token = $result['token']; if (isset($tokens[$token])) { $func = $tokens[$token]; return call_user_func($func, $character); } return 'undefined'; }, $string); return $text; }
function start() { global $config, $SQL, $mysql, $_SYSTEM; $WHERE = 'WHERE '; if ($this->name != '') { $WHERE .= 'arena_team.name LIKE \'%' . $this->name . '%\' AND '; } $WHERE .= '1=1'; $il = $this->per_page; $st = $this->per_page * $this->page; $LIMIT = 'LIMIT ' . $st . ', ' . $il; $data = array(); $i = 0; foreach ($_SYSTEM->Realms as $rID => $rName) { $d = $mysql->getRows("SELECT arena_team.arenateamid as id,arena_team.name,arena_team.type,arena_team_stats.rating,characters.race FROM `arena_team`,`characters`,`arena_team_stats`\n\t\t\t\t{$WHERE} AND arena_team.arenateamid = arena_team_stats.arenateamid AND arena_team.captainguid = characters.guid\n {$LIMIT}", 'char_' . $rID); if (!$d) { continue; } $this->count += mysql_result($mysql->query("SELECT count(*) FROM `arena_team` {$WHERE}", 'char_' . $rID), 0) or $this->count = 0; foreach ($d as $r) { foreach ($r as $key => $value) { $data[$i][$key] = $value; } $data[$i]['realm'] = $rName; $data[$i]['faction'] = character::getAlliance($data[$i]['race']); $i++; } } return $data; }
</table> </form> <?php } if (isset($_POST['ir_step3'])) { $guid = (int) $_POST['ir_char']; $instance = (int) $_POST['ir_instance']; if ($GLOBALS['service'][$service]['currency'] == "vp") { if (account::hasVP($_SESSION['cw_user'], $GLOBALS['service'][$service]['price']) == FALSE) { echo '<span class="alert">You do not have enough Vote Points!'; } else { connect::selectDB($_POST['ir_realm']); mysql_query("DELETE FROM instance WHERE id='" . $instance . "'"); account::deductVP(account::getAccountID($_SESSION['cw_user']), $GLOBALS['service'][$service]['price']); echo '<span class="approved">The instance lock was removed!</span>'; } } elseif ($GLOBALS['service'][$service]['currency'] == "dp") { if (account::hasDP($_SESSION['cw_user'], $GLOBALS['service'][$service]['price']) == FALSE) { echo '<span class="alert">You do not have enough ' . $GLOBALS['donation']['coins_name']; } else { connect::selectDB($_POST['ir_realm']); mysql_query("DELETE FROM instance WHERE id='" . $instance . "'"); account::deductDP(account::getAccountID($_SESSION['cw_user']), $GLOBALS['service'][$service]['price']); echo '<span class="approved">The instance lock was removed!</span>'; account::logThis("Performed an Instance reset on " . character::getCharName($guid, server::getRealmId($_POST['ir_realm'])), "instancereset", server::getRealmId($_POST['ir_realm'])); } } } ?> <br/> <a href="?p=instancereset">Start over</a>
<?php require "php_resources/settings.php"; require "php_resources/character.php"; require "php_resources/chk.php"; require "php_resources/cli.php"; require "php_resources/player.php"; require "php_resources/webInteract.php"; require "php_resources/commandInterpreter.php"; //require "vendor/autoload.php" $cli = new cli(); //$cli = new cli(); $chk = new chk($cli); $commandInterpreter = new commandInterpreter($cli, $settings["commandList"]); $knettenba = new character($cli, "CAT", "Cat", 22, "Bugger all."); $arraything = $commandInterpreter->sliceInput($cli->out("You have a spanner, there is a nut.", "p")); $commandInterpreter->whichCommand($arraything); $arraything = $commandInterpreter->sliceInput($cli->out("You have a spanner, there is a nut.", "p")); $commandInterpreter->whichCommand($arraything); $arraything = $commandInterpreter->sliceInput($cli->out("You have a spanner, there is a nut.", "p")); $commandInterpreter->whichCommand($arraything); $arraything = $commandInterpreter->sliceInput($cli->out("You have a spanner, there is a nut.", "p")); $commandInterpreter->whichCommand($arraything); $arraything = $commandInterpreter->sliceInput($cli->out("You have a spanner, there is a nut.", "p")); $commandInterpreter->whichCommand($arraything); /* $flibble = $knettenba->ask("I SPEeAAK. MROWL."); echo $flibble; $knettenba->say("Hello, my name is ".$knettenba->getVar("name").".");
require 'init.php'; $c->add('main'); $c->assign('menu', $menu->output); $tp = new template(); $tp->add('item-info'); $itemData = $mysql->getRow("select * from item_template where entry = '?1'", (int) $_GET['i'], 'world'); if (!$itemData) { $_SYSTEM->error("Item not found!"); } $itemIcon = $mysql->getRow("select * from itemicon where itemnumber = ?1", $itemData['entry'], 'armory'); $itemIcon = validate_icon($itemIcon, $itemData['entry']); $tp->assign('itemicon', $itemIcon['itemicon']); $tp->assign('itemhtml', $itemIcon['itemhtml']); $tp->assign('itemcost', $itemData['BuyPrice'] ? '<span>Cost:</span><br>' . character::getGold($itemData['BuyPrice']) : ''); $tp->assign('sellfor', $itemData['SellPrice'] ? '<span>Sells for:</span><br>' . character::getGold($itemData['SellPrice']) : ''); if ($itemData['DisenchantID'] && $itemData['RequiredDisenchantSkill'] > -1) { $width = $itemData['RequiredDisenchantSkill'] / 450 * 100; $reqEnch = '<span>Disenchantable: </span><div class="skill-bar"> <b style="width: ' . $width . '%;"></b> <img class="staticTip" src="images/icons/icon-disenchant-sm.gif" onmouseover="setTipText(\'Requires <strong>' . $itemData['RequiredDisenchantSkill'] . '</strong> Enchanting to disenchant\');"> <strong class="staticTip" onmouseover="setTipText(\'Requires <strong>' . $itemData['RequiredDisenchantSkill'] . '</strong> Enchanting to disenchant\');">' . $itemData['RequiredDisenchantSkill'] . '</strong></div>'; } $tp->assign('reqenchanting', $reqEnch); $tp->assign('itemlevel', $itemData['ItemLevel'] . ($itemData['RequiredLevel'] > 0 ? ' (<span class="subClass">Req. ' . $itemData['RequiredLevel'] . '</span>)' : '')); // Drop $drop = $mysql->getRows("SELECT creature_template.name,creature_template.entry,creature_template.minlevel,creature_template.maxlevel,creature_loot_template.ChanceOrQuestChance\nFROM `creature_template`,`creature_loot_template`\nWHERE creature_template.entry = creature_loot_template.entry and creature_loot_template.item = ?1 order by creature_loot_template.ChanceOrQuestChance desc limit 20", $itemData['entry'], 'world'); if ($drop) { $dropTP = '<div class="rel-tab"><p class="rel-drop"/><h3>Dropped by:</h3></div> <div class="data" style="clear: both;"> <table class="data-table"><tbody><tr class="masthead"><td><a class="noLink">Name</a></td><td align="center"><a class="noLink">Level</a></td><td align="center"><a class="noLink">Location</a></td><td align="center"><a class="noLink">Drop Chance</a></td></tr>';
function start() { global $config, $SQL, $mysql, $_SYSTEM; $WHERE = 'WHERE '; if ($this->name != '') { $WHERE .= 'guild.name LIKE \'%' . $this->name . '%\' AND '; } $WHERE .= '1=1'; $il = $this->per_page + 1; $st = $this->per_page * $this->page; $LIMIT = 'LIMIT ' . $st . ', ' . $il; $data = array(); $i = 0; foreach ($_SYSTEM->Realms as $rID => $rName) { $d = $mysql->getRows("SELECT guild.guildid as id,guild.name,guild.leaderguid,characters.race,characters.name as leader,characters.guid as leader_guid\n FROM `guild` inner join `characters` on guild.leaderguid = characters.guid\n\t\t\t\t{$WHERE}\n {$LIMIT}", 'char_' . $rID); if (!$d) { continue; } $this->count += mysql_result($mysql->query("SELECT count(*) FROM `guild` {$WHERE}", 'char_' . $rID), 0) or $this->count = 0; foreach ($d as $r) { foreach ($r as $key => $value) { $data[$i][$key] = $value; } $ids .= $data[$i]['id'] . ','; $data[$i]['members'] = 0; $pos[$data[$i]['id']] = $i; $data[$i]['realm'] = $rName; $data[$i]['faction'] = character::getAlliance($data[$i]['race']); $i++; } if ($r = $mysql->getRows("select * from `guild_member` where guildid in (?1-1)", $ids, 'char_' . $rID)) { foreach ($r as $row) { $data[$pos[$row['guildid']]]['members']++; } } } return $data; }
foreach ($achi as $achi_id => $a) { $i = 0; if (!$a['show']) { continue; } echo '<div onclick="AchReq(' . $achi_id . ',this);" class="ach_' . ($a['date'] ? 'c' : '') . 'show"><div class="icon-frame"><img src="' . str_replace('ajax/', '', $_DOMAIN) . 'images/icon/' . $a['icon'] . '.jpg" class="ach_icon"></div><div class="ach_' . ($a['date'] ? 'c' : '') . 'point">' . $a['points'] . '</div><div class="ach_title">' . $a['name'] . '</div><div class="ach_desc">' . $a['description'] . '</div><div id="ach_req_' . $achi_id . '" class="ach_req"><ul>'; if (count($a['criteria']) == 1) { foreach ($a['criteria'] as $crit) { if ($crit['completionFlag'] & 2) { continue; } if (!$a['progress'][$crit['id']]['counter']) { $a['progress'][$crit['id']]['counter'] = 0; } echo '</ul>'; echo '<div class="ach_bar" style=" width:100%;"><div class="bar" style="width: ' . $a['progress'][$crit['id']]['counter'] / $crit['value'] * 100 . '%;"></div><div class="pr">' . (in_array($crit['id'], array(3506, 3507, 3510, 3511, 3512)) ? character::getGold($a['progress'][$crit['id']]['counter']) : $a['progress'][$crit['id']]['counter'] . ' / ' . $crit['value']) . '</div></div>'; } } else { foreach ($a['criteria'] as $crit) { if ($crit['completionFlag'] & 2) { continue; } echo '<li style="width:48%; float: ' . ($i % 2 ? 'right' : 'left') . ';" class="' . ($a['progress'][$crit['id']]['counter'] >= $crit['value'] ? 'done' : '') . '">' . $crit['name'] . '</li>'; $i++; } echo '</ul>'; } echo '<br clear="all"></div><div class="ach_date">' . ($a['date'] ? date("d-m-Y H:i", $a['date']) : '') . '</div>' . ($a['reward'] ? '<div class="ach_reward">' . $a['reward'] . '</div>' : '') . '</div>'; } } else { $bcat = $mysql->getRows("SELECT * FROM `achievement_category` WHERE `parent` = '-1' AND `id` <> 1 ORDER BY `sortOrder`", 'armory');
<?php header("content-type: text/xml"); $_FPREFIX = '../'; include '../init.php'; $_SEARCH = new search_character($_GET['name'], $_GET['lvl_down'], $_GET['lvl_up'], $_GET['guildid'], $_GET['class'], (int) $_GET['page']); $_SEARCH->set_sort($_GET['sort_by'], (int) $_GET['sort_asc']); $_SEARCH->Realm = (int) $_GET['RealmID'] ? (int) $_GET['RealmID'] : -1; $data = $_SEARCH->start(); $oc = count($data) - $_SEARCH->per_page; echo '<?xml version="1.0" encoding="utf-8"?> <characters> <overcount>' . $oc . '</overcount>' . "\n"; echo '<count>' . $_SEARCH->count . '</count>' . "\n"; for ($i = 0; $i < count($data) && $i < 3 * $_SEARCH->per_page; $i++) { if ($data[$i]['honor'] > 1000000000) { $data[$i]['honor'] = 0; } $temp = $data[$i]; echo '<character>' . "\n"; foreach ($temp as $key => $value) { if ($value == '') { $value = ' '; } echo '<' . $key . '>' . $value . '</' . $key . '>' . "\n"; } echo '<alliance>' . character::getAlliance($data[$i]['race']) . '</alliance>' . "\n" . '</character>' . "\n"; } echo '</characters>' . "\n";
<?php if ($_GET['name']) { if (!(int) $_GET['name']) { $data = $mysql->getRow("select guid from characters where name = '?1'", $_GET['name'], 'char'); $_GET['name'] = (int) $data['guid']; } } $character = character((int) $_GET['name']); $tp->assign('guid', $character->guid); $tp->assign('name', $character->name); $tp->assign('guid', $character->guid); $tp->assign('level', $character->level); $tp->assign('portrait_type', $character->level == 80 ? '-80' : ($character->level >= 70 ? '-70' : ($character->level >= 60 ? '' : '-default'))); $tp->assign('faction_name', $character->getAlliance() ? 'horde' : 'alliance'); $race = character::raceToString($character->race); $tp->assign('race', $race); if (strtolower($race) == 'undead') { $race = 'scourge'; } $tp->assign('race3D', strtolower(str_replace(' ', '', $race))); $tp->assign('class', $character->classToString($character->class)); $tp->assign('gender_nr', $character->gender); $tp->assign('gender3D', $character->gender ? 'female' : 'male'); $tp->assign('race_nr', $character->race); $tp->assign('class_nr', $character->class); $tp->assign('guild', $character->guild_id ? '<a class="charGuildName" href="guild-info.php?Realm={$realm}&name=' . $character->guild . '&characterName=' . $character->name . '">' . $character->guild . '</a>' : ''); $tp->assign('guildname', $character->guild); $tp->assign('guildtabdisplay', $character->guild_id ? '' : 'style="display:none;"'); $tp->assign('arenatabdisplay', $character->arena_team[2]['name'] || $character->arena_team[3]['name'] || $character->arena_team[5]['name'] ? '' : 'style="display:none;"'); $tp->assign('guild_name', $character->guild_id ? $character->guild : 'None');
public static function instant80($values) { die("This feature is disabled. <br/><i>Also, you shouldn't be here...</i>"); $values = mysql_real_escape_string($values); $values = explode("*", $values); connect::connectToRealmDB($values[1]); if (character::isOnline($values[0]) == TRUE) { echo '<b class="red_text">Please log out your character before proceeding.'; } else { $service_values = explode("*", $GLOBALS['service']['instant80']); if ($service_values[1] == "dp") { if (account::hasDP($_SESSION['cw_user'], $GLOBALS['service']['instant80']['price']) == FALSE) { echo '<b class="red_text">Not enough ' . $GLOBALS['donation']['coins_name'] . '</b>'; $error = true; } } elseif ($service_values[1] == "vp") { if (account::hasVP($_SESSION['cw_user'], $GLOBALS['service']['instant80']['price']) == FALSE) { echo '<b class="red_text">Not enough Vote Points.</b>'; $error = true; } } if ($error != true) { //User got coins. Boost them up to 80 :D connect::connectToRealmDB($values[1]); mysql_query("UPDATE characters SET level='80' WHERE guid = '" . $values[0] . "'"); account::logThis("Performed an instant max level on " . character::getCharName($values[0], NULL), 'Instant', NULL); echo '<h3 class="green_text">The character level was set to 80!</h3>'; } } }
<img src="styles/global/images/portraits/ <?php echo $row['gender'] . '-' . $row['race'] . '-' . $row['class']; ?> .gif" border="none"> <?php } ?> </td> <td width="160"><h3><?php echo $row['name']; ?> </h3> <?php echo $row['level'] . " " . character::getRace($row['race']) . " " . character::getGender($row['gender']) . " " . character::getClass($row['class']); ?> </td> <td>Realm: <?php echo $realm; ?> <?php if ($row['online'] == 1) { echo "<br/><span class='red_text'>Please log out before trying to unstuck.</span>"; } ?> </td> <td align="right"> <input type="submit" value="Revive" <?php
*/ function roll_damage($mindamage, $maxdamage) { $delta = $maxdamage - $mindamage; if ($delta < 1) { $delta = 1; } $damage = floor($mindamage + exp(rand(0, floor(137.0 * log($delta))) / 137.0) + rand(0, 99) * 0.01); DEBUG and $_SESSION['disp_msg'][] = "DEBUG: damage between {$mindamage}-{$maxdamage} = {$damage}"; return $damage; } ?> <html> <head> <?php $character = new character($PHP_PHAOS_CHARID); $_SESSION['disp_msg'] = array(); if (isset($_GET['charfrom'])) { $_SESSION['charfrom'] = $_GET['charfrom']; } //FIXME: way to easy to hack $_SESSION['fightbonus'] = isset($_GET['bonus']) ? $_GET['bonus'] : 1; if ($_SESSION['fightbonus'] > 4) { $_SESSION['fightbonus'] = 4; } function setcombatlocation($combatlocation) { $_SESSION['combatlocation'] = $combatlocation; $result = mysql_query("select name from tower_locations where id={$_SESSION['combatlocation']} LIMIT 1"); @(list($_SESSION['locationname']) = mysql_fetch_row($result)); }
public function inventory_action($type) { $type = page::arg('type', $type, 'character'); $charId = page::arg('character_id'); $charName = page::arg('name'); $itemType = page::arg('item_type', null, 'all'); $char = null; if ($charId) { $char = character::load_one($charId); } else { if ($charName) { $char = character::load_one($charName, 'name'); } else { if (!character::selected()) { return api::result(false, array('message' => 'No_character_selected')); } else { $char = character::current(); } } } if (!$type) { $type = 'character'; } $types = array('character' => inventory::TYPE_CHARACTER, 'vault' => inventory::TYPE_VAULT); $itemTypes = array('all' => null, 'usable' => item::TYPE_USABLE, 'enchantable' => item::TYPE_ENCHANTABLE, 'destroyable' => item::TYPE_DESTROYABLE, 'loot' => item::TYPE_LOOT, 'equippable' => item::TYPE_EQUIPPABLE, 'material' => item::TYPE_MATERIAL); if (!isset($types[$type])) { $itemType = (int) $type; } if (!array_key_exists($itemType, $itemTypes)) { return api::result(false, array('message' => 'Invalid_item_type')); } return api::result(true, array($char->inventory($types[$type])->items($itemTypes[$itemType], true))); }
include 'header.php'; ?> <title>GamingZeta - <?php echo ucwords(str_ireplace(array('-', '.php'), array(' ', ''), basename($_SERVER['PHP_SELF']))); ?> / <?php echo $_GET['c']; ?> </title> </head> <body> <div id='header'> </div> <?php include 'menu.php'; $charinfo = new character(); $charinfo->construct($character); $charinfo->get_char_equipment($charinfo->charguid); ?> <div id='content'> <div id='character-left'> <div class='left-character-panel'> <div id='character-main-frame' style='background:url(images/class/<?php echo $charinfo->class; ?> .png) no-repeat;'> <div class='char-right-info1'> <?php include 'inc/charinv.php'; ?> </div>
/** * @param: none * return: none * purpose: generate new NPC/monster and add to database */ function npcgen() { $res = mysql_query("SELECT * FROM phaos_opponents WHERE location='0' ORDER BY RAND() LIMIT 1") or die(mysql_error()); if ($blueprint = mysql_fetch_array($res)) { //create 50% level 1 characters, and not more than 37,5% characters with level>3 $level = 1 + (int) (rand(0, 1) * (pow(1 + rand(0, 10) * rand(0, 10) * 0.01, 4) + rand(0, 99) * 0.01)); $npc = new np_character_from_blueprint($blueprint, $level); $condition_passable = $npc->real_sql_may_pass(); //TODO: add generator regions/locations feature to phaos $tries = 10; while ($tries-- > 0) { $res = null; //FIXME: this actually should depend on the area covered by dungeons //20050717 //Wilderness 14277 //Woodlands 1891 //Dungeon 675 if (!@$res && rand(0, 99) < 4) { $location = 'Rune Gate%'; $sql = "SELECT id FROM phaos_locations WHERE (name LIKE 'Rune Gate%' OR name LIKE 'Dungeon') AND {$condition_passable} ORDER BY RAND() LIMIT 1"; //defined('DEBUG') and DEBUG and $GLOBALS['debugmsgs'][]= __FUNCTION__.": sql: $sql"; $res = mysql_query($sql) or die(mysql_error()); } if (!@$res) { $location = 'Wilderness'; $sql = "SELECT id FROM phaos_locations WHERE (name LIKE 'Wilderness' OR name LIKE 'Woodlands' OR name LIKE 'Rune Gate%' OR name LIKE 'Dungeon') AND {$condition_passable} ORDER BY RAND() LIMIT 1"; //defined('DEBUG') and DEBUG and $GLOBALS['debugmsgs'][]= __FUNCTION__.": sql: $sql"; $res = mysql_query($sql) or die(mysql_error()); } list($locationid) = mysql_fetch_array($res); //check whether location is crowded $res = mysql_query("SELECT count(*) FROM phaos_characters WHERE location='{$locationid}' AND username='******'") or die(mysql_error()); list($count) = mysql_fetch_array($res); if ($count > $level + 1) { defined('DEBUG') and DEBUG and $GLOBALS['debugmsgs'][] = " location {$locationid} is <b>crowded</b>, not placing here ({$count} npcs)"; //trying to fix $res = mysql_query("SELECT id FROM phaos_characters WHERE location='{$locationid}' AND username='******'") or die(mysql_error()); while (list($id) = mysql_fetch_array($res)) { $crowd = new character($id); $crowd->relocate((int) rand(1, 8)); } } else { break; //stop while loop } } } else { die("cant find valid mob in DB: " . mysql_error()); } $npc->place($locationid); DEBUG and $_SESSION['disp_msg'][] = "**DEBUG: {$npc->name}({$npc->level}) generated at location {$location} {$locationid}"; return 1; }
echo "time end pop control=" . endTiming() . "<br>\n"; } // move some NPC first $npctomov = @$_COOKIE['_speed'] ? 3 : 9; for ($i = 0; $i < $npctomov; $i++) { movenpc(); } if (@$_COOKIE['_timing']) { echo "time end pop movement=" . endTiming() . "<br>\n"; } updateshops(); if (@$_COOKIE['_timing']) { echo "time end shop updates=" . endTiming() . "<br>\n"; } // CHARACTER INFORMATION $character = new character($PHP_PHAOS_CHARID); // Make sure character is strong enough to travel if ($character->hit_points <= "0") { $destination = ""; } elseif ($character->stamina_points <= "0") { $destination = ""; } else { //FIXME: this allows an instant gate travel hack, uhm, I mean, spell if (is_numeric(@$_POST['destination']) and $_POST['destination'] > 0) { $destination = $_POST['destination']; } else { $destination = ""; } } if (@$_COOKIE['_timing']) { echo "time 1=" . endTiming();
$bResult = false; } } $action = $_GET['action']; $guid = $_GET['guid']; $char_online = false; if ($bResult) { $WSDB->setErrorHandler('databaseErrorHandler'); $WSDB->query("SET NAMES " . $config['db_encoding']); $query = $WSDB->selectrow("SELECT * FROM `characters` WHERE `account`=?d and `guid`=?d ORDER BY `name`", $user['id'], $guid); $my_char; if (!$query) { $strErrorMsg = 'Персонаж на вашем аккаунте не обнаружен'; $bResult = false; } else { $my_char = new character($query, $mangos_field); if ($my_char->online) { $strErrorMsg = 'Персонаж находится в игре!'; $bResult = false; } } } if ($bResult) { $timecurr = time(); $timecurrf = date('Y-m-d H:i:s', $timecurr); $timeactionf = $WSDB->selectCell("SELECT `timeaction` FROM `mwfe3_character_actions` WHERE account=?d and `guid`=?d and `action`=? ORDER BY `timeaction` DESC LIMIT 1", $user['id'], $guid, $action); $timeaction = strtotime($timeactionf); $timediffh = floor(($timecurr - $timeaction) / 3600); if ($action == 'rename') { if (!$config['chars_rename_enable']) { output_message('alert', 'Переименование персонажей запрещено!' . '<meta http-equiv=refresh content="2;url=index.php?n=account&sub=chars">');
$tp->assign('place', $place); $tp->assign('rank_border', $rank[2]); $tp->assign('wg', $r['games']); $tp->assign('ww', $r['wins']); $tp->assign('wl', $r['games'] - $r['wins']); $tp->assign('wp', $r['games'] ? round($r['wins'] / $r['games'] * 100) : 0); $tp->assign('wr', $r['rating']); $tp->assign('sg', $r['played']); $tp->assign('sw', $r['wins2']); $tp->assign('sl', $r['played'] - $r['wins2']); $tp->assign('sp', $r['played'] ? round($r['wins2'] / $r['played'] * 100) : 0); $icon = getSmallArenaIcon($r); $tp->assign('icon', $icon); $m = $mysql->getRows("select arena_team_member.*,characters.name,characters.race,characters.class,?3 as level,?4 as gender,guild.name as gname from arena_team_member inner join characters on arena_team_member.guid= characters.guid left join guild on guild.guildid = ?2 where arena_team_member.arenateamid = ?1", $r['arenateamid'], SQL_template(CHAR_GUILD_OFFSET), SQL_template(CHAR_LEVEL_OFFSET), CHAR_GENDER_OFFSET, 'char'); if ($m) { foreach ($m as $member) { $team_faction = character::getAlliance($member['race']); $table .= '<tr><td><a href="character-sheet.php?Realm={$realm}&name=' . $member['name'] . '">' . $member['name'] . '</a></td>'; $table .= '<td>' . ($member['gname'] ? '<a href="guild-info.php?Realm={$realm}&name=' . $member['gname'] . '">' . $member['gname'] . '</a>' : 'None') . '</td>'; $table .= '<td><img class="staticTip" onmouseover="setTipText(\'' . character::raceToString($member['race']) . '\');" src="images/icons/race/' . $member['race'] . '-' . $member['gender'] . '.gif"> <img class="staticTip" onmouseover="setTipText(\'' . character::classToString($member['class']) . '\');" src="images/icons/class/' . $member['class'] . '.gif"></td>'; $table .= '<td class="rightNum">' . $member['played_season'] . '</td><td class="rightNum" style="color: #678705;">' . $member['wons_season'] . '</td><td class="rightNum" style="color: #9A1401;">' . ($member['played_season'] - $member['wons_season']) . '</td><td class="rightNum">' . ($member['played_season'] ? round($member['wons_season'] / $member['played_season'] * 100) : 0) . '%</td><td class="rightNum">' . $member['personal_rating'] . '</td></tr>'; } } else { $table = '<tr><td colspan="8">No members</td></tr>'; } $tp->assign('table', $table); $tp->assign('faction', $team_faction); $tp->assign('realm', $_SYSTEM->Realms[$_SYSTEM->Realm]); $c->assign('content', $tp->output); $c->display(); $_SYSTEM->printFooter();