Skip to content

Commit 2df591a

Browse files
authored
Show flavour text on ascendancy and bloodlines (#9548)
* Show flavour text on ascendancy and bloodlines * Small check for old trees, before 3.10 were different
1 parent 427c8f1 commit 2df591a

2 files changed

Lines changed: 46 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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,46 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
468468
SetDrawColor(1, 1, 1, 0.25)
469469
end
470470
self:DrawAsset(tree.assets["Classes"..group.ascendancyName], scrX, scrY, scale)
471+
472+
if tree.classes[1].ascendancies then
473+
local ascendancyData
474+
local isAlternateAscendancy = false
475+
-- Search normal ascendancies
476+
for _, class in ipairs(tree.classes) do
477+
for _, ascendancy in ipairs(class.ascendancies) do
478+
if ascendancy.id == group.ascendancyName then
479+
ascendancyData = ascendancy
480+
break
481+
end
482+
end
483+
if ascendancyData then break end
484+
end
485+
486+
-- Search alternate ascendancies if not found
487+
if not ascendancyData and tree.alternate_ascendancies then
488+
for _, ascendancy in pairs(tree.alternate_ascendancies) do
489+
if ascendancy.id == group.ascendancyName then
490+
ascendancyData = ascendancy
491+
isAlternateAscendancy = true
492+
break
493+
end
494+
end
495+
end
496+
if ascendancyData and ascendancyData.flavourTextRect then
497+
local rect = ascendancyData.flavourTextRect
498+
local textColor = "^x" .. ascendancyData.flavourTextColour
499+
500+
-- Normal ascendancy images are 1300x1300, bloodline appears to be 1488x1412
501+
local offsetX = rect.x - (isAlternateAscendancy and 744 or 650)
502+
local offsetY = rect.y - (isAlternateAscendancy and 706 or 650)
503+
504+
local textX, textY = treeToScreen(group.x + offsetX, group.y + offsetY)
505+
506+
DrawString(textX, textY, "LEFT", 52 * scale, "FONTIN ITALIC", textColor .. ascendancyData.flavourText)
507+
end
508+
else
509+
ConPrintTable(tree.classes)
510+
end
471511
SetDrawColor(1, 1, 1)
472512
end
473513
elseif group.oo[3] then

0 commit comments

Comments
 (0)