function getPortArray()
{
    if (DEBUG) {
        print "Entered port array<br>";
    }
    global $db, $player;
    $db->query("SELECT  * FROM port WHERE sector_id = " . $player->sector_id . " AND game_id = " . $player->game_id);
    if ($db->next_record()) {
        $started = $db->f("attack_started");
        $refresh = $db->f("refresh_defense");
        $level = $db->f("level");
        if ($refresh < TIME) {
            //add news message
            processNews();
            //defences restock (check for fed arrival)
            $minsToStay = 30;
            if ($refresh + $minsToStay * 60 > TIME) {
                $federal_mod = (TIME - $refresh - $minsToStay * 60) / (-6 * $minsToStay);
            } else {
                $federal_mod = 0;
            }
            if ($federal_mod < 0) {
                $federal_mod = 0;
            }
            $rich_mod = floor($db->f("credits") * 1.0E-7);
            if ($rich_mod < 0) {
                $rich_mod = 0;
            }
            $shields = round($level * 1000 + 1000 + $rich_mod * 500 + $federal_mod * 500);
            $armor = round($level * 1000 + 1000 + $rich_mod * 500 + $federal_mod * 500);
            $drones = round($level * 100 + 100 + $rich_mod * 50 + $federal_mod * 50);
            $refresh = TIME + $level * 5 * 60;
            $started = TIME;
        } else {
            $shields = $db->f("shields");
            $armor = $db->f("armor");
            $drones = $db->f("drones");
        }
        $port = array($shields, $drones, $armor, $started, $level, array(), $refresh, $db->f("race_id"));
        $port[PORT_CREDITS] = $db->f("credits");
    } else {
        create_error("Port does not exist");
    }
    if ($port[PORT_ARMOR] == 0 && $port[PORT_SHIELDS] == 0) {
        $container = create_container('skeleton.php', 'port_attack_new.php');
        $container['continue'] = FALSE;
        forward($container);
    }
    return $port;
}
예제 #2
0
function getPortArray()
{
    if (DEBUG) {
        $PHP_OUTPUT .= 'Entered port array<br>';
    }
    global $db, $player;
    $db->query('SELECT  * FROM port WHERE sector_id = ' . $player->getSectorID() . ' AND game_id = ' . $player->getGameID());
    if ($db->next_record()) {
        $started = $db->f('attack_started');
        $refresh = $db->f('reinforce_time');
        $level = $db->f('level');
        if ($refresh < TIME) {
            //add news message
            processNews();
            //defences restock (check for fed arrival)
            $minsToStay = 30;
            if ($refresh + $minsToStay * 60 > TIME) {
                $federal_mod = (TIME - $refresh - $minsToStay * 60) / (-6 * $minsToStay);
            } else {
                $federal_mod = 0;
            }
            if ($federal_mod < 0) {
                $federal_mod = 0;
            }
            $rich_mod = floor($db->f('credits') * 1.0E-7);
            if ($rich_mod < 0) {
                $rich_mod = 0;
            }
            $shields = round($level * 1000 + 1000 + $rich_mod * 500 + $federal_mod * 500);
            $armour = round($level * 1000 + 1000 + $rich_mod * 500 + $federal_mod * 500);
            $drones = round($level * 100 + 100 + $rich_mod * 50 + $federal_mod * 50);
            $refresh = TIME + $level * 5 * 60;
            $started = TIME;
        } else {
            $shields = $db->f('shields');
            $armour = $db->f('armour');
            $drones = $db->f('combat_drones');
        }
        $port = array($shields, $drones, $armour, $started, $level, array(), $refresh, $db->f('race_id'));
        $port[PORT_CREDITS] = $db->f('credits');
    } else {
        create_error('Port does not exist');
    }
    if ($port[PORT_ARMOUR] == 0 && $port[PORT_SHIELDS] == 0) {
        $container = create_container('skeleton.php', 'port_attack.php');
        $container['continue'] = FALSE;
        forward($container);
    }
    return $port;
}
예제 #3
0
if (DEBUG) {
    print "Level is still set to " . $planet[PLANET_LEVEL] . "<br>";
}
//$players contains all player info for the trigger and his alliance IS
$players = getPlayerArray();
//$weapons contains info for weapons being used this battle
$weapons = getWeapons(getHardware($players));
if (!sizeof($players[$player->account_id][WEAPONS])) {
    create_error("What are you going to do?  Insult it to death?");
}
//in case there are more than 10 players IS.  $fleet contains account_ids of the attackers
$fleet = getFleet($players, $weapons);
if (DEBUG) {
    print "Pre news<br>";
}
processNews($fleet, $planet);
hofTracker($players, $planet);
// Take off the 3 turns for attacking
$player->take_turns(3);
$player->update();
// fire shots
if (DEBUG) {
    print "Pre Shots<br>";
}
planetFires($fleet, $planet, $players);
fleetFires($fleet, $planet, $players, $weapons);
//get results in a way we want them
$results = processResults($players, $planet, $fleet, $weapons);
//post on alliances MB or send to player
planetDowngrade($results, $planet);
sendReport($results, $planet);