vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 TooltipsBase_ENABLE = 1;
2 TOOLTIP_IS_NEWBIE = nil;
3 TooltipsBase_Original_GameTooltip_ClearMoney = nil;
4 TooltipsBase_Original_GameTooltip_SetUnit = nil;
5  
6 RealmPlayers = { };
7 RealmGuilds = { };
8  
9 -- unithandle = "player" "target"
10 -- unittype = "elite" "rare" "raremob"
11  
12 function UniversalFrameHandler(unithandle,unittype)
13 if( unithandle == "target" ) then
14 if( unittype == "elite" ) then
15 TargetFrameTexture:SetTexture("Interface\\TargetingFrame\\UI-TargetingFrame-Elite");
16 DUF_ChangeItNow_Elite();
17 elseif( unittype == "rare" ) then
18 TargetFrameTexture:SetTexture("Interface\\TargetingFrame\\UI-TargetingFrame-Rare");
19 DUF_ChangeItNow_Rare();
20 elseif( unittype == "raremob" ) then
21 TargetFrameTexture:SetTexture("Interface\\TargetingFrame\\UI-TargetingFrame-RareMob");
22 end
23 elseif( unithandle == "player" ) then
24 if( unittype == "elite" ) then
25 PlayerFrameTexture:SetTexture("Interface\\TargetingFrame\\UI-TargetingFrame-Elite");
26 elseif( unittype == "rare" ) then
27 PlayerFrameTexture:SetTexture("Interface\\TargetingFrame\\UI-TargetingFrame-Rare");
28 elseif( unittype == "raremob" ) then
29 PlayerFrameTexture:SetTexture("Interface\\TargetingFrame\\UI-TargetingFrame-RareMob");
30 end
31 end
32 end
33  
34 function DUF_ChangeItNow_Elite()
35 if(DUF_Options) then
36 local texture;
37 if (DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture and DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture ~= "") then
38 texture = "Interface\\AddOns\\DiscordUnitFrames\\CustomTextures\\"..DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture;
39 elseif (DUF_Settings[DUF_INDEX].target.EliteTexture.faceleft) then
40 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\EliteLeft";
41 else
42 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\Elite";
43 end
44 if (DUF_OPTIONS_VISIBLE and (not DUF_Settings[DUF_INDEX].target.EliteTexture.hide)) then
45 DUF_TargetFrame_EliteTexture_Texture:SetTexture(texture);
46 DUF_TargetFrame_EliteTexture:Show();
47 return;
48 end
49 if (not DUF_Settings[DUF_INDEX].target.EliteTexture.hide) then
50 if (DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture and DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture ~= "") then
51 texture = "Interface\\AddOns\\DiscordUnitFrames\\CustomTextures\\"..DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture;
52 elseif (DUF_Settings[DUF_INDEX].target.EliteTexture.faceleft) then
53 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\RareLeft";
54 else
55 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\Rare";
56 end
57 DUF_TargetFrame_EliteTexture_Texture:SetTexture(texture);
58 DUF_TargetFrame_EliteTexture:Show();
59 end
60 end
61 end
62  
63 function DUF_ChangeItNow_Rare()
64 if(DUF_Options) then
65 local texture;
66 if (DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture and DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture ~= "") then
67 texture = "Interface\\AddOns\\DiscordUnitFrames\\CustomTextures\\"..DUF_Settings[DUF_INDEX].target.EliteTexture.elitetexture;
68 elseif (DUF_Settings[DUF_INDEX].target.EliteTexture.faceleft) then
69 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\EliteLeft";
70 else
71 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\Elite";
72 end
73 if (DUF_OPTIONS_VISIBLE and (not DUF_Settings[DUF_INDEX].target.EliteTexture.hide)) then
74 DUF_TargetFrame_EliteTexture_Texture:SetTexture(texture);
75 DUF_TargetFrame_EliteTexture:Show();
76 return;
77 end
78 if (not DUF_Settings[DUF_INDEX].target.EliteTexture.hide) then
79 if (DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture and DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture ~= "") then
80 texture = "Interface\\AddOns\\DiscordUnitFrames\\CustomTextures\\"..DUF_Settings[DUF_INDEX].target.EliteTexture.raretexture;
81 elseif (DUF_Settings[DUF_INDEX].target.EliteTexture.faceleft) then
82 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\RareLeft";
83 else
84 texture = "Interface\\AddOns\\DiscordUnitFrames\\Icons\\Rare";
85 end
86 DUF_TargetFrame_EliteTexture_Texture:SetTexture(texture);
87 DUF_TargetFrame_EliteTexture:Show();
88 end
89 end
90 end
91  
92 -- ARTHAS
93 function Realm_Arthas()
94 RealmPlayers = {
95 ["Mobscene"] = "elite";
96 ["Faredegyn"] = "elite";
97 ["Damagius"] = "elite";
98 ["Sketchy"] = "elite";
99 ["Dakkon"] = "elite";
100 };
101 RealmGuilds = { };
102 end
103  
104 -- NATHREZIM
105 function Realm_Nathrezim()
106 RealmPlayers = {
107 ["Dakkan"] = "elite";
108 ["Exodius"] = "elite";
109 ["Arch"] = "elite";
110 ["Kilah"] = "elite";
111 ["Nightcrawlor"] = "elite";
112 ["Archen"] = "elite";
113 ["Archera"] = "elite";
114 };
115 RealmGuilds = {
116 ["Ab Igne Inferiori"] = "rare";
117 };
118 end
119  
120 -- ELDRAD THALAS
121 function Realm_Eldrad_Thalas()
122 RealmPlayers = {
123 ["Bikk"] = "elite";
124 };
125 RealmGuilds = { };
126 end
127  
128 -- DUNEMAUL
129 function Realm_Dunemaul()
130 RealmPlayers = {
131 ["Melady"] = "elite";
132 ["Dardas"] = "elite";
133 ["Xandarous"] = "elite";
134 };
135 RealmGuilds = { };
136 end
137  
138 -- STORMSCALE
139 function Realm_Stormscale()
140 RealmPlayers = {
141 ["Valec"] = "elite";
142 ["Vilandra"] = "elite";
143 };
144 RealmGuilds = { };
145 end
146  
147 -- MAL'GANIS
148 function Realm_MalGanis()
149 RealmPlayers = {
150 ["Zariz"] = "elite";
151 };
152 RealmGuilds = { };
153 end
154  
155 -- DRAGONBLIGHT
156 function Realm_Dragonblight()
157 RealmPlayers = {
158 ["Kellen"] = "elite";
159 ["Nossferratus"] = "elite";
160 };
161 RealmGuilds = { };
162 end
163  
164 -- MEDIVH
165 function Realm_Medivh()
166 RealmPlayers = {
167 ["Wizbang"] = "rare";
168 };
169 RealmGuilds = { };
170 end
171  
172 -- STORMRAGE
173 function Realm_Stormrage()
174 RealmPlayers = {
175 ["Breasal"] = "rare";
176 };
177 RealmGuilds = { };
178 end
179  
180 -- ARCHIMONDE
181 function Realm_Archimonde()
182 RealmPlayers = {
183 ["UFLA"] = "rare";
184 };
185 RealmGuilds = { };
186 end
187  
188 -- ICECROWN
189 function Realm_Icecrown()
190 RealmPlayers = {
191 ["Eludeveren"] = "elite";
192 };
193 RealmGuilds = { };
194 end
195  
196 -- BLOODSCALP
197 function Realm_Bloodscalp()
198 RealmPlayers = {
199 ["Canibis"] = "elite";
200 };
201 RealmGuilds = { };
202 end
203  
204 -- PERENOLDE
205 function Realm_Perenolde()
206 RealmPlayers = {
207 ["Nytebandit"] = "elite";
208 };
209 RealmGuilds = { };
210 end
211  
212 -- AGGRAMAR
213 function Realm_Aggramar()
214 RealmPlayers = {
215 ["Showdon"] = "elite";
216 };
217 RealmGuilds = { };
218 end
219  
220 -- DEATHWING
221 function Realm_Deathwing()
222 RealmPlayers = {
223 ["Narconis"] = "elite";
224 };
225 RealmGuilds = { };
226 end
227  
228 -- DAGGERSPINE
229 function Realm_Daggerspine()
230 RealmPlayers = {
231 ["Dyami"] = "elite";
232 };
233 RealmGuilds = { };
234 end
235  
236 -- LIGHTNING'S BLADE
237 function Realm_LightningsBlade()
238 RealmPlayers = {
239 ["Zeeg"] = "elite";
240 ["Dakkan"] = "elite";
241 };
242 RealmGuilds = {
243 ["Descension"] = "rare";
244 };
245 end
246  
247 -- SKULLCRUSHER
248 function Realm_Skullcrusher()
249 RealmPlayers = {
250 ["Reaver"] = "elite";
251 ["Wizzy"] = "elite";
252 };
253 RealmGuilds = { };
254 end
255  
256 -- KHAZ'GOROTH
257 function Realm_Khazgoroth()
258 RealmPlayers = {
259 ["Nightslayer"] = "rare";
260 };
261 RealmGuilds = { };
262 end
263  
264 -- AZJOL-NERUB
265 function Realm_AzjolNerub()
266 RealmPlayers = {
267 ["Valentyne"] = "rare";
268 };
269 RealmGuilds = { };
270 end
271  
272 -- CHROMAGGUS
273 function Realm_Chromaggus()
274 RealmPlayers = {
275 ["Jezzy"] = "elite";
276 ["Chillakilla"] = "elite";
277 ["Dakken"] = "elite";
278 ["Dakkon"] = "elite";
279 ["Nathen"] = "elite";
280 ["Raxle"] = "elite";
281 ["Xenobia"] = "elite";
282 ["Crazyska"] = "elite";
283 ["Yulia"] = "elite";
284 };
285 RealmGuilds = {
286 ["Mayhem"] = "rare";
287 };
288 end
289  
290 -- WILDHAMMER
291 function Realm_Wildhammer()
292 RealmPlayers = {
293 ["Archess"] = "elite";
294 ["Prizm"] = "elite";
295 ["Sen"] = "elite";
296 ["Cen"] = "elite";
297 ["Shikota"] = "elite";
298 ["Archiess"] = "elite";
299 ["Borealis"] = "elite";
300 };
301 RealmGuilds = {
302 ["Atonement"] = "rare";
303 };
304 end
305  
306 -- SMOLDERTHORN
307 function Realm_Smolderthorn()
308 RealmPlayers = {
309 ["Blaen"] = "rare";
310 };
311 RealmGuilds = { };
312 end
313  
314 -- CENARIUS
315 function Realm_Cenarius()
316 RealmPlayers = {
317 ["Nuurelin"] = "elite";
318 };
319 RealmGuilds = { };
320 end
321  
322 function TooltipsBase_GameTooltip_SetUnit(this,unit)
323 TooltipsBase_Original_GameTooltip_SetUnit(this,unit);
324 TooltipsBase_UnitHandler(unit);
325 TooltipsBase_MouseoverFixSize();
326 end
327  
328 function TooltipsBase_GameTooltip_OnHide()
329 TOOLTIP_IS_NEWBIE = nil;
330 -- fix for clear money
331 if (TooltipsBase_ENABLE == 1) then
332 TooltipsBase_Original_GameTooltip_ClearMoney();
333 end
334 end
335  
336 function TooltipsBase_GameTooltip_ClearMoney()
337 if (TooltipsBase_ENABLE == 1) then
338 -- do nothing, this is handled in the onHide now!
339 else
340 TooltipsBase_Original_GameTooltip_ClearMoney();
341 end
342 end
343  
344 -- Handler called when mouseing over a unit
345 -- Example usage:
346  
347 function TooltipsBase_UnitHandler(type)
348 TargetBorderType = RealmPlayers[UnitName("target")];
349 if( TargetBorderType ) then
350 UniversalFrameHandler("target", TargetBorderType);
351 else
352 TargetBorderType = RealmGuilds[GetGuildInfo("target")];
353 if( TargetBorderType ) then
354 UniversalFrameHandler("target", TargetBorderType);
355 end
356 end
357 end
358  
359 -- fix the size and remove blank lines
360 -- note that blank lines can still be created by setting the string to ""
361 function TooltipsBase_MouseoverFixSize()
362 local tooltipName = "GameTooltip";
363 local newWidth = 0;
364 local newHeight = 20;
365 local lastValid = 0;
366 for i = 1, 20 do
367 local checkText = getglobal(tooltipName.."TextLeft"..i);
368 if (checkText and checkText:IsVisible()) then
369 local width = checkText:GetWidth() + 24;
370 if (width > newWidth) then
371 newWidth = width;
372 end
373 newHeight = newHeight + checkText:GetHeight() + 2;
374 lastValid = lastValid + 1;
375 if (lastValid ~= i) then
376 local moveText = getglobal(tooltipName.."TextLeft"..lastValid);
377 if (moveText ~= nil) then
378 moveText:SetText(checkText:GetText());
379 moveText:Show();
380 checkText:SetText("");
381 checkText:Hide();
382 end
383 end
384 end
385 end
386  
387 GameTooltip:SetWidth(newWidth);
388 GameTooltip:SetHeight(newHeight);
389 end
390  
391  
392 function TooltipsBase_IsNewbieTip()
393 return TOOLTIP_IS_NEWBIE ;
394 end
395  
396 function TooltipsBase_GameTooltip_AddNewbieTip(normalText, r, g, b, newbieText, noNormalText)
397 if ( SHOW_NEWBIE_TIPS == "1" ) then
398 TOOLTIP_IS_NEWBIE = 1;
399 else
400 TOOLTIP_IS_NEWBIE = nil;
401 end
402  
403 end
404  
405  
406 function TooltipsBase_OnLoad()
407 -- Sea.util.hook("UnitFrame_OnEnter","TooltipsBase_UnitFrame_OnEnter","after");
408 -- Sea.util.hook("GameTooltip_OnHide","TooltipsBase_GameTooltip_OnHide","after");
409 -- Sea.util.hook("GameTooltip_AddNewbieTip","TooltipsBase_GameTooltip_AddNewbieTip","after");
410 -- Sea.util.hook("TooltipsBase_UnitHandler","TooltipsProps_UnitHandler","after");
411 -- fix for clear money
412 TooltipsBase_Original_GameTooltip_ClearMoney = GameTooltip_ClearMoney;
413 GameTooltip_ClearMoney = TooltipsBase_GameTooltip_ClearMoney;
414 -- Sea.util.hook doesnt handle GameTooltip:SetUnit
415 -- however this doesnt seem to be working right?
416 TooltipsBase_Original_GameTooltip_SetUnit = GameTooltip.SetUnit;
417 GameTooltip.SetUnit = TooltipsBase_GameTooltip_SetUnit;
418  
419  
420  
421 if(UltimateUI_RegisterConfiguration) then
422 UltimateUI_RegisterConfiguration(
423 "UUI_TOOLTIPSBASE",
424 "SECTION",
425 TOOLTIPSBASE_SEP,
426 TOOLTIPSBASE_SEP_INFO
427 );
428 UltimateUI_RegisterConfiguration(
429 "UUI_TOOLTIPSBASE_SEP",
430 "SEPARATOR",
431 TOOLTIPSBASE_SEP,
432 TOOLTIPSBASE_SEP_INFO
433 );
434 UltimateUI_RegisterConfiguration(
435 "UUI_TOOLTIPS_BASE_C",
436 "CHECKBOX",
437 TOOLTIPSBASE_ENABLE,
438 TOOLTIPSBASE_ENABLE_INFO,
439 TooltipsBase_Toggle,
440 1
441 );
442 end
443  
444 ThisRealmName = GetCVar("realmName");
445 -- Set correct props info according to realm
446 if( ThisRealmName == "Arthas" ) then
447 Realm_Arthas();
448 elseif( ThisRealmName == "Nathrezim" ) then
449 Realm_Nathrezim();
450 elseif( ThisRealmName == "Chromaggus" ) then
451 Realm_Chromaggus();
452 elseif( ThisRealmName == "Eldrad Thalas" ) then
453 Realm_Eldrad_Thalas();
454 elseif( ThisRealmName == "Dunemaul" ) then
455 Realm_Dunemaul();
456 elseif( ThisRealmName == "Stormscale" ) then
457 Realm_Stormscale();
458 elseif( ThisRealmName == "Mal'Ganis" ) then
459 Realm_MalGanis();
460 elseif( ThisRealmName == "Dragonblight" ) then
461 Realm_Dragonblight();
462 elseif( ThisRealmName == "Medivh" ) then
463 Realm_Medivh();
464 elseif( ThisRealmName == "Stormrage" ) then
465 Realm_Stormrage();
466 elseif( ThisRealmName == "Archimonde" ) then
467 Realm_Archimonde();
468 elseif( ThisRealmName == "Icecrown" ) then
469 Realm_Icecrown();
470 elseif( ThisRealmName == "Bloodscalp" ) then
471 Realm_Bloodscalp();
472 elseif( ThisRealmName == "Perenolde" ) then
473 Realm_Perenolde();
474 elseif( ThisRealmName == "Aggramar" ) then
475 Realm_Aggramar();
476 elseif( ThisRealmName == "Deathwing" ) then
477 Realm_Deathwing();
478 elseif( ThisRealmName == "Daggerspine" ) then
479 Realm_Daggerspine();
480 elseif( ThisRealmName == "Lightning's Blade" ) then
481 Realm_LightningsBlade();
482 elseif( ThisRealmName == "Skullcrusher" ) then
483 Realm_Skullcrusher();
484 elseif( ThisRealmName == "Azjol-Nerub" ) then
485 Realm_AzjolNerub();
486 elseif( ThisRealmName == "Khaz'goroth" ) then
487 Realm_Khazgoroth();
488 elseif( ThisRealmName == "Wildhammer" ) then
489 Realm_Wildhammer();
490 elseif( ThisRealmName == "Smolderthorn" ) then
491 Realm_Smolderthorn();
492 elseif( ThisRealmName == "Cenarius" ) then
493 Realm_Cenarius();
494 end
495  
496 -- this:RegisterEvent("UPDATE_MOUSEOVER_UNIT");
497 end
498 function TooltipsBase_Toggle(toggle)
499 if(toggle == 1) then
500 TooltipsBase_ENABLE = 1;
501 else
502 TooltipsBase_ENABLE = nil;
503 end
504 end