Skip to content

Commit 106adb0

Browse files
authored
Shipyard (#25)
* finished shipyard-functionality including the build-queue
1 parent aba2ea4 commit 106adb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1270
-777
lines changed

core/classes/data/building.php

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,64 @@ public function print() : void {
106106
echo '</pre>';
107107
}
108108

109+
/**
110+
* Return the level of the building, given its id
111+
* @param int $id the building id
112+
* @return int the level of the building
113+
*/
114+
public function getBuildingByID(int $id) : int {
115+
116+
switch ($id) {
117+
case 1:
118+
return $this->getMetalMine();
119+
break;
120+
case 2:
121+
return $this->getCrystalMine();
122+
break;
123+
case 3:
124+
return $this->getDeuteriumSynthesizer();
125+
break;
126+
case 4:
127+
return $this->getSolarPlant();
128+
break;
129+
case 5:
130+
return $this->getFusionReactor();
131+
break;
132+
case 6:
133+
return $this->getRoboticFactory();
134+
break;
135+
case 7:
136+
return $this->getNaniteFactory();
137+
break;
138+
case 8:
139+
return $this->getShipyard();
140+
break;
141+
case 9:
142+
return $this->getMetalStorage();
143+
break;
144+
case 10:
145+
return $this->getCrystalStorage();
146+
break;
147+
case 11:
148+
return $this->getDeuteriumStorage();
149+
break;
150+
case 12:
151+
return $this->getResearchLab();
152+
break;
153+
case 13:
154+
return $this->getTerraformer();
155+
break;
156+
case 14:
157+
return $this->getAllianceDepot();
158+
break;
159+
case 15:
160+
return $this->getMissileSilo();
161+
break;
162+
}
163+
164+
return -1;
165+
}
166+
109167
/**
110168
* Returns the current level
111169
* @return int the current level
@@ -408,64 +466,6 @@ public function setMissileSilo(int $level) : void {
408466
}
409467
}
410468

411-
/**
412-
* Return the level of the building, given its id
413-
* @param int $id the building id
414-
* @return int the level of the building
415-
*/
416-
public function getBuildingByID(int $id) : int {
417-
418-
switch ($id) {
419-
case 1:
420-
return $this->getMetalMine();
421-
break;
422-
case 2:
423-
return $this->getCrystalMine();
424-
break;
425-
case 3:
426-
return $this->getDeuteriumSynthesizer();
427-
break;
428-
case 4:
429-
return $this->getSolarPlant();
430-
break;
431-
case 5:
432-
return $this->getFusionReactor();
433-
break;
434-
case 6:
435-
return $this->getRoboticFactory();
436-
break;
437-
case 7:
438-
return $this->getNaniteFactory();
439-
break;
440-
case 8:
441-
return $this->getShipyard();
442-
break;
443-
case 9:
444-
return $this->getMetalStorage();
445-
break;
446-
case 10:
447-
return $this->getCrystalStorage();
448-
break;
449-
case 11:
450-
return $this->getDeuteriumStorage();
451-
break;
452-
case 12:
453-
return $this->getResearchLab();
454-
break;
455-
case 13:
456-
return $this->getTerraformer();
457-
break;
458-
case 14:
459-
return $this->getAllianceDepot();
460-
break;
461-
case 15:
462-
return $this->getMissileSilo();
463-
break;
464-
}
465-
466-
return -1;
467-
}
468-
469469
/**
470470
* Sets the level of the building, given its id and new level
471471
* @param int $id the id of the building

core/classes/data/defense.php

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,47 @@ public function print() : void {
8181
echo '</pre>';
8282
}
8383

84+
/**
85+
* Return the level of the defense, given its id
86+
* @param int $id the defense id
87+
* @return int the level of the defense
88+
*/
89+
public function getDefenseByID(int $id) : int {
90+
91+
switch ($id) {
92+
case 301:
93+
$this->getRocketLauncher();
94+
break;
95+
case 302:
96+
$this->getLightLaser();
97+
break;
98+
case 303:
99+
$this->getHeavyLaser();
100+
break;
101+
case 304:
102+
$this->getGaussCannon();
103+
break;
104+
case 305:
105+
$this->getIonCannon();
106+
break;
107+
case 306:
108+
$this->getPlasmaTurret();
109+
break;
110+
case 307:
111+
$this->getSmallShieldDome();
112+
break;
113+
case 308:
114+
$this->getLargeShieldDome();
115+
break;
116+
case 309:
117+
$this->getAntiBallisticMissile();
118+
break;
119+
case 310:
120+
$this->getInterplanetaryMissile();
121+
break;
122+
}
123+
}
124+
84125
/**
85126
* Returns the current amount
86127
* @return int the current amount
@@ -141,42 +182,42 @@ public function setHeavyLaser(int $amount) : void {
141182
}
142183

143184
/**
144-
* Returns the current amount amount
185+
* Returns the current amount
145186
* @return int the current amount
146187
*/
147-
public function getIonCannon() : int {
188+
public function getGaussCannon() : int {
148189

149-
return $this->ion_cannon;
190+
return $this->gauss_cannon;
150191
}
151192

152193
/**
153194
* Sets the current amount
154-
* @param int $ion_cannon the new amount
195+
* @param int $gauss_cannon the new amount
155196
*/
156-
public function setIonCannon(int $amount) : void {
197+
public function setGaussCannon(int $amount) : void {
157198

158199
if ($amount >= 0) {
159-
$this->ion_cannon = $amount;
200+
$this->gauss_cannon = $amount;
160201
}
161202
}
162203

163204
/**
164-
* Returns the current amount
205+
* Returns the current amount amount
165206
* @return int the current amount
166207
*/
167-
public function getGaussCannon() : int {
208+
public function getIonCannon() : int {
168209

169-
return $this->gauss_cannon;
210+
return $this->ion_cannon;
170211
}
171212

172213
/**
173214
* Sets the current amount
174-
* @param int $gauss_cannon the new amount
215+
* @param int $ion_cannon the new amount
175216
*/
176-
public function setGaussCannon(int $amount) : void {
217+
public function setIonCannon(int $amount) : void {
177218

178219
if ($amount >= 0) {
179-
$this->gauss_cannon = $amount;
220+
$this->ion_cannon = $amount;
180221
}
181222
}
182223

@@ -280,47 +321,6 @@ public function setInterplanetaryMissile(int $amount) : void {
280321
}
281322
}
282323

283-
/**
284-
* Return the level of the defense, given its id
285-
* @param int $id the defense id
286-
* @return int the level of the defense
287-
*/
288-
public function getDefenseByID(int $id) : int {
289-
290-
switch ($id) {
291-
case 301:
292-
$this->getRocketLauncher();
293-
break;
294-
case 302:
295-
$this->getLightLaser();
296-
break;
297-
case 303:
298-
$this->getHeavyLaser();
299-
break;
300-
case 304:
301-
$this->getGaussCannon();
302-
break;
303-
case 305:
304-
$this->getIonCannon();
305-
break;
306-
case 306:
307-
$this->getPlasmaTurret();
308-
break;
309-
case 307:
310-
$this->getSmallShieldDome();
311-
break;
312-
case 308:
313-
$this->getLargeShieldDome();
314-
break;
315-
case 309:
316-
$this->getAntiBallisticMissile();
317-
break;
318-
case 310:
319-
$this->getInterplanetaryMissile();
320-
break;
321-
}
322-
}
323-
324324
/**
325325
* Sets the level of the defense, given its id and new level
326326
* @param int $id the id of the defense

0 commit comments

Comments
 (0)