public static function FromDatabase($row) { $id = $row['class']; $planetType = ResourceParser::Instance()->GetPlanetTypeByID($id); $variation = array(); $variation[] = PlanetData::FromDatabase($row); return new PlanetType($planetType->PlanetClass(), $id, $planetType->AllowedBuildings(), $variation); }
public static function FromDatabase(array $row) { $pData = new PlanetData(); $pData->Image($row['image']); $pData->GroundType($row['type']); $pData->MinTemperature($row['minimal_temperature']); $pData->MaxTemperature($row['maximal_temperature'] - $row['minimal_temperature']); return $pData; }
private function ParsePlanetTypes() { global $GR_planetTypes; foreach ($GR_planetTypes as $planetType => $planetContents) { // Database ID $id = $planetContents['database_id']; // Allowed buildings $allowedBuildings = array(); foreach ($planetContents['allowed_buildings'] as $buildingName) { $allowedBuildings[$buildingName] = $this->GetItemByName($buildingName); } $rg = new ResourceGroup($allowedBuildings); // Planet data $planetVariations = array(); foreach ($planetContents['planet_data'] as $planetData) { $usedInPosition = $planetData["used_in_position"]; $planetGroundType = $planetData["planet_type"]; $planetImages = $planetData["planet_images"]; $MinTemperatureMin = $planetData["minimal_temperature_min"]; $MinTemperatureMax = $planetData["minimal_temperature_max"]; $MaxTemperature = $planetData["maximal_temperature"]; $planetVariations[] = PlanetData::ForGeneration($usedInPosition, $planetGroundType, $planetType, $planetImages, $MinTemperatureMin, $MinTemperatureMax, $MaxTemperature); } $this->_planetTypes[$planetType] = new PlanetType($planetType, $id, $rg, $planetVariations); } }