Ejemplo n.º 1
0
function adr_battle_equip_initialise($user_id, $armor, $buckler, $helm, $gloves, $amulet, $ring, $greave, $boot)
{
    global $db, $lang, $adr_general, $template, $board_config, $phpEx;
    $user_id = intval($user_id);
    $armor = intval($armor);
    $buckler = intval($buckler);
    $helm = intval($helm);
    $gloves = intval($gloves);
    $amulet = intval($amulet);
    $ring = intval($ring);
    // Get the user infos
    $char = adr_get_user_infos($user_id);
    ### START restriction checks ###
    $item_sql = adr_make_restrict_sql($char);
    ### END restriction checks ###
    // Be sure he has a character
    if (!is_numeric($char['character_id'])) {
        adr_previous(Adr_your_character_lack, adr_character, '');
    }
    // Calculate the base stats
    $hp = 0;
    $mp = 0;
    $level = $char['character_level'];
    $char_element = $char['character_element'];
    $char_mp = $char['character_mp'];
    // Create base attack & defence stats
    $att = adr_battle_make_att($char['character_might'], $char['character_constitution']);
    $ma = adr_battle_make_magic_att($char['character_intelligence']);
    $def = adr_battle_make_def($char['character_ac'], $char['character_dexterity']);
    $md = adr_battle_make_magic_def($char['character_wisdom']);
    // Modify stats depending to zone element
    $zone_user = adr_get_user_infos($user_id);
    $actual_zone = $zone_user['character_area'];
    $sql = "SELECT * FROM " . ADR_ZONES_TABLE . "\r\n\t\tWHERE zone_id = {$actual_zone}";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain zones information', "", __LINE__, __FILE__, $sql);
    }
    $zone_check = $db->sql_fetchrow($result);
    if ($board_config['zone_bonus_enable'] == '1' && $zone_check['zone_element'] == '$char_element') {
        $bonus_att = $board_config['zone_bonus_att'];
        $bonus_def = $board_config['zone_bonus_def'];
        $att = ($char['character_might'] + $char['character_constitution']) * 2 + $bonus_att;
        $def = $char['character_dexterity'] + $char['character_wisdom'] + $char['character_ac'] + $bonus_def;
    }
    // Start party
    $party = $char['character_party'];
    if ($party > 0) {
        $sql = " SELECT character_party FROM " . ADR_CHARACTERS_TABLE . "\r\n\t\t\t WHERE character_party = {$party} ";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query count for info page', '', __LINE__, __FILE__, $sql);
        }
        $count_members = $db->sql_numrows($result);
    } elseif ($party = 0) {
        $sql = " SELECT character_party FROM " . ADR_CHARACTERS_TABLE . "\r\n\t\t\t WHERE character_party = 0 ";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query count for info page', '', __LINE__, __FILE__, $sql);
        }
        $count_members = $db->sql_numrows($result);
    }
    // Boost ATT
    $att = $att + $count_members + $count_members + $count_members;
    $att = round($att);
    // Boost DEF
    $def = $def + $count_members + $count_members + $count_members + $count_members + $count_members;
    $def = round($def);
    // Boost MA
    $ma = $ma + $count_members + $count_members + $count_members;
    $ma = round($ma);
    // Boost MD
    $md = $md + $count_members + $count_members + $count_members + $count_members + $count_members;
    $md = round($md);
    // End Party
    if ($armor) {
        $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE item_in_shop = '0'\r\n\t\t\tAND item_owner_id = '{$user_id}'\r\n\t\t\tAND item_in_warehouse = '0'\r\n\t\t\t{$item_sql}\r\n\t\t\tAND item_id = '{$armor}'";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
        }
        $item = $db->sql_fetchrow($result);
        $armor_id = $item['item_id'];
        $def = $def + ($item['item_power'] + $item['item_add_power']);
        adr_use_item($armor, $user_id);
        $armour_name = adr_get_lang($item['item_name']);
    }
    $def = $def + $adr_general['shield_bonus'] * $char['character_skill_shield_level'];
    if ($buckler) {
        $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE item_in_shop = '0'\r\n\t\t\tAND item_owner_id = '{$user_id}'\r\n\t\t\tAND item_in_warehouse = '0'\r\n\t\t\t{$item_sql}\r\n\t\t\tAND item_id = '{$buckler}'";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
        }
        $item = $db->sql_fetchrow($result);
        $buckler_id = $item['item_id'];
        $def = $def + ($item['item_power'] + $item['item_add_power']);
        adr_use_item($buckler, $user_id);
        $buckler_name = adr_get_lang($item['item_name']);
    }
    if ($gloves) {
        $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE item_in_shop = '0'\r\n\t\t\tAND item_owner_id = '{$user_id}'\r\n\t\t\tAND item_in_warehouse = '0'\r\n\t\t\t{$item_sql}\r\n\t\t\tAND item_id = '{$gloves}'";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
        }
        $item = $db->sql_fetchrow($result);
        $gloves_id = $item['item_id'];
        $def = $def + ($item['item_power'] + $item['item_add_power']);
        adr_use_item($gloves, $user_id);
        $gloves_name = adr_get_lang($item['item_name']);
    }
    if ($helm) {
        $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE item_in_shop = '0'\r\n\t\t\tAND item_owner_id = '{$user_id}'\r\n\t\t\tAND item_in_warehouse = '0'\r\n\t\t\t{$item_sql}\r\n\t\t\tAND item_id = '{$helm}'";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
        }
        $item = $db->sql_fetchrow($result);
        $helm_id = $item['item_id'];
        $def = $def + ($item['item_power'] + $item['item_add_power']);
        adr_use_item($helm, $user_id);
        $helm_name = adr_get_lang($item['item_name']);
    }
    // Now we modify mp and hp regeneration with amulets and rings
    if ($amulet) {
        $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE item_in_shop = '0'\r\n\t\t\tAND item_owner_id = '{$user_id}'\r\n\t\t\tAND item_in_warehouse = '0'\r\n\t\t\t{$item_sql}\r\n\t\t\tAND item_id = '{$amulet}'";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
        }
        $item = $db->sql_fetchrow($result);
        $amulet_id = $item['item_id'];
        $hp = $hp + $item['item_power'];
        adr_use_item($amulet, $user_id);
        $amulet_name = adr_get_lang($item['item_name']);
    }
    if ($ring) {
        $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE item_in_shop = '0'\r\n\t\t\tAND item_owner_id = '{$user_id}'\r\n\t\t\tAND item_in_warehouse = '0'\r\n\t\t\t{$item_sql}\r\n\t\t\tAND item_id = '{$ring}'";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
        }
        $item = $db->sql_fetchrow($result);
        $ring_id = $item['item_id'];
        $mp = $mp + $item['item_power'];
        adr_use_item($ring, $user_id);
        $ring_name = adr_get_lang($item['item_name']);
    }
    if ($greave) {
        $sql = " SELECT item_name , item_power , item_add_power FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE item_in_shop = 0 \r\n\t\t\tAND item_owner_id = {$user_id} \r\n\t\t\tAND item_in_warehouse = 0\r\n\t\t\tAND item_id = {$greave} ";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
        }
        $item = $db->sql_fetchrow($result);
        $def = $def + $item['item_power'] + $item['item_add_power'];
        $greave_name = $item['item_name'];
        adr_use_item($greave, $user_id);
        $greave_name = adr_get_lang($item['item_name']);
    }
    if ($boot) {
        $sql = " SELECT item_name , item_power , item_add_power FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE item_in_shop = 0 \r\n\t\t\tAND item_owner_id = {$user_id} \r\n\t\t\tAND item_in_warehouse = 0\r\n\t\t\tAND item_id = {$boot} ";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
        }
        $item = $db->sql_fetchrow($result);
        $def = $def + $item['item_power'] + $item['item_add_power'];
        $boot_name = $item['item_name'];
        adr_use_item($boot, $user_id);
        $boot_name = adr_get_lang($item['item_name']);
    }
    if ($zone_check['zone_monsters_list'] == '') {
        adr_previous(Adr_zone_no_monsters, adr_zones, '');
    }
    $monster_area = $zone_check['zone_monsters_list'] == '0' ? "" : "AND monster_id IN (" . $zone_check['zone_monsters_list'] . ")";
    ##=== START: new monster rand selection code as posted by Sederien ===##
    # V: JK. That's zone mod's code :).
    // Let's care about the opponent now
    $actual_weather = $zone_user['character_weather'];
    $actual_season = $board_config['adr_seasons'];
    $actual_time = $board_config['adr_time'];
    $sql = " SELECT * FROM " . ADR_BATTLE_MONSTERS_TABLE . "\r\n\t\t\tWHERE monster_level <= {$level} \r\n\t\t\t{$monster_area}\r\n\t\t\tAND ( monster_weather = {$actual_weather} || monster_weather = 0 )\r\n\t\t\tAND (monster_time = {$actual_time} OR monster_time = 0)\r\n\t\t\tAND ( monster_season = {$actual_season} || monster_season = 0 )";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not query monsters list', '', __LINE__, __FILE__, $sql);
    }
    $monsters = $db->sql_fetchrow($result);
    // Be sure monsters of the user level exists
    if (!$monsters) {
        adr_previous(Adr_no_monsters, adr_character, '');
    }
    // Get this monster base stats
    $monster_id = $monsters['monster_id'];
    $monster_level = $monsters['monster_level'];
    $monster_base_hp = $monsters['monster_base_hp'];
    $monster_base_att = $monsters['monster_base_att'];
    $monster_base_def = $monsters['monster_base_def'];
    $monster_base_element = $monsters['monster_base_element'];
    $monster_base_mp = $monsters['monster_base_mp'];
    $monster_base_mp_power = $monsters['monster_base_mp_power'];
    $monster_base_ma = $monsters['monster_base_magic_attack'];
    $monster_base_md = $monsters['monster_base_magic_resistance'];
    $monster_base_sp = $monsters['monster_base_sp'];
    ##=== END: new monster selection code by Sederien ===##
    // If the user is higher level than the monster , update the monster stats
    if ($monster_level < $level) {
        if ($adr_general['battle_calc_type']) {
            // Xanathis's alternative battle modifier calculation for monster battles
            $modifier = ($adr_general['battle_monster_stats_modifier'] - 100) / 100 * ($level - $monster_level) + 1;
        } else {
            $modifier = $adr_general['battle_monster_stats_modifier'] / 100 * ($level - $monster_level);
        }
        $monster_base_hp = ceil($monster_base_hp * $modifier);
        $monster_base_att = ceil($monster_base_att * $modifier);
        $monster_base_def = ceil($monster_base_def * $modifier);
        $monster_base_mp = ceil($monster_base_mp * $modifier);
        $monster_base_ma = ceil($monster_base_ma * $modifier);
        $monster_base_md = ceil($monster_base_md * $modifier);
        $monster_base_sp = ceil($monster_base_sp * $modifier);
    }
    ##=== START array for equipment id's ##
    $equip_array = intval($helm_id) . '-' . intval($armor_id) . '-' . intval($gloves_id) . '-' . intval($buckler_id) . '-' . intval($amulet_id) . '-' . intval($ring_id) . '-' . intval($hp) . '-' . intval($mp) . '-' . intval($greave) . '-' . intval($boot);
    ##=== END array for equipment id's ##
    ##=== START: Initiative Checks
    // 1d20 roll. Highest starts.
    $monster_dex = 10 + rand(1, $monster_level) * 2;
    //temp
    $challenger_init_check = rand(1, 20) + adr_modifier_calc($char['character_dexterity']);
    $monster_init_check = rand(1, 20) + adr_modifier_calc($monster_dex);
    // Check who will start ELSE do a rand to determine.
    if ($challenger_init_check >= $monster_init_check) {
        $turn = 1;
    } else {
        $turn = 2;
    }
    ##=== END: Initiative Checks
    $spell_effects = explode(':', $char['character_spell_pre_effects']);
    for ($i = 0; $i < count($spell_effects); $i++) {
        if ($spell_effects[$i] == 'ATT') {
            $value = $spell_effects[$i + 1];
            $att = $att + $value;
        }
        if ($spell_effects[$i] == 'DEF') {
            $value = $spell_effects[$i + 1];
            $def = $def + $value;
        }
    }
    //remove spell pre-effects
    $sql = "UPDATE " . ADR_CHARACTERS_TABLE . "\r\n\t\tSET character_spell_pre_effects = ''\r\n\t\tWHERE character_id = {$user_id} ";
    if (!$db->sql_query($sql)) {
        message_die(GENERAL_ERROR, 'Couldn\'t remove characters spell pre effects for battle', '', __LINE__, __FILE__, $sql);
    }
    // Finally insert all theses values into the database
    $sql = "INSERT INTO " . ADR_BATTLE_LIST_TABLE . "\r\n\t\t(battle_type, battle_start, battle_turn,  battle_result, battle_text, battle_challenger_id, battle_challenger_hp, battle_challenger_mp, battle_challenger_att, battle_challenger_def, battle_challenger_element, battle_challenger_magic_attack, battle_challenger_magic_resistance, battle_challenger_equipment_info, battle_opponent_id, battle_opponent_hp, battle_opponent_hp_max, battle_opponent_mp, battle_opponent_mp_max, battle_opponent_mp_power, battle_opponent_att, battle_opponent_def, battle_opponent_element, battle_opponent_magic_attack, battle_opponent_magic_resistance, battle_opponent_sp)\r\n\t\tVALUES(1, " . time() . ", {$turn}, 0, '', {$user_id}, {$hp}, {$mp}, {$att}, {$def}, {$char_element}, {$ma}, {$md}, '{$equip_array}', {$monster_id}, {$monster_base_hp}, {$monster_base_hp}, {$monster_base_mp}, {$monster_base_mp}, {$monster_base_mp_power}, {$monster_base_att}, {$monster_base_def}, {$monster_base_element}, {$monster_base_ma}, {$monster_base_md}, {$monster_base_sp})";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, "Couldn't insert new battle", "", __LINE__, __FILE__, $sql);
    }
    // Do armour set check
    // Do armour set check
    include_once $phpbb_root_path . 'adr/includes/adr_functions_armour_sets.' . $phpEx;
    adr_armour_set_check($user_id, $armour_name, $buckler_name, $gloves_name, $helm_name, $amulet_name, $ring_name, $greave_name, $boot_name);
}
Ejemplo n.º 2
0
     $tools = $db->sql_fetchrowset($result);
     $tool_list = '<select name="item_tool">';
     $tool_list .= '<option value = "0" >' . $lang['Adr_forge_mining_no_tool'] . '</option>';
     for ($i = 0; $i < count($tools); $i++) {
         $tool_list .= '<option value = "' . $tools[$i]['item_id'] . '" >' . adr_get_lang($tools[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $tools[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $tools[$i]['item_duration'] . ' )' . '</option>';
     }
     $tool_list .= '</select>';
     $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\t\tWHERE item_owner_id = {$user_id}\r\n\t\t\t\tAND item_quality < 5 \r\n\t\t\t\tAND item_in_shop = 0\r\n\t\t\t\tAND item_in_warehouse = 0\r\n\t\t\t\tAND item_duration > 0\r\n\t\t\t\tAND item_type_use IN ( 1 , 2 ) ";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, 'Could not check user items', "", __LINE__, __FILE__, $sql);
     }
     $items = $db->sql_fetchrowset($result);
     $items_list = '<select name="item_to_repair">';
     $items_list .= '<option value = "0" >' . $lang['Adr_forge_repair_no_item'] . '</option>';
     for ($i = 0; $i < count($items); $i++) {
         $items_list .= '<option value = "' . $items[$i]['item_id'] . '" >' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_quality'] . ' : ' . adr_get_item_quality($items[$i]['item_quality'], simple) . ' - ' . $lang['Adr_items_type_use'] . ' : ' . adr_get_item_type($items[$i]['item_type_use'], simple) . ')' . '</option>';
     }
     $items_list .= '</select>';
     $template->assign_vars(array('ITEMS_LIST' => $items_list, 'TOOL_LIST' => $tool_list, 'L_SELECT_TOOL' => $lang['Adr_forge_mining_select_tool'], 'L_SELECT_ITEMS' => $lang['Adr_forge_stone_select_item'], 'L_GO_REPAIR' => $lang['Adr_forge_stone_go'], 'L_STONE_EXPLAIN' => $lang['Adr_forge_stone_explain']));
     break;
 case 'stone_action':
     $tool = intval($HTTP_POST_VARS['item_tool']);
     $item_to_repair = intval($HTTP_POST_VARS['item_to_repair']);
     // No tool , no repair
     if (!$tool) {
         adr_previous(Adr_forge_stone_tool_needed, adr_TownMap_forge, "mode=stone");
     }
     // No item to repair ?
     if (!$item_to_repair) {
         adr_previous(Adr_forge_stone_item_to_repair_needed, adr_TownMap_forge, "mode=stone");
     }
Ejemplo n.º 3
0
        message_die(GENERAL_ERROR, 'Could not obtain items information', "", __LINE__, __FILE__, $sql);
    }
    $items = $db->sql_fetchrowset($result);
    $s_hidden_fields = '<input type="hidden" name="mode" value="add_item" /><input type="hidden" name="item_type" value="' . $category_id . '" />';
    for ($k = 0; $k < count($items); $k++) {
        $row_class = !($k % 2) ? $theme['td_class1'] : $theme['td_class2'];
        if ($items[$k]['item_chance'] == '0') {
            $chance = $lang['Adr_beggar_chance_common'];
        } elseif ($items[$k]['item_chance'] == '1') {
            $chance = $lang['Adr_beggar_chance_uncommon'];
        } elseif ($items[$k]['item_chance'] == '2') {
            $chance = $lang['Adr_beggar_chance_rare'];
        } elseif ($items[$k]['item_chance'] == '3') {
            $chance = $lang['Adr_beggar_chance_very_rare'];
        } elseif ($items[$k]['item_chance'] == '4') {
            $chance = $lang['Adr_beggar_chance_super_rare'];
        }
        $template->assign_block_vars("items", array("ROW_CLASS" => $row_class, "ITEM_NAME" => adr_get_lang($items[$k]['item_name']), "ITEM_DESC" => adr_get_lang($items[$k]['item_desc']), "ITEM_CHANCE" => $chance, "ITEM_IMG" => $items[$k]['item_icon'], "ITEM_TYPE" => $lang[$items[$k]['item_type_lang']], "ITEM_QUALITY" => $lang[$items[$k]['item_quality_lang']], "ITEM_DURATION" => $items[$k]['item_duration'], "ITEM_MAX_DURATION" => $items[$k]['item_duration_max'], "ITEM_POWER" => $items[$k]['item_power'], "ITEM_ADD_POWER" => $items[$k]['item_add_power'], "ITEM_MP_USE" => $items[$k]['item_mp_use'], "ITEM_PRICE" => $items[$k]['item_price'], "U_ITEM_EDIT" => append_sid("admin_adr_beggar_donations.{$phpEx}?mode=edit_item&amp;item_id=" . $items[$k]['item_id']), "U_ITEM_DELETE" => append_sid("admin_adr_beggar_donations.{$phpEx}?mode=delete_item&amp;item_id=" . $items[$k]['item_id'])));
    }
    $sql = "SELECT count(*) AS total FROM " . ADR_BEGGAR_DONATIONS . "\r\n\t\tWHERE item_owner_id = '1'";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
    }
    if ($total = $db->sql_fetchrow($result)) {
        $total_items = $total['total'];
        $pagination = generate_pagination("admin_adr_beggar_donations.{$phpEx}?mode2={$mode2}&amp;order={$sort_order}&amp;cat={$cat}", $total_items, $board_config['topics_per_page'], $start) . '&nbsp;';
    }
    $template->assign_vars(array("L_ITEM_NAME" => $lang['Adr_shops_categories_item_name'], "L_ITEM_DESC" => $lang['Adr_shops_categories_item_desc'], "L_ITEM_TITLE" => $lang['Adr_beggar_title'], "L_ITEM_TEXT" => $lang['Adr_beggar_title_explain'], "L_ITEM_TYPE" => $lang['Adr_items_type_use'], "L_ADD_ITEM" => $lang['Adr_shops_item_add'], "L_ITEM_QUALITY" => $lang['Adr_items_quality'], "L_ITEM_POWER" => $lang['Adr_items_power'], "L_ITEM_WEIGHT" => $lang['Adr_shops_item_weight'], "L_ITEM_DURATION" => $lang['Adr_items_duration'], "L_ITEM_CHANCE" => $lang['Adr_beggar_chance'], "L_ITEM_CHANCE_EXPLAIN" => $lang['Adr_beggar_chance_explain'], "L_ACTION" => $lang['Action'], "L_ITEMS" => $lang['Adr_shops_categories_items'], "L_EDIT" => $lang['Edit'], "L_DELETE" => $lang['Delete'], "L_ITEM_IMG" => $lang['Adr_races_image'], "L_ITEM_PRICE" => $lang['Adr_items_price'], 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'L_ORDER' => $lang['Order'], 'L_SORT' => $lang['Sort'], 'L_SUBMIT' => $lang['Sort'], 'S_MODE_SELECT' => $select_sort_mode, 'S_ORDER_SELECT' => $select_sort_order, 'SELECT_CAT' => $select_category, 'L_SELECT_CAT' => $lang['Adr_items_select'], 'PAGINATION' => $pagination, 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, max(1, ceil($total_items / $board_config['topics_per_page']))), 'L_GOTO_PAGE' => $lang['Goto_page'], "L_GIVE" => $lang['Adr_items_give'], "L_SELL" => $lang['Adr_items_sell'], "L_EDIT" => $lang['Adr_items_edit'], "L_SHOP" => $lang['Adr_items_into_shop'], "S_SHOPS_ACTION" => append_sid("admin_adr_beggar_donations.{$phpEx}?mode2={$mode2}&amp;order={$sort_order}"), "S_HIDDEN_FIELDS" => $s_hidden_fields));
    $template->pparse("body");
}
include './page_footer_admin.' . $phpEx;
Ejemplo n.º 4
0
function adr_pvp_armour_set_check($battle_id, $challenger_id, $opponent_id, $armour = '', $shield = '', $gloves = '', $helm = '', $amulet = '', $ring = '', $greave = '', $boot = '')
{
    global $db;
    $battle_id = intval($battle_id);
    $challenger_id = intval($challenger_id);
    $opponent_id = intval($opponent_id);
    // Check if current armour is equal to a set in table
    $sql = " SELECT a.*, b.* FROM " . ADR_ARMOUR_SET_TABLE . " a, " . ADR_BATTLE_PVP_TABLE . " b\r\n\t\t\tWHERE a.set_helm = '" . str_replace("\\'", "''", $helm) . "'\r\n\t\t\tAND a.set_armour = '" . str_replace("\\'", "''", $armour) . "'\r\n\t\t\tAND a.set_gloves = '" . str_replace("\\'", "''", $gloves) . "'\r\n\t\t\tAND a.set_shield = '" . str_replace("\\'", "''", $shield) . "'\r\n\t\t\tAND a.set_greave = '" . str_replace("\\'", "''", $greave) . "'\r\n\t\t\tAND a.set_boot = '" . str_replace("\\'", "''", $boot) . "'\r\n\t\t\tAND b.battle_id = '{$battle_id}'";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not query armour set table for PvP', '', __LINE__, __FILE__, $sql);
    }
    $bat = $db->sql_fetchrow($result);
    if ($bat['set_id'] != '0' && $bat['set_id'] != '') {
        if ($challenger_id == $bat['battle_challenger_id']) {
            // Calculate bonuses & penalties for armour set
            $att = $bat['battle_challenger_att'] + ($bat['set_might_bonus'] + $bat['set_constitution_bonus']);
            $att = $att - ($bat['set_might_penalty'] + $bat['set_constitution_penalty']);
            $att = $att < 1 ? 1 : $att;
            $def = $bat['battle_challenger_def'] + ($bat['set_dexterity_bonus'] + $bat['set_ac_bonus']);
            $def = $def - ($bat['set_dexterity_penalty'] + $bat['set_ac_penalty']);
            $def = $def < 1 ? 1 : $def;
            $m_att = $bat['battle_challenger_magic_attack'] + $bat['set_intelligence_bonus'];
            $m_att = $m_att - $bat['set_intelligence_penalty'];
            $m_att = $m_att < 1 ? 1 : $m_att;
            $m_def = $bat['battle_challenger_magic_resistance'] + $bat['set_wisdom_bonus'];
            $m_def = $m_def - $bat['set_wisdom_penalty'];
            $m_def = $m_def < 1 ? 1 : $m_def;
            $armour_set = adr_get_lang($bat['set_name']);
            // Now update the database
            $sql = " UPDATE " . ADR_BATTLE_PVP_TABLE . "\r\n\t\t\t\tSET battle_challenger_att = {$att}, \r\n\t\t\t\t\tbattle_challenger_def = {$def},\r\n\t\t\t\t\tbattle_challenger_magic_attack = {$m_att},\r\n\t\t\t\t\tbattle_challenger_magic_resistance = {$m_def},\r\n\t\t\t\t\tbattle_challenger_armour_set = '" . str_replace("\\'", "''", $armour_set) . "'\r\n\t\t\t\tWHERE battle_id = '{$battle_id}'\r\n\t\t\t\tAND battle_challenger_id = '{$challenger_id}'";
            $result = $db->sql_query($sql);
            if (!$result) {
                message_die(GENERAL_ERROR, "Couldn't update challenger armour set stats", "", __LINE__, __FILE__, $sql);
            }
            return;
        } elseif ($opponent_id == $bat['battle_opponent_id']) {
            // Calculate bonuses & penalties for armour set
            $att = $bat['battle_opponent_att'] + ($bat['set_might_bonus'] + $bat['set_constitution_bonus']);
            $att = $att - ($bat['set_might_penalty'] + $bat['set_constitution_penalty']);
            $att = $att < 1 ? 1 : $att;
            $def = $bat['battle_opponent_def'] + ($bat['set_dexterity_bonus'] + $bat['set_ac_bonus']);
            $def = $def - ($bat['set_dexterity_penalty'] + $bat['set_ac_penalty']);
            $def = $def < 1 ? 1 : $def;
            $m_att = $bat['battle_opponent_magic_attack'] + $bat['set_intelligence_bonus'];
            $m_att = $m_att - $bat['set_intelligence_penalty'];
            $m_att = $m_att < 1 ? 1 : $m_att;
            $m_def = $bat['battle_opponent_magic_resistance'] + $bat['set_wisdom_bonus'];
            $m_def = $m_def - $bat['set_wisdom_penalty'];
            $m_def = $m_def < 1 ? 1 : $m_def;
            $armour_set = adr_get_lang($bat['set_name']);
            // Now update the database
            $sql = " UPDATE " . ADR_BATTLE_PVP_TABLE . "\r\n\t\t\t\tSET battle_opponent_att = {$att}, \r\n\t\t\t\t\tbattle_opponent_def = {$def},\r\n\t\t\t\t\tbattle_opponent_magic_attack = {$m_att},\r\n\t\t\t\t\tbattle_opponent_magic_resistance = {$m_def}, \r\n\t\t\t\t\tbattle_opponent_armour_set = '" . str_replace("\\'", "''", $armour_set) . "'\r\n\t\t\t\tWHERE battle_id = '{$battle_id}'\r\n\t\t\t\tAND battle_opponent_id = '{$opponent_id}'";
            $result = $db->sql_query($sql);
            if (!$result) {
                message_die(GENERAL_ERROR, "Couldn't update opponent armour set stats", "", __LINE__, __FILE__, $sql);
            }
            return;
        }
    }
}
Ejemplo n.º 5
0
     message_die(GENERAL_ERROR, 'Could not obtain a list of items', '', __LINE__, __FILE__, $sql);
 }
 $items = $db->sql_fetchrowset($result);
 $select_quantity = '<select name="quantity">';
 for ($i = 1; $i < 21; $i++) {
     $select_quantity .= '<option value="' . $i . '">' . $i . '</option>';
 }
 $select_quantity .= '</select>';
 $action_select = '<select name="mode">';
 $action_select .= '<option value = "">' . $lang['Adr_items_select_action'] . '</option>';
 $action_select .= '<option value = "give">' . $lang['Adr_items_give'] . '</option>';
 $action_select .= '</select>';
 for ($k = 0; $k < count($items); $k++) {
     $row_class = !($k % 2) ? $theme['td_class1'] : $theme['td_class2'];
     $item_image = $adr_image_path . $items[$k]['spell_icon'];
     $template->assign_block_vars('view_store.items', array("ROW_CLASS" => $row_class, "ITEM_ID" => $items[$k]['spell_id'], "ITEM_NAME" => adr_get_lang($items[$k]['spell_name']), "ITEM_DESC" => adr_get_lang($items[$k]['spell_desc']), "ITEM_IMG" => $item_image, "ITEM_TYPE" => $lang[$items[$k]['item_type_lang']], "ITEM_POWER" => $items[$k]['spell_power'], "SELECT_QUANTITY" => $select_quantity));
 }
 // Check if power limit is enabled
 if ($adr_general['item_power_level'] == 1) {
     $lang_power = $lang['Adr_items_level'];
 } else {
     $lang_power = $lang['Adr_items_power'];
 }
 $cat_sql = $cat ? 'AND item_type_use = ' . $cat : '';
 $sql = "SELECT count(*) AS total FROM " . ADR_SHOPS_SPELLS_TABLE . " \r\n\t\tWHERE spell_owner_id = 1 \r\n\t\t{$cat_sql}";
 if (!($result = $db->sql_query($sql))) {
     message_die(GENERAL_ERROR, 'Error getting total number of items', '', __LINE__, __FILE__, $sql);
 }
 if ($total = $db->sql_fetchrow($result)) {
     $total_items = $total['total'];
     $pagination = generate_pagination("admin_adr_give_users_spells.{$phpEx}?mode2={$mode2}&amp;order={$sort_order}", $total_items, $board_config['topics_per_page'], $start) . '&nbsp;';
Ejemplo n.º 6
0
                 break;
         }
         $sql = "SELECT i.* , q.item_quality_lang , t.item_type_lang FROM " . ADR_SHOPS_ITEMS_TABLE . " i\n\t\t\t\tLEFT JOIN " . ADR_SHOPS_ITEMS_QUALITY_TABLE . " q ON ( i.item_quality = q.item_quality_id )\n\t\t\t\tLEFT JOIN " . ADR_SHOPS_ITEMS_TYPE_TABLE . " t ON ( i.item_type_use = t.item_type_id )\n\t\t\t\tWHERE i.item_owner_id = '{$user_id}'\n\t\t\t\t{$cat_sql}\n\t\t\t\tORDER BY {$order_by}";
         if (!($result = $db->sql_query($sql))) {
             message_die(GENERAL_ERROR, 'Could not query WH items', '', __LINE__, __FILE__, $sql);
         }
         $action_select = '<select name="mode">';
         $action_select .= '<option value = "">' . $lang['Adr_items_select_action'] . '</option>';
         $action_select .= '<option value = "delete_item">' . $lang['Delete'] . '</option>';
         $action_select .= '<option value = "delete_inventory">' . $lang['Adr_delete_inventory'] . '</option>';
         $action_select .= '</select>';
         if ($row = $db->sql_fetchrow($result)) {
             $i = 0;
             do {
                 $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
                 $template->assign_block_vars('inventory.items', array("ROW_CLASS" => $row_class, "ITEM_ID" => $row['item_id'], "ITEM_NAME" => adr_get_lang($row['item_name']), "ITEM_DESC" => adr_get_lang($row['item_desc']), "ITEM_IMG" => $row['item_icon'], "ITEM_QUALITY" => $lang[$row['item_quality_lang']], "ITEM_TYPE" => $lang[$row['item_type_lang']], "ITEM_DURATION" => $row['item_duration'], "ITEM_DURATION_MAX" => $row['item_duration_max'], "ITEM_POWER" => $row['item_power'], "ITEM_PRICE" => $row['item_price']));
                 $i++;
             } while ($row = $db->sql_fetchrow($result));
         }
         $cat_sql = $cat ? 'AND item_type_use = ' . $cat : '';
         $sql = "SELECT count(*) AS total FROM " . ADR_SHOPS_ITEMS_TABLE . " \n\t\t\t\tWHERE item_owner_id = '{$user_id}'\n\t\t\t\t{$cat_sql}\n\t\t\t\tAND item_duration > '0'";
         if (!($result = $db->sql_query($sql))) {
             message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
         }
         if ($total = $db->sql_fetchrow($result)) {
             $total_items = $total['total'];
             $pagination = generate_pagination("admin_adr_users.{$phpEx}?mode=inventory&amp;order={$sort_order}&amp;cat={$cat}&amp;user_id=" . $user_id . "", $total_items, $board_config['topics_per_page'], $start) . '&nbsp;';
         }
         $template->assign_vars(array('ORDER_BY' => $order_by, 'ACTION_SELECT' => $action_select, 'SELECT_CAT' => $select_category, 'SELECT_QUANTITY' => $select_quantity, 'SHOP_OWNER_ID' => $shop_owner, 'OWNER_S' => $lang['Adr_warehouse_s'], 'WAREHOUSE_NAME' => $lang['Adr_warehouse_name'], 'OWNER_NAME' => $userdata['username'], 'OWNER_NAME' => $other_user_infos['character_name'], 'INVENTORY_NAME' => $lang['Adr_character_inventory_title'], 'L_CHECK_ALL' => $lang['Adr_check_all'], 'L_UNCHECK_ALL' => $lang['Adr_uncheck_all'], "L_SELECT_CAT" => $lang['Adr_items_select'], "L_SELECT_QUANTITY" => $lang['Adr_items_select_quantity'], "L_ITEM_NAME" => $lang['Adr_shops_categories_item_name'], "L_ITEM_DESC" => $lang['Adr_shops_categories_item_desc'], "L_ITEM_QUALITY" => $lang['Adr_items_quality'], "L_ITEM_POWER" => $lang['Adr_items_power'], "L_ITEM_DURATION" => $lang['Adr_items_duration'], "L_ACTION" => $lang['Adr_items_action'], "L_ITEM_IMG" => $lang['Adr_races_image'], "L_ITEM_PRICE" => $lang['Adr_items_price'], "L_ITEM_TYPE" => $lang['Adr_items_type_use'], "L_NO_ITEMS" => $lang['Adr_items_none'], 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'L_ORDER' => $lang['Order'], 'L_SORT' => $lang['Sort'], 'L_SUBMIT' => $lang['Submit'], 'S_MODE_SELECT' => $select_sort_mode, 'S_ORDER_SELECT' => $select_sort_order, 'PAGINATION' => $pagination, 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, ceil($total_items / $board_config['topics_per_page'])), 'L_GOTO_PAGE' => $lang['Goto_page'], 'S_MODE_ACTION' => append_sid("admin_adr_users.{$phpEx}?mode=inventory")));
         break;
 }
