Updated config management

Updated install

Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
Gregory PLANCHAT 2011-12-14 23:45:09 +01:00
commit fcd1f5b740
58 changed files with 1579 additions and 1695 deletions

View file

@ -1,129 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.wootook.com/
*
* 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 $Owner
* @param unknown_type $MoonID
* @param unknown_type $MoonName
* @param unknown_type $Chance
*/
function CreateOneMoonRecord ( $Galaxy, $System, $Planet, $Owner, $MoonID, $MoonName, $Chance ) {
global $lang;
$PlanetName = "";
$QryGetMoonPlanetData = "SELECT * FROM {{table}} ";
$QryGetMoonPlanetData .= "WHERE ";
$QryGetMoonPlanetData .= "`galaxy` = '". $Galaxy ."' AND ";
$QryGetMoonPlanetData .= "`system` = '". $System ."' AND ";
$QryGetMoonPlanetData .= "`planet` = '". $Planet ."';";
$MoonPlanet = doquery ( $QryGetMoonPlanetData, 'planets', true);
$QryGetMoonGalaxyData = "SELECT * FROM {{table}} ";
$QryGetMoonGalaxyData .= "WHERE ";
$QryGetMoonGalaxyData .= "`galaxy` = '". $Galaxy ."' AND ";
$QryGetMoonGalaxyData .= "`system` = '". $System ."' AND ";
$QryGetMoonGalaxyData .= "`planet` = '". $Planet ."';";
$MoonGalaxy = doquery ( $QryGetMoonGalaxyData, 'galaxy', true);
if ($MoonGalaxy['id_luna'] == 0) {
if ($MoonPlanet['id'] != 0) {
$SizeMin = 2000 + ( $Chance * 100 );
$SizeMax = 6000 + ( $Chance * 200 );
$PlanetName = $MoonPlanet['name'];
$maxtemp = $MoonPlanet['temp_max'] - rand(10, 45);
$mintemp = $MoonPlanet['temp_min'] - rand(10, 45);
$size = rand ($SizeMin, $SizeMax);
$QryInsertMoonInLunas = "INSERT INTO {{table}} SET ";
$QryInsertMoonInLunas .= "`name` = '". ( ($MoonName == '') ? $lang['sys_moon'] : $MoonName ) ."', ";
$QryInsertMoonInLunas .= "`galaxy` = '". $Galaxy ."', ";
$QryInsertMoonInLunas .= "`system` = '". $System ."', ";
$QryInsertMoonInLunas .= "`lunapos` = '". $Planet ."', ";
$QryInsertMoonInLunas .= "`id_owner` = '". $Owner ."', ";
$QryInsertMoonInLunas .= "`temp_max` = '". $maxtemp ."', ";
$QryInsertMoonInLunas .= "`temp_min` = '". $mintemp ."', ";
$QryInsertMoonInLunas .= "`diameter` = '". $size ."', ";
$QryInsertMoonInLunas .= "`id_luna` = '". $MoonID ."';";
doquery( $QryInsertMoonInLunas , 'lunas' );
$QryGetMoonIdFromLunas = "SELECT * FROM {{table}} ";
$QryGetMoonIdFromLunas .= "WHERE ";
$QryGetMoonIdFromLunas .= "`galaxy` = '". $Galaxy ."' AND ";
$QryGetMoonIdFromLunas .= "`system` = '". $System ."' AND ";
$QryGetMoonIdFromLunas .= "`lunapos` = '". $Planet ."';";
$lunarow = doquery( $QryGetMoonIdFromLunas , 'lunas', true);
$QryUpdateMoonInGalaxy = "UPDATE {{table}} SET ";
$QryUpdateMoonInGalaxy .= "`id_luna` = '". $lunarow['id'] ."', ";
$QryUpdateMoonInGalaxy .= "`luna` = '0' ";
$QryUpdateMoonInGalaxy .= "WHERE ";
$QryUpdateMoonInGalaxy .= "`galaxy` = '". $Galaxy ."' AND ";
$QryUpdateMoonInGalaxy .= "`system` = '". $System ."' AND ";
$QryUpdateMoonInGalaxy .= "`planet` = '". $Planet ."';";
doquery( $QryUpdateMoonInGalaxy , 'galaxy');
$QryInsertMoonInPlanet = "INSERT INTO {{table}} SET ";
$QryInsertMoonInPlanet .= "`name` = '" .$lang['sys_moon'] ."', ";
$QryInsertMoonInPlanet .= "`id_owner` = '". $Owner ."', ";
$QryInsertMoonInPlanet .= "`galaxy` = '". $Galaxy ."', ";
$QryInsertMoonInPlanet .= "`system` = '". $System ."', ";
$QryInsertMoonInPlanet .= "`planet` = '". $Planet ."', ";
$QryInsertMoonInPlanet .= "`last_update` = '". time() ."', ";
$QryInsertMoonInPlanet .= "`planet_type` = '3', ";
$QryInsertMoonInPlanet .= "`image` = 'mond', ";
$QryInsertMoonInPlanet .= "`diameter` = '". $size ."', ";
$QryInsertMoonInPlanet .= "`field_max` = '1', ";
$QryInsertMoonInPlanet .= "`temp_min` = '". $maxtemp ."', ";
$QryInsertMoonInPlanet .= "`temp_max` = '". $mintemp ."', ";
$QryInsertMoonInPlanet .= "`metal` = '0', ";
$QryInsertMoonInPlanet .= "`metal_perhour` = '0', ";
$QryInsertMoonInPlanet .= "`metal_max` = '".BASE_STORAGE_SIZE."', ";
$QryInsertMoonInPlanet .= "`crystal` = '0', ";
$QryInsertMoonInPlanet .= "`crystal_perhour` = '0', ";
$QryInsertMoonInPlanet .= "`crystal_max` = '".BASE_STORAGE_SIZE."', ";
$QryInsertMoonInPlanet .= "`deuterium` = '0', ";
$QryInsertMoonInPlanet .= "`deuterium_perhour` = '0', ";
$QryInsertMoonInPlanet .= "`deuterium_max` = '".BASE_STORAGE_SIZE."';";
doquery( $QryInsertMoonInPlanet , 'planets');
}
}
return $PlanetName;
}
?>

View file

@ -1,227 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.wootook.com/
*
* 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 $Position
* @param unknown_type $HomeWorld
*/
function PlanetSizeRandomiser ($Position, $HomeWorld = false) {
global $gameConfig;
if (!$HomeWorld) {
$ClassicBase = 163;
$SettingSize = $gameConfig['initial_fields'];
$PlanetRatio = floor ( ($ClassicBase / $SettingSize) * 10000 ) / 100;
$RandomMin = array ( 40, 50, 55, 100, 95, 80, 115, 120, 125, 75, 80, 85, 60, 40, 50);
$RandomMax = array ( 90, 95, 95, 240, 240, 230, 180, 180, 190, 125, 120, 130, 160, 300, 150);
$CalculMin = floor ( $RandomMin[$Position - 1] + ( $RandomMin[$Position - 1] * $PlanetRatio ) / 100 );
$CalculMax = floor ( $RandomMax[$Position - 1] + ( $RandomMax[$Position - 1] * $PlanetRatio ) / 100 );
$RandomSize = mt_rand($CalculMin, $CalculMax);
$MaxAddon = mt_rand(0, 110);
$MinAddon = mt_rand(0, 100);
$Addon = ($MaxAddon - $MinAddon);
$PlanetFields = ($RandomSize + $abweichung);
} else {
$PlanetFields = $gameConfig['initial_fields'];
}
$PlanetSize = ($PlanetFields ^ (14 / 1.5)) * 75;
$return['diameter'] = $PlanetSize;
$return['field_max'] = $PlanetFields;
return $return;
}
/**
*
* @deprecated
* @param unknown_type $Galaxy
* @param unknown_type $System
* @param unknown_type $Position
* @param unknown_type $PlanetOwnerID
* @param unknown_type $PlanetName
* @param unknown_type $HomeWorld
*/
function CreateOnePlanetRecord($Galaxy, $System, $Position, $PlanetOwnerID, $PlanetName = '', $HomeWorld = false) {
global $lang;
// Avant tout, on verifie s'il existe deja une planete a cet endroit
$QrySelectPlanet = "SELECT `id` ";
$QrySelectPlanet .= "FROM {{table}} ";
$QrySelectPlanet .= "WHERE ";
$QrySelectPlanet .= "`galaxy` = '". $Galaxy ."' AND ";
$QrySelectPlanet .= "`system` = '". $System ."' AND ";
$QrySelectPlanet .= "`planet` = '". $Position ."';";
$PlanetExist = doquery( $QrySelectPlanet, 'planets', true);
// Si $PlanetExist est autre chose que false ... c'est qu'il y a quelque chose l<> bas ...
// C'est donc aussi que je ne peux pas m'y poser !!
if (!$PlanetExist) {
$planet = PlanetSizeRandomiser ($Position, $HomeWorld);
$planet['diameter'] = ($planet['field_max'] ^ (14 / 1.5)) * 75 ;
$planet['metal'] = BUILD_METAL;
$planet['crystal'] = BUILD_CRISTAL;
$planet['deuterium'] = BUILD_DEUTERIUM;
$planet['metal_perhour'] = $gameConfig['metal_basic_income'];
$planet['crystal_perhour'] = $gameConfig['crystal_basic_income'];
$planet['deuterium_perhour'] = $gameConfig['deuterium_basic_income'];
$planet['metal_max'] = BASE_STORAGE_SIZE;
$planet['crystal_max'] = BASE_STORAGE_SIZE;
$planet['deuterium_max'] = BASE_STORAGE_SIZE;
// Posistion 1 - 3: 80% entre 40 et 70 Cases ( 55+ / -15 )
// Posistion 4 - 6: 80% entre 120 et 310 Cases ( 215+ / -95 )
// Posistion 7 - 9: 80% entre 105 et 195 Cases ( 150+ / -45 )
// Posistion 10 - 12: 80% entre 75 et 125 Cases ( 100+ / -25 )
// Posistion 13 - 15: 80% entre 60 et 190 Cases ( 125+ / -65 )
$planet['galaxy'] = $Galaxy;
$planet['system'] = $System;
$planet['planet'] = $Position;
if ($Position == 1 || $Position == 2 || $Position == 3) {
$PlanetType = array('trocken');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
$planet['temp_min'] = rand(0, 100);
$planet['temp_max'] = $planet['temp_min'] + 40;
} elseif ($Position == 4 || $Position == 5 || $Position == 6) {
$PlanetType = array('dschjungel');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
$planet['temp_min'] = rand(-25, 75);
$planet['temp_max'] = $planet['temp_min'] + 40;
} elseif ($Position == 7 || $Position == 8 || $Position == 9) {
$PlanetType = array('normaltemp');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07');
$planet['temp_min'] = rand(-50, 50);
$planet['temp_max'] = $planet['temp_min'] + 40;
} elseif ($Position == 10 || $Position == 11 || $Position == 12) {
$PlanetType = array('wasser');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09');
$planet['temp_min'] = rand(-75, 25);
$planet['temp_max'] = $planet['temp_min'] + 40;
} elseif ($Position == 13 || $Position == 14 || $Position == 15) {
$PlanetType = array('eis');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10');
$planet['temp_min'] = rand(-100, 10);
$planet['temp_max'] = $planet['temp_min'] + 40;
} else {
$PlanetType = array('dschjungel', 'gas', 'normaltemp', 'trocken', 'wasser', 'wuesten', 'eis');
$PlanetClass = array('planet');
$PlanetDesign = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '00',);
$planet['temp_min'] = rand(-120, 10);
$planet['temp_max'] = $planet['temp_min'] + 40;
}
$planet['image'] = $PlanetType[ rand( 0, count( $PlanetType ) -1 ) ];
$planet['image'] .= $PlanetClass[ rand( 0, count( $PlanetClass ) - 1 ) ];
$planet['image'] .= $PlanetDesign[ rand( 0, count( $PlanetDesign ) - 1 ) ];
$planet['planet_type'] = 1;
$planet['id_owner'] = $PlanetOwnerID;
$planet['last_update'] = time();
$planet['name'] = ($PlanetName == '') ? $lang['sys_colo_defaultname'] : $PlanetName;
$QryInsertPlanet = "INSERT INTO {{table}} SET ";
$QryInsertPlanet .= "`name` = '". $planet['name'] ."', ";
$QryInsertPlanet .= "`id_owner` = '". $planet['id_owner'] ."', ";
$QryInsertPlanet .= "`galaxy` = '". $planet['galaxy'] ."', ";
$QryInsertPlanet .= "`system` = '". $planet['system'] ."', ";
$QryInsertPlanet .= "`planet` = '". $planet['planet'] ."', ";
$QryInsertPlanet .= "`last_update` = '". $planet['last_update'] ."', ";
$QryInsertPlanet .= "`planet_type` = '". $planet['planet_type'] ."', ";
$QryInsertPlanet .= "`image` = '". $planet['image'] ."', ";
$QryInsertPlanet .= "`diameter` = '". $planet['diameter'] ."', ";
$QryInsertPlanet .= "`field_max` = '". $planet['field_max'] ."', ";
$QryInsertPlanet .= "`temp_min` = '". $planet['temp_min'] ."', ";
$QryInsertPlanet .= "`temp_max` = '". $planet['temp_max'] ."', ";
$QryInsertPlanet .= "`metal` = '". $planet['metal'] ."', ";
$QryInsertPlanet .= "`metal_perhour` = '". $planet['metal_perhour'] ."', ";
$QryInsertPlanet .= "`metal_max` = '". $planet['metal_max'] ."', ";
$QryInsertPlanet .= "`crystal` = '". $planet['crystal'] ."', ";
$QryInsertPlanet .= "`crystal_perhour` = '". $planet['crystal_perhour'] ."', ";
$QryInsertPlanet .= "`crystal_max` = '". $planet['crystal_max'] ."', ";
$QryInsertPlanet .= "`deuterium` = '". $planet['deuterium'] ."', ";
$QryInsertPlanet .= "`deuterium_perhour` = '". $planet['deuterium_perhour'] ."', ";
$QryInsertPlanet .= "`deuterium_max` = '". $planet['deuterium_max'] ."';";
doquery( $QryInsertPlanet, 'planets');
// On recupere l'id de planete nouvellement cr<63><72>
$QrySelectPlanet = "SELECT `id` ";
$QrySelectPlanet .= "FROM {{table}} ";
$QrySelectPlanet .= "WHERE ";
$QrySelectPlanet .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
$QrySelectPlanet .= "`system` = '". $planet['system'] ."' AND ";
$QrySelectPlanet .= "`planet` = '". $planet['planet'] ."' AND ";
$QrySelectPlanet .= "`id_owner` = '". $planet['id_owner'] ."';";
$GetPlanetID = doquery( $QrySelectPlanet , 'planets', true);
// Testons s'il y a deja eu une planete ici
$QrySelectGalaxy = "SELECT * ";
$QrySelectGalaxy .= "FROM {{table}} ";
$QrySelectGalaxy .= "WHERE ";
$QrySelectGalaxy .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
$QrySelectGalaxy .= "`system` = '". $planet['system'] ."' AND ";
$QrySelectGalaxy .= "`planet` = '". $planet['planet'] ."';";
$GetGalaxyID = doquery( $QrySelectGalaxy, 'galaxy', true);
if ($GetGalaxyID) {
// Ah ... Ce secteur de ce vaste monde a deja ete occup<75>
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`id_planet` = '". $GetPlanetID['id'] ."' ";
$QryUpdateGalaxy .= "WHERE ";
$QryUpdateGalaxy .= "`galaxy` = '". $planet['galaxy'] ."' AND ";
$QryUpdateGalaxy .= "`system` = '". $planet['system'] ."' AND ";
$QryUpdateGalaxy .= "`planet` = '". $planet['planet'] ."';";
doquery( $QryUpdateGalaxy, 'galaxy');
} else {
// C'est tout vide ... y a que dalle ... j'm'y pose !!
$QryInsertGalaxy = "INSERT INTO {{table}} SET ";
$QryInsertGalaxy .= "`galaxy` = '". $planet['galaxy'] ."', ";
$QryInsertGalaxy .= "`system` = '". $planet['system'] ."', ";
$QryInsertGalaxy .= "`planet` = '". $planet['planet'] ."', ";
$QryInsertGalaxy .= "`id_planet` = '". $GetPlanetID['id'] ."';";
doquery( $QryInsertGalaxy, 'galaxy');
}
$RetValue = true;
} else {
$RetValue = false;
}
return $RetValue;
}
?>

View file

@ -1,78 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.wootook.com/
*
* 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
* @param unknown_type $Element
* @param unknown_type $Incremental
* @param unknown_type $ForDestroy
*/
function IsElementBuyable ($CurrentUser, $CurrentPlanet, $Element, $Incremental = true, $ForDestroy = false) {
global $pricelist, $resource;
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
if (IsVacationMode($CurrentUser)) {
return false;
}
if ($Incremental) {
$level = ($CurrentPlanet[$resource[$Element]]) ? $CurrentPlanet[$resource[$Element]] : $CurrentUser[$resource[$Element]];
}
$array = array(
Legacies_Empire::RESOURCE_METAL,
Legacies_Empire::RESOURCE_CRISTAL,
Legacies_Empire::RESOURCE_DEUTERIUM,
'energy_max'
);
$cost = array();
foreach ($array as $ResType) {
if ($pricelist[$Element][$ResType] != 0) {
if ($Incremental) {
$cost[$ResType] = bcmul($pricelist[$Element][$ResType], bcpow($pricelist[$Element]['factor'], $level), 0);
} else {
$cost[$ResType] = $pricelist[$Element][$ResType];
}
if ($ForDestroy) {
$cost[$ResType] = bcdiv($cost[$ResType], 2, 0);
}
if (bccomp($cost[$ResType], $CurrentPlanet[$ResType]) > 0) {
return false;
}
}
}
return true;
}

View file

@ -1,59 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.wootook.com/
*
* 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 IsVacationMode($CurrentUser){
global $gameConfig;
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
if($CurrentUser['urlaubs_modus'] == 1){
$query = doquery("SELECT * FROM {{table}} WHERE id_owner = '{$CurrentUser['id']}'", 'planets');
while ($id = $query->fetch(PDO::FETCH_BOTH)){
doquery("UPDATE {{table}} SET
metal_perhour = '".$gameConfig['metal_basic_income']."',
crystal_perhour = '".$gameConfig['crystal_basic_income']."',
deuterium_perhour = '".$gameConfig['deuterium_basic_income']."',
metal_mine_porcent = '0',
crystal_mine_porcent = '0',
deuterium_sintetizer_porcent = '0',
solar_plant_porcent = '0',
fusion_plant_porcent = '0',
solar_satelit_porcent = '0'
WHERE id = '{$id['id']}' AND `planet_type` = '1' ", 'planets');
}
return true;
}
return false;
}
?>

View file

@ -214,8 +214,15 @@ function MissionCaseAttack($FleetRow)
}
if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) {
$targetPlanetName = CreateOneMoonRecord ($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance);
$GottenMoon = sprintf ($lang['sys_moonbuilt'], $targetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$user = Wootook_Empire_Model_User::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 = "";
}

View file

@ -50,7 +50,15 @@ function MissionCaseColonisation ( $FleetRow ) {
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 {
$NewOwnerPlanet = CreateOnePlanetRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $FleetRow['fleet_owner'], $lang['sys_colo_defaultname'], false);
$user = Wootook_Empire_Model_User::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);

View file

@ -35,7 +35,7 @@
*/
function MissionCaseDestruction($FleetRow)
{
global $user, $pricelist, $lang, $resource, $CombatCaps, $gameConfig;
global $user, $pricelist, $lang, $resource, $CombatCaps;
includeLang('system');
@ -156,7 +156,7 @@ function MissionCaseDestruction($FleetRow)
$gravitonPower = 1 + pow(1 - $gravitonLevel, 2);
$rawChances = pow(sqrt(1 / floatval($TargetPlanet['diameter'])) * $destructionPower * $gravitonPower, 2);
$chances = (1 - (1 / ((2500 / floatval($gameConfig['game_speed'])) * pow(1 + $rawChances, 2)))) * .5;
$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));
@ -252,266 +252,143 @@ function MissionCaseDestruction($FleetRow)
$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) {
$TargetPlanetName = CreateOneMoonRecord ( $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance );
$GottenMoon = sprintf ($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
$user = Wootook_Empire_Model_User::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"]));

View file

@ -1,78 +0,0 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.wootook.com/
*
* 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 ResetThisFuckingCheater ( $UserID ) {
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
$TheUser = doquery ("SELECT * FROM {{table}} WHERE `id` = '". $UserID ."';", 'users', true);
$UserPlanet = doquery ("SELECT `name` FROM {{table}} WHERE `id` = '". $TheUser['id_planet']."';", 'planets', true);
DeleteSelectedUser ( $UserID );
if ($UserPlanet['name'] != "") {
// Creation de l'utilisateur
$QryInsertUser = "INSERT INTO {{table}} SET ";
$QryInsertUser .= "`id` = '". $TheUser['id'] ."', ";
$QryInsertUser .= "`username` = '". $TheUser['username'] ."', ";
$QryInsertUser .= "`email` = '". $TheUser['email'] ."', ";
$QryInsertUser .= "`email_2` = '". $TheUser['email_2'] ."', ";
$QryInsertUser .= "`sex` = '". $TheUser['sex'] ."', ";
$QryInsertUser .= "`id_planet` = '0', ";
$QryInsertUser .= "`authlevel` = '". $TheUser['authlevel'] ."', ";
$QryInsertUser .= "`dpath` = '". $TheUser['dpath'] ."', ";
$QryInsertUser .= "`galaxy` = '". $TheUser['galaxy'] ."', ";
$QryInsertUser .= "`system` = '". $TheUser['system'] ."', ";
$QryInsertUser .= "`planet` = '". $TheUser['planet'] ."', ";
$QryInsertUser .= "`register_time` = '". $TheUser['register_time'] ."', ";
$QryInsertUser .= "`password` = '". $TheUser['password'] ."';";
doquery( $QryInsertUser, 'users');
// On cherche le numero d'enregistrement de l'utilisateur fraichement cr??
$NewUser = doquery("SELECT `id` FROM {{table}} WHERE `username` = '". $TheUser['username'] ."' LIMIT 1;", 'users', true);
CreateOnePlanetRecord ($TheUser['galaxy'], $TheUser['system'], $TheUser['planet'], $NewUser['id'], $UserPlanet['name'], true);
// Recherche de la reference de la nouvelle planete (qui est unique normalement !
$PlanetID = doquery("SELECT `id` FROM {{table}} WHERE `id_owner` = '". $NewUser['id'] ."' LIMIT 1;", 'planets', true);
// Mise a jour de l'enregistrement utilisateur avec les infos de sa planete mere
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`id_planet` = '". $PlanetID['id'] ."', ";
$QryUpdateUser .= "`current_planet` = '". $PlanetID['id'] ."' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '". $NewUser['id'] ."';";
doquery( $QryUpdateUser, 'users');
}
return;
}
?>