Hi all
I need to check a newly equipped items quality, if it is grey save the current equipment set including the new item, if the item is not grey I want to unequip all and then use the current equipment set.
To do this I track the PLAYER_EQUIPMENT_CHANGED event.
Here is my chunk;
Lua Code:
elseif event == "PLAYER_EQUIPMENT_CHANGED" then
local equipmentSlot = ...
IronManSelectionFrame:UnregisterEvent("PLAYER_EQUIPMENT_CHANGED") -- unregister so we don't spam the test
local isItemGrey, itemQuality = true, 99
itemQuality = GetInventoryItemQuality("player", equipmentSlot)
if itemQuality ~= 0 then -- if item is not grey
isItemGrey = false
removeAllEquipedItems()
end
if isItemGrey then
for k, v in pairs(C_EquipmentSet.GetEquipmentSetIDs()) do
C_EquipmentSet.DeleteEquipmentSet(v) -- delete all equipment sets
end
C_EquipmentSet.CreateEquipmentSet("TESTING", 1035053) -- create new equipment set
end
C_EquipmentSet.UseEquipmentSet(0) -- use current equipment set
print("PLAYER_EQUIPMENT_CHANGED Event Fired", equipmentSlot, isItemGrey, itemQuality) -- debug --
IronManSelectionFrame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") -- re-register after test function
I unregister the PLAYER_EQUIPMENT_CHANGED at the start of the function so it doesn’t spam as the unequip re-equip will fire for each item.
He is my result:
Even though I unregister it still spams yet I cannot understand why, so I am looking for some help in understanding why it won't work, and why the equipment set doesn't update.