function adr_attack_weap()
{
    global $monster, $bat, $adr_user, $opponent_element, $item, $db, $lang, $user_id, $power, $crit_result;
    global $challenger, $battle_message, $user_action, $monster_action, $attack_img, $attackwith_overlay;
    global $damage, $dice;
    // weaprof
    $attbonus = adr_weapon_skill_check($user_id);
    if ($diff === TRUE && $dice != '1' || $dice >= $threat_range) {
        // Prefix msg if crit hit
        $battle_message .= $crit_result === TRUE ? '<br>' . $lang['Adr_battle_critical_hit'] . '</b><br />' : '';
        $damage = adr_calc_item_damage($item, $power, $attbonus);
        $damage = $damage > $bat['battle_opponent_hp'] ? $bat['battle_opponent_hp'] : $damage;
        // V: fix element
        $element_name = adr_get_element_infos($item['item_element']);
        // Here we apply text colour if set
        if ($element_name['element_colour'] != '') {
            $item['item_name'] = '<span style="color: ' . $element_name['element_colour'] . '">' . $item['item_name'] . '</span>';
        } else {
            $item['item_name'] = $item['item_name'];
        }
        // Fix attack msg type
        if ($item['item_element'] > '0' && $element_name['element_name'] != '') {
            $battle_message .= sprintf($lang['Adr_battle_attack_success'], $challenger['character_name'], $monster['monster_name'], $item['item_name'], adr_get_lang($element_name['element_name']), floor($attbonus), $damage) . '<br>';
        } else {
            $battle_message .= sprintf($lang['Adr_battle_attack_success_norm'], $challenger['character_name'], $monster['monster_name'], $item['item_name'], floor($attbonus), $damage) . '<br>';
        }
    } else {
        $damage = 0;
        $battle_message .= sprintf($lang['Adr_battle_attack_failure'], $challenger['character_name'], $monster['monster_name'], $item['item_name']) . '<br>';
    }
}
Ejemplo n.º 8
0
            $armor_pic = $items[$i]['item_icon'];
        }
        if ($items[$i]['item_type_use'] == 8 && $items[$i]['item_id'] == $equip_buckler) {
            $buckler_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $buckler_pic = $items[$i]['item_icon'];
        }
        if ($items[$i]['item_type_use'] == 9 && $items[$i]['item_id'] == $equip_helm) {
            $helm_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $helm_pic = $items[$i]['item_icon'];
        }
        if ($items[$i]['item_type_use'] == 10 && $items[$i]['item_id'] == $equip_gloves) {
            $gloves_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $gloves_pic = $items[$i]['item_icon'];
        }
        if ($items[$i]['item_type_use'] == 13 && $items[$i]['item_id'] == $equip_amulet) {
            $amulet_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $amulet_pic = $items[$i]['item_icon'];
        }
        if ($items[$i]['item_type_use'] == 14 && $items[$i]['item_id'] == $equip_ring) {
            $ring_list = adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $items[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )';
            $ring_pic = $items[$i]['item_icon'];
        }
    }
}
$template->assign_vars(array('ARMOR_IMG' => $armor_pic, 'BUCKLER_IMG' => $buckler_pic, 'HELM_IMG' => $helm_pic, 'GLOVES_IMG' => $gloves_pic, 'AMULET_IMG' => $amulet_pic, 'RING_IMG' => $ring_pic, 'SELECT_ARMOR' => $armor_list, 'SELECT_BUCKLER' => $buckler_list, 'SELECT_HELM' => $helm_list, 'SELECT_GLOVES' => $gloves_list, 'SELECT_AMULET' => $amulet_list, 'SELECT_RING' => $ring_list, 'L_EQUIPMENT' => $equip_title, 'L_SELECT_ARMOR' => $equip_larmor, 'L_SELECT_BUCKLER' => $equip_lbuckler, 'L_SELECT_HELM' => $equip_lhelm, 'L_SELECT_GLOVES' => $equip_lgloves, 'L_SELECT_AMULET' => $equip_lamulet, 'L_SELECT_RING' => $equip_lring, 'L_EQUIP' => $lang['Adr_equip']));
include $phpbb_root_path . 'adr/includes/adr_header.' . $phpEx;
$template->pparse('body');
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
?>
 
