Ejemplo n.º 1
0
 public function getContent()
 {
     $text = Neuron_Core_Text::__getInstance();
     $player = Neuron_GameServer::getPlayer();
     if (!$player) {
         return $this->throwError($text->get('login', 'login', 'account'));
     }
     $input = $this->getInputData();
     $request = $this->getRequestData();
     $mapper = Neuron_GameServer_Mappers_BlockingChatMapper::getInstance();
     $total = $mapper->countPrivateMessages($player);
     if (isset($input['page'])) {
         $current = $input['page'];
         $request['page'] = $current;
         $this->updateRequestData($request);
     } else {
         $current = isset($request['page']) ? $request['page'] : 0;
     }
     $perpage = 10;
     $page = new Neuron_Core_Template();
     $pages = Neuron_Core_Tools::splitInPages($page, $total, $current, $perpage);
     $messages = $mapper->getPrivateChats($player, $pages['start'], $pages['perpage']);
     $page->set('messages', $messages);
     return $page->parse('gameserver/chat/privatemessages.phpt');
 }
Ejemplo n.º 2
0
 /**
  * @param Neuron_GameServer_Player $objUser
  */
 public function __construct(Neuron_GameServer_Player $objUser)
 {
     $this->objUser = $objUser;
     $this->objCredits = self::getPureCreditsObject();
     if (!$this->objCredits) {
         return;
     }
     if ($this->objUser->isEmailCertified()) {
         $this->objCredits->setEmail($this->getEmail());
     }
     $this->objCredits->setReferal($objUser->getReferal());
     foreach ($objUser->getOpenIDs() as $v) {
         $this->objCredits->addOpenID($v);
     }
     $container = isset($_SESSION['opensocial_container']) ? $_SESSION['opensocial_container'] : null;
     if (isset($container)) {
         $this->objCredits->setContainer($container);
     }
     $fullscreen = isset($_SESSION['fullscreen']) && $_SESSION['fullscreen'] ? 1 : 0;
     $this->objCredits->setFullscreen($fullscreen);
     $this->objCredits->setLanguage(Neuron_Core_Text::getInstance()->getCurrentLanguage());
     $this->objCredits->setUserId($objUser->getId());
     if (isset($_SESSION['birthday'])) {
         $this->objCredits->setBirthday($_SESSION['birthday']);
     }
     if (isset($_SESSION['gender'])) {
         $this->objCredits->setGender(strtolower($_SESSION['gender']) == 'm' ? 'male' : 'female');
     }
 }
