Back to Home

ESO Lua File v100019

ingame/skills/keyboard/zo_skills.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
local skillTypeToSound =
{
    [SKILL_TYPE_CLASS] = SOUNDS.SKILL_TYPE_CLASS,
    [SKILL_TYPE_WEAPON] = SOUNDS.SKILL_TYPE_WEAPON,
    [SKILL_TYPE_ARMOR] = SOUNDS.SKILL_TYPE_ARMOR,
    [SKILL_TYPE_WORLD] = SOUNDS.SKILL_TYPE_WORLD,
    [SKILL_TYPE_GUILD] = SOUNDS.SKILL_TYPE_GUILD,
    [SKILL_TYPE_AVA] = SOUNDS.SKILL_TYPE_AVA,
    [SKILL_TYPE_RACIAL] = SOUNDS.SKILL_TYPE_RACIAL,
    [SKILL_TYPE_TRADESKILL] = SOUNDS.SKILL_TYPE_TRADESKILL,
}
local ALERT_TEXTURES =
{
    [ZO_SKILLS_MORPH_STATE] = {normal = "EsoUI/Art/Progression/morph_up.dds", mouseDown = "EsoUI/Art/Progression/morph_down.dds", mouseover = "EsoUI/Art/Progression/morph_over.dds"},
    [ZO_SKILLS_PURCHASE_STATE] = {normal = "EsoUI/Art/Progression/addPoints_up.dds", mouseDown = "EsoUI/Art/Progression/addPoints_down.dds", mouseover = "EsoUI/Art/Progression/addPoints_over.dds"},
}
-- Skill Manager
--------------------
local SKILL_ABILITY_DATA = 1
local SKILL_HEADER_DATA = 2
ZO_SkillsManager = ZO_Object:Subclass()
local function SetAbilityButtonTextures(button, passive)
    if passive then
        button:SetNormalTexture("EsoUI/Art/ActionBar/passiveAbilityFrame_round_up.dds")
        button:SetPressedTexture("EsoUI/Art/ActionBar/passiveAbilityFrame_round_up.dds")
        button:SetMouseOverTexture(nil)
        button:SetDisabledTexture("EsoUI/Art/ActionBar/passiveAbilityFrame_round_up.dds")
    else
        button:SetNormalTexture("EsoUI/Art/ActionBar/abilityFrame64_up.dds")
        button:SetPressedTexture("EsoUI/Art/ActionBar/abilityFrame64_down.dds")
        button:SetMouseOverTexture("EsoUI/Art/ActionBar/actionBar_mouseOver.dds")
        button:SetDisabledTexture("EsoUI/Art/ActionBar/abilityFrame64_up.dds")
    end
end
function ZO_SkillsManager:New(...)
    local manager = ZO_Object.New(self)
    manager:Initialize(...)
    return manager
