当前位置: 首页>>代码示例>>PHP>>正文


PHP adr_get_general_config函数代码示例

本文整理汇总了PHP中adr_get_general_config函数的典型用法代码示例。如果您正苦于以下问题:PHP adr_get_general_config函数的具体用法?PHP adr_get_general_config怎么用?PHP adr_get_general_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了adr_get_general_config函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: define

define('IN_ADR_CHARACTER', true);
$phpbb_root_path = './';
include_once $phpbb_root_path . 'extension.inc';
include_once $phpbb_root_path . 'common.' . $phpEx;
//
// Start session management
$userdata = session_pagestart($user_ip, PAGE_ADR);
init_userprefs($userdata);
// End session management
//
$user_id = $userdata['user_id'];
include_once $phpbb_root_path . 'adr/includes/adr_global.' . $phpEx;
// Sorry , only logged users ...
if (!$userdata['session_logged_in']) {
    $redirect = "adr_character.{$phpEx}";
    $redirect .= isset($user_id) ? '&user_id=' . $user_id : '';
    header('Location: ' . append_sid("login.{$phpEx}?redirect={$redirect}", true));
}
// Includes the tpl and the header
adr_template_file('adr_tower_body.tpl');
include_once $phpbb_root_path . 'includes/page_header.' . $phpEx;
// Get the general config and character infos
$adr_general = adr_get_general_config();
adr_enable_check();
adr_ban_check($user_id);
adr_character_created_check($user_id);
$adr_user = adr_get_user_infos($user_id);
$template->assign_vars(array('L_ZONE_TOWER' => $lang['Adr_zone_tower_title'], 'L_ZONE_CHARACTER_SKILLS' => $lang['Adr_zone_character_skills'], 'L_ZONE_CHARACTER_EQUIP' => $lang['Adr_zone_character_equip'], 'U_ZONE_CHARACTER_SKILLS' => append_sid("adr_character_skills.{$phpEx}"), 'U_ZONE_CHARACTER_EQUIP' => append_sid("adr_character_equipment.{$phpEx}"), 'S_ZONES_ACTION' => append_sid("adr_tower.{$phpEx}")));
include $phpbb_root_path . 'adr/includes/adr_header.' . $phpEx;
$template->pparse('body');
include_once $phpbb_root_path . 'includes/page_tail.' . $phpEx;
开发者ID:Nekrofage,项目名称:FJR,代码行数:31,代码来源:adr_tower.php

示例2: adr_use_skill_stone

