Esempio n. 1
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>';
     }
 }
 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');
 }
Esempio 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;
     }
 }
Esempio n. 4
0
 private function getEquipmentStats()
 {
     $equipment = Dolumar_Players_Equipment::getAllEquipment();
     $types = array();
     foreach ($equipment as $v) {
         $type = $v->getItemType();
         if (!isset($types[$type])) {
             $types[$type] = array();
         }
         $types[$type][] = $v;
     }
     $html = '<div class="equipment-report fancybox">';
     foreach ($types as $type => $data) {
         $this->sortLogables($data);
         $html .= '<div class="equipment-type">';
         $html .= '<h2>' . $type . '</h2>';
         foreach ($data as $equipment) {
             $html .= '<div class="equipment">';
             $html .= '<h3>' . $equipment->getName() . ' (' . $equipment->getCategory() . ')</h3>';
             for ($i = 1; $i <= Dolumar_Players_Village_Equipment::EQUIPMENT_MAX_LEVEL; $i++) {
                 $equipment->setLevel($i);
                 $html .= '<div class="equipment-level">';
                 $html .= '<h4>' . $i . ': ' . $equipment->getName() . '</h4>';
                 $html .= Neuron_Core_Tools::output_text($equipment->getStats_text());
                 $html .= '<p class="equipment-costs"><span class="stat-title">Cost: </span>' . $equipment->getCraftCost_text() . '</p>';
                 $html .= '</div>';
             }
             $html .= '</div>';
         }
         $html .= '</div><div class="clearer"></div>';
     }
     return $html . '</div>';
 }
Esempio n. 5
0
 private function register()
 {
     $player = Neuron_GameServer::getPlayer();
     if (!$player) {
         echo '<p>Please login.</p>';
         return;
     }
     $name = Neuron_Core_Tools::getInput('_POST', 'name', 'varchar');
     $developer = Neuron_Core_Tools::getInput('_POST', 'developer', 'varchar');
     $email = Neuron_Core_Tools::getInput('_POST', 'email', 'email');
     $user_id = $player->getId();
     $page = new Neuron_Core_Template();
     if ($name && $developer) {
         $consumer = array('requester_name' => $developer, 'requester_email' => $email);
         // Register the consumer
         $store = Neuron_Auth_OAuthStore::getStore();
         $key = $store->updateConsumer($consumer, $user_id);
         // Get the complete consumer from the store
         $consumer = $store->getConsumer($key, $user_id);
         // Some interesting fields, the user will need the key and secret
         $page->set('app_data', array('Consumer ID' => $consumer['id'], 'Consumer Key' => $consumer['consumer_key'], 'Consumer secret' => $consumer['consumer_secret']));
         return $page->parse('oauth/information.phpt');
     } else {
         return $page->parse('oauth/register.phpt');
     }
 }
 public function getBody()
 {
     $timeframe = Neuron_Core_Tools::getInput('_GET', 'timeframe', 'int', 60 * 60 * 48);
     $db = Neuron_DB_Database::__getInstance();
     $page = new Neuron_Core_Template();
     $page->set('timeframe', $timeframe);
     // Fetch all doubles
     $data = $db->query("\n\t\t\tSELECT\n\t\t\t\tn_login_log.l_ip,\n\t\t\t\t\n\t\t\t\tGROUP_CONCAT(DISTINCT n_login_log.l_plid) AS plids,\n\t\t\t\tGROUP_CONCAT(DISTINCT n_players.nickname) AS nicknames,\n\t\t\t\t\n\t\t\t\tGROUP_CONCAT(c.pac_plid1) AS cleared_1,\n\t\t\t\tGROUP_CONCAT(c.pac_plid2) AS cleared_2,\n\t\t\t\tGROUP_CONCAT(c.pac_reason) AS cleared_reason,\n\t\t\t\t\n\t\t\t\tCOUNT(DISTINCT l_plid) AS aantal\n\t\t\tFROM\n\t\t\t\tn_login_log\n\t\t\tLEFT JOIN\n\t\t\t\tn_players ON n_login_log.l_plid = n_players.plid\n\t\t\tLEFT JOIN\n\t\t\t\tn_players_admin_cleared c ON (c.pac_plid1 = n_login_log.l_plid OR c.pac_plid2 = n_login_log.l_plid)\n\t\t\tWHERE\n\t\t\t\tn_login_log.l_datetime > FROM_UNIXTIME(" . (NOW - $timeframe) . ") AND\n\t\t\t\tn_players.isPlaying = 1\n\t\t\tGROUP BY\n\t\t\t\tl_ip\n\t\t\tHAVING\n\t\t\t\taantal > 1\n\t\t");
     foreach ($data as $row) {
         $plids = explode(',', $row['plids']);
         $nicknames = explode(',', $row['nicknames']);
         // Check clearances.
         $clearances = $this->getClearancesFromRow($row);
         $players = array();
         $combinedlogs = "";
         foreach ($plids as $k => $v) {
             $players[] = array('id' => $plids[$k], 'name' => isset($nicknames[$k]) ? $nicknames[$k] : 'no-nickname-set', 'url' => $this->getUrl('user', array('id' => $plids[$k])), 'logs_url' => $this->getUrl('gamelogs', array('players' => $plids[$k])));
             $combinedlogs .= $plids[$k] . "|";
         }
         // Check for cleared accounts
         $allcleared = true;
         foreach ($players as $k => $v) {
             $players[$k]['cleared'] = $this->isCleared($clearances, $v, $players);
             if ($allcleared && !$players[$k]['cleared']) {
                 $allcleared = false;
             }
         }
         $combinedlogs = substr($combinedlogs, 0, -1);
         $page->addListValue('players', array('ip' => $row['l_ip'], 'players' => $players, 'combined_logs_url' => $this->getUrl('gamelogs', array('players' => $combinedlogs)), 'clearmultis' => $this->getUrl('clearmultis', array('players' => $combinedlogs)), 'cleared' => $allcleared, 'amount' => $row['aantal']));
     }
     $page->usortList('players', array($this, 'sortcompare'));
     return $page->parse('pages/admin/multis.phpt');
 }
