Skip to content

Commit 9316b3a

Browse files
committed
Initial updates for Midnight Alpha
1 parent 732f52f commit 9316b3a

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

LibTalentTree-1.0.lua

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- the data for LibTalentTree will be loaded (and cached) from blizzard's APIs when the Lib loads
22
-- @curseforge-project-slug: libtalenttree@
33

4-
local MAJOR, MINOR = "LibTalentTree-1.0", 27;
4+
local MAJOR, MINOR = "LibTalentTree-1.0", 28;
55
--- @class LibTalentTree-1.0
66
local LibTalentTree = LibStub:NewLibrary(MAJOR, MINOR);
77

@@ -22,8 +22,10 @@ if not C_ClassTalents or not C_ClassTalents.InitializeViewLoadout then
2222
return;
2323
end
2424

25+
local isMidnight = select(4, GetBuildInfo()) >= 120000;
26+
2527
local MAX_LEVEL = 100; -- seems to not break if set too high, but can break things when set too low
26-
local MAX_SUB_TREE_CURRENCY = 10; -- blizzard incorrectly reports 20 when asking for the maxQuantity of the currency
28+
local MAX_SUB_TREE_CURRENCY = isMidnight and 13 or 10; -- blizzard incorrectly reports 20 when asking for the maxQuantity of the currency
2729
local HERO_TREE_REQUIRED_LEVEL = 71; -- while `C_ClassTalents.GetHeroTalentSpecsForClassSpec` returns this info, it's not immediately available on initial load
2830

2931
-- taken from ClassTalentUtil.GetVisualsForClassID
@@ -195,7 +197,7 @@ do
195197
for _, gateInfo in ipairs(treeInfo.gates) do
196198
local conditionID = gateInfo.conditionID;
197199
local conditionInfo = C_Traits.GetConditionInfo(configID, conditionID);
198-
gateData[conditionID] = {
200+
gateData[conditionID] = conditionInfo and {
199201
currencyID = conditionInfo.traitCurrencyID,
200202
spentAmountRequired = conditionInfo.spentAmountRequired,
201203
};
@@ -552,9 +554,10 @@ local gridPositionCache = {};
552554
---
553555
--- The top row is 1, the bottom row is 10.
554556
--- The first class column is 1, the last class column is 9.
555-
--- The first spec column is 13. (if the client supports sub trees, otherwise it's 10)
557+
--- The first spec column is 13. In Midnight this is 14 instead.
556558
---
557559
--- Hero talents are placed in between the class and spec trees, in columns 10, 11, 12.
560+
--- Midnight adds another column to the hero talents, making them sit in columns 10 - 13.
558561
--- Hero talent subTrees are stacked to overlap, all subTrees on rows 1 - 5. You're responsible for adjusting this yourself.
559562
---
560563
--- The Hero talent selection node, is hardcoded to row 5.5 and column 10. Making it sit right underneath the sub trees themselves.
@@ -585,6 +588,8 @@ function LibTalentTree:GetNodeGridPosition(nodeID)
585588
posX = (round(posX) / 10) - offsetX;
586589
posY = (round(posY) / 10) - offsetY;
587590
local colSpacing = 60;
591+
local subTreeColSpacing = colSpacing * 10
592+
local subTreeColOffset = 9;
588593

589594
local row, col;
590595
local nodeInfo = self:GetLibNodeInfo(nodeID);
@@ -595,14 +600,10 @@ function LibTalentTree:GetNodeGridPosition(nodeID)
595600
if subTreeInfo then
596601
local topCenterPosX = subTreeInfo.posX;
597602
local topCenterPosY = subTreeInfo.posY;
598-
local offsetFromCenterX = rawX - topCenterPosX;
599-
if (offsetFromCenterX > colSpacing) then
600-
col = 12;
601-
elseif (offsetFromCenterX < -colSpacing) then
602-
col = 10;
603-
else
604-
col = 11;
605-
end
603+
604+
local colStart = topCenterPosX - (subTreeColSpacing * (isMidnight and 1.5 or 1));
605+
local halfColEnabled = true;
606+
col = subTreeColOffset + getGridLineFromCoordinate(colStart, subTreeColSpacing, halfColEnabled, rawX);
606607

607608
local rowStart = topCenterPosY;
608609
local rowSpacing = 2400 / 4; -- 2400 is generally the height of a sub tree, 4 is number of "gaps" between 5 rows
@@ -618,7 +619,7 @@ function LibTalentTree:GetNodeGridPosition(nodeID)
618619
local halfColEnabled = true;
619620
local classColEnd = 656;
620621
local specColStart = 956;
621-
local subTreeOffset = 3 * colSpacing;
622+
local subTreeOffset = (isMidnight and 4 or 3) * colSpacing;
622623
local classSpecGap = (specColStart - classColEnd) - subTreeOffset;
623624
if (posX > (classColEnd + (classSpecGap / 2))) then
624625
-- remove the gap between the class and spec trees
@@ -632,7 +633,7 @@ function LibTalentTree:GetNodeGridPosition(nodeID)
632633
row = getGridLineFromCoordinate(rowStart, rowSpacing, halfRowEnabled, posY);
633634
end
634635

635-
gridPositionCache[treeID][nodeID] = {col, row};
636+
gridPositionCache[treeID][nodeID] = { col, row };
636637

637638
return col, row;
638639
end

LibTalentTree-1.0.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Interface: @toc-version-retail@
1+
## Interface: @toc-version-retail@,@toc-version-midnight@
22
## Title: Lib: LibTalentTree-1.0
33
## Notes: Library for retrieving class and spec talent tree information
44
## Author: Numy

0 commit comments

Comments
 (0)