Back to Home

ESO Lua File v100034

ingame/lfg/zo_activityfindertemplate_manager.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
--This data will determine how the screens are laid out and presented to the player. It lets you control what goes into the dropdown and what goes into the list (keyboard)
--Or what goes into root list and what gets drilled down into a sub list (gamepad). Should be initialized with any number of LFG activity types.
ZO_ActivityFinderFilterModeData = ZO_Object:Subclass()
function ZO_ActivityFinderFilterModeData:New(...)
    local manager = ZO_Object.New(self)
    manager:Initialize(...)
    return manager
end
function ZO_ActivityFinderFilterModeData:Initialize(...)
    self.activityTypes = { ... }
    self.areSpecificsInSubmenu = false
    self:SetVisibleEntryTypes(ZO_ACTIVITY_FINDER_LOCATION_ENTRY_TYPE.SPECIFIC, ZO_ACTIVITY_FINDER_LOCATION_ENTRY_TYPE.SET)
end
function ZO_ActivityFinderFilterModeData:GetActivityTypes()
    return self.activityTypes
end
function ZO_ActivityFinderFilterModeData:SetSubmenuFilterNames(specificFilterName, randomFilterName)
    self.specificFilterName = specificFilterName
    self.randomFilterName = randomFilterName
end
function ZO_ActivityFinderFilterModeData:GetSpecificFilterName()
    return self.specificFilterName
end
function ZO_ActivityFinderFilterModeData:GetRandomFilterName()
    return self.randomFilterName
end
function ZO_ActivityFinderFilterModeData:SetVisibleEntryTypes(...)
    self.visibleEntryTypes = { ... }
end
function ZO_ActivityFinderFilterModeData:GetVisibleEntryTypes()
    return self.visibleEntryTypes
end
function ZO_ActivityFinderFilterModeData:IsEntryTypeVisible(entryTypeToCheck)
    for _, entryType in ipairs(self.visibleEntryTypes) do
        if entryType == entryTypeToCheck then
            return true
        end
    end
    return false
end
------------------
--Initialization--
------------------
ZO_ActivityFinderTemplate_Manager = ZO_Object:Subclass()
function ZO_ActivityFinderTemplate_Manager:New(...)
    local manager = ZO_Object.New(self)
    manager:Initialize(...)
    return manager
end
function ZO_ActivityFinderTemplate_Manager:Initialize(name, categoryData, filterModeData)
    self.name = name
    self.filterModeData = filterModeData
    if not IsConsoleUI() then
        self.keyboardObject = ZO_ActivityFinderTemplate_Keyboard:New(self, categoryData.keyboardData, categoryData.priority)
    end
    self.gamepadObject = ZO_ActivityFinderTemplate_Gamepad:New(self, categoryData.gamepadData, categoryData.priority)
    self.lockingCooldownTypes = {}
end
function ZO_ActivityFinderTemplate_Manager:GetName()
    return self.name
end
function ZO_ActivityFinderTemplate_Manager:GetFilterModeData()
    return self.filterModeData
end
function ZO_ActivityFinderTemplate_Manager:GetKeyboardObject()
    return self.keyboardObject
end
function ZO_ActivityFinderTemplate_Manager:GetGamepadObject()
    return self.gamepadObject
end
function ZO_ActivityFinderTemplate_Manager:GetCategoryData()
    assert(false) -- must be overwritten in derived classes
end
function ZO_ActivityFinderTemplate_Manager:SetLockingCooldownTypes(...)
    self.lockingCooldownTypes = { ... }
end
function ZO_ActivityFinderTemplate_Manager:IsLockedByCooldown()
    for _, cooldownType in ipairs(self.lockingCooldownTypes) do
        if ZO_ACTIVITY_FINDER_ROOT_MANAGER:IsLFGCooldownTypeOnCooldown(cooldownType) then
            return true
        end
    end
    return false
end
do
    local VERBOSE_COOLDOWN_TEXT = true
    function ZO_ActivityFinderTemplate_Manager:GetCooldownLockText()
        for _, cooldownType in ipairs(self.lockingCooldownTypes) do
            if ZO_ACTIVITY_FINDER_ROOT_MANAGER:IsLFGCooldownTypeOnCooldown(cooldownType) then
                --if the text is a function, that means theres a timer involved that we want to refresh on update
                return function() return ZO_ACTIVITY_FINDER_ROOT_MANAGER:GetLFGCooldownLockText(cooldownType, VERBOSE_COOLDOWN_TEXT) end
            end
        end
        return nil
    end
end
function ZO_ActivityFinderTemplate_Manager:GetManagerLockInfo()
    local isManagerLocked = false
    local managerLockReasons =
    {
        isLockedByCooldown = self:IsLockedByCooldown()
    }
    for _, reason in pairs(managerLockReasons) do
        if reason == true then
            isManagerLocked = true
            break
        end
    end
    return isManagerLocked, managerLockReasons
end
function ZO_ActivityFinderTemplate_Manager:GetManagerLockText()
    local isManagerLocked, managerLockReasons = self:GetManagerLockInfo()
    local lockReasonText
    if isManagerLocked then
        if managerLockReasons.isLockedByCooldown then
            lockReasonText = self:GetCooldownLockText()
        end
    end
    return lockReasonText
end