Esempio n. 7
0
 public function getContent($msg = null, $failed = false)
 {
     $myself = Neuron_GameServer::getPlayer();
     if (!$this->village->isActive() || $this->village->getOwner()->getId() != $myself->getId()) {
         return false;
     }
     $page = new Neuron_Core_Template();
     $page->setTextSection('formation', 'battle');
     // Load battle slots
     $slots = $this->village->getDefenseSlots();
     // Load your units
     $squads = $this->village->getSquads(false, false, false);
     // See how much rows that is
     $rows = $this->countRows($squads, $slots);
     $page->set('rows', $rows);
     $page->set('slots', $slots);
     if (!empty($msg)) {
         $page->set('message', $msg);
         $page->set('error', $failed);
     }
     foreach ($squads as $v) {
         if ($v->getUnitsAmount() > 0) {
             $page->addListValue('squads', array('sName' => Neuron_Core_Tools::output_varchar($v->getName()), 'oUnits' => $v->getUnits(), 'id' => $v->getId()));
         }
     }
     return $page->parse('battle/formation.phpt');
 }
 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');
 }
Esempio n. 9
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>';
     }
 }
Esempio n. 10
0
function checkBuildings($buildings, $sQ, $i, $j, $tx, $ty)
{
    global $output;
    // Objects & buildings
    if (isset($buildings[$tx]) && isset($buildings[$tx][$ty])) {
        $loc = array();
        foreach ($buildings[$tx][$ty] as $b) {
            $displayobject = $b->getDisplayObject();
            $offset = $displayobject->getOffset();
            $title = Neuron_Core_Tools::output_varchar($b->getName());
            $location = $b->getLocation();
            if (!isset($loc[$location[0] . 'p' . $location[1]])) {
                if (!isset($output['regions'][$sQ]['objects'][$i])) {
                    $output['regions'][$sQ]['objects'][$i] = array();
                }
                if (!isset($output['regions'][$sQ]['objects'][$i][$j])) {
                    $output['regions'][$sQ]['objects'][$i][$j] = array();
                }
                $id = time();
                $output['regions'][$sQ]['objects'][$i][$j][] = array('tx' => $tx, 'ty' => $ty, 'id' => $id, 'i' => $i - $offset[0], 'j' => $j - $offset[1], 'm' => map_image_cache($displayobject), 'n' => $title, 's' => $b->getMapObjectStatus()->getArray(), 'c' => $b->getEvents('click'), 'z' => 0, 'd' => true);
                $loc[$location[0] . 'p' . $location[1]] = true;
            }
        }
    }
}
Esempio n. 11
0
 public function getBody()
 {
     $myself = Neuron_GameServer::getPlayer();
     if (!$myself->isAdmin()) {
         return '<p>You are not allowed to execute the commands. Only admins are.</p>';
     }
     // Check for input
     $record = Neuron_Core_Tools::getInput('_GET', 'id', 'int');
     $action = Neuron_Core_Tools::getInput('_GET', 'action', 'varchar');
     if ($record && $action) {
         $this->processAction($record, $action == 'accept');
     }
     $page = new Neuron_Core_Template();
     $db = Neuron_DB_Database::getInstance();
     $list = $db->query("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\tn_mod_actions\n\t\t\tWHERE\n\t\t\t\tma_processed = 0\n\t\t\tORDER BY\n\t\t\t\tma_date ASC\n\t\t");
     foreach ($list as $v) {
         $params = json_decode($v['ma_data'], true);
         $target = false;
         if (isset($params['plid'])) {
             $target = Neuron_GameServer::getPlayer($params['plid']);
         }
         $actor = Neuron_GameServer::getPlayer($v['ma_plid']);
         $page->addListValue('actions', array('date' => $v['ma_date'], 'action' => $v['ma_action'], 'target' => $target ? $target->getDisplayName() : null, 'actor' => $actor ? $actor->getDisplayName() : null, 'reason' => !empty($v['ma_reason']) ? Neuron_Core_Tools::output_text($v['ma_reason']) : null, 'accept_url' => self::getUrl('execute', array('id' => $v['ma_id'], 'action' => 'accept')), 'deny_url' => self::getUrl('execute', array('id' => $v['ma_id'], 'action' => 'deny'))));
     }
     return $page->parse('pages/admin/execute/list.phpt');
 }
