ESO Lua File v100010

ingame/guild/guildroster.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
-----------------
--Friends List
-----------------
local ZO_GuildRosterManager = ZO_SocialList:Subclass()
local GUILD_MEMBER_DATA = 1
local GUILD_MEMBER_SEARCH = 1
local ENTRY_SORT_KEYS =
{
    ["displayName"] = { },
    ["status"]  = { tiebreaker = "normalizedLogoffSort", isNumeric = true },
    ["class"]  = { tiebreaker = "displayName" },
    ["zone"]  = { tiebreaker = "displayName" },
    ["alliance"] = { tiebreaker = "displayName" },
    ["veteranRank"] = { tiebreaker = "displayName", isNumeric = true},
    ["level"] = { tiebreaker = "veteranRank", isNumeric = true },
    ["rankIndex"] = { tiebreaker = "displayName", isNumeric = true },
    ["normalizedLogoffSort"] = { tiebreaker = "displayName", isNumeric = true },
}
function ZO_GuildRosterManager:New(control)
    local manager = ZO_SocialList.New(self, control)
    control:SetHandler("OnEffectivelyHidden", function() manager:OnEffectivelyHidden() end)
    manager.playerAlliance = GetUnitAlliance("player")
    
    ZO_ScrollList_AddDataType(manager.list, GUILD_MEMBER_DATA, "ZO_GuildRosterRow", 30, function(control, data) manager:SetupGuildMember(control, data) end)
    ZO_ScrollList_EnableHighlight(manager.list, "ZO_ThinListHighlight")
    manager.searchBox = GetControl(control, "SearchBox")
    manager.searchBox:SetHandler("OnTextChanged", function() manager:OnSearchTextChanged() end)
    manager.search = ZO_StringSearch:New()
    manager.search:AddProcessor(GUILD_MEMBER_SEARCH, function(stringSearch, data, searchTerm, cache) return manager:ProcessGuildMember(stringSearch, data, searchTerm, cache) end)
    manager.sortFunction = function(listEntry1, listEntry2) return manager:CompareGuildMembers(listEntry1, listEntry2) end
    manager.noteEditedFunction =    function(displayName, note)
                                        local numGuildMembers = GetNumGuildMembers(manager.guildId)
                                        for guildMemberIndex = 1, numGuildMembers do       
                                            local currentDisplayName = GetGuildMemberInfo(manager.guildId, guildMemberIndex)
                                            if(currentDisplayName == displayName) then
                                                SetGuildMemberNote(manager.guildId, guildMemberIndex, note)
                                            end
                                        end
                                    end
    manager.masterList = {}
    manager:RefreshData()
    manager.sortHeaderGroup:SelectHeaderByKey("status")
    
    control:RegisterForEvent(EVENT_GUILD_DATA_LOADED, function() manager:OnGuildDataLoaded() end)
    control:RegisterForEvent(EVENT_GUILD_RANKS_CHANGED, function(_, guildId) if(manager:MatchesGuild(guildId)) then manager:OnGuildRanksChanged() end end) 
    control:RegisterForEvent(EVENT_GUILD_MEMBER_ADDED, function(_, guildId, displayName) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberAdded(guildId, displayName) end end)
     control:RegisterForEvent(EVENT_GUILD_SELF_JOINED_GUILD, function(_, guildId, displayName) manager:OnGuildSelfJoined() end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_REMOVED, function(_, guildId, displayName, characterName) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberRemoved(guildId, characterName) end end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_CHARACTER_UPDATED, function(_, guildId, displayName) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberCharacterUpdated(displayName) end end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_CHARACTER_ZONE_CHANGED, function(_, guildId, displayName, characterName, zone) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberCharacterZoneChanged(displayName, characterName, zone) end end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_CHARACTER_LEVEL_CHANGED, function(_, guildId, displayName, characterName, level) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberCharacterLevelChanged(displayName, characterName, level) end end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_CHARACTER_VETERAN_RANK_CHANGED, function(_, guildId, displayName, characterName, veteranRank) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberCharacterVeteranRankChanged(displayName, characterName, veteranRank) end end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_RANK_CHANGED, function(_, guildId, displayName, rankIndex) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberRankChanged(displayName, rankIndex) end end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_PLAYER_STATUS_CHANGED, function(_, guildId, displayName, oldStatus, newStatus) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberPlayerStatusChanged(displayName, oldStatus, newStatus) end end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_NOTE_CHANGED, function(_, guildId, displayName, note) if(manager:MatchesGuild(guildId)) then manager:OnGuildMemberNoteChanged(displayName, note) end end)
    manager:InitializeKeybindDescriptor()
    GUILD_ROSTER_SCENE = ZO_Scene:New("guildRoster", SCENE_MANAGER)
    GUILD_ROSTER_SCENE:RegisterCallback("StateChange",  function(oldState, newState)
                                                            if(newState == SCENE_SHOWING) then                                          
                                                                KEYBIND_STRIP:AddKeybindButtonGroup(manager.keybindStripDescriptor)
                                                            elseif(newState == SCENE_HIDDEN) then                                                        
                                                                KEYBIND_STRIP:RemoveKeybindButtonGroup(manager.keybindStripDescriptor)
                                                            end
                                                        end)
    return manager
end
function ZO_GuildRosterManager:InitializeKeybindDescriptor()
    self.keybindStripDescriptor =
    {
        -- Invite
        {
            alignment = KEYBIND_STRIP_ALIGN_CENTER,
            name = GetString(SI_GUILD_INVITE_ACTION),
            keybind = "UI_SHORTCUT_PRIMARY",
        
            callback = function()
                local name = GetGuildName(self.guildId)
                ZO_Dialogs_ShowDialog("GUILD_INVITE", self.guildId, {mainTextParams = {name}})
            end,
            visible = function()
                return DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_INVITE)
            end
        },
        
        -- Whisper
        {
            alignment = KEYBIND_STRIP_ALIGN_RIGHT,
            name = GetString(SI_SOCIAL_LIST_PANEL_WHISPER),
            keybind = "UI_SHORTCUT_SECONDARY",
        
            callback = function()
                local data = ZO_ScrollList_GetData(self.mouseOverRow)
                StartChatInput("", CHAT_CHANNEL_WHISPER, data.displayName)
            end,
            visible = function()
                if(self.mouseOverRow) then
                    local data = ZO_ScrollList_GetData(self.mouseOverRow)
                    return data.hasCharacter and data.online and not data.isLocalPlayer
                end
                return false
            end
        },
        -- Invite to Group
        {
            alignment = KEYBIND_STRIP_ALIGN_RIGHT,
            name = GetString(SI_FRIENDS_LIST_PANEL_INVITE),
            keybind = "UI_SHORTCUT_TERTIARY",
        
            callback = function()
                local data = ZO_ScrollList_GetData(self.mouseOverRow)
                local NOT_SENT_FROM_CHAT = false
                local DISPLAY_INVITED_MESSAGE = true
                TryGroupInviteByName(data.characterName, NOT_SENT_FROM_CHAT, DISPLAY_INVITED_MESSAGE)
            end,
            visible = function()
                if(self.mouseOverRow) then
                    local data = ZO_ScrollList_GetData(self.mouseOverRow)
                    if(data.hasCharacter and data.online and data.alliance == self.playerAlliance and not data.isLocalPlayer) then                        
                        return true
                    end
                end
                return false
            end
        },  
    }    
end
function ZO_GuildRosterManager:MatchesGuild(guildId)
    if(guildId == self.guildId) then
        return true
    end
    return false
end
function ZO_GuildRosterManager:SetGuildId(guildId)
    self.guildId = guildId
    self.searchBox:SetText("")
    self.searchBox:LoseFocus()
    self.guildName = GetGuildName(guildId)
    self.guildAlliance = GetGuildAlliance(guildId)
    self:RefreshAll()
end
function ZO_GuildRosterManager:RefreshAll()
    self:RefreshData()
