Quantcast

Make it so if you don't have a reputation level, the recipe is displayed in red.

ackis [10-23-08 - 05:12]
Make it so if you don't have a reputation level, the recipe is displayed in red.
Filename
ARLFrame.lua
AckisRecipeList.lua
AckisRecipeList.toc
diff --git a/ARLFrame.lua b/ARLFrame.lua
index be8bb41..a3c01be 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -2200,7 +2200,8 @@ end
 -- Input:
 -- Output:

-function addon.setFlyawayState ()
+function addon.setFlyawayState()
+
 	-- This function sets all the current options in the flyaway panel to make
 	-- sure they are consistent with the SV options. This is run every time the
 	-- Flyaway panel "OnShow" triggers
@@ -2629,6 +2630,7 @@ function addon.DoFlyaway(panel)
 	end

 	if (ChangeFilters == true) then
+
 		-- Depending on which panel we're showing, either display one column
 		-- or two column
 		if ((panel == 3) or (panel == 4)) then
@@ -2694,7 +2696,80 @@ function initDisplayStrings()
 			local recipeSkill = recipeDB[recipeIndex]["Level"]
 			local playerSkill = playerData.playerProfessionLevel

-			if (recipeSkill > playerSkill) then
+			local sorttype = addon.db.profile.sorting
+
+			if (sorttype == L["Skill"]) then
+
+				recStr = "[" .. recipeSkill .. "] - " .. recStr
+
+			else
+
+				recStr = recStr .. " - [" .. recipeSkill .. "]"
+
+			end
+
+			local checkFactions = true
+			local playerRep = playerData["Reputation"]
+			local playerFaction = playerData.playerFaction
+
+			-- Scan through all acquire types
+			for i in pairs(recipeDB[recipeIndex]["Acquire"]) do
+
+				-- If it's a repuitation type
+				if (recipeDB[recipeIndex]["Acquire"][i]["Type"] == 6) then
+
+					local repid = recipeDB[recipeIndex]["Acquire"][i]["ID"]
+
+					-- If it's Honor Hold/Thrallmar
+					if (repid == 946) or (repid == 947) then
+
+						-- If the player is Alliance look at Honor Hold only
+						if (playerFaction == BFAC["Alliance"]) then
+
+							repid = 946
+
+						-- If the player is Horde look at Thrallmar only
+						else
+
+							repid = 947
+
+						end
+
+					-- If it's Kureni/Mag'har
+					elseif (repid == 941) or (repid == 978) then
+
+						-- If the player is Alliance look at Kureni only
+						if (playerFaction == BFAC["Alliance"]) then
+
+							repid = 978
+
+						-- If the player is Horde look at Mag'har only
+						else
+
+							repid = 941
+
+						end
+
+					end
+
+					if (not playerRep[repDB[repid]["Name"]]) or (playerRep[repDB[repid]["Name"]] < recipeDB[recipeIndex]["Acquire"][i]["RepLevel"]) then
+
+						checkFactions = false
+
+					else
+
+						-- This means that the faction level is high enough to learn the recipe, so we'll set display to true and leave the loop
+						-- This should allow recipes which have multiple reputations to work correctly
+						checkFactions = true
+						break
+
+					end
+
+				end
+
+			end
+
+			if ((recipeSkill > playerSkill) or (not checkFactions)) then

 				t.String = addon:Red(recStr)

@@ -2716,18 +2791,6 @@ function initDisplayStrings()

 			end

-			local sorttype = addon.db.profile.sorting
-
-			if (sorttype == L["Skill"]) then
-
-				t.String = "[" .. recipeSkill .. "] - " .. t.String
-
-			else
-
-				t.String = t.String .. " - [" .. recipeSkill .. "]"
-
-			end
-
 			t.sID = recipeIndex
 			t.IsRecipe = true
 			t.IsExpanded = false
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index bc2df22..14cab9f 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -372,20 +372,28 @@ end
 -- Output: None, array is referenced

 function addon:GetFactionLevels(RepTable)
+
 -- Bug here when I reload UI
 	if (not RepTable) then
+
 		return
+
 	end

 	for i=1,GetNumFactions(),1 do
+
 		local name,_,replevel = GetFactionInfo(i)

 		-- If the rep is greater than neutral
 		if (replevel > 4) then
-		-- We use levels of 0, 1, 2, 3, 4 internally for reputation levels, make it corrospond here
+
+			-- We use levels of 0, 1, 2, 3, 4 internally for reputation levels, make it corrospond here
 			RepTable[name] = replevel - 4
+
 		end
+
 	end
+
 end

 -- Description: Scans first 25 spellbook slots to identify all applicable professions
@@ -561,6 +569,7 @@ function addon:addTradeAcquire(RecipeDB, SpellID, ...)
 	local i = 1

 	while (i < numvars) do
+
 		-- Create the space for the current Acquire method
 		RecipeDB[SpellID]["Acquire"][index] = {}

@@ -582,7 +591,9 @@ function addon:addTradeAcquire(RecipeDB, SpellID, ...)
 		end

 		index = index + 1
+
 	end
+
 end

 -- Description: Adds a specific entry (ie: vendor, mob, etc) to the lookup list
@@ -1532,10 +1543,10 @@ do
 		else

 			if (DEBUG) then
-			self:Print("Debug: Found (known) Recipes: " .. playerData.foundRecipes)
-			self:Print("Debug: Total Recipes in Database: " .. playerData.totalRecipes)
-			self:Print("Debug: Filtered Recipes: " .. playerData.filteredRecipes)
-			self:Print("Debug: Other Recipes: " .. playerData.otherRecipes)
+				self:Print("Debug: Found (known) Recipes: " .. playerData.foundRecipes)
+				self:Print("Debug: Total Recipes in Database: " .. playerData.totalRecipes)
+				self:Print("Debug: Filtered Recipes: " .. playerData.filteredRecipes)
+				self:Print("Debug: Other Recipes: " .. playerData.otherRecipes)
 			end
 			self:CreateFrame(RecipeList, sortedindex, playerData, AllSpecialtiesTable,
 								TrainerList, VendorList, QuestList, ReputationList,
diff --git a/AckisRecipeList.toc b/AckisRecipeList.toc
index 6a3c27c..4b24e21 100644
--- a/AckisRecipeList.toc
+++ b/AckisRecipeList.toc
@@ -18,7 +18,7 @@
 ## X-Donate: Donate a few bucks/hours at your local animal shelter, or send me UDE Point codes, a Murky Code, or an account upgrade certificate.

 ## Interface: 30000
-## Version: Beta 5 r946
+## Version: Beta 5 r947
 ## X-Revision: $Rev$
 ## X-Date: $Date$