Ejemplo n.º 9
0
} else {
    $mode = "";
}
if ($mode != "") {
    switch ($mode) {
        case 'lumberjacking':
            $template->assign_block_vars('lumberjacking', array());
            $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\t\tWHERE item_owner_id = {$user_id}\r\n\t\t\t\tAND item_in_shop = 0\r\n\t\t\t\tAND item_in_warehouse = 0\r\n\t\t\t\tAND item_duration > 0\r\n\t\t\t\tAND item_type_use = 37 ";
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Could not check user tools', "", __LINE__, __FILE__, $sql);
            }
            $tools = $db->sql_fetchrowset($result);
            $tool_list = '<select name="item_tool">';
            $tool_list .= '<option value = "0" >' . $lang['Adr_forge_lumberjack_no_tool'] . '</option>';
            for ($i = 0; $i < count($tools); $i++) {
                $tool_list .= '<option value = "' . $tools[$i]['item_id'] . '" >' . adr_get_lang($tools[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $tools[$i]['item_power'] . ' - ' . $lang['Adr_items_duration'] . ' : ' . $tools[$i]['item_duration'] . ' )' . '</option>';
            }
            $tool_list .= '</select>';
            $template->assign_vars(array('TOOL_LIST' => $tool_list, 'L_SELECT_TOOL' => $lang['Adr_forge_lumberjack_select_tool'], 'L_GO_LUMBERJACK' => $lang['Adr_forge_lumberjack_go'], 'L_LUMBERJACK_EXPLAIN' => $lang['Adr_forge_lumberjack_explain']));
            break;
        case 'lumberjack_action':
            $tool = intval($HTTP_POST_VARS['item_tool']);
            // No tool , no lumberjacking
            if (!$tool) {
                adr_previous(Adr_forge_lumberjack_tool_needed, adr_lumberjack, "mode=lumberjacking");
            } else {
                //Tool gets used even if character doesn't find anything
                adr_use_item($tool, $user_id);
                $item = drop_gather_loot($actual_zone, $user_id, 'herbalism', 8);
                if (!$item) {
                    include $phpbb_root_path . 'adr/includes/adr_header.' . $phpEx;
Ejemplo n.º 10
0
            $combine_result = isset($HTTP_POST_VARS['item_created']) ? trim($HTTP_POST_VARS['item_created']) : trim($HTTP_GET_VARS['item_created']);
            $new_id = $fields_data['pack_id'] + 1;
            if ($combine1 == '0' || $combine2 == '0' || $combine3 == '0' || $combine_result == '0') {
                message_die(MESSAGE, $lang['Fields_empty']);
            }
            $sql = "INSERT INTO " . ADR_CAULDRON_TABLE . " \r\n\t\t\t\t( pack_id , item1_id , item2_id ,  item3_id , itemwin_id )\r\n\t\t\t\tVALUES ( {$new_id},'" . intval($combine1) . "', '" . intval($combine2) . "' , '" . intval($combine3) . "' , '" . intval($combine_result) . "' )";
            $result = $db->sql_query($sql);
            if (!$result) {
                message_die(GENERAL_ERROR, "Couldn't insert new cauldron pack", "", __LINE__, __FILE__, $sql);
            }
            adr_previous(Adr_cauldron_pack_successful_added, admin_adr_cauldron, '');
            break;
    }
} else {
    adr_template_file('admin/config_adr_cauldron_list_body.tpl');
    $template->assign_vars(array('LINK' => 'admin_adr_cauldron.' . $phpEx . '?mode=add&sid=' . $userdata['session_id']));
    $sql = "SELECT *\r\n\t\tFROM " . ADR_CAULDRON_TABLE;
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain cauldron pack information', "", __LINE__, __FILE__, $sql);
    }
    $cauldron_pack = $db->sql_fetchrowset($result);
    for ($i = 0; $i < count($cauldron_pack); $i++) {
        $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
        // V: annoyingly enough, we need to call adr_get_item/adr_get_lang (I added it) here.. :(
        $template->assign_block_vars("cauldron", array("ROW_CLASS" => $row_class, "ITEM_CREATED" => adr_get_lang(adr_get_item($cauldron_pack[$i]['itemwin_id'])['item_name']), "ITEM_COMBINE1" => adr_get_lang(adr_get_item($cauldron_pack[$i]['item1_id'])['item_name']), "ITEM_COMBINE2" => adr_get_lang(adr_get_item($cauldron_pack[$i]['item2_id'])['item_name']), "ITEM_COMBINE3" => adr_get_lang(adr_get_item($cauldron_pack[$i]['item3_id'])['item_name']), "U_CAULDRON_EDIT" => append_sid("admin_adr_cauldron.{$phpEx}?mode=edit&amp;id=" . $cauldron_pack[$i]['pack_id']), "U_CAULDRON_DELETE" => append_sid("admin_adr_cauldron.{$phpEx}?mode=delete&amp;id=" . $cauldron_pack[$i]['pack_id'])));
    }
    $template->assign_vars(array("L_CAULDRON_TITLE" => $lang['Adr_cauldron'], "L_CAULDRON_TEXT" => $lang['Adr_cauldron_explain'], "L_ITEM_CREATED" => $lang['Adr_item_created_name'], "L_ITEM_COMBINE1" => $lang['Adr_item1_combine_name'], "L_ITEM_COMBINE2" => $lang['Adr_item2_combine_name'], "L_ITEM_COMBINE3" => $lang['Adr_item3_combine_name'], "L_CAULDRON_ADD" => $lang['Adr_cauldron_add'], "L_ACTION" => $lang['Action'], "L_DELETE" => $lang['Delete'], "L_EDIT" => $lang['Edit'], "L_SUBMIT" => $lang['Submit'], "S_CAULDRON_ACTION" => append_sid("admin_adr_cauldron.{$phpEx}")));
    $template->pparse("body");
}
include_once './page_footer_admin.' . $phpEx;
Ejemplo n.º 11
0
     }
     if ($items[$i]['item_type_use'] == 9) {
         $helm_selected = $equip_helm == $items[$i]['item_id'] ? 'selected' : '';
         $helm_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $helm_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
     }
     if ($items[$i]['item_type_use'] == 10) {
         $gloves_selected = $equip_gloves == $items[$i]['item_id'] ? 'selected' : '';
         $gloves_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $gloves_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
     }
     if ($items[$i]['item_type_use'] == 13) {
         $amulet_selected = $equip_amulet == $items[$i]['item_id'] ? 'selected' : '';
         $amulet_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $amulet_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
     }
     if ($items[$i]['item_type_use'] == 14) {
         $ring_selected = $equip_ring == $items[$i]['item_id'] ? 'selected' : '';
         $ring_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $ring_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
     }
 }
 $armor_list .= '</select>';
 $buckler_list .= '</select>';
 $helm_list .= '</select>';
 $gloves_list .= '</select>';
 $amulet_list .= '</select>';
 $ring_list .= '</select>';
 $sql = " SELECT * FROM " . ADR_BATTLE_PVP_TABLE . "\n\t\t\t\tWHERE ( battle_result = 0 OR battle_result = 3 )\n\t\t\t\tAND ( battle_opponent_id = {$user_id}\tOR battle_challenger_id = {$user_id} ) ";
 if (!($result = $db->sql_query($sql))) {
     message_die(GENERAL_ERROR, 'Could not obtain user list', '', __LINE__, __FILE__, $sql);
 }
 $targets = $db->sql_fetchrowset($result);
 $ever = '(';
 for ($i = 0; $i < count($targets); $i++) {
Ejemplo n.º 12
0
function adr_steal_item($user_id, $item_id, $shop_owner_id, $shop_id)
{
    global $db, $lang, $phpEx, $adr_general, $board_config, $store_id;
    // Fix the values
    $user_id = intval($user_id);
    $item_id = intval($item_id);
    $shop_owner_id = intval($shop_owner_id);
    $shop_id = intval($shop_id);
    if ($shop_owner_id != 1) {
        $direction = append_sid("adr_shops.{$phpEx}?mode=see_shop&amp;shop_id=" . $shop_id);
    } else {
        $direction = append_sid("adr_shops.{$phpEx}?mode=view_store&amp;shop_id=" . $shop_id);
    }
    // Check if stealing is enabled by admin
    if (!$adr_general['allow_shop_steal']) {
        $message = sprintf($lang['Adr_steal_item_forbidden'], $sum, $points_name);
        $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
        message_die(GENERAL_MESSAGE, $message);
    }
    // Check if user is high enough lvl to be allowed steal attempt
    if ($adr_general['Adr_shop_steal_min_lvl'] > '0') {
        $adr_user = adr_get_user_infos($user_id);
        if ($adr_user['character_level'] < $adr_general['Adr_shop_steal_min_lvl']) {
            $message = $lang['Adr_shop_steal_min_lvl'] . '<br /><br />';
            $message .= sprintf($lang['Adr_shop_steal_min_lvl2'], '<b>', $adr_general['Adr_shop_steal_min_lvl'], '</b>');
            $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
            message_die(GENERAL_MESSAGE, $message);
        }
    }
    $sql = "SELECT character_thief_limit FROM " . ADR_CHARACTERS_TABLE . "\n\t\tWHERE character_id = {$user_id} ";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain thief limit info', "", __LINE__, __FILE__, $sql);
    }
    $thief_limit = $db->sql_fetchrow($result);
    if ($adr_general['Adr_character_limit_enable'] != 0 && $thief_limit['character_thief_limit'] < 1) {
        adr_previous(Adr_thief_limit, adr_shops, '');
    }
    // Select the item infos
    $shop_more_sql = $shop_owner_id != '1' ? 'AND item_in_shop = 1' : '';
    $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\tWHERE item_owner_id = '{$shop_owner_id}'\n\t\tAND item_id = '{$item_id}'\n\t\t{$shop_more_sql}";
    $result = $db->sql_query($sql);
    if (!$result) {
        message_die(GENERAL_ERROR, 'Could not obtain shops items information', "", __LINE__, __FILE__, $sql);
    }
    $item_data = $db->sql_fetchrow($result);
    // Check item is stealable
    if ($item_data['item_steal_dc'] == '0' && $shop_owner_id == '1') {
        //		adr_previous(Adr_store_not_stealable, shops, "view_store&amp;shop_id=".$shop_id."", '', 'adr/images/store_owners/'.$store_info['shop_logo'].'');
        adr_previous(Adr_store_not_stealable, adr_shops);
    }
    // Check for successful steal or not
    $success = adr_use_skill_thief($user_id, $item_data['item_steal_dc']);
    if ($success == TRUE) {
        // Make the new id for the item
        $sql = "SELECT item_id FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\tWHERE item_owner_id = '{$user_id}'\n\t\t\tORDER BY item_id\n\t\t\tDESC LIMIT 1";
        $result = $db->sql_query($sql);
        if (!$result) {
            message_die(GENERAL_ERROR, 'Could not obtain item information', "", __LINE__, __FILE__, $sql);
        }
        $data = $db->sql_fetchrow($result);
        $new_item_id = $data['item_id'] + 1;
        if ($shop_owner_id != '1') {
            // This will never be TRUE as of v0.4.3 because there is no player store stealing allowed
            $sql = "UPDATE " . ADR_SHOPS_ITEMS_TABLE . "\n\t\t\t\tSET item_owner_id = {$user_id},\n\t\t\t\t\titem_id = {$new_item_id},\n\t\t\t\t\titem_bought_timestamp = " . time() . ",\n\t\t\t\t\titem_in_shop = '0', \n\t\t\t\t\titem_auth = '0'\n\t\t\t\t\titem_stolen_by = '',\n\t\t\t\t\titem_stolen_timestamp = " . time . "\n\t\t\t\tWHERE item_owner_id = '{$shop_owner_id}'\n\t\t\t\tAND item_id = '{$item_id}'";
            $result = $db->sql_query($sql);
            if (!$result) {
                message_die(GENERAL_ERROR, 'Could not obtain shops items information', "", __LINE__, __FILE__, $sql);
            }
        } else {
            // Insert item details
            $type = 1;
            //This is so the insert function knows that this is a stolen item for update purposes only (optional function variable)
            adr_shop_insert_item($item_id, $new_item_id, $user_id, $shop_owner_id, $type, $shop_id);
        }
        adr_thief_limit($user_id);
        adr_store_stats_update_steal($success, $user_id, $shop_owner_id, $store_id);
        $message = sprintf($lang['Adr_steal_item_success'], $sum, $points_name);
        $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
        message_die(GENERAL_MESSAGE, $message);
    } else {
        $message = sprintf($lang['Adr_steal_item_failure'], $sum, $points_name);
        if ($adr_general['skill_thief_failure_damage']) {
            // Select the item price
            $shop_more_sql = $shop_owner_id != 1 ? 'AND i.item_in_shop = 1' : '';
            // Prevents users to buy items not in shops
            $sql = "SELECT i.item_price, i.item_name, u.user_points FROM " . ADR_SHOPS_ITEMS_TABLE . " i , " . USERS_TABLE . " u\n\t\t\t\tWHERE i.item_owner_id = {$shop_owner_id}\n\t\t\t\t\tAND u.user_id = {$user_id}\n\t\t\t\t\tAND i.item_id = {$item_id} \n\t\t\t\t{$shop_more_sql} ";
            $result = $db->sql_query($sql);
            if (!$result) {
                message_die(GENERAL_ERROR, 'Could not obtain shops items information', "", __LINE__, __FILE__, $sql);
            }
            $data = $db->sql_fetchrow($result);
            $user_points = $data['user_points'];
            $price = $data['item_price'];
            $fine = $price < intval($adr_general['skill_thief_failure_damage']) ? intval($adr_general['skill_thief_failure_damage']) : $price;
            if ($fine > $user_points && $adr_general['skill_thief_failure_punishment']) {
                $sql = " SELECT owner_id , account_sum FROM " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\t\t\tWHERE owner_id = {$user_id} ";
                if (!($result = $db->sql_query($sql))) {
                    message_die(GENERAL_ERROR, 'Could not query user stats page', '', __LINE__, __FILE__, $sql);
                }
                $vault_sum = $db->sql_fetchrow($result);
                if ($adr_general['skill_thief_failure_punishment'] == 1) {
                    if (is_numeric($vault_sum['owner_id']) && $vault_sum['account_sum'] >= $fine) {
                        $vault_fine = $fine;
                        $fine = 0;
                        // Remove cash from Vault instead
                        $sql = "UPDATE " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\t\t\t\tSET account_sum = account_sum - {$vault_fine}\n\t\t\t\t\t\t\tWHERE owner_id = {$user_id} ";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not update user points from Vault', "", __LINE__, __FILE__, $sql);
                        }
                    } elseif (is_numeric($vault_sum['owner_id']) && $vault_sum['account_sum'] > 0 && $vault_sum['account_sum'] < $fine) {
                        $vault_fine = $vault_sum['account_sum'];
                        $fine = 0;
                        // Remove cash from Vault instead
                        $sql = "UPDATE " . ADR_VAULT_USERS_TABLE . "\n\t\t\t\t\t\t\tSET account_sum = account_sum - {$vault_fine}\n\t\t\t\t\t\t\tWHERE owner_id = {$user_id} ";
                        if (!$db->sql_query($sql)) {
                            message_die(GENERAL_ERROR, 'Could not update user points from Vault', "", __LINE__, __FILE__, $sql);
                        }
                    } else {
                        $fine = $user_points;
                        $vault_fine = 0;
                    }
                } else {
                    if ($adr_general['skill_thief_failure_punishment'] == 2) {
                        adr_cell_imprison_user($user_id, 0, $adr_general['skill_thief_failure_time'], 0, $price, 1, 1, $lang['Adr_steal_item_failure_critical_all_sentence'], $adr_general['skill_thief_failure_type']);
                        $failure[0] = $lang['Adr_steal_item_failure_critical_all'];
                        $failure[1] = $lang['Adr_steal_item_failure_critical_post'];
                        $failure[2] = $lang['Adr_steal_item_failure_critical_read'];
                        $fail = $failure[$adr_general['skill_thief_failure_type']];
                        $fail_message = sprintf($lang['Adr_steal_item_failure_critical'], '<b>', adr_get_lang($data['item_name']), '</b>') . '<br /><br />' . $fail;
                        $fail_message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
                        message_die(GENERAL_MESSAGE, $fail_message);
                    }
                }
            }
            adr_thief_limit($user_id);
            adr_store_stats_update_steal($success, $user_id, $shop_owner_id, $store_id);
            subtract_reward($user_id, $fine);
        }
        if ($fine != 0) {
            $fine = $fine;
        } else {
            $fine = $vault_fine;
        }
        $message .= '<br /><br />' . sprintf($lang['Adr_steal_item_failure_suite'], $fine, $points_name);
        $message .= '<br /><br />' . sprintf($lang['Adr_return'], "<a href=\"" . $direction . "\">", "</a>");
        message_die(GENERAL_MESSAGE, $message);
    }
}
Ejemplo n.º 13
0
    default:
        $order_by = "c.character_name {$sort_order} LIMIT {$start}, " . $board_config['topics_per_page'];
        break;
}
$sql = "SELECT c.*, j.*, u.user_id FROM " . ADR_CHARACTERS_TABLE . " c\r\n\t\tLEFT JOIN " . ADR_JOB_TABLE . " j ON ( j.job_id = c.character_job_id )\r\n\t\tLEFT JOIN " . USERS_TABLE . " u ON ( u.user_id = c.character_id )\r\n\t\tWHERE c.character_job_id <> 0\r\n\t\tORDER BY {$order_by}";
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}
if ($row = $db->sql_fetchrow($result)) {
    $i = 0;
    do {
        $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
        $image = $row['job_img'] != '' ? '<img src="adr/images/jobs/' . $row['job_img'] . '">' : '';
        $completed = $row['character_job_completed'] != 0 ? round($row['character_job_completed'] / $row['character_job_times_employed'] * 100) : 0;
        $days_remaining = ceil(($row['character_job_end'] - time()) / 86400);
        $template->assign_block_vars('characters', array("ROW_CLASS" => $row_class, "JOB_NAME" => adr_get_lang($row['job_name']), "JOB_SALARY" => number_format($row['job_salary']), "JOB_TOTAL_EARNED" => number_format($row['character_job_total_earned']), "JOB_IMG" => $image, "CHARACTER_NAME" => $row['character_name'], "CHARACTER_LEVEL" => $row['character_level'], "CHARACTER_DURATION" => $days_remaining, "CHARACTER_TOTAL_JOBS" => $row['character_job_times_employed'], "CHARACTER_COMPLETED" => $completed, "U_CHARACTER_NAME" => append_sid("adr_character.{$phpEx}?" . POST_USERS_URL . "=" . $row['user_id'])));
        $i++;
    } while ($row = $db->sql_fetchrow($result));
}
$sql = "SELECT count(*) AS total FROM " . ADR_CHARACTERS_TABLE . "\r\n\t\tWHERE character_job_id <> 0";
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
}
if ($total = $db->sql_fetchrow($result)) {
    $total_users = $total['total'];
    $pagination = generate_pagination("adr_character_jobs.{$phpEx}?" . POST_USERS_URL . "={$searchid}&amp;mode2={$mode2}&amp;order={$sort_order}", $total_users, $board_config['topics_per_page'], $start) . '&nbsp;';
}
$template->assign_vars(array('POINTS' => $board_config['points_name'], 'L_CHARACTER_NAME' => $lang['Adr_character'], 'L_LEVEL' => $lang['Adr_character_level'], 'L_JOB_NAME' => $lang['Adr_job_list_name'], 'L_JOB_COMPLETED' => $lang['Adr_job_list_completed'], 'L_JOB_TOTAL_EARNED' => $lang['Adr_job_list_total_earnings'], 'L_JOB_SALARY' => $lang['Adr_job_list_salary'], 'L_JOB_DURATION' => $lang['Adr_job_list_duration'], 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'L_ORDER' => $lang['Order'], 'L_SORT' => $lang['Sort'], 'S_MODE_SELECT' => $select_sort_mode, 'S_ORDER_SELECT' => $select_sort_order, 'PAGINATION' => $pagination, 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, ceil($total_users / $board_config['topics_per_page'])), 'L_GOTO_PAGE' => $lang['Goto_page'], "S_LIST_ACTION" => append_sid("adr_character_jobs.{$phpEx}?" . POST_USERS_URL . "={$searchid}&amp;mode2={$mode2}&amp;order={$sort_order}"), "S_HIDDEN_FIELDS" => $s_hidden_fields));
include $phpbb_root_path . 'adr/includes/adr_header.' . $phpEx;
$template->pparse('body');
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
Ejemplo n.º 14
0
function adr_display_poster_infos($poster_id, $character_info, $race_info, $element_info, $class_info, $alignment_info, $pvp_info, $adr_con_info, $user_cell_time)
{
    global $db, $phpbb_root_path, $lang, $board_config, $phpEx, $table_prefix, $userdata;
    if (!defined('IN_ADR_CHARACTER')) {
        define('IN_ADR_CHARACTER', 1);
    }
    if (!defined('IN_ADR_BATTLE')) {
        define('IN_ADR_BATTLE', 1);
    }
    include_once $phpbb_root_path . 'adr/includes/adr_constants.' . $phpEx;
    include_once $phpbb_root_path . 'adr/includes/adr_global.' . $phpEx;
    include_once $phpbb_root_path . 'adr/includes/adr_functions_battle.' . $phpEx;
    $adr_general = $adr_con_info;
    $topic_config = explode('-', $board_config['Adr_topics_display']);
    $adr_topic_box = '';
    $character_rank_info = character_rank_info();
    $total_ranks = number_format(count($character_rank_info));
    if (!$topic_config[0] && !$topic_config[1] && !$topic_config[2] && !$topic_config[3] && !$topic_config[4] && !$topic_config[5]) {
        return $adr_topic_box;
    }
    for ($adr = 0; $adr < count($character_info); $adr++) {
        $adr_topic_box = '';
        if ($character_info[$adr]['character_id'] == $poster_id && $character_info[$adr]['character_class'] > '0') {
            for ($x = 0; $x < count($character_rank_info); $x++) {
                if ($character_rank_info[$x]['character_id'] == $poster_id) {
                    $rank = sprintf($lang['adr_stats_rank'], $x + 1, $total_ranks);
                }
            }
            $adr_topic_box .= '<fieldset class="fieldset" style="margin: 0px 0px 0px 0px;">';
            $adr_topic_box .= '<legend>' . $lang['Adr_character'] . '</legend>';
            #==== Show INACTIVE or JAILED status, if necessary
            //				if($character_info[$adr]['character_prefs_active'] == '0'){
            //					$adr_topic_box .= ($poster_id == $userdata['user_id']) ? sprintf($lang['Adr_character_inactive_topic'], '<a href="'. append_sid('adr_character_prefs.'. $phpEx .').'">', '</a>').'<br><br>' : sprintf($lang['Adr_character_inactive_topic'], '<b>', '</b>').'<br><br>';
            //				}
            //				elseif(($character_info[$adr]['character_prefs_active'] != '0') && ($user_cell_time > '0')){
            if ($user_cell_time > '0') {
                $adr_topic_box .= $poster_id != $userdata['user_id'] ? sprintf($lang['Adr_character_status_jail_topic'], '<a target="_blank" href="' . append_sid('adr_courthouse.' . $phpEx . '?celled_user_id=' . $poster_id) . '">', '</a>') . '<br><br>' : sprintf($lang['Adr_character_status_jail_topic'], '<b>', '</b>') . '<br><br>';
            }
            #==== Show character_name
            if (!empty($topic_config[5])) {
                $adr_topic_box .= '&nbsp;<a href="' . append_sid('adr_character.' . $phpEx . '?u=' . $character_info[$adr]['character_id']) . '">' . $character_info[$adr]['character_name'] . '</a><br>';
            }
            #==== Show current rank
            if (!empty($topic_config[7])) {
                $adr_topic_box .= '&nbsp;&nbsp;' . $rank . '<br>';
            }
            ##=== Show character level
            if (!empty($topic_config[0])) {
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_topics_level'] . ':&nbsp;' . $character_info[$adr]['character_level'] . '<br />';
            }
            #==== Show PvP link where applicable
            //				if(($topic_config[6]) && ($character_info[$adr]['prefs_pvp_allow'] == '1') && ($character_info[$adr]['character_prefs_active'] == '1') && ($character_info[$adr]['character_id'] != '0') && ($userdata['user_id'] > '0'))
            if (!empty($topic_config[6]) && $character_info[$adr]['prefs_pvp_allow'] == '1' && $character_info[$adr]['character_id'] != '0' && $userdata['user_id'] > '0') {
                #==== Check if the user hasn't already exceeded his maximum number of defies allowed
                $total_battles = 0;
                for ($pvp = 0; $pvp < count($pvp_info); $pvp++) {
                    if (($pvp_info[$pvp]['battle_opponent_id'] == $poster_id || $pvp_info[$pvp]['battle_challenger_id'] == $poster_id) && ($pvp_info[$pvp]['battle_result'] == '0' || $pvp_info[$pvp]['battle_result'] == '3')) {
                        $total_battles = $total_battles + 1;
                        if (!$pvp_info[$pvp]['battle_opponent_id']) {
                            break;
                        }
                    }
                }
                if ($adr_general['battle_pvp_defies_max'] >= $total_battles && $adr_general['battle_pvp_defies_max'] && $poster_id != $userdata['user_id']) {
                    for ($pvp = 0; $pvp < count($pvp_info); $pvp++) {
                        if (($pvp_info[$pvp]['battle_challenger_id'] == $poster_id || $pvp_info[$pvp]['battle_challenger_id'] == $userdata['user_id']) && ($pvp_info[$pvp]['battle_opponent_id'] == $poster_id || $pvp_info[$pvp]['battle_opponent_id'] == $userdata['user_id']) && ($pvp_info[$pvp]['battle_result'] == '0' || $pvp_info[$pvp]['battle_result'] == '3')) {
                            $this_battle_id = $pvp_info[$pvp]['battle_id'];
                            $this_battle_turn = $pvp_info[$pvp]['battle_turn'];
                            $this_battle_result = $pvp_info[$pvp]['battle_result'];
                            break;
                        }
                    }
                    #==== Close 2nd for array
                    if ($this_battle_id) {
                        #==== Check if is current chars turn
                        if ($this_battle_turn == $userdata['user_id']) {
                            $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_pvp_post_text'] . ':&nbsp;<a href="' . append_sid("adr_battle_pvp.{$phpEx}?battle_id=" . $this_battle_id) . '" target="_parent">' . $lang['Adr_pvp_post_your_turn'] . '</a><br />';
                        } elseif ($this_battle_turn == 0 && $this_battle_result == 0) {
                            $opponent_turn = sprintf($lang['Adr_pvp_post_opponent_turn'], $character_info[$adr]['character_name']);
                            $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_pvp_post_text'] . ':&nbsp;<a href="' . append_sid("adr_character_pvp.{$phpEx}?mode=waiting") . '" target="_parent"><i>' . $lang['Adr_pvp_opponent_awaiting'] . '</i></a><br />';
                        } else {
                            $opponent_turn = sprintf($lang['Adr_pvp_post_opponent_turn'], $character_info[$adr]['character_name']);
                            $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_pvp_post_text'] . ':&nbsp;<a href="' . append_sid("adr_battle_pvp.{$phpEx}?mode=see&amp;battle_id=" . $this_battle_id) . '" target="_parent">' . $opponent_turn . '</a><br />';
                        }
                    } else {
                        $total_battles = 0;
                        for ($pvp = 0; $pvp < count($pvp_info); $pvp++) {
                            if (($pvp_info[$pvp]['battle_opponent_id'] == $userdata['user_id'] || $pvp_info[$pvp]['battle_challenger_id'] == $userdata['user_id']) && ($pvp_info[$pvp]['battle_result'] == '0' || $pvp_info[$pvp]['battle_result'] == '3')) {
                                $total_battles = $total_battles + 1;
                                if (!$pvp_info[$pvp]['battle_opponent_id']) {
                                    break;
                                }
                            }
                        }
                        $total = $total_battles;
                        if ($adr_general['battle_pvp_defies_max'] >= $total && $adr_general['battle_pvp_defies_max'] && $poster_id != $userdata['user_id']) {
                            $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_pvp_post_text'] . ':&nbsp;<a href="' . append_sid("adr_character_pvp.{$phpEx}?mode=defy_action&amp;defied=" . $poster_id) . '" target="_parent">' . $lang['Adr_pvp_post_attack'] . '</a><br />';
                        }
                    }
                }
                #==== Close 2nd if statement
            }
            #==== End of pvp check
            if (!empty($topic_config[8])) {
                $adr_topic_box .= '<br>' . $lang['Adr_character_battle_stats_title'] . ':<br>';
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_monster_list_hp'] . ': ' . $character_info[$adr]['character_hp'] . '/' . $character_info[$adr]['character_hp_max'] . '<br>';
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_monster_list_mp'] . ': ' . $character_info[$adr]['character_mp'] . '/' . $character_info[$adr]['character_mp_max'] . '<br>';
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_monster_list_att'] . ':&nbsp;' . adr_battle_make_att($character_info[$adr]['character_might'], $character_info[$adr]['character_dexterity']) . '<br>';
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_monster_list_def'] . ':&nbsp;' . adr_battle_make_def($character_info[$adr]['character_ac'], $character_info[$adr]['character_dexterity']) . '<br>';
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_monster_list_ma'] . ':&nbsp;' . adr_battle_make_magic_att($character_info[$adr]['character_intelligence']) . '<br>';
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_monster_list_md'] . ':&nbsp;' . adr_battle_make_magic_def($character_info[$adr]['character_wisdom']) . '<br>';
            }
            if ($topic_config[1] || $topic_config[2] || $topic_config[3] || $topic_config[4]) {
                $adr_topic_box .= '<br>' . $lang['Adr_character_characteristics'] . ':<br>';
            }
            if ($topic_config[1]) {
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_topics_class'] . ':&nbsp;&nbsp;';
                for ($class = 0; $class < count($class_info); $class++) {
                    if ($character_info[$adr]['character_class'] == $class_info[$class]['class_id']) {
                        $class_lang = adr_get_lang($class_info[$class]['class_name']);
                        $class_img = $class_info[$class]['class_img'];
                        break;
                    }
                }
                if ($topic_config[1] == '1') {
                    $adr_topic_box .= $class_lang;
                } else {
                    $adr_topic_box .= '<img src="adr/images/classes/' . $class_img . '">';
                }
                $adr_topic_box .= '<br />';
            }
            #==== Close topic_config[1] if statement
            if ($topic_config[2]) {
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_topics_race'] . ':&nbsp;&nbsp;';
                for ($race = 0; $race < count($race_info); $race++) {
                    if ($character_info[$adr]['character_race'] == $race_info[$race]['race_id']) {
                        $race_lang = adr_get_lang($race_info[$race]['race_name']);
                        $race_img = $race_info[$race]['race_img'];
                        break;
                    }
                }
                if ($topic_config[2] == '1') {
                    $adr_topic_box .= $race_lang;
                } else {
                    $adr_topic_box .= '<img src="adr/images/races/' . $race_img . '">';
                }
                $adr_topic_box .= '<br />';
            }
            #==== Close topic_config[2] if statement
            if ($topic_config[3]) {
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_topics_element'] . ':&nbsp;&nbsp;';
                for ($elements = 0; $elements < count($element_info); $elements++) {
                    if ($character_info[$adr]['character_element'] == $element_info[$elements]['element_id']) {
                        $element_lang = adr_get_lang($element_info[$elements]['element_name']);
                        $element_img = $element_info[$elements]['element_img'];
                        break;
                    }
                }
                if ($topic_config[3] == '1') {
                    $adr_topic_box .= $element_lang;
                } else {
                    $adr_topic_box .= '<img src="adr/images/elements/' . $element_img . '">';
                }
                $adr_topic_box .= '<br />';
            }
            #==== Close topic_config[3] if statement
            if ($topic_config[4]) {
                $adr_topic_box .= '&nbsp;&nbsp;' . $lang['Adr_topics_alignment'] . ':&nbsp;&nbsp;';
                for ($alignment = 0; $alignment < count($alignment_info); $alignment++) {
                    if ($character_info[$adr]['character_alignment'] == $alignment_info[$alignment]['alignment_id']) {
                        $alignment_lang = adr_get_lang($alignment_info[$alignment]['alignment_name']);
                        $alignment_img = $alignment_info[$alignment]['alignment_img'];
                        break;
                    }
                }
                if ($topic_config[4] == '1') {
                    $adr_topic_box .= $alignment_lang;
                } else {
                    $adr_topic_box .= '<img src="adr/images/alignments/' . $alignment_img . '">';
                }
                $adr_topic_box .= '<br />';
            }
            #==== Close topic_config[4] if statement
            $adr_topic_box .= '</fieldset>';
            break;
        }
        #==== End if statement for matching id
    }
    #==== End for array
    return $adr_topic_box;
}
Ejemplo n.º 15
0
 }
 if ($row['item_restrict_con'] > '0') {
     // Constitution restriction. Has to be more than 0 otherwise pointless restriction
     $char_resist_list .= $lang['Adr_char_con'] . ' [' . $row['item_restrict_con'] . ']; ';
 }
 if ($row['item_restrict_int'] > '0') {
     // Intelligence restriction. Has to be more than 0 otherwise pointless restriction
     $char_resist_list .= $lang['Adr_char_int'] . ' [' . $row['item_restrict_int'] . ']; ';
 }
 if ($row['item_restrict_wis'] > '0') {
     // Wisdom restriction. Has to be more than 0 otherwise pointless restriction
     $char_resist_list .= $lang['Adr_char_wis'] . ' [' . $row['item_restrict_wis'] . ']; ';
 }
 if ($row['item_restrict_cha'] > '0') {
     // Charisma restriction. Has to be more than 0 otherwise pointless restriction
     $char_resist_list .= $lang['Adr_char_cha'] . ' [' . $row['item_restrict_cha'] . ']';
 }
 if ($row['item_restrict_level'] > '1' || $row['item_restrict_str'] > '0' || $row['item_restrict_dex'] > '0' || $row['item_restrict_con'] > '0' || $row['item_restrict_int'] > '0' || $row['item_restrict_wis'] > '0' || $row['item_restrict_cha'] > '0') {
     $template->assign_block_vars('main.items.resist_chars', array("CHAR_RESIST_LIST" => $char_resist_list, "L_CHAR_RESIST_LIST" => $lang['Adr_char_restrict_title']));
 }
 ##=== END: Show any level or characteristic restrictions for this item
 ##=== START: Show stolen info
 if ($row['item_stolen_id'] > '0') {
     // Loop through the shop infos array and grab info
     for ($s = 0; $s < count($shop_info); $s++) {
         if ($row['item_stolen_id'] == $shop_info[$s]['shop_id']) {
             $shop_name = $shop_info[$s]['shop_name'];
         }
     }
     // Make sure we have a shop name!
     $shop_name = $shop_name == '' ? 'Unknown' : adr_get_lang($shop_name);
            }
            $template->assign_vars(array("ROW_CLASS" => $theme['td_class1'], "ROW_CLASS_2" => $theme['td_class2'], "ACTION_SELECT" => $action_select, "ITEM_ID" => $row['spell_id'], "ITEM_NAME" => $row['spell_name'], "ITEM_DESC" => $row['spell_desc'], "ITEM_IMG" => $item_img, "ITEM_TYPE" => $lang[$row['item_type_lang']], "ITEM_POWER" => $row['spell_power'], "ITEM_ELEMENT" => $element_img, "ITEM_ADD_POWER" => $row['spell_add_power'], "ITEM_MP" => $row['spell_mp_use'], "ITEM_POINTS" => $points_name, "SHOP_OWNER_ID" => $store_owner_id, "L_ITEM_POWER" => $lang['Adr_items_power'], "L_ITEM_ADD_POWER" => $lang['Adr_items_dex'], "L_ITEM_MP" => $lang['Adr_items_mp_use'], "L_ITEM_DESC" => $lang['Adr_store_desc'], "L_ITEM_DURA" => $lang['Adr_store_duration'], "L_ITEM_IMG" => $lang['Adr_races_image'], "L_ITEM_PRICE" => $lang['Adr_store_price'], "L_ITEM_TYPE" => $lang['Adr_items_type_use'], "L_ITEM_WEIGHT" => $lang['Adr_store_weight'], "L_ITEM_ELEMENT" => $lang['Adr_store_element'], "L_ACTION" => $lang['Adr_items_action'], "L_SUBMIT" => $lang['Submit']));
            break;
    }
} else {
    adr_template_file('adr_inventory_body_spells.tpl');
    $template->assign_block_vars('main', array());
    $sql = "SELECT i.* , t.item_type_lang FROM " . ADR_SHOPS_SPELLS_TABLE . " i\r\n\t\t\tLEFT JOIN " . ADR_SHOPS_ITEMS_TYPE_TABLE . " t ON ( i.item_type_use = t.item_type_id )\r\n\t\tWHERE i.spell_owner_id = {$searchid}\r\n\t\t{$cat_sql}\r\n\t\tORDER BY {$order_by}";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not query users items', '', __LINE__, __FILE__, $sql);
    }
    if ($row = $db->sql_fetchrow($result)) {
        $i = 0;
        do {
            $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
            $template->assign_block_vars('main.items', array("ROW_CLASS" => $row_class, "ITEM_NAME" => adr_get_lang($row['spell_name']), "ITEM_DESC" => adr_get_lang($row['spell_desc']), "ITEM_IMG" => $row['spell_icon'], "ITEM_TYPE" => $lang[$row['item_type_lang']], "ITEM_POWER" => $row['spell_power'], "ITEM_ID" => $row['spell_id'], "U_ITEM_GIVE" => append_sid("adr_character_inventory_spells.{$phpEx}?mode=give&amp;item_id=" . $row['spell_id']), "U_ITEM_SELL" => append_sid("adr_character_inventory_spells.{$phpEx}?mode=sell&amp;item_id=" . $row['spell_id']), "U_ITEM_EDIT" => append_sid("adr_character_inventory_spells.{$phpEx}?mode=edit&amp;item_id=" . $row['spell_id']), "U_ITEM_SHOP" => append_sid("adr_character_inventory_spells.{$phpEx}?mode=shop&amp;item_id=" . $row['spell_id']), "U_ITEM_INFO" => append_sid("adr_character_inventory_spells.{$phpEx}?mode=view_item&amp;item_owner_id=" . $row['spell_owner_id'] . "&amp;item_id=" . $row['spell_id'] . "")));
            if ($user_id == $searchid) {
                $template->assign_block_vars("main.items.owner", array());
            }
            $i++;
        } while ($row = $db->sql_fetchrow($result));
    }
    if ($user_id == $searchid) {
        $colspan = 9;
        $template->assign_block_vars("main.owner", array());
    }
    $cat_sql = $cat ? 'AND item_type_use = ' . $cat : '';
    $sql = "SELECT count(*) AS total FROM " . ADR_SHOPS_SPELLS_TABLE . " \r\n\t\tWHERE spell_owner_id = {$searchid}\r\n\t\t{$cat_sql} ";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
    }