Ejemplo n.º 3
0
 protected function getForum()
 {
     $requestData = $this->getRequestData();
     if (isset($requestData['clan'])) {
         $clan = new Dolumar_Players_Clan($requestData['clan']);
         if ($clan) {
             $login = Neuron_Core_Login::__getInstance();
             if ($login->isLogin()) {
                 $me = Neuron_GameServer::getPlayer();
                 $isMember = $clan->isMember($me);
                 $isModerator = $clan->isModerator($me);
                 //__construct ($iForumType, $iForumId, $objUser = false, $bCanSeeAll = false, $bIsModerator = false)
                 $forum = new Neuron_Forum_Forum(1, $clan->getId(), $me, $isMember, $isModerator);
             } else {
                 $forum = new Neuron_Forum_Forum(1, $clan->getId(), false, false, false);
             }
             // Fetch thze title
             $text = Neuron_Core_Text::__getInstance();
             $forum->setTitle(Neuron_Core_Tools::putIntoText($text->get('title', 'forum', 'clan'), array('clan' => Neuron_Core_Tools::output_varchar($clan->getName()))));
             return $forum;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 4
0
 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>';
     }
 }
Ejemplo n.º 5
0
 public function getContent()
 {
     $me = Neuron_GameServer::getPlayer();
     $text = Neuron_Core_Text::__getInstance();
     $text->setFile('unit');
     $text->setSection('equipment');
     if ($this->village && $this->village->isActive() && $this->village->getOwner() && $this->village->getOwner()->getId() == $me->getId()) {
         $page = new Neuron_Core_Template();
         $page->set('noItems', $text->get('noItems'));
         $page->set('available', $text->get('available'));
         $page->set('total', $text->get('total'));
         $equipment = $this->village->getEquipment();
         $yourEquipment = array();
         foreach ($equipment as $type => $items) {
             if (count($items) > 0) {
                 $yourEquipment[$type] = array('type' => $text->get($type, 'types', 'equipment'), 'items' => array());
                 foreach ($items as $item) {
                     $yourEquipment[$type]['items'][] = array($item->getName(true), $item->getAvailableAmount(), $item->getAmount(), Neuron_Core_Tools::output_text($item->getStats_text()));
                 }
             }
         }
         $page->set('equipment', $yourEquipment);
         return $page->parse('equipment.tpl');
     } else {
         return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
     }
 }
Ejemplo n.º 6
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     $login = Neuron_Core_Login::__getInstance();
     if ($login->isLogin()) {
         $player = Neuron_GameServer::getPlayer();
         $pos = $player->getPreferences();
         $pos = $pos['minimapPosition'];
     } else {
         $pos = Neuron_Core_Tools::getInput('_COOKIE', COOKIE_PREFIX . 'prefMP', 'int', 0);
     }
     if ($pos == 4) {
         $this->setPosition('auto', 'auto', '0px', '0px');
     } elseif ($pos == 2) {
         $this->setPosition('0px', '32px', 'auto', 'auto');
     } elseif ($pos == 3) {
         $this->setPosition('auto', '32px', '0px', 'auto');
     } else {
         $this->setPosition('0px', 'auto', 'auto', '0px');
     }
     if ($pos != 5) {
         $this->setType('panel');
     } else {
         // Movable ;-)
         $this->setPosition('0px', 'auto', 'auto', '0px');
         //$this->setOnResize ('onResizeMiniMap');
     }
     // Window settings
     $this->setSize('200px', '150px');
     $this->setTitle('Mini Map');
     $this->setClass('minimap');
     $this->setType('panel');
     $this->setAllowOnlyOnce();
     $this->setPool('minimap');
 }
Ejemplo n.º 7
0
 public function getContent($error = null)
 {
     $text = Neuron_Core_Text::__getInstance();
     $text->setFile('account');
     $text->setSection('premium');
     $player = Neuron_GameServer::getPlayer();
     if (!$player) {
         return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
     }
     $openid = isset($_SESSION['neuron_openid_identity']) ? md5($_SESSION['neuron_openid_identity']) : false;
     if ($player && $player->isFound() && ($player->isEmailCertified() || $openid)) {
         $page = new Neuron_Core_Template();
         // Premium account stuff
         $page->set('premium', $text->get('premium', 'myAccount'));
         if ($player->isPremium()) {
             $page->set('premiumLast', Neuron_Core_Tools::putIntoText($text->get('premiumLast', 'myAccount'), array(date(DATETIME, $player->getPremiumEndDate()))));
             $page->set('extend2', $text->getClickTo($text->get('toPremium', 'myAccount')));
         } else {
             $page->set('notPremium1', $text->get('notPremium', 'myAccount'));
             $page->set('notPremium2', $text->getClickTo($text->get('toPremium', 'myAccount')));
         }
         $page->set('toUse', $text->getClickTo(Neuron_Core_Tools::putIntoText($text->get('toUseCredit'), array('amount' => PREMIUM_COST_CREDITS))));
         $page->set('extend_url', htmlentities($player->getCreditUseUrl(PREMIUM_COST_CREDITS)));
         $page->set('benefits', $this->getBenefits());
         if (!empty($error)) {
             $page->set('error', $text->get($error));
         }
         return $page->parse('gameserver/account/premium.tpl');
     } elseif ($player->isFound()) {
         return '<p>' . $text->get('validateEmail') . '</p>';
     }
 }
