Thread Tools Display Modes
12-04-16, 01:26 AM   #1
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
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:
  1. function EquipmentManager_EquipSet(name)
  2.     if(EquipmentSetContainsLockedItems(name) or UnitCastingInfo('player')) then
  3.         UIErrorsFrame:AddMessage(ERR_CLIENT_LOCKED_OUT, 1, 0.1, 0.1, 1)
  4.         return
  5.     end
  6.  
  7.     -- BUG: legion legendaries will halt the set equipping if the user is swapping
  8.     -- different slotted legendaries beyond the 1/2 equipped limit
  9.     local locations = GetEquipmentSetLocations(name)
  10.     for inventoryID = 1, 17 do
  11.         local itemLink = GetInventoryItemLink('player', inventoryID)
  12.         if(itemLink) then
  13.             local rarity = GetInventoryItemQuality('player', inventoryID)
  14.             if(rarity == 5) then
  15.                 -- legendary item found, manually replace it with the item from the new set
  16.                 local action = EquipmentManager_EquipItemByLocation(locations[inventoryID], inventoryID)
  17.                 if(action) then
  18.                     EquipmentManager_RunAction(action)
  19.                 end
  20.             end
  21.         end
  22.     end
  23.  
  24.     UseEquipmentSet(name)
  25. end

Non-blocking version:
Lua Code:
  1. function EquipmentManager_EquipSet(name)
  2.     if(EquipmentSetContainsLockedItems(name) or UnitCastingInfo('player')) then
  3.         UIErrorsFrame:AddMessage(ERR_CLIENT_LOCKED_OUT, 1, 0.1, 0.1, 1)
  4.         return
  5.     end
  6.  
  7.     -- BUG: legion legendaries will halt the set equipping if the user is swapping
  8.     -- different slotted legendaries beyond the 1/2 equipped limit
  9.     local locations = GetEquipmentSetLocations(name)
  10.     for inventoryID = 1, 17 do
  11.         local itemLink = GetInventoryItemLink('player', inventoryID)
  12.         if(itemLink) then
  13.             local rarity = GetInventoryItemQuality('player', inventoryID)
  14.             if(rarity == 5) then
  15.                 -- legendary item found, manually replace it with the item from the new set
  16.                 local action = EquipmentManager_EquipItemByLocation(locations[inventoryID], inventoryID)
  17.                 if(action) then
  18.                     EquipmentManager_RunAction(action)
  19.                     locations[inventoryID] = nil
  20.                 end
  21.             end
  22.         end
  23.     end
  24.  
  25.     -- Equip remaining items through _RunAction to avoid blocking from UseEquipmentSet
  26.     for inventoryID, location in next, locations do
  27.         local action = EquipmentManager_EquipItemByLocation(location, inventoryID)
  28.         if(action) then
  29.             EquipmentManager_RunAction(action)
  30.         end
  31.     end
  32. end

Last edited by p3lim : 12-04-16 at 01:29 AM.
 
01-22-17, 02:20 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Fixed on the 7.2 PTR, build 23436.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Equipment Manager and Legion legendaries

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off