<?php require_once 'lib/fortissimo.php'; require_once 'lib/EVESystem.php'; $test = new EVESystem(30003808); echo "got {$test} - " . $test->getName() . " - " . $test->getConstellationName() . " - " . $test->getRegionName() . " <br />"; echo "okay new test - " . EVESystem::getName(30003808) . "<br />"; echo "if those are both Grispire, you're golden <tt>:)</tt><br />"; echo "test again - " . $test->getId() . " should be 30003808<br />"; echo "this should be too - " . EVESystem::getId('Grispire') . "<br />";
function get_ids() { $sys = new EVESystem(EVESystem::getId($this->system)); $this->system_id = $sys->getId(); $this->region_id = $sys->getRegionId(); $this->constellation_id = $sys->getConstellationId(); if ($this->victim) { $this->victim->get_ids(); } if ($this->killer) { $this->killer->get_ids(); } foreach (array_keys($this->destroyed) as $k) { $this->destroyed[$k]->get_ids(); } foreach (array_keys($this->attackers) as $k) { $this->attackers[$k]->get_ids(); } }
function load_kills_by_id($ids) { global $ft; $out = array(); if (count($ids) <= 0) { return $out; } # try from cache first $cached = $ft->dbh->_select_rows_as_objects('SELECT * FROM tbl:killcache WHERE killid IN (?)', array($ids)); foreach ($cached as $c) { $out[$c->killid] = unserialize($c->cache); } # now remove the ones we got from the load list $load = array(); foreach ($ids as $id) { if (!isset($out[$id])) { array_push($load, $id); } } # if we're done, we're done if (count($load) <= 0) { return $out; } # guess not, try to load from database $data = $ft->dbh->_select_rows_as_objects('SELECT *, FROM_UNIXTIME(killtime) AS "date" FROM tbl:summary WHERE killid IN (?)', array($load)); foreach ($data as $r) { $k = new KillMail(); $k->kill_id = $r->killid; $sys = new EVESystem($r->systemid); $k->system_id = $sys->getId(); $k->region_id = $sys->getRegionId(); $k->constellation_id = $sys->getConstellationId(); $k->killtime = $r->killtime; $k->raw_id = $r->mailid; # strip the time... $date = $r->date; $k->date = preg_replace("/\\s\\d\\d:\\d\\d:\\d\\d\$/", "", $date); # now get the victim $k->victim = new Party(); $k->victim->pilot_id = $r->v_pilotid; $k->victim->corp_id = $r->v_corpid; $k->victim->alliance_id = $r->v_allianceid; $k->victim->ship_id = $r->v_shipid; $k->victim->group_id = $r->v_groupid; # and now the final killer $final = new Party(); $final->pilot_id = $r->k_pilotid; $final->corp_id = $r->k_corpid; $final->alliance_id = $r->k_allianceid; $final->ship_id = $r->k_shipid; $final->group_id = $r->k_groupid; $final->security = $r->k_security; $final->weapon_id = $r->weaponid; $final->finalblow = true; $k->attackers = array($final); $k->killer = $final; # get other killers ... $killers = $ft->dbh->_select_rows_as_objects('SELECT * FROM tbl:killers WHERE killid = ? AND finalblow = 0', array($k->kill_id)); foreach ($killers as $killer) { $p = new Party(); $p->pilot_id = $killer->pilotid; $p->corp_id = $killer->corpid; $p->alliance_id = $killer->allianceid; $p->ship_id = $killer->shipid; $p->group_id = $killer->groupid; $p->security = $killer->security; $p->weapon_id = $killer->weaponid; $p->finalblow = false; array_push($k->attackers, $p); } # and now get the items destroyed $items = $ft->dbh->_select_rows_as_objects('SELECT * FROM tbl:killitems WHERE killid = ?', array($k->kill_id)); foreach ($items as $item) { $p = new Item(); $p->item_id = $item->itemid; $p->quantity = $item->quantity; $p->loc = $item->loc; array_push($k->destroyed, $p); } # done $k->reverse_ids(); $out[$k->kill_id] = $k; # cache it $ft->dbh->_do_query('INSERT INTO tbl:killcache (killid, cache) VALUES (?, ?)', array($k->kill_id, serialize($k))); } return $out; }