end
function ZO_SkillsManager:Initialize(container)
    self.displayedAbilityProgressions = {}
    self.container = container
    self.availablePoints = 0
    self.skyShards = 0
    self.availablePointsLabel = GetControl(container, "AvailablePoints")
    self.skyShardsLabel = GetControl(container, "SkyShards")
    self.navigationContainer = GetControl(container, "NavigationContainer")
    self.navigationTree = ZO_Tree:New(self.navigationContainer:GetNamedChild("ScrollChild"), 74, -10, 300)
    local function TreeHeaderSetup(node, control, skillType, open)
        control.skillType = skillType
        control.text:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
        control.text:SetText(GetString("SI_SKILLTYPE", skillType))
        local down, up, over = ZO_Skills_GetIconsForSkillType(skillType)
        control.icon:SetTexture(open and down or up)
        control.iconHighlight:SetTexture(over)
        control.statusIcon:ClearIcons()
        if NEW_SKILL_CALLOUTS:AreAnySkillLinesInTypeNew(skillType) then
            control.statusIcon:AddIcon(ZO_KEYBOARD_NEW_ICON)
        end
        control.statusIcon:Show()
        
        ZO_IconHeader_Setup(control, open)
    end
    self.navigationTree:AddTemplate("ZO_SkillIconHeader", TreeHeaderSetup, nil, nil, nil, 0)
    local function TreeEntrySetup(node, control, data, open)
        local name = GetSkillLineInfo(data.skillType, data.skillLineIndex)
        control:SetText(zo_strformat(SI_SKILLS_TREE_NAME_FORMAT, name))
        control.statusIcon:ClearIcons()
        if NEW_SKILL_CALLOUTS:IsSkillLineNew(data.skillType, data.skillLineIndex) then
            control.statusIcon:AddIcon(ZO_KEYBOARD_NEW_ICON)
        end
        control.statusIcon:Show()
    end
    local function TreeEntryOnSelected(control, data, selected, reselectingDuringRebuild)
        control:SetSelected(selected)
        if selected and not reselectingDuringRebuild then
            self:RefreshSkillInfo()
            self:RefreshList()
            NEW_SKILL_CALLOUTS:ClearSkillLineNewStatus(data.skillType, data.skillLineIndex)
        end
    end
    local function TreeEntryEquality(left, right)
        return left.skillType == right.skillType and left.skillLineIndex == right.skillLineIndex
    end
    self.navigationTree:AddTemplate("ZO_SkillsNavigationEntry", TreeEntrySetup, TreeEntryOnSelected, TreeEntryEquality)
    self.navigationTree:SetExclusive(true)
    self.navigationTree:SetOpenAnimation("ZO_TreeOpenAnimation")
    self.skillInfo = GetControl(container, "SkillInfo")
    self.abilityList = GetControl(container, "AbilityList")
    ZO_ScrollList_Initialize(self.abilityList)
    ZO_ScrollList_AddDataType(self.abilityList, SKILL_ABILITY_DATA, "ZO_Skills_Ability", 70, function(control, data) self:SetupAbilityEntry(control, data) end)
    ZO_ScrollList_AddDataType(self.abilityList, SKILL_HEADER_DATA, "ZO_Skills_AbilityTypeHeader", 32, function(control, data) self:SetupHeaderEntry(control, data) end)
    ZO_ScrollList_AddResizeOnScreenResize(self.abilityList)
    self.warning = GetControl(container, "Warning")
    -- initialize dialogs
    self:InitializeMorphDialog()
    self:InitializeConfirmDialog()
    self:InitializeUpgradeDialog()
    -- event registration
    local function Refresh()
        self:Refresh()
    end
    local function OnSkillLineUpdate(event, skillType, skillIndex)
        if self:GetSelectedSkillType() == skillType and skillIndex == self:GetSelectedSkillLineIndex() then
            self:RefreshSkillInfo()
            self:RefreshList()
        end
    end
    local function OnAbilityProgressionUpdate(event, progressionIndex)
        if self.displayedAbilityProgressions[progressionIndex] then
            self:RefreshList()
        end
    end
    local function OnSkillPointsChanged()
        self:RefreshSkillInfo()
        self:RefreshList()
    end
    local function OnSkillAbilityProgressionsUpdated()
        self:RefreshList()
    end
    container:RegisterForEvent(EVENT_SKILL_RANK_UPDATE, OnSkillLineUpdate)
    container:RegisterForEvent(EVENT_SKILL_XP_UPDATE, OnSkillLineUpdate)
    container:RegisterForEvent(EVENT_SKILLS_FULL_UPDATE, Refresh)
    container:RegisterForEvent(EVENT_SKILL_POINTS_CHANGED, OnSkillPointsChanged)
    container:RegisterForEvent(EVENT_SKILL_ABILITY_PROGRESSIONS_UPDATED, OnSkillAbilityProgressionsUpdated)
    container:RegisterForEvent(EVENT_PLAYER_ACTIVATED, Refresh)
    container:RegisterForEvent(EVENT_ABILITY_PROGRESSION_RANK_UPDATE, OnAbilityProgressionUpdate)
    container:RegisterForEvent(EVENT_ABILITY_PROGRESSION_XP_UPDATE, OnAbilityProgressionUpdate)
    -- callbacks
    local function OnNewStatusChanged()
        self.navigationTree:RefreshVisible()
        MAIN_MENU_KEYBOARD:RefreshCategoryIndicators()
    end
    NEW_SKILL_CALLOUTS:RegisterCallback("OnSkillLineNewStatusChanged", OnNewStatusChanged)
    NEW_SKILL_CALLOUTS:RegisterCallback("OnAbilityUpdatedStatusChanged", OnNewStatusChanged)
