Back to Home

ESO Lua File v100030

ingame/campaign/campaignselector_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
ZO_CampaignSelector_Shared = ZO_Object:Subclass()
function ZO_CampaignSelector_Shared:New(control)
    local selector = ZO_Object.New(self)
    selector:Initialize(control)
    return selector
end
function ZO_CampaignSelector_Shared:Initialize(control)
    -- Any code added here will affect derived classes
end
function ZO_CampaignSelector_Shared:RefreshQueryTypes()
    -- Should be overridden
end
function ZO_CampaignSelector_Shared:NeedsData()
    return (CAMPAIGN_SELECTOR_FRAGMENT:IsShowing() and self.selectedQueryType == BGQUERY_ASSIGNED_CAMPAIGN)
end
function ZO_CampaignSelector_Shared:IsHomeSelectable()
    return ZO_CampaignSelector_Shared_IsQueryTypeSelectable(BGQUERY_ASSIGNED_CAMPAIGN)
end
function ZO_CampaignSelector_Shared:IsLocalSelectable()
    return ZO_CampaignSelector_Shared_IsQueryTypeSelectable(BGQUERY_LOCAL)
end
function ZO_CampaignSelector_Shared:IsSelectedQueryStillValid()
    return ZO_CampaignSelector_Shared_IsQueryTypeSelectable(self.selectedQueryType)
end
function ZO_CampaignSelector_Shared:GetCampaignId()
    if self.selectedQueryType == BGQUERY_LOCAL then
        return GetCurrentCampaignId()
    elseif self.selectedQueryType == BGQUERY_ASSIGNED_CAMPAIGN then
        return GetAssignedCampaignId()
    end
end
function ZO_CampaignSelector_Shared:GetQueryType()
    return self.selectedQueryType
end
function ZO_CampaignSelector_Shared:UpdateCampaignWindows()
    for _, window in ipairs(self.campaignWindows) do
        window:SetCampaignAndQueryType(self:GetCampaignId(), self.selectedQueryType)
    end
end
--Events
function ZO_CampaignSelector_Shared:OnCurrentCampaignChanged()
    if self.selectedQueryType == BGQUERY_LOCAL then
        self:UpdateCampaignWindows()
    end
end
function ZO_CampaignSelector_Shared:OnAssignedCampaignChanged()
    if self.selectedQueryType == BGQUERY_ASSIGNED_CAMPAIGN then
        self:UpdateCampaignWindows()
    end
end
-- Globals
    if queryType == BGQUERY_ASSIGNED_CAMPAIGN then
        return GetAssignedCampaignId() ~= 0
    elseif queryType == BGQUERY_LOCAL then
        local currentId = GetCurrentCampaignId()
        local assignedId = GetAssignedCampaignId()
        return currentId ~= 0 and currentId ~= assignedId and not IsImperialCityCampaign(currentId)
    end
end
    return ZO_CampaignSelector_Shared_IsQueryTypeSelectable(BGQUERY_ASSIGNED_CAMPAIGN) or ZO_CampaignSelector_Shared_IsQueryTypeSelectable(BGQUERY_LOCAL)
end