Skip to content

Commit ee66ee9

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 88171e5 + 4f60adc commit ee66ee9

40 files changed

+1719
-571
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ php:
33
- '7.1'
44
- '7.2'
55

6+
addons:
7+
mariadb: '10.0'
8+
9+
before_install:
10+
- mysql -e 'CREATE DATABASE IF NOT EXISTS ugamela_testing;'
11+
- mysql -u root --default-character-set=utf8 ugamela_testing < ./tests/database.sql
12+
613
script:
714
# - composer self-update
815
- composer install

core/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
$p = Config::$pathConfig['classes'] . strtolower($s[0]) . '.php';
3838
break;
3939
case "Database":
40-
$p = Config::$pathConfig['classes'] . 'db.php';
40+
$p = Config::$pathConfig['classes'] . 'database.php';
4141
break;
4242
case "Debug":
4343
$p = Config::$pathConfig['classes'] . 'debug.php';

core/classes/data/building.php

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -106,64 +106,6 @@ 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-
167109
/**
168110
* Returns the current level
169111
* @return int the current level
@@ -466,6 +408,64 @@ public function setMissileSilo(int $level) : void {
466408
}
467409
}
468410

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: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class D_Defense {
5454
* @param int $dinterplanetary_missile
5555
*/
5656
public function __construct(
57-
int $drocket_launcher, int $dlight_laser, int $dheavy_laser, int $dion_cannon, int $dgauss_cannon,
57+
int $drocket_launcher, int $dlight_laser, int $dheavy_laser, int $dgauss_cannon, int $dion_cannon,
5858
int $dplasma_turret, int $dsmall_shield_dome,
5959
int $dlarge_shield_dome, int $danti_ballistic_missile, int $dinterplanetary_missile
6060
) {
@@ -81,47 +81,6 @@ 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-
12584
/**
12685
* Returns the current amount
12786
* @return int the current amount
@@ -182,42 +141,42 @@ public function setHeavyLaser(int $amount) : void {
182141
}
183142

184143
/**
185-
* Returns the current amount
144+
* Returns the current amount amount
186145
* @return int the current amount
187146
*/
188-
public function getGaussCannon() : int {
147+
public function getIonCannon() : int {
189148

190-
return $this->gauss_cannon;
149+
return $this->ion_cannon;
191150
}
192151

193152
/**
194153
* Sets the current amount
195-
* @param int $gauss_cannon the new amount
154+
* @param int $ion_cannon the new amount
196155
*/
197-
public function setGaussCannon(int $amount) : void {
156+
public function setIonCannon(int $amount) : void {
198157

199158
if ($amount >= 0) {
200-
$this->gauss_cannon = $amount;
159+
$this->ion_cannon = $amount;
201160
}
202161
}
203162

204163
/**
205-
* Returns the current amount amount
164+
* Returns the current amount
206165
* @return int the current amount
207166
*/
208-
public function getIonCannon() : int {
167+
public function getGaussCannon() : int {
209168

210-
return $this->ion_cannon;
169+
return $this->gauss_cannon;
211170
}
212171

213172
/**
214173
* Sets the current amount
215-
* @param int $ion_cannon the new amount
174+
* @param int $gauss_cannon the new amount
216175
*/
217-
public function setIonCannon(int $amount) : void {
176+
public function setGaussCannon(int $amount) : void {
218177

219178
if ($amount >= 0) {
220-
$this->ion_cannon = $amount;
179+
$this->gauss_cannon = $amount;
221180
}
222181
}
223182

@@ -321,6 +280,50 @@ public function setInterplanetaryMissile(int $amount) : void {
321280
}
322281
}
323282

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+
return $this->getRocketLauncher();
293+
break;
294+
case 302:
295+
return $this->getLightLaser();
296+
break;
297+
case 303:
298+
return $this->getHeavyLaser();
299+
break;
300+
case 304:
301+
return $this->getGaussCannon();
302+
break;
303+
case 305:
304+
return $this->getIonCannon();
305+
break;
306+
case 306:
307+
return $this->getPlasmaTurret();
308+
break;
309+
case 307:
310+
return $this->getSmallShieldDome();
311+
break;
312+
case 308:
313+
return $this->getLargeShieldDome();
314+
break;
315+
case 309:
316+
return $this->getAntiBallisticMissile();
317+
break;
318+
case 310:
319+
return $this->getInterplanetaryMissile();
320+
break;
321+
}
322+
323+
return -1;
324+
325+
}
326+
324327
/**
325328
* Sets the level of the defense, given its id and new level
326329
* @param int $id the id of the defense

core/classes/data/fleet.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ public function getFleetByID(int $id) : int {
154154
return $this->getDeathstar();
155155
break;
156156
}
157+
158+
return -1;
157159
}
158160

159161
/**

core/classes/data/tech.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ public function getTechByID(int $id) : int {
146146
return $this->getGravitonTech();
147147
break;
148148
}
149+
150+
return -1;
149151
}
150152

151153
/**

0 commit comments

Comments
 (0)