end
function ZO_SkillsManager:InitializeMorphDialog()
    local dialogControl = GetControl("ZO_SkillsMorphDialog")
    dialogControl.desc = GetControl(dialogControl, "Description")
    dialogControl.baseAbility = GetControl(dialogControl, "BaseAbility")
    dialogControl.baseAbility.icon = GetControl(dialogControl.baseAbility, "Icon")
    dialogControl.morphAbility1 = GetControl(dialogControl, "MorphAbility1")
    dialogControl.morphAbility1.icon = GetControl(dialogControl.morphAbility1, "Icon")
    dialogControl.morphAbility1.selectedCallout = GetControl(dialogControl.morphAbility1, "SelectedCallout")
    dialogControl.morphAbility1.morph = 1
    dialogControl.morphAbility1.rank = 1
    dialogControl.morphAbility2 = GetControl(dialogControl, "MorphAbility2")
    dialogControl.morphAbility2.icon = GetControl(dialogControl.morphAbility2, "Icon")
    dialogControl.morphAbility2.selectedCallout = GetControl(dialogControl.morphAbility2, "SelectedCallout")
    dialogControl.morphAbility2.morph = 2
    dialogControl.morphAbility2.rank = 1
    dialogControl.confirmButton = GetControl(dialogControl, "Confirm")
    local function SetupMorphAbilityConfirmDialog(dialog, abilityControl)
        if abilityControl.ability.atMorph then
            local ability = abilityControl.ability
            local slot = abilityControl.ability.slot
            dialog.desc:SetText(zo_strformat(SI_SKILLS_SELECT_MORPH, ability.name))
            local baseAbility = dialog.baseAbility
            baseAbility.skillType = abilityControl.skillType
            baseAbility.lineIndex = abilityControl.lineIndex
            baseAbility.index = abilityControl.index
            baseAbility.icon:SetTexture(slot.iconFile)
            local morphAbility1 = dialog.morphAbility1
            local _, morph1Icon = GetAbilityProgressionAbilityInfo(ability.progressionIndex, morphAbility1.morph, morphAbility1.rank)
            morphAbility1.progressionIndex = ability.progressionIndex
            morphAbility1.icon:SetTexture(morph1Icon)
            morphAbility1.selectedCallout:SetHidden(true)
            ZO_ActionSlot_SetUnusable(morphAbility1.icon, false)
            local morphAbility2 = dialog.morphAbility2
            local _, morph2Icon = GetAbilityProgressionAbilityInfo(ability.progressionIndex, morphAbility2.morph, morphAbility2.rank)
            morphAbility2.progressionIndex = ability.progressionIndex
            morphAbility2.icon:SetTexture(morph2Icon)
            morphAbility2.selectedCallout:SetHidden(true)
            ZO_ActionSlot_SetUnusable(morphAbility2.icon, false)
            dialog.confirmButton:SetState(BSTATE_DISABLED)
            dialog.chosenMorphProgressionIndex = nil
            dialog.chosenMorph = nil
        end
    end
    ZO_Dialogs_RegisterCustomDialog("MORPH_ABILITY_CONFIRM",
    {
        customControl = dialogControl,
        title =
        {
            text = SI_SKILLS_MORPH_ABILITY,
        },
        buttons =
        {
            [1] =
            {
                control = GetControl(dialogControl, "Confirm"),
                text =  SI_SKILLS_MORPH_CONFIRM,
                callback =  function(dialog)
                                if dialog.chosenMorphProgressionIndex and dialog.chosenMorph then
                                    ZO_Skills_MorphAbility(dialog.chosenMorphProgressionIndex, dialog.chosenMorph)
                                end
                            end,
            },
        
            [2] =
            {
                control =   GetControl(dialogControl, "Cancel"),
                text =      SI_CANCEL,
            }
        }
    })
    self.morphDialog = dialogControl
