function colonisations() { $sth = mysql_query("select f.fid,fi.pid,fi.uid,f.prod_id,pr.colonists,fi.sid from fleet as f,production pr,planets as p left join fleet_info as fi on fi.fid=f.fid where fi.tpid=0 and fi.tsid=0 and fi.mission=4 and f.prod_id=pr.prod_id and p.uid='0' and p.id=fi.pid and pr.special='C'"); while ($colony = mysql_fetch_assoc($sth)) { $sth1 = mysql_query("select p.id from planets p, users u where u.homeworld=p.id and p.sid=" . $colony["sid"] . " and u.id!=" . $colony["uid"]); if (!$sth1) { echo "ERR::COLONY CHECK=> select p.id from planets p, users u where u.homeworld=p.id and p.sid=" . $colony["sid"] . " and u.uid!=" . $colony["uid"] . "\n"; continue; } if (mysql_num_rows($sth1) > 0) { continue; } // nur planeten besiedelbar, die nicht in nem heimatsystem sind ticker($colony["uid"], "*lproduction.php?pid=" . $colony["pid"] . "*You have colonised a new planet", "w"); $sth1 = mysql_query("update fleet set count=count-1 where prod_id=" . $colony["prod_id"] . " and fid=" . $colony["fid"]); $sth1 = mysql_query("update planets set uid=" . $colony["uid"] . ",population=" . get_pop_by_poplevel($colony["colonists"]) . " where id=" . $colony["pid"]); if (!$sth1) { echo "Colonisation: Database failure!"; } //runelord: ne Colony-Gebäude auf so nen planeten setzen //Productionid einer Colony: 65 $planet_type = get_planets_type($colony["pid"]); $sth1 = mysql_query("insert into constructions values(" . $colony["pid"] . ",65,0)"); if (!$sth1) { echo "Colonisation - setting new building failed!"; } $sth1 = mysql_query("insert into popgain set pid=" . $colony["pid"]); if (!$sth1) { echo "ERR::SET POPGAIN"; } } delete_empty_fleets(); $sth = mysql_query("update fleet_info set mission='0' where mission=4 and tpid=0"); }
function show_totalfleets() { global $uid; $sth = mysql_query("select fid from fleet_info where uid={$uid} order by sid, pid, name"); if (!$sth) { show_message("DB Error"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("You don't have any fleets :("); } while ($its_fleets = mysql_fetch_array($sth)) { $fleets[] = new fleet($its_fleets["fid"]); } // Farbendefinition für verschiedene Flotten Befehle $mission[0] = "defend.jpg"; $mission[1] = "attack.jpg"; $mission[2] = "intercept.jpg"; $mission[3] = "bomb.jpg"; $mission[4] = "colonize.jpg"; $mission[5] = "invade.jpg"; $prev_sid = 0; table_start("center", "500"); for ($i = 0; $i < sizeof($fleets); $i++) { if ($fleets[$i]->sid != $prev_sid) { $system_name = get_systemname($fleets[$i]->sid); table_head_text(array("System: " . $system_name), "6"); $prev_sid = $fleets[$i]->sid; } // Flotten-Bild $fleet_pic = get_fleet_pic($fleets[$i]->fid); $fleet_pic = "<img src=\"" . $fleet_pic . "\" border=\"0\" alt=\"" . $fleets[$i]->name . "\" width=\"16\" height=\"16\" />"; // Mission $mission_pic_alt = $fleets[$i]->get_mission(); $mission_pic = "<img src=\"" . (PIC_ROOT . "fleet_mission_" . $mission[$fleets[$i]->mission]) . "\" border=\"0\" alt=\"" . $mission_pic_alt[0] . "\" height=\"15\" />"; // Position if ($fleets[$i]->tpid || $fleets[$i]->tsid) { $position = "<img src=\"" . PIC_ROOT . "fleet_icon_move.jpg\" alt=\"moving\" height=\"15\" /> " . $system_name . "<br>"; } else { $position = $system_name; } // Ziel if ($fleets[$i]->tpid) { $target = get_planetname($fleets[$i]->tpid); } elseif ($fleets[$i]->tsid) { $target = get_systemname($fleets[$i]->tsid); } else { $target = ""; } $misc = ""; // misc if ($infantry_count = $fleets[$i]->get_infantry_count_aboard()) { $misc = "<img src=\"" . PIC_ROOT . "fleet_icon_infantry.jpg\" height=\"15\" border=\"0\" alt=\"Infantry aboard (" . $infantry_count . ")\" />"; } $sth = mysql_query("select 1 from fleet f, production p where f.prod_id = p.prod_id and f.fid = " . $fleets[$i]->fid . " and (p.special='O' or p.special='C')"); if (!$sth) { return 0; } if (list($has_colonists) = mysql_fetch_row($sth)) { $misc .= " <img src=\"" . PIC_ROOT . "fleet_icon_colonists.jpg\" height=\"15\" border=\"0\" alt=\"Colonists aboard\" />"; } // tonnage $tonnage = $fleets[$i]->get_total_tonnage(); // erst die Flotten die in keinem Orbit sind if (!$fleets[$i]->pid) { table_text_open(); table_text_design($fleet_pic, "15", "", "", "smallhead"); table_text_design($fleets[$i]->name, "135", "", "2", "smallhead"); table_text_design($position . " " . $mission_pic . " " . $target, "200", "", "", "smallhead"); table_text_design($misc, "100", "", "", "smallhead"); table_text_close(); list_fleet_ships($fleets[$i]->ships); table_text(array(" ", " ", " ", "Total: " . $fleets[$i]->get_total_shipcount(), $tonnage . " t"), "", "", "", "smallhead"); } else { $planetname = get_planetname($fleets[$i]->pid); $planet_pic = "<img src=\"" . (PIC_ROOT . get_planets_type($fleets[$i]->pid) . "_small.gif\" height=\"12\" width=\"12\" border=\"0\" alt=\"" . $planetname . "\"/>"); table_text_open(); table_text_design($planet_pic, "15", "", "", "head"); table_text_design("Planet: " . $planetname, "485", "", "5", "head"); table_text_close(); table_text_open(); table_text_design($fleet_pic, "15", "", "", "smallhead"); table_text_design($fleets[$i]->name, "135", "", "2", "smallhead"); table_text_design($position . " " . $mission_pic . " " . $target, "200", "", "", "smallhead"); table_text_design($misc, "100", "", "", "smallhead"); table_text_close(); list_fleet_ships($fleets[$i]->ships); table_text(array(" ", " ", " ", "Total: " . $fleets[$i]->get_total_shipcount(), $tonnage . " t"), "", "", "", "smallhead"); } table_text(array(" ")); } table_end(); }