Esempio n. 12
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>';
     }
 }
Esempio n. 13
0
 private function printResults($page, $query)
 {
     foreach ($query as $v) {
         $displayname = Neuron_URLBuilder::getInstance()->getOpenUrl('PlayerProfile', Neuron_Core_Tools::output_varchar($v['nickname']), array('plid' => $v['plid']));
         $villagename = Neuron_URLBuilder::getInstance()->getOpenUrl('VillageProfile', Neuron_Core_Tools::output_varchar($v['vname']), array('village' => $v['vid']));
         $page->addListValue('results', array('id' => $v['plid'], 'nickname' => $v['nickname'], 'displayname' => $displayname, 'village' => $v['vname'], 'displayvillage' => $villagename, 'distance' => Neuron_Core_Tools::output_distance($v['distance']), 'networth' => $v['networth']));
     }
 }
Esempio n. 14
0
 public function getCustomContent($input)
 {
     $data = $this->getData();
     if (!$data) {
         return null;
     }
     $content = json_decode($data['t_description'], true);
     return Neuron_Core_Tools::output_text($this->getTranslatedContent($content, 'description'));
 }
Esempio n. 15
0
 public function getDescription($tags = true)
 {
     $this->loadData();
     if ($tags) {
         return Neuron_Core_Tools::putIntoText($this->data['c_description'], array('clan' => $this->getName(), 'members' => count($this->getMembers())));
     } else {
         return $this->data['c_description'];
     }
 }
 public function getBody()
 {
     $player = Neuron_GameServer::getPlayer(Neuron_Core_Tools::getInput('_GET', 'id', 'int'));
     $statistics = $player->getStatistics();
     $out = $this->linearArray($statistics);
     $page = new Neuron_Core_Template();
     $page->set('statistics', $out);
     return $page->parse('gameserver/pages/statistics.phpt');
 }
