alaingilbert/ogame

Cost Calculator

galasky opened this issue · 2 comments

Is there a way to know the cost of building a building?

cost := ogame.MetalStorage.GetPrice(5)

Or if you want to use an ogame ID to dynamically get an object...

cost := ogame.Objs.ByID(ogame.MetalStorageID).GetPrice(5)

(5 being the level of a building/tech, or the number of ships/defenses to build)
cost will be a Resources object.

I believe something along those lines should work.


ogame/objs.go

Lines 5 to 66 in 83fdf41

AllianceDepot = newAllianceDepot() // Buildings
CrystalMine = newCrystalMine()
CrystalStorage = newCrystalStorage()
DeuteriumSynthesizer = newDeuteriumSynthesizer()
DeuteriumTank = newDeuteriumTank()
FusionReactor = newFusionReactor()
MetalMine = newMetalMine()
MetalStorage = newMetalStorage()
MissileSilo = newMissileSilo()
NaniteFactory = newNaniteFactory()
ResearchLab = newResearchLab()
RoboticsFactory = newRoboticsFactory()
SeabedDeuteriumDen = newSeabedDeuteriumDen()
ShieldedMetalDen = newShieldedMetalDen()
Shipyard = newShipyard()
SolarPlant = newSolarPlant()
SpaceDock = newSpaceDock()
LunarBase = newLunarBase()
SensorPhalanx = newSensorPhalanx()
JumpGate = newJumpGate()
Terraformer = newTerraformer()
UndergroundCrystalDen = newUndergroundCrystalDen()
SolarSatellite = newSolarSatellite()
AntiBallisticMissiles = newAntiBallisticMissiles() // Defense
GaussCannon = newGaussCannon()
HeavyLaser = newHeavyLaser()
InterplanetaryMissiles = newInterplanetaryMissiles()
IonCannon = newIonCannon()
LargeShieldDome = newLargeShieldDome()
LightLaser = newLightLaser()
PlasmaTurret = newPlasmaTurret()
RocketLauncher = newRocketLauncher()
SmallShieldDome = newSmallShieldDome()
Battlecruiser = newBattlecruiser() // Ships
Battleship = newBattleship()
Bomber = newBomber()
ColonyShip = newColonyShip()
Cruiser = newCruiser()
Deathstar = newDeathstar()
Destroyer = newDestroyer()
EspionageProbe = newEspionageProbe()
HeavyFighter = newHeavyFighter()
LargeCargo = newLargeCargo()
LightFighter = newLightFighter()
Recycler = newRecycler()
SmallCargo = newSmallCargo()
ArmourTechnology = newArmourTechnology() // Technologies
Astrophysics = newAstrophysics()
CombustionDrive = newCombustionDrive()
ComputerTechnology = newComputerTechnology()
EnergyTechnology = newEnergyTechnology()
EspionageTechnology = newEspionageTechnology()
GravitonTechnology = newGravitonTechnology()
HyperspaceDrive = newHyperspaceDrive()
HyperspaceTechnology = newHyperspaceTechnology()
ImpulseDrive = newImpulseDrive()
IntergalacticResearchNetwork = newIntergalacticResearchNetwork()
IonTechnology = newIonTechnology()
LaserTechnology = newLaserTechnology()
PlasmaTechnology = newPlasmaTechnology()
ShieldingTechnology = newShieldingTechnology()
WeaponsTechnology = newWeaponsTechnology()

Thx !