コード例 #1
0
ファイル: Building.php プロジェクト: Toxicat/dolumar
 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>';
     }
 }
コード例 #2
0
 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');
 }
コード例 #3
0
ファイル: Building.php プロジェクト: Toxicat/dolumar
 public function getUpgradeTechnology($input)
 {
     $s_technology = $input['technology'];
     $technologies = $this->getTechnologyUpgrades();
     $text = Neuron_Core_Text::__getInstance();
     $text->setFile('building');
     $text->setSection('technology');
     $page = new Neuron_Core_Template();
     $page->set('title', $text->get('technology'));
     $village = $this->getVillage();
     if (in_array($s_technology, $technologies) && !$village->hasTechnology($s_technology, true)) {
         $technology = Dolumar_Technology_Technology::getTechnology($s_technology);
         $showForm = true;
         if ($technology->canResearch($this)) {
             if (isset($input['confirm']) && Neuron_Core_Tools::checkConfirmLink($input['confirm'])) {
                 $cost = $technology->getResearchCost();
                 if (isset($cost['runeId']) && $cost['runeId'] == 'random' && isset($input['runeSelection'])) {
                     $cost['runeId'] = $input['runeSelection'];
                 }
                 if ($village->resources->takeResourcesAndRunes($cost)) {
                     if ($village->trainTechnology($technology)) {
                         $showForm = false;
                         $page->set('done', $text->get('done'));
                         reloadStatusCounters();
                     } else {
                         $page->set('error', 'Error: couldn\'t start the research.');
                     }
                 } else {
                     $page->set('error', $text->get('notEnoughResources'));
                 }
             }
             if ($showForm) {
                 $page->set('youSure', Neuron_Core_Tools::putIntoText($text->get('youSure'), array(Neuron_Core_Tools::output_varchar($technology->getName()))));
                 $page->set('description', Neuron_Core_Tools::output_varchar($technology->getDescription()));
                 $page->set('cost', Neuron_Core_Tools::putIntoText($text->get('costTime'), array($this->resourceToText($technology->getResearchCost(), true, true, false, $this->getBuildingId()))));
                 $page->set('duration', Neuron_Core_Tools::putIntoText($text->get('duration'), array(Neuron_Core_Tools::getDuration($technology->getDuration()))));
                 $page->set('confirm', $text->getClickto($text->get('toConfirm')));
                 $page->set('technology', $s_technology);
                 $page->set('confirmation', Neuron_Core_Tools::getConfirmLink());
             }
         } else {
             return '<p>Invalid input: technology not researchable.</p>';
         }
     } else {
         $page->set('notFound', $text->get('notFound'));
     }
     $page->set('return', $text->getClickto($text->get('toReturn')));
     return $page->parse('buildings/general_tech.tpl');
 }