Initial commit
This commit is contained in:
commit
d7619777af
915 changed files with 59386 additions and 0 deletions
122
includes/CombatEngine.php
Normal file
122
includes/CombatEngine.php
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
$CombatCaps = array(
|
||||
202 => array ( 'shield' => 10, 'attack' => 5, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 1, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
203 => array ( 'shield' => 25, 'attack' => 5, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 1, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
204 => array ( 'shield' => 10, 'attack' => 50, 'sd' => array (202 => 2, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 1, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
205 => array ( 'shield' => 25, 'attack' => 150, 'sd' => array (202 => 3, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 1, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
206 => array ( 'shield' => 50, 'attack' => 400, 'sd' => array (202 => 1, 203 => 1, 204 => 6, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 10, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
207 => array ( 'shield' => 200, 'attack' => 1000, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 8, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
208 => array ( 'shield' => 100, 'attack' => 50, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 1, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
209 => array ( 'shield' => 10, 'attack' => 1, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 1, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
210 => array ( 'shield' => 0, 'attack' => 0, 'sd' => array (202 => 0, 203 => 0, 204 => 0, 205 => 0, 206 => 0, 207 => 0, 208 => 0, 209 => 0, 210 => 0, 211 => 0, 212 => 0, 213 => 0, 214 => 0, 215 => 0, 401 => 0, 402 => 0, 403 => 0, 404 => 0, 405 => 0, 406 => 0, 407 => 0, 408 => 0 )),
|
||||
211 => array ( 'shield' => 500, 'attack' => 1000, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 20, 402 => 20, 403 => 10, 404 => 1, 405 => 10, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
212 => array ( 'shield' => 10, 'attack' => 1, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 1, 211 => 1, 212 => 0, 213 => 1, 214 => 1, 215 => 1, 401 => 1, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
213 => array ( 'shield' => 500, 'attack' => 2000, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 2, 401 => 1, 402 => 10, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
214 => array ( 'shield' => 50000, 'attack' => 200000, 'sd' => array (202 => 250, 203 => 250, 204 => 200, 205 => 100, 206 => 33, 207 => 30, 208 => 250, 209 => 250, 210 => 1250, 211 => 25, 212 => 1250, 213 => 5, 214 => 1, 215 => 15, 401 => 200, 402 => 200, 403 => 100, 404 => 50, 405 => 100, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
215 => array ( 'shield' => 400, 'attack' => 700, 'sd' => array (202 => 3, 203 => 3, 204 => 1, 205 => 4, 206 => 4, 207 => 7, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1, 401 => 1, 402 => 1, 403 => 1, 404 => 1, 405 => 1, 406 => 1, 407 => 1, 408 => 1 )),
|
||||
|
||||
401 => array ( 'shield' => 20, 'attack' => 80, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1) ),
|
||||
402 => array ( 'shield' => 25, 'attack' => 100, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1) ),
|
||||
403 => array ( 'shield' => 100, 'attack' => 250, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1) ),
|
||||
404 => array ( 'shield' => 200, 'attack' => 1100, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1) ),
|
||||
405 => array ( 'shield' => 500, 'attack' => 150, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1) ),
|
||||
406 => array ( 'shield' => 300, 'attack' => 3000, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1) ),
|
||||
407 => array ( 'shield' => 2000, 'attack' => 1, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1) ),
|
||||
408 => array ( 'shield' => 2000, 'attack' => 1, 'sd' => array (202 => 1, 203 => 1, 204 => 1, 205 => 1, 206 => 1, 207 => 1, 208 => 1, 209 => 1, 210 => 5, 211 => 1, 212 => 5, 213 => 1, 214 => 1, 215 => 1) ),
|
||||
|
||||
502 => array ( 'shield' => 1, 'attack' => 1 ),
|
||||
503 => array ( 'shield' => 1, 'attack' => 12000 )
|
||||
);
|
||||
|
||||
$AtFleet = array ( 203 => 2 );
|
||||
$AtTechn = array ( 109 => 3, 110 => 5, 111 => 3 );
|
||||
$AtCount = 1;
|
||||
|
||||
$DfFleet = array ( 402 => 9 );
|
||||
$DfTechn = array ( 109 => 7, 110 => 7, 111 => 5 );
|
||||
$DfCount = 1;
|
||||
|
||||
|
||||
// Données en entrée :
|
||||
// $AttackFleet -> array de tableaux des flottes attaquantes
|
||||
// $AttackTech -> array de tableaux des technologies des attaquants ainsi que leur id
|
||||
// $AttackCount -> Nbre d'attaquants ( de 1 a 5 )
|
||||
// $TargetFleet -> array de tableaux des flottes defenseurs
|
||||
// $TargetTech -> array de tableaux des technologies des defenseurs ainsi que leur id
|
||||
// $TargetCount -> Nbre de defenseurs ( de 1 a 5 )
|
||||
//
|
||||
function FleetCombat ( $AttackFleet, $AttackTech, $AttackCount, $TargetFleet, $TargetTech, $TargetCount ) {
|
||||
|
||||
}
|
||||
|
||||
function GetWeaponsPerType ( $TypeArray, $Tech ) {
|
||||
global $capacity;
|
||||
// Calcul de la force d'Attaque
|
||||
if (!is_null($TypeArray)) {
|
||||
foreach($TypeArray as $Type => $Count) {
|
||||
$Attack[$Type] = round ($capacity[$Type]['attack'] + (($capacity[$Type]['attack'] * $Tech['109']) / 10));
|
||||
$Units['attack'] += $Count * $Attack[$Type];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function GetShiedsPerType ( $TypeArray, $Tech ) {
|
||||
global $capacity;
|
||||
// Calcul des points de Bouclier
|
||||
if (!is_null($TypeArray)) {
|
||||
foreach($TypeArray as $Type => $Count) {
|
||||
$Shield[$Type] = round ($capacity[$Type]['shield'] + (($capacity[$Type]['shield'] * $Tech['110']) / 10));
|
||||
$Units['shield'] += $Count * $Shield[$Type];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function GetHullPerType ( $TypeArray, $Tech ) {
|
||||
global $pricelist;
|
||||
// Calcul des points de Coque
|
||||
if (!is_null($TypeArray)) {
|
||||
$Units['metal'] = 0;
|
||||
$Units['crystal'] = 0;
|
||||
$Units['deuterium'] = 0;
|
||||
foreach($TypeArray as $Type => $Count) {
|
||||
$Hull[$Type] = ($pricelist[$Type]['metal'] + $pricelist[$Type]['crystal']) + ((($pricelist[$Type]['metal'] + $pricelist[$Type]['crystal']) * $Tech['111']) / 10);
|
||||
$Units['metal'] += $Count * $pricelist[$Type]['metal'];
|
||||
$Units['crystal'] += $Count * $pricelist[$Type]['crystal'];
|
||||
$Units['deuterium'] += $Count * $pricelist[$Type]['deuterium'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
1327
includes/aks.php
Normal file
1327
includes/aks.php
Normal file
File diff suppressed because it is too large
Load diff
74
includes/application/code/community/Legacies.php
Normal file
74
includes/application/code/community/Legacies.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
class Legacies
|
||||
{
|
||||
private static $_listeners = array();
|
||||
|
||||
private static $_translators = array();
|
||||
|
||||
public static $request = null;
|
||||
public static $response = null;
|
||||
|
||||
public static function registerListener($event, $listener)
|
||||
{
|
||||
if (!isset(self::$_listeners[$event])) {
|
||||
self::$_listeners[$event] = array();
|
||||
}
|
||||
self::$_listeners[$event][] = $listener;
|
||||
}
|
||||
|
||||
public static function clearAllListeners()
|
||||
{
|
||||
self::$_listeners = array();
|
||||
}
|
||||
|
||||
public static function clearEventListeners($event)
|
||||
{
|
||||
if (isset(self::$_listeners[$event])) {
|
||||
self::$_listeners[$event] = array();
|
||||
}
|
||||
}
|
||||
|
||||
public static function dispatchEvent($event, $params)
|
||||
{
|
||||
if (!isset(self::$_listeners[$event])) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (self::$_listeners[$event] as $listener) {
|
||||
call_user_func($listener, $params);
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSession($namespace)
|
||||
{
|
||||
return Legacies_Core_Model_Session::factory($namespace);
|
||||
}
|
||||
|
||||
public static function getTranslator($locale = 'fr_FR')
|
||||
{
|
||||
if (!isset($translator[$locale])) {
|
||||
$path = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'locale';
|
||||
$translator[$locale] = new Legacies_Core_Model_Translator($path, $locale);
|
||||
}
|
||||
return $translator[$locale];
|
||||
}
|
||||
|
||||
public static function translate($locale, $message, Array $args)
|
||||
{
|
||||
return vsprintf(self::getTranslator($locale)->translateArgs($message), $args);
|
||||
}
|
||||
|
||||
public static function __($message, $_ = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return self::getTranslator(self::getLocale())->translate($message, $args);
|
||||
}
|
||||
|
||||
public static function getLocale()
|
||||
{
|
||||
return 'fr_FR';
|
||||
}
|
||||
}
|
||||
302
includes/application/code/community/Legacies/Core/Collection.php
Normal file
302
includes/application/code/community/Legacies/Core/Collection.php
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Collection
|
||||
extends Legacies_Core_Model
|
||||
implements Iterator, Countable
|
||||
{
|
||||
protected $_tableName = null;
|
||||
protected $_tableAlias = null;
|
||||
protected $_entityClassName = 'Legacies_Object';
|
||||
|
||||
protected $_columns = array();
|
||||
protected $_where = array();
|
||||
protected $_join = array();
|
||||
protected $_order = array();
|
||||
protected $_union = array();
|
||||
protected $_limit = null;
|
||||
protected $_offset = null;
|
||||
protected $_group = array();
|
||||
|
||||
protected $_items = array();
|
||||
|
||||
public function __construct($tableName = null, $entityClassName = null)
|
||||
{
|
||||
if ($tableName !== null) {
|
||||
$this->setTableName($tableName);
|
||||
}
|
||||
if ($entityClassName != null) {
|
||||
$this->setEntityClassName($entityClassName);
|
||||
}
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTableName($tableName)
|
||||
{
|
||||
if (!is_array($tableName)) {
|
||||
$this->_tableName = $tableName;
|
||||
} else {
|
||||
$this->_tableName = current($tableName);
|
||||
$this->_tableAlias = key($tableName);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTableName()
|
||||
{
|
||||
return $this->_tableName;
|
||||
}
|
||||
|
||||
public function setEntityClassName($entityClassName)
|
||||
{
|
||||
$this->_entityClassName = $entityClassName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEntityClassName()
|
||||
{
|
||||
return $this->_entityClassName;
|
||||
}
|
||||
|
||||
public function quote($data)
|
||||
{
|
||||
static $database = null;
|
||||
|
||||
if ($database === null) {
|
||||
$database = Legacies_Database::getSingleton();
|
||||
}
|
||||
|
||||
return $database->quote($data);
|
||||
}
|
||||
|
||||
public function column($column = '*', $alias = null)
|
||||
{
|
||||
if (is_array($column)) {
|
||||
foreach ($column as $alias => $field) {
|
||||
if (is_int($alias)) {
|
||||
$this->_columns[] = array($field);
|
||||
} else {
|
||||
$this->_columns[] = array($alias => $field);
|
||||
}
|
||||
}
|
||||
} else if ($alias === null || is_int($alias)) {
|
||||
$this->_columns[] = array($column);
|
||||
} else {
|
||||
$this->_columns[] = array($alias => $column);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function where($condition)
|
||||
{
|
||||
$this->_where[] = $condition;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function join($table, $condition, $fields = array('*'), $mode = 'INNER')
|
||||
{
|
||||
static $database = null;
|
||||
|
||||
if ($database === null) {
|
||||
$database = Legacies_Database::getSingleton();
|
||||
}
|
||||
|
||||
if (is_array($table)) {
|
||||
$alias = key($table);
|
||||
$table = current($table);
|
||||
|
||||
foreach ($fields as $fieldAlias => $fieldName) {
|
||||
$this->column("{$alias}.{$field}", $fieldAlias);
|
||||
}
|
||||
|
||||
$this->_join[] = "{$mode} JOIN {$database->getTable($table)} AS {$alias} ON {$condition}";
|
||||
} else {
|
||||
foreach ($fields as $field) {
|
||||
$this->column("{$field}");
|
||||
}
|
||||
|
||||
$this->_join[] = "{$mode} JOIN {$database->getTable($table)} ON {$condition}";
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function order($field, $direction = 'ASC')
|
||||
{
|
||||
$this->_order[] = "{$field} {$direction}";
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function union($collection)
|
||||
{
|
||||
$this->_union[] = $collection;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function limit($limit, $offset = null)
|
||||
{
|
||||
$this->_limit = intval($limit);
|
||||
$this->_offset = $offset;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function group($groupField)
|
||||
{
|
||||
$this->_group[] = $groupField;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function _prepareSql()
|
||||
{
|
||||
if (empty($this->_union)) {
|
||||
$database = Legacies_Database::getSingleton();
|
||||
|
||||
$fields = array();
|
||||
foreach ($this->_columns as $field) {
|
||||
$fieldName = current($field);
|
||||
$fieldAlias = key($field);
|
||||
if (is_string($fieldAlias)) {
|
||||
$fields[] = "{$fieldName} AS {$fieldAlias}";
|
||||
} else {
|
||||
$fields[] = $fieldName;
|
||||
}
|
||||
}
|
||||
$fields = implode(", ", $fields);
|
||||
$where = implode(" AND ", $this->_where);
|
||||
$joinedTables = implode("\n ", $this->_join);
|
||||
|
||||
$order = '';
|
||||
if (!empty($this->_order)) {
|
||||
$order = 'ORDER BY ' . implode(", ", $this->_order);
|
||||
}
|
||||
$alias = '';
|
||||
if ($this->_tableAlias !== null) {
|
||||
$alias = " AS {$this->_tableAlias}";
|
||||
}
|
||||
$limit = '';
|
||||
if ($this->_limit) {
|
||||
if ($this->_offset) {
|
||||
$limit = "LIMIT {$this->_limit}, {$this->_offset}";
|
||||
} else {
|
||||
$limit = "LIMIT {$this->_limit}";
|
||||
}
|
||||
}
|
||||
$group = '';
|
||||
if (!empty($this->_group)) {
|
||||
$group = 'GROUP BY ' . implode(', ', $this->_group);
|
||||
}
|
||||
|
||||
return <<<SQL_EOF
|
||||
SELECT {$fields}
|
||||
FROM {$database->getTable($this->getTableName())}{$alias}
|
||||
{$joinedTables}
|
||||
WHERE $where
|
||||
{$group}
|
||||
{$order}
|
||||
{$limit}
|
||||
SQL_EOF;
|
||||
} else {
|
||||
$statements = array();
|
||||
foreach ($this->_union as $statement) {
|
||||
$statements[] = $statement->_prepareSql();
|
||||
}
|
||||
|
||||
$statements = '(' . implode(') UNION (', $statements) . ')';
|
||||
$where = implode(" AND ", $this->_where);
|
||||
|
||||
$limit = '';
|
||||
if ($this->_limit) {
|
||||
if ($this->_offset) {
|
||||
$limit = "LIMIT {$this->_limit}, {$this->_offset}";
|
||||
} else {
|
||||
$limit = "LIMIT {$this->_limit}";
|
||||
}
|
||||
}
|
||||
|
||||
return <<<SQL_EOF
|
||||
$statements
|
||||
WHERE $where
|
||||
{$limit}
|
||||
SQL_EOF;
|
||||
}
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
$sql = $this->_prepareSql();
|
||||
|
||||
$database = Legacies_Database::getSingleton();
|
||||
$statement = $database->prepare($sql);
|
||||
|
||||
$args = func_get_args();
|
||||
$statement->execute(array_shift($args));
|
||||
|
||||
$this->_items = array();
|
||||
$reflection = new ReflectionClass($this->getEntityClassName());
|
||||
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
|
||||
$args = array($row) + $args;
|
||||
$this->_items[] = $reflection->newInstanceArgs($args);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
foreach ($this->_items as $child) {
|
||||
$child->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
foreach ($this->_items as $child) {
|
||||
$child->delete();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return count($this->_items);
|
||||
}
|
||||
|
||||
public function current()
|
||||
{
|
||||
return current($this->_items);
|
||||
}
|
||||
|
||||
public function next()
|
||||
{
|
||||
return next($this->_items);
|
||||
}
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
return reset($this->_items);
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return key($this->_items);
|
||||
}
|
||||
|
||||
public function valid()
|
||||
{
|
||||
return (key($this->_items) < (current($this->_items)));
|
||||
}
|
||||
}
|
||||
162
includes/application/code/community/Legacies/Core/Entity.php
Normal file
162
includes/application/code/community/Legacies/Core/Entity.php
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
|
||||
abstract class Legacies_Core_Entity
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_EntityInterface
|
||||
{
|
||||
protected $_idFieldName = null;
|
||||
protected $_tableName = null;
|
||||
|
||||
public function setIdFieldName($fieldName)
|
||||
{
|
||||
$this->_idFieldName = $fieldName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIdFieldName()
|
||||
{
|
||||
return $this->_idFieldName;
|
||||
}
|
||||
|
||||
public function setTableName($tableName)
|
||||
{
|
||||
$this->_tableName = $tableName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTableName()
|
||||
{
|
||||
return $this->_tableName;
|
||||
}
|
||||
|
||||
public function setId($id)
|
||||
{
|
||||
$this->setData($this->getIdFieldName(), $id);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->getData($this->getIdFieldName());
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
static $statement = null;
|
||||
|
||||
$id = func_get_arg(0);
|
||||
|
||||
if ($statement === null) {
|
||||
$idFieldName = self::getIdFieldName();
|
||||
$database = Legacies_Database::getSingleton();
|
||||
|
||||
$sql =<<<SQL_EOF
|
||||
SELECT * FROM {$database->getTable(self::getTableName())}
|
||||
WHERE {$idFieldName}=:id
|
||||
LIMIT 1
|
||||
SQL_EOF;
|
||||
$statement = $database->prepare($sql);
|
||||
}
|
||||
|
||||
$statement->execute(array(
|
||||
'id' => $id
|
||||
));
|
||||
|
||||
$datas = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
if (!is_array($datas) || empty($datas)) {
|
||||
throw new Legacies_Core_Model_Exception('Could not load data: this id could not be found.');
|
||||
}
|
||||
unset($datas[self::getIdFieldName()]);
|
||||
|
||||
$this->_data = $datas;
|
||||
$this->setId($id);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
if ($this->getId() !== null) {
|
||||
$fields = array();
|
||||
$values = array();
|
||||
foreach ($this->getAllDatas() as $field => $value) {
|
||||
if ($field == self::getIdFieldName()) {
|
||||
continue;
|
||||
}
|
||||
$fields[] = "{$field}=:{$field}";
|
||||
$values[$field] = $value;
|
||||
}
|
||||
|
||||
$fieldsImploded = implode(', ', $fields);
|
||||
$idFieldName = self::getIdFieldName();
|
||||
$values[$idFieldName] = $this->getId();
|
||||
|
||||
$database = Legacies_Database::getSingleton();
|
||||
$sql =<<<SQL_EOF
|
||||
UPDATE {$database->getTable(self::getTableName())}
|
||||
SET {$fieldsImploded}
|
||||
WHERE {$idFieldName}=:{$idFieldName}
|
||||
SQL_EOF;
|
||||
$statement = $database->prepare($sql);
|
||||
|
||||
$statement->execute($values);
|
||||
} else {
|
||||
$datas = $this->getAllDatas();
|
||||
$fieldsImploded = implode(', ', array_keys($datas));
|
||||
|
||||
$tokens = array();
|
||||
$values = array();
|
||||
foreach ($datas as $field => $value) {
|
||||
if ($field == self::getIdFieldName()) {
|
||||
continue;
|
||||
}
|
||||
$tokens[] = ":{$field}";
|
||||
$values[$field] = $value;
|
||||
}
|
||||
$tokensImploded = implode(', ', $tokens);
|
||||
|
||||
$database = Legacies_Database::getSingleton();
|
||||
$sql =<<<SQL_EOF
|
||||
INSERT INTO {$database->getTable(self::getTableName())} ($fieldsImploded)
|
||||
VALUES ({$tokensImploded})
|
||||
SQL_EOF;
|
||||
$statement = $database->prepare($sql);
|
||||
|
||||
$statement->execute($values);
|
||||
|
||||
$this->setId($database->lastInsertId());
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
static $statement = null;
|
||||
|
||||
if ($statement == null) {
|
||||
$fields = array();
|
||||
foreach ($this->getAllDatas() as $field => $value) {
|
||||
if ($field == self::getIdFieldName()) {
|
||||
continue;
|
||||
}
|
||||
$fields[] = "{$field}=:{$field}";
|
||||
}
|
||||
|
||||
$fieldsImploded = implod(', ', $fields);
|
||||
$idFieldName = self::getIdFieldName();
|
||||
$database = Legacies_Database::getSingleton();
|
||||
$sql =<<<SQL_EOF
|
||||
DELETE {$database->getTable(self::getTableName())}
|
||||
WHERE {$idFieldName}=:{$idFieldName}
|
||||
SQL_EOF;
|
||||
}
|
||||
|
||||
$statement->execute($this->getAllDatas());
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
interface Legacies_Core_EntityInterface
|
||||
{
|
||||
public function getId();
|
||||
public function setId($id);
|
||||
|
||||
public function getIdFieldName();
|
||||
public function setIdFieldName($fieldName);
|
||||
|
||||
public function getTableName();
|
||||
public function setTableName($tableName);
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
interface Legacies_Core_Exception extends Legacies_Exception {}
|
||||
100
includes/application/code/community/Legacies/Core/Model.php
Normal file
100
includes/application/code/community/Legacies/Core/Model.php
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
|
||||
abstract class Legacies_Core_Model
|
||||
extends Legacies_Object
|
||||
{
|
||||
protected $_originalData = array();
|
||||
protected $_data = array();
|
||||
|
||||
public function __construct(Array $data = array())
|
||||
{
|
||||
$this->_data = $data;
|
||||
$this->_setOriginalData($data);
|
||||
|
||||
$this->_init();
|
||||
}
|
||||
|
||||
abstract protected function _init();
|
||||
|
||||
protected function _setOriginalData(Array $data)
|
||||
{
|
||||
$this->_originalData = $data;
|
||||
}
|
||||
|
||||
final public function save()
|
||||
{
|
||||
try {
|
||||
$params = func_get_args();
|
||||
call_user_func_array(array($this, '_beforeSave'), $params);
|
||||
call_user_func_array(array($this, '_save'), $params);
|
||||
call_user_func_array(array($this, '_afterSave'), $params);
|
||||
$this->_setOriginalData($this->_data);
|
||||
} catch (PDOException $e) {
|
||||
throw new Legacies_Core_Model_Exception('Could not save data: ' . $e->getMessage(), 0);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract protected function _save();
|
||||
|
||||
protected function _beforeSave()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _afterSave()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
final public function load()
|
||||
{
|
||||
try {
|
||||
$params = func_get_args();
|
||||
call_user_func_array(array($this, '_beforeLoad'), $params);
|
||||
call_user_func_array(array($this, '_load'), $params);
|
||||
call_user_func_array(array($this, '_afterLoad'), $params);
|
||||
$this->_setOriginalData($this->_data);
|
||||
} catch (PDOException $e) {
|
||||
throw new Legacies_Core_Model_Exception('Could not load data: ' . $e->getMessage(), 0);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract protected function _load();
|
||||
|
||||
protected function _beforeLoad()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _afterLoad()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
final public function delete()
|
||||
{
|
||||
try {
|
||||
$params = func_get_args();
|
||||
call_user_func_array(array($this, '_beforeDelete'), $params);
|
||||
call_user_func_array(array($this, '_delete'), $params);
|
||||
call_user_func_array(array($this, '_afterDelete'), $params);
|
||||
} catch (PDOException $e) {
|
||||
throw new Legacies_Core_Model_Exception('Could not delete entity: ' . $e->getMessage(), 0);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
abstract protected function _delete();
|
||||
|
||||
protected function _beforeDelete()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _afterDelete()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Core_Model_Config
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_Singleton
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
$this->load();
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
$database = Legacies_Database::getSingleton();
|
||||
|
||||
$sql =<<<SQL_EOF
|
||||
SELECT config_name AS attribute, config_value AS value
|
||||
FROM {$database->getTable('config')} AS config
|
||||
SQL_EOF;
|
||||
|
||||
$attributeName = null;
|
||||
$attributeValue = null;
|
||||
|
||||
$statement = $database->prepare($sql);
|
||||
$statement->execute();
|
||||
|
||||
$statement->bindColumn('attribute', $attributeName, PDO::PARAM_STR);
|
||||
$statement->bindColumn('value', $attributeValue, PDO::PARAM_STR);
|
||||
|
||||
while ($statement->fetch(PDO::FETCH_BOUND)) {
|
||||
$this->setData($attributeName, $attributeValue);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
$database = Legacies_Database::getSingleton();
|
||||
$fields = array();
|
||||
|
||||
$sql =<<<SQL_EOF
|
||||
UPDATE {{table}}
|
||||
SET config_value=:value
|
||||
WHERE config_name=:name
|
||||
SQL_EOF;
|
||||
$statement = $database->prepare($sql);
|
||||
|
||||
foreach ($this->getAllDatas() as $attributeName => $attributeValue) {
|
||||
$statement->execute(array(
|
||||
'name' => $attributeName,
|
||||
'value' => $attributeValue
|
||||
));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
{
|
||||
return (bool) $this->getData('game_disable');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Model_Exception
|
||||
extends RuntimeException
|
||||
implements Legacies_Core_Exception
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Core_Model_Session
|
||||
extends Legacies_Object
|
||||
{
|
||||
const CRIT = 0x80;
|
||||
const ERROR = 0x40;
|
||||
const WARN = 0x20;
|
||||
const INFO = 0x10;
|
||||
const DEBUG = 0x01;
|
||||
|
||||
protected static $_instances = null;
|
||||
|
||||
protected static $_levels = null;
|
||||
|
||||
public static function factory($namespace)
|
||||
{
|
||||
$namespace = (string) $namespace;
|
||||
if (!isset(self::$_instances[$namespace])) {
|
||||
if (self::$_levels === null) {
|
||||
$reflection = new ReflectionClass(__CLASS__);
|
||||
self::$_levels = array_flip($reflection->getConstants());
|
||||
}
|
||||
if (session_id() == '') {
|
||||
session_start();
|
||||
}
|
||||
|
||||
self::$_instances[$namespace] = new self($namespace);
|
||||
}
|
||||
return self::$_instances[$namespace];
|
||||
}
|
||||
|
||||
public static function destroy()
|
||||
{
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
public function __construct($namespace)
|
||||
{
|
||||
$this->_data = &$_SESSION[$namespace];
|
||||
$this->_data['messages'] = array();
|
||||
}
|
||||
|
||||
public function getMessages($clear = true)
|
||||
{
|
||||
$messages = $this->_data['messages'];
|
||||
if ($clear == true) {
|
||||
$this->_data['messages'] = array();
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
||||
public function addMessage($message, $type = self::DEBUG)
|
||||
{
|
||||
if (!isset(self::$_levels[$type])) {
|
||||
$type = self::DEBUG;
|
||||
}
|
||||
|
||||
if (!isset($this->_data['messages'])) {
|
||||
$this->_data['messages'] = array();
|
||||
}
|
||||
if (!isset($this->_data['messages'][self::$_levels[$type]])) {
|
||||
$this->_data['messages'][self::$_levels[$type]] = array();
|
||||
}
|
||||
$this->_data['messages'][self::$_levels[$type]][] = $message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addCritical($message, $_ = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return $this->addMessage(vsprintf($message, $args), self::CRIT);
|
||||
}
|
||||
|
||||
public function addError($message, $_ = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return $this->addMessage(vsprintf($message, $args), self::ERROR);
|
||||
}
|
||||
|
||||
public function addWarning($message, $_ = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return $this->addMessage(vsprintf($message, $args), self::WARN);
|
||||
}
|
||||
|
||||
public function addInfo($message, $_ = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return $this->addMessage(vsprintf($message, $args), self::INFO);
|
||||
}
|
||||
|
||||
public function addDebug($message, $_ = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return $this->addMessage(vsprintf($message, $args), self::DEBUG);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Model_Translator
|
||||
{
|
||||
protected $_translations = array();
|
||||
|
||||
public function __construct($path, $locale)
|
||||
{
|
||||
$fileList = glob($path . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR . '*.csv');
|
||||
foreach ($fileList as $file) {
|
||||
$fp = fopen($file, 'r');
|
||||
while (!feof($fp)) {
|
||||
$line = fgetcsv($fp);
|
||||
if (count($line) >= 2) {
|
||||
$this->_translations[$line[0]] = $line[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function translate($message, $_ = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return $this->translateArgs($message, $args);
|
||||
}
|
||||
|
||||
public function translateArgs($message, Array $args = array())
|
||||
{
|
||||
if (isset($this->_translations[$message])) {
|
||||
$message = $this->_translations[$message];
|
||||
}
|
||||
|
||||
return vsprintf($message, $args);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
interface Legacies_Core_Singleton
|
||||
{
|
||||
public static function getSingleton();
|
||||
}
|
||||
70
includes/application/code/community/Legacies/Core/View.php
Normal file
70
includes/application/code/community/Legacies/Core/View.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_View
|
||||
extends Legacies_Object
|
||||
{
|
||||
protected $_template = null;
|
||||
|
||||
public function __construct(Array $data = array())
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
protected function _prepareRender()
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function renderNumber($number)
|
||||
{
|
||||
return Math::render($number);
|
||||
}
|
||||
|
||||
protected function escape($unescaped)
|
||||
{
|
||||
return htmlspecialchars($unescaped, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
public function __($message, $_ = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
array_shift($args);
|
||||
|
||||
return Legacies::translateArgs($message, $args);
|
||||
}
|
||||
|
||||
public function renderScript($file)
|
||||
{
|
||||
$this->_prepareRender();
|
||||
|
||||
$path = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR . 'scripts';
|
||||
|
||||
ob_start();
|
||||
include $path . DIRECTORY_SEPARATOR . $file;
|
||||
$contents = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
$template = $this->getTemplate();
|
||||
if (empty($template)) {
|
||||
return null;
|
||||
}
|
||||
return $this->renderScript($this->getTemplate());
|
||||
}
|
||||
|
||||
public function setTemplate($template)
|
||||
{
|
||||
$this->_template = $template;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTemplate()
|
||||
{
|
||||
return $this->_template;
|
||||
}
|
||||
}
|
||||
32
includes/application/code/community/Legacies/Database.php
Normal file
32
includes/application/code/community/Legacies/Database.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Database
|
||||
extends PDO
|
||||
{
|
||||
protected static $_singleton = null;
|
||||
|
||||
protected static $_prefix = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
$config = include ROOT_PATH . 'config.php';
|
||||
$hostname = $config['global']['database']['options']['hostname'];
|
||||
$username = $config['global']['database']['options']['username'];
|
||||
$password = $config['global']['database']['options']['password'];
|
||||
$database = $config['global']['database']['options']['database'];
|
||||
|
||||
self::$_singleton = new self("mysql:dbname={$database};host={$hostname}", $username, $password);
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
public function getTable($name)
|
||||
{
|
||||
if (self::$_prefix === null) {
|
||||
$config = include ROOT_PATH . 'config.php';
|
||||
self::$_prefix = $config['global']['database']['table_prefix'];
|
||||
}
|
||||
return self::$_prefix . $name;
|
||||
}
|
||||
}
|
||||
140
includes/application/code/community/Legacies/Empire.php
Normal file
140
includes/application/code/community/Legacies/Empire.php
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @author Greg
|
||||
*
|
||||
*/
|
||||
|
||||
class Legacies_Empire
|
||||
{
|
||||
const TYPE_BUILDING = 'build';
|
||||
const TYPE_RESEARCH = 'tech';
|
||||
const TYPE_SHIP = 'fleet';
|
||||
const TYPE_DEFENSE = 'defense';
|
||||
const TYPE_SPECIAL = 'special';
|
||||
const TYPE_OFFICER = 'officier';
|
||||
const TYPE_PRODUCTION = 'prod';
|
||||
|
||||
const RESOURCE_METAL = 'metal';
|
||||
const RESOURCE_CRISTAL = 'crystal';
|
||||
const RESOURCE_DEUTERIUM = 'deuterium';
|
||||
const RESOURCE_ENERGY = 'energy';
|
||||
const RESOURCE_MULTIPLIER = 'factor';
|
||||
const RESOURCE_FORMULA = 'formule';
|
||||
|
||||
const SHIPS_CONSUMPTION_PRIMARY = 'consumption';
|
||||
const SHIPS_CELERITY_PRIMARY = 'speed';
|
||||
const SHIPS_CONSUMPTION_SECONDARY = 'consumption2';
|
||||
const SHIPS_CELERITY_SECONDARY = 'speed2';
|
||||
const SHIPS_CAPACITY = 'capacity';
|
||||
|
||||
const ID_BUILDING_METAL_MINE = 1;
|
||||
const ID_BUILDING_CRISTAL_MINE = 2;
|
||||
const ID_BUILDING_DEUTERIUM_SYNTHETISER = 3;
|
||||
const ID_BUILDING_SOLAR_PLANT = 4;
|
||||
const ID_BUILDING_FUSION_REACTOR = 12;
|
||||
const ID_BUILDING_ROBOTIC_FACTORY = 14;
|
||||
const ID_BUILDING_NANITE_FACTORY = 15;
|
||||
const ID_BUILDING_SHIPYARD = 21;
|
||||
const ID_BUILDING_METAL_STORAGE = 22;
|
||||
const ID_BUILDING_CRISTAL_STORAGE = 23;
|
||||
const ID_BUILDING_DEUTERIUM_TANK = 24;
|
||||
const ID_BUILDING_RESEARCH_LAB = 31;
|
||||
const ID_BUILDING_TERRAFORMER = 33;
|
||||
const ID_BUILDING_ALLIANCE_DEPOT = 34;
|
||||
const ID_BUILDING_LUNAR_BASE = 41;
|
||||
const ID_BUILDING_SENSOR_PHALANX = 42;
|
||||
const ID_BUILDING_JUMP_GATE = 43;
|
||||
const ID_BUILDING_MISSILE_SILO = 44;
|
||||
|
||||
const ID_RESEARCH_ESPIONAGE_TECHNOLOGY = 106;
|
||||
const ID_RESEARCH_COMPUTER_TECHNOLOGY = 108;
|
||||
const ID_RESEARCH_WEAPON_TECHNOLOGY = 109;
|
||||
const ID_RESEARCH_SHIELDING_TECHNOLOGY = 110;
|
||||
const ID_RESEARCH_ARMOUR_TECHNOLOGY = 111;
|
||||
const ID_RESEARCH_ENERGY_TECHNOLOGY = 113;
|
||||
const ID_RESEARCH_HYPERSPACE_TECHNOLOGY = 114;
|
||||
const ID_RESEARCH_COMBUSTION_DRIVE = 115;
|
||||
const ID_RESEARCH_IMPULSE_DRIVE = 117;
|
||||
const ID_RESEARCH_HYPERSPACE_DRIVE = 118;
|
||||
const ID_RESEARCH_LASER_TECHNOLOGY = 120;
|
||||
const ID_RESEARCH_ION_TECHNOLOGY = 121;
|
||||
const ID_RESEARCH_PLASMA_TECHNOLOGY = 122;
|
||||
const ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK = 123;
|
||||
const ID_RESEARCH_EXPEDITION_TECHNOLOGY = 124;
|
||||
const ID_RESEARCH_ASTROPHYSICS = 124;
|
||||
const ID_RESEARCH_GRAVITON_TECHNOLOGY = 199;
|
||||
|
||||
const ID_SHIP_LIGHT_TRANSPORT = 202;
|
||||
const ID_SHIP_LARGE_TRANSPORT = 203;
|
||||
const ID_SHIP_LIGHT_FIGHTER = 204;
|
||||
const ID_SHIP_HEAVY_FIGHTER = 205;
|
||||
const ID_SHIP_CRUISER = 206;
|
||||
const ID_SHIP_BATTLESHIP = 207;
|
||||
const ID_SHIP_COLONY_SHIP = 208;
|
||||
const ID_SHIP_RECYCLER = 209;
|
||||
const ID_SHIP_SPY_DRONE = 210;
|
||||
const ID_SHIP_BOMBER = 211;
|
||||
const ID_SHIP_SOLAR_SATELLITE = 212;
|
||||
const ID_SHIP_DESTRUCTOR = 213;
|
||||
const ID_SHIP_DEATH_STAR = 214;
|
||||
const ID_SHIP_BATTLECRUISER = 215;
|
||||
const ID_SHIP_SUPERNOVA = 216;
|
||||
|
||||
const ID_DEFENSE_ROCKET_LAUNCHER = 401;
|
||||
const ID_DEFENSE_LIGHT_LASER = 402;
|
||||
const ID_DEFENSE_HEAVY_LASER = 403;
|
||||
const ID_DEFENSE_ION_CANNON = 404;
|
||||
const ID_DEFENSE_GAUSS_CANNON = 405;
|
||||
const ID_DEFENSE_PLASMA_TURRET = 406;
|
||||
const ID_DEFENSE_SMALL_SHIELD_DOME = 407;
|
||||
const ID_DEFENSE_LARGE_SHIELD_DOME = 408;
|
||||
|
||||
const ID_SPECIAL_ANTIBALLISTIC_MISSILE = 502;
|
||||
const ID_SPECIAL_INTERPLANETARY_MISSILE = 503;
|
||||
|
||||
const ID_COMBAT_SHIELDS = 'shield';
|
||||
const ID_COMBAT_FIREPOWER = 'attack';
|
||||
const ID_COMBAT_RAPID_FIRE = 'sd';
|
||||
|
||||
public static function getFieldName($id)
|
||||
{
|
||||
global $resource;
|
||||
|
||||
if (!isset($resource[$id])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $resource[$id];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Fleet
|
||||
extends Legacies_Core_Entity
|
||||
{
|
||||
protected static $_instances = array();
|
||||
|
||||
public static function factory($id)
|
||||
{
|
||||
if ($id === null) {
|
||||
return new self();
|
||||
}
|
||||
|
||||
$id = intval($id);
|
||||
if (!isset(self::$_instances[$id])) {
|
||||
$instance = new self();
|
||||
$params = func_get_args();
|
||||
call_user_func_array(array($instance, 'load'), $params);
|
||||
self::$_instances[$id] = $instance;
|
||||
}
|
||||
return self::$_instances[$id];
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
$this->setIdFieldName('fleet_id');
|
||||
$this->setTableName('fleets');
|
||||
}
|
||||
|
||||
public static function planetListener($eventData)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Game_Combat
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_Singleton
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
foreach (include ROOT_PATH . 'includes/data/combat.php' as $elementId => $fieldName) {
|
||||
$this->setData($elementId, $fieldName);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Game_FieldsAlias
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_Singleton
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
foreach (include ROOT_PATH . 'includes/data/fields-alias.php' as $elementId => $fieldName) {
|
||||
$this->setData($elementId, $fieldName);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Game_Prices
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_Singleton
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
foreach (include ROOT_PATH . 'includes/data/prices.php' as $elementId => $fieldName) {
|
||||
$this->setData($elementId, $fieldName);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Game_Production
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_Singleton
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
foreach (include ROOT_PATH . 'includes/data/production.php' as $elementId => $fieldName) {
|
||||
$this->setData($elementId, $fieldName);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Game_Requirements
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_Singleton
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
foreach (include ROOT_PATH . 'includes/data/requirements.php' as $elementId => $fieldName) {
|
||||
$this->setData($elementId, $fieldName);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Game_Resources
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_Singleton
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
foreach (include ROOT_PATH . 'includes/data/resources.php' as $elementId => $fieldName) {
|
||||
$this->setData($elementId, $fieldName);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Game_Types
|
||||
extends Legacies_Core_Model
|
||||
implements Legacies_Core_Singleton
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
foreach (include ROOT_PATH . 'includes/data/types.php' as $elementId => $fieldName) {
|
||||
$this->setData($elementId, $fieldName);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _save()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function _delete()
|
||||
{
|
||||
// NOP
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function is($element, $type)
|
||||
{
|
||||
return in_array($element, $this->getData($type));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,425 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
* @uses Legacies_Empire_User
|
||||
*/
|
||||
class Legacies_Empire_Model_Planet
|
||||
extends Legacies_Core_Entity
|
||||
{
|
||||
const TYPE_PLANET = 1;
|
||||
const TYPE_DEBRIS = 2;
|
||||
const TYPE_MOON = 3;
|
||||
|
||||
protected $_user = null;
|
||||
protected $_moon = null;
|
||||
protected $_now = null;
|
||||
|
||||
protected static $_instances = array();
|
||||
|
||||
protected static $_productionConfig = array(
|
||||
Legacies_Empire::RESOURCE_METAL => array(
|
||||
'field' => Legacies_Empire::RESOURCE_METAL,
|
||||
'production_field' => 'metal_perhour',
|
||||
'ratio_field' => 'metal_porcent',
|
||||
'storage_field' => 'metal_max',
|
||||
'production' => array(
|
||||
Legacies_Empire::ID_BUILDING_METAL_MINE => 'metal_mine_porcent'
|
||||
),
|
||||
'storage' => Legacies_Empire::ID_BUILDING_METAL_STORAGE
|
||||
),
|
||||
Legacies_Empire::RESOURCE_CRISTAL => array(
|
||||
'field' => Legacies_Empire::RESOURCE_CRISTAL,
|
||||
'production_field' => 'crystal_perhour',
|
||||
'ratio_field' => 'crystal_porcent',
|
||||
'storage_field' => 'crystal_max',
|
||||
'production' => array(
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE => 'crystal_mine_porcent'
|
||||
),
|
||||
'storage' => Legacies_Empire::ID_BUILDING_CRISTAL_STORAGE
|
||||
),
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => array(
|
||||
'field' => Legacies_Empire::RESOURCE_DEUTERIUM,
|
||||
'production_field' => 'deuterium_perhour',
|
||||
'ratio_field' => 'deuterium_porcent',
|
||||
'storage_field' => 'deuterium_max',
|
||||
'production' => array(
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => 'deuterium_sintetizer_porcent'
|
||||
),
|
||||
'storage' => Legacies_Empire::ID_BUILDING_DEUTERIUM_TANK
|
||||
),
|
||||
Legacies_Empire::RESOURCE_ENERGY => array(
|
||||
'field' => 'energy_used',
|
||||
'production_field' => 'energy_max',
|
||||
'storage_field' => null,
|
||||
'production' => array(
|
||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT => 'solar_plant_porcent',
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR => 'fusion_plant_porcent',
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 'solar_satelit_porcent'
|
||||
),
|
||||
'storage' => null
|
||||
)
|
||||
);
|
||||
|
||||
protected static $_productionInstances = array();
|
||||
|
||||
public static function factory($id)
|
||||
{
|
||||
if ($id === null) {
|
||||
return new self();
|
||||
}
|
||||
|
||||
$id = intval($id);
|
||||
if (!isset(self::$_instances[$id])) {
|
||||
$instance = new self();
|
||||
$params = func_get_args();
|
||||
call_user_func_array(array($instance, 'load'), $params);
|
||||
self::$_instances[$id] = $instance;
|
||||
}
|
||||
return self::$_instances[$id];
|
||||
}
|
||||
|
||||
public function _init()
|
||||
{
|
||||
$this->_now = time();
|
||||
$this->_tableName = 'planets';
|
||||
$this->_idFieldName = 'id';
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
protected function _now()
|
||||
{
|
||||
return $this->_now;
|
||||
}
|
||||
|
||||
public function updateResources($time = null)
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
if ($time === null) {
|
||||
$time = $this->_now();
|
||||
}
|
||||
|
||||
if ($this->getData('planet_type') != 1) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$resourcesProductions = array();
|
||||
foreach (self::$_productionConfig as $resource => $resourceData) {
|
||||
if ($resourceData['storage_field'] !== null && $resourceData['storage_field'] !== null) {
|
||||
$officerEnhancement = Math::add(Math::mul(.5, $this->getUser('rpg_stockeur')), 1);
|
||||
$storageCapacity = Math::pow(1.5, $this->getData(Legacies_Empire::getFieldName($resourceData['storage'])));
|
||||
|
||||
$value = Math::mul(MAX_OVERFLOW, Math::mul($officerEnhancement, Math::add(BASE_STORAGE_SIZE, $storageCapacity)));
|
||||
$this->setData($resourceData['storage_field'], $value);
|
||||
}
|
||||
|
||||
foreach ($resourceData[production] as $productionUnit => $ratioField) {
|
||||
if (!in_array($productionUnit, $types['prod'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$level = $this->getData(Legacies_Empire::getFieldName($productionUnit));
|
||||
$ratio = $this->getData($ratioField);
|
||||
$element = self::getProducitonElementInstance($productionUnit);
|
||||
|
||||
foreach ($element->getRatios($level, $ratio, $this, $this->getUser()) as $resourceId => $resourceProduction) {
|
||||
if (!isset($resourcesProductions[$resourceId])) {
|
||||
$resourcesProductions[$resourceId] = $resourceProduction;
|
||||
} else {
|
||||
$resourcesProductions[$resourceId] = Math::add($resourcesProductions[$resourceId], $resourceProduction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$timeDiff = ($time - $this->getData('last_update')) / 3600;
|
||||
foreach ($resourcesProductions as $resourceId => $productionPerHour) {
|
||||
if (!isset(self::$_productionConfig[$resource])) {
|
||||
continue;
|
||||
}
|
||||
$this->setData(self::$_productionConfig[$resource]['production_field'], $productionPerHour);
|
||||
|
||||
$production = Math::add($this->getData(self::$_productionConfig[$resource]['field']), Math::mul($timeDiff, $productionPerHour));
|
||||
if (Math::diff($production, $this->getData(self::$_productionConfig[$resource]['storage_field'])) > 0) {
|
||||
$production = $this->getData(self::$_productionConfig[$resource]['storage_field']);
|
||||
}
|
||||
$this->setData(self::$_productionConfig[$resource]['field'], $production);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function getProducitonElementInstance($buildingId)
|
||||
{
|
||||
global $ProdGrid; // FIXME
|
||||
|
||||
if (!isset(self::$_productionInstances[$buildingId])) {
|
||||
if (!isset($ProdGrid[$buildingId])) {
|
||||
return null;
|
||||
}
|
||||
$class = $ProdGrid[$buildingId][Legacies_Empire::RESOURCE_FORMULA];
|
||||
self::$_productionInstances[$buildingId] = new $class;
|
||||
}
|
||||
|
||||
return self::$_productionInstances[$buildingId];
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
if ($this->_user === null) {
|
||||
$this->_user = Legacies_Empire_Model_User::factory($this->getData('id_owner'));
|
||||
}
|
||||
return $this->_user;
|
||||
}
|
||||
|
||||
public function isPlanet()
|
||||
{
|
||||
return (bool) ($this->getData('planet_type') == self::TYPE_PLANET);
|
||||
}
|
||||
|
||||
public function isDebris()
|
||||
{
|
||||
return (bool) ($this->getData('planet_type') == self::TYPE_DEBRIS);
|
||||
}
|
||||
|
||||
public function isMoon()
|
||||
{
|
||||
return (bool) ($this->getData('planet_type') == self::TYPE_MOON);
|
||||
}
|
||||
|
||||
public function getMoon()
|
||||
{
|
||||
static $statement = null;
|
||||
|
||||
if ($this->isMoon()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($this->_moon === null) {
|
||||
if ($statement === null) {
|
||||
$statement = new Legacies_Core_Collection(array('planet' => 'planets'), get_class($this));
|
||||
$statement
|
||||
->where('galaxy=:galaxy')
|
||||
->where('system=:system')
|
||||
->where('planet=:position')
|
||||
->where('planet_type=' . strval(self::TYPE_MOON))
|
||||
;
|
||||
}
|
||||
$statement->load(array(
|
||||
'galaxy' => $this->getGalaxy(),
|
||||
'system' => $this->getSystem(),
|
||||
'position' => $this->getPosition()
|
||||
));
|
||||
|
||||
$this->_moon = $statement->current();
|
||||
}
|
||||
return $this->_moon;
|
||||
}
|
||||
|
||||
public function setGalaxy($galaxy)
|
||||
{
|
||||
$this->setData('galaxy', $galaxy);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getGalaxy()
|
||||
{
|
||||
return (int) $this->getData('galaxy');
|
||||
}
|
||||
|
||||
public function setSystem($system)
|
||||
{
|
||||
$this->setData('system', $system);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSystem()
|
||||
{
|
||||
return (int) $this->getData('system');
|
||||
}
|
||||
|
||||
public function setPosition($position)
|
||||
{
|
||||
$this->setData('planet', $position);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPosition()
|
||||
{
|
||||
return (int) $this->getData('planet');
|
||||
}
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
$this->setData('planet_type', $type);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return (int) $this->getData('planet_type');
|
||||
}
|
||||
|
||||
public function getElement($elementId)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
return $this->getData($fields[$elementId]);
|
||||
}
|
||||
|
||||
public function setElement($elementId, $level)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
return $this->setData($fields[$elementId], $level);
|
||||
}
|
||||
|
||||
public function hasElement($elementId, $levelRequired = 0)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
return $this->hasData($fields[$elementId]) && Math::comp($this->getElement($elementId), $levelRequired) > 0;
|
||||
}
|
||||
|
||||
public static function registrationListener($eventData)
|
||||
{
|
||||
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) {
|
||||
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);
|
||||
|
||||
if ($collection->count() == 0) {
|
||||
throw new Exception('No planet to colonize there!'); // FIXME
|
||||
}
|
||||
|
||||
$systemInfo = $collection->current();
|
||||
if ($systemInfo->getData('count') >= MAX_PLANET_IN_SYSTEM) {
|
||||
throw new Exception('No planet to colonize there!'); // FIXME
|
||||
}
|
||||
$system = $systemInfo->getData('system');
|
||||
$galaxy = $systemInfo->getData('galaxy');
|
||||
|
||||
$collection = new Legacies_Core_Collection('planets');
|
||||
$collection
|
||||
->column(array('position' => 'planet.position'))
|
||||
->where('planet.planet_type=1')
|
||||
->where('planet.planet_type=:system')
|
||||
->load()
|
||||
;
|
||||
$positions = range(1, MAX_PLANET_IN_SYSTEM);
|
||||
foreach ($collection as $planet) {
|
||||
$key = array_search($planet->getData('position'), $positions);
|
||||
if ($key !== false) {
|
||||
unset($positions[$key]);
|
||||
}
|
||||
}
|
||||
$key = array_rand($positions, 1);
|
||||
$finalPosition = $positions[$key];
|
||||
|
||||
$planet = new self();
|
||||
$planet
|
||||
->setData('id_owner', $user->getId())
|
||||
->setData('name', $request->getParam('planet'))
|
||||
->setData('galaxy', $galaxy)
|
||||
->setData('system', $system)
|
||||
->setData('position', $finalPosition)
|
||||
->setData('planet_type', 1)
|
||||
;
|
||||
|
||||
Legacies::dispatchEvent('planet.init', array(
|
||||
'planet' => $planet,
|
||||
'user' => $user
|
||||
));
|
||||
|
||||
$planet
|
||||
->setData('field_max', 163)
|
||||
->setData('field_current', 0)
|
||||
->save()
|
||||
;
|
||||
|
||||
$user
|
||||
->setData('id_planet', $planet->getId())
|
||||
->setData('current_planet', $planet->getId())
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
public static function planetUpdateListener($eventData)
|
||||
{
|
||||
if (isset($eventData['planet'])) {
|
||||
$planet = $eventData['planet'];
|
||||
|
||||
$time = null;
|
||||
if (isset($eventData['time'])) {
|
||||
$time = $eventData['time'];
|
||||
}
|
||||
|
||||
if ($planet === null || !$planet instanceof Legacies_Empire_Model_Planet || !$planet->getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$user = $planet->getUser();
|
||||
if (($queue = $this->getData('b_building_id')) != '') {
|
||||
$explodedQueue = explode(';', $queue);
|
||||
foreach ($explodedQueue as $item) {
|
||||
$partialTime = $this->getData('b_building');
|
||||
|
||||
if ($partialTime < $time) {
|
||||
$planet->updateResources($partialTime);
|
||||
if (CheckPlanetBuildingQueue($planet, $user)) {
|
||||
SetNextQueueElementOnTop($planet, $user);
|
||||
}
|
||||
} else {
|
||||
$planet->updateResources($time);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$planet->updateResources($time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Building_CristalMine
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
||||
{
|
||||
return array(
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 20 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
|
||||
Legacies_Empire::RESOURCE_ENERGY => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
||||
{
|
||||
return array(
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
|
||||
Legacies_Empire::RESOURCE_ENERGY => -30 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Building_FusionReactor
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
||||
{
|
||||
return array(
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
|
||||
Legacies_Empire::RESOURCE_ENERGY => 50 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Building_MetalMine
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
||||
{
|
||||
return array(
|
||||
Legacies_Empire::RESOURCE_METAL => 30 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio),
|
||||
Legacies_Empire::RESOURCE_ENERGY => -10 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,487 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Shipyard building, manages ship and defenses building queue on each planet
|
||||
*
|
||||
* @access public
|
||||
* @category Empire
|
||||
* @category Planet
|
||||
* @package Legacies
|
||||
* @subpackage Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_Planet_Building_Shipyard
|
||||
implements Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
/**
|
||||
* Planet instance
|
||||
* @var Legacies_Empire_Model_Planet
|
||||
*/
|
||||
protected $_currentPlanet = null;
|
||||
|
||||
/**
|
||||
* User instance
|
||||
* @var Legacies_Empire_Model_User
|
||||
*/
|
||||
protected $_currentUser = null;
|
||||
|
||||
/**
|
||||
* construction queue
|
||||
* @var array
|
||||
*/
|
||||
protected $_queue = null;
|
||||
|
||||
/**
|
||||
* Current timestamp
|
||||
*
|
||||
* @var int
|
||||
* @deprecated
|
||||
*/
|
||||
private $_now = 0;
|
||||
|
||||
/**
|
||||
* Resource list
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_resourcesTypes = array(
|
||||
Legacies_Empire::RESOURCE_METAL,
|
||||
Legacies_Empire::RESOURCE_CRISTAL,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM,
|
||||
//Legacies_Empire::RESOURCE_ENERGY
|
||||
);
|
||||
|
||||
/**
|
||||
* Multiton instances
|
||||
* @var array
|
||||
*/
|
||||
protected static $_instances = array();
|
||||
|
||||
/**
|
||||
* Multiton factory. Retruns the planet's shipyard instance or created it if
|
||||
* it doesn't yet exist.
|
||||
*
|
||||
* @param Legacies_Empire_Model_Planet $currentPlanet
|
||||
* @param Legacies_Empire_Model_User $currentUser
|
||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
||||
*/
|
||||
public static function factory($currentPlanet, $currentUser)
|
||||
{
|
||||
if ($currentPlanet->getId()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset(self::$_instances[$currentPlanet->getId()])) {
|
||||
self::$_instances[$currentPlanet->getId()] = new self($currentPlanet, $currentUser);
|
||||
}
|
||||
return self::$_instances[$currentPlanet->getId()];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Used for specific usage, use the factory for standard usage.
|
||||
*
|
||||
* @see Legacies_Empire_Model_Planet_Building_Shipyard::factory()
|
||||
*
|
||||
* @param Legacies_Empire_Model_Planet $currentPlanet
|
||||
* @param Legacies_Empire_Model_User $currentUser
|
||||
*/
|
||||
public function __construct($currentPlanet, $currentUser)
|
||||
{
|
||||
$this->_currentPlanet = $currentPlanet;
|
||||
$this->_currentUser = $currentUser;
|
||||
|
||||
$this->_queue = unserialize($this->_currentPlanet->getData('b_hangar_id'));
|
||||
if (!is_array($this->_queue)) {
|
||||
$this->_queue = array();
|
||||
}
|
||||
|
||||
$this->_now = time();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the timestamp at the instance creation.
|
||||
*
|
||||
* @deprecated
|
||||
* @return int
|
||||
*/
|
||||
protected function _now()
|
||||
{
|
||||
return $this->_now;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$this->_currentPlanet->save();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append items to build to the construction list
|
||||
*
|
||||
* @param int $shipId
|
||||
* @param int|string $qty
|
||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
||||
*/
|
||||
public function appendQueue($shipId, $qty)
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
if (Math::comp($qty, 0) <= 0) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if (!$types->is($shipId, Legacies_Empire::TYPE_SHIP) && !$types->is($shipId, Legacies_Empire::TYPE_DEFENSE)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if (!$this->checkAvailability($shipId)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$qty = $this->_checkMaximumQuantity($shipId, $qty);
|
||||
|
||||
if (MAX_FLEET_OR_DEFS_PER_ROW > 0 && Math::comp($qty, MAX_FLEET_OR_DEFS_PER_ROW) > 0) {
|
||||
$qty = MAX_FLEET_OR_DEFS_PER_ROW;
|
||||
}
|
||||
|
||||
// Dispatch event
|
||||
Legacies::dispatchEvent('planet.shipyard.append-queue.before', array(
|
||||
'ship_id' => $shipId,
|
||||
'qty' => $qty,
|
||||
'shipyard' => $this,
|
||||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser
|
||||
));
|
||||
|
||||
$resourcesNeeded = $this->_getResourcesNeeded($shipId, $qty);
|
||||
$buildTime = $this->getBuildTime($shipId, $qty);
|
||||
|
||||
$this->_queue[] = new Legacies_Empire_Model_Planet_Building_Shipyard_Item(array(
|
||||
'ship_id' => $shipId,
|
||||
'qty' => $qty,
|
||||
'created_at' => $this->_now(),
|
||||
'updated_at' => $this->_now()
|
||||
));
|
||||
|
||||
foreach ($this->_resourcesTypes as $resourceType) {
|
||||
$this->_currentPlanet[$resourceType] = Math::sub($this->_currentPlanet[$resourceType], $resourcesNeeded[$resourceType]);
|
||||
}
|
||||
|
||||
// Dispatch event
|
||||
Legacies::dispatchEvent('planet.shipyard.append-queue.after', array(
|
||||
'ship_id' => $shipId,
|
||||
'qty' => $qty,
|
||||
'shipyard' => $this,
|
||||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the contruction queue.
|
||||
*
|
||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
||||
*/
|
||||
public function updateQueue($time = null)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
if ($time === null) {
|
||||
$time = $this->_now();
|
||||
}
|
||||
$elapsedTime = $time - $this->_currentPlanet['b_hangar'];
|
||||
|
||||
// Dispatch event
|
||||
Legacies::dispatchEvent('planet.shipyard.update-queue.before', array(
|
||||
'shipyard' => $this,
|
||||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser
|
||||
));
|
||||
|
||||
foreach ($this->_queue as $id => &$element) {
|
||||
$shipId = $element->getData('ship_id');
|
||||
$qty = $element->getData('qty');
|
||||
$buildTime = $this->getBuildTime($shipId, $qty);
|
||||
|
||||
if ($elapsedTime >= $buildTime) {
|
||||
$this->_currentPlanet[$fields[$shipId]] = Math::add($this->_currentPlanet[$fields[$shipId]], $qty);
|
||||
$elapsedTime -= $buildTime;
|
||||
unset($this->_queue[$id]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$timeRatio = $elapsedTime / $buildTime;
|
||||
$itemsBuilt = Math::mul($timeRatio, $qty);
|
||||
|
||||
$element->setData('updated_at', $time);
|
||||
$element->setData('qty', Math::sub($qty, $itemsBuilt));
|
||||
$this->_currentPlanet->setData($fields[$shipId], Math::add($this->_currentPlanet->getData($fields[$shipId]), $itemsBuilt));
|
||||
break;
|
||||
}
|
||||
unset($element);
|
||||
|
||||
// Dispatch event
|
||||
Legacies::dispatchEvent('planet.shipyard.update-queue.after', array(
|
||||
'shipyard' => $this,
|
||||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the construction queue
|
||||
* @see Legacies_Empire_Model_Planet_Building_Shipyard_Item
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getQueue()
|
||||
{
|
||||
return $this->_queue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a ship or defense type is actually buildable on the current
|
||||
* planet, depending on the technology and buildings requirements.
|
||||
*
|
||||
* @param int $shipId
|
||||
* @return bool
|
||||
*/
|
||||
public function checkAvailability($shipId)
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
$requirements = Legacies_Empire_Model_Game_Requirements::getSingleton();
|
||||
|
||||
if (!isset($requirements[$shipId]) || empty($requirements[$shipId])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach ($requirements[$shipId] as $requirement => $level) {
|
||||
if ($types->is($requirement, Legacies_Empire::TYPE_BUILDING) && $this->_currentPlanet->hasElement($requirement, $level)) {
|
||||
continue;
|
||||
} else if ($types->is($requirement, Legacies_Empire::TYPE_RESEARCH) && $this->_currentUser->hasElement($requirement, $level)) {
|
||||
continue;
|
||||
} else if ($types->is($requirement, Legacies_Empire::TYPE_DEFENSE) && $this->_currentPlanet->hasElement($requirement, $level)) {
|
||||
continue;
|
||||
} else if ($types->is($requirement, Legacies_Empire::TYPE_SHIP) && $this->_currentPlanet->hasElement($requirement, $level)) {
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
// Dispatch event. Throw an exception to break the avaliability.
|
||||
Legacies::dispatchEvent('planet.shipyard.check-availability', array(
|
||||
'ship_id' => $shipId,
|
||||
'shipyard' => $this,
|
||||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser
|
||||
));
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the quantity set in parameter or the maximum buildable elements
|
||||
* if the quantity requested exeeds this number.
|
||||
*
|
||||
* @param int $shipId
|
||||
* @param int|string $qty
|
||||
* @return int|stirng
|
||||
*/
|
||||
protected function _checkMaximumQuantity($shipId, $qty)
|
||||
{
|
||||
$max = $this->getMaximumBuildableElementsCount($shipId);
|
||||
|
||||
if (Math::comp($qty, $max) > 0) {
|
||||
return $max;
|
||||
}
|
||||
|
||||
return $qty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum quantity of elements that are possible to build on
|
||||
* the current planet.
|
||||
*
|
||||
* @param int $shipId
|
||||
* @return int|string
|
||||
*/
|
||||
public function getMaximumBuildableElementsCount($shipId)
|
||||
{
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
$resources = array(
|
||||
Legacies_Empire::RESOURCE_METAL,
|
||||
Legacies_Empire::RESOURCE_CRISTAL,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM,
|
||||
Legacies_Empire::RESOURCE_ENERGY
|
||||
);
|
||||
|
||||
$qty = 0;
|
||||
foreach ($resources as $resourceId) {
|
||||
if (isset($prices[$shipId]) && isset($prices[$shipId][$resourceId]) && Math::comp($prices[$shipId][$resourceId], 0) > 0) {
|
||||
$maxQty = Math::floor(Math::div($this->_currentPlanet->getData($resourceId), $prices[$shipId][$resourceId]));
|
||||
|
||||
if ($maxQty == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($qty == 0 || Math::comp($maxQty, $qty) < 0) {
|
||||
$qty = $maxQty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($qty == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$limitedElementsQty = array(
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => array(
|
||||
'current' => $this->_currentPlanet[$fields[Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME]],
|
||||
'requested' => $this->_currentPlanet[$fields[Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME]],
|
||||
'limit' => 1
|
||||
),
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => array(
|
||||
'current' => $this->_currentPlanet[$fields[Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME]],
|
||||
'requested' => $this->_currentPlanet[$fields[Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME]],
|
||||
'limit' => 1
|
||||
),
|
||||
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => array(
|
||||
'current' => $this->_currentPlanet[$fields[Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE]],
|
||||
'requested' => $this->_currentPlanet[$fields[Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE]],
|
||||
'limit' => $this->_currentPlanet[$fields[Legacies_Empire::ID_BUILDING_MISSILE_SILO]] * 10
|
||||
),
|
||||
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => array(
|
||||
'current' => $this->_currentPlanet[$fields[Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE]],
|
||||
'requested' => $this->_currentPlanet[$fields[Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE]],
|
||||
'limit' => $this->_currentPlanet[$fields[Legacies_Empire::ID_BUILDING_MISSILE_SILO]] * 5
|
||||
)
|
||||
);
|
||||
|
||||
if (in_array($shipId, array_keys($limitedElementsQty))) {
|
||||
foreach ($this->_queue as $element) {
|
||||
if ($element['ship_id'] != $shipId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$limitedElementsQty[$shipId]['requested'] = Math::add($limitedElementsQty[$shipId]['requested'], $element['qty']);
|
||||
if (Math::comp($limitedElementsQty[$shipId]['requested'], $limitedElementsQty[$shipId]['limit']) >= 0) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (Math::comp($limitedElementsQty[$shipId]['current'], $limitedElementsQty[$shipId]['limit']) >= 0) {
|
||||
return 0;
|
||||
}
|
||||
if (Math::comp($qty, $limitedElementsQty[$shipId]['limit']) >= 0) {
|
||||
return $limitedElementsQty[$shipId]['limit'];
|
||||
}
|
||||
}
|
||||
|
||||
return $qty;
|
||||
}
|
||||
|
||||
protected function _getResourcesNeeded($shipId, $qty)
|
||||
{
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
|
||||
$resourcesNeeded = array();
|
||||
foreach ($this->_resourcesTypes as $resourceId) {
|
||||
if (isset($prices[$shipId]) && isset($prices[$shipId][$resourceId]) && $prices[$shipId][$resourceId] > 0) {
|
||||
$resourcesNeeded[$resourceId] = Math::mul($prices[$shipId][$resourceId], $qty);
|
||||
}
|
||||
}
|
||||
|
||||
return $resourcesNeeded;
|
||||
}
|
||||
|
||||
public function getBuildTime($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();
|
||||
|
||||
$scale = 30;
|
||||
|
||||
$totalCost = Math::mul(Math::add($prices[$shipId][Legacies_Empire::RESOURCE_METAL], $prices[$shipId][Legacies_Empire::RESOURCE_CRISTAL]), $qty, $scale);
|
||||
$speedFactor = $gameConfig->getData('game_speed');
|
||||
|
||||
$shipyardSpeedup = Math::div(1, Math::add($this->_currentPlanet[$fields[Legacies_Empire::ID_BUILDING_SHIPYARD]], 1, $scale), $scale);
|
||||
$naniteSpeedup = Math::pow(.5, $this->_currentPlanet[$fields[Legacies_Empire::ID_BUILDING_NANITE_FACTORY]], $scale);
|
||||
$structuresSpeedup = Math::mul($shipyardSpeedup, $naniteSpeedup, $scale);
|
||||
|
||||
$officerSpeedup = 1;
|
||||
if (in_array($shipId, $types[Legacies_Empire::TYPE_SHIP])) {
|
||||
$officerSpeedup = 1 - ($this->_currentUser['rpg_technocrate'] * .05);
|
||||
} else if (in_array($shipId, $types[Legacies_Empire::TYPE_SPECIAL])) {
|
||||
$officerSpeedup = 1 - ($this->_currentUser['rpg_technocrate'] * .05);
|
||||
} else if (in_array($shipId, $types[Legacies_Empire::TYPE_DEFENSE])) {
|
||||
$officerSpeedup = 1 - ($this->_currentUser['rpg_defenseur'] * .375);
|
||||
}
|
||||
|
||||
$baseTime = ($totalCost / $speedFactor) * $structuresSpeedup;
|
||||
|
||||
return $baseTime * $officerSpeedup * 3600;
|
||||
}
|
||||
|
||||
public static function planetUpdateListener($eventData)
|
||||
{
|
||||
if (isset($eventData['planet'])) {
|
||||
$planet = $eventData['planet'];
|
||||
|
||||
if ($planet === null || !$planet instanceof Legacies_Empire_Model_Planet || !$planet->getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$time = null;
|
||||
if (isset($eventData['time'])) {
|
||||
$time = $eventData['time'];
|
||||
}
|
||||
|
||||
$shipyard = self::factory($planet, $planet->getUser());
|
||||
if ($shipyard !== null) {
|
||||
$shipyard->updateQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Building_Shipyard_Item
|
||||
extends Legacies_Object
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Building_SolarPlant
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
public function getProductionRatios($level, $produtionRatio, $planet, $user)
|
||||
{
|
||||
return array(
|
||||
Legacies_Empire::RESOURCE_ENERGY => 20 * floatval($level) * pow(1.1, floatval($level)) * (0.1 * $produtionRatio)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
interface Legacies_Empire_Model_Planet_BuildingInterface
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
interface Legacies_Empire_Model_Planet_ResourceProductionInterface
|
||||
{
|
||||
public function getProductionRatios($level, $produtionRatio, $planet, $user);
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Ship_SolarSatellite
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
public function getProductionRatios($quantity, $produtionRatio, $planet, $user)
|
||||
{
|
||||
return array(
|
||||
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Ship_Supernova
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
public function getProductionRatios($quantity, $produtionRatio, $planet, $user)
|
||||
{
|
||||
return array(
|
||||
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity) * -1250
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
interface Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,301 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
*
|
||||
* @uses Legacies_Object
|
||||
* @uses Legacies_Empire
|
||||
*/
|
||||
class Legacies_Empire_Model_User
|
||||
extends Legacies_Core_Entity
|
||||
{
|
||||
protected static $_instances = array();
|
||||
|
||||
protected static $_singleton = null;
|
||||
|
||||
const SESSION_KEY = 'user';
|
||||
const COOKIE_NAME = 'legacies';
|
||||
const COOKIE_LIFETIME = 2592000;
|
||||
|
||||
const PLANET_SORT_DATE = 0;
|
||||
const PLANET_SORT_POSITION = 1;
|
||||
const PLANET_SORT_NAME = 2;
|
||||
|
||||
public static function factory($id)
|
||||
{
|
||||
if ($id === null) {
|
||||
return new self();
|
||||
}
|
||||
|
||||
$id = intval($id);
|
||||
if (!isset(self::$_instances[$id])) {
|
||||
$instance = new self();
|
||||
$params = func_get_args();
|
||||
call_user_func_array(array($instance, 'load'), $params);
|
||||
self::$_instances[$id] = $instance;
|
||||
}
|
||||
return self::$_instances[$id];
|
||||
}
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
$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::COOKIE_NAME)) !== null) {
|
||||
$cookieData = unserialize(stripslashes($cookie));
|
||||
if (is_array($cookieData)) {
|
||||
$collection = new Legacies_Core_Collection(array('user' => 'users'));
|
||||
$cookieData = array(
|
||||
'id' => (isset($cookieData['id']) ? intval($cookieData['id']) : 0),
|
||||
'key' => (isset($cookieData['key']) ? $collection->quote($cookieData['key']) : null)
|
||||
);
|
||||
|
||||
$collection
|
||||
->column('id')
|
||||
->where('user.id=:id')
|
||||
->where(':key=CONCAT((@salt:=MID(:key, 0, 4)), SHA1(CONCAT(user.username, user.password, @salt)))')
|
||||
->load($cookieData)
|
||||
;
|
||||
|
||||
if ($collection->count() > 0) {
|
||||
$session->setData(self::SESSION_KEY, $cookieData['id']);
|
||||
} else {
|
||||
$session->addError('Your session has expired, please login.');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$session->addError('Your session has expired, please login.');
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
self::$_singleton = self::factory($id);
|
||||
} catch (Legacies_Core_Model_Exception $e) {
|
||||
$session->addError('Session error.');
|
||||
return null;
|
||||
}
|
||||
self::$_singleton->_updateActivity();
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
protected function _init()
|
||||
{
|
||||
$this->setIdFieldName('id');
|
||||
$this->setTableName('users');
|
||||
}
|
||||
|
||||
protected function _updateActivity()
|
||||
{
|
||||
$this
|
||||
->setData('request_uri', $_SERVER['REQUEST_URI'])
|
||||
->setData('remote_addr', $_SERVER['REMOTE_ADDR'])
|
||||
->setData('user_agent', $_SERVER['HTTP_USER_AGENT'])
|
||||
->setData('onlinetime', time())
|
||||
->save()
|
||||
;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
if (Legacies::$response !== null) {
|
||||
Legacies::$response->unsetCookie(self::COOKIE_NAME);
|
||||
}
|
||||
Legacies_Core_Model_Session::destroy();
|
||||
}
|
||||
|
||||
public static function login($username, $password, $remember = false)
|
||||
{
|
||||
static $statement = null;
|
||||
|
||||
$session = Legacies::getSession(self::SESSION_KEY);
|
||||
|
||||
$collection = new Legacies_Core_Collection(array('user' => 'users'));
|
||||
$collection
|
||||
->column('user.id')
|
||||
->column('user.username')
|
||||
->column('user.banaday')
|
||||
->column('(CASE WHEN MD5(:password)=user.password THEN 1 ELSE 0 END) AS login_success')
|
||||
->column('CONCAT((@salt:=MID(MD5(RAND()), 0, 4)), SHA1(CONCAT(user.username, user.password, @salt))) AS login_rememberme')
|
||||
->where('user.username=:username')
|
||||
->load(array(
|
||||
'username' => $username,
|
||||
'password' => $password
|
||||
))
|
||||
;
|
||||
|
||||
if ($collection->count() <= 0) {
|
||||
$session->addError('No such user.');
|
||||
return null;
|
||||
}
|
||||
$login = $collection->current();
|
||||
|
||||
if (intval($login['login_success']) == 1) {
|
||||
if ($login['banaday'] != 0) {
|
||||
if($login['banaday'] <= time() && $login['banaday'] != '0') {
|
||||
$user->setData('banaday', 0)
|
||||
->setData('bana', 0)
|
||||
->setData('urlaubs_modus', 0)
|
||||
->save()
|
||||
;
|
||||
} else {
|
||||
$session->addError('You were banned, please contact admin for more information.');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_POST["rememberme"]) && Legacies::$request !== null) {
|
||||
Legacies::$response->setCookie(self::COOKIE_NAME, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
|
||||
}
|
||||
|
||||
self::$_singleton = self::factory($login['id']);
|
||||
self::$_singleton->_updateActivity();
|
||||
|
||||
$session->setData('user_id', intval($login['id']));
|
||||
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
$session->addError('Your username or credential is invalid, please check your input.');
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function register($username, $email, $password)
|
||||
{
|
||||
try {
|
||||
$user = new self(array(
|
||||
'username' => $username,
|
||||
'password' => md5($password),
|
||||
'email' => $email,
|
||||
'email_2' => $email
|
||||
));
|
||||
|
||||
$user->save();
|
||||
|
||||
Legacies::dispatchEvent('user.init', array(
|
||||
'user' => $user
|
||||
));
|
||||
|
||||
$user->save();
|
||||
} catch (Legacies_Core_Model_Exception $e) {
|
||||
$session->addError($e->getMessage());
|
||||
return null;
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function getCurrentPlanet()
|
||||
{
|
||||
$planetId = $this->getData('current_planet');
|
||||
if (!$planetId) {
|
||||
$planetId = $this->getData('id_planet');
|
||||
$this->setData('current_planet', $planetId)->save();
|
||||
}
|
||||
return Legacies_Empire_Model_Planet::factory($planetId);
|
||||
}
|
||||
|
||||
public function getPlanetCollection()
|
||||
{
|
||||
$planetCollection = new Legacies_Core_Collection(array('planet' => 'planets'), 'Legacies_Empire_Model_Planet');
|
||||
$planetCollection->where('id_owner=:user');
|
||||
|
||||
$order = ($user['planet_sort_order'] == 1) ? 'DESC' : 'ASC';
|
||||
|
||||
switch ($this->getData('planet_sort')) {
|
||||
case self::PLANET_SORT_POSITION:
|
||||
$planetCollection
|
||||
->order('planet.galaxy', $order)
|
||||
->order('planet.system', $order)
|
||||
->order('planet.planet', $order)
|
||||
->order('planet.planet_type', $order)
|
||||
;
|
||||
break;
|
||||
|
||||
case self::PLANET_SORT_NAME:
|
||||
$planetCollection->order('planet.name', $order);
|
||||
break;
|
||||
|
||||
case self::PLANET_SORT_DATE:
|
||||
default:
|
||||
$planetCollection->order('planet.id', $order);
|
||||
break;
|
||||
}
|
||||
|
||||
$planetCollection->load(array(
|
||||
'user' => $this->getId()
|
||||
));
|
||||
|
||||
return $planetCollection;
|
||||
}
|
||||
|
||||
public function getFleets()
|
||||
{
|
||||
$collection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
||||
$collection
|
||||
->setEntityClassName('Legacies_Empire_Model_Fleet')
|
||||
->where('fleet_owner <= :user_id')
|
||||
->load(array('user_id' => $this->getId()))
|
||||
;
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function getVisibleFleets()
|
||||
{
|
||||
|
||||
$user = Legacies_Empire_Model_User::getSingleton();
|
||||
$firstCollection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
||||
$firstCollection
|
||||
// ->column('*')
|
||||
->column('fleet.fleet_start_galaxy', 'galaxy')
|
||||
->column('fleet.fleet_start_system', 'system')
|
||||
->column('fleet.fleet_start_planet', 'planet')
|
||||
->column('fleet.fleet_start_type', 'planet_type')
|
||||
->where('fleet_end_time <= :now')
|
||||
;
|
||||
$backCollection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
||||
$backCollection
|
||||
// ->column('*')
|
||||
->column('fleet.fleet_end_galaxy', 'galaxy')
|
||||
->column('fleet.fleet_end_system', 'system')
|
||||
->column('fleet.fleet_end_planet', 'planet')
|
||||
->column('fleet.fleet_end_type', 'planet_type')
|
||||
->where('fleet_end_time <= :now')
|
||||
;
|
||||
$collection = new Legacies_Core_Collection();
|
||||
$collection
|
||||
->setEntityClassName('Legacies_Empire_Model_Fleet')
|
||||
->union($firstCollection)
|
||||
->union($backCollection)
|
||||
->load(array('now' => time()));
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function getElement($elementId)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
return $this->getData($fields[$elementId]);
|
||||
}
|
||||
|
||||
public function setElement($elementId, $level)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
return $this->setData($fields[$elementId], $level);
|
||||
}
|
||||
|
||||
public function hasElement($elementId, $levelRequired = 0)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
return $this->hasData($fields[$elementId]) && Math::comp($this->getElement($elementId), $levelRequired) > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
interface Legacies_Exception {}
|
||||
102
includes/application/code/community/Legacies/Object.php
Normal file
102
includes/application/code/community/Legacies/Object.php
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Object
|
||||
implements ArrayAccess
|
||||
{
|
||||
protected $_data = array();
|
||||
|
||||
public function __construct(Array $data = array())
|
||||
{
|
||||
$this->_data = $data;
|
||||
}
|
||||
|
||||
public function getData($key)
|
||||
{
|
||||
if ($this->hasData($key)) {
|
||||
return $this->_data[$key];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getAllDatas()
|
||||
{
|
||||
return $this->_data;
|
||||
}
|
||||
|
||||
public function hasData($key)
|
||||
{
|
||||
return (bool) isset($this->_data[$key]);
|
||||
}
|
||||
|
||||
public function setData($key, $value)
|
||||
{
|
||||
$this->_data[$key] = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addData(Array $data)
|
||||
{
|
||||
foreach ($data as $key => $value) {
|
||||
$this->setData($key, $value);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function unsetData($key)
|
||||
{
|
||||
if ($this->hasData($key)) {
|
||||
unset($this->_data[$key]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function clearData()
|
||||
{
|
||||
$this->_data = array();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return $this->hasData($offset);
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->getData($offset);
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $data)
|
||||
{
|
||||
return $this->setData($offset, $data);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
return $this->unsetData($offset);
|
||||
}
|
||||
|
||||
public function __set($key, $value)
|
||||
{
|
||||
return $this->setData($key, $value);
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
return $this->getData($key, $value);
|
||||
}
|
||||
|
||||
public function __unset($key)
|
||||
{
|
||||
return $this->unsetData($key);
|
||||
}
|
||||
|
||||
public function __isset($key)
|
||||
{
|
||||
return $this->hasData($key);
|
||||
}
|
||||
}
|
||||
73
includes/application/code/community/Math.php
Normal file
73
includes/application/code/community/Math.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
class Math
|
||||
{
|
||||
protected static $_singleton = null;
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
if (extension_loaded('bcmath')) {
|
||||
self::$_singleton = new Math_Bcmath();
|
||||
} else {
|
||||
self::$_singleton = new Math_Native();
|
||||
}
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
public static function add($a, $b)
|
||||
{
|
||||
return self::getSingleton()->add($a, $b);
|
||||
}
|
||||
|
||||
public static function sub($a, $b)
|
||||
{
|
||||
return self::getSingleton()->sub($a, $b);
|
||||
}
|
||||
|
||||
public static function mul($a, $b)
|
||||
{
|
||||
return self::getSingleton()->mul($a, $b);
|
||||
}
|
||||
|
||||
public static function div($a, $b)
|
||||
{
|
||||
return self::getSingleton()->div($a, $b);
|
||||
}
|
||||
|
||||
public static function comp($a, $b)
|
||||
{
|
||||
return self::getSingleton()->comp($a, $b);
|
||||
}
|
||||
|
||||
public static function pow($a, $b)
|
||||
{
|
||||
return self::getSingleton()->pow($a, $b);
|
||||
}
|
||||
|
||||
public static function mod($a, $b)
|
||||
{
|
||||
return self::getSingleton()->mod($a, $b);
|
||||
}
|
||||
|
||||
public static function ceil($a)
|
||||
{
|
||||
return self::getSingleton()->ceil($a);
|
||||
}
|
||||
|
||||
public static function floor($a)
|
||||
{
|
||||
return self::getSingleton()->floor($a);
|
||||
}
|
||||
|
||||
public static function round($a, $range = 0)
|
||||
{
|
||||
return self::getSingleton()->round($a, $range);
|
||||
}
|
||||
|
||||
public static function render($a)
|
||||
{
|
||||
return self::getSingleton()->render($a);
|
||||
}
|
||||
}
|
||||
119
includes/application/code/community/Math/Bcmath.php
Normal file
119
includes/application/code/community/Math/Bcmath.php
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
class Math_Bcmath
|
||||
{
|
||||
public function add($a, $b)
|
||||
{
|
||||
return bcadd($a, $b);
|
||||
}
|
||||
|
||||
public function mul($a, $b)
|
||||
{
|
||||
return bcmul($a, $b);
|
||||
}
|
||||
|
||||
public function sub($a, $b)
|
||||
{
|
||||
return bcsub($a, $b);
|
||||
}
|
||||
|
||||
public function div($a, $b)
|
||||
{
|
||||
return bcdiv($a, $b);
|
||||
}
|
||||
|
||||
public function mod($a, $b)
|
||||
{
|
||||
return bcmod($a, $b);
|
||||
}
|
||||
|
||||
public function pow($a, $b)
|
||||
{
|
||||
return bcpow($a, $b);
|
||||
}
|
||||
|
||||
public function comp($a, $b)
|
||||
{
|
||||
return bccomp($a, $b);
|
||||
}
|
||||
|
||||
public function ceil($x)
|
||||
{
|
||||
$integer = bcmul($x, 1, 0);
|
||||
$decimals = bcsub($x, $integer);
|
||||
|
||||
if (bccomp($decimals, 0) > 0) {
|
||||
return bcadd($integer, 1);
|
||||
} else {
|
||||
return $integer;
|
||||
}
|
||||
}
|
||||
|
||||
public function floor($x)
|
||||
{
|
||||
$integer = bcmul($x, 1, 0);
|
||||
$decimals = bcsub($x, $integer);
|
||||
|
||||
if (bccomp($decimals, 0) < 0) {
|
||||
return bcsub($integer, 1);
|
||||
} else {
|
||||
return $integer;
|
||||
}
|
||||
}
|
||||
|
||||
public function round($x, $range = 0)
|
||||
{
|
||||
$integer = bcmul($x, 1, 0);
|
||||
$decimals = bcsub($x, $integer, $range);
|
||||
|
||||
if (bccomp($decimals, 0) > 0) {
|
||||
return bcadd($integer, '0.' . str_pad('5', $range, STR_PAD_LEFT), $range);
|
||||
} else {
|
||||
return bcsub($integer, '0.' . str_pad('5', $range, STR_PAD_LEFT), $range);
|
||||
}
|
||||
}
|
||||
|
||||
public function render($a)
|
||||
{
|
||||
if (!$a) {
|
||||
return '0';
|
||||
}
|
||||
|
||||
$pos = strrpos(strval($a), '.');
|
||||
$a = substr(strval($a), 0, $pos);
|
||||
|
||||
$length = $pos + ((3 - ($pos % 3)) % 3);
|
||||
$a = str_pad($a, $length, ' ', STR_PAD_LEFT);
|
||||
$parts = str_split($a, 3);
|
||||
switch ((int) (count($parts) / 3)) {
|
||||
case 0:
|
||||
case 1:
|
||||
return implode('.', $parts);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'M';
|
||||
break;
|
||||
|
||||
case 3:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'G';
|
||||
break;
|
||||
|
||||
case 4:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'T';
|
||||
break;
|
||||
|
||||
case 5:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'P';
|
||||
break;
|
||||
|
||||
case 6:
|
||||
return implode('.', array_slice($parts, 0, 2)) . 'Y';
|
||||
break;
|
||||
|
||||
default:
|
||||
return implode('.', array_slice($parts, 0, sizeof($parts) - 18)) . 'Z';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
59
includes/application/code/community/Math/Native.php
Normal file
59
includes/application/code/community/Math/Native.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
class Math_Native
|
||||
{
|
||||
public function add($a, $b)
|
||||
{
|
||||
return $a + $b;
|
||||
}
|
||||
|
||||
public function mul($a, $b)
|
||||
{
|
||||
return $a * $b;
|
||||
}
|
||||
|
||||
public function sub($a, $b)
|
||||
{
|
||||
return $a - $b;
|
||||
}
|
||||
|
||||
public function div($a, $b)
|
||||
{
|
||||
return $a / $b;
|
||||
}
|
||||
|
||||
public function mod($a, $b)
|
||||
{
|
||||
return $a % $b;
|
||||
}
|
||||
|
||||
public function pow($a, $b)
|
||||
{
|
||||
return pow($a, $b);
|
||||
}
|
||||
|
||||
public function comp($a, $b)
|
||||
{
|
||||
return ($a > $b) ? 1 : ($a < $b) ? -1 : 0;
|
||||
}
|
||||
|
||||
public function ceil($x)
|
||||
{
|
||||
return ceil($x);
|
||||
}
|
||||
|
||||
public function floor($x)
|
||||
{
|
||||
return floor($x);
|
||||
}
|
||||
|
||||
public function round($range = 0)
|
||||
{
|
||||
return round($x, $range);
|
||||
}
|
||||
|
||||
public function render($a, $b)
|
||||
{
|
||||
return strval(number_format($a, 0, ',', '.'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
<span>Hello world!!</span>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php foreach ($this->getResourceIds() as $resourceId):?>
|
||||
<div class="resource-<?php echo $this->escape($resourceId) ?>">
|
||||
<?php echo $this->getResourceBlock($resourceId)->render()?>
|
||||
</div>
|
||||
<?php endforeach?>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php if ($this->getData('overload')) :?>
|
||||
<span class="overload"><?php echo $this->renderNumber($this->getData('stock'))?></span>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getData('stock'))?>
|
||||
<?php endif?>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?php if ($this->getData('overload')) :?>
|
||||
<span class="overload"><?php echo $this->renderNumber($this->getData('usage'))?></span> / <?php echo $this->renderNumber($this->getData('stock'))?>
|
||||
<?php else:?>
|
||||
<?php echo $this->renderNumber($this->getData('usage'))?> / <?php echo $this->renderNumber($this->getData('stock'))?>
|
||||
<?php endif?>
|
||||
4
includes/application/locale/fr_FR/Legacies_User.csv
Normal file
4
includes/application/locale/fr_FR/Legacies_User.csv
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
"Your session has expired, please login.","Votre session a expiré, veuillez vous identifier de nouveau."
|
||||
"Your username or credential is invalid, please check your input.","Your username or credential is invalid, please check your input."
|
||||
"No such user.","No such user."
|
||||
"You were banned, please contact admin for more information.","You were banned, please contact admin for more information."
|
||||
|
265
includes/application/scripts/legacies/client.js
Normal file
265
includes/application/scripts/legacies/client.js
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* Main application script execution class
|
||||
*
|
||||
* @param string responder
|
||||
* @param int messageOffset
|
||||
*/
|
||||
|
||||
function Legacies_Client(responder, messageOffset) {
|
||||
if (!document.querySelectorAll) {
|
||||
alert("Your browser is not compatible with CSS selectors API.\n\nCould not continue.");
|
||||
return;
|
||||
}
|
||||
this.responder = responder;
|
||||
this.messages = [];
|
||||
this.messageId = messageOffset || 1;
|
||||
this.callbacks = {};
|
||||
this.recurrentMessages = [];
|
||||
|
||||
this.send = (function() {
|
||||
if (this.messages.length == 0) {
|
||||
return this;
|
||||
}
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('POST', this.responder, false);
|
||||
request.send(JSON.stringify(this.messages));
|
||||
this.messages = [];
|
||||
for (var i in this.recurrentMessages) {
|
||||
this.enqueue(this.recurrentMessages[i].action, this.recurrentMessages[i].params, this.recurrentMessages[i].callback);
|
||||
}
|
||||
if(request.status == 404) {
|
||||
alert('Request failed, responder not found.');
|
||||
return this;
|
||||
}
|
||||
try {
|
||||
var response = JSON.parse(request.responseText);
|
||||
} catch (e) {
|
||||
alert('Invalid response.');
|
||||
return this;
|
||||
}
|
||||
if(request.status == 200) {
|
||||
for (var i in response) {
|
||||
this._callback(response[i]);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}).bind(this);
|
||||
|
||||
this.main = (function(interval) {
|
||||
setInterval(this.send, interval || 30000);
|
||||
}).bind(this);
|
||||
|
||||
this.enqueue = (function(action, params){
|
||||
this.messages.push({'uid':this.messageId++,'action':action,'params':params});
|
||||
return this;
|
||||
}).bind(this);
|
||||
|
||||
this.enqueueRecurrent = (function(action, params, callback) {
|
||||
this.recurrentMessages.push({'callback':callback,'action':action,'params':params});
|
||||
this.enqueue(action, params, callback);
|
||||
}).bind(this);
|
||||
|
||||
this._callback = (function(message){
|
||||
if (message.error === undefined || message.payload === undefined) {
|
||||
return this;
|
||||
}
|
||||
if (message.error === true) {
|
||||
if (typeof(message.payload.messages) == 'string') {
|
||||
alert(message.payload.messages);
|
||||
} else {
|
||||
var info = '';
|
||||
for (var i in message.payload.messages) {
|
||||
info = info + "\n[" + i + "]:\n" + message.payload.messages[i].join("\n") + "\n";
|
||||
}
|
||||
alert("Errors were returned:\n" + info);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (message.callback && this.CallbackType[message.callback]) {
|
||||
(this.CallbackType[message.callback]).bind(this)(message.payload);
|
||||
}
|
||||
return this;
|
||||
}).bind(this);
|
||||
|
||||
this.login = (function(username, password, rememberme) {
|
||||
var params = {
|
||||
'username': username,
|
||||
'password': password,
|
||||
'rememberme': rememberme || false
|
||||
};
|
||||
this.enqueue('user.account.login', params).send();
|
||||
return this;
|
||||
}).bind(this);
|
||||
|
||||
this.logout = (function() {
|
||||
this.enqueue('user.account.logout', {}).send();
|
||||
return this;
|
||||
}).bind(this);
|
||||
|
||||
this.form = (function(event) {
|
||||
event.preventDefault();
|
||||
var form = event.target;
|
||||
var params = {};
|
||||
for (var i = 0; i < form.length; i++) {
|
||||
if (!form[i].name || !form[i].type) {
|
||||
continue;
|
||||
}
|
||||
if (form[i].type == 'checkbox') {
|
||||
if (form[i].checked) {
|
||||
params[form[i].name] = true;
|
||||
} else {
|
||||
params[form[i].name] = false;
|
||||
}
|
||||
} else if (form[i].type == 'radio') {
|
||||
params[form[i].name] = form[i].value;
|
||||
} else if (form[i].value !== undefined) {
|
||||
params[form[i].name] = form[i].value;
|
||||
}
|
||||
}
|
||||
var action = form.action.slice(form.action.indexOf('#') + 1);
|
||||
this.enqueue(action, params, this.CallbackType.updater).send();
|
||||
}).bind(this);
|
||||
|
||||
this.CallbackType = {
|
||||
redirector: function(payload) {
|
||||
if (payload.redirect) {
|
||||
document.location.href = payload.redirect;
|
||||
}
|
||||
},
|
||||
updater: function(payload) {
|
||||
if (payload.html && payload.selector) {
|
||||
var parent = $$(payload.selector);
|
||||
var handler = document.createElement("div");
|
||||
handler.innerHTML = payload.html;
|
||||
|
||||
var fragment = document.createDocumentFragment();
|
||||
for (var i = 0; i < handler.childNodes.length; i++) {
|
||||
fragment.appendChild(handler.childNodes[i]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < parent.length; i++) {
|
||||
parent[i].appendChild(fragment.cloneNode(true));
|
||||
}
|
||||
}
|
||||
},
|
||||
script: function(payload) {
|
||||
if (payload.script) {
|
||||
eval(payload.script);
|
||||
}
|
||||
},
|
||||
error: function(payload) {
|
||||
if (payload.messages) {
|
||||
alert(payload.messages.join(', '));
|
||||
}
|
||||
},
|
||||
show: function(payload) {
|
||||
if (payload.selector) {
|
||||
var elementList = $$(payload.selector);
|
||||
for (var i = 0; i < elementList.length; i++) {
|
||||
elementList[i].style.display = 'block';
|
||||
}
|
||||
}
|
||||
},
|
||||
hide: function(payload) {
|
||||
if (payload.selector) {
|
||||
var elementList = $$(payload.selector);
|
||||
for (var i = 0; i < elementList.length; i++) {
|
||||
elementList[i].style.display = 'none';
|
||||
}
|
||||
}
|
||||
},
|
||||
callback: function(payload) {
|
||||
if (payload.callback) {
|
||||
payload.callback.apply(this, payload.params);
|
||||
}
|
||||
},
|
||||
enqueueRecurrent: function(payload) {
|
||||
if (payload.action && payload.params && payload.callback) {
|
||||
this.enqueueRecurrent(payload.action, payload.params, payload.callback);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function Legacies_Element(object) {
|
||||
object.listen = (function(event, callback) {
|
||||
this.addEventListener(event, callback, false);
|
||||
return this;
|
||||
}).bind(object);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
function Legacies_List(object) {
|
||||
object.listen = (function(event, callback) {
|
||||
for (var i in this) {
|
||||
Legacies_Element(Legacies_Element[i]);
|
||||
this[i].listen(event, callback);
|
||||
}
|
||||
return this;
|
||||
}).bind(object);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
function $A(object) {
|
||||
return Array.prototype.slice.call(object);
|
||||
}
|
||||
|
||||
function $(element) {
|
||||
if (typeof(element) == 'string') {
|
||||
element = document.getElementById(element);
|
||||
}
|
||||
Legacies_Element(element);
|
||||
return element;
|
||||
}
|
||||
|
||||
function $$(selector, context) {
|
||||
context = context || document;
|
||||
var nodeList = context.querySelectorAll(selector);
|
||||
Legacies_List(nodeList);
|
||||
return nodeList;
|
||||
}
|
||||
|
||||
function $E(element, methods) {
|
||||
for (var i in methods) {
|
||||
if (methods[i] === undefined) {
|
||||
continue;
|
||||
}
|
||||
element[i] = function(){
|
||||
var args = $A(arguments);
|
||||
args.unshift(element);
|
||||
methods[i].apply(element, args);
|
||||
}
|
||||
element[i].bind(element);
|
||||
}
|
||||
return element;
|
||||
}
|
||||
1413
includes/application/scripts/sizzle.js
Normal file
1413
includes/application/scripts/sizzle.js
Normal file
File diff suppressed because it is too large
Load diff
273
includes/ataki.php
Normal file
273
includes/ataki.php
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
function walka ($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno) {
|
||||
global $pricelist, $CombatCaps, $gameConfig;
|
||||
$runda = array();
|
||||
$atakujacy_n = array();
|
||||
$wrog_n = array();
|
||||
|
||||
// Calcul des points de Structure de l'attaquant
|
||||
if (!is_null($CurrentSet)) {
|
||||
$atakujacy_zlom_poczatek['metal'] = 0;
|
||||
$atakujacy_zlom_poczatek['crystal'] = 0;
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
$atakujacy_zlom_poczatek['metal'] = $atakujacy_zlom_poczatek['metal'] + $CurrentSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$atakujacy_zlom_poczatek['crystal'] = $atakujacy_zlom_poczatek['crystal'] + $CurrentSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
}
|
||||
}
|
||||
|
||||
// Calcul des points de Structure du défenseur
|
||||
$wrog_zlom_poczatek['metal'] = 0;
|
||||
$wrog_zlom_poczatek['crystal'] = 0;
|
||||
$wrog_poczatek = $TargetSet;
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $a => $b) {
|
||||
if ($a < 300) {
|
||||
$wrog_zlom_poczatek['metal'] = $wrog_zlom_poczatek['metal'] + $TargetSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$wrog_zlom_poczatek['crystal'] = $wrog_zlom_poczatek['crystal'] + $TargetSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
} else {
|
||||
$wrog_zlom_poczatek_obrona['metal'] = $wrog_zlom_poczatek_obrona['metal'] + $TargetSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$wrog_zlom_poczatek_obrona['crystal'] = $wrog_zlom_poczatek_obrona['crystal'] + $TargetSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 7; $i++) {
|
||||
$atakujacy_atak = 0;
|
||||
$wrog_atak = 0;
|
||||
$atakujacy_obrona = 0;
|
||||
$wrog_obrona = 0;
|
||||
$atakujacy_ilosc = 0;
|
||||
$wrog_ilosc = 0;
|
||||
$wrog_tarcza = 0;
|
||||
$atakujacy_tarcza = 0;
|
||||
|
||||
if (!is_null($CurrentSet)) {
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
$CurrentSet[$a]["obrona"] = $CurrentSet[$a]['count'] * ($pricelist[$a]['metal'] + $pricelist[$a]['crystal']) / 10 * (1 + (0.1 * ($CurrentTechno["defence_tech"]) + (0.05 * $user['rpg_amiral'])));
|
||||
$rand = rand(80, 120) / 100;
|
||||
$CurrentSet[$a]["tarcza"] = $CurrentSet[$a]['count'] * $CombatCaps[$a]['shield'] * (1 + (0.1 * $CurrentTechno["shield_tech"]) + (0.05 * $user['rpg_amiral'])) * $rand;
|
||||
$atak_statku = $CombatCaps[$a]['attack'];
|
||||
$technologie = (1 + (0.1 * $CurrentTechno["military_tech"]+(0.05 * $user['rpg_amiral'])));
|
||||
$rand = rand(80, 120) / 100;
|
||||
$ilosc = $CurrentSet[$a]['count'];
|
||||
$CurrentSet[$a]["atak"] = $ilosc * $atak_statku * $technologie * $rand;
|
||||
$atakujacy_atak = $atakujacy_atak + $CurrentSet[$a]["atak"];
|
||||
$atakujacy_obrona = $atakujacy_obrona + $CurrentSet[$a]["obrona"];
|
||||
$atakujacy_ilosc = $atakujacy_ilosc + $CurrentSet[$a]['count'];
|
||||
}
|
||||
} else {
|
||||
$atakujacy_ilosc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $a => $b) {
|
||||
$TargetSet[$a]["obrona"] = $TargetSet[$a]['count'] * ($pricelist[$a]['metal'] + $pricelist[$a]['crystal']) / 10 * (1 + (0.1 * ($TargetTechno["defence_tech"]) + (0.05 * $user['rpg_amiral'])));
|
||||
$rand = rand(80, 120) / 100;
|
||||
$TargetSet[$a]["tarcza"] = $TargetSet[$a]['count'] * $CombatCaps[$a]['shield'] * (1 + (0.1 * $TargetTechno["shield_tech"])+ (0.05 * $user['rpg_amiral'])) * $rand;
|
||||
$atak_statku = $CombatCaps[$a]['attack'];
|
||||
$technologie = (1 + (0.1 * $TargetTechno["military_tech"]) + (0.05 * $user['rpg_amiral']));
|
||||
$rand = rand(80, 120) / 100;
|
||||
$ilosc = $TargetSet[$a]['count'];
|
||||
$TargetSet[$a]["atak"] = $ilosc * $atak_statku * $technologie * $rand;
|
||||
$wrog_atak = $wrog_atak + $TargetSet[$a]["atak"];
|
||||
$wrog_obrona = $wrog_obrona + $TargetSet[$a]["obrona"];
|
||||
$wrog_ilosc = $wrog_ilosc + $TargetSet[$a]['count'];
|
||||
}
|
||||
} else {
|
||||
$wrog_ilosc = 0;
|
||||
$runda[$i]["atakujacy"] = $CurrentSet;
|
||||
$runda[$i]["wrog"] = $TargetSet;
|
||||
$runda[$i]["atakujacy"]["atak"] = $atakujacy_atak;
|
||||
$runda[$i]["wrog"]["atak"] = $wrog_atak;
|
||||
$runda[$i]["atakujacy"]['count'] = $atakujacy_ilosc;
|
||||
$runda[$i]["wrog"]['count'] = $wrog_ilosc;
|
||||
break;
|
||||
}
|
||||
|
||||
$runda[$i]["atakujacy"] = $CurrentSet;
|
||||
$runda[$i]["wrog"] = $TargetSet;
|
||||
$runda[$i]["atakujacy"]["atak"] = $atakujacy_atak;
|
||||
$runda[$i]["wrog"]["atak"] = $wrog_atak;
|
||||
$runda[$i]["atakujacy"]['count'] = $atakujacy_ilosc;
|
||||
$runda[$i]["wrog"]['count'] = $wrog_ilosc;
|
||||
|
||||
if (($atakujacy_ilosc == 0) or ($wrog_ilosc == 0)) {
|
||||
break;
|
||||
}
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
if ($atakujacy_ilosc > 0) {
|
||||
$wrog_moc = $CurrentSet[$a]['count'] * $wrog_atak / $atakujacy_ilosc;
|
||||
if ($CurrentSet[$a]["tarcza"] < $wrog_moc) {
|
||||
$max_zdjac = floor($CurrentSet[$a]['count'] * $wrog_ilosc / $atakujacy_ilosc);
|
||||
$wrog_moc = $wrog_moc - $CurrentSet[$a]["tarcza"];
|
||||
$atakujacy_tarcza = $atakujacy_tarcza + $CurrentSet[$a]["tarcza"];
|
||||
$ile_zdjac = floor(($wrog_moc / (($pricelist[$a]['metal'] + $pricelist[$a]['crystal']) / 10)));
|
||||
if ($ile_zdjac > $max_zdjac) {
|
||||
$ile_zdjac = $max_zdjac;
|
||||
}
|
||||
$atakujacy_n[$a]['count'] = ceil($CurrentSet[$a]['count'] - $ile_zdjac);
|
||||
if ($atakujacy_n[$a]['count'] <= 0) {
|
||||
$atakujacy_n[$a]['count'] = 0;
|
||||
}
|
||||
} else {
|
||||
$atakujacy_n[$a]['count'] = $CurrentSet[$a]['count'];
|
||||
$atakujacy_tarcza = $atakujacy_tarcza + $wrog_moc;
|
||||
}
|
||||
} else {
|
||||
$atakujacy_n[$a]['count'] = $CurrentSet[$a]['count'];
|
||||
$atakujacy_tarcza = $atakujacy_tarcza + $wrog_moc;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($TargetSet as $a => $b) {
|
||||
if ($wrog_ilosc > 0) {
|
||||
$atakujacy_moc = $TargetSet[$a]['count'] * $atakujacy_atak / $wrog_ilosc;
|
||||
if ($TargetSet[$a]["tarcza"] < $atakujacy_moc) {
|
||||
$max_zdjac = floor($TargetSet[$a]['count'] * $atakujacy_ilosc / $wrog_ilosc);
|
||||
$atakujacy_moc = $atakujacy_moc - $TargetSet[$a]["tarcza"];
|
||||
$wrog_tarcza = $wrog_tarcza + $TargetSet[$a]["tarcza"];
|
||||
$ile_zdjac = floor(($atakujacy_moc / (($pricelist[$a]['metal'] + $pricelist[$a]['crystal']) / 10)));
|
||||
if ($ile_zdjac > $max_zdjac) {
|
||||
$ile_zdjac = $max_zdjac;
|
||||
}
|
||||
$wrog_n[$a]['count'] = ceil($TargetSet[$a]['count'] - $ile_zdjac);
|
||||
if ($wrog_n[$a]['count'] <= 0) {
|
||||
$wrog_n[$a]['count'] = 0;
|
||||
}
|
||||
} else {
|
||||
$wrog_n[$a]['count'] = $TargetSet[$a]['count'];
|
||||
$wrog_tarcza = $wrog_tarcza + $atakujacy_moc;
|
||||
}
|
||||
} else {
|
||||
$wrog_n[$a]['count'] = $TargetSet[$a]['count'];
|
||||
$wrog_tarcza = $wrog_tarcza + $atakujacy_moc;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
foreach ($CombatCaps[$a]['sd'] as $c => $d) {
|
||||
if (isset($TargetSet[$c])) {
|
||||
$wrog_n[$c]['count'] = $wrog_n[$c]['count'] - floor($d * rand(50, 100) / 100);
|
||||
if ($wrog_n[$c]['count'] <= 0) {
|
||||
$wrog_n[$c]['count'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($TargetSet as $a => $b) {
|
||||
foreach ($CombatCaps[$a]['sd'] as $c => $d) {
|
||||
if (isset($CurrentSet[$c])) {
|
||||
$atakujacy_n[$c]['count'] = $atakujacy_n[$c]['count'] - floor($d * rand(50, 100) / 100);
|
||||
if ($atakujacy_n[$c]['count'] <= 0) {
|
||||
$atakujacy_n[$c]['count'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$runda[$i]["atakujacy"]["tarcza"] = $atakujacy_tarcza;
|
||||
$runda[$i]["wrog"]["tarcza"] = $wrog_tarcza;
|
||||
// print_r($runda[$i]);
|
||||
$TargetSet = $wrog_n;
|
||||
$CurrentSet = $atakujacy_n;
|
||||
}
|
||||
|
||||
if (($atakujacy_ilosc == 0) or ($wrog_ilosc == 0)) {
|
||||
if (($atakujacy_ilosc == 0) and ($wrog_ilosc == 0)) {
|
||||
$wygrana = "r";
|
||||
} else {
|
||||
if ($atakujacy_ilosc == 0) {
|
||||
$wygrana = "w";
|
||||
} else {
|
||||
$wygrana = "a";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$i = sizeof($runda);
|
||||
$runda[$i]["atakujacy"] = $CurrentSet;
|
||||
$runda[$i]["wrog"] = $TargetSet;
|
||||
$runda[$i]["atakujacy"]["atak"] = $atakujacy_atak;
|
||||
$runda[$i]["wrog"]["atak"] = $wrog_atak;
|
||||
$runda[$i]["atakujacy"]['count'] = $atakujacy_ilosc;
|
||||
$runda[$i]["wrog"]['count'] = $wrog_ilosc;
|
||||
$wygrana = "r";
|
||||
}
|
||||
$atakujacy_zlom_koniec['metal'] = 0;
|
||||
$atakujacy_zlom_koniec['crystal'] = 0;
|
||||
if (!is_null($CurrentSet)) {
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
$atakujacy_zlom_koniec['metal'] = $atakujacy_zlom_koniec['metal'] + $CurrentSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$atakujacy_zlom_koniec['crystal'] = $atakujacy_zlom_koniec['crystal'] + $CurrentSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
}
|
||||
}
|
||||
$wrog_zlom_koniec['metal'] = 0;
|
||||
$wrog_zlom_koniec['crystal'] = 0;
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $a => $b) {
|
||||
if ($a < 300) {
|
||||
$wrog_zlom_koniec['metal'] = $wrog_zlom_koniec['metal'] + $TargetSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$wrog_zlom_koniec['crystal'] = $wrog_zlom_koniec['crystal'] + $TargetSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
} else {
|
||||
$wrog_zlom_koniec_obrona['metal'] = $wrog_zlom_koniec_obrona['metal'] + $TargetSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$wrog_zlom_koniec_obrona['crystal'] = $wrog_zlom_koniec_obrona['crystal'] + $TargetSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$ilosc_wrog = 0;
|
||||
$straty_obrona_wrog = 0;
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $a => $b) {
|
||||
if ($a > 300) {
|
||||
$straty_obrona_wrog = $straty_obrona_wrog + (($wrog_poczatek[$a]['count'] - $TargetSet[$a]['count']) * ($pricelist[$a]['metal'] + $pricelist[$a]['crystal']));
|
||||
$TargetSet[$a]['count'] = $TargetSet[$a]['count'] + (($wrog_poczatek[$a]['count'] - $TargetSet[$a]['count']) * rand(60, 80) / 100);
|
||||
$ilosc_wrog = $ilosc_wrog + $TargetSet[$a]['count'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($ilosc_wrog > 0) and ($atakujacy_ilosc == 0)) {
|
||||
$wygrana = "w";
|
||||
}
|
||||
|
||||
$zlom['metal'] = ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * ($gameConfig['Fleet_Cdr'] / 100));
|
||||
$zlom['crystal'] = ((($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal'])) * ($gameConfig['Fleet_Cdr'] / 100));
|
||||
|
||||
$zlom['metal'] += ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * ($gameConfig['Defs_Cdr'] / 100));
|
||||
$zlom['crystal'] += ((($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal'])) * ($gameConfig['Defs_Cdr'] / 100));
|
||||
|
||||
$zlom["atakujacy"] = (($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']));
|
||||
$zlom["wrog"] = (($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal']) + $straty_obrona_wrog);
|
||||
return array("atakujacy" => $CurrentSet, "wrog" => $TargetSet, "wygrana" => $wygrana, "dane_do_rw" => $runda, "zlom" => $zlom);
|
||||
}
|
||||
|
||||
?>
|
||||
69
includes/constants.php
Normal file
69
includes/constants.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
define('ADMINEMAIL', "admin@xnova-ng.org");
|
||||
define('GAMEURL', "http://".$_SERVER['HTTP_HOST']."/");
|
||||
|
||||
// Definition du monde connu !
|
||||
define('MAX_GALAXY_IN_WORLD', 3);
|
||||
define('MAX_SYSTEM_IN_GALAXY', 100);
|
||||
define('MAX_PLANET_IN_SYSTEM', 50);
|
||||
|
||||
define('LEVEL_ADMIN', 3);
|
||||
define('LEVEL_OPERATOR', 2);
|
||||
define('LEVEL_MODERATOR', 1);
|
||||
define('LEVEL_PLAYER', 0);
|
||||
|
||||
// Nombre de colones pour les rapports d'espionnage
|
||||
define('SPY_REPORT_ROW', 2);
|
||||
|
||||
// Cases données par niveau de Base Lunaire
|
||||
define('FIELDS_BY_MOONBASIS_LEVEL', 4);
|
||||
|
||||
// Nombre maximum de colonie par joueur
|
||||
define('MAX_PLAYER_PLANETS', 9);
|
||||
|
||||
// Nombre maximum d'element dans la liste de construction de batiments
|
||||
define('MAX_BUILDING_QUEUE_SIZE', 5);
|
||||
|
||||
// Nombre maximum d'element dans une ligne de liste de construction flotte et defenses
|
||||
define('MAX_FLEET_OR_DEFS_PER_ROW', 100000000);
|
||||
|
||||
// Taux de depassement possible dans l'espace de stockage des hangars ...
|
||||
// 1.0 pour 100% - 1.1 pour 110% etc ...
|
||||
define('MAX_OVERFLOW', 1.1);
|
||||
|
||||
define('SHOW_ADMIN_IN_RECORDS', false);
|
||||
|
||||
// Valeurs de bases pour les colonies ou planetes fraichement crées
|
||||
define('BASE_STORAGE_SIZE', 100000);
|
||||
define('BUILD_METAL', 500);
|
||||
define('BUILD_CRISTAL', 500);
|
||||
define('BUILD_DEUTERIUM', 0);
|
||||
623
includes/data/combat.php
Normal file
623
includes/data/combat.php
Normal file
|
|
@ -0,0 +1,623 @@
|
|||
<?php return array(
|
||||
//
|
||||
// Ships combat capacities
|
||||
// {{{
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 10,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 5,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 25,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 5,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 10,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 50,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 2,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 25,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 150,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 3,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_CRUISER => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 50,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 400,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 6,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 10,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 200,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 1000,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 8,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 100,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 50,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 10,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 1,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 0,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 0,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 0,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 0,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 0,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 0,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 0,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 0,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 0,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 0,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 0,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 0,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 0,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 0,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 0,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 0,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 0,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 0,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 0,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 0,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 0,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 0,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 0
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BOMBER => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 500,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 1000,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 20,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 20,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 10,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 10,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 10,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 1,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 1,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 500,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 2000,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 2,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 10,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 50000,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 200000,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 250,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 250,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 200,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 100,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 33,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 30,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 250,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 250,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 1250,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 25,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 1250,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 5,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 15,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 200,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 200,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 100,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 50,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 100,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 400,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 700,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 3,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 3,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 4,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 4,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 7,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 5,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 1,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 1,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 1,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SUPERNOVA => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 400,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 700,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1250,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1250,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1000,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 500,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 165,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 150,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1250,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1250,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 6250,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 125,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 6250,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 25,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 5,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 75,
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => 1000,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => 1000,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => 500,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => 250,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => 500,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => 5,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => 1,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => 1
|
||||
)
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Defense combat capacities
|
||||
// {{{
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => array (
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 20,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 80,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => array (
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 25,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 100,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => array (
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 100,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 250,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 200,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 1100,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => array (
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 500,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 150,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 300,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 3000,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 2000,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 1,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 2000,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 1,
|
||||
Legacies_Empire::ID_COMBAT_RAPID_FIRE => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => 1,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => 1,
|
||||
Legacies_Empire::ID_SHIP_CRUISER => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => 1,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => 1,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => 5,
|
||||
Legacies_Empire::ID_SHIP_BOMBER => 1,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 0,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => 1,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => 1,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => 1
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 1,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => array(
|
||||
Legacies_Empire::ID_COMBAT_SHIELDS => 1,
|
||||
Legacies_Empire::ID_COMBAT_FIREPOWER => 12000
|
||||
)
|
||||
// }}}
|
||||
);
|
||||
21
includes/data/events.php
Normal file
21
includes/data/events.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php return array(
|
||||
'login.failure' => array(),
|
||||
'login.success' => array(),
|
||||
'logout.success' => array(),
|
||||
'register.before' => array(),
|
||||
'register.failure' => array(),
|
||||
'register.success' => array(
|
||||
array('Legacies_Empire_Model_Planet', 'registrationListener')
|
||||
),
|
||||
'planet.update' => array(
|
||||
array('Legacies_Empire_Model_Planet', 'planetUpdateListener'),
|
||||
array('Legacies_Empire_Model_Planet_Building_Shipyard', 'planetUpdateListener')
|
||||
),
|
||||
'user.init' => array(),
|
||||
'planet.init' => array(),
|
||||
'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()
|
||||
);
|
||||
101
includes/data/fields-alias.php
Normal file
101
includes/data/fields-alias.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php return array(
|
||||
//
|
||||
// Buildings
|
||||
// {{{
|
||||
Legacies_Empire::ID_BUILDING_METAL_MINE => "metal_mine",
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE => "crystal_mine",
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => "deuterium_sintetizer",
|
||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT => "solar_plant",
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR => "fusion_plant",
|
||||
Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY => "robot_factory",
|
||||
Legacies_Empire::ID_BUILDING_NANITE_FACTORY => "nano_factory",
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => "hangar",
|
||||
Legacies_Empire::ID_BUILDING_METAL_STORAGE => "metal_store",
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_STORAGE => "crystal_store",
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_TANK => "deuterium_store",
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => "laboratory",
|
||||
Legacies_Empire::ID_BUILDING_TERRAFORMER => "terraformer",
|
||||
Legacies_Empire::ID_BUILDING_ALLIANCE_DEPOT => "ally_deposit",
|
||||
Legacies_Empire::ID_BUILDING_LUNAR_BASE => "mondbasis",
|
||||
Legacies_Empire::ID_BUILDING_SENSOR_PHALANX => "phalanx",
|
||||
Legacies_Empire::ID_BUILDING_JUMP_GATE => "sprungtor",
|
||||
Legacies_Empire::ID_BUILDING_MISSILE_SILO => "silo",
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Researches
|
||||
// {{{
|
||||
Legacies_Empire::ID_RESEARCH_ESPIONAGE_TECHNOLOGY => "spy_tech",
|
||||
Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => "computer_tech",
|
||||
Legacies_Empire::ID_RESEARCH_WEAPON_TECHNOLOGY => "military_tech",
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => "defence_tech",
|
||||
Legacies_Empire::ID_RESEARCH_ARMOUR_TECHNOLOGY => "shield_tech",
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => "energy_tech",
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => "hyperspace_tech",
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => "combustion_tech",
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => "impulse_motor_tech",
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => "hyperspace_motor_tech",
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => "laser_tech",
|
||||
Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => "ionic_tech",
|
||||
Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY => "buster_tech",
|
||||
Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK => "intergalactic_tech",
|
||||
Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY => "expedition_tech",
|
||||
Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => "graviton_tech",
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Ships
|
||||
// {{{
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => "small_ship_cargo",
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => "big_ship_cargo",
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => "light_hunter",
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => "heavy_hunter",
|
||||
Legacies_Empire::ID_SHIP_CRUISER => "crusher",
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => "battle_ship",
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => "colonizer",
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => "recycler",
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => "spy_sonde",
|
||||
Legacies_Empire::ID_SHIP_BOMBER => "bomber_ship",
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => "solar_satelit",
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => "destructor",
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => "dearth_star",
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => "battleship",
|
||||
Legacies_Empire::ID_SHIP_SUPERNOVA => "supernova",
|
||||
//
|
||||
|
||||
//
|
||||
// Defenses
|
||||
// {{{
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => "misil_launcher",
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => "small_laser",
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => "big_laser",
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => "gauss_canyon",
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => "ionic_canyon",
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => "buster_canyon",
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => "small_protection_shield",
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => "big_protection_shield",
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => "interceptor_misil",
|
||||
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => "interplanetary_misil",
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Officers
|
||||
// {{{
|
||||
601 => "rpg_geologue",
|
||||
602 => "rpg_amiral",
|
||||
603 => "rpg_ingenieur",
|
||||
604 => "rpg_technocrate",
|
||||
605 => "rpg_constructeur",
|
||||
606 => "rpg_scientifique",
|
||||
607 => "rpg_stockeur",
|
||||
608 => "rpg_defenseur",
|
||||
609 => "rpg_bunker",
|
||||
610 => "rpg_espion",
|
||||
611 => "rpg_commandant",
|
||||
612 => "rpg_destructeur",
|
||||
613 => "rpg_general",
|
||||
614 => "rpg_raideur",
|
||||
615 => "rpg_empereur"
|
||||
// }}}
|
||||
);
|
||||
580
includes/data/prices.php
Normal file
580
includes/data/prices.php
Normal file
|
|
@ -0,0 +1,580 @@
|
|||
<?php return array(
|
||||
//
|
||||
// Buildings costs
|
||||
// {{{
|
||||
Legacies_Empire::ID_BUILDING_METAL_MINE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 60,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 15,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 48,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 24,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.6
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 225,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 75,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 75,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 30,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 900,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 360,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 180,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.8
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 400,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 120,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 200,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_NANITE_FACTORY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 1000000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 500000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 400,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 200,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_METAL_STORAGE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_STORAGE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 1000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_TANK => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 200,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 400,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 200,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_TERRAFORMER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 50000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 1000,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_ALLIANCE_DEPOT => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 20000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 40000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
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::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::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::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
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Researches costs
|
||||
// {{{
|
||||
Legacies_Empire::ID_RESEARCH_ESPIONAGE_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 200,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 1000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 200,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 400,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 600,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_WEAPON_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 800,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 200,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 200,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 600,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ARMOUR_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 1000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 800,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 400,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 4000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 2000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 400,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 600,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
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_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 10000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 20000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 6000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 200,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 100,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 1000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 300,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 4000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 1000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 240000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 400000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 160000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 4000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 8000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 4000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 2
|
||||
),
|
||||
|
||||
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
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Ship costs & technical properties
|
||||
// {{{
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 20,
|
||||
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::ID_SHIP_LARGE_TRANSPORT => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 6000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 6000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 50,
|
||||
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::ID_SHIP_LIGHT_FIGHTER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 3000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 1000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 20,
|
||||
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::ID_SHIP_HEAVY_FIGHTER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 6000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 4000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 75,
|
||||
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::ID_SHIP_CRUISER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 20000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 7000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 2000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 300 ,
|
||||
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::ID_SHIP_BATTLESHIP => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 45000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 15000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 500,
|
||||
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::ID_SHIP_COLONY_SHIP => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 10000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 20000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 10000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 1000,
|
||||
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::ID_SHIP_RECYCLER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 10000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 6000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 2000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 300,
|
||||
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::ID_SHIP_SPY_DRONE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 1000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 1,
|
||||
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::ID_SHIP_BOMBER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 50000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 25000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 15000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 1000,
|
||||
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::ID_SHIP_SOLAR_SATELLITE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 500,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 0,
|
||||
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::ID_SHIP_DESTRUCTOR => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 60000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 50000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 15000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 1000,
|
||||
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::ID_SHIP_DEATH_STAR => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 5000000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 4000000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 1000000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 1,
|
||||
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::ID_SHIP_BATTLECRUISER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 30000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 40000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 15000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 250,
|
||||
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::ID_SHIP_SUPERNOVA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 150000000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 300000000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 450000000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 1000000000,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_PRIMARY => 100000,
|
||||
Legacies_Empire::SHIPS_CONSUMPTION_SECONDARY => 100000,
|
||||
Legacies_Empire::SHIPS_CELERITY_PRIMARY => 1000,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 1000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 1000000
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Defenses
|
||||
// {{{
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 0,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 1500,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 500,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 6000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 20000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 15000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 2000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 2000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 6000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 50000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 50000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 30000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 10000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 10000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 50000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 50000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 8000,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 12500,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 2500,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 10000,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Officers
|
||||
// {{
|
||||
601 => array('max' => 20),
|
||||
602 => array('max' => 20),
|
||||
603 => array('max' => 10),
|
||||
604 => array('max' => 10),
|
||||
605 => array('max' => 3),
|
||||
606 => array('max' => 3),
|
||||
607 => array('max' => 2),
|
||||
608 => array('max' => 2),
|
||||
609 => array('max' => 1),
|
||||
610 => array('max' => 2),
|
||||
611 => array('max' => 2),
|
||||
612 => array('max' => 1),
|
||||
613 => array('max' => 3),
|
||||
614 => array('max' => 1),
|
||||
615 => array('max' => 1)
|
||||
// }}}
|
||||
);
|
||||
106
includes/data/production.php
Normal file
106
includes/data/production.php
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
<?php return array(
|
||||
//
|
||||
// Buildings production
|
||||
// {{{
|
||||
Legacies_Empire::ID_BUILDING_METAL_MINE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 40,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 10,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 'return (30 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);',
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_ENERGY => 'return -(10 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 30,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 15,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.6,
|
||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 'return (20 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);',
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_ENERGY => 'return -(10 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 150,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 50,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return ((10 * $BuildLevel * pow((1.1), $BuildLevel)) * (-0.002 * $BuildTemp + 1.28)) * (0.1 * $BuildLevelFactor);',
|
||||
Legacies_Empire::RESOURCE_ENERGY => 'return -(30 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 50,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 20,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 0,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.5,
|
||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_ENERGY => 'return (20 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
||||
)
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 500,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 200,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 100,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 1.8,
|
||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return -(10 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);',
|
||||
Legacies_Empire::RESOURCE_ENERGY => 'return (50 * $BuildLevel * pow((1.1), $BuildLevel)) * (0.1 * $BuildLevelFactor);'
|
||||
)
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Ships production
|
||||
// {{{
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 500,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 0.5,
|
||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_ENERGY => 'return (($BuildTemp / 4) + 20) * $BuildLevel * (0.1 * $BuildLevelFactor);'
|
||||
)
|
||||
),
|
||||
Legacies_Empire::ID_SHIP_SUPERNOVA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 0,
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 2000,
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 500,
|
||||
Legacies_Empire::RESOURCE_ENERGY => 0,
|
||||
Legacies_Empire::RESOURCE_MULTIPLIER => 0.5,
|
||||
Legacies_Empire::RESOURCE_FORMULA => array(
|
||||
Legacies_Empire::RESOURCE_METAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_CRISTAL => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => 'return "0";',
|
||||
Legacies_Empire::RESOURCE_ENERGY => 'return -(12500 * ($BuildTemp / 4) + 20) * $BuildLevel * (0.1 * $BuildLevelFactor);'
|
||||
)
|
||||
)
|
||||
// }}}
|
||||
);
|
||||
283
includes/data/requirements.php
Normal file
283
includes/data/requirements.php
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
<?php return array(
|
||||
//
|
||||
// Planet buildings requirements
|
||||
// {{{
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array(
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => 5,
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 3
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_NANITE_FACTORY => array(
|
||||
Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY => 10,
|
||||
Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => 10
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => array(
|
||||
Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_TERRAFORMER => array(
|
||||
Legacies_Empire::ID_BUILDING_NANITE_FACTORY => 1,
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 12
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Moon buildings requirements
|
||||
// {{{
|
||||
Legacies_Empire::ID_BUILDING_SENSOR_PHALANX => array(
|
||||
Legacies_Empire::ID_BUILDING_LUNAR_BASE => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_BUILDING_JUMP_GATE => array(
|
||||
Legacies_Empire::ID_BUILDING_LUNAR_BASE => 1,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 7
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Technologies requirements
|
||||
// {{{
|
||||
Legacies_Empire::ID_RESEARCH_ESPIONAGE_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 3
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_WEAPON_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 4
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 3,
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 6
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ARMOUR_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 5,
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => 5,
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 7
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => array(
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 1,
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => array(
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 1,
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => array(
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 3,
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 7
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 1,
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 4,
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => 5,
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 4
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 5,
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 8,
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => 10,
|
||||
Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => 5
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 10,
|
||||
Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => 8,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 8
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 3,
|
||||
Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => 4,
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => 3
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => array(
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 12
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Fleets requirements
|
||||
// {{{
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 2,
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 4,
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => 6
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 1,
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 3,
|
||||
Legacies_Empire::ID_RESEARCH_ARMOUR_TECHNOLOGY => 2,
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_CRUISER => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 5,
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => 4,
|
||||
Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 7,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => 4
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 4,
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => 3
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_RECYCLER => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 4,
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => 6,
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 3,
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => 3,
|
||||
Legacies_Empire::ID_RESEARCH_ESPIONAGE_TECHNOLOGY => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BOMBER => array(
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => 6,
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 8,
|
||||
Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY => 5
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 9,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => 6,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 5
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 12,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => 7,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 6,
|
||||
Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER => array(
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 5,
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => 12,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => 5,
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 8
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SHIP_SUPERNOVA => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 25,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => 18,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 14,
|
||||
Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => 3
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Defenses requirements
|
||||
// {{{
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER => array(
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 1,
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 2,
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => 3
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER => array(
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 3,
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 4,
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => 6
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 6,
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => 6,
|
||||
Legacies_Empire::ID_RESEARCH_WEAPON_TECHNOLOGY => 3,
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 4,
|
||||
Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => 4
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => array(
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 8,
|
||||
Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY => 7
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => array(
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => 2,
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 1
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => array(
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => 6,
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD => 6
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => array(
|
||||
Legacies_Empire::ID_BUILDING_MISSILE_SILO => 2
|
||||
),
|
||||
|
||||
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => array(
|
||||
Legacies_Empire::ID_BUILDING_MISSILE_SILO => 4
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Officers requirements
|
||||
// {{{
|
||||
603 => array(601 => 5),
|
||||
604 => array(602 => 5),
|
||||
605 => array(601 => 10, 603 => 2),
|
||||
606 => array(601 => 10, 603 => 2),
|
||||
607 => array(605 => 1),
|
||||
608 => array(606 => 1),
|
||||
609 => array(601 => 20, 603 => 10, 605 => 3, 606 => 3, 607 => 2, 608 => 2),
|
||||
610 => array(602 => 10, 604 => 5),
|
||||
611 => array(602 => 10, 604 => 5),
|
||||
612 => array(610 => 1),
|
||||
613 => array(611 => 1),
|
||||
614 => array(602 => 20, 604 => 10, 610 => 2, 611 => 2, 612 => 1, 613 => 3),
|
||||
615 => array(614 => 1, 609 => 1)
|
||||
);
|
||||
55
includes/data/resources.php
Normal file
55
includes/data/resources.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?php return array(
|
||||
Legacies_Empire::RESOURCE_METAL => array(
|
||||
'template' => 'empire/resources/default.phtml',
|
||||
'renderer' => 'Legacies_Empire_Block_Resource_Default',
|
||||
|
||||
'field' => Legacies_Empire::RESOURCE_METAL,
|
||||
'production_field' => 'metal_perhour',
|
||||
'ratio_field' => 'metal_porcent',
|
||||
'storage_field' => 'metal_max',
|
||||
'production' => array(
|
||||
Legacies_Empire::ID_BUILDING_METAL_MINE => 'metal_mine_porcent'
|
||||
),
|
||||
'storage' => Legacies_Empire::ID_BUILDING_METAL_STORAGE
|
||||
),
|
||||
Legacies_Empire::RESOURCE_CRISTAL => array(
|
||||
'template' => 'empire/resources/default.phtml',
|
||||
'renderer' => 'Legacies_Empire_Block_Resource_Default',
|
||||
|
||||
'field' => Legacies_Empire::RESOURCE_CRISTAL,
|
||||
'production_field' => 'crystal_perhour',
|
||||
'ratio_field' => 'crystal_porcent',
|
||||
'storage_field' => 'crystal_max',
|
||||
'production' => array(
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE => 'crystal_mine_porcent'
|
||||
),
|
||||
'storage' => Legacies_Empire::ID_BUILDING_CRISTAL_STORAGE
|
||||
),
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => array(
|
||||
'template' => 'empire/resources/default.phtml',
|
||||
'renderer' => 'Legacies_Empire_Block_Resource_Default',
|
||||
|
||||
'field' => Legacies_Empire::RESOURCE_DEUTERIUM,
|
||||
'production_field' => 'deuterium_perhour',
|
||||
'ratio_field' => 'deuterium_porcent',
|
||||
'storage_field' => 'deuterium_max',
|
||||
'production' => array(
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => 'deuterium_sintetizer_porcent'
|
||||
),
|
||||
'storage' => Legacies_Empire::ID_BUILDING_DEUTERIUM_TANK
|
||||
),
|
||||
Legacies_Empire::RESOURCE_ENERGY => array(
|
||||
'template' => 'empire/resources/energy.phtml',
|
||||
'renderer' => 'Legacies_Empire_Block_Resource_Default',
|
||||
|
||||
'field' => 'energy_used',
|
||||
'production_field' => 'energy_max',
|
||||
'storage_field' => 'energy_used',
|
||||
'production' => array(
|
||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT => 'solar_plant_porcent',
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR => 'fusion_plant_porcent',
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 'solar_satelit_porcent'
|
||||
),
|
||||
'storage' => null
|
||||
)
|
||||
);
|
||||
122
includes/data/types.php
Normal file
122
includes/data/types.php
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
<?php return array(
|
||||
//
|
||||
// Buildings type
|
||||
// {{{
|
||||
Legacies_Empire::TYPE_BUILDING => array(
|
||||
Legacies_Empire::ID_BUILDING_METAL_MINE,
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE,
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER,
|
||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT,
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR,
|
||||
Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY,
|
||||
Legacies_Empire::ID_BUILDING_NANITE_FACTORY,
|
||||
Legacies_Empire::ID_BUILDING_SHIPYARD,
|
||||
Legacies_Empire::ID_BUILDING_METAL_STORAGE,
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_STORAGE,
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_TANK,
|
||||
Legacies_Empire::ID_BUILDING_RESEARCH_LAB,
|
||||
Legacies_Empire::ID_BUILDING_TERRAFORMER,
|
||||
Legacies_Empire::ID_BUILDING_ALLIANCE_DEPOT,
|
||||
Legacies_Empire::ID_BUILDING_LUNAR_BASE,
|
||||
Legacies_Empire::ID_BUILDING_SENSOR_PHALANX,
|
||||
Legacies_Empire::ID_BUILDING_JUMP_GATE,
|
||||
Legacies_Empire::ID_BUILDING_MISSILE_SILO
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Research types
|
||||
// {{{
|
||||
Legacies_Empire::TYPE_RESEARCH => array(
|
||||
Legacies_Empire::ID_RESEARCH_ESPIONAGE_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_WEAPON_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_ARMOUR_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE,
|
||||
Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE,
|
||||
Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE,
|
||||
Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK,
|
||||
Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY,
|
||||
Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Ship types
|
||||
// {{{
|
||||
Legacies_Empire::TYPE_SHIP => array(
|
||||
Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT,
|
||||
Legacies_Empire::ID_SHIP_LARGE_TRANSPORT,
|
||||
Legacies_Empire::ID_SHIP_LIGHT_FIGHTER,
|
||||
Legacies_Empire::ID_SHIP_HEAVY_FIGHTER,
|
||||
Legacies_Empire::ID_SHIP_CRUISER,
|
||||
Legacies_Empire::ID_SHIP_BATTLESHIP,
|
||||
Legacies_Empire::ID_SHIP_COLONY_SHIP,
|
||||
Legacies_Empire::ID_SHIP_RECYCLER,
|
||||
Legacies_Empire::ID_SHIP_SPY_DRONE,
|
||||
Legacies_Empire::ID_SHIP_BOMBER,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE,
|
||||
Legacies_Empire::ID_SHIP_DESTRUCTOR,
|
||||
Legacies_Empire::ID_SHIP_DEATH_STAR,
|
||||
Legacies_Empire::ID_SHIP_BATTLECRUISER,
|
||||
Legacies_Empire::ID_SHIP_SUPERNOVA
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Defense types
|
||||
// {{{
|
||||
Legacies_Empire::TYPE_DEFENSE => array(
|
||||
Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER,
|
||||
Legacies_Empire::ID_DEFENSE_LIGHT_LASER,
|
||||
Legacies_Empire::ID_DEFENSE_HEAVY_LASER,
|
||||
Legacies_Empire::ID_DEFENSE_ION_CANNON,
|
||||
Legacies_Empire::ID_DEFENSE_GAUSS_CANNON,
|
||||
Legacies_Empire::ID_DEFENSE_PLASMA_TURRET,
|
||||
Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME,
|
||||
Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME,
|
||||
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE,
|
||||
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Special defenses types
|
||||
// {{{
|
||||
Legacies_Empire::TYPE_SPECIAL => array(
|
||||
Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE,
|
||||
Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Officers type
|
||||
// {{{
|
||||
Legacies_Empire::TYPE_OFFICER => array(
|
||||
601, 602, 603,
|
||||
604, 605, 606,
|
||||
607, 608, 609,
|
||||
610, 611, 612,
|
||||
613, 614, 615
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Production-able elements
|
||||
// {{{
|
||||
Legacies_Empire::TYPE_PRODUCTION => array(
|
||||
Legacies_Empire::ID_BUILDING_METAL_MINE,
|
||||
Legacies_Empire::ID_BUILDING_CRISTAL_MINE,
|
||||
Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER,
|
||||
Legacies_Empire::ID_BUILDING_SOLAR_PLANT,
|
||||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE
|
||||
)
|
||||
// }}}
|
||||
);
|
||||
551
includes/databaseinfos.php
Normal file
551
includes/databaseinfos.php
Normal file
|
|
@ -0,0 +1,551 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
$QryTableAks = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableAks .= "`id` bigint(20) unsigned NOT NULL auto_increment, ";
|
||||
$QryTableAks .= "`name` varchar(50) collate latin1_general_ci default NULL, ";
|
||||
$QryTableAks .= "`teilnehmer` text collate latin1_general_ci, ";
|
||||
$QryTableAks .= "`flotten` text collate latin1_general_ci, ";
|
||||
$QryTableAks .= "`ankunft` int(32) default NULL, ";
|
||||
$QryTableAks .= "`galaxy` int(2) default NULL, ";
|
||||
$QryTableAks .= "`system` int(4) default NULL, ";
|
||||
$QryTableAks .= "`planet` int(2) default NULL, ";
|
||||
$QryTableAks .= "`eingeladen` int(11) default NULL, ";
|
||||
$QryTableAks .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableAks .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table annonce
|
||||
$QryTableAnnonce = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableAnnonce .= "`id` int(11) NOT NULL auto_increment, ";
|
||||
$QryTableAnnonce .= "`user` text collate latin1_general_ci NOT NULL, ";
|
||||
$QryTableAnnonce .= "`galaxie` int(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`systeme` int(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`metala` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`cristala` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`deuta` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`metals` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`cristals` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`deuts` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableAnnonce .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table alliance
|
||||
$QryTableAlliance = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableAlliance .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableAlliance .= "`ally_name` varchar(32) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_tag` varchar(8) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableAlliance .= "`ally_register_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableAlliance .= "`ally_description` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_web` varchar(255) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_text` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_image` varchar(255) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_request` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_request_waiting` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_request_notallow` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableAlliance .= "`ally_owner_range` varchar(32) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_ranks` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_members` int(11) NOT NULL default '0', ";
|
||||
$QryTableAlliance .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableAlliance .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table banned
|
||||
$QryTableBanned = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableBanned .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableBanned .= "`who` varchar(11) character set latin1 NOT NULL default '', ";
|
||||
$QryTableBanned .= "`theme` text character set latin1 NOT NULL, ";
|
||||
$QryTableBanned .= "`who2` varchar(11) character set latin1 NOT NULL default '', ";
|
||||
$QryTableBanned .= "`time` int(11) NOT NULL default '0', ";
|
||||
$QryTableBanned .= "`longer` int(11) NOT NULL default '0', ";
|
||||
$QryTableBanned .= "`author` varchar(11) character set latin1 NOT NULL default '', ";
|
||||
$QryTableBanned .= "`email` varchar(20) character set latin1 NOT NULL default '', ";
|
||||
$QryTableBanned .= "KEY `ID` (`id`) ";
|
||||
$QryTableBanned .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table buddy
|
||||
$QryTableBuddy = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableBuddy .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableBuddy .= "`sender` int(11) NOT NULL default '0', ";
|
||||
$QryTableBuddy .= "`owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableBuddy .= "`active` tinyint(3) NOT NULL default '0', ";
|
||||
$QryTableBuddy .= "`text` text character set latin1, ";
|
||||
$QryTableBuddy .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableBuddy .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table chat
|
||||
$QryTableChat = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableChat .= "`messageid` int(5) unsigned NOT NULL auto_increment, ";
|
||||
$QryTableChat .= "`user` varchar(255) NOT NULL default '', ";
|
||||
$QryTableChat .= "`message` text NOT NULL, ";
|
||||
$QryTableChat .= "`timestamp` int(11) NOT NULL default '0', ";
|
||||
$QryTableChat .= "PRIMARY KEY (`messageid`) ";
|
||||
$QryTableChat .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table config
|
||||
$QryTableConfig = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableConfig .= "`config_name` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableConfig .= "`config_value` text character set latin1 NOT NULL ";
|
||||
$QryTableConfig .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Valeurs de base de la config
|
||||
$QryInsertConfig = "INSERT INTO `{{table}}` ";
|
||||
$QryInsertConfig .= "(`config_name` , `config_value`) VALUES ";
|
||||
$QryInsertConfig .= "('users_amount' , '0'), ";
|
||||
$QryInsertConfig .= "('game_speed' , '2500'), ";
|
||||
$QryInsertConfig .= "('fleet_speed' , '2500'), ";
|
||||
$QryInsertConfig .= "('resource_multiplier' , '1'), ";
|
||||
$QryInsertConfig .= "('Fleet_Cdr' , '30'), ";
|
||||
$QryInsertConfig .= "('Defs_Cdr' , '30'), ";
|
||||
$QryInsertConfig .= "('initial_fields' , '163'), ";
|
||||
$QryInsertConfig .= "('COOKIE_NAME' , 'XNova Legacies'), ";
|
||||
$QryInsertConfig .= "('game_name' , 'XNova Legacies'), ";
|
||||
$QryInsertConfig .= "('game_disable' , '1'), ";
|
||||
$QryInsertConfig .= "('close_reason' , 'Le jeu est clos pour le moment!'), ";
|
||||
$QryInsertConfig .= "('metal_basic_income' , '20'), ";
|
||||
$QryInsertConfig .= "('crystal_basic_income' , '10'), ";
|
||||
$QryInsertConfig .= "('deuterium_basic_income', '0'), ";
|
||||
$QryInsertConfig .= "('energy_basic_income' , '0'), ";
|
||||
$QryInsertConfig .= "('BuildLabWhileRun' , '0'), ";
|
||||
$QryInsertConfig .= "('LastSettedGalaxyPos' , '1'), ";
|
||||
$QryInsertConfig .= "('LastSettedSystemPos' , '8'), ";
|
||||
$QryInsertConfig .= "('LastSettedPlanetPos' , '3'), ";
|
||||
$QryInsertConfig .= "('urlaubs_modus_erz' , '1'), ";
|
||||
$QryInsertConfig .= "('noobprotection' , '1'), ";
|
||||
$QryInsertConfig .= "('noobprotectiontime' , '5000'), ";
|
||||
$QryInsertConfig .= "('noobprotectionmulti' , '5'), ";
|
||||
$QryInsertConfig .= "('forum_url' , 'http://board.xnova-ng.org/' ), ";
|
||||
$QryInsertConfig .= "('OverviewNewsFrame' , '1' ), ";
|
||||
$QryInsertConfig .= "('OverviewNewsText' , 'Bienvenue sur le nouveau serveur XNova Legacies' ), ";
|
||||
$QryInsertConfig .= "('OverviewExternChat' , '0' ), ";
|
||||
$QryInsertConfig .= "('OverviewExternChatCmd' , '' ), ";
|
||||
$QryInsertConfig .= "('OverviewBanner' , '0' ), ";
|
||||
$QryInsertConfig .= "('OverviewClickBanner' , '' ), ";
|
||||
$QryInsertConfig .= "('ExtCopyFrame' , '0' ), ";
|
||||
$QryInsertConfig .= "('ExtCopyOwner' , '' ), ";
|
||||
$QryInsertConfig .= "('ExtCopyFunct' , '' ), ";
|
||||
$QryInsertConfig .= "('ForumBannerFrame' , '0' ), ";
|
||||
$QryInsertConfig .= "('stat_settings' , '1000' ), ";
|
||||
$QryInsertConfig .= "('link_enable' , '0' ), ";
|
||||
$QryInsertConfig .= "('link_name' , '' ), ";
|
||||
$QryInsertConfig .= "('link_url' , '' ), ";
|
||||
$QryInsertConfig .= "('enable_announces' , '1' ), ";
|
||||
$QryInsertConfig .= "('enable_marchand' , '1'), ";
|
||||
$QryInsertConfig .= "('enable_notes' , '1'), ";
|
||||
$QryInsertConfig .= "('bot_name' , 'XNoviana Reali'), ";
|
||||
$QryInsertConfig .= "('bot_adress' , 'xnova@xnova-ng.org' ), ";
|
||||
$QryInsertConfig .= "('banner_source_post' , '../images/bann.png' ), ";
|
||||
$QryInsertConfig .= "('ban_duration' , '30' ), ";
|
||||
$QryInsertConfig .= "('enable_bot' , '0' ), ";
|
||||
$QryInsertConfig .= "('enable_bbcode' , '1' ), ";
|
||||
$QryInsertConfig .= "('debug' , '0') ";
|
||||
$QryInsertConfig .= ";";
|
||||
|
||||
|
||||
// Table declared (multicomptes)
|
||||
$QryTabledeclared = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTabledeclared .= "`declarator`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`declared_1`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`declared_2`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`declared_3`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`reason`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`declarator_name`TEXT NOT NULL ";
|
||||
|
||||
$QryTabledeclared .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table errors
|
||||
$QryTableErrors = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableErrors .= "`error_id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableErrors .= "`error_sender` varchar(32) character set latin1 NOT NULL default '0', ";
|
||||
$QryTableErrors .= "`error_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableErrors .= "`error_type` varchar(32) character set latin1 NOT NULL default 'unknown', ";
|
||||
$QryTableErrors .= "`error_text` text character set latin1, ";
|
||||
$QryTableErrors .= "PRIMARY KEY (`error_id`) ";
|
||||
$QryTableErrors .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table fleets
|
||||
$QryTableFleets = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableFleets .= "`fleet_id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableFleets .= "`fleet_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_mission` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_amount` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_array` text character set latin1, ";
|
||||
$QryTableFleets .= "`fleet_start_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_start_galaxy` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_start_system` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_start_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_start_type` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_stay` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_galaxy` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_system` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_type` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_taget_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_resource_metal` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_resource_crystal` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_resource_deuterium` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_target_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_group` int (11) NOT NULL DEFAULT '0', ";
|
||||
$QryTableFleets .= "`fleet_mess` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`start_time` int(11) default NULL, ";
|
||||
$QryTableFleets .= "PRIMARY KEY (`fleet_id`) ";
|
||||
$QryTableFleets .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table galaxy
|
||||
$QryTableGalaxy = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableGalaxy .= "`galaxy` int(2) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`system` int(3) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`planet` int(2) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`id_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`metal` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`crystal` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`id_luna` int(11) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`luna` int(2) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "KEY `galaxy` (`galaxy`), ";
|
||||
$QryTableGalaxy .= "KEY `system` (`system`), ";
|
||||
$QryTableGalaxy .= "KEY `planet` (`planet`) ";
|
||||
$QryTableGalaxy .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table iraks
|
||||
$QryTableIraks = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableIraks .= "`id` bigint(20) unsigned NOT NULL auto_increment, ";
|
||||
$QryTableIraks .= "`zeit` int(32) default NULL, ";
|
||||
$QryTableIraks .= "`galaxy` int(2) default NULL, ";
|
||||
$QryTableIraks .= "`system` int(4) default NULL, ";
|
||||
$QryTableIraks .= "`planet` int(2) default NULL, ";
|
||||
$QryTableIraks .= "`galaxy_angreifer` int(2) default NULL, ";
|
||||
$QryTableIraks .= "`system_angreifer` int(4) default NULL, ";
|
||||
$QryTableIraks .= "`planet_angreifer` int(2) default NULL, ";
|
||||
$QryTableIraks .= "`owner` int(32) default NULL, ";
|
||||
$QryTableIraks .= "`zielid` int(32) default NULL, ";
|
||||
$QryTableIraks .= "`anzahl` int(32) default NULL, ";
|
||||
$QryTableIraks .= "`primaer` int(32) default NULL, ";
|
||||
$QryTableIraks .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableIraks .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table lunas
|
||||
$QryTableLunas = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableLunas .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableLunas .= "`id_luna` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "`name` varchar(11) character set latin1 NOT NULL default 'Lune', ";
|
||||
$QryTableLunas .= "`image` varchar(11) character set latin1 NOT NULL default 'mond', ";
|
||||
$QryTableLunas .= "`destruyed` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "`id_owner` int(11) default NULL, ";
|
||||
$QryTableLunas .= "`galaxy` int(11) default NULL, ";
|
||||
$QryTableLunas .= "`system` int(11) default NULL, ";
|
||||
$QryTableLunas .= "`lunapos` int(11) default NULL, ";
|
||||
$QryTableLunas .= "`temp_min` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "`temp_max` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "`diameter` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableLunas .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table messages
|
||||
$QryTableMessages = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableMessages .= "`message_id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableMessages .= "`message_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableMessages .= "`message_sender` int(11) NOT NULL default '0', ";
|
||||
$QryTableMessages .= "`message_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableMessages .= "`message_type` int(11) NOT NULL default '0', ";
|
||||
$QryTableMessages .= "`message_from` varchar(48) character set latin1 default NULL, ";
|
||||
$QryTableMessages .= "`message_subject` varchar(48) character set latin1 default NULL, ";
|
||||
$QryTableMessages .= "`message_text` text character set latin1, ";
|
||||
$QryTableMessages .= "PRIMARY KEY (`message_id`) ";
|
||||
$QryTableMessages .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table notes
|
||||
$QryTableNotes = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableNotes .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableNotes .= "`owner` int(11) default NULL, ";
|
||||
$QryTableNotes .= "`time` int(11) default NULL, ";
|
||||
$QryTableNotes .= "`priority` tinyint(1) default NULL, ";
|
||||
$QryTableNotes .= "`title` varchar(32) character set latin1 default NULL, ";
|
||||
$QryTableNotes .= "`text` text character set latin1, ";
|
||||
$QryTableNotes .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableNotes .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table planets
|
||||
$QryTablePlanets = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTablePlanets .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTablePlanets .= "`name` varchar(255) character set latin1 default NULL, ";
|
||||
$QryTablePlanets .= "`id_owner` int(11) default NULL, ";
|
||||
$QryTablePlanets .= "`id_level` int(11) default NULL, ";
|
||||
$QryTablePlanets .= "`galaxy` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`system` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`planet` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`last_update` int(11) default NULL, ";
|
||||
$QryTablePlanets .= "`planet_type` int(11) NOT NULL default '1', ";
|
||||
$QryTablePlanets .= "`destruyed` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_building` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_building_id` text character set latin1 NOT NULL, ";
|
||||
$QryTablePlanets .= "`b_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_tech_id` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_hangar` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_hangar_id` text character set latin1 NOT NULL, ";
|
||||
$QryTablePlanets .= "`b_hangar_plus` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`image` varchar(32) character set latin1 NOT NULL default 'normaltempplanet01', ";
|
||||
$QryTablePlanets .= "`diameter` int(11) NOT NULL default '12800', ";
|
||||
$QryTablePlanets .= "`points` bigint(20) default '0', ";
|
||||
$QryTablePlanets .= "`ranks` bigint(20) default '0', ";
|
||||
$QryTablePlanets .= "`field_current` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`field_max` int(11) NOT NULL default '163', ";
|
||||
$QryTablePlanets .= "`temp_min` int(3) NOT NULL default '-17', ";
|
||||
$QryTablePlanets .= "`temp_max` int(3) NOT NULL default '23', ";
|
||||
$QryTablePlanets .= "`metal` double(132,8) NOT NULL default '0.00000000', ";
|
||||
$QryTablePlanets .= "`metal_perhour` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`metal_max` bigint(20) default '100000', ";
|
||||
$QryTablePlanets .= "`crystal` double(132,8) NOT NULL default '0.00000000', ";
|
||||
$QryTablePlanets .= "`crystal_perhour` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`crystal_max` bigint(20) default '100000', ";
|
||||
$QryTablePlanets .= "`deuterium` double(132,8) NOT NULL default '0.00000000', ";
|
||||
$QryTablePlanets .= "`deuterium_perhour` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`deuterium_max` bigint(20) default '100000', ";
|
||||
$QryTablePlanets .= "`energy_used` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`energy_max` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`metal_mine` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`crystal_mine` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`deuterium_sintetizer` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`solar_plant` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`fusion_plant` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`robot_factory` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`nano_factory` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`hangar` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`metal_store` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`crystal_store` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`deuterium_store` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`laboratory` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`terraformer` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`ally_deposit` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`silo` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`small_ship_cargo` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`big_ship_cargo` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`light_hunter` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`heavy_hunter` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`crusher` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`battle_ship` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`colonizer` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`recycler` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`spy_sonde` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`bomber_ship` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`solar_satelit` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`destructor` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`dearth_star` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`battleship` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`supernova` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`misil_launcher` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`small_laser` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`big_laser` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`gauss_canyon` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`ionic_canyon` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`buster_canyon` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`small_protection_shield` enum('0', '1') NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`big_protection_shield` enum('0', '1') NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`interceptor_misil` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`interplanetary_misil` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`metal_mine_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`crystal_mine_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`deuterium_sintetizer_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`solar_plant_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`fusion_plant_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`solar_satelit_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`mondbasis` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`phalanx` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`sprungtor` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`last_jump_time` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "PRIMARY KEY (`id`) ";
|
||||
$QryTablePlanets .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table rw
|
||||
$QryTableRw = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableRw .= "`id_owner1` int(11) NOT NULL default '0', ";
|
||||
$QryTableRw .= "`id_owner2` int(11) NOT NULL default '0', ";
|
||||
$QryTableRw .= "`rid` varchar(72) character set latin1 NOT NULL, ";
|
||||
$QryTableRw .= "`raport` text character set latin1 NOT NULL, ";
|
||||
$QryTableRw .= "`a_zestrzelona` tinyint(3) unsigned NOT NULL default '0', ";
|
||||
$QryTableRw .= "`time` int(10) unsigned NOT NULL default '0', ";
|
||||
$QryTableRw .= "UNIQUE KEY `rid` (`rid`), ";
|
||||
$QryTableRw .= "KEY `id_owner1` (`id_owner1`,`rid`), ";
|
||||
$QryTableRw .= "KEY `id_owner2` (`id_owner2`,`rid`), ";
|
||||
$QryTableRw .= "KEY `time` (`time`), ";
|
||||
$QryTableRw .= "FULLTEXT KEY `raport` (`raport`) ";
|
||||
$QryTableRw .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table statpoints
|
||||
$QryTableStatPoints = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableStatPoints .= "`id_owner` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`id_ally` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`stat_type` int(2) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`stat_code` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`tech_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`tech_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`tech_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`tech_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`build_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`build_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`build_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`build_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`defs_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`defs_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`defs_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`defs_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`fleet_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`fleet_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`fleet_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`fleet_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`total_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`total_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`total_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`total_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`stat_date` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "KEY `TECH` (`tech_points`), ";
|
||||
$QryTableStatPoints .= "KEY `BUILDS` (`build_points`), ";
|
||||
$QryTableStatPoints .= "KEY `DEFS` (`defs_points`), ";
|
||||
$QryTableStatPoints .= "KEY `FLEET` (`fleet_points`), ";
|
||||
$QryTableStatPoints .= "KEY `TOTAL` (`total_points`) ";
|
||||
$QryTableStatPoints .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table users
|
||||
$QryTableUsers = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableUsers .= "`id` bigint(11) unsigned NOT NULL auto_increment PRIMARY KEY, ";
|
||||
$QryTableUsers .= "`username` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`password` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`email` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`email_2` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`lang` varchar(8) character set latin1 NOT NULL default 'fr', ";
|
||||
$QryTableUsers .= "`authlevel` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`sex` char(1) character set latin1 default NULL, ";
|
||||
$QryTableUsers .= "`avatar` varchar(255) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`sign` text character set latin1, ";
|
||||
$QryTableUsers .= "`id_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`galaxy` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`system` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`current_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`user_lastip` varchar(16) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`ip_at_reg` varchar(16) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`user_agent` text character set latin1 NOT NULL, ";
|
||||
$QryTableUsers .= "`current_page` text character set latin1 NOT NULL, ";
|
||||
$QryTableUsers .= "`register_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`onlinetime` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`dpath` varchar(255) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`design` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`noipcheck` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`planet_sort` tinyint(1) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`planet_sort_order` tinyint(1) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`spio_anz` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_tooltiptime` tinyint(4) NOT NULL default '5', ";
|
||||
$QryTableUsers .= "`settings_fleetactions` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`settings_allylogo` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`settings_esp` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_wri` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_bud` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_mis` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_rep` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`urlaubs_modus` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`urlaubs_until` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`db_deaktjava` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`new_message` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`fleet_shortcut` text character set latin1, ";
|
||||
$QryTableUsers .= "`b_tech_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`spy_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`computer_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`military_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`defence_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`shield_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`energy_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`hyperspace_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`combustion_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`impulse_motor_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`hyperspace_motor_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`laser_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ionic_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`buster_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`intergalactic_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`expedition_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`graviton_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ally_id` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ally_name` varchar(32) character set latin1 default '', ";
|
||||
$QryTableUsers .= "`ally_request` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ally_request_text` text character set latin1, ";
|
||||
$QryTableUsers .= "`ally_register_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ally_rank_id` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`current_luna` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`kolorminus` varchar(11) character set latin1 NOT NULL default 'red', ";
|
||||
$QryTableUsers .= "`kolorplus` varchar(11) character set latin1 NOT NULL default '#00FF00', ";
|
||||
$QryTableUsers .= "`kolorpoziom` varchar(11) character set latin1 NOT NULL default 'yellow', ";
|
||||
$QryTableUsers .= "`rpg_geologue` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_amiral` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_ingenieur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_technocrate` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_espion` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_constructeur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_scientifique` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_commandant` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_points` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_stockeur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_defenseur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_destructeur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_general` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_bunker` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_raideur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_empereur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`lvl_minier` int(11) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`lvl_raid` int(11) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`xpraid` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`xpminier` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`raids` bigint(20) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`p_infligees` bigint(20) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`mnl_alliance` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_joueur` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_attaque` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_spy` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_exploit` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_transport` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_expedition` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_general` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_buildlist` INT (11) NOT NULL , ";
|
||||
$QryTableUsers .= "`bana` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`multi_validated` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`banaday` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`raids1` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`raidswin` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`raidsloose` int(11) default NULL ";
|
||||
$QryTableUsers .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Multi
|
||||
$QryTableMulti = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableMulti .= "`id` int(11) NOT NULL auto_increment, ";
|
||||
$QryTableMulti .= "`player` bigint(11) unsigned NOT NULL, ";
|
||||
$QryTableMulti .= "`sharer` bigint(11) unsigned NOT NULL, ";
|
||||
$QryTableMulti .= "`reason` text character set latin1 NOT NULL, ";
|
||||
$QryTableMulti .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableMulti .= ") ENGINE=MyISAM;";
|
||||
|
||||
?>
|
||||
33
includes/db.php
Normal file
33
includes/db.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
if ( defined('INSIDE') ) {
|
||||
include(ROOT_PATH . 'db/mysql.'.PHPEXT);
|
||||
}
|
||||
157
includes/debug.class.php
Normal file
157
includes/debug.class.php
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Debug class
|
||||
*
|
||||
* @todo Clean up source code
|
||||
*/
|
||||
class Nova_Core_Debug
|
||||
{
|
||||
const CRITICAL = 0x80;
|
||||
const ERROR = 0x40;
|
||||
const WARNING = 0x20;
|
||||
const INFO = 0x10;
|
||||
const MESSAGE = 0x08;
|
||||
const AUDIT_FAILED = 0x04;
|
||||
const AUDIT_SUCCESS = 0x02;
|
||||
const DEBUG = 0x01;
|
||||
|
||||
const DEFAULT_LOGFILE = 'var/log/system.log';
|
||||
|
||||
protected $_logLevelNames = array(
|
||||
self::CRITICAL => 'CRITICAL',
|
||||
self::ERROR => 'ERROR',
|
||||
self::WARNING => 'WARNING',
|
||||
self::INFO => 'INFO',
|
||||
self::MESSAGE => 'MESSAGE',
|
||||
self::AUDIT_FAILED => 'AUDIT_FAILED',
|
||||
self::AUDIT_SUCCESS => 'AUDIT_SUCCESS',
|
||||
self::DEBUG => 'DEBUG'
|
||||
);
|
||||
|
||||
/**
|
||||
* Clean logging method
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $resource
|
||||
* @param int $level
|
||||
* @return unknown_type
|
||||
*/
|
||||
public function log($message, $resource = self::DEFAULT_LOGFILE, $level = self::DEBUG)
|
||||
{
|
||||
if(!($fp = fopen($resource, 'a'))) {
|
||||
trigger_error('Unable to open logs.', E_USER_ERROR);
|
||||
trigger_error($message, E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
fprintf($fp, '[%s] | %s - %s', $this->_logLevelNames[$level], date('r'), $message);
|
||||
fclose($fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @todo Clean up source code
|
||||
*/
|
||||
class Debug
|
||||
extends Nova_Core_Debug
|
||||
{
|
||||
protected $_logMessages = array();
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
function add($message)
|
||||
{
|
||||
$this->log($message);
|
||||
$this->_logMessages[] = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return void
|
||||
*/
|
||||
function echo_log()
|
||||
{
|
||||
$messages = implode(PHP_EOL, $this->_logMessages);
|
||||
echo <<<EOF
|
||||
<dl class="k">
|
||||
<dt>
|
||||
<a href="admin/settings.php">Debug Log</a>:
|
||||
</dt>
|
||||
<dd>
|
||||
<pre><code>{$messages}</code></pre>
|
||||
</dd>
|
||||
</dl>
|
||||
EOF;
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @todo Clean up source code
|
||||
* @param $message
|
||||
* @param $title
|
||||
* @return unknown_type
|
||||
*/
|
||||
function error($message, $title)
|
||||
{
|
||||
global $link, $gameConfig;
|
||||
|
||||
if($gameConfig['debug']==1){
|
||||
echo "<h2>$title</h2><br><font color=red>$message</font><br><hr>";
|
||||
echo "<table>".$this->log."</table>";
|
||||
}
|
||||
|
||||
global $user;
|
||||
$config = include ROOT_PATH . 'config.' . PHPEXT;
|
||||
if(!$link) die('La base de donnee n est pas disponible pour le moment, desole pour la gene occasionnee...');
|
||||
$query = "INSERT INTO {{table}} SET
|
||||
`error_sender` = '{$user['id']}' ,
|
||||
`error_time` = '".time()."' ,
|
||||
`error_type` = '{$title}' ,
|
||||
`error_text` = '".mysql_escape_string($message)."';";
|
||||
$sqlquery = mysql_query(str_replace("{{table}}", $dbsettings["prefix"].'errors',$query))
|
||||
or die('error fatal');
|
||||
$query = "explain select * from {{table}}";
|
||||
$q = mysql_fetch_array(mysql_query(str_replace("{{table}}", $dbsettings["prefix"].
|
||||
'errors', $query))) or die('error fatal: ');
|
||||
|
||||
if (!function_exists('message')) {
|
||||
echo "Erreur, merci de contacter l'admin. Erreur n<>: <b>".$q['rows']."</b>";
|
||||
} else {
|
||||
message("Erreur, merci de contacter l'admin. Erreur n<>: <b>".$q['rows']."</b>", "Erreur");
|
||||
}
|
||||
}
|
||||
}
|
||||
185
includes/functions.php
Normal file
185
includes/functions.php
Normal file
|
|
@ -0,0 +1,185 @@
|
|||
<?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.
|
||||
*
|
||||
*/
|
||||
|
||||
function check_urlaubmodus ($user) {
|
||||
if ($user['urlaubs_modus'] == 1) {
|
||||
message("Vous êtes en mode vacances!", $title = $user['username'], $dest = "", $time = "3");
|
||||
}
|
||||
}
|
||||
|
||||
function check_urlaubmodus_time () {
|
||||
global $user, $gameConfig;
|
||||
if ($gameConfig['urlaubs_modus_erz'] == 1) {
|
||||
$begrenzung = 86400; //24x60x60= 24h
|
||||
$urlaub_modus_time = $user['urlaubs_modus_time'];
|
||||
$urlaub_modus_time_soll = $urlaub_modus_time + $begrenzung;
|
||||
$time_jetzt = time();
|
||||
if ($user['urlaubs_modus'] == 1 && $urlaub_modus_time_soll > $time_jetzt) {
|
||||
$soll_datum = date("d.m.Y", $urlaub_modus_time_soll);
|
||||
$soll_uhrzeit = date("H:i:s", $urlaub_modus_time_soll);
|
||||
message("Vous <20>tes en mode vacances!<br>Le mode vacance dure jusque $soll_datum $soll_uhrzeit<br> Ce n'est qu'apr<70>s cette p<>riode que vous pouvez changer vos options.", "Mode vacance");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Routine Test de validit<69> d'une adresse email
|
||||
//
|
||||
function is_email($email) {
|
||||
return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Routine Affichage d'un message administrateur avec saut vers une autre page si souhait<69>
|
||||
//
|
||||
function AdminMessage ($mes, $title = 'Error', $dest = '', $time = '3', $color= 'red') {
|
||||
$parse['color'] = $color;
|
||||
$parse['title'] = $title;
|
||||
$parse['mes'] = $mes;
|
||||
|
||||
$page = parsetemplate(gettemplate('admin/message_body'), $parse);
|
||||
|
||||
display ($page, $title, false, (($dest != "") ? "<meta http-equiv=\"refresh\" content=\"$time;URL={$dest}\">" : ""), true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Routine Affichage d'un message avec saut vers une autre page si souhait<69>
|
||||
//
|
||||
function message($mes, $title = 'Error', $dest = "", $time = "3", $color = 'orange') {
|
||||
$parse['color'] = $color;
|
||||
$parse['title'] = $title;
|
||||
$parse['mes'] = $mes;
|
||||
|
||||
$page = parsetemplate(gettemplate('admin/message_body'), $parse);
|
||||
|
||||
display ($page, $title, false, (($dest != "") ? "<meta http-equiv=\"refresh\" content=\"$time;URL={$dest}\">" : ""), true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Routine d'affichage d'une page dans un cadre donn<6E>
|
||||
//
|
||||
// $page -> la page
|
||||
// $title -> le titre de la page
|
||||
// $topnav -> Affichage des ressources ? oui ou non ??
|
||||
// $metatags -> S'il y a quelques actions particulieres a faire ...
|
||||
// $AdminPage -> Si on est dans la section admin ... faut le dire ...
|
||||
function display ($page, $title = '', $topnav = true, $metatags = '', $AdminPage = false) {
|
||||
global $link, $gameConfig, $debug, $user, $planetrow;
|
||||
|
||||
if (!$AdminPage) {
|
||||
$DisplayPage = StdUserHeader ($title, $metatags);
|
||||
} else {
|
||||
$DisplayPage = AdminUserHeader ($title, $metatags);
|
||||
}
|
||||
|
||||
if ($topnav) {
|
||||
$DisplayPage .= ShowTopNavigationBar( $user, $planetrow );
|
||||
}
|
||||
$DisplayPage .= "<center>\n". $page ."\n</center>\n";
|
||||
// Affichage du Debug si necessaire
|
||||
if (isset($user['authlevel']) && in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR))) {
|
||||
if ($gameConfig['debug'] == 1) $debug->echo_log();
|
||||
}
|
||||
|
||||
$DisplayPage .= StdFooter();
|
||||
if (isset($link)) {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
echo $DisplayPage;
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Entete de page
|
||||
//
|
||||
function StdUserHeader ($title = '', $metatags = '') {
|
||||
global $user, $langInfos;
|
||||
|
||||
$parse = $langInfos;
|
||||
$parse['title'] = $title;
|
||||
if ( defined('LOGIN') ) {
|
||||
$parse['dpath'] = "skins/xnova/";
|
||||
$parse['-style-'] = "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/styles.css\">\n";
|
||||
$parse['-style-'] .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/about.css\">\n";
|
||||
} else {
|
||||
$parse['dpath'] = DEFAULT_SKINPATH;
|
||||
$parse['-style-'] = "<link rel=\"stylesheet\" type=\"text/css\" href=\"". DEFAULT_SKINPATH ."/default.css\" />";
|
||||
$parse['-style-'] .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"". DEFAULT_SKINPATH ."/formate.css\" />";
|
||||
}
|
||||
|
||||
$parse['-meta-'] = ($metatags) ? $metatags : "";
|
||||
$parse['-body-'] = "<body>"; // class=\"style\" topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">";
|
||||
return parsetemplate(gettemplate('simple_header'), $parse);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Entete de page administration
|
||||
//
|
||||
function AdminUserHeader ($title = '', $metatags = '') {
|
||||
global $user, $dpath, $langInfos;
|
||||
|
||||
$parse = $langInfos;
|
||||
$parse['dpath'] = $dpath;
|
||||
$parse['title'] = $title;
|
||||
$parse['-meta-'] = ($metatags) ? $metatags : "";
|
||||
$parse['-body-'] = "<body>"; // class=\"style\" topmargin=\"0\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">";
|
||||
return parsetemplate(gettemplate('admin/simple_header'), $parse);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Pied de page
|
||||
//
|
||||
function StdFooter() {
|
||||
global $gameConfig, $lang;
|
||||
$parse['copyright'] = isset($gameConfig['copyright']) ? $gameConfig['copyright'] : 'XNova Support Team';
|
||||
$parse['TranslationBy'] = isset($lang['TranslationBy']) ? $lang['TranslationBy'] : '';
|
||||
return parsetemplate(gettemplate('overall_footer'), $parse);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Calcul de la place disponible sur une planete
|
||||
//
|
||||
function CalculateMaxPlanetFields (&$planet) {
|
||||
global $resource;
|
||||
|
||||
return $planet["field_max"] + ($planet[ $resource[33] ] * 5);
|
||||
}
|
||||
|
||||
?>
|
||||
122
includes/functions/AbandonColony.php
Normal file
122
includes/functions/AbandonColony.php
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
<?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 $user
|
||||
* @param unknown_type $planetrow
|
||||
*/
|
||||
function AbandonColony($user,$planetrow) {
|
||||
$destruyed = time() + 3600; //Temps avant la suppression dans la galaxie
|
||||
$DeleteMoon = false;
|
||||
if ($planetrow["planet_type"]==1){
|
||||
//Selectionne si il y a une lune sur la colonie a supprim<69>e
|
||||
$QryWithMoon = "SELECT * FROM {{table}} ";
|
||||
$QryWithMoon .= "WHERE ";
|
||||
$QryWithMoon .= "`destruyed` = '0' AND ";
|
||||
$QryWithMoon .= "`galaxy` = '". $planetrow['galaxy'] ."' AND ";
|
||||
$QryWithMoon .= "`system` = '". $planetrow['system'] ."' AND ";
|
||||
$QryWithMoon .= "`lunapos` = '". $planetrow['planet'] ."' AND ";
|
||||
$QryWithMoon .= "`id_owner` = '". $user['id'] ."' ;";
|
||||
$IsMoon = doquery( $QryWithMoon , 'lunas',true);
|
||||
if($IsMoon){
|
||||
//Envoi la demande de suppression de la lune associ<63> a la colonie
|
||||
$DeleteMoon = true; // borrar luna
|
||||
}
|
||||
|
||||
//Mise en mode destruction d ela colonie
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`destruyed` = '" . $destruyed . "', ";
|
||||
$QryUpdatePlanet .= "`id_owner` = '0' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`id` = '" . $user['current_planet'] . "' LIMIT 1;";
|
||||
doquery($QryUpdatePlanet , 'planets');
|
||||
|
||||
//Si on veut supprimer une lune
|
||||
}elseif($planetrow["planet_type"]==3){
|
||||
$DeleteMoon = true; //borrar luna
|
||||
}
|
||||
|
||||
if ($DeleteMoon){
|
||||
$QryDeleteMoon = "DELETE FROM {{table}} ";
|
||||
$QryDeleteMoon .= "WHERE ";
|
||||
$QryDeleteMoon .= "`galaxy` = '". $planetrow['galaxy'] ."' AND ";
|
||||
$QryDeleteMoon .= "`system` = '". $planetrow['system'] ."' AND ";
|
||||
$QryDeleteMoon .= "`planet` = '". $planetrow['planet'] ."' AND ";
|
||||
$QryDeleteMoon .= "`planet_type` = '3' AND ";
|
||||
$QryDeleteMoon .= "`id_owner` = '". $user['id'] ."' ;";
|
||||
doquery($QryDeleteMoon , 'planets');
|
||||
|
||||
$Qrydestructionlune = "DELETE FROM {{table}} ";
|
||||
$Qrydestructionlune .= "WHERE ";
|
||||
$Qrydestructionlune .= "`galaxy` = '". $planetrow['galaxy'] ."' AND ";
|
||||
$Qrydestructionlune .= "`system` = '". $planetrow['system'] ."' AND ";
|
||||
$Qrydestructionlune .= "`lunapos` = '". $planetrow['planet'] ."' AND ";
|
||||
$Qrydestructionlune .= "`id_owner` = '". $user['id'] ."' ;";
|
||||
doquery( $Qrydestructionlune , 'lunas');
|
||||
|
||||
$Qrydestructionlune2 = "UPDATE {{table}} SET ";
|
||||
$Qrydestructionlune2 .= "`id_luna` = '0' ";
|
||||
$Qrydestructionlune2 .= "WHERE ";
|
||||
$Qrydestructionlune2 .= "`galaxy` = '". $planetrow['galaxy'] ."' AND ";
|
||||
$Qrydestructionlune2 .= "`system` = '". $planetrow['system'] ."' AND ";
|
||||
$Qrydestructionlune2 .= "`planet` = '". $planetrow['planet'] ."' ;";
|
||||
doquery( $Qrydestructionlune2 , 'galaxy');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function CheckFleets($planetrow){
|
||||
|
||||
$QryFleet = "SELECT * FROM {{table}} WHERE ";
|
||||
$QryFleet .= "(`fleet_start_galaxy` = '".$planetrow["galaxy"]."' AND ";
|
||||
$QryFleet .= "`fleet_start_system` = '".$planetrow["system"]."' AND ";
|
||||
$QryFleet .= "`fleet_start_planet` = '".$planetrow["planet"]."'";
|
||||
if ($planetrow["planet_type"]==3){
|
||||
$QryFleet .= " AND `fleet_start_type` = '3'";
|
||||
}
|
||||
$QryFleet .= ") OR ";
|
||||
$QryFleet .= "(`fleet_end_galaxy` = '".$planetrow["galaxy"]."' AND ";
|
||||
$QryFleet .= "`fleet_end_system` = '".$planetrow["system"]."' AND ";
|
||||
$QryFleet .= "`fleet_end_planet` = '".$planetrow["planet"]."'";
|
||||
if ($planetrow["planet_type"]==3){
|
||||
$QryFleet .= " AND `fleet_end_type` = '3'";
|
||||
}
|
||||
$QryFleet .= " AND `fleet_mess` <> 1 ); ";
|
||||
$fleets = doquery($QryFleet, 'fleets',true);
|
||||
if($fleets){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
114
includes/functions/AddBuildingToQueue.php
Normal file
114
includes/functions/AddBuildingToQueue.php
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
<?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 $Element
|
||||
* @param unknown_type $AddMode
|
||||
*/
|
||||
function AddBuildingToQueue ( &$CurrentPlanet, $CurrentUser, $Element, $AddMode = true) {
|
||||
global $lang, $resource;
|
||||
|
||||
$CurrentQueue = $CurrentPlanet['b_building_id'];
|
||||
if ($CurrentQueue != 0) {
|
||||
$QueueArray = explode ( ";", $CurrentQueue );
|
||||
$ActualCount = count ( $QueueArray );
|
||||
} else {
|
||||
$QueueArray = "";
|
||||
$ActualCount = 0;
|
||||
}
|
||||
|
||||
if ($AddMode == true) {
|
||||
$BuildMode = 'build';
|
||||
} else {
|
||||
$BuildMode = 'destroy';
|
||||
}
|
||||
|
||||
if ( $ActualCount < MAX_BUILDING_QUEUE_SIZE ) {
|
||||
$QueueID = $ActualCount + 1;
|
||||
} else {
|
||||
$QueueID = false;
|
||||
}
|
||||
|
||||
if ( $QueueID != false ) {
|
||||
// Faut verifier si l'Element que l'on veut integrer est deja dans le tableau !
|
||||
if ($QueueID > 1) {
|
||||
$InArray = 0;
|
||||
for ( $QueueElement = 0; $QueueElement < $ActualCount; $QueueElement++ ) {
|
||||
$QueueSubArray = explode ( ",", $QueueArray[$QueueElement] );
|
||||
if ($QueueSubArray[0] == $Element) {
|
||||
$InArray++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$InArray = 0;
|
||||
}
|
||||
|
||||
if ($InArray != 0) {
|
||||
$ActualLevel = $CurrentPlanet[$resource[$Element]];
|
||||
if ($AddMode == true) {
|
||||
$BuildLevel = $ActualLevel + 1 + $InArray;
|
||||
$CurrentPlanet[$resource[$Element]] += $InArray;
|
||||
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
|
||||
$CurrentPlanet[$resource[$Element]] -= $InArray;
|
||||
} else {
|
||||
$BuildLevel = $ActualLevel - 1 + $InArray;
|
||||
$CurrentPlanet[$resource[$Element]] -= $InArray;
|
||||
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element) / 2;
|
||||
$CurrentPlanet[$resource[$Element]] += $InArray;
|
||||
}
|
||||
} else {
|
||||
$ActualLevel = $CurrentPlanet[$resource[$Element]];
|
||||
if ($AddMode == true) {
|
||||
$BuildLevel = $ActualLevel + 1;
|
||||
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
|
||||
} else {
|
||||
$BuildLevel = $ActualLevel - 1;
|
||||
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
if ($QueueID == 1) {
|
||||
$BuildEndTime = time() + $BuildTime;
|
||||
} else {
|
||||
$PrevBuild = explode (",", $QueueArray[$ActualCount - 1]);
|
||||
$BuildEndTime = $PrevBuild[3] + $BuildTime;
|
||||
}
|
||||
$QueueArray[$ActualCount] = $Element .",". $BuildLevel .",". $BuildTime .",". $BuildEndTime .",". $BuildMode;
|
||||
$NewQueue = implode ( ";", $QueueArray );
|
||||
$CurrentPlanet['b_building_id'] = $NewQueue;
|
||||
}
|
||||
return $QueueID;
|
||||
}
|
||||
|
||||
?>
|
||||
129
includes/functions/BBcodeFunction.php
Normal file
129
includes/functions/BBcodeFunction.php
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<?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 $string
|
||||
*/
|
||||
function bbcode($string) {
|
||||
$pattern = array(
|
||||
'/\\n/',
|
||||
'/\\r/',
|
||||
'/\[list\](.*?)\[\/list\]/ise',
|
||||
'/\[b\](.*?)\[\/b\]/is',
|
||||
'/\[strong\](.*?)\[\/strong\]/is',
|
||||
'/\[i\](.*?)\[\/i\]/is',
|
||||
'/\[u\](.*?)\[\/u\]/is',
|
||||
'/\[s\](.*?)\[\/s\]/is',
|
||||
'/\[del\](.*?)\[\/del\]/is',
|
||||
'/\[url=(.*?)\](.*?)\[\/url\]/ise',
|
||||
'/\[email=(.*?)\](.*?)\[\/email\]/is',
|
||||
'/\[img](.*?)\[\/img\]/ise',
|
||||
'/\[color=(.*?)\](.*?)\[\/color\]/is',
|
||||
'/\[quote\](.*?)\[\/quote\]/ise',
|
||||
'/\[code\](.*?)\[\/code\]/ise'
|
||||
);
|
||||
|
||||
$replace = array(
|
||||
'',
|
||||
'',
|
||||
'sList(\'\\1\')',
|
||||
'<b>\1</b>',
|
||||
'<strong>\1</strong>',
|
||||
'<i>\1</i>',
|
||||
'<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\')',
|
||||
'<a href="mailto:\1" title="\1">\2</a>',
|
||||
'imagefix(\'\\1\')',
|
||||
'<span style="color: \1;">\2</span>',
|
||||
'sQuote(\'\1\')',
|
||||
'sCode(\'\1\')'
|
||||
);
|
||||
|
||||
return preg_replace($pattern, $replace, nl2br(htmlspecialchars(stripslashes($string))));
|
||||
}
|
||||
|
||||
|
||||
|
||||
function image($string)
|
||||
{
|
||||
//On va pas se casser le fion a lire les accents quand meme !!!!!!!
|
||||
$string = str_replace("'", "'", $string);
|
||||
|
||||
|
||||
//Emoticones.... COPIEZ COLLEZ CES LIGNES POUR RAJOUTER LES VOTRES !
|
||||
$string = str_replace("Smile", "[img]../emoticones/Smile.png[/img]", $string);
|
||||
$string = str_replace("cool", "[img]../emoticones/cool.png[/img]", $string);
|
||||
$string = str_replace("grrr", "[img]../emoticones/grrr.png[/img]", $string);
|
||||
$string = str_replace("love", "[img]../emoticones/love.png[/img]", $string);
|
||||
$string = str_replace("msn", "[img]../emoticones/msn.png[/img]", $string);
|
||||
$string = str_replace("Oo", "[img]../emoticones/Oo.png[/img]", $string);
|
||||
$string = str_replace("perdu", "[img]../emoticones/perdu.png[/img]", $string);
|
||||
$string = str_replace("wink", "[img]../emoticones/wink.png[/img]", $string);
|
||||
$string = str_replace("wow", "[img]../emoticones/wow.png[/img]", $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function sCode($string){
|
||||
$pattern = '/\<img src=\\\"(.*?)img\/smilies\/(.*?).png\\\" alt=\\\"(.*?)\\\" \/>/s';
|
||||
$string = preg_replace($pattern, '\3', $string);
|
||||
return '<pre>' . trim($string) . '</pre>';
|
||||
}
|
||||
|
||||
function sList($string) {
|
||||
$tmp = explode('[*]', stripslashes($string));
|
||||
$out = null;
|
||||
foreach($tmp as $list) {
|
||||
if(strlen(str_replace('', '', $list)) > 0) {
|
||||
$out .= '<li>' . trim($list) . '</li>';
|
||||
}
|
||||
}
|
||||
return '<ul>' . $out . '</ul>';
|
||||
}
|
||||
|
||||
function imagefix($img) {
|
||||
if(substr($img, 0, 7) != 'http://') {
|
||||
$img = './images/' . $img;
|
||||
}
|
||||
return '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" />';
|
||||
}
|
||||
|
||||
function urlfix($url, $title) {
|
||||
$title = stripslashes($title);
|
||||
return '<a href="' . $url . '" title="' . $title . '">' . $title . '</a>';
|
||||
}
|
||||
?>
|
||||
208
includes/functions/BatimentBuildingPage.php
Normal file
208
includes/functions/BatimentBuildingPage.php
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
<?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, $_GET;
|
||||
|
||||
CheckPlanetUsedFields ( $CurrentPlanet );
|
||||
|
||||
// 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'] );
|
||||
}
|
||||
}
|
||||
|
||||
SetNextQueueElementOnTop ( $CurrentPlanet, $CurrentUser );
|
||||
|
||||
$Queue = ShowBuildingQueue ( $CurrentPlanet, $CurrentUser );
|
||||
|
||||
// On enregistre ce que l'on a modifi<66> dans planet !
|
||||
BuildingSavePlanetRecord ( $CurrentPlanet );
|
||||
// On enregistre ce que l'on a eventuellement modifi<66> dans users
|
||||
BuildingSaveUserRecord ( $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']);
|
||||
}
|
||||
?>
|
||||
167
includes/functions/BuildFleetEventTable.php
Normal file
167
includes/functions/BuildFleetEventTable.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?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 $FleetRow
|
||||
* @param unknown_type $Status
|
||||
* @param unknown_type $Owner
|
||||
* @param unknown_type $Label
|
||||
* @param unknown_type $Record
|
||||
*/
|
||||
function BuildFleetEventTable ( $FleetRow, $Status, $Owner, $Label, $Record ) {
|
||||
global $lang;
|
||||
|
||||
$FleetStyle = array (
|
||||
1 => 'attack',
|
||||
2 => 'federation',
|
||||
3 => 'transport',
|
||||
4 => 'deploy',
|
||||
5 => 'hold',
|
||||
6 => 'espionage',
|
||||
7 => 'colony',
|
||||
8 => 'harvest',
|
||||
9 => 'destroy',
|
||||
10 => 'missile',
|
||||
15 => 'transport',
|
||||
);
|
||||
$FleetStatus = array ( 0 => 'flight', 1 => 'holding', 2 => 'return' );
|
||||
if ( $Owner == true ) {
|
||||
$FleetPrefix = 'own';
|
||||
} else {
|
||||
$FleetPrefix = '';
|
||||
}
|
||||
|
||||
$RowsTPL = gettemplate ('overview_fleet_event');
|
||||
$MissionType = $FleetRow['fleet_mission'];
|
||||
$FleetContent = CreateFleetPopupedFleetLink ( $FleetRow, $lang['ov_fleet'], $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
$FleetCapacity = CreateFleetPopupedMissionLink ( $FleetRow, $lang['type_mission'][ $MissionType ], $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
|
||||
$StartPlanet = doquery("SELECT `name` FROM {{table}} WHERE `galaxy` = '".$FleetRow['fleet_start_galaxy']."' AND `system` = '".$FleetRow['fleet_start_system']."' AND `planet` = '".$FleetRow['fleet_start_planet']."' AND `planet_type` = '".$FleetRow['fleet_start_type']."';", 'planets', true);
|
||||
$StartType = $FleetRow['fleet_start_type'];
|
||||
$TargetPlanet = doquery("SELECT `name` FROM {{table}} WHERE `galaxy` = '".$FleetRow['fleet_end_galaxy']."' AND `system` = '".$FleetRow['fleet_end_system']."' AND `planet` = '".$FleetRow['fleet_end_planet']."' AND `planet_type` = '".$FleetRow['fleet_end_type']."';", 'planets', true);
|
||||
$TargetType = $FleetRow['fleet_end_type'];
|
||||
|
||||
if ($Status != 2) {
|
||||
if ($StartType == 1) {
|
||||
$StartID = $lang['ov_planet_to'];
|
||||
} elseif ($StartType == 3) {
|
||||
$StartID = $lang['ov_moon_to'];
|
||||
}
|
||||
$StartID .= $StartPlanet['name'] ." ";
|
||||
$StartID .= GetStartAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
|
||||
if ( $MissionType != 15 ) {
|
||||
if ($TargetType == 1) {
|
||||
$TargetID = $lang['ov_planet_to_target'];
|
||||
} elseif ($TargetType == 2) {
|
||||
$TargetID = $lang['ov_debris_to_target'];
|
||||
} elseif ($TargetType == 3) {
|
||||
$TargetID = $lang['ov_moon_to_target'];
|
||||
}
|
||||
} else {
|
||||
$TargetID = $lang['ov_explo_to_target'];
|
||||
}
|
||||
$TargetID .= $TargetPlanet['name'] ." ";
|
||||
$TargetID .= GetTargetAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
} else {
|
||||
if ($StartType == 1) {
|
||||
$StartID = $lang['ov_back_planet'];
|
||||
} elseif ($StartType == 3) {
|
||||
$StartID = $lang['ov_back_moon'];
|
||||
}
|
||||
$StartID .= $StartPlanet['name'] ." ";
|
||||
$StartID .= GetStartAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
|
||||
if ( $MissionType != 15 ) {
|
||||
if ($TargetType == 1) {
|
||||
$TargetID = $lang['ov_planet_from'];
|
||||
} elseif ($TargetType == 2) {
|
||||
$TargetID = $lang['ov_debris_from'];
|
||||
} elseif ($TargetType == 3) {
|
||||
$TargetID = $lang['ov_moon_from'];
|
||||
}
|
||||
} else {
|
||||
$TargetID = $lang['ov_explo_from'];
|
||||
}
|
||||
$TargetID .= $TargetPlanet['name'] ." ";
|
||||
$TargetID .= GetTargetAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
}
|
||||
|
||||
if ($Owner == true) {
|
||||
$EventString = $lang['ov_une']; // 'Une de tes '
|
||||
$EventString .= $FleetContent;
|
||||
} else {
|
||||
$EventString = $lang['ov_une_hostile']; // 'Une '
|
||||
$EventString .= $FleetContent;
|
||||
$EventString .= $lang['ov_hostile']; // ' hostile de '
|
||||
$EventString .= BuildHostileFleetPlayerLink ( $FleetRow );
|
||||
}
|
||||
|
||||
if ($Status == 0) {
|
||||
$Time = $FleetRow['fleet_start_time'];
|
||||
$Rest = $Time - time();
|
||||
$EventString .= $lang['ov_vennant']; // ' venant '
|
||||
$EventString .= $StartID;
|
||||
$EventString .= $lang['ov_atteint']; // ' atteint '
|
||||
$EventString .= $TargetID;
|
||||
$EventString .= $lang['ov_mission']; // '. Elle avait pour mission: '
|
||||
} elseif ($Status == 1) {
|
||||
$Time = $FleetRow['fleet_end_stay'];
|
||||
$Rest = $Time - time();
|
||||
$EventString .= $lang['ov_vennant']; // ' venant '
|
||||
$EventString .= $StartID;
|
||||
$EventString .= $lang['ov_explo_stay']; // ' explore '
|
||||
$EventString .= $TargetID;
|
||||
$EventString .= $lang['ov_explo_mission']; // '. Elle a pour mission: '
|
||||
} elseif ($Status == 2) {
|
||||
$Time = $FleetRow['fleet_end_time'];
|
||||
$Rest = $Time - time();
|
||||
$EventString .= $lang['ov_rentrant'];// ' rentrant '
|
||||
$EventString .= $TargetID;
|
||||
$EventString .= $StartID;
|
||||
$EventString .= $lang['ov_mission']; // '. Elle avait pour mission: '
|
||||
}
|
||||
$EventString .= $FleetCapacity;
|
||||
|
||||
$bloc['fleet_status'] = $FleetStatus[ $Status ];
|
||||
$bloc['fleet_prefix'] = $FleetPrefix;
|
||||
$bloc['fleet_style'] = $FleetStyle[ $MissionType ];
|
||||
$bloc['fleet_javai'] = InsertJavaScriptChronoApplet ( $Label, $Record, $Rest, true );
|
||||
$bloc['fleet_order'] = $Label . $Record;
|
||||
$bloc['fleet_time'] = date("H:i:s", $Time);
|
||||
$bloc['fleet_descr'] = $EventString;
|
||||
$bloc['fleet_javas'] = InsertJavaScriptChronoApplet ( $Label, $Record, $Rest, false );
|
||||
|
||||
return parsetemplate($RowsTPL, $bloc);
|
||||
}
|
||||
|
||||
?>
|
||||
70
includes/functions/BuildFlyingFleetTable.php
Normal file
70
includes/functions/BuildFlyingFleetTable.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?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
|
||||
*/
|
||||
function BuildFlyingFleetTable () {
|
||||
global $lang;
|
||||
|
||||
$TableTPL = gettemplate('admin/fleet_rows');
|
||||
$FlyingFleets = doquery ("SELECT * FROM {{table}} ORDER BY `fleet_end_time` ASC;", 'fleets');
|
||||
while ( $CurrentFleet = mysql_fetch_assoc( $FlyingFleets ) ) {
|
||||
$FleetOwner = doquery("SELECT `username` FROM {{table}} WHERE `id` = '". $CurrentFleet['fleet_owner'] ."';", 'users', true);
|
||||
$TargetOwner = doquery("SELECT `username` FROM {{table}} WHERE `id` = '". $CurrentFleet['fleet_target_owner'] ."';", 'users', true);
|
||||
$Bloc['Id'] = $CurrentFleet['fleet_id'];
|
||||
$Bloc['Mission'] = CreateFleetPopupedMissionLink ( $CurrentFleet, $lang['type_mission'][ $CurrentFleet['fleet_mission'] ], '' );
|
||||
$Bloc['Mission'] .= "<br>". (($CurrentFleet['fleet_mess'] == 1) ? "R" : "A" );
|
||||
|
||||
$Bloc['Fleet'] = CreateFleetPopupedFleetLink ( $CurrentFleet, $lang['tech'][200], '' );
|
||||
$Bloc['St_Owner'] = "[". $CurrentFleet['fleet_owner'] ."]<br>". $FleetOwner['username'];
|
||||
$Bloc['St_Posit'] = "[".$CurrentFleet['fleet_start_galaxy'] .":". $CurrentFleet['fleet_start_system'] .":". $CurrentFleet['fleet_start_planet'] ."]<br>". ( ($CurrentFleet['fleet_start_type'] == 1) ? "[P]": (($CurrentFleet['fleet_start_type'] == 2) ? "D" : "L" )) ."";
|
||||
$Bloc['St_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_start_time']);
|
||||
if (is_array($TargetOwner)) {
|
||||
$Bloc['En_Owner'] = "[". $CurrentFleet['fleet_target_owner'] ."]<br>". $TargetOwner['username'];
|
||||
} else {
|
||||
$Bloc['En_Owner'] = "";
|
||||
}
|
||||
$Bloc['En_Posit'] = "[".$CurrentFleet['fleet_end_galaxy'] .":". $CurrentFleet['fleet_end_system'] .":". $CurrentFleet['fleet_end_planet'] ."]<br>". ( ($CurrentFleet['fleet_end_type'] == 1) ? "[P]": (($CurrentFleet['fleet_end_type'] == 2) ? "D" : "L" )) ."";
|
||||
if ($CurrentFleet['fleet_mission'] == 15) {
|
||||
$Bloc['Wa_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_stay_time']);
|
||||
} else {
|
||||
$Bloc['Wa_Time'] = "";
|
||||
}
|
||||
$Bloc['En_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_end_time']);
|
||||
|
||||
$table .= parsetemplate( $TableTPL, $Bloc );
|
||||
}
|
||||
return $table;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
49
includes/functions/BuildingSavePlanetRecord.php
Normal file
49
includes/functions/BuildingSavePlanetRecord.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?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 BuildingSavePlanetRecord ( $CurrentPlanet ) {
|
||||
|
||||
// Enregistrement des divers changements dans les tables
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`b_building_id` = '". $CurrentPlanet['b_building_id'] ."', ";
|
||||
$QryUpdatePlanet .= "`b_building` = '". $CurrentPlanet['b_building'] ."' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`id` = '". $CurrentPlanet['id'] ."';";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
47
includes/functions/BuildingSaveUserRecord.php
Normal file
47
includes/functions/BuildingSaveUserRecord.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?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 BuildingSaveUserRecord ( $CurrentUser ) {
|
||||
|
||||
$QryUpdateUser = "UPDATE {{table}} SET ";
|
||||
$QryUpdateUser .= "`xpminier` = '". $CurrentUser['xpminier'] ."' ";
|
||||
$QryUpdateUser .= "WHERE ";
|
||||
$QryUpdateUser .= "`id` = '". $CurrentUser["id"] ."';";
|
||||
doquery( $QryUpdateUser, 'users');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
114
includes/functions/CancelBuildingFromQueue.php
Normal file
114
includes/functions/CancelBuildingFromQueue.php
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
<?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 CancelBuildingFromQueue ( &$CurrentPlanet, &$CurrentUser ) {
|
||||
|
||||
$CurrentQueue = $CurrentPlanet['b_building_id'];
|
||||
if ($CurrentQueue != 0) {
|
||||
// Creation du tableau de la liste de construction
|
||||
$QueueArray = explode ( ";", $CurrentQueue );
|
||||
// Comptage du nombre d'elements dans la liste
|
||||
$ActualCount = count ( $QueueArray );
|
||||
|
||||
// Stockage de l'element a 'interrompre'
|
||||
$CanceledIDArray = explode ( ",", $QueueArray[0] );
|
||||
$Element = $CanceledIDArray[0];
|
||||
$BuildMode = $CanceledIDArray[4]; // pour savoir si on construit ou detruit
|
||||
|
||||
$nb_item = $Element;
|
||||
|
||||
if ($ActualCount > 1) {
|
||||
array_shift( $QueueArray );
|
||||
$NewCount = count( $QueueArray );
|
||||
// Mise a jour de l'heure de fin de construction theorique du batiment
|
||||
$BuildEndTime = time();
|
||||
|
||||
for ($ID = 0; $ID < $NewCount ; $ID++ ) {
|
||||
$ListIDArray = explode ( ",", $QueueArray[$ID] );
|
||||
|
||||
// Pour diminuer le niveau et le temps de construction
|
||||
// si le bâtiment qui est annulé se trouve plusieurs fois dans la queue
|
||||
// Exemple de queue de construction :
|
||||
// Mine de métal (Niveau 40) | Silo de missile (Niveau 30) | Silo de missiles (Niveau 31) | Mine de métal (Niveau 41)
|
||||
|
||||
// Si on supprime le premier bâtiment, on aura dans la queue de construction :
|
||||
// Silo de missile (Niveau 30) | Silo de missiles (Niveau 31) | Mine de métal (Niveau 40)
|
||||
if ( $nb_item == $ListIDArray[0])
|
||||
{
|
||||
$ListIDArray[1] -= 1;
|
||||
$ListIDArray[2] = GetBuildingTimeLevel($CurrentUser, $CurrentPlanet, $ListIDArray[0], $ListIDArray[1]);
|
||||
}
|
||||
$BuildEndTime += $ListIDArray[2];
|
||||
$ListIDArray[3] = $BuildEndTime;
|
||||
$QueueArray[$ID] = implode ( ",", $ListIDArray );
|
||||
}
|
||||
$NewQueue = implode(";", $QueueArray );
|
||||
$ReturnValue = true;
|
||||
$BuildEndTime = '0';
|
||||
} else {
|
||||
$NewQueue = '0';
|
||||
$ReturnValue = false;
|
||||
$BuildEndTime = '0';
|
||||
}
|
||||
|
||||
// Ici on va rembourser les ressources engagées ...
|
||||
// Deja le mode (car quand on detruit ca ne coute que la moitié du prix de construction classique
|
||||
if ($BuildMode == 'destroy') {
|
||||
$ForDestroy = true;
|
||||
} else {
|
||||
$ForDestroy = false;
|
||||
}
|
||||
|
||||
if ( $Element != false ) {
|
||||
$Needed = GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
|
||||
$CurrentPlanet['metal'] += $Needed['metal'];
|
||||
$CurrentPlanet['crystal'] += $Needed['crystal'];
|
||||
$CurrentPlanet['deuterium'] += $Needed['deuterium'];
|
||||
}
|
||||
|
||||
} else {
|
||||
$NewQueue = '0';
|
||||
$BuildEndTime = '0';
|
||||
$ReturnValue = false;
|
||||
}
|
||||
|
||||
$CurrentPlanet['b_building_id'] = $NewQueue;
|
||||
$CurrentPlanet['b_building'] = $BuildEndTime;
|
||||
|
||||
return $ReturnValue;
|
||||
}
|
||||
|
||||
?>
|
||||
97
includes/functions/CheckCookies.php
Normal file
97
includes/functions/CheckCookies.php
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
<?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 $IsUserChecked
|
||||
*/
|
||||
function CheckCookies($IsUserChecked)
|
||||
{
|
||||
global $lang, $gameConfig;
|
||||
|
||||
includeLang('cookies');
|
||||
|
||||
$userData = array();
|
||||
if (isset($_SESSION['user_id'])) {
|
||||
$sql =<<<EOF
|
||||
SELECT * FROM {{table}}
|
||||
WHERE id={$_SESSION['user_id']}
|
||||
LIMIT 1
|
||||
EOF;
|
||||
$userData = doquery($sql, 'users', true);
|
||||
} else if (isset($_COOKIE['nova-cookie'])) {
|
||||
$cookieData = unserialize(stripslashes($_COOKIE['nova-cookie']));
|
||||
$cookieData = array(
|
||||
'id' => (isset($cookieData['id']) ? (int) $cookieData['id'] : 0),
|
||||
'key' => (isset($cookieData['key']) ? (string) $cookieData['key'] : null)
|
||||
);
|
||||
|
||||
$sql =<<<EOF
|
||||
SELECT * FROM {{table}} AS user
|
||||
WHERE id={$cookieData['id']}
|
||||
AND (@key:="{$cookieData['key']}")=CONCAT((@salt:=MID(@key, 0, 4)), SHA1(CONCAT(user.username, user.password, @salt)))
|
||||
LIMIT 1
|
||||
EOF;
|
||||
$userData = doquery($sql, 'users', true);
|
||||
$_SESSION['user_id'] = $userData['id'];
|
||||
if (empty($userData)) {
|
||||
message($lang['cookies']['Error2'] );
|
||||
}
|
||||
} else {
|
||||
return array(
|
||||
'state' => false,
|
||||
'record' => array()
|
||||
);
|
||||
}
|
||||
|
||||
$sessionData = array(
|
||||
'request_uri' => mysql_real_escape_string($_SERVER['REQUEST_URI']),
|
||||
'remote_addr' => mysql_real_escape_string($_SERVER['REMOTE_ADDR']/* . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? '|' . $_SERVER['HTTP_X_FORWARDED_FOR'] : '')*/),
|
||||
'user_agent' => mysql_real_escape_string($_SERVER['HTTP_USER_AGENT'])
|
||||
);
|
||||
$now = time();
|
||||
$sql =<<<EOF
|
||||
UPDATE {{table}}
|
||||
SET `onlinetime` = "{$now}",
|
||||
`current_page` = "{$sessionData['request_uri']}",
|
||||
`user_lastip` = "{$sessionData['remote_addr']}",
|
||||
`user_agent` = "{$sessionData['user_agent']}"
|
||||
WHERE `id`={$_SESSION['user_id']}
|
||||
LIMIT 1;
|
||||
EOF;
|
||||
doquery($sql, 'users');
|
||||
$IsUserChecked = true;
|
||||
|
||||
return array(
|
||||
'state' => $IsUserChecked,
|
||||
'record' => $userData
|
||||
);
|
||||
}
|
||||
46
includes/functions/CheckInputStrings.php
Normal file
46
includes/functions/CheckInputStrings.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?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 $String
|
||||
*/
|
||||
function CheckInputStrings ( $String ) {
|
||||
global $ListCensure;
|
||||
|
||||
$ValidString = $String;
|
||||
for ($Mot = 0; $Mot < count($ListCensure); $Mot++) {
|
||||
$ValidString = eregi_replace( "$ListCensure[$Mot]", "*", $ValidString );
|
||||
}
|
||||
return ($ValidString);
|
||||
}
|
||||
|
||||
?>
|
||||
62
includes/functions/CheckLabSettingsInQueue.php
Normal file
62
includes/functions/CheckLabSettingsInQueue.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?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;
|
||||
}
|
||||
|
||||
?>
|
||||
156
includes/functions/CheckPlanetBuildingQueue.php
Normal file
156
includes/functions/CheckPlanetBuildingQueue.php
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
<?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 CheckPlanetBuildingQueue ( &$CurrentPlanet, &$CurrentUser ) {
|
||||
global $lang, $resource;
|
||||
|
||||
// Table des batiments donnant droit de l'experience minier
|
||||
$XPBuildings = array( 1, 2, 3, 22, 23, 24);
|
||||
|
||||
$RetValue = false;
|
||||
if ($CurrentPlanet['b_building_id'] != 0) {
|
||||
$CurrentQueue = $CurrentPlanet['b_building_id'];
|
||||
if ($CurrentQueue != 0) {
|
||||
$QueueArray = explode ( ";", $CurrentQueue );
|
||||
$ActualCount = count ( $QueueArray );
|
||||
}
|
||||
|
||||
$BuildArray = explode (",", $QueueArray[0]);
|
||||
$BuildEndTime = floor($BuildArray[3]);
|
||||
$BuildMode = $BuildArray[4];
|
||||
$Element = $BuildArray[0];
|
||||
array_shift ( $QueueArray );
|
||||
|
||||
if ($BuildMode == 'destroy') {
|
||||
$ForDestroy = true;
|
||||
} else {
|
||||
$ForDestroy = false;
|
||||
}
|
||||
|
||||
if ($BuildEndTime <= time()) {
|
||||
// Mise a jours des points
|
||||
$Needed = GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
|
||||
$Units = $Needed['metal'] + $Needed['crystal'] + $Needed['deuterium'];
|
||||
if ($ForDestroy == false) {
|
||||
// Mise a jours de l'XP Minier
|
||||
if (in_array($Element, $XPBuildings)) {
|
||||
$AjoutXP = $Units / 1000;
|
||||
$CurrentUser['xpminier'] += $AjoutXP;
|
||||
}
|
||||
} else {
|
||||
// Mise a jours de l'XP Minier
|
||||
if (in_array($Element, $XPBuildings)) {
|
||||
$AjoutXP = ($Units * 3) / 1000;
|
||||
$CurrentUser['xpminier'] -= $AjoutXP;
|
||||
}
|
||||
}
|
||||
|
||||
$current = intval($CurrentPlanet['field_current']);
|
||||
$max = intval($CurrentPlanet['field_max']);
|
||||
// Pour une lune
|
||||
if ($CurrentPlanet['planet_type'] == 3) {
|
||||
if ($Element == 41) {
|
||||
// Base Lunaire
|
||||
$current += 1;
|
||||
$max += FIELDS_BY_MOONBASIS_LEVEL;
|
||||
$CurrentPlanet[$resource[$Element]]++;
|
||||
} elseif ($Element != 0) {
|
||||
if ($ForDestroy == false) {
|
||||
$current += 1;
|
||||
$CurrentPlanet[$resource[$Element]]++;
|
||||
} else {
|
||||
$current -= 1;
|
||||
$CurrentPlanet[$resource[$Element]]--;
|
||||
}
|
||||
}
|
||||
} elseif ($CurrentPlanet['planet_type'] == 1) {
|
||||
if ($ForDestroy == false) {
|
||||
$current += 1;
|
||||
$CurrentPlanet[$resource[$Element]]++;
|
||||
} else {
|
||||
$current -= 1;
|
||||
$CurrentPlanet[$resource[$Element]]--;
|
||||
}
|
||||
}
|
||||
if (count ( $QueueArray ) == 0) {
|
||||
$NewQueue = 0;
|
||||
} else {
|
||||
$NewQueue = implode (";", $QueueArray );
|
||||
}
|
||||
$CurrentPlanet['b_building'] = 0;
|
||||
$CurrentPlanet['b_building_id'] = $NewQueue;
|
||||
$CurrentPlanet['field_current'] = $current;
|
||||
$CurrentPlanet['field_max'] = $max;
|
||||
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`".$resource[$Element]."` = '".$CurrentPlanet[$resource[$Element]]."', ";
|
||||
// Mise a 0 de l'heure de fin de construction ...
|
||||
// Ca va activer la mise en place du batiment suivant de la queue
|
||||
$QryUpdatePlanet .= "`b_building` = '". $CurrentPlanet['b_building'] ."' , ";
|
||||
$QryUpdatePlanet .= "`b_building_id` = '". $CurrentPlanet['b_building_id'] ."' , ";
|
||||
$QryUpdatePlanet .= "`field_current` = '" . $CurrentPlanet['field_current'] . "', ";
|
||||
$QryUpdatePlanet .= "`field_max` = '" . $CurrentPlanet['field_max'] . "' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
$QryUpdateUser = "UPDATE {{table}} SET ";
|
||||
$QryUpdateUser .= "`xpminier` = '".$CurrentUser['xpminier']."' ";
|
||||
$QryUpdateUser .= "WHERE ";
|
||||
$QryUpdateUser .= "`id` = '" . $CurrentUser['id'] . "';";
|
||||
doquery( $QryUpdateUser, 'users');
|
||||
|
||||
$RetValue = true;
|
||||
} else {
|
||||
$RetValue = false;
|
||||
}
|
||||
} else {
|
||||
$CurrentPlanet['b_building'] = 0;
|
||||
$CurrentPlanet['b_building_id'] = 0;
|
||||
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`b_building` = '". $CurrentPlanet['b_building'] ."' , ";
|
||||
$QryUpdatePlanet .= "`b_building_id` = '". $CurrentPlanet['b_building_id'] ."' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
$RetValue = false;
|
||||
}
|
||||
|
||||
return $RetValue;
|
||||
}
|
||||
|
||||
?>
|
||||
58
includes/functions/CheckPlanetUsedFields.php
Normal file
58
includes/functions/CheckPlanetUsedFields.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?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 $planet
|
||||
*/
|
||||
function CheckPlanetUsedFields ( &$planet ) {
|
||||
global $resource;
|
||||
|
||||
// Tous les batiments
|
||||
$cfc = $planet[$resource[1]] + $planet[$resource[2]] + $planet[$resource[3]] ;
|
||||
$cfc += $planet[$resource[4]] + $planet[$resource[12]] + $planet[$resource[14]];
|
||||
$cfc += $planet[$resource[15]] + $planet[$resource[21]] + $planet[$resource[22]];
|
||||
$cfc += $planet[$resource[23]] + $planet[$resource[24]] + $planet[$resource[31]];
|
||||
$cfc += $planet[$resource[33]] + $planet[$resource[34]] + $planet[$resource[44]];
|
||||
|
||||
// Si on se trouve sur une lune ... Y a des choses a ajouter aussi
|
||||
if ($planet['planet_type'] == '3') {
|
||||
$cfc += $planet[$resource[41]] + $planet[$resource[42]] + $planet[$resource[43]];
|
||||
}
|
||||
|
||||
// Mise a jour du nombre de case dans la BDD si incorrect
|
||||
if ($planet['field_current'] != $cfc) {
|
||||
$planet['field_current'] = $cfc;
|
||||
doquery("UPDATE {{table}} SET field_current=$cfc WHERE id={$planet['id']}", 'planets');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
62
includes/functions/ChekUser.php
Normal file
62
includes/functions/ChekUser.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?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 $IsUserChecked
|
||||
*/
|
||||
function CheckTheUser($IsUserChecked)
|
||||
{
|
||||
global $user;
|
||||
includeLang('admin');
|
||||
$Result = CheckCookies( $IsUserChecked );
|
||||
$IsUserChecked = $Result['state'];
|
||||
|
||||
|
||||
if ($Result['record'] != false) {
|
||||
$user = $Result['record'];
|
||||
if ($user['bana'] == "1") {
|
||||
die (
|
||||
|
||||
$page .= parsetemplate(gettemplate('usr_banned'), $lang)
|
||||
|
||||
);
|
||||
}
|
||||
$RetValue['record'] = $user;
|
||||
$RetValue['state'] = $IsUserChecked;
|
||||
} else {
|
||||
$RetValue['record'] = array();
|
||||
$RetValue['state'] = false;
|
||||
}
|
||||
|
||||
return $RetValue;
|
||||
}
|
||||
|
||||
129
includes/functions/CreateOneMoonRecord.php
Normal file
129
includes/functions/CreateOneMoonRecord.php
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<?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 $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $Owner
|
||||
* @param unknown_type $MoonID
|
||||
* @param unknown_type $MoonName
|
||||
* @param unknown_type $Chance
|
||||
*/
|
||||
function CreateOneMoonRecord ( $Galaxy, $System, $Planet, $Owner, $MoonID, $MoonName, $Chance ) {
|
||||
global $lang;
|
||||
|
||||
$PlanetName = "";
|
||||
|
||||
$QryGetMoonPlanetData = "SELECT * FROM {{table}} ";
|
||||
$QryGetMoonPlanetData .= "WHERE ";
|
||||
$QryGetMoonPlanetData .= "`galaxy` = '". $Galaxy ."' AND ";
|
||||
$QryGetMoonPlanetData .= "`system` = '". $System ."' AND ";
|
||||
$QryGetMoonPlanetData .= "`planet` = '". $Planet ."';";
|
||||
$MoonPlanet = doquery ( $QryGetMoonPlanetData, 'planets', true);
|
||||
|
||||
$QryGetMoonGalaxyData = "SELECT * FROM {{table}} ";
|
||||
$QryGetMoonGalaxyData .= "WHERE ";
|
||||
$QryGetMoonGalaxyData .= "`galaxy` = '". $Galaxy ."' AND ";
|
||||
$QryGetMoonGalaxyData .= "`system` = '". $System ."' AND ";
|
||||
$QryGetMoonGalaxyData .= "`planet` = '". $Planet ."';";
|
||||
$MoonGalaxy = doquery ( $QryGetMoonGalaxyData, 'galaxy', true);
|
||||
|
||||
if ($MoonGalaxy['id_luna'] == 0) {
|
||||
if ($MoonPlanet['id'] != 0) {
|
||||
$SizeMin = 2000 + ( $Chance * 100 );
|
||||
$SizeMax = 6000 + ( $Chance * 200 );
|
||||
|
||||
$PlanetName = $MoonPlanet['name'];
|
||||
|
||||
$maxtemp = $MoonPlanet['temp_max'] - rand(10, 45);
|
||||
$mintemp = $MoonPlanet['temp_min'] - rand(10, 45);
|
||||
$size = rand ($SizeMin, $SizeMax);
|
||||
|
||||
$QryInsertMoonInLunas = "INSERT INTO {{table}} SET ";
|
||||
$QryInsertMoonInLunas .= "`name` = '". ( ($MoonName == '') ? $lang['sys_moon'] : $MoonName ) ."', ";
|
||||
$QryInsertMoonInLunas .= "`galaxy` = '". $Galaxy ."', ";
|
||||
$QryInsertMoonInLunas .= "`system` = '". $System ."', ";
|
||||
$QryInsertMoonInLunas .= "`lunapos` = '". $Planet ."', ";
|
||||
$QryInsertMoonInLunas .= "`id_owner` = '". $Owner ."', ";
|
||||
$QryInsertMoonInLunas .= "`temp_max` = '". $maxtemp ."', ";
|
||||
$QryInsertMoonInLunas .= "`temp_min` = '". $mintemp ."', ";
|
||||
$QryInsertMoonInLunas .= "`diameter` = '". $size ."', ";
|
||||
$QryInsertMoonInLunas .= "`id_luna` = '". $MoonID ."';";
|
||||
doquery( $QryInsertMoonInLunas , 'lunas' );
|
||||
|
||||
$QryGetMoonIdFromLunas = "SELECT * FROM {{table}} ";
|
||||
$QryGetMoonIdFromLunas .= "WHERE ";
|
||||
$QryGetMoonIdFromLunas .= "`galaxy` = '". $Galaxy ."' AND ";
|
||||
$QryGetMoonIdFromLunas .= "`system` = '". $System ."' AND ";
|
||||
$QryGetMoonIdFromLunas .= "`lunapos` = '". $Planet ."';";
|
||||
$lunarow = doquery( $QryGetMoonIdFromLunas , 'lunas', true);
|
||||
|
||||
$QryUpdateMoonInGalaxy = "UPDATE {{table}} SET ";
|
||||
$QryUpdateMoonInGalaxy .= "`id_luna` = '". $lunarow['id'] ."', ";
|
||||
$QryUpdateMoonInGalaxy .= "`luna` = '0' ";
|
||||
$QryUpdateMoonInGalaxy .= "WHERE ";
|
||||
$QryUpdateMoonInGalaxy .= "`galaxy` = '". $Galaxy ."' AND ";
|
||||
$QryUpdateMoonInGalaxy .= "`system` = '". $System ."' AND ";
|
||||
$QryUpdateMoonInGalaxy .= "`planet` = '". $Planet ."';";
|
||||
doquery( $QryUpdateMoonInGalaxy , 'galaxy');
|
||||
|
||||
$QryInsertMoonInPlanet = "INSERT INTO {{table}} SET ";
|
||||
$QryInsertMoonInPlanet .= "`name` = '" .$lang['sys_moon'] ."', ";
|
||||
$QryInsertMoonInPlanet .= "`id_owner` = '". $Owner ."', ";
|
||||
$QryInsertMoonInPlanet .= "`galaxy` = '". $Galaxy ."', ";
|
||||
$QryInsertMoonInPlanet .= "`system` = '". $System ."', ";
|
||||
$QryInsertMoonInPlanet .= "`planet` = '". $Planet ."', ";
|
||||
$QryInsertMoonInPlanet .= "`last_update` = '". time() ."', ";
|
||||
$QryInsertMoonInPlanet .= "`planet_type` = '3', ";
|
||||
$QryInsertMoonInPlanet .= "`image` = 'mond', ";
|
||||
$QryInsertMoonInPlanet .= "`diameter` = '". $size ."', ";
|
||||
$QryInsertMoonInPlanet .= "`field_max` = '1', ";
|
||||
$QryInsertMoonInPlanet .= "`temp_min` = '". $maxtemp ."', ";
|
||||
$QryInsertMoonInPlanet .= "`temp_max` = '". $mintemp ."', ";
|
||||
$QryInsertMoonInPlanet .= "`metal` = '0', ";
|
||||
$QryInsertMoonInPlanet .= "`metal_perhour` = '0', ";
|
||||
$QryInsertMoonInPlanet .= "`metal_max` = '".BASE_STORAGE_SIZE."', ";
|
||||
$QryInsertMoonInPlanet .= "`crystal` = '0', ";
|
||||
$QryInsertMoonInPlanet .= "`crystal_perhour` = '0', ";
|
||||
$QryInsertMoonInPlanet .= "`crystal_max` = '".BASE_STORAGE_SIZE."', ";
|
||||
$QryInsertMoonInPlanet .= "`deuterium` = '0', ";
|
||||
$QryInsertMoonInPlanet .= "`deuterium_perhour` = '0', ";
|
||||
$QryInsertMoonInPlanet .= "`deuterium_max` = '".BASE_STORAGE_SIZE."';";
|
||||
doquery( $QryInsertMoonInPlanet , 'planets');
|
||||
}
|
||||
}
|
||||
|
||||
return $PlanetName;
|
||||
}
|
||||
|
||||
?>
|
||||
227
includes/functions/CreateOnePlanetRecord.php
Normal file
227
includes/functions/CreateOnePlanetRecord.php
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
<?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 $Position
|
||||
* @param unknown_type $HomeWorld
|
||||
*/
|
||||
function PlanetSizeRandomiser ($Position, $HomeWorld = false) {
|
||||
global $gameConfig;
|
||||
|
||||
if (!$HomeWorld) {
|
||||
$ClassicBase = 163;
|
||||
$SettingSize = $gameConfig['initial_fields'];
|
||||
$PlanetRatio = floor ( ($ClassicBase / $SettingSize) * 10000 ) / 100;
|
||||
$RandomMin = array ( 40, 50, 55, 100, 95, 80, 115, 120, 125, 75, 80, 85, 60, 40, 50);
|
||||
$RandomMax = array ( 90, 95, 95, 240, 240, 230, 180, 180, 190, 125, 120, 130, 160, 300, 150);
|
||||
$CalculMin = floor ( $RandomMin[$Position - 1] + ( $RandomMin[$Position - 1] * $PlanetRatio ) / 100 );
|
||||
$CalculMax = floor ( $RandomMax[$Position - 1] + ( $RandomMax[$Position - 1] * $PlanetRatio ) / 100 );
|
||||
$RandomSize = mt_rand($CalculMin, $CalculMax);
|
||||
$MaxAddon = mt_rand(0, 110);
|
||||
$MinAddon = mt_rand(0, 100);
|
||||
$Addon = ($MaxAddon - $MinAddon);
|
||||
$PlanetFields = ($RandomSize + $abweichung);
|
||||
} else {
|
||||
$PlanetFields = $gameConfig['initial_fields'];
|
||||
}
|
||||
$PlanetSize = ($PlanetFields ^ (14 / 1.5)) * 75;
|
||||
|
||||
$return['diameter'] = $PlanetSize;
|
||||
$return['field_max'] = $PlanetFields;
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Position
|
||||
* @param unknown_type $PlanetOwnerID
|
||||
* @param unknown_type $PlanetName
|
||||
* @param unknown_type $HomeWorld
|
||||
*/
|
||||
function CreateOnePlanetRecord($Galaxy, $System, $Position, $PlanetOwnerID, $PlanetName = '', $HomeWorld = false) {
|
||||
global $lang;
|
||||
|
||||
// Avant tout, on verifie s'il existe deja une planete a cet endroit
|
||||
$QrySelectPlanet = "SELECT `id` ";
|
||||
$QrySelectPlanet .= "FROM {{table}} ";
|
||||
$QrySelectPlanet .= "WHERE ";
|
||||
$QrySelectPlanet .= "`galaxy` = '". $Galaxy ."' AND ";
|
||||
$QrySelectPlanet .= "`system` = '". $System ."' AND ";
|
||||
$QrySelectPlanet .= "`planet` = '". $Position ."';";
|
||||
$PlanetExist = doquery( $QrySelectPlanet, 'planets', true);
|
||||
|
||||
// Si $PlanetExist est autre chose que false ... c'est qu'il y a quelque chose l<> bas ...
|
||||
// C'est donc aussi que je ne peux pas m'y poser !!
|
||||
if (!$PlanetExist) {
|
||||
$planet = PlanetSizeRandomiser ($Position, $HomeWorld);
|
||||
$planet['diameter'] = ($planet['field_max'] ^ (14 / 1.5)) * 75 ;
|
||||
$planet['metal'] = BUILD_METAL;
|
||||
$planet['crystal'] = BUILD_CRISTAL;
|
||||
$planet['deuterium'] = BUILD_DEUTERIUM;
|
||||
$planet['metal_perhour'] = $gameConfig['metal_basic_income'];
|
||||
$planet['crystal_perhour'] = $gameConfig['crystal_basic_income'];
|
||||
$planet['deuterium_perhour'] = $gameConfig['deuterium_basic_income'];
|
||||
$planet['metal_max'] = BASE_STORAGE_SIZE;
|
||||
$planet['crystal_max'] = BASE_STORAGE_SIZE;
|
||||
$planet['deuterium_max'] = BASE_STORAGE_SIZE;
|
||||
|
||||
// Posistion 1 - 3: 80% entre 40 et 70 Cases ( 55+ / -15 )
|
||||
// Posistion 4 - 6: 80% entre 120 et 310 Cases ( 215+ / -95 )
|
||||
// Posistion 7 - 9: 80% entre 105 et 195 Cases ( 150+ / -45 )
|
||||
// Posistion 10 - 12: 80% entre 75 et 125 Cases ( 100+ / -25 )
|
||||
// Posistion 13 - 15: 80% entre 60 et 190 Cases ( 125+ / -65 )
|
||||
|
||||
$planet['galaxy'] = $Galaxy;
|
||||
$planet['system'] = $System;
|
||||
$planet['planet'] = $Position;
|
||||
|
||||
if ($Position == 1 || $Position == 2 || $Position == 3) {
|
||||
$PlanetType = array('trocken');
|
||||
$PlanetClass = array('planet');
|
||||
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
|
||||
$planet['temp_min'] = rand(0, 100);
|
||||
$planet['temp_max'] = $planet['temp_min'] + 40;
|
||||
} elseif ($Position == 4 || $Position == 5 || $Position == 6) {
|
||||
$PlanetType = array('dschjungel');
|
||||
$PlanetClass = array('planet');
|
||||
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
|
||||
$planet['temp_min'] = rand(-25, 75);
|
||||
$planet['temp_max'] = $planet['temp_min'] + 40;
|
||||
} elseif ($Position == 7 || $Position == 8 || $Position == 9) {
|
||||
$PlanetType = array('normaltemp');
|
||||
$PlanetClass = array('planet');
|
||||
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07');
|
||||
$planet['temp_min'] = rand(-50, 50);
|
||||
$planet['temp_max'] = $planet['temp_min'] + 40;
|
||||
} elseif ($Position == 10 || $Position == 11 || $Position == 12) {
|
||||
$PlanetType = array('wasser');
|
||||
$PlanetClass = array('planet');
|
||||
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09');
|
||||
$planet['temp_min'] = rand(-75, 25);
|
||||
$planet['temp_max'] = $planet['temp_min'] + 40;
|
||||
} elseif ($Position == 13 || $Position == 14 || $Position == 15) {
|
||||
$PlanetType = array('eis');
|
||||
$PlanetClass = array('planet');
|
||||
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
|
||||
$planet['temp_min'] = rand(-100, 10);
|
||||
$planet['temp_max'] = $planet['temp_min'] + 40;
|
||||
} else {
|
||||
$PlanetType = array('dschjungel', 'gas', 'normaltemp', 'trocken', 'wasser', 'wuesten', 'eis');
|
||||
$PlanetClass = array('planet');
|
||||
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '00',);
|
||||
$planet['temp_min'] = rand(-120, 10);
|
||||
$planet['temp_max'] = $planet['temp_min'] + 40;
|
||||
}
|
||||
|
||||
$planet['image'] = $PlanetType[ rand( 0, count( $PlanetType ) -1 ) ];
|
||||
$planet['image'] .= $PlanetClass[ rand( 0, count( $PlanetClass ) - 1 ) ];
|
||||
$planet['image'] .= $PlanetDesign[ rand( 0, count( $PlanetDesign ) - 1 ) ];
|
||||
$planet['planet_type'] = 1;
|
||||
$planet['id_owner'] = $PlanetOwnerID;
|
||||
$planet['last_update'] = time();
|
||||
$planet['name'] = ($PlanetName == '') ? $lang['sys_colo_defaultname'] : $PlanetName;
|
||||
|
||||
$QryInsertPlanet = "INSERT INTO {{table}} SET ";
|
||||
$QryInsertPlanet .= "`name` = '". $planet['name'] ."', ";
|
||||
$QryInsertPlanet .= "`id_owner` = '". $planet['id_owner'] ."', ";
|
||||
$QryInsertPlanet .= "`galaxy` = '". $planet['galaxy'] ."', ";
|
||||
$QryInsertPlanet .= "`system` = '". $planet['system'] ."', ";
|
||||
$QryInsertPlanet .= "`planet` = '". $planet['planet'] ."', ";
|
||||
$QryInsertPlanet .= "`last_update` = '". $planet['last_update'] ."', ";
|
||||
$QryInsertPlanet .= "`planet_type` = '". $planet['planet_type'] ."', ";
|
||||
$QryInsertPlanet .= "`image` = '". $planet['image'] ."', ";
|
||||
$QryInsertPlanet .= "`diameter` = '". $planet['diameter'] ."', ";
|
||||
$QryInsertPlanet .= "`field_max` = '". $planet['field_max'] ."', ";
|
||||
$QryInsertPlanet .= "`temp_min` = '". $planet['temp_min'] ."', ";
|
||||
$QryInsertPlanet .= "`temp_max` = '". $planet['temp_max'] ."', ";
|
||||
$QryInsertPlanet .= "`metal` = '". $planet['metal'] ."', ";
|
||||
$QryInsertPlanet .= "`metal_perhour` = '". $planet['metal_perhour'] ."', ";
|
||||
$QryInsertPlanet .= "`metal_max` = '". $planet['metal_max'] ."', ";
|
||||
$QryInsertPlanet .= "`crystal` = '". $planet['crystal'] ."', ";
|
||||
$QryInsertPlanet .= "`crystal_perhour` = '". $planet['crystal_perhour'] ."', ";
|
||||
$QryInsertPlanet .= "`crystal_max` = '". $planet['crystal_max'] ."', ";
|
||||
$QryInsertPlanet .= "`deuterium` = '". $planet['deuterium'] ."', ";
|
||||
$QryInsertPlanet .= "`deuterium_perhour` = '". $planet['deuterium_perhour'] ."', ";
|
||||
$QryInsertPlanet .= "`deuterium_max` = '". $planet['deuterium_max'] ."';";
|
||||
doquery( $QryInsertPlanet, 'planets');
|
||||
|
||||
// On recupere l'id de planete nouvellement cr<63><72>
|
||||
$QrySelectPlanet = "SELECT `id` ";
|
||||
$QrySelectPlanet .= "FROM {{table}} ";
|
||||
$QrySelectPlanet .= "WHERE ";
|
||||
$QrySelectPlanet .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
|
||||
$QrySelectPlanet .= "`system` = '". $planet['system'] ."' AND ";
|
||||
$QrySelectPlanet .= "`planet` = '". $planet['planet'] ."' AND ";
|
||||
$QrySelectPlanet .= "`id_owner` = '". $planet['id_owner'] ."';";
|
||||
$GetPlanetID = doquery( $QrySelectPlanet , 'planets', true);
|
||||
|
||||
// Testons s'il y a deja eu une planete ici
|
||||
$QrySelectGalaxy = "SELECT * ";
|
||||
$QrySelectGalaxy .= "FROM {{table}} ";
|
||||
$QrySelectGalaxy .= "WHERE ";
|
||||
$QrySelectGalaxy .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
|
||||
$QrySelectGalaxy .= "`system` = '". $planet['system'] ."' AND ";
|
||||
$QrySelectGalaxy .= "`planet` = '". $planet['planet'] ."';";
|
||||
$GetGalaxyID = doquery( $QrySelectGalaxy, 'galaxy', true);
|
||||
|
||||
if ($GetGalaxyID) {
|
||||
// Ah ... Ce secteur de ce vaste monde a deja ete occup<75>
|
||||
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
|
||||
$QryUpdateGalaxy .= "`id_planet` = '". $GetPlanetID['id'] ."' ";
|
||||
$QryUpdateGalaxy .= "WHERE ";
|
||||
$QryUpdateGalaxy .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
|
||||
$QryUpdateGalaxy .= "`system` = '". $planet['system'] ."' AND ";
|
||||
$QryUpdateGalaxy .= "`planet` = '". $planet['planet'] ."';";
|
||||
doquery( $QryUpdateGalaxy, 'galaxy');
|
||||
} else {
|
||||
// C'est tout vide ... y a que dalle ... j'm'y pose !!
|
||||
$QryInsertGalaxy = "INSERT INTO {{table}} SET ";
|
||||
$QryInsertGalaxy .= "`galaxy` = '". $planet['galaxy'] ."', ";
|
||||
$QryInsertGalaxy .= "`system` = '". $planet['system'] ."', ";
|
||||
$QryInsertGalaxy .= "`planet` = '". $planet['planet'] ."', ";
|
||||
$QryInsertGalaxy .= "`id_planet` = '". $GetPlanetID['id'] ."';";
|
||||
doquery( $QryInsertGalaxy, 'galaxy');
|
||||
}
|
||||
|
||||
$RetValue = true;
|
||||
} else {
|
||||
|
||||
$RetValue = false;
|
||||
}
|
||||
|
||||
return $RetValue;
|
||||
}
|
||||
|
||||
?>
|
||||
150
includes/functions/DefensesBuildingPage.php
Normal file
150
includes/functions/DefensesBuildingPage.php
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
<?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
|
||||
//
|
||||
?>
|
||||
73
includes/functions/DeleteSelectedUser.php
Normal file
73
includes/functions/DeleteSelectedUser.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?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 $UserID
|
||||
*/
|
||||
function DeleteSelectedUser ( $UserID ) {
|
||||
|
||||
$TheUser = doquery ( "SELECT * FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users', true );
|
||||
if ( $TheUser['ally_id'] != 0 ) {
|
||||
$TheAlly = doquery ( "SELECT * FROM {{table}} WHERE `id` = '" . $TheUser['ally_id'] . "';", 'alliance', true );
|
||||
$TheAlly['ally_members'] -= 1;
|
||||
if ( $TheAlly['ally_members'] > 0 ) {
|
||||
doquery ( "UPDATE {{table}} SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';", 'alliance' );
|
||||
} else {
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $TheAlly['id'] . "';", 'alliance' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';", 'statpoints' );
|
||||
}
|
||||
}
|
||||
doquery ( "DELETE FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';", 'statpoints' );
|
||||
|
||||
$ThePlanets = doquery ( "SELECT * FROM {{table}} WHERE `id_owner` = '" . $UserID . "';", 'planets' );
|
||||
while ( $OnePlanet = mysql_fetch_assoc ( $ThePlanets ) ) {
|
||||
if ( $OnePlanet['planet_type'] == 1 ) {
|
||||
doquery ( "DELETE FROM {{table}} WHERE `galaxy` = '" . $OnePlanet['galaxy'] . "' AND `system` = '" . $OnePlanet['system'] . "' AND `planet` = '" . $OnePlanet['planet'] . "';", 'galaxy' );
|
||||
} elseif ( $OnePlanet['planet_type'] == 3 ) {
|
||||
doquery ( "DELETE FROM {{table}} WHERE `galaxy` = '" . $OnePlanet['galaxy'] . "' AND `system` = '" . $OnePlanet['system'] . "' AND `lunapos` = '" . $OnePlanet['planet'] . "';", 'lunas' );
|
||||
}
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $OnePlanet['id'] . "';", 'planets' );
|
||||
}
|
||||
doquery ( "DELETE FROM {{table}} WHERE `message_sender` = '" . $UserID . "';", 'messages' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `message_owner` = '" . $UserID . "';", 'messages' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'notes' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `fleet_owner` = '" . $UserID . "';", 'fleets' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id_owner1` = '" . $UserID . "';", 'rw' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id_owner2` = '" . $UserID . "';", 'rw' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `sender` = '" . $UserID . "';", 'buddy' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'buddy' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `user` = '" . $UserID . "';", 'annonce' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users' );
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
70
includes/functions/ElementBuildListBox.php
Normal file
70
includes/functions/ElementBuildListBox.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?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 ElementBuildListBox ( $CurrentUser, $CurrentPlanet ) {
|
||||
global $lang, $pricelist;
|
||||
|
||||
// // Array del b_hangar_id
|
||||
// $ElementQueue = explode(';', $CurrentPlanet['b_hangar_id']);
|
||||
// $NbrePerType = "";
|
||||
// $NamePerType = "";
|
||||
// $TimePerType = "";
|
||||
//
|
||||
// foreach($ElementQueue as $ElementLine => $Element) {
|
||||
// if ($Element != '') {
|
||||
// $Element = explode(',', $Element);
|
||||
// $ElementTime = GetBuildingTime( $CurrentUser, $CurrentPlanet, $Element[0] );
|
||||
// $QueueTime += $ElementTime * $Element[1];
|
||||
// $TimePerType .= "".$ElementTime.",";
|
||||
// $NamePerType .= "'". html_entity_decode($lang['tech'][$Element[0]]) ."',";
|
||||
// $NbrePerType .= "".$Element[1].",";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $parse = $lang;
|
||||
// $parse['a'] = $NbrePerType;
|
||||
// $parse['b'] = $NamePerType;
|
||||
// $parse['c'] = $TimePerType;
|
||||
// $parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
|
||||
//
|
||||
// $parse['pretty_time_b_hangar'] = pretty_time($QueueTime - $CurrentPlanet['b_hangar']);
|
||||
//
|
||||
// $text .= parsetemplate(gettemplate('buildings_script'), $parse);
|
||||
//
|
||||
// return $text;
|
||||
}
|
||||
|
||||
?>
|
||||
82
includes/functions/ElementBuildListQueue.php
Normal file
82
includes/functions/ElementBuildListQueue.php
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?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 !
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
|
||||
?>
|
||||
149
includes/functions/FleetBuildingPage.php
Normal file
149
includes/functions/FleetBuildingPage.php
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
<?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']);
|
||||
}
|
||||
122
includes/functions/FlyingFleetHandler.php
Normal file
122
includes/functions/FlyingFleetHandler.php
Normal file
|
|
@ -0,0 +1,122 @@
|
|||
<?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 $planet
|
||||
*/
|
||||
function FlyingFleetHandler (&$planet) {
|
||||
global $resource;
|
||||
|
||||
doquery("LOCK TABLE {{table}}lunas WRITE, {{table}}rw WRITE, {{table}}errors WRITE, {{table}}messages WRITE, {{table}}fleets WRITE, {{table}}planets WRITE, {{table}}galaxy WRITE ,{{table}}users WRITE", "");
|
||||
|
||||
$QryFleet = "SELECT * FROM {{table}} ";
|
||||
$QryFleet .= "WHERE (";
|
||||
$QryFleet .= "( ";
|
||||
$QryFleet .= "`fleet_start_galaxy` = ". $planet['galaxy'] ." AND ";
|
||||
$QryFleet .= "`fleet_start_system` = ". $planet['system'] ." AND ";
|
||||
$QryFleet .= "`fleet_start_planet` = ". $planet['planet'] ." AND ";
|
||||
$QryFleet .= "`fleet_start_type` = ". $planet['planet_type'] ." ";
|
||||
$QryFleet .= ") OR ( ";
|
||||
$QryFleet .= "`fleet_end_galaxy` = ". $planet['galaxy'] ." AND ";
|
||||
$QryFleet .= "`fleet_end_system` = ". $planet['system'] ." AND ";
|
||||
$QryFleet .= "`fleet_end_planet` = ". $planet['planet'] ." ) AND ";
|
||||
$QryFleet .= "`fleet_end_type`= ". $planet['planet_type'] ." ) AND ";
|
||||
$QryFleet .= "( `fleet_start_time` < '". time() ."' OR `fleet_end_time` < '". time() ."' );";
|
||||
$fleetquery = doquery( $QryFleet, 'fleets' );
|
||||
|
||||
while ($CurrentFleet = mysql_fetch_array($fleetquery)) {
|
||||
switch ($CurrentFleet["fleet_mission"]) {
|
||||
case 1:
|
||||
// Attaquer
|
||||
MissionCaseAttack ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// Attaque groupée
|
||||
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = '". $CurrentFleet['fleet_id'] ."';", 'fleets');
|
||||
break;
|
||||
|
||||
case 3:
|
||||
// Transporter
|
||||
MissionCaseTransport ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// Stationner
|
||||
MissionCaseStay ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 5:
|
||||
// Stationner chez un Allié
|
||||
MissionCaseStayAlly ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// Flotte d'espionnage
|
||||
MissionCaseSpy ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 7:
|
||||
// Coloniser
|
||||
MissionCaseColonisation ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 8:
|
||||
// Recyclage
|
||||
MissionCaseRecycling ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 9:
|
||||
// Detruire ??? dans le code ogame c'est 9 !!
|
||||
MissionCaseDestruction ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 10:
|
||||
// Missiles !!
|
||||
|
||||
break;
|
||||
|
||||
case 15:
|
||||
// Expeditions
|
||||
MissionCaseExpedition ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
default: {
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $CurrentFleet['fleet_id'] ."';", 'fleets');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doquery("UNLOCK TABLES", "");
|
||||
}
|
||||
|
||||
?>
|
||||
56
includes/functions/GalaxyCheckFunctions.php
Normal file
56
includes/functions/GalaxyCheckFunctions.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?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 $lunarow
|
||||
*/
|
||||
function CheckAbandonMoonState ($lunarow) {
|
||||
if (($lunarow['destruyed'] + 172800) <= time() && $lunarow['destruyed'] != 0) {
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id = '" . $lunarow['id'] . "'", "lunas");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression complete d'une planete
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function CheckAbandonPlanetState (&$planet) {
|
||||
if ($planet['destruyed'] <= time()) {
|
||||
$id = $planet['id'];
|
||||
doquery("DELETE FROM {{table}} WHERE id={$id}", 'planets');
|
||||
doquery("DELETE FROM {{table}} WHERE id_planet={$id}", 'galaxy');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
69
includes/functions/GalaxyLegendPopup.php
Normal file
69
includes/functions/GalaxyLegendPopup.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?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
|
||||
*/
|
||||
function GalaxyLegendPopup () {
|
||||
global $lang;
|
||||
|
||||
$Result = "<a href=# style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['Legend']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Strong_player']."</td><td><span class=strong>".$lang['strong_player_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Weak_player']."</td><td><span class=noob>".$lang['weak_player_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Way_vacation']."</td><td><span class=vacation>".$lang['vacation_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Pendent_user']."</td><td><span class=banned>".$lang['banned_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Inactive_7_days']."</td><td><span class=inactive>".$lang['inactif_7_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Inactive_28_days']."</td><td><span class=longinactive>".$lang['inactif_28_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>Admin</td><td><font color=lime><blink>A</blink></font></td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "\");' onmouseout='return nd();'>";
|
||||
$Result .= $lang['Legend']."</a>";
|
||||
|
||||
|
||||
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
108
includes/functions/GalaxyRowActions.php
Normal file
108
includes/functions/GalaxyRowActions.php
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
<?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 $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowPlayer
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowActions ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user, $dpath, $CurrentMIP, $CurrentSystem, $CurrentGalaxy;
|
||||
// Icones action
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=125>";
|
||||
if ($GalaxyRowPlayer['id'] != $user['id']) {
|
||||
|
||||
if ($CurrentMIP <> 0) {
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
|
||||
$Range = GetMissileRange();
|
||||
$SystemLimitMin = $CurrentSystem - $Range;
|
||||
if ($SystemLimitMin < 1) {
|
||||
$SystemLimitMin = 1;
|
||||
}
|
||||
$SystemLimitMax = $CurrentSystem + $Range;
|
||||
if ($System <= $SystemLimitMax) {
|
||||
if ($System >= $SystemLimitMin) {
|
||||
$MissileBtn = true;
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
|
||||
if ($GalaxyRowPlayer && $GalaxyRowPlanet["destruyed"] == 0) {
|
||||
if ($user["settings_esp"] == "1" &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=# onclick=\"javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", 1, ".$user["spio_anz"].");\" >";
|
||||
$Result .= "<img src=". $dpath ."img/e.gif alt=\"".$lang['gl_espionner']."\" title=\"".$lang['gl_espionner']."\" border=0></a>";
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_wri"] == "1" &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=messages.php?mode=write&id=".$GalaxyRowPlayer["id"].">";
|
||||
$Result .= "<img src=". $dpath ."img/m.gif alt=\"".$lang['gl_sendmess']."\" title=\"".$lang['gl_sendmess']."\" border=0></a>";
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_bud"] == "1" &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=buddy.php?a=2&u=".$GalaxyRowPlayer['id']." >";
|
||||
$Result .= "<img src=". $dpath ."img/b.gif alt=\"".$lang['gl_buddyreq']."\" title=\"".$lang['gl_buddyreq']."\" border=0></a>";
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_mis"] == "1" AND
|
||||
$MissileBtn == true &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=galaxy.php?mode=2&galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."¤t=".$user['current_planet']." >";
|
||||
$Result .= "<img src=". $dpath ."img/r.gif alt=\"".$lang['gl_mipattack']."\" title=\"".$lang['gl_mipattack']."\" border=0></a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
92
includes/functions/GalaxyRowAlly.php
Normal file
92
includes/functions/GalaxyRowAlly.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?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 $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowAlly ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user;
|
||||
|
||||
// Alliances
|
||||
$Result = "<th width=80>";
|
||||
if ($GalaxyRowUser['ally_id'] && $GalaxyRowUser['ally_id'] != 0) {
|
||||
$allyquery = doquery("SELECT * FROM {{table}} WHERE id=" . $GalaxyRowUser['ally_id'], "alliance", true);
|
||||
if ($allyquery) {
|
||||
$members_count = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE ally_id=" . $allyquery['id'] . ";", "users", true);
|
||||
|
||||
if ($members_count[0] > 1) {
|
||||
$add = "s";
|
||||
} else {
|
||||
$add = "";
|
||||
}
|
||||
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c>".$lang['Alliance']." ". $allyquery['ally_name'] ." ".$lang['gl_with']." ". $members_count[0] ." ". $lang['gl_membre'] . $add ."</td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "<th>";
|
||||
$Result .= "<table>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td><a href=alliance.php?mode=ainfo&a=". $allyquery['id'] .">".$lang['gl_ally_internal']."</a></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td><a href=stat.php?start=101&who=ally>".$lang['gl_stats']."</a></td>";
|
||||
if ($allyquery["ally_web"] != "") {
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td><a href=". $allyquery["ally_web"] ." target=_new>".$lang['gl_ally_web']."</td>";
|
||||
}
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "</th>";
|
||||
$Result .= "</table>\"";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
if ($user['ally_id'] == $GalaxyRowPlayer['ally_id']) {
|
||||
$Result .= "<span class=\"allymember\">". $allyquery['ally_tag'] ."</span></a>";
|
||||
} else {
|
||||
$Result .= $allyquery['ally_tag'] ."</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
105
includes/functions/GalaxyRowDebris.php
Normal file
105
includes/functions/GalaxyRowDebris.php
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<?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 $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowDebris ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $dpath, $CurrentRC, $user, $pricelist;
|
||||
// Cdr
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=30>";
|
||||
if ($GalaxyRow) {
|
||||
if ($GalaxyRow["metal"] != 0 || $GalaxyRow["crystal"] != 0) {
|
||||
$RecNeeded = ceil(($GalaxyRow["metal"] + $GalaxyRow["crystal"]) / $pricelist[209]['capacity']);
|
||||
if ($RecNeeded < $CurrentRC) {
|
||||
$RecSended = $RecNeeded;
|
||||
} elseif ($RecNeeded >= $CurrentRC) {
|
||||
$RecSended = $CurrentRC;
|
||||
} else {
|
||||
$RecSended = $RecyclerCount;
|
||||
}
|
||||
$Result = "<th style=\"";
|
||||
if (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 10000000) {
|
||||
$Result .= "background-color: rgb(100, 0, 0);";
|
||||
} elseif (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 1000000) {
|
||||
$Result .= "background-color: rgb(100, 100, 0);";
|
||||
} elseif (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 100000) {
|
||||
$Result .= "background-color: rgb(0, 100, 0);";
|
||||
}
|
||||
$Result .= "background-image: none;\" width=30>";
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>";
|
||||
$Result .= $lang['Debris']." [".$Galaxy.":".$System.":".$Planet."]";
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th width=80>";
|
||||
$Result .= "<img src=". $dpath ."planeten/debris.jpg height=75 width=75 />";
|
||||
$Result .= "</th>";
|
||||
$Result .= "<th>";
|
||||
$Result .= "<table>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['gl_ressource']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th>".$lang['Metal']." </th><th>". number_format( $GalaxyRow['metal'], 0, '', '.') ."</th>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th>".$lang['Crystal']." </th><th>". number_format( $GalaxyRow['crystal'], 0, '', '.') ."</th>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['gl_action']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th colspan=2 align=left>";
|
||||
$Result .= "<a href= # onclick='javascript:doit (8, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$RecSended.");' >". $lang['type_mission'][8] ."</a>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "</th>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>\"";
|
||||
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
$Result .= "<img src=". $dpath ."planeten/debris.jpg height=22 width=22></a>";
|
||||
}
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
128
includes/functions/GalaxyRowMoon.php
Normal file
128
includes/functions/GalaxyRowMoon.php
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
<?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 $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowMoon ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user, $dpath, $HavePhalanx, $CurrentSystem, $CurrentGalaxy, $CanDestroy;
|
||||
|
||||
// Lune
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=30>";
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType6Link = "<a href=# onclick='javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$user["spio_anz"].");' >". $lang['type_mission'][6] ."</a><br /><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType6Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType1Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=1>". $lang['type_mission'][1] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType1Link = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType5Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=5>". $lang['type_mission'][5] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType5Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType4Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=4>". $lang['type_mission'][4] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType4Link = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
if ($CanDestroy > 0) {
|
||||
$MissionType9Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=9>". $lang['type_mission'][9] ."</a>";
|
||||
} else {
|
||||
$MissionType9Link = "";
|
||||
}
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType9Link = "";
|
||||
}
|
||||
|
||||
$MissionType3Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=3>". $lang['type_mission'][3] ."</a><br />";
|
||||
|
||||
if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0 && $GalaxyRow["id_luna"] != 0) {
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>";
|
||||
$Result .= $lang['Moon'].": ".$GalaxyRowPlanet["name"]." [".$Galaxy.":".$System.":".$Planet."]";
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th width=80>";
|
||||
$Result .= "<img src=". $dpath ."planeten/mond.jpg height=75 width=75 />";
|
||||
$Result .= "</th>";
|
||||
$Result .= "<th>";
|
||||
$Result .= "<table>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['caracters']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th>".$lang['diameter']."</th>";
|
||||
$Result .= "<th>". number_format($GalaxyRowPlanet['diameter'], 0, '', '.') ."</th>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th>".$lang['temperature']."</th><th>". number_format($GalaxyRowPlanet['temp_min'], 0, '', '.') ."</th>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['Actions']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th colspan=2 align=center>";
|
||||
$Result .= $MissionType6Link;
|
||||
$Result .= $MissionType3Link;
|
||||
$Result .= $MissionType4Link;
|
||||
$Result .= $MissionType1Link;
|
||||
$Result .= $MissionType5Link;
|
||||
$Result .= $MissionType9Link;
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "</th>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>\"";
|
||||
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
$Result .= "<img src=". $dpath ."planeten/small/s_mond.jpg height=22 width=22>";
|
||||
$Result .= "</a>";
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
133
includes/functions/GalaxyRowPlanet.php
Normal file
133
includes/functions/GalaxyRowPlanet.php
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?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 $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowPlanet ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $dpath, $user, $HavePhalanx, $CurrentSystem, $CurrentGalaxy;
|
||||
|
||||
// Planete (Image)
|
||||
$Result = "<th width=30>";
|
||||
|
||||
$GalaxyRowUser = doquery("SELECT * FROM {{table}} WHERE id='".$GalaxyRowPlanet['id_owner']."';", 'users', true);
|
||||
if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0 && $GalaxyRow["id_planet"] != 0) {
|
||||
if ($HavePhalanx <> 0) {
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
|
||||
$Range = GetPhalanxRange ( $HavePhalanx );
|
||||
if ($SystemLimitMin < 1) {
|
||||
$SystemLimitMin = 1;
|
||||
}
|
||||
$SystemLimitMax = $CurrentSystem + $Range;
|
||||
if ($System <= $SystemLimitMax) {
|
||||
if ($System >= $SystemLimitMin) {
|
||||
$PhalanxTypeLink = "<a href=# onclick=fenster('phalanx.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."') >".$lang['gl_phalanx']."</a><br />";
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType6Link = "<a href=# onclick='javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$user["spio_anz"].");' >". $lang['type_mission'][6] ."</a><br /><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType6Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType1Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=1>". $lang['type_mission'][1] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType1Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType5Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=5>". $lang['type_mission'][5] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType5Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType4Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=4>". $lang['type_mission'][4] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType4Link = "";
|
||||
}
|
||||
$MissionType3Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=3>". $lang['type_mission'][3] ."</a>";
|
||||
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>";
|
||||
$Result .= $lang['gl_planet'] ." ". stripslashes($GalaxyRowPlanet["name"]) ." [".$Galaxy.":".$System.":".$Planet."]";
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<th width=80>";
|
||||
$Result .= "<img src=". $dpath ."planeten/small/s_". $GalaxyRowPlanet["image"] .".jpg height=75 width=75 />";
|
||||
$Result .= "</th>";
|
||||
$Result .= "<th align=left>";
|
||||
$Result .= $MissionType6Link;
|
||||
$Result .= $PhalanxTypeLink;
|
||||
$Result .= $MissionType1Link;
|
||||
$Result .= $MissionType5Link;
|
||||
$Result .= $MissionType4Link;
|
||||
$Result .= $MissionType3Link;
|
||||
$Result .= "</th>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>\"";
|
||||
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
$Result .= "<img src=". $dpath ."planeten/small/s_". $GalaxyRowPlanet["image"] .".jpg height=30 width=30>";
|
||||
// $Result .= $GalaxyRowPlanet["name"];
|
||||
$Result .= "</a>";
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
102
includes/functions/GalaxyRowPlanetName.php
Normal file
102
includes/functions/GalaxyRowPlanetName.php
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
<?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 $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowPlanetName ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user, $HavePhalanx, $CurrentSystem, $CurrentGalaxy;
|
||||
|
||||
// Planete (Nom)
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=130>";
|
||||
|
||||
if ($GalaxyRowUser['ally_id'] == $user['ally_id'] AND
|
||||
$GalaxyRowUser['id'] != $user['id'] AND
|
||||
$user['ally_id'] != '') {
|
||||
$TextColor = "<font color=\"green\">";
|
||||
$EndColor = "</font>";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$TextColor = "<font color=\"red\">";
|
||||
$EndColor = "</font>";
|
||||
} else {
|
||||
$TextColor = '';
|
||||
$EndColor = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowPlanet['last_update'] > (time()-59 * 60) AND
|
||||
$GalaxyRowUser['id'] != $user['id']) {
|
||||
$Inactivity = pretty_time_hour(time() - $GalaxyRowPlanet['last_update']);
|
||||
}
|
||||
if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0) {
|
||||
if ($HavePhalanx <> 0) {
|
||||
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
|
||||
$Range = GetPhalanxRange ( $HavePhalanx );
|
||||
if ($CurrentGalaxy + $Range <= $CurrentSystem AND
|
||||
$CurrentSystem >= $CurrentGalaxy - $Range) {
|
||||
$PhalanxTypeLink = "<a href=# onclick=fenster('phalanx.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."') title=\"".$lang['gl_phalanx']."\">".$GalaxyRowPlanet['name']."</a><br />";
|
||||
} else {
|
||||
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
|
||||
}
|
||||
|
||||
$Result .= $TextColor . $PhalanxTypeLink . $EndColor;
|
||||
|
||||
if ($GalaxyRowPlanet['last_update'] > (time()-59 * 60) AND
|
||||
$GalaxyRowUser['id'] != $user['id']) {
|
||||
if ($GalaxyRowPlanet['last_update'] > (time()-10 * 60) AND
|
||||
$GalaxyRowUser['id'] != $user['id']) {
|
||||
$Result .= "(*)";
|
||||
} else {
|
||||
$Result .= " (".$Inactivity.")";
|
||||
}
|
||||
}
|
||||
} elseif ($GalaxyRowPlanet["destruyed"] != 0) {
|
||||
$Result .= $lang['gl_destroyedplanet'];
|
||||
}
|
||||
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
50
includes/functions/GalaxyRowPos.php
Normal file
50
includes/functions/GalaxyRowPos.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?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 $Planet
|
||||
* @param unknown_type $GalaxyRow
|
||||
*/
|
||||
function GalaxyRowPos ( $Planet, $GalaxyRow ) {
|
||||
// Pos
|
||||
$Result = "<th width=30>";
|
||||
$Result .= "<a href=\"#\"";
|
||||
if ($GalaxyRow) {
|
||||
$Result .= " tabindex=\"". ($Planet + 1) ."\"";
|
||||
}
|
||||
$Result .= ">". $Planet ."</a>";
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
141
includes/functions/GalaxyRowUser.php
Normal file
141
includes/functions/GalaxyRowUser.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<?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 $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowUser ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user;
|
||||
|
||||
// Joueur
|
||||
$Result = "<th width=150>";
|
||||
if ($GalaxyRowUser && $GalaxyRowPlanet["destruyed"] == 0) {
|
||||
$NoobProt = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotection';", 'config', true);
|
||||
$NoobTime = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotectiontime';", 'config', true);
|
||||
$NoobMulti = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotectionmulti';", 'config', true);
|
||||
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $user['id'] ."';", 'statpoints', true);
|
||||
$User2Points = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $GalaxyRowUser['id'] ."';", 'statpoints', true);
|
||||
$CurrentPoints = $UserPoints['total_points'];
|
||||
$RowUserPoints = $User2Points['total_points'];
|
||||
$CurrentLevel = $CurrentPoints * $NoobMulti['config_value'];
|
||||
$RowUserLevel = $RowUserPoints * $NoobMulti['config_value'];
|
||||
if ($GalaxyRowUser['bana'] == 1 AND
|
||||
$GalaxyRowUser['urlaubs_modus'] == 1) {
|
||||
$Systemtatus2 = $lang['vacation_shortcut']." <a href=\"banned.php\"><span class=\"banned\">".$lang['banned_shortcut']."</span></a>";
|
||||
$Systemtatus = "<span class=\"vacation\">";
|
||||
} elseif ($GalaxyRowUser['bana'] == 1) {
|
||||
$Systemtatus2 = "<a href=\"banned.php\"><span class=\"banned\">".$lang['banned_shortcut']."</span></a>";
|
||||
$Systemtatus = "";
|
||||
} elseif ($GalaxyRowUser['urlaubs_modus'] == 1) {
|
||||
$Systemtatus2 = "<span class=\"vacation\">".$lang['vacation_shortcut']."</span>";
|
||||
$Systemtatus = "<span class=\"vacation\">";
|
||||
} elseif ($GalaxyRowUser['onlinetime'] < (time()-60 * 60 * 24 * 7) AND
|
||||
$GalaxyRowUser['onlinetime'] > (time()-60 * 60 * 24 * 28)) {
|
||||
$Systemtatus2 = "<span class=\"inactive\">".$lang['inactif_7_shortcut']."</span>";
|
||||
$Systemtatus = "<span class=\"inactive\">";
|
||||
} elseif ($GalaxyRowUser['onlinetime'] < (time()-60 * 60 * 24 * 28)) {
|
||||
$Systemtatus2 = "<span class=\"inactive\">".$lang['inactif_7_shortcut']."</span><span class=\"longinactive\"> ".$lang['inactif_28_shortcut']."</span>";
|
||||
$Systemtatus = "<span class=\"longinactive\">";
|
||||
} elseif ($RowUserLevel < $CurrentPoints AND
|
||||
$NoobProt['config_value'] == 1 AND
|
||||
$NoobTime['config_value'] * 1000 > $RowUserPoints) {
|
||||
$Systemtatus2 = "<span class=\"noob\">".$lang['weak_player_shortcut']."</span>";
|
||||
$Systemtatus = "<span class=\"noob\">";
|
||||
} elseif ($RowUserPoints > $CurrentLevel AND
|
||||
$NoobProt['config_value'] == 1 AND
|
||||
$NoobTime['config_value'] * 1000 > $CurrentPoints) {
|
||||
$Systemtatus2 = $lang['strong_player_shortcut'];
|
||||
$Systemtatus = "<span class=\"strong\">";
|
||||
} else {
|
||||
$Systemtatus2 = "";
|
||||
$Systemtatus = "";
|
||||
}
|
||||
$Systemtatus4 = $User2Points['total_rank'];
|
||||
if ($Systemtatus2 != '') {
|
||||
$Systemtatus6 = "<font color=\"white\">(</font>";
|
||||
$Systemtatus7 = "<font color=\"white\">)</font>";
|
||||
}
|
||||
if ($Systemtatus2 == '') {
|
||||
$Systemtatus6 = "";
|
||||
$Systemtatus7 = "";
|
||||
}
|
||||
$admin = "";
|
||||
if ($GalaxyRowUser['authlevel'] == LEVEL_ADMIN) {
|
||||
$admin = "<font color=\"red\"><blink>A</blink></font>";
|
||||
} else if ($GalaxyRowUser['authlevel'] == LEVEL_OPERATOR) {
|
||||
$admin = "<font color=\"lime\"><blink>O</blink></font>";
|
||||
} else if ($GalaxyRowUser['authlevel'] == LEVEL_MODERATOR) {
|
||||
$admin = "<font color=\"skyblue\"><blink>M</blink></font>";
|
||||
}
|
||||
$Systemtart = $User2Points['total_rank'];
|
||||
if (strlen($Systemtart) < 3) {
|
||||
$Systemtart = 1;
|
||||
} else {
|
||||
$Systemtart = (floor( $User2Points['total_rank'] / 100 ) * 100) + 1;
|
||||
}
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=190>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['Player']." ".$GalaxyRowUser['username']." ".$lang['Place']." ".$Systemtatus4."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$Result .= "<td><a href=messages.php?mode=write&id=".$GalaxyRowUser['id'].">".$lang['gl_sendmess']."</a></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td><a href=buddy.php?a=2&u=".$GalaxyRowUser['id'].">".$lang['gl_buddyreq']."</a></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
}
|
||||
$Result .= "<td><a href=stat.php?who=player&start=".$Systemtart.">".$lang['gl_stats']."</a></td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>\"";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
$Result .= $Systemtatus;
|
||||
$Result .= $GalaxyRowUser["username"]."</span>";
|
||||
$Result .= $Systemtatus6;
|
||||
$Result .= $Systemtatus;
|
||||
$Result .= $Systemtatus2;
|
||||
$Result .= $Systemtatus7." ".$admin;
|
||||
$Result .= "</span></a>";
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
64
includes/functions/GetBuildingPrice.php
Normal file
64
includes/functions/GetBuildingPrice.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?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
|
||||
* @param unknown_type $Element
|
||||
* @param unknown_type $Incremental
|
||||
* @param unknown_type $ForDestroy
|
||||
*/
|
||||
function GetBuildingPrice ($CurrentUser, $CurrentPlanet, $Element, $Incremental = true, $ForDestroy = false) {
|
||||
global $pricelist, $resource;
|
||||
|
||||
if ($Incremental) {
|
||||
$level = ($CurrentPlanet[$resource[$Element]]) ? $CurrentPlanet[$resource[$Element]] : $CurrentUser[$resource[$Element]];
|
||||
}
|
||||
|
||||
$array = array('metal', 'crystal', 'deuterium', 'energy_max');
|
||||
foreach ($array as $ResType) {
|
||||
if ($Incremental) {
|
||||
$cost[$ResType] = floor($pricelist[$Element][$ResType] * pow($pricelist[$Element]['factor'], $level));
|
||||
} else {
|
||||
$cost[$ResType] = floor($pricelist[$Element][$ResType]);
|
||||
}
|
||||
|
||||
if ($ForDestroy == true) {
|
||||
$cost[$ResType] = floor($cost[$ResType]) / 2;
|
||||
$cost[$ResType] /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
return $cost;
|
||||
}
|
||||
|
||||
?>
|
||||
86
includes/functions/GetBuildingTime.php
Normal file
86
includes/functions/GetBuildingTime.php
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<?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 $user
|
||||
* @param unknown_type $planet
|
||||
* @param unknown_type $Element
|
||||
*/
|
||||
function GetBuildingTime ($user, $planet, $Element) {
|
||||
global $pricelist, $resource, $reslist, $gameConfig;
|
||||
|
||||
|
||||
$level = ($planet[$resource[$Element]]) ? $planet[$resource[$Element]] : $user[$resource[$Element]];
|
||||
if (in_array($Element, $reslist['build'])) {
|
||||
// Pour un batiment ...
|
||||
$cost_metal = floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $level));
|
||||
$cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
|
||||
$time = ((($cost_crystal) + ($cost_metal)) / $gameConfig['game_speed']) * (1 / ($planet[$resource['14']] + 1)) * pow(0.5, $planet[$resource['15']]);
|
||||
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_constructeur']) * 0.1)));
|
||||
} elseif (in_array($Element, $reslist['tech'])) {
|
||||
// Pour une recherche
|
||||
$cost_metal = floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $level));
|
||||
$cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
|
||||
$intergal_lab = $user[$resource[123]];
|
||||
if ( $intergal_lab < "1" ) {
|
||||
$lablevel = $planet[$resource['31']];
|
||||
} elseif ( $intergal_lab >= "1" ) {
|
||||
$empire = doquery("SELECT * FROM {{table}} WHERE id_owner='". $user[id] ."';", 'planets');
|
||||
$NbLabs = 0;
|
||||
while ($colonie = mysql_fetch_array($empire)) {
|
||||
$techlevel[$NbLabs] = $colonie[$resource['31']];
|
||||
$NbLabs++;
|
||||
}
|
||||
if ($intergal_lab >= "1") {
|
||||
$lablevel = 0;
|
||||
for ($lab = 1; $lab <= $intergal_lab; $lab++) {
|
||||
asort($techlevel);
|
||||
$lablevel += $techlevel[$lab - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$time = (($cost_metal + $cost_crystal) / $gameConfig['game_speed']) / (($lablevel + 1) * 2);
|
||||
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_scientifique']) * 0.1)));
|
||||
} elseif (in_array($Element, $reslist['defense'])) {
|
||||
// Pour les defenses ou la flotte 'tarif fixe' durée adaptée a u niveau nanite et usine robot
|
||||
$time = (($pricelist[$Element]['metal'] + $pricelist[$Element]['crystal']) / $gameConfig['game_speed']) * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
|
||||
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_defenseur']) * 0.375)));
|
||||
} elseif (in_array($Element, $reslist['fleet'])) {
|
||||
$time = (($pricelist[$Element]['metal'] + $pricelist[$Element]['crystal']) / $gameConfig['game_speed']) * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
|
||||
$time = floor(($time * 60 * 60) * (1 - ($user['rpg_technocrate'] * 0.05)));
|
||||
}
|
||||
|
||||
|
||||
return max(1, $time);
|
||||
}
|
||||
|
||||
?>
|
||||
87
includes/functions/GetBuildingTimeLevel.php
Normal file
87
includes/functions/GetBuildingTimeLevel.php
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<?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 $user
|
||||
* @param unknown_type $planet
|
||||
* @param unknown_type $Element
|
||||
* @param unknown_type $level
|
||||
*/
|
||||
function GetBuildingTimeLevel ($user, $planet, $Element, $level) {
|
||||
global $pricelist, $resource, $reslist, $gameConfig;
|
||||
|
||||
$level -= 1;
|
||||
|
||||
if (in_array($Element, $reslist['build'])) {
|
||||
// Pour un batiment ...
|
||||
$cost_metal = floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $level));
|
||||
$cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
|
||||
$time = ((($cost_crystal) + ($cost_metal)) / $gameConfig['game_speed']) * (1 / ($planet[$resource['14']] + 1)) * pow(0.5, $planet[$resource['15']]);
|
||||
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_constructeur']) * 0.1)));
|
||||
} elseif (in_array($Element, $reslist['tech'])) {
|
||||
// Pour une recherche
|
||||
$cost_metal = floor($pricelist[$Element]['metal'] * pow($pricelist[$Element]['factor'], $level));
|
||||
$cost_crystal = floor($pricelist[$Element]['crystal'] * pow($pricelist[$Element]['factor'], $level));
|
||||
$intergal_lab = $user[$resource[123]];
|
||||
if ( $intergal_lab < "1" ) {
|
||||
$lablevel = $planet[$resource['31']];
|
||||
} elseif ( $intergal_lab >= "1" ) {
|
||||
$empire = doquery("SELECT * FROM {{table}} WHERE id_owner='". $user[id] ."';", 'planets');
|
||||
$NbLabs = 0;
|
||||
while ($colonie = mysql_fetch_array($empire)) {
|
||||
$techlevel[$NbLabs] = $colonie[$resource['31']];
|
||||
$NbLabs++;
|
||||
}
|
||||
if ($intergal_lab >= "1") {
|
||||
$lablevel = 0;
|
||||
for ($lab = 1; $lab <= $intergal_lab; $lab++) {
|
||||
asort($techlevel);
|
||||
$lablevel += $techlevel[$lab - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
$time = (($cost_metal + $cost_crystal) / $gameConfig['game_speed']) / (($lablevel + 1) * 2);
|
||||
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_scientifique']) * 0.1)));
|
||||
} elseif (in_array($Element, $reslist['defense'])) {
|
||||
// Pour les defenses ou la flotte 'tarif fixe' dur<75>e adapt<70>e a u niveau nanite et usine robot
|
||||
$time = (($pricelist[$Element]['metal'] + $pricelist[$Element]['crystal']) / $gameConfig['game_speed']) * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
|
||||
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_defenseur']) * 0.375)));
|
||||
} elseif (in_array($Element, $reslist['fleet'])) {
|
||||
$time = (($pricelist[$Element]['metal'] + $pricelist[$Element]['crystal']) / $gameConfig['game_speed']) * (1 / ($planet[$resource['21']] + 1)) * pow(1 / 2, $planet[$resource['15']]);
|
||||
$time = floor(($time * 60 * 60) * (1 - (($user['rpg_technocrate']) * 0.05)));
|
||||
}
|
||||
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
?>
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue