require_once get_file_loc("smr_planet.inc");
$amount = $_REQUEST['amount'];
if (!is_numeric($amount)) {
    create_error("Numbers only please");
}
// only whole numbers allowed
$amount = round($amount);
if ($amount <= 0) {
    create_error("You must actually enter an amount > 0!");
}
if ($player->newbie_turns > 0) {
    create_error("You can't drop defenses under newbie protection!");
}
// get a planet from the sector where the player is in
$planet = new SMR_PLANET($player->sector_id, SmrSession::$game_id);
$type_id = $var["type_id"];
$action = $_REQUEST['action'];
// transfer to ship
if ($action == "Ship") {
    include get_file_loc('planet_defenses_disallow.php');
    // do the user wants to transfer shields?
    if ($type_id == 1) {
        // do we want transfer more than we have?
        if ($amount > $planet->shields) {
            create_error("You can't take more shields from planet than are on it!");
        }
        // do we want to transfer more than we can carry?
        if ($amount > $ship->max_hardware[1] - $ship->hardware[1]) {
            create_error("You can't take more shields than you can carry!");
        }
Esempio n. 2
0
<?php

require_once get_file_loc("smr_planet.inc");
if ($player->land_on_planet == "FALSE") {
    print_error("You are not on a planet!");
    return;
}
// create planet object
$planet = new SMR_PLANET($player->sector_id, $player->game_id);
$planet->build();
print_topic("PLANET : {$planet->planet_name} [SECTOR #{$player->sector_id}]");
include get_file_loc('menue.inc');
print_planet_menue();
//print the dump cargo message or other message.
if (isset($var["msg"])) {
    print $var["msg"] . "<br>";
}
print "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" class=\"standard\">";
print "<tr>";
print "<th width=\"125\">&nbsp;</th>";
print "<th width=\"75\">Current</th>";
print "<th width=\"75\">Max</th>";
print "</tr>";
print "<tr>";
print "<td>Generator</td><td align=\"center\">";
print $planet->construction[1];
print "</td><td align=\"center\">";
print $planet->max_construction[1];
print "</td>";
print "</tr>";
print "<tr>";
Esempio n. 3
0
<?php

require_once get_file_loc("smr_planet.inc");
// get a planet from the sector where the player is in
$planet = new SMR_PLANET($player->sector_id, $player->game_id);
// owner of planet
if ($planet->owner_id != 0) {
    $planet_owner = new SMR_PLAYER($planet->owner_id, SmrSession::$game_id);
    $ownerAllianceID = $planet_owner->alliance_id;
} else {
    $ownerAllianceID = 0;
}
print_topic("Examine Planet");
print "<table>";
print "<tr><td><b>Planet Name:</b></td><td>{$planet->planet_name}</td></tr>";
print "<tr><td><b>Level:</b></td><td>" . $planet->level() . "</td></tr>";
print "<tr><td><b>Owner:</b></td><td>";
if ($planet->owner_id != 0) {
    print $planet_owner->player_name;
} else {
    print "Unclaimed";
}
print "</td></tr>";
print "<tr><td><b>Alliance:</b></td><td>";
if ($planet->owner_id != 0) {
    print $planet_owner->alliance_name;
} else {
    print "none";
}
print "</td></tr>";
print "</table>";
Esempio n. 4
0
<?php

require_once get_file_loc("smr_planet.inc");
if ($player->land_on_planet == "FALSE") {
    print_error("You are not on a planet!");
    return;
}
// create planet object
$planet = new SMR_PLANET($player->sector_id, $player->game_id);
$planet->build();
print_topic("PLANET : {$planet->planet_name} [SECTOR #{$player->sector_id}]");
include get_file_loc('menue.inc');
print_planet_menue();
if ($planet->build()) {
    $db->query("SELECT * FROM planet_build_construction NATURAL JOIN planet_construction " . "WHERE game_id = {$player->game_id} AND " . "sector_id = {$player->sector_id}");
    if ($db->next_record()) {
        $construction_name = $db->f("construction_name");
        $construction_id = $db->f("construction_id");
        $time_left = $db->f("time_complete") - time();
    }
    $hours = floor($time_left / 3600);
    $minutes = floor(($time_left - $hours * 3600) / 60);
    $seconds = $time_left - $hours * 3600 - $minutes * 60;
    print "<p>You are currently building: {$construction_name}.<br>";
    print "Finished in ";
    if ($hours > 0) {
        if ($hours == 1) {
            print "{$hours} hour";
        } else {
            print "{$hours} hours";
        }
<?php

require_once get_file_loc("smr_planet.inc");
$planet = new SMR_PLANET($player->sector_id, $player->game_id);
$action = $_REQUEST['action'];
if ($action == "Build") {
    if ($planet->build()) {
        create_error("There is already a building in progress!");
    }
    $player->credits -= $var["cost"];
    $player->update();
    // now start the construction
    $planet->start_construction($var["construction_id"]);
    $db->query("SELECT * FROM planet_construction WHERE construction_id = " . $var["construction_id"]);
    $db->next_record();
    $name = $db->f("construction_name");
    $account->log(11, "Player starts a {$name} on planet.", $player->sector_id);
} elseif ($action == "Cancel") {
    $db->query("DELETE FROM planet_build_construction WHERE sector_id = {$player->sector_id} AND game_id = {$player->game_id}");
    $account->log(11, "Player cancels planet construction", $player->sector_id);
}
forward(create_container("skeleton.php", "planet_construction.php"));
Esempio n. 6
0
<?php

require_once get_file_loc("smr_planet.inc");
if ($player->land_on_planet == "FALSE") {
    print_error("You are not on a planet!");
    return;
}
// create planet object
$planet = new SMR_PLANET($player->sector_id, $player->game_id);
$planet->build();
print_topic("PLANET : {$planet->planet_name} [SECTOR #{$player->sector_id}]");
include get_file_loc('menue.inc');
print_planet_menue();
print "<p>";
print "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" class=\"standard\">";
print "<tr>";
print "<th>Good</th>";
print "<th>Ship</th>";
print "<th>Planet</th>";
print "<th>Amount</th>";
print "<th>Transfer to</th>";
print "</tr>";
$db->query("SELECT * FROM good ORDER BY good_id");
while ($db->next_record()) {
    $good_id = $db->f("good_id");
    $good_name = $db->f("good_name");
    if (empty($ship->cargo[$good_id]) && empty($planet->stockpile[$good_id])) {
        continue;
    }
    $container = array();
    $container["url"] = "planet_stockpile_processing.php";
Esempio n. 7
0
 print "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" class=\"standard\" width=\"95%\">";
 print "<tr>";
 print "<th align=\"center\">Name</th>";
 print "<th align=\"center\">Owner</th>";
 print "<th align=\"center\">Sector</th>";
 print "<th align=\"center\">Galaxy</th>";
 print "<th align=\"center\">G</th>";
 print "<th align=\"center\">H</th>";
 print "<th align=\"center\">T</th>";
 print "<th align=\"center\">Build</th>";
 print "<th align=\"center\">Shields</th>";
 print "<th align=\"center\">Drones</th>";
 print "<th align=\"center\">Supplies</th>";
 print "</tr>";
 while ($db->next_record()) {
     $planet = new SMR_PLANET($db->f("sector_id"), SmrSession::$game_id);
     $planet_sector = new SMR_SECTOR($db->f("sector_id"), SmrSession::$game_id, SmrSession::$old_account_id);
     $planet_owner = new SMR_PLAYER($planet->owner_id, SmrSession::$game_id);
     $planet->build();
     print "<tr>";
     print "<td>{$planet->planet_name}</td>";
     print "<td>{$planet_owner->player_name}</td>";
     print "<td align=\"center\">{$planet->sector_id}</td>";
     print "<td align=\"center\">{$planet_sector->galaxy_name}</td>";
     print "<td align=\"center\">" . $planet->construction[1] . "</td>";
     print "<td align=\"center\">" . $planet->construction[2] . "</td>";
     print "<td align=\"center\">" . $planet->construction[3] . "</td>";
     print "<td align=\"center\">";
     if ($planet->build()) {
         print "{$planet->current_building_name}<br>";
         print print_time($planet->time_left);
Esempio n. 8
0
<?php

require_once get_file_loc("smr_planet.inc");
if ($player->land_on_planet == "FALSE") {
    print_error("You are not on a planet!");
    return;
}
// create planet object
$planet = new SMR_PLANET($player->sector_id, $player->game_id);
$planet->build();
print_topic("PLANET : {$planet->planet_name} [SECTOR #{$player->sector_id}]");
include get_file_loc('menue.inc');
print_planet_menue();
$curr_time = time();
$lvl = $planet->level();
if ($lvl < 9) {
    $base = 1.02;
} elseif ($lvl < 19) {
    $base = 1.03;
} elseif ($lvl < 29) {
    $base = 1.06;
} elseif ($lvl < 39) {
    $base = 1.025;
} elseif ($lvl < 49) {
    $base = 1.02;
} elseif ($lvl < 59) {
    $base = 1.015;
} elseif ($lvl < 69) {
    $base = 1.01;
} else {
    $base = 1.009;
<?php

require_once get_file_loc("smr_planet.inc");
$amount = $_REQUEST['amount'];
if (!is_numeric($amount)) {
    create_error("Numbers only please");
}
$amount = floor($amount);
if ($amount <= 0) {
    create_error("You must actually enter an ammount > 0!");
}
// get a planet from the sector where the player is in
$planet = new SMR_PLANET($player->sector_id, SmrSession::$game_id);
$action = $_REQUEST['action'];
// transfer to ship
if ($action == "Ship") {
    // do we want transfer more than we have?
    if ($amount > $planet->stockpile[$var["good_id"]]) {
        create_error("You can't take more than on planet!");
    }
    // do we want to transfer more than we can carry?
    if ($amount > $ship->cargo_left) {
        create_error("You can't take more than you can carry!");
    }
    // now transfer
    $planet->stockpile[$var["good_id"]] -= $amount;
    $ship->cargo[$var["good_id"]] += $amount;
    $db->query("SELECT * FROM good WHERE good_id = {$var['good_id']}");
    $db->next_record();
    $good_name = $db->f("good_name");
    $account->log(11, "Player takes {$amount} {$good_name} from planet.", $player->sector_id);