1 | <?php |
---|
2 | require_once('common/includes/class.kill.php'); |
---|
3 | require_once('common/includes/class.pilot.php'); |
---|
4 | require_once('common/includes/class.corp.php'); |
---|
5 | require_once('common/includes/class.alliance.php'); |
---|
6 | |
---|
7 | $page = new Page('Kill details'); |
---|
8 | |
---|
9 | if (config::get('item_values')) |
---|
10 | { |
---|
11 | $smarty->assign('item_values', 'true'); |
---|
12 | if ($page->isAdmin()) |
---|
13 | { |
---|
14 | $smarty->assign('admin', 'true'); |
---|
15 | if (isset($_POST['submit']) && $_POST['submit'] == 'UpdateValue') |
---|
16 | { |
---|
17 | // Send new value for item to the database |
---|
18 | $IID = $_POST['IID']; |
---|
19 | $Val = $_POST[$IID]; |
---|
20 | $qry = new DBQuery(); |
---|
21 | $qry->execute("INSERT INTO kb3_item_price (typeID, price) VALUES ('".$IID."', '".$Val."') ON DUPLICATE KEY UPDATE price = '".$Val."'"); |
---|
22 | } |
---|
23 | } |
---|
24 | } |
---|
25 | |
---|
26 | if ($page->isAdmin()) |
---|
27 | { |
---|
28 | if (isset($_GET['view']) && $_GET['view']== 'FixSlot') |
---|
29 | { |
---|
30 | $smarty->assign('fixSlot', 'true'); |
---|
31 | } |
---|
32 | |
---|
33 | $smarty->assign('admin', 'true'); |
---|
34 | if (isset($_POST['submit']) && $_POST['submit'] == 'UpdateSlot') |
---|
35 | { |
---|
36 | $IID = $_POST['IID']; |
---|
37 | $KID = $_POST['KID']; |
---|
38 | $Val = $_POST[$IID]; |
---|
39 | $table = $_POST['TYPE']; |
---|
40 | $old = $_POST['OLDSLOT']; |
---|
41 | $qry = new DBQuery(); |
---|
42 | $qry->execute("UPDATE kb3_items_".$table." SET itd_itl_id ='".$Val."' WHERE itd_itm_id=".$IID." AND itd_kll_id = ".$KID." AND itd_itl_id = ".$old); |
---|
43 | } |
---|
44 | } |
---|
45 | |
---|
46 | if (!$kll_id = intval($_GET['kll_id'])) |
---|
47 | { |
---|
48 | $html = "No kill id specified."; |
---|
49 | $page->setContent($html); |
---|
50 | $page->generate($html); |
---|
51 | exit; |
---|
52 | } |
---|
53 | |
---|
54 | $kill = new Kill($kll_id); |
---|
55 | if (!$kill->exists()) |
---|
56 | { |
---|
57 | $html = "That kill doesn't exist."; |
---|
58 | $page->setContent($html); |
---|
59 | $page->generate($html); |
---|
60 | exit; |
---|
61 | } |
---|
62 | |
---|
63 | // victim $smarty->assign('',); |
---|
64 | $smarty->assign('KillId', $kill->getID()); |
---|
65 | $smarty->assign('VictimPortrait', $kill->getVictimPortrait(64)); |
---|
66 | $smarty->assign('VictimURL', "?a=pilot_detail&plt_id=".$kill->getVictimID()); |
---|
67 | $smarty->assign('VictimName', $kill->getVictimName()); |
---|
68 | $smarty->assign('VictimCorpURL', "?a=corp_detail&crp_id=".$kill->getVictimCorpID()); |
---|
69 | $smarty->assign('VictimCorpName', $kill->getVictimCorpName()); |
---|
70 | $smarty->assign('VictimAllianceURL', "?a=alliance_detail&all_id=".$kill->getVictimAllianceID()); |
---|
71 | $smarty->assign('VictimAllianceName', $kill->getVictimAllianceName()); |
---|
72 | $smarty->assign('VictimDamageTaken', $kill->VictimDamageTaken); |
---|
73 | |
---|
74 | // involved |
---|
75 | $i = 1; |
---|
76 | $involved = array(); |
---|
77 | foreach ($kill->involvedparties_ as $inv) |
---|
78 | { |
---|
79 | $pilot = new Pilot($inv->getPilotID()); |
---|
80 | $corp = new Corporation($inv->getCorpID()); |
---|
81 | $alliance = new Alliance($inv->getAllianceID()); |
---|
82 | $ship = $inv->getShip(); |
---|
83 | $weapon = $inv->getWeapon(); |
---|
84 | |
---|
85 | $involved[$i]['shipImage'] = $ship->getImage(64); |
---|
86 | $involved[$i]['PilotURL'] = "?a=pilot_detail&plt_id=".$pilot->getID(); |
---|
87 | $involved[$i]['PilotName'] = $pilot->getName(); |
---|
88 | $involved[$i]['CorpURL'] = "?a=corp_detail&crp_id=".$corp->getID(); |
---|
89 | $involved[$i]['CorpName'] = $corp->getName(); |
---|
90 | $involved[$i]['AlliURL'] = "?a=alliance_detail&all_id=".$alliance->getID(); |
---|
91 | $involved[$i]['AlliName'] = $alliance->getName(); |
---|
92 | $involved[$i]['ShipName'] = $ship->getName(); |
---|
93 | $involved[$i]['ShipID'] = $ship->externalid_; |
---|
94 | $involved[$i]['damageDone'] = $inv->dmgdone_; |
---|
95 | |
---|
96 | if ($pilot->getID() == $kill->getFBPilotID()) |
---|
97 | { |
---|
98 | $involved[$i]['FB'] = "true"; |
---|
99 | } |
---|
100 | else |
---|
101 | { |
---|
102 | $involved[$i]['FB'] = "false"; |
---|
103 | } |
---|
104 | |
---|
105 | if ($corp->isNPCCorp()) |
---|
106 | { |
---|
107 | $involved[$i]['portrait'] = $corp->getPortraitURL(64); |
---|
108 | } |
---|
109 | else |
---|
110 | { |
---|
111 | $involved[$i]['portrait'] = $pilot->getPortraitURL(64); |
---|
112 | } |
---|
113 | |
---|
114 | if ($weapon->getName() != "Unknown" && $weapon->getName() != $ship->getName()) |
---|
115 | { |
---|
116 | $involved[$i]['weaponName'] = $weapon->getName(); |
---|
117 | $involved[$i]['weaponID'] = $weapon->row_['itm_externalid']; |
---|
118 | } |
---|
119 | else |
---|
120 | $involved[$i]['weaponName'] = "Unknown"; |
---|
121 | ++$i; |
---|
122 | } |
---|
123 | $smarty->assign_by_ref('involved', $involved); |
---|
124 | |
---|
125 | if (config::get('comments')) |
---|
126 | { |
---|
127 | include('comments.php'); |
---|
128 | $smarty->assign('comments', $comment); |
---|
129 | } |
---|
130 | // ship, ship details |
---|
131 | $ship = $kill->getVictimShip(); |
---|
132 | $shipclass = $ship->getClass(); |
---|
133 | $system = $kill->getSystem(); |
---|
134 | |
---|
135 | $smarty->assign('VictimShip', $kill->getVictimShip()); |
---|
136 | $smarty->assign('ShipClass', $ship->getClass()); |
---|
137 | $smarty->assign('ShipImage', $ship->getImage(64)); |
---|
138 | $smarty->assign('ShipName', $ship->getName()); |
---|
139 | $smarty->assign('ShipID', $ship->externalid_); |
---|
140 | $smarty->assign('ClassName', $shipclass->getName()); |
---|
141 | |
---|
142 | if ($kill->isClassified()) |
---|
143 | { |
---|
144 | //Admin is able to see classified Systems |
---|
145 | if ($page->isAdmin()){ |
---|
146 | $smarty->assign('System', $system->getName().' (Classified)'); |
---|
147 | $smarty->assign('SystemURL', "?a=system_detail&sys_id=".$system->getID()); |
---|
148 | $smarty->assign('SystemSecurity', $system->getSecurity(true)); |
---|
149 | }else{ |
---|
150 | $smarty->assign('System', 'Classified'); |
---|
151 | $smarty->assign('SystemURL', ""); |
---|
152 | $smarty->assign('SystemSecurity', '0.0'); |
---|
153 | } |
---|
154 | } |
---|
155 | else |
---|
156 | { |
---|
157 | $smarty->assign('System', $system->getName()); |
---|
158 | $smarty->assign('SystemURL', "?a=system_detail&sys_id=".$system->getID()); |
---|
159 | $smarty->assign('SystemSecurity', $system->getSecurity(true)); |
---|
160 | } |
---|
161 | $smarty->assign('TimeStamp', $kill->getTimeStamp()); |
---|
162 | $smarty->assign('VictimShipImg', $ship->getImage(64)); |
---|
163 | |
---|
164 | // preparing slot layout |
---|
165 | |
---|
166 | $slot_array = array(); |
---|
167 | $slot_array[1] = array('img' => 'icon08_11.png', 'text' => 'Fitted - High slot', 'items' => array()); |
---|
168 | $slot_array[2] = array('img' => 'icon08_10.png', 'text' => 'Fitted - Mid slot', 'items' => array()); |
---|
169 | $slot_array[3] = array('img' => 'icon08_09.png', 'text' => 'Fitted - Low slot', 'items' => array()); |
---|
170 | $slot_array[5] = array('img' => 'icon68_01.png', 'text' => 'Fitted - Rig slot', 'items' => array()); |
---|
171 | $slot_array[6] = array('img' => 'icon02_10.png', 'text' => 'Drone bay', 'items' => array()); |
---|
172 | $slot_array[4] = array('img' => 'icon03_14.png', 'text' => 'Cargo Bay', 'items' => array()); |
---|
173 | |
---|
174 | // ship fitting |
---|
175 | if (count($kill->destroyeditems_) > 0) |
---|
176 | { |
---|
177 | $dest_array = array(); |
---|
178 | foreach($kill->destroyeditems_ as $destroyed) |
---|
179 | { |
---|
180 | $item = $destroyed->getItem(); |
---|
181 | if (config::get('item_values')) |
---|
182 | { |
---|
183 | $value = $destroyed->getValue(); |
---|
184 | $TotalValue += $value*$destroyed->getQuantity(); |
---|
185 | $formatted = $destroyed->getFormatttedValue(); |
---|
186 | } |
---|
187 | $dest_array[$destroyed->getLocationID()][] = array('Icon' => $item->getIcon(32), 'Name' => $item->getName(), 'Quantity' => $destroyed->getQuantity(), 'Value' => $formatted, 'single_unit' => $value, 'itemID' => $item->getID(),'slotID' => $destroyed->getLocationID()); |
---|
188 | } |
---|
189 | } |
---|
190 | |
---|
191 | if (count($kill->droppeditems_) > 0) |
---|
192 | { |
---|
193 | $drop_array = array(); |
---|
194 | foreach($kill->droppeditems_ as $dropped) |
---|
195 | { |
---|
196 | $item = $dropped->getItem(); |
---|
197 | if (config::get('item_values')) |
---|
198 | { |
---|
199 | $value = $dropped->getValue(); |
---|
200 | $dropvalue += $value*$dropped->getQuantity(); |
---|
201 | $formatted = $dropped->getFormatttedValue(); |
---|
202 | } |
---|
203 | $drop_array[$dropped->getLocationID()][] = array('Icon' => $item->getIcon(32), 'Name' => $item->getName(), 'Quantity' => $dropped->getQuantity(), 'Value' => $formatted, 'single_unit' => $value, 'itemID' => $item->getID(),'slotID' => $dropped->getLocationID()); |
---|
204 | } |
---|
205 | } |
---|
206 | |
---|
207 | if ($TotalValue >= 0) |
---|
208 | { |
---|
209 | $Formatted = number_format($TotalValue, 2); |
---|
210 | } |
---|
211 | |
---|
212 | // Get Ship Value |
---|
213 | $ShipValue = $ship->getPrice(); |
---|
214 | if (config::get('kd_droptototal')) |
---|
215 | { |
---|
216 | $TotalValue += $dropvalue; |
---|
217 | } |
---|
218 | $TotalLoss = number_format($TotalValue + $ShipValue, 2); |
---|
219 | $ShipValue = number_format($ShipValue, 2); |
---|
220 | $dropvalue = number_format($dropvalue, 2); |
---|
221 | |
---|
222 | $smarty->assign_by_ref('destroyed', $dest_array); |
---|
223 | $smarty->assign_by_ref('dropped', $drop_array); |
---|
224 | $smarty->assign_by_ref('slots', $slot_array); |
---|
225 | $smarty->assign('ItemValue', $Formatted); |
---|
226 | $smarty->assign('DropValue', $dropvalue); |
---|
227 | $smarty->assign('ShipValue', $ShipValue); |
---|
228 | $smarty->assign('TotalLoss', $TotalLoss); |
---|
229 | |
---|
230 | $menubox = new Box("Menu"); |
---|
231 | $menubox->setIcon("menu-item.gif"); |
---|
232 | $menubox->addOption("caption", "View"); |
---|
233 | $menubox->addOption("link", "Killmail", "javascript:sndReq('index.php?a=kill_mail&kll_id=".$kill->getID()."');ReverseContentDisplay('popup')"); |
---|
234 | if ($kill->relatedKillCount() > 1 || $kill->relatedLossCount() > 1) |
---|
235 | { |
---|
236 | $menubox->addOption("link", "Related kills (".$kill->relatedKillCount()."/".$kill->relatedLossCount().")", "?a=kill_related&kll_id=".$kill->getID()); |
---|
237 | } |
---|
238 | if ($page->isAdmin()) |
---|
239 | { |
---|
240 | $menubox->addOption("caption", "Admin"); |
---|
241 | $menubox->addOption("link", "Delete", "javascript:openWindow('?a=admin_kill_delete&kll_id=".$kill->getID()."', null, 420, 300, '' );"); |
---|
242 | $menubox->addOption("link", "Fix Slots", "?a=kill_detail&kll_id=".$kill->getID()."&view=FixSlot"); |
---|
243 | |
---|
244 | } |
---|
245 | $page->addContext($menubox->generate()); |
---|
246 | |
---|
247 | if (config::get('kill_points')) |
---|
248 | { |
---|
249 | $scorebox = new Box("Points"); |
---|
250 | $scorebox->addOption("points", $kill->getKillPoints()); |
---|
251 | $page->addContext($scorebox->generate()); |
---|
252 | } |
---|
253 | |
---|
254 | //Admin is able to see classsiefied systems |
---|
255 | if ((!$kill->isClassified()) || ($page->isAdmin())) |
---|
256 | { |
---|
257 | $mapbox = new Box("Map"); |
---|
258 | $mapbox->addOption("img", "?a=mapview&sys_id=".$system->getID()."&mode=map&size=145"); |
---|
259 | $mapbox->addOption("img", "?a=mapview&sys_id=".$system->getID()."&mode=region&size=145"); |
---|
260 | $mapbox->addOption("img", "?a=mapview&sys_id=".$system->getID()."&mode=cons&size=145"); |
---|
261 | $page->addContext($mapbox->generate()); |
---|
262 | } |
---|
263 | |
---|
264 | $html = $smarty->fetch(get_tpl('kill_detail')); |
---|
265 | $page->setContent($html); |
---|
266 | $page->generate(); |
---|
267 | ?> |
---|