Ejemplo n.º 17
0
        $order_by = "set_name {$sort_order} LIMIT {$start}, " . $board_config['topics_per_page'];
        break;
    default:
        $order_by = "set_name {$sort_order} LIMIT {$start}, " . $board_config['topics_per_page'];
        break;
}
$sql = "SELECT * FROM " . ADR_ARMOUR_SET_TABLE . "\r\n\t\tORDER BY {$order_by}";
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}
if ($sets = $db->sql_fetchrow($result)) {
    $i = 0;
    do {
        $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
        $image = $sets['set_img'] != '' ? '<img src="adr/images/sets/' . $sets['set_img'] . '">' : '';
        $template->assign_block_vars('sets', array("ROW_CLASS" => $row_class, "SET_ID" => $sets['set_id'], "SET_IMG" => $image, "SET_NAME" => $sets['set_name'], "SET_DESC" => $sets['set_desc'], "SET_HELM" => adr_get_lang($sets['set_helm']), "SET_ARMOUR" => adr_get_lang($sets['set_armour']), "SET_GLOVES" => adr_get_lang($sets['set_gloves']), "SET_SHIELD" => adr_get_lang($sets['set_shield']), "SET_MIGHT_BONUS" => $sets['set_might_bonus'], "SET_CON_BONUS" => $sets['set_constitution_bonus'], "SET_AC_BONUS" => $sets['set_ac_bonus'], "SET_DEX_BONUS" => $sets['set_dexterity_bonus'], "SET_INT_BONUS" => $sets['set_intelligence_bonus'], "SET_WIS_BONUS" => $sets['set_wisdom_bonus'], "SET_MIGHT_PEN" => $sets['set_might_penalty'], "SET_CON_PEN" => $sets['set_constitution_penalty'], "SET_AC_PEN" => $sets['set_ac_penalty'], "SET_DEX_PEN" => $sets['set_dexterity_penalty'], "SET_INT_PEN" => $sets['set_intelligence_penalty'], "SET_WIS_PEN" => $sets['set_wisdom_penalty']));
        $i++;
    } while ($sets = $db->sql_fetchrow($result));
}
$sql = "SELECT count(*) AS total FROM " . ADR_ARMOUR_SET_TABLE;
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, 'Error getting total users', '', __LINE__, __FILE__, $sql);
}
if ($total = $db->sql_fetchrow($result)) {
    $total_users = $total['total'];
    $pagination = generate_pagination("adr_character_armour_sets.{$phpEx}?" . POST_USERS_URL . "={$searchid}&amp;mode2={$mode2}&amp;order={$sort_order}", $total_users, $board_config['topics_per_page'], $start) . '&nbsp;';
}
$template->assign_vars(array('POINTS' => get_reward_name(), 'L_SET_HELM' => $lang['Adr_set_helm'], 'L_SET_ARMOUR' => $lang['Adr_set_armour'], 'L_SET_GLOVES' => $lang['Adr_set_gloves'], 'L_SET_SHIELD' => $lang['Adr_set_shield'], 'L_SET_MIGHT_BONUS' => $lang['Adr_set_might_bonus'], 'L_SET_CON_BONUS' => $lang['Adr_set_con_bonus'], 'L_SET_AC_BONUS' => $lang['Adr_set_ac_bonus'], 'L_SET_DEX_BONUS' => $lang['Adr_set_dex_bonus'], 'L_SET_INT_BONUS' => $lang['Adr_set_int_bonus'], 'L_SET_WIS_BONUS' => $lang['Adr_set_wis_bonus'], 'L_SET_MIGHT_PEN' => $lang['Adr_set_might_pen'], 'L_SET_CON_PEN' => $lang['Adr_set_con_pen'], 'L_SET_AC_PEN' => $lang['Adr_set_ac_pen'], 'L_SET_DEX_PEN' => $lang['Adr_set_dex_pen'], 'L_SET_INT_PEN' => $lang['Adr_set_int_pen'], 'L_SET_WIS_PEN' => $lang['Adr_set_wis_pen'], 'L_SET_IMG' => $lang['Adr_races_image'], 'L_SET_IMG_EXPLAIN' => $lang['Adr_set_img_explain'], 'L_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'L_ORDER' => $lang['Order'], 'L_SORT' => $lang['Sort'], 'S_MODE_SELECT' => $select_sort_mode, 'S_ORDER_SELECT' => $select_sort_order, 'PAGINATION' => $pagination, 'PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, ceil($total_users / $board_config['topics_per_page'])), 'L_GOTO_PAGE' => $lang['Goto_page'], "S_LIST_ACTION" => append_sid("adr_character_armour_sets.{$phpEx}?" . POST_USERS_URL . "={$searchid}&amp;mode2={$mode2}&amp;order={$sort_order}"), "S_HIDDEN_FIELDS" => isset($s_hidden_fields) ? $s_hidden_fields : ''));
include $phpbb_root_path . 'adr/includes/adr_header.' . $phpEx;
$template->pparse('body');
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
function adr_battle_equip_screen($user_id)
{
    global $db, $lang, $adr_general, $template, $phpEx;
    $user_id = intval($user_id);
    $char = adr_get_user_infos($user_id);
    ### START restriction checks ###
    $item_sql = adr_make_restrict_sql($char);
    ### END restriction checks ###
    if ($char['character_hp'] < '1') {
        $message = $lang['Adr_battle_character_dead'];
        $message .= '<br /><br />' . sprintf($lang['Adr_battle_temple'], "<a href=\"" . 'adr_temple.' . $phpEx . "\">", "</a>");
        $message .= '<br /><br />' . sprintf($lang['Adr_character_return'], "<a href=\"" . 'adr_character.' . $phpEx . "\">", "</a>");
        message_die(GENERAL_MESSAGE, $message);
    }
    // No battle in progress , display the equipment page
    adr_template_file('adr_battle_equip_body.tpl');
    // First select the available items
    $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\n\t\tWHERE item_in_shop = '0'\n\t\tAND item_duration > '0'\n\t\tAND item_in_warehouse = '0'\n\t\t{$item_sql}\n\t\tAND item_owner_id = '{$user_id}'";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
    }
    $items = $db->sql_fetchrowset($result);
    // Prepare the items list
    $armor_list = '<select name="item_armor">';
    $armor_list .= '<option value = "0" >' . $lang['Adr_battle_no_armor'] . '</option>';
    $buckler_list = '<select name="item_buckler">';
    $buckler_list .= '<option value = "0" >' . $lang['Adr_battle_no_buckler'] . '</option>';
    $helm_list = '<select name="item_helm">';
    $helm_list .= '<option value = "0" >' . $lang['Adr_battle_no_helm'] . '</option>';
    $gloves_list = '<select name="item_gloves">';
    $gloves_list .= '<option value = "0" >' . $lang['Adr_battle_no_gloves'] . '</option>';
    $amulet_list = '<select name="item_amulet">';
    $amulet_list .= '<option value = "0" >' . $lang['Adr_battle_no_amulet'] . '</option>';
    $ring_list = '<select name="item_ring">';
    $ring_list .= '<option value = "0" >' . $lang['Adr_battle_no_ring'] . '</option>';
    $equip_armor = $char['equip_armor'];
    $equip_buckler = $char['equip_buckler'];
    $equip_helm = $char['equip_helm'];
    $equip_gloves = $char['equip_gloves'];
    $equip_amulet = $char['equip_amulet'];
    $equip_ring = $char['equip_ring'];
    for ($i = 0; $i < count($items); $i++) {
        $item_power = $items[$i]['item_power'] + $items[$i]['item_add_power'];
        if ($items[$i]['item_type_use'] == '7') {
            $armor_selected = $equip_armor == $items[$i]['item_id'] ? 'selected' : '';
            $armor_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $armor_selected . ' >' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
        }
        if ($items[$i]['item_type_use'] == '8') {
            $buckler_selected = $equip_buckler == $items[$i]['item_id'] ? 'selected' : '';
            $buckler_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $buckler_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
        }
        if ($items[$i]['item_type_use'] == '9') {
            $helm_selected = $equip_helm == $items[$i]['item_id'] ? 'selected' : '';
            $helm_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $helm_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
        }
        if ($items[$i]['item_type_use'] == '10') {
            $gloves_selected = $equip_gloves == $items[$i]['item_id'] ? 'selected' : '';
            $gloves_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $gloves_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
        }
        if ($items[$i]['item_type_use'] == '13') {
            $amulet_selected = $equip_amulet == $items[$i]['item_id'] ? 'selected' : '';
            $amulet_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $amulet_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
        }
        if ($items[$i]['item_type_use'] == '14') {
            $ring_selected = $equip_ring == $items[$i]['item_id'] ? 'selected' : '';
            $ring_list .= '<option value = "' . $items[$i]['item_id'] . '" ' . $ring_selected . '>' . adr_get_lang($items[$i]['item_name']) . ' ( ' . $lang['Adr_items_power'] . ' : ' . $item_power . ' - ' . $lang['Adr_items_duration'] . ' : ' . $items[$i]['item_duration'] . ' )' . '</option>';
        }
    }
    $armor_list .= '</select>';
    $buckler_list .= '</select>';
    $helm_list .= '</select>';
    $gloves_list .= '</select>';
    $amulet_list .= '</select>';
    $ring_list .= '</select>';
    $template->assign_vars(array('SELECT_ARMOR' => $armor_list, 'SELECT_BUCKLER' => $buckler_list, 'SELECT_HELM' => $helm_list, 'SELECT_GLOVES' => $gloves_list, 'SELECT_AMULET' => $amulet_list, 'SELECT_RING' => $ring_list, 'L_EQUIPMENT' => $lang['Adr_battle_equipment'], 'L_SELECT_ARMOR' => $lang['Adr_battle_select_armor'], 'L_SELECT_BUCKLER' => $lang['Adr_battle_select_buckler'], 'L_SELECT_HELM' => $lang['Adr_battle_select_helm'], 'L_SELECT_GLOVES' => $lang['Adr_battle_select_gloves'], 'L_SELECT_AMULET' => $lang['Adr_battle_select_amulet'], 'L_SELECT_RING' => $lang['Adr_battle_select_ring'], 'L_FIGHT' => $lang['Adr_battle_fight']));
    return;
}
Ejemplo n.º 19
0
             $theftskill_rem_effect_value = $effects_list[$i + 1];
             $theftskill_rem_monster_hit = $effects_list[$i + 3];
             $theftskill_rem_perm_effect = $effects_list[$i + 5];
         }
         if ($effects_list[$i] == 'ATT') {
             $att_effect_value = $effects_list[$i + 1];
             $att_monster_hit = $effects_list[$i + 3];
             $att_perm_effect = $effects_list[$i + 5];
         }
         if ($effects_list[$i] == 'DEF') {
             $def_effect_value = $effects_list[$i + 1];
             $def_monster_hit = $effects_list[$i + 3];
             $def_perm_effect = $effects_list[$i + 5];
         }
     }
     $template->assign_vars(array("L_RECIPE_NAME" => $lang['recipe_name'], "L_RECIPE_NAME_DESC" => $lang['recipe_name_desc'], "L_RECIPE_DESC" => $lang['recipe_desc'], "L_RECIPE_DESC_DESC" => $lang['recipe_desc_desc'], "L_RECIPE_IMG" => $lang['Adr_races_image'], "L_RECIPE_IMG_DESC" => $lang['Adr_items_image_explain'], "L_RECIPE_LEVEL" => $lang['recipe_level'], "L_RECIPE_LEVEL_DESC" => $lang['recipe_level_desc'], "L_RECIPE_ADMIN_ONLY" => $lang['recipe_admin_only'], "L_RECIPE_ADMIN_ONLY_DESC" => $lang['recipe_admin_only_desc'], "RECIPE_NAME" => $recipe['item_name'], "RECIPE_DESC" => $recipe['item_desc'], "RECIPE_IMG" => $recipe['item_icon'], "RECIPE_LEVEL" => $recipe['item_power'], "RECIPE_DURATION" => $recipe['item_duration'], "RECIPE_DURATION_MAX" => $recipe['item_duration_max'], "RECIPE_ADD_POWER" => $recipe['item_add_power'], "RECIPE_MP_USE" => $recipe['item_mp_use'], "RECIPE_PRICE" => $recipe['item_price'], "RECIPE_ADMIN_ONLY" => $recipe['item_auth'] ? 'checked' : '', "RECIPE_SELL_BACK_PERCENT" => $recipe['item_sell_back_percentage'], "L_RECIPE_WEIGHT" => $lang['Adr_shops_item_weight'], "RECIPE_WEIGHT" => $recipe['item_weight'], "L_RECIPE_STORE" => $lang['Adr_items_store'], "RECIPE_STORE_LIST" => $recipe_store_cat_list, "L_RECIPE_STEAL" => $lang['Adr_items_steal'], "L_RECIPE_STEAL_EXPLAIN" => $lang['Adr_items_steal_explain'], "RECIPE_STEAL_LIST" => $recipe_steal_list, "L_RECIPE_QUALITY" => $lang['Adr_items_quality'], "RECIPE_QUALITY" => $r_quality, "L_RECIPE_TYPE" => $lang['Adr_items_type_use'], "RECIPE_TYPE" => adr_get_item_type(20, 'simple'), "L_RECIPE_DURATION" => $lang['Adr_items_duration'], "L_RECIPE_DURATION_MAX" => $lang['Adr_items_duration_max'], "L_RECIPE_DURATION" => $lang['Adr_items_duration'], "L_RECIPE_DURATION_MAX" => $lang['Adr_items_duration_max'], "L_RECIPE_PRICE" => $lang['Adr_items_price'], "L_RECIPE_PRICE_EXPLAIN" => $lang['Adr_items_price_explain'], "L_RECIPE_SELL_BACK_PERCENT" => $lang['Adr_item_sell_back'], "L_RECIPE_SELL_BACK_PERCENT_EXPLAIN" => $lang['Adr_item_sell_back_explain'], "L_RECIPE_ITEMS_REQ" => $lang['recipe_items_req'], "L_RECIPE_ITEMS_REQ_DESC" => $lang['recipe_items_req_desc'], "L_RECIPE_ITEMS_AMOUNT" => $lang['recipe_items_amount'], "L_RECIPE_ITEMS_AMOUNT_DESC" => $lang['recipe_items_amount_desc'], "RECIPE_ITEMS_REQ" => $items_list, "RECIPE_ITEMS_AMOUNT" => $new_item_amount_list, "RECIPE_EFFECT" => $item['item_brewing_effect'], "L_RECIPE_EFFECT" => $lang['recipe_effect'], "L_RECIPE_EFFECT_DESC" => $lang['recipe_effect_desc'], "L_RECIPE_EFFECT_HP" => $lang['Adr_character_health'], "L_RECIPE_EFFECT_MP" => $lang['Adr_character_magic'], "L_RECIPE_EFFECT_EXP" => $lang['Adr_character_experience'], "L_RECIPE_EFFECT_GOLD" => get_reward_name(), "L_RECIPE_EFFECT_SP" => $lang['Adr_character_sp'], "L_RECIPE_EFFECT_AC" => $lang['Adr_character_ac'], "L_RECIPE_EFFECT_STR" => $lang['Adr_character_power'], "L_RECIPE_EFFECT_DEX" => $lang['Adr_character_agility'], "L_RECIPE_EFFECT_CON" => $lang['Adr_character_endurance'], "L_RECIPE_EFFECT_INT" => $lang['Adr_character_intelligence'], "L_RECIPE_EFFECT_WIS" => $lang['Adr_character_willpower'], "L_RECIPE_EFFECT_CHA" => $lang['Adr_character_charm'], "L_RECIPE_EFFECT_BATTLES_REM" => $lang['Adr_character_battle_limit'], "L_RECIPE_EFFECT_SKILLUSE_REM" => $lang['Adr_character_skill_limit'], "L_RECIPE_EFFECT_TRADINGSKILL_REM" => $lang['Adr_character_trading_limit'], "L_RECIPE_EFFECT_THEFTSKILL_REM" => $lang['Adr_character_thief_limit'], "L_RECIPE_EFFECT_MA" => $lang['Adr_character_ma'], "L_RECIPE_EFFECT_MD" => $lang['Adr_character_md'], "L_RECIPE_EFFECT_ATT" => $lang['Adr_monster_list_att'], "L_RECIPE_EFFECT_DEF" => $lang['Adr_monster_list_def'], "L_RECIPE_TEMP_AND_PERM" => $lang['Adr_temp_and_perm_effects'], "L_RECIPE_PERM_ONLY" => $lang['Adr_perm_only_effects'], "L_RECIPE_PERM_EFFECT" => $lang['Adr_perm_effect'], "L_RECIPE_HIT_MONSTER" => $lang['Adr_hit_monster'], "RECIPE_EFFECT_HP" => $hp_effect_value, "RECIPE_EFFECT_HP_M" => $hp_monster_hit ? 'checked' : '', "RECIPE_EFFECT_MP" => $mp_effect_value, "RECIPE_EFFECT_MP_M" => $mp_monster_hit ? 'checked' : '', "RECIPE_EFFECT_AC" => $ac_effect_value, "RECIPE_EFFECT_STR" => $str_effect_value, "RECIPE_EFFECT_DEX" => $dex_effect_value, "RECIPE_EFFECT_CON" => $con_effect_value, "RECIPE_EFFECT_INT" => $int_effect_value, "RECIPE_EFFECT_WIS" => $wis_effect_value, "RECIPE_EFFECT_CHA" => $cha_effect_value, "RECIPE_EFFECT_MA_PERM" => $ma_perm_effect ? 'checked' : '', "RECIPE_EFFECT_MA_M" => $ma_monster_hit ? 'checked' : '', "RECIPE_EFFECT_MA" => $ma_effect_value, "RECIPE_EFFECT_MD_PERM" => $md_perm_effect ? 'checked' : '', "RECIPE_EFFECT_MD_M" => $md_monster_hit ? 'checked' : '', "RECIPE_EFFECT_MD" => $md_effect_value, "RECIPE_EFFECT_ATT_M" => $att_monster_hit ? 'checked' : '', "RECIPE_EFFECT_ATT" => $att_effect_value, "RECIPE_EFFECT_DEF_M" => $def_monster_hit ? 'checked' : '', "RECIPE_EFFECT_DEF" => $def_effect_value, "RECIPE_EFFECT_EXP" => $exp_effect_value, "RECIPE_EFFECT_GOLD" => $gold_effect_value, "RECIPE_EFFECT_SP" => $sp_effect_value, "RECIPE_EFFECT_BATTLES_REM" => $battles_rem_effect_value, "RECIPE_EFFECT_SKILLUSE_REM" => $skilluse_rem_effect_value, "RECIPE_EFFECT_TRADINGSKILL_REM" => $tradingskill_rem_effect_value, "RECIPE_EFFECT_THEFTSKILL_REM" => $theftskill_rem_effect_value, "ITEM_NAME" => $item['item_name'], "ITEM_DESC" => $item['item_desc'], "ITEM_NAME_EXPLAIN" => adr_get_lang($item['item_name']), "ITEM_DESC_EXPLAIN" => adr_get_lang($item['item_desc']), "ITEM_IMG" => $item['item_icon'], "ITEM_QUALITY" => adr_get_item_quality($item['item_quality'], 'list'), "ITEM_TYPE" => adr_get_item_type(19, 'simple'), "ITEM_ELEMENT_LIST" => $element_weap_list, "ITEM_ELEMENT_STR" => $item['item_element_str_dmg'], "ITEM_ELEMENT_SAME" => $item['item_element_same_dmg'], "ITEM_ELEMENT_WEAK" => $item['item_element_weak_dmg'], "ITEM_STORE_LIST" => $store_cat_list, "ITEM_WEIGHT" => $item['item_weight'], "ITEM_AUTH" => $item['item_auth'] ? 'checked' : '', "ITEM_MAX_SKILL" => $item['item_max_skill'], "ITEM_SELL_BACK_PERCENT" => $item['item_sell_back_percentage'], "ITEM_STEAL_LIST" => $steal_list, "ITEM_DURATION" => $item['item_duration'], "ITEM_DURATION_MAX" => $item['item_duration_max'], "ITEM_POWER" => $item['item_power'], "ITEM_ADD_POWER" => $item['item_add_power'], "ITEM_MP_USE" => $item['item_mp_use'], "ITEM_PRICE" => $item['item_price'], "L_ITEM_STEAL" => $lang['Adr_items_steal'], "L_ITEM_STEAL_EXPLAIN" => $lang['Adr_items_steal_explain'], "L_ITEM_SELL_BACK_PERCENT" => $lang['Adr_item_sell_back'], "L_ITEM_SELL_BACK_PERCENT_EXPLAIN" => $lang['Adr_item_sell_back_explain'], "L_ITEM_ELEMENT" => $lang['Adr_shops_item_element'], "L_ITEM_ELEMENT_STR" => $lang['Adr_shops_item_element_str'], "L_ITEM_ELEMENT_SAME" => $lang['Adr_shops_item_element_same'], "L_ITEM_ELEMENT_WEAK" => $lang['Adr_shops_item_element_weak'], "L_ITEM_MAX_SKILL" => $lang['Adr_item_max_skill'], "L_ITEM_WEIGHT" => $lang['Adr_shops_item_weight'], "L_ITEM_STORE" => $lang['Adr_items_store'], "L_ITEM_ENHANCEMENTS" => $lang['Adr_items_enhancements'], "L_ITEM_ADD_POWER" => $lang['Adr_items_dex'], "L_ITEM_ADD_POWER_EXPLAIN" => $lang['Adr_items_dex_explain'], "L_ITEM_MP_USE" => $lang['Adr_items_mp_use'], "L_ITEM_MP_USE_EXPLAIN" => $lang['Adr_items_mp_use_explain'], "L_POINTS" => $board_config['points_name'], "L_NAME_EXPLAIN" => $lang['Adr_races_name_explain'], "L_RECIPES_TITLE" => $lang['Adr_recipes_add_title'], "L_RECIPES_EXPLAIN" => $lang['Adr_recipes_add_title_explain'], "L_ITEM_NAME" => $lang['Adr_shops_categories_item_name'], "L_ITEM_DESC" => $lang['Adr_shops_categories_item_desc'], "L_ITEM_QUALITY" => $lang['Adr_items_quality'], "L_ITEM_POWER" => $lang['Adr_items_power'], "L_ITEM_ENHANCEMENTS" => $lang['Adr_items_enhancements'], "L_ITEM_ADD_POWER" => $lang['Adr_items_dex'], "L_ITEM_ADD_POWER_EXPLAIN" => $lang['Adr_items_dex_explain'], "L_ITEM_MP_USE" => $lang['Adr_items_mp_use'], "L_ITEM_MP_USE_EXPLAIN" => $lang['Adr_items_mp_use_explain'], "L_ITEM_DURATION" => $lang['Adr_items_duration'], "L_ITEM_DURATION_MAX" => $lang['Adr_items_duration_max'], "L_ITEM_TYPE" => $lang['Adr_items_type_use'], "L_ITEM_AUTH" => $lang['Adr_store_auth'], "L_NAME" => $lang['Adr_races_name'], "L_DESC" => $lang['Adr_races_desc'], "L_ACTION" => $lang['Action'], "L_ITEMS" => $lang['Adr_shops_categories_items'], "L_EDIT" => $lang['Edit'], "L_DELETE" => $lang['Delete'], "L_ITEM_IMG" => $lang['Adr_races_image'], "L_ITEM_PRICE" => $lang['Adr_items_price'], "L_ITEM_PRICE_EXPLAIN" => $lang['Adr_items_price_explain'], "L_IMG" => $lang['Adr_races_image'], "L_IMG_EXPLAIN" => $lang['Adr_items_image_explain'], "L_ITEM_ELEMENT" => $lang['Adr_shops_item_element'], "L_SUBMIT" => $lang['Submit'], "S_ITEMS_ACTION" => append_sid("admin_adr_brewing_recipes.{$phpEx}"), "S_HIDDEN_FIELDS" => $s_hidden_fields));
     $template->pparse("body");
     break;
 case "save_recipe":
     $item_id = intval($HTTP_POST_VARS['item_id']);
     $recipe_id = intval($HTTP_POST_VARS['recipe_id']);
     $item_name = isset($HTTP_POST_VARS['item_name']) ? trim($HTTP_POST_VARS['item_name']) : trim($HTTP_GET_VARS['item_name']);
     $recipe_name = isset($HTTP_POST_VARS['recipe_name']) ? trim($HTTP_POST_VARS['recipe_name']) : trim($HTTP_GET_VARS['recipe_name']);
     $item_desc = isset($HTTP_POST_VARS['item_desc']) ? trim($HTTP_POST_VARS['item_desc']) : trim($HTTP_GET_VARS['item_desc']);
     $recipe_desc = isset($HTTP_POST_VARS['recipe_desc']) ? trim($HTTP_POST_VARS['recipe_desc']) : trim($HTTP_GET_VARS['recipe_desc']);
     $item_icon = isset($HTTP_POST_VARS['item_img']) ? trim($HTTP_POST_VARS['item_img']) : trim($HTTP_GET_VARS['item_img']);
     $recipe_img = isset($HTTP_POST_VARS['recipe_img']) ? trim($HTTP_POST_VARS['recipe_img']) : trim($HTTP_GET_VARS['recipe_img']);
     $item_quality = intval($HTTP_POST_VARS['item_quality']);
     $recipe_quality = intval($HTTP_POST_VARS['recipe_quality']);
     $item_type = 19;
     $recipe_type = 20;