end
function ZO_SkillsManager:InitializeConfirmDialog()
    local confirmDialogControl = GetControl("ZO_SkillsConfirmDialog")
    confirmDialogControl.abilityName = GetControl(confirmDialogControl, "AbilityName")
    confirmDialogControl.ability = GetControl(confirmDialogControl, "Ability")
    confirmDialogControl.ability.icon = GetControl(confirmDialogControl.ability, "Icon")
    local function SetupPurchaseAbilityConfirmDialog(dialog, abilityControl)
        local ability = abilityControl.ability
        local slot = abilityControl.ability.slot
        local dialogAbility = dialog.ability
        SetAbilityButtonTextures(dialogAbility, ability.passive)
        dialog.abilityName:SetText(ability.plainName)
        dialogAbility.skillType = abilityControl.skillType
        dialogAbility.lineIndex = abilityControl.lineIndex
        dialogAbility.index = abilityControl.index
        dialogAbility.icon:SetTexture(slot.iconFile)
        dialog.chosenSkillType = abilityControl.skillType
        dialog.chosenLineIndex = abilityControl.lineIndex
        dialog.chosenAbilityIndex = abilityControl.index
    end
    ZO_Dialogs_RegisterCustomDialog("PURCHASE_ABILITY_CONFIRM",
    {
        customControl = confirmDialogControl,
        title =
        {
            text = SI_SKILLS_CONFIRM_PURCHASE_ABILITY,
        },
        buttons =
        {
            [1] =
            {
                control =   GetControl(confirmDialogControl, "Confirm"),
                text =      SI_SKILLS_UNLOCK_CONFIRM,
                callback =  function(dialog)
                                if dialog.chosenSkillType and dialog.chosenLineIndex and dialog.chosenAbilityIndex then
                                    ZO_Skills_PurchaseAbility(dialog.chosenSkillType, dialog.chosenLineIndex, dialog.chosenAbilityIndex)
                                end
                            end,
            },
        
            [2] =
            {
                control =   GetControl(confirmDialogControl, "Cancel"),
                text =      SI_CANCEL,
            }
        }
    })
    self.confirmDialog = confirmDialogControl
end
function ZO_SkillsManager:InitializeUpgradeDialog()
    local upgradeDialogControl = GetControl("ZO_SkillsUpgradeDialog")
    upgradeDialogControl.desc = GetControl(upgradeDialogControl, "Description")
    upgradeDialogControl.baseAbility = GetControl(upgradeDialogControl, "BaseAbility")
    upgradeDialogControl.baseAbility.icon = GetControl(upgradeDialogControl.baseAbility, "Icon")
    upgradeDialogControl.upgradeAbility = GetControl(upgradeDialogControl, "UpgradeAbility")
    upgradeDialogControl.upgradeAbility.icon = GetControl(upgradeDialogControl.upgradeAbility, "Icon")
    local function SetupUpgradeAbilityDialog(dialog, abilityControl)
        local ability = abilityControl.ability
        local slot = abilityControl.ability.slot
        dialog.desc:SetText(zo_strformat(SI_SKILLS_UPGRADE_DESCRIPTION, ability.plainName))
        local baseAbility = dialog.baseAbility
        local upgradeAbility = dialog.upgradeAbility
        SetAbilityButtonTextures(baseAbility, ability.passive)
        SetAbilityButtonTextures(upgradeAbility, ability.passive)
        baseAbility.skillType = abilityControl.skillType
        baseAbility.lineIndex = abilityControl.lineIndex
        baseAbility.index = abilityControl.index
        baseAbility.icon:SetTexture(slot.iconFile)
        local _, upgradeIcon = GetSkillAbilityNextUpgradeInfo(abilityControl.skillType, abilityControl.lineIndex, abilityControl.index)
        upgradeAbility.skillType = abilityControl.skillType
        upgradeAbility.lineIndex = abilityControl.lineIndex
        upgradeAbility.index = abilityControl.index
        upgradeAbility.icon:SetTexture(upgradeIcon)
        dialog.chosenSkillType = abilityControl.skillType
        dialog.chosenLineIndex = abilityControl.lineIndex
        dialog.chosenAbilityIndex = abilityControl.index
    end
    ZO_Dialogs_RegisterCustomDialog("UPGRADE_ABILITY_CONFIRM",
    {
        customControl = upgradeDialogControl,
        setup = SetupUpgradeAbilityDialog,
        title =
        {
            text = SI_SKILLS_UPGRADE_ABILITY,
        },
        buttons =
        {
            [1] =
            {
                control = GetControl(upgradeDialogControl, "Confirm"),
                text =  SI_SKILLS_UPGRADE_CONFIRM,
                callback =  function(dialog)
                                if dialog.chosenSkillType and dialog.chosenLineIndex and dialog.chosenAbilityIndex then
                                    ZO_Skills_UpgradeAbility(dialog.chosenSkillType, dialog.chosenLineIndex, dialog.chosenAbilityIndex)
                                end
                            end,
            },
            [2] =
            {
                control =   GetControl(upgradeDialogControl, "Cancel"),
                text =      SI_CANCEL,
            }
        }
    })
    self.upgradeDialog = upgradeDialogControl
