Back to Home

ESO Lua File v100031

ingame/group/gamepad/zo_grouplist_gamepad.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
--Layout consts, defining the widths of the list's columns as provided by design--
ZO_GAMEPAD_GROUP_LIST_USER_FACING_NAME_WIDTH = 350 - ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_HEADER_DOUBLE_PADDING_X
ZO_GAMEPAD_GROUP_LIST_CHARACTER_NAME_WIDTH = 240 - ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_HEADER_DOUBLE_PADDING_X
ZO_GAMEPAD_GROUP_LIST_ZONE_WIDTH = 270 - ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_HEADER_DOUBLE_PADDING_X
ZO_GAMEPAD_GROUP_LIST_ROLES_WIDTH = 125 - ZO_GAMEPAD_INTERACTIVE_FILTER_LIST_HEADER_DOUBLE_PADDING_X
local SORT_KEYS =
{
    ["displayName"] = { },
    ["characterName"] = { },
    ["formattedZone"] = { tiebreaker = "displayName" },
    ["class"] = { tiebreaker = "displayName" },
    ["championPoints"] = { tiebreaker = "displayName", isNumeric = true },
    ["level"] = { tiebreaker = "championPoints", isNumeric = true },
    ["status"] = { tiebreaker = "displayName", isNumeric = true},
}
----------------------------------
--Group List Gamepad
----------------------------------
local GroupList_Gamepad = ZO_GamepadSocialListPanel:Subclass()
function GroupList_Gamepad:New(...)
    return ZO_GamepadSocialListPanel.New(self, ...)
end
function GroupList_Gamepad:Initialize(control)
    ZO_GamepadSocialListPanel.Initialize(self, control, GROUP_LIST_MANAGER, "ZO_GroupListRow_Gamepad")
    self:SetEmptyText(GetString(SI_GROUP_LIST_PANEL_NO_GROUP_MESSAGE));
    self:SetupSort(SORT_KEYS, "displayName", ZO_SORT_ORDER_UP)
end
function GroupList_Gamepad:GetBackKeybindCallback()
    return function()
        GAMEPAD_GROUP_MENU:SelectMenuList()
    end
end
function GroupList_Gamepad:SetupRow(control, data, selected)
    local fontColor = data.online and ZO_NORMAL_TEXT or ZO_DISABLED_TEXT
    local displayNameControl = control:GetNamedChild("DisplayName")
    local characterNameControl = control:GetNamedChild("CharacterName")
    if data.leader then
        displayNameControl:SetText(zo_iconTextFormat("EsoUI/Art/UnitFrames/Gamepad/gp_Group_Leader.dds", 32, 32, ZO_FormatUserFacingDisplayName(data.displayName)))
        characterNameControl:SetText(ZO_FormatUserFacingCharacterName(data.characterName))
    end
    displayNameControl:SetColor(fontColor:UnpackRGB())
    
    local rolesControl = control:GetNamedChild("Roles")
    local dpsIcon = rolesControl:GetNamedChild("DPS")
    local healIcon = rolesControl:GetNamedChild("Heal")
    local tankIcon = rolesControl:GetNamedChild("Tank")
    dpsIcon:SetTexture(GetGamepadRoleIcon(LFG_ROLE_DPS))
    healIcon:SetTexture(GetGamepadRoleIcon(LFG_ROLE_HEAL))
    tankIcon:SetTexture(GetGamepadRoleIcon(LFG_ROLE_TANK))
    
    dpsIcon:SetAlpha(data.isDps and ZO_GAMEPAD_ICON_SELECTED_ALPHA or ZO_GAMEPAD_ICON_UNSELECTED_ALPHA)
    healIcon:SetAlpha(data.isHeal and ZO_GAMEPAD_ICON_SELECTED_ALPHA or ZO_GAMEPAD_ICON_UNSELECTED_ALPHA)
    tankIcon:SetAlpha(data.isTank and ZO_GAMEPAD_ICON_SELECTED_ALPHA or ZO_GAMEPAD_ICON_UNSELECTED_ALPHA)
