diff --git a/src/application/code/core/Legacies/Empire/Controller/ShipyardController.php b/src/application/code/core/Legacies/Empire/Controller/ShipyardController.php index dd42c30..1af2ed7 100644 --- a/src/application/code/core/Legacies/Empire/Controller/ShipyardController.php +++ b/src/application/code/core/Legacies/Empire/Controller/ShipyardController.php @@ -31,7 +31,7 @@ class Legacies_Empire_Controller_ShipyardController public function buildAction() { if (!$this->getRequest()->isPost() || !is_array($shipList = $this->getRequest()->getPost('id'))) { - $this->_redirect('*/*/view'); + $this->_redirect('*/*/'); return; } diff --git a/src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php b/src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php index e584a74..41be71d 100644 --- a/src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php +++ b/src/application/code/core/Legacies/Empire/Model/Planet/Building/ResearchLab/Builder.php @@ -334,4 +334,4 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder return $this; } -} \ No newline at end of file +} diff --git a/src/application/code/core/Wootook/Core/Block/Html/Home.php b/src/application/code/core/Wootook/Core/Block/Html/Home.php new file mode 100644 index 0000000..ac43612 --- /dev/null +++ b/src/application/code/core/Wootook/Core/Block/Html/Home.php @@ -0,0 +1,22 @@ +getReadConnection(); - $select = $database->select('planets'); - $select - ->column('id') - ->where('galaxy=:galaxy') - ->where('system=:system') - ->where('planet=:position') - ->where('planet_type=:type') - ->limit(1) - ; - $statement = $database->prepare($select); + $collection = new Wootook_Empire_Resource_Planet_Collection('core_read'); + $collection->addCoordsToFilter($coords['galaxy'], $coords['system'], $coords['position'], $coords['type']) + ->setPage(1, 1); - if (!$statement->execute() || $statement->rowCount() <= 0) { - return new self(); + $planet = $collection->getFirstItem(); + if ($planet !== null) { + return $planet; } - $planetId = $statement->fetchCol(); - - return self::factory($planetId); + return new self; } public function __construct(Array $data = array(), Wootook_Player_Model_Entity $player = null) @@ -624,16 +615,16 @@ class Wootook_Empire_Model_Planet } if ($this->isDestroyed()) { - throw new Wootook_Empire_Model_Planet_Exception(Wootook::__('Planet is already destroyed.')); + throw new Wootook_Empire_Exception_Planet(Wootook::__('Planet is already destroyed.')); } if ($this->getFleetCollection()->count() > 0) { - throw new Wootook_Empire_Model_Planet_Exception(Wootook::__("Could not delete planet until fleets aten't retuned.")); + throw new Wootook_Empire_Exception_Planet(Wootook::__("Could not delete planet until fleets aten't retuned.")); } $player = $this->getPlayer(); if ($player->getHomePlanet()->getId() == $this->getId()) { - throw new Wootook_Empire_Model_Planet_Exception(Wootook::__("You can't destroy your home planet.")); + throw new Wootook_Empire_Exception_Planet(Wootook::__("You can't destroy your home planet.")); } if ($player->getCurrentPlanet()->getId() == $this->getId()) { @@ -763,12 +754,12 @@ class Wootook_Empire_Model_Planet /** * - * @return Wootook_Empire_Model_Planet_Builder + * @return Wootook_Empire_Model_Planet_Builder_Builder */ public function getBuildingQueue() { if ($this->_builder === null && $this->getPlayer()) { - $this->_builder = new Wootook_Empire_Model_Planet_Builder($this, $this->getPlayer()); + $this->_builder = new Wootook_Empire_Model_Planet_Builder_Builder($this, $this->getPlayer()); } return $this->_builder; } diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/Builder.php b/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Builder.php similarity index 97% rename from src/application/code/core/Wootook/Empire/Model/Planet/Builder.php rename to src/application/code/core/Wootook/Empire/Model/Planet/Builder/Builder.php index 9724142..38aaa62 100644 --- a/src/application/code/core/Wootook/Empire/Model/Planet/Builder.php +++ b/src/application/code/core/Wootook/Empire/Model/Planet/Builder/Builder.php @@ -34,7 +34,7 @@ * @author Greg * */ -class Wootook_Empire_Model_Planet_Builder +class Wootook_Empire_Model_Planet_Builder_Builder extends Wootook_Empire_Model_BuilderAbstract { const FIELD_SERIALIZED = 'b_building_id'; @@ -124,6 +124,7 @@ class Wootook_Empire_Model_Planet_Builder $levelTime = Math::sub($partialLevelTime, $firstLevelTime); $speedFactor = Wootook::getGameConfig('game/speed/general'); + if ($speedFactor == null) { $speedFactor = 1; } @@ -172,7 +173,7 @@ class Wootook_Empire_Model_Planet_Builder /** * Update the contruction queue. * - * @return Wootook_Empire_Model_Planet_Builder + * @return Wootook_Empire_Model_Planet_Builder_Builder */ public function updateQueue(Wootook_Core_DateTime $time) { @@ -231,7 +232,7 @@ class Wootook_Empire_Model_Planet_Builder * * @param int|string $buildingId * @param int $level - * @return Wootook_Empire_Model_Planet_Builder + * @return Wootook_Empire_Model_Planet_Builder_Builder */ public function appendQueue($buildingId, $level, Wootook_Core_DateTime $time) { @@ -281,7 +282,7 @@ class Wootook_Empire_Model_Planet_Builder * Dequeues the first item to build to the construction list and removes all * its successors of the same type. * - * @return Wootook_Empire_Model_Planet_Builder + * @return Wootook_Empire_Model_Planet_Builder_Builder */ public function dequeueFirstItem() { @@ -296,7 +297,7 @@ class Wootook_Empire_Model_Planet_Builder * successors of the same type. * * @param string $itemId - * @return Wootook_Empire_Model_Planet_Builder + * @return Wootook_Empire_Model_Planet_Builder_Builder */ public function dequeueItem($itemId) { @@ -329,4 +330,4 @@ class Wootook_Empire_Model_Planet_Builder return $this; } -} \ No newline at end of file +} diff --git a/src/application/code/core/Wootook/Empire/Model/Planet/Exception.php b/src/application/code/core/Wootook/Empire/Model/Planet/Exception.php deleted file mode 100644 index 206a600..0000000 --- a/src/application/code/core/Wootook/Empire/Model/Planet/Exception.php +++ /dev/null @@ -1,3 +0,0 @@ -addFieldToFilter('galaxy', $galaxy); + + return $this; + } + + public function addSystemToFilter($system) + { + $this->addFieldToFilter('system', $system); + + return $this; + } + + public function addPositionToFilter($position) + { + $this->addFieldToFilter('planet', $position); + + return $this; + } + public function addTypeToFilter($type) { $this->addFieldToFilter('planet_type', $type); return $this; } + + public function addCoordsToFilter($galaxy, $system = null, $position = null, $type = null) + { + $this->addGalaxyToFilter($galaxy); + + if ($system !== null) { + $this->addSystemToFilter($system); + + if ($position !== null) { + $this->addPositionToFilter($position); + + if ($type !== null) { + $this->addTypeToFilter($type); + } + } + } + + return $this; + } } diff --git a/src/application/configs/system.php b/src/application/configs/system.php index 9adcd29..f1c17e0 100644 --- a/src/application/configs/system.php +++ b/src/application/configs/system.php @@ -45,6 +45,15 @@ 'timezone' => 'Europe/Paris' ), ), + 'game' => array( + 'speed' => array( + 'general' => 1000 + ), + 'home' => array( + 'title' => 'Welcome on Wootook!', + 'formated-welcome-text' => '
Wootook make you an emperor.
Conquer outer space and master other players on Wootook.
' + ) + ) ), 'frontend' => array( 'layout' => array( @@ -59,4 +68,4 @@ 'admin' => 'admin.php' ), ) - ); \ No newline at end of file + ); diff --git a/src/application/design/frontend/base/default/layouts/page.xml b/src/application/design/frontend/base/default/layouts/page.xml index 02e472d..53a6c80 100644 --- a/src/application/design/frontend/base/default/layouts/page.xml +++ b/src/application/design/frontend/base/default/layouts/page.xml @@ -109,16 +109,19 @@__('Build next level (%s)', $this->renderNumber($this->getNextLevel()))?>
+__('Build next level (%s)', $this->renderNumber($this->getNextLevel()))?>
getDescription()?>
diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue/item.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue/item.phtml index d1ffa3f..ac60627 100644 --- a/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue/item.phtml +++ b/src/application/design/frontend/base/default/scripts/empire/planet/research-lab/queue/item.phtml @@ -6,6 +6,6 @@__('Lasts %s', $this->renderTime($this->getBuildingRemainingTime()))?>
getFormatedWelcomeText()?>
+ +