|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* ResearchManager |
|
5
|
|
|
* |
|
6
|
|
|
* @author Jacky Casas |
|
7
|
|
|
* @copyright Expansion - le jeu |
|
8
|
|
|
* |
|
9
|
|
|
* @package Prométhée |
|
10
|
|
|
* @update 20.05.13 |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Asylamba\Modules\Promethee\Manager; |
|
14
|
|
|
|
|
15
|
|
|
use Asylamba\Classes\Worker\Manager; |
|
16
|
|
|
use Asylamba\Classes\Database\Database; |
|
17
|
|
|
use Asylamba\Classes\Library\Utils; |
|
18
|
|
|
use Asylamba\Classes\Container\StackList; |
|
19
|
|
|
|
|
20
|
|
|
use Asylamba\Modules\Promethee\Model\Research; |
|
21
|
|
|
|
|
22
|
|
|
use Asylamba\Modules\Zeus\Manager\PlayerManager; |
|
23
|
|
|
use Asylamba\Modules\Hermes\Manager\NotificationManager; |
|
24
|
|
|
use Asylamba\Modules\Promethee\Helper\ResearchHelper; |
|
25
|
|
|
use Asylamba\Modules\Hermes\Model\Notification; |
|
26
|
|
|
use Asylamba\Modules\Demeter\Resource\ColorResource; |
|
27
|
|
|
|
|
28
|
|
|
use Asylamba\Classes\Exception\ErrorException; |
|
29
|
|
|
|
|
30
|
|
|
class ResearchManager extends Manager { |
|
31
|
|
|
/** @var string **/ |
|
32
|
|
|
protected $managerType = '_Research'; |
|
33
|
|
|
/** @var PlayerManager **/ |
|
34
|
|
|
protected $playerManager; |
|
35
|
|
|
/** @var NotificationManager **/ |
|
36
|
|
|
protected $notificationManager; |
|
37
|
|
|
/** @var ResearchHelper **/ |
|
38
|
|
|
protected $researchHelper; |
|
39
|
|
|
/** @var int **/ |
|
40
|
|
|
protected $researchQuantity; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @param Database $database |
|
44
|
|
|
* @param PlayerManager $playerManager |
|
45
|
|
|
* @param NotificationManager $notificationManager |
|
46
|
|
|
* @param ResearchHelper $researchHelper |
|
47
|
|
|
* @param int $researchQuantity |
|
48
|
|
|
*/ |
|
49
|
|
|
public function __construct( |
|
50
|
|
|
Database $database, |
|
51
|
|
|
PlayerManager $playerManager, |
|
52
|
|
|
NotificationManager $notificationManager, |
|
53
|
|
|
ResearchHelper $researchHelper, |
|
54
|
|
|
$researchQuantity |
|
55
|
|
|
) |
|
56
|
|
|
{ |
|
|
|
|
|
|
57
|
|
|
parent::__construct($database); |
|
58
|
|
|
$this->playerManager = $playerManager; |
|
59
|
|
|
$this->notificationManager = $notificationManager; |
|
60
|
|
|
$this->researchHelper = $researchHelper; |
|
61
|
|
|
$this->researchQuantity = $researchQuantity; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function load($where = array(), $order = array(), $limit = array()) { |
|
65
|
|
|
$formatWhere = Utils::arrayToWhere($where); |
|
66
|
|
|
$formatOrder = Utils::arrayToOrder($order); |
|
67
|
|
|
$formatLimit = Utils::arrayToLimit($limit); |
|
68
|
|
|
|
|
69
|
|
|
$qr = $this->database->prepare('SELECT * |
|
70
|
|
|
FROM research |
|
71
|
|
|
' . $formatWhere . ' |
|
72
|
|
|
' . $formatOrder . ' |
|
73
|
|
|
' . $formatLimit |
|
74
|
|
|
); |
|
75
|
|
|
|
|
76
|
|
|
foreach($where AS $v) { |
|
|
|
|
|
|
77
|
|
|
if (is_array($v)) { |
|
78
|
|
|
foreach ($v as $p) { |
|
79
|
|
|
$valuesArray[] = $p; |
|
|
|
|
|
|
80
|
|
|
} |
|
81
|
|
|
} else { |
|
82
|
|
|
$valuesArray[] = $v; |
|
|
|
|
|
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
if (empty($valuesArray)) { |
|
87
|
|
|
$qr->execute(); |
|
88
|
|
|
} else { |
|
89
|
|
|
$qr->execute($valuesArray); |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
while($aw = $qr->fetch()) { |
|
|
|
|
|
|
93
|
|
|
$res = new Research(); |
|
94
|
|
|
|
|
95
|
|
|
$res->rPlayer = $aw['rPlayer']; |
|
96
|
|
|
$res->mathLevel = $aw['mathLevel']; |
|
97
|
|
|
$res->physLevel = $aw['physLevel']; |
|
98
|
|
|
$res->chemLevel = $aw['chemLevel']; |
|
99
|
|
|
$res->bioLevel = $aw['bioLevel']; |
|
100
|
|
|
$res->mediLevel = $aw['mediLevel']; |
|
101
|
|
|
$res->econoLevel = $aw['econoLevel']; |
|
102
|
|
|
$res->psychoLevel = $aw['psychoLevel']; |
|
103
|
|
|
$res->networkLevel = $aw['networkLevel']; |
|
104
|
|
|
$res->algoLevel = $aw['algoLevel']; |
|
105
|
|
|
$res->statLevel = $aw['statLevel']; |
|
106
|
|
|
$res->naturalTech = $aw['naturalTech']; |
|
107
|
|
|
$res->lifeTech = $aw['lifeTech']; |
|
108
|
|
|
$res->socialTech = $aw['socialTech']; |
|
109
|
|
|
$res->informaticTech = $aw['informaticTech']; |
|
110
|
|
|
$res->naturalToPay = $aw['naturalToPay']; |
|
111
|
|
|
$res->lifeToPay = $aw['lifeToPay']; |
|
112
|
|
|
$res->socialToPay = $aw['socialToPay']; |
|
113
|
|
|
$res->informaticToPay = $aw['informaticToPay']; |
|
114
|
|
|
|
|
115
|
|
|
$this->_Add($res); |
|
116
|
|
|
} |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function add(Research $res) { |
|
120
|
|
|
$qr = $this->database->prepare('INSERT INTO |
|
121
|
|
|
research(rPlayer, mathLevel, physLevel, chemLevel, bioLevel, mediLevel, econoLevel, psychoLevel, networkLevel, algoLevel, statLevel, naturalTech, lifeTech, socialTech, informaticTech, naturalToPay, lifeToPay, socialToPay, informaticToPay) |
|
122
|
|
|
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); |
|
123
|
|
|
$qr->execute(array( |
|
124
|
|
|
$res->rPlayer, |
|
125
|
|
|
$res->mathLevel, |
|
126
|
|
|
$res->physLevel, |
|
127
|
|
|
$res->chemLevel, |
|
128
|
|
|
$res->bioLevel, |
|
129
|
|
|
$res->mediLevel, |
|
130
|
|
|
$res->econoLevel, |
|
131
|
|
|
$res->psychoLevel, |
|
132
|
|
|
$res->networkLevel, |
|
133
|
|
|
$res->algoLevel, |
|
134
|
|
|
$res->statLevel, |
|
135
|
|
|
$res->naturalTech, |
|
136
|
|
|
$res->lifeTech, |
|
137
|
|
|
$res->socialTech, |
|
138
|
|
|
$res->informaticTech, |
|
139
|
|
|
$res->naturalToPay, |
|
140
|
|
|
$res->lifeToPay, |
|
141
|
|
|
$res->socialToPay, |
|
142
|
|
|
$res->informaticToPay |
|
143
|
|
|
)); |
|
144
|
|
|
|
|
145
|
|
|
$this->_Add($res); |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
public function save() { |
|
149
|
|
|
$researches = $this->_Save(); |
|
150
|
|
|
|
|
151
|
|
|
foreach ($researches AS $k => $res) { |
|
|
|
|
|
|
152
|
|
|
$qr = $this->database->prepare('UPDATE research |
|
153
|
|
|
SET rPlayer = ?, |
|
154
|
|
|
mathLevel = ?, |
|
155
|
|
|
physLevel = ?, |
|
156
|
|
|
chemLevel = ?, |
|
157
|
|
|
bioLevel = ?, |
|
158
|
|
|
mediLevel = ?, |
|
159
|
|
|
econoLevel = ?, |
|
160
|
|
|
psychoLevel = ?, |
|
161
|
|
|
networkLevel = ?, |
|
162
|
|
|
algoLevel = ?, |
|
163
|
|
|
statLevel = ?, |
|
164
|
|
|
naturalTech = ?, |
|
165
|
|
|
lifeTech = ?, |
|
166
|
|
|
socialTech = ?, |
|
167
|
|
|
informaticTech = ?, |
|
168
|
|
|
naturalToPay = ?, |
|
169
|
|
|
lifeToPay = ?, |
|
170
|
|
|
socialToPay = ?, |
|
171
|
|
|
informaticToPay = ? |
|
172
|
|
|
WHERE rPlayer = ?'); |
|
173
|
|
|
$qr->execute(array( |
|
174
|
|
|
$res->rPlayer, |
|
175
|
|
|
$res->mathLevel, |
|
176
|
|
|
$res->physLevel, |
|
177
|
|
|
$res->chemLevel, |
|
178
|
|
|
$res->bioLevel, |
|
179
|
|
|
$res->mediLevel, |
|
180
|
|
|
$res->econoLevel, |
|
181
|
|
|
$res->psychoLevel, |
|
182
|
|
|
$res->networkLevel, |
|
183
|
|
|
$res->algoLevel, |
|
184
|
|
|
$res->statLevel, |
|
185
|
|
|
$res->naturalTech, |
|
186
|
|
|
$res->lifeTech, |
|
187
|
|
|
$res->socialTech, |
|
188
|
|
|
$res->informaticTech, |
|
189
|
|
|
$res->naturalToPay, |
|
190
|
|
|
$res->lifeToPay, |
|
191
|
|
|
$res->socialToPay, |
|
192
|
|
|
$res->informaticToPay, |
|
193
|
|
|
$res->rPlayer |
|
194
|
|
|
)); |
|
195
|
|
|
} |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
public function update(Research $research, $playerId, $naturalInvest, $lifeInvest, $socialInvest, $informaticInvest) { |
|
199
|
|
|
# prestige |
|
200
|
|
|
$player = $this->playerManager->get($playerId); |
|
201
|
|
|
$applyPrestige = FALSE; |
|
|
|
|
|
|
202
|
|
|
if ($player->rColor == ColorResource::APHERA) { |
|
203
|
|
|
$applyPrestige = TRUE; |
|
|
|
|
|
|
204
|
|
|
} |
|
205
|
|
|
// natural technologies |
|
206
|
|
|
do { |
|
207
|
|
|
if ($research->naturalToPay > $naturalInvest) { |
|
208
|
|
|
$research->naturalToPay -= $naturalInvest; |
|
209
|
|
|
$naturalInvest = 0; |
|
210
|
|
|
} else { |
|
211
|
|
|
$naturalInvest -= $research->naturalToPay; |
|
212
|
|
|
switch ($research->naturalTech) { |
|
213
|
|
|
case 0 : |
|
|
|
|
|
|
214
|
|
|
$research->mathLevel++; |
|
215
|
|
|
$levelReached = $research->mathLevel; |
|
216
|
|
|
break; |
|
217
|
|
|
case 1 : |
|
|
|
|
|
|
218
|
|
|
$research->physLevel++; |
|
219
|
|
|
$levelReached = $research->physLevel; |
|
220
|
|
|
break; |
|
221
|
|
|
case 2 : |
|
|
|
|
|
|
222
|
|
|
$research->chemLevel++; |
|
223
|
|
|
$levelReached = $research->chemLevel; |
|
224
|
|
|
break; |
|
225
|
|
|
default : |
|
|
|
|
|
|
226
|
|
|
$levelReached = 0; |
|
|
|
|
|
|
227
|
|
|
throw new ErrorException('une erreur est survenue lors de la mise à jour des technologies'); |
|
228
|
|
|
} |
|
229
|
|
|
|
|
230
|
|
|
$n = new Notification(); |
|
231
|
|
|
$n->setRPlayer($playerId); |
|
232
|
|
|
$n->setTitle($this->researchHelper->getInfo($research->naturalTech, 'name') . ' niveau ' . $levelReached); |
|
233
|
|
|
$n->setContent('Vos investissements dans l\'Université ont payé !<br /> |
|
234
|
|
|
Vos chercheurs du département des <strong>Sciences Naturelles</strong> ont fait des avancées en <strong>' |
|
235
|
|
|
. $this->researchHelper->getInfo($research->naturalTech, 'name') . '</strong>. Vous êtes actuellement au <strong>niveau ' |
|
236
|
|
|
. $levelReached . '</strong> dans ce domaine. Félicitations !'); |
|
237
|
|
|
$this->notificationManager->add($n); |
|
238
|
|
|
do { |
|
239
|
|
|
$research->naturalTech = rand(0, 2); // 0, 1 ou 2 |
|
240
|
|
|
$tech1 = $research->mathLevel; |
|
241
|
|
|
$tech2 = $research->physLevel; |
|
242
|
|
|
$tech3 = $research->chemLevel; |
|
243
|
|
|
switch ($research->naturalTech) { |
|
244
|
|
|
case 0 : $tech1++; break; |
|
|
|
|
|
|
245
|
|
|
case 1 : $tech2++; break; |
|
|
|
|
|
|
246
|
|
|
case 2 : $tech3++; break; |
|
|
|
|
|
|
247
|
|
|
default : |
|
|
|
|
|
|
248
|
|
|
throw new ErrorException('une erreur est survenue lors de la mise à jour des technologies'); |
|
249
|
|
|
} |
|
250
|
|
|
} while (!$this->researchHelper->isResearchPermit($tech1, $tech2, $tech3)); |
|
251
|
|
|
$research->naturalToPay = $this->researchHelper->getInfo($research->naturalTech, 'level', $research->getLevel($research->naturalTech) + 1, 'price'); |
|
252
|
|
|
} |
|
253
|
|
|
} while ($naturalInvest > 0); |
|
254
|
|
|
// life technologies (en fait ce sont les sciences politiques) |
|
255
|
|
|
do { |
|
256
|
|
|
if ($research->lifeToPay > $lifeInvest) { |
|
257
|
|
|
$research->lifeToPay -= $lifeInvest; |
|
258
|
|
|
$lifeInvest = 0; |
|
259
|
|
|
} else { |
|
260
|
|
|
$lifeInvest -= $research->lifeToPay; |
|
261
|
|
|
switch ($research->lifeTech) { |
|
262
|
|
|
case 3 : |
|
|
|
|
|
|
263
|
|
|
$research->bioLevel++; |
|
264
|
|
|
$levelReached = $research->bioLevel; |
|
265
|
|
|
break; |
|
266
|
|
|
case 4 : |
|
|
|
|
|
|
267
|
|
|
$research->mediLevel++; |
|
268
|
|
|
$levelReached = $research->mediLevel; |
|
269
|
|
|
break; |
|
270
|
|
|
default : |
|
|
|
|
|
|
271
|
|
|
$levelReached = 0; |
|
|
|
|
|
|
272
|
|
|
throw new ErrorException('une erreur est survenue lors de la mise à jour des technologies'); |
|
273
|
|
|
} |
|
274
|
|
|
|
|
275
|
|
|
$n = new Notification(); |
|
276
|
|
|
$n->setRPlayer($playerId); |
|
277
|
|
|
$n->setTitle($this->researchHelper->getInfo($research->lifeTech, 'name') . ' niveau ' . $levelReached); |
|
278
|
|
|
$n->setContent('Vos investissements dans l\'Université ont payé !<br /> |
|
279
|
|
|
Vos chercheurs du département des <strong>Sciences Politiques</strong> ont fait des avancées en <strong>' |
|
280
|
|
|
. $this->researchHelper->getInfo($research->lifeTech, 'name') . '</strong>. Vous êtes actuellement au <strong>niveau ' |
|
281
|
|
|
. $levelReached . '</strong> dans ce domaine. Félicitations !'); |
|
282
|
|
|
$this->notificationManager->add($n); |
|
283
|
|
|
|
|
284
|
|
|
do { |
|
285
|
|
|
$research->lifeTech = rand(3, 4); |
|
286
|
|
|
$tech1 = $research->bioLevel; |
|
287
|
|
|
$tech2 = $research->mediLevel; |
|
288
|
|
|
switch ($research->lifeTech) { |
|
289
|
|
|
case 3 : $tech1++; break; |
|
|
|
|
|
|
290
|
|
|
case 4 : $tech2++; break; |
|
|
|
|
|
|
291
|
|
|
default : |
|
|
|
|
|
|
292
|
|
|
throw new ErrorException('une erreur est survenue lors de la mise à jour des technologies'); |
|
293
|
|
|
} |
|
294
|
|
|
} while (!$this->researchHelper->isResearchPermit($tech1, $tech2)); |
|
295
|
|
|
$research->lifeToPay = $this->researchHelper->getInfo($research->lifeTech, 'level', $research->getLevel($research->lifeTech) + 1, 'price'); |
|
296
|
|
|
} |
|
297
|
|
|
} while ($lifeInvest > 0); |
|
298
|
|
|
// social technologies |
|
299
|
|
|
do { |
|
300
|
|
|
if ($research->socialToPay > $socialInvest) { |
|
301
|
|
|
$research->socialToPay -= $socialInvest; |
|
302
|
|
|
$socialInvest = 0; |
|
303
|
|
|
} else { |
|
304
|
|
|
$socialInvest -= $research->socialToPay; |
|
305
|
|
|
switch ($research->socialTech) { |
|
306
|
|
|
case 5 : |
|
|
|
|
|
|
307
|
|
|
$research->econoLevel++; |
|
308
|
|
|
$levelReached = $research->econoLevel; |
|
309
|
|
|
break; |
|
310
|
|
|
case 6 : |
|
|
|
|
|
|
311
|
|
|
$research->psychoLevel++; |
|
312
|
|
|
$levelReached = $research->psychoLevel; |
|
313
|
|
|
break; |
|
314
|
|
|
default : |
|
|
|
|
|
|
315
|
|
|
$levelReached = 0; |
|
|
|
|
|
|
316
|
|
|
throw new ErrorException('une erreur est survenue lors de la mise à jour des technologies'); |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
|
|
$n = new Notification(); |
|
320
|
|
|
$n->setRPlayer($playerId); |
|
321
|
|
|
$n->setTitle($this->researchHelper->getInfo($research->socialTech, 'name') . ' niveau ' . $levelReached); |
|
322
|
|
|
$n->setContent('Vos investissements dans l\'Université ont payé !<br /> |
|
323
|
|
|
Vos chercheurs du département des <strong>Sciences Economiques et Sociales</strong> ont fait des avancées en <strong>' |
|
324
|
|
|
. $this->researchHelper->getInfo($research->socialTech, 'name') . '</strong>. Vous êtes actuellement au <strong>niveau ' |
|
325
|
|
|
. $levelReached . '</strong> dans ce domaine. Félicitations !'); |
|
326
|
|
|
$this->notificationManager->add($n); |
|
327
|
|
|
do { |
|
328
|
|
|
$research->socialTech = rand(5, 6); |
|
329
|
|
|
$tech1 = $research->econoLevel; |
|
330
|
|
|
$tech2 = $research->psychoLevel; |
|
331
|
|
|
switch ($research->socialTech) { |
|
332
|
|
|
case 5 : $tech1++; break; |
|
|
|
|
|
|
333
|
|
|
case 6 : $tech2++; break; |
|
|
|
|
|
|
334
|
|
|
default : |
|
|
|
|
|
|
335
|
|
|
throw new ErrorException('une erreur est survenue lors de la mise à jour des technologies'); |
|
336
|
|
|
} |
|
337
|
|
|
} while (!$this->researchHelper->isResearchPermit($tech1, $tech2)); |
|
338
|
|
|
$research->socialToPay = $this->researchHelper->getInfo($research->socialTech, 'level', $research->getLevel($research->socialTech) + 1, 'price'); |
|
339
|
|
|
} |
|
340
|
|
|
} while ($socialInvest > 0); |
|
341
|
|
|
// informatic technologies |
|
342
|
|
|
do { |
|
343
|
|
|
if ($research->informaticToPay > $informaticInvest) { |
|
344
|
|
|
$research->informaticToPay -= $informaticInvest; |
|
345
|
|
|
$informaticInvest = 0; |
|
346
|
|
|
} else { |
|
347
|
|
|
$informaticInvest -= $research->informaticToPay; |
|
348
|
|
|
switch ($research->informaticTech) { |
|
349
|
|
|
case 7 : |
|
|
|
|
|
|
350
|
|
|
$research->networkLevel++; |
|
351
|
|
|
$levelReached = $research->networkLevel; |
|
352
|
|
|
break; |
|
353
|
|
|
case 8 : |
|
|
|
|
|
|
354
|
|
|
$research->algoLevel++; |
|
355
|
|
|
$levelReached = $research->algoLevel; |
|
356
|
|
|
break; |
|
357
|
|
|
case 9 : |
|
|
|
|
|
|
358
|
|
|
$research->statLevel++; |
|
359
|
|
|
$levelReached = $research->statLevel; |
|
360
|
|
|
break; |
|
361
|
|
|
default : |
|
|
|
|
|
|
362
|
|
|
$levelReached = 0; |
|
|
|
|
|
|
363
|
|
|
throw new ErrorException('une erreur est survenue lors de la mise à jour des technologies'); |
|
364
|
|
|
} |
|
365
|
|
|
|
|
366
|
|
|
$n = new Notification(); |
|
367
|
|
|
$n->setRPlayer($playerId); |
|
368
|
|
|
$n->setTitle($this->researchHelper->getInfo($research->informaticTech, 'name') . ' niveau ' . $levelReached); |
|
369
|
|
|
$n->setContent('Vos investissements dans l\'Université ont payé !<br /> |
|
370
|
|
|
Vos chercheurs du département de l\'<strong>Ingénierie Informatique</strong> ont fait des avancées en <strong>' |
|
371
|
|
|
. $this->researchHelper->getInfo($research->informaticTech, 'name') . '</strong>. Vous êtes actuellement au <strong>niveau ' |
|
372
|
|
|
. $levelReached . '</strong> dans ce domaine. Félicitations !'); |
|
373
|
|
|
$this->notificationManager->add($n); |
|
374
|
|
|
|
|
375
|
|
|
do { |
|
376
|
|
|
$research->informaticTech = rand(7, 9); |
|
377
|
|
|
$tech1 = $research->networkLevel; |
|
378
|
|
|
$tech2 = $research->algoLevel; |
|
379
|
|
|
$tech3 = $research->statLevel; |
|
380
|
|
|
switch ($research->informaticTech) { |
|
381
|
|
|
case 7 : $tech1++; break; |
|
|
|
|
|
|
382
|
|
|
case 8 : $tech2++; break; |
|
|
|
|
|
|
383
|
|
|
case 9 : $tech3++; break; |
|
|
|
|
|
|
384
|
|
|
default : |
|
|
|
|
|
|
385
|
|
|
throw new ErrorException('une erreur est survenue lors de la mise à jour des technologies'); |
|
386
|
|
|
} |
|
387
|
|
|
} while (!$this->researchHelper->isResearchPermit($tech1, $tech2, $tech3)); |
|
388
|
|
|
$research->informaticToPay = $this->researchHelper->getInfo($research->informaticTech, 'level', $research->getLevel($research->informaticTech) + 1, 'price'); |
|
389
|
|
|
} |
|
390
|
|
|
} while ($informaticInvest > 0); |
|
391
|
|
|
} |
|
392
|
|
|
|
|
393
|
|
|
public function getResearchList(Research $research) { |
|
394
|
|
|
// return a stacklist of the researches |
|
395
|
|
|
$r = new StackList(); |
|
396
|
|
|
for ($i = 0; $i < $this->researchQuantity; $i++) { |
|
397
|
|
|
$r->append($research->getLevel($i)); |
|
398
|
|
|
} |
|
399
|
|
|
return $r; |
|
400
|
|
|
} |
|
401
|
|
|
|
|
402
|
|
|
/* This will no longer work |
|
403
|
|
|
public static function deleteByRPlayer($rPlayer) { |
|
404
|
|
|
try { |
|
405
|
|
|
$db = Database::getInstance(); |
|
406
|
|
|
$qr = $db->prepare('DELETE FROM research WHERE rPlayer = ?'); |
|
407
|
|
|
$qr->execute(array($rPlayer)); |
|
408
|
|
|
return TRUE; |
|
409
|
|
|
} catch(Exception $e) { |
|
410
|
|
|
$_SESSION[SERVERSESS]['alert'][] = array($e->getMessage(), $e->getCode()); |
|
411
|
|
|
} |
|
412
|
|
|
}*/ |
|
413
|
|
|
} |