vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | -- Version 0.31 |
2 | -- 12.05.2005 |
||
3 | -- For updates visit http://www.curse-gaming.com/mod.php?addid=1103 |
||
4 | |||
5 | |||
6 | TITAN_FRIENDSX_ID = "FriendsX" |
||
7 | |||
8 | NumFriendsOnline = 0; |
||
9 | NumGuildsOnline = 0; |
||
10 | NumFriends = 0; |
||
11 | NumGuilds = 0; |
||
12 | |||
13 | |||
14 | function TitanPanelFriendsXButton_OnLoad() |
||
15 | this.registry = { |
||
16 | id = TITAN_FRIENDSX_ID, |
||
17 | menuText = FRIENDSX_MENU_TEXT, |
||
18 | buttonTextFunction = "TitanPanelFriendsXButton_GetButtonText", |
||
19 | tooltipTitle = FRIENDSX_TOOLTIP, |
||
20 | tooltipTextFunction = "TitanPanelFriendsXButton_GetTooltipText", |
||
21 | |||
22 | savedVariables = { |
||
23 | ShowLabelText = 1, |
||
24 | FriendsCount = 1, |
||
25 | FriendsShowOnline = 1, |
||
26 | FriendsMarkArea = 1, |
||
27 | GuildCount = 1, |
||
28 | GuildShowOnline = 1, |
||
29 | GuildMarkArea = 1, |
||
30 | |||
31 | } |
||
32 | }; |
||
33 | this:RegisterEvent("FRIENDLIST_SHOW"); |
||
34 | this:RegisterEvent("FRIENDLIST_UPDATE"); |
||
35 | this:RegisterEvent("GUILD_ROSTER_SHOW"); |
||
36 | this:RegisterEvent("GUILD_ROSTER_UPDATE"); |
||
37 | --this:RegisterEvent("VARIABLES_LOADED"); |
||
38 | --this:RegisterEvent("PLAYER_GUILD_UPDATE"); |
||
39 | |||
40 | |||
41 | end |
||
42 | |||
43 | |||
44 | function TitanPanelFriendsXButton_OnEnter() |
||
45 | |||
46 | --Sea.IO.print("FriendsXButton_OnEnter Event"); |
||
47 | ShowFriends(); |
||
48 | |||
49 | end |
||
50 | |||
51 | function TitanPanelFriendsXButton_OnEvent(event) |
||
52 | |||
53 | --TitanPanelButton_UpdateTooltip(); |
||
54 | --if (event == "VARIABLES_LOADED") then |
||
55 | -- GuildRoster(); |
||
56 | -- Sea.IO.print("VARIABLES_LOADED Event"); |
||
57 | -- ShowFriends(); |
||
58 | --else |
||
59 | -- Sea.IO.print(event); |
||
60 | TitanPanelButton_UpdateButton(TITAN_FRIENDSX_ID); |
||
61 | --end |
||
62 | end |
||
63 | |||
64 | |||
65 | function TitanPanelFriendsXButton_GetButtonText(id) |
||
66 | local id = TitanUtils_GetButton(id, true); |
||
67 | NumFriends = GetNumFriends(); |
||
68 | NumFriendsOnline = 0; |
||
69 | NumGuilds = GetNumGuildMembers(); |
||
70 | NumGuildsOnline = 0; |
||
71 | local FriendInSameArea = 0; |
||
72 | local GuildInSameArea = 0; |
||
73 | local buttonRichText = ""; |
||
74 | |||
75 | local friend_name, friend_level, friend_class, friend_area, friend_connected |
||
76 | local guild_name, guild_rank, guild_rankIndex, guild_level, guild_class, guild_zone, guild_group, guild_note, guild_officernote, guild_online |
||
77 | local friendIndex |
||
78 | local guildIndex |
||
79 | local CharName = ""; |
||
80 | |||
81 | CharName = UnitName("player"); |
||
82 | |||
83 | -- get a count of the number of online friends |
||
84 | for friendIndex=1, NumFriends do |
||
85 | friend_name, friend_level, friend_class, friend_area, friend_connected = GetFriendInfo(friendIndex); |
||
86 | if (CharName ~= friend_name) then |
||
87 | if ( friend_connected ) then |
||
88 | NumFriendsOnline = NumFriendsOnline + 1; |
||
89 | end |
||
90 | if (friend_area == GetZoneText()) then |
||
91 | FriendInSameArea = FriendInSameArea + 1; |
||
92 | end |
||
93 | end |
||
94 | end |
||
95 | |||
96 | -- get a count of the number of online guild members |
||
97 | for guildIndex=1, NumGuilds do |
||
98 | guild_name, guild_rank, guild_rankIndex, guild_level, guild_class, guild_zone, guild_group, guild_note, guild_officernote, guild_online = GetGuildRosterInfo(guildIndex); |
||
99 | if (CharName ~= guild_name) then |
||
100 | if ( guild_online ) then |
||
101 | NumGuildsOnline = NumGuildsOnline + 1; |
||
102 | if (guild_zone == GetZoneText()) then |
||
103 | GuildInSameArea = GuildInSameArea + 1; |
||
104 | end |
||
105 | end |
||
106 | end |
||
107 | end |
||
108 | |||
109 | |||
110 | -- Create Button Text depending on options |
||
111 | |||
112 | if ((TitanGetVar(TITAN_FRIENDSX_ID, "FriendsCount")) and (TitanGetVar(TITAN_FRIENDSX_ID, "GuildCount"))) then |
||
113 | --Sea.IO.print("Beide Counts an"); |
||
114 | buttonRichText = format(FRIENDSX_BUTTON_TEXT, TitanUtils_GetGreenText(NumFriendsOnline+NumGuildsOnline), TitanUtils_GetHighlightText(NumFriends+NumGuilds), TitanUtils_GetRedText(GuildInSameArea + FriendInSameArea)); |
||
115 | elseif ((TitanGetVar(TITAN_FRIENDSX_ID, "FriendsCount")) and (TitanGetVar(TITAN_FRIENDSX_ID, "GuildCount") == nil)) then |
||
116 | buttonRichText = format(FRIENDSX_BUTTON_TEXT, TitanUtils_GetGreenText(NumFriendsOnline), TitanUtils_GetHighlightText(NumFriends), TitanUtils_GetRedText(FriendInSameArea)); |
||
117 | --Sea.IO.print("Nur Friend Count an"); |
||
118 | elseif ((TitanGetVar(TITAN_FRIENDSX_ID, "FriendsCount") == nil) and (TitanGetVar(TITAN_FRIENDSX_ID, "GuildCount"))) then |
||
119 | --Sea.IO.print("nur gild count an"); |
||
120 | buttonRichText = format(FRIENDSX_BUTTON_TEXT, TitanUtils_GetGreenText(NumGuildsOnline), TitanUtils_GetHighlightText(NumGuilds), TitanUtils_GetRedText(GuildInSameArea)); |
||
121 | else |
||
122 | buttonRichText = format(FRIENDSX_BUTTON_TEXT, TitanUtils_GetGreenText("-"), TitanUtils_GetHighlightText("-"), TitanUtils_GetRedText("-")); |
||
123 | end |
||
124 | return FRIENDSX_BUTTON_LABEL, buttonRichText; |
||
125 | |||
126 | end |
||
127 | |||
128 | |||
129 | function TitanPanelFriendsXButton_GetTooltipText() |
||
130 | --local NumFriends = GetNumFriends(); |
||
131 | --local NumGuilds = GetNumGuildMembers(); |
||
132 | local tooltipRichText = ""; |
||
133 | |||
134 | |||
135 | local friend_name, friend_level, friend_class, friend_area, friend_connected; |
||
136 | local friendIndex; |
||
137 | local guild_name, guild_rank, guild_rankIndex, guild_level, guild_class, guild_zone, guild_group, guild_note, guild_officernote, guild_online; |
||
138 | local guildIndex; |
||
139 | local CharName = ""; |
||
140 | |||
141 | CharName = UnitName("player"); |
||
142 | |||
143 | if (TitanGetVar(TITAN_FRIENDSX_ID, "FriendsShowOnline")) then |
||
144 | |||
145 | if (NumFriendsOnline > 0) then |
||
146 | tooltipRichText = tooltipRichText.."\n"..TitanUtils_GetGreenText(FRIENDSX_FRIENDS).."\n"; |
||
147 | for friendIndex=1, NumFriends do |
||
148 | friend_name, friend_level, friend_class, friend_area, friend_connected = GetFriendInfo(friendIndex); |
||
149 | if (CharName ~= friend_name) then |
||
150 | if (friend_connected) then |
||
151 | if ((friend_area == GetZoneText()) and (TitanGetVar(TITAN_FRIENDSX_ID, "FriendsMarkArea"))) then |
||
152 | tooltipRichText = tooltipRichText..TitanUtils_GetRedText(friend_name)..TitanUtils_GetHighlightText(" - "..friend_area.." ["..friend_level.." "..friend_class.."]").."\n"; |
||
153 | else |
||
154 | tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(friend_name)..TitanUtils_GetHighlightText(" - "..friend_area.." ["..friend_level.." "..friend_class.."]").."\n"; |
||
155 | end |
||
156 | end |
||
157 | end |
||
158 | end |
||
159 | end |
||
160 | end |
||
161 | |||
162 | if (TitanGetVar(TITAN_FRIENDSX_ID, "GuildShowOnline")) then |
||
163 | |||
164 | if (NumGuildsOnline > 0) then |
||
165 | tooltipRichText = tooltipRichText.."\n"..TitanUtils_GetGreenText(FRIENDSX_GUILD).."\n"; |
||
166 | for guildIndex=1, NumGuilds do |
||
167 | guild_name, guild_rank, guild_rankIndex, guild_level, guild_class, guild_zone, guild_group, guild_note, guild_officernote, guild_online = GetGuildRosterInfo(guildIndex); |
||
168 | if (CharName ~= guild_name) then |
||
169 | if ( (guild_online)) then |
||
170 | if ((guild_zone == GetZoneText()) and (TitanGetVar(TITAN_FRIENDSX_ID, "GuildMarkArea"))) then |
||
171 | tooltipRichText = tooltipRichText..TitanUtils_GetRedText(guild_name)..TitanUtils_GetHighlightText(" - "..guild_zone.." ["..guild_level.." "..guild_class.."]").."\n"; |
||
172 | else |
||
173 | tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(guild_name)..TitanUtils_GetHighlightText(" - "..guild_zone.." ["..guild_level.." "..guild_class.."]").."\n"; |
||
174 | end |
||
175 | end |
||
176 | end |
||
177 | end |
||
178 | end |
||
179 | end |
||
180 | if (tooltipRichtext == TITAN_FRIENDSX_ID) then |
||
181 | tooltipRichText = tooltipRichText..TitanUtils_GetNormalText(FRIENDSX_NOBODY_ONLINE_TOOLTIP); |
||
182 | else |
||
183 | -- remove the last \n |
||
184 | tooltipRichText = string.sub(tooltipRichText, 1, string.len(tooltipRichText)-1); |
||
185 | end |
||
186 | |||
187 | return tooltipRichText; |
||
188 | end |
||
189 | |||
190 | |||
191 | function Whisper() |
||
192 | -- yes its the same like kragusī one :) nice job! |
||
193 | if ( not ChatFrameEditBox:IsVisible() ) then |
||
194 | ChatFrame_OpenChat("/w "..this.value.." "); |
||
195 | else |
||
196 | ChatFrameEditBox:SetText("/w "..this.value.." "); |
||
197 | end |
||
198 | end |
||
199 | |||
200 | |||
201 | function invite() |
||
202 | InviteByName(this.value); |
||
203 | end |
||
204 | |||
205 | |||
206 | function TitanPanelRightClickMenu_PrepareFriendsXMenu() |
||
207 | |||
208 | |||
209 | if (IsShiftKeyDown() ) then |
||
210 | -- Creater Wisper menu |
||
211 | |||
212 | local guild_name, guild_rank, guild_rankIndex, guild_level, guild_class, guild_zone, guild_group, guild_note, guild_officernote, guild_online |
||
213 | local friend_name, friend_level, friend_class, friend_area, friend_connected; |
||
214 | local Index = 0; |
||
215 | local CharName = ""; |
||
216 | |||
217 | CharName = UnitName("player"); |
||
218 | |||
219 | info = {}; |
||
220 | info.text = TitanUtils_GetNormalText("Whisper"); |
||
221 | info.notClickable = 1; |
||
222 | UIDropDownMenu_AddButton(info); |
||
223 | |||
224 | |||
225 | |||
226 | info = {}; |
||
227 | info.text = TitanUtils_GetGreenText(FRIENDSX_FRIENDS); |
||
228 | info.notClickable = 1; |
||
229 | UIDropDownMenu_AddButton(info); |
||
230 | |||
231 | -- get online friends |
||
232 | for Index=1, NumFriends do |
||
233 | friend_name, friend_level, friend_class, friend_area, friend_connected = GetFriendInfo(Index); |
||
234 | if ( friend_connected and CharName ~= friend_name) then |
||
235 | info = {}; |
||
236 | info.text = friend_name; |
||
237 | info.func = Whisper; |
||
238 | info.value = friend_name; |
||
239 | UIDropDownMenu_AddButton(info); |
||
240 | end |
||
241 | end |
||
242 | |||
243 | info = {}; |
||
244 | info.text = TitanUtils_GetGreenText(FRIENDSX_GUILD); |
||
245 | info.notClickable = 1 |
||
246 | UIDropDownMenu_AddButton(info); |
||
247 | |||
248 | -- get online guild people |
||
249 | for Index=1, NumGuilds do |
||
250 | guild_name, guild_rank, guild_rankIndex, guild_level, guild_class, guild_zone, guild_group, guild_note, guild_officernote, guild_online = GetGuildRosterInfo(Index); |
||
251 | if ( guild_online and CharName ~= guild_name) then |
||
252 | info = {}; |
||
253 | info.text = guild_name; |
||
254 | info.func = Whisper; |
||
255 | info.value = guild_name; |
||
256 | UIDropDownMenu_AddButton(info); |
||
257 | end |
||
258 | end |
||
259 | |||
260 | |||
261 | elseif (IsControlKeyDown() ) then |
||
262 | |||
263 | -- Create invite menu |
||
264 | |||
265 | local guild_name, guild_rank, guild_rankIndex, guild_level, guild_class, guild_zone, guild_group, guild_note, guild_officernote, guild_online |
||
266 | local friend_name, friend_level, friend_class, friend_area, friend_connected; |
||
267 | local Index = 0; |
||
268 | local CharName = ""; |
||
269 | |||
270 | CharName = UnitName("player"); |
||
271 | |||
272 | |||
273 | info = {}; |
||
274 | info.text = TitanUtils_GetNormalText("Invite"); |
||
275 | info.notClickable = 1; |
||
276 | UIDropDownMenu_AddButton(info); |
||
277 | |||
278 | |||
279 | info = {}; |
||
280 | info.text = TitanUtils_GetGreenText(FRIENDSX_FRIENDS); |
||
281 | info.notClickable = 1; |
||
282 | UIDropDownMenu_AddButton(info); |
||
283 | |||
284 | -- get online friends |
||
285 | for Index=1, NumFriends do |
||
286 | friend_name, friend_level, friend_class, friend_area, friend_connected = GetFriendInfo(Index); |
||
287 | if ( friend_connected and CharName ~= friend_name) then |
||
288 | info = {}; |
||
289 | info.text = friend_name; |
||
290 | info.func = invite; |
||
291 | info.value = friend_name; |
||
292 | UIDropDownMenu_AddButton(info); |
||
293 | end |
||
294 | end |
||
295 | |||
296 | info = {}; |
||
297 | info.text = TitanUtils_GetGreenText(FRIENDSX_GUILD); |
||
298 | info.notClickable = 1 |
||
299 | UIDropDownMenu_AddButton(info); |
||
300 | |||
301 | -- get online guild people |
||
302 | for Index=1, NumGuilds do |
||
303 | guild_name, guild_rank, guild_rankIndex, guild_level, guild_class, guild_zone, guild_group, guild_note, guild_officernote, guild_online = GetGuildRosterInfo(Index); |
||
304 | if ( guild_online and CharName ~= guild_name) then |
||
305 | info = {}; |
||
306 | info.text = guild_name; |
||
307 | info.func = invite; |
||
308 | info.value = guild_name_name; |
||
309 | UIDropDownMenu_AddButton(info); |
||
310 | end |
||
311 | end |
||
312 | |||
313 | |||
314 | else |
||
315 | |||
316 | local id = "FriendsX"; |
||
317 | local info; |
||
318 | TitanPanelRightClickMenu_AddTitle(TitanPlugins[id].menuText); |
||
319 | |||
320 | -- FRIEND OPTIONS |
||
321 | info = {}; |
||
322 | info.text = TitanUtils_GetGreenText(FRIENDSX_FRIENDS_OPTIONS); |
||
323 | info.notClickable = 1 |
||
324 | UIDropDownMenu_AddButton(info); |
||
325 | |||
326 | info = {}; |
||
327 | info.text = FRIENDSX_FRIENDS_OPTIONS_COUNT; |
||
328 | info.func = function() |
||
329 | TitanToggleVar(TITAN_FRIENDSX_ID, "FriendsCount"); |
||
330 | --TitanPanelSettings.FriendsCount = TitanUtils_Toggle(TitanPanelSettings.FriendsCount); |
||
331 | TitanPanelButton_UpdateButton(TITAN_FRIENDSX_ID); |
||
332 | end |
||
333 | info.keepShownOnClick = 1; |
||
334 | info.checked = TitanGetVar(TITAN_FRIENDSX_ID, "FriendsCount"); |
||
335 | UIDropDownMenu_AddButton(info); |
||
336 | |||
337 | info = {}; |
||
338 | info.text = FRIENDSX_FRIENDS_OPTIONS_SHOW_ONLINE_TOOLTIP; |
||
339 | info.func = function() |
||
340 | TitanToggleVar(TITAN_FRIENDSX_ID, "FriendsShowOnline"); |
||
341 | end |
||
342 | info.keepShownOnClick = 1; |
||
343 | info.checked = TitanGetVar(TITAN_FRIENDSX_ID, "FriendsShowOnline"); |
||
344 | UIDropDownMenu_AddButton(info); |
||
345 | |||
346 | info = {}; |
||
347 | info.text = FRIENDSX_FRIENDS_OPTIONS_MARK_AREA; |
||
348 | info.func = function() |
||
349 | TitanToggleVar(TITAN_FRIENDSX_ID, "FriendsMarkArea"); |
||
350 | end |
||
351 | info.keepShownOnClick = 1; |
||
352 | info.checked = TitanGetVar(TITAN_FRIENDSX_ID, "FriendsMarkArea"); |
||
353 | UIDropDownMenu_AddButton(info); |
||
354 | |||
355 | |||
356 | -- GUILD OPTIONS |
||
357 | info = {}; |
||
358 | info.text = TitanUtils_GetGreenText(FRIENDSX_GUILD_OPTIONS); |
||
359 | info.notClickable = 1; |
||
360 | UIDropDownMenu_AddButton(info); |
||
361 | |||
362 | |||
363 | info = {}; |
||
364 | info.text = FRIENDSX_GUILD_OPTIONS_COUNT; |
||
365 | info.func = function() |
||
366 | TitanToggleVar(TITAN_FRIENDSX_ID, "GuildCount"); |
||
367 | TitanPanelButton_UpdateButton(TITAN_FRIENDSX_ID); |
||
368 | end |
||
369 | info.keepShownOnClick = 1; |
||
370 | info.checked = TitanGetVar(TITAN_FRIENDSX_ID, "GuildCount"); |
||
371 | UIDropDownMenu_AddButton(info); |
||
372 | |||
373 | info = {}; |
||
374 | info.text = FRIENDSX_GUILD_OPTIONS_SHOW_ONLINE_TOOLTIP; |
||
375 | info.func = function() |
||
376 | TitanToggleVar(TITAN_FRIENDSX_ID, "GuildShowOnline"); |
||
377 | end |
||
378 | info.keepShownOnClick = 1; |
||
379 | info.checked = TitanGetVar(TITAN_FRIENDSX_ID, "GuildShowOnline"); |
||
380 | UIDropDownMenu_AddButton(info); |
||
381 | |||
382 | info = {}; |
||
383 | info.text = FRIENDSX_GUILD_OPTIONS_MARK_AREA; |
||
384 | info.func = function() |
||
385 | TitanToggleVar(TITAN_FRIENDSX_ID, "GuildMarkArea"); |
||
386 | end |
||
387 | info.keepShownOnClick = 1; |
||
388 | info.checked = TitanGetVar(TITAN_FRIENDSX_ID, "GuildMarkArea"); |
||
389 | UIDropDownMenu_AddButton(info); |
||
390 | |||
391 | TitanPanelRightClickMenu_AddSpacer(); |
||
392 | |||
393 | TitanPanelRightClickMenu_AddToggleLabelText(TITAN_FRIENDSX_ID); |
||
394 | TitanPanelRightClickMenu_AddCommand(TITAN_PANEL_MENU_HIDE, id, TITAN_PANEL_MENU_FUNC_HIDE); |
||
395 | |||
396 | end |
||
397 | |||
398 | end |