Skip to content

Commit 6694a55

Browse files
Blitz54LocalIdentity
andauthored
Add Desecrated mods to Custom modifiers dropdown (#1773)
* Add Desecrated mods to Custom modifiers dropdown * Show the remove button for the desecrated custom mod * Fix desecrated specific mods not showing up for maces and other weapons Some of the desecrated only mods weren't correctly looking through the spawn tags Also now doesn't use the existance of an essence mod for the desecrated mod pool to show up --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 8bcdb49 commit 6694a55

2 files changed

Lines changed: 62 additions & 2 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2838,18 +2838,73 @@ function ItemsTabClass:AddCustomModifierToDisplayItem()
28382838
return a.essence.tierLevel > b.essence.tierLevel
28392839
end
28402840
end)
2841+
elseif sourceId == "DESECRATED" then
2842+
local function isDesecratedMod(mod)
2843+
for _, tag in ipairs(mod.modTags or { }) do
2844+
if tag == "ulaman_mod" or tag == "amanamu_mod" or tag == "kurgal_mod" then
2845+
return true
2846+
end
2847+
end
2848+
end
2849+
for _, mod in pairs(self.displayItem.affixes) do -- Normal mods for the item can be desecrated as well.
2850+
if (mod.type == "Prefix" or mod.type == "Suffix") and self.displayItem:GetModSpawnWeight(mod) > 0 then
2851+
t_insert(modList, {
2852+
label = mod.affix .. " ^8[" .. table.concat(mod, "/") .. "]",
2853+
mod = mod,
2854+
type = "desecrated",
2855+
})
2856+
end
2857+
end
2858+
for _, mod in pairs(self.build.data.itemMods.Desecrated) do
2859+
if isDesecratedMod(mod) and self.displayItem:GetModSpawnWeight(mod) > 0 then
2860+
t_insert(modList, {
2861+
label = mod.affix .. " " .. "^8[" .. table.concat(mod, "/") .. "]" .. " (" .. (mod.type or "Suffix") .. ") (Desecrated)",
2862+
mod = mod,
2863+
type = "desecrated",
2864+
desecratedSpecific = true,
2865+
})
2866+
end
2867+
end
2868+
table.sort(modList, function(a, b)
2869+
local modA = a.mod
2870+
local modB = b.mod
2871+
2872+
-- Desecrated specific mods always come first
2873+
if a.desecratedSpecific ~= b.desecratedSpecific then
2874+
return a.desecratedSpecific == true
2875+
end
2876+
2877+
for i = 1, m_max(#modA.statOrder or 0, #modB.statOrder or 0) do
2878+
local statA = modA.statOrder and modA.statOrder[i]
2879+
local statB = modB.statOrder and modB.statOrder[i]
2880+
2881+
if not statA then
2882+
return true
2883+
elseif not statB then
2884+
return false
2885+
elseif statA ~= statB then
2886+
return statA < statB
2887+
end
2888+
end
2889+
return (modA.level or 0) > (modB.level or 0)
2890+
end)
28412891
end
28422892
setDefaultSortOrder(modList)
28432893
end
28442894
if not self.displayItem.crafted then
28452895
t_insert(sourceList, { label = "Prefix", sourceId = "PREFIX" })
28462896
t_insert(sourceList, { label = "Suffix", sourceId = "SUFFIX" })
28472897
end
2848-
buildMods("ESSENCE") -- This is technically a waste if there aren't any essence mods,
2898+
buildMods("DESECRATED")
2899+
local hasDesecratedMods = #modList > 0
2900+
buildMods("ESSENCE") -- This is technically a waste if there aren't any essence mods,
28492901
-- but it makes it so we don't have to maintain a list of applicable essence-able base types
28502902
if #modList > 0 then
28512903
t_insert(sourceList, { label = "Essence", sourceId = "ESSENCE" })
28522904
end
2905+
if hasDesecratedMods then
2906+
t_insert(sourceList, { label = "Desecrated", sourceId = "DESECRATED" })
2907+
end
28532908
t_insert(sourceList, { label = "Custom", sourceId = "CUSTOM" })
28542909
buildMods(sourceList[1].sourceId)
28552910
local function addModifier()
@@ -2860,6 +2915,11 @@ function ItemsTabClass:AddCustomModifierToDisplayItem()
28602915
if controls.custom.buf:match("%S") then
28612916
t_insert(item.explicitModLines, { line = controls.custom.buf, custom = true })
28622917
end
2918+
elseif sourceId == "DESECRATED" then
2919+
local listMod = modList[controls.modSelect.selIndex]
2920+
for _, line in ipairs(listMod.mod) do
2921+
t_insert(item.explicitModLines, { line = line, modTags = listMod.mod.modTags, [listMod.type] = true, custom = true })
2922+
end
28632923
else
28642924
local listMod = modList[controls.modSelect.selIndex]
28652925
for _, line in ipairs(listMod.mod) do

src/Modules/ItemTools.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ function itemLib.formatModLine(modLine, dbMode)
335335
line = line .. " ^1'" .. modLine.extra .. "'"
336336
end
337337
else
338-
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
338+
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
339339
end
340340
return colorCode..line
341341
end

0 commit comments

Comments
 (0)