diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 5a2b9aa8f..9208f70df 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -2624,16 +2624,65 @@ function ItemsTabClass:AddCustomModifierToDisplayItem() return a.essence.tierLevel > b.essence.tierLevel end end) + elseif sourceId == "DESECRATED" then + for _, mod in pairs(self.displayItem.affixes) do -- Normal mods for the item can be desecrated as well. + if (mod.type == "Prefix" or mod.type == "Suffix") and self.displayItem:GetModSpawnWeight(mod) > 0 then + t_insert(modList, { + label = mod.affix .. " ^8[" .. table.concat(mod, "/") .. "]", + mod = mod, + type = "desecrated", + }) + end + end + for modId, mod in pairs(self.build.data.itemMods.Desecrated) do + for _, weightKey in pairs(mod.weightKey) do + local tag_name = weightKey:lower() + local item_type = self.displayItem.type:lower():gsub(" ", "_") + if tag_name == item_type then + t_insert(modList, { + label = mod.affix .. " " .. "^8[" .. table.concat(mod, "/") .. "]" .. " (" .. (mod.type or "Suffix") .. ") (Desecrated)", + mod = mod, + type = "desecrated", + desecratedSpecific = true, + }) + end + end + end + table.sort(modList, function(a, b) + local modA = a.mod + local modB = b.mod + + -- Desecrated specific mods always come first + if a.desecratedSpecific ~= b.desecratedSpecific then + return a.desecratedSpecific == true + end + + for i = 1, m_max(#modA.statOrder or 0, #modB.statOrder or 0) do + local statA = modA.statOrder and modA.statOrder[i] + local statB = modB.statOrder and modB.statOrder[i] + + if not statA then + return true + elseif not statB then + return false + elseif statA ~= statB then + return statA < statB + end + end + return (modA.level or 0) > (modB.level or 0) + end) end end if not self.displayItem.crafted then t_insert(sourceList, { label = "Prefix", sourceId = "PREFIX" }) t_insert(sourceList, { label = "Suffix", sourceId = "SUFFIX" }) end - buildMods("ESSENCE") -- This is technically a waste if there aren't any essence mods, + buildMods("DESECRATED") + buildMods("ESSENCE") -- This is technically a waste if there aren't any essence mods, -- but it makes it so we don't have to maintain a list of applicable essence-able base types if #modList > 0 then t_insert(sourceList, { label = "Essence", sourceId = "ESSENCE" }) + t_insert(sourceList, { label = "Desecrated", sourceId = "DESECRATED" }) end t_insert(sourceList, { label = "Custom", sourceId = "CUSTOM" }) buildMods(sourceList[1].sourceId) @@ -2645,6 +2694,11 @@ function ItemsTabClass:AddCustomModifierToDisplayItem() if controls.custom.buf:match("%S") then t_insert(item.explicitModLines, { line = controls.custom.buf, custom = true }) end + elseif sourceId == "DESECRATED" then + local listMod = modList[controls.modSelect.selIndex] + for _, line in ipairs(listMod.mod) do + t_insert(item.explicitModLines, { line = line, modTags = listMod.mod.modTags, [listMod.type] = true, custom = true }) + end else local listMod = modList[controls.modSelect.selIndex] for _, line in ipairs(listMod.mod) do diff --git a/src/Modules/Data.lua b/src/Modules/Data.lua index a92579ce6..340d52861 100644 --- a/src/Modules/Data.lua +++ b/src/Modules/Data.lua @@ -622,7 +622,8 @@ data.itemMods = { Jewel = LoadModule("Data/ModJewel"), Corruption = LoadModule("Data/ModCorrupted"), Runes = LoadModule("Data/ModRunes"), - Exclusive = LoadModule("Data/ModItemExclusive") + Exclusive = LoadModule("Data/ModItemExclusive"), + Desecrated = LoadModule("Data/ModVeiled") } -- update JewelRadius affixes for Time-Lost jewels diff --git a/src/Modules/ItemTools.lua b/src/Modules/ItemTools.lua index a013bbd7c..c607c1663 100644 --- a/src/Modules/ItemTools.lua +++ b/src/Modules/ItemTools.lua @@ -331,7 +331,7 @@ function itemLib.formatModLine(modLine, dbMode) line = line .. " ^1'" .. modLine.extra .. "'" end else - colorCode = (modLine.enchant and colorCodes.ENCHANTED) or (modLine.fractured and colorCodes.FRACTURED) or (modLine.mutated and colorCodes.MUTATED) or (modLine.custom and colorCodes.CUSTOM) or colorCodes.MAGIC + colorCode = (modLine.enchant and colorCodes.ENCHANTED) or (modLine.fractured and colorCodes.FRACTURED) or (modLine.mutated and colorCodes.MUTATED) or (modLine.custom and (not modLine.desecrated and colorCodes.CUSTOM)) or colorCodes.MAGIC end return colorCode..line end