View Single Post
02/26/23, 04:42 AM   #2
ExoY
 
ExoY's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 88
Originally Posted by sinnereso View Post
Hey guys im adding my last feature to my addon auto weapon recharge but run into an issue and cant seem to get the "ChargeItemWithSoulGem" function to actually recharge the weaps but is executing past that line. Its likly a formatting issue as that my biggest headache otherwise everything else is working perfectly.

heres some of the code im working with atm and where i believe the problem lies:

Code:
function RidinDirty.Recharge()
    local weapons = {
        EQUIP_SLOT_MAIN_HAND,
        EQUIP_SLOT_OFF_HAND,
        EQUIP_SLOT_BACKUP_MAIN,
        EQUIP_SLOT_BACKUP_OFF
    }
    local minimumWeaponCharge = 95

	for index = 0, GetBagSize(BAG_BACKPACK) do
		local gemId = GetItemId(BAG_BACKPACK, index)
		if gemId == 33271 then
			gemIndex = index
		end
	end
	if gemIndex == nil then df("|c9900FF[RidinDirty]|r |ccc0000No Gems To Recharge Weapons|r") return end
	for _, weapon in ipairs(weapons) do
		local charge = GetChargeInfoForItem(BAG_WORN, weapon)
		if charge <= minimumWeaponCharge and IsItemChargeable then
			ChargeItemWithSoulGem(BAG_WORN, weapon, BAG_BACKPACK, gemIndex)--     <<<<< must be executing this line but doing nothing
			df("**** should be charging jus sayin but isnt =p")--     <<<<<< executing to here properly and as expected
		end
		local charged = GetChargeInfoForItem(BAG_WORN, weapon)
		if charged > charge then
			df("**** should have been charged jus sayin but isnt =p")
		end
	end
end
Where is "IsItemChargeable" coming from?
Based on the Code snipped you provided this will always be nil, wouldnt it?
  Reply With Quote