/** * Calculate the current cost of a ship loss excluding blueprints. * @param boolean $update set true to update all-time summaries. * @return float */ function calculateISKLoss($update = true) { $value = 0; foreach ($this->destroyeditems_ as $itd) { $item = $itd->getItem(); if (strpos($item->getName(), "Blueprint") === FALSE) { $value += $itd->getValue() * $itd->getQuantity(); } } if (config::get('kd_droptototal')) { foreach ($this->droppeditems_ as $itd) { $item = $itd->getItem(); if (strpos($item->getName(), "Blueprint") === FALSE) { $value += $itd->getValue() * $itd->getQuantity(); } } } $value += $this->victimship->getPrice(); if ($update) { $qry = DBFactory::getDBQuery(); $qry->execute("UPDATE kb3_kills SET kll_isk_loss = '{$value}' WHERE\n\t\t\t\tkll_id = '" . $this->id . "'"); if ($this->iskloss) { summaryCache::update($this, $value - $this->iskloss); } } $this->iskloss = $value; return $value; }
function remove($delcomments = true, $permanent = true) { if (!$this->id) { return; } $qry = DBFactory::getDBQuery(); $qry->autocommit(false); event::call('killmail_delete', $this); summaryCache::delKill($this); $qry->execute("delete from kb3_inv_detail where ind_kll_id = " . $this->id); $qry->execute("delete from kb3_inv_all where ina_kll_id = " . $this->id); $qry->execute("delete from kb3_inv_crp where inc_kll_id = " . $this->id); $qry->execute("delete from kb3_items_destroyed where itd_kll_id = " . $this->id); $qry->execute("delete from kb3_items_dropped where itd_kll_id = " . $this->id); // Don't remove comments when readding a kill if ($delcomments) { $qry->execute("delete from kb3_comments where kll_id = " . $this->id); if ($permanent) { //this uses the trust field for a different purpose: to prevent reposts of deleted kills $qry->execute("UPDATE kb3_mails SET kll_trust = -1, kll_modified_time = UTC_TIMESTAMP() WHERE kll_id = " . $this->id); } else { $qry->execute("DELETE FROM kb3_mails WHERE kll_id = " . $this->id); } } $qry->execute("delete from kb3_kills where kll_id = " . $this->id); $qry->autocommit(true); $this->valid = false; Cacheable::delCache($this); }