Ejemplo n.º 8
0
 public function DoQuote($bbcode, $action, $name, $default, $params, $content)
 {
     if ($action == BBCODE_CHECK) {
         return true;
     }
     $text = Neuron_Core_Text::getInstance();
     $txtname = 'quote';
     $txtparams = array();
     if (isset($params['name'])) {
         $txtparams['name'] = htmlspecialchars(trim($params['name']));
         $txtname .= '_wrote';
         if (isset($params['date'])) {
             $date = strtotime($params['date']);
             $txtparams['date'] = date(DATETIME, $date);
             $txtname .= '_date';
         }
     } else {
         if (!is_string($default)) {
             // Do nothing
         } else {
             $txtparams['name'] = htmlspecialchars(trim($default));
             $txtname .= '_wrote';
         }
     }
     $title = Neuron_Core_Tools::putIntoText($text->get($txtname, 'textconvert', 'main', ""), $txtparams);
     $out = "\n<blockquote class=\"bbcode_quote\">\n";
     if (!empty($title)) {
         $out .= "<h4 class=\"bbcode_quote_head\">" . $title . "</h4>\n";
     }
     $out .= "<div class=\"bbcode_quote_body\">" . $content . "</div>\n</blockquote>\n";
     return $out;
 }
Ejemplo n.º 9
0
 public function getContent($error = null)
 {
     $sUploadUrl = ABSOLUTE_URL . 'page/customsign/?sessionId=' . session_id();
     if (!file_exists(PUBLIC_PATH) || !is_writable(PUBLIC_PATH)) {
         return '<p>Error: ' . PUBLIC_PATH . ' does not exist or is not writeable.</p>';
     }
     if (!isset($this->village)) {
         return '<p class="false">No village defined.</p>';
     }
     $text = Neuron_Core_Text::getInstance();
     $text->setFile('premium');
     $text->setSection('bonusbuilding');
     $page = new Neuron_Core_Template();
     $page->set('upload_url', $sUploadUrl);
     $buildings = $this->getPublicBuildings();
     foreach ($this->getPublicBuildings() as $v) {
         $page->addListValue('buildings', $v);
     }
     $db = Neuron_DB_Database::getInstance();
     $login = Neuron_Core_Login::getInstance();
     $r = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tplayers_tiles\n\t\t\tWHERE\n\t\t\t\tt_userid = {$login->getUserId()}\n\t\t\tORDER BY\n\t\t\t\tt_id DESC\n\t\t\tLIMIT\n\t\t\t\t8\n\t\t");
     $data = array();
     foreach ($r as $v) {
         if (file_exists(PUBLIC_PATH . $v['t_imagename'])) {
             $imagename = PUBLIC_URL . $v['t_imagename'];
             $action = new Dolumar_View_SelectBuildLocation(100, 'build bonus building', null, new Neuron_GameServer_Map_Display_Sprite($imagename), $v['t_id']);
             // selectBuildLocation (this, 100, null, 'placeholder', null, <?=$v['id']
             $page->addListValue('signs', array('id' => $v['t_id'], 'image_url' => PUBLIC_URL . $v['t_imagename'], 'credits' => self::CREDIT_COST, 'action' => $action->getAction()));
         }
     }
     if (isset($error)) {
         $page->set($error);
     }
     return $page->parse('dolumar/bonusbuilding/bonusbuilding.phpt');
 }
