function trustable() { if ($this->obj) { $val = get_corp_allowed($this->obj->corpid); if (!is_null($val) && $val) { return 1; } return 0; } return 0; }
function figure_killtype() { global $ft; # get the final killer $final = $this->killer(); $killer_friendly = get_corp_allowed($final->corp_id); $victim_friendly = get_corp_allowed($this->victim->corp_id); # the states if ($killer_friendly && !$victim_friendly) { return 'kill'; } elseif ($killer_friendly && $victim_friendly) { return 'murder'; } elseif ($victim_friendly) { return 'loss'; } else { return 'other'; } return 'other'; ## END ## # get the data to use global $_ALLIANCE_STANDINGS, $_CORP_STANDINGS; if (!isset($_ALLIANCE_STANDINGS)) { # echo("[[ SET ALLIANCE STANDINGS ]]<br />\n"); $alliances = $ft->dbh->_select_rows_as_objects('SELECT allianceid, standings FROM tbl:alliances'); $_ALLIANCE_STANDINGS = $alliances; } else { $alliances = $_ALLIANCE_STANDINGS; } if (!isset($_CORP_STANDINGS)) { # echo("[[ SET CORP STANDINGS ]]<br />\n"); $corps = $ft->dbh->_select_rows_as_objects('SELECT corpid, standings FROM tbl:corps'); $_CORP_STANDINGS = $corps; } else { $corps = $_CORP_STANDINGS; } # now, get our standings $v_a = 0; $k_a = 0; $v_c = 0; $k_c = 0; foreach ($alliances as $a) { if ($a->allianceid == $this->victim->alliance_id) { $v_a = $a->standings; } if ($a->allianceid == $final->alliance_id) { $k_a = $a->standings; } } foreach ($corps as $c) { if ($c->corpid == $this->victim->corp_id) { $v_c = $c->standings; } if ($c->corpid == $final->corp_id) { $k_c = $c->standings; } } # echo("[[ (" . $this->victim->alliance_id . ',' . $this->victim->corp_id . ',' . $final->alliance_id . ',' . $final->corp_id . ") va=$v_a, vc=$v_c, ka=$k_a, kc=$k_c ]]<br />\n"); # corp standings override alliance standings $killer_standings = $k_a; $victim_standings = $v_a; if ($k_c != 0) { $killer_standings = $k_c; } if ($v_c != 0) { $victim_standings = $v_c; } # figure out what happened if ($killer_standings > 0 && $victim_standings > 0) { return 'murder'; } elseif ($killer_standings > 0 && $victim_standings <= 0) { return 'kill'; } elseif ($killer_standings <= 0 && $victim_standings > 0) { return 'loss'; } else { return 'other'; } }