Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Mod Tooltip #5203

Merged
Merged
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
165 changes: 115 additions & 50 deletions src/Classes/ItemsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -655,56 +655,6 @@ holding Shift will put it in the second.]])
if mod.modTags and #mod.modTags > 0 then
tooltip:AddLine(16, "Tags: "..table.concat(mod.modTags, ', '))
end

local notableName = mod[1] and mod[1]:match("1 Added Passive Skill is (.*)")
local node = notableName and self.build.spec.tree.clusterNodeMap[notableName]
if node then
tooltip:AddSeparator(14)

-- Node name
self.socketViewer:AddNodeName(tooltip, node, self.build)

-- Node description
if node.sd[1] then
tooltip:AddLine(16, "")
for i, line in ipairs(node.sd) do
tooltip:AddLine(16, ((node.mods[i].extra or not node.mods[i].list) and colorCodes.UNSUPPORTED or colorCodes.MAGIC)..line)
end
end

-- Reminder text
if node.reminderText then
tooltip:AddSeparator(14)
for _, line in ipairs(node.reminderText) do
tooltip:AddLine(14, "^xA0A080"..line)
end
end

-- Comparison
tooltip:AddSeparator(14)
self:AppendAnointTooltip(tooltip, node, "Allocating")

-- Information of for this notable appears
local clusterInfo = self.build.data.clusterJewelInfoForNotable[notableName]
if clusterInfo then
tooltip:AddSeparator(14)
tooltip:AddLine(20, "^7"..notableName.." can appear on:")
local isFirstSize = true
for size, v in pairs(clusterInfo.size) do
tooltip:AddLine(18, colorCodes.MAGIC..size..":")
local sizeSkills = self.build.data.clusterJewels.jewels[size].skills
for i, type in ipairs(clusterInfo.jewelTypes) do
if sizeSkills[type] then
tooltip:AddLine(14, "^7 "..sizeSkills[type].name)
end
end
if not isFirstSize then
tooltip:AddLine(10, "")
end
isFirstSize = false
end
end
end
else
tooltip:AddLine(16, "^7"..#modList.." Tiers")
local minMod = self.displayItem.affixes[modList[1]]
Expand Down Expand Up @@ -733,6 +683,66 @@ holding Shift will put it in the second.]])
tooltip:AddLine(16, "Tags: "..table.concat(maxMod.modTags, ', '))
end
end
local mod = self.displayItem.affixes[value.modId or modList[1]]
local notableName = mod[1] and mod[1]:match("1 Added Passive Skill is (.*)")
local node = notableName and self.build.spec.tree.clusterNodeMap[notableName]
if node then
tooltip:AddSeparator(14)

-- Node name
self.socketViewer:AddNodeName(tooltip, node, self.build)

-- Node description
if node.sd[1] then
tooltip:AddLine(16, "")
for i, line in ipairs(node.sd) do
tooltip:AddLine(16, ((node.mods[i].extra or not node.mods[i].list) and colorCodes.UNSUPPORTED or colorCodes.MAGIC)..line)
end
end

-- Reminder text
if node.reminderText then
tooltip:AddSeparator(14)
for _, line in ipairs(node.reminderText) do
tooltip:AddLine(14, "^xA0A080"..line)
end
end

-- Comparison
tooltip:AddSeparator(14)
self:AppendAnointTooltip(tooltip, node, "Allocating")

