Example #1
0
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  *
  */
 function start()
 {
     $this->page = new Page('Related kills & losses');
     $this->page->addHeader('<meta name="robots" content="index, nofollow" />');
     $this->kll_id = (int) edkURI::getArg('kll_id', 1);
     if (!$this->kll_id) {
         $this->kll_external_id = (int) edkURI::getArg('kll_ext_id');
         if (!$this->kll_external_id) {
             // internal and external ids easily overlap so we can't guess which
             $this->kll_id = (int) edkURI::getArg(null, 1);
             $this->kill = Kill::getByID($this->kll_id);
         } else {
             $this->kill = new Kill($this->kll_external_id, true);
             $this->kll_id = $this->kill->getID();
         }
     } else {
         $this->kill = Kill::getByID($this->kll_id);
     }
     $this->adjacent = edkURI::getArg('adjacent');
     $this->scl_id = (int) edkURI::getArg('scl_id');
     $this->menuOptions = array();
     if (!$this->kll_id || !$this->kill->exists()) {
         echo 'No valid kill id specified';
         exit;
     }
     if ($this->kill->isClassified()) {
         Header("Location: " . htmlspecialchars_decode(edkURI::page('kill_detail', $this->kll_id, 'kll_id')));
         die;
     }
     //		$this->getInvolved();
     //		$this->buildStats();
 }
 /**
  * Start constructing the page.
  * Prepare all the shared variables such as dates and check alliance ID.
  *
  */
 function start()
 {
     // set some directory paths for this mod first
     $this->modDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     $this->includeDir = $this->modDir . 'include' . DIRECTORY_SEPARATOR;
     $this->cssDir = config::get("cfg_kbhost") . '/mods/' . basename(dirname(__FILE__)) . '/css/';
     $this->templateDir = $this->modDir . 'template' . DIRECTORY_SEPARATOR;
     $this->jsDir = config::get("cfg_kbhost") . '/mods/' . basename(dirname(__FILE__)) . '/js/';
     $this->imgDir = config::get("cfg_kbhost") . '/mods/' . basename(dirname(__FILE__)) . '/img/';
     $this->page = new Page('Related kills & losses');
     $this->page->addHeader('<meta name="robots" content="index, nofollow" />');
     $this->isFixed = FALSE;
     $this->kll_id = (int) edkURI::getArg('kll_id', 1);
     if (!$this->kll_id) {
         $this->kll_external_id = (int) edkURI::getArg('kll_ext_id');
         if (!$this->kll_external_id) {
             // internal and external ids easily overlap so we can't guess which
             $this->kll_id = (int) edkURI::getArg(null, 1);
             $this->kill = Kill::getByID($this->kll_id);
         } else {
             $this->kill = new Kill($this->kll_external_id, true);
             $this->kll_id = $this->kill->getID();
         }
     } else {
         $this->kill = Kill::getByID($this->kll_id);
     }
     // read url parameters
     $this->adjacent = (bool) edkURI::getArg('adjacent');
     $this->scl_id = (int) edkURI::getArg('scl_id');
     $this->displayingBattle = (bool) edkURI::getArg('battle');
     $this->menuOptions = array();
     if (!$this->kll_id || !$this->kill->exists()) {
         echo 'No valid kill id specified';
         exit;
     }
     if ($this->kill->isClassified()) {
         Header("Location: " . KB_HOST . "/?a=kill_detail&kll_id=" . $this->kll_id);
         die;
     }
     // set javascript headers
     $this->page->addHeader("<link rel=\"stylesheet\" href=\"" . $this->cssDir . "tabber.css\" TYPE=\"text/css\" MEDIA=\"screen\">");
     $this->page->addHeader("<script type=\"text/javascript\">var fleetBattlesLoadingImage = '" . $this->imgDir . "loading.gif';</script>");
     $this->page->addHeader("<script type=\"text/javascript\" src=\"" . $this->jsDir . "entity.js\"></script>");
     $this->page->addHeader("<script type=\"text/javascript\" src=\"" . $this->jsDir . "fleetBattles.js\"></script>");
     $this->page->addHeader("<script type=\"text/javascript\" src=\"" . $this->jsDir . "tabber.js\"></script>");
     $this->page->addHeader('<link rel="stylesheet" type="text/css" href="' . $this->cssDir . 'style.css">');
     // include helpers
     include_once $this->includeDir . "class.helpers.php";
 }
