Updated data access layer
Renamed classes, methods & variables from "User" to "Player" Fixed dependencies requirements in the research lab queue Updated overview Added MVC's controller Added build files Updated directory structure Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
d40313279a
commit
690a7f60f3
1435 changed files with 5772 additions and 5764 deletions
95
src/includes/CombatEngine.php
Normal file
95
src/includes/CombatEngine.php
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
$CombatCaps = Wootook_Empire_Model_Game_Combat::getSingleton();
|
||||
|
||||
$AtFleet = array ( 203 => 2 );
|
||||
$AtTechn = array ( 109 => 3, 110 => 5, 111 => 3 );
|
||||
$AtCount = 1;
|
||||
|
||||
$DfFleet = array ( 402 => 9 );
|
||||
$DfTechn = array ( 109 => 7, 110 => 7, 111 => 5 );
|
||||
$DfCount = 1;
|
||||
|
||||
|
||||
// Données en entrée :
|
||||
// $AttackFleet -> array de tableaux des flottes attaquantes
|
||||
// $AttackTech -> array de tableaux des technologies des attaquants ainsi que leur id
|
||||
// $AttackCount -> Nbre d'attaquants ( de 1 a 5 )
|
||||
// $TargetFleet -> array de tableaux des flottes defenseurs
|
||||
// $TargetTech -> array de tableaux des technologies des defenseurs ainsi que leur id
|
||||
// $TargetCount -> Nbre de defenseurs ( de 1 a 5 )
|
||||
//
|
||||
function FleetCombat ( $AttackFleet, $AttackTech, $AttackCount, $TargetFleet, $TargetTech, $TargetCount ) {
|
||||
|
||||
}
|
||||
|
||||
function GetWeaponsPerType ( $TypeArray, $Tech ) {
|
||||
global $capacity;
|
||||
// Calcul de la force d'Attaque
|
||||
if (!is_null($TypeArray)) {
|
||||
foreach($TypeArray as $Type => $Count) {
|
||||
$Attack[$Type] = round ($capacity[$Type]['attack'] + (($capacity[$Type]['attack'] * $Tech['109']) / 10));
|
||||
$Units['attack'] += $Count * $Attack[$Type];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function GetShiedsPerType ( $TypeArray, $Tech ) {
|
||||
global $capacity;
|
||||
// Calcul des points de Bouclier
|
||||
if (!is_null($TypeArray)) {
|
||||
foreach($TypeArray as $Type => $Count) {
|
||||
$Shield[$Type] = round ($capacity[$Type]['shield'] + (($capacity[$Type]['shield'] * $Tech['110']) / 10));
|
||||
$Units['shield'] += $Count * $Shield[$Type];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function GetHullPerType ( $TypeArray, $Tech ) {
|
||||
global $pricelist;
|
||||
// Calcul des points de Coque
|
||||
if (!is_null($TypeArray)) {
|
||||
$Units['metal'] = 0;
|
||||
$Units['crystal'] = 0;
|
||||
$Units['deuterium'] = 0;
|
||||
foreach($TypeArray as $Type => $Count) {
|
||||
$Hull[$Type] = ($pricelist[$Type]['metal'] + $pricelist[$Type]['crystal']) + ((($pricelist[$Type]['metal'] + $pricelist[$Type]['crystal']) * $Tech['111']) / 10);
|
||||
$Units['metal'] += $Count * $pricelist[$Type]['metal'];
|
||||
$Units['crystal'] += $Count * $pricelist[$Type]['crystal'];
|
||||
$Units['deuterium'] += $Count * $pricelist[$Type]['deuterium'];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
1327
src/includes/aks.php
Normal file
1327
src/includes/aks.php
Normal file
File diff suppressed because it is too large
Load diff
273
src/includes/ataki.php
Normal file
273
src/includes/ataki.php
Normal file
|
|
@ -0,0 +1,273 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
function walka ($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno) {
|
||||
global $pricelist, $CombatCaps;
|
||||
$runda = array();
|
||||
$atakujacy_n = array();
|
||||
$wrog_n = array();
|
||||
|
||||
// Calcul des points de Structure de l'attaquant
|
||||
if (!is_null($CurrentSet)) {
|
||||
$atakujacy_zlom_poczatek['metal'] = 0;
|
||||
$atakujacy_zlom_poczatek['crystal'] = 0;
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
$atakujacy_zlom_poczatek['metal'] = $atakujacy_zlom_poczatek['metal'] + $CurrentSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$atakujacy_zlom_poczatek['crystal'] = $atakujacy_zlom_poczatek['crystal'] + $CurrentSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
}
|
||||
}
|
||||
|
||||
// Calcul des points de Structure du défenseur
|
||||
$wrog_zlom_poczatek['metal'] = 0;
|
||||
$wrog_zlom_poczatek['crystal'] = 0;
|
||||
$wrog_poczatek = $TargetSet;
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $a => $b) {
|
||||
if ($a < 300) {
|
||||
$wrog_zlom_poczatek['metal'] = $wrog_zlom_poczatek['metal'] + $TargetSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$wrog_zlom_poczatek['crystal'] = $wrog_zlom_poczatek['crystal'] + $TargetSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
} else {
|
||||
$wrog_zlom_poczatek_obrona['metal'] = $wrog_zlom_poczatek_obrona['metal'] + $TargetSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$wrog_zlom_poczatek_obrona['crystal'] = $wrog_zlom_poczatek_obrona['crystal'] + $TargetSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 1; $i <= 7; $i++) {
|
||||
$atakujacy_atak = 0;
|
||||
$wrog_atak = 0;
|
||||
$atakujacy_obrona = 0;
|
||||
$wrog_obrona = 0;
|
||||
$atakujacy_ilosc = 0;
|
||||
$wrog_ilosc = 0;
|
||||
$wrog_tarcza = 0;
|
||||
$atakujacy_tarcza = 0;
|
||||
|
||||
if (!is_null($CurrentSet)) {
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
$CurrentSet[$a]["obrona"] = $CurrentSet[$a]['count'] * ($pricelist[$a]['metal'] + $pricelist[$a]['crystal']) / 10 * (1 + (0.1 * ($CurrentTechno["defence_tech"]) + (0.05 * $user['rpg_amiral'])));
|
||||
$rand = rand(80, 120) / 100;
|
||||
$CurrentSet[$a]["tarcza"] = $CurrentSet[$a]['count'] * $CombatCaps[$a]['shield'] * (1 + (0.1 * $CurrentTechno["shield_tech"]) + (0.05 * $user['rpg_amiral'])) * $rand;
|
||||
$atak_statku = $CombatCaps[$a]['attack'];
|
||||
$technologie = (1 + (0.1 * $CurrentTechno["military_tech"]+(0.05 * $user['rpg_amiral'])));
|
||||
$rand = rand(80, 120) / 100;
|
||||
$ilosc = $CurrentSet[$a]['count'];
|
||||
$CurrentSet[$a]["atak"] = $ilosc * $atak_statku * $technologie * $rand;
|
||||
$atakujacy_atak = $atakujacy_atak + $CurrentSet[$a]["atak"];
|
||||
$atakujacy_obrona = $atakujacy_obrona + $CurrentSet[$a]["obrona"];
|
||||
$atakujacy_ilosc = $atakujacy_ilosc + $CurrentSet[$a]['count'];
|
||||
}
|
||||
} else {
|
||||
$atakujacy_ilosc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $a => $b) {
|
||||
$TargetSet[$a]["obrona"] = $TargetSet[$a]['count'] * ($pricelist[$a]['metal'] + $pricelist[$a]['crystal']) / 10 * (1 + (0.1 * ($TargetTechno["defence_tech"]) + (0.05 * $user['rpg_amiral'])));
|
||||
$rand = rand(80, 120) / 100;
|
||||
$TargetSet[$a]["tarcza"] = $TargetSet[$a]['count'] * $CombatCaps[$a]['shield'] * (1 + (0.1 * $TargetTechno["shield_tech"])+ (0.05 * $user['rpg_amiral'])) * $rand;
|
||||
$atak_statku = $CombatCaps[$a]['attack'];
|
||||
$technologie = (1 + (0.1 * $TargetTechno["military_tech"]) + (0.05 * $user['rpg_amiral']));
|
||||
$rand = rand(80, 120) / 100;
|
||||
$ilosc = $TargetSet[$a]['count'];
|
||||
$TargetSet[$a]["atak"] = $ilosc * $atak_statku * $technologie * $rand;
|
||||
$wrog_atak = $wrog_atak + $TargetSet[$a]["atak"];
|
||||
$wrog_obrona = $wrog_obrona + $TargetSet[$a]["obrona"];
|
||||
$wrog_ilosc = $wrog_ilosc + $TargetSet[$a]['count'];
|
||||
}
|
||||
} else {
|
||||
$wrog_ilosc = 0;
|
||||
$runda[$i]["atakujacy"] = $CurrentSet;
|
||||
$runda[$i]["wrog"] = $TargetSet;
|
||||
$runda[$i]["atakujacy"]["atak"] = $atakujacy_atak;
|
||||
$runda[$i]["wrog"]["atak"] = $wrog_atak;
|
||||
$runda[$i]["atakujacy"]['count'] = $atakujacy_ilosc;
|
||||
$runda[$i]["wrog"]['count'] = $wrog_ilosc;
|
||||
break;
|
||||
}
|
||||
|
||||
$runda[$i]["atakujacy"] = $CurrentSet;
|
||||
$runda[$i]["wrog"] = $TargetSet;
|
||||
$runda[$i]["atakujacy"]["atak"] = $atakujacy_atak;
|
||||
$runda[$i]["wrog"]["atak"] = $wrog_atak;
|
||||
$runda[$i]["atakujacy"]['count'] = $atakujacy_ilosc;
|
||||
$runda[$i]["wrog"]['count'] = $wrog_ilosc;
|
||||
|
||||
if (($atakujacy_ilosc == 0) or ($wrog_ilosc == 0)) {
|
||||
break;
|
||||
}
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
if ($atakujacy_ilosc > 0) {
|
||||
$wrog_moc = $CurrentSet[$a]['count'] * $wrog_atak / $atakujacy_ilosc;
|
||||
if ($CurrentSet[$a]["tarcza"] < $wrog_moc) {
|
||||
$max_zdjac = floor($CurrentSet[$a]['count'] * $wrog_ilosc / $atakujacy_ilosc);
|
||||
$wrog_moc = $wrog_moc - $CurrentSet[$a]["tarcza"];
|
||||
$atakujacy_tarcza = $atakujacy_tarcza + $CurrentSet[$a]["tarcza"];
|
||||
$ile_zdjac = floor(($wrog_moc / (($pricelist[$a]['metal'] + $pricelist[$a]['crystal']) / 10)));
|
||||
if ($ile_zdjac > $max_zdjac) {
|
||||
$ile_zdjac = $max_zdjac;
|
||||
}
|
||||
$atakujacy_n[$a]['count'] = ceil($CurrentSet[$a]['count'] - $ile_zdjac);
|
||||
if ($atakujacy_n[$a]['count'] <= 0) {
|
||||
$atakujacy_n[$a]['count'] = 0;
|
||||
}
|
||||
} else {
|
||||
$atakujacy_n[$a]['count'] = $CurrentSet[$a]['count'];
|
||||
$atakujacy_tarcza = $atakujacy_tarcza + $wrog_moc;
|
||||
}
|
||||
} else {
|
||||
$atakujacy_n[$a]['count'] = $CurrentSet[$a]['count'];
|
||||
$atakujacy_tarcza = $atakujacy_tarcza + $wrog_moc;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($TargetSet as $a => $b) {
|
||||
if ($wrog_ilosc > 0) {
|
||||
$atakujacy_moc = $TargetSet[$a]['count'] * $atakujacy_atak / $wrog_ilosc;
|
||||
if ($TargetSet[$a]["tarcza"] < $atakujacy_moc) {
|
||||
$max_zdjac = floor($TargetSet[$a]['count'] * $atakujacy_ilosc / $wrog_ilosc);
|
||||
$atakujacy_moc = $atakujacy_moc - $TargetSet[$a]["tarcza"];
|
||||
$wrog_tarcza = $wrog_tarcza + $TargetSet[$a]["tarcza"];
|
||||
$ile_zdjac = floor(($atakujacy_moc / (($pricelist[$a]['metal'] + $pricelist[$a]['crystal']) / 10)));
|
||||
if ($ile_zdjac > $max_zdjac) {
|
||||
$ile_zdjac = $max_zdjac;
|
||||
}
|
||||
$wrog_n[$a]['count'] = ceil($TargetSet[$a]['count'] - $ile_zdjac);
|
||||
if ($wrog_n[$a]['count'] <= 0) {
|
||||
$wrog_n[$a]['count'] = 0;
|
||||
}
|
||||
} else {
|
||||
$wrog_n[$a]['count'] = $TargetSet[$a]['count'];
|
||||
$wrog_tarcza = $wrog_tarcza + $atakujacy_moc;
|
||||
}
|
||||
} else {
|
||||
$wrog_n[$a]['count'] = $TargetSet[$a]['count'];
|
||||
$wrog_tarcza = $wrog_tarcza + $atakujacy_moc;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
foreach ($CombatCaps[$a]['sd'] as $c => $d) {
|
||||
if (isset($TargetSet[$c])) {
|
||||
$wrog_n[$c]['count'] = $wrog_n[$c]['count'] - floor($d * rand(50, 100) / 100);
|
||||
if ($wrog_n[$c]['count'] <= 0) {
|
||||
$wrog_n[$c]['count'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($TargetSet as $a => $b) {
|
||||
foreach ($CombatCaps[$a]['sd'] as $c => $d) {
|
||||
if (isset($CurrentSet[$c])) {
|
||||
$atakujacy_n[$c]['count'] = $atakujacy_n[$c]['count'] - floor($d * rand(50, 100) / 100);
|
||||
if ($atakujacy_n[$c]['count'] <= 0) {
|
||||
$atakujacy_n[$c]['count'] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$runda[$i]["atakujacy"]["tarcza"] = $atakujacy_tarcza;
|
||||
$runda[$i]["wrog"]["tarcza"] = $wrog_tarcza;
|
||||
// print_r($runda[$i]);
|
||||
$TargetSet = $wrog_n;
|
||||
$CurrentSet = $atakujacy_n;
|
||||
}
|
||||
|
||||
if (($atakujacy_ilosc == 0) or ($wrog_ilosc == 0)) {
|
||||
if (($atakujacy_ilosc == 0) and ($wrog_ilosc == 0)) {
|
||||
$wygrana = "r";
|
||||
} else {
|
||||
if ($atakujacy_ilosc == 0) {
|
||||
$wygrana = "w";
|
||||
} else {
|
||||
$wygrana = "a";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$i = sizeof($runda);
|
||||
$runda[$i]["atakujacy"] = $CurrentSet;
|
||||
$runda[$i]["wrog"] = $TargetSet;
|
||||
$runda[$i]["atakujacy"]["atak"] = $atakujacy_atak;
|
||||
$runda[$i]["wrog"]["atak"] = $wrog_atak;
|
||||
$runda[$i]["atakujacy"]['count'] = $atakujacy_ilosc;
|
||||
$runda[$i]["wrog"]['count'] = $wrog_ilosc;
|
||||
$wygrana = "r";
|
||||
}
|
||||
$atakujacy_zlom_koniec['metal'] = 0;
|
||||
$atakujacy_zlom_koniec['crystal'] = 0;
|
||||
if (!is_null($CurrentSet)) {
|
||||
foreach($CurrentSet as $a => $b) {
|
||||
$atakujacy_zlom_koniec['metal'] = $atakujacy_zlom_koniec['metal'] + $CurrentSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$atakujacy_zlom_koniec['crystal'] = $atakujacy_zlom_koniec['crystal'] + $CurrentSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
}
|
||||
}
|
||||
$wrog_zlom_koniec['metal'] = 0;
|
||||
$wrog_zlom_koniec['crystal'] = 0;
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $a => $b) {
|
||||
if ($a < 300) {
|
||||
$wrog_zlom_koniec['metal'] = $wrog_zlom_koniec['metal'] + $TargetSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$wrog_zlom_koniec['crystal'] = $wrog_zlom_koniec['crystal'] + $TargetSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
} else {
|
||||
$wrog_zlom_koniec_obrona['metal'] = $wrog_zlom_koniec_obrona['metal'] + $TargetSet[$a]['count'] * $pricelist[$a]['metal'];
|
||||
$wrog_zlom_koniec_obrona['crystal'] = $wrog_zlom_koniec_obrona['crystal'] + $TargetSet[$a]['count'] * $pricelist[$a]['crystal'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$ilosc_wrog = 0;
|
||||
$straty_obrona_wrog = 0;
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $a => $b) {
|
||||
if ($a > 300) {
|
||||
$straty_obrona_wrog = $straty_obrona_wrog + (($wrog_poczatek[$a]['count'] - $TargetSet[$a]['count']) * ($pricelist[$a]['metal'] + $pricelist[$a]['crystal']));
|
||||
$TargetSet[$a]['count'] = $TargetSet[$a]['count'] + (($wrog_poczatek[$a]['count'] - $TargetSet[$a]['count']) * rand(60, 80) / 100);
|
||||
$ilosc_wrog = $ilosc_wrog + $TargetSet[$a]['count'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (($ilosc_wrog > 0) and ($atakujacy_ilosc == 0)) {
|
||||
$wygrana = "w";
|
||||
}
|
||||
|
||||
$zlom['metal'] = ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * (Wootook::getGameConfig('game/debris/fleet') ? (Wootook::getGameConfig('game/debris/metal-percent') / 100) : 0));
|
||||
$zlom['crystal'] = ((($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal'])) * (Wootook::getGameConfig('game/debris/fleet') ? (Wootook::getGameConfig('game/debris/cristal-percent') / 100) : 0));
|
||||
|
||||
$zlom['metal'] += ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * (Wootook::getGameConfig('game/debris/defense') ? (Wootook::getGameConfig('game/debris/metal-percent') / 100) : 0));
|
||||
$zlom['crystal'] += ((($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal'])) * (Wootook::getGameConfig('game/debris/defense') ? (Wootook::getGameConfig('game/debris/cristal-percent') / 100) : 0));
|
||||
|
||||
$zlom["atakujacy"] = (($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($atakujacy_zlom_poczatek['crystal'] - $atakujacy_zlom_koniec['crystal']));
|
||||
$zlom["wrog"] = (($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal']) + $straty_obrona_wrog);
|
||||
return array("atakujacy" => $CurrentSet, "wrog" => $TargetSet, "wygrana" => $wygrana, "dane_do_rw" => $runda, "zlom" => $zlom);
|
||||
}
|
||||
|
||||
?>
|
||||
247
src/includes/bb.class.php
Normal file
247
src/includes/bb.class.php
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
<?php
|
||||
|
||||
// Si la constante n'est pas defini on bloque l'execution du fichier
|
||||
if(!defined('PHPSIMUL_PAGES') || @PHPSIMUL_PAGES != 'PHPSIMULLL')
|
||||
{
|
||||
die('Erreur 404 - Le fichier n\'a pas <20>t<EFBFBD> trouv<75>');
|
||||
}
|
||||
|
||||
/* PHPsimul : Cr<EFBFBD>ez votre jeu de simulation en PHP
|
||||
Copyright (<EFBFBD>) - 2007 - CAPARROS S<EFBFBD>bastien (Camaris)
|
||||
|
||||
Codeur officiel: Camaris & Max485
|
||||
http://forum.epic-arena.fr
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
class bb
|
||||
{
|
||||
##############################################################################################################
|
||||
// Fonction d<>vlopp<70> par Max485 pour affichez le bbcode
|
||||
|
||||
function bbcode($texte)
|
||||
{
|
||||
|
||||
//on supprime les slashs qui se seraient ajout<75>s automatiquement
|
||||
$texte = stripslashes($texte) ;
|
||||
//on d<>sactive le HTML
|
||||
$texte = htmlspecialchars($texte) ;
|
||||
//on g<>n<EFBFBD>re des retours chariots automatiques !!!
|
||||
$texte = nl2br($texte) ;
|
||||
|
||||
//on cr<63>e le bbcode qui sera appliqu<71> <20> notre texte !
|
||||
$bbcode=array(
|
||||
//mise en gras
|
||||
"!\[b\](.+)\[/b\]!isU",
|
||||
//soulignement
|
||||
"!\[u\](.+)\[/u\]!isU",
|
||||
//mise en italique
|
||||
"!\[i\](.+)\[/i\]!isU",
|
||||
//mise en couleur
|
||||
"!\[color=(.+)\](.+)\[/color\]!isU",
|
||||
//liste <20> puces 1
|
||||
"!\[ul\](.+)\[/ul\]!U",
|
||||
//liste <20> puces 2
|
||||
"!\[li\](.+)\[/li\]!U",
|
||||
// Lien nomm<6D>
|
||||
"!\[url=(.+?)\](.+?)\[\/url\]!i",
|
||||
//afficher les images
|
||||
"!\[img\](.+)\[/img\]!i",
|
||||
// Lien
|
||||
"!\[url\](.+?)\[\/url\]!i",
|
||||
// Email nomm<6D>
|
||||
"!\[email=(.+?)\](.+?)\[\/email\]!i",
|
||||
// Email
|
||||
"!\[email\](.+?)\[\/email\]!i",
|
||||
// Size H1
|
||||
"!\[size=1\](.+)\[/size\]!i",
|
||||
// Size H2
|
||||
"!\[size=2\](.+)\[/size\]!i",
|
||||
// Size H3
|
||||
"!\[size=3\](.+)\[/size\]!i",
|
||||
// Size H4
|
||||
"!\[size=4\](.+)\[/size\]!i",
|
||||
// Size H5
|
||||
"!\[size=5\](.+)\[/size\]!i",
|
||||
// Size Tres petit
|
||||
"!\[size=tres petit\](.+)\[/size\]!i",
|
||||
// Size Petit
|
||||
"!\[size=petit\](.+)\[/size\]!i",
|
||||
// Size Normal
|
||||
"!\[size=normal\](.+)\[/size\]!i",
|
||||
// Size Moyen
|
||||
"!\[size=moyen\](.+)\[/size\]!i",
|
||||
// Size Grand
|
||||
"!\[size=grand\](.+)\[/size\]!i",
|
||||
// Size 18
|
||||
"!\[size=18\](.+)\[/size\]!i",
|
||||
// Quote
|
||||
"!\[quote\](.+)\[/quote\]!i",
|
||||
//Quote nomm<6D>
|
||||
"!\[quote=(.+)\](.+)\[/quote\]!i",
|
||||
// Code
|
||||
"!\[code\](.+)\[/code\]!i",
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
$html = array(
|
||||
//mise en gras
|
||||
"<b>$1</b>",
|
||||
//soulignement
|
||||
"<u>$1</u>",
|
||||
//mise en italique
|
||||
"<i>$1</i>",
|
||||
//mise en couleur
|
||||
"<span style=\"color:$1\">$2</span>",
|
||||
//liste <20> puce 1
|
||||
"<ul>$1</ul>",
|
||||
//liste <20> puce 2
|
||||
"<li>$1</li>",
|
||||
// Lien nomm<6D>
|
||||
"<a href=\"$1\">$2</a>",
|
||||
//afficher les images
|
||||
"<img src=\"$1\">",
|
||||
// Lien
|
||||
"<a href=\"$1\">$1</a>",
|
||||
// Email nomm<6D>
|
||||
"<a href=\"mailto:$1\">$2</a>",
|
||||
// Email
|
||||
"<a href=\"mailto:$1\">$1</a>",
|
||||
//Size H1
|
||||
"<h1>$1</h1>",
|
||||
//Size H2
|
||||
"<h2>$1</h2>",
|
||||
//Size H3
|
||||
"<h3>$1</h3>",
|
||||
//Size H4
|
||||
"<h4>$1</h4>",
|
||||
//Size H5
|
||||
"<h5>$1</h5>",
|
||||
//Size Tres Petit
|
||||
"<h1>$1</h1>",
|
||||
//Size Petit
|
||||
"<h3>$1</h3>",
|
||||
//Size Normal
|
||||
"<h4>$1</h4>",
|
||||
//Size Moyen
|
||||
"<h6>$1</h6>",
|
||||
//Size Grand
|
||||
"<h7>$1</h7>",
|
||||
// Size 18
|
||||
"<h6>$1</h6>",
|
||||
// Quote
|
||||
"<br><u><b>Citation :</b></u><table cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"left\" bgcolor=\"red\"><tr><td bgcolor=\"#FFFFFF\"><font color=\"#000000\"><b>$1</b><br></font></td></tr></table><br><br>",
|
||||
// Quote nomm<6D>
|
||||
"<br><u><b>$1 :</b></u><table cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"left\" bgcolor=\"red\"><tr><td bgcolor=\"#FFFFFF\"><font color=\"#000000\"><b>$2</b><br></font></td></tr></table><br><br>",
|
||||
// Code
|
||||
"<br><u><b>Code :</b></u><table cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"left\" bgcolor=\"red\"><tr><td bgcolor=\"#FFFFFF\"><font color=\"#000000\"><b>$1</b><br></font></td></tr></table><br><br>",
|
||||
|
||||
);
|
||||
|
||||
$texte = preg_replace($bbcode,$html,$texte);
|
||||
|
||||
return $texte ;
|
||||
|
||||
}
|
||||
##############################################################################################################
|
||||
function div_page($nb_s,$d,$id,$cat,$nb_ep)
|
||||
{
|
||||
if($nb_s > $nb_ep)
|
||||
{
|
||||
$nb_p = ceil($nb_s / $nb_ep);
|
||||
$p_suiv = $d+1;
|
||||
$p_prec = $d-1;
|
||||
|
||||
if($d > 1)
|
||||
{
|
||||
echo '<a href="?cat='.$cat.'&id='.$id.'&d=1"><< </a>';
|
||||
echo '<a href="?cat='.$cat.'&id='.$id.'&d='.$p_prec.'">< </a>';
|
||||
}
|
||||
|
||||
echo '<span class="p"> Page n<> '.$d.' / '.$nb_p.'</span>';
|
||||
|
||||
if($d < $nb_p)
|
||||
{
|
||||
echo '<a href="?cat='.$cat.'&id='.$id.'&d='.$p_suiv.'"> ></a>';
|
||||
echo '<a href="?cat='.$cat.'&id='.$id.'&d='.$nb_p.'"> >></a>';
|
||||
}
|
||||
echo ' <br /><br />';
|
||||
}
|
||||
}
|
||||
|
||||
function div_page_l($nb_s,$d,$id,$p,$s)
|
||||
{
|
||||
|
||||
if(strlen($s) > 1)
|
||||
{
|
||||
$s_lien = "&s=".$s;
|
||||
}
|
||||
else
|
||||
{
|
||||
$s_lien = "";
|
||||
}
|
||||
|
||||
if($nb_s > 10)
|
||||
{
|
||||
echo' <br />';
|
||||
$nb_p = ceil($nb_s / 10);
|
||||
$p_suiv = $p+1;
|
||||
$p_prec = $p-1;
|
||||
|
||||
if($p > 1)
|
||||
{
|
||||
echo '<a href="?cat=4&id='.$id.'&d='.$d.'&p=1'.$s_lien.'"><< </a>';
|
||||
echo '<a href="?cat=4&id='.$id.'&d='.$d.'&p='.$p_prec.$s_lien.'">< </a>';
|
||||
}
|
||||
|
||||
echo '<span class="p"> Page n<> '.$p.' / '.$nb_p.'</span>';
|
||||
|
||||
if($p < $nb_p)
|
||||
{
|
||||
echo '<a href="?cat=4&id='.$id.'&d='.$d.'&p='.$p_suiv.$s_lien.'"> ></a>';
|
||||
echo '<a href="?cat=4&id='.$id.'&d='.$d.'&p='.$nb_p.$s_lien.'"> >></a>';
|
||||
}
|
||||
echo ' <br />';
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
##############################################################################################################
|
||||
function smileys($chaine)
|
||||
{
|
||||
global $userrow;
|
||||
|
||||
$chaine = str_replace(":D", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/sourire.gif' />", $chaine);
|
||||
$chaine = str_replace(";)", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/clin.gif' />", $chaine);
|
||||
$chaine = str_replace(":(", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/triste.gif' />", $chaine);
|
||||
$chaine = str_replace(":surpris:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/yeuxrond.gif' />", $chaine);
|
||||
$chaine = str_replace(":o", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/etonne.gif' />", $chaine);
|
||||
$chaine = str_replace(":confus:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/confus.gif' />", $chaine);
|
||||
$chaine = str_replace(":lol:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/lol.gif' />", $chaine);
|
||||
$chaine = str_replace(":fire:", " <img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/flame.gif' />", $chaine);
|
||||
$chaine = str_replace(":splif:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/petard.gif' />", $chaine);
|
||||
$chaine = str_replace(":bigsmile:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/green.gif' />", $chaine);
|
||||
$chaine = str_replace(":x", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/mod.gif' />", $chaine);
|
||||
$chaine = str_replace(":roll:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/rolleyes.gif' />", $chaine);
|
||||
$chaine = str_replace(":bigcry:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/crying.gif' />", $chaine);
|
||||
$chaine = str_replace(":colere:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/colere.gif' />", $chaine);
|
||||
$chaine = str_replace(":P", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/razz.gif' />", $chaine);
|
||||
$chaine = str_replace("8)", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/lunettes.gif' />", $chaine);
|
||||
$chaine = str_replace(":)", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/sourire.gif' />", $chaine);
|
||||
$chaine = str_replace("^^oops:", "<img alt='' style='border:0px;' src='templates/".$userrow["template"]."/images/forum/smileys/redface.gif.gif' />", $chaine);
|
||||
|
||||
return($chaine);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
72
src/includes/constants.php
Normal file
72
src/includes/constants.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
defined('E_USER_DEPRECATED') || define('E_USER_DEPRECATED', E_USER_WARNING); // Defined in PHP 5.3 core
|
||||
|
||||
define('ADMINEMAIL', "no-reply@wootook.org");
|
||||
|
||||
/**
|
||||
* User level constants
|
||||
* {{{
|
||||
*/
|
||||
define('LEVEL_ADMIN', 3);
|
||||
define('LEVEL_OPERATOR', 2);
|
||||
define('LEVEL_MODERATOR', 1);
|
||||
define('LEVEL_PLAYER', 0);
|
||||
/**
|
||||
* }}}
|
||||
*/
|
||||
|
||||
// Nombre de colones pour les rapports d'espionnage
|
||||
define('SPY_REPORT_ROW', 2);
|
||||
|
||||
// Cases données par niveau de Base Lunaire
|
||||
define('FIELDS_BY_MOONBASIS_LEVEL', 4);
|
||||
|
||||
// Nombre maximum de colonie par joueur
|
||||
define('MAX_PLAYER_PLANETS', 9);
|
||||
|
||||
// Nombre maximum d'element dans la liste de construction de batiments
|
||||
define('MAX_BUILDING_QUEUE_SIZE', 5);
|
||||
|
||||
// Nombre maximum d'element dans une ligne de liste de construction flotte et defenses
|
||||
define('MAX_FLEET_OR_DEFS_PER_ROW', 100000000);
|
||||
|
||||
// Taux de depassement possible dans l'espace de stockage des hangars ...
|
||||
// 1.0 pour 100% - 1.1 pour 110% etc ...
|
||||
define('MAX_OVERFLOW', 1);
|
||||
|
||||
define('SHOW_ADMIN_IN_RECORDS', false);
|
||||
|
||||
// Valeurs de bases pour les colonies ou planetes fraichement crées
|
||||
define('BASE_STORAGE_SIZE', 100000);
|
||||
|
||||
// Chemin vers le skin de base
|
||||
define('DEFAULT_SKINPATH', 'skin/frontend/base/default/');
|
||||
551
src/includes/databaseinfos.php
Normal file
551
src/includes/databaseinfos.php
Normal file
|
|
@ -0,0 +1,551 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
$QryTableAks = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableAks .= "`id` bigint(20) unsigned NOT NULL auto_increment, ";
|
||||
$QryTableAks .= "`name` varchar(50) collate latin1_general_ci default NULL, ";
|
||||
$QryTableAks .= "`teilnehmer` text collate latin1_general_ci, ";
|
||||
$QryTableAks .= "`flotten` text collate latin1_general_ci, ";
|
||||
$QryTableAks .= "`ankunft` int(32) default NULL, ";
|
||||
$QryTableAks .= "`galaxy` int(2) default NULL, ";
|
||||
$QryTableAks .= "`system` int(4) default NULL, ";
|
||||
$QryTableAks .= "`planet` int(2) default NULL, ";
|
||||
$QryTableAks .= "`eingeladen` int(11) default NULL, ";
|
||||
$QryTableAks .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableAks .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table annonce
|
||||
$QryTableAnnonce = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableAnnonce .= "`id` int(11) NOT NULL auto_increment, ";
|
||||
$QryTableAnnonce .= "`user` text collate latin1_general_ci NOT NULL, ";
|
||||
$QryTableAnnonce .= "`galaxie` int(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`systeme` int(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`metala` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`cristala` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`deuta` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`metals` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`cristals` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "`deuts` bigint(11) NOT NULL, ";
|
||||
$QryTableAnnonce .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableAnnonce .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table alliance
|
||||
$QryTableAlliance = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableAlliance .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableAlliance .= "`ally_name` varchar(32) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_tag` varchar(8) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableAlliance .= "`ally_register_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableAlliance .= "`ally_description` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_web` varchar(255) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_text` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_image` varchar(255) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_request` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_request_waiting` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_request_notallow` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableAlliance .= "`ally_owner_range` varchar(32) character set latin1 default '', ";
|
||||
$QryTableAlliance .= "`ally_ranks` text character set latin1, ";
|
||||
$QryTableAlliance .= "`ally_members` int(11) NOT NULL default '0', ";
|
||||
$QryTableAlliance .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableAlliance .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table banned
|
||||
$QryTableBanned = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableBanned .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableBanned .= "`who` varchar(11) character set latin1 NOT NULL default '', ";
|
||||
$QryTableBanned .= "`theme` text character set latin1 NOT NULL, ";
|
||||
$QryTableBanned .= "`who2` varchar(11) character set latin1 NOT NULL default '', ";
|
||||
$QryTableBanned .= "`time` int(11) NOT NULL default '0', ";
|
||||
$QryTableBanned .= "`longer` int(11) NOT NULL default '0', ";
|
||||
$QryTableBanned .= "`author` varchar(11) character set latin1 NOT NULL default '', ";
|
||||
$QryTableBanned .= "`email` varchar(20) character set latin1 NOT NULL default '', ";
|
||||
$QryTableBanned .= "KEY `ID` (`id`) ";
|
||||
$QryTableBanned .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table buddy
|
||||
$QryTableBuddy = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableBuddy .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableBuddy .= "`sender` int(11) NOT NULL default '0', ";
|
||||
$QryTableBuddy .= "`owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableBuddy .= "`active` tinyint(3) NOT NULL default '0', ";
|
||||
$QryTableBuddy .= "`text` text character set latin1, ";
|
||||
$QryTableBuddy .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableBuddy .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table chat
|
||||
$QryTableChat = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableChat .= "`messageid` int(5) unsigned NOT NULL auto_increment, ";
|
||||
$QryTableChat .= "`user` varchar(255) NOT NULL default '', ";
|
||||
$QryTableChat .= "`message` text NOT NULL, ";
|
||||
$QryTableChat .= "`timestamp` int(11) NOT NULL default '0', ";
|
||||
$QryTableChat .= "PRIMARY KEY (`messageid`) ";
|
||||
$QryTableChat .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table config
|
||||
$QryTableConfig = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableConfig .= "`config_name` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableConfig .= "`config_value` text character set latin1 NOT NULL ";
|
||||
$QryTableConfig .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Valeurs de base de la config
|
||||
$QryInsertConfig = "INSERT INTO `{{table}}` ";
|
||||
$QryInsertConfig .= "(`config_name` , `config_value`) VALUES ";
|
||||
$QryInsertConfig .= "('users_amount' , '0'), ";
|
||||
$QryInsertConfig .= "('game_speed' , '2500'), ";
|
||||
$QryInsertConfig .= "('fleet_speed' , '2500'), ";
|
||||
$QryInsertConfig .= "('resource_multiplier' , '1'), ";
|
||||
$QryInsertConfig .= "('Fleet_Cdr' , '30'), ";
|
||||
$QryInsertConfig .= "('Defs_Cdr' , '30'), ";
|
||||
$QryInsertConfig .= "('initial_fields' , '163'), ";
|
||||
$QryInsertConfig .= "('COOKIE_NAME' , 'Wootook Legacies'), ";
|
||||
$QryInsertConfig .= "('game_name' , 'Wootook Legacies'), ";
|
||||
$QryInsertConfig .= "('game_disable' , '1'), ";
|
||||
$QryInsertConfig .= "('close_reason' , 'Le jeu est clos pour le moment!'), ";
|
||||
$QryInsertConfig .= "('metal_basic_income' , '20'), ";
|
||||
$QryInsertConfig .= "('crystal_basic_income' , '10'), ";
|
||||
$QryInsertConfig .= "('deuterium_basic_income', '0'), ";
|
||||
$QryInsertConfig .= "('energy_basic_income' , '0'), ";
|
||||
$QryInsertConfig .= "('BuildLabWhileRun' , '0'), ";
|
||||
$QryInsertConfig .= "('LastSettedGalaxyPos' , '1'), ";
|
||||
$QryInsertConfig .= "('LastSettedSystemPos' , '8'), ";
|
||||
$QryInsertConfig .= "('LastSettedPlanetPos' , '3'), ";
|
||||
$QryInsertConfig .= "('urlaubs_modus_erz' , '1'), ";
|
||||
$QryInsertConfig .= "('noobprotection' , '1'), ";
|
||||
$QryInsertConfig .= "('noobprotectiontime' , '5000'), ";
|
||||
$QryInsertConfig .= "('noobprotectionmulti' , '5'), ";
|
||||
$QryInsertConfig .= "('forum_url' , 'http://board.xnova-ng.org/' ), ";
|
||||
$QryInsertConfig .= "('OverviewNewsFrame' , '1' ), ";
|
||||
$QryInsertConfig .= "('OverviewNewsText' , 'Bienvenue sur le nouveau serveur Wootook Legacies' ), ";
|
||||
$QryInsertConfig .= "('OverviewExternChat' , '0' ), ";
|
||||
$QryInsertConfig .= "('OverviewExternChatCmd' , '' ), ";
|
||||
$QryInsertConfig .= "('OverviewBanner' , '0' ), ";
|
||||
$QryInsertConfig .= "('OverviewClickBanner' , '' ), ";
|
||||
$QryInsertConfig .= "('ExtCopyFrame' , '0' ), ";
|
||||
$QryInsertConfig .= "('ExtCopyOwner' , '' ), ";
|
||||
$QryInsertConfig .= "('ExtCopyFunct' , '' ), ";
|
||||
$QryInsertConfig .= "('ForumBannerFrame' , '0' ), ";
|
||||
$QryInsertConfig .= "('stat_settings' , '1000' ), ";
|
||||
$QryInsertConfig .= "('link_enable' , '0' ), ";
|
||||
$QryInsertConfig .= "('link_name' , '' ), ";
|
||||
$QryInsertConfig .= "('link_url' , '' ), ";
|
||||
$QryInsertConfig .= "('enable_announces' , '1' ), ";
|
||||
$QryInsertConfig .= "('enable_marchand' , '1'), ";
|
||||
$QryInsertConfig .= "('enable_notes' , '1'), ";
|
||||
$QryInsertConfig .= "('bot_name' , 'XNoviana Reali'), ";
|
||||
$QryInsertConfig .= "('bot_adress' , 'xnova@xnova-ng.org' ), ";
|
||||
$QryInsertConfig .= "('banner_source_post' , '../images/bann.png' ), ";
|
||||
$QryInsertConfig .= "('ban_duration' , '30' ), ";
|
||||
$QryInsertConfig .= "('enable_bot' , '0' ), ";
|
||||
$QryInsertConfig .= "('enable_bbcode' , '1' ), ";
|
||||
$QryInsertConfig .= "('debug' , '0') ";
|
||||
$QryInsertConfig .= ";";
|
||||
|
||||
|
||||
// Table declared (multicomptes)
|
||||
$QryTabledeclared = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTabledeclared .= "`declarator`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`declared_1`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`declared_2`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`declared_3`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`reason`TEXT NOT NULL, ";
|
||||
$QryTabledeclared .= "`declarator_name`TEXT NOT NULL ";
|
||||
|
||||
$QryTabledeclared .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table errors
|
||||
$QryTableErrors = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableErrors .= "`error_id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableErrors .= "`error_sender` varchar(32) character set latin1 NOT NULL default '0', ";
|
||||
$QryTableErrors .= "`error_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableErrors .= "`error_type` varchar(32) character set latin1 NOT NULL default 'unknown', ";
|
||||
$QryTableErrors .= "`error_text` text character set latin1, ";
|
||||
$QryTableErrors .= "PRIMARY KEY (`error_id`) ";
|
||||
$QryTableErrors .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table fleets
|
||||
$QryTableFleets = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableFleets .= "`fleet_id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableFleets .= "`fleet_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_mission` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_amount` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_array` text character set latin1, ";
|
||||
$QryTableFleets .= "`fleet_start_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_start_galaxy` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_start_system` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_start_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_start_type` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_stay` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_galaxy` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_system` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_end_type` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_taget_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_resource_metal` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_resource_crystal` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_resource_deuterium` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_target_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`fleet_group` int (11) NOT NULL DEFAULT '0', ";
|
||||
$QryTableFleets .= "`fleet_mess` int(11) NOT NULL default '0', ";
|
||||
$QryTableFleets .= "`start_time` int(11) default NULL, ";
|
||||
$QryTableFleets .= "PRIMARY KEY (`fleet_id`) ";
|
||||
$QryTableFleets .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table galaxy
|
||||
$QryTableGalaxy = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableGalaxy .= "`galaxy` int(2) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`system` int(3) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`planet` int(2) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`id_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`metal` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`crystal` bigint(11) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`id_luna` int(11) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "`luna` int(2) NOT NULL default '0', ";
|
||||
$QryTableGalaxy .= "KEY `galaxy` (`galaxy`), ";
|
||||
$QryTableGalaxy .= "KEY `system` (`system`), ";
|
||||
$QryTableGalaxy .= "KEY `planet` (`planet`) ";
|
||||
$QryTableGalaxy .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table iraks
|
||||
$QryTableIraks = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableIraks .= "`id` bigint(20) unsigned NOT NULL auto_increment, ";
|
||||
$QryTableIraks .= "`zeit` int(32) default NULL, ";
|
||||
$QryTableIraks .= "`galaxy` int(2) default NULL, ";
|
||||
$QryTableIraks .= "`system` int(4) default NULL, ";
|
||||
$QryTableIraks .= "`planet` int(2) default NULL, ";
|
||||
$QryTableIraks .= "`galaxy_angreifer` int(2) default NULL, ";
|
||||
$QryTableIraks .= "`system_angreifer` int(4) default NULL, ";
|
||||
$QryTableIraks .= "`planet_angreifer` int(2) default NULL, ";
|
||||
$QryTableIraks .= "`owner` int(32) default NULL, ";
|
||||
$QryTableIraks .= "`zielid` int(32) default NULL, ";
|
||||
$QryTableIraks .= "`anzahl` int(32) default NULL, ";
|
||||
$QryTableIraks .= "`primaer` int(32) default NULL, ";
|
||||
$QryTableIraks .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableIraks .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table lunas
|
||||
$QryTableLunas = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableLunas .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableLunas .= "`id_luna` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "`name` varchar(11) character set latin1 NOT NULL default 'Lune', ";
|
||||
$QryTableLunas .= "`image` varchar(11) character set latin1 NOT NULL default 'mond', ";
|
||||
$QryTableLunas .= "`destruyed` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "`id_owner` int(11) default NULL, ";
|
||||
$QryTableLunas .= "`galaxy` int(11) default NULL, ";
|
||||
$QryTableLunas .= "`system` int(11) default NULL, ";
|
||||
$QryTableLunas .= "`lunapos` int(11) default NULL, ";
|
||||
$QryTableLunas .= "`temp_min` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "`temp_max` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "`diameter` int(11) NOT NULL default '0', ";
|
||||
$QryTableLunas .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableLunas .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table messages
|
||||
$QryTableMessages = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableMessages .= "`message_id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableMessages .= "`message_owner` int(11) NOT NULL default '0', ";
|
||||
$QryTableMessages .= "`message_sender` int(11) NOT NULL default '0', ";
|
||||
$QryTableMessages .= "`message_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableMessages .= "`message_type` int(11) NOT NULL default '0', ";
|
||||
$QryTableMessages .= "`message_from` varchar(48) character set latin1 default NULL, ";
|
||||
$QryTableMessages .= "`message_subject` varchar(48) character set latin1 default NULL, ";
|
||||
$QryTableMessages .= "`message_text` text character set latin1, ";
|
||||
$QryTableMessages .= "PRIMARY KEY (`message_id`) ";
|
||||
$QryTableMessages .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table notes
|
||||
$QryTableNotes = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableNotes .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTableNotes .= "`owner` int(11) default NULL, ";
|
||||
$QryTableNotes .= "`time` int(11) default NULL, ";
|
||||
$QryTableNotes .= "`priority` tinyint(1) default NULL, ";
|
||||
$QryTableNotes .= "`title` varchar(32) character set latin1 default NULL, ";
|
||||
$QryTableNotes .= "`text` text character set latin1, ";
|
||||
$QryTableNotes .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableNotes .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table planets
|
||||
$QryTablePlanets = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTablePlanets .= "`id` bigint(11) NOT NULL auto_increment, ";
|
||||
$QryTablePlanets .= "`name` varchar(255) character set latin1 default NULL, ";
|
||||
$QryTablePlanets .= "`id_owner` int(11) default NULL, ";
|
||||
$QryTablePlanets .= "`id_level` int(11) default NULL, ";
|
||||
$QryTablePlanets .= "`galaxy` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`system` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`planet` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`last_update` int(11) default NULL, ";
|
||||
$QryTablePlanets .= "`planet_type` int(11) NOT NULL default '1', ";
|
||||
$QryTablePlanets .= "`destruyed` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_building` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_building_id` text character set latin1 NOT NULL, ";
|
||||
$QryTablePlanets .= "`b_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_tech_id` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_hangar` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`b_hangar_id` text character set latin1 NOT NULL, ";
|
||||
$QryTablePlanets .= "`b_hangar_plus` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`image` varchar(32) character set latin1 NOT NULL default 'normaltempplanet01', ";
|
||||
$QryTablePlanets .= "`diameter` int(11) NOT NULL default '12800', ";
|
||||
$QryTablePlanets .= "`points` bigint(20) default '0', ";
|
||||
$QryTablePlanets .= "`ranks` bigint(20) default '0', ";
|
||||
$QryTablePlanets .= "`field_current` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`field_max` int(11) NOT NULL default '163', ";
|
||||
$QryTablePlanets .= "`temp_min` int(3) NOT NULL default '-17', ";
|
||||
$QryTablePlanets .= "`temp_max` int(3) NOT NULL default '23', ";
|
||||
$QryTablePlanets .= "`metal` double(132,8) NOT NULL default '0.00000000', ";
|
||||
$QryTablePlanets .= "`metal_perhour` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`metal_max` bigint(20) default '100000', ";
|
||||
$QryTablePlanets .= "`crystal` double(132,8) NOT NULL default '0.00000000', ";
|
||||
$QryTablePlanets .= "`crystal_perhour` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`crystal_max` bigint(20) default '100000', ";
|
||||
$QryTablePlanets .= "`deuterium` double(132,8) NOT NULL default '0.00000000', ";
|
||||
$QryTablePlanets .= "`deuterium_perhour` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`deuterium_max` bigint(20) default '100000', ";
|
||||
$QryTablePlanets .= "`energy_used` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`energy_max` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`metal_mine` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`crystal_mine` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`deuterium_sintetizer` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`solar_plant` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`fusion_plant` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`robot_factory` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`nano_factory` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`hangar` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`metal_store` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`crystal_store` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`deuterium_store` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`laboratory` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`terraformer` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`ally_deposit` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`silo` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`small_ship_cargo` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`big_ship_cargo` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`light_hunter` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`heavy_hunter` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`crusher` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`battle_ship` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`colonizer` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`recycler` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`spy_sonde` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`bomber_ship` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`solar_satelit` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`destructor` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`dearth_star` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`battleship` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`supernova` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`misil_launcher` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`small_laser` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`big_laser` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`gauss_canyon` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`ionic_canyon` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`buster_canyon` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`small_protection_shield` enum('0', '1') NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`big_protection_shield` enum('0', '1') NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`interceptor_misil` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`interplanetary_misil` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`metal_mine_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`crystal_mine_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`deuterium_sintetizer_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`solar_plant_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`fusion_plant_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`solar_satelit_porcent` int(11) NOT NULL default '10', ";
|
||||
$QryTablePlanets .= "`mondbasis` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`phalanx` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`sprungtor` bigint(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "`last_jump_time` int(11) NOT NULL default '0', ";
|
||||
$QryTablePlanets .= "PRIMARY KEY (`id`) ";
|
||||
$QryTablePlanets .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table rw
|
||||
$QryTableRw = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableRw .= "`id_owner1` int(11) NOT NULL default '0', ";
|
||||
$QryTableRw .= "`id_owner2` int(11) NOT NULL default '0', ";
|
||||
$QryTableRw .= "`rid` varchar(72) character set latin1 NOT NULL, ";
|
||||
$QryTableRw .= "`raport` text character set latin1 NOT NULL, ";
|
||||
$QryTableRw .= "`a_zestrzelona` tinyint(3) unsigned NOT NULL default '0', ";
|
||||
$QryTableRw .= "`time` int(10) unsigned NOT NULL default '0', ";
|
||||
$QryTableRw .= "UNIQUE KEY `rid` (`rid`), ";
|
||||
$QryTableRw .= "KEY `id_owner1` (`id_owner1`,`rid`), ";
|
||||
$QryTableRw .= "KEY `id_owner2` (`id_owner2`,`rid`), ";
|
||||
$QryTableRw .= "KEY `time` (`time`), ";
|
||||
$QryTableRw .= "FULLTEXT KEY `raport` (`raport`) ";
|
||||
$QryTableRw .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table statpoints
|
||||
$QryTableStatPoints = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableStatPoints .= "`id_owner` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`id_ally` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`stat_type` int(2) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`stat_code` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`tech_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`tech_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`tech_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`tech_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`build_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`build_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`build_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`build_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`defs_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`defs_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`defs_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`defs_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`fleet_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`fleet_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`fleet_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`fleet_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`total_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`total_old_rank` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`total_points` bigint(20) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`total_count` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "`stat_date` int(11) NOT NULL, ";
|
||||
$QryTableStatPoints .= "KEY `TECH` (`tech_points`), ";
|
||||
$QryTableStatPoints .= "KEY `BUILDS` (`build_points`), ";
|
||||
$QryTableStatPoints .= "KEY `DEFS` (`defs_points`), ";
|
||||
$QryTableStatPoints .= "KEY `FLEET` (`fleet_points`), ";
|
||||
$QryTableStatPoints .= "KEY `TOTAL` (`total_points`) ";
|
||||
$QryTableStatPoints .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Table users
|
||||
$QryTableUsers = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableUsers .= "`id` bigint(11) unsigned NOT NULL auto_increment PRIMARY KEY, ";
|
||||
$QryTableUsers .= "`username` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`password` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`email` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`email_2` varchar(64) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`lang` varchar(8) character set latin1 NOT NULL default 'fr', ";
|
||||
$QryTableUsers .= "`authlevel` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`sex` char(1) character set latin1 default NULL, ";
|
||||
$QryTableUsers .= "`avatar` varchar(255) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`sign` text character set latin1, ";
|
||||
$QryTableUsers .= "`id_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`galaxy` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`system` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`current_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`user_lastip` varchar(16) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`ip_at_reg` varchar(16) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`user_agent` text character set latin1 NOT NULL, ";
|
||||
$QryTableUsers .= "`current_page` text character set latin1 NOT NULL, ";
|
||||
$QryTableUsers .= "`register_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`onlinetime` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`dpath` varchar(255) character set latin1 NOT NULL default '', ";
|
||||
$QryTableUsers .= "`design` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`noipcheck` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`planet_sort` tinyint(1) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`planet_sort_order` tinyint(1) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`spio_anz` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_tooltiptime` tinyint(4) NOT NULL default '5', ";
|
||||
$QryTableUsers .= "`settings_fleetactions` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`settings_allylogo` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`settings_esp` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_wri` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_bud` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_mis` tinyint(4) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`settings_rep` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`urlaubs_modus` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`urlaubs_until` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`db_deaktjava` tinyint(4) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`new_message` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`fleet_shortcut` text character set latin1, ";
|
||||
$QryTableUsers .= "`b_tech_planet` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`spy_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`computer_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`military_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`defence_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`shield_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`energy_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`hyperspace_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`combustion_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`impulse_motor_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`hyperspace_motor_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`laser_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ionic_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`buster_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`intergalactic_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`expedition_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`graviton_tech` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ally_id` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ally_name` varchar(32) character set latin1 default '', ";
|
||||
$QryTableUsers .= "`ally_request` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ally_request_text` text character set latin1, ";
|
||||
$QryTableUsers .= "`ally_register_time` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`ally_rank_id` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`current_luna` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`kolorminus` varchar(11) character set latin1 NOT NULL default 'red', ";
|
||||
$QryTableUsers .= "`kolorplus` varchar(11) character set latin1 NOT NULL default '#00FF00', ";
|
||||
$QryTableUsers .= "`kolorpoziom` varchar(11) character set latin1 NOT NULL default 'yellow', ";
|
||||
$QryTableUsers .= "`rpg_geologue` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_amiral` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_ingenieur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_technocrate` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_espion` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_constructeur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_scientifique` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_commandant` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_points` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_stockeur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_defenseur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_destructeur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_general` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_bunker` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_raideur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`rpg_empereur` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`lvl_minier` int(11) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`lvl_raid` int(11) NOT NULL default '1', ";
|
||||
$QryTableUsers .= "`xpraid` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`xpminier` int(11) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`raids` bigint(20) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`p_infligees` bigint(20) NOT NULL default '0', ";
|
||||
$QryTableUsers .= "`mnl_alliance` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_joueur` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_attaque` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_spy` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_exploit` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_transport` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_expedition` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_general` INT( 11 ) NOT NULL , ";
|
||||
$QryTableUsers .= "`mnl_buildlist` INT (11) NOT NULL , ";
|
||||
$QryTableUsers .= "`bana` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`multi_validated` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`banaday` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`raids1` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`raidswin` int(11) default NULL , ";
|
||||
$QryTableUsers .= "`raidsloose` int(11) default NULL ";
|
||||
$QryTableUsers .= ") ENGINE=MyISAM;";
|
||||
|
||||
// Multi
|
||||
$QryTableMulti = "CREATE TABLE `{{table}}` ( ";
|
||||
$QryTableMulti .= "`id` int(11) NOT NULL auto_increment, ";
|
||||
$QryTableMulti .= "`player` bigint(11) unsigned NOT NULL, ";
|
||||
$QryTableMulti .= "`sharer` bigint(11) unsigned NOT NULL, ";
|
||||
$QryTableMulti .= "`reason` text character set latin1 NOT NULL, ";
|
||||
$QryTableMulti .= "PRIMARY KEY (`id`) ";
|
||||
$QryTableMulti .= ") ENGINE=MyISAM;";
|
||||
|
||||
?>
|
||||
154
src/includes/debug.class.php
Normal file
154
src/includes/debug.class.php
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Debug class
|
||||
*
|
||||
* @todo Clean up source code
|
||||
*/
|
||||
class Nova_Core_Debug
|
||||
{
|
||||
const CRITICAL = 0x80;
|
||||
const ERROR = 0x40;
|
||||
const WARNING = 0x20;
|
||||
const INFO = 0x10;
|
||||
const MESSAGE = 0x08;
|
||||
const AUDIT_FAILED = 0x04;
|
||||
const AUDIT_SUCCESS = 0x02;
|
||||
const DEBUG = 0x01;
|
||||
|
||||
const DEFAULT_LOGFILE = 'var/log/system.log';
|
||||
|
||||
protected $_logLevelNames = array(
|
||||
self::CRITICAL => 'CRITICAL',
|
||||
self::ERROR => 'ERROR',
|
||||
self::WARNING => 'WARNING',
|
||||
self::INFO => 'INFO',
|
||||
self::MESSAGE => 'MESSAGE',
|
||||
self::AUDIT_FAILED => 'AUDIT_FAILED',
|
||||
self::AUDIT_SUCCESS => 'AUDIT_SUCCESS',
|
||||
self::DEBUG => 'DEBUG'
|
||||
);
|
||||
|
||||
/**
|
||||
* Clean logging method
|
||||
*
|
||||
* @param string $message
|
||||
* @param string $resource
|
||||
* @param int $level
|
||||
* @return unknown_type
|
||||
*/
|
||||
public function log($message, $resource = self::DEFAULT_LOGFILE, $level = self::DEBUG)
|
||||
{
|
||||
if(!($fp = fopen($resource, 'a'))) {
|
||||
trigger_error('Unable to open logs.', E_USER_ERROR);
|
||||
trigger_error($message, E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
fprintf($fp, '[%s] | %s - %s', $this->_logLevelNames[$level], date('r'), $message);
|
||||
fclose($fp);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @todo Clean up source code
|
||||
*/
|
||||
class Debug
|
||||
extends Nova_Core_Debug
|
||||
{
|
||||
protected $_logMessages = array();
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param string $message
|
||||
* @return void
|
||||
*/
|
||||
function add($message)
|
||||
{
|
||||
$this->log($message);
|
||||
$this->_logMessages[] = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @return void
|
||||
*/
|
||||
function echo_log()
|
||||
{
|
||||
$messages = implode(PHP_EOL, $this->_logMessages);
|
||||
echo <<<EOF
|
||||
<dl class="k">
|
||||
<dt>
|
||||
<a href="admin/settings.php">Debug Log</a>:
|
||||
</dt>
|
||||
<dd>
|
||||
<pre><code>{$messages}</code></pre>
|
||||
</dd>
|
||||
</dl>
|
||||
EOF;
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @todo Clean up source code
|
||||
* @param $message
|
||||
* @param $title
|
||||
* @return unknown_type
|
||||
*/
|
||||
public function error($message, $title)
|
||||
{
|
||||
if (defined('DEBUG')) {
|
||||
echo "<h2>$title</h2><br><font color=red>$message</font><br><hr>";
|
||||
echo "<table>".$this->log."</table>";
|
||||
}
|
||||
|
||||
$user = Legacies_Empire_Model_User::getSingleton();
|
||||
|
||||
$db = Legacies_Database::getSingleton();
|
||||
$config = include ROOT_PATH . 'config.' . PHPEXT;
|
||||
if(!$link) die('La base de donnee n est pas disponible pour le moment, desole pour la gene occasionnee...');
|
||||
$query = "INSERT INTO {$db->getTable('errors')} SET
|
||||
`error_sender` = {$user->getId()} ,
|
||||
`error_time` = {$db->quote(time())},
|
||||
`error_type` = {$db->quote($title)},
|
||||
`error_text` = {$db->quote($message)}";
|
||||
|
||||
$db->query($query);
|
||||
$id = $db->lastInsertId($db->getTable('errors'));
|
||||
if (!function_exists('message')) {
|
||||
echo "Erreur, merci de contacter l'admin. Erreur n<>: <b>".$id."</b>";
|
||||
} else {
|
||||
message("Erreur, merci de contacter l'admin. Erreur n<>: <b>".$id."</b>", "Erreur");
|
||||
}
|
||||
}
|
||||
}
|
||||
673
src/includes/deprecated.php
Normal file
673
src/includes/deprecated.php
Normal file
|
|
@ -0,0 +1,673 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Deprecated method used to add a building to the planet building list.
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
* @param Wootook_Player_Model_Entity|array $currentUser
|
||||
* @param int $buildingId
|
||||
* @param bool $AddMode
|
||||
*/
|
||||
function AddBuildingToQueue($currentPlanet, $currentUser, $buildingId, $AddMode = true)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->appendBuildingQueue($buildingId, !$AddMode);
|
||||
|
||||
return $currentPlanet->getBuildingQueue()->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecaed function used to save the planet record
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function BuildingSavePlanetRecord($currentPlanet)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deprecaed function used to save the user record
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Player_Model_Entity|array $currentUser
|
||||
*/
|
||||
function BuildingSaveUserRecord($currentUser)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentUser instanceof Wootook_Player_Model_Entity) {
|
||||
trigger_error('$currentUser should be an instance of Wootook_Player_Model_Entity', E_USER_WARNING);
|
||||
$currentUser = Wootook_Player_Model_Entity::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$currentUser->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
* @param Wootook_Player_Model_Entity|array $currentUser
|
||||
*/
|
||||
function CheckPlanetBuildingQueue($currentPlanet, $currentUser)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Wootook_Player_Model_Entity) {
|
||||
trigger_error('$currentUser should be an instance of Wootook_Player_Model_Entity', E_USER_WARNING);
|
||||
$currentUser = Wootook_Player_Model_Entity::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->updateBuildingQueue();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function CheckPlanetUsedFields($currentPlanet)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->updateStorages()->save();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Player_Model_Entity|array $currentUser
|
||||
* @param Wootook_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') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Wootook_Player_Model_Entity) {
|
||||
trigger_error('$currentUser should be an instance of Wootook_Player_Model_Entity', E_USER_WARNING);
|
||||
$currentUser = Wootook_Player_Model_Entity::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$types = Wootook_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 Wootook_Player_Model_Entity|array $currentUser
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $buildingId
|
||||
*/
|
||||
function GetBuildingTime($currentUser, $currentPlanet, $buildingId)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Wootook_Player_Model_Entity) {
|
||||
trigger_error('$currentUser should be an instance of Wootook_Player_Model_Entity', E_USER_WARNING);
|
||||
$currentUser = Wootook_Player_Model_Entity::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$types = Wootook_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->getResearchLab()->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 Wootook_Player_Model_Entity|array $currentUser
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $Element
|
||||
* @param int|string $level
|
||||
*/
|
||||
function GetBuildingTimeLevel($currentUser, $currentPlanet, $buildingId, $level)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Wootook_Player_Model_Entity) {
|
||||
trigger_error('$currentUser should be an instance of Wootook_Player_Model_Entity', E_USER_WARNING);
|
||||
$currentUser = Wootook_Player_Model_Entity::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
$types = Wootook_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 Wootook_Player_Model_Entity|array $currentUser
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $buildingId
|
||||
* @param unknown_type $userfactor
|
||||
*/
|
||||
function GetElementPrice($currentUser, $currentPlanet, $buildingId, $userfactor = true)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if (!$currentUser instanceof Wootook_Player_Model_Entity) {
|
||||
trigger_error('$currentUser should be an instance of Wootook_Player_Model_Entity', E_USER_WARNING);
|
||||
$currentUser = Wootook_Player_Model_Entity::factory($currentUser['id']);
|
||||
}
|
||||
|
||||
global $lang;
|
||||
|
||||
$prices = Wootook_Empire_Model_Game_Prices::getSingleton();
|
||||
$types = Wootook_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') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
$currentUser = Wootook_Player_Model_Session::getSingleton()->getPlayer();
|
||||
$currentPlanet = $currentUser->getCurrentPlanet();
|
||||
|
||||
return $currentPlanet->getShipyard()->getResourcesNeeded($buildingId, $count);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Player_Model_Entity|array $currentUser
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
* @param int $productionTime
|
||||
*
|
||||
* @see Lagecies_Empire_Model_Planet::updateBuildingQueue()
|
||||
*/
|
||||
function HandleElementBuildingQueue($currentUser, $currentPlanet, $productionTime)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param bool $isUserChecked
|
||||
*
|
||||
* @see Wootook_Player_Model_Session::getSingleton()->getPlayer()
|
||||
*/
|
||||
function CheckCookies($isUserChecked)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
$user = Wootook_Player_Model_Session::getSingleton()->getPlayer();
|
||||
|
||||
if ($user instanceof Wootook_Player_Model_Entity) {
|
||||
return array(
|
||||
'state' => true,
|
||||
'record' => $user
|
||||
);
|
||||
} else {
|
||||
return array(
|
||||
'state' => false,
|
||||
'record' => array()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param bool $isUserChecked
|
||||
*
|
||||
* @see Wootook_Player_Model_Session::getSingleton()->getPlayer()
|
||||
*/
|
||||
function CheckTheUser($isUserChecked)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
$result = CheckCookies($isUserChecked);
|
||||
|
||||
if ($result['record'] instanceof Wootook_Player_Model_Entity && $result['record']['bana']) {
|
||||
die(parsetemplate(gettemplate('usr_banned'), $lang));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
* @param Wootook_Player_Model_Entity|array $currentUser
|
||||
*
|
||||
* @see Wootook_Empire_Model_Planet::updateBuildingQueue()
|
||||
*/
|
||||
function UpdatePlanetBatimentQueueList($currentPlanet, $currentUser)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
$currentPlanet->updateBuildingQueue(Beyond::now());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function CalculateMaxPlanetFields($currentPlanet)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
return max(1, $currentPlanet['field_max'] + ($currentPlanet->getElement(Legacies_Empire::ID_BUILDING_TERRAFORMER) * 5));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Player_Model_Entity|array $currentUser
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function AbandonColony($currentUser, $currentPlanet)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
try {
|
||||
$currentPlanet->destroy();
|
||||
} catch (Wootook_Core_Model_Exception $e) {
|
||||
Wootook_Core_Model_Session::factory('empire')->addCritical($e->getMessage());
|
||||
} catch (Wootook_Empire_Model_Planet_Exception $e) {
|
||||
Wootook_Core_Model_Session::factory('empire')->addError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function CheckFleets($currentPlanet)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
return (bool) ($currentPlanet->getFleetCollection()->count() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param Wootook_Player_Model_Entity|array $currentUser
|
||||
* @param Wootook_Empire_Model_Planet|array $currentPlanet
|
||||
*/
|
||||
function CancelBuildingFromQueue($currentPlanet, $currentUser)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
if (!$currentPlanet instanceof Wootook_Empire_Model_Planet) {
|
||||
trigger_error('$currentPlanet should be an instance of Wootook_Empire_Model_Planet', E_USER_WARNING);
|
||||
$currentPlanet = Wootook_Empire_Model_Planet::factory($currentPlanet['id']);
|
||||
}
|
||||
|
||||
if ($currentPlanet->getBuildingQueue()->count() <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$currentPlanet->dequeueBuilding();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class Deprecated
|
||||
{
|
||||
/**
|
||||
* @var Wootook_Core_Layout $layout
|
||||
*/
|
||||
public static $layout = null;
|
||||
|
||||
/**
|
||||
* @return Wootook_Core_Layout
|
||||
*/
|
||||
public static function getLayout($adminPage = false)
|
||||
{
|
||||
if (self::$layout === null) {
|
||||
self::$layout = new Wootook_Core_Layout();
|
||||
}
|
||||
|
||||
return self::$layout;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param string $page The page content
|
||||
* @param string $title The page title
|
||||
* @param bool $topnav Wether we show the top navigation or not
|
||||
* @param null $metatags Extra meta tags
|
||||
* @param bool $adminPage unused
|
||||
*/
|
||||
function display($page, $title = '', $topnav = true, $metatags = '', $adminPage = false)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
// TODO: implement extra meta tags
|
||||
$layout = Deprecated::getLayout($adminPage);
|
||||
if ($adminPage === false) {
|
||||
$layout->load('empire');
|
||||
} else {
|
||||
$layout->setDomain(Wootook_Core_Layout::DOMAIN_BACKEND);
|
||||
$layout->load('admin');
|
||||
}
|
||||
|
||||
$content = $layout->getBlock('content');
|
||||
if (!$content instanceof Wootook_Core_View) {
|
||||
exit(0);
|
||||
}
|
||||
$pageContent = $layout->createBlock('core/text', 'content');
|
||||
$pageContent->setContent($page);
|
||||
$content->page = $pageContent;
|
||||
|
||||
echo $layout->render();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param string $template The page template
|
||||
* @param array $array The view data
|
||||
*/
|
||||
function parsetemplate($template, $array)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
static $baseUrl = null;
|
||||
if ($baseUrl === null) {
|
||||
$user = Wootook_Player_Model_Session::getSingleton()->getPlayer();
|
||||
if ($user !== null && $user->getId() && ($baseUrl = $user->getSkinPath()) == '') {
|
||||
$baseUrl = DEFAULT_SKINPATH;
|
||||
}
|
||||
}
|
||||
$array['dpath'] = $baseUrl;
|
||||
|
||||
$layout = Deprecated::getLayout();
|
||||
$view = $layout->createBlock('core/deprecated', uniqid(), $array);
|
||||
$view->setTemplate('deprecated/' .$template . '.tpl');
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param string $filename
|
||||
* @return string
|
||||
*/
|
||||
function ReadFromFile($filename)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
return file_get_contents($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param string $filename
|
||||
* @param string $content
|
||||
* @return void
|
||||
*/
|
||||
function saveToFile($filename, $content)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
file_put_contents($filename, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param string $templateName
|
||||
* @return string
|
||||
*/
|
||||
function getTemplate($templateName)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
return $templateName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Enter description here ...
|
||||
* @deprecated
|
||||
* @param string $query
|
||||
* @param string $table
|
||||
* @param bool $fetch
|
||||
*/
|
||||
function doquery($query, $table, $fetch = false)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
/**
|
||||
* @var Wootook_Core_Database $database
|
||||
*/
|
||||
$database = Wootook_Core_Database::getSingleton();
|
||||
|
||||
$sql = str_replace("{{table}}", $database->getTable($table), $query);
|
||||
|
||||
/**
|
||||
* @var PDOStatement $statement
|
||||
*/
|
||||
try {
|
||||
$statement = $database->prepare($sql);
|
||||
|
||||
$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 $statement->fetch(PDO::FETCH_BOTH);
|
||||
} else {
|
||||
return $statement;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $UserID
|
||||
*/
|
||||
function ResetThisFuckingCheater($userId)
|
||||
{
|
||||
defined('DEPRECATION') || Wootook_Core_ErrorProfiler::getSingleton()->addException(new Wootook_Core_Exception_Deprecated(sprintf('Function "%s" is deprecated', __FUNCTION__)));
|
||||
|
||||
$user = Wootook_Player_Model_Entity::factory($userId);
|
||||
$username = $user->getData('username');
|
||||
$email = $user->getData('email');
|
||||
$password = $user->getData('password');
|
||||
$user->delete();
|
||||
|
||||
$user = Wootook_Player_Model_Entity::register($TheUser['username'], $TheUser['email'], 'password');
|
||||
$user->setData('password', $password);
|
||||
$user->save();
|
||||
return;
|
||||
}
|
||||
84
src/includes/functions.php
Normal file
84
src/includes/functions.php
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
function check_urlaubmodus ($user) {
|
||||
if ($user['urlaubs_modus'] == 1) {
|
||||
message("Vous êtes en mode vacances!", $title = $user['username'], $dest = "", $time = "3");
|
||||
}
|
||||
}
|
||||
|
||||
function check_urlaubmodus_time () {
|
||||
global $user;
|
||||
$begrenzung = 86400; //24x60x60= 24h
|
||||
$urlaub_modus_time = $user['urlaubs_modus_time'];
|
||||
$urlaub_modus_time_soll = $urlaub_modus_time + $begrenzung;
|
||||
$time_jetzt = time();
|
||||
if ($user['urlaubs_modus'] == 1 && $urlaub_modus_time_soll > $time_jetzt) {
|
||||
$soll_datum = date("d.m.Y", $urlaub_modus_time_soll);
|
||||
$soll_uhrzeit = date("H:i:s", $urlaub_modus_time_soll);
|
||||
message("Vous <20>tes en mode vacances!<br>Le mode vacance dure jusque $soll_datum $soll_uhrzeit<br> Ce n'est qu'apr<70>s cette p<>riode que vous pouvez changer vos options.", "Mode vacance");
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Routine Test de validit<69> d'une adresse email
|
||||
//
|
||||
function is_email($email) {
|
||||
return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email));
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Routine Affichage d'un message administrateur avec saut vers une autre page si souhait<69>
|
||||
//
|
||||
function AdminMessage ($mes, $title = 'Error', $dest = '', $time = '3', $color= 'red') {
|
||||
$parse['color'] = $color;
|
||||
$parse['title'] = $title;
|
||||
$parse['mes'] = $mes;
|
||||
|
||||
$page = parsetemplate(gettemplate('admin/message_body'), $parse);
|
||||
|
||||
display ($page, $title, false, (($dest != "") ? "<meta http-equiv=\"refresh\" content=\"$time;URL={$dest}\">" : ""), true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Routine Affichage d'un message avec saut vers une autre page si souhait<69>
|
||||
//
|
||||
function message($mes, $title = 'Error', $dest = "", $time = "3", $color = 'orange') {
|
||||
$parse['color'] = $color;
|
||||
$parse['title'] = $title;
|
||||
$parse['mes'] = $mes;
|
||||
|
||||
$page = parsetemplate(gettemplate('admin/message_body'), $parse);
|
||||
|
||||
display ($page, $title, false, (($dest != "") ? "<meta http-equiv=\"refresh\" content=\"$time;URL={$dest}\">" : ""), true);
|
||||
}
|
||||
133
src/includes/functions/BBcodeFunction.php
Normal file
133
src/includes/functions/BBcodeFunction.php
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $string
|
||||
*/
|
||||
function bbcode($string) {
|
||||
$pattern = array(
|
||||
'/\\n/',
|
||||
'/\\r/',
|
||||
'/\[list\](.*?)\[\/list\]/ise',
|
||||
'/\[b\](.*?)\[\/b\]/is',
|
||||
'/\[strong\](.*?)\[\/strong\]/is',
|
||||
'/\[i\](.*?)\[\/i\]/is',
|
||||
'/\[u\](.*?)\[\/u\]/is',
|
||||
'/\[s\](.*?)\[\/s\]/is',
|
||||
'/\[del\](.*?)\[\/del\]/is',
|
||||
'/\[url=(.*?)\](.*?)\[\/url\]/ise',
|
||||
'/\[email=(.*?)\](.*?)\[\/email\]/is',
|
||||
'/\[img](.*?)\[\/img\]/ise',
|
||||
'/\[color=(.*?)\](.*?)\[\/color\]/is',
|
||||
'/\[quote\](.*?)\[\/quote\]/ise',
|
||||
'/\[code\](.*?)\[\/code\]/ise',
|
||||
'#\[youtube\]([^\]]+)\[/youtube\]#',
|
||||
'#\[dailymotion\]([^\]]+)\[/dailymotion\]#'
|
||||
);
|
||||
|
||||
$replace = array(
|
||||
'',
|
||||
'',
|
||||
'sList(\'\\1\')',
|
||||
'<b>\1</b>',
|
||||
'<strong>\1</strong>',
|
||||
'<i>\1</i>',
|
||||
'<span style="text-decoration: underline;">\1</span>',
|
||||
'<span style="text-decoration: line-through;">\1</span>',
|
||||
'<span style="text-decoration: line-through;">\1</span>',
|
||||
'urlfix($1,$2)',
|
||||
'<a href="mailto:\1" title="\1">\2</a>',
|
||||
'imagefix(\'\\1\')',
|
||||
'<span style="color: \1;">\2</span>',
|
||||
'sQuote(\'\1\')',
|
||||
'sCode(\'\1\')',
|
||||
'<iframe src="http://www.youtube.com/embed/\\1" width="640" height="385"></iframe>',
|
||||
'<iframe frameborder="0" width="560" height="420" src="http://www.dailymotion.com/embed/video/\\1?width=560"></iframe>'
|
||||
);
|
||||
|
||||
return preg_replace($pattern, $replace, nl2br(htmlspecialchars(stripslashes($string))));
|
||||
}
|
||||
|
||||
|
||||
|
||||
function image($string)
|
||||
{
|
||||
//On va pas se casser le fion a lire les accents quand meme !!!!!!!
|
||||
$string = str_replace("'", "'", $string);
|
||||
|
||||
|
||||
//Emoticones.... COPIEZ COLLEZ CES LIGNES POUR RAJOUTER LES VOTRES !
|
||||
$string = str_replace("Smile", "[img]../emoticones/Smile.png[/img]", $string);
|
||||
$string = str_replace("cool", "[img]../emoticones/cool.png[/img]", $string);
|
||||
$string = str_replace("grrr", "[img]../emoticones/grrr.png[/img]", $string);
|
||||
$string = str_replace("love", "[img]../emoticones/love.png[/img]", $string);
|
||||
$string = str_replace("msn", "[img]../emoticones/msn.png[/img]", $string);
|
||||
$string = str_replace("Oo", "[img]../emoticones/Oo.png[/img]", $string);
|
||||
$string = str_replace("perdu", "[img]../emoticones/perdu.png[/img]", $string);
|
||||
$string = str_replace("wink", "[img]../emoticones/wink.png[/img]", $string);
|
||||
$string = str_replace("wow", "[img]../emoticones/wow.png[/img]", $string);
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function sCode($string){
|
||||
$pattern = '/\<img src=\\\"(.*?)img\/smilies\/(.*?).png\\\" alt=\\\"(.*?)\\\" \/>/s';
|
||||
$string = preg_replace($pattern, '\3', $string);
|
||||
return '<pre>' . trim($string) . '</pre>';
|
||||
}
|
||||
|
||||
function sList($string) {
|
||||
$tmp = explode('[*]', stripslashes($string));
|
||||
$out = null;
|
||||
foreach($tmp as $list) {
|
||||
if(strlen(str_replace('', '', $list)) > 0) {
|
||||
$out .= '<li>' . trim($list) . '</li>';
|
||||
}
|
||||
}
|
||||
return '<ul>' . $out . '</ul>';
|
||||
}
|
||||
|
||||
function imagefix($img) {
|
||||
if(substr($img, 0, 7) != 'http://') {
|
||||
$img = './images/' . $img;
|
||||
}
|
||||
return '<img src="' . $img . '" alt="' . $img . '" title="' . $img . '" />';
|
||||
}
|
||||
|
||||
function urlfix($url, $title) {
|
||||
$title = stripslashes($title);
|
||||
return '<a href="' . $url . '" title="' . $title . '">' . $title . '</a>';
|
||||
}
|
||||
?>
|
||||
167
src/includes/functions/BuildFleetEventTable.php
Normal file
167
src/includes/functions/BuildFleetEventTable.php
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
* @param unknown_type $Status
|
||||
* @param unknown_type $Owner
|
||||
* @param unknown_type $Label
|
||||
* @param unknown_type $Record
|
||||
*/
|
||||
function BuildFleetEventTable ( $FleetRow, $Status, $Owner, $Label, $Record ) {
|
||||
global $lang;
|
||||
|
||||
$FleetStyle = array (
|
||||
1 => 'attack',
|
||||
2 => 'federation',
|
||||
3 => 'transport',
|
||||
4 => 'deploy',
|
||||
5 => 'hold',
|
||||
6 => 'espionage',
|
||||
7 => 'colony',
|
||||
8 => 'harvest',
|
||||
9 => 'destroy',
|
||||
10 => 'missile',
|
||||
15 => 'transport',
|
||||
);
|
||||
$FleetStatus = array ( 0 => 'flight', 1 => 'holding', 2 => 'return' );
|
||||
if ( $Owner == true ) {
|
||||
$FleetPrefix = 'own';
|
||||
} else {
|
||||
$FleetPrefix = '';
|
||||
}
|
||||
|
||||
$RowsTPL = gettemplate ('overview_fleet_event');
|
||||
$MissionType = $FleetRow['fleet_mission'];
|
||||
$FleetContent = CreateFleetPopupedFleetLink ( $FleetRow, $lang['ov_fleet'], $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
$FleetCapacity = CreateFleetPopupedMissionLink ( $FleetRow, $lang['type_mission'][ $MissionType ], $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
|
||||
$StartPlanet = doquery("SELECT `name` FROM {{table}} WHERE `galaxy` = '".$FleetRow['fleet_start_galaxy']."' AND `system` = '".$FleetRow['fleet_start_system']."' AND `planet` = '".$FleetRow['fleet_start_planet']."' AND `planet_type` = '".$FleetRow['fleet_start_type']."';", 'planets', true);
|
||||
$StartType = $FleetRow['fleet_start_type'];
|
||||
$TargetPlanet = doquery("SELECT `name` FROM {{table}} WHERE `galaxy` = '".$FleetRow['fleet_end_galaxy']."' AND `system` = '".$FleetRow['fleet_end_system']."' AND `planet` = '".$FleetRow['fleet_end_planet']."' AND `planet_type` = '".$FleetRow['fleet_end_type']."';", 'planets', true);
|
||||
$TargetType = $FleetRow['fleet_end_type'];
|
||||
|
||||
if ($Status != 2) {
|
||||
if ($StartType == 1) {
|
||||
$StartID = $lang['ov_planet_to'];
|
||||
} elseif ($StartType == 3) {
|
||||
$StartID = $lang['ov_moon_to'];
|
||||
}
|
||||
$StartID .= $StartPlanet['name'] ." ";
|
||||
$StartID .= GetStartAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
|
||||
if ( $MissionType != 15 ) {
|
||||
if ($TargetType == 1) {
|
||||
$TargetID = $lang['ov_planet_to_target'];
|
||||
} elseif ($TargetType == 2) {
|
||||
$TargetID = $lang['ov_debris_to_target'];
|
||||
} elseif ($TargetType == 3) {
|
||||
$TargetID = $lang['ov_moon_to_target'];
|
||||
}
|
||||
} else {
|
||||
$TargetID = $lang['ov_explo_to_target'];
|
||||
}
|
||||
$TargetID .= $TargetPlanet['name'] ." ";
|
||||
$TargetID .= GetTargetAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
} else {
|
||||
if ($StartType == 1) {
|
||||
$StartID = $lang['ov_back_planet'];
|
||||
} elseif ($StartType == 3) {
|
||||
$StartID = $lang['ov_back_moon'];
|
||||
}
|
||||
$StartID .= $StartPlanet['name'] ." ";
|
||||
$StartID .= GetStartAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
|
||||
if ( $MissionType != 15 ) {
|
||||
if ($TargetType == 1) {
|
||||
$TargetID = $lang['ov_planet_from'];
|
||||
} elseif ($TargetType == 2) {
|
||||
$TargetID = $lang['ov_debris_from'];
|
||||
} elseif ($TargetType == 3) {
|
||||
$TargetID = $lang['ov_moon_from'];
|
||||
}
|
||||
} else {
|
||||
$TargetID = $lang['ov_explo_from'];
|
||||
}
|
||||
$TargetID .= $TargetPlanet['name'] ." ";
|
||||
$TargetID .= GetTargetAdressLink ( $FleetRow, $FleetPrefix . $FleetStyle[ $MissionType ] );
|
||||
}
|
||||
|
||||
if ($Owner == true) {
|
||||
$EventString = $lang['ov_une']; // 'Une de tes '
|
||||
$EventString .= $FleetContent;
|
||||
} else {
|
||||
$EventString = $lang['ov_une_hostile']; // 'Une '
|
||||
$EventString .= $FleetContent;
|
||||
$EventString .= $lang['ov_hostile']; // ' hostile de '
|
||||
$EventString .= BuildHostileFleetPlayerLink ( $FleetRow );
|
||||
}
|
||||
|
||||
if ($Status == 0) {
|
||||
$Time = $FleetRow['fleet_start_time'];
|
||||
$Rest = $Time - time();
|
||||
$EventString .= $lang['ov_vennant']; // ' venant '
|
||||
$EventString .= $StartID;
|
||||
$EventString .= $lang['ov_atteint']; // ' atteint '
|
||||
$EventString .= $TargetID;
|
||||
$EventString .= $lang['ov_mission']; // '. Elle avait pour mission: '
|
||||
} elseif ($Status == 1) {
|
||||
$Time = $FleetRow['fleet_end_stay'];
|
||||
$Rest = $Time - time();
|
||||
$EventString .= $lang['ov_vennant']; // ' venant '
|
||||
$EventString .= $StartID;
|
||||
$EventString .= $lang['ov_explo_stay']; // ' explore '
|
||||
$EventString .= $TargetID;
|
||||
$EventString .= $lang['ov_explo_mission']; // '. Elle a pour mission: '
|
||||
} elseif ($Status == 2) {
|
||||
$Time = $FleetRow['fleet_end_time'];
|
||||
$Rest = $Time - time();
|
||||
$EventString .= $lang['ov_rentrant'];// ' rentrant '
|
||||
$EventString .= $TargetID;
|
||||
$EventString .= $StartID;
|
||||
$EventString .= $lang['ov_mission']; // '. Elle avait pour mission: '
|
||||
}
|
||||
$EventString .= $FleetCapacity;
|
||||
|
||||
$bloc['fleet_status'] = $FleetStatus[ $Status ];
|
||||
$bloc['fleet_prefix'] = $FleetPrefix;
|
||||
$bloc['fleet_style'] = $FleetStyle[ $MissionType ];
|
||||
$bloc['fleet_javai'] = InsertJavaScriptChronoApplet ( $Label, $Record, $Rest, true );
|
||||
$bloc['fleet_order'] = $Label . $Record;
|
||||
$bloc['fleet_time'] = date("H:i:s", $Time);
|
||||
$bloc['fleet_descr'] = $EventString;
|
||||
$bloc['fleet_javas'] = InsertJavaScriptChronoApplet ( $Label, $Record, $Rest, false );
|
||||
|
||||
return parsetemplate($RowsTPL, $bloc);
|
||||
}
|
||||
|
||||
?>
|
||||
70
src/includes/functions/BuildFlyingFleetTable.php
Normal file
70
src/includes/functions/BuildFlyingFleetTable.php
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function BuildFlyingFleetTable () {
|
||||
global $lang;
|
||||
|
||||
$TableTPL = gettemplate('admin/fleet_rows');
|
||||
$FlyingFleets = doquery ("SELECT * FROM {{table}} ORDER BY `fleet_end_time` ASC;", 'fleets');
|
||||
while ( $CurrentFleet = $FlyingFleets->fetch(PDO::FETCH_ASSOC) ) {
|
||||
$FleetOwner = doquery("SELECT `username` FROM {{table}} WHERE `id` = '". $CurrentFleet['fleet_owner'] ."';", 'users', true);
|
||||
$TargetOwner = doquery("SELECT `username` FROM {{table}} WHERE `id` = '". $CurrentFleet['fleet_target_owner'] ."';", 'users', true);
|
||||
$Bloc['Id'] = $CurrentFleet['fleet_id'];
|
||||
$Bloc['Mission'] = CreateFleetPopupedMissionLink ( $CurrentFleet, $lang['type_mission'][ $CurrentFleet['fleet_mission'] ], '' );
|
||||
$Bloc['Mission'] .= "<br>". (($CurrentFleet['fleet_mess'] == 1) ? "R" : "A" );
|
||||
|
||||
$Bloc['Fleet'] = CreateFleetPopupedFleetLink ( $CurrentFleet, $lang['tech'][200], '' );
|
||||
$Bloc['St_Owner'] = "[". $CurrentFleet['fleet_owner'] ."]<br>". $FleetOwner['username'];
|
||||
$Bloc['St_Posit'] = "[".$CurrentFleet['fleet_start_galaxy'] .":". $CurrentFleet['fleet_start_system'] .":". $CurrentFleet['fleet_start_planet'] ."]<br>". ( ($CurrentFleet['fleet_start_type'] == 1) ? "[P]": (($CurrentFleet['fleet_start_type'] == 2) ? "D" : "L" )) ."";
|
||||
$Bloc['St_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_start_time']);
|
||||
if (is_array($TargetOwner)) {
|
||||
$Bloc['En_Owner'] = "[". $CurrentFleet['fleet_target_owner'] ."]<br>". $TargetOwner['username'];
|
||||
} else {
|
||||
$Bloc['En_Owner'] = "";
|
||||
}
|
||||
$Bloc['En_Posit'] = "[".$CurrentFleet['fleet_end_galaxy'] .":". $CurrentFleet['fleet_end_system'] .":". $CurrentFleet['fleet_end_planet'] ."]<br>". ( ($CurrentFleet['fleet_end_type'] == 1) ? "[P]": (($CurrentFleet['fleet_end_type'] == 2) ? "D" : "L" )) ."";
|
||||
if ($CurrentFleet['fleet_mission'] == 15) {
|
||||
$Bloc['Wa_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_stay_time']);
|
||||
} else {
|
||||
$Bloc['Wa_Time'] = "";
|
||||
}
|
||||
$Bloc['En_Time'] = date('G:i:s d/n/Y', $CurrentFleet['fleet_end_time']);
|
||||
|
||||
$table .= parsetemplate( $TableTPL, $Bloc );
|
||||
}
|
||||
return $table;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
39
src/includes/functions/CheckInputStrings.php
Normal file
39
src/includes/functions/CheckInputStrings.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $String
|
||||
*/
|
||||
function CheckInputStrings($string)
|
||||
{
|
||||
return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
74
src/includes/functions/DeleteSelectedUser.php
Normal file
74
src/includes/functions/DeleteSelectedUser.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $UserID
|
||||
*/
|
||||
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 );
|
||||
$TheAlly['ally_members'] -= 1;
|
||||
if ( $TheAlly['ally_members'] > 0 ) {
|
||||
doquery ( "UPDATE {{table}} SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';", 'alliance' );
|
||||
} else {
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $TheAlly['id'] . "';", 'alliance' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';", 'statpoints' );
|
||||
}
|
||||
}
|
||||
doquery ( "DELETE FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';", 'statpoints' );
|
||||
|
||||
$ThePlanets = doquery ( "SELECT * FROM {{table}} WHERE `id_owner` = '" . $UserID . "';", 'planets' );
|
||||
while ( $OnePlanet = $ThePlanets->fetch(PDO::FETCH_ASSOC) ) {
|
||||
if ( $OnePlanet['planet_type'] == 1 ) {
|
||||
doquery ( "DELETE FROM {{table}} WHERE `galaxy` = '" . $OnePlanet['galaxy'] . "' AND `system` = '" . $OnePlanet['system'] . "' AND `planet` = '" . $OnePlanet['planet'] . "';", 'galaxy' );
|
||||
} elseif ( $OnePlanet['planet_type'] == 3 ) {
|
||||
doquery ( "DELETE FROM {{table}} WHERE `galaxy` = '" . $OnePlanet['galaxy'] . "' AND `system` = '" . $OnePlanet['system'] . "' AND `lunapos` = '" . $OnePlanet['planet'] . "';", 'lunas' );
|
||||
}
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $OnePlanet['id'] . "';", 'planets' );
|
||||
}
|
||||
doquery ( "DELETE FROM {{table}} WHERE `message_sender` = '" . $UserID . "';", 'messages' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `message_owner` = '" . $UserID . "';", 'messages' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'notes' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `fleet_owner` = '" . $UserID . "';", 'fleets' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id_owner1` = '" . $UserID . "';", 'rw' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id_owner2` = '" . $UserID . "';", 'rw' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `sender` = '" . $UserID . "';", 'buddy' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `owner` = '" . $UserID . "';", 'buddy' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `user` = '" . $UserID . "';", 'annonce' );
|
||||
doquery ( "DELETE FROM {{table}} WHERE `id` = '" . $UserID . "';", 'users' );
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
71
src/includes/functions/ElementBuildListBox.php
Normal file
71
src/includes/functions/ElementBuildListBox.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $CurrentPlanet
|
||||
*/
|
||||
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 = "";
|
||||
// $NamePerType = "";
|
||||
// $TimePerType = "";
|
||||
//
|
||||
// foreach($ElementQueue as $ElementLine => $Element) {
|
||||
// if ($Element != '') {
|
||||
// $Element = explode(',', $Element);
|
||||
// $ElementTime = GetBuildingTime( $CurrentUser, $CurrentPlanet, $Element[0] );
|
||||
// $QueueTime += $ElementTime * $Element[1];
|
||||
// $TimePerType .= "".$ElementTime.",";
|
||||
// $NamePerType .= "'". html_entity_decode($lang['tech'][$Element[0]]) ."',";
|
||||
// $NbrePerType .= "".$Element[1].",";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// $parse = $lang;
|
||||
// $parse['a'] = $NbrePerType;
|
||||
// $parse['b'] = $NamePerType;
|
||||
// $parse['c'] = $TimePerType;
|
||||
// $parse['b_hangar_id_plus'] = $CurrentPlanet['b_hangar'];
|
||||
//
|
||||
// $parse['pretty_time_b_hangar'] = pretty_time($QueueTime - $CurrentPlanet['b_hangar']);
|
||||
//
|
||||
// $text .= parsetemplate(gettemplate('buildings_script'), $parse);
|
||||
//
|
||||
// return $text;
|
||||
}
|
||||
|
||||
?>
|
||||
108
src/includes/functions/FlyingFleetHandler.php
Normal file
108
src/includes/functions/FlyingFleetHandler.php
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $planet
|
||||
*/
|
||||
function FlyingFleetHandler($planet) {
|
||||
global $resource;
|
||||
|
||||
$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
|
||||
|
||||
foreach ($planet->getFleetCollection(Wootook::now()) as $CurrentFleet) {
|
||||
switch ($CurrentFleet["fleet_mission"]) {
|
||||
case Legacies_Empire::ID_MISSION_ATTACK:
|
||||
// Attaquer
|
||||
MissionCaseAttack ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_TRANSPORT:
|
||||
// Transporter
|
||||
MissionCaseTransport ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_STATION:
|
||||
// Stationner
|
||||
MissionCaseStay ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_STATION_ALLY:
|
||||
// Stationner chez un Allié
|
||||
MissionCaseStayAlly ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_SPY:
|
||||
// Flotte d'espionnage
|
||||
MissionCaseSpy ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_SETTLE_COLONY:
|
||||
// Coloniser
|
||||
MissionCaseColonisation ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_RECYCLE:
|
||||
// Recyclage
|
||||
MissionCaseRecycling ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_DESTROY:
|
||||
// Detruire ??? dans le code ogame c'est 9 !!
|
||||
MissionCaseDestruction ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
case Legacies_Empire::ID_MISSION_EXPEDITION:
|
||||
// Expeditions
|
||||
MissionCaseExpedition ( $CurrentFleet );
|
||||
break;
|
||||
|
||||
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", ""); // FIXME: use transactions
|
||||
}
|
||||
57
src/includes/functions/GalaxyCheckFunctions.php
Normal file
57
src/includes/functions/GalaxyCheckFunctions.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $lunarow
|
||||
*/
|
||||
function CheckAbandonMoonState ($lunarow) {
|
||||
if (($lunarow['destruyed'] + 172800) <= time() && $lunarow['destruyed'] != 0) {
|
||||
$query = doquery("DELETE FROM {{table}} WHERE id = '" . $lunarow['id'] . "'", "lunas");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppression complete d'une planete
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function CheckAbandonPlanetState (&$planet) {
|
||||
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');
|
||||
doquery("DELETE FROM {{table}} WHERE id_planet={$id}", 'galaxy');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
73
src/includes/functions/GalaxyLegendPopup.php
Normal file
73
src/includes/functions/GalaxyLegendPopup.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function GalaxyLegendPopup () {
|
||||
global $lang;
|
||||
|
||||
$Result = '<a href="#" onclick="return false;" style="cursor: pointer;"';
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['Legend']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Strong_player']."</td><td><span class=strong>".$lang['strong_player_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Weak_player']."</td><td><span class=noob>".$lang['weak_player_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Way_vacation']."</td><td><span class=vacation>".$lang['vacation_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Pendent_user']."</td><td><span class=banned>".$lang['banned_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Inactive_7_days']."</td><td><span class=inactive>".$lang['inactif_7_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>".$lang['Inactive_28_days']."</td><td><span class=longinactive>".$lang['inactif_28_shortcut']."</span></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>Admin</td><td><font color=red><blink>A</blink></font></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>Operator</td><td><font color=lime><blink>O</blink></font></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td width=220>Moderator</td><td><font color=skyblue><blink>M</blink></font></td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "\");' onmouseout='return nd();'>";
|
||||
$Result .= $lang['Legend']."</a>";
|
||||
|
||||
|
||||
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
113
src/includes/functions/GalaxyRowActions.php
Normal file
113
src/includes/functions/GalaxyRowActions.php
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowPlayer
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowActions ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user, $dpath, $CurrentMIP, $CurrentSystem, $CurrentGalaxy;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="125"></th>';
|
||||
}
|
||||
|
||||
// Icones action
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=125>";
|
||||
if ($GalaxyRowPlayer['id'] != $user['id']) {
|
||||
|
||||
if ($CurrentMIP <> 0) {
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
|
||||
$Range = GetMissileRange();
|
||||
$SystemLimitMin = $CurrentSystem - $Range;
|
||||
if ($SystemLimitMin < 1) {
|
||||
$SystemLimitMin = 1;
|
||||
}
|
||||
$SystemLimitMax = $CurrentSystem + $Range;
|
||||
if ($System <= $SystemLimitMax) {
|
||||
if ($System >= $SystemLimitMin) {
|
||||
$MissileBtn = true;
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
} else {
|
||||
$MissileBtn = false;
|
||||
}
|
||||
|
||||
if ($GalaxyRowPlayer && $GalaxyRowPlanet["destruyed"] == 0) {
|
||||
if ($user["settings_esp"] == "1" &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=# onclick=\"javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", 1, ".$user["spio_anz"].");\" >";
|
||||
$Result .= '<img src="' . Wootook::getSkinUrl('base', 'default', 'graphics/img/e.gif') . '" alt="'.$lang['gl_espionner'].'" title="'.$lang['gl_espionner'].'" border="0"></a>';
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_wri"] == "1" &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=messages.php?mode=write&id=".$GalaxyRowPlayer["id"].">";
|
||||
$Result .= '<img src="' . Wootook::getSkinUrl('base', 'default', 'graphics/img/m.gif') . '" alt="'.$lang['gl_sendmess'].'" title="'.$lang['gl_sendmess'].'" border="0"></a>';
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_bud"] == "1" &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=buddy.php?a=2&u=".$GalaxyRowPlayer['id']." >";
|
||||
$Result .= '<img src="' . Wootook::getSkinUrl('base', 'default', 'graphics/img/b.gif') . '" alt="'.$lang['gl_buddyreq'].'" title="'.$lang['gl_buddyreq'].'" border="0"></a>';
|
||||
$Result .= " ";
|
||||
}
|
||||
if ($user["settings_mis"] == "1" AND
|
||||
$MissileBtn == true &&
|
||||
$GalaxyRowPlayer['id']) {
|
||||
$Result .= "<a href=galaxy.php?mode=2&galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."¤t=".$user['current_planet']." >";
|
||||
$Result .= '<img src="' . Wootook::getSkinUrl('base', 'default', 'graphics/img/r.gif') . '" alt="'.$lang['gl_mipattack'].'" title="'.$lang['gl_mipattack'].'" border="0"></a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
96
src/includes/functions/GalaxyRowAlly.php
Normal file
96
src/includes/functions/GalaxyRowAlly.php
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowAlly ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="80"></th>';
|
||||
}
|
||||
|
||||
// Alliances
|
||||
$Result = "<th width=80>";
|
||||
if ($GalaxyRowUser['ally_id'] && $GalaxyRowUser['ally_id'] != 0) {
|
||||
$allyquery = doquery("SELECT * FROM {{table}} WHERE id=" . $GalaxyRowUser['ally_id'], "alliance", true);
|
||||
if ($allyquery) {
|
||||
$members_count = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE ally_id=" . $allyquery['id'] . ";", "users", true);
|
||||
|
||||
if ($members_count[0] > 1) {
|
||||
$add = "s";
|
||||
} else {
|
||||
$add = "";
|
||||
}
|
||||
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c>".htmlspecialchars($lang['Alliance'], ENT_QUOTES, 'UTF-8')." ". htmlspecialchars($allyquery['ally_name'], ENT_QUOTES, 'UTF-8') ." ".$lang['gl_with']." ". $members_count[0] ." ". $lang['gl_membre'] . $add ."</td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "<th>";
|
||||
$Result .= "<table>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td><a href=alliance.php?mode=ainfo&a=". intval($allyquery['id']) .">".$lang['gl_ally_internal']."</a></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td><a href=stat.php?start=101&who=ally>".$lang['gl_stats']."</a></td>";
|
||||
if ($allyquery["ally_web"] != "") {
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td><a href=". htmlspecialchars($allyquery["ally_web"], ENT_QUOTES, 'UTF-8') ." target=_new>".$lang['gl_ally_web']."</td>";
|
||||
}
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "</th>";
|
||||
$Result .= "</table>\"";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
if ($user['ally_id'] == $GalaxyRowUser['ally_id']) {
|
||||
$Result .= "<span class=\"allymember\">". htmlspecialchars($allyquery['ally_tag'], ENT_QUOTES, 'UTF-8') ."</span></a>";
|
||||
} else {
|
||||
$Result .= $allyquery['ally_tag'] ."</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
105
src/includes/functions/GalaxyRowDebris.php
Normal file
105
src/includes/functions/GalaxyRowDebris.php
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowDebris ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $dpath, $CurrentRC, $user, $pricelist;
|
||||
// Cdr
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=30>";
|
||||
if ($GalaxyRow) {
|
||||
if ($GalaxyRow["metal"] != 0 || $GalaxyRow["crystal"] != 0) {
|
||||
$RecNeeded = ceil(($GalaxyRow["metal"] + $GalaxyRow["crystal"]) / $pricelist[209]['capacity']);
|
||||
if ($RecNeeded < $CurrentRC) {
|
||||
$RecSended = $RecNeeded;
|
||||
} elseif ($RecNeeded >= $CurrentRC) {
|
||||
$RecSended = $CurrentRC;
|
||||
} else {
|
||||
$RecSended = $RecyclerCount;
|
||||
}
|
||||
$Result = "<th style=\"";
|
||||
if (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 10000000) {
|
||||
$Result .= "background-color: rgb(100, 0, 0);";
|
||||
} elseif (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 1000000) {
|
||||
$Result .= "background-color: rgb(100, 100, 0);";
|
||||
} elseif (($GalaxyRow["metal"] + $GalaxyRow["crystal"]) >= 100000) {
|
||||
$Result .= "background-color: rgb(0, 100, 0);";
|
||||
}
|
||||
$Result .= "background-image: none;\" width=30>";
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>";
|
||||
$Result .= $lang['Debris']." [".$Galaxy.":".$System.":".$Planet."]";
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th width=80>";
|
||||
$Result .= "<img src=". $dpath ."planeten/debris.jpg height=75 width=75 />";
|
||||
$Result .= "</th>";
|
||||
$Result .= "<th>";
|
||||
$Result .= "<table>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['gl_ressource']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th>".$lang['Metal']." </th><th>". number_format( $GalaxyRow['metal'], 0, '', '.') ."</th>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th>".$lang['Crystal']." </th><th>". number_format( $GalaxyRow['crystal'], 0, '', '.') ."</th>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['gl_action']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th colspan=2 align=left>";
|
||||
$Result .= "<a href= # onclick='javascript:doit (8, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$RecSended.");' >". $lang['type_mission'][8] ."</a>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "</th>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>\"";
|
||||
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
$Result .= "<img src=". $dpath ."planeten/debris.jpg height=22 width=22></a>";
|
||||
}
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
132
src/includes/functions/GalaxyRowMoon.php
Normal file
132
src/includes/functions/GalaxyRowMoon.php
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowMoon($GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user, $dpath, $HavePhalanx, $CurrentSystem, $CurrentGalaxy, $CanDestroy;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="30"></th>';
|
||||
}
|
||||
|
||||
// Lune
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=30>";
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType6Link = "<a href=# onclick='javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$user["spio_anz"].");' >". $lang['type_mission'][6] ."</a><br /><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType6Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType1Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=1>". $lang['type_mission'][1] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType1Link = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType5Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=5>". $lang['type_mission'][5] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType5Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType4Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=4>". $lang['type_mission'][4] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType4Link = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
if ($CanDestroy > 0) {
|
||||
$MissionType9Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=9>". $lang['type_mission'][9] ."</a>";
|
||||
} else {
|
||||
$MissionType9Link = "";
|
||||
}
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType9Link = "";
|
||||
}
|
||||
|
||||
$MissionType3Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=3>". $lang['type_mission'][3] ."</a><br />";
|
||||
|
||||
if ($GalaxyRow && (!isset($GalaxyRowPlanet["destruyed"]) || $GalaxyRowPlanet["destruyed"] == 0) && $GalaxyRow["id_luna"] != 0) {
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>";
|
||||
$Result .= $lang['Moon'].": ".$GalaxyRowPlanet["name"]." [".$Galaxy.":".$System.":".$Planet."]";
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th width=80>";
|
||||
$Result .= "<img src=". $dpath ."planeten/mond.jpg height=75 width=75 />";
|
||||
$Result .= "</th>";
|
||||
$Result .= "<th>";
|
||||
$Result .= "<table>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['caracters']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th>".$lang['diameter']."</th>";
|
||||
$Result .= "<th>". number_format($GalaxyRowPlanet['diameter'], 0, '', '.') ."</th>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th>".$lang['temperature']."</th><th>". number_format($GalaxyRowPlanet['temp_min'], 0, '', '.') ."</th>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['Actions']."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<th colspan=2 align=center>";
|
||||
$Result .= $MissionType6Link;
|
||||
$Result .= $MissionType3Link;
|
||||
$Result .= $MissionType4Link;
|
||||
$Result .= $MissionType1Link;
|
||||
$Result .= $MissionType5Link;
|
||||
$Result .= $MissionType9Link;
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "</th>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>\"";
|
||||
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
$Result .= "<img src=". $dpath ."planeten/small/s_mond.jpg height=22 width=22>";
|
||||
$Result .= "</a>";
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
136
src/includes/functions/GalaxyRowPlanet.php
Normal file
136
src/includes/functions/GalaxyRowPlanet.php
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowPlanet ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $dpath, $user, $HavePhalanx, $CurrentSystem, $CurrentGalaxy;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="30"></th>';
|
||||
}
|
||||
// Planete (Image)
|
||||
$Result = "<th width=30>";
|
||||
|
||||
$GalaxyRowUser = doquery("SELECT * FROM {{table}} WHERE id='".$GalaxyRowPlanet['id_owner']."';", 'users', true);
|
||||
if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0 && $GalaxyRow["id_planet"] != 0) {
|
||||
if ($HavePhalanx <> 0) {
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
|
||||
$Range = GetPhalanxRange ( $HavePhalanx );
|
||||
if ($SystemLimitMin < 1) {
|
||||
$SystemLimitMin = 1;
|
||||
}
|
||||
$SystemLimitMax = $CurrentSystem + $Range;
|
||||
if ($System <= $SystemLimitMax) {
|
||||
if ($System >= $SystemLimitMin) {
|
||||
$PhalanxTypeLink = "<a href=# onclick=fenster('phalanx.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."') >".$lang['gl_phalanx']."</a><br />";
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType6Link = "<a href=# onclick='javascript:doit(6, ".$Galaxy.", ".$System.", ".$Planet.", ".$PlanetType.", ".$user["spio_anz"].");' >". $lang['type_mission'][6] ."</a><br /><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType6Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType1Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=1>". $lang['type_mission'][1] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType1Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType5Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=5>". $lang['type_mission'][5] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType5Link = "";
|
||||
}
|
||||
if ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$MissionType4Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=4>". $lang['type_mission'][4] ."</a><br />";
|
||||
} elseif ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$MissionType4Link = "";
|
||||
}
|
||||
$MissionType3Link = "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."&target_mission=3>". $lang['type_mission'][3] ."</a>";
|
||||
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=240>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>";
|
||||
$Result .= $lang['gl_planet'] ." ". stripslashes($GalaxyRowPlanet["name"]) ." [".$Galaxy.":".$System.":".$Planet."]";
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<th width=80>";
|
||||
$Result .= "<img src=". $dpath ."planeten/small/s_". $GalaxyRowPlanet["image"] .".jpg height=75 width=75 />";
|
||||
$Result .= "</th>";
|
||||
$Result .= "<th align=left>";
|
||||
$Result .= $MissionType6Link;
|
||||
$Result .= $PhalanxTypeLink;
|
||||
$Result .= $MissionType1Link;
|
||||
$Result .= $MissionType5Link;
|
||||
$Result .= $MissionType4Link;
|
||||
$Result .= $MissionType3Link;
|
||||
$Result .= "</th>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>\"";
|
||||
// $Result .= ", STICKY, MOUSEOFF, DELAY, ". ($user["settings_tooltiptime"] * 1000) .", CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
$Result .= "<img src=". $dpath ."planeten/small/s_". $GalaxyRowPlanet["image"] .".jpg height=30 width=30>";
|
||||
// $Result .= $GalaxyRowPlanet["name"];
|
||||
$Result .= "</a>";
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
106
src/includes/functions/GalaxyRowPlanetName.php
Normal file
106
src/includes/functions/GalaxyRowPlanetName.php
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowPlanetName ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user, $HavePhalanx, $CurrentSystem, $CurrentGalaxy;
|
||||
|
||||
if (empty($GalaxyRowPlanet)) {
|
||||
return '<th width="130"></th>';
|
||||
}
|
||||
|
||||
// Planete (Nom)
|
||||
$Result = "<th style=\"white-space: nowrap;\" width=130>";
|
||||
|
||||
if ($GalaxyRowUser['ally_id'] == $user['ally_id'] AND
|
||||
$GalaxyRowUser['id'] != $user['id'] AND
|
||||
$user['ally_id'] != '') {
|
||||
$TextColor = "<font color=\"green\">";
|
||||
$EndColor = "</font>";
|
||||
} elseif ($GalaxyRowUser['id'] == $user['id']) {
|
||||
$TextColor = "<font color=\"red\">";
|
||||
$EndColor = "</font>";
|
||||
} else {
|
||||
$TextColor = '';
|
||||
$EndColor = "";
|
||||
}
|
||||
|
||||
if ($GalaxyRowPlanet['last_update'] > (time()-59 * 60) AND
|
||||
$GalaxyRowUser['id'] != $user['id']) {
|
||||
$Inactivity = pretty_time_hour(time() - $GalaxyRowPlanet['last_update']);
|
||||
}
|
||||
if ($GalaxyRow && $GalaxyRowPlanet["destruyed"] == 0) {
|
||||
if ($HavePhalanx <> 0) {
|
||||
if ($GalaxyRowPlanet["galaxy"] == $CurrentGalaxy) {
|
||||
$Range = GetPhalanxRange ( $HavePhalanx );
|
||||
if ($CurrentGalaxy + $Range <= $CurrentSystem AND
|
||||
$CurrentSystem >= $CurrentGalaxy - $Range) {
|
||||
$PhalanxTypeLink = "<a href=# onclick=fenster('phalanx.php?galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."&planettype=".$PlanetType."') title=\"".$lang['gl_phalanx']."\">".$GalaxyRowPlanet['name']."</a><br />";
|
||||
} else {
|
||||
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
|
||||
}
|
||||
} else {
|
||||
$PhalanxTypeLink = stripslashes($GalaxyRowPlanet['name']);
|
||||
}
|
||||
|
||||
$Result .= $TextColor . $PhalanxTypeLink . $EndColor;
|
||||
|
||||
if ($GalaxyRowPlanet['last_update'] > (time()-59 * 60) AND
|
||||
$GalaxyRowUser['id'] != $user['id']) {
|
||||
if ($GalaxyRowPlanet['last_update'] > (time()-10 * 60) AND
|
||||
$GalaxyRowUser['id'] != $user['id']) {
|
||||
$Result .= "(*)";
|
||||
} else {
|
||||
$Result .= " (".$Inactivity.")";
|
||||
}
|
||||
}
|
||||
} elseif ($GalaxyRowPlanet["destruyed"] != 0) {
|
||||
$Result .= $lang['gl_destroyedplanet'];
|
||||
}
|
||||
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
50
src/includes/functions/GalaxyRowPos.php
Normal file
50
src/includes/functions/GalaxyRowPos.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $GalaxyRow
|
||||
*/
|
||||
function GalaxyRowPos ( $Planet, $GalaxyRow ) {
|
||||
// Pos
|
||||
$Result = "<th width=30>";
|
||||
$Result .= "<a href=\"#\"";
|
||||
if ($GalaxyRow) {
|
||||
$Result .= " tabindex=\"". ($Planet + 1) ."\"";
|
||||
}
|
||||
$Result .= ">". $Planet ."</a>";
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
141
src/includes/functions/GalaxyRowUser.php
Normal file
141
src/includes/functions/GalaxyRowUser.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $GalaxyRow
|
||||
* @param unknown_type $GalaxyRowPlanet
|
||||
* @param unknown_type $GalaxyRowUser
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $PlanetType
|
||||
*/
|
||||
function GalaxyRowUser ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowUser, $Galaxy, $System, $Planet, $PlanetType ) {
|
||||
global $lang, $user;
|
||||
|
||||
// Joueur
|
||||
$Result = "<th width=150>";
|
||||
if ($GalaxyRowUser && $GalaxyRowPlanet["destruyed"] == 0) {
|
||||
$NoobProt = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotection';", 'config', true);
|
||||
$NoobTime = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotectiontime';", 'config', true);
|
||||
$NoobMulti = doquery("SELECT * FROM {{table}} WHERE `config_name` = 'noobprotectionmulti';", 'config', true);
|
||||
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $user['id'] ."';", 'statpoints', true);
|
||||
$User2Points = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '". $GalaxyRowUser['id'] ."';", 'statpoints', true);
|
||||
$CurrentPoints = $UserPoints['total_points'];
|
||||
$RowUserPoints = $User2Points['total_points'];
|
||||
$CurrentLevel = $CurrentPoints * $NoobMulti['config_value'];
|
||||
$RowUserLevel = $RowUserPoints * $NoobMulti['config_value'];
|
||||
if ($GalaxyRowUser['bana'] == 1 AND
|
||||
$GalaxyRowUser['urlaubs_modus'] == 1) {
|
||||
$Systemtatus2 = $lang['vacation_shortcut']." <a href=\"banned.php\"><span class=\"banned\">".$lang['banned_shortcut']."</span></a>";
|
||||
$Systemtatus = "<span class=\"vacation\">";
|
||||
} elseif ($GalaxyRowUser['bana'] == 1) {
|
||||
$Systemtatus2 = "<a href=\"banned.php\"><span class=\"banned\">".$lang['banned_shortcut']."</span></a>";
|
||||
$Systemtatus = "";
|
||||
} elseif ($GalaxyRowUser['urlaubs_modus'] == 1) {
|
||||
$Systemtatus2 = "<span class=\"vacation\">".$lang['vacation_shortcut']."</span>";
|
||||
$Systemtatus = "<span class=\"vacation\">";
|
||||
} elseif ($GalaxyRowUser['onlinetime'] < (time()-60 * 60 * 24 * 7) AND
|
||||
$GalaxyRowUser['onlinetime'] > (time()-60 * 60 * 24 * 28)) {
|
||||
$Systemtatus2 = "<span class=\"inactive\">".$lang['inactif_7_shortcut']."</span>";
|
||||
$Systemtatus = "<span class=\"inactive\">";
|
||||
} elseif ($GalaxyRowUser['onlinetime'] < (time()-60 * 60 * 24 * 28)) {
|
||||
$Systemtatus2 = "<span class=\"inactive\">".$lang['inactif_7_shortcut']."</span><span class=\"longinactive\"> ".$lang['inactif_28_shortcut']."</span>";
|
||||
$Systemtatus = "<span class=\"longinactive\">";
|
||||
} elseif ($RowUserLevel < $CurrentPoints AND
|
||||
$NoobProt['config_value'] == 1 AND
|
||||
$NoobTime['config_value'] * 1000 > $RowUserPoints) {
|
||||
$Systemtatus2 = "<span class=\"noob\">".$lang['weak_player_shortcut']."</span>";
|
||||
$Systemtatus = "<span class=\"noob\">";
|
||||
} elseif ($RowUserPoints > $CurrentLevel AND
|
||||
$NoobProt['config_value'] == 1 AND
|
||||
$NoobTime['config_value'] * 1000 > $CurrentPoints) {
|
||||
$Systemtatus2 = $lang['strong_player_shortcut'];
|
||||
$Systemtatus = "<span class=\"strong\">";
|
||||
} else {
|
||||
$Systemtatus2 = "";
|
||||
$Systemtatus = "";
|
||||
}
|
||||
$Systemtatus4 = $User2Points['total_rank'];
|
||||
if ($Systemtatus2 != '') {
|
||||
$Systemtatus6 = "<font color=\"white\">(</font>";
|
||||
$Systemtatus7 = "<font color=\"white\">)</font>";
|
||||
}
|
||||
if ($Systemtatus2 == '') {
|
||||
$Systemtatus6 = "";
|
||||
$Systemtatus7 = "";
|
||||
}
|
||||
$admin = "";
|
||||
if ($GalaxyRowUser['authlevel'] == LEVEL_ADMIN) {
|
||||
$admin = "<font color=\"red\"><blink>A</blink></font>";
|
||||
} else if ($GalaxyRowUser['authlevel'] == LEVEL_OPERATOR) {
|
||||
$admin = "<font color=\"lime\"><blink>O</blink></font>";
|
||||
} else if ($GalaxyRowUser['authlevel'] == LEVEL_MODERATOR) {
|
||||
$admin = "<font color=\"skyblue\"><blink>M</blink></font>";
|
||||
}
|
||||
$Systemtart = $User2Points['total_rank'];
|
||||
if (strlen($Systemtart) < 3) {
|
||||
$Systemtart = 1;
|
||||
} else {
|
||||
$Systemtart = (floor( $User2Points['total_rank'] / 100 ) * 100) + 1;
|
||||
}
|
||||
$Result .= "<a style=\"cursor: pointer;\"";
|
||||
$Result .= " onmouseover='return overlib(\"";
|
||||
$Result .= "<table width=190>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=2>".$lang['Player']." ".$GalaxyRowUser['username']." ".$lang['Place']." ".$Systemtatus4."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
if ($GalaxyRowUser['id'] != $user['id']) {
|
||||
$Result .= "<td><a href=messages.php?mode=write&id=".$GalaxyRowUser['id'].">".$lang['gl_sendmess']."</a></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td><a href=buddy.php?a=2&u=".$GalaxyRowUser['id'].">".$lang['gl_buddyreq']."</a></td>";
|
||||
$Result .= "</tr><tr>";
|
||||
}
|
||||
$Result .= "<td><a href=stat.php?who=player&start=".$Systemtart.">".$lang['gl_stats']."</a></td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>\"";
|
||||
$Result .= ", STICKY, MOUSEOFF, DELAY, 750, CENTER, OFFSETX, -40, OFFSETY, -40 );'";
|
||||
$Result .= " onmouseout='return nd();'>";
|
||||
$Result .= $Systemtatus;
|
||||
$Result .= $GalaxyRowUser["username"]."</span>";
|
||||
$Result .= $Systemtatus6;
|
||||
$Result .= $Systemtatus;
|
||||
$Result .= $Systemtatus2;
|
||||
$Result .= $Systemtatus7." ".$admin;
|
||||
$Result .= "</span></a>";
|
||||
}
|
||||
$Result .= "</th>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
80
src/includes/functions/GetMaxConstructibleElements.php
Normal file
80
src/includes/functions/GetMaxConstructibleElements.php
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Element
|
||||
* @param unknown_type $Ressources
|
||||
*/
|
||||
function GetMaxConstructibleElements ($Element, $Ressources) {
|
||||
global $pricelist;
|
||||
// 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'];
|
||||
$Buildable = floor($Ressources["metal"] / $ResType_1_Needed);
|
||||
$MaxElements = $Buildable;
|
||||
}
|
||||
|
||||
if ($pricelist[$Element]['crystal'] != 0) {
|
||||
$ResType_2_Needed = $pricelist[$Element]['crystal'];
|
||||
$Buildable = floor($Ressources["crystal"] / $ResType_2_Needed);
|
||||
}
|
||||
if (!isset($MaxElements)) {
|
||||
$MaxElements = $Buildable;
|
||||
} elseif ($MaxElements > $Buildable) {
|
||||
$MaxElements = $Buildable;
|
||||
}
|
||||
|
||||
if ($pricelist[$Element]['deuterium'] != 0) {
|
||||
$ResType_3_Needed = $pricelist[$Element]['deuterium'];
|
||||
$Buildable = floor($Ressources["deuterium"] / $ResType_3_Needed);
|
||||
}
|
||||
if (!isset($MaxElements)) {
|
||||
$MaxElements = $Buildable;
|
||||
} elseif ($MaxElements > $Buildable) {
|
||||
$MaxElements = $Buildable;
|
||||
}
|
||||
|
||||
if ($pricelist[$Element]['energy'] != 0) {
|
||||
$ResType_4_Needed = $pricelist[$Element]['energy'];
|
||||
$Buildable = floor($Ressources["energy_max"] / $ResType_4_Needed);
|
||||
}
|
||||
if ($Buildable < 1) {
|
||||
$MaxElements = 0;
|
||||
}
|
||||
|
||||
return $MaxElements;
|
||||
}
|
||||
// Verion History
|
||||
// - 1.0 Version initiale (creation)
|
||||
// - 1.1 Correction bug ressources n<>gatives ...
|
||||
// - 1.2 Correction bug quand pas de m<>tal
|
||||
?>
|
||||
47
src/includes/functions/GetMissileRange.php
Normal file
47
src/includes/functions/GetMissileRange.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function GetMissileRange () {
|
||||
global $resource, $user;
|
||||
|
||||
if ($user[$resource[117]] > 0) {
|
||||
$MissileRange = ($user[$resource[117]] * 5) - 1;
|
||||
} elseif ($user[$resource[117]] == 0) {
|
||||
$MissileRange = 0;
|
||||
}
|
||||
|
||||
return $MissileRange;
|
||||
}
|
||||
|
||||
?>
|
||||
50
src/includes/functions/GetPhalanxRange.php
Normal file
50
src/includes/functions/GetPhalanxRange.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $PhalanxLevel
|
||||
*/
|
||||
function GetPhalanxRange ( $PhalanxLevel ) {
|
||||
// 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 =
|
||||
$PhalanxRange = 0;
|
||||
if ($PhalanxLevel > 1) {
|
||||
for ($Level = 2; $Level < $PhalanxLevel + 1; $Level++) {
|
||||
$lvl = ($Level * 2) - 1;
|
||||
$PhalanxRange += $lvl;
|
||||
}
|
||||
}
|
||||
return $PhalanxRange;
|
||||
}
|
||||
|
||||
?>
|
||||
75
src/includes/functions/GetRestPrice.php
Normal file
75
src/includes/functions/GetRestPrice.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $user
|
||||
* @param unknown_type $planet
|
||||
* @param unknown_type $Element
|
||||
* @param unknown_type $userfactor
|
||||
*/
|
||||
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]];
|
||||
}
|
||||
|
||||
$array = array(
|
||||
'metal' => $lang["Metal"],
|
||||
'crystal' => $lang["Crystal"],
|
||||
'deuterium' => $lang["Deuterium"],
|
||||
'energy_max' => $lang["Energy"]
|
||||
);
|
||||
|
||||
$text = "<br><font color=\"#7f7f7f\">". $lang['Rest_ress'] .": ";
|
||||
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: rgb(127, 95, 96);\">". pretty_number($planet[$ResType] - $cost) ."</b> ";
|
||||
} else {
|
||||
$text .= "<b style=\"color: rgb(95, 127, 108);\">". pretty_number($planet[$ResType] - $cost) ."</b> ";
|
||||
}
|
||||
}
|
||||
}
|
||||
$text .= "</font>";
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
?>
|
||||
138
src/includes/functions/InsertGalaxyScripts.php
Normal file
138
src/includes/functions/InsertGalaxyScripts.php
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
*/
|
||||
function InsertGalaxyScripts ( $CurrentPlanet ) {
|
||||
global $lang;
|
||||
|
||||
$Script = "<div style=\"top: 10px;\" id=\"content\">";
|
||||
$Script .= "<script language=\"JavaScript\">\n";
|
||||
$Script .= "function galaxy_submit(value) {\n";
|
||||
$Script .= " document.getElementById('auto').name = value;\n";
|
||||
$Script .= " document.getElementById('galaxy_form').submit();\n";
|
||||
$Script .= "}\n\n";
|
||||
|
||||
$Script .= "function fenster(target_url,win_name) {\n";
|
||||
$Script .= " var new_win = window.open(target_url,win_name,'resizable=yes,scrollbars=yes,menubar=no,toolbar=no,width=640,height=480,top=0,left=0');\n";
|
||||
$Script .= " new_win.focus();\n";
|
||||
$Script .= "}\n";
|
||||
$Script .= "</script>\n";
|
||||
|
||||
$Script .= "<script language=\"JavaScript\" src=\"scripts/tw-sack.js\"></script>\n";
|
||||
|
||||
$Script .= "<script type=\"text/javascript\">\n\n";
|
||||
$Script .= "var ajax = new sack();\n";
|
||||
$Script .= "var strInfo = \"\";\n";
|
||||
|
||||
$Script .= "function whenResponse () {\n";
|
||||
$Script .= " retVals = this.response.split(\"|\");\n";
|
||||
$Script .= " Message = retVals[0];\n";
|
||||
$Script .= " Infos = retVals[1];\n";
|
||||
$Script .= " retVals = Infos.split(\" \");\n";
|
||||
$Script .= " UsedSlots = retVals[0];\n";
|
||||
$Script .= " SpyProbes = retVals[1];\n";
|
||||
$Script .= " Recyclers = retVals[2];\n";
|
||||
$Script .= " Missiles = retVals[3];\n";
|
||||
$Script .= " retVals = Message.split(\";\");\n";
|
||||
$Script .= " CmdCode = retVals[0];\n";
|
||||
$Script .= " strInfo = retVals[1];\n";
|
||||
$Script .= " addToTable(\"done\", \"success\");\n";
|
||||
$Script .= " changeSlots( UsedSlots );\n";
|
||||
$Script .= " setShips(\"probes\", SpyProbes );\n";
|
||||
$Script .= " setShips(\"recyclers\", Recyclers );\n";
|
||||
$Script .= " setShips(\"missiles\", Missiles );\n";
|
||||
$Script .= "}\n\n";
|
||||
|
||||
$Script .= "function doit (order, galaxy, system, planet, planettype, shipcount) {\n";
|
||||
$Script .= " ajax.requestFile = \"flotenajax.php?action=send\";\n";
|
||||
$Script .= " ajax.runResponse = whenResponse;\n";
|
||||
$Script .= " ajax.execute = true;\n\n";
|
||||
$Script .= " ajax.setVar(\"thisgalaxy\", ". $CurrentPlanet["galaxy"] .");\n";
|
||||
$Script .= " ajax.setVar(\"thissystem\", ". $CurrentPlanet["system"] .");\n";
|
||||
$Script .= " ajax.setVar(\"thisplanet\", ". $CurrentPlanet["planet"] .");\n";
|
||||
$Script .= " ajax.setVar(\"thisplanettype\", ". $CurrentPlanet["planet_type"] .");\n";
|
||||
$Script .= " ajax.setVar(\"mission\", order);\n";
|
||||
$Script .= " ajax.setVar(\"galaxy\", galaxy);\n";
|
||||
$Script .= " ajax.setVar(\"system\", system);\n";
|
||||
$Script .= " ajax.setVar(\"planet\", planet);\n";
|
||||
$Script .= " ajax.setVar(\"planettype\", planettype);\n";
|
||||
$Script .= " if (order == 6)\n";
|
||||
$Script .= " ajax.setVar(\"ship210\", shipcount);\n";
|
||||
$Script .= " if (order == 7) {\n";
|
||||
$Script .= " ajax.setVar(\"ship208\", 1);\n\n";
|
||||
$Script .= " ajax.setVar(\"ship203\", 2);\n\n";
|
||||
$Script .= " }\n";
|
||||
$Script .= " if (order == 8)\n";
|
||||
$Script .= " ajax.setVar(\"ship209\", shipcount);\n\n";
|
||||
$Script .= " ajax.runAJAX();\n";
|
||||
$Script .= "}\n\n";
|
||||
|
||||
$Script .= "function addToTable(strDataResult, strClass) {\n";
|
||||
$Script .= " var e = document.getElementById('fleetstatusrow');\n";
|
||||
$Script .= " var e2 = document.getElementById('fleetstatustable');\n";
|
||||
$Script .= " e.style.display = '';\n";
|
||||
$Script .= " if(e2.rows.length > 2) {\n";
|
||||
$Script .= " e2.deleteRow(2);\n";
|
||||
$Script .= " }\n";
|
||||
$Script .= " var row = e2.insertRow(0);\n";
|
||||
$Script .= " var td1 = document.createElement(\"td\");\n";
|
||||
$Script .= " var td1text = document.createTextNode(strInfo);\n";
|
||||
$Script .= " td1.appendChild(td1text);\n";
|
||||
$Script .= " var td2 = document.createElement(\"td\");\n";
|
||||
$Script .= " var span = document.createElement(\"span\");\n";
|
||||
$Script .= " var spantext = document.createTextNode(strDataResult);\n";
|
||||
$Script .= " var spanclass = document.createAttribute(\"class\");\n";
|
||||
$Script .= " spanclass.nodeValue = strClass;\n";
|
||||
$Script .= " span.setAttributeNode(spanclass);\n";
|
||||
$Script .= " span.appendChild(spantext);\n";
|
||||
$Script .= " td2.appendChild(span);\n";
|
||||
$Script .= " row.appendChild(td1);\n";
|
||||
$Script .= " row.appendChild(td2);\n";
|
||||
$Script .= "}\n\n";
|
||||
|
||||
$Script .= "function changeSlots(slotsInUse) {\n";
|
||||
$Script .= " var e = document.getElementById('slots');\n";
|
||||
$Script .= " e.innerHTML = slotsInUse;\n";
|
||||
$Script .= "}\n\n";
|
||||
|
||||
$Script .= "function setShips(ship, count) {\n";
|
||||
$Script .= " var e = document.getElementById(ship);\n";
|
||||
$Script .= " e.innerHTML = count;\n";
|
||||
$Script .= "}\n";
|
||||
|
||||
$Script .= "</script>\n";
|
||||
|
||||
return $Script;
|
||||
}
|
||||
|
||||
?>
|
||||
83
src/includes/functions/InsertJavaScriptChronoApplet.php
Normal file
83
src/includes/functions/InsertJavaScriptChronoApplet.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Type
|
||||
* @param unknown_type $Ref
|
||||
* @param unknown_type $Value
|
||||
* @param unknown_type $Init
|
||||
*/
|
||||
function InsertJavaScriptChronoApplet ( $Type, $Ref, $Value, $Init ) {
|
||||
if ($Init == true) {
|
||||
$JavaString = "<script type=\"text/javascript\">\n";
|
||||
$JavaString .= "function t". $Type . $Ref ."() {\n";
|
||||
$JavaString .= "v = new Date();\n";
|
||||
$JavaString .= "var bxx". $Type . $Ref ." = document.getElementById('bxx". $Type . $Ref ."');\n";
|
||||
$JavaString .= "n = new Date();\n";
|
||||
$JavaString .= "ss". $Type . $Ref ." = pp". $Type . $Ref .";\n";
|
||||
$JavaString .= "ss". $Type . $Ref ." = ss". $Type . $Ref ." - Math.round((n.getTime() - v.getTime()) / 1000.);\n";
|
||||
$JavaString .= "m". $Type . $Ref ." = 0;\n";
|
||||
$JavaString .= "h". $Type . $Ref ." = 0;\n";
|
||||
$JavaString .= "if (ss". $Type . $Ref ." < 0) {\n";
|
||||
$JavaString .= " bxx". $Type . $Ref .".innerHTML = \"-\";\n";
|
||||
$JavaString .= "} else {\n";
|
||||
$JavaString .= " if (ss". $Type . $Ref ." > 59) {\n";
|
||||
$JavaString .= " m". $Type . $Ref ." = Math.floor(ss". $Type . $Ref ." / 60);\n";
|
||||
$JavaString .= " ss". $Type . $Ref ." = ss". $Type . $Ref ." - m". $Type . $Ref ." * 60;\n";
|
||||
$JavaString .= " }\n";
|
||||
$JavaString .= " if (m". $Type . $Ref ." > 59) {\n";
|
||||
$JavaString .= " h". $Type . $Ref ." = Math.floor(m". $Type . $Ref ." / 60);\n";
|
||||
$JavaString .= " m". $Type . $Ref ." = m". $Type . $Ref ." - h". $Type . $Ref ." * 60;\n";
|
||||
$JavaString .= " }\n";
|
||||
$JavaString .= " if (ss". $Type . $Ref ." < 10) {\n";
|
||||
$JavaString .= " ss". $Type . $Ref ." = \"0\" + ss". $Type . $Ref .";\n";
|
||||
$JavaString .= " }\n";
|
||||
$JavaString .= " if (m". $Type . $Ref ." < 10) {\n";
|
||||
$JavaString .= " m". $Type . $Ref ." = \"0\" + m". $Type . $Ref .";\n";
|
||||
$JavaString .= " }\n";
|
||||
$JavaString .= " bxx". $Type . $Ref .".innerHTML = h". $Type . $Ref ." + \":\" + m". $Type . $Ref ." + \":\" + ss". $Type . $Ref .";\n";
|
||||
$JavaString .= "}\n";
|
||||
$JavaString .= "pp". $Type . $Ref ." = pp". $Type . $Ref ." - 1;\n";
|
||||
$JavaString .= "window.setTimeout(\"t". $Type . $Ref ."();\", 999);\n";
|
||||
$JavaString .= "}\n";
|
||||
$JavaString .= "</script>\n";
|
||||
} else {
|
||||
$JavaString = "<script language=\"JavaScript\">\n";
|
||||
$JavaString .= "pp". $Type . $Ref ." = ". $Value .";\n";
|
||||
$JavaString .= "t". $Type . $Ref ."();\n";
|
||||
$JavaString .= "</script>\n";
|
||||
}
|
||||
|
||||
return $JavaString;
|
||||
}
|
||||
|
||||
?>
|
||||
58
src/includes/functions/IsOfficierAccessible.php
Normal file
58
src/includes/functions/IsOfficierAccessible.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
* @param unknown_type $Officier
|
||||
*/
|
||||
function IsOfficierAccessible ($CurrentUser, $Officier) {
|
||||
global $requirements, $resource, $pricelist;
|
||||
|
||||
if (isset($requirements[$Officier])) {
|
||||
$enabled = true;
|
||||
foreach($requirements[$Officier] as $ReqOfficier => $OfficierLevel) {
|
||||
if ($CurrentUser[$resource[$ReqOfficier]] &&
|
||||
$CurrentUser[$resource[$ReqOfficier]] >= $OfficierLevel) {
|
||||
$enabled = 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($CurrentUser[$resource[$Officier]] < $pricelist[$Officier]['max'] ) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
58
src/includes/functions/IsTechnologieAccessible.php
Normal file
58
src/includes/functions/IsTechnologieAccessible.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $user
|
||||
* @param unknown_type $planet
|
||||
* @param unknown_type $element
|
||||
*/
|
||||
function IsTechnologieAccessible($user, $planet, $element)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
global $requirements, $resource;
|
||||
|
||||
if (isset($requirements[$element])) {
|
||||
$enabled = true;
|
||||
foreach($requirements[$element] as $ReqElement => $EleLevel) {
|
||||
if (@$user[$resource[$ReqElement]] && $user[$resource[$ReqElement]] >= $EleLevel) {
|
||||
// break;
|
||||
} elseif ($planet[$resource[$ReqElement]] && $planet[$resource[$ReqElement]] >= $EleLevel) {
|
||||
$enabled = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $enabled;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
63
src/includes/functions/MessageForm.php
Normal file
63
src/includes/functions/MessageForm.php
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Title
|
||||
* @param unknown_type $Message
|
||||
* @param unknown_type $Goto
|
||||
* @param unknown_type $Button
|
||||
* @param unknown_type $TwoLines
|
||||
*/
|
||||
function MessageForm ($Title, $Message, $Goto = '', $Button = ' ok ', $TwoLines = false) {
|
||||
$Form = "<center>";
|
||||
$Form .= "<form action=\"". $Goto ."\" method=\"post\">";
|
||||
$Form .= "<table width=\"519\">";
|
||||
$Form .= "<tr>";
|
||||
$Form .= "<td class=\"c\" colspan=\"2\">". $Title ."</td>";
|
||||
$Form .= "</tr><tr>";
|
||||
if ($TwoLines == true) {
|
||||
$Form .= "<th colspan=\"2\">". $Message ."</th>";
|
||||
$Form .= "</tr><tr>";
|
||||
$Form .= "<th colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"". $Button ."\"></th>";
|
||||
} else {
|
||||
$Form .= "<th colspan=\"2\">". $Message ."<input type=\"submit\" value=\"". $Button ."\"></th>";
|
||||
}
|
||||
$Form .= "</tr>";
|
||||
$Form .= "</table>";
|
||||
$Form .= "</form>";
|
||||
$Form .= "</center>";
|
||||
|
||||
return $Form;
|
||||
}
|
||||
// Release History
|
||||
// - 1.0 Mise en fonction, Documentation
|
||||
?>
|
||||
104
src/includes/functions/MipCombatEngine.php
Normal file
104
src/includes/functions/MipCombatEngine.php
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $NbreMip
|
||||
* @param unknown_type $IDAversaire
|
||||
*/
|
||||
function MipAttack ($NbreMip, $IDAversaire) {
|
||||
$TechnoArme = doquery("SELECT * FROM {{table}} WHERE `id`='" . $user['id'] . "'", "users");
|
||||
$InfoAdversaire = doquery("SELECT * FROM {{table}} WHERE `id`='" . $IDAversaire . "'", "planets", true);
|
||||
|
||||
$PuissanceAttaque = ($NbreMip * 12000) * (1.05 * $TechnoArme['military_tech']);
|
||||
|
||||
/*
|
||||
|
||||
401 => 'Lanceur de missiles',
|
||||
402 => 'Artillerie laser légère',
|
||||
403 => 'Artillerie laser lourde',
|
||||
404 => 'Canon de Gauss',
|
||||
405 => 'Artillerie à ions',
|
||||
406 => 'Lanceur de plasma',
|
||||
407 => 'Petit bouclier',
|
||||
408 => 'Grand bouclier',
|
||||
|
||||
*/
|
||||
|
||||
$TableauDeDefense = array(
|
||||
401 => array ('shield' => 20),
|
||||
402 => array ('shield' => 25),
|
||||
403 => array ('shield' => 100),
|
||||
404 => array ('shield' => 200),
|
||||
405 => array ('shield' => 500),
|
||||
406 => array ('shield' => 300),
|
||||
407 => array ('shield' => 2000),
|
||||
408 => array ('shield' => 2000)
|
||||
);
|
||||
|
||||
$DefenseAdversaire = array(
|
||||
401 => ($InfoAdversaire['misil_launcher']),
|
||||
402 => ($InfoAdversaire['small_laser']),
|
||||
403 => ($InfoAdversaire['big_laser']),
|
||||
404 => ($InfoAdversaire['gauss_canyon']),
|
||||
405 => ($InfoAdversaire['ionic_canyon']),
|
||||
406 => ($InfoAdversaire['buster_canyon']),
|
||||
407 => ($InfoAdversaire['small_protection_shield']),
|
||||
408 => ($InfoAdversaire['big_protection_shield'])
|
||||
);
|
||||
|
||||
while ($PuissanceAttaque > 20) {
|
||||
$RandomDefense = rand(401, 408);
|
||||
|
||||
$SelectionDefense = $DefenseAdversaire[$RandomDefense];
|
||||
if ($SelectionDefense > 0) {
|
||||
if ($PuissanceAttaque > ($SelectionDefense * $TableauDeDefense[$RandomDefense])) {
|
||||
$PuissanceAttaque = $PuissanceAttaque - ($SelectionDefense * $TableauDeDefense[$RandomDefense]);
|
||||
$DefenseAdversaire[$RandomDefense] = $DefenseAdversaire[$RandomDefense] - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$SqlDefenseur = "UPDATE {{table}} SET ";
|
||||
$SqlDefenseur .= "`small_laser`='".$DefenseAdversaire[402]."', ";
|
||||
$SqlDefenseur .= "`big_laser`='".$DefenseAdversaire[403]."', ";
|
||||
$SqlDefenseur .= "`gauss_canyon`='".$DefenseAdversaire[404]."', ";
|
||||
$SqlDefenseur .= "`ionic_canyon`='".$DefenseAdversaire[405]."', ";
|
||||
$SqlDefenseur .= "`buster_canyon`='".$DefenseAdversaire[406]."', ";
|
||||
$SqlDefenseur .= "`small_protection_shield`='".$DefenseAdversaire[407]."', ";
|
||||
$SqlDefenseur .= "`big_protection_shield`='".$DefenseAdversaire[408]."' ";
|
||||
$SqlDefenseur .= " WHERE `id`='".$IDAversaire."'";
|
||||
|
||||
doquery($SqlDefenseur, 'planets');
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
458
src/includes/functions/MissionCaseAttack.php
Normal file
458
src/includes/functions/MissionCaseAttack.php
Normal file
|
|
@ -0,0 +1,458 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseAttack($FleetRow)
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$pricelist = Wootook_Empire_Model_Game_Prices::getSingleton();
|
||||
$resource = Wootook_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
$CombatCaps = Wootook_Empire_Model_Game_Combat::getSingleton();
|
||||
|
||||
if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] <= time()) {
|
||||
|
||||
// refactored parts
|
||||
// {{{
|
||||
$targetPlanet = Wootook_Empire_Model_Planet::factoryFromCoords(array(
|
||||
'galaxy' => $FleetRow['fleet_end_galaxy'],
|
||||
'system' => $FleetRow['fleet_end_system'],
|
||||
'planet' => $FleetRow['fleet_end_planet'],
|
||||
'type' => $FleetRow['fleet_end_type']
|
||||
));
|
||||
|
||||
/*
|
||||
* Update planet resources and constructions
|
||||
*/
|
||||
Wootook::dispatchEvent('planet.update', array(
|
||||
'planet' => $targetPlanet
|
||||
));
|
||||
$targetPlanet->save();
|
||||
|
||||
$TargetUser = $targetPlanet->getUser();
|
||||
$CurrentUser = Wootook_Player_Model_Entity::factory($FleetRow['fleet_owner']);
|
||||
|
||||
$TargetUserID = $TargetUser->getId();
|
||||
$CurrentUserID = $CurrentUser->getId();
|
||||
|
||||
$TargetTechno = array(
|
||||
'military_tech' => $TargetUser->getData('military_tech'),
|
||||
'defence_tech' => $TargetUser->getData('defence_tech'),
|
||||
'shield_tech' => $TargetUser->getData('shield_tech')
|
||||
);
|
||||
|
||||
$CurrentTechno = array(
|
||||
'military_tech' => $CurrentUser->getData('military_tech'),
|
||||
'defence_tech' => $CurrentUser->getData('defence_tech'),
|
||||
'shield_tech' => $CurrentUser->getData('shield_tech')
|
||||
);
|
||||
// }}}
|
||||
for ($SetItem = 200; $SetItem < 500; $SetItem++) {
|
||||
if ($targetPlanet[$resource[$SetItem]] > 0) {
|
||||
$TargetSet[$SetItem]['count'] = $targetPlanet[$resource[$SetItem]];
|
||||
}
|
||||
}
|
||||
|
||||
$TheFleet = explode(";", $FleetRow['fleet_array']);
|
||||
foreach($TheFleet as $a => $b) {
|
||||
if ($b != '') {
|
||||
$a = explode(",", $b);
|
||||
$CurrentSet[$a[0]]['count'] = $a[1];
|
||||
}
|
||||
}
|
||||
|
||||
include_once($xnova_root_path . 'includes/ataki.' . PHPEXT);
|
||||
// Calcul de la duree de traitement (initialisation)
|
||||
$mtime = microtime();
|
||||
$mtime = explode(" ", $mtime);
|
||||
$mtime = $mtime[1] + $mtime[0];
|
||||
$starttime = $mtime;
|
||||
|
||||
$walka = walka($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno);
|
||||
// Calcul de la duree de traitement (calcul)
|
||||
$mtime = microtime();
|
||||
$mtime = explode(" ", $mtime);
|
||||
$mtime = $mtime[1] + $mtime[0];
|
||||
$endtime = $mtime;
|
||||
$totaltime = ($endtime - $starttime);
|
||||
// Ce qu'il reste de l'attaquant
|
||||
$CurrentSet = $walka["atakujacy"];
|
||||
// Ce qu'il reste de l'attaqué
|
||||
$TargetSet = $walka["wrog"];
|
||||
// Le resultat de la bataille
|
||||
$FleetResult = $walka["wygrana"];
|
||||
// Rapport long (rapport de bataille detaillé)
|
||||
$dane_do_rw = $walka["dane_do_rw"];
|
||||
// Rapport court (cdr + unitées perdues)
|
||||
$zlom = $walka["zlom"];
|
||||
|
||||
$FleetArray = "";
|
||||
$FleetAmount = 0;
|
||||
$FleetStorage = 0;
|
||||
foreach ($CurrentSet as $Ship => $Count) {
|
||||
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count['count'];
|
||||
$FleetArray .= $Ship . "," . $Count['count'] . ";";
|
||||
$FleetAmount += $Count['count'];
|
||||
}
|
||||
// Au cas ou le p'tit rigolo qu'a envoyé la flotte y avait mis des ressources ...
|
||||
$FleetStorage -= $FleetRow["fleet_resource_metal"];
|
||||
$FleetStorage -= $FleetRow["fleet_resource_crystal"];
|
||||
$FleetStorage -= $FleetRow["fleet_resource_deuterium"];
|
||||
|
||||
$targetPlanetUpd = "";
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $Ship => $Count) {
|
||||
$targetPlanetUpd .= "`" . $resource[$Ship] . "` = '" . $Count['count'] . "', ";
|
||||
}
|
||||
}
|
||||
// Determination des ressources pillées
|
||||
$Mining['metal'] = 0;
|
||||
$Mining['crystal'] = 0;
|
||||
$Mining['deuter'] = 0;
|
||||
if ($FleetResult == "a") {
|
||||
if ($FleetStorage > 0) {
|
||||
$metal = $targetPlanet['metal'] / 2;
|
||||
$crystal = $targetPlanet['crystal'] / 2;
|
||||
$deuter = $targetPlanet["deuterium"] / 2;
|
||||
if (($metal) > $FleetStorage / 3) {
|
||||
$Mining['metal'] = $FleetStorage / 3;
|
||||
$FleetStorage = $FleetStorage - $Mining['metal'];
|
||||
} else {
|
||||
$Mining['metal'] = $metal;
|
||||
$FleetStorage = $FleetStorage - $Mining['metal'];
|
||||
}
|
||||
|
||||
if (($crystal) > $FleetStorage / 2) {
|
||||
$Mining['crystal'] = $FleetStorage / 2;
|
||||
$FleetStorage = $FleetStorage - $Mining['crystal'];
|
||||
} else {
|
||||
$Mining['crystal'] = $crystal;
|
||||
$FleetStorage = $FleetStorage - $Mining['crystal'];
|
||||
}
|
||||
|
||||
if (($deuter) > $FleetStorage) {
|
||||
$Mining['deuter'] = $FleetStorage;
|
||||
$FleetStorage = $FleetStorage - $Mining['deuter'];
|
||||
} else {
|
||||
$Mining['deuter'] = $deuter;
|
||||
$FleetStorage = $FleetStorage - $Mining['deuter'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$Mining['metal'] = round($Mining['metal']);
|
||||
$Mining['crystal'] = round($Mining['crystal']);
|
||||
$Mining['deuter'] = round($Mining['deuter']);
|
||||
// Mise a jour de l'enregistrement de la planete attaquée
|
||||
$QryUpdateTarget = "UPDATE {{table}} SET ";
|
||||
$QryUpdateTarget .= $targetPlanetUpd;
|
||||
$QryUpdateTarget .= "`metal` = `metal` - '" . $Mining['metal'] . "', ";
|
||||
$QryUpdateTarget .= "`crystal` = `crystal` - '" . $Mining['crystal'] . "', ";
|
||||
$QryUpdateTarget .= "`deuterium` = `deuterium` - '" . $Mining['deuter'] . "' ";
|
||||
$QryUpdateTarget .= "WHERE ";
|
||||
$QryUpdateTarget .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
|
||||
$QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
|
||||
$QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND ";
|
||||
$QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' ";
|
||||
$QryUpdateTarget .= "LIMIT 1;";
|
||||
doquery($QryUpdateTarget , 'planets');
|
||||
// Mise a jour du champ de ruine devant la planete attaquée
|
||||
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
|
||||
$QryUpdateGalaxy .= "`metal` = `metal` + '" . $zlom['metal'] . "', ";
|
||||
$QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $zlom['crystal'] . "' ";
|
||||
$QryUpdateGalaxy .= "WHERE ";
|
||||
$QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND ";
|
||||
$QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND ";
|
||||
$QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' ";
|
||||
$QryUpdateGalaxy .= "LIMIT 1;";
|
||||
doquery($QryUpdateGalaxy , 'galaxy');
|
||||
// Là on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune !
|
||||
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
|
||||
$StrAttackerUnits = sprintf ($lang['sys_attacker_lostunits'], pretty_number ($zlom["atakujacy"]));
|
||||
$StrDefenderUnits = sprintf ($lang['sys_defender_lostunits'], pretty_number ($zlom["wrog"]));
|
||||
$StrRuins = sprintf ($lang['sys_gcdrunits'], pretty_number ($zlom["metal"]), $lang['Metal'], pretty_number ($zlom['crystal']), $lang['Crystal']);
|
||||
$DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins;
|
||||
$MoonChance = $FleetDebris / 100000;
|
||||
if ($FleetDebris > 2000000) {
|
||||
$MoonChance = 20;
|
||||
}
|
||||
if ($FleetDebris < 100000) {
|
||||
$UserChance = 0;
|
||||
$ChanceMoon = "";
|
||||
} elseif ($FleetDebris >= 100000) {
|
||||
$UserChance = mt_rand(1, 100);
|
||||
$ChanceMoon = sprintf ($lang['sys_moonproba'], $MoonChance);
|
||||
}
|
||||
|
||||
if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) {
|
||||
$user = Wootook_Player_Model_Entity::factory($TargetUserID);
|
||||
$user->createNewPlanet(
|
||||
intval($FleetRow['fleet_end_galaxy']),
|
||||
intval($FleetRow['fleet_end_system']),
|
||||
intval($FleetRow['fleet_end_planet']),
|
||||
Wootook_Empire_Model_Planet::TYPE_MOON,
|
||||
Wootook::__('Moon')
|
||||
);
|
||||
$GottenMoon = Wootook::_('A moon has been created!');
|
||||
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
|
||||
$GottenMoon = "";
|
||||
}
|
||||
|
||||
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
|
||||
$title = sprintf ($lang['sys_attack_title'], $AttackDate);
|
||||
$raport = "<center><table><tr><td>" . $title . "<br />";
|
||||
$zniszczony = false;
|
||||
$a_zestrzelona = 0;
|
||||
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
|
||||
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
|
||||
$AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10;
|
||||
$AttackerData = sprintf ($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
|
||||
$AttackerTech = sprintf ($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
|
||||
|
||||
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
|
||||
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
|
||||
$DefendTechon['C'] = $TargetTechno["shield_tech"] * 10;
|
||||
$DefenderData = sprintf ($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
|
||||
$DefenderTech = sprintf ($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
|
||||
|
||||
foreach ($dane_do_rw as $a => $b) {
|
||||
$raport .= "<table border=1 width=100%><tr><th><br /><center>" . $AttackerData . "<br />" . $AttackerTech . "<table border=1>";
|
||||
if ($b["atakujacy"]['count'] > 0) {
|
||||
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
|
||||
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
|
||||
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
|
||||
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
|
||||
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
|
||||
foreach ($b["atakujacy"] as $Ship => $Data) {
|
||||
if (is_numeric($Ship)) {
|
||||
if ($Data['count'] > 0) {
|
||||
$raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>";
|
||||
$raport2 .= "<th>" . pretty_number ($Data['count']) . "</th>";
|
||||
$raport3 .= "<th>" . pretty_number (round($Data["atak"] / $Data['count'])) . "</th>";
|
||||
$raport4 .= "<th>" . pretty_number (round($Data["tarcza"] / $Data['count'])) . "</th>";
|
||||
$raport5 .= "<th>" . pretty_number (round($Data["obrona"] / $Data['count'])) . "</th>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$raport1 .= "</tr>";
|
||||
$raport2 .= "</tr>";
|
||||
$raport3 .= "</tr>";
|
||||
$raport4 .= "</tr>";
|
||||
$raport5 .= "</tr>";
|
||||
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
|
||||
} else {
|
||||
if ($a == 2) {
|
||||
$a_zestrzelona = 1;
|
||||
}
|
||||
$zniszczony = true;
|
||||
$raport .= "<br />" . $lang['sys_destroyed'];
|
||||
}
|
||||
|
||||
$raport .= "</table></center></th></tr></table>";
|
||||
$raport .= "<table border=1 width=100%><tr><th><br /><center>" . $DefenderData . "<br />" . $DefenderTech . "<table border=1>";
|
||||
if ($b["wrog"]['count'] > 0) {
|
||||
$raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>";
|
||||
$raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>";
|
||||
$raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>";
|
||||
$raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>";
|
||||
$raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>";
|
||||
foreach ($b["wrog"] as $Ship => $Data) {
|
||||
if (is_numeric($Ship)) {
|
||||
if ($Data['count'] > 0) {
|
||||
$raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>";
|
||||
$raport2 .= "<th>" . pretty_number ($Data['count']) . "</th>";
|
||||
$raport3 .= "<th>" . pretty_number (round($Data["atak"] / $Data['count'])) . "</th>";
|
||||
$raport4 .= "<th>" . pretty_number (round($Data["tarcza"] / $Data['count'])) . "</th>";
|
||||
$raport5 .= "<th>" . pretty_number (round($Data["obrona"] / $Data['count'])) . "</th>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$raport1 .= "</tr>";
|
||||
$raport2 .= "</tr>";
|
||||
$raport3 .= "</tr>";
|
||||
$raport4 .= "</tr>";
|
||||
$raport5 .= "</tr>";
|
||||
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
|
||||
} else {
|
||||
$zniszczony = true;
|
||||
$raport .= "<br />" . $lang['sys_destroyed'];
|
||||
}
|
||||
$raport .= "</table></center></th></tr></table>";
|
||||
|
||||
if (($zniszczony == false) and !($a == 8)) {
|
||||
$AttackWaveStat = sprintf ($lang['sys_attack_attack_wave'], pretty_number (floor($b["atakujacy"]["atak"])), pretty_number (floor($b["wrog"]["tarcza"])));
|
||||
$DefendWavaStat = sprintf ($lang['sys_attack_defend_wave'], pretty_number (floor($b["wrog"]["atak"])), pretty_number (floor($b["atakujacy"]["tarcza"])));
|
||||
$raport .= "<br /><center>" . $AttackWaveStat . "<br />" . $DefendWavaStat . "</center>";
|
||||
}
|
||||
}
|
||||
switch ($FleetResult) {
|
||||
case "a":
|
||||
$Pillage = sprintf ($lang['sys_stealed_ressources'], pretty_number ($Mining['metal']), $lang['metal'], pretty_number ($Mining['crystal']), $lang['crystal'], pretty_number ($Mining['deuter']), $lang['Deuterium']);
|
||||
$raport .= $lang['sys_attacker_won'] . "<br />" . $Pillage . "<br />";
|
||||
$raport .= $DebrisField . "<br />";
|
||||
$raport .= $ChanceMoon . "<br />";
|
||||
$raport .= $GottenMoon . "<br />";
|
||||
break;
|
||||
case "r":
|
||||
$raport .= $lang['sys_both_won'] . "<br />";
|
||||
$raport .= $DebrisField . "<br />";
|
||||
$raport .= $ChanceMoon . "<br />";
|
||||
$raport .= $GottenMoon . "<br />";
|
||||
break;
|
||||
case "w":
|
||||
$raport .= $lang['sys_defender_won'] . "<br />";
|
||||
$raport .= $DebrisField . "<br />";
|
||||
$raport .= $ChanceMoon . "<br />";
|
||||
$raport .= $GottenMoon . "<br />";
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
$SimMessage = sprintf ($lang['sys_rapport_build_time'], $totaltime);
|
||||
$raport .= $SimMessage . "</table>";
|
||||
|
||||
$rid = md5($raport);
|
||||
$QryInsertRapport = "INSERT INTO {{table}} SET ";
|
||||
$QryInsertRapport .= "`time` = UNIX_TIMESTAMP(), ";
|
||||
$QryInsertRapport .= "`id_owner1` = '" . $FleetRow['fleet_owner'] . "', ";
|
||||
$QryInsertRapport .= "`id_owner2` = '" . $TargetUserID . "', ";
|
||||
$QryInsertRapport .= "`rid` = '" . $rid . "', ";
|
||||
$QryInsertRapport .= "`a_zestrzelona` = '" . $a_zestrzelona . "', ";
|
||||
$QryInsertRapport .= "`raport` = '" . addslashes ($raport) . "';";
|
||||
doquery($QryInsertRapport , 'rw');
|
||||
// Colorisation du résumé de rapport pour l'attaquant
|
||||
$raport = "<a href # OnClick=\"f( 'rw.php?raport=" . $rid . "', '');\" >";
|
||||
$raport .= "<center>";
|
||||
if ($FleetResult == "a") {
|
||||
$raport .= "<font color=\"green\">";
|
||||
} elseif ($FleetResult == "r") {
|
||||
$raport .= "<font color=\"orange\">";
|
||||
} elseif ($FleetResult == "w") {
|
||||
$raport .= "<font color=\"red\">";
|
||||
}
|
||||
$raport .= $lang['sys_mess_attack_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "] </font></a><br /><br />";
|
||||
$raport .= "<font color=\"red\">" . $lang['sys_perte_attaquant'] . ": " . pretty_number ($zlom["atakujacy"]) . "</font>";
|
||||
$raport .= "<font color=\"green\"> " . $lang['sys_perte_defenseur'] . ":" . pretty_number ($zlom["wrog"]) . "</font><br />" ;
|
||||
$raport .= $lang['sys_gain'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . pretty_number ($Mining['metal']) . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . pretty_number ($Mining['crystal']) . "</font> " . $lang['Deuterium'] . ":<font color=\"#f77542\">" . pretty_number ($Mining['deuter']) . "</font><br />";
|
||||
$raport .= $lang['sys_debris'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . pretty_number ($zlom['metal']) . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . pretty_number ($zlom['crystal']) . "</font><br /></center>";
|
||||
|
||||
$Mining['metal'] = $Mining['metal'] + $FleetRow["fleet_resource_metal"];
|
||||
$Mining['crystal'] = $Mining['crystal'] + $FleetRow["fleet_resource_crystal"];
|
||||
$Mining['deuter'] = $Mining['deuter'] + $FleetRow["fleet_resource_deuterium"];
|
||||
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_amount` = '" . $FleetAmount . "', ";
|
||||
$QryUpdateFleet .= "`fleet_array` = '" . $FleetArray . "', ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = '1', ";
|
||||
$QryUpdateFleet .= "`fleet_resource_metal` = '" . $Mining['metal'] . "', ";
|
||||
$QryUpdateFleet .= "`fleet_resource_crystal` = '" . $Mining['crystal'] . "', ";
|
||||
$QryUpdateFleet .= "`fleet_resource_deuterium` = '" . $Mining['deuter'] . "' ";
|
||||
$QryUpdateFleet .= "WHERE fleet_id = '" . $FleetRow['fleet_id'] . "' ";
|
||||
$QryUpdateFleet .= "LIMIT 1 ;";
|
||||
doquery($QryUpdateFleet , 'fleets');
|
||||
|
||||
SendSimpleMessage ($CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport);
|
||||
// Ajout du petit point raideur
|
||||
$AddPoint = $CurrentUser['xpraid'] + 1;
|
||||
|
||||
$QryUpdateOfficier = "UPDATE {{table}} SET ";
|
||||
$QryUpdateOfficier .= "`xpraid` = '" . $AddPoint . "' ";
|
||||
$QryUpdateOfficier .= "WHERE id = '" . $CurrentUserID . "' ";
|
||||
$QryUpdateOfficier .= "LIMIT 1 ;";
|
||||
doquery($QryUpdateOfficier, 'users');
|
||||
// Ajout d'un point au compteur de raids
|
||||
$RaidsTotal = $CurrentUser['raids'] + 1;
|
||||
if ($FleetResult == "a") {
|
||||
$RaidsWin = $CurrentUser['raidswin'] + 1;
|
||||
$QryUpdateRaidsCompteur = "UPDATE {{table}} SET ";
|
||||
$QryUpdateRaidsCompteur .= "`raidswin` ='" . $RaidsWin . "', ";
|
||||
$QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' ";
|
||||
$QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' ";
|
||||
$QryUpdateRaidsCompteur .= "LIMIT 1 ;";
|
||||
doquery($QryUpdateRaidsCompteur, 'users');
|
||||
} elseif ($FleetResult == "r" || $FleetResult == "w") {
|
||||
$RaidsLoose = $CurrentUser['raidsloose'] + 1;
|
||||
$QryUpdateRaidsCompteur = "UPDATE {{table}} SET ";
|
||||
$QryUpdateRaidsCompteur .= "`raidswin` ='" . $RaidsLoose . "', ";
|
||||
$QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' ";
|
||||
$QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' ";
|
||||
$QryUpdateRaidsCompteur .= "LIMIT 1 ;";
|
||||
doquery($QryUpdateRaidsCompteur, 'users');
|
||||
}
|
||||
// Colorisation du résumé de rapport pour l'attaquant
|
||||
$raport2 = "<a href # OnClick=\"f( 'rw.php?raport=" . $rid . "', '');\" >";
|
||||
$raport2 .= "<center>";
|
||||
if ($FleetResult == "a") {
|
||||
$raport2 .= "<font color=\"green\">";
|
||||
} elseif ($FleetResult == "r") {
|
||||
$raport2 .= "<font color=\"orange\">";
|
||||
} elseif ($FleetResult == "w") {
|
||||
$raport2 .= "<font color=\"red\">";
|
||||
}
|
||||
$raport2 .= $lang['sys_mess_attack_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "] </font></a><br /><br />";
|
||||
|
||||
SendSimpleMessage ($TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport2);
|
||||
}
|
||||
// Retour de flotte (s'il en reste)
|
||||
$fquery = "";
|
||||
if ($FleetRow['fleet_end_time'] <= time()) {
|
||||
if (!is_null($CurrentSet)) {
|
||||
foreach($CurrentSet as $Ship => $Count) {
|
||||
$fquery .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` + '" . $Count['count'] . "', ";
|
||||
}
|
||||
} else {
|
||||
$fleet = explode(";", $FleetRow['fleet_array']);
|
||||
foreach($fleet as $a => $b) {
|
||||
if ($b != '') {
|
||||
$a = explode(",", $b);
|
||||
$fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets');
|
||||
if (!($FleetResult == "w")) {
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= $fquery;
|
||||
$QryUpdatePlanet .= "`metal` = `metal` + " . $FleetRow['fleet_resource_metal'] . ", ";
|
||||
$QryUpdatePlanet .= "`crystal` = `crystal` + " . $FleetRow['fleet_resource_crystal'] . ", ";
|
||||
$QryUpdatePlanet .= "`deuterium` = `deuterium` + " . $FleetRow['fleet_resource_deuterium'] . " ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`galaxy` = " . $FleetRow['fleet_start_galaxy'] . " AND ";
|
||||
$QryUpdatePlanet .= "`system` = " . $FleetRow['fleet_start_system'] . " AND ";
|
||||
$QryUpdatePlanet .= "`planet` = " . $FleetRow['fleet_start_planet'] . " AND ";
|
||||
$QryUpdatePlanet .= "`planet_type` = " . $FleetRow['fleet_start_type'] . " LIMIT 1 ;";
|
||||
doquery($QryUpdatePlanet, 'planets');
|
||||
}
|
||||
}
|
||||
}
|
||||
115
src/includes/functions/MissionCaseColonisation.php
Normal file
115
src/includes/functions/MissionCaseColonisation.php
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseColonisation ( $FleetRow ) {
|
||||
global $lang, $resource;
|
||||
|
||||
$statement = doquery ("SELECT count(*) FROM {{table}} WHERE `id_owner` = '". $FleetRow['fleet_owner'] ."' AND `planet_type` = '1'", 'planets');
|
||||
$iPlanetCount = $statement->fetch(PDO::FETCH_ASSOC);
|
||||
if ($FleetRow['fleet_mess'] == 0) {
|
||||
// Déjà, sommes nous a l'aller ??
|
||||
$statement2 = doquery ("SELECT count(*) FROM {{table}} WHERE `galaxy` = '". $FleetRow['fleet_end_galaxy']."' AND `system` = '". $FleetRow['fleet_end_system']."' AND `planet` = '". $FleetRow['fleet_end_planet']."';", 'galaxy');
|
||||
$iGalaxyPlace = $statement2->fetch(PDO::FETCH_ASSOC);
|
||||
$TargetAdress = sprintf ($lang['sys_adress_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
|
||||
if ($iGalaxyPlace == 0) {
|
||||
// Y a personne qui s'y est mis avant que je ne debarque !
|
||||
if ($iPlanetCount >= MAX_PLAYER_PLANETS && $user['authlevel'] != LEVEL_ADMIN) {
|
||||
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_maxcolo'] . MAX_PLAYER_PLANETS . $lang['sys_colo_planet'];
|
||||
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
|
||||
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||
} else {
|
||||
$user = Wootook_Player_Model_Entity::factory($FleetRow['fleet_owner']);
|
||||
$user->createNewPlanet(
|
||||
intval($FleetRow['fleet_end_galaxy']),
|
||||
intval($FleetRow['fleet_end_system']),
|
||||
intval($FleetRow['fleet_end_planet']),
|
||||
Wootook_Empire_Model_Planet::TYPE_PLANET,
|
||||
Wootook::__('Colony')
|
||||
);
|
||||
|
||||
if ( $NewOwnerPlanet == true ) {
|
||||
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok'];
|
||||
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
|
||||
// Verifier ce que contient fleet_array (et le cas et cheant retirer un element '208'
|
||||
if ($FleetRow['fleet_amount'] == 1) {
|
||||
doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets');
|
||||
} else {
|
||||
$CurrentFleet = explode(";", $FleetRow['fleet_array']);
|
||||
$NewFleet = "";
|
||||
foreach ($CurrentFleet as $Item => $Group) {
|
||||
if ($Group != '') {
|
||||
$Class = explode (",", $Group);
|
||||
if ($Class[0] == 208) {
|
||||
if ($Class[1] > 1) {
|
||||
$NewFleet .= $Class[0].",".($Class[1] - 1).";";
|
||||
}
|
||||
} else {
|
||||
if ($Class[1] <> 0) {
|
||||
$NewFleet .= $Class[0].",".$Class[1].";";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_array` = '". $NewFleet ."', ";
|
||||
$QryUpdateFleet .= "`fleet_amount` = `fleet_amount` - 1, ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = '1' ";
|
||||
$QryUpdateFleet .= "WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';";
|
||||
doquery( $QryUpdateFleet, 'fleets');
|
||||
}
|
||||
} else {
|
||||
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_badpos'];
|
||||
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
|
||||
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Pas de bol coiffé sur le poteau !
|
||||
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_notfree'];
|
||||
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
|
||||
// Mettre a jour la flotte pour qu'effectivement elle revienne !
|
||||
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||
|
||||
}
|
||||
} else {
|
||||
if ($FleetRow['fleet_end_time'] <= time()) {
|
||||
// Retour de flotte
|
||||
RestoreFleetToPlanet ( $FleetRow, true );
|
||||
doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
521
src/includes/functions/MissionCaseDestruction.php
Normal file
521
src/includes/functions/MissionCaseDestruction.php
Normal file
|
|
@ -0,0 +1,521 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseDestruction($FleetRow)
|
||||
{
|
||||
global $user, $pricelist, $lang, $resource, $CombatCaps;
|
||||
|
||||
includeLang('system');
|
||||
|
||||
if ($FleetRow['fleet_start_time'] <= time()) {
|
||||
if ($FleetRow['fleet_mess'] == 0) {
|
||||
if (!isset($CombatCaps[202]['sd'])) {
|
||||
message("<font color=\"red\">". $lang['sys_no_vars'] ."</font>", $lang['sys_error'], "fleet." . PHPEXT, 2);
|
||||
return;
|
||||
}
|
||||
|
||||
$QryTargetPlanet = "SELECT * FROM {{table}} ";
|
||||
$QryTargetPlanet .= "WHERE ";
|
||||
$QryTargetPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryTargetPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryTargetPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
||||
$QryTargetPlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."';";
|
||||
$TargetPlanet = doquery( $QryTargetPlanet, 'planets', true);
|
||||
|
||||
$TargetUserID = $TargetPlanet['id_owner'];
|
||||
$QryDepPlanet = "SELECT * FROM {{table}} ";
|
||||
$QryDepPlanet .= "WHERE ";
|
||||
$QryDepPlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
|
||||
$QryDepPlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
|
||||
$QryDepPlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
|
||||
$QryDepPlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."';";
|
||||
$DepPlanet = doquery( $QryDepPlanet, 'planets', true);
|
||||
$DepName = $DepPlanet['name'];
|
||||
|
||||
$QryCurrentUser = "SELECT * FROM {{table}} ";
|
||||
$QryCurrentUser .= "WHERE ";
|
||||
$QryCurrentUser .= "`id` = '". $FleetRow['fleet_owner'] ."';";
|
||||
$CurrentUser = doquery($QryCurrentUser , 'users', true);
|
||||
$CurrentUserID = $CurrentUser['id'];
|
||||
|
||||
$QryTargetUser = "SELECT * FROM {{table}} ";
|
||||
$QryTargetUser .= "WHERE ";
|
||||
$QryTargetUser .= "`id` = '". $TargetUserID ."';";
|
||||
$TargetUser = doquery($QryTargetUser, 'users', true);
|
||||
|
||||
$QryTargetTech = "SELECT ";
|
||||
$QryTargetTech .= "`military_tech`, `defence_tech`, `shield_tech` ";
|
||||
$QryTargetTech .= "FROM {{table}} ";
|
||||
$QryTargetTech .= "WHERE ";
|
||||
$QryTargetTech .= "`id` = '". $TargetUserID ."';";
|
||||
|
||||
$TargetTechno = doquery($QryTargetTech, 'users', true);
|
||||
|
||||
$QryCurrentTech = "SELECT ";
|
||||
$QryCurrentTech .= "`military_tech`, `defence_tech`, `shield_tech` ";
|
||||
$QryCurrentTech .= "FROM {{table}} ";
|
||||
$QryCurrentTech .= "WHERE ";
|
||||
$QryCurrentTech .= "`id` = '". $CurrentUserID ."';";
|
||||
$CurrentTechno = doquery($QryCurrentTech, 'users', true);
|
||||
|
||||
for ($SetItem = 200; $SetItem < 500; $SetItem++) {
|
||||
if ($TargetPlanet[$resource[$SetItem]] > 0) {
|
||||
$TargetSet[$SetItem]['count'] = $TargetPlanet[$resource[$SetItem]];
|
||||
}
|
||||
}
|
||||
|
||||
$TheFleet = explode(";", $FleetRow['fleet_array']);
|
||||
foreach($TheFleet as $a => $b) {
|
||||
if ($b != '') {
|
||||
$a = explode(",", $b);
|
||||
$CurrentSet[$a[0]]['count'] = $a[1];
|
||||
}
|
||||
}
|
||||
|
||||
include_once($ugamela_root_path . 'includes/ataki.' . PHPEXT);
|
||||
|
||||
// Calcul de la duree de traitement (initialisation)
|
||||
$starttime = microtime(true);
|
||||
$walka = walka($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno);
|
||||
$totaltime = (microtime(true) - $starttime);
|
||||
|
||||
// Ce qu'il reste de l'attaquant
|
||||
$CurrentSet = $walka["atakujacy"];
|
||||
// Ce qu'il reste de l'attaqu<71>
|
||||
$TargetSet = $walka["wrog"];
|
||||
// Le resultat de la bataille
|
||||
$FleetResult = $walka["wygrana"];
|
||||
// Rapport long (rapport de bataille detaill<6C>)
|
||||
$dane_do_rw = $walka["dane_do_rw"];
|
||||
// Rapport court (cdr + unit<69>es perdues)
|
||||
$zlom = $walka["zlom"];
|
||||
|
||||
$FleetArray = "";
|
||||
$FleetAmount = 0;
|
||||
$FleetStorage = 0;
|
||||
|
||||
foreach ($CurrentSet as $Ship => $Count) {
|
||||
$FleetStorage += $pricelist[$Ship]["capacity"] * $Count['count'];
|
||||
$FleetArray .= $Ship.",".$Count['count'].";";
|
||||
$FleetAmount += $Count['count'];
|
||||
}
|
||||
|
||||
$TargetPlanetUpd = "";
|
||||
if (!is_null($TargetSet)) {
|
||||
foreach($TargetSet as $Ship => $Count) {
|
||||
$TargetPlanetUpd .= "`". $resource[$Ship] ."` = '". $Count['count'] ."', ";
|
||||
}
|
||||
}
|
||||
|
||||
if ($FleetResult == "a") {
|
||||
$ripCount = 0.;
|
||||
$supernovaCount = 0.;
|
||||
$gravitonLevel = 0.;
|
||||
if (isset($CurrentSet['214']) && isset($CurrentSet['214']['count'])) {
|
||||
$ripCount = floatval($CurrentSet['214']['count']);
|
||||
}
|
||||
if (isset($CurrentSet['216']) && isset($CurrentSet['216']['count'])) {
|
||||
$supernovaCount = floatval($CurrentSet['216']['count']);
|
||||
}
|
||||
if (isset($user[$resource[Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY]])) {
|
||||
$gravitonLevel = floatval($user[$resource[Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY]]);
|
||||
}
|
||||
$destructionPower = $ripCount + ($supernovaCount * 4);
|
||||
$gravitonPower = 1 + pow(1 - $gravitonLevel, 2);
|
||||
|
||||
$rawChances = pow(sqrt(1 / floatval($TargetPlanet['diameter'])) * $destructionPower * $gravitonPower, 2);
|
||||
$chances = (1 - (1 / ((2500 / floatval(Wootook::getGameConfig('game/speed/general'))) * pow(1 + $rawChances, 2)))) * .5;
|
||||
|
||||
$tirage = mt_rand(0, 100000000);
|
||||
$probalune = sprintf($lang['sys_destruc_lune'], (int) ($chances * 100));
|
||||
if ($tirage <= ($chance * 1000000)) {
|
||||
$resultat = '1';
|
||||
$finmess = $lang['sys_destruc_reussi'];
|
||||
|
||||
//destruction de la lune dabord dans la liste des planetes puis dans la liste des lunes et enfin dans la galaxie
|
||||
doquery("DELETE FROM {{table}} WHERE `id` = '". $TargetPlanet['id'] ."';", 'planets');
|
||||
$Qrydestructionlune = "UPDATE {{table}} SET ";
|
||||
$Qrydestructionlune .= "`destruyed` = '1' ";
|
||||
$Qrydestructionlune .= "WHERE ";
|
||||
$Qrydestructionlune .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$Qrydestructionlune .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$Qrydestructionlune .= "`lunapos` = '". $FleetRow['fleet_end_planet'] ."' ";
|
||||
$Qrydestructionlune .= "LIMIT 1 ;";
|
||||
doquery( $Qrydestructionlune , 'lunas');
|
||||
|
||||
$Qrydestructionlune2 = "UPDATE {{table}} SET ";
|
||||
$Qrydestructionlune2 .= "`id_luna` = '0' ";
|
||||
$Qrydestructionlune2 .= "WHERE ";
|
||||
$Qrydestructionlune2 .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$Qrydestructionlune2 .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$Qrydestructionlune2 .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' ";
|
||||
$Qrydestructionlune2 .= "LIMIT 1 ;";
|
||||
//$Qrydestructionlune2 .= ";";
|
||||
|
||||
doquery( $Qrydestructionlune2 , 'galaxy');
|
||||
//la lune est detruite, alors on redirige les flottes sur la planete
|
||||
$QryDetFleets1 = "UPDATE {{table}} SET ";
|
||||
$QryDetFleets1 .= "`fleet_start_type` = '1' ";
|
||||
$QryDetFleets1 .= "WHERE ";
|
||||
$QryDetFleets1 .= "`fleet_start_galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryDetFleets1 .= "`fleet_start_system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryDetFleets1 .= "`fleet_start_planet` = '". $FleetRow['fleet_end_planet'] ."' ";
|
||||
$QryDetFleets1 .= ";";
|
||||
doquery( $QryDetFleets1 , 'fleets');
|
||||
|
||||
$QryDetFleets2 = "UPDATE {{table}} SET ";
|
||||
$QryDetFleets2 .= "`fleet_end_type` = '1' ";
|
||||
$QryDetFleets2 .= "WHERE ";
|
||||
$QryDetFleets2 .= "`fleet_end_galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryDetFleets2 .= "`fleet_end_system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryDetFleets2 .= "`fleet_end_planet` = '". $FleetRow['fleet_end_planet'] ."' ";
|
||||
$QryDetFleets2 .= ";";
|
||||
doquery( $QryDetFleets2 , 'fleets');
|
||||
|
||||
//maintenant on va verifier si la vue du joueur n est pas calee sur la lune qui est detruite
|
||||
if ($TargetUser['current_planet'] == $TargetPlanet['id']){
|
||||
$QryPlanet = "SELECT * FROM {{table}} ";
|
||||
|
||||
$QryPlanet .= "WHERE ";
|
||||
$QryPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
||||
$QryPlanet .= "`planet_type` = '1';";
|
||||
$Planet = doquery( $QryPlanet, 'planets', true);
|
||||
$IDPlanet = $Planet['id'];
|
||||
|
||||
$Qryvue = "UPDATE {{table}} SET ";
|
||||
$Qryvue .= "`current_planet` = '". $IDPlanet ."' ";
|
||||
$Qryvue .= "WHERE ";
|
||||
$Qryvue .= "`id` = '". $TargetUserID ."' ";
|
||||
$Qryvue .= ";";
|
||||
|
||||
doquery( $Qryvue , 'users');
|
||||
}
|
||||
} else {
|
||||
$resultat = '0';
|
||||
}// la lune a resisté
|
||||
|
||||
// la lune a resiste, alors voyons les chances que les rip soient detruites
|
||||
$destructionrip = (1 - (1 / pow($TargetPlanet['diameter'], 1 / 4))) * .5;
|
||||
|
||||
//maintenant qu on sait quelle chance tentons la destruction, allez roule croupier
|
||||
$chance2 = round($destructionrip * 100); // En pourcentage
|
||||
if ($resultat == 0) {
|
||||
$tirage2 = mt_rand(0, 100);
|
||||
$probarip = sprintf($lang['sys_destruc_rip'], $chance2);
|
||||
|
||||
if ($tirage2 <= $chance2) {
|
||||
$resultat2 = ' detruite 1'; // RIP detruite
|
||||
$finmess = $lang['sys_destruc_echec'];
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
|
||||
}
|
||||
else {
|
||||
$resultat2 = 'sauvees 0'; // les RIP sont saines et sauves
|
||||
$finmess = $lang['sys_destruc_null'];
|
||||
}}
|
||||
//fin
|
||||
}
|
||||
|
||||
$introdestruc = sprintf ($lang['sys_destruc_mess'], $DepName , $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
|
||||
|
||||
// Mise a jour de l'enregistrement de la planete attaqu<71>e
|
||||
$QryUpdateTarget = "UPDATE {{table}} SET ";
|
||||
$QryUpdateTarget .= $TargetPlanetUpd;
|
||||
$QryUpdateTarget .= "`metal` = `metal` - '". $Mining['metal'] ."', ";
|
||||
$QryUpdateTarget .= "`crystal` = `crystal` - '". $Mining['crystal'] ."', ";
|
||||
$QryUpdateTarget .= "`deuterium` = `deuterium` - '". $Mining['deuter'] ."' ";
|
||||
$QryUpdateTarget .= "WHERE ";
|
||||
$QryUpdateTarget .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryUpdateTarget .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryUpdateTarget .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
||||
$QryUpdateTarget .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' ";
|
||||
$QryUpdateTarget .= "LIMIT 1;";
|
||||
doquery( $QryUpdateTarget , 'planets');
|
||||
|
||||
// Mise a jour du champ de ruine devant la planete attaqu<71>e
|
||||
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
|
||||
$QryUpdateGalaxy .= "`metal` = `metal` + '". $zlom['metal'] ."', ";
|
||||
$QryUpdateGalaxy .= "`crystal` = `crystal` + '". $zlom['crystal'] ."' ";
|
||||
$QryUpdateGalaxy .= "WHERE ";
|
||||
$QryUpdateGalaxy .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryUpdateGalaxy .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryUpdateGalaxy .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' ";
|
||||
$QryUpdateGalaxy .= "LIMIT 1;";
|
||||
doquery( $QryUpdateGalaxy , 'galaxy');
|
||||
|
||||
// L<> on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune !
|
||||
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
|
||||
$StrAttackerUnits = sprintf ($lang['sys_attacker_lostunits'], $zlom["atakujacy"]);
|
||||
$StrDefenderUnits = sprintf ($lang['sys_defender_lostunits'], $zlom["wrog"]);
|
||||
$StrRuins = sprintf ($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']);
|
||||
$DebrisField = $StrAttackerUnits ."<br />". $StrDefenderUnits ."<br />". $StrRuins;
|
||||
$MoonChance = $FleetDebris / 100000;
|
||||
if ($FleetDebris > 2000000) {
|
||||
$MoonChance = 20;
|
||||
}
|
||||
if ($FleetDebris < 100000) {
|
||||
$UserChance = 0;
|
||||
$ChanceMoon = "";
|
||||
} elseif ($FleetDebris >= 100000) {
|
||||
$UserChance = mt_rand(1, 100);
|
||||
$ChanceMoon = sprintf ($lang['sys_moonproba'], $MoonChance);
|
||||
}
|
||||
|
||||
if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) {
|
||||
$user = Wootook_Player_Model_Entity::factory($TargetUserID);
|
||||
$user->createNewPlanet(
|
||||
intval($FleetRow['fleet_end_galaxy']),
|
||||
intval($FleetRow['fleet_end_system']),
|
||||
intval($FleetRow['fleet_end_planet']),
|
||||
Wootook_Empire_Model_Planet::TYPE_MOON,
|
||||
Wootook::__('Moon')
|
||||
);
|
||||
$GottenMoon = Wootook::_('A moon has been created!');
|
||||
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
|
||||
$GottenMoon = "";
|
||||
}
|
||||
|
||||
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
|
||||
$title = sprintf ($lang['sys_destruc_title'], $AttackDate);
|
||||
$raport = "<center><table><tr><td>". $title ."<br />";
|
||||
$zniszczony = false;
|
||||
$a_zestrzelona = 0;
|
||||
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
|
||||
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
|
||||
$AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10;
|
||||
$AttackerData = sprintf ($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'] );
|
||||
$AttackerTech = sprintf ($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
|
||||
|
||||
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
|
||||
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
|
||||
$DefendTechon['C'] = $TargetTechno["shield_tech"] * 10;
|
||||
$DefenderData = sprintf ($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'] );
|
||||
$DefenderTech = sprintf ($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
|
||||
|
||||
foreach ($dane_do_rw as $a => $b) {
|
||||
$raport .= "<table border=1 width=100%><tr><th><br /><center>".$AttackerData."<br />".$AttackerTech."<table border=1>";
|
||||
if ($b["atakujacy"]['count'] > 0) {
|
||||
$raport1 = "<tr><th>".$lang['sys_ship_type']."</th>";
|
||||
$raport2 = "<tr><th>".$lang['sys_ship_count']."</th>";
|
||||
$raport3 = "<tr><th>".$lang['sys_ship_weapon']."</th>";
|
||||
$raport4 = "<tr><th>".$lang['sys_ship_shield']."</th>";
|
||||
$raport5 = "<tr><th>".$lang['sys_ship_armour']."</th>";
|
||||
foreach ($b["atakujacy"] as $Ship => $Data) {
|
||||
if (is_numeric($Ship)) {
|
||||
if ($Data['count'] > 0) {
|
||||
$raport1 .= "<th>". $lang["tech_rc"][$Ship] ."</th>";
|
||||
$raport2 .= "<th>". $Data['count'] ."</th>";
|
||||
$raport3 .= "<th>". round($Data["atak"] / $Data['count']) ."</th>";
|
||||
$raport4 .= "<th>". round($Data["tarcza"] / $Data['count']) ."</th>";
|
||||
$raport5 .= "<th>". round($Data["obrona"] / $Data['count']) ."</th>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$raport1 .= "</tr>";
|
||||
$raport2 .= "</tr>";
|
||||
$raport3 .= "</tr>";
|
||||
$raport4 .= "</tr>";
|
||||
$raport5 .= "</tr>";
|
||||
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
|
||||
} else {
|
||||
if ($a == 2) {
|
||||
$a_zestrzelona = 1;
|
||||
}
|
||||
$zniszczony = true;
|
||||
$raport .= "<br />". $lang['sys_destroyed'];
|
||||
}
|
||||
|
||||
$raport .= "</table></center></th></tr></table>";
|
||||
$raport .= "<table border=1 width=100%><tr><th><br /><center>".$DefenderData."<br />".$DefenderTech."<table border=1>";
|
||||
if ($b["wrog"]['count'] > 0) {
|
||||
$raport1 = "<tr><th>".$lang['sys_ship_type']."</th>";
|
||||
$raport2 = "<tr><th>".$lang['sys_ship_count']."</th>";
|
||||
$raport3 = "<tr><th>".$lang['sys_ship_weapon']."</th>";
|
||||
$raport4 = "<tr><th>".$lang['sys_ship_shield']."</th>";
|
||||
$raport5 = "<tr><th>".$lang['sys_ship_armour']."</th>";
|
||||
foreach ($b["wrog"] as $Ship => $Data) {
|
||||
if (is_numeric($Ship)) {
|
||||
if ($Data['count'] > 0) {
|
||||
$raport1 .= "<th>". $lang["tech_rc"][$Ship] ."</th>";
|
||||
$raport2 .= "<th>". $Data['count'] ."</th>";
|
||||
$raport3 .= "<th>". round($Data["atak"] / $Data['count']) ."</th>";
|
||||
$raport4 .= "<th>". round($Data["tarcza"] / $Data['count']) ."</th>";
|
||||
$raport5 .= "<th>". round($Data["obrona"] / $Data['count']) ."</th>";
|
||||
}
|
||||
}
|
||||
}
|
||||
$raport1 .= "</tr>";
|
||||
$raport2 .= "</tr>";
|
||||
$raport3 .= "</tr>";
|
||||
$raport4 .= "</tr>";
|
||||
$raport5 .= "</tr>";
|
||||
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
|
||||
} else {
|
||||
$zniszczony = true;
|
||||
$raport .= "<br />". $lang['sys_destroyed'];
|
||||
}
|
||||
$raport .= "</table></center></th></tr></table>";
|
||||
|
||||
if (($zniszczony == false) and !($a == 8)) {
|
||||
$AttackWaveStat = sprintf ($lang['sys_attack_attack_wave'], floor($b["atakujacy"]["atak"]), floor($b["wrog"]["tarcza"]));
|
||||
$DefendWavaStat = sprintf ($lang['sys_attack_defend_wave'], floor($b["wrog"]["atak"]), floor($b["atakujacy"]["tarcza"]));
|
||||
$raport .= "<br /><center>".$AttackWaveStat."<br />".$DefendWavaStat."</center>";
|
||||
}
|
||||
}
|
||||
|
||||
switch ($FleetResult) {
|
||||
case "a":
|
||||
$raport .= $lang['sys_attacker_won'] ."<br />";
|
||||
$raport .= $DebrisField ."<br />";
|
||||
$raport .= $introdestruc ."<br />";
|
||||
$raport .= $lang['sys_destruc_mess1'];
|
||||
$raport .= $finmess ."<br />";
|
||||
$raport .= $probalune ."<br />";
|
||||
$raport .= $probarip ."<br />";
|
||||
break;
|
||||
|
||||
case "r":
|
||||
$raport .= $lang['sys_both_won'] ."<br />";
|
||||
$raport .= $DebrisField ."<br />";
|
||||
$raport .= $introdestruc ."<br />";
|
||||
$raport .= $lang['sys_destruc_stop'] ."<br />";
|
||||
break;
|
||||
|
||||
case "w":
|
||||
$raport .= $lang['sys_defender_won'] ."<br />";
|
||||
$raport .= $DebrisField ."<br />";
|
||||
$raport .= $introdestruc ."<br />";
|
||||
$raport .= $lang['sys_destruc_stop'] ."<br />";
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$SimMessage = sprintf($lang['sys_rapport_build_time'], $totaltime);
|
||||
$raport .= $SimMessage ."</table>";
|
||||
|
||||
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
|
||||
$rid = md5($raport);
|
||||
$QryInsertRapport = "INSERT INTO {{table}} SET ";
|
||||
$QryInsertRapport .= "`time` = UNIX_TIMESTAMP(), ";
|
||||
$QryInsertRapport .= "`id_owner1` = '". $FleetRow['fleet_owner'] ."', ";
|
||||
$QryInsertRapport .= "`id_owner2` = '". $TargetUserID ."', ";
|
||||
$QryInsertRapport .= "`rid` = '". $rid ."', ";
|
||||
$QryInsertRapport .= "`a_zestrzelona` = '". $a_zestrzelona ."', ";
|
||||
$QryInsertRapport .= "`raport` = '". addslashes ( $raport ) ."';";
|
||||
doquery( $QryInsertRapport , 'rw');
|
||||
|
||||
|
||||
|
||||
// Colorisation du r<>sum<75> de rapport pour l'attaquant
|
||||
$raport = "<a href # OnClick=\"f( 'rw.php?raport=". $rid ."', '');\" >";
|
||||
$raport .= "<center>";
|
||||
|
||||
if ($FleetResult == "a") {
|
||||
$raport .= "<font color=\"green\">";
|
||||
} elseif ($FleetResult == "r") {
|
||||
$raport .= "<font color=\"orange\">";
|
||||
} elseif ($FleetResult == "w") {
|
||||
$raport .= "<font color=\"red\">";
|
||||
}
|
||||
|
||||
$raport .= $lang['sys_mess_destruc_report'] ." [". $FleetRow['fleet_end_galaxy'] .":". $FleetRow['fleet_end_system'] .":". $FleetRow['fleet_end_planet'] ."] </font></a><br /><br />";
|
||||
$raport .= "<font color=\"red\">". $lang['sys_perte_attaquant'] .": ". $zlom["atakujacy"] ."</font>";
|
||||
$raport .= "<font color=\"green\"> ". $lang['sys_perte_defenseur'] .":". $zlom["wrog"] ."</font><br />" ;
|
||||
$raport .= $lang['sys_debris'] ." ". $lang['Metal'] .":<font color=\"#adaead\">". $zlom['metal'] ."</font> ". $lang['Crystal'] .":<font color=\"#ef51ef\">". $zlom['crystal'] ."</font><br /></center>";
|
||||
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_amount` = '". $FleetAmount ."', ";
|
||||
$QryUpdateFleet .= "`fleet_array` = '". $FleetArray ."', ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = '1' ";
|
||||
$QryUpdateFleet .= "WHERE fleet_id = '". $FleetRow['fleet_id'] ."' ";
|
||||
$QryUpdateFleet .= "LIMIT 1 ;";
|
||||
|
||||
doquery( $QryUpdateFleet , 'fleets');
|
||||
SendSimpleMessage ( $CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_destruc_report'], $raport );
|
||||
// Colorisation du r<>sum<75> de rapport pour le defenseur
|
||||
$raport2 = "<a href # OnClick=\"f( 'rw.php?raport=". $rid ."', '');\" >";
|
||||
$raport2 .= "<center>";
|
||||
|
||||
if ($FleetResult == "a") {
|
||||
$raport2 .= "<font color=\"red\">";
|
||||
} elseif ($FleetResult == "r") {
|
||||
$raport2 .= "<font color=\"orange\">";
|
||||
} elseif ($FleetResult == "w") {
|
||||
$raport2 .= "<font color=\"green\">";
|
||||
}
|
||||
|
||||
$raport2 .= $lang['sys_mess_destruc_report'] ." [". $FleetRow['fleet_end_galaxy'] .":". $FleetRow['fleet_end_system'] .":". $FleetRow['fleet_end_planet'] ."] </font></a><br /><br />";
|
||||
SendSimpleMessage ( $TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_destruc_report'], $raport2 );
|
||||
}
|
||||
|
||||
// Retour de flotte (s'il en reste)
|
||||
$fquery = "";
|
||||
if ($FleetRow['fleet_end_time'] <= time()) {
|
||||
if (!is_null($CurrentSet)) {
|
||||
foreach($CurrentSet as $Ship => $Count) {
|
||||
$fquery .= "`". $resource[$Ship] ."` = `". $resource[$Ship] ."` + '". $Count['count'] ."', ";
|
||||
}
|
||||
} else {
|
||||
$fleet = explode(";", $FleetRow['fleet_array']);
|
||||
foreach($fleet as $a => $b) {
|
||||
if ($b != '') {
|
||||
$a = explode(",", $b);
|
||||
$fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets');
|
||||
|
||||
if (!($FleetResult == "w")) {
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= $fquery;
|
||||
$QryUpdatePlanet .= "`metal` = `metal` + ". $FleetRow['fleet_resource_metal'] .", ";
|
||||
$QryUpdatePlanet .= "`crystal` = `crystal` + ". $FleetRow['fleet_resource_crystal'] .", ";
|
||||
$QryUpdatePlanet .= "`deuterium` = `deuterium` + ". $FleetRow['fleet_resource_deuterium'] ." ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`galaxy` = ".$FleetRow['fleet_start_galaxy']." AND ";
|
||||
$QryUpdatePlanet .= "`system` = ".$FleetRow['fleet_start_system']." AND ";
|
||||
$QryUpdatePlanet .= "`planet` = ".$FleetRow['fleet_start_planet']." AND ";
|
||||
$QryUpdatePlanet .= "`planet_type` = ".$FleetRow['fleet_start_type']." LIMIT 1 ;";
|
||||
|
||||
doquery( $QryUpdatePlanet, 'planets' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
239
src/includes/functions/MissionCaseExpedition.php
Normal file
239
src/includes/functions/MissionCaseExpedition.php
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseExpedition ( $FleetRow ) {
|
||||
global $lang, $resource, $pricelist;
|
||||
|
||||
$FleetOwner = $FleetRow['fleet_owner'];
|
||||
$MessSender = $lang['sys_mess_qg'];
|
||||
$MessTitle = $lang['sys_expe_report'];
|
||||
|
||||
if ($FleetRow['fleet_mess'] == 0) {
|
||||
// Flotte en vol aller
|
||||
if ($FleetRow['fleet_end_stay'] < time()) {
|
||||
// La Flotte vient de finir son exploration
|
||||
// Table de ratio de points par type de vaisseau
|
||||
$PointsFlotte = array(
|
||||
202 => 1.0, // 'Petit transporteur'
|
||||
203 => 1.5, // 'Grand transporteur'
|
||||
204 => 0.5, // 'Chasseur léger'
|
||||
205 => 1.5, // 'Chasseur lourd'
|
||||
206 => 2.0, // 'Croiseur'
|
||||
207 => 2.5, // 'Vaisseau de bataille'
|
||||
208 => 0.5, // 'Vaisseau de colonisation'
|
||||
209 => 1.0, // 'Recycleur'
|
||||
210 => 0.01, // 'Sonde espionnage'
|
||||
211 => 3.0, // 'Bombardier'
|
||||
212 => 0.0, // 'Satellite solaire'
|
||||
213 => 3.5, // 'Destructeur'
|
||||
214 => 5.0, // 'Etoile de la mort'
|
||||
215 => 3.2, // 'Traqueur'
|
||||
);
|
||||
|
||||
// Table de ratio de gains en nombre par type de vaisseau
|
||||
$RatioGain = array (
|
||||
202 => 0.1, // 'Petit transporteur'
|
||||
203 => 0.1, // 'Grand transporteur'
|
||||
204 => 0.1, // 'Chasseur léger'
|
||||
205 => 0.5, // 'Chasseur lourd'
|
||||
206 => 0.25, // 'Croiseur'
|
||||
207 => 0.125, // 'Vaisseau de bataille'
|
||||
208 => 0.5, // 'Vaisseau de colonisation'
|
||||
209 => 0.1, // 'Recycleur'
|
||||
210 => 0.1, // 'Sonde espionnage'
|
||||
211 => 0.0625, // 'Bombardier'
|
||||
212 => 0.0, // 'Satellite solaire'
|
||||
213 => 0.0625, // 'Destructeur'
|
||||
214 => 0.03125, // 'Etoile de la mort'
|
||||
215 => 0.0625, // 'Traqueur'
|
||||
);
|
||||
|
||||
$FleetStayDuration = ($FleetRow['fleet_end_stay'] - $FleetRow['fleet_start_time']) / 3600;
|
||||
|
||||
// Initialisation du contenu de la Flotte
|
||||
$farray = explode(";", $FleetRow['fleet_array']);
|
||||
foreach ($farray as $Item => $Group) {
|
||||
if ($Group != '') {
|
||||
$Class = explode (",", $Group);
|
||||
$TypeVaisseau = $Class[0];
|
||||
$NbreVaisseau = $Class[1];
|
||||
|
||||
$LaFlotte[$TypeVaisseau] = $NbreVaisseau;
|
||||
|
||||
//On calcul les ressources maximum qui peuvent être récupéré
|
||||
$FleetCapacity += $pricelist[$TypeVaisseau]['capacity'];
|
||||
// Maintenant on calcul en points toute la flotte
|
||||
$FleetPoints += ($NbreVaisseau * $PointsFlotte[$TypeVaisseau]);
|
||||
}
|
||||
}
|
||||
|
||||
// Espace deja occupé dans les soutes si ce devait etre le cas
|
||||
$FleetUsedCapacity = $FleetRow['fleet_resource_metal'] + $FleetRow['fleet_resource_crystal'] + $FleetRow['fleet_resource_deuterium'];
|
||||
$FleetCapacity -= $FleetUsedCapacity;
|
||||
|
||||
//On récupère le nombre total de vaisseaux
|
||||
$FleetCount = $FleetRow['fleet_amount'];
|
||||
|
||||
// Bon on les mange comment ces explorateurs ???
|
||||
$Hasard = rand(0, 10);
|
||||
|
||||
$MessSender = $lang['sys_mess_qg']. "(".$Hasard.")";
|
||||
|
||||
if ($Hasard < 3) {
|
||||
// Pas de bol, on les mange tout crus
|
||||
$Hasard += 1;
|
||||
$LostAmount = (($Hasard * 33) + 1) / 100;
|
||||
|
||||
// Message pour annoncer la bonne mauvaise nouvelle
|
||||
if ($LostAmount == 100) {
|
||||
// Supprimer effectivement la flotte
|
||||
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $lang['sys_expe_blackholl_2'] );
|
||||
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||
} else {
|
||||
foreach ($LaFlotte as $Ship => $Count) {
|
||||
$LostShips[$Ship] = intval($Count * $LostAmount);
|
||||
$NewFleetArray .= $Ship.",". ($Count - $LostShips[$Ship]) .";";
|
||||
}
|
||||
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_array` = '". $NewFleetArray ."', ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = '1' ";
|
||||
$QryUpdateFleet .= "WHERE ";
|
||||
$QryUpdateFleet .= "`fleet_id` = '". $FleetRow["fleet_id"] ."';";
|
||||
doquery( $QryUpdateFleet, 'fleets');
|
||||
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $lang['sys_expe_blackholl_1'] );
|
||||
}
|
||||
|
||||
} elseif ($Hasard == 3) {
|
||||
// Ah un tour pour rien
|
||||
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $lang['sys_expe_nothing_1'] );
|
||||
} elseif ($Hasard >= 4 && $Hasard < 7) {
|
||||
// Gains de ressources
|
||||
if ($FleetCapacity > 5000) {
|
||||
$MinCapacity = $FleetCapacity - 5000;
|
||||
$MaxCapacity = $FleetCapacity;
|
||||
$FoundGoods = rand($MinCapacity, $MaxCapacity);
|
||||
$FoundMetal = intval($FoundGoods / 2);
|
||||
$FoundCrist = intval($FoundGoods / 4);
|
||||
$FoundDeute = intval($FoundGoods / 6);
|
||||
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_resource_metal` = `fleet_resource_metal` + '". $FoundMetal ."', ";
|
||||
$QryUpdateFleet .= "`fleet_resource_crystal` = `fleet_resource_crystal` + '". $FoundCrist ."', ";
|
||||
$QryUpdateFleet .= "`fleet_resource_deuterium` = `fleet_resource_deuterium` + '". $FoundDeute ."', ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = '1' ";
|
||||
$QryUpdateFleet .= "WHERE ";
|
||||
$QryUpdateFleet .= "`fleet_id` = '". $FleetRow["fleet_id"] ."';";
|
||||
doquery( $QryUpdateFleet, 'fleets');
|
||||
$Message = sprintf($lang['sys_expe_found_goods'],
|
||||
pretty_number($FoundMetal), $lang['Metal'],
|
||||
pretty_number($FoundCrist), $lang['Crystal'],
|
||||
pretty_number($FoundDeute), $lang['Deuterium']);
|
||||
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $Message );
|
||||
}
|
||||
} elseif ($Hasard == 7) {
|
||||
// Ah un tour pour rien
|
||||
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $lang['sys_expe_nothing_2'] );
|
||||
} elseif ($Hasard >= 8 && $Hasard < 11) {
|
||||
// Gain de vaisseaux
|
||||
$FoundChance = $FleetPoints / $FleetCount;
|
||||
for ($Ship = 202; $Ship < 216; $Ship++) {
|
||||
if ($LaFlotte[$Ship] != 0) {
|
||||
$FoundShip[$Ship] = round($LaFlotte[$Ship] * $RatioGain[$Ship]);
|
||||
if ($FoundShip[$Ship] > 0) {
|
||||
$LaFlotte[$Ship] += $FoundShip[$Ship];
|
||||
}
|
||||
}
|
||||
}
|
||||
$NewFleetArray = "";
|
||||
$FoundShipMess = "";
|
||||
foreach ($LaFlotte as $Ship => $Count) {
|
||||
if ($Count > 0) {
|
||||
$NewFleetArray .= $Ship.",". $Count .";";
|
||||
}
|
||||
}
|
||||
foreach ($FoundShip as $Ship => $Count) {
|
||||
if ($Count != 0) {
|
||||
$FoundShipMess .= $Count." ".$lang['tech'][$Ship].",";
|
||||
}
|
||||
}
|
||||
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_array` = '". $NewFleetArray ."', ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = '1' ";
|
||||
$QryUpdateFleet .= "WHERE ";
|
||||
$QryUpdateFleet .= "`fleet_id` = '". $FleetRow["fleet_id"] ."';";
|
||||
doquery( $QryUpdateFleet, 'fleets');
|
||||
$Message = $lang['sys_expe_found_ships']. $FoundShipMess . "";
|
||||
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_stay'], 15, $MessSender, $MessTitle, $Message );
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// La Flotte est de retour a quai
|
||||
if ($FleetRow['fleet_end_time'] < time()) {
|
||||
// Reintegration de ce qui se ballade avec la flotte
|
||||
$farray = explode(";", $FleetRow['fleet_array']);
|
||||
foreach ($farray as $Item => $Group) {
|
||||
if ($Group != '') {
|
||||
$Class = explode (",", $Group);
|
||||
$FleetAutoQuery .= "`". $resource[$Class[0]]. "` = `". $resource[$Class[0]] ."` + ". $Class[1] .", ";
|
||||
}
|
||||
}
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= $FleetAutoQuery;
|
||||
$QryUpdatePlanet .= "`metal` = `metal` + ". $FleetRow['fleet_resource_metal'] .", ";
|
||||
$QryUpdatePlanet .= "`crystal` = `crystal` + ". $FleetRow['fleet_resource_crystal'] .", ";
|
||||
$QryUpdatePlanet .= "`deuterium` = `deuterium` + ". $FleetRow['fleet_resource_deuterium'] ." ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."' ";
|
||||
$QryUpdatePlanet .= "LIMIT 1 ;";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
// Message pour annoncer le retour de flotte
|
||||
SendSimpleMessage ( $FleetOwner, '', $FleetRow['fleet_end_time'], 15, $MessSender, $MessTitle, $lang['sys_expe_back_home'] );
|
||||
|
||||
// Suppression de la flotte
|
||||
doquery ("DELETE FROM {{table}} WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
141
src/includes/functions/MissionCaseRecycling.php
Normal file
141
src/includes/functions/MissionCaseRecycling.php
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseRecycling ($FleetRow) {
|
||||
global $pricelist, $lang;
|
||||
|
||||
if ($FleetRow["fleet_mess"] == "0") {
|
||||
if ($FleetRow['fleet_start_time'] <= time()) {
|
||||
$QrySelectGalaxy = "SELECT * FROM {{table}} ";
|
||||
$QrySelectGalaxy .= "WHERE ";
|
||||
$QrySelectGalaxy .= "`galaxy` = '".$FleetRow['fleet_end_galaxy']."' AND ";
|
||||
$QrySelectGalaxy .= "`system` = '".$FleetRow['fleet_end_system']."' AND ";
|
||||
$QrySelectGalaxy .= "`planet` = '".$FleetRow['fleet_end_planet']."' ";
|
||||
$QrySelectGalaxy .= "LIMIT 1;";
|
||||
$TargetGalaxy = doquery( $QrySelectGalaxy, 'galaxy', true);
|
||||
|
||||
$FleetRecord = explode(";", $FleetRow['fleet_array']);
|
||||
$RecyclerCapacity = 0;
|
||||
$OtherFleetCapacity = 0;
|
||||
foreach ($FleetRecord as $Item => $Group) {
|
||||
if ($Group != '') {
|
||||
$Class = explode (",", $Group);
|
||||
if ($Class[0] == 209) {
|
||||
$RecyclerCapacity += $pricelist[$Class[0]]["capacity"] * $Class[1];
|
||||
} else {
|
||||
$OtherFleetCapacity += $pricelist[$Class[0]]["capacity"] * $Class[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$IncomingFleetGoods = $FleetRow["fleet_resource_metal"] + $FleetRow["fleet_resource_crystal"] + $FleetRow["fleet_resource_deuterium"];
|
||||
if ($IncomingFleetGoods > $OtherFleetCapacity) {
|
||||
$RecyclerCapacity -= ($IncomingFleetGoods - $OtherFleetCapacity);
|
||||
}
|
||||
|
||||
if (($TargetGalaxy["metal"] + $TargetGalaxy["crystal"]) <= $RecyclerCapacity) {
|
||||
$RecycledGoods["metal"] = $TargetGalaxy["metal"];
|
||||
$RecycledGoods["crystal"] = $TargetGalaxy["crystal"];
|
||||
} else {
|
||||
if (($TargetGalaxy["metal"] > $RecyclerCapacity / 2) AND
|
||||
($TargetGalaxy["crystal"] > $RecyclerCapacity / 2)) {
|
||||
$RecycledGoods["metal"] = $RecyclerCapacity / 2;
|
||||
$RecycledGoods["crystal"] = $RecyclerCapacity / 2;
|
||||
} else {
|
||||
if ($TargetGalaxy["metal"] > $TargetGalaxy["crystal"]) {
|
||||
$RecycledGoods["crystal"] = $TargetGalaxy["crystal"];
|
||||
if ($TargetGalaxy["metal"] > ($RecyclerCapacity - $RecycledGoods["crystal"])) {
|
||||
$RecycledGoods["metal"] = $RecyclerCapacity - $RecycledGoods["crystal"];
|
||||
} else {
|
||||
$RecycledGoods["metal"] = $TargetGalaxy["metal"];
|
||||
}
|
||||
} else {
|
||||
$RecycledGoods["metal"] = $TargetGalaxy["metal"];
|
||||
if ($TargetGalaxy["crystal"] > ($RecyclerCapacity - $RecycledGoods["metal"])) {
|
||||
$RecycledGoods["crystal"] = $RecyclerCapacity - $RecycledGoods["metal"];
|
||||
} else {
|
||||
$RecycledGoods["crystal"] = $TargetGalaxy["crystal"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$NewCargo['Metal'] = $FleetRow["fleet_resource_metal"] + $RecycledGoods["metal"];
|
||||
$NewCargo['Crystal'] = $FleetRow["fleet_resource_crystal"] + $RecycledGoods["crystal"];
|
||||
$NewCargo['Deuterium'] = $FleetRow["fleet_resource_deuterium"];
|
||||
|
||||
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
|
||||
$QryUpdateGalaxy .= "`metal` = `metal` - '".$RecycledGoods["metal"]."', ";
|
||||
$QryUpdateGalaxy .= "`crystal` = `crystal` - '".$RecycledGoods["crystal"]."' ";
|
||||
$QryUpdateGalaxy .= "WHERE ";
|
||||
$QryUpdateGalaxy .= "`galaxy` = '".$FleetRow['fleet_end_galaxy']."' AND ";
|
||||
$QryUpdateGalaxy .= "`system` = '".$FleetRow['fleet_end_system']."' AND ";
|
||||
$QryUpdateGalaxy .= "`planet` = '".$FleetRow['fleet_end_planet']."' ";
|
||||
$QryUpdateGalaxy .= "LIMIT 1;";
|
||||
doquery( $QryUpdateGalaxy, 'galaxy');
|
||||
|
||||
$Message = sprintf($lang['sys_recy_gotten'], pretty_number($RecycledGoods["metal"]), $lang['Metal'], pretty_number($RecycledGoods["crystal"]), $lang['Crystal']);
|
||||
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 4, $lang['sys_mess_spy_control'], $lang['sys_recy_report'], $Message);
|
||||
doquery("UPDATE {{table}} SET `mnl_exploit` = `mnl_exploit` + '1' WHERE `id` = '".$FleetRow['fleet_owner']."'", 'users');
|
||||
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_resource_metal` = '".$NewCargo['Metal']."', ";
|
||||
$QryUpdateFleet .= "`fleet_resource_crystal` = '".$NewCargo['Crystal']."', ";
|
||||
$QryUpdateFleet .= "`fleet_resource_deuterium` = '".$NewCargo['Deuterium']."', ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = '1' ";
|
||||
$QryUpdateFleet .= "WHERE ";
|
||||
$QryUpdateFleet .= "`fleet_id` = '".$FleetRow['fleet_id']."' ";
|
||||
$QryUpdateFleet .= "LIMIT 1;";
|
||||
doquery( $QryUpdateFleet, 'fleets');
|
||||
}
|
||||
} else {
|
||||
if ($FleetRow['fleet_end_time'] <= time()) {
|
||||
// Mettre le message de retour de flotte
|
||||
$Message = sprintf( $lang['sys_tran_mess_owner'],
|
||||
$TargetName, GetTargetAdressLink($FleetRow, ''),
|
||||
pretty_number($FleetRow['fleet_resource_metal']), $lang['Metal'],
|
||||
pretty_number($FleetRow['fleet_resource_crystal']), $lang['Crystal'],
|
||||
pretty_number($FleetRow['fleet_resource_deuterium']), $lang['Deuterium'] );
|
||||
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 4, $lang['sys_mess_spy_control'], $lang['sys_mess_fleetback'], $Message);
|
||||
|
||||
RestoreFleetToPlanet ( $FleetRow, true );
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
// History version
|
||||
// 1.0 Mise en module initiale
|
||||
|
||||
?>
|
||||
204
src/includes/functions/MissionCaseSpy.php
Normal file
204
src/includes/functions/MissionCaseSpy.php
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseSpy($FleetRow)
|
||||
{
|
||||
global $lang;
|
||||
|
||||
$resource = Wootook_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
if ($FleetRow['fleet_start_time'] <= time()) {
|
||||
// refactored parts
|
||||
// {{{
|
||||
$planetCollection = new Legacies_Core_Collection(array('planet' => 'planets'), 'Legacies_Empire_Model_Planet');
|
||||
$planetCollection
|
||||
->where('galaxy=:galaxy')
|
||||
->where('system=:system')
|
||||
->where('planet=:planet')
|
||||
->where('type=:type')
|
||||
->limit(1)
|
||||
->load(array(
|
||||
'galaxy' => $FleetRow['fleet_end_galaxy'],
|
||||
'system' => $FleetRow['fleet_end_system'],
|
||||
'planet' => $FleetRow['fleet_end_planet'],
|
||||
'planet_type' => $FleetRow['fleet_end_type']
|
||||
))
|
||||
;
|
||||
$TargetPlanet = $planetCollection->current();
|
||||
|
||||
/*
|
||||
* Update planet resources and constructions
|
||||
*/
|
||||
Wootook::dispatchEvent('planet.update', array(
|
||||
'planet' => $TargetPlanet
|
||||
));
|
||||
$TargetPlanet->save();
|
||||
|
||||
$TargetUser = $targetPlanet->getUser();
|
||||
$CurrentUser = Legacies_Empire_Model_User::factory($FleetRow['fleet_owner']);
|
||||
|
||||
$TargetUserID = $TargetUser->getId();
|
||||
$CurrentUserID = $CurrentUser->getId();
|
||||
|
||||
$TargetTechno = array(
|
||||
'military_tech' => $TargetUser->getData('military_tech'),
|
||||
'defence_tech' => $TargetUser->getData('defence_tech'),
|
||||
'shield_tech' => $TargetUser->getData('shield_tech')
|
||||
);
|
||||
|
||||
$CurrentTechno = array(
|
||||
'military_tech' => $CurrentUser->getData('military_tech'),
|
||||
'defence_tech' => $CurrentUser->getData('defence_tech'),
|
||||
'shield_tech' => $CurrentUser->getData('shield_tech')
|
||||
);
|
||||
// }}}
|
||||
|
||||
$fleet = explode(";", $FleetRow['fleet_array']);
|
||||
$fquery = "";
|
||||
foreach ($fleet as $a => $b) {
|
||||
if ($b != '') {
|
||||
$a = explode(",", $b);
|
||||
$fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n";
|
||||
if ($FleetRow["fleet_mess"] != "1") {
|
||||
if ($a[0] == "210") {
|
||||
$LS = $a[1];
|
||||
$QryTargetGalaxy = "SELECT * FROM {{table}} WHERE ";
|
||||
$QryTargetGalaxy .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryTargetGalaxy .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryTargetGalaxy .= "`planet` = '". $FleetRow['fleet_end_planet'] ."';";
|
||||
$TargetGalaxy = doquery( $QryTargetGalaxy, 'galaxy', true);
|
||||
$CristalDebris = $TargetGalaxy['crystal'];
|
||||
$SpyToolDebris = $LS * 300;
|
||||
|
||||
$MaterialsInfo = SpyTarget ( $TargetPlanet, 0, $lang['sys_spy_maretials'] );
|
||||
$Materials = $MaterialsInfo['String'];
|
||||
|
||||
$PlanetFleetInfo = SpyTarget ( $TargetPlanet, 1, $lang['sys_spy_fleet'] );
|
||||
$PlanetFleet = $Materials;
|
||||
$PlanetFleet .= $PlanetFleetInfo['String'];
|
||||
|
||||
$PlanetDefenInfo = SpyTarget ( $TargetPlanet, 2, $lang['sys_spy_defenses'] );
|
||||
$PlanetDefense = $PlanetFleet;
|
||||
$PlanetDefense .= $PlanetDefenInfo['String'];
|
||||
|
||||
$PlanetBuildInfo = SpyTarget ( $TargetPlanet, 3, $lang['tech'][0] );
|
||||
$PlanetBuildings = $PlanetDefense;
|
||||
$PlanetBuildings .= $PlanetBuildInfo['String'];
|
||||
|
||||
$TargetTechnInfo = SpyTarget ( $TargetUser, 4, $lang['tech'][100] );
|
||||
$TargetTechnos = $PlanetBuildings;
|
||||
$TargetTechnos .= $TargetTechnInfo['String'];
|
||||
|
||||
$TargetForce = ($PlanetFleetInfo['Count'] * $LS) / 4;
|
||||
|
||||
if ($TargetForce > 100) {
|
||||
$TargetForce = 100;
|
||||
}
|
||||
$TargetChances = rand(0, $TargetForce);
|
||||
$SpyerChances = rand(0, 100);
|
||||
if ($TargetChances >= $SpyerChances) {
|
||||
$DestProba = sprintf( $lang['sys_mess_spy_lostproba'], $TargetChances);
|
||||
} elseif ($TargetChances < $SpyerChances) {
|
||||
$DestProba = "<font color=\"red\">".$lang['sys_mess_spy_destroyed']."</font>";
|
||||
}
|
||||
$AttackLink = "<center>";
|
||||
$AttackLink .= "<a href=\"fleet.php?galaxy=". $FleetRow['fleet_end_galaxy'] ."&system=". $FleetRow['fleet_end_system'] ."";
|
||||
$AttackLink .= "&planet=".$FleetRow['fleet_end_planet']."";
|
||||
$AttackLink .= "&target_mission=1";
|
||||
$AttackLink .= " \">". $lang['type_mission'][1] ."";
|
||||
$AttackLink .= "</a></center>";
|
||||
|
||||
|
||||
$MessageEnd = "<center>".$DestProba."</center>";
|
||||
|
||||
$pT = ($TargetSpyLvl - $CurrentSpyLvl);
|
||||
$pW = ($CurrentSpyLvl - $TargetSpyLvl);
|
||||
if ($TargetSpyLvl > $CurrentSpyLvl) {
|
||||
$ST = ($LS - pow($pT, 2));
|
||||
}
|
||||
if ($CurrentSpyLvl > $TargetSpyLvl) {
|
||||
$ST = ($LS + pow($pW, 2));
|
||||
}
|
||||
if ($TargetSpyLvl == $CurrentSpyLvl) {
|
||||
$ST = $CurrentSpyLvl;
|
||||
}
|
||||
if ($ST <= "1") {
|
||||
$SpyMessage = $Materials."<br />".$AttackLink.$MessageEnd;
|
||||
}
|
||||
if ($ST == "2") {
|
||||
$SpyMessage = $PlanetFleet."<br />".$AttackLink.$MessageEnd;
|
||||
}
|
||||
if ($ST == "4" or $ST == "3") {
|
||||
$SpyMessage = $PlanetDefense."<br />".$AttackLink.$MessageEnd;
|
||||
}
|
||||
if ($ST == "5" or $ST == "6") {
|
||||
$SpyMessage = $PlanetBuildings."<br />".$AttackLink.$MessageEnd;
|
||||
}
|
||||
if ($ST >= "7") {
|
||||
$SpyMessage = $TargetTechnos."<br />".$AttackLink.$MessageEnd;
|
||||
}
|
||||
|
||||
SendSimpleMessage ( $CurrentUserID, '', $FleetRow['fleet_start_time'], 0, $lang['sys_mess_qg'], $lang['sys_mess_spy_report'], $SpyMessage);
|
||||
|
||||
$TargetMessage = $lang['sys_mess_spy_ennemyfleet'] ." ". $CurrentPlanet['name'];
|
||||
$TargetMessage .= "<a href=\"galaxy.php?mode=3&galaxy=". $CurrentPlanet["galaxy"] ."&system=". $CurrentPlanet["system"] ."\">";
|
||||
$TargetMessage .= "[". $CurrentPlanet["galaxy"] .":". $CurrentPlanet["system"] .":". $CurrentPlanet["planet"] ."]</a> ";
|
||||
$TargetMessage .= $lang['sys_mess_spy_seen_at'] ." ". $TargetPlanet['name'];
|
||||
$TargetMessage .= " [". $TargetPlanet["galaxy"] .":". $TargetPlanet["system"] .":". $TargetPlanet["planet"] ."].";
|
||||
|
||||
SendSimpleMessage ( $TargetUserID, '', $FleetRow['fleet_start_time'], 0, $lang['sys_mess_spy_control'], $lang['sys_mess_spy_activity'], $TargetMessage);
|
||||
|
||||
}
|
||||
if ($TargetChances >= $SpyerChances) {
|
||||
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
|
||||
$QryUpdateGalaxy .= "`crystal` = `crystal` + '". (0 + $SpyToolDebris) ."' ";
|
||||
$QryUpdateGalaxy .= "WHERE `id_planet` = '". $TargetPlanet['id'] ."';";
|
||||
doquery( $QryUpdateGalaxy, 'galaxy');
|
||||
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
|
||||
} else {
|
||||
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Retour de sondes
|
||||
if ($FleetRow['fleet_end_time'] <= time()) {
|
||||
RestoreFleetToPlanet ( $FleetRow, true );
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
85
src/includes/functions/MissionCaseStay.php
Normal file
85
src/includes/functions/MissionCaseStay.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseStay ( $FleetRow ) {
|
||||
global $lang, $resource;
|
||||
|
||||
if ($FleetRow['fleet_mess'] == 0) {
|
||||
if ($FleetRow['fleet_start_time'] <= time()) {
|
||||
$QryGetTargetPlanet = "SELECT * FROM {{table}} ";
|
||||
$QryGetTargetPlanet .= "WHERE ";
|
||||
$QryGetTargetPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryGetTargetPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryGetTargetPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
||||
$QryGetTargetPlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."';";
|
||||
$TargetPlanet = doquery( $QryGetTargetPlanet, 'planets', true);
|
||||
$TargetUserID = $TargetPlanet['id_owner'];
|
||||
|
||||
$TargetAdress = sprintf ($lang['sys_adress_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
|
||||
$TargetAddedGoods = sprintf ($lang['sys_stay_mess_goods'],
|
||||
$lang['Metal'], pretty_number($FleetRow['fleet_resource_metal']),
|
||||
$lang['Crystal'], pretty_number($FleetRow['fleet_resource_crystal']),
|
||||
$lang['Deuterium'], pretty_number($FleetRow['fleet_resource_deuterium']));
|
||||
|
||||
$TargetMessage = $lang['sys_stay_mess_start'] ."<a href=\"galaxy.php?mode=3&galaxy=". $FleetRow['fleet_end_galaxy'] ."&system=". $FleetRow['fleet_end_system'] ."\">";
|
||||
$TargetMessage .= $TargetAdress. "</a>". $lang['sys_stay_mess_end'] ."<br />". $TargetAddedGoods;
|
||||
|
||||
SendSimpleMessage ( $TargetUserID, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_qg'], $lang['sys_stay_mess_stay'], $TargetMessage);
|
||||
RestoreFleetToPlanet ( $FleetRow, false );
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
|
||||
}
|
||||
} else {
|
||||
if ($FleetRow['fleet_end_time'] <= time()) {
|
||||
$TargetAdress = sprintf ($lang['sys_adress_planet'], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']);
|
||||
$TargetAddedGoods = sprintf ($lang['sys_stay_mess_goods'],
|
||||
$lang['Metal'], pretty_number($FleetRow['fleet_resource_metal']),
|
||||
$lang['Crystal'], pretty_number($FleetRow['fleet_resource_crystal']),
|
||||
$lang['Deuterium'], pretty_number($FleetRow['fleet_resource_deuterium']));
|
||||
|
||||
$TargetMessage = $lang['sys_stay_mess_back'] ."<a href=\"galaxy.php?mode=3&galaxy=". $FleetRow['fleet_start_galaxy'] ."&system=". $FleetRow['fleet_start_system'] ."\">";
|
||||
$TargetMessage .= $TargetAdress. "</a>". $lang['sys_stay_mess_bend'] ."<br />". $TargetAddedGoods;
|
||||
|
||||
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 5, $lang['sys_mess_qg'], $lang['sys_mess_fleetback'], $TargetMessage);
|
||||
RestoreFleetToPlanet ( $FleetRow, true );
|
||||
doquery("DELETE FROM {{table}} WHERE `fleet_id` = '". $FleetRow["fleet_id"] ."';", 'fleets');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
// History version
|
||||
// 1.0 Mise en module initiale
|
||||
// 1.1 FIX permet un retour de flotte coh<6F>rant
|
||||
?>
|
||||
93
src/includes/functions/MissionCaseStayAlly.php
Normal file
93
src/includes/functions/MissionCaseStayAlly.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseStayAlly ( $FleetRow ) {
|
||||
global $lang;
|
||||
|
||||
$QryStartPlanet = "SELECT * FROM {{table}} ";
|
||||
$QryStartPlanet .= "WHERE ";
|
||||
$QryStartPlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
|
||||
$QryStartPlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
|
||||
$QryStartPlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."';";
|
||||
$StartPlanet = doquery( $QryStartPlanet, 'planets', true);
|
||||
$StartName = $StartPlanet['name'];
|
||||
$StartOwner = $StartPlanet['id_owner'];
|
||||
|
||||
$QryTargetPlanet = "SELECT * FROM {{table}} ";
|
||||
$QryTargetPlanet .= "WHERE ";
|
||||
$QryTargetPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryTargetPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryTargetPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."';";
|
||||
$TargetPlanet = doquery( $QryTargetPlanet, 'planets', true);
|
||||
$TargetName = $TargetPlanet['name'];
|
||||
$TargetOwner = $TargetPlanet['id_owner'];
|
||||
|
||||
if ($FleetRow['fleet_mess'] == 0) {
|
||||
if ($FleetRow['fleet_start_time'] <= time()) {
|
||||
|
||||
$Message = sprintf( $lang['sys_tran_mess_owner'],
|
||||
$TargetName, GetTargetAdressLink($FleetRow, ''),
|
||||
$FleetRow['fleet_resource_metal'], $lang['Metal'],
|
||||
$FleetRow['fleet_resource_crystal'], $lang['Crystal'],
|
||||
$FleetRow['fleet_resource_deuterium'], $lang['Deuterium'] );
|
||||
|
||||
SendSimpleMessage ( $StartOwner, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
|
||||
|
||||
$Message = sprintf( $lang['sys_tran_mess_user'],
|
||||
$StartName, GetStartAdressLink($FleetRow, ''),
|
||||
$TargetName, GetTargetAdressLink($FleetRow, ''),
|
||||
$FleetRow['fleet_resource_metal'], $lang['Metal'],
|
||||
$FleetRow['fleet_resource_crystal'], $lang['Crystal'],
|
||||
$FleetRow['fleet_resource_deuterium'], $lang['Deuterium'] );
|
||||
SendSimpleMessage ( $TargetOwner, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
|
||||
} elseif ( $FleetRow['fleet_end_stay'] <= time() ) {
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = 2 ";
|
||||
$QryUpdateFleet .= "WHERE `fleet_id` = '". $FleetRow['fleet_id'] ."' ";
|
||||
$QryUpdateFleet .= "LIMIT 1 ;";
|
||||
doquery( $QryUpdateFleet, 'fleets');
|
||||
}
|
||||
} else {
|
||||
if ($FleetRow['fleet_end_time'] < time()) {
|
||||
$Message = sprintf ($lang['sys_tran_mess_back'],
|
||||
$StartName, GetStartAdressLink($FleetRow, ''));
|
||||
SendSimpleMessage ( $StartOwner, '', $FleetRow['fleet_end_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_fleetback'], $Message);
|
||||
RestoreFleetToPlanet ( $FleetRow, true );
|
||||
doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
101
src/includes/functions/MissionCaseTransport.php
Normal file
101
src/includes/functions/MissionCaseTransport.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
*/
|
||||
function MissionCaseTransport ( $FleetRow ) {
|
||||
global $lang;
|
||||
|
||||
$QryStartPlanet = "SELECT * FROM {{table}} ";
|
||||
$QryStartPlanet .= "WHERE ";
|
||||
$QryStartPlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
|
||||
$QryStartPlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
|
||||
$QryStartPlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
|
||||
$QryStartPlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."';";
|
||||
$StartPlanet = doquery( $QryStartPlanet, 'planets', true);
|
||||
$StartName = $StartPlanet['name'];
|
||||
$StartOwner = $StartPlanet['id_owner'];
|
||||
|
||||
$QryTargetPlanet = "SELECT * FROM {{table}} ";
|
||||
$QryTargetPlanet .= "WHERE ";
|
||||
$QryTargetPlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryTargetPlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryTargetPlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
||||
$QryTargetPlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."';";
|
||||
$TargetPlanet = doquery( $QryTargetPlanet, 'planets', true);
|
||||
$TargetName = $TargetPlanet['name'];
|
||||
$TargetOwner = $TargetPlanet['id_owner'];
|
||||
|
||||
if ($FleetRow['fleet_mess'] == 0) {
|
||||
if ($FleetRow['fleet_start_time'] < time()) {
|
||||
StoreGoodsToPlanet ($FleetRow, false);
|
||||
$Message = sprintf( $lang['sys_tran_mess_owner'],
|
||||
$TargetName, GetTargetAdressLink($FleetRow, ''),
|
||||
$FleetRow['fleet_resource_metal'], $lang['Metal'],
|
||||
$FleetRow['fleet_resource_crystal'], $lang['Crystal'],
|
||||
$FleetRow['fleet_resource_deuterium'], $lang['Deuterium'] );
|
||||
|
||||
SendSimpleMessage ( $StartOwner, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
|
||||
if ($TargetOwner <> $StartOwner) {
|
||||
$Message = sprintf( $lang['sys_tran_mess_user'],
|
||||
$StartName, GetStartAdressLink($FleetRow, ''),
|
||||
$TargetName, GetTargetAdressLink($FleetRow, ''),
|
||||
$FleetRow['fleet_resource_metal'], $lang['Metal'],
|
||||
$FleetRow['fleet_resource_crystal'], $lang['Crystal'],
|
||||
$FleetRow['fleet_resource_deuterium'], $lang['Deuterium'] );
|
||||
SendSimpleMessage ( $TargetOwner, '', $FleetRow['fleet_start_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
|
||||
}
|
||||
|
||||
$QryUpdateFleet = "UPDATE {{table}} SET ";
|
||||
$QryUpdateFleet .= "`fleet_resource_metal` = '0' , ";
|
||||
$QryUpdateFleet .= "`fleet_resource_crystal` = '0' , ";
|
||||
$QryUpdateFleet .= "`fleet_resource_deuterium` = '0' , ";
|
||||
$QryUpdateFleet .= "`fleet_mess` = '1' ";
|
||||
$QryUpdateFleet .= "WHERE `fleet_id` = '". $FleetRow['fleet_id'] ."' ";
|
||||
$QryUpdateFleet .= "LIMIT 1 ;";
|
||||
doquery( $QryUpdateFleet, 'fleets');
|
||||
}
|
||||
} else {
|
||||
if ($FleetRow['fleet_end_time'] < time()) {
|
||||
$Message = sprintf ($lang['sys_tran_mess_back'], $StartName, GetStartAdressLink($FleetRow, ''));
|
||||
SendSimpleMessage ( $StartOwner, '', $FleetRow['fleet_end_time'], 5, $lang['sys_mess_tower'], $lang['sys_mess_fleetback'], $Message);
|
||||
RestoreFleetToPlanet ( $FleetRow, true );
|
||||
doquery("DELETE FROM {{table}} WHERE fleet_id=" . $FleetRow["fleet_id"], 'fleets');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------
|
||||
// History version
|
||||
|
||||
?>
|
||||
51
src/includes/functions/PlanetResourceUpdate.php
Normal file
51
src/includes/functions/PlanetResourceUpdate.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param array $CurrentUser
|
||||
* @param array $CurrentPlanet
|
||||
* @param int $UpdateTime
|
||||
*/
|
||||
function PlanetResourceUpdate($CurrentUser, &$CurrentPlanet, $UpdateTime)
|
||||
{
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$planet = Legacies_Empire_Model_User::factory($CurrentPlanet['id']);
|
||||
|
||||
/*
|
||||
* Update planet resources and constructions
|
||||
*/
|
||||
Wootook::dispatchEvent('planet.update', array(
|
||||
'planet' => $planet,
|
||||
'time' => $UpdateTime
|
||||
));
|
||||
$planet->save();
|
||||
}
|
||||
74
src/includes/functions/RestoreFleetToPlanet.php
Normal file
74
src/includes/functions/RestoreFleetToPlanet.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
* @param unknown_type $Start
|
||||
*/
|
||||
function RestoreFleetToPlanet ( $FleetRow, $Start = true ) {
|
||||
global $resource;
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$FleetRecord = explode(";", $FleetRow['fleet_array']);
|
||||
$QryUpdFleet = "";
|
||||
foreach ($FleetRecord as $Item => $Group) {
|
||||
if ($Group != '') {
|
||||
$Class = explode (",", $Group);
|
||||
$QryUpdFleet .= "`". $resource[$Class[0]] ."` = `".$resource[$Class[0]]."` + '".$Class[1]."', \n";
|
||||
}
|
||||
}
|
||||
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
if ($QryUpdFleet != "") {
|
||||
$QryUpdatePlanet .= $QryUpdFleet;
|
||||
}
|
||||
$QryUpdatePlanet .= "`metal` = `metal` + '". $FleetRow['fleet_resource_metal'] ."', ";
|
||||
$QryUpdatePlanet .= "`crystal` = `crystal` + '". $FleetRow['fleet_resource_crystal'] ."', ";
|
||||
$QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $FleetRow['fleet_resource_deuterium'] ."' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
if ($Start == true) {
|
||||
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."' ";
|
||||
} else {
|
||||
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' ";
|
||||
}
|
||||
$QryUpdatePlanet .= "LIMIT 1;";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
64
src/includes/functions/RevisionTime.php
Normal file
64
src/includes/functions/RevisionTime.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $seconds
|
||||
*/
|
||||
function RevisionTime ($seconds) {
|
||||
$days = floor($seconds / 86400);
|
||||
$hours = (floor(($seconds % 86400) / 3600));
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$secs = $seconds % 60;
|
||||
$month_len = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
|
||||
$year = 1970;
|
||||
$done = 0;
|
||||
$month_id = 1;
|
||||
while ($days > $month_lenght) {
|
||||
$month_lenght = ($month_id == 2 ? ($year % 4 == 0 ? 29 : $month_len[$month_id]) : $month_len[$month_id]);
|
||||
$days -= $month_lenght;
|
||||
if ($month_id > 12) {
|
||||
$month_id = 1;
|
||||
$year++;
|
||||
} else
|
||||
$month_id++;
|
||||
}
|
||||
$days++;
|
||||
$days = ($days < 10 ? "0" . $days : $days);
|
||||
$month = ($month_id < 10 ? "0" . $month_id : $month_id);
|
||||
$hours = ($hours < 10 ? "0" . $hours : $hours);
|
||||
$minutes = ($minutes < 10 ? "0" . $minutes : $minutes);
|
||||
$secs = ($secs < 10 ? "0" . $secs : $secs);
|
||||
$ret = ($seconds > 0 ? "$year-$month-$days<br>GMT $hours:$minutes:$secs" : "");
|
||||
return $ret;
|
||||
}
|
||||
|
||||
?>
|
||||
92
src/includes/functions/SendNewPassword.php
Normal file
92
src/includes/functions/SendNewPassword.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $mail
|
||||
*/
|
||||
function sendnewpassword($mail){
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
|
||||
$ExistMail = doquery("SELECT `email` FROM {{table}} WHERE `email` = '". $mail ."' LIMIT 1;", 'users', true);
|
||||
|
||||
if (empty($ExistMail['email'])) {
|
||||
message('L\'adresse n\'existe pas !','Erreur');
|
||||
}
|
||||
|
||||
else{
|
||||
//Caractere qui seront contenus dans le nouveau mot de passe
|
||||
$Caracters="aazertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN1234567890";
|
||||
|
||||
$Count=strlen($Caracters);
|
||||
|
||||
$NewPass="";
|
||||
$Taille=6;
|
||||
|
||||
|
||||
srand((double)microtime()*1000000);
|
||||
|
||||
for($i=0;$i<$Taille;$i++){
|
||||
|
||||
$CaracterBoucle=rand(0,$Count-1);
|
||||
|
||||
$NewPass=$NewPass.substr($Caracters,$CaracterBoucle,1);
|
||||
}
|
||||
|
||||
//Et un nouveau mot de passe tout chaud ^^
|
||||
|
||||
//On va maintenant l'envoyer au destinataire
|
||||
$Title = "Wootook : Nouveau mot de passe";
|
||||
$Body = "Voici votre nouveau mot de passe : ";
|
||||
$Body .= $NewPass;
|
||||
|
||||
mail($mail,$Title,$Body);
|
||||
|
||||
//Email envoy<6F>, maintenant place au changement dans la BDD
|
||||
|
||||
$NewPassSql = md5($NewPass);
|
||||
|
||||
$QryPassChange = "UPDATE {{table}} SET ";
|
||||
$QryPassChange .= "`password` ='". $NewPassSql ."' ";
|
||||
$QryPassChange .= "WHERE `email`='". $mail ."' LIMIT 1;";
|
||||
|
||||
doquery( $QryPassChange, 'users');
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
74
src/includes/functions/SendSimpleMessage.php
Normal file
74
src/includes/functions/SendSimpleMessage.php
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Owner
|
||||
* @param unknown_type $Sender
|
||||
* @param unknown_type $Time
|
||||
* @param unknown_type $Type
|
||||
* @param unknown_type $From
|
||||
* @param unknown_type $Subject
|
||||
* @param unknown_type $Message
|
||||
*/
|
||||
function SendSimpleMessage ( $Owner, $Sender, $Time, $Type, $From, $Subject, $Message) {
|
||||
global $messfields;
|
||||
|
||||
if ($Time == '') {
|
||||
$Time = time();
|
||||
}
|
||||
|
||||
$QryInsertMessage = "INSERT INTO {{table}} SET ";
|
||||
$QryInsertMessage .= "`message_owner` = '". $Owner ."', ";
|
||||
$QryInsertMessage .= "`message_sender` = '". $Sender ."', ";
|
||||
$QryInsertMessage .= "`message_time` = '" . $Time . "', ";
|
||||
$QryInsertMessage .= "`message_type` = '". $Type ."', ";
|
||||
$QryInsertMessage .= "`message_from` = '". addslashes( $From ) ."', ";
|
||||
$QryInsertMessage .= "`message_subject` = '". addslashes( $Subject ) ."', ";
|
||||
$QryInsertMessage .= "`message_text` = '". addslashes( $Message ) ."';";
|
||||
doquery( $QryInsertMessage, 'messages');
|
||||
|
||||
$QryUpdateUser = "UPDATE {{table}} SET ";
|
||||
$QryUpdateUser .= "`".$messfields[$Type]."` = `".$messfields[$Type]."` + 1, ";
|
||||
$QryUpdateUser .= "`".$messfields[100]."` = `".$messfields[100]."` + 1 ";
|
||||
$QryUpdateUser .= "WHERE ";
|
||||
$QryUpdateUser .= "`id` = '". $Owner ."';";
|
||||
doquery( $QryUpdateUser, 'users');
|
||||
|
||||
}
|
||||
|
||||
// Revision history :
|
||||
// 1.0 - Initial release (mise en fonction generique)
|
||||
// 1.1 - Ajout gestion des messages par type pour le module de messages
|
||||
// 1.2 - Correction bug (addslashes pour les zone texte pouvant contenir une apostrophe)
|
||||
// 1.3 - Correction bug (integration de la variable $Time pour afficher l'heure exacte de l'evenement pour les flottes)
|
||||
|
||||
?>
|
||||
101
src/includes/functions/ShowGalaxyFooter.php
Normal file
101
src/includes/functions/ShowGalaxyFooter.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $CurrentMIP
|
||||
* @param unknown_type $CurrentRC
|
||||
* @param unknown_type $CurrentSP
|
||||
*/
|
||||
function ShowGalaxyFooter ( $Galaxy, $System, $CurrentMIP, $CurrentRC, $CurrentSP) {
|
||||
global $lang, $maxfleet_count, $fleetmax, $planetcount;
|
||||
|
||||
$Result = "";
|
||||
if ($planetcount == 1) {
|
||||
$PlanetCountMessage = $planetcount ." ". $lang['gf_cntmone'];
|
||||
} elseif ($planetcount == 0) {
|
||||
$PlanetCountMessage = $lang['gf_cntmnone'];
|
||||
} else {
|
||||
$PlanetCountMessage = $planetcount." " . $lang['gf_cntmsome'];
|
||||
}
|
||||
$LegendPopup = GalaxyLegendPopup ();
|
||||
$Recyclers = pretty_number($CurrentRC);
|
||||
$SpyProbes = pretty_number($CurrentSP);
|
||||
|
||||
$Result .= "\n";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<th width=\"30\">16</th>";
|
||||
$Result .= "<th colspan=7>";
|
||||
$Result .= "<a href=fleet.php?galaxy=".$Galaxy."&system=".$System."&planet=16;planettype=1&target_mission=15>". $lang['gf_unknowsp'] ."</a>";
|
||||
$Result .= "</th>";
|
||||
$Result .= "</tr>";
|
||||
|
||||
$Result .= "\n";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=6>( ".$PlanetCountMessage." )</td>";
|
||||
$Result .= "<td class=c colspan=2>". $LegendPopup ."</td>";
|
||||
$Result .= "</tr>";
|
||||
|
||||
$Result .= "\n";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=3><span id=\"missiles\">". $CurrentMIP ."</span> ". $lang['gf_mi_title'] ."</td>";
|
||||
$Result .= "<td class=c colspan=3><span id=\"slots\">". $maxfleet_count ."</span>/". $fleetmax ." ". $lang['gf_fleetslt'] ."</td>";
|
||||
$Result .= "<td class=c colspan=2>";
|
||||
$Result .= "<span id=\"recyclers\">". $Recyclers ."</span> ". $lang['gf_rc_title'] ."<br>";
|
||||
$Result .= "<span id=\"probes\">". $SpyProbes ."</span> ". $lang['gf_sp_title'] ."</td>";
|
||||
$Result .= "</tr>";
|
||||
|
||||
$Result .= "\n";
|
||||
$Result .= "<tr style=\"display: none;\" id=\"fleetstatusrow\">";
|
||||
$Result .= "<th class=c colspan=8><!--<div id=\"fleetstatus\"></div>-->";
|
||||
$Result .= "<table style=\"font-weight: bold\" width=\"100%\" id=\"fleetstatustable\">";
|
||||
$Result .= "<!-- will be filled with content later on while processing ajax replys -->";
|
||||
// $Result .= "<tr style=\"display: none; align:left\" id=\"fleetstatusrow\">";
|
||||
// $Result .= "<th colspan=8><div style=\"align:left\" id=\"fleetstatus\"></div></th>";
|
||||
// $Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "</th>";
|
||||
$Result .= "\n";
|
||||
$Result .= "</tr>";
|
||||
/*
|
||||
<tr style=\"display: none;\" id=\"fleetstatusrow\"><th colspan="8"><!--<div id="fleetstatus"></div>-->
|
||||
<table style="font-weight: bold;" width=100% id="fleetstatustable">
|
||||
<!-- will be filled with content later on while processing ajax replys -->
|
||||
</table>
|
||||
</th>
|
||||
</tr>
|
||||
*/
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
76
src/includes/functions/ShowGalaxyMISelector.php
Normal file
76
src/includes/functions/ShowGalaxyMISelector.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
* @param unknown_type $Planet
|
||||
* @param unknown_type $Current
|
||||
* @param unknown_type $MICount
|
||||
*/
|
||||
function ShowGalaxyMISelector ( $Galaxy, $System, $Planet, $Current, $MICount ) {
|
||||
global $lang;
|
||||
|
||||
$Result = "<form action=\"raketenangriff.php?c=".$Current."&mode=2&galaxy=".$Galaxy."&system=".$System."&planet=".$Planet."\" method=\"POST\">";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<table border=\"0\">";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=\"c\" colspan=\"2\">";
|
||||
$Result .= $lang['gm_launch'] ." [".$Galaxy.":".$System.":".$Planet."]";
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "<tr>";
|
||||
$String = sprintf($lang['gm_restmi'], $MICount);
|
||||
$Result .= "<td class=\"c\">".$String." <input type=\"text\" name=\"SendMI\" size=\"2\" maxlength=\"7\" /></td>";
|
||||
$Result .= "<td class=\"c\">".$lang['gm_target']." <select name=\"Target\">";
|
||||
$Result .= "<option value=\"all\" selected>".$lang['gm_all']."</option>";
|
||||
$Result .= "<option value=\"0\">".$lang['tech'][401]."</option>";
|
||||
$Result .= "<option value=\"1\">".$lang['tech'][402]."</option>";
|
||||
$Result .= "<option value=\"2\">".$lang['tech'][403]."</option>";
|
||||
$Result .= "<option value=\"3\">".$lang['tech'][404]."</option>";
|
||||
$Result .= "<option value=\"4\">".$lang['tech'][405]."</option>";
|
||||
$Result .= "<option value=\"5\">".$lang['tech'][406]."</option>";
|
||||
$Result .= "<option value=\"6\">".$lang['tech'][407]."</option>";
|
||||
$Result .= "<option value=\"7\">".$lang['tech'][408]."</option>";
|
||||
$Result .= "</select>";
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=\"c\" colspan=\"2\"><input type=\"submit\" name=\"aktion\" value=\"".$lang['gm_send']."\"></td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</table>";
|
||||
$Result .= "</form>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
103
src/includes/functions/ShowGalaxyRows.php
Normal file
103
src/includes/functions/ShowGalaxyRows.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
*/
|
||||
function ShowGalaxyRows ($Galaxy, $System) {
|
||||
global $lang, $planetcount, $CurrentRC, $dpath, $user;
|
||||
|
||||
$Result = "";
|
||||
for ($Planet = 1; $Planet <= Wootook::getGameConfig('engine/universe/positions'); $Planet++) {
|
||||
|
||||
$GalaxyRowPlanet = array();
|
||||
$GalaxyRowMoon = array();
|
||||
$GalaxyRowPlayer = array();
|
||||
$GalaxyRowAlly = array();
|
||||
|
||||
$GalaxyRow = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '".$Galaxy."' AND `system` = '".$System."' AND `planet` = '".$Planet."';", 'galaxy', true);
|
||||
|
||||
$Result .= "\n";
|
||||
$Result .= "<tr>"; // Depart de ligne
|
||||
if ($GalaxyRow) {
|
||||
// Il existe des choses sur cette ligne de planete
|
||||
if ($GalaxyRow["id_planet"] != 0) {
|
||||
$GalaxyRowPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRow["id_planet"] ."';", 'planets', true);
|
||||
|
||||
if ($GalaxyRowPlanet['destruyed'] != 0 AND
|
||||
$GalaxyRowPlanet['id_owner'] != '' AND
|
||||
$GalaxyRow["id_planet"] != '') {
|
||||
CheckAbandonPlanetState ($GalaxyRowPlanet);
|
||||
} else {
|
||||
$planetcount++;
|
||||
$GalaxyRowPlayer = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRowPlanet["id_owner"] ."';", 'users', true);
|
||||
}
|
||||
|
||||
if ($GalaxyRow["id_luna"] != 0) {
|
||||
$GalaxyRowMoon = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRow["id_luna"] ."';", 'lunas', true);
|
||||
if ($GalaxyRowMoon["destruyed"] != 0) {
|
||||
CheckAbandonMoonState ($GalaxyRowMoon);
|
||||
}
|
||||
}
|
||||
$GalaxyRowPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRow["id_planet"] ."';", 'planets', true);
|
||||
if ($GalaxyRowPlanet['id_owner'] <> 0) {
|
||||
$GalaxyRowUser = doquery("SELECT * FROM {{table}} WHERE `id` = '". $GalaxyRowPlanet['id_owner'] ."';", 'users', true);
|
||||
} else {
|
||||
$GalaxyRowUser = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
$Result .= "\n";
|
||||
$Result .= GalaxyRowPos ( $Planet, $GalaxyRow );
|
||||
$Result .= "\n";
|
||||
$Result .= GalaxyRowPlanet ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 1 );
|
||||
$Result .= "\n";
|
||||
$Result .= GalaxyRowPlanetName ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 1 );
|
||||
$Result .= "\n";
|
||||
$Result .= GalaxyRowMoon ( $GalaxyRow, $GalaxyRowMoon , $GalaxyRowPlayer, $Galaxy, $System, $Planet, 3 );
|
||||
$Result .= "\n";
|
||||
$Result .= GalaxyRowDebris ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 2 );
|
||||
$Result .= "\n";
|
||||
$Result .= GalaxyRowUser ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 0 );
|
||||
$Result .= "\n";
|
||||
$Result .= GalaxyRowAlly ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 0 );
|
||||
$Result .= "\n";
|
||||
$Result .= GalaxyRowActions ( $GalaxyRow, $GalaxyRowPlanet, $GalaxyRowPlayer, $Galaxy, $System, $Planet, 0 );
|
||||
$Result .= "\n";
|
||||
$Result .= "</tr>";
|
||||
}
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
85
src/includes/functions/ShowGalaxySelector.php
Normal file
85
src/includes/functions/ShowGalaxySelector.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
*/
|
||||
function ShowGalaxySelector ( $Galaxy, $System ) {
|
||||
global $lang;
|
||||
|
||||
if ($Galaxy > Wootook::getGameConfig('engine/universe/galaxies')) {
|
||||
$Galaxy = Wootook::getGameConfig('engine/universe/galaxies');
|
||||
}
|
||||
if ($Galaxy < 1) {
|
||||
$Galaxy = 1;
|
||||
}
|
||||
if ($System > Wootook::getGameConfig('engine/universe/systems')) {
|
||||
$System = Wootook::getGameConfig('engine/universe/systems');
|
||||
}
|
||||
if ($System < 1) {
|
||||
$System = 1;
|
||||
}
|
||||
|
||||
$Result = "<form action=\"galaxy.php?mode=1\" method=\"post\" id=\"galaxy_form\">";
|
||||
$Result .= "<input type=\"hidden\" id=\"auto\" value=\"dr\" >";
|
||||
$Result .= "<table border=\"0\">";
|
||||
$Result .= "<tbody><tr><td>";
|
||||
|
||||
$Result .= "<table><tbody><tr>";
|
||||
$Result .= "<td class=\"c\" colspan=\"3\">". $lang['Galaxy'] ."</td></tr><tr>";
|
||||
$Result .= "<td class=\"l\"><input name=\"galaxyLeft\" value=\"<-\" onclick=\"galaxy_submit('galaxyLeft')\" type=\"button\"></td>";
|
||||
$Result .= "<td class=\"l\"><input name=\"galaxy\" value=\"". $Galaxy ."\" size=\"5\" maxlength=\"3\" tabindex=\"1\" type=\"text\"></td>";
|
||||
$Result .= "<td class=\"l\"><input name=\"galaxyRight\" value=\"->\" onclick=\"galaxy_submit('galaxyRight')\" type=\"button\"></td>";
|
||||
$Result .= "</tr></tbody></table>";
|
||||
|
||||
$Result .= "</td><td>";
|
||||
|
||||
$Result .= "<table><tbody><tr>";
|
||||
$Result .= "<td class=\"c\" colspan=\"3\">". $lang['Solar_system'] ."</td></tr><tr>";
|
||||
$Result .= "<td class=\"l\"><input name=\"systemLeft\" value=\"<-\" onclick=\"galaxy_submit('systemLeft')\" type=\"button\"></td>";
|
||||
$Result .= "<td class=\"l\"><input name=\"system\" value=\"". $System ."\" size=\"5\" maxlength=\"3\" tabindex=\"2\" type=\"text\"></td>";
|
||||
$Result .= "<td class=\"l\"><input name=\"systemRight\" value=\"->\" onclick=\"galaxy_submit('systemRight')\" type=\"button\"></td>";
|
||||
$Result .= "</tr></tbody></table>";
|
||||
|
||||
$Result .= "</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td class=\"l\" colspan=\"2\" align=\"center\"> <input value=\"". $lang['Afficher'] ."\" type=\"submit\"></td>";
|
||||
$Result .= "</tr>";
|
||||
$Result .= "</tbody></table>";
|
||||
$Result .= "</form>";
|
||||
|
||||
return $Result;
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
57
src/includes/functions/ShowGalaxyTitles.php
Normal file
57
src/includes/functions/ShowGalaxyTitles.php
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $Galaxy
|
||||
* @param unknown_type $System
|
||||
*/
|
||||
function ShowGalaxyTitles ( $Galaxy, $System ) {
|
||||
global $lang;
|
||||
|
||||
$Result = "\n";
|
||||
$Result .= "<tr>";
|
||||
$Result .= "<td class=c colspan=8>".$lang['Solar_system']." ".$Galaxy.":".$System."</td>";
|
||||
$Result .= "</tr><tr>";
|
||||
$Result .= "<td class=c>".$lang['Pos']."</td>";
|
||||
$Result .= "<td class=c>".$lang['Planet']."</td>";
|
||||
$Result .= "<td class=c>".$lang['Name']."</td>";
|
||||
$Result .= "<td class=c>".$lang['Moon']."</td>";
|
||||
$Result .= "<td class=c>".$lang['Debris']."</td>";
|
||||
$Result .= "<td class=c>".$lang['Player']."</td>";
|
||||
$Result .= "<td class=c>".$lang['Alliance']."</td>";
|
||||
$Result .= "<td class=c>".$lang['Actions']."</td>";
|
||||
$Result .= "</tr>";
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
?>
|
||||
52
src/includes/functions/SortUserPlanets.php
Normal file
52
src/includes/functions/SortUserPlanets.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function SortUserPlanets ( $CurrentUser ) {
|
||||
$Order = ( $CurrentUser['planet_sort_order'] == 1 ) ? "DESC" : "ASC" ;
|
||||
$Sort = $CurrentUser['planet_sort'];
|
||||
|
||||
$QryPlanets = "SELECT `id`, `name`, `galaxy`, `system`, `planet`, `planet_type` FROM {{table}} WHERE `id_owner` = '". $CurrentUser['id'] ."' ORDER BY ";
|
||||
if ( $Sort == 0 ) {
|
||||
$QryPlanets .= "`id` ". $Order;
|
||||
} elseif ( $Sort == 1 ) {
|
||||
$QryPlanets .= "`galaxy`, `system`, `planet`, `planet_type` ". $Order;
|
||||
} elseif ( $Sort == 2 ) {
|
||||
$QryPlanets .= "`name` ". $Order;
|
||||
}
|
||||
$Planets = doquery ( $QryPlanets, 'planets');
|
||||
|
||||
return $Planets;
|
||||
}
|
||||
?>
|
||||
118
src/includes/functions/SpyTarget.php
Normal file
118
src/includes/functions/SpyTarget.php
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $TargetPlanet
|
||||
* @param unknown_type $Mode
|
||||
* @param unknown_type $TitleString
|
||||
*/
|
||||
function SpyTarget ( $TargetPlanet, $Mode, $TitleString ) {
|
||||
global $lang, $resource;
|
||||
|
||||
$LookAtLoop = true;
|
||||
if ($Mode == 0) {
|
||||
$String = "<table width=\"440\"><tr><td class=\"c\" colspan=\"5\">";
|
||||
$String .= $TitleString ." ". $TargetPlanet['name'];
|
||||
$String .= " <a href=\"galaxy.php?mode=3&galaxy=". $TargetPlanet["galaxy"] ."&system=". $TargetPlanet["system"]. "\">";
|
||||
$String .= "[". $TargetPlanet["galaxy"] .":". $TargetPlanet["system"] .":". $TargetPlanet["planet"] ."]</a>";
|
||||
$String .= " le ". gmdate("d-m-Y H:i:s", time() + 2 * 60 * 60) ."</td>";
|
||||
$String .= "</tr><tr>";
|
||||
$String .= "<td width=220>". $lang['Metal'] ."</td><td width=220 align=right>". pretty_number($TargetPlanet['metal']) ."</td><td> </td>";
|
||||
$String .= "<td width=220>". $lang['Crystal'] ."</td></td><td width=220 align=right>". pretty_number($TargetPlanet['crystal']) ."</td>";
|
||||
$String .= "</tr><tr>";
|
||||
$String .= "<td width=220>". $lang['Deuterium'] ."</td><td width=220 align=right>". pretty_number($TargetPlanet['deuterium']) ."</td><td> </td>";
|
||||
$String .= "<td width=220>". $lang['Energy'] ."</td><td width=220 align=right>". pretty_number($TargetPlanet['energy_max']) ."</td>";
|
||||
$String .= "</tr>";
|
||||
$LookAtLoop = false;
|
||||
} elseif ($Mode == 1) {
|
||||
$ResFrom[0] = 200;
|
||||
$ResTo[0] = 299;
|
||||
$Loops = 1;
|
||||
} elseif ($Mode == 2) {
|
||||
$ResFrom[0] = 400;
|
||||
$ResTo[0] = 499;
|
||||
$ResFrom[1] = 500;
|
||||
$ResTo[1] = 599;
|
||||
$Loops = 2;
|
||||
} elseif ($Mode == 3) {
|
||||
$ResFrom[0] = 1;
|
||||
$ResTo[0] = 99;
|
||||
$Loops = 1;
|
||||
} elseif ($Mode == 4) {
|
||||
$ResFrom[0] = 100;
|
||||
$ResTo[0] = 199;
|
||||
$Loops = 1;
|
||||
}
|
||||
|
||||
if ($LookAtLoop == true) {
|
||||
$String = "<table width=\"440\" cellspacing=\"1\"><tr><td class=\"c\" colspan=\"". ((2 * SPY_REPORT_ROW) + (SPY_REPORT_ROW - 1))."\">". $TitleString ."</td></tr>";
|
||||
$Count = 0;
|
||||
$CurrentLook = 0;
|
||||
while ($CurrentLook < $Loops) {
|
||||
$row = 0;
|
||||
for ($Item = $ResFrom[$CurrentLook]; $Item <= $ResTo[$CurrentLook]; $Item++) {
|
||||
if ( $TargetPlanet[$resource[$Item]] > 0) {
|
||||
if ($row == 0) {
|
||||
$String .= "<tr>";
|
||||
}
|
||||
$String .= "<td align=left>".$lang['tech'][$Item]."</td><td align=right>".$TargetPlanet[$resource[$Item]]."</td>";
|
||||
if ($row < SPY_REPORT_ROW - 1) {
|
||||
$String .= "<td> </td>";
|
||||
}
|
||||
$Count += $TargetPlanet[$resource[$Item]];
|
||||
$row++;
|
||||
if ($row == SPY_REPORT_ROW) {
|
||||
$String .= "</tr>";
|
||||
$row = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ($row != 0) {
|
||||
$String .= "<td> </td><td> </td>";
|
||||
$row++;
|
||||
if ($row == SPY_REPORT_ROW) {
|
||||
$String .= "</tr>";
|
||||
$row = 0;
|
||||
}
|
||||
}
|
||||
$CurrentLook++;
|
||||
} // while
|
||||
}
|
||||
$String .= "</table>";
|
||||
|
||||
$return['String'] = $String;
|
||||
$return['Count'] = $Count;
|
||||
return $return;
|
||||
}
|
||||
|
||||
?>
|
||||
62
src/includes/functions/StoreGoodsToPlanet.php
Normal file
62
src/includes/functions/StoreGoodsToPlanet.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $FleetRow
|
||||
* @param unknown_type $Start
|
||||
*/
|
||||
function StoreGoodsToPlanet ( $FleetRow, $Start = false ) {
|
||||
global $resource;
|
||||
|
||||
|
||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||
$QryUpdatePlanet .= "`metal` = `metal` + '". $FleetRow['fleet_resource_metal'] ."', ";
|
||||
$QryUpdatePlanet .= "`crystal` = `crystal` + '". $FleetRow['fleet_resource_crystal'] ."', ";
|
||||
$QryUpdatePlanet .= "`deuterium` = `deuterium` + '". $FleetRow['fleet_resource_deuterium'] ."' ";
|
||||
$QryUpdatePlanet .= "WHERE ";
|
||||
if ($Start == true) {
|
||||
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_start_galaxy'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_start_system'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_start_planet'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_start_type'] ."' ";
|
||||
} else {
|
||||
$QryUpdatePlanet .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
||||
$QryUpdatePlanet .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' ";
|
||||
}
|
||||
$QryUpdatePlanet .= "LIMIT 1;";
|
||||
doquery( $QryUpdatePlanet, 'planets');
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
62
src/includes/functions/UpdatePlanetBatimentQueueList.php
Normal file
62
src/includes/functions/UpdatePlanetBatimentQueueList.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated
|
||||
* @param unknown_type $CurrentPlanet
|
||||
* @param unknown_type $CurrentUser
|
||||
*/
|
||||
function UpdatePlanetBatimentQueueList ( &$CurrentPlanet, &$CurrentUser ) {
|
||||
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||
$RetValue = false;
|
||||
if ( $CurrentPlanet['b_building_id'] != 0 ) {
|
||||
while ( $CurrentPlanet['b_building_id'] != 0 ) {
|
||||
if ( $CurrentPlanet['b_building'] <= time() ) {
|
||||
PlanetResourceUpdate ( $CurrentUser, $CurrentPlanet, $CurrentPlanet['b_building'], false );
|
||||
$IsDone = CheckPlanetBuildingQueue( $CurrentPlanet, $CurrentUser );
|
||||
if ( $IsDone == true ) {
|
||||
SetNextQueueElementOnTop ( $CurrentPlanet, $CurrentUser );
|
||||
}
|
||||
} else {
|
||||
$RetValue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $RetValue;
|
||||
}
|
||||
|
||||
// Revision History
|
||||
// - 1.0 Mise en module initiale
|
||||
// - 1.1 Mise a jour des ressources sur la planete verifi<66>e (pour prendre en compte les ressources produites
|
||||
// pendant la construction et avant l'evolution evantuel d'une mine ou d'en batiment
|
||||
|
||||
?>
|
||||
157
src/includes/migrateinfo.php
Normal file
157
src/includes/migrateinfo.php
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
$QryMigrate = array(
|
||||
"ALTER TABLE `{{prefix}}fleets` ADD COLUMN `fleet_end_stay` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}fleets` ADD COLUMN `fleet_target_owner` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}fleets` ADD COLUMN `fleet_group` int (11) NOT NULL DEFAULT '0';",
|
||||
|
||||
"ALTER TABLE `{{prefix}}messages` MODIFY `message_from` varchar(48) character set latin1 default NULL;",
|
||||
"ALTER TABLE `{{prefix}}messages` MODIFY `message_subject` varchar(48) character set latin1 default NULL;",
|
||||
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `mnl_buildlist` INT (11) NOT NULL;",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `expedition_tech` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `mnl_expedition` INT( 11 ) NOT NULL;",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_geologue` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_amiral` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_ingenieur` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_technocrate` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_espion` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_constructeur` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_scientifique` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_commandant` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_stockeur` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_defenseur` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_destructeur` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_general` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_bunker` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_raideur` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_empereur` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `rpg_points` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `lvl_minier` int(11) NOT NULL default '1';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `lvl_raid` int(11) NOT NULL default '1';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `xpraid` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `xpminier` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `banaday` int(11) default NULL;",
|
||||
"ALTER TABLE `{{prefix}}users` ADD COLUMN `user_agent` text character set latin1 NOT NULL;",
|
||||
"ALTER TABLE `{{prefix}}users` MODIFY `lang` varchar(8) character set latin1 NOT NULL default 'fr';",
|
||||
|
||||
"CREATE TABLE `{{prefix}}annonce` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`user` text collate latin1_general_ci NOT NULL,
|
||||
`galaxie` int(11) NOT NULL,
|
||||
`systeme` int(11) NOT NULL,
|
||||
`metala` bigint(11) NOT NULL,
|
||||
`cristala` bigint(11) NOT NULL,
|
||||
`deuta` bigint(11) NOT NULL,
|
||||
`metals` bigint(11) NOT NULL,
|
||||
`cristals` bigint(11) NOT NULL,
|
||||
`deuts` bigint(11) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci AUTO_INCREMENT=5;",
|
||||
|
||||
"ALTER TABLE `{{prefix}}planets` ADD COLUMN `last_jump_time` int(11) NOT NULL default '0';",
|
||||
"ALTER TABLE `{{prefix}}planets` ADD COLUMN `id_level` int(11) default NULL;",
|
||||
"ALTER TABLE `{{prefix}}planets` MODIFY `b_building_id` text character set latin1 NOT NULL;",
|
||||
|
||||
"CREATE TABLE `{{prefix}}statpoints` (
|
||||
`id_owner` int(11) NOT NULL,
|
||||
`id_ally` int(11) NOT NULL,
|
||||
`stat_type` int(2) NOT NULL,
|
||||
`stat_code` int(11) NOT NULL,
|
||||
`tech_rank` int(11) NOT NULL,
|
||||
`tech_old_rank` int(11) NOT NULL,
|
||||
`tech_points` bigint(20) NOT NULL,
|
||||
`tech_count` int(11) NOT NULL,
|
||||
`build_rank` int(11) NOT NULL,
|
||||
`build_old_rank` int(11) NOT NULL,
|
||||
`build_points` bigint(20) NOT NULL,
|
||||
`build_count` int(11) NOT NULL,
|
||||
`defs_rank` int(11) NOT NULL,
|
||||
`defs_old_rank` int(11) NOT NULL,
|
||||
`defs_points` bigint(20) NOT NULL,
|
||||
`defs_count` int(11) NOT NULL,
|
||||
`fleet_rank` int(11) NOT NULL,
|
||||
`fleet_old_rank` int(11) NOT NULL,
|
||||
`fleet_points` bigint(20) NOT NULL,
|
||||
`fleet_count` int(11) NOT NULL,
|
||||
`total_rank` int(11) NOT NULL,
|
||||
`total_old_rank` int(11) NOT NULL,
|
||||
`total_points` bigint(20) NOT NULL,
|
||||
`total_count` int(11) NOT NULL,
|
||||
`stat_date` int(11) NOT NULL,
|
||||
KEY `TECH` (`tech_points`),
|
||||
KEY `BUILDS` (`build_points`),
|
||||
KEY `DEFS` (`defs_points`),
|
||||
KEY `FLEET` (`fleet_points`),
|
||||
KEY `TOTAL` (`total_points`)
|
||||
) ENGINE=MyISAM;",
|
||||
|
||||
"CREATE TABLE `{{prefix}}chat` (
|
||||
`messageid` int(5) unsigned NOT NULL auto_increment,
|
||||
`user` varchar(255) NOT NULL default '',
|
||||
`message` text NOT NULL,
|
||||
`timestamp` int(11) NOT NULL default '0',
|
||||
PRIMARY KEY (`messageid`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;",
|
||||
|
||||
"INSERT INTO `{{prefix}}config` (`config_name`, `config_value`) VALUES
|
||||
('Fleet_Cdr', '30'),
|
||||
('Defs_Cdr', '30'),
|
||||
('game_disable', '0'),
|
||||
('close_reason', ''),
|
||||
('BuildLabWhileRun', '0'),
|
||||
('LastSettedGalaxyPos', '1'),
|
||||
('LastSettedSystemPos', '9'),
|
||||
('LastSettedPlanetPos', '1'),
|
||||
('urlaubs_modus_erz', '1'),
|
||||
('forum_url', 'http://board.xnova-ng.org/'),
|
||||
('OverviewNewsFrame', '1'),
|
||||
('OverviewNewsText', 'Vous avez correctement mis votre serveur UGamela sous Wootook!'),
|
||||
('OverviewExternChat', '0'),
|
||||
('OverviewExternChatCmd', ''),
|
||||
('OverviewBanner', '0'),
|
||||
('OverviewClickBanner', ''),
|
||||
('ExtCopyFrame', '0'),
|
||||
('ExtCopyOwner', ''),
|
||||
('ExtCopyFunct', ''),
|
||||
('ForumBannerFrame', '0');",
|
||||
"UPDATE `{{prefix}}config` SET `config_value`='Wootook' WHERE `config_name`='COOKIE_NAME';",
|
||||
"UPDATE `{{prefix}}config` SET `config_value`='Wootook' WHERE `config_name`='game_name';",
|
||||
|
||||
"CREATE TABLE `{{prefix}}multi` (
|
||||
`id` int(11) NOT NULL auto_increment,
|
||||
`player` bigint(11) unsigned NOT NULL default '0',
|
||||
`sharer` bigint(11) unsigned NOT NULL default '0',
|
||||
`reason` text character set latin1 NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
|
||||
|
||||
?>
|
||||
161
src/includes/raketenangriff.php
Normal file
161
src/includes/raketenangriff.php
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
function raketenangriff($verteidiger_panzerung, $angreifer_waffen, $iraks, $def, $primaerziel = '0') {
|
||||
// Variablen initialisieren
|
||||
$temp = '';
|
||||
$temp2 = '';
|
||||
|
||||
$def[10] = $iraks;
|
||||
|
||||
$metall = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
$kristall = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
$deut = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
$verblieben = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
for($temp = 0; $temp < 11; $temp++) {
|
||||
$verblieben[$temp] = $def[$temp];
|
||||
}
|
||||
|
||||
$kaputt = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
$hull = Array();
|
||||
|
||||
$hull[0] = 200 * (1 + $verteidiger_panzerung / 10);
|
||||
$hull[1] = $hull[0];
|
||||
$hull[2] = 800 * (1 + ($verteidiger_panzerung / 10));
|
||||
$hull[3] = 3500 * (1 + ($verteidiger_panzerung / 10));
|
||||
$hull[4] = $hull[2];
|
||||
$hull[5] = 10000 * (1 + ($verteidiger_panzerung / 10));
|
||||
$hull[6] = 2000 * (1 + ($verteidiger_panzerung / 10));
|
||||
$hull[7] = $hull[5];
|
||||
$hull[8] = 1500 * (1 + ($verteidiger_panzerung / 10));
|
||||
|
||||
$metall_cost_tab = Array( 2, 1.5, 6, 20, 2, 50, 10, 50, 12.5, 8);
|
||||
$kristall_cost_tab = Array( 0, 0.5, 2, 15, 6, 50, 10, 50, 2.5, 0);
|
||||
$deut_cost_tab = Array( 0, 0, 0, 2, 0, 30, 0, 0, 10.0, 2);
|
||||
|
||||
$schaden = floor(($def[10] - $def[9]) * (12000 * (1 + ($angreifer_waffen / 10))));
|
||||
if ($schaden < 0)
|
||||
$schaden = 0;
|
||||
|
||||
switch ($primaerziel) {
|
||||
case 0:
|
||||
$beschussreihenfolge = Array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
break;
|
||||
case 1:
|
||||
$beschussreihenfolge = Array(1, 0, 2, 3, 4, 5, 6, 7, 8);
|
||||
break;
|
||||
case 2:
|
||||
$beschussreihenfolge = Array(2, 0, 1, 3, 4, 5, 6, 7, 8);
|
||||
break;
|
||||
case 3:
|
||||
$beschussreihenfolge = Array(3, 0, 1, 2, 4, 5, 6, 7, 8);
|
||||
break;
|
||||
case 4:
|
||||
$beschussreihenfolge = Array(4, 0, 1, 2, 3, 5, 6, 7, 8);
|
||||
break;
|
||||
case 5:
|
||||
$beschussreihenfolge = Array(5, 0, 1, 2, 3, 4, 6, 7, 8);
|
||||
break;
|
||||
case 6:
|
||||
$beschussreihenfolge = Array(6, 0, 1, 2, 3, 4, 5, 7, 8);
|
||||
break;
|
||||
case 7:
|
||||
$beschussreihenfolge = Array(7, 0, 1, 2, 3, 4, 5, 6, 8);
|
||||
break;
|
||||
case 8:
|
||||
$beschussreihenfolge = Array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
break;
|
||||
}
|
||||
// Simulation
|
||||
// das Einfachste: I-Raks und Abfangraks ausrechnen...
|
||||
$verblieben[10] = 0;
|
||||
$kaputt[10] += $def[10];
|
||||
$metall[10] += $kaputt[10] * $metall_cost_tab[8];
|
||||
$kristall[10] += $kaputt[10] * $kristall_cost_tab[8];
|
||||
$deut[10] += $kaputt[10] * $deut_cost_tab[8];
|
||||
|
||||
$verblieben[9] = ($def[9] - $def[10]);
|
||||
if ($verblieben[9] < 0)
|
||||
$verblieben[9] = 0;
|
||||
|
||||
$kaputt[11] = $def[9] - $verblieben[9];
|
||||
$kaputt[9] += ($def[9] - $verblieben[9]);
|
||||
$metall[9] += $kaputt[9] * $metall_cost_tab[9];
|
||||
$kristall[9] += $kaputt[9] * $kristall_cost_tab[9];
|
||||
$deut[9] += $kaputt[9] * $deut_cost_tab[9];
|
||||
$metall[11] += $metall[9];
|
||||
$kristall[11] += $kristall[9];
|
||||
$deut[11] += $deut[9];
|
||||
// und jetzt der Reihe nach alles ABKNALLEN!!!
|
||||
for($temp = 0; $temp < 9; $temp++) {
|
||||
if ($schaden >= ($hull[$beschussreihenfolge[$temp]] * $def[$beschussreihenfolge[$temp]])) {
|
||||
$kaputt[$beschussreihenfolge[$temp]] += $def[$beschussreihenfolge[$temp]];
|
||||
|
||||
$verblieben[$beschussreihenfolge[$temp]] = 0;
|
||||
|
||||
$schaden -= ($hull[$beschussreihenfolge[$temp]] * $kaputt[$beschussreihenfolge[$temp]]);
|
||||
} else {
|
||||
$kaputt[$beschussreihenfolge[$temp]] += floor($schaden / $hull[$beschussreihenfolge[$temp]]);
|
||||
|
||||
$schaden -= $kaputt[$beschussreihenfolge[$temp]] * $hull[$beschussreihenfolge[$temp]];
|
||||
|
||||
$verblieben[$beschussreihenfolge[$temp]] = ($def[$beschussreihenfolge[$temp]] - $kaputt[$beschussreihenfolge[$temp]]);
|
||||
}
|
||||
|
||||
$metall[$beschussreihenfolge[$temp]] += $kaputt[$beschussreihenfolge[$temp]] * $metall_cost_tab[$beschussreihenfolge[$temp]];
|
||||
$kristall[$beschussreihenfolge[$temp]] += $kaputt[$beschussreihenfolge[$temp]] * $kristall_cost_tab[$beschussreihenfolge[$temp]];
|
||||
$deut[$beschussreihenfolge[$temp]] += $kaputt[$beschussreihenfolge[$temp]] * $deut_cost_tab[$beschussreihenfolge[$temp]];
|
||||
|
||||
$verblieben[11] += $verblieben[$beschussreihenfolge[$temp]];
|
||||
$kaputt[11] += $kaputt[$beschussreihenfolge[$temp]];
|
||||
$metall[11] += $metall[$beschussreihenfolge[$temp]];
|
||||
$kristall[11] += $kristall[$beschussreihenfolge[$temp]];
|
||||
$deut[11] += $deut[$beschussreihenfolge[$temp]];
|
||||
}
|
||||
|
||||
$return = array();
|
||||
|
||||
$return['verbleibt'] = $verblieben; // <20>brige Def
|
||||
$return['zerstoert'] = $kaputt; // Zerst<73>rte Def
|
||||
$return['verluste_metall'] = $metall; // Gesamtverluste Metall
|
||||
$return['verluste_kristall'] = $kristall; // Gesamtverluste Kristall
|
||||
$return['verluste_deuterium'] = $deut; // Gesamtverluste Deuterium
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
// 11 => Immer gesamt
|
||||
// Copyright (c) 2007 by -= MoF =- for Deutsches UGamela Forum
|
||||
// Date N/A
|
||||
// Open Source
|
||||
|
||||
?>
|
||||
67
src/includes/strings.php
Normal file
67
src/includes/strings.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
function colorNumber($n, $s = '') {
|
||||
if ($n > 0) {
|
||||
if ($s != '') {
|
||||
$s = colorGreen($s);
|
||||
} else {
|
||||
$s = colorGreen($n);
|
||||
}
|
||||
} elseif ($n < 0) {
|
||||
if ($s != '') {
|
||||
$s = colorRed($s);
|
||||
} else {
|
||||
$s = colorRed($n);
|
||||
}
|
||||
} else {
|
||||
if ($s != '') {
|
||||
$s = $s;
|
||||
} else {
|
||||
$s = $n;
|
||||
}
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
function colorRed($n) {
|
||||
return '<font color="#FF0000">' . $n . '</font>';
|
||||
}
|
||||
|
||||
function colorGreen($n) {
|
||||
return '<font color="#00FF00">' . $n . '</font>';
|
||||
}
|
||||
|
||||
function pretty_number($n, $floor = true) {
|
||||
if ($floor) {
|
||||
$n = floor($n);
|
||||
}
|
||||
return number_format($n, 0, ",", ".");
|
||||
}
|
||||
82
src/includes/todofleetcontrol.php
Normal file
82
src/includes/todofleetcontrol.php
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once ROOT_PATH . 'includes/deprecated.php';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* {{{
|
||||
*/
|
||||
include(ROOT_PATH . 'includes/functions/FlyingFleetHandler.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseAttack.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseStay.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseStayAlly.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseTransport.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseSpy.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseRecycling.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseDestruction.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseColonisation.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MissionCaseExpedition.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/SendSimpleMessage.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/SpyTarget.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/RestoreFleetToPlanet.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/StoreGoodsToPlanet.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/IsTechnologieAccessible.'.PHPEXT); // <- TODO: delete
|
||||
include(ROOT_PATH . 'includes/functions/GetRestPrice.'.PHPEXT); // <- TODO: delete
|
||||
include(ROOT_PATH . 'includes/functions/InsertGalaxyScripts.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyCheckFunctions.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ShowGalaxyRows.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GetPhalanxRange.'.PHPEXT); // <- TODO: delete
|
||||
include(ROOT_PATH . 'includes/functions/GetMissileRange.'.PHPEXT); // <- TODO: delete
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyRowPos.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyRowPlanet.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyRowPlanetName.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyRowMoon.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyRowDebris.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyRowUser.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyRowAlly.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyRowActions.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ShowGalaxySelector.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ShowGalaxyMISelector.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ShowGalaxyTitles.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/GalaxyLegendPopup.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/ShowGalaxyFooter.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MessageForm.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/SendNewPassword.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/IsOfficierAccessible.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/CheckInputStrings.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/MipCombatEngine.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/DeleteSelectedUser.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/SortUserPlanets.'.PHPEXT);
|
||||
include(ROOT_PATH . 'includes/functions/BuildFleetEventTable.'.PHPEXT);
|
||||
/**
|
||||
* }}}
|
||||
*/
|
||||
350
src/includes/unlocalised.php
Normal file
350
src/includes/unlocalised.php
Normal file
|
|
@ -0,0 +1,350 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-Present, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
function GetTargetDistance($OrigGalaxy, $DestGalaxy, $OrigSystem, $DestSystem, $OrigPlanet, $DestPlanet) {
|
||||
$distance = 0;
|
||||
|
||||
if (($OrigGalaxy - $DestGalaxy) != 0) {
|
||||
$distance = abs($OrigGalaxy - $DestGalaxy) * 20000;
|
||||
} elseif (($OrigSystem - $DestSystem) != 0) {
|
||||
$distance = abs($OrigSystem - $DestSystem) * 5 * 19 + 2700;
|
||||
} elseif (($OrigPlanet - $DestPlanet) != 0) {
|
||||
$distance = abs($OrigPlanet - $DestPlanet) * 5 + 1000;
|
||||
} else {
|
||||
$distance = 5;
|
||||
}
|
||||
|
||||
return $distance;
|
||||
}
|
||||
|
||||
// Calcul de la durée de vol d'une flotte par rapport a sa vitesse max
|
||||
function GetMissionDuration ($GameSpeed, $MaxFleetSpeed, $Distance, $SpeedFactor) {
|
||||
$Duration = 0;
|
||||
$Duration = round(((35000 / $GameSpeed * sqrt($Distance * 10 / $MaxFleetSpeed) + 10) / $SpeedFactor));
|
||||
|
||||
return $Duration;
|
||||
}
|
||||
|
||||
// Retourne la valeur ajustée de vitesse des flottes
|
||||
function GetGameSpeedFactor () {
|
||||
return Wootook::getGameConfig('game/speed/fleet') / 2500;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcul de la vitesse de la flotte par rapport aux technos du joueur
|
||||
* Avec prise en compte
|
||||
*/
|
||||
function GetFleetMaxSpeed($FleetArray, $Fleet, $Player) {
|
||||
global $reslist, $pricelist;
|
||||
|
||||
if (!is_array($FleetArray)) {
|
||||
$FleetArray = array();
|
||||
}
|
||||
|
||||
if ($Fleet != 0) {
|
||||
$FleetArray[$Fleet] = 1;
|
||||
}
|
||||
|
||||
$speedalls = array();
|
||||
foreach ($FleetArray as $Ship => $Count) {
|
||||
if ($Ship == Legacies_Empire::ID_SHIP_SOLAR_SATELLITE) {
|
||||
$speedalls[$Ship] = 0;
|
||||
}
|
||||
if ($Ship == Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT) {
|
||||
if ($Player['impulse_motor_tech'] >= 5) {
|
||||
$speedalls[$Ship] = $pricelist[$Ship]['speed2'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2);
|
||||
} else {
|
||||
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['combustion_tech']) * 0.1);
|
||||
}
|
||||
}
|
||||
if ($Ship == Legacies_Empire::ID_SHIP_LARGE_TRANSPORT || $Ship == Legacies_Empire::ID_SHIP_LIGHT_FIGHTER ||
|
||||
$Ship == Legacies_Empire::ID_SHIP_RECYCLER || $Ship == Legacies_Empire::ID_SHIP_SPY_DRONE) {
|
||||
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['combustion_tech']) * 0.1);
|
||||
}
|
||||
if ($Ship == Legacies_Empire::ID_SHIP_HEAVY_FIGHTER || $Ship == Legacies_Empire::ID_SHIP_CRUISER ||
|
||||
$Ship == Legacies_Empire::ID_SHIP_COLONY_SHIP) {
|
||||
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2);
|
||||
}
|
||||
if ($Ship == Legacies_Empire::ID_SHIP_BOMBER) {
|
||||
if ($Player['hyperspace_motor_tech'] >= 8) {
|
||||
$speedalls[$Ship] = $pricelist[$Ship]['speed2'] + (($pricelist[$Ship]['speed'] * $Player['hyperspace_motor_tech']) * 0.3);
|
||||
} else {
|
||||
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['impulse_motor_tech']) * 0.2);
|
||||
}
|
||||
}
|
||||
if ($Ship == Legacies_Empire::ID_SHIP_BATTLESHIP || $Ship == Legacies_Empire::ID_SHIP_DESTRUCTOR ||
|
||||
$Ship == Legacies_Empire::ID_SHIP_DEATH_STAR || $Ship == Legacies_Empire::ID_SHIP_BATTLECRUISER ||
|
||||
$Ship == Legacies_Empire::ID_SHIP_SUPERNOVA) {
|
||||
$speedalls[$Ship] = $pricelist[$Ship]['speed'] + (($pricelist[$Ship]['speed'] * $Player['hyperspace_motor_tech']) * 0.3);
|
||||
}
|
||||
}
|
||||
if ($Fleet != 0 && isset($speedalls[$Ship])) {
|
||||
$ShipSpeed = $speedalls[$Ship];
|
||||
$speedalls = $ShipSpeed;
|
||||
}
|
||||
|
||||
return $speedalls;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// Calcul de la consommation de base d'un vaisseau au regard des technologies
|
||||
function GetShipConsumption ( $Ship, $Player ) {
|
||||
global $pricelist;
|
||||
if ($Player['impulse_motor_tech'] >= 5) {
|
||||
$Consumption = $pricelist[$Ship]['consumption2'];
|
||||
} else {
|
||||
$Consumption = $pricelist[$Ship]['consumption'];
|
||||
}
|
||||
|
||||
return $Consumption;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// Calcul de la consommation de la flotte pour cette mission
|
||||
function GetFleetConsumption ($FleetArray, $SpeedFactor, $MissionDuration, $MissionDistance, $FleetMaxSpeed, $Player) {
|
||||
|
||||
$consumption = 0;
|
||||
$basicConsumption = 0;
|
||||
|
||||
foreach ($FleetArray as $Ship => $Count) {
|
||||
if ($Ship > 0) {
|
||||
$ShipSpeed = GetFleetMaxSpeed ( "", $Ship, $Player );
|
||||
$ShipConsumption = GetShipConsumption ( $Ship, $Player );
|
||||
$spd = 35000 / ($MissionDuration * $SpeedFactor - 10) * sqrt( $MissionDistance * 10 / $ShipSpeed );
|
||||
$basicConsumption = $ShipConsumption * $Count;
|
||||
$consumption += $basicConsumption * $MissionDistance / 35000 * (($spd / 10) + 1) * (($spd / 10) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
$consumption = round($consumption) + 1;
|
||||
|
||||
return $consumption;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Mise en forme de chaines pour affichage
|
||||
//
|
||||
|
||||
// Mise en forme de la durée sous forme xj xxh xxm xxs
|
||||
function pretty_time ($seconds) {
|
||||
$day = floor($seconds / (24 * 3600));
|
||||
$hs = floor($seconds / 3600 % 24);
|
||||
$ms = floor($seconds / 60 % 60);
|
||||
$sr = floor($seconds / 1 % 60);
|
||||
|
||||
if ($hs < 10) { $hh = "0" . $hs; } else { $hh = $hs; }
|
||||
if ($ms < 10) { $mm = "0" . $ms; } else { $mm = $ms; }
|
||||
if ($sr < 10) { $ss = "0" . $sr; } else { $ss = $sr; }
|
||||
|
||||
$time = '';
|
||||
if ($day != 0) { $time .= $day . 'j '; }
|
||||
if ($hs != 0) { $time .= $hh . 'h '; } else { $time .= '00h '; }
|
||||
if ($ms != 0) { $time .= $mm . 'm '; } else { $time .= '00m '; }
|
||||
$time .= $ss . 's';
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
// Mise en forme de la durée sous forme xxxmin
|
||||
function pretty_time_hour ($seconds) {
|
||||
$min = floor($seconds / 60 % 60);
|
||||
|
||||
$time = '';
|
||||
if ($min != 0) { $time .= $min . 'min '; }
|
||||
|
||||
return $time;
|
||||
}
|
||||
|
||||
// Mise en forme du temps de construction (avec la phrase de description)
|
||||
function ShowBuildTime ($time) {
|
||||
global $lang;
|
||||
|
||||
return "<br>". $lang['ConstructionTime'] .": " . pretty_time($time);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
function add_points ($resources, $userid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function remove_points ($resources, $userid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
function get_userdata () {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gestion de la localisation des chaînes
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $extension
|
||||
* @return void
|
||||
*/
|
||||
function includeLang($filename, $extension = 'mo')
|
||||
{
|
||||
global $lang, $user;
|
||||
|
||||
$pathPattern = ROOT_PATH . "language/%s/{$filename}.%s";
|
||||
if (isset($user['lang']) && !empty($user['lang'])) {
|
||||
if (($fp = @fopen($filename = sprintf($pathPattern, $user['lang'], $extension), 'r', false)) !== false) {
|
||||
fclose($fp);
|
||||
|
||||
require_once $filename;
|
||||
return $lang;
|
||||
} else if (($fp = @fopen($filename = sprintf($pathPattern, $user['lang'], 'csv'), 'r', false)) !== false) {
|
||||
while (!feof($fp)) {
|
||||
$line = fgetcsv($fp);
|
||||
if (count($line) == 2 && !empty($line[0])) {
|
||||
$lang[$line[0]] = $line[1];
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
return $lang;
|
||||
}
|
||||
}
|
||||
|
||||
require_once sprintf($pathPattern, DEFAULT_LANG, 'mo');
|
||||
return $lang;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Affiche une adresse de depart sous forme de lien
|
||||
function GetStartAdressLink ( $FleetRow, $FleetType ) {
|
||||
$Link = "<a href=\"galaxy.php?mode=3&galaxy=".$FleetRow['fleet_start_galaxy']."&system=".$FleetRow['fleet_start_system']."\" ". $FleetType ." >";
|
||||
$Link .= "[".$FleetRow['fleet_start_galaxy'].":".$FleetRow['fleet_start_system'].":".$FleetRow['fleet_start_planet']."]</a>";
|
||||
return $Link;
|
||||
}
|
||||
|
||||
// Affiche une adresse de cible sous forme de lien
|
||||
function GetTargetAdressLink ( $FleetRow, $FleetType ) {
|
||||
$Link = "<a href=\"galaxy.php?mode=3&galaxy=".$FleetRow['fleet_end_galaxy']."&system=".$FleetRow['fleet_end_system']."\" ". $FleetType ." >";
|
||||
$Link .= "[".$FleetRow['fleet_end_galaxy'].":".$FleetRow['fleet_end_system'].":".$FleetRow['fleet_end_planet']."]</a>";
|
||||
return $Link;
|
||||
}
|
||||
|
||||
// Affiche une adresse de planete sous forme de lien
|
||||
function BuildPlanetAdressLink ( $CurrentPlanet ) {
|
||||
$Link = "<a href=\"galaxy.php?mode=3&galaxy=".$CurrentPlanet['galaxy']."&system=".$CurrentPlanet['system']."\">";
|
||||
$Link .= "[".$CurrentPlanet['galaxy'].":".$CurrentPlanet['system'].":".$CurrentPlanet['planet']."]</a>";
|
||||
return $Link;
|
||||
}
|
||||
|
||||
// Création d'un lien pour le joueur hostile
|
||||
function BuildHostileFleetPlayerLink ( $FleetRow ) {
|
||||
global $lang, $dpath;
|
||||
|
||||
$PlayerName = doquery ("SELECT `username` FROM {{table}} WHERE `id` = '". $FleetRow['fleet_owner']."';", 'users', true);
|
||||
$Link = $PlayerName['username']. " ";
|
||||
$Link .= "<a href=\"messages.php?mode=write&id=".$FleetRow['fleet_owner']."\">";
|
||||
$Link .= "<img src=\"".$dpath."/img/m.gif\" alt=\"". $lang['ov_message']."\" title=\"". $lang['ov_message']."\" border=\"0\"></a>";
|
||||
return $Link;
|
||||
}
|
||||
|
||||
function GetNextJumpWaitTime ( $CurMoon ) {
|
||||
global $resource;
|
||||
|
||||
$JumpGateLevel = $CurMoon[$resource[43]];
|
||||
$LastJumpTime = $CurMoon['last_jump_time'];
|
||||
if ($JumpGateLevel > 0) {
|
||||
$WaitBetweenJmp = (60 * 60) * (1 / $JumpGateLevel);
|
||||
$NextJumpTime = $LastJumpTime + $WaitBetweenJmp;
|
||||
if ($NextJumpTime >= time()) {
|
||||
$RestWait = $NextJumpTime - time();
|
||||
$RestString = " ". pretty_time($RestWait);
|
||||
} else {
|
||||
$RestWait = 0;
|
||||
$RestString = "";
|
||||
}
|
||||
} else {
|
||||
$RestWait = 0;
|
||||
$RestString = "";
|
||||
}
|
||||
$RetValue['string'] = $RestString;
|
||||
$RetValue['value'] = $RestWait;
|
||||
|
||||
return $RetValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Céation du lien avec popup pour la flotte
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
function CreateFleetPopupedFleetLink ( $FleetRow, $Texte, $FleetType ) {
|
||||
global $lang;
|
||||
|
||||
$FleetRec = explode(";", $FleetRow['fleet_array']);
|
||||
$FleetPopup = "<a href='#' onmouseover=\"return overlib('";
|
||||
$FleetPopup .= "<table width=200>";
|
||||
foreach($FleetRec as $Item => $Group) {
|
||||
if ($Group != '') {
|
||||
$Ship = explode(",", $Group);
|
||||
$FleetPopup .= "<tr><td width=50% align=left><font color=white>". $lang['tech'][$Ship[0]] .":<font></td><td width=50% align=right><font color=white>". pretty_number($Ship[1]) ."<font></td></tr>";
|
||||
}
|
||||
}
|
||||
$FleetPopup .= "</table>";
|
||||
$FleetPopup .= "');\" onmouseout=\"return nd();\" class=\"". $FleetType ."\">". $Texte ."</a>";
|
||||
|
||||
return $FleetPopup;
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
//
|
||||
// Céation du lien avec popup pour le type de mission avec ou non les ressources si disponibles
|
||||
function CreateFleetPopupedMissionLink ( $FleetRow, $Texte, $FleetType ) {
|
||||
global $lang;
|
||||
|
||||
$FleetTotalC = $FleetRow['fleet_resource_metal'] + $FleetRow['fleet_resource_crystal'] + $FleetRow['fleet_resource_deuterium'];
|
||||
if ($FleetTotalC <> 0) {
|
||||
$FRessource = "<table width=200>";
|
||||
$FRessource .= "<tr><td width=50% align=left><font color=white>". $lang['Metal'] ."<font></td><td width=50% align=right><font color=white>". pretty_number($FleetRow['fleet_resource_metal']) ."<font></td></tr>";
|
||||
$FRessource .= "<tr><td width=50% align=left><font color=white>". $lang['Crystal'] ."<font></td><td width=50% align=right><font color=white>". pretty_number($FleetRow['fleet_resource_crystal']) ."<font></td></tr>";
|
||||
$FRessource .= "<tr><td width=50% align=left><font color=white>". $lang['Deuterium'] ."<font></td><td width=50% align=right><font color=white>". pretty_number($FleetRow['fleet_resource_deuterium']) ."<font></td></tr>";
|
||||
$FRessource .= "</table>";
|
||||
} else {
|
||||
$FRessource = "";
|
||||
}
|
||||
|
||||
if ($FRessource <> "") {
|
||||
$MissionPopup = "<a href='#' onmouseover=\"return overlib('". $FRessource ."');";
|
||||
$MissionPopup .= "\" onmouseout=\"return nd();\" class=\"". $FleetType ."\">" . $Texte ."</a>";
|
||||
} else {
|
||||
$MissionPopup = $Texte ."";
|
||||
}
|
||||
|
||||
return $MissionPopup;
|
||||
}
|
||||
59
src/includes/vars.php
Normal file
59
src/includes/vars.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Wootook
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* @see http://wootook.org/
|
||||
*
|
||||
* Copyright (c) 2009-2010, Wootook 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 Wootook.
|
||||
*
|
||||
*/
|
||||
|
||||
if (!defined('ROOT_PATH')) {
|
||||
die('Hacking attempt');
|
||||
}
|
||||
|
||||
// Liste de champs pour l'indication des messages en attante
|
||||
$messfields = array (
|
||||
0 => "mnl_spy",
|
||||
1 => "mnl_joueur",
|
||||
2 => "mnl_alliance",
|
||||
3 => "mnl_attaque",
|
||||
4 => "mnl_exploit",
|
||||
5 => "mnl_transport",
|
||||
15 => "mnl_expedition",
|
||||
97 => "mnl_general",
|
||||
99 => "mnl_buildlist",
|
||||
100 => "new_message"
|
||||
);
|
||||
|
||||
$resource = Wootook_Empire_Model_Game_FieldsAlias::getSingleton();
|
||||
|
||||
$requirements = Wootook_Empire_Model_Game_Requirements::getSingleton();
|
||||
|
||||
$pricelist = Wootook_Empire_Model_Game_Prices::getSingleton();
|
||||
|
||||
$CombatCaps = Wootook_Empire_Model_Game_Combat::getSingleton();
|
||||
|
||||
$ProdGrid = Wootook_Empire_Model_Game_Production::getSingleton();
|
||||
|
||||
$reslist = Wootook_Empire_Model_Game_Types::getSingleton();
|
||||
Loading…
Reference in a new issue