end
function ZO_SkillsManager:SetupAbilityEntry(ability, data)
    SetAbilityButtonTextures(ability.slot, data.passive)
    ability.name = data.name
    ability.plainName = data.plainName
    ability.nameLabel:SetText(data.name)
    ability.alert.skillType = data.skillType
    ability.alert.lineIndex = data.lineIndex
    ability.alert.index = data.abilityIndex
    ability.purchased = data.purchased
    ability.passive = data.passive
    ability.ultimate = data.ultimate
    local isTheSame = ability.progressionIndex == data.progressionIndex
    ability.progressionIndex = data.progressionIndex
    local slot = ability.slot
    slot.skillType = data.skillType
    slot.lineIndex = data.lineIndex
    slot.index = data.abilityIndex
    slot.icon:SetTexture(data.icon)
    slot.iconFile = data.icon
    ability:ClearAnchors()
    if data.progressionIndex then
        ability.xpBar:SetHidden(false)
        local lastXP, nextXP, currentXP, atMorph = GetAbilityProgressionXPInfo(data.progressionIndex)
        local _, morph, rank = GetAbilityProgressionInfo(data.progressionIndex)
        local wasAbilityRespecced = ability.morph and ability.morph > morph or false
        ZO_SkillInfoXPBar_SetValue(ability.xpBar, rank, lastXP, nextXP, currentXP, not isTheSame or wasAbilityRespecced)
        ability.atMorph = atMorph
        ability.morph = morph
        ability.nameLabel:SetAnchor(LEFT, ability.slot, RIGHT, 10, -10)
    else
        ability.xpBar:SetHidden(true)
        ZO_SkillInfoXPBar_SetValue(ability.xpBar, nil, 0, 1, 0, FORCE_INIT_SMOOTH_STATUS_BAR)
        ability.atMorph = false
        ability.nameLabel:SetAnchor(LEFT, ability.slot, RIGHT, 10, 0)
    end
    ability.upgradeAvailable = data.nextUpgradeEarnedRank and data.lineRank >= data.nextUpgradeEarnedRank
    
    if ability.purchased then
        slot:SetEnabled(true)
        ZO_ActionSlot_SetUnusable(slot.icon, false)
        ability.nameLabel:SetColor(PURCHASED_COLOR:UnpackRGBA())
        if ability.atMorph and self.availablePoints > 0 then
            ability.alert:SetHidden(false)
            ability.lock:SetHidden(true)
            ZO_Skills_SetAlertButtonTextures(ability.alert, ALERT_TEXTURES[ZO_SKILLS_MORPH_STATE])
        elseif ability.upgradeAvailable and self.availablePoints > 0 then
            ability.alert:SetHidden(false)
            ability.lock:SetHidden(true)
            ZO_Skills_SetAlertButtonTextures(ability.alert, ALERT_TEXTURES[ZO_SKILLS_PURCHASE_STATE])
        else
            ability.alert:SetHidden(true)
            ability.lock:SetHidden(true)
        end
    else
        slot:SetEnabled(false)
        ZO_ActionSlot_SetUnusable(slot.icon, true)
        if data.lineRank >= data.earnedRank then
            ability.nameLabel:SetColor(UNPURCHASED_COLOR:UnpackRGBA())
            ability.lock:SetHidden(true)
            if self.availablePoints > 0 then
                ability.alert:SetHidden(false)
                ZO_Skills_SetAlertButtonTextures(ability.alert, ALERT_TEXTURES[ZO_SKILLS_PURCHASE_STATE])
            else
                ability.alert:SetHidden(true)
            end
        else
            ability.nameLabel:SetColor(LOCKED_COLOR:UnpackRGBA())
            ability.alert:SetHidden(true)
            ability.lock:SetHidden(false)
        end
    end
