From 3af3855be65dea0d47550cffa7ff94cc0e30002d Mon Sep 17 00:00:00 2001 From: telkar-rg Date: Sat, 2 Dec 2023 23:43:14 +0100 Subject: [PATCH] variable rename --- Altoholic-Addon/Altoholic/LootTableSetup.lua | 6 +++--- .../DataStore_Crafts/DataStore_Crafts.lua | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Altoholic-Addon/Altoholic/LootTableSetup.lua b/Altoholic-Addon/Altoholic/LootTableSetup.lua index a951650..a8b0eec 100644 --- a/Altoholic-Addon/Altoholic/LootTableSetup.lua +++ b/Altoholic-Addon/Altoholic/LootTableSetup.lua @@ -4199,7 +4199,7 @@ db.lootTable = { } -local factionDuplicates = { +local recipeFactionDuplicates = { Alliance = { [4355] = {BZ["Hillsbrad Foothills"], format("%s: %s", L["Merchant"], "Micha Yance") }, -- Tailoring-Pattern: Icy Cloak [6401] = {BZ["Duskwood"], format("%s: %s", L["Merchant"], "Sheri Zipstitch") }, -- Tailoring-Pattern: Dark Silk Shirt @@ -4242,8 +4242,8 @@ local factionDuplicates = { local playerFaction = UnitFactionGroup("player") local zone,boss -if factionDuplicates[playerFaction] then - for k, v in pairs(factionDuplicates[playerFaction]) do +if recipeFactionDuplicates[playerFaction] then + for k, v in pairs(recipeFactionDuplicates[playerFaction]) do zone = v[1] boss = v[2] if zone and boss then diff --git a/Altoholic-Addon/DataStore_Crafts/DataStore_Crafts.lua b/Altoholic-Addon/DataStore_Crafts/DataStore_Crafts.lua index 0fcd23b..8eb9c84 100644 --- a/Altoholic-Addon/DataStore_Crafts/DataStore_Crafts.lua +++ b/Altoholic-Addon/DataStore_Crafts/DataStore_Crafts.lua @@ -485,12 +485,13 @@ local function ScanRecipes() local char = addon.ThisCharacter local profession = char.Professions[tradeskillName] - local crafts = profession.Crafts - wipe(crafts) + -- local crafts = profession.Crafts + -- wipe(crafts) + local crafts = {} - profession.FullLink = select(2, GetSpellLink(tradeskillName)) local NumCrafts = 0 + local NumHeaders = 0 local color, craftInfo, link for i = 1, GetNumTradeSkills() do @@ -499,6 +500,7 @@ local function ScanRecipes() if skillType == "header" then craftInfo = skillName or "" + NumHeaders = NumHeaders + 1 else link = GetTradeSkillRecipeLink(i) craftInfo = tonumber(link:match("enchant:(%d+)")) -- this actually extracts the spellID @@ -507,7 +509,15 @@ local function ScanRecipes() crafts[i] = color .. "|" .. craftInfo end - profession.NumCrafts = NumCrafts + if NumHeaders > 0 then -- only overwrite stored info if he have seen some headers (indicator that the whole profession is in game cache and the interface is shown in its entirety) + profession.FullLink = select(2, GetSpellLink(tradeskillName)) + profession.NumCrafts = NumCrafts + wipe(profession.Crafts) -- wipe old table (for memory saving) + profession.Crafts = crafts -- assign the valid new table + else + wipe(crafts) -- wipe unused table + print(format("|cffFFFF20%s|r:",addonName), "Profession not yet fully loaded.") + end end local function ScanTradeSkills()