[94] | 1 | <?php |
---|
[81] | 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! |
---|
[94] | 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 |
---|
[81] | 8 | //values from eve-central, beware this will take a while and dont do it lots or they will ban your ass. |
---|
| 9 | |
---|
[70] | 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"); |
---|
[81] | 16 | require_once("common/class.ship.php"); |
---|
[70] | 17 | require_once("common/globals.php"); |
---|
| 18 | |
---|
| 19 | $page = new Page("Kill details"); |
---|
| 20 | |
---|
| 21 | if($page->isAdmin()) { |
---|
[94] | 22 | if (isset($_POST['submit'])) { |
---|
[70] | 23 | // Send new value for item to the database |
---|
| 24 | $IID = $_POST['IID']; |
---|
| 25 | $Val = $_POST[$IID]; |
---|
[94] | 26 | |
---|
[70] | 27 | $qry = new DBQuery(); |
---|
[94] | 28 | $qry->execute("UPDATE kb3_items SET itm_value ='" . $Val . "' WHERE itm_id='" . $IID . "'") or die($qry->getErrorMsg()); |
---|
| 29 | |
---|
| 30 | } |
---|
[70] | 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 | { |
---|
[81] | 122 | include('common/comments.php'); |
---|
[70] | 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 | $html .= "<tr class=kb-table-row-odd><td width=\"64\" rowspan=3><img src=\"" . $ship->getImage(64) . "\"></td>"; |
---|
| 133 | $html .= "<td class=kb-table-cell><b>Ship:</b></td><td class=kb-table-cell><b>" . $ship->getName() . "</b> (" . $shipclass->getName() . ")</td>"; |
---|
| 134 | $html .= "</tr>"; |
---|
| 135 | $system = $kill->getSystem(); |
---|
| 136 | $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>"; |
---|
| 137 | |
---|
| 138 | $html .= "</tr>"; |
---|
| 139 | $html .= "<tr class=kb-table-row-odd><td class=kb-table-cell><b>Date:</b></td><td class=kb-table-cell>" . $kill->getTimeStamp() . "</td>"; |
---|
| 140 | $html .= "</tr>"; |
---|
| 141 | $html .= "</table>"; |
---|
| 142 | |
---|
| 143 | // ship fitting |
---|
| 144 | if (count($kill->destroyeditems_) > 0) |
---|
| 145 | { |
---|
| 146 | $html .= "<div class=block-header>Ship details</div>"; |
---|
| 147 | $html .= "<table class=kb-table width=360 border=\"0\" cellspacing=\"1\">"; |
---|
| 148 | $imgid = 0; |
---|
[94] | 149 | |
---|
[70] | 150 | if($page->isAdmin()) { |
---|
[94] | 151 | |
---|
[70] | 152 | } |
---|
| 153 | foreach($kill->destroyeditems_ as $destroyed) |
---|
| 154 | { |
---|
| 155 | $item = $destroyed->getItem(); |
---|
| 156 | switch ($destroyed->getLocationID()) |
---|
| 157 | { |
---|
| 158 | case 4: |
---|
| 159 | $location = "Cargo"; |
---|
| 160 | break; |
---|
| 161 | case 6: // drone |
---|
| 162 | $location = "Drone Bay"; |
---|
| 163 | break; |
---|
| 164 | default: |
---|
| 165 | switch ($item->getSlot()) |
---|
| 166 | { |
---|
| 167 | case 1: // high |
---|
| 168 | $location = "Fitted - High slot"; |
---|
| 169 | break; |
---|
| 170 | case 2: // high |
---|
| 171 | $location = "Fitted - Medium slot"; |
---|
| 172 | break; |
---|
| 173 | case 3: // high |
---|
| 174 | $location = "Fitted - Low slot"; |
---|
| 175 | break; |
---|
| 176 | case 6: // drone |
---|
| 177 | $location = "Drone Bay"; |
---|
| 178 | break; |
---|
| 179 | } |
---|
| 180 | break; |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | if ($location != $lastlocation) |
---|
| 184 | { |
---|
| 185 | $lastlocation = $location; |
---|
| 186 | $html .= "<tr class=kb-table-row-odd>"; |
---|
| 187 | $html .= "<td width=\"32\"><img src=\"" . IMG_URL . "/" . strtolower(str_replace(' ', '_', $location)) . ".jpg\" alt=\"" . $location . "\" border=\"0\"></a></td>"; |
---|
| 188 | $html .= "<td class=kb-table-cell colspan=2><b>" . $location . "</b></td>"; |
---|
[81] | 189 | $html .= "<td class=kb-table-cell colspan=1 align='center'><b>" . "Value" . "</b></td>"; |
---|
[70] | 190 | $html .= "</tr>"; |
---|
| 191 | } |
---|
| 192 | // item detail |
---|
| 193 | //Coni |
---|
| 194 | $html .= "<tr class=kb-table-row-even>"; |
---|
| 195 | $html .= $item->getIcon(32); |
---|
| 196 | $html .= "<td class=kb-table-cell>" . $item->getName() . "</td>"; |
---|
| 197 | $html .= "<td width=\"30\" align=\"center\">" . $destroyed->getQuantity() . "</td>"; |
---|
| 198 | $value = $destroyed->getValue(); |
---|
| 199 | $value_single = $value; |
---|
| 200 | if ($value > 0) { |
---|
| 201 | $value = $destroyed->getValue() * $destroyed->getQuantity(); |
---|
| 202 | $TotalValue = $TotalValue + $value; |
---|
[94] | 203 | |
---|
[81] | 204 | // Value Manipulation for prettyness. |
---|
[94] | 205 | |
---|
[81] | 206 | if (strlen($value) >1) { // 1000's ? |
---|
[94] | 207 | $Formatted = number_format($value,2); |
---|
[81] | 208 | $Formatted = $Formatted . " isk"; |
---|
[94] | 209 | } |
---|
| 210 | |
---|
[81] | 211 | if (strlen($value) >3) { // 1000's ? |
---|
| 212 | $Formatted = round($value / 1000,2); |
---|
[94] | 213 | |
---|
| 214 | $Formatted = number_format($Formatted,2); |
---|
[81] | 215 | $Formatted = $Formatted . " K"; |
---|
| 216 | } |
---|
[94] | 217 | |
---|
[81] | 218 | if (strlen($value) >6) { // Is this value in the millions? |
---|
| 219 | $Formatted = round($value / 1000000,2); |
---|
[94] | 220 | $Formatted = number_format($Formatted,2); |
---|
[81] | 221 | $Formatted = $Formatted . " M"; |
---|
| 222 | } |
---|
[94] | 223 | |
---|
[70] | 224 | } |
---|
[98] | 225 | if ($page->isAdmin()) |
---|
| 226 | { |
---|
[81] | 227 | $html .="<form method=post id=".$value." name=". $value ." action= >"; |
---|
[98] | 228 | $html .= "<td class=kb-table-cell colspan=1 align=right><b>$value</b>"; |
---|
[70] | 229 | $html .= "<input checked='checked' name='IID' value=" . $item->getID() . " type='hidden'></td>"; // Hidden Item Id Indicator |
---|
[94] | 230 | |
---|
[70] | 231 | $html .= "<tr class=kb-table-row-even>"; |
---|
| 232 | $html .= "<td class=kb-table-cell></td>"; |
---|
| 233 | $html .= "<td colspan=2 align=right class=kb-table-cell>Single Unit Value:"; |
---|
| 234 | $html .= "<input name= '".$item->getID()."' type='text' class='comment-button' value='".$value_single."' size='6'></td>"; |
---|
| 235 | $html .= "<td class=kb-table-cell colspan=1><input type='submit' name='submit' value='Update' class='comment-button'></td>"; |
---|
| 236 | $html .="</form>"; |
---|
| 237 | } |
---|
[98] | 238 | else |
---|
| 239 | { |
---|
| 240 | $html .= "<td class=kb-table-cell colspan=1 align=right><b>$Formatted</b>"; |
---|
| 241 | } |
---|
[70] | 242 | $html .= "</tr>"; |
---|
| 243 | $imgid++; |
---|
| 244 | } |
---|
| 245 | |
---|
| 246 | $html .= "<tr class=kb-table-row-odd>"; |
---|
[81] | 247 | //$html .= "<td width=\"32\"></td>"; |
---|
| 248 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Total Module Loss:" . "</b></td>"; |
---|
[94] | 249 | |
---|
[98] | 250 | if ($TotalValue > 0) |
---|
| 251 | { |
---|
[81] | 252 | $Formatted = number_format($TotalValue,2); |
---|
[70] | 253 | } |
---|
[96] | 254 | //Get Ship Value |
---|
| 255 | $ShipValue = $ship->getPrice(); |
---|
[94] | 256 | |
---|
[81] | 257 | $TotalLoss = number_format($TotalValue + $ShipValue,2); |
---|
[94] | 258 | |
---|
[83] | 259 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . $Formatted . "</b>"; |
---|
[70] | 260 | $html .="</td>"; |
---|
| 261 | $html .= "</tr>"; |
---|
[81] | 262 | $html .= "<tr class=kb-table-row-odd>"; |
---|
| 263 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Ship Loss:" . "</b></td>"; |
---|
[83] | 264 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . number_format($ShipValue,2) . "</b></td>"; |
---|
[81] | 265 | $html .= "</tr>"; |
---|
| 266 | $html .= "<tr class=kb-table-row-even>"; |
---|
| 267 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . "Total Loss:" . "</b></td>"; |
---|
[83] | 268 | $html .= "<td class=kb-table-cell colspan=2 align=right><b>" . $TotalLoss . "</b></td>"; |
---|
[81] | 269 | $html .= "</tr>"; |
---|
[94] | 270 | |
---|
[70] | 271 | $html .= "</table>"; |
---|
| 272 | } |
---|
| 273 | else |
---|
| 274 | $html .= "<div class=block-header>No ship details</div>"; |
---|
| 275 | |
---|
| 276 | $html .= "</td></tr></table>"; |
---|
| 277 | |
---|
[107] | 278 | $menubox = new box("Menu"); |
---|
| 279 | $menubox->setIcon("menu-item.gif"); |
---|
| 280 | $menubox->addOption("Caption","View"); |
---|
| 281 | $menubox->addOption("link","Killmail", "javascript:openWindow( '?a=kill_mail&kll_id=".$kill->getID()."', null, 355, 430, '' );"); |
---|
[70] | 282 | if ($kill->relatedKillCount() > 1 || $kill->relatedLossCount() > 1) |
---|
| 283 | { |
---|
[107] | 284 | $menubox->addOption("link","Related kills (".$kill->relatedKillCount()."/".$kill->relatedLossCount().")", "?a=kill_related&kll_id=".$kill->getID()); |
---|
[70] | 285 | } |
---|
| 286 | if ($page->isAdmin()) |
---|
| 287 | { |
---|
[107] | 288 | $menubox->addOption("caption","Admin"); |
---|
| 289 | $menubox->addOption("link","Delete", "javascript:openWindow('?a=kill_delete&kll_id=".$kill->getID()."', null, 420, 300, '' );"); |
---|
[70] | 290 | } |
---|
| 291 | $page->addContext($menubox->generate()); |
---|
| 292 | |
---|
| 293 | if ($config->getKillPoints()) |
---|
| 294 | { |
---|
| 295 | $scorebox = new Box("Points awarded"); |
---|
[107] | 296 | $scorebox->addOption("points",$kill->getKillPoints()); |
---|
[70] | 297 | $page->addContext($scorebox->generate()); |
---|
| 298 | } |
---|
| 299 | |
---|
| 300 | $mapbox = new Box("Map"); |
---|
[107] | 301 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=map&size=145"); |
---|
| 302 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=region&size=145"); |
---|
| 303 | $mapbox->addOption("img","?a=mapview&sys_id=".$system->getID()."&mode=cons&size=145"); |
---|
| 304 | |
---|
[70] | 305 | $page->addContext($mapbox->generate()); |
---|
| 306 | |
---|
| 307 | $page->setContent($html); |
---|
| 308 | $page->generate(); |
---|
| 309 | ?> |
---|