Skip to content

Commit f853b0d

Browse files
authored
Show Influence icons on item headers (#1199)
* Show Influence icons on item headers * Comment out fractured icon, get new desecrated icon * Remove Old Image * Set self.desecrated item if the item has an unveiled desecrated mod * Fix copy paste not showing icons
1 parent bd4089a commit f853b0d

7 files changed

Lines changed: 49 additions & 11 deletions

File tree

spec/System/TestItemParse_spec.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ describe("TestItemParse", function()
146146
assert.truthy(item.mirrored)
147147
item = new("Item", raw("Corrupted"))
148148
assert.truthy(item.corrupted)
149-
item = new("Item", raw("Fractured Item"))
149+
item = new("Item", raw("Leech 6.61% of Physical Attack Damage as Mana (fractured)"))
150150
assert.truthy(item.fractured)
151+
item = new("Item", raw("Adds 36 to 48 Fire Damage (desecrated)"))
152+
assert.truthy(item.desecrated)
151153
item = new("Item", raw("Crafted: true"))
152154
assert.truthy(item.crafted)
153155
item = new("Item", raw("Unreleased: true"))

src/Assets/fractureditemsymbol.png

2.39 KB
Loading

src/Assets/veileditemsymbol.png

5.16 KB
Loading

src/Classes/Item.lua

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
381381
self.mirrored = true
382382
elseif line == "Corrupted" then
383383
self.corrupted = true
384-
elseif line == "Fractured Item" then
385-
self.fractured = true
386-
elseif line == "Desecrated Item" then
384+
elseif line == "Desecrated Prefix" or line == "Desecrated Suffix" then
387385
self.desecrated = true
388386
elseif line == "Requirements:" then
389387
-- nothing to do
@@ -620,6 +618,12 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
620618
if modLine.enchant then
621619
modLine.implicit = true
622620
end
621+
if modLine.desecrated then
622+
self.desecrated = true
623+
end
624+
if modLine.fractured then
625+
self.fractured = true
626+
end
623627
local baseName
624628
if not self.base and (self.rarity == "NORMAL" or self.rarity == "MAGIC") then
625629
-- Exact match (affix-less magic and normal items)

src/Classes/ItemsTab.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,6 +2585,27 @@ function ItemsTabClass:AddItemSetTooltip(tooltip, itemSet)
25852585
end
25862586
end
25872587

2588+
function ItemsTabClass:SetTooltipHeaderInfluence(tooltip, item)
2589+
tooltip.influenceHeader1 = nil
2590+
tooltip.influenceHeader2 = nil
2591+
-- Fractured items don't have the icon now, they did on trade before 0.3. Maybe they will return.
2592+
--if item.fractured then
2593+
-- tooltip.influenceHeader1 = "Fractured"
2594+
--end
2595+
if item.desecrated then
2596+
if not tooltip.influenceHeader1 then
2597+
tooltip.influenceHeader1 = "Desecrated"
2598+
else
2599+
tooltip.influenceHeader2 = "Desecrated"
2600+
end
2601+
end
2602+
2603+
-- If only one influence, we copy to second header. Preparing for dual influence mods like in first game.
2604+
if tooltip.influenceHeader1 and not tooltip.influenceHeader2 then
2605+
tooltip.influenceHeader2 = tooltip.influenceHeader1
2606+
end
2607+
end
2608+
25882609
function ItemsTabClass:FormatItemSource(text)
25892610
return text:gsub("unique{([^}]+)}",colorCodes.UNIQUE.."%1"..colorCodes.SOURCE)
25902611
:gsub("normal{([^}]+)}",colorCodes.NORMAL.."%1"..colorCodes.SOURCE)
@@ -2599,6 +2620,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
25992620
tooltip.tooltipHeader = item.rarity
26002621
tooltip.center = true
26012622
tooltip.color = rarityCode
2623+
self:SetTooltipHeaderInfluence(tooltip, item)
26022624
if item.title then
26032625
tooltip:AddLine(20, rarityCode..item.title)
26042626
tooltip:AddLine(20, rarityCode..item.baseName:gsub(" %(.+%)",""))

src/Classes/Tooltip.lua

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ function TooltipClass:Draw(x, y, w, h, viewPort)
265265
ttW = titleW + 50
266266
end
267267
end
268+
local headerInfluence = {
269+
Fractured = "Assets/FracturedItemSymbol.png",
270+
Desecrated = "Assets/VeiledItemSymbol.png",
271+
}
268272
local headerConfigs = {
269273
RELIC = {left="Assets/ItemsHeaderFoilLeft.png",middle="Assets/ItemsHeaderFoilMiddle.png",right="Assets/ItemsHeaderFoilRight.png",height=56,sideWidth=43,middleWidth=43,textYOffset=2},
270274
UNIQUE = {left="Assets/ItemsHeaderUniqueLeft.png",middle="Assets/ItemsHeaderUniqueMiddle.png",right="Assets/ItemsHeaderUniqueRight.png",height=56,sideWidth=43,middleWidth=43,textYOffset=2},
@@ -337,9 +341,18 @@ function TooltipClass:Draw(x, y, w, h, viewPort)
337341
local headerY = ttY + BORDER_WIDTH
338342
local headerTotalWidth = ttW - 2 * BORDER_WIDTH
339343
local headerMiddleAreaWidth = m_max(0, headerTotalWidth - 2 * headerSideWidth)
344+
if self.influenceHeader1 then
345+
self.influenceIcon1 = NewImageHandle()
346+
self.influenceIcon1:Load(headerInfluence[self.influenceHeader1])
347+
self.influenceIcon2 = NewImageHandle()
348+
self.influenceIcon2:Load(headerInfluence[self.influenceHeader2])
349+
end
340350

341-
-- Draw left cap
351+
-- Draw left cap first, then influence icon on top
342352
DrawImage(self.headerLeft, headerX, headerY, headerSideWidth, headerHeight)
353+
if self.influenceHeader1 then
354+
DrawImage(self.influenceIcon1, headerX+5, headerY+(headerHeight/4), headerSideWidth/2+6, headerHeight/2)
355+
end
343356

344357
-- Draw middle fill
345358
if headerMiddleAreaWidth > 0 then
@@ -357,6 +370,9 @@ function TooltipClass:Draw(x, y, w, h, viewPort)
357370

358371
-- Draw right cap
359372
DrawImage(self.headerRight, headerX + headerTotalWidth - headerSideWidth, headerY, headerSideWidth, headerHeight)
373+
if self.influenceHeader2 then
374+
DrawImage(self.influenceIcon2, headerX + headerTotalWidth - headerSideWidth+10, headerY+(headerHeight/4), headerSideWidth/2+6, headerHeight/2)
375+
end
360376
end
361377

362378
-- Draw lines and images

src/Classes/TradeQueryRequests.lua

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,6 @@ function TradeQueryRequestsClass:FetchResultBlock(url, callback)
401401
for _, modLine in ipairs(item.desecratedMods) do
402402
t_insert(rawLines, "{desecrated}" .. escapeGGGString(modLine))
403403
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
410404
if item.mirrored then
411405
t_insert(rawLines, "Mirrored")
412406
end

0 commit comments

Comments
 (0)