<?php 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_planet.inc"); print_topic("VIEWING PLANET DETAILS"); $db2 = new SmrMySqlDatabase(); if ($player->alliance_id != 0) { $db->query("SELECT planet.sector_id as sector, player.game_id as game, time_attack, attacker_damage, planet_damage, trigger_id FROM player, planet, planet_attack WHERE player.game_id = planet.game_id AND " . "owner_id = account_id AND " . "player.game_id = {$player->game_id} AND " . "planet.game_id = {$player->game_id} AND " . "planet.sector_id = planet_attack.sector_id AND " . "planet.game_id = planet_attack.game_id AND " . "alliance_id = {$player->alliance_id} " . "ORDER BY time_attack DESC"); } else { $db->query("SELECT planet.sector_id as sector, player.game_id as game, time_attack, attacker_damage, planet_damage, trigger_id FROM player, planet, planet_attack WHERE player.game_id = planet.game_id AND " . "owner_id = account_id AND " . "planet.game_id = {$player->game_id} AND " . "planet.sector_id = planet_attack.sector_id AND " . "planet.game_id = planet_attack.game_id AND " . "player.game_id = {$player->game_id} " . "ORDER BY time_attack DESC"); } while ($db->next_record()) { $game_id = $db->f("game"); $sector_id = $db->f("sector"); $time = $db->f("time_attack"); $attacker = new SMR_PLAYER($db->f("trigger_id"), $player->game_id); $att_damage = $db->f("attacker_damage"); $planet_damage = $db->f("planet_damage"); $planet = new SMR_PLANET($db->f("sector"), $player->game_id); print "Planet <span style=font-variant:small-caps>{$planet->planet_name}</span> is under attack by " . $attacker->get_colored_name() . "<br>"; print "This shot was at " . date("n/j/Y g:i:s A", $time) . ". The attacking team did {$att_damage} damage "; print "while the planet did {$planet_damage} damage<br><br>"; }
print "<p><input type=\"text\" name=\"min_rank\" value=\"{$min_rank}\" size=\"3\" id=\"InputFields\" style=\"text-align:center;\"> - <input type=\"text\" name=\"max_rank\" value=\"{$max_rank}\" size=\"3\" id=\"InputFields\" style=\"text-align:center;\"> "; print_submit("Show"); print "</p></form>"; print "<table cellspacing=\"0\" cellpadding=\"5\" border=\"0\" class=\"standard\" width=\"95%\">"; print "<tr>"; print "<th>Rank</th>"; print "<th>Player</th>"; print "<th>Race</th>"; print "<th>Alliance</th>"; print "<th>Deaths</th>"; print "</tr>"; $db->query("SELECT * FROM player WHERE game_id = " . SmrSession::$game_id . " ORDER BY deaths DESC, player_name LIMIT " . ($min_rank - 1) . ", " . ($max_rank - $min_rank + 1)); $rank = $min_rank - 1; while ($db->next_record()) { // get current player $curr_player = new SMR_PLAYER($db->f("account_id"), $player->game_id); // increase rank counter $rank++; print "<tr>"; print "<td valign=\"top\" align=\"center\""; if ($player->account_id == $curr_player->account_id) { print " style=\"font-weight:bold;\""; } print ">{$rank}</td>"; print "<td valign=\"top\""; if ($player->account_id == $curr_player->account_id) { print " style=\"font-weight:bold;\""; } print ">{$curr_player->level_name} "; $container = array(); $container["url"] = "skeleton.php";
<?php require_once get_file_loc("smr_planet.inc"); $planet = new SMR_PLANET($player->sector_id, $player->game_id); $planet_player = new SMR_PLAYER($var["account_id"], SmrSession::$game_id); $owner = new SMR_PLAYER($planet->owner_id, $player->game_id); if ($owner->alliance_id != $player->alliance_id) { create_error("You can not kick someone off a planet your alliance does not own!"); } $message = "You have been kicked from {$planet->planet_name} in #{$player->sector_id}"; $player->send_message($planet_player->account_id, 2, format_string($message, false)); $planet_player->land_on_planet = "FALSE"; //update their last active time so that they are visable if kicked $worst = time() - 1500; if ($planet_player->last_active < $worst) { $planet_player->last_active = $worst; } $planet_player->update(); forward(create_container("skeleton.php", "planet_main.php"));
$player->delete_plotted_course(); // 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]");
} $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);
$db->query("SELECT * FROM player " . "WHERE game_id = {$player->game_id} AND " . "player_name LIKE " . format_string($player_name, true) . " AND player_name != " . format_string($real, true) . " " . "ORDER BY player_name LIMIT 5"); if ($db->nf() > 0) { print "<table border=\"0\" class=\"standard\" cellspacing=\"0\" cellpadding=\"3\" width=\"75%\">"; print "<tr>"; print "<th>Name</th>"; print "<th>Alliance</th>"; print "<th>Race</th>"; print "<th>Experience</th>"; print "<th>Online</th>"; if (in_array($player->account_id, $HIDDEN_PLAYERS)) { print "<th>Sector</th>"; } print "<th>Option</th>"; print "</tr>"; while ($db->next_record()) { $curr_player = new SMR_PLAYER($db->f("account_id"), $player->game_id); $curr_player->get_display_xp_lvl(); print "<tr>"; $container = array(); $container["url"] = "skeleton.php"; $container["body"] = "trader_search_result.php"; $container["player_id"] = $curr_player->player_id; print "<td>"; print_link($container, $curr_player->get_colored_name()); print "<br>"; $db2->query("SELECT * FROM ship_has_name WHERE game_id = {$player->game_id} AND " . "account_id = {$curr_player->account_id}"); if ($db2->next_record()) { //they have a name so we print it $named_ship = stripslashes($db2->f("ship_name")); print "{$named_ship}"; }
$kill_exp = $dead_ppl->f("kill_exp"); // we have to set the 'process' column to true here // BEFORE we give access free to that table. // otherwise another thread could pick this row up // but we cannot delte the entry before we sent that poor guy back to his hq $db->query("UPDATE kills SET processed = 'TRUE' WHERE game_id = {$player->game_id} AND dead_id = {$killed_id} AND killer_id = {$killer_id}"); // give table free $dead_ppl->unlock(); if ($debug) { print "<p>report any errors on that page to spock</p>"; } // create player object // JUST FOR READING!!! // DO NOT CHANGE SOMETHING IN THERE! $killed = new SMR_PLAYER($killed_id, SmrSession::$game_id); $killer = new SMR_PLAYER($killer_id, SmrSession::$game_id); // is one of the dead guys the original attacker or defender? if ($killed_id == $defender_id || $killed_id == $attacker_id) { $container["continue"] = "No"; } // save some time here $killer_name = get_colored_text($killer->alignment, $killer->player_name); $killed_name = get_colored_text($killed->alignment, $killed->player_name); if ($debug) { print "newbie turns<br>"; } $db->query("UPDATE player SET newbie_turns = 100 WHERE account_id = {$killed_id} AND game_id = {$player->game_id}"); if ($debug) { print "insurance<br>"; } // 1/4 of ship value -> insurance
} // get values from container $amount = $var["amount"]; $account_id = $var["account_id"]; if (!$amount) { create_error("You must enter an amount"); } if ($amount < 0) { create_error("You must enter a positive amount"); } // take the bounty from the cash $player->credits -= $amount; $player->update(); $db2 = new SmrMySqlDatabase(); $db->query("SELECT * FROM bounty " . "WHERE game_id = {$player->game_id} AND " . "account_id = {$account_id} AND " . "claimer_id = 0 AND " . "type = '{$type}' LIMIT 1"); $time = time(); if ($db->nf()) { $db->next_record(); //$days = ($time - $db->f("time")) / 60 / 60 / 24; //$curr_amount = $db->f("amount") * pow(1.05,$days); $curr_amount = $db->f("amount"); $new_amount = $curr_amount + $amount; $db2->query("UPDATE bounty SET amount = {$new_amount}, time = {$time} WHERE game_id = {$player->game_id} AND account_id = {$account_id} AND claimer_id = 0 AND type = '{$type}'"); //print("Added bounty....$curr_amount + $amount<br>UPDATE bounty SET amount = $new_amount, time = $time WHERE game_id = $player->game_id AND account_id = $account_id AND type = '$type'"); } else { $db->query("INSERT INTO bounty (account_id, game_id, bounty_id, type, claimer_id, amount, time) VALUES ({$account_id}, {$player->game_id}, NULL, '{$type}' , 0, {$amount}, {$time})"); //print("First<br>INSERT INTO bounty (account_id, game_id, bounty_id, type, claimer_id, amount, time) VALUES ($account_id, $player->game_id, $bounty_id, '$type' , 0, $amount, $time)"); } $placed = new SMR_PLAYER($account_id, $player->game_id); $placed->update_stat("bounty_amount_on", $amount); forward($container);
} $list .= ")"; } $db->query("SELECT * FROM player_cache WHERE account_id IN {$list} AND game_id = {$player->game_id} ORDER BY experience DESC"); if ($db->nf() > 0) { print "<p><table border=\"0\" class=\"standard\" cellspacing=\"0\" align=\"center\" width=\"85%\">"; print "<tr>"; print "<th> </th>"; print "<th>Name</th>"; print "<th>Race</th>"; print "<th>Alliance</th>"; print "<th>Experience</th>"; print "</tr>"; $count = 0; while ($db->next_record()) { $council = new SMR_PLAYER($db->f("account_id"), $player->game_id); $count++; print "<tr>"; print "<td align=\"center\""; if ($council->account_id == $player->account_id) { print " style=\"font-weight:bold;\""; } print ">{$count}.</td>"; print "<td valign=\"middle\""; if ($council->account_id == $player->account_id) { print " style=\"font-weight:bold;\""; } print ">{$council->display_level_name} "; $container = array(); $container["url"] = "skeleton.php"; $container["body"] = "trader_search_result.php";
function do_voodoo() { ob_clean(); global $lock, $var; foreach ($GLOBALS as $key => $value) { ${$key} =& $GLOBALS[$key]; } // initialize objects we usually need, like player, ship if (SmrSession::$game_id > 0) { $db = new SmrMySqlDatabase(); // We need to acquire locks BEFORE getting the player information // Otherwise we could be working on stale information $db->query('SELECT sector_id FROM player WHERE account_id=' . SmrSession::$old_account_id . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1'); $db->next_record(); $sector_id = $db->f('sector_id'); if (!$lock && $var['body'] != 'error.php' && !isset($var['ForwardError'])) { if (!acquire_lock($sector_id)) { create_error("Failed to acquire sector lock"); } } // Now that they've acquire a lock we can move on $player = new SMR_PLAYER(SmrSession::$old_account_id, SmrSession::$game_id); if ($player->dead == 'TRUE' && $var['body'] != 'death.php' && !isset($var['override_death'])) { $container = array(); $container["url"] = "skeleton.php"; $container["body"] = "death.php"; forward($container); } $ship = new SMR_SHIP(SmrSession::$old_account_id, SmrSession::$game_id); // update turns on that player $player->update_turns($ship->speed); if ($player->newbie_turns <= 20 && $player->newbie_warning == "TRUE" && $var["body"] != "newbie_warning.php") { forward(create_container("skeleton.php", "newbie_warning.php")); } } require get_file_loc($var["url"]); SmrSession::update(); if ($lock) { release_lock($lock); } exit; }
function displayMessage($message_id, $sender_id, $message_text, $send_time, $msg_read, $type) { global $player, $account; $replace = explode("!", $message_text); foreach ($replace as $key => $timea) { if (($final = strtotime($timea)) !== false && $timea != "") { $final += $account->offset * 3600; $message_text = str_replace("!{$timea}!", date("n/j/Y g:i:s A", $final), "{$message_text}"); } } $replace = explode("?", $message_text); foreach ($replace as $key => $timea) { if (($final = strtotime($timea)) !== false && $sender_id > 0 && $timea != "") { $send_acc = new SMR_ACCOUNT(); $send_acc->get_by_id($sender_id); $final += $account->offset * 3600 - $send_acc->offset * 3600; $message_text = str_replace("?{$timea}?", date("n/j/Y g:i:s A", $final), "{$message_text}"); } } if (!empty($sender_id)) { $sender = new SMR_PLAYER($sender_id, $player->game_id); } print "<tr>"; print "<td width=\"10\"><input type=\"checkbox\" name=\"message_id[]\" value=\"{$message_id}\">"; // remember id for marking as read if ($msg_read == 'FALSE') { print "*"; } print "</td>"; print "<td nowrap=\"nowrap\" width=\"100%\">From: "; if (!empty($sender_id)) { $container = array(); $container["url"] = "skeleton.php"; $container["body"] = "trader_search_result.php"; $container["player_id"] = $sender->player_id; print_link($container, $sender->get_colored_name()); } else { if ($type == 7) { print "<span style=\"font:small-caps bold;color:blue;\">Administrator</span>"; } elseif ($type == 6) { print "<span class=\"green\">"; print "Alliance Ambassador"; print "</span>"; } elseif ($type == 2) { print "<span class=\"yellow\">Port Defenses</span>"; } else { print "Unknown"; } } print "</td>"; print "<td nowrap=\"nowrap\">Date: " . date("n/j/Y g:i:s A", $send_time) . "</td>"; print "<td>"; $container = array(); $container["url"] = "skeleton.php"; $container["body"] = "message_notify_confirm.php"; $container["message_id"] = $message_id; $container["sent_time"] = $send_time; $container["notified_time"] = time(); print_link($container, "<img src=\"images/notify.gif\" border=\"0\" align=\"right\"title=\"Report this message to an admin\">"); print "</td>"; print "</tr>"; print "<tr>"; print "<td colspan=\"4\">{$message_text}</td>"; print "</tr>"; }
require_once get_file_loc('smr_ship.inc', $databaseInfo['GameType']); while ($db->nextRecord()) { $game_id = $db->getField('game_id'); $index = $databaseClassName . $game_id; $games['Play'][$index]['ID'] = $game_id; $games['Play'][$index]['Name'] = $db->getField('game_name'); $games['Play'][$index]['Type'] = $db->getField('game_type'); $games['Play'][$index]['EndDate'] = $db->getField('end_date'); $games['Play'][$index]['Speed'] = $db->getField('game_speed'); $games['Play'][$index]['Type'] = $db->getField('game_type'); $container = array(); $container['game_id'] = $game_id; $container['url'] = 'game_play_processing.php'; $games['Play'][$index]['PlayGameLink'] = 'loader2.php?sn=' . SmrSession::addLink($container); // creates a new player object $curr_player = new SMR_PLAYER(SmrSession::$old_account_id, $game_id); $curr_ship = new SMR_SHIP(SmrSession::$old_account_id, $game_id); // update turns for this game $curr_player->update_turns($curr_ship->speed); // generate list of game_id that this player is joined $game_id_list[] = $game_id; $db2 = new $databaseClassName(); $db2->query('SELECT count(*) as num_playing FROM player WHERE last_active >= ' . $db->escapeNumber(TIME - 600) . ' AND game_id = ' . $db->escapeNumber($game_id)); $db2->nextRecord(); $games['Play'][$index]['NumberPlaying'] = $db2->getField('num_playing'); // create a container that will hold next url and additional variables. $container_game = array(); $container_game['url'] = 'skeleton.php'; $container_game['body'] = 'game_stats.php';
} // ******************************** // * // * A t t a c k e r s h o o t s // * // ******************************** $attacker_total_msg = array(); $attacker_msg = array(); if ($player->alliance_id != 0) { $db->query("SELECT * FROM player " . "WHERE game_id = {$player->game_id} AND " . "alliance_id = {$player->alliance_id} AND " . "sector_id = {$player->sector_id} AND " . "land_on_planet = 'FALSE' AND " . "newbie_turns = 0 " . "ORDER BY rand() LIMIT 10"); } else { $db->query("SELECT * FROM player " . "WHERE game_id = {$player->game_id} AND " . "sector_id = {$player->sector_id} AND " . "account_id = {$player->account_id} AND " . "land_on_planet = 'FALSE' AND " . "newbie_turns = 0"); } $db2 = new SmrMySqlDatabase(); while ($db->next_record() && ($forces->combat_drones > 0 || $forces->scout_drones > 0 || $forces->mines > 0)) { $curr_attacker = new SMR_PLAYER($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->account_id} 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->combat_drones > 0 || $forces->scout_drones > 0 || $forces->mines > 0)) { $weapon_name = $db2->f("weapon_name"); $shield_damage = $db2->f("shield_damage"); $armor_damage = $db2->f("armor_damage"); $accuracy = $db2->f("accuracy"); if ($forces->mines > 0) { if ($armor_damage > 0) { // mines take 20 armor damage each $mines_dead = round($armor_damage / 20); // more damage than mines?
print "The traders listed in <span style=\"font-style:italic;\">italics</span> are still ranked as Newbie or Beginner.</p>"; $player = new SMR_PLAYER($account->account_id, $game_id); if ($count_last_active > 0) { print "<table cellspacing=\"0\" cellpadding=\"5\" border=\"0\" class=\"standard\" width=\"95%\">"; print "<tr>"; print "<th>Player</th>"; print "<th>Race</th>"; print "<th>Alliance</th>"; print "<th>Experience</th>"; print "</tr>"; while ($db->next_record()) { $curr_account = new SMR_ACCOUNT(); $curr_account->get_by_id($db->f("account_id")); //reset style $style = ""; $curr_player = new SMR_PLAYER($db->f("account_id"), $game_id); if ($curr_account->veteran == "FALSE" && $curr_account->get_rank() < FLEDGLING) { $style = "font-style:italic;"; } if ($curr_player->account_id == $account->account_id) { $style .= "font-weight:bold;"; } if (!empty($style)) { $style = " style=\"{$style}\""; } print "<tr>"; print "<td valign=\"top\"{$style}>{$curr_player->display_level_name} "; $name = $curr_player->get_colored_name(); print "{$name}"; print "</td>"; print "<td align=\"center\"{$style}>";
<?php 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>";
$container["sort"] = "alliance_id"; print "<th>"; print_link($container, "<font color=#80c870>Alliance</font>"); print "</th>"; $container["sort"] = "experience"; print "<th>"; print_link($container, "<font color=#80c870>Experience</font>"); print "</th>"; print "</tr>"; //while ($db->next_record()) { foreach ($exp as $acc_id => $exp) { $curr_account = new SMR_ACCOUNT(); $curr_account->get_by_id($acc_id); //reset style $style = ""; $curr_player = new SMR_PLAYER($acc_id, SmrSession::$game_id); $curr_player->get_display_xp_lvl(); if ($curr_account->veteran == "FALSE" && $curr_account->get_rank() < FLEDGLING) { $style = "font-style:italic;"; } if ($curr_player->account_id == $player->account_id) { $style .= "font-weight:bold;"; } $fullStyle = ''; if (!empty($style)) { $fullStyle = " style=\"{$style}\""; } print "<tr>"; print "<td valign=\"top\"{$fullStyle}>"; $rank = $curr_player->display_level_name; //print("$curr_player->display_level_name ");