Example #1
0
 /**
  * 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);
     }
 }
 /**
  * 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);
     }
 }
Example #3
0
 /**
  * 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_corp SET csm_loss_count = csm_loss_count - 1, " . " csm_loss_isk = csm_loss_isk-" . $killisk . " ,csm_loss_loot = csm_loss_loot-" . $killloot . " ,csm_loss_points = csm_loss_points-" . $points . " WHERE csm_crp_id = " . $kill->getVictimCorpID() . " AND csm_shp_id = {$shipid} AND csm_monthday = {$month} AND csm_year = {$year}";
     $qry->execute($sql);
     $solo = true;
     $alls[$kill->getVictimCorpID()] = 1;
     foreach ($kill->getInvolved() as $inv) {
         if (isset($alls[$inv->getCorpID()])) {
             continue;
         }
         $alls[$inv->getCorpID()] = 1;
         $solo = false;
         $sql = "UPDATE kb3_sum_corp SET csm_kill_count = csm_kill_count - 1, " . " csm_kill_isk = csm_kill_isk - " . $killisk . " ,csm_kill_loot = csm_kill_loot - " . $killloot . " ,csm_kill_points = csm_kill_points - " . $points . " WHERE csm_crp_id = " . $inv->getCorpID() . " AND csm_shp_id = {$shipid} AND csm_monthday = {$month} AND csm_year = {$year}";
         $qry->execute($sql);
     }
     if ($solo) {
         $sql = "UPDATE kb3_sum_corp SET csm_kill_count=csm_kill_count-1, csm_kill_isk=csm_kill_isk-{$killisk}, csm_kill_loot=csm_kill_loot-{$killloot}, csm_kill_points=csm_kill_points-{$points} WHERE " . " csm_crp_id = " . $kill->getVictimCorpID() . " AND csm_shp_id = {$shipid} AND csm_monthday = {$month} AND csm_year = {$year}";
         $qry->execute($sql);
     }
 }