end
function ZO_GuildRosterManager:RefreshRankDependentControls()
    self:RefreshVisible()
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
function ZO_GuildRosterManager:ColorRow(control, data, mouseIsOver)
    ZO_SocialList.ColorRow(self, control, data, mouseIsOver)
    
    if(not self.lockedForUpdates) then
        local _, iconColor = self:GetRowColors(data, mouseIsOver)
        local rank = GetControl(control, "Rank")
        rank:SetColor(iconColor:UnpackRGBA())
    end
end
function ZO_GuildRosterManager:SetupGuildMember(control, data)
    local note = GetControl(control, "Note")
    if(data.note ~= "") then
        note:SetHidden(false)
        if(DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_NOTE_EDIT)) then
            note:SetState(BSTATE_NORMAL, false)
        else
            note:SetState(BSTATE_DISABLED, true)
        end
    else
        note:SetHidden(true)
    end
    local rank = GetControl(control, "Rank")
    local rankTexture = GetFinalGuildRankTextureSmall(self.guildId, data.rankIndex)
    if(rankTexture) then
        rank:SetHidden(false)
        rank:SetTexture(rankTexture)
    else
        rank:SetHidden(true)
    end
end
function ZO_GuildRosterManager:ProcessGuildMember(stringSearch, data, searchTerm, cache)
    local lowerSearchTerm = searchTerm:lower()
    if(zo_plainstrfind(data.displayName:lower(), lowerSearchTerm)) then
        return true
    end
    if(data.characterName ~= nil and zo_plainstrfind(data.characterName:lower(), lowerSearchTerm)) then
        return true
    end
end
function ZO_GuildRosterManager:BuildMasterList()
    local guildId = self.guildId
    local localPlayerIndex = GetPlayerGuildMemberIndex(guildId)
    local numGuildMembers = GetNumGuildMembers(guildId)
    for guildMemberIndex = 1, numGuildMembers do
        local displayName, note, rankIndex, status, secsSinceLogoff = GetGuildMemberInfo(guildId, guildMemberIndex)
        local online = (status ~= PLAYER_STATUS_OFFLINE)
        local rankId = GetGuildRankId(guildId, rankIndex)
        local isLocalPlayer = (localPlayerIndex > 0 and guildMemberIndex == localPlayerIndex)        
        local hasCharacter, rawCharacterName, zone, class, alliance, level, veteranRank = GetGuildMemberCharacterInfo(guildId, guildMemberIndex)
       
        local data =  {  
                            index = guildMemberIndex,
                            displayName=displayName,
                            hasCharacter = hasCharacter,
                            isLocalPlayer = isLocalPlayer, 
                            characterName = zo_strformat(SI_UNIT_NAME, rawCharacterName), 
                            gender = GetGenderFromNameDescriptor(rawCharacterName),
                            level = level, 
                            veteranRank = veteranRank, 
                            class = class, 
                            zone = zone,                            
                            alliance = alliance, 
                            note = note,
                            rankIndex = rankIndex,
                            rankId = rankId,
                            type = GUILD_MEMBER_SEARCH,
                            status = status,
                        }
        self:SetUpOnlineData(data, online, secsSinceLogoff)
        self.masterList[guildMemberIndex] = data
    end
end
function ZO_GuildRosterManager:FilterScrollList()
    local scrollData = ZO_ScrollList_GetDataList(self.list)
    ZO_ClearNumericallyIndexedTable(scrollData)
    local searchTerm = self.searchBox:GetText()
    for i = 1, #self.masterList do
        local data = self.masterList[i]
        if(searchTerm == "" or self.search:IsMatch(searchTerm, data)) then
            table.insert(scrollData, ZO_ScrollList_CreateDataEntry(GUILD_MEMBER_DATA, data))
        end
    end    
end
function ZO_GuildRosterManager:CompareGuildMembers(listEntry1, listEntry2)
    return ZO_TableOrderingFunction(listEntry1.data, listEntry2.data, self.currentSortKey, ENTRY_SORT_KEYS, self.currentSortOrder)
end
function ZO_GuildRosterManager:SortScrollList()
    if(self.currentSortKey ~= nil and self.currentSortOrder ~= nil) then
        local scrollData = ZO_ScrollList_GetDataList(self.list)
        table.sort(scrollData, self.sortFunction)
    end
