Updated themes
Updated buildings Updated shipyard page (ships & defense) Added Buildings building queue display & cancel build action. Added research lab Added navigation block structure Removed old code Updated registration Added files to .gitignore Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
ddfb36efa5
commit
8f0f7a4d46
147 changed files with 3488 additions and 2468 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -1 +1,5 @@
|
|||
/config.php
|
||||
config.php
|
||||
.buildpath
|
||||
.project
|
||||
.settings/
|
||||
coverage/
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
39
frames.php
39
frames.php
|
|
@ -1,3 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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);
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
|
|
@ -5,7 +42,7 @@
|
|||
<title>XNova:Legacies</title>
|
||||
</head>
|
||||
<frameset framespacing="0" border="0" cols="190,*" frameborder="0">
|
||||
<frame name="LeftMenu" target="Mainframe" src="leftmenu.php" noresize scrolling="no" marginwidth="0" marginheight="0">
|
||||
<frame name="LeftMenu" src="leftmenu.php" marginwidth="0" marginheight="0">
|
||||
<frame name="Hauptframe" src="overview.php">
|
||||
<noframes>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,89 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Bootstrap class, used to access main and global functionalities
|
||||
*
|
||||
* @package Legacies
|
||||
* @category core
|
||||
*/
|
||||
class Legacies
|
||||
{
|
||||
/**
|
||||
* Static list of application event listeners
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_listeners = array();
|
||||
|
||||
/**
|
||||
* Static list of all locale translators
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_translators = array();
|
||||
|
||||
public static $request = null;
|
||||
public static $response = null;
|
||||
/**
|
||||
* HTTP request management object
|
||||
*
|
||||
* @var Legacies_Core_Controller_Request_Http
|
||||
*/
|
||||
protected static $_request = null;
|
||||
|
||||
/**
|
||||
* HTTP response management object
|
||||
*
|
||||
* @var Legacies_Core_Controller_Response
|
||||
*/
|
||||
protected static $_response = null;
|
||||
|
||||
/**
|
||||
* The current timestamp
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected static $_now = null;
|
||||
|
||||
/**
|
||||
* Default locale identifier
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $_defaultLocale = 'fr_FR';
|
||||
|
||||
/**
|
||||
* Registers an event listener to be called later in the application.
|
||||
*
|
||||
* @param string $event The event identifier
|
||||
* @param callback $listener The event callback to be called
|
||||
*/
|
||||
public static function registerListener($event, $listener)
|
||||
{
|
||||
if (!isset(self::$_listeners[$event])) {
|
||||
|
|
@ -19,11 +92,19 @@ class Legacies
|
|||
self::$_listeners[$event][] = $listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all event listeners
|
||||
*/
|
||||
public static function clearAllListeners()
|
||||
{
|
||||
self::$_listeners = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear a specific event's listeners
|
||||
*
|
||||
* @param unknown_type $event
|
||||
*/
|
||||
public static function clearEventListeners($event)
|
||||
{
|
||||
if (isset(self::$_listeners[$event])) {
|
||||
|
|
@ -31,25 +112,44 @@ class Legacies
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches an event, calls all callbacks that were previously registered
|
||||
*
|
||||
* @param string $event The event identifier
|
||||
* @param array $params The event params
|
||||
*/
|
||||
public static function dispatchEvent($event, $params)
|
||||
{
|
||||
$eventObject = new Legacies_Core_Event($params);
|
||||
|
||||
if (!isset(self::$_listeners[$event])) {
|
||||
return;
|
||||
return $eventObject;
|
||||
}
|
||||
|
||||
$eventObject = new Legacies_Core_Event($params);
|
||||
foreach (self::$_listeners[$event] as $listener) {
|
||||
call_user_func($listener, $eventObject);
|
||||
}
|
||||
|
||||
return $eventObject;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param unknown_type $namespace
|
||||
* @return Legacies_Core_Model_Session
|
||||
*/
|
||||
public static function getSession($namespace)
|
||||
{
|
||||
return Legacies_Core_Model_Session::factory($namespace);
|
||||
}
|
||||
|
||||
public static function getTranslator($locale = 'fr_FR')
|
||||
public static function getTranslator($locale = null)
|
||||
{
|
||||
if ($locale === null) {
|
||||
$locale = self::getDefaultLocale();
|
||||
}
|
||||
|
||||
if (!isset($translator[$locale])) {
|
||||
$path = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'locale';
|
||||
$translator[$locale] = new Legacies_Core_Model_Translator($path, $locale);
|
||||
|
|
@ -67,12 +167,20 @@ class Legacies
|
|||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return self::getTranslator(self::getLocale())->translate($message, $args);
|
||||
return self::getTranslator(self::getDefaultLocale())->translateArgs($message, $args);
|
||||
}
|
||||
|
||||
public static function getLocale()
|
||||
public static function setDefaultLocale($locale)
|
||||
{
|
||||
return 'fr_FR';
|
||||
$oldLocale = self::$_defaultLocale;
|
||||
self::$_defaultLocale = $locale;
|
||||
|
||||
return $oldLocale;
|
||||
}
|
||||
|
||||
public static function getDefaultLocale()
|
||||
{
|
||||
return self::$_defaultLocale;
|
||||
}
|
||||
|
||||
public static function now()
|
||||
|
|
@ -82,4 +190,30 @@ class Legacies
|
|||
}
|
||||
return self::$_now;
|
||||
}
|
||||
|
||||
public static function getRequest()
|
||||
{
|
||||
if (self::$_request === null) {
|
||||
self::$_request = new Legacies_Core_Controller_Request_Http();
|
||||
}
|
||||
return self::$_request;
|
||||
}
|
||||
|
||||
public static function setRequest($request)
|
||||
{
|
||||
self::$_request = $request;
|
||||
}
|
||||
|
||||
public static function getResponse()
|
||||
{
|
||||
if (self::$_response === null) {
|
||||
self::$_response = new Legacies_Core_Controller_Response();
|
||||
}
|
||||
return self::$_response;
|
||||
}
|
||||
|
||||
public static function setResponse($response)
|
||||
{
|
||||
self::$_response = $response;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,4 +3,64 @@
|
|||
class Legacies_Core_Block_Html_Navigation
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
public function addLink($name, $label, $title, $uri, Array $params = array(), Array $classes = array(), $template = null)
|
||||
{
|
||||
$explodedPath = explode('/', $name);
|
||||
$baseName = array_pop($explodedPath);
|
||||
$parent = $this->_getNode($explodedPath);
|
||||
|
||||
$child = $this->getLayout()
|
||||
->createBlock('core/html.navigation.link', $this->getNameInLayout() . '.' . $baseName, array(
|
||||
'url' => array(
|
||||
'uri' => $uri,
|
||||
'params' => $params
|
||||
),
|
||||
'label' => $label,
|
||||
'title' => $title,
|
||||
'classes' => $classes
|
||||
));
|
||||
$parent->setPartial($baseName, $child);
|
||||
|
||||
if ($template !== null) {
|
||||
$child->setTemplate($template);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setNodeTitle($path, $title)
|
||||
{
|
||||
return $this->getNode($path)->setTitle($title);
|
||||
}
|
||||
|
||||
public function setNodeTemplate($path, $template)
|
||||
{
|
||||
return $this->getNode($path)->setTemplate($template);
|
||||
}
|
||||
|
||||
public function getNode($path)
|
||||
{
|
||||
return $this->_getNode(explode('/', $path));
|
||||
}
|
||||
|
||||
protected function _getNode($explodedPath)
|
||||
{
|
||||
$name = array_shift($explodedPath);
|
||||
|
||||
if ($this->hasPartial($name)) {
|
||||
$child = $this->getPartial($name)->_getNode($explodedPath);
|
||||
} else {
|
||||
$child = $this->getLayout()
|
||||
->createBlock('core/html.navigation.node', $this->getNameInLayout() . '.' . $name);
|
||||
}
|
||||
|
||||
if ($child instanceof Legacies_Core_Block_Html_Navigation_Link) {
|
||||
throw new RuntimeException('Node is a link. Could not append a child node to a link node.');
|
||||
}
|
||||
|
||||
if (count($explodedPath) == 0) {
|
||||
return $child;
|
||||
}
|
||||
return $child->_getNode($explodedPath);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Block_Html_Navigation_Link
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
protected $_label = '';
|
||||
protected $_title = '';
|
||||
protected $_uri = '';
|
||||
protected $_params = array();
|
||||
protected $_classes = array('link');
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
if ($this->_template !== null) {
|
||||
return $this->_template;
|
||||
}
|
||||
return 'page/html/navigation/link.phtml';
|
||||
}
|
||||
|
||||
public function setLabel($label)
|
||||
{
|
||||
$this->_label = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->_label;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
public function setUrl($uri, $params = array())
|
||||
{
|
||||
$this->_uri = $uri;
|
||||
$this->_params = $params;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLinkUrl($moreParams = array())
|
||||
{
|
||||
$params = array_merge($this->_params, $moreParams);
|
||||
return $this->getUrl($this->_uri, $params);
|
||||
}
|
||||
|
||||
public function addClass($class)
|
||||
{
|
||||
$this->_classes[] = $class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearClasses()
|
||||
{
|
||||
$this->_classes = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function renderClasses($moreClasses)
|
||||
{
|
||||
$classes = array_merge($this->_classes, $moreClasses);
|
||||
return implode(' ', $classes);
|
||||
}
|
||||
|
||||
public function __construct(Array $data = array())
|
||||
{
|
||||
if (isset($data['label'])) {
|
||||
$this->setLabel($data['label']);
|
||||
unset($data['label']);
|
||||
}
|
||||
|
||||
if (isset($data['title'])) {
|
||||
$this->setTitle($data['title']);
|
||||
unset($data['title']);
|
||||
}
|
||||
|
||||
if (isset($data['url'])) {
|
||||
if (is_array($data['url']) && isset($data['url']['uri'])) {
|
||||
if (isset($data['url']['params'])) {
|
||||
$this->setUrl($data['url']['uri'], $data['url']['params']);
|
||||
} else {
|
||||
$this->setUrl($data['url']['uri']);
|
||||
}
|
||||
} else {
|
||||
$this->setUrl($data['url']);
|
||||
}
|
||||
unset($data['url']);
|
||||
}
|
||||
|
||||
if (isset($data['classes'])) {
|
||||
$classes = (array) $data['classes'];
|
||||
unset($data['classes']);
|
||||
|
||||
foreach ($classes as $class) {
|
||||
$this->set($class);
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct($data);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Block_Html_Navigation_Node
|
||||
extends Legacies_Core_Block_Html_Navigation
|
||||
{
|
||||
protected $_title = '';
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->_title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
if ($this->_template !== null) {
|
||||
return $this->_template;
|
||||
}
|
||||
return 'page/html/navigation/node.phtml';
|
||||
}
|
||||
}
|
||||
|
|
@ -3,5 +3,4 @@
|
|||
class Legacies_Core_Block_Template
|
||||
extends Legacies_Core_View
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -21,16 +21,16 @@ class Legacies_Core_Controller_Request_Http
|
|||
if (isset($_POST[$key])) {
|
||||
return $_POST[$key];
|
||||
}
|
||||
if (!isset($_GET[$key])) {
|
||||
if (isset($_GET[$key])) {
|
||||
return $_GET[$key];
|
||||
}
|
||||
if (!isset($_FILES[$key])) {
|
||||
if (isset($_FILES[$key])) {
|
||||
return $_FILES[$key];
|
||||
}
|
||||
if (!isset($_COOKIE[$key])) {
|
||||
if (isset($_COOKIE[$key])) {
|
||||
return $_COOKIE[$key];
|
||||
}
|
||||
if (!isset($_SERVER[$key])) {
|
||||
if (isset($_SERVER[$key])) {
|
||||
return $_SERVER[$key];
|
||||
}
|
||||
return $default;
|
||||
|
|
@ -75,4 +75,12 @@ class Legacies_Core_Controller_Request_Http
|
|||
}
|
||||
return $_POST[$key];
|
||||
}
|
||||
|
||||
public function getServer($key, $default = null)
|
||||
{
|
||||
if (!isset($_SERVER[$key])) {
|
||||
return $default;
|
||||
}
|
||||
return $_SERVER[$key];
|
||||
}
|
||||
}
|
||||
32
includes/application/code/core/Legacies/Core/Email.php
Normal file
32
includes/application/code/core/Legacies/Core/Email.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Email
|
||||
{
|
||||
protected static $_defaultHeadrs = array(
|
||||
);
|
||||
|
||||
protected $_headers = array();
|
||||
|
||||
public function send($to, $from, $subject, $body, Array $headers = array())
|
||||
{
|
||||
$this->_prepareHeaders($headers);
|
||||
}
|
||||
|
||||
public function setHeader($name, $value)
|
||||
{
|
||||
$this->_headers[$name] = $value;
|
||||
}
|
||||
|
||||
protected function _prepareHeaders($headers)
|
||||
{
|
||||
foreach ($headers as $name => $value) {
|
||||
$this->setHeader($name, $value);
|
||||
}
|
||||
|
||||
$this->addHeader('X-Mailer', 'PHP/' . PHP_VERSION . ' Legacies/' . VERSION);
|
||||
$this->addHeader('Content-Transfer-Encoding', '7bit');
|
||||
$this->addHeader('Content-Type', 'text/plain; charset=utf-8');
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ class Legacies_Core_Layout
|
|||
foreach (include $path . $layoutFile as $layoutId => $layoutConfig) {
|
||||
if ($this->hasData($layoutId)) {
|
||||
$declared = $this->getData($layoutId);
|
||||
|
||||
$layoutConfig = array_merge($declared, $layoutConfig);
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +39,6 @@ class Legacies_Core_Layout
|
|||
}
|
||||
|
||||
$layoutConfigs = array($this->getData($layoutId));
|
||||
$layoutUpdates = array();
|
||||
if (isset($layoutConfigs[0]['update'])) {
|
||||
$parent = $layoutConfigs[0]['update'];
|
||||
|
||||
|
|
@ -53,6 +53,7 @@ class Legacies_Core_Layout
|
|||
}
|
||||
}
|
||||
|
||||
$layoutUpdates = array();
|
||||
$layoutConfig = array();
|
||||
foreach (array_reverse($layoutConfigs) as $config) {
|
||||
$layoutConfig = array_merge($layoutConfig, $config);
|
||||
|
|
@ -72,12 +73,13 @@ class Legacies_Core_Layout
|
|||
$type = $layoutConfig['type'];
|
||||
$name = isset($layoutConfig['name']) ? $layoutConfig['name'] : 'root';
|
||||
|
||||
$this->_view = $this->createBlock($type, $name, $layoutConfig);
|
||||
$this->_view = $this->_createBlock($type, $name, $layoutConfig);
|
||||
|
||||
foreach ($layoutUpdates as $block => $updates) {
|
||||
if (!isset($this->_blocks[$block])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$parent = $this->_blocks[$block];
|
||||
foreach ($updates as $update) {
|
||||
if (isset($update['children'])) {
|
||||
|
|
@ -85,11 +87,27 @@ class Legacies_Core_Layout
|
|||
$type = $childConfig['type'];
|
||||
$alias = isset($childConfig['alias']) ? $childConfig['alias'] : $childName;
|
||||
|
||||
$parent->$alias = $this->createBlock($type, $childName, $childConfig);
|
||||
$parent->$alias = $this->_createBlock($type, $childName, $childConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($layoutUpdates as $block => $updates) {
|
||||
if (!isset($this->_blocks[$block])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($updates as $update) {
|
||||
if (isset($update['actions'])) {
|
||||
$this->_callActions($this->_blocks[$block], $update['actions']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->_blocks as $block) {
|
||||
$block->prepareLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public function _save()
|
||||
|
|
@ -119,6 +137,15 @@ class Legacies_Core_Layout
|
|||
}
|
||||
|
||||
public function createBlock($type, $name, $config = array())
|
||||
{
|
||||
$instance = $this->_createBlock($type, $name, $config);
|
||||
|
||||
$instance->prepareLayout();
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
protected function _createBlock($type, $name, $config = array())
|
||||
{
|
||||
$className = $this->_resolveBlockClassType($type);
|
||||
|
||||
|
|
@ -138,6 +165,9 @@ class Legacies_Core_Layout
|
|||
|
||||
$instance = $reflectionClass->newInstance($config);
|
||||
$this->_blocks[$name] = $instance;
|
||||
$instance->setNameInLayout($name);
|
||||
|
||||
$instance->setLayout($this);
|
||||
|
||||
foreach ($children as $name => $config) {
|
||||
if (isset($config['alias'])) {
|
||||
|
|
@ -149,14 +179,22 @@ class Legacies_Core_Layout
|
|||
if (!isset($config['type'])) {
|
||||
$instance->$alias = new Legacies_Core_View($config);
|
||||
} else {
|
||||
$instance->$alias = $this->createBlock($config['type'], $name, $config);
|
||||
$instance->$alias = $this->_createBlock($config['type'], $name, $config);
|
||||
}
|
||||
}
|
||||
} catch (ReflectionException $e) {
|
||||
var_dump($e);
|
||||
return null;
|
||||
}
|
||||
|
||||
$instance->setLayout($this);
|
||||
$this->_callActions($instance, $actions);
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
protected function _callActions($block, $actions)
|
||||
{
|
||||
$reflectionClass = new ReflectionClass($block);
|
||||
|
||||
foreach ($actions as $action) {
|
||||
if (!isset($action['method'])) {
|
||||
|
|
@ -171,6 +209,7 @@ class Legacies_Core_Layout
|
|||
|
||||
try {
|
||||
$reflectionMethod = $reflectionClass->getMethod($method);
|
||||
$requiredParameterCount = $reflectionMethod->getNumberOfRequiredParameters();
|
||||
$callParamaters = array();
|
||||
foreach ($reflectionMethod->getParameters() as $parameter) {
|
||||
$paramterName = $parameter->getName();
|
||||
|
|
@ -180,24 +219,19 @@ class Legacies_Core_Layout
|
|||
$callParamaters[$paramterPosition] = $params[$paramterName];
|
||||
} else if ($parameter->isDefaultValueAvailable()) {
|
||||
$callParamaters[$paramterPosition] = $parameter->getDefaultValue();
|
||||
} else if ($parameter->isOptionnal()) {
|
||||
continue;
|
||||
} else {
|
||||
throw RuntimeException();
|
||||
//} else if (!$parameter->isOptionnal()) {
|
||||
} else if ($paramterPosition <= $requiredParameterCount) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
$reflectionMethod->invokeArgs($instance, $callParamaters);
|
||||
$reflectionMethod->invokeArgs($block, $callParamaters);
|
||||
} catch (ReflectionException $e) {
|
||||
continue;
|
||||
} catch (RuntimeException $e) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$instance->prepareLayout();
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
public function getBlock($code)
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@ class Legacies_Core_Model_Session
|
|||
$reflection = new ReflectionClass(__CLASS__);
|
||||
self::$_levels = array_flip($reflection->getConstants());
|
||||
}
|
||||
if (session_id() == '') {
|
||||
session_start();
|
||||
}
|
||||
|
||||
self::$_instances[$namespace] = new self($namespace);
|
||||
}
|
||||
|
|
@ -45,6 +42,14 @@ class Legacies_Core_Model_Session
|
|||
|
||||
public function __construct($namespace)
|
||||
{
|
||||
if (session_id() == '') {
|
||||
session_start();
|
||||
}
|
||||
|
||||
if (!isset($_SESSION[$namespace])) {
|
||||
$_SESSION[$namespace] = array();
|
||||
}
|
||||
|
||||
$this->_data = &$_SESSION[$namespace];
|
||||
$this->_data['messages'] = array();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ class Legacies_Core_View
|
|||
protected $_template = null;
|
||||
protected $_partials = array();
|
||||
protected $_layout = null;
|
||||
protected $_nameInLayout = null;
|
||||
|
||||
public function __construct(Array $data = array())
|
||||
{
|
||||
|
|
@ -27,6 +28,32 @@ class Legacies_Core_View
|
|||
return Math::render($number);
|
||||
}
|
||||
|
||||
public function renderTime($time, $unique = false)
|
||||
{
|
||||
if ($time >= 10) {
|
||||
$seconds = $time % 60;
|
||||
$minutes = (int) (($time - $seconds) / 60) % 60;
|
||||
$hours = (int) ((($time - $seconds) / 60) - $minutes) / 60;
|
||||
|
||||
if ($hours > 24) {
|
||||
$dayHours = (int) $hours % 24;
|
||||
$days = (int) ($hours - $dayHours) / 24;
|
||||
|
||||
return $this->__('%1$d day(s) and %2$d hour(s)', $days, $dayHours);
|
||||
} else if ($hours > 0) {
|
||||
return $this->__('%1$d hour(s), %2$d minute(s) and %3$d second(s)', $hours, $minutes, $seconds);
|
||||
} else if ($minutes > 0) {
|
||||
return $this->__('%1$d minute(s) and %2$d second(s)', $minutes, $seconds);
|
||||
} else {
|
||||
return $this->__('%1$d second(s)', $seconds);
|
||||
}
|
||||
} else if (!$unique && $time > 0) {
|
||||
return $this->__('%1$d per minute', 60 / $time);
|
||||
} else {
|
||||
return $this->__('instantaneous');
|
||||
}
|
||||
}
|
||||
|
||||
protected function escape($unescaped)
|
||||
{
|
||||
return htmlspecialchars($unescaped, ENT_QUOTES, 'UTF-8');
|
||||
|
|
@ -37,7 +64,7 @@ class Legacies_Core_View
|
|||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return Legacies::translate(Legacies::getLocale(), $message, $args);
|
||||
return Legacies::translate(Legacies::getDefaultLocale(), $message, $args);
|
||||
}
|
||||
|
||||
public function translate($message, $_ = null)
|
||||
|
|
@ -104,12 +131,15 @@ class Legacies_Core_View
|
|||
static $baseUrl = null;
|
||||
if ($baseUrl === null) {
|
||||
$user = Legacies_Empire_Model_User::getSingleton();
|
||||
if ($user !== null && $user->getId() && ($baseUrl = $user->getSkinPath()) == '') {
|
||||
if ($user !== null && $user->getId()) {
|
||||
$baseUrl = $user->getSkinPath();
|
||||
}
|
||||
if ($baseUrl == '') {
|
||||
$baseUrl = DEFAULT_SKINPATH;
|
||||
}
|
||||
}
|
||||
|
||||
return $baseUrl . $uri;
|
||||
return $this->getUrl($baseUrl . $uri);
|
||||
}
|
||||
|
||||
public function setPartial($name, $content)
|
||||
|
|
@ -128,6 +158,11 @@ class Legacies_Core_View
|
|||
return $this->_partials[$name];
|
||||
}
|
||||
|
||||
public function getAllPartials()
|
||||
{
|
||||
return $this->_partials;
|
||||
}
|
||||
|
||||
public function unsetPartial($name)
|
||||
{
|
||||
if (isset($this->_partials[$name])) {
|
||||
|
|
@ -171,6 +206,10 @@ class Legacies_Core_View
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Legacies_Core_Layout
|
||||
*/
|
||||
public function getLayout()
|
||||
{
|
||||
return $this->_layout;
|
||||
|
|
@ -183,4 +222,16 @@ class Legacies_Core_View
|
|||
public function beforeToHtml()
|
||||
{
|
||||
}
|
||||
|
||||
public function setNameInLayout($name)
|
||||
{
|
||||
$this->_nameInLayout = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNameInLayout()
|
||||
{
|
||||
return $this->_nameInLayout;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,8 +15,13 @@ class Legacies_Database
|
|||
$username = $config['global']['database']['options']['username'];
|
||||
$password = $config['global']['database']['options']['password'];
|
||||
$database = $config['global']['database']['options']['database'];
|
||||
$port = 3306;
|
||||
|
||||
self::$_singleton = new self("mysql:dbname={$database};host={$hostname}", $username, $password, array(
|
||||
if (isset($config['global']['database']['options']['port'])) {
|
||||
$port = $config['global']['database']['options']['port'];
|
||||
}
|
||||
|
||||
self::$_singleton = new self("mysql:dbname={$database};host={$hostname};port={$port}", $username, $password, array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class Legacies_Empire
|
|||
const RESOURCE_MULTIPLIER = 'factor';
|
||||
const RESOURCE_FORMULA = 'formule';
|
||||
const RESOURCE_CLASS = 'class';
|
||||
const BASE_BUILDING_TIME = 'base_time';
|
||||
|
||||
const SHIPS_CONSUMPTION_PRIMARY = 'consumption';
|
||||
const SHIPS_CELERITY_PRIMARY = 'speed';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
|
||||
abstract class Legacies_Empire_Block_Planet_Builder_ItemAbstract
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
protected $_user = null;
|
||||
protected $_planet = null;
|
||||
protected $_itemId = null;
|
||||
|
||||
public function setUser(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
$this->_user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
if ($this->_user === null) {
|
||||
$this->_user = Legacies_Empire_Model_User::getSingleton();
|
||||
}
|
||||
|
||||
return $this->_user;
|
||||
}
|
||||
|
||||
public function setPlanet(Legacies_Empire_Model_Planet $planet)
|
||||
{
|
||||
$this->_planet = $planet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlanet()
|
||||
{
|
||||
if ($this->_planet === null) {
|
||||
$this->_planet = $this->getUser()->getCurrentPlanet();
|
||||
}
|
||||
|
||||
return $this->_planet;
|
||||
}
|
||||
|
||||
public function setItemId($itemId)
|
||||
{
|
||||
$this->_itemId = $itemId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItemId()
|
||||
{
|
||||
return $this->_itemId;
|
||||
}
|
||||
|
||||
public function getItemInfoUrl()
|
||||
{
|
||||
return $this->getUrl('infos.php', array('gid' => $this->getItemId()));
|
||||
}
|
||||
|
||||
public function getItemImageUrl()
|
||||
{
|
||||
// TODO : Upgrade theme
|
||||
return $this->getSkinUrl('graphics/gebaeude/' . $this->getItemId() . '.gif');
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('tech');
|
||||
}
|
||||
|
||||
if (isset($lang['tech']) && isset($lang['tech'][$this->getItemId()])) {
|
||||
return $this->__($lang['tech'][$this->getItemId()]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('tech');
|
||||
}
|
||||
|
||||
if (isset($lang['res']) && isset($lang['res']['descriptions']) && isset($lang['res']['descriptions'][$this->getItemId()])) {
|
||||
return $this->__($lang['res']['descriptions'][$this->getItemId()]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getResourceName($resourceId)
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('imperium');
|
||||
}
|
||||
if ($resourceId == 'cristal') {
|
||||
$resourceId = 'crystal';
|
||||
}
|
||||
|
||||
if (isset($lang[$resourceId])) {
|
||||
return $this->__($lang[$resourceId]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getNextLevel()
|
||||
{
|
||||
return $this->getQueuedLevel() + 1;
|
||||
}
|
||||
|
||||
abstract public function getResourcesNeeded($level);
|
||||
|
||||
abstract public function getBuildingTime($level);
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
abstract class Legacies_Empire_Block_Planet_Builder_Queue_ItemAbstract
|
||||
extends Legacies_Empire_Block_Planet_Builder_ItemAbstract
|
||||
{
|
||||
protected $_item = null;
|
||||
|
||||
protected $_itemIdField = null;
|
||||
|
||||
public function setItem(Legacies_Empire_Model_Builder_Item $item)
|
||||
{
|
||||
$this->_item = $item;
|
||||
$this->setItemId($item->getData($this->_itemIdField));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItem()
|
||||
{
|
||||
return $this->_item;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
|
||||
abstract class Legacies_Empire_Block_Planet_Builder_QueueAbstract
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
protected $_user = null;
|
||||
protected $_planet = null;
|
||||
protected $_itemTemplate = null;
|
||||
protected $_itemBlock = null;
|
||||
|
||||
public function setUser(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
$this->_user = $user;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
if ($this->_user === null) {
|
||||
$this->_user = Legacies_Empire_Model_User::getSingleton();
|
||||
}
|
||||
|
||||
return $this->_user;
|
||||
}
|
||||
|
||||
public function setPlanet(Legacies_Empire_Model_Planet $planet)
|
||||
{
|
||||
$this->_planet = $planet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlanet()
|
||||
{
|
||||
if ($this->_planet === null) {
|
||||
$this->_planet = $this->getUser()->getCurrentPlanet();
|
||||
}
|
||||
|
||||
return $this->_planet;
|
||||
}
|
||||
|
||||
public function setItemTemplate($template)
|
||||
{
|
||||
$this->_itemTemplate = $template;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItemTemplate()
|
||||
{
|
||||
return $this->_itemTemplate;
|
||||
}
|
||||
|
||||
public function setItemBlockType($blockType)
|
||||
{
|
||||
$this->_itemBlockType = $blockType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItemBlockType()
|
||||
{
|
||||
return $this->_itemBlockType;
|
||||
}
|
||||
|
||||
public function getItemBlock(Legacies_Empire_Model_Builder_Item $item)
|
||||
{
|
||||
$index = $item->getIndex();
|
||||
$blockName = "item({$index})";
|
||||
|
||||
return $this->getLayout()
|
||||
->createBlock($this->getItemBlockType(), $blockName)
|
||||
->setTemplate($this->getItemTemplate())
|
||||
->setPlanet($this->getPlanet())
|
||||
->setItem($item);
|
||||
}
|
||||
|
||||
public function prepareLayout()
|
||||
{
|
||||
$parentBlock = $this->getLayout()
|
||||
->createBlock('core/concat', $this->getNameInLayout() . '.item-list')
|
||||
;
|
||||
$this->setPartial('item-list', $parentBlock);
|
||||
|
||||
foreach ($this->getQueue() as $item) {
|
||||
$block = $this->getItemBlock($item);
|
||||
$parentBlock->setPartial($block->getNameInLayout(), $block);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract public function getQueue();
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
abstract class Legacies_Empire_Block_Planet_BuilderAbstract
|
||||
extends Legacies_Core_Block_Template
|
||||
{
|
||||
protected $_itemTemplate = null;
|
||||
protected $_itemBlock = null;
|
||||
|
||||
public function setItemTemplate($template)
|
||||
{
|
||||
$this->_itemTemplate = $template;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItemTemplate()
|
||||
{
|
||||
return $this->_itemTemplate;
|
||||
}
|
||||
|
||||
public function setItemBlockType($blockType)
|
||||
{
|
||||
$this->_itemBlockType = $blockType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItemBlockType()
|
||||
{
|
||||
return $this->_itemBlockType;
|
||||
}
|
||||
|
||||
public function getItemBlock($itemId)
|
||||
{
|
||||
$blockName = "item({$itemId})";
|
||||
|
||||
return $this->getLayout()
|
||||
->createBlock($this->getItemBlockType(), $blockName)
|
||||
->setTemplate($this->getItemTemplate())
|
||||
->setPlanet($this->getPlanet())
|
||||
->setItemId($itemId);
|
||||
}
|
||||
|
||||
public function prepareLayout()
|
||||
{
|
||||
parent::prepareLayout();
|
||||
|
||||
$this->_initChildBlocks();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract protected function _initChildBlocks();
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_Buildings
|
||||
extends Legacies_Empire_Block_Planet_BuilderAbstract
|
||||
{
|
||||
protected $_planet = null;
|
||||
|
||||
public function setPlanet(Legacies_Empire_Model_Planet $planet)
|
||||
{
|
||||
$this->_planet = $planet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlanet()
|
||||
{
|
||||
if ($this->_planet === null) {
|
||||
$this->_planet = Legacies_Empire_Model_User::getSingleton()
|
||||
->getCurrentPlanet()
|
||||
;
|
||||
}
|
||||
return $this->_planet;
|
||||
}
|
||||
|
||||
public function _initChildBlocks()
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
$type = Legacies_Empire::TYPE_BUILDING_PLANET;
|
||||
if ($this->getPlanet()->isMoon()) {
|
||||
$type = Legacies_Empire::TYPE_BUILDING_MOON;
|
||||
}
|
||||
|
||||
/** @var Legacies_Core_Block_Concat $parentBlock */
|
||||
$parentBlock = $this->getLayout()->getBlock('item-list.items');
|
||||
foreach ($types->getData($type) as $itemId) {
|
||||
if (!$this->getPlanet()->checkAvailability($itemId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$block = $this->getItemBlock($itemId);
|
||||
$parentBlock->setPartial($block->getName(), $block);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,102 +1,56 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_Buildings_Item
|
||||
extends Legacies_Core_Block_Template
|
||||
extends Legacies_Empire_Block_Planet_Builder_ItemAbstract
|
||||
{
|
||||
protected $_planet = null;
|
||||
protected $_itemId = null;
|
||||
|
||||
public function setPlanet(Legacies_Empire_Model_Planet $planet)
|
||||
{
|
||||
$this->_planet = $planet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlanet()
|
||||
{
|
||||
return $this->_planet;
|
||||
}
|
||||
|
||||
public function setItemId($itemId)
|
||||
{
|
||||
$this->_itemId = $itemId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItemId()
|
||||
{
|
||||
return $this->_itemId;
|
||||
}
|
||||
|
||||
public function getItemInfoUrl()
|
||||
{
|
||||
return $this->getUrl('infos.php', array('gid' => $this->getItemId()));
|
||||
}
|
||||
|
||||
public function getItemImageUrl()
|
||||
{
|
||||
return $this->getSkinUrl('graphics/gebaeude/' . $this->getItemId() . '.gif');
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('tech');
|
||||
}
|
||||
|
||||
if (isset($lang['tech']) && isset($lang['tech'][$this->getItemId()])) {
|
||||
return $this->__($lang['tech'][$this->getItemId()]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('tech');
|
||||
}
|
||||
|
||||
if (isset($lang['res']) && isset($lang['res']['descriptions']) && isset($lang['res']['descriptions'][$this->getItemId()])) {
|
||||
return $this->__($lang['res']['descriptions'][$this->getItemId()]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getResourceName($resourceId)
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('imperium');
|
||||
}
|
||||
if ($resourceId == 'cristal') {
|
||||
$resourceId = 'crystal';
|
||||
}
|
||||
|
||||
if (isset($lang[$resourceId])) {
|
||||
return $this->__($lang[$resourceId]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getLevel()
|
||||
{
|
||||
return $this->_planet->getElement($this->getItemId());
|
||||
return $this->getPlanet()->getElement($this->getItemId());
|
||||
}
|
||||
|
||||
public function getResourcesNeeded()
|
||||
public function getResourcesNeeded($level)
|
||||
{
|
||||
return $this->_planet->getResourcesNeeded($this->getItemId(), 1);
|
||||
return $this->getPlanet()->getResourcesNeeded($this->getItemId(), $level);
|
||||
}
|
||||
|
||||
public function getItemTime()
|
||||
public function getQueuedLevel()
|
||||
{
|
||||
return $this->_planet->getBuildingTime($this->getItemId(), 1);
|
||||
return $this->getPlanet()->getBuildingLevelQueued($this->getItemId());
|
||||
}
|
||||
|
||||
public function getBuildingTime($level)
|
||||
{
|
||||
return $this->getPlanet()->getBuildingTime($this->getItemId(), $level);
|
||||
}
|
||||
|
||||
public function getResourcesConfigForLevel($level)
|
||||
{
|
||||
$resources = $this->getResourcesNeeded($level);
|
||||
|
||||
$resourceConfig = array();
|
||||
foreach ($resources as $resourceId => $resourceValue) {
|
||||
$resourceConfig[$resourceId] = new Legacies_Object(array(
|
||||
'resource_id' => $resourceId,
|
||||
'value' => $resourceValue
|
||||
));
|
||||
|
||||
$amount = $this->getPlanet()->getResourceAmount($resourceId);
|
||||
if (Math::comp($amount, $resourceValue) < 0) {
|
||||
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
|
||||
} else {
|
||||
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
|
||||
}
|
||||
}
|
||||
return $resourceConfig;
|
||||
}
|
||||
|
||||
public function getResourcesConfigForNextLevel()
|
||||
{
|
||||
return $this->getResourcesConfigForLevel($this->getNextLevel());
|
||||
}
|
||||
|
||||
public function getBuildingTimeForNextLevel()
|
||||
{
|
||||
return $this->getBuildingTime($this->getNextLevel());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_Buildings_Queue
|
||||
extends Legacies_Empire_Block_Planet_Builder_QueueAbstract
|
||||
{
|
||||
public function getQueue()
|
||||
{
|
||||
return $this->getPlanet()->getBuildingQueue();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->getQueue()->count() == 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_Buildings_Queue_Item
|
||||
extends Legacies_Empire_Block_Planet_Builder_Queue_ItemAbstract
|
||||
{
|
||||
protected $_itemIdField = 'building_id';
|
||||
|
||||
public function getLevel()
|
||||
{
|
||||
return $this->getPlanet()->getElement($this->getItemId());
|
||||
}
|
||||
|
||||
public function getResourcesNeeded($level)
|
||||
{
|
||||
return $this->getPlanet()->getResourcesNeeded($this->getItemId(), $this->getQueuedLevel() + 1);
|
||||
}
|
||||
|
||||
public function getItemQueuedLevel()
|
||||
{
|
||||
return $this->getItem()->getData('level');
|
||||
}
|
||||
|
||||
public function getQueuedLevel()
|
||||
{
|
||||
return $this->getPlanet()->getBuildingLevelQueued($this->getItemId());
|
||||
}
|
||||
|
||||
public function getBuildingTime($level)
|
||||
{
|
||||
return $this->getPlanet()->getBuildingTime($this->getItemId(), $level);
|
||||
}
|
||||
|
||||
public function getResourcesConfigForLevel($level)
|
||||
{
|
||||
$resources = $this->getResourcesNeeded($level);
|
||||
|
||||
$resourceConfig = array();
|
||||
foreach ($resources as $resourceId => $resourceValue) {
|
||||
$resourceConfig[$resourceId] = new Legacies_Object(array(
|
||||
'resource_id' => $resourceId,
|
||||
'value' => $resourceValue
|
||||
));
|
||||
|
||||
$amount = $this->getPlanet()->getResourceAmount($resourceId);
|
||||
if (Math::comp($amount, $resourceValue) < 0) {
|
||||
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
|
||||
} else {
|
||||
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
|
||||
}
|
||||
}
|
||||
return $resourceConfig;
|
||||
}
|
||||
|
||||
public function getResourcesConfigForNextLevel()
|
||||
{
|
||||
return $this->getResourcesConfigForLevel($this->getNextLevel());
|
||||
}
|
||||
|
||||
public function getBuildingTimeForNextLevel()
|
||||
{
|
||||
return $this->getBuildingTime($this->getNextLevel());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_ResearchLab
|
||||
extends Legacies_Empire_Block_Planet_BuilderAbstract
|
||||
{
|
||||
protected $_planet = null;
|
||||
|
||||
public function setPlanet(Legacies_Empire_Model_Planet $planet)
|
||||
{
|
||||
$this->_planet = $planet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlanet()
|
||||
{
|
||||
if ($this->_planet === null) {
|
||||
$this->_planet = Legacies_Empire_Model_User::getSingleton()
|
||||
->getCurrentPlanet()
|
||||
;
|
||||
}
|
||||
return $this->_planet;
|
||||
}
|
||||
|
||||
public function _initChildBlocks()
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
/** @var Legacies_Core_Block_Concat $parentBlock */
|
||||
$parentBlock = $this->getLayout()->getBlock('item-list.items');
|
||||
foreach ($types->getData(Legacies_Empire::TYPE_RESEARCH) as $itemId) {
|
||||
if (!$this->getPlanet()->getResearchLab()->checkAvailability($itemId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$block = $this->getItemBlock($itemId);
|
||||
$parentBlock->setPartial($block->getName(), $block);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_ResearchLab_Item
|
||||
extends Legacies_Empire_Block_Planet_Builder_ItemAbstract
|
||||
{
|
||||
public function getLevel()
|
||||
{
|
||||
return $this->getUser()->getElement($this->getItemId());
|
||||
}
|
||||
|
||||
public function getResourcesNeeded($level)
|
||||
{
|
||||
return $this->getPlanet()->getResearchLab()->getResourcesNeeded($this->getItemId(), $level);
|
||||
}
|
||||
|
||||
public function getQueuedLevel()
|
||||
{
|
||||
return $this->getPlanet()->getResearchLab()->getResearchLevelQueued($this->getItemId());
|
||||
}
|
||||
|
||||
public function getBuildingTime($level)
|
||||
{
|
||||
return $this->getPlanet()->getResearchLab()->getResearchTime($this->getItemId(), $level);
|
||||
}
|
||||
|
||||
public function getResourcesConfigForLevel($level)
|
||||
{
|
||||
$resources = $this->getResourcesNeeded($level);
|
||||
|
||||
$resourceConfig = array();
|
||||
foreach ($resources as $resourceId => $resourceValue) {
|
||||
$resourceConfig[$resourceId] = new Legacies_Object(array(
|
||||
'resource_id' => $resourceId,
|
||||
'value' => $resourceValue
|
||||
));
|
||||
|
||||
$amount = $this->getPlanet()->getResourceAmount($resourceId);
|
||||
if (Math::comp($amount, $resourceValue) < 0) {
|
||||
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
|
||||
} else {
|
||||
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
|
||||
}
|
||||
}
|
||||
return $resourceConfig;
|
||||
}
|
||||
|
||||
public function getResourcesConfigForNextLevel()
|
||||
{
|
||||
return $this->getResourcesConfigForLevel($this->getNextLevel());
|
||||
}
|
||||
|
||||
public function getBuildingTimeForNextLevel()
|
||||
{
|
||||
return $this->getBuildingTime($this->getNextLevel());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_ResearchLab_Queue
|
||||
extends Legacies_Empire_Block_Planet_Builder_QueueAbstract
|
||||
{
|
||||
public function getQueue()
|
||||
{
|
||||
return $this->getPlanet()->getResearchLab()->getBuilder();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->getQueue()->count() == 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_ResearchLab_Queue_Item
|
||||
extends Legacies_Empire_Block_Planet_Builder_Queue_ItemAbstract
|
||||
{
|
||||
protected $_itemIdField = 'research_id';
|
||||
|
||||
public function getLevel()
|
||||
{
|
||||
return $this->getUser()->getElement($this->getItemId());
|
||||
}
|
||||
|
||||
public function getResourcesNeeded($level)
|
||||
{
|
||||
return $this->getPlanet()->getResearchLab()->getResourcesNeeded($this->getItemId(), $this->getQueuedLevel() + 1);
|
||||
}
|
||||
|
||||
public function getItemQueuedLevel()
|
||||
{
|
||||
return $this->getItem()->getData('level');
|
||||
}
|
||||
|
||||
public function getQueuedLevel()
|
||||
{
|
||||
return $this->getPlanet()->getResearchLab()->getResearchLevelQueued($this->getItemId());
|
||||
}
|
||||
|
||||
public function getBuildingTime($level)
|
||||
{
|
||||
return $this->getPlanet()->getResearchLab()->getBuildingTime($this->getItemId(), $level);
|
||||
}
|
||||
|
||||
public function getResourcesConfigForLevel($level)
|
||||
{
|
||||
$resources = $this->getResourcesNeeded($level);
|
||||
|
||||
$resourceConfig = array();
|
||||
foreach ($resources as $resourceId => $resourceValue) {
|
||||
$resourceConfig[$resourceId] = new Legacies_Object(array(
|
||||
'resource_id' => $resourceId,
|
||||
'value' => $resourceValue
|
||||
));
|
||||
|
||||
$amount = $this->getPlanet()->getResourceAmount($resourceId);
|
||||
if (Math::comp($amount, $resourceValue) < 0) {
|
||||
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
|
||||
} else {
|
||||
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
|
||||
}
|
||||
}
|
||||
return $resourceConfig;
|
||||
}
|
||||
|
||||
public function getResourcesConfigForNextLevel()
|
||||
{
|
||||
return $this->getResourcesConfigForLevel($this->getNextLevel());
|
||||
}
|
||||
|
||||
public function getBuildingTimeForNextLevel()
|
||||
{
|
||||
return $this->getBuildingTime($this->getNextLevel());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_Shipyard
|
||||
extends Legacies_Empire_Block_Planet_BuilderAbstract
|
||||
{
|
||||
protected $_planet = null;
|
||||
protected $_type = Legacies_Empire::TYPE_SHIP;
|
||||
|
||||
protected $_allowedTypes = array(
|
||||
Legacies_Empire::TYPE_SHIP,
|
||||
Legacies_Empire::TYPE_DEFENSE
|
||||
);
|
||||
|
||||
public function setPlanet(Legacies_Empire_Model_Planet $planet)
|
||||
{
|
||||
$this->_planet = $planet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlanet()
|
||||
{
|
||||
if ($this->_planet === null) {
|
||||
$this->_planet = Legacies_Empire_Model_User::getSingleton()
|
||||
->getCurrentPlanet()
|
||||
;
|
||||
}
|
||||
return $this->_planet;
|
||||
}
|
||||
|
||||
public function setAllowedTypes($types)
|
||||
{
|
||||
if (is_array($types)) {
|
||||
$this->_allowedTypes = $types;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addAllowedType($type)
|
||||
{
|
||||
if (!in_array($type, $this->_allowedTypes)) {
|
||||
$this->_allowedTypes[] = $type;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAllowedTypes()
|
||||
{
|
||||
return $this->_allowedTypes;
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
if (in_array($type, $this->_allowedTypes)) {
|
||||
$this->_type = $type;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
public function _initChildBlocks()
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
/** @var Legacies_Core_Block_Concat $parentBlock */
|
||||
$parentBlock = $this->getLayout()->getBlock('item-list.items');
|
||||
foreach ($types->getData($this->getType()) as $itemId) {
|
||||
if (!$this->getPlanet()->getShipyard()->checkAvailability($itemId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$block = $this->getItemBlock($itemId);
|
||||
$parentBlock->setPartial($block->getName(), $block);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,109 +1,46 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_Shipyard_Item
|
||||
extends Legacies_Core_Block_Template
|
||||
extends Legacies_Empire_Block_Planet_Builder_ItemAbstract
|
||||
{
|
||||
protected $_planet = null;
|
||||
protected $_shipyard = null;
|
||||
protected $_itemId = null;
|
||||
|
||||
public function setPlanet(Legacies_Empire_Model_Planet $planet)
|
||||
{
|
||||
$this->_planet = $planet;
|
||||
$this->_shipyard = $this->_planet->getShipyard();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPlanet()
|
||||
{
|
||||
return $this->_planet;
|
||||
}
|
||||
|
||||
public function setItemId($shipId)
|
||||
{
|
||||
$this->_itemId = $shipId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getItemId()
|
||||
{
|
||||
return $this->_itemId;
|
||||
}
|
||||
|
||||
public function getItemInfoUrl()
|
||||
{
|
||||
return $this->getUrl('infos.php', array('gid' => $this->getItemId()));
|
||||
}
|
||||
|
||||
public function getItemImageUrl()
|
||||
{
|
||||
return $this->getSkinUrl('graphics/gebaeude/' . $this->getItemId() . '.gif');
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('tech');
|
||||
}
|
||||
|
||||
if (isset($lang['tech']) && isset($lang['tech'][$this->getItemId()])) {
|
||||
return $this->__($lang['tech'][$this->getItemId()]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('tech');
|
||||
}
|
||||
|
||||
if (isset($lang['res']) && isset($lang['res']['descriptions']) && isset($lang['res']['descriptions'][$this->getItemId()])) {
|
||||
return $this->__($lang['res']['descriptions'][$this->getItemId()]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getResourceName($resourceId)
|
||||
{
|
||||
static $lang = null;
|
||||
if ($lang === null) {
|
||||
// FIXME: implement a cleaner way to get names
|
||||
$lang = includeLang('imperium');
|
||||
}
|
||||
if ($resourceId == 'cristal') {
|
||||
$resourceId = 'crystal';
|
||||
}
|
||||
|
||||
if (isset($lang[$resourceId])) {
|
||||
return $this->__($lang[$resourceId]);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
public function getQty()
|
||||
{
|
||||
return $this->_planet->getElement($this->getItemId());
|
||||
return $this->getPlanet()->getElement($this->getItemId());
|
||||
}
|
||||
|
||||
public function getResourcesNeeded()
|
||||
public function getResourcesNeeded($qty)
|
||||
{
|
||||
return $this->_shipyard->getResourcesNeeded($this->getItemId(), 1);
|
||||
return $this->getPlanet()->getShipyard()->getResourcesNeeded($this->getItemId(), $qty);
|
||||
}
|
||||
|
||||
public function getBuildingTime()
|
||||
public function getBuildingTime($qty)
|
||||
{
|
||||
return $this->_shipyard->getBuildingTime($this->getItemId(), 1);
|
||||
return $this->getPlanet()->getShipyard()->getBuildingTime($this->getItemId(), $qty);
|
||||
}
|
||||
|
||||
public function getMaximumBuildableElementsCount()
|
||||
{
|
||||
return $this->_shipyard->getMaximumBuildableElementsCount($this->getItemId());
|
||||
return $this->getPlanet()->getShipyard()->getMaximumBuildableElementsCount($this->getItemId());
|
||||
}
|
||||
|
||||
public function getResourcesConfigForQty($qty)
|
||||
{
|
||||
$resources = $this->getResourcesNeeded($qty);
|
||||
|
||||
$resourceConfig = array();
|
||||
foreach ($resources as $resourceId => $resourceValue) {
|
||||
$resourceConfig[$resourceId] = new Legacies_Object(array(
|
||||
'resource_id' => $resourceId,
|
||||
'value' => $resourceValue
|
||||
));
|
||||
|
||||
$amount = $this->getPlanet()->getResourceAmount($resourceId);
|
||||
if (Math::comp($amount, $resourceValue) < 0) {
|
||||
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
|
||||
} else {
|
||||
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
|
||||
}
|
||||
}
|
||||
return $resourceConfig;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Block_Planet_Shipyard_Queue
|
||||
extends Legacies_Empire_Block_Planet_Builder_QueueAbstract
|
||||
{
|
||||
public function getQueue()
|
||||
{
|
||||
return $this->getPlanet()->getShipyard()->getQueue();
|
||||
}
|
||||
|
||||
public function isEmpty()
|
||||
{
|
||||
return $this->getQueue()->count() == 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ abstract class Legacies_Empire_Model_BuilderAbstract
|
|||
* construction queue
|
||||
* @var array
|
||||
*/
|
||||
private $_queue = null;
|
||||
protected $_queue = null;
|
||||
|
||||
/**
|
||||
* construction queue
|
||||
|
|
@ -27,12 +27,6 @@ abstract class Legacies_Empire_Model_BuilderAbstract
|
|||
*/
|
||||
protected $_itemClass = 'Legacies_Empire_Model_Builder_Item';
|
||||
|
||||
/**
|
||||
* construction queue
|
||||
* @var array
|
||||
*/
|
||||
protected $_index = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Legacies_Empire_Model_Planet $currentPlanet
|
||||
|
|
@ -48,25 +42,36 @@ abstract class Legacies_Empire_Model_BuilderAbstract
|
|||
|
||||
abstract public function init();
|
||||
|
||||
abstract protected function _initItem();
|
||||
abstract protected function _initItem(Array $params);
|
||||
|
||||
public function enqueue()
|
||||
public function enqueue($params, $index = null)
|
||||
{
|
||||
$params = func_get_args();
|
||||
$item = call_user_func_array(array($this, '_initItem'), $params);
|
||||
$item->setIndex($this->_index);
|
||||
$this->_queue[$this->_index++] = $item;
|
||||
$item = $this->_initItem($params);
|
||||
if ($item === null) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if ($index === null) {
|
||||
$index = $this->_generateIndex();
|
||||
}
|
||||
$item->setIndex($index);
|
||||
$this->_queue[$index] = $item;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function dequeue($item)
|
||||
{
|
||||
unset($this->_queue[(int) $item->getIndex()]);
|
||||
unset($this->_queue[$item->getIndex()]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _generateIndex()
|
||||
{
|
||||
return uniqid();
|
||||
}
|
||||
|
||||
public function getItem($itemIndex)
|
||||
{
|
||||
if (isset($this->_queue[$itemIndex])) {
|
||||
|
|
@ -79,8 +84,8 @@ abstract class Legacies_Empire_Model_BuilderAbstract
|
|||
protected function _serializeQueue()
|
||||
{
|
||||
$serialize = array();
|
||||
foreach ($this->_queue as $item) {
|
||||
$serialize[] = $item->getAllDatas();
|
||||
foreach ($this->_queue as $itemIndex => $itemInstance) {
|
||||
$serialize[$itemIndex] = $itemInstance->getAllDatas();
|
||||
}
|
||||
return serialize($serialize);
|
||||
}
|
||||
|
|
@ -95,8 +100,8 @@ abstract class Legacies_Empire_Model_BuilderAbstract
|
|||
return $this;
|
||||
}
|
||||
|
||||
foreach ($unserialized as $itemData) {
|
||||
call_user_func_array(array($this, 'enqueue'), $itemData);
|
||||
foreach ($unserialized as $itemIndex => $itemData) {
|
||||
$this->enqueue($itemData, $itemIndex);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
@ -222,7 +227,7 @@ abstract class Legacies_Empire_Model_BuilderAbstract
|
|||
protected function _calculateResourceRemainingAmounts($resourceNeeded)
|
||||
{
|
||||
$resourceAmounts = array();
|
||||
foreach ($resourcesNeeded as $resourceId => $resourceAmount) {
|
||||
foreach ($resourceNeeded as $resourceId => $resourceAmount) {
|
||||
$resourceAmounts[$resourceId] = Math::sub($this->_currentPlanet[$resourceId], $resourceAmount);
|
||||
if (Math::isNegative($resourceAmounts[$resourceId])) {
|
||||
return false;
|
||||
|
|
@ -230,4 +235,13 @@ abstract class Legacies_Empire_Model_BuilderAbstract
|
|||
}
|
||||
return $resourceAmounts;
|
||||
}
|
||||
|
||||
protected function _calculateResourceReclaimedAmounts($resourceNeeded)
|
||||
{
|
||||
$resourceAmounts = array();
|
||||
foreach ($resourceNeeded as $resourceId => $resourceAmount) {
|
||||
$resourceAmounts[$resourceId] = Math::add($this->_currentPlanet[$resourceId], $resourceAmount);
|
||||
}
|
||||
return $resourceAmounts;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,4 +8,25 @@ class Legacies_Empire_Model_Galaxy_Position
|
|||
$this->_tableName = 'galaxy';
|
||||
$this->_idFieldNames = array('id_planet');
|
||||
}
|
||||
|
||||
static function initPlanetListerner($eventData)
|
||||
{
|
||||
if (!isset($eventData['planet'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$planet = $eventData['planet'];
|
||||
if (!$planet->isPlanet()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$galaxy = new self();
|
||||
$galaxy
|
||||
->setData('galaxy', $planet->getGalaxy())
|
||||
->setData('system', $planet->getSystem())
|
||||
->setData('planet', $planet->getPosition())
|
||||
->setData('id_planet', $planet->getId())
|
||||
->save()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
@ -70,15 +70,6 @@ class Legacies_Empire_Model_Planet
|
|||
$this->_idFieldName = 'id';
|
||||
}
|
||||
|
||||
public function _afterLoad()
|
||||
{
|
||||
parent::_afterLoad();
|
||||
|
||||
$this->getBuildingQueue()->init();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLastUpdate()
|
||||
{
|
||||
return $this->getData('last_update');
|
||||
|
|
@ -119,10 +110,15 @@ class Legacies_Empire_Model_Planet
|
|||
//$officerEnhancement = (.5 * $this->getUser()->getData('rpg_stockeur')) + 1;
|
||||
$officerEnhancement = 1;
|
||||
|
||||
$storageEnhancementFactor = Math::floor(Math::pow(1.6, $this[Legacies_Empire::getFieldName($resourceData['storage'])]));
|
||||
$storageEnhancement = Math::mul(BASE_STORAGE_SIZE / 2, $storageEnhancementFactor);
|
||||
if ($this->getElement($resourceData['storage'])) {
|
||||
$storageEnhancementFactor = Math::floor(Math::pow(1.6, $this->getElement($resourceData['storage'])));
|
||||
$storageEnhancement = Math::mul(BASE_STORAGE_SIZE / 2, $storageEnhancementFactor);
|
||||
} else {
|
||||
$storageEnhancement = 0;
|
||||
}
|
||||
|
||||
$value = Math::mul(MAX_OVERFLOW, Math::mul($officerEnhancement, Math::add(BASE_STORAGE_SIZE, $storageEnhancement)));
|
||||
|
||||
$this->setData($resourceData['storage_field'], Math::floor($value));
|
||||
}
|
||||
Math::setPrecision();
|
||||
|
|
@ -619,9 +615,9 @@ class Legacies_Empire_Model_Planet
|
|||
));
|
||||
|
||||
if ($destroy === false) {
|
||||
$level = $this->getElement($buildingId) + 1;
|
||||
$level = $this->getBuildingLevelQueued($buildingId) + 1;
|
||||
} else {
|
||||
$level = max($this->getElement($buildingId) - 1, 0);
|
||||
$level = max($this->getBuildingLevelQueued($buildingId) - 1, 0);
|
||||
}
|
||||
|
||||
$this->getBuildingQueue()->appendQueue($buildingId, $level, $time);
|
||||
|
|
@ -664,6 +660,19 @@ class Legacies_Empire_Model_Planet
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getBuildingLevelQueued($buildingId)
|
||||
{
|
||||
$level = $this->getElement($buildingId);
|
||||
foreach ($this->_builder as $item) {
|
||||
if ($item->getData('building_id') != $buildingId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$level = $item->getData('level');
|
||||
}
|
||||
return $level;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Legacies_Empire_Model_Planet_Builder
|
||||
|
|
@ -691,6 +700,18 @@ class Legacies_Empire_Model_Planet
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @return Legacies_Empire_Model_Planet
|
||||
*/
|
||||
public function dequeueItem($itemId)
|
||||
{
|
||||
$this->getBuildingQueue()->dequeueItem($itemId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a building is actually buildable on the current planet,
|
||||
* depending on the technology and buildings requirements.
|
||||
|
|
@ -743,60 +764,33 @@ class Legacies_Empire_Model_Planet
|
|||
{
|
||||
if (isset($eventData['user'])) {
|
||||
$user = $eventData['user'];
|
||||
$request = $eventData['request'];
|
||||
|
||||
if ($user === null || !$user instanceof Legacies_Empire_Model_User || $user->getId()) {
|
||||
return;
|
||||
}
|
||||
if ($request === null || !$request instanceof Legacies_Core_Controller_Request) {
|
||||
if ($user === null || !$user instanceof Legacies_Empire_Model_User || !$user->getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$collection = new Legacies_Core_Collection('planets');
|
||||
$collection
|
||||
->column(array(
|
||||
'galaxy' => 'planet.galaxy',
|
||||
'system' => 'planet.system',
|
||||
'count' => 'COUNT(planet.id)'
|
||||
))
|
||||
->group('planet.galaxy')
|
||||
->group('planet.system')
|
||||
->where('planet.planet_type=1')
|
||||
->order('COUNT(planet.id)', 'ASC')
|
||||
->order('RAND()', 'ASC')
|
||||
->limit(1)
|
||||
;
|
||||
|
||||
$params = array();
|
||||
$galaxy = $request->getParam('system');
|
||||
if ($galaxy !== null) {
|
||||
$collection->where('planet.galaxy=:galaxy');
|
||||
$params['galaxy'] = $galaxy;
|
||||
|
||||
$systems = explode(',', $request->getParam('system'));
|
||||
if (is_array($systems) && count($systems) == 2 && is_int($systems[0]) && is_int($systems[1])) {
|
||||
$collection->where('planet.system IN(' . implode(', ', range($systems[0], $systems[1])) . ')');
|
||||
}
|
||||
}
|
||||
$collection->load($params);
|
||||
$collection = self::_searchMostFreeSystems();
|
||||
$collection->limit(1)->load();
|
||||
|
||||
if ($collection->count() == 0) {
|
||||
throw new Exception('No planet to colonize there!'); // FIXME
|
||||
throw new Exception('No more planet to colonize!'); // Oops, no more free place
|
||||
}
|
||||
|
||||
$systemInfo = $collection->current();
|
||||
if ($systemInfo->getData('count') >= MAX_PLANET_IN_SYSTEM) {
|
||||
throw new Exception('No planet to colonize there!'); // FIXME
|
||||
throw new Exception('No more planet to colonize!'); // Oops, no more free place
|
||||
}
|
||||
$system = $systemInfo->getData('system');
|
||||
$galaxy = $systemInfo->getData('galaxy');
|
||||
|
||||
$collection = new Legacies_Core_Collection('planets');
|
||||
$collection = new Legacies_Core_Collection(array('planet' => 'planets'));
|
||||
$collection
|
||||
->column(array('position' => 'planet.position'))
|
||||
->column(array('position' => 'planet.planet'))
|
||||
->where('planet.planet_type=1')
|
||||
->where('planet.planet_type=:system')
|
||||
->load()
|
||||
->where('planet.galaxy=:galaxy')
|
||||
->where('planet.system=:system')
|
||||
->load(array(
|
||||
'galaxy' => $systemInfo->getData('galaxy'),
|
||||
'system' => $systemInfo->getData('system'),
|
||||
))
|
||||
;
|
||||
$positions = range(1, MAX_PLANET_IN_SYSTEM);
|
||||
foreach ($collection as $planet) {
|
||||
|
|
@ -808,14 +802,29 @@ class Legacies_Empire_Model_Planet
|
|||
$key = array_rand($positions, 1);
|
||||
$finalPosition = $positions[$key];
|
||||
|
||||
$config = Legacies_Core_Model_Config::getSingleton();
|
||||
$planet = new self();
|
||||
$planet
|
||||
->setData('id_owner', $user->getId())
|
||||
->setData('name', $request->getParam('planet'))
|
||||
->setData('galaxy', $galaxy)
|
||||
->setData('system', $system)
|
||||
->setData('position', $finalPosition)
|
||||
->setData('name', Legacies::getRequest()->getParam('planet'))
|
||||
->setData('galaxy', $systemInfo->getData('galaxy'))
|
||||
->setData('system', $systemInfo->getData('system'))
|
||||
->setData('planet', $finalPosition)
|
||||
->setData('planet_type', 1)
|
||||
->setData('field_max', $config->getData('initial_fields'))
|
||||
->setData('field_current', 0)
|
||||
->setData('metal', 500) // TODO: use config
|
||||
->setData('cristal', 500) // TODO: use config
|
||||
;
|
||||
|
||||
$planet->save();
|
||||
|
||||
$user
|
||||
->setData('id_planet', $planet->getId())
|
||||
->setData('current_planet', $planet->getId())
|
||||
->setData('galaxy', $planet->getGalaxy())
|
||||
->setData('system', $planet->getSystem())
|
||||
->setData('planet', $planet->getPosition())
|
||||
;
|
||||
|
||||
Legacies::dispatchEvent('planet.init', array(
|
||||
|
|
@ -823,19 +832,61 @@ class Legacies_Empire_Model_Planet
|
|||
'user' => $user
|
||||
));
|
||||
|
||||
$planet
|
||||
->setData('field_max', 163)
|
||||
->setData('field_current', 0)
|
||||
->save()
|
||||
;
|
||||
|
||||
$user
|
||||
->setData('id_planet', $planet->getId())
|
||||
->setData('current_planet', $planet->getId())
|
||||
;
|
||||
//$planet->save();
|
||||
}
|
||||
}
|
||||
|
||||
protected static function _searchMostFreeSystems($galaxyList = null, $systemList = null)
|
||||
{
|
||||
$collection = new Legacies_Core_Collection(array('planet' => 'planets'));
|
||||
$collection
|
||||
->column(array(
|
||||
'galaxy' => 'planet.galaxy',
|
||||
'system' => 'planet.system',
|
||||
'count' => 'COUNT(planet.id)'
|
||||
))
|
||||
->group('planet.galaxy')
|
||||
->group('planet.system')
|
||||
->where('planet.planet_type=1')
|
||||
;
|
||||
|
||||
$config = Legacies_Core_Model_Config::getSingleton();
|
||||
|
||||
if ($galaxyList === null && $config->hasData('user/registration/galaxy_list')) {
|
||||
$galaxyList = explode(',', $config->getData('user/registration/galaxy_list'));
|
||||
}
|
||||
|
||||
if ($galaxyList !== null) {
|
||||
array_walk($galaxyList, array(__CLASS__, '_cleanItemRanges'));
|
||||
$collection->where('planet.galaxy IN(' . implode(', ', $galaxyList) . ')');
|
||||
}
|
||||
|
||||
if ($systemList === null && $config->hasData('user/registration/system_list')) {
|
||||
$systemList = explode(',', $config->getData('user/registration/system_list'));
|
||||
}
|
||||
|
||||
if ($systemList !== null) {
|
||||
array_walk($systemList, array(__CLASS__, '_cleanItemRanges'));
|
||||
$collection->where('planet.system IN(' . implode(', ', $systemList) . ')');
|
||||
}
|
||||
|
||||
$orders = array(
|
||||
"1.5 / COUNT(planet.id)",
|
||||
"ABS(planet.galaxy - CEIL({$collection->quote(MAX_GALAXY_IN_WORLD)} / 2))",
|
||||
"ABS(planet.system - CEIL({$collection->quote(MAX_SYSTEM_IN_GALAXY)} / 2))"
|
||||
);
|
||||
$collection
|
||||
->order('((' . implode(') * (', $orders) . '))', 'ASC')
|
||||
->order('RAND()', 'ASC');
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
private static function _cleanItemRanges(&$value, $index, $userdata = null)
|
||||
{
|
||||
return intval($value);
|
||||
}
|
||||
|
||||
public static function planetUpdateListener($eventData)
|
||||
{
|
||||
if (isset($eventData['planet'])) {
|
||||
|
|
|
|||
|
|
@ -9,21 +9,41 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
}
|
||||
|
||||
/**
|
||||
* @param int $buildingId
|
||||
* @param int $level
|
||||
* @param int $time
|
||||
* @param array $params
|
||||
*/
|
||||
public function _initItem()
|
||||
protected function _initItem(Array $params)
|
||||
{
|
||||
$buildingId = func_get_arg(0);
|
||||
$level = func_get_arg(1);
|
||||
$time = func_get_arg(2);
|
||||
if (!isset($params['building_id']) || !isset($params['level'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$buildingId = $params['building_id'];
|
||||
$level = $params['level'];
|
||||
|
||||
if (!isset($params['created_at'])) {
|
||||
$createdAt = time();
|
||||
} else {
|
||||
$createdAt = $params['created_at'];
|
||||
}
|
||||
|
||||
if (!isset($params['started_at'])) {
|
||||
$startedAt = 0;
|
||||
} else {
|
||||
$startedAt = $params['started_at'];
|
||||
}
|
||||
|
||||
if (!isset($params['updated_at'])) {
|
||||
$updatedAt = $createdAt;
|
||||
} else {
|
||||
$updatedAt = $params['updated_at'];
|
||||
}
|
||||
|
||||
return new Legacies_Empire_Model_Planet_Builder_Item(array(
|
||||
'building_id' => $buildingId,
|
||||
'level' => $level,
|
||||
'created_at' => $time,
|
||||
'updated_at' => $time
|
||||
'created_at' => $createdAt,
|
||||
'started_at' => $startedAt,
|
||||
'updated_at' => $updatedAt
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -42,12 +62,34 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
return true;
|
||||
}
|
||||
|
||||
return $this->checkAvailability($buildingId);
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getBuildingTime($buildingId, $level)
|
||||
{
|
||||
return 0;
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
$gameConfig = Legacies_Core_Model_Config::getSingleton();
|
||||
|
||||
Math::setPrecision(50);
|
||||
$firstLevelTime = $prices[$buildingId][Legacies_Empire::BASE_BUILDING_TIME];
|
||||
$partialLevelTime = Math::mul($firstLevelTime, Math::pow($prices[$buildingId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
|
||||
$levelTime = Math::sub($partialLevelTime, $firstLevelTime);
|
||||
|
||||
$speedFactor = $gameConfig->getData('game_speed');
|
||||
$baseTime = $levelTime / $speedFactor * 3600;
|
||||
|
||||
Math::setPrecision();
|
||||
|
||||
$event = Legacies::dispatchEvent('planet.building.building-time', array(
|
||||
'time' => $baseTime,
|
||||
'base_time' => $baseTime,
|
||||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser,
|
||||
'building_id' => $buildingId,
|
||||
'level' => $level
|
||||
));
|
||||
|
||||
return $event->getData('time');
|
||||
}
|
||||
|
||||
public function getResourcesNeeded($buildingId, $level)
|
||||
|
|
@ -65,8 +107,7 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
}
|
||||
if (Math::isPositive($prices[$buildingId][$resourceId])) {
|
||||
$firstLevelCost = $prices[$buildingId][$resourceId];
|
||||
$partialLevelCost = Math::mul($firstLevelCost, Math::pow($prices[$buildingId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
|
||||
$resourcesNeeded[$resourceId] = Math::sub($partialLevelCost, $firstLevelCost);
|
||||
$resourcesNeeded[$resourceId] = Math::mul($firstLevelCost, Math::pow($prices[$buildingId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,12 +123,20 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
$elapsedTime = $time - $this->_currentPlanet->getData('b_building');
|
||||
$startingTime = $this->_currentPlanet->getData('b_building');
|
||||
|
||||
foreach ($this->getQueue() as $element) {
|
||||
$buildingId = $element->getData('building_id');
|
||||
$elementTime = $element->getData('started_at');
|
||||
|
||||
if ($elementTime == 0) {
|
||||
$element->setData('started_at', $startingTime);
|
||||
$elementTime = $startingTime;
|
||||
}
|
||||
|
||||
$level = $element->getData('level');
|
||||
$buildTime = $this->getBuildingTime($buildingId, $level); // FIXME: consider total time, not only the construction time
|
||||
$buildingId = $element->getData('building_id');
|
||||
$buildTime = $this->getBuildingTime($buildingId, $level);
|
||||
$elapsedTime = $time - $elementTime;
|
||||
|
||||
if ($elapsedTime >= $buildTime) {
|
||||
$this->_currentPlanet->updateResources($time - $elapsedTime);
|
||||
|
|
@ -95,6 +144,7 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
$this->_currentPlanet->updateResourceProduction($time - $elapsedTime);
|
||||
$this->_currentPlanet->updateStorages($time - $elapsedTime);
|
||||
$this->_currentPlanet->updateBuildingFields();
|
||||
|
||||
$this->dequeue($element);
|
||||
|
||||
Legacies::dispatchEvent('planet.building.level-update', array(
|
||||
|
|
@ -105,15 +155,16 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
'level' => $level
|
||||
));
|
||||
|
||||
$elapsedTime -= $buildTime;
|
||||
$startingTime = $elementTime + $buildTime;
|
||||
continue;
|
||||
}
|
||||
|
||||
$element->setData('updated_at', $time);
|
||||
break;
|
||||
}
|
||||
|
||||
$this->_currentPlanet->setData('b_building_id', $this->serialize());
|
||||
$this->_currentPlanet->setData('b_building', $time);
|
||||
$this->_currentPlanet->setData('b_building', $startingTime);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -148,7 +199,11 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
return $this;
|
||||
}
|
||||
|
||||
$this->enqueue($buildingId, $level, $time);
|
||||
$this->enqueue(array(
|
||||
'building_id' => $buildingId,
|
||||
'level' => $level,
|
||||
'created_at' => $time
|
||||
));
|
||||
$this->_currentPlanet->setData('b_building_id', $this->serialize());
|
||||
|
||||
foreach ($remainingAmounts as $resourceId => $resourceAmount) {
|
||||
|
|
@ -159,22 +214,52 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
}
|
||||
|
||||
/**
|
||||
* Append items to build to the construction list
|
||||
* Dequeues the first item to build to the construction list and removes all
|
||||
* its successors of the same type.
|
||||
*
|
||||
* @param int $buildingId
|
||||
* @param int|string $level
|
||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
||||
* @return Legacies_Empire_Model_Planet_Builder
|
||||
*/
|
||||
public function dequeueFirstItem($time)
|
||||
public function dequeueFirstItem()
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
$resources = Legacies_Empire_Model_Game_Resources::getSingleton();
|
||||
$this->rewind();
|
||||
$item = $this->current();
|
||||
|
||||
if (!Math::isPositive($level)) {
|
||||
return $this->dequeueItem($item->getIndex());
|
||||
}
|
||||
|
||||
/**
|
||||
* Dequeues an item to build to the construction list and removes all its
|
||||
* successors of the same type.
|
||||
*
|
||||
* @param string $itemId
|
||||
* @return Legacies_Empire_Model_Planet_Builder
|
||||
*/
|
||||
public function dequeueItem($itemId)
|
||||
{
|
||||
$item = $this->getItem($itemId);
|
||||
if (!$item) {
|
||||
return $this;
|
||||
}
|
||||
$buildingId = $item->getData('building_id');
|
||||
|
||||
// FIXME
|
||||
$keys = array_keys($this->_queue);
|
||||
$size = count($keys);
|
||||
$start = array_search($item->getIndex(), $keys);
|
||||
for ($i = $start; $i < $size; $i++) {
|
||||
$index = $keys[$i];
|
||||
if ($this->_queue[$index]->getData('building_id') != $buildingId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$resourcesNeeded = $this->getResourcesNeeded($buildingId, $this->_queue[$index]->getData('level'));
|
||||
$reclaimedAmounts = $this->_calculateResourceReclaimedAmounts($resourcesNeeded);
|
||||
|
||||
$this->dequeue($this->_queue[$index]);
|
||||
|
||||
foreach ($reclaimedAmounts as $resourceId => $resourceAmount) {
|
||||
$this->_currentPlanet[$resourceId] = $resourceAmount;
|
||||
}
|
||||
}
|
||||
|
||||
$this->_currentPlanet->setData('b_building_id', $this->serialize());
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Building_NaniteFactory
|
||||
implements Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
public static function buildingTimeListener($event)
|
||||
{
|
||||
$planet = $event->getData('planet');
|
||||
|
||||
if (!$planet->getId() || ($level = $planet->getElement(Legacies_Empire::ID_BUILDING_NANITE_FACTORY)) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$time = $event->getData('time');
|
||||
|
||||
$speedFactor = pow(2, $level);
|
||||
$event->setData('time', $time / $speedFactor);
|
||||
}
|
||||
}
|
||||
|
|
@ -206,12 +206,12 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab
|
|||
* @param int $resourceId
|
||||
* @return bool
|
||||
*/
|
||||
public function checkAvailability($resourceId)
|
||||
public function checkAvailability($researchId)
|
||||
{
|
||||
try {
|
||||
// Dispatch event
|
||||
Legacies::dispatchEvent($this->_eventPrefix . 'check-availability', array(
|
||||
'research_id' => $resourceId,
|
||||
'research_id' => $researchId,
|
||||
'laboratory' => $this,
|
||||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser
|
||||
|
|
@ -220,17 +220,30 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab
|
|||
return false;
|
||||
}
|
||||
|
||||
return $this->_builder->checkAvailability($resourceId);
|
||||
return $this->_builder->checkAvailability($researchId);
|
||||
}
|
||||
|
||||
public function getResourcesNeeded($resourceId, $level)
|
||||
public function getResourcesNeeded($researchId, $level)
|
||||
{
|
||||
return $this->_builder->getResourcesNeeded($resourceId, $level);
|
||||
return $this->_builder->getResourcesNeeded($researchId, $level);
|
||||
}
|
||||
|
||||
public function getBuildingTime($resourceId, $level)
|
||||
public function getResearchTime($researchId, $level)
|
||||
{
|
||||
$this->_builder->getBuildingTime($resourceId, $level);
|
||||
$this->_builder->getBuildingTime($researchId, $level);
|
||||
}
|
||||
|
||||
public function getResearchLevelQueued($researchId)
|
||||
{
|
||||
$level = $this->_currentUser->getElement($researchId);
|
||||
foreach ($this->_builder as $item) {
|
||||
if ($item->getData('research_id') != $researchId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$level = $item->getData('level');
|
||||
}
|
||||
return $level;
|
||||
}
|
||||
|
||||
public static function planetUpdateListener($eventData)
|
||||
|
|
|
|||
|
|
@ -18,17 +18,30 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder
|
|||
* @param int $level
|
||||
* @param int $time
|
||||
*/
|
||||
public function _initItem()
|
||||
protected function _initItem(Array $params)
|
||||
{
|
||||
$technologyId = func_get_arg(0);
|
||||
$level = func_get_arg(1);
|
||||
$time = func_get_arg(2);
|
||||
if (!isset($params['technology_id']) || !isset($params['level'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$technologyId = $params['technology_id'];
|
||||
$level = $params['level'];
|
||||
if (!isset($params['created_at'])) {
|
||||
$createdAt = time();
|
||||
} else {
|
||||
$createdAt = $params['created_at'];
|
||||
}
|
||||
if (!isset($params['updated_at'])) {
|
||||
$updatedAt = $createdAt;
|
||||
} else {
|
||||
$updatedAt = $params['updated_at'];
|
||||
}
|
||||
|
||||
return new Legacies_Empire_Model_Planet_Building_ResearchLab_Item(array(
|
||||
'technology_id' => $technologyId,
|
||||
'level' => $level,
|
||||
'created_at' => $time,
|
||||
'updated_at' => $time
|
||||
'created_at' => $createdAt,
|
||||
'updated_at' => $updatedAt
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Building_RoboticFactory
|
||||
implements Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
public static function buildingTimeListener($event)
|
||||
{
|
||||
$planet = $event->getData('planet');
|
||||
|
||||
if (!$planet->getId() || ($level = $planet->getElement(Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY)) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$time = $event->getData('time');
|
||||
|
||||
$speedFactor = 1 + $level;
|
||||
$event->setData('time', $time / $speedFactor);
|
||||
}
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard
|
|||
|
||||
public function getBuildingTime($shipId, $qty)
|
||||
{
|
||||
$this->_builder->getBuildingTime($shipId, $qty);
|
||||
return $this->_builder->getBuildingTime($shipId, $qty);
|
||||
}
|
||||
|
||||
public static function planetUpdateListener($eventData)
|
||||
|
|
|
|||
|
|
@ -18,17 +18,30 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder
|
|||
* @param int $qty
|
||||
* @param int $time
|
||||
*/
|
||||
public function _initItem()
|
||||
protected function _initItem(Array $params)
|
||||
{
|
||||
$shipId = func_get_arg(0);
|
||||
$qty = func_get_arg(1);
|
||||
$time = func_get_arg(2);
|
||||
if (!isset($params['ship_id']) || !isset($params['qty'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$shipId = $params['ship_id'];
|
||||
$qty = $params['qty'];
|
||||
if (!isset($params['created_at'])) {
|
||||
$createdAt = time();
|
||||
} else {
|
||||
$createdAt = $params['created_at'];
|
||||
}
|
||||
if (!isset($params['updated_at'])) {
|
||||
$updatedAt = $createdAt;
|
||||
} else {
|
||||
$updatedAt = $params['updated_at'];
|
||||
}
|
||||
|
||||
return new Legacies_Empire_Model_Planet_Building_Shipyard_Item(array(
|
||||
'ship_id' => $shipId,
|
||||
'qty' => $qty,
|
||||
'created_at' => $time,
|
||||
'updated_at' => $time
|
||||
'created_at' => $createdAt,
|
||||
'updated_at' => $updatedAt
|
||||
));
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +121,7 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder
|
|||
);
|
||||
|
||||
if (in_array($shipId, array_keys($limitedElementsQty))) {
|
||||
foreach ($this->_queue as $element) {
|
||||
foreach ($this->getQueue() as $element) {
|
||||
if ($element['ship_id'] != $shipId) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -138,36 +151,26 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder
|
|||
public function getBuildingTime($shipId, $qty)
|
||||
{
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
$gameConfig = Legacies_Core_Model_Config::getSingleton();
|
||||
|
||||
Math::setPrecision(50);
|
||||
$buildingTime = Math::mul($prices[$shipId][Legacies_Empire::BASE_BUILDING_TIME], $qty);
|
||||
|
||||
// FIXME: Resource dependency
|
||||
$totalCost = Math::mul(Math::add($prices[$shipId][Legacies_Empire::RESOURCE_METAL], $prices[$shipId][Legacies_Empire::RESOURCE_CRISTAL]), $qty);
|
||||
$speedFactor = $gameConfig->getData('game_speed');
|
||||
|
||||
// FIXME: Building dependency
|
||||
$shipyardSpeedup = Math::div(1, Math::add($this->_currentPlanet[$fields[Legacies_Empire::ID_BUILDING_SHIPYARD]], 1));
|
||||
$naniteSpeedup = Math::pow(.5, $this->_currentPlanet[$fields[Legacies_Empire::ID_BUILDING_NANITE_FACTORY]]);
|
||||
$structuresSpeedup = Math::mul($shipyardSpeedup, $naniteSpeedup);
|
||||
|
||||
// FIXME: officers
|
||||
$officerSpeedup = 1;
|
||||
if ($types->is($shipId, Legacies_Empire::TYPE_SHIP)) {
|
||||
$officerSpeedup = 1 - ($this->_currentUser['rpg_technocrate'] * .05);
|
||||
} else if ($types->is($shipId, Legacies_Empire::TYPE_SPECIAL)) {
|
||||
$officerSpeedup = 1 - ($this->_currentUser['rpg_technocrate'] * .05);
|
||||
} else if ($types->is($shipId, Legacies_Empire::TYPE_DEFENSE)) {
|
||||
$officerSpeedup = 1 - ($this->_currentUser['rpg_defenseur'] * .375);
|
||||
}
|
||||
$baseTime = Math::div($buildingTime, $speedFactor);
|
||||
|
||||
Math::setPrecision();
|
||||
|
||||
$baseTime = ($totalCost / $speedFactor) * $structuresSpeedup;
|
||||
$event = Legacies::dispatchEvent('planet.shipyard.building-time', array(
|
||||
'time' => $baseTime,
|
||||
'base_time' => $baseTime,
|
||||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser,
|
||||
'ship_id' => $shipId,
|
||||
'qty' => $qty
|
||||
));
|
||||
|
||||
return (int) Math::floor($baseTime * $officerSpeedup * 3600);
|
||||
return $event->getData('time');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ class Legacies_Empire_Model_User
|
|||
|
||||
public static $hashCallback = 'md5';
|
||||
|
||||
protected $_homePlanet = null;
|
||||
protected $_currentPlanet = null;
|
||||
|
||||
const SESSION_KEY = 'user';
|
||||
const COOKIE_NAME = 'legacies';
|
||||
const COOKIE_LIFETIME = 2592000;
|
||||
|
|
@ -56,7 +59,7 @@ class Legacies_Empire_Model_User
|
|||
$session = Legacies::getSession(self::SESSION_KEY);
|
||||
if ($session->hasData('user_id')) {
|
||||
$id = intval($session->getData('user_id'));
|
||||
} else if (Legacies::$request !== null && ($cookie = Legacies::$request->getCookie(self::$_cookieName)) !== null) {
|
||||
} else if (Legacies::getRequest() !== null && ($cookie = Legacies::getRequest()->getCookie(self::$_cookieName)) !== null) {
|
||||
$cookieData = unserialize(stripslashes($cookie));
|
||||
if (is_array($cookieData)) {
|
||||
$collection = new Legacies_Core_Collection(array('user' => 'users'));
|
||||
|
|
@ -164,7 +167,7 @@ class Legacies_Empire_Model_User
|
|||
|
||||
if (intval($login['login_success']) == 1) {
|
||||
if ($login['banaday'] != 0) {
|
||||
if($login['banaday'] <= time() && $login['banaday'] != '0') {
|
||||
if($login['banaday'] <= time()) {
|
||||
$user->setData('banaday', 0)
|
||||
->setData('bana', 0)
|
||||
->setData('urlaubs_modus', 0)
|
||||
|
|
@ -176,7 +179,7 @@ class Legacies_Empire_Model_User
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($_POST["rememberme"]) && Legacies::$request !== null) {
|
||||
if (isset($_POST["rememberme"]) && Legacies::getRequest() !== null) {
|
||||
Legacies::$response->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
|
||||
}
|
||||
|
||||
|
|
@ -195,11 +198,18 @@ class Legacies_Empire_Model_User
|
|||
public static function register($username, $email, $password)
|
||||
{
|
||||
try {
|
||||
$request = Legacies::getRequest();
|
||||
$user = new self(array(
|
||||
'username' => $username,
|
||||
'password' => md5($password),
|
||||
'email' => $email,
|
||||
'email_2' => $email
|
||||
'email_2' => $email,
|
||||
|
||||
'register_time' => Legacies::now(),
|
||||
'onlinetime' => Legacies::now(),
|
||||
'ip_at_reg' => $request->getServer('REMOTE_ADDR'),
|
||||
'user_lastip' => $request->getServer('REMOTE_ADDR'),
|
||||
'user_agent' => $request->getServer('HTTP_USER_AGENT')
|
||||
));
|
||||
|
||||
$user->save();
|
||||
|
|
@ -210,6 +220,7 @@ class Legacies_Empire_Model_User
|
|||
|
||||
$user->save();
|
||||
} catch (Legacies_Core_Model_Exception $e) {
|
||||
echo $e->getTraceAsString();
|
||||
$session->addError($e->getMessage());
|
||||
return null;
|
||||
}
|
||||
|
|
@ -225,7 +236,7 @@ class Legacies_Empire_Model_User
|
|||
public function updateCurrentPlanet($planet)
|
||||
{
|
||||
if (!$planetId instanceof Legacies_Empire_Model_Planet) {
|
||||
$planetColelction = $this->_preparePlanetCollection()->where('id=:id');
|
||||
$planetCollection = $this->_preparePlanetCollection()->where('id=:id');
|
||||
|
||||
$planetCollection->load(array(
|
||||
'id' => $planet,
|
||||
|
|
@ -248,6 +259,23 @@ class Legacies_Empire_Model_User
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @param Legacies_Empire_Model_Planet $planet
|
||||
*/
|
||||
public function setHomePlanet(Legacies_Empire_Model_Planet $planet)
|
||||
{
|
||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$this->setData('id_planet', $planet->getId());
|
||||
$this->_homePlanet = $planet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
|
|
@ -260,6 +288,7 @@ class Legacies_Empire_Model_User
|
|||
}
|
||||
|
||||
$this->setData('current_planet', $planet->getId());
|
||||
$this->_currentPlanet = $planet;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -271,15 +300,19 @@ class Legacies_Empire_Model_User
|
|||
*/
|
||||
public function getHomePlanet()
|
||||
{
|
||||
$planetId = $this->getData('id_planet');
|
||||
if (!$planetId) {
|
||||
return null;
|
||||
}
|
||||
if ($this->_homePlanet === null) {
|
||||
$planetId = $this->getData('id_planet');
|
||||
if (!$planetId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$planet = Legacies_Empire_Model_Planet::factory($planetId);
|
||||
$planet = Legacies_Empire_Model_Planet::factory($planetId);
|
||||
|
||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
||||
return null;
|
||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->_homePlanet = $planet;
|
||||
}
|
||||
|
||||
return $planet;
|
||||
|
|
@ -292,22 +325,29 @@ class Legacies_Empire_Model_User
|
|||
*/
|
||||
public function getCurrentPlanet()
|
||||
{
|
||||
$planetId = $this->getData('current_planet');
|
||||
if ($this->_currentPlanet === null) {
|
||||
$planetId = $this->getData('current_planet');
|
||||
|
||||
if (!$planetId) {
|
||||
$planet = $this->getHomePlanet();
|
||||
$this->setData('current_planet', $planet->getId())->save();
|
||||
if (!$planetId) {
|
||||
$this->_currentPlanet = $this->getHomePlanet();
|
||||
$this->setData('current_planet', $this->_currentPlanet->getId())->save();
|
||||
|
||||
return $planet;
|
||||
return $this->_currentPlanet;
|
||||
}
|
||||
|
||||
$planet = Legacies_Empire_Model_Planet::factory($planetId);
|
||||
|
||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
||||
$this->_currentPlanet = $this->getHomePlanet();
|
||||
$this->setData('current_planet', $this->_currentPlanet->getId())->save();
|
||||
|
||||
return $this->_currentPlanet;
|
||||
}
|
||||
|
||||
$this->_currentPlanet = $planet;
|
||||
}
|
||||
|
||||
$planet = Legacies_Empire_Model_Planet::factory($planetId);
|
||||
|
||||
if ($planet->getUserId() != $this->getId() || $planet->isDestroyed()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $planet;
|
||||
return $this->_currentPlanet;
|
||||
}
|
||||
|
||||
protected function _preparePlanetCollection()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,237 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Test class for Legacies_Object.
|
||||
* Generated by PHPUnit on 2011-09-01 at 11:24:52.
|
||||
*/
|
||||
class Test_Legacies_Empire_Model_BuilderTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var Legacies_Empire_Model_Planet
|
||||
*/
|
||||
protected $_planet = null;
|
||||
|
||||
/**
|
||||
* @var Legacies_Empire_Model_User
|
||||
*/
|
||||
protected $_user = null;
|
||||
|
||||
protected $_class = 'Legacies_Empire_Model_BuilderAbstract';
|
||||
|
||||
protected $_queueItemsData = null;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_planet = new Legacies_Empire_Model_Planet(array(
|
||||
'id' => 1,
|
||||
'id_owner' => 1
|
||||
));
|
||||
|
||||
$this->_user = new Legacies_Empire_Model_User(array(
|
||||
'id' => 1
|
||||
));
|
||||
|
||||
$this->_planet->setUser($this->_user);
|
||||
|
||||
$this->_user->setCurrentPlanet($this->_planet);
|
||||
$this->_user->setHomePlanet($this->_planet);
|
||||
|
||||
$this->_queueItemsData = array(
|
||||
'IDX0001' => array(
|
||||
'item_id' => 1,
|
||||
'level' => 1,
|
||||
'created_at' => 0,
|
||||
'updated_at' => 0
|
||||
),
|
||||
'IDX0002' => array(
|
||||
'item_id' => 1,
|
||||
'level' => 2,
|
||||
'created_at' => 100,
|
||||
'updated_at' => 100
|
||||
),
|
||||
'IDX0003' => array(
|
||||
'item_id' => 1,
|
||||
'level' => 3,
|
||||
'created_at' => 150,
|
||||
'updated_at' => 150
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
protected function _getMockedInstance($planet, $user, $methods = array())
|
||||
{
|
||||
$reflector = new ReflectionClass($this->_class);
|
||||
|
||||
foreach ($reflector->getMethods() as $method) {
|
||||
if ($method->isAbstract()) {
|
||||
$methods[] = $method->getName();
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($methods)) {
|
||||
$methods = null;
|
||||
}
|
||||
|
||||
return $this->getMock($this->_class, $methods, array($planet, $user));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
public function testInit()
|
||||
{
|
||||
$stub = $this->getMockBuilder('Legacies_Empire_Model_BuilderAbstract')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('init', '_initItem', 'updateQueue', 'appendQueue', 'getResourcesNeeded', 'getBuildingTime'))
|
||||
->getMock();
|
||||
|
||||
$stub->expects($this->once())
|
||||
->method('init')
|
||||
->will($this->returnValue($stub));
|
||||
|
||||
$stub->expects($this->never())
|
||||
->method('_serializeQueue')
|
||||
->will($this->returnValue($stub));
|
||||
|
||||
$stub->expects($this->never())
|
||||
->method('_unserializeQueue')
|
||||
->will($this->returnValue($stub));
|
||||
|
||||
$stub->__construct($this->_planet, $this->_user);
|
||||
}
|
||||
|
||||
public function testSerializingQueue()
|
||||
{
|
||||
$items = array(
|
||||
'IDX0001' => array(
|
||||
'item_id' => 1,
|
||||
'level' => 1,
|
||||
'created_at' => 0,
|
||||
'updated_at' => 0
|
||||
),
|
||||
'IDX0002' => array(
|
||||
'item_id' => 1,
|
||||
'level' => 2,
|
||||
'created_at' => 100,
|
||||
'updated_at' => 100
|
||||
),
|
||||
'IDX0003' => array(
|
||||
'item_id' => 1,
|
||||
'level' => 3,
|
||||
'created_at' => 150,
|
||||
'updated_at' => 150
|
||||
)
|
||||
);
|
||||
|
||||
$stub = $this->_getMockedInstance($this->_planet, $this->_user, array('_generateIndex'));
|
||||
|
||||
$stub->expects($this->exactly(3))
|
||||
->method('_initItem')
|
||||
->will($this->onConsecutiveCalls(
|
||||
new Legacies_Empire_Model_Builder_Item($this->_queueItemsData['IDX0001']),
|
||||
new Legacies_Empire_Model_Builder_Item($this->_queueItemsData['IDX0002']),
|
||||
new Legacies_Empire_Model_Builder_Item($this->_queueItemsData['IDX0003'])
|
||||
));
|
||||
|
||||
$stub->expects($this->exactly(3))
|
||||
->method('_generateIndex')
|
||||
->will($this->onConsecutiveCalls(
|
||||
'IDX0001',
|
||||
'IDX0002',
|
||||
'IDX0003'
|
||||
));
|
||||
|
||||
$stub->enqueue($this->_queueItemsData['IDX0001']);
|
||||
$stub->enqueue($this->_queueItemsData['IDX0002']);
|
||||
$stub->enqueue($this->_queueItemsData['IDX0003']);
|
||||
|
||||
$this->assertEquals(serialize($this->_queueItemsData), $stub->serialize());
|
||||
}
|
||||
|
||||
public function testUnSerializingQueue()
|
||||
{
|
||||
$serializedData = serialize($this->_queueItemsData);
|
||||
|
||||
$stub = $this->_getMockedInstance($this->_planet, $this->_user, array('_generateIndex'));
|
||||
|
||||
$stub->expects($this->exactly(3))
|
||||
->method('_initItem')
|
||||
->will($this->onConsecutiveCalls(
|
||||
new Legacies_Empire_Model_Builder_Item($this->_queueItemsData['IDX0001']),
|
||||
new Legacies_Empire_Model_Builder_Item($this->_queueItemsData['IDX0002']),
|
||||
new Legacies_Empire_Model_Builder_Item($this->_queueItemsData['IDX0003'])
|
||||
));
|
||||
|
||||
$stub->expects($this->never())
|
||||
->method('_generateIndex');
|
||||
|
||||
$stub->unserialize($serializedData);
|
||||
|
||||
$this->assertAttributeNotEmpty('_queue', $stub);
|
||||
|
||||
$this->assertEquals(serialize($this->_queueItemsData), $stub->serialize());
|
||||
}
|
||||
|
||||
public function testUnSerializingQueueWithInvalidData()
|
||||
{
|
||||
$serializedData = '';
|
||||
|
||||
$stub = $this->_getMockedInstance($this->_planet, $this->_user, array('_generateIndex'));
|
||||
|
||||
$stub->expects($this->never())
|
||||
->method('_initItem');
|
||||
|
||||
$stub->expects($this->never())
|
||||
->method('_generateIndex');
|
||||
|
||||
$stub->unserialize($serializedData);
|
||||
|
||||
$this->assertAttributeEmpty('_queue', $stub);
|
||||
|
||||
$this->assertEquals('a:0:{}', $stub->serialize());
|
||||
}
|
||||
|
||||
public function testInitItemReturningNull()
|
||||
{
|
||||
$serializedData = serialize($this->_queueItemsData);
|
||||
|
||||
$stub = $this->_getMockedInstance($this->_planet, $this->_user, array('_generateIndex'));
|
||||
|
||||
$stub->expects($this->exactly(3))
|
||||
->method('_initItem')
|
||||
->will($this->returnValue(null));
|
||||
|
||||
$stub->unserialize($serializedData);
|
||||
|
||||
$this->assertAttributeEmpty('_queue', $stub);
|
||||
|
||||
$this->assertEquals('a:0:{}', $stub->serialize());
|
||||
}
|
||||
|
||||
public function testCheckAvailability()
|
||||
{
|
||||
$serializedData = serialize($this->_queueItemsData);
|
||||
|
||||
$stub = $this->_getMockedInstance($this->_planet, $this->_user, array('_generateIndex'));
|
||||
|
||||
$stub->expects($this->any())
|
||||
->method('_initItem')
|
||||
->will($this->onConsecutiveCalls(
|
||||
new Legacies_Empire_Model_Builder_Item($this->_queueItemsData['IDX0001'])
|
||||
));
|
||||
|
||||
$this->assertTrue($stub->checkAvailability(Legacies_Empire::ID_BUILDING_METAL_MINE));
|
||||
$this->assertTrue($stub->checkAvailability(Legacies_Empire::ID_BUILDING_CRISTAL_MINE));
|
||||
$this->assertTrue($stub->checkAvailability(Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER));
|
||||
$this->assertTrue($stub->checkAvailability(Legacies_Empire::ID_BUILDING_FUSION_REACTOR));
|
||||
}
|
||||
}
|
||||
205
includes/application/code/core/Test/Legacies/ObjectTest.php
Normal file
205
includes/application/code/core/Test/Legacies/ObjectTest.php
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Test class for Legacies_Object.
|
||||
* Generated by PHPUnit on 2011-09-01 at 11:24:52.
|
||||
*/
|
||||
class Test_Legacies_ObjectTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var Legacies_Object
|
||||
*/
|
||||
protected $_object;
|
||||
|
||||
/**
|
||||
* Sets up the fixture, for example, opens a network connection.
|
||||
* This method is called before a test is executed.
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_object = new Legacies_Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tears down the fixture, for example, closes a network connection.
|
||||
* This method is called after a test is executed.
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testSetData().
|
||||
*/
|
||||
public function testSetData()
|
||||
{
|
||||
$this->assertAttributeEmpty('_data', $this->_object);
|
||||
|
||||
$this->_object->setData('test', true);
|
||||
$expected = array('test' => true);
|
||||
$this->assertAttributeEquals($expected, '_data', $this->_object);
|
||||
|
||||
$this->_object->setData('test', 'testing');
|
||||
$expected = array('test' => 'testing');
|
||||
$this->assertAttributeEquals($expected, '_data', $this->_object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testSetData
|
||||
*/
|
||||
public function testGetData()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
|
||||
$this->assertEquals('testing', $this->_object->getData('test'));
|
||||
|
||||
$this->_object->setData('test', true);
|
||||
$this->assertTrue($this->_object->getData('test'));
|
||||
|
||||
$this->assertNull($this->_object->getData('testing'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testSetData
|
||||
* @requires testGetData
|
||||
*/
|
||||
public function testGetAllDatas()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
|
||||
$expected = array('test' => 'testing');
|
||||
$this->assertEquals($expected, $this->_object->getAllDatas());
|
||||
|
||||
$this->_object->setData('test', true);
|
||||
$expected = array('test' => true);
|
||||
$this->assertEquals($expected, $this->_object->getAllDatas());
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testSetData
|
||||
* @requires testGetData
|
||||
*/
|
||||
public function testHasData()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
|
||||
$this->assertTrue($this->_object->hasData('test'));
|
||||
$this->assertFalse($this->_object->hasData('testing'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testSetData
|
||||
*/
|
||||
public function testAddData()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
|
||||
$expected = array(
|
||||
'test' => 'testing',
|
||||
'testing' => true,
|
||||
'legacies' => false
|
||||
);
|
||||
|
||||
$this->_object->addData(array(
|
||||
'testing' => true,
|
||||
'legacies' => false
|
||||
));
|
||||
$this->assertAttributeEquals($expected, '_data', $this->_object);
|
||||
|
||||
$expected = array(
|
||||
'test' => 'legacies',
|
||||
'testing' => false,
|
||||
'legacies' => 'Legacies_Object'
|
||||
);
|
||||
|
||||
$this->_object->addData($expected);
|
||||
$this->assertAttributeEquals($expected, '_data', $this->_object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testSetData
|
||||
*/
|
||||
public function testUnsetData()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
$this->_object->setData('testing', true);
|
||||
$this->_object->setData('removed', 'me!');
|
||||
$this->_object->setData('legacies', false);
|
||||
|
||||
$expected = array(
|
||||
'test' => 'testing',
|
||||
'testing' => true,
|
||||
'legacies' => false
|
||||
);
|
||||
|
||||
$this->_object->unsetData('removed');
|
||||
$this->assertAttributeEquals($expected, '_data', $this->_object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Implement testClearData().
|
||||
*/
|
||||
public function testClearData()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
$this->_object->setData('testing', true);
|
||||
$this->_object->setData('removed', 'me!');
|
||||
$this->_object->setData('legacies', false);
|
||||
|
||||
$expected = array(
|
||||
'test' => 'testing',
|
||||
'testing' => true,
|
||||
'legacies' => false
|
||||
);
|
||||
|
||||
$this->_object->clearData();
|
||||
$this->assertAttributeEmpty('_data', $this->_object);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testSetData
|
||||
* @requires testHasData
|
||||
*/
|
||||
public function testOffsetExists()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
|
||||
$this->assertTrue(isset($this->_object['test']));
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testSetData
|
||||
* @requires testGetData
|
||||
*/
|
||||
public function testOffsetGet()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
|
||||
$this->assertEquals('testing', $this->_object['test']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testGetData
|
||||
* @requires testSetData
|
||||
*/
|
||||
public function testOffsetSet()
|
||||
{
|
||||
$this->_object['test'] = 'testing';
|
||||
|
||||
$this->assertEquals('testing', $this->_object->getData('test'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires testSetData
|
||||
* @requires testGetData
|
||||
*/
|
||||
public function testOffsetUnset()
|
||||
{
|
||||
$this->_object->setData('test', 'testing');
|
||||
|
||||
unset($this->_object['test']);
|
||||
|
||||
$this->assertAttributeEmpty('_data', $this->_object);
|
||||
$this->assertNull($this->_object->getData('test'));
|
||||
}
|
||||
}
|
||||
119
includes/application/code/core/Test/LegaciesTest.php
Normal file
119
includes/application/code/core/Test/LegaciesTest.php
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
class Test_LegaciesTest
|
||||
extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function tearDown()
|
||||
{
|
||||
Legacies::clearAllListeners();
|
||||
}
|
||||
|
||||
public function nonStaticListener($observer)
|
||||
{
|
||||
$observer->setData('success', true);
|
||||
}
|
||||
|
||||
public static function staticListener($observer)
|
||||
{
|
||||
$observer->setData('success', true);
|
||||
}
|
||||
|
||||
public function testRegisteringNonStaticEvent()
|
||||
{
|
||||
Legacies::registerListener('testing', array($this, 'nonStaticListener'));
|
||||
|
||||
$observer = Legacies::dispatchEvent('testing', array('success' => false));
|
||||
|
||||
$this->assertInstanceOf('Legacies_Core_Event', $observer);
|
||||
$this->assertTrue($observer->getData('success'));
|
||||
}
|
||||
|
||||
public function testRegisteringStaticEvent()
|
||||
{
|
||||
Legacies::registerListener('testing', array(get_class($this), 'staticListener'));
|
||||
|
||||
$observer = Legacies::dispatchEvent('testing', array('success' => false));
|
||||
|
||||
$this->assertInstanceOf('Legacies_Core_Event', $observer);
|
||||
$this->assertTrue($observer->getData('success'));
|
||||
}
|
||||
|
||||
public function testDispatchNonExistingEvent()
|
||||
{
|
||||
$observer = Legacies::dispatchEvent('testing', array('success' => true));
|
||||
|
||||
$this->assertInstanceOf('Legacies_Core_Event', $observer);
|
||||
$this->assertTrue($observer->getData('success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testRegisteringNonStaticEvent
|
||||
*/
|
||||
public function testUnregisteringNonStaticEvent()
|
||||
{
|
||||
Legacies::registerListener('testing', array($this, 'nonStaticListener'));
|
||||
|
||||
Legacies::clearEventListeners('testing');
|
||||
|
||||
$observer = Legacies::dispatchEvent('testing', array('success' => false));
|
||||
|
||||
$this->assertInstanceOf('Legacies_Core_Event', $observer);
|
||||
$this->assertFalse($observer->getData('success'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testRegisteringStaticEvent
|
||||
*/
|
||||
public function testUnregisteringStaticEvent()
|
||||
{
|
||||
Legacies::registerListener('testing', array(get_class($this), 'staticListener'));
|
||||
|
||||
Legacies::clearEventListeners('testing');
|
||||
|
||||
$observer = Legacies::dispatchEvent('testing', array('success' => false));
|
||||
|
||||
$this->assertInstanceOf('Legacies_Core_Event', $observer);
|
||||
$this->assertFalse($observer->getData('success'));
|
||||
}
|
||||
|
||||
public function testGetSession()
|
||||
{
|
||||
$this->markTestSkipped('Sessions could not be tested in CLI.');
|
||||
$this->assertInstanceOf('Legacies_Core_Model_Session', Legacies::getSession('test'));
|
||||
}
|
||||
|
||||
public function testGetTranslator()
|
||||
{
|
||||
$this->assertInstanceOf('Legacies_Core_Model_Translator', Legacies::getTranslator('test'));
|
||||
|
||||
$this->assertInstanceOf('Legacies_Core_Model_Translator', Legacies::getTranslator());
|
||||
}
|
||||
|
||||
public function testTranslate()
|
||||
{
|
||||
$this->assertEquals('My testing message!', Legacies::translate('test', 'My %s message!', array('testing')));
|
||||
}
|
||||
|
||||
public function testTranslateGettextStyle()
|
||||
{
|
||||
$this->assertEquals('My testing message!', Legacies::__('My %s message!', 'testing'));
|
||||
}
|
||||
|
||||
public function testSetDefaultLocale()
|
||||
{
|
||||
Legacies::setDefaultLocale('test');
|
||||
|
||||
$this->assertAttributeEquals('test', '_defaultLocale', 'Legacies');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @requires testSetDefaultLocale
|
||||
*/
|
||||
public function testGetDefaultLocale()
|
||||
{
|
||||
Legacies::setDefaultLocale('test');
|
||||
|
||||
$this->assertEquals('test', Legacies::getDefaultLocale());
|
||||
}
|
||||
}
|
||||
66
includes/application/code/core/Test/bootstrap.php
Normal file
66
includes/application/code/core/Test/bootstrap.php
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
dirname(__DIR__),
|
||||
get_include_path()
|
||||
)));
|
||||
|
||||
function frameworkAutoload($class) {
|
||||
include_once str_replace('_', '/', $class) . '.php';
|
||||
}
|
||||
|
||||
spl_autoload_register('frameworkAutoload');
|
||||
|
||||
include 'vfsStream/vfsStream.php';
|
||||
|
||||
vfsStream::create(array(
|
||||
'includes' => array(
|
||||
'application' => array(
|
||||
'code' => array(
|
||||
'community' => array(),
|
||||
'core' => array(),
|
||||
'libraries' => array(),
|
||||
'local' => array(),
|
||||
),
|
||||
'design' => array(
|
||||
'layouts' => array(),
|
||||
'scripts' => array()
|
||||
)
|
||||
),
|
||||
'data' => array(
|
||||
'combat.php' => '<?php echo ' . var_export(array(), true),
|
||||
'events.php' => '<?php echo ' . var_export(array(), true),
|
||||
'fields-alias.php' => '<?php echo ' . var_export(array(), true),
|
||||
'prices.php' => '<?php echo ' . var_export(array(), true),
|
||||
'production.php' => '<?php echo ' . var_export(array(), true),
|
||||
'requirements.php' => '<?php echo ' . var_export(array(), true),
|
||||
'resources.php' => '<?php echo ' . var_export(array(), true),
|
||||
'types.php' => '<?php echo ' . var_export(array(), true),
|
||||
)
|
||||
),
|
||||
'config.php' => '<?php echo ' . var_export(array(
|
||||
'global' => array(
|
||||
'date' => array(
|
||||
'timezone' => 'Europe/Paris'
|
||||
),
|
||||
'database' => array(
|
||||
'engine' => 'mysql',
|
||||
'options' => array(
|
||||
'hostname' => 'localhost',
|
||||
'username' => 'root',
|
||||
'password' => '',
|
||||
'database' => 'db_xnova'
|
||||
),
|
||||
'table_prefix' => 'game_',
|
||||
),
|
||||
'layout' => array(
|
||||
'page' => 'page.php',
|
||||
'empire' => 'empire.php'
|
||||
)
|
||||
)
|
||||
), true) . ';'
|
||||
), 'root', 644);
|
||||
|
||||
define('ROOT_PATH', vfsStream::url(''));
|
||||
define('APPLICATION_PATH', vfsStream::url('includes/application'));
|
||||
|
||||
|
|
@ -83,6 +83,15 @@ class Math_Bcmath
|
|||
if (!$a) {
|
||||
return '0';
|
||||
}
|
||||
$negative = false;
|
||||
if ($a[0] == '-') {
|
||||
$a = substr($a, 1);
|
||||
$negative = true;
|
||||
}
|
||||
if ($a[0] == '+') {
|
||||
$a = substr($a, 1);
|
||||
}
|
||||
|
||||
$a = strval($a);
|
||||
|
||||
$pos = strrpos($a, '.');
|
||||
|
|
@ -90,37 +99,38 @@ class Math_Bcmath
|
|||
$a = substr($a, 0, $pos);
|
||||
}
|
||||
|
||||
$length = $pos + ((3 - ($pos % 3)) % 3);
|
||||
$a = str_pad($a, $length, ' ', STR_PAD_LEFT);
|
||||
$length = (3 - (strlen($a) % 3)) % 3;
|
||||
$a = str_pad($a, $length + strlen($a), ' ', STR_PAD_LEFT);
|
||||
$parts = str_split($a, 3);
|
||||
$parts[0] = ltrim($parts[0]);
|
||||
switch ((int) (count($parts) / 3)) {
|
||||
case 0:
|
||||
case 1:
|
||||
return implode('.', $parts);
|
||||
return ($negative ? '-' : '') . implode('.', $parts);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'M';
|
||||
return ($negative ? '-' : '') . implode('.', array_slice($parts, 0, 2)) . 'M';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'G';
|
||||
return ($negative ? '-' : '') . implode('.', array_slice($parts, 0, 2)) . 'G';
|
||||
break;
|
||||
|
||||
case 4:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'T';
|
||||
return ($negative ? '-' : '') . implode('.', array_slice($parts, 0, 2)) . 'T';
|
||||
break;
|
||||
|
||||
case 5:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'P';
|
||||
return ($negative ? '-' : '') . implode('.', array_slice($parts, 0, 2)) . 'P';
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'Y';
|
||||
return ($negative ? '-' : '') . implode('.', array_slice($parts, 0, 2)) . 'Y';
|
||||
break;
|
||||
|
||||
default:
|
||||
return implode('.', array_slice($parts, 0, sizeof($parts) - 18)) . 'Z';
|
||||
return ($negative ? '-' : '') . implode('.', array_slice($parts, 0, sizeof($parts) - 18)) . 'Z';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,77 @@
|
|||
<?php return array(
|
||||
'empire' => array(
|
||||
'update' => '2columns-left',
|
||||
'reference' => array(
|
||||
'navigation' => array(
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'setNodeTitle',
|
||||
'params' => array(
|
||||
'path' => 'development',
|
||||
'title' => 'Development'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addLink',
|
||||
'params' => array(
|
||||
'name' => 'development/overview',
|
||||
'label' => 'Overview',
|
||||
'title' => 'Overview',
|
||||
'uri' => 'overview.php'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addLink',
|
||||
'params' => array(
|
||||
'name' => 'development/buildings',
|
||||
'label' => 'Buildings',
|
||||
'title' => 'Buildings',
|
||||
'uri' => 'overview.php'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addLink',
|
||||
'params' => array(
|
||||
'name' => 'development/research-lab',
|
||||
'label' => 'Research Lab',
|
||||
'title' => 'Research Lab',
|
||||
'uri' => 'overview.php',
|
||||
'params' => array(
|
||||
'mode' => 'research'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addLink',
|
||||
'params' => array(
|
||||
'name' => 'development/shipyard',
|
||||
'label' => 'Shipyard',
|
||||
'title' => 'Shipyard',
|
||||
'uri' => 'overview.php',
|
||||
'params' => array(
|
||||
'mode' => 'fleet'
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addLink',
|
||||
'params' => array(
|
||||
'name' => 'development/defenses',
|
||||
'label' => 'Defenses',
|
||||
'title' => 'Defenses',
|
||||
'uri' => 'overview.php',
|
||||
'params' => array(
|
||||
'mode' => 'defense'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
'overview' => array(
|
||||
'update' => '1column',
|
||||
'update' => 'empire',
|
||||
'reference' => array(
|
||||
'content' => array(
|
||||
'children' => array(
|
||||
|
|
@ -12,6 +83,8 @@
|
|||
'template' => 'empire/overview.phtml'
|
||||
),
|
||||
)
|
||||
),
|
||||
'left' => array(
|
||||
)
|
||||
)
|
||||
),
|
||||
|
|
@ -45,7 +118,7 @@
|
|||
),
|
||||
|
||||
'planet.buildings' => array(
|
||||
'update' => '1column',
|
||||
'update' => 'empire',
|
||||
'reference' => array(
|
||||
'content' => array(
|
||||
'children' => array(
|
||||
|
|
@ -54,16 +127,44 @@
|
|||
'template' => 'empire/topnav.phtml',
|
||||
),
|
||||
'queue' => array(
|
||||
'type' => 'core/template',
|
||||
'template' => 'empire/planet/buildings/queue.phtml'
|
||||
'type' => 'empire/planet.buildings.queue',
|
||||
'template' => 'empire/planet/buildings/queue.phtml',
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'setItemTemplate',
|
||||
'params' => array(
|
||||
'template' => 'empire/planet/buildings/queue/item.phtml'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'setItemBlockType',
|
||||
'params' => array(
|
||||
'blockType' => 'empire/planet.buildings.queue.item'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
'item-list' => array(
|
||||
'type' => 'core/template',
|
||||
'type' => 'empire/planet.buildings',
|
||||
'template' => 'empire/planet/buildings.phtml',
|
||||
'children' => array(
|
||||
'item-list.items' => array(
|
||||
'type' => 'core/concat'
|
||||
),
|
||||
),
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'setItemTemplate',
|
||||
'params' => array(
|
||||
'template' => 'empire/planet/buildings/item.phtml'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'setItemBlockType',
|
||||
'params' => array(
|
||||
'blockType' => 'empire/planet.buildings.item'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
)
|
||||
|
|
@ -72,7 +173,7 @@
|
|||
),
|
||||
|
||||
'planet.shipyard' => array(
|
||||
'update' => '1column',
|
||||
'update' => 'empire',
|
||||
'reference' => array(
|
||||
'content' => array(
|
||||
'children' => array(
|
||||
|
|
@ -81,20 +182,119 @@
|
|||
'template' => 'empire/topnav.phtml',
|
||||
),
|
||||
'item-list' => array(
|
||||
'type' => 'core/template',
|
||||
'type' => 'empire/planet.shipyard',
|
||||
'template' => 'empire/planet/shipyard.phtml',
|
||||
'children' => array(
|
||||
'item-list.items' => array(
|
||||
'type' => 'core/concat'
|
||||
),
|
||||
),
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'setItemTemplate',
|
||||
'params' => array(
|
||||
'template' => 'empire/planet/shipyard/item.phtml'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'setItemBlockType',
|
||||
'params' => array(
|
||||
'blockType' => 'empire/planet.shipyard.item'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'queue' => array(
|
||||
'type' => 'core/template',
|
||||
'template' => 'empire/planet/shipyard/queue.phtml'
|
||||
'type' => 'empire/planet.shipyard.queue',
|
||||
'template' => 'empire/planet/shipyard/queue.phtml',
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'setItemTemplate',
|
||||
'params' => array(
|
||||
'template' => 'empire/planet/shipyard/queue/item.phtml'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'setItemBlockType',
|
||||
'params' => array(
|
||||
'blockType' => 'empire/planet.shipyard.queue.item'
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
'planet.defense' => array(
|
||||
'update' => 'planet.shipyard',
|
||||
'reference' => array(
|
||||
'item-list' => array(
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'setType',
|
||||
'params' => array(
|
||||
'type' => Legacies_Empire::TYPE_DEFENSE
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
'planet.research-lab' => array(
|
||||
'update' => 'empire',
|
||||
'reference' => array(
|
||||
'content' => array(
|
||||
'children' => array(
|
||||
'topnav' => array(
|
||||
'type' => 'empire/topnav',
|
||||
'template' => 'empire/topnav.phtml',
|
||||
),
|
||||
'item-list' => array(
|
||||
'type' => 'empire/planet.research-lab',
|
||||
'template' => 'empire/planet/research-lab.phtml',
|
||||
'children' => array(
|
||||
'item-list.items' => array(
|
||||
'type' => 'core/concat'
|
||||
),
|
||||
),
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'setItemTemplate',
|
||||
'params' => array(
|
||||
'template' => 'empire/planet/research-lab/item.phtml'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'setItemBlockType',
|
||||
'params' => array(
|
||||
'blockType' => 'empire/planet.research-lab.item'
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
'queue' => array(
|
||||
'type' => 'empire/planet.research-lab.queue',
|
||||
'template' => 'empire/planet/research-lab/queue.phtml',
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'setItemTemplate',
|
||||
'params' => array(
|
||||
'template' => 'empire/planet/research-lab/queue/item.phtml'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'setItemBlockType',
|
||||
'params' => array(
|
||||
'blockType' => 'empire/planet.research-lab.queue.item'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,14 @@
|
|||
'root' => array(
|
||||
'children' => array(
|
||||
'left' => array(
|
||||
'type' => 'core/concat'
|
||||
),
|
||||
'type' => 'core/concat',
|
||||
'children' => array(
|
||||
'navigation' => array(
|
||||
'type' => 'core/html.navigation',
|
||||
'template' => 'page/html/navigation.phtml'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -59,13 +65,19 @@
|
|||
array(
|
||||
'method' => 'addCss',
|
||||
'params' => array(
|
||||
'stylesheet' => 'css/default.css'
|
||||
'stylesheet' => 'css/deprecated/default.css'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addCss',
|
||||
'params' => array(
|
||||
'stylesheet' => 'css/formate.css'
|
||||
'stylesheet' => 'css/deprecated/formate.css'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addCss',
|
||||
'params' => array(
|
||||
'stylesheet' => 'css/legacies.css'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
@ -130,5 +142,65 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
'login' => array(
|
||||
'update' => '1column',
|
||||
'reference' => array(
|
||||
'content' => array(
|
||||
'children' => array(
|
||||
'login' => array(
|
||||
'type' => 'core/template',
|
||||
'template' => 'user/login.phtml'
|
||||
),
|
||||
)
|
||||
),
|
||||
'head' => array(
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'addCss',
|
||||
'params' => array(
|
||||
'stylesheet' => 'css/deprecated/styles.css'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addCss',
|
||||
'params' => array(
|
||||
'stylesheet' => 'css/deprecated/about.css'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
'registration' => array(
|
||||
'update' => '1column',
|
||||
'reference' => array(
|
||||
'content' => array(
|
||||
'children' => array(
|
||||
'registration' => array(
|
||||
'type' => 'core/template',
|
||||
'template' => 'user/registration.phtml'
|
||||
),
|
||||
)
|
||||
),
|
||||
'head' => array(
|
||||
'actions' => array(
|
||||
array(
|
||||
'method' => 'addCss',
|
||||
'params' => array(
|
||||
'stylesheet' => 'css/deprecated/styles.css'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'method' => 'addCss',
|
||||
'params' => array(
|
||||
'stylesheet' => 'css/deprecated/about.css'
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,68 +0,0 @@
|
|||
<div id="main">
|
||||
<script type="text/javascript">
|
||||
var lastType = "";
|
||||
function changeAction(type) {
|
||||
if (document.formular.Uni.value == '') {
|
||||
alert('<?php echo $this->getData('log_univ')?>');
|
||||
} else {
|
||||
if(type == "login" && lastType == "") {
|
||||
var url = "http://" + document.formular.Uni.value + "";
|
||||
document.formular.action = url;
|
||||
} else {
|
||||
var url = "http://" + document.formular.Uni.value + "/reg.php";
|
||||
document.formular.action = url;
|
||||
document.formular.submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div id="login">
|
||||
<div id="login_input">
|
||||
<form name="formular" action="" method="post" onsubmit="changeAction('login');">
|
||||
<table width="400" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top;">
|
||||
<td style="padding-right: 4px;">
|
||||
<?php echo $this->getData('User_name')?> <input name="username" value="" type="text">
|
||||
<?php echo $this->getData('Password')?> <input name="password" value="" type="password">
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td style="padding-right: 4px;">
|
||||
<?php echo $this->getData('Remember_me')?> <input name="rememberme" type="checkbox"> <script type="text/javascript">document.formular.Uni.focus(); </script><input name="submit" value="<?php echo $this->getData('Login')?>" type="submit">
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td style="padding-right: 4px;">
|
||||
<a href="lostpassword.php"><?php echo $this->getData('PasswordLost')?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mainmenu" style="margin-top: 20px;">
|
||||
<a href="reg.php"><?php echo $this->getData('log_reg')?></a>
|
||||
<a href="<?php echo $this->getData('forum_url')?>">Forum</a>
|
||||
<a href="contact.php">Contact</a>
|
||||
</div>
|
||||
<div id="rightmenu" class="rightmenu">
|
||||
<div id="title"><?php echo $this->getData('log_welcome')?> <?php echo $this->getData('servername')?></div>
|
||||
<div id="content">
|
||||
<center>
|
||||
<div id="text1">
|
||||
<div style="text-align: left;"><strong><?php echo $this->getData('servername')?></strong> <?php echo $this->getData('log_desc')?> <?php echo $this->getData('servername')?>.
|
||||
</div>
|
||||
</div>
|
||||
<div id="register" class="bigbutton" onclick="document.location.href='reg.php';"><font color="#cc0000"><?php echo $this->getData('log_toreg')?></font></div>
|
||||
<div id="text2">
|
||||
<div id="text3">
|
||||
<center><b><font color="#00cc00"><?php echo $this->getData('log_online')?>: </font>
|
||||
<font color="#c6c7c6"><?php echo $this->getData('online_users')?></font> - <font color="#00cc00"><?php echo $this->getData('log_lastreg')?>: </font>
|
||||
<font color="#c6c7c6"><?php echo $this->getData('last_user')?></font> - <font color="#00cc00"><?php echo $this->getData('log_numbreg')?>:</font> <font color="#c6c7c6"><?php echo $this->getData('users_amount')?></font>
|
||||
</b></center>
|
||||
</div>
|
||||
</div>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
<tr><td class="c" colspan="4"><a href="overview.php?action=rename" title="<?php echo $this->getData('Planet_menu')?>"><?php echo $this->getData('Planet')?> "<?php echo $this->getData('planet_name')?>"</a> (<?php echo $this->getData('user_username')?>)</td></tr>
|
||||
<?php echo $this->getData('Have_new_message')?>
|
||||
<?php echo $this->getData('Have_new_level_mineur')?>
|
||||
<?php echo $this->getData('Have_new_level_raid')?>
|
||||
<?php //echo $this->getData('Have_new_level_raid')?>
|
||||
<tr><th><?php echo $this->getData('Server_time')?></th>
|
||||
<th colspan="3"><div id="dateheure"></div></th></tr>
|
||||
<tr><th><?php echo $this->getData('MembersOnline')?></th>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<th colspan="2"><img src="<?php echo $this->getData('dpath')?>graphics/planeten/<?php echo $this->getData('planet_image')?>.jpg" height="200" width="200"><br><?php echo $this->getData('building')?></th>
|
||||
<th class="s"><table class="s" align="top" border="0"><tr><?php echo $this->getData('anothers_planets')?></tr></table></th></tr>
|
||||
<tr><th><?php echo $this->getData('Diameter')?></th>
|
||||
<th colspan="3"><?php echo $this->getData('planet_diameter')?> km (<a title="<?php echo $this->getData('Developed_fields')?>"><?php echo $this->getData('planet_field_current')?></a> / <a title="<?php echo $this->getData('max_eveloped_fields')?>"><?php echo $this->getData('planet_field_max')?></a> <?php echo $this->getData('fields')?>)</th></tr>
|
||||
<th colspan="3"><?php echo $this->getData('planet_diameter')?> km (<a title="<?php echo $this->getData('Developed_fields')?>"><?php echo $this->getData('planet_field_current')?></a> / <a title="<?php echo $this->getData('max_developed_fields')?>"><?php echo $this->getData('planet_field_max')?></a> <?php echo $this->getData('fields')?>)</th></tr>
|
||||
<th><?php echo $this->getData('Developed_fields')?></th>
|
||||
<th colspan="3" align="center"><div style="border: 1px solid rgb(153, 153, 255); width: 400px;"><div id="CaseBarre" style="background-color: <?php echo $this->getData('case_barre_barcolor')?>; width: <?php echo $this->getData('case_barre')?>%;"><font color="#CCF19F"><?php echo $this->getData('case_pourcentage')?></font></div></th>
|
||||
<tr><tr><th><?php echo $this->getData('ov_off_level')?></th><th colspan="3" align="center"><table border="0" width="100%"><tbody><tr>
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
<?php
|
||||
|
|
@ -1 +0,0 @@
|
|||
<span>Hello world!!</span>
|
||||
|
|
@ -1,20 +1,4 @@
|
|||
<div class="shipyard">
|
||||
<div class="buildings item-list">
|
||||
<h1><?php echo $this->__('Buildings')?></h1>
|
||||
<form action="<?php echo $this->getUrl('buildings.php')?>" method="post">
|
||||
<dl>
|
||||
<?php echo $this->getPartial('item-list.items')->render()?>
|
||||
</dl>
|
||||
<input type="submit" value="<?php echo $this->__('Build')?>">
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
/*<![CDATA[*/
|
||||
(function($){
|
||||
$(document).ready(function(){
|
||||
$('.shipyard .buy .max').click(function(){
|
||||
$('#' + this.rel).val($('#' + this.rel + ':max').val());
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
/*]]>*/
|
||||
</script>
|
||||
<?php echo $this->getPartial('item-list.items')->render()?>
|
||||
</div>
|
||||
|
|
@ -1,18 +1,27 @@
|
|||
<?php /** @var Legacies_Core_Block_Template $this */?>
|
||||
<dt>
|
||||
<div class="item title">
|
||||
<h2><a href="<?php echo $this->getItemInfoUrl()?>"><?php echo $this->escape($this->getName())?></a> (<?php echo $this->renderNumber($this->getLevel())?>)</h2>
|
||||
</dt>
|
||||
<dd>
|
||||
</div>
|
||||
<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="details">
|
||||
<p><?php echo $this->getDescription()?></p>
|
||||
<ul>
|
||||
<?php foreach ($this->getResourcesNeeded() as $resourceId => $resourceValue):?>
|
||||
<li><span class="resource"><?php echo $this->getResourceName($resourceId)?></span><span class="cost"><?php echo $this->renderNumber($resourceValue)?></span></li>
|
||||
<?php foreach ($this->getResourcesConfigForNextLevel() as $resourceId => $resourceConfig):?>
|
||||
<li class="resource">
|
||||
<span class="label"><?php echo $this->getResourceName($resourceId)?></span>
|
||||
<span class="cost<?php if ($resourceConfig->hasData('requirement')):?> capped<?php endif?>"><?php echo $this->renderNumber($resourceConfig->getData('value'))?></span>
|
||||
<?php if ($resourceConfig->hasData('requirement')):?>
|
||||
<span class="requirement">(<?php echo $this->renderNumber($resourceConfig->getData('requirement'))?>)</span>
|
||||
<?php else:?>
|
||||
<span class="overflow">(<?php echo $this->renderNumber($resourceConfig->getData('overflow'))?>)</span>
|
||||
<?php endif?>
|
||||
</li>
|
||||
<?php endforeach?>
|
||||
</ul>
|
||||
<p><?php echo $this->__('Building time: %s', $this->renderTime($this->getBuildingTimeForNextLevel(), true))?>
|
||||
</div>
|
||||
<div class="buy">
|
||||
<p><a class="build" href="<?php echo $this->getUrl('buildings.php', array('building' => $this->getItemId()))?>"><?php echo $this->__('Build next level (%s)', $this->renderNumber($this->getLevel() + 1))?></a></p>
|
||||
<p><a class="build" href="<?php echo $this->getUrl('buildings.php', array('building' => $this->getItemId()))?>"><?php echo $this->__('Build next level (%s)', $this->renderNumber($this->getNextLevel()))?></a></p>
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
|
@ -1 +1,6 @@
|
|||
<?php
|
||||
<?php if (!$this->isEmpty()):?>
|
||||
<div class="building queue">
|
||||
<h1><?php echo $this->__('Work in progress')?></h1>
|
||||
<?php echo $this->getPartial('item-list')->render() ?>
|
||||
</div>
|
||||
<?php endif?>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?php /** @var Legacies_Core_Block_Template $this */?>
|
||||
<div class="item queue">
|
||||
<a href="<?php echo $this->getItemInfoUrl()?>" class="image"><img src="<?php echo $this->getItemImageUrl()?>" alt="" width="30" height="30" /></a>
|
||||
<a href="<?php echo $this->getItemInfoUrl()?>"><?php echo $this->escape($this->getName())?></a> (<?php echo $this->renderNumber($this->getItemQueuedLevel())?>)
|
||||
<div class="cancel">
|
||||
<p><a class="build" href="<?php echo $this->getUrl('buildings.php', array('cancel' => $this->getItem()->getIndex()))?>"><?php echo $this->__('Cancel')?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<div class="shipyard item-list">
|
||||
<h1><?php echo $this->__('Research Laboratory')?></h1>
|
||||
<?php echo $this->getPartial('item-list.items')->render()?>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php /** @var Legacies_Core_Block_Template $this */?>
|
||||
<div class="item title">
|
||||
<h2><a href="<?php echo $this->getItemInfoUrl()?>"><?php echo $this->escape($this->getName())?></a> (<?php echo $this->renderNumber($this->getLevel())?>)</h2>
|
||||
</div>
|
||||
<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="details">
|
||||
<p><?php echo $this->getDescription()?></p>
|
||||
<ul>
|
||||
<?php foreach ($this->getResourcesConfigForNextLevel() as $resourceId => $resourceConfig):?>
|
||||
<li class="resource">
|
||||
<span class="label"><?php echo $this->getResourceName($resourceId)?></span>
|
||||
<span class="cost<?php if ($resourceConfig->hasData('requirement')):?> capped<?php endif?>"><?php echo $this->renderNumber($resourceConfig->getData('value'))?></span>
|
||||
<?php if ($resourceConfig->hasData('requirement')):?>
|
||||
<span class="requirement">(<?php echo $this->renderNumber($resourceConfig->getData('requirement'))?>)</span>
|
||||
<?php else:?>
|
||||
<span class="overflow">(<?php echo $this->renderNumber($resourceConfig->getData('overflow'))?>)</span>
|
||||
<?php endif?>
|
||||
</li>
|
||||
<?php endforeach?>
|
||||
</ul>
|
||||
<p><?php echo $this->__('Building time: %s', $this->renderTime($this->getBuildingTime(1), false))?>
|
||||
</div>
|
||||
<div class="buy">
|
||||
<p><a class="build" href="<?php echo $this->getUrl('buildings.php', array('building' => $this->getItemId(), 'mode' => 'research'))?>"><?php echo $this->__('Build next level (%s)', $this->renderNumber($this->getNextLevel()))?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php if (!$this->isEmpty()):?>
|
||||
<div class="building queue">
|
||||
<h1><?php echo $this->__('Work in progress')?></h1>
|
||||
<?php echo $this->getPartial('item-list')->render() ?>
|
||||
</div>
|
||||
<?php endif?>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?php /** @var Legacies_Core_Block_Template $this */?>
|
||||
<div class="item queue">
|
||||
<a href="<?php echo $this->getItemInfoUrl()?>" class="image"><img src="<?php echo $this->getItemImageUrl()?>" alt="" width="30" height="30" /></a>
|
||||
<a href="<?php echo $this->getItemInfoUrl()?>"><?php echo $this->escape($this->getName())?></a> (<?php echo $this->renderNumber($this->getItemQueuedLevel())?>)
|
||||
<div class="cancel">
|
||||
<p><a class="build" href="<?php echo $this->getUrl('buildings.php', array('cancel' => $this->getItem()->getIndex()))?>"><?php echo $this->__('Cancel')?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<div class="shipyard">
|
||||
<div class="shipyard item-list">
|
||||
<h1><?php echo $this->__('Shipyard')?></h1>
|
||||
<form action="<?php echo $this->getUrl('buildings.php', array('mode' => 'fleets'))?>" method="post">
|
||||
<dl>
|
||||
|
|
|
|||
|
|
@ -1,20 +1,29 @@
|
|||
<?php /** @var Legacies_Core_Block_Template $this */?>
|
||||
<dt>
|
||||
<div class="item title">
|
||||
<h2><a href="<?php echo $this->getItemInfoUrl()?>"><?php echo $this->escape($this->getName())?></a> (<?php echo $this->renderNumber($this->getQty())?>)</h2>
|
||||
</dt>
|
||||
<dd>
|
||||
</div>
|
||||
<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="details">
|
||||
<p><?php echo $this->getDescription()?></p>
|
||||
<ul>
|
||||
<?php foreach ($this->getResourcesNeeded() as $resourceId => $resourceValue):?>
|
||||
<li><span class="resource"><?php echo $this->getResourceName($resourceId)?></span><span class="cost"><?php echo $this->renderNumber($resourceValue)?></span></li>
|
||||
<?php foreach ($this->getResourcesConfigForQty(1) as $resourceId => $resourceConfig):?>
|
||||
<li class="resource">
|
||||
<span class="label"><?php echo $this->getResourceName($resourceId)?></span>
|
||||
<span class="cost<?php if ($resourceConfig->hasData('requirement')):?> capped<?php endif?>"><?php echo $this->renderNumber($resourceConfig->getData('value'))?></span>
|
||||
<?php if ($resourceConfig->hasData('requirement')):?>
|
||||
<span class="requirement">(<?php echo $this->renderNumber($resourceConfig->getData('requirement'))?>)</span>
|
||||
<?php else:?>
|
||||
<span class="overflow">(<?php echo $this->renderNumber($resourceConfig->getData('overflow'))?>)</span>
|
||||
<?php endif?>
|
||||
</li>
|
||||
<?php endforeach?>
|
||||
</ul>
|
||||
<p><?php echo $this->__('Building time: %s', $this->renderTime($this->getBuildingTime(1), false))?>
|
||||
</div>
|
||||
<div class="buy">
|
||||
<p><input type="text" name="ship[<?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())?>" />
|
||||
<p><a class="max" rel="ship:<?php echo $this->getItemId()?>"><?php echo $this->__('Max (%s)', $this->renderNumber($this->getMaximumBuildableElementsCount()))?></a></p>
|
||||
</div>
|
||||
</dd>
|
||||
</div>
|
||||
|
|
@ -1,77 +1,65 @@
|
|||
<div id="header_top">
|
||||
<table class="header">
|
||||
<tbody>
|
||||
<tr class="header">
|
||||
<td class="header">
|
||||
<center>
|
||||
<table class="header">
|
||||
<tbody>
|
||||
<tr class="header">
|
||||
<td class="header"><img src="<?php echo $this->getSkinUrl($this->getCurrentPlanet()->getSmallImage())?>" height="50" width="50"></td>
|
||||
<td class="header" valign="middle">
|
||||
<select size="1" onchange="document.location.href=this.options[this.selectedIndex].value;">
|
||||
<?php foreach ($this->getPlanetCollection() as $planet):?>
|
||||
<option value="<?php echo $this->getUrl('', array('cp' => $planet->getId()))?>"<?php if ($planet->getId() == $this->getCurrentPlanet()->getId()):?> selected="selected"<?php endif?>><?php echo $this->escape($planet->getName())?> [<?php echo $this->escape($planet->getCoords())?>]</option>
|
||||
<?php endforeach?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</center>
|
||||
</td>
|
||||
<td class="header">
|
||||
<table style="width: 508px;" class="header" id="resources" padding-right="30" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr class="header">
|
||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/metall.gif')?>" border="0" height="22" width="42"></td>
|
||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/kristall.gif')?>" border="0" height="22" width="42"></td>
|
||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/deuterium.gif')?>" border="0" height="22" width="42"></td>
|
||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/energie.gif')?>" border="0" height="22" width="42"></td>
|
||||
<td class="header" align="center" width="140"><img src="<?php echo $this->getSkinUrl('graphics/images/message.gif')?>" border="0" height="22" width="42"></td>
|
||||
</tr>
|
||||
<tr class="header">
|
||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Metal')?></font></b></i></td>
|
||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Cristal')?></font></b></i></td>
|
||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Deuterium')?></font></b></i></td>
|
||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Energy')?></font></b></i></td>
|
||||
<td class="header" align="center" width="140"><i><b><font color="white"><?php echo $this->__('Messages')?></font></b></i></td>
|
||||
</tr>
|
||||
<tr class="header">
|
||||
<td class="header" align="center" width="140">
|
||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_METAL)):?>
|
||||
<span style="color:red;"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?>
|
||||
<?php endif?>
|
||||
</td>
|
||||
<td class="header" align="center" width="140">
|
||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_CRISTAL)):?>
|
||||
<span style="color:red;"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?>
|
||||
<?php endif?>
|
||||
</td>
|
||||
<td class="header" align="center" width="140">
|
||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_DEUTERIUM)):?>
|
||||
<span style="color:red;"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?>
|
||||
<?php endif?>
|
||||
</td>
|
||||
<td class="header" align="center" width="140">
|
||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_ENERGY)):?>
|
||||
<span style="color:red;"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / <?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / <?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?>
|
||||
<?php endif?>
|
||||
</td>
|
||||
<td class="header" align="center" width="140"><a href="<?php echo $this->getUrl('messages.php')?>"><?php echo $this->getCurrentUser()->getNewMessagesCount()?></a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="planet-carrousel">
|
||||
<?php foreach ($this->getPlanetCollection() as $planet):?>
|
||||
<div class="planet item">
|
||||
<?php if ($planet->getId() != $this->getCurrentPlanet()->getId()):?>
|
||||
<a href="<?php echo $this->getUrl('', array('cp' => $planet->getId()))?>"><?php echo $this->escape($planet->getName())?> [<?php echo $this->escape($planet->getCoords())?>]</a>
|
||||
<?php else:?>
|
||||
<?php echo $this->escape($planet->getName())?> [<?php echo $this->escape($planet->getCoords())?>]
|
||||
<?php endif?>
|
||||
</div>
|
||||
<?php endforeach?>
|
||||
</div>
|
||||
<div class="resources-display">
|
||||
<div class="resource metal">
|
||||
<img src="<?php echo $this->getSkinUrl('graphics/images/metall.gif')?>" border="0" height="22" width="42" alt="<?php echo $this->__('Metal')?>" title="<?php echo $this->__('Metal')?>" />
|
||||
<p>
|
||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_METAL)):?>
|
||||
<span class="resource-capped"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_METAL))?>
|
||||
<?php endif?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="resource cristal">
|
||||
<img src="<?php echo $this->getSkinUrl('graphics/images/kristall.gif')?>" border="0" height="22" width="42" alt="<?php echo $this->__('Cristal')?>" title="<?php echo $this->__('Cristal')?>" />
|
||||
<p>
|
||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_CRISTAL)):?>
|
||||
<span class="resource-capped"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_CRISTAL))?>
|
||||
<?php endif?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="resource deuterium">
|
||||
<img src="<?php echo $this->getSkinUrl('graphics/images/deuterium.gif')?>" border="0" height="22" width="42" alt="<?php echo $this->__('Deuterium')?>" title="<?php echo $this->__('Deuterium')?>" />
|
||||
<p>
|
||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_DEUTERIUM)):?>
|
||||
<span class="resource-capped"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_DEUTERIUM))?>
|
||||
<?php endif?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="resource energy">
|
||||
<img src="<?php echo $this->getSkinUrl('graphics/images/energie.gif')?>" border="0" height="22" width="42" alt="<?php echo $this->__('Energy')?>" title="<?php echo $this->__('Energy')?>" />
|
||||
<p>
|
||||
<?php if ($this->getCurrentPlanet()->isResourceCapped(Legacies_Empire::RESOURCE_ENERGY)):?>
|
||||
<span class="resource-capped"><?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / <?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceAmount(Legacies_Empire::RESOURCE_ENERGY))?> / <?php echo $this->renderNumber($this->getCurrentPlanet()->getResourceCap(Legacies_Empire::RESOURCE_ENERGY))?>
|
||||
<?php endif?>
|
||||
</p>
|
||||
</div>
|
||||
<div class="messages">
|
||||
<img src="<?php echo $this->getSkinUrl('graphics/images/message.gif')?>" border="0" height="22" width="42" alt="<?php echo $this->__('Messages')?>" title="<?php echo $this->__('Messages')?>" />
|
||||
<p>
|
||||
<?php if (($count = $this->getCurrentUser()->getNewMessagesCount()) > 1):?>
|
||||
<a href="<?php echo $this->getUrl('messages.php')?>" title="<?php echo $this->__('You have %1$d new messages.', $count)?>"><?php echo $this->__('%1$d messages.', $count)?></a>
|
||||
<?php elseif ($count == 1):?>
|
||||
<a href="<?php echo $this->getUrl('messages.php')?>" title="<?php echo $this->__('You have 1 new message.')?>"><?php echo $this->__('1 message.')?></a>
|
||||
<?php else:?>
|
||||
<a href="<?php echo $this->getUrl('messages.php')?>" title="<?php echo $this->__('You have no new message.')?>"><?php echo $this->__('No message.')?></a>
|
||||
<?php endif?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
<div class="navigation">
|
||||
<?php foreach ($this->getAllPartials() as $partial):?>
|
||||
<?php echo $partial->render()?>
|
||||
<?php endforeach?>
|
||||
</div>
|
||||
|
|
@ -0,0 +1 @@
|
|||
<span class="<?php echo $this->escape($this->renderClasses())?>"><a href="<?php echo $this->escape($this->getLinkUrl())?>"><?php echo $this->escape($link->getLabel())?></a></span>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<div class="navigation-node">
|
||||
<?php foreach ($this->getAllPartials() as $partial):?>
|
||||
<?php echo $partial->render()?>
|
||||
<?php endforeach?>
|
||||
</div>
|
||||
54
includes/application/design/scripts/user/login.phtml
Normal file
54
includes/application/design/scripts/user/login.phtml
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<div id="main">
|
||||
<div id="login">
|
||||
<div id="login_input">
|
||||
<form name="formular" action="" method="post" onsubmit="changeAction('login');">
|
||||
<table width="400" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top;">
|
||||
<td style="padding-right: 4px;">
|
||||
<?php echo $this->__('Username')?> <input name="username" value="" type="text">
|
||||
<?php echo $this->__('Password')?> <input name="password" value="" type="password">
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td style="padding-right: 4px;">
|
||||
<?php echo $this->__('Remember me')?> <input name="rememberme" type="checkbox">
|
||||
<input name="submit" value="<?php echo $this->__('Log in!')?>" type="submit">
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td style="padding-right: 4px;">
|
||||
<a href="lostpassword.php"><?php echo $this->__('I have lost my password.')?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="mainmenu" style="margin-top: 20px;">
|
||||
<a href="reg.php"><?php echo $this->__('Register')?></a>
|
||||
<a href="<?php echo $this->getData('board_url')?>"><?php echo $this->__('Boards')?></a>
|
||||
<a href="contact.php"><?php echo $this->__('Contact')?></a>
|
||||
</div>
|
||||
<div id="rightmenu" class="rightmenu">
|
||||
<div id="title"><?php echo $this->__('Welcome on %s!', $this->escape($this->getData('server_name')))?></div>
|
||||
<div id="content">
|
||||
<center>
|
||||
<div id="text1">
|
||||
<div style="text-align: left;"><?php echo $this->__('<strong>%1$s</strong> make you an emperor. Conquer outer space and master other players on <strong>%1$s</strong>.', $this->getData('server_name'))?></div>
|
||||
</div>
|
||||
<div id="register" class="bigbutton" onclick="document.location.href='reg.php';"><font color="#cc0000"><?php echo $this->__('Register now!')?></font></div>
|
||||
<div id="text2">
|
||||
<div id="text3">
|
||||
<center>
|
||||
<b>
|
||||
<font color="#00cc00"><?php echo $this->__('Player count: ')?></font><font color="#c6c7c6"><?php echo $this->getData('user_count')?></font> -
|
||||
<font color="#00cc00"><?php echo $this->__('Latest player: ')?></font><font color="#c6c7c6"><?php echo $this->getData('latest_player')?></font> -
|
||||
<font color="#00cc00"><?php echo $this->__('Online players: ')?></font> <font color="#c6c7c6"><?php echo $this->getData('online_players')?></font>
|
||||
</b>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
36
includes/application/design/scripts/user/registration.phtml
Normal file
36
includes/application/design/scripts/user/registration.phtml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<form action="reg.php" method="post">
|
||||
<fieldset>
|
||||
<legend><?php echo $this->__('User data:')?></legend>
|
||||
<p>
|
||||
<label for="register:username"><?php echo $this->__('Username:')?></label>
|
||||
<input type="text" name="username" id="register:username" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="register:email"><?php echo $this->__('Email:')?></label>
|
||||
<input type="text" name="email" id="register:email" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="register:email_confirm"><?php echo $this->__('Confirm email:')?></label>
|
||||
<input type="text" name="email_confirm" id="register:email_confirm" />
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $this->__('Password:')?></legend>
|
||||
<p>
|
||||
<label for="register:username"><?php echo $this->__('Password:')?></label>
|
||||
<input type="password" name="password" id="register:password" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="register:username"><?php echo $this->__('Confirm password:')?></label>
|
||||
<input type="password" name="password_confirm" id="register:password_confirm" />
|
||||
</p>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend><?php echo $this->__('Planet:')?></legend>
|
||||
<p>
|
||||
<label for="register:planet_name"><?php echo $this->__('Planet name:')?></label>
|
||||
<input type="text" name="planet_name" id="register:planet_name" />
|
||||
</p>
|
||||
</fieldset>
|
||||
<input type="submit" value="<?php echo $this->__('Register!')?>" />
|
||||
</form>
|
||||
6
includes/application/locale/fr_FR/Legacies_User.txt
Normal file
6
includes/application/locale/fr_FR/Legacies_User.txt
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Your session has expired, please login.
|
||||
Your username or credential is invalid, please check your input.
|
||||
No such user.
|
||||
You were banned, please contact admin for more information.
|
||||
You have 1 unread message.
|
||||
You have %1$d unread messages.
|
||||
247
includes/bb.class.php
Normal file
247
includes/bb.class.php
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
<?php
|
||||
|
||||
// Si la constante n'est pas defini on bloque l'execution du fichier
|
||||
if(!defined('PHPSIMUL_PAGES') || @PHPSIMUL_PAGES != 'PHPSIMULLL')
|
||||
{
|
||||
die('Erreur 404 - Le fichier n\'a pas <20>t<EFBFBD> trouv<75>');
|
||||
}
|
||||
|
||||
/* PHPsimul : Cr<EFBFBD>ez votre jeu de simulation en PHP
|
||||
Copyright (<EFBFBD>) - 2007 - CAPARROS S<EFBFBD>bastien (Camaris)
|
||||
|
||||
Codeur officiel: Camaris & Max485
|
||||
http://forum.epic-arena.fr
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class bb
|
||||
{
|
||||
##############################################################################################################
|
||||
// Fonction d<>vlopp<70> par Max485 pour affichez le bbcode
|
||||
|
||||
function bbcode($texte)
|
||||
{
|
||||
|
||||
//on supprime les slashs qui se seraient ajout<75>s automatiquement
|
||||
$texte = stripslashes($texte) ;
|
||||
//on d<>sactive le HTML
|
||||
$texte = htmlspecialchars($texte) ;
|
||||
//on g<>n<EFBFBD>re des retours chariots automatiques !!!
|
||||
$texte = nl2br($texte) ;
|
||||
|
||||
//on cr<63>e le bbcode qui sera appliqu<71> <20> notre texte !
|
||||
$bbcode=array(
|
||||
//mise en gras
|
||||
"!\[b\](.+)\[/b\]!isU",
|
||||
//soulignement
|
||||
"!\[u\](.+)\[/u\]!isU",
|
||||
//mise en italique
|
||||
"!\[i\](.+)\[/i\]!isU",
|
||||
//mise en couleur
|
||||
"!\[color=(.+)\](.+)\[/color\]!isU",
|
||||
//liste <20> puces 1
|
||||
"!\[ul\](.+)\[/ul\]!U",
|
||||
//liste <20> puces 2
|
||||
"!\[li\](.+)\[/li\]!U",
|
||||
// Lien nomm<6D>
|
||||
"!\[url=(.+?)\](.+?)\[\/url\]!i",
|
||||
//afficher les images
|
||||
"!\[img\](.+)\[/img\]!i",
|
||||
// Lien
|
||||
"!\[url\](.+?)\[\/url\]!i",
|
||||
// Email nomm<6D>
|
||||
"!\[email=(.+?)\](.+?)\[\/email\]!i",
|
||||
// Email
|
||||
"!\[email\](.+?)\[\/email\]!i",
|
||||
// Size H1
|
||||
"!\[size=1\](.+)\[/size\]!i",
|
||||
// Size H2
|
||||
"!\[size=2\](.+)\[/size\]!i",
|
||||
// Size H3
|
||||
"!\[size=3\](.+)\[/size\]!i",
|
||||
// Size H4
|
||||
"!\[size=4\](.+)\[/size\]!i",
|
||||
// Size H5
|
||||
"!\[size=5\](.+)\[/size\]!i",
|
||||
// Size Tres petit
|
||||
"!\[size=tres petit\](.+)\[/size\]!i",
|
||||
// Size Petit
|
||||
"!\[size=petit\](.+)\[/size\]!i",
|
||||
// Size Normal
|
||||
"!\[size=normal\](.+)\[/size\]!i",
|
||||
// Size Moyen
|
||||
"!\[size=moyen\](.+)\[/size\]!i",
|
||||
// Size Grand
|
||||
"!\[size=grand\](.+)\[/size\]!i",
|
||||
// Size 18
|
||||
"!\[size=18\](.+)\[/size\]!i",
|
||||
// Quote
|
||||
"!\[quote\](.+)\[/quote\]!i",
|
||||
//Quote nomm<6D>
|
||||
"!\[quote=(.+)\](.+)\[/quote\]!i",
|
||||
// Code
|
||||
"!\[code\](.+)\[/code\]!i",
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
$html = array(
|
||||
//mise en gras
|
||||
"<b>$1</b>",
|
||||
//soulignement
|
||||
"<u>$1</u>",
|
||||
//mise en italique
|
||||
"<i>$1</i>",
|
||||
//mise en couleur
|
||||
"<span style=\"color:$1\">$2</span>",
|
||||
//liste <20> puce 1
|
||||
"<ul>$1</ul>",
|
||||
//liste <20> puce 2
|
||||
"<li>$1</li>",
|
||||
// Lien nomm<6D>
|
||||
"<a href=\"$1\">$2</a>",
|
||||
//afficher les images
|
||||
"<img src=\"$1\">",
|
||||
// Lien
|
||||
"<a href=\"$1\">$1</a>",
|
||||
// Email nomm<6D>
|
||||
"<a href=\"mailto:$1\">$2</a>",
|
||||
// Email
|
||||
"<a href=\"mailto:$1\">$1</a>",
|
||||
//Size H1
|
||||
"<h1>$1</h1>",
|
||||
//Size H2
|
||||
"<h2>$1</h2>",
|
||||
//Size H3
|
||||
"<h3>$1</h3>",
|
||||
//Size H4
|
||||
"<h4>$1</h4>",
|
||||
//Size H5
|
||||
"<h5>$1</h5>",
|
||||
//Size Tres Petit
|
||||
"<h1>$1</h1>",
|
||||
//Size Petit
|
||||
"<h3>$1</h3>",
|
||||
//Size Normal
|
||||
"<h4>$1</h4>",
|
||||
//Size Moyen
|
||||
"<h6>$1</h6>",
|
||||
//Size Grand
|
||||
"<h7>$1</h7>",
|
||||
// Size 18
|
||||
"<h6>$1</h6>",
|
||||
// Quote
|
||||
"<br><u><b>Citation :</b></u><table cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"left\" bgcolor=\"red\"><tr><td bgcolor=\"#FFFFFF\"><font color=\"#000000\"><b>$1</b><br></font></td></tr></table><br><br>",
|
||||
// Quote nomm<6D>
|
||||
"<br><u><b>$1 :</b></u><table cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"left\" bgcolor=\"red\"><tr><td bgcolor=\"#FFFFFF\"><font color=\"#000000\"><b>$2</b><br></font></td></tr></table><br><br>",
|
||||
// Code
|
||||
"<br><u><b>Code :</b></u><table cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"left\" bgcolor=\"red\"><tr><td bgcolor=\"#FFFFFF\"><font color=\"#000000\"><b>$1</b><br></font></td></tr></table><br><br>",
|
||||
|
||||
);
|
||||
|
||||
$texte = preg_replace($bbcode,$html,$texte);
|
||||
|
||||
return $texte ;
|
||||
|
||||
}
|
||||
##############################################################################################################
|
||||
function div_page($nb_s,$d,$id,$cat,$nb_ep)
|
||||
{
|
||||
if($nb_s > $nb_ep)
|
||||
{
|
||||
$nb_p = ceil($nb_s / $nb_ep);
|
||||
$p_suiv = $d+1;
|
||||
$p_prec = $d-1;
|
||||
|
||||
if($d > 1)
|
||||
{
|
||||
echo '<a href="?cat='.$cat.'&id='.$id.'&d=1"><< </a>';
|
||||
echo '<a href="?cat='.$cat.'&id='.$id.'&d='.$p_prec.'">< </a>';
|
||||
}
|
||||
|
||||
echo '<span class="p"> Page n<> '.$d.' / '.$nb_p.'</span>';
|
||||
|
||||
if($d < $nb_p)
|
||||
{
|
||||
echo '<a href="?cat='.$cat.'&id='.$id.'&d='.$p_suiv.'"> ></a>';
|
||||
echo '<a href="?cat='.$cat.'&id='.$id.'&d='.$nb_p.'"> >></a>';
|
||||
}
|
||||
echo ' <br /><br />';
|
||||
}
|
||||
}
|
||||
|
||||
function div_page_l($nb_s,$d,$id,$p,$s)
|
||||
{
|
||||
|
||||
if(strlen($s) > 1)
|
||||
{
|
||||
$s_lien = "&s=".$s;
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_lien = "";
|
||||
}
|
||||
|
||||
if($nb_s > 10)
|
||||
{
|
||||
echo' <br />';
|
||||
$nb_p = ceil($nb_s / 10);
|
||||
$p_suiv = $p+1;
|
||||
$p_prec = $p-1;
|
||||
|
||||
if($p > 1)
|
||||
{
|
||||
echo '<a href="?cat=4&id='.$id.'&d='.$d.'&p=1'.$s_lien.'"><< </a>';
|
||||
echo '<a href="?cat=4&id='.$id.'&d='.$d.'&p='.$p_prec.$s_lien.'">< </a>';
|
||||
}
|
||||
|
||||
echo '<span class="p"> Page n<> '.$p.' / '.$nb_p.'</span>';
|
||||
|
||||
if($p < $nb_p)
|
||||
{
|
||||
echo '<a href="?cat=4&id='.$id.'&d='.$d.'&p='.$p_suiv.$s_lien.'"> ></a>';
|
||||
echo '<a href="?cat=4&id='.$id.'&d='.$d.'&p='.$nb_p.$s_lien.'"> >></a>';
|
||||
}
|
||||
echo ' <br />';
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
##############################################################################################################
|
||||
function smileys($chaine)
|
||||
{
|
||||
global $userrow;
|
||||
|
||||
$chaine = str_replace(":D", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/sourire.gif' />", $chaine);
|
||||
$chaine = str_replace(";)", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/clin.gif' />", $chaine);
|
||||
$chaine = str_replace(":(", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/triste.gif' />", $chaine);
|
||||
$chaine = str_replace(":surpris:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/yeuxrond.gif' />", $chaine);
|
||||
$chaine = str_replace(":o", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/etonne.gif' />", $chaine);
|
||||
$chaine = str_replace(":confus:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/confus.gif' />", $chaine);
|
||||
$chaine = str_replace(":lol:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/lol.gif' />", $chaine);
|
||||
$chaine = str_replace(":fire:", " <img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/flame.gif' />", $chaine);
|
||||
$chaine = str_replace(":splif:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/petard.gif' />", $chaine);
|
||||
$chaine = str_replace(":bigsmile:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/green.gif' />", $chaine);
|
||||
$chaine = str_replace(":x", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/mod.gif' />", $chaine);
|
||||
$chaine = str_replace(":roll:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/rolleyes.gif' />", $chaine);
|
||||
$chaine = str_replace(":bigcry:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/crying.gif' />", $chaine);
|
||||
$chaine = str_replace(":colere:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/colere.gif' />", $chaine);
|
||||
$chaine = str_replace(":P", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/razz.gif' />", $chaine);
|
||||
$chaine = str_replace("8)", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/lunettes.gif' />", $chaine);
|
||||
$chaine = str_replace(":)", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/sourire.gif' />", $chaine);
|
||||
$chaine = str_replace("^^oops:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/redface.gif.gif' />", $chaine);
|
||||
|
||||
return($chaine);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -11,11 +11,23 @@
|
|||
array('Legacies_Empire_Model_Planet', 'planetUpdateListener'),
|
||||
array('Legacies_Empire_Model_Planet_Building_Shipyard', 'planetUpdateListener')
|
||||
),
|
||||
'user.init' => array(),
|
||||
'planet.init' => array(),
|
||||
'user.init' => array(
|
||||
array('Legacies_Empire_Model_Planet', 'registrationListener')
|
||||
),
|
||||
'planet.init' => array(
|
||||
array('Legacies_Empire_Model_Galaxy_Position', 'initPlanetListerner')
|
||||
),
|
||||
'planet.shipyard.check-availability' => array(),
|
||||
'planet.shipyard.update-queue.before' => array(),
|
||||
'planet.shipyard.update-queue.after' => array(),
|
||||
'planet.shipyard.append-queue.before' => array(),
|
||||
'planet.shipyard.append-queue.after' => array()
|
||||
'planet.shipyard.append-queue.after' => array(),
|
||||
'planet.building.building-time' => array(
|
||||
array('Legacies_Empire_Model_Planet_Building_NaniteFactory', 'buildingTimeListener'),
|
||||
array('Legacies_Empire_Model_Planet_Building_RoboticFactory', 'buildingTimeListener')
|
||||
),
|
||||
'planet.shipyard.building-time' => array(
|
||||
array('Legacies_Empire_Model_Planet_Building_NaniteFactory', 'buildingTimeListener'),
|
||||
array('Legacies_Empire_Model_Planet_Building_RoboticFactory', 'buildingTimeListener')
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 15,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 75
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE => array(
|
||||
|
|
@ -15,7 +16,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 24,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.6
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.6,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 72
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => array(
|
||||
|
|
@ -23,7 +25,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 75,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 300
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT => array(
|
||||
|
|
@ -31,7 +34,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 30,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 105
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array(
|
||||
|
|
@ -39,7 +43,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 360,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 180,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.8
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.8,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 1260
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY => array(
|
||||
|
|
@ -47,7 +52,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 120,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 200,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 520
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_NANITE_FACTORY => array(
|
||||
|
|
@ -55,7 +61,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 500000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 1500000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => array(
|
||||
|
|
@ -63,7 +70,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 200,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 600
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_METAL_STORAGE => array(
|
||||
|
|
@ -71,7 +79,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 2000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_STORAGE => array(
|
||||
|
|
@ -79,7 +88,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 1000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 3000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_TANK => array(
|
||||
|
|
@ -87,7 +97,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 4000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => array(
|
||||
|
|
@ -95,7 +106,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 400,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 200,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 600
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_TERRAFORMER => array(
|
||||
|
|
@ -103,7 +115,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 50000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 1000,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 50000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_ALLIANCE_DEPOT => array(
|
||||
|
|
@ -111,35 +124,40 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 40000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 60000
|
||||
),
|
||||
Legacies_Empire::ID_BUILDING_LUNAR_BASE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 20000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 40000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 20000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 60000
|
||||
),
|
||||
Legacies_Empire::ID_BUILDING_SENSOR_PHALANX => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 20000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 40000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 20000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 60000
|
||||
),
|
||||
Legacies_Empire::ID_BUILDING_JUMP_GATE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 4000000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 2000000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 6000000
|
||||
),
|
||||
Legacies_Empire::ID_BUILDING_MISSILE_SILO => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 20000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 20000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 1000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 40000
|
||||
),
|
||||
// }}}
|
||||
|
||||
|
|
@ -151,7 +169,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 1000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 200,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 1200
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => array(
|
||||
|
|
@ -159,7 +178,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 400,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 600,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 400
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_WEAPON_TECHNOLOGY => array(
|
||||
|
|
@ -167,7 +187,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 200,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 1000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => array(
|
||||
|
|
@ -175,7 +196,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 600,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 800
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ARMOUR_TECHNOLOGY => array(
|
||||
|
|
@ -183,7 +205,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 1000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => array(
|
||||
|
|
@ -191,7 +214,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 800,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 400,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 800
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => array(
|
||||
|
|
@ -199,7 +223,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 4000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 2000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 4000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => array(
|
||||
|
|
@ -207,15 +232,17 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 600,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 400
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 4000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 600,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 600,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 6000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => array(
|
||||
|
|
@ -223,7 +250,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 20000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 6000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 30000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => array(
|
||||
|
|
@ -231,7 +259,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 100,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 300
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => array(
|
||||
|
|
@ -239,7 +268,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 300,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 1300
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY => array(
|
||||
|
|
@ -247,7 +277,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 4000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 1000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 6000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK => array(
|
||||
|
|
@ -255,7 +286,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 400000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 160000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 640000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY => array(
|
||||
|
|
@ -263,15 +295,17 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 8000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 4000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 12000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
'energy_max' => 300000, // FIXME:
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 3
|
||||
Legacies_Empire::RESOURCE_ENERGY => 300000, // FIXME:
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 3,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 0
|
||||
),
|
||||
// }}}
|
||||
|
||||
|
|
@ -288,7 +322,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 40,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 5000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 10000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 5000
|
||||
Legacies_Empire::SHIPS_CAPACITY => 5000,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 4000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => array(
|
||||
|
|
@ -301,7 +336,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 50,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 7500,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 7500,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 25000
|
||||
Legacies_Empire::SHIPS_CAPACITY => 25000,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 12000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => array(
|
||||
|
|
@ -314,7 +350,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 20,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 12500,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 12500,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 50
|
||||
Legacies_Empire::SHIPS_CAPACITY => 50,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 4000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => array(
|
||||
|
|
@ -327,7 +364,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 75,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 10000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 15000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 100
|
||||
Legacies_Empire::SHIPS_CAPACITY => 100,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 10000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_CRUISER => array(
|
||||
|
|
@ -340,7 +378,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 300,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 15000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 15000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 800
|
||||
Legacies_Empire::SHIPS_CAPACITY => 800,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 27000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => array(
|
||||
|
|
@ -353,7 +392,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 500,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 10000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 10000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 1500
|
||||
Legacies_Empire::SHIPS_CAPACITY => 1500,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 60000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => array(
|
||||
|
|
@ -366,7 +406,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 1000,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 2500,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 2500,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 7500
|
||||
Legacies_Empire::SHIPS_CAPACITY => 7500,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 30000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => array(
|
||||
|
|
@ -379,7 +420,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 300,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 2000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 2000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 20000
|
||||
Legacies_Empire::SHIPS_CAPACITY => 20000,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 16000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => array(
|
||||
|
|
@ -392,7 +434,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 1,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 100000000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 100000000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 5
|
||||
Legacies_Empire::SHIPS_CAPACITY => 5,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 1000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BOMBER => array(
|
||||
|
|
@ -405,7 +448,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 1000,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 4000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 5000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 500
|
||||
Legacies_Empire::SHIPS_CAPACITY => 500,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 75000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array(
|
||||
|
|
@ -418,7 +462,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 0,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 0,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 0,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 0
|
||||
Legacies_Empire::SHIPS_CAPACITY => 0,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 2000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => array(
|
||||
|
|
@ -431,7 +476,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 1000,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 5000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 5000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 2000
|
||||
Legacies_Empire::SHIPS_CAPACITY => 2000,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 110000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => array(
|
||||
|
|
@ -444,7 +490,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 1,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 100,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 100,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 1000000
|
||||
Legacies_Empire::SHIPS_CAPACITY => 1000000,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 9000000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => array(
|
||||
|
|
@ -457,7 +504,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 250,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 10000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 10000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 750
|
||||
Legacies_Empire::SHIPS_CAPACITY => 750,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 70000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SUPERNOVA => array(
|
||||
|
|
@ -470,7 +518,8 @@
|
|||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 100000,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 500,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 1000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 1000000
|
||||
Legacies_Empire::SHIPS_CAPACITY => 1000000,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 450000000
|
||||
),
|
||||
// }}}
|
||||
|
||||
|
|
@ -482,7 +531,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 2000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => array(
|
||||
|
|
@ -490,7 +540,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 500,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 2000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => array(
|
||||
|
|
@ -498,7 +549,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 8000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => array(
|
||||
|
|
@ -506,7 +558,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 15000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 2000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 35000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => array(
|
||||
|
|
@ -514,7 +567,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 6000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 8000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => array(
|
||||
|
|
@ -522,7 +576,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 50000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 30000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 100000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => array(
|
||||
|
|
@ -530,7 +585,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 10000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 20000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => array(
|
||||
|
|
@ -538,7 +594,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 50000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 100000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => array(
|
||||
|
|
@ -546,7 +603,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 10000
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => array(
|
||||
|
|
@ -554,7 +612,8 @@
|
|||
Legacies_Empire::RESOURCE_CRISTAL => 2500,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 10000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::BASE_BUILDING_TIME => 15000
|
||||
),
|
||||
// }}}
|
||||
|
||||
|
|
|
|||
|
|
@ -508,7 +508,7 @@ function display($page, $title = '', $topnav = true, $metatags = '', $AdminPage
|
|||
|
||||
// TODO: implement extra meta tags
|
||||
$layout = new Legacies_Core_Layout();
|
||||
$layout->load('1column');
|
||||
$layout->load('2columns-left');
|
||||
$content = $layout->getBlock('content');
|
||||
|
||||
if ($topnav) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ function bbcode($string) {
|
|||
'/\[img](.*?)\[\/img\]/ise',
|
||||
'/\[color=(.*?)\](.*?)\[\/color\]/is',
|
||||
'/\[quote\](.*?)\[\/quote\]/ise',
|
||||
'/\[code\](.*?)\[\/code\]/ise'
|
||||
'/\[code\](.*?)\[\/code\]/ise',
|
||||
'#\[youtube\]([^\]]+)\[/youtube\]#',
|
||||
'#\[dailymotion\]([^\]]+)\[/dailymotion\]#'
|
||||
);
|
||||
|
||||
$replace = array(
|
||||
|
|
@ -62,12 +64,14 @@ function bbcode($string) {
|
|||
'<span style="text-decoration: underline;">\1</span>',
|
||||
'<span style="text-decoration: line-through;">\1</span>',
|
||||
'<span style="text-decoration: line-through;">\1</span>',
|
||||
'urlfix(\'\\1\',\'\\2\')',
|
||||
'urlfix($1,$2)',
|
||||
'<a href="mailto:\1" title="\1">\2</a>',
|
||||
'imagefix(\'\\1\')',
|
||||
'<span style="color: \1;">\2</span>',
|
||||
'sQuote(\'\1\')',
|
||||
'sCode(\'\1\')'
|
||||
'sCode(\'\1\')',
|
||||
'<iframe src="http://www.youtube.com/embed/\\1" width="640" height="385"></iframe>',
|
||||
'<iframe frameborder="0" width="560" height="420" src="http://www.dailymotion.com/embed/video/\\1?width=560"></iframe>'
|
||||
);
|
||||
|
||||
return preg_replace($pattern, $replace, nl2br(htmlspecialchars(stripslashes($string))));
|
||||
|
|
|
|||
|
|
@ -1,199 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function BatimentBuildingPage($CurrentPlanet, $CurrentUser)
|
||||
{
|
||||
global $lang, $resource, $reslist, $dpath, $gameConfig;
|
||||
|
||||
// Tables des batiments possibles par type de planete
|
||||
$Allowed['1'] = array( 1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 44);
|
||||
$Allowed['3'] = array( 12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
|
||||
|
||||
// Boucle d'interpretation des eventuelles commandes
|
||||
if (isset($_GET['cmd'])) {
|
||||
// On passe une commande
|
||||
$bThisIsCheated = false;
|
||||
$bDoItNow = false;
|
||||
$TheCommand = $_GET['cmd'];
|
||||
$Element = $_GET['building'];
|
||||
$ListID = $_GET['listid'];
|
||||
if ( isset ( $Element )) {
|
||||
if ( !strchr ( $Element, " ") ) {
|
||||
if ( !strchr ( $Element, ",") ) {
|
||||
if ( !strchr ( $Element, ";") ) {
|
||||
if (in_array( trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
|
||||
$bDoItNow = true;
|
||||
} else {
|
||||
$bThisIsCheated = true;
|
||||
}
|
||||
} else {
|
||||
$bThisIsCheated = true;
|
||||
}
|
||||
} else {
|
||||
$bThisIsCheated = true;
|
||||
}
|
||||
} else {
|
||||
$bThisIsCheated = true;
|
||||
}
|
||||
} elseif ( isset ( $ListID )) {
|
||||
$bDoItNow = true;
|
||||
}
|
||||
if ($bDoItNow == true) {
|
||||
switch($TheCommand){
|
||||
case 'cancel':
|
||||
// Interrompre le premier batiment de la queue
|
||||
CancelBuildingFromQueue ( $CurrentPlanet, $CurrentUser );
|
||||
break;
|
||||
case 'remove':
|
||||
// Supprimer un element de la queue (mais pas le premier)
|
||||
// $RemID -> element de la liste a supprimer
|
||||
RemoveBuildingFromQueue ( $CurrentPlanet, $CurrentUser, $ListID );
|
||||
break;
|
||||
case 'insert':
|
||||
// Insere un element dans la queue
|
||||
AddBuildingToQueue ( $CurrentPlanet, $CurrentUser, $Element, true );
|
||||
break;
|
||||
case 'destroy':
|
||||
// Detruit un batiment deja construit sur la planete !
|
||||
AddBuildingToQueue ( $CurrentPlanet, $CurrentUser, $Element, false );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // switch
|
||||
} elseif ($bThisIsCheated == true) {
|
||||
ResetThisFuckingCheater ( $CurrentUser['id'] );
|
||||
}
|
||||
}
|
||||
|
||||
$Queue = ShowBuildingQueue ( $CurrentPlanet, $CurrentUser );
|
||||
|
||||
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
|
||||
$CanBuildElement = true;
|
||||
} else {
|
||||
$CanBuildElement = false;
|
||||
}
|
||||
|
||||
$SubTemplate = gettemplate('buildings_builds_row');
|
||||
$BuildingPage = "";
|
||||
foreach($lang['tech'] as $Element => $ElementName) {
|
||||
if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
|
||||
$CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
|
||||
if ($CurrentPlanet["field_current"] < ($CurrentMaxFields - $Queue['lenght'])) {
|
||||
$RoomIsOk = true;
|
||||
} else {
|
||||
$RoomIsOk = false;
|
||||
}
|
||||
|
||||
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
|
||||
$HaveRessources = IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, true, false);
|
||||
$parse = array();
|
||||
$parse['dpath'] = $dpath;
|
||||
$parse['i'] = $Element;
|
||||
$BuildingLevel = $CurrentPlanet[$resource[$Element]];
|
||||
$parse['nivel'] = ($BuildingLevel == 0) ? "" : " (". $lang['level'] ." ". $BuildingLevel .")";
|
||||
$parse['n'] = $ElementName;
|
||||
$parse['descriptions'] = $lang['res']['descriptions'][$Element];
|
||||
$ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
|
||||
$parse['time'] = ShowBuildTime($ElementBuildTime);
|
||||
$parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
|
||||
$parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element);
|
||||
$parse['click'] = '';
|
||||
$NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
|
||||
|
||||
if ($Element == 31) {
|
||||
// Sp<53>cial Laboratoire
|
||||
if ($CurrentUser["b_tech_planet"] != 0 && // Si pas 0 y a une recherche en cours
|
||||
$gameConfig['BuildLabWhileRun'] != 1) { // Variable qui contient le parametre
|
||||
// On verifie si on a le droit d'evoluer pendant les recherches (Setting dans config)
|
||||
$parse['click'] = "<font color=#FF0000>". $lang['in_working'] ."</font>";
|
||||
}
|
||||
}
|
||||
if ($parse['click'] != '') {
|
||||
// Bin on ne fait rien, vu que l'on l'a deja fait au dessus !!
|
||||
} elseif ($RoomIsOk && $CanBuildElement) {
|
||||
if ($Queue['lenght'] == 0) {
|
||||
if ($NextBuildLevel == 1) {
|
||||
if ( $HaveRessources == true ) {
|
||||
$parse['click'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['BuildFirstLevel'] ."</font></a>";
|
||||
} else {
|
||||
$parse['click'] = "<font color=#FF0000>". $lang['BuildFirstLevel'] ."</font>";
|
||||
}
|
||||
} else {
|
||||
if ( $HaveRessources == true ) {
|
||||
$parse['click'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font></a>";
|
||||
} else {
|
||||
$parse['click'] = "<font color=#FF0000>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$parse['click'] = "<a href=\"?cmd=insert&building=". $Element ."\"><font color=#00FF00>". $lang['InBuildQueue'] ."</font></a>";
|
||||
}
|
||||
} elseif ($RoomIsOk && !$CanBuildElement) {
|
||||
if ($NextBuildLevel == 1) {
|
||||
$parse['click'] = "<font color=#FF0000>". $lang['BuildFirstLevel'] ."</font>";
|
||||
} else {
|
||||
$parse['click'] = "<font color=#FF0000>". $lang['BuildNextLevel'] ." ". $NextBuildLevel ."</font>";
|
||||
}
|
||||
} else {
|
||||
$parse['click'] = "<font color=#FF0000>". $lang['NoMoreSpace'] ."</font>";
|
||||
}
|
||||
|
||||
$BuildingPage .= parsetemplate($SubTemplate, $parse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$parse = $lang;
|
||||
|
||||
// Faut il afficher la liste de construction ??
|
||||
if ($Queue['lenght'] > 0) {
|
||||
$parse['BuildListScript'] = InsertBuildListScript ( "buildings" );
|
||||
$parse['BuildList'] = $Queue['buildlist'];
|
||||
} else {
|
||||
$parse['BuildListScript'] = "";
|
||||
$parse['BuildList'] = "";
|
||||
}
|
||||
|
||||
$parse['planet_field_current'] = $CurrentPlanet["field_current"];
|
||||
$parse['planet_field_max'] = $CurrentPlanet['field_max'] + ($CurrentPlanet[$resource[33]] * 5);
|
||||
$parse['field_libre'] = $parse['planet_field_max'] - $CurrentPlanet['field_current'];
|
||||
|
||||
$parse['BuildingsList'] = $BuildingPage;
|
||||
|
||||
$page .= parsetemplate(gettemplate('buildings_builds'), $parse);
|
||||
|
||||
display($page, $lang['Builds']);
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
*/
|
||||
function CheckLabSettingsInQueue ( $CurrentPlanet ) {
|
||||
global $lang, $gameConfig;
|
||||
|
||||
if ($CurrentPlanet['b_building_id'] != "0") {
|
||||
$BuildQueue = $CurrentPlanet['b_building_id'];
|
||||
if (strpos ($BuildQueue, ";")) {
|
||||
$Queue = explode (";", $BuildQueue);
|
||||
$CurrentBuilding = $Queue[0];
|
||||
} else {
|
||||
// Y a pas de queue de construction la liste n'a qu'un seul element
|
||||
$CurrentBuilding = $BuildQueue;
|
||||
}
|
||||
|
||||
if ($CurrentBuilding == 31 && $gameConfig['BuildLabWhileRun'] != 1) {
|
||||
$return = false;
|
||||
} else {
|
||||
$return = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
$return = true;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $currentPlanet
|
||||
* @param unknown_type $currentUser
|
||||
*/
|
||||
function DefensesBuildingPage ( &$currentPlanet, $currentUser ) {
|
||||
global $lang, $resource, $dpath;
|
||||
|
||||
// S'il n'y a pas de Chantier
|
||||
if (!isset($currentPlanet[$resource[Legacies_Empire::ID_BUILDING_SHIPYARD]]) || $currentPlanet[$resource[Legacies_Empire::ID_BUILDING_SHIPYARD]] == 0) {
|
||||
message($lang['need_hangar'], $lang['tech'][Legacies_Empire::ID_BUILDING_SHIPYARD]);
|
||||
return;
|
||||
}
|
||||
|
||||
$shipyard = Legacies_Empire_Model_Planet_Building_Shipyard::factory($currentPlanet, $currentUser);
|
||||
if (isset($_POST['fmenge']) && is_array($_POST['fmenge'])) {
|
||||
foreach ($_POST['fmenge'] as $shipId => $count) {
|
||||
$shipId = intval($shipId);
|
||||
if (in_array($shipId, $resource)) {
|
||||
continue;
|
||||
}
|
||||
$count = intval($count);
|
||||
|
||||
$shipyard->appendQueue($shipId, $count);
|
||||
}
|
||||
$currentPlanet = $shipyard->save();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// Construction de la page du Chantier (car si j'arrive ici ... c'est que j'ai tout ce qu'il faut pour ...
|
||||
$TabIndex = 0;
|
||||
$PageTable = "";
|
||||
$types = include ROOT_PATH . 'includes/data/types.php';
|
||||
foreach ($types[Legacies_Empire::TYPE_DEFENSE] as $shipId) {
|
||||
if ($shipyard->checkAvailability($shipId)) {
|
||||
// Disponible à la construction
|
||||
|
||||
// On regarde combien de temps il faut pour construire l'element
|
||||
$BuildOneElementTime = $shipyard->getBuildTime($shipId, 1);
|
||||
// Disponibilité actuelle
|
||||
$shipIdCount = $currentPlanet[$resource[$shipId]];
|
||||
$shipIdNbre = ($shipIdCount == 0) ? "" : " (".$lang['dispo'].": " . pretty_number($shipIdCount) . ")";
|
||||
|
||||
// Construction des 3 cases de la ligne d'un element dans la page d'achat !
|
||||
// Début de ligne
|
||||
$PageTable .= "\n<tr>";
|
||||
|
||||
// Imagette + Link vers la page d'info
|
||||
$PageTable .= "<th class=l>";
|
||||
$PageTable .= "<a href=infos.".PHPEXT."?gid=".$shipId.">";
|
||||
$PageTable .= "<img border=0 src=\"".$dpath."gebaeude/".$shipId.".gif\" align=top width=120 height=120></a>";
|
||||
$PageTable .= "</th>";
|
||||
|
||||
// Description
|
||||
$PageTable .= "<td class=l>";
|
||||
$PageTable .= "<a href=infos.".PHPEXT."?gid=".$shipId.">".$shipIdName."</a> ".$shipIdNbre."<br>";
|
||||
$PageTable .= "".$lang['res']['descriptions'][$shipId]."<br>";
|
||||
// On affiche le 'prix' avec eventuellement ce qui manque en ressource
|
||||
$PageTable .= GetElementPrice($currentUser, $currentPlanet, $shipId, false);
|
||||
// On affiche le temps de construction (c'est toujours tellement plus joli)
|
||||
$PageTable .= ShowBuildTime($BuildOneElementTime);
|
||||
$PageTable .= "</td>";
|
||||
|
||||
// Case nombre d'elements a construire
|
||||
$PageTable .= "<td class=k>";
|
||||
// Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie
|
||||
$maxElements = $shipyard->getMaximumBuildableElementsCount($shipId);
|
||||
if (bccomp($maxElements, 0) > 0) {
|
||||
$TabIndex++;
|
||||
$PageTable .= "<input type=\"text\" id=\"fmenge:{$shipId}\" name=\"fmenge[".$shipId."]\" alt='".$lang['tech'][$shipId]."' size=5 maxlength=5 value=0 tabindex=".$TabIndex.">";
|
||||
|
||||
if (MAX_FLEET_OR_DEFS_PER_ROW > 0 && $maxElements > MAX_FLEET_OR_DEFS_PER_ROW) {
|
||||
$maxElements = MAX_FLEET_OR_DEFS_PER_ROW;
|
||||
}
|
||||
|
||||
$PageTable .= '<br /><a onclick="document.getElementById(\'fmenge:'.$shipId.'\').value=\''.strval($maxElements).'\';" style="cursor:pointer;">Nombre max ('.number_format($maxElements, 0, ',', '.').')</a>';
|
||||
} else if (in_array($shipId, array(Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME, Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME))) {
|
||||
$PageTable .= '<span style="color:red">Limite de construction atteinte.</span>';
|
||||
} else if (in_array($shipId, array(Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME, Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME))) {
|
||||
$PageTable .= '<span style="color:red">Silo plein.</span>';
|
||||
}
|
||||
$PageTable .= '</td>';
|
||||
|
||||
// Fin de ligne (les 3 cases sont construites !!
|
||||
$PageTable .= "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($currentPlanet['b_hangar_id'])) {
|
||||
$data = array();
|
||||
foreach ($shipyard->getQueue() as $item) {
|
||||
$data[] = array_merge($item, array(
|
||||
'label' => $lang['tech'][$item['ship_id']],
|
||||
'speed' => $shipyard->getBuildTime($item['ship_id'], 1)
|
||||
));
|
||||
}
|
||||
$parse = array(
|
||||
'data' => json_encode($data)
|
||||
);
|
||||
$BuildQueue = parsetemplate(gettemplate('buildings_script'), $parse);
|
||||
}
|
||||
|
||||
$parse = $lang;
|
||||
// La page se trouve dans $PageTable;
|
||||
$parse['buildlist'] = $PageTable;
|
||||
// Et la liste de constructions en cours dans $BuildQueue;
|
||||
$parse['buildinglist'] = $BuildQueue;
|
||||
// fragmento de template
|
||||
$page .= parsetemplate(gettemplate('buildings_defense'), $parse);
|
||||
|
||||
display($page, $lang['Defense']);
|
||||
|
||||
}
|
||||
// Version History
|
||||
// - 1.0 Modularisation
|
||||
// - 1.1 Correction mise en place d'une limite max d'elements constructibles par ligne
|
||||
// - 1.2 Correction limitation bouclier meme si en queue de fabrication
|
||||
//
|
||||
?>
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $CurrentPlanet
|
||||
*/
|
||||
function ElementBuildListQueue ( $CurrentUser, $CurrentPlanet ) {
|
||||
// Jamais appelé pour le moment donc totalement modifiable !
|
||||
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
/*
|
||||
alter table `ogame`.`game_planets`
|
||||
change `name` `name` varchar (255) NULL COLLATE latin1_general_ci,
|
||||
change `b_building_id` `b_building_id` text NULL COLLATE latin1_general_ci,
|
||||
change `b_tech_id` `b_tech_id` text NULL COLLATE latin1_general_ci,
|
||||
change `b_hangar_id` `b_hangar_id` text NULL COLLATE latin1_general_ci,
|
||||
change `image` `image` varchar (32) DEFAULT 'normaltempplanet01' NOT NULL COLLATE latin1_general_ci,
|
||||
change `b_building_queue` `b_building_queue` text NULL COLLATE latin1_general_ci,
|
||||
change `unbau` `unbau` varchar (100) NULL COLLATE latin1_general_ci;
|
||||
|
||||
*/
|
||||
// global $lang, $pricelist;
|
||||
//
|
||||
// // Array del b_hangar_id
|
||||
// $b_building_id = explode(';', $CurrentPlanet['b_building_queue']);
|
||||
//
|
||||
// $a = $b = $c = "";
|
||||
// foreach($b_hangar_id as $n => $array) {
|
||||
// if ($array != '') {
|
||||
// $array = explode(',', $array);
|
||||
// // calculamos el tiempo
|
||||
// $time = GetBuildingTime($user, $CurrentPlanet, $array[0]);
|
||||
// $totaltime += $time * $array[1];
|
||||
// $c .= "$time,";
|
||||
// $b .= "'{$lang['tech'][$array[0]]}',";
|
||||
// $a .= "{$array[1]},";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $parse = $lang;
|
||||
// $parse['a'] = $a;
|
||||
// $parse['b'] = $b;
|
||||
// $parse['c'] = $c;
|
||||
// $parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
|
||||
//
|
||||
// $parse['pretty_time_b_hangar'] = pretty_time($totaltime - $CurrentPlanet['b_hangar']); // //$CurrentPlanet['last_update']
|
||||
//
|
||||
// $text .= parsetemplate(gettemplate('buildings_script'), $parse);
|
||||
//
|
||||
// return $text;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $currentPlanet
|
||||
* @param unknown_type $currentUser
|
||||
*/
|
||||
function FleetBuildingPage(&$currentPlanet, &$currentUser)
|
||||
{
|
||||
global $lang, $resource, $dpath;
|
||||
|
||||
// S'il n'y a pas de Chantier
|
||||
if (!isset($currentPlanet[$resource[Legacies_Empire::ID_BUILDING_SHIPYARD]]) || $currentPlanet[$resource[Legacies_Empire::ID_BUILDING_SHIPYARD]] == 0) {
|
||||
message($lang['need_hangar'], $lang['tech'][Legacies_Empire::ID_BUILDING_SHIPYARD]);
|
||||
return;
|
||||
}
|
||||
|
||||
$shipyard = Legacies_Empire_Model_Planet_Building_Shipyard::factory($currentPlanet, $currentUser);
|
||||
if (isset($_POST['fmenge']) && is_array($_POST['fmenge'])) {
|
||||
foreach ($_POST['fmenge'] as $shipId => $count) {
|
||||
$shipId = intval($shipId);
|
||||
if (in_array($shipId, $resource)) {
|
||||
continue;
|
||||
}
|
||||
$count = intval($count);
|
||||
if ($count <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($shipId == Legacies_Empire::ID_SHIP_DEATH_STAR && $currentUser['rpg_destructeur'] == 1) { // FIXME: Officers
|
||||
$count = $count * 2;
|
||||
}
|
||||
|
||||
$shipyard->appendQueue($shipId, $count);
|
||||
}
|
||||
$currentPlanet = $shipyard->save();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
// Construction de la page du Chantier (car si j'arrive ici ... c'est que j'ai tout ce qu'il faut pour ...
|
||||
$tableIndex = 0;
|
||||
$types = include ROOT_PATH . 'includes/data/types.php';
|
||||
foreach ($types[Legacies_Empire::TYPE_SHIP] as $shipId) {
|
||||
if ($shipyard->checkAvailability($shipId)) {
|
||||
// Disponible à la construction
|
||||
|
||||
// On regarde si on peut en acheter au moins 1
|
||||
$CanBuildOne = IsElementBuyable($currentUser, $currentPlanet, $shipId, false);
|
||||
// On regarde combien de temps il faut pour construire l'element
|
||||
$BuildOneElementTime = $shipyard->getBuildTime($shipId, 1);
|
||||
// Disponibilité actuelle
|
||||
$shipIdCount = $currentPlanet[$resource[$shipId]];
|
||||
$shipIdNbre = ($shipIdCount == 0) ? "" : " (".$lang['dispo'].": " . pretty_number($shipIdCount) . ")";
|
||||
|
||||
// Construction des 3 cases de la ligne d'un element dans la page d'achat !
|
||||
// Début de ligne
|
||||
$PageTable .= "\n<tr>";
|
||||
|
||||
// Imagette + Link vers la page d'info
|
||||
$PageTable .= "<th class=l>";
|
||||
$PageTable .= "<a href=infos.".PHPEXT."?gid=".$shipId.">";
|
||||
$PageTable .= "<img border=0 src=\"".$dpath."gebaeude/".$shipId.".gif\" align=top width=120 height=120></a>";
|
||||
$PageTable .= "</th>";
|
||||
|
||||
// Description
|
||||
$PageTable .= "<td class=l>";
|
||||
$PageTable .= "<a href=infos.".PHPEXT."?gid=".$shipId.">".$shipIdName."</a> ".$shipIdNbre."<br />";
|
||||
$PageTable .= "".$lang['res']['descriptions'][$shipId]."<br />";
|
||||
// On affiche le 'prix' avec eventuellement ce qui manque en ressource
|
||||
$PageTable .= GetElementPrice($currentUser, $currentPlanet, $shipId, false);
|
||||
// On affiche le temps de construction (c'est toujours tellement plus joli)
|
||||
$PageTable .= ShowBuildTime($BuildOneElementTime);
|
||||
$PageTable .= "</td>";
|
||||
|
||||
// Case nombre d'elements a construire
|
||||
$PageTable .= "<th class=k>";
|
||||
// Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie
|
||||
if ($CanBuildOne) {
|
||||
$tableIndex++;
|
||||
$PageTable .= "<input type=text id=\"fmenge:{$shipId}\" name=fmenge[".$shipId."] alt='".$lang['tech'][$shipId]."' value=0 tabindex=".$tableIndex.">";
|
||||
}
|
||||
|
||||
$maxElements = $shipyard->getMaximumBuildableElementsCount($shipId);
|
||||
|
||||
if (MAX_FLEET_OR_DEFS_PER_ROW > 0 && $maxElements > MAX_FLEET_OR_DEFS_PER_ROW) {
|
||||
$maxElements = MAX_FLEET_OR_DEFS_PER_ROW;
|
||||
}
|
||||
|
||||
if ($CanBuildOne) {
|
||||
$PageTable .= '<br /><a onclick="document.getElementById(\'fmenge:'.$shipId.'\').value=\''.strval($maxElements).'\';" style="cursor:pointer;">Nombre max ('.number_format($maxElements, 0, ',', '.').')</a>';
|
||||
}
|
||||
|
||||
// Fin de ligne (les 3 cases sont construites !!
|
||||
$PageTable .= "</tr>";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($currentPlanet['b_hangar_id'])) {
|
||||
$data = array();
|
||||
foreach ($shipyard->getQueue() as $item) {
|
||||
$data[] = array_merge($item, array(
|
||||
'label' => $lang['tech'][$item['ship_id']],
|
||||
'speed' => $shipyard->getBuildTime($item['ship_id'], 1)
|
||||
));
|
||||
}
|
||||
$parse = array(
|
||||
'data' => json_encode($data)
|
||||
);
|
||||
$BuildQueue = parsetemplate(gettemplate('buildings_script'), $parse);
|
||||
}
|
||||
|
||||
$parse = $lang;
|
||||
// La page se trouve dans $PageTable;
|
||||
$parse['buildlist'] = $PageTable;
|
||||
// Et la liste de constructions en cours dans $BuildQueue;
|
||||
$parse['buildinglist'] = $BuildQueue;
|
||||
$page .= parsetemplate(gettemplate('buildings_fleet'), $parse);
|
||||
|
||||
display($page, $lang['Fleet']);
|
||||
}
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function HandleTechnologieBuild ( &$CurrentPlanet, &$CurrentUser ) {
|
||||
global $resource;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if ($CurrentUser['b_tech_planet'] != 0) {
|
||||
// Y a une technologie en cours sur une de mes colonies
|
||||
if ($CurrentUser['b_tech_planet'] != $CurrentPlanet['id']) {
|
||||
// Et ce n'est pas sur celle ci !!
|
||||
$WorkingPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $CurrentUser['b_tech_planet'] ."';", 'planets', true);
|
||||
}
|
||||
|
||||
if ($WorkingPlanet) {
|
||||
$ThePlanet = $WorkingPlanet;
|
||||
} else {
|
||||
$ThePlanet = $CurrentPlanet;
|
||||
}
|
||||
|
||||
if ($ThePlanet['b_tech'] <= time() &&
|
||||
$ThePlanet['b_tech_id'] != 0) {
|
||||
// La recherche en cours est terminée ...
|
||||
$CurrentUser[$resource[$ThePlanet['b_tech_id']]]++;
|
||||
// Mise a jour de la planete sur laquelle la technologie a été recherchée
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`b_tech` = '0', ";
|
||||
$QryUpdatePlanet .= "`b_tech_id` = '0' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`id` = '". $ThePlanet['id'] ."';";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
// Mes a jour de la techno sur l'enregistrement Utilisateur
|
||||
// Et tant qu'a faire des stats points
|
||||
$QryUpdateUser = "UPDATE {{table}} SET ";
|
||||
$QryUpdateUser .= "`".$resource[$ThePlanet['b_tech_id']]."` = '". $CurrentUser[$resource[$ThePlanet['b_tech_id']]] ."', ";
|
||||
$QryUpdateUser .= "`b_tech_planet` = '0' ";
|
||||
$QryUpdateUser .= "WHERE ";
|
||||
$QryUpdateUser .= "`id` = '". $CurrentUser['id'] ."';";
|
||||
doquery( $QryUpdateUser, 'users');
|
||||
$ThePlanet["b_tech_id"] = 0;
|
||||
if (isset($WorkingPlanet)) {
|
||||
$WorkingPlanet = $ThePlanet;
|
||||
} else {
|
||||
$CurrentPlanet = $ThePlanet;
|
||||
}
|
||||
$Result['WorkOn'] = "";
|
||||
$Result['OnWork'] = false;
|
||||
|
||||
} elseif ($ThePlanet["b_tech_id"] == 0) {
|
||||
// Il n'y a rien a l'ouest ...
|
||||
// Pas de Technologie en cours devait y avoir un bug lors de la derniere connexion
|
||||
// On met l'enregistrement informant d'une techno en cours de recherche a jours
|
||||
doquery("UPDATE {{table}} SET `b_tech_planet` = '0' WHERE `id` = '". $CurrentUser['id'] ."';", 'users');
|
||||
$Result['WorkOn'] = "";
|
||||
$Result['OnWork'] = false;
|
||||
|
||||
} else {
|
||||
// Bin on bosse toujours ici ... Alors ne nous derangez pas !!!
|
||||
$Result['WorkOn'] = $ThePlanet;
|
||||
$Result['OnWork'] = true;
|
||||
}
|
||||
} else {
|
||||
$Result['WorkOn'] = "";
|
||||
$Result['OnWork'] = false;
|
||||
}
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
// History revision
|
||||
// 1.0 - mise en forme modularisation version initiale
|
||||
// 1.1 - Correction retour de fonction (retourne un tableau a la place d'un flag)
|
||||
?>
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CallProgram
|
||||
*/
|
||||
function InsertBuildListScript($CallProgram)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $QueueID
|
||||
*/
|
||||
function RemoveBuildingFromQueue ( &$CurrentPlanet, $CurrentUser, $QueueID ) {
|
||||
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
if ($QueueID > 1) {
|
||||
$CurrentQueue = $CurrentPlanet['b_building_id'];
|
||||
if ($CurrentQueue != 0) {
|
||||
$QueueArray = explode ( ";", $CurrentQueue );
|
||||
$ActualCount = count ( $QueueArray );
|
||||
$ListIDArray = explode ( ",", $QueueArray[$QueueID - 2] );
|
||||
$BuildEndTime = $ListIDArray[3];
|
||||
$ListIDArray = explode ( ",", $QueueArray[$QueueID - 1] );
|
||||
$Element = $ListIDArray[0];
|
||||
for ($ID = $QueueID; $ID < $ActualCount; $ID++ ) {
|
||||
$ListIDArray = explode ( ",", $QueueArray[$ID] );
|
||||
if ($Element == $ListIDArray[0])
|
||||
{
|
||||
$ListIDArray[1] -= 1;
|
||||
$ListIDArray[2] = GetBuildingTimeLevel($CurrentUser, $CurrentPlanet, $ListIDArray[0], $ListIDArray[1]);
|
||||
}
|
||||
$BuildEndTime += $ListIDArray[2];
|
||||
$ListIDArray[3] = $BuildEndTime;
|
||||
$QueueArray[$ID - 1] = implode ( ",", $ListIDArray );
|
||||
}
|
||||
unset ($QueueArray[$ActualCount - 1]);
|
||||
$NewQueue = implode ( ";", $QueueArray );
|
||||
}
|
||||
$CurrentPlanet['b_building_id'] = $NewQueue;
|
||||
}
|
||||
|
||||
return $QueueID;
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,218 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $InResearch
|
||||
* @param unknown_type $ThePlanet
|
||||
*/
|
||||
function ResearchBuildingPage (&$CurrentPlanet, $CurrentUser, $InResearch, $ThePlanet)
|
||||
{
|
||||
global $lang, $resource, $reslist, $dpath, $gameConfig, $_GET;
|
||||
|
||||
$NoResearchMessage = "";
|
||||
$bContinue = true;
|
||||
// Deja est qu'il y a un laboratoire sur la planete ???
|
||||
if ($CurrentPlanet[$resource[31]] == 0) {
|
||||
message($lang['no_laboratory'], $lang['Research']);
|
||||
}
|
||||
// Ensuite ... Est ce que la labo est en cours d'upgrade ?
|
||||
if (!CheckLabSettingsInQueue ( $CurrentPlanet )) {
|
||||
$NoResearchMessage = $lang['labo_on_update'];
|
||||
$bContinue = false;
|
||||
}
|
||||
|
||||
// Boucle d'interpretation des eventuelles commandes
|
||||
if (isset($_GET['cmd'])) {
|
||||
$TheCommand = $_GET['cmd'];
|
||||
$Techno = $_GET['tech'];
|
||||
if ( is_numeric($Techno) ) {
|
||||
if ( in_array($Techno, $reslist['tech']) ) {
|
||||
// Bon quand on arrive ici ... On sait deja qu'on a une technologie valide
|
||||
if ( is_array ($ThePlanet) ) {
|
||||
$WorkingPlanet = $ThePlanet;
|
||||
} else {
|
||||
$WorkingPlanet = $CurrentPlanet;
|
||||
}
|
||||
switch($TheCommand){
|
||||
case 'cancel':
|
||||
if ($ThePlanet['b_tech_id'] == $Techno) {
|
||||
$costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
|
||||
$WorkingPlanet['metal'] += $costs['metal'];
|
||||
$WorkingPlanet['crystal'] += $costs['crystal'];
|
||||
$WorkingPlanet['deuterium'] += $costs['deuterium'];
|
||||
$WorkingPlanet['b_tech_id'] = 0;
|
||||
$WorkingPlanet["b_tech"] = 0;
|
||||
$CurrentUser['b_tech_planet'] = 0;
|
||||
$UpdateData = true;
|
||||
$InResearch = false;
|
||||
}
|
||||
break;
|
||||
case 'search':
|
||||
if ( IsTechnologieAccessible($CurrentUser, $WorkingPlanet, $Techno) &&
|
||||
IsElementBuyable($CurrentUser, $WorkingPlanet, $Techno) ) {
|
||||
$costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
|
||||
$WorkingPlanet['metal'] -= $costs['metal'];
|
||||
$WorkingPlanet['crystal'] -= $costs['crystal'];
|
||||
$WorkingPlanet['deuterium'] -= $costs['deuterium'];
|
||||
$WorkingPlanet["b_tech_id"] = $Techno;
|
||||
$WorkingPlanet["b_tech"] = time() + GetBuildingTime($CurrentUser, $WorkingPlanet, $Techno);
|
||||
$CurrentUser["b_tech_planet"] = $WorkingPlanet["id"];
|
||||
$UpdateData = true;
|
||||
$InResearch = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($UpdateData == true) {
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`b_tech_id` = '". $WorkingPlanet['b_tech_id'] ."', ";
|
||||
$QryUpdatePlanet .= "`b_tech` = '". $WorkingPlanet['b_tech'] ."', ";
|
||||
$QryUpdatePlanet .= "`metal` = '". $WorkingPlanet['metal'] ."', ";
|
||||
$QryUpdatePlanet .= "`crystal` = '". $WorkingPlanet['crystal'] ."', ";
|
||||
$QryUpdatePlanet .= "`deuterium` = '". $WorkingPlanet['deuterium'] ."' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`id` = '". $WorkingPlanet['id'] ."';";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
$QryUpdateUser = "UPDATE {{table}} SET ";
|
||||
$QryUpdateUser .= "`b_tech_planet` = '". $CurrentUser['b_tech_planet'] ."' ";
|
||||
$QryUpdateUser .= "WHERE ";
|
||||
$QryUpdateUser .= "`id` = '". $CurrentUser['id'] ."';";
|
||||
doquery( $QryUpdateUser, 'users');
|
||||
}
|
||||
if ( is_array ($ThePlanet) ) {
|
||||
$ThePlanet = $WorkingPlanet;
|
||||
} else {
|
||||
$CurrentPlanet = $WorkingPlanet;
|
||||
if ($TheCommand == 'search') {
|
||||
$ThePlanet = $CurrentPlanet;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$bContinue = false;
|
||||
}
|
||||
}
|
||||
|
||||
$TechRowTPL = gettemplate('buildings_research_row');
|
||||
$TechScrTPL = gettemplate('buildings_research_script');
|
||||
|
||||
foreach($lang['tech'] as $Tech => $TechName) {
|
||||
if ($Tech > 105 && $Tech <= 199) {
|
||||
if ( IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
|
||||
$RowParse = $lang;
|
||||
$RowParse['dpath'] = $dpath;
|
||||
$RowParse['tech_id'] = $Tech;
|
||||
$building_level = $CurrentUser[$resource[$Tech]];
|
||||
$RowParse['tech_level'] = ($building_level == 0) ? "" : "( ". $lang['level']. " ".$building_level." )";
|
||||
$RowParse['tech_name'] = $TechName;
|
||||
$RowParse['tech_descr'] = $lang['res']['descriptions'][$Tech];
|
||||
$RowParse['tech_price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Tech);
|
||||
$SearchTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Tech);
|
||||
$RowParse['search_time'] = ShowBuildTime($SearchTime);
|
||||
$RowParse['tech_restp'] = $lang['Rest_ress'] ." ". GetRestPrice ($CurrentUser, $CurrentPlanet, $Tech, true);
|
||||
$CanBeDone = IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech);
|
||||
|
||||
// Arbre de decision de ce que l'on met dans la derniere case de la ligne
|
||||
if (!$InResearch) {
|
||||
$LevelToDo = 1 + $CurrentUser[$resource[$Tech]];
|
||||
if ($CanBeDone) {
|
||||
if (!CheckLabSettingsInQueue ( $CurrentPlanet )) {
|
||||
// Le laboratoire est cours de construction ou d'evolution
|
||||
// Et dans la config du systeme, on ne permet pas la recherche pendant
|
||||
// que le labo est en construction ou evolution !
|
||||
if ($LevelToDo == 1) {
|
||||
$TechnoLink = "<font color=#FF0000>". $lang['Rechercher'] ."</font>";
|
||||
} else {
|
||||
$TechnoLink = "<font color=#FF0000>". $lang['Rechercher'] ."<br>".$lang['level']." ".$LevelToDo."</font>";
|
||||
}
|
||||
} else {
|
||||
$TechnoLink = "<a href=\"buildings.php?mode=research&cmd=search&tech=".$Tech."\">";
|
||||
if ($LevelToDo == 1) {
|
||||
$TechnoLink .= "<font color=#00FF00>". $lang['Rechercher'] ."</font>";
|
||||
} else {
|
||||
$TechnoLink .= "<font color=#00FF00>". $lang['Rechercher'] ."<br>".$lang['level']." ".$LevelToDo."</font>";
|
||||
}
|
||||
$TechnoLink .= "</a>";
|
||||
}
|
||||
} else {
|
||||
if ($LevelToDo == 1) {
|
||||
$TechnoLink = "<font color=#FF0000>". $lang['Rechercher'] ."</font>";
|
||||
} else {
|
||||
$TechnoLink = "<font color=#FF0000>". $lang['Rechercher'] ."<br>".$lang['level']." ".$LevelToDo."</font>";
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Y a une construction en cours
|
||||
if ($ThePlanet["b_tech_id"] == $Tech) {
|
||||
// C'est le technologie en cours de recherche
|
||||
$bloc = $lang;
|
||||
if ($ThePlanet['id'] != $CurrentPlanet['id']) {
|
||||
// Ca se passe sur une autre planete
|
||||
$bloc['tech_time'] = $ThePlanet["b_tech"] - time();
|
||||
$bloc['tech_name'] = $lang['on'] ."<br>". $ThePlanet["name"];
|
||||
$bloc['tech_home'] = $ThePlanet["id"];
|
||||
$bloc['tech_id'] = $ThePlanet["b_tech_id"];
|
||||
} else {
|
||||
// Ca se passe sur la planete actuelle
|
||||
$bloc['tech_time'] = $CurrentPlanet["b_tech"] - time();
|
||||
$bloc['tech_name'] = "";
|
||||
$bloc['tech_home'] = $CurrentPlanet["id"];
|
||||
$bloc['tech_id'] = $CurrentPlanet["b_tech_id"];
|
||||
}
|
||||
$TechnoLink = parsetemplate($TechScrTPL, $bloc);
|
||||
} else {
|
||||
// Technologie pas en cours recherche
|
||||
$TechnoLink = "<center>-</center>";
|
||||
}
|
||||
}
|
||||
$RowParse['tech_link'] = $TechnoLink;
|
||||
$TechnoList .= parsetemplate($TechRowTPL, $RowParse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$PageParse = $lang;
|
||||
$PageParse['noresearch'] = $NoResearchMessage;
|
||||
$PageParse['technolist'] = $TechnoList;
|
||||
$Page .= parsetemplate(gettemplate('buildings_research'), $PageParse);
|
||||
|
||||
display( $Page, $lang['Research'] );
|
||||
}
|
||||
|
||||
// History revision
|
||||
// 1.0 - Release initiale / modularisation / Reecriture / Commentaire / Mise en forme
|
||||
// 1.1 - BUG affichage de la techno en cours
|
||||
// 1.2 - Restructuration modification pour permettre d'annuller proprement une techno en cours
|
||||
?>
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function SetNextQueueElementOnTop ( &$CurrentPlanet, $CurrentUser ) {
|
||||
global $lang, $resource;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
// Garde fou ... Si le temps de construction n'est pas 0 on ne fait rien !!!
|
||||
if ($CurrentPlanet['b_building'] == 0) {
|
||||
$CurrentQueue = $CurrentPlanet['b_building_id'];
|
||||
if ($CurrentQueue != 0) {
|
||||
$QueueArray = explode ( ";", $CurrentQueue );
|
||||
$Loop = true;
|
||||
while ($Loop == true) {
|
||||
$ListIDArray = explode ( ",", $QueueArray[0] );
|
||||
$Element = $ListIDArray[0];
|
||||
$Level = $ListIDArray[1];
|
||||
$BuildTime = $ListIDArray[2];
|
||||
$BuildEndTime = $ListIDArray[3];
|
||||
$BuildMode = $ListIDArray[4]; // pour savoir si on construit ou detruit
|
||||
$HaveNoMoreLevel = false;
|
||||
|
||||
if ($BuildMode == 'destroy') {
|
||||
$ForDestroy = true;
|
||||
} else {
|
||||
$ForDestroy = false;
|
||||
}
|
||||
$HaveRessources = IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
|
||||
if ($ForDestroy) {
|
||||
if ($CurrentPlanet[$resource[$Element]] == 0) {
|
||||
$HaveRessources = false;
|
||||
$HaveNoMoreLevel = true;
|
||||
}
|
||||
}
|
||||
if ( $HaveRessources == true ) {
|
||||
$Needed = GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
|
||||
$CurrentPlanet['metal'] -= $Needed['metal'];
|
||||
$CurrentPlanet['crystal'] -= $Needed['crystal'];
|
||||
$CurrentPlanet['deuterium'] -= $Needed['deuterium'];
|
||||
$CurrentTime = time();
|
||||
$BuildEndTime = $BuildEndTime;
|
||||
$NewQueue = implode ( ";", $QueueArray );
|
||||
if ($NewQueue == "") {
|
||||
$NewQueue = '0';
|
||||
}
|
||||
$Loop = false;
|
||||
} else {
|
||||
$ElementName = $lang['tech'][$Element];
|
||||
if ($HaveNoMoreLevel == true) {
|
||||
$Message = sprintf ($lang['sys_nomore_level'], $ElementName );
|
||||
} else {
|
||||
$Needed = GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
|
||||
$Message = sprintf ($lang['sys_notenough_money'], $ElementName,
|
||||
pretty_number ($CurrentPlanet['metal']), $lang['Metal'],
|
||||
pretty_number ($CurrentPlanet['crystal']), $lang['Crystal'],
|
||||
pretty_number ($CurrentPlanet['deuterium']), $lang['Deuterium'],
|
||||
pretty_number ($Needed['metal']), $lang['Metal'],
|
||||
pretty_number ($Needed['crystal']), $lang['Crystal'],
|
||||
pretty_number ($Needed['deuterium']), $lang['Deuterium']);
|
||||
}
|
||||
|
||||
SendSimpleMessage ( $CurrentUser['id'], '', '', 99, $lang['sys_buildlist'], $lang['sys_buildlist_fail'], $Message);
|
||||
|
||||
array_shift( $QueueArray );
|
||||
$ActualCount = count ( $QueueArray );
|
||||
if ( $ActualCount == 0 ) {
|
||||
$BuildEndTime = '0';
|
||||
$NewQueue = '0';
|
||||
$Loop = false;
|
||||
}
|
||||
}
|
||||
} // while
|
||||
} else {
|
||||
$BuildEndTime = '0';
|
||||
$NewQueue = '0';
|
||||
}
|
||||
|
||||
// Ecriture de la mise a jour dans la BDD
|
||||
$CurrentPlanet['b_building'] = $BuildEndTime;
|
||||
$CurrentPlanet['b_building_id'] = $NewQueue;
|
||||
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`metal` = '". $CurrentPlanet['metal'] ."' , ";
|
||||
$QryUpdatePlanet .= "`crystal` = '". $CurrentPlanet['crystal'] ."' , ";
|
||||
$QryUpdatePlanet .= "`deuterium` = '". $CurrentPlanet['deuterium'] ."' , ";
|
||||
$QryUpdatePlanet .= "`b_building` = '". $CurrentPlanet['b_building'] ."' , ";
|
||||
$QryUpdatePlanet .= "`b_building_id` = '". $CurrentPlanet['b_building_id'] ."' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function SetSelectedPlanet ( &$CurrentUser )
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
if (!isset($_GET['cp']) || !isset($_GET['re'])) {
|
||||
return;
|
||||
}
|
||||
$SelectPlanet = $_GET['cp'];
|
||||
$RestorePlanet = $_GET['re'];
|
||||
|
||||
if (isset($SelectPlanet) &&
|
||||
is_numeric($SelectPlanet) &&
|
||||
isset($RestorePlanet) &&
|
||||
$RestorePlanet == 0) {
|
||||
$IsPlanetMine = doquery("SELECT `id` FROM {{table}} WHERE `id` = '". $SelectPlanet ."' AND `id_owner` = '". $CurrentUser['id'] ."';", 'planets', true);
|
||||
if ($IsPlanetMine) {
|
||||
// Ouaip elle est a moi ... Donc ... on met la met comme planete courrante
|
||||
$CurrentUser['current_planet'] = $SelectPlanet;
|
||||
// Puis tant qu'a faire ... On l'enregistre aussi sait on jamais
|
||||
doquery("UPDATE {{table}} SET `current_planet` = '". $SelectPlanet ."' WHERE `id` = '".$CurrentUser['id']."';", 'users');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function ShowBuildingQueue ( $CurrentPlanet, $CurrentUser ) {
|
||||
global $lang;
|
||||
|
||||
$CurrentQueue = $CurrentPlanet['b_building_id'];
|
||||
$QueueID = 0;
|
||||
if ($CurrentQueue != 0) {
|
||||
// Queue de fabrication documentée ... Y a au moins 1 element a construire !
|
||||
$QueueArray = explode ( ";", $CurrentQueue );
|
||||
// Compte le nombre d'elements
|
||||
$ActualCount = count ( $QueueArray );
|
||||
} else {
|
||||
// Queue de fabrication vide
|
||||
$QueueArray = "0";
|
||||
$ActualCount = 0;
|
||||
}
|
||||
|
||||
$ListIDRow = "";
|
||||
if ($ActualCount != 0) {
|
||||
$PlanetID = $CurrentPlanet['id'];
|
||||
for ($QueueID = 0; $QueueID < $ActualCount; $QueueID++) {
|
||||
// Chaque element de la liste de fabrication est un tableau de 5 données
|
||||
// [0] -> Le batiment
|
||||
// [1] -> Le niveau du batiment
|
||||
// [2] -> La durée de construction
|
||||
// [3] -> L'heure théorique de fin de construction
|
||||
// [4] -> type d'action
|
||||
$BuildArray = explode (",", $QueueArray[$QueueID]);
|
||||
$BuildEndTime = floor($BuildArray[3]);
|
||||
$CurrentTime = floor(time());
|
||||
if ($BuildEndTime >= $CurrentTime) {
|
||||
$ListID = $QueueID + 1;
|
||||
$Element = $BuildArray[0];
|
||||
$BuildLevel = $BuildArray[1];
|
||||
$BuildMode = $BuildArray[4];
|
||||
$BuildTime = $BuildEndTime - time();
|
||||
$ElementTitle = $lang['tech'][$Element];
|
||||
|
||||
if ($ListID > 0) {
|
||||
$ListIDRow .= "<tr>";
|
||||
if ($BuildMode == 'build') {
|
||||
$ListIDRow .= " <td class=\"l\" colspan=\"2\">". $ListID .".: ". $ElementTitle ." ". $BuildLevel ."</td>";
|
||||
} else {
|
||||
$ListIDRow .= " <td class=\"l\" colspan=\"2\">". $ListID .".: ". $ElementTitle ." ". $BuildLevel ." ". $lang['destroy'] ."</td>";
|
||||
}
|
||||
$ListIDRow .= " <td class=\"k\">";
|
||||
if ($ListID == 1) {
|
||||
$ListIDRow .= " <div id=\"blc\" class=\"z\">". $BuildTime ."<br>";
|
||||
$ListIDRow .= " <a href=\"buildings.php?listid=". $ListID ."&cmd=cancel&planet=". $PlanetID ."\">". $lang['DelFirstQueue'] ."</a></div>";
|
||||
$ListIDRow .= " <script language=\"JavaScript\">";
|
||||
$ListIDRow .= " pp = \"". $BuildTime ."\";\n"; // temps necessaire (a compter de maintenant et sans ajouter time() )
|
||||
$ListIDRow .= " pk = \"". $ListID ."\";\n"; // id index (dans la liste de construction)
|
||||
$ListIDRow .= " pm = \"cancel\";\n"; // mot de controle
|
||||
$ListIDRow .= " pl = \"". $PlanetID ."\";\n"; // id planete
|
||||
$ListIDRow .= " t();\n";
|
||||
$ListIDRow .= " </script>";
|
||||
$ListIDRow .= " <strong color=\"lime\"><br><font color=\"lime\">". date("j/m H:i:s" ,$BuildEndTime) ."</font></strong>";
|
||||
} else {
|
||||
$ListIDRow .= " <font color=\"red\">";
|
||||
$ListIDRow .= " <a href=\"buildings.php?listid=". $ListID ."&cmd=remove&planet=". $PlanetID ."\">". $lang['DelFromQueue'] ."</a></font>";
|
||||
}
|
||||
$ListIDRow .= " </td>";
|
||||
$ListIDRow .= "</tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$RetValue['lenght'] = $ActualCount;
|
||||
$RetValue['buildlist'] = $ListIDRow;
|
||||
|
||||
return $RetValue;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $CurrentPlanet
|
||||
*/
|
||||
function ShowTopNavigationBar ( $CurrentUser, $CurrentPlanet ) {
|
||||
global $lang, $_GET;
|
||||
|
||||
// debug_print_backtrace();
|
||||
|
||||
if ($CurrentUser) {
|
||||
if ( !$CurrentPlanet ) {
|
||||
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $CurrentUser['current_planet'] ."';", 'planets', true);
|
||||
}
|
||||
|
||||
// Actualisation des ressources de la planete
|
||||
|
||||
$NavigationTPL = gettemplate('topnav');
|
||||
|
||||
$dpath = (!$CurrentUser["dpath"]) ? DEFAULT_SKINPATH : $CurrentUser["dpath"];
|
||||
$parse = $lang;
|
||||
$parse['dpath'] = $dpath;
|
||||
$parse['image'] = $CurrentPlanet['image'];
|
||||
|
||||
// Genearation de la combo des planetes du joueur
|
||||
$parse['planetlist'] = '';
|
||||
$ThisUsersPlanets = SortUserPlanets ( $CurrentUser );
|
||||
while ($CurPlanet = $ThisUsersPlanets->fetch(PDO::FETCH_BOTH)) {
|
||||
if ($CurPlanet["destruyed"] == 0) {
|
||||
$parse['planetlist'] .= "\n<option ";
|
||||
if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
|
||||
// Bon puisque deja on s'y trouve autant le marquer
|
||||
$parse['planetlist'] .= "selected=\"selected\" ";
|
||||
}
|
||||
$parse['planetlist'] .= "value=\"?cp=".$CurPlanet['id']."";
|
||||
$parse['planetlist'] .= "&mode=".$_GET['mode'];
|
||||
$parse['planetlist'] .= "&re=0\">";
|
||||
|
||||
// Nom et coordonnées de la planete
|
||||
$parse['planetlist'] .= "".$CurPlanet['name'];
|
||||
$parse['planetlist'] .= " [".$CurPlanet['galaxy'].":";
|
||||
$parse['planetlist'] .= "".$CurPlanet['system'].":";
|
||||
$parse['planetlist'] .= "".$CurPlanet['planet'];
|
||||
$parse['planetlist'] .= "] </option>";
|
||||
}
|
||||
}
|
||||
|
||||
$energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
|
||||
// Energie
|
||||
if (($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) < 0) {
|
||||
$parse['energy'] = colorRed($energy);
|
||||
} else {
|
||||
$parse['energy'] = $energy;
|
||||
}
|
||||
// Metal
|
||||
$metal = pretty_number($CurrentPlanet["metal"]);
|
||||
if (($CurrentPlanet["metal"] > $CurrentPlanet["metal_max"])) {
|
||||
$parse['metal'] = colorRed($metal);
|
||||
} else {
|
||||
$parse['metal'] = $metal;
|
||||
}
|
||||
// Cristal
|
||||
$crystal = pretty_number($CurrentPlanet["crystal"]);
|
||||
if (($CurrentPlanet["crystal"] > $CurrentPlanet["crystal_max"])) {
|
||||
$parse['crystal'] = colorRed($crystal);
|
||||
} else {
|
||||
$parse['crystal'] = $crystal;
|
||||
}
|
||||
// Deuterium
|
||||
$deuterium = pretty_number($CurrentPlanet["deuterium"]);
|
||||
if (($CurrentPlanet["deuterium"] > $CurrentPlanet["deuterium_max"])) {
|
||||
$parse['deuterium'] = colorRed($deuterium);
|
||||
} else {
|
||||
$parse['deuterium'] = $deuterium;
|
||||
}
|
||||
|
||||
// Message
|
||||
if ($CurrentUser['new_message'] > 0) {
|
||||
$parse['message'] = "<a href=\"messages.php\">[ ". $CurrentUser['new_message'] ." ]</a>";
|
||||
} else {
|
||||
$parse['message'] = "0";
|
||||
}
|
||||
|
||||
// Le tout passe dans la template
|
||||
$TopBar = parsetemplate( $NavigationTPL, $parse);
|
||||
} else {
|
||||
$TopBar = "";
|
||||
}
|
||||
|
||||
return $TopBar;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -80,26 +80,26 @@ include(ROOT_PATH . 'includes/functions/ShowGalaxyMISelector.'.PHPEXT);
|
|||
include(ROOT_PATH . 'includes/functions/ShowGalaxyTitles.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyLegendPopup.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ShowGalaxyFooter.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GetMaxConstructibleElements.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/GetMaxConstructibleElements.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/GetElementRessources.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/ElementBuildListBox.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ElementBuildListQueue.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/FleetBuildingPage.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/DefensesBuildingPage.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ResearchBuildingPage.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/BatimentBuildingPage.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/CheckLabSettingsInQueue.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/InsertBuildListScript.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/ElementBuildListQueue.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/FleetBuildingPage.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/DefensesBuildingPage.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/ResearchBuildingPage.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/BatimentBuildingPage.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/CheckLabSettingsInQueue.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/InsertBuildListScript.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/AddBuildingToQueue.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ShowBuildingQueue.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/HandleTechnologieBuild.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/ShowBuildingQueue.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/HandleTechnologieBuild.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/BuildingSavePlanetRecord.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/BuildingSaveUserRecord.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/RemoveBuildingFromQueue.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/RemoveBuildingFromQueue.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/CancelBuildingFromQueue.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/SetNextQueueElementOnTop.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ShowTopNavigationBar.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/SetSelectedPlanet.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/SetNextQueueElementOnTop.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/ShowTopNavigationBar.'.PHPEXT);
|
||||
//include(ROOT_PATH . 'includes/functions/SetSelectedPlanet.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MessageForm.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/BuildFlyingFleetTable.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/SendNewPassword.'.PHPEXT);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
ALTER TABLE `game_planets`
|
||||
CHANGE `metal` `metal` DECIMAL( 20, 0 ) NOT NULL DEFAULT '0.00000000',
|
||||
CHANGE `metal_perhour` `metal_perhour` DECIMAL( 20, 0 ) NOT NULL DEFAULT '0',
|
||||
CHANGE `metal_max` `metal_max` DECIMAL( 20, 0 ) NOT NULL DEFAULT '100000',
|
||||
CHANGE `crystal` `cristal` DECIMAL( 20, 0 ) NOT NULL DEFAULT '0.00000000',
|
||||
CHANGE `crystal_perhour` `cristal_perhour` DECIMAL( 20, 0 ) NOT NULL DEFAULT '0',
|
||||
CHANGE `crystal_max` `cristal_max` DECIMAL( 20, 0 ) NOT NULL DEFAULT '100000',
|
||||
CHANGE `deuterium` `deuterium` DECIMAL( 20, 0 ) NOT NULL DEFAULT '0.00000000',
|
||||
CHANGE `deuterium_perhour` `deuterium_perhour` DECIMAL( 20, 0 ) NOT NULL DEFAULT '0',
|
||||
CHANGE `deuterium_max` `deuterium_max` DECIMAL( 20, 0 ) NOT NULL DEFAULT '100000',
|
||||
CHANGE `energy_used` `energy_used` DECIMAL( 20, 0 ) NOT NULL DEFAULT '0',
|
||||
CHANGE `energy_max` `energy_max` DECIMAL( 20, 0 ) NOT NULL DEFAULT '0',
|
||||
CHANGE `metal` `metal` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `metal_perhour` `metal_perhour` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `metal_max` `metal_max` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `crystal` `cristal` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `crystal_perhour` `cristal_perhour` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `crystal_max` `cristal_max` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `deuterium` `deuterium` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `deuterium_perhour` `deuterium_perhour` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `deuterium_max` `deuterium_max` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `energy_used` `energy_used` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `energy_max` `energy_max` DECIMAL( 20, 0 ) UNSIGNED NOT NULL DEFAULT '0',
|
||||
CHANGE `crystal_mine` `cristal_mine` INT( 11 ) NOT NULL DEFAULT '0',
|
||||
CHANGE `crystal_store` `cristal_store` INT( 11 ) NOT NULL DEFAULT '0',
|
||||
CHANGE `crystal_mine_porcent` `cristal_mine_porcent` INT( 11 ) NOT NULL DEFAULT '10';
|
||||
|
|
|
|||
49
login.php
49
login.php
|
|
@ -28,9 +28,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('LOGIN' , true);
|
||||
define('INSIDE', true);
|
||||
define('INSTALL', false);
|
||||
define('DISABLE_IDENTITY_CHECK', true);
|
||||
require_once dirname(__FILE__) . '/common.php';
|
||||
|
||||
|
|
@ -40,7 +39,7 @@ if (!empty($_POST) && isset($_POST['username']) && isset($_POST['password'])) {
|
|||
$user = Legacies_Empire_Model_User::login($_POST['username'], $_POST['password'], isset($_POST['rememberme']) && !empty($_POST['rememberme']));
|
||||
|
||||
$session = Legacies::getSession(Legacies_Empire_Model_User::SESSION_KEY);
|
||||
if ($user !== null) {
|
||||
if ($user !== null && $user->getId()) {
|
||||
header("Location: frames.php");
|
||||
} else {
|
||||
header("Location: login.php");
|
||||
|
|
@ -48,18 +47,36 @@ if (!empty($_POST) && isset($_POST['username']) && isset($_POST['password'])) {
|
|||
Legacies_Core_ErrorProfiler::unregister(true);
|
||||
exit(0);
|
||||
}
|
||||
$parse = $lang;
|
||||
$Count = doquery('SELECT COUNT(DISTINCT users.id) AS `players` FROM {{table}} AS users WHERE users.authlevel < 3', 'users', true);
|
||||
$LastPlayer = doquery('SELECT users.`username` FROM {{table}} AS users ORDER BY `register_time` DESC LIMIT 1', 'users', true);
|
||||
$parse['last_user'] = $LastPlayer['username'];
|
||||
$PlayersOnline = doquery("SELECT COUNT(DISTINCT id) AS `onlinenow` FROM {{table}} AS users WHERE `onlinetime` > (UNIX_TIMESTAMP()-900) AND users.authlevel < 3", 'users', true);
|
||||
$parse['online_users'] = $PlayersOnline['onlinenow'];
|
||||
$parse['users_amount'] = $Count['players'];
|
||||
$parse['servername'] = $gameConfig['game_name'];
|
||||
$parse['forum_url'] = $gameConfig['forum_url'];
|
||||
$parse['PasswordLost'] = $lang['PasswordLost'];
|
||||
|
||||
$page = parsetemplate(gettemplate('login_body'), $parse);
|
||||
$db = Legacies_Database::getSingleton();
|
||||
$displayedPlayerLevels = implode(',', array(
|
||||
//LEVEL_ADMIN,
|
||||
LEVEL_OPERATOR,
|
||||
LEVEL_MODERATOR,
|
||||
LEVEL_PLAYER
|
||||
));
|
||||
$userCountStatement = $db->prepare("SELECT COUNT(DISTINCT user.id) AS `user_count` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels})");
|
||||
$userCountStatement->execute();
|
||||
$userCount = $userCountStatement->fetch(Legacies_Database::FETCH_COLUMN, 0);
|
||||
|
||||
display($page, $lang['Login'], false);
|
||||
$latestPlayerStatement = $db->prepare("SELECT user.username AS `latest_player` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels}) ORDER BY user.`register_time` DESC LIMIT 1");
|
||||
$latestPlayerStatement->execute();
|
||||
$latestPlayer = $latestPlayerStatement->fetch(Legacies_Database::FETCH_COLUMN, 0);
|
||||
|
||||
$onlinePlayersStatement = $db->prepare("SELECT COUNT(DISTINCT user.id) AS `online_players` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels}) AND user.`onlinetime` > (UNIX_TIMESTAMP() - 900)");
|
||||
$onlinePlayersStatement->execute();
|
||||
$onlinePlayers = $onlinePlayersStatement->fetch(Legacies_Database::FETCH_COLUMN, 0);
|
||||
|
||||
$layout = new Legacies_Core_Layout();
|
||||
$layout->load('login');
|
||||
$block = $layout->getBlock('login');
|
||||
|
||||
$block['user_count'] = $userCount;
|
||||
$block['latest_player'] = $latestPlayer;
|
||||
$block['online_players'] = $onlinePlayers;
|
||||
|
||||
$block['server_name'] = $gameConfig['game_name'];
|
||||
$block['board_url'] = $gameConfig['forum_url'];
|
||||
|
||||
echo $layout->render();
|
||||
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ if (isset($_POST) && !empty($_POST)) {
|
|||
// Rajout d'une barre pourcentage
|
||||
// Calcul du pourcentage de remplissage
|
||||
// Barre de remplissage
|
||||
$size = Math::floor(Math::div($planet->getBuildingFields(), $planet->getUsedFields()) * 100);
|
||||
$size = Math::floor(Math::div($planet->getUsedFields(), $planet->getBuildingFields()) * 100);
|
||||
// Couleur de la barre de remplissage
|
||||
$parse['case_pourcentage'] = $size . $lang['o/o'];
|
||||
if (Math::comp($size, 100) > 0) {
|
||||
|
|
|
|||
249
reg.php
249
reg.php
|
|
@ -28,16 +28,46 @@
|
|||
*
|
||||
*/
|
||||
|
||||
define('INSIDE' , true);
|
||||
define('INSTALL' , false);
|
||||
define('INSIDE', true);
|
||||
define('INSTALL', false);
|
||||
define('DISABLE_IDENTITY_CHECK', true);
|
||||
require_once dirname(__FILE__) .'/common.php';
|
||||
|
||||
//on demarre la session qui ne sers ici que pour le code de secu
|
||||
session_start();
|
||||
|
||||
includeLang('reg');
|
||||
|
||||
if (!empty($_POST) && isset($_POST['username']) && isset($_POST['planet_name']) && isset($_POST['email']) && isset($_POST['email_confirm']) && isset($_POST['password']) && isset($_POST['password_confirm'])) {
|
||||
$session = Legacies::getSession(Legacies_Empire_Model_User::SESSION_KEY);
|
||||
if ($_POST['password'] !== $_POST['password_confirm']) {
|
||||
$session->addError('Password and password confirmation does not match.');
|
||||
}
|
||||
if ($_POST['email'] !== $_POST['email_confirm']) {
|
||||
$session->addError('Email and email confirmation does not match.');
|
||||
}
|
||||
|
||||
$user = null;
|
||||
if (true || count($session->getMessages(false)) === 0) {
|
||||
$user = Legacies_Empire_Model_User::register($_POST['username'], $_POST['email'], $_POST['password']);
|
||||
|
||||
$user->getHomePlanet()->setName($_POST['planet_name']);
|
||||
}
|
||||
|
||||
if ($user !== null && $user->getId()) {
|
||||
header("HTTP/1.1 302 Found");
|
||||
header("Location: welcome.php");
|
||||
} else {
|
||||
header("HTTP/1.1 302 Found");
|
||||
header("Location: reg.php");
|
||||
}
|
||||
Legacies_Core_ErrorProfiler::unregister(true);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$layout = new Legacies_Core_Layout();
|
||||
$layout->load('registration');
|
||||
$block = $layout->getBlock('registration');
|
||||
|
||||
echo $layout->render();
|
||||
/*
|
||||
function sendpassemail($emailaddress, $password)
|
||||
{
|
||||
global $lang;
|
||||
|
|
@ -74,211 +104,4 @@ function mymail($to, $title, $body, $from = '')
|
|||
|
||||
return mail($to, $title, $body, $head);
|
||||
}
|
||||
|
||||
if ($_POST) {
|
||||
$errors = 0;
|
||||
$errorlist = "";
|
||||
|
||||
//si la secu est active
|
||||
|
||||
if ( $gameConfig['secu'] == 1 ){
|
||||
echo $_session['secu'];
|
||||
if (!$_POST['secu'] || $_POST['secu'] != $_SESSION['secu'] ) { $errorlist .= $lang['error_secu']; $errors++; }
|
||||
}
|
||||
|
||||
$_POST['email'] = strip_tags($_POST['email']);
|
||||
if (!is_email($_POST['email'])) {
|
||||
$errorlist .= "\"" . $_POST['email'] . "\" " . $lang['error_mail'];
|
||||
$errors++;
|
||||
}
|
||||
|
||||
if (!$_POST['planet']) {
|
||||
$errorlist .= $lang['error_planet'];
|
||||
$errors++;
|
||||
}
|
||||
|
||||
if (preg_match("/[^A-z0-9_\-]/", $_POST['hplanet']) == 1) {
|
||||
$errorlist .= $lang['error_planetnum'];
|
||||
$errors++;
|
||||
}
|
||||
|
||||
if (!$_POST['character']) {
|
||||
$errorlist .= $lang['error_character'];
|
||||
$errors++;
|
||||
}
|
||||
|
||||
if (strlen($_POST['passwrd']) < 4) {
|
||||
$errorlist .= $lang['error_password'];
|
||||
$errors++;
|
||||
}
|
||||
|
||||
if (preg_match("/[^A-z0-9_\-]/", $_POST['character']) == 1) {
|
||||
$errorlist .= $lang['error_charalpha'];
|
||||
$errors++;
|
||||
}
|
||||
|
||||
if ($_POST['rgt'] != 'on') {
|
||||
$errorlist .= $lang['error_rgt'];
|
||||
$errors++;
|
||||
}
|
||||
// Le meilleur moyen de voir si un nom d'utilisateur est pris c'est d'essayer de l'appeler !!
|
||||
$ExistUser = doquery("SELECT `username` FROM {{table}} WHERE `username` = '" . mysql_escape_string($_POST['character']) . "' LIMIT 1;", 'users', true);
|
||||
if ($ExistUser) {
|
||||
$errorlist .= $lang['error_userexist'];
|
||||
$errors++;
|
||||
}
|
||||
// Si l'on verifiait que l'adresse email n'existe pas encore ???
|
||||
$ExistMail = doquery("SELECT `email` FROM {{table}} WHERE `email` = '" . mysql_escape_string($_POST['email']) . "' LIMIT 1;", 'users', true);
|
||||
if ($ExistMail) {
|
||||
$errorlist .= $lang['error_emailexist'];
|
||||
$errors++;
|
||||
}
|
||||
|
||||
if ($_POST['sex'] != '' && $_POST['sex'] != 'F' && $_POST['sex'] != 'M') {
|
||||
$errorlist .= $lang['error_sex'];
|
||||
$errors++;
|
||||
}
|
||||
|
||||
if ($errors != 0) {
|
||||
message ($errorlist, $lang['Register']);
|
||||
} else {
|
||||
$newpass = $_POST['passwrd'];
|
||||
$UserName = CheckInputStrings ($_POST['character']);
|
||||
$UserEmail = CheckInputStrings ($_POST['email']);
|
||||
$UserPlanet = CheckInputStrings (addslashes($_POST['planet']));
|
||||
|
||||
$md5newpass = md5($newpass);
|
||||
// Creation de l'utilisateur
|
||||
$QryInsertUser = "INSERT INTO {{table}} SET ";
|
||||
$QryInsertUser .= "`username` = '" . mysql_escape_string(strip_tags($UserName)) . "', ";
|
||||
$QryInsertUser .= "`email` = '" . mysql_escape_string($UserEmail) . "', ";
|
||||
$QryInsertUser .= "`email_2` = '" . mysql_escape_string($UserEmail) . "', ";
|
||||
$QryInsertUser .= "`sex` = '" . mysql_escape_string($_POST['sex']) . "', ";
|
||||
$QryInsertUser .= "`ip_at_reg` = '" . $_SERVER["REMOTE_ADDR"] . "', ";
|
||||
$QryInsertUser .= "`id_planet` = '0', ";
|
||||
$QryInsertUser .= "`register_time` = '" . time() . "', ";
|
||||
$QryInsertUser .= "`password`='" . $md5newpass . "';";
|
||||
doquery($QryInsertUser, 'users');
|
||||
// On cherche le numero d'enregistrement de l'utilisateur fraichement cree
|
||||
$NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '" . mysql_escape_string($_POST['character']) . "' LIMIT 1;", 'users', true);
|
||||
$iduser = $NewUser['id'];
|
||||
// Recherche d'une place libre !
|
||||
$LastSettedGalaxyPos = $gameConfig['LastSettedGalaxyPos'];
|
||||
$LastSettedSystemPos = $gameConfig['LastSettedSystemPos'];
|
||||
$LastSettedPlanetPos = $gameConfig['LastSettedPlanetPos'];
|
||||
while (!isset($newpos_checked)) {
|
||||
for ($Galaxy = $LastSettedGalaxyPos; $Galaxy <= MAX_GALAXY_IN_WORLD; $Galaxy++) {
|
||||
for ($System = $LastSettedSystemPos; $System <= MAX_SYSTEM_IN_GALAXY; $System++) {
|
||||
for ($Posit = $LastSettedPlanetPos; $Posit <= 4; $Posit++) {
|
||||
$Planet = round (rand (4, 12));
|
||||
|
||||
switch ($LastSettedPlanetPos) {
|
||||
case 1:
|
||||
$LastSettedPlanetPos += 1;
|
||||
break;
|
||||
case 2:
|
||||
$LastSettedPlanetPos += 1;
|
||||
break;
|
||||
case 3:
|
||||
if ($LastSettedSystemPos == MAX_SYSTEM_IN_GALAXY) {
|
||||
$LastSettedGalaxyPos += 1;
|
||||
$LastSettedSystemPos = 1;
|
||||
$LastSettedPlanetPos = 1;
|
||||
break;
|
||||
} else {
|
||||
$LastSettedPlanetPos = 1;
|
||||
}
|
||||
$LastSettedSystemPos += 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$QrySelectGalaxy = "SELECT * ";
|
||||
$QrySelectGalaxy .= "FROM {{table}} ";
|
||||
$QrySelectGalaxy .= "WHERE ";
|
||||
$QrySelectGalaxy .= "`galaxy` = '" . $Galaxy . "' AND ";
|
||||
$QrySelectGalaxy .= "`system` = '" . $System . "' AND ";
|
||||
$QrySelectGalaxy .= "`planet` = '" . $Planet . "' ";
|
||||
$QrySelectGalaxy .= "LIMIT 1;";
|
||||
$GalaxyRow = doquery($QrySelectGalaxy, 'galaxy', true);
|
||||
|
||||
if ($GalaxyRow["id_planet"] == "0") {
|
||||
$newpos_checked = true;
|
||||
}
|
||||
|
||||
if (!$GalaxyRow) {
|
||||
CreateOnePlanetRecord ($Galaxy, $System, $Planet, $NewUser['id'], $UserPlanet, true);
|
||||
$newpos_checked = true;
|
||||
}
|
||||
if ($newpos_checked) {
|
||||
doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedGalaxyPos . "' WHERE `config_name` = 'LastSettedGalaxyPos';", 'config');
|
||||
doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedSystemPos . "' WHERE `config_name` = 'LastSettedSystemPos';", 'config');
|
||||
doquery("UPDATE {{table}} SET `config_value` = '" . $LastSettedPlanetPos . "' WHERE `config_name` = 'LastSettedPlanetPos';", 'config');
|
||||
}
|
||||
}
|
||||
// Recherche de la reference de la nouvelle planete (qui est unique normalement !
|
||||
$PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '" . $NewUser['id'] . "' LIMIT 1;", 'planets', true);
|
||||
// Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere
|
||||
$QryUpdateUser = "UPDATE {{table}} SET ";
|
||||
$QryUpdateUser .= "`id_planet` = '" . $PlanetID['id'] . "', ";
|
||||
$QryUpdateUser .= "`current_planet` = '" . $PlanetID['id'] . "', ";
|
||||
$QryUpdateUser .= "`galaxy` = '" . $Galaxy . "', ";
|
||||
$QryUpdateUser .= "`system` = '" . $System . "', ";
|
||||
$QryUpdateUser .= "`planet` = '" . $Planet . "' ";
|
||||
$QryUpdateUser .= "WHERE ";
|
||||
$QryUpdateUser .= "`id` = '" . $NewUser['id'] . "' ";
|
||||
$QryUpdateUser .= "LIMIT 1;";
|
||||
doquery($QryUpdateUser, 'users');
|
||||
// Envois d'un message in-game sympa ^^
|
||||
$from = $lang['sender_message_ig'];
|
||||
$sender = "Admin";
|
||||
$Subject = $lang['subject_message_ig'];
|
||||
$message = $lang['text_message_ig'];
|
||||
SendSimpleMessage($iduser, $sender, $Time, 1, $from, $Subject, $message);
|
||||
|
||||
// Mise a jour du nombre de joueurs inscripts
|
||||
doquery("UPDATE {{table}} SET `config_value` = `config_value` + '1' WHERE `config_name` = 'users_amount' LIMIT 1;", 'config');
|
||||
|
||||
$Message = $lang['thanksforregistry'];
|
||||
if (sendpassemail($_POST['email'], "$newpass")) {
|
||||
$Message .= " (" . htmlentities($_POST["email"]) . ")";
|
||||
} else {
|
||||
$Message .= " (" . htmlentities($_POST["email"]) . ")";
|
||||
$Message .= "<br><br>" . $lang['error_mailsend'] . " <b>" . $newpass . "</b>";
|
||||
}
|
||||
message($Message, $lang['reg_welldone']);
|
||||
}
|
||||
} elseif ( $gameConfig['secu'] == 1 ){
|
||||
|
||||
$parse = $lang;
|
||||
$_SESSION['nombre1']= rand(0,50);
|
||||
$_SESSION['nombre2']= rand(0,50);
|
||||
$_SESSION['secu'] = $_SESSION['nombre1'] + $_SESSION['nombre2'];
|
||||
|
||||
$parse['servername'] = '<img src="images/xnova.png" align="top" border="0" >';
|
||||
$parse['code_secu'] = "<th>Securite: </th>";
|
||||
$parse['affiche'] = $_SESSION['nombre1']." + ".$_SESSION['nombre2']." = <input name='secu' size='3' maxlength='3' type='text'>";
|
||||
$page = parsetemplate(gettemplate('registry_form'), $parse);
|
||||
|
||||
}else{
|
||||
|
||||
// Afficher le formulaire d'enregistrement
|
||||
$parse = $lang;
|
||||
$parse['code_secu'] = "";
|
||||
$parse['affiche'] = "";
|
||||
$parse['servername'] = '<img src="images/xnova.png" align="top" border="0" >';
|
||||
$page = parsetemplate(gettemplate('registry_form'), $parse);
|
||||
}
|
||||
display ($page, $lang['registry'], false);
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
// History version
|
||||
// 1.0 - Version originelle
|
||||
// 1.1 - Menage + rangement + utilisation fonction de creation planete nouvelle generation
|
||||
// 1.2 - Ajout securite activable ou non
|
||||
?>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ a:hover {
|
|||
position: relative;
|
||||
width: 886px;
|
||||
height: 580px;
|
||||
background-image: url(../images/tlo.jpg);
|
||||
background-image: url(../graphics/images/tlo.jpg);
|
||||
background-repeat: none;
|
||||
|
||||
}
|
||||
22
skin/default/css/legacies.css
Normal file
22
skin/default/css/legacies.css
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
@CHARSET "UTF-8";
|
||||
.global .content .resources-display {width:770px;height:40px;margin:0 auto 30px;padding:0 50px;color:#000;background:#FFF;box-shadow:0 -4px 6px #156 inset;border:1px solid #FFF;border-top:none;border-radius: 0 0 20px 20px;}
|
||||
.global .content .resources-display .resource,.global .content .resources-display .messages {height:22px;float:left;width:140px;margin:7px 0;}
|
||||
.global .content .resources-display .resource img,.global .content .resources-display .messages img {float:left;}
|
||||
.global .content .resources-display .resource p,.global .content .resources-display .messages p {font-weight:bold;font-size:12px;margin:2px 0 2px 47px;}
|
||||
.global .content .resources-display .resource a,.global .content .resources-display .messages a {color:#000;text-decoration:underline;}
|
||||
.global .content .resources-display .resource .resource-capped {color:red;}
|
||||
.global .content .resources-display .messages {height:22px;float:left;width:160px;}
|
||||
.global .content .resources-display .energy {width:190px;}
|
||||
|
||||
|
||||
.global .content .queue {width:600px;margin:10px auto 0;background:#FFF;color:#000;border:1px solid #FFF;border-radius:5px;border-top-left-radius:20px;border-top-right-radius:20px;box-shadow:0 4px 6px #156 inset;}
|
||||
.global .content .queue h1 {color:#000;margin:10px 15px;width:570px;text-align:center;border-bottom:5px solid #9BC;}
|
||||
|
||||
.global .content .queue .item {width:580px;margin:0 10px;border:0;box-shadow:none;border-radius:0;}
|
||||
.global .content .queue .item,.global .content .queue .item * {color:#000;}
|
||||
|
||||
.global .content .item-list {width:800px; margin:10px auto 0;background:#FFF;color:#000;border:1px solid #FFF;border-radius:5px;border-top-left-radius:20px;border-top-right-radius:20px;box-shadow:0 4px 6px #156 inset;}
|
||||
.global .content .item-list h1 {color:#000;margin:10px 15px;width:770px;text-align:center;border-bottom:5px solid #9BC;}
|
||||
|
||||
.global .content .item-list .item {width:780px;margin:0 10px;border:0;box-shadow:none;border-radius:0;}
|
||||
.global .content .item-list .item,.global .content .item-list .item * {color:#000;}
|
||||
|
Before Width: | Height: | Size: 842 B After Width: | Height: | Size: 842 B |
|
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 66 KiB |
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue