Updated config management
Updated install Signed-off-by: Gregory PLANCHAT <g.planchat@gmail.com>
This commit is contained in:
parent
4bb4693d2e
commit
fcd1f5b740
58 changed files with 1579 additions and 1695 deletions
|
|
@ -33,16 +33,15 @@ define('INSTALL' , false);
|
||||||
define('IN_ADMIN', true);
|
define('IN_ADMIN', true);
|
||||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||||
|
|
||||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
|
if (in_array($user['authlevel'], array(LEVEL_ADMIN))) {
|
||||||
$lang['PHP_SELF'] = 'options.'.PHPEXT;
|
doquery("UPDATE {{table}} SET `banaday` =` banaday` - '1' WHERE `banaday` != '0';",'users');
|
||||||
doquery("UPDATE {{table}} SET `banaday` =` banaday` - '1' WHERE `banaday` != '0';",'users');
|
doquery("UPDATE {{table}} SET `bana` = '0' WHERE `banaday` < '1';",'users');
|
||||||
doquery("UPDATE {{table}} SET `bana` = '0' WHERE `banaday` < '1';",'users');
|
|
||||||
$parse = $gameConfig;
|
|
||||||
$parse['dpath'] = $dpath;
|
|
||||||
$parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":'';
|
|
||||||
} else {
|
|
||||||
message ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
$response = Wootook::getResponse()
|
||||||
|
->setRedirect(Wootook::getUrl('admin/overview.php'))
|
||||||
|
->sendHeaders();
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
message ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,66 +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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
define('IN_ADMIN', true);
|
|
||||||
|
|
||||||
function mass_message_run($parent){
|
|
||||||
if($_POST["mode"] == "change"){
|
|
||||||
if(isset($_POST["tresc"])&& $_POST["tresc"] != ''){
|
|
||||||
$gameConfig['tresc'] = $parent->safe_get_post_var("tresc");
|
|
||||||
}
|
|
||||||
if(isset($_POST["temat"])&& $_POST["temat"] != ''){
|
|
||||||
$gameConfig['temat'] = $parent->safe_get_post_var("temat");
|
|
||||||
}
|
|
||||||
$kolor = 'red';
|
|
||||||
if($gameConfig['tresc'] !='' and $gameConfig['temat']){
|
|
||||||
$sq = $parent->db->query("SELECT `id` FROM {{table}}","users");
|
|
||||||
while($u = $parent->db->fetch_assoc($sq)){
|
|
||||||
doquery("INSERT INTO {{table}} SET
|
|
||||||
`message_owner`='{$u['id']}',
|
|
||||||
`message_sender`='1' ,
|
|
||||||
`message_time`='".time()."',
|
|
||||||
`message_type`='0',
|
|
||||||
`message_from`='<font color=\"$kolor\">Administracja</font>',
|
|
||||||
`message_subject`='<font color=\"$kolor\">{$gameConfig['temat']}</font>',
|
|
||||||
`message_text`='<font color=\"$kolor\"><b>{$gameConfig['tresc']}</b></font>'
|
|
||||||
","messages");
|
|
||||||
$parent->db->query("UPDATE {{table}} SET new_message=new_message+1 WHERE id='{$u['id']}'",'users');
|
|
||||||
}
|
|
||||||
$parent->smarty->assign("message","<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$parent->smarty->display("mass_message.tpl");
|
|
||||||
}
|
|
||||||
|
|
||||||
function mass_message_info(){
|
|
||||||
return array("name" => "Send MassMessages","description"=>"Sends messagess to all players","default_weight"=>"0");
|
|
||||||
}
|
|
||||||
|
|
@ -31,45 +31,45 @@
|
||||||
define('INSIDE' , true);
|
define('INSIDE' , true);
|
||||||
define('INSTALL' , false);
|
define('INSTALL' , false);
|
||||||
define('IN_ADMIN', true);
|
define('IN_ADMIN', true);
|
||||||
|
|
||||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||||
|
|
||||||
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
if (in_array($user['authlevel'], array(LEVEL_ADMIN, LEVEL_OPERATOR, LEVEL_MODERATOR))) {
|
||||||
if ($_POST && $mode == "change") {
|
if (!empty($_POST)) {
|
||||||
if (isset($_POST["tresc"]) && $_POST["tresc"] != '') {
|
if (isset($_POST["tresc"]) && $_POST["tresc"] != '') {
|
||||||
$gameConfig['tresc'] = $_POST['tresc'];
|
$tresc = $_POST['tresc'];
|
||||||
|
}
|
||||||
|
if (isset($_POST["temat"]) && $_POST["temat"] != '') {
|
||||||
|
$temat = $_POST['temat'];
|
||||||
|
}
|
||||||
|
if ($user['authlevel'] == LEVEL_ADMIN) {
|
||||||
|
$kolor = 'red';
|
||||||
|
$ranga = 'Administrator';
|
||||||
|
} elseif ($user['authlevel'] == LEVEL_OPERATOR) {
|
||||||
|
$kolor = 'skyblue';
|
||||||
|
$ranga = 'Operator';
|
||||||
|
} elseif ($user['authlevel'] == LEVEL_MODERATOR) {
|
||||||
|
$kolor = 'yellow';
|
||||||
|
$ranga = 'Moderator';
|
||||||
|
}
|
||||||
|
if (isset($tresc) && isset($temat)) {
|
||||||
|
$sq = doquery("SELECT `id` FROM {{table}}", "users");
|
||||||
|
$Time = time();
|
||||||
|
$From = "<font color=\"". $kolor ."\">". $ranga ." ".$user['username']."</font>";
|
||||||
|
$Subject = "<font color=\"". $kolor ."\">". $temat ."</font>";
|
||||||
|
$Message = "<font color=\"". $kolor ."\"><b>". $tresc ."</b></font>";
|
||||||
|
while ($u = $sq->fetch(PDO::FETCH_BOTH)) {
|
||||||
|
SendSimpleMessage($u['id'], $user['id'], $Time, 97, $From, $Subject, $Message);
|
||||||
}
|
}
|
||||||
if (isset($_POST["temat"]) && $_POST["temat"] != '') {
|
message("<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>", "Complete", "../overview." . PHPEXT, 3);
|
||||||
$gameConfig['temat'] = $_POST['temat'];
|
|
||||||
}
|
|
||||||
if ($user['authlevel'] == LEVEL_ADMIN) {
|
|
||||||
$kolor = 'red';
|
|
||||||
$ranga = 'Administrator';
|
|
||||||
} elseif ($user['authlevel'] == LEVEL_OPERATOR) {
|
|
||||||
$kolor = 'skyblue';
|
|
||||||
$ranga = 'Operator';
|
|
||||||
} elseif ($user['authlevel'] == LEVEL_MODERATOR) {
|
|
||||||
$kolor = 'yellow';
|
|
||||||
$ranga = 'Moderator';
|
|
||||||
}
|
|
||||||
if ($gameConfig['tresc'] != '' and $gameConfig['temat']) {
|
|
||||||
$sq = doquery("SELECT `id` FROM {{table}}", "users");
|
|
||||||
$Time = time();
|
|
||||||
$From = "<font color=\"". $kolor ."\">". $ranga ." ".$user['username']."</font>";
|
|
||||||
$Subject = "<font color=\"". $kolor ."\">". $gameConfig['temat'] ."</font>";
|
|
||||||
$Message = "<font color=\"". $kolor ."\"><b>". $gameConfig['tresc'] ."</b></font>";
|
|
||||||
while ($u = $sq->fetch(PDO::FETCH_BOTH)) {
|
|
||||||
SendSimpleMessage ( $u['id'], $user['id'], $Time, 97, $From, $Subject, $Message);
|
|
||||||
}
|
|
||||||
message("<font color=\"lime\">Wys<79>a<EFBFBD>e<EFBFBD> wiadomo<6D><6F> do wszystkich graczy</font>", "Complete", "../overview." . PHPEXT, 3);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$parse = $gameConfig;
|
|
||||||
$parse['dpath'] = $dpath;
|
|
||||||
$parse['debug'] = ($gameConfig['debug'] == 1) ? " checked='checked'/":'';
|
|
||||||
$page .= parsetemplate(gettemplate('admin/messall_body'), $parse);
|
|
||||||
display($page, '', false,'', true);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
message($lang['sys_noalloaw'], $lang['sys_noaccess']);
|
$parse = array();
|
||||||
|
$parse['dpath'] = $dpath;
|
||||||
|
$parse['debug'] = (defined('DEBUG')) ? " checked='checked'/":'';
|
||||||
|
$page .= parsetemplate(gettemplate('admin/messall_body'), $parse);
|
||||||
|
display($page, '', false,'', true);
|
||||||
}
|
}
|
||||||
?>
|
} else {
|
||||||
|
message($lang['sys_noalloaw'], $lang['sys_noaccess']);
|
||||||
|
}
|
||||||
|
|
@ -34,8 +34,8 @@ define('IN_ADMIN', true);
|
||||||
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
require_once dirname(dirname(__FILE__)) .'/application/bootstrap.php';
|
||||||
|
|
||||||
|
|
||||||
function DisplayGameSettingsPage ( $CurrentUser ) {
|
function DisplayGameSettingsPage($CurrentUser) {
|
||||||
global $lang, $gameConfig;
|
global $lang;
|
||||||
|
|
||||||
includeLang('admin/settings');
|
includeLang('admin/settings');
|
||||||
|
|
||||||
|
|
@ -43,208 +43,197 @@ function DisplayGameSettingsPage ( $CurrentUser ) {
|
||||||
if (isset($_POST['opt_save']) && $_POST['opt_save'] == "1") {
|
if (isset($_POST['opt_save']) && $_POST['opt_save'] == "1") {
|
||||||
// Jeu Ouvert ou Ferm<72> !
|
// Jeu Ouvert ou Ferm<72> !
|
||||||
if (isset($_POST['closed']) && $_POST['closed'] == 'on') {
|
if (isset($_POST['closed']) && $_POST['closed'] == 'on') {
|
||||||
$gameConfig['game_disable'] = "1";
|
Wootook::setConfig('game/general/active', true, 1, 1);
|
||||||
$gameConfig['close_reason'] = addslashes( $_POST['close_reason'] );
|
|
||||||
} else {
|
} else {
|
||||||
$gameConfig['game_disable'] = "0";
|
Wootook::setConfig('game/general/active', false, 1, 1);
|
||||||
$gameConfig['close_reason'] = "";
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['close_reason'])) {
|
||||||
|
Wootook::setConfig('game/general/closing-message', $_POST['close_reason'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Y a un News Frame ? !
|
// Y a un News Frame ? !
|
||||||
if (isset($_POST['newsframe']) && $_POST['newsframe'] == 'on') {
|
if (isset($_POST['newsframe']) && $_POST['newsframe'] == 'on') {
|
||||||
$gameConfig['OverviewNewsFrame'] = "1";
|
Wootook::setConfig('game/news/active', true, 1, 1);
|
||||||
$gameConfig['OverviewNewsText'] = addslashes( $_POST['NewsText'] );
|
|
||||||
} else {
|
} else {
|
||||||
$gameConfig['OverviewNewsFrame'] = "0";
|
Wootook::setConfig('game/news/active', false, 1, 1);
|
||||||
$gameConfig['OverviewNewsText'] = "";
|
}
|
||||||
|
|
||||||
|
if (isset($_POST['NewsText'])) {
|
||||||
|
Wootook::setConfig('game/news/content', $_POST['NewsText'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Y a un TCHAT externe ??
|
// Y a un TCHAT externe ??
|
||||||
if (isset($_POST['chatframe']) && $_POST['chatframe'] == 'on') {
|
if (isset($_POST['chatframe']) && $_POST['chatframe'] == 'on') {
|
||||||
$gameConfig['OverviewExternChat'] = "1";
|
Wootook::setConfig('engine/options/chat', true, 1, 1);
|
||||||
$gameConfig['OverviewExternChatCmd'] = addslashes( $_POST['ExternChat'] );
|
|
||||||
} else {
|
} else {
|
||||||
$gameConfig['OverviewExternChat'] = "0";
|
Wootook::setConfig('engine/options/chat', false, 1, 1);
|
||||||
$gameConfig['OverviewExternChatCmd'] = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_POST['googlead']) && $_POST['googlead'] == 'on') {
|
if (isset($_POST['ga']) && $_POST['ga'] == 'on') {
|
||||||
$gameConfig['OverviewBanner'] = "1";
|
Wootook::setConfig('engine/options/ga', true, 1, 1);
|
||||||
$gameConfig['OverviewClickBanner'] = addslashes( $_POST['GoogleAds'] );
|
|
||||||
} else {
|
} else {
|
||||||
$gameConfig['OverviewBanner'] = "0";
|
Wootook::setConfig('engine/options/ga', false, 1, 1);
|
||||||
$gameConfig['OverviewClickBanner'] = "";
|
}
|
||||||
|
if (isset($_POST['ga_id']) && !empty($_POST['ga_id'])) {
|
||||||
|
Wootook::setConfig('engine/options/ga-id', $_POST['ga_id'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Y a un BANNER Frame ?
|
// Y a un BANNER Frame ?
|
||||||
if (isset($_POST['bannerframe']) && $_POST['bannerframe'] == 'on') {
|
if (isset($_POST['bannerframe']) && $_POST['bannerframe'] == 'on') {
|
||||||
$gameConfig['ForumBannerFrame'] = "1";
|
Wootook::setConfig('engine/options/banner', true, 1, 1);
|
||||||
} else {
|
} else {
|
||||||
$gameConfig['ForumBannerFrame'] = "0";
|
Wootook::setConfig('engine/options/banner', false, 1, 1);
|
||||||
}
|
|
||||||
|
|
||||||
// Mode Debug ou pas !
|
|
||||||
if (isset($_POST['debug']) && $_POST['debug'] == 'on') {
|
|
||||||
$gameConfig['debug'] = "1";
|
|
||||||
} else {
|
|
||||||
$gameConfig['debug'] = "0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nom du Jeu
|
// Nom du Jeu
|
||||||
if (isset($_POST['game_name']) && $_POST['game_name'] != '') {
|
if (isset($_POST['game_name']) && !empty($_POST['game_name'])) {
|
||||||
$gameConfig['game_name'] = $_POST['game_name'];
|
Wootook::setConfig('game/general/name', $_POST['game_name'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adresse du Forum
|
// Adresse du Forum
|
||||||
if (isset($_POST['forum_url']) && $_POST['forum_url'] != '') {
|
if (isset($_POST['forum_url']) && !empty($_POST['forum_url'])) {
|
||||||
$gameConfig['forum_url'] = $_POST['forum_url'];
|
Wootook::setConfig('game/general/boards-url', $_POST['forum_url'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vitesse du Jeu
|
// Vitesse du Jeu
|
||||||
if (isset($_POST['game_speed']) && is_numeric($_POST['game_speed'])) {
|
if (isset($_POST['game_speed']) && is_numeric($_POST['game_speed'])) {
|
||||||
$gameConfig['game_speed'] = $_POST['game_speed'];
|
Wootook::setConfig('game/speed/general', $_POST['game_speed'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vitesse des Flottes
|
// Vitesse des Flottes
|
||||||
if (isset($_POST['fleet_speed']) && is_numeric($_POST['fleet_speed'])) {
|
if (isset($_POST['fleet_speed']) && is_numeric($_POST['fleet_speed'])) {
|
||||||
$gameConfig['fleet_speed'] = $_POST['fleet_speed'];
|
Wootook::setConfig('game/speed/fleet', $_POST['fleet_speed'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiplicateur de Production
|
// Multiplicateur de Production
|
||||||
if (isset($_POST['resource_multiplier']) && is_numeric($_POST['resource_multiplier'])) {
|
if (isset($_POST['resource_multiplier']) && is_numeric($_POST['resource_multiplier'])) {
|
||||||
$gameConfig['resource_multiplier'] = $_POST['resource_multiplier'];
|
Wootook::setConfig('game/resource/multiplier', $_POST['resource_multiplier'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Taille de la planete mère
|
// Taille de la planete mère
|
||||||
if (isset($_POST['initial_fields']) && is_numeric($_POST['initial_fields'])) {
|
if (isset($_POST['initial_fields']) && is_numeric($_POST['initial_fields'])) {
|
||||||
$gameConfig['initial_fields'] = $_POST['initial_fields'];
|
Wootook::setConfig('resource/initial/fields', $_POST['initial_fields'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Revenu de base Metal
|
// Revenu de base Metal
|
||||||
if (isset($_POST['metal_basic_income']) && is_numeric($_POST['metal_basic_income'])) {
|
if (isset($_POST['metal_basic_income']) && is_numeric($_POST['metal_basic_income'])) {
|
||||||
$gameConfig['metal_basic_income'] = $_POST['metal_basic_income'];
|
Wootook::setConfig('resource/initial/metal', $_POST['metal_basic_income'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Revenu de base Cristal
|
// Revenu de base Cristal
|
||||||
if (isset($_POST['crystal_basic_income']) && is_numeric($_POST['crystal_basic_income'])) {
|
if (isset($_POST['crystal_basic_income']) && is_numeric($_POST['crystal_basic_income'])) {
|
||||||
$gameConfig['crystal_basic_income'] = $_POST['crystal_basic_income'];
|
Wootook::setConfig('resource/initial/cristal', $_POST['crystal_basic_income'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Revenu de base Deuterium
|
// Revenu de base Deuterium
|
||||||
if (isset($_POST['deuterium_basic_income']) && is_numeric($_POST['deuterium_basic_income'])) {
|
if (isset($_POST['deuterium_basic_income']) && is_numeric($_POST['deuterium_basic_income'])) {
|
||||||
$gameConfig['deuterium_basic_income'] = $_POST['deuterium_basic_income'];
|
Wootook::setConfig('resource/initial/deuterium', $_POST['deuterium_basic_income'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Revenu de base Energie
|
// Revenu de base Energie
|
||||||
if (isset($_POST['energy_basic_income']) && is_numeric($_POST['energy_basic_income'])) {
|
if (isset($_POST['energy_basic_income']) && is_numeric($_POST['energy_basic_income'])) {
|
||||||
$gameConfig['energy_basic_income'] = $_POST['energy_basic_income'];
|
Wootook::setConfig('resource/initial/energy', $_POST['energy_basic_income'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lien supplémentaire dans le menu
|
// Lien supplémentaire dans le menu
|
||||||
if (isset($_POST['enable_link_']) && is_numeric($_POST['enable_link_'])) {
|
if (isset($_POST['url_link_']) && is_numeric($_POST['url_link_'])) {
|
||||||
$gameConfig['link_enable'] = $_POST['enable_link_'];
|
Wootook::setConfig('game/general/boards-url', $_POST['url_link_'], 1, 1);
|
||||||
}
|
}
|
||||||
// Texte de ce lien...
|
|
||||||
$gameConfig['link_name'] = addslashes( $_POST['name_link_']);
|
|
||||||
|
|
||||||
// URL de ce lien...
|
|
||||||
$gameConfig['link_url'] = $_POST['url_link_'];
|
|
||||||
// Image de la bannière
|
// Image de la bannière
|
||||||
$gameConfig['banner_source_post'] = $_POST['banner_source_post'];
|
if (isset($_POST['banner_source_post'])) {
|
||||||
|
Wootook::setConfig('engine/options/banner', $_POST['banner_source_post'], 1, 1);
|
||||||
|
}
|
||||||
// 1 point = ??? Ressources ?
|
// 1 point = ??? Ressources ?
|
||||||
if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings'])) {
|
if (isset($_POST['stat_settings']) && is_numeric($_POST['stat_settings'])) {
|
||||||
$gameConfig['stat_settings'] = $_POST['stat_settings'];
|
Wootook::setConfig('game/resource/multiplier', $_POST['stat_settings'], 1, 1);
|
||||||
}
|
}
|
||||||
// Activation -ou non- des annonces
|
// Activation -ou non- des annonces
|
||||||
if (isset($_POST['enable_announces_']) && is_numeric($_POST['enable_announces_'])) {
|
if (isset($_POST['enable_announces_']) && is_numeric($_POST['enable_announces_'])) {
|
||||||
$gameConfig['enable_announces'] = $_POST['enable_announces_'];
|
Wootook::setConfig('engine/options/announces', $_POST['enable_announces_'], 1, 1);
|
||||||
}
|
}
|
||||||
// Activation -ou non- du marchand
|
// Activation -ou non- du marchand
|
||||||
if (isset($_POST['enable_marchand_']) && is_numeric($_POST['enable_marchand_'])) {
|
if (isset($_POST['enable_marchand_']) && is_numeric($_POST['enable_marchand_'])) {
|
||||||
$gameConfig['enable_marchand'] = $_POST['enable_marchand_'];
|
Wootook::setConfig('engine/options/retailer', $_POST['enable_marchand_'], 1, 1);
|
||||||
}
|
}
|
||||||
// Activation -ou non- des notes
|
// Activation -ou non- des notes
|
||||||
if (isset($_POST['enable_notes_']) && is_numeric($_POST['enable_notes_'])) {
|
if (isset($_POST['enable_notes_']) && is_numeric($_POST['enable_notes_'])) {
|
||||||
$gameConfig['enable_notes'] = $_POST['enable_notes_'];
|
Wootook::setConfig('engine/options/notes', $_POST['enable_notes_'], 1, 1);
|
||||||
}
|
}
|
||||||
// Nom du bot antimulti
|
// Nom du bot antimulti
|
||||||
$gameConfig['bot_name'] = addslashes( $_POST['name_bot']);
|
if (isset($_POST['name_bot'])) {
|
||||||
|
Wootook::setConfig('engine/bot/name', $_POST['name_bot'], 1, 1);
|
||||||
// email du bot antimulti
|
}
|
||||||
$gameConfig['bot_adress'] = addslashes( $_POST['adress_bot']);
|
// email du bot antimulti
|
||||||
|
if (isset($_POST['adress_bot'])) {
|
||||||
// Activation -ou non- des notes
|
Wootook::setConfig('engine/bot/email', $_POST['adress_bot'], 1, 1);
|
||||||
if (isset($_POST['duration_ban']) && is_numeric($_POST['duration_ban'])) {
|
|
||||||
$gameConfig['ban_duration'] = $_POST['duration_ban'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activation -ou non- du bot
|
// Activation -ou non- des notes
|
||||||
if (isset($_POST['bot_enable']) && is_numeric($_POST['bot_enable'])) {
|
if (isset($_POST['duration_ban']) && is_numeric($_POST['duration_ban'])) {
|
||||||
$gameConfig['enable_bot'] = $_POST['bot_enable'];
|
Wootook::setConfig('engine/ban/duration', $_POST['duration_ban'], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// BBCode ou pas ?
|
// Activation -ou non- du bot
|
||||||
|
if (isset($_POST['bot_enable']) && is_numeric($_POST['bot_enable'])) {
|
||||||
if (isset($_POST['bbcode_field']) && is_numeric($_POST['bbcode_field'])) {
|
Wootook::setConfig('engine/bot/active', $_POST['bot_enable'], 1, 1);
|
||||||
$gameConfig['enable_bbcode'] = $_POST['bbcode_field'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$gameConfig->save();
|
// BBCode ou pas ?
|
||||||
|
if (isset($_POST['bbcode_field']) && is_numeric($_POST['bbcode_field'])) {
|
||||||
|
Wootook::setConfig('engine/options/bbcode', $_POST['bbcode_field'], 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
AdminMessage ('Options changees avec succes !', 'Succes', '?');
|
AdminMessage('Options changees avec succes !', 'Succes', '?');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$parse = $lang;
|
$parse = $lang;
|
||||||
$parse['game_name'] = $gameConfig['game_name'];
|
$parse['game_name'] = Wootook::getGameConfig('game/general/name');
|
||||||
$parse['game_speed'] = $gameConfig['game_speed'];
|
$parse['game_speed'] = Wootook::getGameConfig('game/speed/general');
|
||||||
$parse['fleet_speed'] = $gameConfig['fleet_speed'];
|
$parse['fleet_speed'] = Wootook::getGameConfig('game/speed/fleet');
|
||||||
$parse['resource_multiplier'] = $gameConfig['resource_multiplier'];
|
$parse['resource_multiplier'] = Wootook::getGameConfig('game/resource/multiplier');
|
||||||
$parse['forum_url'] = $gameConfig['forum_url'];
|
$parse['forum_url'] = Wootook::getGameConfig('game/general/boards-url');
|
||||||
$parse['initial_fields'] = $gameConfig['initial_fields'];
|
$parse['initial_fields'] = Wootook::getGameConfig('resource/initial/fields');
|
||||||
$parse['metal_basic_income'] = $gameConfig['metal_basic_income'];
|
$parse['metal_basic_income'] = Wootook::getGameConfig('resource/initial/metal');
|
||||||
$parse['crystal_basic_income'] = $gameConfig['crystal_basic_income'];
|
$parse['crystal_basic_income'] = Wootook::getGameConfig('resource/initial/cristal');
|
||||||
$parse['deuterium_basic_income'] = $gameConfig['deuterium_basic_income'];
|
$parse['deuterium_basic_income'] = Wootook::getGameConfig('resource/initial/deuterium');
|
||||||
$parse['energy_basic_income'] = $gameConfig['energy_basic_income'];
|
$parse['energy_basic_income'] = Wootook::getGameConfig('resource/initial/energy');
|
||||||
$parse['enable_link'] = $gameConfig['link_enable'];
|
$parse['enable_link'] = $gameConfig['link_enable'];
|
||||||
$parse['name_link'] = $gameConfig['link_name'];
|
$parse['name_link'] = Wootook::getGameConfig('game/general/extra-url-title');
|
||||||
$parse['url_link'] = $gameConfig['link_url'];
|
$parse['url_link'] = Wootook::getGameConfig('game/general/extra-url');
|
||||||
$parse['enable_announces'] = $gameConfig['enable_announces'];
|
$parse['enable_announces'] = Wootook::getGameConfig('engine/options/announces');
|
||||||
$parse['enable_marchand'] = $gameConfig['enable_marchand'];
|
$parse['enable_marchand'] = Wootook::getGameConfig('engine/options/retailer');
|
||||||
$parse['enable_notes'] = $gameConfig['enable_notes'];
|
$parse['enable_notes'] = Wootook::getGameConfig('engine/options/notes');
|
||||||
$parse['bot_name'] = stripslashes($gameConfig['bot_name']);
|
$parse['bot_name'] = Wootook::getGameConfig('engine/bot/name');
|
||||||
$parse['bot_adress'] = stripslashes($gameConfig['bot_adress']);
|
$parse['bot_adress'] = Wootook::getGameConfig('engine/bot/email');
|
||||||
$parse['ban_duration'] = stripslashes($gameConfig['ban_duration']);
|
$parse['ban_duration'] = Wootook::getGameConfig('engine/ban/duration');
|
||||||
$parse['enable_bot'] = stripslashes($gameConfig['enable_bot']);
|
$parse['enable_bot'] = Wootook::getGameConfig('engine/bot/active');
|
||||||
$parse['enable_bbcode'] = stripslashes($gameConfig['enable_bbcode']);
|
$parse['enable_bbcode'] = Wootook::getGameConfig('engine/options/bbcode');
|
||||||
|
|
||||||
$parse['banner_source_post'] = $gameConfig['banner_source_post'];
|
$parse['banner_source_post'] = Wootook::getGameConfig('engine/options/banner');
|
||||||
$parse['stat_settings'] = stripslashes($gameConfig['stat_settings']);
|
$parse['stat_settings'] = Wootook::getGameConfig('game/resource/multiplier');
|
||||||
|
|
||||||
|
$parse['closed'] = (!Wootook::getGameConfig('game/general/active')) ? " checked = 'checked' ":"";
|
||||||
|
$parse['close_reason'] = Wootook::getGameConfig('game/general/closing-message');
|
||||||
|
|
||||||
|
$parse['newsframe'] = (Wootook::getGameConfig('game/news/active')) ? " checked = 'checked' ":"";
|
||||||
$parse['closed'] = ($gameConfig['game_disable'] == 1) ? " checked = 'checked' ":"";
|
$parse['NewsTextVal'] = Wootook::getGameConfig('game/news/content');
|
||||||
$parse['close_reason'] = stripslashes( $gameConfig['close_reason'] );
|
|
||||||
|
|
||||||
$parse['newsframe'] = ($gameConfig['OverviewNewsFrame'] == 1) ? " checked = 'checked' ":"";
|
|
||||||
$parse['NewsTextVal'] = stripslashes( $gameConfig['OverviewNewsText'] );
|
|
||||||
|
|
||||||
$parse['chatframe'] = ($gameConfig['OverviewExternChat'] == 1) ? " checked = 'checked' ":"";
|
$parse['chatframe'] = ($gameConfig['OverviewExternChat'] == 1) ? " checked = 'checked' ":"";
|
||||||
$parse['ExtTchatVal'] = stripslashes( $gameConfig['OverviewExternChatCmd'] );
|
$parse['ExtTchatVal'] = stripslashes( $gameConfig['OverviewExternChatCmd'] );
|
||||||
|
|
||||||
$parse['googlead'] = ($gameConfig['OverviewBanner'] == 1) ? " checked = 'checked' ":"";
|
$parse['ga'] = (Wootook::getGameConfig('engine/options/ga')) ? " checked = 'checked' ":"";
|
||||||
$parse['GoogleAdVal'] = stripslashes( $gameConfig['OverviewClickBanner'] );
|
$parse['ga_id'] = Wootook::getGameConfig('engine/options/ga-id');
|
||||||
|
|
||||||
$parse['debug'] = ($gameConfig['debug'] == 1) ? " checked = 'checked' ":"";
|
|
||||||
|
|
||||||
$parse['bannerframe'] = ($gameConfig['ForumBannerFrame'] == 1) ? " checked = 'checked' ":"";
|
$parse['bannerframe'] = ($gameConfig['ForumBannerFrame'] == 1) ? " checked = 'checked' ":"";
|
||||||
|
|
||||||
$PageTPL = gettemplate('admin/options_body');
|
$PageTPL = gettemplate('admin/options_body');
|
||||||
$Page = parsetemplate( $PageTPL, $parse );
|
$Page = parsetemplate($PageTPL, $parse);
|
||||||
|
|
||||||
display ( $Page, $lang['adm_opt_title'], false, '', true );
|
display($Page, $lang['adm_opt_title'], false, '', true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AdminMessage ( $lang['sys_noalloaw'], $lang['sys_noaccess'] );
|
AdminMessage($lang['sys_noalloaw'], $lang['sys_noaccess']);
|
||||||
}
|
}
|
||||||
return $Page;
|
return $Page;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,8 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
||||||
|
|
||||||
$GameUsers = doquery("SELECT * FROM {{table}} WHERE authlevel<3", 'users');
|
$GameUsers = doquery("SELECT * FROM {{table}} WHERE authlevel<3", 'users');
|
||||||
|
|
||||||
|
$resourceMultiplier = Wootook::getGameConfig('game/resource/multiplier');
|
||||||
|
|
||||||
while ($CurUser = $GameUsers->fetch(PDO::FETCH_ASSOC)) {
|
while ($CurUser = $GameUsers->fetch(PDO::FETCH_ASSOC)) {
|
||||||
// Recuperation des anciennes statistiques
|
// Recuperation des anciennes statistiques
|
||||||
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';", 'statpoints', true);
|
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';", 'statpoints', true);
|
||||||
|
|
@ -69,7 +71,7 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
||||||
// Total des unitées consommée pour la recherche
|
// Total des unitées consommée pour la recherche
|
||||||
$Points = GetTechnoPoints ( $CurUser );
|
$Points = GetTechnoPoints ( $CurUser );
|
||||||
$TTechCount = $Points['TechCount'];
|
$TTechCount = $Points['TechCount'];
|
||||||
$TTechPoints = ($Points['TechPoint'] / $gameConfig['stat_settings']);
|
$TTechPoints = ($Points['TechPoint'] / $resourceMultiplier);
|
||||||
|
|
||||||
// Totalisation des points accumulés par planete
|
// Totalisation des points accumulés par planete
|
||||||
$TBuildCount = 0;
|
$TBuildCount = 0;
|
||||||
|
|
@ -85,20 +87,20 @@ if (strtolower(substr(PHP_SAPI, 0, 3)) == 'cli' || in_array($user['authlevel'],
|
||||||
$Points = GetBuildPoints ( $CurPlanet );
|
$Points = GetBuildPoints ( $CurPlanet );
|
||||||
$TBuildCount += $Points['BuildCount'];
|
$TBuildCount += $Points['BuildCount'];
|
||||||
$GCount += $Points['BuildCount'];
|
$GCount += $Points['BuildCount'];
|
||||||
$PlanetPoints = ($Points['BuildPoint'] / $gameConfig['stat_settings']);
|
$PlanetPoints = ($Points['BuildPoint'] / $resourceMultiplier);
|
||||||
$TBuildPoints += ($Points['BuildPoint'] / $gameConfig['stat_settings']);
|
$TBuildPoints += ($Points['BuildPoint'] / $resourceMultiplier);
|
||||||
|
|
||||||
$Points = GetDefensePoints ( $CurPlanet );
|
$Points = GetDefensePoints ( $CurPlanet );
|
||||||
$TDefsCount += $Points['DefenseCount'];;
|
$TDefsCount += $Points['DefenseCount'];;
|
||||||
$GCount += $Points['DefenseCount'];
|
$GCount += $Points['DefenseCount'];
|
||||||
$PlanetPoints += ($Points['DefensePoint'] / $gameConfig['stat_settings']);
|
$PlanetPoints += ($Points['DefensePoint'] / $resourceMultiplier);
|
||||||
$TDefsPoints += ($Points['DefensePoint'] / $gameConfig['stat_settings']);
|
$TDefsPoints += ($Points['DefensePoint'] / $resourceMultiplier);
|
||||||
|
|
||||||
$Points = GetFleetPoints ( $CurPlanet );
|
$Points = GetFleetPoints ( $CurPlanet );
|
||||||
$TFleetCount += $Points['FleetCount'];
|
$TFleetCount += $Points['FleetCount'];
|
||||||
$GCount += $Points['FleetCount'];
|
$GCount += $Points['FleetCount'];
|
||||||
$PlanetPoints += ($Points['FleetPoint'] / $gameConfig['stat_settings']);
|
$PlanetPoints += ($Points['FleetPoint'] / $resourceMultiplier);
|
||||||
$TFleetPoints += ($Points['FleetPoint'] / $gameConfig['stat_settings']);
|
$TFleetPoints += ($Points['FleetPoint'] / $resourceMultiplier);
|
||||||
|
|
||||||
$GPoints += $PlanetPoints;
|
$GPoints += $PlanetPoints;
|
||||||
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
$QryUpdatePlanet = "UPDATE {{table}} SET ";
|
||||||
|
|
|
||||||
|
|
@ -100,9 +100,9 @@ include(ROOT_PATH . 'includes/strings.' . PHPEXT);
|
||||||
|
|
||||||
if (!defined('IN_INSTALL')) {
|
if (!defined('IN_INSTALL')) {
|
||||||
|
|
||||||
$gameConfig = Wootook_Core_Model_Config::getSingleton();
|
$cookieName = Wootook::getGameConfig('web/cookie/name');
|
||||||
if (isset($gameConfig['cookie_name']) && !empty($gameConfig['cookie_name'])) {
|
if ($cookieName !== null) {
|
||||||
Wootook_Empire_Model_User::setCookieName($gameConfig['cookie_name']);
|
Wootook_Empire_Model_User::setCookieName($cookieName);
|
||||||
}
|
}
|
||||||
$user = Wootook_Empire_Model_User::getSingleton();
|
$user = Wootook_Empire_Model_User::getSingleton();
|
||||||
|
|
||||||
|
|
@ -112,8 +112,15 @@ if (!defined('IN_INSTALL')) {
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gameConfig->isEnabled() && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) {
|
if (Wootook::getGameConfig('game/general/active') && $user !== null && !in_array($user->getData('authlevel'), array(LEVEL_ADMIN, LEVEL_MODERATOR, LEVEL_OPERATOR))) {
|
||||||
message(stripslashes($gameConfig->getData('close_reason')), $gameConfig->getData('game_name'));
|
$layout = new Wootook_Core_Layout();
|
||||||
|
$layout->load('message');
|
||||||
|
|
||||||
|
$block = $layout->getBlock('message');
|
||||||
|
$block['title'] = Wootook::__('Game is disabled.');
|
||||||
|
$block['message'] = Wootook::getGameConfig('game/general/closing-message');
|
||||||
|
|
||||||
|
echo $layout->render();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,13 +108,12 @@ class Legacies_Empire_Model_Planet_Building_ResearchLab_Builder
|
||||||
{
|
{
|
||||||
$prices = Wootook_Empire_Model_Game_Prices::getSingleton();
|
$prices = Wootook_Empire_Model_Game_Prices::getSingleton();
|
||||||
$types = Wootook_Empire_Model_Game_Types::getSingleton();
|
$types = Wootook_Empire_Model_Game_Types::getSingleton();
|
||||||
$gameConfig = Wootook_Core_Model_Config::getSingleton();
|
|
||||||
|
|
||||||
Math::setPrecision(50);
|
Math::setPrecision(50);
|
||||||
|
|
||||||
// FIXME: Resource dependency
|
// FIXME: Resource dependency
|
||||||
$totalCost = Math::mul(Math::add($prices[$technologyId][Legacies_Empire::RESOURCE_METAL], $prices[$technologyId][Legacies_Empire::RESOURCE_CRISTAL]), $level);
|
$totalCost = Math::mul(Math::add($prices[$technologyId][Legacies_Empire::RESOURCE_METAL], $prices[$technologyId][Legacies_Empire::RESOURCE_CRISTAL]), $level);
|
||||||
$speedFactor = $gameConfig->getData('game_speed');
|
$speedFactor = Wootook::getGameConfig('game/speed/general');
|
||||||
|
|
||||||
// FIXME: Building & Technology dependency
|
// FIXME: Building & Technology dependency
|
||||||
$extraLaboratoriesLevels = 0;
|
$extraLaboratoriesLevels = 0;
|
||||||
|
|
|
||||||
|
|
@ -185,12 +185,11 @@ class Legacies_Empire_Model_Planet_Building_Shipyard_Builder
|
||||||
public function getBuildingTime($shipId, $qty)
|
public function getBuildingTime($shipId, $qty)
|
||||||
{
|
{
|
||||||
$prices = Wootook_Empire_Model_Game_Prices::getSingleton();
|
$prices = Wootook_Empire_Model_Game_Prices::getSingleton();
|
||||||
$gameConfig = Wootook_Core_Model_Config::getSingleton();
|
|
||||||
|
|
||||||
Math::setPrecision(50);
|
Math::setPrecision(50);
|
||||||
$buildingTime = Math::mul($prices[$shipId][Legacies_Empire::BASE_BUILDING_TIME], $qty);
|
$buildingTime = Math::mul($prices[$shipId][Legacies_Empire::BASE_BUILDING_TIME], $qty);
|
||||||
|
|
||||||
$speedFactor = $gameConfig->getData('game_speed');
|
$speedFactor = Wootook::getGameConfig('game/speed/general');
|
||||||
$baseTime = Math::div($buildingTime, $speedFactor);
|
$baseTime = Math::div($buildingTime, $speedFactor);
|
||||||
|
|
||||||
Math::setPrecision();
|
Math::setPrecision();
|
||||||
|
|
|
||||||
|
|
@ -130,71 +130,206 @@ SQL_EOF;
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('config')} (
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_website')} (
|
||||||
`config_name` VARCHAR(64) NOT NULL,
|
`website_id` TINYINT UNSIGNED NOT NULL,
|
||||||
`config_value` TEXT NOT NULL,
|
`code` VARCHAR(64) NOT NULL,
|
||||||
UNIQUE KEY (`config_name`)
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`sort_order` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`default_group_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`is_default` BOOL NOT NULL,
|
||||||
|
`is_staging` BOOL NOT NULL,
|
||||||
|
`is_active` BOOL NOT NULL,
|
||||||
|
PRIMARY KEY (`webste_id`),
|
||||||
|
UNIQUE (`code`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
INSERT IGNORE INTO {$this->getTableName('config')} (`config_name`, `config_value`) VALUES
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game_group')} (
|
||||||
-- ('game/1/resource/income/base/metal', '20'),
|
`group_id` TINYINT UNSIGNED NOT NULL,
|
||||||
-- ('game/1/resource/income/base/cristal', '10'),
|
`website_id` TINYINT UNSIGNED NOT NULL,
|
||||||
-- ('game/1/resource/income/base/deuterium', '0'),
|
`code` VARCHAR(64) NOT NULL,
|
||||||
-- ('game/1/resource/income/base/energy', '0'),
|
`name` VARCHAR(255) NOT NULL,
|
||||||
-- ('game/1/resource/multiplier', '1000'),
|
`sort_order` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`is_default` BOOL NOT NULL,
|
||||||
|
PRIMARY KEY (`group_id`),
|
||||||
|
INDEX (`webste_id`),
|
||||||
|
UNIQUE (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
-- ('game/1/speed/general', '2500'),
|
$this->query($sql);
|
||||||
-- ('game/1/speed/fleet', '2500'),
|
|
||||||
|
|
||||||
('game_speed', '2500'),
|
$sql = <<<SQL_EOF
|
||||||
('fleet_speed', '2500'),
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_game')} (
|
||||||
('resource_multiplier', '1000'),
|
`game_id` SMALLINT UNSIGNED NOT NULL,
|
||||||
|
`group_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`website_id` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`code` VARCHAR(64) NOT NULL,
|
||||||
|
`name` VARCHAR(255) NOT NULL,
|
||||||
|
`sort_order` TINYINT UNSIGNED NOT NULL,
|
||||||
|
`is_default` BOOL NOT NULL,
|
||||||
|
`is_staging` BOOL NOT NULL,
|
||||||
|
`is_active` BOOL NOT NULL,
|
||||||
|
PRIMARY KEY (`group_id`),
|
||||||
|
INDEX (`webste_id`),
|
||||||
|
UNIQUE (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
('metal_basic_income', '20'),
|
$this->query($sql);
|
||||||
('cristal_basic_income', '10'),
|
|
||||||
('deuterium_basic_income', '0'),
|
|
||||||
('energy_basic_income', '0'),
|
|
||||||
|
|
||||||
('Fleet_Cdr', '30'),
|
$sql = <<<SQL_EOF
|
||||||
('Defs_Cdr', '30'),
|
INSERT INTO {$this->getTableName('core_website')} (`website_id`, `code`, `name`, `sort_order`, `default_group_id`, `is_default`, `is_staging`, `is_active`)
|
||||||
('initial_fields', '5000'),
|
VALUES
|
||||||
('COOKIE_NAME', 'wootook'),
|
(0, "admin", "Administration", 0, 0, 0, 0, 1),
|
||||||
('game_name', 'Wootook'),
|
(1, "default", "Default Website", 1, 1, 1, 0, 1);
|
||||||
('game_disable', '1'),
|
SQL_EOF;
|
||||||
('close_reason', 'Le jeu est clos pour le moment!'),
|
|
||||||
('BuildLabWhileRun', '0'),
|
$this->query($sql);
|
||||||
('urlaubs_modus_erz', '1'),
|
|
||||||
('noobprotection', '1'),
|
$sql = <<<SQL_EOF
|
||||||
('noobprotectiontime', '5000'),
|
INSERT INTO {$this->getTableName('core_game_group')} (`group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`)
|
||||||
('noobprotectionmulti', '5'),
|
VALUES
|
||||||
('forum_url', 'http://board.xnova-ng.org/'),
|
(0, 0, "admin", "Administration", 0, 0),
|
||||||
('OverviewNewsFrame', '1'),
|
(1, 1, "default", "Default Group", 1, 1);
|
||||||
('OverviewNewsTEXT', 'Bienvenue sur le nouveau serveur Wootook'),
|
SQL_EOF;
|
||||||
('OverviewExternChat', '0'),
|
|
||||||
('OverviewExternChatCmd', ''),
|
$this->query($sql);
|
||||||
('OverviewBanner', '0'),
|
|
||||||
('OverviewClickBanner', ''),
|
$sql = <<<SQL_EOF
|
||||||
('ExtCopyFrame', '0'),
|
INSERT INTO {$this->getTableName('core_game')} (`game_id`, `group_id`, `website_id`, `code`, `name`, `sort_order`, `is_default`, `is_staging`, `is_active`)
|
||||||
('ExtCopyOwner', ''),
|
VALUES
|
||||||
('ExtCopyFunct', ''),
|
(0, 0, 0, "admin", "Administration", 0, 0, 0, 1),
|
||||||
('ForumBannerFrame', '0'),
|
(1, 1, 1, "default", "Default Game", 1, 1, 0, 1);
|
||||||
('stat_settings', '1000'),
|
SQL_EOF;
|
||||||
('link_enable', '0'),
|
|
||||||
('link_name', ''),
|
$this->query($sql);
|
||||||
('link_url', ''),
|
|
||||||
('enable_announces', '1'),
|
$sql = <<<SQL_EOF
|
||||||
('enable_marchand', '1'),
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('core_config')} (
|
||||||
('enable_notes', '1'),
|
`website_id` TINYINT UNSIGNED NOT NULL,
|
||||||
('bot_name', 'XNoviana Reali'),
|
`game_id` TINYINT UNSIGNED NOT NULL,
|
||||||
('bot_adress', 'contact@wootook.org'),
|
`config_path` VARCHAR(64) NOT NULL,
|
||||||
('banner_source_post', '../images/bann.png'),
|
`config_value` VARCHAR(255) NOT NULL,
|
||||||
('ban_duration', '30'),
|
PRIMARY KEY (`website_id`, `game_id`, `config_path`),
|
||||||
('enable_bot', '0'),
|
INDEX (`website_id`),
|
||||||
('enable_bbcode', '1');
|
INDEX (`game_id`),
|
||||||
|
INDEX (`config_path`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
INSERT IGNORE INTO {$this->getTableName('core_config')} (`webste_id`, `game_id`, `config_path`, `config_value`) VALUES
|
||||||
|
(1, 1, 'resource/base-income/metal', '20'),
|
||||||
|
(1, 1, 'resource/base-income/cristal', '10'),
|
||||||
|
(1, 1, 'resource/base-income/deuterium', '0'),
|
||||||
|
(1, 1, 'resource/base-income/energy', '0'),
|
||||||
|
|
||||||
|
(1, 1, 'resource/initial/fields', '163'),
|
||||||
|
(1, 1, 'resource/initial/metal', '500'),
|
||||||
|
(1, 1, 'resource/initial/cristal', '500'),
|
||||||
|
(1, 1, 'resource/initial/deuterium', '0'),
|
||||||
|
(1, 1, 'resource/initial/energy', '0'),
|
||||||
|
|
||||||
|
(1, 1, 'game/general/name', 'Wootook'),
|
||||||
|
(1, 1, 'game/general/boards-url', 'http://wootook.org/board/'),
|
||||||
|
(1, 1, 'game/general/extra-url-title', 'Wootook!'),
|
||||||
|
(1, 1, 'game/general/extra-url', 'http://wootook.org/'),
|
||||||
|
(1, 1, 'game/general/active', '1'),
|
||||||
|
(1, 1, 'game/general/closing-message', 'Le jeu est clos pour le moment.'),
|
||||||
|
(1, 1, 'game/general/locale', 'fr_FR'),
|
||||||
|
|
||||||
|
(1, 1, 'game/resource/multiplier', '1000'),
|
||||||
|
(1, 1, 'game/speed/general', '2500'),
|
||||||
|
(1, 1, 'game/speed/fleet', '2500'),
|
||||||
|
|
||||||
|
(1, 1, 'game/debris/metal-percent', '30'),
|
||||||
|
(1, 1, 'game/debris/cristal-percent', '30'),
|
||||||
|
(1, 1, 'game/debris/deuterium-percent', '0'),
|
||||||
|
(1, 1, 'game/debris/energy-percent', '0'),
|
||||||
|
|
||||||
|
(1, 1, 'game/debris/fleet', '1'),
|
||||||
|
(1, 1, 'game/debris/defense', '0'),
|
||||||
|
|
||||||
|
(1, 1, 'game/noob-protection/active', '0'),
|
||||||
|
(1, 1, 'game/noob-protection/points-cap', '5000'),
|
||||||
|
(1, 1, 'game/noob-protection/multiplier', '5'),
|
||||||
|
|
||||||
|
(0, 0, 'web/cookie/name', '__wtk'),
|
||||||
|
(0, 0, 'web/cookie/time', '2592000'),
|
||||||
|
(0, 0, 'web/cookie/domain', ''),
|
||||||
|
(0, 0, 'web/cookie/path', ''),
|
||||||
|
|
||||||
|
(0, 0, 'engine/options/bbcode', '1'),
|
||||||
|
(0, 0, 'engine/options/ga', '1'),
|
||||||
|
(0, 0, 'engine/options/announces', '0'),
|
||||||
|
(0, 0, 'engine/options/retailer', '0'),
|
||||||
|
(0, 0, 'engine/options/notes', '0'),
|
||||||
|
(0, 0, 'engine/options/chat', '0'),
|
||||||
|
(0, 0, 'engine/options/banner', '0'),
|
||||||
|
(0, 0, 'engine/options/vacation-min-time', '172800'),
|
||||||
|
|
||||||
|
(0, 0, 'game/news/active', '0'),
|
||||||
|
(0, 0, 'game/news/content', 'Bienvenue sur le nouveau serveur de jeu Wootook!'),
|
||||||
|
|
||||||
|
(0, 0, 'engine/ban/duration', '86400'),
|
||||||
|
|
||||||
|
(0, 0, 'engine/bot/active', '0'),
|
||||||
|
(0, 0, 'engine/bot/name', 'Woot'),
|
||||||
|
(0, 0, 'engine/bot/email', 'contact@wootook.org'),
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- (0, 0, 'game_speed', '2500'),
|
||||||
|
-- (0, 0, 'fleet_speed', '2500'),
|
||||||
|
-- (0, 0, 'resource_multiplier', '1000'),
|
||||||
|
|
||||||
|
-- (0, 0, 'metal_basic_income', '20'),
|
||||||
|
-- (0, 0, 'cristal_basic_income', '10'),
|
||||||
|
-- (0, 0, 'deuterium_basic_income', '0'),
|
||||||
|
-- (0, 0, 'energy_basic_income', '0'),
|
||||||
|
|
||||||
|
-- (0, 0, 'Fleet_Cdr', '30'),
|
||||||
|
-- (0, 0, 'Defs_Cdr', '30'),
|
||||||
|
-- (0, 0, 'initial_fields', '5000'),
|
||||||
|
-- (0, 0, 'COOKIE_NAME', 'wootook'),
|
||||||
|
-- (0, 0, 'game_name', 'Wootook'),
|
||||||
|
-- (0, 0, 'game_disable', '1'),
|
||||||
|
-- (0, 0, 'close_reason', 'Le jeu est clos pour le moment.'),
|
||||||
|
(0, 0, 'BuildLabWhileRun', '0'),
|
||||||
|
-- (0, 0, 'urlaubs_modus_erz', '1'),
|
||||||
|
-- (0, 0, 'noobprotection', '1'),
|
||||||
|
-- (0, 0, 'noobprotectiontime', '5000'),
|
||||||
|
-- (0, 0, 'noobprotectionmulti', '5'),
|
||||||
|
-- (0, 0, 'forum_url', 'http://wootook.org/board/'),
|
||||||
|
-- (0, 0, 'OverviewNewsFrame', '1'),
|
||||||
|
-- (0, 0, 'OverviewNewsTEXT', 'Bienvenue sur le nouveau serveur Wootook'),
|
||||||
|
-- (0, 0, 'OverviewExternChat', '0'),
|
||||||
|
-- (0, 0, 'OverviewExternChatCmd', ''),
|
||||||
|
-- (0, 0, 'OverviewBanner', '0'),
|
||||||
|
-- (0, 0, 'OverviewClickBanner', ''),
|
||||||
|
(0, 0, 'ExtCopyFrame', '0'),
|
||||||
|
(0, 0, 'ExtCopyOwner', ''),
|
||||||
|
(0, 0, 'ExtCopyFunct', ''),
|
||||||
|
-- (0, 0, 'ForumBannerFrame', '0'),
|
||||||
|
-- (0, 0, 'stat_settings', '1000'),
|
||||||
|
-- (0, 0, 'link_enable', '0'),
|
||||||
|
-- (0, 0, 'link_name', ''),
|
||||||
|
-- (0, 0, 'link_url', ''),
|
||||||
|
-- (0, 0, 'enable_announces', '1'),
|
||||||
|
-- (0, 0, 'enable_marchand', '1'),
|
||||||
|
-- (0, 0, 'enable_notes', '1'),
|
||||||
|
-- (0, 0, 'bot_name', 'Isaac'),
|
||||||
|
-- (0, 0, 'bot_adress', 'contact@wootook.org'),
|
||||||
|
-- (0, 0, 'banner_source_post', '../images/bann.png'),
|
||||||
|
-- (0, 0, 'ban_duration', '30'),
|
||||||
|
-- (0, 0, 'enable_bot', '0'),
|
||||||
|
-- (0, 0, 'enable_bbcode', '1');
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
@ -259,7 +394,7 @@ $this->query($sql);
|
||||||
|
|
||||||
$sql = <<<SQL_EOF
|
$sql = <<<SQL_EOF
|
||||||
CREATE TABLE IF NOT EXISTS {$this->getTableName('galaxy')} (
|
CREATE TABLE IF NOT EXISTS {$this->getTableName('galaxy')} (
|
||||||
`galaxy` TINYINT UNSIGNED NOT NULL,
|
`galaxy` SMALLINT UNSIGNED NOT NULL,
|
||||||
`system` SMALLINT UNSIGNED NOT NULL,
|
`system` SMALLINT UNSIGNED NOT NULL,
|
||||||
`planet` TINYINT UNSIGNED NOT NULL,
|
`planet` TINYINT UNSIGNED NOT NULL,
|
||||||
`id_planet` BIGINT UNSIGNED NOT NULL,
|
`id_planet` BIGINT UNSIGNED NOT NULL,
|
||||||
|
|
@ -617,3 +752,320 @@ SQL_EOF;
|
||||||
|
|
||||||
$this->query($sql);
|
$this->query($sql);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Galaxy positions generation
|
||||||
|
*/
|
||||||
|
$galaxyCount = Wootook::getConfig('default/engine/universe/galaxies');
|
||||||
|
$systemCount = Wootook::getConfig('default/engine/universe/systems');
|
||||||
|
|
||||||
|
$sql = <<<SQL_EOF
|
||||||
|
INSERT INTO {$this->getTableName('galaxy')}
|
||||||
|
(`galaxy`, `system`, `planet`, `id_planet`, `metal`, `crystal`, `id_luna`, `luna`)
|
||||||
|
SELECT
|
||||||
|
_increment.galaxy AS `galaxy`,
|
||||||
|
_increment.system AS `system`,
|
||||||
|
0 AS `planet`,
|
||||||
|
0 AS `id_planet`,
|
||||||
|
0 AS `metal`,
|
||||||
|
0 AS `crystal`,
|
||||||
|
0 AS `id_luna`,
|
||||||
|
0 AS `luna`
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
(1 + _galaxy_10e0.galaxy + _galaxy_10e1.galaxy + _galaxy_10e2.galaxy + _galaxy_10e3.galaxy + _galaxy_10e4.galaxy) AS galaxy,
|
||||||
|
(1 + _system_10e0.system + _system_10e1.system + _system_10e2.system + _system_10e3.system + _system_10e4.system) AS system
|
||||||
|
FROM (
|
||||||
|
SELECT 0 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 1 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 4 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 5 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 6 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 7 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 8 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 9 AS system
|
||||||
|
) AS _system_10e0
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
if ($systemCount > 10) {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 10 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 20 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 30 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 40 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 50 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 60 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 70 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 80 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 90 AS system
|
||||||
|
) AS _system_10e1
|
||||||
|
SQL_EOF;
|
||||||
|
} else {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (SELECT 0 AS system) AS _system_10e1
|
||||||
|
SQL_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($systemCount > 100) {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 100 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 200 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 300 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 400 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 500 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 600 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 700 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 800 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 900 AS system
|
||||||
|
) AS _system_10e2
|
||||||
|
SQL_EOF;
|
||||||
|
} else {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (SELECT 0 AS system) AS _system_10e2
|
||||||
|
SQL_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($systemCount > 1000) {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 1000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 4000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 5000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 6000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 7000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 8000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 9000 AS system
|
||||||
|
) AS _system_10e3
|
||||||
|
SQL_EOF;
|
||||||
|
} else {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (SELECT 0 AS system) AS _system_10e3
|
||||||
|
SQL_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($systemCount > 10000) {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 10000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 20000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 30000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 40000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 50000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 60000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 70000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 80000 AS system
|
||||||
|
UNION ALL
|
||||||
|
SELECT 90000 AS system
|
||||||
|
) AS _system_10e4
|
||||||
|
SQL_EOF;
|
||||||
|
} else {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (SELECT 0 AS system) AS _system_10e4
|
||||||
|
SQL_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 1 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 4 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 5 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 6 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 7 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 8 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 9 AS galaxy
|
||||||
|
) AS _galaxy_10e0
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
if ($systemCount > 10) {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 10 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 20 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 30 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 40 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 50 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 60 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 70 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 80 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 90 AS galaxy
|
||||||
|
) AS _galaxy_10e1
|
||||||
|
SQL_EOF;
|
||||||
|
} else {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (SELECT 0 AS galaxy) AS _galaxy_10e1
|
||||||
|
SQL_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($systemCount > 100) {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 100 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 200 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 300 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 400 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 500 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 600 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 700 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 800 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 900 AS galaxy
|
||||||
|
) AS _galaxy_10e2
|
||||||
|
SQL_EOF;
|
||||||
|
} else {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (SELECT 0 AS galaxy) AS _galaxy_10e2
|
||||||
|
SQL_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($systemCount > 1000) {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 1000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 2000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 3000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 4000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 5000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 6000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 7000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 8000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 9000 AS galaxy
|
||||||
|
) AS _galaxy_10e3
|
||||||
|
SQL_EOF;
|
||||||
|
} else {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (SELECT 0 AS galaxy) AS _galaxy_10e3
|
||||||
|
SQL_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($systemCount > 10000) {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (
|
||||||
|
SELECT 0 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 10000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 20000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 30000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 40000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 50000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 60000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 70000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 80000 AS galaxy
|
||||||
|
UNION ALL
|
||||||
|
SELECT 90000 AS galaxy
|
||||||
|
) AS _galaxy_10e4
|
||||||
|
SQL_EOF;
|
||||||
|
} else {
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
CROSS JOIN (SELECT 0 AS galaxy) AS _galaxy_10e4
|
||||||
|
SQL_EOF;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= <<<SQL_EOF
|
||||||
|
) _increment
|
||||||
|
|
||||||
|
WHERE _increment.galaxy<={$galaxyCount}
|
||||||
|
AND _increment.system<={$systemCount}
|
||||||
|
SQL_EOF;
|
||||||
|
|
||||||
|
$this->query($sql);
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,31 @@ class Wootook
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Enter description here ...
|
* Enter description here ...
|
||||||
* @var array
|
* @var Wootook_Core_Config_Adapter_Abstract
|
||||||
*/
|
*/
|
||||||
protected static $_config = null;
|
protected static $_config = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter description here ...
|
||||||
|
* @var Wootook_Core_Config_Adapter_Abstract
|
||||||
|
*/
|
||||||
|
protected static $_globalConfig = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter description here ...
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $_websiteConfigs = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Enter description here ...
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected static $_gameConfigs = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an event listener to be called later in the application.
|
* Registers an event listener to be called later in the application.
|
||||||
*
|
*
|
||||||
|
|
@ -179,7 +200,7 @@ class Wootook
|
||||||
|
|
||||||
public static function getLocale()
|
public static function getLocale()
|
||||||
{
|
{
|
||||||
$availableLocales = self::getConfig('global/locales');
|
$availableLocales = self::$_config->getConfig('global/locales');
|
||||||
|
|
||||||
return self::getPreferredLocale($availableLocales);
|
return self::getPreferredLocale($availableLocales);
|
||||||
}
|
}
|
||||||
|
|
@ -287,68 +308,172 @@ class Wootook
|
||||||
self::$_response = $response;
|
self::$_response = $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function loadConfig()
|
public static function loadConfig($filename = null)
|
||||||
{
|
{
|
||||||
self::$_config = include ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php';
|
if ($filename === null) {
|
||||||
|
$filename = ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php';
|
||||||
if (!is_array(self::$_config)) {
|
|
||||||
self::$_config = array();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self::$_config = new Wootook_Core_Config_Adapter_Array($filename);
|
||||||
|
|
||||||
|
self::$_globalConfig = clone self::$_config['default'];
|
||||||
|
self::$_globalConfig->merge(self::$_config['global']);
|
||||||
|
|
||||||
|
self::_appendDatabaseConfig(self::$_globalConfig);
|
||||||
|
|
||||||
|
self::$_websiteConfigs = array();
|
||||||
|
self::$_gameConfigs = array();
|
||||||
|
|
||||||
return self::$_config;
|
return self::$_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function _appendDatabaseConfig(Wootook_Core_Config_Node $config, $type = 'global', $id = 0)
|
||||||
|
{
|
||||||
|
$collection = new Wootook_Core_Collection('core_config', 'Wootook_Core_Model_Config');
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case 'website':
|
||||||
|
$collection->where('website_id = :website_id');
|
||||||
|
$collection->load(array('website_id' => $id));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'game':
|
||||||
|
$collection->where('game_id = :game_id');
|
||||||
|
$collection->load(array('game_id' => $id));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$collection->where('website_id = 0');
|
||||||
|
$collection->where('game_id = 0');
|
||||||
|
$collection->load(array());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($collection as $row) {
|
||||||
|
$config->setConfig($row->getData('config_path'), $row->getData('config_value'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $config;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function _initWebsiteConfig($websiteId)
|
||||||
|
{
|
||||||
|
if (self::$_config === null) {
|
||||||
|
self::loadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
$websiteId = 1;
|
||||||
|
|
||||||
|
if (!isset(self::$_websiteConfigs[$websiteId])) {
|
||||||
|
self::$_websiteConfigs[$websiteId] = clone self::$_globalConfig;
|
||||||
|
|
||||||
|
$websiteConfig = self::$_config->getConfig("website/{$websiteId}");
|
||||||
|
if ($websiteConfig !== null) {
|
||||||
|
self::$_websiteConfigs[$websiteId]->merge($websiteConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::_appendDatabaseConfig(self::$_websiteConfigs[$websiteId], 'website', $websiteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$_websiteConfigs[$websiteId];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function _initGameConfig($gameId)
|
||||||
|
{
|
||||||
|
if (self::$_config === null) {
|
||||||
|
self::loadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
$websiteId = 1;
|
||||||
|
$gameId = 1;
|
||||||
|
|
||||||
|
if (!isset(self::$_gameConfigs[$gameId])) {
|
||||||
|
self::_initWebsiteConfig($websiteId);
|
||||||
|
|
||||||
|
self::$_gameConfigs[$gameId] = clone self::$_websiteConfigs[$websiteId];
|
||||||
|
|
||||||
|
$gameConfig = self::$_config->getConfig("game/{$gameId}");
|
||||||
|
if ($gameConfig !== null) {
|
||||||
|
self::$_gameConfigs[$gameId]->merge($gameConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::_appendDatabaseConfig(self::$_gameConfigs[$gameId], 'game', $gameId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$_gameConfigs[$gameId];
|
||||||
|
}
|
||||||
|
|
||||||
public static function getConfig($path = null)
|
public static function getConfig($path = null)
|
||||||
{
|
{
|
||||||
if (self::$_config === null) {
|
if (self::$_config === null) {
|
||||||
self::loadConfig();
|
self::loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path === null || !is_string($path)) {
|
if ($path !== null) {
|
||||||
return self::$_config;
|
return self::$_globalConfig->getConfig($path);
|
||||||
}
|
}
|
||||||
$config = self::$_config;
|
return self::$_globalConfig;
|
||||||
foreach (explode('/', $path) as $chunk) {
|
|
||||||
if (!isset($config[$chunk])) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
$config = $config[$chunk];
|
|
||||||
}
|
|
||||||
return $config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setConfig($path, $value)
|
public static function getWebsiteConfig($path = null, $websiteId = null)
|
||||||
{
|
{
|
||||||
if (self::$_config === null) {
|
if (self::$_config === null) {
|
||||||
self::loadConfig();
|
self::loadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($path === null || !is_string($path)) {
|
$websiteId = 1;
|
||||||
return self::$_config = $value;
|
|
||||||
|
self::_initWebsiteConfig($websiteId);
|
||||||
|
|
||||||
|
if ($path !== null) {
|
||||||
|
return self::$_websiteConfigs[$websiteId]->getConfig($path);
|
||||||
}
|
}
|
||||||
$config = &self::$_config;
|
return self::$_websiteConfigs[$websiteId];
|
||||||
foreach (explode('/', $path) as $chunk) {
|
}
|
||||||
if (!isset($config[$chunk])) {
|
|
||||||
$config[$chunk] = array();
|
public static function getGameConfig($path = null, $gameId = null)
|
||||||
|
{
|
||||||
|
if (self::$_config === null) {
|
||||||
|
self::loadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
$gameId = 1;
|
||||||
|
|
||||||
|
self::_initGameConfig($gameId);
|
||||||
|
|
||||||
|
if ($path !== null) {
|
||||||
|
return self::$_gameConfigs[$gameId]->getConfig($path);
|
||||||
|
}
|
||||||
|
return self::$_gameConfigs[$gameId];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setConfig($path, $value, $websiteId = null, $gameId = null)
|
||||||
|
{
|
||||||
|
if (self::$_config === null) {
|
||||||
|
self::loadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
$updater = new Wootook_Core_Model_Config();
|
||||||
|
$updater->setPath($path)->setValue($value);
|
||||||
|
if ($websiteId !== null) {
|
||||||
|
$updater->setWebsiteId($websiteId);
|
||||||
|
if ($gameId !== null) {
|
||||||
|
$updater->setGameId($gameId);
|
||||||
|
self::$_gameConfigs[$gameId]->setConfig($path, $value);
|
||||||
|
} else {
|
||||||
|
self::$_websiteConfigs[$websiteId]->setConfig($path, $value);
|
||||||
}
|
}
|
||||||
$config = &$config[$chunk];
|
} else {
|
||||||
|
self::$_globalConfig->setConfig($path, $value);
|
||||||
}
|
}
|
||||||
$config = $value;
|
$updater->save();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function writeConfig(Array $config)
|
|
||||||
{
|
|
||||||
file_put_contents(ROOT_PATH . DIRECTORY_SEPARATOR . 'config.php',
|
|
||||||
'<' . '?p' . 'hp ' . var_export($config, true) . ';');
|
|
||||||
|
|
||||||
self::$_config = $config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getBaseUrl()
|
public static function getBaseUrl()
|
||||||
{
|
{
|
||||||
return self::getConfig('global/web/base_url');
|
return self::$_config->getConfig('global/web/base_url');
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSkinUrl($package, $theme, $uri, Array $params = array())
|
public static function getSkinUrl($package, $theme, $uri, Array $params = array())
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,14 @@ class Wootook_Core_Block_Messages
|
||||||
{
|
{
|
||||||
$messages = array();
|
$messages = array();
|
||||||
|
|
||||||
|
var_dump($this->_storages);
|
||||||
foreach ($this->_storages as $namespace) {
|
foreach ($this->_storages as $namespace) {
|
||||||
$session = Wootook::getSession($namespace);
|
$session = Wootook::getSession($namespace);
|
||||||
|
var_dump($session);
|
||||||
|
|
||||||
|
foreach ($session->getMessages() as $messageLevel => $messageList) {
|
||||||
|
var_dump(array($messageLevel => $messageList));
|
||||||
|
|
||||||
foreach ($session->getData('messages') as $messageLevel => $messageList) {
|
|
||||||
if (!isset($messages[$messageLevel])) {
|
if (!isset($messages[$messageLevel])) {
|
||||||
$messages[$messageLevel] = $messageList;
|
$messages[$messageLevel] = $messageList;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Wootook_Core_Collection
|
class Wootook_Core_Collection
|
||||||
extends Wootook_Core_Model
|
extends Wootook_Core_Database_Resource
|
||||||
implements Iterator, Countable
|
implements Iterator, Countable
|
||||||
{
|
{
|
||||||
protected $_tableName = null;
|
protected $_tableName = null;
|
||||||
|
|
@ -254,7 +254,7 @@ SQL_EOF;
|
||||||
{
|
{
|
||||||
$sql = $this->_prepareSql();
|
$sql = $this->_prepareSql();
|
||||||
|
|
||||||
$database = Wootook_Database::getSingleton();
|
$database = $this->getReadConnection();
|
||||||
$statement = $database->prepare($sql);
|
$statement = $database->prepare($sql);
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class Wootook_Core_Config_Adapter_Abstract
|
||||||
|
extends Wootook_Core_Config_Node
|
||||||
|
{
|
||||||
|
}
|
||||||
33
application/code/core/Wootook/Core/Config/Adapter/Array.php
Normal file
33
application/code/core/Wootook/Core/Config/Adapter/Array.php
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Wootook_Core_Config_Adapter_Array
|
||||||
|
extends Wootook_Core_Config_Adapter_Abstract
|
||||||
|
{
|
||||||
|
public function __construct($filename = null)
|
||||||
|
{
|
||||||
|
if ($filename !== null) {
|
||||||
|
$this->load($filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function load($filename)
|
||||||
|
{
|
||||||
|
$data = include $filename;
|
||||||
|
|
||||||
|
if (!is_array($data)) {
|
||||||
|
throw new Wootook_Core_Exception_DataAccessException(
|
||||||
|
Wootook::__('Configuration file could not be loaded.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_init($data);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save($filename)
|
||||||
|
{
|
||||||
|
file_put_contents($filename, '<' . '?p' . 'hp return ' . var_export($this->toArray(), true) . ';');
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
204
application/code/core/Wootook/Core/Config/Node.php
Normal file
204
application/code/core/Wootook/Core/Config/Node.php
Normal file
|
|
@ -0,0 +1,204 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Wootook_Core_Config_Node
|
||||||
|
implements ArrayAccess
|
||||||
|
{
|
||||||
|
protected $_children = array();
|
||||||
|
|
||||||
|
protected $_parent = null;
|
||||||
|
|
||||||
|
protected static $_attributeNameCache = array();
|
||||||
|
|
||||||
|
public function __construct(Array $data = array(), $parent = null)
|
||||||
|
{
|
||||||
|
$this->_init($data, $parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setData(Array $data = array())
|
||||||
|
{
|
||||||
|
$this->_init($data);
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _init(Array $data, $parent = null)
|
||||||
|
{
|
||||||
|
if ($parent !== null) {
|
||||||
|
$this->_parent = $parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_children = array();
|
||||||
|
|
||||||
|
foreach ($data as $key => $value) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
$this->offsetSet($key, new self($value, $this));
|
||||||
|
} else {
|
||||||
|
$this->offsetSet($key, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setConfig($path, $value)
|
||||||
|
{
|
||||||
|
$explodedPath = explode('/', $path);
|
||||||
|
|
||||||
|
$length = count($explodedPath);
|
||||||
|
$currentNode = $this;
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
if (!$currentNode->offsetExists($explodedPath[$i])) {
|
||||||
|
$newNode = new Wootook_Core_Config_Node(array(), $currentNode);
|
||||||
|
$currentNode->offsetSet($explodedPath[$i], $newNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentNode = $currentNode->offsetGet($explodedPath[$i]);
|
||||||
|
|
||||||
|
if ($i >= ($length - 1)) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
$currentNode->offsetSet($explodedPath[$i], new self($value, $this));
|
||||||
|
} else {
|
||||||
|
$currentNode->offsetSet($explodedPath[$i], $value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} else if (!$currentNode instanceof Wootook_Core_Config_Node) {
|
||||||
|
throw new Wootook_Core_Exception_RuntimeException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConfig($path)
|
||||||
|
{
|
||||||
|
$explodedPath = explode('/', $path);
|
||||||
|
|
||||||
|
$length = count($explodedPath);
|
||||||
|
$currentNode = $this;
|
||||||
|
for ($i = 0; $i < $length; $i++) {
|
||||||
|
if (!$currentNode instanceof Wootook_Core_Config_Node) {
|
||||||
|
throw new Wootook_Core_Exception_RuntimeException();
|
||||||
|
}
|
||||||
|
if (!$currentNode->offsetExists($explodedPath[$i])) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentNode = $currentNode->offsetGet($explodedPath[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $currentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toArray()
|
||||||
|
{
|
||||||
|
$result = array();
|
||||||
|
foreach ($this->_children as $key => $child) {
|
||||||
|
if ($child instanceof self) {
|
||||||
|
$result[$key] = $child->toArray();
|
||||||
|
} else if ($child instanceof Wootook_Core_Config_Leaf) {
|
||||||
|
$result[$key] = $child->getValue();
|
||||||
|
} else {
|
||||||
|
$result[$key] = $child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function reset()
|
||||||
|
{
|
||||||
|
$this->_children = array();
|
||||||
|
$this->_parent = null;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function merge(self $node)
|
||||||
|
{
|
||||||
|
foreach ($node->_children as $offset => $value) {
|
||||||
|
if ($value instanceof self) {
|
||||||
|
if (!$this->offsetExists($offset)) {
|
||||||
|
$this->offsetSet($offset, new self(array(), $this));
|
||||||
|
}
|
||||||
|
$this->offsetGet($offset)->merge($value);
|
||||||
|
} else {
|
||||||
|
$this->offsetSet($offset, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _resolveAttributeName($key)
|
||||||
|
{
|
||||||
|
if (!isset(self::$_attributeNameCache[$key])) {
|
||||||
|
self::$_attributeNameCache[$key] = str_replace(' ', '-', strtolower(preg_replace('#[A-Z]#', ' \\1', $key)));
|
||||||
|
}
|
||||||
|
return self::$_attributeNameCache[$key];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __get($offset)
|
||||||
|
{
|
||||||
|
return $this->offsetGet($this->_resolveAttributeName($offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __set($offset, $value)
|
||||||
|
{
|
||||||
|
return $this->offsetSet($this->_resolveAttributeName($offset), $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __isset($offset)
|
||||||
|
{
|
||||||
|
return $this->offsetExists($this->_resolveAttributeName($offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __unset($offset)
|
||||||
|
{
|
||||||
|
return $this->offsetUnset($this->_resolveAttributeName($offset));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __clone()
|
||||||
|
{
|
||||||
|
$clone = new self();
|
||||||
|
|
||||||
|
foreach ($this->_children as $childName => $childNode) {
|
||||||
|
if ($childNode instanceof self) {
|
||||||
|
$childNode = clone $childNode;
|
||||||
|
$childNode->_parent = $clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
$clone->offsetSet($childName, $childNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetGet($offset)
|
||||||
|
{
|
||||||
|
if ($this->offsetExists($offset)) {
|
||||||
|
return $this->_children[$offset];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetSet($offset, $value)
|
||||||
|
{
|
||||||
|
$this->_children[$offset] = $value;
|
||||||
|
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetExists($offset)
|
||||||
|
{
|
||||||
|
if (isset($this->_children[$offset])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offsetUnset($offset)
|
||||||
|
{
|
||||||
|
if ($this->offsetExists($offset)) {
|
||||||
|
unset($this->_children[$offset]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
67
application/code/core/Wootook/Core/Database/Resource.php
Normal file
67
application/code/core/Wootook/Core/Database/Resource.php
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class Wootook_Core_Database_Resource
|
||||||
|
extends Wootook_Core_Model
|
||||||
|
{
|
||||||
|
protected $_readConnection = null;
|
||||||
|
protected $_writeConnection = null;
|
||||||
|
|
||||||
|
protected $_tableName = null;
|
||||||
|
|
||||||
|
public function setTableName($tableName)
|
||||||
|
{
|
||||||
|
$this->_tableName = $tableName;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTableName()
|
||||||
|
{
|
||||||
|
return $this->_tableName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getReadConnection()
|
||||||
|
{
|
||||||
|
if ($this->_readConnection === null) {
|
||||||
|
$this->_readConnection = Wootook_Database::getConnection('core_read');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->_readConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setReadConnection($connection)
|
||||||
|
{
|
||||||
|
if ($connection instanceof Wootook_Database) {
|
||||||
|
$this->_readConnection = $connection;
|
||||||
|
} else if (is_string($connection)) {
|
||||||
|
$this->_readConnection = Wootook_Database::getConnection($connection);
|
||||||
|
} else {
|
||||||
|
throw new Wootook_Core_Exception_RuntimeException(
|
||||||
|
'First parameter should be either a database connection object or a string identifier.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getWriteConnection()
|
||||||
|
{
|
||||||
|
if ($this->_writeConnection === null) {
|
||||||
|
$this->_writeConnection = Wootook_Database::getConnection('core_write');
|
||||||
|
}
|
||||||
|
return $this->_writeConnection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setWriteConnection($connection)
|
||||||
|
{
|
||||||
|
if ($connection instanceof Wootook_Database) {
|
||||||
|
$this->_readConnection = $connection;
|
||||||
|
} else if (is_string($connection)) {
|
||||||
|
$this->_readConnection = Wootook_Database::getConnection($connection);
|
||||||
|
} else {
|
||||||
|
throw new Wootook_Core_Exception_RuntimeException(
|
||||||
|
'First parameter should be either a database connection object or a string identifier.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
abstract class Wootook_Core_Entity
|
abstract class Wootook_Core_Entity
|
||||||
extends Wootook_Core_Model
|
extends Wootook_Core_Database_Resource
|
||||||
implements Wootook_Core_EntityInterface
|
implements Wootook_Core_EntityInterface
|
||||||
{
|
{
|
||||||
protected $_idFieldName = null;
|
protected $_idFieldName = null;
|
||||||
protected $_tableName = null;
|
|
||||||
|
|
||||||
public function setIdFieldName($fieldName)
|
public function setIdFieldName($fieldName)
|
||||||
{
|
{
|
||||||
|
|
@ -19,18 +18,6 @@ abstract class Wootook_Core_Entity
|
||||||
return $this->_idFieldName;
|
return $this->_idFieldName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setTableName($tableName)
|
|
||||||
{
|
|
||||||
$this->_tableName = $tableName;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTableName()
|
|
||||||
{
|
|
||||||
return $this->_tableName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setId($id)
|
public function setId($id)
|
||||||
{
|
{
|
||||||
$this->setData($this->getIdFieldName(), $id);
|
$this->setData($this->getIdFieldName(), $id);
|
||||||
|
|
@ -48,10 +35,10 @@ abstract class Wootook_Core_Entity
|
||||||
$id = func_get_arg(0);
|
$id = func_get_arg(0);
|
||||||
|
|
||||||
$idFieldName = self::getIdFieldName();
|
$idFieldName = self::getIdFieldName();
|
||||||
$database = Wootook_Database::getSingleton();
|
$database = $this->getReadConnection();
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
$sql =<<<SQL_EOF
|
||||||
SELECT * FROM {$database->getTable(self::getTableName())}
|
SELECT * FROM {$database->getTable($this->getTableName())}
|
||||||
WHERE {$idFieldName}=:id
|
WHERE {$idFieldName}=:id
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
@ -89,9 +76,9 @@ SQL_EOF;
|
||||||
$idFieldName = self::getIdFieldName();
|
$idFieldName = self::getIdFieldName();
|
||||||
$values[$idFieldName] = $this->getId();
|
$values[$idFieldName] = $this->getId();
|
||||||
|
|
||||||
$database = Wootook_Database::getSingleton();
|
$database = $this->getWriteConnection();
|
||||||
$sql =<<<SQL_EOF
|
$sql =<<<SQL_EOF
|
||||||
UPDATE {$database->getTable(self::getTableName())}
|
UPDATE {$database->getTable($this->getTableName())}
|
||||||
SET {$fieldsImploded}
|
SET {$fieldsImploded}
|
||||||
WHERE {$idFieldName}=:{$idFieldName}
|
WHERE {$idFieldName}=:{$idFieldName}
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
@ -113,9 +100,9 @@ SQL_EOF;
|
||||||
}
|
}
|
||||||
$tokensImploded = implode(', ', $tokens);
|
$tokensImploded = implode(', ', $tokens);
|
||||||
|
|
||||||
$database = Wootook_Database::getSingleton();
|
$database = $this->getWriteConnection();
|
||||||
$sql =<<<SQL_EOF
|
$sql =<<<SQL_EOF
|
||||||
INSERT INTO {$database->getTable(self::getTableName())} ($fieldsImploded)
|
INSERT INTO {$database->getTable($this->getTableName())} ($fieldsImploded)
|
||||||
VALUES ({$tokensImploded})
|
VALUES ({$tokensImploded})
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
$statement = $database->prepare($sql);
|
$statement = $database->prepare($sql);
|
||||||
|
|
@ -140,9 +127,9 @@ SQL_EOF;
|
||||||
|
|
||||||
$fieldsImploded = implod(', ', $fields);
|
$fieldsImploded = implod(', ', $fields);
|
||||||
$idFieldName = self::getIdFieldName();
|
$idFieldName = self::getIdFieldName();
|
||||||
$database = Wootook_Database::getSingleton();
|
$database = $this->getWriteConnection();
|
||||||
$sql =<<<SQL_EOF
|
$sql =<<<SQL_EOF
|
||||||
DELETE {$database->getTable(self::getTableName())}
|
DELETE {$database->getTable($this->getTableName())}
|
||||||
WHERE {$idFieldName}=:{$idFieldName}
|
WHERE {$idFieldName}=:{$idFieldName}
|
||||||
SQL_EOF;
|
SQL_EOF;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,9 @@
|
||||||
* @uses Wootook_Empire_Model_User
|
* @uses Wootook_Empire_Model_User
|
||||||
*/
|
*/
|
||||||
abstract class Wootook_Core_Entity_SubTable
|
abstract class Wootook_Core_Entity_SubTable
|
||||||
extends Wootook_Core_Model
|
extends Wootook_Core_Database_Resource
|
||||||
{
|
{
|
||||||
private $_isLoaded = false;
|
private $_isLoaded = false;
|
||||||
protected $_tableName = null;
|
|
||||||
protected $_idFieldNames = array();
|
protected $_idFieldNames = array();
|
||||||
|
|
||||||
protected $_eventPrefix = 'entity.sub-table';
|
protected $_eventPrefix = 'entity.sub-table';
|
||||||
|
|
@ -118,16 +117,4 @@ SQL_EOF;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setTableName($tableName)
|
|
||||||
{
|
|
||||||
$this->_tableName = $tableName;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getTableName()
|
|
||||||
{
|
|
||||||
return $this->_tableName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -16,6 +16,10 @@ class Wootook_Core_ErrorProfiler
|
||||||
|
|
||||||
private $_mute = false;
|
private $_mute = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Wootook_Core_ErrorProfiler
|
||||||
|
*/
|
||||||
public static function getSingleton()
|
public static function getSingleton()
|
||||||
{
|
{
|
||||||
if (self::$_singleton === null) {
|
if (self::$_singleton === null) {
|
||||||
|
|
|
||||||
|
|
@ -8,81 +8,56 @@
|
||||||
* @uses Legacies_Empire
|
* @uses Legacies_Empire
|
||||||
*/
|
*/
|
||||||
class Wootook_Core_Model_Config
|
class Wootook_Core_Model_Config
|
||||||
extends Wootook_Core_Model
|
extends Wootook_Core_Entity_SubTable
|
||||||
implements Wootook_Core_Singleton
|
|
||||||
{
|
{
|
||||||
private static $_singleton = null;
|
private static $_singleton = null;
|
||||||
|
|
||||||
protected $_eventPrefix = 'core.config';
|
protected $_eventPrefix = 'core.config';
|
||||||
protected $_eventObject = 'config';
|
protected $_eventObject = 'config';
|
||||||
|
|
||||||
public static function getSingleton()
|
|
||||||
{
|
|
||||||
if (self::$_singleton === null) {
|
|
||||||
self::$_singleton = new self();
|
|
||||||
}
|
|
||||||
return self::$_singleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function _init()
|
protected function _init()
|
||||||
{
|
{
|
||||||
$this->load();
|
$this->_tableName = 'core_config';
|
||||||
|
$this->_idFieldNames = array('config_path', 'website_id', 'game_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _load()
|
public function setWebsiteId($websiteId)
|
||||||
{
|
{
|
||||||
$database = Wootook_Database::getSingleton();
|
return $this->setData('website_id', $websiteId);
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
|
||||||
SELECT config_name AS attribute, config_value AS value
|
|
||||||
FROM {$database->getTable('config')} AS config
|
|
||||||
SQL_EOF;
|
|
||||||
|
|
||||||
$attributeName = null;
|
|
||||||
$attributeValue = null;
|
|
||||||
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
$statement->execute();
|
|
||||||
|
|
||||||
$statement->bindColumn('attribute', $attributeName, PDO::PARAM_STR);
|
|
||||||
$statement->bindColumn('value', $attributeValue, PDO::PARAM_STR);
|
|
||||||
|
|
||||||
while ($statement->fetch(PDO::FETCH_BOUND)) {
|
|
||||||
$this->setData($attributeName, $attributeValue);
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _save()
|
public function getWebsiteId()
|
||||||
{
|
{
|
||||||
$database = Wootook_Database::getSingleton();
|
return $this->getData('website_id');
|
||||||
$fields = array();
|
|
||||||
|
|
||||||
$sql =<<<SQL_EOF
|
|
||||||
UPDATE {{table}}
|
|
||||||
SET config_value=:value
|
|
||||||
WHERE config_name=:name
|
|
||||||
SQL_EOF;
|
|
||||||
$statement = $database->prepare($sql);
|
|
||||||
|
|
||||||
foreach ($this->getAllDatas() as $attributeName => $attributeValue) {
|
|
||||||
$statement->execute(array(
|
|
||||||
'name' => $attributeName,
|
|
||||||
'value' => $attributeValue
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _delete()
|
public function setGameId($gameId)
|
||||||
{
|
{
|
||||||
// NOP
|
return $this->setData('game_id', $gameId);
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isEnabled()
|
public function getGameId()
|
||||||
{
|
{
|
||||||
return (bool) $this->getData('game_disable');
|
return $this->getData('game_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setPath($path)
|
||||||
|
{
|
||||||
|
return $this->setData('config_path', $path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPath()
|
||||||
|
{
|
||||||
|
return $this->getData('config_path');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setValue($value)
|
||||||
|
{
|
||||||
|
return $this->setData('config_value', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getValue()
|
||||||
|
{
|
||||||
|
return $this->getData('config_value');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -58,7 +58,8 @@ class Wootook_Core_Model_Session
|
||||||
{
|
{
|
||||||
$messages = $this->_data['messages'];
|
$messages = $this->_data['messages'];
|
||||||
if ($clear == true) {
|
if ($clear == true) {
|
||||||
$this->_data['messages'] = array();
|
var_dump($this->_data['messages']);
|
||||||
|
//$this->_data['messages'] = array();
|
||||||
}
|
}
|
||||||
return $messages;
|
return $messages;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,10 @@ class Wootook_Database
|
||||||
return self::$_connectionAliases[$connectionName];
|
return self::$_connectionAliases[$connectionName];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($alias = Wootook::getConfig("global/database/{$connectionName}/use")) {
|
if ($alias = Wootook::getConfig("database/{$connectionName}/use")) {
|
||||||
self::$_connectionAliases[$connectionName] = self::getConnection($alias);
|
self::$_connectionAliases[$connectionName] = self::getConnection($alias);
|
||||||
|
|
||||||
|
return self::$_connectionAliases[$connectionName];
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_connections[$connectionName] = self::_initConnection($connectionName);
|
self::$_connections[$connectionName] = self::_initConnection($connectionName);
|
||||||
|
|
@ -45,23 +47,23 @@ class Wootook_Database
|
||||||
|
|
||||||
private static function _initConnection($connectionName)
|
private static function _initConnection($connectionName)
|
||||||
{
|
{
|
||||||
$hostname = Wootook::getConfig("global/database/{$connectionName}/params/hostname");
|
$hostname = Wootook::getConfig("database/{$connectionName}/params/hostname");
|
||||||
$username = Wootook::getConfig("global/database/{$connectionName}/params/username");
|
$username = Wootook::getConfig("database/{$connectionName}/params/username");
|
||||||
$password = Wootook::getConfig("global/database/{$connectionName}/params/password");
|
$password = Wootook::getConfig("database/{$connectionName}/params/password");
|
||||||
$database = Wootook::getConfig("global/database/{$connectionName}/params/database");
|
$database = Wootook::getConfig("database/{$connectionName}/params/database");
|
||||||
|
|
||||||
if (empty($hostname) || empty($username) || empty($database)) {
|
if (empty($hostname) || empty($username) || empty($database)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dsn = "mysql:dbname={$database};host={$hostname}";
|
$dsn = "mysql:dbname={$database};host={$hostname}";
|
||||||
if (($port = Wootook::getConfig("global/database/{$connectionName}/params/port")) && is_numeric($port)) {
|
if (($port = Wootook::getConfig("database/{$connectionName}/params/port")) && is_numeric($port)) {
|
||||||
$dsn .= ";port={$port}";
|
$dsn .= ";port={$port}";
|
||||||
}
|
}
|
||||||
|
|
||||||
$event = Wootook::dispatchEvent('database.prepare-options', array(
|
$event = Wootook::dispatchEvent('database.prepare-options', array(
|
||||||
'name' => $connectionName,
|
'name' => $connectionName,
|
||||||
'options' => array_merge(self::$options, Wootook::getConfig("global/database/{$connectionName}/options"))
|
'options' => array_merge(self::$options, Wootook::getConfig("database/{$connectionName}/options")->toArray())
|
||||||
));
|
));
|
||||||
|
|
||||||
$options = $event->getData('options');
|
$options = $event->getData('options');
|
||||||
|
|
@ -71,7 +73,7 @@ class Wootook_Database
|
||||||
$connection->_username = $username;
|
$connection->_username = $username;
|
||||||
$connection->_password = $password;
|
$connection->_password = $password;
|
||||||
|
|
||||||
if (($prefix = Wootook::getConfig("global/database/{$connectionName}/table_prefix")) !== null) {
|
if (($prefix = Wootook::getConfig("database/{$connectionName}/table_prefix")) !== null) {
|
||||||
$connection->setTablePrefix($prefix);
|
$connection->setTablePrefix($prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,10 @@ abstract class Wootook_Empire_Model_BuilderAbstract
|
||||||
|
|
||||||
public function enqueue($params, $index = null)
|
public function enqueue($params, $index = null)
|
||||||
{
|
{
|
||||||
|
if ($this->_currentUser->getVacation()) {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
$item = $this->_initItem($params);
|
$item = $this->_initItem($params);
|
||||||
if ($item === null) {
|
if ($item === null) {
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,14 @@ class Wootook_Empire_Model_Planet
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->getUser()->isVacation()) {
|
||||||
|
$resourceConfig = Wootook::getGameConfig('resource/base-income');
|
||||||
|
foreach ($resources->getAllDatas() as $resource => $resourceData) {
|
||||||
|
$this->setData($resourceData['production_field'], $resourceConfig[$resource]);
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute resources consumers and resources producers
|
* Compute resources consumers and resources producers
|
||||||
*/
|
*/
|
||||||
|
|
@ -952,22 +960,14 @@ class Wootook_Empire_Model_Planet
|
||||||
$key = array_rand($positions, 1);
|
$key = array_rand($positions, 1);
|
||||||
$finalPosition = $positions[$key];
|
$finalPosition = $positions[$key];
|
||||||
|
|
||||||
$config = Wootook_Core_Model_Config::getSingleton();
|
$user->createNewPlanet(
|
||||||
$planet = new self();
|
$systemInfo->getData('galaxy'),
|
||||||
$planet
|
$systemInfo->getData('system'),
|
||||||
->setData('id_owner', $user->getId())
|
$finalPosition,
|
||||||
->setData('name', Wootook::getRequest()->getParam('planet'))
|
Wootook_Empire_Model_Planet::TYPE_PLANET,
|
||||||
->setData('galaxy', $systemInfo->getData('galaxy'))
|
Wootook::getRequest()->getParam('planet'),
|
||||||
->setData('system', $systemInfo->getData('system'))
|
Wootook::getGameConfig('resource/initial/fields')
|
||||||
->setData('planet', $finalPosition)
|
);
|
||||||
->setData('planet_type', 1)
|
|
||||||
->setData('field_max', $config->getData('initial_fields'))
|
|
||||||
->setData('field_current', 0)
|
|
||||||
->setData('metal', 500) // TODO: use config
|
|
||||||
->setData('cristal', 500) // TODO: use config
|
|
||||||
;
|
|
||||||
|
|
||||||
$planet->save();
|
|
||||||
|
|
||||||
$user
|
$user
|
||||||
->setData('id_planet', $planet->getId())
|
->setData('id_planet', $planet->getId())
|
||||||
|
|
@ -976,13 +976,6 @@ class Wootook_Empire_Model_Planet
|
||||||
->setData('system', $planet->getSystem())
|
->setData('system', $planet->getSystem())
|
||||||
->setData('planet', $planet->getPosition())
|
->setData('planet', $planet->getPosition())
|
||||||
;
|
;
|
||||||
|
|
||||||
Wootook::dispatchEvent('planet.init', array(
|
|
||||||
'planet' => $planet,
|
|
||||||
'user' => $user
|
|
||||||
));
|
|
||||||
|
|
||||||
$planet->save();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,13 @@ class Wootook_Empire_Model_Planet_Builder
|
||||||
public function getBuildingTime($buildingId, $level)
|
public function getBuildingTime($buildingId, $level)
|
||||||
{
|
{
|
||||||
$prices = Wootook_Empire_Model_Game_Prices::getSingleton();
|
$prices = Wootook_Empire_Model_Game_Prices::getSingleton();
|
||||||
$gameConfig = Wootook_Core_Model_Config::getSingleton();
|
|
||||||
|
|
||||||
Math::setPrecision(50);
|
Math::setPrecision(50);
|
||||||
$firstLevelTime = $prices[$buildingId][Legacies_Empire::BASE_BUILDING_TIME];
|
$firstLevelTime = $prices[$buildingId][Legacies_Empire::BASE_BUILDING_TIME];
|
||||||
$partialLevelTime = Math::mul($firstLevelTime, Math::pow($prices[$buildingId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
|
$partialLevelTime = Math::mul($firstLevelTime, Math::pow($prices[$buildingId][Legacies_Empire::RESOURCE_MULTIPLIER], $level));
|
||||||
$levelTime = Math::sub($partialLevelTime, $firstLevelTime);
|
$levelTime = Math::sub($partialLevelTime, $firstLevelTime);
|
||||||
|
|
||||||
$speedFactor = $gameConfig->getData('game_speed');
|
$speedFactor = Wootook::getGameConfig('game/speed/general');
|
||||||
$baseTime = $levelTime / $speedFactor * 3600;
|
$baseTime = $levelTime / $speedFactor * 3600;
|
||||||
|
|
||||||
Math::setPrecision();
|
Math::setPrecision();
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ class Wootook_Empire_Model_User
|
||||||
$user->setData('banaday', 0)
|
$user->setData('banaday', 0)
|
||||||
->setData('bana', 0)
|
->setData('bana', 0)
|
||||||
->setData('urlaubs_modus', 0)
|
->setData('urlaubs_modus', 0)
|
||||||
|
->setData('urlaubs_until', null)
|
||||||
->save()
|
->save()
|
||||||
;
|
;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -186,18 +187,25 @@ class Wootook_Empire_Model_User
|
||||||
Wootook::getResponse()->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
|
Wootook::getResponse()->setCookie(self::$_cookieName, array('id' => $login['id'], 'key' => $login['login_rememberme']), self::COOKIE_LIFETIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_singleton = self::factory($login['id']);
|
return self::setLoggedIn(self::factory($login['id']));
|
||||||
self::$_singleton->_updateActivity();
|
|
||||||
|
|
||||||
$session->setData('user_id', intval($login['id']));
|
|
||||||
|
|
||||||
return self::$_singleton;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$session->addError('Your username or credential is invalid, please check your input.');
|
$session->addError('Your username or credential is invalid, please check your input.');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function setLoggedIn(self $user)
|
||||||
|
{
|
||||||
|
$session = Wootook::getSession(self::SESSION_KEY);
|
||||||
|
|
||||||
|
self::$_singleton = $user;
|
||||||
|
self::$_singleton->_updateActivity();
|
||||||
|
|
||||||
|
$session->setData('user_id', intval(self::$_singleton->getId()));
|
||||||
|
|
||||||
|
return self::$_singleton;
|
||||||
|
}
|
||||||
|
|
||||||
public static function register($username, $email, $password)
|
public static function register($username, $email, $password)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
@ -225,7 +233,7 @@ class Wootook_Empire_Model_User
|
||||||
} catch (Wootook_Core_Exception_DataAccessException $e) {
|
} catch (Wootook_Core_Exception_DataAccessException $e) {
|
||||||
$session = Wootook_Core_Model_Session::factory(Wootook_Empire_Model_User::SESSION_KEY);
|
$session = Wootook_Core_Model_Session::factory(Wootook_Empire_Model_User::SESSION_KEY);
|
||||||
|
|
||||||
trigger_error($e->getMessage(), E_USER_ERROR);
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
$session->addError($e->getMessage());
|
$session->addError($e->getMessage());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -233,6 +241,44 @@ class Wootook_Empire_Model_User
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function createNewPlanet($galaxy, $system, $position, $type, $name, $size = null)
|
||||||
|
{
|
||||||
|
if ($size === null) {
|
||||||
|
$baseSize = Wootook::getGameConfig('resource/initial/fields');
|
||||||
|
|
||||||
|
$factor = $position * 10 / (1 + log($position * 10));
|
||||||
|
$fuzz = 2 * $factor * pow(sin($factor), 2) / 2 + $factor / 4;
|
||||||
|
|
||||||
|
$size = mt_rand(floor($factor / 10), ceil($factor * 5 / 4)) + mt_rand(0, $fuzz);
|
||||||
|
}
|
||||||
|
|
||||||
|
$planet = new self();
|
||||||
|
$planet
|
||||||
|
->setData('id_owner', $user->getId())
|
||||||
|
->setData('name', $name)
|
||||||
|
->setData('galaxy', $galaxy)
|
||||||
|
->setData('system', $system)
|
||||||
|
->setData('planet', $position)
|
||||||
|
->setData('planet_type', $type)
|
||||||
|
->setData('field_max', $size)
|
||||||
|
->setData('diameter', pow($size, 2) + mt_rand(0, $size * $position))
|
||||||
|
->setData('field_current', 0)
|
||||||
|
;
|
||||||
|
|
||||||
|
$resourceConfig = Wootook::getGameConfig('resource/initial');
|
||||||
|
$resourceList = Wootook_Empire_Model_Game_Resources::getSingleton();
|
||||||
|
foreach ($resourceList as $resource => $resourceData) {
|
||||||
|
$planet->setData($resourceData['production_field'], $resourceConfig[$resource]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Wootook::dispatchEvent('planet.init', array(
|
||||||
|
'planet' => $planet,
|
||||||
|
'user' => $user
|
||||||
|
));
|
||||||
|
|
||||||
|
$planet->save();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Enter description here ...
|
* Enter description here ...
|
||||||
|
|
@ -561,4 +607,34 @@ class Wootook_Empire_Model_User
|
||||||
$navigation->addLink('tools/back', 'Go back to the game', 'Go back to the game', 'overview.php', array(), array('admin'));
|
$navigation->addLink('tools/back', 'Go back to the game', 'Go back to the game', 'overview.php', array(), array('admin'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getVacation()
|
||||||
|
{
|
||||||
|
return $this->getData('urlaubs_modus') ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getVacationEndDate()
|
||||||
|
{
|
||||||
|
return $this->getData('urlaubs_until');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setVacation($active = true)
|
||||||
|
{
|
||||||
|
$this->setData('urlaubs_modus', $active);
|
||||||
|
|
||||||
|
foreach ($this->getPlanetCollection() as $planet) {
|
||||||
|
$planet->updateResources();
|
||||||
|
$planet->updateResourceProduction();
|
||||||
|
$planet->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($active) {
|
||||||
|
$this->setData('urlaubs_until', time() + Wootook::getConfig('engine/options/vacation-min-time'));
|
||||||
|
} else {
|
||||||
|
$this->setData('urlaubs_until', null);
|
||||||
|
}
|
||||||
|
$this->save();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
<table width="519">
|
<table width="519">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="c" colspan="2">Message Général</td>
|
<td class="c" colspan="2"><?php echo $this->__('General message')?></td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th>Sujet</th>
|
<th>Sujet</th>
|
||||||
<th><input name="temat" maxlength="100" size="20" value="" type="text"></th>
|
<th><input name="temat" maxlength="100" size="20" value="" type="text"></th>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th>Texte (<span id="cntChars">0</span> / 5000 Caractère)</th>
|
<th><?php echo $this->__('Content <span id="cntChars">0</span> / %1$d chars)', 5000)?></th>
|
||||||
<th><textarea name="tresc" cols="40" rows="10" size="100">Message Administratif</textarea></th>
|
<th><textarea name="tresc" cols="40" rows="10" size="100"><?php echo $this->__('Admin message')?></textarea></th>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th colspan="2"><input value="Envoyer" type="submit"></th>
|
<th colspan="2"><input value="Envoyer" type="submit"></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -102,24 +102,17 @@
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th colspan="2"><textarea name="NewsText" cols="80" rows="5" size="80" ><?php echo $this->getData('NewsTextVal')?></textarea></th>
|
<th colspan="2"><textarea name="NewsText" cols="80" rows="5" size="80" ><?php echo $this->getData('NewsTextVal')?></textarea></th>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th><?php echo $this->getData('adm_opt_game_oth_chat')?></th>
|
<th><?php echo $this->__('Enable Google Analytics')?></th>
|
||||||
<th><input name="chatframe"<?php echo $this->getData('chatframe')?> type="checkbox" /></th>
|
<td><input name="ga"<?php echo $this->getData('ga')?> type="checkbox" /></td>
|
||||||
</tr><tr>
|
</tr><tr>
|
||||||
<th colspan="2"><textarea name="ExternChat" cols="80" rows="5" size="80" ><?php echo $this->getData('ExtTchatVal')?></textarea></th>
|
<th><?php echo $this->__('Google Analytics Identifier')?></th>
|
||||||
</tr><tr>
|
<td><input name=ga_id type="text" value="<?php echo $this->escape($this->getData('ga_id'))?>" /></td>
|
||||||
<th><?php echo $this->getData('adm_opt_game_oth_adds')?></th>
|
</tr>
|
||||||
<th><input name="googlead"<?php echo $this->getData('googlead')?> type="checkbox" /></th>
|
|
||||||
</tr><tr>
|
|
||||||
<th colspan="2"><textarea name="GoogleAds" cols="80" rows="5" size="80" ><?php echo $this->getData('GoogleAdVal')?></textarea></th>
|
|
||||||
</tr><tr>
|
|
||||||
<th><?php echo $this->getData('adm_opt_game_debugmod')?></a></th>
|
|
||||||
<th><input name="debug"<?php echo $this->getData('debug')?> type="checkbox" /></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><?php echo $this->getData('banner')?></th>
|
<th><?php echo $this->getData('banner')?></th>
|
||||||
<th><textarea name="banner_source_post" cols="80" rows="1" size="80" ><?php echo $this->getData('banner_source_post')?></textarea></th>
|
<th><textarea name="banner_source_post" cols="80" rows="1" size="80" ><?php echo $this->getData('banner_source_post')?></textarea></th>
|
||||||
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2"><img src="<?php echo $this->getData('banner_source_post')?>" alt="<?php echo $this->getData('banner_source_post')?>" title="<?php echo $this->getData('banner_source_post')?>"></th>
|
<th colspan="2"><img src="<?php echo $this->getData('banner_source_post')?>" alt="<?php echo $this->getData('banner_source_post')?>" title="<?php echo $this->getData('banner_source_post')?>"></th>
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,6 @@
|
||||||
'install' => array(
|
'install' => array(
|
||||||
'update' => '2columns-left',
|
'update' => '2columns-left',
|
||||||
'reference' => array(
|
'reference' => array(
|
||||||
'messages' => array(
|
|
||||||
'actions' => array(
|
|
||||||
array(
|
|
||||||
'method' => 'prepareMessages',
|
|
||||||
'params' => array(
|
|
||||||
'namespace' => 'install'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
'content' => array(
|
'content' => array(
|
||||||
'children' => array(
|
'children' => array(
|
||||||
'navigation' => array(
|
'navigation' => array(
|
||||||
|
|
@ -155,5 +145,19 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
|
||||||
|
'install.summary' => array(
|
||||||
|
'update' => 'install',
|
||||||
|
'reference' => array(
|
||||||
|
'content' => array(
|
||||||
|
'children' => array(
|
||||||
|
'overview' => array(
|
||||||
|
'type' => 'core/template',
|
||||||
|
'template' => 'summary.phtml'
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<h1><?php echo $this->__('Welcome to the Wootook! installer')?></h1>
|
<h1><?php echo $this->__('Welcome to the Wootook! installer')?></h1>
|
||||||
<h2><?php echo $this->__('Admin Profile Config')?></h2>
|
<h2><?php echo $this->__('Admin Profile Config')?></h2>
|
||||||
<?php echo $this->getLayout()->getMessagesblock()->renderGroupedHtml()?>
|
<?php echo $this->getLayout()->getMessagesblock()->renderGroupedHtml()?>
|
||||||
<form method="post" action="?mode=install&step=3" id="form:database">
|
<form method="post" action="?mode=install&step=4" id="form:database">
|
||||||
<input type="hidden" id="form_key" name="__formkey" value="<?php echo $session->getFormKey()?>" />
|
<input type="hidden" id="form_key" name="__formkey" value="<?php echo $session->getFormKey()?>" />
|
||||||
<p>
|
<p>
|
||||||
<label for="account:username"><?php echo $this->__('Root admin account name:')?></label>
|
<label for="account:username"><?php echo $this->__('Root admin account name:')?></label>
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,9 @@ $position = isset($session['position']) ? $session['position'] : 0;
|
||||||
$type = isset($session['type']) ? $session['type'] : 0;
|
$type = isset($session['type']) ? $session['type'] : 0;
|
||||||
$speed = isset($session['speed']) ? $session['speed'] : 10;
|
$speed = isset($session['speed']) ? $session['speed'] : 10;
|
||||||
|
|
||||||
|
$protection = Wootook::getGameConfig('game/noob-protection/active');
|
||||||
$protection = $gameConfig['noobprotection'];
|
$protectiontime = Wootook::getGameConfig('game/noob-protection/points-cap');
|
||||||
$protectiontime = $gameConfig['noobprotectiontime'];
|
$protectionmulti = Wootook::getGameConfig('game/noob-protection/multiplier');
|
||||||
$protectionmulti = $gameConfig['noobprotectionmulti'];
|
|
||||||
|
|
||||||
if ($protectiontime < 1) {
|
if ($protectiontime < 1) {
|
||||||
$protectiontime = 9999999999999999;
|
$protectiontime = 9999999999999999;
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,9 @@ require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$PrNoob = $gameConfig['noobprotection'];
|
$PrNoob = Wootook::getGameConfig('game/noob-protection/active');
|
||||||
$PrNoobTime = $gameConfig['noobprotectiontime'];
|
$PrNoobTime = Wootook::getGameConfig('game/noob-protection/points-cap');
|
||||||
$PrNoobMulti = $gameConfig['noobprotectionmulti'];
|
$PrNoobMulti = Wootook::getGameConfig('game/noob-protection/multiplier');
|
||||||
|
|
||||||
// Petit Test de coherance
|
// Petit Test de coherance
|
||||||
$galaxy = intval($_POST['galaxy']);
|
$galaxy = intval($_POST['galaxy']);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function walka ($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno) {
|
function walka ($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno) {
|
||||||
global $pricelist, $CombatCaps, $gameConfig;
|
global $pricelist, $CombatCaps;
|
||||||
$runda = array();
|
$runda = array();
|
||||||
$atakujacy_n = array();
|
$atakujacy_n = array();
|
||||||
$wrog_n = array();
|
$wrog_n = array();
|
||||||
|
|
@ -259,11 +259,11 @@ function walka ($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno) {
|
||||||
$wygrana = "w";
|
$wygrana = "w";
|
||||||
}
|
}
|
||||||
|
|
||||||
$zlom['metal'] = ((($atakujacy_zlom_poczatek['metal'] - $atakujacy_zlom_koniec['metal']) + ($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal'])) * ($gameConfig['Fleet_Cdr'] / 100));
|
$zlom['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'])) * ($gameConfig['Fleet_Cdr'] / 100));
|
$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'])) * ($gameConfig['Defs_Cdr'] / 100));
|
$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'])) * ($gameConfig['Defs_Cdr'] / 100));
|
$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["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);
|
$zlom["wrog"] = (($wrog_zlom_poczatek['metal'] - $wrog_zlom_koniec['metal']) + ($wrog_zlom_poczatek['crystal'] - $wrog_zlom_koniec['crystal']) + $straty_obrona_wrog);
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ defined('E_USER_DEPRECATED') || define('E_USER_DEPRECATED', E_USER_WARNING); //
|
||||||
define('ADMINEMAIL', "no-reply@wootook.org");
|
define('ADMINEMAIL', "no-reply@wootook.org");
|
||||||
|
|
||||||
// Definition du monde connu !
|
// Definition du monde connu !
|
||||||
defined('MAX_GALAXY_IN_WORLD') || define('MAX_GALAXY_IN_WORLD', Wootook::getConfig('default/engine/universe/galaxies'));
|
defined('MAX_GALAXY_IN_WORLD') || define('MAX_GALAXY_IN_WORLD', Wootook::getGameConfig('engine/universe/galaxies'));
|
||||||
defined('MAX_SYSTEM_IN_GALAXY') || define('MAX_SYSTEM_IN_GALAXY', Wootook::getConfig('default/engine/universe/systems'));
|
defined('MAX_SYSTEM_IN_GALAXY') || define('MAX_SYSTEM_IN_GALAXY', Wootook::getGameConfig('engine/universe/systems'));
|
||||||
defined('MAX_PLANET_IN_SYSTEM') || define('MAX_PLANET_IN_SYSTEM', Wootook::getConfig('default/engine/universe/positions'));
|
defined('MAX_PLANET_IN_SYSTEM') || define('MAX_PLANET_IN_SYSTEM', Wootook::getGameConfig('engine/universe/positions'));
|
||||||
|
|
||||||
defined('BCNUMBERS') || define('BCNUMBERS', Wootook::getConfig('default/engine/core/use_large_numbers'));
|
defined('BCNUMBERS') || define('BCNUMBERS', Wootook::getConfig('default/engine/core/use_large_numbers'));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -127,9 +127,7 @@ EOF;
|
||||||
*/
|
*/
|
||||||
public function error($message, $title)
|
public function error($message, $title)
|
||||||
{
|
{
|
||||||
$gameConfig = Legacies_Core_Model_Config::getSingleton();
|
if (defined('DEBUG')) {
|
||||||
|
|
||||||
if ($gameConfig['debug'] == 1) {
|
|
||||||
echo "<h2>$title</h2><br><font color=red>$message</font><br><hr>";
|
echo "<h2>$title</h2><br><font color=red>$message</font><br><hr>";
|
||||||
echo "<table>".$this->log."</table>";
|
echo "<table>".$this->log."</table>";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -657,4 +657,25 @@ function doquery($query, $table, $fetch = false)
|
||||||
} else {
|
} else {
|
||||||
return $statement;
|
return $statement;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @deprecated
|
||||||
|
* @param unknown_type $UserID
|
||||||
|
*/
|
||||||
|
function ResetThisFuckingCheater($userId)
|
||||||
|
{
|
||||||
|
defined('DEPRECATION') || trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
$user = Wootook_Empire_Model_User::factory($userId);
|
||||||
|
$username = $user->getData('username');
|
||||||
|
$email = $user->getData('email');
|
||||||
|
$password = $user->getData('password');
|
||||||
|
$user->delete();
|
||||||
|
|
||||||
|
$user = Wootook_Empire_Model_User::register($TheUser['username'], $TheUser['email'], 'password');
|
||||||
|
$user->setData('password', $password);
|
||||||
|
$user->save();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -35,17 +35,15 @@ function check_urlaubmodus ($user) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_urlaubmodus_time () {
|
function check_urlaubmodus_time () {
|
||||||
global $user, $gameConfig;
|
global $user;
|
||||||
if ($gameConfig['urlaubs_modus_erz'] == 1) {
|
$begrenzung = 86400; //24x60x60= 24h
|
||||||
$begrenzung = 86400; //24x60x60= 24h
|
$urlaub_modus_time = $user['urlaubs_modus_time'];
|
||||||
$urlaub_modus_time = $user['urlaubs_modus_time'];
|
$urlaub_modus_time_soll = $urlaub_modus_time + $begrenzung;
|
||||||
$urlaub_modus_time_soll = $urlaub_modus_time + $begrenzung;
|
$time_jetzt = time();
|
||||||
$time_jetzt = time();
|
if ($user['urlaubs_modus'] == 1 && $urlaub_modus_time_soll > $time_jetzt) {
|
||||||
if ($user['urlaubs_modus'] == 1 && $urlaub_modus_time_soll > $time_jetzt) {
|
$soll_datum = date("d.m.Y", $urlaub_modus_time_soll);
|
||||||
$soll_datum = date("d.m.Y", $urlaub_modus_time_soll);
|
$soll_uhrzeit = date("H:i:s", $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");
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
@ -214,8 +214,15 @@ function MissionCaseAttack($FleetRow)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) {
|
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);
|
$user = Wootook_Empire_Model_User::factory($TargetUserID);
|
||||||
$GottenMoon = sprintf ($lang['sys_moonbuilt'], $targetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
|
$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) {
|
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
|
||||||
$GottenMoon = "";
|
$GottenMoon = "";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
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');
|
doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = ". $FleetRow["fleet_id"], 'fleets');
|
||||||
} else {
|
} 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 ) {
|
if ( $NewOwnerPlanet == true ) {
|
||||||
$TheMessage = $lang['sys_colo_arrival'] . $TargetAdress . $lang['sys_colo_allisok'];
|
$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);
|
SendSimpleMessage ( $FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 0, $lang['sys_colo_mess_from'], $lang['sys_colo_mess_report'], $TheMessage);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
*/
|
*/
|
||||||
function MissionCaseDestruction($FleetRow)
|
function MissionCaseDestruction($FleetRow)
|
||||||
{
|
{
|
||||||
global $user, $pricelist, $lang, $resource, $CombatCaps, $gameConfig;
|
global $user, $pricelist, $lang, $resource, $CombatCaps;
|
||||||
|
|
||||||
includeLang('system');
|
includeLang('system');
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ function MissionCaseDestruction($FleetRow)
|
||||||
$gravitonPower = 1 + pow(1 - $gravitonLevel, 2);
|
$gravitonPower = 1 + pow(1 - $gravitonLevel, 2);
|
||||||
|
|
||||||
$rawChances = pow(sqrt(1 / floatval($TargetPlanet['diameter'])) * $destructionPower * $gravitonPower, 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);
|
$tirage = mt_rand(0, 100000000);
|
||||||
$probalune = sprintf($lang['sys_destruc_lune'], (int) ($chances * 100));
|
$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']);
|
$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
|
// Mise a jour de l'enregistrement de la planete attaqu<71>e
|
||||||
|
|
||||||
$QryUpdateTarget = "UPDATE {{table}} SET ";
|
$QryUpdateTarget = "UPDATE {{table}} SET ";
|
||||||
|
|
||||||
$QryUpdateTarget .= $TargetPlanetUpd;
|
$QryUpdateTarget .= $TargetPlanetUpd;
|
||||||
|
|
||||||
$QryUpdateTarget .= "`metal` = `metal` - '". $Mining['metal'] ."', ";
|
$QryUpdateTarget .= "`metal` = `metal` - '". $Mining['metal'] ."', ";
|
||||||
|
|
||||||
$QryUpdateTarget .= "`crystal` = `crystal` - '". $Mining['crystal'] ."', ";
|
$QryUpdateTarget .= "`crystal` = `crystal` - '". $Mining['crystal'] ."', ";
|
||||||
|
|
||||||
$QryUpdateTarget .= "`deuterium` = `deuterium` - '". $Mining['deuter'] ."' ";
|
$QryUpdateTarget .= "`deuterium` = `deuterium` - '". $Mining['deuter'] ."' ";
|
||||||
|
|
||||||
$QryUpdateTarget .= "WHERE ";
|
$QryUpdateTarget .= "WHERE ";
|
||||||
|
|
||||||
$QryUpdateTarget .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
$QryUpdateTarget .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||||
|
|
||||||
$QryUpdateTarget .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
$QryUpdateTarget .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||||
|
|
||||||
$QryUpdateTarget .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
$QryUpdateTarget .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' AND ";
|
||||||
|
|
||||||
$QryUpdateTarget .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' ";
|
$QryUpdateTarget .= "`planet_type` = '". $FleetRow['fleet_end_type'] ."' ";
|
||||||
|
|
||||||
$QryUpdateTarget .= "LIMIT 1;";
|
$QryUpdateTarget .= "LIMIT 1;";
|
||||||
|
|
||||||
doquery( $QryUpdateTarget , 'planets');
|
doquery( $QryUpdateTarget , 'planets');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Mise a jour du champ de ruine devant la planete attaqu<71>e
|
// Mise a jour du champ de ruine devant la planete attaqu<71>e
|
||||||
|
|
||||||
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
|
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
|
||||||
|
|
||||||
$QryUpdateGalaxy .= "`metal` = `metal` + '". $zlom['metal'] ."', ";
|
$QryUpdateGalaxy .= "`metal` = `metal` + '". $zlom['metal'] ."', ";
|
||||||
|
|
||||||
$QryUpdateGalaxy .= "`crystal` = `crystal` + '". $zlom['crystal'] ."' ";
|
$QryUpdateGalaxy .= "`crystal` = `crystal` + '". $zlom['crystal'] ."' ";
|
||||||
|
|
||||||
$QryUpdateGalaxy .= "WHERE ";
|
$QryUpdateGalaxy .= "WHERE ";
|
||||||
|
|
||||||
$QryUpdateGalaxy .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
$QryUpdateGalaxy .= "`galaxy` = '". $FleetRow['fleet_end_galaxy'] ."' AND ";
|
||||||
|
|
||||||
$QryUpdateGalaxy .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
$QryUpdateGalaxy .= "`system` = '". $FleetRow['fleet_end_system'] ."' AND ";
|
||||||
|
|
||||||
$QryUpdateGalaxy .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' ";
|
$QryUpdateGalaxy .= "`planet` = '". $FleetRow['fleet_end_planet'] ."' ";
|
||||||
|
|
||||||
$QryUpdateGalaxy .= "LIMIT 1;";
|
$QryUpdateGalaxy .= "LIMIT 1;";
|
||||||
|
|
||||||
doquery( $QryUpdateGalaxy , 'galaxy');
|
doquery( $QryUpdateGalaxy , 'galaxy');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// L<> on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune !
|
// L<> on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune !
|
||||||
|
|
||||||
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
|
$FleetDebris = $zlom['metal'] + $zlom['crystal'];
|
||||||
|
|
||||||
$StrAttackerUnits = sprintf ($lang['sys_attacker_lostunits'], $zlom["atakujacy"]);
|
$StrAttackerUnits = sprintf ($lang['sys_attacker_lostunits'], $zlom["atakujacy"]);
|
||||||
|
|
||||||
$StrDefenderUnits = sprintf ($lang['sys_defender_lostunits'], $zlom["wrog"]);
|
$StrDefenderUnits = sprintf ($lang['sys_defender_lostunits'], $zlom["wrog"]);
|
||||||
|
|
||||||
$StrRuins = sprintf ($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']);
|
$StrRuins = sprintf ($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']);
|
||||||
|
|
||||||
$DebrisField = $StrAttackerUnits ."<br />". $StrDefenderUnits ."<br />". $StrRuins;
|
$DebrisField = $StrAttackerUnits ."<br />". $StrDefenderUnits ."<br />". $StrRuins;
|
||||||
|
|
||||||
$MoonChance = $FleetDebris / 100000;
|
$MoonChance = $FleetDebris / 100000;
|
||||||
|
|
||||||
if ($FleetDebris > 2000000) {
|
if ($FleetDebris > 2000000) {
|
||||||
|
|
||||||
$MoonChance = 20;
|
$MoonChance = 20;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($FleetDebris < 100000) {
|
if ($FleetDebris < 100000) {
|
||||||
|
|
||||||
$UserChance = 0;
|
$UserChance = 0;
|
||||||
|
|
||||||
$ChanceMoon = "";
|
$ChanceMoon = "";
|
||||||
|
|
||||||
} elseif ($FleetDebris >= 100000) {
|
} elseif ($FleetDebris >= 100000) {
|
||||||
|
|
||||||
$UserChance = mt_rand(1, 100);
|
$UserChance = mt_rand(1, 100);
|
||||||
|
|
||||||
$ChanceMoon = sprintf ($lang['sys_moonproba'], $MoonChance);
|
$ChanceMoon = sprintf ($lang['sys_moonproba'], $MoonChance);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) {
|
if (($UserChance > 0) and ($UserChance <= $MoonChance) and $galenemyrow['id_luna'] == 0) {
|
||||||
|
$user = Wootook_Empire_Model_User::factory($TargetUserID);
|
||||||
$TargetPlanetName = CreateOneMoonRecord ( $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance );
|
$user->createNewPlanet(
|
||||||
|
intval($FleetRow['fleet_end_galaxy']),
|
||||||
$GottenMoon = sprintf ($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']);
|
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) {
|
} elseif ($UserChance = 0 or $UserChance > $MoonChance) {
|
||||||
|
|
||||||
$GottenMoon = "";
|
$GottenMoon = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
|
$AttackDate = date("r", $FleetRow["fleet_start_time"]);
|
||||||
|
|
||||||
$title = sprintf ($lang['sys_destruc_title'], $AttackDate);
|
$title = sprintf ($lang['sys_destruc_title'], $AttackDate);
|
||||||
|
|
||||||
$raport = "<center><table><tr><td>". $title ."<br />";
|
$raport = "<center><table><tr><td>". $title ."<br />";
|
||||||
|
|
||||||
$zniszczony = false;
|
$zniszczony = false;
|
||||||
|
|
||||||
$a_zestrzelona = 0;
|
$a_zestrzelona = 0;
|
||||||
|
|
||||||
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
|
$AttackTechon['A'] = $CurrentTechno["military_tech"] * 10;
|
||||||
|
|
||||||
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
|
$AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10;
|
||||||
|
|
||||||
$AttackTechon['C'] = $CurrentTechno["shield_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'] );
|
$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']);
|
$AttackerTech = sprintf ($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
|
$DefendTechon['A'] = $TargetTechno["military_tech"] * 10;
|
||||||
|
|
||||||
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
|
$DefendTechon['B'] = $TargetTechno["defence_tech"] * 10;
|
||||||
|
|
||||||
$DefendTechon['C'] = $TargetTechno["shield_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'] );
|
$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']);
|
$DefenderTech = sprintf ($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($dane_do_rw as $a => $b) {
|
foreach ($dane_do_rw as $a => $b) {
|
||||||
|
|
||||||
$raport .= "<table border=1 width=100%><tr><th><br /><center>".$AttackerData."<br />".$AttackerTech."<table border=1>";
|
$raport .= "<table border=1 width=100%><tr><th><br /><center>".$AttackerData."<br />".$AttackerTech."<table border=1>";
|
||||||
|
|
||||||
if ($b["atakujacy"]['count'] > 0) {
|
if ($b["atakujacy"]['count'] > 0) {
|
||||||
|
|
||||||
$raport1 = "<tr><th>".$lang['sys_ship_type']."</th>";
|
$raport1 = "<tr><th>".$lang['sys_ship_type']."</th>";
|
||||||
|
|
||||||
$raport2 = "<tr><th>".$lang['sys_ship_count']."</th>";
|
$raport2 = "<tr><th>".$lang['sys_ship_count']."</th>";
|
||||||
|
|
||||||
$raport3 = "<tr><th>".$lang['sys_ship_weapon']."</th>";
|
$raport3 = "<tr><th>".$lang['sys_ship_weapon']."</th>";
|
||||||
|
|
||||||
$raport4 = "<tr><th>".$lang['sys_ship_shield']."</th>";
|
$raport4 = "<tr><th>".$lang['sys_ship_shield']."</th>";
|
||||||
|
|
||||||
$raport5 = "<tr><th>".$lang['sys_ship_armour']."</th>";
|
$raport5 = "<tr><th>".$lang['sys_ship_armour']."</th>";
|
||||||
|
|
||||||
foreach ($b["atakujacy"] as $Ship => $Data) {
|
foreach ($b["atakujacy"] as $Ship => $Data) {
|
||||||
|
|
||||||
if (is_numeric($Ship)) {
|
if (is_numeric($Ship)) {
|
||||||
|
|
||||||
if ($Data['count'] > 0) {
|
if ($Data['count'] > 0) {
|
||||||
|
|
||||||
$raport1 .= "<th>". $lang["tech_rc"][$Ship] ."</th>";
|
$raport1 .= "<th>". $lang["tech_rc"][$Ship] ."</th>";
|
||||||
|
|
||||||
$raport2 .= "<th>". $Data['count'] ."</th>";
|
$raport2 .= "<th>". $Data['count'] ."</th>";
|
||||||
|
|
||||||
$raport3 .= "<th>". round($Data["atak"] / $Data['count']) ."</th>";
|
$raport3 .= "<th>". round($Data["atak"] / $Data['count']) ."</th>";
|
||||||
|
|
||||||
$raport4 .= "<th>". round($Data["tarcza"] / $Data['count']) ."</th>";
|
$raport4 .= "<th>". round($Data["tarcza"] / $Data['count']) ."</th>";
|
||||||
|
|
||||||
$raport5 .= "<th>". round($Data["obrona"] / $Data['count']) ."</th>";
|
$raport5 .= "<th>". round($Data["obrona"] / $Data['count']) ."</th>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$raport1 .= "</tr>";
|
$raport1 .= "</tr>";
|
||||||
|
|
||||||
$raport2 .= "</tr>";
|
$raport2 .= "</tr>";
|
||||||
|
|
||||||
$raport3 .= "</tr>";
|
$raport3 .= "</tr>";
|
||||||
|
|
||||||
$raport4 .= "</tr>";
|
$raport4 .= "</tr>";
|
||||||
|
|
||||||
$raport5 .= "</tr>";
|
$raport5 .= "</tr>";
|
||||||
|
|
||||||
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
|
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ($a == 2) {
|
if ($a == 2) {
|
||||||
|
|
||||||
$a_zestrzelona = 1;
|
$a_zestrzelona = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$zniszczony = true;
|
$zniszczony = true;
|
||||||
|
|
||||||
$raport .= "<br />". $lang['sys_destroyed'];
|
$raport .= "<br />". $lang['sys_destroyed'];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$raport .= "</table></center></th></tr></table>";
|
$raport .= "</table></center></th></tr></table>";
|
||||||
|
|
||||||
$raport .= "<table border=1 width=100%><tr><th><br /><center>".$DefenderData."<br />".$DefenderTech."<table border=1>";
|
$raport .= "<table border=1 width=100%><tr><th><br /><center>".$DefenderData."<br />".$DefenderTech."<table border=1>";
|
||||||
|
|
||||||
if ($b["wrog"]['count'] > 0) {
|
if ($b["wrog"]['count'] > 0) {
|
||||||
|
|
||||||
$raport1 = "<tr><th>".$lang['sys_ship_type']."</th>";
|
$raport1 = "<tr><th>".$lang['sys_ship_type']."</th>";
|
||||||
|
|
||||||
$raport2 = "<tr><th>".$lang['sys_ship_count']."</th>";
|
$raport2 = "<tr><th>".$lang['sys_ship_count']."</th>";
|
||||||
|
|
||||||
$raport3 = "<tr><th>".$lang['sys_ship_weapon']."</th>";
|
$raport3 = "<tr><th>".$lang['sys_ship_weapon']."</th>";
|
||||||
|
|
||||||
$raport4 = "<tr><th>".$lang['sys_ship_shield']."</th>";
|
$raport4 = "<tr><th>".$lang['sys_ship_shield']."</th>";
|
||||||
|
|
||||||
$raport5 = "<tr><th>".$lang['sys_ship_armour']."</th>";
|
$raport5 = "<tr><th>".$lang['sys_ship_armour']."</th>";
|
||||||
|
|
||||||
foreach ($b["wrog"] as $Ship => $Data) {
|
foreach ($b["wrog"] as $Ship => $Data) {
|
||||||
|
|
||||||
if (is_numeric($Ship)) {
|
if (is_numeric($Ship)) {
|
||||||
|
|
||||||
if ($Data['count'] > 0) {
|
if ($Data['count'] > 0) {
|
||||||
|
|
||||||
$raport1 .= "<th>". $lang["tech_rc"][$Ship] ."</th>";
|
$raport1 .= "<th>". $lang["tech_rc"][$Ship] ."</th>";
|
||||||
|
|
||||||
$raport2 .= "<th>". $Data['count'] ."</th>";
|
$raport2 .= "<th>". $Data['count'] ."</th>";
|
||||||
|
|
||||||
$raport3 .= "<th>". round($Data["atak"] / $Data['count']) ."</th>";
|
$raport3 .= "<th>". round($Data["atak"] / $Data['count']) ."</th>";
|
||||||
|
|
||||||
$raport4 .= "<th>". round($Data["tarcza"] / $Data['count']) ."</th>";
|
$raport4 .= "<th>". round($Data["tarcza"] / $Data['count']) ."</th>";
|
||||||
|
|
||||||
$raport5 .= "<th>". round($Data["obrona"] / $Data['count']) ."</th>";
|
$raport5 .= "<th>". round($Data["obrona"] / $Data['count']) ."</th>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$raport1 .= "</tr>";
|
$raport1 .= "</tr>";
|
||||||
|
|
||||||
$raport2 .= "</tr>";
|
$raport2 .= "</tr>";
|
||||||
|
|
||||||
$raport3 .= "</tr>";
|
$raport3 .= "</tr>";
|
||||||
|
|
||||||
$raport4 .= "</tr>";
|
$raport4 .= "</tr>";
|
||||||
|
|
||||||
$raport5 .= "</tr>";
|
$raport5 .= "</tr>";
|
||||||
|
|
||||||
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
|
$raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$zniszczony = true;
|
$zniszczony = true;
|
||||||
|
|
||||||
$raport .= "<br />". $lang['sys_destroyed'];
|
$raport .= "<br />". $lang['sys_destroyed'];
|
||||||
|
|
||||||
}
|
}
|
||||||
$raport .= "</table></center></th></tr></table>";
|
$raport .= "</table></center></th></tr></table>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (($zniszczony == false) and !($a == 8)) {
|
if (($zniszczony == false) and !($a == 8)) {
|
||||||
$AttackWaveStat = sprintf ($lang['sys_attack_attack_wave'], floor($b["atakujacy"]["atak"]), floor($b["wrog"]["tarcza"]));
|
$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"]));
|
$DefendWavaStat = sprintf ($lang['sys_attack_defend_wave'], floor($b["wrog"]["atak"]), floor($b["atakujacy"]["tarcza"]));
|
||||||
|
|
|
||||||
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -48,12 +48,9 @@ include(ROOT_PATH . 'includes/functions/SendSimpleMessage.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/SpyTarget.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/SpyTarget.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/RestoreFleetToPlanet.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/RestoreFleetToPlanet.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/StoreGoodsToPlanet.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/StoreGoodsToPlanet.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/CreateOneMoonRecord.'.PHPEXT); // <- TODO: delete
|
|
||||||
include(ROOT_PATH . 'includes/functions/CreateOnePlanetRecord.'.PHPEXT); // <- TODO: delete
|
|
||||||
include(ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/IsTechnologieAccessible.'.PHPEXT); // <- TODO: delete
|
include(ROOT_PATH . 'includes/functions/IsTechnologieAccessible.'.PHPEXT); // <- TODO: delete
|
||||||
include(ROOT_PATH . 'includes/functions/GetRestPrice.'.PHPEXT); // <- TODO: delete
|
include(ROOT_PATH . 'includes/functions/GetRestPrice.'.PHPEXT); // <- TODO: delete
|
||||||
include(ROOT_PATH . 'includes/functions/IsElementBuyable.'.PHPEXT);
|
|
||||||
include(ROOT_PATH . 'includes/functions/InsertGalaxyScripts.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/InsertGalaxyScripts.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/GalaxyCheckFunctions.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/GalaxyCheckFunctions.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/ShowGalaxyRows.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/ShowGalaxyRows.'.PHPEXT);
|
||||||
|
|
@ -80,8 +77,6 @@ include(ROOT_PATH . 'includes/functions/MipCombatEngine.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/DeleteSelectedUser.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/DeleteSelectedUser.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/SortUserPlanets.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/SortUserPlanets.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/BuildFleetEventTable.'.PHPEXT);
|
include(ROOT_PATH . 'includes/functions/BuildFleetEventTable.'.PHPEXT);
|
||||||
include(ROOT_PATH . 'includes/functions/ResetThisFuckingCheater.'.PHPEXT);
|
|
||||||
include(ROOT_PATH . 'includes/functions/IsVacationMode.'.PHPEXT);
|
|
||||||
/**
|
/**
|
||||||
* }}}
|
* }}}
|
||||||
*/
|
*/
|
||||||
|
|
@ -54,9 +54,7 @@ function GetMissionDuration ($GameSpeed, $MaxFleetSpeed, $Distance, $SpeedFactor
|
||||||
|
|
||||||
// Retourne la valeur ajustée de vitesse des flottes
|
// Retourne la valeur ajustée de vitesse des flottes
|
||||||
function GetGameSpeedFactor () {
|
function GetGameSpeedFactor () {
|
||||||
global $gameConfig;
|
return Wootook::getGameConfig('game/speed/fleet') / 2500;
|
||||||
|
|
||||||
return $gameConfig['fleet_speed'] / 2500;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
19
infos.php
19
infos.php
|
|
@ -82,17 +82,18 @@ function BuildJumpableMoonCombo ( $CurrentUser, $CurrentPlanet ) {
|
||||||
// Tient compte aussi du multiplicateur de ressources
|
// Tient compte aussi du multiplicateur de ressources
|
||||||
//
|
//
|
||||||
function ShowProductionTable ($CurrentUser, $CurrentPlanet, $BuildID, $Template) {
|
function ShowProductionTable ($CurrentUser, $CurrentPlanet, $BuildID, $Template) {
|
||||||
global $ProdGrid, $resource, $gameConfig;
|
global $ProdGrid, $resource;
|
||||||
|
|
||||||
$BuildLevelFactor = $CurrentPlanet[ $resource[$BuildID]."_porcent" ];
|
$BuildLevelFactor = $CurrentPlanet[ $resource[$BuildID]."_porcent" ];
|
||||||
$BuildTemp = $CurrentPlanet[ 'temp_max' ];
|
$BuildTemp = $CurrentPlanet[ 'temp_max' ];
|
||||||
$CurrentBuildtLvl = $CurrentPlanet[ $resource[$BuildID] ];
|
$CurrentBuildtLvl = $CurrentPlanet[ $resource[$BuildID] ];
|
||||||
|
|
||||||
$BuildLevel = ($CurrentBuildtLvl > 0) ? $CurrentBuildtLvl : 1;
|
$BuildLevel = ($CurrentBuildtLvl > 0) ? $CurrentBuildtLvl : 1;
|
||||||
$Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
$multiplier = Wootook::getGameConfig('game/resource/multiplier');
|
||||||
$Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
$Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
||||||
$Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
$Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
||||||
$Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_ingenieur'] * 0.05)));
|
$Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
||||||
|
$Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $multiplier) * (1 + ($CurrentUser['rpg_ingenieur'] * 0.05)));
|
||||||
$BuildLevel = "";
|
$BuildLevel = "";
|
||||||
|
|
||||||
$ActualProd = floor($Prod[$BuildID]);
|
$ActualProd = floor($Prod[$BuildID]);
|
||||||
|
|
@ -110,10 +111,10 @@ function ShowProductionTable ($CurrentUser, $CurrentPlanet, $BuildID, $Template)
|
||||||
$ProdFirst = 0;
|
$ProdFirst = 0;
|
||||||
for ( $BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++ ) {
|
for ( $BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++ ) {
|
||||||
if ($BuildID != 42) {
|
if ($BuildID != 42) {
|
||||||
$Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
$Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
||||||
$Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
$Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
||||||
$Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
$Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $multiplier) * (1 + ($CurrentUser['rpg_geologue'] * 0.05)));
|
||||||
$Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $gameConfig['resource_multiplier']) * (1 + ($CurrentUser['rpg_ingenieur'] * 0.05)));
|
$Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $multiplier) * (1 + ($CurrentUser['rpg_ingenieur'] * 0.05)));
|
||||||
|
|
||||||
$bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">".$BuildLevel."</font>" : $BuildLevel;
|
$bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">".$BuildLevel."</font>" : $BuildLevel;
|
||||||
if ($ProdFirst > 0) {
|
if ($ProdFirst > 0) {
|
||||||
|
|
|
||||||
|
|
@ -64,16 +64,14 @@ if (isset($_SERVER['REQUEST_URI'])) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(Wootook::getConfig()) == 0) {
|
Wootook::setConfig('global/web/base_url', $baseUrl);
|
||||||
Wootook::setConfig('global/web/base_url', $baseUrl);
|
|
||||||
|
|
||||||
Wootook::setConfig('global/package', 'install');
|
Wootook::setConfig('global/package', 'install');
|
||||||
Wootook::setConfig('global/theme', 'default');
|
Wootook::setConfig('global/theme', 'default');
|
||||||
Wootook::setconfig('global/layout', array(
|
Wootook::setconfig('global/layout', array(
|
||||||
'page' => 'page.php',
|
'page' => 'page.php',
|
||||||
'install' => 'install.php'
|
'install' => 'install.php'
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
|
||||||
$session = Wootook::getSession('install');
|
$session = Wootook::getSession('install');
|
||||||
$layout = new Wootook_Core_Layout();
|
$layout = new Wootook_Core_Layout();
|
||||||
|
|
@ -82,8 +80,8 @@ $response = new Wootook_Core_Controller_Response_Http();
|
||||||
|
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 'intro':
|
case 'intro':
|
||||||
$layout->getMessagesBlock()->prepareMessages('install');
|
|
||||||
$layout->load('install.intro');
|
$layout->load('install.intro');
|
||||||
|
$layout->getMessagesBlock()->prepareMessages('install');
|
||||||
$session->setData('step', 1);
|
$session->setData('step', 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -113,8 +111,6 @@ case 'install':
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout->getMessagesblock()->prepareMessages('install');
|
|
||||||
|
|
||||||
$config = array(
|
$config = array(
|
||||||
'global' => array(
|
'global' => array(
|
||||||
'storyline' => array(
|
'storyline' => array(
|
||||||
|
|
@ -142,28 +138,28 @@ case 'install':
|
||||||
);
|
);
|
||||||
$session->setData('config', serialize($config));
|
$session->setData('config', serialize($config));
|
||||||
|
|
||||||
Wootook::writeConfig($config);
|
|
||||||
|
|
||||||
$session->setData('step', STEP_DATABASE);
|
$session->setData('step', STEP_DATABASE);
|
||||||
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_DATABASE)));
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_DATABASE)));
|
||||||
$response->sendHeaders();
|
$response->sendHeaders();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout->getMessagesBlock()->prepareMessages('install');
|
|
||||||
$layout->load('install.step.system');
|
$layout->load('install.step.system');
|
||||||
|
$layout->getMessagesBlock()->prepareMessages('install');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STEP_DATABASE:
|
case STEP_DATABASE:
|
||||||
$config = unserialize($session->getData('config'));
|
$config = unserialize($session->getData('config'));
|
||||||
$session->setFormData(array(
|
if (isset($config['global']['database'])) {
|
||||||
'host' => $config['global']['database']['default']['params']['hostname'],
|
$session->setFormData(array(
|
||||||
'port' => $config['global']['database']['default']['params']['port'],
|
'host' => $config['global']['database']['default']['params']['hostname'],
|
||||||
'user' => $config['global']['database']['default']['params']['username'],
|
'port' => $config['global']['database']['default']['params']['port'],
|
||||||
'password' => $config['global']['database']['default']['params']['password'],
|
'user' => $config['global']['database']['default']['params']['username'],
|
||||||
'dbname' => $config['global']['database']['default']['params']['database'],
|
'password' => $config['global']['database']['default']['params']['password'],
|
||||||
'prefix' => $config['global']['database']['default']['table_prefix'],
|
'dbname' => $config['global']['database']['default']['params']['database'],
|
||||||
));
|
'prefix' => $config['global']['database']['default']['table_prefix'],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
$form = new Wootook_Core_Form($session, array(
|
$form = new Wootook_Core_Form($session, array(
|
||||||
|
|
@ -214,8 +210,6 @@ case 'install':
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout->getMessagesblock()->prepareMessages('install');
|
|
||||||
|
|
||||||
$config = unserialize($session->getData('config'));
|
$config = unserialize($session->getData('config'));
|
||||||
$config['global']['database'] = array(
|
$config['global']['database'] = array(
|
||||||
'default' => array(
|
'default' => array(
|
||||||
|
|
@ -249,8 +243,8 @@ case 'install':
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout->getMessagesBlock()->prepareMessages('install');
|
|
||||||
$layout->load('install.step.database');
|
$layout->load('install.step.database');
|
||||||
|
$layout->getMessagesBlock()->prepareMessages('install');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STEP_UNIVERSE:
|
case STEP_UNIVERSE:
|
||||||
|
|
@ -319,12 +313,27 @@ case 'install':
|
||||||
}
|
}
|
||||||
} catch (Wootook_Core_Setup_Exception_VersionStageError $e) {
|
} catch (Wootook_Core_Setup_Exception_VersionStageError $e) {
|
||||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
|
|
||||||
|
$session->addError($e->getMessage());
|
||||||
|
$session->setData('step', STEP_UNIVERSE);
|
||||||
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE)));
|
||||||
|
$response->sendHeaders();
|
||||||
continue;
|
continue;
|
||||||
} catch (Wootook_Core_Setup_Exception_VersionValueError $e) {
|
} catch (Wootook_Core_Setup_Exception_VersionValueError $e) {
|
||||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
|
|
||||||
|
$session->addError($e->getMessage());
|
||||||
|
$session->setData('step', STEP_UNIVERSE);
|
||||||
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE)));
|
||||||
|
$response->sendHeaders();
|
||||||
continue;
|
continue;
|
||||||
} catch (Wootook_Core_Setup_Exception_RuntimeException $e) {
|
} catch (Wootook_Core_Setup_Exception_RuntimeException $e) {
|
||||||
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
Wootook_Core_ErrorProfiler::getSingleton()->exceptionManager($e);
|
||||||
|
|
||||||
|
$session->addError($e->getMessage());
|
||||||
|
$session->setData('step', STEP_UNIVERSE);
|
||||||
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_UNIVERSE)));
|
||||||
|
$response->sendHeaders();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -339,8 +348,8 @@ case 'install':
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout->getMessagesBlock()->prepareMessages('install');
|
|
||||||
$layout->load('install.step.universe');
|
$layout->load('install.step.universe');
|
||||||
|
$layout->getMessagesBlock()->prepareMessages('install');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STEP_PROFILE:
|
case STEP_PROFILE:
|
||||||
|
|
@ -358,6 +367,7 @@ case 'install':
|
||||||
if (!$form->validate()) {
|
if (!$form->validate()) {
|
||||||
$session->setData('step', STEP_PROFILE);
|
$session->setData('step', STEP_PROFILE);
|
||||||
$session->setFormData($request->getData());
|
$session->setFormData($request->getData());
|
||||||
|
$session->addError(Wootook::__('Form data error.'));
|
||||||
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE)));
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE)));
|
||||||
$response->sendHeaders();
|
$response->sendHeaders();
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
@ -375,26 +385,48 @@ case 'install':
|
||||||
if ($request->getPost('email') != $request->getPost('email_confirm')) {
|
if ($request->getPost('email') != $request->getPost('email_confirm')) {
|
||||||
$session->setData('step', STEP_PROFILE);
|
$session->setData('step', STEP_PROFILE);
|
||||||
$session->setFormData($request->getData());
|
$session->setFormData($request->getData());
|
||||||
$session->addError(Wootook::__('e-mails does not match.'));
|
$session->addError(Wootook::__('Both e-mails does not match.'));
|
||||||
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE)));
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE)));
|
||||||
$response->sendHeaders();
|
$response->sendHeaders();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Wootook_Empire_Model_User::register($request->getPost('username'), $request->getPost('email'), $request->getPost('password'));
|
try {
|
||||||
|
$user = Wootook_Empire_Model_User::register($request->getPost('username'), $request->getPost('email'), $request->getPost('password'));
|
||||||
|
} catch (Wootook_Empire_Exception_RuntimeException $e) {
|
||||||
|
}
|
||||||
|
$layout->getMessagesBlock()->prepareMessages('user');
|
||||||
|
if (!$user->getId()) {
|
||||||
|
$session->setData('step', STEP_PROFILE);
|
||||||
|
$session->setFormData($request->getData());
|
||||||
|
$session->addError(Wootook::__('Could not create user.'));
|
||||||
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_PROFILE)));
|
||||||
|
$response->sendHeaders();
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
Wootook_Empire_Model_User::setLoggedIn($user);
|
||||||
|
|
||||||
|
$user->setData('authlevel', LEVEL_ADMIN)->save();
|
||||||
|
}
|
||||||
|
|
||||||
$session->setData('step', STEP_CONFIG);
|
$session->setData('step', STEP_CONFIG);
|
||||||
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_CONFIG)));
|
//$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'install', 'step' => STEP_CONFIG)));
|
||||||
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'summary')));
|
||||||
$response->sendHeaders();
|
$response->sendHeaders();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout->getMessagesBlock()->prepareMessages('install');
|
|
||||||
$layout->load('install.step.profile');
|
$layout->load('install.step.profile');
|
||||||
|
$layout->getMessagesBlock()->prepareMessages('install');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STEP_CONFIG:
|
case STEP_CONFIG:
|
||||||
if (empty($_POST)) {
|
//*
|
||||||
|
$response->setRedirect(Wootook::getUrl('install/index.php', array('mode' => 'summary')));
|
||||||
|
$response->sendHeaders();
|
||||||
|
exit(0);
|
||||||
|
/*/
|
||||||
|
if ($request->isPost()) {
|
||||||
$session->setData('step', $step);
|
$session->setData('step', $step);
|
||||||
$response->setRedirect("?mode=install&step={$nextStep}");
|
$response->setRedirect("?mode=install&step={$nextStep}");
|
||||||
$response->sendHeaders();
|
$response->sendHeaders();
|
||||||
|
|
@ -402,197 +434,15 @@ case 'install':
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout->getMessagesBlock()->prepareMessages('install');
|
$layout->getMessagesBlock()->prepareMessages('install');
|
||||||
$layout->load('install.config');
|
$layout->load('install.step.config');
|
||||||
|
//*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'summary':
|
||||||
case 'ins':
|
$layout->load('install.summary');
|
||||||
if ($page == 1) {
|
$layout->getMessagesBlock()->prepareMessages('install');
|
||||||
if (isset($_GET['error']) && intval($_GET['error']) == 1) {
|
break;
|
||||||
adminMessage ($lang['ins_error1'], $lang['ins_error']);
|
|
||||||
}
|
|
||||||
elseif (isset($_GET['error']) && intval($_GET['error']) == 2) {
|
|
||||||
adminMessage ($lang['ins_error2'], $lang['ins_error']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$subTpl = gettemplate('install/ins_form');
|
|
||||||
$bloc = $lang;
|
|
||||||
$bloc['dpath'] = $dpath;
|
|
||||||
$frame = parsetemplate($subTpl, $bloc);
|
|
||||||
} else if ($page == 2) {
|
|
||||||
$host = $_POST['host'];
|
|
||||||
$user = $_POST['user'];
|
|
||||||
$pass = $_POST['passwort'];
|
|
||||||
$prefix = $_POST['prefix'];
|
|
||||||
$db = $_POST['db'];
|
|
||||||
|
|
||||||
$connection = @mysql_connect($host, $user, $pass);
|
|
||||||
if (!$connection) {
|
|
||||||
header("Location: ?mode=ins&page=1&error=1");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$dbselect = @mysql_select_db($db);
|
|
||||||
if (!$dbselect) {
|
|
||||||
header("Location: ?mode=ins&page=1&error=1");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$dz = fopen("../config.php", "w");
|
|
||||||
if (!$dz) {
|
|
||||||
header("Location: ?mode=ins&page=1&error=2");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
$fileData =<<<EOF
|
|
||||||
<?php return array(
|
|
||||||
'global' => array(
|
|
||||||
'database' => array(
|
|
||||||
'engine' => 'mysql',
|
|
||||||
'options' => array(
|
|
||||||
'hostname' => '{$host}',
|
|
||||||
'username' => '{$user}',
|
|
||||||
'password' => '{$pass}',
|
|
||||||
'database' => '{$db}'
|
|
||||||
),
|
|
||||||
'table_prefix' => '{$prefix}',
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
EOF;
|
|
||||||
fwrite($dz, $fileData);
|
|
||||||
fclose($dz);
|
|
||||||
|
|
||||||
doquery ( $QryTableAks , 'aks' );
|
|
||||||
doquery ( $QryTableAnnonce , 'annonce' );
|
|
||||||
doquery ( $QryTableAlliance , 'alliance' );
|
|
||||||
doquery ( $QryTableBanned , 'banned' );
|
|
||||||
doquery ( $QryTableBuddy , 'buddy' );
|
|
||||||
doquery ( $QryTableChat , 'chat' );
|
|
||||||
doquery ( $QryTableConfig , 'config' );
|
|
||||||
doquery ( $QryInsertConfig , 'config' );
|
|
||||||
doquery ( $QryTabledeclared , 'declared' );
|
|
||||||
doquery ( $QryTableErrors , 'errors' );
|
|
||||||
doquery ( $QryTableFleets , 'fleets' );
|
|
||||||
doquery ( $QryTableGalaxy , 'galaxy' );
|
|
||||||
doquery ( $QryTableIraks , 'iraks' );
|
|
||||||
doquery ( $QryTableLunas , 'lunas' );
|
|
||||||
doquery ( $QryTableMessages , 'messages' );
|
|
||||||
doquery ( $QryTableNotes , 'notes' );
|
|
||||||
doquery ( $QryTablePlanets , 'planets' );
|
|
||||||
doquery ( $QryTableRw , 'rw' );
|
|
||||||
doquery ( $QryTableStatPoints , 'statpoints' );
|
|
||||||
doquery ( $QryTableUsers , 'users' );
|
|
||||||
doquery ( $QryTableMulti , 'multi' );
|
|
||||||
|
|
||||||
$subTpl = gettemplate ('install/ins_form_done');
|
|
||||||
$bloc = $lang;
|
|
||||||
$bloc['dpath'] = $dpath;
|
|
||||||
$frame = parsetemplate ( $subTpl, $bloc );
|
|
||||||
} elseif ($page == 3) {
|
|
||||||
if (isset($_GET['error']) && intval($_GET['error']) == 3) {
|
|
||||||
adminMessage($lang['ins_error3'], $lang['ins_error']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$subTpl = gettemplate ('install/ins_acc');
|
|
||||||
$bloc = $lang;
|
|
||||||
$bloc['dpath'] = $dpath;
|
|
||||||
$frame = parsetemplate ( $subTpl, $bloc );
|
|
||||||
} elseif ($page == 4) {
|
|
||||||
$adm_user = $_POST['adm_user'];
|
|
||||||
$adm_pass = $_POST['adm_pass'];
|
|
||||||
$adm_email = $_POST['adm_email'];
|
|
||||||
$adm_planet = $_POST['adm_planet'];
|
|
||||||
$adm_sex = $_POST['adm_sex'];
|
|
||||||
$md5pass = md5($adm_pass);
|
|
||||||
|
|
||||||
if (!isset($_POST['adm_user'])) {
|
|
||||||
header("Location: ?mode=ins&page=3&error=3");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
if (!isset($_POST['adm_pass'])) {
|
|
||||||
header("Location: ?mode=ins&page=3&error=3");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
if (!isset($_POST['adm_email'])) {
|
|
||||||
header("Location: ?mode=ins&page=3&error=3");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
if (!isset($_POST['adm_planet'])) {
|
|
||||||
header("Location: ?mode=ins&page=3&error=3");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$config = include(ROOT_PATH . 'config.php');
|
|
||||||
$db_host = $config['global']['database']['options']['hostname'];
|
|
||||||
$db_user = $config['global']['database']['options']['username'];
|
|
||||||
$db_pass = $config['global']['database']['options']['password'];
|
|
||||||
$db_db = $config['global']['database']['options']['database'];
|
|
||||||
$db_prefix = $config['global']['database']['table_prefix'];
|
|
||||||
|
|
||||||
$connection = @mysql_connect($db_host, $db_user, $db_pass);
|
|
||||||
if (!$connection) {
|
|
||||||
header("Location: ?mode=ins&page=1&error=1");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$dbselect = @mysql_select_db($db_db);
|
|
||||||
if (!$dbselect) {
|
|
||||||
header("Location: ?mode=ins&page=1&error=1");
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$QryInsertAdm = "INSERT INTO {{table}} SET ";
|
|
||||||
$QryInsertAdm .= "`id` = '1', ";
|
|
||||||
$QryInsertAdm .= "`username` = '". $adm_user ."', ";
|
|
||||||
$QryInsertAdm .= "`email` = '". $adm_email ."', ";
|
|
||||||
$QryInsertAdm .= "`email_2` = '". $adm_email ."', ";
|
|
||||||
$QryInsertAdm .= "`authlevel` = '3', ";
|
|
||||||
$QryInsertAdm .= "`sex` = '". $adm_sex ."', ";
|
|
||||||
$QryInsertAdm .= "`id_planet` = '1', ";
|
|
||||||
$QryInsertAdm .= "`galaxy` = '1', ";
|
|
||||||
$QryInsertAdm .= "`system` = '1', ";
|
|
||||||
$QryInsertAdm .= "`planet` = '1', ";
|
|
||||||
$QryInsertAdm .= "`current_planet` = '1', ";
|
|
||||||
$QryInsertAdm .= "`register_time` = '". time() ."', ";
|
|
||||||
$QryInsertAdm .= "`password` = '". $md5pass ."';";
|
|
||||||
doquery($QryInsertAdm, 'users');
|
|
||||||
|
|
||||||
$QryAddAdmPlt = "INSERT INTO {{table}} SET ";
|
|
||||||
$QryAddAdmPlt .= "`name` = '". $adm_planet ."', ";
|
|
||||||
$QryAddAdmPlt .= "`id_owner` = '1', ";
|
|
||||||
$QryAddAdmPlt .= "`galaxy` = '1', ";
|
|
||||||
$QryAddAdmPlt .= "`system` = '1', ";
|
|
||||||
$QryAddAdmPlt .= "`planet` = '1', ";
|
|
||||||
$QryAddAdmPlt .= "`last_update` = '". time() ."', ";
|
|
||||||
$QryAddAdmPlt .= "`planet_type` = '1', ";
|
|
||||||
$QryAddAdmPlt .= "`image` = 'normaltempplanet02', ";
|
|
||||||
$QryAddAdmPlt .= "`diameter` = '12750', ";
|
|
||||||
$QryAddAdmPlt .= "`field_max` = '163', ";
|
|
||||||
$QryAddAdmPlt .= "`temp_min` = '47', ";
|
|
||||||
$QryAddAdmPlt .= "`temp_max` = '87', ";
|
|
||||||
$QryAddAdmPlt .= "`metal` = '500', ";
|
|
||||||
$QryAddAdmPlt .= "`metal_perhour` = '0', ";
|
|
||||||
$QryAddAdmPlt .= "`metal_max` = '1000000', ";
|
|
||||||
$QryAddAdmPlt .= "`crystal` = '500', ";
|
|
||||||
$QryAddAdmPlt .= "`crystal_perhour` = '0', ";
|
|
||||||
$QryAddAdmPlt .= "`crystal_max` = '1000000', ";
|
|
||||||
$QryAddAdmPlt .= "`deuterium` = '500', ";
|
|
||||||
$QryAddAdmPlt .= "`deuterium_perhour` = '0', ";
|
|
||||||
$QryAddAdmPlt .= "`deuterium_max` = '1000000';";
|
|
||||||
doquery($QryAddAdmPlt, 'planets');
|
|
||||||
|
|
||||||
$QryAddAdmGlx = "INSERT INTO {{table}} SET ";
|
|
||||||
$QryAddAdmGlx .= "`galaxy` = '1', ";
|
|
||||||
$QryAddAdmGlx .= "`system` = '1', ";
|
|
||||||
$QryAddAdmGlx .= "`planet` = '1', ";
|
|
||||||
$QryAddAdmGlx .= "`id_planet` = '1'; ";
|
|
||||||
doquery($QryAddAdmGlx, 'galaxy');
|
|
||||||
|
|
||||||
$subTpl = gettemplate ('install/ins_acc_done');
|
|
||||||
$frame = parsetemplate ( $subTpl, $lang );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $layout->render();
|
echo $layout->render();
|
||||||
|
|
|
||||||
111
leftmenu.php
111
leftmenu.php
|
|
@ -1,111 +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.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
define('INSIDE' , true);
|
|
||||||
define('INSTALL' , false);
|
|
||||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
|
||||||
|
|
||||||
function ShowLeftMenu ( $Level , $Template = 'left_menu') {
|
|
||||||
global $lang, $user, $dpath, $gameConfig;
|
|
||||||
|
|
||||||
includeLang('leftmenu');
|
|
||||||
|
|
||||||
$MenuTPL = gettemplate( $Template );
|
|
||||||
$InfoTPL = gettemplate( 'serv_infos' );
|
|
||||||
$parse = $lang;
|
|
||||||
$parse['lm_tx_serv'] = $gameConfig['resource_multiplier'];
|
|
||||||
$parse['lm_tx_game'] = $gameConfig['game_speed'] / 2500;
|
|
||||||
$parse['lm_tx_fleet'] = $gameConfig['fleet_speed'] / 2500;
|
|
||||||
$parse['lm_tx_queue'] = MAX_FLEET_OR_DEFS_PER_ROW;
|
|
||||||
$SubFrame = parsetemplate( $InfoTPL, $parse );
|
|
||||||
$parse['server_info'] = $SubFrame;
|
|
||||||
$parse['WootookRelease'] = VERSION;
|
|
||||||
$parse['dpath'] = $dpath;
|
|
||||||
$parse['forum_url'] = $gameConfig['forum_url'];
|
|
||||||
$parse['mf'] = "Hauptframe";
|
|
||||||
$rank = doquery("SELECT `total_rank` FROM {{table}} WHERE `stat_code` = '1' AND `stat_type` = '1' AND `id_owner` = '". $user['id'] ."';",'statpoints',true);
|
|
||||||
$parse['user_rank'] = $rank['total_rank'];
|
|
||||||
if ($Level > 0) {
|
|
||||||
$parse['ADMIN_LINK'] = "
|
|
||||||
<tr>
|
|
||||||
<td colspan=\"2\"><div><a href=\"admin/leftmenu.php\"><font color=\"lime\">".$lang['user_level'][$Level]."</font></a></div></td>
|
|
||||||
</tr>";
|
|
||||||
} else {
|
|
||||||
$parse['ADMIN_LINK'] = "";
|
|
||||||
}
|
|
||||||
//Lien suppl<70>mentaire d<>termin<69> dans le panel admin
|
|
||||||
if ($gameConfig['link_enable'] == 1) {
|
|
||||||
$parse['added_link'] = "
|
|
||||||
<tr>
|
|
||||||
<td colspan=\"2\"><div><a href=\"".$gameConfig['link_url']."\" target=\"_blank\">".stripslashes($gameConfig['link_name'])."</a></div></td>
|
|
||||||
</tr>";
|
|
||||||
} else {
|
|
||||||
$parse['added_link'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
//Maintenant on v<>rifie si les annonces sont activ<69>es ou non
|
|
||||||
if ($gameConfig['enable_announces'] == 1) {
|
|
||||||
$parse['announce_link'] = "
|
|
||||||
<tr>
|
|
||||||
<td colspan=\"2\"><div><a href=\"annonce.php\" target=\"Hauptframe\">Annonces</a></div></td>
|
|
||||||
</tr>";
|
|
||||||
} else {
|
|
||||||
$parse['announce_link'] = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
//Maintenant le marchand
|
|
||||||
if ($gameConfig['enable_marchand'] == 1) {
|
|
||||||
$parse['marchand_link'] = "
|
|
||||||
<td colspan=\"2\"><div><a href=\"marchand.php\" target=\"Hauptframe\">Marchand</a></div></td>";
|
|
||||||
} else {
|
|
||||||
$parse['marchand_link'] = "";
|
|
||||||
}
|
|
||||||
//Maintenant les notes
|
|
||||||
if ($gameConfig['enable_notes'] == 1) {
|
|
||||||
$parse['notes_link'] = "
|
|
||||||
<tr>
|
|
||||||
<td colspan=\"2\"><div><a href=\"#\" onClick=\"f(\'notes.php\', \'Report\');\" accesskey=\"n\">Notes</a></div></td>
|
|
||||||
</tr>";
|
|
||||||
} else {
|
|
||||||
$parse['notes_link'] = "";
|
|
||||||
}
|
|
||||||
$parse['servername'] = $gameConfig['game_name'];
|
|
||||||
$Menu = parsetemplate( $MenuTPL, $parse);
|
|
||||||
|
|
||||||
return $Menu;
|
|
||||||
}
|
|
||||||
$Menu = ShowLeftMenu ( $user['authlevel'] );
|
|
||||||
display ( $Menu, "Menu", '', false );
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------------
|
|
||||||
// History version
|
|
||||||
// 1.0 - Passage en fonction pour Wootook version future
|
|
||||||
// 1.1 - Modification pour gestion Admin / Game OP / Modo
|
|
||||||
?>
|
|
||||||
|
|
@ -77,8 +77,8 @@ $block['user_count'] = $userCount;
|
||||||
$block['latest_player'] = $latestPlayer;
|
$block['latest_player'] = $latestPlayer;
|
||||||
$block['online_players'] = $onlinePlayers;
|
$block['online_players'] = $onlinePlayers;
|
||||||
|
|
||||||
$block['server_name'] = $gameConfig['game_name'];
|
$block['server_name'] = Wootook::getWebsiteConfig('game/general/name');
|
||||||
$block['board_url'] = $gameConfig['forum_url'];
|
$block['board_url'] = Wootook::getWebsiteConfig('game/general/boards-url');
|
||||||
|
|
||||||
echo $layout->render();
|
echo $layout->render();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ while ($CurMess = $UsrMess->fetch(PDO::FETCH_BOTH)) {
|
||||||
$Sender = $user['id'];
|
$Sender = $user['id'];
|
||||||
$From = $user['username'] ." [".$user['galaxy'].":".$user['system'].":".$user['planet']."]";
|
$From = $user['username'] ." [".$user['galaxy'].":".$user['system'].":".$user['planet']."]";
|
||||||
$Subject = $_POST['subject'];
|
$Subject = $_POST['subject'];
|
||||||
if($gameConfig['enable_bbcode'] == 1) {
|
if (Wootook::getGameConfig('engine/options/bbcode')) {
|
||||||
$Message = trim ( nl2br (bbcode ( image ( strip_tags ( $_POST['text'], '<br>' ) ) ) ) );
|
$Message = trim ( nl2br (bbcode ( image ( strip_tags ( $_POST['text'], '<br>' ) ) ) ) );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -128,7 +128,7 @@ $Message = trim ( nl2br ( strip_tags ( $_POST['text'], '<br>' ) ) ); }
|
||||||
$parse['to'] = $OwnerRecord['username'] ." [".$OwnerHome['galaxy'].":".$OwnerHome['system'].":".$OwnerHome['planet']."]";
|
$parse['to'] = $OwnerRecord['username'] ." [".$OwnerHome['galaxy'].":".$OwnerHome['system'].":".$OwnerHome['planet']."]";
|
||||||
$parse['subject'] = (!isset($subject)) ? $lang['mess_no_subject'] : $subject ;
|
$parse['subject'] = (!isset($subject)) ? $lang['mess_no_subject'] : $subject ;
|
||||||
$parse['text'] = $text;
|
$parse['text'] = $text;
|
||||||
if($gameConfig['enable_bbcode'] == 1) {
|
if(Wootook::getGameConfig('engine/options/bbcode')) {
|
||||||
$page .= parsetemplate(gettemplate('messages_pm_form_bb'), $parse);
|
$page .= parsetemplate(gettemplate('messages_pm_form_bb'), $parse);
|
||||||
} else {
|
} else {
|
||||||
$page .= parsetemplate(gettemplate('messages_pm_form'), $parse); }
|
$page .= parsetemplate(gettemplate('messages_pm_form'), $parse); }
|
||||||
|
|
|
||||||
97
options.php
97
options.php
|
|
@ -30,46 +30,26 @@
|
||||||
|
|
||||||
define('INSIDE' , true);
|
define('INSIDE' , true);
|
||||||
define('INSTALL' , false);
|
define('INSTALL' , false);
|
||||||
|
|
||||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||||
|
|
||||||
includeLang('options');
|
$user = Wootook_Empire_Model_User::getSingleton();
|
||||||
|
|
||||||
$lang['PHP_SELF'] = 'options.' . PHPEXT;
|
includeLang('options');
|
||||||
|
|
||||||
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
|
$lang['PHP_SELF'] = 'options.' . PHPEXT;
|
||||||
$mode = $_GET['mode'];
|
|
||||||
|
|
||||||
if ($_POST && $mode == "exit") { // Array ( [db_character]
|
$mode = isset($_GET['mode']) ? $_GET['mode'] : null;
|
||||||
if (isset($_POST["exit_modus"]) && $_POST["exit_modus"] == 'on' and $user['urlaubs_until'] <= time()){
|
|
||||||
$urlaubs_modus = "0";
|
|
||||||
doquery("UPDATE {{table}} SET
|
|
||||||
`urlaubs_modus` = '0',
|
|
||||||
`urlaubs_until` = '0'
|
|
||||||
WHERE `id` = '".$user['id']."' LIMIT 1", "users");
|
|
||||||
|
|
||||||
//Remise des mines au retour du mod vacance
|
if (!empty($_POST) && $mode == "exit") { // Array ( [db_character]
|
||||||
|
if (isset($_POST["exit_modus"]) && !empty($_POST["exit_modus"]) && $user->getVacation() && $user->getVacationEndDate() <= time()) {
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id_owner = '{$user['id']}'", 'planets');
|
$user->setVacation(false);
|
||||||
while ($id = $query->fetch(PDO::FETCH_BOTH)){
|
message($lang['succeful_save'], $lang['Options'],"options.php",1);
|
||||||
doquery("UPDATE {{table}} SET
|
} else {
|
||||||
energy_used = '10',
|
message($lang['You_cant_exit_vmode'], $lan['Error'] ,"options.php",1);
|
||||||
energy_max = '10',
|
|
||||||
metal_mine_porcent = '10',
|
|
||||||
crystal_mine_porcent = '10',
|
|
||||||
deuterium_sintetizer_porcent = '10',
|
|
||||||
solar_plant_porcent = '10',
|
|
||||||
fusion_plant_porcent = '10',
|
|
||||||
solar_satelit_porcent = '10'
|
|
||||||
WHERE id = '{$id['id']}' AND `planet_type` = 1 ", 'planets');}
|
|
||||||
|
|
||||||
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
|
|
||||||
message($lang['succeful_save'], $lang['Options'],"options.php",1);
|
|
||||||
}else{
|
|
||||||
$urlaubs_modus = "1";
|
|
||||||
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
|
|
||||||
message($lang['You_cant_exit_vmode'], $lan['Error'] ,"options.php",1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST && $mode == "change") { // Array ( [db_character]
|
if ($_POST && $mode == "change") { // Array ( [db_character]
|
||||||
$iduser = $user["id"];
|
$iduser = $user["id"];
|
||||||
$avatar = $_POST["avatar"];
|
$avatar = $_POST["avatar"];
|
||||||
|
|
@ -167,44 +147,22 @@ require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||||
$settings_rep = "0";
|
$settings_rep = "0";
|
||||||
}
|
}
|
||||||
// Modo vacaciones
|
// Modo vacaciones
|
||||||
if (isset($_POST["urlaubs_modus"]) && $_POST["urlaubs_modus"] == 'on') {
|
if (isset($_POST["urlaubs_modus"]) && !empty($_POST["urlaubs_modus"]) && !$user->getVacation()) {
|
||||||
//Selectionne si le joueur a des flottes en vol
|
//Selectionne si le joueur a des flottes en vol
|
||||||
$fleet = doquery("SELECT COUNT(fleet_owner) AS `actcnt` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets', true);
|
$fleet = doquery("SELECT COUNT(fleet_owner) AS `actcnt` FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets', true);
|
||||||
//Selectionne si le joueur a des batiments en construction
|
//Selectionne si le joueur a des batiments en construction
|
||||||
$build = doquery("SELECT COUNT(id_owner) AS `building` FROM {{table}} WHERE `id_owner` = '".$user['id']."' and `b_building`!=0;", 'planets', true);
|
$build = doquery("SELECT COUNT(id_owner) AS `building` FROM {{table}} WHERE `id_owner` = '".$user['id']."' and `b_building`!=0;", 'planets', true);
|
||||||
//Selectionne si le joueur a des techno en cours
|
//Selectionne si le joueur a des techno en cours
|
||||||
$tech = doquery("SELECT COUNT(id) AS `tech` FROM {{table}} WHERE `id` = '".$user['id']."' and `b_tech_planet`!=0;", 'users', true);
|
$tech = doquery("SELECT COUNT(id) AS `tech` FROM {{table}} WHERE `id` = '".$user['id']."' and `b_tech_planet`!=0;", 'users', true);
|
||||||
//Selectionne si le joueur est en train de se faire attaquer
|
//Selectionne si le joueur est en train de se faire attaquer
|
||||||
$attack = doquery("SELECT COUNT(fleet_taget_owner) AS `attack` FROM {{table}} WHERE `fleet_taget_owner` = '".$user['id']."';", 'fleets', true);
|
$attack = doquery("SELECT COUNT(fleet_taget_owner) AS `attack` FROM {{table}} WHERE `fleet_taget_owner` = '".$user['id']."';", 'fleets', true);
|
||||||
if($fleet['actcnt']=='0' && $build['building']=='0' && $tech['tech']=='0' && $attack['attack']=='0') {
|
|
||||||
$urlaubs_modus = "1";
|
|
||||||
$time = time() + 172800;
|
|
||||||
doquery("UPDATE {{table}} SET
|
|
||||||
`urlaubs_modus` = '$urlaubs_modus',
|
|
||||||
`urlaubs_until` = '$time'
|
|
||||||
WHERE `id` = '$iduser' LIMIT 1", "users");
|
|
||||||
} else {
|
|
||||||
message ( 'Verifiez vos flottes, technologies et batiments','<center><font color=\"red\">Vous avez des actions en cours</font></center>' );
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = doquery("SELECT * FROM {{table}} WHERE id_owner = '{$user['id']}'", 'planets');
|
if ($fleet['actcnt'] == 0 && $build['building'] == 0 && $tech['tech'] == 0 && $attack['attack'] == 0) {
|
||||||
while ($id = $query->fetch(PDO::FETCH_BOTH)){
|
$user->setVacation();
|
||||||
doquery("UPDATE {{table}} SET
|
} else {
|
||||||
metal_perhour = '".$gameConfig['metal_basic_income']."',
|
message(Wootook::__('Could not set to vacation mode.'),
|
||||||
crystal_perhour = '".$gameConfig['metal_basic_income']."',
|
Wootook::__("You currently can't get to vacation mode, please check your flying fleets, and building queues."));
|
||||||
deuterium_perhour = '".$gameConfig['metal_basic_income']."',
|
}
|
||||||
energy_used = '0',
|
|
||||||
energy_max = '0',
|
|
||||||
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');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$urlaubs_modus = "0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Borrar cuenta
|
// Borrar cuenta
|
||||||
|
|
@ -233,7 +191,6 @@ require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||||
`settings_bud` = '$settings_bud',
|
`settings_bud` = '$settings_bud',
|
||||||
`settings_mis` = '$settings_mis',
|
`settings_mis` = '$settings_mis',
|
||||||
`settings_rep` = '$settings_rep',
|
`settings_rep` = '$settings_rep',
|
||||||
`urlaubs_modus` = '$urlaubs_modus',
|
|
||||||
`db_deaktjava` = '$db_deaktjava',
|
`db_deaktjava` = '$db_deaktjava',
|
||||||
`kolorminus` = '$kolorminus',
|
`kolorminus` = '$kolorminus',
|
||||||
`kolorplus` = '$kolorplus',
|
`kolorplus` = '$kolorplus',
|
||||||
|
|
|
||||||
46
overview.php
46
overview.php
|
|
@ -211,20 +211,16 @@ if (isset($_POST) && !empty($_POST)) {
|
||||||
// News Frame ...
|
// News Frame ...
|
||||||
// External Chat Frame ...
|
// External Chat Frame ...
|
||||||
// Banner ADS Google (meme si je suis contre cela)
|
// Banner ADS Google (meme si je suis contre cela)
|
||||||
if ($gameConfig['OverviewNewsFrame'] == '1') {
|
if (Wootook::getGameConfig('game/news/active')) {
|
||||||
$parse['NewsFrame'] = "<tr><th>" . $lang['ov_news_title'] . "</th><th colspan=\"3\">" . stripslashes($gameConfig['OverviewNewsText']) . "</th></tr>";
|
$parse['NewsFrame'] = "<tr><th>" . $lang['ov_news_title'] . "</th><th colspan=\"3\">" . htmlentities(Wootook::getGameConfig('game/news/content'), ENT_QUOTES, 'UTF-8') . "</th></tr>";
|
||||||
}
|
}
|
||||||
if ($gameConfig['OverviewExternChat'] == '1') {
|
if (Wootook::getGameConfig('engine/options/chat')) {
|
||||||
$parse['ExternalTchatFrame'] = "<tr><th colspan=\"4\">" . stripslashes($gameConfig['OverviewExternChatCmd']) . "</th></tr>";
|
$parse['ExternalTchatFrame'] = "<tr><th colspan=\"4\">" . Wootook::__('Open the chat.') . "</th></tr>";
|
||||||
}
|
}
|
||||||
if ($gameConfig['OverviewClickBanner'] != '') {
|
if (Wootook::getGameConfig('engine/options/banner')) {
|
||||||
$parse['ClickBanner'] = stripslashes($gameConfig['OverviewClickBanner']);
|
$bannerUrl = Wootook::getUrl('scripts/createbanner.php', array('id' => $user['id']));
|
||||||
}
|
|
||||||
if ($gameConfig['ForumBannerFrame'] == '1') {
|
|
||||||
|
|
||||||
$BannerURL = Wootook::getUrl('scripts/createbanner.php', array('id' => $user['id']));
|
$parse['bannerframe'] = "<th colspan=\"4\"><img src=\"{$bannerUrl}\"><br>".$lang['InfoBanner']."<br><input name=\"bannerlink\" type=\"text\" id=\"bannerlink\" value=\"[img]".$bannerUrl."[/img]\" size=\"62\"></th></tr>";
|
||||||
|
|
||||||
$parse['bannerframe'] = "<th colspan=\"4\"><img src=\"{$BannerURL}\"><br>".$lang['InfoBanner']."<br><input name=\"bannerlink\" type=\"text\" id=\"bannerlink\" value=\"[img]".$BannerURL."[/img]\" size=\"62\"></th></tr>";
|
|
||||||
}
|
}
|
||||||
// --- Gestion de l'affichage d'une lune ---------------------------------------------------------
|
// --- Gestion de l'affichage d'une lune ---------------------------------------------------------
|
||||||
if ($moon['id']) {
|
if ($moon['id']) {
|
||||||
|
|
@ -276,7 +272,18 @@ if (isset($_POST) && !empty($_POST)) {
|
||||||
$parse['time'] = "<div id=\"dateheure\"></div>";
|
$parse['time'] = "<div id=\"dateheure\"></div>";
|
||||||
$parse['planet_image'] = $planet['image'];
|
$parse['planet_image'] = $planet['image'];
|
||||||
$parse['anothers_planets'] = $planetBlock->render();
|
$parse['anothers_planets'] = $planetBlock->render();
|
||||||
$parse['max_users'] = $gameConfig['users_amount'];
|
|
||||||
|
$db = Wootook_Database::getConnection('default');
|
||||||
|
$displayedPlayerLevels = implode(',', array(
|
||||||
|
//LEVEL_ADMIN,
|
||||||
|
LEVEL_OPERATOR,
|
||||||
|
LEVEL_MODERATOR,
|
||||||
|
LEVEL_PLAYER
|
||||||
|
));
|
||||||
|
$userCountStatement = $db->prepare("SELECT COUNT(DISTINCT user.id) AS `user_count` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels})");
|
||||||
|
$userCountStatement->execute();
|
||||||
|
$userCount = $userCountStatement->fetch(Wootook_Database::FETCH_COLUMN, 0);
|
||||||
|
$parse['max_users'] = $userCount;
|
||||||
|
|
||||||
$galaxyData = $planet->getGalaxyData();
|
$galaxyData = $planet->getGalaxyData();
|
||||||
$parse['metal_debris'] = Math::render($galaxyData['metal']);
|
$parse['metal_debris'] = Math::render($galaxyData['metal']);
|
||||||
|
|
@ -287,12 +294,19 @@ if (isset($_POST) && !empty($_POST)) {
|
||||||
$parse['get_link'] = '';
|
$parse['get_link'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$latestPlayerStatement = $db->prepare("SELECT user.username AS `latest_player` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels}) ORDER BY user.`register_time` DESC LIMIT 1");
|
||||||
|
$latestPlayerStatement->execute();
|
||||||
|
$latestPlayer = $latestPlayerStatement->fetch(Wootook_Database::FETCH_COLUMN, 0);
|
||||||
|
|
||||||
|
$onlinePlayersStatement = $db->prepare("SELECT COUNT(DISTINCT user.id) AS `online_players` FROM {$db->getTable('users')} AS user WHERE user.authlevel IN({$displayedPlayerLevels}) AND user.`onlinetime` > (UNIX_TIMESTAMP() - 900)");
|
||||||
|
$onlinePlayersStatement->execute();
|
||||||
|
$onlinePlayers = $onlinePlayersStatement->fetch(Wootook_Database::FETCH_COLUMN, 0);
|
||||||
|
|
||||||
$query = doquery('SELECT username FROM {{table}} ORDER BY register_time DESC', 'users', true);
|
$query = doquery('SELECT username FROM {{table}} ORDER BY register_time DESC', 'users', true);
|
||||||
$parse['last_user'] = $query['username'];
|
$parse['last_user'] = $latestPlayer;
|
||||||
$query = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE onlinetime>" . (time()-900), 'users', true);
|
$query = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE onlinetime>" . (time()-900), 'users', true);
|
||||||
$parse['online_users'] = $query[0];
|
$parse['online_users'] = $onlinePlayers;
|
||||||
// $count = doquery(","users",true);
|
$parse['users_amount'] = $userCount;
|
||||||
$parse['users_amount'] = $gameConfig['users_amount'];
|
|
||||||
|
|
||||||
// Rajout d'une barre pourcentage
|
// Rajout d'une barre pourcentage
|
||||||
// Calcul du pourcentage de remplissage
|
// Calcul du pourcentage de remplissage
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ includeLang('fleet');
|
||||||
}
|
}
|
||||||
|
|
||||||
$distance = GetTargetDistance ( $planetrow['galaxy'], $Galaxy, $planetrow['system'], $System, $planetrow['planet'], $Planet );
|
$distance = GetTargetDistance ( $planetrow['galaxy'], $Galaxy, $planetrow['system'], $System, $planetrow['planet'], $Planet );
|
||||||
$SpeedFactor = $gameConfig['fleet_speed'] / 2500;
|
$SpeedFactor = Wootook::getGameConfig('game/speed/fleet') / 2500;
|
||||||
$GenFleetSpeed = 10; // a 100%
|
$GenFleetSpeed = 10; // a 100%
|
||||||
$duration = GetMissionDuration ( $GenFleetSpeed, $RecyclerSpeed, $distance, $SpeedFactor );
|
$duration = GetMissionDuration ( $GenFleetSpeed, $RecyclerSpeed, $distance, $SpeedFactor );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ $select = doquery("SELECT * FROM {{table}} WHERE id = ".$ziel_id, 'users', true)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$flugzeit = round(((30 + (60 * $tempvar1)) * 2500) / $gameConfig['game_speed']);
|
$flugzeit = round(((30 + (60 * $tempvar1)) * 2500) / Wootook::getGameConfig('game/speed/general'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,20 +33,13 @@ define('INSTALL' , false);
|
||||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||||
|
|
||||||
function BuildRessourcePage($CurrentUser, $CurrentPlanet ) {
|
function BuildRessourcePage($CurrentUser, $CurrentPlanet ) {
|
||||||
global $lang, $gameConfig;
|
global $lang;
|
||||||
|
|
||||||
includeLang('resources');
|
includeLang('resources');
|
||||||
|
|
||||||
$RessBodyTPL = gettemplate('resources');
|
$RessBodyTPL = gettemplate('resources');
|
||||||
$RessRowTPL = gettemplate('resources_row');
|
$RessRowTPL = gettemplate('resources_row');
|
||||||
|
|
||||||
// Si c'est une lune ... pas de ressources produites
|
|
||||||
if ($CurrentPlanet['planet_type'] == 3) {
|
|
||||||
$gameConfig['metal_basic_income'] = 0;
|
|
||||||
$gameConfig['crystal_basic_income'] = 0;
|
|
||||||
$gameConfig['deuterium_basic_income'] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$request = Wootook::getRequest();
|
$request = Wootook::getRequest();
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
foreach ($request->getPost() as $buildingField => $value) {
|
foreach ($request->getPost() as $buildingField => $value) {
|
||||||
|
|
@ -142,10 +135,18 @@ function BuildRessourcePage($CurrentUser, $CurrentPlanet ) {
|
||||||
$parse['production_level'] = 100;
|
$parse['production_level'] = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parse['metal_basic_income'] = $gameConfig['metal_basic_income'] * $gameConfig['resource_multiplier'];
|
if ($CurrentPlanet['planet_type'] == Wootook_Empire_Model_Planet::TYPE_PLANET) {
|
||||||
$parse['crystal_basic_income'] = $gameConfig['crystal_basic_income'] * $gameConfig['resource_multiplier'];
|
$multiplier = Wootook::getGameConfig('game/resource/multiplier');
|
||||||
$parse['deuterium_basic_income'] = $gameConfig['deuterium_basic_income'] * $gameConfig['resource_multiplier'];
|
$parse['metal_basic_income'] = Wootook::getGameConfig('resource/base-income/metal') * $multiplier;
|
||||||
$parse['energy_basic_income'] = $gameConfig['energy_basic_income'] * $gameConfig['resource_multiplier'];
|
$parse['crystal_basic_income'] = Wootook::getGameConfig('resource/base-income/cristal') * $multiplier;
|
||||||
|
$parse['deuterium_basic_income'] = Wootook::getGameConfig('resource/base-income/deuterium') * $multiplier;
|
||||||
|
$parse['energy_basic_income'] = Wootook::getGameConfig('resource/base-income/energy') * $multiplier;
|
||||||
|
} else {
|
||||||
|
$parse['metal_basic_income'] = 0;
|
||||||
|
$parse['crystal_basic_income'] = 0;
|
||||||
|
$parse['deuterium_basic_income'] = 0;
|
||||||
|
$parse['energy_basic_income'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if ($CurrentPlanet['metal_max'] < $CurrentPlanet['metal']) {
|
if ($CurrentPlanet['metal_max'] < $CurrentPlanet['metal']) {
|
||||||
$parse['metal_max'] = "<font color=\"#ff0000\">";
|
$parse['metal_max'] = "<font color=\"#ff0000\">";
|
||||||
|
|
|
||||||
15
rules.php
15
rules.php
|
|
@ -32,15 +32,12 @@ define('INSIDE' , true);
|
||||||
define('INSTALL' , false);
|
define('INSTALL' , false);
|
||||||
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
require_once dirname(__FILE__) .'/application/bootstrap.php';
|
||||||
|
|
||||||
includeLang('rules');
|
includeLang('rules');
|
||||||
|
|
||||||
$parse = $lang;
|
$parse = $lang;
|
||||||
$parse['servername'] = $gameConfig['game_name'];
|
$parse['servername'] = Wootook::getGameConfig('game/general/name');
|
||||||
|
|
||||||
$PageTPL = gettemplate('rules_body');
|
$PageTPL = gettemplate('rules_body');
|
||||||
$page = parsetemplate( $PageTPL, $parse);
|
$page = parsetemplate( $PageTPL, $parse);
|
||||||
|
|
||||||
display($page, $lang['rules'], false);
|
display($page, $lang['rules'], false);
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue