// adapt turns $player->turns = $player->turns * $speed / $ship->speed; if ($player->turns > $max_turns) { $player->turns = $max_turns; } // take the money from the user $player->credits -= $cost; $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.
} $player->get_relations(); if ($port->race_id > 1) { $new_relations = $player->relations[$port->race_id] - 45; if ($new_relations < -500) { $new_relations = -500; } $db->query("REPLACE INTO player_has_relation (account_id, game_id, race_id, relation) VALUES({$player->account_id}, {$player->game_id}, {$port->race_id}, {$new_relations})"); } // also we change alignment if ($player->relations_global_rev[$port->race_id] < -299) { $new_alignment = $player->alignment + $port_original_level * 2; } else { $new_alignment = $player->alignment - $port_original_level * 2; } $db->query("UPDATE player SET alignment={$new_alignment} WHERE account_id={$player->account_id} AND game_id={$player->game_id} LIMIT 1"); } //kill the dead people foreach ($dead_traders as $acc_id) { $dead_acc = new SMR_PLAYER($acc_id, $player->game_id); $dead_acc->died_by_port(); $dead_ship = new SMR_SHIP($acc_id, $player->game_id); $dead_ship->get_pod(); } $container = array(); $container["url"] = "skeleton.php"; $container["body"] = "port_attack.php"; $container["attacker"] = $attacker; $container["portdamage"] = $port_msg; $container["dead_traders"] = $dead_traders; forward($container);
// log $account->log(2, "Player entered game " . SmrSession::$game_id, $player->sector_id); $container = array(); $container["url"] = "skeleton.php"; if ($player->land_on_planet == "TRUE") { $container["body"] = "planet_main.php"; } else { $container["body"] = "current_sector.php"; } require_once get_file_loc('smr_alliance.inc'); require_once get_file_loc("smr_force.inc"); require_once get_file_loc("smr_planet.inc"); require_once get_file_loc("smr_port.inc"); require_once get_file_loc('smr_sector.inc'); $player = new SMR_PLAYER(SmrSession::$old_account_id, SmrSession::$game_id); $ship = new SMR_SHIP(SmrSession::$old_account_id, SmrSession::$game_id); $sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id); // update turns on that player $player->update_turns($ship->speed); // we cant move if we are dead //check if we are in kill db...if we are we don't do anything $db->query("SELECT * FROM kills WHERE dead_id = {$player->account_id} AND game_id = {$player->game_id}"); if (!$db->next_record()) { if ($ship->hardware[HARDWARE_SHIELDS] == 0 && $ship->hardware[HARDWARE_ARMOR] == 0 && ($var["body"] != "trader_attack.php" && $var["url"] != "trader_attack_processing.php" && $var["body"] != "port_attack.php" && $var["url"] != "port_attack_processing.php" && $var["body"] != "planet_attack.php" && $var["url"] != "planet_attack_processing.php")) { $player->sector_id = $player->get_home(); $player->newbie_turns = 100; $player->mark_dead(); $player->update(); $ship->get_pod(); //print("$var[body], $var[url]"); $container = array();
} } $last_active = time() - 259200; $db->query("SELECT * FROM player WHERE game_id = {$player->game_id} AND " . "sector_id = " . $var["target_sector"] . " AND " . "last_active > {$last_active} AND " . "land_on_planet = 'FALSE' AND " . "account_id NOT IN (" . implode(',', $HIDDEN_PLAYERS) . ")"); while ($db->next_record()) { // we may skip player if this is a protected gal. if ($sector->is_protected_gal()) { $curr_account = new SMR_ACCOUNT(); $curr_account->get_by_id($db->f("account_id")); // if one is vet and the other is newbie we skip it if (different_level($rank_id, $curr_account->get_rank(), $account->veteran, $curr_account->veteran)) { continue; } } $curr_player = new SMR_PLAYER($db->f("account_id"), $player->game_id); $curr_ship = new SMR_SHIP($db->f("account_id"), $player->game_id); // he's a friend if he's in our alliance (and we are not in a 0 alliance if ($player->alliance_id != 0 && $curr_player->alliance_id == $player->alliance_id) { $friendly_vessel += $curr_ship->attack_rating(); } else { $enemy_vessel += $curr_ship->defense_rating() * 10; } } print "<p>"; print "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" class=\"standard\">"; print "<tr>"; print "<th> </th>"; print "<th align=\"center\">Scan Results</th>"; print "</tr>"; print "<tr>"; print "<td>Friendly vessels</td>";
// ******************************** // * // * A t t a c k e r s h o o t s // * // ******************************** $attacker_total_msg = array(); $attacker_msg = array(); if ($player->getAllianceID() != 0) { $db->query('SELECT * FROM player ' . 'WHERE game_id = ' . $player->getGameID() . ' AND ' . 'alliance_id = ' . $player->getAllianceID() . ' AND ' . 'sector_id = ' . $player->getSectorID() . ' AND ' . 'land_on_planet = \'FALSE\' AND ' . 'newbie_turns = 0 ' . 'ORDER BY rand() LIMIT 10'); } else { $db->query('SELECT * FROM player ' . 'WHERE game_id = ' . $player->getGameID() . ' AND ' . 'sector_id = ' . $player->getSectorID() . ' AND ' . 'account_id = ' . $player->getAccountID() . ' AND ' . 'land_on_planet = \'FALSE\' AND ' . 'newbie_turns = 0'); } $db2 = new SmrMySqlDatabase(); while ($db->next_record() && ($forces->hasCDs() || $forces->hasSDs() || $forces->hasMines())) { $curr_attacker =& SmrPlayer::getPlayer($db->f('account_id'), SmrSession::$game_id); $curr_attacker_ship = new SMR_SHIP($db->f('account_id'), SmrSession::$game_id); // disable cloak $curr_attacker_ship->disable_cloak(); $db2->query('SELECT * FROM ship_has_weapon, weapon_type ' . 'WHERE account_id = ' . $curr_attacker->getAccountID() . ' AND ' . 'game_id = ' . SmrSession::$game_id . ' AND ' . 'ship_has_weapon.weapon_type_id = weapon_type.weapon_type_id ' . 'ORDER BY order_id'); // iterate over all existing weapons while ($db2->next_record() && ($forces->hasCDs() || $forces->hasSDs() || $forces->hasMines())) { $weapon_name = $db2->f('weapon_name'); $shield_damage = $db2->f('shield_damage'); $armour_damage = $db2->f('armour_damage'); $accuracy = $db2->f('accuracy'); if ($forces->hasMines()) { if ($armour_damage > 0) { // mines take 20 armour damage each $mines_dead = round($armour_damage / 20); // more damage than mines? if ($mines_dead > $forces->getMines()) {
} } $attacker_list = "(" . $attacker_list . ")"; } else { // mhh. we are not in an alliance. // so we fighting alone. $attacker_list = "(" . $attacker->account_id . ")"; } print "<td valign=\"top\">"; if ($attacker_list == "()") { print " "; } else { $db->query("SELECT * FROM player WHERE game_id = " . SmrSession::$game_id . " AND " . "account_id IN {$attacker_list}"); while ($db->next_record()) { $curr_player = new SMR_PLAYER($db->f("account_id"), SmrSession::$game_id); $curr_ship = new SMR_SHIP($db->f("account_id"), SmrSession::$game_id); print "{$player->level_name}<br>"; print "<span style=\"color:yellow;\">{$curr_player->player_name} ({$curr_player->player_id})</span><br>"; print "Race: {$curr_player->race_name}<br>"; print "Level: {$curr_player->level_id}<br>"; print "Alliance: {$curr_player->alliance_name}<br><br>"; print "<small>"; print "{$curr_ship->ship_name}<br>"; print "Rating : " . $curr_ship->attack_rating() . "/" . $curr_ship->defense_rating() . "<br>"; print "Shields : " . $curr_ship->shield_low() . "-" . $curr_ship->shield_high() . "<br>"; print "Armor : " . $curr_ship->armor_low() . "-" . $curr_ship->armor_high() . "<br>"; print "Hard Points: {$curr_ship->weapon_used}<br>"; print "Combat Drones: " . $curr_ship->combat_drones_low() . "-" . $curr_ship->combat_drones_high(); print "</small><br><br><br>"; } }