Example #1
0
 function get_ids()
 {
     # order matters!!!!
     if (is_null($this->alliance_id)) {
         $this->alliance_id = get_alliance_id($this->alliance);
     }
     if (is_null($this->corp_id)) {
         $this->corp_id = get_corp_id($this->corp, $this->alliance_id);
     }
     if (is_null($this->pilot_id)) {
         $this->pilot_id = get_pilot_id($this->pilot, $this->corp_id);
     }
     if (is_null($this->char_id)) {
         $this->char_id = get_pilot_charid($this->pilot_id);
     }
     if (is_null($this->ship_id)) {
         $this->ship_id = get_item_id($this->ship);
     }
     if (is_null($this->group_id)) {
         $this->group_id = get_item_group_id($this->ship_id);
     }
     if (is_null($this->weapon_id)) {
         $this->weapon_id = get_item_id($this->weapon);
     }
 }
Example #2
0
function get_alliance_id($name, $first = 1)
{
    global $ft;
    if (is_null($name) || $name == 'None' || $name == 'Unknown') {
        # None/Unknown seems to be a hint used by the game when a corp doesn't have an alliance
        return 0;
    }
    $allianceid = $ft->dbh->_select_one('SELECT allianceid FROM tbl:alliances WHERE name = ?', array($name));
    if (!$allianceid && $first) {
        $ft->dbh->_do_query('INSERT INTO tbl:alliances (name) VALUES (?)', array($name));
        $allianceid = get_alliance_id($name, 0);
    }
    return $allianceid;
}
Example #3
0
function get_pilot_with_info($charid, $name, $corpname, $alliancename)
{
    # creates the pilot if needed
    $allid = get_alliance_id($alliancename);
    $corpid = get_corp_id($corpname, $allid);
    $pilotid = get_pilot_id($name, $corpid);
    $ocid = get_pilot_charid($pilotid);
    if ($ocid != $charid) {
        global $ft;
        $ft->dbh->_do_query('UPDATE tbl:pilots SET charid = ? WHERE pilotid = ?', array($charid, $pilotid));
    }
    return $pilotid;
}