Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
61abbb3900
commit
3fd8832b45
138 changed files with 2597 additions and 1253 deletions
|
|
@ -44,7 +44,7 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
|
|||
$AllActivPlanet = doquery("SELECT * FROM {{table}} WHERE `last_update` >= '". (time()-15 * 60) ."' ORDER BY `id` ASC", 'planets');
|
||||
$Count = 0;
|
||||
|
||||
while ($ActivPlanet = mysql_fetch_array($AllActivPlanet)) {
|
||||
while ($ActivPlanet = $AllActivPlanet->fetch(PDO::FETCH_BOTH)) {
|
||||
$parse['online_list'] .= "<tr>";
|
||||
$parse['online_list'] .= "<td class=b><center><b>". $ActivPlanet['name'] ."</b></center></td>";
|
||||
$parse['online_list'] .= "<td class=b><center><b>[". $ActivPlanet['galaxy'] .":". $ActivPlanet['system'] .":". $ActivPlanet['planet'] ."]</b></center></td>";
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ $parse = $lang;
|
|||
// Affichage des messages
|
||||
$query = doquery("SELECT * FROM {{table}} ORDER BY messageid DESC LIMIT 25", 'chat');
|
||||
$i = 0;
|
||||
while ($e = mysql_fetch_array($query)) {
|
||||
while ($e = $query->fetch(PDO::FETCH_BOTH)) {
|
||||
$i++;
|
||||
$parse['msg_list'] .= stripslashes("<tr><th class=b>" . date('h:i:s', $e['timestamp']) . "</th>".
|
||||
"<th class=b>". $e['user'] . "</th>".
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ $parse = $lang;
|
|||
// Afficher les erreurs
|
||||
$query = doquery("SELECT * FROM {{table}}", 'errors');
|
||||
$i = 0;
|
||||
while ($u = mysql_fetch_array($query)) {
|
||||
while ($u = $query->fetch(PDO::FETCH_BOTH)) {
|
||||
$i++;
|
||||
$parse['errors_list'] .= "
|
||||
<tr><td width=\"25\" class=n>". $u['error_id'] ."</td>
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
|
|||
|
||||
$StartRec = 1 + (($ViewPage - 1) * 25);
|
||||
$Messages = doquery("SELECT * FROM {{table}} WHERE `message_type` = '". $Selected ."' ORDER BY `message_time` DESC LIMIT ". $StartRec .",25;", 'messages');
|
||||
while ($row = mysql_fetch_assoc($Messages)) {
|
||||
while ($row = $Messages->fetch(PDO::FETCH_ASSOC)) {
|
||||
$OwnerData = doquery ("SELECT `username` FROM {{table}} WHERE `id` = '". $row['message_owner'] ."';", 'users',true);
|
||||
$bloc['mlst_id'] = $row['message_id'];
|
||||
$bloc['mlst_from'] = $row['message_from'];
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
|
|||
$From = "<font color=\"". $kolor ."\">". $ranga ." ".$user['username']."</font>";
|
||||
$Subject = "<font color=\"". $kolor ."\">". $gameConfig['temat'] ."</font>";
|
||||
$Message = "<font color=\"". $kolor ."\"><b>". $gameConfig['tresc'] ."</b></font>";
|
||||
while ($u = mysql_fetch_array($sq)) {
|
||||
while ($u = $sq->fetch(PDO::FETCH_BOTH)) {
|
||||
SendSimpleMessage ( $u['id'], $user['id'], $Time, 97, $From, $Subject, $Message);
|
||||
}
|
||||
message("<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>", "Complete", "../overview." . PHPEXT, 3);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
|
|||
$parse = $lang;
|
||||
$query = doquery("SELECT * FROM {{table}} WHERE planet_type='3'", "planets");
|
||||
$i = 0;
|
||||
while ($u = mysql_fetch_array($query)) {
|
||||
while ($u = $query->fetch(PDO::FETCH_BOTH)) {
|
||||
$parse['moon'] .= "<tr>"
|
||||
. "<td class=b><center><b>" . $u[0] . "</center></b></td>"
|
||||
. "<td class=b><center><b>" . $u[1] . "</center></b></td>"
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
|
|||
$RowsTPL = gettemplate('admin/multi_rows');
|
||||
$PageTPL = gettemplate('admin/multi_body');
|
||||
|
||||
while ($infos = mysql_fetch_assoc($query)) {
|
||||
while ($infos = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$Bloc['player'] = $infos['player'];
|
||||
$Bloc['text'] = $infos['text'];
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ require_once dirname(dirname(__FILE__)) .'/common.php';
|
|||
$parse = $lang;
|
||||
$query = doquery("SELECT * FROM {{table}} WHERE planet_type='1'", "planets");
|
||||
$i = 0;
|
||||
while ($u = mysql_fetch_array($query)) {
|
||||
while ($u = $query->fetch(PDO::FETCH_BOTH)) {
|
||||
$parse['planetes'] .= "<tr>"
|
||||
. "<td class=b><center><b>" . $u[0] . "</center></b></td>"
|
||||
. "<td class=b><center><b>" . $u[1] . "</center></b></td>"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
|
||||
$GameUsers = doquery("SELECT * FROM {{table}} WHERE authlevel<3", 'users');
|
||||
|
||||
while ($CurUser = mysql_fetch_assoc($GameUsers)) {
|
||||
while ($CurUser = $GameUsers->fetch(PDO::FETCH_ASSOC)) {
|
||||
// Recuperation des anciennes statistiques
|
||||
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';",'statpoints');
|
||||
if ($OldStatRecord) {
|
||||
|
|
@ -190,7 +190,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
|||
// Statistiques des alliances ...
|
||||
$GameAllys = doquery("SELECT * FROM {{table}}", 'alliance');
|
||||
|
||||
while ($CurAlly = mysql_fetch_assoc($GameAllys)) {
|
||||
while ($CurAlly = $GameAllys->fetch(PDO::FETCH_ASSOC)) {
|
||||
// Recuperation des anciennes statistiques
|
||||
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints');
|
||||
if ($OldStatRecord) {
|
||||
|
|
|
|||
12
alliance.php
12
alliance.php
|
|
@ -222,7 +222,7 @@ if ($user['ally_id'] == 0) { // Sin alianza
|
|||
if (mysql_num_rows($search) != 0) {
|
||||
$template = gettemplate('alliance_searchresult_row');
|
||||
|
||||
while ($s = mysql_fetch_array($search)) {
|
||||
while ($s = $search->fetch(PDO::FETCH_BOTH)) {
|
||||
$entry = array();
|
||||
$entry['ally_tag'] = "[<a href=\"alliance.php?mode=apply&allyid={$s['id']}\">{$s['ally_tag']}</a>]";
|
||||
$entry['ally_name'] = $s['ally_name'];
|
||||
|
|
@ -428,7 +428,7 @@ elseif ($user['ally_id'] != 0 && $user['ally_request'] == 0) { // Con alianza
|
|||
// Como es costumbre. un row template
|
||||
$template = gettemplate('alliance_memberslist_row');
|
||||
$page_list = '';
|
||||
while ($u = mysql_fetch_array($listuser)) {
|
||||
while ($u = $listuser->fetch(PDO::FETCH_BOTH)) {
|
||||
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $u['id'] . "';", 'statpoints', true);
|
||||
|
||||
$i++;
|
||||
|
|
@ -506,7 +506,7 @@ elseif ($user['ally_id'] != 0 && $user['ally_request'] == 0) { // Con alianza
|
|||
}
|
||||
// looooooop
|
||||
$list = '';
|
||||
while ($u = mysql_fetch_array($sq)) {
|
||||
while ($u = $sq->fetch(PDO::FETCH_BOTH)) {
|
||||
doquery("INSERT INTO {{table}} SET
|
||||
`message_owner`='{$u['id']}',
|
||||
`message_sender`='{$user['id']}' ,
|
||||
|
|
@ -802,7 +802,7 @@ elseif ($user['ally_id'] != 0 && $user['ally_request'] == 0) { // Con alianza
|
|||
} else {
|
||||
$selection=doquery("SELECT * FROM {{table}} where ally_id='".$user['ally_id']."'",'users');
|
||||
$select='';
|
||||
while($data=mysql_fetch_array($selection)){
|
||||
while ($data = $selection->fetch(PDO::FETCH_BOTH)){
|
||||
$select.='<OPTION VALUE="'.$data['id'].'">'.$data['username'];
|
||||
}
|
||||
$page .= '<br><form method="post" action="alliance.php?mode=admin&edit=give"><table width="600" border="0" cellpadding="0" cellspacing="1" ALIGN="center">';
|
||||
|
|
@ -879,7 +879,7 @@ while($data=mysql_fetch_array($selection)){
|
|||
$page_list = '';
|
||||
$lang['memberzahl'] = mysql_num_rows($listuser);
|
||||
|
||||
while ($u = mysql_fetch_array($listuser)) {
|
||||
while ($u = $listuser->fetch(PDO::FETCH_BOTH)) {
|
||||
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $u['id'] . "';", 'statpoints', true);
|
||||
$i++;
|
||||
$u['i'] = $i;
|
||||
|
|
@ -1017,7 +1017,7 @@ while($data=mysql_fetch_array($selection)){
|
|||
$i = 0;
|
||||
$parse = $lang;
|
||||
$query = doquery("SELECT id,username,ally_request_text,ally_register_time FROM {{table}} WHERE ally_request='{$ally['id']}'", 'users');
|
||||
while ($r = mysql_fetch_array($query)) {
|
||||
while ($r = $query->fetch(PDO::FETCH_BOTH)) {
|
||||
// recolectamos los datos del que se eligio.
|
||||
if (isset($show) && $r['id'] == $show) {
|
||||
$s['username'] = $r['username'];
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ if ($action == 5) {
|
|||
$cristalsouhait = $_POST['cristalsouhait'];
|
||||
$deutsouhait = $_POST['deutsouhait'];
|
||||
|
||||
while ($v_annonce = mysql_fetch_array($users)) {
|
||||
while ($v_annonce = $users->fetch(PDO::FETCH_BOTH)) {
|
||||
$user = $v_annonce['username'];
|
||||
$galaxie = $v_annonce['galaxy'];
|
||||
$systeme = $v_annonce['system'];
|
||||
|
|
@ -87,7 +87,7 @@ if ($action != 5) {
|
|||
|
||||
|
||||
";
|
||||
while ($b = mysql_fetch_array($annonce)) {
|
||||
while ($b = $annonce->fetch(PDO::FETCH_BOTH)) {
|
||||
$page2 .= '<tr><th> ';
|
||||
$page2 .= $b["user"] ;
|
||||
$page2 .= '</th><th>';
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ $parse['mf'] = $mf;
|
|||
|
||||
$query = doquery("SELECT * FROM {{table}} ORDER BY `id`;",'banned');
|
||||
$i=0;
|
||||
while($u = mysql_fetch_array($query)){
|
||||
while ($u = $query->fetch(PDO::FETCH_BOTH)){
|
||||
$parse['banned'] .=
|
||||
"<tr><td class=b><center><b>".$u[1]."</center></td></b>".
|
||||
"<td class=b><center><b>".$u[2]."</center></b></td>".
|
||||
|
|
|
|||
34
common.php
34
common.php
|
|
@ -44,12 +44,12 @@ defined('APPLICATION_PATH') || define('APPLICATION_PATH', ROOT_PATH . 'includes'
|
|||
|
||||
defined('PHPEXT') || define('PHPEXT', require 'extension.inc');
|
||||
|
||||
defined('VERSION') || define('VERSION', '2009.5');
|
||||
defined('VERSION') || define('VERSION', '2011.1');
|
||||
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'core',
|
||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'community',
|
||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'local',
|
||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'community',
|
||||
APPLICATION_PATH . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'core',
|
||||
get_include_path()
|
||||
)));
|
||||
|
||||
|
|
@ -57,6 +57,8 @@ function __autoload($class) {
|
|||
include_once str_replace('_', '/', $class) . '.php';
|
||||
}
|
||||
|
||||
Legacies_Core_Error::register();
|
||||
|
||||
if (0 === filesize(ROOT_PATH . 'config.php')) {
|
||||
header('Location: install/');
|
||||
die();
|
||||
|
|
@ -84,10 +86,13 @@ include(ROOT_PATH . 'includes/unlocalised.' . PHPEXT);
|
|||
include(ROOT_PATH . 'includes/todofleetcontrol.' . PHPEXT);
|
||||
include(ROOT_PATH . 'language/' . DEFAULT_LANG . '/lang_info.cfg');
|
||||
include(ROOT_PATH . 'includes/vars.' . PHPEXT);
|
||||
include(ROOT_PATH . 'includes/db.' . PHPEXT);
|
||||
include(ROOT_PATH . 'db/mysql.' . PHPEXT);
|
||||
include(ROOT_PATH . 'includes/strings.' . PHPEXT);
|
||||
|
||||
$gameConfig = Legacies_Core_Model_Config::getSingleton();
|
||||
if (isset($gameConfig['cookie_name']) && !empty($gameConfig['cookie_name'])) {
|
||||
Legacies_Empire_Model_User::setCookieName($gameConfig['cookie_name']);
|
||||
}
|
||||
$user = Legacies_Empire_Model_User::getSingleton();
|
||||
|
||||
if (!defined('DISABLE_IDENTITY_CHECK')) {
|
||||
|
|
@ -110,31 +115,30 @@ include(ROOT_PATH . 'rak.php');
|
|||
$dpath = DEFAULT_SKINPATH;
|
||||
if (($user !== null && $user->getId())) {
|
||||
$dpath = $user->getSkinPath();
|
||||
|
||||
if (empty($dpath)) {
|
||||
$dpath = DEFAULT_SKINPATH;
|
||||
}
|
||||
|
||||
if (defined('IN_ADMIN')) {
|
||||
$dpath = '../' . $dpath;
|
||||
}
|
||||
SetSelectedPlanet($user); // FIXME
|
||||
|
||||
foreach ($user->getVisibleFleets() as $fleet) {
|
||||
FlyingFleetHandler($fleet); // FIXME
|
||||
if (isset($_GET['cp']) && !empty($_GET['cp'])) {
|
||||
$user->updateCurrentPlanet((int) $_GET['cp']);
|
||||
}
|
||||
|
||||
$planetrow = $user->getCurrentPlanet();
|
||||
$galaxyrow = doquery("SELECT * FROM {{table}} WHERE `id_planet` = '".$planetrow['id']."';", 'galaxy', true);
|
||||
foreach ($user->getPlanetCollection() as $planet) {
|
||||
FlyingFleetHandler($planet); // TODO: implement logic into a refactored model
|
||||
}
|
||||
|
||||
CheckPlanetUsedFields($planetrow); // FIXME
|
||||
$planet = $user->getCurrentPlanet();
|
||||
|
||||
/*
|
||||
* Update planet resources and constructions
|
||||
*/
|
||||
Legacies::dispatchEvent('planet.update', array(
|
||||
'planet' => $planetrow
|
||||
'planet' => $planet
|
||||
));
|
||||
$planetrow->save();
|
||||
} else {
|
||||
$planetrow = array();
|
||||
$galaxyrow = array();
|
||||
$planet->save();
|
||||
}
|
||||
49
db/mysql.php
49
db/mysql.php
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
/**
|
||||
* Tis file is part of XNova:Legacies
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
|
|
@ -28,38 +28,37 @@
|
|||
*
|
||||
*/
|
||||
|
||||
class Database
|
||||
{
|
||||
static $dbHandle = NULL;
|
||||
static $config = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @deprecated
|
||||
* @param string $query
|
||||
* @param string $table
|
||||
* @param bool $fetch
|
||||
*/
|
||||
function doquery($query, $table, $fetch = false)
|
||||
{
|
||||
if (!isset(Database::$config)) {
|
||||
$config = require dirname(dirname(__FILE__)) . '/config.php';
|
||||
}
|
||||
/**
|
||||
* @var Legacies_Database $database
|
||||
*/
|
||||
$database = Legacies_Database::getSingleton();
|
||||
|
||||
if(!isset(Database::$dbHandle))
|
||||
{
|
||||
Database::$dbHandle = mysql_connect(
|
||||
$config['global']['database']['options']['hostname'],
|
||||
$config['global']['database']['options']['username'],
|
||||
$config['global']['database']['options']['password'])
|
||||
or trigger_error(mysql_error() . "$query<br />" . PHP_EOL, E_USER_WARNING);
|
||||
$sql = str_replace("{{table}}", $database->getTable($table), $query);
|
||||
|
||||
mysql_select_db($config['global']['database']['options']['database'], Database::$dbHandle)
|
||||
or trigger_error(mysql_error()."$query<br />" . PHP_EOL, E_USER_WARNING);
|
||||
}
|
||||
$sql = str_replace("{{table}}", "{$config['global']['database']['table_prefix']}{$table}", $query);
|
||||
/**
|
||||
* @var PDOStatement $statement
|
||||
*/
|
||||
try {
|
||||
$statement = $database->prepare($sql);
|
||||
|
||||
if (false === ($sqlQuery = mysql_query($sql, Database::$dbHandle))) {
|
||||
trigger_error(mysql_error() . PHP_EOL . "<br /><pre></code>$sql<code></pre><br />" . PHP_EOL, E_USER_WARNING);
|
||||
$statement->execute(array());
|
||||
} catch (PDOException $e) {
|
||||
trigger_error($e->getMessage() . PHP_EOL . "<br /><pre></code>$sql<code></pre><br />" . PHP_EOL, E_USER_WARNING);
|
||||
}
|
||||
|
||||
if ($fetch) {
|
||||
return mysql_fetch_array($sqlQuery);
|
||||
return $statement->fetch(PDO::FETCH_BOTH);
|
||||
} else {
|
||||
return $sqlQuery;
|
||||
return $statement;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ require_once dirname(__FILE__) .'/common.php';
|
|||
$i = 0;
|
||||
|
||||
|
||||
while ($f = mysql_fetch_array($fq)) {
|
||||
while ($f = $fq->fetch(PDO::FETCH_BOTH)) {
|
||||
$i++;
|
||||
$page .= "<tr height=20>";
|
||||
// (01) Fleet ID
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ require_once dirname(__FILE__) .'/common.php';
|
|||
$i = 0;
|
||||
$w = 0;
|
||||
$tr = true;
|
||||
while ($row = mysql_fetch_array($kolonien)) {
|
||||
while ($row = $kolonien->fetch(PDO::FETCH_BOTH)) {
|
||||
if ($w == 0 && $tr) {
|
||||
$page .= "<tr height=\"20\">";
|
||||
$tr = false;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ require_once dirname(__FILE__) .'/common.php';
|
|||
$UsedPlanet = false;
|
||||
$select = doquery("SELECT * FROM {{table}}", "planets");
|
||||
|
||||
while ($row = mysql_fetch_array($select)) {
|
||||
while ($row = $select->fetch(PDO::FETCH_BOTH)) {
|
||||
if ($galaxy == $row['galaxy'] &&
|
||||
$system == $row['system'] &&
|
||||
$planet == $row['planet'] &&
|
||||
|
|
|
|||
|
|
@ -28,34 +28,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
$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 )
|
||||
);
|
||||
$CombatCaps = Legacies_Empire_Model_Game_Combat::getSingleton();
|
||||
|
||||
$AtFleet = array ( 203 => 2 );
|
||||
$AtTechn = array ( 109 => 3, 110 => 5, 111 => 3 );
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class Legacies_Core_Collection
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function _prepareSql()
|
||||
protected function _prepareSql()
|
||||
{
|
||||
if (empty($this->_union)) {
|
||||
$database = Legacies_Database::getSingleton();
|
||||
|
|
@ -172,8 +172,16 @@ class Legacies_Core_Collection
|
|||
$fields[] = $fieldName;
|
||||
}
|
||||
}
|
||||
if (!empty($fields)) {
|
||||
$fields = implode(", ", $fields);
|
||||
$where = implode(" AND ", $this->_where);
|
||||
} else {
|
||||
$fields = '*';
|
||||
}
|
||||
if (!empty($where)) {
|
||||
$where = 'WHERE ' . implode(" AND ", $this->_where);
|
||||
} else {
|
||||
$where = '';
|
||||
}
|
||||
$joinedTables = implode("\n ", $this->_join);
|
||||
|
||||
$order = '';
|
||||
|
|
@ -201,7 +209,7 @@ class Legacies_Core_Collection
|
|||
SELECT {$fields}
|
||||
FROM {$database->getTable($this->getTableName())}{$alias}
|
||||
{$joinedTables}
|
||||
WHERE $where
|
||||
{$where}
|
||||
{$group}
|
||||
{$order}
|
||||
{$limit}
|
||||
|
|
@ -213,6 +221,11 @@ SQL_EOF;
|
|||
}
|
||||
|
||||
$statements = '(' . implode(') UNION (', $statements) . ')';
|
||||
if (!empty($where)) {
|
||||
$where = 'WHERE ' . implode(" AND ", $this->_where);
|
||||
} else {
|
||||
$where = '';
|
||||
}
|
||||
$where = implode(" AND ", $this->_where);
|
||||
|
||||
$limit = '';
|
||||
|
|
@ -226,12 +239,17 @@ SQL_EOF;
|
|||
|
||||
return <<<SQL_EOF
|
||||
$statements
|
||||
WHERE $where
|
||||
{$where}
|
||||
{$limit}
|
||||
SQL_EOF;
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_prepareSql();
|
||||
}
|
||||
|
||||
protected function _load()
|
||||
{
|
||||
$sql = $this->_prepareSql();
|
||||
|
|
@ -245,8 +263,8 @@ SQL_EOF;
|
|||
$this->_items = array();
|
||||
$reflection = new ReflectionClass($this->getEntityClassName());
|
||||
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
|
||||
$args = array($row) + $args;
|
||||
$this->_items[] = $reflection->newInstanceArgs($args);
|
||||
$params = array_merge(array($row), $args);
|
||||
$this->_items[] = $reflection->newInstanceArgs($params);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
@ -282,12 +300,16 @@ SQL_EOF;
|
|||
|
||||
public function next()
|
||||
{
|
||||
return next($this->_items);
|
||||
next($this->_items);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
return reset($this->_items);
|
||||
reset($this->_items);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function key()
|
||||
|
|
@ -297,6 +319,6 @@ SQL_EOF;
|
|||
|
||||
public function valid()
|
||||
{
|
||||
return (key($this->_items) < (current($this->_items)));
|
||||
return current($this->_items) !== false;
|
||||
}
|
||||
}
|
||||
|
|
@ -45,11 +45,8 @@ abstract class Legacies_Core_Entity
|
|||
|
||||
protected function _load()
|
||||
{
|
||||
static $statement = null;
|
||||
|
||||
$id = func_get_arg(0);
|
||||
|
||||
if ($statement === null) {
|
||||
$idFieldName = self::getIdFieldName();
|
||||
$database = Legacies_Database::getSingleton();
|
||||
|
||||
|
|
@ -59,8 +56,6 @@ SELECT * FROM {$database->getTable(self::getTableName())}
|
|||
LIMIT 1
|
||||
SQL_EOF;
|
||||
$statement = $database->prepare($sql);
|
||||
}
|
||||
|
||||
$statement->execute(array(
|
||||
'id' => $id
|
||||
));
|
||||
|
|
@ -135,9 +130,6 @@ SQL_EOF;
|
|||
|
||||
protected function _delete()
|
||||
{
|
||||
static $statement = null;
|
||||
|
||||
if ($statement == null) {
|
||||
$fields = array();
|
||||
foreach ($this->getAllDatas() as $field => $value) {
|
||||
if ($field == self::getIdFieldName()) {
|
||||
|
|
@ -153,7 +145,6 @@ SQL_EOF;
|
|||
DELETE {$database->getTable(self::getTableName())}
|
||||
WHERE {$idFieldName}=:{$idFieldName}
|
||||
SQL_EOF;
|
||||
}
|
||||
|
||||
$statement->execute($this->getAllDatas());
|
||||
|
||||
|
|
|
|||
|
|
@ -96,8 +96,10 @@ SQL_EOF;
|
|||
$database = Legacies_Database::getSingleton();
|
||||
|
||||
$idFields = array();
|
||||
$idValues = array();
|
||||
foreach ($this->_idFieldNames as $field) {
|
||||
$idFields[] = "{$field}=:{$field}";
|
||||
$idValues[$field] = $this->getData($field);
|
||||
}
|
||||
$idFields = '(' . implode(') AND (', $idFields) . ')';
|
||||
|
||||
|
|
|
|||
163
includes/application/code/community/Legacies/Core/Error.php
Normal file
163
includes/application/code/community/Legacies/Core/Error.php
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Error
|
||||
{
|
||||
private static $_singleton = null;
|
||||
|
||||
protected $_errors = array();
|
||||
protected $_warnings = array();
|
||||
protected $_notices = array();
|
||||
protected $_otherErrors = array();
|
||||
protected $_exceptions = array();
|
||||
|
||||
public static function getSingleton()
|
||||
{
|
||||
if (self::$_singleton === null) {
|
||||
self::$_singleton = new self;
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
||||
public function errorManager($errno, $errstr, $errfile = null, $errline = null, Array $errcontext = array())
|
||||
{
|
||||
switch ($errno) {
|
||||
case E_USER_ERROR:
|
||||
case E_ERROR:
|
||||
$this->_errors[] = array(
|
||||
'time' => explode(' ', microtime()),
|
||||
'code' => $errno,
|
||||
'message' => $errstr,
|
||||
'file' => $errfile,
|
||||
'line' => $errline,
|
||||
'context' => $errcontext
|
||||
);
|
||||
break;
|
||||
|
||||
case E_USER_WARNING:
|
||||
case E_WARNING:
|
||||
$this->_warnings[] = array(
|
||||
'time' => explode(' ', microtime()),
|
||||
'code' => $errno,
|
||||
'message' => $errstr,
|
||||
'file' => $errfile,
|
||||
'line' => $errline,
|
||||
'context' => $errcontext
|
||||
);
|
||||
break;
|
||||
|
||||
case E_USER_NOTICE:
|
||||
case E_NOTICE:
|
||||
$this->_notices[] = array(
|
||||
'time' => explode(' ', microtime()),
|
||||
'code' => $errno,
|
||||
'message' => $errstr,
|
||||
'file' => $errfile,
|
||||
'line' => $errline,
|
||||
'context' => $errcontext
|
||||
);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!isset($this->_otherErrors[$errno])) {
|
||||
$this->_otherErrors[$errno] = array();
|
||||
}
|
||||
|
||||
$this->_otherErrors[$errno][] = array(
|
||||
'time' => explode(' ', microtime()),
|
||||
'code' => $errno,
|
||||
'message' => $errstr,
|
||||
'file' => $errfile,
|
||||
'line' => $errline,
|
||||
'context' => $errcontext
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function exceptionManager($exception)
|
||||
{
|
||||
$this->_exceptions[] = $exception;
|
||||
}
|
||||
|
||||
protected function _renderError($error)
|
||||
{
|
||||
$types = array(
|
||||
0x0001 => 'E_ERROR',
|
||||
0x0002 => 'E_WARNING',
|
||||
0x0004 => 'E_PARSE',
|
||||
0x0008 => 'E_NOTICE',
|
||||
0x0010 => 'E_CORE_ERROR',
|
||||
0x0020 => 'E_CORE_WARNING',
|
||||
0x0040 => 'E_COMPILE_ERROR',
|
||||
0x0080 => 'E_COMPILE_WARNING',
|
||||
0x0100 => 'E_USER_ERROR',
|
||||
0x0200 => 'E_USER_WARNING',
|
||||
0x0400 => 'E_USER_NOTICE',
|
||||
0x0800 => 'E_STRICT',
|
||||
0x1000 => 'E_RECOVERABLE_ERROR',
|
||||
0x2000 => 'E_DEPRECATED',
|
||||
0x4000 => 'E_USER_DEPRECATED',
|
||||
);
|
||||
|
||||
if (isset($types[$error['code']])) {
|
||||
$code = $types[$error['code']];
|
||||
} else {
|
||||
$code = "Unknown ({$error['code']})";
|
||||
}
|
||||
|
||||
$date = date('Y-m-d H:i:s', (int) $error['time'][1]);
|
||||
$microsec = (int) ($error['time'][0] * 1000000);
|
||||
|
||||
return <<<ERROR_EOF
|
||||
On: {$date} +{$microsec}µs
|
||||
Type: {$code}
|
||||
Message: {$error['message']}
|
||||
File: {$error['file']}
|
||||
Line: {$error['line']}
|
||||
\n
|
||||
ERROR_EOF;
|
||||
}
|
||||
|
||||
public function shutdownManager()
|
||||
{
|
||||
echo '<pre style="background:#FFF;border:1px solid #F00;color:#000;padding:10px;margin:20px;">';
|
||||
foreach ($this->_errors as $error) {
|
||||
echo $this->_renderError($error);
|
||||
}
|
||||
foreach ($this->_warnings as $error) {
|
||||
echo $this->_renderError($error);
|
||||
}
|
||||
foreach ($this->_notices as $error) {
|
||||
echo $this->_renderError($error);
|
||||
}
|
||||
foreach ($this->_otherErrors as $error) {
|
||||
echo $this->_renderError($error);
|
||||
}
|
||||
foreach ($this->_exceptions as $exception) {
|
||||
echo $exception->getMessage();
|
||||
echo $exception->getTraceAsString();
|
||||
}
|
||||
echo '</pre>';
|
||||
}
|
||||
|
||||
public static function register()
|
||||
{
|
||||
static $registered = false;
|
||||
|
||||
set_error_handler(array(self::getSingleton(), 'errorManager'));
|
||||
set_exception_handler(array(self::getSingleton(), 'exceptionManager'));
|
||||
|
||||
if ($registered === false && defined('DEBUG')) {
|
||||
$registered = true;
|
||||
register_shutdown_function(array(self::getSingleton(), 'shutdownManager'));
|
||||
}
|
||||
}
|
||||
|
||||
public static function unregister()
|
||||
{
|
||||
restore_error_handler();
|
||||
restore_exception_handler();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,444 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Core_Setup_Model_Updater_ScriptQueue
|
||||
implements Iterator, Countable, ArrayAccess
|
||||
{
|
||||
const PCRE_FILE_PATTERN = '%^(?<action>install|upgrade|uninstall|downgrade)-(?<version1>[0-9]+\.[0-9]+\.[0-9]+)(?:\.(?<stage1>[a-z]+)(?<level1>[0-9]+))?(?:-(?<version2>[0-9]+\.[0-9]+\.[0-9]+)(?:\.(?<stage2>[a-z]+)(?<level2>[0-9]+))?)?$%';
|
||||
const PCRE_VERSION_PATTERN = '%^(?<version>[0-9]+\.[0-9]+\.[0-9]+)(?:-(?<stage>[a-z]+)(?<level>[0-9]+)?)?$%';
|
||||
|
||||
const STAGE_ALPHA = 'alpha';
|
||||
const STAGE_BETA = 'beta';
|
||||
const STAGE_RC = 'rc';
|
||||
const STAGE_STABLE = 'stable';
|
||||
|
||||
const MODE_INSTALL = 'install';
|
||||
const MODE_UNINSTALL = 'uninstall';
|
||||
const MODE_UPGRADE = 'upgrade';
|
||||
const MODE_DOWNGRADE = 'downgrade';
|
||||
|
||||
const VERSION_NULL = '0.0.0';
|
||||
|
||||
protected $_installVersions = array();
|
||||
protected $_upgradeVersions = array();
|
||||
protected $_uninstallVersions = array();
|
||||
protected $_downgradeVersions = array();
|
||||
|
||||
protected $_finalVersion = null;
|
||||
|
||||
protected $_scripts = array();
|
||||
|
||||
public function __construct($path, $fromVersion = null, $toVersion = null)
|
||||
{
|
||||
try {
|
||||
$this->_analyzePath($path);
|
||||
} catch (Exception $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($fromVersion === null) {
|
||||
$fromVersion = '0.0.0';
|
||||
}
|
||||
|
||||
if ($toVersion === null) {
|
||||
$toVersion = '0.0.0';
|
||||
}
|
||||
|
||||
preg_match(self::PCRE_VERSION_PATTERN, $fromVersion, $matches);
|
||||
$fromVersion = array(
|
||||
'version' => isset($matches['version']) ? $matches['version'] : self::VERSION_NULL,
|
||||
'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE,
|
||||
'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0,
|
||||
);
|
||||
|
||||
preg_match(self::PCRE_VERSION_PATTERN, $toVersion, $matches);
|
||||
$toVersion = array(
|
||||
'version' => isset($matches['version']) ? $matches['version'] : self::VERSION_NULL,
|
||||
'stage' => isset($matches['stage']) && !empty($matches['stage']) ? $matches['stage'] : self::STAGE_STABLE,
|
||||
'level' => isset($matches['level']) && !empty($matches['level']) ? (int) $matches['level'] : 0,
|
||||
);
|
||||
|
||||
switch (version_compare($toVersion['version'], $fromVersion['version'])) {
|
||||
case 1:
|
||||
$this->_upgradeToVersion($fromVersion, $toVersion);
|
||||
break;
|
||||
|
||||
case -1:
|
||||
$this->_downgradeToVersion($fromVersion, $toVersion);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
if ($toVersion['stage'] === self::STAGE_STABLE) {
|
||||
if ($fromVersion['stage'] !== self::STAGE_STABLE) {
|
||||
$this->_upgradeToVersion($fromVersion, $toVersion);
|
||||
} else {
|
||||
$this->_downgradeToVersion($fromVersion, $toVersion);
|
||||
}
|
||||
} else if ($toVersion['stage'] === self::STAGE_RC) {
|
||||
if ($fromVersion['stage'] === self::STAGE_STABLE) {
|
||||
$this->_downgradeToVersion($fromVersion, $toVersion);
|
||||
} else if ($fromVersion['stage'] === self::STAGE_RC) {
|
||||
if ($fromVersion['level'] < $toVersion['level']) {
|
||||
$this->_upgradeToVersion($fromVersion, $toVersion);
|
||||
} else {
|
||||
// throw new RuntimeException("Version already installed.");
|
||||
}
|
||||
} else {
|
||||
$this->_upgradeToVersion($fromVersion, $toVersion);
|
||||
}
|
||||
} else if ($toVersion['stage'] === self::STAGE_BETA) {
|
||||
if (in_array($fromVersion['stage'], array(self::STAGE_STABLE, self::STAGE_RC))) {
|
||||
$this->_downgradeToVersion($fromVersion, $toVersion);
|
||||
} else if ($fromVersion['stage'] === self::STAGE_BETA) {
|
||||
if ($fromVersion['level'] < $toVersion['level']) {
|
||||
$this->_upgradeToVersion($fromVersion, $toVersion);
|
||||
} else {
|
||||
// throw new RuntimeException("Version already installed.");
|
||||
}
|
||||
} else {
|
||||
$this->_upgradeToVersion($fromVersion, $toVersion);
|
||||
}
|
||||
} else if ($toVersion['stage'] === self::STAGE_ALPHA) {
|
||||
if (in_array($fromVersion['stage'], array(self::STAGE_STABLE, self::STAGE_RC, self::STAGE_BETA))) {
|
||||
$this->_downgradeToVersion($fromVersion, $toVersion);
|
||||
} else if ($fromVersion['stage'] === self::STAGE_ALPHA) {
|
||||
if ($fromVersion['level'] < $toVersion['level']) {
|
||||
$this->_upgradeToVersion($fromVersion, $toVersion);
|
||||
} else {
|
||||
// throw new RuntimeException("Version already installed.");
|
||||
}
|
||||
} else {
|
||||
$this->_upgradeToVersion($fromVersion, $toVersion);
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Invalid version stage.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFinalVersion()
|
||||
{
|
||||
return $this->_finalVersion;
|
||||
}
|
||||
|
||||
protected function _installHighestInstaller($currentVersion, $toVersion)
|
||||
{
|
||||
$highestVersion = self::VERSION_NULL;
|
||||
foreach (array_keys($this->_installVersions) as $version) {
|
||||
if (version_compare($version, $highestVersion, '>') && version_compare($version, $toVersion['version'], '<=')) {
|
||||
$highestVersion = $version;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->_installVersions[$highestVersion][self::STAGE_STABLE][0])) {
|
||||
$version = array(
|
||||
'version' => $highestVersion,
|
||||
'stage' => self::STAGE_STABLE,
|
||||
'level' => 0,
|
||||
);
|
||||
$this->enqueue(array($version, $this->_installVersions[$highestVersion][self::STAGE_STABLE][0]));
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
if (isset($this->_installVersions[$highestVersion][self::STAGE_RC])) {
|
||||
$stage = self::STAGE_RC;
|
||||
} else if (isset($this->_installVersions[$highestVersion][self::STAGE_BETA])) {
|
||||
$stage = self::STAGE_BETA;
|
||||
} else if (isset($this->_installVersions[$highestVersion][self::STAGE_ALPHA])) {
|
||||
$stage = self::STAGE_ALPHA;
|
||||
} else {
|
||||
throw new RuntimeException("Invalid version stage.");
|
||||
}
|
||||
|
||||
$levelList = array_keys($this->_installVersions[$highestVersion][$stage]);
|
||||
|
||||
$highestLevel = 0;
|
||||
foreach ($levelList as $level) {
|
||||
if ($level > $highestLevel) {
|
||||
$highestLevel = $level;
|
||||
}
|
||||
}
|
||||
|
||||
$version = array(
|
||||
'version' => $highestVersion,
|
||||
'stage' => $stage,
|
||||
'level' => $highestLevel,
|
||||
);
|
||||
|
||||
$this->enqueue(array($version, $this->_installVersions[$highestVersion][$stage][$highestLevel]));
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
protected function _downgradeToVersion($fromVersion, $toVersion)
|
||||
{
|
||||
throw new RuntimeException("Downgrade isn't yet implemented.");
|
||||
}
|
||||
|
||||
protected function _upgradeToVersion($fromVersion, $toVersion)
|
||||
{
|
||||
$currentVersion = $fromVersion;
|
||||
|
||||
if ($fromVersion['version'] === self::VERSION_NULL) {
|
||||
// run the higher install script
|
||||
$currentVersion = $this->_installHighestInstaller($currentVersion, $toVersion);
|
||||
}
|
||||
|
||||
$upgradeVersions = $this->_upgradeVersions;
|
||||
while (true) {
|
||||
|
||||
if ($currentVersion['version'] === $toVersion['version'] &&
|
||||
$currentVersion['stage'] === $toVersion['stage'] &&
|
||||
$currentVersion['level'] === $toVersion['level']) {
|
||||
break;
|
||||
}
|
||||
|
||||
$versionPointer = &$upgradeVersions[$currentVersion['version']][$currentVersion['stage']][$currentVersion['level']];
|
||||
if (empty($versionPointer)) {
|
||||
break;
|
||||
}
|
||||
|
||||
$highestVersion = $currentVersion['version'];
|
||||
foreach ($versionPointer as $version => $stages) {
|
||||
if (version_compare($version, $highestVersion['version'], '>') && version_compare($version, $toVersion['version'], '<=')) {
|
||||
$highestVersion = $version;
|
||||
}
|
||||
}
|
||||
|
||||
if (version_compare($highestVersion, $toVersion['version'], '<')) {
|
||||
$stage = self::STAGE_STABLE;
|
||||
$level = 0;
|
||||
} else if (version_compare($highestVersion, $toVersion['version']) === 0) {
|
||||
if (isset($versionPointer[$highestVersion][self::STAGE_STABLE]) && $toVersion['stage'] === self::STAGE_STABLE) {
|
||||
$stage = self::STAGE_STABLE;
|
||||
} else if (isset($versionPointer[$highestVersion][self::STAGE_RC]) &&
|
||||
in_array($toVersion['stage'], array(self::STAGE_RC, self::STAGE_STABLE))) {
|
||||
|
||||
$stage = self::STAGE_RC;
|
||||
} else if (isset($versionPointer[$highestVersion][self::STAGE_BETA]) &&
|
||||
in_array($toVersion['stage'], array(self::STAGE_RC, self::STAGE_STABLE, self::STAGE_BETA))) {
|
||||
|
||||
$stage = self::STAGE_BETA;
|
||||
} else if (isset($versionPointer[$highestVersion][self::STAGE_ALPHA]) &&
|
||||
in_array($toVersion['stage'], array(self::STAGE_RC, self::STAGE_STABLE, self::STAGE_BETA, self::STAGE_ALPHA))) {
|
||||
|
||||
$stage = self::STAGE_ALPHA;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
$level = max(array_keys($versionPointer[$highestVersion][$stage]));
|
||||
} else {
|
||||
throw new RuntimeException("Invalid version value.");
|
||||
}
|
||||
|
||||
$currentVersion = array(
|
||||
'version' => $highestVersion,
|
||||
'stage' => $stage,
|
||||
'level' => $level
|
||||
);
|
||||
$this->enqueue(array($currentVersion, $versionPointer[$highestVersion][$stage][$level]));
|
||||
}
|
||||
|
||||
$this->_finalVersion = $currentVersion;
|
||||
}
|
||||
|
||||
protected function _analyzePath($path)
|
||||
{
|
||||
$iterator = new DirectoryIterator($path);
|
||||
|
||||
foreach ($iterator as $file) {
|
||||
if ($file->isDir() || $file->isDot()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!preg_match(self::PCRE_FILE_PATTERN, $file->getBasename('.php'), $matches)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch ($matches['action']) {
|
||||
case self::MODE_INSTALL:
|
||||
$this->_addInstallFile(
|
||||
$file->getPathname(),
|
||||
$matches['version1'],
|
||||
(isset($matches['stage1']) && !empty($matches['stage1']) ? $matches['stage1'] : self::STAGE_STABLE),
|
||||
(isset($matches['level1']) && !empty($matches['level1']) ? (int) $matches['level1'] : 0)
|
||||
);
|
||||
break;
|
||||
|
||||
case self::MODE_UNINSTALL:
|
||||
$this->_addUninstallFile(
|
||||
$file->getPathname(),
|
||||
$matches['version1'],
|
||||
(isset($matches['stage1']) && !empty($matches['stage1']) ? $matches['stage1'] : self::STAGE_STABLE),
|
||||
(isset($matches['level1']) && !empty($matches['level1']) ? (int) $matches['level1'] : 0)
|
||||
);
|
||||
break;
|
||||
|
||||
case self::MODE_UPGRADE:
|
||||
$this->_addUpgradeFile(
|
||||
$file->getPathname(),
|
||||
$matches['version1'],
|
||||
$matches['version2'],
|
||||
(isset($matches['stage1']) && !empty($matches['stage1']) ? $matches['stage1'] : self::STAGE_STABLE),
|
||||
(isset($matches['stage2']) && !empty($matches['stage2']) ? $matches['stage2'] : self::STAGE_STABLE),
|
||||
(isset($matches['level1']) && !empty($matches['level1']) ? (int) $matches['level1'] : 0),
|
||||
(isset($matches['level2']) && !empty($matches['level2']) ? (int) $matches['level2'] : 0)
|
||||
);
|
||||
break;
|
||||
|
||||
case self::MODE_DOWNGRADE:
|
||||
$this->_addDowngradeFile(
|
||||
$file->getPathname(),
|
||||
$matches['version1'],
|
||||
$matches['version2'],
|
||||
(isset($matches['stage1']) && !empty($matches['stage1']) ? $matches['stage1'] : self::STAGE_STABLE),
|
||||
(isset($matches['stage2']) && !empty($matches['stage2']) ? $matches['stage2'] : self::STAGE_STABLE),
|
||||
(isset($matches['level1']) && !empty($matches['level1']) ? (int) $matches['level1'] : 0),
|
||||
(isset($matches['level2']) && !empty($matches['level2']) ? (int) $matches['level2'] : 0)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function _addInstallFile($file, $version, $stage = self::STAGE_STABLE, $level = null)
|
||||
{
|
||||
if (!isset($this->_installVersions[$version])) {
|
||||
$this->_installVersions[$version] = array();
|
||||
}
|
||||
if (!isset($this->_installVersions[$version][$stage])) {
|
||||
$this->_installVersions[$version][$stage] = array();
|
||||
}
|
||||
|
||||
$this->_installVersions[$version][$stage][$level] = $file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function _addUpgradeFile($file, $upperVersion, $lowerVersion, $upperStage = self::STAGE_STABLE, $lowerStage = self::STAGE_STABLE, $upperLevel = null, $lowerLevel = null)
|
||||
{
|
||||
if (!isset($this->_upgradeVersions[$upperVersion])) {
|
||||
$this->_upgradeVersions[$upperVersion] = array();
|
||||
}
|
||||
if (!isset($this->_upgradeVersions[$upperVersion][$upperStage])) {
|
||||
$this->_upgradeVersions[$upperVersion][$upperStage] = array();
|
||||
}
|
||||
if (!isset($this->_upgradeVersions[$upperVersion][$upperStage][$upperLevel])) {
|
||||
$this->_upgradeVersions[$upperVersion][$upperStage][$upperLevel] = array();
|
||||
}
|
||||
if (!isset($this->_upgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion])) {
|
||||
$this->_upgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion] = array();
|
||||
}
|
||||
if (!isset($this->_upgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion][$lowerStage])) {
|
||||
$this->_upgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion][$lowerStage] = array();
|
||||
}
|
||||
|
||||
$this->_upgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion][$lowerStage][$lowerLevel] = $file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function _addUninstallFile($file, $version, $stage = self::STAGE_STABLE, $level = null)
|
||||
{
|
||||
if (!isset($this->_uninstallVersions[$version])) {
|
||||
$this->_uninstallVersions[$version] = array();
|
||||
}
|
||||
if (!isset($this->_uninstallVersions[$version][$stage])) {
|
||||
$this->_uninstallVersions[$version][$stage] = array();
|
||||
}
|
||||
|
||||
$this->_uninstallVersions[$version][$stage][$level] = $file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function _addDowngradeFile($file, $upperVersion, $lowerVersion, $upperStage = self::STAGE_STABLE, $lowerStage = self::STAGE_STABLE, $upperLevel = null, $lowerLevel = null)
|
||||
{
|
||||
if (!isset($this->_downgradeVersions[$upperVersion])) {
|
||||
$this->_downgradeVersions[$upperVersion] = array();
|
||||
}
|
||||
if (!isset($this->_downgradeVersions[$upperVersion][$upperStage])) {
|
||||
$this->_downgradeVersions[$upperVersion][$upperStage] = array();
|
||||
}
|
||||
if (!isset($this->_downgradeVersions[$upperVersion][$upperStage][$upperLevel])) {
|
||||
$this->_downgradeVersions[$upperVersion][$upperStage][$upperLevel] = array();
|
||||
}
|
||||
if (!isset($this->_downgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion])) {
|
||||
$this->_downgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion] = array();
|
||||
}
|
||||
if (!isset($this->_downgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion][$lowerStage])) {
|
||||
$this->_downgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion][$lowerStage] = array();
|
||||
}
|
||||
|
||||
$this->_downgradeVersions[$upperVersion][$upperStage][$upperLevel][$lowerVersion][$lowerStage][$lowerLevel] = $file;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return count($this->_scripts);
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return array_key_exists($offset, $this->_scripts);
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->_scripts[(int) $offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
if ($this->offsetExists($offset)) {
|
||||
return $this->_scripts[(int) $offset];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
if ($this->offsetExists($offset)) {
|
||||
unset($this->_scripts[(int) $offset]);
|
||||
}
|
||||
}
|
||||
|
||||
public function current()
|
||||
{
|
||||
return current($this->_scripts);
|
||||
}
|
||||
|
||||
public function key()
|
||||
{
|
||||
return key($this->_scripts);
|
||||
}
|
||||
|
||||
public function next()
|
||||
{
|
||||
next($this->_scripts);
|
||||
}
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
reset($this->_scripts);
|
||||
}
|
||||
|
||||
public function valid()
|
||||
{
|
||||
return (bool) (key($this->_scripts) !== null);
|
||||
}
|
||||
|
||||
public function enqueue($data)
|
||||
{
|
||||
$this->_scripts[] = array(
|
||||
'script' => $data[1],
|
||||
'version' => $data[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,792 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license Modified BSD
|
||||
* @see https://github.com/gplanchat/one.platform
|
||||
*
|
||||
* Copyright (c) 2009-2010, Grégory PLANCHAT <g.planchat at gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Grégory PLANCHAT nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* --> 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 One.Platform.
|
||||
*
|
||||
*/
|
||||
|
||||
$this->setSetupConnection('legacies_setup');
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/aks')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(50) NULL,
|
||||
`teilnehmer` TEXT NULL,
|
||||
`flotten` TEXT NULL,
|
||||
`ankunft` INT UNSIGNED NULL,
|
||||
`galaxy` TINYINT UNSIGNED NULL,
|
||||
`system` SMALLINT UNSIGNED NULL,
|
||||
`planet` TINYINT UNSIGNED NULL,
|
||||
`eingeladen` INT UNSIGNED NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/aks', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/aks', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/aks', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/alliance')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`ally_name` VARCHAR(32) NOT NULL,
|
||||
`ally_tag` VARCHAR(8) NOT NULL,
|
||||
`ally_owner` BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`ally_register_time` TIMESTAMP NOT NULL,
|
||||
`ally_description` TEXT NULL,
|
||||
`ally_web` VARCHAR(255) NULL,
|
||||
`ally_text` TEXT NULL,
|
||||
`ally_image` VARCHAR(255) NULL,
|
||||
`ally_request` TEXT NULL,
|
||||
`ally_request_waiting` TEXT NULL,
|
||||
`ally_request_notallow` BOOL NOT NULL DEFAULT FALSE,
|
||||
`ally_owner_range` VARCHAR(32) NULL,
|
||||
`ally_ranks` TEXT NULL,
|
||||
`ally_members` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/alliance', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/alliance', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/alliance', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/annonce')} (
|
||||
`id` SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`user` TEXT NOT NULL,
|
||||
`galaxie` TINYINT UNSIGNED NOT NULL,
|
||||
`systeme` SMALLINT UNSIGNED NOT NULL,
|
||||
`metala` DECIMAL(65,0) NOT NULL,
|
||||
`cristala` DECIMAL(65,0) NOT NULL,
|
||||
`deuta` DECIMAL(65,0) NOT NULL,
|
||||
`metals` DECIMAL(65,0) NOT NULL,
|
||||
`cristals` DECIMAL(65,0) NOT NULL,
|
||||
`deuts` DECIMAL(65,0) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/annonce', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/annonce', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/annonce', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/banned')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`who` BIGINT UNSIGNED NOT NULL,
|
||||
`theme` TEXT NOT NULL,
|
||||
`who2` BIGINT UNSIGNED NOT NULL,
|
||||
`time` TIMESTAMP NOT NULL,
|
||||
`longer` INT UNSIGNED NOT NULL DEFAULT 3600,
|
||||
`author` BIGINT UNSIGNED NOT NULL,
|
||||
`email` VARCHAR(100) NOT NULL,
|
||||
KEY `ID` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/banned', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/banned', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/banned', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/buddy')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`sender` BIGINT UNSIGNED NOT NULL,
|
||||
`owner` BIGINT UNSIGNED NOT NULL,
|
||||
`active` BOOL NOT NULL DEFAULT TRUE,
|
||||
`text` TEXT,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/buddy', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/buddy', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/buddy', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/chat')} (
|
||||
`messageid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`user` VARCHAR(255) NOT NULL,
|
||||
`message` TEXT NOT NULL,
|
||||
`timestamp` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`messageid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/chat', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/chat', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/chat', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/config')} (
|
||||
`config_name` VARCHAR(64) NOT NULL,
|
||||
`config_value` TEXT NOT NULL,
|
||||
UNIQUE KEY (`config_name`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/config', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/config', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/config', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
INSERT INTO {$this->getTableName('legacies/config')} (`config_name`, `config_value`) VALUES
|
||||
('game_speed', '2500'),
|
||||
('fleet_speed', '2500'),
|
||||
('resource_multiplier', '1000'),
|
||||
('Fleet_Cdr', '30'),
|
||||
('Defs_Cdr', '30'),
|
||||
('initial_fields', '5000'),
|
||||
('COOKIE_NAME', 'xnova-legacies'),
|
||||
('game_name', 'XNova:Legacies'),
|
||||
('game_disable', '1'),
|
||||
('close_reason', 'Le jeu est clos pour le moment!'),
|
||||
('metal_basic_income', '20'),
|
||||
('crystal_basic_income', '10'),
|
||||
('deuterium_basic_income', '0'),
|
||||
('energy_basic_income', '0'),
|
||||
('BuildLabWhileRun', '0'),
|
||||
('LastSettedGalaxyPos', '1'),
|
||||
('LastSettedSystemPos', '1'),
|
||||
('LastSettedPlanetPos', '1'),
|
||||
('urlaubs_modus_erz', '1'),
|
||||
('noobprotection', '1'),
|
||||
('noobprotectiontime', '5000'),
|
||||
('noobprotectionmulti', '5'),
|
||||
('forum_url', 'http://board.xnova-ng.org/'),
|
||||
('OverviewNewsFrame', '1'),
|
||||
('OverviewNewsTEXT', 'Bienvenue sur le nouveau serveur XNova Legacies'),
|
||||
('OverviewExternChat', '0'),
|
||||
('OverviewExternChatCmd', ''),
|
||||
('OverviewBanner', '0'),
|
||||
('OverviewClickBanner', ''),
|
||||
('ExtCopyFrame', '0'),
|
||||
('ExtCopyOwner', ''),
|
||||
('ExtCopyFunct', ''),
|
||||
('ForumBannerFrame', '0'),
|
||||
('stat_settings', '1000'),
|
||||
('link_enable', '0'),
|
||||
('link_name', ''),
|
||||
('link_url', ''),
|
||||
('enable_announces', '1'),
|
||||
('enable_marchand', '1'),
|
||||
('enable_notes', '1'),
|
||||
('bot_name', 'XNoviana Reali'),
|
||||
('bot_adress', 'xnova@xnova.fr'),
|
||||
('banner_source_post', '../images/bann.png'),
|
||||
('ban_duration', '30'),
|
||||
('enable_bot', '0'),
|
||||
('enable_bbcode', '1'),
|
||||
('debug', '0');
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/declared')} (
|
||||
`declarator` TEXT NOT NULL,
|
||||
`declared_1` TEXT NOT NULL,
|
||||
`declared_2` TEXT NOT NULL,
|
||||
`declared_3` TEXT NOT NULL,
|
||||
`reason` TEXT NOT NULL,
|
||||
`declarator_name` TEXT NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/declared', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/declared', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/declared', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/errors')} (
|
||||
`error_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`error_sender` VARCHAR(32) NOT NULL,
|
||||
`error_time` TIMESTAMP NOT NULL,
|
||||
`error_type` VARCHAR(32) NOT NULL DEFAULT 'unknown',
|
||||
`error_text` TEXT,
|
||||
PRIMARY KEY (`error_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/errors', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/errors', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/errors', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/fleets')} (
|
||||
`fleet_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`fleet_owner` BIGINT UNSIGNED NOT NULL,
|
||||
`fleet_mission` TINYINT UNSIGNED NOT NULL,
|
||||
`fleet_amount` DECIMAL(65,0) NOT NULL,
|
||||
`fleet_array` TEXT NULL,
|
||||
`fleet_start_time` TIMESTAMP NOT NULL,
|
||||
`fleet_start_galaxy` TINYINT UNSIGNED NOT NULL,
|
||||
`fleet_start_system` SMALLINT UNSIGNED NOT NULL,
|
||||
`fleet_start_planet` TINYINT UNSIGNED NOT NULL,
|
||||
`fleet_start_type` TINYINT UNSIGNED NOT NULL,
|
||||
`fleet_end_time` TIMESTAMP NOT NULL,
|
||||
`fleet_end_stay` TIMESTAMP NOT NULL,
|
||||
`fleet_end_galaxy` TINYINT UNSIGNED NOT NULL,
|
||||
`fleet_end_system` SMALLINT UNSIGNED NOT NULL,
|
||||
`fleet_end_planet` TINYINT UNSIGNED NOT NULL,
|
||||
`fleet_end_type` TINYINT UNSIGNED NOT NULL,
|
||||
`fleet_taget_owner` BIGINT UNSIGNED NOT NULL,
|
||||
`fleet_resource_metal` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`fleet_resource_crystal` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`fleet_resource_deuterium` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`fleet_target_owner` BIGINT UNSIGNED NOT NULL,
|
||||
`fleet_group` BIGINT UNSIGNED NOT NULL,
|
||||
`fleet_mess` BIGINT UNSIGNED NOT NULL,
|
||||
`start_time` INT,
|
||||
PRIMARY KEY (`fleet_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/fleets', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/fleets', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/fleets', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/galaxy')} (
|
||||
`galaxy` TINYINT UNSIGNED NOT NULL,
|
||||
`system` SMALLINT UNSIGNED NOT NULL,
|
||||
`planet` TINYINT UNSIGNED NOT NULL,
|
||||
`id_planet` BIGINT UNSIGNED NOT NULL,
|
||||
`metal` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`crystal` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`id_luna` BIGINT UNSIGNED NULL,
|
||||
`luna` BOOL NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY (`galaxy`, `system`, `planet`),
|
||||
KEY `galaxy` (`galaxy`),
|
||||
KEY `system` (`system`),
|
||||
KEY `planet` (`planet`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/galaxy', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/galaxy', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/galaxy', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/iraks')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`zeit` TIMESTAMP NOT NULL,
|
||||
`galaxy` TINYINT UNSIGNED NOT NULL,
|
||||
`system` SMALLINT UNSIGNED NOT NULL,
|
||||
`planet` TINYINT UNSIGNED NOT NULL,
|
||||
`galaxy_angreifer` TINYINT UNSIGNED NOT NULL,
|
||||
`system_angreifer` SMALLINT UNSIGNED NOT NULL,
|
||||
`planet_angreifer` TINYINT UNSIGNED NOT NULL,
|
||||
`owner` BIGINT UNSIGNED NOT NULL,
|
||||
`zielid` BIGINT UNSIGNED NOT NULL,
|
||||
`anzahl` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`primaer` SMALLINT UNSIGNED,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/iraks', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/iraks', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/iraks', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/lunas')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`id_luna` BIGINT UNSIGNED NOT NULL,
|
||||
`name` VARCHAR(100) NOT NULL DEFAULT 'Lune',
|
||||
`image` VARCHAR(50) NOT NULL DEFAULT 'mond',
|
||||
`destruyed` BOOL NOT NULL DEFAULT FALSE,
|
||||
`id_owner` BIGINT UNSIGNED NOT NULL,
|
||||
`galaxy` TINYINT UNSIGNED NOT NULL,
|
||||
`system` SMALLINT UNSIGNED NOT NULL,
|
||||
`lunapos` TINYINT UNSIGNED NOT NULL,
|
||||
`temp_min` TINYINT NOT NULL DEFAULT 0,
|
||||
`temp_max` TINYINT NOT NULL DEFAULT 0,
|
||||
`diameter` INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/lunas', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/lunas', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/lunas', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/messages')} (
|
||||
`message_id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`message_owner` BIGINT UNSIGNED NOT NULL,
|
||||
`message_sender` BIGINT UNSIGNED NOT NULL,
|
||||
`message_time` TIMESTAMP NOT NULL,
|
||||
`message_type` TINYINT UNSIGNED NOT NULL,
|
||||
`message_from` VARCHAR(50),
|
||||
`message_subject` VARCHAR(150),
|
||||
`message_text` TEXT,
|
||||
PRIMARY KEY (`message_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/messages', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/messages', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/messages', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/multi')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`player` BIGINT UNSIGNED NOT NULL,
|
||||
`sharer` BIGINT UNSIGNED NOT NULL,
|
||||
`reason` TEXT NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/multi', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/multi', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/multi', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/notes')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`owner` BIGINT UNSIGNED NOT NULL,
|
||||
`time` TIMESTAMP NOT NULL,
|
||||
`priority` TINYINT UNSIGNED NOT NULL,
|
||||
`title` VARCHAR(32) NOT NULL,
|
||||
`TEXT` TEXT NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/notes', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/notes', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/notes', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/planets')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(100) NOT NULL,
|
||||
`id_owner` BIGINT UNSIGNED NOT NULL,
|
||||
`id_level` TINYINT UNSIGNED NOT NULL,
|
||||
`galaxy` TINYINT UNSIGNED NOT NULL,
|
||||
`system` SMALLINT UNSIGNED NOT NULL,
|
||||
`planet` TINYINT UNSIGNED NOT NULL,
|
||||
`last_update` TIMESTAMP NOT NULL,
|
||||
`planet_type` TINYINT UNSIGNED NOT NULL,
|
||||
`destruyed` BOOL NOT NULL DEFAULT FALSE,
|
||||
`b_building` SMALLINT UNSIGNED NOT NULL,
|
||||
`b_building_id` TEXT NOT NULL,
|
||||
`b_tech` SMALLINT UNSIGNED NOT NULL,
|
||||
`b_tech_id` SMALLINT UNSIGNED NOT NULL,
|
||||
`b_hangar` SMALLINT UNSIGNED NOT NULL,
|
||||
`b_hangar_id` TEXT NOT NULL,
|
||||
`b_hangar_plus` SMALLINT UNSIGNED NOT NULL,
|
||||
`image` VARCHAR(50) NOT NULL DEFAULT 'normaltempplanet01',
|
||||
`diameter` INT UNSIGNED NOT NULL DEFAULT 12800,
|
||||
`points` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`ranks` BIGINT UNSIGNED NOT NULL,
|
||||
`field_current` INT UNSIGNED NOT NULL DEFAULT 163,
|
||||
`field_max` INT UNSIGNED NOT NULL DEFAULT 163,
|
||||
`temp_min` INT NOT NULL DEFAULT 0,
|
||||
`temp_max` INT NOT NULL DEFAULT 0,
|
||||
`metal` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`metal_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`metal_max` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`crystal` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`crystal_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`crystal_max` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`deuterium` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`deuterium_perhour` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`deuterium_max` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`energy_used` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`energy_max` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`metal_mine` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`crystal_mine` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`deuterium_sintetizer` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`solar_plant` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`fusion_plant` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`robot_factory` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`nano_factory` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`hangar` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`metal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`crystal_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`deuterium_store` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`laboratory` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`terraformer` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`ally_deposit` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`silo` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`mondbasis` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`phalanx` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`sprungtor` SMALLINT UNSIGNED NOT NULL DEFAULT 0,
|
||||
`small_ship_cargo` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`big_ship_cargo` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`light_hunter` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`heavy_hunter` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`crusher` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`battle_ship` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`colonizer` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`recycler` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`spy_sonde` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`bomber_ship` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`solar_satelit` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`destructor` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`dearth_star` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`battleship` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`misil_launcher` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`small_laser` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`big_laser` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`gauss_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`ionic_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`buster_canyon` DECIMAL(65,0) NOT NULL DEFAULT 0,
|
||||
`small_protection_shield` ENUM('0','1') NOT NULL DEFAULT 0,
|
||||
`big_protection_shield` ENUM('0','1') NOT NULL DEFAULT 0,
|
||||
`interceptor_misil` SMALLINT NOT NULL DEFAULT 0,
|
||||
`interplanetary_misil` SMALLINT NOT NULL DEFAULT 0,
|
||||
`metal_mine_porcent` TINYINT NOT NULL DEFAULT 10,
|
||||
`crystal_mine_porcent` TINYINT NOT NULL DEFAULT 10,
|
||||
`deuterium_sintetizer_porcent` TINYINT NOT NULL DEFAULT 10,
|
||||
`solar_plant_porcent` TINYINT NOT NULL DEFAULT 10,
|
||||
`fusion_plant_porcent` TINYINT NOT NULL DEFAULT 10,
|
||||
`solar_satelit_porcent` TINYINT NOT NULL DEFAULT 10,
|
||||
`last_jump_time` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/planets', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/planets', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/planets', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/rw')} (
|
||||
`id_owner1` BIGINT UNSIGNED NOT NULL,
|
||||
`id_owner2` BIGINT UNSIGNED NOT NULL,
|
||||
`rid` VARCHAR(72) NOT NULL,
|
||||
`raport` LONGTEXT NOT NULL,
|
||||
`a_zestrzelona` TINYINT UNSIGNED NOT NULL,
|
||||
`time` TIMESTAMP NOT NULL,
|
||||
KEY (`rid`),
|
||||
UNIQUE KEY `id_owner1` (`id_owner1`,`rid`),
|
||||
UNIQUE KEY `id_owner2` (`id_owner2`,`rid`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/rw', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/rw', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/rw', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/statpoints')} (
|
||||
`id_owner` BIGINT UNSIGNED NOT NULL,
|
||||
`id_ally` BIGINT UNSIGNED NOT NULL,
|
||||
`stat_type` TINYINT UNSIGNED NOT NULL,
|
||||
`stat_code` TINYINT UNSIGNED NOT NULL,
|
||||
`tech_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`tech_old_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`tech_points` DECIMAL(65,0) NOT NULL,
|
||||
`tech_count` BIGINT UNSIGNED NOT NULL,
|
||||
`build_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`build_old_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`build_points` DECIMAL(65,0) NOT NULL,
|
||||
`build_count` BIGINT UNSIGNED NOT NULL,
|
||||
`defs_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`defs_old_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`defs_points` DECIMAL(65,0) NOT NULL,
|
||||
`defs_count` BIGINT UNSIGNED NOT NULL,
|
||||
`fleet_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`fleet_old_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`fleet_points` DECIMAL(65,0) NOT NULL,
|
||||
`fleet_count` BIGINT UNSIGNED NOT NULL,
|
||||
`total_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`total_old_rank` BIGINT UNSIGNED NOT NULL,
|
||||
`total_points` DECIMAL(65,0) NOT NULL,
|
||||
`total_count` BIGINT UNSIGNED NOT NULL,
|
||||
`stat_date` TIMESTAMP NOT NULL,
|
||||
KEY (`tech_points`),
|
||||
KEY (`build_points`),
|
||||
KEY (`defs_points`),
|
||||
KEY (`fleet_points`),
|
||||
KEY (`total_points`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/statpoints', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/statpoints', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/statpoints', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('legacies/users')} (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`username` VARCHAR(100) NOT NULL, -- FIXME
|
||||
`password` VARCHAR(64) NOT NULL, -- FIXME
|
||||
`email` VARCHAR(200) NOT NULL, -- FIXME
|
||||
`email_2` VARCHAR(200) NOT NULL, -- FIXME
|
||||
`lang` VARCHAR(3) NOT NULL DEFAULT 'fr',
|
||||
`authlevel` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
|
||||
`sex` ENUM('M','F') NULL DEFAULT NULL,
|
||||
`avatar` VARCHAR(255) NULL DEFAULT NULL,
|
||||
`sign` TEXT NULL,
|
||||
`id_planet` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`galaxy` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`system` SMALLINT UNSIGNED NOT NULL, -- FIXME
|
||||
`planet` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`current_planet` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`user_lastip` VARCHAR(16) NOT NULL, -- FIXME
|
||||
`ip_at_reg` VARCHAR(16) NOT NULL, -- FIXME
|
||||
`user_agent` TEXT NOT NULL, -- FIXME
|
||||
`current_page` TEXT NOT NULL, -- FIXME
|
||||
`register_time` TIMESTAMP NOT NULL, -- FIXME
|
||||
`onlinetime` TIMESTAMP NOT NULL, -- FIXME
|
||||
`dpath` VARCHAR(255) NOT NULL, -- FIXME
|
||||
`design` TINYINT NOT NULL DEFAULT 1, -- FIXME
|
||||
`noipcheck` BOOL NOT NULL DEFAULT TRUE, -- FIXME
|
||||
`planet_sort` TINYINT NOT NULL DEFAULT 0, -- FIXME
|
||||
`planet_sort_order` TINYINT NOT NULL DEFAULT 0, -- FIXME
|
||||
`spio_anz` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
|
||||
`settings_tooltiptime` TINYINT UNSIGNED NOT NULL DEFAULT 5, -- FIXME
|
||||
`settings_fleetactions` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
|
||||
`settings_allylogo` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
|
||||
`settings_esp` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
|
||||
`settings_wri` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
|
||||
`settings_bud` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
|
||||
`settings_mis` TINYINT UNSIGNED NOT NULL DEFAULT 1, -- FIXME
|
||||
`settings_rep` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
|
||||
`urlaubs_modus` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
|
||||
`urlaubs_until` TIMESTAMP NOT NULL, -- FIXME
|
||||
`db_deaktjava` BOOL NOT NULL DEFAULT FALSE, -- FIXME
|
||||
`new_message` TINYINT UNSIGNED NOT NULL DEFAULT 0, -- FIXME
|
||||
`fleet_shortcut` TEXT NULL,
|
||||
`b_tech_planet` INT NOT NULL, -- FIXME
|
||||
`spy_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`computer_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`military_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`defence_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`shield_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`energy_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`hyperspace_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`combustion_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`impulse_motor_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`hyperspace_motor_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`laser_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`ionic_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`buster_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`intergalactic_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`expedition_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`graviton_tech` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`ally_id` BIGINT UNSIGNED NOT NULL,
|
||||
`ally_name` VARCHAR(32) NULL, -- FIXME
|
||||
`ally_request` BOOL NOT NULL DEFAULT FALSE, -- FIXME
|
||||
`ally_request_text` TEXT NULL, -- FIXME
|
||||
`ally_register_time` TIMESTAMP NOT NULL, -- FIXME
|
||||
`ally_rank_id` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`current_luna` INT NOT NULL, -- FIXME
|
||||
`kolorminus` VARCHAR(11) NOT NULL DEFAULT 'red',
|
||||
`kolorplus` VARCHAR(11) NOT NULL DEFAULT '#00FF00',
|
||||
`kolorpoziom` VARCHAR(11) NOT NULL DEFAULT 'yellow',
|
||||
`rpg_geologue` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_amiral` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_ingenieur` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_technocrate` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_espion` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_constructeur` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_scientifique` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_commandant` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_points` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_stockeur` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_defenseur` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_destructeur` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_general` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_bunker` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_raideur` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`rpg_empereur` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`lvl_minier` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`lvl_raid` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`xpraid` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`xpminier` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`raids` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`p_infligees` DECIMAL(65,0) NOT NULL, -- FIXME
|
||||
`mnl_alliance` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`mnl_joueur` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`mnl_attaque` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`mnl_spy` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`mnl_exploit` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`mnl_transport` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`mnl_expedition` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`mnl_general` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`mnl_buildlist` TINYINT UNSIGNED NOT NULL, -- FIXME
|
||||
`bana` BOOL NOT NULL DEFAULT FALSE, -- FIXME
|
||||
`multi_validated` BOOL NOT NULL DEFAULT FALSE, -- FIXME
|
||||
`banaday` TIMESTAMP NULL DEFAULT NULL, -- FIXME
|
||||
`raids1` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`raidswin` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
`raidsloose` BIGINT UNSIGNED NOT NULL, -- FIXME
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY (`username`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$this
|
||||
->grant('legacies/users', 'legacies_read', array('SELECT'))
|
||||
->grant('legacies/users', 'legacies_write', array('SELECT', 'CREATE', 'UPDATE', 'DELETE'))
|
||||
->grant('legacies/users', 'legacies_setup')
|
||||
;
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
INSERT INTO {$this->getTableName('legacies/alliance')} (
|
||||
`id`, `ally_name`, `ally_tag`, `ally_owner`, `ally_register_time`, `ally_description`,
|
||||
`ally_web`, `ally_text`, `ally_image`, `ally_request`, `ally_request_waiting`,
|
||||
`ally_request_notallow`, `ally_owner_range`, `ally_ranks`, `ally_members`
|
||||
)
|
||||
VALUES
|
||||
('1', 'Admin', 'Admin', 1, NOW(), 'Administrator alliance', 'http://www.xnova-ng.org/',
|
||||
'', '', '', '', '', '', '', '')
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
INSERT INTO {$this->getTableName('legacies/users')} (
|
||||
`id`, `username`, `password`, `email`, `email_2`, `lang`, `authlevel`, `sex`,
|
||||
`avatar`, `sign`, `id_planet`, `galaxy`, `system`, `planet`, `current_planet`,
|
||||
`user_lastip`, `ip_at_reg`, `user_agent`, `current_page`, `register_time`,
|
||||
`onlinetime`, `dpath`, `design`, `noipcheck`, `planet_sort`, `planet_sort_order`,
|
||||
`spio_anz`, `settings_tooltiptime`, `settings_fleetactions`, `settings_allylogo`,
|
||||
`settings_esp`, `settings_wri`, `settings_bud`, `settings_mis`, `settings_rep`,
|
||||
`urlaubs_modus`, `urlaubs_until`, `db_deaktjava`, `new_message`, `fleet_shortcut`,
|
||||
`b_tech_planet`, `spy_tech`, `computer_tech`, `military_tech`, `defence_tech`,
|
||||
`shield_tech`, `energy_tech`, `hyperspace_tech`, `combustion_tech`,
|
||||
`impulse_motor_tech`, `hyperspace_motor_tech`, `laser_tech`, `ionic_tech`,
|
||||
`buster_tech`, `intergalactic_tech`, `expedition_tech`, `graviton_tech`,
|
||||
`ally_id`, `ally_name`, `ally_request`, `ally_request_text`, `ally_register_time`,
|
||||
`ally_rank_id`, `current_luna`, `kolorminus`, `kolorplus`, `kolorpoziom`,
|
||||
`rpg_geologue`, `rpg_amiral`, `rpg_ingenieur`, `rpg_technocrate`, `rpg_espion`,
|
||||
`rpg_constructeur`, `rpg_scientifique`, `rpg_commandant`, `rpg_points`, `rpg_stockeur`,
|
||||
`rpg_defenseur`, `rpg_destructeur`, `rpg_general`, `rpg_bunker`, `rpg_raideur`,
|
||||
`rpg_empereur`, `lvl_minier`, `lvl_raid`, `xpraid`, `xpminier`, `raids`,
|
||||
`p_infligees`, `mnl_alliance`, `mnl_joueur`, `mnl_attaque`, `mnl_spy`,
|
||||
`mnl_exploit`, `mnl_transport`, `mnl_expedition`, `mnl_general`, `mnl_buildlist`,
|
||||
`bana`, `multi_validated`, `banaday`, `raids1`, `raidswin`, `raidsloose`
|
||||
)
|
||||
VALUES
|
||||
('1', 'Admin', '', '', '', 'fr', '3', NULL, '', '', '1', '1', '1', '1',
|
||||
'1', '127.0.0.1', '', '', '', '1254743313', '1269391977', '', '1', '1', '0',
|
||||
'0', '1', '5', '0', '0', '1', '1', '1', '1', '0', '0', '0', '0', '0', '', '0',
|
||||
'16', '20', '11', '11', '11', '12', '10', '14', '10', '9', '0', '0', '0', '0',
|
||||
'0', '1', 1, 'Admin', '0', '', NOW(), '0', '0', 'red', '#00FF00', 'yellow', '20',
|
||||
'20', '10', '10', '0', '3', '3', '0', '27', '2', '2', '0', '0', '0', '0', '0',
|
||||
'98', '1', '0', '1133583738', '0', '0', '0', '0', '0', '0', '0', '0', '0',
|
||||
'0', '0', '0', '0', '0', '0', '0', '0')
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license Modified BSD
|
||||
* @see https://github.com/gplanchat/one.platform
|
||||
*
|
||||
* Copyright (c) 2009-2010, Grégory PLANCHAT <g.planchat at gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* - Neither the name of Grégory PLANCHAT nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* --> 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 One.Platform.
|
||||
*
|
||||
*/
|
||||
|
||||
$this->setSetupConnection('legacies_setup');
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/aks')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/alliance')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/annonce')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/banned')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/buddy')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/chat')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/config')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/declared')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/errors')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/fleets')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/galaxy')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/iraks')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/lunas')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/messages')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/multi')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/notes')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/planets')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/rw')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/statpoints')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
||||
$sql = <<<SQL_EOF
|
||||
DROP TABLE {$this->getTableName('legacies/users')};
|
||||
SQL_EOF;
|
||||
|
||||
$this->query($sql);
|
||||
|
|
@ -16,7 +16,9 @@ class Legacies_Database
|
|||
$password = $config['global']['database']['options']['password'];
|
||||
$database = $config['global']['database']['options']['database'];
|
||||
|
||||
self::$_singleton = new self("mysql:dbname={$database};host={$hostname}", $username, $password);
|
||||
self::$_singleton = new self("mysql:dbname={$database};host={$hostname}", $username, $password, array(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
|
||||
));
|
||||
}
|
||||
return self::$_singleton;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,12 +38,15 @@
|
|||
class Legacies_Empire
|
||||
{
|
||||
const TYPE_BUILDING = 'build';
|
||||
const TYPE_BUILDING_MOON = 'build_moon';
|
||||
const TYPE_BUILDING_PLANET = 'build_planet';
|
||||
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 TYPE_FLEET_MISSION = 'mission';
|
||||
|
||||
const RESOURCE_METAL = 'metal';
|
||||
const RESOURCE_CRISTAL = 'cristal';
|
||||
|
|
@ -129,6 +132,18 @@ class Legacies_Empire
|
|||
const ID_COMBAT_FIREPOWER = 'attack';
|
||||
const ID_COMBAT_RAPID_FIRE = 'sd';
|
||||
|
||||
const ID_MISSION_ATTACK = 1;
|
||||
const ID_MISSION_GROUP_ATTACK = 2;
|
||||
const ID_MISSION_TRANSPORT = 3;
|
||||
const ID_MISSION_STATION = 4;
|
||||
const ID_MISSION_STATION_ALLY = 5;
|
||||
const ID_MISSION_SPY = 6;
|
||||
const ID_MISSION_SETTLE_COLONY = 7;
|
||||
const ID_MISSION_RECYCLE = 8;
|
||||
const ID_MISSION_DESTROY = 9;
|
||||
const ID_MISSION_MISSILES = 10;
|
||||
const ID_MISSION_EXPEDITION = 15;
|
||||
|
||||
public static function getFieldName($id)
|
||||
{
|
||||
$fieldsAlias = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ abstract class Legacies_Empire_Model_BuilderAbstract
|
|||
{
|
||||
$this->clearQueue();
|
||||
|
||||
$unserialized = unserialize($serialized);
|
||||
$unserialized = @unserialize($serialized);
|
||||
if ($unserialized === false) {
|
||||
$this->_queue = array();
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@ class Legacies_Empire_Model_Game_Types
|
|||
|
||||
public function is($element, $type)
|
||||
{
|
||||
if (!is_array($this->getData($type))) {
|
||||
return false;
|
||||
}
|
||||
return in_array($element, $this->getData($type));
|
||||
}
|
||||
}
|
||||
|
|
@ -90,6 +90,28 @@ class Legacies_Empire_Model_Planet
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function updateBuildingFields()
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
if ($this->isPlanet()) {
|
||||
$filter = Legacies_Empire::TYPE_BUILDING_PLANET;
|
||||
} else if ($this->isMoon()) {
|
||||
$filter = Legacies_Empire::TYPE_BUILDING_MOON;
|
||||
} else {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$usedFields = 0;
|
||||
foreach ($types[$filter] as $buildingId) {
|
||||
$usedFields += $this->getElement($buildingId);
|
||||
}
|
||||
|
||||
$this->setData('field_current', $usedFields);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updateResourceProduction($time = null)
|
||||
{
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
|
@ -121,7 +143,7 @@ class Legacies_Empire_Model_Planet
|
|||
|
||||
$level = $this->getData(Legacies_Empire::getFieldName($productionUnit));
|
||||
$ratio = $this->getData($ratioField);
|
||||
$element = self::getProducitonElementInstance($productionUnit);
|
||||
$element = self::getProductionElementInstance($productionUnit);
|
||||
|
||||
$productionRatios[$productionUnit] = $element->getProductionRatios($level, $ratio, $this, $this->getUser());
|
||||
foreach ($productionRatios[$productionUnit] as $resourceId => $resourceProduction) {
|
||||
|
|
@ -216,7 +238,7 @@ class Legacies_Empire_Model_Planet
|
|||
return $this;
|
||||
}
|
||||
|
||||
public static function getProducitonElementInstance($buildingId)
|
||||
public static function getProductionElementInstance($buildingId)
|
||||
{
|
||||
$production = Legacies_Empire_Model_Game_Production::getSingleton();
|
||||
|
||||
|
|
@ -232,6 +254,49 @@ class Legacies_Empire_Model_Planet
|
|||
return self::$_productionInstances[$buildingId];
|
||||
}
|
||||
|
||||
public function getFleetCollection($time = null)
|
||||
{
|
||||
$firstCollection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
||||
$firstCollection
|
||||
->column('*')
|
||||
->where('fleet.fleet_start_galaxy = :galaxy')
|
||||
->where('fleet.fleet_start_system = :system')
|
||||
->where('fleet.fleet_start_planet = :position')
|
||||
->where('fleet.fleet_start_type = :planet_type')
|
||||
;
|
||||
$backCollection = new Legacies_Core_Collection(array('fleet' => 'fleets'));
|
||||
$backCollection
|
||||
->column('*')
|
||||
->where('fleet.fleet_end_galaxy = :galaxy')
|
||||
->where('fleet.fleet_end_system = :system')
|
||||
->where('fleet.fleet_end_planet = :position')
|
||||
->where('fleet.fleet_end_type = :planet_type')
|
||||
;
|
||||
|
||||
$options = array(
|
||||
'galaxy' => $this->getSystem(),
|
||||
'system' => $this->getSystem(),
|
||||
'position' => $this->getPosition(),
|
||||
'planet_type' => $this->getType()
|
||||
);
|
||||
|
||||
if ($time !== null) {
|
||||
$options['now'] = $time;
|
||||
$firstCollection->where('fleet_start_time <= :now');
|
||||
$backCollection->where('fleet_end_time <= :now');
|
||||
}
|
||||
|
||||
$collection = new Legacies_Core_Collection();
|
||||
$collection
|
||||
->setEntityClassName('Legacies_Empire_Model_Fleet')
|
||||
->union($firstCollection)
|
||||
->union($backCollection)
|
||||
->load($options)
|
||||
;
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function getUser()
|
||||
{
|
||||
if ($this->_user === null) {
|
||||
|
|
@ -434,7 +499,7 @@ class Legacies_Empire_Model_Planet
|
|||
'user' => $this->_currentUser
|
||||
));
|
||||
|
||||
$this->_builder->updateQueue();
|
||||
$this->_builder->updateQueue($time);
|
||||
|
||||
// Dispatch event
|
||||
Legacies::dispatchEvent($this->_eventPrefix . 'update-queue.after', array(
|
||||
|
|
@ -443,6 +508,13 @@ class Legacies_Empire_Model_Planet
|
|||
'planet' => $this->_currentPlanet,
|
||||
'user' => $this->_currentUser
|
||||
));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBuildingQueue()
|
||||
{
|
||||
return $this->_builder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -471,6 +543,28 @@ class Legacies_Empire_Model_Planet
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resources needed to build a specific building
|
||||
*
|
||||
* @param int $buildingId
|
||||
* @return bool
|
||||
*/
|
||||
public function getResourcesNeeded($buildingId, $level)
|
||||
{
|
||||
return $this->_builder->getResourcesNeeded($buildingId, $level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time needed to build a specific building
|
||||
*
|
||||
* @param int $buildingId
|
||||
* @return bool
|
||||
*/
|
||||
public function getBuildingTime($buildingId, $level)
|
||||
{
|
||||
return $this->_builder->getBuildingTime($buildingId, $level);
|
||||
}
|
||||
|
||||
public static function registrationListener($eventData)
|
||||
{
|
||||
if (isset($eventData['user'])) {
|
||||
|
|
|
|||
|
|
@ -78,13 +78,10 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
*
|
||||
* @return Legacies_Empire_Model_Planet_Building_Shipyard
|
||||
*/
|
||||
public function updateQueue($time = null)
|
||||
public function updateQueue($time)
|
||||
{
|
||||
$fields = Legacies_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
if ($time === null) {
|
||||
$time = Legacies::now();
|
||||
}
|
||||
$elapsedTime = $time - $this->_currentPlanet->getData('b_building');
|
||||
|
||||
foreach ($this->getQueue() as $element) {
|
||||
|
|
@ -97,6 +94,7 @@ class Legacies_Empire_Model_Planet_Builder
|
|||
$this->_currentPlanet->setElement($buildingId, $level);
|
||||
$this->_currentPlanet->updateResourceProduction($time - $elapsedTime);
|
||||
$this->_currentPlanet->updateStorages($time - $elapsedTime);
|
||||
$this->_currentPlanet->updateBuildingFields();
|
||||
$this->dequeue($element);
|
||||
|
||||
Legacies::dispatchEvent('planet.building.level-update', array(
|
||||
|
|
|
|||
|
|
@ -207,13 +207,13 @@ class Legacies_Empire_Model_Planet_Building_Shipyard
|
|||
|
||||
/**
|
||||
* Return the construction queue
|
||||
* @see Legacies_Empire_Model_Planet_Building_Shipyard_Item
|
||||
* @see Legacies_Empire_Model_Planet_Building_Shipyard_Builder
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getQueue()
|
||||
public function getBuilder()
|
||||
{
|
||||
return $this->_queue;
|
||||
return $this->_builder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
class Legacies_Empire_Model_Planet_Ship_LightTransport
|
||||
implements Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE = 4;
|
||||
|
||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
|
||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) {
|
||||
return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
|
||||
} else {
|
||||
return $prices[Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT][Legacies_Empire::SHIPS_CELERITY_SECONDARY];
|
||||
}
|
||||
}
|
||||
|
||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_IMPULSE_DRIVE) {
|
||||
return pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE));
|
||||
} else {
|
||||
return pow(1.2, $user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,4 +9,14 @@ class Legacies_Empire_Model_Planet_Ship_SolarSatellite
|
|||
Legacies_Empire::RESOURCE_ENERGY => ((floatval($planet->getData('temp_max')) / 4) + 20) * (0.1 * $produtionRatio) * floatval($quantity)
|
||||
);
|
||||
}
|
||||
|
||||
public function getMaximumSpeed(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getActualMaximumSpeed(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,10 +3,36 @@
|
|||
class Legacies_Empire_Model_Planet_Ship_Supernova
|
||||
implements Legacies_Empire_Model_Planet_ResourceProductionInterface, Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE = 20;
|
||||
const REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY = 15;
|
||||
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
public function getBaseSpeed(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
|
||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE &&
|
||||
$user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) {
|
||||
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_PRIMARY];
|
||||
} else {
|
||||
return $prices[Legacies_Empire::ID_SHIP_SUPERNOVA][Legacies_Empire::SHIPS_CELERITY_SECONDARY];
|
||||
}
|
||||
}
|
||||
|
||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user)
|
||||
{
|
||||
if ($user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_DRIVE &&
|
||||
$user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY) < self::REQUIREMENT_TO_UPGRADE_CELERITY__RESEARCH_HYPERSPACE_TECHNOLOGY) {
|
||||
return pow(1.2, $user->getElement(Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE));
|
||||
} else {
|
||||
return pow(1.3, $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE)) *
|
||||
pow(1.1, $user->getElement(Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,4 +2,6 @@
|
|||
|
||||
interface Legacies_Empire_Model_Planet_ShipInterface
|
||||
{
|
||||
public function getBaseSpeed(Legacies_Empire_Model_User $user);
|
||||
public function getSpeedMultiplier(Legacies_Empire_Model_User $user);
|
||||
}
|
||||
|
|
@ -22,6 +22,13 @@ class Legacies_Empire_Model_User
|
|||
const PLANET_SORT_POSITION = 1;
|
||||
const PLANET_SORT_NAME = 2;
|
||||
|
||||
protected static $_cookieName = self::COOKIE_NAME;
|
||||
|
||||
public static function setCookieName($name)
|
||||
{
|
||||
self::$_cookieName = $name;
|
||||
}
|
||||
|
||||
public static function factory($id)
|
||||
{
|
||||
if ($id === null) {
|
||||
|
|
@ -44,7 +51,7 @@ class Legacies_Empire_Model_User
|
|||
$session = Legacies::getSession(self::SESSION_KEY);
|
||||
if ($session->hasData('user_id')) {
|
||||
$id = intval($session->getData('user_id'));
|
||||
} else if (Legacies::$request !== null && ($cookie = Legacies::$request->getCookie(self::COOKIE_NAME)) !== null) {
|
||||
} else if (Legacies::$request !== null && ($cookie = Legacies::$request->getCookie(self::$_cookieName)) !== null) {
|
||||
$cookieData = unserialize(stripslashes($cookie));
|
||||
if (is_array($cookieData)) {
|
||||
$collection = new Legacies_Core_Collection(array('user' => 'users'));
|
||||
|
|
@ -92,8 +99,8 @@ class Legacies_Empire_Model_User
|
|||
protected function _updateActivity()
|
||||
{
|
||||
$this
|
||||
->setData('request_uri', $_SERVER['REQUEST_URI'])
|
||||
->setData('remote_addr', $_SERVER['REMOTE_ADDR'])
|
||||
->setData('current_page', $_SERVER['REQUEST_URI'])
|
||||
->setData('user_lastip', $_SERVER['REMOTE_ADDR'])
|
||||
->setData('user_agent', $_SERVER['HTTP_USER_AGENT'])
|
||||
->setData('onlinetime', time())
|
||||
->save()
|
||||
|
|
@ -104,7 +111,7 @@ class Legacies_Empire_Model_User
|
|||
public function logout()
|
||||
{
|
||||
if (Legacies::$response !== null) {
|
||||
Legacies::$response->unsetCookie(self::COOKIE_NAME);
|
||||
Legacies::$response->unsetCookie(self::$_cookieName);
|
||||
}
|
||||
Legacies_Core_Model_Session::destroy();
|
||||
}
|
||||
|
|
@ -150,7 +157,7 @@ class Legacies_Empire_Model_User
|
|||
}
|
||||
|
||||
if (isset($_POST["rememberme"]) && Legacies::$request !== null) {
|
||||
Legacies::$response->setCookie(self::COOKIE_NAME, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
|
||||
Legacies::$response->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
|
||||
}
|
||||
|
||||
self::$_singleton = self::factory($login['id']);
|
||||
|
|
@ -190,6 +197,25 @@ class Legacies_Empire_Model_User
|
|||
return $user;
|
||||
}
|
||||
|
||||
public function updateCurrentPlanet($planetId)
|
||||
{
|
||||
$planetColelction = $this->_preparePlanetCollection()->where('id=:id');
|
||||
|
||||
$planetCollection->load(array(
|
||||
'id' => $planetId,
|
||||
'user' => $this->getId()
|
||||
));
|
||||
|
||||
if ($planetCollection->count() !== 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$planet = $planetCollection->current();
|
||||
$this->setData('current_planet', $planet->getId());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getCurrentPlanet()
|
||||
{
|
||||
$planetId = $this->getData('current_planet');
|
||||
|
|
@ -200,7 +226,7 @@ class Legacies_Empire_Model_User
|
|||
return Legacies_Empire_Model_Planet::factory($planetId);
|
||||
}
|
||||
|
||||
public function getPlanetCollection()
|
||||
protected function _preparePlanetCollection()
|
||||
{
|
||||
$planetCollection = new Legacies_Core_Collection(array('planet' => 'planets'), 'Legacies_Empire_Model_Planet');
|
||||
$planetCollection->where('id_owner=:user');
|
||||
|
|
@ -226,6 +252,12 @@ class Legacies_Empire_Model_User
|
|||
$planetCollection->order('planet.id', $order);
|
||||
break;
|
||||
}
|
||||
return $planetCollection;
|
||||
}
|
||||
|
||||
public function getPlanetCollection()
|
||||
{
|
||||
$planetCollection = $this->_preparePlanetCollection();
|
||||
|
||||
$planetCollection->load(array(
|
||||
'user' => $this->getId()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
defined('E_USER_DEPRECATED') || define('E_USER_DEPRECATED', E_USER_WARNING); // Defined in PHP 5.3 core
|
||||
|
||||
define('ADMINEMAIL', "admin@xnova-ng.org");
|
||||
define('GAMEURL', "http://".$_SERVER['HTTP_HOST']."/");
|
||||
|
||||
|
|
|
|||
|
|
@ -468,7 +468,7 @@
|
|||
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_PRIMARY => 500,
|
||||
Legacies_Empire::SHIPS_CELERITY_SECONDARY => 1000,
|
||||
Legacies_Empire::SHIPS_CAPACITY => 1000000
|
||||
),
|
||||
|
|
|
|||
|
|
@ -22,6 +22,38 @@
|
|||
Legacies_Empire::ID_BUILDING_JUMP_GATE,
|
||||
Legacies_Empire::ID_BUILDING_MISSILE_SILO
|
||||
),
|
||||
|
||||
Legacies_Empire::TYPE_BUILDING_PLANET => 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_MISSILE_SILO
|
||||
),
|
||||
|
||||
Legacies_Empire::TYPE_BUILDING_MOON => array(
|
||||
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_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
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
|
|
@ -118,6 +150,24 @@
|
|||
Legacies_Empire::ID_BUILDING_FUSION_REACTOR,
|
||||
Legacies_Empire::ID_SHIP_SOLAR_SATELLITE,
|
||||
Legacies_Empire::ID_SHIP_SUPERNOVA
|
||||
),
|
||||
// }}}
|
||||
|
||||
//
|
||||
// Mission types
|
||||
// {{{
|
||||
Legacies_Empire::TYPE_FLEET_MISSION => array(
|
||||
Legacies_Empire::ID_MISSION_ATTACK,
|
||||
Legacies_Empire::ID_MISSION_GROUP_ATTACK,
|
||||
Legacies_Empire::ID_MISSION_TRANSPORT,
|
||||
Legacies_Empire::ID_MISSION_STATION,
|
||||
Legacies_Empire::ID_MISSION_STATION_ALLY,
|
||||
Legacies_Empire::ID_MISSION_SPY,
|
||||
Legacies_Empire::ID_MISSION_SETTLE_COLONY,
|
||||
Legacies_Empire::ID_MISSION_RECYCLE,
|
||||
Legacies_Empire::ID_MISSION_DESTROY,
|
||||
Legacies_Empire::ID_MISSION_MISSILES,
|
||||
Legacies_Empire::ID_MISSION_EXPEDITION,
|
||||
)
|
||||
// }}}
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
if ( defined('INSIDE') ) {
|
||||
include(ROOT_PATH . 'db/mysql.'.PHPEXT);
|
||||
}
|
||||
428
includes/deprecated.php
Normal file
428
includes/deprecated.php
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
<?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 method used to add a building to the planet building list.
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
* @param int $buildingId
|
||||
* @param bool $AddMode
|
||||
*/
|
||||
function AddBuildingToQueue($currentPlanet, $currentUser, $buildingId, $AddMode = true)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->appendBuildingQueue($buildingId, !$AddMode);
|
||||
|
||||
return $currentPlanet->getBuildingQueue()->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecaed function used to save the planet record
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function BuildingSavePlanetRecord($currentPlanet)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecaed function used to save the user record
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
*/
|
||||
function BuildingSaveUserRecord($currentUser)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentUser instanceof Legacies_Empire_Model_User) {
|
||||
trigger_error('$currentUser should be an instance of Legacies_Empire_Model_User', E_USER_WARNING);
|
||||
$currentUser = Legacies_Empire_Model_User::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$currentUser->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
*/
|
||||
function CheckPlanetBuildingQueue($currentPlanet, $currentUser)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Legacies_Empire_Model_User) {
|
||||
trigger_error('$currentUser should be an instance of Legacies_Empire_Model_User', E_USER_WARNING);
|
||||
$currentUser = Legacies_Empire_Model_User::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->updateBuildingQueue();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function CheckPlanetUsedFields($currentPlanet)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->updateStorages()->save();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $buildingId
|
||||
* @param bool $incremental
|
||||
* @param bool $destroy
|
||||
*/
|
||||
function GetBuildingPrice($currentUser, $currentPlanet, $buildingId, $incremental = true, $destroy = false)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Legacies_Empire_Model_User) {
|
||||
trigger_error('$currentUser should be an instance of Legacies_Empire_Model_User', E_USER_WARNING);
|
||||
$currentUser = Legacies_Empire_Model_User::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
if ($types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) {
|
||||
$level = $currentPlanet->getElement($buildingId);
|
||||
|
||||
if ($incremental) {
|
||||
if (!$destroy) {
|
||||
$level++;
|
||||
} else {
|
||||
$level--;
|
||||
}
|
||||
}
|
||||
|
||||
$resources = $currentPlanet->getResourcesNeeded($buildingId, $level);
|
||||
return array(
|
||||
'metal' => $resources[Legacies_Empire::RESOURCE_METAL],
|
||||
'crystal' => $resources[Legacies_Empire::RESOURCE_CRISTAL],
|
||||
'deuterium' => $resources[Legacies_Empire::RESOURCE_DEUTERIUM],
|
||||
'energy_max' => $resources[Legacies_Empire::RESOURCE_ENERGY]
|
||||
);
|
||||
} else if ($types->is($buildingId, Legacies_Empire::TYPE_RESEARCH)) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
return array(
|
||||
'metal' => 0,
|
||||
'crystal' => 0,
|
||||
'deuterium' => 0,
|
||||
'energy_max' => 0
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $buildingId
|
||||
*/
|
||||
function GetBuildingTime($currentUser, $currentPlanet, $buildingId)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Legacies_Empire_Model_User) {
|
||||
trigger_error('$currentUser should be an instance of Legacies_Empire_Model_User', E_USER_WARNING);
|
||||
$currentUser = Legacies_Empire_Model_User::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
if ($types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) {
|
||||
return $currentPlanet->getBuildingTime($buildingId, 1);
|
||||
} else if ($types->is($buildingId, Legacies_Empire::TYPE_RESEARCH)) {
|
||||
return $currentPlanet->getLaboratory()->getBuildingTime($buildingId, 1);
|
||||
} else if ($types->is($buildingId, Legacies_Empire::TYPE_SHIP) || $types->is($buildingId, Legacies_Empire::TYPE_DEFENSE)) {
|
||||
return $currentPlanet->getShipyard()->getBuildingTime($buildingId, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $Element
|
||||
* @param int|string $level
|
||||
*/
|
||||
function GetBuildingTimeLevel($currentUser, $currentPlanet, $buildingId, $level)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Legacies_Empire_Model_User) {
|
||||
trigger_error('$currentUser should be an instance of Legacies_Empire_Model_User', E_USER_WARNING);
|
||||
$currentUser = Legacies_Empire_Model_User::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
if ($types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) {
|
||||
return $currentPlanet->getBuildingTime($buildingId, $level);
|
||||
} else if ($types->is($buildingId, Legacies_Empire::TYPE_RESEARCH)) {
|
||||
return $currentPlanet->getLaboratory()->getBuildingTime($buildingId, $level);
|
||||
} else if ($types->is($buildingId, Legacies_Empire::TYPE_SHIP) || $types->is($buildingId, Legacies_Empire::TYPE_DEFENSE)) {
|
||||
return $currentPlanet->getShipyard()->getBuildingTime($buildingId, $level);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $buildingId
|
||||
* @param unknown_type $userfactor
|
||||
*/
|
||||
function GetElementPrice($currentUser, $currentPlanet, $buildingId, $userfactor = true)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Legacies_Empire_Model_User) {
|
||||
trigger_error('$currentUser should be an instance of Legacies_Empire_Model_User', E_USER_WARNING);
|
||||
$currentUser = Legacies_Empire_Model_User::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
global $lang;
|
||||
|
||||
$prices = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
$types = Legacies_Empire_Model_Game_Types::getSingleton();
|
||||
|
||||
$array = array(
|
||||
Legacies_Empire::RESOURCE_METAL => $lang["Metal"],
|
||||
Legacies_Empire::RESOURCE_CRISTAL => $lang["Crystal"],
|
||||
Legacies_Empire::RESOURCE_DEUTERIUM => $lang["Deuterium"],
|
||||
Legacies_Empire::RESOURCE_ENERGY => $lang["Energy"]
|
||||
);
|
||||
|
||||
if ($types->is($buildingId, Legacies_Empire::TYPE_BUILDING)) {
|
||||
$cost = $currentPlanet->getResourcesNeeded($buildingId, $currentPlanet->getElement($buildingId) + 1);
|
||||
} else if ($types->is($buildingId, Legacies_Empire::TYPE_RESEARCH)) {
|
||||
// TODO
|
||||
} else if ($types->is($buildingId, Legacies_Empire::TYPE_SHIP) || $types->is($buildingId, Legacies_Empire::TYPE_DEFENSE)) {
|
||||
$cost = $currentPlanet->getShipyard()->getResourcesNeeded($buildingId, 1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
$output = $lang['Requires'] . ": ";
|
||||
foreach ($array as $resourceId => $resourceLabel) {
|
||||
if (Math::isPositive($prices[$buildingId][$resourceId])) {
|
||||
$output .= $resourceLabel . ": ";
|
||||
|
||||
if (Math::comp($cost[$resourceId], $currentPlanet->getData($resourceId)) > 0) {
|
||||
$text .= '<b style="color:red;"><t title="-' . Math::render(Math::sub($cost[$resourceId], $currentPlanet->getData($resourceId))) . '">';
|
||||
$text .= '<span class="noresources">' . Math::render($cost[$resourceId]) . '</span></t></b>';
|
||||
} else {
|
||||
$text .= '<b style="color:lime;"> <span class="noresources">' . Math::render($cost[$resourceId]) . '</span></b>';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param int $elementId
|
||||
* @param int|string $count
|
||||
*/
|
||||
function GetElementRessources($elementId, $count)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$currentUser = Legacies_Empire_Model_User::getSingleton();
|
||||
$currentPlanet = $currentUser->getCurrentPlanet();
|
||||
|
||||
return $currentPlanet->getShipyard()->getResourcesNeeded($buildingId, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $productionTime
|
||||
*
|
||||
* @see Lagecies_Empire_Model_Planet::updateBuildingQueue()
|
||||
*/
|
||||
function HandleElementBuildingQueue($currentUser, $currentPlanet, $productionTime)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param bool $isUserChecked
|
||||
*
|
||||
* @see Legacies_Empire_Model_User::getSingleton()
|
||||
*/
|
||||
function CheckCookies($isUserChecked)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$user = Legacies_Empire_Model_User::getSingleton();
|
||||
|
||||
if ($user instanceof Legacies_Empire_Model_User) {
|
||||
return array(
|
||||
'state' => true,
|
||||
'record' => $user
|
||||
);
|
||||
} else {
|
||||
return array(
|
||||
'state' => false,
|
||||
'record' => array()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param bool $isUserChecked
|
||||
*
|
||||
* @see Legacies_Empire_Model_User::getSingleton()
|
||||
*/
|
||||
function CheckTheUser($isUserChecked)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$result = CheckCookies($isUserChecked);
|
||||
|
||||
if ($result['record'] instanceof Legacies_Empire_Model_User && $result['record']['bana']) {
|
||||
die(parsetemplate(gettemplate('usr_banned'), $lang));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
* @param Legacies_Empire_Model_User|array $currentUser
|
||||
*
|
||||
* @see Legacies_Empire_Model_Planet::updateBuildingQueue()
|
||||
*/
|
||||
function UpdatePlanetBatimentQueueList($currentPlanet, $currentUser)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->updateBuildingQueue(Legacies::now());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Legacies_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function CalculateMaxPlanetFields($currentPlanet)
|
||||
{
|
||||
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$currentPlanet instanceof Legacies_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Legacies_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Legacies_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
return max(1, $currentPlanet['field_max'] + ($currentPlanet->getElement(Legacies_Empire::ID_BUILDING_TERRAFORMER) * 5));
|
||||
}
|
||||
|
|
@ -171,15 +171,3 @@ function StdFooter() {
|
|||
$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);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
* @param unknown_type $planetrow
|
||||
*/
|
||||
function AbandonColony($user,$planetrow) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$destruyed = time() + 3600; //Temps avant la suppression dans la galaxie
|
||||
$DeleteMoon = false;
|
||||
if ($planetrow["planet_type"]==1){
|
||||
|
|
|
|||
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
* @param unknown_type $string
|
||||
*/
|
||||
function bbcode($string) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$pattern = array(
|
||||
'/\\n/',
|
||||
'/\\r/',
|
||||
|
|
@ -77,6 +78,7 @@ function bbcode($string) {
|
|||
|
||||
function image($string)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
//On va pas se casser le fion a lire les accents quand meme !!!!!!!
|
||||
$string = str_replace("'", "'", $string);
|
||||
|
||||
|
|
@ -99,12 +101,14 @@ function image($string)
|
|||
|
||||
|
||||
function sCode($string){
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$pattern = '/\<img src=\\\"(.*?)img\/smilies\/(.*?).png\\\" alt=\\\"(.*?)\\\" \/>/s';
|
||||
$string = preg_replace($pattern, '\3', $string);
|
||||
return '<pre>' . trim($string) . '</pre>';
|
||||
}
|
||||
|
||||
function sList($string) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$tmp = explode('[*]', stripslashes($string));
|
||||
$out = null;
|
||||
foreach($tmp as $list) {
|
||||
|
|
@ -116,6 +120,7 @@ function sList($string) {
|
|||
}
|
||||
|
||||
function imagefix($img) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
if(substr($img, 0, 7) != 'http://') {
|
||||
$img = './images/' . $img;
|
||||
}
|
||||
|
|
@ -123,6 +128,7 @@ function imagefix($img) {
|
|||
}
|
||||
|
||||
function urlfix($url, $title) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$title = stripslashes($title);
|
||||
return '<a href="' . $url . '" title="' . $title . '">' . $title . '</a>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function BatimentBuildingPage (&$CurrentPlanet, $CurrentUser) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $resource, $reslist, $dpath, $gameConfig, $_GET;
|
||||
|
||||
CheckPlanetUsedFields ( $CurrentPlanet );
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
* @param unknown_type $Record
|
||||
*/
|
||||
function BuildFleetEventTable ( $FleetRow, $Status, $Owner, $Label, $Record ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang;
|
||||
|
||||
$FleetStyle = array (
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
* @deprecated
|
||||
*/
|
||||
function BuildFlyingFleetTable () {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang;
|
||||
|
||||
$TableTPL = gettemplate('admin/fleet_rows');
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
*/
|
||||
function 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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function BuildingSaveUserRecord ( $CurrentUser ) {
|
||||
|
||||
$QryUpdateUser = "UPDATE {{table}} SET ";
|
||||
$QryUpdateUser .= "`xpminier` = '". $CurrentUser['xpminier'] ."' ";
|
||||
$QryUpdateUser .= "WHERE ";
|
||||
$QryUpdateUser .= "`id` = '". $CurrentUser["id"] ."';";
|
||||
doquery( $QryUpdateUser, 'users');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function CancelBuildingFromQueue ( &$CurrentPlanet, &$CurrentUser ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$CurrentQueue = $CurrentPlanet['b_building_id'];
|
||||
if ($CurrentQueue != 0) {
|
||||
|
|
|
|||
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $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
|
||||
);
|
||||
}
|
||||
|
|
@ -33,14 +33,9 @@
|
|||
* @deprecated
|
||||
* @param unknown_type $String
|
||||
*/
|
||||
function CheckInputStrings ( $String ) {
|
||||
global $ListCensure;
|
||||
function CheckInputStrings($string)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$ValidString = $String;
|
||||
for ($Mot = 0; $Mot < count($ListCensure); $Mot++) {
|
||||
$ValidString = eregi_replace( "$ListCensure[$Mot]", "*", $ValidString );
|
||||
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
return ($ValidString);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
* @param unknown_type $CurrentPlanet
|
||||
*/
|
||||
function CheckLabSettingsInQueue ( $CurrentPlanet ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $gameConfig;
|
||||
|
||||
if ($CurrentPlanet['b_building_id'] != "0") {
|
||||
|
|
|
|||
|
|
@ -1,156 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function 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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $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');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
*/
|
||||
function CheckTheUser($IsUserChecked)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $user;
|
||||
includeLang('admin');
|
||||
$Result = CheckCookies( $IsUserChecked );
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
*/
|
||||
function CreateOneMoonRecord ( $Galaxy, $System, $Planet, $Owner, $MoonID, $MoonName, $Chance ) {
|
||||
global $lang;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$PlanetName = "";
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
*/
|
||||
function PlanetSizeRandomiser ($Position, $HomeWorld = false) {
|
||||
global $gameConfig;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (!$HomeWorld) {
|
||||
$ClassicBase = 163;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
*/
|
||||
function DefensesBuildingPage ( &$currentPlanet, $currentUser ) {
|
||||
global $lang, $resource, $dpath;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
// 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) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
*/
|
||||
function DeleteSelectedUser ( $UserID ) {
|
||||
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$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 );
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
function ElementBuildListBox ( $CurrentUser, $CurrentPlanet ) {
|
||||
global $lang, $pricelist;
|
||||
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
// // Array del b_hangar_id
|
||||
// $ElementQueue = explode(';', $CurrentPlanet['b_hangar_id']);
|
||||
// $NbrePerType = "";
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
function ElementBuildListQueue ( $CurrentUser, $CurrentPlanet ) {
|
||||
// Jamais appelé pour le moment donc totalement modifiable !
|
||||
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
/*
|
||||
alter table `ogame`.`game_planets`
|
||||
change `name` `name` varchar (255) NULL COLLATE latin1_general_ci,
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
*/
|
||||
function FleetBuildingPage(&$currentPlanet, &$currentUser)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $resource, $dpath;
|
||||
|
||||
// S'il n'y a pas de Chantier
|
||||
|
|
|
|||
|
|
@ -33,90 +33,79 @@
|
|||
* @deprecated
|
||||
* @param unknown_type $planet
|
||||
*/
|
||||
function FlyingFleetHandler (&$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", "");
|
||||
//trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$sql =<<<SQL_EOF
|
||||
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
|
||||
SQL_EOF;
|
||||
//doquery($sql, ''); // FIXME: use transactions
|
||||
|
||||
$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)) {
|
||||
if (!$planet instanceof Legacies_Empire_Model_Planet) {var_dump($planet);}
|
||||
foreach ($planet->getFleetCollection(Legacies::now()) as $CurrentFleet) {
|
||||
var_dump($CurrentFleet);
|
||||
switch ($CurrentFleet["fleet_mission"]) {
|
||||
case 1:
|
||||
case Legacies_Empire::ID_MISSION_ATTACK:
|
||||
// Attaquer
|
||||
MissionCaseAttack ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// Attaque groupée
|
||||
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = '". $CurrentFleet['fleet_id'] ."';", 'fleets');
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case Legacies_Empire::ID_MISSION_TRANSPORT:
|
||||
// Transporter
|
||||
MissionCaseTransport ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case Legacies_Empire::ID_MISSION_STATION:
|
||||
// Stationner
|
||||
MissionCaseStay ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case Legacies_Empire::ID_MISSION_STATION_ALLY:
|
||||
// Stationner chez un Allié
|
||||
MissionCaseStayAlly ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 6:
|
||||
case Legacies_Empire::ID_MISSION_SPY:
|
||||
// Flotte d'espionnage
|
||||
MissionCaseSpy ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case Legacies_Empire::ID_MISSION_SETTLE_COLONY:
|
||||
// Coloniser
|
||||
MissionCaseColonisation ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 8:
|
||||
case Legacies_Empire::ID_MISSION_RECYCLE:
|
||||
// Recyclage
|
||||
MissionCaseRecycling ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 9:
|
||||
case Legacies_Empire::ID_MISSION_DESTROY:
|
||||
// Detruire ??? dans le code ogame c'est 9 !!
|
||||
MissionCaseDestruction ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case 10:
|
||||
// Missiles !!
|
||||
|
||||
break;
|
||||
|
||||
case 15:
|
||||
case Legacies_Empire::ID_MISSION_EXPEDITION:
|
||||
// Expeditions
|
||||
MissionCaseExpedition ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
default: {
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $CurrentFleet['fleet_id'] ."';", 'fleets');
|
||||
}
|
||||
case Legacies_Empire::ID_MISSION_GROUP_ATTACK: // TODO: implement mission type
|
||||
case Legacies_Empire::ID_MISSION_MISSILES: // TODO: implement mission type
|
||||
default:
|
||||
$CurrentFleet->delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
doquery("UNLOCK TABLES", "");
|
||||
//doquery("UNLOCK TABLES", ""); // FIXME: use transactions
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
* @param unknown_type $lunarow
|
||||
*/
|
||||
function CheckAbandonMoonState ($lunarow) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
if (($lunarow['destruyed'] + 172800) <= time() && $lunarow['destruyed'] != 0) {
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id = '" . $lunarow['id'] . "'", "lunas");
|
||||
}
|
||||
|
|
@ -45,6 +46,7 @@ function CheckAbandonMoonState ($lunarow) {
|
|||
* @deprecated
|
||||
*/
|
||||
function CheckAbandonPlanetState (&$planet) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
if ($planet['destruyed'] <= time()) {
|
||||
$id = $planet['id'];
|
||||
doquery("DELETE FROM {{table}} WHERE id={$id}", 'planets');
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
* @deprecated
|
||||
*/
|
||||
function GalaxyLegendPopup () {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang;
|
||||
|
||||
$Result = "<a href=# style=\"cursor: pointer;\"";
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowActions ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $user, $dpath, $CurrentMIP, $CurrentSystem, $CurrentGalaxy;
|
||||
// Icones action
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=125>";
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowAlly ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $user;
|
||||
|
||||
// Alliances
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowDebris ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $dpath, $CurrentRC, $user, $pricelist;
|
||||
// Cdr
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=30>";
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowMoon ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $user, $dpath, $HavePhalanx, $CurrentSystem, $CurrentGalaxy, $CanDestroy;
|
||||
|
||||
// Lune
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowPlanet ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $dpath, $user, $HavePhalanx, $CurrentSystem, $CurrentGalaxy;
|
||||
|
||||
// Planete (Image)
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowPlanetName ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $user, $HavePhalanx, $CurrentSystem, $CurrentGalaxy;
|
||||
|
||||
// Planete (Nom)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
* @param unknown_type $GalaxyRow
|
||||
*/
|
||||
function GalaxyRowPos ( $Planet, $GalaxyRow ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
// Pos
|
||||
$Result = "<th width=30>";
|
||||
$Result .= "<a href=\"#\"";
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowUser ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang, $user;
|
||||
|
||||
// Joueur
|
||||
|
|
|
|||
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $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);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $user
|
||||
* @param unknown_type $planet
|
||||
* @param unknown_type $Element
|
||||
* @param unknown_type $userfactor
|
||||
*/
|
||||
function GetElementPrice($user, $planet, $Element, $userfactor = true) {
|
||||
global $pricelist, $resource, $lang;
|
||||
|
||||
if ($userfactor) {
|
||||
$level = ($planet[$resource[$Element]]) ? $planet[$resource[$Element]] : $user[$resource[$Element]];
|
||||
}
|
||||
|
||||
$is_buyeable = true;
|
||||
$array = array(
|
||||
'metal' => $lang["Metal"],
|
||||
'crystal' => $lang["Crystal"],
|
||||
'deuterium' => $lang["Deuterium"],
|
||||
'energy_max' => $lang["Energy"]
|
||||
);
|
||||
|
||||
$text = $lang['Requires'] . ": ";
|
||||
foreach ($array as $ResType => $ResTitle) {
|
||||
if ($pricelist[$Element][$ResType] != 0) {
|
||||
$text .= $ResTitle . ": ";
|
||||
if ($userfactor) {
|
||||
$cost = floor($pricelist[$Element][$ResType] * pow($pricelist[$Element]['factor'], $level));
|
||||
} else {
|
||||
$cost = floor($pricelist[$Element][$ResType]);
|
||||
}
|
||||
if ($cost > $planet[$ResType]) {
|
||||
$text .= "<b style=\"color:red;\"> <t title=\"-" . pretty_number ($cost - $planet[$ResType]) . "\">";
|
||||
$text .= "<span class=\"noresources\">" . pretty_number($cost) . "</span></t></b> ";
|
||||
$is_buyeable = false; //style="cursor: pointer;"
|
||||
} else {
|
||||
$text .= "<b style=\"color:lime;\"> <span class=\"noresources\">" . pretty_number($cost) . "</span></b> ";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of XNova:Legacies
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://www.xnova-ng.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* --> NOTICE <--
|
||||
* This file is part of the core development branch, changing its contents will
|
||||
* make you unable to use the automatic updates manager. Please refer to the
|
||||
* documentation for further information about customizing XNova.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Element
|
||||
* @param unknown_type $Count
|
||||
*/
|
||||
function GetElementRessources ( $Element, $Count ) {
|
||||
global $pricelist;
|
||||
|
||||
$ResType['metal'] = ($pricelist[$Element]['metal'] * $Count);
|
||||
$ResType['crystal'] = ($pricelist[$Element]['crystal'] * $Count);
|
||||
$ResType['deuterium'] = ($pricelist[$Element]['deuterium'] * $Count);
|
||||
|
||||
return $ResType;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
*/
|
||||
function GetMaxConstructibleElements ($Element, $Ressources) {
|
||||
global $pricelist;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
// On test les 4 Type de ressource pour voir si au moins on sait en construire 1
|
||||
if ($pricelist[$Element]['metal'] != 0) {
|
||||
$ResType_1_Needed = $pricelist[$Element]['metal'];
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
*/
|
||||
function GetMissileRange () {
|
||||
global $resource, $user;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if ($user[$resource[117]] > 0) {
|
||||
$MissileRange = ($user[$resource[117]] * 5) - 1;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
* @param unknown_type $PhalanxLevel
|
||||
*/
|
||||
function GetPhalanxRange ( $PhalanxLevel ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
// Niveau 1 2 3 4 5 6 7 = lvl
|
||||
// Portée ajouté 0 3 5 7 9 11 13 = (lvl * 2) - 1
|
||||
// Phalanx en nbre de systemes 0 3 8 15 24 35 48 =
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
*/
|
||||
function GetRestPrice ($user, $planet, $Element, $userfactor = true) {
|
||||
global $pricelist, $resource, $lang;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if ($userfactor) {
|
||||
$level = ($planet[$resource[$Element]]) ? $planet[$resource[$Element]] : $user[$resource[$Element]];
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
*/
|
||||
function HandleTechnologieBuild ( &$CurrentPlanet, &$CurrentUser ) {
|
||||
global $resource;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if ($CurrentUser['b_tech_planet'] != 0) {
|
||||
// Y a une technologie en cours sur une de mes colonies
|
||||
|
|
|
|||
|
|
@ -35,5 +35,6 @@
|
|||
*/
|
||||
function InsertBuildListScript($CallProgram)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
return null;
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@
|
|||
*/
|
||||
function InsertGalaxyScripts ( $CurrentPlanet ) {
|
||||
global $lang;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$Script = "<div style=\"top: 10px;\" id=\"content\">";
|
||||
$Script .= "<script language=\"JavaScript\">\n";
|
||||
$Script .= "function galaxy_submit(value) {\n";
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
* @param unknown_type $Init
|
||||
*/
|
||||
function InsertJavaScriptChronoApplet ( $Type, $Ref, $Value, $Init ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
if ($Init == true) {
|
||||
$JavaString = "<script type=\"text/javascript\">\n";
|
||||
$JavaString .= "function t". $Type . $Ref ."() {\n";
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
*/
|
||||
function IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, $Incremental = true, $ForDestroy = false) {
|
||||
global $pricelist, $resource;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if (IsVacationMode($CurrentUser)) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
function IsOfficierAccessible ($CurrentUser, $Officier) {
|
||||
global $requirements, $resource, $pricelist;
|
||||
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
if (isset($requirements[$Officier])) {
|
||||
$enabled = true;
|
||||
foreach($requirements[$Officier] as $ReqOfficier => $OfficierLevel) {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
*/
|
||||
function IsTechnologieAccessible($user, $planet, $element)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $requirements, $resource;
|
||||
|
||||
if (isset($requirements[$element])) {
|
||||
|
|
|
|||
|
|
@ -35,10 +35,11 @@
|
|||
*/
|
||||
function IsVacationMode($CurrentUser){
|
||||
global $gameConfig;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if($CurrentUser['urlaubs_modus'] == 1){
|
||||
$query = doquery("SELECT * FROM {{table}} WHERE id_owner = '{$CurrentUser['id']}'", 'planets');
|
||||
while($id = mysql_fetch_array($query)){
|
||||
while ($id = $query->fetch(PDO::FETCH_BOTH)){
|
||||
doquery("UPDATE {{table}} SET
|
||||
metal_perhour = '".$gameConfig['metal_basic_income']."',
|
||||
crystal_perhour = '".$gameConfig['crystal_basic_income']."',
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
* @param unknown_type $TwoLines
|
||||
*/
|
||||
function MessageForm ($Title, $Message, $Goto = '', $Button = ' ok ', $TwoLines = false) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$Form = "<center>";
|
||||
$Form .= "<form action=\"". $Goto ."\" method=\"post\">";
|
||||
$Form .= "<table width=\"519\">";
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
* @param unknown_type $IDAversaire
|
||||
*/
|
||||
function MipAttack ($NbreMip, $IDAversaire) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$TechnoArme = doquery("SELECT * FROM {{table}} WHERE `id`='" . $user['id'] . "'", "users");
|
||||
$InfoAdversaire = doquery("SELECT * FROM {{table}} WHERE `id`='" . $IDAversaire . "'", "planets", true);
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
*/
|
||||
function MissionCaseAttack($FleetRow)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $lang;
|
||||
|
||||
$pricelist = Legacies_Empire_Model_Game_Prices::getSingleton();
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
*/
|
||||
function MissionCaseColonisation ( $FleetRow ) {
|
||||
global $lang, $resource;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$iPlanetCount = mysql_result(doquery ("SELECT count(*) FROM {{table}} WHERE `id_owner` = '". $FleetRow['fleet_owner'] ."' AND `planet_type` = '1'", 'planets'), 0);
|
||||
if ($FleetRow['fleet_mess'] == 0) {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
function MissionCaseDestruction($FleetRow)
|
||||
{
|
||||
global $user, $pricelist, $lang, $resource, $CombatCaps, $gameConfig;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
includeLang('system');
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
*/
|
||||
function MissionCaseExpedition ( $FleetRow ) {
|
||||
global $lang, $resource, $pricelist;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$FleetOwner = $FleetRow['fleet_owner'];
|
||||
$MessSender = $lang['sys_mess_qg'];
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
*/
|
||||
function MissionCaseRecycling ($FleetRow) {
|
||||
global $pricelist, $lang;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
if ($FleetRow["fleet_mess"] == "0") {
|
||||
if ($FleetRow['fleet_start_time'] <= time()) {
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue