public function getContent() { $text = Neuron_Core_Text::__getInstance(); if ($this->building) { $input = $this->getInputData(); $me = Neuron_GameServer::getPlayer(); if ($me && $this->building->getOwner()->getId() == $me->getId() && $this->building->getVillage()->isActive()) { if (isset($input['action']) && $input['action'] == 'destruct' && isset($input['key']) && Neuron_Core_Tools::checkConfirmLink($input['key'])) { // Reload reloadEverything(); $loc = $this->building->getLocation(); //$this->reloadLocation ($loc[0], $loc[1]); return $this->building->destructBuilding(); } else { // Make sure you are not in vacation mode. if ($this->building->getVillage()->getOwner()->inVacationMode()) { return '<p class="false">' . $text->get('vacationMode', 'main', 'main') . '</p>'; } return $this->building->getMyContent($input); } } else { return $this->building->getGeneralContent(false); } } else { return '<p class="false">' . $text->get('notFound', 'building', 'building') . '</p>'; } }
public function processInput() { $text = Neuron_Core_Text::__getInstance(); $data = $this->getInputData(); $_SESSION['language'] = $data['language']; setcookie('user_language', $data['language'], time() + COOKIE_LIFE, '/'); $text->setLanguage($data['language']); $user = Neuron_GameServer::getPlayer(); if ($user) { $user->setLanguage($text->getCurrentLanguage()); } $this->updateContent($this->getContent($data['language'])); reloadEverything(); $this->reloadMap(); }
protected function onLogin() { // Login succeeded $html = $this->getContent(false); $me = Neuron_GameServer::getPlayer(); $this->updateContent($html); if ($me->isPlaying()) { // Scroll to the right location $home = $me->getHomeLocation(); $this->mapJump($home[0], $home[1]); } // Reload everything (all open windows) reloadEverything(); // Set the request data $this->updateRequestData(''); }
protected function getPlayerInitialization($registrationTracker = false) { // Check if we can actually register $server = Neuron_GameServer::getServer(); if (!$server->canRegister()) { return '<p>This server has gone into "endgame" mode. You can not register here anymore. But stay tuned, a new game will start soon.</p>'; } $data = $this->getInputData(); $me = Neuron_GameServer::getPlayer(); if (isset($data['race'])) { // Check for clans $clan = isset($data['clan']) ? intval($data['clan']) : 0; $location = isset($data['location']) ? $data['location'] : null; $objClan = false; if ($clan > 0) { $objClan = new Dolumar_Players_Clan($clan); if ($objClan->isFound()) { // Check for password if ($objClan->isPasswordProtected()) { // Break out of the function if the password is not correct. if (!isset($data['password']) || !$objClan->checkPassword($data['password'])) { return $this->requestClanPassword($data['race'], $objClan); } } $members = $objClan->getMembers(); if (count($members) > 0) { $member = $members[rand(0, count($members) - 1)]; // Fetch towncenter $village = $member->getMainVillage(); if ($village) { // Overwrite location with the location of this towncenter. $location = $village->buildings->getTownCenterLocation(); } else { $location = array(0, 0); } } else { $location = array(0, 0); } } } if ($me->initializeAccount($data['race'], $location, $objClan)) { // Scroll to the right location $me = Neuron_GameServer::getPlayer(); $home = $me->getHomeLocation(); $this->mapJump($home[0], $home[1]); // Reload area $this->reloadLocation($home[0], $home[1]); reloadEverything(); return $this->getContent(false); } else { //return $this->getPlayerInitialization (); } } $text = Neuron_Core_Text::__getInstance(); $text->setFile('account'); $text->setSection('selectRace'); $data = $this->getInputData(); // Show form $page = new Neuron_Core_Template(); $error = Neuron_GameServer::getPlayer()->getError(); if (!empty($error)) { $page->set('error', $text->get($error, 'errors', 'account', $error)); } // Loop trough races foreach (Dolumar_Races_Race::getRaces() as $k => $v) { $race = Dolumar_Races_Race::getFromId($k); if ($race->canPlayerSelect(Neuron_GameServer::getPlayer())) { $page->addListValue('races', array($text->get($v, 'races', 'races', $v), $text->get($v, 'desc', 'races', 'null'), $k)); } } $page->sortList('races'); // Some text values $page->set('submit', $text->get('submit')); $page->set('select', $text->get('select')); $page->set('location', $text->get('location')); if ($registrationTracker === true) { $tracker = Neuron_GameServer::getPlayer()->getTrackerUrl('registration'); $page->set('tracker_url', htmlentities($tracker)); } // Locations $page->addListValue('directions', array($text->get('r', 'directions', 'main'), 'r')); $page->addListValue('directions', array($text->get('n', 'directions', 'main'), 'n')); $page->addListValue('directions', array($text->get('ne', 'directions', 'main'), 'ne')); $page->addListValue('directions', array($text->get('e', 'directions', 'main'), 'e')); $page->addListValue('directions', array($text->get('es', 'directions', 'main'), 'es')); $page->addListValue('directions', array($text->get('s', 'directions', 'main'), 's')); $page->addListValue('directions', array($text->get('sw', 'directions', 'main'), 'sw')); $page->addListValue('directions', array($text->get('w', 'directions', 'main'), 'w')); $page->addListValue('directions', array($text->get('wn', 'directions', 'main'), 'wn')); // Fetch a list of all clans $db = Neuron_Core_Database::__getInstance(); $clans = $db->select('clans', array('*')); // Add a list of all clans ;-) foreach ($clans as $v) { $clan = new Dolumar_Players_Clan($v['c_id'], $v); $page->addListValue('clans', array('id' => $clan->getId(), 'name' => Neuron_Core_Tools::output_varchar($clan->getName()), 'isLocked' => $clan->isPasswordProtected(), 'isFull' => $clan->isFull())); } return $page->parse('account/selectRace.phpt'); }
public function sendToVillage($target) { // For now: quick & dirty "instant arrival" $db = Neuron_DB_Database::__getInstance(); // Take a look: is this squad traveling at the moment? $current = $db->query("\n\t\t\tSELECT\n\t\t\t\tUNIX_TIMESTAMP(s_start) AS vertrek,\n\t\t\t\tUNIX_TIMESTAMP(s_end) AS aankomst\n\t\t\tFROM\n\t\t\t\tsquad_commands\n\t\t\tWHERE\n\t\t\t\ts_id = " . $this->getId() . "\n\t\t\t\tAND s_end > FROM_UNIXTIME(" . NOW . ")\n\t\t\tORDER BY\n\t\t\t\ts_end DESC\n\t\t\tLIMIT 1\n\t\t"); if (count($current) > 0) { // This squad is currently travelling, this is a recall. // Moveing back takes as long as moving overthere. $duration = NOW - $current[0]['vertrek']; // Remove all others $db->query("\n\t\t\t\tDELETE FROM\n\t\t\t\t\tsquad_commands\n\t\t\t\tWHERE\n\t\t\t\t\ts_end < FROM_UNIXTIME(" . NOW . ") OR\n\t\t\t\t\ts_id = " . $this->getId() . "\n\t\t\t"); } else { // Calculate the distance & speed $speed = $this->getSpeed(); $distance = Dolumar_Map_Map::getDistanceBetweenVillages($this->getCurrentLocation(), $target); $duration = $distance * 60 * 10 / ($speed * GAME_SPEED_MOVEMENT); } // Do the actual move $db->query("\n\t\t\tUPDATE\n\t\t\t\tvillages_squads\n\t\t\tSET\n\t\t\t\ts_village = " . $target->getId() . "\n\t\t\tWHERE\n\t\t\t\ts_id = " . $this->getId() . "\n\t\t"); // Update the defense slots $db->query("\n\t\t\tUPDATE\n\t\t\t\tsquad_units\n\t\t\tSET\n\t\t\t\ts_slotId = 0,\n\t\t\t\ts_priority = 0\n\t\t\tWHERE\n\t\t\t\ts_id = " . $this->getId() . "\n\t\t"); // Add the commands $db->query("\n\t\t\tINSERT INTO\n\t\t\t\tsquad_commands\n\t\t\tSET\n\t\t\t\ts_id = " . $this->getId() . ",\n\t\t\t\ts_action = 'move',\n\t\t\t\ts_start = FROM_UNIXTIME(" . NOW . "),\n\t\t\t\ts_end = FROM_UNIXTIME(" . (NOW + $duration) . "),\n\t\t\t\ts_from = " . $this->getCurrentLocation()->getId() . ",\n\t\t\t\ts_to = " . $target->getId() . "\n\t\t"); reloadStatusCounters(); reloadEverything(); }
private function getDonateResources($target, $resources, $runes, $equipment) { $text = Neuron_Core_Text::__getInstance(); $msgs = array(); $premium = $this->isPremium($target); // Count transactions $t1 = $this->splitInTransactions($resources, self::RESOURCES_PER_TRANSPORTER); $t2 = $this->splitInTransactions($runes, self::RUNES_PER_TRANSPORTER); //$t3 = $this->splitInTransactions ($equipment, self::EQUIPMENT_PER_TRANSPORTER); $t3 = $equipment; $total_transactions = count($t1) + count($t2) + count($t3); $max_transactions = $this->countTransfersLeft($premium); if ($total_transactions > $max_transactions) { // No error, just show the confirm button again. return $this->getConfirmDonation($target, $resources, $runes, $equipment); } // Calculate the price $costs = $this->calculateCosts($target, $resources, $runes, $premium); $amount = 0; foreach ($resources as $v) { $amount += $v; } $duration = $this->getTransferDuration($target); /* done_res = "You have sent resource to @@target." done_runes = "You have sent runes to @@target." */ // RESOURCES foreach ($t1 as $resources) { if ($this->getVillage()->resources->transferResources($target, $resources, $costs, $duration)) { $msgs[] = array(Neuron_Core_Tools::putIntoText($text->get('done_res', 'market', 'buildings'), array('target' => Neuron_Core_Tools::output_varchar($target->getName()), 'cost' => $this->resourceToText($costs))), true); } elseif ($amount > 0) { $msgs[] = array(Neuron_Core_Tools::putIntoText($text->get($this->getVillage()->resources->getError(), 'market', 'buildings'), array('target' => Neuron_Core_Tools::output_varchar($target->getName()), 'cost' => $this->resourceToText($costs))), false); } $costs = array(); } // RUNES foreach ($t2 as $runes) { if ($this->getVillage()->resources->transferRunes($target, $runes, $duration)) { $msgs[] = array(Neuron_Core_Tools::putIntoText($text->get('done_runes', 'market', 'buildings'), array('target' => Neuron_Core_Tools::output_varchar($target->getName()), 'cost' => $this->resourceToText($costs))), true); } elseif (count($runes) > 0) { $msgs[] = array(Neuron_Core_Tools::putIntoText($text->get($this->getVillage()->resources->getError(), 'market', 'buildings'), array('target' => Neuron_Core_Tools::output_varchar($target->getName()), 'cost' => $this->resourceToText($costs))), false); } } // Time for the equipment stuff $equips = 0; foreach ($equipment as $v) { if ($this->getVillage()->equipment->transferEquipment($target, $v['equipment'], $v['amount'], $duration)) { $equips += $v['amount']; } else { $msgs[] = array(Neuron_Core_Tools::putIntoText($text->get($this->getVillage()->resources->getError(), 'market', 'buildings'), array('target' => Neuron_Core_Tools::output_varchar($target->getName()), 'cost' => $this->resourceToText($costs))), false); } } if ($equips > 0) { $msgs[] = array(Neuron_Core_Tools::putIntoText($text->get('done_equipment' . ($equips > 1 ? '2' : '1'), 'market', 'buildings'), array('target' => Neuron_Core_Tools::output_varchar($target->getName()), 'cost' => $this->resourceToText($costs), 'items' => $equips)), true); } reloadEverything(); $this->aInput = array('action' => 'donate'); return $this->getChooseTarget($msgs); }
protected function doCastSpell($objUnit, $objSpell, $objTarget, $visible = true) { // Just feed the random number generator, just to be sure. mt_srand(); $page = new Neuron_Core_Template(); $text = Neuron_Core_Text::getInstance(); $page->setTextSection('result', $this->sTextFile); // Now let's start the checking $cost = $objSpell->getCost($objUnit, $objTarget); if ($this->village->resources->takeResourcesAndRunes($cost)) { $dif = $this->getProbability($objUnit, $objSpell, $objTarget); $rand = mt_rand(0, 100); $objSpell->setVillage($this->village); $objSpell->setTarget($objTarget); $objSpell->prepare(); // Some spells are not castable for some reason. if (!$objSpell->isCastable()) { $page->set('success', false); $page->set('message', $text->get($objSpell->getError(), 'errors', $this->sTextFile)); } else { if ($rand < $dif) { $objSpell->execute($visible); reloadStatusCounters(); $page->set('success', true); $page->set('message', $objSpell->getSuccessMessage()); // Call the trigger! $objUnit->onSuccess(); // Update request data (to return to overview) //$this->updateRequestData (array ('building' => $'village' => $this->village->getId ())); $page->set('extra', $objSpell->getExtraContent()); $success = true; } else { $page->set('success', false); $page->set('message', $objSpell->getFailedMessage()); // Call the trigger! $objUnit->onFail(); if ($objUnit->isAlive()) { $page->set('retry', true); $page->set('inputData', $this->getInputData()); } $success = false; } $toTarget = $success || !$visible; if (!$success) { $visible = true; } $objTarget = $objSpell->getTarget(); $log = Dolumar_Players_Logs::getInstance(); $log->addEffectLog($objTarget, $objSpell, $this->village, $success, $visible, $toTarget, $this->sTextFile); reloadEverything(); } } else { $page->set('success', false); $page->set('error', 'err_resources'); } return $page->parse('magic/result.phpt'); }
protected function getCustomContent($input) { $db = Neuron_Core_Database::__getInstance(); $text = Neuron_Core_Text::__getInstance(); $text->setFile('buildings'); $text->setSection('townCenter'); $page = new Neuron_Core_Template(); // Just to make sure we're not displaying old rune scouts. $this->getVillage()->resources->getRunes(); // Change village name if (isset($input['villageName'])) { $input['villageName'] = strip_tags($input['villageName']); if (!$this->getVillage()->setName($input['villageName'])) { $page->set('changename_err', $text->get($this->getVillage()->getError())); } else { reloadEverything(); } } // Let's check if we are already searching for runes $runeCheck = $db->select('villages_scouting', array('count(scoutId)'), "vid = '" . $this->getVillage()->getId() . "'"); $alreadyScouting = $runeCheck[0]['count(scoutId)'] > 0; if (isset($input['do'])) { if ($input['do'] == 'scout') { $this->hideGeneralOptions(); $this->hideTechnologyUpgrades(); $currentPage = isset($input['pageid']) ? $input['pageid'] : 1; if ($currentPage < 1) { $currentPage = 1; } Neuron_Core_Tools::splitInPages($page, $currentPage * 4 + 8, $currentPage, 4, 4, array('do' => 'scout'), null, 'pageid'); if ($alreadyScouting) { $page->set('scoutResults', $text->get('alreadyScouting')); $page->set('scoutResult_isGood', false); } else { if (isset($input['runes']) && is_numeric($input['runes'])) { $runes = intval($input['runes']); // Let's start scouting $village = $this->getVillage(); //$cost = $village->getScoutLandsCost ($runes); if ($village->scout($runes)) { $page->set('scoutResults', $text->get('doneScouting')); $page->set('scoutResult_isGood', true); } else { $page->set('scoutResults', $text->get('searchNoRunes')); $page->set('scoutResult_isGood', false); } } else { $scoutoptions = array(); $start = ($currentPage - 1) * 4 + 1; $end = $start + 4; for ($i = $start; $i < $end; $i++) { $duration = $this->getVillage()->getScoutLandsDuration($i); $cost = $this->resourceToText($this->getVillage()->getScoutLandsCost($i)); $duration = Neuron_Core_Tools::getDuration($duration); $scoutoptions[] = array('runes' => $i, 'scoutDuration' => $duration, 'scoutCost' => $cost); } $page->set('scoutoptions', $scoutoptions); } } return $page->parse('buildings/townCenter_scoutRunes.phpt'); } else { if ($input['do'] == 'explore') { /* * TODO ;-) * $village = $this->getVillage (); $village->lookForNPCs (); */ } } } $page->set('vid', $this->getVillage()->getId()); // Search for new runes $page->set('searchRunes', $text->get('searchRunes')); $page->set('scoutLands', $text->get('scoutLands')); $page->set('scoutCost', $text->get('scoutCost')); // Change name $page->set('changeName', $text->get('changeName')); $page->set('villageName', $text->get('villageName')); $page->set('change', $text->get('change')); $page->set('villageName_value', Neuron_Core_Tools::output_varchar($this->getVillage()->getName())); $page->set('overview', $text->getClickTo($text->get('overview'))); $page->set('techniques', $text->getClickTo($text->get('techniques'))); $page->set('toScout', $text->getClickTo($text->get('toScout'))); return $page->parse('buildings/townCenter.phpt'); }
private function buildBuilding($building, $x, $y) { $db = Neuron_Core_Database::__getInstance(); $text = Neuron_Core_Text::__getInstance(); // Check range, overlap etc. $chk = $building->checkBuildLocation($this->village, $x, $y); if ($chk[0]) { $x = $chk[1][0]; $y = $chk[1][1]; $res = $building->getBuildingCost($this->village); // Take resources & runes if ($this->village->resources->takeResourcesAndRunes($res)) { $building = $building->build($this->village, $x, $y); //$this->reloadLocation ($x, $y); // Reload buildings & runes $this->village->buildings->reloadBuildings(); $this->village->buildings->reloadBuildingLevels(); $this->village->onBuild($building); // Reload windows reloadEverything(); $this->updateContent($this->getContent('done')); } else { $this->updateContent($this->getContent($this->village->resources->getError())); } } else { // Game error: town center not found $this->updateContent($this->getContent($chk[1], isset($chk[2]) ? $chk[2] : array())); } }
public function processBattles($now) { // Check if it has been checked for this if ($now <= $this->iLastBattleCheck) { return; } $this->iLastBattleCheck = $now; // To not replace all this shit. $villageId = $this->objProfile->getId(); // Start profiler & stuff $profiler = Neuron_Profiler_Profiler::__getInstance(); $profiler->start('Calculating battles for village ' . $villageId . ' (' . $now . ')'); // The lock will make sure that every battle will only be calculated one time. $lock = Neuron_Core_Lock::__getInstance(); // First: make sure this village hasn't been calculated yet /* if ($lock->setSoftLock ('battle_village', $villageId.'_'.$now)) { */ $dbi = Neuron_DB_Database::getInstance(); $villageId = intval($villageId); $battles = $dbi->query("\n\t\t\t\tSELECT\n\t\t\t\t\tbattleId\n\t\t\t\tFROM\n\t\t\t\t\tbattle\n\t\t\t\tWHERE\n\t\t\t\t\t(vid = {$villageId} OR targetId = {$villageId})\n\t\t\t\t\tAND (\n\t\t\t\t\t\t(fightDate < {$now} AND isFought = '0') OR\n\t\t\t\t\t\tendDate < {$now}\n\t\t\t\t\t)\n\t\t\t\tORDER BY\n\t\t\t\t\tfightDate ASC,\n\t\t\t\t\tendDate ASC,\n\t\t\t\t\tbattleId ASC\n\t\t\t"); $profiler->start('Processing ' . count($battles) . ' battles.'); foreach ($battles as $bdata) { $profiler->start('Processing battle ' . $bdata['battleId']); // Only process every battle ones if ($lock->setLock('battle', $bdata['battleId'])) { $profiler->start('Lock set, process battles.'); $battle = Dolumar_Battle_Battle::getBattle($bdata['battleId']); //$battle->setData ($aBattle, $this->objProfile); // Check for fight execution if ($battle->getFightDate() <= $now && !$battle->isFought()) { $profiler->start('Executing battle #' . $battle->getId()); // Execute battle $battle->execute(); $profiler->stop(); } // Check for fight removal if ($battle->getEndDate() <= $now && $battle->isFought()) { $profiler->start('Removing battle #' . $battle->getId()); // Do finish battle stuff $battle->removeBattle(); $profiler->stop(); } //$battle->__destruct (); unset($battle); //} $lock->releaseLock('battle', $bdata['battleId']); $profiler->stop(); $this->objProfile->reloadData(); reloadEverything(); } else { $profiler->start('Battle is already locked, not doing anything.'); $profiler->stop(); } $profiler->stop(); } $profiler->stop(); $profiler->stop(); }
private function getSquadOverview($objSquad) { $text = Neuron_Core_Text::__getInstance(); $text->setFile('squads'); $text->setSection('squad'); $page = new Neuron_Core_Template(); $page->set('squadId', $objSquad->getId()); $page->set('squads', $text->get('squads')); $page->set('remove', $text->get('remove')); $page->set('confirm', addslashes($text->get('conRemove'))); $page->set('noUnits', $text->get('noUnits')); $page->set('noItem', $text->get('noItem')); $page->set('toAdd', $text->getClickTo($text->get('toAdd'))); $page->set('toRemove', $text->getClickTo($text->get('toRemove'))); $page->set('toReturn', $text->getClickTo($text->get('toReturn'))); $page->set('name', Neuron_Core_Tools::output_varchar($objSquad->getName())); $input = $this->getInputData(); if (isset($input['remove'])) { if ($objSquad->isIdle()) { if ($objSquad->removeUnit((int) $input['remove'])) { $this->setInputData('{}'); return $this->getOverview(); } } else { $this->alert($text->get('notIdle')); } } // Handle equipment input $equipment = $this->village->getEquipment(); $reloadEquipment = false; foreach ($objSquad->getUnits() as $unit) { // Loop trough equipment to seek input foreach ($equipment as $type => $items) { $inputKey = $unit->getUnitId() . '_' . $type; if (isset($input[$inputKey])) { if ($input[$inputKey] == "0") { $itemid = Dolumar_Players_Equipment::getItemTypeId_static($type); $objSquad->unequipItem($unit, $itemid); } else { // Loop trough your equipment and search for selected item foreach ($items as $name => $item) { if ($input[$inputKey] == $item->getId()) { if (!$objSquad->addEquipment($unit, $item)) { //$this->alert ($text->get ($objSquad->getError ())); $page->set('error', $text->get($objSquad->getError())); } break 1; } } } $reloadEquipment = true; } } } //return '<pre>'.print_r ($equipment, true).'</pre>'; //return $input[$inputKey]; //return $inputKey . '<pre>'.print_r ($input, true).'</pre>'; if ($reloadEquipment) { reloadEverything(); $objSquad->reloadUnits(); } foreach ($objSquad->getUnits() as $v) { // And do the actual output $items = array(); foreach ($v->getEquipment() as $eq) { $items[$eq->getItemType()] = $eq->getId(); } $page->addListValue('units', array(Neuron_Core_Tools::output_varchar($v->getName()), $v->getSquadlessAmount(), $v->getImageUrl(), $v->getUnitId(), $items, 'stats' => Dolumar_Windows_Units::getUnitStatsHTML($v))); } $o = array(); $e = $this->village->getEquipment(); foreach ($e as $k => $v) { $page->addListValue('equipment', array(Neuron_Core_Tools::output_varchar(Dolumar_Players_Equipment::getEquipmentName($k)), $v, $k)); } return $page->parse('squads/view.tpl'); }
public function doUpgradeBuilding() { $res = $this->getUpgradeCost($this->getVillage()); $objLock = Neuron_Core_Lock::__getInstance(); if ($objLock->setLock('upgradebuilding', $this->getId())) { $return = false; $duration = $this->getUpgradeTime($this->getVillage()); // Check some stuff if (!$this->isFinished()) { $this->sError = 'unfinished'; } elseif (!$this->getVillage()->readyToBuild()) { $this->sError = 'busy'; } elseif (!$this->getVillage()->resources->takeResourcesAndRunes($res)) { $this->sError = $this->getVillage()->resources->getError(); } else { $db = Neuron_Core_Database::__getInstance(); // Reload buildings & runes $this->getVillage()->buildings->reloadBuildings(); $this->getVillage()->resources->reloadRunes(); $this->getVillage()->buildings->increaseBuildingLevel($this, $this->getLevel() + 1); // Update duration $db->update('map_buildings', array('lastUpgradeDate' => time() + $duration, 'bLevel' => '++'), "bid = '" . $this->id . "'"); // Reload windows if (isset($this->objWindow)) { reloadEverything(); reloadStatusCounters(); $loc = $this->getLocation(); $this->objWindow->reloadLocation($loc[0], $loc[1]); } $runes = array(); if (isset($res['runeId']) && isset($res['runeAmount'])) { $runes[$res['runeId']] = $res['runeAmount']; } unset($res['runeId']); unset($res['runeAmount']); $this->addUsedResources($res, $runes); $this->getVillage()->onUpgrade($this); $return = true; } $objLock->releaseLock('upgradebuilding', $this->getId()); return $return; } else { return false; } }
public function processInput() { // update request ifno $input = $this->getInputData(); if (isset($input['page'])) { $this->updateRequestData(array('page' => $input['page'])); // update current village $player = Neuron_GameServer::getPlayer(); if ($player) { $villages = $player->getVillages(); $k = intval($input['page'] - 1); if (isset($villages[$k])) { $player->setCurrentVillage($villages[$k]); reloadEverything(); $loc = $player->getCurrentVillage()->buildings->getTownCenterLocation(); // Jump to the selected village $this->mapJump($loc[0], $loc[1]); } } } $this->updateContent(); }