diff --git a/DB/ItemCountDB.lua b/DB/ItemCountDB.lua index ca7c47e1..49780f41 100644 --- a/DB/ItemCountDB.lua +++ b/DB/ItemCountDB.lua @@ -29,6 +29,18 @@ function CraftSim.DB.ITEM_COUNT:Migrate() CraftSimDB.itemCountDB.data = CraftSimItemCountCache or {} CraftSimDB.itemCountDB.version = 1 end + + -- 1 -> 2 (16.1.2 -> 16.1.3) + if CraftSimDB.itemCountDB.version == 1 then + -- remove any crafter entries with colored names... + for crafterUID, _ in pairs(CraftSimDB.itemCountDB.data) do + if string.find(crafterUID, '\124c') then + CraftSimDB.itemCountDB.data[crafterUID] = nil + end + end + + CraftSimDB.itemCountDB.version = 2 + end end function CraftSim.DB.ITEM_COUNT:CleanUp() diff --git a/DB/craftQueueDB.lua b/DB/craftQueueDB.lua index afd58f47..b3d6162e 100644 --- a/DB/craftQueueDB.lua +++ b/DB/craftQueueDB.lua @@ -30,6 +30,11 @@ function CraftSim.DB.CRAFT_QUEUE:Migrate() end CraftSimDB.craftQueueDB.version = 1 end + -- 1 -> 2 (16.1.2 -> 16.1.3) + if CraftSimDB.craftQueueDB.version == 1 then + CraftSim.DB.CRAFT_QUEUE:ClearAll() + CraftSimDB.craftQueueDB.version = 2 + end end function CraftSim.DB.CRAFT_QUEUE:ClearAll() diff --git a/DB/crafterDB.lua b/DB/crafterDB.lua index 78eeff6d..51614a14 100644 --- a/DB/crafterDB.lua +++ b/DB/crafterDB.lua @@ -84,6 +84,17 @@ function CraftSim.DB.CRAFTER:Migrate() end CraftSimDB.crafterDB.version = 1 end + -- 1 -> 2 (16.1.2 -> 16.1.3) + if CraftSimDB.crafterDB.version == 1 then + -- remove any crafter entries with colored names... + for crafterUID, _ in pairs(CraftSimDB.crafterDB.data) do + if string.find(crafterUID, '\124c') then + CraftSimDB.crafterDB.data[crafterUID] = nil + end + end + + CraftSimDB.crafterDB.version = 2 + end end ---@param crafterUID CrafterUID @@ -93,7 +104,7 @@ function CraftSim.DB.CRAFTER:AddCachedRecipeID(crafterUID, profession, recipeID) CraftSimDB.crafterDB.data[crafterUID] = CraftSimDB.crafterDB.data[crafterUID] or {} CraftSimDB.crafterDB.data[crafterUID].cachedRecipeIDs = CraftSimDB.crafterDB.data[crafterUID].cachedRecipeIDs or {} CraftSimDB.crafterDB.data[crafterUID].cachedRecipeIDs[profession] = CraftSimDB.crafterDB.data[crafterUID] - .cachedRecipeIDs[profession] or {} + .cachedRecipeIDs[profession] or {} if not tContains(CraftSimDB.crafterDB.data[crafterUID].cachedRecipeIDs[profession], recipeID) then tinsert(CraftSimDB.crafterDB.data[crafterUID].cachedRecipeIDs[profession], recipeID) diff --git a/DB/itemOptimizedCostsDB.lua b/DB/itemOptimizedCostsDB.lua index c4294216..a8ed691b 100644 --- a/DB/itemOptimizedCostsDB.lua +++ b/DB/itemOptimizedCostsDB.lua @@ -42,6 +42,20 @@ function CraftSim.DB.ITEM_OPTIMIZED_COSTS:Migrate() end CraftSimDB.itemOptimizedCostsDB.version = 1 end + + -- 1 -> 2 (16.1.2 -> 16.1.3) + if CraftSimDB.itemOptimizedCostsDB.version == 1 then + -- remove any crafter entries with colored names... + for _, data in pairs(CraftSimDB.itemOptimizedCostsDB.data) do + for crafterUID, _ in pairs(data) do + if string.find(crafterUID, '\124c') then + data[crafterUID] = nil + end + end + end + + CraftSimDB.itemOptimizedCostsDB.version = 2 + end end function CraftSim.DB.ITEM_OPTIMIZED_COSTS:ClearAll() diff --git a/DB/itemRecipeDB.lua b/DB/itemRecipeDB.lua index 4c33ebbe..b69616a0 100644 --- a/DB/itemRecipeDB.lua +++ b/DB/itemRecipeDB.lua @@ -37,6 +37,22 @@ function CraftSim.DB.ITEM_RECIPE:Migrate() end CraftSimDB.itemRecipeDB.version = 1 end + + -- 1 -> 2 (16.1.2 -> 16.1.3) + if CraftSimDB.itemRecipeDB.version == 1 then + -- remove any crafter entries with colored names... + for _, data in pairs(CraftSimDB.itemRecipeDB.data) do + local correctedCrafterUIDs = {} + for _, crafterUID in pairs(data.crafters) do + if not string.find(crafterUID, '\124c') then + tinsert(correctedCrafterUIDs, crafterUID) + end + end + data.crafters = correctedCrafterUIDs + end + + CraftSimDB.itemRecipeDB.version = 2 + end end function CraftSim.DB.ITEM_RECIPE:ClearAll() diff --git a/DB/recipeSubCrafterDB.lua b/DB/recipeSubCrafterDB.lua index d46ff743..bfe7abf5 100644 --- a/DB/recipeSubCrafterDB.lua +++ b/DB/recipeSubCrafterDB.lua @@ -31,6 +31,18 @@ function CraftSim.DB.RECIPE_SUB_CRAFTER:Migrate() end CraftSimDB.recipeSubCrafterDB.version = 1 end + + -- 1 -> 2 (16.1.2 -> 16.1.3) + if CraftSimDB.recipeSubCrafterDB.version == 1 then + -- remove any crafter entries with colored names... + for itemID, crafterUID in pairs(CraftSimDB.recipeSubCrafterDB.data) do + if string.find(crafterUID, '\124c') then + CraftSimDB.recipeSubCrafterDB.data[itemID] = nil + end + end + + CraftSimDB.recipeSubCrafterDB.version = 2 + end end function CraftSim.DB.RECIPE_SUB_CRAFTER:ClearAll() diff --git a/Modules/RecipeScan/Frames.lua b/Modules/RecipeScan/Frames.lua index 63db1cba..e3ada3b7 100644 --- a/Modules/RecipeScan/Frames.lua +++ b/Modules/RecipeScan/Frames.lua @@ -554,7 +554,7 @@ function CraftSim.RECIPE_SCAN.FRAMES:AddProfessionTabRow(crafterUID, profession) local crafterClass = CraftSim.DB.CRAFTER:GetClass(crafterUID) local crafterName, crafterRealm = strsplit("-", crafterUID) - crafterName = f.class(crafterName, crafterClass) + local coloredCrafterName = f.class(crafterName, crafterClass) local professionIconSize = 20 local professionIcon = GUTIL:IconToText(CraftSim.CONST.PROFESSION_ICONS[row.profession], professionIconSize, professionIconSize) @@ -566,7 +566,7 @@ function CraftSim.RECIPE_SCAN.FRAMES:AddProfessionTabRow(crafterUID, profession) } -- todo: add profession icon prefix - crafterColumn.text:SetText(professionIcon .. " " .. crafterName) + crafterColumn.text:SetText(professionIcon .. " " .. coloredCrafterName) ---@type Enum.Profession ---@type CraftSim.CrafterData row.crafterData = { @@ -599,7 +599,7 @@ function CraftSim.RECIPE_SCAN.FRAMES:AddProfessionTabRow(crafterUID, profession) row.content = CraftSim.RECIPE_SCAN.FRAMES:CreateProfessionTabContent(row, row.contentFrame.content) - row.content.recipeTitle:SetText(professionIcon .. " " .. crafterName) + row.content.recipeTitle:SetText(professionIcon .. " " .. coloredCrafterName) end) end