1 | <?php |
---|
2 | require_once('common/includes/class.pilot.php'); |
---|
3 | require_once('common/includes/class.corp.php'); |
---|
4 | require_once('common/includes/class.alliance.php'); |
---|
5 | require_once('common/includes/class.kill.php'); |
---|
6 | require_once('common/includes/class.killlist.php'); |
---|
7 | require_once('common/includes/class.killlisttable.php'); |
---|
8 | require_once('common/includes/class.killsummarytable.php'); |
---|
9 | require_once('common/includes/class.toplist.php'); |
---|
10 | |
---|
11 | $plt_id = intval($_GET['plt_id']); |
---|
12 | $plt_external_id = intval($_GET['plt_external_id']); |
---|
13 | $scl_id = intval($_GET['scl_id']); |
---|
14 | |
---|
15 | if(!$plt_id) |
---|
16 | { |
---|
17 | if($plt_external_id) |
---|
18 | { |
---|
19 | $qry = new DBQuery(); |
---|
20 | $qry->execute('SELECT plt_id FROM kb3_pilots WHERE plt_externalid = '.$plt_external_id); |
---|
21 | if($qry->recordCount()) |
---|
22 | { |
---|
23 | $row = $qry->getRow(); |
---|
24 | $plt_id = $row['plt_id']; |
---|
25 | } |
---|
26 | } |
---|
27 | else |
---|
28 | { |
---|
29 | $html = 'That pilot doesn\'t exist.'; |
---|
30 | $page->generate($html); |
---|
31 | exit; |
---|
32 | } |
---|
33 | |
---|
34 | } |
---|
35 | $pilot = new Pilot($plt_id); |
---|
36 | $corp = $pilot->getCorp(); |
---|
37 | $alliance = $corp->getAlliance(); |
---|
38 | $page = new Page('Pilot details - '.$pilot->getName()); |
---|
39 | |
---|
40 | if (!$pilot->exists()) |
---|
41 | { |
---|
42 | $html = 'That pilot doesn\'t exist.'; |
---|
43 | $page->generate($html); |
---|
44 | exit; |
---|
45 | } |
---|
46 | |
---|
47 | $klist = new KillList(); |
---|
48 | $tklist = new KillList(); |
---|
49 | $llist = new KillList(); |
---|
50 | //$klist->setSummary(true); |
---|
51 | //$tklist->setSummary(true); |
---|
52 | //$llist->setSummary(true); |
---|
53 | $klist->addInvolvedPilot($pilot); |
---|
54 | $tklist->addInvolvedPilot($pilot); |
---|
55 | $llist->addVictimPilot($pilot); |
---|
56 | $klist->getAllKills(); |
---|
57 | $llist->getAllKills(); |
---|
58 | $tklist->setPodsNoobShips(false); |
---|
59 | |
---|
60 | $html .= "<table class=kb-table cellspacing=1 width=\"100%\">"; |
---|
61 | |
---|
62 | $html .= "<tr class=kb-table-row-even>"; |
---|
63 | $html .= "<td rowspan=8 width=128><img src=\"".$pilot->getPortraitURL(128)."\" border=\"0\" width=\"128\" height=\"128\" alt=\"portrait\"></td>"; |
---|
64 | |
---|
65 | $html .= "<td class=kb-table-cell width=160><b>Corporation:</b></td><td class=kb-table-cell><a href=\"?a=corp_detail&crp_id=".$corp->getID()."\">".$corp->getName()."</a></td></tr>"; |
---|
66 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Alliance:</b></td><td class=kb-table-cell>"; |
---|
67 | if ($alliance->getName() == "Unknown" || $alliance->getName() == "None") |
---|
68 | $html .= "<b>".$alliance->getName()."</b>"; |
---|
69 | else |
---|
70 | $html .= "<a href=\"?a=alliance_detail&all_id=".$alliance->getID()."\">".$alliance->getName()."</a>"; |
---|
71 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Kills:</b></td><td class=kl-kill>".$klist->getCount()."</td></tr>"; |
---|
72 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Real kills:</b></td><td class=kl-kill>".$tklist->getCount()."</td></tr>"; |
---|
73 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Losses:</b></td><td class=kl-loss>".$llist->getCount()."</td></tr>"; |
---|
74 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage done (ISK):</b></td><td class=kl-kill>".round($klist->getISK()/1000000000,2)."B</td></tr>"; |
---|
75 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Damage received (ISK):</b></td><td class=kl-loss>".round($llist->getISK()/1000000000,2)."B</td></tr>"; |
---|
76 | |
---|
77 | //Pilot Efficiency Mod Begin (K Austin) |
---|
78 | |
---|
79 | if ($tklist->getCount() == 0) |
---|
80 | { |
---|
81 | $pilot_survival = 100; |
---|
82 | $pilot_efficiency = 0; |
---|
83 | } |
---|
84 | else |
---|
85 | { |
---|
86 | if($tklist->getCount() + $llist->getCount()) $pilot_survival = round($llist->getCount() / ($tklist->getCount() + $llist->getCount()) * 100,2); |
---|
87 | else $pilot_survival = 0; |
---|
88 | if($klist->getISK() + $llist->getISK()) $pilot_efficiency = round(($klist->getISK() / ($klist->getISK() + $llist->getISK())) * 100,2); |
---|
89 | else $pilot_efficiency = 0; |
---|
90 | } |
---|
91 | |
---|
92 | //PE MOD addon (C Berry) |
---|
93 | $half = 50.0; |
---|
94 | if ($pilot_survival >= $half) $ps_color = "#00AA00"; |
---|
95 | else $ps_color = "#AA0000"; |
---|
96 | |
---|
97 | if ($pilot_efficiency < $half) $pe_color = "#AA0000"; |
---|
98 | else $pe_color = "#00AA00"; |
---|
99 | |
---|
100 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell><b>Chance of enemy survival:</b></td><td class=kb-table-cell><b><span style=\"color:" .$ps_color .";\">".$pilot_survival ."%</span></b></td></tr>"; |
---|
101 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell></td><td class=kb-table-cell><b>Pilot Efficiency (ISK):</b></td><td class=kb-table-cell><b><span style=\"color:" .$pe_color .";\">".$pilot_efficiency ."%</span></b></td></tr>"; |
---|
102 | |
---|
103 | //Pilot Efficiency Mod End |
---|
104 | |
---|
105 | //$html .= "</td></tr>"; |
---|
106 | $html .= "</table>"; |
---|
107 | |
---|
108 | $html .= "<br/>"; |
---|
109 | |
---|
110 | $points = $klist->getPoints(); |
---|
111 | $lpoints = $llist->getPoints(); |
---|
112 | $summary = new KillSummaryTable($klist, $llist); |
---|
113 | //$summary = new KillSummaryTable(); |
---|
114 | //$summary->addInvolvedPilot($pilot); |
---|
115 | |
---|
116 | $summary->setBreak(config::get('summarytable_rowcount')); |
---|
117 | if ($_GET['view'] == "ships_weapons") |
---|
118 | { |
---|
119 | $summary->setFilter(false); |
---|
120 | } |
---|
121 | $html .= $summary->generate(); |
---|
122 | |
---|
123 | switch ($_GET['view']) |
---|
124 | { |
---|
125 | case "kills": |
---|
126 | $html .= "<div class=kb-kills-header>All kills</div>"; |
---|
127 | |
---|
128 | $list = new KillList(); |
---|
129 | $list->setOrdered(true); |
---|
130 | $list->addInvolvedPilot($pilot); |
---|
131 | if ($scl_id) |
---|
132 | $list->addVictimShipClass($scl_id); |
---|
133 | $pagesplitter = new PageSplitter($list->getCount(), 30); |
---|
134 | $list->setPageSplitter($pagesplitter); |
---|
135 | $table = new KillListTable($list); |
---|
136 | $table->setDayBreak(false); |
---|
137 | $html .= $table->generate(); |
---|
138 | $html .= $pagesplitter->generate(); |
---|
139 | |
---|
140 | break; |
---|
141 | case "losses": |
---|
142 | $html .= "<div class=kb-losses-header>All losses</div>"; |
---|
143 | |
---|
144 | $list = new KillList(); |
---|
145 | $list->setOrdered(true); |
---|
146 | $list->setPodsNoobships(true); |
---|
147 | $list->addVictimPilot($pilot); |
---|
148 | if ($scl_id) |
---|
149 | $list->addVictimShipClass($scl_id); |
---|
150 | $pagesplitter = new PageSplitter($list->getCount(), 30); |
---|
151 | $list->setPageSplitter($pagesplitter); |
---|
152 | |
---|
153 | $table = new KillListTable($list); |
---|
154 | $table->setDayBreak(false); |
---|
155 | $html .= $table->generate(); |
---|
156 | $html .= $pagesplitter->generate(); |
---|
157 | break; |
---|
158 | case "ships_weapons": |
---|
159 | $html .= "<div class=block-header2>Ships & weapons used</div>"; |
---|
160 | |
---|
161 | $html .= "<table class=kb-subtable><tr><td valign=top width=400>"; |
---|
162 | $shiplist = new TopShipList(); |
---|
163 | $shiplist->addInvolvedPilot($pilot); |
---|
164 | $shiplisttable = new TopShipListTable($shiplist); |
---|
165 | $html .= $shiplisttable->generate(); |
---|
166 | $html .= "</td><td valign=top align=right width=400>"; |
---|
167 | |
---|
168 | $weaponlist = new TopWeaponList(); |
---|
169 | $weaponlist->addInvolvedPilot($pilot); |
---|
170 | $weaponlisttable = new TopWeaponListTable($weaponlist); |
---|
171 | $html .= $weaponlisttable->generate(); |
---|
172 | $html .= "</td></tr></table>"; |
---|
173 | |
---|
174 | break; |
---|
175 | default: |
---|
176 | $html .= "<div class=kb-kills-header>10 Most recent kills</div>"; |
---|
177 | $list = new KillList(); |
---|
178 | $list->setOrdered(true); |
---|
179 | if (config::get('comments_count')) $list->setCountComments(true); |
---|
180 | if (config::get('killlist_involved')) $list->setCountInvolved(true); |
---|
181 | $list->setLimit(10); |
---|
182 | $list->setPodsNoobships(true); |
---|
183 | $list->addInvolvedPilot($pilot); |
---|
184 | if ($scl_id) |
---|
185 | $list->addVictimShipClass($scl_id); |
---|
186 | |
---|
187 | $table = new KillListTable($list); |
---|
188 | $table->setDayBreak(false); |
---|
189 | $html .= $table->generate(); |
---|
190 | |
---|
191 | $html .= "<div class=kb-losses-header>10 Most recent losses</div>"; |
---|
192 | $list = new KillList(); |
---|
193 | $list->setOrdered(true); |
---|
194 | if (config::get('comments_count')) $list->setCountComments(true); |
---|
195 | if (config::get('killlist_involved')) $list->setCountInvolved(true); |
---|
196 | $list->setLimit(10); |
---|
197 | $list->setPodsNoobships(true); |
---|
198 | $list->addVictimPilot($pilot); |
---|
199 | if ($scl_id) |
---|
200 | $list->addVictimShipClass($scl_id); |
---|
201 | |
---|
202 | $table = new KillListTable($list); |
---|
203 | $table->setDayBreak(false); |
---|
204 | $table->setDayBreak(false); |
---|
205 | $html .= $table->generate(); |
---|
206 | break; |
---|
207 | } |
---|
208 | |
---|
209 | $menubox = new box("Menu"); |
---|
210 | $menubox->setIcon("menu-item.gif"); |
---|
211 | $menubox->addOption("caption","Kills & losses"); |
---|
212 | $menubox->addOption("link","Recent activity", "?a=pilot_detail&plt_id=".$pilot->getID()."&view=recent"); |
---|
213 | $menubox->addOption("link","Kills", "?a=pilot_detail&plt_id=".$pilot->getID()."&view=kills"); |
---|
214 | $menubox->addOption("link","Losses", "?a=pilot_detail&plt_id=".$pilot->getID()."&view=losses"); |
---|
215 | $menubox->addOption("caption","Statistics"); |
---|
216 | $menubox->addOption("link","Ships & weapons", "?a=pilot_detail&plt_id=".$pilot->getID()."&view=ships_weapons"); |
---|
217 | if (strstr(config::get("mods_active"), 'signature_generator')) |
---|
218 | { |
---|
219 | $menubox->addOption("caption","Signature"); |
---|
220 | $menubox->addOption("link","Link", "?a=sig_list&i=".$pilot->getID()); |
---|
221 | } |
---|
222 | $page->addContext($menubox->generate()); |
---|
223 | |
---|
224 | if (config::get('kill_points')) |
---|
225 | { |
---|
226 | $scorebox = new Box("Kill points"); |
---|
227 | $scorebox->addOption("points", $points); |
---|
228 | $page->addContext($scorebox->generate()); |
---|
229 | } |
---|
230 | if (config::get('loss_points')) |
---|
231 | { |
---|
232 | $scorebox = new Box("Loss points"); |
---|
233 | $scorebox->addOption("points", $lpoints); |
---|
234 | $page->addContext($scorebox->generate()); |
---|
235 | } |
---|
236 | if (config::get('total_points')) |
---|
237 | { |
---|
238 | $scorebox = new Box("Total points"); |
---|
239 | $scorebox->addOption("points", $points-$lpoints); |
---|
240 | $page->addContext($scorebox->generate()); |
---|
241 | } |
---|
242 | |
---|
243 | $page->setContent($html); |
---|
244 | $page->generate(); |
---|
245 | ?> |
---|