Ejemplo n.º 10
0
 private function commandUnit($building, $unitId)
 {
     $building = $this->village->buildings->getBuilding($building);
     if (!$building instanceof $this->buildingType) {
         return '<p>Invalid input: building not found.</p>';
     }
     $text = Neuron_Core_Text::__getInstance();
     $input = $this->getInputData();
     $action = isset($input['action']) ? $input['action'] : null;
     $unit = $this->village->getSpecialUnit($unitId);
     if (!$unit) {
         return '<p>Invalid input: unit not found.</p>';
     } elseif ($unit->isMoving()) {
         return '<p class="false">' . $text->get('isMoving', 'commandUnit', 'thievery') . '</p>';
     }
     switch ($action) {
         case 'move':
             return $this->commandMoveUnit($building, $unit);
             break;
         default:
             // Check if a spell is selected
             $spell = isset($input['spell']) ? $input['spell'] : null;
             if (isset($spell)) {
                 $spell = $unit->getEffect($spell);
                 if ($spell && isset($input['confirm'])) {
                     return $this->doCastSpell($unit, $spell, $unit->getLocation(), false);
                 } else {
                     return $this->getConfirmCast($unit, $spell, $unit->getLocation(), $this->getInputData());
                 }
             } else {
                 return $this->getCastSpell($unit, array('unit' => $unit->getId()), array('building' => $building->getId()));
             }
             break;
     }
 }
Ejemplo n.º 11
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     // Window settings
     $this->setSize('250px', '300px');
     $this->setTitle($text->get('effectreports', 'menu', 'main'));
     $this->setAllowOnlyOnce();
 }
Ejemplo n.º 12
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     // Window settings
     $this->setSize('250px', '300px');
     $this->setTitle('Village Overview');
     $this->setAllowOnlyOnce();
 }
Ejemplo n.º 13
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     // Window settings
     $this->setSize('350px', '300px');
     $this->setTitle('News bulletin');
     $this->setAllowOnlyOnce();
 }
Ejemplo n.º 14
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     // Window settings
     $this->setSize('550px', '280px');
     $this->setTitle($text->get('clanlogs', 'menu', 'main'));
     $this->setAllowOnlyOnce();
 }
Ejemplo n.º 15
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     // Window settings
     $this->setSize('600px', '500px');
     $this->setTitle('Underworld');
     $this->setClass('small-border no-overflow');
     $this->setAllowOnlyOnce();
 }
 public function setReturnData($returnData, $returnText = null)
 {
     $this->sReturnAction = str_replace('"', "'", json_encode($returnData));
     if (isset($returnText)) {
         $this->sReturnText = $returnText;
     } else {
         $text = Neuron_Core_Text::__getInstance();
         $this->sReturnText = $text->get('return', 'chooseTarget', 'main');
     }
 }
Ejemplo n.º 17
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     // Window settings
     $this->setSize('150px', '100px');
     $this->setTitle('Server settings');
     $this->setAllowOnlyOnce();
     $this->setCentered();
     //$this->setModal ();
 }
Ejemplo n.º 18
0
 public function getContent()
 {
     $player = Neuron_GameServer::getPlayer();
     if (!$player) {
         $text = Neuron_Core_Text::__getInstance();
         return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
     }
     $page = new Neuron_Core_Template();
     $page->set('sUrl', ABSOLUTE_URL . '?pref=' . $player->getId());
     return $page->parse('account/invite.phpt');
 }
Ejemplo n.º 19
0
 protected function getCustomContent($input)
 {
     $text = Neuron_Core_Text::__getInstance();
     $text->setFile('buildings');
     $text->setSection('producing');
     $page = new Neuron_Core_Template();
     $page->set('hourlyIncome', $text->get('hourlyIncome'));
     $page->set('producing1', $text->get('producing1'));
     $page->set('producing2', $text->get('producing2'));
     $page->set('income', $this->resourceToText($this->getIncome(), true, false));
     return $page->parse('buildings/producing.tpl');
 }
Ejemplo n.º 20
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     $login = Neuron_Core_Login::__getInstance();
     $data = $this->getRequestData();
     // Window settings
     $this->setSize('558px', '650px');
     $this->setTitle($text->get('battle', 'menu', 'main'));
     // Onload
     $this->setOnload('initBattleSimulator');
     $this->setClassName('battle simulator');
 }
