/** * @param SimpleXMLElement $row * @param Kill $kill * @param string $time YYYY-mm-dd hh:ss * @return boolean false on error */ private function processVictim($row, &$kill, $time) { // If we have a character ID but no name then we give up - the needed // info is gone. // If we have no character ID and no name then it's a structure or NPC // - if we have a moonID (anchored at a moon) call it corpname - moonname // - if we don't have a moonID call it corpname - systemname $victim = $row->victim; if (!strval($victim['characterName']) && (int) $victim['characterID']) { return false; } else { if (!strval($victim['corporationName'])) { return false; } } if ((int) $victim['allianceID']) { $alliance = Alliance::add(strval($victim['allianceName']), (int) $victim['allianceID']); } else { if ((int) $victim['factionID']) { $alliance = Alliance::add(strval($victim['factionName']), (int) $victim['factionID']); } else { $alliance = Alliance::add("None"); } } $corp = Corporation::add(strval($victim['corporationName']), $alliance, $time, (int) $victim['corporationID']); if (!strval($victim['characterName'])) { if ((int) $row['moonID']) { $name = API_Helpers::getMoonName((int) $row['moonID']); if (!$name) { $idtoname = new API_IDtoName(); $idtoname->setIDs((int) $row['moonID']); if ($idtoname->fetchXML()) { return false; } $namedata = $idtoname->getIDData(); $name = $namedata[0]['name']; } $name = strval($victim['corporationName']) . " - " . $name; } else { $name = strval($victim['corporationName']) . " - " . $kill->getSystem()->getName(); } } else { if (!(int) $victim['shipTypeID']) { return false; } else { $name = strval($victim['characterName']); } } $pilot = Pilot::add($name, $corp, $time, (int) $victim['characterID']); $ship = Ship::getByID((int) $victim['shipTypeID']); $kill->setVictim($pilot); $kill->setVictimID($pilot->getID()); $kill->setVictimCorpID($corp->getID()); $kill->setVictimAllianceID($alliance->getID()); $kill->setVictimShip($ship); $kill->set('dmgtaken', (int) $victim['damageTaken']); return true; }