Esempio n. 17
0
 public function getContent()
 {
     $server = Neuron_GameServer::getServer();
     $page = new Neuron_Core_Template();
     if ($server->getEndgameStartDate() > time()) {
         $page->set('endgame_start', Neuron_Core_Tools::getCountdown($server->getEndgameStartDate()));
     } else {
         $page->set('endgame_start', '<strong>already started</strong>');
     }
     return $page->parse('dolumar/serversettings.phpt');
 }
 public static function text2bundle($text)
 {
     $path = $text->getPath();
     $output = array();
     self::handleDirectory($output, $path);
     $data = array();
     foreach ($output as $k => $v) {
         $data[] = array('attributes' => array('name' => $k), 'element-content' => $v);
     }
     return Neuron_Core_Tools::output_xml($data, null, 'messagebundle', array(), 'msg');
 }
Esempio n. 19
0
 public function getBody()
 {
     $village = Neuron_Core_Tools::getInput('_GET', 'village', 'int');
     $village = Dolumar_Players_Village::getVillage($village);
     $body = '<h2>' . $village->getName() . '</h2>';
     $location = $village->buildings->getTownCenterLocation();
     //$url = ABSOLUTE_URL . '#' . $location[0] . ',' . $location[1];
     $url = $this->getUrl('Playerprofile', array('plid' => $village->getOwner()->getId()));
     header('Location: ' . $url);
     return $body;
 }
Esempio n. 20
0
 public function getIncome($since = NOW, $now = NOW)
 {
     $profiler = Neuron_Profiler_Profiler::getInstance();
     $profiler->start('Calculating income for this ' . $this->getClassName());
     $o = array($this->RESOURCE => $this->calculateIncome());
     $profiler->start('Processing bonus effects');
     $o = Neuron_Core_Tools::floor_array($this->getVillage()->procBonusses('procIncome', array($o, $this), $now, $since));
     $profiler->stop();
     $profiler->stop();
     return $o;
 }
 public function send($sUrl)
 {
     $xml = Neuron_Core_Tools::output_xml($this->sXML, 1, 'userstats', array());
     // And now: send the notification!
     $postfields = array('userstats_xml' => $xml);
     // Make sure curl doesn't think that we're trying to upload files
     foreach ($postfields as $k => $v) {
         if (substr($v, 0, 1) == '@') {
             // Let's hope the receive will trim the response.
             // It's only used for the bare message anyway.
             $postfields[$k] = ' ' . $v;
         }
     }
     if (defined('NOTIFICATION_DEBUG')) {
         $postfields['debug'] = true;
         echo '<h2>Preparing data to send:</h2><pre>';
         echo htmlentities(print_r($postfields, true));
         echo '</pre>';
         echo '<h2>Sending data</h2>';
         echo '<p>Contacting <span style="color: red;">' . $sUrl . '</span>... ';
     }
     try {
         if (function_exists('curl_init')) {
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $sUrl);
             //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             // return into a variable
             curl_setopt($ch, CURLOPT_TIMEOUT, 3);
             // times out after 4s
             curl_setopt($ch, CURLOPT_POST, true);
             // set POST method
             curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
             // add POST fields
             // execute curl command
             $result = curl_exec($ch);
             // run the whole process
         }
     } catch (Exception $e) {
         // Do nothing. The notification was not sent.
     }
     // Show if debug is on.
     if (defined('NOTIFICATION_DEBUG')) {
         if (!$result) {
             echo '<p>cURL error: ' . curl_error($ch) . '</p>';
         }
         echo 'Done!</p>';
         echo '<h2>Beginning notification output:</h2>';
         echo '<pre>' . htmlentities($result) . '</pre>';
         echo '<h2>End of notification output.</h2>';
     }
 }