Ejemplo n.º 20
0
$level_list .= '<option value="">' . $lang['Adr_pvp_taunt_none'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_1'] . '">' . $lang['Adr_pvp_taunt_1'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_2'] . '">' . $lang['Adr_pvp_taunt_2'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_3'] . '">' . $lang['Adr_pvp_taunt_3'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_4'] . '">' . $lang['Adr_pvp_taunt_4'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_5'] . '">' . $lang['Adr_pvp_taunt_5'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_6'] . '">' . $lang['Adr_pvp_taunt_6'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_7'] . '">' . $lang['Adr_pvp_taunt_7'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_8'] . '">' . $lang['Adr_pvp_taunt_8'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_9'] . '">' . $lang['Adr_pvp_taunt_9'] . '</option>';
$level_list .= '<option value="' . $lang['Adr_pvp_taunt_10'] . '">' . $lang['Adr_pvp_taunt_10'] . '</option>';
$level_list .= '</select>';
##=== END: custom taunt list ===##
##=== START calculate HP/MP bar width ===##
list($challenger_hp_width, $challenger_hp_empty) = adr_make_bars($current_hp, $current_hp_max, '100');
list($challenger_mp_width, $challenger_mp_empty) = adr_make_bars($current_mp, $current_mp_max, '100');
list($opponent_hp_width, $opponent_hp_empty) = adr_make_bars($opponent_hp, $opponent_hp_max, '100');
list($opponent_mp_width, $opponent_mp_empty) = adr_make_bars($opponent_mp, $opponent_mp_max, '100');
##=== END calculate HP/MP bar width ===##
##=== START: grab challenger & opponent infos ===##
$current_element_infos = adr_get_element_infos($current_element);
$current_alignment_infos = adr_get_alignment_infos($current_alignment);
$current_class_infos = adr_get_class_infos($current_class);
$opponent_element_infos = adr_get_element_infos($opponent_element);
$opponent_alignment_infos = adr_get_alignment_infos($opponent_alignment);
$opponent_class_infos = adr_get_class_infos($opponent_class);
##=== END: grab challenger & opponent infos ===##
$template->assign_vars(array('L_ATTRIBUTES' => $lang['Adr_battle_attributes'], 'L_PHY_ATT' => $lang['Adr_battle_phy_att'], 'L_PHY_DEF' => $lang['Adr_battle_phy_def'], 'L_MAG_ATT' => $lang['Adr_battle_mag_att'], 'L_MAG_DEF' => $lang['Adr_battle_mag_def'], 'L_ALIGNMENT' => $lang['Adr_battle_alignment'], 'L_ELEMENT' => $lang['Adr_battle_element'], 'L_CLASS' => $lang['Adr_battle_class'], 'ALIGNMENT' => adr_get_lang($current_alignment_infos['alignment_name']), 'ELEMENT' => adr_get_lang($current_element_infos['element_name']), 'CHALLENGER_CLASS' => adr_get_lang($current_class_infos['class_name']), 'M_ATT' => $current_ma, 'M_DEF' => $current_md, 'OPPONENT_ALIGNMENT' => adr_get_lang($opponent_alignment_infos['alignment_name']), 'OPPONENT_ELEMENT' => adr_get_lang($opponent_element_infos['element_name']), 'OPPONENT_CLASS' => adr_get_lang($opponent_class_infos['class_name']), 'OPPONENT_M_ATT' => $opponent_ma, 'OPPONENT_M_DEF' => $opponent_md, 'ATTACK' => $weapon_list, 'SPELL' => $spell_list, 'POTION' => $potion_list, 'NAME' => $current_name, 'AVATAR_IMG' => $current_avatar_img, 'OPPONENT_NAME' => $opponent_name, 'OPPONENT_IMG' => $opponent_avatar_img, 'BATTLE_TEXT' => $battle_text, 'BATTLE_CHAT' => $battle_text_chat, 'HP' => $current_hp, 'MP' => $current_mp, 'HP_MAX' => $current_hp_max, 'MP_MAX' => $current_mp_max, 'HP_WIDTH' => $challenger_hp_width, 'MP_WIDTH' => $challenger_mp_width, 'ATT' => $current_att, 'DEF' => $current_def, 'OPPONENT_HP' => $opponent_hp, 'OPPONENT_MP' => $opponent_mp, 'OPPONENT_HP_MAX' => $opponent_hp_max, 'OPPONENT_MP_MAX' => $opponent_mp_max, 'OPPONENT_HP_WIDTH' => $opponent_hp_width, 'OPPONENT_MP_WIDTH' => $opponent_mp_width, 'OPPONENT_ATT' => $opponent_att, 'OPPONENT_DEF' => $opponent_def, 'HP_EMPTY' => $challenger_hp_empty, 'MP_EMPTY' => $challenger_mp_empty, 'OPPONENT_HP_EMPTY' => $opponent_hp_empty, 'OPPONENT_MP_EMPTY' => $opponent_mp_empty, 'TAUNT_LIST' => $level_list, 'L_COMMS' => $lang['Adr_pvp_comms'], 'L_TYPE_HERE' => $lang['Adr_pvp_custom_taunt'], 'L_CUSTOM_SENTANCE' => $lang['Adr_pvp_taunt'], 'S_CHATBOX' => append_sid("adr_battle_pvp_chatbox.{$phpEx}?battle_id=" . $battle_id), 'L_HP' => $lang['Adr_character_health'], 'L_MP' => $lang['Adr_character_magic'], 'L_ATT' => $lang['Adr_attack'], 'L_DEF' => $lang['Adr_defense'], 'L_ATTACK' => $lang['Adr_attack_opponent'], 'L_POTION' => $lang['Adr_potion_opponent'], 'L_DEFEND' => $lang['Adr_defend_opponent'], 'L_FLEE' => $lang['Adr_flee_opponent'], 'L_SPELL' => $lang['Adr_spell_opponent'], 'L_ACTIONS' => $lang['Adr_actions_opponent'], 'L_BATTLE_CHAT' => $lang['Adr_pvp_battle_chat'], 'L_BATTLE_REFRESH' => $lang['Adr_pvp_refresh_page'], 'S_PVP_ACTION' => append_sid("adr_battle_pvp.{$phpEx}?battle_id=" . $battle_id)));
include $phpbb_root_path . 'adr/includes/adr_header.' . $phpEx;
$template->pparse('body');
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
Ejemplo n.º 21
0
 }
 $itemlist = $db->sql_fetchrowset($result);
 if ($library['book_crafting']) {
     $sql = "SELECT item_name FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n       \t\t\t\t\tWHERE item_owner_id = '1'\r\n\t\t\t\t\tAND item_id = " . $library['book_crafting'];
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, 'Could not obtain inventory information', "", __LINE__, __FILE__, $sql);
     }
     $crafting = $db->sql_fetchrow($result);
     $crafting_name = adr_get_lang($crafting['item_name']);
 } else {
     $crafting_name = $lang['Adr_zone_acp_item_nothing'];
 }
 $item_list = '<select name="book_crafting">';
 $item_list .= '<option selected value="0" class="post">' . $lang['Adr_zone_acp_item_nothing'] . '</option><option selected value="' . $library['book_crafting'] . '" class="post">' . $crafting_name . '</option>';
 for ($i = 0; $i < count($itemlist); $i++) {
     $item_list .= '<option value = "' . $itemlist[$i]['item_id'] . '" class="post">' . adr_get_lang($itemlist[$i]['item_name']) . '</option>';
 }
 $item_list .= '</select>';
 //difficulty lists
 $difficulty[0] = $lang['Adr_library_very_easy'];
 $difficulty[1] = $lang['Adr_library_easy'];
 $difficulty[2] = $lang['Adr_library_average'];
 $difficulty[3] = $lang['Adr_library_tough'];
 $difficulty[4] = $lang['Adr_library_challenging'];
 $difficulty[5] = $lang['Adr_library_formidable'];
 $difficulty[6] = $lang['Adr_library_heroic'];
 $difficulty[7] = $lang['Adr_library_impossible'];
 $difficulty_list = '<select name="book_difficulty">';
 for ($i = 0; $i < 8; $i++) {
     $selected = $i == $library['book_difficulty'] ? ' selected="selected"' : '';
     $difficulty_list .= '<option value = "' . $i . '" ' . $selected . ' >' . $difficulty[$i] . '</option>';
Ejemplo n.º 22
0
function adr_get_item_type($type, $mode)
{
    global $db, $lang, $phpEx, $userdata, $phpbb_root_path, $board_config;
    $type = intval($type);
    define('IN_ADR_SHOPS', 1);
    include_once $phpbb_root_path . 'adr/includes/adr_constants.' . $phpEx;
    $cache_config = explode('-', $board_config['Adr_use_cache_system']);
    if ($cache_config[5]) {
        // All the following code has been made by Ptirhiik
        @(include $phpbb_root_path . './adr/cache/cache_item_type.' . $phpEx);
        if (!empty($adr_item_type)) {
            while (list($item_type_id, $item_type_data) = @each($adr_item_type)) {
                $items_type[$item_type_id] = $item_type_data;
            }
        } else {
            $sql = "SELECT * FROM  " . ADR_SHOPS_ITEMS_TYPE_TABLE;
            if (!($result = $db->sql_query($sql))) {
                message_die(GENERAL_ERROR, 'Unable to query item type infos (cache)', '', __LINE__, __FILE__, $sql);
            }
            @(include $phpbb_root_path . './adr/cache/cache_item_type.' . $phpEx);
            if (empty($adr_item_type)) {
                adr_update_item_type();
                include $phpbb_root_path . './adr/cache/cache_item_type.' . $phpEx;
                while (list($item_type_id, $item_type_data) = @each($adr_item_type)) {
                    $items_type[$item_type_id] = $item_type_data;
                }
            }
        }
    } else {
        $sql = "SELECT * FROM  " . ADR_SHOPS_ITEMS_TYPE_TABLE;
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Unable to query item type infos (non-cache)', '', __LINE__, __FILE__, $sql);
        }
        $items_type = $db->sql_fetchrowset($result);
    }
    switch ($mode) {
        case 'list':
            $item_type = '<select name="item_type_use">';
            for ($l = 1; $l < count($items_type); $l++) {
                $selected = $items_type[$l]['item_type_id'] == $type ? 'selected="selected"' : '';
                $item_type .= '<option value = "' . $items_type[$l]['item_type_id'] . '" ' . $selected . '>' . adr_get_lang($items_type[$l]['item_type_lang']) . '</option>';
            }
            $item_type .= '</select>';
            return $item_type;
            break;
        case 'search':
            $item_type = '<select name="item_type_use">';
            for ($l = 0; $l < count($items_type); $l++) {
                $item_type .= '<option value = "' . $items_type[$l]['item_type_id'] . '" >' . adr_get_lang($items_type[$l]['item_type_lang']) . '</option>';
            }
            $item_type .= '</select>';
            return $item_type;
            break;
        case 'simple':
            $item_type = adr_get_lang($items_type[$type]['item_type_lang']);
            return $item_type;
            break;
        case 'price':
            $item_type = $items_type[$type]['item_type_base_price'];
            return $item_type;
            break;
    }
}
Ejemplo n.º 23
0
     $item = $db->sql_fetchrow($result);
     $def = $def + $item['item_power'] + $item['item_add_power'];
     $greave_name = adr_get_lang($item['item_name']);
 }
 if ($boot) {
     $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\t\t\t\t\tWHERE item_in_shop = 0 \r\t\t\t\t\tAND item_owner_id = {$user_id} \r\t\t\t\t\t{$item_sql}\r\t\t\t\t\tAND item_id = {$boot} ";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
     }
     $item = $db->sql_fetchrow($result);
     $def = $def + $item['item_power'] + $item['item_add_power'];
     $boot_name = adr_get_lang($item['item_name']);
 }
 // Now we modify mp and hp regeneration with amulets and rings
 if ($amulet) {
     $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\t\t\t\t\tWHERE item_in_shop = 0 \r\t\t\t\t\tAND item_owner_id = {$user_id} \r\t\t\t\t\t{$item_sql}\r\t\t\t\t\tAND item_id = {$amulet} ";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
     }
     $item = $db->sql_fetchrow($result);
     $hp_regen = $hp_regen + $item['item_power'];
     $amulet_name = adr_get_lang($item['item_name']);
 }
 if ($ring) {
     $sql = " SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\t\t\t\t\tWHERE item_in_shop = 0 \r\t\t\t\t\tAND item_owner_id = {$user_id} \r\t\t\t\t\t{$item_sql}\r\t\t\t\t\tAND item_id = {$ring} ";
     if (!($result = $db->sql_query($sql))) {
         message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql);
     }
     $item = $db->sql_fetchrow($result);
     $mp_regen = $mp_regen + $item['item_power'];
     $ring_name = adr_get_lang($item['item_name']);