-- Information of for this notable appears
local clusterInfo = self.build.data.clusterJewelInfoForNotable[notableName]
if clusterInfo then
tooltip:AddSeparator(14)
tooltip:AddLine(20, "^7"..notableName.." can appear on:")
local isFirstSize = true
for size, v in pairs(clusterInfo.size) do
tooltip:AddLine(18, colorCodes.MAGIC..size..":")
local sizeSkills = self.build.data.clusterJewels.jewels[size].skills
for i, type in ipairs(clusterInfo.jewelTypes) do
if sizeSkills[type] then
tooltip:AddLine(14, "^7 "..sizeSkills[type].name)
end
end
if not isFirstSize then
tooltip:AddLine(10, "")
end
isFirstSize = false
end
end
else
local mod = { }
if value.modId or #modList == 1 then
mod = self.displayItem.affixes[value.modId or modList[1]]
else
mod = self.displayItem.affixes[modList[1 + round((#modList - 1) * main.defaultItemAffixQuality)]]
end

-- Adding Mod
self:AddModComparisonTooltip(tooltip, mod)
end
end
end
drop.shown = function()
Expand Down Expand Up @@ -1695,6 +1705,22 @@ function ItemsTabClass:UpdateDisplayItemRangeLines()
end
end

function ItemsTabClass:AddModComparisonTooltip(tooltip, mod)
local slotName = self.displayItem:GetPrimarySlot()
local newItem = new("Item", self.displayItem:BuildRaw())

for _, subMod in ipairs(mod) do
t_insert(newItem.explicitModLines, { line = subMod, modTags = mod.modTags, [mod.type] = true })
end

newItem:BuildAndParseRaw()

local calcFunc = self.build.calcsTab:GetMiscCalculator()
local outputBase = calcFunc({ repSlotName = slotName, repItem = self.displayItem }, {})
local outputNew = calcFunc({ repSlotName = slotName, repItem = newItem }, {})
self.build:AddStatComparesToTooltip(tooltip, outputBase, outputNew, "\nAdding this mod will give: ")
end

-- Returns the first slot in which the given item is equipped
function ItemsTabClass:GetEquippedSlotForItem(item)
for _, slot in ipairs(self.orderedSlots) do
Expand Down Expand Up @@ -2242,20 +2268,56 @@ function ItemsTabClass:CorruptDisplayItem(modType)
controls.implicit = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 80, 45, 440, 18, nil, function()
buildList(controls.implicit2, controls.implicit, currentModType)
end)
controls.implicit.tooltipFunc = function(tooltip, mode, index, value)
tooltip:Clear()
if mode ~= "OUT" and value and value.mod then
for _, line in ipairs(value.mod) do
tooltip:AddLine(16, "^7"..line)
end
self:AddModComparisonTooltip(tooltip, value.mod)
end
end
controls.implicit2Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 75, 65, 0, 16, "^7Implicit #2:")
controls.implicit2 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 80, 65, 440, 18, nil, function()
buildList(controls.implicit, controls.implicit2, currentModType)
end)
controls.implicit2.tooltipFunc = function(tooltip, mode, index, value)
tooltip:Clear()
if mode ~= "OUT" and value and value.mod then
for _, line in ipairs(value.mod) do
tooltip:AddLine(16, "^7"..line)
end
self:AddModComparisonTooltip(tooltip, value.mod)
end
end
controls.implicit3Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 75, 85, 0, 16, "^7Implicit #3:")
controls.implicit3 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 80, 65, 440, 18, nil, function()
buildList(controls.implicit4, controls.implicit3, "ScourgeDownside")
end)
controls.implicit3.tooltipFunc = function(tooltip, mode, index, value)
tooltip:Clear()
if mode ~= "OUT" and value and value.mod then
for _, line in ipairs(value.mod) do
tooltip:AddLine(16, "^7"..line)
end
self:AddModComparisonTooltip(tooltip, value.mod)
end
end
controls.implicit3Label.shown = false
controls.implicit3.shown = false
controls.implicit4Label = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 75, 105, 0, 16, "^7Implicit #4:")
controls.implicit4 = new("DropDownControl", {"TOPLEFT",nil,"TOPLEFT"}, 80, 105, 440, 18, nil, function()
buildList(controls.implicit3, controls.implicit4, "ScourgeDownside")
end)
controls.implicit4.tooltipFunc = function(tooltip, mode, index, value)
tooltip:Clear()
if mode ~= "OUT" and value and value.mod then
for _, line in ipairs(value.mod) do
tooltip:AddLine(16, "^7"..line)
end
self:AddModComparisonTooltip(tooltip, value.mod)
end
end
controls.implicit4Label.shown = false
controls.implicit4.shown = false
buildList(controls.implicit, controls.implicit2, currentModType)
Expand Down Expand Up @@ -2445,6 +2507,7 @@ function ItemsTabClass:AddCustomModifierToDisplayItem()
for _, line in ipairs(value.mod) do
tooltip:AddLine(16, "^7"..line)
end
self:AddModComparisonTooltip(tooltip, value.mod)
end
end
controls.custom = new("EditControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 45, 440, 18)
Expand Down Expand Up @@ -2665,6 +2728,7 @@ function ItemsTabClass:AddImplicitToDisplayItem()
for _, line in ipairs(value.mod) do
tooltip:AddLine(16, "^7"..line)
end
self:AddModComparisonTooltip(tooltip, value.mod)
end
end
controls.modSelectLabel = new("LabelControl", {"TOPRIGHT",nil,"TOPLEFT"}, 95, 70, 0, 16, "^7Modifier:")
Expand All @@ -2678,6 +2742,7 @@ function ItemsTabClass:AddImplicitToDisplayItem()
for _, line in ipairs(value.mod) do
tooltip:AddLine(16, "^7"..line)
end
self:AddModComparisonTooltip(tooltip, value.mod)
end
end
controls.custom = new("EditControl", {"TOPLEFT",nil,"TOPLEFT"}, 100, 45, 440, 18)
Expand Down