Fixed bug with addon settings.

Pontus Welin [10-27-16 - 03:45]
Fixed bug with addon settings.
Filename
EnchantMaker.lua
lang/strings.lua
diff --git a/EnchantMaker.lua b/EnchantMaker.lua
index a24c862..693c04f 100644
--- a/EnchantMaker.lua
+++ b/EnchantMaker.lua
@@ -221,9 +221,8 @@ end

 function EnchMaker.Enchant:conformsToSearch(searchTerms)
     searchTerms = searchTerms or {}
-	local _, _, runeType, rankRequirement, rarityRequirement = GetItemCraftingInfo(self.ingredients[3].bag, self.ingredients[3].slot)
+	local _, _, runeType, rankRequirement, rarityRequirement = GetItemCraftingInfo(self.ingredients[1].bag, self.ingredients[1].slot)
 	local isUsable = EnchantMakerSavedVariables.useUnknownSkill or DoesRunePassRequirements(runeType, rankRequirement, rarityRequirement)
-
     local potencyFiltersHit = isUsable
     for k, v in pairs(searchTerms.potency) do
         potencyFiltersHit = false
@@ -239,6 +238,8 @@ function EnchMaker.Enchant:conformsToSearch(searchTerms)
         return false
     end

+	_, _, runeType, rankRequirement, rarityRequirement = GetItemCraftingInfo(self.ingredients[2].bag, self.ingredients[2].slot)
+	isUsable = EnchantMakerSavedVariables.useUnknownSkill or DoesRunePassRequirements(runeType, rankRequirement, rarityRequirement)
     local essenceFiltersHit = isUsable
     for k, v in pairs(searchTerms.essence) do
         essenceFiltersHit = false
@@ -254,6 +255,8 @@ function EnchMaker.Enchant:conformsToSearch(searchTerms)
         return false
     end

+	_, _, runeType, rankRequirement, rarityRequirement = GetItemCraftingInfo(self.ingredients[3].bag, self.ingredients[3].slot)
+	isUsable = EnchantMakerSavedVariables.useUnknownSkill or DoesRunePassRequirements(runeType, rankRequirement, rarityRequirement)
     local aspectFiltersHit = isUsable
     for k, v in pairs(searchTerms.aspect) do
         aspectFiltersHit = false
@@ -375,6 +378,7 @@ function EnchMaker.addAllStuffToInventory()
         local item = EnchMaker.Runestone:new{name = runeData.name, translation = runeData.translation, quality = runeData.quality, skillRequirement = runeData.skillRequirement, prefix = runeData.prefix, minLevel = runeData.minLevel, maxLevel = runeData.maxLevel}
         local skillLevel = 0
         if not EnchantMakerSavedVariables.useUnknownTraits then
+			d(runeData.runestoneType)
             if runeData.runestoneType == "aspect" then
                 local _, _, earnedRank, _, _, _, _ = GetSkillAbilityInfo(8, 4, 1)
                 skillLevel = earnedRank
@@ -398,7 +402,7 @@ function EnchMaker.addStuffToInventoryForBag(bagId)

         if itemType == ITEMTYPE_ENCHANTING_RUNE_ASPECT or itemType == ITEMTYPE_ENCHANTING_RUNE_ESSENCE or itemType == ITEMTYPE_ENCHANTING_RUNE_POTENCY or itemType == ITEMTYPE_ENCHANTMENT_BOOSTER then
 			local _, stack, _, meetsUsageRequirement, _, _, _, quality = GetItemInfo(bagId, slotIndex)
-            if itemType == ITEMTYPE_ENCHANTING_RUNE_ASPECT or itemType == ITEMTYPE_ENCHANTING_RUNE_ESSENCE or itemType == ITEMTYPE_ENCHANTING_RUNE_POTENCY and meetsUsageRequirement then
+            if (meetsUsageRequirement or EnchantMakerSavedVariables.useUnknownSkill) and (itemType == ITEMTYPE_ENCHANTING_RUNE_ASPECT or itemType == ITEMTYPE_ENCHANTING_RUNE_ESSENCE or itemType == ITEMTYPE_ENCHANTING_RUNE_POTENCY) then
                 --translation = "Negate", prefix = "Splendid", skillRequirement = 9, minLevel = 57, maxLevel = 59
                 local runeData = EnchMaker.allRunestones[EnchMaker.stripTrailingJunk(GetItemName(bagId, slotIndex))]
                 local itemAlreadyInInventory = nil
@@ -416,7 +420,7 @@ function EnchMaker.addStuffToInventoryForBag(bagId)
 					item.qualityColor = EnchMaker.DEC_HEX(math.floor(((qualityColor["r"]) * 256) - 0.5)) .. EnchMaker.DEC_HEX(math.floor(((qualityColor["g"]) * 256) - 0.5)) .. EnchMaker.DEC_HEX(math.floor(((qualityColor["b"]) * 256) - 0.5))
                     EnchMaker.Inventory.runestones[runeData.runestoneType][item] = stack
                 end
-            elseif meetsUsageRequirement then
+            elseif meetsUsageRequirement or EnchantMakerSavedVariables.useUnknownSkill then
                 d("TODO: Handle ITEMTYPE_ENCHANTMENT_BOOSTER")
                 d(GetItemName(bagId, slotIndex))
                 -- translation = "Negate", prefix = "Splendid", skillRequirement = 9, minLevel = 57, maxLevel = 59
diff --git a/lang/strings.lua b/lang/strings.lua
index 065245e..7e8fd1a 100644
--- a/lang/strings.lua
+++ b/lang/strings.lua
@@ -14,6 +14,8 @@ local strings = {
     ENCHANTMAKER_USE_MISSING_RUNESTONES_SHORT   = "Include missing runestones",
     ENCHANTMAKER_USE_MISSING_RUNESTONES_LONG    = "Check this to search for enchantments that use runestones you do not have.",
     ENCHANTMAKER_USE_MISSING_RUNESTONES_WARNING = "Enabling this turns off automatic adding of runestones to table!",
+    ENCHANTMAKER_USE_UNKNOWN_SKILL_SHORT        = "Include unknown skill",
+    ENCHANTMAKER_USE_UNKNOWN_SKILL_LONG         = "Check this to search for enchantments that you lack the skill for.",
     ENCHANTMAKER_USE_UNKNOWN_TRAITS_SHORT       = "Include unknown translations in searches",
     ENCHANTMAKER_USE_UNKNOWN_TRAITS_LONG        = "Check this to include unknown translations in your searches.",
     ENCHANTMAKER_TRAINING_SHORT                 = "Unknown translations only",