Example #1
0
 public function getInvolved()
 {
     $this->victimAll = array();
     $this->invAll = array();
     $this->victimCorp = array();
     $this->invCorp = array();
     // Find all involved parties not in the same corp/alliance as the victim. If
     // the board has an owner swap sides if necessary so board owner is the killer
     foreach ($this->kill->getInvolved() as $inv) {
         if (strcasecmp($inv->getAlliance()->getName(), 'None')) {
             if ($inv->getAllianceID() != $this->kill->getVictimAllianceID()) {
                 $this->invAll[$inv->getAllianceID()] = $inv->getAllianceID();
             }
         } elseif ($inv->getCorpID() != $this->kill->getVictimCorpID()) {
             $this->invCorp[$inv->getCorpID()] = $inv->getCorpID();
         }
     }
     if (strcasecmp($this->kill->getVictimAllianceName(), 'None')) {
         $this->victimAll[$this->kill->getVictimAllianceID()] = $this->kill->getVictimAllianceID();
     } else {
         $this->victimCorp[$this->kill->getVictimCorpID()] = $this->kill->getVictimCorpID();
     }
     // Check which side board owner is on and make that the kill side. The other
     // side is the loss side. If board owner is on neither then victim is the loss
     // side.
     if (in_array($this->kill->getVictimAllianceID(), config::get('cfg_allianceid')) || in_array($this->kill->getVictimCorpID(), config::get('cfg_corpid'))) {
         $tmp = $this->victimAll;
         $this->victimAll = $this->invAll;
         $this->invAll = $tmp;
         $tmp = $this->victimCorp;
         $this->victimCorp = $this->invCorp;
         $this->invCorp = $tmp;
     }
 }
/**
 *
 * @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;
    }
}