end
function ZO_SkillsManager:SetupHeaderEntry(header, data)
    local label = GetControl(header, "Label")
    if data.passive then
        label:SetText(GetString(SI_SKILLS_PASSIVE_ABILITIES))
    elseif data.ultimate then
        label:SetText(GetString(SI_SKILLS_ULTIMATE_ABILITIES))
    else
        label:SetText(GetString(SI_SKILLS_ACTIVE_ABILITIES))
    end
end
function ZO_SkillsManager:UpdateSkyShards()
    self.skyShardsLabel:SetText(zo_strformat(SI_SKILLS_SKY_SHARDS_COLLECTED, self.skyShards))
end
function ZO_SkillsManager:RefreshSkillInfo()
    if self.container:IsHidden() then
        self.dirty = true
        return
    end
    local skillType = self:GetSelectedSkillType()
    local skillIndex = self:GetSelectedSkillLineIndex()
    local lineName, lineRank = GetSkillLineInfo(skillType, skillIndex)
    local lastXP, nextXP, currentXP = GetSkillLineXPInfo(skillType, skillIndex)
    self.skillInfo.name:SetText(zo_strformat(SI_SKILLS_ENTRY_LINE_NAME_FORMAT, lineName))
    local isTheSame = self.skillInfo.xpBar:GetControl().skillType == skillType and self.skillInfo.xpBar:GetControl().skillIndex == skillIndex
    self.skillInfo.xpBar:GetControl().skillType = skillType
    self.skillInfo.xpBar:GetControl().skillIndex = skillIndex
    ZO_SkillInfoXPBar_SetValue(self.skillInfo.xpBar, lineRank, lastXP, nextXP, currentXP, not isTheSame)
    self.availablePoints = GetAvailableSkillPoints()
    self.availablePointsLabel:SetText(zo_strformat(SI_SKILLS_POINTS_TO_SPEND, self.availablePoints))
    self.skyShards = GetNumSkyShards()
    self:UpdateSkyShards()
    if SkillTooltip:GetOwner() == self.skillInfo.xpBar:GetControl() then
        ZO_SkillInfoXPBar_OnMouseEnter(self.skillInfo.xpBar:GetControl())
    end
