Equipment Manager and Legion legendaries
Legion legendaries are unique-equipped up to two at the same time, but the UseEquipmentSet API is stupid, it will fail should you try to swap to a different legendary without unequipping a previous one first (fails with the "Too many legendaries equipped" error).
Here is a dirty fix to the EquipmentManager_EquipSet function:
Lua Code:
function EquipmentManager_EquipSet(name) if(EquipmentSetContainsLockedItems(name) or UnitCastingInfo('player')) then UIErrorsFrame:AddMessage(ERR_CLIENT_LOCKED_OUT, 1, 0.1, 0.1, 1) return end -- BUG: legion legendaries will halt the set equipping if the user is swapping -- different slotted legendaries beyond the 1/2 equipped limit local locations = GetEquipmentSetLocations(name) for inventoryID = 1, 17 do local itemLink = GetInventoryItemLink('player', inventoryID) if(itemLink) then local rarity = GetInventoryItemQuality('player', inventoryID) if(rarity == 5) then -- legendary item found, manually replace it with the item from the new set local action = EquipmentManager_EquipItemByLocation(locations[inventoryID], inventoryID) if(action) then EquipmentManager_RunAction(action) end end end end UseEquipmentSet(name) end
Non-blocking version:
Lua Code:
function EquipmentManager_EquipSet(name) if(EquipmentSetContainsLockedItems(name) or UnitCastingInfo('player')) then UIErrorsFrame:AddMessage(ERR_CLIENT_LOCKED_OUT, 1, 0.1, 0.1, 1) return end -- BUG: legion legendaries will halt the set equipping if the user is swapping -- different slotted legendaries beyond the 1/2 equipped limit local locations = GetEquipmentSetLocations(name) for inventoryID = 1, 17 do local itemLink = GetInventoryItemLink('player', inventoryID) if(itemLink) then local rarity = GetInventoryItemQuality('player', inventoryID) if(rarity == 5) then -- legendary item found, manually replace it with the item from the new set local action = EquipmentManager_EquipItemByLocation(locations[inventoryID], inventoryID) if(action) then EquipmentManager_RunAction(action) locations[inventoryID] = nil end end end end -- Equip remaining items through _RunAction to avoid blocking from UseEquipmentSet for inventoryID, location in next, locations do local action = EquipmentManager_EquipItemByLocation(location, inventoryID) if(action) then EquipmentManager_RunAction(action) end end end
|