Quantcast

Added option for disabling Known items.

Salvatore Lopiparo [07-20-16 - 00:41]
Added option for disabling Known items.
Filename
code.lua
options.lua
diff --git a/code.lua b/code.lua
index 1038cc3..bea54a9 100644
--- a/code.lua
+++ b/code.lua
@@ -134,6 +134,14 @@ CanIMogIt.NOT_TRANSMOGABLE = 		NOT_TRANSMOGABLE_ICON .. GRAY .. "Cannot be learn
 CanIMogIt.KNOWN_FROM_ANOTHER_ITEM_AND_CHARACTER = QUESTIONABLE_ICON .. YELLOW .. "Cannot determine status on other characters."


+local knownTexts = {
+	[CanIMogIt.KNOWN] = true,
+	[CanIMogIt.KNOWN_FROM_ANOTHER_ITEM] = true,
+	[CanIMogIt.KNOWN_BY_ANOTHER_CHARACTER] = true,
+	[CanIMogIt.KNOWN_BUT_TOO_LOW_LEVEL] = true,
+}
+
+
 -----------------------------
 -- Exceptions              --
 -----------------------------
@@ -509,6 +517,10 @@ local function addToTooltip(tooltip, itemLink)
 		-- If we don't want to show the tooltip if it's not transmoggable
 		return
 	end
+	if CanIMogItOptions["showUnknownOnly"] and knownTexts[text] then
+		-- We don't want to show the tooltip if it's already known.
+		return
+	end
 	if text then
 		addDoubleLine(tooltip, CanIMogIt.CAN_I_MOG_IT, text)
 	end
diff --git a/options.lua b/options.lua
index e696d0f..5f67392 100644
--- a/options.lua
+++ b/options.lua
@@ -4,7 +4,7 @@

 local _G = _G

-CanIMogIt_OptionsVersion = "1.2"
+CanIMogIt_OptionsVersion = "1.3"

 CanIMogItOptions_Defaults = {
     ["options"] = {
@@ -12,6 +12,7 @@ CanIMogItOptions_Defaults = {
         ["debug"] = false,
         ["showEquippableOnly"] = true,
         ["showTransmoggableOnly"] = false,
+        ["showUnknownOnly"] = false,
     },
 }

@@ -29,6 +30,10 @@ CanIMogItOptions_DisplayData = {
         ["displayName"] = "Transmoggable Items Only",
         ["description"] = "Only show on items that can be transmoggrified."
     },
+    ["showUnknownOnly"] = {
+        ["displayName"] = "Unknown Items Only",
+        ["description"] = "Only show on items that you haven't learned."
+    },
 }


@@ -81,11 +86,13 @@ local function createOptionsMenu()
     local debug = newCheckbox(CanIMogIt.frame, "debug")
     local showEquippableOnly = newCheckbox(CanIMogIt.frame, "showEquippableOnly")
     local showTransmoggableOnly = newCheckbox(CanIMogIt.frame, "showTransmoggableOnly")
+    local showUnknownOnly = newCheckbox(CanIMogIt.frame, "showUnknownOnly")

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