Updated home page

Fixed buildings consruction time

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2012-03-24 15:51:26 +01:00
commit a531d61639
17 changed files with 131 additions and 49 deletions

View file

@ -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;
}

View file

@ -334,4 +334,4 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder
return $this;
}
}
}

View 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');
}
}

View file

@ -0,0 +1,7 @@
<?php
class Wootook_Empire_Exception_Planet
extends Wootook_Empire_Exception_RuntimeException
implements Wootook_Empire_Exception
{
}

View file

@ -251,4 +251,4 @@ abstract class Wootook_Empire_Model_BuilderAbstract
}
return $resourceAmounts;
}
}
}

View file

@ -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;
}

View file

@ -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;
}
}
}

View file

@ -1,3 +0,0 @@
<?php
class Wootook_Empire_Model_Planet_Exception implements Wootook_Empire_Exception {}

View file

@ -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;
}
}

View file

@ -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'
),
)
);
);

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -118,15 +118,14 @@ input[type=submit],input[type=button] {height:2em;border:#58939f 0 solid;border-
*/
body.public-form {width:100%;height:100%;}
body.public-form .main-form {display:block;margin:0 auto;padding:0;width:300px;border-radius:5px;background:rgba(255,255,255,.8);border:5px solid #58939f;background-image:-moz-linear-gradient(top,#AAA 0,#FFF 100%);background-image:linear-gradient(top,#AAA 0,#FFF 100%);}
body.public-form #login-form {height:190px;}
body.public-form #lost-password-form {height:130px;}
body.public-form #register-form {height:350px;}
body.public-form #login-form {height:230px;}
body.public-form #lost-password-form {height:170px;}
body.public-form #register-form {height:390px;}
body.public-form .main-form fieldset {border:none;margin:0;padding:0;}
body.public-form #login-form fieldset legend,
body.public-form #lost-password-form fieldset legend {display:block;width:280px;height:30px;background:#58939f;color:#FFF;font-weight:bold;font-size:2em;padding:0 10px;margin-bottom:10px;}
body.public-form #register-form h1 {display:block;width:280px;height:30px;background:#58939f;color:#FFF;font-weight:bold;font-size:2em;padding:0 10px;margin:0 0 10px;}
body.public-form #register-form fieldset legend {display:block;width:280px;height:15px;font-weight:bold;font-size:1.5em;padding:0 10px;margin:10px 0 5px;}
body.public-form .main-form input[type="submit"],
body.public-form .main-form input[type="button"],
body.public-form .main-form input[type="text"],
body.public-form .main-form input[type="password"] {border-width:1px;}
@ -135,10 +134,10 @@ body.public-form .main-form p.lost-password {margin:0;padding:0;height:30px;widt
body.public-form .main-form p.form label {margin:0;padding:0 10px;text-align:right;width:150px;height:30px;float:left;display:block;}
body.public-form .main-form p.form input {margin:0;padding:0;width:120px;}
body.public-form .main-form p.checkbox input {margin:0;padding:0;width:20px;}
body.public-form .main-form p.submit input {margin:0 100px;padding:0;width:100px;text-align:center;}
body.public-form #lost-password-form p.submit input {width:150px;margin:0 75px;}
body.public-form .main-form p.submit input {margin:0 100px;padding:0;text-align:center;}
body.public-form #lost-password-form p.submit input {margin:0 75px;}
body.public .content .public-topbar {background:#FF;border-bottom:5px solid #000;margin:0;height:30px;padding:0 10px;width:100%;background:rgba(0,0,0,.1);}
body.public .content .public-topbar {background:#FFF;border-bottom:5px solid #000;margin:0;height:30px;padding:0 10px;width:100%;background:rgba(0,0,0,.1);}
body.public .content .public-topbar .container {margin:0 auto;width:780px;}
body.public .content .public-topbar .container span {height:25px;padding:5px 15px 0;display:block;float:left;height:25px;margin:0 5px;font-size:1.5em;font-weight:bold;}
body.public .content .public-topbar .container span:hover {background:rgba(94,175,239,0.3);border-radius:8px;}
@ -146,6 +145,13 @@ body.public .content .public-topbar .container span a:hover {color:#000;}
body.public-form .content .public-topbar {margin-bottom:150px;}
body.public-form .main-form p.form input[type=submit],
button.register {height:45px;background:#F7A90F;border-radius:10px;font-weight:bold;font-family:Arial,sans-serif;font-variant:small-caps;font-style:oblique;border:2px solid #263D43;box-shadow:0 -8px 10px #D5640E inset, 0 2px 7px #58939F;color:#08335B;font-size:2em;text-align:center;}
button.register {margin:25px;margin-left:345px;width:400px;}
body.public-form .main-form p.form input[type=submit] {margin:10px 50px;width:200px;padding:5px 20px;}
.global .content .home-block {width:740px;padding:10px 30px;margin:10px auto 0;background-color:rgba(255,255,255,.1);color:#FFF;border:10px solid rgba(88,147,159,.1);border-radius:10px;border-top-left-radius:30px;border-top-right-radius:30px;}
/**
* Galaxy user name display colors
*/