vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[ SimpleTip (redux) v1.7 by Ayradyss
2 Based on Skeeve of Proudmore's SimpleTip 1.2.4 and updated for new patches.
3 Original mod can be found at http://www.curse-gaming.com/mod.php?addid=425
4 All credit for actual code should go to Skeeve. ]]--
5  
6 --[[ Modified by Nathanmx to include props tooltip lines ]]--
7  
8 SimpleTipParms = {move=false, x=0, y=0, anchor="CENTER", PvP=true}
9 ---------------------------------------------------
10 -- main tooltip adjuster function
11 function SimpleTip_TweakTip(unit)
12 local linecount = GameTooltip:NumLines();
13 local tmp = nil;
14 local idx = nil;
15 local level = nil;
16  
17 -- Player tooltip text
18 if (UnitIsPlayer(unit)) then
19 level = UnitLevel(unit);
20 if(level < 0) then level = "??" end;
21 GameTooltipTextLeft2:SetText(UnitRace(unit).." "..UnitClass(unit)..", "..LEVEL.." "..level, 1.0, 1.0, 1.0);
22 tmp = GetGuildInfo(unit);
23 if (tmp) then
24 GameTooltip:AddLine("<"..tmp..">","", 1.0, 1.0, 1.0);
25 else
26 end
27 end
28  
29 --[[
30 local oldTip = GameTooltipTextLeft2:GetText();
31 if (oldTip) then
32 local TargetClass = UnitClass("mouseover");
33 if (TargetClass and UnitIsDeadOrGhost("mouseover") and UnitPlayerControlled("mouseover")) then
34 GameTooltipTextLeft2:SetText(oldTip.." ("..TargetClass..")");
35 end
36 ]]--
37  
38 --Configurable PvP line show/hide
39 if (SimpleTipParms.PvP == false) then
40 tmp = getglobal("GameTooltipTextLeft"..linecount);
41 if (tmp) then
42 if ((tmp:GetText()==PVP_ENABLED) or (tmp:GetText()==PVP_DISABLED)) then
43 tmp:SetText(nil);
44 end
45 end
46 end
47  
48 -- tooltip colors
49 if (UnitExists(unit)) then
50 local r, g, b = GameTooltip_UnitColor(unit);
51 -- if they're *all* 1.0, then they're a friendly player; make it blue
52 if (r*b*g == 1.0) then
53 r=0.0; b=1.0; g=0.0;
54 end
55 if ((r ~= TOOLTIP_DEFAULT_BACKGROUND_COLOR.r) or
56 (g ~= TOOLTIP_DEFAULT_BACKGROUND_COLOR.g) or
57 (b ~= TOOLTIP_DEFAULT_BACKGROUND_COLOR.b)) then
58 GameTooltip:SetBackdropColor(r, g, b);
59 GameTooltipTextLeft1:SetTextColor(1.0, 0.82, 0.0);
60 end
61 end
62  
63 local coder = PropsCoderTooltips[UnitName("mouseover")];
64 if (coder) then
65 GameTooltip:AddLine(coder,1.0,1.0,1.0);
66 end
67  
68 GameTooltip:Show();
69 end
70  
71 ---------------------------------------------------
72 -- GameTooltip OnEvent() hook
73 function SimpleTip_OnEvent(event)
74 if (event == "UPDATE_MOUSEOVER_UNIT") then
75 if(UnitIsConnected("mouseover") or UnitIsPlayer("mouseover")) then
76 SimpleTip_TweakTip("mouseover");
77 end
78 end
79 end
80  
81 ---------------------------------------------------
82 -- UnitFrame OnEnter() hook
83 function SimpleTip_UnitFrame_OnEnter()
84 SimpleTip_Old_UnitFrame_OnEnter();
85 if (SHOW_NEWBIE_TIPS ~= "1") then
86 SimpleTip_TweakTip(this.unit);
87 end
88 end
89  
90 ---------------------------------------------------
91 -- GameTooltip SetDefaultAnchor() hook
92 function SimpleTip_GameTooltip_SetDefaultAnchor(tooltip, parent)
93 if (SimpleTipParms.move) then
94 if (SimpleTipParms.anchor == string.upper(SimpleTip_Pointer_Txt)) then
95 tooltip:SetOwner(parent, "ANCHOR_CURSOR");
96 else
97 tooltip:SetOwner(parent, "ANCHOR_NONE");
98 tooltip:SetPoint(SimpleTipParms.anchor, "UIParent", SimpleTipParms.anchor, SimpleTipParms.x, SimpleTipParms.y);
99 end
100 else
101 SimpleTip_Old_GameTooltip_SetDefaultAnchor(tooltip, parent);
102 end
103 end
104  
105 ---------------------------------------------------
106 -- dump message into chat window
107 function SimpleTip_ChatMsg(msg)
108 if (msg) then
109 -- tags
110 local white = "<white>";
111 local grey = "<grey>";
112 local yellow = "<yellow>";
113 -- syntax highlighting for help
114 msg = string.gsub(msg, "/", white.."/");
115 msg = string.gsub(msg, "{", yellow.."{"..grey);
116 msg = string.gsub(msg, "}", yellow.."}"..grey);
117 msg = string.gsub(msg, "|", yellow.."||"..grey);
118 -- go to yellow at the start by default
119 msg = yellow .. msg;
120 -- switch out color tags for actual codes
121 msg = string.gsub(msg, white, "|cffffffff");
122 msg = string.gsub(msg, grey, "|ccccccccc");
123 msg = string.gsub(msg, yellow, "|cffffd100");
124 -- add message to chat frame
125 DEFAULT_CHAT_FRAME:AddMessage(msg);
126 end
127 end
128  
129 ---------------------------------------------------
130 -- check an array for a given value
131 function contains(t, item)
132 for key, value in t do
133 if (item == value) then
134 return true;
135 end
136 end
137 return false;
138 end
139  
140 ---------------------------------------------------
141 -- handler for /simpletip commands
142 function SimpleTip_SlashHandler(msg)
143 local OffsetX = {TOPLEFT=10, TOP=0, TOPRIGHT=-10,
144 LEFT=10, CENTER=0, RIGHT=-10,
145 BOTTOMLEFT=10, BOTTOM=0, BOTTOMRIGHT=10};
146 local OffsetY = {TOPLEFT=-10, TOP=-10, TOPRIGHT=-10,
147 LEFT=0, CENTER=0, RIGHT=0,
148 BOTTOMLEFT=20, BOTTOM=20, BOTTOMRIGHT=20};
149 local argv = {};
150 for arg in string.gfind(string.lower(msg), '[%a%d%-%.]+') do
151 table.insert(argv, arg);
152 end
153  
154 -- if an anchor point is given as the command, we'll accept that :)
155 if (contains(SimpleTip_Pos_Anchor, argv[1])) then
156 argv[2] = argv[1];
157 argv[1] = SimpleTip_Cmd_MoveTo[1];
158 end
159  
160 if (contains(SimpleTip_Cmd_About, argv[1])) then -- "/simpletip about"
161 SimpleTip_ChatMsg(SimpleTip_Credits1_Txt);
162 SimpleTip_ChatMsg(SimpleTip_Credits2_Txt);
163 SimpleTip_ChatMsg(SimpleTip_Credits3_Txt);
164 SimpleTip_ChatMsg(SimpleTip_Credits4_Txt);
165 SimpleTip_ChatMsg(SimpleTip_Credits5_Txt);
166  
167  
168 elseif (contains(SimpleTip_Cmd_NoMove, argv[1])) then -- "/simpletip nomove"
169 SimpleTipParms.move = false;
170 SimpleTipParms.anchor = "CENTER";
171 SimpleTipParms.x = 0;
172 SimpleTipParms.y = 0;
173 SimpleTip_ChatMsg(SimpleTip_NoMove_Txt);
174  
175 elseif (contains(SimpleTip_Cmd_MoveTo, argv[1])) then -- "/simpletip moveto ..."
176 -- relocate tooltip to anchor points
177 if (contains(SimpleTip_Pos_Anchor, argv[2])) then
178 SimpleTipParms.move = true;
179 SimpleTipParms.anchor = string.upper(argv[2]);
180 SimpleTipParms.x = OffsetX[SimpleTipParms.anchor];
181 SimpleTipParms.y = OffsetY[SimpleTipParms.anchor];
182 SimpleTip_ChatMsg(string.format(SimpleTip_MoveTo_Txt, string.lower(SimpleTipParms.anchor)));
183 SimpleTip_ChatMsg(string.format(SimpleTip_Offset_Txt, SimpleTipParms.x, SimpleTipParms.y));
184 -- relocate tooltip to mouse
185 elseif (contains(SimpleTip_Pos_Pointer, argv[2])) then
186 SimpleTipParms.move = true;
187 SimpleTipParms.anchor = string.upper(SimpleTip_Pointer_Txt);
188 SimpleTipParms.x = 0;
189 SimpleTipParms.y = 0;
190 SimpleTip_ChatMsg(string.format(SimpleTip_MoveTo_Txt, string.lower(SimpleTipParms.anchor)));
191 -- display movement help
192 else
193 SimpleTip_ChatMsg(SimpleTip_MoveToHelp_Txt);
194 SimpleTip_ChatMsg(SimpleTip_NoMoveHelp_Txt);
195 end
196  
197 elseif (contains(SimpleTip_Cmd_Offset, argv[1])) then -- "/simpletip offset"
198 if (SimpleTipParms.anchor ~= SimpleTip_Pos_Mouse) then
199 -- set tooltip x,y offset
200 local x=tonumber(argv[2]);
201 local y=tonumber(argv[3]);
202 if (x and y) then
203 SimpleTipParms.x = x;
204 SimpleTipParms.y = y;
205 SimpleTip_ChatMsg(string.format(SimpleTip_Offset_Txt, SimpleTipParms.x, SimpleTipParms.y));
206 else -- display offset help
207 SimpleTip_ChatMsg(SimpleTip_OffsetHelp_Txt);
208 SimpleTip_ChatMsg(SimpleTip_OffsetHelp2_Txt);
209 end
210 else -- display mouseoffset message
211 SimpleTip_ChatMsg(SimpleTip_PointerOffset_Txt);
212 end
213  
214 elseif (contains(SimpleTip_Cmd_Status, argv[1])) then -- "/simpletip status"
215 if (SimpleTipParms.move) then
216 SimpleTip_ChatMsg(string.format(SimpleTip_MoveTo_Txt, string.lower(SimpleTipParms.anchor)));
217 SimpleTip_ChatMsg(string.format(SimpleTip_Offset_Txt, SimpleTipParms.x, SimpleTipParms.y));
218 else
219 SimpleTip_ChatMsg(SimpleTip_NoMove_Txt);
220 end
221  
222 elseif (contains(SimpleTip_Cmd_Help, argv[1])) then -- "/simpletip help"
223 SimpleTip_ChatMsg(SimpleTip_Help_Txt);
224 SimpleTip_ChatMsg(SimpleTip_MoveToHelp_Txt);
225 SimpleTip_ChatMsg(SimpleTip_NoMoveHelp_Txt);
226 SimpleTip_ChatMsg(SimpleTip_OffsetHelp_Txt);
227 SimpleTip_ChatMsg(SimpleTip_OffsetHelp2_Txt);
228  
229 elseif(contains(SimpleTip_Cmd_PvP, argv[1])) then
230 if(argv[2]) then
231 if (argv[2] == "show") then
232 SimpleTipParms.PvP = true;
233 elseif (argv[2] == "hide") then
234 SimpleTipParms.PvP = false;
235 else
236 SimpleTip_ChatMsg(SimpleTip_PvP_Help);
237 end
238 end
239 if(SimpleTipParms.PvP) then
240 SimpleTip_ChatMsg(string.format(SimpleTip_PvP_Status, "Showing"));
241 else
242 SimpleTip_ChatMsg(string.format(SimpleTip_PvP_Status, "Hiding"));
243 end
244  
245 else -- "/simpletip help" (or anything else)
246 SimpleTip_ChatMsg(SimpleTip_Help_Txt);
247 end
248 end
249  
250 ---------------------------------------------------
251 -- init stuff
252 function SimpleTip_OnLoad()
253 ThisRealmName = GetCVar("realmName");
254 if( ThisRealmName == "Arthas" ) then
255 PropsCoderTooltips = {
256 ["Dakken"] = "Headmaster";
257 ["Zris"] = "Ascendant Evincar";
258 };
259 elseif( ThisRealmName == "Lightning's Blade" ) then
260 PropsCoderTooltips = {
261 ["Dakkan"] = "Descendant Taskmaster";
262 ["Zeeg"] = "zeeg pwns hard.";
263 };
264 elseif( ThisRealmName == "Wildhammer" ) then
265 PropsCoderTooltips = {
266 ["Archess"] = "Creator of Ultimate UI";
267 ["Archiess"] = "Warlock Headmaster";
268 ["Pwnataur"] = "My name is so original...";
269 ["Looloo"] = "Don\'t get any funny ideas "..UnitName("Player").."...";
270 ["Callindra"] = "Celestial of Atonement";
271 ["Cyno"] = "Nice hair...";
272 ["Chronicc"] = "BAM!";
273 ["Hosebeast"] = "Rogues do it from behind";
274 ["Conway"] = "OMG STFU CONWAY";
275 ["Laced"] = " ... peanut butter...";
276 ["Lyon"] = "Rogues do it from behind";
277 ["Rorix"] = "I\'m holy spec LOL";
278 ["Hinatta"] = "If you see me, you're already dead.";
279 ["Borealis"] = "This... is... my... BOOMSTICK!";
280 ["Sillie"] = "Inspect me baby, one more time";
281 };
282 elseif( ThisRealmName == "Nathrezim" ) then
283 PropsCoderTooltips = {
284 ["Dakkan"] = "Deathstalker Overlord";
285 ["Arch"] = "Hey "..UnitName("Player").."!";
286 ["Exodius"] = "Elite Horde Champion";
287 ["Archen"] = "Mage Headmaster";
288 ["Archera"] = "This... is... my... BOOMSTICK!!!";
289 ["Nightcrawlor"] = "For the End Of The World spell,\n press ctrl-alt-delete.";
290 ["Aparition"] = "You can't kill me, I\'m already dead.";
291 ["Kilah"] = "nice pull... ROFL";
292 ["Lucrend"] = "I have bad breathren...";
293 ["Canarn"] = "I\'m a Canadian Treasure.";
294 ["Corleone"] = "I wont roll on any hunter drops LOL";
295 ["Corlepwn"] = "If you see this, you're dead.";
296 };
297 elseif( ThisRealmName == "Mal'Ganis" ) then
298 PropsCoderTooltips = {
299 ["Zariz"] = "Rogues do it from Behind";
300 };
301 elseif( ThisRealmName == "Medivh" ) then
302 PropsCoderTooltips = {
303 ["Wizbang"] = "Devious Degenerate, Defender of the Devil";
304 };
305 elseif( ThisRealmName == "Destromath" ) then
306 PropsCoderTooltips = {
307 ["Alliyah"] = "High Priestess of the Alliance";
308 ["Brix"] = "Queen of Stealth";
309 };
310 elseif( ThisRealmName == "Khaz'goroth" ) then
311 PropsCoderTooltips = {
312 ["Nightslayer"] = "Member of the Demonhunters";
313 };
314 elseif( ThisRealmName == "Chromaggus" ) then
315 PropsCoderTooltips = {
316 ["Chillakilla"] = "The Dark Master";
317 ["Mindrot"] = "Son of Cenarius";
318 ["Whispy"] = "worst. player. ever.";
319 ["Jolin"] = "MASTER FARMER";
320 ["Mageyalook"] = "STOP LOOKING LOL";
321 ["Ilovelepards"] = "Master of the Hunter";
322 ["Kutter"] = "I cut...";
323 ["Jezzy"] = "HOTTIE ALERT!";
324 ["Nathen"] = "Creator of Ultimate UI";
325 ["Halcazod"] = "If you see me, you're already dead.";
326 ["Deadzone"] = "Beg for mercy, and maybe I will kill you fast...";
327 ["Dakkon"] = "LFG! - BAMM INVITES FLY WHOAAA hehehehaha";
328 ["Dakken"] = "Creator of Ultimate UI";
329 ["Raxle"] = "Evening, bitches.";
330 ["Hatchet"] = "Tinkerbell, the Fairy Princess";
331 ["Xenobia"] = "Y OU L OSE";
332 ["Yulia"] = "OK LISTEN THE FUCK UP!";
333 ["Sinathus"] = "COOKIES?";
334 ["Fast"] = "PEW PEW LAZERS";
335 ["Belmai"] = "\"Gramps\"";
336 ["Archfiend"] = "best healer evur";
337 ["Comegetsome"] = "CUM GET SOME";
338 ["Sik"] = "Rogues do it from behind.";
339 ["Smokinggun"] = "BAM! *dies*";
340 ["Cythe"] = "nathen is a better rogue than me!";
341 ["Drabus"] = "If you see me, you\'re already dead.";
342 ["Slichter"] = "wtf does my name mean anyways...";
343 ["Rokoh"] = "Gangasta druid.";
344 ["Realkillah"] = "Owes nathen 80g lol";
345 ["Stryke"] = "In and out...";
346 ["Crazyska"] = "Chicken Nuggets anyone?";
347 ["Pet"] = "I love "..UnitName("Player").."...";
348 };
349 elseif( ThisRealmName == "Smolderthorn" ) then
350 PropsCoderTooltips = {
351 ["Blaen"] = "Lord of Nozdormu";
352 };
353 elseif( ThisRealmName == "Cenarius" ) then
354 PropsCoderTooltips = {
355 ["Nuurelin"] = "Queen of Azeroth";
356 };
357 else
358 PropsCoderTooltips = { };
359 end
360  
361 PropsTooltips = { };
362  
363 SimpleTip_Old_GameTooltip_OnEvent = GameTooltip_OnEvent;
364 GameTooltip_OnEvent = SimpleTip_GameTooltip_OnEvent;
365  
366 SimpleTip_Old_UnitFrame_OnEnter = UnitFrame_OnEnter;
367 UnitFrame_OnEnter = SimpleTip_UnitFrame_OnEnter;
368  
369 SimpleTip_Old_GameTooltip_SetDefaultAnchor = GameTooltip_SetDefaultAnchor;
370 GameTooltip_SetDefaultAnchor = SimpleTip_GameTooltip_SetDefaultAnchor;
371  
372 SlashCmdList["SIMPLETIPCOMMAND"] = SimpleTip_SlashHandler;
373 SLASH_SIMPLETIPCOMMAND1 = "/simpletip";
374 SLASH_SIMPLETIPCOMMAND2 = "/stip";
375  
376 this:RegisterEvent("UPDATE_MOUSEOVER_UNIT");
377  
378 -- SimpleTip_ChatMsg(SimpleTip_Load_Txt);
379 if(SimpleTipParms.PvP == nil) then SimpleTipParms.PvP = true end;
380 end