Esempio n. 22
0
 public function getName()
 {
     /*
     	$res, 
     	$showRunes = true, 
     	$dot = true, 
     	$village = false, 
     	$runeId = 'rune', 
     	$html = true, 
     	$income = array (),
     	$capacity = array ()
     */
     return Neuron_Core_Tools::resourceToText($this->getLogArray(), false, false, false, false, false);
 }
Esempio n. 23
0
 protected function setPlayer()
 {
     $o = $this->getRequestData();
     if (!isset($o['village']) && isset($o[0])) {
         $o['village'] = $o[0];
     } elseif (!isset($o['village'])) {
         $o['village'] = null;
     }
     $village = Dolumar_Players_Village::getVillage($o['village']);
     if ($village) {
         $this->player = $village->getOwner();
         $this->thisVillage = $village;
     }
     $this->setTitle(Neuron_Core_Tools::output_varchar($this->player->getNickname()));
 }
function sendNotification($id, $sender, $public)
{
    echo '<h1>';
    echo $sender ? 'With sender' : 'Without sender';
    echo ' and ';
    echo $public ? 'public' : 'private';
    echo '</h1>';
    $player = Dolumar_Players_Player::getFromId($id);
    $other = Dolumar_Players_Player::getFromId(Neuron_Core_Tools::getInput('_GET', 'from', 'int', 1));
    if ($sender) {
        echo '<p>Message was sent from ' . $other->getNickname() . '.</p>';
    }
    $player->sendNotification('test', 'system', array('target' => $other, 'defender' => $other->getMainVillage(), 'pl_defender' => $other, 'village' => $player->getMainVillage(), 'player' => $player), $sender ? $other : null, $public);
    echo '<p style="color: green;">A notification has been sent to user ' . $player->getName() . '.</p>';
}
Esempio n. 25
0
 public function getContent()
 {
     $map = $this->getServer()->getMap();
     if (!$map instanceof Dolumar_Underworld_Map_Map) {
         $this->reloadWindow();
         return '<p>Mission is finished.</p>';
     }
     $mission = $map->getMission();
     $sides = $mission->getSides();
     $objective = $mission->getObjective();
     // Check the victory conditions
     $objective->checkVictoryConditions();
     if ($objective instanceof Dolumar_Underworld_Models_Objectives_TakeAndHold) {
         $out = '<p>Hold the center castle until the counter reaches 0.</p>';
         $scores = $objective->getScores();
         $out .= '<ul>';
         foreach ($scores as $v) {
             $timeleft = $objective->getHoldDuration() - $v['score'];
             if ($timeleft > 0) {
                 if ($v['increasing']) {
                     $timeleft = Neuron_Core_Tools::getCountdown(NOW + $timeleft);
                 } else {
                     $timeleft = Neuron_Core_Tools::getDuration($timeleft);
                 }
             } else {
                 $timeleft = 0;
             }
             $out .= '<li>' . $v['side']->getDisplayName() . ': ' . $timeleft . '</li>';
         }
         $out .= '</ul>';
     } else {
         $out = '<p>Just explore ^^</p>';
     }
     /*
     		foreach ($sides as $v)
     		{
     
     
     			$checkpoints = $objective->getConqueredCheckpoints ($v);
     			$score = count ($checkpoints);
     
     			$out .= '<p>- Team ' . $v->getId () . ': ' . $score . '</p>';
     		}*/
     $out .= '<p>' . Neuron_URLBuilder::getInstance()->getOpenUrl('Battle', 'Battle reports', array()) . '</p>';
     return $out;
 }
