} // end if item use 12 } else { if ($spell2) { // Define the weapon quality and power $item_spell2 = intval($HTTP_POST_VARS['item_spell2']); $power = 0; $damage = 0; if ($item_spell2) { $sql = " SELECT spell_name , spell_power , item_type_use , spell_add_power , spell_mp_use , spell_element , spell_element_str_dmg, spell_element_weak_dmg , spell_element_same_dmg, spell_items_req, spell_xtreme_pvp FROM " . ADR_SHOPS_SPELLS_TABLE . "\r\n WHERE spell_owner_id = {$user_id} \r\n AND spell_id = {$item_spell2} \r\n ORDER BY spell_name ASC"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql); } $item = $db->sql_fetchrow($result); if ($item['spell_items_req'] != '' && $item['spell_items_req'] != '0') { adr_spell_check_components($item_spell2, $user_id, 'adr_battle_pvp'); } if ($current_mp < $item['spell_mp_use'] + $item['spell_power'] || $current_mp < 0) { adr_previous(Adr_battle_check_two, 'adr_battle', ''); } $power = $item['spell_power'] * 1.2 + $item['spell_add_power']; $mp_usage = $item['spell_mp_use'] + $item['spell_power']; if ($mp_usage == '') { adr_previous(Adr_battle_check, 'adr_battle', ''); } adr_use_item($item_spell2, $user_id); // Subtract the magic points if ($user_id == $battle_challenger_id) { $sql = "UPDATE " . ADR_BATTLE_PVP_TABLE . "\r\n SET battle_challenger_mp = battle_challenger_mp - (" . $item['spell_power'] . " + " . $item['spell_mp_use'] . ")\r\n WHERE battle_challenger_id = {$user_id}\r\n AND battle_id = {$battle_id} "; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not update battle', '', __LINE__, __FILE__, $sql);
} $chars_list .= '</select>'; if ($cast_spell) { // Get other char info $other_member = adr_get_user_infos($to_member_id); // Get spell info $sql = "SELECT * FROM " . ADR_SHOPS_SPELLS_TABLE . " \r\n\t\tWHERE spell_owner_id = {$user_id}\r\n\t\tAND spell_original_id = {$spell_id}\r\n\t\tLIMIT 1"; if (!($result = $db->sql_query($sql))) { adr_previous(Adr_shop_items_failure_deleted, adr_spellbook, ''); } $item = $db->sql_fetchrow($result); $spell_skill = $item['item_type_use']; $power = 0; // Spell components check if ($item['spell_items_req'] != '' && $item['spell_items_req'] != '0') { adr_spell_check_components($spell_id, $user_id, 'adr_spellbook'); } // MP check if ($adr_user['character_mp'] < $item['spell_mp_use'] + $item['spell_power'] || $adr_user['character_mp'] < 0) { adr_previous(Adr_battle_check_two, 'adr_spellbook', ''); } $power = $item['spell_power'] * 1.2 + $item['spell_add_power']; $mp_usage = $item['spell_mp_use'] + $item['spell_power']; if ($mp_usage == '') { adr_previous(Adr_battle_check, 'adr_spellbook', ''); } // Check if target is in combat $sql = " SELECT * FROM " . ADR_BATTLE_LIST_TABLE . " \r\n\t\tWHERE battle_challenger_id = {$to_member_id}\r\n\t\tAND battle_result = 0\r\n\t\tAND battle_type = 1 "; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not query battle list', '', __LINE__, __FILE__, $sql); }