Updated home page
Fixed buildings consruction time Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
347952319a
commit
a531d61639
17 changed files with 131 additions and 49 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -334,4 +334,4 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder
|
|||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
22
src/application/code/core/Wootook/Core/Block/Html/Home.php
Normal file
22
src/application/code/core/Wootook/Core/Block/Html/Home.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by JetBrains PhpStorm.
|
||||
* User: Greg
|
||||
* Date: 24/03/12
|
||||
* Time: 10:51
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
|
||||
class Wootook_Core_Block_Html_Home
|
||||
extends Wootook_Core_Block_Template
|
||||
{
|
||||
public function getTitle()
|
||||
{
|
||||
return Wootook::getGameConfig('game/home/title');
|
||||
}
|
||||
|
||||
public function getFormatedWelcomeText()
|
||||
{
|
||||
return Wootook::getGameConfig('game/home/formated-welcome-text');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Empire_Exception_Planet
|
||||
extends Wootook_Empire_Exception_RuntimeException
|
||||
implements Wootook_Empire_Exception
|
||||
{
|
||||
}
|
||||
|
|
@ -251,4 +251,4 @@ abstract class Wootook_Empire_Model_BuilderAbstract
|
|||
}
|
||||
return $resourceAmounts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Wootook_Empire_Model_Planet
|
|||
protected $_planet = null;
|
||||
|
||||
/**
|
||||
* @var Wootook_Empire_Model_Planet_Builder
|
||||
* @var Wootook_Empire_Model_Planet_Builder_Builder
|
||||
*/
|
||||
protected $_builder = null;
|
||||
|
||||
|
|
@ -101,25 +101,16 @@ class Wootook_Empire_Model_Planet
|
|||
$coords['type'] = $type;
|
||||
}
|
||||
|
||||
$database = $this->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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Wootook_Empire_Model_Planet_Exception implements Wootook_Empire_Exception {}
|
||||
|
|
@ -15,10 +15,50 @@ class Wootook_Empire_Resource_Planet_Collection
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function addGalaxyToFilter($galaxy)
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,15 @@
|
|||
'timezone' => 'Europe/Paris'
|
||||
),
|
||||
),
|
||||
'game' => array(
|
||||
'speed' => array(
|
||||
'general' => 1000
|
||||
),
|
||||
'home' => array(
|
||||
'title' => 'Welcome on Wootook!',
|
||||
'formated-welcome-text' => '<p><strong>Wootook</strong> make you an emperor.</p><p>Conquer outer space and master other players on <strong>Wootook</strong>.</p>'
|
||||
)
|
||||
)
|
||||
),
|
||||
'frontend' => array(
|
||||
'layout' => array(
|
||||
|
|
@ -59,4 +68,4 @@
|
|||
'admin' => 'admin.php'
|
||||
),
|
||||
)
|
||||
);
|
||||
);
|
||||
|
|
|
|||
|
|
@ -109,16 +109,19 @@
|
|||
<action method="addBodyClass">
|
||||
<param name="class">home</param>
|
||||
</action>
|
||||
<action method="addBodyClass">
|
||||
<param name="class">public-form</param>
|
||||
</action>
|
||||
</reference>
|
||||
|
||||
<reference name="head">
|
||||
<action method="setTitle">
|
||||
<param name="title">Home page</param>
|
||||
<param name="title">Welcome</param>
|
||||
</action>
|
||||
</reference>
|
||||
|
||||
<reference name="content">
|
||||
<block name="login" type="core/template" template="page/html/home.phtml" />
|
||||
<block name="login" type="core/html.home" template="page/html/home.phtml" />
|
||||
</reference>
|
||||
</handle>
|
||||
</layout>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div class="item details">
|
||||
<a href="<?php echo $this->getItemInfoUrl()?>" class="image"><img src="<?php echo $this->getItemImageUrl()?>" alt="" width="120" height="120" /></a>
|
||||
<div class="buy">
|
||||
<p><a class="build" href="<?php echo $this->getUrl('empire/research-lab/build', array('id' => $this->getItemId()))?>"><?php echo $this->__('Build next level (%s)', $this->renderNumber($this->getNextLevel()))?></a></p>
|
||||
<p><a class="build" href="<?php echo $this->getUrl('legacies-empire/research-lab/build', array('id' => $this->getItemId()))?>"><?php echo $this->__('Build next level (%s)', $this->renderNumber($this->getNextLevel()))?></a></p>
|
||||
</div>
|
||||
<div class="details">
|
||||
<p><?php echo $this->getDescription()?></p>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
</p>
|
||||
<p class="time"><?php echo $this->__('Lasts %s', $this->renderTime($this->getBuildingRemainingTime()))?></p>
|
||||
<div class="cancel">
|
||||
<p><a class="build" href="<?php echo $this->getUrl('empire/research-lab/cancel', array('id' => $this->getItem()->getIndex()))?>"><?php echo $this->__('Cancel')?></a></p>
|
||||
<p><a class="build" href="<?php echo $this->getUrl('legacies-empire/research-lab/cancel', array('id' => $this->getItem()->getIndex()))?>"><?php echo $this->__('Cancel')?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<div class="shipyard item-list countable" id="shipyard">
|
||||
<h1><?php echo $this->__('Shipyard')?></h1>
|
||||
<form action="<?php echo $this->getUrl('empire/shipyard/build')?>" method="post" id="shipyard-form">
|
||||
<form action="<?php echo $this->getUrl('legacies-empire/shipyard/build')?>" method="post" id="shipyard-form">
|
||||
<?php echo $this->getPartial('item-list.items')->render()?>
|
||||
<input type="submit" value="<?php echo $this->__('Build')?>">
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<div class="item details">
|
||||
<a href="<?php echo $this->getItemInfoUrl()?>" class="image"><img src="<?php echo $this->getItemImageUrl()?>" alt="" width="120" height="120" /></a>
|
||||
<div class="qty">
|
||||
<p><input type="text" name="ship[<?php echo $this->getItemId()?>]" id="ship:<?php echo $this->getItemId()?>" /></p>
|
||||
<p><input type="text" name="id[<?php echo $this->getItemId()?>]" id="ship:<?php echo $this->getItemId()?>" /></p>
|
||||
<input type="hidden" id="ship:<?php echo $this->getItemId()?>:max" value="<?php echo $this->escape($this->getMaximumBuildableElementsCount())?>" />
|
||||
</div>
|
||||
<div class="max">
|
||||
|
|
@ -31,4 +31,4 @@
|
|||
<p><?php echo $this->__('Building time: %s', $this->renderTime($this->getBuildingTime(1), false))?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1 +1,7 @@
|
|||
<?php /** @var Wootook_Core_Block_Html_Home $this */ ?>
|
||||
<?php echo $this->getLayout()->getMessagesBlock()->renderGroupedHtml()?>
|
||||
<div class="home-block">
|
||||
<h1><?php echo $this->getTitle()?></h1>
|
||||
<p><?php echo $this->getFormatedWelcomeText()?></p>
|
||||
<button class="register" onclick="document.location='<?php echo $this->getUrl('player/account/new')?>'"><?php echo $this->escape('Create an empire of your own, now!')?></button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue