Quantcast

Fix weird colouring issues and the location sort crashing. Who's awesome? I'm awesome.

ackis [10-30-08 - 02:29]
Fix weird colouring issues and the location sort crashing.  Who's awesome? I'm awesome.
Filename
ARLFrame.lua
AckisRecipeList.lua
diff --git a/ARLFrame.lua b/ARLFrame.lua
index a7ac158..d1f1f79 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -214,7 +214,7 @@ end

 local function checkFactions(DB, recipeIndex, playerFaction, playerRep)

-	local fac = false
+	local fac = true

 	-- Scan through all acquire types
 	for i in pairs(DB[recipeIndex]["Acquire"]) do
@@ -1293,8 +1293,10 @@ function SetRecipeButtonTooltip (bIndex)

 				-- check if the recipe is excluded
 				if (exclude[rIndex] == true) then
+
 					clr1 = addon:hexcolor("RED")
 					gttAdd(0, -1, 1, 0, L["RECIPE_EXCLUDED"], clr1)
+
 				end

 				-- Add in skill level requirement, colored correctly
@@ -1563,15 +1565,25 @@ function SetRecipeButtonTooltip (bIndex)
 				local playerSkill = playerData.playerProfessionLevel

 				if (recipeSkill > playerSkill) then
+
 					clr2 = addon:hexcolor("RED")
+
 				elseif ((playerSkill - recipeSkill) < 20) then
+
 					clr2 = addon:hexcolor("ORANGE")
+
 				elseif ((playerSkill - recipeSkill) < 30) then
+
 					clr2 = addon:hexcolor("YELLOW")
+
 				elseif ((playerSkill - recipeSkill) < 40) then
-					clr2 = addon:hexcolor("GREEN")
+
+					clr2 = addon:hexcolor("GREEN")
+
 				else
+
 					clr2 = addon:hexcolor("MIDGREY")
+
 				end

 				gttAdd(0, -1, 0, 0, L["Required Skill"] .. " :", clr1, recipeDB[rIndex]["Level"], clr2)
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index 4bb27d1..e31a199 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -1448,11 +1448,19 @@ do
 			tsort(locationlist, function(a, b) return a < b end)

 			-- Return the list as a string
-			return tconcat(locationlist,",")
+			if (#locationlist == 0)then
+
+				return ""
+
+			else
+
+				return tconcat(locationlist,",")
+
+			end

 		else

-			return nil
+			return ""

 		end

@@ -1817,7 +1825,14 @@ do
 			-- Will only sort based off of the first acquire type
 			sortFuncs[L["Location"]] = function (a, b)

-				return (string.match(RecipeDB[a]["Locations"],"(%w+),") < string.match(RecipeDB[b]["Locations"],"(%w+),"))
+				-- We do the or "" because of nil's, I think this would be better if I just left it as a table which was returned
+				local reca = RecipeDB[a]["Locations"] or ""
+				local recb = RecipeDB[b]["Locations"] or ""
+
+				reca = string.match(reca,"(%w+),") or ""
+				recb = string.match(recb,"(%w+),") or ""
+
+				return (reca < recb)

 			end