Updated installer
Added Website and Game models Updted config loading Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
fcd1f5b740
commit
5393be4daf
39 changed files with 779 additions and 661 deletions
|
|
@ -4,4 +4,22 @@ class Wootook_Empire_Exception_Exception
|
|||
extends Exception
|
||||
implements Wootook_Empire_Exception
|
||||
{
|
||||
protected $_previous = null;
|
||||
|
||||
public function __construct($message = null, $code = null, $previous = null)
|
||||
{
|
||||
if (PHP_VERSION_ID >= 50300) {
|
||||
parent::__construct($message, $code, $previous);
|
||||
} else {
|
||||
parent::__construct($message, $code);
|
||||
$this->_previous = $previous;
|
||||
}
|
||||
}
|
||||
|
||||
public function __call($method, $params)
|
||||
{
|
||||
if (strtolower($method) == 'getprevious') {
|
||||
return $this->_previous;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,4 +4,22 @@ class Wootook_Empire_Exception_RuntimeException
|
|||
extends RuntimeException
|
||||
implements Wootook_Empire_Exception
|
||||
{
|
||||
protected $_previous = null;
|
||||
|
||||
public function __construct($message = null, $code = null, $previous = null)
|
||||
{
|
||||
if (PHP_VERSION_ID >= 50300) {
|
||||
parent::__construct($message, $code, $previous);
|
||||
} else {
|
||||
parent::__construct($message, $code);
|
||||
$this->_previous = $previous;
|
||||
}
|
||||
}
|
||||
|
||||
public function __call($method, $params)
|
||||
{
|
||||
if (strtolower($method) == 'getprevious') {
|
||||
return $this->_previous;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -960,7 +960,7 @@ class Wootook_Empire_Model_Planet
|
|||
$key = array_rand($positions, 1);
|
||||
$finalPosition = $positions[$key];
|
||||
|
||||
$user->createNewPlanet(
|
||||
$planet = $user->createNewPlanet(
|
||||
$systemInfo->getData('galaxy'),
|
||||
$systemInfo->getData('system'),
|
||||
$finalPosition,
|
||||
|
|
@ -992,10 +992,8 @@ class Wootook_Empire_Model_Planet
|
|||
->group('galaxy.system')
|
||||
;
|
||||
|
||||
$config = Wootook_Core_Model_Config::getSingleton();
|
||||
|
||||
if ($galaxyList === null && $config->hasData('user/registration/galaxy_list')) {
|
||||
$galaxyList = explode(',', $config->getData('user/registration/galaxy_list'));
|
||||
if ($galaxyList === null && Wootook::getGameConfig('user/registration/galaxy_list')) {
|
||||
$galaxyList = explode(',', Wootook::getGameConfig('user/registration/galaxy_list'));
|
||||
}
|
||||
|
||||
if ($galaxyList !== null) {
|
||||
|
|
@ -1003,8 +1001,8 @@ class Wootook_Empire_Model_Planet
|
|||
$collection->where('galaxy.galaxy IN(' . implode(', ', $galaxyList) . ')');
|
||||
}
|
||||
|
||||
if ($systemList === null && $config->hasData('user/registration/system_list')) {
|
||||
$systemList = explode(',', $config->getData('user/registration/system_list'));
|
||||
if ($systemList === null && Wootook::getGameConfig('user/registration/system_list')) {
|
||||
$systemList = explode(',', Wootook::getGameConfig('user/registration/system_list'));
|
||||
}
|
||||
|
||||
if ($systemList !== null) {
|
||||
|
|
|
|||
|
|
@ -252,9 +252,9 @@ class Wootook_Empire_Model_User
|
|||
$size = mt_rand(floor($factor / 10), ceil($factor * 5 / 4)) + mt_rand(0, $fuzz);
|
||||
}
|
||||
|
||||
$planet = new self();
|
||||
$planet = new Wootook_Empire_Model_Planet();
|
||||
$planet
|
||||
->setData('id_owner', $user->getId())
|
||||
->setData('id_owner', $this->getId())
|
||||
->setData('name', $name)
|
||||
->setData('galaxy', $galaxy)
|
||||
->setData('system', $system)
|
||||
|
|
@ -271,12 +271,19 @@ class Wootook_Empire_Model_User
|
|||
$planet->setData($resourceData['production_field'], $resourceConfig[$resource]);
|
||||
}
|
||||
|
||||
$planet->save();
|
||||
|
||||
var_dump($planet->getId());
|
||||
die();
|
||||
|
||||
Wootook::dispatchEvent('planet.init', array(
|
||||
'planet' => $planet,
|
||||
'user' => $user
|
||||
'user' => $this
|
||||
));
|
||||
|
||||
$planet->save();
|
||||
|
||||
return $planet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue