/** * Build a new summary table for a pilot. * * @param integer $plt_id * @return boolean Returns false on error. */ private static function buildSummary($plt_id) { $plt_id = (int) $plt_id; if (!$plt_id) { return false; } $qry = DBFactory::getDBQuery(); $qry->autocommit(false); $klist = new KillList(); $klist->addInvolvedPilot($plt_id); $klist->getAllKills(); $kpoints = $klist->getPoints(); unset($klist); $llist = new KillList(); $llist->addVictimPilot($plt_id); $llist->getAllKills(); $lpoints = $llist->getPoints(); unset($llist); $qry->execute("UPDATE kb3_pilots SET plt_kpoints = {$kpoints},\n\t\t\t plt_lpoints = {$lpoints} WHERE plt_id = {$plt_id}"); $qry->autocommit(true); return; }
*/ define('MPATH', dirname(__FILE__) . "/"); $im = imagecreatefrompng(MPATH . 'default.png'); $red = imagecolorallocate($im, 255, 10, 10); $orange = imagecolorallocate($im, 150, 120, 20); $blue = imagecolorallocate($im, 0, 0, 200); $white = imagecolorallocate($im, 255, 255, 255); $black = imagecolorallocate($im, 0, 0, 0); $grey_trans = imagecolorallocatealpha($im, 50, 50, 50, 50); $greyred_trans = imagecolorallocatealpha($im, 50, 10, 10, 50); $name = $pilot->getName(); $list = new KillList(); $list->setOrdered(true); $list->setLimit(1); $list->setPodsNoobships(false); $list->addInvolvedPilot($pilot); $kill = $list->getKill(); // corp $box = imagettfbbox(10, 0, MPATH . 'GUNSHIP2.TTF', $corp->getName()); $width = $box[4]; imagettftext($im, 10, 0, 319 - $width, 71, $black, MPATH . 'GUNSHIP2.TTF', $corp->getName()); imagettftext($im, 10, 0, 318 - $width, 70, $red, MPATH . 'GUNSHIP2.TTF', $corp->getName()); // player $box = imagettfbbox(16, 0, MPATH . 'GUNSHIP2.TTF', $name); $width = $box[4]; imagettftext($im, 16, 0, 319 - $width, 91, $black, MPATH . 'GUNSHIP2.TTF', $name); imagettftext($im, 16, 0, 318 - $width, 90, $red, MPATH . 'GUNSHIP2.TTF', $name); // time, victim, victim corp and ship killed imagettftext($im, 11, 0, 39, 16, $black, MPATH . 'spaceage.ttf', $kill->getTimeStamp()); imagettftext($im, 11, 0, 38, 15, $white, MPATH . 'spaceage.ttf', $kill->getTimeStamp()); imagettftext($im, 11, 0, 39, 26, $black, MPATH . 'spaceage.ttf', $kill->getVictimName());
/** * Return the html for the known members of this corp. * @param pCorpDetail $home * @return string */ public static function view($home) { if (config::get('mod_knownmembers_own')) { if (array_search($home->alliance->getID(), config::get('cfg_allianceid')) !== false) { $can_view = 1; } else { if (array_search($home->crp_id, config::get('cfg_corpid')) !== false) { $can_view = 1; } } } if ($can_view == 1) { $html .= "Cannot View this corps Member List"; } else { $query = "SELECT * FROM `kb3_pilots` WHERE plt_crp_id =" . $home->crp_id . " ORDER BY `plt_name` ASC"; $qry = DBFactory::getDBQuery(); $qry->execute($query); $cnt = $qry->recordCount(); $html .= "<div class=block-header2>Known Pilots (" . $cnt . ")</div>"; $html .= "<table class=kb-table align=center>"; $html .= '<tr class=kb-table-header>'; if (config::get('mod_knownmembers_img')) { $html .= '<td class=kb-table-header align="center"></td>'; } $html .= '<td class=kb-table-header align="center">Pilot</td>'; if (config::get('mod_knownmembers_kllpnts')) { $html .= '<td class=kb-table-header align="center">Kill Points</td>'; } if (config::get('mod_knownmembers_dmgdn')) { $html .= '<td class=kb-table-header align="center">Dmg Done (isk)</td>'; } if (config::get('mod_knownmembers_dmgrcv')) { $html .= '<td class=kb-table-header align="center">Dmg Received (isk)</td>'; } if (config::get('mod_knownmembers_eff')) { $html .= '<td class=kb-table-header align="center">Efficiency</td>'; } if ($home->page->isAdmin()) { $html .= '<td class=kb-table-header align="center">Admin - Move</td>'; } $html .= '</tr>'; while ($data = $qry->getRow()) { $pilot = new Pilot($data['plt_id']); $plist = new KillList(); $plist->addInvolvedPilot($pilot); $plist->getAllKills(); $points = $plist->getPoints(); $pllist = new KillList(); $pllist->addVictimPilot($pilot); $pllist->getAllKills(); $plistisk = $plist->getISK(); $pllistisk = $pllist->getISK(); if ($plistisk == 0) { $plistisk = 1; //Remove divide by 0 } if ($pllistisk == 0) { $pllistisk = 1; //Remove divide by 0 } $efficiency = round($plistisk / ($plistisk + $pllistisk) * 100, 2); if (!$odd) { $odd = true; $class = 'kb-table-row-odd'; } else { $odd = false; $class = 'kb-table-row-even'; } $html .= "<tr class=" . $class . " style=\"height: 32px;\">"; if (config::get('mod_knownmembers_img')) { $html .= '<td width="64" align="center"><img src=' . $pilot->getPortraitURL(32) . '></td>'; } $html .= '<td align="center"><a href=?a=pilot_detail&plt_id=' . $pilot->getID() . '>' . $pilot->getName() . '</a></td>'; if (config::get('mod_knownmembers_kllpnts')) { $html .= '<td align="center">' . $points . '</td>'; } if (config::get('mod_knownmembers_dmgdn')) { $html .= '<td align="center">' . round($plist->getISK(), 2) / 1000000 . 'M</td>'; } if (config::get('mod_knownmembers_dmgrcv')) { $html .= '<td align="center">' . round($pllist->getISK(), 2) / 1000000 . 'M</td>'; } if (config::get('mod_knownmembers_eff')) { $html .= '<td align="center">' . $efficiency . '%</td>'; } if ($home->page->isAdmin()) { $html .= "<td align=center><a href=\"javascript:openWindow('?a=admin_move_pilot&plt_id=" . $data['plt_id'] . "', null, 500, 500, '' )\">Move</a></td>"; } $html .= '</tr>'; } $html .= '</table>'; } return $html; }
$llist = new KillList(); $tmp = explode(',', $string); foreach ($tmp as $item) { if (!$item) { continue; } $typ = substr($item, 0, 1); $id = substr($item, 1); if ($typ == 'a') { $klist->addInvolvedAlliance(new Alliance($id)); $llist->addVictimAlliance(new Alliance($id)); } elseif ($typ == 'c') { $klist->addInvolvedCorp(new Corporation($id)); $llist->addVictimCorp(new Corporation($id)); } elseif ($typ == 'p') { $klist->addInvolvedPilot(new Pilot($id)); $llist->addVictimPilot(new Pilot($id)); } } $kills = array(); while ($kill = $klist->getKill()) { $kills[$kill->getID()] = $kill->getTimestamp(); } while ($kill = $llist->getKill()) { $kills[$kill->getID()] = $kill->getTimestamp(); } asort($kills); $cnt = 0; foreach ($kills as $id => $timestamp) { $kill = new Kill($id); $cnt++;
/** * Build the killlists that are needed for the options selected. */ function killList() { global $smarty; if (isset($this->viewList[$this->view])) { return call_user_func_array($this->viewList[$this->view], array(&$this)); } $scl_id = (int) edkURI::getArg('scl_id'); switch ($this->view) { case "kills": $list = new KillList(); $list->setOrdered(true); $list->addInvolvedPilot($this->pilot); if ($scl_id) { $list->addVictimShipClass($scl_id); } $list->setPageSplit(config::get('killcount')); $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount')); $table = new KillListTable($list); $smarty->assign('splitter', $pagesplitter->generate()); $smarty->assign('kills', $table->generate()); return $smarty->fetch(get_tpl('detail_kl_kills')); break; case "losses": $list = new KillList(); $list->setOrdered(true); $list->addVictimPilot($this->pilot); if ($scl_id) { $list->addVictimShipClass($scl_id); } else { $list->setPodsNoobships(config::get('podnoobs')); } $list->setPageSplit(config::get('killcount')); $pagesplitter = new PageSplitter($list->getCount(), config::get('killcount')); $table = new KillListTable($list); $smarty->assign('splitter', $pagesplitter->generate()); $smarty->assign('losses', $table->generate()); return $smarty->fetch(get_tpl('detail_kl_losses')); break; case "ships_weapons": $shiplist = new TopList_Ship(); $shiplist->addInvolvedPilot($this->pilot); $shiplisttable = new TopTable_Ship($shiplist); $smarty->assign('ships', $shiplisttable->generate()); $weaponlist = new TopList_Weapon(); $weaponlist->addInvolvedPilot($this->pilot); $weaponlisttable = new TopTable_Weapon($weaponlist); $smarty->assign('weapons', $weaponlisttable->generate()); return $smarty->fetch(get_tpl('detail_kl_ships_weapons')); break; case 'history': $pltsum = new pilotSummary($this->plt_id); $smarty->assign('title', Language::get('history')); $smarty->assign('summary', $pltsum->getMonthlySummary()); return $smarty->fetch(get_tpl('detail_history')); break; default: $list = new KillList(); $list->setOrdered(true); if (config::get('comments_count')) { $list->setCountComments(true); } if (config::get('killlist_involved')) { $list->setCountInvolved(true); } $list->setLimit(10); $list->addInvolvedPilot($this->pilot); if ($scl_id) { $list->addVictimShipClass($scl_id); } else { $list->setPodsNoobships(config::get('podnoobs')); } $table = new KillListTable($list); $smarty->assign('kills', $table->generate()); $list = new KillList(); $list->setOrdered(true); if (config::get('comments_count')) { $list->setCountComments(true); } if (config::get('killlist_involved')) { $list->setCountInvolved(true); } $list->setLimit(10); $list->addVictimPilot($this->pilot); if ($scl_id) { $list->addVictimShipClass($scl_id); } else { $list->setPodsNoobships(config::get('podnoobs')); } $table = new KillListTable($list); $smarty->assign('losses', $table->generate()); return $smarty->fetch(get_tpl('detail_kl_default')); break; } return $html; }