1- if LE_EXPANSION_LEVEL_CURRENT <= LE_EXPANSION_SHADOWLANDS then print (' this addon requires Dragonflight to work' ) return end
2-
31local name , ns = ...
42
3+ if LE_EXPANSION_LEVEL_CURRENT <= LE_EXPANSION_SHADOWLANDS then print (name , ' requires Dragonflight to work' ) return end
4+
55--- @class TalentViewer
66TalentViewer = {
77 purchasedRanks = {},
6060end
6161
6262do
63-
6463 local deepCopy ;
6564 function deepCopy (original )
6665 local originalType = type (original );
8079
8180 --- @class TalentViewerTalentFrame
8281 TalentViewer_ClassTalentTalentsTabMixin = deepCopy (ClassTalentTalentsTabMixin )
83- TalentViewer_TalentFrameBaseMixin = deepCopy (TalentFrameBaseMixin )
8482
8583 local function removeFromMixing (method ) TalentViewer_ClassTalentTalentsTabMixin [method ] = function () end end
84+ removeFromMixing (' UpdateConfigButtonsState' )
85+ removeFromMixing (' RefreshLoadoutOptions' )
86+ removeFromMixing (' InitializeLoadoutDropDown' )
87+ removeFromMixing (' GetInspectUnit' )
88+ removeFromMixing (' OnEvent' )
89+
8690 function TalentViewer_ClassTalentTalentsTabMixin :GetClassID ()
8791 return TalentViewer .selectedClassId
8892 end
9296 function TalentViewer_ClassTalentTalentsTabMixin :IsInspecting ()
9397 return false
9498 end
95- removeFromMixing (' UpdateConfigButtonsState' )
96- removeFromMixing (' RefreshLoadoutOptions' )
97- removeFromMixing (' InitializeLoadoutDropDown' )
98- removeFromMixing (' GetInspectUnit' )
99- removeFromMixing (' OnEvent' )
10099
101100 local emptyTable = {}
102101
111110 or ((isChoiceNode and selectedEntryId and 1 ) or TalentViewer :GetActiveRank (nodeID ))
112111 nodeInfo .currentRank = nodeInfo .activeRank
113112 nodeInfo .ranksPurchased = not isGranted and nodeInfo .currentRank or 0
114- nodeInfo .isAvailable = true -- should depend on incoming edges
113+ nodeInfo .isAvailable = true -- TODO: should depend on incoming edges
115114 nodeInfo .canPurchaseRank = not isGranted and ((TalentViewer .purchasedRanks [nodeID ] or 0 ) < nodeInfo .maxRanks )
116115 nodeInfo .canRefundRank = not isGranted and ((TalentViewer .purchasedRanks [nodeID ] or 0 ) > 0 )
117116 nodeInfo .meetsEdgeRequirements = true
174173 local talentFrame = self
175174 local talentButton = ClassTalentTalentsTabMixin .AcquireTalentButton (self , nodeInfo , talentType , offsetX , offsetY , initFunction )
176175 function talentButton :OnClick (button )
176+ -- TODO should we trigger that event?
177177 EventRegistry :TriggerEvent (" TalentButton.OnClick" , self , button );
178178
179179 if button == " LeftButton" then
180+ -- TODO: if IsShiftKeyDown then link spellId to chat
180181 if self :CanPurchaseRank () then
181182 self :PurchaseRank ();
182183 end
352353 specId , _ = specId or cache .defaultSpecs [classId ]
353354 TalentViewer :SelectSpec (classId , specId )
354355 end
355-
356- function TalentViewer_PlayerTalentButton_OnLoad (self )
357- -- self.icon:ClearAllPoints()
358- -- self.name:ClearAllPoints()
359- -- self.icon:SetPoint('LEFT', 35, 0)
360- -- self.name:SetSize(90, 35)
361- -- self.name:SetPoint('LEFT', self.icon, 'RIGHT', 10, 0)
362- --
363- -- self:RegisterForClicks('LeftButtonUp')
364- end
365-
366- function TalentViewer_PlayerTalentButton_OnClick (self )
367- -- if (IsModifiedClick('CHATLINK')) then
368- -- local spellName, _, _, _ = GetSpellInfo(self:GetID())
369- -- local talentLink, _ = GetSpellLink(self:GetID())
370- -- if ( MacroFrameText and MacroFrameText:HasFocus() ) then
371- -- if ( spellName and not IsPassiveSpell(spellName) ) then
372- -- local subSpellName = GetSpellSubtext(spellName)
373- -- if ( subSpellName ) then
374- -- if ( subSpellName ~= '' ) then
375- -- ChatEdit_InsertLink(spellName..'('..subSpellName..')')
376- -- else
377- -- ChatEdit_InsertLink(spellName)
378- -- end
379- -- else
380- -- ChatEdit_InsertLink(spellName)
381- -- end
382- -- end
383- -- elseif ( talentLink ) then
384- -- ChatEdit_InsertLink(talentLink)
385- -- end
386- -- end
387- end
388356end
389357
390358local frame = CreateFrame (' FRAME' )
@@ -396,9 +364,6 @@ local function OnEvent(_, event, ...)
396364 if (IsAddOnLoaded (' BlizzMove' )) then TalentViewer :RegisterToBlizzMove () end
397365 if (IsAddOnLoaded (' ElvUI' )) then TalentViewer :ApplyElvUISkin () end
398366 end
399-
400- ---- if addonName == 'BlizzMove' then TalentViewer:RegisterToBlizzMove() end
401- ---- if addonName == 'ElvUI' then TalentViewer:ApplyElvUISkin() end
402367 end
403368 if event == ' PLAYER_ENTERING_WORLD' then
404369 TalentViewer :OnPlayerEnteringWorld ()
@@ -429,7 +394,6 @@ function TalentViewer:ResetTree()
429394 TalentViewer_DF .Talents :SetTalentTreeID (self .treeId , true );
430395 TalentViewer_DF .Talents :UpdateBasePanOffset ()
431396 TalentViewer_DF .Talents :UpdateSpecBackground ();
432- -- TalentViewer_DF.Talents:UpdateTreeCurrencyInfo();
433397end
434398
435399function TalentViewer :GetActiveRank (nodeID )
@@ -504,8 +468,8 @@ function TalentViewer:OnPlayerEnteringWorld()
504468end
505469
506470function TalentViewer :OnInitialize ()
507- TalentViewerDB = TalentViewerDB or {}
508- self .db = TalentViewerDB
471+ TalentTreeViewerDB = TalentTreeViewerDB or {}
472+ self .db = TalentTreeViewerDB
509473
510474 if not self .db .ldbOptions then
511475 self .db .ldbOptions = {
@@ -516,7 +480,7 @@ function TalentViewer:OnInitialize()
516480 name ,
517481 {
518482 type = ' data source' ,
519- text = ' Talent Viewer' ,
483+ text = ' Talent Tree Viewer' ,
520484 icon = ' interface/icons/inv_inscription_talenttome01.blp' ,
521485 OnClick = function ()
522486 if IsShiftKeyDown () then
@@ -527,7 +491,7 @@ function TalentViewer:OnInitialize()
527491 TalentViewer :ToggleTalentView ()
528492 end ,
529493 OnTooltipShow = function (tooltip )
530- tooltip :AddLine (' Talent Viewer' )
494+ tooltip :AddLine (' Talent Tree Viewer' )
531495 tooltip :AddLine (' |cffeda55fClick|r to view the talents for any spec.' )
532496 tooltip :AddLine (' |cffeda55fShift-Click|r to hide this button. (|cffeda55f/tv reset|r to restore)' )
533497 end ,
@@ -537,6 +501,7 @@ function TalentViewer:OnInitialize()
537501
538502 SLASH_TALENT_VIEWER1 = ' /tv'
539503 SLASH_TALENT_VIEWER2 = ' /talentviewer'
504+ SLASH_TALENT_VIEWER3 = ' /talenttreeviewer'
540505 SlashCmdList [' TALENT_VIEWER' ] = function (message )
541506 if message == ' reset' then
542507 wipe (TalentViewer .db .ldbOptions )
@@ -671,16 +636,18 @@ end
671636function TalentViewer :RegisterToBlizzMove ()
672637 if not BlizzMoveAPI then return end
673638 BlizzMoveAPI :RegisterAddOnFrames (
674- { [name ] = {
675- [' TalentViewer_DF' ] = {
676- MinVersion = 100000 ,
677- SubFrames = {
678- [' TalentViewer_DF.Talents.ButtonsParent' ] = {
679- MinVersion = 100000 ,
680- }
681- }
639+ {
640+ [name ] = {
641+ [' TalentViewer_DF' ] = {
642+ MinVersion = 100000 ,
643+ SubFrames = {
644+ [' TalentViewer_DF.Talents.ButtonsParent' ] = {
645+ MinVersion = 100000 ,
646+ },
647+ },
648+ },
682649 },
683- } }
650+ }
684651 )
685652end
686653
0 commit comments