本文整理汇总了PHP中CheckPlanetUsedFields函数的典型用法代码示例。如果您正苦于以下问题:PHP CheckPlanetUsedFields函数的具体用法?PHP CheckPlanetUsedFields怎么用?PHP CheckPlanetUsedFields使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckPlanetUsedFields函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowPlanetMenu
function ShowPlanetMenu($CurrentUser)
{
global $dpath, $lang;
$planets = SortUserPlanets($CurrentUser);
while ($p = mysql_fetch_array($planets)) {
if ($p["destruyed"] == 0) {
$ct = $p["field_max"] + $p["terraformer"] * FIELDS_BY_TERRAFORMER;
if ($p['planet_type'] == 3) {
$ct = $p["field_max"];
}
if ($p['b_building'] != 0) {
UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser);
if ($p['b_building'] != 0) {
$BuildQueue = $p['b_building_id'];
$QueueArray = explode(";", $BuildQueue);
$CurrentBuild = explode(",", $QueueArray[0]);
$BuildElement = $CurrentBuild[0];
$BuildLevel = $CurrentBuild[1];
$BuildRestTime = pretty_time($CurrentBuild[3] - time());
$construccion = "" . $lang['tech'][$BuildElement] . "<br>(Construyendo nivel " . $BuildLevel . ")<br>Tiempo restante:" . $BuildRestTime . "";
} else {
CheckPlanetUsedFields($p);
$construccion = $lang['ov_free'];
}
} else {
$construccion = $lang['ov_free'];
}
$popup = "" . $p['name'] . " [" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]<br>Campos ocupados: " . $p['field_current'] . "/" . $ct . "<br>" . $construccion . "";
if ($t == 0) {
$parse['mplanet'] .= "<th text-decoration:none>";
}
if ($p['planet_type'] == 1 && $p["id"] != $CurrentUser["current_planet"]) {
$parse['mplanet'] .= "<div align=center><a class=mplanet href=game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $p['id'] . "&mode=" . $_GET['mode'] . "&re=0 onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br><font color=#2E9AFE>" . $p['name'] . " </font><font color=#58FA58><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a>";
} elseif ($p['planet_type'] == 3 && $p["id"] != $CurrentUser["current_planet"]) {
$parse['mplanet'] .= "<div align=center><a class=mplanet href=game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $p['id'] . "&mode=" . $_GET['mode'] . "&re=0 onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br>" . $p['name'] . " (Luna) <font color=#58FA58><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a>";
} else {
$parse['mplanet'] .= "<div align=center><a class=mplanet href=# onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br><font color=#FFFF00>" . $p['name'] . " </font><font color=#FE9A2E><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a></div>";
}
if ($t == 6) {
$parse['mplanet'] .= "</th>";
$t = 0;
} else {
$t = $t + 1;
}
}
}
$parse['mplanet'] .= "</center></table>";
return parsetemplate(gettemplate('planet_menu'), $parse);
}
示例2: ShowOverviewPage
function ShowOverviewPage($CurrentUser, $CurrentPlanet)
{
global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user;
include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx;
$parse = $lang;
$FlyingFleetsTable = new FlyingFleetsTable();
$lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentPlanet['id_owner'] . "' AND `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "';", 'lunas', true);
CheckPlanetUsedFields($lunarow);
$parse['planet_id'] = $CurrentPlanet['id'];
$parse['planet_name'] = $CurrentPlanet['name'];
$parse['galaxy_galaxy'] = $CurrentPlanet['galaxy'];
$parse['galaxy_system'] = $CurrentPlanet['system'];
$parse['galaxy_planet'] = $CurrentPlanet['planet'];
switch ($_GET['mode']) {
case 'renameplanet':
if ($_POST['action'] == $lang['ov_planet_rename_action']) {
$newname = mysql_escape_string(strip_tags(trim($_POST['newname'])));
if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) {
message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2);
}
if ($newname != "") {
doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . $CurrentUser['current_planet'] . "' LIMIT 1;", "planets");
if ($CurrentPlanet['planet_type'] == 3) {
doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "' LIMIT 1;", "lunas");
}
}
} elseif ($_POST['action'] == $lang['ov_abandon_planet']) {
return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse));
} elseif ($_POST['kolonieloeschen'] == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) {
if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) {
doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . mysql_real_escape_string($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets');
doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . mysql_real_escape_string($CurrentUser['id']) . "' LIMIT 1", "users");
doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = 3;", 'planets');
doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "';", 'lunas');
message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet');
} elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) {
message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet');
} else {
message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet');
}
}
return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse));
break;
default:
if ($game_config['ts_modon'] == 1) {
include_once $xgp_root . 'includes/classes/class.cyts.' . $phpEx;
$ts = new cyts();
if ($ts->connect($game_config['ts_server'], $game_config['ts_tcpport'], $game_config['ts_udpport'], $game_config['ts_timeout'])) {
$tsdata = $ts->info_serverInfo();
$tsdata2 = $ts->info_globalInfo();
$maxusers = $tsdata["server_maxusers"];
$useronline = $tsdata["server_currentusers"];
$channels = $tsdata["server_currentchannels"];
$seconds = $tsdata["server_uptime"];
$os = $tsdata2["total_server_platform"];
$version = $tsdata2["total_server_version"];
$trafin = round($tsdata2["total_bytesreceived"] / 1024 / 1024, 2);
$trafout = round($tsdata2["total_bytessend"] / 1024 / 1024, 2);
$trafges = $trafin + $trafout;
$parse['ov_ts'] = "<tr><th>Teamspeak</th><th colspan=\"3\"><a href=\"teamspeak://" . $game_config['ts_server'] . ":" . $game_config['ts_udpport'] . "?username=" . $user['username'] . "\" alt=\"Teamspeak Connect\" name=\"Teamspeak Connect\">Connect</a> • Online: " . $useronline . "/" . $maxusers . " • Channels: " . $channels . " • Traffic IN: " . $trafin . " MB • Traffic Out: " . $trafout . " MB • Traffic ges.: " . $trafges . " MB</th></tr>";
} else {
$parse['ov_ts'] = "<tr><th>Teamspeak</th><th colspan=\"3\">Server zurzeit nicht erreichbar. Wir bitten um verständnis.</th></tr>";
}
}
$OnlineAdmins = doquery("SELECT * FROM {{table}} WHERE onlinetime>='" . (time() - 10 * 60) . "' AND authlevel > 1", 'users');
if ($OnlineAdmins) {
$AdminsNr = 1;
$parse['OnlineAdmins'] = "";
while ($oas = mysql_fetch_array($OnlineAdmins)) {
if ($AdminsNr == 1) {
$parse['OnlineAdmins'] .= "<a href=\"game.php?page=messages&mode=write&id=" . $oas['id'] . "\" >" . $oas['username'] . "</a>";
} else {
$parse['OnlineAdmins'] .= " • <a href=\"game.php?page=messages&mode=write&id=" . $oas['id'] . "\" >" . $oas['username'] . "</a>";
}
$AdminsNr++;
}
} else {
$parse['OnlineAdmins'] = "-";
}
if ($CurrentUser['new_message'] != 0) {
$Have_new_message .= "<tr>";
if ($CurrentUser['new_message'] == 1) {
$Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>";
} elseif ($CurrentUser['new_message'] > 1) {
$Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>";
$Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']);
$Have_new_message .= "</a></th>";
}
$Have_new_message .= "</tr>";
}
$OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . $CurrentUser['id'] . "';", 'fleets');
$Record = 0;
while ($FleetRow = mysql_fetch_array($OwnFleets)) {
$Record++;
$StartTime = $FleetRow['fleet_start_time'];
$StayTime = $FleetRow['fleet_end_stay'];
$EndTime = $FleetRow['fleet_end_time'];
$Label = "fs";
if ($StartTime > time()) {
//.........这里部分代码省略.........
示例3: __construct
public function __construct(&$CurrentPlanet, $CurrentUser)
{
global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $xgp_root;
include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
include_once $xgp_root . 'includes/functions/CheckPlanetUsedFields.' . $phpEx;
CheckPlanetUsedFields($CurrentPlanet);
$parse = $lang;
$Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 44);
$Allowed['3'] = array(12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
if (isset($_GET['cmd'])) {
$bDoItNow = false;
$TheCommand = $_GET['cmd'];
$Element = $_GET['building'];
$ListID = $_GET['listid'];
if (!in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
unset($Element);
}
if (isset($Element)) {
if (!strchr($Element, ",") && !strchr($Element, " ") && !strchr($Element, "+") && !strchr($Element, "*") && !strchr($Element, "~") && !strchr($Element, "=") && !strchr($Element, ";") && !strchr($Element, "'") && !strchr($Element, "#") && !strchr($Element, "-") && !strchr($Element, "_") && !strchr($Element, "[") && !strchr($Element, "]") && !strchr($Element, ".") && !strchr($Element, ":")) {
if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
$bDoItNow = true;
}
} else {
header("location:game.php?page=buildings");
}
} elseif (isset($ListID)) {
$bDoItNow = true;
}
if ($Element == 31 && $CurrentUser["b_tech_planet"] != 0) {
$bDoItNow = false;
}
if (($Element == 21 or $Element == 14 or $Element == 15) && $CurrentPlanet["b_hangar"] != 0) {
$bDoItNow = false;
}
if ($bDoItNow == true) {
switch ($TheCommand) {
case 'cancel':
$this->CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
break;
case 'remove':
$this->RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
break;
case 'insert':
$this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
break;
case 'destroy':
$this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
break;
}
}
if ($_GET['r'] == 'overview') {
header('location:game.php?page=overview');
} else {
header("Location: game.php?page=buildings&mode=buildings");
}
}
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
// $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser); // OLD CODE
// START FIX BY JSTAR
$Sprice = array();
$Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser, $Sprice);
// END FIX BY JSTAR
$this->BuildingSavePlanetRecord($CurrentPlanet);
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
$BuildingPage = "";
$zaehler = 1;
foreach ($lang['tech'] as $Element => $ElementName) {
if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
$CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
if ($CurrentPlanet["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
$RoomIsOk = true;
} else {
$RoomIsOk = false;
}
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
$parse = array();
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['i'] = $Element;
$BuildingLevel = $CurrentPlanet[$resource[$Element]];
$parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['bd_lvl'] . " " . $BuildingLevel . ")";
$parse['n'] = $ElementName;
$parse['descriptions'] = $lang['res']['descriptions'][$Element];
/* OLD CODE ---------------------------------------------------- OLD CODE ------------------------------------- //
$ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
$parse['time'] = ShowBuildTime($ElementBuildTime);
$parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
OLD CODE ---------------------------------------------------- OLD CODE ------------------------------------- //
*/
// START FIX BY JSTAR
$really_lvl = isset($Sprice[$Element]) ? $Sprice[$Element] : $BuildingLevel;
$ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element, $really_lvl);
$parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element, true, $really_lvl);
$parse['time'] = ShowBuildTime($ElementBuildTime);
//.........这里部分代码省略.........
示例4: define
* overview.php
* @Licence GNU (GPL)
* @version 3.0
* @copyright 2009
* @Team Space Beginner
*
**/
define('INSIDE', true);
define('INSTALL', false);
$xnova_root_path = './';
include $xnova_root_path . 'extension.inc';
include $xnova_root_path . 'common.' . $phpEx;
includeLang('resources');
includeLang('menu_01/ubersicht');
$lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $planetrow['id_owner'] . "' AND `galaxy` = '" . $planetrow['galaxy'] . "' AND `system` = '" . $planetrow['system'] . "' AND `lunapos` = '" . $planetrow['planet'] . "';", 'lunas', true);
CheckPlanetUsedFields($lunarow);
$mode = $_GET['mode'];
$pl = mysql_escape_string($_GET['pl']);
$_POST['deleteid'] = intval($_POST['deleteid']);
if ($game_config['enable_bot'] == 1) {
$multi = $user['multi_validated'];
$ip = $user['user_lastip'];
$time = time();
$duree = $time + stripslashes($game_config['ban_duration']) * 86400;
$op = stripslashes($game_config['bot_name']);
$mail = stripslashes($game_config['bot_adress']);
$sql = mysql_query("SELECT * FROM game_users WHERE `user_lastip`='{$ip}'");
$boucle = 0;
$username = '';
$v = ', ';
while ($m = mysql_fetch_array($sql)) {
示例5: BuildRessourcePage
/**
* BuildRessourcePage.php
*
* @version 1.0
* @copyright 2008 by ShadoV for XNova
*/
function BuildRessourcePage($CurrentUser, $CurrentPlanet)
{
global $lang, $ProdGrid, $resource, $reslist, $game_config, $_POST;
CheckPlanetUsedFields($CurrentPlanet);
$RessBodyTPL = gettemplate('resources');
$RessRowTPL = gettemplate('resources_row');
// Si c'est une lune ... pas de ressources produites
if ($CurrentPlanet['planet_type'] == 3) {
$game_config['metal_basic_income'] = 0;
$game_config['crystal_basic_income'] = 0;
$game_config['deuterium_basic_income'] = 0;
}
$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
$SubQry = "";
if ($_POST) {
foreach ($_POST as $Field => $Value) {
$FieldName = $Field . "_porcent";
if (isset($CurrentPlanet[$FieldName])) {
if (!in_array($Value, $ValidList['percent'])) {
header("Location: ?action=internalHome");
exit;
}
$Values = $Value / 10;
$CurrentPlanet[$FieldName] = $Values;
$SubQry .= ", `" . $FieldName . "` = '" . $Values . "'";
}
}
}
$parse = $lang;
$production_level = 100;
if ($CurrentPlanet['energy_max'] == 0 && $CurrentPlanet['energy_used'] > 0) {
$post_porcent = 0;
if ($CurrentPlanet['energy_max'] > 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
$post_porcent = floor($CurrentPlanet['energy_max'] / abs($CurrentPlanet['energy_used']) * 100);
} elseif ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
$post_porcent = 0;
}
} else {
$post_porcent = 100;
}
if ($post_porcent > 100) {
$post_porcent = 100;
}
// -------------------------------------------------------------------------------------------------------
// Mise a jour de l'espace de stockage
$CurrentPlanet['metal_max'] = floor(BASE_STORAGE_SIZE * pow(1.5, $CurrentPlanet[$resource[22]])) * (1 + $CurrentUser['rpg_stockeur'] * 0.5);
$CurrentPlanet['crystal_max'] = floor(BASE_STORAGE_SIZE * pow(1.5, $CurrentPlanet[$resource[23]])) * (1 + $CurrentUser['rpg_stockeur'] * 0.5);
$CurrentPlanet['deuterium_max'] = floor(BASE_STORAGE_SIZE * pow(1.5, $CurrentPlanet[$resource[24]])) * (1 + $CurrentUser['rpg_stockeur'] * 0.5);
// -------------------------------------------------------------------------------------------------------
$parse['resource_row'] = "";
$CurrentPlanet['metal_perhour'] = 0;
$CurrentPlanet['crystal_perhour'] = 0;
$CurrentPlanet['deuterium_perhour'] = 0;
$CurrentPlanet['energy_max'] = 0;
$CurrentPlanet['energy_used'] = 0;
$BuildTemp = $CurrentPlanet['temp_max'];
foreach ($reslist['prod'] as $ProdID) {
if ($CurrentPlanet[$resource[$ProdID]] > 0 && isset($ProdGrid[$ProdID])) {
$BuildLevelFactor = $CurrentPlanet[$resource[$ProdID] . "_porcent"];
$BuildLevel = $CurrentPlanet[$resource[$ProdID]];
$metal = floor(eval($ProdGrid[$ProdID]['formule']['metal']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * 0.05));
$crystal = floor(eval($ProdGrid[$ProdID]['formule']['crystal']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * 0.05));
$deuterium = floor(eval($ProdGrid[$ProdID]['formule']['deuterium']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * 0.05));
$energy = floor(eval($ProdGrid[$ProdID]['formule']['energy']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_ingenieur'] * 0.05));
if ($energy > 0) {
$CurrentPlanet['energy_max'] += $energy;
} else {
$CurrentPlanet['energy_used'] += $energy;
}
$CurrentPlanet['metal_perhour'] += $metal;
$CurrentPlanet['crystal_perhour'] += $crystal;
$CurrentPlanet['deuterium_perhour'] += $deuterium;
$metal_ref = $metal * 0.01 * $post_porcent;
$crystal_ref = $crystal * 0.01 * $post_porcent;
$deuterium_ref = $deuterium * 0.01 * $post_porcent;
$energy_ref = $energy;
$Field = $resource[$ProdID] . "_porcent";
$CurrRow = array();
$CurrRow['name'] = $resource[$ProdID];
$CurrRow['porcent'] = $CurrentPlanet[$Field];
for ($Option = 10; $Option >= 0; $Option--) {
$OptValue = $Option * 10;
if ($Option == $CurrRow['porcent']) {
$OptSelected = " selected=selected";
} else {
$OptSelected = "";
}
$CurrRow['option'] .= "<option value=\"" . $OptValue . "\"" . $OptSelected . ">" . $OptValue . "%</option>";
}
$CurrRow['type'] = $lang['tech'][$ProdID];
$CurrRow['level'] = $ProdID > 200 ? $lang['quantity'] : $lang['level'];
$CurrRow['level_type'] = $CurrentPlanet[$resource[$ProdID]];
$metal_type = pretty_number(abs($metal_ref));
$crystal_type = pretty_number(abs($crystal_ref));
//.........这里部分代码省略.........
示例6: elseif
$missiontype[5] = $lang['type_mission'][5];
}
} elseif ($_POST['ship209'] >= 1 || $_POST['ship208']) {
$missiontype[3] = $lang['type_mission'][3];
}
if ($YourPlanet) {
$missiontype[4] = $lang['type_mission'][4];
}
if ($_POST['planettype'] == 3 && ($_POST['ship214'] || $_POST['ship213']) && !$YourPlanet && $UsedPlanet) {
$missiontype[2] = $lang['type_mission'][2];
}
}
if (empty($missiontype[$fleetmission])) {
message("<font color=\"red\"><b>" . $lang['fl_bad_mission'] . "</b></font>", $lang['fl_error'], "fleet." . $phpEx, 2);
}
CheckPlanetUsedFields($CurrentPlanet);
if ($TargetPlanet['id_owner'] == '') {
$HeDBRec = $MyDBRec;
} elseif ($TargetPlanet['id_owner'] != '') {
$HeDBRec = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $TargetPlanet['id_owner'] . "';", 'users', true);
}
$UserPoints = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $MyDBRec['id'] . "';", 'statpoints', true);
$User2Points = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $HeDBRec['id'] . "';", 'statpoints', true);
$MyGameLevel = $UserPoints['total_points'];
$HeGameLevel = $User2Points['total_points'];
$VacationMode = $HeDBRec['urlaubs_modus'];
//假期模式
if ($user['authlevel'] < 1) {
if ($MyGameLevel > $HeGameLevel * $protectionmulti and $TargetPlanet['id_owner'] != '' and $_POST['mission'] == 1 and $protection == 1 and $HeGameLevel < $protectiontime * 500) {
message("<font color=\"lime\"><b>1." . $lang['fl_noob_mess_n'] . "</b></font>", $lang['fl_noob_title'], "fleet." . $phpEx, 2);
}
示例7: Play
function Play()
{
global $resource;
$this->HandleOwnFleets();
$iPlanetCount = doquery("SELECT count(*) AS `total` FROM {{table}} WHERE `id_owner` = '" . $this->user['id'] . "' AND `planet_type` = '1'", 'planets', true);
$maxfleet = doquery("SELECT COUNT(fleet_owner) AS `actcnt` FROM {{table}} WHERE `fleet_owner` = '" . $this->user['id'] . "';", 'fleets', true);
$maxcolofleet = doquery("SELECT COUNT(fleet_owner) AS `total` FROM {{table}} WHERE `fleet_owner` = '" . $this->user['id'] . "' AND `fleet_mission` = '7';", 'fleets', true);
$MaxFlyingFleets = $maxfleet['actcnt'];
$MaxFlottes = $this->user[$resource[108]];
$planetselected = false;
$planetwork = false;
$planetquery = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $this->user['id'] . "' AND `planet_type` = '1' ORDER BY `id` ASC;", 'planets', false);
while ($this->CurrentPlanet = $planetquery->fetch_array()) {
if ($planetselected == true and $this->CurrentPlanet['id_owner'] == $this->user['id']) {
CheckPlanetUsedFields($this->CurrentPlanet);
if (!is_null($this->log)) {
$this->log .= $this->user['username'] . ' - Hora: ' . date('H:i:s - j/n/Y') . ' - Planeta: ' . $this->CurrentPlanet['name'] . ' [' . $this->CurrentPlanet['id'] . ']' . "\n";
}
$this->BuildStores();
$Rand = mt_rand(0, 1);
if ($Rand == 1 or $this->CurrentPlanet[$resource[4]] <= 5) {
$this->BuildBuildings();
} else {
$this->BuildSpecialBuildings();
}
if ($this->CurrentPlanet[$resource[31]] > 0) {
$this->ResearchTechs();
}
$Rand = mt_rand(0, 1);
if ($Rand == 1) {
$this->BuildFleet();
} else {
$this->BuildDefense();
}
if ($iPlanetCount['total'] < MAX_PLAYER_PLANETS and $maxcolofleet['total'] < MAX_PLAYER_PLANETS - $maxcolofleet['total'] and $MaxFlyingFleets < $MaxFlottes and $this->CurrentPlanet[$resource[208]] >= 1) {
$this->Colonize($iPlanetCount['total']);
}
if ($this->CurrentPlanet['id'] == $this->user['id_planet']) {
if ($MaxFlyingFleets < $MaxFlottes + 1) {
$this->HandleOtherFleets();
}
} elseif ($MaxFlyingFleets < $MaxFlottes) {
$this->GetFleet();
}
$this->Update();
$planetselected = false;
$planetwork = true;
$planetid = $this->CurrentPlanet['id'];
} else {
if ($this->CurrentPlanet['id'] == $this->Bot['last_planet']) {
$planetselected = true;
}
}
}
if ($planetwork == false) {
$this->CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $this->user['id_planet'] . "';", 'planets', true);
CheckPlanetUsedFields($this->CurrentPlanet);
if (!is_null($this->log)) {
$this->log .= $this->user['username'] . ' - Hora: ' . date('H:i:s - j/n/Y') . ' - Planeta: ' . $this->CurrentPlanet['name'] . ' [' . $this->CurrentPlanet['id'] . ']' . "\n";
}
$this->BuildStores();
$Rand = mt_rand(0, 1);
if ($Rand == 1 or $this->CurrentPlanet[$resource[4]] <= 5) {
$this->BuildBuildings();
} else {
$this->BuildSpecialBuildings();
}
if ($this->CurrentPlanet[$resource[31]] > 0) {
$this->ResearchTechs();
}
$Rand = mt_rand(0, 1);
if ($Rand == 1) {
$this->BuildFleet();
} else {
$this->BuildDefense();
}
if ($iPlanetCount['total'] < MAX_PLAYER_PLANETS and $maxcolofleet['total'] < MAX_PLAYER_PLANETS - $maxcolofleet['total'] and $MaxFlyingFleets < $MaxFlottes and $this->CurrentPlanet[$resource[208]] >= 1) {
$this->Colonize($iPlanetCount['total']);
}
if ($this->CurrentPlanet['id'] == $this->user['id_planet']) {
if ($MaxFlyingFleets < $MaxFlottes + 1) {
$this->HandleOtherFleets();
}
} elseif ($MaxFlyingFleets < $MaxFlottes) {
$this->GetFleet();
}
$this->Update();
$planetid = $this->user['id_planet'];
}
$this->end_planet = $planetid;
}
示例8: ShowOverviewPage
function ShowOverviewPage($CurrentUser, $CurrentPlanet)
{
global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user;
include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx;
$FlyingFleetsTable = new FlyingFleetsTable();
$lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . intval($CurrentPlanet['id_owner']) . "' AND `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type`='3'", 'planets', true);
if (empty($lunarow)) {
unset($lunarow);
}
CheckPlanetUsedFields($lunarow);
$parse = $lang;
$parse['planet_id'] = $CurrentPlanet['id'];
$parse['planet_name'] = $CurrentPlanet['name'];
$parse['galaxy_galaxy'] = $CurrentPlanet['galaxy'];
$parse['galaxy_system'] = $CurrentPlanet['system'];
$parse['galaxy_planet'] = $CurrentPlanet['planet'];
switch ($_GET['mode']) {
case 'renameplanet':
if ($_POST['action'] == $lang['ov_planet_rename_action']) {
$newname = mysql_escape_string(strip_tags(trim($_POST['newname'])));
if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) {
message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2);
}
if ($newname != "") {
doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", "planets");
}
} elseif ($_POST['action'] == $lang['ov_abandon_planet']) {
return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse));
} elseif (intval($_POST['kolonieloeschen']) == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) {
$filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_owner = '" . intval($user['id']) . "' AND fleet_start_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_start_system='" . intval($CurrentPlanet['system']) . "' AND fleet_start_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets');
while ($satir = mysql_fetch_array($filokontrol)) {
$kendifilo = $satir['fleet_owner'];
$digerfilo = $satir['fleet_target_owner'];
$harabeyeri = $satir['fleet_end_type'];
$mess = $satir['fleet_mess'];
}
$filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_target_owner = '" . intval($user['id']) . "' AND fleet_end_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_end_system='" . intval($CurrentPlanet['system']) . "' AND fleet_end_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets');
while ($satir = mysql_fetch_array($filokontrol)) {
$kendifilo = $satir['fleet_owner'];
$digerfilo = $satir['fleet_target_owner'];
$gezoay = $satir['fleet_end_type'];
$mess = $satir['fleet_mess'];
}
if ($kendifilo > 0) {
message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
} elseif ($digerfilo > 0 && $mess < 1 && $gezoay != 2) {
message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
} else {
if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) {
doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets');
doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . intval($CurrentUser['id']) . "' LIMIT 1", "users");
doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = 3;", 'planets');
message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet');
} elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) {
message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet');
} else {
message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet');
}
}
}
return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse));
break;
default:
if ($CurrentUser['new_message'] != 0) {
$Have_new_message .= "<tr>";
if ($CurrentUser['new_message'] == 1) {
$Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>";
} elseif ($CurrentUser['new_message'] > 1) {
$Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>";
$Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']);
$Have_new_message .= "</a></th>";
}
$Have_new_message .= "</tr>";
}
$OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets');
$Record = 0;
while ($FleetRow = mysql_fetch_array($OwnFleets)) {
$Record++;
$StartTime = $FleetRow['fleet_start_time'];
$StayTime = $FleetRow['fleet_end_stay'];
$EndTime = $FleetRow['fleet_end_time'];
/////// // ### LUCKY , CODES ARE BELOW
$hedefgalaksi = $FleetRow['fleet_end_galaxy'];
$hedefsistem = $FleetRow['fleet_end_system'];
$hedefgezegen = $FleetRow['fleet_end_planet'];
$mess = $FleetRow['fleet_mess'];
$filogrubu = $FleetRow['fleet_group'];
$id = $FleetRow['fleet_id'];
//////
$Label = "fs";
if ($StartTime > time()) {
$fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record);
}
if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) {
$Label = "ft";
if ($StayTime > time()) {
$fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record);
}
$Label = "fe";
//.........这里部分代码省略.........
示例9: BatimentBuildingPage
/**
* BatimentBuildingPage.php
*
* @version 1.1
* @copyright 2008 by Chlorel for XNova
*/
function BatimentBuildingPage(&$CurrentPlanet, $CurrentUser)
{
global $lang, $resource, $reslist, $dpath, $game_config, $_GET;
CheckPlanetUsedFields($CurrentPlanet);
// Tables des batiments possibles par type de planete
$Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 44);
$Allowed['3'] = array(12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
// Boucle d'interpretation des eventuelles commandes
if (isset($_GET['cmd'])) {
// On passe une commande
$bThisIsCheated = false;
$bDoItNow = false;
$TheCommand = $_GET['cmd'];
if (isset($_GET['building'])) {
//Wenn Variable gefüllt ist
$Element = intval($_GET['building']);
// Muss ne Zahl sein
if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
$bDoItNow = true;
// Ist true wenns vorhanden ist und eine Zahl aus der Whitelist des jeweiligen Typs enthält.
} else {
$bThisIsCheated = true;
}
}
if (isset($_GET['listid'])) {
//Wenn Variable gefüllt ist...
$ListID = intval($_GET['listid']);
// Das hier muss ne Zahl sein
$bDoItNow = true;
// Und ist auch true wenn $ListID vorhanden ist
}
if ($bDoItNow == true) {
// Wenn True dann mach hier weiter
switch ($TheCommand) {
case 'cancel':
// Bricht den aktuell laufenden Auftrag ab
CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
break;
case 'remove':
// Entfernt ein wartendes Element aus der Bauschleife
RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
break;
case 'insert':
// Fügt ein Element zur Bauschleife hinzu
if ($Element == 31) {
if ($CurrentUser["b_tech_planet"] == 0 || $game_config['BuildLabWhileRun'] == 1) {
AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
}
} else {
AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
}
break;
case 'destroy':
// Baut ein Gebäude eine Stufe ab
if ($Element == 31) {
if ($CurrentUser["b_tech_planet"] == 0 || $game_config['BuildLabWhileRun'] == 1) {
AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
}
} else {
AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
}
break;
default:
break;
}
}
header('Location: ?action=internalBuildings');
//Nach nem Klick Weiterleitung auf die Bauseite um Doppelklicke zu vermeiden
}
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
$Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
// Änderungen in den Planeten Rekorden übernehmen
BuildingSavePlanetRecord($CurrentPlanet);
// Änderungen in den Userrekorden übernehmen
BuildingSaveUserRecord($CurrentUser);
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
//Solange noch Platz in der Bauischleife ist...
$CanBuildElement = true;
// ...kann man bauen
} else {
$CanBuildElement = false;
}
$SubTemplate = gettemplate('buildings_builds_row');
$BuildingPage = "";
foreach ($lang['tech'] as $Element => $ElementName) {
if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
$CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
if ($CurrentPlanet["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
$RoomIsOk = true;
} else {
$RoomIsOk = false;
}
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
//.........这里部分代码省略.........
示例10: ShowBuildingsPage
public function ShowBuildingsPage(&$CurrentPlanet, $CurrentUser)
{
global $ProdGrid, $lang, $resource, $reslist, $phpEx, $db, $svn_root, $displays;
include_once $svn_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
include_once $svn_root . 'includes/functions/GetElementPrice.' . $phpEx;
$displays->assignContent('buildings/buildings_building');
CheckPlanetUsedFields($CurrentPlanet);
$Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 35, 44, 45);
$Allowed['3'] = array(12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
if (isset($_GET['cmd'])) {
$bDoItNow = false;
$TheCommand = $_GET['cmd'];
$Element = $_GET['building'];
$ListID = $_GET['listid'];
if (!in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
unset($Element);
}
if (isset($Element)) {
if (!strchr($Element, ",") && !strchr($Element, " ") && !strchr($Element, "+") && !strchr($Element, "*") && !strchr($Element, "~") && !strchr($Element, "=") && !strchr($Element, ";") && !strchr($Element, "'") && !strchr($Element, "#") && !strchr($Element, "-") && !strchr($Element, "_") && !strchr($Element, "[") && !strchr($Element, "]") && !strchr($Element, ".") && !strchr($Element, ":")) {
if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
$bDoItNow = true;
}
} else {
header("location:game.php?page=buildings");
}
} elseif (isset($ListID)) {
$bDoItNow = true;
}
if ($Element == 31 && $CurrentUser["b_tech_planet"] != 0) {
$bDoItNow = false;
}
if (($Element == 21 or $Element == 14 or $Element == 15) && $CurrentPlanet["b_hangar"] != 0) {
$bDoItNow = false;
}
if ($bDoItNow == true) {
switch ($TheCommand) {
case 'cancel':
$this->CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
break;
case 'remove':
$this->RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
break;
case 'insert':
$this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
break;
case 'destroy':
$this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
break;
}
header("location:game.php?page=buildings");
}
}
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
$Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser);
$this->BuildingSavePlanetRecord($CurrentPlanet);
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
$siguiente = 1;
foreach ($reslist['build'] as $Element) {
if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
$CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
if ($CurrentPlanet["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
$RoomIsOk = true;
} else {
$RoomIsOk = false;
}
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$displays->newblock('build');
$HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
$parse['i'] = $Element;
$BuildingLevel = $CurrentPlanet[$resource[$Element]];
$parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['bd_lvl'] . " " . $BuildingLevel . ")";
$parse['n'] = $lang['tech'][$Element];
$parse['descriptionss'] = $lang['res']['descriptions'][$Element];
$ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
$parse['time'] = ShowBuildTime($ElementBuildTime);
$parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
$NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
if ($RoomIsOk && $CanBuildElement) {
if ($Queue['lenght'] == 0) {
if ($NextBuildLevel == 1) {
if ($HaveRessources == true) {
$parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_build'] . "</font></a>";
} else {
$parse['click'] = "<font color=#FF0000>" . $lang['bd_build'] . "</font>";
}
} else {
if ($HaveRessources == true) {
$parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_build_next_level'] . $NextBuildLevel . "</font></a>";
} else {
$parse['click'] = "<font color=#FF0000>" . $lang['bd_build_next_level'] . $NextBuildLevel . "</font>";
}
}
} else {
$parse['click'] = "<a href=\"game.php?page=buildings&cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['bd_add_to_list'] . "</font></a>";
}
} elseif ($RoomIsOk && !$CanBuildElement) {
//.........这里部分代码省略.........
示例11: ShowOverviewPage
function ShowOverviewPage($CurrentUser, $CurrentPlanet)
{
global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user, $resource;
include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx;
include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx;
include_once $xgp_root . 'includes/functions/CheckPlanetUsedFields.' . $phpEx;
$FlyingFleetsTable = new FlyingFleetsTable();
$lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . intval($CurrentPlanet['id_owner']) . "' AND `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type`='3'", 'planets', true);
if (empty($lunarow)) {
unset($lunarow);
}
CheckPlanetUsedFields($lunarow);
$parse = $lang;
$parse['id'] = $user['id'];
$parse['planet_id'] = $CurrentPlanet['id'];
$parse['planet_name'] = $CurrentPlanet['name'];
$parse['galaxy_galaxy'] = $CurrentPlanet['galaxy'];
$parse['galaxy_system'] = $CurrentPlanet['system'];
$parse['galaxy_planet'] = $CurrentPlanet['planet'];
$parse['dpath'] = $dpath;
$parse['avatar'] = $user['avatar'];
$QueryStat = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `stat_type` = '1'", "statpoints", true);
$parse['puntos_defensa'] = pretty_number($QueryStat['defs_count']);
$parse['puntos_edificios'] = pretty_number($QueryStat['build_points']);
$parse['puntos_naves'] = pretty_number($QueryStat['fleet_count']);
$parse['puntos_investigaciones'] = pretty_number($QueryStat['tech_count']);
$StatRecord = doquery("SELECT `total_rank`,`total_points`,`defs_rank`,`build_rank`,`fleet_rank`,`tech_rank` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true);
$parse['top_defensa'] = $StatRecord['defs_rank'];
$parse['top_edificios'] = $StatRecord['build_rank'];
$parse['top_naves'] = $StatRecord['fleet_rank'];
$parse['top_investigaciones'] = $StatRecord['tech_rank'];
switch ($_GET['mode']) {
case 'renameplanet':
if ($_POST['action'] == $lang['ov_planet_rename_action']) {
$newname = mysql_escape_string(strip_tags(trim($_POST['newname'])));
if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) {
message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2);
}
if ($newname != "") {
doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", "planets");
}
} elseif ($_POST['action'] == $lang['ov_abandon_planet']) {
return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse));
} elseif (intval($_POST['kolonieloeschen']) == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) {
$filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_owner = '" . intval($user['id']) . "' AND fleet_start_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_start_system='" . intval($CurrentPlanet['system']) . "' AND fleet_start_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets');
while ($satir = mysql_fetch_array($filokontrol)) {
$kendifilo = $satir['fleet_owner'];
$digerfilo = $satir['fleet_target_owner'];
$harabeyeri = $satir['fleet_end_type'];
$mess = $satir['fleet_mess'];
}
$filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_target_owner = '" . intval($user['id']) . "' AND fleet_end_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_end_system='" . intval($CurrentPlanet['system']) . "' AND fleet_end_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets');
while ($satir = mysql_fetch_array($filokontrol)) {
$kendifilo = $satir['fleet_owner'];
$digerfilo = $satir['fleet_target_owner'];
$gezoay = $satir['fleet_end_type'];
$mess = $satir['fleet_mess'];
}
if ($kendifilo > 0) {
message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
} elseif ($digerfilo > 0 && $mess < 1 && $gezoay != 2) {
message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet');
} else {
if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) {
doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets');
doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . intval($CurrentUser['id']) . "' LIMIT 1", "users");
doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = 3;", 'planets');
message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet');
} elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) {
message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet');
} else {
message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet');
}
}
}
return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse));
break;
default:
$CONSULTA = doquery("SELECT metal,crystal FROM {{table}} WHERE galaxy = '" . $CurrentPlanet['galaxy'] . "' AND system = '" . $CurrentPlanet['system'] . "' AND planet = '" . $CurrentPlanet['planet'] . "'", "galaxy", true);
$parse['metal_debris'] = pretty_number($CONSULTA['metal']);
$parse['crystal_debris'] = pretty_number($CONSULTA['crystal']);
if ($CurrentPlanet['recycler'] != 0 && ($CONSULTA['metal'] != 0 || $CONSULTA['crystal'] != 0)) {
$parse['get_link'] = " (<a href=\"game.php?page=galaxy&mode=8&g=" . $CurrentPlanet['galaxy'] . "&s=" . $CurrentPlanet['system'] . "&p=" . $CurrentPlanet['planet'] . "&t=2\"> DF </a>)";
} else {
$parse['get_link'] = '';
}
if ($CurrentUser['new_message'] != 0) {
$Have_new_message .= "<tr>";
if ($CurrentUser['new_message'] == 1) {
$Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>";
} elseif ($CurrentUser['new_message'] > 1) {
$Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>";
$Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']);
$Have_new_message .= "</a></th>";
}
$Have_new_message .= "</tr>";
}
$OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets');
$Record = 0;
while ($FleetRow = mysql_fetch_array($OwnFleets)) {
//.........这里部分代码省略.........
示例12: __construct
public function __construct()
{
global $ProdGrid, $LNG, $resource, $reslist, $CONF, $db, $PLANET, $USER;
include_once ROOT_PATH . 'includes/functions/IsTechnologieAccessible.' . PHP_EXT;
include_once ROOT_PATH . 'includes/functions/GetElementPrice.' . PHP_EXT;
CheckPlanetUsedFields($PLANET);
$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']]) && ($Element == 31 && $USER["b_tech_planet"] == 0 || $Element != 31) && (($Element == 15 || $Element == 21) && empty($PLANET['b_hangar_id']) || ($Element != 15 || $Element != 21))) || $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();
$Queue = $this->ShowBuildingQueue();
$template = new template();
$template->page_header();
$template->page_topnav();
$template->page_leftmenu();
$template->page_planetmenu();
$template->page_footer();
$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 + $USER['rpg_ingenieur'] * 0.05);
$BuildLevel += 1;
$Prod = floor(eval($ProdGrid[$Element]['formule']['energy']) * $CONF['resource_multiplier']) * (1 + $USER['rpg_ingenieur'] * 0.05);
$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 == 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'], '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']));
$template->show("buildings_overview.tpl");
}
示例13: __construct
public function __construct(&$CurrentPlanet, $CurrentUser)
{
global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $xgp_root;
include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
CheckPlanetUsedFields($CurrentPlanet);
$parse = $lang;
$Allowed['1'] = array(1, 2, 3, 4, 5, 12, 14, 15, 21, 22, 23, 24, 25, 31, 33, 34, 35, 44, 45);
$Allowed['3'] = array(12, 14, 21, 22, 23, 24, 25, 34, 41, 42, 43);
if (isset($_GET['cmd'])) {
$bDoItNow = false;
$TheCommand = $_GET['cmd'];
$Element = $_GET['building'];
$ListID = $_GET['listid'];
if (!in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
unset($Element);
}
if (isset($Element)) {
if (!strchr($Element, ",") && !strchr($Element, " ") && !strchr($Element, "+") && !strchr($Element, "*") && !strchr($Element, "~") && !strchr($Element, "=") && !strchr($Element, ";") && !strchr($Element, "'") && !strchr($Element, "#") && !strchr($Element, "-") && !strchr($Element, "_") && !strchr($Element, "[") && !strchr($Element, "]") && !strchr($Element, ".") && !strchr($Element, ":")) {
if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
$bDoItNow = true;
}
} else {
header("location:game.php?page=buildings");
}
} elseif (isset($ListID)) {
$bDoItNow = true;
}
if ($Element == 31 && $CurrentUser["b_tech_planet"] != 0) {
$bDoItNow = false;
}
if (($Element == 21 or $Element == 14 or $Element == 15) && $CurrentPlanet["b_hangar"] != 0) {
$bDoItNow = false;
}
if ($bDoItNow == true) {
switch ($TheCommand) {
case 'cancel':
$this->CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
break;
case 'remove':
$this->RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
break;
case 'insert':
$this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
break;
case 'destroy':
$this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
break;
}
}
if ($_GET['r'] == 'overview') {
header('location:game.php?page=overview');
} else {
header("Location: game.php?page=buildings&mode=buildings");
}
}
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
if (empty($CurrentPlanet['b_building_id'])) {
$CurrentPlanetID = intval($CurrentPlanet['id']);
doquery("UPDATE {{table}} SET `b_building_id` = '0', `b_building` = '0' WHERE `id` = '{$CurrentPlanetID}';", 'planets');
$CurrentPlanet['b_building_id'] = "0";
$CurrentPlanet['b_building'] = 0;
}
$Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser);
$this->BuildingSavePlanetRecord($CurrentPlanet);
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
$BuildingPage = "";
$zaehler = 1;
foreach ($lang['tech'] as $Element => $ElementName) {
if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
$CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
if ($CurrentPlanet["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
$RoomIsOk = true;
} else {
$RoomIsOk = false;
}
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
$parse = array();
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['i'] = $Element;
$BuildingLevel = $CurrentPlanet[$resource[$Element]];
$parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['bd_lvl'] . " " . $BuildingLevel . ")";
$BuildLevelFactor = 10;
$BuildTemp = $CurrentPlanet['temp_max'];
$CurrentBuildtLvl = $BuildingLevel;
$BuildLevel = $CurrentBuildtLvl > 0 ? $CurrentBuildtLvl : 1;
$EnergyTechLevel = $CurrentUser["energy_tech"];
$Prod[4] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
$ActualNeed = floor($Prod[4]);
$BuildLevel++;
$Prod[4] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
$EnergyNeed = colorNumber(pretty_number(floor($Prod[4] - $ActualNeed)));
if ($Element >= 1 && $Element <= 3 or $Element == 5) {
$parse['energy'] = " <font color=#FF0000>" . $EnergyNeed . "</font>";
//.........这里部分代码省略.........
示例14: ResearchPage
function ResearchPage(&$CurrentPlanet, $CurrentUser, $InResearch, $ThePlanet)
{
global $lang, $resource, $reslist, $pricelist, $phpEx, $dpath, $game_config, $_GET;
CheckPlanetUsedFields($CurrentPlanet);
// Boucle d'interpretation des eventuelles commandes
if (isset($_GET['cmd'])) {
$TheCommand = $_GET['cmd'];
$Techno = idstring($_GET['tech']);
if (is_numeric($Techno)) {
if (in_array($Techno, $reslist['tech'])) {
// Bon quand on arrive ici ... On sait deja qu'on a une technologie valide
if (is_array($ThePlanet)) {
$WorkingPlanet = $ThePlanet;
} else {
$WorkingPlanet = $CurrentPlanet;
}
switch ($TheCommand) {
case 'cancel':
if ($ThePlanet['b_tech_id'] == $Techno) {
$costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
$WorkingPlanet['metal'] += $costs['metal'];
$WorkingPlanet['crystal'] += $costs['crystal'];
$WorkingPlanet['deuterium'] += $costs['deuterium'];
$WorkingPlanet['b_tech_id'] = 0;
$WorkingPlanet["b_tech"] = 0;
$CurrentUser['b_tech_planet'] = 0;
$UpdateData = true;
$InResearch = false;
}
break;
case 'search':
if (IsTechnologieAccessible($CurrentUser, $WorkingPlanet, $Techno) && IsElementBuyable($CurrentUser, $WorkingPlanet, $Techno) && !$InResearch) {
$costs = GetBuildingPrice($CurrentUser, $WorkingPlanet, $Techno);
$WorkingPlanet['metal'] -= $costs['metal'];
$WorkingPlanet['crystal'] -= $costs['crystal'];
$WorkingPlanet['deuterium'] -= $costs['deuterium'];
$WorkingPlanet["b_tech_id"] = $Techno;
$WorkingPlanet["b_tech"] = time() + GetBuildingTime($CurrentUser, $WorkingPlanet, $Techno);
$CurrentUser["b_tech_planet"] = $WorkingPlanet["id"];
$UpdateData = true;
$InResearch = true;
}
break;
}
if ($UpdateData == true) {
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`b_tech_id` = '" . $WorkingPlanet['b_tech_id'] . "', ";
$QryUpdatePlanet .= "`b_tech` = '" . $WorkingPlanet['b_tech'] . "', ";
$QryUpdatePlanet .= "`metal` = '" . $WorkingPlanet['metal'] . "', ";
$QryUpdatePlanet .= "`crystal` = '" . $WorkingPlanet['crystal'] . "', ";
$QryUpdatePlanet .= "`deuterium` = '" . $WorkingPlanet['deuterium'] . "' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '" . $WorkingPlanet['id'] . "';";
doquery($QryUpdatePlanet, 'planets');
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`b_tech_planet` = '" . $CurrentUser['b_tech_planet'] . "' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '" . $CurrentUser['id'] . "';";
doquery($QryUpdateUser, 'users');
}
if (is_array($ThePlanet)) {
$ThePlanet = $WorkingPlanet;
} else {
$CurrentPlanet = $WorkingPlanet;
if ($TheCommand == 'search') {
$ThePlanet = $CurrentPlanet;
}
}
}
} else {
$bContinue = false;
}
}
$TechScrTPL = gettemplate('buildings_research_script');
$SubTemplate = gettemplate('buildings/research_buttonz');
$parse = array();
$infopg = array();
foreach ($lang['names'] as $Tech => $TechName) {
if ($Tech > 105 && $Tech <= 199) {
if (!IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
$parse['state_' . $Tech] = "off";
$parse['mes_' . $Tech] = "Requirements are not met";
} elseif (!IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech)) {
$parse['state_' . $Tech] = "disabled";
$parse['mes_' . $Tech] = "Not enough resources!";
} else {
$parse['state_' . $Tech] = "on";
$parse['mes_' . $Tech] = "";
}
} else {
$parse['state_' . $Tech] = "off";
$parse['mes_' . $Tech] = "Not availble";
}
$parse['name_' . $Tech] = $TechName;
$parse['count_' . $Tech] = $CurrentUser[$resource[$Tech]];
}
//Anything currently building?
if ($CurrentUser['b_tech_planet']) {
$WorkingPlanet = doquery("SELECT `id`,`name`,`b_tech_id`,`b_tech` FROM {{table}} WHERE `id` = '" . $CurrentUser['b_tech_planet'] . "';", 'planets', true);
//Whats currently building
//.........这里部分代码省略.........
示例15: ShowBuildingsPage
public function ShowBuildingsPage(&$CurrentPlanet, $CurrentUser)
{
global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $xgp_root;
include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
CheckPlanetUsedFields($CurrentPlanet);
$parse = $lang;
$Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 35, 44);
$Allowed['3'] = array(12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
if (isset($_GET['cmd'])) {
$bDoItNow = false;
$TheCommand = $_GET['cmd'];
$Element = $_GET['building'];
$ListID = $_GET['listid'];
if (!in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
unset($Element);
}
if (isset($Element)) {
if (!strchr($Element, ",") && !strchr($Element, " ") && !strchr($Element, "+") && !strchr($Element, "*") && !strchr($Element, "~") && !strchr($Element, "=") && !strchr($Element, ";") && !strchr($Element, "'") && !strchr($Element, "#") && !strchr($Element, "-") && !strchr($Element, "_") && !strchr($Element, "[") && !strchr($Element, "]") && !strchr($Element, ".") && !strchr($Element, ":")) {
if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
$bDoItNow = true;
}
} else {
header("location:game.php?page=buildings");
}
} elseif (isset($ListID)) {
$bDoItNow = true;
}
if ($bDoItNow == true) {
switch ($TheCommand) {
case 'cancel':
$this->CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
break;
case 'remove':
$this->RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
break;
case 'insert':
$this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
break;
case 'destroy':
$this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
break;
}
}
}
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
$Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser);
$this->BuildingSavePlanetRecord($CurrentPlanet);
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
$BuildingPage = "";
$zaehler = 1;
$siguiente = 1;
foreach ($lang['tech'] as $BuildID => $ElementName) {
if (in_array($BuildID, $Allowed[$CurrentPlanet['planet_type']])) {
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['name'] = $lang['info'][$BuildID]['name'];
$parse['image'] = $BuildID;
$parse['description'] = $lang['info'][$BuildID]['description'];
$NeededRessources = GetBuildingPrice($CurrentUser, $CurrentPlanet, $BuildID, true, true);
$DestroyTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $BuildID) / 2;
$parse['destroyurl'] = "game.php?page=buildings&cmd=destroy&building=" . $BuildID;
$parse['levelvalue'] = $CurrentPlanet[$resource[$BuildID]];
$parse['nfo_metal'] = $lang['Metal'];
$parse['nfo_crysta'] = $lang['Crystal'];
$parse['nfo_deuter'] = $lang['Deuterium'];
$parse['metal'] = pretty_number($NeededRessources['metal']);
$parse['crystal'] = pretty_number($NeededRessources['crystal']);
$parse['deuterium'] = pretty_number($NeededRessources['deuterium']);
$parse['destroytime'] = pretty_time($DestroyTime);
$infodiv .= parsetemplate(gettemplate('buildings/buildings_info_row'), $parse);
}
}
foreach ($lang['tech'] as $Element => $ElementName) {
if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
$CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
if ($CurrentPlanet["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
$RoomIsOk = true;
} else {
$RoomIsOk = false;
}
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
$parse = array();
$parse = $lang;
$parse['dpath'] = $dpath;
if ($siguiente == 1) {
$parse['abrirtr'] = "<tr>";
}
$parse['i'] = $Element;
$BuildingLevel = $CurrentPlanet[$resource[$Element]];
$parse['nivel'] = $BuildingLevel == 0 ? " (" . $lang['bd_lvl'] . " 0)" : " (" . $lang['bd_lvl'] . " " . $BuildingLevel . ")";
$BuildLevelFactor = $CurrentPlanet[$resource[$Element] . "_porcent"];
$BuildTemp = $CurrentPlanet['temp_max'];
$CurrentBuildtLvl = $BuildingLevel;
$BuildLevel = $CurrentBuildtLvl > 0 ? $CurrentBuildtLvl : 1;
//.........这里部分代码省略.........