Skip to content

Commit 6a0860d

Browse files
committed
Show flavour text on ascendancy and bloodlines
1 parent d31d44d commit 6a0860d

2 files changed

Lines changed: 42 additions & 2 deletions

File tree

src/Classes/PassiveTree.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
117117
classId = classId,
118118
class = class,
119119
ascendClassId = ascendClassId,
120-
ascendClass = ascendClass
120+
ascendClass = ascendClass,
121+
flavourText = ascendClass.flavourText,
122+
flavourTextRect = ascendClass.flavourTextRect,
121123
}
122124
end
123125
end
@@ -179,7 +181,9 @@ local PassiveTreeClass = newClass("PassiveTree", function(self, treeVersion)
179181
classId = "alternate_ascendancies",
180182
class = alternate_ascendancies_class,
181183
ascendClassId = ascendClassId,
182-
ascendClass = ascendClass
184+
ascendClass = ascendClass,
185+
flavourText = ascendClass.flavourText,
186+
flavourTextRect = ascendClass.flavourTextRect,
183187
}
184188
self.secondaryAscendNameMap[ascendClass.id] = self.ascendNameMap[ascendClass.id]
185189
end

src/Classes/PassiveTreeView.lua

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,42 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
464464
SetDrawColor(1, 1, 1, 0.25)
465465
end
466466
self:DrawAsset(tree.assets["Classes"..group.ascendancyName], scrX, scrY, scale)
467+
468+
local ascendancyData
469+
local isAlternateAscendancy = false
470+
-- Search normal ascendancies
471+
for _, class in ipairs(tree.classes) do
472+
for _, ascendancy in ipairs(class.ascendancies) do
473+
if ascendancy.id == group.ascendancyName then
474+
ascendancyData = ascendancy
475+
break
476+
end
477+
end
478+
if ascendancyData then break end
479+
end
480+
481+
-- Search alternate ascendancies if not found
482+
if not ascendancyData and tree.alternate_ascendancies then
483+
for _, ascendancy in pairs(tree.alternate_ascendancies) do
484+
if ascendancy.id == group.ascendancyName then
485+
ascendancyData = ascendancy
486+
isAlternateAscendancy = true
487+
break
488+
end
489+
end
490+
end
491+
if ascendancyData and ascendancyData.flavourTextRect then
492+
local rect = ascendancyData.flavourTextRect
493+
local textColor = "^x" .. ascendancyData.flavourTextColour
494+
495+
-- Normal ascendancy images are 1300x1300, bloodline appears to be 1488x1412
496+
local offsetX = rect.x - (isAlternateAscendancy and 744 or 650)
497+
local offsetY = rect.y - (isAlternateAscendancy and 706 or 650)
498+
499+
local textX, textY = treeToScreen(group.x + offsetX, group.y + offsetY)
500+
501+
DrawString(textX, textY, "LEFT", 52 * scale, "FONTIN ITALIC", textColor .. ascendancyData.flavourText)
502+
end
467503
SetDrawColor(1, 1, 1)
468504
end
469505
elseif group.oo[3] then

0 commit comments

Comments
 (0)