コード例 #1
0
ファイル: game.php プロジェクト: AdrianMarceau/mmrpg-world
// Define the default SEO and MARKUP variables
$this_seo_title = 'Game | Mega Man RPG World | Last Updated ' . preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})-([0-9]{2})#', '$1/$2/$3', MMRPG_CONFIG_CACHE_DATE);
$this_seo_keywords = 'megaman,mega man,protoman,proto man,bass,rpg,prototype,dr.light,dr.wily,dr.cossack,battle,browser,pbbg,ipad,firefox,chrome,safari';
$this_seo_description = 'Battle through more than thirty robot masters in classic RPG style with either Dr. Light and Mega Man, Dr. Wily and Bass, or Dr. Cossack and Proto Man! Mega Man RPG World is a browser-based fangame that combines the mechanics of both the Pokémon and Mega Man series of video games into one strange and wonderful little time waster.';
// Define the default Open Graph tag variables
$this_graph_data = array('title' => 'Mega Man RPG World', 'type' => 'website', 'url' => $this_current_url, 'image' => MMRPG_CONFIG_ROOTURL . 'images/assets/mmrpg-prototype-logo.png?' . MMRPG_CONFIG_CACHE_DATE, 'site_name' => 'Mega Man RPG World', 'description' => $this_seo_description);
// If a reset was intentionally called
if (!empty($_GET['reset']) || rpg_game::is_demo() && !empty($_SESSION['GAME']['CACHE_DATE']) && $_SESSION['GAME']['CACHE_DATE'] != MMRPG_CONFIG_CACHE_DATE) {
    // Reset the game session
    rpg_game::reset_session();
} elseif (rpg_game::is_demo() && !empty($_SESSION['GAME']['CACHE_DATE']) && $_SESSION['GAME']['CACHE_DATE'] != MMRPG_CONFIG_CACHE_DATE) {
    // Reset the game session
    rpg_game::reset_session();
} elseif (!empty($_GET['reload']) || !isset($_SESSION['GAME']['CACHE_DATE']) || rpg_game::is_demo() && $_SESSION['GAME']['CACHE_DATE'] != MMRPG_CONFIG_CACHE_DATE) {
    // Ensure there is a save file to load
    if (rpg_user::is_member()) {
        // Load the save file into memory and overwrite the session
        rpg_game::load_session();
    } else {
        // Reset the game session
        rpg_game::reset_session();
    }
    // Update the cache date to reflect the reload
    $_SESSION['GAME']['CACHE_DATE'] = MMRPG_CONFIG_CACHE_DATE;
    // Save the updated file back to the system
    rpg_game::save_session();
}
// Automatically empty all temporary battle variables
$_SESSION['BATTLES'] = array();
$_SESSION['FIELDS'] = array();
$_SESSION['PLAYERS'] = array();
コード例 #2
0
ファイル: battle.php プロジェクト: AdrianMarceau/mmrpg-world
    // Collect the battle target menus markup
    $actions_markup['target_target'] = rpg_battle::get_menu_markup($objects, 'target_target');
    $actions_markup['target_this'] = rpg_battle::get_menu_markup($objects, 'target_this');
    $actions_markup['target_this_disabled'] = rpg_battle::get_menu_markup($objects, 'target_this_disabled');
    // Collect the battle scan menu markup
    $actions_markup['scan'] = rpg_battle::get_menu_markup($objects, 'scan');
    // Collect the battle menu markup
    $actions_markup['battle'] = rpg_battle::get_menu_markup($objects, 'battle');
} elseif (empty($this_redirect) && $this_battle_status == 'complete') {
    // Collect the battle options menu markup
    $actions_markup['option'] = rpg_battle::get_menu_markup($objects, 'option');
    // Collect the battle complete menu markup
    $actions_markup['complete'] = rpg_battle::get_menu_markup($objects, 'complete');
}
// If possible, attempt to save the game to the session with recent changes
if (rpg_user::is_member() && $this_battle_status == 'complete') {
    // Save the game session
    rpg_game::save_session();
}
// Determine the next action based on everything that's happened
if (empty($this_redirect)) {
    $this_next_action = 'battle';
    $this_robot_status = $this_robot->get_status();
    $this_robot_position = $this_robot->get_position();
    if (($this_robot_status == 'disabled' || $this_robot_position != 'active') && $this_battle_status != 'complete') {
        $this_next_action = 'switch';
    }
}
// Stop the output buffer and collect contents
$output_buffer_contents = trim(ob_get_clean());
?>