Back to Home

ESO Lua File v100021

ingame/map/worldmapfilters_shared.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
--Filter Panel
ZO_WorldMapFilterPanel_Shared = ZO_Object:Subclass()
function ZO_WorldMapFilterPanel_Shared:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_WorldMapFilterPanel_Shared:Initialize(control, mapFilterType, savedVars)
    self.control = control
    self.savedVars = savedVars
    self.mapFilterType = mapFilterType
    self.pinFilterCheckBoxes = {}
    self.pinFilterOptionComboBoxes = {} 
end
function ZO_WorldMapFilterPanel_Shared:AnchorControl(control, offsetX)
    if(offsetX == nil) then
        offsetX  = 0
    end
    if(self.lastControl) then
        control:SetAnchor(TOPLEFT, self.lastControl, BOTTOMLEFT, offsetX - self.lastOffsetX, 8)
    else
        control:SetAnchor(TOPLEFT, nil, TOPLEFT, 0, offsetX)
    end
    self.lastControl = control
    self.lastOffsetX = offsetX
end
function ZO_WorldMapFilterPanel_Shared:SetHidden(hidden)
    self.control:SetHidden(hidden)
end
function ZO_WorldMapFilterPanel_Shared:GetPinFilter(mapPinGroup)
    if self.modeVars then
        local filter = self.modeVars.filters[self.mapFilterType]
        if filter then
            return filter[mapPinGroup]
        end
    end
    return nil
end
function ZO_WorldMapFilterPanel_Shared:SetPinFilter(mapPinGroup, shown)
    self.modeVars.filters[self.mapFilterType][mapPinGroup] = shown
end
function ZO_WorldMapFilterPanel_Shared:FindCheckBox(mapPinGroup)
    for _, checkBox in ipairs(self.pinFilterCheckBoxes) do
        if(checkBox.mapPinGroup == mapPinGroup) then
            return checkBox
        end
    end
    return nil
end
function ZO_WorldMapFilterPanel_Shared:FindComboBox(mapPinGroup)
    for _, comboBox in ipairs(self.pinFilterOptionComboBoxes) do
        if(comboBox.mapPinGroup == mapPinGroup) then
            return comboBox
        end
    end
    return nil
end
function ZO_WorldMapFilterPanel_Shared:ComboBoxDependsOn(childPinGroup, parentPinGroup)
    local checkBox = self:FindCheckBox(parentPinGroup)
    checkBox.dependentComboBox = childPinGroup
end
function ZO_WorldMapFilterPanel_Shared:FindDependentCheckBox(mapPinGroup)
    for _, checkBox in ipairs(self.pinFilterCheckBoxes) do
        if(checkBox.dependentComboBox == mapPinGroup) then
            return checkBox
        end
    end
    return nil
end
function ZO_WorldMapFilterPanel_Shared:PreBuildControls()
    
end
function ZO_WorldMapFilterPanel_Shared:BuildControls()
    
end
function ZO_WorldMapFilterPanel_Shared:PostBuildControls()
    
end
--Filters
ZO_WorldMapFilters_Shared = ZO_Object:Subclass()
function ZO_WorldMapFilters_Shared:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_WorldMapFilters_Shared:Initialize(control)
    self.control = control
    local function OnMapChanged()
        local mapFilterType = GetMapFilterType()
        local mode = ZO_WorldMap_GetMode()
        local newCurrentPanel
        if mapFilterType == MAP_FILTER_TYPE_STANDARD then
            newCurrentPanel = self.pvePanel
            self.pvePanel:SetMapMode(mode)
        elseif mapFilterType == MAP_FILTER_TYPE_AVA_CYRODIIL then
            newCurrentPanel = self.pvpPanel
            self.pvpPanel:SetMapMode(mode)
        elseif mapFilterType == MAP_FILTER_TYPE_AVA_IMPERIAL then
            newCurrentPanel = self.imperialPvPPanel
            self.imperialPvPPanel:SetMapMode(mode)
        elseif mapFilterType == MAP_FILTER_TYPE_BATTLEGROUND then
            newCurrentPanel = self.battlegroundPanel
            self.battlegroundPanel:SetMapMode(mode)
        end
        if self.currentPanel and self.currentPanel ~= newCurrentPanel then
            self.currentPanel:SetHidden(true)
        end
        newCurrentPanel:SetHidden(false)
        self.currentPanel = newCurrentPanel
    end
    
    CALLBACK_MANAGER:RegisterCallback("OnWorldMapChanged", OnMapChanged)
    CALLBACK_MANAGER:RegisterCallback("OnWorldMapModeChanged", OnMapChanged)
end
-- Shared PVP and PVE panel code
ZO_PvEWorldMapFilterPanel_Shared = ZO_Object:Subclass()
function ZO_PvEWorldMapFilterPanel_Shared:BuildControls()
    self:AddPinFilterCheckBox(MAP_FILTER_OBJECTIVES, ZO_WorldMap_RefreshAllPOIs, GetString(SI_WORLD_MAP_FILTERS_SHOW_DETAILS))
    self:AddPinFilterCheckBox(MAP_FILTER_WAYSHRINES, ZO_WorldMap_RefreshWayshrines)
    self:AddPinFilterCheckBox(MAP_FILTER_GROUP_MEMBERS, ZO_WorldMap_RefreshGroupPins)
end
ZO_PvPWorldMapFilterPanel_Shared = ZO_Object:Subclass()
function ZO_PvPWorldMapFilterPanel_Shared:BuildControls()
    self:AddPinFilterCheckBox(MAP_FILTER_OBJECTIVES, ZO_WorldMap_RefreshAllPOIs, GetString(SI_WORLD_MAP_FILTERS_SHOW_DETAILS))
    self:AddPinFilterCheckBox(MAP_FILTER_WAYSHRINES, ZO_WorldMap_RefreshWayshrines)
    self:AddPinFilterCheckBox(MAP_FILTER_GROUP_MEMBERS, ZO_WorldMap_RefreshGroupPins)
    self:AddPinFilterCheckBox(MAP_FILTER_KILL_LOCATIONS, ZO_WorldMap_RefreshKillLocations)
    self:AddPinFilterCheckBox(MAP_FILTER_RESOURCE_KEEPS, ZO_WorldMap_RefreshKeeps)
    self:AddPinFilterCheckBox(MAP_FILTER_IMPERIAL_CITY_ENTRANCES, ZO_WorldMap_RefreshImperialCity)
    self:AddPinFilterCheckBox(MAP_FILTER_AVA_GRAVEYARDS, function() 
    end)
    self:AddPinFilterCheckBox(MAP_FILTER_AVA_GRAVEYARD_AREAS, ZO_WorldMap_RefreshForwardCamps)
    self:AddPinFilterCheckBox(MAP_FILTER_TRANSIT_LINES, ZO_WorldMap_RefreshKeepNetwork)
    self:ComboBoxDependsOn(MAP_FILTER_TRANSIT_LINES_ALLIANCE, MAP_FILTER_TRANSIT_LINES)
    self:AddPinFilterComboBox(MAP_FILTER_TRANSIT_LINES_ALLIANCE, ZO_WorldMap_RefreshKeepNetwork, GetString(SI_WORLD_MAP_FILTERS_SHOW_ALLIANCE), "SI_MAPTRANSITLINEALLIANCE", MAP_TRANSIT_LINE_ALLIANCE_ALL, MAP_TRANSIT_LINE_ALLIANCE_MINE)
end
ZO_ImperialPvPWorldMapFilterPanel_Shared = ZO_Object:Subclass()
function ZO_ImperialPvPWorldMapFilterPanel_Shared:BuildControls()
    self:AddPinFilterCheckBox(MAP_FILTER_OBJECTIVES, ZO_WorldMap_RefreshAllPOIs, GetString(SI_WORLD_MAP_FILTERS_SHOW_DETAILS))
    self:AddPinFilterCheckBox(MAP_FILTER_GROUP_MEMBERS, ZO_WorldMap_RefreshGroupPins)
    self:AddPinFilterCheckBox(MAP_FILTER_KILL_LOCATIONS, ZO_WorldMap_RefreshKillLocations)
end
ZO_BattlegroundWorldMapFilterPanel_Shared = ZO_Object:Subclass()
function ZO_BattlegroundWorldMapFilterPanel_Shared:BuildControls()
    self:AddPinFilterCheckBox(MAP_FILTER_GROUP_MEMBERS, ZO_WorldMap_RefreshGroupPins)
end