Back to Home

ESO Lua File v101042

ingame/contacts/keyboard/sociallist_keyboard.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
--Social List
ZO_SocialListKeyboard = ZO_Object.MultiSubclass(ZO_SortFilterList, ZO_SocialListDirtyLogic_Shared)
function ZO_SocialListKeyboard:InitializeSortFilterList(control)
    ZO_SortFilterList.InitializeSortFilterList(self, control)
end
function ZO_SocialListKeyboard:SetUpOnlineData(data, online, secsSinceLogoff)
    ZO_SocialList_SetUpOnlineData(data, online, secsSinceLogoff)
end
function ZO_SocialListKeyboard:GetRowColors(data, selected)
    return ZO_SocialList_GetRowColors(data, selected)
end
function ZO_SocialListKeyboard:ColorRow(control, data, mouseIsOver)
    local textColor, iconColor = self:GetRowColors(data, mouseIsOver)
    ZO_SocialList_ColorRow(control, data, textColor, iconColor, textColor)
end
function ZO_SocialListKeyboard:SharedSocialSetup(control, data)
    ZO_SortFilterList.SetupRow(self, control, data)
end
function ZO_SocialListKeyboard:UpdateHideOfflineCheckBox(checkBox)
    local hideOfflineSetting = GetSetting_Bool(SETTING_TYPE_UI, UI_SETTING_SOCIAL_LIST_HIDE_OFFLINE)
    if hideOfflineSetting ~= ZO_CheckButton_IsChecked(checkBox) then
        if hideOfflineSetting then
            ZO_CheckButton_SetChecked(checkBox)
        else
            ZO_CheckButton_SetUnchecked(checkBox)
        end
        self:RefreshFilters()
    end
end
--XML
function ZO_SocialListKeyboard:Note_OnMouseEnter(control)
    if data then
        InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
        SetTooltipText(InformationTooltip, data.note)
    end
end
function ZO_SocialListKeyboard:Note_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
end
function ZO_SocialListKeyboard:Note_OnClicked(control, noteEditedFunction)
    if data then
        ZO_Dialogs_ShowDialog("EDIT_NOTE", {displayName = data.displayName, note = data.note, changedCallback = noteEditedFunction})
    end
end
function ZO_SocialListKeyboard:DisplayName_OnMouseEnter(control)
    local row = control:GetParent()
    local data = ZO_ScrollList_GetData(row)
    if data and data.hasCharacter then
        InitializeTooltip(InformationTooltip)
        local textWidth = control:GetTextDimensions()
        InformationTooltip:ClearAnchors()
        InformationTooltip:SetAnchor(BOTTOM, control, TOPLEFT, textWidth * 0.5, 0)
        SetTooltipText(InformationTooltip, ZO_FormatUserFacingCharacterName(data.characterName))
    end
    self:EnterRow(row)
end
function ZO_SocialListKeyboard:DisplayName_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
    local row = control:GetParent()
    self:ExitRow(row)
end
function ZO_SocialListKeyboard:CharacterName_OnMouseEnter(control)
    local row = control:GetParent()
    local data = ZO_ScrollList_GetData(row)
    if data and data.displayName then
        InitializeTooltip(InformationTooltip)
        local textWidth = control:GetTextDimensions()
        InformationTooltip:ClearAnchors()
        InformationTooltip:SetAnchor(BOTTOM, control, TOPLEFT, textWidth * 0.5, 0)
        SetTooltipText(InformationTooltip, data.displayName)
    end
    self:EnterRow(row)
end
function ZO_SocialListKeyboard:CharacterName_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
    local row = control:GetParent()
    self:ExitRow(row)
end
function ZO_SocialListKeyboard:Alliance_OnMouseEnter(control)
    local row = control:GetParent()
    local data = ZO_ScrollList_GetData(row)
    if data and data.alliance then
        InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
        SetTooltipText(InformationTooltip, data.formattedAllianceName)
    end
    self:EnterRow(row)
end
function ZO_SocialListKeyboard:Alliance_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
end
function ZO_SocialListKeyboard:Status_OnMouseEnter(control)
    local row = control:GetParent()
    local data = ZO_ScrollList_GetData(row)
    if data and data.status then
        InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)        
        if data.status == PLAYER_STATUS_OFFLINE then
            SetTooltipText(InformationTooltip, zo_strformat(SI_SOCIAL_LIST_LAST_ONLINE, ZO_FormatDurationAgo(data.secsSinceLogoff + GetFrameTimeSeconds() - data.timeStamp)))
        else
            SetTooltipText(InformationTooltip, GetString("SI_PLAYERSTATUS", data.status))
        end
    end
    self:EnterRow(row)
end
function ZO_SocialListKeyboard:Status_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
end
local function GetClassNameFromData(data)
    local gender = data.gender or GENDER_MALE
    return zo_strformat(SI_CLASS_NAME, GetClassName(gender, data.class))
end
function ZO_SocialListKeyboard:Class_OnMouseEnter(control)
    local row = control:GetParent()
    local data = ZO_ScrollList_GetData(row)
    if data and data.class then
        InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
        SetTooltipText(InformationTooltip, GetClassNameFromData(data))
    end
    self:EnterRow(row)
end
function ZO_SocialListKeyboard:Class_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
end
function ZO_SocialListKeyboard:Champion_OnMouseEnter(control)
    local row = control:GetParent()
    self:EnterRow(row)
end
function ZO_SocialListKeyboard:Champion_OnMouseExit(control)
end
function ZO_SocialListKeyboard:HideOffline_OnClicked()
     SetSetting(SETTING_TYPE_UI, UI_SETTING_SOCIAL_LIST_HIDE_OFFLINE, tostring(not GetSetting_Bool(SETTING_TYPE_UI, UI_SETTING_SOCIAL_LIST_HIDE_OFFLINE)))
     self:RefreshFilters()
     self:UpdateKeybinds()
end