From 8fb681287628d1f66c97c2733efa4041012afdf2 Mon Sep 17 00:00:00 2001 From: Adrian L Lange Date: Fri, 13 Jul 2012 04:53:17 +0200 Subject: [PATCH] Use a database for lockboxes instead of the (faulty) localization hack. --- Lockpicking.lua | 37 +++++++++++++++++++++++++++++++++++++ Molinari.lua | 19 +++++++++---------- Molinari.toc | 1 + 3 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 Lockpicking.lua diff --git a/Lockpicking.lua b/Lockpicking.lua new file mode 100644 index 0000000..d569198 --- /dev/null +++ b/Lockpicking.lua @@ -0,0 +1,37 @@ +local _, ns = ... + +local openable = { + ['68729'] = true, -- MoP + ['63349'] = true, -- MoP + ['45986'] = true, + ['43624'] = true, + ['43622'] = true, + ['43575'] = true, + ['31952'] = true, + ['12033'] = true, + ['29569'] = true, + ['5760'] = true, + ['13918'] = true, + ['5759'] = true, + ['5758'] = true, + ['13875'] = true, + ['4638'] = true, + ['16884'] = true, + ['4637'] = true, + ['4636'] = true, + ['6355'] = true, + ['16883'] = true, + ['4634'] = true, + ['4633'] = true, + ['6354'] = true, + ['16882'] = true, + ['4632'] = true, + ['88165'] = true, + ['88567'] = true, + ['88165'] = true, + ['88567'] = true, +} + +function ns.Openable(link) + return openable[link:match('item:(%d+)')] +end diff --git a/Molinari.lua b/Molinari.lua index fd45757..e59e876 100644 --- a/Molinari.lua +++ b/Molinari.lua @@ -29,8 +29,7 @@ function button:PLAYER_LOGIN() end if(IsSpellKnown(1804)) then - -- Commence localization hack - rogue = ITEM_MIN_SKILL:gsub('%%s', (GetSpellInfo(1810))):gsub('%%d', '%(.*%)') + rogue = true end GameTooltip:HookScript('OnTooltipSetItem', function(self) @@ -38,18 +37,18 @@ function button:PLAYER_LOGIN() if(item and not InCombatLockdown() and IsAltKeyDown() and not (AuctionFrame and AuctionFrame:IsShown())) then local spell, r, g, b = ScanTooltip(self, spells) - if(not spell and disenchanter and ns.Disenchantable(link)) then - spell, r, g, b = GetSpellInfo(13262), 1/2, 1/2, 1 - elseif(not spell and rogue) then - for index = 1, self:NumLines() do - if(string.match(_G['GameTooltipTextLeft' .. index]:GetText() or '', rogue)) then - spell, r, g, b = GetSpellInfo(1804), 0, 1, 1 - end + if(not spell) then + if(disenchanter and ns.Disenchantable(link)) then + spell, r, g, b = GetSpellInfo(13262), 1/2, 1/2, 1 + elseif(rogue and ns.Openable) then + spell, r, g, b = GetSpellInfo(1804), 0, 1, 1 + else + return end end local bag, slot = GetMouseFocus():GetParent(), GetMouseFocus() - if(spell and GetContainerItemLink(bag:GetID(), slot:GetID()) == link) then + if(GetContainerItemLink(bag:GetID(), slot:GetID()) == link) then button:SetAttribute('macrotext', string.format('/cast %s\n/use %s %s', spell, bag:GetID(), slot:GetID())) button:SetAllPoints(slot) button:Show() diff --git a/Molinari.toc b/Molinari.toc index f90cb92..8cf5291 100644 --- a/Molinari.toc +++ b/Molinari.toc @@ -6,3 +6,4 @@ Molinari.lua Disenchanting.lua +Lockpicking.lua -- 1.7.9.5