Partial checkin for remote editing

Wobin [04-26-14 - 13:17]
Partial checkin for remote editing
start on language stripper
added toggle for recipe matching entirely.
Come back, internet, all is forgiven
Filename
.gitignore
SousChef.lua
diff --git a/.gitignore b/.gitignore
index bff2d76..0cc2124 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 *.iml
+.idea/
diff --git a/SousChef.lua b/SousChef.lua
index 5d3cf49..9ca75a7 100644
--- a/SousChef.lua
+++ b/SousChef.lua
@@ -51,6 +51,12 @@ local function StartsWith(String,Start)
     return Start=='' or string.sub(String, 1, string.len(Start))==Start
 end

+local suffixes = {"le", "el", }
+
+local function StripLanguageIdentifiers(entry)
+
+end
+
 local function CleanString(entry)
     return entry:gsub("%^(%a+)", ""):gsub(" ",""):gsub("-",""):lower()
 end
@@ -161,22 +167,23 @@ local function AddRankToSlot(row)
 			end

 		end
-	else
-		if GetItemType(bagId, slotIndex) == ITEMTYPE_RECIPE then
-			local match = MatchInCookbook(slot.name)
-			local gmatch = MatchInGlobalCookbook(slot.name)
-			if (match and SousChef.settings.checkKnown == "known") or
-			   (not match and SousChef.settings.checkKnown == "unknown")then
-				rankIcon:SetTexture(CANLEARN)
-				rankIcon:SetHidden(false)
-				if not match and gmatch and SousChef.settings.checkKnown == "unknown" and SousChef.settings.markAlt then
-					rankIcon:SetColor(1,1,1,0.2)
-				else
-					rankIcon:SetColor(1,1,1,1)
-				end
-			end
-		end
-
+    else
+        if SousChef.settings.parseRecipes then
+            if GetItemType(bagId, slotIndex) == ITEMTYPE_RECIPE then
+                local match = MatchInCookbook(slot.name)
+                local gmatch = MatchInGlobalCookbook(slot.name)
+                if (match and SousChef.settings.checkKnown == "known") or
+                   (not match and SousChef.settings.checkKnown == "unknown")then
+                    rankIcon:SetTexture(CANLEARN)
+                    rankIcon:SetHidden(false)
+                    if not match and gmatch and SousChef.settings.checkKnown == "unknown" and SousChef.settings.markAlt then
+                        rankIcon:SetColor(1,1,1,0.2)
+                    else
+                        rankIcon:SetColor(1,1,1,1)
+                    end
+                end
+            end
+		end
 	end
 end

@@ -184,23 +191,24 @@ local function AddTradingSlot(row, result)
 	local rankIcon = getIcon(row)

 	rankIcon:SetHidden(true)
-
-	if MatchesRecipe(result.name) then
-		local match = MatchInCookbook(result.name)
-		local gmatch = MatchInGlobalCookbook(result.name)
-		if (match and SousChef.settings.checkKnown == "known") or
-		   (not match and SousChef.settings.checkKnown == "unknown")then
-			rankIcon:SetDimensions(30, 30)
-			rankIcon:SetAnchor(CENTER, row, CENTER, 230)
-			rankIcon:SetTexture(CANLEARN)
-			rankIcon:SetHidden(false)
-			if not match and gmatch and SousChef.settings.checkKnown == "unknown" and SousChef.settings.markAlt then
-				rankIcon:SetColor(1,1,1,0.2)
-			else
-				rankIcon:SetColor(1,1,1,1)
-			end
-		end
-	end
+    if SousChef.settings.parseRecipes then
+        if MatchesRecipe(result.name) then
+            local match = MatchInCookbook(result.name)
+            local gmatch = MatchInGlobalCookbook(result.name)
+            if (match and SousChef.settings.checkKnown == "known") or
+               (not match and SousChef.settings.checkKnown == "unknown")then
+                rankIcon:SetDimensions(30, 30)
+                rankIcon:SetAnchor(CENTER, row, CENTER, 230)
+                rankIcon:SetTexture(CANLEARN)
+                rankIcon:SetHidden(false)
+                if not match and gmatch and SousChef.settings.checkKnown == "unknown" and SousChef.settings.markAlt then
+                    rankIcon:SetColor(1,1,1,0.2)
+                else
+                    rankIcon:SetColor(1,1,1,1)
+                end
+            end
+        end
+    end
 end

 local function AddRecipe(Cookbook, link)
@@ -247,7 +255,19 @@ local function SousChefCreateSettings()
 	local panel = LAM:CreateControlPanel("SousChefMenu", "Sous Chef")

 	LAM:AddHeader(panel, "SousChef_General", "Settings")
-
+
+    LAM:AddCheckbox(panel, "processRecipes", "Have Sous Chef check for recipes", "Non English clients may want to untick this if the experimental matching isn't sufficient",
+                        function() return SousChef.settings.processRecipes end,
+                        function(value)
+                            SousChef.settings.processRecipes = not SousChef.settings.processRecipes
+                            if SousChef.settings.processRecipes then
+                                ZO_Options_SetOptionInactive(markLearnt)
+                                ZO_Options_SetOptionInactive(markAltKnows)
+                            else
+                                ZO_Options_SetOptionActive(markLearnt)
+                                ZO_Options_SetOptionActive(markAltKnows)
+                            end
+                        end)
   	LAM:AddDropdown(panel, "markLearnt", "Mark if recipes are ",
 						"How do you want Sous Chef to indicate your knowledge of a recipe?",
 						{"known", "unknown"}, function() return SousChef.settings.checkKnown end,
@@ -265,7 +285,9 @@ local function SousChefCreateSettings()
 						"Allows you to set the colour of the indicator",
 						function() return SousChef.settings.colour[1], SousChef.settings.colour[2], SousChef.settings.colour[3] end,
 						function(r,g,b) SousChef.settings.colour[1] = r; SousChef.settings.colour[2] = g; SousChef.settings.colour[3] = b end)
-
+    LAM:AddCheckbox(panel, "experimental", "Use the experimental recipe matcher", "Currently Sous Chef cannot match reliably in other languages. This will attempt to match as best it can",
+                        function() return SousChef.settings.experimentalMatch end,
+                        function(value) SousChef.settings.experimentalMatch = not SousChef.settings.experimentalMatch end)
 end

 local function HookTrading(...)
@@ -292,7 +314,10 @@ local function SousChef_Loaded(eventCode, addOnName)
 		Pantry = {},
 		ReverseCookbook = {},
 		showAltKnowledge = false,
-		boldIcon = false
+		boldIcon = false,
+        experimentalMatch = false,
+        processRecipes = true,
+        processRecipes = true
 	}

     SousChef.settings = ZO_SavedVars:NewAccountWide("SousChef_Settings", 8, nil, defaults)