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; } }
/** * Update the summary table when a kill value changes. * * @param Kill $kill * @param float $difference */ public static function update($kill, $difference) { $year = date('Y', strtotime($kill->getTimestamp())); $month = date('m', strtotime($kill->getTimestamp())); $shipid = $kill->getVictimShip()->getClass()->getID(); $difference = (double) $difference; $alls = array(); $qry = DBFactory::getDBQuery(); $sql = "UPDATE kb3_sum_alliance SET asm_loss_isk = asm_loss_isk + " . $difference . " WHERE asm_all_id = " . $kill->getVictimAllianceID() . " AND asm_shp_id = " . $shipid; $qry->execute($sql); foreach ($kill->getInvolved() as $inv) { if (isset($alls[$inv->getAllianceID()])) { continue; } $alls[$inv->getAllianceID()] = 1; $qry->execute("SELECT 1 FROM kb3_sum_alliance WHERE asm_all_id = " . $inv->getAllianceID()); if (!$qry->recordCount()) { continue; } $sql = "UPDATE kb3_sum_alliance SET asm_kill_isk = asm_kill_isk + " . $difference . " WHERE asm_all_id = " . $inv->getAllianceID() . " AND asm_shp_id = " . $shipid; $qry->execute($sql); } }
/** * Update the summary table when a kill value changes. * * @param Kill $kill * @param float $difference */ public static function update($kill, $difference) { $difference = (double) $difference; $alls = array(); $qry = DBFactory::getDBQuery(); $qry->execute("SELECT 1 FROM kb3_sum_pilot WHERE psm_plt_id = " . $kill->getVictimID()); // No summary table to remove kill from so skip. if ($qry->recordCount()) { $sql = "UPDATE kb3_sum_pilot SET psm_loss_isk = psm_loss_isk - " . $difference . " WHERE psm_plt_id = " . $kill->getVictimID() . " AND psm_shp_id = " . $kill->getVictimShip()->getClass()->getID(); $qry->execute($sql); } foreach ($kill->getInvolved() as $inv) { if ($alls[$inv->getPilotID()]) { continue; } $alls[$inv->getPilotID()] = 1; $qry->execute("SELECT 1 FROM kb3_sum_pilot WHERE psm_plt_id = " . $inv->getPilotID()); if (!$qry->recordCount()) { continue; } $sql = "UPDATE kb3_sum_pilot SET psm_kill_isk = psm_kill_isk - " . $difference . " WHERE psm_plt_id = " . $inv->getPilotID() . " AND psm_shp_id = " . $kill->getVictimShip()->getClass()->getID(); $qry->execute($sql); } }