ok I readjusted it and and reaplced the 3 with INVENTORY_UPDATE_REASON_ITEM_CHARGE as well.. not gonna use the return true stuff yet as im trying to keep it basic untill i see recharge actually happening. heres the brint of it and if your correct then I just need to work on the "ChargeItemWithSoulGem(BAG_WORN, weapon, BAG_BACKPACK, gemSlot)" line again which is pretty much all ive been doing.
Code:
function RidinDirty.GetGems()
for slotId = 0, GetBagSize(BAG_BACKPACK) do
if IsItemSoulGem(SOUL_GEM_TYPE_FILLED, BAG_BACKPACK, slotId) then
local gemSlot = slotId
RidinDirty.Recharge(gemSlot)
end
end
end
function RidinDirty.Recharge(gemSlot)
local minimumWeaponCharge = 97
local weapons = {
EQUIP_SLOT_MAIN_HAND,
EQUIP_SLOT_OFF_HAND,
EQUIP_SLOT_BACKUP_MAIN,
EQUIP_SLOT_BACKUP_OFF
}
if gemSlot == nil then return false end
for _, weapon in ipairs(weapons) do
df("found weapon %s", weapon)
local charge, maxCharge = GetChargeInfoForItem(BAG_WORN, weapon)
if charge <= minimumWeaponCharge then --and IsItemChargeable(BAG_WORN, weapon) then --and not maxCharge == 0 then
--local gemSlot = RidinDirty.GetGems()
ChargeItemWithSoulGem(BAG_WORN, weapon, BAG_BACKPACK, gemSlot)
end
local charged, maxCharged = GetChargeInfoForItem(BAG_WORN, weapon)
if charged > charge then
df("should have been charged %s", weapon)
--return true
end
end
end