コード例 #1
0
<?php

require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
$good_id = $var["good_id"];
$good_name = $var["good_name"];
$amount = $_REQUEST['amount'];
if (!is_numeric($amount)) {
    create_error("Numbers only please");
}
if ($amount <= 0) {
    create_error("You must actually enter an ammount > 0!");
}
//lets make sure there is actually that much on the ship
if ($amount > $ship->cargo[$good_id]) {
    create_error("You can't dump more than you have.");
}
if ($sector->has_fed_beacon()) {
    create_error("You can't dump cargo in a Federal Sector!");
}
if ($player->turns < 1) {
    create_error("You do not have enough turns to dump cargo!");
}
require_once "shop_goods.inc";
// get the distance
$good_distance = get_good_distance($good_id, "Buy");
$lost_xp = (round($amount / 30) + 1) * 2 * $good_distance;
$player->experience -= $lost_xp;
if ($player->experience < 0) {
    $player->experience = 0;
}
コード例 #2
0
<?php

require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
print_topic("Military Payment Center");
include get_file_loc('menue.inc');
if ($sector->has_hq()) {
    print_hq_menue();
} else {
    print_ug_menue();
}
if ($player->military_payment > 0) {
    print "For your military help you have been paid <font color=yellow>{$player->military_payment}</font> credits";
    $player->update_stat("military_claimed", $player->military_payment);
    // add to our cash
    $player->credits += $player->military_payment;
    $player->military_payment = 0;
    $player->update();
} else {
    print "You have done nothing worthy of military payment";
}
コード例 #3
0
ファイル: bar_main.php プロジェクト: smrealms/smrv2.0
<?php

