本文整理汇总了PHP中template::execscript方法的典型用法代码示例。如果您正苦于以下问题:PHP template::execscript方法的具体用法?PHP template::execscript怎么用?PHP template::execscript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::execscript方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowFleetTraderPage
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (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 ShowFleetTraderPage()
{
global $USER, $PLANET, $LNG, $CONF, $pricelist, $resource;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$CONF['trade_allowed_ships'] = explode(',', $CONF['trade_allowed_ships']);
$ID = request_var('id', 0);
if (!empty($ID) && in_array($ID, $CONF['trade_allowed_ships'])) {
$Count = max(min(request_var('count', '0'), $PLANET[$resource[$ID]]), 0);
$PLANET['metal'] = bcadd($PLANET['metal'], bcmul($Count, bcmul($pricelist[$ID]['metal'], (double) (1 - $CONF['trade_charge']))));
$PLANET['crystal'] = bcadd($PLANET['crystal'], bcmul($Count, bcmul($pricelist[$ID]['crystal'], (double) (1 - $CONF['trade_charge']))));
$PLANET['deuterium'] = bcadd($PLANET['deuterium'], bcmul($Count, bcmul($pricelist[$ID]['deuterium'], (double) (1 - $CONF['trade_charge']))));
$PLANET['norio'] = bcadd($PLANET['norio'], bcmul($Count, bcmul($pricelist[$ID]['norio'], (double) (1 - $CONF['trade_charge']))));
$USER['darkmatter'] = bcadd($USER['darkmatter'], bcmul($Count, bcmul($pricelist[$ID]['darkmatter'], (double) (1 - $CONF['trade_charge']))));
$PlanetRess->Builded[$ID] = bcadd(bcmul('-1', $Count), $PlanetRess->Builded[$ID]);
}
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->loadscript('fleettrader.js');
$template->execscript('updateVars();');
$Cost = array();
foreach ($CONF['trade_allowed_ships'] as $ID) {
$Cost[$ID] = array($PLANET[$resource[$ID]], $pricelist[$ID]['metal'], $pricelist[$ID]['crystal'], $pricelist[$ID]['deuterium'], $pricelist[$ID]['darkmatter'], $pricelist[$ID]['norio']);
}
$template->assign_vars(array('tech' => $LNG['tech'], 'ft_head' => $LNG['ft_head'], 'ft_count' => $LNG['ft_count'], 'ft_max' => $LNG['ft_max'], 'ft_total' => $LNG['ft_total'], 'ft_charge' => $LNG['ft_charge'], 'ft_absenden' => $LNG['ft_absenden'], 'trade_allowed_ships' => $CONF['trade_allowed_ships'], 'CostInfos' => json_encode($Cost), 'Charge' => $CONF['trade_charge']));
$template->show("fleettrader_overview.tpl");
}
示例2: ShowDisclamerPage
function ShowDisclamerPage()
{
global $LNG;
$config = Config::get(Universe::getEmulated());
if (!empty($_POST)) {
$config_before = array('disclamerAddress' => $config->disclamerAddress, 'disclamerPhone' => $config->disclamerPhone, 'disclamerMail' => $config->disclamerMail, 'disclamerNotice' => $config->disclamerNotice);
$disclaimerAddress = HTTP::_GP('disclaimerAddress', '', true);
$disclaimerPhone = HTTP::_GP('disclaimerPhone', '', true);
$disclaimerMail = HTTP::_GP('disclaimerMail', '', true);
$disclaimerNotice = HTTP::_GP('disclaimerNotice', '', true);
$config_after = array('disclamerAddress' => $disclaimerAddress, 'disclamerPhone' => $disclaimerPhone, 'disclamerMail' => $disclaimerMail, 'disclamerNotice' => $disclaimerNotice);
foreach ($config_after as $key => $value) {
$config->{$key} = $value;
}
$config->save();
$LOG = new Log(3);
$LOG->target = 5;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->loadscript('../base/jquery.autosize-min.js');
$template->execscript('$(\'textarea\').autosize();');
$template->assign_vars(array('disclaimerAddress' => $config->disclamerAddress, 'disclaimerPhone' => $config->disclamerPhone, 'disclaimerMail' => $config->disclamerMail, 'disclaimerNotice' => $config->disclamerNotice, 'se_server_parameters' => $LNG['mu_disclaimer'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_disclaimerAddress' => $LNG['se_disclaimerAddress'], 'se_disclaimerPhone' => $LNG['se_disclaimerPhone'], 'se_disclaimerMail' => $LNG['se_disclaimerMail'], 'se_disclaimerNotice' => $LNG['se_disclaimerNotice']));
$template->show('DisclamerConfigBody.tpl');
}
示例3: __construct
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;
}
}
示例4: ShowDisclamerPage
function ShowDisclamerPage()
{
global $LNG, $USER;
$CONF = Config::getAll(NULL, $_SESSION['adminuni']);
if (!empty($_POST)) {
$config_before = array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice']);
$disclamerAddress = HTTP::_GP('disclamerAddress', '', true);
$disclamerPhone = HTTP::_GP('disclamerPhone', '', true);
$disclamerMail = HTTP::_GP('disclamerMail', '', true);
$disclamerNotice = HTTP::_GP('disclamerNotice', '', true);
$config_after = array('disclamerAddress' => $disclamerAddress, 'disclamerPhone' => $disclamerPhone, 'disclamerMail' => $disclamerMail, 'disclamerNotice' => $disclamerNotice);
Config::update($config_after);
$CONF = Config::getAll(NULL, $_SESSION['adminuni']);
$LOG = new Log(3);
$LOG->target = 5;
$LOG->old = $config_before;
$LOG->new = $config_after;
$LOG->save();
}
$template = new template();
$template->loadscript('../base/jquery.autosize-min.js');
$template->execscript('$(\'textarea\').autosize();');
$template->assign_vars(array('disclamerAddress' => $CONF['disclamerAddress'], 'disclamerPhone' => $CONF['disclamerPhone'], 'disclamerMail' => $CONF['disclamerMail'], 'disclamerNotice' => $CONF['disclamerNotice'], 'se_server_parameters' => $LNG['mu_disclamer'], 'se_save_parameters' => $LNG['se_save_parameters'], 'se_disclamerAddress' => $LNG['se_disclamerAddress'], 'se_disclamerPhone' => $LNG['se_disclamerPhone'], 'se_disclamerMail' => $LNG['se_disclamerMail'], 'se_disclamerNotice' => $LNG['se_disclamerNotice']));
$template->show('DisclamerConfigBody.tpl');
}
示例5: ShowOverviewPage
function ShowOverviewPage()
{
global $CONF, $LNG, $PLANET, $USER, $db, $resource, $UNI;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->getplanets();
$AdminsOnline = $AllPlanets = $Moon = array();
foreach ($template->UserPlanets as $ID => $CPLANET) {
if ($ID == $_SESSION['planet'] || $CPLANET['planet_type'] == 3) {
continue;
}
if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) {
$Queue = explode(';', $CPLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$BuildPlanet = $LNG['tech'][$CurrBuild[0]] . " (" . $CurrBuild[1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($CurrBuild[3] - TIMESTAMP) . ")</span>";
} else {
$BuildPlanet = $LNG['ov_free'];
}
$AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet);
}
if ($PLANET['id_luna'] != 0) {
$Moon = $db->uniquequery("SELECT `id`, `name` FROM " . PLANETS . " WHERE `id` = '" . $PLANET['id_luna'] . "';");
}
if (!empty($PLANET['b_building'])) {
$Queue = explode(';', $PLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$Build = $LNG['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')<br><div id="blc">"' . pretty_time($PLANET['b_building'] - TIMESTAMP) . '</div>';
$template->execscript('BuildTime();');
} else {
$Build = $LNG['ov_free'];
}
$OnlineAdmins = $db->query("SELECT `id`,`username` FROM " . USERS . " WHERE `universe` = '" . $UNI . "' AND `onlinetime` >= '" . (TIMESTAMP - 10 * 60) . "' AND `authlevel` > '0';");
while ($AdminRow = $db->fetch_array($OnlineAdmins)) {
$AdminsOnline[$AdminRow['id']] = $AdminRow['username'];
}
$db->free_result($OnlineAdmins);
$template->loadscript('mbContainer.js');
$template->loadscript('overview.js');
$template->execscript('GetFleets(true);');
$template->assign_vars(array('user_rank' => sprintf($LNG['ov_userrank_info'], pretty_number($USER['total_points']), $LNG['ov_place'], $USER['total_rank'], $USER['total_rank'], $LNG['ov_of'], $CONF['users_amount']), 'is_news' => $CONF['OverviewNewsFrame'], 'news' => makebr($CONF['OverviewNewsText']), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'buildtime' => $PLANET['b_building'], 'userid' => $USER['id'], 'username' => $USER['username'], 'build' => $Build, 'Moon' => $Moon, 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'Teamspeak' => GetTeamspeakData(), 'messages' => $USER['new_message'] > 0 ? $USER['new_message'] == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($USER['new_message'])) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ov_news' => $LNG['ov_news'], 'fcm_moon' => $LNG['fcm_moon'], 'ov_server_time' => $LNG['ov_server_time'], 'ov_planet' => $LNG['ov_planet'], 'ov_planetmenu' => $LNG['ov_planetmenu'], 'ov_diameter' => $LNG['ov_diameter'], 'ov_distance_unit' => $LNG['ov_distance_unit'], 'ov_developed_fields' => $LNG['ov_developed_fields'], 'ov_max_developed_fields' => $LNG['ov_max_developed_fields'], 'ov_fields' => $LNG['ov_fields'], 'ov_temperature' => $LNG['ov_temperature'], 'ov_aprox' => $LNG['ov_aprox'], 'ov_temp_unit' => $LNG['ov_temp_unit'], 'ov_to' => $LNG['ov_to'], 'ov_position' => $LNG['ov_position'], 'ov_points' => $LNG['ov_points'], 'ov_events' => $LNG['ov_events'], 'ov_admins_online' => $LNG['ov_admins_online'], 'ov_no_admins_online' => $LNG['ov_no_admins_online'], 'ov_userbanner' => $LNG['ov_userbanner'], 'ov_teamspeak' => $LNG['ov_teamspeak'], 'ov_your_planet' => $LNG['ov_your_planet'], 'ov_coords' => $LNG['ov_coords'], 'ov_planet_name' => $LNG['ov_planet_name'], 'ov_actions' => $LNG['ov_actions'], 'ov_abandon_planet' => $LNG['ov_abandon_planet'], 'ov_planet_rename' => $LNG['ov_planet_rename'], 'ov_planet_rename_action' => $LNG['ov_planet_rename_action'], 'ov_password' => $LNG['ov_password'], 'ov_with_pass' => $LNG['ov_with_pass'], 'ov_security_confirm' => $LNG['ov_security_confirm'], 'ov_security_request' => $LNG['ov_security_request'], 'ov_delete_planet' => $LNG['ov_delete_planet'], 'ov_planet_abandoned' => $LNG['ov_planet_abandoned'], 'path' => PROTOCOL . $_SERVER['HTTP_HOST'] . HTTP_ROOT));
$template->show("overview_body.tpl");
}
示例6: ShowNotes
private function ShowNotes()
{
global $LNG, $db, $USER;
$NotesID = request_var('id', 0);
$Note = $db->uniquequery("SELECT * FROM " . NOTES . " WHERE id = '" . $NotesID . "' AND owner = '" . $USER['id'] . "';");
if (!$Note) {
redirectTo("game.php?page=notes");
}
$template = new template();
$template->isPopup(true);
$template->execscript("\$('#cntChars').text(\$('#text').val().length);");
$template->assign_vars(array('nt_edit_note' => $LNG['nt_edit_note'], 'nt_priority' => $LNG['nt_priority'], 'nt_important' => $LNG['nt_important'], 'nt_normal' => $LNG['nt_normal'], 'nt_unimportant' => $LNG['nt_unimportant'], 'nt_subject_note' => $LNG['nt_subject_note'], 'nt_reset' => $LNG['nt_reset'], 'nt_save' => $LNG['nt_save'], 'nt_note' => $LNG['nt_note'], 'nt_characters' => $LNG['nt_characters'], 'nt_back' => $LNG['nt_back'], 'PriorityList' => array(2 => $LNG['nt_important'], 1 => $LNG['nt_normal'], 0 => $LNG['nt_unimportant']), 'priority' => $Note['priority'], 'id' => $Note['id'], 'ntitle' => $Note['title'], 'ntext' => $Note['text']));
$template->show('notes_edit_form.tpl');
}
示例7: __construct
public function __construct()
{
global $USER, $CONF, $PLANET, $resource, $reslist, $LNG, $db, $ExtraDM, $OfficerInfo, $pricelist;
$action = request_var('action', '');
$Offi = request_var('offi', 0);
$Extra = request_var('extra', 0);
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
if ($action == "send" && $USER['urlaubs_modus'] == 0) {
if (!empty($Offi) && !CheckModule(18)) {
$this->UpdateOfficier($Offi);
} elseif (!empty($Extra) && !CheckModule(8)) {
$this->UpdateExtra($Extra);
}
}
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->loadscript('officier.js');
if (!CheckModule(8)) {
foreach ($reslist['dmfunc'] as $Element) {
if ($USER[$resource[$Element]] > TIMESTAMP) {
$template->execscript("GetOfficerTime(" . $Element . ", " . ($USER[$resource[$Element]] - TIMESTAMP) . ");");
}
$ExtraDMList[] = array('id' => $Element, 'active' => $USER[$resource[$Element]] - TIMESTAMP, 'price' => pretty_number($ExtraDM[$Element]['darkmatter']), 'isok' => $USER['darkmatter'] - $ExtraDM[$Element]['darkmatter'] >= 0 ? true : false, 'time' => pretty_time($ExtraDM[$Element]['time'] * 3600), 'name' => $LNG['tech'][$Element], 'desc' => sprintf($LNG['res']['descriptions'][$Element], $ExtraDM[$Element]['add'] * 100));
}
}
if (!CheckModule(18)) {
foreach ($reslist['officier'] as $Element) {
if (($Result = $this->IsOfficierAccessible($Element)) === 0) {
continue;
}
$description = $OfficerInfo[$Element]['info'] ? sprintf($LNG['info'][$Element]['description'], is_float($OfficerInfo[$Element]['info']) ? $OfficerInfo[$Element]['info'] * 100 : $OfficerInfo[$Element]['info'], $pricelist[$Element]['max']) : sprintf($LNG['info'][$Element]['description'], $pricelist[$Element]['max']);
$OfficierList[] = array('id' => $Element, 'level' => $USER[$resource[$Element]], 'name' => $LNG['tech'][$Element], 'desc' => $description, 'Result' => $Result);
}
}
$template->assign_vars(array('ExtraDMList' => $ExtraDMList, 'OfficierList' => $OfficierList, 'user_darkmatter' => floor($USER['darkmatter'] / DM_PRO_OFFICIER_LEVEL), 'of_max_lvl' => $LNG['of_max_lvl'], 'of_recruit' => $LNG['of_recruit'], 'of_darkmatter' => sprintf($LNG['of_points_per_thousand_darkmatter'], DM_PRO_OFFICIER_LEVEL, $LNG['Darkmatter']), 'of_available_points' => $LNG['of_available_points'], 'of_lvl' => $LNG['of_lvl'], 'in_dest_durati' => $LNG['in_dest_durati'], 'of_still' => $LNG['of_still'], 'of_active' => $LNG['of_active'], 'of_update' => $LNG['of_update'], 'in_dest_durati' => $LNG['in_dest_durati'], 'of_dm_trade' => sprintf($LNG['of_dm_trade'], $LNG['Darkmatter'])));
$template->show("officier_overview.tpl");
}
示例8: ShowFleet2Page
public static function ShowFleet2Page()
{
global $USER, $PLANET, $db, $LNG;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->loadscript('flotten.js');
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$TargetGalaxy = request_var('galaxy', 0);
$TargetSystem = request_var('system', 0);
$TargetPlanet = request_var('planet', 0);
$TargetPlanettype = request_var('planettype', 0);
$TargetMission = request_var('mission', 0);
$GenFleetSpeed = request_var('speed', 0);
$fleet_group = request_var('fleet_group', 0);
$usedfleet = request_var('usedfleet', '', true);
$FleetArray = parent::GetFleetArray($usedfleet);
if ($TargetPlanettype == 2) {
$GetInfoPlanet = $db->uniquequery("SELECT `id_owner`, `der_metal`, `der_crystal` FROM `" . PLANETS . "` WHERE `galaxy` = " . $TargetGalaxy . " AND `system` = " . $TargetSystem . " AND `planet` = " . $TargetPlanet . " AND `planet_type` = '1';");
if ($GetInfoPlanet['der_metal'] == 0 && $GetInfoPlanet['der_crystal'] == 0) {
$template->message("<font color=\"red\"><b>" . $LNG['fl_no_empty_derbis'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
exit;
}
}
$MisInfo['galaxy'] = $TargetGalaxy;
$MisInfo['system'] = $TargetSystem;
$MisInfo['planet'] = $TargetPlanet;
$MisInfo['planettype'] = $TargetPlanettype;
$MisInfo['IsAKS'] = $fleet_group;
$MisInfo['Ship'] = $FleetArray;
$MisInfo['CurrentUser'] = $USER;
$MissionOutput = parent::GetFleetMissions($MisInfo);
if (empty($MissionOutput)) {
$template->message("<font color=\"red\"><b>" . $LNG['fl_empty_target'] . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
exit;
}
$GameSpeedFactor = parent::GetGameSpeedFactor();
$MaxFleetSpeed = parent::GetFleetMaxSpeed($FleetArray, $USER);
$distance = parent::GetTargetDistance($PLANET['galaxy'], $TargetGalaxy, $PLANET['system'], $TargetSystem, $PLANET['planet'], $TargetPlanet);
$duration = parent::GetMissionDuration($GenFleetSpeed, $MaxFleetSpeed, $distance, $GameSpeedFactor, $USER);
$consumption = parent::GetFleetConsumption($FleetArray, $duration, $distance, $MaxFleetSpeed, $USER, $GameSpeedFactor);
if ($consumption > $PLANET['deuterium']) {
$template->message("<font color=\"red\"><b>" . sprintf($LNG['fl_no_enought_deuterium'], $LNG['Deuterium'], pretty_number($PLANET['deuterium'] - $consumption), $LNG['Deuterium']) . "</b></font>", "game." . PHP_EXT . "?page=fleet", 2);
exit;
}
if (!empty($fleet_group)) {
$TargetMission = 2;
}
$FleetData = array('fleetroom' => floattostring(parent::GetFleetRoom($FleetArray)), 'consumption' => floattostring($consumption));
$template->execscript('calculateTransportCapacity();');
$template->assign_vars(array('fleetdata' => json_encode($FleetData), 'consumption' => floattostring($consumption), 'mission' => $TargetMission, 'galaxy_post' => $TargetGalaxy, 'system_post' => $TargetSystem, 'thisgalaxy' => $PLANET['galaxy'], 'thissystem' => $PLANET['system'], 'thisplanet' => $PLANET['planet'], 'thisplanet_type' => $PLANET['planet_type'], 'MissionSelector' => $MissionOutput['MissionSelector'], 'StaySelector' => $MissionOutput['StayBlock'], 'fl_planet' => $LNG['fl_planet'], 'fl_moon' => $LNG['fl_moon'], 'fl_mission' => $LNG['fl_mission'], 'fl_resources' => $LNG['fl_resources'], 'fl_max' => $LNG['fl_max'], 'fl_resources_left' => $LNG['fl_resources_left'], 'fl_all_resources' => $LNG['fl_all_resources'], 'fl_fuel_consumption' => $LNG['fl_fuel_consumption'], 'fl_hours' => $LNG['fl_hours'], 'fl_hold_time' => $LNG['fl_hold_time'], 'fl_expedition_alert_message' => $LNG['fl_expedition_alert_message'], 'fl_dm_alert_message' => sprintf($LNG['fl_dm_alert_message'], $LNG['type_mission'][11], $LNG['Darkmatter']), 'fl_continue' => $LNG['fl_continue'], 'fleetarray' => $usedfleet, 'galaxy' => $TargetGalaxy, 'system' => $TargetSystem, 'planet' => $TargetPlanet, 'planettype' => $TargetPlanettype, 'fleet_group' => $fleet_group, 'speed' => $GenFleetSpeed));
$template->show('fleet2_table.tpl');
}
示例9: ShowOverviewPage
function ShowOverviewPage()
{
global $CONF, $LNG, $PLANET, $USER, $db, $resource;
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$PlanetRess->SavePlanetToDB();
$template = new template();
$template->getplanets();
$AdminsOnline = $AllPlanets = $Moon = array();
foreach ($template->UserPlanets as $ID => $CPLANET) {
if ($ID == $_SESSION['planet'] || $CPLANET['planet_type'] == 3) {
continue;
}
if (!empty($CPLANET['b_building']) && $CPLANET['b_building'] > TIMESTAMP) {
$Queue = explode(';', $CPLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$BuildPlanet = $LNG['tech'][$CurrBuild[0]] . " (" . $CurrBuild[1] . ")<br><span style=\"color:#7F7F7F;\">(" . pretty_time($CurrBuild[3] - TIMESTAMP) . ")</span>";
} else {
$BuildPlanet = $LNG['ov_free'];
}
$AllPlanets[] = array('id' => $CPLANET['id'], 'name' => $CPLANET['name'], 'image' => $CPLANET['image'], 'build' => $BuildPlanet);
}
if ($PLANET['id_luna'] != 0) {
$Moon = $db->uniquequery("SELECT `id`, `name` FROM " . PLANETS . " WHERE `id` = '" . $PLANET['id_luna'] . "';");
}
if (!empty($PLANET['b_building'])) {
$Queue = explode(';', $PLANET['b_building_id']);
$CurrBuild = explode(',', $Queue[0]);
$Build = $LNG['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')<br><div id="blc">"' . pretty_time($PLANET['b_building'] - TIMESTAMP) . '</div>';
$template->execscript('BuildTime();');
} else {
$Build = $LNG['ov_free'];
}
$Teamspeak = '';
if ($CONF['ts_modon'] == 1) {
if ($CONF['ts_version'] == 2) {
include_once ROOT_PATH . "includes/libs/teamspeak/class.teamspeak2." . PHP_EXT;
$ts = new cyts();
if ($ts->connect($CONF['ts_server'], $CONF['ts_tcpport'], $CONF['ts_udpport'], $CONF['ts_timeout'])) {
$tsdata = $ts->info_serverInfo();
$tsdata2 = $ts->info_globalInfo();
$ts->disconnect();
$trafges = pretty_number($tsdata2["total_bytessend"] / 1024 / 1024 + $tsdata2["total_bytesreceived"] / 1024 / 1024);
$Teamspeak = sprintf($LNG['ov_teamspeak_v2'], $CONF['ts_server'], $CONF['ts_udpport'], $USER['username'], $tsdata["server_currentusers"], $tsdata["server_maxusers"], $tsdata["server_currentchannels"], $trafges);
} else {
$Teamspeak = $LNG['ov_teamspeak_not_online'];
}
} elseif ($CONF['ts_version'] == 3) {
$ip = $CONF['ts_server'];
$port = $CONF['ts_tcpport'];
$t_port = $CONF['ts_udpport'];
$sid = $CONF['ts_timeout'];
require_once ROOT_PATH . "includes/libs/teamspeak/class.teamspeak3." . PHP_EXT;
$tsAdmin = new ts3admin($ip, $t_port);
if ($tsAdmin->connect()) {
$tsAdmin->selectServer($sid);
#$tsAdmin->login($username, $password); Insert the SA Account Details, if Teamspeak banned you.
$sinfo = $tsAdmin->serverInfo();
$tsAdmin->logout();
$tsAdmin->quit();
$trafges = round($sinfo['connection_bytes_received_total'] / 1024 / 1024 + $sinfo['connection_bytes_sent_total'] / 1024 / 1024, 2);
$Debug = $tsAdmin->getDebugLog();
if ($Debug == "Error while fetching: 'error id=518 msg=not logged in'<br>") {
$Teamspeak = sprintf($LNG['ov_teamspeak_v3'], $ip, $port, $USER['username'], $sinfo['virtualserver_password'], $sinfo['virtualserver_clientsonline'] - 1, $sinfo['virtualserver_maxclients'], $sinfo['virtualserver_channelsonline'], $trafges);
} else {
$Teamspeak = $Debug;
}
} else {
$Teamspeak = $LNG['ov_teamspeak_not_online'];
}
}
}
$OnlineAdmins = $db->query("SELECT `id`,`username` FROM " . USERS . " WHERE `onlinetime` >= '" . (TIMESTAMP - 10 * 60) . "' AND `authlevel` > '0';");
while ($AdminRow = $db->fetch_array($OnlineAdmins)) {
$AdminsOnline[$AdminRow['id']] = $AdminRow['username'];
}
$db->free_result($OnlineAdmins);
$template->loadscript('mbContainer.js');
$template->loadscript('overview.js');
$template->execscript('GetFleets(true);');
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$template->assign_vars(array('user_rank' => sprintf($LNG['ov_userrank_info'], pretty_number($USER['total_points']), $LNG['ov_place'], $USER['total_rank'], $USER['total_rank'], $LNG['ov_of'], $CONF['users_amount']), 'is_news' => $CONF['OverviewNewsFrame'], 'news' => makebr($CONF['OverviewNewsText']), 'planetname' => $PLANET['name'], 'planetimage' => $PLANET['image'], 'galaxy' => $PLANET['galaxy'], 'system' => $PLANET['system'], 'planet' => $PLANET['planet'], 'buildtime' => $PLANET['b_building'], 'userid' => $USER['id'], 'username' => $USER['username'], 'build' => $Build, 'Moon' => $Moon, 'AllPlanets' => $AllPlanets, 'AdminsOnline' => $AdminsOnline, 'Teamspeak' => $Teamspeak, 'messages' => $USER['new_message'] > 0 ? $USER['new_message'] == 1 ? $LNG['ov_have_new_message'] : sprintf($LNG['ov_have_new_messages'], pretty_number($USER['new_message'])) : false, 'planet_diameter' => pretty_number($PLANET['diameter']), 'planet_field_current' => $PLANET['field_current'], 'planet_field_max' => CalculateMaxPlanetFields($PLANET), 'planet_temp_min' => $PLANET['temp_min'], 'planet_temp_max' => $PLANET['temp_max'], 'ov_news' => $LNG['ov_news'], 'fcm_moon' => $LNG['fcm_moon'], 'ov_server_time' => $LNG['ov_server_time'], 'ov_planet' => $LNG['ov_planet'], 'ov_planetmenu' => $LNG['ov_planetmenu'], 'ov_diameter' => $LNG['ov_diameter'], 'ov_distance_unit' => $LNG['ov_distance_unit'], 'ov_developed_fields' => $LNG['ov_developed_fields'], 'ov_max_developed_fields' => $LNG['ov_max_developed_fields'], 'ov_fields' => $LNG['ov_fields'], 'ov_temperature' => $LNG['ov_temperature'], 'ov_aprox' => $LNG['ov_aprox'], 'ov_temp_unit' => $LNG['ov_temp_unit'], 'ov_to' => $LNG['ov_to'], 'ov_position' => $LNG['ov_position'], 'ov_points' => $LNG['ov_points'], 'ov_events' => $LNG['ov_events'], 'ov_admins_online' => $LNG['ov_admins_online'], 'ov_no_admins_online' => $LNG['ov_no_admins_online'], 'ov_userbanner' => $LNG['ov_userbanner'], 'ov_teamspeak' => $LNG['ov_teamspeak'], 'ov_your_planet' => $LNG['ov_your_planet'], 'ov_coords' => $LNG['ov_coords'], 'ov_planet_name' => $LNG['ov_planet_name'], 'ov_actions' => $LNG['ov_actions'], 'ov_abandon_planet' => $LNG['ov_abandon_planet'], 'ov_planet_rename' => $LNG['ov_planet_rename'], 'ov_planet_rename_action' => $LNG['ov_planet_rename_action'], 'ov_password' => $LNG['ov_password'], 'ov_with_pass' => $LNG['ov_with_pass'], 'ov_security_confirm' => $LNG['ov_security_confirm'], 'ov_security_request' => $LNG['ov_security_request'], 'ov_delete_planet' => $LNG['ov_delete_planet'], 'ov_planet_abandoned' => $LNG['ov_planet_abandoned'], 'path' => PROTOCOL . $_SERVER['HTTP_HOST'] . HTTP_ROOT));
$template->show("overview_body.tpl");
}
示例10: __construct
public function __construct()
{
global $ProdGrid, $LNG, $resource, $reslist, $CONF, $db, $PLANET, $USER;
include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.php';
include_once ROOT_PATH . 'includes/functions/GetElementPrice.php';
$TheCommand = request_var('cmd', '');
$Element = request_var('building', 0);
$ListID = request_var('listid', 0);
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
if (!empty($Element) && $USER['urlaubs_modus'] == 0 && (IsTechnologieAccessible($USER, $PLANET, $Element) && in_array($Element, $reslist['allow'][$PLANET['planet_type']])) || $TheCommand == "cancel" || $TheCommand == "remove") {
if ($Element == 31 && $USER["b_tech_planet"] != 0 || ($Element == 15 || $Element == 21) && !empty($PLANET['b_hangar_id'])) {
$TheCommand = '';
}
switch ($TheCommand) {
case 'cancel':
$this->CancelBuildingFromQueue($PlanetRess);
break;
case 'remove':
$this->RemoveBuildingFromQueue($ListID, $PlanetRess);
break;
case 'insert':
$this->AddBuildingToQueue($Element, true);
break;
case 'destroy':
$this->AddBuildingToQueue($Element, false);
break;
}
}
$PlanetRess->SavePlanetToDB();
$Queue = $this->ShowBuildingQueue();
$template = new template();
$CanBuildElement = count($Queue) < MAX_BUILDING_QUEUE_SIZE ? true : false;
$BuildingPage = "";
$CurrentMaxFields = CalculateMaxPlanetFields($PLANET);
$RoomIsOk = $PLANET["field_current"] < $CurrentMaxFields - count($Queue) ? true : false;
$BuildEnergy = $USER[$resource[113]];
$BuildLevelFactor = 10;
$BuildTemp = $PLANET['temp_max'];
foreach ($reslist['allow'][$PLANET['planet_type']] as $ID => $Element) {
if (!IsTechnologieAccessible($USER, $PLANET, $Element)) {
continue;
}
$HaveRessources = IsElementBuyable($USER, $PLANET, $Element, true, false);
if (in_array($Element, $reslist['prod'])) {
$BuildLevel = $PLANET[$resource[$Element]];
$Need = floor(eval($ProdGrid[$Element]['formule']['energy']) * $CONF['resource_multiplier']) * (1 + ($this->TIME - $this->USER[$resource[704]] <= 0) ? 1 + $ExtraDM[704]['add'] : 1);
$BuildLevel += 1;
$Prod = floor(eval($ProdGrid[$Element]['formule']['energy']) * $CONF['resource_multiplier']) * (1 + ($this->TIME - $this->USER[$resource[704]] <= 0) ? 1 + $ExtraDM[704]['add'] : 1);
$EnergyNeed = $Prod - $Need;
} else {
unset($EnergyNeed);
}
$parse['click'] = '';
$NextBuildLevel = $PLANET[$resource[$Element]] + 1;
if ($RoomIsOk && $CanBuildElement) {
$parse['click'] = $HaveRessources == true ? "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><span style=\"color:#00FF00\">" . ($PLANET['b_building'] != 0 ? $LNG['bd_add_to_list'] : ($NextBuildLevel == 1 ? $LNG['bd_build'] : $LNG['bd_build_next_level'] . $NextBuildLevel)) . "</span></a>" : "<span style=\"color:#FF0000\">" . ($NextBuildLevel == 1 ? $LNG['bd_build'] : $LNG['bd_build_next_level'] . $NextBuildLevel) . "</span>";
} elseif ($RoomIsOk && !$CanBuildElement) {
$parse['click'] = "<span style=\"color:#FF0000\">" . ($NextBuildLevel == 1 ? $LNG['bd_build'] : $LNG['bd_build_next_level'] . $NextBuildLevel) . "</span>";
} else {
$parse['click'] = "<span style=\"color:#FF0000\">" . $LNG['bd_no_more_fields'] . "</span>";
}
if (($Element == 6 || $Element == 31) && $USER['b_tech'] > TIMESTAMP) {
$parse['click'] = "<span style=\"color:#FF0000\">" . $LNG['bd_working'] . "</span>";
} elseif (($Element == 15 || $Element == 21) && !empty($PLANET['b_hangar_id'])) {
$parse['click'] = "<span style=\"color:#FF0000\">" . $LNG['bd_working'] . "</span>";
}
$BuildInfoList[] = array('id' => $Element, 'name' => $LNG['tech'][$Element], 'descriptions' => $LNG['res']['descriptions'][$Element], 'level' => $PLANET[$resource[$Element]], 'destroyress' => array_map('pretty_number', GetBuildingPrice($USER, $PLANET, $Element, true, true)), 'destroytime' => pretty_time(GetBuildingTime($USER, $PLANET, $Element, true)), 'price' => GetElementPrice($USER, $PLANET, $Element, true), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'EnergyNeed' => isset($EnergyNeed) ? sprintf($EnergyNeed < 0 ? $LNG['bd_need_engine'] : $LNG['bd_more_engine'], pretty_number(abs($EnergyNeed)), $LNG['Energy']) : "", 'BuildLink' => $parse['click'], 'restprice' => $this->GetRestPrice($Element));
}
if ($PLANET['b_building'] != 0) {
$template->execscript('ReBuildView();Buildlist();');
$template->loadscript('buildlist.js');
$template->assign_vars(array('data' => json_encode(array('bd_cancel' => $LNG['bd_cancel'], 'bd_continue' => $LNG['bd_continue'], 'bd_finished' => $LNG['bd_finished'], 'build' => $Queue))));
}
$template->assign_vars(array('BuildInfoList' => $BuildInfoList, 'bd_lvl' => $LNG['bd_lvl'], 'bd_next_level' => $LNG['bd_next_level'], 'Metal' => $LNG['Metal'], 'Crystal' => $LNG['Crystal'], 'Deuterium' => $LNG['Deuterium'], 'Norio' => $LNG['Norio'], 'Darkmatter' => $LNG['Darkmatter'], 'bd_dismantle' => $LNG['bd_dismantle'], 'fgf_time' => $LNG['fgf_time'], 'bd_remaining' => $LNG['bd_remaining'], 'bd_jump_gate_action' => $LNG['bd_jump_gate_action'], 'bd_price_for_destroy' => $LNG['bd_price_for_destroy'], 'bd_destroy_time' => $LNG['bd_destroy_time']));
$template->show("buildings_overview.tpl");
}
示例11: __construct
public function __construct()
{
global $PLANET, $USER, $LNG, $resource, $reslist, $CONF, $db, $pricelist, $OfficerInfo;
include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.php';
include_once ROOT_PATH . 'includes/functions/GetElementPrice.php';
$template = new template();
if ($PLANET[$resource[31]] == 0) {
$template->message($LNG['bd_lab_required']);
exit;
}
$bContinue = $this->CheckLabSettingsInQueue($PLANET) ? true : false;
$TheCommand = request_var('cmd', '');
$Element = request_var('tech', 0);
$ListID = request_var('listid', 0);
$PlanetRess = new ResourceUpdate();
$PLANET[$resource[31] . '_inter'] = $PlanetRess->CheckAndGetLabLevel($USER, $PLANET);
$PlanetRess->CalcResource();
if (!empty($Element) && $bContinue && $USER['urlaubs_modus'] == 0 && ($USER[$resource[$Element]] < $pricelist[$Element]['max'] && IsTechnologieAccessible($USER, $PLANET, $Element) && in_array($Element, $reslist['tech'])) || $TheCommand == "cancel" || $TheCommand == "remove") {
switch ($TheCommand) {
case 'cancel':
$this->CancelBuildingFromQueue($PlanetRess);
break;
case 'remove':
$this->RemoveBuildingFromQueue($ListID, $PlanetRess);
break;
case 'insert':
$this->AddBuildingToQueue($Element, true);
break;
case 'destroy':
$this->AddBuildingToQueue($Element, false);
break;
}
}
$PlanetRess->SavePlanetToDB();
$ScriptInfo = array();
$TechQueue = $this->ShowTechQueue();
foreach ($reslist['tech'] as $ID => $Element) {
if (!IsTechnologieAccessible($USER, $PLANET, $Element)) {
continue;
}
$CanBeDone = IsElementBuyable($USER, $PLANET, $Element);
if (isset($pricelist[$Element]['max']) && $USER[$resource[$Element]] >= $pricelist[$Element]['max']) {
$TechnoLink = "<font color=\"#FF0000\">" . $LNG['bd_maxlevel'] . "</font>";
} elseif (MAX_RESEACH_QUEUE_SIZE > 1) {
$LevelToDo = 1 + $USER[$resource[$Element]];
$TechnoLink = $CanBeDone && $bContinue ? "<a href=\"game.php?page=buildings&mode=research&cmd=insert&tech=" . $Element . "\"><font color=\"#00FF00\">" . ($USER['b_tech_id'] != 0 ? $LNG['bd_add_to_list'] : $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo)) . "</font></a>" : "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>";
if ($USER['b_tech_id'] != 0) {
$template->loadscript('researchlist.js');
$template->execscript('ReBuildView();Techlist();');
$ScriptInfo = array('bd_cancel' => $LNG['bd_cancel'], 'bd_continue' => $LNG['bd_continue'], 'bd_finished' => $LNG['bd_finished'], 'build' => $TechQueue);
}
} else {
if ($USER['b_tech_id'] == 0) {
$LevelToDo = 1 + $USER[$resource[$Element]];
$TechnoLink = $CanBeDone && $bContinue ? "<a href=\"game.php?page=buildings&mode=research&cmd=insert&tech=" . $Element . "\"><font color=\"#00FF00\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font></a>" : "<font color=\"#FF0000\">" . $LNG['bd_research'] . ($LevelToDo == 1 ? "" : "<br>" . $LNG['bd_lvl'] . " " . $LevelToDo) . "</font>";
} else {
if ($USER['b_tech_id'] == $Element) {
$template->loadscript('research.js');
if ($USER['b_tech_planet'] == $PLANET['id']) {
$ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => '', 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']);
} else {
$ScriptInfo = array('tech_time' => $USER['b_tech'], 'tech_name' => $LNG['bd_on'] . '<br>' . $TechQueue['planet'], 'tech_home' => $USER['b_tech_planet'], 'tech_id' => $USER['b_tech_id'], 'game_name' => $CONF['game_name'], 'tech_lang' => $LNG['tech'][$USER['b_tech_id']], 'bd_cancel' => $LNG['bd_cancel'], 'bd_ready' => $LNG['bd_ready'], 'bd_continue' => $LNG['bd_continue']);
}
$TechnoLink = '<div id="research"></div>';
} else {
$TechnoLink = '<center>-</center>';
}
}
}
$ResearchList[] = array('id' => $Element, 'maxinfo' => isset($pricelist[$Element]['max']) && $pricelist[$Element]['max'] != 255 ? sprintf($LNG['bd_max_lvl'], $pricelist[$Element]['max']) : '', 'name' => $LNG['tech'][$Element], 'descr' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'restprice' => $this->GetRestPrice($Element), 'elvl' => $Element == 106 ? $USER['rpg_espion'] * $OfficerInfo[610]['info'] . " (" . $LNG['tech'][610] . ")" : ($Element == 108 ? $USER['rpg_commandant'] * $OfficerInfo[611]['info'] . " (" . $LNG['tech'][611] . ")" : false), 'lvl' => $USER[$resource[$Element]], 'link' => $TechnoLink, 'oldlink' => MAX_RESEACH_QUEUE_SIZE == 1, 'queue' => $TechQueue);
}
$template->assign_vars(array('ResearchList' => $ResearchList, 'IsLabinBuild' => !$bContinue, 'ScriptInfo' => json_encode($ScriptInfo), 'bd_building_lab' => $LNG['bd_building_lab'], 'bd_remaining' => $LNG['bd_remaining'], 'bd_lvl' => $LNG['bd_lvl'], 'fgf_time' => $LNG['fgf_time']));
$template->show('buildings_research.tpl');
}
示例12: DefensesBuildingPage
//.........这里部分代码省略.........
$fmenge = $_POST['fmenge'];
$cancel = request_var('auftr', range(0, MAX_FLEET_OR_DEFS_IN_BUILD - 1));
$action = request_var('action', '');
$PlanetRess = new ResourceUpdate();
$PlanetRess->CalcResource();
$NotBuilding = true;
if (!empty($PLANET['b_building_id'])) {
$CurrentQueue = $PLANET['b_building_id'];
$QueueArray = explode(";", $CurrentQueue);
for ($i = 0; $i < count($QueueArray); $i++) {
$ListIDArray = explode(",", $QueueArray[$i]);
if ($ListIDArray[0] == 21 || $ListIDArray[0] == 15) {
$NotBuilding = false;
break;
}
}
}
if (isset($fmenge) && $NotBuilding == true && $USER['urlaubs_modus'] == 0) {
$ebuild = explode(";", $PLANET['b_hangar_id']);
if (count($ebuild) - 1 >= MAX_FLEET_OR_DEFS_IN_BUILD) {
$template->message(sprintf($LNG['bd_max_builds'], MAX_FLEET_OR_DEFS_IN_BUILD), "?page=buildings&mode=fleet", 3);
exit;
}
$Missiles[502] = $PLANET[$resource[502]];
$Missiles[503] = $PLANET[$resource[503]];
$SiloSize = $PLANET[$resource[44]];
$MaxMissiles = $SiloSize * 10;
$BuildQueue = $PLANET['b_hangar_id'];
$BuildArray = explode(";", $BuildQueue);
for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
$ElmentArray = explode(",", $BuildArray[$QElement]);
if (isset($Missiles[$ElmentArray[0]])) {
$Missiles[$ElmentArray[0]] += $ElmentArray[1];
}
}
foreach ($fmenge as $Element => $Count) {
if (empty($Count) || !in_array($Element, $reslist['defense'])) {
continue;
}
$Count = is_numeric($Count) ? $Count : 0;
$Count = max(min($Count, MAX_FLEET_OR_DEFS_PER_ROW), 0);
$MaxElements = $this->GetMaxConstructibleElements($Element);
if (empty($Element) || empty($Count) || empty($MaxElements) || !IsTechnologieAccessible($USER, $PLANET, $Element)) {
continue;
}
if ($Element == 502 || $Element == 503) {
$ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
$MissilesSpace = $MaxMissiles - $ActuMissiles;
$Count = $Element == 502 ? min($Count, $MissilesSpace) : min($Count, floor($MissilesSpace / 2));
$Count = min($Count, $MaxElements);
$Missiles[$Element] += $Count;
} elseif (in_array($Element, $reslist['one'])) {
$Count = $PLANET[$resource[$Element]] == 0 && strpos($PLANET['b_hangar_id'], $Element . ',') === false ? 1 : 0;
} else {
$Count = min($Count, $MaxElements);
}
if ($Count < 1) {
continue;
}
$Ressource = $this->GetElementRessources($Element, $Count);
$PLANET['metal'] -= $Ressource['metal'];
$PLANET['crystal'] -= $Ressource['crystal'];
$PLANET['deuterium'] -= $Ressource['deuterium'];
$PLANET['norio'] -= $Ressource['norio'];
$USER['darkmatter'] -= $Ressource['darkmatter'];
$PLANET['b_hangar_id'] .= $Element . ',' . floattostring($Count) . ';';
}
}
if ($action == "delete" && is_array($cancel) && $USER['urlaubs_modus'] == 0) {
$this->CancelAuftr($cancel);
}
$PlanetRess->SavePlanetToDB();
foreach ($reslist['defense'] as $Element) {
if (!IsTechnologieAccessible($USER, $PLANET, $Element)) {
continue;
}
$DefenseList[] = array('id' => $Element, 'name' => $LNG['tech'][$Element], 'descriptions' => $LNG['res']['descriptions'][$Element], 'price' => GetElementPrice($USER, $PLANET, $Element, false), 'restprice' => $this->GetRestPrice($Element), 'time' => pretty_time(GetBuildingTime($USER, $PLANET, $Element)), 'IsAvailable' => IsElementBuyable($USER, $PLANET, $Element, false), 'GetMaxAmount' => floattostring($this->GetMaxConstructibleElements($Element)), 'Available' => pretty_number($PLANET[$resource[$Element]]), 'AlreadyBuild' => in_array($Element, $reslist['one']) && (strpos($PLANET['b_hangar_id'], $Element . ",") !== false || $PLANET[$resource[$Element]] != 0) ? true : false);
}
$Buildlist = array();
if (!empty($PLANET['b_hangar_id'])) {
$ElementQueue = explode(';', $PLANET['b_hangar_id']);
$Shipyard = array();
$QueueTime = 0;
foreach ($ElementQueue as $ElementLine => $Element) {
if (empty($Element)) {
continue;
}
$Element = explode(',', $Element);
$ElementTime = GetBuildingTime($USER, $PLANET, $Element[0]);
$QueueTime += $ElementTime * $Element[1];
$Shipyard[] = array($LNG['tech'][$Element[0]], $Element[1], $ElementTime);
}
$template->loadscript('bcmath.js');
$template->loadscript('shipyard.js');
$template->execscript('ShipyardInit();');
$Buildlist = array('Queue' => $Shipyard, 'b_hangar_id_plus' => $PLANET['b_hangar'], 'pretty_time_b_hangar' => pretty_time(max($QueueTime - $PLANET['b_hangar'], 0)));
}
$template->assign_vars(array('DefenseList' => $DefenseList, 'NotBuilding' => $NotBuilding, 'bd_available' => $LNG['bd_available'], 'bd_remaining' => $LNG['bd_remaining'], 'fgf_time' => $LNG['fgf_time'], 'bd_build_ships' => $LNG['bd_build_ships'], 'bd_building_shipyard' => $LNG['bd_building_shipyard'], 'bd_protection_shield_only_one' => $LNG['bd_protection_shield_only_one'], 'bd_cancel_warning' => $LNG['bd_cancel_warning'], 'bd_cancel_send' => $LNG['bd_cancel_send'], 'bd_operating' => $LNG['bd_operating'], 'bd_actual_production' => $LNG['bd_actual_production'], 'BuildList' => json_encode($Buildlist), 'maxlength' => strlen(MAX_FLEET_OR_DEFS_PER_ROW)));
$template->show("shipyard_defense.tpl");
}
示例13: ShowPhalanxPage
/**
_ \_/ |\ | /¯¯\ \ / /\ |¯¯) |_¯ \ / /¯¯\ | | |´¯|¯` | /¯¯\ |\ |5
¯ /¯\ | \| \__/ \/ /--\ |¯¯\ |__ \/ \__/ |__ \_/ | | \__/ | \|Core.
* @author: Copyright (C) 2011 by Brayan Narvaez (Prinick) developer of xNova Revolution
* @link: http://www.xnovarevolution.con.ar
* @package 2Moons
* @author Slaver <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (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');
}
示例14: template
<?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 <slaver7@gmail.com>
* @copyright 2009 Lucky <douglas@crockford.com> (XGProyecto)
* @copyright 2011 Slaver <slaver7@gmail.com> (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');