function display_log($entries, $name) { global $Db; $output = "<table class=\"fancy {$name}\" style=\"font-size:80%\">"; $output .= "<tr><th colspan=7 style=\"font-size:120%\">{$name}</th></tr>"; $output .= "<tr><th>date</th><th>destroyed</th><th>victim</th>"; if (CORP_MODE) { $output .= "<th>final blow</th>"; } $output .= "<th>system</th><th>corp</th><th>alliance</th><th>#P</th></tr>"; $alt = " class=\"main\""; foreach ($entries as $kill) { if ($alt == " class=\"main\"") { $alt = " class=\"alt\""; } else { $alt = " class=\"main\""; } $output .= "<tr style=\"cursor: pointer;\" {$alt} onclick=\"document.location='" . FULL_URL . "&view=kills&kill=" . $kill["killID"] . "';\">"; $output .= "<th scope=\"row\">" . force_nowrap($kill['killTime']) . "</th>"; $output .= "<td>" . force_nowrap($Db->getNameFromTypeId((int) $kill->victim['shipTypeID'])) . "</td>"; $output .= "<td>" . force_nowrap(getcharname($kill)) . "</td>"; if (CORP_MODE) { $killer = $kill->xpath("/eveapi/result/rowset[@name='kills']/row[@killID=" . $kill["killID"] . "]/rowset[@name='attackers']/row[@finalBlow=1]"); if ((string) $killer[0]["characterName"] == "") { $killer = $Db->getNameFromTypeId((int) $killer[0]['shipTypeID']); } else { $killer = (string) $killer[0]["characterName"]; } $output .= "<td>" . force_nowrap($killer) . "</td>"; } $output .= "<td>" . force_nowrap($Db->getNameFromSystemId((int) $kill['solarSystemID'])) . "</td>"; $output .= "<td>" . force_nowrap($kill->victim['corporationName']) . "</td>"; $output .= "<td>" . force_nowrap($kill->victim['allianceName']) . "</td>"; $output .= "<td>" . count($kill->xpath("/eveapi/result/rowset[@name='kills']/row[@killID='" . $kill['killID'] . "']/rowset[@name='attackers']/*")) . "</td>"; $output .= "</tr>\n"; } $output .= "</table>\n"; return $output; }
function generate_kill($kill) { global $Db; @($oldTz = date_default_timezone_get()); date_default_timezone_set("UTC"); $killtime = strtotime((string) $kill["killTime"]); /*print_r($kill); die();*/ if ($oldTz) { date_default_timezone_set($oldTz); } $ret = ""; $ret .= date("Y.m.d H:i", $killtime) . "\n"; $ret .= "\n"; $ret .= "Victim: " . getcharname($kill) . "\n"; $ret .= "Corp: " . $kill->victim["corporationName"] . "\n"; $ret .= "Alliance: " . ($kill->victim["allianceName"] == "" ? "NONE" : $kill->victim["allianceName"]) . "\n"; $ret .= "Faction: " . ($kill->victim["factionName"] == "" ? "NONE" : $kill->victim["factionName"]) . "\n"; $ret .= "Destroyed: " . $Db->getNameFromTypeId((int) $kill->victim['shipTypeID']) . "\n"; $ret .= "System: " . $Db->getNameFromSystemId((int) $kill['solarSystemID']) . "\n"; $ret .= "Security: " . $Db->getSystemSecurity((int) $kill['solarSystemID']) . "\n"; $dmgtot = 0; $attackers = array(); $dmg = array(); foreach ($kill->rowset[0]->row as $attacker) { if ((int) $attacker["characterID"] == 0) { $attckr = "Name: " . ($attacker["shipTypeID"] != 0 ? $Db->getNameFromTypeId((int) $attacker['shipTypeID']) : "Unknown") . " / " . $attacker["corporationName"] . ($attacker["finalBlow"] == 1 ? " (laid the final blow)" : "") . "\n"; $attckr .= "Damage Done: " . $attacker["damageDone"] . "\n"; } else { $attckr = "Name: " . $attacker["characterName"] . ($attacker["finalBlow"] == 1 ? " (laid the final blow)" : "") . "\n"; $attckr .= "Security: " . number_format((double) $attacker["securityStatus"], 1) . "\n"; $attckr .= "Corp: " . $attacker["corporationName"] . "\n"; $attckr .= "Alliance: " . ($attacker["allianceName"] == "" ? "NONE" : $attacker["allianceName"]) . "\n"; $attckr .= "Faction: " . ($attacker["factionName"] == "" ? "NONE" : $attacker["factionName"]) . "\n"; $attckr .= "Ship: " . ($attacker["shipTypeID"] != 0 ? $Db->getNameFromTypeId((int) $attacker['shipTypeID']) : "Unknown") . "\n"; $attckr .= "Weapon: " . ($attacker["weaponTypeID"] != 0 ? $Db->getNameFromTypeId((int) $attacker['weaponTypeID']) : "Unknown") . "\n"; $attckr .= "Damage Done: " . $attacker["damageDone"] . "\n"; } $attckr .= "\n"; $key = (string) $attacker["characterID"] . (string) $attacker["shipTypeID"] . (string) $attacker["corporationID"]; $attackers[$key] = $attckr; $dmg[$key] = (int) $attacker["damageDone"]; $dmgtot += (int) $attacker["damageDone"]; } $ret .= "Damage Taken: {$dmgtot}\n"; $ret .= "\nInvolved parties:\n\n"; arsort($dmg); foreach ($dmg as $attacker => $d) { $ret .= $attackers[$attacker]; } $dropped = ""; $destroyed = ""; $flags = array(5 => "Cargo", 87 => "Drone Bay", 89 => "Installed Implant"); foreach ($kill->rowset[1]->row as $item) { $qDropped = (int) $item["qtyDropped"]; $qDestryd = (int) $item["qtyDestroyed"]; $type = $Db->getNameFromTypeId((int) $item['typeID']); if (strpos($type, " Blueprint") !== false) { if (isset($item["singleton"]) && (int) $item["singleton"] == 2) { // Value is 2 if the item is a blueprint copy, 0 for all other items, including blueprint originals. $type .= " (Copy)"; } else { $type .= " (Original)"; } } $flag = (int) $item['flag']; if ($qDropped > 0) { $dropped .= $type; if ($qDropped > 1) { $dropped .= ", Qty: {$qDropped}"; } if (isset($flags[$flag])) { $dropped .= " (" . $flags[$flag] . ")"; } $dropped .= "\n"; } if ($qDestryd > 0) { $destroyed .= $type; if ($qDestryd > 1) { $destroyed .= ", Qty: {$qDestryd}"; } if (isset($flags[$flag])) { $destroyed .= " (" . $flags[$flag] . ")"; } $destroyed .= "\n"; } if ($item->rowset) { foreach ($item->rowset->row as $item) { $qDropped = (int) $item["qtyDropped"]; $qDestryd = (int) $item["qtyDestroyed"]; $type = $Db->getNameFromTypeId((int) $item['typeID']); if ($qDropped > 0) { $dropped .= $type . ($qDropped > 1 ? ", Qty: {$qDropped}" : "") . " (In Container)\n"; } if ($qDestryd > 0) { $destroyed .= $type . ($qDestryd > 1 ? ", Qty: {$qDestryd}" : "") . " (In Container)\n"; } } } } if ($destroyed != "") { $ret .= "Destroyed items:\n\n{$destroyed}\n"; } if ($dropped != "") { $ret .= "Dropped items:\n\n{$dropped}\n"; } return $ret; }