end
function ZO_GuildRosterManager:UnlockSelection()
    ZO_SortFilterList.UnlockSelection(self)
    self:RefreshVisible()
end
function ZO_GuildRosterManager:FindDataByDisplayName(displayName)
    for i = 1, #self.masterList do
        local data = self.masterList[i]
        if(data.displayName == displayName) then
            return data
        end
    end
end
--Events
---------
function ZO_GuildRosterManager:OnGuildDataLoaded()
    self:RefreshAll()
end
function ZO_GuildRosterManager:OnGuildMemberAdded(guildId, displayName)
    self:RefreshData()
    if(DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_INVITE)) then
        local data = self:FindDataByDisplayName(displayName)
        if(data) then
            local hasCharacter, rawCharacterName, zone, class, alliance, level, veteranRank = GetGuildMemberCharacterInfo(self.guildId, data.index)
            ZO_Alert(UI_ALERT_CATEGORY_ALERT, SOUNDS.GUILD_ROSTER_ADDED, zo_strformat(SI_GUILD_ROSTER_ADDED, rawCharacterName, self.guildName))
        end
    end
end
function ZO_GuildRosterManager:OnGuildSelfJoined()
     PlaySound(SOUNDS.GUILD_SELF_JOINED)
end
function ZO_GuildRosterManager:OnGuildMemberRemoved(guildId, rawCharacterName)
    if(DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_INVITE)) then
          if(ShouldDisplayGuildMemberRemoveAlert(rawCharacterName)) then
               ZO_Alert(UI_ALERT_CATEGORY_ALERT, SOUNDS.GUILD_ROSTER_REMOVED, zo_strformat(SI_GUILD_ROSTER_REMOVED, rawCharacterName, self.guildName))
          else
               PlaySound(SOUNDS.GUILD_ROSTER_REMOVED)
          end
    end
    self:RefreshData()
end
function ZO_GuildRosterManager:OnGuildMemberCharacterUpdated(displayName)
    local data = self:FindDataByDisplayName(displayName)
    if(data) then
        local hasCharacter, rawCharacterName, zone, class, alliance, level, veteranRank = GetGuildMemberCharacterInfo(self.guildId, data.index)
        data.hasCharacter = hasCharacter
        data.characterName = zo_strformat(SI_UNIT_NAME, rawCharacterName)
        data.gender = GetGenderFromNameDescriptor(rawCharacterName)
        data.zone = zone
        data.class = class
        data.alliance = alliance
        data.level = level
        data.veteranRank = veteranRank
        self:RefreshFilters()
    end
end
function ZO_GuildRosterManager:OnGuildMemberCharacterZoneChanged(displayName, characterName, zone)
    local data = self:FindDataByDisplayName(displayName)
    if(data) then
        data.zone = zone
        self:RefreshSort()
    end
end
function ZO_GuildRosterManager:OnGuildMemberCharacterLevelChanged(displayName, characterName, level)
    local data = self:FindDataByDisplayName(displayName)
    if(data) then
        data.level = level
        self:RefreshSort()
    end
end
function ZO_GuildRosterManager:OnGuildMemberCharacterVeteranRankChanged(displayName, characterName, veteranRank)
    local data = self:FindDataByDisplayName(displayName)
    if(data) then
        data.veteranRank = veteranRank
        self:RefreshSort()
    end
end
function ZO_GuildRosterManager:OnGuildMemberRankChanged(displayName, rankIndex)
    local data = self:FindDataByDisplayName(displayName)
    if(data) then
        data.rankIndex = rankIndex
        self:RefreshSort()
        local playerIndex = GetPlayerGuildMemberIndex(self.guildId)
        local playerDisplayName = GetGuildMemberInfo(self.guildId, playerIndex)
        if(playerDisplayName == displayName) then
            self:RefreshRankDependentControls()
        end
    end
