本文整理汇总了PHP中IsTechnologieAccessible函数的典型用法代码示例。如果您正苦于以下问题:PHP IsTechnologieAccessible函数的具体用法?PHP IsTechnologieAccessible怎么用?PHP IsTechnologieAccessible使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsTechnologieAccessible函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
//.........这里部分代码省略.........
示例2: FleetBuildingPage
function FleetBuildingPage(&$CurrentPlanet, $CurrentUser)
{
global $lang, $resource, $phpEx, $dpath, $_POST;
if ($CurrentUser['urlaubs_modus'] == 0) {
if (isset($_POST['fmenge'])) {
// Es wurde 'Bauen' geklickt
// Und hat auch eine Liste von [?]
$AddedInQueue = false;
// Gut, hier weiss man was und wieviel gebaut werden soll.
foreach ($_POST['fmenge'] as $Element => $Count) {
// Bau der Flotte auf der Flottenseite
// ACHTUNG ! Die Warteschlange der Flotte und Verteidigung werden zusammen verarbeitet.
// In fmenge, sollte man eine Tabelle der Elemente Baugrundstücke und der Anzahl der Elemente haben
$Element = intval($Element);
$Count = intval($Count);
if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
$Count = MAX_FLEET_OR_DEFS_PER_ROW;
}
if ($Count != 0) {
// Verified, wenn man die notwendige Technologie hat für den Bau des aktuellen Elements
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
// Verified, hole maximal mögliche Anzahl
$MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
// Wenn nicht genügend Ressourcen vorhanden sind, wird eine Anpassung der Anzahl der Elemente vorgenommen
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
$Ressource = GetElementRessources($Element, $Count);
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
if ($Count >= 1) {
$CurrentPlanet['metal'] -= $Ressource['metal'];
$CurrentPlanet['crystal'] -= $Ressource['crystal'];
$CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
$CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
}
}
}
}
}
}
// -------------------------------------------------------------------------------------------------------
// Wenn nix gebaut wird / werden kann
if ($CurrentPlanet[$resource[21]] == 0) {
// Veuillez avoir l'obligeance de construire le Chantier Spacial !!
message($lang['need_hangar'], $lang['tech'][21]);
}
// -------------------------------------------------------------------------------------------------------
// Bau der Seite der Baustelle (denn wenn ich hier ... ist, dass ich alles, was Sie brauchen, um ...
$TabIndex = 0;
foreach ($lang['tech'] as $Element => $ElementName) {
if ($Element > 201 && $Element <= 399) {
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
// Disponible à la construction
// On regarde si on peut en acheter au moins 1
$CanBuildOne = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, false);
// On regarde combien de temps il faut pour construire l'element
$BuildOneElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
// Disponibilité actuelle
$ElementCount = $CurrentPlanet[$resource[$Element]];
$ElementNbre = $ElementCount == 0 ? "" : " (" . $lang['dispo'] . ": " . pretty_number($ElementCount) . ")";
// Construction des 3 cases de la ligne d'un element dans la page d'achat !
// Début de ligne
$PageTable .= "\n<tr>";
// Imagette + Link vers la page d'info
$PageTable .= "<th class=l>";
$PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">";
$PageTable .= "<img border=0 src=\"" . $dpath . "gebaeude/" . $Element . ".gif\" align=top width=120 height=120></a>";
$PageTable .= "</th>";
// Description
$PageTable .= "<td class=l>";
$PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">" . $ElementName . "</a> " . $ElementNbre . "<br>";
$PageTable .= "" . $lang['res']['descriptions'][$Element] . "<br>";
// On affiche le 'prix' avec eventuellement ce qui manque en ressource
$PageTable .= GetElementPrice($CurrentUser, $CurrentPlanet, $Element, false);
// On affiche le temps de construction (c'est toujours tellement plus joli)
$PageTable .= ShowBuildTime($BuildOneElementTime);
$PageTable .= "</td>";
// Case nombre d'elements a construire
$PageTable .= "<th class=k>";
// Si ... Et Seulement si je peux construire je mets la p'tite zone de saisie
if ($CanBuildOne) {
$TabIndex++;
$PageTable .= "<input type=text name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' size=5 maxlength=8 value=0 tabindex=" . $TabIndex . ">";
}
$PageTable .= "</th>";
// Fin de ligne (les 3 cases sont construites !!
$PageTable .= "</tr>";
}
}
}
if ($CurrentPlanet['b_hangar_id'] != '') {
$BuildQueue .= ElementBuildListBox($CurrentUser, $CurrentPlanet);
}
$parse = $lang;
// La page se trouve dans $PageTable;
$parse['buildlist'] = $PageTable;
// Et la liste de constructions en cours dans $BuildQueue;
$parse['buildinglist'] = $BuildQueue;
$page .= parsetemplate(gettemplate('buildings_fleet'), $parse);
display($page, $lang['Fleet']);
//.........这里部分代码省略.........
示例3: BuildingPage
//.........这里部分代码省略.........
BuildingSavePlanetRecord($planetrow);
// On enregistre ce que l'on a eventuellement modifi� dans users
BuildingSaveUserRecord($user);
$max_qs = MAX_BUILDING_QUEUE_SIZE;
if ($max_qs > 0) {
//fine :)
} else {
$max_qs = 10;
}
if ($Queue['length'] < $max_qs) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
if ($_GET['page'] == 'station') {
if ($planetrow['planet_type'] == 3) {
$SubTemplate = gettemplate('buildings/station-moon_buttonz');
} else {
$SubTemplate = gettemplate('buildings/station_buttonz');
}
} elseif ($_GET['page'] == 'resources') {
$SubTemplate = gettemplate('buildings/resources_buttonz');
} else {
die("Hacking attempt");
}
$parse = array();
$infopg = array();
foreach ($lang['names'] as $Element => $ElementName) {
if (!$planetrow['planet_type']) {
die("no planet type");
}
if (in_array($Element, $Allowed[$planetrow['planet_type']]) || $_GET['page'] == 'station') {
if (@in_array($Element, $Allowed[$planetrow['planet_type']])) {
if (!IsTechnologieAccessible($user, $planetrow, $Element)) {
$parse['state_' . $Element] = "off";
$parse['mes_' . $Element] = "Requirements are not met";
$parse['canbuild_' . $Element] = "";
} elseif (!IsElementBuyable($user, $planetrow, $Element, true, false) && $Queue['length'] == 0) {
$parse['state_' . $Element] = "disabled";
$parse['mes_' . $Element] = "Not enough resources!";
$parse['canbuild_' . $Element] = "";
} elseif (!$CanBuildElement) {
$parse['state_' . $Element] = "disabled";
$parse['mes_' . $Element] = "Queue is full!";
$parse['canbuild_' . $Element] = "";
} else {
$parse['state_' . $Element] = "on";
$parse['mes_' . $Element] = "";
$parse['canbuild_' . $Element] = "\n\t\t\t\t\t\t<a class=\"fastBuild tips\" href=\"#\" onclick=\"loadpage('./?page=" . $_GET['page'] . "&cmd=insert&building={$Element}&id={$Element}',document.title,document.body.id);\">\n\t\t\t\t\t\t\t<img src=\"" . GAME_SKIN . "/img/layout/sofort_bauen.gif\" height=\"14\" width=\"22\">\n\t\t\t\t\t\t</a>";
}
} else {
$parse['state_' . $Element] = "off";
$parse['mes_' . $Element] = "Not availble";
$parse['canbuild_' . $Element] = "";
}
$parse['name_' . $Element] = $ElementName;
$parse['count_' . $Element] = $planetrow[$resource[$Element]];
}
}
//Countdowns
if ($planetrow['b_building'] > 0) {
$BuildQueue = explode(";", $planetrow['b_building_id']);
$CurrBuild = explode(",", $BuildQueue[0]);
$parse['countdown_' . $CurrBuild[0]] = "\n\t\t\t\t\t\t\t\t\t<div class=\"construction\">\n\n\t\t\t\t\t\t\t\t\t\t<div class=\"pusher\" style=\"height: 80px; margin-bottom: -80px;\">\n\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"time\" id=\"resource\">" . parsecountdown($planetrow['b_building']) . "</span>\n\n\t\t\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t\t\t</div>\n";
}
$BuildingPage = parsetemplate($SubTemplate, $parse);
示例4: BuildDefense
protected function BuildDefense()
{
global $resource;
$DefLevel = array(401 => 150, 402 => 150, 403 => 90, 403 => 110, 404 => 70, 406 => 50);
uasort($DefLevel, 'scmp');
foreach ($DefLevel as $Element => $Max) {
if ($Element == 0) {
continue;
}
$MaxElements = $this->GetMaxConstructibleElements($Element, $this->CurrentPlanet);
$Count = $MaxElements;
if ($Count > $Max * $this->CurrentPlanet[$resource[21]]) {
$Count = $Max * $this->CurrentPlanet[$resource[21]];
}
$Value = 1 + pow(10, 2) - pow($this->CurrentPlanet[$resource[21]], 2);
if ($Value > 0) {
$Count = ceil($Count / $Value);
} else {
$Count = ceil($Count * $Value);
}
if (IsElementBuyable($this->user, $this->CurrentPlanet, $Element) and IsTechnologieAccessible($this->user, $this->CurrentPlanet, $Element)) {
$this->HangarBuild($Element, $Count);
}
}
}
示例5: ShowResearchPage
public function ShowResearchPage(&$CurrentPlanet, $CurrentUser, $InResearch, $ThePlanet)
{
global $lang, $resource, $reslist, $phpEx, $dpath, $db, $displays, $_GET;
include_once $svn_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
include_once $svn_root . 'includes/functions/GetElementPrice.' . $phpEx;
$displays->assignContent("buildings/buildings_research");
$NoResearchMessage = "";
$bContinue = true;
if ($CurrentPlanet[$resource[31]] == 0) {
$displays->message($lang['bd_lab_required'], '', '', true);
}
if (!$this->CheckLabSettingsInQueue($CurrentPlanet)) {
$displays->assign('noresearch', $lang['bd_building_lab']);
$bContinue = false;
}
if (isset($_GET['cmd']) && $bContinue) {
$TheCommand = $_GET['cmd'];
$Techno = intval($_GET['tech']);
if (isset($Techno)) {
if (!strstr($Techno, ",") && !strchr($Techno, " ") && !strchr($Techno, "+") && !strchr($Techno, "*") && !strchr($Techno, "~") && !strchr($Techno, "=") && !strchr($Techno, ";") && !strchr($Techno, "'") && !strchr($Techno, "#") && !strchr($Techno, "-") && !strchr($Techno, "_") && !strchr($Techno, "[") && !strchr($Techno, "]") && !strchr($Techno, ".") && !strchr($Techno, ":")) {
if (in_array($Techno, $reslist['tech'])) {
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)) {
$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'] . "';";
$db->query($QryUpdatePlanet, 'planets');
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`b_tech_planet` = '" . $CurrentUser['b_tech_planet'] . "' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '" . $CurrentUser['id'] . "';";
$db->query($QryUpdateUser, 'users');
}
$CurrentPlanet = $WorkingPlanet;
if (is_array($ThePlanet)) {
$ThePlanet = $WorkingPlanet;
} else {
$CurrentPlanet = $WorkingPlanet;
if ($TheCommand == 'search') {
$ThePlanet = $CurrentPlanet;
}
}
}
} else {
die(header("location:game.php?page=buildings&mode=research"));
}
} else {
$bContinue = false;
}
}
$siguiente = 1;
foreach ($reslist['tech'] as $Tech) {
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
$displays->newblock("research");
$RowParse['tech_id'] = $Tech;
$building_level = $CurrentUser[$resource[$Tech]];
if ($Tech == 106) {
$RowParse['tech_level'] = $building_level == 0 ? "" : "(" . $lang['bd_lvl'] . " " . $building_level . ")";
$RowParse['tech_level'] .= $CurrentUser['rpg_espion'] == 0 ? "" : "<strong><font color=\"lime\"> +" . $CurrentUser['rpg_espion'] * 5 . $lang['bd_spy'] . "</font></strong>";
} elseif ($Tech == 108) {
$RowParse['tech_level'] = $building_level == 0 ? "" : "(" . $lang['bd_lvl'] . " " . $building_level . ")";
$RowParse['tech_level'] .= $CurrentUser['rpg_commandant'] == 0 ? "" : "<strong><font color=\"lime\"> +" . $CurrentUser['rpg_commandant'] * 3 . $lang['bd_commander'] . "</font></strong>";
} else {
//.........这里部分代码省略.........
示例6: __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");
}
示例7: DefensesBuildingPage
/**
* This file is part of XNova:Legacies
*
* @license http://www.gnu.org/licenses/gpl-3.0.txt
* @see http://www.xnova-ng.org/
*
* Copyright (c) 2009-2010, XNova Support Team <http://www.xnova-ng.org>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing XNova.
*
*/
function DefensesBuildingPage(&$CurrentPlanet, $CurrentUser)
{
global $lang, $resource, $dpath, $_POST;
if (isset($_POST['fmenge'])) {
// On vient de Cliquer ' Construire '
// Et y a une liste de doléances
// Ici, on sait precisement ce qu'on aimerait bien construire ...
// Gestion de la place disponible dans les silos !
$Missiles[502] = $CurrentPlanet[$resource[502]];
$Missiles[503] = $CurrentPlanet[$resource[503]];
$SiloSize = $CurrentPlanet[$resource[44]];
$MaxMissiles = $SiloSize * 10;
// On prend les missiles deja dans la queue de fabrication aussi (ca aide)
$BuildQueue = $CurrentPlanet['b_hangar_id'];
$BuildArray = explode(";", $BuildQueue);
for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
$ElmentArray = explode(",", $BuildArray[$QElement]);
if ($ElmentArray[502] != 0) {
$Missiles[502] += $ElmentArray[502];
} elseif ($ElmentArray[503] != 0) {
$Missiles[503] += $ElmentArray[503];
}
}
foreach ($_POST['fmenge'] as $Element => $Count) {
// Construction d'Element recuperés sur la page de Flotte ...
// ATTENTION ! La file d'attente Flotte est Commune a celle des Defenses
// Dans fmenge, on devrait trouver un tableau des elements constructibles etdu nombre d'elements souhaités
$Element = intval($Element);
$Count = intval($Count);
if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
$Count = MAX_FLEET_OR_DEFS_PER_ROW;
}
if ($Count != 0) {
// Cas particulier (Petit Bouclier et Grand Bouclier
// ne peuvent exister qu'une seule et unique fois
$InQueue = strpos($CurrentPlanet['b_hangar_id'], $Element . ",");
$IsBuild = $CurrentPlanet[$resource[407]] >= 1 ? true : false;
if ($Element == 407 || $Element == 408) {
if ($InQueue === false && !$IsBuild) {
$Count = 1;
}
}
// On verifie si on a les technologies necessaires a la construction de l'element
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
// On verifie combien on sait faire de cet element au max
$MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
// Testons si on a de la place pour ces nouveaux missiles !
if ($Element == 502 || $Element == 503) {
// Cas particulier des missiles
$ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
$MissilesSpace = $MaxMissiles - $ActuMissiles;
if ($Element == 502) {
if ($Count > $MissilesSpace) {
$Count = $MissilesSpace;
}
} else {
if ($Count > floor($MissilesSpace / 2)) {
$Count = floor($MissilesSpace / 2);
}
}
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
$Missiles[$Element] += $Count;
} else {
// Si pas assez de ressources, on ajuste le nombre d'elements
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
}
$Ressource = GetElementRessources($Element, $Count);
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
//.........这里部分代码省略.........
示例8: BatimentBuildingPage
//.........这里部分代码省略.........
break;
default:
break;
}
// switch
} elseif ($bThisIsCheated == true) {
ResetThisFuckingCheater($CurrentUser['id']);
}
sleep(1);
// es wird 1 sekunde geschlafen
}
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
$Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
// On enregistre ce que l'on a modifié dans planet !
BuildingSavePlanetRecord($CurrentPlanet);
// On enregistre ce que l'on a eventuellement modifié dans users
BuildingSaveUserRecord($CurrentUser);
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} else {
$CanBuildElement = false;
}
$SubTemplate = gettemplate('buildings_builds_row');
$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['dpath'] = $dpath;
$parse['i'] = $Element;
$BuildingLevel = $CurrentPlanet[$resource[$Element]];
$parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")";
$parse['n'] = $ElementName;
$parse['descriptions'] = $lang['res']['descriptions'][$Element];
$ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
$parse['time'] = ShowBuildTime($ElementBuildTime);
$parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
$parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element);
$parse['click'] = '';
$NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
// show energy on BuildingPage
//================================
$BuildLevelFactor = $CurrentPlanet[$resource[$Element] . "_porcent"];
$BuildTemp = $CurrentPlanet['temp_max'];
$CurrentBuildtLvl = $BuildingLevel;
$BuildLevel = $CurrentBuildtLvl > 0 ? $CurrentBuildtLvl : 1;
$Prod[3] = floor(eval($ProdGrid[$Element]['formule']['deuterium']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_geologue'] * 0.05);
$Prod[11] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
if ($Element != 12) {
$ActualNeed = floor($Prod[11]);
} else {
$ActualNeed = floor($Prod[3]);
}
$BuildLevel++;
$Prod[3] = floor(eval($ProdGrid[$Element]['formule']['deuterium']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_geologue'] * 0.05);
$Prod[11] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
if ($Element != 12) {
$bloc['build_prod'] = pretty_number(floor($Prod[$BuildID]));
示例9: DefensesBuildingPage
function DefensesBuildingPage(&$CurrentPlanet, $CurrentUser)
{
global $lang, $resource, $phpEx, $dpath, $_POST, $reslist, $pricelist;
if (isset($_POST['fmenge'])) {
// On vient de Cliquer ' Construire '
// Et y a une liste de doléances
// Ici, on sait precisement ce qu'on aimerait bien construire ...
// Gestion de la place disponible dans les silos !
$Missiles[502] = $CurrentPlanet[$resource[502]];
$Missiles[503] = $CurrentPlanet[$resource[503]];
$SiloSize = $CurrentPlanet[$resource[44]];
$MaxMissiles = $SiloSize * 10;
// On prend les missiles deja dans la queue de fabrication aussi (ca aide)
$BuildQueue = $CurrentPlanet['b_hangar_id'];
$BuildArray = explode(";", $BuildQueue);
for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
$ElmentArray = explode(",", $BuildArray[$QElement]);
if ($ElmentArray[502] != 0) {
$Missiles[502] += $ElmentArray[502];
} elseif ($ElmentArray[503] != 0) {
$Missiles[503] += $ElmentArray[503];
}
}
foreach ($_POST as $Element => $Count) {
$Element = idstring($Element);
if (in_array($Element, $reslist['fleet'])) {
$Element = intval($Element);
$Count = intval($Count);
if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
$Count = MAX_FLEET_OR_DEFS_PER_ROW;
}
if ($Count != 0) {
// Cas particulier (Petit Bouclier et Grand Bouclier
// ne peuvent exister qu'une seule et unique fois
$InQueue = strpos($CurrentPlanet['b_hangar_id'], $Element . ",");
$IsBuild = $CurrentPlanet[$resource[407]] >= 1 ? true : false;
if ($Element == 407 || $Element == 408) {
if ($InQueue === false && !$IsBuild) {
$Count = 1;
}
}
// On verifie si on a les technologies necessaires a la construction de l'element
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
// On verifie combien on sait faire de cet element au max
$MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
// Testons si on a de la place pour ces nouveaux missiles !
if ($Element == 502 || $Element == 503) {
// Cas particulier des missiles
$ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
$MissilesSpace = $MaxMissiles - $ActuMissiles;
if ($Element == 502) {
if ($Count > $MissilesSpace) {
$Count = $MissilesSpace;
}
} else {
if ($Count > floor($MissilesSpace / 2)) {
$Count = floor($MissilesSpace / 2);
}
}
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
$Missiles[$Element] += $Count;
} else {
// Si pas assez de ressources, on ajuste le nombre d'elements
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
}
$Ressource = GetElementRessources($Element, $Count);
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
if ($Count >= 1) {
$CurrentPlanet['metal'] -= $Ressource['metal'];
$CurrentPlanet['crystal'] -= $Ressource['crystal'];
$CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
$CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
}
}
}
}
}
}
// -------------------------------------------------------------------------------------------------------
// S'il n'y a pas de Chantier ...
if ($CurrentPlanet[$resource[21]] == 0) {
$shipyard = false;
} else {
$shipyard = true;
}
// -------------------------------------------------------------------------------------------------------
// Construction de la page du Chantier (car si j'arrive ici ... c'est que j'ai tout ce qu'il faut pour ...
$TabIndex = 0;
$PageTable = "";
$SubTemplate = gettemplate('buildings/defense_buttonz');
$parse = array();
$infopg = array();
foreach ($lang['tech'] as $Element => $ElementName) {
if (in_array($Element, $reslist['defense'])) {
if (!IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$parse['state_' . $Element] = "off";
//.........这里部分代码省略.........
示例10: ResearchBuildingPage
function ResearchBuildingPage(&$CurrentPlanet, $CurrentUser, $InResearch, $ThePlanet)
{
global $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET;
$NoResearchMessage = "";
$bContinue = true;
if ($CurrentPlanet[$resource[31]] == 0) {
message($lang['no_laboratory'], $lang['Research']);
}
if (!CheckLabSettingsInQueue($CurrentPlanet)) {
$NoResearchMessage = $lang['labo_on_update'];
$bContinue = false;
}
if (isset($_GET['cmd'])) {
$TheCommand = $_GET['cmd'];
$Techno = intval($_GET['tech']);
if (is_numeric($Techno)) {
if (in_array($Techno, $reslist['tech'])) {
if (is_array($ThePlanet)) {
$WorkingPlanet = $ThePlanet;
} else {
$WorkingPlanet = $CurrentPlanet;
}
switch ($TheCommand) {
case 'cancel':
if ($ThePlanet['b_tech_id'] == $Techno) {
$Needed = GetBuildingPrice($CurrentUser, $CurrentPlanet, $Techno, true, $ForDestroy);
$CurrentPlanet['metal'] += $Needed['metal'];
$CurrentPlanet['crystal'] += $Needed['crystal'];
$CurrentPlanet['deuterium'] += $Needed['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)) {
$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;
}
}
$TechRowTPL = gettemplate('buildings_research_row');
$TechScrTPL = gettemplate('buildings_research_script');
foreach ($lang['tech'] as $Tech => $TechName) {
if ($Tech > 105 && $Tech <= 199) {
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Tech)) {
$RowParse = $lang;
$RowParse['dpath'] = $dpath;
$RowParse['tech_id'] = $Tech;
$building_level = $CurrentUser[$resource[$Tech]];
$RowParse['tech_level'] = $building_level == 0 ? "" : "( " . $lang['level'] . " " . $building_level . " )";
$RowParse['tech_name'] = $TechName;
$RowParse['tech_descr'] = $lang['res']['descriptions'][$Tech];
$RowParse['tech_price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Tech);
$SearchTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Tech);
$RowParse['search_time'] = ShowBuildTime($SearchTime);
$RowParse['tech_restp'] = $lang['Rest_ress'] . " " . GetRestPrice($CurrentUser, $CurrentPlanet, $Tech, true);
$CanBeDone = IsElementBuyable($CurrentUser, $CurrentPlanet, $Tech);
if (!$InResearch) {
$LevelToDo = 1 + $CurrentUser[$resource[$Tech]];
if ($CanBeDone) {
if (!CheckLabSettingsInQueue($CurrentPlanet)) {
//.........这里部分代码省略.........
示例11: ShowBuildingQueue
function ShowBuildingQueue($CurrentPlanet, $CurrentUser)
{
global $lang, $dpath, $reslist, $resource;
$BuildingNow = array();
$CurrentQueue = $CurrentPlanet['b_building_id'];
$QueueID = 0;
if ($CurrentQueue != 0) {
$QueueArray = explode(";", $CurrentQueue);
$ActualCount = count($QueueArray);
} else {
$QueueArray = "0";
$ActualCount = 0;
}
$ListIDRow = "";
if ($ActualCount != 0) {
$ListIDRow .= "<tr><td class='c' colspan='3' align='center'>" . $lang['Constructions'] . "<font color='#00FF00'>" . $ActualCount . "</font> von <font color='#FF0000'>" . MAX_BUILDING_QUEUE_SIZE . "</font></td></tr>";
$PlanetID = $CurrentPlanet['id'];
$totalBuildTime = 0;
$totalBuildEndTime = time();
if (MAX_BUILDING_QUEUE_SIZE - $ActualCount > 0) {
$CanBuild = true;
} else {
$Canbuild = false;
}
foreach ($reslist['build'] as $Element) {
$BuildingNow[$Element] = $CurrentPlanet[$resource[$Element]];
}
for ($QueueID = 0; $QueueID < $ActualCount; $QueueID++) {
$BuildArray = explode(",", $QueueArray[$QueueID]);
$BuildEndTime = floor($BuildArray[3]);
$CurrentTime = floor(time());
if ($BuildEndTime >= $CurrentTime) {
$ListID = $QueueID + 1;
$Element = $BuildArray[0];
$BuildingNow[$Element] = $BuildArray[1];
$BuildLevel = $BuildArray[1];
$BuildMode = $BuildArray[4];
$BuildTime = $BuildEndTime - time();
$totalBuildTime = $BuildTime;
$totalBuildEndTime = $BuildEndTime;
$ElementTitle = $lang['tech'][$Element];
if (IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false) and IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element) and $CanBuild and $CurrentPlanet["field_current"] < CalculateMaxPlanetFields($CurrentPlanet) - $ActualCount) {
$CanBuild = true;
} else {
$CanBuild = false;
}
if ($BuildMode == 'build') {
$modo_rep = 'insert';
$multi = 1;
} else {
$modo_rep = 'destroy';
$multi = 2;
}
if ($CanBuild) {
$levelmore = "<a href='buildings.php?cmd={$modo_rep}&building=" . $Element . "'>" . $lang['Next'] . "</a> ";
} else {
$levelmore = '';
}
if ($ListID > 0) {
$ListIDRow .= "<tr>";
if ($ListID == 1) {
$ListIDRow .= "<th colspan=\"3\">";
$ListIDRow .= " <table width=\"100%\">";
$ListIDRow .= " <tr>";
$ListIDRow .= " <td width='80' rowspan='2'><a href='infos.php?gid=" . $Element . "'><img border='0' src='" . $dpath . "gebaeude/" . $Element . ".gif' align='top' title='" . $ElementTitle . "' width='80' height='80'></a></td>";
if ($BuildMode == 'build') {
$ListIDRow .= " <td><center>";
$ListIDRow .= " <table>";
$ListIDRow .= " <tr>";
$ListIDRow .= " <td class='c' width='24'><img border='0' src='./images/enproceso.gif' align='top' width='24' height='24'></td>";
$ListIDRow .= " <td class='c'><center><font color =\"#6699FF\"><a href='infos.php?gid=" . $Element . "'><font color =\"#6699FF\">- " . $ElementTitle . " </font></a><br />" . $lang['BuildNextLevel'] . "<font color=\"#FF8C00\"><b>" . $lang['level'] . " " . $BuildLevel . "</b></font></font></center></td>";
$ListIDRow .= " <td class='c' width='24'><img border='0' src='./images/enproceso.gif' align='top' width='24' height='24'></td>";
$ListIDRow .= " </tr>";
$ListIDRow .= " <tr>";
$ListIDRow .= " <td class='c' colspan='3'><center>" . $levelmore . "</center></td>";
$ListIDRow .= " </tr>";
$ListIDRow .= " </table>";
$ListIDRow .= " </center></td>";
} else {
$ListIDRow .= " <td class='c'><center>";
$ListIDRow .= " <table>";
$ListIDRow .= " <tr>";
$ListIDRow .= " <td class='c' width='24'><img border='0' src='./images/enproceso.gif' align='top' width='24' height='24'></td>";
$ListIDRow .= " <td class='c'><center><font color =\"#6699FF\"><a href='infos.php?gid=" . $Element . "'><font color =\"#6699FF\"> " . $ElementTitle . " </font></a><br /><font color=\"#87CEEB\"><blink>" . $lang['bd_dismantle'] . "</blink></font> en <font color=\"#FF8C00\"><b>Nivel " . $BuildLevel . "</b></font></font></center></td>";
$ListIDRow .= " <td class='c' width='24'><img border='0' src='./images/enproceso.gif' align='top' width='24' height='24'></td>";
$ListIDRow .= " </tr>";
$ListIDRow .= " </table>";
$ListIDRow .= " </center></td>";
}
$ListIDRow .= " <td class='c' width=\"56\" rowspan='2'><center>";
$ListIDRow .= " <div id=\"blc\" class=\"z\">" . $BuildTime . "<br><a href=\"buildings.php?listid=" . $ListID . "&cmd=cancel&planet=" . $PlanetID . "\">" . $lang['bd_interrupt'] . "</a></div>";
$ListIDRow .= " <script language=\"JavaScript\">";
$ListIDRow .= " pp = \"" . $BuildTime . "\";\n";
$ListIDRow .= " pk = \"" . $ListID . "\";\n";
$ListIDRow .= " pm = \"cancel\";\n";
$ListIDRow .= " pl = \"" . $PlanetID . "\";\n";
$ListIDRow .= " t();\n";
$ListIDRow .= " </script>";
$ListIDRow .= " <strong color=\"lime\"><br><font color=\"lime\">" . date("j/m H:i:s", $BuildEndTime) . "</font></strong></center>";
$ListIDRow .= " </td>";
//.........这里部分代码省略.........
示例12: DefensesBuildingPage
public function DefensesBuildingPage(&$CurrentPlanet, $CurrentUser)
{
global $lang, $resource, $phpEx, $dpath, $_POST, $xgp_root;
include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
$parse = $lang;
if (isset($_POST['fmenge'])) {
$Missiles[502] = $CurrentPlanet[$resource[502]];
$Missiles[503] = $CurrentPlanet[$resource[503]];
$SiloSize = $CurrentPlanet[$resource[44]];
$MaxMissiles = $SiloSize * 10;
$BuildQueue = $CurrentPlanet['b_hangar_id'];
$BuildArray = explode(";", $BuildQueue);
for ($QElement = 0; $QElement < count($BuildArray); $QElement++) {
$ElmentArray = explode(",", $BuildArray[$QElement]);
if ($ElmentArray[0] == 502) {
$Missiles[502] += $ElmentArray[1];
} elseif ($ElmentArray[0] == 503) {
$Missiles[503] += $ElmentArray[1];
}
}
foreach ($_POST['fmenge'] as $Element => $Count) {
$Element = intval($Element);
$Count = intval($Count);
if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
$Count = MAX_FLEET_OR_DEFS_PER_ROW;
}
if ($Count != 0) {
$InQueue = strpos($CurrentPlanet['b_hangar_id'], $Element . ",");
$IsBuildp = $CurrentPlanet[$resource[407]] >= 1 ? TRUE : FALSE;
$IsBuildg = $CurrentPlanet[$resource[408]] >= 1 ? TRUE : FALSE;
$IsBuildpp = $CurrentPlanet[$resource[409]] >= 1 ? TRUE : FALSE;
if ($Element == 407 && !$IsBuildp && $InQueue === FALSE) {
$Count = 1;
}
if ($Element == 408 && !$IsBuildg && $InQueue === FALSE) {
$Count = 1;
}
if ($Element == 409 && !$IsBuildpp && $InQueue === FALSE) {
$Count = 1;
}
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$MaxElements = $this->GetMaxConstructibleElements($Element, $CurrentPlanet);
if ($Element == 502 || $Element == 503) {
$ActuMissiles = $Missiles[502] + 2 * $Missiles[503];
$MissilesSpace = $MaxMissiles - $ActuMissiles;
if ($Element == 502) {
if ($Count > $MissilesSpace) {
$Count = $MissilesSpace;
}
} else {
if ($Count > floor($MissilesSpace / 2)) {
$Count = floor($MissilesSpace / 2);
}
}
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
$Missiles[$Element] += $Count;
} else {
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
}
$Ressource = $this->GetElementRessources($Element, $Count);
if ($Count >= 1) {
$CurrentPlanet['metal'] -= $Ressource['metal'];
$CurrentPlanet['crystal'] -= $Ressource['crystal'];
$CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
$CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
}
}
}
}
header("Location: game.php?page=buildings&mode=defense");
}
if ($CurrentPlanet[$resource[21]] == 0) {
message($lang['bd_shipyard_required'], '', '', true);
}
$NotBuilding = true;
if ($CurrentPlanet['b_building_id'] != 0) {
$CurrentQueue = $CurrentPlanet['b_building_id'];
if (strpos($CurrentQueue, ";")) {
// FIX BY LUCKY - IF THE SHIPYARD IS IN QUEUE THE USER CANT RESEARCH ANYTHING...
$QueueArray = explode(";", $CurrentQueue);
for ($i = 0; $i < MAX_BUILDING_QUEUE_SIZE; $i++) {
$ListIDArray = explode(",", $QueueArray[$i]);
$Element = $ListIDArray[0];
if ($Element == 21 or $Element == 14 or $Element == 15) {
break;
}
}
// END - FIX
} else {
$CurrentBuilding = $CurrentQueue;
}
if ($CurrentBuilding == 21 or $CurrentBuilding == 14 or $CurrentBuilding == 15 or ($Element == 21 or $Element == 14 or $Element == 15)) {
$parse[message] = "<font color=\"red\">" . $lang['bd_building_shipyard'] . "</font>";
$NotBuilding = false;
}
//.........这里部分代码省略.........
示例13: FleetBuildingPage
function FleetBuildingPage(&$CurrentPlanet, $CurrentUser)
{
global $planetrow, $lang, $pricelist, $resource, $phpEx, $dpath, $_POST;
if (isset($_GET[action])) {
switch ($_GET[action]) {
case "cancelqueue":
$ElementQueue = explode(';', $CurrentPlanet['b_hangar_id']);
foreach ($ElementQueue as $ElementLine => $Element) {
if ($Element != '') {
$Element = explode(',', $Element);
$ResourcesToUpd[metal] += floor($pricelist[$Element[0]][metal] * $Element[1]);
$ResourcesToUpd[crystal] += floor($pricelist[$Element[0]][crystal] * $Element[1]);
$ResourcesToUpd[deuterium] += floor($pricelist[$Element[0]][deuterium] * $Element[1]);
$ResourcesToUpd[tachyon] += floor($pricelist[$Element[0]][tachyon] * $Element[1]);
}
}
$SetRes = "UPDATE {{table}} SET ";
$SetRes .= "`metal` = metal + '" . $ResourcesToUpd[metal] . "', ";
$SetRes .= "`crystal` = crystal + '" . $ResourcesToUpd[crystal] . "', ";
$SetRes .= "`deuterium` = deuterium + '" . $ResourcesToUpd[deuterium] . "', ";
$SetRes .= "`tachyon` = tachyon + '" . $ResourcesToUpd[tachyon] . "', ";
$SetRes .= "`b_hangar` = '', ";
$SetRes .= "`b_hangar_id` = ''";
$SetRes .= " WHERE `id` = '" . $CurrentPlanet['id'] . "'";
doquery($SetRes, 'planets');
header("location: " . $_SERVER['PHP_SELF'] . "?mode=" . $_GET[mode]);
exit;
break;
}
}
if (isset($_POST['fmenge'])) {
$AddedInQueue = false;
foreach ($_POST['fmenge'] as $Element => $Count) {
$Element = intval($Element);
$Count = intval($Count);
if ($Count > MAX_FLEET_OR_DEFS_PER_ROW) {
$Count = MAX_FLEET_OR_DEFS_PER_ROW;
}
if ($Count != 0) {
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$MaxElements = GetMaxConstructibleElements($Element, $CurrentPlanet);
if ($Count > $MaxElements) {
$Count = $MaxElements;
}
$Ressource = GetElementRessources($Element, $Count);
$BuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
if ($Count >= 1) {
$CurrentPlanet['metal'] -= $Ressource['metal'];
$CurrentPlanet['crystal'] -= $Ressource['crystal'];
$CurrentPlanet['deuterium'] -= $Ressource['deuterium'];
$CurrentPlanet['tachyon'] -= $Ressource['tachyon'];
$CurrentPlanet['b_hangar_id'] .= "" . $Element . "," . $Count . ";";
}
}
}
}
}
if ($CurrentPlanet[$resource[21]] == 0) {
message($lang['need_hangar'], $lang['tech'][21]);
}
$TabIndex = 0;
foreach ($lang['tech'] as $Element => $ElementName) {
if ($Element > 201 && $Element <= 399) {
if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
$CanBuildOne = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, false);
$BuildOneElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
$ElementCount = $CurrentPlanet[$resource[$Element]];
$ElementNbre = $ElementCount == 0 ? "" : " (" . $lang['dispo'] . ": " . pretty_number($ElementCount) . ")";
$PageTable .= "\n<tr>";
$PageTable .= "<th class=k>";
$PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">";
$PageTable .= "<img border=0 src=\"" . $dpath . "gebaeude/" . $Element . ".gif\" align=top width=120 height=120></a>";
$PageTable .= "</th>";
$PageTable .= "<td class=k>";
$PageTable .= "<a href=infos." . $phpEx . "?gid=" . $Element . ">" . $ElementName . "</a> " . $ElementNbre . "<br>";
$PageTable .= "" . $lang['res']['descriptions'][$Element] . "<br>";
$PageTable .= GetElementPrice($CurrentUser, $CurrentPlanet, $Element, false);
$PageTable .= ShowBuildTime($BuildOneElementTime);
$PageTable .= "</td>";
$PageTable .= "<th class=k>";
if ($CanBuildOne) {
$TabIndex++;
$PageTable .= "<input type=text name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' size=7 maxlength=7 value=0 tabindex=" . $TabIndex . ">";
}
$PageTable .= "</th>";
$PageTable .= "</tr>";
}
}
}
if ($CurrentPlanet['b_hangar_id'] != '') {
$BuildQueue .= ElementBuildListBox($CurrentUser, $CurrentPlanet);
}
$parse = $lang;
$parse['buildlist'] = $PageTable;
$parse['buildinglist'] = $BuildQueue;
$page .= parsetemplate(gettemplate('buildings_fleet'), $parse);
display($page, $lang['Fleet']);
}
示例14: BatimentBuildingPage
function BatimentBuildingPage(&$CurrentPlanet, $CurrentUser)
{
global $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET;
CheckPlanetUsedFields($CurrentPlanet);
$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 (isset($Element)) {
if (!strchr($Element, " ")) {
if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
$bDoItNow = true;
}
}
} elseif (isset($ListID)) {
$bDoItNow = true;
}
if ($bDoItNow == true) {
switch ($TheCommand) {
case 'cancel':
CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
break;
case 'remove':
RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
break;
case 'insert':
AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
break;
case 'destroy':
AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
break;
default:
break;
}
}
}
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
$Queue = ShowBuildingQueue($CurrentPlanet, $CurrentUser);
BuildingSavePlanetRecord($CurrentPlanet);
BuildingSaveUserRecord($CurrentUser);
if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
$CanBuildElement = true;
} 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);
$parse = array();
$parse['dpath'] = $dpath;
$parse['i'] = $Element;
$BuildingLevel = $CurrentPlanet[$resource[$Element]];
$parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['level'] . " " . $BuildingLevel . ")";
$parse['n'] = $ElementName;
$parse['descriptions'] = $lang['res']['descriptions'][$Element];
$ElementBuildTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element);
$parse['time'] = ShowBuildTime($ElementBuildTime);
$parse['price'] = GetElementPrice($CurrentUser, $CurrentPlanet, $Element);
$parse['rest_price'] = GetRestPrice($CurrentUser, $CurrentPlanet, $Element);
$parse['click'] = '';
$NextBuildLevel = $CurrentPlanet[$resource[$Element]] + 1;
if ($Element == 31) {
if ($CurrentUser["b_tech_planet"] != 0 && $game_config['BuildLabWhileRun'] != 1) {
$parse['click'] = "<font color=#FF0000>" . $lang['in_working'] . "</font>";
}
}
if ($parse['click'] != '') {
} elseif ($RoomIsOk && $CanBuildElement) {
if ($Queue['lenght'] == 0) {
if ($NextBuildLevel == 1) {
if ($HaveRessources == true) {
$parse['click'] = "<a href=\"?cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['BuildFirstLevel'] . "</font></a>";
} else {
$parse['click'] = "<font color=#FF0000>" . $lang['BuildFirstLevel'] . "</font>";
}
} else {
if ($HaveRessources == true) {
$parse['click'] = "<a href=\"?cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font></a>";
} else {
$parse['click'] = "<font color=#FF0000>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font>";
}
}
} else {
$parse['click'] = "<a href=\"?cmd=insert&building=" . $Element . "\"><font color=#00FF00>" . $lang['InBuildQueue'] . "</font></a>";
}
} elseif ($RoomIsOk && !$CanBuildElement) {
if ($NextBuildLevel == 1) {
$parse['click'] = "<font color=#FF0000>" . $lang['BuildFirstLevel'] . "</font>";
//.........这里部分代码省略.........
示例15: __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');
}