Ejemplo n.º 21
0
 private static function parseNewFile($file)
 {
     $text = Neuron_Core_Text::__getInstance();
     $params1 = 'api.php?action=query&prop=revisions&rvprop=timestamp|user|comment|content&format=php&titles=';
     $params2 = 'api.php?action=query&prop=imageinfo&iiprop=url&format=php&titles=';
     $url = WIKI_GUIDE_URL . $params1 . urlencode($file);
     // Load file from wiki
     $wiki = file_get_contents($url);
     $wiki = unserialize($wiki);
     // Get the real content
     $content = Neuron_Core_Tools::getArrayFirstValue($wiki['query']['pages']);
     if (!isset($content[1]['revisions'])) {
         return false;
     } else {
         $content = Neuron_Core_Tools::getArrayFirstValue($content[1]['revisions']);
         $content = $content[1]['*'];
         // Search for thze images
         $images = array();
         //[[Image:Voorbeeld.png]]
         // Replace external links
         $images = array();
         preg_match_all("/\\[\\[Image:([^|]*?)]]/si", $content, $images, PREG_PATTERN_ORDER);
         // Fetch all image infos
         $imageOut = array();
         foreach ($images[1] as $k => $v) {
             $imgs = WIKI_GUIDE_URL . $params2 . 'Image:' . addslashes($v);
             $imgdata = unserialize(file_get_contents($imgs));
             $imgdata = Neuron_Core_Tools::getArrayFirstValue($imgdata['query']['pages']);
             if (isset($imgdata[1]['imageinfo'])) {
                 $sUrl = WIKI_GUIDE_URL . substr($imgdata[1]['imageinfo'][0]['url'], 1);
                 $content = str_replace($images[0][$k], '***img***' . $sUrl . '***/img***', $content);
             }
         }
         // Replace external links
         $content = preg_replace('/([^\\[]{1})' . '\\[' . '([^ \\]]+)' . '\\]' . '([^\\]]{1})' . '/si', '\\1[url]\\2[/url]\\3', $content);
         $content = preg_replace('/([^\\[]{1})' . '\\[' . '([^ \\]]+)' . ' ([^\\]]+)' . '\\]' . '([^\\]]{1})' . '/si', '\\1[url=\\2]\\3[/url]\\4', $content);
         // Replace code
         $content = str_replace('<code>', '[code]', $content);
         $content = str_replace('</code>', '[/code]', $content);
         $content = str_replace('***img***', '[img align="left"]', $content);
         $content = str_replace('***/img***', '[/img]', $content);
         // Replace headers
         $content = preg_replace("/====([^|]*?)====/si", "[h4]\\1[/h4]", $content);
         $content = preg_replace("/===([^|]*?)===/si", "[h3]\\1[/h3]", $content);
         $content = preg_replace("/==([^|]*?)==/si", "[h2]\\1[/h2]", $content);
         $content = html_entity_decode($content, ENT_NOQUOTES, 'UTF-8');
         $content = preg_replace("/\\[\\[([^|]*?)]]/si", '[action title="\\1" data="{\'page\':\\1\'}"]\\1[/action]', $content);
         $content = preg_replace("/\\[\\[([^|\\[]*?)\\|([^|\\]]*?)\\]\\]/si", '[action title="\\2" data="{\'page\':\'\\1\'}"]\\2[/action]', $content);
         $content = Neuron_Core_Tools::output_text($content);
         return $content;
     }
 }
Ejemplo n.º 22
0
 protected function getForum()
 {
     $text = Neuron_Core_Text::__getInstance();
     $login = Neuron_Core_Login::__getInstance();
     if ($login->isLogin()) {
         $me = Neuron_GameServer::getPlayer();
         $forum = new Neuron_Forum_Forum(0, 0, $me, $me->isChatModerator(), $me->isChatModerator());
     } else {
         $forum = new Neuron_Forum_Forum(0, 0, false, false, false);
     }
     $forum->setTitle($text->get('ingameForum', 'menu', 'main'));
     return $forum;
 }
