/** _ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5 ¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core. * @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution * @link: http://www.xnovarevolution.con.ar * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ * Please do not remove the credits */ function ShowTopKB() { global $USER, $PLANET, $LNG, $UNI, $db, $LANG; $mode = request_var('mode', ''); $template = new template(); switch ($mode) { case "showkb": $template->isPopup(true); $LANG->includeLang(array('FLEET')); $ReportID = request_var('rid', ''); if (file_exists(ROOT_PATH . 'raports/topkb_' . $ReportID . '.php')) { require_once ROOT_PATH . 'raports/topkb_' . $ReportID . '.php'; $RaportRAW = $db->uniquequery("SELECT `angreifer`, `defender` FROM " . TOPKB . " WHERE `rid` = '" . $db->sql_escape($ReportID) . "';"); } foreach ($LNG['tech_rc'] as $id => $s_name) { $ship[] = "[ship[" . $id . "]]"; $shipname[] = $s_name; } $template->assign_vars(array('attacker' => $RaportRAW['angreifer'], 'defender' => $RaportRAW['defender'], 'report' => $raport)); $template->show("topkb_report.tpl"); break; default: $PlanetRess = new ResourceUpdate(); $PlanetRess->CalcResource(); $PlanetRess->SavePlanetToDB(); $top = $db->query("SELECT * FROM " . TOPKB . " WHERE `universe` = '" . $UNI . "' ORDER BY gesamtunits DESC LIMIT 100;"); while ($data = $db->fetch_array($top)) { $TopKBList[] = array('result' => $data['fleetresult'], 'time' => date(TDFORMAT, $data['time']), 'units' => pretty_number($data['gesamtunits']), 'rid' => $data['rid'], 'attacker' => $data['angreifer'], 'defender' => $data['defender'], 'result' => $data['fleetresult']); } $db->free_result($top); $template->assign_vars(array('tkb_units' => $LNG['tkb_units'], 'tkb_datum' => $LNG['tkb_datum'], 'tkb_owners' => $LNG['tkb_owners'], 'tkb_platz' => $LNG['tkb_platz'], 'tkb_top' => $LNG['tkb_top'], 'tkb_gratz' => $LNG['tkb_gratz'], 'tkb_legende' => $LNG['tkb_legende'], 'tkb_gewinner' => $LNG['tkb_gewinner'], 'tkb_verlierer' => $LNG['tkb_verlierer'], 'TopKBList' => $TopKBList)); $template->show("topkb_overview.tpl"); break; } }
/** _ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5 ¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core. * @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution * @link: http://www.xnovarevolution.con.ar * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ * Please do not remove the credits */ function ShowFleetShortcuts() { global $USER, $LNG, $db; $a = request_var('a', ''); $mode = request_var('mode', ''); $template = new template(); $template->isPopup(true); if ($mode == "add") { if ($_POST) { $name = request_var('n', $LNG['fl_anonymous']); $gala = request_var('g', 0); $sys = request_var('s', 0); $plan = request_var('p', 0); $type = request_var('t', 0); $USER['fleet_shortcut'] .= $name . ',' . $gala . ',' . $sys . ',' . $plan . ',' . $type . "\r\n"; $db->query("UPDATE " . USERS . " SET `fleet_shortcut` = '" . $db->sql_escape($USER['fleet_shortcut']) . "' WHERE `id` = '" . $USER['id'] . "';"); redirectTo("game.php" . "?page=shortcuts"); } $template->assign_vars(array('fl_shortcut_add_title' => $LNG['fl_shortcut_add_title'], 'fl_clean' => $LNG['fl_clean'], 'fl_register_shorcut' => $LNG['fl_register_shorcut'], 'fl_back' => $LNG['fl_back'], 'typeselector' => array(1 => $LNG['fl_planet'], 2 => $LNG['fl_debris'], 3 => $LNG['fl_moon']))); $template->show("fleet_shortcuts_add.tpl"); } elseif (is_numeric($a)) { $scarray = explode("\r\n", $USER['fleet_shortcut']); $r = explode(",", $scarray[$a]); if ($_POST) { if ($_POST['delete']) { unset($scarray[$a]); } else { $r[0] = request_var('n', ''); $r[1] = request_var('g', 0); $r[2] = request_var('s', 0); $r[3] = request_var('p', 0); $r[4] = request_var('t', 0); $scarray[$a] = implode(",", $r); } $USER['fleet_shortcut'] = implode("\r\n", $scarray); $db->query("UPDATE " . USERS . " SET fleet_shortcut = '" . $db->sql_escape($USER['fleet_shortcut']) . "' WHERE id=" . $USER['id'] . ";"); exit(redirectTo("game.php" . "?page=shortcuts")); } if (empty($USER['fleet_shortcut'])) { redirectTo("game.php" . "?page=shortcuts"); } $template->assign_vars(array('fl_back' => $LNG['fl_back'], 'fl_shortcut_edition' => $LNG['fl_shortcut_edition'], 'fl_reset_shortcut' => $LNG['fl_reset_shortcut'], 'fl_register_shorcut' => $LNG['fl_register_shorcut'], 'fl_dlte_shortcut' => $LNG['fl_dlte_shortcut'], 'typeselector' => array(1 => $LNG['fl_planet'], 2 => $LNG['fl_debris'], 3 => $LNG['fl_moon']), 'name' => $r[0], 'galaxy' => $r[1], 'system' => $r[2], 'planet' => $r[3], 'type' => $r[4], 'id' => $a)); $template->show("fleet_shortcuts_edit.tpl"); } else { $scarray = explode("\r\n", $USER['fleet_shortcut']); foreach ($scarray as $b) { if (empty($b)) { continue; } $c = explode(',', $b); $ShortCuts[] = array('name' => $c[0], 'galaxy' => $c[1], 'system' => $c[2], 'planet' => $c[3], 'type' => $c[4]); } $template->assign_vars(array('ShortCuts' => $ShortCuts, 'fl_back' => $LNG['fl_back'], 'fl_planet_shortcut' => $LNG['fl_planet_shortcut'], 'fl_moon_shortcut' => $LNG['fl_moon_shortcut'], 'fl_debris_shortcut' => $LNG['fl_debris_shortcut'], 'fl_no_shortcuts' => $LNG['fl_no_shortcuts'], 'fl_shortcuts' => $LNG['fl_shortcuts'], 'fl_shortcut_add' => $LNG['fl_shortcut_add'])); $template->show("fleet_shortcuts.tpl"); } }
/** * 2Moons * Copyright (C) 2011 Slaver * * 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/>. * * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ */ function ShowLogoutPage() { global $LNG, $SESSION; $SESSION->DestroySession(); $template = new template(); $template->cache = true; $template->isPopup(true); $template->assign_vars(array('lo_title' => $LNG['lo_title'], 'lo_logout' => $LNG['lo_logout'], 'lo_redirect' => $LNG['lo_redirect'], 'lo_notify' => $LNG['lo_notify'], 'lo_continue' => $LNG['lo_continue'])); $template->show("logout_overview.tpl"); }
private function ShowIndexPage() { global $LNG, $db, $USER; $template = new template(); $template->isPopup(true); $NotesRAW = $db->query("SELECT * FROM " . NOTES . " WHERE owner = " . $USER['id'] . " ORDER BY time DESC;"); $NoteList = array(); while ($Note = $db->fetch_array($NotesRAW)) { $NoteList[] = array('id' => $Note['id'], 'time' => date(TDFORMAT, $Note['time']), 'title' => $Note['title'], 'size' => strlen($Note['text']), 'priority' => $Note['priority']); } $template->assign_vars(array('NoteList' => $NoteList, 'nt_priority' => $LNG['nt_you_dont_have_notes'], 'nt_size_note' => $LNG['nt_size_note'], 'nt_date_note' => $LNG['nt_date_note'], 'nt_notes' => $LNG['nt_notes'], 'nt_create_new_note' => $LNG['nt_create_new_note'], 'nt_subject_note' => $LNG['nt_subject_note'], 'nt_dlte_note' => $LNG['nt_dlte_note'], 'nt_you_dont_have_notes' => $LNG['nt_you_dont_have_notes'])); $template->show('notes_body.tpl'); }
/** _ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5 ¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core. * @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution * @link: http://www.xnovarevolution.con.ar * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ * Please do not remove the credits */ function ShowPlayerCard() { global $USER, $PLANET, $LNG, $UNI, $db; $template = new template(); $template->isPopup(true); $playerid = request_var('id', 0); $query = $db->uniquequery("SELECT a.wons, a.loos, a.draws, a.kbmetal, a.kbcrystal, a.kbnorio, a.lostunits, a.desunits, a.ally_id, a.ally_name, a.username, a.galaxy, a.system, a.planet, b.name, c.tech_rank, c.tech_points, c.build_rank, c.build_points, c.defs_rank, c.defs_points, c.fleet_rank, c.fleet_points, c.total_rank, c.total_points FROM " . USERS . " as a, " . PLANETS . " as b, " . STATPOINTS . " as c WHERE a.universe = '" . $UNI . "' AND a.id = '" . $db->sql_escape($playerid) . "' AND a.id_planet = b.id AND a.id = c.id_owner AND c.stat_type = 1;"); $totalfights = $query['wons'] + $query['loos'] + $query['draws']; if ($totalfights == 0) { $siegprozent = 0; $loosprozent = 0; $drawsprozent = 0; } else { $siegprozent = 100 / $totalfights * $query['wons']; $loosprozent = 100 / $totalfights * $query['loos']; $drawsprozent = 100 / $totalfights * $query['draws']; } $template->assign_vars(array('id' => $playerid, 'yourid' => $USER['id'], 'name' => $query['username'], 'homeplanet' => $query['name'], 'galaxy' => $query['galaxy'], 'system' => $query['system'], 'planet' => $query['planet'], 'allyid' => $query['ally_id'], 'tech_rank' => pretty_number($query['tech_rank']), 'tech_points' => pretty_number($query['tech_points']), 'build_rank' => pretty_number($query['build_rank']), 'build_points' => pretty_number($query['build_points']), 'defs_rank' => pretty_number($query['defs_rank']), 'defs_points' => pretty_number($query['defs_points']), 'fleet_rank' => pretty_number($query['fleet_rank']), 'fleet_points' => pretty_number($query['fleet_points']), 'total_rank' => pretty_number($query['total_rank']), 'total_points' => pretty_number($query['total_points']), 'allyname' => $query['ally_name'], 'playerdestory' => sprintf($LNG['pl_destroy'], $query['username']), 'wons' => pretty_number($query['wons']), 'loos' => pretty_number($query['loos']), 'draws' => pretty_number($query['draws']), 'kbmetal' => pretty_number($query['kbmetal']), 'kbcrystal' => pretty_number($query['kbcrystal']), 'kbnorio' => pretty_number($query['kbnorio']), 'lostunits' => pretty_number($query['lostunits']), 'desunits' => pretty_number($query['desunits']), 'totalfights' => pretty_number($totalfights), 'siegprozent' => round($siegprozent, 2), 'loosprozent' => round($loosprozent, 2), 'drawsprozent' => round($drawsprozent, 2), 'pl_name' => $LNG['pl_name'], 'pl_overview' => $LNG['pl_overview'], 'pl_ally' => $LNG['pl_ally'], 'pl_message' => $LNG['pl_message'], 'pl_range' => $LNG['pl_range'], 'pl_builds' => $LNG['pl_builds'], 'pl_tech' => $LNG['pl_tech'], 'pl_fleet' => $LNG['pl_fleet'], 'pl_def' => $LNG['pl_def'], 'pl_fightstats' => $LNG['pl_fightstats'], 'pl_fights' => $LNG['pl_fights'], 'pl_fprocent' => $LNG['pl_fprocent'], 'pl_fightstats' => $LNG['pl_fightstats'], 'pl_fights' => $LNG['pl_fights'], 'pl_fprocent' => $LNG['pl_fprocent'], 'pl_fightwon' => $LNG['pl_fightwon'], 'pl_fightdraw' => $LNG['pl_fightdraw'], 'pl_fightlose' => $LNG['pl_fightlose'], 'pl_totalfight' => $LNG['pl_totalfight'], 'pl_unitsshot' => $LNG['pl_unitsshot'], 'pl_unitslose' => $LNG['pl_unitslose'], 'pl_dermetal' => $LNG['pl_dermetal'], 'pl_dercrystal' => $LNG['pl_dercrystal'], 'pl_dernorio' => $LNG['pl_dernorio'], 'pl_total' => $LNG['pl_total'], 'pl_buddy' => $LNG['pl_buddy'], 'pl_points' => $LNG['pl_points'], 'pl_homeplanet' => $LNG['pl_homeplanet'], 'pl_etc' => $LNG['pl_etc'])); $template->show("playercard_overview.tpl"); }
public function __construct() { global $CONF, $dpath, $LNG, $db, $USER, $PLANET; $mode = request_var('mode', ''); $msg = request_var('msg', '', true); $ctype = request_var('chat_type', ''); $MessageID = request_var('id', 0); switch ($mode) { case "delete": $this->DelMeassageFromChat($MessageID); break; case "send": $this->SetMeassageInChat($ctype, $msg); break; case "call": $this->GetMessages($ctype); break; default: $template = new template(); $template->execscript("showMessage();setInterval(showMessage, 10000);"); $template->loadscript("chat.js"); if (empty($ctype)) { $PlanetRess = new ResourceUpdate(); $PlanetRess->CalcResource(); $PlanetRess->SavePlanetToDB(); } else { $template->isPopup(true); } $template->assign_vars(array('ctype' => $ctype, 'chat_send' => $LNG['chat_send'], 'chat_disc' => $LNG['chat_disc'], 'chat_message' => $LNG['chat_message'], 'chat_bbcode' => $LNG['chat_bbcode'], 'chat_fontcolor' => $LNG['chat_fontcolor'], 'chat_color_white' => $LNG['chat_color_white'], 'chat_color_blue' => $LNG['chat_color_blue'], 'chat_color_yellow' => $LNG['chat_color_yellow'], 'chat_color_green' => $LNG['chat_color_green'], 'chat_color_pink' => $LNG['chat_color_pink'], 'chat_color_red' => $LNG['chat_color_red'], 'chat_color_orange' => $LNG['chat_color_orange'], 'chat_notext' => $LNG['chat_notext'], 'chat_request_url' => $LNG['chat_request_url'], 'chat_request_url_desc' => $LNG['chat_request_url_desc'])); $template->show("chat_overview.tpl"); break; } }
/** _ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5 ¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core. * @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution * @link: http://www.xnovarevolution.con.ar * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ * Please do not remove the credits */ function ShowPhalanxPage() { global $USER, $PLANET, $LNG, $db, $UNI; include_once ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.php'; include_once ROOT_PATH . 'includes/classes/class.FlyingFleetsTable.php'; include_once ROOT_PATH . 'includes/classes/class.GalaxyRows.php'; $FlyingFleetsTable = new FlyingFleetsTable(); $GalaxyRows = new GalaxyRows(); $template = new template(); $template->isPopup(true); $template->loadscript('phalanx.js'); $template->execscript('FleetTime();window.setInterval("FleetTime()", 1000);'); $PhRange = $GalaxyRows->GetPhalanxRange($PLANET['phalanx']); $Galaxy = request_var('galaxy', 0); $System = request_var('system', 0); $Planet = request_var('planet', 0); if ($Galaxy != $PLANET['galaxy'] || $System > $PLANET['system'] + $PhRange || $System < max(1, $PLANET['system'] - $PhRange)) { $template->message($LNG['px_out_of_range'], false, 0, true); exit; } if ($PLANET['deuterium'] < 5000) { $template->message($LNG['px_no_deuterium'], false, 0, true); exit; } $PLANET['deuterium'] -= 5000; $db->query("UPDATE " . PLANETS . " SET `deuterium` = `deuterium` - '5000' WHERE `id` = '" . $PLANET['id'] . "';"); $TargetInfo = $db->uniquequery("SELECT id, name, id_owner FROM " . PLANETS . " WHERE`universe` = '" . $UNI . "' AND `galaxy` = '" . $Galaxy . "' AND `system` = '" . $System . "' AND `planet` = '" . $Planet . "' AND `planet_type` = '1';"); if (empty($TargetInfo)) { $template->message($LNG['px_out_of_range'], false, 0, true); exit; } $FleetToTarget = $db->query("SELECT * FROM " . FLEETS . " WHERE `fleet_start_id` = '" . $TargetInfo['id'] . "' OR `fleet_end_id` = '" . $TargetInfo['id'] . "' ORDER BY `fleet_start_time`;"); $fpage = array(); $FleetData = array(); $_SESSION['USER']['spy_tech'] = 8; while ($FleetRow = $db->fetch_array($FleetToTarget)) { $Record++; $IsOwner = $FleetRow['fleet_owner'] == $TargetInfo['id_owner'] ? true : false; $FleetRow['fleet_resource_metal'] = 0; $FleetRow['fleet_resource_crystal'] = 0; $FleetRow['fleet_resource_deuterium'] = 0; $FleetRow['fleet_resource_norio'] = 0; $FleetRow['fleet_resource_darkmatter'] = 0; if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] > TIMESTAMP) { $fpage[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, $IsOwner, 'fs', $Record); $FleetData[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_start_time'] . $FleetRow['fleet_id']]['fleet_return']; } if ($FleetRow['fleet_mission'] == 4) { continue; } if ($FleetRow['fleet_mess'] != 1 && $FleetRow['fleet_end_stay'] > TIMESTAMP) { $fpage[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, $IsOwner, 'ft', $Record); $FleetData[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_end_stay'] . $FleetRow['fleet_id']]['fleet_return']; } if ($IsOwner == false) { continue; } if ($FleetRow['fleet_end_time'] > TIMESTAMP) { $fpage[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, $IsOwner, 'fe', $Record); $FleetData[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']] = $fpage[$FleetRow['fleet_end_time'] . $FleetRow['fleet_id']]['fleet_return']; } } $_SESSION['USER']['spy_tech'] = $USER['spy_tech']; $db->free_result($FleetToTarget); if (!empty($fpage)) { ksort($fpage); } $template->assign_vars(array('phl_pl_galaxy' => $Galaxy, 'phl_pl_system' => $System, 'phl_pl_place' => $Planet, 'phl_pl_name' => $TargetInfo['name'], 'fleets' => $fpage, 'FleetData' => json_encode($FleetData), 'px_scan_position' => $LNG['px_scan_position'], 'px_no_fleet' => $LNG['px_no_fleet'], 'px_fleet_movement' => $LNG['px_fleet_movement'])); $template->show('phalax_body.tpl'); }
public function __construct() { global $USER, $PLANET, $dpath, $LNG, $resource, $pricelist, $reslist, $CombatCaps, $ProdGrid, $CONF, $OfficerInfo; $BuildID = request_var('gid', 0); $template = new template(); $template->isPopup(true); if (in_array($BuildID, $reslist['prod']) && $BuildID != 212) { $BuildLevelFactor = 10; $BuildTemp = $PLANET['temp_max']; $CurrentBuildtLvl = $PLANET[$resource[$BuildID]]; $BuildEnergy = $USER[$resource[113]]; /*$BuildLevel = ($CurrentBuildtLvl > 0) ? $CurrentBuildtLvl : 1; $Prod[1] = (floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[703]] <= 0) ? ($ExtraDM[703]['add']) : 0)); $Prod[2] = (floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[703]] <= 0) ? ($ExtraDM[703]['add']) : 0)); $Prod[7] = (floor(eval($ProdGrid[$BuildID]['formule']['norio']) * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[703]] <= 0) ? ($ExtraDM[703]['add']) : 0)); $Prod[3] = (floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[703]] <= 0) ? ($ExtraDM[703]['add']) : 0)); $Prod[4] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']) * (1 + (TIMESTAMP - $USER[$resource[704]] <= 0) ? ($ExtraDM[704]['add']) : 0)); $Prod[12] = (floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']));*/ $BuildLevel = max($CurrentBuildtLvl, 1); $Prod[1] = round(eval($ProdGrid[$BuildID]['formule']['metal']) * $CONF['resource_multiplier']); $Prod[2] = round(eval($ProdGrid[$BuildID]['formule']['crystal']) * $CONF['resource_multiplier']); $Prod[7] = round(eval($ProdGrid[$BuildID]['formule']['norio']) * $CONF['resource_multiplier']); $Prod[3] = round(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']); $Prod[4] = round(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']); $Prod[12] = round(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']); $BuildStartLvl = max($CurrentBuildtLvl - 2, 1); $ActualProd = floor($Prod[$BuildID]); $ActualNeed = $BuildID != 12 ? floor($Prod[4]) : floor($Prod[3]); $ProdFirst = 0; for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 15; $BuildLevel++) { /*$Prod[1] = floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $CONF['resource_multiplier']); $Prod[2] = floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $CONF['resource_multiplier']); $Prod[3] = floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']); $Prod[4] = floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']); $Prod[7] = floor(eval($ProdGrid[$BuildID]['formule']['norio']) * $CONF['resource_multiplier']); $Prod[12] = floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']);*/ $Prod[1] = round(eval($ProdGrid[$BuildID]['formule']['metal']) * $CONF['resource_multiplier']); $Prod[2] = round(eval($ProdGrid[$BuildID]['formule']['crystal']) * $CONF['resource_multiplier']); $Prod[3] = round(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']); $Prod[7] = round(eval($ProdGrid[$BuildID]['formule']['norio']) * $CONF['resource_multiplier']); $Prod[4] = round(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']); $Prod[12] = round(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']); $NeesRess = $BuildID != 12 ? floor($Prod[4]) : floor($Prod[3]); $prod = pretty_number(floor($Prod[$BuildID])); $prod_diff = colorNumber(pretty_number(floor($Prod[$BuildID] - $ActualProd))); $need = colorNumber(pretty_number(floor($NeesRess))); $need_diff = colorNumber(pretty_number(floor($NeesRess - $ActualNeed))); if ($ProdFirst == 0) { $ProdFirst = floor($Prod[$BuildID]); } $ProductionTable[] = array('BuildLevel' => $BuildLevel, 'prod' => $prod, 'prod_diff' => $prod_diff, 'need' => $need, 'need_diff' => $need_diff); } } elseif (in_array($BuildID, $reslist['fleet'])) { for ($Type = 200; $Type < 500; $Type++) { if ($CombatCaps[$BuildID]['sd'][$Type] > 1) { $RapidFire['to'][$LNG['tech'][$Type]] = $CombatCaps[$BuildID]['sd'][$Type]; } if ($CombatCaps[$Type]['sd'][$BuildID] > 1) { $RapidFire['from'][$LNG['tech'][$Type]] = $CombatCaps[$Type]['sd'][$BuildID]; } } $FleetInfo[$LNG['in_struct_pt']] = pretty_number($pricelist[$BuildID]['metal'] + $pricelist[$BuildID]['crystal'] + $pricelist[$BuildID]['norio']); $FleetInfo[$LNG['in_shield_pt']] = pretty_number($CombatCaps[$BuildID]['shield']); $FleetInfo[$LNG['in_attack_pt']] = pretty_number($CombatCaps[$BuildID]['attack']); $FleetInfo[$LNG['in_capacity']] = pretty_number($pricelist[$BuildID]['capacity']); $FleetInfo[$LNG['in_base_speed']][] = pretty_number($pricelist[$BuildID]['speed']); $FleetInfo[$LNG['in_consumption']][] = pretty_number($pricelist[$BuildID]['consumption']); $FleetInfo[$LNG['in_base_speed']][] = pretty_number($pricelist[$BuildID]['speed2']); $FleetInfo[$LNG['in_consumption']][] = pretty_number($pricelist[$BuildID]['consumption2']); } elseif (in_array($BuildID, $reslist['defense'])) { for ($Type = 200; $Type < 500; $Type++) { if ($CombatCaps[$BuildID]['sd'][$Type] > 1) { $RapidFire['to'][$LNG['tech'][$Type]] = $CombatCaps[$BuildID]['sd'][$Type]; } if ($CombatCaps[$Type]['sd'][$BuildID] > 1) { $RapidFire['from'][$LNG['tech'][$Type]] = $CombatCaps[$Type]['sd'][$BuildID]; } } $FleetInfo[$LNG['in_struct_pt']] = pretty_number($pricelist[$BuildID]['metal'] + $pricelist[$BuildID]['crystal'] + $pricelist[$BuildID]['norio']); $FleetInfo[$LNG['in_shield_pt']] = pretty_number($CombatCaps[$BuildID]['shield']); $FleetInfo[$LNG['in_attack_pt']] = pretty_number($CombatCaps[$BuildID]['attack']); } elseif ($BuildID == 43 && $PLANET[$resource[43]] > 0) { $template->loadscript('flotten.js'); $GateFleetList['jump'] = $this->DoFleetJump(); $RestString = $this->GetNextJumpWaitTime($PLANET); if ($RestString['value'] != 0) { include_once ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.php'; $template->assign_vars(array('gate_time_script' => InsertJavaScriptChronoApplet("Gate", "1", $RestString['value'], true), 'gate_script_go' => InsertJavaScriptChronoApplet("Gate", "1", $RestString['value'], false))); } $GateFleetList['start_link'] = BuildPlanetAdressLink($PLANET); $GateFleetList['moons'] = $this->BuildJumpableMoonCombo($USER, $PLANET); $GateFleetList['fleets'] = $this->BuildFleetListRows($PLANET); } if (in_array($BuildID, $reslist['officier'])) { $description = $OfficerInfo[$BuildID]['info'] ? sprintf($LNG['info'][$BuildID]['description'], is_float($OfficerInfo[$BuildID]['info']) ? $OfficerInfo[$BuildID]['info'] * 100 : $OfficerInfo[$BuildID]['info'], $pricelist[$BuildID]['max']) : sprintf($LNG['info'][$BuildID]['description'], $pricelist[$BuildID]['max']); } else { $description = $LNG['info'][$BuildID]['description']; } $template->assign_vars(array('id' => $BuildID, 'name' => $LNG['info'][$BuildID]['name'], 'image' => $BuildID, 'description' => $description, 'ProductionTable' => $ProductionTable, 'RapidFire' => $RapidFire, 'Level' => $CurrentBuildtLvl, 'FleetInfo' => $FleetInfo, 'GateFleetList' => $GateFleetList, 'in_jump_gate_jump' => $LNG['in_jump_gate_jump'], 'gate_ship_dispo' => $LNG['in_jump_gate_available'], 'in_level' => $LNG['in_level'], 'in_prod_p_hour' => $LNG['in_prod_p_hour'], 'in_difference' => $LNG['in_difference'], 'in_used_energy' => $LNG['in_used_energy'], 'in_prod_energy' => $LNG['in_prod_energy'], 'in_used_deuter' => $LNG['in_used_deuter'], 'in_rf_again' => $LNG['in_rf_again'], 'in_rf_from' => $LNG['in_rf_from'], 'in_jump_gate_select_ships' => $LNG['in_jump_gate_select_ships'], 'in_jump_gate_start_moon' => $LNG['in_jump_gate_start_moon'], 'in_jump_gate_finish_moon' => $LNG['in_jump_gate_finish_moon'], 'in_jump_gate_wait_time' => $LNG['in_jump_gate_wait_time'])); $template->show('info_overview.tpl'); }
<?php /** _ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5 ¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core. * @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution * @link: http://www.xnovarevolution.con.ar * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ * Please do not remove the credits */ define('INSIDE', true); define('ROOT_PATH', './'); include ROOT_PATH . 'common.php'; $LANG->includeLang(array('FLEET', 'TECH')); $RID = request_var('raport', ''); if (file_exists(ROOT_PATH . 'raports/raport_' . $RID . '.php')) { require_once ROOT_PATH . 'raports/raport_' . $RID . '.php'; } $template = new template(); $template->isPopup(true); $template->execscript('</script><script type="text/javascript" src="http://savekb.2moons.cc/js.php">'); $template->assign_vars(array('raport' => $raport)); $template->show('raport.tpl');
/** * 2Moons * Copyright (C) 2011 Slaver * * 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/>. * * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ */ function ShowMessagesPage() { global $USER, $PLANET, $CONF, $dpath, $LNG, $db, $UNI; $MessCategory = request_var('messcat', 0); $MessPageMode = request_var('mode', ''); $DeleteWhat = request_var('deletemessages', ''); $Send = request_var('send', 0); $OwnerID = request_var('id', 0); $Subject = request_var('subject', '', true); $MessageType = array(0, 1, 2, 3, 4, 5, 15, 50, 99, 100, 999); $TitleColor = array(0 => '#FFFF00', 1 => '#FF6699', 2 => '#FF3300', 3 => '#FF9900', 4 => '#773399', 5 => '#009933', 15 => '#6495ed', 50 => '#666600', 99 => '#007070', 100 => '#ABABAB', 999 => '#CCCCCC'); $template = new template(); switch ($MessPageMode) { case 'write': $template->isPopup(true); $OwnerRecord = $db->uniquequery("SELECT a.galaxy, a.system, a.planet, b.username, b.id_planet FROM " . PLANETS . " as a, " . USERS . " as b WHERE b.id = '" . $OwnerID . "' AND a.id = b.id_planet;"); if (!$OwnerRecord) { $template->message($LNG['mg_error'], false, 0, true); } if ($Send) { $Owner = $OwnerID; $Message = makebr(request_var('text', '', true)); $From = $USER['username'] . ' [' . $USER['galaxy'] . ':' . $USER['system'] . ':' . $USER['planet'] . ']'; if (connection_aborted()) { exit; } SendSimpleMessage($OwnerID, $USER['id'], '', 1, $From, $Subject, $Message); exit($LNG['mg_message_send']); } $template->assign_vars(array('mg_send_new' => $LNG['mg_send_new'], 'mg_send_to' => $LNG['mg_send_to'], 'mg_send' => $LNG['mg_send'], 'mg_message' => $LNG['mg_message'], 'mg_characters' => $LNG['mg_characters'], 'mg_subject' => $LNG['mg_subject'], 'mg_empty_text' => $LNG['mg_empty_text'], 'subject' => empty($Subject) ? $LNG['mg_no_subject'] : $Subject, 'id' => $OwnerID, 'username' => $OwnerRecord['username'], 'galaxy' => $OwnerRecord['galaxy'], 'system' => $OwnerRecord['system'], 'planet' => $OwnerRecord['planet'])); $template->show("message_send_form.tpl"); break; default: $PlanetRess = new ResourceUpdate(); $PlanetRess->CalcResource(); $PlanetRess->SavePlanetToDB(); $template->loadscript('message.js'); $MessOut = $db->countquery("SELECT COUNT(*) FROM " . MESSAGES . " WHERE message_sender = '" . $USER['id'] . "';"); $OpsList = array(); $TotalMess = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 15 => 0, 50 => 0, 99 => 0, 100 => 0, 999 => 0); $UnRead = array(0 => 0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 15 => 0, 50 => 0, 99 => 0, 100 => 0, 999 => 0); $GameOps = $db->query("SELECT `username`, `email` FROM " . USERS . " WHERE `universe` = '" . $UNI . "' AND`authlevel` != '0' ORDER BY `username` ASC;"); while ($Ops = $db->fetch_array($GameOps)) { $OpsList[] = array('username' => $Ops['username'], 'email' => $Ops['email']); } $db->free_result($GameOps); $UsrMess = $db->query("SELECT `message_type`, `message_unread` FROM " . MESSAGES . " WHERE `message_owner` = '" . $USER['id'] . "' OR `message_type` = '50';"); while ($CurMess = $db->fetch_array($UsrMess)) { $UnRead[$CurMess['message_type']] += $CurMess['message_unread']; $TotalMess[$CurMess['message_type']] += 1; } $db->free_result($UsrMess); $UnRead[50] += $USER['new_gmessage']; $UnRead[100] = is_array($UnRead) ? array_sum($UnRead) : 0; $TotalMess[100] = is_array($TotalMess) ? array_sum($TotalMess) - $TotalMess[50] : 0; $TotalMess[999] = $MessOut; foreach ($TitleColor as $MessageID => $MessageColor) { $MessageList[$MessageID] = array('color' => $MessageColor, 'unread' => !empty($UnRead[$MessageID]) ? $UnRead[$MessageID] : 0, 'total' => !empty($TotalMess[$MessageID]) ? $TotalMess[$MessageID] : 0, 'lang' => $LNG['mg_type'][$MessageID]); } $template->assign_vars(array('MessageList' => $MessageList, 'OpsList' => $OpsList, 'mg_overview' => $LNG['mg_overview'], 'mg_game_operators' => $LNG['mg_game_operators'])); $template->show("message_overview.tpl"); break; } }
/** * 2Moons * Copyright (C) 2011 Slaver * * 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/>. * * @package 2Moons * @author Slaver <*****@*****.**> * @copyright 2009 Lucky <*****@*****.**> (XGProyecto) * @copyright 2011 Slaver <*****@*****.**> (Fork/2Moons) * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License * @version 1.3 (2011-01-21) * @link http://code.google.com/p/2moons/ */ function ShowBuddyPage() { global $USER, $PLANET, $LNG, $db; $template = new template(); $bid = request_var('bid', 0); $uid = request_var('u', 0); $mode = request_var('mode', 0); $sm = request_var('sm', 0); switch ($mode) { case 1: switch ($sm) { case 1: $db->query("DELETE FROM " . BUDDY . " WHERE `id`='" . $bid . "';"); redirectTo("game.php" . "?page=buddy"); break; case 2: $db->query("UPDATE " . BUDDY . " SET `active` = '1' WHERE `id` ='" . $bid . "';"); redirectTo("game.php" . "?page=buddy"); break; case 3: $test = $db->uniquequery("SELECT `id` FROM " . BUDDY . " WHERE (`sender`='" . $USER['id'] . "' AND `owner`='" . $uid . "') OR (`owner`='" . $USER['id'] . "' AND `sender`='" . $uid . "');"); if (!isset($test)) { $text = request_var('text', '', UTF8_SUPPORT); $db->query("INSERT INTO " . BUDDY . " SET `sender` = '" . $USER['id'] . "', `owner` = '" . $uid . "', `active` = '0', `text` = '" . $db->sql_escape($text) . "';"); exit($LNG['bu_request_send']); } else { exit($LNG['bu_request_exists']); } break; } break; case 2: if ($u == $USER['id']) { $template->message($LNG['bu_cannot_request_yourself'], 'game.php?page=buddy', 2, true); } else { $template->isPopup(true); $Player = $db->uniquequery("SELECT `username` FROM " . USERS . " WHERE `id`='" . $uid . "';"); $template->assign_vars(array('bu_player' => $LNG['bu_player'], 'bu_request_message' => $LNG['bu_request_message'], 'bu_back' => $LNG['bu_back'], 'bu_send' => $LNG['bu_send'], 'bu_characters' => $LNG['bu_characters'], 'bu_request_text' => $LNG['bu_request_text'], 'mg_empty_text' => $LNG['mg_empty_text'], 'username' => $Player['username'], 'id' => $uid)); $template->show("buddy_send_form.tpl"); } break; default: $PlanetRess = new ResourceUpdate(); $PlanetRess->CalcResource(); $PlanetRess->SavePlanetToDB(); $BuddyListRAW = $db->query("SELECT a.`active`, a.`sender`, a.`id` as buddyid, a.`text`, b.`id`, b.`username`, b.`onlinetime`, b.`galaxy`, b.`system`, b.`planet`, b.`ally_id`, b.`ally_name` FROM " . BUDDY . " as a, " . USERS . " as b WHERE (a.`sender` = '" . $USER['id'] . "' AND b.`id` = a.`owner`) OR (a.`owner` = '" . $USER['id'] . "' AND b.`id` = a.`sender`);"); $MyRequestList = array(); $OutRequestList = array(); $MyBuddyList = array(); while ($BuddyList = $db->fetch_array($BuddyListRAW)) { if ($BuddyList['active'] == 0) { if ($BuddyList['sender'] == $USER['id']) { $MyRequestList[] = array('playerid' => $BuddyList['id'], 'name' => $BuddyList['username'], 'allyid' => $BuddyList['ally_id'], 'allyname' => $BuddyList['ally_name'], 'text' => $BuddyList['text'], 'galaxy' => $BuddyList['galaxy'], 'system' => $BuddyList['system'], 'planet' => $BuddyList['planet'], 'buddyid' => $BuddyList['buddyid']); } else { $OutRequestList[] = array('playerid' => $BuddyList['id'], 'name' => $BuddyList['username'], 'allyid' => $BuddyList['ally_id'], 'allyname' => $BuddyList['ally_name'], 'text' => $BuddyList['text'], 'galaxy' => $BuddyList['galaxy'], 'system' => $BuddyList['system'], 'planet' => $BuddyList['planet'], 'buddyid' => $BuddyList['buddyid']); } } else { $MyBuddyList[] = array('playerid' => $BuddyList['id'], 'name' => $BuddyList['username'], 'allyid' => $BuddyList['ally_id'], 'allyname' => $BuddyList['ally_name'], 'onlinetime' => floor((TIMESTAMP - $BuddyList['onlinetime']) / 60), 'galaxy' => $BuddyList['galaxy'], 'system' => $BuddyList['system'], 'planet' => $BuddyList['planet'], 'buddyid' => $BuddyList['buddyid']); } } $db->free_result($BuddyListRAW); $template->assign_vars(array('MyBuddyList' => $MyBuddyList, 'MyRequestList' => $MyRequestList, 'OutRequestList' => $OutRequestList, 'bu_buddy_list' => $LNG['bu_buddy_list'], 'bu_requests' => $LNG['bu_requests'], 'bu_player' => $LNG['bu_player'], 'bu_alliance' => $LNG['bu_alliance'], 'bu_coords' => $LNG['bu_coords'], 'bu_text' => $LNG['bu_text'], 'bu_action' => $LNG['bu_action'], 'bu_my_requests' => $LNG['bu_my_requests'], 'bu_partners' => $LNG['bu_partners'], 'bu_no_request' => $LNG['bu_no_request'], 'bu_no_buddys' => $LNG['bu_no_buddys'], 'bu_no_buddys' => $LNG['bu_no_buddys'], 'bu_minutes' => $LNG['bu_minutes'], 'bu_accept' => $LNG['bu_accept'], 'bu_decline' => $LNG['bu_decline'], 'bu_cancel_request' => $LNG['bu_cancel_request'], 'bu_disconnected' => $LNG['bu_disconnected'], 'bu_delete' => $LNG['bu_delete'], 'bu_online' => $LNG['bu_online'], 'bu_connected' => $LNG['bu_connected'])); $template->show("buddy_overview.tpl"); break; } }