Back to Home

ESO Lua File v101044

ingame/skills/keyboard/scribinglibrary_keyboard.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
ZO_ScribingLibrary_Keyboard = ZO_Object.MultiSubclass(ZO_DeferredInitializingObject, ZO_ScribingLayout_Keyboard)
function ZO_ScribingLibrary_Keyboard:Initialize(control)
    self.scene = ZO_Scene:New("scribingLibraryKeyboard", SCENE_MANAGER)
    ZO_ScribingLayout_Keyboard.Initialize(self, control)
    ZO_DeferredInitializingObject.Initialize(self, self.scene)
    self.infoTextControl = self.control:GetNamedChild("InfoText")
    local fragment = ZO_FadeSceneFragment:New(control)
    self.scene:AddFragment(fragment)
end
function ZO_ScribingLibrary_Keyboard:OnDeferredInitialize()
    local function OnSkillLineUpdated(skillLineData)
        if self:IsShowing() then
            self:RefreshLeftPanel()
        end
    end
    SKILLS_DATA_MANAGER:RegisterCallback("SkillLineUpdated", OnSkillLineUpdated)
end
function ZO_ScribingLibrary_Keyboard:OnShowing()
    local RESET_TO_TOP = true
    self:ShowCraftedAbilities(RESET_TO_TOP)
    KEYBIND_STRIP:RemoveDefaultExit()
    KEYBIND_STRIP:AddKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_ScribingLibrary_Keyboard:OnHiding()
    KEYBIND_STRIP:RemoveKeybindButtonGroup(self.keybindStripDescriptor)
    KEYBIND_STRIP:RestoreDefaultExit()
end
function ZO_ScribingLibrary_Keyboard:OnHidden()
end
function ZO_ScribingLibrary_Keyboard:RefreshLeftPanel()
    self.infoTextControl:SetHidden(true)
    if SCRIBING_DATA_MANAGER:HasScribedCraftedAbilitySkillsData() then
        self.scene:AddFragment(FRAME_TARGET_STANDARD_RIGHT_PANEL_MEDIUM_LEFT_PANEL_FRAGMENT)
        self.scene:AddFragment(FRAME_TARGET_BLUR_STANDARD_RIGHT_PANEL_MEDIUM_LEFT_PANEL_FRAGMENT)
        self.scene:AddFragment(SCRIBING_LIBRARY_CRAFTED_ABILITY_SKILLS_FRAGMENT)
    else
        if not SCRIBING_DATA_MANAGER:IsScribingContentAccessible() then
            self.infoTextControl:SetText(SCRIBING_DATA_MANAGER:GetScribingInaccessibleText())
            self.infoTextControl:SetHidden(false)
            self.scene:AddFragment(MEDIUM_LEFT_PANEL_BG_FRAGMENT)
        end
        self.scene:AddFragment(FRAME_TARGET_STANDARD_RIGHT_PANEL_FRAGMENT)
        self.scene:AddFragment(FRAME_TARGET_BLUR_STANDARD_RIGHT_PANEL_FRAGMENT)
    end
end
function ZO_ScribingLibrary_Keyboard:InitializeKeybindStripDescriptors()
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_CENTER,
        -- Select Grimoire
        {
            keybind = "UI_SHORTCUT_PRIMARY",
            name = GetString(SI_SCRIBING_LIBRARY_SELECT_GRIMOIRE),
            callback = function()
                local entryData = self:GetMouseOverCraftedAbilityEntry().dataEntry.data
                local craftedAbilityId = entryData:GetId()
                self:SelectCraftedAbilityId(craftedAbilityId)
            end,
            visible = function()
                return self:HasMouseOverCraftedAbilityEntry()
            end,
        },
        -- Exit/Back
        {
            name = function()
                if self:AreScriptsShowing() then
                    return GetString(SI_SCRIBING_BACK_KEYBIND_LABEL)
                else
                    return GetString(SI_EXIT_BUTTON)
                end
            end,
            keybind = "UI_SHORTCUT_EXIT",
            alignment = KEYBIND_STRIP_ALIGN_RIGHT,
            callback = function()
                if self:AreScriptsShowing() then
                    self:ShowCraftedAbilities()
                else
                    SCENE_MANAGER:HideCurrentScene()
                end
            end,
        },
    }
end
function ZO_ScribingLibrary_Keyboard:ShowCraftedAbilities(resetToTop)
    ZO_ScribingLayout_Keyboard.ShowCraftedAbilities(self, resetToTop)
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
-- Overridden from ZO_ScribingLayout_Keyboard
function ZO_ScribingLibrary_Keyboard:GetCraftedAbilityDataList()
    return SCRIBING_DATA_MANAGER:GetSortedBySkillTypeCraftedAbilityData()
end
function ZO_ScribingLibrary_Keyboard:SetMouseOverCraftedAbilityEntry(...)
    ZO_ScribingLayout_Keyboard.SetMouseOverCraftedAbilityEntry(self, ...)
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_ScribingLibrary_Keyboard:SelectCraftedAbilityId(craftedAbilityId)
    ZO_ScribingLayout_Keyboard.SelectCraftedAbilityId(self, craftedAbilityId)
    local craftedAbilityData = SCRIBING_DATA_MANAGER:GetCraftedAbilityData(craftedAbilityId)
    if craftedAbilityData then
        craftedAbilityData:SetScriptIdSelectionOverride(0, 0, 0)
        self:ShowScripts()
    else
        self:ShowCraftedAbilities()
    end
end
function ZO_ScribingLibrary_Keyboard:GetIconsForScriptData(scriptData)
    local icons = {}
    local craftedAbilityData = self:GetSelectedCraftedAbilityData()
    if craftedAbilityData:IsScriptActive(scriptData) then
        table.insert(icons, "EsoUI/Art/Crafting/scribing_activeScript_icon.dds")
    end
    return icons
end
-- End Overridden from ZO_ScribingLayout_Keyboard
--
-- Functions for XML
--
function ZO_ScribingLibrary_Keyboard.OnControlInitialized(control)
    SCRIBING_LIBRARY_KEYBOARD = ZO_ScribingLibrary_Keyboard:New(control)
end