From ac0efbf780a513f3be63cf10a5b2f97df03143ed Mon Sep 17 00:00:00 2001 From: Bunny67 Date: Sat, 20 Jun 2020 11:34:13 +0300 Subject: [PATCH] enable Equipment Set prototype --- WeakAuras/GenericTrigger.lua | 20 +++++++++++++++++--- WeakAuras/Prototypes.lua | 1 - 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 31e5191..43d2e96 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -2531,17 +2531,31 @@ function WeakAuras.WatchUnitChange(unit) watchUnitChange.unitChangeGUIDS[unit] = UnitGUID(unit) or "" end +local equipmentItemIDs, equipmentSetItemIDs = {}, {} function WeakAuras.GetEquipmentSetInfo(itemSetName, partial) local bestMatchNumItems = 0; local bestMatchNumEquipped = 0; local bestMatchName = nil; local bestMatchIcon = nil; - local equipmentSetIds = C_EquipmentSet.GetEquipmentSetIDs(); - for index, id in pairs(equipmentSetIds) do - local name, icon, _, _, numItems, numEquipped = C_EquipmentSet.GetEquipmentSetInfo(id); + for slot = 1, 19 do + equipmentItemIDs[slot] = GetInventoryItemID("player", slot) or 0 + end + + for id = 1, GetNumEquipmentSets() do + local numItems, numEquipped = 0, 0 + local name, icon = GetEquipmentSetInfo(id); if (itemSetName == nil or (name and itemSetName == name)) then if (name ~= nil) then + equipmentSetItemIDs = GetEquipmentSetItemIDs(name, equipmentSetItemIDs) + for slot, item in ipairs(equipmentSetItemIDs) do + if item > 0 then + numItems = numItems + 1 + if equipmentItemIDs[slot] == item then + numEquipped = numEquipped + 1 + end + end + end local match = (not partial and numItems == numEquipped) or (partial and (numEquipped or 0) > bestMatchNumEquipped); if (match) then diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index e66fb55..65ede4b 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -5352,7 +5352,6 @@ WeakAuras.event_prototypes["DBM Announce"] = nil WeakAuras.event_prototypes["DBM Timer"] = nil WeakAuras.event_prototypes["BigWigs Message"] = nil WeakAuras.event_prototypes["BigWigs Timer"] = nil -WeakAuras.event_prototypes["Equipment Set"] = nil WeakAuras.dynamic_texts = { ["p"] = {