Quantcast

Fixed bug in exceptions, added option to disable non-transmoggable items

Salvatore Lopiparo [07-17-16 - 19:55]
Fixed bug in exceptions, added option to disable non-transmoggable items
Filename
code.lua
options.lua
diff --git a/code.lua b/code.lua
index 183d268..06eab24 100644
--- a/code.lua
+++ b/code.lua
@@ -126,6 +126,7 @@ local exceptionItems = {
 		[37894] = CanIMogIt.NOT_TRANSMOGABLE,
 		[37893] = CanIMogIt.NOT_TRANSMOGABLE,
 		[33018] = CanIMogIt.NOT_TRANSMOGABLE,
+		[56836] = CanIMogIt.NOT_TRANSMOGABLE,
 		-- Brewfest Steins end --
 	},
     ['INVTYPE_SHIELD'] = {},
@@ -209,7 +210,10 @@ function CanIMogIt:GetExceptionText(itemLink)
 	-- Returns the exception text for this item, if it has one.
 	local itemID = CanIMogIt:GetItemID(itemLink)
 	local slotName = select(9, GetItemInfo(itemLink))
-	return exceptionItems[slotName][itemID]
+	local slotExceptions = exceptionItems[slotName]
+	if slotExceptions then
+		return slotExceptions[itemID]
+	end
 end


@@ -390,6 +394,10 @@ local function addToTooltip(tooltip, itemLink)
 		CanIMogIt.cachedItemLink = itemLink
 		CanIMogIt.cachedTooltipText = text
 	end
+	if CanIMogItOptions["showTransmoggableOnly"] and text == CanIMogIt.NOT_TRANSMOGABLE then
+		-- If we don't want to show the tooltip if it's not transmoggable
+		return
+	end
 	if text then
 		addDoubleLine(tooltip, CanIMogIt.CAN_I_MOG_IT, text)
 	end
diff --git a/options.lua b/options.lua
index 02b1da3..e696d0f 100644
--- a/options.lua
+++ b/options.lua
@@ -4,13 +4,14 @@

 local _G = _G

-CanIMogIt_OptionsVersion = "1.1"
+CanIMogIt_OptionsVersion = "1.2"

 CanIMogItOptions_Defaults = {
     ["options"] = {
         ["version"] = CanIMogIt_OptionsVersion,
         ["debug"] = false,
         ["showEquippableOnly"] = true,
+        ["showTransmoggableOnly"] = false,
     },
 }

@@ -18,11 +19,15 @@ CanIMogItOptions_Defaults = {
 CanIMogItOptions_DisplayData = {
     ["debug"] = {
         ["displayName"] = "Debug Tooltip",
-        ["description"] = "Enables a detailed display for debug purposes. Use this when sending bug reports.",
+        ["description"] = "Detailed information for debug purposes. Use this when sending bug reports.",
     },
     ["showEquippableOnly"] = {
-        ["displayName"] = "Show On Equippable Items Only",
-        ["description"] = "When selected, only items that can be equipped will display the Can I Mog It? tooltip."
+        ["displayName"] = "Equippable Items Only",
+        ["description"] = "Only show on items that can be equipped."
+    },
+    ["showTransmoggableOnly"] = {
+        ["displayName"] = "Transmoggable Items Only",
+        ["description"] = "Only show on items that can be transmoggrified."
     },
 }

@@ -75,10 +80,12 @@ local function createOptionsMenu()
     -- define the checkboxes
     local debug = newCheckbox(CanIMogIt.frame, "debug")
     local showEquippableOnly = newCheckbox(CanIMogIt.frame, "showEquippableOnly")
+    local showTransmoggableOnly = newCheckbox(CanIMogIt.frame, "showTransmoggableOnly")

     -- position the checkboxes
     debug:SetPoint("TOPLEFT", 16, -16)
     showEquippableOnly:SetPoint("TOPLEFT", debug, "BOTTOMLEFT")
+    showTransmoggableOnly:SetPoint("TOPLEFT", showEquippableOnly, "BOTTOMLEFT")
 end