コード例 #1
0
ファイル: forces_examine.php プロジェクト: smrealms/smrv2.0
require_once get_file_loc("smr_force.inc");
// initialize random generator.
mt_srand((double) microtime() * 1000000);
// creates a new player object for attacker and defender
$attacker = new SMR_PLAYER(SmrSession::$old_account_id, SmrSession::$game_id);
$attacker_ship = new SMR_SHIP(SmrSession::$old_account_id, SmrSession::$game_id);
$forces_owner = new SMR_PLAYER($var["owner_id"], SmrSession::$game_id);
$forces = new SMR_FORCE($var["owner_id"], $attacker->sector_id, $attacker->game_id);
// first check if both ship and forces are in same sector
if ($attacker->sector_id != $forces->sector_id) {
    print_error("Those forces are no longer here!");
    return;
}
print "<h1>EXAMINE FORCES</h1>";
// should we display an attack button
if (($attacker_ship->attack_rating() > 0 || $attacker_ship->hardware[HARDWARE_COMBAT] > 0) && !$attacker->is_fed_protected() && $attacker->newbie_turns == 0 && $attacker->land_on_planet == 'FALSE' && ($attacker->alliance_id == 0 || $forces_owner->alliance_id == 0 || $forces_owner->alliance_id != $attacker->alliance_id) && $attacker->account_id != $forces_owner->account_id) {
    $container = array();
    $container["url"] = "forces_attack_processing.php";
    transfer("target");
    transfer("owner_id");
    print_form($container);
    print_submit("Attack Forces (3)");
    print "</form>";
} elseif ($attacker->is_fed_protected()) {
    print "<p><big style=\"color:#3333FF;\">You are under federal protection! That wouldn't be fair.</big></p>";
} elseif ($attacker->newbie_turns > 0) {
    print "<p><big style=\"color:#33FF33;\">You are under newbie protection!</big></p>";
} elseif ($owner->alliance_id == $attacker->alliance_id && $attacker->alliance_id != 0) {
    print "<p><big style=\"color:#33FF33;\">These are your alliance's forces!</big></p>";
} elseif ($owner->account_id == $attacker->account_id) {
    print "<p><big style=\"color:#33FF33;\">These are your forces!</big></p>";