end
function ZO_SkillsManager:RefreshList()
    if self.container:IsHidden() then
        self.dirty = true
        return
    end
    if not IsActionBarSlottingAllowed() then
        self.abilityList:SetHidden(true)
        return
    else
        self.abilityList:SetHidden(false)
    end
    local skillType = self:GetSelectedSkillType()
    local skillIndex = self:GetSelectedSkillLineIndex()
    local _, lineRank = GetSkillLineInfo(skillType, skillIndex)
    local scrollData = ZO_ScrollList_GetDataList(self.abilityList)
    ZO_ScrollList_Clear(self.abilityList)
    self.displayedAbilityProgressions = {}
    local numAbilities = GetNumSkillAbilities(skillType, skillIndex)
    local foundFirstActive = false
    local foundFirstPassive = false
    local foundFirstUltimate = false
    for i = 1, numAbilities do
        local name, icon, earnedRank, passive, ultimate, purchased, progressionIndex = GetSkillAbilityInfo(skillType, skillIndex, i)
        local currentUpgradeLevel, maxUpgradeLevel = GetSkillAbilityUpgradeInfo(skillType, skillIndex, i)
        local _, _, nextUpgradeEarnedRank = GetSkillAbilityNextUpgradeInfo(skillType, skillIndex, i)
        local plainName = zo_strformat(SI_ABILITY_NAME, name)
        name = ZO_Skills_GenerateAbilityName(SI_ABILITY_NAME_AND_UPGRADE_LEVELS, name, currentUpgradeLevel, maxUpgradeLevel, progressionIndex)
        if not (currentUpgradeLevel and maxUpgradeLevel) and progressionIndex then
            self.displayedAbilityProgressions[progressionIndex] = true
        end
        local isActive = (not passive and not ultimate)
        local isUltimate = (not passive and ultimate)
        local addHeader = (isActive and not foundFirstActive) or (passive and not foundFirstPassive) or (isUltimate and not foundFirstUltimate)
        if addHeader then
            table.insert(scrollData, ZO_ScrollList_CreateDataEntry(SKILL_HEADER_DATA,  {
                                                                                            passive = passive,
                                                                                            ultimate = isUltimate
                                                                                        }))
        end
        foundFirstActive = foundFirstActive or isActive
        foundFirstPassive = foundFirstPassive or passive
        foundFirstUltimate = foundFirstUltimate or isUltimate
        table.insert(scrollData, ZO_ScrollList_CreateDataEntry(SKILL_ABILITY_DATA,  {
                                                                                        skillType = skillType,
                                                                                        lineIndex = skillIndex,
                                                                                        abilityIndex = i,
                                                                                        plainName = plainName,
                                                                                        name = name,
                                                                                        icon = icon,
                                                                                        earnedRank = earnedRank,
                                                                                        passive = passive,
                                                                                        ultimate = ultimate,
                                                                                        purchased = purchased,
                                                                                        progressionIndex = progressionIndex,
                                                                                        lineRank = lineRank,
                                                                                        nextUpgradeEarnedRank = nextUpgradeEarnedRank,
                                                                                    }))
    end
    ZO_ScrollList_Commit(self.abilityList)
end
function ZO_SkillsManager:GetSelectedSkillType()
    local selectedData = self.navigationTree:GetSelectedData()
    if selectedData then
        return selectedData.skillType
    end
end
function ZO_SkillsManager:GetSelectedSkillLineIndex()
    local selectedData = self.navigationTree:GetSelectedData()
    if selectedData then
        return selectedData.skillLineIndex
    end
end
function ZO_SkillsManager:Refresh()
    if self.container:IsHidden() then
        self.dirty = true
        return
    end
    if IsActionBarSlottingAllowed() then
        self.warning:SetHidden(true)
    else
        self.warning:SetText(GetString(SI_SKILLS_DISABLED_SPECIAL_ABILITIES))
        self.warning:SetHidden(false)
    end
    self.navigationTree:Reset()
    for skillType = 1, GetNumSkillTypes() do
        local numSkillLines = GetNumSkillLines(skillType)
        local parent
        for skillLineIndex = 1, numSkillLines do
            local _, _, discovered = GetSkillLineInfo(skillType, skillLineIndex)
            if discovered then
                if not parent then
                    parent = self.navigationTree:AddNode("ZO_SkillIconHeader", skillType, nil, skillTypeToSound[skillType])
                end
                self.navigationTree:AddNode("ZO_SkillsNavigationEntry", { skillType = skillType, skillLineIndex = skillLineIndex }, parent, SOUNDS.SKILL_LINE_SELECT)
            end
        end
    end
    self.navigationTree:Commit()
    self:RefreshSkillInfo()
    self:RefreshList()
end
function ZO_SkillsManager:OnShown()
    if self.dirty then
        self:Refresh()
    end
end
local function SetMorphButtonTextures(button, chosen)
    if chosen then
        ZO_ActionSlot_SetUnusable(button.icon, false)
        button.selectedCallout:SetHidden(false)
    else
        ZO_ActionSlot_SetUnusable(button.icon, true)
        button.selectedCallout:SetHidden(true)
    end
end
function ZO_SkillsManager:ChooseMorph(morphSlot)
    if morphSlot then
        self.morphDialog.chosenMorphProgressionIndex = morphSlot.progressionIndex
        self.morphDialog.chosenMorph = morphSlot.morph
        if morphSlot == self.morphDialog.morphAbility1 then
            SetMorphButtonTextures(self.morphDialog.morphAbility1, true)
            SetMorphButtonTextures(self.morphDialog.morphAbility2, false)
        else
            SetMorphButtonTextures(self.morphDialog.morphAbility1, false)
            SetMorphButtonTextures(self.morphDialog.morphAbility2, true)
        end
        self.morphDialog.confirmButton:SetState(BSTATE_NORMAL)
    end
