|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Orbital Base |
|
5
|
|
|
* |
|
6
|
|
|
* @author Jacky Casas |
|
7
|
|
|
* @copyright Expansion - le jeu |
|
8
|
|
|
* |
|
9
|
|
|
* @package Athena |
|
10
|
|
|
* @update 02.01.14 |
|
11
|
|
|
*/ |
|
12
|
|
|
namespace Asylamba\Modules\Athena\Model; |
|
13
|
|
|
|
|
14
|
|
|
use ErrorException; |
|
15
|
|
|
|
|
16
|
|
|
class OrbitalBase { |
|
17
|
|
|
# type of base |
|
18
|
|
|
const TYP_NEUTRAL = 0; |
|
19
|
|
|
const TYP_COMMERCIAL = 1; |
|
20
|
|
|
const TYP_MILITARY = 2; |
|
21
|
|
|
const TYP_CAPITAL = 3; |
|
22
|
|
|
|
|
23
|
|
|
const MAXCOMMANDERSTANDARD = 2; |
|
24
|
|
|
const MAXCOMMANDERMILITARY = 5; |
|
25
|
|
|
|
|
26
|
|
|
const COOL_DOWN = 12; |
|
27
|
|
|
const EXTRA_STOCK = 25000; |
|
28
|
|
|
|
|
29
|
|
|
const MAXCOMMANDERINMESS = 20; |
|
30
|
|
|
|
|
31
|
|
|
//ATTRIBUTES : ORBITALBASE |
|
32
|
|
|
public $rPlace; |
|
33
|
|
|
public $rPlayer; |
|
34
|
|
|
public $name; |
|
35
|
|
|
public $typeOfBase = 0; |
|
36
|
|
|
public $levelGenerator = 1; |
|
37
|
|
|
public $levelRefinery = 1; |
|
38
|
|
|
public $levelDock1 = 1; |
|
39
|
|
|
public $levelDock2 = 0; |
|
40
|
|
|
public $levelDock3 = 0; |
|
41
|
|
|
public $levelTechnosphere = 1; |
|
42
|
|
|
public $levelCommercialPlateforme = 0; |
|
43
|
|
|
public $levelStorage = 1; |
|
44
|
|
|
public $levelRecycling = 0; |
|
45
|
|
|
public $levelSpatioport = 0; |
|
46
|
|
|
public $points = 0; |
|
47
|
|
|
public $iSchool = 1000; |
|
48
|
|
|
public $iAntiSpy = 0; |
|
49
|
|
|
public $antiSpyAverage = 0; |
|
50
|
|
|
public $shipStorage = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); |
|
51
|
|
|
public $resourcesStorage = 5000; |
|
52
|
|
|
public $uOrbitalBase = ''; |
|
53
|
|
|
public $dCreation = ''; |
|
54
|
|
|
//ATTRIBUTES : PLACE |
|
55
|
|
|
public $position = 0; |
|
56
|
|
|
public $system = 0; |
|
57
|
|
|
public $xSystem = 0; |
|
58
|
|
|
public $ySystem = 0; |
|
59
|
|
|
public $sector = 0; |
|
60
|
|
|
public $sectorColor; |
|
61
|
|
|
public $tax = 0; |
|
62
|
|
|
public $planetPopulation = 0; |
|
63
|
|
|
public $planetResources = 0; |
|
64
|
|
|
public $planetHistory = 0; |
|
65
|
|
|
//ATTRIBUTES : OTHERS |
|
66
|
|
|
public $remainingTimeGenerator; |
|
67
|
|
|
public $remainingTimeDock1; |
|
68
|
|
|
public $remainingTimeDock2; |
|
69
|
|
|
public $remainingTimeDock3; |
|
70
|
|
|
public $routesNumber; |
|
71
|
|
|
//ATTRIBUTES : FUTURE LEVELS |
|
72
|
|
|
public $realGeneratorLevel; |
|
73
|
|
|
public $realRefineryLevel; |
|
74
|
|
|
public $realDock1Level; |
|
75
|
|
|
public $realDock2Level; |
|
76
|
|
|
public $realDock3Level; |
|
77
|
|
|
public $realTechnosphereLevel; |
|
78
|
|
|
public $realCommercialPlateformeLevel; |
|
79
|
|
|
public $realStorageLevel; |
|
80
|
|
|
public $realRecyclingLevel; |
|
81
|
|
|
public $realSpatioportLevel; |
|
82
|
|
|
// PUBLIC ATTRIBUTES |
|
83
|
|
|
public $buildingQueues = []; |
|
84
|
|
|
public $routeManager; |
|
85
|
|
|
public $technoQueues = []; |
|
86
|
|
|
public $commercialShippings = []; |
|
87
|
|
|
|
|
88
|
|
|
//GETTERS |
|
89
|
|
|
public function getId() { return $this->rPlace; } |
|
|
|
|
|
|
90
|
|
|
public function getRPlace() { return $this->rPlace; } |
|
|
|
|
|
|
91
|
|
|
public function getRPlayer() { return $this->rPlayer; } |
|
|
|
|
|
|
92
|
|
|
public function getName() { return $this->name; } |
|
|
|
|
|
|
93
|
|
|
public function getLevelGenerator() { return $this->levelGenerator; } |
|
|
|
|
|
|
94
|
|
|
public function getLevelRefinery() { return $this->levelRefinery; } |
|
|
|
|
|
|
95
|
|
|
public function getLevelDock1() { return $this->levelDock1; } |
|
|
|
|
|
|
96
|
|
|
public function getLevelDock2() { return $this->levelDock2; } |
|
|
|
|
|
|
97
|
|
|
public function getLevelDock3() { return $this->levelDock3; } |
|
|
|
|
|
|
98
|
|
|
public function getLevelTechnosphere() { return $this->levelTechnosphere; } |
|
|
|
|
|
|
99
|
|
|
public function getLevelCommercialPlateforme() { return $this->levelCommercialPlateforme; } |
|
|
|
|
|
|
100
|
|
|
public function getLevelStorage() { return $this->levelStorage; } |
|
|
|
|
|
|
101
|
|
|
public function getLevelRecycling() { return $this->levelRecycling; } |
|
|
|
|
|
|
102
|
|
|
public function getLevelSpatioport() { return $this->levelSpatioport; } |
|
|
|
|
|
|
103
|
|
|
public function getPoints() { return $this->points; } |
|
|
|
|
|
|
104
|
|
|
public function getISchool() { return $this->iSchool; } |
|
|
|
|
|
|
105
|
|
|
public function getIAntiSpy() { return $this->iAntiSpy; } |
|
|
|
|
|
|
106
|
|
|
public function getAntiSpyAverage() { return $this->antiSpyAverage; } |
|
|
|
|
|
|
107
|
|
|
public function getShipStorage($k = -1) {return ($k == -1) ? $this->shipStorage : $this->shipStorage[$k]; } |
|
|
|
|
|
|
108
|
|
|
public function getResourcesStorage() { return $this->resourcesStorage; } |
|
|
|
|
|
|
109
|
|
|
public function getDCreation() { return $this->dCreation; } |
|
|
|
|
|
|
110
|
|
|
|
|
111
|
|
|
public function getPosition() { return $this->position; } |
|
|
|
|
|
|
112
|
|
|
public function getSystem() { return $this->system; } |
|
|
|
|
|
|
113
|
|
|
public function getXSystem() { return $this->xSystem; } |
|
|
|
|
|
|
114
|
|
|
public function getYSystem() { return $this->ySystem; } |
|
|
|
|
|
|
115
|
|
|
public function getSector() { return $this->sector; } |
|
|
|
|
|
|
116
|
|
|
public function getTax() { return $this->tax; } |
|
|
|
|
|
|
117
|
|
|
public function getPlanetPopulation() { return $this->planetPopulation; } |
|
|
|
|
|
|
118
|
|
|
public function getPlanetResources() { return $this->planetResources; } |
|
|
|
|
|
|
119
|
|
|
public function getPlanetHistory() { return $this->planetHistory; } |
|
|
|
|
|
|
120
|
|
|
|
|
121
|
|
|
public function getRemainingTimeGenerator() { return $this->remainingTimeGenerator; } |
|
|
|
|
|
|
122
|
|
|
public function getRemainingTimeDock1() { return $this->remainingTimeDock1; } |
|
|
|
|
|
|
123
|
|
|
public function getRemainingTimeDock2() { return $this->remainingTimeDock2; } |
|
|
|
|
|
|
124
|
|
|
public function getRemainingTimeDock3() { return $this->remainingTimeDock3; } |
|
|
|
|
|
|
125
|
|
|
public function getRoutesNumber() { return $this->routesNumber; } |
|
|
|
|
|
|
126
|
|
|
|
|
127
|
|
|
public function getRealGeneratorLevel() { return $this->realGeneratorLevel; } |
|
|
|
|
|
|
128
|
|
|
public function getRealRefineryLevel() { return $this->realRefineryLevel; } |
|
|
|
|
|
|
129
|
|
|
public function getRealDock1Level() { return $this->realDock1Level; } |
|
|
|
|
|
|
130
|
|
|
public function getRealDock2Level() { return $this->realDock2Level; } |
|
|
|
|
|
|
131
|
|
|
public function getRealDock3Level() { return $this->realDock3Level; } |
|
|
|
|
|
|
132
|
|
|
public function getRealTechnosphereLevel() { return $this->realTechnosphereLevel; } |
|
|
|
|
|
|
133
|
|
|
public function getRealCommercialPlateformeLevel() { return $this->realCommercialPlateformeLevel; } |
|
|
|
|
|
|
134
|
|
|
public function getRealStorageLevel() { return $this->realStorageLevel; } |
|
|
|
|
|
|
135
|
|
|
public function getRealRecyclingLevel() { return $this->realRecyclingLevel; } |
|
|
|
|
|
|
136
|
|
|
public function getRealSpatioportLevel() { return $this->realSpatioportLevel; } |
|
|
|
|
|
|
137
|
|
|
|
|
138
|
|
|
public function getBuildingLevel($buildingNumber) { |
|
139
|
|
|
switch ($buildingNumber) { |
|
140
|
|
|
case 0 : return $this->levelGenerator; |
|
|
|
|
|
|
141
|
|
|
case 1 : return $this->levelRefinery; |
|
|
|
|
|
|
142
|
|
|
case 2 : return $this->levelDock1; |
|
|
|
|
|
|
143
|
|
|
case 3 : return $this->levelDock2; |
|
|
|
|
|
|
144
|
|
|
case 4 : return $this->levelDock3; |
|
|
|
|
|
|
145
|
|
|
case 5 : return $this->levelTechnosphere; |
|
|
|
|
|
|
146
|
|
|
case 6 : return $this->levelCommercialPlateforme; |
|
|
|
|
|
|
147
|
|
|
case 7 : return $this->levelStorage; |
|
|
|
|
|
|
148
|
|
|
case 8 : return $this->levelRecycling; |
|
|
|
|
|
|
149
|
|
|
case 9 : return $this->levelSpatioport; |
|
|
|
|
|
|
150
|
|
|
default : |
|
|
|
|
|
|
151
|
|
|
throw new ErrorException('Bâtiment invalide dans getBuildingLevel de OrbitalBase'); |
|
152
|
|
|
return FALSE; |
|
|
|
|
|
|
153
|
|
|
} |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
//SETTERS |
|
157
|
|
|
public function setId($var) { |
|
158
|
|
|
$this->rPlace = $var; |
|
159
|
|
|
return $this; |
|
160
|
|
|
} |
|
|
|
|
|
|
161
|
|
|
public function setRPlace($var) { |
|
162
|
|
|
$this->rPlace = $var; |
|
163
|
|
|
return $this; |
|
164
|
|
|
} |
|
|
|
|
|
|
165
|
|
|
public function setRPlayer($var) { |
|
166
|
|
|
$this->rPlayer = $var; |
|
167
|
|
|
return $this; |
|
168
|
|
|
} |
|
|
|
|
|
|
169
|
|
|
public function setName($var) { |
|
170
|
|
|
$this->name = $var; |
|
171
|
|
|
return $this; |
|
172
|
|
|
} |
|
|
|
|
|
|
173
|
|
|
public function setLevelGenerator($var) { |
|
174
|
|
|
$this->levelGenerator = $var; |
|
175
|
|
|
return $this; |
|
176
|
|
|
} |
|
|
|
|
|
|
177
|
|
|
public function setLevelRefinery($var) { |
|
178
|
|
|
$this->levelRefinery = $var; |
|
179
|
|
|
return $this; |
|
180
|
|
|
} |
|
|
|
|
|
|
181
|
|
|
public function setLevelDock1($var) { |
|
182
|
|
|
$this->levelDock1 = $var; |
|
183
|
|
|
return $this; |
|
184
|
|
|
} |
|
|
|
|
|
|
185
|
|
|
public function setLevelDock2($var) { |
|
186
|
|
|
$this->levelDock2 = $var; |
|
187
|
|
|
return $this; |
|
188
|
|
|
} |
|
|
|
|
|
|
189
|
|
|
public function setLevelDock3($var) { |
|
190
|
|
|
$this->levelDock3 = $var; |
|
191
|
|
|
return $this; |
|
192
|
|
|
} |
|
|
|
|
|
|
193
|
|
|
public function setLevelTechnosphere($var) { |
|
194
|
|
|
$this->levelTechnosphere = $var; |
|
195
|
|
|
return $this; |
|
196
|
|
|
} |
|
|
|
|
|
|
197
|
|
|
public function setLevelCommercialPlateforme($var) { |
|
198
|
|
|
$this->levelCommercialPlateforme = $var; |
|
199
|
|
|
return $this; |
|
200
|
|
|
} |
|
|
|
|
|
|
201
|
|
|
public function setLevelStorage($var) { |
|
202
|
|
|
$this->levelStorage = $var; |
|
203
|
|
|
return $this; |
|
204
|
|
|
} |
|
|
|
|
|
|
205
|
|
|
public function setLevelRecycling($var) { |
|
206
|
|
|
$this->levelRecycling = $var; |
|
207
|
|
|
return $this; |
|
208
|
|
|
} |
|
|
|
|
|
|
209
|
|
|
public function setLevelSpatioport($var) { |
|
210
|
|
|
$this->levelSpatioport = $var; |
|
211
|
|
|
return $this; |
|
212
|
|
|
} |
|
|
|
|
|
|
213
|
|
|
public function setPoints($var) { |
|
214
|
|
|
$this->points = $var; |
|
215
|
|
|
return $this; |
|
216
|
|
|
} |
|
|
|
|
|
|
217
|
|
|
public function setISchool($var) { |
|
218
|
|
|
$this->iSchool = $var; |
|
219
|
|
|
return $this; |
|
220
|
|
|
} |
|
|
|
|
|
|
221
|
|
|
public function setIAntiSpy($var) { |
|
222
|
|
|
$this->iAntiSpy = $var; |
|
223
|
|
|
return $this; |
|
224
|
|
|
} |
|
|
|
|
|
|
225
|
|
|
public function setAntiSpyAverage($var) { |
|
226
|
|
|
$this->antiSpyAverage = $var; |
|
227
|
|
|
return $this; |
|
228
|
|
|
} |
|
|
|
|
|
|
229
|
|
|
public function setShipStorage($k, $v) { |
|
230
|
|
|
$this->shipStorage[$k] = $v; |
|
231
|
|
|
return $this; |
|
232
|
|
|
} |
|
|
|
|
|
|
233
|
|
|
public function setResourcesStorage($var) { |
|
234
|
|
|
$this->resourcesStorage = $var; |
|
235
|
|
|
return $this; |
|
236
|
|
|
} |
|
|
|
|
|
|
237
|
|
|
public function setDCreation($var) { |
|
238
|
|
|
$this->dCreation = $var; |
|
239
|
|
|
return $this; |
|
240
|
|
|
} |
|
|
|
|
|
|
241
|
|
|
|
|
242
|
|
|
public function setPosition($var) { |
|
243
|
|
|
$this->position = $var; |
|
244
|
|
|
return $this; |
|
245
|
|
|
} |
|
|
|
|
|
|
246
|
|
|
public function setSystem($var) { |
|
247
|
|
|
$this->system = $var; |
|
248
|
|
|
return $this; |
|
249
|
|
|
} |
|
|
|
|
|
|
250
|
|
|
public function setXSystem($var) { |
|
251
|
|
|
$this->xSystem = $var; |
|
252
|
|
|
return $this; |
|
253
|
|
|
} |
|
|
|
|
|
|
254
|
|
|
public function setYSystem($var) { |
|
255
|
|
|
$this->ySystem = $var; |
|
256
|
|
|
return $this; |
|
257
|
|
|
} |
|
|
|
|
|
|
258
|
|
|
public function setSector($var) { |
|
259
|
|
|
$this->sector = $var; |
|
260
|
|
|
return $this; |
|
261
|
|
|
} |
|
|
|
|
|
|
262
|
|
|
public function setTax($var) { |
|
263
|
|
|
$this->tax = $var; |
|
264
|
|
|
return $this; |
|
265
|
|
|
} |
|
|
|
|
|
|
266
|
|
|
public function setPlanetPopulation($var) { |
|
267
|
|
|
$this->planetPopulation = $var; |
|
268
|
|
|
return $this; |
|
269
|
|
|
} |
|
|
|
|
|
|
270
|
|
|
public function setPlanetResources($var) { |
|
271
|
|
|
$this->planetResources = $var; |
|
272
|
|
|
return $this; |
|
273
|
|
|
} |
|
|
|
|
|
|
274
|
|
|
public function setPlanetHistory($var) { |
|
275
|
|
|
$this->planetHistory = $var; |
|
276
|
|
|
return $this; |
|
277
|
|
|
} |
|
|
|
|
|
|
278
|
|
|
|
|
279
|
|
|
public function setRemainingTimeGenerator($var) { |
|
280
|
|
|
$this->remainingTimeGenerator = $var; |
|
281
|
|
|
return $this; |
|
282
|
|
|
} |
|
|
|
|
|
|
283
|
|
|
public function setRemainingTimeDock1($var) { |
|
284
|
|
|
$this->remainingTimeDock1 = $var; |
|
285
|
|
|
return $this; |
|
286
|
|
|
} |
|
|
|
|
|
|
287
|
|
|
public function setRemainingTimeDock2($var) { |
|
288
|
|
|
$this->remainingTimeDock2 = $var; |
|
289
|
|
|
return $this; |
|
290
|
|
|
} |
|
|
|
|
|
|
291
|
|
|
public function setRemainingTimeDock3($var) { |
|
292
|
|
|
$this->remainingTimeDock3 = $var; |
|
293
|
|
|
return $this; |
|
294
|
|
|
} |
|
|
|
|
|
|
295
|
|
|
public function setRoutesNumber($var) { |
|
296
|
|
|
$this->routesNumber = $var; |
|
297
|
|
|
return $this; |
|
298
|
|
|
} |
|
|
|
|
|
|
299
|
|
|
|
|
300
|
|
|
public function setRealGeneratorLevel($var) { |
|
301
|
|
|
$this->realGeneratorLevel = $var; |
|
302
|
|
|
return $this; |
|
303
|
|
|
} |
|
|
|
|
|
|
304
|
|
|
public function setRealRefineryLevel($var) { |
|
305
|
|
|
$this->realRefineryLevel = $var; |
|
306
|
|
|
return $this; |
|
307
|
|
|
} |
|
|
|
|
|
|
308
|
|
|
public function setRealDock1Level($var) { |
|
309
|
|
|
$this->realDock1Level = $var; |
|
310
|
|
|
return $this; |
|
311
|
|
|
} |
|
|
|
|
|
|
312
|
|
|
public function setRealDock2Level($var) { |
|
313
|
|
|
$this->realDock2Level = $var; |
|
314
|
|
|
return $this; |
|
315
|
|
|
} |
|
|
|
|
|
|
316
|
|
|
public function setRealDock3Level($var) { |
|
317
|
|
|
$this->realDock3Level = $var; |
|
318
|
|
|
return $this; |
|
319
|
|
|
} |
|
|
|
|
|
|
320
|
|
|
public function setRealTechnosphereLevel($var) { |
|
321
|
|
|
$this->realTechnosphereLevel = $var; |
|
322
|
|
|
return $this; |
|
323
|
|
|
} |
|
|
|
|
|
|
324
|
|
|
public function setRealCommercialPlateformeLevel($var) { |
|
325
|
|
|
$this->realCommercialPlateformeLevel = $var; |
|
326
|
|
|
return $this; |
|
327
|
|
|
} |
|
|
|
|
|
|
328
|
|
|
public function setRealStorageLevel($var) { |
|
329
|
|
|
$this->realStorageLevel = $var; |
|
330
|
|
|
return $this; |
|
331
|
|
|
} |
|
|
|
|
|
|
332
|
|
|
public function setRealRecyclingLevel($var) { |
|
333
|
|
|
$this->realRecyclingLevel = $var; |
|
334
|
|
|
return $this; |
|
335
|
|
|
} |
|
|
|
|
|
|
336
|
|
|
public function setRealSpatioportLevel($var) { |
|
337
|
|
|
$this->realSpatioportLevel = $var; |
|
338
|
|
|
return $this; |
|
339
|
|
|
} |
|
|
|
|
|
|
340
|
|
|
|
|
341
|
|
|
public function setBuildingLevel($buildingNumber, $level) { |
|
342
|
|
|
switch ($buildingNumber) { |
|
343
|
|
|
case 0 : $this->levelGenerator = $level; break; |
|
|
|
|
|
|
344
|
|
|
case 1 : $this->levelRefinery = $level; break; |
|
|
|
|
|
|
345
|
|
|
case 2 : $this->levelDock1 = $level; break; |
|
|
|
|
|
|
346
|
|
|
case 3 : $this->levelDock2 = $level; break; |
|
|
|
|
|
|
347
|
|
|
case 4 : $this->levelDock3 = $level; break; |
|
|
|
|
|
|
348
|
|
|
case 5 : $this->levelTechnosphere = $level; break; |
|
|
|
|
|
|
349
|
|
|
case 6 : $this->levelCommercialPlateforme = $level; break; |
|
|
|
|
|
|
350
|
|
|
case 7 : $this->levelStorage = $level; break; |
|
|
|
|
|
|
351
|
|
|
case 8 : $this->levelRecycling = $level; break; |
|
|
|
|
|
|
352
|
|
|
case 9 : $this->levelSpatioport = $level; break; |
|
|
|
|
|
|
353
|
|
|
default : |
|
|
|
|
|
|
354
|
|
|
throw new ErrorException('Bâtiment invalide dans setBuildingLevel de OrbitalBase'); |
|
355
|
|
|
} |
|
356
|
|
|
return $this; |
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
/** |
|
360
|
|
|
* @param string $updatedAt |
|
361
|
|
|
* @return OrbitalBase |
|
362
|
|
|
*/ |
|
363
|
|
|
public function setUpdatedAt($updatedAt) |
|
364
|
|
|
{ |
|
365
|
|
|
$this->uOrbitalBase = $updatedAt; |
|
366
|
|
|
|
|
367
|
|
|
return $this; |
|
368
|
|
|
} |
|
369
|
|
|
|
|
370
|
|
|
/** |
|
371
|
|
|
* @return string |
|
372
|
|
|
*/ |
|
373
|
|
|
public function getUpdatedAt() |
|
374
|
|
|
{ |
|
375
|
|
|
return $this->uOrbitalBase; |
|
376
|
|
|
} |
|
377
|
|
|
} |
|
378
|
|
|
|