diff --git a/spec/System/TestItemParse_spec.lua b/spec/System/TestItemParse_spec.lua index 701669e31d..011e9bdf51 100644 --- a/spec/System/TestItemParse_spec.lua +++ b/spec/System/TestItemParse_spec.lua @@ -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")) diff --git a/src/Assets/fractureditemsymbol.png b/src/Assets/fractureditemsymbol.png new file mode 100644 index 0000000000..afba72d563 Binary files /dev/null and b/src/Assets/fractureditemsymbol.png differ diff --git a/src/Assets/veileditemsymbol.png b/src/Assets/veileditemsymbol.png new file mode 100644 index 0000000000..a4b719299f Binary files /dev/null and b/src/Assets/veileditemsymbol.png differ diff --git a/src/Classes/Item.lua b/src/Classes/Item.lua index cb64807672..dbb9fffb3a 100644 --- a/src/Classes/Item.lua +++ b/src/Classes/Item.lua @@ -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 @@ -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) diff --git a/src/Classes/ItemsTab.lua b/src/Classes/ItemsTab.lua index 44f9ec1fad..078684bd50 100644 --- a/src/Classes/ItemsTab.lua +++ b/src/Classes/ItemsTab.lua @@ -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) @@ -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(" %(.+%)","")) diff --git a/src/Classes/Tooltip.lua b/src/Classes/Tooltip.lua index 322dbdc697..bff02c6ebe 100644 --- a/src/Classes/Tooltip.lua +++ b/src/Classes/Tooltip.lua @@ -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}, @@ -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 @@ -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 diff --git a/src/Classes/TradeQueryRequests.lua b/src/Classes/TradeQueryRequests.lua index 53050423ab..92f4f23d8d 100644 --- a/src/Classes/TradeQueryRequests.lua +++ b/src/Classes/TradeQueryRequests.lua @@ -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