/** * 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; }
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(); }
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; }
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>"; $parse['metal_total'] = colorNumber(pretty_number($CurrentPlanet['metal_perhour'] + $parse['metal_basic_income'])); $parse['crystal_total'] = colorNumber(pretty_number($CurrentPlanet['crystal_perhour'] + $parse['crystal_basic_income'])); $parse['deuterium_total'] = colorNumber(pretty_number($CurrentPlanet['deuterium_perhour'] + $parse['deuterium_basic_income'])); $parse['energy_total'] = colorNumber(pretty_number($CurrentPlanet['energy_max'] + $parse['energy_basic_income'] + $CurrentPlanet['energy_used'])); $parse['daily_metal'] = floor(($CurrentPlanet['metal_perhour'] + $parse['metal_basic_income']) * 24); $parse['weekly_metal'] = floor($parse['daily_metal'] * 7); $parse['monthly_metal'] = floor($parse['daily_metal'] * 30); $parse['daily_crystal'] = floor(($CurrentPlanet['crystal_perhour'] + $parse['crystal_basic_income']) * 24); $parse['weekly_crystal'] = floor($parse['daily_crystal'] * 7); $parse['monthly_crystal'] = floor($parse['daily_crystal'] * 30); $parse['daily_deuterium'] = floor(($CurrentPlanet['deuterium_perhour'] + $parse['deuterium_basic_income']) * 24); $parse['weekly_deuterium'] = floor($parse['daily_deuterium'] * 7); $parse['monthly_deuterium'] = floor($parse['daily_deuterium'] * 30); $parse['daily_metal'] = colorNumber(pretty_number($parse['daily_metal'])); $parse['weekly_metal'] = colorNumber(pretty_number($parse['weekly_metal'])); $parse['monthly_metal'] = colorNumber(pretty_number($parse['monthly_metal'])); $parse['daily_crystal'] = colorNumber(pretty_number($parse['daily_crystal'])); $parse['weekly_crystal'] = colorNumber(pretty_number($parse['weekly_crystal'])); $parse['monthly_crystal'] = colorNumber(pretty_number($parse['monthly_crystal'])); $parse['daily_deuterium'] = colorNumber(pretty_number($parse['daily_deuterium'])); $parse['weekly_deuterium'] = colorNumber(pretty_number($parse['weekly_deuterium'])); $parse['monthly_deuterium'] = colorNumber(pretty_number($parse['monthly_deuterium'])); $parse['metal_storage'] = floor($CurrentPlanet['metal'] / $CurrentPlanet['metal_max'] * 100) . $lang['o/o']; $parse['crystal_storage'] = floor($CurrentPlanet['crystal'] / $CurrentPlanet['crystal_max'] * 100) . $lang['o/o']; $parse['deuterium_storage'] = floor($CurrentPlanet['deuterium'] / $CurrentPlanet['deuterium_max'] * 100) . $lang['o/o']; $parse['metal_storage_bar'] = floor($CurrentPlanet['metal'] / $CurrentPlanet['metal_max'] * 100 * 2.5); $parse['crystal_storage_bar'] = floor($CurrentPlanet['crystal'] / $CurrentPlanet['crystal_max'] * 100 * 2.5); $parse['deuterium_storage_bar'] = floor($CurrentPlanet['deuterium'] / $CurrentPlanet['deuterium_max'] * 100 * 2.5); if ($parse['metal_storage_bar'] > 100 * 2.5) { $parse['metal_storage_bar'] = 250; $parse['metal_storage_barcolor'] = '#C00000'; } elseif ($parse['metal_storage_bar'] > 80 * 2.5) { $parse['metal_storage_barcolor'] = '#C0C000'; } else { $parse['metal_storage_barcolor'] = '#00C000'; } if ($parse['crystal_storage_bar'] > 100 * 2.5) { $parse['crystal_storage_bar'] = 250; $parse['crystal_storage_barcolor'] = '#C00000'; } elseif ($parse['crystal_storage_bar'] > 80 * 2.5) { $parse['crystal_storage_barcolor'] = '#C0C000'; } else { $parse['crystal_storage_barcolor'] = '#00C000'; } if ($parse['deuterium_storage_bar'] > 100 * 2.5) { $parse['deuterium_storage_bar'] = 250; $parse['deuterium_storage_barcolor'] = '#C00000'; } elseif ($parse['deuterium_storage_bar'] > 80 * 2.5) { $parse['deuterium_storage_barcolor'] = '#C0C000'; } else { $parse['deuterium_storage_barcolor'] = '#00C000'; } $parse['production_level_bar'] = $parse['production_level'] * 2.5; $parse['production_level'] = "{$parse['production_level']}%"; $parse['production_level_barcolor'] = '#00ff00'; $sql = <<<SQL \t\t\tUPDATE {{table}} \t\t\tSET \t\t\t\t`energy_max` = '{$CurrentPlanet['energy_max']}' \t\t\t\t{$SubQry} \t\t\tWHERE \t\t\t\t`id` = '{$CurrentPlanet['id']}' SQL; doquery($sql, 'planets'); $page = parsetemplate($RessBodyTPL, $parse); return $page; }
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 = "******"; $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 "; $QryUpdatePlanet .= "`b_building` = '" . $CurrentPlanet['b_building'] . "' , "; $QryUpdatePlanet .= "`b_building_id` = '" . $CurrentPlanet['b_building_id'] . "' "; $QryUpdatePlanet .= "WHERE "; $QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';"; doquery($QryUpdatePlanet, 'planets'); $RetValue = false; } return $RetValue; }
/** * 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]) . "' "; $QryUpdateGalaxy .= "WHERE "; $QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; $QryUpdateGalaxy .= "LIMIT 1;"; doquery($QryUpdateGalaxy, 'galaxy'); // Mise à jour du CDR en table galaxy // doquery('UPDATE {{table}} SET metal=metal+'.($result['debree']['att'][0]+$result['debree']['def'][0]).' , crystal=crystal+'.($result['debree']['att'][1]+$result['debree']['def'][1]).' WHERE `galaxy` = '. $FleetRow['fleet_end_galaxy'] .' AND `system` = '. $FleetRow['fleet_end_system'] .' AND `planet` = '. $FleetRow['fleet_end_planet'],'galaxy'); $totalDebree = $result['debree']['def'][0] + $result['debree']['def'][1] + $result['debree']['att'][0] + $result['debree']['att'][1]; $steal = array('metal' => 0, 'crystal' => 0, 'deuterium' => 0, 'appolonium' => 0); switch ($result['won']) { case "a": // Calculons la capacité de transpor du restant de flotte après combat $max_resources = 0; foreach ($attackFleets[$FleetRow['fleet_id']]['detail'] as $Element => $amount) { $max_resources += $pricelist[$Element]['capacity'] * $amount; } if ($max_resources > 0) { $metal = $targetPlanet['metal'] / 2; $crystal = $targetPlanet['crystal'] / 2; $deuter = $targetPlanet['deuterium'] / 2; $appolonium = $targetPlanet['appolonium'] / 2; if ($appolonium > $max_resources / 4) { $steal['appolonium'] = $max_resources / 4; $max_resources -= $steal['appolonium']; } else { $steal['appolonium'] = $appolonium; $max_resources -= $steal['appolonium']; } if ($deuter > $max_resources / 3) { $steal['deuterium'] = $max_resources / 3; $max_resources -= $steal['deuterium']; } else { $steal['deuterium'] = $deuter; $max_resources -= $steal['deuterium']; } if ($crystal > $max_resources / 2) { $steal['crystal'] = $max_resources / 2; $max_resources -= $steal['crystal']; } else { $steal['crystal'] = $crystal; $max_resources -= $steal['crystal']; } if ($metal > $max_resources) { $steal['metal'] = $max_resources; $max_resources = $max_resources - $steal['metal']; } else { $steal['metal'] = $metal; $max_resources -= $steal['metal']; } } $steal = array_map('round', $steal); // Mise à jour de la flotte après pillage $QryUpdateFleet = 'UPDATE {{table}} SET '; $QryUpdateFleet .= '`fleet_resource_metal` = `fleet_resource_metal` + ' . $steal['metal'] . ', '; $QryUpdateFleet .= '`fleet_resource_crystal` = `fleet_resource_crystal` +' . $steal['crystal'] . ', '; $QryUpdateFleet .= '`fleet_resource_deuterium` = `fleet_resource_deuterium` +' . $steal['deuterium'] . ', '; $QryUpdateFleet .= '`fleet_resource_appolonium` = `fleet_resource_appolonium` +' . $steal['appolonium'] . ' '; $QryUpdateFleet .= 'WHERE fleet_id = ' . $FleetRow['fleet_id'] . ' '; $QryUpdateFleet .= 'LIMIT 1 ;'; doquery($QryUpdateFleet, 'fleets'); // Mise à jour flotte et planètes foreach ($attackFleets as $fleetID => $attacker) { // Flottes attaquantes $fleetArray = ''; $totalCount = 0; foreach ($attacker['detail'] as $element => $amount) { if ($amount) { $fleetArray .= $element . ',' . $amount . ';'; } $totalCount += $amount; } if ($totalCount <= 0) { doquery('DELETE FROM {{table}} WHERE `fleet_id`=' . $fleetID, 'fleets'); } else { doquery('UPDATE {{table}} SET fleet_array="' . substr($fleetArray, 0, -1) . '", fleet_amount=' . $totalCount . ', fleet_mess=1 WHERE fleet_id=' . $fleetID, 'fleets'); } } foreach ($defense as $fleetID => $defender) { // Flottes et Défenses de la cible if ($fleetID != 0) { $fleetArray = ''; $totalCount = 0; foreach ($defender['def'] as $element => $amount) { if ($amount) { $fleetArray .= $element . ',' . $amount . ';'; } $totalCount += $amount; } if ($totalCount <= 0) { doquery('DELETE FROM {{table}} WHERE `fleet_id`=' . $fleetID, 'fleets'); } else { doquery('UPDATE {{table}} SET fleet_array="' . $fleetArray . '", fleet_amount=' . $totalCount . ', fleet_mess=1 WHERE fleet_id=' . $fleetID, 'fleets'); } } else { $fleetArray = ''; $totalCount = 0; foreach ($defender['def'] as $element => $amount) { $fleetArray .= '`' . $resource[$element] . '`=' . $amount . ', '; } // Mise a jour de l'enregistrement de la planete attaquée $QryUpdateTarget = "UPDATE {{table}} SET "; $QryUpdateTarget .= $fleetArray; $QryUpdateTarget .= "`metal` = `metal` - '" . $steal['metal'] . "', "; $QryUpdateTarget .= "`crystal` = `crystal` - '" . $steal['crystal'] . "', "; $QryUpdateTarget .= "`deuterium` = `deuterium` - '" . $steal['deuterium'] . "', "; $QryUpdateTarget .= "`appolonium` = `appolonium` - '" . $steal['appolonium'] . "' "; $QryUpdateTarget .= "WHERE "; $QryUpdateTarget .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND "; $QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' "; $QryUpdateTarget .= "LIMIT 1;"; doquery($QryUpdateTarget, 'planets'); } } //Mondzerstörungswarscheinlichkeitsberechnung gemäß Owiki $destructionl1 = 100 - sqrt($targetPlanet['diameter']); if ($attackFleets[$FleetRow['fleet_id']]['detail'][218] > 0) { $destructionl21 = $destructionl1 * round(sqrt($attackFleets[$FleetRow['fleet_id']]['detail'][218] / MAX_ST)); $destructionl2 = $destructionl21 / 1; } else { $destructionl21 = $destructionl1 * round(sqrt($attackFleets[$FleetRow['fleet_id']]['detail'][214] / MAX_RIP)); $destructionl2 = $destructionl21 / 1; } if ($destructionl2 > 100) { $chance = '100'; } elseif ($destructionl2 < 0) { $chance = '0'; } else { $chance = round($destructionl2); // En pourcentage } $tirage = mt_rand(0, 100); $probalune = sprintf($lang['sys_destruc_lune'], $chance); if ($tirage <= $chance) { //destruction de la lune dabord dans la liste des planetes puis dans la liste des lunes et enfin dans la galaxie doquery("DELETE FROM {{table}} WHERE `id` = '" . $targetPlanet['id'] . "';", 'planets'); //$Qrydestructionlune .= ";"; $Qrydestructionlune = "DELETE FROM {{table}} "; $Qrydestructionlune .= "WHERE "; $Qrydestructionlune .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $Qrydestructionlune .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $Qrydestructionlune .= "`lunapos` = '" . $FleetRow['fleet_end_planet'] . "' "; $Qrydestructionlune .= "LIMIT 1 ;"; doquery($Qrydestructionlune, 'lunas'); //$Qrydestructionlune2 .= ";"; $Qrydestructionlune2 = "UPDATE {{table}} SET "; $Qrydestructionlune2 .= "`id_luna` = '0' "; $Qrydestructionlune2 .= "WHERE "; $Qrydestructionlune2 .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $Qrydestructionlune2 .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $Qrydestructionlune2 .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; $Qrydestructionlune2 .= "LIMIT 1 ;"; doquery($Qrydestructionlune2, 'galaxy'); //la lune est detruite, alors on redirige les flottes sur la planete $QryFleetsFrom = doquery("SELECT * FROM {{table}} WHERE \n\t\t\t\t`fleet_start_galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND\n\t\t\t\t`fleet_start_system` = '" . $FleetRow['fleet_end_system'] . "' AND\n\t\t\t\t`fleet_start_planet` = '" . $FleetRow['fleet_end_planet'] . "' AND\n\t\t\t\t`fleet_start_type` = '3';", 'fleets'); while ($FromMoonFleets = mysql_fetch_array($QryFleetsFrom)) { doquery("UPDATE {{table}} SET `fleet_start_type` = '1' WHERE `fleet_id` = '" . $FromMoonFleets['fleet_id'] . "';", 'fleets'); } $QryFleetsTo = doquery("SELECT * FROM {{table}} WHERE \n\t\t\t\t`fleet_end_galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND\n\t\t\t\t`fleet_end_system` = '" . $FleetRow['fleet_end_system'] . "' AND\n\t\t\t\t`fleet_end_planet` = '" . $FleetRow['fleet_end_planet'] . "' AND\n\t\t\t\t`fleet_end_type` = '3';", 'fleets'); while ($ToMoonFleets = mysql_fetch_array($QryFleetsTo)) { doquery("UPDATE {{table}} SET `fleet_end_type` = '1' WHERE `fleet_id` = '" . $ToMoonFleets['fleet_id'] . "';", 'fleets'); } // Mond Explodiert!?Wo bleiben die Trümmer vom Mond $metallmond = 0; $kristallmond = 0; $appolonium = 0; // Berechnung des Trümmerfeldes $metallmond = round($targetPlanet['diameter'] * 625); $kristallmond = round($targetPlanet['diameter'] * 625); // Berechnung Appollonium $zuwert = mt_rand(100, 300); $appolonium = round($targetPlanet['diameter'] * $zuwert); // Trümmerfeld go's Galaxy $QryUpdateGalaxy = "UPDATE {{table}} SET "; $QryUpdateGalaxy .= "`metal` = `metal` + '" . $metallmond . "', "; $QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $kristallmond . "', "; $QryUpdateGalaxy .= "`appolonium` = `appolonium` + '" . $appolonium . "' "; $QryUpdateGalaxy .= "WHERE "; $QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; $QryUpdateGalaxy .= "LIMIT 1;"; doquery($QryUpdateGalaxy, 'galaxy'); //maintenant on va verifier si la vue du joueur n est pas calee sur la lune qui est detruite if ($targetUser['current_planet'] == $targetPlanet['id']) { $QryPlanet = "SELECT * FROM {{table}} "; $QryPlanet .= "WHERE "; $QryPlanet .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryPlanet .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryPlanet .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND "; $QryPlanet .= "`planet_type` = '1';"; $Planet = doquery($QryPlanet, 'planets', true); $IDPlanet = $Planet['id']; $Qryvue = "UPDATE {{table}} SET "; $Qryvue .= "`current_planet` = '" . $IDPlanet . "' "; $Qryvue .= "WHERE "; $Qryvue .= "`id` = '" . $targetUserID . "' "; $Qryvue .= ";"; doquery($Qryvue, 'users'); } $destext .= sprintf($lang['sys_destruc_mess'], $DepName, $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']) . "<br />"; $destext .= sprintf($lang['sys_destruc_lune'], $chance) . "<br />"; $destext .= $lang['sys_debris'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . ($result['debree']['att'][0] + $result['debree']['def'][0] + $metallmond) . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . ($result['debree']['att'][1] + $result['debree']['def'][1] + $kristallmond) . "</font>" . $lang['Appolonium'] . ":<font color=\"#40e0d0\">" . ($result['debree']['att'][2] + $result['debree']['def'][2] + $appolonium) . "</font><br />"; $destext .= $lang['sys_destruc_mess1'] . "<br />"; $destext .= $lang['sys_destruc_reussi'] . "<br />"; $destructionrip = sqrt($targetPlanet['diameter']) / 2; $chance2 = round($destructionrip); $tirage2 = mt_rand(0, 100); $destext .= sprintf($lang['sys_destruc_rip'], $chance2) . "<br />"; if ($tirage2 <= $chance2) { //Rips gehen in das Tf $tftsmet = 0; $tftscrist = 0; if ($attackFleets[$FleetRow['fleet_id']]['detail'][218] > 0 and $attackFleets[$FleetRow['fleet_id']]['detail'][214] = 0) { $tftsmet = round($attackFleets[$FleetRow['fleet_id']]['detail'][218] * $pricelist['218']['metal']) * ($game_config['Fleet_Cdr'] / 100); $tftscrist = round($attackFleets[$FleetRow['fleet_id']]['detail'][218] * $pricelist['218']['crystal']) * ($game_config['Fleet_Cdr'] / 100); $tftsappo = round($attackFleets[$FleetRow['fleet_id']]['detail'][218] * $pricelist['218']['appolonium']) * ($game_config['Fleet_Cdr'] / 100); } else { $tftsmet = round($attackFleets[$FleetRow['fleet_id']]['detail'][214] * $pricelist['214']['metal']) * ($game_config['Fleet_Cdr'] / 100); $tftscrist = round($attackFleets[$FleetRow['fleet_id']]['detail'][214] * $pricelist['214']['crystal']) * ($game_config['Fleet_Cdr'] / 100); } // Trümmerfeld go's Galaxy $QryUpdateGalaxy = "UPDATE {{table}} SET "; $QryUpdateGalaxy .= "`metal` = `metal` +'" . $tftsmet . "', "; $QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $tftscrist . "', "; $QryUpdateGalaxy .= "`appolonium` = `appolonium` + '" . $tftsappo . "' "; $QryUpdateGalaxy .= "WHERE "; $QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; $QryUpdateGalaxy .= "LIMIT 1;"; doquery($QryUpdateGalaxy, 'galaxy'); //Rips in das Tf Ende $destext .= $lang['sys_destruc_echec'] . " <br />"; $destext .= $lang['sys_debris'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . ($result['debree']['att'][0] + $result['debree']['def'][0] + $tftsmet) . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . ($result['debree']['att'][1] + $result['debree']['def'][1] + $tftscrist) . "</font>" . $lang['Appolonium'] . ":<font color=\"#40e0d0\">" . ($result['debree']['att'][2] + $result['debree']['def'][2] + $tftsappo) . "</font><br />"; doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets'); } // Falls Mondzerstörung Abgeblockt wird } else { $destructionrip = sqrt($targetPlanet['diameter']) / 2; $chance2 = round($destructionrip); $tirage2 = mt_rand(0, 100); $destext .= sprintf($lang['sys_destruc_mess'], $DepName, $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']) . "<br />"; $destext .= $lang['sys_destruc_mess1'] . "<br />"; $destext .= sprintf($lang['sys_destruc_lune'], $chance) . "<br />"; $destext .= sprintf($lang['sys_destruc_rip'], $chance2) . "<br />"; if ($tirage2 <= $chance2) { //Rips gehen in das Tf $tftsmet = 0; $tftscrist = 0; if ($attackFleets[$FleetRow['fleet_id']]['detail'][218] > 0 and $attackFleets[$FleetRow['fleet_id']]['detail'][214] = 0) { $tftsmet = round($attackFleets[$FleetRow['fleet_id']]['detail'][218] * $pricelist['218']['metal']) * ($game_config['Fleet_Cdr'] / 100); $tftscrist = round($attackFleets[$FleetRow['fleet_id']]['detail'][218] * $pricelist['218']['crystal']) * ($game_config['Fleet_Cdr'] / 100); $tftsappo = round($attackFleets[$FleetRow['fleet_id']]['detail'][218] * $pricelist['218']['appolonium']) * ($game_config['Fleet_Cdr'] / 100); } else { $tftsmet = round($attackFleets[$FleetRow['fleet_id']]['detail'][214] * $pricelist['214']['metal']) * ($game_config['Fleet_Cdr'] / 100); $tftscrist = round($attackFleets[$FleetRow['fleet_id']]['detail'][214] * $pricelist['214']['crystal']) * ($game_config['Fleet_Cdr'] / 100); } // Trümmerfeld go's Galaxy $QryUpdateGalaxy = "UPDATE {{table}} SET "; $QryUpdateGalaxy .= "`metal` = `metal` +'" . $tftsmet . "', "; $QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $tftscrist . "', "; $QryUpdateGalaxy .= "`appolonium` = `appolonium` + '" . $tftsappo . "' "; $QryUpdateGalaxy .= "WHERE "; $QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; $QryUpdateGalaxy .= "LIMIT 1;"; doquery($QryUpdateGalaxy, 'galaxy'); //Rips in das Tf Ende $destext .= $lang['sys_destruc_echec'] . " <br />"; $destext .= $lang['sys_debris'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . ($result['debree']['att'][0] + $result['debree']['def'][0] + $tftsmet) . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . ($result['debree']['att'][1] + $result['debree']['def'][1] + $tftscrist) . "</font>" . $lang['Appolonium'] . ":<font color=\"#ef51ef\">" . ($result['debree']['att'][2] + $result['debree']['def'][2] + $tftsappo) . "</font><br />"; doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets'); } else { $destext .= $lang['sys_destruc_stop'] . "<br />"; } } break; case "r": $destext .= sprintf($lang['sys_destruc_mess'], $DepName, $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']) . "<br />"; $destext .= $lang['sys_destruc_stop'] . "<br />"; doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets'); break; case "w": $destext .= sprintf($lang['sys_destruc_mess'], $DepName, $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet'], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']) . "<br />"; $destext .= $lang['sys_destruc_stop'] . "<br />"; break; default: break; } //Ende Mondzerstörung $strunitsgesamt = $result['lost']['att'] + $result['lost']['def']; $user1lostunits = $result['lost']['att']; $user1shotunits = $result['lost']['def']; $user2lostunits = $result['lost']['def']; $user2shotunits = $result['lost']['att']; $strtruemmerfeld = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1] + $result['debree']['att'][2] + $result['debree']['def'][2]; $strtruemmermetal = $result['debree']['att'][0] + $result['debree']['def'][0]; $strtruemmercrystal = $result['debree']['att'][1] + $result['debree']['def'][1]; $strtruemmerappolonium = $result['debree']['att'][2] + $result['debree']['def'][2]; $FleetDebris = $result['debree']['att'][0] + $result['debree']['def'][0] + $result['debree']['att'][1] + $result['debree']['def'][1] + $result['debree']['att'][2] + $result['debree']['def'][2]; $StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $result['lost']['att']); $StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $result['lost']['def']); $StrRuins = sprintf($lang['sys_gcdrunits'], $result['debree']['def'][0] + $result['debree']['att'][0], $lang['Metal'], $result['debree']['def'][1] + $result['debree']['att'][1], $lang['Crystal'], $result['debree']['def'][2] + $result['debree']['att'][2], $lang['Appolonium']); $DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins; // Monderstellung $MoonChance = $FleetDebris / 100000; if ($FleetDebris > 2000000) { $MoonChance = 20; } if ($FleetDebris < 100000) { $UserChance = 0; $ChanceMoon = ""; } elseif ($FleetDebris >= 100000) { $UserChance = mt_rand(1, 100); $ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance); } // Mond ja if ($UserChance > 0 && $UserChance <= $MoonChance && $targetGalaxy['id_luna'] == 0) { $TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance); $GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); $GottenMoon .= "<br />"; //Warum gibt es ein Trümmerfeld wenn der Mond doch daraus ensteht??? //Abfrage der Größe des Trümmerfeldes? $QrySelectGalaxy = "SELECT * FROM {{table}} "; $QrySelectGalaxy .= "WHERE "; $QrySelectGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QrySelectGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QrySelectGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; $QrySelectGalaxy .= "LIMIT 1;"; $TargetGalaxy = doquery($QrySelectGalaxy, 'galaxy', true); // Trümmerfeld wird gelöscht da der Mond aus den Trümmern entstanden ist!. $QryUpdateGalaxy = "UPDATE {{table}} SET "; $QryUpdateGalaxy .= "`metal` = `metal` - '" . $TargetGalaxy["metal"] . "', "; $QryUpdateGalaxy .= "`crystal` = `crystal` - '" . $TargetGalaxy["crystal"] . "', "; $QryUpdateGalaxy .= "`appolonium` = `appolonium` - '" . $TargetGalaxy["appolonium"] . "' "; $QryUpdateGalaxy .= "WHERE "; $QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; $QryUpdateGalaxy .= "LIMIT 1;"; doquery($QryUpdateGalaxy, 'galaxy'); // Mond nein } elseif ($UserChance = 0 or $UserChance > $MoonChance) { $GottenMoon = ""; } $OwnedUser = doquery('SELECT * FROM {{table}} WHERE id=' . $FleetRow['fleet_owner'], 'users', true); $formatted_cr = formatCRM($result, $steal, $MoonChance, $GottenMoon, $totaltime, $destext); $raport = $formatted_cr['html']; $rid = md5($raport); $QryInsertRapport = 'INSERT INTO {{table}} SET '; $QryInsertRapport .= '`time` = UNIX_TIMESTAMP(), '; foreach ($attackFleets as $fleetID => $attacker) { $users2[$attacker['user']['id']] = $attacker['user']['id']; } foreach ($defense as $fleetID => $defender) { $users2[$defender['user']['id']] = $defender['user']['id']; } $QryInsertRapport .= '`owners` = "' . implode(',', $users2) . '", '; $QryInsertRapport .= '`rid` = "' . $rid . '", '; $QryInsertRapport .= '`raport` = "' . mysql_real_escape_string($raport) . '"'; doquery($QryInsertRapport, 'rw') or die("Error inserting CR to database" . mysql_error() . "<br /><br />Trying to execute:" . mysql_query()); $angreifer = $formatted_cr['angreifer']; $dpath = !$user["dpath"] ? DEFAULT_SKINPATH : $user["dpath"]; $rid = md5($raport); $QryInserttopkb = "INSERT INTO {{table}} SET "; $QryInserttopkb .= "`time` = UNIX_TIMESTAMP(), "; $QryInserttopkb .= "`id_owner1` = '" . $FleetRow['fleet_owner'] . "', "; $QryInserttopkb .= "`angreifer` = '" . $angreifer . "', "; $QryInserttopkb .= "`id_owner2` = '" . $targetUser['id'] . "', "; $QryInserttopkb .= "`defender` = '" . $targetUser['username'] . "', "; $QryInserttopkb .= "`gesamtunits` = '" . $strunitsgesamt . "', "; $QryInserttopkb .= "`gesamttruemmer` = '" . $strtruemmerfeld . "', "; $QryInserttopkb .= "`rid` = '" . $rid . "', "; $QryInserttopkb .= "`a_zestrzelona` = '" . $a_zestrzelona . "', "; $QryInserttopkb .= "`raport` = '" . mysql_real_escape_string($raport) . "',"; $QryInserttopkb .= "`fleetresult` = '" . $result['won'] . "';"; doquery("LOCK TABLE {{table}} WRITE", 'topkb'); doquery($QryInserttopkb, 'topkb'); doquery("UNLOCK TABLES", ''); $user1stat = $FleetRow['fleet_owner']; $user2stat = $TargetUserID; $raport = '<a href # OnClick=\'f( "rw.php?raport=' . $rid . '", "");\' >'; $raport .= '<center>'; if ($result['won'] == "a") { $raport .= '<font color=\'green\'>'; } elseif ($result['won'] == "w") { $raport .= '<font color=\'orange\'>'; } elseif ($result['won'] == "r") { $raport .= '<font color=\'red\'>'; } $raport .= $lang['sys_mess_destruc_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "] </font></a><br /><br />"; $raport .= "<font color=\"red\">" . $lang['sys_perte_attaquant'] . ": " . $result['lost']['att'] . "</font>"; $raport .= "<font color=\"green\"> " . $lang['sys_perte_defenseur'] . ": " . $result['lost']['def'] . "</font><br />"; $raport .= $lang['sys_debris'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . ($result['debree']['att'][0] + $result['debree']['def'][0] + $metallmond) . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . ($result['debree']['att'][1] + $result['debree']['def'][1] + $kristallmond) . "</font>" . $lang['Appolonium'] . ":<font color=\"#40e0d0\">" . ($result['debree']['att'][2] + $result['debree']['def'][2] + $appolonium) . "</font><br />"; SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_destruc_report'], $raport); $raport2 = "<a href # OnClick=\"f( 'rw.php?raport=" . $rid . "', '');\" >"; $raport2 .= "<center>"; if ($result['won'] == "a") { $raport2 .= '<font color=\'red\'>'; } elseif ($result['won'] == "w") { $raport2 .= '<font color=\'orange\'>'; } elseif ($result['won'] == "r") { $raport2 .= '<font color=\'green\'>'; } $raport2 .= $lang['sys_mess_destruc_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "] </font></a><br /><br />"; foreach ($users2 as $id) { if ($id != $FleetRow['fleet_owner'] && $id != 0) { SendSimpleMessage($id, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport2); } } $user1 = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $user1stat . "';", 'users'); while ($user1data = mysql_fetch_assoc($user1)) { $strtruemmermetaluser1 = $strtruemmermetal + $user1data['kbmetal']; $strtruemmercrystaluser1 = $strtruemmercrystal + $user1data['kbcrystal']; $strtruemmerappoloniumuser1 = $strtruemmerappolonium + $user1data['kbappolonium']; $user1lostunits = $user1lostunits + $user1data['lostunits']; $user1shotunits = $user1shotunits + $user1data['desunits']; $user1wons = $user1data['wons']; $user1loos = $user1data['loos']; $user1draws = $user1data['draws']; } $user2 = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $user2stat . "';", 'users'); while ($user2data = mysql_fetch_assoc($user2)) { $strtruemmermetaluser2 = $strtruemmermetal + $user2data['kbmetal']; $strtruemmercrystaluser2 = $strtruemmercrystal + $user2data['kbcrystal']; $strtruemmerappoloniumuser2 = $strtruemmerappolonium + $user2data['kbappolonium']; $user2lostunits = $user2lostunits + $user2data['lostunits']; $user2shotunits = $user2shotunits + $user2data['desunits']; $user2wons = $user2data['wons']; $user2loos = $user2data['loos']; $user2draws = $user2data['draws']; } if ($result['won'] == "a") { $user1wons = $user1wons + 1; $user2loos = $user2loos + 1; } elseif ($result['won'] == "w") { $user1draws = $user1draws + 1; $user2draws = $user2draws + 1; } elseif ($result['won'] == "r") { $user1loos = $user1loos + 1; $user2wons = $user2wons + 1; } $QryUpdateuserstat = "UPDATE {{table}} SET "; $QryUpdateuserstat .= "`wons` = '" . $user1wons . "', "; $QryUpdateuserstat .= "`loos` = '" . $user1loos . "', "; $QryUpdateuserstat .= "`draws` = '" . $user1draws . "', "; $QryUpdateuserstat .= "`kbmetal` = '" . $strtruemmermetaluser1 . "', "; $QryUpdateuserstat .= "`kbcrystal` = '" . $strtruemmercrystaluser1 . "', "; $QryUpdateuserstat .= "`kbappolonium` = '" . $strtruemmerappoloniumuser1 . "', "; $QryUpdateuserstat .= "`lostunits` = '" . $user1lostunits . "', "; $QryUpdateuserstat .= "`desunits` = '" . $user1shotunits . "' "; $QryUpdateuserstat .= "WHERE "; $QryUpdateuserstat .= "`id` = '" . $FleetRow['fleet_owner'] . "';"; doquery($QryUpdateuserstat, 'users'); $QryUpdateuser2stat = "UPDATE {{table}} SET "; $QryUpdateuser2stat .= "`wons` = '" . $user2wons . "', "; $QryUpdateuser2stat .= "`loos` = '" . $user2loos . "', "; $QryUpdateuser2stat .= "`draws` = '" . $user2draws . "', "; $QryUpdateuser2stat .= "`kbmetal` = '" . $strtruemmermetaluser2 . "', "; $QryUpdateuser2stat .= "`kbcrystal` = '" . $strtruemmercrystaluser2 . "', "; $QryUpdateuser2stat .= "`kbappolonium` = '" . $strtruemmerappoloniumuser2 . "', "; $QryUpdateuser2stat .= "`lostunits` = '" . $user2lostunits . "', "; $QryUpdateuser2stat .= "`desunits` = '" . $user2shotunits . "' "; $QryUpdateuser2stat .= "WHERE "; $QryUpdateuser2stat .= "`id` = '" . $targetUser['id'] . "';"; doquery($QryUpdateuser2stat, 'users'); $CurrentUser = doquery("SELECT * FROM {{table}} WHERE id = " . $FleetRow['fleet_owner'], 'users', true); $CurrentUserID = $CurrentUser['id']; $AddPoint = $CurrentUser['xpraid'] + 1; $QryUpdateOfficier = "UPDATE {{table}} SET "; $QryUpdateOfficier .= "`xpraid` = '" . $AddPoint . "' "; $QryUpdateOfficier .= "WHERE id = '" . $CurrentUserID . "' "; $QryUpdateOfficier .= "LIMIT 1 ;"; doquery($QryUpdateOfficier, 'users'); $RaidsTotal = $CurrentUser['raids'] + 1; if ($result['won'] == "a") { $RaidsWin = $CurrentUser['raidswin'] + 1; $QryUpdateRaidsCompteur = "UPDATE {{table}} SET "; $QryUpdateRaidsCompteur .= "`raidswin` ='" . $RaidsWin . "', "; $QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' "; $QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' "; $QryUpdateRaidsCompteur .= "LIMIT 1 ;"; doquery($QryUpdateRaidsCompteur, 'users'); } elseif ($result['won'] == "r" || $result['won'] == "w") { $RaidsLoose = $CurrentUser['raidsloose'] + 1; $QryUpdateRaidsCompteur = "UPDATE {{table}} SET "; $QryUpdateRaidsCompteur .= "`raidsloose` ='" . $RaidsLoose . "', "; $QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' "; $QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' "; $QryUpdateRaidsCompteur .= "LIMIT 1 ;"; doquery($QryUpdateRaidsCompteur, 'users'); } } elseif ($FleetRow['fleet_end_time'] <= time()) { $Message = sprintf($lang['sys_tran_mess_angriffback'], $TargetName, GetTargetAdressLink($FleetRow, ''), pretty_number($FleetRow['fleet_resource_metal']), $lang['Metal'], pretty_number($FleetRow['fleet_resource_crystal']), $lang['Crystal'], pretty_number($FleetRow['fleet_resource_deuterium']), $lang['Deuterium'], pretty_number($FleetRow['fleet_resource_appolonium']), $lang['Appolonium']); SendSimpleMessage($FleetRow['fleet_owner'], '', $FleetRow['fleet_end_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_fleetback'], $Message); RestoreFleetToPlanet($FleetRow); doquery('DELETE FROM {{table}} WHERE `fleet_id`=' . $FleetRow['fleet_id'], 'fleets'); } }
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)) {
} 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']);
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); }
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"]); $parse['creditos'] = pretty_number($CurrentUser["creditos"]); $parse['user_username'] = $CurrentUser['username']; $parse['date_time'] = date("D M j H:i:s", time()); $parse['metal_max'] = pretty_number($CurrentPlanet['metal_max']); $parse['crystal_max'] = pretty_number($CurrentPlanet['crystal_max']); $parse['deuterium_max'] = pretty_number($CurrentPlanet['deuterium_max']); $parse['dearkmatter_max'] = pretty_number($CurrentPlanet['darkmatter_max']); $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['darkmatter_basic_income'] = $game_config['darkmatter_basic_income'] * $game_config['resource_multiplier']; $parse['energy_basic_income'] = $game_config['energy_basic_income'] * $game_config['resource_multiplier']; $parse['user_username'] = $CurrentUser['username']; $TopBar = parsetemplate(gettemplate('topnav'), $parse); return $TopBar; }
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; }
/** * 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> -"; } else { $parse['ADMIN_LINK'] = ""; } $OnlineUsers = doquery("SELECT COUNT(*) FROM {{table}} WHERE onlinetime>='" . (time() - 15 * 60) . "'", 'users', 'true'); if ($CurrentUser['authlevel'] > 0) { $parse['NumberMembersOnline'] = "" . $lang['menu']['900'] . "" . $lang['menu']['501'] . " " . $OnlineUsers[0] . ""; } else { $parse['NumberMembersOnline'] = ""; } $Consulta = mysql_fetch_row(doquery("SELECT COUNT(*) FROM {{table}} ", "messages")); if ($CurrentUser['authlevel'] > 0) { $parse['cantmessa'] = "" . $lang['menu']['502'] . " " . $Consulta[0] . ""; } else { $parse['cantmessa'] = ""; } $Consulta = mysql_fetch_row(doquery("SELECT COUNT(*) FROM {{table}}", "supp")); if ($CurrentUser['authlevel'] > 0) { $parse['cantsupp'] = "" . $lang['menu']['504'] . " " . $Consulta[0] . ""; } else { $parse['cantsupp'] = ""; } $Consulta = mysql_fetch_row(doquery("SELECT COUNT(*) FROM {{table}}", "errors")); if ($CurrentUser['authlevel'] > 0) { $parse['canterror'] = "" . $lang['menu']['505'] . " " . $Consulta[0] . "" . $lang['menu']['901'] . ""; } else { $parse['canterror'] = ""; } if ($game_config['angriffszone'] == 1) { $parse['info_01'] = "" . $lang['menu']['300'] . ""; } else { $parse['info_01'] = "" . $lang['menu']['301'] . ""; } if ($game_config['over'] == 1) { $parse['1be_aa'] = "<a href=\"overview.php\" target=\"_self\"> " . $lang['menu']['101'] . "</a>"; } else { $parse['1be_aa'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['gala'] == 1) { $parse['1be_ab'] = "<a href=\"galaxy.php?mode=0\" target=\"_self\"> " . $lang['menu']['102'] . "</a>"; } else { $parse['1be_ab'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['fleet'] == 1) { $parse['1be_ac'] = "<a href=\"fleet.php\" target=\"_self\"> " . $lang['menu']['103'] . "</a>"; } else { $parse['1be_ac'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['mess'] == 1) { $parse['1be_ad'] = "<a href=\"messages.php\" target=\"_self\"> " . $lang['menu']['104'] . "</a>"; } else { $parse['1be_ad'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['gebau'] == 1) { $parse['2be_aa'] = "<a href=\"buildings.php\" target=\"_self\"> " . $lang['menu']['105'] . "</a>"; } else { $parse['2be_aa'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['forsch'] == 1) { $parse['2be_ab'] = "<a href=\"buildings.php?mode=research\" target=\"_self\"> " . $lang['menu']['106'] . "</a>"; } else { $parse['2be_ab'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['armada'] == 1) { $parse['2be_ac'] = "<a href=\"buildings.php?mode=fleet\" target=\"_self\"> " . $lang['menu']['107'] . "</a>"; } else { $parse['2be_ac'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['abwehr'] == 1) { $parse['2be_ad'] = "<a href=\"buildings.php?mode=defense\" target=\"_self\"> " . $lang['menu']['108'] . "</a>"; } else { $parse['2be_ad'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['officier'] == 1) { $parse['3be_aa'] = "<a href=\"officier.php\" target=\"_self\"> " . $lang['menu']['109'] . "</a>"; } else { $parse['3be_aa'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['marchand'] == 1) { $parse['3be_ab'] = "<a href=\"marchand.php\" target=\"_self\"> " . $lang['menu']['110'] . "</a>"; } else { $parse['3be_ab'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['annonce'] == 1) { $parse['3be_ac'] = "<a href=\"annonce.php\" target=\"_self\"> " . $lang['menu']['111'] . "</a>"; } else { $parse['3be_ac'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['schrotti'] == 1) { $parse['3be_ad'] = "<a href=\"schrotti.php\" target=\"_self\"> " . $lang['menu']['112'] . "</a>"; } else { $parse['3be_ad'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['imperium'] == 1) { $parse['4be_aa'] = "<a href=\"imperium.php\" target=\"_self\"> " . $lang['menu']['113'] . "</a>"; } else { $parse['4be_aa'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['alliance'] == 1) { $parse['4be_ab'] = "<a href=\"alliance.php\" target=\"_self\"> " . $lang['menu']['114'] . "</a>"; } else { $parse['4be_ab'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['resources'] == 1) { $parse['4be_ac'] = "<a href=\"resources.php\" target=\"_self\"> " . $lang['menu']['115'] . "</a>"; } else { $parse['4be_ac'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['techtree'] == 1) { $parse['4be_ad'] = "<a href=\"techtree.php\" target=\"_self\"> " . $lang['menu']['116'] . "</a>"; } else { $parse['4be_ad'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['reco'] == 1) { $parse['1be_ba'] = "<a href=\"records.php\" target=\"_self\"> " . $lang['menu']['201'] . "</a>"; } else { $parse['1be_ba'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['stat'] == 1) { $parse['1be_bb'] = "<a href=\"game.php?page=stat\" target=\"_self\"> " . $lang['menu']['202'] . "</a>"; } else { $parse['1be_bb'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['topk'] == 1) { $parse['1be_bc'] = "<a href=\"game.php?page=ruhm\" target=\"_self\"> " . $lang['menu']['203'] . "</a>"; } else { $parse['1be_bc'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['simu'] == 1) { $parse['1be_bd'] = "<a href=\"simulator.php\" target=\"_self\"> " . $lang['menu']['204'] . "</a>"; } else { $parse['1be_bd'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['note'] == 1) { $parse['2be_ba'] = "<a href=\"notes.php\" target=\"_self\"> " . $lang['menu']['205'] . "</a>"; } else { $parse['2be_ba'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['budd'] == 1) { $parse['2be_bb'] = "<a href=\"buddy.php\" target=\"_self\"> " . $lang['menu']['206'] . "</a>"; } else { $parse['2be_bb'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['chat'] == 1) { $parse['2be_bc'] = "<a href=\"chat.php\" target=\"_self\"> " . $lang['menu']['207'] . "</a>"; } else { $parse['2be_bc'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['sear'] == 1) { $parse['2be_bd'] = "<a href=\"search.php\" target=\"_self\"> " . $lang['menu']['208'] . "</a>"; } else { $parse['2be_bd'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['decl'] == 1) { $parse['3be_ba'] = "<a href=\"add_declare.php\" target=\"_self\"> " . $lang['menu']['209'] . "</a>"; } else { $parse['3be_ba'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['rule'] == 1) { $parse['3be_bb'] = "<a href=\"rules.html\" target=\"_self\"> " . $lang['menu']['210'] . "</a>"; } else { $parse['3be_bb'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['conn'] == 1) { $parse['3be_bc'] = "<a href=\"contact.php\" target=\"_self\"> " . $lang['menu']['211'] . "</a>"; } else { $parse['3be_bc'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['supp'] == 1) { $parse['3be_bd'] = "<a href=\"support.php\" target=\"_self\"> " . $lang['menu']['212'] . "</a>"; } else { $parse['3be_bd'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['bann'] == 1) { $parse['4be_ba'] = "<a href=\"banned.php\" target=\"_self\"> " . $lang['menu']['213'] . "</a>"; } else { $parse['4be_ba'] = " <u>" . $lang['menu']['500'] . "</u>"; } if ($game_config['opti'] == 1) { $parse['4be_bb'] = "<a href=\"options.php\" target=\"_self\"> " . $lang['menu']['214'] . "</a>"; } else { $parse['4be_bb'] = " <u>" . $lang['menu']['500'] . "</u>"; } $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=\"?cp=" . $CurPlanet['id'] . ""; $parse['planetlist'] .= "&mode=" . $_GET['mode']; $parse['planetlist'] .= "&re=0\">"; $parse['planetlist'] .= " [" . $CurPlanet['galaxy'] . ":"; $parse['planetlist'] .= "" . $CurPlanet['system'] . ":"; $parse['planetlist'] .= "" . $CurPlanet['planet']; $parse['planetlist'] .= "] </option>"; } } $parse['planet_name'] = "" . $CurrentPlanet['name']; $energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]); if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) { $parse['energy'] = colorRed($energy); } else { $parse['energy'] = $energy; } $metal = pretty_number($CurrentPlanet["metal"]); if ($CurrentPlanet["metal"] > $CurrentPlanet["metal_max"]) { $parse['metal'] = colorRed($metal); } else { $parse['metal'] = $metal; } $crystal = pretty_number($CurrentPlanet["crystal"]); if ($CurrentPlanet["crystal"] > $CurrentPlanet["crystal_max"]) { $parse['crystal'] = colorRed($crystal); } else { $parse['crystal'] = $crystal; } $deuterium = pretty_number($CurrentPlanet["deuterium"]); if ($CurrentPlanet["deuterium"] > $CurrentPlanet["deuterium_max"]) { $parse['deuterium'] = colorRed($deuterium); } else { $parse['deuterium'] = $deuterium; } $appolonium = pretty_number($CurrentPlanet["appolonium"]); if ($CurrentPlanet["appolonium"] > $CurrentPlanet["appolonium_max"]) { $parse['appolonium'] = colorRed($appolonium); } else { $parse['appolonium'] = $appolonium; } $energy_max = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet['energy_max'] / 100 * $CurrentUser['energy_tech']); 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'] + $CurrentPlanet['energy_max'] / 100 * $CurrentUser['energy_tech']))); 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"]) . " {$lang['']}</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"]) . " {$lang['']}</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"]) . " {$lang['']}</font>"; if ($CurrentPlanet["appolonium_max"] < $CurrentPlanet["appolonium"]) { $parse['appolonium_max'] = '<font color="#ff0000">'; } else { $parse['appolonium_max'] = '<font color="#00ff00">'; } $parse['appolonium_max'] .= pretty_number($CurrentPlanet["appolonium_max"]) . " {$lang['']}</font>"; $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['appolonium_perhour'] .= $CurrentPlanet["appolonium_perhour"] + $game_config['appolonium_basic_income'] * $game_config['resource_multiplier']; $parse['metalh'] .= round($CurrentPlanet["metal"]); $parse['crystalh'] .= round($CurrentPlanet["crystal"]); $parse['deuteriumh'] .= round($CurrentPlanet["deuterium"]); $parse['appoloniumh'] .= round($CurrentPlanet["appolonium"]); $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['appolonium_mmax'] .= $CurrentPlanet["appolonium_max"] * MAX_OVERFLOW; if ($CurrentUser['new_message'] > 0) { $parse['message'] = "<a href=\"messages.php\"><img src=\"./images/info.gif\" style=\"height:33px; width:33px;\" alt=\"info.gif\"/></a>"; } else { $parse['message'] = ""; } $TopBar = parsetemplate($NavigationTPL, $parse); } else { $TopBar = ""; } return $TopBar; }
/** * 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 { $parse['metal_max'] = '<font color="#00ff00">'; } $parse['metal_max'] .= pretty_number($CurrentPlanet["metal_max"] / 1) . " {$lang['']}</font>"; // Cristal maximo 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"] / 1) . " {$lang['']}"; // Deuterio maximo 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"] / 1) . " {$lang['']}"; $parse['metal_perhour'] .= $CurrentPlanet["metal_perhour"]; $parse['crystal_perhour'] .= $CurrentPlanet["crystal_perhour"]; $parse['deuterium_perhour'] .= $CurrentPlanet["deuterium_perhour"]; $parse['metalh'] .= round($CurrentPlanet["metal"]); $parse['crystalh'] .= round($CurrentPlanet["crystal"]); $parse['deuteriumh'] .= round($CurrentPlanet["deuterium"]); $parse['metal_mmax'] .= $CurrentPlanet["metal_max"]; $parse['crystal_mmax'] .= $CurrentPlanet["crystal_max"]; $parse['deuterium_mmax'] .= $CurrentPlanet["deuterium_max"]; // Message if ($CurrentUser['new_message'] > 0) { $parse['message'] = "<a href=\"messages.php\"><blink>[ " . $CurrentUser['new_message'] . " ]</blink></a>"; } else { $parse['message'] = "0"; } // Le tout passe dans la template $TopBar = parsetemplate($NavigationTPL, $parse); } else { $TopBar = ""; } return $TopBar; }
/** * 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 { $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])); $bloc['build_prod_diff'] = colorNumber(pretty_number(floor($Prod[$BuildID] - $ActualProd))); $bloc['build_need'] = colorNumber(pretty_number(floor($Prod[11]))); $EnergyNeed = colorNumber(pretty_number(floor($Prod[11] - $ActualNeed))); } else { $bloc['build_prod'] = pretty_number(floor($Prod[11])); $bloc['build_prod_diff'] = colorNumber(pretty_number(floor($Prod[11] - $ActualProd))); $bloc['build_need'] = colorNumber(pretty_number(floor($Prod[3]))); $EnergyNeed = colorNumber(pretty_number(floor($Prod[3] - $ActualNeed))); } if ($Element >= 1 && $Element <= 4) { $parse['build_need_diff'] = "(" . "<font color=#FF0000>" . $EnergyNeed . " " . $lang['Energy'] . "</font>" . ")"; $BuildLevel = 0; } elseif ($Element == 11 || $Element == 12) { $parse['build_need_diff'] = "(" . "<font color=#00FF00>+" . $EnergyNeed . " " . $lang['Energy'] . "</font>" . ")"; $BuildLevel = 0; } //================================ if ($Element == 31) { // Spécial Laboratoire if ($CurrentUser['b_tech_planet'] != 0 && $game_config['BuildLabWhileRun'] != 1) { // Variable qui contient le parametre // On verifie si on a le droit d'evoluer pendant les recherches (Setting dans config) $parse['click'] = "<font color=#FF0000>" . $lang['in_working'] . "</font>"; } } if ($Element == 15) { // Spezialgebäude Nanitenfabrik if ($CurrentPlanet['robot_factory'] <= 9) { // On verifie si on a le droit d'evoluer pendant les recherches (Setting dans config) $parse['click'] = "<font color=#FF0000>" . $lang['no Nani'] . "</font>"; } } if ($Element == 45) { // Spezialgebäude Mondtransformer if ($CurrentPlanet['mondtransformer'] == 1) { // Es darf nur ein Mondtransformer pro Planet gebaut werden $parse['click'] = "<font color=#FF0000>" . $lang['only_one_mondtransformer'] . "</font>"; } } if ($parse['click'] != '') { // Bin on ne fait rien, vu que l'on l'a deja fait au dessus !! } 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>"; } else { $parse['click'] = "<font color=#FF0000>" . $lang['BuildNextLevel'] . " " . $NextBuildLevel . "</font>"; } } else { $parse['click'] = "<font color=#FF0000>" . $lang['NoMoreSpace'] . "</font>"; } if ($zaehler % 3 == 0) { $parse['trclose'] = '</tr>'; $zaehler++; } else { $parse['trclose'] = ''; $zaehler++; } $BuildingPage .= parsetemplate($SubTemplate, $parse); } } } $parse = $lang; // Faut il afficher la liste de construction ?? if ($Queue['lenght'] > 0) { $parse['BuildListScript'] = InsertBuildListScript("buildings"); $parse['BuildList'] = $Queue['buildlist']; } else { $parse['BuildListScript'] = ""; $parse['BuildList'] = ""; } $parse['planet_field_current'] = $CurrentPlanet['field_current']; $parse['planet_field_max'] = $CurrentPlanet['field_max']; $parse['field_libre'] = $parse['planet_field_max'] - $CurrentPlanet['field_current']; $parse['BuildingsList'] = $BuildingPage; $page .= parsetemplate(gettemplate('buildings_builds'), $parse); display($page, $lang['Builds']); }
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'; } else { $parse['metal_storage_barcolor'] = '#00CC00'; } if ($parse['crystal_storage_bar'] >= 100 * 0.7) { $parse['crystal_storage_bar'] = 70; $parse['crystal_storage'] = "100%"; $parse['crystal_storage_barcolor'] = '#FF0000'; } elseif ($parse['crystal_storage_bar'] > 100 * 0.63) { $parse['crystal_storage_barcolor'] = '#FFCC00'; } else { $parse['crystal_storage_barcolor'] = '#00CC00'; } if ($parse['deuterium_storage_bar'] >= 100 * 0.7) { $parse['deuterium_storage_bar'] = 70; $parse['deuterium_storage'] = "100%"; $parse['deuterium_storage_barcolor'] = '#FF0000'; } elseif ($parse['deuterium_storage_bar'] > 100 * 0.63) { $parse['deuterium_storage_barcolor'] = '#FFCC00'; } else { $parse['deuterium_storage_barcolor'] = '#00CC00'; } if ($parse['energy_storage_bar'] >= 100 * 0.7) { $parse['energy_storage_bar'] = 70; $parse['energy_storage_barcolor'] = '#00CC00'; } elseif ($parse['energy_storage_bar'] < 0) { $parse['energy_storage_bar'] = floor(($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) / (1 + $CurrentPlanet['energy_max']) * 100 * 0.7); $parse['energy_storage'] = floor(($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) / (1 + $CurrentPlanet['energy_max']) * 100) . "%"; $parse['energy_storage_barcolor'] = '#FF0000'; } else { $parse['energy_storage_barcolor'] = '#00CC00'; } if ($user["new_message"] != 0) { $color = "color=\"red\""; } else { $color = "color=\"white\""; } $parse["new_message"] = '<font size="1px" ' . $color . ' > ' . $user["new_message"] . ' </font>'; $funcionespia = doquery("SELECT * FROM `{{table}}` WHERE `galaxia` = " . $CurrentUser['galaxy'] . " AND `sistema` = " . $CurrentUser['system'] . " AND `planeta` = " . $CurrentPlanet['planet'] . ";", 'radar'); $respy = mysql_num_rows($funcionespia); if ($respy) { for ($i = 0; $i < $respy; $i++) { $lineaspy = mysql_fetch_array($funcionespia); $codealert = $lineaspy['id']; if ($lineaspy['alert'] == 1) { $alertred = 1; } elseif ($lineaspy['alert'] == 2) { $alertorange = 1; } else { $alertgreen = 1; } } } $actionled = $_GET['actionled']; if ($actionled == '1') { doquery("DELETE FROM {{table}} WHERE `id`={$codealert};", "radar"); message('Alert Deleted!', 'game.php?page=overview', 2); } if ($alertred == 1) { $parse['alertled'] = "<br><a href='game.php?page=overview&actionled=1' border='0'><img src='styles/images/red.gif' style='float:center; margin-right:2px;'></a>"; } elseif ($alertorange == 1) { $parse['alertled'] = "<br><a href='game.php?page=overview&actionled=1' border='0'><img src='styles/images/yellow.gif' style='float:center; margin-right:2px;'></a>"; } else { $parse['alertled'] = "<br><img src='styles/images/green.gif' style='float:center; margin-right:2px;'>"; } if ($CurrentUser['rpg_geologue'] > 0) { $parse['geologo'] = "geologo.gif"; } else { $parse['geologo'] = "geologo_un.gif"; } if ($CurrentUser['rpg_amiral'] > 0) { $parse['admirante'] = "admirante.gif"; } else { $parse['admirante'] = "admirante_un.gif"; } if ($CurrentUser['rpg_commandant'] > 0) { $parse['comandante'] = "comandante.gif"; } else { $parse['comandante'] = "comandante_un.gif"; } if ($CurrentUser['rpg_ingenieur'] > 0) { $parse['ingeniero'] = "ingeniero.gif"; } else { $parse['ingeniero'] = "ingeniero_un.gif"; } if ($CurrentUser['rpg_technocrate'] > 0) { $parse['tecnocrata'] = "tecnocrata.gif"; } else { $parse['tecnocrata'] = "tecnocrata_un.gif"; } if ($CurrentUser['rpg_constructeur'] > 0) { $parse['constructeur'] = "constructeur.gif"; } else { $parse['constructeur'] = "constructeur_un.gif"; } if ($CurrentUser['rpg_scientifique'] > 0) { $parse['scientifique'] = "scientifique.gif"; } else { $parse['scientifique'] = "scientifique_un.gif"; } if ($CurrentUser['rpg_stockeur'] > 0) { $parse['stockeur'] = "stockeur.gif"; } else { $parse['stockeur'] = "stockeur_un.gif"; } if ($CurrentUser['rpg_defenseur'] > 0) { $parse['defenseur'] = "defenseur.gif"; } else { $parse['defenseur'] = "defenseur_un.gif"; } if ($CurrentUser['rpg_bunker'] > 0) { $parse['bunker'] = "bunker.gif"; } else { $parse['bunker'] = "bunker_un.gif"; } if ($CurrentUser['rpg_espion'] > 0) { $parse['espion'] = "espion.gif"; } else { $parse['espion'] = "espion_un.gif"; } if ($CurrentUser['rpg_destructeur'] > 0) { $parse['destructeur'] = "destructeur.gif"; } else { $parse['destructeur'] = "destructeur_un.gif"; } if ($CurrentUser['rpg_general'] > 0) { $parse['general'] = "general.gif"; } else { $parse['general'] = "general_un.gif"; } if ($CurrentUser['rpg_raideur'] > 0) { $parse['raideur'] = "raideur.gif"; } else { $parse['raideur'] = "raideur_un.gif"; } if ($CurrentUser['rpg_empereur'] > 0) { $parse['empereur'] = "empereur.gif"; } else { $parse['empereur'] = "empereur_un.gif"; } $TopBar = parsetemplate(gettemplate('topnav'), $parse); return $TopBar; }
/** * SetNextQueueElementOnTop.php * * * @version 1.0 * @copyright 2008 by Chlorel for XNova */ function SetNextQueueElementOnTop(&$CurrentPlanet, $CurrentUser) { global $lang, $resource; // Garde fou ... Si le temps de construction n'est pas 0 on ne fait rien !!! PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time()); if ($CurrentPlanet['b_building'] == 0) { $CurrentQueue = $CurrentPlanet['b_building_id']; if ($CurrentQueue != 0) { $QueueArray = explode(";", $CurrentQueue); $Loop = true; while ($Loop == true) { $ListIDArray = explode(",", $QueueArray[0]); $Element = $ListIDArray[0]; $Level = $ListIDArray[1]; $BuildTime = $ListIDArray[2]; $BuildEndTime = $ListIDArray[3]; $BuildMode = $ListIDArray[4]; // pour savoir si on construit ou detruit $HaveNoMoreLevel = false; if ($BuildMode == 'destroy') { $ForDestroy = true; } else { $ForDestroy = false; } $HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy); if ($ForDestroy) { if ($CurrentPlanet[$resource[$Element]] == 0) { $HaveRessources = false; $HaveNoMoreLevel = true; } } if ($HaveRessources == true) { $Needed = GetBuildingPrice($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy); $CurrentPlanet['metal'] -= $Needed['metal']; $CurrentPlanet['crystal'] -= $Needed['crystal']; $CurrentPlanet['deuterium'] -= $Needed['deuterium']; $CurrentPlanet['appolonium'] -= $Needed['appolonium']; $CurrentTime = time(); $BuildEndTime = $BuildEndTime; $NewQueue = implode(";", $QueueArray); if ($NewQueue == "") { $NewQueue = '0'; } $Loop = false; } else { $ElementName = $lang['tech'][$Element]; if ($HaveNoMoreLevel == true) { $Message = sprintf($lang['sys_nomore_level'], $ElementName); } else { $Needed = GetBuildingPrice($CurrentUser, $CurrentPlanet, $Element, true, $ForDestroy); $Message = sprintf($lang['sys_notenough_money'], $ElementName, pretty_number($CurrentPlanet['metal']), $lang['Metal'], pretty_number($CurrentPlanet['crystal']), $lang['Crystal'], pretty_number($CurrentPlanet['deuterium']), $lang['Deuterium'], pretty_number($CurrentPlanet['appolonium']), $lang['Appolonium'], pretty_number($Needed['metal']), $lang['Metal'], pretty_number($Needed['crystal']), $lang['Crystal'], pretty_number($Needed['deuterium']), $lang['Deuterium'], pretty_number($Needed['appolonium']), $lang['Appolonium']); } SendSimpleMessage($CurrentUser['id'], '', '', 99, $lang['sys_buildlist'], $lang['sys_buildlist_fail'], $Message); array_shift($QueueArray); $ActualCount = count($QueueArray); if ($ActualCount == 0) { $BuildEndTime = '0'; $NewQueue = '0'; $Loop = false; } } } // while } else { $BuildEndTime = '0'; $NewQueue = '0'; } // Ecriture de la mise a jour dans la BDD $CurrentPlanet['b_building'] = $BuildEndTime; $CurrentPlanet['b_building_id'] = $NewQueue; $QryUpdatePlanet = "UPDATE {{table}} SET "; $QryUpdatePlanet .= "`metal` = '" . $CurrentPlanet['metal'] . "' , "; $QryUpdatePlanet .= "`crystal` = '" . $CurrentPlanet['crystal'] . "' , "; $QryUpdatePlanet .= "`deuterium` = '" . $CurrentPlanet['deuterium'] . "' , "; $QryUpdatePlanet .= "`appolonium` = '" . $CurrentPlanet['appolonium'] . "' , "; $QryUpdatePlanet .= "`b_building` = '" . $CurrentPlanet['b_building'] . "' , "; $QryUpdatePlanet .= "`b_building_id` = '" . $CurrentPlanet['b_building_id'] . "' "; $QryUpdatePlanet .= "WHERE "; $QryUpdatePlanet .= "`id` = '" . $CurrentPlanet['id'] . "';"; doquery($QryUpdatePlanet, 'planets'); } return; }
protected function Update() { //UpdatePlanet($this->CurrentPlanet, $this->user, time(), true); UpdatePlanetBatimentQueueList($this->CurrentPlanet, $this->user); HandleTechnologieBuild($this->CurrentPlanet, $this->user); PlanetResourceUpdate($this->user, $this->CurrentPlanet, time()); }
function ShowImperiumPage($CurrentUser) { global $lang, $resource, $reslist, $dpath; $lang['imperium_vision'] = 'Visión general del Imperio'; $lang['name'] = 'Planeta'; $lang['coordinates'] = 'Coordenadas'; $lang['fields'] = 'Campos'; $lang['resources'] = 'Recursos'; $lang['buildings'] = 'Edificios'; $lang['investigation'] = 'Investigaciones'; $lang['ships'] = 'Flotas'; $lang['defense'] = 'Defensas'; $parse = $lang; if (isset($_GET['planet_type'])) { if ($_GET['planet_type'] == 1) { $planettype = " AND `planet_type` = '1'"; $parse['select1'] = ' selected'; } elseif ($_GET['planet_type'] == 3) { $planettype = "AND `planet_type` = '3'"; $parse['select3'] = ' selected'; } else { $planettype = ''; $parse['select0'] = ' selected'; } } else { $planettype = ''; $parse['select0'] = ' selected'; } $planetsrow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentUser['id'] . "'{$planettype};", 'planets'); $planet = array(); while ($p = mysql_fetch_array($planetsrow)) { PlanetResourceUpdate($CurrentUser, $p, time()); $planet['sum'] = sumar_array($planet['sum'], $p); $planet[] = $p; } uksort($planet, 'planet_empire_sort'); $parse['mount'] = count($planet) + 3; // primera tabla, con las imagenes y coordenadas $row = gettemplate('empire/imperium_row'); $row2 = gettemplate('empire/imperium_row2'); foreach ($planet as $ID => $p) { if ($ID !== 'sum') { UpdatePlanetBatimentQueueList($p, $CurrentUser); $AllPlanets = ''; if ($p['b_building'] != 0) { $BuildQueue = $p['b_building_id']; $QueueArray = explode(";", $BuildQueue); $CurrentBuild = explode(",", $QueueArray[0]); $BuildElement = $CurrentBuild[0]; $BuildLevel = $CurrentBuild[1]; $BuildRestTime = pretty_time($CurrentBuild[3] - time()); $AllPlanets .= $lang['tech'][$BuildElement] . ' (' . $BuildLevel . ')'; $AllPlanets .= "<br/><font color=\"#7f7f7f\">(" . $BuildRestTime . ")</font>"; } else { CheckPlanetUsedFields($p); $AllPlanets .= "<a href='game.php?page=buildings'>Libre</a>"; } // {file_images} $parse['build'] .= '<th width="75">' . $AllPlanets . '</th>'; $data['text'] = '<a href="game.php?page=overview&cp=' . $p['id'] . '&re=0"><img src="' . $dpath . 'planeten/' . $p['image'] . '.jpg" border="0" height="75" width="75"></a><br/>'; $parse['file_images'] .= parsetemplate($row, $data); // {file_names} $data['text'] = '<a href="game.php?page=overview&cp=' . $p['id'] . '&re=0">' . $p['name'] . ' </a>'; if ($p['planet_type'] == 3) { $data['text'] = '<a href="game.php?page=overview&cp=' . $p['id'] . '&re=0">' . $p['name'] . ' (Luna)</a>'; } $parse['file_names'] .= parsetemplate($row2, $data); // {file_type} $data['text'] = GetPlanetType($p); $parse['file_type'] .= parsetemplate($row2, $data); // {file_coordinates} $data['text'] = "[<a href=\"game.php?page=galaxy&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'] . '/' . CalculateMaxPlanetFields($p) . '<br/>' . GetPercentBar($p['field_current'], CalculateMaxPlanetFields($p)); $parse['file_fields'] .= parsetemplate($row2, $data); // {file_metal} $data['text'] = '<a href="game.php?page=resources&cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['metal']) . '</a><br/>' . GetPercentBar($p['metal'], $p['metal_max'] * MAX_OVERFLOW); $parse['file_metal'] .= parsetemplate($row2, $data); // {file_crystal} $data['text'] = '<a href="game.php?page=resources&cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['crystal']) . '</a><br/>' . GetPercentBar($p['crystal'], $p['crystal_max'] * MAX_OVERFLOW); $parse['file_crystal'] .= parsetemplate($row2, $data); // {file_deuterium} $data['text'] = '<a href="game.php?page=resources&cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['deuterium']) . '</a><br/>' . GetPercentBar($p['deuterium'], $p['deuterium_max'] * MAX_OVERFLOW); $parse['file_deuterium'] .= parsetemplate($row2, $data); // {file_hidrogeno} $data['text'] = '<a href="game.php?page=resources&cp=' . $p['id'] . '&re=0&planettype=' . $p['planet_type'] . '">' . pretty_number($p['tritium']) . '</a><br/>' . GetPercentBar($p['tritium'], $p['tritium_max'] * MAX_OVERFLOW); $parse['file_tritium'] .= parsetemplate($row2, $data); // {file_energy} $data['text'] = pretty_number($p['energy_max'] - $p['energy_used']) . ' / ' . pretty_number($p['energy_max']) . '<br/>' . GetPercentBar($p['energy_max'], $p['energy_max'] - $p['energy_used']); $parse['file_energy'] .= parsetemplate($row2, $data); $Queue = ShowBuildingsPage::ShowBuildingQueue($p, $CurrentUser); foreach ($resource as $i => $res) { if (in_array($i, $reslist['build'])) { if ($Queue['buildingarray'][$i] > $p[$resource[$i]]) { $p[$resource[$i]] = $p[$resource[$i]] . " <span style='color:lime;'>+" . ($Queue['buildingarray'][$i] - $p[$resource[$i]]) . "</span>"; } $data['text'] = $p[$resource[$i]] == 0 ? '' : "<a href=\"game.php?page=buildings&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">" . pretty_number($p[$resource[$i]]) . "</a>"; if (IsElementBuyable($CurrentUser, $p, $i, true, false) and IsTechnologieAccessible($CurrentUser, $p, $i) and $p["field_current"] < CalculateMaxPlanetFields($p)) { $data['text'] .= " <a href=\"game.php?page=buildings&cmd=insert&cp={$p['id']}&re=0&building=" . $i . "\"><font color=lime>+</font></a>"; } } elseif (in_array($i, $reslist['tech'])) { $data['text'] = $CurrentUser[$resource[$i]] == 0 ? '' : "<a href=\"game.php?page=buildings&mode=research&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">{$CurrentUser[$resource[$i]]}</a>"; if (IsElementBuyable($CurrentUser, $p, $i, true, false) and IsTechnologieAccessible($CurrentUser, $p, $i) and $CurrentUser["b_tech_planet"] == 0) { $data['text'] .= " <a href=\"game.php?page=buildings&mode=research&cmd=search&cp={$p['id']}&re=0&tech=" . $i . "\"><font color=lime>+</font></a>"; } } elseif (in_array($i, $reslist['fleet'])) { $data['text'] = $p[$resource[$i]] == 0 ? '' : "<a href=\"game.php?page=buildings&mode=fleet&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">" . pretty_number($p[$resource[$i]]) . "</a>"; } elseif (in_array($i, $reslist['defense'])) { $data['text'] = $p[$resource[$i]] == 0 ? '' : "<a href=\"game.php?page=buildings&mode=defense&cp={$p['id']}&re=0&planettype={$p['planet_type']}\">" . pretty_number($p[$resource[$i]]) . "</a>"; } $r[$i] .= parsetemplate($row2, $data); } } else { $parse['build'] .= '<th width="75">-</th>'; $data['text'] = '<span style="font-size:48px;font-weight:normal;">Σ</span><br/>'; $parse['file_images'] .= parsetemplate($row, $data); // {file_names} $data['text'] = '-'; $parse['file_names'] .= parsetemplate($row2, $data); // {file_type} $data['text'] = "-"; $parse['file_type'] .= parsetemplate($row2, $data); // {file_coordinates} $data['text'] = "-"; $parse['file_coordinates'] .= parsetemplate($row2, $data); // {file_fields} $data['text'] = $p['field_current'] . '/' . CalculateMaxPlanetFields($p) . '<br/>' . GetPercentBar($p['field_current'], CalculateMaxPlanetFields($p)); $parse['file_fields'] .= parsetemplate($row2, $data); // {file_metal} $data['text'] = pretty_number($p['metal']) . '<br/>' . GetPercentBar($p['metal'], $p['metal_max'] * MAX_OVERFLOW); $parse['file_metal'] .= parsetemplate($row2, $data); // {file_crystal} $data['text'] = pretty_number($p['crystal']) . '<br/>' . GetPercentBar($p['crystal'], $p['crystal_max'] * MAX_OVERFLOW); $parse['file_crystal'] .= parsetemplate($row2, $data); // {file_deuterium} $data['text'] = pretty_number($p['deuterium']) . '<br/>' . GetPercentBar($p['deuterium'], $p['deuterium_max'] * MAX_OVERFLOW); $parse['file_deuterium'] .= parsetemplate($row2, $data); // {file_hidrogeno} $data['text'] = pretty_number($p['tritium']) . '<br/>' . GetPercentBar($p['tritium'], $p['tritium_max'] * MAX_OVERFLOW); $parse['file_tritium'] .= parsetemplate($row2, $data); // {file_energy} $data['text'] = pretty_number($p['energy_max'] - $p['energy_used']) . ' / ' . pretty_number($p['energy_max']) . '<br/>' . GetPercentBar($p['energy_max'], $p['energy_max'] - $p['energy_used']); $parse['file_energy'] .= parsetemplate($row2, $data); foreach ($resource as $i => $res) { if (in_array($i, $reslist['build'])) { $data['text'] = $p[$resource[$i]] == 0 ? '' : pretty_number($p[$resource[$i]]); } elseif (in_array($i, $reslist['tech'])) { $data['text'] = $CurrentUser[$resource[$i]] == 0 ? '' : $CurrentUser[$resource[$i]]; } elseif (in_array($i, $reslist['fleet'])) { $data['text'] = $p[$resource[$i]] == 0 ? '' : pretty_number($p[$resource[$i]]); } elseif (in_array($i, $reslist['defense'])) { $data['text'] = $p[$resource[$i]] == 0 ? '' : pretty_number($p[$resource[$i]]); } $r[$i] .= parsetemplate($row2, $data); } } } // {building_row} foreach ($reslist['build'] as $a => $i) { $data['text'] = $lang['tech'][$i]; $parse['building_row'] .= '<tr><th width="15"><span style="float:center;width: 16px;"><a title="' . $lang['tech'][$i] . '"><img style="border: 1px solid rgb(46, 52, 54);vertical-align: bottom;padding: 0px;width: 15px;height: 15px;" src="' . $dpath . 'gebaeude/' . $i . '.gif"></a></span></th>' . parsetemplate($row2, $data) . $r[$i] . "</tr>"; } // {technology_row} foreach ($reslist['tech'] as $a => $i) { $data['text'] = $lang['tech'][$i]; $parse['technology_row'] .= '<tr><th width="15"><span style="float:center;width: 16px;"><a title="' . $lang['tech'][$i] . '"><img style="border: 1px solid rgb(46, 52, 54);vertical-align: bottom;padding: 0px;width: 15px;height: 15px;" src="' . $dpath . 'gebaeude/' . $i . '.gif"></a></span></th>' . parsetemplate($row2, $data) . $r[$i] . "</tr>"; } // {fleet_row} foreach ($reslist['fleet'] as $a => $i) { $data['text'] = $lang['tech'][$i]; $parse['fleet_row'] .= '<tr><th width="15"><span style="float:center;width: 16px;"><a title="' . $lang['tech'][$i] . '"><img style="border: 1px solid rgb(46, 52, 54);vertical-align: bottom;padding: 0px;width: 15px;height: 15px;" src="' . $dpath . 'gebaeude/' . $i . '.gif"></a></span></th>' . parsetemplate($row2, $data) . $r[$i] . "</tr>"; } // {defense_row} foreach ($reslist['defense'] as $a => $i) { $data['text'] = $lang['tech'][$i]; $parse['defense_row'] .= '<tr><th width="15"><span style="float:center;width: 15px;"><a title="' . $lang['tech'][$i] . '"><img style="border: 1px solid rgb(46, 52, 54);vertical-align: bottom;padding: 0px;width: 15px;height: 15px;" src="' . $dpath . 'gebaeude/' . $i . '.gif"></a></span></th>' . parsetemplate($row2, $data) . $r[$i] . "</tr>"; } $page .= parsetemplate(gettemplate('empire/imperium_table'), $parse); display($page, false); }
private function MissionCaseSpy($FleetRow) { global $lang, $resource; if ($FleetRow['fleet_start_time'] <= time()) { $CurrentUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $FleetRow['fleet_owner'] . "';", 'users', true); $CurrentUserID = $FleetRow['fleet_owner']; $QryGetTargetPlanet = "SELECT * FROM {{table}} "; $QryGetTargetPlanet .= "WHERE "; $QryGetTargetPlanet .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryGetTargetPlanet .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryGetTargetPlanet .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND "; $QryGetTargetPlanet .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "';"; $TargetPlanet = doquery($QryGetTargetPlanet, 'planets', true); $TargetUserID = $TargetPlanet['id_owner']; $CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '" . $FleetRow['fleet_start_galaxy'] . "' AND `system` = '" . $FleetRow['fleet_start_system'] . "' AND `planet` = '" . $FleetRow['fleet_start_planet'] . "';", 'planets', true); $CurrentSpyLvl = $CurrentUser['spy_tech'] + $CurrentUser['rpg_espion'] * ESPION; $TargetUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $TargetUserID . "';", 'users', true); $TargetSpyLvl = $TargetUser['spy_tech'] + $TargetUser['rpg_espion'] * ESPION; $fleet = explode(";", $FleetRow['fleet_array']); $fquery = ""; PlanetResourceUpdate($TargetUser, $TargetPlanet, time()); foreach ($fleet as $a => $b) { if ($b != '') { $a = explode(",", $b); $fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n"; if ($FleetRow["fleet_mess"] != "1") { if ($a[0] == "210") { $LS = $a[1]; $QryTargetGalaxy = "SELECT * FROM {{table}} WHERE "; $QryTargetGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryTargetGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryTargetGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "';"; $TargetGalaxy = doquery($QryTargetGalaxy, 'galaxy', true); $CristalDebris = $TargetGalaxy['crystal']; $SpyToolDebris = $LS * 300; $MaterialsInfo = $this->SpyTarget($TargetPlanet, 0, $lang['sys_spy_maretials']); $LinkRess = $MaterialsInfo['lien']; $Materials = $MaterialsInfo['String']; $PlanetFleetInfo = $this->SpyTarget($TargetPlanet, 1, $lang['sys_spy_fleet']); $PlanetFleet = $Materials; $LinkFleet = $PlanetFleetInfo['lien']; $PlanetFleet .= $PlanetFleetInfo['String']; $PlanetDefenInfo = $this->SpyTarget($TargetPlanet, 2, $lang['sys_spy_defenses']); $PlanetDefense = $PlanetFleet; $LinkDef = $PlanetDefenInfo['lien']; $PlanetDefense .= $PlanetDefenInfo['String']; $PlanetBuildInfo = $this->SpyTarget($TargetPlanet, 3, $lang['tech'][0]); $PlanetBuildings = $PlanetDefense; $PlanetBuildings .= $PlanetBuildInfo['String']; $TargetTechnInfo = $this->SpyTarget($TargetUser, 4, $lang['tech'][100]); $TargetTechnos = $PlanetBuildings; $LinkTech = $TargetTechnInfo['lien']; $TargetTechnos .= $TargetTechnInfo['String']; $TargetForce = $PlanetFleetInfo['Count'] * $LS / 4; if ($TargetForce > 100) { $TargetForce = 100; } $TargetChances = rand(0, $TargetForce); $SpyerChances = rand(0, 100); if ($TargetChances >= $SpyerChances) { $DestProba = "<font color=\"red\">" . $lang['sys_mess_spy_destroyed'] . "</font>"; } elseif ($TargetChances < $SpyerChances) { $DestProba = sprintf($lang['sys_mess_spy_lostproba'], $TargetChances); } $AttackLink = "<center>"; $AttackLink .= "<a href=\"game.php?page=fleet&galaxy=" . $FleetRow['fleet_end_galaxy'] . "&system=" . $FleetRow['fleet_end_system'] . ""; $AttackLink .= "&planet=" . $FleetRow['fleet_end_planet'] . "&planettype=" . $FleetRow['fleet_end_type'] . ""; $AttackLink .= "&target_mission=1"; $AttackLink .= " \">" . $lang['type_mission'][1] . ""; $AttackLink .= "</a></center>"; $MessageEnd = "<center>" . $DestProba . "</center>"; $pT = $TargetSpyLvl - $CurrentSpyLvl; $pW = $CurrentSpyLvl - $TargetSpyLvl; if ($TargetSpyLvl > $CurrentSpyLvl) { $ST = $LS - pow($pT, 2); } if ($CurrentSpyLvl > $TargetSpyLvl) { $ST = $LS + pow($pW, 2); } if ($TargetSpyLvl == $CurrentSpyLvl) { $ST = $CurrentSpyLvl; } if ($ST <= "1") { $SimulLink = "<center><a href=\"game.php?page=simulateur&raport=1&" . $LinkRess . "\">Simular</a></center>"; $SpyMessage = $Materials . "<br />" . $AttackLink . $SimulLink . $MessageEnd; } if ($ST == "2") { $SimulLink = "<center><a href=\"game.php?page=simulateur&raport=1&" . $LinkRess . $LinkFleet . "\">Simular</a></center>"; $SpyMessage = $PlanetFleet . "<br />" . $AttackLink . $SimulLink . $MessageEnd; } if ($ST == "4" or $ST == "3") { $SimulLink = "<center><a href=\"game.php?page=simulateur&raport=1&" . $LinkRess . $LinkFleet . $LinkDef . "\">Simular</a></center>"; $SpyMessage = $PlanetDefense . "<br />" . $AttackLink . $SimulLink . $MessageEnd; } if ($ST == "5" or $ST == "6") { $SimulLink = "<center><a href=\"game.php?page=simulateur&raport=1&" . $LinkRess . $LinkFleet . $LinkDef . "\">Simular</a></center>"; $SpyMessage = $PlanetBuildings . "<br />" . $AttackLink . $SimulLink . $MessageEnd; } if ($ST >= "7") { $SimulLink = "<center><a href=\"game.php?page=simulateur&raport=1&" . $LinkRess . $LinkTech . $LinkFleet . $LinkDef . "\">Simular</a></center>"; $SpyMessage = $TargetTechnos . "<br />" . $AttackLink . $SimulLink . $MessageEnd; } SendSimpleMessage($CurrentUserID, '', $FleetRow['fleet_start_time'], 0, $lang['sys_mess_qg'], $lang['sys_mess_spy_report'], $SpyMessage); $TargetMessage = $lang['sys_mess_spy_ennemyfleet'] . " " . $CurrentPlanet['name']; if ($FleetRow['fleet_start_type'] == 3) { $TargetMessage .= $lang['sys_mess_spy_report_moon'] . " "; } $TargetMessage .= "<a href=\"game.php?page=galaxy&mode=3&galaxy=" . $CurrentPlanet["galaxy"] . "&system=" . $CurrentPlanet["system"] . "\">"; $TargetMessage .= "[" . $CurrentPlanet["galaxy"] . ":" . $CurrentPlanet["system"] . ":" . $CurrentPlanet["planet"] . "]</a> "; $TargetMessage .= $lang['sys_mess_spy_seen_at'] . " " . $TargetPlanet['name']; $TargetMessage .= " [" . $TargetPlanet["galaxy"] . ":" . $TargetPlanet["system"] . ":" . $TargetPlanet["planet"] . "]."; SendSimpleMessage($TargetUserID, '', $FleetRow['fleet_start_time'], 0, $lang['sys_mess_spy_control'], $lang['sys_mess_spy_activity'], $TargetMessage); } if ($TargetChances >= $SpyerChances) { $QryUpdateGalaxy = "UPDATE {{table}} SET "; $QryUpdateGalaxy .= "`crystal` = `crystal` + '" . (0 + $SpyToolDebris) . "' "; $QryUpdateGalaxy .= "WHERE `id_planet` = '" . $TargetPlanet['id'] . "';"; doquery($QryUpdateGalaxy, 'galaxy'); doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets'); } else { doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets'); } } } else { if ($FleetRow['fleet_end_time'] <= time()) { $this->RestoreFleetToPlanet($FleetRow, true); doquery("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } } } } }
/** * method attack_mission * param $fleet_row * return the attack result */ public function attack_mission($fleet_row) { // null == use default handlers $errorHandler = null; $exceptionHandler = null; if ($fleet_row['fleet_mess'] == 0 && $fleet_row['fleet_start_time'] <= time()) { $base = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR; require $base . 'utils' . DIRECTORY_SEPARATOR . 'includer.php'; $target_planet = parent::$db->query_fetch("SELECT *\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . BUILDINGS . " AS b ON b.building_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_galaxy` = " . (int) $fleet_row['fleet_end_galaxy'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_system` = " . (int) $fleet_row['fleet_end_system'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_type` = " . (int) $fleet_row['fleet_end_type'] . " AND\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t`planet_planet` = " . (int) $fleet_row['fleet_end_planet'] . ";"); if ($fleet_row['fleet_group'] > 0) { parent::$db->query("DELETE FROM `" . ACS_FLEETS . "`\n\t\t\t\t\t\t\t\t\t\tWHERE `acs_fleet_id` = '" . (int) $fleet_row['fleet_group'] . "'"); parent::$db->query("UPDATE `" . FLEETS . "` SET\n\t\t\t\t\t\t\t\t\t\t`fleet_mess` = '1'\n\t\t\t\t\t\t\t\t\t\tWHERE `fleet_group` = '" . $fleet_row['fleet_group'] . "'"); } else { parent::return_fleet($fleet_row['fleet_id']); } $target_user = doquery('SELECT * FROM {{table}} WHERE id=' . $target_planet['id_owner'], 'users', true); $target_userID = $target_user['id']; PlanetResourceUpdate($target_user, $target_planet, time()); // attackers fleet sum $attackers = new PlayerGroup(); if ($fleet_row['fleet_group'] != 0) { $fleets = doquery('SELECT * FROM {{table}} WHERE fleet_group=' . $fleet_row['fleet_group'], 'fleets'); $attackers = get_player_group_from_query($fleets); } else { $attackers = get_player_group($fleet_row); } //defenders fleet sum $def = doquery('SELECT * FROM {{table}} WHERE `fleet_end_galaxy` = ' . $fleet_row['fleet_end_galaxy'] . ' AND `fleet_end_system` = ' . $fleet_row['fleet_end_system'] . ' AND `fleet_end_type` = ' . $fleet_row['fleet_end_type'] . ' AND `fleet_end_planet` = ' . $fleet_row['fleet_end_planet'] . ' AND fleet_start_time<' . time() . ' AND fleet_end_stay>=' . time(), 'fleets'); $defenders = get_player_group_from_query($def, true, $target_user); //defenses sum $homeFleet = new HomeFleet(0); for ($i = self::DEFENSE_MIN_ID; $i < self::DEFENSE_MAX_ID; $i++) { if (isset($this->_resource[$i]) && isset($target_planet[$this->_resource[$i]])) { if ($target_planet[$this->_resource[$i]] != 0) { $homeFleet->add(get_ship_type($i, $target_planet[$this->_resource[$i]])); } } } for ($i = self::SHIP_MIN_ID; $i < self::SHIP_MAX_ID; $i++) { if (isset($this->_resource[$i]) && isset($target_planet[$this->_resource[$i]])) { if ($target_planet[$this->_resource[$i]] != 0) { $homeFleet->add(get_ship_type($i, $target_planet[$this->_resource[$i]])); } } } if (!$defenders->existPlayer($target_userID)) { $player = new Player($target_userID, array($homeFleet)); $player->setTech($target_user['military_tech'], $target_user['shield_tech'], $target_user['defence_tech']); $defenders->addPlayer($player); } else { $defenders->getPlayer($target_userID)->addDefense($homeFleet); } //start of battle $battle = new Battle($attackers, $defenders); $startBattle = DebugManager::runDebugged(array($battle, 'startBattle'), $errorHandler, $exceptionHandler); $startBattle(); //end of battle $report = $battle->getReport(); $steal = $this->update_attackers($report->getPresentationAttackersFleetOnRound('START'), $report->getAfterBattleAttackers(), $target_planet); $this->update_defenders($report->getPresentationDefendersFleetOnRound('START'), $report->getAfterBattleDefenders(), $target_planet, $steal); $this->updateDebris($fleet_row, $report); $this->update_moon($fleet_row, $report, '', $target_userID, $target_planet); $this->send_message($fleet_row, $report); } elseif ($fleet_row['fleet_end_time'] <= time()) { $message = sprintf($this->_lang['sys_fleet_won'], $target_planet['planet_name'], Fleets_Lib::target_link($fleet_row, ''), Format_Lib::pretty_number($fleet_row['fleet_resource_metal']), $this->_lang['Metal'], Format_Lib::pretty_number($fleet_row['fleet_resource_crystal']), $this->_lang['Crystal'], Format_Lib::pretty_number($fleet_row['fleet_resource_deuterium']), $this->_lang['Deuterium']); Functions_Lib::send_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_time'], 1, $this->_lang['sys_mess_tower'], $this->_lang['sys_mess_fleetback'], $message); parent::restore_fleet($fleet_row); parent::remove_fleet($fleet_row['fleet_id']); } }
function ShowTutorialPage(&$user, &$planetrow) { global $lang, $dpath, $game_config, $resource; $parse = $lang; $parse['dpath'] = $dpath; $requer = 0; switch ($_GET['pp']) { case 'exit': message('Puedes volver a acceder al Tutorial en el menu. Buena suerte', 'game.php?page=overview'); break; case 'finish': message('Has terminado el Tutorial correctamente. Buena suerte', 'game.php?page=overview'); break; case 1: if ($planetrow[$resource[1]] >= 4) { $parse['met_4'] = 'check'; ++$requer; } else { $parse['met_4'] = 'none'; } if ($planetrow[$resource[2]] >= 2) { $parse['cris_2'] = 'check'; ++$requer; } else { $parse['cris_2'] = 'none'; } if ($planetrow[$resource[4]] >= 4) { $parse['sol_4'] = 'check'; ++$requer; } else { $parse['sol_4'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 3 and $user['tut_1'] == 0) { $planetrow['metal'] += 1500; $planetrow['crystal'] += 750; doquery("UPDATE {{table}} SET `tut_1` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); PlanetResourceUpdate($user, $planetrow, time()); $user['tut_1'] = 1; message(' <p style="color:lime;">¡Felicitaciones! Con la construcción exitosa de tus primeras minas has asegurado la base de abastecimiento de tu planeta.</p> <ul><li>Asegúrate de que tus minas tengan a su disposición suficiente energía. Si no lo haces, tus minas no podrán seguir trabajando efectivamente. </li> <li>Al principio del juego, la planta de energía solar es la fuente de energía más económica.</li> <li>Al comienzo del juego, es muy importante que tengas los recursos base metal y cristal para la expansión de otras minas. Más tarde necesitarás también el recurso deuterio. Y mucho más tarde el hidrógeno. </li></ul>', 'game.php?page=tutorial&pp=2', 3); } if ($requer == 3 and $user['tut_1'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=1&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_1'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_1'), $parse); break; case 2: if ($planetrow[$resource[3]] >= 2) { $parse['deu_4'] = 'check'; ++$requer; } else { $parse['deu_4'] = 'none'; } if ($planetrow[$resource[14]] >= 2) { $parse['robot_2'] = 'check'; ++$requer; } else { $parse['robot_2'] = 'none'; } if ($planetrow[$resource[21]] >= 1) { $parse['han_1'] = 'check'; ++$requer; } else { $parse['han_1'] = 'none'; } if ($planetrow[$resource[401]] >= 1) { $parse['lanz_1'] = 'check'; ++$requer; } else { $parse['lanz_1'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 4 and $user['tut_2'] == 0) { doquery("UPDATE {{table}} SET `" . $resource[401] . "` = `" . $resource[401] . "` + 20 WHERE `id` = '" . $planetrow['id'] . "';", 'planets'); doquery("UPDATE {{table}} SET `tut_2` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); $user['tut_2'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial&pp=3'); } if ($requer == 4 and $user['tut_2'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=2&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_2'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_2'), $parse); break; case 3: if ($planetrow[$resource[1]] >= 10) { $parse['met_10'] = 'check'; ++$requer; } else { $parse['met_10'] = 'none'; } if ($planetrow[$resource[2]] >= 7) { $parse['cris_7'] = 'check'; ++$requer; } else { $parse['cris_7'] = 'none'; } if ($planetrow[$resource[3]] >= 5) { $parse['deut_5'] = 'check'; ++$requer; } else { $parse['deut_5'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 3 and $user['tut_3'] == 0) { $planetrow['metal'] += 20000; $planetrow['crystal'] += 5000; doquery("UPDATE {{table}} SET `tut_3` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); PlanetResourceUpdate($user, $planetrow, time()); $user['tut_3'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial&pp=4'); } if ($requer == 3 and $user['tut_3'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=3&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_3'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_3'), $parse); break; case 4: if ($planetrow[$resource[31]] >= 1) { $parse['inv_1'] = 'check'; ++$requer; } else { $parse['inv_1'] = 'none'; } if ($user[$resource[115]] >= 2) { $parse['comb_2'] = 'check'; ++$requer; } else { $parse['comb_2'] = 'none'; } if ($planetrow[$resource[202]] >= 1) { $parse['navp_1'] = 'check'; ++$requer; } else { $parse['navp_1'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 3 and $user['tut_4'] == 0) { $planetrow['deuterium'] += 7000; $planetrow['tritium'] += 1500; doquery("UPDATE {{table}} SET `tut_4` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); PlanetResourceUpdate($user, $planetrow, time()); $user['tut_4'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial&pp=5'); } if ($requer == 3 and $user['tut_4'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=4&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_4'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_4'), $parse); break; case 5: if (isset($_POST['forum_content']) and strpos($_POST['forum_content'], $game_config['forum_url']) !== false) { doquery("UPDATE {{table}} SET `tut_5_forum` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); $user['tut_5_forum'] = 1; } if ($planetrow['name'] != $lang['sys_pp_defaultname'] and $planetrow['name'] != $lang['sys_colo_defaultname']) { $parse['planet'] = 'check'; ++$requer; } else { $parse['planet'] = 'none'; } if ($user['tut_5_forum'] == 1) { $parse['forum'] = 'check'; ++$requer; } else { $parse['forum'] = 'none'; } $buddyrow = doquery("SELECT count(*) AS `total` FROM {{table}} WHERE `sender` = '" . $user["id"] . "' OR `owner` = '" . $user["id"] . "';", 'buddy', true); if ($buddyrow['total'] >= 1) { $parse['buddy'] = 'check'; ++$requer; } else { $parse['buddy'] = 'none'; } $allyrow = doquery("SELECT count(*) AS `total` FROM {{table}} WHERE `ally_id` = '" . $user["ally_id"] . "';", 'users', true); if ($user['ally_id'] != 0 and $allyrow['total'] >= 4) { $parse['ally'] = 'check'; ++$requer; } else { $parse['ally'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 4 and $user['tut_5'] == 0) { $user['darkmatter'] += TR_DARK_MATTER; doquery("UPDATE {{table}} SET `tut_5` = '1', `darkmatter` = '" . $user['darkmatter'] . "' WHERE `id` = '" . $user['id'] . "';", 'users'); $user['tut_5'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial&pp=6'); } if ($requer == 4 and $user['tut_5'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=5&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_5'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_5'), $parse); break; case 6: if ($planetrow[$resource[22]] >= 1 or $planetrow[$resource[23]] >= 1 or $planetrow[$resource[24]] >= 1) { $parse['alm'] = 'check'; ++$requer; } else { $parse['alm'] = 'none'; } if ($user['tut_6_mer'] >= 1) { $parse['mer'] = 'check'; ++$requer; } else { $parse['mer'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 2 and $user['tut_6'] == 0) { $rand = mt_rand(22, 24); $planetrow[$resource[$rand]] += 1; doquery("UPDATE {{table}} SET `" . $resource[$rand] . "` = '" . $planetrow[$resource[$rand]] . "' WHERE `id` = '" . $planetrow['id'] . "';", 'planets'); doquery("UPDATE {{table}} SET `tut_6` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); $user['tut_6'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial&pp=7'); } if ($requer == 2 and $user['tut_6'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=6&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_6'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_6'), $parse); break; case 7: if ($planetrow[$resource[210]] >= 1) { $parse['sond'] = 'check'; ++$requer; } else { $parse['sond'] = 'none'; } if ($user['tut_7_esp'] >= 1) { $parse['esp'] = 'check'; ++$requer; } else { $parse['esp'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 2 and $user['tut_7'] == 0) { doquery("UPDATE {{table}} SET `" . $resource[210] . "` = `" . $resource[210] . "` + 20 WHERE `id` = '" . $planetrow['id'] . "';", 'planets'); doquery("UPDATE {{table}} SET `tut_7` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); $user['tut_7'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial&pp=8'); } if ($requer == 2 and $user['tut_7'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=7&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_7'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_7'), $parse); break; case 8: $parse['exp_pln'] = MAX_PLANET_IN_SYSTEM + 1; if ($user['tut_8_exp'] >= 1) { $parse['exp'] = 'check'; ++$requer; } else { $parse['exp'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 1 and $user['tut_8'] == 0) { doquery("UPDATE {{table}} SET `" . $resource[202] . "` = `" . $resource[202] . "` + 50 , `" . $resource[205] . "` = `" . $resource[205] . "` + 20 WHERE `id` = '" . $planetrow['id'] . "';", 'planets'); doquery("UPDATE {{table}} SET `tut_8` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); $user['tut_8'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial&pp=9'); } if ($requer == 1 and $user['tut_8'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=8&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_8'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_8'), $parse); break; case 9: $planets = doquery("SELECT count(*) AS `total` FROM {{table}} WHERE `id_owner` = '" . $user["id"] . "';", 'planets', true); if ($planets['total'] >= 2) { $parse['colonia'] = 'check'; ++$requer; } else { $parse['colonia'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 1 and $user['tut_9'] == 0) { doquery("UPDATE {{table}} SET `tut_9` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); $user['tut_9'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial&pp=10'); } if ($requer == 1 and $user['tut_9'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=9&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_9'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_9'), $parse); break; case 10: if ($user['tut_10_rec'] >= 1) { $parse['rec'] = 'check'; ++$requer; } else { $parse['rec'] = 'none'; } if ($_GET['continue'] == 1 and $requer == 1 and $user['tut_10'] == 0) { doquery("UPDATE {{table}} SET `" . $resource[209] . "` = `" . $resource[209] . "` + 100 WHERE `id` = '" . $planetrow['id'] . "';", 'planets'); $user['tut_10'] = 1; doquery("UPDATE {{table}} SET `tut_10` = '1' WHERE `id` = '" . $user['id'] . "';", 'users'); $user['tut_10'] = 1; if ($user['tut_1'] == 1 and $user['tut_2'] == 1 and $user['tut_3'] == 1 and $user['tut_4'] == 1 and $user['tut_5'] == 1 and $user['tut_6'] == 1 and $user['tut_7'] == 1 and $user['tut_8'] == 1 and $user['tut_9'] == 1 and $user['tut_10'] == 1) { header('Location: game.php?page=tutorial&pp=finish'); die; } header('Location: game.php?page=tutorial'); } if ($requer == 1 and $user['tut_10'] == 0) { $parse['button'] = '<input type="button" onclick="window.location = \'game.php?page=tutorial&pp=10&continue=1\'" value="Recompensa" style="width:150px;height:30px;color:orange;"/></th>'; } elseif ($user['tut_10'] == 1) { $parse['button'] = '<input type="button" value="Completado" style="width:150px;height:30px;color:green;" disabled="true" />'; } else { $parse['button'] = '<input type="button" onclick="document.getElementById(\'tutorial_solution\').style.display = \'block\';this.disabled = true;" value="Solución" style="width:130px;"/>'; } $page = parsetemplate(gettemplate('tutorial/tutorial_10'), $parse); break; default: for ($e = 1; $e <= 10; ++$e) { if ($user['tut_' . $e] == 1) { $parse['tut_' . $e] = 'check'; } elseif ($user['tut_' . $e] == 0) { $parse['tut_' . $e] = 'none'; } } $parse['db_game_name'] = $game_config['game_name']; $page = parsetemplate(gettemplate('tutorial/tutorial'), $parse); break; } display("<div id='content'>" . $page . "</div>"); }
* PlanetResourceUpdateGlobal.php * * @version 1.0 * by Helmchen for XNova Community */ define('INSIDE', true); define('INSTALL', false); define('IN_ADMIN', true); $rocketnova_root_path = './../'; include $rocketnova_root_path . 'extension.inc'; include $rocketnova_root_path . 'common.' . $phpEx; //DEBUG AUSGABE (Es werden nur die neuen Werte angezeigt, ohne sie in die Datenbank zu schreiben) // true = nur Ausgabe // false = keine Debugausgabe + Daten werden in die Datenbank geschrieben. $debugUpdate = false; ///////////////////////////////////////////////////////////////////////////////////////////////// $count = 0; //affected planets/moons $GameUsers = doquery("SELECT * FROM {{table}}", 'users'); while ($CurUser = mysql_fetch_assoc($GameUsers)) { $UsrPlanets = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurUser['id'] . "';", 'planets'); while ($CurPlanet = mysql_fetch_assoc($UsrPlanets)) { $update = PlanetResourceUpdate($CurUser, $CurPlanet, time(), $debugUpdate); $count = $count + 1; } } if ($count <= 0) { echo '<center><font color="red">Beim Update gab es offenbar ein Problem.<br>Es wurden <u>keine</u> Planeten aktualisiert!</font></center>'; } else { echo '<center><font color="green">Done!<br>Ingsgesamt wurden ' . $count . ' Planeten / Monde aktualisiert!</font></center>'; }
function MissionCaseSpy($FleetRow) { global $lang, $resource; if ($FleetRow['fleet_start_time'] <= time()) { $CurrentUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $FleetRow['fleet_owner'] . "';", 'users', true); $CurrentUserID = $FleetRow['fleet_owner']; $QryGetTargetPlanet = "SELECT * FROM {{table}} "; $QryGetTargetPlanet .= "WHERE "; $QryGetTargetPlanet .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryGetTargetPlanet .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryGetTargetPlanet .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND "; $QryGetTargetPlanet .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "';"; $TargetPlanet = doquery($QryGetTargetPlanet, 'planets', true); $TargetUserID = $TargetPlanet['id_owner']; $CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `galaxy` = '" . $FleetRow['fleet_start_galaxy'] . "' AND `system` = '" . $FleetRow['fleet_start_system'] . "' AND `planet` = '" . $FleetRow['fleet_start_planet'] . "';", 'planets', true); $CurrentSpyLvl = $CurrentUser['spy_tech']; $CurrentEspia = $CurrentUser['rpg_espion']; $TargetUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $TargetUserID . "';", 'users', true); $TargetSpyLvl = $TargetUser['spy_tech']; $TargetEspia = $TargetUser['rpg_espion']; $fleet = explode(";", $FleetRow['fleet_array']); $fquery = ""; // Planeten aktualisieren und erneut auslesen // ============================================================================= $update = PlanetResourceUpdate($TargetUser, $TargetPlanet, $FleetRow['fleet_end_time']); $TargetPlanet = doquery($QryGetTargetPlanet, 'planets', true); $TargetUser = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $TargetUserID . "';", 'users', true); // ============================================================================= foreach ($fleet as $a => $b) { if ($b != '') { $a = explode(",", $b); $fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n"; if ($FleetRow['fleet_mess'] != "1") { if ($a[0] == "210") { $LS = $a[1]; $QryTargetGalaxy = "SELECT * FROM {{table}} WHERE "; $QryTargetGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryTargetGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryTargetGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "';"; $TargetGalaxy = doquery($QryTargetGalaxy, 'galaxy', true); $CristalDebris = $TargetGalaxy['crystal']; $SpyToolDebris = $LS * 300; $MaterialsInfo = SpyTarget($TargetPlanet, 0, $lang['sys_spy_maretials']); $Materials = $MaterialsInfo['String']; $PlanetFleetInfo = SpyTarget($TargetPlanet, 1, $lang['sys_spy_fleet']); $PlanetFleet = $Materials; $PlanetFleet .= $PlanetFleetInfo['String']; $PlanetDefenInfo = SpyTarget($TargetPlanet, 2, $lang['sys_spy_defenses']); $PlanetDefense = $PlanetFleet; $PlanetDefense .= $PlanetDefenInfo['String']; $PlanetBuildInfo = SpyTarget($TargetPlanet, 3, $lang['tech'][0]); $PlanetBuildings = $PlanetDefense; $PlanetBuildings .= $PlanetBuildInfo['String']; $TargetTechnInfo = SpyTarget($TargetUser, 4, $lang['tech'][100]); $TargetTechnos = $PlanetBuildings; $TargetTechnos .= $TargetTechnInfo['String']; // Stehende Flotten $TargetAllyInfo = SpyTarget($TargetPlanet, 5, $lang['sys_spy_stayfleets']); $TargetAllyFleet = $TargetTechnos; $TargetAllyFleet .= $TargetAllyInfo['String']; $TargetForce = $PlanetFleetInfo['Count'] * $LS / 4; if ($TargetForce > 100) { $TargetForce = 100; } $TargetChances = rand(0, $TargetForce); $SpyerChances = rand(0, 100); if ($TargetChances >= $SpyerChances) { $DestProba = "<font color=\"red\">" . $lang['sys_mess_spy_destroyed'] . "</font>"; //Wenn die Spiosonden abgeschossen wurden werden sie jetzt in der DB gelöscht. doquery("DELETE FROM {{table}} WHERE `fleet_owner` = '" . $TargetUserID . "' AND `fleet_mission`=6 AND `fleet_mission`='" . $FleetRow['fleet_id'] . "';", 'fleets'); } elseif ($TargetChances < $SpyerChances) { $DestProba = sprintf($lang['sys_mess_spy_lostproba'], $TargetChances); } $AttackLink = "<center>"; $AttackLink .= "<a href=\"fleet.php?galaxy=" . $FleetRow['fleet_end_galaxy'] . "&system=" . $FleetRow['fleet_end_system'] . ""; $AttackLink .= "&planet=" . $FleetRow['fleet_end_planet'] . "&planettype=" . $FleetRow['fleet_end_type'] . ""; $AttackLink .= "&target_mission=1"; $AttackLink .= " \">" . $lang['type_mission'][1] . ""; $AttackLink .= "</a></center>"; $MessageEnd = "<center>" . $DestProba . "</center>"; $pT = $TargetSpyLvl + $TargetEspia - ($CurrentSpyLvl + $CurrentEspia); $pW = $CurrentSpyLvl + $CurrentEspia - ($TargetSpyLvl + $TargetEspia); if ($TargetSpyLvl + $TargetEspia > $CurrentSpyLvl + $CurrentEspia) { $ST = $LS - pow($pT, 2); } if ($CurrentSpyLvl + $CurrentEspia > $TargetSpyLvl + $TargetEspia) { $ST = $LS + pow($pW, 2); } if ($TargetSpyLvl == $CurrentSpyLvl) { $ST = $CurrentSpyLvl; } if ($ST <= "1") { $SpyMessage = $Materials . "<br />" . $AttackLink . $MessageEnd; } if ($ST == "2") { $SpyMessage = $PlanetFleet . "<br />" . $AttackLink . $MessageEnd; } if ($ST == "4" or $ST == "3") { $SpyMessage = $PlanetDefense . "<br />" . $AttackLink . $MessageEnd; } if ($ST == "5" or $ST == "6") { $SpyMessage = $PlanetBuildings . "<br />" . $AttackLink . $MessageEnd; } if ($ST >= "7") { $SpyMessage = $TargetAllyFleet . "<br />" . $AttackLink . $MessageEnd; } SendSimpleMessage($CurrentUserID, '', $FleetRow['fleet_start_time'], 0, $lang['sys_mess_qg'], $lang['sys_mess_spy_report'], $SpyMessage); $TargetMessage = $lang['sys_mess_spy_ennemyfleet'] . " " . $CurrentPlanet['name']; $TargetMessage .= "<a href=\"galaxy.php?mode=3&galaxy=" . $CurrentPlanet['galaxy'] . "&system=" . $CurrentPlanet['system'] . "\">"; $TargetMessage .= "[" . $CurrentPlanet['galaxy'] . ":" . $CurrentPlanet['system'] . ":" . $CurrentPlanet['planet'] . "]</a> "; $TargetMessage .= $lang['sys_mess_spy_seen_at'] . " " . $TargetPlanet['name']; $TargetMessage .= " [" . $TargetPlanet['galaxy'] . ":" . $TargetPlanet['system'] . ":" . $TargetPlanet['planet'] . "]."; SendSimpleMessage($TargetUserID, '', $FleetRow['fleet_start_time'], 0, $lang['sys_mess_spy_control'], $lang['sys_mess_spy_activity'], $TargetMessage); } if ($TargetChances >= $SpyerChances) { $QryUpdateGalaxy = "UPDATE {{table}} SET "; $QryUpdateGalaxy .= "`crystal` = `crystal` + '" . (0 + $SpyToolDebris) . "' "; $QryUpdateGalaxy .= "WHERE `id_planet` = '" . $TargetPlanet['id'] . "';"; doquery("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow['fleet_id'], 'fleets'); doquery($QryUpdateGalaxy, 'galaxy'); } else { doquery("UPDATE {{table}} SET `fleet_mess` = '1' WHERE `fleet_id` = '" . $FleetRow['fleet_id'] . "';", 'fleets'); } } } else { // Rueckkehr der Spiosonden if ($FleetRow['fleet_end_time'] <= time()) { RestoreFleetToPlanet($FleetRow, true); doquery("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow['fleet_id'], 'fleets'); } } } } }
/** * ShowTopNavigationBar.php * * @version 1 * @copyright 2008 By Chlorel for XNova */ function ShowTopNavigationBar($CurrentUser, $CurrentPlanet) { global $lang, $_GET; if ($CurrentUser) { if (!$CurrentPlanet) { $CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $CurrentUser['current_planet'] . "';", 'planets', true); } // Actualisation des ressources de la planete PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time()); $NavigationTPL = gettemplate('topnav'); $dpath = !$CurrentUser["dpath"] ? DEFAULT_SKINPATH : $CurrentUser["dpath"]; $parse = $lang; $parse['dpath'] = $dpath; $parse['image'] = $CurrentPlanet['image']; // 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; } // Message if ($CurrentUser['new_message'] > 0) { $parse['message'] = "<a href=\"messages.php\">[ " . $CurrentUser['new_message'] . " ]</a>"; } else { $parse['message'] = "0"; } // Le tout passe dans la template $TopBar = parsetemplate($NavigationTPL, $parse); } else { $TopBar = ""; } return $TopBar; }
function MissionCaseAttack($FleetRow) { global $user, $phpEx, $ugamela_root_path, $pricelist, $lang, $resource, $CombatCaps; if ($FleetRow['fleet_start_time'] <= time()) { if ($FleetRow['fleet_mess'] == 0) { if (!isset($CombatCaps[202]['sd'])) { message("<font color=\"red\">" . $lang['sys_no_vars'] . "</font>", $lang['sys_error'], "fleet." . $phpEx, 2); } $QryTargetPlanet = "SELECT * FROM {{table}} "; $QryTargetPlanet .= "WHERE "; $QryTargetPlanet .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryTargetPlanet .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryTargetPlanet .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND "; $QryTargetPlanet .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "';"; $TargetPlanet = doquery($QryTargetPlanet, 'planets', true); $TargetUserID = $TargetPlanet['id_owner']; $QryTargetUser = "******"; $QryTargetUser .= "WHERE "; $QryTargetUser .= "`id` = '" . $TargetUserID . "';"; $TargetUser = doquery($QryTargetUser, 'users', true); // Planeten aktualisieren und erneut auslesen // ============================================================================= $update = PlanetResourceUpdate($TargetUser, $TargetPlanet, time()); $TargetPlanet = doquery($QryTargetPlanet, 'planets', true); $TargetUser = doquery($QryTargetUser, 'users', true); // ============================================================================= $QryCurrentUser = "******"; $QryCurrentUser .= "WHERE "; $QryCurrentUser .= "`id` = '" . $FleetRow['fleet_owner'] . "';"; $CurrentUser = doquery($QryCurrentUser, 'users', true); $CurrentUserID = $CurrentUser['id']; $QryTargetTech = "SELECT "; $QryTargetTech .= "`military_tech`, `defence_tech`, `shield_tech` "; $QryTargetTech .= "FROM {{table}} "; $QryTargetTech .= "WHERE "; $QryTargetTech .= "`id` = '" . $TargetUserID . "';"; $TargetTechno = doquery($QryTargetTech, 'users', true); $QryCurrentTech = "SELECT "; $QryCurrentTech .= "`military_tech`, `defence_tech`, `shield_tech` "; $QryCurrentTech .= "FROM {{table}} "; $QryCurrentTech .= "WHERE "; $QryCurrentTech .= "`id` = '" . $CurrentUserID . "';"; $CurrentTechno = doquery($QryCurrentTech, 'users', true); for ($SetItem = 200; $SetItem < 500; $SetItem++) { if ($TargetPlanet[$resource[$SetItem]] > 0) { $TargetSet[$SetItem]['count'] = $TargetPlanet[$resource[$SetItem]]; } } $TheFleet = explode(";", $FleetRow['fleet_array']); foreach ($TheFleet as $a => $b) { if ($b != '') { $a = explode(",", $b); $CurrentSet[$a[0]]['count'] = $a[1]; } } include_once $ugamela_root_path . 'includes/ataki.' . $phpEx; // Calcul de la duree de traitement (initialisation) $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $starttime = $mtime; $walka = walka($CurrentSet, $TargetSet, $CurrentTechno, $TargetTechno); // Calcul de la duree de traitement (calcul) $mtime = microtime(); $mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = $endtime - $starttime; // Ce qu'il reste de l'attaquant $CurrentSet = $walka["atakujacy"]; // Ce qu'il reste de l'attaqué $TargetSet = $walka["wrog"]; // Le resultat de la bataille $FleetResult = $walka["wygrana"]; // Rapport long (rapport de bataille detaillé) $dane_do_rw = $walka["dane_do_rw"]; // Rapport court (cdr + unitées perdues) $zlom = $walka["zlom"]; $FleetArray = ""; $FleetAmount = 0; $FleetStorage = 0; foreach ($CurrentSet as $Ship => $Count) { $FleetStorage += $pricelist[$Ship]["capacity"] * $Count['count']; $FleetArray .= $Ship . "," . $Count['count'] . ";"; $FleetAmount += $Count['count']; } // Au cas ou le p'tit rigolo qu'a envoyé la flotte y avait mis des ressources ... $FleetStorage -= $FleetRow["fleet_resource_metal"]; $FleetStorage -= $FleetRow["fleet_resource_crystal"]; $FleetStorage -= $FleetRow["fleet_resource_deuterium"]; $TargetPlanetUpd = ""; if (!is_null($TargetSet)) { foreach ($TargetSet as $Ship => $Count) { $TargetPlanetUpd .= "`" . $resource[$Ship] . "` = '" . $Count['count'] . "', "; } } // Determination des ressources pillées $Mining['metal'] = 0; $Mining['crystal'] = 0; $Mining['deuter'] = 0; if ($FleetResult == "a") { if ($FleetStorage > 0) { $metal = $TargetPlanet['metal'] / 2; $crystal = $TargetPlanet['crystal'] / 2; $deuter = $TargetPlanet["deuterium"] / 2; if ($metal > $FleetStorage / 3) { $Mining['metal'] = $FleetStorage / 3; $FleetStorage = $FleetStorage - $Mining['metal']; } else { $Mining['metal'] = $metal; $FleetStorage = $FleetStorage - $Mining['metal']; } if ($crystal > $FleetStorage / 2) { $Mining['crystal'] = $FleetStorage / 2; $FleetStorage = $FleetStorage - $Mining['crystal']; } else { $Mining['crystal'] = $crystal; $FleetStorage = $FleetStorage - $Mining['crystal']; } if ($deuter > $FleetStorage) { $Mining['deuter'] = $FleetStorage; $FleetStorage = $FleetStorage - $Mining['deuter']; } else { $Mining['deuter'] = $deuter; $FleetStorage = $FleetStorage - $Mining['deuter']; } } } $Mining['metal'] = round($Mining['metal']); $Mining['crystal'] = round($Mining['crystal']); $Mining['deuter'] = round($Mining['deuter']); // Mise a jour de l'enregistrement de la planete attaquée $QryUpdateTarget = "UPDATE {{table}} SET "; $QryUpdateTarget .= $TargetPlanetUpd; $QryUpdateTarget .= "`metal` = `metal` - '" . $Mining['metal'] . "', "; $QryUpdateTarget .= "`crystal` = `crystal` - '" . $Mining['crystal'] . "', "; $QryUpdateTarget .= "`deuterium` = `deuterium` - '" . $Mining['deuter'] . "' "; $QryUpdateTarget .= "WHERE "; $QryUpdateTarget .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryUpdateTarget .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryUpdateTarget .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND "; $QryUpdateTarget .= "`planet_type` = '" . $FleetRow['fleet_end_type'] . "' "; $QryUpdateTarget .= "LIMIT 1;"; doquery($QryUpdateTarget, 'planets'); // Mise a jour du champ de ruine devant la planete attaquée $QryUpdateGalaxy = "UPDATE {{table}} SET "; $QryUpdateGalaxy .= "`metal` = `metal` + '" . $zlom['metal'] . "', "; $QryUpdateGalaxy .= "`crystal` = `crystal` + '" . $zlom['crystal'] . "' "; $QryUpdateGalaxy .= "WHERE "; $QryUpdateGalaxy .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryUpdateGalaxy .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryUpdateGalaxy .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' "; $QryUpdateGalaxy .= "LIMIT 1;"; doquery($QryUpdateGalaxy, 'galaxy'); // Là on va discuter le bout de gras pour voir s'il y a moyen d'avoir une Lune ! $FleetDebris = $zlom['metal'] + $zlom['crystal']; $StrAttackerUnits = sprintf($lang['sys_attacker_lostunits'], $zlom["atakujacy"]); $StrDefenderUnits = sprintf($lang['sys_defender_lostunits'], $zlom["wrog"]); $StrRuins = sprintf($lang['sys_gcdrunits'], $zlom["metal"], $lang['Metal'], $zlom['crystal'], $lang['Crystal']); $DebrisField = $StrAttackerUnits . "<br />" . $StrDefenderUnits . "<br />" . $StrRuins; $MoonChance = $FleetDebris / 100000000; if ($FleetDebris > 2000000000) { $MoonChance = 20; } if ($FleetDebris < 100000000) { $UserChance = 0; $ChanceMoon = ""; } elseif ($FleetDebris >= 100000000) { $UserChance = mt_rand(1, 100); $ChanceMoon = sprintf($lang['sys_moonproba'], $MoonChance); } if ($UserChance > 0 and $UserChance <= $MoonChance and $galenemyrow['id_luna'] == 0) { $TargetPlanetName = CreateOneMoonRecord($FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet'], $TargetUserID, $FleetRow['fleet_start_time'], '', $MoonChance); $GottenMoon = sprintf($lang['sys_moonbuilt'], $TargetPlanetName, $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); } elseif ($UserChance = 0 or $UserChance > $MoonChance) { $GottenMoon = ""; } $AttackDate = date("r", $FleetRow["fleet_start_time"]); $title = sprintf($lang['sys_attack_title'], $AttackDate); $raport = "<center><table><tr><td>" . $title . "<br />"; $zniszczony = false; $a_zestrzelona = 0; $AttackTechon['A'] = $CurrentTechno["military_tech"] * 10; $AttackTechon['B'] = $CurrentTechno["defence_tech"] * 10; $AttackTechon['C'] = $CurrentTechno["shield_tech"] * 10; $AttackerData = sprintf($lang['sys_attack_attacker_pos'], $CurrentUser["username"], $FleetRow['fleet_start_galaxy'], $FleetRow['fleet_start_system'], $FleetRow['fleet_start_planet']); $AttackerTech = sprintf($lang['sys_attack_techologies'], $AttackTechon['A'], $AttackTechon['B'], $AttackTechon['C']); $DefendTechon['A'] = $TargetTechno["military_tech"] * 10; $DefendTechon['B'] = $TargetTechno["defence_tech"] * 10; $DefendTechon['C'] = $TargetTechno["shield_tech"] * 10; $DefenderData = sprintf($lang['sys_attack_defender_pos'], $TargetUser["username"], $FleetRow['fleet_end_galaxy'], $FleetRow['fleet_end_system'], $FleetRow['fleet_end_planet']); $DefenderTech = sprintf($lang['sys_attack_techologies'], $DefendTechon['A'], $DefendTechon['B'], $DefendTechon['C']); foreach ($dane_do_rw as $a => $b) { $raport .= "<table border=1 width=100%><tr><th><br /><center>" . $AttackerData . "<br />" . $AttackerTech . "<table border=1>"; if ($b["atakujacy"]['count'] > 0) { $raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>"; $raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>"; $raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>"; $raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>"; $raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>"; foreach ($b["atakujacy"] as $Ship => $Data) { if (is_numeric($Ship)) { if ($Data['count'] > 0) { $raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>"; $raport2 .= "<th>" . $Data['count'] . "</th>"; $raport3 .= "<th>" . round($Data["atak"] / $Data['count']) . "</th>"; $raport4 .= "<th>" . round($Data["tarcza"] / $Data['count']) . "</th>"; $raport5 .= "<th>" . round($Data["obrona"] / $Data['count']) . "</th>"; } } } $raport1 .= "</tr>"; $raport2 .= "</tr>"; $raport3 .= "</tr>"; $raport4 .= "</tr>"; $raport5 .= "</tr>"; $raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5; } else { if ($a == 2) { $a_zestrzelona = 1; } $zniszczony = true; $raport .= "<br />" . $lang['sys_destroyed']; } $raport .= "</table></center></th></tr></table>"; $raport .= "<table border=1 width=100%><tr><th><br /><center>" . $DefenderData . "<br />" . $DefenderTech . "<table border=1>"; if ($b["wrog"]['count'] > 0) { $raport1 = "<tr><th>" . $lang['sys_ship_type'] . "</th>"; $raport2 = "<tr><th>" . $lang['sys_ship_count'] . "</th>"; $raport3 = "<tr><th>" . $lang['sys_ship_weapon'] . "</th>"; $raport4 = "<tr><th>" . $lang['sys_ship_shield'] . "</th>"; $raport5 = "<tr><th>" . $lang['sys_ship_armour'] . "</th>"; foreach ($b["wrog"] as $Ship => $Data) { if (is_numeric($Ship)) { if ($Data['count'] > 0) { $raport1 .= "<th>" . $lang["tech_rc"][$Ship] . "</th>"; $raport2 .= "<th>" . $Data['count'] . "</th>"; $raport3 .= "<th>" . round($Data["atak"] / $Data['count']) . "</th>"; $raport4 .= "<th>" . round($Data["tarcza"] / $Data['count']) . "</th>"; $raport5 .= "<th>" . round($Data["obrona"] / $Data['count']) . "</th>"; } } } $raport1 .= "</tr>"; $raport2 .= "</tr>"; $raport3 .= "</tr>"; $raport4 .= "</tr>"; $raport5 .= "</tr>"; $raport .= $raport1 . $raport2 . $raport3 . $raport4 . $raport5; } else { $zniszczony = true; $raport .= "<br />" . $lang['sys_destroyed']; } $raport .= "</table></center></th></tr></table>"; if ($zniszczony == false and !($a == 8)) { $AttackWaveStat = sprintf($lang['sys_attack_attack_wave'], floor($b["atakujacy"]["atak"]), floor($b["wrog"]["tarcza"])); $DefendWavaStat = sprintf($lang['sys_attack_defend_wave'], floor($b["wrog"]["atak"]), floor($b["atakujacy"]["tarcza"])); $raport .= "<br /><center>" . $AttackWaveStat . "<br />" . $DefendWavaStat . "</center>"; } } switch ($FleetResult) { case "a": $Pillage = sprintf($lang['sys_stealed_ressources'], $Mining['metal'], $lang['metal'], $Mining['crystal'], $lang['crystal'], $Mining['deuter'], $lang['Deuterium']); $raport .= $lang['sys_attacker_won'] . "<br />" . $Pillage . "<br />"; $raport .= $DebrisField . "<br />"; $raport .= $ChanceMoon . "<br />"; $raport .= $GottenMoon . "<br />"; break; case "r": $raport .= $lang['sys_both_won'] . "<br />"; $raport .= $DebrisField . "<br />"; $raport .= $ChanceMoon . "<br />"; $raport .= $GottenMoon . "<br />"; break; case "w": $raport .= $lang['sys_defender_won'] . "<br />"; $raport .= $DebrisField . "<br />"; $raport .= $ChanceMoon . "<br />"; $raport .= $GottenMoon . "<br />"; doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets'); break; default: break; } $SimMessage = sprintf($lang['sys_rapport_build_time'], $totaltime); $raport .= $SimMessage . "</table>"; $dpath = !$user["dpath"] ? DEFAULT_SKINPATH : $user["dpath"]; $rid = md5($raport); $QryInsertRapport = "INSERT INTO {{table}} SET "; $QryInsertRapport .= "`time` = UNIX_TIMESTAMP(), "; $QryInsertRapport .= "`id_owner1` = '" . $FleetRow['fleet_owner'] . "', "; $QryInsertRapport .= "`id_owner2` = '" . $TargetUserID . "', "; $QryInsertRapport .= "`rid` = '" . $rid . "', "; $QryInsertRapport .= "`a_zestrzelona` = '" . $a_zestrzelona . "', "; $QryInsertRapport .= "`raport` = '" . addslashes($raport) . "';"; doquery($QryInsertRapport, 'rw'); // Colorisation du résumé de rapport pour l'attaquant $raport = "<a href # OnClick=\"f( 'rw.php?raport=" . $rid . "', '');\" >"; $raport .= "<center>"; if ($FleetResult == "a") { $raport .= "<font color=\"green\">"; } elseif ($FleetResult == "r") { $raport .= "<font color=\"orange\">"; } elseif ($FleetResult == "w") { $raport .= "<font color=\"red\">"; } $raport .= $lang['sys_mess_attack_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "] </font></a><br /><br />"; $raport .= "<font color=\"red\">" . $lang['sys_perte_attaquant'] . ": " . $zlom["atakujacy"] . "</font>"; $raport .= "<font color=\"green\"> " . $lang['sys_perte_defenseur'] . ":" . $zlom["wrog"] . "</font><br />"; $raport .= $lang['sys_gain'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . $Mining['metal'] . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . $Mining['crystal'] . "</font> " . $lang['Deuterium'] . ":<font color=\"#f77542\">" . $Mining['deuter'] . "</font><br />"; $raport .= $lang['sys_debris'] . " " . $lang['Metal'] . ":<font color=\"#adaead\">" . $zlom['metal'] . "</font> " . $lang['Crystal'] . ":<font color=\"#ef51ef\">" . $zlom['crystal'] . "</font><br /></center>"; $Mining['metal'] = $Mining['metal'] + $FleetRow["fleet_resource_metal"]; $Mining['crystal'] = $Mining['crystal'] + $FleetRow["fleet_resource_crystal"]; $Mining['deuter'] = $Mining['deuter'] + $FleetRow["fleet_resource_deuterium"]; $QryUpdateFleet = "UPDATE {{table}} SET "; $QryUpdateFleet .= "`fleet_amount` = '" . $FleetAmount . "', "; $QryUpdateFleet .= "`fleet_array` = '" . $FleetArray . "', "; $QryUpdateFleet .= "`fleet_mess` = '1', "; $QryUpdateFleet .= "`fleet_resource_metal` = '" . $Mining['metal'] . "', "; $QryUpdateFleet .= "`fleet_resource_crystal` = '" . $Mining['crystal'] . "', "; $QryUpdateFleet .= "`fleet_resource_deuterium` = '" . $Mining['deuter'] . "' "; $QryUpdateFleet .= "WHERE fleet_id = '" . $FleetRow['fleet_id'] . "' "; $QryUpdateFleet .= "LIMIT 1 ;"; doquery($QryUpdateFleet, 'fleets'); SendSimpleMessage($CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport); // Ajout d'un point au compteur de raids $RaidsTotal = $CurrentUser['raids'] + 1; if ($FleetResult == "a") { $RaidsWin = $CurrentUser['raidswin'] + 1; $QryUpdateRaidsCompteur = "UPDATE {{table}} SET "; $QryUpdateRaidsCompteur .= "`raidswin` ='" . $RaidsWin . "', "; $QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' "; $QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' "; $QryUpdateRaidsCompteur .= "LIMIT 1 ;"; doquery($QryUpdateRaidsCompteur, 'users'); } elseif ($FleetResult == "r" || $FleetResult == "w") { $RaidsLoose = $CurrentUser['raidsloose'] + 1; $QryUpdateRaidsCompteur = "UPDATE {{table}} SET "; $QryUpdateRaidsCompteur .= "`raidsloose` ='" . $RaidsLoose . "', "; $QryUpdateRaidsCompteur .= "`raids` ='" . $RaidsTotal . "' "; $QryUpdateRaidsCompteur .= "WHERE id = '" . $CurrentUserID . "' "; $QryUpdateRaidsCompteur .= "LIMIT 1 ;"; doquery($QryUpdateRaidsCompteur, 'users'); } // Colorisation du résumé de rapport pour l'attaquant $raport2 = "<a href # OnClick=\"f( 'rw.php?raport=" . $rid . "', '');\" >"; $raport2 .= "<center>"; if ($FleetResult == "a") { $raport2 .= "<font color=\"green\">"; } elseif ($FleetResult == "r") { $raport2 .= "<font color=\"orange\">"; } elseif ($FleetResult == "w") { $raport2 .= "<font color=\"red\">"; } $raport2 .= $lang['sys_mess_attack_report'] . " [" . $FleetRow['fleet_end_galaxy'] . ":" . $FleetRow['fleet_end_system'] . ":" . $FleetRow['fleet_end_planet'] . "] </font></a><br /><br />"; SendSimpleMessage($TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_mess_attack_report'], $raport2); } // Retour de flotte (s'il en reste) $fquery = ""; if ($FleetRow['fleet_end_time'] <= time()) { if (!is_null($CurrentSet)) { foreach ($CurrentSet as $Ship => $Count) { $fquery .= "`" . $resource[$Ship] . "` = `" . $resource[$Ship] . "` + '" . $Count['count'] . "', "; } } else { $fleet = explode(";", $FleetRow['fleet_array']); foreach ($fleet as $a => $b) { if ($b != '') { $a = explode(",", $b); $fquery .= "{$resource[$a[0]]}={$resource[$a[0]]} + {$a[1]}, \n"; } } } doquery("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); if (!($FleetResult == "w")) { $QryUpdatePlanet = "UPDATE {{table}} SET "; $QryUpdatePlanet .= $fquery; $QryUpdatePlanet .= "`metal` = `metal` + " . $FleetRow['fleet_resource_metal'] . ", "; $QryUpdatePlanet .= "`crystal` = `crystal` + " . $FleetRow['fleet_resource_crystal'] . ", "; $QryUpdatePlanet .= "`deuterium` = `deuterium` + " . $FleetRow['fleet_resource_deuterium'] . " "; $QryUpdatePlanet .= "WHERE "; $QryUpdatePlanet .= "`galaxy` = " . $FleetRow['fleet_start_galaxy'] . " AND "; $QryUpdatePlanet .= "`system` = " . $FleetRow['fleet_start_system'] . " AND "; $QryUpdatePlanet .= "`planet` = " . $FleetRow['fleet_start_planet'] . " AND "; $QryUpdatePlanet .= "`planet_type` = " . $FleetRow['fleet_start_type'] . " LIMIT 1 ;"; doquery($QryUpdatePlanet, 'planets'); } } } }
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 . ";"; PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time()); } } } } 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; } } $TabIndex = 0; $PageTable = ""; foreach ($lang['tech'] as $Element => $ElementName) { if ($Element > 400 && $Element <= 599) { if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) { $CanBuildOne = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, false); $BuildOneElementTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $Element); $ElementCount = $CurrentPlanet[$resource[$Element]]; $ElementNbre = $ElementCount == 0 ? "" : " (" . $lang['bd_available'] . pretty_number($ElementCount) . ")"; $PageTable .= "\n<tr>"; $PageTable .= "<th class=l>"; $PageTable .= "<a href=game." . $phpEx . "?page=infos&gid=" . $Element . ">"; $PageTable .= "<img border=0 src=\"" . $dpath . "gebaeude/" . $Element . ".gif\" align=top width=120 height=120></a>"; $PageTable .= "</th>"; $PageTable .= "<td class=l>"; $PageTable .= "<a href=game." . $phpEx . "?page=infos&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) { $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; $BuildIt = TRUE; if ($Element == 407 || $Element == 408 || $Element == 409) { $BuildIt = false; if ($Element == 407 && !$IsBuildp && $InQueue === FALSE) { $BuildIt = TRUE; } if ($Element == 408 && !$IsBuildg && $InQueue === FALSE) { $BuildIt = TRUE; } if ($Element == 409 && !$IsBuildpp && $InQueue === FALSE) { $BuildIt = TRUE; } } if (!$BuildIt) { $PageTable .= "<font color=\"red\">" . $lang['bd_protection_shield_only_one'] . "</font>"; } elseif ($NotBuilding) { $maxElements = $this->GetMaxConstructibleElements($Element, $CurrentPlanet); $maxElements = $maxElements > 0 ? '<br><input type="button" value="Σ" onclick="document.getElementById(\'fmenge' . $Element . '\').value = ' . $maxElements . ';"/>' : ''; $TabIndex++; $PageTable .= "<input type=text id=fmenge" . $Element . " name=fmenge[" . $Element . "] alt='" . $lang['tech'][$Element] . "' size=6 maxlength=6 value=0 tabindex=" . $TabIndex . ">" . $maxElements; } if ($NotBuilding) { $parse[build_defenses] = "<tr><td class=\"c\" colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"" . $lang['bd_build_defenses'] . "\"></td></tr>"; } } else { $PageTable .= "</th>"; } $PageTable .= "</tr>"; } } } if ($CurrentPlanet['b_hangar_id'] != '') { $BuildQueue .= $this->ElementBuildListBox($CurrentUser, $CurrentPlanet); } $parse['buildlist'] = $PageTable; $parse['buildinglist'] = $BuildQueue; display(parsetemplate(gettemplate('buildings/buildings_defense'), $parse)); }
* index.php * * @version 1.4 * @copyright 2008 by Anthony for XNova Redesigned */ define('INSIDE', true); define('INSTALL', false); define('ROOT_PATH', ''); include_once ROOT_PATH . 'common.php'; //Firstly, if not gonan be defined anywhere else $pageid = "overview"; //Template constants. define('GAME_SKIN', $user['skin']); define('PLANET_NAME', $planetrow['name']); define('USER_NAME', $user['username']); PlanetResourceUpdate($user, $planetrow, time()); //Skin config? $skin_config = @file(GAME_SKIN . "/config.txt"); if (substr($skin_config[0], 0, 26) == '!!--Skin Configuration--!!') { define('HEADER_CACHE', str_replace("{{skin}}", GAME_SKIN, $skin_config[2])); } else { define('HEADER_CACHE', './headerCache/'); } if ($_GET['iframe'] == '1') { include_once 'iframe.php'; } else { switch ($_GET['page']) { case 'admin': // -------------------------------------------------------------------------------------------------- $pageid = "preferences"; include ROOT_PATH . 'admin.php';
/** * 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); } // Aktualisieren der Planeten Ress PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time()); $NavigationTPL = gettemplate('topnav'); $dpath = !$CurrentUser["dpath"] ? DEFAULT_SKINPATH : $CurrentUser["dpath"]; $parse = $lang; $parse['dpath'] = $dpath; $parse['image'] = $CurrentPlanet['image']; // 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>"; } } if ($CurrentPlanet['energy_max'] == 0 && $CurrentPlanet['energy_used'] > 0) { $production_level = 0; } elseif ($CurrentPlanet['energy_max'] > 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) { $production_level = floor($CurrentPlanet['energy_max'] / abs($CurrentPlanet['energy_used']) * 100); } elseif ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) { $production_level = 0; } else { $production_level = 100; } if ($production_level > 100) { $production_level = 100; } $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 $parse['metal'] = pretty_number($CurrentPlanet["metal"]); $parse['metal_js'] = str_replace(".", "", pretty_number($CurrentPlanet["metal"])); if ($CurrentPlanet["metal"] >= $CurrentPlanet["metal_max"]) { $parse['metal_per_hour'] = 0; } else { $metal = abs(floor($CurrentPlanet['metal_perhour'] * 0.01 * $production_level)) + $game_config['metal_basic_income'] * $game_config['resource_multiplier']; $parse['metal_per_hour'] = $metal / 3600; } // Cristal $parse['crystal'] = pretty_number($CurrentPlanet["crystal"]); $parse['crystal_js'] = str_replace(".", "", pretty_number($CurrentPlanet["crystal"])); if ($CurrentPlanet["crystal"] >= $CurrentPlanet["crystal_max"]) { $parse['crystal_per_hour'] = 0; } else { $crystal = abs(floor($CurrentPlanet['crystal_perhour'] * 0.01 * $production_level)) + $game_config['crystal_basic_income'] * $game_config['resource_multiplier']; $parse['crystal_per_hour'] = $crystal / 3600; } // Deuterium $parse['deuterium'] = pretty_number($CurrentPlanet["deuterium"]); $parse['deuterium_js'] = str_replace(".", "", pretty_number($CurrentPlanet["deuterium"])); if ($CurrentPlanet["deuterium"] >= $CurrentPlanet["deuterium_max"]) { $parse['deuterium_per_hour'] = 0; } else { $deuterium = abs(floor($CurrentPlanet['deuterium_perhour'] * 0.01 * $production_level)) + $game_config['deuterium_basic_income'] * $game_config['resource_multiplier']; $parse['deuterium_per_hour'] = $deuterium / 3600; } // 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']); $parse['speed'] = $game_config['resource_multiplier']; // Metal maximum 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"] / 1) . " {$lang['']}</font>"; $parse['metal_max_js'] = str_replace(".", "", pretty_number($CurrentPlanet["metal_max"])); // Cristal maximum 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"] / 1) . " {$lang['']}</font>"; $parse['crystal_max_js'] = str_replace(".", "", pretty_number($CurrentPlanet["crystal_max"])); // Deuterium maximum 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"] / 1) . " {$lang['']}</font>"; $parse['deuterium_max_js'] = str_replace(".", "", pretty_number($CurrentPlanet["deuterium_max"])); // Message if ($CurrentUser['new_message'] > 0) { $parse['message'] = "<a href=\"?action=internalMessages\" style=\"text-decoration:blink\">[ " . $CurrentUser['new_message'] . " ]</a>"; } else { $parse['message'] = "0"; } // Le tout passe dans la template $TopBar = parsetemplate($NavigationTPL, $parse); } else { $TopBar = ""; } return $TopBar; }
/** * 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); } // Actualisation des ressources de la planete if ($CurrentUser['urlaubs_modus'] == 0) { PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time()); } else { //doquery ( "UPDATE {{table}} SET `last_update` = ".time()." WHERE id_owner = ".$CurrentUser['id'],"planets"); 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 bis ' . date('d.m.Y h:i:s', $CurrentUser['urlaubs_modus_time']) . '</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 = $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; } // JAVASCRIPT REALTIME RESS $parse['energy_total'] = colorNumber(pretty_number(floor($CurrentPlanet['energy_max'] + $CurrentPlanet["energy_used"]) - $parse['energy_basic_income'])); // Metal maximo if ($CurrentPlanet["metal_max"] * MAX_OVERFLOW < $CurrentPlanet["metal"]) { $parse['metal_max'] = '<font color="#ff0000">'; } else { $parse['metal_max'] = '<font color="#00ff00">'; } $parse['metal_max'] .= pretty_number($CurrentPlanet["metal_max"] / 1) . " {$lang['']}</font>"; // Cristal maximo if ($CurrentPlanet["crystal_max"] * MAX_OVERFLOW < $CurrentPlanet["crystal"]) { $parse['crystal_max'] = '<font color="#ff0000">'; } else { $parse['crystal_max'] = '<font color="#00ff00">'; } $parse['crystal_max'] .= pretty_number($CurrentPlanet["crystal_max"] / 1) . " {$lang['']}"; // Deuterio maximo if ($CurrentPlanet["deuterium_max"] * MAX_OVERFLOW < $CurrentPlanet["deuterium"]) { $parse['deuterium_max'] = '<font color="#ff0000">'; } else { $parse['deuterium_max'] = '<font color="#00ff00">'; } $parse['deuterium_max'] .= pretty_number($CurrentPlanet["deuterium_max"] / 1) . " {$lang['']}"; if ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) >= 0) { $plevel = 0; } elseif ($CurrentPlanet['energy_max'] > 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) { $plevel = floor($CurrentPlanet['energy_max'] / abs($CurrentPlanet['energy_used']) * 100); } elseif ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) { $plevel = 0; } else { $plevel = 100; } if ($plevel > 100) { $plevel = 100; } $parse['metal_perhour'] .= $CurrentPlanet['metal_perhour'] * 0.01 * $plevel + $game_config['metal_basic_income'] * $game_config['resource_multiplier']; $parse['crystal_perhour'] .= $CurrentPlanet['crystal_perhour'] * 0.01 * $plevel + $game_config['crystal_basic_income'] * $game_config['resource_multiplier']; $parse['deuterium_perhour'] .= $CurrentPlanet['deuterium_perhour'] * 0.01 * $plevel + $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; // JAVASCRIPT REALTIME RESS ENDE // Message if ($CurrentUser['new_message'] > 0) { $parse['message'] = "<a href=\"messages.php\">[ " . $CurrentUser['new_message'] . " ]</a>"; } else { $parse['message'] = "0"; } // Le tout passe dans la template $TopBar = parsetemplate($NavigationTPL, $parse); } else { $TopBar = ""; } return $TopBar; }
$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; // } $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); // Mise à jour de la cible ... PlanetResourceUpdate($targetUser, $targetPlanet, time()); // 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']; // AG : Mettre toutes les flottes dans un tableau $attackFleets = array(); // De forme : attackFleets[id] = array('fleet' => $FleetRow, 'user' => $user); if ($FleetRow['fleet_group'] != 0) { // Si c'est une AG $fleets = doquery('SELECT * FROM {{table}} WHERE fleet_group=' . $FleetRow['fleet_group'], 'fleets'); // Selection de toute les flottes composant l'AG 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();