diff --git a/.gitignore b/.gitignore
index b74decb..3ca62fc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
-/config.php
+config.php
+.buildpath
+.project
+.settings/
+coverage/
diff --git a/buildings.php b/buildings.php
index 6d08a70..ac51962 100644
--- a/buildings.php
+++ b/buildings.php
@@ -36,7 +36,7 @@ includeLang('buildings');
$user = Legacies_Empire_Model_User::getSingleton();
$planet = $user->getCurrentPlanet();
-$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
+$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
switch ($mode) {
case 'fleet':
@@ -64,32 +64,38 @@ case 'fleet':
$planet->save();
}
- $types = Legacies_Empire_Model_Game_Types::getSingleton();
$layout = new Legacies_Core_Layout();
$layout->load('planet.shipyard');
- /** @var Legacies_Core_Block_Concat $parentBlock */
- $parentBlock = $layout->getBlock('item-list.items');
- foreach ($types->getData(Legacies_Empire::TYPE_SHIP) as $shipId) {
- if (!$shipyard->checkAvailability($shipId)) {
- continue;
- }
-
- $blockName = "ship({$shipId})";
- $block = $layout->createBlock('empire/planet.shipyard.item', $blockName);
- $block->setTemplate('empire/planet/shipyard/item.phtml');
- $block->setPlanet($planet);
- $block->setItemId($shipId);
-
- $parentBlock->setPartial($blockName, $block);
- }
-
echo $layout->render();
break;
case 'research':
- // --------------------------------------------------------------------------------------------------
- ResearchBuildingPage($planet, $user, $IsWorking['OnWork'], $IsWorking['WorkOn'] );
+ if ($planet->getElement(Legacies_Empire::ID_BUILDING_RESEARCH_LAB) === null) {
+ $layout = new Legacies_Core_Layout();
+ $layout->load('message');
+
+ $block = $layout->getBlock('message');
+ $block['title'] = Legacies::__('Research lab is required');
+ $block['title'] = Legacies::__('In order to do technological researches, you will need to build a research lab building.');
+
+ $layout->render();
+ break;
+ }
+
+ if (isset($_GET['research']) && !empty($_GET['research'])) {
+ $data = $planet->getAllDatas();
+ $planet->appendBuildingQueue(intval($_GET['research']), isset($_GET['destroy']));
+ $planet->save();
+ } else if (isset($_GET['cancel']) && !empty($_GET['cancel'])) {
+ $planet->dequeueItem($_GET['cancel']);
+ $planet->save();
+ }
+
+ $layout = new Legacies_Core_Layout();
+ $layout->load('planet.research-lab');
+
+ echo $layout->render();
break;
case 'defense':
@@ -117,61 +123,28 @@ case 'defense':
$planet->save();
}
- $types = Legacies_Empire_Model_Game_Types::getSingleton();
$layout = new Legacies_Core_Layout();
- $layout->load('planet.shipyard');
+ $layout->load('planet.defense');
- /** @var Legacies_Core_Block_Concat $parentBlock */
- $parentBlock = $layout->getBlock('item-list.items');
- foreach ($types->getData(Legacies_Empire::TYPE_DEFENSE) as $defenseId) {
- if (!$shipyard->checkAvailability($defenseId)) {
- continue;
- }
-
- $blockName = "defense({$defenseId})";
- $block = $layout->createBlock('empire/planet.shipyard.item', $blockName);
- $block->setTemplate('empire/planet/shipyard/item.phtml');
- $block->setPlanet($planet);
- $block->setItemId($defenseId);
-
- $parentBlock->setPartial($blockName, $block);
- }
+ /** @var Legacies_Empire_Block_Planet_Shipyard $block */
+ $block = $layout->getBlock('item-list');
+ $block->setType(Legacies_Empire::TYPE_DEFENSE);
echo $layout->render();
break;
default:
if (isset($_GET['building']) && !empty($_GET['building'])) {
- $buildingId = intval($_GET['building']);
-
- $planet->appendBuildingQueue($shipId, isset($_GET['destroy']));
+ $data = $planet->getAllDatas();
+ $planet->appendBuildingQueue(intval($_GET['building']), isset($_GET['destroy']));
+ $planet->save();
+ } else if (isset($_GET['cancel']) && !empty($_GET['cancel'])) {
+ $planet->dequeueItem($_GET['cancel']);
$planet->save();
}
- $types = Legacies_Empire_Model_Game_Types::getSingleton();
$layout = new Legacies_Core_Layout();
$layout->load('planet.buildings');
-
- /** @var Legacies_Core_Block_Concat $parentBlock */
- $parentBlock = $layout->getBlock('item-list.items');
- $type = Legacies_Empire::TYPE_BUILDING_PLANET;
- if ($planet->isMoon()) {
- $type = Legacies_Empire::TYPE_BUILDING_MOON;
- }
- foreach ($types->getData($type) as $buildingId) {
- if (!$planet->checkAvailability($buildingId)) {
- continue;
- }
-
- $blockName = "building({$buildingId})";
- $block = $layout->createBlock('empire/planet.buildings.item', $blockName);
- $block->setTemplate('empire/planet/buildings/item.phtml');
- $block->setPlanet($planet);
- $block->setItemId($buildingId);
-
- $parentBlock->setPartial($blockName, $block);
- }
-
echo $layout->render();
break;
}
diff --git a/common.php b/common.php
index 7e91b9a..d7aadaa 100644
--- a/common.php
+++ b/common.php
@@ -28,8 +28,9 @@
*
*/
-define('DEPRECATION', true);
-define('DEBUG', true);
+defined('BCNUMBERS') || define('BCNUMBERS', true);
+defined('DEPRECATION') || define('DEPRECATION', true);
+defined('DEBUG') || define('DEBUG', true);
if (!defined('DEBUG') && ($env = getenv('DEBUG')) !== false && in_array(strtolower($env), array('1', 'on', 'true'))) {
define('DEBUG', true);
@@ -135,8 +136,8 @@ if (($user !== null && $user->getId())) {
$planet = $user->getCurrentPlanet();
- foreach ($user->getPlanetCollection() as $planet) {
- FlyingFleetHandler($planet); // TODO: implement logic into a refactored model
+ foreach ($user->getPlanetCollection() as $userPlanet) {
+ FlyingFleetHandler($userPlanet); // TODO: implement logic into a refactored model
}
/*
diff --git a/frames.php b/frames.php
index 367459c..c6b5b8c 100644
--- a/frames.php
+++ b/frames.php
@@ -1,3 +1,40 @@
+
+ * All rights reserved.
+ *
+ * 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, see .
+ *
+ * --> NOTICE <--
+ * This file is part of the core development branch, changing its contents will
+ * make you unable to use the automatic updates manager. Please refer to the
+ * documentation for further information about customizing XNova.
+ *
+ */
+
+defined('DEPRECATION') || define('DEPRECATION', false);
+defined('DEBUG') || define('DEBUG', false);
+
+require_once dirname(__FILE__) .'/common.php';
+
+Legacies_Core_ErrorProfiler::unregister(true);
+?>
@@ -5,7 +42,7 @@
XNova:Legacies