Ejemplo n.º 23
0
 public function getContent()
 {
     //return $this->getCurrentResources ();
     $data = $this->getRequestData();
     $page = isset($data['page']) ? intval($data['page']) : 1;
     $myself = Neuron_GameServer::getPlayer();
     // Sort of config ;-)
     $totalPages = 0;
     if ($myself) {
         $villages = $myself->getVillages();
         $totalPages = count($villages);
     }
     $content = $this->getResourcesPage();
     // Next & previous pages
     $nextPage = $page + 1;
     $previousPage = $page - 1;
     if ($previousPage < 1) {
         // Highest page id
         $previousPage = $totalPages;
     }
     if ($nextPage > $totalPages) {
         $nextPage = 1;
     }
     $text = Neuron_Core_Text::__getInstance();
     $page = new Neuron_Core_Template();
     $page->set('nextPage', $nextPage);
     $page->set('previousPage', $previousPage);
     $page->set('minimap', $text->get('minimap', 'menu', 'main'));
     // Check for news messages
     $hasMessages = false;
     if ($myself) {
         $mapper = Neuron_GameServer_Mappers_CachedChatMapper::getInstance();
         $messages = $mapper->countUnreadMessages($myself);
         $hasMessages = $messages > 0;
         //return $messages;
         // Get current village
         $village = $myself->getCurrentVillage();
         if ($village) {
             $page->set('current_village', Neuron_Core_Tools::output_varchar($village->getName()));
             $page->set('current_village_id', Neuron_Core_Tools::output_varchar($village->getId()));
         }
     }
     $page->set('hasMessages', $hasMessages);
     $page->set('inbox', $text->get('inbox', 'menu', 'main'));
     $page->set('home', $text->get('home', 'menu', 'main'));
     $page->set('homecors', $this->getHomeLocation());
     $page->set('content', $content);
     return $page->parse('newsbar.tpl');
 }
Ejemplo n.º 24
0
 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();
 }
Ejemplo n.º 25
0
 public function getName()
 {
     $data = $this->getLogArray();
     //print_r ($data);
     $id = $data['building'];
     $race = Dolumar_Races_Race::getFromId($data['race']);
     list($locationX, $locationY) = array($data['x'], $data['y']);
     $level = $data['level'];
     $building = Dolumar_Buildings_Building::getBuilding($id, $race, $locationX, $locationY);
     if ($building) {
         $text = Neuron_Core_Text::getInstance();
         return $building->getName() . ' ' . $text->get('lvl', 'building', 'building') . ' ' . $level;
     } else {
         return 'Building not found: ' . print_r($data);
     }
 }
Ejemplo n.º 26
0
 protected function getCloseWindow()
 {
     $input = $this->getInputData();
     $text = Neuron_Core_Text::__getInstance();
     if (isset($input['confirm']) && $input['confirm']) {
         $player = Neuron_GameServer::getPlayer();
         if ($player) {
             $player->setPreference('closeTutorial', 1);
         }
         $this->closeWindow();
     } else {
         $out = '<p>' . $text->get('closeTutorial', 'help', 'main') . '</p>';
         $out .= '<p><a href="javascript:void(0);" ' . 'onclick="windowAction (this, {\'page\':\'window:close\',\'confirm\':1})">' . $text->get('closeTutorialBtn', 'help', 'main') . '</a></p>';
         return $out;
     }
 }
Ejemplo n.º 27
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     $data = $this->getRequestData();
     $center = isset($data['centered']) ? $data['centered'] : true;
     $width = isset($data['width']) ? $data['width'] . 'px' : '600px';
     $height = isset($data['height']) ? $data['width'] . 'px' : '500px';
     $title = isset($data['title']) ? $data['title'] : null;
     // Window settings
     $this->setSize($width, $height);
     $this->setTitle($title);
     $this->setClass('small-border no-overflow');
     if ($center) {
         $this->setCentered();
     }
 }