Ejemplo n.º 24
0
        message_die(GENERAL_ERROR, 'Could not obtain loottable information', "", __LINE__, __FILE__, $sql);
    }
    $loottables = $db->sql_fetchrowset($result);
    $s_hidden_fields = '<input type="hidden" name="mode" value="add_loottable" /><input type="hidden" name="loottable_type" value="' . $category_id . '" />';
    for ($k = 0; $k < count($loottables); $k++) {
        $row_class = !($k % 2) ? $theme['td_class1'] : $theme['td_class2'];
        if ($loottables[$k]['loottable_status'] == 0) {
            $loottable_status = $lang['Adr_loottable_status_deactivated'];
        }
        if ($loottables[$k]['loottable_status'] == 1) {
            $loottable_status = $lang['Adr_loottable_status_activated'];
        }
        $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TABLE . "\r\n\t\t\tWHERE (item_loottables like '" . $loottables[$k]['loottable_id'] . ":" . "%'\r\n\t\t\t\tOR item_loottables = '" . $loottables[$k]['loottable_id'] . "'\r\n\t\t\t\tOR item_loottables like '%" . ":" . $loottables[$k]['loottable_id'] . ":" . "%'\r\n\t\t\t\tOR item_loottables like '%" . ":" . $loottables[$k]['loottable_id'] . "')\r\n\t\t\t";
        if (!($result = $db->sql_query($sql))) {
            message_die(GENERAL_ERROR, 'Could not query items', '', __LINE__, __FILE__, $sql);
        }
        $total_items = $db->sql_fetchrowset($result);
        $template->assign_block_vars("loottables", array("ROW_CLASS" => $row_class, "LOOTTABLE_NAME" => adr_get_lang($loottables[$k]['loottable_name']), "LOOTTABLE_DESC" => adr_get_lang($loottables[$k]['loottable_desc']), "LOOTTABLE_ITEMS" => count($total_items), "LOOTTABLE_STATUS" => $loottable_status, "LOOTTABLE_DROPCHANCE" => $loottables[$k]['loottable_dropchance'], "U_LOOTTABLE_VIEW" => append_sid("admin_adr_loottables_cats.{$phpEx}?mode=view_loottable&amp;loottable_id=" . $loottables[$k]['loottable_id']), "U_LOOTTABLE_EDIT" => append_sid("admin_adr_loottables_cats.{$phpEx}?mode=edit_loottable&amp;loottable_id=" . $loottables[$k]['loottable_id']), "U_LOOTTABLE_DELETE" => append_sid("admin_adr_loottables_cats.{$phpEx}?mode=delete_loottable&amp;loottable_id=" . $loottables[$k]['loottable_id'])));
    }
    $sql = "SELECT count(*) AS total FROM " . ADR_LOOTTABLES_TABLE . " \r\n\t\t";
    if (!($result = $db->sql_query($sql))) {
        message_die(GENERAL_ERROR, 'Error getting total loottables', '', __LINE__, __FILE__, $sql);
    }
    if ($total = $db->sql_fetchrow($result)) {
        $total_loottables = $total['total'];
        $pagination = generate_pagination("admin_adr_loottables_cats.{$phpEx}?mode2={$mode2}&amp;order={$sort_order}", $total_loottables, $board_config['topics_per_page'], $start) . '&nbsp;';
    }
    $template->assign_vars(array("L_LOOTTABLE_TITLE" => $lang['Adr_loottable_title'], "L_LOOTTABLE_EXPLAIN" => $lang['Adr_loottable_title_explain'], "L_LOOTTABLE_NAME" => $lang['Adr_loottable_name'], "L_LOOTTABLE_DESC" => $lang['Adr_loottable_desc'], "L_LOOTTABLE_ITEMS" => $lang['Adr_loottable_items'], "L_LOOTTABLE_DROPCHANCE" => $lang['Adr_loottable_dropchance_title'], "L_LOOTTABLE_STATUS" => $lang['Adr_loottable_status'], "L_LOOTTABLE_ADD" => $lang['Adr_loottable_cat_add'], "L_LOOTTABLE_ACTION" => $lang['Action'], "L_LOOTTABLE_VIEW" => $lang['View'], "L_LOOTTABLE_EDIT" => $lang['Edit'], "L_LOOTTABLE_DELETE" => $lang['Delete'], 'L_LOOTTABLE_ORDER' => $lang['Order'], 'L_LOOTTABLE_SORT' => $lang['Sort'], 'L_LOOTTABLE_SELECT_SORT_METHOD' => $lang['Select_sort_method'], 'S_LOOTTABLE_MODE_SELECT' => $select_sort_mode, 'S_LOOTTABLE_ORDER_SELECT' => $select_sort_order, 'LOOTTABLE_PAGINATION' => $pagination, 'LOOTTABLE_PAGE_NUMBER' => sprintf($lang['Page_of'], floor($start / $board_config['topics_per_page']) + 1, ceil($total_loottables / $board_config['topics_per_page'])), "S_LOOTTABLE_ACTION" => append_sid("admin_adr_loottables_cats.{$phpEx}?mode2={$mode2}&amp;order={$sort_order}"), "S_HIDDEN_FIELDS" => $s_hidden_fields));
    $template->pparse("body");
}
include './page_footer_admin.' . $phpEx;
Ejemplo n.º 25
0
if (!($result = $db->sql_query($sql))) {
    message_die(GENERAL_ERROR, 'Could not obtain required quest information', "", __LINE__, __FILE__, $sql);
}
while ($quest_log = $db->sql_fetchrow($result)) {
    $quest_status = "";
    //Get all the information about the NPC
    $sql2 = " SELECT * FROM  " . ADR_NPC_TABLE . "\r\n    \tWHERE npc_id = '" . $quest_log['npc_id'] . "' \r\n\t\t";
    if (!($result2 = $db->sql_query($sql2))) {
        message_die(GENERAL_ERROR, 'No items found', "", __LINE__, __FILE__, $sql2);
    }
    if ($npc_info = $db->sql_fetchrow($result2)) {
        if ($quest_log['quest_killed_monster'] != "" && $quest_log['quest_killed_monster'] != '0') {
            $quest_status .= sprintf($lang['Adr_questbook_quest_typ_killed'], $quest_log['quest_killed_monsters_amount'], $quest_log['quest_killed_monster']);
        }
        if ($quest_log['quest_item_gave'] != "" && $quest_log['quest_item_gave'] != '0') {
            $npc_item_need_array = explode(',', $quest_log['quest_item_gave']);
            for ($i = 0; $i < count($npc_item_need_array); $i++) {
                $sql4 = "SELECT * FROM " . ADR_QUEST_LOG_HISTORY_TABLE . "\r\n\t\t\t\tWHERE quest_item_gave like '" . $npc_item_need_array[$i] . "," . "%' \r\n\t\t\t\tOR quest_item_gave like '" . $npc_item_need_array[$i] . "'\r\n\t\t\t\tOR quest_item_gave like '" . $npc_item_need_array[$i] . "," . "'\r\n\t\t\t\tOR quest_item_gave like '%" . "," . $npc_item_need_array[$i] . "," . "%'\r\n\t\t\t\tOR quest_item_gave like '%" . "," . $npc_item_need_array[$i] . "'\r\n\t\t\t\tAND user_id = '{$user_id}'\r\n\t\t\t\t";
                $result4 = $db->sql_query($sql4);
                if ($got_item_log = $db->sql_fetchrow($result4)) {
                    $quest_status .= sprintf($lang['Adr_questbook_quest_typ_item_gave'], adr_get_lang($npc_item_need_array[$i]));
                }
            }
        }
        $template->assign_block_vars('quest', array("QUEST_KILLED_MONSTER" => $quest_log['quest_killed_monster'], "QUEST_KILLED_MONSTERS_AMOUNT" => $quest_log['quest_killed_monsters_amount'], "QUEST_ITEM_GAVE" => $quest_log['quest_item_gave'], "QUEST_STATUS" => $quest_status, "NPC_ZONE" => $npc_info['npc_zone'], "NPC_NAME" => $npc_info['npc_name'] . "<br>", "NPC_IMG" => $npc_info['npc_img'], "NPC_ENABLE" => $npc_info['npc_enable'], "NPC_PRICE" => $npc_info['npc_price'], "NPC_MESSAGE" => $npc_info['npc_message'], "NPC_ITEM" => $npc_info['npc_item'], "NPC_MESSAGE2" => $npc_info['npc_message2'], "NPC_POINTS" => $npc_info['npc_points'], "NPC_EXP" => $npc_info['npc_exp'], "NPC_SP" => $npc_info['npc_sp'], "NPC_ITEM2" => $npc_info['npc_item2'], "NPC_TIMES" => $npc_info['npc_times']));
    }
}
$template->assign_vars(array('LANG' => $board_config['default_lang'], "QUEST_BOOK_TITLE" => $lang['Adr_questbook_history_title'], "QUEST_BOOK_LINK" => $lang['Adr_questbook_link'], "QUEST_BOOK_HISTORY_LINK" => $lang['Adr_questbook_history_link'], "NPC_NAME_HEADER" => $lang['Adr_questbook_npc_name'], "NPC_ZONE_HEADER" => $lang['Adr_questbook_npc_zone'], "NPC_MESSAGE_HEADER" => $lang['Adr_questbook_npc_message']));
include $phpbb_root_path . 'adr/includes/adr_header.' . $phpEx;
$template->pparse('body');
include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
Ejemplo n.º 26
0
                $result = $db->sql_query($sql);
                if (!$result) {
                    message_die(GENERAL_ERROR, "Couldn't insert new element", "", __LINE__, __FILE__, $sql);
                }
                // Update cache
                adr_update_element_infos();
                adr_previous(Adr_element_successful_added, admin_adr_elements, '');
                break;
        }
    } else {
        adr_template_file('admin/config_adr_elements_list_body.tpl');
        $sql = "SELECT *\n\t\tFROM " . ADR_ELEMENTS_TABLE;
        $result = $db->sql_query($sql);
        if (!$result) {
            message_die(GENERAL_ERROR, 'Could not obtain elements information', "", __LINE__, __FILE__, $sql);
        }
        $elements = $db->sql_fetchrowset($result);
        for ($i = 0; $i < count($elements); $i++) {
            $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
            $level[0] = $lang['Adr_races_level_all'];
            $level[1] = $lang['Adr_races_level_admin'];
            $level[2] = $lang['Adr_races_level_mod'];
            $element_level = $level[$elements[$i]['element_level']];
            $pic = $elements[$i]['element_img'];
            $template->assign_block_vars("elements", array("ROW_CLASS" => $row_class, "NAME" => adr_get_lang($elements[$i]['element_name']), "DESC" => adr_get_lang($elements[$i]['element_desc']), "IMG" => $pic, "LEVEL" => $element_level, "U_ELEMENTS_EDIT" => append_sid("admin_adr_elements.{$phpEx}?mode=edit&amp;id=" . $elements[$i]['element_id']), "U_ELEMENTS_DELETE" => append_sid("admin_adr_elements.{$phpEx}?mode=delete&amp;id=" . $elements[$i]['element_id'])));
        }
        $template->assign_vars(array("L_ELEMENTS_TITLE" => $lang['Adr_elements'], "L_ELEMENTS_TEXT" => $lang['Adr_elements_explain'], "L_NAME" => $lang['Adr_races_name'], "L_IMG" => $lang['Adr_races_image'], "L_DESC" => $lang['Adr_races_desc'], "L_LEVEL" => $lang['Adr_races_level'], "L_ELEMENTS_ADD" => $lang['Adr_elements_add'], "L_ACTION" => $lang['Action'], "L_DELETE" => $lang['Delete'], "L_EDIT" => $lang['Edit'], "L_SUBMIT" => $lang['Submit'], "S_ELEMENTS_ACTION" => append_sid("admin_adr_elements.{$phpEx}")));
        $template->pparse("body");
        include './page_footer_admin.' . $phpEx;
    }
}
Ejemplo n.º 27
0
        }
        $sell_item[$a] .= '</select>';
        $row_color = !($i % 2) ? $theme['td_color1'] : $theme['td_color2'];
        $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
        $sql = "SELECT * FROM " . ADR_VAULT_EXCHANGE_USERS_TABLE . "\n\t\t\tWHERE stock_id = " . $exchange[$i]['stock_id'] . "\n\t\t\tAND user_id = " . $user_id;
        $result = $db->sql_query($sql);
        if (!$result) {
            message_die(GENERAL_ERROR, "Couldn't obtain stock exchange from database", "", __LINE__, __FILE__, $sql);
        }
        $owned = $db->sql_fetchrow($result);
        $actions_owned = $owned['stock_amount'];
        if (!$actions_owned) {
            $actions_owned = $lang['Adr_vault_exchange_none'];
        }
        $stock_name = adr_get_lang($exchange[$i]['stock_name']);
        $stock_desc = adr_get_lang($exchange[$i]['stock_desc']);
        $template->assign_block_vars("exchange", array("ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "STOCK_NAME" => $stock_name, "STOCK_DESC" => $stock_desc, "STOCK_AMOUNT" => number_format($exchange[$i]['stock_price']), "STOCK_PREVIOUS" => number_format($exchange[$i]['stock_previous_price']), "STOCK_WORST" => number_format($exchange[$i]['stock_worst_price']), "STOCK_BEST" => number_format($exchange[$i]['stock_best_price']), "STOCK_BUY" => $buy_item[$a], "STOCK_SELL" => $sell_item[$a], "STOCK_OWNED" => $actions_owned));
    }
    $template->assign_vars(array('L_STOCK_EXCHANGE_ACTIONS' => $lang['Adr_vault_exchange_actions'], 'L_STOCK_NAME' => $lang['Adr_vault_exchange_actions_name'], 'L_STOCK_DESC' => $lang['Adr_vault_exchange_actions_desc'], 'L_STOCK_AMOUNT' => $lang['Adr_vault_exchange_actions_amount'], 'L_STOCK_PREVIOUS' => $lang['Adr_vault_exchange_previous_price'], 'L_STOCK_WORST' => $lang['Adr_vault_exchange_worst_price'], 'L_STOCK_BEST' => $lang['Adr_vault_exchange_best_price'], 'L_STOCK_OWNED' => $lang['Adr_vault_exchange_owned'], 'L_STOCK_BUY' => $lang['Adr_vault_exchange_buy'], 'L_STOCK_SELL' => $lang['Adr_vault_exchange_sell'], 'L_USERNAME' => $lang['Username'], 'L_PROFILE' => $lang['Profile'], 'L_SUBMIT' => $lang['Submit']));
}
if ($list) {
    adr_template_file('adr_vault_list_body.tpl');
    if ($board_config['stock_use']) {
        $template->assign_block_vars('stock', array());
    }
    $start = isset($_GET['start']) ? intval($_GET['start']) : 0;
    if (isset($_GET['mode']) || isset($_POST['mode'])) {
        $mode = isset($_POST['mode']) ? htmlspecialchars($_POST['mode']) : htmlspecialchars($_GET['mode']);
    } else {
        $mode = 'username';
    }
Ejemplo n.º 28
0
     }
     if ($monsters[$i]['monster_weather'] == '3') {
         $show_weather = $lang['Adr_Weather_3'];
     }
     if ($monsters[$i]['monster_weather'] == '4') {
         $show_weather = $lang['Adr_Weather_4'];
     }
     if ($monsters[$i]['monster_weather'] == '5') {
         $show_weather = $lang['Adr_Weather_5'];
     }
     if ($monsters[$i]['monster_weather'] == '6') {
         $show_weather = $lang['Adr_Weather_6'];
     }
     if ($monsters[$i]['monster_time'] == '0') {
         $show_time = $lang['Adr_Time_all'];
     }
     if ($monsters[$i]['monster_time'] == '1') {
         $show_time = $lang['Adr_Time_1'];
     }
     if ($monsters[$i]['monster_time'] == '2') {
         $show_time = $lang['Adr_Time_2'];
     }
     if ($monsters[$i]['monster_time'] == '3') {
         $show_time = $lang['Adr_Time_3'];
     }
     if ($monsters[$i]['monster_time'] == '4') {
         $show_time = $lang['Adr_Time_4'];
     }
     $monsters[$i]['monster_message_enable'] == '1' ? $show_message = $lang['Adr_monster_message_yes'] : ($show_message = $lang['Adr_monster_message_no']);
     $template->assign_block_vars("monsters", array("ROW_CLASS" => $row_class, "NAME" => adr_get_lang($monsters[$i]['monster_name']), "IMG" => $monsters[$i]['monster_img'], "LEVEL" => $monsters[$i]['monster_level'], "BASE_HP" => $monsters[$i]['monster_base_hp'], "BASE_DEF" => $monsters[$i]['monster_base_def'], "BASE_ATT" => $monsters[$i]['monster_base_att'], "BASE_MA" => $monsters[$i]['monster_base_magic_attack'], "TIME" => $show_time, "BASE_MD" => $monsters[$i]['monster_base_magic_resistance'], "BASE_MP" => $monsters[$i]['monster_base_mp'], "BASE_MP_POWER" => $monsters[$i]['monster_base_mp_power'], "BASE_SP" => $monsters[$i]['monster_base_sp'], "BASE_SPELL" => $monsters[$i]['monster_base_custom_spell'], "THIEF_SKILL" => $monsters[$i]['monster_thief_skill'], "BASE_ELEMENT" => adr_get_lang($monsters[$i]['element_name']), "SEASON" => $show_season, "WEATHER" => $show_weather, "MESSAGE" => $show_message, "U_MONSTERS_EDIT" => append_sid("admin_adr_monsters.{$phpEx}?mode=edit&amp;id=" . $monsters[$i]['monster_id']), "U_MONSTERS_DELETE" => append_sid("admin_adr_monsters.{$phpEx}?mode=delete&amp;id=" . $monsters[$i]['monster_id'])));
 }