require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
//first check if there is a bar here
if (!$sector->has_bar()) {
    create_error("So two guys walk into this bar...");
}
//get script to include
if (isset($var["script"])) {
    $script = $var["script"];
} else {
    $script = "bar_opening.php";
}
//if ($script == 'bar_gambling_bet.php') create_error("Blackjack is currently outlawed, you will have to come back later.");
//get bar name
$db->query("SELECT location_name FROM location_type NATURAL JOIN location WHERE game_id = {$player->game_id} AND sector_id = {$player->sector_id} AND location_type.location_type_id > 800 AND location_type.location_type_id < 900");
//next welcome them
if ($db->next_record()) {
    print_topic("Welcome to " . $db->f("location_name") . ".");
} else {
    print_topic("Welcome to this bar");
}
//include menu (not menue ;) )
include get_file_loc('menue.inc');
print_bar_menue();
//get rid of drinks older than 30 mins
$time = time() - 1800;
$db->query("DELETE FROM player_has_drinks WHERE time < {$time}");
//include bar part
include get_file_loc("{$script}");
コード例 #4
0
<?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_port.inc");
require_once get_file_loc("smr_battle.inc");
$port = new SMR_PORT($player->sector_id, $player->game_id);
if ($player->newbie_turns > 0) {
    create_error("You are under newbie protection!");
}
if ($player->is_fed_protected()) {
    create_error("You are under federal protection! That wouldn't be fair.");
}
if (!$sector->has_port()) {
    create_error("There is no port in that sector!");
}
// check if he got enough turns
if ($player->get_info('turns') < 3) {
    create_error("You do not have enough turns to attack this port!");
}
$db->query("SELECT * FROM ship_has_weapon NATURAL JOIN weapon_type " . "WHERE account_id = {$player->account_id} AND " . "game_id = {$player->game_id} " . "ORDER BY order_id");
if (!$db->next_record()) {
    //do we have drones to attack?
    $db->query("SELECT * FROM ship_has_hardware WHERE hardware_type_id = HARDWARE_COMBAT AND account_id = {$player->account_id} AND game_id = {$player->game_id}");
    if (!$db->next_record()) {
        create_error("What are you gonna do? Insult it to death?");
    }
}
//set the attack start time
$time = time();
//only 1 shot per 2 seconds (stop double port raids)
コード例 #5
0
<?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_battle.inc");
if (isset($_COOKIE["Legit"])) {
    setcookie("Legit", 2, time() - 3600);
    $db->query("SELECT * FROM macro_check WHERE account_id = {$player->account_id}");
    if ($db->next_record()) {
        $db->query("UPDATE macro_check SET good = good + 1 WHERE account_id = {$player->account_id}");
    } else {
        $db->query("REPLACE INTO macro_check (account_id, good) VALUES ({$player->account_id}, 1)");
    }
} elseif (!$var["legit"]) {
    $db->query("SELECT * FROM macro_check WHERE account_id = {$player->account_id}");
    if ($db->next_record()) {
        $db->query("UPDATE macro_check SET bad = bad + 1 WHERE account_id = {$player->account_id}");
    } else {
        $db->query("REPLACE INTO macro_check (account_id, bad) VALUES ({$player->account_id}, 1)");
    }
}
//this might help
include get_file_loc("trader_attack.inc");
$db2 = new SmrMySqlDatabase();
// initialize random generator.
mt_srand((double) microtime() * 1000000);
// creates a new player object for attacker and defender
$attacker_id = SmrSession::$old_account_id;
$defender_id = $var["target"];
$attacker_team = new SMR_BATTLE($attacker_id, SmrSession::$game_id);
$defender_team = new SMR_BATTLE($defender_id, SmrSession::$game_id);
コード例 #6
0
ファイル: sector_scan.php プロジェクト: smrealms/smrv2.0
print "</tr>";
print "<tr>";
print "<td>Enemy vessels</td>";
print "<td align=\"center\">{$enemy_vessel}</td>";
print "</tr>";
print "<tr>";
print "<td>Friendly forces</td>";
print "<td align=\"center\">{$friendly_forces}</td>";
print "</tr>";
print "<tr>";
print "<td>Enemy forces</td>";
print "<td align=\"center\">{$enemy_forces}</td>";
print "</tr>";
print "</table>";
print "</p>";
$target_sector = new SMR_SECTOR($var["target_sector"], SmrSession::$game_id, SmrSession::$old_account_id);
print "<p>";
print "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" class=\"standard\">";
print "<tr>";
print "<td>Planet</td>";
print "<td>";
if ($target_sector->has_planet()) {
    print "Yes";
} else {
    print "No";
}
print "</td>";
print "</tr>";
print "<tr>";
print "<td>Port</td>";
print "<td>";
コード例 #7
0
    $distance = $db->f('distance');
    if ($path_list[0] == $var['target_sector']) {
        array_shift($path_list);
        $distance -= $turns;
        // write back to db
        if (!empty($path_list)) {
            $db->query("UPDATE player_plotted_course SET distance = {$distance}, course = '" . addslashes(serialize($path_list)) . "' WHERE account_id = {$player->account_id} AND game_id = {$player->game_id} LIMIT 1");
        } else {
            $db->query("DELETE FROM player_plotted_course WHERE account_id = {$player->account_id} AND game_id = {$player->game_id}");
        }
    } else {
        $db->query("DELETE FROM player_plotted_course WHERE account_id = {$player->account_id} AND game_id = {$player->game_id}");
    }
}
// get new sector object
$sector = new SMR_SECTOR($player->sector_id, $player->game_id, $player->account_id);
//add that the player explored here if it hasnt been explored...for HoF
$db->query("SELECT account_id FROM player_visited_sector WHERE game_id = {$player->game_id} AND sector_id = " . $var['target_sector'] . " AND account_id = {$player->account_id} LIMIT 1");
if (!$sector->visited) {
    $player->update_stat('sectors_explored', 1);
}
// We only bother updating if there's a port in sector
if (!$sector->visited || $sector->port_visited) {
    // make current sector visible to him
    $sector->mark_visited();
}
// send scout msgs
$db->query(get_forces_query($gal_ids[$var['target_sector']]));
$mine_owner_id = false;
$scout_owners = array();
while ($db->next_record()) {
コード例 #8
0
ファイル: port_attack.php プロジェクト: smrealms/smrv2.0
<?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_port.inc");
//kill the dead people
/*
$dead_traders = $var["dead_traders"];
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();

}*/
//make sure the planet is actually alive
if (!isset($var["dead"])) {
    print "<p><big><b>Port Results</b></big></p>";
    foreach ($var["portdamage"] as $msg) {
        //all this info comes from the last page look there for more info
        //this is the planet shooting.
        print "{$msg}<br>";
    }
    // port shot show the pic
    print "<p><img src=\"images/creonti_cruiser.jpg\"></p>";
    print "<p><big><b>Attacker Results</b></big></p>";
    //now we need to get the player shooting results
    foreach ($var["attacker"] as $playerdamage) {
        foreach ($playerdamage as $msg) {
            //same as above...came from port_attack_processing.php
コード例 #9
0
$sector->leaving_sector();
//set the last sector
$player->last_sector_id = $sector->sector_id;
// Move the user around (Must be done while holding both sector locks)
$player->take_turns(15);
$player->sector_change();
$player->detected = 'false';
$player->update();
// We need to release the lock on our old sector
release_lock();
// We need a lock on the new sector so that more than one person isn't hitting the same mines
acquire_lock($player->sector_id);
// delete plotted course
$db->query("DELETE FROM player_plotted_course " . "WHERE account_id = {$player->account_id} AND " . "game_id = {$player->game_id}");
// get new sector object
$sector = new SMR_SECTOR($player->sector_id, $player->game_id, $player->account_id);
// make current sector visible to him
$sector->mark_visited();
// send scout msg
$sector->entering_sector();
$db->query("SELECT * FROM sector_has_forces, player " . "WHERE sector_has_forces.game_id = player.game_id AND " . "sector_has_forces.owner_id = player.account_id AND " . "sector_has_forces.game_id = {$player->game_id} AND " . "sector_has_forces.sector_id = {$player->sector_id} AND " . "mines > 0 AND " . "owner_id != {$player->account_id} AND " . "(alliance_id != {$player->alliance_id} OR alliance_id = 0)");
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;
        }
    }