function adr_use_skill_stone($user_id, $tool, $item_to_repair)
{
    global $db;
    $user_id = intval($user_id);
    $tool = intval($tool);
    $item_to_repair = intval($item_to_repair);
    $success = 0;
    $adr_general = adr_get_general_config();
    // START skill limit check
    $sql = " SELECT character_skill_limit FROM " . ADR_CHARACTERS_TABLE . "\n\t\t\tWHERE character_id = {$user_id} ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not query skill limit value', '', __LINE__, __FILE__, $sql);
    }
    $limit_check = $db->sql_fetchrow($result);
    if ($adr_general['Adr_character_limit_enable'] != 0 && $limit_check['character_skill_limit'] < 1) {
        adr_previous(Adr_skill_limit, adr_town, '');
    }
    // END skill limit check
    // Alter the tool
    adr_use_item($tool, $user_id);
    $adr_general = adr_get_general_config();
    $adr_user = adr_get_user_infos($user_id);
    $skill_data = adr_get_skill_data(2);
    $user_chance = $adr_user['character_skill_stone'] * $skill_data['skill_chance'];
    $user_chance = $user_chance > 100 ? 100 : $user_chance;
    $rand = rand(0, 100);
    // At first let's introduce a little fun
    if ($rand < 5) {
        // Destroy the item
        $success = -1;
        $sql = " DELETE FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\tWHERE item_in_shop = 0 \n\t\t\tAND item_owner_id = {$user_id} \n\t\t\tAND item_id = {$item_to_repair} ";
        if (!$db->sql_query($sql)) {
            message_die(GENERAL_ERROR, 'Could not update item information', "", __LINE__, __FILE__, $sql);
        }
    } else {
        if ($user_chance > $rand && $rand > 4) {
            $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\tWHERE item_in_shop = 0 \n\t\t\tAND item_owner_id = {$user_id} \n\t\t\tAND item_id = {$tool} ";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query tool informations', '', __LINE__, __FILE__, $sql);
            }
            $tool_data = $db->sql_fetchrow($result);
            $modif = $tool_data['item_quality'] > 3 ? $tool_data['item_quality'] - 3 : 0;
            $modif = $modif + ($tool_data['item_power'] - 1);
            $repair_power = floor(($modif + $adr_user['character_skill_stone']) / 2);
            $success = $repair_power;
            adr_skill_limit($user_id);
            // Check max dura
            $sql = "SELECT item_duration, item_duration_max FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\tWHERE item_owner_id = '{$user_id}'\n\t\t\tAND item_id = '{$item_to_repair}'";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not query tool informations', '', __LINE__, __FILE__, $sql);
            }
            $max_dura_check = $db->sql_fetchrow($result);
            $new_max_dura = $max_dura_check['item_duration'] + $repair_power > $max_dura_check['item_duration_max'] ? $max_dura_check['item_duration'] + $repair_power : $max_dura_check['item_duration_max'];
            $sql = " UPDATE " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\tSET item_duration = item_duration + {$repair_power} ,\n\t\t\t\titem_duration_max = {$new_max_dura},\n\t\t\t    item_quality = item_quality + 1\n\t\t\tWHERE item_in_shop = 0\n\t\t\tAND item_quality < 5\n\t\t\tAND item_owner_id = {$user_id}\n\t\t\tAND item_id = {$item_to_repair} ";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not update item informations', '', __LINE__, __FILE__, $sql);
            }
            // Increases the success uses of this skill and increase level if needed
            if ($adr_user['character_skill_stone_uses'] + 1 >= $skill_data['skill_req']) {
                $sql = "UPDATE " . ADR_CHARACTERS_TABLE . "\n\t\t\t\tSET character_skill_stone_uses = 0 , \n\t\t\t\t\tcharacter_skill_stone = character_skill_stone + 1\n\t\t\t\tWHERE character_id = {$user_id} ";
                $result = $db->sql_query($sql);
                if (!$result) {
                    message_die(GENERAL_ERROR, 'Could not obtain skill information', "", __LINE__, __FILE__, $sql);
                }
            } else {
                $sql = "UPDATE " . ADR_CHARACTERS_TABLE . "\n\t\t\t\tSET character_skill_stone_uses = character_skill_stone_uses + 1\n\t\t\t\tWHERE character_id = {$user_id} ";
                $result = $db->sql_query($sql);
                if (!$result) {
                    message_die(GENERAL_ERROR, 'Could not obtain item information', "", __LINE__, __FILE__, $sql);
                }
            }
        }
    }
    return $success;
}
开发者ID:ZerGabriel,项目名称:adr-rpg,代码行数:75,代码来源:adr_functions_skills.php

示例3: adr_get_item_real_price

function adr_get_item_real_price($item_id, $user_id)
{
    global $db;
    // Fix the values
    $item_id = intval($item_id);
    $user_id = intval($user_id);
    $adr_general = adr_get_general_config();
    $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\tWHERE item_id = {$item_id} \n\t\tAND item_owner_id = {$user_id} ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, "Couldn't query item infos", "", __LINE__, __FILE__, $sql);
    }
    $row = $db->sql_fetchrow($result);
    // Once again , let's protect us about malicious users ...
    if (!is_numeric($row['item_type_use'])) {
        message_die(GENERAL_ERROR, "This item doesn't exist");
    }
    $item_type = $row['item_type_use'];
    $item_quality = $row['item_quality'];
    $item_duration = $row['item_duration'];
    $item_duration_max = $row['item_duration_max'];
    $item_power = $row['item_power'];
    // Get the base and modifier price
    $adr_quality_price = adr_get_item_quality($item_quality, price);
    $adr_type_price = adr_get_item_type($item_type, price);
    // First define the base price
    $item_price = $adr_type_price;
    // Apply the sell back penalty
    $item_price = $row['item_sell_back_percentage'] * $item_price / 100;
    // Then apply the quality modifier
    $item_price = $item_price * ($adr_quality_price / 100);
    // And now the power - it's a little more complicated
    $item_price = $item_power > 1 ? $item_price + $item_price * (($item_power - 1) * ($adr_general['item_modifier_power'] - 100) / 100) : $item_price;
    // Apply the duration penalty
    $item_price = abs($item_price / ($item_duration_max / $item_duration));
    // Finally let's use a non decimal value
    $item_price = ceil($item_price);
    return $item_price;
}
开发者ID:ZerGabriel,项目名称:adr-rpg,代码行数:38,代码来源:adr_functions_shops.php

