Beispiel #1
0
 function adjust_totals($override = 0)
 {
     $this->get_ids();
     # at this point we know we have all id information, we want to get a duplicate id
     if (!$override) {
         if ($this->is_duplicate()) {
             return;
         }
     }
     # and now try to figure out what kind of kill this is
     $this->killtype = $this->figure_killtype();
     # not a dupe, let's add it to the summary table... this one is huge
     $final = $this->killer();
     if (!$final) {
         return false;
     }
     global $ft;
     $res = $ft->dbh->_do_query('INSERT INTO tbl:summary (v_pilotid, v_corpid, v_allianceid, v_shipid, ' . 'k_pilotid, k_corpid, k_allianceid, k_security, k_shipid, systemid, ' . 'system_security, killtime, weaponid, mailid, type, regionid, v_groupid, k_groupid, ' . 'constellationid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', array($this->victim->pilot_id, $this->victim->corp_id, $this->victim->alliance_id, $this->victim->ship_id, $final->pilot_id, $final->corp_id, $final->alliance_id, $final->security, $final->ship_id, $this->system_id, $this->security, $this->killtime, $final->weapon_id, $this->raw_id, $this->killtype, $this->region_id, $this->victim->group_id, $final->group_id, $this->constellation_id));
     if (!$res) {
         return false;
     }
     # now get the kill id back out
     $this->kill_id = mysql_insert_id($ft->dbh->_dbh());
     # figure out what day/month/year it is
     $matches = array();
     if (preg_match("/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)\\s/", $this->date, &$matches)) {
         $year = $matches[1];
         $month = $matches[2] + $year * 100;
         $week = date("W", $this->killtime) + $year * 100;
         #                $day = $matches[3];
     }
     # hurrah, fo shizzle, insert our attacker rows
     foreach (array_keys($this->attackers) as $k) {
         $ki =& $this->attackers[$k];
         if ($ki->finalblow) {
             $fb = 1;
         } else {
             $fb = 0;
         }
         $ft->dbh->_do_query('INSERT INTO tbl:killers (killid, pilotid, corpid, allianceid, shipid, groupid, ' . 'finalblow, weaponid, security) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)', array($this->kill_id, $ki->pilot_id, $ki->corp_id, $ki->alliance_id, $ki->ship_id, $ki->group_id, $fb, $ki->weapon_id, $ki->security));
     }
     # insert in items from this kill
     foreach (array_keys($this->destroyed) as $k) {
         $ki =& $this->destroyed[$k];
         $ft->dbh->_do_query('INSERT INTO tbl:killitems (killid, itemid, quantity, loc) VALUES (?, ?, ?, ?)', array($this->kill_id, $ki->item_id, $ki->quantity, $ki->loc));
     }
     # get some values of this kill
     $iskval = get_item_killpoints($this->victim->ship_id);
     $bounty = get_item_bountypoints($this->victim->ship_id);
     # do some stats on pilots, we're going to do this sort of condensation thing
     # now to save time later
     if ($this->killtype == 'kill' || $this->killtype == 'loss') {
         # a 'kill' is GOOD, we killed someone bad! yay!
         $this->increment_stat(&$this->victim, $year, $month, $week, $this->killtype . 'recv');
         if ($iskval > 0) {
             $this->increment_stat(&$this->victim, $year, $month, $week, 'isklost', $iskval);
         }
         $this->increment_favorite(&$this->victim, 'ship_lost', $this->victim->ship_id);
         foreach (array_keys($this->attackers) as $k) {
             # favorites on this pilot
             $this->increment_favorite(&$this->attackers[$k], 'pilot', $this->victim->pilot_id);
             $this->increment_favorite(&$this->attackers[$k], 'system', $this->system_id);
             $this->increment_favorite(&$this->attackers[$k], 'weapon', $this->attackers[$k]->weapon_id);
             $this->increment_favorite(&$this->attackers[$k], 'ship_killed', $this->victim->ship_id);
             $this->increment_favorite(&$this->attackers[$k], 'ship_flown', $this->attackers[$k]->ship_id);
             # stats on this pilot
             $this->increment_stat(&$this->attackers[$k], $year, $month, $week, $this->killtype . 'give');
             if ($this->attackers[$k]->finalblow) {
                 if ($iskval) {
                     $this->increment_stat(&$this->attackers[$k], $year, $month, $week, 'iskdestroyed', $iskval);
                 }
                 if ($bounty > 0) {
                     $this->increment_stat(&$this->attackers[$k], $year, $month, $week, 'bountypoints', $bounty);
                 }
                 if (count($this->attackers) == 1) {
                     # only one attacker, solo kill
                     $this->increment_stat(&$this->attackers[$k], $year, $month, $week, 'solokills');
                 }
                 $this->increment_stat(&$this->attackers[$k], $year, $month, $week, 'finalblows');
             }
         }
     } elseif ($this->killtype == 'murder') {
         # Until a decision is made, you don't get final blow points for killing a friendly... also
         # you don't get isk destroyed, or isk lost, or anything... these are basically not in the stats
         # except as friendly kills
         $this->increment_stat(&$this->victim, $year, $month, $week, 'murderrecv');
         foreach (array_keys($this->attackers) as $k) {
             $this->increment_stat(&$this->attackers[$k], $year, $month, $week, 'murdergive');
         }
     }
 }
Beispiel #2
0
$finals = array();
$parts = array();
$names = array();
# now iterate over the list and start coercing data
foreach ($kills as $k) {
    foreach (array_keys($k->attackers) as $ke) {
        # ignore anybody not in our target list
        $killer =& $k->attackers[$ke];
        if ($whatis == 'pilot' && $id > 0 && $killer->pilot_id != $id) {
            continue;
        } elseif ($whatis == 'corp' && $id > 0 && $killer->corp_id != $id) {
            continue;
        }
        if ($killer->finalblow) {
            $finals[$killer->pilot_id]++;
            $bounties[$killer->pilot_id] += get_item_bountypoints($k->victim->ship_id);
        } else {
            $finals[$killer->pilot_id] += 0;
            $bounties[$killer->pilot_id] += 0;
        }
        $parts[$killer->pilot_id]++;
        if (!isset($earliest[$killer->pilot_id])) {
            $earliest[$killer->pilot_id] = $k->killtime;
        } else {
            if ($k->killtime < $earliest[$killer->pilot_id]) {
                $earliest[$killer->pilot_id] = $k->killtime;
            }
        }
        if (!isset($latest[$killer->pilot_id])) {
            $latest[$killer->pilot_id] = $k->killtime;
        } else {