Skip to content

Commit ba5b175

Browse files
LocalIdentityLocalIdentity
andauthored
Add Importing for Desecrated mods (#1198)
* Add Importing for Desecrated Mod Should be correct for the new league but may need to adjust some of the parsing for the mod text on items Also fixes a issue where we weren't adding the fracture text from items on the trade site * Change colour --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 923c6df commit ba5b175

File tree

6 files changed

+27
-5
lines changed

6 files changed

+27
-5
lines changed

src/Classes/ImportTab.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,7 @@ function ImportTabClass:ImportItem(itemData, slotName)
935935
item.mirrored = itemData.mirrored
936936
item.corrupted = itemData.corrupted
937937
item.fractured = itemData.fractured
938+
item.desecrated = itemData.desecrated
938939
if itemData.sockets and itemData.sockets[1] then
939940
item.sockets = { }
940941
item.itemSocketCount = 0
@@ -1006,6 +1007,14 @@ function ImportTabClass:ImportItem(itemData, slotName)
10061007
end
10071008
end
10081009
end
1010+
if itemData.desecratedMods then
1011+
for _, line in ipairs(itemData.desecratedMods) do
1012+
for line in line:gmatch("[^\n]+") do
1013+
local modList, extra = modLib.parseMod(line)
1014+
t_insert(item.explicitModLines, { line = line, extra = extra, mods = modList or { }, desecrated = true })
1015+
end
1016+
end
1017+
end
10091018

10101019
if itemData.grantedSkills then
10111020
for _, grantedSkillInfo in ipairs(itemData.grantedSkills) do

src/Classes/Item.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ local ItemClass = newClass("Item", function(self, raw, rarity, highQuality)
5757
end)
5858

5959
local lineFlags = {
60-
["custom"] = true, ["fractured"] = true, ["enchant"] = true, ["implicit"] = true, ["rune"] = true,
60+
["custom"] = true, ["fractured"] = true, ["desecrated"] = true, ["enchant"] = true, ["implicit"] = true, ["rune"] = true,
6161
}
6262

6363
-- Special function to store unique instances of modifier on specific item slots
@@ -383,6 +383,8 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
383383
self.corrupted = true
384384
elseif line == "Fractured Item" then
385385
self.fractured = true
386+
elseif line == "Desecrated Item" then
387+
self.desecrated = true
386388
elseif line == "Requirements:" then
387389
-- nothing to do
388390
else
@@ -1154,6 +1156,9 @@ function ItemClass:BuildRaw()
11541156
if modLine.fractured then
11551157
line = "{fractured}" .. line
11561158
end
1159+
if modLine.desecrated then
1160+
line = "{desecrated}" .. line
1161+
end
11571162
if modLine.variantList then
11581163
local varSpec
11591164
for varId in pairs(modLine.variantList) do

src/Classes/ItemsTab.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,9 +2605,6 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
26052605
else
26062606
tooltip:AddLine(20, rarityCode..item.namePrefix..item.baseName:gsub(" %(.+%)","")..item.nameSuffix)
26072607
end
2608-
if item.fractured then
2609-
tooltip:AddLine(16, colorCodes.FRACTURED.."Fractured Item")
2610-
end
26112608

26122609
tooltip:AddSeparator(10)
26132610

src/Classes/TradeQueryRequests.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ function TradeQueryRequestsClass:FetchResultBlock(url, callback)
377377
-- ensure these fields are initialised
378378
item.enchantMods = item.enchantMods or { }
379379
item.fracturedMods = item.fracturedMods or { }
380+
item.desecratedMods = item.desecratedMods or { }
380381
item.runeMods = item.runeMods or { }
381382
item.implicitMods = item.implicitMods or { }
382383
item.explicitMods = item.explicitMods or { }
@@ -397,6 +398,15 @@ function TradeQueryRequestsClass:FetchResultBlock(url, callback)
397398
for _, modLine in ipairs(item.explicitMods) do
398399
t_insert(rawLines, escapeGGGString(modLine))
399400
end
401+
for _, modLine in ipairs(item.desecratedMods) do
402+
t_insert(rawLines, "{desecrated}" .. escapeGGGString(modLine))
403+
end
404+
if item.fractured then
405+
t_insert(rawLines, "Fractured Item")
406+
end
407+
if item.desecrated then
408+
t_insert(rawLines, "Desecrated Item")
409+
end
400410
if item.mirrored then
401411
t_insert(rawLines, "Mirrored")
402412
end

src/Data/Global.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ colorCodes.ARMOUR = colorCodes.NORMAL
7676
colorCodes.EVASION = colorCodes.POSITIVE
7777
colorCodes.RAGE = colorCodes.WARNING
7878
colorCodes.PHYS = colorCodes.NORMAL
79+
colorCodes.DESECRATED = colorCodes.RELIC
7980

8081
defaultColorCodes = copyTable(colorCodes)
8182
function updateColorCode(code, color)

src/Modules/ItemTools.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ function itemLib.formatModLine(modLine, dbMode)
331331
line = line .. " ^1'" .. modLine.extra .. "'"
332332
end
333333
else
334-
colorCode = (modLine.enchant and colorCodes.ENCHANTED) or (modLine.fractured and colorCodes.FRACTURED) or (modLine.custom and colorCodes.CUSTOM) or colorCodes.MAGIC
334+
colorCode = (modLine.enchant and colorCodes.ENCHANTED) or (modLine.fractured and colorCodes.FRACTURED) or (modLine.desecrated and colorCodes.DESECRATED) or (modLine.custom and colorCodes.CUSTOM) or colorCodes.MAGIC
335335
end
336336
return colorCode..line
337337
end

0 commit comments

Comments
 (0)