function addScout($pilot_name) { $scoutship = "9999"; //get pilot order $pqry = new DBPreparedQuery(); $pqry->prepare("select max(ind_order), ind_timestamp from kb3_inv_detail where ind_kll_id = ? group by ind_timestamp"); $pqry->bind_param('i', $this->killID_); $pqry->bind_result($scoutorder, $timestamp); if (!$pqry->execute() || !$pqry->recordCount()) { return false; } else { $pqry->fetch(); } $scoutorder = $scoutorder + 1; //lookup pilot id by name $pilot = Pilot::lookup($pilot_name); if (!$pilot) { return false; } if (isset($pilot)) { $pilotid = $pilot->getID(); if ($pilotid == 0) { return false; } } else { return false; } $qry = new DBQuery(true); $qry->execute("INSERT INTO kb3_scout (`inp_kll_id`,`inp_plt_id`) VALUES ('" . $this->killID_ . "','" . $pilotid . "')"); $this->scouts_[] = $this->getPilotData($pilotid, $qry->getInsertID()); if (!isset($this->scouts_)) { return false; } $qry->execute("INSERT INTO kb3_inv_detail (`ind_kll_id`,`ind_timestamp`,`ind_plt_id`,`ind_all_id`,`ind_crp_id`,`ind_shp_id`,`ind_order`) VALUES ('" . $this->killID_ . "','" . $timestamp . "','" . $pilotid . "','" . $this->scouts_[0]['allianceid'] . "','" . $this->scouts_[0]['corpid'] . "','" . $scoutship . "','" . $scoutorder . "')"); //add to pilot's stats $qry->execute("SELECT 1 FROM kb3_sum_pilot WHERE psm_plt_id = '" . $pilotid . "'"); if ($qry->recordCount() > 0) { $this->kill = new Kill($this->killID_); $qry->execute("INSERT INTO kb3_sum_pilot \n (psm_plt_id, psm_shp_id, psm_kill_count, psm_kill_isk) \n VALUES ('" . $pilotid . "','" . $this->kill->getVictimShip()->getClass()->getID() . "', 1, '" . $this->kill->getISKLoss() . "') \n ON DUPLICATE KEY \n UPDATE psm_kill_count = psm_kill_count + 1, \n psm_kill_isk = psm_kill_isk + '" . $this->kill->getISKLoss() . "'"); //Jalon debugging - i had to run this query to fix the DB, it was missing a default value: //alter table kb3_inv_detail modify column ind_dmgdone int(11) not null default 0; //error_log("INSERT INTO kb3_sum_pilot (psm_plt_id, psm_shp_id, psm_kill_count, psm_kill_isk) VALUES ('".$pilotid."','".$this->kill->getVictimShip()->getClass()->getID()."', 1, '".$this->kill->getISKLoss()."') ON DUPLICATE KEY UPDATE psm_kill_count = psm_kill_count + 1, psm_kill_isk = psm_kill_isk + '".$this->kill->getISKLoss()."'"); $qry->execute("UPDATE kb3_pilots \n SET plt_kpoints = plt_kpoints + '" . $this->kill->getKillPoints() . "' WHERE plt_id = '" . $pilotid . "'"); } //make sure involved count is shown correctly (it's generated before this class is loaded) header("Location: ?a=kill_detail&kll_id=" . $this->killID_); exit; }