end
    InitializeTooltip(SkillTooltip, control, TOPLEFT, 5, -5, TOPRIGHT)
    SkillTooltip:SetSkillAbility(control.skillType, control.lineIndex, control.index)
end
    ClearTooltip(SkillTooltip)
end
    InitializeTooltip(SkillTooltip, control, TOPLEFT, 5, -5, TOPRIGHT)
    SkillTooltip:SetSkillUpgradeAbility(control.skillType, control.lineIndex, control.index)
end
    ClearTooltip(SkillTooltip)
end
    if(GetCursorContentType() == MOUSE_CONTENT_EMPTY) then
        if ZO_Skills_AbilityFailsWerewolfRequirement(control.skillType, control.lineIndex) then
        else
            PickupAbilityBySkillLine(control.skillType, control.lineIndex, control.index)
        end
    end
end
    local ability = control.ability
    if ability.purchased and not ability.passive then
        if ZO_Skills_AbilityFailsWerewolfRequirement(control.skillType, control.lineIndex) then
        else
            local slot = GetFirstFreeValidSlotForSkillAbility(control.skillType, control.lineIndex, control.index)
            if slot then
                SlotSkillAbilityInSlot(control.skillType, control.lineIndex, control.index, slot)
            end
        end
    end
end
    local ability = control.ability
    if ability.purchased and not ability.passive then
        ClearMenu()
        if not ZO_Skills_AbilityFailsWerewolfRequirement(control.skillType, control.lineIndex) then
            if ability.ultimate then
                AddMenuItem(GetString(SI_SKILL_ABILITY_ASSIGN_TO_ULTIMATE_SLOT), function() SelectSlotSkillAbility(control.skillType, control.lineIndex, control.index, ACTION_BAR_ULTIMATE_SLOT_INDEX + 1) end)
            else
                local slot = GetFirstFreeValidSlotForSkillAbility(control.skillType, control.lineIndex, control.index)
                if slot then
                    AddMenuItem(GetString(SI_SKILL_ABILITY_ASSIGN_TO_EMPTY_SLOT), function() SlotSkillAbilityInSlot(control.skillType, control.lineIndex, control.index, slot) end)
                end
                for i = ACTION_BAR_FIRST_NORMAL_SLOT_INDEX, ACTION_BAR_ULTIMATE_SLOT_INDEX - 1 do
                    AddMenuItem(zo_strformat(SI_SKILL_ABILITY_ASSIGN_TO_SLOT, i - 1), function() SelectSlotSkillAbility(control.skillType, control.lineIndex, control.index, i + 1) end)
                end
            end
        else
        end
        ShowMenu(control)
    end
end
    if not control.ability.purchased then
        ZO_Dialogs_ShowDialog("PURCHASE_ABILITY_CONFIRM", control)
    elseif control.ability.atMorph then
        ZO_Dialogs_ShowDialog("MORPH_ABILITY_CONFIRM", control)
    elseif control.ability.upgradeAvailable then
        ZO_Dialogs_ShowDialog("UPGRADE_ABILITY_CONFIRM", control)
    end
end
    InitializeTooltip(SkillTooltip, control, TOPLEFT, 5, -5, TOPRIGHT)
    SkillTooltip:SetProgressionAbility(control.progressionIndex, control.morph, control.rank)
end
    SKILLS_WINDOW:ChooseMorph(control)
end
    InitializeTooltip(SkillTooltip, control, TOPLEFT, 15, 5, BOTTOMLEFT)
    SkillTooltip:SetSkillLine(control.skillType, control.skillIndex)
end
    ClearTooltip(SkillTooltip)
end
function ZO_Skills_OnShown(self)
    SKILLS_WINDOW:OnShown()
end
    SKILLS_WINDOW = ZO_SkillsManager:New(control)
end
    self.statusIcon = self:GetNamedChild("StatusIcon")
end
    self.statusIcon = self:GetNamedChild("StatusIcon")
end