Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion spec/System/TestItemParse_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ describe("TestItemParse", function()
assert.truthy(item.mirrored)
item = new("Item", raw("Corrupted"))
assert.truthy(item.corrupted)
item = new("Item", raw("Fractured Item"))
item = new("Item", raw("Leech 6.61% of Physical Attack Damage as Mana (fractured)"))
assert.truthy(item.fractured)
item = new("Item", raw("Adds 36 to 48 Fire Damage (desecrated)"))
assert.truthy(item.desecrated)
item = new("Item", raw("Crafted: true"))
assert.truthy(item.crafted)
item = new("Item", raw("Unreleased: true"))
Expand Down
Binary file added src/Assets/fractureditemsymbol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/Assets/veileditemsymbol.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions src/Classes/Item.lua
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
self.mirrored = true
elseif line == "Corrupted" then
self.corrupted = true
elseif line == "Fractured Item" then
self.fractured = true
elseif line == "Desecrated Item" then
elseif line == "Desecrated Prefix" or line == "Desecrated Suffix" then
self.desecrated = true
elseif line == "Requirements:" then
-- nothing to do
Expand Down Expand Up @@ -620,6 +618,12 @@ function ItemClass:ParseRaw(raw, rarity, highQuality)
if modLine.enchant then
modLine.implicit = true
end
if modLine.desecrated then
self.desecrated = true
end
if modLine.fractured then
self.fractured = true
end
local baseName
if not self.base and (self.rarity == "NORMAL" or self.rarity == "MAGIC") then
-- Exact match (affix-less magic and normal items)
Expand Down
22 changes: 22 additions & 0 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2585,6 +2585,27 @@ function ItemsTabClass:AddItemSetTooltip(tooltip, itemSet)
end
end

function ItemsTabClass:SetTooltipHeaderInfluence(tooltip, item)
tooltip.influenceHeader1 = nil
tooltip.influenceHeader2 = nil
-- Fractured items don't have the icon now, they did on trade before 0.3. Maybe they will return.
--if item.fractured then
-- tooltip.influenceHeader1 = "Fractured"
--end
if item.desecrated then
if not tooltip.influenceHeader1 then
tooltip.influenceHeader1 = "Desecrated"
else
tooltip.influenceHeader2 = "Desecrated"
end
end

-- If only one influence, we copy to second header. Preparing for dual influence mods like in first game.
if tooltip.influenceHeader1 and not tooltip.influenceHeader2 then
tooltip.influenceHeader2 = tooltip.influenceHeader1
end
end

function ItemsTabClass:FormatItemSource(text)
return text:gsub("unique{([^}]+)}",colorCodes.UNIQUE.."%1"..colorCodes.SOURCE)
:gsub("normal{([^}]+)}",colorCodes.NORMAL.."%1"..colorCodes.SOURCE)
Expand All @@ -2599,6 +2620,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
tooltip.tooltipHeader = item.rarity
tooltip.center = true
tooltip.color = rarityCode
self:SetTooltipHeaderInfluence(tooltip, item)
if item.title then
tooltip:AddLine(20, rarityCode..item.title)
tooltip:AddLine(20, rarityCode..item.baseName:gsub(" %(.+%)",""))
Expand Down
18 changes: 17 additions & 1 deletion src/Classes/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ function TooltipClass:Draw(x, y, w, h, viewPort)
ttW = titleW + 50
end
end
local headerInfluence = {
Fractured = "Assets/FracturedItemSymbol.png",
Desecrated = "Assets/VeiledItemSymbol.png",
}
local headerConfigs = {
RELIC = {left="Assets/ItemsHeaderFoilLeft.png",middle="Assets/ItemsHeaderFoilMiddle.png",right="Assets/ItemsHeaderFoilRight.png",height=56,sideWidth=43,middleWidth=43,textYOffset=2},
UNIQUE = {left="Assets/ItemsHeaderUniqueLeft.png",middle="Assets/ItemsHeaderUniqueMiddle.png",right="Assets/ItemsHeaderUniqueRight.png",height=56,sideWidth=43,middleWidth=43,textYOffset=2},
Expand Down Expand Up @@ -337,9 +341,18 @@ function TooltipClass:Draw(x, y, w, h, viewPort)
local headerY = ttY + BORDER_WIDTH
local headerTotalWidth = ttW - 2 * BORDER_WIDTH
local headerMiddleAreaWidth = m_max(0, headerTotalWidth - 2 * headerSideWidth)
if self.influenceHeader1 then
self.influenceIcon1 = NewImageHandle()
self.influenceIcon1:Load(headerInfluence[self.influenceHeader1])
self.influenceIcon2 = NewImageHandle()
self.influenceIcon2:Load(headerInfluence[self.influenceHeader2])
end

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

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

-- Draw right cap
DrawImage(self.headerRight, headerX + headerTotalWidth - headerSideWidth, headerY, headerSideWidth, headerHeight)
if self.influenceHeader2 then
DrawImage(self.influenceIcon2, headerX + headerTotalWidth - headerSideWidth+10, headerY+(headerHeight/4), headerSideWidth/2+6, headerHeight/2)
end
end

-- Draw lines and images
Expand Down
6 changes: 0 additions & 6 deletions src/Classes/TradeQueryRequests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,6 @@ function TradeQueryRequestsClass:FetchResultBlock(url, callback)
for _, modLine in ipairs(item.desecratedMods) do
t_insert(rawLines, "{desecrated}" .. escapeGGGString(modLine))
end
if item.fractured then
t_insert(rawLines, "Fractured Item")
end
if item.desecrated then
t_insert(rawLines, "Desecrated Item")
end
if item.mirrored then
t_insert(rawLines, "Mirrored")
end
Expand Down