@@ -7,6 +7,7 @@ local L = TTT.L;
77
88local SKYRIDING_TREE_ID = Constants .MountDynamicFlightConsts and Constants .MountDynamicFlightConsts .TREE_ID or 672 ;
99local HORRIFIC_VISIONS_TREE_ID = 1057 ;
10+ local OVERCHARGED_TITAN_CONSOLE_TREE_ID = 1061 ;
1011
1112local CHOICE_NODE_OPTION_1 = 1 ;
1213local CHOICE_NODE_OPTION_2 = 2 ;
@@ -40,12 +41,19 @@ function Module:OnInitialize()
4041 end
4142 self .disabledByRefund = false ;
4243 hooksecurefunc (C_Traits , ' RefundRank' , function (configID )
43- if configID == self .skyridingConfigID or configID == self .horrificVisionsConfigID then
44+ if
45+ configID == self .skyridingConfigID
46+ or configID == self .horrificVisionsConfigID
47+ or configID == self .overchargedTitanConsoleConfigID
48+ then
4449 self .disabledByRefund = true ;
4550 end
4651 end );
4752 hooksecurefunc (C_Traits , ' SetSelection' , function (configID , nodeID , entryID )
48- if (configID == self .skyridingConfigID or configID == self .horrificVisionsConfigID ) and entryID == nil then
53+ if
54+ (configID == self .skyridingConfigID or configID == self .horrificVisionsConfigID or configID == self .overchargedTitanConsoleConfigID )
55+ and entryID == nil
56+ then
4957 self .disabledByRefund = true ;
5058 end
5159 end );
@@ -89,6 +97,7 @@ function Module:GetOptions(defaultOptionsTable, db)
8997 surge = CHOICE_NODE_OPTION_1 ,
9098 surgeCache = {},
9199 horrificVisionsEnabled = true ,
100+ overchargedTitanConsoleEnabled = true ,
92101 };
93102 for k , v in pairs (defaults ) do
94103 if self .db [k ] == nil then
@@ -99,6 +108,7 @@ function Module:GetOptions(defaultOptionsTable, db)
99108 self .enabledTreeIDs = {
100109 [SKYRIDING_TREE_ID ] = self .db .skyridingEnabled or nil ,
101110 [HORRIFIC_VISIONS_TREE_ID ] = self .db .horrificVisionsEnabled or nil ,
111+ [OVERCHARGED_TITAN_CONSOLE_TREE_ID ] = self .db .overchargedTitanConsoleEnabled or nil ,
102112 };
103113 end
104114 setEnabledTreeIDs ();
@@ -124,6 +134,7 @@ function Module:GetOptions(defaultOptionsTable, db)
124134 function Module :BuildOptionsTable ()
125135 local isSkyridingLoaded = not not self .skyridingConfigID ;
126136 local isHorrificVisionsLoaded = not not self .horrificVisionsConfigID ;
137+ local isOverchargedTitanConsoleLoaded = not not self .overchargedTitanConsoleConfigID ;
127138
128139 defaultOptionsTable .args .skyRiding = {
129140 type = ' group' ,
@@ -237,6 +248,36 @@ function Module:GetOptions(defaultOptionsTable, db)
237248 },
238249 },
239250 };
251+ defaultOptionsTable .args .overchargedTitanConsole = {
252+ type = ' group' ,
253+ inline = true ,
254+ name = GENERIC_TRAIT_FRAME_TITAN_CONSOLE_TITLE ,
255+ order = increment (),
256+ args = {
257+ loading = {
258+ type = ' description' ,
259+ name = L [' Loading...' ] .. ' \n ' .. L [' You have not unlocked the %s system on this character yet.' ]:format (GENERIC_TRAIT_FRAME_TITAN_CONSOLE_TITLE ),
260+ order = increment (),
261+ hidden = isOverchargedTitanConsoleLoaded ,
262+ },
263+ overchargedTitanConsoleEnabled = {
264+ type = ' toggle' ,
265+ name = L [' Enable' ],
266+ desc = L [' Automatically purchase %s talents when you have enough currency.' ]:format (GENERIC_TRAIT_FRAME_TITAN_CONSOLE_TITLE ),
267+ order = increment (),
268+ get = get ,
269+ set = set ,
270+ },
271+ openUI = {
272+ type = ' execute' ,
273+ name = L [' Toggle %s UI' ]:format (GENERIC_TRAIT_FRAME_TITAN_CONSOLE_TITLE ),
274+ desc = L [' Toggle the %s UI to view and adjust talents.' ]:format (GENERIC_TRAIT_FRAME_TITAN_CONSOLE_TITLE ),
275+ order = increment (),
276+ func = function () self :ToggleTreeUI (OVERCHARGED_TITAN_CONSOLE_TREE_ID ); end ,
277+ disabled = not isOverchargedTitanConsoleLoaded ,
278+ },
279+ },
280+ };
240281 end
241282 self :BuildOptionsTable ();
242283
@@ -271,15 +312,24 @@ end
271312function Module :CheckConfig ()
272313 self .skyridingConfigID = C_Traits .GetConfigIDByTreeID (SKYRIDING_TREE_ID );
273314 self .horrificVisionsConfigID = C_Traits .GetConfigIDByTreeID (HORRIFIC_VISIONS_TREE_ID );
274- if not self .skyridingConfigID and not self .horrificVisionsConfigID then return ; end
315+ self .overchargedTitanConsoleConfigID = C_Traits .GetConfigIDByTreeID (OVERCHARGED_TITAN_CONSOLE_TREE_ID );
316+ if
317+ not self .skyridingConfigID
318+ and not self .horrificVisionsConfigID
319+ and not self .overchargedTitanConsoleConfigID
320+ then return ; end
275321
276322 self :BuildOptionsTable ();
277323 Main :NotifyConfigChange ();
278324 self .talentsLoaded = true ;
279325 if self .enabled then
280326 self :PurchaseTalents ();
281327 end
282- if self .skyridingConfigID and self .horrificVisionsConfigID then
328+ if
329+ self .skyridingConfigID
330+ and self .horrificVisionsConfigID
331+ and self .overchargedTitanConsoleConfigID
332+ then
283333 for _ , event in pairs (self .checkConfigEvents ) do
284334 self :UnregisterEvent (event );
285335 end
@@ -332,6 +382,9 @@ function Module:PurchaseTalents()
332382 if self .db .horrificVisionsEnabled then
333383 self :PurchaseHorrificVisionsTalents ();
334384 end
385+ if self .db .overchargedTitanConsoleEnabled then
386+ self :PurchaseOverchargedTitanConsoleTalents ();
387+ end
335388end
336389
337390function Module :PurchaseSkyridingTalents ()
@@ -358,6 +411,15 @@ function Module:PurchaseHorrificVisionsTalents()
358411 self :DoPurchase (configID , treeID , ignoredNodeIDs );
359412end
360413
414+ function Module :PurchaseOverchargedTitanConsoleTalents ()
415+ if not self .overchargedTitanConsoleConfigID then return ; end
416+
417+ local ignoredNodeIDs = {};
418+ local configID = self .overchargedTitanConsoleConfigID ;
419+ local treeID = OVERCHARGED_TITAN_CONSOLE_TREE_ID ;
420+ self :DoPurchase (configID , treeID , ignoredNodeIDs );
421+ end
422+
361423function Module :DoPurchase (configID , treeID , ignoredNodeIDs )
362424 if self .purchasing or self .disabledByRefund then
363425 -- Already purchasing or disabled by refund
@@ -455,7 +517,7 @@ function Module:ReportPurchases(entryIDs)
455517 end
456518 self :Print (
457519 string.format (
458- L [' Purchased %d new talents.' ] .. ' %s' ,
520+ L [' Purchased %d new talents.' ] .. ' %s' ,
459521 # entryIDs ,
460522 table.concat (spellLinks , ' , ' )
461523 )
0 commit comments