示例4: adr_use_skill

function adr_use_skill($user_id, $tool, $recipe_item_id, $skill_id, $type)
{
    global $db;
    $user_id = intval($user_id);
    $item_id = intval($item_id);
    $tool = intval($tool);
    $recipe_item_id = intval($recipe_item_id);
    $new_item_id = 0;
    $adr_general = adr_get_general_config();
    $adr_user = adr_get_user_infos($user_id);
    $skill_data = adr_get_skill_data($skill_id);
    $current_file = 'adr_' . $type;
    $character_skill = 'character_skill_' . $type;
    $character_skill_uses = 'character_skill_' . $type . '_uses';
    // START skill limit check
    if ($adr_general['Adr_character_limit_enable'] != 0 && $adr_user['character_skill_limit'] < 1) {
        adr_previous(Adr_skill_limit, $current_file, "mode=view&known_recipes={$recipe_item_id}");
    }
    // END skill limit check
    $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\tWHERE item_in_shop = 0 \r\n\t\tAND item_owner_id = {$user_id} \r\n\t\tAND item_id = {$tool} ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not query tool informations', '', __LINE__, __FILE__, $sql);
    }
    $item = $db->sql_fetchrow($result);
    // get the information of the item that will be crafted
    //get original recipe information
    $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\tWHERE item_owner_id = 1\r\n\t\tAND item_original_recipe_id = {$recipe_item_id}\r\n\t\t";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain owners recipes information', "", __LINE__, __FILE__, $sql);
    }
    $original_recipe = $db->sql_fetchrow($result);
    //get original (up-to-date) recipe info now
    $sql_recipe = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\tWHERE item_id = " . $original_recipe['item_recipe_linked_item'] . "\r\n\t\tAND item_owner_id = 1\r\n\t\t";
    $result_recipe = $db->sql_query($sql_recipe);
    if (!$result_recipe) {
        message_die(GENERAL_ERROR, "Couldn't select recipe info", "", __LINE__, __FILE__, $sql_recipe);
    }
    $crafted_item = $db->sql_fetchrow($result_recipe);
    if ($item['item_duration'] < 0) {
        adr_previous(Adr_forge_broken, $current_file, "mode=view&known_recipes={$recipe_item_id}");
    }
    // Alter the tool
    adr_use_item($tool, $user_id);
    //roll
    $difference = intval($adr_user['character_skill_' . $type . ''] - $original_recipe['item_power']);
    $impossible_loose_bonus = 0;
    switch (TRUE) {
        case $difference < -9:
            $modifier = '-100%';
            $lose_roll = 100;
            $impossible_loose_bonus = 1;
            break;
            //Impossible
        //Impossible
        case $difference >= -9 && $difference < -6:
            $modifier = '-80%';
            $lose_roll = 80;
            $item_quality = rand(1, 2);
            break;
            //Very Hard
        //Very Hard
        case $difference >= -6 && $difference < -4:
            $modifier = '-60%';
            $lose_roll = 60;
            $item_quality = rand(1, 3);
            break;
            //Hard
        //Hard
        case $difference >= -4 && $difference < -2:
            $modifier = '-40%';
            $lose_roll = 40;
            $item_quality = rand(1, 4);
            break;
            //Normal
        //Normal
        case $difference >= -2 && $difference < 0:
            $modifier = '-20%';
            $lose_roll = 20;
            $item_quality = rand(1, 5);
            break;
            //Easy
        //Easy
        case $difference >= 0:
            $modifier = '-1%';
            $lose_roll = 5;
            $item_quality = rand(1, 6);
            break;
            //Very Easy
    }
    $user_chance = rand(0, $adr_user['character_skill_' . $type . ''] * 100);
    $user_chance = $user_chance + floor($user_chance * $modifier / 100);
    $loose_chance = rand($impossible_loose_bonus, $adr_user['character_skill_' . $type . ''] * $lose_roll);
    /*
    echo $modifier." : modifier<br>";
    echo $difference." : difference<br>";
    echo $user_chance." : user chance<br>";
    echo $loose_chance." : loose_chance<br>";
    */
    // loose a needed item if the rolled dice is bad
//.........这里部分代码省略.........
开发者ID:Nekrofage,项目名称:FJR,代码行数:101,代码来源:adr_functions_skills.php


注:本文中的adr_get_general_config函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。