end
function ZO_GuildRosterManager:OnGuildMemberPlayerStatusChanged(displayName, oldStatus, newStatus)
    local data = self:FindDataByDisplayName(displayName)
    if(data) then
        --Because we may have refreshed the whole list in between when this event happened and when we received it,
        --we must use our conception of whether they were online, not whether they were online or not when the event happened.
        local wasOnline = data.online
        local isOnline = (newStatus ~= PLAYER_STATUS_OFFLINE)
        data.status = newStatus
        if(wasOnline and not isOnline) then
            self:SetUpOnlineData(data, false, 0)
        elseif(not wasOnline and isOnline) then
            self:SetUpOnlineData(data, true) 
            local hasCharacter, rawCharacterName, zone, class, alliance, level, veteranRank = GetGuildMemberCharacterInfo(self.guildId, data.index)
            data.characterName = zo_strformat(SI_UNIT_NAME, rawCharacterName)
            data.gender = GetGenderFromNameDescriptor(rawCharacterName)
            data.zone = zone
            data.class = class
            data.alliance = alliance
            data.level = level
            data.veteranRank = veteranRank
        end
        self:RefreshSort()
    end
end
function ZO_GuildRosterManager:OnGuildMemberNoteChanged(displayName, note)
    local data = self:FindDataByDisplayName(displayName)
    if(data) then
        data.note = note
        self:RefreshVisible()
    end
end
function ZO_GuildRosterManager:OnGuildRanksChanged()
    self:RefreshAll()
end
function ZO_GuildRosterManager:OnUpdate(control, currentTime)
    if(currentTime - self.lastUpdateTime > OFFLINE_TIME_UPDATE) then 
          self.lastUpdateTime = currentTime
          self:RefreshVisible()
     end
end
function ZO_GuildRosterManager:OnEffectivelyHidden()
    ClearMenu()
end
function ZO_GuildRosterManager:OnSearchTextChanged()
    self:RefreshFilters()
end
function ZO_GuildRosterManager:GuildRosterRow_OnMouseUp(control, button, upInside)
    if(button == 2 and upInside) then
        ClearMenu()        
        local data = ZO_ScrollList_GetData(control)
        if data then
            local dataIndex = data.index
            local playerIndex = GetPlayerGuildMemberIndex(self.guildId)        
            local playerData = self.masterList[playerIndex]
            local playerHasHigherRank = playerData.rankIndex < data.rankIndex
            local playerIsGuildmaster = IsGuildRankGuildMaster(self.guildId, playerData.rankIndex)
            if(DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_PROMOTE)) then
                if(data.rankIndex > 1) then                
                    if(playerData.rankIndex < (data.rankIndex - 1)) then
                        AddMenuItem(GetString(SI_GUILD_PROMOTE), function() GuildPromote(self.guildId, data.displayName); PlaySound(SOUNDS.GUILD_ROSTER_PROMOTE) end)
                    elseif(playerIsGuildmaster) then
                        AddMenuItem(GetString(SI_GUILD_PROMOTE),    function()
                                                                        local allianceIcon = zo_iconFormat(GetAllianceBannerIcon(self.guildAlliance), 17, 17)
                                                                        local rankName = GetFinalGuildRankName(self.guildId, 2)
                                                                        ZO_Dialogs_ShowDialog("PROMOTE_TO_GUILDMASTER", {guildId = self.guildId, displayName = data.displayName}, { mainTextParams = { data.displayName, allianceIcon, self.guildName,  rankName}})  
                                                                    end)
                    end
                end
            end
            if(DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_DEMOTE)) then
                if(data.rankIndex < GetNumGuildRanks(self.guildId)) then
                    if(playerHasHigherRank) then
                        AddMenuItem(GetString(SI_GUILD_DEMOTE), function()
                                                                    GuildDemote(self.guildId, data.displayName)
                                                                    PlaySound(SOUNDS.GUILD_ROSTER_DEMOTE)
                                                                end)
                    end
                end            
            end
            if(DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_REMOVE)) then
                if(playerHasHigherRank and playerIndex ~= dataIndex) then
                         local allianceIcon = zo_iconFormat(GetAllianceBannerIcon(self.guildAlliance), 17, 17)
                    AddMenuItem(GetString(SI_GUILD_REMOVE), function()
                                                                                ZO_Dialogs_ShowDialog("GUILD_REMOVE_MEMBER", {guildId = self.guildId,  displayName = data.displayName}, { mainTextParams = { data.displayName, allianceIcon, self.guildName }})                                                                
                                                            end)
                end
            end
            if(DoesPlayerHaveGuildPermission(self.guildId, GUILD_PERMISSION_NOTE_EDIT)) then
                AddMenuItem(GetString(SI_SOCIAL_MENU_EDIT_NOTE),    function()
                                                                        ZO_Dialogs_ShowDialog("EDIT_NOTE", {displayName = data.displayName, note = data.note, changedCallback = self.noteEditedFunction})
                                                                    end)
            end
            if(dataIndex == playerIndex) then
                    ZO_AddLeaveGuildMenuItem(self.guildId)
            else
                if(data.hasCharacter and data.online) then
                    AddMenuItem(GetString(SI_SOCIAL_LIST_SEND_MESSAGE), function() StartChatInput("", CHAT_CHANNEL_WHISPER, data.displayName) end)
                    if(data.alliance == self.playerAlliance) then
                        AddMenuItem(GetString(SI_SOCIAL_MENU_INVITE), function() 
                        local NOT_SENT_FROM_CHAT = false
                        local DISPLAY_INVITED_MESSAGE = true
                        TryGroupInviteByName(data.characterName, NOT_SENT_FROM_CHAT, DISPLAY_INVITED_MESSAGE) 
                        end)
                        AddMenuItem(GetString(SI_SOCIAL_MENU_JUMP_TO_PLAYER), function() JumpToGuildMember(data.displayName) end)
                    end
                end
                AddMenuItem(GetString(SI_SOCIAL_MENU_SEND_MAIL), function() MAIL_SEND:ComposeMailTo(data.displayName) end)
                if(not IsFriend(data.displayName)) then
                    AddMenuItem(GetString(SI_SOCIAL_MENU_ADD_FRIEND), function() ZO_Dialogs_ShowDialog("REQUEST_FRIEND", {name = data.displayName}) end)
                end
            end        
            self:ShowMenu(control)
        end
    end
