vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 SmartHeal.default['clickmode']={}
2  
3 SmartHeal.clickmodeOptionList={
4 ['PRIEST']={SH_UNASSIGNED,
5 SH_RENEW,SH_FLASH_HEAL,SH_LESSER_GREATER_HEALS,SH_PRAYER_OF_HEALING,
6 SH_GREATER_HEAL,SH_HEAL,SH_LESSER_HEAL,
7 SH_POWERWORD_SHIELD,SH_POWERWORD_FORTITUDE,SH_PRAYER_OF_FORTITUDE,SH_SHADOW_PROTECTION,SH_PRAYER_OF_SHADOW_PROTECTION,
8 SH_DIVINE_SPIRIT,SH_DISPEL_MAGIC,SH_ABOLISH_DISEASE,SH_RESURRECTION,
9 },
10  
11 ['PALADIN']={SH_UNASSIGNED,
12 SH_FLASH_OF_LIGHT,SH_HOLY_LIGHT,SH_REDEMPTION,SH_LAY_ON_HANDS,
13 SH_BLESSING_OF_KINGS,SH_BLESSING_OF_MIGHT,SH_BLESSING_OF_LIGHT,SH_BLESSING_OF_WISDOM,SH_BLESSING_OF_SALVATION,SH_BLESSING_OF_SANCTUARY,SH_BLESSING_OF_PROTECTION,SH_BLESSING_OF_FREEDOM,
14 SH_GREATER_BLESSING_OF_KINGS,SH_GREATER_BLESSING_OF_MIGHT,SH_GREATER_BLESSING_OF_LIGHT,SH_GREATER_BLESSING_OF_WISDOM,SH_GREATER_BLESSING_OF_SALVATION,SH_GREATER_BLESSING_OF_SANCTUARY,
15 },
16  
17 ['DRUID']={SH_UNASSIGNED,
18 SH_REJUVENATION,SH_HEALING_TOUCH,SH_REGROWTH,
19 SH_MARK_OF_THE_WILD,SH_GIFT_OF_THE_WILD,SH_NATURES_SWIFTNESS,
20 SH_REBIRTH,SH_TRANQULITY,SH_INNERVATE,SH_THORNS,SH_SWIFTMEND
21 },
22  
23 ['SHAMAN']={SH_UNASSIGNED,
24 SH_LESSER_HEALING_WAVE,SH_HEALING_WAVE,SH_CHAIN_HEAL,
25 SH_ANCESTRAL_SPIRIT,SH_LIGHTNING_SHIELD,
26 },
27  
28 }
29  
30 SmartHeal.OverDriveOptionList={SH_DISABLED,"shift","ctrl","alt"}
31  
32 SmartHeal.defaultClick={
33 ['PRIEST']={
34 ['shiftLeftButton']=3,['shiftMiddleButton']=2,['shiftRightButton']=9,
35 ['ctrlLeftButton']=3,['ctrlMiddleButton']=2,['ctrlRightButton']=9,
36 ['altLeftButton']=4,['altMiddleButton']=1,['altRightButton']=10,
37 },
38 ['PALADIN']={
39 ['shiftLeftButton']=2,['shiftMiddleButton']=4,['shiftRightButton']=1,
40 ['ctrlLeftButton']=2,['ctrlMiddleButton']=4,['ctrlRightButton']=1,
41 ['altLeftButton']=3,['altMiddleButton']=1,['altRightButton']=1,
42 },
43 ['DRUID']={
44 ['shiftLeftButton']=2,['shiftMiddleButton']=4,['shiftRightButton']=5,
45 ['ctrlLeftButton']=2,['ctrlMiddleButton']=4,['ctrlRightButton']=5,
46 ['altLeftButton']=3,['altMiddleButton']=8,['altRightButton']=6,
47 },
48 ['SHAMAN']={
49 ['shiftLeftButton']=2,['shiftMiddleButton']=6,['shiftRightButton']=4,
50 ['ctrlLeftButton']=2,['ctrlMiddleButton']=6,['ctrlRightButton']=4,
51 ['altLeftButton']=3,['altMiddleButton']=1,['altRightButton']=5,
52 },
53 }
54  
55 SmartHeal.ClickHealFuncMap={
56  
57 }
58  
59 function SmartHeal:InitClickMode()
60  
61 SmartHeal.default['clickmode']['enable']=1
62 SmartHeal.default['clickmode']['overdrive']=2
63  
64 for option,value in SmartHeal.defaultClick[SmartHeal.playerClass] do
65 SmartHeal.default['clickmode'][option]=value
66 end
67  
68 -- ctra unit frame click
69 if ( type(CT_RA_CustomOnClickFunction) == "function" ) then SH_CT_RA_CustomOnClickFunction=CT_RA_CustomOnClickFunction end
70 -- blizz player frame click
71 if ( type(PlayerFrame_OnClick) == "function" ) then
72 PlayerFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up");
73 SH_PlayerFrame_OnClick=PlayerFrame_OnClick
74 end
75 if (type(PetFrame_OnClick)=="function") then
76 PetFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
77 SH_PetFrame_OnClick=PetFrame_OnClick
78 end
79 -- blizz party unit and pet frame click
80 if ( type(PartyMemberFrame_OnClick) == "function" ) then
81 PartyMemberFrame1:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
82 PartyMemberFrame2:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
83 PartyMemberFrame3:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
84 PartyMemberFrame4:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
85 SH_PartyMemberFrame_OnClick=PartyMemberFrame_OnClick
86 end
87 if ( type(PartyMemberPetFrame_OnClick) == "function" ) then
88 PartyMemberFrame1PetFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
89 PartyMemberFrame2PetFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
90 PartyMemberFrame3PetFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
91 PartyMemberFrame4PetFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
92 SH_PartyMemberPetFrame_OnClick=PartyMemberPetFrame_OnClick
93 end
94 if ( type(TargetFrame_OnClick) == "function" ) then
95 TargetFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
96 SH_TargetFrame_OnClick=TargetFrame_OnClick
97 end
98 if(type(TargetofTarget_OnClick) == "function" ) then
99 TargetofTargetFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
100 SH_TargetofTarget_OnClick=TargetofTarget_OnClick
101 end
102 if ( type(CT_AssistFrame_OnClick) == "function" ) then
103 CT_AssistFrame:RegisterForClicks("LeftButtonUp","MiddleButtonUp","RightButtonUp","Button4Up","Button5Up")
104 SH_CT_AssistFrame_OnClick=CT_AssistFrame_OnClick
105 end
106  
107 -- check for Nymbia's Perl
108 if(type(Perl_Player_OnClick)=="function") then SH_Perl_Player_OnClick=Perl_Player_OnClick end
109 if(type(Perl_Player_Pet_MouseUp)=="function") then SH_Perl_Player_Pet_MouseUp=Perl_Player_Pet_MouseUp end
110 if(type(Perl_Party_OnClick)=="function") then SH_Perl_Party_OnClick=Perl_Party_OnClick end
111 if(type(Perl_Party_Pet_MouseUp)=="function") then SH_Perl_Party_Pet_MouseUp=Perl_Party_Pet_MouseUp end
112 if(type(Perl_Target_MouseUp)=="function") then SH_Perl_Target_MouseUp=Perl_Target_MouseUp end
113 if(type(Perl_Raid_OnClick)=="function") then SH_Perl_Raid_OnClick=Perl_Raid_OnClick end
114  
115 -- discord unit frame click
116 if ( type(DUF_UnitFrame_OnClick) == "function" ) then SH_DUF_UnitFrame_OnClick=DUF_UnitFrame_OnClick end
117 if ( type(DUF_Element_OnClick) == "function" ) then SH_DUF_Element_OnClick=DUF_Element_OnClick end
118  
119 -- Sage
120 if ( type(SFrame_OnClick) == "function" ) then SH_SFrame_OnClick=SFrame_OnClick end
121  
122 -- PerfectRaid
123 if (PerfectRaid) then SH_PerfectRaidCustomClick=PerfectRaidCustomClick end
124  
125 -- Nurfed Unitframes
126 if(type(NurfedPlayer_OnClick)=="function") then SH_NurfedPlayer_OnClick=NurfedPlayer_OnClick end
127 if(type(Nurfed_PetFrame_OnClick)=="function") then SH_Nurfed_PetFrame_OnClick=Nurfed_PetFrame_OnClick end
128 if(type(Nurfed_PartyMember_OnClick)=="function") then SH_Nurfed_PartyMember_OnClick=Nurfed_PartyMember_OnClick end
129 if(type(Nurfed_TargetFrame_OnClick)=="function") then SH_Nurfed_TargetFrame_OnClick=Nurfed_TargetFrame_OnClick end
130 if(type(Nurfed_Unit_OnClick)=="function") then SH_Nurfed_Unit_OnClick=Nurfed_Unit_OnClick end
131  
132  
133 if (SmartHeal:getConfig("enable","clickmode")==nil or SmartHeal:getConfig("enable","clickmode")) then
134 SmartHeal:setClickMode(1)
135 else
136 SmartHeal:setClickMode()
137 end
138  
139 end
140  
141 function SmartHeal:setClickMode(status)
142  
143 if (status) then
144  
145 CT_RA_CustomOnClickFunction= function(button,unit) return SmartHeal:CTRA_ClickHeal(button,unit) end
146 CT_AssistFrame_OnClick= function(button) return SmartHeal:CT_AssistFrame_OnClick(button) end
147  
148 PlayerFrame_OnClick= function(button) return SmartHeal:PlayerFrame_OnClick(button) end
149 PetFrame_OnClick= function(button) return SmartHeal:PetFrame_OnClick(button) end
150 PartyMemberFrame_OnClick= function(partyFrame) return SmartHeal:PartyMemberFrame_OnClick(partyFrame) end
151 PartyMemberPetFrame_OnClick= function() return SmartHeal:PartyMemberPetFrame_OnClick() end
152 TargetFrame_OnClick= function(button) return SmartHeal:TargetFrame_OnClick(button) end
153 TargetofTarget_OnClick= function(button) return SmartHeal:TargetofTarget_OnClick(button) end
154  
155 DUF_UnitFrame_OnClick= function(button) return SmartHeal:DUF_UnitFrame_OnClick(button) end
156 DUF_Element_OnClick= function(button) return SmartHeal:DUF_Element_OnClick(button) end
157  
158 Perl_Player_OnClick= function(button) return SmartHeal:Perl_Player_OnClick(button) end
159 Perl_Player_Pet_MouseUp= function(button) return SmartHeal:Perl_Player_Pet_MouseUp(button) end
160 Perl_Party_OnClick= function(button) return SmartHeal:Perl_Party_OnClick(button) end
161 Perl_Party_Pet_MouseUp= function(button) return SmartHeal:Perl_Party_Pet_MouseUp(button) end
162 Perl_Target_MouseUp= function(button) return SmartHeal:Perl_Target_MouseUp(button) end
163 Perl_Raid_OnClick= function(button) return SmartHeal:Perl_Raid_OnClick(button) end
164  
165 SFrame_OnClick= function() return SmartHeal:SFrame_OnClick() end
166 PerfectRaidCustomClick = function(button,unit) return SmartHeal:PerfectRaidCustomClick(button, unit) end
167  
168 NurfedPlayer_OnClick=function(button) return SmartHeal:NurfedPlayer_OnClick(button) end
169 Nurfed_PetFrame_OnClick=function(button) return SmartHeal:Nurfed_PetFrame_OnClick(button) end
170 Nurfed_PartyMember_OnClick=function(partyFrame) return SmartHeal:Nurfed_PartyMember_OnClick(partyFrame) end
171 Nurfed_TargetFrame_OnClick=function(targetFrame) return SmartHeal:Nurfed_TargetFrame_OnClick(targetFrame) end
172 Nurfed_Unit_OnClick=function(arg1) return SmartHeal:Nurfed_Unit_OnClick(arg1) end
173  
174 else
175  
176 -- reset to original click function
177 CT_RA_CustomOnClickFunction=SH_CT_RA_CustomOnClickFunction
178 CT_AssistFrame_OnClick=SH_CT_AssistFrame_OnClick
179  
180 PlayerFrame_OnClick=SH_PlayerFrame_OnClick
181 PetFrame_OnClick=SH_PetFrame_OnClick
182 PartyMemberFrame_OnClick=SH_PartyMemberFrame_OnClick
183 PartyMemberPetFrame_OnClick=SH_PartyMemberPetFrame_OnClick
184 TargetFrame_OnClick=SH_TargetFrame_OnClick
185 TargetofTarget_OnClick=SH_TargetofTarget_OnClick
186  
187 DUF_UnitFrame_OnClick=SH_DUF_UnitFrame_OnClick
188 DUF_Element_OnClick=SH_DUF_Element_OnClick
189  
190 Perl_Player_OnClick=SH_Perl_Player_OnClick
191 Perl_Player_Pet_MouseUp=SH_Perl_Player_Pet_MouseUp
192 Perl_Party_OnClick=SH_Perl_Party_OnClick
193 Perl_Party_Pet_MouseUp=SH_Perl_Party_Pet_MouseUp
194 Perl_Target_MouseUp=SH_Perl_Target_MouseUp
195 Perl_Raid_OnClick=SH_Perl_Raid_OnClick
196  
197 SFrame_OnClick=SH_SFrame_OnClick
198 PerfectRaidCustomClick=SH_PerfectRaidCustomClick
199  
200 NurfedPlayer_OnClick=SH_NurfedPlayer_OnClick
201 Nurfed_PetFrame_OnClick=SH_Nurfed_PetFrame_OnClick
202 Nurfed_PartyMember_OnClick=SH_Nurfed_PartyMember_OnClick
203 Nurfed_TargetFrame_OnClick=SH_Nurfed_TargetFrame_OnClick
204 Nurfed_Unit_OnClick=SH_Nurfed_Unit_OnClick
205  
206 end
207 end
208  
209 function SmartHeal:NurfedPlayer_OnClick(button)
210  
211 local KeyDownType=SmartHeal:GetClickHealButton()
212  
213 if KeyDownType=="undetermined" then
214 return
215 elseif KeyDownType then
216 SmartHeal:ClickHeal(KeyDownType..button,"player")
217 elseif ( type(SH_NurfedPlayer_OnClick)=="function") then
218 return SH_NurfedPlayer_OnClick(button)
219 end
220  
221 end
222  
223 function SmartHeal:Nurfed_PetFrame_OnClick(button)
224  
225 local KeyDownType=SmartHeal:GetClickHealButton()
226  
227 if KeyDownType=="undetermined" then
228 return
229 elseif KeyDownType then
230 SmartHeal:ClickHeal(KeyDownType..button,"pet")
231 elseif ( type(SH_Nurfed_PetFrame_OnClick)=="function") then
232 return SH_Nurfed_PetFrame_OnClick(button)
233 end
234  
235 end
236  
237 function SmartHeal:Nurfed_PartyMember_OnClick(partyFrame)
238  
239 if ( not partyFrame ) then partyFrame=this end
240 local unit = "party"..partyFrame:GetID()
241  
242 local KeyDownType=SmartHeal:GetClickHealButton()
243 if KeyDownType=="undetermined" then
244 return
245 elseif KeyDownType then
246 SmartHeal:ClickHeal(KeyDownType..arg1,unit)
247 elseif ( type(SH_Nurfed_PartyMember_OnClick)=="function") then
248 return SH_Nurfed_PartyMember_OnClick(partyFrame)
249 end
250  
251 end
252  
253 function SmartHeal:Nurfed_TargetFrame_OnClick(targetFrame)
254 local KeyDownType=SmartHeal:GetClickHealButton()
255  
256 if KeyDownType=="undetermined" then
257 return
258 elseif KeyDownType then
259 SmartHeal:ClickHeal(KeyDownType..arg1,"target")
260 elseif ( type(SH_Nurfed_TargetFrame_OnClick)=="function") then
261 return SH_Nurfed_TargetFrame_OnClick(targetFrame)
262 end
263 end
264  
265 function SmartHeal:Nurfed_Unit_OnClick(arg1)
266  
267 local KeyDownType=SmartHeal:GetClickHealButton()
268 if KeyDownType=="undetermined" then
269 return
270 elseif KeyDownType then
271 SmartHeal:ClickHeal(KeyDownType..arg1,this.unit)
272 elseif ( type(SH_Nurfed_Unit_OnClick)=="function") then
273 return SH_Nurfed_Unit_OnClick(arg1)
274 end
275  
276 end
277  
278 function SmartHeal:PerfectRaidCustomClick(button, unit)
279  
280 local KeyDownType=SmartHeal:GetClickHealButton()
281  
282 if KeyDownType=="undetermined" then
283 return
284 elseif KeyDownType then
285 SmartHeal:ClickHeal(KeyDownType..button,unit)
286 elseif ( type(SH_PerfectRaidCustomClick)=="function") then
287 return SH_PerfectRaidCustomClick(button,unit)
288 else
289 SmartHeal:DefaultClick(button,unit)
290 end
291  
292 end
293  
294 function SmartHeal:SFrame_OnClick()
295  
296 local unit = SFrame_FrameToID(this)
297 local KeyDownType=SmartHeal:GetClickHealButton()
298  
299 if KeyDownType=="undetermined" then
300 return
301 elseif KeyDownType then
302 SmartHeal:ClickHeal(KeyDownType..arg1,unit)
303 elseif ( type(SH_SFrame_OnClick)=="function") then
304 return SH_SFrame_OnClick()
305 end
306 end
307  
308 function SmartHeal:TargetofTarget_OnClick(button)
309  
310 local unit="targettarget"
311 if(UnitCanAttack("player","targettarget")) then
312 unit="targettargettarget"
313 end
314  
315 local KeyDownType=SmartHeal:GetClickHealButton()
316  
317 if KeyDownType=="undetermined" then
318 return
319 elseif KeyDownType then
320 SmartHeal:ClickHeal(KeyDownType..button,unit)
321 elseif ( type(SH_TargetofTarget_OnClick)=="function") then
322 return SH_TargetofTarget_OnClick(button)
323 end
324  
325 end
326  
327 function SmartHeal:Perl_Player_OnClick(button)
328 local KeyDownType=SmartHeal:GetClickHealButton()
329  
330 if KeyDownType=="undetermined" then
331 return
332 elseif KeyDownType then
333 SmartHeal:ClickHeal(KeyDownType..button,"player")
334 elseif ( type(SH_Perl_Player_OnClick)=="function") then
335 return SH_Perl_Player_OnClick(button)
336 end
337 end
338  
339 function SmartHeal:Perl_Player_Pet_MouseUp(button)
340 local KeyDownType=SmartHeal:GetClickHealButton()
341  
342 if KeyDownType=="undetermined" then
343 return
344 elseif KeyDownType then
345 SmartHeal:ClickHeal(KeyDownType..button,"pet")
346 elseif ( type(SH_Perl_Player_Pet_MouseUp)=="function") then
347 return SH_Perl_Player_Pet_MouseUp(button)
348 end
349 end
350  
351 function SmartHeal:Perl_Party_OnClick(button)
352 local id=Perl_Party_FindID(this);
353 this:SetID(id);
354 local KeyDownType=SmartHeal:GetClickHealButton()
355 if KeyDownType=="undetermined" then
356 return
357 elseif KeyDownType then
358 SmartHeal:ClickHeal(KeyDownType..arg1,"party"..id)
359 elseif ( type(SH_Perl_Party_OnClick)=="function") then
360 return SH_Perl_Party_OnClick(button)
361 end
362 end
363  
364 function SmartHeal:Perl_Party_Pet_MouseUp(button)
365  
366 local id=Perl_Party_Pet_FindID(this);
367 this:SetID(id);
368 local KeyDownType=SmartHeal:GetClickHealButton()
369  
370 if KeyDownType=="undetermined" then
371 return
372 elseif KeyDownType then
373 SmartHeal:ClickHeal(KeyDownType..arg1,"partypet"..id)
374 elseif ( type(SH_Perl_Party_Pet_MouseUp)=="function") then
375 return SH_Perl_Party_Pet_MouseUp(button)
376 end
377 end
378  
379 function SmartHeal:Perl_Target_MouseUp(button)
380  
381 local KeyDownType=SmartHeal:GetClickHealButton()
382  
383 if KeyDownType=="undetermined" then
384 return
385 elseif KeyDownType then
386 SmartHeal:ClickHeal(KeyDownType..button,"target")
387 elseif ( type(SH_Perl_Target_MouseUp)=="function") then
388 return SH_Perl_Target_MouseUp(button)
389 end
390  
391 end
392  
393 function SmartHeal:Perl_Raid_OnClick(button)
394 local id=Perl_Raid_FindID(this);
395 this:SetID(id);
396 if (this:GetID()<=40) then
397 partyid = ("raid"..this:GetID());
398 else
399 if Warriors[this:GetID()-40] then
400 partyid = ("raid"..Warriors[this:GetID()-40].."target");
401 else
402 return
403 end
404 end
405 local KeyDownType=SmartHeal:GetClickHealButton()
406  
407 if KeyDownType=="undetermined" then
408 return
409 elseif KeyDownType then
410 SmartHeal:ClickHeal(KeyDownType..button,partyid)
411 elseif ( type(SH_Perl_Raid_OnClick)=="function") then
412 return SH_Perl_Raid_OnClick(button)
413 end
414  
415 end
416  
417 function SmartHeal:DUF_Element_OnClick(button)
418  
419 local unit = this.unit;
420 if (not unit) then
421 unit = this:GetParent().unit;
422 end
423  
424 local KeyDownType=SmartHeal:GetClickHealButton()
425  
426 if KeyDownType=="undetermined" then
427 return
428 elseif KeyDownType then
429 SmartHeal:ClickHeal(KeyDownType..button,unit)
430 elseif ( type(SH_DUF_UnitFrame_OnClick)=="function") then
431 return SH_DUF_Element_OnClick(button)
432 end
433  
434 end
435  
436 function SmartHeal:DUF_UnitFrame_OnClick(button)
437  
438 local KeyDownType=SmartHeal:GetClickHealButton()
439  
440 if KeyDownType=="undetermined" then
441 return
442 elseif KeyDownType then
443 SmartHeal:ClickHeal(KeyDownType..button,this.unit)
444 elseif ( type(SH_DUF_UnitFrame_OnClick)=="function") then
445 return SH_DUF_UnitFrame_OnClick(button)
446 end
447  
448 end
449  
450 function SmartHeal:PartyMemberFrame_OnClick(partyFrame)
451 if ( not partyFrame ) then
452 partyFrame = this;
453 end
454 local unit = "party"..partyFrame:GetID();
455 local KeyDownType=SmartHeal:GetClickHealButton()
456  
457 if KeyDownType=="undetermined" then
458 return
459 elseif KeyDownType then
460 SmartHeal:ClickHeal(KeyDownType..arg1,unit)
461 elseif ( type(SH_PartyMemberFrame_OnClick)=="function") then
462 return SH_PartyMemberFrame_OnClick(partyFrame)
463 end
464 end
465  
466 function SmartHeal:PartyMemberPetFrame_OnClick()
467  
468 local unit = "partypet"..this:GetParent():GetID();
469 local KeyDownType=SmartHeal:GetClickHealButton()
470  
471 if KeyDownType=="undetermined" then
472 return
473 elseif KeyDownType then
474 SmartHeal:ClickHeal(KeyDownType..arg1,unit)
475 elseif ( type(SH_PartyMemberPetFrame_OnClick)=="function") then
476 return SH_PartyMemberPetFrame_OnClick()
477 end
478  
479 end
480  
481 function SmartHeal:TargetFrame_OnClick(button)
482 local KeyDownType=SmartHeal:GetClickHealButton()
483  
484 if KeyDownType=="undetermined" then
485 return
486 elseif KeyDownType then
487 SmartHeal:ClickHeal(KeyDownType..button,"target")
488 elseif ( type(SH_TargetFrame_OnClick)=="function") then
489 return SH_TargetFrame_OnClick(button)
490 end
491 end
492  
493 function SmartHeal:CT_AssistFrame_OnClick(button)
494  
495 local unit="targettarget"
496 if(UnitCanAttack("player","targettarget")) then
497 unit="targettargettarget"
498 end
499  
500 local KeyDownType=SmartHeal:GetClickHealButton()
501  
502 if KeyDownType=="undetermined" then
503 return
504 elseif KeyDownType then
505 SmartHeal:ClickHeal(KeyDownType..button,unit)
506 elseif ( type(SH_CT_AssistFrame_OnClick)=="function") then
507 return SH_CT_AssistFrame_OnClick(button)
508 end
509 end
510  
511 function SmartHeal:PlayerFrame_OnClick(button)
512 local KeyDownType=SmartHeal:GetClickHealButton()
513  
514 if KeyDownType=="undetermined" then
515 return
516 elseif KeyDownType then
517 SmartHeal:ClickHeal(KeyDownType..button,"player")
518 elseif ( type(SH_PlayerFrame_OnClick)=="function") then
519 return SH_PlayerFrame_OnClick(button)
520 end
521 end
522  
523 function SmartHeal:PetFrame_OnClick(button)
524 local KeyDownType=SmartHeal:GetClickHealButton()
525  
526 if KeyDownType=="undetermined" then
527 return
528 elseif KeyDownType then
529 SmartHeal:ClickHeal(KeyDownType..button,"pet")
530 elseif ( type(SH_PetFrame_OnClick)=="function") then
531 return SH_PetFrame_OnClick(button)
532 end
533 end
534  
535 function SmartHeal:CTRA_ClickHeal(button,unit)
536  
537 local KeyDownType=SmartHeal:GetClickHealButton()
538  
539 if KeyDownType=="undetermined" then
540 return true
541 elseif KeyDownType then
542 SmartHeal:ClickHeal(KeyDownType..button,unit)
543 return true
544 elseif ( type(SH_CT_RA_CustomOnClickFunction)=="function") then
545 return SH_CT_RA_CustomOnClickFunction(button,unit)
546 else
547 return false
548 end
549  
550 end
551  
552 function SmartHeal:GetKeyDownType()
553  
554 local keydowntype={}
555  
556 if IsControlKeyDown() then keydowntype["ctrl"]=1 end
557 if IsAltKeyDown() then keydowntype["alt"]=1 end
558 if IsShiftKeyDown() then keydowntype["shift"]=1 end
559  
560 return keydowntype
561  
562 end
563  
564 function SmartHeal:GetClickHealButton()
565  
566 local keydowntype=SmartHeal:GetKeyDownType()
567 keydowntype[SmartHeal.OverDriveOptionList[SmartHeal:getConfig("overdrive","clickmode")]]=nil
568  
569 local clickhealButton={}
570  
571 local i=1
572 for key,status in keydowntype do
573 clickhealButton[i]=key
574 i=i+1
575 end
576  
577 if(clickhealButton[2]) then
578 return "undetermined"
579 else
580 return clickhealButton[1]
581 end
582  
583 end
584  
585 function SmartHeal:DefaultClick(button,unit)
586 if (button == "LeftButton") then
587 if (SpellIsTargeting()) then
588 SpellTargetUnit(unit)
589 return true
590 elseif (CursorHasItem()) then
591 if (UnitIsUnit("player", unit)) then
592 AutoEquipCursorItem()
593 else
594 DropItemOnUnit(unit)
595 end
596 return true
597 else
598 TargetUnit(unit)
599 return true
600 end
601 elseif (button == "RightButton") then
602 if (SpellIsTargeting()) then
603 SpellStopTargeting()
604 return true
605 elseif (CursorHasItem()) then
606 if (ClearCursor) then
607 ClearCursor()
608 return true
609 end
610 end
611 end
612 end
613  
614 function SmartHeal:ClickHeal(button,unit)
615  
616 local optionID=SmartHeal:getConfig(button,'clickmode')
617 local spell=SmartHeal.clickmodeOptionList[SmartHeal.playerClass][optionID]
618 local clearTarget,Attacking
619 SmartHeal.AttackingBeforeCast=nil
620  
621 if (not spell or not UnitExists(unit)) then return end
622  
623 if (UnitIsUnit("player",unit)) then
624 SmartHeal.selfCast=1
625 else
626 SmartHeal.selfCast=0
627 end
628  
629 if (UnitIsUnit("player",unit) or UnitIsUnit("target",unit)) then
630 SmartHeal:Cast(spell)
631  
632 else
633  
634 if(not UnitExists("target")) then clearTarget=1
635 elseif (SmartHeal.Attacking) then Attacking=1 end
636  
637 TargetUnit(unit)
638  
639 SmartHeal:Cast(spell)
640  
641 if (SpellIsTargeting() and not SpellCanTargetUnit(unit)) then
642 SpellStopTargeting()
643  
644 if(clearTarget) then
645 ClearTarget()
646 else
647 TargetLastTarget()
648 end
649  
650 if(Attacking) then
651 SmartHeal.ResumeAttack=1
652 end
653 else
654  
655 if(clearTarget) then
656 ClearTarget()
657 else
658 TargetLastTarget()
659 end
660  
661 if(Attacking) then
662 SmartHeal.AttackingBeforeCast=1
663 end
664 end
665  
666 end
667  
668 end
669  
670 SmartHeal.ResumeAttackDelay=1 -- 1 sec delay to resume attack current target
671 SmartHeal.ResumeAttackTimer=0
672  
673 function SmartHeal:ResumeAttack_OnUpdate(arg1)
674  
675 if(SmartHeal.ResumeAttack) then
676 SmartHeal.ResumeAttackTimer=SmartHeal.ResumeAttackTimer+arg1
677 if(SmartHeal.ResumeAttackTimer>SmartHeal.ResumeAttackDelay) then
678 if (not SmartHeal.Attacking) then AttackTarget() end
679 SmartHeal.ResumeAttack=nil
680 SmartHeal.ResumeAttackTimer=0
681 end
682 end
683  
684 end
685  
686 function SmartHeal:ClickHeal_IsOverdrive()
687  
688 local keydowntype=SmartHeal:GetKeyDownType()
689  
690 if (keydowntype[SmartHeal.OverDriveOptionList[SmartHeal:getConfig("overdrive","clickmode")]]) then
691 return true
692 else
693 return nil
694 end
695 end
696  
697 function SmartHeal:ClickHeal_DropDown_OnShow()
698 local OverdriveHotkey=SmartHeal.OverDriveOptionList[SmartHeal:getConfig("overdrive","clickmode")]
699 local parentName="SH_OptionsFrame2"
700  
701 for i=2,table.getn(SmartHeal.OverDriveOptionList) do
702  
703 if(SmartHeal.OverDriveOptionList[i]==OverdriveHotkey) then
704 getglobal(parentName.."_DropDown_"..OverdriveHotkey.."LeftButton_clickmode"):Hide()
705 getglobal(parentName.."_DropDown_"..OverdriveHotkey.."MiddleButton_clickmode"):Hide()
706 getglobal(parentName.."_DropDown_"..OverdriveHotkey.."RightButton_clickmode"):Hide()
707 getglobal(parentName.."_Disabled_"..OverdriveHotkey.."LeftButton_clickmode"):Show()
708 getglobal(parentName.."_Disabled_"..OverdriveHotkey.."MiddleButton_clickmode"):Show()
709 getglobal(parentName.."_Disabled_"..OverdriveHotkey.."RightButton_clickmode"):Show()
710 else
711  
712 getglobal(parentName.."_DropDown_"..SmartHeal.OverDriveOptionList[i].."LeftButton_clickmode"):Show()
713 getglobal(parentName.."_DropDown_"..SmartHeal.OverDriveOptionList[i].."MiddleButton_clickmode"):Show()
714 getglobal(parentName.."_DropDown_"..SmartHeal.OverDriveOptionList[i].."RightButton_clickmode"):Show()
715 getglobal(parentName.."_Disabled_"..SmartHeal.OverDriveOptionList[i].."LeftButton_clickmode"):Hide()
716 getglobal(parentName.."_Disabled_"..SmartHeal.OverDriveOptionList[i].."MiddleButton_clickmode"):Hide()
717 getglobal(parentName.."_Disabled_"..SmartHeal.OverDriveOptionList[i].."RightButton_clickmode"):Hide()
718  
719 end
720  
721 end
722  
723 end