1 | <?php |
---|
2 | //Version 1.3 of the item_values mod |
---|
3 | // ChangeLog |
---|
4 | //Last edit 11/23/2006 |
---|
5 | //Made change to class.ship.php to be pushed to core, rounding ship values is fucking retarded |
---|
6 | //Using this change added ship value loss and total loss to the ItemValue. Probably need to change this to smarty now but beyond that it is done done done! |
---|
7 | //Ship value is calculated using the base value in the kb3_ships, this is where the values need to be changed, the settings file will update the database to current |
---|
8 | //values from eve-central, beware this will take a while and dont do it lots or they will ban your ass. |
---|
9 | |
---|
10 | require_once("common/class.kill.php"); |
---|
11 | require_once("common/class.page.php"); |
---|
12 | require_once("common/class.pilot.php"); |
---|
13 | require_once("common/class.corp.php"); |
---|
14 | require_once("common/class.box.php"); |
---|
15 | require_once("common/class.alliance.php"); |
---|
16 | require_once("common/class.ship.php"); |
---|
17 | require_once("common/globals.php"); |
---|
18 | |
---|
19 | $page = new Page("Kill details"); |
---|
20 | |
---|
21 | if($page->isAdmin()) { |
---|
22 | if (isset($_POST['submit'])) { |
---|
23 | // Send new value for item to the database |
---|
24 | $IID = $_POST['IID']; |
---|
25 | $Val = $_POST[$IID]; |
---|
26 | |
---|
27 | $qry = new DBQuery(); |
---|
28 | $qry->execute("UPDATE kb3_items SET itm_value ='" . $Val . "' WHERE itm_id='" . $IID . "'") or die($qry->getErrorMsg()); |
---|
29 | |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | if (!$kll_id = intval($_GET['kll_id'])) |
---|
34 | { |
---|
35 | $html = "No kill id spezified."; |
---|
36 | $page->setContent($html); |
---|
37 | $page->generate($html); |
---|
38 | exit; |
---|
39 | } |
---|
40 | $kill = new Kill($kll_id); |
---|
41 | if (!$kill->exists()) |
---|
42 | { |
---|
43 | $html = "That kill doesn't exist."; |
---|
44 | $page->setContent($html); |
---|
45 | $page->generate($html); |
---|
46 | exit; |
---|
47 | } |
---|
48 | |
---|
49 | $html .= "<table cellpadding=0 cellspacing=1 border=0><tr><td width=360 align=left valign=top>"; |
---|
50 | |
---|
51 | // victim |
---|
52 | $html .= "<table class=kb-table width=360 cellpadding=0 cellspacing=1 border=0>"; |
---|
53 | $html .= "<tr class=kb-table-row-odd><td rowspan=3 width=\"64\"><img src=\"" . $kill->getVictimPortrait(64) . "\" border=\"0\"></td>"; |
---|
54 | $html .= "<td class=kb-table-cell width=64><b>Victim:</b></td><td class=kb-table-cell><a href=\"?a=pilot_detail&plt_id=" . $kill->getVictimID() . "\">" . $kill->getVictimName() . "</a></td>"; |
---|
55 | $html .= "</tr>"; |
---|
56 | $html .= "<tr class=kb-table-row-odd>"; |
---|
57 | $html .= "<td class=kb-table-cell width=64><b>Corp:</b></td><td class=kb-table-cell><a href=\"?a=corp_detail&crp_id=" . $kill->getVictimCorpID() . "\">" . $kill->getVictimCorpName() . "</a></td>"; |
---|
58 | $html .= "</tr>"; |
---|
59 | $html .= "<tr class=kb-table-row-odd>"; |
---|
60 | $html .= "<td class=kb-table-cell width=64><b>Alliance:</b></td><td class=kb-table-cell><a href=\"?a=alliance_detail&all_id=".$kill->getVictimAllianceID()."\">".$kill->getVictimAllianceName()."</a></b></td>"; |
---|
61 | $html .= "</tr>"; |
---|
62 | $html .= "</table>"; |
---|
63 | |
---|
64 | // involved |
---|
65 | $html .= "<div class=block-header>Involved parties</div>"; |
---|
66 | $html .= "<table class=kb-table width=360 border=0 cellspacing=\"1\">"; |
---|
67 | $odd = true; |
---|
68 | foreach ($kill->involvedparties_ as $inv) |
---|
69 | { |
---|
70 | $pilot = new Pilot($inv->getPilotID()); |
---|
71 | $corp = new Corporation($inv->getCorpID()); |
---|
72 | $alliance = new Alliance($inv->getAllianceID()); |
---|
73 | $ship = $inv->getShip(); |
---|
74 | $weapon = $inv->getWeapon(); |
---|
75 | |
---|
76 | if ($odd) |
---|
77 | { |
---|
78 | $odd = false; |
---|
79 | $rowclass = "kb-table-row-even"; |
---|
80 | } |
---|
81 | else |
---|
82 | { |
---|
83 | $odd = true; |
---|
84 | $rowclass = "kb-table-row-odd"; |
---|
85 | } |
---|
86 | |
---|
87 | if ($pilot->getID() == $kill->getFBPilotID()) |
---|
88 | { |
---|
89 | $imgclass = "class=finalblow "; |
---|
90 | } |
---|
91 | else |
---|
92 | { |
---|
93 | $imgclass = ""; |
---|
94 | } |
---|
95 | |
---|
96 | $html .= "<tr class=kb-table-row-even>"; |
---|
97 | if ($corp->isNPCCorp()) |
---|
98 | { |
---|
99 | $html .= "<td rowspan=5 width=\"64\"><img " . $imgclass . "src=\"" . $corp->getPortraitURL(64) . "\" border=\"0\"></td>"; |
---|
100 | } |
---|
101 | else |
---|
102 | { |
---|
103 | $html .= "<td rowspan=5 width=\"64\"><img " . $imgclass . "src=\"" . $pilot->getPortraitURL(64) . "\" border=\"0\"></td>"; |
---|
104 | } |
---|
105 | $html .= "<td rowspan=5 width=\"64\"><img " . $imgclass . "src=\"" . $ship->getImage(64) . "\" border=\"0\"></td>"; |
---|
106 | $html .= "<td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><a href=\"?a=pilot_detail&plt_id=" . $pilot->getID() . "\">" . $pilot->getName() . "</a></td>"; |
---|
107 | $html .= "</tr>"; |
---|
108 | |
---|
109 | $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><a href=\"?a=corp_detail&crp_id=" . $corp->getID() . "\">" . $corp->getName() . "</a></td></tr>"; |
---|
110 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><a href=\"?a=alliance_detail&all_id=" . $alliance->getID() . "\">" . $alliance->getName() . "</a></td></tr>"; |
---|
111 | $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\"><b>" . $ship->getName() . "</b></td></tr>"; |
---|
112 | |
---|
113 | if ($weapon->getName() != "Unknown" && $weapon->getName() != $ship->getName()) |
---|
114 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\">" . $weapon->getName() . "</td></tr>"; |
---|
115 | else |
---|
116 | $html .= "<tr class=kb-table-row-even><td class=kb-table-cell style=\"padding-top: 1px; padding-bottom: 1px;\">Unknown</td></tr>"; |
---|
117 | } |
---|
118 | $html .= "</table>"; |
---|
119 | |
---|
120 | if ($config->getConfig('comments')) |
---|
121 | { |
---|
122 | include('common/comments.php'); |
---|
123 | } |
---|
124 | |
---|
125 | $html .= "</td><td width=50> </td>"; |
---|
126 | // ship, ship details |
---|
127 | $html .= "<td align=left valign=top width=360>"; |
---|
128 | |
---|
129 | $html .= "<table class=kb-table width=360 cellspacing=\"1\">"; |
---|
130 | $ship = $kill->getVictimShip(); |
---|
131 | $shipclass = $ship->getClass(); |
---|
132 | |
---|
133 | $html .= "<tr class=kb-table-row-odd><td width=\"64\" rowspan=3><img src=\"" . $ship->getImage(64) . "\"></td>"; |
---|
134 | $html .= "<td class=kb-table-cell><b>Ship:</b></td><td class=kb-table-cell><b>" . $ship->getName() . "</b> (" . $shipclass->getName() . ")</td>"; |
---|
135 | $html .= "</tr>"; |
---|
136 | $system = $kill->getSystem(); |
---|
137 | $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>Location:</b></td><td class=kb-table-cell><b><a href=\"javascript:openWindow( '?a=system_detail&sys_id=" . $system->getID() . "', '', 620, 260, '' );\">" . $system->getName() . "</a></b> (" . $system->getSecurity(true) . ")</td>"; |
---|
138 | |
---|
139 | $html .= "</tr>"; |
---|
140 | $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>Date:</b></td><td class=kb-table-cell>" . $kill->getTimeStamp() . "</td>"; |
---|
141 | $html .= "</tr>"; |
---|
142 | $html .= "</table>"; |
---|
143 | |
---|
144 | // ship fitting |
---|
145 | if (count($kill->destroyeditems_) > 0) |
---|
146 | { |
---|
147 | $html .= "<div class=block-header>Ship details</div>"; |
---|
148 | $html .= "<table class=kb-table width=360 border=\"0\" cellspacing=\"1\">"; |
---|
149 | $imgid = 0; |
---|
150 | |
---|
151 | if($page->isAdmin()) { |
---|
152 | |
---|
153 | } |
---|
154 | foreach($kill->destroyeditems_ as $destroyed) |
---|
155 | { |
---|
156 | $item = $destroyed->getItem(); |
---|
157 | switch ($destroyed->getLocationID()) |
---|
158 | { |
---|
159 | case 4: |
---|
160 | $location = "Cargo"; |
---|
161 | break; |
---|
162 | case 6: // drone |
---|
163 | $location = "Drone Bay"; |
---|
164 | break; |
---|
165 | default: |
---|
166 | switch ($item->getSlot()) |
---|
167 | { |
---|
168 | case 1: // high |
---|
169 | $location = "Fitted - High slot"; |
---|
170 | break; |
---|
171 | case 2: // high |
---|
172 | $location = "Fitted - Medium slot"; |
---|
173 | break; |
---|
174 | case 3: // high |
---|
175 | $location = "Fitted - Low slot"; |
---|
176 | break; |
---|
177 | case 6: // drone |
---|
178 | $location = "Drone Bay"; |
---|
179 | break; |
---|
180 | } |
---|
181 | break; |
---|
182 | } |
---|
183 | |
---|
184 | if ($location != $lastlocation) |
---|
185 | { |
---|
186 | $lastlocation = $location; |
---|
187 | $html .= "<tr class=kb-table-row-odd>"; |
---|
188 | $html .= "<td width=\"32\"><img src=\"" . IMG_URL . "/" . strtolower(str_replace(' ', '_', $location)) . ".jpg\" alt=\"" . $location . "\" border=\"0\"></a></td>"; |
---|
189 | $html .= "<td class=kb-table-cell colspan=2><b>" . $location . "</b></td>"; |
---|
190 | $html .= "<td class=kb-table-cell colspan=1 align='center'><b>" . "Value" . "</b></td>"; |
---|
191 | $html .= "</tr>"; |
---|
192 | } |
---|
193 | // item detail |
---|
194 | //Coni |
---|
195 | $html .= "<tr class=kb-table-row-even>"; |
---|
196 | $html .= $item->getIcon(32); |
---|
197 | $html .= "<td class=kb-table-cell>" . $item->getName() . "</td>"; |
---|
198 | $html .= "<td width=\"30\" align=\"center\">" . $destroyed->getQuantity() . "</td>"; |
---|
199 | $value = $destroyed->getValue(); |
---|
200 | $value_single = $value; |
---|
201 | if ($value > 0) { |
---|
202 | $value = $destroyed->getValue() * $destroyed->getQuantity(); |
---|
203 | $TotalValue = $TotalValue + $value; |
---|
204 | |
---|
205 | // Value Manipulation for prettyness. |
---|
206 | |
---|
207 | if (strlen($value) >1) { // 1000's ? |
---|
208 | $Formatted = number_format($value,2); |
---|
209 | $Formatted = $Formatted . " isk"; |
---|
210 | } |
---|
211 | |
---|
212 | if (strlen($value) >3) { // 1000's ? |
---|
213 | $Formatted = round($value / 1000,2); |
---|
214 | |
---|
215 | $Formatted = number_format($Formatted,2); |
---|
216 | $Formatted = $Formatted . " K"; |
---|
217 | } |
---|
218 | |
---|
219 | if (strlen($value) >6) { // Is this value in the millions? |
---|
220 | $Formatted = round($value / 1000000,2); |
---|
221 | $Formatted = number_format($Formatted,2); |
---|
222 | $Formatted = $Formatted . " M"; |
---|
223 | } |
---|
224 | |
---|
225 | } |
---|
226 | if ($page->isAdmin()) |
---|
227 | { |
---|
228 | $html .="<form method=post id=".$value." name=". $value ." action= >"; |
---|
229 | $html .= "<td class=kb-table-cell colspan=1 align=right><b>$value</b>"; |
---|
230 | $html .= "<input checked='checked' name='IID' value=" . $item->getID() . " type='hidden'></td>"; // Hidden Item Id Indicator |
---|
231 | |
---|
232 | $html .= "<tr class=kb-table-row-even>"; |
---|
233 | $html .= "<td class=kb-table-cell></td>"; |
---|
234 | $html .= "<td colspan=2 align=right class=kb-table-cell>Single Unit Value:"; |
---|
235 | $html .= "<input name= '".$item->getID()."' type='text' class='comment-button' value='".$value_single."' size='6'></td>"; |
---|
236 | $html .= "<td class=kb-table-cell colspan=1><input type='submit' name='submit' value='Update' class='comment-button'></td>"; |
---|
237 | $html .="</form>"; |
---|
238 | } |
---|
239 | else |
---|
240 | { |
---|
241 | $html .= "<td class=kb-table-cell colspan=1 align=right><b>$Formatted</b>"; |
---|
242 | } |
---|
243 | $html .= "</tr>"; |
---|
244 | $imgid++; |
---|
245 | } |
---|
246 | |
---|
247 | $html .= "<tr class=kb-table-row-odd>"; |
---|
248 | //$html .= "<td width=\"32\"></td>"; |
---|
249 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Total Module Loss:" . "</b></td>"; |
---|
250 | |
---|
251 | if ($TotalValue > 0) |
---|
252 | { |
---|
253 | $Formatted = number_format($TotalValue,2); |
---|
254 | } |
---|
255 | //Get Ship Value |
---|
256 | $ShipValue = $ship->getPrice(); |
---|
257 | |
---|
258 | $TotalLoss = number_format($TotalValue + $ShipValue,2); |
---|
259 | |
---|
260 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . $Formatted . "</b>"; |
---|
261 | $html .="</td>"; |
---|
262 | $html .= "</tr>"; |
---|
263 | $html .= "<tr class=kb-table-row-odd>"; |
---|
264 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Ship Loss:" . "</b></td>"; |
---|
265 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . number_format($ShipValue,2) . "</b></td>"; |
---|
266 | $html .= "</tr>"; |
---|
267 | $html .= "<tr class=kb-table-row-even>"; |
---|
268 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Total Loss:" . "</b></td>"; |
---|
269 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . $TotalLoss . "</b></td>"; |
---|
270 | $html .= "</tr>"; |
---|
271 | |
---|
272 | $html .= "</table>"; |
---|
273 | } |
---|
274 | else |
---|
275 | $html .= "<div class=block-header>No ship details</div>"; |
---|
276 | |
---|
277 | $html .= "</td></tr></table>"; |
---|
278 | |
---|
279 | $menubox = new box("Menu"); |
---|
280 | $menubox->setIcon("menu-item.gif"); |
---|
281 | $menubox->addOption("Caption","View"); |
---|
282 | $menubox->addOption("link","Killmail", "javascript:openWindow( '?a=kill_mail&kll_id=".$kill->getID()."', null, 355, 430, '' );"); |
---|
283 | if ($kill->relatedKillCount() > 1 || $kill->relatedLossCount() > 1) |
---|
284 | { |
---|
285 | $menubox->addOption("link","Related kills (".$kill->relatedKillCount()."/".$kill->relatedLossCount().")", "?a=kill_related&kll_id=".$kill->getID()); |
---|
286 | } |
---|
287 | if ($page->isAdmin()) |
---|
288 | { |
---|
289 | $menubox->addOption("caption","Admin"); |
---|
290 | $menubox->addOption("link","Delete", "javascript:openWindow('?a=kill_delete&kll_id=".$kill->getID()."', null, 420, 300, '' );"); |
---|
291 | } |
---|
292 | $page->addContext($menubox->generate()); |
---|
293 | |
---|
294 | if ($config->getKillPoints()) |
---|
295 | { |
---|
296 | $scorebox = new Box("Points awarded"); |
---|
297 | $scorebox->addOption("points",$kill->getKillPoints()); |
---|
298 | $page->addContext($scorebox->generate()); |
---|
299 | } |
---|
300 | |
---|
301 | $mapbox = new Box("Map"); |
---|
302 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=map&size=145"); |
---|
303 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=region&size=145"); |
---|
304 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=cons&size=145"); |
---|
305 | |
---|
306 | $page->addContext($mapbox->generate()); |
---|
307 | |
---|
308 | $page->setContent($html); |
---|
309 | $page->generate(); |
---|
310 | ?> |
---|