end
function ZO_GuildRosterManager:GuildRosterRowRank_OnMouseEnter(control)
    local row = control:GetParent()
    local data = ZO_ScrollList_GetData(row)
    if(data.rankIndex) then
        InitializeTooltip(InformationTooltip, control, BOTTOM, 0, 0)
        SetTooltipText(InformationTooltip, GetFinalGuildRankName(self.guildId, data.rankIndex))
    end
    self:EnterRow(row)
end
function ZO_GuildRosterManager:GuildRosterRowRank_OnMouseExit(control)
    ClearTooltip(InformationTooltip)
end
--Global XML
---------------
    GUILD_ROSTER:Row_OnMouseEnter(control)
end
    GUILD_ROSTER:Row_OnMouseExit(control)
end
function ZO_GuildRosterRow_OnMouseUp(control, button, upInside)
    GUILD_ROSTER:GuildRosterRow_OnMouseUp(control, button, upInside)
end
    GUILD_ROSTER:Note_OnMouseEnter(control)
end
    GUILD_ROSTER:Note_OnMouseExit(control)
end
    GUILD_ROSTER:Note_OnClicked(control)
end
    GUILD_ROSTER:DisplayName_OnMouseEnter(control)
end
    GUILD_ROSTER:DisplayName_OnMouseExit(control)
end
    GUILD_ROSTER:Alliance_OnMouseEnter(control)
end
    GUILD_ROSTER:Alliance_OnMouseExit(control)
end
    GUILD_ROSTER:Status_OnMouseEnter(control)
end
    GUILD_ROSTER:Status_OnMouseExit(control)
end
    GUILD_ROSTER:Class_OnMouseEnter(control)
end
    GUILD_ROSTER:Class_OnMouseExit(control)
end
end
end
    GUILD_ROSTER = ZO_GuildRosterManager:New(control)
end