-
Notifications
You must be signed in to change notification settings - Fork 0
/
Members.lua
758 lines (603 loc) · 28.2 KB
/
Members.lua
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
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
local listLength = 0;
local scrollFrame;
local slider;
local scrollChild;
local previousSelection = "Online";
local previousSpecFilter = "All specs";
local previousProfessionFilter = "All professions";
local previousKeySort = "";
local direction = 'ASC';
local currentKeySort = "";
local playerName = UnitName("player");
local playerRank = "";
function LaFratellanza_SplitString(inputString)
local words = {};
for word in string.gmatch(inputString, "[^%s/-]+") do
table.insert(words, LaFratellanza_ToLowerCase(word));
end
return words;
end
function LaFratellanza_RefreshMembers() --lasciare così questa funzione
GuildRoster();
-- set a true della variabile config guildShowOffline (se è disattivata, getNumGuildMembers torna solo il numero di player online)
SetCVar("guildShowOffline", 1); --questo oltre a mostrare anche i membri offline trigghera GUILD_ROSTER_UPDATE
SetCVar("guildShowOffline", 0);
end
function LaFratellanza_DecodeNote(elements, result, name)
local indexProf = 1;
local indexSpec = 1;
for i, element in ipairs(elements) do
if element == "main" then
result.isAlt = false;
elseif element == "alt" then
result.isAlt = true;
else
if LaFratellanza_prof_table[element] ~= nil then
if indexProf == 1 then
result["prof"].main = LaFratellanza_prof_table[element];
indexProf = 2;
elseif indexProf == 2 then
result["prof"].off = LaFratellanza_prof_table[element];
end
elseif LaFratellanza_spec_table[element] ~= nil then
if indexSpec == 1 then
result["spec"].main = LaFratellanza_spec_table[element];
indexSpec = 2;
elseif indexSpec == 2 then
result["spec"].off = LaFratellanza_spec_table[element];
end
elseif LaFratellanza_guild_roster_names[element] then
result.altOf = LaFratellanza_guild_roster_names[element];
end
end
end
end
function LaFratellanza_GetMemberProps(idx, name, rank, rankIndex, lvl, cl, zone, note, offNote, online, status, class)
local result = { idx = idx, name = name, lvl = lvl, cl = cl, zone = zone, note = note, offNote = offNote, online = online, status = status, class = class,
rank = LaFratellanza_ToLowerCase(LaFratellanza_Trim(rank)),
rankIndex = rankIndex,
prof = {},
spec = {},
isAlt = false,
altOf = '',
};
-- ALT ha uno spazio alla fine
-- todo: stringa da trimmare
if rank == "ALT " then
result.isAlt = true;
end
local elements = LaFratellanza_SplitString(note);
LaFratellanza_DecodeNote(elements, result, name);
return result;
end
function LaFratellanza_InitNoteFrame()
LaFratellanza_note_frame = CreateFrame("Frame", "LaFratellanza_Note_Frame", LaFratellanza_main_frame);
LaFratellanza_note_frame:SetSize(256, 256);
LaFratellanza_note_frame:SetPoint("LEFT", LaFratellanza_main_frame, "BOTTOMRIGHT", -15, 160);
LaFratellanza_note_frame:SetBackdrop({
bgFile = "Interface\\AddOns\\LaFratellanza\\texture\\frames\\finestra-laterale.tga",
tile = false,
insets = { left = 0, right = 0, top = 0, bottom = 0 }
});
LaFratellanza_note_frame:SetFrameLevel(LaFratellanza_main_frame:GetFrameLevel()-1);
LaFratellanza_note_frame_title = LaFratellanza_note_frame:CreateFontString(nil, "OVERLAY", "GameFontNormal");
LaFratellanza_note_frame_title:SetPoint("TOPLEFT", LaFratellanza_note_frame, "TOPLEFT", 30, -30);
LaFratellanza_note_frame_title:SetText("");
local personalNotesLabel = LaFratellanza_note_frame:CreateFontString(nil, "OVERLAY", "GameFontNormal");
personalNotesLabel:SetPoint("TOPLEFT", LaFratellanza_note_frame_title, "BOTTOMLEFT", 0, -15);
personalNotesLabel:SetText("Note personali: ");
LaFratellanza_note_frame_personal_note = CreateFrame("EditBox", "MioAddonEditBox", LaFratellanza_note_frame);
LaFratellanza_note_frame_personal_note:SetMultiLine(true);
LaFratellanza_note_frame_personal_note:SetFontObject(GameFontNormal);
LaFratellanza_note_frame_personal_note:SetWidth(200);
LaFratellanza_note_frame_personal_note:SetPoint("TOPLEFT", personalNotesLabel, "BOTTOMLEFT", 0, -3);
LaFratellanza_note_frame_personal_note:SetText("");
LaFratellanza_note_frame_personal_note:HighlightText();
LaFratellanza_note_frame_personal_note:SetBackdrop({
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
});
LaFratellanza_note_frame_personal_note:SetTextInsets(8, 8, 8, 8);
LaFratellanza_note_frame_personal_note:SetMaxLetters(40);
local officerNotesLabel = LaFratellanza_note_frame:CreateFontString(nil, "OVERLAY", "GameFontNormal");
officerNotesLabel:SetPoint("TOPLEFT", LaFratellanza_note_frame_personal_note, "BOTTOMLEFT", 0, -12);
officerNotesLabel:SetText("Note officer: ");
LaFratellanza_note_frame_officer_note = CreateFrame("EditBox", "MioAddonEditBox", LaFratellanza_note_frame);
LaFratellanza_note_frame_officer_note:SetMultiLine(true);
LaFratellanza_note_frame_officer_note:SetFontObject(GameFontNormal);
LaFratellanza_note_frame_officer_note:SetWidth(200);
LaFratellanza_note_frame_officer_note:SetPoint("TOPLEFT", officerNotesLabel, "BOTTOMLEFT", 0, -3);
LaFratellanza_note_frame_officer_note:SetText("");
LaFratellanza_note_frame_officer_note:HighlightText();
LaFratellanza_note_frame_officer_note:SetBackdrop({
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
});
LaFratellanza_note_frame_officer_note:SetTextInsets(8, 8, 8, 8);
LaFratellanza_note_frame_officer_note:SetMaxLetters(40);
local closeButton = CreateFrame("Button", "SaveButton", LaFratellanza_note_frame, "UIPanelButtonTemplate");
closeButton:SetSize(80, 25);
closeButton:SetText("Chiudi");
closeButton:SetPoint("BOTTOMLEFT", LaFratellanza_note_frame, "BOTTOMLEFT", 30, 25);
closeButton:SetScript("OnClick", function()
LaFratellanza_note_frame_title:SetText("");
LaFratellanza_note_frame_personal_note:SetText("");
LaFratellanza_note_frame_officer_note:SetText("");
LaFratellanza_note_frame:Hide();
end);
LaFratellanza_note_frame_save = CreateFrame("Button", "SaveButton", LaFratellanza_note_frame, "UIPanelButtonTemplate");
LaFratellanza_note_frame_save:SetSize(80, 25);
LaFratellanza_note_frame_save:SetText("Salva");
LaFratellanza_note_frame_save:SetPoint("LEFT", closeButton, "RIGHT", 10, 0);
LaFratellanza_note_frame:Hide();
end
function LaFratellanza_OpenEditNote(name, idx, note)
LaFratellanza_note_frame:Show();
LaFratellanza_note_frame_title:SetText(LaFratellanza_ToUpperCase(name));
if note:match("^(.-)\n\n(.+)$") then
local personal, officer = note:match("^(.-)\n\n(.+)$");
LaFratellanza_note_frame_personal_note:SetText(personal);
LaFratellanza_note_frame_officer_note:SetText(string.sub(officer, 14));
else
LaFratellanza_note_frame_personal_note:SetText(note);
LaFratellanza_note_frame_officer_note:SetText("");
end
LaFratellanza_note_frame_save:SetScript("OnClick", function()
local personalNotes = LaFratellanza_note_frame_personal_note:GetText();
local officerNotes = LaFratellanza_note_frame_personal_note:GetText();
GuildRosterSetPublicNote(idx, personalNotes);
GuildRosterSetOfficerNote(idx, officerNotes);
LaFratellanza_note_frame_title:SetText("");
LaFratellanza_note_frame_personal_note:SetText("");
LaFratellanza_note_frame_officer_note:SetText("");
LaFratellanza_note_frame:Hide();
LaFratellanza_RefreshMembers();
end);
end
function LaFratellanza_ClearMemberRow()
for idx = 1, 13 do
_G["LaFratellanza_Member" .. idx .. "_ClassIcon_Texture"]:SetTexture(nil);
_G["LaFratellanza_Member" .. idx .. "_Name_Text"]:SetText(nil);
_G["LaFratellanza_Member" .. idx .. "_Level_Text"]:SetText(nil);
_G["LaFratellanza_Member" .. idx .. "_MainSpec_Texture"]:SetTexture(nil);
_G["LaFratellanza_Member" .. idx .. "_OffSpec_Texture"]:SetTexture(nil);
_G["LaFratellanza_Member" .. idx .. "_MainProf_Texture"]:SetTexture(nil);
_G["LaFratellanza_Member" .. idx .. "_OffProf_Texture"]:SetTexture(nil);
_G["LaFratellanza_Member" .. idx .. "_Zone_Text"]:SetText(nil);
_G["LaFratellanza_Member" .. idx .. "_Main_Text"]:SetText(nil);
_G["LaFratellanza_Member" .. idx .. "_Rank_Texture"]:SetTexture(nil);
_G["LaFratellanza_Member" .. idx .. "_Note"]:SetScript("OnEnter", nil);
_G["LaFratellanza_Member" .. idx .. "_Note"]:SetScript("OnLeave", nil);
_G["LaFratellanza_Member" .. idx .. "_Note"]:SetScript("OnClick", nil);
_G["LaFratellanza_Member" .. idx .. "_Note"]:Hide();
_G["LaFratellanza_Member" .. idx .. "_Invite"]:Hide();
_G["LaFratellanza_Member" .. idx .. "_Whisper"]:Hide();
end
end
function LaFratellanza_MemberListUpdate(index)
LaFratellanza_ClearMemberRow()
local cycle = #LaFratellanza_guild_roster_filtered;
if cycle > 13 then
cycle = 13;
end
for idx = 1, cycle do
local memberFrame = _G["LaFratellanza_Member" .. idx];
if LaFratellanza_section == 'offline' then
memberFrame:SetAlpha(0.6);
else
memberFrame:SetAlpha(1);
end
local classIconTexture = _G[memberFrame:GetName() .. "_ClassIcon_Texture"];
if LaFratellanza_guild_roster_filtered[idx+index].name == 'Cipollino' then
classIconTexture:SetTexture([[Interface\AddOns\LaFratellanza\texture\icons\Cipollino]]);
else
classIconTexture:SetTexture([[Interface\AddOns\LaFratellanza\texture\icons\]] .. LaFratellanza_guild_roster_filtered[idx+index].class);
end
local name = _G[memberFrame:GetName() .. "_Name_Text"];
name:SetText(LaFratellanza_guild_roster_filtered[idx+index].name);
local lvl = _G[memberFrame:GetName() .. "_Level_Text"];
lvl:SetText(LaFratellanza_guild_roster_filtered[idx+index].lvl);
if(LaFratellanza_guild_roster_filtered[idx+index].spec.main) then
_G[memberFrame:GetName() .. "_MainSpec_Texture"]:SetTexture([[Interface\AddOns\LaFratellanza\texture\icons\]] .. LaFratellanza_guild_roster_filtered[idx+index].spec.main .. LaFratellanza_guild_roster_filtered[idx+index].class);
end
if(LaFratellanza_guild_roster_filtered[idx+index].spec.off) then
_G[memberFrame:GetName() .. "_OffSpec_Texture"]:SetTexture([[Interface\AddOns\LaFratellanza\texture\icons\]] .. LaFratellanza_guild_roster_filtered[idx+index].spec.off .. LaFratellanza_guild_roster_filtered[idx+index].class);
end
if(LaFratellanza_guild_roster_filtered[idx+index].prof.main) then
local mainProf = _G[memberFrame:GetName() .. "_MainProf"];
local prof = LaFratellanza_guild_roster_filtered[idx+index].prof.main
_G[memberFrame:GetName() .. "_MainProf_Texture"]:SetTexture([[Interface\AddOns\LaFratellanza\texture\icons\]] .. LaFratellanza_guild_roster_filtered[idx+index].prof.main);
mainProf:SetScript("OnClick", function()
local msg = "Req:" .. prof;
SendAddonMessage(LaFratellanza_channel, msg, "WHISPER", LaFratellanza_guild_roster_filtered[idx+index].name);
end)
end
if(LaFratellanza_guild_roster_filtered[idx+index].prof.off) then
local offProf = _G[memberFrame:GetName() .. "_OffProf"];
local prof = LaFratellanza_guild_roster_filtered[idx+index].prof.off
_G[memberFrame:GetName() .. "_OffProf_Texture"]:SetTexture([[Interface\AddOns\LaFratellanza\texture\icons\]] .. LaFratellanza_guild_roster_filtered[idx+index].prof.off);
offProf:SetScript("OnClick", function()
local msg = "Req:" .. prof;
SendAddonMessage(LaFratellanza_channel, msg, "WHISPER", LaFratellanza_guild_roster_filtered[idx+index].name);
end)
end
local zone = _G[memberFrame:GetName() .. "_Zone_Text"];
local zoneText = LaFratellanza_guild_roster_filtered[idx + index].zone;
if string.len(zoneText) > 21 then
zoneText = string.sub(zoneText, 1, 21) .. "...";
end
zone:SetText(zoneText);
if LaFratellanza_section == 'offline' then
name:SetTextColor(0.5, 0.5, 0.5);
lvl:SetTextColor(0.5, 0.5, 0.5);
zone:SetTextColor(0.5, 0.5, 0.5);
else
name:SetTextColor(0.9, 0.9, 0.9);
lvl:SetTextColor(0.9, 0.9, 0.9);
zone:SetTextColor(0.9, 0.9, 0.9);
end
local invite = _G[memberFrame:GetName() .. "_Invite"];
local whisper = _G[memberFrame:GetName() .. "_Whisper"];
if LaFratellanza_section == 'offline' then
invite:Hide();
whisper:Hide();
else
invite:Show();
whisper:Show();
invite:SetScript("OnClick", function()
InviteUnit(LaFratellanza_guild_roster_filtered[idx+index].name);
end)
whisper:SetScript("OnClick", function()
ChatFrame_SendTell(LaFratellanza_guild_roster_filtered[idx+index].name);
end)
end
_G[memberFrame:GetName() .. "_Rank_Texture"]:SetTexture([[Interface\AddOns\LaFratellanza\texture\icons\rank_]] .. LaFratellanza_guild_roster_filtered[idx+index].rank);
if(LaFratellanza_guild_roster_filtered[idx+index].altOf) then
local main = _G[memberFrame:GetName() .. "_Main_Text"];
main:SetText(LaFratellanza_guild_roster_filtered[idx+index].altOf);
main:SetFont("Fonts\\FRIZQT__.TTF", 10, "OUTLINE");
main:SetTextColor(0.7, 0.7, 0.7);
end
local note = _G[memberFrame:GetName() .. "_Note"];
note:Show();
local textNote = LaFratellanza_guild_roster_filtered[idx+index].note;
if(LaFratellanza_guild_roster_filtered[idx+index].offNote ~= "") then
textNote = textNote .. "\n\nOfficer Note: " .. LaFratellanza_guild_roster_filtered[idx+index].offNote
end
note:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_TOP");
GameTooltip:SetWidth(400);
GameTooltip:SetText(textNote, 1, 1, 1, true);
GameTooltip:Show();
end)
note:SetScript("OnLeave", function()
GameTooltip:Hide();
end)
if(playerRank == "guild master" or LaFratellanza_Rank_Edit_Note[playerRank])then
note:SetScript("OnClick", function ()
LaFratellanza_OpenEditNote(LaFratellanza_guild_roster_filtered[idx+index].name, LaFratellanza_guild_roster_filtered[idx+index].note);
end)
end
end
end
function LaFratellanza_MemberListInit()
for idx = 1, 13 do
local item = CreateFrame("Frame", "LaFratellanza_Member" .. idx, LaFratellanza_members_frame, "LaFratellanza_Member_Template");
if idx == 1 then
item:SetPoint("TOP", 0, -60);
else
item:SetPoint("TOP", _G["LaFratellanza_Member" .. idx-1], "BOTTOM", 0, 0);
end
end
LaFratellanza_is_first_open = false;
LaFratellanza_MemberListUpdate(0);
end
function LaFratellanza_MembersScrollBarInit()
scrollFrame = CreateFrame("ScrollFrame", "LaFratellanza_Main_Frame_Members_ScrollFrame", LaFratellanza_members_frame, "UIPanelScrollFrameTemplate");
slider = CreateFrame("Slider", "LaFratellanza_Main_Frame_Members_Slider", scrollFrame, "OptionsSliderTemplate");
scrollChild = CreateFrame("Frame", "LaFratellanza_Main_Frame_Members_ScrollChild", scrollFrame);
LaFratellanza_members_frame.scrollFrame = scrollFrame;
LaFratellanza_members_frame.slider = slider;
scrollFrame:SetPoint("CENTER", LaFratellanza_members_frame, "CENTER", 0, -10);
scrollFrame:SetSize(768, 430);
scrollFrame:EnableMouseWheel(true);
slider:SetSize(25, 445);
slider:SetPoint("LEFT", LaFratellanza_members_frame, "RIGHT", 0, -10);
slider:SetBackdrop({
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeSize = 8,
insets = { left = 3, right = 3, top = 6, bottom = 6 },
});
_G[slider:GetName() .. 'Low']:SetText('');
_G[slider:GetName() .. 'High']:SetText('');
end
function LaFratellanza_MembersScrollBarUpdate()
local minValue = 1;
local addValue = 0;
if listLength > 13 and (listLength-13) % 5 ~= 0 then
addValue = (5 - ((listLength - 13) % 5)) * 32;
end
local maxValue = (listLength*32) + addValue;
scrollChild:SetSize(665, maxValue);
scrollChild:SetPoint("RIGHT", LaFratellanza_members_frame, "LEFT", 0, 0);
scrollFrame:SetScrollChild(scrollChild);
local stepSize = 5 * 32;
scrollFrame:SetScript("OnVerticalScroll", function(self, value)
local newValue = math.max(160, math.floor(value / stepSize + 0.5) * stepSize);
newValue = math.min(maxValue, math.max(minValue, newValue));
if(value == 0) then
LaFratellanza_MemberListUpdate(0);
else
LaFratellanza_MemberListUpdate(newValue / 32);
end
end)
end
function LaFratellanza_GuildRoster_Filtered()
LaFratellanza_guild_roster_filtered = {};
if(LaFratellanza_prof_filter ~= "All professions" or LaFratellanza_spec_filter ~= "All specs") then
if(LaFratellanza_prof_filter ~= "All professions" and LaFratellanza_spec_filter ~= "All specs") then
for _, member in ipairs(LaFratellanza_guild_roster[LaFratellanza_section]) do
if ((member.spec.main == LaFratellanza_spec_filter or member.spec.off == LaFratellanza_spec_filter) and
(member.prof.main == LaFratellanza_prof_filter or member.prof.off == LaFratellanza_prof_filter)) then
table.insert(LaFratellanza_guild_roster_filtered, member);
end
end
elseif(LaFratellanza_spec_filter ~= "All specs") then
for _, member in ipairs(LaFratellanza_guild_roster[LaFratellanza_section]) do
if (member.spec.main == LaFratellanza_spec_filter or member.spec.off == LaFratellanza_spec_filter) then
table.insert(LaFratellanza_guild_roster_filtered, member);
end
end
elseif(LaFratellanza_prof_filter ~= "All professions") then
for _, member in ipairs(LaFratellanza_guild_roster[LaFratellanza_section]) do
if (member.prof.main == LaFratellanza_prof_filter or member.prof.off == LaFratellanza_prof_filter) then
table.insert(LaFratellanza_guild_roster_filtered, member);
end
end
end
else
LaFratellanza_guild_roster_filtered = LaFratellanza_guild_roster[LaFratellanza_section];
end
end
function LaFratellanza_GuildRoster_Sorted()
if(previousKeySort ~= currentKeySort) then
direction = "ASC";
elseif direction == "ASC" then
direction = "DESC";
else
direction = "ASC";
end
table.sort(LaFratellanza_guild_roster_filtered, function(a, b)
if direction == "ASC" then
return a[currentKeySort] < b[currentKeySort];
else
return a[currentKeySort] > b[currentKeySort];
end
end)
previousKeySort = currentKeySort;
end
function LaFratellanza_MembersFrameInit()
LaFratellanza_GuildRoster_Filtered();
if currentKeySort ~= "" then
LaFratellanza_GuildRoster_Sorted();
end
listLength = #LaFratellanza_guild_roster_filtered;
if(LaFratellanza_navBar_current_button == "membri") then
LaFratellanza_ShowMembersFrame();
end
if(LaFratellanza_is_first_open) then
LaFratellanza_MembersScrollBarInit();
LaFratellanza_MemberListInit();
end
LaFratellanza_MembersScrollBarUpdate();
LaFratellanza_MemberListUpdate(0);
end
function LaFratellanza_BuildArrayOfName(maxMembers)
for i = 1, maxMembers do
local name = GetGuildRosterInfo(i);
if name ~= nil then
LaFratellanza_guild_roster_names[string.lower(name)] = name;
end
end
end
function LaFratellanza_RosterBuild()
LaFratellanza_rosterInProgress = true;
SetCVar("guildShowOffline", 1);
LaFratellanza_guild_roster["online"] = {};
LaFratellanza_guild_roster["offline"] = {};
local maxMembers = GetNumGuildMembers();
if maxMembers ~= nil then
LaFratellanza_BuildArrayOfName(maxMembers)
for i = 1, maxMembers do
local name, rank, rankIndex, lvl, cl, zone, note, offNote, online, status, class = GetGuildRosterInfo(i);
if name ~= nil then
if name == playerName then
playerRank = LaFratellanza_ToLowerCase(LaFratellanza_Trim(rank));
end
if online == 1 then
table.insert(LaFratellanza_guild_roster["online"], LaFratellanza_GetMemberProps(i, name, rank, rankIndex, lvl, cl, zone, note, offNote, online, status, class));
else
table.insert(LaFratellanza_guild_roster["offline"], LaFratellanza_GetMemberProps(i, name, rank, rankIndex, lvl, cl, zone, note, offNote, online, status, class));
end
end
end
_G["LaFratellanza_Main_Frame_Members_RosterStatus"]:SetText("Online: " .. #LaFratellanza_guild_roster["online"] .. "/" .. #LaFratellanza_guild_roster["online"]+#LaFratellanza_guild_roster["offline"]);
LaFratellanza_MembersFrameInit();
end
SetCVar("guildShowOffline", 0);
LaFratellanza_rosterInProgress = false;
end
function LaFratellanza_Status_InitDropDown(self, level, menuList)
local info = UIDropDownMenu_CreateInfo();
info.func = LaFratellanza_Status_DropDownOnClick;
if level == 1 then
info.text = "Online";
info.value = "Online";
UIDropDownMenu_AddButton(info);
info.text = "Offline";
info.value = "Offline";
UIDropDownMenu_AddButton(info);
end
end
function LaFratellanza_Status_DropDownOnClick(self, arg1, arg2, checked)
if self.value ~= previousSelection then
previousSelection = self.value;
local dropDownButton = _G["LaFratellanza_Status_DropDownButton"];
UIDropDownMenu_SetText(dropDownButton, self.value);
LaFratellanza_section = LaFratellanza_ToLowerCase(self.value);
LaFratellanza_MembersFrameInit();
end
end
function LaFratellanza_Specs_InitDropDown(self, level, menuList)
local info = UIDropDownMenu_CreateInfo();
info.func = LaFratellanza_Specs_DropDownOnClick;
if level == 1 then
info.text = "All specs";
info.value = "All specs";
UIDropDownMenu_AddButton(info);
info.text = "Frost";
info.value = "Frost";
UIDropDownMenu_AddButton(info);
info.text = "Restoration";
info.value = "Restoration";
UIDropDownMenu_AddButton(info);
info.text = "Feral";
info.value = "Feral";
UIDropDownMenu_AddButton(info);
info.text = "Balance";
info.value = "Balance";
UIDropDownMenu_AddButton(info);
info.text = "Guardian";
info.value = "Guardian";
UIDropDownMenu_AddButton(info);
info.text = "BeastMastery";
info.value = "BeastMastery";
UIDropDownMenu_AddButton(info);
info.text = "Marksmanship";
info.value = "Marksmanship";
UIDropDownMenu_AddButton(info);
info.text = "Survival";
info.value = "Survival";
UIDropDownMenu_AddButton(info);
info.text = "Affliction";
info.value = "Affliction";
UIDropDownMenu_AddButton(info);
info.text = "Destruction";
info.value = "Destruction";
UIDropDownMenu_AddButton(info);
info.text = "Demonology";
info.value = "Demonology";
UIDropDownMenu_AddButton(info);
info.text = "Shadow";
info.value = "Shadow";
UIDropDownMenu_AddButton(info);
info.text = "Discipline";
info.value = "Discipline";
UIDropDownMenu_AddButton(info);
info.text = "Holy";
info.value = "Holy";
UIDropDownMenu_AddButton(info);
info.text = "Fire";
info.value = "Fire";
UIDropDownMenu_AddButton(info);
info.text = "Arcane";
info.value = "Arcane";
UIDropDownMenu_AddButton(info);
info.text = "Protection";
info.value = "Protection";
UIDropDownMenu_AddButton(info);
info.text = "Fury";
info.value = "Fury";
UIDropDownMenu_AddButton(info);
info.text = "Arms";
info.value = "Arms";
UIDropDownMenu_AddButton(info);
info.text = "Retribution";
info.value = "Retribution";
UIDropDownMenu_AddButton(info);
info.text = "Combat";
info.value = "Combat";
UIDropDownMenu_AddButton(info);
info.text = "Assassination";
info.value = "Assassination";
UIDropDownMenu_AddButton(info);
info.text = "Subtlety";
info.value = "Subtlety";
UIDropDownMenu_AddButton(info);
info.text = "Elemental";
info.value = "Elemental";
UIDropDownMenu_AddButton(info);
info.text = "Enhancement";
info.value = "Enhancement";
UIDropDownMenu_AddButton(info);
end
end
function LaFratellanza_Specs_DropDownOnClick(self, arg1, arg2, checked)
if self.value ~= previousSpecFilter then
previousSpecFilter = self.value;
local dropDownButton = _G["LaFratellanza_Specs_DropDownButton"];
UIDropDownMenu_SetText(dropDownButton, self.value);
LaFratellanza_spec_filter = self.value;
LaFratellanza_MembersFrameInit();
end
end
function LaFratellanza_Professions_InitDropDown(self, level, menuList)
local info = UIDropDownMenu_CreateInfo();
info.func = LaFratellanza_Professions_DropDownOnClick;
if level == 1 then
info.text = "All professions";
info.value = "All professions";
UIDropDownMenu_AddButton(info);
info.text = "Alchemy";
info.value = "Alchemy";
UIDropDownMenu_AddButton(info);
info.text = "Blacksmithing";
info.value = "Blacksmithing";
UIDropDownMenu_AddButton(info);
info.text = "Enchanting";
info.value = "Enchanting";
UIDropDownMenu_AddButton(info);
info.text = "Engineering";
info.value = "Engineering";
UIDropDownMenu_AddButton(info);
info.text = "Herbalism";
info.value = "Herbalism";
UIDropDownMenu_AddButton(info);
info.text = "Inscription";
info.value = "Inscription";
UIDropDownMenu_AddButton(info);
info.text = "Jewelcrafting";
info.value = "Jewelcrafting";
UIDropDownMenu_AddButton(info);
info.text = "Leatherworking";
info.value = "Leatherworking";
UIDropDownMenu_AddButton(info);
info.text = "Mining";
info.value = "Mining";
UIDropDownMenu_AddButton(info);
info.text = "Skinning";
info.value = "Skinning";
UIDropDownMenu_AddButton(info);
info.text = "Tailoring";
info.value = "Tailoring";
UIDropDownMenu_AddButton(info);
end
end
function LaFratellanza_Professions_DropDownOnClick(self, arg1, arg2, checked)
if self.value ~= previousProfessionFilter then
previousProfessionFilter = self.value;
local dropDownButton = _G["LaFratellanza_Professions_DropDownButton"];
UIDropDownMenu_SetText(dropDownButton, self.value);
LaFratellanza_prof_filter = self.value;
LaFratellanza_MembersFrameInit();
end
end
function LaFratellanza_Button_Members_Menu_Cliked(self, key)
currentKeySort = key;
LaFratellanza_MembersFrameInit();
end