Skip to content

Commit 1939162

Browse files
committed
Add level requirement, limit, and colour to rune tooltips
1 parent 4bbee80 commit 1939162

3 files changed

Lines changed: 301 additions & 268 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,12 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
196196
end
197197
end
198198

199+
rune.name = name
199200
rune.label = mod[1]
200201
rune.order = mod.statOrder[1]
201-
rune.req = mod.rank[1]
202+
rune.req = mod.rank
202203
rune.group = #mod
204+
rune.limit = mod.limit
203205

204206
if slot == "armour" then
205207
for _, v in pairs(runeList) do
@@ -276,9 +278,20 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
276278
runeSlot.tooltipFunc = function(tooltip, mode, index, rune)
277279
tooltip:Clear()
278280
if rune.label ~= "None" then
279-
tooltip:AddLine(14, "^7"..rune.label)
281+
tooltip:AddLine(16, "^7" .. rune.name)
282+
283+
if rune.limit then
284+
tooltip:AddLine(14, "^7" .. s_format("Limited to: %d", rune.limit))
285+
end
286+
287+
if rune.req > 1 then
288+
tooltip:AddLine(14, "^7" .. s_format("Requires: Level %d", rune.req))
289+
end
280290
for _, line in ipairs(rune) do
281-
tooltip:AddLine(14, "^7"..line)
291+
-- skip bonded lines as monks cannot use these
292+
if not line:match("^Bonded:") then
293+
tooltip:AddLine(14, colorCodes.MAGIC .. line)
294+
end
282295
end
283296
-- Adding Comparison
284297
local compLines = { type = "Rune" }
@@ -289,11 +302,13 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
289302
local outputBase = calcFunc()
290303
local outputNew = calcFunc({ repSlotName = slotName, repItem = rune })
291304
self.build:AddStatComparesToTooltip(tooltip, outputBase, outputNew,
292-
"\nAdding this mod will give: ")
305+
"\n^7Adding this mod will give: ")
293306
end
294307
end
295308

296-
self.controls[slotName.."Label"] = new("LabelControl", {"RIGHT", runeSlot, "LEFT"}, {-2, 0, 16, 16}, s_format("^7%s:", label))
309+
self.controls[slotName .. " Label"] = new("LabelControl", { "RIGHT", runeSlot, "LEFT" },
310+
{ -2, 0, 16, 16 },
311+
s_format("^7%s:", label))
297312

298313
prevSlot = runeSlot
299314
t_insert(self.controls, runeSlot)
@@ -783,9 +798,17 @@ holding Shift will put it in the second.]])
783798
drop.tooltipFunc = function(tooltip, mode, index, value)
784799
tooltip:Clear()
785800
if value.lines and value.lines[1] ~= "None" then
786-
tooltip:AddLine(14, "^7"..value.name)
801+
tooltip:AddLine(16, "^7" .. value.name)
802+
803+
if value.lines and value.lines.limit then
804+
tooltip:AddLine(14, "^7" .. s_format("Limited to: %d", value.lines.limit))
805+
end
806+
807+
if value.req > 1 then
808+
tooltip:AddLine(14, "^7" .. s_format("Requires: Level %d", value.req))
809+
end
787810
for _, line in ipairs(value.lines) do
788-
tooltip:AddLine(14, "^7"..line)
811+
tooltip:AddLine(14, colorCodes.MAGIC .. line)
789812
end
790813
-- Adding Comparison
791814
local compLines = { type = "Rune" }
@@ -1953,7 +1976,17 @@ local runeModLines = { { name = "None", label = "None", lines = { "None" }, orde
19531976
for name, runeMods in pairs(data.itemMods.Runes) do
19541977
-- Some runes have multiple mod lines; insert each as separate entry
19551978
for slotType, runeMod in pairs(runeMods) do
1956-
t_insert(runeModLines, { name = name, label = runeMod[1], lines = runeMod, req = runeMod.rank[1], order = runeMod.statOrder[1], slot = slotType, type = runeMod.type, group = #runeMod })
1979+
t_insert(runeModLines,
1980+
{
1981+
name = name,
1982+
label = runeMod[1],
1983+
lines = runeMod,
1984+
req = runeMod.rank,
1985+
order = runeMod.statOrder[1],
1986+
slot = slotType,
1987+
type = runeMod.type,
1988+
group = #runeMod
1989+
})
19571990
end
19581991
end
19591992
table.sort(runeModLines, function(a, b)

0 commit comments

Comments
 (0)