Esempio n. 26
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);
 }
Esempio n. 27
0
 public function getContent()
 {
     $player = Neuron_GameServer::getPlayer();
     if ($player && $player->isPlaying()) {
         $page = new Neuron_Core_Template();
         // Check for welcome message
         if (isset($_SESSION['welcome_html'])) {
             $page->set('welcome', $_SESSION['welcome_html']);
         }
         $server = Neuron_GameServer_Server::getInstance();
         $txt = $server->getText('headline');
         $page->set('headline', isset($txt) ? Neuron_Core_Tools::output_text($txt) : null);
         $page->set('nickname', $player->getDisplayName());
         $page->set('isPremium', $player->isPremium());
         $page->set('date', date(DATE, $player->getPremiumEndDate()));
         $page->set('isFreePremium', !$player->isProperPremium());
         $msg = Neuron_GameServer_Mappers_CachedChatMapper::getInstance();
         $messages = $msg->countUnreadMessages($player);
         $page->set('inbox', $messages);
         $clans = $player->getClans();
         $page->set('hasclan', count($clans) > 0);
         if (count($clans) > 0) {
             $objlogs = Dolumar_Players_ClanLogs::getInstance();
             $objlogs->clearMyVillages();
             foreach ($player->getVillages() as $village) {
                 $objlogs->addMyVillage($village);
             }
             $logs = $objlogs->getClanLogs($clans, 0, 3);
             foreach ($logs as $v) {
                 $page->addListValue('logs', array('date' => date(DATETIME, $v['timestamp']), 'text' => $objlogs->getLogText($v)));
             }
         }
         // Fetch thze news
         if (defined('GAMENEWS_RSS_URL')) {
             $text = Neuron_Core_Text::getInstance();
             $localized_link = str_replace('{lang}', $text->getCurrentLanguage(), GAMENEWS_RSS_URL);
             $rss = new Neuron_Core_RSSParser($localized_link);
             $rss->setCache(Neuron_Core_Cache::getInstance('newsfeed/'));
             foreach ($rss->getItems(3) as $v) {
                 $page->addListValue('gamenews', array('date' => $v['date'] ? date(DATETIME, $v['date']) : null, 'title' => $v['title'], 'url' => $v['url']));
             }
         }
         return $page->parse('dolumar/welcome/welcome.phpt');
     }
     return false;
 }
Esempio n. 28
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'));
     }
 }
 private function getStartVacation()
 {
     $myself = Neuron_GameServer::getPlayer();
     $input = $this->getInputData();
     $page = new Neuron_Core_Template();
     if (isset($input['confirm']) && Neuron_Core_Tools::checkConfirmLink($input['confirm'])) {
         if ($myself->startVacationMode()) {
             $page->set('done', true);
         } else {
             $page->set('done', false);
             $page->set('error', $myself->getError());
         }
     } else {
         $page->set('done', false);
     }
     $page->set('checkkey', Neuron_Core_Tools::getConfirmLink());
     return $page->parse('gameserver/account/vacationMode.phpt');
 }
Esempio n. 30
0
 public function getOuterBody()
 {
     $username = Neuron_Core_Tools::getInput('_POST', 'username', 'varchar');
     $password = Neuron_Core_Tools::getInput('_POST', 'password', 'varchar');
     $page = new Neuron_Core_Template();
     if ($username && $password) {
         $chk = $this->login->login($username, $password, false);
         if ($chk) {
             $url = $this->getUrl('index');
             header('Location: ' . $url);
             return '<p>Welcome! Click <a href="' . $url . '">here</a> to continue.</p>';
         } else {
             $page->set('error', $this->login->getError());
         }
     }
     $page->set('action', '');
     return $page->parse('pages/login.phpt');
 }