function ShowPlanetMenu($CurrentUser) { global $dpath, $lang; $planets = SortUserPlanets($CurrentUser); while ($p = mysql_fetch_array($planets)) { if ($p["destruyed"] == 0) { $ct = $p["field_max"] + $p["terraformer"] * FIELDS_BY_TERRAFORMER; if ($p['planet_type'] == 3) { $ct = $p["field_max"]; } if ($p['b_building'] != 0) { UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser); if ($p['b_building'] != 0) { $BuildQueue = $p['b_building_id']; $QueueArray = explode(";", $BuildQueue); $CurrentBuild = explode(",", $QueueArray[0]); $BuildElement = $CurrentBuild[0]; $BuildLevel = $CurrentBuild[1]; $BuildRestTime = pretty_time($CurrentBuild[3] - time()); $construccion = "" . $lang['tech'][$BuildElement] . "<br>(Construyendo nivel " . $BuildLevel . ")<br>Tiempo restante:" . $BuildRestTime . ""; } else { CheckPlanetUsedFields($p); $construccion = $lang['ov_free']; } } else { $construccion = $lang['ov_free']; } $popup = "" . $p['name'] . " [" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]<br>Campos ocupados: " . $p['field_current'] . "/" . $ct . "<br>" . $construccion . ""; if ($t == 0) { $parse['mplanet'] .= "<th text-decoration:none>"; } if ($p['planet_type'] == 1 && $p["id"] != $CurrentUser["current_planet"]) { $parse['mplanet'] .= "<div align=center><a class=mplanet href=game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $p['id'] . "&mode=" . $_GET['mode'] . "&re=0 onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br><font color=#2E9AFE>" . $p['name'] . " </font><font color=#58FA58><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a>"; } elseif ($p['planet_type'] == 3 && $p["id"] != $CurrentUser["current_planet"]) { $parse['mplanet'] .= "<div align=center><a class=mplanet href=game.php?page={$_GET['page']}&gid={$_GET['gid']}&cp=" . $p['id'] . "&mode=" . $_GET['mode'] . "&re=0 onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br>" . $p['name'] . " (Luna) <font color=#58FA58><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a>"; } else { $parse['mplanet'] .= "<div align=center><a class=mplanet href=# onmouseover=\"return overlib('" . $popup . "', CENTER, OFFSETX, -80, OFFSETY, 20, WIDTH, 200)\" onmouseout=\"return nd();\"><img src=" . $dpath . "/planeten/" . $p['image'] . ".jpg border=0 height=78 width=78><br><font color=#FFFF00>" . $p['name'] . " </font><font color=#FE9A2E><br>[" . $p['galaxy'] . ":" . $p['system'] . ":" . $p['planet'] . "]</font></a></div>"; } if ($t == 6) { $parse['mplanet'] .= "</th>"; $t = 0; } else { $t = $t + 1; } } } $parse['mplanet'] .= "</center></table>"; return parsetemplate(gettemplate('planet_menu'), $parse); }
function ShowOverviewPage($CurrentUser, $CurrentPlanet) { global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user, $resource; include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx; include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx; $FlyingFleetsTable = new FlyingFleetsTable(); $lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentPlanet['id_owner'] . "' AND `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type`='3'", 'planets', true); if (empty($lunarow)) { unset($lunarow); } CheckPlanetUsedFields($lunarow); $parse = $lang; $parse['planet_id'] = $CurrentPlanet['id']; $parse['planet_name'] = $CurrentPlanet['name']; $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy']; $parse['galaxy_system'] = $CurrentPlanet['system']; $parse['galaxy_planet'] = $CurrentPlanet['planet']; $parse['dpath'] = $dpath; $parse['avatar'] = $user['avatar']; $online_users = doquery("SELECT COUNT(DISTINCT(id)) as `onlinenow` FROM {{table}} WHERE `onlinetime` > '" . (time() - 15 * 60) . "';", 'users', true); $parse['online_users'] = $online_users['onlinenow']; $QueryStat = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `stat_type` = '1'", "statpoints", true); $parse['puntos_defensa'] = pretty_number($QueryStat['defs_count']); $parse['puntos_edificios'] = pretty_number($QueryStat['build_points']); $parse['puntos_naves'] = pretty_number($QueryStat['fleet_count']); $parse['puntos_investigaciones'] = pretty_number($QueryStat['tech_count']); $StatRecord = doquery("SELECT `total_rank`,`total_points`,`defs_rank`,`build_rank`,`fleet_rank`,`tech_rank` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true); $parse['top_defensa'] = $StatRecord['defs_rank']; $parse['top_edificios'] = $StatRecord['build_rank']; $parse['top_naves'] = $StatRecord['fleet_rank']; $parse['top_investigaciones'] = $StatRecord['tech_rank']; $parse['top_total'] = $StatRecord['total_rank']; $parse['ally_name'] = $ally_name; $parse['ally_tag'] = $ally_tag; if ($Level > 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'] = ""; } switch ($_GET['mode']) { case 'renameplanet': if ($_POST['action'] == $lang['ov_planet_rename_action']) { $newname = mysql_escape_string(strip_tags(trim($_POST['newname']))); if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) { message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2); } if ($newname != "") { doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . $CurrentUser['current_planet'] . "' LIMIT 1;", "planets"); } } elseif ($_POST['action'] == $lang['ov_abandon_planet']) { return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse)); } elseif ($_POST['kolonieloeschen'] == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) { $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_owner = '{$user['id']}' AND fleet_start_galaxy='{$CurrentPlanet['galaxy']}' AND fleet_start_system='{$CurrentPlanet['system']}' AND fleet_start_planet='{$CurrentPlanet['planet']}'", 'fleets'); while ($satir = mysql_fetch_array($filokontrol)) { $kendifilo = $satir['fleet_owner']; $digerfilo = $satir['fleet_target_owner']; $harabeyeri = $satir['fleet_end_type']; $mess = $satir['fleet_mess']; } $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_target_owner = '{$user['id']}' AND fleet_end_galaxy='{$CurrentPlanet['galaxy']}' AND fleet_end_system='{$CurrentPlanet['system']}' AND fleet_end_planet='{$CurrentPlanet['planet']}'", 'fleets'); while ($satir = mysql_fetch_array($filokontrol)) { $kendifilo = $satir['fleet_owner']; $digerfilo = $satir['fleet_target_owner']; $gezoay = $satir['fleet_end_type']; $mess = $satir['fleet_mess']; } if ($kendifilo > 0) { message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet'); } elseif ($digerfilo > 0 && $mess < 1 && $gezoay != 2) { message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet'); } else { if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) { doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . mysql_real_escape_string($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets'); doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . mysql_real_escape_string($CurrentUser['id']) . "' LIMIT 1", "users"); doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = 3;", 'planets'); message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet'); } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) { message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet'); } else { message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet'); } } } return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse)); break; default: if ($StatRecord['total_points'] >= 0 && $StatRecord['total_points'] < 100000) { $parse['rankgame'] = "Soldado"; $parse['rankimg'] = "rank1.gif"; } elseif ($StatRecord['total_points'] >= 100000 && $StatRecord['total_points'] < 250000) { $parse['rankgame'] = "Cabo Cazador"; $parse['rankimg'] = "rank2.gif"; } elseif ($StatRecord['total_points'] >= 250000 && $StatRecord['total_points'] < 500000) { $parse['rankgame'] = "Sargento Cazador"; $parse['rankimg'] = "rank3.gif"; } elseif ($StatRecord['total_points'] >= 500000 && $StatRecord['total_points'] < 1000000) { $parse['rankgame'] = "Teniente de Crucero"; $parse['rankimg'] = "rank4.gif"; } elseif ($StatRecord['total_points'] >= 1000000 && $StatRecord['total_points'] < 2500000) { $parse['rankgame'] = "Capitán Destructor"; $parse['rankimg'] = "rank5.gif"; } elseif ($StatRecord['total_points'] >= 2500000 && $StatRecord['total_points'] < 5000000) { $parse['rankgame'] = "Almirante Acorazado"; $parse['rankimg'] = "rank6.gif"; } elseif ($StatRecord['total_points'] >= 5000000 && $StatRecord['total_points'] < 10000000) { $parse['rankgame'] = "General Estrella"; $parse['rankimg'] = "rank7.gif"; } elseif ($StatRecord['total_points'] >= 10000000 && $StatRecord['total_points'] < 25000000) { $parse['rankgame'] = "General Supernova"; $parse['rankimg'] = "rank8.gif"; } elseif ($StatRecord['total_points'] >= 25000000 && $StatRecord['total_points'] < 50000000) { $parse['rankgame'] = "General de Flota"; $parse['rankimg'] = "rank9.gif"; } elseif ($StatRecord['total_points'] >= 50000000 && $StatRecord['total_points'] < 100000000) { $parse['rankgame'] = "General Interestelar"; $parse['rankimg'] = "rank10.gif"; } elseif ($StatRecord['total_points'] >= 100000000 && $StatRecord['total_points'] < 500000000) { $parse['rankgame'] = "Cónsul General"; $parse['rankimg'] = "rank11.gif"; } elseif ($StatRecord['total_points'] >= 500000000) { $parse['rankgame'] = "Emperador"; $parse['rankimg'] = "rank12.gif"; } if ($CurrentPlanet['planet'] >= 1 && $CurrentPlanet['planet'] < 4) { $parse['type_of_planet'] = "Desertico"; } elseif ($CurrentPlanet['planet'] >= 4 && $CurrentPlanet['planet'] < 7) { $parse['type_of_planet'] = "Jungla"; } elseif ($CurrentPlanet['planet'] >= 7 && $CurrentPlanet['planet'] < 10) { $parse['type_of_planet'] = "Gaseoso"; } elseif ($CurrentPlanet['planet'] >= 10 && $CurrentPlanet['planet'] < 13) { $parse['type_of_planet'] = "Acuatico"; } elseif ($CurrentPlanet['planet'] >= 13) { $parse['type_of_planet'] = "Congelado"; } $CONSULTA = doquery("SELECT metal,crystal,darkmatter FROM {{table}} WHERE galaxy = '" . $CurrentPlanet['galaxy'] . "' AND system = '" . $CurrentPlanet['system'] . "' AND planet = '" . $CurrentPlanet['planet'] . "'", "galaxy", true); $parse['metal_debris'] = pretty_number($CONSULTA['metal']); $parse['crystal_debris'] = pretty_number($CONSULTA['crystal']); $parse['darkmatter_debris'] = pretty_number($CONSULTA['darkmatter']); if ($CurrentPlanet['recycler'] != 0 && ($CONSULTA['metal'] != 0 || $CONSULTA['crystal'] != 0 || $CONSULTA['darkmatter'] != 0)) { $parse['get_link'] = " (<a href=\"game.php?page=galaxy&mode=8&g=" . $CurrentPlanet['galaxy'] . "&s=" . $CurrentPlanet['system'] . "&p=" . $CurrentPlanet['planet'] . "&t=2\">asdasd</a>)"; } else { $parse['get_link'] = ''; } if ($CurrentUser['new_message'] != 0) { $Have_new_message .= "<tr>"; if ($CurrentUser['new_message'] == 1) { $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>"; } elseif ($CurrentUser['new_message'] > 1) { $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>"; $Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']); $Have_new_message .= "</a></th>"; } $Have_new_message .= "</tr>"; } $OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . $CurrentUser['id'] . "';", 'fleets'); $Record = 0; while ($FleetRow = mysql_fetch_array($OwnFleets)) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $id = $FleetRow['fleet_id']; $EndTime = $FleetRow['fleet_end_time']; /////// // ### LUCKY , CODES ARE BELOW $hedefgalaksi = $FleetRow['fleet_end_galaxy']; $hedefsistem = $FleetRow['fleet_end_system']; $hedefgezegen = $FleetRow['fleet_end_planet']; $mess = $FleetRow['fleet_mess']; $filogrubu = $FleetRow['fleet_group']; $id = $FleetRow['fleet_id']; ////// $Label = "fs"; if ($StartTime > time()) { $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record); } if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) { $Label = "ft"; if ($StayTime > time()) { $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record); } $Label = "fe"; if ($EndTime > time()) { $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record); } } } mysql_free_result($OwnFleets); //iss ye katilan filo//////////////////////////////////// // ### LUCKY , CODES ARE BELOW $dostfilo = doquery("SELECT * FROM {{table}} WHERE `fleet_end_galaxy` = '" . $hedefgalaksi . "' AND `fleet_end_system` = '" . $hedefsistem . "' AND `fleet_end_planet` = '" . $hedefgezegen . "' AND `fleet_group` = '" . $filogrubu . "';", 'fleets'); $Record1 = 0; while ($FleetRow = mysql_fetch_array($dostfilo)) { $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $id = $FleetRow['fleet_id']; $EndTime = $FleetRow['fleet_end_time']; /////// $hedefgalaksi = $FleetRow['fleet_end_galaxy']; $hedefsistem = $FleetRow['fleet_end_system']; $hedefgezegen = $FleetRow['fleet_end_planet']; $mess = $FleetRow['fleet_mess']; $filogrubu = $FleetRow['fleet_group']; $id = $FleetRow['fleet_id']; /////// if ($FleetRow['fleet_mission'] == 2 && $FleetRow['fleet_owner'] != $CurrentUser['id']) { $Record1++; // if (($FleetRow['fleet_mission'] == 2) ){ if ($mess > 0) { $StartTime = ""; } else { $StartTime = $FleetRow['fleet_start_time']; } if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record1); } // } } ///"" if ($FleetRow['fleet_mission'] == 1 && $FleetRow['fleet_owner'] != $CurrentUser['id'] && $filogrubu > 0) { $Record++; if ($mess > 0) { $StartTime = ""; } else { $StartTime = $FleetRow['fleet_start_time']; } if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record); } } } mysql_free_result($dostfilo); // ////////////////////////////////////////////////// $OtherFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . $CurrentUser['id'] . "';", 'fleets'); $Record = 2000; while ($FleetRow = mysql_fetch_array($OtherFleets)) { if ($FleetRow['fleet_owner'] != $CurrentUser['id']) { if ($FleetRow['fleet_mission'] != 8) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record); } if ($FleetRow['fleet_mission'] == 5) { $Label = "oft"; if ($StayTime > time()) { $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record); } } } } } mysql_free_result($OtherFleets); $planets_query = doquery("SELECT * FROM `{{table}}` WHERE id_owner='{$CurrentUser['id']}' AND `destruyed` = 0", "planets"); $Colone = 1; $AllPlanets = "<tr>"; while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) { if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) { $Coloneshow++; $AllPlanets .= "<th width='80'>" . $CurrentUserPlanet['name'] . "<br>"; $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".gif\" height=\"50\" width=\"50\"></a><br>"; $AllPlanets .= "<center>"; if ($CurrentUserPlanet['b_building'] != 0) { UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser); if ($CurrentUserPlanet['b_building'] != 0) { $BuildQueue = $CurrentUserPlanet['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($CurrentUserPlanet); $AllPlanets .= $lang['ov_free']; } } else { $AllPlanets .= $lang['ov_free']; } $AllPlanets .= "</center></th>"; if ($Colone <= 5) { $Colone++; } else { $AllPlanets .= "</tr><tr>"; $Colone = 1; } } } mysql_free_result($planets_query); $AllPlanets .= "</tr>"; if ($game_config['OverviewNewsFrame'] == '1') { $parse['NewsFrame'] = "<tr>" . $lang['ov_news_title'] . "<th colspan=\"4\">" . stripslashes($game_config['OverviewNewsText']) . "</th></tr>"; } if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 1 && $CurrentPlanet['planet_type'] != 3) { if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) { $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = '3'", 'planets', true); $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $moon['image'] . ".png\" height=\"90\" width=\"90\"></a>"; $parse['moon'] = $moon['name'] . ""; } else { $parse['moon_img'] = ""; $parse['moon'] = ""; } } elseif ($CurrentPlanet['planet_type'] == 3) { $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = '1'", 'planets', true); $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $moon['image'] . ".gif\" height=\"120\" width=\"120\"></a>"; $parse['moon'] = $moon['name'] . ""; } else { $parse['moon_img'] = ""; $parse['moon'] = ""; } $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']); $parse['planet_field_current'] = $CurrentPlanet['field_current']; $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet); $parse['planet_temp_min'] = $CurrentPlanet['temp_min']; $parse['planet_temp_max'] = $CurrentPlanet['temp_max']; $StatRecord = doquery("SELECT `total_rank`,`total_points` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true); $parse['user_username'] = $CurrentUser['username']; if (count($fpage) > 0) { ksort($fpage); foreach ($fpage as $time => $content) { $flotten .= $content . "\n"; } } // **** INICIA MOD {MOSTRAR TECNOLOGIA EN PROCESO EN VISTA GENERAL} **** if ($CurrentPlanet['b_building'] != 0) { include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $user); if ($CurrentPlanet['b_building'] != 0) { $BuildQueue = explode(";", $CurrentPlanet['b_building_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RestTime = $CurrentPlanet['b_building'] - time(); $PlanetID = $CurrentPlanet['id']; $Build = InsertBuildListScript("buildings"); $Build .= "<table>"; $Build .= " <tr>"; $Build .= " <td colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</td>"; $Build .= " </tr>"; $Build .= " <tr>"; $Build .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif\" width=\"40\" height=\"40\"></td>"; $Build .= " <td>" . $lang['pr_subiendo'] . " <span style=\"color:#FF8C00;\">Nivel " . $CurrBuild[1] . "</span><br />"; $Build .= " " . $lang['pr_duracion'] . ":<div id=\"blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Build .= " </td>"; $Build .= " </tr>"; $Build .= "</Table>"; $Build .= "\n<script language=\"JavaScript\">"; $Build .= "\n pp = \"" . $RestTime . "\";\n"; $Build .= "\n pk = \"" . 1 . "\";\n"; $Build .= "\n pm = \"cancel\";\n"; $Build .= "\n pl = \"" . $PlanetID . "\";\n"; $Build .= "\n t();\n"; $Build .= "\n</script>\n"; $parse['building'] = $Build; } else { $parse['building'] = $lang['ov_free']; } } else { $parse['building'] = $lang['ov_free']; } $PlanetaQueInv = doquery("SELECT id, name, b_tech, b_tech_id FROM `{{table}}` WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `b_tech` != '0';", 'planets', true); if ($PlanetaQueInv['b_tech'] != 0) { include $xgp_root . 'includes/functions/InsertTechListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $user); $NvlActual = $CurrentUser[$resource[$PlanetaQueInv['b_tech_id']]] + 1; $RestTime = $PlanetaQueInv['b_tech'] - time(); $PlanetID = $PlanetaQueInv['id']; $NomPlaneta = ""; if ($PlanetaQueInv['name'] != $CurrentPlanet['name']) { $NomPlaneta = " de " . $PlanetaQueInv['name']; } $Tech = InsertTechListScript("buildings", $NomPlaneta); $Tech .= "<table>"; $Tech .= " <tr>"; $Tech .= " <td colspan=\"2\">" . $lang['tech'][$PlanetaQueInv['b_tech_id']] . "</td>"; $Tech .= " </tr>"; $Tech .= " <tr>"; $Tech .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $PlanetaQueInv['b_tech_id'] . ".gif\" width=\"40\" height=\"40\"></td>"; $Tech .= " <td>" . $lang['pr_investigando'] . " <span style=\"color:#FF8C00;\">Nivel " . $NvlActual . "</span><br />"; $Tech .= " " . $lang['pr_duracion'] . ":<div id=\"tec_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Tech .= " </td>"; $Tech .= " </tr>"; $Tech .= "</Table>"; $Tech .= "\n<script language=\"JavaScript\">"; $Tech .= "\n tec_pp = \"" . $RestTime . "\";\n"; $Tech .= "\n tec_pk = \"" . 1 . "\";\n"; $Tech .= "\n tec_pm = \"cancel\";\n"; $Tech .= "\n tec_pl = \"" . $PlanetaQueInv['b_tech_id'] . "\";\n"; $Tech .= "\n tec_t();\n"; $Tech .= "\n</script>\n"; $parse['tech_en_proceso'] .= $Tech; } else { $parse['tech_en_proceso'] = $lang['ov_tfree']; } if ($CurrentPlanet['b_hangar'] != 0) { include $xgp_root . 'includes/functions/InsertHangarListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $user); $BuildQueue = explode(";", $CurrentPlanet['b_hangar_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RealTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $CurrBuild[0]); $QueueTime = $RealTime * $CurrBuild[1]; $RestTime = $QueueTime - $CurrentPlanet['b_hangar']; $PlanetID = $CurrentPlanet['id']; $Hangar = InsertHangarListScript("overview"); $Hangar .= "<table>"; $Hangar .= " <tr>"; $Hangar .= " <td colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</td>"; $Hangar .= " </tr>"; $Hangar .= " <tr>"; $Hangar .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif\" width=\"40\" height=\"40\"><br />"; $Hangar .= " </td>"; $Hangar .= " <td>" . $lang['pr_tiempo_prod'] . "<br />"; $Hangar .= " <div id=\"han_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Hangar .= " </td>"; $Hangar .= " </tr>"; $Hangar .= "</Table>"; $Hangar .= "\n<script language=\"JavaScript\">"; $Hangar .= "\n han_pp = \"" . $RestTime . "\";\n"; $Hangar .= "\n han_pk = \"" . 1 . "\";\n"; $Hangar .= "\n han_pm = \"cancel\";\n"; $Hangar .= "\n han_pl = \"" . $PlanetID . "\";\n"; $Hangar .= "\n han_t();\n"; $Hangar .= "\n</script>\n"; $parse['hangar_en_proceso'] .= $Hangar; } else { $parse['hangar_en_proceso'] = $lang['ov_hree']; } $parse['overview_produccion'] = parsetemplate(gettemplate('overview/overview_produccion'), $parse); // **** FIN MOD {MOSTRAR TECNOLOGIA EN PROCESO EN VISTA GENERAL} **** $parse['fleet_list'] = $flotten; $parse['Have_new_message'] = $Have_new_message; $parse['planet_image'] = $CurrentPlanet['image']; $parse['anothers_planets'] = $AllPlanets; $parse["dpath"] = $dpath; if ($game_config['stat'] == 0) { $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")"; } elseif ($game_config['stat'] == 1 && $CurrentUser['authlevel'] < $game_config['stat_level']) { $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")"; } else { $parse['user_rank'] = "-"; } setlocale(LC_ALL, 'es_ES'); $parse['date_time'] = date("D M j H:i:s", time()); if ($Level > 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 ($user["new_message"] != 0) { $color = "color=\"red\""; } else { $color = "color=\"white\""; } $parse["new_message"] = ' (<font size="1px" ' . $color . ' > ' . $user["new_message"] . ' </font>)'; return display(parsetemplate(gettemplate('overview/overview_body'), $parse)); break; } }
$parse['Have_new_level_raid'] = $HaveNewLevelRaid; $parse['time'] = "<div id=\"dateheure\"></div>"; $parse['dpath'] = $dpath; $parse['planet_image'] = $planetrow['image']; $parse['anothers_planets'] = $AllPlanets; $parse['max_users'] = $MaxUsers['count']; $parse['metal_debris'] = pretty_number($galaxyrow['metal']); $parse['crystal_debris'] = pretty_number($galaxyrow['crystal']); $parse['appolonium_debris'] = pretty_number($galaxyrow['appolonium']); if (($galaxyrow['metal'] != 0 || $galaxyrow['crystal'] != 0 || $galaxyrow['appolonium'] != 0) && $planetrow[$resource[219]] != 0 or $planetrow[$resource[209]] != 0) { $parse['get_link'] = " [<a href=\"quickfleet.php?mode=8&g=" . $galaxyrow['galaxy'] . "&s=" . $galaxyrow['system'] . "&p=" . $galaxyrow['planet'] . "&t=2\">" . $lang['type_mission'][8] . "</a>]"; } else { $parse['get_link'] = ''; } if ($planetrow['b_building'] != 0) { UpdatePlanetBatimentQueueList($planetrow, $user); if ($planetrow['b_building'] != 0) { $BuildQueue = explode(";", $planetrow['b_building_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RestTime = $planetrow['b_building'] - time(); $PlanetID = $planetrow['id']; $Build = countdown('gebaude', $RestTime); $Build2 = $lang['tech'][$CurrBuild[0]]; $parse['build'] = '<table cellspacing="0" cellpadding="0" style="width:100%;"> <tr><td class="sb" align="left" style="width:30%;" valign="top" ><img src="' . $dpath . 'gebaeude/' . $CurrBuild[0] . '.gif" style="width:40px; height:40px;" alt=""></td> <td class="sb" align="center" style="width:70%;" valign="middle" >' . $Build . ' </td></tr> <tr><td class="sb" align="center" style="width:30%;" valign="middle" ><img src="./styl/image/pfeile/rechto.png" alt=""></td> <td class="sb" align="left" style="width:70%;" valign="middle" >' . $Build2 . ' </td></tr> </table>'; } else { $parse['build'] = '<table cellspacing="0" style="width:100%;">
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 HandleEventQueue() { $lockname = "HandleEventQueue"; if (!get_lock($lockname)) { return; } $events = doquery("SELECT * FROM event_queue ORDER BY due_time LIMIT 5", 'NOTABLE'); while ($event = mysql_fetch_array($events)) { switch ($event['type']) { case "building": UpdatePlanetBatimentQueueList($event['id']); break; case "tech": break; default: assert(false); } } release_lock($lockname); }
function ShowOverviewPage($CurrentUser, $CurrentPlanet) { global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user; include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx; include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx; $FlyingFleetsTable = new FlyingFleetsTable(); $lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . intval($CurrentPlanet['id_owner']) . "' AND `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type`='3'", 'planets', true); if (empty($lunarow)) { unset($lunarow); } CheckPlanetUsedFields($lunarow); $parse = $lang; $parse['planet_id'] = $CurrentPlanet['id']; $parse['planet_name'] = $CurrentPlanet['name']; $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy']; $parse['galaxy_system'] = $CurrentPlanet['system']; $parse['galaxy_planet'] = $CurrentPlanet['planet']; switch ($_GET['mode']) { case 'renameplanet': if ($_POST['action'] == $lang['ov_planet_rename_action']) { $newname = mysql_escape_string(strip_tags(trim($_POST['newname']))); if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) { message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2); } if ($newname != "") { doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", "planets"); } } elseif ($_POST['action'] == $lang['ov_abandon_planet']) { return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse)); } elseif (intval($_POST['kolonieloeschen']) == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) { $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_owner = '" . intval($user['id']) . "' AND fleet_start_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_start_system='" . intval($CurrentPlanet['system']) . "' AND fleet_start_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets'); while ($satir = mysql_fetch_array($filokontrol)) { $kendifilo = $satir['fleet_owner']; $digerfilo = $satir['fleet_target_owner']; $harabeyeri = $satir['fleet_end_type']; $mess = $satir['fleet_mess']; } $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_target_owner = '" . intval($user['id']) . "' AND fleet_end_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_end_system='" . intval($CurrentPlanet['system']) . "' AND fleet_end_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets'); while ($satir = mysql_fetch_array($filokontrol)) { $kendifilo = $satir['fleet_owner']; $digerfilo = $satir['fleet_target_owner']; $gezoay = $satir['fleet_end_type']; $mess = $satir['fleet_mess']; } if ($kendifilo > 0) { message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet'); } elseif ($digerfilo > 0 && $mess < 1 && $gezoay != 2) { message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet'); } else { if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) { doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets'); doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . intval($CurrentUser['id']) . "' LIMIT 1", "users"); doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = 3;", 'planets'); message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet'); } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) { message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet'); } else { message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet'); } } } return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse)); break; default: if ($CurrentUser['new_message'] != 0) { $Have_new_message .= "<tr>"; if ($CurrentUser['new_message'] == 1) { $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>"; } elseif ($CurrentUser['new_message'] > 1) { $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>"; $Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']); $Have_new_message .= "</a></th>"; } $Have_new_message .= "</tr>"; } $OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets'); $Record = 0; while ($FleetRow = mysql_fetch_array($OwnFleets)) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $EndTime = $FleetRow['fleet_end_time']; /////// // ### LUCKY , CODES ARE BELOW $hedefgalaksi = $FleetRow['fleet_end_galaxy']; $hedefsistem = $FleetRow['fleet_end_system']; $hedefgezegen = $FleetRow['fleet_end_planet']; $mess = $FleetRow['fleet_mess']; $filogrubu = $FleetRow['fleet_group']; $id = $FleetRow['fleet_id']; ////// $Label = "fs"; if ($StartTime > time()) { $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record); } if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) { $Label = "ft"; if ($StayTime > time()) { $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record); } $Label = "fe"; if ($EndTime > time()) { $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record); } } /**fix fleet table return by jstar**/ if ($FleetRow['fleet_mission'] == 4 && $StartTime < time() && $EndTime > time()) { $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, "fjstar", $Record); } /**end fix**/ } mysql_free_result($OwnFleets); //iss ye katilan filo//////////////////////////////////// // ### LUCKY , CODES ARE BELOW $dostfilo = doquery("SELECT * FROM {{table}} WHERE `fleet_end_galaxy` = '" . intval($hedefgalaksi) . "' AND `fleet_end_system` = '" . intval($hedefsistem) . "' AND `fleet_end_planet` = '" . intval($hedefgezegen) . "' AND `fleet_group` = '" . intval($filogrubu) . "';", 'fleets'); $Record1 = 0; while ($FleetRow = mysql_fetch_array($dostfilo)) { $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $EndTime = $FleetRow['fleet_end_time']; /////// $hedefgalaksi = $FleetRow['fleet_end_galaxy']; $hedefsistem = $FleetRow['fleet_end_system']; $hedefgezegen = $FleetRow['fleet_end_planet']; $mess = $FleetRow['fleet_mess']; $filogrubu = $FleetRow['fleet_group']; $id = $FleetRow['fleet_id']; /////// if ($FleetRow['fleet_mission'] == 2 && $FleetRow['fleet_owner'] != $CurrentUser['id']) { $Record1++; // if (($FleetRow['fleet_mission'] == 2) ){ if ($mess > 0) { $StartTime = ""; } else { $StartTime = $FleetRow['fleet_start_time']; } if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record1); } // } } ///"" if ($FleetRow['fleet_mission'] == 1 && $FleetRow['fleet_owner'] != $CurrentUser['id'] && $filogrubu > 0) { $Record++; if ($mess > 0) { $StartTime = ""; } else { $StartTime = $FleetRow['fleet_start_time']; } if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record); } } } mysql_free_result($dostfilo); // ////////////////////////////////////////////////// $OtherFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets'); $Record = 2000; while ($FleetRow = mysql_fetch_array($OtherFleets)) { if ($FleetRow['fleet_owner'] != $CurrentUser['id']) { if ($FleetRow['fleet_mission'] != 8) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $id = $FleetRow['fleet_id']; if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record); } if ($FleetRow['fleet_mission'] == 5) { $Label = "oft"; if ($StayTime > time()) { $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record); } } } } } mysql_free_result($OtherFleets); $planets_query = doquery("SELECT * FROM `{{table}}` WHERE id_owner='" . intval($CurrentUser['id']) . "' AND `destruyed` = 0", "planets"); $Colone = 1; $AllPlanets = "<tr>"; while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) { if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) { $Coloneshow++; $AllPlanets .= "<th>" . $CurrentUserPlanet['name'] . "<br>"; $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".jpg\" height=\"50\" width=\"50\"></a><br>"; $AllPlanets .= "<center>"; if ($CurrentUserPlanet['b_building'] != 0) { UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser); if ($CurrentUserPlanet['b_building'] != 0) { $BuildQueue = $CurrentUserPlanet['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($CurrentUserPlanet); $AllPlanets .= $lang['ov_free']; } } else { $AllPlanets .= $lang['ov_free']; } $AllPlanets .= "</center></th>"; if ($Colone <= 1) { $Colone++; } else { $AllPlanets .= "</tr><tr>"; $Colone = 1; } } } mysql_free_result($planets_query); $AllPlanets .= "</tr>"; if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 1 && $CurrentPlanet['planet_type'] != 3) { if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) { $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = '3'", 'planets', true); $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/" . $moon['image'] . ".jpg\" height=\"50\" width=\"50\"></a>"; $parse['moon'] = $moon['name'] . " (" . $lang['fcm_moon'] . ")"; } else { $parse['moon_img'] = ""; $parse['moon'] = ""; } } else { $parse['moon_img'] = ""; $parse['moon'] = ""; } $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']); $parse['planet_field_current'] = $CurrentPlanet['field_current']; $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet); $parse['planet_temp_min'] = $CurrentPlanet['temp_min']; $parse['planet_temp_max'] = $CurrentPlanet['temp_max']; $StatRecord = doquery("SELECT `total_rank`,`total_points` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . intval($CurrentUser['id']) . "';", 'statpoints', true); $parse['user_username'] = $CurrentUser['username']; if (count($fpage) > 0) { ksort($fpage); foreach ($fpage as $time => $content) { $flotten .= $content . "\n"; } } if ($CurrentPlanet['b_building'] != 0) { include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $user); if ($CurrentPlanet['b_building'] != 0) { $BuildQueue = explode(";", $CurrentPlanet['b_building_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RestTime = $CurrentPlanet['b_building'] - time(); $PlanetID = $CurrentPlanet['id']; $Build = InsertBuildListScript("overview"); $Build .= $lang['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')'; $Build .= "<br /><div id=\"blc\" class=\"z\">" . pretty_time($RestTime) . "</div>"; $Build .= "\n<script language=\"JavaScript\">"; $Build .= "\n\tpp = \"" . $RestTime . "\";\n"; $Build .= "\n\tpk = \"" . 1 . "\";\n"; $Build .= "\n\tpm = \"cancel\";\n"; $Build .= "\n\tpl = \"" . $PlanetID . "\";\n"; $Build .= "\n\tt();\n"; $Build .= "\n</script>\n"; $parse['building'] = $Build; } else { $parse['building'] = $lang['ov_free']; } } else { $parse['building'] = $lang['ov_free']; } $parse['fleet_list'] = $flotten; $parse['Have_new_message'] = $Have_new_message; $parse['planet_image'] = $CurrentPlanet['image']; $parse['anothers_planets'] = $AllPlanets; $parse["dpath"] = $dpath; if ($game_config['stat'] == 0) { $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")"; } elseif ($game_config['stat'] == 1 && $CurrentUser['authlevel'] < $game_config['stat_level']) { $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")"; } else { $parse['user_rank'] = "-"; } $parse['date_time'] = date("D M j H:i:s", time()); return display(parsetemplate(gettemplate('overview/overview_body'), $parse)); break; } }
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); }
function ShowOverviewPage($CurrentUser, $CurrentPlanet) { global $svn_root, $phpEx, $dpath, $db, $lang, $planetrow, $users, $displays; $displays->assignContent('overview/overview'); include_once $svn_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx; include_once $svn_root . 'includes/functions/classes/class.FlyingFleetsTable.' . $phpEx; $FlyingFleetsTable = new FlyingFleetsTable(); $lunarow = $db->query("SELECT `id`,`name`,`image`,`destruyed` FROM {{table}}\r\n\t\t\t WHERE `id_owner` = '" . $CurrentPlanet['id_owner'] . "'\r\n\t\t\t AND `galaxy` = '" . $CurrentPlanet['galaxy'] . "'\r\n\t\t\t AND `system` = '" . $CurrentPlanet['system'] . "'\r\n\t\t\t AND `planet` = '" . $CurrentPlanet['planet'] . "'\r\n\t\t\t AND `planet_type`= '3';", 'planets', true); if (empty($lunarow)) { unset($lunarow); } CheckPlanetUsedFields($lunarow); $parse['planet_id'] = $CurrentPlanet['id']; $parse['planet_name'] = $CurrentPlanet['name']; $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy']; $parse['galaxy_system'] = $CurrentPlanet['system']; $parse['galaxy_planet'] = $CurrentPlanet['planet']; switch ($_GET['mode']) { case 'renameplanet': if ($_POST['newname']) { $parse['planet_name'] = mysql_escape_string(strip_tags(trim($_POST['newname']))); } foreach ($parse as $name => $trans) { $displays->assignGlobal($name, $trans); } if ($_POST['action'] == $lang['ov_planet_rename_action']) { $newname = mysql_escape_string(strip_tags(trim($_POST['newname']))); if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) { $displays->message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2); } if ($newname != "") { $db->query("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . $CurrentUser['current_planet'] . "' LIMIT 1;", "planets"); } } elseif ($_POST['action'] == $lang['ov_abandon_planet']) { $displays->newblock('deleted'); } elseif ($_POST['kolonieloeschen'] == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) { if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) { $db->query("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "'\r\n\t\t\t\t\t\tWHERE `id` = '" . mysql_real_escape_string($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets'); $db->query("UPDATE {{table}} SET `current_planet` = `id_planet`\r\n\t\t\t\t\t\tWHERE `id` = '" . mysql_real_escape_string($CurrentUser['id']) . "' LIMIT 1", "users"); $db->query("DELETE FROM {{table}}\r\n\t\t\t\t\t\tWHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "'\r\n\t\t\t\t\t\tAND `system` = '" . $CurrentPlanet['system'] . "'\r\n\t\t\t\t\t\tAND `planet` = '" . $CurrentPlanet['planet'] . "'\r\n\t\t\t\t\t\tAND `planet_type` = 3;", 'planets'); $db->query("UPDATE {{table}} SET `id_luna` = '0'\r\n\t\t\t\t\t\tWHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "'\r\n\t\t\t\t\t\tAND `system` = '" . $CurrentPlanet['system'] . "'\r\n\t\t\t\t\t\tAND `planet` = '" . $CurrentPlanet['planet'] . "';", 'galaxy'); $displays->message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet'); } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) { $displays->message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet'); } else { $displays->message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet'); } } $displays->newblock('renameplanet'); break; default: $displays->newblock('overview'); if ($CurrentUser["db_deaktjava"] == "1") { $parse["delete"] = "<tr><th colspan=4 ><h1>" . $lang["deleted"] . gmdate("j-m-y H:i:s", $CurrentUser["db_time"]) . "</h1></th></tr>"; } $noticias = explode(";;", $db->game_config["information"]); if ($noticias[0] == 1) { $displays->newblock('noticias'); $new = nl2br(stripslashes($noticias[1])); $new = str_replace(":name:", $CurrentUser['username'], $new); $new = str_replace(":server:", $db->game_config['game_name'], $new); $displays->assign('news', $new); } $OwnFleets = $db->query("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . $CurrentUser['id'] . "';", 'fleets'); $Record = 0; $fpage = array(); while ($FleetRow = mysql_fetch_array($OwnFleets)) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $EndTime = $FleetRow['fleet_end_time']; $Label = "fs"; if ($StartTime > time()) { $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record); } if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) { $Label = "ft"; if ($StayTime > time()) { $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record); } $Label = "fe"; if ($EndTime > time()) { $fpage[$EndTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record); } } } $OtherFleets = $db->query("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . $CurrentUser['id'] . "';", 'fleets'); $Record = 2000; while ($FleetRow = mysql_fetch_array($OtherFleets)) { if ($FleetRow['fleet_owner'] != $CurrentUser['id']) { if ($FleetRow['fleet_mission'] != 8) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record); } if ($FleetRow['fleet_mission'] == 5) { $Label = "oft"; if ($StayTime > time()) { $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record); } } } } } mysql_free_result($OtherFleets); $planets_query = $db->query("SELECT * FROM `{{table}}` WHERE id_owner='{$CurrentUser['id']}' AND `destruyed` = 0", "planets"); $Colone = 1; $PlanetaQueInv = array(); while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) { if ($CurrentUserPlanet["b_tech"] != 0) { $PlanetaQueInv['b_tech'] = $CurrentUserPlanet["b_tech"]; $PlanetaQueInv['b_tech_id'] = $CurrentUserPlanet["b_tech_id"]; $PlanetaQueInv['name'] = $CurrentUserPlanet["name"]; $PlanetaQueInv['id'] = $CurrentUserPlanet["id"]; } if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) { $Coloneshow++; $AllPlanets .= "<th>" . $CurrentUserPlanet['name'] . "<br>"; $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".jpg\" height=\"20\" width=\"20\"></a><br>"; $AllPlanets .= "<center>"; if ($CurrentUserPlanet['b_building'] != 0) { UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser); if ($CurrentUserPlanet['b_building'] != 0) { $BuildQueue = $CurrentUserPlanet['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($CurrentUserPlanet); $AllPlanets .= $lang['ov_free']; } } else { $AllPlanets .= $lang['ov_free']; } $AllPlanets .= "</center></th>"; if ($Coloneshow % 6 == 0) { $AllPlanets .= "</tr><tr>"; } } } if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 0 && $CurrentPlanet['planet_type'] != 3) { if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) { $displays->newblock('moon'); $displays->assign('moon_img', "<a href=\"game.php?page=overview&cp=" . $lunarow['id'] . "&re=0\" title=\"" . $lunarow['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $lunarow['image'] . ".png\" height=\"50\" width=\"50\"></a>"); $displays->assign('moon', $lunarow['name'] . " (" . $lang['fcm_moon'] . ")"); } } $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']); $parse['planet_field_current'] = $CurrentPlanet['field_current']; $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet); $parse['planet_temp_min'] = $CurrentPlanet['temp_min']; $parse['planet_temp_max'] = $CurrentPlanet['temp_max']; $parse['user_username'] = $CurrentUser['username']; if (count($fpage) > 0) { $flotten = ""; ksort($fpage); foreach ($fpage as $time => $content) { $flotten .= $content . "\n"; } } if ($CurrentPlanet['b_building'] != 0) { include $svn_root . 'includes/functions/InsertBuildListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $users->user); if ($CurrentPlanet['b_building'] != 0) { $BuildQueue = explode(";", $CurrentPlanet['b_building_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RestTime = $CurrentPlanet['b_building'] - time(); $PlanetID = $CurrentPlanet['id']; $Build = InsertBuildListScript("buildings"); $Build .= "<table>"; $Build .= " <tr>"; $Build .= " <th colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</th>"; $Build .= " </tr>"; $Build .= " <tr>"; $Build .= " <th class='anything' align=\"center\" style=\"background-image: url(" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif);background-repeat:no-repeat;width:60px; height:60;\" valign=\"middle\"></th>"; $Build .= " <th class='anything'>" . $lang['pr_subiendo'] . " <span style=\"color:#FF8C00;\">Nivel " . $CurrBuild[1] . "</span><br />"; $Build .= " " . $lang['pr_duracion'] . ":<div id=\"blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Build .= " </th>"; $Build .= " </tr>"; $Build .= "</Table>"; $Build .= "\n<script language=\"JavaScript\">"; $Build .= "\n\tpp = \"" . $RestTime . "\";\n"; $Build .= "\n\tpk = \"" . 1 . "\";\n"; $Build .= "\n\tpm = \"cancel\";\n"; $Build .= "\n\tpl = \"" . $PlanetID . "\";\n"; $Build .= "\n\tt();\n"; $Build .= "\n</script>\n"; $parse['building'] = $Build; } else { $parse['building'] = $lang['ov_free']; } } else { $parse['building'] = $lang['ov_free']; } if ($PlanetaQueInv['b_tech'] != 0 && $PlanetaQueInv['b_tech_id']) { global $resource; include $svn_root . 'includes/functions/InsertTechListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $users->user); $NvlActual = $CurrentUser[$resource[$PlanetaQueInv['b_tech_id']]] + 1; $RestTime = $PlanetaQueInv['b_tech'] - time(); $PlanetID = $PlanetaQueInv['id']; $NomPlaneta = ""; if ($PlanetaQueInv['name'] != $CurrentPlanet['name']) { $NomPlaneta = " de " . $PlanetaQueInv['name']; } $Tech = InsertTechListScript("buildings&mode=research", $NomPlaneta); $Tech .= "<table>"; $Tech .= " <tr>"; $Tech .= " <th colspan=\"2\">" . $lang['tech'][$PlanetaQueInv['b_tech_id']] . "</th>"; $Tech .= " </tr>"; $Tech .= " <tr>"; $Tech .= " <th class='anything' align=\"center\" style=\"background-image: url(" . $dpath . "gebaeude/" . $PlanetaQueInv['b_tech_id'] . ".gif);background-repeat:no-repeat;width:60px; height:60;\" valign=\"middle\"></th>"; $Tech .= " <th class='anything'>" . $lang['pr_investigando'] . " <span style=\"color:#FF8C00;\">Nivel " . $NvlActual . "</span><br />"; $Tech .= " " . $lang['pr_duracion'] . ":<div id=\"tec_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Tech .= " </th>"; $Tech .= " </tr>"; $Tech .= "</Table>"; $Tech .= "\n<script language=\"JavaScript\">"; $Tech .= "\n tec_pp = \"" . $RestTime . "\";\n"; $Tech .= "\n tec_pk = \"" . 1 . "\";\n"; $Tech .= "\n tec_pm = \"cancel\";\n"; $Tech .= "\n tec_pl = \"" . $PlanetaQueInv['b_tech_id'] . "\";\n"; $Tech .= "\n tec_t();\n"; $Tech .= "\n</script>\n"; unset($resource); $parse['tech_en_proceso'] .= $Tech; } else { $parse['tech_en_proceso'] = $lang['ov_free']; } if ($CurrentPlanet['b_hangar'] != 0) { include $svn_root . 'includes/functions/InsertHangarListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $users->user); $BuildQueue = explode(";", $CurrentPlanet['b_hangar_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RealTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $CurrBuild[0]); $QueueTime = $RealTime * $CurrBuild[1]; $RestTime = $QueueTime - $CurrentPlanet['b_hangar']; $PlanetID = $CurrentPlanet['id']; $Hangar = InsertHangarListScript("fleet"); $Hangar .= "<table>"; $Hangar .= " <tr>"; $Hangar .= " <th colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</th>"; $Hangar .= " </tr>"; $Hangar .= " <tr>"; $Hangar .= " <th class='anything' align=\"center\" style=\"background-image: url(" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif);background-repeat:no-repeat;width:60px; height:60;\" valign=\"middle\"><br />"; $Hangar .= " </th>"; $Hangar .= " <th class='anything'>" . $lang['pr_tiempo_prod'] . "<br />"; $Hangar .= " <div id=\"han_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Hangar .= " </th>"; $Hangar .= " </tr>"; $Hangar .= "</Table>"; $Hangar .= "\n<script language=\"JavaScript\">"; $Hangar .= "\n han_pp = \"" . $RestTime . "\";\n"; $Hangar .= "\n han_pk = \"" . 1 . "\";\n"; $Hangar .= "\n han_pm = \"cancel\";\n"; $Hangar .= "\n han_pl = \"" . $PlanetID . "\";\n"; $Hangar .= "\n han_t();\n"; $Hangar .= "\n</script>\n"; $parse['hangar_en_proceso'] .= $Hangar; } else { $parse['hangar_en_proceso'] = $lang['ov_free']; } // Usuarios conectados $OnlineUsers = $db->query("SELECT COUNT(DISTINCT id) as count FROM {{table}} WHERE onlinetime>='" . (time() - 15 * 60) . "'", 'users', 'true'); $parse['NumberMembersOnline'] = $OnlineUsers['count']; $parse['id'] = $CurrentPlanet['id']; $parse['fleet_list'] = $flotten; $parse['planet_image'] = $CurrentPlanet['image']; if (isset($AllPlanets)) { $displays->newblock('anothers_planets'); $displays->assign('anothers_planets', $AllPlanets); } $parse["dpath"] = $dpath; if ($db->game_config['stat'] == 0) { $parse['user_rank'] = pretty_number($users->user['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $users->user['total_rank'] . "\">" . $users->user['total_rank'] . "</a> " . $lang['ov_of'] . " " . $db->game_config['users_amount'] . ")"; } elseif ($db->game_config['stat'] == 1 && $CurrentUser['authlevel'] < $db->game_config['stat_level']) { $parse['user_rank'] = pretty_number($users->user['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $users->user['total_rank'] . "\">" . $users->user['total_rank'] . "</a> " . $lang['ov_of'] . " " . $db->game_config['users_amount'] . ")"; } else { $parse['user_rank'] = "-"; } setlocale(LC_ALL, 'es_ES.UTF-8/UTF-8'); $parse['date_time'] = strftime("Hoy es %A, %e de %B de %Y, son las %H:%M:%S", time()); //$url=explode("game.php",$_SERVER[HTTP_REFERER]); $url = dirname("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) . "/"; $parse['refer'] = '' . $url . 'index.php?ref=' . $users->user['username'] . ''; $displays->gotoBlock('overview'); foreach ($parse as $name => $trans) { $displays->assign($name, $trans); } break; } $displays->display("Overview"); }
function MissionCaseDestruction($FleetRow) { global $user, $phpEx, $ugamela_root_path, $pricelist, $lang, $resource, $CombatCaps; includeLang('system'); 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); } $QryGalaxyMoon = "SELECT * FROM {{table}} "; $QryGalaxyMoon .= "WHERE "; $QryGalaxyMoon .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryGalaxyMoon .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryGalaxyMoon .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "';"; $QryGalaxy = doquery($QryGalaxyMoon, 'galaxy', true); $QryTargetMoon = "SELECT * FROM {{table}} "; $QryTargetMoon .= "WHERE "; $QryTargetMoon .= "`galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND "; $QryTargetMoon .= "`system` = '" . $FleetRow['fleet_end_system'] . "' AND "; $QryTargetMoon .= "`planet` = '" . $FleetRow['fleet_end_planet'] . "' AND "; $QryTargetMoon .= "`planet_type` = '3';"; $TargetMoon = doquery($QryTargetMoon, 'planets', true); $TargetUserID = $TargetMoon['id_owner']; $TargerMoonID = $TargetMoon['id']; $MoonSize = $TargetMoon['diameter']; $MoonID = $TargetMoon['id']; $MoonName = $TargetMoon['name']; $QryCurrentUser = "******"; $QryCurrentUser .= "WHERE "; $QryCurrentUser .= "`id` = '" . $FleetRow['fleet_owner'] . "';"; $CurrentUser = doquery($QryCurrentUser, 'users', true); $CurrentUserID = $CurrentUser['id']; $QryTargetUser = "******"; $QryTargetUser .= "WHERE "; $QryTargetUser .= "`id` = '" . $TargetUserID . "';"; $TargetUser = doquery($QryTargetUser, 'users', true); $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 ($TargetMoon[$resource[$SetItem]] > 0) { $TargetSet[$SetItem]['count'] = $TargetMoon[$resource[$SetItem]]; } } $TheFleet = explode(";", $FleetRow['fleet_array']); foreach ($TheFleet as $a => $b) { if ($b != '') { $a = explode(",", $b); $CurrentSet[$a[0]]['count'] = $a[1]; } } UpdatePlanetBatimentQueueList($TargetMoon, $TargetUser); PlanetResourceUpdate($TargetUser, $TargetMoon, time()); //UPDATE PLANET RESOURCES 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; $Rips = 0; foreach ($CurrentSet as $Ship => $Count) { if ($Ship == '214') { $Rips += $Count['count']; } if ($Ship == '210') { $FleetStorage += 0; } else { $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"]; $TargetMoonUpd = ""; if (!is_null($TargetSet)) { foreach ($TargetSet as $Ship => $Count) { $TargetMoonUpd .= "`" . $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 = $TargetMoon['metal'] / 2; $crystal = $TargetMoon['crystal'] / 2; $deuter = $TargetMoon["deuterium"] / 2; if ($metal + $crystal + $deuter > $FleetStorage) { 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']; } } else { $Mining['metal'] = $metal; $Mining['crystal'] = $crystal; $Mining['deuter'] = $deuter; $FleetStorage = $FleetStorage - $Mining['metal'] - $Mining['crystal'] - $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 .= $TargetMoonUpd; $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` = '3' "; $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 / 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); } $GottenMoon = ""; $AttackDate = date("m-d H:i:s", $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 < 6) { // if($zniszczony == false){ $AttackWaveStat = sprintf($lang['sys_attack_attack_wave'], floor($b["atakujacy"]["count"]), floor($b["atakujacy"]["atak"]), floor($b["wrog"]["tarcza"])); $DefendWavaStat = sprintf($lang['sys_attack_defend_wave'], floor($b["wrog"]["count"]), 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); $RidMessage = "<br><br><center> reportID= " . $rid . "</center>"; $raport .= $RidMessage; $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); // 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=\"red\">"; } elseif ($FleetResult == "r") { $raport2 .= "<font color=\"orange\">"; } elseif ($FleetResult == "w") { $raport2 .= "<font color=\"green\">"; } $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); $RipsKilled = 0; $MoonDestroyed = 0; if ($FleetResult == "a" and $Rips > '0') { $MoonDestChance = round((100 - sqrt($MoonSize)) * sqrt($Rips)); if ($MoonDestChance > 99) { $MoonDestChance = 99; } $RipDestChance = round(sqrt($MoonSize) / 2); $UserChance = mt_rand(1, 100); if ($UserChance > 0 and $UserChance <= $MoonDestChance and $RipDestChance <= $MoonDestChance) { $RipsKilled = 0; $MoonDestroyed = 1; } elseif ($UserChance > 0 and $UserChance <= $RipDestChance) { $RipsKilled = 1; $MoonDestroyed = 0; } } if ($MoonDestroyed == 1) { $DeleteMoonQry2 = "DELETE FROM {{table}} WHERE `id` ='" . $TargerMoonID . "';"; doquery($DeleteMoonQry2, 'planets'); $QryUpdateGalaxy = "UPDATE {{table}} SET "; $QryUpdateGalaxy .= "`id_luna` = '0' "; $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'); //change return path for fleets sent from destroyed moon $QryFleetsFrom = doquery("SELECT * FROM {{table}} WHERE\n `fleet_start_galaxy` = '" . $FleetRow['fleet_end_galaxy'] . "' AND\n `fleet_start_system` = '" . $FleetRow['fleet_end_system'] . "' AND\n `fleet_start_planet` = '" . $FleetRow['fleet_end_planet'] . "' AND\n `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'); } $message = $lang['sys_moon_destroyed']; $message .= "<br><br>"; $message .= $lang['sys_chance_moon_destroy'] . $MoonDestChance . "%. <br>" . $lang['sys_chance_rips_destroy'] . $RipDestChance . "%"; SendSimpleMessage($CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_moon_destruction_report'], $message); SendSimpleMessage($TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_moon_destruction_report'], $message); } elseif ($RipsKilled == 1) { doquery("DELETE FROM {{table}} WHERE `fleet_id` = '" . $FleetRow["fleet_id"] . "';", 'fleets'); $FleetResult = "w"; $message = $lang['sys_rips_destroyed']; $message .= "<br><br>"; $message .= $lang['sys_chance_moon_destroy'] . $MoonDestChance . "%. <br>" . $lang['sys_chance_rips_destroy'] . $RipDestChance . "%"; SendSimpleMessage($CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_moon_destruction_report'], $message); SendSimpleMessage($TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_moon_destruction_report'], $message); } else { $message = $lang['sys_rips_come_back']; $message .= "<br>"; $message .= $lang['sys_chance_moon_destroy'] . $MoonDestChance . "%. <br>" . $lang['sys_chance_rips_destroy'] . $RipDestChance; SendSimpleMessage($CurrentUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_moon_destruction_report'], $message); SendSimpleMessage($TargetUserID, '', $FleetRow['fleet_start_time'], 3, $lang['sys_mess_tower'], $lang['sys_moon_destruction_report'], $message); } } // 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"; } } } 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'); doquery("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } doquery("DELETE FROM {{table}} WHERE `fleet_id` = " . $FleetRow["fleet_id"], 'fleets'); } } // return $FleetResult; }
function ShowOverviewPage($CurrentUser, $CurrentPlanet) { global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user, $resource; include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx; include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx; include_once $xgp_root . 'includes/functions/CheckPlanetUsedFields.' . $phpEx; $FlyingFleetsTable = new FlyingFleetsTable(); $lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . intval($CurrentPlanet['id_owner']) . "' AND `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type`='3'", 'planets', true); if (empty($lunarow)) { unset($lunarow); } CheckPlanetUsedFields($lunarow); $parse = $lang; $parse['id'] = $user['id']; $parse['planet_id'] = $CurrentPlanet['id']; $parse['planet_name'] = $CurrentPlanet['name']; $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy']; $parse['galaxy_system'] = $CurrentPlanet['system']; $parse['galaxy_planet'] = $CurrentPlanet['planet']; $parse['dpath'] = $dpath; $parse['avatar'] = $user['avatar']; $QueryStat = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `stat_type` = '1'", "statpoints", true); $parse['puntos_defensa'] = pretty_number($QueryStat['defs_count']); $parse['puntos_edificios'] = pretty_number($QueryStat['build_points']); $parse['puntos_naves'] = pretty_number($QueryStat['fleet_count']); $parse['puntos_investigaciones'] = pretty_number($QueryStat['tech_count']); $StatRecord = doquery("SELECT `total_rank`,`total_points`,`defs_rank`,`build_rank`,`fleet_rank`,`tech_rank` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true); $parse['top_defensa'] = $StatRecord['defs_rank']; $parse['top_edificios'] = $StatRecord['build_rank']; $parse['top_naves'] = $StatRecord['fleet_rank']; $parse['top_investigaciones'] = $StatRecord['tech_rank']; switch ($_GET['mode']) { case 'renameplanet': if ($_POST['action'] == $lang['ov_planet_rename_action']) { $newname = mysql_escape_string(strip_tags(trim($_POST['newname']))); if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) { message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2); } if ($newname != "") { doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", "planets"); } } elseif ($_POST['action'] == $lang['ov_abandon_planet']) { return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse)); } elseif (intval($_POST['kolonieloeschen']) == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) { $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_owner = '" . intval($user['id']) . "' AND fleet_start_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_start_system='" . intval($CurrentPlanet['system']) . "' AND fleet_start_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets'); while ($satir = mysql_fetch_array($filokontrol)) { $kendifilo = $satir['fleet_owner']; $digerfilo = $satir['fleet_target_owner']; $harabeyeri = $satir['fleet_end_type']; $mess = $satir['fleet_mess']; } $filokontrol = doquery("SELECT * FROM {{table}} WHERE fleet_target_owner = '" . intval($user['id']) . "' AND fleet_end_galaxy='" . intval($CurrentPlanet['galaxy']) . "' AND fleet_end_system='" . intval($CurrentPlanet['system']) . "' AND fleet_end_planet='" . intval($CurrentPlanet['planet']) . "'", 'fleets'); while ($satir = mysql_fetch_array($filokontrol)) { $kendifilo = $satir['fleet_owner']; $digerfilo = $satir['fleet_target_owner']; $gezoay = $satir['fleet_end_type']; $mess = $satir['fleet_mess']; } if ($kendifilo > 0) { message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet'); } elseif ($digerfilo > 0 && $mess < 1 && $gezoay != 2) { message($lang['ov_abandon_planet_not_possible'], 'game.php?page=overview&mode=renameplanet'); } else { if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) { doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . intval($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets'); doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . intval($CurrentUser['id']) . "' LIMIT 1", "users"); doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = 3;", 'planets'); message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet'); } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) { message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet'); } else { message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet'); } } } return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse)); break; default: $CONSULTA = doquery("SELECT metal,crystal FROM {{table}} WHERE galaxy = '" . $CurrentPlanet['galaxy'] . "' AND system = '" . $CurrentPlanet['system'] . "' AND planet = '" . $CurrentPlanet['planet'] . "'", "galaxy", true); $parse['metal_debris'] = pretty_number($CONSULTA['metal']); $parse['crystal_debris'] = pretty_number($CONSULTA['crystal']); if ($CurrentPlanet['recycler'] != 0 && ($CONSULTA['metal'] != 0 || $CONSULTA['crystal'] != 0)) { $parse['get_link'] = " (<a href=\"game.php?page=galaxy&mode=8&g=" . $CurrentPlanet['galaxy'] . "&s=" . $CurrentPlanet['system'] . "&p=" . $CurrentPlanet['planet'] . "&t=2\"> DF </a>)"; } else { $parse['get_link'] = ''; } if ($CurrentUser['new_message'] != 0) { $Have_new_message .= "<tr>"; if ($CurrentUser['new_message'] == 1) { $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>"; } elseif ($CurrentUser['new_message'] > 1) { $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>"; $Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']); $Have_new_message .= "</a></th>"; } $Have_new_message .= "</tr>"; } $OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets'); $Record = 0; while ($FleetRow = mysql_fetch_array($OwnFleets)) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $EndTime = $FleetRow['fleet_end_time']; /////// // ### LUCKY , CODES ARE BELOW $hedefgalaksi = $FleetRow['fleet_end_galaxy']; $hedefsistem = $FleetRow['fleet_end_system']; $hedefgezegen = $FleetRow['fleet_end_planet']; $mess = $FleetRow['fleet_mess']; $filogrubu = $FleetRow['fleet_group']; $id = $FleetRow['fleet_id']; ////// $Label = "fs"; if ($StartTime > time()) { $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record); } if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) { $Label = "ft"; if ($StayTime > time()) { $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record); } $Label = "fe"; if ($EndTime > time()) { $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record); } } /**fix fleet table return by jstar**/ if ($FleetRow['fleet_mission'] == 4 && $StartTime < time() && $EndTime > time()) { $fpage[$EndTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, "fjstar", $Record); } /**end fix**/ } mysql_free_result($OwnFleets); //iss ye katilan filo//////////////////////////////////// // ### LUCKY , CODES ARE BELOW $dostfilo = doquery("SELECT * FROM {{table}} WHERE `fleet_end_galaxy` = '" . intval($hedefgalaksi) . "' AND `fleet_end_system` = '" . intval($hedefsistem) . "' AND `fleet_end_planet` = '" . intval($hedefgezegen) . "' AND `fleet_group` = '" . intval($filogrubu) . "';", 'fleets'); $Record1 = 0; while ($FleetRow = mysql_fetch_array($dostfilo)) { $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $EndTime = $FleetRow['fleet_end_time']; /////// $hedefgalaksi = $FleetRow['fleet_end_galaxy']; $hedefsistem = $FleetRow['fleet_end_system']; $hedefgezegen = $FleetRow['fleet_end_planet']; $mess = $FleetRow['fleet_mess']; $filogrubu = $FleetRow['fleet_group']; $id = $FleetRow['fleet_id']; /////// if ($FleetRow['fleet_mission'] == 2 && $FleetRow['fleet_owner'] != $CurrentUser['id']) { $Record1++; // if (($FleetRow['fleet_mission'] == 2) ){ if ($mess > 0) { $StartTime = ""; } else { $StartTime = $FleetRow['fleet_start_time']; } if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record1); } // } } ///"" if ($FleetRow['fleet_mission'] == 1 && $FleetRow['fleet_owner'] != $CurrentUser['id'] && $filogrubu > 0) { $Record++; if ($mess > 0) { $StartTime = ""; } else { $StartTime = $FleetRow['fleet_start_time']; } if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record); } } } mysql_free_result($dostfilo); // ////////////////////////////////////////////////// //nome da aliança $ally_id = $user['ally_id']; if ($ally_id) { $allydata = doquery("SELECT `ally_name` FROM {{table}} WHERE `id` = '" . $ally_id . "'", "alliance", true); if ($allydata['ally_name'] != '') { $parse['ally_name'] = $allydata['ally_name']; } else { $parse['ally_name'] = "You dont have any alliance"; } } else { $parse['ally_name'] = "You dont have any alliance"; } ////////////////////////////////////////////////// //Administración overview $OnlineAdmins = doquery("SELECT * FROM {{table}} WHERE onlinetime>='" . (time() - 10 * 60) . "' AND authlevel>=1", 'users'); if ($OnlineAdmins) { $parse['OnlineAdmins'] = ""; while ($oas = mysql_fetch_array($OnlineAdmins)) { $parse['OnlineAdmins'] .= "<a href=\"game.php?page=messages&mode=write&id=" . $oas['id'] . "\" >" . $oas['username'] . "</a> • "; } if ($parse['OnlineAdmins'] == "") { $parse['OnlineAdmins'] = "--"; } } //Administración overview $OtherFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . intval($CurrentUser['id']) . "';", 'fleets'); $Record = 2000; while ($FleetRow = mysql_fetch_array($OtherFleets)) { if ($FleetRow['fleet_owner'] != $CurrentUser['id']) { if ($FleetRow['fleet_mission'] != 8) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $id = $FleetRow['fleet_id']; if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record); } if ($FleetRow['fleet_mission'] == 5) { $Label = "oft"; if ($StayTime > time()) { $fpage[$StayTime . $id] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record); } } } } } mysql_free_result($OtherFleets); $planets_query = doquery("SELECT * FROM `{{table}}` WHERE id_owner='" . intval($CurrentUser['id']) . "' AND `destruyed` = 0", "planets"); $Colone = 1; $AllPlanets = "<tr>"; while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) { if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) { $Coloneshow++; $AllPlanets .= "<th>" . $CurrentUserPlanet['name'] . "<br>"; $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".jpg\" height=\"50\" width=\"50\"></a><br>"; $AllPlanets .= "<center>"; if ($CurrentUserPlanet['b_building'] != 0) { UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser); if ($CurrentUserPlanet['b_building'] != 0) { $BuildQueue = $CurrentUserPlanet['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($CurrentUserPlanet); $AllPlanets .= $lang['ov_free']; } } else { $AllPlanets .= $lang['ov_free']; } $AllPlanets .= "</center></th>"; if ($Colone <= 9) { $Colone++; } else { $AllPlanets .= "</tr><tr>"; $Colone = 0; } } } mysql_free_result($planets_query); $AllPlanets .= "</tr>"; if ($game_config['OverviewNewsFrame'] == '1') { $parse['NewsFrame'] = "<tr>" . $lang['ov_news_title'] . "<th colspan=\"4\">" . stripslashes($game_config['OverviewNewsText']) . "</th></tr>"; } if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 1 && $CurrentPlanet['planet_type'] != 3) { if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) { $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . intval($CurrentPlanet['galaxy']) . "' AND `system` = '" . intval($CurrentPlanet['system']) . "' AND `planet` = '" . intval($CurrentPlanet['planet']) . "' AND `planet_type` = '3'", 'planets', true); $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/" . $moon['image'] . ".jpg\" height=\"50\" width=\"50\"></a>"; $parse['moon'] = $moon['name'] . " (" . $lang['fcm_moon'] . ")"; } else { $parse['moon_img'] = ""; $parse['moon'] = ""; } } else { $parse['moon_img'] = ""; $parse['moon'] = ""; } $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']); $parse['planet_field_current'] = $CurrentPlanet['field_current']; $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet); $parse['planet_temp_min'] = $CurrentPlanet['temp_min']; $parse['planet_temp_max'] = $CurrentPlanet['temp_max']; // Gouvernement $staatsform = $user['staatsform']; if ($staatsform == 2) { $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n <th colspan=\"2\">Forma de gobierno:</th>\r\n <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['demokratie'] . "</a></th>\r\n</tr>"; } elseif ($staatsform == 3) { $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n <th colspan=\"2\">Forma de gobierno:</th>\r\n <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['monarchie'] . "</a></th>\r\n</tr>"; } elseif ($staatsform == 4) { $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n <th colspan=\"2\">Forma de gobierno:</th>\r\n <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['diktatur'] . "</a></th>\r\n</tr>"; } elseif ($staatsform == 5) { $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n <th colspan=\"2\">Forma de gobierno:</th>\r\n <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['imperialisme'] . "</a></th>\r\n</tr>"; } elseif ($staatsform == 6) { $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n <th colspan=\"2\">Forma de gobierno:</th>\r\n <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['aristocratie'] . "</a></th>\r\n</tr>"; } else { $parse['STAATSFORM_LINK'] = "\r\n<tr><center>\r\n <th colspan=\"2\">Forma de gobierno:</th>\r\n <th colspan=\"2\"><a href=\"game.php?page=gouv\" accesskey=\"d\" style=\"font-size:100%\">" . $lang['barbarisch'] . "</a></th>\r\n</tr>"; } if ($user['humano'] == 1) { $parse['race'] = 'Raza: Humano'; $parse['imgrace'] = 'images/human.gif'; } else { if ($user['vampiro'] == 1) { $parse['race'] = 'Raza: Vampiro'; $parse['imgrace'] = 'images/vampiro.gif'; } else { if ($user['lobo'] == 1) { $parse['race'] = 'Raza : Lobo'; $parse['imgrace'] = 'images/lobo.gif'; } else { if ($user['asgard'] == 1) { $parse['race'] = 'Raza : Asgard'; $parse['imgrace'] = 'images/asgard.gif'; } } } } $StatRecord = doquery("SELECT `total_rank`,`total_points` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . intval($CurrentUser['id']) . "';", 'statpoints', true); $parse['user_username'] = $CurrentUser['username']; if (count($fpage) > 0) { ksort($fpage); foreach ($fpage as $time => $content) { $flotten .= $content . "\n"; } } // **** INICIA MOD {MOSTRAR TECNOLOGIA EN PROCESO EN VISTA GENERAL} **** if ($CurrentPlanet['b_building'] != 0) { include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $user); if ($CurrentPlanet['b_building'] != 0) { $BuildQueue = explode(";", $CurrentPlanet['b_building_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RestTime = $CurrentPlanet['b_building'] - time(); $PlanetID = $CurrentPlanet['id']; $Build = InsertBuildListScript("buildings"); $Build .= "<table>"; $Build .= " <tr>"; $Build .= " <td colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</td>"; $Build .= " </tr>"; $Build .= " <tr>"; $Build .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif\" width=\"40\" height=\"40\"></td>"; $Build .= " <td>" . $lang['pr_subiendo'] . " <span style=\"color:#FF8C00;\">Nivel " . $CurrBuild[1] . "</span><br />"; $Build .= " " . $lang['pr_duracion'] . ":<div id=\"blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Build .= " </td>"; $Build .= " </tr>"; $Build .= "</Table>"; $Build .= "\n<script language=\"JavaScript\">"; $Build .= "\n pp = \"" . $RestTime . "\";\n"; $Build .= "\n pk = \"" . 1 . "\";\n"; $Build .= "\n pm = \"cancel\";\n"; $Build .= "\n pl = \"" . $PlanetID . "\";\n"; $Build .= "\n t();\n"; $Build .= "\n</script>\n"; $parse['building'] = $Build; } else { $parse['building'] = $lang['ov_free']; } } else { $parse['building'] = $lang['ov_free']; } $PlanetaQueInv = doquery("SELECT id, name, b_tech, b_tech_id FROM `{{table}}` WHERE `id_owner` = '" . $CurrentUser['id'] . "' AND `b_tech` != '0';", 'planets', true); if ($PlanetaQueInv['b_tech'] != 0) { include $xgp_root . 'includes/functions/InsertTechListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $user); $NvlActual = $CurrentUser[$resource[$PlanetaQueInv['b_tech_id']]] + 1; $RestTime = $PlanetaQueInv['b_tech'] - time(); $PlanetID = $PlanetaQueInv['id']; $NomPlaneta = ""; if ($PlanetaQueInv['name'] != $CurrentPlanet['name']) { $NomPlaneta = " de " . $PlanetaQueInv['name']; } $Tech = InsertTechListScript("buildings", $NomPlaneta); $Tech .= "<table>"; $Tech .= " <tr>"; $Tech .= " <td colspan=\"2\">" . $lang['tech'][$PlanetaQueInv['b_tech_id']] . "</td>"; $Tech .= " </tr>"; $Tech .= " <tr>"; $Tech .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $PlanetaQueInv['b_tech_id'] . ".gif\" width=\"40\" height=\"40\"></td>"; $Tech .= " <td>" . $lang['pr_investigando'] . " <span style=\"color:#FF8C00;\">Nivel " . $NvlActual . "</span><br />"; $Tech .= " " . $lang['pr_duracion'] . ":<div id=\"tec_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Tech .= " </td>"; $Tech .= " </tr>"; $Tech .= "</Table>"; $Tech .= "\n<script language=\"JavaScript\">"; $Tech .= "\n tec_pp = \"" . $RestTime . "\";\n"; $Tech .= "\n tec_pk = \"" . 1 . "\";\n"; $Tech .= "\n tec_pm = \"cancel\";\n"; $Tech .= "\n tec_pl = \"" . $PlanetaQueInv['b_tech_id'] . "\";\n"; $Tech .= "\n tec_t();\n"; $Tech .= "\n</script>\n"; $parse['tech_en_proceso'] .= $Tech; } else { $parse['tech_en_proceso'] = $lang['ov_free']; } if ($CurrentPlanet['b_hangar'] != 0) { include $xgp_root . 'includes/functions/InsertHangarListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $user); $BuildQueue = explode(";", $CurrentPlanet['b_hangar_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RealTime = GetBuildingTime($CurrentUser, $CurrentPlanet, $CurrBuild[0]); $QueueTime = $RealTime * $CurrBuild[1]; $RestTime = $QueueTime - $CurrentPlanet['b_hangar']; $PlanetID = $CurrentPlanet['id']; $Hangar = InsertHangarListScript("overview"); $Hangar .= "<table>"; $Hangar .= " <tr>"; $Hangar .= " <td colspan=\"2\">" . $lang['tech'][$CurrBuild[0]] . "</td>"; $Hangar .= " </tr>"; $Hangar .= " <tr>"; $Hangar .= " <td align=\"center\" valign=\"middle\"><img src=\"" . $dpath . "gebaeude/" . $CurrBuild[0] . ".gif\" width=\"40\" height=\"40\"><br />"; $Hangar .= " </td>"; $Hangar .= " <td>" . $lang['pr_tiempo_prod'] . "<br />"; $Hangar .= " <div id=\"han_blc\" class=\"z\" style=\"color:yellow;\">" . pretty_time($RestTime) . "</div>"; $Hangar .= " </td>"; $Hangar .= " </tr>"; $Hangar .= "</Table>"; $Hangar .= "\n<script language=\"JavaScript\">"; $Hangar .= "\n han_pp = \"" . $RestTime . "\";\n"; $Hangar .= "\n han_pk = \"" . 1 . "\";\n"; $Hangar .= "\n han_pm = \"cancel\";\n"; $Hangar .= "\n han_pl = \"" . $PlanetID . "\";\n"; $Hangar .= "\n han_t();\n"; $Hangar .= "\n</script>\n"; $parse['hangar_en_proceso'] .= $Hangar; } else { $parse['hangar_en_proceso'] = $lang['ov_free']; } $parse['overview_produccion'] = parsetemplate(gettemplate('overview/overview_produccion'), $parse); // **** FIN MOD {MOSTRAR TECNOLOGIA EN PROCESO EN VISTA GENERAL} **** $parse['fleet_list'] = $flotten; $parse['Have_new_message'] = $Have_new_message; $parse['planet_image'] = $CurrentPlanet['image']; $parse['anothers_planets'] = $AllPlanets; $parse["dpath"] = $dpath; if ($game_config['stat'] == 0) { $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")"; } elseif ($game_config['stat'] == 1 && $CurrentUser['authlevel'] < $game_config['stat_level']) { $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")"; } else { $parse['user_rank'] = "-"; } $parse['date_time'] = date("D M j H:i:s", time()); // Rajout d'une barre pourcentage // Calcul du pourcentage de remplissage $parse['case_pourcentage'] = floor($planetrow["field_current"] / CalculateMaxPlanetFields($planetrow) * 100) . $lang['o/o']; // Barre de remplissage $parse['case_barre'] = floor($planetrow["field_current"] / CalculateMaxPlanetFields($planetrow) * 101) * 4.1; // Couleur de la barre de remplissage if ($parse['case_barre'] > 100 * 4.0) { $parse['case_barre'] = 400; $parse['case_barre_barcolor'] = '#C00000'; } elseif ($parse['case_barre'] > 80 * 4.0) { $parse['case_barre_barcolor'] = '#C0C000'; } else { $parse['case_barre_barcolor'] = '#00C000'; } if ($StatRecord['total_points'] >= 0 && $StatRecord['total_points'] < 100000) { $parse['rankgame'] = "Soldado"; $parse['rankimg'] = "rank1.gif"; } elseif ($StatRecord['total_points'] >= 100000 && $StatRecord['total_points'] < 250000) { $parse['rankgame'] = "Cabo Cazador"; $parse['rankimg'] = "rank2.gif"; } elseif ($StatRecord['total_points'] >= 250000 && $StatRecord['total_points'] < 500000) { $parse['rankgame'] = "Sargento Cazador"; $parse['rankimg'] = "rank3.gif"; } elseif ($StatRecord['total_points'] >= 500000 && $StatRecord['total_points'] < 1000000) { $parse['rankgame'] = "Teniente de Crucero"; $parse['rankimg'] = "rank4.gif"; } elseif ($StatRecord['total_points'] >= 1000000 && $StatRecord['total_points'] < 2500000) { $parse['rankgame'] = "Capitán Destructor"; $parse['rankimg'] = "rank5.gif"; } elseif ($StatRecord['total_points'] >= 2500000 && $StatRecord['total_points'] < 5000000) { $parse['rankgame'] = "Almirante Acorazado"; $parse['rankimg'] = "rank6.gif"; } elseif ($StatRecord['total_points'] >= 5000000 && $StatRecord['total_points'] < 10000000) { $parse['rankgame'] = "General Estrella"; $parse['rankimg'] = "rank7.gif"; } elseif ($StatRecord['total_points'] >= 10000000 && $StatRecord['total_points'] < 25000000) { $parse['rankgame'] = "General Supernova"; $parse['rankimg'] = "rank8.gif"; } elseif ($StatRecord['total_points'] >= 25000000 && $StatRecord['total_points'] < 50000000) { $parse['rankgame'] = "General de Flota"; $parse['rankimg'] = "rank9.gif"; } elseif ($StatRecord['total_points'] >= 50000000 && $StatRecord['total_points'] < 100000000) { $parse['rankgame'] = "General Interestelar"; $parse['rankimg'] = "rank10.gif"; } elseif ($StatRecord['total_points'] >= 100000000 && $StatRecord['total_points'] < 500000000) { $parse['rankgame'] = "Cónsul General"; $parse['rankimg'] = "rank11.gif"; } elseif ($StatRecord['total_points'] >= 500000000) { $parse['rankgame'] = "Emperador"; $parse['rankimg'] = "rank12.gif"; } return display(parsetemplate(gettemplate('overview/overview_body'), $parse)); break; } }
function ShowOverviewPage($CurrentUser, $CurrentPlanet) { global $xgp_root, $phpEx, $dpath, $game_config, $lang, $planetrow, $user; include_once $xgp_root . 'includes/functions/InsertJavaScriptChronoApplet.' . $phpEx; include_once $xgp_root . 'includes/classes/class.FlyingFleetsTable.' . $phpEx; $parse = $lang; $FlyingFleetsTable = new FlyingFleetsTable(); $lunarow = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '" . $CurrentPlanet['id_owner'] . "' AND `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "';", 'lunas', true); CheckPlanetUsedFields($lunarow); $parse['planet_id'] = $CurrentPlanet['id']; $parse['planet_name'] = $CurrentPlanet['name']; $parse['galaxy_galaxy'] = $CurrentPlanet['galaxy']; $parse['galaxy_system'] = $CurrentPlanet['system']; $parse['galaxy_planet'] = $CurrentPlanet['planet']; switch ($_GET['mode']) { case 'renameplanet': if ($_POST['action'] == $lang['ov_planet_rename_action']) { $newname = mysql_escape_string(strip_tags(trim($_POST['newname']))); if (preg_match("/[^A-z0-9_\\- ]/", $newname) == 1) { message($lang['ov_newname_error'], "game.php?page=overview&mode=renameplanet", 2); } if ($newname != "") { doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `id` = '" . $CurrentUser['current_planet'] . "' LIMIT 1;", "planets"); if ($CurrentPlanet['planet_type'] == 3) { doquery("UPDATE {{table}} SET `name` = '" . $newname . "' WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "' LIMIT 1;", "lunas"); } } } elseif ($_POST['action'] == $lang['ov_abandon_planet']) { return display(parsetemplate(gettemplate('overview/overview_deleteplanet'), $parse)); } elseif ($_POST['kolonieloeschen'] == 1 && intval($_POST['deleteid']) == $CurrentUser['current_planet']) { if (md5($_POST['pw']) == $CurrentUser["password"] && $CurrentUser['id_planet'] != $CurrentUser['current_planet']) { doquery("UPDATE {{table}} SET `destruyed` = '" . (time() + 86400) . "' WHERE `id` = '" . mysql_real_escape_string($CurrentUser['current_planet']) . "' LIMIT 1;", 'planets'); doquery("UPDATE {{table}} SET `current_planet` = `id_planet` WHERE `id` = '" . mysql_real_escape_string($CurrentUser['id']) . "' LIMIT 1", "users"); doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = 3;", 'planets'); doquery("DELETE FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `lunapos` = '" . $CurrentPlanet['planet'] . "';", 'lunas'); message($lang['ov_planet_abandoned'], 'game.php?page=overview&mode=renameplanet'); } elseif ($CurrentUser['id_planet'] == $CurrentUser["current_planet"]) { message($lang['ov_principal_planet_cant_abanone'], 'game.php?page=overview&mode=renameplanet'); } else { message($lang['ov_wrong_pass'], 'game.php?page=overview&mode=renameplanet'); } } return display(parsetemplate(gettemplate('overview/overview_renameplanet'), $parse)); break; default: if ($game_config['ts_modon'] == 1) { include_once $xgp_root . 'includes/classes/class.cyts.' . $phpEx; $ts = new cyts(); if ($ts->connect($game_config['ts_server'], $game_config['ts_tcpport'], $game_config['ts_udpport'], $game_config['ts_timeout'])) { $tsdata = $ts->info_serverInfo(); $tsdata2 = $ts->info_globalInfo(); $maxusers = $tsdata["server_maxusers"]; $useronline = $tsdata["server_currentusers"]; $channels = $tsdata["server_currentchannels"]; $seconds = $tsdata["server_uptime"]; $os = $tsdata2["total_server_platform"]; $version = $tsdata2["total_server_version"]; $trafin = round($tsdata2["total_bytesreceived"] / 1024 / 1024, 2); $trafout = round($tsdata2["total_bytessend"] / 1024 / 1024, 2); $trafges = $trafin + $trafout; $parse['ov_ts'] = "<tr><th>Teamspeak</th><th colspan=\"3\"><a href=\"teamspeak://" . $game_config['ts_server'] . ":" . $game_config['ts_udpport'] . "?username="******"\" alt=\"Teamspeak Connect\" name=\"Teamspeak Connect\">Connect</a> • Online: " . $useronline . "/" . $maxusers . " • Channels: " . $channels . " • Traffic IN: " . $trafin . " MB • Traffic Out: " . $trafout . " MB • Traffic ges.: " . $trafges . " MB</th></tr>"; } else { $parse['ov_ts'] = "<tr><th>Teamspeak</th><th colspan=\"3\">Server zurzeit nicht erreichbar. Wir bitten um verständnis.</th></tr>"; } } $OnlineAdmins = doquery("SELECT * FROM {{table}} WHERE onlinetime>='" . (time() - 10 * 60) . "' AND authlevel > 1", 'users'); if ($OnlineAdmins) { $AdminsNr = 1; $parse['OnlineAdmins'] = ""; while ($oas = mysql_fetch_array($OnlineAdmins)) { if ($AdminsNr == 1) { $parse['OnlineAdmins'] .= "<a href=\"game.php?page=messages&mode=write&id=" . $oas['id'] . "\" >" . $oas['username'] . "</a>"; } else { $parse['OnlineAdmins'] .= " • <a href=\"game.php?page=messages&mode=write&id=" . $oas['id'] . "\" >" . $oas['username'] . "</a>"; } $AdminsNr++; } } else { $parse['OnlineAdmins'] = "-"; } if ($CurrentUser['new_message'] != 0) { $Have_new_message .= "<tr>"; if ($CurrentUser['new_message'] == 1) { $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>" . $lang['ov_have_new_message'] . "</a></th>"; } elseif ($CurrentUser['new_message'] > 1) { $Have_new_message .= "<th colspan=4><a href=game.{$phpEx}?page=messages>"; $Have_new_message .= str_replace('%m', pretty_number($CurrentUser['new_message']), $lang['ov_have_new_messages']); $Have_new_message .= "</a></th>"; } $Have_new_message .= "</tr>"; } $OwnFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_owner` = '" . $CurrentUser['id'] . "';", 'fleets'); $Record = 0; while ($FleetRow = mysql_fetch_array($OwnFleets)) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; $EndTime = $FleetRow['fleet_end_time']; $Label = "fs"; if ($StartTime > time()) { $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, true, $Label, $Record); } if ($FleetRow['fleet_mission'] != 4 && $FleetRow['fleet_mission'] != 10) { $Label = "ft"; if ($StayTime > time()) { $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, true, $Label, $Record); } $Label = "fe"; if ($EndTime > time()) { $fpage[$EndTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 2, true, $Label, $Record); } } } $OtherFleets = doquery("SELECT * FROM {{table}} WHERE `fleet_target_owner` = '" . $CurrentUser['id'] . "';", 'fleets'); $Record = 2000; while ($FleetRow = mysql_fetch_array($OtherFleets)) { if ($FleetRow['fleet_owner'] != $CurrentUser['id']) { if ($FleetRow['fleet_mission'] != 8) { $Record++; $StartTime = $FleetRow['fleet_start_time']; $StayTime = $FleetRow['fleet_end_stay']; if ($StartTime > time()) { $Label = "ofs"; $fpage[$StartTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 0, false, $Label, $Record); } if ($FleetRow['fleet_mission'] == 5) { $Label = "oft"; if ($StayTime > time()) { $fpage[$StayTime] = $FlyingFleetsTable->BuildFleetEventTable($FleetRow, 1, false, $Label, $Record); } } } } } $planets_query = doquery("SELECT * FROM `{{table}}` WHERE id_owner='{$CurrentUser['id']}' AND `destruyed` = 0", "planets"); $Colone = 1; $AllPlanets = "<tr>"; if ($game_config['OverviewNewsFrame'] == '1') { $parse['NewsFrame'] = "<tr><th>" . $lang['ov_news_title'] . "</th><th colspan=\"3\">" . stripslashes($game_config['OverviewNewsText']) . "</th></tr>"; } while ($CurrentUserPlanet = mysql_fetch_array($planets_query)) { if ($CurrentUserPlanet["id"] != $CurrentUser["current_planet"] && $CurrentUserPlanet['planet_type'] != 3) { $Coloneshow++; $AllPlanets .= "<th>" . $CurrentUserPlanet['name'] . "<br>"; $AllPlanets .= "<a href=\"game.php?page=overview&cp=" . $CurrentUserPlanet['id'] . "&re=0\" title=\"" . $CurrentUserPlanet['name'] . "\"><img src=\"" . $dpath . "planeten/small/s_" . $CurrentUserPlanet['image'] . ".jpg\" height=\"50\" width=\"50\"></a><br>"; $AllPlanets .= "<center>"; if ($CurrentUserPlanet['b_building'] != 0) { UpdatePlanetBatimentQueueList($CurrentUserPlanet, $CurrentUser); if ($CurrentUserPlanet['b_building'] != 0) { $BuildQueue = $CurrentUserPlanet['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($CurrentUserPlanet); $AllPlanets .= $lang['ov_free']; } } else { $AllPlanets .= $lang['ov_free']; } $AllPlanets .= "</center></th>"; if ($Colone <= 1) { $Colone++; } else { $AllPlanets .= "</tr><tr>"; $Colone = 1; } } } $AllPlanets .= "</tr>"; if ($lunarow['id'] != 0 && $lunarow['destruyed'] != 1 && $CurrentPlanet['planet_type'] != 3) { if ($CurrentPlanet['planet_type'] == 1 or $lunarow['id'] != 0) { $moon = doquery("SELECT `id`,`name`,`image` FROM {{table}} WHERE `galaxy` = '" . $CurrentPlanet['galaxy'] . "' AND `system` = '" . $CurrentPlanet['system'] . "' AND `planet` = '" . $CurrentPlanet['planet'] . "' AND `planet_type` = '3'", 'planets', true); $parse['moon_img'] = "<a href=\"game.php?page=overview&cp=" . $moon['id'] . "&re=0\" title=\"" . $moon['name'] . "\"><img src=\"" . $dpath . "planeten/" . $moon['image'] . ".jpg\" height=\"50\" width=\"50\"></a>"; $parse['moon'] = $moon['name'] . " (" . $lang['fcm_moon'] . ")"; } else { $parse['moon_img'] = ""; $parse['moon'] = ""; } } else { $parse['moon_img'] = ""; $parse['moon'] = ""; } $parse['planet_diameter'] = pretty_number($CurrentPlanet['diameter']); $parse['planet_field_current'] = $CurrentPlanet['field_current']; $parse['planet_field_max'] = CalculateMaxPlanetFields($CurrentPlanet); $parse['planet_temp_min'] = $CurrentPlanet['temp_min']; $parse['planet_temp_max'] = $CurrentPlanet['temp_max']; $StatRecord = doquery("SELECT `total_rank`,`total_points` FROM `{{table}}` WHERE `stat_type` = '1' AND `stat_code` = '1' AND `id_owner` = '" . $CurrentUser['id'] . "';", 'statpoints', true); $parse['user_username'] = $CurrentUser['username']; if (count($fpage) > 0) { ksort($fpage); foreach ($fpage as $time => $content) { $flotten .= $content . "\n"; } } if ($CurrentPlanet['b_building'] != 0) { include $xgp_root . 'includes/functions/InsertBuildListScript.' . $phpEx; UpdatePlanetBatimentQueueList($planetrow, $user); if ($CurrentPlanet['b_building'] != 0) { $BuildQueue = explode(";", $CurrentPlanet['b_building_id']); $CurrBuild = explode(",", $BuildQueue[0]); $RestTime = $CurrentPlanet['b_building'] - time(); $PlanetID = $CurrentPlanet['id']; $Build = InsertBuildListScript("overview"); $Build .= $lang['tech'][$CurrBuild[0]] . ' (' . $CurrBuild[1] . ')'; $Build .= "<br /><div id=\"blc\" class=\"z\">" . pretty_time($RestTime) . "</div>"; $Build .= "\n<script language=\"JavaScript\">"; $Build .= "\n\tpp = \"" . $RestTime . "\";\n"; $Build .= "\n\tpk = \"" . 1 . "\";\n"; $Build .= "\n\tpm = \"cancel\";\n"; $Build .= "\n\tpl = \"" . $PlanetID . "\";\n"; $Build .= "\n\tt();\n"; $Build .= "\n</script>\n"; $parse['building'] = $Build; } else { $parse['building'] = $lang['ov_free']; } } else { $parse['building'] = $lang['ov_free']; } $parse['fleet_list'] = $flotten; $parse['Have_new_message'] = $Have_new_message; $parse['planet_image'] = $CurrentPlanet['image']; $parse['anothers_planets'] = $AllPlanets; $parse["dpath"] = $dpath; if ($game_config['stat'] == 0) { $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")"; } elseif ($game_config['stat'] == 1 && $CurrentUser['authlevel'] < $game_config['stat_level']) { $parse['user_rank'] = pretty_number($StatRecord['total_points']) . " (" . $lang['ov_place'] . " <a href=\"game.php?page=statistics&range=" . $StatRecord['total_rank'] . "\">" . $StatRecord['total_rank'] . "</a> " . $lang['ov_of'] . " " . $game_config['users_amount'] . ")"; } else { $parse['user_rank'] = "-"; } $parse['date_time'] = date("D M j H:i:s", time()); return display(parsetemplate(gettemplate('overview/overview_body'), $parse)); break; } }