end
function GroupList_Gamepad:OnShown()
    ZO_GamepadSocialListPanel.OnShowing(self)
    self:RefreshData()
end
function GroupList_Gamepad:RefreshData()
    if not self.control:IsHidden() then
        ZO_GamepadSocialListPanel.RefreshData(self)
    end
    GAMEPAD_GROUP_ROLES_BAR:UpdateEnabledState()
end
function GroupList_Gamepad:RefreshTooltip()
    --Do nothing, because group list doesn't use a tooltip like other social lists
end
----------------------------------
-- ZO_SocialOptionsDialogGamepad--
----------------------------------
function GroupList_Gamepad:BuildOptionsList()
    local groupingId = self:AddOptionTemplateGroup(ZO_SocialOptionsDialogGamepad.GetDefaultHeader)
    local function BuildTravelToGroupPlayerOption()
    end
    self:AddOptionTemplate(groupingId, BuildTravelToGroupPlayerOption, ZO_SocialOptionsDialogGamepad.SelectedDataIsLoggedIn)
    self:AddOptionTemplate(groupingId, ZO_SocialOptionsDialogGamepad.BuildWhisperOption, ZO_SocialOptionsDialogGamepad.ShouldAddWhisperOption)
    
    local function CanKickMember()
        return IsGroupModificationAvailable() and not DoesGroupModificationRequireVote() and IsUnitGroupLeader("player") and not self:SelectedDataIsPlayer()
    end
    local function CanVoteForKickMember()
    end
    local function ShouldAddPromoteOption()
        return IsUnitGroupLeader("player") and self.socialData.online and not self:SelectedDataIsPlayer()
    end
    local function CanJumpToPlayerHouse()
       return not self:SelectedDataIsPlayer()
    end
    self:AddOptionTemplate(groupingId, GroupList_Gamepad.BuildPromoteToLeaderOption, ShouldAddPromoteOption)
    self:AddOptionTemplate(groupingId, GroupList_Gamepad.BuildKickMemberOption, CanKickMember)
    self:AddOptionTemplate(groupingId, GroupList_Gamepad.BuildVoteKickMemberOption, CanVoteForKickMember)
    self:AddOptionTemplate(groupingId, ZO_SocialOptionsDialogGamepad.BuildGamerCardOption, IsConsoleUI)
    self:AddOptionTemplate(groupingId, ZO_SocialOptionsDialogGamepad.BuildAddFriendOption, ZO_SocialOptionsDialogGamepad.ShouldAddFriendOption)
    self:AddOptionTemplate(groupingId, ZO_SocialOptionsDialogGamepad.BuildVisitPlayerHouseOption, CanJumpToPlayerHouse)
end
function GroupList_Gamepad:BuildPromoteToLeaderOption()
    local callback = function()
        GroupPromote(self.socialData.unitTag)
    end
    return self:BuildOptionEntry(nil, SI_GROUP_LIST_MENU_PROMOTE_TO_LEADER, callback)
end
function GroupList_Gamepad:BuildKickMemberOption()
    local callback = function()
        GroupKick(self.socialData.unitTag)
    end
    return self:BuildOptionEntry(nil, SI_GROUP_LIST_MENU_KICK_FROM_GROUP, callback)
end
function GroupList_Gamepad:BuildVoteKickMemberOption()
    local callback = function()
        BeginGroupElection(GROUP_ELECTION_TYPE_KICK_MEMBER, ZO_GROUP_ELECTION_DESCRIPTORS.NONE, self.socialData.unitTag)
    end
    return self:BuildOptionEntry(nil, SI_GROUP_LIST_MENU_VOTE_KICK_FROM_GROUP, callback)
end
-------------
--XML calls--
-------------
    GROUP_LIST_GAMEPAD = GroupList_Gamepad:New(control)
end