bad performance $res = mysql_query($query) or die(mysql_error()); $moons = 0; $planets = 0; $coordinates = ""; $moon_coordinates = ""; $amount_metal = 0; $amount_crystal = 0; $amount_deut = 0; $draw_graph = false; $max_temp = array(123,123,120,66.7,64.5,63,41,39,36,14.5,12,11,-43,-44,-46); $moon_array = array(); $player_stats = array(); $old_coordinates = ""; $moon_ajax_array = array(); $planet_ajax_array = array(); $moon_done = false; $planet_done = false; $report_planet_array = array(); $report_moon_array = array(); $fleetsize = array("kt"=>0,"gt"=>0,"lj"=>0,"sj"=>0,"krz"=>0,"ss"=>0,"kolo"=>0,"rec"=>0,"spio"=>0,"bomb"=>0,"zerri"=>0,"ds"=>0,"skrz"=>0,"sat"=>0); $techarray = array("spiolvl"=>0,"computech"=>0,"waffentech"=>0,"schildtech"=>0,"rpz"=>0,"energytech"=>0,"hypertech"=>0,"vbt"=>0,"impulse"=>0,"hra"=>0,"lasertech"=>0,"iontech"=>0,"plasmatech"=>0,"forschungsnetz"=>0,"expedition"=>0,"gravi"=>0); $players_with_tech = 0; if (mysql_num_rows($res) > 0) { while ($line = mysql_fetch_object($res)) { // collect tech information if ($line->last_tech_update != "0000-00-00 00:00:00") { $players_with_tech++; $techarray["spiolvl"] += ($line->spiolvl == NULL) ? 0 : $line->spiolvl; $techarray["computech"] += ($line->computech == NULL) ? 0 : $line->computech; $techarray["waffentech"] += ($line->waffentech == NULL) ? 0 : $line->waffentech; $techarray["schildtech"] += ($line->schildtech == NULL) ? 0 : $line->schildtech; $techarray["rpz"] += ($line->rpz == NULL) ? 0 : $line->rpz; $techarray["energytech"] += ($line->energytech == NULL) ? 0 : $line->energytech; $techarray["hypertech"] += ($line->hypertech == NULL) ? 0 : $line->hypertech; $techarray["vbt"] += ($line->vbt == NULL) ? 0 : $line->vbt; $techarray["impulse"] += ($line->impulse == NULL) ? 0 : $line->impulse; $techarray["hra"] += ($line->hra == NULL) ? 0 : $line->hra; $techarray["lasertech"] += ($line->lasertech == NULL) ? 0 : $line->lasertech; $techarray["iontech"] += ($line->iontech == NULL) ? 0 : $line->iontech; $techarray["plasmatech"] += ($line->plasmatech == NULL) ? 0 : $line->plasmatech; $techarray["forschungsnetz"] += ($line->forschungsnetz == NULL) ? 0 : $line->forschungsnetz; $techarray["expedition"] += ($line->expedition == NULL) ? 0 : $line->expedition; $techarray["gravi"] += ($line->gravi == NULL) ? 0 : $line->gravi; } $galaxy_query = "SELECT g.planet as g_planet, g.system as g_system, g.galaxy as g_galaxy, g.moon as g_moon, r.* ". "FROM $dbtablename g LEFT JOIN $reporttable r ON (g.galaxy=r.galaxy AND g.system=r.system AND g.planet=r.planet) ". "WHERE g.player_id='$line->player_id' ". "ORDER BY g.galaxy,g.system,g.planet"; $res2 = mysql_query($galaxy_query) or die(mysql_error()); // LOOP all reports of current player $i = 0; while ($result_row = mysql_fetch_object($res2)) { $coordinates = ""; $moon_coordinates = ""; $moon_mouse_over = ""; $planet_mouse_over = ""; // collect fleet information $fleetsize["kt"] += ($result_row->kt == NULL) ? 0 : $result_row->kt; $fleetsize["gt"] += ($result_row->gt == NULL) ? 0 : $result_row->gt; $fleetsize["lj"] += ($result_row->lj == NULL) ? 0 : $result_row->lj; $fleetsize["sj"] += ($result_row->sj == NULL) ? 0 : $result_row->sj; $fleetsize["krz"] += ($result_row->krz == NULL) ? 0 : $result_row->krz; $fleetsize["ss"] += ($result_row->ss == NULL) ? 0 : $result_row->ss; $fleetsize["kolo"] += ($result_row->kolo == NULL) ? 0 : $result_row->kolo; $fleetsize["rec"] += ($result_row->rec == NULL) ? 0 : $result_row->rec; $fleetsize["spio"] += ($result_row->spio == NULL) ? 0 : $result_row->spio; $fleetsize["bomb"] += ($result_row->bomb == NULL) ? 0 : $result_row->bomb; $fleetsize["zerri"] += ($result_row->zerri == NULL) ? 0 : $result_row->zerri; $fleetsize["ds"] += ($result_row->ds == NULL) ? 0 : $result_row->ds; $fleetsize["skrz"] += ($result_row->skrz == NULL) ? 0 : $result_row->skrz; $fleetsize["sat"] += ($result_row->sat == NULL) ? 0 : $result_row->sat; if ($result_row->g_galaxy.":".$result_row->g_system.":".$result_row->g_planet != $old_coordinates) { // coordinates changed, so add missing planets / moons now if (!$moon_done && $i > 0) { $moons++; //if ($moons == 1) $moon_coordinates .= " - "; else $moon_coordinates .= " ; "; $moon_coordinates .= " ".$old_coordinates.""; $report_moon_array[$old_coordinates.":1"] = $moon_coordinates; $coordinates = ""; $moon_coordinates = ""; } if (!$planet_done && $i > 0) { $planets++; //if ($planets == 1) $coordinates .= " - "; else $coordinates .= " ; "; $coordinates .= " ".$old_coordinates.""; $report_planet_array[$old_coordinates.":0"] = $coordinates; $coordinates = ""; $moon_coordinates = ""; } $old_coordinates = $result_row->g_galaxy.":".$result_row->g_system.":".$result_row->g_planet; $old_galaxy = $result_row->g_galaxy; $old_system = $result_row->g_system; $moon_done = false; $planet_done = false; } if ($result_row->moon == "true" && $result_row->energy != NULL) { $moons++; //if ($moons == 1) $moon_coordinates .= " - "; else $moon_coordinates .= " ; "; $moon_mouse_over = ' onmouseover="ShowObject(\'report'.$moons.'_M\',\'ajax_reports.php?coordinates='."$result_row->g_galaxy:$result_row->g_system:".$result_row->g_planet.'&moon=1\',true)"'; $moon_coordinates .= " g_galaxy."&system=".$result_row->g_system."\" $moon_mouse_over>".$result_row->g_galaxy.":".$result_row->g_system.":".$result_row->g_planet.""; array_push($moon_ajax_array,"report".$moons."_M"); // add to moon array if ($result_row->sensor > 0) { if (!isset($moon_array[$result_row->g_galaxy])) $moon_array[$result_row->g_galaxy] = array(); $min = $result_row->g_system - (($result_row->sensor * $result_row->sensor) - 1); $max = $result_row->g_system + (($result_row->sensor * $result_row->sensor) - 1); $min = ($min < 1) ? 1 : $min; $max = ($max > 499) ? 499 : $max; array_push($moon_array[$result_row->g_galaxy],array("min"=>$min,"max"=>$max)); } $moon_done = true; } if ($result_row->moon == "false" && $result_row->energy != NULL) { $planets++; //if ($planets == 1) $coordinates .= " - "; else $coordinates .= " ; "; $planet_mouse_over = ' onmouseover="ShowObject(\'report'.$planets.'\',\'ajax_reports.php?coordinates='."$result_row->g_galaxy:$result_row->g_system:".$result_row->g_planet.'\',true)"'; $coordinates .= " g_galaxy."&system=".$result_row->g_system."\" $planet_mouse_over>".$result_row->g_galaxy.":".$result_row->g_system.":".$result_row->g_planet.""; array_push($planet_ajax_array,"report".$planets); if ($result_row->memi > 0) { $amount_metal += floor( 30 * $result_row->memi * pow(1.1,$result_row->memi) + 20); } if ($result_row->krimi > 0) { $amount_crystal += floor(20 * $result_row->krimi * pow(1.1,$result_row->krimi)); } if ($result_row->deutsyn > 0) { $amount_deut += floor(10 * $result_row->deutsyn * pow(1.1,$result_row->deutsyn) * (-0.002 * $max_temp[$result_row->g_planet-1] + 1.28)); } $planet_done = true; } if ($result_row->g_moon == "false") { $moon_done = true; } // add the line to array if (!empty($coordinates)) $report_planet_array[$result_row->g_galaxy.":".$result_row->g_system.":".$result_row->g_planet.":0"] = $coordinates; if (!empty($moon_coordinates)) $report_moon_array[$result_row->g_galaxy.":".$result_row->g_system.":".$result_row->g_planet.":1"] = $moon_coordinates; $i++; } // add last entry if (!$moon_done && $i > 0) { $moons++; //if ($moons == 1) $moon_coordinates .= " - "; else $moon_coordinates .= " ; "; $moon_coordinates .= " ".$old_coordinates.""; $report_moon_array[$old_coordinates.":1"] = $moon_coordinates; } if (!$planet_done && $i > 0) { $planets++; //if ($planets == 1) $coordinates .= " - "; else $coordinates .= " ; "; $coordinates .= " ".$old_coordinates.""; $report_planet_array[$old_coordinates.":0"] = $coordinates; } // Player specific information $score = ($line->rank > 0) ? DETAILEDINFO_RANK.": ".$line->rank." ".DETAILEDINFO_POINTS." ".number_format($line->points,0,",",".") : DETAILEDINFO_UNKNOWN; $fscore = ($line->frank > 0) ? DETAILEDINFO_RANK.": ".$line->frank." ".DETAILEDINFO_POINTS." ".number_format($line->fpoints,0,",",".") : DETAILEDINFO_UNKNOWN; $rscore = ($line->rrank > 0) ? DETAILEDINFO_RANK.": ".$line->rrank." ".DETAILEDINFO_POINTS." ".number_format($line->rpoints,0,",",".") : DETAILEDINFO_UNKNOWN; if ($line->points > 0 && !$draw_graph) { $draw_graph = true; } array_push($player_stats,array("player_id"=>$line->player_id,"name"=>$line->playername,"score"=>$line->ppoints,"fleet"=>$line->pfpoints,"research"=>$line->prpoints,"dipl_status"=>$line->diplomatic_status)); $ally_dipl_status = $line->a_dipl_status; $player_dipl_status = $line->diplomatic_status; $ally_members = $line->members; $allyname = $line->allyname; } if (count($moon_array) > 0) $phalanx_range = get_phalanx_range($moon_array); else $phalanx_range = array(); ob_start(); echo '
'.STATS_ALLYNAME.' | '.$allyname.' - ('.STATS_MEMBERS.': '.$ally_members.') '.$ostat.' '; if ($_SESSION['s_diplomatic']) { echo ' '. ' |
').utf8_encode(STATS_CHANGE_ALLIANCE_STATUS).htmlentities(' | |
').utf8_encode(STATS_CHANGE_ALLIANCE_STATUS_HINT).htmlentities(' | |
'. '').utf8_encode(STATS_NEUTRAL).htmlentities(' | |
'. '').utf8_encode(STATS_BOYCOTT).htmlentities(' | |
'. '').utf8_encode(STATS_NAP).htmlentities(' | |
'. '').utf8_encode(STATS_ALLIED).htmlentities(' | |
'. '').utf8_encode(STATS_WAR).htmlentities(' | |
'. '').utf8_encode(STATS_OWN).htmlentities(' | |
'. '').utf8_encode(STATS_WING).htmlentities(' | |
'. '').utf8_encode(STATS_NOTHING).htmlentities(' | |
') .utf8_encode(STATS_DELETE).htmlentities(' |
|
'.DETAILEDINFO_METAL.' | '.DETAILEDINFO_CRYSTAL.' | '.DETAILEDINFO_DEUTERIUM.' | |
'.DETAILEDINFO_RESOURCES_PER_HOUR.' | '.number_format($amount_metal,0,",",".").' | '.number_format($amount_crystal,0,",",".").' | '.number_format($amount_deut,0,",",".").' |
'.DETAILEDINFO_RESOURCES_PER_DAY.' | '.number_format($amount_metal*24,0,",",".").' | '.number_format($amount_crystal*24,0,",",".").' | '.number_format($amount_deut*24,0,",",".").' |
'.DETAILEDINFO_RESOURCES_PER_WEEK.' | '.number_format($amount_metal*24*7,0,",",".").' | '.number_format($amount_crystal*24*7,0,",",".").' | '.number_format($amount_deut*24*7,0,",",".").' |
'.DETAILEDINFO_RESOURCES_PER_MONTH.' | '.number_format($amount_metal*24*30,0,",",".").' | '.number_format($amount_crystal*24*30,0,",",".").' | '.number_format($amount_deut*24*30,0,",",".").' |
'.DETAILEDINFO_SCORE_DISTRIBUTION.' | |
'; $_GET['id'] = $alliance_id; $_GET['what'] = "points"; $no_ajax = true; include "ajax_allyinfo.php"; echo ' |
|
|