Ejemplo n.º 1
0
$atts = array();
// iterate over whole fleet
for ($i = 0; $i < $attacker_team->get_fleet_size(); $i++) {
    // get attacker
    $curr_att_id = $attacker_team->next(true);
    $curr_attacker = new SMR_PLAYER($curr_att_id, SmrSession::$game_id);
    $curr_attacker_ship = new SMR_SHIP($curr_attacker->account_id, SmrSession::$game_id);
    //this player has successfully shot the port.
    $db->query("SELECT * FROM player_attacks_port WHERE game_id = " . SmrSession::$game_id . " AND sector_id = {$sector->sector_id} AND account_id = {$curr_attacker->account_id}");
    //is he already recorded?  If so we don't want to lower the lvl of the port he is attacking.
    if (!$db->next_record()) {
        $db->query("REPLACE INTO player_attacks_port (game_id, account_id, sector_id, time, level) VALUES (" . SmrSession::$game_id . ", {$curr_attacker->account_id}, {$sector->sector_id}, {$time}, {$port->level})");
    }
    $atts[] = $curr_att_id;
    // reduce his relations
    $curr_attacker->get_relations();
    $curr_attacker->relations[$port->race_id] -= 5;
    if ($curr_attacker->relations[$port->race_id] < -500) {
        $curr_attacker->relations[$port->race_id] = -500;
    }
    // save what we got so far
    $curr_attacker->update();
    // disable cloak
    $curr_attacker_ship->disable_cloak();
    // the damage this attacker is going to do
    $attacker_damage = 0;
    // and his message array
    $damage_msg = array();
    $weapon = new SmrMySqlDatabase();
    $weapon->query("SELECT * FROM ship_has_weapon NATURAL JOIN weapon_type " . "WHERE account_id = {$curr_attacker->account_id} AND " . "game_id = {$curr_attacker->game_id} " . "ORDER BY order_id");
    // iterate over all existing weapons
Ejemplo n.º 2
0
 if ($debug) {
     print "send message to attacker<br>";
 }
 // send dead msg
 $killed->send_message($killer->account_id, MSG_PLAYER, format_string("You <span style=\"color:red;\">DESTROYED</span> {$killed_name} in Sector&nbsp<span style=\"color:blue;\">#{$curr_sector}</span>", false));
 if ($debug) {
     print "send message to defender<br>";
 }
 //send them a nice message
 $killer->send_message($killed_id, MSG_PLAYER, format_string("You were <span style=\"color:red;\">DESTROYED</span> by {$killer_name} in Sector&nbsp<span style=\"color:blue;\">#{$curr_sector}</span>", false));
 if ($debug) {
     print "change alignment<br>";
 }
 // now we change align
 // @ war? bring it up @ peace? go down @ neutral? check aligns
 $killer->get_relations();
 if ($killer->relations_global[$killed->race_id] <= -300) {
     $modifier = $killer->relations_global[$killed->race_id] / -25;
 } elseif ($killer->relations_global[$killed->race_id] >= 300) {
     $modifier = $killer->relations_global[$killed->race_id] / -25;
 } else {
     $modifier = $killed->alignment / -10;
 }
 $db->query("UPDATE player SET alignment = alignment + {$modifier} WHERE account_id = {$killer_id} AND game_id = {$player->game_id}");
 if ($debug) {
     print "military payment?<br>";
 }
 // do we get military pay?
 // align * 50 * sqrt of sqrt / 1.5 of exp * .1
 if ($killer->relations_global[$killed->race_id] <= -300) {
     $military_pay = $killer->relations_global[$killed->race_id] * 50 * sqrt(sqrt($killed_exp / 1.5)) * -1;