Quantcast

Improved disenchanting guessing by providing a working table

p3lim [12-23-10 - 15:06]
Improved disenchanting guessing by providing a working table
- Table is not complete due to bugs on Wowhead
Filename
Database.lua
Disenchanting.lua
Molinari.lua
Molinari.toc
diff --git a/Database.lua b/Database.lua
deleted file mode 100644
index e1741bb..0000000
--- a/Database.lua
+++ /dev/null
@@ -1,5 +0,0 @@
-local _, ns = ...
-
-ns.notDisenchantable = {
-
-}
diff --git a/Disenchanting.lua b/Disenchanting.lua
new file mode 100644
index 0000000..02ddb20
--- /dev/null
+++ b/Disenchanting.lua
@@ -0,0 +1,37 @@
+local _, ns = ...
+
+local notDisenchantable = {
+	-- Weapons
+	['52889'] = true,
+	['52876'] = true,
+	['52870'] = true,
+	['52872'] = true,
+	['52875'] = true,
+	['59043'] = true,
+	['59042'] = true,
+	['59040'] = true,
+	['66196'] = true,
+	['66291'] = true,
+
+	-- Armor
+	['40483'] = true,
+	['22206'] = true,
+	['52873'] = true,
+	['52874'] = true,
+	['57115'] = true,
+	['31404'] = true,
+	['21525'] = true,
+	['67108'] = true,
+	['52019'] = true,
+	['31405'] = true,
+	['21524'] = true,
+	['23192'] = true,
+}
+
+function ns.Disenchantable(link)
+	local _, _, quality = GetItemInfo(link)
+
+	if(IsEquippableItem(link) and (quality and (quality > 1 or quality < 5))) then
+		return not notDisenchantable[link:match('item:(%d+):')]
+	end
+end
diff --git a/Molinari.lua b/Molinari.lua
index 6bdf2b1..062e024 100644
--- a/Molinari.lua
+++ b/Molinari.lua
@@ -1,7 +1,5 @@
 
 local addonName, ns = ...
-local armorType = GetLocale() == 'ruRU' and '' or ARMOR
-
 local button = CreateFrame('Button', addonName, UIParent, 'SecureActionButtonTemplate')
 button:SetScript('OnEvent', function(self, event, ...) self[event](self, ...) end)
 button:RegisterEvent('PLAYER_LOGIN')
@@ -16,7 +14,7 @@ local function ScanTooltip(self, spells)
 end

 function button:PLAYER_LOGIN()
-	local spells, disenchantable = {}
+	local spells, disenchanter = {}
 	if(IsSpellKnown(51005)) then
 		spells[ITEM_MILLABLE] = {GetSpellInfo(51005), 1/2, 1, 1/2}
 	end
@@ -27,7 +25,7 @@ function button:PLAYER_LOGIN()

 	-- I wish Blizzard could treat disenchanting the same way
 	if(IsSpellKnown(13262)) then
-		disenchantable = {GetSpellInfo(13262), 1, 1, 1}
+		disenchanter = {GetSpellInfo(13262), 1, 1, 1}
 	end

 	GameTooltip:HookScript('OnTooltipSetItem', function(self)
@@ -35,13 +33,8 @@ function button:PLAYER_LOGIN()
 		if(item and not InCombatLockdown() and IsAltKeyDown()) then
 			local spell, r, g, b = ScanTooltip(self, spells)

-
-			if(not spell and disenchantable and not ns.notDisenchantable[link:match('item:(%d+):')]) then
-				local _, _, quality, _, _, itemType = GetItemInfo(item)
-
-				if((itemType == armorType or itemType == ENCHSLOT_WEAPON) and (quality and (quality > 1 or quality < 5))) then
-					spell, r, g, b = unpack(disenchantable)
-				end
+			if(not spell and disenchanter and ns.Disenchantable(link)) then
+				spell, r, g, b = unpack(disenchanter)
 			end

 			local bag, slot = GetMouseFocus():GetParent(), GetMouseFocus()
diff --git a/Molinari.toc b/Molinari.toc
index 7625beb..1f42d29 100644
--- a/Molinari.toc
+++ b/Molinari.toc
@@ -4,5 +4,5 @@
 ## Title: Molinari
 ## Notes: One-click Milling, Prospecting and Disenchanting!

-Database.lua
 Molinari.lua
+Disenchanting.lua