コード例 #1
0
function adr_get_monster_infos($monster_id)
{
    global $db, $lang, $phpEx, $phpbb_root_path, $board_config, $table_prefix;
    define('IN_ADR_BATTLE', 1);
    include_once $phpbb_root_path . 'adr/includes/adr_constants.' . $phpEx;
    $cache_config = explode('-', $board_config['Adr_use_cache_system']);
    if ($cache_config[9]) {
        // All the following code has been made by Ptirhiik
        @(include $phpbb_root_path . './adr/cache/cache_monsters.' . $phpEx);
        if (!empty($adr_monsters)) {
            $cached_adr_monsters = $adr_monsters[$monster_id];
        } else {
            $sql = "SELECT * FROM " . ADR_BATTLE_MONSTERS_TABLE . "\n\t\t\t\tWHERE monster_id = '{$monster_id}'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Unable to query monster infos (cache)', '', __LINE__, __FILE__, $sql);
            }
            @(include $phpbb_root_path . './adr/cache/cache_monsters.' . $phpEx);
            if (empty($adr_monsters)) {
                adr_update_monster_infos();
                include $phpbb_root_path . './adr/cache/cache_monsters.' . $phpEx;
                $cached_adr_monsters = $adr_monsters[$monster_id];
            }
        }
    } else {
        $monster_sql = "SELECT * FROM " . ADR_BATTLE_MONSTERS_TABLE . "\n\t\t\tWHERE monster_id = '{$monster_id}'";
        if (!($monster_result = $db->sql_query($monster_sql))) {
            message_die(GENERAL_ERROR, 'Unable to query monster infos (non-cache)', '', __LINE__, __FILE__, $sql);
        }
        $cached_adr_monsters = $db->sql_fetchrow($monster_result);
    }
    return $cached_adr_monsters;
}
コード例 #2
0
ファイル: adr_functions_cache.php プロジェクト: Nekrofage/FJR
function adr_get_monster_infos($monster_id)
{
    global $db, $lang, $phpEx, $phpbb_root_path, $board_config, $table_prefix;
    redefine('IN_ADR_CHARACTER', 1);
    include_once $phpbb_root_path . 'adr/includes/adr_constants.' . $phpEx;
    // All the following code has been made by Ptirhiik
    @(include $phpbb_root_path . './adr/cache/cache_monsters.' . $phpEx);
    if (!empty($adr_monsters)) {
        $cached_adr_monsters = $adr_monsters[$monster_id];
    } else {
        adr_update_monster_infos();
        include $phpbb_root_path . './adr/cache/cache_monsters.' . $phpEx;
        $cached_adr_monsters = $adr_monsters[$monster_id];
    }
    return $cached_adr_monsters;
}