Back to Home

ESO Lua File v101044

ingame/zo_guildselectormanager/zo_guildselectormanager.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
ZO_GuildSelectorManager = ZO_InitializingCallbackObject:Subclass()
function ZO_GuildSelectorManager:Initialize()
end
function ZO_GuildSelectorManager:RegisterForEvents()
    local function OnAddOnLoaded(_, name)
        if name == "ZO_Ingame" then
            self:SetupSavedVars()
            EVENT_MANAGER:UnregisterForEvent("ZO_GuildSelectorManager", EVENT_ADD_ON_LOADED)
        end
    end
    EVENT_MANAGER:RegisterForEvent("ZO_GuildSelectorManager", EVENT_ADD_ON_LOADED, OnAddOnLoaded)
end
function ZO_GuildSelectorManager:SetupSavedVars()
    local defaults =
    {
        selectedGuildStoreId = 0,
        selectedGuildBankId = 0,
        selectedGuildMenuId = 0,
    }
    self.savedVars = ZO_SavedVars:NewAccountWide("ZO_Ingame_SavedVariables", 1, "ZO_GuildSelectorManager", defaults)
    self:FireCallbacks("OnReady")
end
function ZO_GuildSelectorManager:SetSelectedGuildStoreId(selectedGuildStoreId)
    if not self:IsReady() then return end
    self.savedVars.selectedGuildStoreId = selectedGuildStoreId
    SelectTradingHouseGuildId(selectedGuildStoreId)
end
function ZO_GuildSelectorManager:GetSelectedGuildStoreId()
    if not self:IsReady() then return 0 end
    return self.savedVars.selectedGuildStoreId
end
function ZO_GuildSelectorManager:SetSelectedGuildBankId(selectedGuildBankId)
    if not self:IsReady() then return end
    self.savedVars.selectedGuildBankId = selectedGuildBankId
    SelectGuildBank(selectedGuildBankId)
end
function ZO_GuildSelectorManager:GetSelectedGuildBankId()
    if not self:IsReady() then return 0 end
    return self.savedVars.selectedGuildBankId
end
function ZO_GuildSelectorManager:SetSelectedGuildMenuId(selectedGuildMenuId)
    if not self:IsReady() then return end
    self.savedVars.selectedGuildMenuId = selectedGuildMenuId
end
function ZO_GuildSelectorManager:GetSelectedGuildMenuId()
    if not self:IsReady() then return 0 end
    return self.savedVars.selectedGuildMenuId
end
function ZO_GuildSelectorManager:IsReady()
    return self.savedVars ~= nil
end
ZO_GUILD_SELECTOR_MANAGER = ZO_GuildSelectorManager:New()