1 | <?php |
---|
2 | require_once("class.killlist.php"); |
---|
3 | require_once("class.corp.php"); |
---|
4 | require_once("class.alliance.php"); |
---|
5 | require_once("class.system.php"); |
---|
6 | require_once("class.ship.php"); |
---|
7 | |
---|
8 | class TopList |
---|
9 | { |
---|
10 | function TopList() |
---|
11 | { |
---|
12 | $this->qry_ = new DBQuery(); |
---|
13 | $this->exclude_scl_ = array(); |
---|
14 | $this->vic_scl_id_ = array(); |
---|
15 | $this->regions_ = array(); |
---|
16 | $this->systems_ = array(); |
---|
17 | } |
---|
18 | |
---|
19 | function setPodsNoobShips($flag) |
---|
20 | { |
---|
21 | if (!$flag) |
---|
22 | { |
---|
23 | array_push($this->exclude_scl_, 2); |
---|
24 | array_push($this->exclude_scl_, 3); |
---|
25 | array_push($this->exclude_scl_, 11); |
---|
26 | } |
---|
27 | else |
---|
28 | { |
---|
29 | $this->exclude_scl_ = array(); |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | function setSQLTop($sql) |
---|
34 | { |
---|
35 | $this->sqltop_ = $sql; |
---|
36 | } |
---|
37 | |
---|
38 | function setSQLBottom($sql) |
---|
39 | { |
---|
40 | $this->sqlbottom_ = $sql; |
---|
41 | } |
---|
42 | |
---|
43 | function addInvolvedPilot($pilot) |
---|
44 | { |
---|
45 | $this->inv_plt_ .= $pilot->getID().", "; |
---|
46 | if ($this->inv_crp_ || $this->inv_all_) |
---|
47 | $this->mixedinvolved_ = true; |
---|
48 | } |
---|
49 | |
---|
50 | function addInvolvedCorp($corp) |
---|
51 | { |
---|
52 | $this->inv_crp_ .= $corp->getID().", "; |
---|
53 | if ($this->inv_plt_ || $this->inv_all_) |
---|
54 | $this->mixedinvolved_ = true; |
---|
55 | } |
---|
56 | |
---|
57 | function addInvolvedAlliance($alliance) |
---|
58 | { |
---|
59 | $this->inv_all_ .= $alliance->getID().", "; |
---|
60 | if ($this->inv_plt_ || $this->inv_crp_) |
---|
61 | $this->mixedinvolved_ = true; |
---|
62 | } |
---|
63 | |
---|
64 | function addVictimPilot($pilot) |
---|
65 | { |
---|
66 | $this->vic_plt_ .= $pilot->getID().", "; |
---|
67 | if ($this->vic_crp_ || $this->vic_all_) |
---|
68 | $this->mixedvictims_ = true; |
---|
69 | } |
---|
70 | |
---|
71 | function addVictimCorp($corp) |
---|
72 | { |
---|
73 | $this->vic_crp_ .= $corp->getID().", "; |
---|
74 | if ($this->vic_plt_ || $this->vic_all_) |
---|
75 | $this->mixedvictims_ = true; |
---|
76 | } |
---|
77 | |
---|
78 | function addVictimAlliance($alliance) |
---|
79 | { |
---|
80 | $this->vic_all_ .= $alliance->getID().", "; |
---|
81 | if ($this->vic_plt_ || $this->vic_crp_) |
---|
82 | $this->mixedvictims_ = true; |
---|
83 | } |
---|
84 | |
---|
85 | function addVictimShipClass($shipclass) |
---|
86 | { |
---|
87 | array_push($this->vic_scl_id_, $shipclass->getID()); |
---|
88 | } |
---|
89 | |
---|
90 | function addVictimShip($ship) |
---|
91 | { |
---|
92 | } |
---|
93 | |
---|
94 | function addItemDestroyed($item) |
---|
95 | { |
---|
96 | } |
---|
97 | |
---|
98 | function addRegion($region) |
---|
99 | { |
---|
100 | array_push($this->regions_, $region->getID()); |
---|
101 | } |
---|
102 | |
---|
103 | function addSystem($system) |
---|
104 | { |
---|
105 | array_push($this->systems_, $system->getID()); |
---|
106 | } |
---|
107 | |
---|
108 | function addGroupBy($groupby) |
---|
109 | { |
---|
110 | array_push($this->groupby_, $groupby); |
---|
111 | } |
---|
112 | |
---|
113 | function setPageSplitter($pagesplitter) |
---|
114 | { |
---|
115 | if (isset($_GET['page'])) $page = $_GET['page']; |
---|
116 | else $page = 1; |
---|
117 | $this->plimit_ = $pagesplitter->getSplit(); |
---|
118 | $this->poffset_ = ($page * $this->plimit_) - $this->plimit_; |
---|
119 | // echo $this->offset_; |
---|
120 | // echo $this->limit_; |
---|
121 | } |
---|
122 | |
---|
123 | function setWeek($weekno) |
---|
124 | { |
---|
125 | $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) = "; |
---|
126 | $this->timeframe_ .= $weekno; |
---|
127 | } |
---|
128 | |
---|
129 | function setMonth($monthno) |
---|
130 | { |
---|
131 | $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%c\" ) = "; |
---|
132 | $this->timeframe_ .= $monthno; |
---|
133 | } |
---|
134 | |
---|
135 | function setYear($yearno) |
---|
136 | { |
---|
137 | $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%Y\" ) = "; |
---|
138 | $this->timeframe_ .= $yearno; |
---|
139 | } |
---|
140 | |
---|
141 | function setStartWeek($weekno) |
---|
142 | { |
---|
143 | $this->timeframe_ .= " and date_format( kll.kll_timestamp, \"%u\" ) >= "; |
---|
144 | $this->timeframe_ .= $weekno; |
---|
145 | } |
---|
146 | |
---|
147 | function setStartDate($timestamp) |
---|
148 | { |
---|
149 | $this->timeframe_ .= " and kll.kll_timestamp >= '".$timestamp."'"; |
---|
150 | } |
---|
151 | |
---|
152 | function setEndDate($timestamp) |
---|
153 | { |
---|
154 | $this->timeframe_ .= " and kll.kll_timestamp <= '".$timestamp."'"; |
---|
155 | } |
---|
156 | |
---|
157 | function setGroupBy($groupby) |
---|
158 | { |
---|
159 | $this->groupby_ = $groupby; |
---|
160 | } |
---|
161 | |
---|
162 | function execQuery() |
---|
163 | { |
---|
164 | $this->sql_ .= $this->sqltop_; |
---|
165 | // involved |
---|
166 | if ($this->inv_plt_) |
---|
167 | $this->sql_ .= " inner join kb3_inv_plt inp |
---|
168 | on ( inp.inp_plt_id in ( ".substr($this->inv_plt_, 0, strlen($this->inv_plt_) - 2)." ) and kll.kll_id = inp.inp_kll_id ) "; |
---|
169 | if ($this->inv_crp_) |
---|
170 | $this->sql_ .= " inner join kb3_inv_crp inc |
---|
171 | on ( inc.inc_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." ) and kll.kll_id = inc.inc_kll_id ) "; |
---|
172 | |
---|
173 | if ($this->inv_all_) |
---|
174 | $this->sql_ .= " inner join kb3_inv_all ina |
---|
175 | on ( ina.ina_all_id in ( ".substr($this->inv_all_, 0, strlen($this->inv_all_) - 2)." ) and kll.kll_id = ina.ina_kll_id ) "; |
---|
176 | |
---|
177 | if (count($this->exclude_scl_)) |
---|
178 | { |
---|
179 | $this->sql_ .= " inner join kb3_ships shp |
---|
180 | on ( shp.shp_id = kll.kll_ship_id ) |
---|
181 | inner join kb3_ship_classes scl |
---|
182 | on ( scl.scl_id = shp.shp_class )"; |
---|
183 | $this->sql_ .= " and scl.scl_id not in ( ".implode(",", $this->exclude_scl_)." )"; |
---|
184 | } |
---|
185 | |
---|
186 | if (count($this->vic_scl_id_)) |
---|
187 | { |
---|
188 | $this->sql_ .= " inner join kb3_ships shp |
---|
189 | on ( shp.shp_id = kll.kll_ship_id ) |
---|
190 | inner join kb3_ship_classes scl |
---|
191 | on ( scl.scl_id = shp.shp_class )"; |
---|
192 | $this->sql_ .= " and scl.scl_id in ( ".implode(",", $this->vic_scl_id_)." )"; |
---|
193 | } |
---|
194 | |
---|
195 | if (count($this->regions_)) |
---|
196 | { |
---|
197 | $this->sql_ .= " inner join kb3_systems sys |
---|
198 | on ( sys.sys_id = kll.kll_system_id ) |
---|
199 | inner join kb3_constellations con |
---|
200 | on ( con.con_id = sys.sys_con_id ) |
---|
201 | inner join kb3_regions reg |
---|
202 | on ( reg.reg_id = con.con_reg_id |
---|
203 | and reg.reg_id in ( ".implode($this->regions_, ",")." ) )"; |
---|
204 | } |
---|
205 | if (count($this->systems_)) |
---|
206 | { |
---|
207 | $this->sql_ .= " and kll.kll_system_id in ( ".implode($this->systems_, ",").")"; |
---|
208 | } |
---|
209 | // victim filter |
---|
210 | if ($this->mixedvictims_) |
---|
211 | { |
---|
212 | $this->sql_ .= " and ( 1 = 0 "; |
---|
213 | $op = "or"; |
---|
214 | } |
---|
215 | else |
---|
216 | { |
---|
217 | $this->sql_ .= ' where 1=1 '; |
---|
218 | $op = "and"; |
---|
219 | } |
---|
220 | |
---|
221 | if ($this->vic_plt_) |
---|
222 | $this->sql_ .= " ".$op." kll.kll_victim_id in ( ".substr($this->vic_plt_, 0, strlen($this->vic_plt_) - 2)." )"; |
---|
223 | if ($this->vic_crp_) |
---|
224 | $this->sql_ .= " ".$op." kll.kll_crp_id in ( ".substr($this->vic_crp_, 0, strlen($this->vic_crp_) - 2)." )"; |
---|
225 | if ($this->vic_all_) |
---|
226 | $this->sql_ .= " ".$op." kll.kll_all_id in ( ".substr($this->vic_all_, 0, strlen($this->vic_all_) - 2)." )"; |
---|
227 | |
---|
228 | if ($this->mixedvictims_) |
---|
229 | $this->sql_ .= " ) "; |
---|
230 | |
---|
231 | if ($this->timeframe_) $this->sql_ .= $this->timeframe_; |
---|
232 | |
---|
233 | $this->sql_ .= " ".$this->sqlbottom_; |
---|
234 | // echo $this->sql_."<br/><br/>"; |
---|
235 | $this->qry_->execute($this->sql_); |
---|
236 | } |
---|
237 | |
---|
238 | function getRow() |
---|
239 | { |
---|
240 | if (!$this->qry_->executed()) |
---|
241 | $this->execQuery(); |
---|
242 | |
---|
243 | $row = $this->qry_->getRow(); |
---|
244 | return $row; |
---|
245 | } |
---|
246 | |
---|
247 | function getTimeFrameSQL() |
---|
248 | { |
---|
249 | return $this->timeframe_; |
---|
250 | } |
---|
251 | } |
---|
252 | |
---|
253 | class TopKillsList extends TopList |
---|
254 | { |
---|
255 | function TopKillsList() |
---|
256 | { |
---|
257 | $this->TopList(); |
---|
258 | } |
---|
259 | |
---|
260 | function generate() |
---|
261 | { |
---|
262 | $sql = "select count(*) as cnt, ind.ind_plt_id as plt_id |
---|
263 | from kb3_kills kll |
---|
264 | inner join kb3_inv_detail ind |
---|
265 | on ( ind.ind_kll_id = kll.kll_id ) |
---|
266 | inner join kb3_pilots plt |
---|
267 | on ( plt.plt_id = ind.ind_plt_id "; |
---|
268 | if ($this->inv_crp_) |
---|
269 | $sql .= " and plt.plt_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." )"; |
---|
270 | $sql .= ")"; |
---|
271 | |
---|
272 | if ($this->inv_all_) |
---|
273 | { |
---|
274 | $sql .= ' inner join kb3_corps crp on ( crp.crp_id = ind.ind_crp_id '; |
---|
275 | $sql .= " and crp.crp_all_id in ( ".substr($this->inv_all_, 0, strlen($this->inv_all_) - 2)." )"; |
---|
276 | $sql .= ')'; |
---|
277 | } |
---|
278 | |
---|
279 | $this->setSQLTop($sql); |
---|
280 | |
---|
281 | $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc |
---|
282 | limit 30"); |
---|
283 | if (count($this->vic_scl_id)) |
---|
284 | { |
---|
285 | $this->setPodsNoobShips(false); |
---|
286 | } |
---|
287 | else |
---|
288 | { |
---|
289 | $this->setPodsNoobShips(true); |
---|
290 | } |
---|
291 | } |
---|
292 | } |
---|
293 | |
---|
294 | class TopCorpKillsList extends TopList |
---|
295 | { |
---|
296 | function TopKillsList() |
---|
297 | { |
---|
298 | $this->TopList(); |
---|
299 | } |
---|
300 | |
---|
301 | function generate() |
---|
302 | { |
---|
303 | $sql = "select count(distinct(kll.kll_id)) as cnt, ind.ind_crp_id as crp_id |
---|
304 | from kb3_kills kll |
---|
305 | inner join kb3_inv_detail ind |
---|
306 | on ( ind.ind_kll_id = kll.kll_id ) |
---|
307 | inner join kb3_corps crp |
---|
308 | on ( crp.crp_id = ind.ind_crp_id "; |
---|
309 | if ($this->inv_all_) |
---|
310 | $sql .= " and crp.crp_all_id in ( ".substr($this->inv_all_, 0, strlen($this->inv_all_) - 2)." )"; |
---|
311 | |
---|
312 | $sql .= ")"; |
---|
313 | |
---|
314 | $this->setSQLTop($sql); |
---|
315 | |
---|
316 | $this->setSQLBottom("group by ind.ind_crp_id order by 1 desc |
---|
317 | limit 30"); |
---|
318 | if (count($this->vic_scl_id)) |
---|
319 | { |
---|
320 | $this->setPodsNoobShips(false); |
---|
321 | } |
---|
322 | else |
---|
323 | { |
---|
324 | $this->setPodsNoobShips(true); |
---|
325 | } |
---|
326 | } |
---|
327 | } |
---|
328 | |
---|
329 | class TopScoreList extends TopList |
---|
330 | { |
---|
331 | function TopScoreList() |
---|
332 | { |
---|
333 | $this->TopList(); |
---|
334 | } |
---|
335 | |
---|
336 | function generate() |
---|
337 | { |
---|
338 | $sql = "select sum(kll.kll_points) as cnt, ind.ind_plt_id as plt_id |
---|
339 | from kb3_kills kll |
---|
340 | inner join kb3_inv_detail ind |
---|
341 | on ( ind.ind_kll_id = kll.kll_id ) |
---|
342 | inner join kb3_pilots plt |
---|
343 | on ( plt.plt_id = ind.ind_plt_id "; |
---|
344 | if ($this->inv_crp_) |
---|
345 | $sql .= " and plt.plt_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." )"; |
---|
346 | |
---|
347 | $sql .= ")"; |
---|
348 | |
---|
349 | if ($this->inv_all_) |
---|
350 | { |
---|
351 | $sql .= ' inner join kb3_corps crp on ( crp.crp_id = ind.ind_crp_id '; |
---|
352 | $sql .= " and crp.crp_all_id in ( ".substr($this->inv_all_, 0, strlen($this->inv_all_) - 2)." )"; |
---|
353 | $sql .= ')'; |
---|
354 | } |
---|
355 | |
---|
356 | $this->setSQLTop($sql); |
---|
357 | |
---|
358 | $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc |
---|
359 | limit 30"); |
---|
360 | // $this->setPodsNoobShips(false); |
---|
361 | } |
---|
362 | } |
---|
363 | |
---|
364 | class TopLossesList extends TopList |
---|
365 | { |
---|
366 | function TopScoreList() |
---|
367 | { |
---|
368 | $this->TopList(); |
---|
369 | } |
---|
370 | |
---|
371 | function generate() |
---|
372 | { |
---|
373 | $this->setSQLTop("select count(*) as cnt, kll.kll_victim_id as plt_id |
---|
374 | from kb3_kills kll"); |
---|
375 | $this->setSQLBottom("group by kll.kll_victim_id order by 1 desc |
---|
376 | limit 30"); |
---|
377 | if (!count($this->vic_scl_id_)) |
---|
378 | { |
---|
379 | $this->setPodsNoobShips(false); |
---|
380 | } |
---|
381 | } |
---|
382 | } |
---|
383 | |
---|
384 | class TopCorpLossesList extends TopList |
---|
385 | { |
---|
386 | function TopScoreList() |
---|
387 | { |
---|
388 | $this->TopList(); |
---|
389 | } |
---|
390 | |
---|
391 | function generate() |
---|
392 | { |
---|
393 | $this->setSQLTop("select count(*) as cnt, kll.kll_crp_id as crp_id |
---|
394 | from kb3_kills kll"); |
---|
395 | $this->setSQLBottom("group by kll.kll_crp_id order by 1 desc |
---|
396 | limit 30"); |
---|
397 | if (count($this->vic_scl_id)) |
---|
398 | { |
---|
399 | $this->setPodsNoobShips(false); |
---|
400 | } |
---|
401 | else |
---|
402 | { |
---|
403 | $this->setPodsNoobShips(true); |
---|
404 | } |
---|
405 | } |
---|
406 | } |
---|
407 | |
---|
408 | class TopFinalBlowList extends TopList |
---|
409 | { |
---|
410 | function TopFinalBlowList() |
---|
411 | { |
---|
412 | $this->TopList(); |
---|
413 | } |
---|
414 | |
---|
415 | function generate() |
---|
416 | { |
---|
417 | $sql = "select count(kll.kll_id) as cnt, kll.kll_fb_plt_id as plt_id |
---|
418 | from kb3_kills kll |
---|
419 | inner join kb3_pilots plt |
---|
420 | on ( plt.plt_id = kll.kll_fb_plt_id "; |
---|
421 | if ($this->inv_crp_) |
---|
422 | $sql .= " and plt.plt_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." )"; |
---|
423 | |
---|
424 | $sql .= ")"; |
---|
425 | |
---|
426 | $this->setSQLTop($sql); |
---|
427 | |
---|
428 | $this->setSQLBottom("group by kll.kll_fb_plt_id order by 1 desc |
---|
429 | limit 30"); |
---|
430 | $this->setPodsNoobShips(false); |
---|
431 | } |
---|
432 | } |
---|
433 | |
---|
434 | class TopDamageDealerList extends TopList |
---|
435 | { |
---|
436 | function TopDamageDealerList() |
---|
437 | { |
---|
438 | $this->TopList(); |
---|
439 | } |
---|
440 | |
---|
441 | function generate() |
---|
442 | { |
---|
443 | $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id |
---|
444 | from kb3_kills kll |
---|
445 | inner join kb3_inv_detail ind |
---|
446 | on ( ind.ind_kll_id = kll.kll_id and ind.ind_order = 0) |
---|
447 | inner join kb3_pilots plt |
---|
448 | on ( plt.plt_id = ind.ind_plt_id "; |
---|
449 | if ($this->inv_crp_) |
---|
450 | $sql .= " and plt.plt_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." )"; |
---|
451 | |
---|
452 | $sql .= ")"; |
---|
453 | |
---|
454 | $this->setSQLTop($sql); |
---|
455 | |
---|
456 | $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc |
---|
457 | limit 30"); |
---|
458 | $this->setPodsNoobShips(false); |
---|
459 | } |
---|
460 | } |
---|
461 | |
---|
462 | class TopSoloKillerList extends TopList |
---|
463 | { |
---|
464 | function TopSoloKillerList() |
---|
465 | { |
---|
466 | $this->TopList(); |
---|
467 | } |
---|
468 | |
---|
469 | function generate() |
---|
470 | { |
---|
471 | $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id |
---|
472 | from kb3_kills kll |
---|
473 | inner join kb3_inv_detail ind |
---|
474 | on ( ind.ind_kll_id = kll.kll_id and ind.ind_order = 0) |
---|
475 | inner join kb3_inv_detail ind2 |
---|
476 | on ( ind2.ind_kll_id = ind.ind_kll_id |
---|
477 | and not (ind2.ind_order > 0 ) ) |
---|
478 | inner join kb3_pilots plt |
---|
479 | on ( plt.plt_id = ind.ind_plt_id |
---|
480 | and kll.kll_fb_plt_id = plt.plt_id"; |
---|
481 | if ($this->inv_crp_) |
---|
482 | $sql .= " and plt.plt_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." )"; |
---|
483 | |
---|
484 | $sql .= ")"; |
---|
485 | |
---|
486 | $this->setSQLTop($sql); |
---|
487 | |
---|
488 | $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc |
---|
489 | limit 30"); |
---|
490 | $this->setPodsNoobShips(false); |
---|
491 | } |
---|
492 | } |
---|
493 | |
---|
494 | class TopPodKillerList extends TopList |
---|
495 | { |
---|
496 | function TopPodKillerList() |
---|
497 | { |
---|
498 | $this->TopList(); |
---|
499 | } |
---|
500 | |
---|
501 | function generate() |
---|
502 | { |
---|
503 | $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id |
---|
504 | from kb3_kills kll |
---|
505 | inner join kb3_inv_detail ind |
---|
506 | on ( ind.ind_kll_id = kll.kll_id ) |
---|
507 | inner join kb3_pilots plt |
---|
508 | on ( plt.plt_id = ind.ind_plt_id"; |
---|
509 | if ($this->inv_crp_) |
---|
510 | $sql .= " and plt.plt_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." )"; |
---|
511 | |
---|
512 | $sql .= ")"; |
---|
513 | |
---|
514 | $this->setSQLTop($sql); |
---|
515 | |
---|
516 | $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc |
---|
517 | limit 30"); |
---|
518 | $this->addVictimShipClass(new ShipClass(2)); // capsule |
---|
519 | } |
---|
520 | } |
---|
521 | |
---|
522 | class TopGrieferList extends TopList |
---|
523 | { |
---|
524 | function TopGrieferList() |
---|
525 | { |
---|
526 | $this->TopList(); |
---|
527 | } |
---|
528 | |
---|
529 | function generate() |
---|
530 | { |
---|
531 | $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id |
---|
532 | from kb3_kills kll |
---|
533 | inner join kb3_inv_detail ind |
---|
534 | on ( ind.ind_kll_id = kll.kll_id ) |
---|
535 | inner join kb3_pilots plt |
---|
536 | on ( plt.plt_id = ind.ind_plt_id"; |
---|
537 | if ($this->inv_crp_) |
---|
538 | $sql .= " and plt.plt_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." )"; |
---|
539 | |
---|
540 | $sql .= ")"; |
---|
541 | |
---|
542 | $this->setSQLTop($sql); |
---|
543 | |
---|
544 | $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc |
---|
545 | limit 30"); |
---|
546 | $this->addVictimShipClass(new ShipClass(20)); // freighter |
---|
547 | $this->addVictimShipClass(new ShipClass(22)); // exhumer |
---|
548 | $this->addVictimShipClass(new ShipClass(7)); // industrial |
---|
549 | $this->addVictimShipClass(new ShipClass(12)); // barge |
---|
550 | $this->addVictimShipClass(new ShipClass(14)); // transport |
---|
551 | } |
---|
552 | } |
---|
553 | |
---|
554 | class TopCapitalShipKillerList extends TopList |
---|
555 | { |
---|
556 | function TopCapitalShipKillerList() |
---|
557 | { |
---|
558 | $this->TopList(); |
---|
559 | } |
---|
560 | |
---|
561 | function generate() |
---|
562 | { |
---|
563 | $sql = "select count(kll.kll_id) as cnt, ind.ind_plt_id as plt_id |
---|
564 | from kb3_kills kll |
---|
565 | inner join kb3_inv_detail ind |
---|
566 | on ( ind.ind_kll_id = kll.kll_id ) |
---|
567 | inner join kb3_pilots plt |
---|
568 | on ( plt.plt_id = ind.ind_plt_id"; |
---|
569 | if ($this->inv_crp_) |
---|
570 | $sql .= " and plt.plt_crp_id in ( ".substr($this->inv_crp_, 0, strlen($this->inv_crp_) - 2)." )"; |
---|
571 | |
---|
572 | $sql .= ")"; |
---|
573 | |
---|
574 | $this->setSQLTop($sql); |
---|
575 | |
---|
576 | $this->setSQLBottom("group by ind.ind_plt_id order by 1 desc |
---|
577 | limit 30"); |
---|
578 | $this->addVictimShipClass(new ShipClass(20)); // freighter |
---|
579 | $this->addVictimShipClass(new ShipClass(19)); // dread |
---|
580 | $this->addVictimShipClass(new ShipClass(27)); // carrier |
---|
581 | $this->addVictimShipClass(new ShipClass(28)); // mothership |
---|
582 | $this->addVictimShipClass(new ShipClass(26)); // titan |
---|
583 | } |
---|
584 | } |
---|
585 | |
---|
586 | class TopContractKillsList extends TopKillsList |
---|
587 | { |
---|
588 | function TopContractKillsList() |
---|
589 | { |
---|
590 | $this->TopKillsList(); |
---|
591 | } |
---|
592 | |
---|
593 | function generate() |
---|
594 | { |
---|
595 | parent::generate(); |
---|
596 | } |
---|
597 | |
---|
598 | function setContract($contract) |
---|
599 | { |
---|
600 | $this->setStartDate($contract->getStartDate()); |
---|
601 | if ($contract->getEndDate() != "") |
---|
602 | $this->setEndDate($contract->getEndDate()); |
---|
603 | |
---|
604 | while ($target = $contract->getContractTarget()) |
---|
605 | { |
---|
606 | switch ($target->getType()) |
---|
607 | { |
---|
608 | case "corp": |
---|
609 | $this->addVictimCorp(new Corporation($target->getID())); |
---|
610 | break; |
---|
611 | case "alliance": |
---|
612 | $this->addVictimAlliance(new Alliance($target->getID())); |
---|
613 | break; |
---|
614 | case "region": |
---|
615 | $this->addRegion(new Region($target->getID())); |
---|
616 | break; |
---|
617 | case "system": |
---|
618 | $this->addSystem(new SolarSystem($target->getID())); |
---|
619 | break; |
---|
620 | } |
---|
621 | } |
---|
622 | } |
---|
623 | } |
---|
624 | |
---|
625 | class TopContractScoreList extends TopScoreList |
---|
626 | { |
---|
627 | function TopContractScoreList() |
---|
628 | { |
---|
629 | $this->TopScoreList(); |
---|
630 | } |
---|
631 | |
---|
632 | function generate() |
---|
633 | { |
---|
634 | parent::generate(); |
---|
635 | } |
---|
636 | |
---|
637 | function setContract($contract) |
---|
638 | { |
---|
639 | $this->setStartDate($contract->getStartDate()); |
---|
640 | if ($contract->getEndDate() != "") |
---|
641 | $this->setEndDate($contract->getEndDate()); |
---|
642 | |
---|
643 | while ($target = $contract->getContractTarget()) |
---|
644 | { |
---|
645 | switch ($target->getType()) |
---|
646 | { |
---|
647 | case "corp": |
---|
648 | $this->addVictimCorp(new Corporation($target->getID())); |
---|
649 | break; |
---|
650 | case "alliance": |
---|
651 | $this->addVictimAlliance(new Alliance($target->getID())); |
---|
652 | break; |
---|
653 | case "region": |
---|
654 | $this->addRegion(new Region($target->getID())); |
---|
655 | break; |
---|
656 | case "system": |
---|
657 | $this->addSystem(new SolarSystem($target->getID())); |
---|
658 | break; |
---|
659 | } |
---|
660 | } |
---|
661 | } |
---|
662 | } |
---|
663 | |
---|
664 | class TopPilotTable |
---|
665 | { |
---|
666 | function TopPilotTable($toplist, $entity) |
---|
667 | { |
---|
668 | $this->toplist_ = $toplist; |
---|
669 | $this->entity_ = $entity; |
---|
670 | } |
---|
671 | |
---|
672 | function generate() |
---|
673 | { |
---|
674 | $this->toplist_->generate(); |
---|
675 | |
---|
676 | $html .= "<table class=kb-table cellspacing=1>"; |
---|
677 | $html .= "<tr class=kb-table-header>"; |
---|
678 | $html .= "<td class=kb-table-cell align=center colspan=2>Pilot</td>"; |
---|
679 | $html .= "<td class=kb-table-cell align=center width=60>".$this->entity_."</td>"; |
---|
680 | $html .= "</tr>"; |
---|
681 | |
---|
682 | $odd = true; |
---|
683 | $i = 1; |
---|
684 | while ($row = $this->toplist_->getRow()) |
---|
685 | { |
---|
686 | $pilot = new Pilot($row['plt_id']); |
---|
687 | if ($odd) |
---|
688 | { |
---|
689 | $class = "kb-table-row-odd"; |
---|
690 | $odd = false; |
---|
691 | } |
---|
692 | else |
---|
693 | { |
---|
694 | $class = "kb-table-row-even"; |
---|
695 | $odd = true; |
---|
696 | } |
---|
697 | $html .= "<tr class=".$class.">"; |
---|
698 | $html .= "<td><img src=\"".$pilot->getPortraitURL(32)."\"></td>"; |
---|
699 | $html .= "<td class=kb-table-cell width=200><b>".$i.".</b> <a class=kb-shipclass href=\"?a=pilot_detail&plt_id=".$row['plt_id']."\">".$pilot->getName()."</a></td>"; |
---|
700 | $html .= "<td class=kb-table-cell align=center><b>".$row['cnt']."</b></td>"; |
---|
701 | |
---|
702 | $html .= "</tr>"; |
---|
703 | $i++; |
---|
704 | } |
---|
705 | |
---|
706 | $html .= "</table>"; |
---|
707 | |
---|
708 | return $html; |
---|
709 | } |
---|
710 | } |
---|
711 | |
---|
712 | class TopCorpTable |
---|
713 | { |
---|
714 | function TopCorpTable($toplist, $entity) |
---|
715 | { |
---|
716 | $this->toplist_ = $toplist; |
---|
717 | $this->entity_ = $entity; |
---|
718 | } |
---|
719 | |
---|
720 | function generate() |
---|
721 | { |
---|
722 | $this->toplist_->generate(); |
---|
723 | |
---|
724 | $html .= "<table class=kb-table cellspacing=1>"; |
---|
725 | $html .= "<tr class=kb-table-header>"; |
---|
726 | $html .= "<td class=kb-table-cell align=center>#</td>"; |
---|
727 | $html .= "<td class=kb-table-cell align=center>Corporation</td>"; |
---|
728 | $html .= "<td class=kb-table-cell align=center width=60>".$this->entity_."</td>"; |
---|
729 | $html .= "</tr>"; |
---|
730 | |
---|
731 | $odd = true; |
---|
732 | $i = 1; |
---|
733 | while ($row = $this->toplist_->getRow()) |
---|
734 | { |
---|
735 | $corp = new Corporation($row['crp_id']); |
---|
736 | if ($odd) |
---|
737 | { |
---|
738 | $class = "kb-table-row-odd"; |
---|
739 | $odd = false; |
---|
740 | } |
---|
741 | else |
---|
742 | { |
---|
743 | $class = "kb-table-row-even"; |
---|
744 | $odd = true; |
---|
745 | } |
---|
746 | $html .= "<tr class=".$class.">"; |
---|
747 | $html .= "<td class=kb-table-cell align=center><b>".$i.".</b></td>"; |
---|
748 | $html .= "<td class=kb-table-cell width=200><a href=\"?a=corp_detail&crp_id=".$row['crp_id']."\">".$corp->getName()."</a></td>"; |
---|
749 | $html .= "<td class=kb-table-cell align=center><b>".$row['cnt']."</b></td>"; |
---|
750 | |
---|
751 | $html .= "</tr>"; |
---|
752 | $i++; |
---|
753 | } |
---|
754 | |
---|
755 | $html .= "</table>"; |
---|
756 | |
---|
757 | return $html; |
---|
758 | } |
---|
759 | } |
---|
760 | |
---|
761 | class TopShipList extends TopList |
---|
762 | { |
---|
763 | function TopShipList() |
---|
764 | { |
---|
765 | $this->TopList(); |
---|
766 | } |
---|
767 | |
---|
768 | function addInvolvedPilot($pilot) |
---|
769 | { |
---|
770 | $this->invplt_ = $pilot; |
---|
771 | } |
---|
772 | |
---|
773 | function addInvolvedCorp($corp) |
---|
774 | { |
---|
775 | $this->invcrp_ = $corp; |
---|
776 | } |
---|
777 | |
---|
778 | function addInvolvedAlliance($alliance) |
---|
779 | { |
---|
780 | $this->invall_ = $alliance; |
---|
781 | } |
---|
782 | |
---|
783 | function generate() |
---|
784 | { |
---|
785 | $sql = "select count(*) as cnt, ind.ind_shp_id as shp_id |
---|
786 | from kb3_inv_detail ind |
---|
787 | inner join kb3_ships shp on ( shp_id = ind.ind_shp_id )"; |
---|
788 | |
---|
789 | if ($this->invplt_) |
---|
790 | $sql .= " inner join kb3_inv_plt inp |
---|
791 | on ( inp.inp_kll_id = ind.ind_kll_id |
---|
792 | and inp.inp_plt_id = ind.ind_plt_id |
---|
793 | and inp.inp_plt_id = ".$this->invplt_->getID().")"; |
---|
794 | |
---|
795 | if ($this->invcrp_) |
---|
796 | $sql .= " inner join kb3_inv_crp inc |
---|
797 | on ( inc.inc_kll_id = ind.ind_kll_id |
---|
798 | and inc.inc_crp_id = ind.ind_crp_id |
---|
799 | and inc.inc_crp_id = ".$this->invcrp_->getID().")"; |
---|
800 | |
---|
801 | if ($this->invall_) |
---|
802 | $sql .= " inner join kb3_inv_all ina |
---|
803 | on ( ina.ina_kll_id = ind.ind_kll_id |
---|
804 | and ina.ina_all_id = ind.ind_all_id |
---|
805 | and ina.ina_all_id = ".$this->invall_->getID().")"; |
---|
806 | |
---|
807 | $this->setSQLTop($sql); |
---|
808 | $this->setSQLBottom(" and ind.ind_shp_id not in ( 6, 31 ) |
---|
809 | and shp.shp_class != 17 |
---|
810 | group by ind.ind_shp_id order by 1 desc |
---|
811 | limit 20"); |
---|
812 | } |
---|
813 | } |
---|
814 | |
---|
815 | class TopShipListTable |
---|
816 | { |
---|
817 | function TopShipListTable($toplist) |
---|
818 | { |
---|
819 | $this->toplist_ = $toplist; |
---|
820 | } |
---|
821 | |
---|
822 | function generate() |
---|
823 | { |
---|
824 | $this->toplist_->generate(); |
---|
825 | |
---|
826 | $html .= "<table class=kb-table cellspacing=1>"; |
---|
827 | $html .= "<tr class=kb-table-header>"; |
---|
828 | $html .= "<td class=kb-table-cell align=center colspan=2>Ship</td>"; |
---|
829 | $html .= "<td class=kb-table-cell align=center width=60>Kills</td>"; |
---|
830 | $html .= "</tr>"; |
---|
831 | |
---|
832 | $odd = true; |
---|
833 | while ($row = $this->toplist_->getRow()) |
---|
834 | { |
---|
835 | $ship = new Ship($row['shp_id']); |
---|
836 | $shipclass = $ship->getClass(); |
---|
837 | if ($odd) |
---|
838 | { |
---|
839 | $class = "kb-table-row-odd"; |
---|
840 | $odd = false; |
---|
841 | } |
---|
842 | else |
---|
843 | { |
---|
844 | $class = "kb-table-row-even"; |
---|
845 | $odd = true; |
---|
846 | } |
---|
847 | $html .= "<tr class=".$class.">"; |
---|
848 | $html .= "<td><img src=\"".$ship->getImage(32)."\"></td>"; |
---|
849 | $html .= "<td class=kb-table-cell width=200><b>".$ship->getName()."</b><br>".$shipclass->getName()."</td>"; |
---|
850 | $html .= "<td class=kb-table-cell align=center><b>".$row['cnt']."</b></td>"; |
---|
851 | |
---|
852 | $html .= "</tr>"; |
---|
853 | } |
---|
854 | |
---|
855 | $html .= "</table>"; |
---|
856 | |
---|
857 | return $html; |
---|
858 | } |
---|
859 | } |
---|
860 | |
---|
861 | class TopWeaponList extends TopList |
---|
862 | { |
---|
863 | function TopWeaponList() |
---|
864 | { |
---|
865 | $this->TopList(); |
---|
866 | } |
---|
867 | |
---|
868 | function addInvolvedPilot($pilot) |
---|
869 | { |
---|
870 | $this->invplt_ = $pilot; |
---|
871 | } |
---|
872 | |
---|
873 | function addInvolvedCorp($corp) |
---|
874 | { |
---|
875 | $this->invcrp_ = $corp; |
---|
876 | } |
---|
877 | |
---|
878 | function addInvolvedAlliance($alliance) |
---|
879 | { |
---|
880 | $this->invall_ = $alliance; |
---|
881 | } |
---|
882 | |
---|
883 | function generate() |
---|
884 | { |
---|
885 | $sql = "select count(*) as cnt, ind.ind_wep_id as itm_id |
---|
886 | from kb3_inv_detail ind |
---|
887 | inner join kb3_items itm on ( itm_id = ind.ind_wep_id )"; |
---|
888 | |
---|
889 | if ($this->invplt_) |
---|
890 | $sql .= " inner join kb3_inv_plt inp |
---|
891 | on ( inp.inp_kll_id = ind.ind_kll_id |
---|
892 | and inp.inp_plt_id = ind.ind_plt_id |
---|
893 | and inp.inp_plt_id = ".$this->invplt_->getID().")"; |
---|
894 | |
---|
895 | if ($this->invcrp_) |
---|
896 | $sql .= " inner join kb3_inv_crp inc |
---|
897 | on ( inc.inc_kll_id = ind.ind_kll_id |
---|
898 | and inc.inc_crp_id = ind.ind_crp_id |
---|
899 | and inc.inc_crp_id = ".$this->invcrp_->getID().")"; |
---|
900 | |
---|
901 | if ($this->invall_) |
---|
902 | $sql .= " inner join kb3_inv_all ina |
---|
903 | on ( ina.ina_kll_id = ind.ind_kll_id |
---|
904 | and ina.ina_all_id = ind.ind_all_id |
---|
905 | and ina.ina_all_id = ".$this->invall_->getID().")"; |
---|
906 | |
---|
907 | $this->setSQLTop($sql); |
---|
908 | $this->setSQLBottom(" and itm.itm_icon not in ( '1', 'icon_null' ) |
---|
909 | and itm.itm_name != 'Unknown' |
---|
910 | group by ind.ind_wep_id order by 1 desc |
---|
911 | limit 20"); |
---|
912 | } |
---|
913 | } |
---|
914 | |
---|
915 | class TopWeaponListTable |
---|
916 | { |
---|
917 | function TopWeaponListTable($toplist) |
---|
918 | { |
---|
919 | $this->toplist_ = $toplist; |
---|
920 | } |
---|
921 | |
---|
922 | function generate() |
---|
923 | { |
---|
924 | $this->toplist_->generate(); |
---|
925 | |
---|
926 | $html .= "<table class=kb-table cellspacing=1>"; |
---|
927 | $html .= "<tr class=kb-table-header>"; |
---|
928 | $html .= "<td class=kb-table-cell align=center colspan=2>Weapon</td>"; |
---|
929 | $html .= "<td class=kb-table-cell align=center width=60>Kills</td>"; |
---|
930 | $html .= "</tr>"; |
---|
931 | |
---|
932 | $odd = true; |
---|
933 | while ($row = $this->toplist_->getRow()) |
---|
934 | { |
---|
935 | $item = new Item($row['itm_id']); |
---|
936 | if ($odd) |
---|
937 | { |
---|
938 | $class = "kb-table-row-odd"; |
---|
939 | $odd = false; |
---|
940 | } |
---|
941 | else |
---|
942 | { |
---|
943 | $class = "kb-table-row-even"; |
---|
944 | $odd = true; |
---|
945 | } |
---|
946 | $html .= "<tr class=".$class.">"; |
---|
947 | $html .= "<td>".$item->getIcon(32)."</td>"; |
---|
948 | $html .= "<td class=kb-table-cell width=200><b>".$item->getName()."</b></td>"; |
---|
949 | $html .= "<td class=kb-table-cell align=center><b>".$row['cnt']."</b></td>"; |
---|
950 | |
---|
951 | $html .= "</tr>"; |
---|
952 | } |
---|
953 | |
---|
954 | $html .= "</table>"; |
---|
955 | |
---|
956 | return $html; |
---|
957 | } |
---|
958 | } |
---|
959 | ?> |
---|