Exemplo n.º 1
0
    }
    //used for include if we need a spec game script outside of the game
    $overrideGameID = 0;
    if (isset($var['game_id']) && is_numeric($var['game_id'])) {
        $overrideGameID = $var['game_id'];
    }
    if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) {
        $overrideGameID = $var['GameID'];
    }
    if ($overrideGameID == 0) {
        $overrideGameID = SmrSession::$game_id;
    }
    require_once get_file_loc('SmrAccount.class.inc');
    $account =& SmrAccount::getAccount(SmrSession::$account_id);
    // get reason for disabled user
    if (($disabled = $account->isDisabled()) !== false) {
        // save session (incase we forward)
        SmrSession::update();
        if ($disabled['Reason'] == 'Invalid eMail') {
            header('Location: ' . URL . '/email.php');
            exit;
        } else {
            header('Location: ' . URL . '/disabled.php');
            exit;
        }
    }
    require_once get_file_loc('smr.inc');
    do_voodoo();
} catch (Exception $e) {
    handleException($e);
}
Exemplo n.º 2
0
function processContainer($container)
{
    global $forwardedContainer, $previousContainer, $player;
    if ($container == $previousContainer && $forwardedContainer['body'] != 'forces_attack.php') {
        debug('We are executing the same container twice?', array('ForwardedContainer' => $forwardedContainer, 'Container' => $container));
        if ($player->hasNewbieTurns() || $player->hasFederalProtection()) {
            // Only throw the exception if we have protection, otherwise let's hope that the NPC will be able to find its way to safety rather than dying in the open.
            throw new Exception('We are executing the same container twice?');
        }
    }
    clearCaches();
    //Clear caches of anything we have used for decision making before processing container and getting lock.
    $previousContainer = $container;
    debug('Executing container', $container);
    //Redefine MICRO_TIME and TIME, the rest of the game expects them to be the single point in time that the script is executing, with it being redefined for each page load - unfortunately NPCs are one consistent script so we have to do a hack and redefine it (or change every instance of the TIME constant.
    runkit_constant_redefine('MICRO_TIME', microtime());
    runkit_constant_redefine('TIME', (int) microtimeSec(MICRO_TIME));
    resetContainer($container);
    do_voodoo();
}