vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function GB_UnitFrames_Initialize()
2 if (not GB_INITIALIZED) then return; end
3 GB_UnitFrames_Detect();
4  
5 for unit, value in GB_UNITFRAMES do
6 for i, frame in value.frames do
7 local clickbox = getglobal(GB_CLICKBOXES2[unit][i]);
8 unit2 = unit;
9 if (unit == "target") then unit2 = "friendlytarget"; end
10 local offsets = GB_Settings[GB_INDEX][unit2].Clickbox;
11 if (not getglobal(frame)) then
12 clickbox:ClearAllPoints();
13 clickbox:SetPoint("TOP", "UIParent", "BOTTOM", 100, -100);
14 clickbox:Hide();
15 else
16 local frameheight = getglobal(frame):GetHeight();
17 local framewidth = getglobal(frame):GetWidth();
18 if ( (offsets.x1 - offsets.x2) > framewidth) then
19 offsets.x2 = 0;
20 end
21 if ( (offsets.y2 - offsets.y1) > frameheight) then
22 offsets.y1 = 0;
23 end
24 clickbox:ClearAllPoints();
25 clickbox:SetPoint("TOPLEFT", frame, "TOPLEFT", offsets.x1, offsets.y1);
26 clickbox:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", offsets.x2, offsets.y2);
27 clickbox:Raise()
28 end
29 end
30 end
31  
32 if (not GB_Settings[GB_INDEX].hideClickboxes) then
33 if (UnitName("pet")) then
34 GB_Pet0Clickbox:Show();
35 end
36 for i=1,GetNumPartyMembers() do
37 getglobal("GB_Party"..i.."Clickbox"):Show();
38 if (UnitName("partypet"..i)) then
39 getglobal("GB_Pet"..i.."Clickbox"):Show();
40 end
41 end
42 end
43 end
44  
45 function GB_UnitFrames_Detect()
46 if (DUF_EventFrame) then
47 GB_UNITFRAMES = {
48 player = {
49 frames={"DUF_PlayerFrame"},
50 onClick = {name="DUF_UnitFrame_OnClick", params={"mousebutton", "unitID"}},
51 onEnter = {name="DUF_UnitFrame_OnEnter", params={"unitID", "frame"}},
52 onLeave = {name="DUF_UnitFrame_OnLeave", params={"frame"}},
53 onMouseUp = {name="", override="GB_DUF_OnMouseUp"}
54 },
55 party = {
56 frames={"DUF_PartyFrame1", "DUF_PartyFrame2", "DUF_PartyFrame3", "DUF_PartyFrame4"},
57 onClick = {name="DUF_UnitFrame_OnClick", params={"mousebutton", "unitID"}},
58 onEnter = {name="DUF_UnitFrame_OnEnter", params={"unitID", "frame"}},
59 onLeave = {name="DUF_UnitFrame_OnLeave", params={"frame"}},
60 onMouseUp = {name="", override="GB_DUF_OnMouseUp"}
61 },
62 target = {
63 frames={"DUF_TargetFrame"},
64 onClick = {name="DUF_UnitFrame_OnClick", params={"mousebutton", "unitID"}},
65 onEnter = {name="DUF_UnitFrame_OnEnter", params={"unitID", "frame"}},
66 onLeave = {name="DUF_UnitFrame_OnLeave", params={"frame"}},
67 onMouseUp = {name="", override="GB_DUF_OnMouseUp"}
68 },
69 pet = {
70 frames={"DUF_PetFrame"},
71 onClick = {name="DUF_UnitFrame_OnClick", params={"mousebutton", "unitID"}},
72 onEnter = {name="DUF_UnitFrame_OnEnter", params={"unitID", "frame"}},
73 onLeave = {name="DUF_UnitFrame_OnLeave", params={"frame"}},
74 onMouseUp = {name="", override="GB_DUF_OnMouseUp"}
75 },
76 partypet = {
77 frames={"DUF_PartyPetFrame1", "DUF_PartyPetFrame2", "DUF_PartyPetFrame3", "DUF_PartyPetFrame4"},
78 onClick = {name="DUF_UnitFrame_OnClick", params={"mousebutton", "unitID"}},
79 onEnter = {name="DUF_UnitFrame_OnEnter", params={"unitID", "frame"}},
80 onLeave = {name="DUF_UnitFrame_OnLeave", params={"frame"}},
81 onMouseUp = {name="", override="GB_DUF_OnMouseUp"}
82 }
83 };
84 elseif (MGParty_Member0) then
85 GB_UNITFRAMES = {
86 player = {
87 frames={"MGParty_Member0"},
88 onClick= {name="MGParty_Member_OnClick", params={}},
89 onEnter = {name="MGParty_Member_OnEnter", params={}},
90 onLeave = {name="MGParty_Member_OnLeave", params={}},
91 onDrag = {name="PlayerFrame_OnReceiveDrag", params = {}}
92 },
93 party = {
94 frames={"MGParty_Member1", "MGParty_Member2", "MGParty_Member3", "MGParty_Member4"},
95 onClick= {name="MGParty_Member_OnClick", params={}},
96 onEnter = {name="MGParty_Member_OnEnter", params={}},
97 onLeave = {name="MGParty_Member_OnLeave", params={}}
98 },
99 target = {
100 frames={"MGTarget_Frame"},
101 onClick = {name="MGTarget_OnClick", params={"mousebutton"}},
102 onEnter = {name="MGTarget_OnEnter", params = {}},
103 onLeave = {name="MGTarget_OnLeave", params = {}}
104 },
105 pet = {
106 frames={"PetFrame"},
107 onClick = {name="PetFrame_OnClick", params={"mousebutton"}},
108 onEnter = {name="UnitFrame_OnEnter", override="GB_DefaultPartyFrame_OnEnter", params = {}},
109 onLeave = {name="UnitFrame_OnLeave", override="GB_DefaultPartyFrame_OnLeave", params = {}}
110 },
111 partypet = {
112 frames={"PartyMemberFrame1PetFrame", "PartyMemberFrame2PetFrame", "PartyMemberFrame3PetFrame", "PartyMemberFrame4PetFrame"},
113 onClick = {name="PartyMemberPetFrame_OnClick", params={}},
114 onEnter = {name="UnitFrame_OnEnter", params = {}},
115 onLeave = {name="UnitFrame_OnLeave", params = {}}
116 }
117 };
118 elseif (MGplayer) then
119 GB_UNITFRAMES = {
120 player = {
121 frames={"MGplayer"},
122 onClick= {name="MiniGroup_Member_OnClick", params={"mousebutton"}},
123 onEnter = {name="", override = "GB_MiniGroup_OnEnter", params={}},
124 onLeave = {name="", override = "GB_MiniGroup_OnLeave", params={}},
125 onMouseDown = {name="MiniGroup_Member_OnMouseDown", params={"mousebutton"}},
126 onMouseUp = {name="MiniGroup_Member_OnMouseUp", params={"mousebutton"}}
127 },
128 party = {
129 frames={"MGparty1", "MGparty2", "MGparty3", "MGparty4"},
130 onClick= {name="MiniGroup_Member_OnClick", params={"mousebutton"}},
131 onEnter = {name="", override = "GB_MiniGroup_OnEnter", params={}},
132 onLeave = {name="", override = "GB_MiniGroup_OnLeave", params={}},
133 onMouseDown = {name="MiniGroup_Member_OnMouseDown", params={"mousebutton"}},
134 onMouseUp = {name="MiniGroup_Member_OnMouseUp", params={"mousebutton"}}
135 },
136 target = {
137 frames={"MGtarget"},
138 onClick= {name="MiniGroup_Member_OnClick", params={"mousebutton"}},
139 onEnter = {name="", override = "GB_MiniGroup_OnEnter", params={}},
140 onLeave = {name="", override = "GB_MiniGroup_OnLeave", params={}},
141 onMouseDown = {name="MiniGroup_Member_OnMouseDown", params={"mousebutton"}},
142 onMouseUp = {name="MiniGroup_Member_OnMouseUp", params={"mousebutton"}}
143 },
144 pet = {
145 frames={"MGpet"},
146 onClick= {name="MiniGroup_Member_OnClick", params={"mousebutton"}},
147 onEnter = {name="", override = "GB_MiniGroup_OnEnter", params={}},
148 onLeave = {name="", override = "GB_MiniGroup_OnLeave", params={}},
149 onMouseDown = {name="MiniGroup_Member_OnMouseDown", params={"mousebutton"}},
150 onMouseUp = {name="MiniGroup_Member_OnMouseUp", params={"mousebutton"}}
151 },
152 partypet = {
153 frames={"MGpartypet1", "MGpartypet2", "MGpartypet3", "MGpartypet4"},
154 onClick= {name="MiniGroup_Member_OnClick", params={"mousebutton"}},
155 onEnter = {name="", override = "GB_MiniGroup_OnEnter", params={}},
156 onLeave = {name="", override = "GB_MiniGroup_OnLeave", params={}},
157 onMouseDown = {name="MiniGroup_Member_OnMouseDown", params={"mousebutton"}},
158 onMouseUp = {name="MiniGroup_Member_OnMouseUp", params={"mousebutton"}}
159 }
160 };
161 elseif (Nurfed_player) then
162 GB_UNITFRAMES = {
163 player = {
164 frames={"Nurfed_player"},
165 onClick= {name="Nurfed_Unit_OnClick", params={"mousebutton", "nurfed"}}
166 },
167 party = {
168 frames={"Nurfed_party1", "Nurfed_party2", "Nurfed_party3", "Nurfed_party4"},
169 onClick= {name="Nurfed_Unit_OnClick", params={"mousebutton", "nurfed"}},
170 onEnter = {name="Nurfed_UnitFrame_OnEnter", params={"unitID"}},
171 onLeave = {name="Nurfed_UnitFrame_OnLeave", params={}}
172 },
173 target = {
174 frames={"Nurfed_target"},
175 onClick= {name="Nurfed_Unit_OnClick", params={"mousebutton", "nurfed"}}
176 },
177 pet = {
178 frames={"Nurfed_pet"},
179 onClick= {name="Nurfed_Unit_OnClick", params={"mousebutton", "nurfed"}}
180 },
181 partypet = {
182 frames={"Nurfed_partypet1", "Nurfed_partypet2", "Nurfed_partypet3", "Nurfed_partypet4"},
183 onClick= {name="Nurfed_Unit_OnClick", params={"mousebutton", "nurfed"}}
184 }
185 };
186 elseif (Perl_party1) then
187 GB_UNITFRAMES = {
188 player = {
189 frames={"Perl_Player_Frame"},
190 onClick= {name="Perl_Party_MouseDown", params={"mousebutton"}},
191 onMouseUp = {name="Perl_Party_MouseUp", params={"mousebutton"}},
192 onEnter = {name="Perl_Player_MouseEnter", params={}},
193 onLeave = {name="Perl_Player_MouseLeave", params={}}
194 },
195 party = {
196 frames={"Perl_party1", "Perl_party2", "Perl_party3", "Perl_party4"},
197 onClick= {name="Perl_Party_MouseDown", params={"mousebutton"}},
198 onMouseUp = {name="Perl_Party_MouseUp", params={"mousebutton"}},
199 onEnter = {name="Perl_Party_PlayerTip", params={}},
200 onLeave = {name="GB_Hide_PlayerTooltip", params={}}
201 },
202 target = {
203 frames={"Perl_Target_Frame"},
204 onClick= {name="Perl_Target_MouseDown", params={"mousebutton"}},
205 onMouseUp = {name="Perl_Target_MouseUp", params={"mousebutton"}},
206 onEnter = {name="Perl_Target_PlayerTip", params={}},
207 onLeave = {name="GB_Hide_PlayerTooltip", params={}}
208 },
209 pet = {
210 frames={"Perl_Player_Pet_Frame"},
211 onClick = {name="Perl_Player_Pet_MouseDown", params={"mousebutton"}},
212 onMouseUp = {name="Perl_Player_Pet_MouseUp", params={"mousebutton"}},
213 onEnter = {name="UnitFrame_OnEnter", override="GB_DefaultPartyFrame_OnEnter", params = {}},
214 onLeave = {name="UnitFrame_OnLeave", override="GB_DefaultPartyFrame_OnLeave", params = {}}
215 },
216 partypet = {
217 frames={"Perl_Party_Pet1", "Perl_Party_Pet2", "Perl_Party_Pet3", "Perl_Party_Pet4"},
218 onClick = {name="Perl_Party_Pet_MouseDown", params={"mousebutton"}},
219 onMouseUp = {name="Perl_Party_Pet_MouseUp", params={"mousebutton"}},
220 onEnter = {name="Perl_Party_Pet_PlayerTip", params = {}},
221 onLeave = {name="UnitFrame_OnLeave", params = {}}
222 }
223 };
224 elseif (WatchDogFrame) then
225 GB_UNITFRAMES = {
226 player = {
227 frames={"WatchDogFrame_player"},
228 onClick= {name="WatchDog_OnClick", params={"mousebutton"}},
229 onEnter = {name="UnitFrame_OnEnter", params={}},
230 onLeave = {name="UnitFrame_OnLeave", params={}}
231 },
232 party = {
233 frames={"WatchDogFrame_party1", "WatchDogFrame_party2", "WatchDogFrame_party3", "WatchDogFrame_party4"},
234 onClick= {name="WatchDog_OnClick", params={"mousebutton"}},
235 onEnter = {name="UnitFrame_OnEnter", params={}},
236 onLeave = {name="UnitFrame_OnLeave", params={}}
237 },
238 target = {
239 frames={"WatchDogFrame_target"},
240 onClick= {name="WatchDog_OnClick", params={"mousebutton"}},
241 onEnter = {name="UnitFrame_OnEnter", params={}},
242 onLeave = {name="UnitFrame_OnLeave", params={}}
243 },
244 pet = {
245 frames={"WatchDogFrame_pet"},
246 onClick= {name="WatchDog_OnClick", params={"mousebutton"}},
247 onEnter = {name="UnitFrame_OnEnter", params={}},
248 onLeave = {name="UnitFrame_OnLeave", params={}}
249 },
250 partypet = {
251 frames={"WatchDogFrame_partypet1", "WatchDogFrame_partypet2", "WatchDogFrame_partypet3", "WatchDogFrame_partypet4"},
252 onClick= {name="WatchDog_OnClick", params={"mousebutton"}},
253 onEnter = {name="UnitFrame_OnEnter", params={}},
254 onLeave = {name="UnitFrame_OnLeave", params={}}
255 }
256 };
257 elseif (Perl_Party_MemberFrame1) then
258 GB_UNITFRAMES = {
259 player = {
260 frames={"Perl_Player_Frame"},
261 onClick= {name="Perl_Player_MouseClick", params={"mousebutton"}},
262 onMouseDown = {name="Perl_Player_MouseDown", params={"mousebutton"}},
263 onMouseUp = {name="Perl_Player_MouseUp", params={"mousebutton"}}
264 },
265 party = {
266 frames={"Perl_Party_MemberFrame1", "Perl_Party_MemberFrame2", "Perl_Party_MemberFrame3", "Perl_Party_MemberFrame4"},
267 onClick= {name="Perl_Party_MouseClick", params={"mousebutton"}},
268 onMouseDown = {name="Perl_Party_MouseDown", params={"mousebutton"}},
269 onMouseUp = {name="Perl_Party_MouseUp", params={"mousebutton"}},
270 onEnter = {name="Perl_Party_Tip", params={}},
271 onLeave = {name="UnitFrame_OnLeave", params={}}
272 },
273 target = {
274 frames={"Perl_Target_Frame"},
275 onClick= {name="Perl_Target_MouseClick", params={"mousebutton"}},
276 onMouseDown = {name="Perl_Target_MouseDown", params={"mousebutton"}},
277 onMouseUp = {name="Perl_Target_MouseUp", params={"mousebutton"}},
278 onEnter = {name="Perl_Target_Tip", params={}},
279 onLeave = {name="UnitFrame_OnLeave", params={}}
280 },
281 pet = {
282 frames={"Perl_Player_Pet_Frame"},
283 onClick= {name="Perl_Player_Pet_MouseClick", params={"mousebutton"}},
284 onMouseDown = {name="Perl_Player_Pet_MouseDown", params={"mousebutton"}},
285 onMouseUp = {name="Perl_Player_Pet_MouseUp", params={"mousebutton"}}
286 },
287 partypet = {
288 frames={"PartyMemberFrame1PetFrame", "PartyMemberFrame2PetFrame", "PartyMemberFrame3PetFrame", "PartyMemberFrame4PetFrame"},
289 onClick = {name="PartyMemberPetFrame_OnClick", params={}},
290 onEnter = {name="UnitFrame_OnEnter", params = {}},
291 onLeave = {name="UnitFrame_OnLeave", params = {}}
292 }
293 };
294 end
295 end
296  
297 function GB_UnitFrame_OnClick(mousebutton)
298 local keys = "";
299  
300 if (IsShiftKeyDown()) then
301 keys = "s";
302 end
303 if (IsAltKeyDown()) then
304 keys = keys.."a";
305 end
306 if (IsControlKeyDown()) then
307 keys = keys.."c";
308 end
309 if (mousebutton == "LeftButton") then
310 keys = keys.."l";
311 elseif (mousebutton == "RightButton") then
312 keys = keys.."r";
313 elseif (mousebutton == "MiddleButton") then
314 keys = keys.."m";
315 elseif (mousebutton == "Button4") then
316 keys="4";
317 elseif (mousebutton == "Button5") then
318 keys="5";
319 end
320  
321 local bar = this.bar;
322 if (bar == "target") then
323 if (UnitCanAttack("player", "target")) then
324 bar = "hostiletarget";
325 else
326 bar = "friendlytarget";
327 end
328 end
329 if (keys == GB_Settings[GB_INDEX][bar].oldLeftClick or keys == GB_Settings[GB_INDEX][bar].oldRightClick) then
330 local func;
331 local clickparams;
332 if (GB_UNITFRAMES[this.bar].onClick) then
333 func = getglobal(GB_UNITFRAMES[this.bar].onClick.name);
334 clickparams = GB_UNITFRAMES[this.bar].onClick.params;
335 else
336 return;
337 end
338 local params = {};
339 for i, v in clickparams do
340 if (v == "mousebutton") then
341 params[i] = mousebutton;
342 elseif (v == "unitID") then
343 params[i] = this.unit;
344 elseif (v == "nurfed") then
345 params[i] = Nurfed_Units[getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]):GetName()];
346 end
347 end
348 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
349 func(params[1], params[2], params[3], params[4], params[5]);
350 return;
351 end
352  
353 local buttonNum = GB_Settings[GB_INDEX][bar].clickCast[keys];
354 if (buttonNum) then
355 local unitBar = GB_Get_UnitBar(this.unit);
356 if (this.index == "lowesthealth") then
357 unitBar = GB_Get_UnitBar(this.index);
358 end
359 GB_ActionButton_OnClick(unitBar, buttonNum, 1);
360 end
361 end
362  
363 function GB_UnitFrame_OnEnter()
364 local unitBar = getglobal(GB_Get_UnitBar(this.unit));
365 if (this.index == "lowesthealth") then
366 unitBar = GB_Get_UnitBar(this.index);
367 end
368 if (GB_Settings[GB_INDEX][unitBar.index].mouseover) then
369 unitBar.timer = nil;
370 unitBar:Show();
371 end
372 if (not GB_UNITFRAMES[this.bar].onEnter) then return; end
373 if (GB_UNITFRAMES[this.bar].onEnter.override) then
374 local func = getglobal(GB_UNITFRAMES[this.bar].onEnter.override);
375 func();
376 return;
377 end
378 local func = getglobal(GB_UNITFRAMES[this.bar].onEnter.name);
379 local params = {};
380 for i, v in GB_UNITFRAMES[this.bar].onEnter.params do
381 if (v == "frame") then
382 params[i] = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
383 elseif (v == "unitID") then
384 params[i] = this.unit;
385 end
386 end
387 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
388 func(params[1], params[2], params[3], params[4], params[5]);
389 end
390  
391 function GB_UnitFrame_OnEvent(event)
392 if (not GB_INITIALIZED) then return; end
393 if (event == "PARTY_MEMBERS_CHANGED") then
394 if (not GB_Settings[GB_INDEX].hideClickboxes) then
395 local numParty = GetNumPartyMembers();
396 for i=1,numParty do
397 getglobal("GB_Party"..i.."Clickbox"):Show();
398 if (UnitName("partypet"..i)) then
399 getglobal("GB_Pet"..i.."Clickbox"):Show();
400 end
401 end
402 numParty = numParty + 1;
403 if (numParty < 5) then
404 for i=numParty,4 do
405 getglobal("GB_Party"..i.."Clickbox"):Hide();
406 getglobal("GB_Pet"..i.."Clickbox"):Hide();
407 end
408 end
409 end
410 elseif (event == "PLAYER_TARGET_CHANGED") then
411 if (UnitName("target")) then
412 if (not GB_Get("hideClickboxes")) then
413 this:Show();
414 end
415 else
416 this:Hide();
417 end
418 elseif (event == "UNIT_PET") then
419 if (UnitName(this.unit) and UnitExists(this.unit)) then
420 if (not GB_Get("hideClickboxes")) then
421 this:Show();
422 end
423 else
424 this:Hide();
425 end
426 end
427 end
428  
429 function GB_UnitFrame_OnLeave()
430 local unitBar = getglobal(GB_Get_UnitBar(this.unit));
431 if (this.index == "lowesthealth") then
432 unitBar = GB_Get_UnitBar(this.index);
433 end
434 if (not unitBar) then return; end
435 if (GB_Settings[GB_INDEX][unitBar.index].mouseover) then
436 unitBar.timer = GB_MOUSEOUT_TIME;
437 end
438 if (not GB_UNITFRAMES[this.bar].onLeave) then return; end
439 if (GB_UNITFRAMES[this.bar].onLeave.override) then
440 local func = getglobal(GB_UNITFRAMES[this.bar].onLeave.override);
441 func();
442 return;
443 end
444 local func = getglobal(GB_UNITFRAMES[this.bar].onLeave.name);
445 local params = {};
446 for i, v in GB_UNITFRAMES[this.bar].onLeave.params do
447 if (v == "frame") then
448 params[i] = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
449 elseif (v == "unitID") then
450 params[i] = this.unit;
451 end
452 end
453 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
454 func(params[1], params[2], params[3], params[4], params[5]);
455 end
456  
457 function GB_UnitFrame_OnMouseDown(mousebutton)
458 if (not GB_UNITFRAMES[this.bar].onMouseDown) then return; end
459 if (DUF_EventFrame) then
460 if (IsShiftKeyDown() or IsAltKeyDown() or IsControlKeyDown() or mousebutton == "MiddleButton") then
461 return;
462 end
463 end
464 local func = getglobal(GB_UNITFRAMES[this.bar].onMouseDown.name);
465 local params = {};
466 for i, v in GB_UNITFRAMES[this.bar].onMouseDown.params do
467 if (v == "mousebutton") then
468 params[i] = mousebutton;
469 elseif (v == "unitID") then
470 params[i] = this.unit;
471 end
472 end
473 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
474 func(params[1], params[2], params[3], params[4], params[5]);
475 end
476  
477 function GB_UnitFrame_OnMouseUp(mousebutton)
478 if (not GB_UNITFRAMES[this.bar].onMouseUp) then return; end
479 if (GB_UNITFRAMES[this.bar].onMouseUp.override) then
480 local func = getglobal(GB_UNITFRAMES[this.bar].onMouseUp.override);
481 func();
482 return;
483 end
484 local func = getglobal(GB_UNITFRAMES[this.bar].onMouseUp.name);
485 local params = {};
486 for i, v in GB_UNITFRAMES[this.bar].onMouseUp.params do
487 if (v == "mousebutton") then
488 params[i] = mousebutton;
489 elseif (v == "unitID") then
490 params[i] = this.unit;
491 end
492 end
493 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
494 func(params[1], params[2], params[3], params[4], params[5]);
495 end
496  
497 function GB_UnitFrame_OnReceiveDrag()
498 if (not GB_UNITFRAMES[this.bar]["onDrag"]) then return; end
499 local func = getglobal(GB_UNITFRAMES[this.bar].onDrag.name);
500 local params = {};
501 for i, v in GB_UNITFRAMES[this.bar].onDrag.params do
502 if (v == "frame") then
503 params[i] = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
504 elseif (v == "unitID") then
505 params[i] = this.unit;
506 end
507 end
508 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
509 func(params[1], params[2], params[3], params[4], params[5]);
510 end
511  
512 function GB_DefaultPartyFrame_OnEnter()
513 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
514 UnitFrame_OnEnter();
515 PartyMemberBuffTooltip:SetPoint("TOPLEFT", this:GetName(), "TOPLEFT", 60, -25);
516 PartyMemberBuffTooltip_Update();
517 end
518  
519 function GB_DefaultPartyFrame_OnLeave()
520 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
521 UnitFrame_OnLeave();
522 PartyMemberBuffTooltip:Hide();
523 end
524  
525 function GB_MiniGroup_OnEnter()
526 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
527 MiniGroup_Member_OnEnter();
528 UnitFrame_OnEnter();
529 end
530  
531 function GB_MiniGroup_OnLeave()
532 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
533 MiniGroup_Member_OnLeave();
534 UnitFrame_OnLeave();
535 end
536  
537 function GB_DUF_OnMouseUp()
538 this = getglobal(GB_UNITFRAMES[this.bar].frames[this:GetID()]);
539 if (not DUF_Settings[DUF_INDEX].FramesLocked) then
540 DUF_UnitFrame_StopMoving(this.unit);
541 end
542 end
543  
544 function GB_CT_RA_MemberFrame_OnClick(mousebutton)
545 local keys = "";
546  
547 if (IsShiftKeyDown()) then
548 keys = "s";
549 end
550 if (IsAltKeyDown()) then
551 keys = keys.."a";
552 end
553 if (IsControlKeyDown()) then
554 keys = keys.."c";
555 end
556 if (mousebutton == "LeftButton") then
557 keys = keys.."l";
558 elseif (mousebutton == "RightButton") then
559 keys = keys.."r";
560 elseif (mousebutton == "MiddleButton") then
561 keys = keys.."m";
562 elseif (mousebutton == "Button4") then
563 keys="4";
564 elseif (mousebutton == "Button5") then
565 keys="5";
566 end
567  
568 local bar = "raid";
569  
570 if (keys == GB_Settings[GB_INDEX][bar].oldLeftClick or keys == GB_Settings[GB_INDEX][bar].oldRightClick) then
571 GB_Old_CT_RA_MemberFrame_OnClick(mousebutton);
572 return;
573 end
574  
575 local buttonNum = GB_Settings[GB_INDEX][bar].clickCast[keys];
576 local id = this:GetParent():GetParent():GetID();
577 if (buttonNum) then
578 GB_ActionButton_OnClick(GB_Get_UnitBar("raid"..id), buttonNum, 1);
579 end
580 end
581  
582 function GB_CT_RA_MemberFrame_OnEnter()
583 GB_Old_CT_RA_MemberFrame_OnEnter();
584 local id = this:GetParent():GetParent():GetID();
585 local unitBar = getglobal(GB_Get_UnitBar("raid"..id));
586 if (GB_Settings[GB_INDEX][unitBar.index].mouseover) then
587 unitBar.timer = nil;
588 unitBar:Show();
589 end
590 end
591  
592 function GB_CT_RA_MemberFrame_OnLeave()
593 GB_Old_CT_RA_MemberFrame_OnLeave();
594 local id = this:GetParent():GetParent():GetID();
595 local unitBar = getglobal(GB_Get_UnitBar("raid"..id));
596 if (GB_Settings[GB_INDEX][unitBar.index].mouseover) then
597 unitBar.timer = GB_MOUSEOUT_TIME;
598 end
599 end
600  
601 function GB_Hide_PlayerTooltip()
602 GameTooltip:Hide();
603 end
604  
605 function GB_Perl_Raid_MouseUp(mousebutton)
606 local keys = "";
607  
608 if (IsShiftKeyDown()) then
609 keys = "s";
610 end
611 if (IsAltKeyDown()) then
612 keys = keys.."a";
613 end
614 if (IsControlKeyDown()) then
615 keys = keys.."c";
616 end
617 if (mousebutton == "LeftButton") then
618 keys = keys.."l";
619 elseif (mousebutton == "RightButton") then
620 keys = keys.."r";
621 elseif (mousebutton == "MiddleButton") then
622 keys = keys.."m";
623 elseif (mousebutton == "Button4") then
624 keys="4";
625 elseif (mousebutton == "Button5") then
626 keys="5";
627 end
628  
629 local bar = "raid";
630  
631 if (keys == GB_Settings[GB_INDEX][bar].oldLeftClick or keys == GB_Settings[GB_INDEX][bar].oldRightClick) then
632 GB_Old_Perl_Raid_MouseUp(mousebutton);
633 return;
634 end
635  
636 local buttonNum = GB_Settings[GB_INDEX][bar].clickCast[keys];
637 local id = this:GetParent():GetParent():GetID();
638 if (buttonNum) then
639 GB_ActionButton_OnClick(GB_Get_UnitBar("raid"..id), buttonNum, 1);
640 end
641 end
642  
643 function GB_DUF_Element_OnClick(mousebutton)
644 local keys = "";
645  
646 if (IsShiftKeyDown()) then
647 keys = "s";
648 end
649 if (IsAltKeyDown()) then
650 keys = keys.."a";
651 end
652 if (IsControlKeyDown()) then
653 keys = keys.."c";
654 end
655 if (mousebutton == "LeftButton") then
656 keys = keys.."l";
657 elseif (mousebutton == "RightButton") then
658 keys = keys.."r";
659 elseif (mousebutton == "MiddleButton") then
660 keys = keys.."m";
661 elseif (mousebutton == "Button4") then
662 keys="4";
663 elseif (mousebutton == "Button5") then
664 keys="5";
665 end
666  
667 local unit = this.unit;
668 if (not this.unit) then
669 unit = this:GetParent().unit;
670 end
671  
672 local bar;
673 local frame = this:GetName();
674 if (string.find(frame, "DUF_PlayerFrame")) then
675 bar = "player";
676 elseif (string.find(frame, "DUF_PartyFrame")) then
677 bar = "party";
678 elseif (string.find(frame, "DUF_PartyPetFrame")) then
679 bar = "partypet";
680 elseif (string.find(frame, "DUF_TargetFrame") or string.find(frame, "DUF_TargetOfTargetFrame")) then
681 bar = "target";
682 elseif (string.find(frame, "DUF_PetFrame")) then
683 bar = "pet";
684 end
685 if (bar == "target") then
686 if (UnitCanAttack("player", unit)) then
687 bar = "hostiletarget";
688 else
689 bar = "friendlytarget";
690 end
691 end
692 if (keys == GB_Settings[GB_INDEX][bar].oldLeftClick or keys == GB_Settings[GB_INDEX][bar].oldRightClick) then
693 GB_Old_DUF_Element_OnClick(mousebutton);
694 return;
695 end
696  
697 local buttonNum = GB_Settings[GB_INDEX][bar].clickCast[keys];
698 if (buttonNum) then
699 local unitBar = GB_Get_UnitBar(unit);
700 if (not unitBar) then
701 unitBar = GB_Get_UnitBar(bar);
702 end
703 GB_ActionButton_OnClick(unitBar, buttonNum, 1, unit);
704 else
705 GB_Old_DUF_Element_OnClick(mousebutton);
706 end
707 end
708  
709 function GB_DUF_UnitFrame_OnClick(mousebutton)
710 local keys = "";
711  
712 if (IsShiftKeyDown()) then
713 keys = "s";
714 end
715 if (IsAltKeyDown()) then
716 keys = keys.."a";
717 end
718 if (IsControlKeyDown()) then
719 keys = keys.."c";
720 end
721 if (mousebutton == "LeftButton") then
722 keys = keys.."l";
723 elseif (mousebutton == "RightButton") then
724 keys = keys.."r";
725 elseif (mousebutton == "MiddleButton") then
726 keys = keys.."m";
727 elseif (mousebutton == "Button4") then
728 keys="4";
729 elseif (mousebutton == "Button5") then
730 keys="5";
731 end
732  
733 local unit = this.unit;
734  
735 local bar;
736 local frame = this:GetName();
737 if (frame == "DUF_PlayerFrame") then
738 bar = "player";
739 elseif (string.find(frame, "DUF_PartyFrame")) then
740 bar = "party";
741 elseif (string.find(frame, "DUF_PartyPetFrame")) then
742 bar = "partypet";
743 elseif (frame == "DUF_TargetFrame" or frame == "DUF_TargetOfTargetFrame") then
744 bar = "target";
745 elseif (frame == "DUF_PetFrame") then
746 bar = "pet";
747 end
748 if (bar == "target") then
749 if (UnitCanAttack("player", this.unit)) then
750 bar = "hostiletarget";
751 else
752 bar = "friendlytarget";
753 end
754 end
755 if (keys == GB_Settings[GB_INDEX][bar].oldLeftClick or keys == GB_Settings[GB_INDEX][bar].oldRightClick) then
756 GB_Old_DUF_UnitFrame_OnClick(mousebutton);
757 return;
758 end
759  
760 local buttonNum = GB_Settings[GB_INDEX][bar].clickCast[keys];
761 if (buttonNum) then
762 local unitBar = GB_Get_UnitBar(this.unit);
763 if (not unitBar) then
764 unitBar = GB_Get_UnitBar(bar);
765 end
766 GB_ActionButton_OnClick(unitBar, buttonNum, 1, this.unit);
767 else
768 GB_Old_DUF_UnitFrame_OnClick(mousebutton);
769 end
770 end
771  
772 function GB_DUF_Element_OnEnter()
773 GB_Old_DUF_Element_OnEnter();
774 local unitBar = getglobal(GB_Get_UnitBar(this:GetParent().unit));
775 if (unitBar and GB_Settings[GB_INDEX][unitBar.index].mouseover) then
776 unitBar.timer = nil;
777 unitBar:Show();
778 end
779 end
780  
781 function GB_DUF_UnitFrame_OnEnter()
782 GB_Old_DUF_UnitFrame_OnEnter();
783 local unitBar = getglobal(GB_Get_UnitBar(this.unit));
784 if (unitBar and GB_Settings[GB_INDEX][unitBar.index].mouseover) then
785 unitBar.timer = nil;
786 unitBar:Show();
787 end
788 end
789  
790 function GB_DUF_Element_OnLeave()
791 GB_Old_DUF_Element_OnLeave();
792 local unitBar = getglobal(GB_Get_UnitBar(this:GetParent().unit));
793 if (unitBar and GB_Settings[GB_INDEX][unitBar.index].mouseover) then
794 unitBar.timer = GB_MOUSEOUT_TIME;
795 end
796 end
797  
798 function GB_DUF_UnitFrame_OnLeave()
799 GB_Old_DUF_UnitFrame_OnLeave();
800 local unitBar = getglobal(GB_Get_UnitBar(this.unit));
801 if (unitBar and GB_Settings[GB_INDEX][unitBar.index].mouseover) then
802 unitBar.timer = GB_MOUSEOUT_TIME;
803 end
804 end
805  
806 function GB_RaidPulloutButton_OnClick()
807 local mousebutton = arg1;
808 local keys = "";
809  
810 if (IsShiftKeyDown()) then
811 keys = "s";
812 end
813 if (IsAltKeyDown()) then
814 keys = keys.."a";
815 end
816 if (IsControlKeyDown()) then
817 keys = keys.."c";
818 end
819 if (mousebutton == "LeftButton") then
820 keys = keys.."l";
821 elseif (mousebutton == "RightButton") then
822 keys = keys.."r";
823 elseif (mousebutton == "MiddleButton") then
824 keys = keys.."m";
825 elseif (mousebutton == "Button4") then
826 keys="4";
827 elseif (mousebutton == "Button5") then
828 keys="5";
829 end
830  
831 local unit = this.unit;
832 if (not unit) then
833 unit = this:GetParent().unit;
834 end
835  
836 local bar = "raid";
837  
838 if (keys == GB_Settings[GB_INDEX][bar].oldLeftClick or keys == GB_Settings[GB_INDEX][bar].oldRightClick) then
839 arg1 = mousebutton;
840 GB_Old_RaidPulloutButton_OnClick();
841 return;
842 end
843  
844 local buttonNum = GB_Settings[GB_INDEX][bar].clickCast[keys];
845 if (buttonNum) then
846 local unitBar = GB_Get_UnitBar(unit);
847 GB_ActionButton_OnClick(unitBar, buttonNum, 1);
848 else
849 arg1 = mousebutton;
850 GB_Old_RaidPulloutButton_OnClick();
851 end
852 end
853  
854 function GB_beyondRaidUnitOnClick(mousebutton)
855 local keys = "";
856  
857 if (IsShiftKeyDown()) then
858 keys = "s";
859 end
860 if (IsAltKeyDown()) then
861 keys = keys.."a";
862 end
863 if (IsControlKeyDown()) then
864 keys = keys.."c";
865 end
866 if (mousebutton == "LeftButton") then
867 keys = keys.."l";
868 elseif (mousebutton == "RightButton") then
869 keys = keys.."r";
870 elseif (mousebutton == "MiddleButton") then
871 keys = keys.."m";
872 elseif (mousebutton == "Button4") then
873 keys="4";
874 elseif (mousebutton == "Button5") then
875 keys="5";
876 end
877  
878 local unit = this:GetParent().unitID;
879  
880 local bar = "raid";
881  
882 if (keys == GB_Settings[GB_INDEX][bar].oldLeftClick or keys == GB_Settings[GB_INDEX][bar].oldRightClick) then
883 GB_Old_beyondRaidUnitOnClick(mousebutton)
884 return;
885 end
886  
887 local buttonNum = GB_Settings[GB_INDEX][bar].clickCast[keys];
888 if (buttonNum) then
889 local unitBar = GB_Get_UnitBar(unit);
890 GB_ActionButton_OnClick(unitBar, buttonNum, 1);
891 else
892 GB_Old_beyondRaidUnitOnClick(mousebutton);
893 end
894 end
895  
896 function GB_MarsRaidFrame_OnClick()
897 local mousebutton = arg1;
898 local keys = "";
899  
900 if (IsShiftKeyDown()) then
901 keys = "s";
902 end
903 if (IsAltKeyDown()) then
904 keys = keys.."a";
905 end
906 if (IsControlKeyDown()) then
907 keys = keys.."c";
908 end
909 if (mousebutton == "LeftButton") then
910 keys = keys.."l";
911 elseif (mousebutton == "RightButton") then
912 keys = keys.."r";
913 elseif (mousebutton == "MiddleButton") then
914 keys = keys.."m";
915 elseif (mousebutton == "Button4") then
916 keys="4";
917 elseif (mousebutton == "Button5") then
918 keys="5";
919 end
920  
921 local unit = this.unit;
922  
923 local bar = "raid";
924  
925 if (keys == GB_Settings[GB_INDEX][bar].oldLeftClick or keys == GB_Settings[GB_INDEX][bar].oldRightClick) then
926 arg1 = mousebutton;
927 GB_Old_MarsRaidFrame_OnClick();
928 return;
929 end
930  
931 local buttonNum = GB_Settings[GB_INDEX][bar].clickCast[keys];
932 if (buttonNum) then
933 local unitBar = GB_Get_UnitBar(unit);
934 GB_ActionButton_OnClick(unitBar, buttonNum, 1);
935 else
936 arg1 = mousebutton;
937 GB_Old_MarsRaidFrame_OnClick();
938 end
939 end
940  
941 function GB_MarsRaidFrame_OnEnter()
942 GB_Old_MarsRaidFrame_OnEnter();
943 local unitBar = getglobal(GB_Get_UnitBar(this.unit));
944 if (unitBar and GB_Settings[GB_INDEX][unitBar.index].mouseover) then
945 unitBar.timer = nil;
946 unitBar:Show();
947 end
948 end
949  
950 function GB_MarsRaidFrame_OnLeave()
951 GB_Old_MarsRaidFrame_OnLeave();
952 local unitBar = getglobal(GB_Get_UnitBar(this.unit));
953 if (unitBar and GB_Settings[GB_INDEX][unitBar.index].mouseover) then
954 unitBar.timer = GB_MOUSEOUT_TIME;
955 end
956 end