示例#1
0
require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
require_once get_file_loc("smr_force.inc");
print_topic("SECTOR SCAN");
// initialize vars
$friendly_forces = 0;
$enemy_forces = 0;
$friendly_vessel = 0;
$enemy_vessel = 0;
// get our rank
$rank_id = $account->get_rank();
// iterate over all forces in the target sector
$db->query("SELECT * FROM sector_has_forces WHERE game_id = {$player->game_id} AND " . "sector_id = " . $var["target_sector"]);
while ($db->next_record()) {
    // we may skip forces if this is a protected gal.
    if ($sector->is_protected_gal()) {
        $forces_account = new SMR_ACCOUNT();
        $forces_account->get_by_id($db->f("owner_id"));
        // if one is vet and the other is newbie we skip it
        if (different_level($rank_id, $forces_account->get_rank(), $account->veteran, $forces_account->veteran)) {
            continue;
        }
    }
    // decide if it's an friendly or enemy stack
    $forces_owner = new SMR_PLAYER($db->f("owner_id"), $player->game_id);
    $forces = new SMR_FORCE($db->f("owner_id"), $var["target_sector"], $player->game_id);
    if ($player->alliance_id == 0 && $forces->owner_id == $player->account_id || $player->alliance_id != 0 && $player->alliance_id == $forces_owner->alliance_id) {
        $friendly_forces += $forces->mines * 3 + $forces->combat_drones * 2 + $forces->scout_drones;
    } else {
        $enemy_forces += $forces->mines * 3 + $forces->combat_drones * 2 + $forces->scout_drones;
    }