Ejemplo n.º 29
0
 /**
  * @method POST
  * @api opponent_turn
  */
 public function opponent_turn()
 {
     $bat = $this->getBattleList();
     if ($bat == false) {
         return $this->response(array('status' => 0, 'message' => 'There is no active battle!'));
     }
     $adr_general = ADR::getGeneralConfig();
     $characters = new Character();
     $challenger = $characters->getCharacterByID($_POST['character_id']);
     $monsters = new Monsters();
     $monster = $monsters->getMonsterByID($bat['battle_opponent_id']);
     $monster_name = adr_get_lang($monster['monster_name']);
     $character_name = $challenger['character_name'];
     $monster['monster_crit_hit_mod'] = 2;
     $monster['monster_crit_hit'] = 20;
     $monster['monster_int'] = 10 + rand(1, $monster['monster_level']) * 2;
     //temp calc
     $monster['monster_str'] = 10 + rand(1, $monster['monster_level']) * 2;
     //temp calc
     $user_ma = $bat['battle_challenger_magic_attack'];
     $user_md = $bat['battle_challenger_magic_resistance'];
     $monster_ma = $bat['battle_opponent_magic_attack'];
     $monster_md = $bat['battle_opponent_magic_resistance'];
     $challenger_element = $challenger['character_element'];
     $opponent_element = $monster['monster_base_element'];
     $battle_round = $bat['battle_round'];
     $battle_message = array();
     $def = false;
     if ($def != TRUE) {
         $power = ceil($monster['monster_level'] * rand(1, 3));
     } else {
         $power = floor($monster['monster_level'] * rand(1, 3) / 2);
     }
     // Has the monster the ability to steal from user?
     $thief_chance = 0;
     //NEED ITEMS $thief_chance = rand(1,20);
     if ($adr_general['thief_enable'] == '1' && $thief_chance == '20') {
         /*$sql = "SELECT item_id, item_name FROM  " . ADR_SHOPS_ITEMS_TABLE . "
                         WHERE item_monster_thief = '0'
                         AND item_in_warehouse = '0'
                         AND item_in_shop = '0'
                         AND item_duration > '0'
                         AND item_owner_id = '$user_id'
                         AND item_id NOT IN ($helm_equip, $armour_equip, $gloves_equip, $buckler_equip, $amulet_equip, $ring_equip)
                         ORDER BY rand() LIMIT 1";
                     if(!($result = $db->sql_query($sql))){
                         message_die(GENERAL_ERROR, 'Could not query items for monster item steal', '', __LINE__, __FILE__, $sql);}
                     $item_to_steal = $db->sql_fetchrow($result);
         
                     // Rand to check type of thief attack
                     $success_chance = rand(1,20);
                     $rand = rand(1,20);
         
                     ##=== START: steal item checks
                     $challenger_item_spot_check = (20 + adr_modifier_calc($challenger['character_skill_thief']));
                     $monster_item_attempt = (((($rand + adr_modifier_calc($monster['monster_thief_skill'])) > $challenger_item_spot_check) && ($rand != '1')) || ($rand == '20')) ? TRUE : FALSE;
                     ##=== END: steal item checks
         
                     ##=== START: steal points checks
                     $challenger_points_spot_check = (10 + adr_modifier_calc($challenger['character_skill_thief']));
                     $monster_points_attempt = (((($rand + $monster['monster_thief_skill']) > $challenger_points_spot_check) && ($rand != '1')) || ($rand == '20')) ? TRUE : FALSE;
                     ##=== END: steal points checks
         
                     if(($success_chance == '20') && ($monster_item_attempt == TRUE) && ($item_to_steal['item_name'] != '')){
                         $damage = 0;
         
                         // Mark the item as stolen
                         $sql = "UPDATE " . ADR_SHOPS_ITEMS_TABLE . "
                             SET item_monster_thief = 1
                             WHERE item_owner_id = '$user_id'
                             AND item_id = '" . $item_to_steal['item_id'] . "'";
                         if(!($result = $db->sql_query($sql))){
                             message_die(GENERAL_ERROR, 'Could not update stolen item by monster', '', __LINE__, __FILE__, $sql);}
         
                             array_push($battle_message, sprintf(ADR::Lang('Adr_battle_opponent_thief_success'), $monster_name, adr_get_lang($item_to_steal['item_name']), $character_name));
                     }
                     elseif(($success_chance >= '15') && ($success_chance != '20') && ($user_points > '0') && ($monster_points_attempt == TRUE)){
                         $damage = 0;
                         $points_stolen = floor(($user_points / 100) *$adr_general['thief_points']);
                         subtract_reward($user_id, $points_stolen);
                         array_push($battle_message, sprintf(ADR::Lang('Adr_battle_opponent_thief_points'), $monster_name, $points_stolen, get_reward_name(), $character_name));
                     }
                     else{
                         $damage = 0;
                         array_push($battle_message, sprintf(ADR::Lang('Adr_battle_opponent_thief_failure'), $monster_name, adr_get_lang($item_to_steal['item_name']), $character_name));
                     }*/
     } else {
         $attack_type = rand(1, 20);
         ##=== START: Critical hit code
         $threat_range = $monster['monster_crit_hit'];
         //          list($crit_result, $power) = explode('-', adr_battle_make_crit_roll($bat['battle_opponent_att'], $monster['monster_level'], $bat['battle_challenger_def'], 0, $power, 0, $threat_range, 0));
         ##=== END: Critical hit code
         if ($bat['battle_opponent_mp'] > '0' && $bat['battle_opponent_mp'] >= $bat['battle_opponent_mp_power'] && $attack_type > '16') {
             $damage = 1;
             $power = ceil($power + adr_modifier_calc($bat['battle_opponent_mp_power']));
             $elements = new Elements();
             $monster_elemental = $elements->getElementByID($opponent_element);
             // Sort out magic check & opponents saving throw
             $dice = rand(1, 20);
             $magic_check = ceil($dice + $bat['battle_opponent_mp_power'] + adr_modifier_calc($monster['monster_int']));
             $fort_save = 11 + adr_modifier_calc($challenger['character_wisdom']);
             $success = $magic_check >= $fort_save && $dice != '1' || $dice >= $threat_range ? TRUE : FALSE;
             if ($success === TRUE) {
                 // Prefix msg if crit hit
                 if ($dice >= $threat_range) {
                     array_push($battle_message, ADR::Lang('Adr_battle_critical_hit'));
                 }
                 // Work out attack type
                 if ($challenger_element === $monster_elemental['element_oppose_weak']) {
                     $damage = ceil($power * ($monster_elemental['element_oppose_strong_dmg'] / 100));
                 } elseif ($challenger_element === $opponent_element) {
                     $damage = ceil($power * ($monster_elemental['element_oppose_same_dmg'] / 100));
                 } elseif ($challenger_element === $monster_elemental['element_oppose_strong']) {
                     $damage = ceil($power * ($monster_elemental['element_oppose_weak_dmg'] / 100));
                 } else {
                     $damage = ceil($power);
                 }
                 // Fix dmg value
                 $damage = $damage < '1' ? rand(1, 3) : $damage;
                 $damage = $dice >= $threat_range ? $damage * $monster['monster_crit_hit_mod'] : $damage;
                 $damage = $damage > $challenger['character_hp'] ? $challenger['character_hp'] : $damage;
                 // Fix attack msg type
                 if ($monster['monster_base_custom_spell'] != '') {
                     array_push($battle_message, sprintf(ADR::Lang('Adr_battle_opponent_spell_success'), $monster_name, $monster['monster_base_custom_spell'], $character_name, $damage));
                 } else {
                     array_push($battle_message, sprintf(ADR::Lang('Adr_battle_opponent_spell_success2'), $monster_name, $character_name, $damage));
                 }
             } else {
                 $damage = 0;
                 array_push($battle_message, sprintf(ADR::Lang('Adr_battle_opponent_spell_failure'), $monster_name, $character_name));
             }
             // Remove monster MP
             $opponent_mp_remaining = $bat['battle_opponent_mp'] - $bat['battle_opponent_mp_power'];
             $this->updateBattleList(array('battle_opponent_mp' => $opponent_mp_remaining));
         } else {
             // Let's check if the attack succeeds
             $dice = rand(1, 20);
             $success = $bat['battle_opponent_att'] + $dice >= $bat['battle_challenger_def'] + adr_modifier_calc($challenger['character_dexterity']) && $dice != '1' || $dice >= $threat_range ? TRUE : FALSE;
             $power = ceil($power / 2 + adr_modifier_calc($monster['monster_str']));
             $damage = 1;
             if ($success == TRUE) {
                 // Attack success , calculate the damage . Critical dice roll is still success
                 $damage = $power < '1' ? rand(1, 3) : $power;
                 $damage = $dice >= $threat_range ? ceil($damage * $monster['monster_crit_hit_mod']) : ceil($damage);
                 $damage = $damage > $challenger['character_hp'] ? $challenger['character_hp'] : $damage;
                 if ($dice >= $threat_range) {
                     array_push($battle_message, ADR::Lang('Adr_battle_critical_hit'));
                 }
                 array_push($battle_message, sprintf(ADR::Lang('Adr_battle_opponent_attack_success'), $monster_name, $character_name, $damage));
             } else {
                 $damage = 0;
                 array_push($battle_message, sprintf(ADR::Lang('Adr_battle_opponent_attack_failure'), $monster_name, $character_name));
             }
         }
         $bat['battle_opponent_dmg'] = $damage;
         // Prevent instant kills at start of battle
         $challenger_hp = $challenger['character_hp'] - $damage;
         if ($bat['battle_round'] == 0 && $challenger_hp < 1) {
             $challenger_hp = 1;
         }
         $db = DB::instance();
         $db->update('adr_characters', array('character_hp' => $challenger_hp), array('character_id' => $bat['battle_challenger_id']));
         if ($challenger_hp <= 0) {
             $return = $this->lose($bat, $monster, $challenger);
             $return['message'] = array_merge($battle_message, $return['message']);
             return $this->response($return);
         } else {
             return $this->response(array('status' => 1, 'message' => $battle_message, 'damage' => $damage, 'challenger_hp' => $challenger_hp));
         }
     }
 }
