public function getContent() { $data = $this->getRequestData(); $id = isset($data['id']) ? $data['id'] : 0; $mission = Dolumar_Underworld_Mappers_MissionMapper::getFromId($id); if ($mission) { return '<iframe src="' . $mission->getUrl() . '" style="width: 100%; height: 100%; border: 0px none black;" border="0"></iframe>'; } else { return '<p>Mission not found.</p>'; } }
* http://www.catlab.eu/ * http://www.dolumar.com/ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ require_once 'bootstrap/bootstrap.php'; if (isset($_GET['debug'])) { $_SESSION['debug'] = $_GET['debug']; } if (isset($_SESSION['debug'])) { define('DEBUG', $_SESSION['debug']); } $mission_id = Neuron_Core_Tools::getInput('_GET', 'id', 'int'); $mission = Dolumar_Underworld_Mappers_MissionMapper::getFromId($mission_id); $game = new Dolumar_Underworld_Game($mission); $server = Neuron_GameServer::getInstance(); $server->setGame($game); $server->setDispatchURL(ABSOLUTE_URL . 'underworld.php?id=' . $mission_id . '&module='); $server->dispatch();
private function getMissionOverview($input) { if (isset($input['id'])) { $mission = Dolumar_Underworld_Mappers_MissionMapper::getFromId($input['id']); } if (!isset($mission)) { return '<p class="false">Mission not found.</p>'; } $text = Neuron_Core_Text::getInstance(); $page = new Neuron_Core_Template(); $page->set('id', $mission->getId()); $page->set('mission', $mission->getName()); $page->set('openmission', Neuron_URLBuilder::getInstance()->getOpenUrl('Underworld', $text->get('openmission', 'clanportal', 'buildings'), array('id' => $mission->getId()), null, $mission->getUrl())); $page->set('return', Neuron_URLBuilder::getInstance()->getUpdateUrl('Building', $text->get('return', 'clanportal', 'buildings'), array('action' => 'overview'))); // Get free regiments $units = array(); $addunits = array(); $unitsdata = $this->getVillage()->getSquads(false, true, true); foreach ($unitsdata as $v) { if (!$v->isIdle()) { continue; } $add = true; // Check for adding if (isset($input['unit_' . $v->getId()]) && $input['unit_' . $v->getId()]) { $addunits[] = $v; $add = false; } if ($add) { $units[] = array('id' => $v->getId(), 'name' => $v->getDisplayName()); } } // The spawnpionts $side = $mission->getPlayerSide(Neuron_GameServer::getPlayer()); $spawnpoints = $mission->getSpawnpoints($side); // Group the spawnpoints $groupedspawnpoints = array(); foreach ($spawnpoints as $v) { if (!isset($groupedspawnpoints[$v->getGroup()->getId()])) { $groupedspawnpoints[$v->getGroup()->getId()] = $v->getGroup(); } } $page->set('spawnpoints', $groupedspawnpoints); // Add the units if (count($addunits) > 0) { $spanwpointId = null; if (isset($input['spawnpoint'])) { $spanwpointId = $input['spawnpoint']; } $army = $mission->addSquads(Neuron_GameServer::getPlayer(), $side, $addunits, $spanwpointId); } $page->set('units', $units); return $page->parse('buildings/clanportals_mission.phpt'); }
public function onWin(Dolumar_Underworld_Models_Side $side) { // Add log $lock = Neuron_Core_Lock::getInstance(); $lockname = 'uw_fin'; if ($lock->setLock($lockname, $this->getMission()->getId())) { // Reload mission, just to be sure $mission = Dolumar_Underworld_Mappers_MissionMapper::getFromId($this->getMission()->getId()); if ($mission) { // Logger $this->getMission()->getLogger()->win($side); // Do whatever we need to do $this->winnerBenefits($side); // Start removing mission $mission->destroy(); // Release the lock $lock->releaseLock($lockname, $this->getMission()->getId()); } } }