/**
 *
 * @global array $destroyed
 * @global <type> $pilots
 * @global array $pods
 * @param Kill $kill
 * @param <type> $side
 * @return <type>
 */
function handle_destroyed($kill, $side, &$destroyed, &$pilots, $sideAssignmentMap = array(), $completeInformation = FALSE)
{
    // -------------------------------------------------------------------------
    // FIX BATTLE REPORT a little by Evoke. Salvoxia
    // BEGIN
    // -------------------------------------------------------------------------
    // we don't want losses of our own corp/ally as losses on the enemy's side
    if ($side == 'e') {
        if (config::get('cfg_corpid')) {
            $corpId = config::get('cfg_corpid');
            $corpId = $corpId[0];
            if ($kill->getVictimCorpID() == $corpId) {
                return;
            }
        } elseif (config::get('cfg_allianceid')) {
            $allianceId = config::get('cfg_allianceid');
            $allianceId = $allianceId[0];
            if ($kill->getVictimAllianceID() == $allianceId) {
                return;
            }
        }
    }
    // -------------------------------------------------------------------------
    // FIX BATTLE REPORT a little by Evoke. Salvoxia
    // END
    // -------------------------------------------------------------------------
    if ($completeInformation && !is_null($destroyed) && is_array($destroyed)) {
        $destroyed[$kill->getID()] = $kill->getVictimID();
    }
    if (config::get('fleet_battles_mod_sideassign')) {
        // determine whether the pilot is member of an alliance
        if ($kill->getVictimAllianceName() == "None") {
            $entityType = "corp";
            $entityId = $kill->getVictimCorpID();
        } else {
            $entityType = "alliance";
            $entityId = $kill->getVictimAllianceID();
        }
        if (isset($sideAssignmentMap[$entityType][$entityId])) {
            $pilotSide = $sideAssignmentMap[$entityType][$entityId];
        } else {
            $pilotSide = $side;
        }
    } else {
        $pilotSide = $side;
    }
    $ship = Ship::lookup($kill->getVictimShipName());
    $shipc = $ship->getClass();
    $ts = strtotime($kill->getTimeStamp());
    // mark the pilot as podded
    if ($shipc->getID() == 18 || $shipc->getID() == 2) {
        // increase the timestamp of a podkill by 1 so its after the shipkill
        $ts++;
    }
    // search for ships with the same id
    if (isset($pilots[$pilotSide][$kill->getVictimId()]) && is_array($pilots[$pilotSide][$kill->getVictimId()])) {
        foreach ($pilots[$pilotSide][$kill->getVictimId()] as $id => $_ship) {
            if ($ship->getID() == $_ship['sid']) {
                $pilots[$pilotSide][$kill->getVictimId()][$id]['destroyed'] = true;
                if (!isset($pilots[$pilotSide][$kill->getVictimId()][$id]['kll_id'])) {
                    $pilots[$pilotSide][$kill->getVictimId()][$id]['kll_id'] = $kill->getID();
                    $pilots[$pilotSide][$kill->getVictimId()][$id]['kll_url'] = edkURI::page('kill_detail', $kill->getID(), "kll_id");
                }
                //$pilots[$side][$kill->getVictimId()][0]["times"] +=1;
                return;
            }
        }
    }
    if ($completeInformation) {
        $pilots[$pilotSide][$kill->getVictimId()][] = array('name' => $kill->getVictimName(), 'plt_url' => edkURI::page("pilot_detail", $kill->getVictimID(), "plt_id"), 'kll_id' => $kill->getID(), 'kll_url' => edkURI::page('kill_detail', $kill->getID(), "kll_id"), 'spic' => imageURL::getURL('Ship', $ship->getID(), 32), 'scl' => $shipc->getPoints(), 'destroyed' => true, 'corp' => $kill->getVictimCorpName(), 'alliance' => $kill->getVictimAllianceName(), 'aid' => $kill->getVictimAllianceID(), 'alliance_url' => edkURI::page("alliance_detail", $kill->getVictimAllianceID(), "all_id"), 'ship' => $kill->getVictimShipname(), 'shipClass' => $shipc->getName(), 'shipClassObject' => $shipc, 'sid' => $ship->getID(), 'cid' => $kill->getVictimCorpID(), 'crp_url' => edkURI::page("corp_detail", $kill->getVictimCorpID(), "crp_id"), 'ts' => $ts, 'times' => 0, 'color' => getColorClassByClass($shipc));
    } else {
        $pilots[$pilotSide][$kill->getVictimId()] = 1;
    }
}