diff --git a/ARLFrame.lua b/ARLFrame.lua
index 0d1e373..2a3ebc4 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -161,31 +161,33 @@ function addon:CloseWindow()
end
--- Description: Provides the total number of recipes for a specific profession minus the filtered ones
--- Expected result: An integer which will be used for the progress bar is provided
--- Input: Total recipes, total filtered, total found, and total from other professions
--- Output: Total recipeswithout the filtered ones for a given profession
+-- Description: Updates the progress bar based on the number of known / total recipes
+-- Expected result: the progression bar shows the correct information based on settings and filters
+-- Input: playerdata data structure
+-- Output: none
+local function SetProgressBar(playerData)
--- Description:
--- Expected result:
--- Input:
--- Output:
-
-local function GetFilteredRecipes(total, filtered, found, other)
+ local pbCur, pbMax
- local totalfiltered = filtered - other
- local actualfiltered = total - totalfiltered
- if (not addon.db.profile.filters.general.known) then
+ if (addon.db.profile.includefiltered == true) then
- return found + actualfiltered
+ pbCur = playerData.recipes_known
+ pbMax = playerData.recipes_total
+ -- We're removing filtered recipes from the final count
else
- return found
+ pbCur = playerData.recipes_known_filtered
+ pbMax = playerData.recipes_total_filtered
end
+ addon:Print("SetProgressBar:", addon.db.profile.includefiltered, playerData.recipes_known_filtered, "/", playerData.recipes_total_filtered, "-", playerData.recipes_known, "/", playerData.recipes_total, "-", playerData.foundRecipes, "/", playerData.totalRecipes)
+
+ ARL_ProgressBar:SetMinMaxValues(0, pbMax)
+ ARL_ProgressBar:SetValue(pbCur)
+ ARL_ProgressBarText:SetText(pbCur .. " / " .. pbMax .. " - " .. math.floor(pbCur / pbMax * 100) .. "%")
end
-- Under various conditions, I'm going to have to redisplay my recipe list
@@ -210,26 +212,7 @@ function ReDisplay()
initDisplayStrings()
- -- Update our progressbar
- local pbCur = playerData.foundRecipes
- local pbMin = 0
- local pbMax = 100
-
- -- Include filtered recipes in overall count, so we just display the total number of recipes
- if (addon.db.profile.includefiltered == true) then
-
- pbMax = playerData.totalRecipes
-
- -- We're removing filtered recipes from the final count
- else
-
- pbMax = GetFilteredRecipes(playerData.totalRecipes, playerData.filteredRecipes, playerData.foundRecipes, playerData.otherRecipes)
-
- end
-
- ARL_ProgressBar:SetMinMaxValues(pbMin, pbMax)
- ARL_ProgressBar:SetValue(pbCur)
- ARL_ProgressBarText:SetText(pbCur .. " / " .. pbMax .. " - " .. math.floor(pbCur / pbMax * 100) .. "%")
+ SetProgressBar(playerData)
-- Make sure our expand all button is set to expandall
ARL_ExpandButton:SetText(L["EXPANDALL"])
@@ -1840,17 +1823,17 @@ function RecipeList_Update()
else
-- If the recipe total is at 0, it means we have not scanned the profession yet
- if (playerData.totalRecipes == 0) then
+ if (playerData.recipes_total == 0) then
StaticPopup_Show("ARL_NOTSCANNED")
-- We know all the recipes
- elseif (playerData.foundRecipes == playerData.totalRecipes) then
+ elseif (playerData.recipes_known == playerData.recipes_total) then
StaticPopup_Show("ARL_ALLKNOWN")
-- Our filters are actually filtering something
- elseif ((playerData.totalRecipes - (playerData.filteredRecipes - playerData.otherRecipes)) > 0) then
+ elseif (playerData.recipes_total_filtered == 0) then
StaticPopup_Show("ARL_ALLFILTERED")
@@ -4034,21 +4017,7 @@ function addon:CreateFrame(
initDisplayStrings()
-- Update our progressbar
- pbCur = cPlayer.foundRecipes
-
- if (addon.db.profile.includefiltered == true) then
-
- pbMax = cPlayer.totalRecipes
-
- else
-
- pbMax = GetFilteredRecipes(cPlayer.totalRecipes, cPlayer.filteredRecipes, cPlayer.foundRecipes, cPlayer.otherRecipes)
-
- end
-
- ARL_ProgressBar:SetMinMaxValues(pbMin, pbMax)
- ARL_ProgressBar:SetValue(pbCur)
- ARL_ProgressBarText:SetText(pbCur .. " / " .. pbMax .. " - " .. math.floor(pbCur / pbMax * 100) .. "%")
+ SetProgressBar(cPlayer)
-- And update our scrollframe
RecipeList_Update()
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index b50ad1f..aecb8a3 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -897,16 +897,6 @@ do
return false
end
- -- Include known
- if (generaldb.known == false) and (Recipe["Known"] == true) then
- return false
- end
-
- -- Include unknown
- if (generaldb.unknown == false) and (Recipe["Known"] == false) then
- return false
- end
-
-- Display both horde and alliance factions?
if (generaldb.faction == false) then
@@ -1234,22 +1224,43 @@ function addon:UpdateFilters(RecipeDB, AllSpecialtiesTable, playerData)
playerData.filteredRecipes = 0
playerData.otherRecipes = 0
+ playerData.recipes_total = 0
+ playerData.recipes_known = 0
+ playerData.recipes_total_filtered = 0
+ playerData.recipes_known_filtered = 0
+
+ local displayflag = false
+
-- Parse through all the entries in the Recipe array
- for RecipeID in pairs(RecipeDB) do
+ for RecipeID, Recipe in pairs(RecipeDB) do
+
+ -- only interested in the current profession
+ if (Recipe["Profession"] == playerProfession) then
-- Determine if we are to display this recipe or not
- local displayflag = self:CheckDisplayRecipe(RecipeDB[RecipeID], AllSpecialtiesTable, playerProfessionLevel, playerProfession, playerSpecialty, playerFaction, playerClass)
+ displayflag = self:CheckDisplayRecipe(Recipe, AllSpecialtiesTable, playerProfessionLevel, playerProfession, playerSpecialty, playerFaction, playerClass)
- if (displayflag == false) then
+ playerData.recipes_total = playerData.recipes_total + 1
+ playerData.recipes_known = playerData.recipes_known + (Recipe["Known"] == true and 1 or 0)
- playerData.filteredRecipes = playerData.filteredRecipes + 1
+ if displayflag == true then
+ playerData.recipes_total_filtered = playerData.recipes_total_filtered + 1
+ playerData.recipes_known_filtered = playerData.recipes_known_filtered + (Recipe["Known"] == true and 1 or 0)
- end
+ -- Include known
+ if (addon.db.profile.filters.general.known == false) and (Recipe["Known"] == true) then
+ displayflag = false
+ end
- -- If the recipes aren't for the current profession, lets add it to the list
- if (RecipeDB[RecipeID]["Profession"] ~= playerProfession) then
+ -- Include unknown
+ if (addon.db.profile.filters.general.unknown == false) and (Recipe["Known"] == false) then
+ displayflag = false
+ end
+ end
+
+ else
- playerData.otherRecipes = playerData.otherRecipes + 1
+ displayflag = false
end