Skip to content

Commit c2c56d3

Browse files
committed
Improved compatibility with Midnight
1 parent e7d39e0 commit c2c56d3

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

LibTalentTree-1.0.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,12 @@ do
253253
subTreeInfo.maxCurrency = MAX_SUB_TREE_CURRENCY;
254254
subTreeInfo.isActive = false;
255255
cache.subTreeData[entryInfo.subTreeID] = subTreeInfo;
256-
cache.treeCurrencyMap[treeID][subTreeInfo.traitCurrencyID].subTreeID = entryInfo.subTreeID;
257-
cache.treeCurrencyMap[treeID][subTreeInfo.traitCurrencyID].quantity = MAX_SUB_TREE_CURRENCY;
258-
cache.treeCurrencyMap[treeID][subTreeInfo.traitCurrencyID].maxQuantity = MAX_SUB_TREE_CURRENCY;
256+
local currencyInfo = cache.treeCurrencyMap[treeID][subTreeInfo.traitCurrencyID];
257+
currencyInfo.quantity = MAX_SUB_TREE_CURRENCY;
258+
currencyInfo.maxQuantity = MAX_SUB_TREE_CURRENCY;
259+
currencyInfo.subTreeID = entryInfo.subTreeID;
260+
currencyInfo.subTreeIDs = currencyInfo.subTreeIDs or {};
261+
table.insert(currencyInfo.subTreeIDs, entryInfo.subTreeID);
259262
end
260263
end
261264
end

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,16 @@ The data is similar to `C_Traits.GetTreeCurrencyInfo`, but enriched with more in
409409
#### Returns
410410
* `table` treeCurrencies - list of `table` treeCurrencyInfo - first entry is class currency, second is spec currency, the rest are sub tree currencies. The list is additionally indexed by the traitCurrencyID
411411
##### treeCurrencyInfo
412-
| Field | Differences from C_Traits | Extra info |
413-
|----------------------------|------------------------------------------|-------------------------------------------------------------------|
414-
| `number` traitCurrencyID | None | |
415-
| `number` quantity | Always matches maxQuantity for max level | |
416-
| `number?` maxQuantity | Always matches maxQuantity for max level | |
417-
| `number` spent | Always 0 | |
418-
| `boolean?` isClassCurrency | Lib-Only | true if the currency is a class tree currency, nil otherwise |
419-
| `boolean?` isSpecCurrency | Lib-Only | true if the currency is a spec tree currency, nil otherwise |
420-
| `number?` subTreeID | Lib-Only | the subTreeID that the currency is used for if any, nil otherwise |
412+
| Field | Differences from C_Traits | Extra info |
413+
|----------------------------|------------------------------------------|---------------------------------------------------------------------------------------|
414+
| `number` traitCurrencyID | None | |
415+
| `number` quantity | Always matches maxQuantity for max level | |
416+
| `number?` maxQuantity | Always matches maxQuantity for max level | |
417+
| `number` spent | Always 0 | |
418+
| `boolean?` isClassCurrency | Lib-Only | true if the currency is a class tree currency, nil otherwise |
419+
| `boolean?` isSpecCurrency | Lib-Only | true if the currency is a spec tree currency, nil otherwise |
420+
| `number?` subTreeID | Lib-Only | DEPRECATED! one of the subTreeIDs that the currency is used for if any, nil otherwise |
421+
| `number[]?` subTreeIDs | Lib-Only | the subTreeIDs that the currency is used for if any, nil otherwise |
421422
#### Example
422423
```lua
423424
local LibTalentTree = LibStub("LibTalentTree-1.0")

types.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
---@field spent number
99
---@field isClassCurrency boolean? # true if the currency is a class currency, nil otherwise
1010
---@field isSpecCurrency boolean? # true if the currency is a spec currency, nil otherwise
11-
---@field subTreeID number? # the sub tree ID that the currency is associated with if any, nil otherwise
11+
---@field subTreeID number? # DEPRECATED the sub tree ID that the currency is associated with if any, nil otherwise
12+
---@field subTreeIDs number[]? # list of sub trees that the currency is associated with if any, nil otherwise
1213

1314
---@alias edgeType
1415
---| 0 # VisualOnly

0 commit comments

Comments
 (0)