forked from alaingilbert/ogame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.go
280 lines (254 loc) · 7 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
package ogame
import "strconv"
// MissionID represent a mission id
type MissionID int
func (m MissionID) String() string {
switch m {
case Attack:
return "Attack"
case GroupedAttack:
return "GroupedAttack"
case Transport:
return "Transport"
case Park:
return "Park"
case ParkInThatAlly:
return "ParkInThatAlly"
case Spy:
return "Spy"
case Colonize:
return "Colonize"
case RecycleDebrisField:
return "RecycleDebrisField"
case Destroy:
return "Destroy"
case MissileAttack:
return "MissileAttack"
case Expedition:
return "Expedition"
default:
return strconv.FormatInt(int64(m), 10)
}
}
// Speed represent a fleet speed
type Speed float64
// Float64 returns a float64 value of the speed
func (s Speed) Float64() float64 {
return float64(s)
}
// Int64 returns an integer value of the speed
func (s Speed) Int64() int64 {
return int64(s)
}
// Int returns an integer value of the speed
// Deprecated: backward compatibility
func (s Speed) Int() int64 {
return int64(s)
}
func (s Speed) String() string {
switch s {
case FivePercent:
return "5%"
case TenPercent:
return "10%"
case FifteenPercent:
return "15%"
case TwentyPercent:
return "20%"
case TwentyFivePercent:
return "25%"
case ThirtyPercent:
return "30%"
case ThirtyFivePercent:
return "35%"
case FourtyPercent:
return "40%"
case FourtyFivePercent:
return "45%"
case FiftyPercent:
return "50%"
case FiftyFivePercent:
return "55%"
case SixtyPercent:
return "60%"
case SixtyFivePercent:
return "65%"
case SeventyPercent:
return "70%"
case SeventyFivePercent:
return "75%"
case EightyPercent:
return "80%"
case EightyFivePercent:
return "85%"
case NinetyPercent:
return "90%"
case NinetyFivePercent:
return "95%"
case HundredPercent:
return "100%"
default:
return strconv.FormatFloat(float64(s), 'f', 1, 64)
}
}
// CelestialType destination type might be planet/moon/debris
type CelestialType int64
func (d CelestialType) String() string {
switch d {
case PlanetType:
return "planet"
case MoonType:
return "moon"
case DebrisType:
return "debris"
default:
return strconv.FormatInt(int64(d), 10)
}
}
// Int64 returns an integer value of the CelestialType
func (d CelestialType) Int64() int64 {
return int64(d)
}
// Int returns an integer value of the CelestialType
// Deprecated: backward compatibility
func (d CelestialType) Int() int64 {
return int64(d)
}
// AllianceClass ...
type AllianceClass int64
// IsWarrior ...
func (c AllianceClass) IsWarrior() bool {
return c == Warrior
}
// IsTrader ...
func (c AllianceClass) IsTrader() bool {
return c == Trader
}
// IsResearcher ...
func (c AllianceClass) IsResearcher() bool {
return c == Researcher
}
// CharacterClass ...
type CharacterClass int64
func (c CharacterClass) IsCollector() bool {
return c == Collector
}
func (c CharacterClass) IsGeneral() bool {
return c == General
}
func (c CharacterClass) IsDiscoverer() bool {
return c == Discoverer
}
// OGame constants
const (
NoClass CharacterClass = 0
Collector CharacterClass = 1
General CharacterClass = 2
Discoverer CharacterClass = 3
NoAllianceClass AllianceClass = 0
Warrior AllianceClass = 1
Trader AllianceClass = 2
Researcher AllianceClass = 3
PlanetType CelestialType = 1
DebrisType CelestialType = 2
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
// Missions
Attack MissionID = 1
GroupedAttack MissionID = 2
Transport MissionID = 3
Park MissionID = 4
ParkInThatAlly MissionID = 5
Spy MissionID = 6
Colonize MissionID = 7
RecycleDebrisField MissionID = 8
Destroy MissionID = 9
MissileAttack MissionID = 10
Expedition MissionID = 15
// Speeds
TenPercent Speed = 1
TwentyPercent Speed = 2
ThirtyPercent Speed = 3
FourtyPercent Speed = 4
FiftyPercent Speed = 5
SixtyPercent Speed = 6
SeventyPercent Speed = 7
EightyPercent Speed = 8
NinetyPercent Speed = 9
HundredPercent Speed = 10
FivePercent Speed = 0.5 // General class only detailed speeds
FifteenPercent Speed = 1.5
TwentyFivePercent Speed = 2.5
ThirtyFivePercent Speed = 3.5
FourtyFivePercent Speed = 4.5
FiftyFivePercent Speed = 5.5
SixtyFivePercent Speed = 6.5
SeventyFivePercent Speed = 7.5
EightyFivePercent Speed = 8.5
NinetyFivePercent Speed = 9.5
)