From 3ffc43da2758a2b9e469d9124ce8b649b686bfd7 Mon Sep 17 00:00:00 2001 From: Continuity Date: Fri, 11 Oct 2024 11:33:23 +0200 Subject: [PATCH] Fixing an issue with Lockpicking. (#28) --- nop-button.lua | 4 ++++ nop-core.lua | 2 +- nop-item.lua | 7 +++++-- nop-slash.lua | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nop-button.lua b/nop-button.lua index 35a6f5e..d156629 100644 --- a/nop-button.lua +++ b/nop-button.lua @@ -337,6 +337,10 @@ function NOP:ButtonShow() -- display button bt:SetAttribute("spell", bt.mspell) bt:SetAttribute("item", bt.mtarget) -- ("bag slot") bt:SetAttribute("target-item", bt.mtargetitem) -- ("bag slot") + if bt.mspell then + bt:SetAttribute("target-bag", bt.bagID) + bt:SetAttribute("target-slot", bt.slotID) + end self:Verbose("ButtonShow:",self:CompressText(bt.mtype),bt.mspell and self:CompressText(bt.mspell),bt.mtarget and self:CompressText("item: " .. bt.mtarget),bt.mtargetitem and self:CompressText("target-item: " .. bt.mtargetitem)) else --bt:SetAttribute("macrotext1", nil) diff --git a/nop-core.lua b/nop-core.lua index c2ef488..0d2d065 100644 --- a/nop-core.lua +++ b/nop-core.lua @@ -23,7 +23,7 @@ local GetMinimapZoneText = _G.GetMinimapZoneText; assert(GetMinimapZoneText ~= n local GetNumArchaeologyRaces = _G.GetNumArchaeologyRaces; assert(GetNumArchaeologyRaces ~= nil,'GetNumArchaeologyRaces') local GetNumFactions = _G.GetNumFactions or _G.C_Reputation.GetNumFactions; assert(GetNumFactions ~= nil,'GetNumFactions') local GetSpellCooldown = _G.GetSpellCooldown or _G.C_Spell.GetSpellCooldown; assert(GetSpellCooldown ~= nil,'GetSpellCooldown') -local GetSpellInfo = _G.GetSpellInfo or _G.C_Spell.GetSpellInfo; assert(GetSpellInfo ~= nil,'GetSpellInfo') +local GetSpellInfo = _G.GetSpellInfo or _G.C_Spell.GetSpellName; assert(GetSpellInfo ~= nil,'GetSpellInfo') -- intentionally use GetSpellName here, as that is what we use later local GetTime = _G.GetTime; assert(GetTime ~= nil,'GetTime') local gsub = _G.gsub; assert(gsub ~= nil,'gsub') local InCombatLockdown = _G.InCombatLockdown; assert(InCombatLockdown ~= nil,'InCombatLockdown') diff --git a/nop-item.lua b/nop-item.lua index 1e6e8a6..c885432 100644 --- a/nop-item.lua +++ b/nop-item.lua @@ -386,6 +386,8 @@ function NOP:ItemShow(itemID,prio) -- add item to button local mtarget = format("item:%d", itemID) --local mtarget = format("%d %d", bagID, slotID) local mtargetitem = nil + local mtargetbag = nil + local mtartgetslot = nil local mtype = "item" local mspell = nil if T_PICK[itemID] then -- item has picklock in tooltip @@ -398,7 +400,8 @@ function NOP:ItemShow(itemID,prio) -- add item to button mtype = "spell" mspell = self.pickLockSpell mtarget = nil - mtargetitem = format("item:%d", itemID) --format("%d %d" ,bagID,slotID) -- this one needs unlock + --mtargetitem = format("item:%d", itemID) --format("%d %d" ,bagID,slotID) -- this one needs unlock + mtargetitem = nil else T_PICK[itemID] = nil -- it not require lockpick anymore end @@ -410,7 +413,7 @@ function NOP:ItemShow(itemID,prio) -- add item to button mtarget = nil mtargetitem = format("item:%d", itemID) --format("%d %d" ,bagID,slotID) -- disenchant this end - if (bt.itemCount ~= itemCount) or (bt.itemID ~= itemID) or (bt.isGlow ~= isGlow) or (bt.mtext ~= mtext) or (bt.mtype ~= mtype) or (bt.mspell ~= mspell) or (bt.mtarget ~= mtarget) or (bt.mtargetitem ~= mtargetitem) then + if (bt.itemCount ~= itemCount) or (bt.itemID ~= itemID) or (bt.isGlow ~= isGlow) or (bt.mtext ~= mtext) or (bt.mtype ~= mtype) or (bt.mspell ~= mspell) or (bt.mtarget ~= mtarget) or (bt.mtargetitem ~= mtargetitem) or (bt.bagID ~= bagID) or (bt.slotID ~= slotID) then bt.prio = prio bt.showID = itemID bt.itemID = itemID diff --git a/nop-slash.lua b/nop-slash.lua index 6aeb137..e9cc4c3 100644 --- a/nop-slash.lua +++ b/nop-slash.lua @@ -10,7 +10,7 @@ local GetContainerItemID = _G.GetContainerItemID or C_Container.GetContainerItem local GetContainerItemLink = _G.GetContainerItemLink or C_Container.GetContainerItemLink; assert(GetContainerItemLink ~= nil,'GetContainerItemLink') local GetContainerNumSlots = _G.GetContainerNumSlots or C_Container.GetContainerNumSlots; assert(GetContainerNumSlots ~= nil,'GetContainerNumSlots') local GetItemInfo = _G.GetItemInfo or _G.C_Item.GetItemInfo; assert(GetItemInfo ~= nil,'GetItemInfo') -local GetSpellInfo = _G.GetSpellInfo or _G.C_Spell.GetSpellInfo; assert(GetSpellInfo ~= nil,'GetSpellInfo') +local GetSpellInfo = _G.GetSpellInfo or _G.C_Spell.GetSpellName; assert(GetSpellInfo ~= nil,'GetSpellInfo') -- intentionally use GetSpellName here, as that is what we use later local GetTime = _G.GetTime; assert(GetTime ~= nil,'GetTime') local issecurevariable = _G.issecurevariable; assert(issecurevariable ~= nil,'issecurevariable') local math = _G.math; assert(math ~= nil,'math')