public static function GetShipsOfColony(Colony $colony) { global $GR_missionDatabaseIDs; $id = $colony->ID(); $query = "SELECT * FROM fleet WHERE colonyID = {$id} AND mission_type = 0 LIMIT 1;"; $row = Database::Instance()->ExecuteQuery($query, "SELECT"); return ShipFleet::FromDatabase($row, $colony); }
public static function GetDefensesOfColony(Colony $colony) { $id = $colony->ID(); $query = "SELECT * FROM colony_defences WHERE colonyID = {$id};"; $row = Database::Instance()->ExecuteQuery($query, "SELECT"); $row = array_slice($row, 1); // Get rid of colonyID // TODO: put these numbers in the config files or game resources, // otherwise when you add a new weapon you need to change all these. $row = array_slice($row, 0, 8); // Get rid of missiles return CombatGroup::FromList($row, $colony); }
public static function FromDatabaseByColony(Colony $colony) { $id = $colony->ID(); $query = "SELECT * FROM colony_structures WHERE colonyID = {$id};"; $row = Database::Instance()->ExecuteQuery($query, "SELECT"); $row = array_slice($row, 1); // Dump the colonyID $productionUnitsRow = array_slice($row, 0, 5); // TODO: put solar sats here? $buildingsRow = array_slice($row, 5); $productionUnits = BuildingGroup::FromDatabase($productionUnitsRow, $colony); $buildings = BuildingGroup::FromDatabase($buildingsRow, $colony); return array($productionUnits, $buildings); }
public static function GetListCount(Colony $c) { $id = $c->ID(); $query = "SELECT COUNT(colonyID) as count FROM production_building WHERE colonyID = {$id};"; $result = Database::Instance()->ExecuteQuery($query, "SELECT"); if ($result == NULL) { $count = 0; } else { $count = $result['count']; } }
public function Equals(self $other) { if ($this->ID() == $other->ID()) { return true; } return false; }