From 5b325ea7e4c3804c7f282ec34b7d0cb4061a9af8 Mon Sep 17 00:00:00 2001 From: Daniel Yates Date: Thu, 21 Jul 2016 16:23:14 +0100 Subject: [PATCH 1/5] Fixed processCheck function being made global --- xanMortarPestle.lua | 62 +++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/xanMortarPestle.lua b/xanMortarPestle.lua index 879b171..8f6d42e 100644 --- a/xanMortarPestle.lua +++ b/xanMortarPestle.lua @@ -112,6 +112,35 @@ end) local frm = CreateFrame("frame", "xanMortarPestle_Frame", UIParent) frm:SetScript("OnEvent", function(self, event, ...) if self[event] then return self[event](self, event, ...) end end) +local function processCheck(id, itemType, qual, link) + if not spells then return nil end + + --first check milling + if xMPDB.herbs[id] and spells[51005] then + return 51005 + end + + --second checking prospecting + if xMPDB.ore[id] and spells[31252] then + return 31252 + end + + --third checking lock picking (thanks to Kailsoul) + if xMPDB.lock[id] and spells[1804] then + return 1804 + end + + --otherwise check disenchat + if itemType and qual and XMP_DB and spells[13262] then + --only allow if the type of item is a weapon or armor, and it's a specific quality + if (itemType == ARMOR or itemType == L.Weapon) and qual > 1 and qual < 5 and IsEquippableItem(link) and not XMP_DB[id] then + return 13262 + end + end + + return nil +end + --this update is JUST IN CASE the autoshine is still going even after the alt press is gone local TimerOnUpdate = function(self, time) @@ -215,43 +244,14 @@ function frm:PLAYER_LOGIN() button:ClearAllPoints() button:Hide() end - + end end) - + self:UnregisterEvent("PLAYER_LOGIN") self.PLAYER_LOGIN = nil end -function processCheck(id, itemType, qual, link) - if not spells then return nil end - - --first check milling - if xMPDB.herbs[id] and spells[51005] then - return 51005 - end - - --second checking prospecting - if xMPDB.ore[id] and spells[31252] then - return 31252 - end - - --third checking lock picking (thanks to Kailsoul) - if xMPDB.lock[id] and spells[1804] then - return 1804 - end - - --otherwise check disenchat - if itemType and qual and XMP_DB and spells[13262] then - --only allow if the type of item is a weapon or armor, and it's a specific quality - if (itemType == ARMOR or itemType == L.Weapon) and qual > 1 and qual < 5 and IsEquippableItem(link) and not XMP_DB[id] then - return 13262 - end - end - - return nil -end - --instead of having a large array with all the possible non-disenchant items --I decided to go another way around this. Whenever a user tries to disenchant an item that can't be disenchanted --it learns the item into a database. That way in the future the user will not be able to disenchant it. -- 1.7.9.5 From 98b568c170af3ee8ad8c89a3a8c8e70b4bfec6f3 Mon Sep 17 00:00:00 2001 From: Daniel Yates Date: Thu, 21 Jul 2016 16:24:23 +0100 Subject: [PATCH 2/5] Whitespace and newline formatting fixes Nothing interesting to see here whatsoever. --- xanMortarPestle.lua | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/xanMortarPestle.lua b/xanMortarPestle.lua index 8f6d42e..ed11d89 100644 --- a/xanMortarPestle.lua +++ b/xanMortarPestle.lua @@ -51,7 +51,7 @@ button:RegisterForDrag("LeftButton") button:SetFrameStrata("TOOLTIP") --secured on leave function to hide the frame when we are in combat -button:SetAttribute("_onleave", "self:ClearAllPoints() self:SetAlpha(0) self:Hide()") +button:SetAttribute("_onleave", "self:ClearAllPoints() self:SetAlpha(0) self:Hide()") button:HookScript("OnLeave", function(self) AutoCastShine_AutoCastStop(self) @@ -72,7 +72,7 @@ function button:MODIFIER_STATE_CHANGED(event, modi) if not modi then return end if modi ~= "LALT" or modi ~= "RALT" then return end if not self:IsShown() then return end - + --clear the auto shine if alt key has been released if not IsAltKeyDown() and not InCombatLockdown() then AutoCastShine_AutoCastStop(self) @@ -160,10 +160,10 @@ local TimerOnUpdate = function(self, time) end function frm:PLAYER_LOGIN() - + --check for DB if not XMP_DB then XMP_DB = {} end - + --milling if(IsSpellKnown(51005)) then spells[51005] = GetSpellInfo(51005) @@ -173,7 +173,7 @@ function frm:PLAYER_LOGIN() if(IsSpellKnown(31252)) then spells[31252] = GetSpellInfo(31252) end - + --disenchanting if(IsSpellKnown(13262)) then spells[13262] = GetSpellInfo(13262) @@ -183,7 +183,7 @@ function frm:PLAYER_LOGIN() if(IsSpellKnown(1804)) then spells[1804] = GetSpellInfo(1804) end - + GameTooltip:HookScript('OnTooltipSetItem', function(self) --do some checks before we do anything if InCombatLockdown() then return end --if were in combat then exit @@ -191,40 +191,40 @@ function frm:PLAYER_LOGIN() if CursorHasItem() then return end --if the mouse has an item then exit if MailFrame:IsVisible() then return end --don't continue if the mailbox is open. For addons such as Postal. if AuctionFrame and AuctionFrame:IsShown() then return end --dont enable if were at the auction house - + local item, link = self:GetItem() --make sure we have an item to work with if not item and not link then return end - + local owner = self:GetOwner() --get the owner of the tooltip --if it's the character frames equipment switch then ignore it if owner and owner:GetName() and strfind(string.lower(owner:GetName()), "character") and strfind(string.lower(owner:GetName()), "slot") then return end if owner and owner:GetParent() and owner:GetParent():GetName() and strfind(string.lower(owner:GetParent():GetName()), "paperdoll") then return end if owner and owner:GetName() and strfind(string.lower(owner:GetName()), "equipmentflyout") then return end - + --reset if no item (link will be nil) lastItem = link --make sure we have an item, it's not an equipped one, and the darn lootframe isn't showing if item and link and not IsEquippedItem(link) and not LootFrame:IsShown() then - + --get the bag slot info local bag = owner:GetParent():GetID() local slot = owner:GetID() - + local id = type(link) == "number" and link or select(3, link:find("item:(%d+):")) id = tonumber(id) - + if not id then return end if not xMPDB then return end - + local _, _, qual, itemLevel, _, itemType = GetItemInfo(link) local spellID = processCheck(id, itemType, qual, link) - + --check to show or hide the button if spellID then - + --set the item for disenchant check lastItem = link @@ -235,7 +235,7 @@ function frm:PLAYER_LOGIN() button:SetAllPoints(owner) button:SetAlpha(1) button:Show() - + AutoCastShine_AutoCastStart(button, colors[spellID].r, colors[spellID].g, colors[spellID].b) else button:SetScript("OnUpdate", nil) -- 1.7.9.5 From 475d766399a5d098462df82b35e12deda5a18fe6 Mon Sep 17 00:00:00 2001 From: Daniel Yates Date: Thu, 21 Jul 2016 16:40:11 +0100 Subject: [PATCH 3/5] Added Legion ores, herbs and lockboxes Not collected any of these in the beta, but I've checked that each herb has an associated Mass Mill spell and the same for ores wrt. prospecting. --- itemDB.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/itemDB.lua b/itemDB.lua index 840ece4..9159292 100644 --- a/itemDB.lua +++ b/itemDB.lua @@ -74,6 +74,14 @@ xMPDB.herbs = { [109127] = true, -- Starflower [109128] = true, -- Nagrand Arrowbloom [109129] = true, -- Talador Orchid + -- Legion + [124101] = true, -- Aethril + [124102] = true, -- Dreamleaf + [124103] = true, -- Foxflower + [124104] = true, -- Fjarnskaggl-waggle-something. + [124105] = true, -- Starlight Rose + [124106] = true, -- Felwort + [128304] = true, -- Yseralline Seed (I guess - these have a Mass Mill spell). } --[[------------------------ @@ -102,6 +110,9 @@ xMPDB.ore = { -- Warlords of Draenor [109119] = true, -- True Iron Ore [109118] = true, -- Blackrock Ore + -- Legion + [123918] = true, -- Leystone Ore + [123919] = true, -- Felslate } @@ -142,4 +153,6 @@ xMPDB.lock = { [88567] = true, --ghost iron box -- Warlords of Draenor [116920] = true, -- True Steel Lockbox + -- Legion + [121331] = true, -- Leystone Lockbox } -- 1.7.9.5 From f133dd5f0791232312902231e8638e15647bfd9f Mon Sep 17 00:00:00 2001 From: Daniel Yates Date: Thu, 21 Jul 2016 16:40:54 +0100 Subject: [PATCH 4/5] Removed WoD ores which aren't prospectable So turns out for the entire expansion you couldn't prospect those ores, instead having to rely on the garrisons to do it for you. --- itemDB.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/itemDB.lua b/itemDB.lua index 9159292..55b5942 100644 --- a/itemDB.lua +++ b/itemDB.lua @@ -107,9 +107,6 @@ xMPDB.ore = { [72103] = true, -- White Trillium Ore [72094] = true, -- Black Trillium Ore [72093] = true, -- Kyparite Ore - -- Warlords of Draenor - [109119] = true, -- True Iron Ore - [109118] = true, -- Blackrock Ore -- Legion [123918] = true, -- Leystone Ore [123919] = true, -- Felslate -- 1.7.9.5 From f4289b7b1b2f1d99b5b98eeaeb958722b03634d8 Mon Sep 17 00:00:00 2001 From: Daniel Yates Date: Thu, 21 Jul 2016 16:42:57 +0100 Subject: [PATCH 5/5] TOC bump --- xanMortarPestle.toc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xanMortarPestle.toc b/xanMortarPestle.toc index 7d96ef0..86b60be 100644 --- a/xanMortarPestle.toc +++ b/xanMortarPestle.toc @@ -1,4 +1,4 @@ -## Interface: 60000 +## Interface: 70000 ## Title: xanMortarPestle ## Notes: Mill/Prospect/Disenchant using (Alt + Right-Click) on an item. ## Author: Xruptor -- 1.7.9.5