Ejemplo n.º 28
0
 public function getContent()
 {
     $login = Neuron_Core_Login::__getInstance();
     $text = Neuron_Core_Text::__getInstance();
     $text->setFile('village');
     $text->setSection('economics');
     if ($login->isLogin() && $this->village && $this->village->isFound()) {
         $me = Neuron_GameServer::getPlayer();
         if ($this->village->isActive() && ($me->getId() == $this->village->getOwner()->getId() || $me->isModerator())) {
             $page = new Neuron_Core_Template();
             $page->set('resources', $text->get('resources'));
             $page->set('stock', $text->get('stock'));
             $page->set('max', $text->get('max'));
             $page->set('income', $text->get('income'));
             $page->set('norunes', $text->get('norunes'));
             $page->set('bruto', $text->get('bruto'));
             $page->set('consuming', $text->get('consuming'));
             $page->set('honour', $this->village->honour->getHonour());
             $page->set('hourly', $text->get('hourly'));
             $res = $this->village->resources->getResources();
             $income = $this->village->resources->getIncome();
             $capacity = $this->village->resources->getCapacity();
             $consumption = $this->village->resources->getUnitConsumption();
             $bruto = $this->village->resources->getBrutoIncome();
             foreach ($res as $k => $v) {
                 $page->addListValue('resources', array(ucfirst($text->get($k, 'resources', 'main')), $v, $capacity[$k], $income[$k], 'resource' => $k, 'bruto' => isset($bruto[$k]) ? $bruto[$k] : 0, 'consuming' => isset($consumption[$k]) ? $consumption[$k] : 0));
             }
             // Runes
             $page->set('runes', $text->get('runes'));
             $runes = $this->village->resources->getRuneSummary();
             foreach ($runes as $k => $v) {
                 if ($v > 0) {
                     if ($k == 'random') {
                         $k = 'randomrune';
                     }
                     $page->addListValue('runes', array('name' => ucfirst($text->get($k, 'runeDouble', 'main')), 'available' => $v['available'], 'key' => $k, 'used' => $v['used'], 'used_percentage' => $v['used_percentage'] * 100));
                 }
             }
             $page->sortList('runes');
             return $page->parse('economics.tpl');
         } else {
             return '<p>You are not authorized to view this information: ' . $this->village->getId() . ' != ' . $me->getId() . '</p>';
         }
     } else {
         return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
     }
 }
Ejemplo n.º 29
0
 public function setSettings()
 {
     $text = Neuron_Core_Text::__getInstance();
     $login = Neuron_Core_Login::__getInstance();
     // Window settings
     $this->setSize('250px', '245px');
     $this->setAllowOnlyOnce();
     $data = $this->getRequestData();
     // Construct village
     $this->village = Dolumar_Players_Village::getVillage($data['vid']);
     if ($login->isLogin() && $this->village->isFound()) {
         $this->setTitle($text->get('technologies', 'menu', 'main') . ' (' . Neuron_Core_Tools::output_varchar($this->village->getName()) . ')');
     } else {
         $this->village = false;
         $this->setTitle($text->get('technologies', 'menu', 'main'));
     }
 }
Ejemplo n.º 30
0
 public function getContent()
 {
     if (!$this->objVillage) {
         $text = Neuron_Core_Text::__getInstance();
         return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
     }
     $input = $this->getInputData();
     // Get logs from this village
     $objLogs = Dolumar_Players_Logs::__getInstance();
     $iPage = isset($input['page']) ? $input['page'] : 0;
     $page = new Neuron_Core_Template();
     // Split in pages
     $limit = Neuron_Core_Tools::splitInPages($page, $objLogs->countLogs($this->objVillage), $iPage, 10);
     $objLogs->addMyVillage($this->objVillage);
     $logs = $objLogs->getLogs($this->objVillage, $limit['start'], $limit['perpage'], 'DESC');
     return $this->getLogHTML($page, $objLogs, $logs);
 }