/** * Delete a Kill and remove its value from the summary. * * @param Kill $kill */ public static function delKill($kill) { $year = date('Y', strtotime($kill->getTimestamp())); $month = date('m', strtotime($kill->getTimestamp())); $shipid = $kill->getVictimShip()->getClass()->getID(); $killisk = $kill->getISKLoss(); $killloot = $kill->getISKLoot(); $points = $kill->getKillPoints(); $alls = array(); $qry = DBFactory::getDBQuery(); $sql = "UPDATE kb3_sum_alliance SET asm_loss_count = asm_loss_count - 1, " . " asm_loss_isk = asm_loss_isk-" . $killisk . " ,asm_loss_loot = asm_loss_loot-" . $killloot . " ,asm_loss_points = asm_loss_points-" . $points . " WHERE asm_all_id = " . $kill->getVictimAllianceID() . " AND asm_shp_id = {$shipid} AND asm_monthday = {$month} AND asm_year = {$year}"; $qry->execute($sql); $solo = true; $alls[$kill->getVictimAllianceID()] = 1; foreach ($kill->getInvolved() as $inv) { if (isset($alls[$inv->getAllianceID()])) { continue; } $alls[$inv->getAllianceID()] = 1; $solo = false; $sql = "UPDATE kb3_sum_alliance SET asm_kill_count = asm_kill_count - 1, " . " asm_kill_isk = asm_kill_isk - " . $killisk . " ,asm_kill_loot = asm_kill_loot - " . $killloot . " ,asm_kill_points = asm_kill_points - " . $points . " WHERE asm_all_id = " . $inv->getAllianceID() . " AND asm_shp_id = {$shipid} AND asm_monthday = {$month} AND asm_year = {$year}"; $qry->execute($sql); } if ($solo) { $sql = "UPDATE kb3_sum_alliance SET asm_kill_count=asm_kill_count-1, asm_kill_isk=asm_kill_isk-{$killisk}, asm_kill_loot=asm_kill_loot-{$killloot}, asm_kill_points=asm_kill_points-{$points} WHERE " . " asm_all_id = " . $kill->getVictimAllianceID() . " AND asm_shp_id = {$shipid} AND asm_monthday = {$month} AND asm_year = {$year}"; $qry->execute($sql); } }
/** * Delete a Kill and remove its value from the summary. * * @param Kill $kill */ public static function delKill($kill) { $year = date('Y', strtotime($kill->getTimestamp())); $month = date('m', strtotime($kill->getTimestamp())); $shipid = $kill->getVictimShip()->getClass()->getID(); $killisk = $kill->getISKLoss(); $killloot = $kill->getISKLoot(); $points = $kill->getKillPoints(); $alls = array(); $qry = DBFactory::getDBQuery(); $sql = "UPDATE kb3_sum_pilot SET psm_loss_count = psm_loss_count - 1, " . " psm_loss_isk = psm_loss_isk-" . $killisk . " ,psm_loss_loot = psm_loss_loot-" . $killloot . " ,psm_loss_points = psm_loss_points-" . $points . " WHERE psm_plt_id = " . $kill->getVictimID() . " AND psm_shp_id = {$shipid} AND psm_monthday = {$month} AND psm_year = {$year}"; $qry->execute($sql); $sql = "UPDATE kb3_pilots SET plt_lpoints = plt_lpoints - " . $kill->getKillPoints() . " WHERE plt_id = " . $kill->getVictimID(); $qry->execute($sql); foreach ($kill->getInvolved() as $inv) { if (isset($alls[$inv->getPilotID()])) { continue; } $alls[$inv->getPilotID()] = 1; $sql = "UPDATE kb3_sum_pilot SET psm_kill_count = psm_kill_count - 1, " . " psm_kill_isk = psm_kill_isk - " . $killisk . " ,psm_kill_loot = psm_kill_loot - " . $killloot . " ,psm_kill_points = psm_kill_points - " . $points . " WHERE psm_plt_id = " . $inv->getPilotID() . " AND psm_shp_id = {$shipid} AND psm_monthday = {$month} AND psm_year = {$year}"; $qry->execute($sql); $sql = "UPDATE kb3_pilots SET plt_kpoints = plt_kpoints - " . $kill->getKillPoints() . " WHERE plt_id = " . $inv->getPilotID(); $qry->execute($sql); } }