Back to Home

ESO Lua File v101044

ingame/campaign/campaignemperor.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
ZO_CAMPAIGN_EMPEROR_RANK_WIDTH = 60
ZO_CAMPAIGN_EMPEROR_IS_INELIGIBLE_WIDTH = 40
ZO_CAMPAIGN_EMPEROR_NAME_WIDTH = 270
ZO_CAMPAIGN_EMPEROR_NAME_HEADER_OFFSETX = ZO_CAMPAIGN_EMPEROR_IS_INELIGIBLE_WIDTH + 5
ZO_CAMPAIGN_EMPEROR_NAME_HEADER_WIDTH = 265
ZO_CAMPAIGN_EMPEROR_ALLIANCE_WIDTH = 85
ZO_CAMPAIGN_EMPEROR_POINTS_WIDTH = 130
local CampaignEmperor = ZO_InitializingObject:MultiSubclass(CampaignEmperor_Shared, ZO_SortFilterList)
function CampaignEmperor:Initialize(control)
    ZO_SortFilterList.InitializeSortFilterList(self, control)
    CampaignEmperor_Shared.Initialize(self, control)
    self.imperialKeepPool = ZO_ControlPool:New("ZO_CampaignImperialKeep", self.imperialKeeps, "ImperialKeep")
    ZO_ScrollList_AddDataType(self.list, ZO_EMPEROR_LEADERBOARD_NONPLAYER_DATA, "ZO_CampaignEmperorLeaderboardsNonPlayerRow", 30, function(control, data)
    end)
    ZO_ScrollList_AddDataType(self.list, ZO_EMPEROR_LEADERBOARD_PLAYER_DATA, "ZO_CampaignEmperorLeaderboardsPlayerRow", 30, function(control, data)
    end)
    CAMPAIGN_EMPEROR_FRAGMENT = ZO_FadeSceneFragment:New(ZO_CampaignEmperor)
    CAMPAIGN_EMPEROR_FRAGMENT:RegisterCallback("StateChange", function(oldState, newState)
        if newState == SCENE_FRAGMENT_SHOWN then
            QueryCampaignLeaderboardData(self.listAlliance)
            self:RefreshData()
            self:RefreshEmperor()
        end
    end)
end
function CampaignEmperor:ChangeAlliance(alliance, shownAllianceString)
    local leaderboardLabelControl = GetControl(self.control, "LeaderboardLabel")
    if leaderboardLabelControl then
        leaderboardLabelControl:SetText(zo_strformat(SI_CAMPAIGN_EMPEROR_LEADERBOARD, shownAllianceString))
    end
    CampaignEmperor_Shared.ChangeAlliance(self, alliance, shownAllianceString)
end
--Local XML
function CampaignEmperor:ImperialKeep_OnMouseEnter(control)
    InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
    SetTooltipText(InformationTooltip, zo_strformat(SI_TOOLTIP_KEEP_NAME, GetKeepName(control.keepId)))
end
function CampaignEmperor:ImperialKeep_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
end
function CampaignEmperor:IsIneligible_OnMouseEnter(control)
    InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
    SetTooltipText(InformationTooltip, GetString(SI_CAMPAIGN_EMPEROR_CHARACTER_INELIGIBLE_TEXT))
end
function CampaignEmperor:IsIneligible_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
end
function CampaignEmperor:OnDropdownClicked(control)
    local menuShowing = IsMenuVisible() and GetMenuOwner() == control
    ClearMenu()
    if not menuShowing then
        SetMenuSpacing(3)
        SetMenuPad(10)
        SetMenuMinimumWidth(185)
        for i = 1, #self.menuEntries do
            local entry = self.menuEntries[i]
            AddMenuItem(entry.textString, entry.callback)
        end
        
        ShowMenu(control)
        ZO_Menu:ClearAnchors()
        ZO_Menu:SetAnchor(TOPRIGHT, control, BOTTOMRIGHT, 0, 3)
    end
end
function CampaignEmperor:SetKeepAllianceNoneStatus(keep)
    keep:SetHidden(true)
end
--Global XML
    CAMPAIGN_EMPEROR:ImperialKeep_OnMouseEnter(control)
end
    CAMPAIGN_EMPEROR:ImperialKeep_OnMouseExit(control)
end
    CAMPAIGN_EMPEROR:OnDropdownClicked(control)
end
    CAMPAIGN_EMPEROR:IsIneligible_OnMouseEnter(control)
end
    CAMPAIGN_EMPEROR:IsIneligible_OnMouseExit(control)
end
    ZO_SocialListKeyboard.CharacterName_OnMouseEnter(CAMPAIGN_EMPEROR, control)
end
     ZO_SocialListKeyboard.CharacterName_OnMouseExit(CAMPAIGN_EMPEROR, control)
end
    CAMPAIGN_EMPEROR = CampaignEmperor:New(self)
end