vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local dewdrop = DewdropLib:GetInstance('1.0') |
2 | local tablet = TabletLib:GetInstance('1.0') |
||
3 | local metro = Metrognome:GetInstance('1') |
||
4 | |||
5 | GuildFu = FuBarPlugin:GetInstance("1.2"):new({ |
||
6 | name = GuildFULocals.NAME, |
||
7 | description = GuildFULocals.DESCRIPTION, |
||
8 | version = "1.52", |
||
9 | releaseDate = "2006-05-15", |
||
10 | aceCompatible = "102", |
||
11 | author = "Garfield", |
||
12 | email = "f6_garfield@hotmail.com", |
||
13 | website = "", |
||
14 | category = "interface", |
||
15 | db = AceDatabase:new("GuildFUDB"), |
||
16 | defaults = DEFAULT_OPTIONS, |
||
17 | cmd = AceChatCmd:new( GuildFULocals.COMMANDS, GuildFULocals.CMD_OPTIONS), |
||
18 | hasIcon = TRUE, |
||
19 | colorRank = "|cffff9933", |
||
20 | colorPublicNotes = "|cffff9933", |
||
21 | colorOfficerNotes = "|cffffcc66", |
||
22 | colorLevel = "|cff33ff00", |
||
23 | -- Methods |
||
24 | |||
25 | loc = GuildFULocals, |
||
26 | |||
27 | ToggleHideLocation = function(self) |
||
28 | self.data.hideLocation = not self.data.hideLocation |
||
29 | self:Update() |
||
30 | return self.data.hideLocation |
||
31 | end, |
||
32 | |||
33 | ToggleHideLevel = function(self) |
||
34 | self.data.hideLevel = not self.data.hideLevel |
||
35 | self:Update() |
||
36 | return self.data.hideLevel |
||
37 | end, |
||
38 | |||
39 | ToggleColorNames = function(self) |
||
40 | self.data.colornames = not self.data.colornames |
||
41 | self:Update() |
||
42 | return self.data.colornames |
||
43 | end, |
||
44 | |||
45 | ToggleHideLabel = function(self) |
||
46 | self.data.hideLabel = not self.data.hideLabel |
||
47 | self:Update() |
||
48 | return self.data.hideLabel |
||
49 | end, |
||
50 | |||
51 | ToggleHideTotal = function(self) |
||
52 | self.data.hideTotal = not self.data.hideTotal |
||
53 | self:Update() |
||
54 | return self.data.hideTotal |
||
55 | end, |
||
56 | |||
57 | ToggleHideClass = function(self) |
||
58 | self.data.hideClass = not self.data.hideClass |
||
59 | self:Update() |
||
60 | return self.data.hideClass |
||
61 | end, |
||
62 | |||
63 | ToggleHideRace = function(self) |
||
64 | self.data.hideRace = not self.data.hideRace |
||
65 | self:Update() |
||
66 | return self.data.hideRace |
||
67 | end, |
||
68 | |||
69 | ToggleHideRank = function(self) |
||
70 | self.data.hideRank = not self.data.hideRank |
||
71 | self:Update() |
||
72 | return self.data.hideClass |
||
73 | end, |
||
74 | |||
75 | ToggleHidePublicNotes = function(self) |
||
76 | self.data.hidePublicNotes = not self.data.hidePublicNotes |
||
77 | self:Update() |
||
78 | return self.data.hidePublicNotes |
||
79 | end, |
||
80 | |||
81 | ToggleHideOfficerNotes = function(self) |
||
82 | self.data.hideOfficerNotes = not self.data.hideOfficerNotes |
||
83 | self:Update() |
||
84 | return self.data.hideOfficerNotes |
||
85 | end, |
||
86 | |||
87 | ToggleOrder = function(self,selectorder) |
||
88 | self.data.SortOrder = selectorder |
||
89 | self:Update() |
||
90 | return true |
||
91 | end, |
||
92 | |||
93 | SetLeadText = function(self, txt) |
||
94 | txt = self:trim(txt) |
||
95 | if ( txt == "nil" ) then self.data.LeadText = nil else self.data.LeadText = text end |
||
96 | self:Update() |
||
97 | end, |
||
98 | |||
99 | trim = function(self,s) |
||
100 | return (string.gsub(s, "^%s*(.-)%s*$", "%1")) |
||
101 | end, |
||
102 | |||
103 | SetLevelRange = function(self, txt) |
||
104 | txt = tonumber(txt) |
||
105 | if ((txt < 0) or (txt > 10) )then self.data.levelrange = nil else self.data.levelrange = txt end |
||
106 | end, |
||
107 | |||
108 | SetRefreshRate = function(self, txt) |
||
109 | txt = tonumber(txt) |
||
110 | if ((txt < 1) or (txt > 300) )then self.data.refreshrate = nil else self.data.refreshrate = txt end |
||
111 | metro:Stop(self.loc.NAME) |
||
112 | metro:Unregister(self.loc.NAME) |
||
113 | metro:Register(self.loc.NAME, prepare_data, self.data.refreshrate or self.loc.REFRESHINTERVAL,self) |
||
114 | metro:Start(self.loc.NAME) |
||
115 | end, |
||
116 | |||
117 | Report = function(self) |
||
118 | self.cmd:report({ |
||
119 | }) |
||
120 | end, |
||
121 | |||
122 | MenuSettings = function(self,level,value) |
||
123 | |||
124 | local pagingRemainder, numPages, pagemenu, info |
||
125 | if ( level == 3 ) then |
||
126 | if (value == self.loc.MENU_FILTER_CLASS) then |
||
127 | local classindex, classListValues |
||
128 | local playerFaction = "" |
||
129 | playerFaction = UnitFactionGroup("player") |
||
130 | if (playerFaction == "Horde") then |
||
131 | classListValues = self.loc.hordeClassValues |
||
132 | else |
||
133 | classListValues = self.loc.allianceClassValues |
||
134 | end |
||
135 | for classindex=1,table.getn(classListValues) do |
||
136 | checked = false |
||
137 | if ( classindex==1 and not self.data.filterclass ) then checked = true end |
||
138 | if ( self.data.filterclass and self.data.filterclass[classListValues[classindex]] ) then checked = true end |
||
139 | dewdrop:AddLine ( |
||
140 | 'text' , classListValues[classindex], |
||
141 | 'value' , classListValues[classindex], |
||
142 | 'func' , function(myclass) self:FilterClass(myclass) end, |
||
143 | 'arg1', classListValues[classindex], |
||
144 | 'checked' , checked) |
||
145 | end |
||
146 | end |
||
147 | if (value == self.loc.MENU_FILTER_LEVEL) then |
||
148 | checked = false |
||
149 | if ( self.data.filterlevel == self.loc.allianceClassValues[1] or not self.data.filterclass ) then checked = true end |
||
150 | dewdrop:AddLine( |
||
151 | 'text', self.loc.allianceClassValues[1], |
||
152 | 'value' , self.loc.allianceClassValues[1], |
||
153 | 'func', function() self:FilterLevel(self.loc.allianceClassValues[1]) end, |
||
154 | 'checked',checked) |
||
155 | |||
156 | checked = false |
||
157 | if ( self.data.filterlevel == "levelrange" ) then checked = true end |
||
158 | dewdrop:AddLine( |
||
159 | 'text',string.format("+/- %i from your level", self.data.levelrange or self.loc.MENU_FILTER_LEVELRANGE), |
||
160 | 'value', "levelrange", |
||
161 | 'func', function() self:FilterLevel("levelrange") end, |
||
162 | 'checked',checked) |
||
163 | |||
164 | local index, minlvl,maxlvl |
||
165 | for index=0,5 do |
||
166 | info = {} |
||
167 | minlvl = index *10 |
||
168 | maxlvl = index *10 + 9 |
||
169 | if (minlvl == 0) then minlvl = 1 end |
||
170 | checked = false |
||
171 | myvalue = string.format("level%i",index) |
||
172 | if ( self.data.filterlevel == myvalue ) then checked = true end |
||
173 | dewdrop:AddLine( |
||
174 | 'text', string.format("From level %i to %i", minlvl , maxlvl), |
||
175 | 'value', myvalue, |
||
176 | 'func', function(myarg) self:FilterLevel(myarg) end, |
||
177 | 'arg1', myvalue, |
||
178 | 'checked',checked) |
||
179 | end |
||
180 | checked = false |
||
181 | if ( self.data.filterlevel == "level6" ) then checked = true end |
||
182 | dewdrop:AddLine( |
||
183 | 'text', string.format("Level %i", self.loc.WowMaxLevel), |
||
184 | 'value', "level6", |
||
185 | 'func', function() self:FilterLevel("level6") end, |
||
186 | 'checked',checked) |
||
187 | end |
||
188 | if (value == self.loc.MENU_FILTER_ZONE) then |
||
189 | for i=1,table.getn(self.loc.MENU_FILTERS_ZONE) do |
||
190 | local checked = false |
||
191 | if self.data.filterzone and self.data.filterzone[self.loc.MENU_FILTERS_ZONE[i]] then checked = true end |
||
192 | dewdrop:AddLine( |
||
193 | 'text', self.loc.MENU_FILTERS_ZONE[i], |
||
194 | 'value', self.loc.MENU_FILTERS_ZONE[i], |
||
195 | 'func', function(myzone) self:FilterZone(myzone) end, |
||
196 | 'arg1', self.loc.MENU_FILTERS_ZONE[i], |
||
197 | 'checked',checked) |
||
198 | end |
||
199 | end |
||
200 | end |
||
201 | |||
202 | if ( level == 2 ) then |
||
203 | |||
204 | if ( value == self.loc.MENU_INVITE or value == self.loc.MENU_WHISPER) then |
||
205 | local friendIndex |
||
206 | |||
207 | for friendIndex=1 , table.getn(self.data.FriendTable) do |
||
208 | if ( value == self.loc.MENU_INVITE ) then |
||
209 | myfunc = function(myfriend) self:friendInvite(myfriend) end |
||
210 | else |
||
211 | myfunc = function(myfriend) self:friendWhisper(myfriend) end |
||
212 | end |
||
213 | dewdrop:AddLine( |
||
214 | 'text',self.data.FriendTable[friendIndex][1], |
||
215 | 'value', self.data.FriendTable[friendIndex][1], |
||
216 | 'func', myfunc, |
||
217 | 'arg1', self.data.FriendTable[friendIndex][1] |
||
218 | ) |
||
219 | |||
220 | end |
||
221 | end |
||
222 | if ( value == self.loc.MENU_DISPLAY ) then |
||
223 | dewdrop:AddLine( |
||
224 | 'text', self.loc.MENU_SHOW_LOCATION, |
||
225 | 'value', self.loc.MENU_SHOW_LOCATION, |
||
226 | 'func', function() self:ToggleHideLocation() end, |
||
227 | 'checked', not self.data.hideLocation, |
||
228 | 'closeWhenClicked', false) |
||
229 | |||
230 | dewdrop:AddLine( |
||
231 | 'text', self.loc.MENU_SHOW_LEVEL, |
||
232 | 'value', self.loc.MENU_SHOW_LEVEL, |
||
233 | 'func', function() self:ToggleHideLevel() end, |
||
234 | 'checked', not self.data.hideLevel, |
||
235 | 'closeWhenClicked', false) |
||
236 | |||
237 | dewdrop:AddLine( |
||
238 | 'text', self.loc.MENU_SHOW_CLASS, |
||
239 | 'value', self.loc.MENU_SHOW_CLASS, |
||
240 | 'func', function() self:ToggleHideClass() end, |
||
241 | 'checked', not self.data.hideClass, |
||
242 | 'closeWhenClicked', false) |
||
243 | |||
244 | dewdrop:AddLine( |
||
245 | 'text', self.loc.MENU_SHOW_PUBLICNOTES, |
||
246 | 'value', self.loc.MENU_SHOW_PUBLICNOTES, |
||
247 | 'func', function() self:ToggleHidePublicNotes() end, |
||
248 | 'checked', not self.data.hidePublicNotes, |
||
249 | 'closeWhenClicked', false) |
||
250 | |||
251 | dewdrop:AddLine( |
||
252 | 'text', self.loc.MENU_SHOW_OFFICERNOTES, |
||
253 | 'value', self.loc.MENU_SHOW_OFFICERNOTES, |
||
254 | 'func', function() self:ToggleHideOfficerNotes() end, |
||
255 | 'checked', not self.data.hideOfficerNotes, |
||
256 | 'closeWhenClicked', false) |
||
257 | |||
258 | dewdrop:AddLine( |
||
259 | 'text', self.loc.MENU_SHOW_RANK, |
||
260 | 'value', self.loc.MENU_SHOW_RANK, |
||
261 | 'func', function() self:ToggleHideRank() end, |
||
262 | 'checked', not self.data.hideRank, |
||
263 | 'closeWhenClicked', false) |
||
264 | |||
265 | dewdrop:AddLine( |
||
266 | 'text', self.loc.MENU_SHOW_LABEL, |
||
267 | 'value', self.loc.MENU_SHOW_LABEL, |
||
268 | 'func', function() self:ToggleHideLabel() end, |
||
269 | 'checked', not self.data.hideLabel, |
||
270 | 'closeWhenClicked', false) |
||
271 | |||
272 | dewdrop:AddLine( |
||
273 | 'text', self.loc.MENU_SHOW_TOTAL, |
||
274 | 'value', self.loc.MENU_SHOW_TOTAL, |
||
275 | 'func', function() self:ToggleHideTotal() end, |
||
276 | 'checked', not self.data.hideTotal, |
||
277 | 'closeWhenClicked', false) |
||
278 | |||
279 | dewdrop:AddLine( |
||
280 | 'text', self.loc.MENU_COLORNAMES, |
||
281 | 'value', self.loc.MENU_COLORNAMES, |
||
282 | 'func', function() self:ToggleColorNames() end, |
||
283 | 'checked', self.data.colornames, |
||
284 | 'closeWhenClicked', false) |
||
285 | |||
286 | end |
||
287 | if ( value == self.loc.MENU_ORDER ) then |
||
288 | checked = false |
||
289 | if ( self.data.SortOrder == self.loc.MENU_ORDER_LOCATION) then checked = true end |
||
290 | dewdrop:AddLine( |
||
291 | 'text', self.loc.MENU_ORDER_LOCATION, |
||
292 | 'value', self.loc.MENU_ORDER_LOCATION, |
||
293 | 'func', function() self:ToggleOrder(self.loc.MENU_ORDER_LOCATION) end, |
||
294 | 'checked', checked) |
||
295 | |||
296 | checked = false |
||
297 | if ( self.data.SortOrder == self.loc.MENU_ORDER_LEVEL) then checked = true end |
||
298 | dewdrop:AddLine( |
||
299 | 'text', self.loc.MENU_ORDER_LEVEL, |
||
300 | 'value', self.loc.MENU_ORDER_LEVEL, |
||
301 | 'func', function() self:ToggleOrder(self.loc.MENU_ORDER_LEVEL) end, |
||
302 | 'checked', checked) |
||
303 | |||
304 | checked = false |
||
305 | if ( self.data.SortOrder == self.loc.MENU_ORDER_CLASS) then checked = true end |
||
306 | dewdrop:AddLine( |
||
307 | 'text', self.loc.MENU_ORDER_CLASS, |
||
308 | 'value', self.loc.MENU_ORDER_CLASS, |
||
309 | 'func', function() self:ToggleOrder(self.loc.MENU_ORDER_CLASS) end, |
||
310 | 'checked', checked) |
||
311 | |||
312 | checked = false |
||
313 | if ( self.data.SortOrder == self.loc.MENU_ORDER_NAME) then checked = true end |
||
314 | dewdrop:AddLine( |
||
315 | 'text', self.loc.MENU_ORDER_NAME, |
||
316 | 'value', self.loc.MENU_ORDER_NAME, |
||
317 | 'func', function() self:ToggleOrder(self.loc.MENU_ORDER_NAME) end, |
||
318 | 'checked', checked) |
||
319 | |||
320 | end |
||
321 | |||
322 | if ( value == self.loc.MENU_FILTER ) then |
||
323 | dewdrop:AddLine( |
||
324 | 'text', self.loc.MENU_FILTER_CLASS, |
||
325 | 'value',self.loc.MENU_FILTER_CLASS, |
||
326 | 'hasArrow', true) |
||
327 | |||
328 | dewdrop:AddLine( |
||
329 | 'text', self.loc.MENU_FILTER_LEVEL, |
||
330 | 'value',self.loc.MENU_FILTER_LEVEL, |
||
331 | 'hasArrow', true) |
||
332 | |||
333 | dewdrop:AddLine( |
||
334 | 'text', self.loc.MENU_FILTER_ZONE, |
||
335 | 'value',self.loc.MENU_FILTER_ZONE, |
||
336 | 'hasArrow', true) |
||
337 | end |
||
338 | end |
||
339 | if ( level == 1 ) then |
||
340 | dewdrop:AddLine( |
||
341 | 'text', self.loc.MENU_INVITE, |
||
342 | 'value',self.loc.MENU_INVITE, |
||
343 | 'hasArrow', true) |
||
344 | |||
345 | dewdrop:AddLine( |
||
346 | 'text', self.loc.MENU_WHISPER, |
||
347 | 'value',self.loc.MENU_WHISPER, |
||
348 | 'hasArrow', true) |
||
349 | |||
350 | |||
351 | dewdrop:AddLine() |
||
352 | |||
353 | dewdrop:AddLine( |
||
354 | 'text', self.loc.MENU_DISPLAY, |
||
355 | 'value',self.loc.MENU_DISPLAY, |
||
356 | 'hasArrow', true) |
||
357 | |||
358 | dewdrop:AddLine( |
||
359 | 'text', self.loc.MENU_ORDER, |
||
360 | 'value',self.loc.MENU_ORDER, |
||
361 | 'hasArrow', true) |
||
362 | |||
363 | dewdrop:AddLine( |
||
364 | 'text', self.loc.MENU_FILTER, |
||
365 | 'value',self.loc.MENU_FILTER, |
||
366 | 'hasArrow', true) |
||
367 | |||
368 | end |
||
369 | end, |
||
370 | |||
371 | Initialize = function(self) |
||
372 | self.data.Page = 0 |
||
373 | self:Show() |
||
374 | if not IsInGuild() then self:Hide() end |
||
375 | end, |
||
376 | |||
377 | Enable = function(self) |
||
378 | self:RegisterEvent("GUILD_ROSTER_SHOW","Update") |
||
379 | self:RegisterEvent("GUILD_ROSTER_UPDATE","Update") |
||
380 | self:RegisterEvent("GUILD_REGISTRAR_SHOW","Update") |
||
381 | self:RegisterEvent("GUILD_REGISTRAR_CLOSED","Update") |
||
382 | self:RegisterEvent("PLAYER_ENTERING_WORLD","Update") |
||
383 | self:RegisterEvent("CHAT_MSG_SYSTEM","SystemMessage") |
||
384 | metro:Register(self.loc.NAME, self.prepare_data, self.data.refreshrate or self.loc.REFRESHINTERVAL,self) |
||
385 | metro:Start(self.loc.NAME) |
||
386 | end, |
||
387 | |||
388 | Disable = function(self) |
||
389 | metro:Unregister(self.loc.NAME) |
||
390 | end, |
||
391 | |||
392 | prepare_data = function(self) |
||
393 | self:UpdateData() |
||
394 | self:UpdateText() |
||
395 | end, |
||
396 | |||
397 | SystemMessage = function(self) |
||
398 | if ( string.find(arg1, self.loc.SYSMSG_ONLINE) or string.find(arg1, self.loc.SYSMSG_OFFLINE) ) then |
||
399 | self:Update() |
||
400 | end |
||
401 | end, |
||
402 | |||
403 | friendInvite = function(self,name) |
||
404 | InviteByName( name ) |
||
405 | end, |
||
406 | |||
407 | FilterClass = function(self, selectclass) |
||
408 | if selectclass == self.loc.allianceClassValues[1] then |
||
409 | self.data.filterclass = nil |
||
410 | else |
||
411 | if not self.data.filterclass then self.data.filterclass={} end |
||
412 | if self.data.filterclass[selectclass] then self.data.filterclass[selectclass]=nil else self.data.filterclass[selectclass]=TRUE end |
||
413 | end |
||
414 | self:Update() |
||
415 | end, |
||
416 | |||
417 | FilterLevel = function(self,selectlevel) |
||
418 | self.data.filterlevel=selectlevel |
||
419 | self:Update() |
||
420 | end, |
||
421 | |||
422 | FilterZone = function(self, selectzone) |
||
423 | if not self.data.filterzone then self.data.filterzone={} end |
||
424 | if self.data.filterzone[selectzone] then self.data.filterzone[selectzone]=nil else self.data.filterzone[selectzone]=TRUE end |
||
425 | self:Update() |
||
426 | end, |
||
427 | |||
428 | passfilter = function(self,info) |
||
429 | local filterclass,filterlevel,filterzone |
||
430 | |||
431 | |||
432 | if ( self.data.filterclass ) then |
||
433 | if ( self.data.filterclass[info[3]] ) then filterclass = true end |
||
434 | else |
||
435 | filterclass = true |
||
436 | end |
||
437 | |||
438 | if ( self.data.filterlevel and self.data.filterlevel ~= self.loc.allianceClassValues[1] ) then |
||
439 | local minlvl, maxlvl |
||
440 | local wowmaxlvl |
||
441 | |||
442 | if ( self.data.filterlevel == "levelrange" ) then |
||
443 | local mylvl = UnitLevel("player") |
||
444 | minlvl = mylvl - ( self.data.levelrange or self.loc.MENU_FILTER_LEVELRANGE) |
||
445 | maxlvl = mylvl + ( self.data.levelrange or self.loc.MENU_FILTER_LEVELRANGE ) |
||
446 | else |
||
447 | local lvl |
||
448 | lvl = tonumber(string.sub(self.data.filterlevel,-1,-1)) |
||
449 | minlvl = lvl * 10 |
||
450 | maxlvl = lvl * 10 + 9 |
||
451 | end |
||
452 | wowmaxlvl = self.loc.WowMaxLevel |
||
453 | if ( minlvl < 1 ) then minlvl = 1 end |
||
454 | if ( maxlvl < 1 ) then maxlvl = 1 end |
||
455 | if ( minlvl > wowmaxlvl ) then minlvl = wowmaxlvl end |
||
456 | if ( maxlvl > wowmaxlvl ) then maxlvl = wowmaxlvl end |
||
457 | if ( minlvl <= info[2] and maxlvl >= info[2] ) then filterlevel = true end |
||
458 | else |
||
459 | filterlevel = true |
||
460 | end |
||
461 | |||
462 | if ( self.data.filterzone ) then |
||
463 | filterzone = true |
||
464 | if self.data.filterzone[self.loc.MENU_FILTERS_ZONE[1]] then |
||
465 | if (info[4] ~= GetZoneText() ) then filterzone = nil end |
||
466 | end |
||
467 | if self.data.filterzone[self.loc.MENU_FILTERS_ZONE[2]] then |
||
468 | if (self.loc.dungeonlist[info[4]] ) then filterzone = nil end |
||
469 | end |
||
470 | if self.data.filterzone[self.loc.MENU_FILTERS_ZONE[3]] then |
||
471 | if (self.loc.battlegroundlist[info[4]] ) then filterzone = nil end |
||
472 | end |
||
473 | else |
||
474 | filterzone = true |
||
475 | end |
||
476 | return filterclass and filterlevel and filterzone |
||
477 | end, |
||
478 | |||
479 | friendWhisper= function(self,name) |
||
480 | if ( not ChatFrameEditBox:IsVisible() ) then |
||
481 | ChatFrame_OpenChat(string.format("/w %s ",name)) |
||
482 | else |
||
483 | ChatFrameEditBox:SetText(string.format("/w %s ",name)) |
||
484 | end |
||
485 | end , |
||
486 | |||
487 | |||
488 | UpdateData = function(self) |
||
489 | |||
490 | local NumFriends = GetNumGuildMembers(true) |
||
491 | local NumFriendsOnline = 0 |
||
492 | local friend_name, friend_level, friend_class, friend_area, friend_connected, friend_rank, rankIndex, note, officernote, status |
||
493 | local friendIndex |
||
494 | local friendtable={} |
||
495 | |||
496 | if (IsInGuild()) then |
||
497 | GuildRoster() |
||
498 | for friendIndex=1, NumFriends do |
||
499 | friend_name, friend_rank, rankIndex, friend_level, friend_class, friend_area, note, officernote, friend_connected, status = GetGuildRosterInfo(friendIndex) |
||
500 | if (not friend_area) then friend_area = " . " end |
||
501 | if ( friend_connected ) then |
||
502 | if ( self:passfilter({friend_name, friend_level,friend_class, friend_area} ) )then |
||
503 | NumFriendsOnline = NumFriendsOnline + 1 |
||
504 | table.insert(friendtable,{friend_name, friend_level,friend_class, friend_area,friend_rank,rankIndex,note,officernote}) |
||
505 | end |
||
506 | end |
||
507 | end |
||
508 | if ( self.data.SortOrder == self.loc.MENU_ORDER_LOCATION ) then table.sort(friendtable, function(a,b) return a[4]<b[4] end) end |
||
509 | if ( self.data.SortOrder == self.loc.MENU_ORDER_LEVEL ) then table.sort(friendtable, function(a,b) return a[2]>b[2] end) end |
||
510 | if ( self.data.SortOrder == self.loc.MENU_ORDER_CLASS ) then table.sort(friendtable, function(a,b) return a[3]<b[3] end) end |
||
511 | if ( self.data.SortOrder == self.loc.MENU_ORDER_NAME ) then table.sort(friendtable, function(a,b) return a[1]<b[1] end) end |
||
512 | |||
513 | self.data.NumOnline = NumFriendsOnline |
||
514 | self.data.NumMaximum = NumFriends |
||
515 | self.data.FriendTable = friendtable |
||
516 | else |
||
517 | self.data.NumOnline = 0 |
||
518 | self.data.NumMaximum = 0 |
||
519 | self.data.FriendTable = {} |
||
520 | end |
||
521 | end, |
||
522 | |||
523 | UpdateText = function(self) |
||
524 | local tekst |
||
525 | if ( self.data.hideTotal ) then |
||
526 | tekst =self.data.NumOnline |
||
527 | else |
||
528 | tekst = string.format("%i/%i",self.data.NumOnline, self.data.NumMaximum ) |
||
529 | end |
||
530 | if (not self.data.hideLabel ) then |
||
531 | if self.data.LeadText then tekst = string.format("%s %s",self.data.LeadText or "",tekst) end |
||
532 | end |
||
533 | self:SetText(tekst) |
||
534 | end, |
||
535 | |||
536 | UpdateTooltip = function(self) |
||
537 | local lijn1, lijn2 |
||
538 | local friendIndex, friend_name,friend_class,friend_level,friend_area |
||
539 | if ( IsInGuild() ) then |
||
540 | local cat = tablet:AddCategory('columns', 4) |
||
541 | for friendIndex=1, table.getn(self.data.FriendTable) do |
||
542 | friend_name = self.data.FriendTable[friendIndex][1] |
||
543 | friend_level = string.format("%s%s|r",self.colorLevel,self.data.FriendTable[friendIndex][2]) |
||
544 | friend_color = self.loc.colorclasses[self.data.FriendTable[friendIndex][3]] |
||
545 | friend_class = string.format("%s%s|r",friend_color,self.data.FriendTable[friendIndex][3]) |
||
546 | friend_area = self.data.FriendTable[friendIndex][4] |
||
547 | if ( self.data.colornames ) then friend_name = string.format("%s%s|r",friend_color,friend_name) end |
||
548 | |||
549 | friend_rank = string.format("%s[%s]|r",self.colorRank,self.data.FriendTable[friendIndex][5]) |
||
550 | if (self.data.FriendTable[friendIndex][7] == "" ) then |
||
551 | friend_publicnotes = "" |
||
552 | else |
||
553 | friend_publicnotes = string.format("%s[%s]|r",self.colorPublicNotes,self.data.FriendTable[friendIndex][7]) |
||
554 | end |
||
555 | if (self.data.FriendTable[friendIndex][8] == "" ) then |
||
556 | friend_officernotes = "" |
||
557 | else |
||
558 | friend_officernotes = string.format("%s[%s]|r",self.colorOfficerNotes,self.data.FriendTable[friendIndex][8]) |
||
559 | end |
||
560 | |||
561 | if ( self.data.hidePublicNotes ) then |
||
562 | friend_publicnotes = "" |
||
563 | end |
||
564 | if ( self.data.hideOfficerNotes ) then |
||
565 | friend_officernotes = "" |
||
566 | end |
||
567 | if ( self.data.hideLocation ) then |
||
568 | friend_area = "" |
||
569 | end |
||
570 | if ( self.data.hideLevel ) then |
||
571 | friend_level = "" |
||
572 | end |
||
573 | if ( self.data.hideClass ) then |
||
574 | friend_class = "" |
||
575 | end |
||
576 | if (self.data.hideRank ) then |
||
577 | friend_rank = "" |
||
578 | end |
||
579 | cat:AddLine( |
||
580 | 'text', string.format("%s %s%s",friend_name,friend_publicnotes,friend_officernotes), |
||
581 | 'text2',friend_area, |
||
582 | 'text3',friend_level, |
||
583 | 'text4',string.format("%s %s",friend_class,friend_rank), |
||
584 | 'justify', "LEFT", |
||
585 | 'justify2', "LEFT", |
||
586 | 'justify3', "RIGHT", |
||
587 | 'justify4', "RIGHT" |
||
588 | ) |
||
589 | end |
||
590 | else |
||
591 | cat:AddLine('text',self.loc.TOOLTIP_NOTINGUILD) |
||
592 | end |
||
593 | end, |
||
594 | |||
595 | |||
596 | OnClick = function(self) |
||
597 | ToggleFriendsFrame(3) |
||
598 | FriendsFrame_Update() |
||
599 | end, |
||
600 | |||
601 | }) |
||
602 | |||
603 | GuildFu:RegisterForLoad() |