From f8657fb18c9ff6e5efdca5232072be081851ee93 Mon Sep 17 00:00:00 2001 From: Alain Gilbert Date: Sat, 20 Aug 2022 04:27:28 -0700 Subject: [PATCH 1/8] lifeform --- pkg/ogame/constants.go | 160 ++++++++++++--------- pkg/ogame/lfBuildings.go | 263 ++++++++++++++++++++++++++++++++++ pkg/ogame/lfBuildings_test.go | 25 ++++ pkg/ogame/objs.go | 12 ++ pkg/ogame/resources.go | 2 + pkg/ogame/resources_test.go | 2 +- 6 files changed, 398 insertions(+), 66 deletions(-) create mode 100644 pkg/ogame/lfBuildings.go create mode 100644 pkg/ogame/lfBuildings_test.go diff --git a/pkg/ogame/constants.go b/pkg/ogame/constants.go index 78bf3544..332aa98b 100644 --- a/pkg/ogame/constants.go +++ b/pkg/ogame/constants.go @@ -113,71 +113,101 @@ const ( MoonType CelestialType = 3 //Buildings - MetalMineID ID = 1 - CrystalMineID ID = 2 - DeuteriumSynthesizerID ID = 3 - SolarPlantID ID = 4 - FusionReactorID ID = 12 - MetalStorageID ID = 22 - CrystalStorageID ID = 23 - DeuteriumTankID ID = 24 - ShieldedMetalDenID ID = 25 - UndergroundCrystalDenID ID = 26 - SeabedDeuteriumDenID ID = 27 - AllianceDepotID ID = 34 // Facilities - RoboticsFactoryID ID = 14 - ShipyardID ID = 21 - ResearchLabID ID = 31 - MissileSiloID ID = 44 - NaniteFactoryID ID = 15 - TerraformerID ID = 33 - SpaceDockID ID = 36 - LunarBaseID ID = 41 // Moon facilities - SensorPhalanxID ID = 42 - JumpGateID ID = 43 - RocketLauncherID ID = 401 // Defense - LightLaserID ID = 402 - HeavyLaserID ID = 403 - GaussCannonID ID = 404 - IonCannonID ID = 405 - PlasmaTurretID ID = 406 - SmallShieldDomeID ID = 407 - LargeShieldDomeID ID = 408 - AntiBallisticMissilesID ID = 502 - InterplanetaryMissilesID ID = 503 - SmallCargoID ID = 202 // Ships - LargeCargoID ID = 203 - LightFighterID ID = 204 - HeavyFighterID ID = 205 - CruiserID ID = 206 - BattleshipID ID = 207 - ColonyShipID ID = 208 - RecyclerID ID = 209 - EspionageProbeID ID = 210 - BomberID ID = 211 - SolarSatelliteID ID = 212 - DestroyerID ID = 213 - DeathstarID ID = 214 - BattlecruiserID ID = 215 - CrawlerID ID = 217 - ReaperID ID = 218 - PathfinderID ID = 219 - EspionageTechnologyID ID = 106 // Research - ComputerTechnologyID ID = 108 - WeaponsTechnologyID ID = 109 - ShieldingTechnologyID ID = 110 - ArmourTechnologyID ID = 111 - EnergyTechnologyID ID = 113 - HyperspaceTechnologyID ID = 114 - CombustionDriveID ID = 115 - ImpulseDriveID ID = 117 - HyperspaceDriveID ID = 118 - LaserTechnologyID ID = 120 - IonTechnologyID ID = 121 - PlasmaTechnologyID ID = 122 - IntergalacticResearchNetworkID ID = 123 - AstrophysicsID ID = 124 - GravitonTechnologyID ID = 199 + MetalMineID ID = 1 + CrystalMineID ID = 2 + DeuteriumSynthesizerID ID = 3 + SolarPlantID ID = 4 + FusionReactorID ID = 12 + MetalStorageID ID = 22 + CrystalStorageID ID = 23 + DeuteriumTankID ID = 24 + ShieldedMetalDenID ID = 25 + UndergroundCrystalDenID ID = 26 + SeabedDeuteriumDenID ID = 27 + AllianceDepotID ID = 34 // Facilities + RoboticsFactoryID ID = 14 + ShipyardID ID = 21 + ResearchLabID ID = 31 + MissileSiloID ID = 44 + NaniteFactoryID ID = 15 + TerraformerID ID = 33 + SpaceDockID ID = 36 + LunarBaseID ID = 41 // Moon facilities + SensorPhalanxID ID = 42 + JumpGateID ID = 43 + RocketLauncherID ID = 401 // Defense + LightLaserID ID = 402 + HeavyLaserID ID = 403 + GaussCannonID ID = 404 + IonCannonID ID = 405 + PlasmaTurretID ID = 406 + SmallShieldDomeID ID = 407 + LargeShieldDomeID ID = 408 + AntiBallisticMissilesID ID = 502 + InterplanetaryMissilesID ID = 503 + SmallCargoID ID = 202 // Ships + LargeCargoID ID = 203 + LightFighterID ID = 204 + HeavyFighterID ID = 205 + CruiserID ID = 206 + BattleshipID ID = 207 + ColonyShipID ID = 208 + RecyclerID ID = 209 + EspionageProbeID ID = 210 + BomberID ID = 211 + SolarSatelliteID ID = 212 + DestroyerID ID = 213 + DeathstarID ID = 214 + BattlecruiserID ID = 215 + CrawlerID ID = 217 + ReaperID ID = 218 + PathfinderID ID = 219 + EspionageTechnologyID ID = 106 // Research + ComputerTechnologyID ID = 108 + WeaponsTechnologyID ID = 109 + ShieldingTechnologyID ID = 110 + ArmourTechnologyID ID = 111 + EnergyTechnologyID ID = 113 + HyperspaceTechnologyID ID = 114 + CombustionDriveID ID = 115 + ImpulseDriveID ID = 117 + HyperspaceDriveID ID = 118 + LaserTechnologyID ID = 120 + IonTechnologyID ID = 121 + PlasmaTechnologyID ID = 122 + IntergalacticResearchNetworkID ID = 123 + AstrophysicsID ID = 124 + GravitonTechnologyID ID = 199 + ResidentialSectorID ID = 11101 // Lifeform + BiosphereFarmID ID = 11102 + ResearchCentreID ID = 11103 + AcademyOfSciencesID ID = 11104 + NeuroCalibrationCentreID ID = 11105 + HighEnergySmeltingID ID = 11106 + FoodSiloID ID = 11107 + FusionPoweredProductionID ID = 11108 + SkyscraperID ID = 11109 + BiotechLabID ID = 11110 + MetropolisID ID = 11111 + PlanetaryShieldID ID = 11112 + IntergalacticEnvoysID ID = 11201 // Lifeform tech + HighPerformanceExtractorsID ID = 11202 + FusionDrivesID ID = 11203 + StealthFieldGeneratorID ID = 11204 + OrbitalDenID ID = 11205 + ResearchAIID ID = 11206 + HighPerformanceTerraformerID ID = 11207 + EnhancedProductionTechnologiesID ID = 11208 + LightFighterMkIIID ID = 11209 + CruiserMkIIID ID = 11210 + ImprovedLabTechnologyID ID = 11211 + PlasmaTerraformerID ID = 11212 + LowTemperatureDrivesID ID = 11213 + BomberMkIIID ID = 11214 + DestroyerMkIIID ID = 11215 + BattlecruiserMkIIID ID = 11216 + RobotAssistantsID ID = 11217 + SupercomputerID ID = 11218 // Missions Attack MissionID = 1 diff --git a/pkg/ogame/lfBuildings.go b/pkg/ogame/lfBuildings.go new file mode 100644 index 00000000..0f2fb632 --- /dev/null +++ b/pkg/ogame/lfBuildings.go @@ -0,0 +1,263 @@ +package ogame + +import ( + "math" +) + +// LazyLfBuildings ... +type LazyLfBuildings func() LfBuildings + +// LfBuildings lifeform buildings +type LfBuildings struct { + ResidentialSector int64 // 11101 + BiosphereFarm int64 // 11102 + ResearchCentre int64 // 11103 + AcademyOfSciences int64 // 11104 + NeuroCalibrationCentre int64 // 11105 + HighEnergySmelting int64 // 11106 + FoodSilo int64 // 11107 + FusionPoweredProduction int64 // 11108 + Skyscraper int64 // 11109 + BiotechLab int64 // 11110 + Metropolis int64 // 11111 + PlanetaryShield int64 // 11112 +} + +// Lazy returns a function that return self +func (b LfBuildings) Lazy() LazyLfBuildings { + return func() LfBuildings { return b } +} + +// ByID gets the lfBuilding level by lfBuilding id +func (b LfBuildings) ByID(id ID) int64 { + switch id { + case ResidentialSectorID: + return b.ResidentialSector + case BiosphereFarmID: + return b.BiosphereFarm + case ResearchCentreID: + return b.ResearchCentre + case AcademyOfSciencesID: + return b.AcademyOfSciences + case NeuroCalibrationCentreID: + return b.NeuroCalibrationCentre + case HighEnergySmeltingID: + return b.HighEnergySmelting + case FoodSiloID: + return b.FoodSilo + case FusionPoweredProductionID: + return b.FusionPoweredProduction + case SkyscraperID: + return b.Skyscraper + case BiotechLabID: + return b.BiotechLab + case MetropolisID: + return b.Metropolis + case PlanetaryShieldID: + return b.PlanetaryShield + } + return 0 +} + +// BaseLfBuilding base struct for Lifeform buildings +type BaseLfBuilding struct { + BaseBuilding + energyIncreaseFactor float64 +} + +// GetPrice returns the price to build the given level +func (b BaseLfBuilding) GetPrice(level int64) Resources { + tmp := func(baseCost int64, increaseFactor float64, level int64) int64 { + return int64(float64(baseCost) * math.Pow(increaseFactor, float64(level-1)) * float64(level)) + } + return Resources{ + Metal: tmp(b.BaseCost.Metal, b.IncreaseFactor, level), + Crystal: tmp(b.BaseCost.Crystal, b.IncreaseFactor, level), + Deuterium: tmp(b.BaseCost.Deuterium, b.IncreaseFactor, level), + Energy: tmp(b.BaseCost.Energy, b.energyIncreaseFactor, level), + } +} + +type residentialSector struct { + BaseLfBuilding +} + +func newResidentialSector() *residentialSector { + b := new(residentialSector) + b.Name = "residential sector" + b.ID = ResidentialSectorID + b.IncreaseFactor = 1.2 + b.BaseCost = Resources{Metal: 7, Crystal: 2} + b.Requirements = map[ID]int64{} + return b +} + +type biosphereFarm struct { + BaseLfBuilding +} + +func newBiosphereFarm() *biosphereFarm { + b := new(biosphereFarm) + b.Name = "biosphere farm" + b.ID = BiosphereFarmID + b.IncreaseFactor = 1.23 + b.energyIncreaseFactor = 1.021 + b.BaseCost = Resources{Metal: 5, Crystal: 2, Energy: 8} + b.Requirements = map[ID]int64{} + return b +} + +type researchCentre struct { + BaseLfBuilding +} + +func newResearchCentre() *researchCentre { + b := new(researchCentre) + b.Name = "research centre" + b.ID = ResearchCentreID + b.IncreaseFactor = 1.3 + b.BaseCost = Resources{Metal: 20000, Crystal: 25000, Deuterium: 10000} + b.Requirements = map[ID]int64{ResidentialSectorID: 12, BiosphereFarmID: 13} + return b +} + +type academyOfSciences struct { + BaseLfBuilding +} + +func newAcademyOfSciences() *academyOfSciences { + b := new(academyOfSciences) + b.Name = "academy of sciences" + b.ID = AcademyOfSciencesID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 5000, Crystal: 3200, Deuterium: 1500, Lifeform: 20000000} + b.Requirements = map[ID]int64{ResidentialSectorID: 40} + return b +} + +type neuroCalibrationCentre struct { + BaseLfBuilding +} + +func newNeuroCalibrationCentre() *neuroCalibrationCentre { + b := new(neuroCalibrationCentre) + b.Name = "neuro calibration centre" + b.ID = NeuroCalibrationCentreID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 50000, Crystal: 40000, Deuterium: 50000, Lifeform: 100000000} + b.Requirements = map[ID]int64{ResidentialSectorID: 40, AcademyOfSciencesID: 1, FusionPoweredProductionID: 1, SkyscraperID: 5} + return b +} + +type highEnergySmelting struct { + BaseLfBuilding +} + +func newHighEnergySmelting() *highEnergySmelting { + b := new(highEnergySmelting) + b.Name = "high energy smelting" + b.ID = HighEnergySmeltingID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 7500, Crystal: 5000, Deuterium: 3000} + b.Requirements = map[ID]int64{ResidentialSectorID: 12, BiosphereFarmID: 13, ResearchCentreID: 5} + return b +} + +type foodSilo struct { + BaseLfBuilding +} + +func newFoodSilo() *foodSilo { + b := new(foodSilo) + b.Name = "food silo" + b.ID = FoodSiloID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 25000, Crystal: 13000, Deuterium: 7000} + b.Requirements = map[ID]int64{ResidentialSectorID: 12, BiosphereFarmID: 13, ResearchCentreID: 5, HighEnergySmeltingID: 3} + return b +} + +type fusionPoweredProduction struct { + BaseLfBuilding +} + +func newFusionPoweredProduction() *fusionPoweredProduction { + b := new(fusionPoweredProduction) + b.Name = "fusion powered production" + b.ID = FusionPoweredProductionID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 50000, Crystal: 25000, Deuterium: 25000} + b.Requirements = map[ID]int64{ResidentialSectorID: 40, AcademyOfSciencesID: 1} + return b +} + +type skyscraper struct { + BaseLfBuilding +} + +func newSkyscraper() *skyscraper { + b := new(skyscraper) + b.Name = "skyscraper" + b.ID = SkyscraperID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 75000, Crystal: 20000, Deuterium: 25000} + b.Requirements = map[ID]int64{ResidentialSectorID: 40, AcademyOfSciencesID: 1, FusionPoweredProductionID: 1} + return b +} + +type biotechLab struct { + BaseLfBuilding +} + +func newBiotechLab() *biotechLab { + b := new(biotechLab) + b.Name = "biotech lab" + b.ID = BiotechLabID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 150000, Crystal: 30000, Deuterium: 15000} + b.Requirements = map[ID]int64{ResidentialSectorID: 40, AcademyOfSciencesID: 1, FusionPoweredProductionID: 2} + return b +} + +type metropolis struct { + BaseLfBuilding +} + +func newMetropolis() *metropolis { + b := new(metropolis) + b.Name = "metropolis" + b.ID = MetropolisID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 80000, Crystal: 35000, Deuterium: 60000} + b.Requirements = map[ID]int64{ResidentialSectorID: 40, AcademyOfSciencesID: 1, FusionPoweredProductionID: 1, SkyscraperID: 5, NeuroCalibrationCentreID: 1} + return b +} + +type planetaryShield struct { + BaseLfBuilding +} + +func newPlanetaryShield() *planetaryShield { + b := new(planetaryShield) + b.Name = "planetary shield" + b.ID = PlanetaryShieldID + b.IncreaseFactor = 1 // TODO + b.BaseCost = Resources{Metal: 250000, Crystal: 125000, Deuterium: 125000} + b.Requirements = map[ID]int64{ + ResidentialSectorID: 40, + BiosphereFarmID: 13, + ResearchCentreID: 5, + AcademyOfSciencesID: 1, + FusionPoweredProductionID: 5, + SkyscraperID: 5, + HighEnergySmeltingID: 3, + MetropolisID: 5, + FoodSiloID: 4, + NeuroCalibrationCentreID: 5} + return b +} + +// BaseLfTechnology base struct for lifeform technologies +type BaseLfTechnology struct { + BaseLevelable +} diff --git a/pkg/ogame/lfBuildings_test.go b/pkg/ogame/lfBuildings_test.go new file mode 100644 index 00000000..ed4896b4 --- /dev/null +++ b/pkg/ogame/lfBuildings_test.go @@ -0,0 +1,25 @@ +package ogame + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestResidentialSectorCost(t *testing.T) { + a := newResidentialSector() + assert.Equal(t, Resources{Metal: 7, Crystal: 2}, a.GetPrice(1)) + assert.Equal(t, Resources{Metal: 16, Crystal: 4}, a.GetPrice(2)) + assert.Equal(t, Resources{Metal: 30, Crystal: 8}, a.GetPrice(3)) +} + +func TestBiosphereFarmCost(t *testing.T) { + a := newBiosphereFarm() + assert.Equal(t, Resources{Metal: 5, Crystal: 2, Energy: 8}, a.GetPrice(1)) + assert.Equal(t, Resources{Metal: 8499, Crystal: 3399, Energy: 272}, a.GetPrice(22)) +} + +func TestResearchCenterCost(t *testing.T) { + a := newResearchCentre() + assert.Equal(t, Resources{Metal: 20000, Crystal: 25000, Deuterium: 10000}, a.GetPrice(1)) + assert.Equal(t, Resources{Metal: 52000, Crystal: 65000, Deuterium: 26000}, a.GetPrice(2)) +} diff --git a/pkg/ogame/objs.go b/pkg/ogame/objs.go index 3a8c3db5..206a7329 100644 --- a/pkg/ogame/objs.go +++ b/pkg/ogame/objs.go @@ -67,6 +67,18 @@ var ( PlasmaTechnology = register[*plasmaTechnology](newPlasmaTechnology) ShieldingTechnology = register[*shieldingTechnology](newShieldingTechnology) WeaponsTechnology = register[*weaponsTechnology](newWeaponsTechnology) + ResidentialSector = register[*residentialSector](newResidentialSector) // Lifeform + BiosphereFarm = register[*biosphereFarm](newBiosphereFarm) + ResearchCentre = register[*researchCentre](newResearchCentre) + AcademyOfSciences = register[*academyOfSciences](newAcademyOfSciences) + NeuroCalibrationCentre = register[*neuroCalibrationCentre](newNeuroCalibrationCentre) + HighEnergySmelting = register[*highEnergySmelting](newHighEnergySmelting) + FoodSilo = register[*foodSilo](newFoodSilo) + FusionPoweredProduction = register[*fusionPoweredProduction](newFusionPoweredProduction) + Skyscraper = register[*skyscraper](newSkyscraper) + BiotechLab = register[*biotechLab](newBiotechLab) + Metropolis = register[*metropolis](newMetropolis) + PlanetaryShield = register[*planetaryShield](newPlanetaryShield) ) type ObjsStruct struct{ m map[ID]BaseOgameObj } diff --git a/pkg/ogame/resources.go b/pkg/ogame/resources.go index fec9a486..35fc6098 100644 --- a/pkg/ogame/resources.go +++ b/pkg/ogame/resources.go @@ -58,6 +58,8 @@ type Resources struct { Deuterium int64 Energy int64 Darkmatter int64 + Lifeform int64 + Food int64 } func (r Resources) String() string { diff --git a/pkg/ogame/resources_test.go b/pkg/ogame/resources_test.go index cc64595a..3f1383f9 100644 --- a/pkg/ogame/resources_test.go +++ b/pkg/ogame/resources_test.go @@ -88,7 +88,7 @@ func TestResourcesDetails_Available(t *testing.T) { d.Deuterium.Available = 3 d.Energy.Available = 4 d.Darkmatter.Available = 5 - assert.Equal(t, Resources{1, 2, 3, 4, 5}, d.Available()) + assert.Equal(t, Resources{1, 2, 3, 4, 5, 0, 0}, d.Available()) } func TestResources_FitsIn(t *testing.T) { From 2be68be230ae9667e76b5600391de2c8f6c660e5 Mon Sep 17 00:00:00 2001 From: Alain Gilbert Date: Sat, 20 Aug 2022 05:23:59 -0700 Subject: [PATCH 2/8] build/cancel lfbuilding --- pkg/extractor/extractor.go | 1 + pkg/extractor/v6/extractor.go | 4 ++++ pkg/extractor/v9/extractor.go | 10 ++++++++++ pkg/extractor/v9/extracts.go | 29 +++++++++++++++++++++++++++++ pkg/ogame/id.go | 17 ++++++++++++++++- pkg/parser/overviewPage.go | 4 ++++ pkg/wrapper/fetcher.go | 1 + pkg/wrapper/interfaces.go | 1 + pkg/wrapper/ogame.go | 17 +++++++++++++++++ pkg/wrapper/ogame_test.go | 16 ++++++++++++++++ pkg/wrapper/prioritize.go | 7 +++++++ 11 files changed, 106 insertions(+), 1 deletion(-) diff --git a/pkg/extractor/extractor.go b/pkg/extractor/extractor.go index 99b72437..3d535ddb 100644 --- a/pkg/extractor/extractor.go +++ b/pkg/extractor/extractor.go @@ -24,6 +24,7 @@ type Extractor interface { ExtractAuction(pageHTML []byte) (ogame.Auction, error) ExtractBuffActivation(pageHTML []byte) (string, []ogame.Item, error) ExtractCancelBuildingInfos(pageHTML []byte) (token string, techID, listID int64, err error) + ExtractCancelLfBuildingInfos(pageHTML []byte) (token string, id, listID int64, err error) ExtractCancelFleetToken(pageHTML []byte, fleetID ogame.FleetID) (string, error) ExtractCancelResearchInfos(pageHTML []byte) (token string, techID, listID int64, err error) ExtractCelestial(pageHTML []byte, v any) (ogame.Celestial, error) diff --git a/pkg/extractor/v6/extractor.go b/pkg/extractor/v6/extractor.go index 2efd59a9..827a0ed3 100644 --- a/pkg/extractor/v6/extractor.go +++ b/pkg/extractor/v6/extractor.go @@ -39,6 +39,10 @@ func (e *Extractor) GetLanguage() string { return e.lang } +func (e *Extractor) ExtractCancelLfBuildingInfos(pageHTML []byte) (token string, id, listID int64, err error) { + panic("implement me") +} + // ExtractActiveItems ... func (e *Extractor) ExtractActiveItems(pageHTML []byte) ([]ogame.ActiveItem, error) { panic("implement me") diff --git a/pkg/extractor/v9/extractor.go b/pkg/extractor/v9/extractor.go index d9bc23dc..b3d53c85 100644 --- a/pkg/extractor/v9/extractor.go +++ b/pkg/extractor/v9/extractor.go @@ -17,6 +17,16 @@ func NewExtractor() *Extractor { return &Extractor{} } +// ExtractCancelLfBuildingInfos ... +func (e *Extractor) ExtractCancelLfBuildingInfos(pageHTML []byte) (token string, id, listID int64, err error) { + return extractCancelLfBuildingInfos(pageHTML) +} + +// ExtractCancelResearchInfos ... +func (e *Extractor) ExtractCancelResearchInfos(pageHTML []byte) (token string, id, listID int64, err error) { + return extractCancelResearchInfos(pageHTML) +} + // ExtractEmpire ... func (e *Extractor) ExtractEmpire(pageHTML []byte) ([]ogame.EmpireCelestial, error) { return extractEmpireV9(pageHTML) diff --git a/pkg/extractor/v9/extracts.go b/pkg/extractor/v9/extracts.go index 3f5d16b6..337bbc52 100644 --- a/pkg/extractor/v9/extracts.go +++ b/pkg/extractor/v9/extracts.go @@ -1,6 +1,7 @@ package v9 import ( + "bytes" "errors" "github.com/PuerkitoBio/goquery" "github.com/alaingilbert/ogame/pkg/extractor/v6" @@ -12,6 +13,34 @@ import ( "time" ) +func extractCancelInfos(pageHTML []byte, linkVarName, fnName string, tableIdx int) (token string, id, listID int64, err error) { + r1 := regexp.MustCompile(linkVarName + `[^?]+\?page=ingame&component=overview&modus=2&token=(\w+)&action=cancel`) + m1 := r1.FindSubmatch(pageHTML) + if len(m1) < 2 { + return "", 0, 0, errors.New("unable to find token") + } + token = string(m1[1]) + doc, _ := goquery.NewDocumentFromReader(bytes.NewReader(pageHTML)) + t := doc.Find("table.construction").Eq(tableIdx) + a, _ := t.Find("a.abortNow").Attr("onclick") + r := regexp.MustCompile(fnName + `\((\d+),\s?(\d+),`) + m := r.FindStringSubmatch(a) + if len(m) < 3 { + return "", 0, 0, errors.New("unable to find id/listid") + } + id = utils.DoParseI64(m[1]) + listID = utils.DoParseI64(m[2]) + return +} + +func extractCancelLfBuildingInfos(pageHTML []byte) (token string, id, listID int64, err error) { + return extractCancelInfos(pageHTML, "cancelLinklfbuilding", "cancellfbuilding", 1) +} + +func extractCancelResearchInfos(pageHTML []byte) (token string, techID, listID int64, err error) { + return extractCancelInfos(pageHTML, "cancelLinkresearch", "cancelresearch", 2) +} + func extractEmpireV9(pageHTML []byte) ([]ogame.EmpireCelestial, error) { var out []ogame.EmpireCelestial raw, err := v6.ExtractEmpireJSON(pageHTML) diff --git a/pkg/ogame/id.go b/pkg/ogame/id.go index febeb8aa..d7493616 100644 --- a/pkg/ogame/id.go +++ b/pkg/ogame/id.go @@ -197,9 +197,24 @@ func (o ID) IsResourceBuilding() bool { o == SeabedDeuteriumDenID } +func (o ID) IsLfBuilding() bool { + return o == ResidentialSectorID || + o == BiosphereFarmID || + o == ResearchCentreID || + o == AcademyOfSciencesID || + o == NeuroCalibrationCentreID || + o == HighEnergySmeltingID || + o == FoodSiloID || + o == FusionPoweredProductionID || + o == SkyscraperID || + o == BiotechLabID || + o == MetropolisID || + o == PlanetaryShieldID +} + // IsBuilding returns either or not the id is a building (facility, resource building) func (o ID) IsBuilding() bool { - return o.IsResourceBuilding() || o.IsFacility() + return o.IsResourceBuilding() || o.IsLfBuilding() || o.IsFacility() } // IsTech returns either or not the id is a technology diff --git a/pkg/parser/overviewPage.go b/pkg/parser/overviewPage.go index 6cb65288..8fd5d372 100644 --- a/pkg/parser/overviewPage.go +++ b/pkg/parser/overviewPage.go @@ -27,3 +27,7 @@ func (p OverviewPage) ExtractCancelResearchInfos() (token string, techID, listID func (p OverviewPage) ExtractCancelBuildingInfos() (token string, techID, listID int64, err error) { return p.e.ExtractCancelBuildingInfos(p.content) } + +func (p OverviewPage) ExtractCancelLfBuildingInfos() (token string, id, listID int64, err error) { + return p.e.ExtractCancelLfBuildingInfos(p.content) +} diff --git a/pkg/wrapper/fetcher.go b/pkg/wrapper/fetcher.go index 22def64d..bb19c89d 100644 --- a/pkg/wrapper/fetcher.go +++ b/pkg/wrapper/fetcher.go @@ -11,6 +11,7 @@ const ( PreferencesPageName = "preferences" ResourceSettingsPageName = "resourceSettings" DefensesPageName = "defenses" + LfbuildingsPageName = "lfbuildings" SuppliesPageName = "supplies" FacilitiesPageName = "facilities" FleetdispatchPageName = "fleetdispatch" diff --git a/pkg/wrapper/interfaces.go b/pkg/wrapper/interfaces.go index 73ca6d11..5e527985 100644 --- a/pkg/wrapper/interfaces.go +++ b/pkg/wrapper/interfaces.go @@ -109,6 +109,7 @@ type Prioritizable interface { BuildShips(celestialID ogame.CelestialID, shipID ogame.ID, nbr int64) error BuildTechnology(celestialID ogame.CelestialID, technologyID ogame.ID) error CancelBuilding(ogame.CelestialID) error + CancelLfBuilding(ogame.CelestialID) error CancelResearch(ogame.CelestialID) error ConstructionsBeingBuilt(ogame.CelestialID) (buildingID ogame.ID, buildingCountdown int64, researchID ogame.ID, researchCountdown int64) EnsureFleet(celestialID ogame.CelestialID, ships []ogame.Quantifiable, speed ogame.Speed, where ogame.Coordinate, mission ogame.MissionID, resources ogame.Resources, holdingTime, unionID int64) (ogame.Fleet, error) diff --git a/pkg/wrapper/ogame.go b/pkg/wrapper/ogame.go index f75bc3f9..d5ef8a5d 100644 --- a/pkg/wrapper/ogame.go +++ b/pkg/wrapper/ogame.go @@ -513,6 +513,7 @@ func postSessions(b *OGame, lobby, username, password, otpSecret string) (out *G } cookies = append(cookies, cookie) b.client.Jar.SetCookies(u, cookies) + fmt.Println("bearer", out.Token) b.bearerToken = out.Token return out, nil } @@ -2949,6 +2950,8 @@ func (b *OGame) build(celestialID ogame.CelestialID, id ogame.ID, nbr int64) err page = DefensesPageName } else if id.IsShip() { page = ShipyardPageName + } else if id.IsLfBuilding() { + page = LfbuildingsPageName } else if id.IsBuilding() { page = SuppliesPageName } else if id.IsTech() { @@ -3057,6 +3060,15 @@ func (b *OGame) cancelBuilding(celestialID ogame.CelestialID) error { return b.cancel(token, techID, listID) } +func (b *OGame) cancelLfBuilding(celestialID ogame.CelestialID) error { + page, err := getPage[parser.OverviewPage](b, ChangePlanet(celestialID)) + if err != nil { + return err + } + token, id, listID, _ := page.ExtractCancelLfBuildingInfos() + return b.cancel(token, id, listID) +} + func (b *OGame) cancelResearch(celestialID ogame.CelestialID) error { page, err := getPage[parser.OverviewPage](b, ChangePlanet(celestialID)) if err != nil { @@ -4457,6 +4469,11 @@ func (b *OGame) CancelBuilding(celestialID ogame.CelestialID) error { return b.WithPriority(taskRunner.Normal).CancelBuilding(celestialID) } +// CancelLfBuilding cancel the construction of a lifeform building on a specified planet +func (b *OGame) CancelLfBuilding(celestialID ogame.CelestialID) error { + return b.WithPriority(taskRunner.Normal).CancelLfBuilding(celestialID) +} + // CancelResearch cancel the research func (b *OGame) CancelResearch(celestialID ogame.CelestialID) error { return b.WithPriority(taskRunner.Normal).CancelResearch(celestialID) diff --git a/pkg/wrapper/ogame_test.go b/pkg/wrapper/ogame_test.go index 28952709..7839aef7 100644 --- a/pkg/wrapper/ogame_test.go +++ b/pkg/wrapper/ogame_test.go @@ -2166,6 +2166,22 @@ func TestCancelV7(t *testing.T) { assert.Equal(t, int64(1336041), listID) } +func TestCancelLfBuildingV902(t *testing.T) { + pageHTMLBytes, _ := ioutil.ReadFile("../../samples/v9.0.2/en/overview_all_queues.html") + token, id, listID, _ := v9.NewExtractor().ExtractCancelLfBuildingInfos(pageHTMLBytes) + assert.Equal(t, "07287218c9661bcc67b05ec1b6171fe8", token) + assert.Equal(t, int64(11101), id) + assert.Equal(t, int64(3998104), listID) +} + +func TestCancelResearchV902(t *testing.T) { + pageHTMLBytes, _ := ioutil.ReadFile("../../samples/v9.0.2/en/overview_all_queues.html") + token, id, listID, _ := v9.NewExtractor().ExtractCancelResearchInfos(pageHTMLBytes) + assert.Equal(t, "07287218c9661bcc67b05ec1b6171fe8", token) + assert.Equal(t, int64(113), id) + assert.Equal(t, int64(3998106), listID) +} + func TestCancelResearch(t *testing.T) { pageHTMLBytes, _ := ioutil.ReadFile("../../samples/unversioned/overview_active_queue2.html") token, techID, listID, _ := v6.NewExtractor().ExtractCancelResearchInfos(pageHTMLBytes) diff --git a/pkg/wrapper/prioritize.go b/pkg/wrapper/prioritize.go index b69ceaa7..afea5366 100644 --- a/pkg/wrapper/prioritize.go +++ b/pkg/wrapper/prioritize.go @@ -389,6 +389,13 @@ func (b *Prioritize) CancelBuilding(celestialID ogame.CelestialID) error { return b.bot.cancelBuilding(celestialID) } +// CancelLfBuilding cancel the construction of a lifeform building on a specified planet +func (b *Prioritize) CancelLfBuilding(celestialID ogame.CelestialID) error { + b.begin("CancelLfBuilding") + defer b.done() + return b.bot.cancelLfBuilding(celestialID) +} + // CancelResearch cancel the research func (b *Prioritize) CancelResearch(celestialID ogame.CelestialID) error { b.begin("CancelResearch") From 62b5ba8d1772d04bf6b4a9f6c0d43e693ceb2e53 Mon Sep 17 00:00:00 2001 From: Alain Gilbert Date: Sat, 20 Aug 2022 05:28:17 -0700 Subject: [PATCH 3/8] dedup code --- pkg/extractor/v7/extracts.go | 34 +++++++++++----------------------- pkg/extractor/v9/extracts.go | 26 +++----------------------- 2 files changed, 14 insertions(+), 46 deletions(-) diff --git a/pkg/extractor/v7/extracts.go b/pkg/extractor/v7/extracts.go index c9229110..6019efac 100644 --- a/pkg/extractor/v7/extracts.go +++ b/pkg/extractor/v7/extracts.go @@ -600,44 +600,32 @@ func extractEspionageReportFromDocV7(doc *goquery.Document, location *time.Locat return report, nil } -func extractCancelBuildingInfosV7(pageHTML []byte) (token string, techID, listID int64, err error) { - r1 := regexp.MustCompile(`cancelLinkbuilding[^?]+\?page=ingame&component=overview&modus=2&token=(\w+)&action=cancel`) +func ExtractCancelInfos(pageHTML []byte, linkVarName, fnName string, tableIdx int) (token string, id, listID int64, err error) { + r1 := regexp.MustCompile(linkVarName + `[^?]+\?page=ingame&component=overview&modus=2&token=(\w+)&action=cancel`) m1 := r1.FindSubmatch(pageHTML) if len(m1) < 2 { return "", 0, 0, errors.New("unable to find token") } token = string(m1[1]) doc, _ := goquery.NewDocumentFromReader(bytes.NewReader(pageHTML)) - t := doc.Find("table.construction").Eq(0) + t := doc.Find("table.construction").Eq(tableIdx) a, _ := t.Find("a.abortNow").Attr("onclick") - r := regexp.MustCompile(`cancelbuilding\((\d+),\s?(\d+),`) + r := regexp.MustCompile(fnName + `\((\d+),\s?(\d+),`) m := r.FindStringSubmatch(a) if len(m) < 3 { - return "", 0, 0, errors.New("unable to find techid/listid") + return "", 0, 0, errors.New("unable to find id/listid") } - techID = utils.DoParseI64(m[1]) + id = utils.DoParseI64(m[1]) listID = utils.DoParseI64(m[2]) return } +func extractCancelBuildingInfosV7(pageHTML []byte) (token string, techID, listID int64, err error) { + return ExtractCancelInfos(pageHTML, "cancelLinkbuilding", "cancelbuilding", 0) +} + func extractCancelResearchInfosV7(pageHTML []byte) (token string, techID, listID int64, err error) { - r1 := regexp.MustCompile(`cancelLinkresearch[^?]+\?page=ingame&component=overview&modus=2&token=(\w+)&action=cancel`) - m1 := r1.FindSubmatch(pageHTML) - if len(m1) < 2 { - return "", 0, 0, errors.New("unable to find token") - } - token = string(m1[1]) - doc, _ := goquery.NewDocumentFromReader(bytes.NewReader(pageHTML)) - t := doc.Find("table.construction").Eq(1) - a, _ := t.Find("a.abortNow").Attr("onclick") - r := regexp.MustCompile(`cancelresearch\((\d+),\s?(\d+),`) - m := r.FindStringSubmatch(a) - if len(m) < 3 { - return "", 0, 0, errors.New("unable to find techid/listid") - } - techID = utils.DoParseI64(m[1]) - listID = utils.DoParseI64(m[2]) - return + return ExtractCancelInfos(pageHTML, "cancelLinkresearch", "cancelresearch", 1) } func extractResourceSettingsFromDocV7(doc *goquery.Document) (ogame.ResourceSettings, error) { diff --git a/pkg/extractor/v9/extracts.go b/pkg/extractor/v9/extracts.go index 337bbc52..383b864f 100644 --- a/pkg/extractor/v9/extracts.go +++ b/pkg/extractor/v9/extracts.go @@ -1,10 +1,10 @@ package v9 import ( - "bytes" "errors" "github.com/PuerkitoBio/goquery" "github.com/alaingilbert/ogame/pkg/extractor/v6" + v7 "github.com/alaingilbert/ogame/pkg/extractor/v7" "github.com/alaingilbert/ogame/pkg/extractor/v71" "github.com/alaingilbert/ogame/pkg/ogame" "github.com/alaingilbert/ogame/pkg/utils" @@ -13,32 +13,12 @@ import ( "time" ) -func extractCancelInfos(pageHTML []byte, linkVarName, fnName string, tableIdx int) (token string, id, listID int64, err error) { - r1 := regexp.MustCompile(linkVarName + `[^?]+\?page=ingame&component=overview&modus=2&token=(\w+)&action=cancel`) - m1 := r1.FindSubmatch(pageHTML) - if len(m1) < 2 { - return "", 0, 0, errors.New("unable to find token") - } - token = string(m1[1]) - doc, _ := goquery.NewDocumentFromReader(bytes.NewReader(pageHTML)) - t := doc.Find("table.construction").Eq(tableIdx) - a, _ := t.Find("a.abortNow").Attr("onclick") - r := regexp.MustCompile(fnName + `\((\d+),\s?(\d+),`) - m := r.FindStringSubmatch(a) - if len(m) < 3 { - return "", 0, 0, errors.New("unable to find id/listid") - } - id = utils.DoParseI64(m[1]) - listID = utils.DoParseI64(m[2]) - return -} - func extractCancelLfBuildingInfos(pageHTML []byte) (token string, id, listID int64, err error) { - return extractCancelInfos(pageHTML, "cancelLinklfbuilding", "cancellfbuilding", 1) + return v7.ExtractCancelInfos(pageHTML, "cancelLinklfbuilding", "cancellfbuilding", 1) } func extractCancelResearchInfos(pageHTML []byte) (token string, techID, listID int64, err error) { - return extractCancelInfos(pageHTML, "cancelLinkresearch", "cancelresearch", 2) + return v7.ExtractCancelInfos(pageHTML, "cancelLinkresearch", "cancelresearch", 2) } func extractEmpireV9(pageHTML []byte) ([]ogame.EmpireCelestial, error) { From cb3af145d541daf9d5e42cd3a05d009f446522ee Mon Sep 17 00:00:00 2001 From: Alain Gilbert Date: Sat, 20 Aug 2022 05:57:15 -0700 Subject: [PATCH 4/8] extractor LifeformEnabled --- pkg/extractor/extractor.go | 2 + pkg/extractor/v6/extractor.go | 11 +- pkg/extractor/v9/extractor.go | 2 +- pkg/extractor/v9/extracts.go | 8 +- pkg/parser/fullPage_test.go | 2 +- pkg/wrapper/ogame_test.go | 22 +- samples/v9.0.2/en/{ => lifeform}/defence.html | 0 .../en/lifeform/overview_all_queues.html | 1871 +++++++++ .../{ => lifeform}/overview_ships_queue.html | 0 samples/v9.0.2/en/overview_all_queues.html | 3411 +++++++++-------- 10 files changed, 3648 insertions(+), 1681 deletions(-) rename samples/v9.0.2/en/{ => lifeform}/defence.html (100%) create mode 100644 samples/v9.0.2/en/lifeform/overview_all_queues.html rename samples/v9.0.2/en/{ => lifeform}/overview_ships_queue.html (100%) diff --git a/pkg/extractor/extractor.go b/pkg/extractor/extractor.go index 3d535ddb..7d4db77b 100644 --- a/pkg/extractor/extractor.go +++ b/pkg/extractor/extractor.go @@ -16,6 +16,8 @@ type Extractor interface { SetLanguage(lang string) GetLocation() *time.Location SetLocation(loc *time.Location) + GetLifeformEnabled() bool + SetLifeformEnabled(lifeformEnabled bool) ExtractActiveItems(pageHTML []byte) ([]ogame.ActiveItem, error) ExtractAdmiral(pageHTML []byte) bool ExtractAjaxChatToken(pageHTML []byte) (string, error) diff --git a/pkg/extractor/v6/extractor.go b/pkg/extractor/v6/extractor.go index 827a0ed3..6dcfabb2 100644 --- a/pkg/extractor/v6/extractor.go +++ b/pkg/extractor/v6/extractor.go @@ -13,8 +13,9 @@ import ( // Extractor ... type Extractor struct { - loc *time.Location - lang string + loc *time.Location + lang string + lifeformEnabled bool } // NewExtractor ... @@ -24,8 +25,10 @@ func NewExtractor() *Extractor { return &Extractor{} } -func (e *Extractor) SetLocation(loc *time.Location) { e.loc = loc } -func (e *Extractor) SetLanguage(lang string) { e.lang = lang } +func (e *Extractor) SetLocation(loc *time.Location) { e.loc = loc } +func (e *Extractor) SetLanguage(lang string) { e.lang = lang } +func (e *Extractor) SetLifeformEnabled(lifeformEnabled bool) { e.lifeformEnabled = lifeformEnabled } +func (e *Extractor) GetLifeformEnabled() bool { return e.lifeformEnabled } func (e *Extractor) GetLocation() *time.Location { if e.loc == nil { return time.UTC diff --git a/pkg/extractor/v9/extractor.go b/pkg/extractor/v9/extractor.go index b3d53c85..9bc7c341 100644 --- a/pkg/extractor/v9/extractor.go +++ b/pkg/extractor/v9/extractor.go @@ -24,7 +24,7 @@ func (e *Extractor) ExtractCancelLfBuildingInfos(pageHTML []byte) (token string, // ExtractCancelResearchInfos ... func (e *Extractor) ExtractCancelResearchInfos(pageHTML []byte) (token string, id, listID int64, err error) { - return extractCancelResearchInfos(pageHTML) + return extractCancelResearchInfos(pageHTML, e.GetLifeformEnabled()) } // ExtractEmpire ... diff --git a/pkg/extractor/v9/extracts.go b/pkg/extractor/v9/extracts.go index 383b864f..80185481 100644 --- a/pkg/extractor/v9/extracts.go +++ b/pkg/extractor/v9/extracts.go @@ -17,8 +17,12 @@ func extractCancelLfBuildingInfos(pageHTML []byte) (token string, id, listID int return v7.ExtractCancelInfos(pageHTML, "cancelLinklfbuilding", "cancellfbuilding", 1) } -func extractCancelResearchInfos(pageHTML []byte) (token string, techID, listID int64, err error) { - return v7.ExtractCancelInfos(pageHTML, "cancelLinkresearch", "cancelresearch", 2) +func extractCancelResearchInfos(pageHTML []byte, lifeformEnabled bool) (token string, techID, listID int64, err error) { + tableIdx := 1 + if lifeformEnabled { + tableIdx = 2 + } + return v7.ExtractCancelInfos(pageHTML, "cancelLinkresearch", "cancelresearch", tableIdx) } func extractEmpireV9(pageHTML []byte) ([]ogame.EmpireCelestial, error) { diff --git a/pkg/parser/fullPage_test.go b/pkg/parser/fullPage_test.go index 975a122a..36bf3b14 100644 --- a/pkg/parser/fullPage_test.go +++ b/pkg/parser/fullPage_test.go @@ -11,7 +11,7 @@ import ( ) func TestExtractCelestial(t *testing.T) { - pageHTML, _ := ioutil.ReadFile("../../samples/v9.0.2/en/overview_all_queues.html") + pageHTML, _ := ioutil.ReadFile("../../samples/v9.0.2/en/lifeform/overview_all_queues.html") p := FullPage{Page: Page{e: v9.NewExtractor(), content: pageHTML}} celestial, err := p.ExtractCelestial(33640820) assert.NoError(t, err) diff --git a/pkg/wrapper/ogame_test.go b/pkg/wrapper/ogame_test.go index 7839aef7..d57c64ca 100644 --- a/pkg/wrapper/ogame_test.go +++ b/pkg/wrapper/ogame_test.go @@ -2166,8 +2166,16 @@ func TestCancelV7(t *testing.T) { assert.Equal(t, int64(1336041), listID) } -func TestCancelLfBuildingV902(t *testing.T) { +func TestCancelBuildingV902(t *testing.T) { pageHTMLBytes, _ := ioutil.ReadFile("../../samples/v9.0.2/en/overview_all_queues.html") + token, id, listID, _ := v9.NewExtractor().ExtractCancelBuildingInfos(pageHTMLBytes) + assert.Equal(t, "66f639922a3c76fe6074d12ae36e573e", token) + assert.Equal(t, int64(1), id) + assert.Equal(t, int64(3469488), listID) +} + +func TestCancelLfBuildingLFV902(t *testing.T) { + pageHTMLBytes, _ := ioutil.ReadFile("../../samples/v9.0.2/en/lifeform/overview_all_queues.html") token, id, listID, _ := v9.NewExtractor().ExtractCancelLfBuildingInfos(pageHTMLBytes) assert.Equal(t, "07287218c9661bcc67b05ec1b6171fe8", token) assert.Equal(t, int64(11101), id) @@ -2177,6 +2185,16 @@ func TestCancelLfBuildingV902(t *testing.T) { func TestCancelResearchV902(t *testing.T) { pageHTMLBytes, _ := ioutil.ReadFile("../../samples/v9.0.2/en/overview_all_queues.html") token, id, listID, _ := v9.NewExtractor().ExtractCancelResearchInfos(pageHTMLBytes) + assert.Equal(t, "66f639922a3c76fe6074d12ae36e573e", token) + assert.Equal(t, int64(108), id) + assert.Equal(t, int64(3469490), listID) +} + +func TestCancelResearchLFV902(t *testing.T) { + pageHTMLBytes, _ := ioutil.ReadFile("../../samples/v9.0.2/en/lifeform/overview_all_queues.html") + e := v9.NewExtractor() + e.SetLifeformEnabled(true) + token, id, listID, _ := e.ExtractCancelResearchInfos(pageHTMLBytes) assert.Equal(t, "07287218c9661bcc67b05ec1b6171fe8", token) assert.Equal(t, int64(113), id) assert.Equal(t, int64(3998106), listID) @@ -2484,7 +2502,7 @@ func TestV71ExtractOverviewProduction(t *testing.T) { } func TestV902ExtractOverviewProduction(t *testing.T) { - pageHTMLBytes, _ := ioutil.ReadFile("../../samples/v9.0.2/en/overview_all_queues.html") + pageHTMLBytes, _ := ioutil.ReadFile("../../samples/v9.0.2/en/lifeform/overview_all_queues.html") prods, countdown, _ := v9.NewExtractor().ExtractOverviewProduction(pageHTMLBytes) assert.Equal(t, 4, len(prods)) assert.Equal(t, int64(1660), countdown) diff --git a/samples/v9.0.2/en/defence.html b/samples/v9.0.2/en/lifeform/defence.html similarity index 100% rename from samples/v9.0.2/en/defence.html rename to samples/v9.0.2/en/lifeform/defence.html diff --git a/samples/v9.0.2/en/lifeform/overview_all_queues.html b/samples/v9.0.2/en/lifeform/overview_all_queues.html new file mode 100644 index 00000000..2842a540 --- /dev/null +++ b/samples/v9.0.2/en/lifeform/overview_all_queues.html @@ -0,0 +1,1871 @@ + + + Halley OGame + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + +
+
+
+
+
+ +
+
+
+ +
+ +
+
+
+ + 208.338 + +
+
+
+
+
+ + 95.025 + +
+
+
+
+
+ + 394.522 + +
+
+
+
+
+ + -2.556 + +
+
+
+
+
+ + 86.499.097 + +
+
+
+
+
+ + 0 + +
+
+
+
+ + +
+
+ + 8.000 + +
+
+
+ +
+ +
+
+ + + 48 + + + + + 0 + + +
+ +
+ ajax spinner + load... +
+ +
+
+ +
+
+
+ +
+
+
+
+ ? +
+
+
+
+
+
+ +
+ + + + + + +
+
+ +
+
+
+
+
+
+
+ + +

Events

+
+ + + +
+
+
+
+ + + +
+
+ +
+
+
+ + +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
Metal:(+9.682) 208.335 / 2.920.000
21.08 11:38:56
Crystal:(+5.578) 95.023 / 2.920.000
30.08 22:01:33
Deuterium:(+3.384) 394.521 / 1.590.000
24.08 12:51:00
+ + + +
+ + + +
+ + + +
+ + +
+ + +
+
+ + +
+
+ +
+
+ +
+ +
+ + +
+
+
+
+
+
+
+

Buildings

+
+
+ + + + + + + + + + + + + + + + + + + +
Solar Plant
+ + Improve to + Level 21 +
Duration:
+ load... +
+ +
+ + Halve time + + + Costs: + 5.250 DM + +
+
+
+ +
+ +
+
+
+

Lifeform Buildings

+
+
+ + + + + + + + + + + + + + + + + + + +
Residential Sector
+ + Improve to + Level 28 +
Duration:
+ load... +
+ +
+ + Halve time + + + Costs: + 2.250 DM + +
+
+
+ +
+ +
+
+
+
+
+

Research

+
+
+ + + + + + + + + + + + + + + + + + + +
Energy Technology
+ + Research to + Level 5 +
Duration:
+ load... +
+ +
+ + Halve time + + + Costs: + 750 DM + +
+
+
+ +
+ +
+
+ +
+
+
+ +
+
+

Shipyard

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Small Cargo
+
+ + Small Cargo + +
+
1
+
Building duration
+ load... +
Total time:
+ load... +
+ +
+ + Halve time + + + Costs: + 750 DM + +
+
+ + + + + + + + + +
+ Small Cargo
+ 2 +
+ Light Fighter
+ 3 +
+ Rocket Launcher
+ 2 +
+
+ +
+ +
+
+
+ + + +
+
+ +
+
+
+ + + + + +
+
+ +
+ +
+
    +
  • +
    +
    + 0 Contact(s) online +
  • +
+ + +
+
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/v9.0.2/en/overview_ships_queue.html b/samples/v9.0.2/en/lifeform/overview_ships_queue.html similarity index 100% rename from samples/v9.0.2/en/overview_ships_queue.html rename to samples/v9.0.2/en/lifeform/overview_ships_queue.html diff --git a/samples/v9.0.2/en/overview_all_queues.html b/samples/v9.0.2/en/overview_all_queues.html index 2842a540..ae7b16bc 100644 --- a/samples/v9.0.2/en/overview_all_queues.html +++ b/samples/v9.0.2/en/overview_all_queues.html @@ -1,445 +1,535 @@ - - Halley OGame - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + Ferdinand OGame + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + - - + ); + + +
- +
- -
- - - - -
-
- -
+ +
+ + + + + -
-
- +
+ + +
+ +
- + +
+ +
@@ -447,1425 +537,1404 @@
-
-
-
-
- +
+
+
+ +
+ +
+
+
+ + 13.537 -
-
-
-
-
- - -2.556 +
+
+
+
+
+ + 451.293 -
-
-
-
-
- - 86.499.097 +
+
+
+
+
+ + 538.573 -
-
-
-
-
- - 0 +
+
+
+
+
+ + -2.141 -
-
-
-
- - -
-
- +
+
+
+
+ + +
+
+ 8.000 -
-
-
- +
-
-
- -
-
-
-
- -
-
-
-
- - - - + var isMobile = false; + var LocalizationStrings = {"timeunits":{"short":{"year":"y","month":"m","week":"w","day":"d","hour":"h","minute":"m","second":"s"}},"status":{"ready":"done"},"decimalPoint":".","thousandSeperator":".","unitMega":"Mn","unitKilo":"K","unitMilliard":"Bn","question":"Question","error":"Error","loading":"load...","notice":"Reference","yes":"yes","no":"No","ok":"Ok","attention":"Caution","outlawWarning":"You are about to attack a stronger player. If you do this, your attack defences will be shut down for 7 days and all players will be able to attack you without punishment. Are you sure you want to continue?","lastSlotWarningMoon":"This building will use the last available building slot. Expand your Lunar Base to receive more space. Are you sure you want to build this building?","lastSlotWarningPlanet":"This building will use the last available building slot. Expand your Terraformer or buy a Planet Field item to obtain more slots. Are you sure you want to build this building?","forcedVacationWarning":"Confirm your lobby account now and we\u2019ll gift you Dark Matter in each universe!","planetMoveBreakUpWarning":"Caution! This mission may still be running once the relocation period starts and if this is the case, the process will be cancelled. Do you really want to continue with this job?","moreDetails":"More details","lessDetails":"Less detail","planetOrder":{"lock":"Lock arrangement","unlock":"Unlock arrangement"},"darkMatter":"Dark Matter","errorNotEnoughDM":"Not enough Dark Matter available! Do you want to buy some now?","activateItem":{"upgradeItemQuestion":"Would you like to replace the existing item? The old bonus will be lost in the process.","upgradeItemQuestionHeader":"Replace item?"},"characterClassItem":{"buyAndActivateItemQuestion":"Do you want to activate the #characterClassName# class for #darkmatter# Dark Matter? In doing so, you will lose your current class.","activateItemQuestion":"Do you want to activate the #characterClassName# class? In doing so, you will lose your current class."},"allianceClassItem":{"buyAndActivateItemQuestion":"Do you want to activate the alliance class #allianceClassName# for #darkmatter# Dark Matter? In doing so, you will lose your current alliance class.","activateItemQuestion":"Do you want to activate the alliance class #allianceClassName#? In doing so, you will lose your current alliance class.","appendCurrentClassQuestion":"

Current alliance class: #currentAllianceClassName#

Last changed on: #lastAllianceClassChange#"},"LOCA_ALL_NETWORK_ATTENTION":"Caution","LOCA_ALL_YES":"yes","LOCA_ALL_NO":"No","redirectMessage":"By following this link, you will leave OGame. Do you wish to continue?"}; + + (function($) { + reloadResources({"resources":{"metal":{"amount":13537,"storage":5355000,"baseProduction":0.05,"production":3.7958554704570022,"tooltip":"Metal|
Available:<\/th>13.537<\/span><\/td><\/tr>
Storage capacity<\/th>5.355.000<\/span><\/td><\/tr>
Current production:<\/th>+13.665<\/span><\/td><\/tr>
Den Capacity:<\/th>58.123<\/span><\/td><\/tr><\/table>","classesListItem":"","shopUrl":"https:\/\/s184-en.ogame.gameforge.com\/game\/index.php?page=shop#category=d8d49c315fa620d9c7f1f19963970dea59a0e3be&item=859d82d316b83848f7365d21949b3e1e63c7841f"},"crystal":{"amount":451293,"storage":2920000,"baseProduction":0.025,"production":2.1817515352239014,"tooltip":"Crystal|
Available:<\/th>451.293<\/span><\/td><\/tr>
Storage capacity<\/th>2.920.000<\/span><\/td><\/tr>
Current production:<\/th>+7.854<\/span><\/td><\/tr>
Den Capacity:<\/th>30.119<\/span><\/td><\/tr><\/table>","classesListItem":"","shopUrl":"https:\/\/s184-en.ogame.gameforge.com\/game\/index.php?page=shop#category=d8d49c315fa620d9c7f1f19963970dea59a0e3be&item=bb2f6843226ef598f0b567b92c51b283de90aa48"},"deuterium":{"amount":538573,"storage":1590000,"baseProduction":0,"production":1.4277806527289036,"tooltip":"Deuterium|
Available:<\/th>538.573<\/span><\/td><\/tr>
Storage capacity<\/th>1.590.000<\/span><\/td><\/tr>
Current production:<\/th>+5.140<\/span><\/td><\/tr>
Den Capacity:<\/th>17.723<\/span><\/td><\/tr><\/table>","classesListItem":"","shopUrl":"https:\/\/s184-en.ogame.gameforge.com\/game\/index.php?page=shop#category=d8d49c315fa620d9c7f1f19963970dea59a0e3be&item=cb72ed207dd871832a850ee29f1c1f83aa3f4f36"},"energy":{"amount":-2141,"tooltip":"Energy|
Available:<\/th>-2.141<\/span><\/td><\/tr>
Current production:<\/th>+2.690<\/span><\/td><\/tr>
Consumption<\/th>-4.831<\/span><\/td><\/tr><\/table>","classesListItem":""},"darkmatter":{"amount":8000,"tooltip":"Dark Matter|
Available:<\/th>8.000<\/span><\/td><\/tr>
Purchased<\/th>0<\/span><\/td><\/tr>
Found<\/th>8.000<\/span><\/td><\/tr><\/table>","classesListItem":"","classes":"overlay","link":"https:\/\/s184-en.ogame.gameforge.com\/game\/index.php?page=payment","img":"https:\/\/gf1.geo.gfsrv.net\/cdnc5\/401d1a91ff40dc7c8acfa4377d3d65.gif"},"population":{"classesListItem":""},"food":{"classesListItem":""}},"techs":{"1":{"techId":1,"production":{"metal":6.727222222222222,"crystal":0,"deuterium":0,"energy":0},"consumption":{"metal":0,"crystal":0,"deuterium":0,"energy":0.3736111111111111}},"2":{"techId":2,"production":{"metal":0,"crystal":3.8733333333333335,"deuterium":0,"energy":0},"consumption":{"metal":0,"crystal":0,"deuterium":0,"energy":0.3227777777777778}},"3":{"techId":3,"production":{"metal":0,"crystal":0,"deuterium":2.5641666666666665,"energy":0},"consumption":{"metal":0,"crystal":0,"deuterium":0,"energy":0.6455555555555555}},"4":{"techId":4,"production":{"metal":0,"crystal":0,"deuterium":0,"energy":0.7472222222222222},"consumption":{"metal":0,"crystal":0,"deuterium":0,"energy":0}},"12":{"techId":12,"production":{"metal":0,"crystal":0,"deuterium":0,"energy":0},"consumption":{"metal":0,"crystal":0,"deuterium":0,"energy":0}},"212":{"techId":212,"production":{"metal":0,"crystal":0,"deuterium":0,"energy":0},"consumption":{"metal":0,"crystal":0,"deuterium":0,"energy":0}},"217":{"techId":217,"production":{"metal":0,"crystal":0,"deuterium":0,"energy":0},"consumption":{"metal":0,"crystal":0,"deuterium":0,"energy":0}}},"honorScore":0}); + })(jQuery); + + + - +
+
+ + + 11 - - - + + + 0 - -
- -
- ajax spinner - load... -
- -
-
- -
-
+ +
+ +
+ ajax spinner + load... +
+ +
+
+
+
+ + +
+
+
+ ? +
- -
-
-
-
-
- - -

Events

-
- - - -
-
-
-
- - +
+
+
+
+
+