private static function GetBuildListBy($colony, $IDrangeFrom, $IDrangeTo, $readyToBeBuilt = false, $table = "production") { // Get building list $colonyID = $colony->ID(); $query = "SELECT * FROM {$table} WHERE colonyID = {$colonyID} AND resource_type_being_built BETWEEN {$IDrangeFrom} AND {$IDrangeTo}"; if ($readyToBeBuilt) { $time = time(); $query .= " AND {$time} > scheduled_time"; } $query .= " ORDER BY build_list_position ASC;"; $buildData = Database::Instance()->ExecuteQuery($query, "SELECT"); // BuildGroup always expects an array of arrays, so if we get NULL or a single array, we need to make an array of arrays if ($buildData === NULL) { $buildData = array(); } if (isset($buildData["colonyID"])) { $buildData = array($buildData); } if ($table === "production_building") { $buildGroup = BuildingBuildGroup::FromDatabase($buildData, $colony); } else { $buildGroup = BuildGroup::FromDatabase($buildData, $colony); } return new ResourceBuilder($buildGroup); }