本文整理汇总了PHP中PlanetResourceUpdate函数的典型用法代码示例。如果您正苦于以下问题:PHP PlanetResourceUpdate函数的具体用法?PHP PlanetResourceUpdate怎么用?PHP PlanetResourceUpdate使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PlanetResourceUpdate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InsertGalaxyScripts
/**
* InsertGalaxyScripts.php
* @Licence GNU (GPL)
* @version 3.0
* @copyright 2009
* @Team Space Beginner
*
**/
function InsertGalaxyScripts($CurrentPlanet)
{
global $lang, $CurrentUser, $CurrentPlanet;
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
$Script = "\n\n <script type=\"text/javascript\">\n\n function galaxy_submit(value) {\n document.getElementById('auto').name = value;\n document.getElementById('galaxy_form').submit();\n }\n\n function fenster(target_url,win_name) {\n var new_win = window.open(target_url,win_name,'resizable=yes,scrollbars=yes,menubar=no,toolbar=no,width=640,height=480,top=0,left=0');\n new_win.focus();\n }\n </script>\n <script type=\"text/javascript\" src=\"scripts/tw-sack.js\"></script>\n <script type=\"text/javascript\">\n\n var ajax = new sack();\n var strInfo = \"\";\n\n function whenResponse () {\n retVals = this.response.split(\"|\");\n Message = retVals[0];\n Infos = retVals[1];\n retVals = Infos.split(\" \");\n UsedSlots = retVals[0];\n SpyProbes = retVals[1];\n Recyclers = retVals[2];\n Missiles = retVals[3];\n retVals = Message.split(\";\");\n CmdCode = retVals[0];\n strInfo = retVals[1];\n\n if (retVals[0] == 600)\n addToTable(\"done\", \"success\");\n\n if (retVals[0] != 600)\n addToTable(\"Error\", \"error\");\n changeSlots( UsedSlots );\n setShips(\"probes\", SpyProbes );\n setShips(\"recyclers\", Recyclers );\n setShips(\"missiles\", Missiles );\n }\n\n function doit (order, galaxy, system, planet, planettype, shipcount) {\n ajax.requestFile = \"flotenajax.php?action=send\";\n ajax.runResponse = whenResponse;\n ajax.execute = true;\n ajax.setVar(\"thisgalaxy\", " . $CurrentPlanet["galaxy"] . ");\n ajax.setVar(\"thissystem\", " . $CurrentPlanet["system"] . ");\n ajax.setVar(\"thisplanet\", " . $CurrentPlanet["planet"] . ");\n ajax.setVar(\"thisplanettype\", " . $CurrentPlanet["planet_type"] . ");\n ajax.setVar(\"mission\", order);\n ajax.setVar(\"galaxy\", galaxy);\n ajax.setVar(\"system\", system);\n ajax.setVar(\"planet\", planet);\n ajax.setVar(\"planettype\", planettype);\n\n if (order == 6)\n ajax.setVar(\"ship210\", shipcount);\n\n if (order == 7) {\n ajax.setVar(\"ship208\", 1);\n ajax.setVar(\"ship203\", 2);\n }\n\n if (order == 8)\n ajax.setVar(\"ship209\", shipcount);\n ajax.runAJAX();\n }\n\n function addToTable(strDataResult, strClass) {\n var e = document.getElementById('fleetstatusrow');\n var e2 = document.getElementById('fleetstatustable');\n e.style.display = '';\n\n if(e2.rows.length > 2) {\n e2.deleteRow(2);\n }\n\n var row = e2.insertRow(0);\n var td1 = document.createElement(\"td\");\n var td1text = document.createTextNode(strInfo);\n td1.appendChild(td1text);\n var td2 = document.createElement(\"td\");\n var span = document.createElement(\"span\");\n var spantext = document.createTextNode(strDataResult);\n var spanclass = document.createAttribute(\"class\");\n spanclass.nodeValue = strClass;\n span.setAttributeNode(spanclass);\n span.appendChild(spantext);\n td2.appendChild(span);\n row.appendChild(td1);\n row.appendChild(td2);\n }\n\n function changeSlots(slotsInUse) {\n var e = document.getElementById('slots');\n e.innerHTML = slotsInUse;\n }\n\n function setShips(ship, count) {\n var e = document.getElementById(ship);\n e.innerHTML = count;\n }\n\n </script>";
return $Script;
}
示例2: UpdatePlanetBatimentQueueList
function UpdatePlanetBatimentQueueList($planetid)
{
$RetValue = false;
$now = time();
begin_transaction();
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $planetid . "' FOR UPDATE", 'planets', true);
if (!$CurrentPlanet || $CurrentPlanet['b_building'] == 0 || $CurrentPlanet['b_building'] > $now) {
rollback();
return false;
}
$CurrentUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $CurrentPlanet['id_owner'] . "' LOCK IN SHARE MODE", 'users', true);
if (!$CurrentUser) {
return false;
}
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, $CurrentPlanet['b_building'], false);
CheckPlanetBuildingQueue($CurrentPlanet, $CurrentUser);
commit();
}
示例3: UpdatePlanetBatimentQueueList
function UpdatePlanetBatimentQueueList(&$CurrentPlanet, &$CurrentUser)
{
$RetValue = false;
if ($CurrentPlanet['b_building_id'] != 0) {
while ($CurrentPlanet['b_building_id'] != 0) {
if ($CurrentPlanet['b_building'] <= time()) {
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, $CurrentPlanet['b_building'], false);
$IsDone = CheckPlanetBuildingQueue($CurrentPlanet, $CurrentUser);
if ($IsDone == true) {
SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
}
} else {
$RetValue = true;
break;
}
}
}
return $RetValue;
}
示例4: BuildRessourcePage
function BuildRessourcePage($CurrentUser, $CurrentPlanet)
{
global $lang, $ProdGrid, $resource, $reslist, $game_config, $_POST;
includeLang('resources');
$RessBodyTPL = gettemplate('resources');
$RessRowTPL = gettemplate('resources_row');
$userInVacation = $CurrentUser['urlaubs_modus'] == 1 ? true : false;
if ($CurrentPlanet['planet_type'] == 3 || $userInVacation == true) {
message($lang['Ressource_PageNotAllowed'], $lang['Ressource_NotDisponible'], 'overview.php');
}
$ValidList['percent'] = array(100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0);
$SubQry = "";
if ($_POST) {
foreach ($_POST as $Field => $Value) {
$FieldName = $Field . "_porcent";
if (isset($CurrentPlanet[$FieldName])) {
if (!in_array($Value, $ValidList['percent'])) {
header("Location: overview.php");
exit;
}
$Value = $Value / 10;
$CurrentPlanet[$FieldName] = $Value;
$SubQry .= ", `" . $FieldName . "` = '" . $Value . "'";
}
}
}
$parse = $lang;
// -------------------------------------------------------------------------------------------------------
// 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);
// -------------------------------------------------------------------------------------------------------
// Calcul du % de production et mise � jour des ressources
$CurrentPlanet = PlanetResourceUpdate($user, $CurrentPlanet, time());
// --------------------------------------------------------------------------------------------------------
$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']) * ($CurrentPlanet['porcent'] / 100) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * 0.05));
$crystal = floor(eval($ProdGrid[$ProdID]['formule']['crystal']) * ($CurrentPlanet['porcent'] / 100) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * 0.05));
$deuterium = floor(eval($ProdGrid[$ProdID]['formule']['deuterium']) * ($CurrentPlanet['porcent'] / 100) * $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;
$CurrRow = array();
$CurrRow['name'] = $resource[$ProdID];
$CurrRow['porcent'] = $BuildLevelFactor;
foreach ($ValidList['percent'] as $Option) {
$OptSelected = $Option / 10 == $CurrRow['porcent'] ? ' selected=selected' : '';
$CurrRow['option'] .= "<option value=\"" . $Option . "\"" . $OptSelected . ">" . $Option . "%</option>";
}
$CurrRow['type'] = $lang['tech'][$ProdID];
$CurrRow['level'] = $ProdID > 200 ? $lang['quantity'] : $lang['level'];
$CurrRow['level_type'] = $CurrentPlanet[$resource[$ProdID]];
$CurrRow['metal_type'] = colorNumber(pretty_number($metal));
$CurrRow['crystal_type'] = colorNumber(pretty_number($crystal));
$CurrRow['deuterium_type'] = colorNumber(pretty_number($deuterium));
$CurrRow['energy_type'] = colorNumber(pretty_number($energy));
$parse['resource_row'] .= parsetemplate($RessRowTPL, $CurrRow);
}
}
$parse['Production_of_resources_in_the_planet'] = str_replace('%s', $CurrentPlanet['name'], $lang['Production_of_resources_in_the_planet']);
$parse['production_level'] = $CurrentPlanet['porcent'];
$parse['metal_basic_income'] = $game_config['metal_basic_income'] * $game_config['resource_multiplier'];
$parse['crystal_basic_income'] = $game_config['crystal_basic_income'] * $game_config['resource_multiplier'];
$parse['deuterium_basic_income'] = $game_config['deuterium_basic_income'] * $game_config['resource_multiplier'];
$parse['energy_basic_income'] = $game_config['energy_basic_income'] * $game_config['resource_multiplier'];
if ($CurrentPlanet['metal_max'] < $CurrentPlanet['metal']) {
$parse['metal_max'] = "<font color=\"#ff0000\">";
} else {
$parse['metal_max'] = "<font color=\"#00ff00\">";
}
$parse['metal_max'] .= pretty_number($CurrentPlanet['metal_max'] / 1000) . " " . $lang['k'] . "</font>";
if ($CurrentPlanet['crystal_max'] < $CurrentPlanet['crystal']) {
$parse['crystal_max'] = "<font color=\"#ff0000\">";
} else {
$parse['crystal_max'] = "<font color=\"#00ff00\">";
}
$parse['crystal_max'] .= pretty_number($CurrentPlanet['crystal_max'] / 1000) . " " . $lang['k'] . "</font>";
if ($CurrentPlanet['deuterium_max'] < $CurrentPlanet['deuterium']) {
$parse['deuterium_max'] = "<font color=\"#ff0000\">";
} else {
$parse['deuterium_max'] = "<font color=\"#00ff00\">";
}
$parse['deuterium_max'] .= pretty_number($CurrentPlanet['deuterium_max'] / 1000) . " " . $lang['k'] . "</font>";
//.........这里部分代码省略.........
示例5: CheckPlanetBuildingQueue
function CheckPlanetBuildingQueue(&$CurrentPlanet, &$CurrentUser)
{
global $lang, $resource;
// Table des batiments donnant droit de l'experience minier
$XPBuildings = array(1, 2, 3);
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
$RetValue = false;
if ($CurrentPlanet['b_building_id'] != 0) {
$CurrentQueue = $CurrentPlanet['b_building_id'];
if ($CurrentQueue != 0) {
$QueueArray = explode(";", $CurrentQueue);
$ActualCount = count($QueueArray);
}
$BuildArray = explode(",", $QueueArray[0]);
$BuildEndTime = floor($BuildArray[3]);
$BuildMode = $BuildArray[4];
$Element = $BuildArray[0];
array_shift($QueueArray);
if ($BuildMode == 'destroy') {
$ForDestroy = true;
} else {
$ForDestroy = false;
}
if ($BuildEndTime <= time()) {
// Mise a jours des points
$Needed = GetBuildingPrice($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy);
$Units = $Needed['metal'] + $Needed['crystal'] + $Needed['deuterium'] + $Needed['appolonium'];
if ($ForDestroy == false) {
// Mise a jours de l'XP Minier
if (in_array($Element, $XPBuildings)) {
$AjoutXP = $Units / 1000;
$CurrentUser['xpminier'] += $AjoutXP;
}
} else {
// Mise a jours de l'XP Minier
if (in_array($Element, $XPBuildings)) {
$AjoutXP = $Units * 3 / 1000;
$CurrentUser['xpminier'] -= $AjoutXP;
}
}
$current = intval($CurrentPlanet['field_current']);
$max = intval($CurrentPlanet['field_max']);
// Pour une lune
if ($CurrentPlanet['planet_type'] == 3) {
if ($Element == 41) {
// Base Lunaire
$current += 1;
$max += FIELDS_BY_MOONBASIS_LEVEL;
$CurrentPlanet[$resource[$Element]]++;
} elseif ($Element != 0) {
if ($ForDestroy == false) {
$current += 1;
$CurrentPlanet[$resource[$Element]]++;
} else {
$current -= 1;
$CurrentPlanet[$resource[$Element]]--;
}
}
} elseif ($CurrentPlanet['planet_type'] == 1) {
if ($ForDestroy == false) {
$current += 1;
$CurrentPlanet[$resource[$Element]]++;
} else {
$current -= 1;
$CurrentPlanet[$resource[$Element]]--;
}
}
if (count($QueueArray) == 0) {
$NewQueue = 0;
} else {
$NewQueue = implode(";", $QueueArray);
}
$CurrentPlanet['b_building'] = 0;
$CurrentPlanet['b_building_id'] = $NewQueue;
$CurrentPlanet['field_current'] = $current;
$CurrentPlanet['field_max'] = $max;
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`" . $resource[$Element] . "` = '" . $CurrentPlanet[$resource[$Element]] . "', ";
// Mise a 0 de l'heure de fin de construction ...
// Ca va activer la mise en place du batiment suivant de la queue
$QryUpdatePlanet .= "`b_building` = '" . $CurrentPlanet['b_building'] . "' , ";
$QryUpdatePlanet .= "`b_building_id` = '" . $CurrentPlanet['b_building_id'] . "' , ";
$QryUpdatePlanet .= "`field_current` = '" . $CurrentPlanet['field_current'] . "', ";
$QryUpdatePlanet .= "`field_max` = '" . $CurrentPlanet['field_max'] . "' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';";
doquery($QryUpdatePlanet, 'planets');
$QryUpdateUser = "UPDATE {{table}} SET ";
$QryUpdateUser .= "`xpminier` = '" . $CurrentUser['xpminier'] . "' ";
$QryUpdateUser .= "WHERE ";
$QryUpdateUser .= "`id` = '" . $CurrentUser['id'] . "';";
doquery($QryUpdateUser, 'users');
$RetValue = true;
} else {
$RetValue = false;
}
} else {
$CurrentPlanet['b_building'] = 0;
$CurrentPlanet['b_building_id'] = 0;
$QryUpdatePlanet = "UPDATE {{table}} SET ";
//.........这里部分代码省略.........
示例6: MissionCaseDestruction
/**
* MissionCaseDestruction.php
* @Licence GNU (GPL)
* @version 2.2
* @copyright 2009
* @Team Space Beginner
*/
function MissionCaseDestruction($FleetRow)
{
global $phpEx, $xnova_root_path, $pricelist, $lang, $resource, $CombatCaps, $game_config, $user;
includeLang('system');
if ($FleetRow['fleet_mess'] == 0 && $FleetRow['fleet_start_time'] <= time()) {
if (!isset($CombatCaps[202]['sd'])) {
message('<font color=red>' . $lang['sys_no_vars'] . '</font><br />(Error: <font color=red>(!isset($pricelist[202][\'sd\']))</font>. Please report this to an admin.)', $lang['sys_error'], 'fleet.php', 15);
}
$targetPlanet = doquery("SELECT * FROM {{table}} WHERE `galaxy` = " . $FleetRow['fleet_end_galaxy'] . " AND `system` = " . $FleetRow['fleet_end_system'] . " AND `planet_type` = " . $FleetRow['fleet_end_type'] . " AND `planet` = " . $FleetRow['fleet_end_planet'] . ";", 'planets', true);
// if (!isset($targetPlanet['id'])) {
if ($FleetRow['fleet_group'] > 0) {
//MadnessRed Code
doquery("DELETE FROM {{table}} WHERE id =" . $FleetRow['fleet_group'], 'aks');
doquery("UPDATE {{table}} SET fleet_mess=1 WHERE fleet_group=" . $FleetRow['fleet_group'], 'fleets');
} else {
doquery("UPDATE {{table}} SET fleet_mess=1 WHERE fleet_id=" . $FleetRow['fleet_id'], 'fleets');
}
// return;
//}
// Mise à jour de la cible ...
// On recharge les infos qui viennent d'être mises à jour
$targetGalaxy = doquery('SELECT * FROM {{table}} WHERE `galaxy` = ' . $FleetRow['fleet_end_galaxy'] . ' AND `system` = ' . $FleetRow['fleet_end_system'] . ' AND `planet` = ' . $FleetRow['fleet_end_planet'] . ';', 'galaxy', true);
$targetUser = doquery('SELECT * FROM {{table}} WHERE id=' . $targetPlanet['id_owner'], 'users', true);
$TargetUserID = $targetUser['id'];
PlanetResourceUpdate($targetUser, $targetPlanet, time());
// AG : Mettre toutes les flottes dans un tableau
$attackFleets = array();
// De forme : attackFleets[id] = array('fleet' => $FleetRow, 'user' => $user);
if ($FleetRow['fleet_group'] != 0) {
$fleets = doquery('SELECT * FROM {{table}} WHERE fleet_group=' . $FleetRow['fleet_group'], 'fleets');
while ($fleet = mysql_fetch_assoc($fleets)) {
$attackFleets[$fleet['fleet_id']]['fleet'] = $fleet;
$attackFleets[$fleet['fleet_id']]['user'] = doquery('SELECT * FROM {{table}} WHERE id =' . $fleet['fleet_owner'], 'users', true);
$attackFleets[$fleet['fleet_id']]['detail'] = array();
$temp = explode(';', $fleet['fleet_array']);
foreach ($temp as $temp2) {
$temp2 = explode(',', $temp2);
if ($temp2[0] < 100) {
continue;
}
if (!isset($attackFleets[$fleet['fleet_id']]['detail'][$temp2[0]])) {
$attackFleets[$fleet['fleet_id']]['detail'][$temp2[0]] = 0;
}
$attackFleets[$fleet['fleet_id']]['detail'][$temp2[0]] += $temp2[1];
}
}
} else {
$attackFleets[$FleetRow['fleet_id']]['fleet'] = $FleetRow;
$attackFleets[$FleetRow['fleet_id']]['user'] = doquery('SELECT * FROM {{table}} WHERE id=' . $FleetRow['fleet_owner'], 'users', true);
$attackFleets[$FleetRow['fleet_id']]['detail'] = array();
$temp = explode(';', $FleetRow['fleet_array']);
foreach ($temp as $temp2) {
$temp2 = explode(',', $temp2);
if ($temp2[0] < 100) {
continue;
}
if (!isset($attackFleets[$FleetRow['fleet_id']]['detail'][$temp2[0]])) {
$attackFleets[$FleetRow['fleet_id']]['detail'][$temp2[0]] = 0;
}
$attackFleets[$FleetRow['fleet_id']]['detail'][$temp2[0]] += $temp2[1];
}
}
$defense = array();
$def = doquery('SELECT * FROM {{table}} WHERE `fleet_end_galaxy` = ' . $FleetRow['fleet_end_galaxy'] . ' AND `fleet_end_system` = ' . $FleetRow['fleet_end_system'] . ' AND `fleet_end_type` = ' . $FleetRow['fleet_end_type'] . ' AND `fleet_end_planet` = ' . $FleetRow['fleet_end_planet'] . ' AND fleet_start_time<' . time() . ' AND fleet_end_stay>=' . time(), 'fleets');
while ($defRow = mysql_fetch_assoc($def)) {
$defRowDef = explode(';', $defRow['fleet_array']);
foreach ($defRowDef as $Element) {
$Element = explode(',', $Element);
if ($Element[0] < 100) {
continue;
}
if (!isset($defense[$defRow['fleet_id']]['def'][$Element[0]])) {
$defense[$defRow['fleet_id']][$Element[0]] = 0;
}
$defense[$defRow['fleet_id']]['def'][$Element[0]] += $Element[1];
$defense[$defRow['fleet_id']]['user'] = doquery('SELECT * FROM {{table}} WHERE id=' . $defRow['fleet_owner'], 'users', true);
}
}
$defense[0]['def'] = array();
$defense[0]['user'] = $targetUser;
for ($i = 200; $i < 500; $i++) {
if (isset($resource[$i]) && isset($targetPlanet[$resource[$i]])) {
$defense[0]['def'][$i] = $targetPlanet[$resource[$i]];
}
}
$start = microtime(true);
$result = calculateAttack($attackFleets, $defense);
$totaltime = microtime(true) - $start;
// Mise a jour du champ de ruine devant la planete attaquée
$QryUpdateGalaxy = "UPDATE {{table}} SET ";
$QryUpdateGalaxy .= "`metal` = `metal` +'" . ($result['debree']['att'][0] + $result['debree']['def'][0]) . "', ";
$QryUpdateGalaxy .= "`crystal` = `crystal` + '" . ($result['debree']['att'][1] + $result['debree']['def'][1]) . "', ";
$QryUpdateGalaxy .= "`appolonium` = `appolonium` + '" . ($result['debree']['att'][2] + $result['debree']['def'][2]) . "' ";
//.........这里部分代码省略.........
示例7: mysql_free_result
mysql_free_result($OtherFleets);
$Order = $user['planet_sort_order'] == 1 ? "DESC" : "ASC";
$Sort = $user['planet_sort'];
$QryPlanets = "SELECT * FROM {{table}} WHERE `id_owner` = '" . $user['id'] . "' ORDER BY ";
if ($Sort == 0) {
$QryPlanets .= "`id` " . $Order;
} elseif ($Sort == 1) {
$QryPlanets .= "`galaxy`, `system`, `planet`, `planet_type` " . $Order;
} elseif ($Sort == 2) {
$QryPlanets .= "`name` " . $Order;
}
$planets_query = doquery($QryPlanets, 'planets');
$Colone = 1;
$AllPlanets = "<tr>";
while ($UserPlanet = mysql_fetch_array($planets_query)) {
PlanetResourceUpdate($user, $UserPlanet, time());
if ($UserPlanet["id"] != $user["current_planet"] && $UserPlanet['planet_type'] != 3) {
$AllPlanets .= "<td align='right'>";
$AllPlanets .= "<a href='?cp=" . $UserPlanet['id'] . "&re=0' title='" . $UserPlanet['name'] . "'><img src='" . $dpath . "planeten/small_planet/s_" . $UserPlanet['image'] . ".gif' style='width:50px; height:50px'alt=''></a><br>";
$AllPlanets .= "</td>";
if ($Colone <= 0) {
$Colone++;
} else {
$AllPlanets .= "</tr><tr>";
$Colone = 1;
}
}
}
$iraks_query = doquery("SELECT * FROM {{table}} WHERE owner = '" . $user['id'] . "'", 'iraks');
$Record = 4000;
while ($irak = mysql_fetch_array($iraks_query)) {
示例8: elseif
} elseif ($Sort == 1) {
$QryPlanets .= "`galaxy`, `system`, `planet`, `planet_type` " . $Order;
} elseif ($Sort == 2) {
$QryPlanets .= "`name` " . $Order;
}
$planetsrow = doquery($QryPlanets, 'planets');
$planet = array();
$parse = $lang;
while ($p = mysql_fetch_array($planetsrow)) {
$planet[] = $p;
}
$parse['mount'] = count($planet) + 1;
$row = gettemplate('imperium_row');
$row2 = gettemplate('imperium_row2');
foreach ($planet as $p) {
PlanetResourceUpdate($user, $p, time());
$data['text'] = '<a href="overview.php?cp=' . $p['id'] . '&re=0"><img src="' . $dpath . 'planeten/small/s_' . $p['image'] . '.jpg" border="0" height="71" width="75"></a>';
$parse['file_images'] .= parsetemplate($row, $data);
$data['text'] = $p['name'];
$parse['file_names'] .= parsetemplate($row2, $data);
// {file_coordinates}
$data['text'] = "[<a href=\"galaxy.php?mode=3&galaxy={$p['galaxy']}&system={$p['system']}\">{$p['galaxy']}:{$p['system']}:{$p['planet']}</a>]";
$parse['file_coordinates'] .= parsetemplate($row2, $data);
// {file_fields}
$data['text'] = $p['field_current'] . '/' . $p['field_max'];
$parse['file_fields'] .= parsetemplate($row2, $data);
// {file_metal}
$data['text'] = '<a href="resources.php?cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['metal']) . '</a> / ' . pretty_number($p['metal_perhour']);
$parse['file_metal'] .= parsetemplate($row2, $data);
// {file_crystal}
$data['text'] = '<a href="resources.php?cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['crystal']) . '</a> / ' . pretty_number($p['crystal_perhour']);
示例9: ShowTopNavigationBar
private function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
global $dpath, $svn_root, $lang;
$this->gotoBlock("topnav");
if ($CurrentUser['urlaubs_modus'] == 0 && isset($CurrentUser['urlaubs_modus'])) {
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
} else {
$this->db->query("UPDATE {{table}} SET `deuterium_sintetizer_porcent` = 0, `metal_mine_porcent` = 0, `crystal_mine_porcent` = 0 WHERE id_owner = " . $CurrentUser['id'], "planets");
}
$ThisUsersPlanets = SortUserPlanets($CurrentUser);
while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
if ($CurPlanet["destruyed"] == 0) {
if ($CurPlanet['planet_type'] != 3) {
$this->newblock('planetlist');
} else {
$this->newblock('moonlist');
}
if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
$CurPlanet['select'] = "selected=\"selected\" ";
}
$CurPlanet['page_topnav'] = $_GET['page'];
$CurPlanet['gid_topnav'] = $_GET['gid'];
$CurPlanet['mode_topnav'] = $_GET['mode'];
foreach ($CurPlanet as $name => $trans) {
$this->assign($name, $trans);
}
unset($CurPlanet);
} else {
if ($CurPlanet["destruyed"] < time()) {
$db->query("DELETE FROM `{{table}}` WHERE `id` = '{$CurPlanet['id']}'", "planets");
}
}
//FIN FIX ABANDONO
}
$this->gotoBlock("_ROOT");
$parse['image'] = $CurrentPlanet['image'];
$parse['show_umod_notice'] = $CurrentUser['urlaubs_modus'] ? '<table width="100%" style="border: 3px solid red; text-align:center;"><tr><td>' . $lang['tn_vacation_mode'] . date('d.m.Y h:i:s', $CurrentUser['urlaubs_until']) . '</td></tr></table>' : '';
$energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
// Energie
if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
$parse['energy'] = colorRed($energy);
} else {
$parse['energy'] = $energy;
}
// Metal
$metal = pretty_number($CurrentPlanet["metal"]);
if ($CurrentPlanet["metal"] >= $CurrentPlanet["metal_max"]) {
$parse['metal'] = colorRed($metal);
} else {
$parse['metal'] = $metal;
}
// Cristal
$crystal = pretty_number($CurrentPlanet["crystal"]);
if ($CurrentPlanet["crystal"] >= $CurrentPlanet["crystal_max"]) {
$parse['crystal'] = colorRed($crystal);
} else {
$parse['crystal'] = $crystal;
}
// Deuterium
$deuterium = pretty_number($CurrentPlanet["deuterium"]);
if ($CurrentPlanet["deuterium"] >= $CurrentPlanet["deuterium_max"]) {
$parse['deuterium'] = colorRed($deuterium);
} else {
$parse['deuterium'] = $deuterium;
}
if ($CurrentUser["activate_status"] == 0) {
$parse["show_umod_notice"] = '<table width="100%" style="border: 3px solid red;position:relative; text-align:center;z-index:10000"><tr><td>Debes activar tu cuenta si quieres seguir jugando. <a href="' . $svn_root . 'game.php?page=options&mode=activar">Activar tu Cuenta</a></td></tr></table>';
}
$parse['darkmatter'] = pretty_number($CurrentUser["darkmatter"]);
foreach ($parse as $name => $trans) {
$this->assign($name, $trans);
}
unset($parse);
}
示例10: ShowTopNavigationBar
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
global $lang, $game_config, $dpath;
if ($CurrentUser['urlaubs_modus'] == 0) {
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
} else {
doquery("UPDATE {{table}} SET `deuterium_sintetizer_porcent` = 0, `metal_mine_porcent` = 0, `crystal_mine_porcent` = 0, `darkmatter_mine_porcent` = 0 WHERE id_owner = " . $CurrentUser['id'], "planets");
}
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['image'] = $CurrentPlanet['image'];
if ($CurrentUser['rpg_geologue'] > 0) {
$parse['geologo'] = "geologue.gif";
} else {
$parse['geologo'] = "geologue_un.gif";
}
if ($CurrentUser['rpg_amiral'] > 0) {
$parse['admirante'] = "admiral.gif";
} else {
$parse['admirante'] = "amiral_un.gif";
}
if ($CurrentUser['rpg_empereur'] > 0) {
$parse['comandante'] = "empereur.gif";
} else {
$parse['comandante'] = "empereur_un.gif";
}
if ($CurrentUser['rpg_ingenieur'] > 0) {
$parse['ingeniero'] = "ingenieur.gif";
} else {
$parse['ingeniero'] = "ingenieur_un.gif";
}
if ($CurrentUser['rpg_technocrate'] > 0) {
$parse['tecnocrata'] = "technocrate.gif";
} else {
$parse['tecnocrata'] = "technocrate_un.gif";
}
if ($CurrentUser['urlaubs_modus'] && $CurrentUser['db_deaktjava']) {
$parse['show_umod_notice'] .= $CurrentUser['db_deaktjava'] ? '<table width="100%" style="border: 2px solid red; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $lang['tn_delete_mode'] . date('d.m.Y h:i:s', $CurrentUser['db_deaktjava'] + 60 * 60 * 24 * 7) . '</td></tr></table>' : '';
} else {
$parse['show_umod_notice'] = $CurrentUser['urlaubs_modus'] ? '<table width="100%" style="border: 2px solid #1DF0F0; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $lang['tn_vacation_mode'] . date('d.m.Y h:i:s', $CurrentUser['urlaubs_until']) . '</td></tr></table><br>' : '';
$parse['show_umod_notice'] .= $CurrentUser['db_deaktjava'] ? '<table width="100%" style="border: 2px solid red; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $lang['tn_delete_mode'] . date('d.m.Y h:i:s', $CurrentUser['db_deaktjava'] + 60 * 60 * 24 * 7) . '</td></tr></table>' : '';
}
$parse['planetlist'] = '';
$ThisUsersPlanets = SortUserPlanets($CurrentUser);
while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
if ($CurPlanet["destruyed"] == 0) {
$parse['planetlist'] .= "\n<option ";
if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
$parse['planetlist'] .= "selected=\"selected\" ";
}
$parse['planetlist'] .= "value=\"game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $CurPlanet['id'] . "";
$parse['planetlist'] .= "&mode=" . $_GET['mode'];
$parse['planetlist'] .= "&re=0\">";
if ($CurPlanet['planet_type'] != 3) {
$parse['planetlist'] .= "" . $CurPlanet['name'];
} else {
$parse['planetlist'] .= "" . $CurPlanet['name'] . " (" . $lang['fcm_moon'] . ")";
}
$parse['planetlist'] .= " [" . $CurPlanet['galaxy'] . ":";
$parse['planetlist'] .= "" . $CurPlanet['system'] . ":";
$parse['planetlist'] .= "" . $CurPlanet['planet'];
$parse['planetlist'] .= "] </option>";
}
}
$energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
// Energie
if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
$parse['energy'] = colorRed($energy);
} else {
$parse['energy'] = $energy;
}
// Metal
$metal = pretty_number($CurrentPlanet["metal"]);
if ($CurrentPlanet["metal"] >= $CurrentPlanet["metal_max"]) {
$parse['metal'] = colorRed($metal);
} else {
$parse['metal'] = $metal;
}
// Cristal
$crystal = pretty_number($CurrentPlanet["crystal"]);
if ($CurrentPlanet["crystal"] >= $CurrentPlanet["crystal_max"]) {
$parse['crystal'] = colorRed($crystal);
} else {
$parse['crystal'] = $crystal;
}
// Deuterium
$deuterium = pretty_number($CurrentPlanet["deuterium"]);
if ($CurrentPlanet["deuterium"] >= $CurrentPlanet["deuterium_max"]) {
$parse['deuterium'] = colorRed($deuterium);
} else {
$parse['deuterium'] = $deuterium;
}
// Materia Oscura
$darkmatter = pretty_number($CurrentPlanet["darkmatter"]);
if ($CurrentPlanet["darkmatter"] >= $CurrentPlanet["darkmatter_max"]) {
$parse['darkmatter'] = colorRed($darkmatter);
} else {
$parse['darkmatter'] = $darkmatter;
}
//$parse['darkmatter'] = pretty_number($CurrentUser["darkmatter"]);
//.........这里部分代码省略.........
示例11: ShowTopNavigationBar
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
global $lang, $game_config, $dpath;
if ($CurrentUser['urlaubs_modus'] == 0) {
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
} else {
doquery("UPDATE {{table}} SET `deuterium_sintetizer_porcent` = 0, `metal_mine_porcent` = 0, `crystal_mine_porcent` = 0 WHERE id_owner = " . $CurrentUser['id'], "planets");
}
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['image'] = $CurrentPlanet['image'];
$parse['show_umod_notice'] = $CurrentUser['urlaubs_modus'] ? '<table width="100%" style="border: 3px solid red; text-align:center;"><tr><td>' . $lang['tn_vacation_mode'] . date('d.m.Y h:i:s', $CurrentUser['urlaubs_until']) . '</td></tr></table>' : '';
$parse['show_umod_notice'] = $CurrentUser['db_deaktjava'] ? '<table width="100%" style="border: 3px solid red; text-align:center;"><tr><td>' . $lang['tn_delete_mode'] . date('d.m.Y h:i:s', $CurrentUser['db_deaktjava'] + 60 * 60 * 24 * 7) . '</td></tr></table>' : '';
$parse['planetlist'] = '';
$ThisUsersPlanets = SortUserPlanets($CurrentUser);
while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
if ($CurPlanet["destruyed"] == 0) {
$parse['planetlist'] .= "\n<option ";
if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
$parse['planetlist'] .= "selected=\"selected\" ";
}
$parse['planetlist'] .= "value=\"game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $CurPlanet['id'] . "";
$parse['planetlist'] .= "&mode=" . $_GET['mode'];
$parse['planetlist'] .= "&re=0\">";
if ($CurPlanet['planet_type'] != 3) {
$parse['planetlist'] .= "" . $CurPlanet['name'];
} else {
$parse['planetlist'] .= "" . $CurPlanet['name'] . " (" . $lang['fcm_moon'] . ")";
}
$parse['planetlist'] .= " [" . $CurPlanet['galaxy'] . ":";
$parse['planetlist'] .= "" . $CurPlanet['system'] . ":";
$parse['planetlist'] .= "" . $CurPlanet['planet'];
$parse['planetlist'] .= "] </option>";
}
}
$energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
// Energie
if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
$parse['energy'] = colorRed($energy);
} else {
$parse['energy'] = $energy;
}
// Metal
$metal = pretty_number($CurrentPlanet["metal"]);
if ($CurrentPlanet["metal"] >= $CurrentPlanet["metal_max"]) {
$parse['metal'] = colorRed($metal);
} else {
$parse['metal'] = $metal;
}
// Cristal
$crystal = pretty_number($CurrentPlanet["crystal"]);
if ($CurrentPlanet["crystal"] >= $CurrentPlanet["crystal_max"]) {
$parse['crystal'] = colorRed($crystal);
} else {
$parse['crystal'] = $crystal;
}
// Deuterium
$deuterium = pretty_number($CurrentPlanet["deuterium"]);
if ($CurrentPlanet["deuterium"] >= $CurrentPlanet["deuterium_max"]) {
$parse['deuterium'] = colorRed($deuterium);
} else {
$parse['deuterium'] = $deuterium;
}
$parse['darkmatter'] = pretty_number($CurrentUser["darkmatter"]);
$parse['metal_max'] .= pretty_number($CurrentPlanet["metal_max"] / 1);
$parse['crystal_max'] .= pretty_number($CurrentPlanet["crystal_max"] / 1);
$parse['deuterium_max'] .= pretty_number($CurrentPlanet["deuterium_max"] / 1);
$parse['metal_perhour'] .= $CurrentPlanet["metal_perhour"] + $game_config['metal_basic_income'] * $game_config['resource_multiplier'];
$parse['crystal_perhour'] .= $CurrentPlanet["crystal_perhour"] + $game_config['crystal_basic_income'] * $game_config['resource_multiplier'];
$parse['deuterium_perhour'] .= $CurrentPlanet["deuterium_perhour"] + $game_config['deuterium_basic_income'] * $game_config['resource_multiplier'];
$parse['metalh'] .= round($CurrentPlanet["metal"]);
$parse['crystalh'] .= round($CurrentPlanet["crystal"]);
$parse['deuteriumh'] .= round($CurrentPlanet["deuterium"]);
$parse['metal_mmax'] .= $CurrentPlanet["metal_max"] * MAX_OVERFLOW;
$parse['crystal_mmax'] .= $CurrentPlanet["crystal_max"] * MAX_OVERFLOW;
$parse['deuterium_mmax'] .= $CurrentPlanet["deuterium_max"] * MAX_OVERFLOW;
$TopBar = parsetemplate(gettemplate('topnav'), $parse);
return $TopBar;
}
示例12: ShowTopNavigationBar
/**
* ShowTopNavigationsBar.php
* @Licence GNU (GPL)
* @version 1.0
* @copyright 2009
* @Team Space Beginner
*
**/
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
global $lang, $_GET, $game_config, $dpath;
includeLang('menu');
if ($CurrentUser) {
if (!$CurrentPlanet) {
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $CurrentUser['current_planet'] . "';", 'planets', true);
}
if ($CurrentPlanet["metal"] < 0) {
$CurrentPlanet["metal"] = 1;
}
if ($CurrentPlanet["crystal"] < 0) {
$CurrentPlanet["crystal"] = 1;
}
if ($CurrentPlanet["deuterium"] < 0) {
$CurrentPlanet["deuterium"] = 1;
}
if ($CurrentPlanet["appolonium"] < 0) {
$CurrentPlanet["appolonium"] = 1;
}
if ($CurrentUser['urlaubs_modus'] == 0) {
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
} else {
doquery("UPDATE {{table}} SET `deuterium_sintetizer_porcent` = 0,`appolonium_mine_porcent` = 0, `metal_mine_porcent` = 0, `crystal_mine_porcent` = 0 WHERE id_owner = " . $CurrentUser['id'], "planets");
}
$NavigationTPL = gettemplate('menu/menu');
$dpath = !$CurrentUser["dpath"] ? DEFAULT_SKINPATH : $CurrentUser["dpath"];
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['image'] = $CurrentPlanet['image'];
$parse['username'] = $CurrentUser['username'];
$parse['user-id'] = $CurrentUser['id'];
$parse['user-zone'] = $CurrentUser['angriffszone'];
$parse['name'] = $game_config['game_name'];
$parse['nummer'] = $game_config['VERSION'];
$parse['forum_url'] = $game_config['forum_url'];
$parse['lm_tx_serv'] = $game_config['resource_multiplier'];
$parse['lm_tx_game'] = $game_config['game_speed'] / 2500;
$parse['lm_tx_fleet'] = $game_config['fleet_speed'] / 2500;
$parse['lm_tx_queue'] = MAX_FLEET_OR_DEFS_PER_ROW;
$parse['show_umod_notice'] = $CurrentUser['urlaubs_modus'] ? '<table width="100%" style="border: 1px solid red; text-align:center;"><tr><td>Urlaubsmodus</td></tr></table>' : '';
$parse['show_attacklock_notice'] = $game_config['attack_disabled'] ? '<table width="100%" style="border: 3px solid red; text-align:center;text-decoration:blink;color: #ff0000;"><tr><td>Angriffsperre aktiviert Informationen im Forum</td></tr></table>' : '';
switch ($CurrentUser['volk']) {
case "A":
switch ($CurrentUser['avatar']) {
case "0":
$parse['volk'] = "<img src=\"./styl/image/volk/volk_01.jpg\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
case "A":
$parse['volk'] = "<img src=\"./styl/image/volk/volk_01.jpg\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
default:
$parse['volk'] = "<img src=\"" . $CurrentUser['avatar'] . "\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
}
$parse['volk1'] = "" . $lang['menu']['401'] . "";
break;
case "B":
switch ($CurrentUser['avatar']) {
case "0":
$parse['volk'] = "<img src=\"./styl/image/volk/volk_02.jpg\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
case "B":
$parse['volk'] = "<img src=\"./styl/image/volk/volk_02.jpg\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
default:
$parse['volk'] = "<img src=\"" . $CurrentUser['avatar'] . "\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
}
$parse['volk1'] = "" . $lang['menu']['402'] . "";
break;
case "C":
switch ($CurrentUser['avatar']) {
case "0":
$parse['volk'] = "<img src=\"./styl/image/volk/volk_03.jpg\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
case "C":
$parse['volk'] = "<img src=\"./styl/image/volk/volk_03.jpg\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
default:
$parse['volk'] = "<img src=\"" . $CurrentUser['avatar'] . "\" style=\"height:33px; width:33px;\" alt=\"\">";
break;
}
$parse['volk1'] = "" . $lang['menu']['403'] . "";
break;
case "0":
$parse['volk'] = "<img src=\"./styl/image/volk/volk_04.png\" style=\"height:33px; width:33px;\" alt=\"\">";
$parse['volk1'] = "" . $lang['menu']['404'] . "";
break;
}
if ($CurrentUser['authlevel'] > 0) {
$parse['ADMIN_LINK'] = "<a href=\"admin/index.php\" target=\"_blank\"><font size=\"1\" color=\"red\"><b>" . $lang['menu']['506'] . "</b></font></a> -";
//.........这里部分代码省略.........
示例13: ShowTopNavigationBar
/**
* ShowTopNavigationBar.php
*
* @version 1
* @copyright 2008 By Chlorel for XNova
*/
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
global $lang, $_GET, $game_config;
if ($CurrentUser) {
if (!$CurrentPlanet) {
$CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $CurrentUser['current_planet'] . "';", 'planets', true);
}
//Rohstoffe von -Rohstoffen wieder hoch setzen
if ($CurrentPlanet["metal"] < 0) {
$CurrentPlanet["metal"] = 1000000;
} else {
}
if ($CurrentPlanet["crystal"] < 0) {
$CurrentPlanet["crystal"] = 1000000;
} else {
}
if ($CurrentPlanet["deuterium"] < 0) {
$CurrentPlanet["deuterium"] = 1000000;
} else {
}
// Actualisation des ressources de la planete
if ($CurrentUser['urlaubs_modus'] == 0) {
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
} else {
doquery("UPDATE {{table}} SET `deuterium_sintetizer_porcent` = 0, `metal_mine_porcent` = 0, `crystal_mine_porcent` = 0 WHERE id_owner = " . $CurrentUser['id'], "planets");
}
$NavigationTPL = gettemplate('topnav');
$dpath = !$CurrentUser["dpath"] ? DEFAULT_SKINPATH : $CurrentUser["dpath"];
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['image'] = $CurrentPlanet['image'];
$parse['show_umod_notice'] = $CurrentUser['urlaubs_modus'] ? '<table width="100%" style="border: 1px solid red; text-align:center;"><tr><td>Urlaubsmodus</td></tr></table>' : '';
$parse['show_attacklock_notice'] = $game_config['attack_disabled'] ? '<table width="100%" style="border: 3px solid red; text-align:center;text-decoration:blink;color: #ff0000;"><tr><td>Angriffsperre aktiviert nähere Informationen im Forum</td></tr></table>' : '';
// Genearation de la combo des planetes du joueur
$parse['planetlist'] = '';
$ThisUsersPlanets = SortUserPlanets($CurrentUser);
while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
if ($CurPlanet["destruyed"] == 0) {
$parse['planetlist'] .= "\n<option ";
if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
// Bon puisque deja on s'y trouve autant le marquer
$parse['planetlist'] .= "selected=\"selected\" ";
}
$parse['planetlist'] .= "value=\"?cp=" . $CurPlanet['id'] . "";
$parse['planetlist'] .= "&mode=" . $_GET['mode'];
$parse['planetlist'] .= "&re=0\">";
// Nom et coordonnées de la planete
$parse['planetlist'] .= "" . $CurPlanet['name'];
$parse['planetlist'] .= " [" . $CurPlanet['galaxy'] . ":";
$parse['planetlist'] .= "" . $CurPlanet['system'] . ":";
$parse['planetlist'] .= "" . $CurPlanet['planet'];
$parse['planetlist'] .= "] </option>";
}
}
$energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
// Energie
if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
$parse['energy'] = colorRed($energy);
} else {
$parse['energy'] = $energy;
}
// Metal
$metal = pretty_number($CurrentPlanet["metal"]);
if ($CurrentPlanet["metal"] > $CurrentPlanet["metal_max"]) {
$parse['metal'] = colorRed($metal);
} else {
$parse['metal'] = $metal;
}
// Cristal
$crystal = pretty_number($CurrentPlanet["crystal"]);
if ($CurrentPlanet["crystal"] > $CurrentPlanet["crystal_max"]) {
$parse['crystal'] = colorRed($crystal);
} else {
$parse['crystal'] = $crystal;
}
// Deuterium
$deuterium = pretty_number($CurrentPlanet["deuterium"]);
if ($CurrentPlanet["deuterium"] > $CurrentPlanet["deuterium_max"]) {
$parse['deuterium'] = colorRed($deuterium);
} else {
$parse['deuterium'] = $deuterium;
}
// Max Energie
$energy_max = pretty_number($CurrentPlanet["energy_max"]);
if ($CurrentPlanet["energy_max"] > $CurrentPlanet["energy_max"]) {
$parse['energy_max'] = colorRed($energy_max);
} else {
$parse['energy_max'] = $energy_max;
}
$parse['energy_total'] = colorNumber(pretty_number(floor($CurrentPlanet['energy_max'] + $CurrentPlanet["energy_used"])) - $parse['energy_basic_income']);
// Metal maximo
if ($CurrentPlanet["metal_max"] < $CurrentPlanet["metal"]) {
$parse['metal_max'] = '<font color="#ff0000">';
} else {
//.........这里部分代码省略.........
示例14: BatimentBuildingPage
/**
* BatimentBuildingPage.php
*
* @version 1.1
* @copyright 2008 by Chlorel for XNova
*/
function BatimentBuildingPage(&$CurrentPlanet, $CurrentUser)
{
global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $user;
CheckPlanetUsedFields($CurrentPlanet);
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
// Was gebaut werden darf in Abhängikeit zum gewählten Volk.
switch ($user['volk']) {
case "A":
$Allowed['1'] = array(1, 2, 3, 11, 12, 14, 15, 21, 22, 23, 24, 25, 26, 27, 31, 33, 34, 44);
$Allowed['3'] = array(4, 12, 14, 15, 21, 25, 26, 34, 41, 42, 43);
break;
case "B":
$Allowed['1'] = array(1, 2, 3, 11, 12, 14, 15, 21, 22, 23, 24, 25, 26, 31, 33, 34, 44, 45);
$Allowed['3'] = array(4, 12, 14, 15, 21, 25, 26, 34, 41, 42, 43);
break;
case "C":
$Allowed['1'] = array(1, 2, 3, 11, 12, 14, 15, 21, 22, 23, 24, 25, 26, 31, 33, 34, 44, 46);
$Allowed['3'] = array(4, 12, 14, 15, 21, 25, 26, 34, 41, 42, 43, 46);
break;
}
//Werte auf null setzen
$bThisIsCheated = 0;
$bDoItNow = 0;
$TheCommand = 0;
$Element = 0;
$ListID = 0;
// Boucle d'interpretation des eventuelles commandes
if (isset($_GET['cmd'])) {
// On passe une commande
$bThisIsCheated = false;
$bDoItNow = false;
$TheCommand = $_GET['cmd'];
$Element = $_GET['building'];
$ListID = $_GET['listid'];
if (isset($Element)) {
if (!strchr($Element, " ")) {
if (!strchr($Element, ",")) {
if (!strchr($Element, ";")) {
if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
$bDoItNow = true;
} else {
$bThisIsCheated = true;
}
} else {
$bThisIsCheated = true;
}
} else {
$bThisIsCheated = true;
}
} else {
$bThisIsCheated = true;
}
} elseif (isset($ListID)) {
$bDoItNow = true;
}
if ($bDoItNow == true) {
$Element = abs($Element);
switch ($TheCommand) {
case 'cancel':
// Interrompre le premier batiment de la queue
CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
break;
case 'remove':
// Supprimer un element de la queue (mais pas le premier)
// $RemID -> element de la liste a supprimer
RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
break;
case 'insert':
// Insere un element dans la queue
AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
break;
case 'destroy':
// Detruit un batiment deja construit sur la planete !
AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
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 {
//.........这里部分代码省略.........
示例15: ShowTopNavigationBar
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
global $lang, $game_config, $dpath, $user;
if ($CurrentUser['urlaubs_modus'] == 0) {
PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
} else {
doquery("UPDATE {{table}} SET `deuterium_sintetizer_porcent` = 0, `metal_mine_porcent` = 0, `crystal_mine_porcent` = 0 WHERE id_owner = " . intval($CurrentUser['id']), "planets");
}
$parse = $lang;
$parse['dpath'] = $dpath;
$parse['image'] = $CurrentPlanet['image'];
if ($user['authlevel'] > 0) {
$parse['admin_link'] = "<tr><td><div align=\"center\"><a href=\"javascript:top.location.href='adm/index.php'\"> <font color=\"lime\">" . $lang['lm_administration'] . "</font></a></div></td></tr>";
} else {
$parse['admin_link'] = "";
}
if ($CurrentUser['urlaubs_modus'] && $CurrentUser['db_deaktjava']) {
$parse['show_umod_notice'] .= $CurrentUser['db_deaktjava'] ? '<table width="100%" style="border: 2px solid red; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $lang['tn_delete_mode'] . date('d.m.Y h:i:s', $CurrentUser['db_deaktjava'] + 60 * 60 * 24 * 7) . '</td></tr></table>' : '';
} else {
$parse['show_umod_notice'] = $CurrentUser['urlaubs_modus'] ? '<table width="100%" style="border: 2px solid #1DF0F0; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $lang['tn_vacation_mode'] . date('d.m.Y h:i:s', $CurrentUser['urlaubs_until']) . '</td></tr></table><br>' : '';
$parse['show_umod_notice'] .= $CurrentUser['db_deaktjava'] ? '<table width="100%" style="border: 2px solid red; text-align:center;background:transparent;"><tr style="background:transparent;"><td style="background:transparent;">' . $lang['tn_delete_mode'] . date('d.m.Y h:i:s', $CurrentUser['db_deaktjava'] + 60 * 60 * 24 * 7) . '</td></tr></table>' : '';
}
$parse['planetlist'] = '';
$ThisUsersPlanets = SortUserPlanets($CurrentUser);
while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
if ($CurPlanet["destruyed"] == 0) {
$parse['planetlist'] .= "\n<option ";
if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
$parse['planetlist'] .= "selected=\"selected\" ";
}
$parse['planetlist'] .= "value=\"game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $CurPlanet['id'] . "";
$parse['planetlist'] .= "&mode=" . $_GET['mode'];
$parse['planetlist'] .= "&re=0\">";
if ($CurPlanet['planet_type'] != 3) {
$parse['planetlist'] .= "" . $CurPlanet['name'];
} else {
$parse['planetlist'] .= "" . $CurPlanet['name'] . " (" . $lang['fcm_moon'] . ")";
}
$parse['planetlist'] .= " [" . $CurPlanet['galaxy'] . ":";
$parse['planetlist'] .= "" . $CurPlanet['system'] . ":";
$parse['planetlist'] .= "" . $CurPlanet['planet'];
$parse['planetlist'] .= "] </option>";
}
}
$energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
// Energie
if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
$parse['energy'] = colorRed($energy);
} else {
$parse['energy'] = $energy;
}
// Metal
$metal = pretty_number($CurrentPlanet["metal"]);
if ($CurrentPlanet["metal"] >= $CurrentPlanet["metal_max"]) {
$parse['metal'] = colorRed($metal);
} else {
$parse['metal'] = $metal;
}
// Cristal
$crystal = pretty_number($CurrentPlanet["crystal"]);
if ($CurrentPlanet["crystal"] >= $CurrentPlanet["crystal_max"]) {
$parse['crystal'] = colorRed($crystal);
} else {
$parse['crystal'] = $crystal;
}
// Deuterium
$deuterium = pretty_number($CurrentPlanet["deuterium"]);
if ($CurrentPlanet["deuterium"] >= $CurrentPlanet["deuterium_max"]) {
$parse['deuterium'] = colorRed($deuterium);
} else {
$parse['deuterium'] = $deuterium;
}
$parse['darkmatter'] = pretty_number($CurrentUser["darkmatter"]);
// Porcentaje de almacenes con bug fix almaneces negativos.
$parse['metal_max'] .= pretty_number($CurrentPlanet["metal_max"] / 1) . " {$lang['']}";
$parse['crystal_max'] .= pretty_number($CurrentPlanet["crystal_max"] / 1) . " {$lang['']}";
$parse['deuterium_max'] .= pretty_number($CurrentPlanet["deuterium_max"] / 1) . " {$lang['']}";
$parse['metal_perhour'] .= $CurrentPlanet["metal_perhour"] + $game_config['metal_basic_income'] * $game_config['resource_multiplier'];
$parse['crystal_perhour'] .= $CurrentPlanet["crystal_perhour"] + $game_config['crystal_basic_income'] * $game_config['resource_multiplier'];
$parse['deuterium_perhour'] .= $CurrentPlanet["deuterium_perhour"] + $game_config['deuterium_basic_income'] * $game_config['resource_multiplier'];
$parse['metalh'] .= round($CurrentPlanet["metal"]);
$parse['crystalh'] .= round($CurrentPlanet["crystal"]);
$parse['deuteriumh'] .= round($CurrentPlanet["deuterium"]);
$parse['metal_mmax'] .= $CurrentPlanet["metal_max"] * MAX_OVERFLOW;
$parse['crystal_mmax'] .= $CurrentPlanet["crystal_max"] * MAX_OVERFLOW;
$parse['deuterium_mmax'] .= $CurrentPlanet["deuterium_max"] * MAX_OVERFLOW;
$parse['metal_storage'] = floor($CurrentPlanet['metal'] / $CurrentPlanet['metal_max'] * 100) . "%";
$parse['crystal_storage'] = floor($CurrentPlanet['crystal'] / $CurrentPlanet['crystal_max'] * 100) . "%";
$parse['deuterium_storage'] = floor($CurrentPlanet['deuterium'] / $CurrentPlanet['deuterium_max'] * 100) . "%";
$parse['energy_storage'] = floor(($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) / (1 + $CurrentPlanet['energy_max']) * 100) . "%";
$parse['metal_storage_bar'] = floor($CurrentPlanet['metal'] / $CurrentPlanet['metal_max'] * 100 * 0.7);
$parse['crystal_storage_bar'] = floor($CurrentPlanet['crystal'] / $CurrentPlanet['crystal_max'] * 100 * 0.7);
$parse['deuterium_storage_bar'] = floor($CurrentPlanet['deuterium'] / $CurrentPlanet['deuterium_max'] * 100 * 0.7);
$parse['energy_storage_bar'] = floor(($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) / (1 + $CurrentPlanet['energy_max']) * 100 * 0.7);
if ($parse['metal_storage_bar'] >= 100 * 0.7) {
$parse['metal_storage_bar'] = 70;
$parse['metal_storage'] = "100%";
$parse['metal_storage_barcolor'] = '#FF0000';
} elseif ($parse['metal_storage_bar'] > 100 * 0.63) {
$parse['metal_storage_barcolor'] = '#FFCC00';
//.........这里部分代码省略.........