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