From 0bb0afe8db1ea6c80edc9050261567f8e9fb7c56 Mon Sep 17 00:00:00 2001 From: torhal Date: Fri, 18 Dec 2009 06:19:57 +0000 Subject: [PATCH] Fixed value bug in the tooltip hook: If a scan had not been performed, skill level data for the given profession would be a boolean instead of a number - now this is treated as 0 skill. In addon:Scan(): Added an is_refresh parameter and some state-saving/comparison for number of recipes known. This ensures that we only refresh the displayed list when a new recipe is learned. Previously, this was occurring every time TRADE_SKILL_UPDATE was fired, which appears to have the ability to be broadcast from other players. --- ARL.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ARL.lua b/ARL.lua index 582818a..14deba6 100644 --- a/ARL.lua +++ b/ARL.lua @@ -503,7 +503,7 @@ function addon:OnInitialize() for spell_id in pairs(vendor["SellList"]) do local recipe = RecipeList[spell_id] local skill_level = Player["Professions"][GetSpellInfo(recipe["Profession"])] - local has_skill = skill_level and skill_level >= recipe["Level"] + local has_skill = skill_level and (type(skill_level) == "boolean" and true or skill_level >= recipe["Level"]) if ((not recipe["Known"] and has_skill) or shifted) and Player:IsCorrectFaction(recipe["Flags"]) then local _, _, _, hex = GetItemQualityColor(recipe["Rarity"]) @@ -797,7 +797,7 @@ do last_update = last_update + elapsed if last_update >= 0.5 then - addon:Scan(false) + addon:Scan(false, true) self:Hide() end end) @@ -1485,7 +1485,7 @@ do -- @usage AckisRecipeList:Scan(true) -- @param textdump Boolean indicating if we want the output to be a text dump, or if we want to use the ARL GUI. -- @return A frame with either the text dump, or the ARL frame. - function addon:Scan(textdump) + function addon:Scan(textdump, is_refresh) local scan_parent = self.scan_button:GetParent() -- The scan button is re-parented to whichever interface it's anchored to, whether it's TradeSkillFrame or a replacement AddOn, @@ -1596,9 +1596,13 @@ do end end end - -- TODO: Figure out what this variable was supposed to be for - it isn't used anywhere. -Torhal + Player.prev_count = Player.foundRecipes Player.foundRecipes = recipes_found + if is_refresh and Player.prev_count == recipes_found then + return + end + self:UpdateFilters() Player:MarkExclusions() -- 1.7.9.5