Ejemplo n.º 30
0
                adr_renumber_order();
                adr_update_item_type();
                adr_previous(Adr_item_type_successful_edited, admin_adr_item_type, '');
                break;
        }
    } else {
        adr_template_file('admin/config_adr_item_type_list_body.tpl');
        $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TYPE_TABLE . " ORDER BY item_type_category, item_type_order ASC";
        $result = $db->sql_query($sql);
        if (!$result) {
            message_die(GENERAL_ERROR, 'Could not obtain minerals information', "", __LINE__, __FILE__, $sql);
        }
        $item_type = $db->sql_fetchrowset($result);
        for ($i = 0; $i < count($item_type); $i++) {
            $row_class = !($i % 2) ? $theme['td_class1'] : $theme['td_class2'];
            $template->assign_block_vars("items", array("ROW_CLASS" => $row_class, "NAME" => adr_get_lang($item_type[$i]['item_type_lang']), "ID" => $item_type[$i]['item_type_id'], "PRICE" => $item_type[$i]['item_type_base_price'], "U_ITEM_TYPE_UP" => append_sid("admin_adr_item_type.{$phpEx}?mode=order&amp;move=-15&amp;id=" . $item_type[$i]['item_type_id']), "U_ITEM_TYPE_DOWN" => append_sid("admin_adr_item_type.{$phpEx}?mode=order&amp;move=15&amp;id=" . $item_type[$i]['item_type_id']), "U_ITEM_TYPE_EDIT" => append_sid("admin_adr_item_type.{$phpEx}?mode=edit&amp;id=" . $item_type[$i]['item_type_id']), "U_ITEM_TYPE_DELETE" => append_sid("admin_adr_item_type.{$phpEx}?mode=delete&amp;id=" . $item_type[$i]['item_type_id'])));
            if ($item_type[$i]['item_type_category'] != $prev_cat) {
                $template->assign_block_vars("items.categories", array("CATEGORY" => $item_type[$i]['item_type_category']));
            }
            $prev_cat = $item_type[$i]['item_type_category'];
        }
        $template->assign_vars(array("L_ITEM_TYPE" => $lang['Adr_items_settings_advanced'], "L_ITEM_TYPE_TEXT" => $lang['Adr_item_type_explain'], "L_NAME" => $lang['Adr_item_type_name'], "L_ID" => $lang['Adr_item_type_id'], "L_PRICE" => $lang['Adr_item_type_price'], "L_ACTION" => $lang['Action'], "L_DELETE" => $lang['Delete'], "L_EDIT" => $lang['Edit'], 'L_MOVE_UP' => $lang['Move_up'], 'L_MOVE_DOWN' => $lang['Move_down'], "L_ITEMS_ADD" => $lang['Adr_item_type_add'], "S_ITEM_TYPE_ACTION" => append_sid("admin_adr_item_type.{$phpEx}")));
        $template->pparse("body");
        include './page_footer_admin.' . $phpEx;
    }
}
function adr_renumber_order()
{
    global $db;
    $sql = "SELECT * FROM " . ADR_SHOPS_ITEMS_TYPE_TABLE . "\n\t\tORDER BY item_type_category, item_type_order ASC";
    if (!($result = $db->sql_query($sql))) {