コード例 #1
0
$player->update();
// assign the new ship
$ship->ship_type_id = $var["ship_id"];
// delete cargo
$ship->remove_all_cargo();
// update
$ship->update();
// get new ship object
$ship = new SMR_SHIP(SmrSession::$old_account_id, SmrSession::$game_id);
// adapt hardware
$db->query("SELECT * FROM hardware_type");
while ($db->next_record()) {
    $hardware_type_id = $db->f("hardware_type_id");
    // take hardware we don't support
    if ($ship->hardware[$hardware_type_id] > $ship->max_hardware[$hardware_type_id]) {
        $ship->hardware[$hardware_type_id] = $ship->max_hardware[$hardware_type_id];
    }
}
// take weapons that we can't carry
$ship->weapon = array_slice($ship->weapon, 0, $ship->hardpoint);
// disable hardware
$db->query("DELETE FROM ship_is_cloaked WHERE account_id = {$player->account_id} AND " . "game_id = {$player->game_id}");
$db->query("DELETE FROM ship_has_illusion WHERE account_id = {$player->account_id} AND " . "game_id = {$player->game_id}");
// if we changed max hardware we need to compensate this.
$ship->mark_seen();
// update again
$ship->update_hardware();
$ship->update_weapon();
$ship->mark_seen();
$account->log(10, "Buys a {$ship->ship_name} for {$cost} credits", $player->sector_id);
forward(create_container("skeleton.php", "current_sector.php"));
コード例 #2
0
        }
    }
    // add this to the outgoing message array
    $port_msg[] = $msg . ".";
    // is he dead now?
    if ($curr_attacker_ship->hardware[HARDWARE_SHIELDS] == 0 && $curr_attacker_ship->hardware[HARDWARE_ARMOR] == 0 && !in_array($curr_attacker->account_id, $dead_traders)) {
        // write a message to the array
        $port_msg[] = "<span style=\"color:yellow;\">{$curr_attacker->player_name}</span> has been <span style=\"color:red;\">DESTROYED</span> by port forces";
        if ($curr_attacker->account_id != $player->account_id) {
            $curr_attacker->set_info('dead', "TRUE");
        }
        // add him to the array to process later
        $dead_traders[] = $curr_attacker->account_id;
    }
    // update ship
    $curr_attacker_ship->update_hardware();
}
// get the overall damage
if ($port_damage > 0) {
    $port_msg[] = "This port does a total of <span style=\"color:red;\">{$port_damage}</span> damage in this round of combat.";
} else {
    $port_msg[] = "This port does no damage at all. It needs a better attack coordinator";
}
// ********************************
// *
// * A t t a c k e r	s h o o t s
// *
// ********************************
// array for next page
$damage_msgs = array();
$atts = array();