forked from Eirosdev/QuickHeal
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathQuickHealDruid.lua
893 lines (752 loc) · 46.2 KB
/
QuickHealDruid.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
local function writeLine(s,r,g,b)
if DEFAULT_CHAT_FRAME then
DEFAULT_CHAT_FRAME:AddMessage(s, r or 1, g or 1, b or 0.5)
end
end
function QuickHeal_Druid_GetRatioHealthyExplanation()
local RatioHealthy = QuickHeal_GetRatioHealthy();
local RatioFull = QuickHealVariables["RatioFull"];
if RatioHealthy >= RatioFull then
return QUICKHEAL_SPELL_REGROWTH .. " will always be used in and out of combat, and " .. QUICKHEAL_SPELL_HEALING_TOUCH .. " will never be used. ";
else
if RatioHealthy > 0 then
return QUICKHEAL_SPELL_REGROWTH .. " will be used in combat if the target has less than " .. RatioHealthy*100 .. "% life, and " .. QUICKHEAL_SPELL_HEALING_TOUCH .. " will be used otherwise. ";
else
return QUICKHEAL_SPELL_REGROWTH .. " will never be used. " .. QUICKHEAL_SPELL_HEALING_TOUCH .. " will always be used in and out of combat. ";
end
end
end
function QuickHeal_Druid_FindHealSpellToUse(Target, healType, multiplier, forceMaxHPS)
local SpellID = nil;
local HealSize = 0;
local Overheal = false;
local ForceHTinCombat = false;
local NaturesGrace = false;
-- +Healing-PenaltyFactor = (1-((20-LevelLearnt)*0.0375)) for all spells learnt before level 20
local PF1 = 0.2875;
local PF8 = 0.55;
local PFRG1 = 0.7 * 1.042; -- Rank 1 of RG (1.041 compensates for the 0.50 factor that should be 0.48 for RG1)
local PF14 = 0.775;
local PFRG2 = 0.925;
-- Local aliases to access main module functionality and settings
local RatioFull = QuickHealVariables["RatioFull"];
local RatioHealthy = QuickHeal_GetRatioHealthy();
local UnitHasHealthInfo = QuickHeal_UnitHasHealthInfo;
local EstimateUnitHealNeed = QuickHeal_EstimateUnitHealNeed;
local GetSpellIDs = QuickHeal_GetSpellIDs;
local debug = QuickHeal_debug;
-- Return immediately if no player needs healing
if not Target then
return SpellID,HealSize;
end
if multiplier == nil then
jgpprint(">>> multiplier is NIL <<<")
--if multiplier > 1.0 then
-- Overheal = true;
--end
elseif multiplier == 1.0 then
jgpprint(">>> multiplier is " .. multiplier .. " <<<")
elseif multiplier > 1.0 then
jgpprint(">>> multiplier is " .. multiplier .. " <<<")
Overheal = true;
end
-- Determine health and heal need of target
local healneed;
local Health;
if UnitHasHealthInfo(Target) then
-- Full info available
healneed = UnitHealthMax(Target) - UnitHealth(Target) - HealComm:getHeal(UnitName(Target)); -- Implementatio for HealComm
Health = UnitHealth(Target) / UnitHealthMax(Target);
else
-- Estimate target health
healneed = EstimateUnitHealNeed(Target,true);
Health = UnitHealth(Target)/100;
end
-- if BonusScanner is running, get +Healing bonus
local Bonus = 0;
if (BonusScanner) then
Bonus = tonumber(BonusScanner:GetBonus("HEAL"));
debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * Bonus;
local healMod20 = (2.0/3.5) * Bonus;
local healMod25 = (2.5/3.5) * Bonus;
local healMod30 = (3.0/3.5) * Bonus;
local healMod35 = Bonus;
local healModRG = (2.0/3.5) * Bonus * 0.5; -- The 0.5 factor is calculated as DirectHeal/(DirectHeal+HoT)
debug("Final Healing Bonus (1.5,2.0,2.5,3.0,3.5,Regrowth)", healMod15,healMod20,healMod25,healMod30,healMod35,healModRG);
local InCombat = UnitAffectingCombat('player') or UnitAffectingCombat(Target);
-- Gift of Nature - Increases healing by 2% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(3,8);
local gnMod = 2*talentRank/100 + 1;
debug(string.format("Gift of Nature modifier: %f", gnMod));
-- Tranquil Spirit - Decreases mana usage by 2% per rank on HT only
local _,_,_,_,talentRank,_ = GetTalentInfo(3,10);
local tsMod = 1 - 2*talentRank/100;
debug(string.format("Tranquil Spirit modifier: %f", tsMod));
-- Moonglow - Decrease mana usage by 3% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(1,13);
local mgMod = 1 - 3*talentRank/100;
debug(string.format("Moonglow modifier: %f", mgMod));
-- Improved Regrowth Talent (increases Regrowth effect by 5% per rank, as crit is 50% bonus only)
local _,_,_,_,talentRank,_ = GetTalentInfo(3,14);
local iregMod = 5*talentRank/100 + 1;
debug(string.format("Improved Regrowth talentmodification: %f", iregMod))
-- Improved Rejuvenation -- Increases Rejuvenation effects by 5% per rank
--local _,_,_,_,talentRank,_ = GetTalentInfo(3,9);
--local irMod = 5*talentRank/100 + 1;
--debug(string.format("Improved Rejuvenation modifier: %f", irMod));
local TargetIsHealthy = Health >= RatioHealthy;
local ManaLeft = UnitMana('player');
if TargetIsHealthy then
debug("Target is healthy ",Health);
end
-- Detect Clearcasting (from Omen of Clarity, talent(1,10))
if QuickHeal_DetectBuff('player',"Spell_Shadow_ManaBurn",1) then -- Spell_Shadow_ManaBurn (1)
ManaLeft = UnitManaMax('player'); -- set to max mana so max spell rank will be cast
healneed = 10^6; -- deliberate overheal (mana is free)
debug("BUFF: Clearcasting (Omen of Clarity)");
end
-- Detect Nature's Swiftness (next nature spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Nature_RavenForm") then
debug("BUFF: Nature's Swiftness (out of combat healing forced)");
ForceHTinCombat = true;
end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-------------------------------------------
-- Detect Wushoolay's Charm of Nature (Trinket from Zul'Gurub, Madness event)
if QuickHeal_DetectBuff('player',"Spell_Nature_Regenerate") then
debug("BUFF: Nature's Swiftness (out of combat healing forced)");
ForceHTinCombat = true;
end
-- Detect Nature's Grace (next nature spell is hasted by 0.5 seconds)
--if QuickHeal_DetectBuff('player',"Spell_Nature_NaturesBlessing") and healneed < ((219*gnMod+healMod25*PF14)*2.8) and
-- not QuickHeal_DetectBuff('player',"Spell_Nature_Regenerate") then
-- ManaLeft = 110*tsMod*mgMod;
--end
if QuickHeal_DetectBuff('player',"Spell_Nature_NaturesBlessing") then
NaturesGrace = true;
end
-------------------------------------------
-- Get total healing modifier (factor) caused by healing target debuffs
local HDB = QuickHeal_GetHealModifier(Target);
debug("Target debuff healing modifier",HDB);
healneed = healneed/HDB;
-- Get a list of ranks available for all spells
local SpellIDsHT = GetSpellIDs(QUICKHEAL_SPELL_HEALING_TOUCH);
local SpellIDsRG = GetSpellIDs(QUICKHEAL_SPELL_REGROWTH);
--local SpellIDsRJ = GetSpellIDs(QUICKHEAL_SPELL_REJUVENATION);
local maxRankHT = table.getn(SpellIDsHT);
local maxRankRG = table.getn(SpellIDsRG);
--local maxRankRJ = table.getn(SpellIDsRJ);
debug(string.format("Found HT up to rank %d, RG up to rank %d", maxRankHT, maxRankRG));
--Get max HealRanks that are allowed to be used
local downRankFH = QuickHealVariables.DownrankValueFH -- rank for 1.5 sec heals
local downRankNH = QuickHealVariables.DownrankValueNH -- rank for < 1.5 sec heals
-- Compensation for health lost during combat
local k=1.0;
local K=1.0;
if InCombat then
k=0.9;
K=0.8;
end
if TargetIsHealthy or maxRankRG<1 then
-- Not in combat or target is healthy so use the closest available mana efficient healing
debug(string.format("Not in combat or target healthy or no Regrowth available, will use Healing Touch"))
if Health < RatioFull then
SpellID = SpellIDsHT[1]; HealSize = 44*gnMod+healMod15*PF1; -- Default to rank 1
if healneed > ( 100*gnMod+healMod20*PF8 )*k and ManaLeft >= 55*tsMod*mgMod and maxRankHT >= 2 and SpellIDsHT[2] then SpellID = SpellIDsHT[2]; HealSize = 100*gnMod+healMod20*PF8 end
if healneed > ( 219*gnMod+healMod25*PF14)*K and ManaLeft >= 110*tsMod*mgMod and maxRankHT >= 3 and SpellIDsHT[3] then SpellID = SpellIDsHT[3]; HealSize = 219*gnMod+healMod25*PF14 end
if healneed > ( 404*gnMod+healMod30)*K and ManaLeft >= 185*tsMod*mgMod and maxRankHT >= 4 and SpellIDsHT[4] then SpellID = SpellIDsHT[4]; HealSize = 404*gnMod+healMod30 end
if healneed > ( 633*gnMod+healMod35)*K and ManaLeft >= 270*tsMod*mgMod and maxRankHT >= 5 and SpellIDsHT[5] then SpellID = SpellIDsHT[5]; HealSize = 633*gnMod+healMod35 end
if healneed > ( 818*gnMod+healMod35)*K and ManaLeft >= 335*tsMod*mgMod and maxRankHT >= 6 and SpellIDsHT[6] then SpellID = SpellIDsHT[6]; HealSize = 818*gnMod+healMod35 end
if healneed > (1028*gnMod+healMod35)*K and ManaLeft >= 405*tsMod*mgMod and maxRankHT >= 7 and SpellIDsHT[7] then SpellID = SpellIDsHT[7]; HealSize = 1028*gnMod+healMod35 end
if healneed > (1313*gnMod+healMod35)*K and ManaLeft >= 495*tsMod*mgMod and maxRankHT >= 8 and SpellIDsHT[8] then SpellID = SpellIDsHT[8]; HealSize = 1313*gnMod+healMod35 end
if healneed > (1656*gnMod+healMod35)*K and ManaLeft >= 600*tsMod*mgMod and maxRankHT >= 9 and SpellIDsHT[9] then SpellID = SpellIDsHT[9]; HealSize = 1656*gnMod+healMod35 end
if healneed > (2060*gnMod+healMod35)*K and ManaLeft >= 720*tsMod*mgMod and maxRankHT >= 10 and SpellIDsHT[10] then SpellID = SpellIDsHT[10]; HealSize = 2060*gnMod+healMod35 end
if healneed > (2472*gnMod+healMod35)*K and ManaLeft >= 800*tsMod*mgMod and maxRankHT >= 11 and SpellIDsHT[11] then SpellID = SpellIDsHT[11]; HealSize = 2472*gnMod+healMod35 end
end
elseif ForceHTinCombat then
SpellID = SpellIDsHT[1]; HealSize = 44*gnMod+healMod15*PF1; -- Default to rank 1
if healneed > ( 100*gnMod+healMod20*PF8 )*k and ManaLeft >= 55*tsMod*mgMod and maxRankHT >= 2 and SpellIDsHT[2] then SpellID = SpellIDsHT[2]; HealSize = 100*gnMod+healMod20*PF8 end
if healneed > ( 219*gnMod+healMod25*PF14)*K and ManaLeft >= 110*tsMod*mgMod and maxRankHT >= 3 and SpellIDsHT[3] then SpellID = SpellIDsHT[3]; HealSize = 219*gnMod+healMod25*PF14 end
if healneed > ( 404*gnMod+healMod30)*K and ManaLeft >= 185*tsMod*mgMod and maxRankHT >= 4 and SpellIDsHT[4] then SpellID = SpellIDsHT[4]; HealSize = 404*gnMod+healMod30 end
if healneed > ( 633*gnMod+healMod35)*K and ManaLeft >= 270*tsMod*mgMod and maxRankHT >= 5 and SpellIDsHT[5] then SpellID = SpellIDsHT[5]; HealSize = 633*gnMod+healMod35 end
if healneed > ( 818*gnMod+healMod35)*K and ManaLeft >= 335*tsMod*mgMod and maxRankHT >= 6 and SpellIDsHT[6] then SpellID = SpellIDsHT[6]; HealSize = 818*gnMod+healMod35 end
if healneed > (1028*gnMod+healMod35)*K and ManaLeft >= 405*tsMod*mgMod and maxRankHT >= 7 and SpellIDsHT[7] then SpellID = SpellIDsHT[7]; HealSize = 1028*gnMod+healMod35 end
if healneed > (1313*gnMod+healMod35)*K and ManaLeft >= 495*tsMod*mgMod and maxRankHT >= 8 and SpellIDsHT[8] then SpellID = SpellIDsHT[8]; HealSize = 1313*gnMod+healMod35 end
if healneed > (1656*gnMod+healMod35)*K and ManaLeft >= 600*tsMod*mgMod and maxRankHT >= 9 and SpellIDsHT[9] then SpellID = SpellIDsHT[9]; HealSize = 1656*gnMod+healMod35 end
if healneed > (2060*gnMod+healMod35)*K and ManaLeft >= 720*tsMod*mgMod and maxRankHT >= 10 and SpellIDsHT[10] then SpellID = SpellIDsHT[10]; HealSize = 2060*gnMod+healMod35 end
if healneed > (2472*gnMod+healMod35)*K and ManaLeft >= 800*tsMod*mgMod and maxRankHT >= 11 and SpellIDsHT[11] then SpellID = SpellIDsHT[11]; HealSize = 2472*gnMod+healMod35 end
else
-- target is unhealthy and player has Regrowth
debug(string.format("In combat and target unhealthy and Regrowth available, will use Regrowth"));
if Health < RatioFull then
SpellID = SpellIDsRG[1]; HealSize = (91*gnMod+healModRG*PFRG1)*iregMod; -- Default to rank 1
if healneed > ( 176*gnMod+healModRG*PFRG2)*iregMod*k and ManaLeft >= 164*tsMod*mgMod and maxRankRG >= 2 and SpellIDsRG[2] then SpellID = SpellIDsRG[2]; HealSize = (176*gnMod+healModRG*PFRG2)*iregMod end
if healneed > ( 257*gnMod+healModRG)*iregMod*k and ManaLeft >= 224*tsMod*mgMod and maxRankRG >= 3 and SpellIDsRG[3] then SpellID = SpellIDsRG[3]; HealSize = (257*gnMod+healModRG)*iregMod end
if healneed > ( 339*gnMod+healModRG)*iregMod*k and ManaLeft >= 280*tsMod*mgMod and maxRankRG >= 4 and SpellIDsRG[4] then SpellID = SpellIDsRG[4]; HealSize = (339*gnMod+healModRG)*iregMod end
if healneed > ( 431*gnMod+healModRG)*iregMod*k and ManaLeft >= 336*tsMod*mgMod and maxRankRG >= 5 and SpellIDsRG[5] then SpellID = SpellIDsRG[5]; HealSize = (431*gnMod+healModRG)*iregMod end
if healneed > ( 543*gnMod+healModRG)*iregMod*k and ManaLeft >= 408*tsMod*mgMod and maxRankRG >= 6 and SpellIDsRG[6] then SpellID = SpellIDsRG[6]; HealSize = (543*gnMod+healModRG)*iregMod end
if healneed > ( 686*gnMod+healModRG)*iregMod*k and ManaLeft >= 492*tsMod*mgMod and maxRankRG >= 7 and SpellIDsRG[7] then SpellID = SpellIDsRG[7]; HealSize = (686*gnMod+healModRG)*iregMod end
if healneed > ( 857*gnMod+healModRG)*iregMod*k and ManaLeft >= 592*tsMod*mgMod and maxRankRG >= 8 and SpellIDsRG[8] then SpellID = SpellIDsRG[8]; HealSize = (857*gnMod+healModRG)*iregMod end
if healneed > (1061*gnMod+healModRG)*iregMod*k and ManaLeft >= 704*tsMod*mgMod and maxRankRG >= 9 and SpellIDsRG[9] then SpellID = SpellIDsRG[9]; HealSize = (1061*gnMod+healModRG)*iregMod end
end
end
return SpellID,HealSize*HDB;
end
function QuickHeal_Druid_FindHealSpellToUseNoTarget(maxhealth, healDeficit, healType, multiplier, forceMaxHPS, forceMaxRank, hdb, incombat)
local SpellID = nil;
local HealSize = 0;
local Overheal = false;
local ForceHTinCombat = false;
-- +Healing-PenaltyFactor = (1-((20-LevelLearnt)*0.0375)) for all spells learnt before level 20
local PF1 = 0.2875;
local PF8 = 0.55;
local PFRG1 = 0.7 * 1.042; -- Rank 1 of RG (1.041 compensates for the 0.50 factor that should be 0.48 for RG1)
local PF14 = 0.775;
local PFRG2 = 0.925;
-- Local aliases to access main module functionality and settings
local RatioFull = QuickHealVariables["RatioFull"];
local RatioHealthy = QuickHeal_GetRatioHealthy();
local UnitHasHealthInfo = QuickHeal_UnitHasHealthInfo;
local EstimateUnitHealNeed = QuickHeal_EstimateUnitHealNeed;
local GetSpellIDs = QuickHeal_GetSpellIDs;
local debug = QuickHeal_debug;
if multiplier == nil then
jgpprint(">>> multiplier is NIL <<<")
--if multiplier > 1.0 then
-- Overheal = true;
--end
elseif multiplier == 1.0 then
jgpprint(">>> multiplier is " .. multiplier .. " <<<")
elseif multiplier > 1.0 then
jgpprint(">>> multiplier is " .. multiplier .. " <<<")
Overheal = true;
end
-- Determine health and heal need of target
local healneed = healDeficit * multiplier;
local Health = healDeficit / maxhealth;
-- if BonusScanner is running, get +Healing bonus
local Bonus = 0;
if (BonusScanner) then
Bonus = tonumber(BonusScanner:GetBonus("HEAL"));
debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * Bonus;
local healMod20 = (2.0/3.5) * Bonus;
local healMod25 = (2.5/3.5) * Bonus;
local healMod30 = (3.0/3.5) * Bonus;
local healMod35 = Bonus;
local healModRG = (2.0/3.5) * Bonus * 0.5; -- The 0.5 factor is calculated as DirectHeal/(DirectHeal+HoT)
debug("Final Healing Bonus (1.5,2.0,2.5,3.0,3.5,Regrowth)", healMod15,healMod20,healMod25,healMod30,healMod35,healModRG);
local InCombat = UnitAffectingCombat('player') or incombat;
-- Gift of Nature - Increases healing by 2% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(3,8);
local gnMod = 2*talentRank/100 + 1;
debug(string.format("Gift of Nature modifier: %f", gnMod));
-- Tranquil Spirit - Decreases mana usage by 2% per rank on HT and RG
local _,_,_,_,talentRank,_ = GetTalentInfo(3,10);
local tsMod = 1 - 2*talentRank/100;
debug(string.format("Tranquil Spirit modifier: %f", tsMod));
-- Moonglow - Decrease mana usage by 3% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(1,13);
local mgMod = 1 - 3*talentRank/100;
debug(string.format("Moonglow modifier: %f", mgMod));
-- Improved Regrowth Talent (increases Regrowth effect by 5% per rank, as crit is 50% bonus only)
local _,_,_,_,talentRank,_ = GetTalentInfo(3,14);
local iregMod = 5*talentRank/100 + 1;
debug(string.format("Improved Regrowth talentmodification: %f", iregMod))
-- Improved Rejuvenation -- Increases Rejuvenation effects by 5% per rank
--local _,_,_,_,talentRank,_ = GetTalentInfo(3,9);
--local irMod = 5*talentRank/100 + 1;
--debug(string.format("Improved Rejuvenation modifier: %f", irMod));
local TargetIsHealthy = Health >= RatioHealthy;
local ManaLeft = UnitMana('player');
if TargetIsHealthy then
debug("Target is healthy ",Health);
end
-- Detect Clearcasting (from Omen of Clarity, talent(1,10))
if QuickHeal_DetectBuff('player',"Spell_Shadow_ManaBurn",1) then -- Spell_Shadow_ManaBurn (1)
ManaLeft = UnitManaMax('player'); -- set to max mana so max spell rank will be cast
healneed = 10^6; -- deliberate overheal (mana is free)
debug("BUFF: Clearcasting (Omen of Clarity)");
end
-- Detect Nature's Swiftness (next nature spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Nature_RavenForm") then
debug("BUFF: Nature's Swiftness (out of combat healing forced)");
ForceHTinCombat = true;
end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-------------------------------------------
-- Detect Wushoolay's Charm of Nature (Trinket from Zul'Gurub, Madness event)
if QuickHeal_DetectBuff('player',"Spell_Nature_Regenerate") then
debug("BUFF: Nature's Swiftness (out of combat healing forced)");
ForceHTinCombat = true;
end
-- Detect Nature's Grace (next nature spell is hasted by 0.5 seconds)
if QuickHeal_DetectBuff('player',"Spell_Nature_NaturesBlessing") and healneed < ((219*gnMod+healMod25*PF14)*2.8) and
not QuickHeal_DetectBuff('player',"Spell_Nature_Regenerate") then
ManaLeft = 110*tsMod*mgMod;
end
-------------------------------------------
---- Get total healing modifier (factor) caused by healing target debuffs
--local HDB = QuickHeal_GetHealModifier(Target);
--debug("Target debuff healing modifier",HDB);
healneed = healneed/hdb;
-- Get a list of ranks available for all spells
local SpellIDsHT = GetSpellIDs(QUICKHEAL_SPELL_HEALING_TOUCH);
local SpellIDsRG = GetSpellIDs(QUICKHEAL_SPELL_REGROWTH);
--local SpellIDsRJ = GetSpellIDs(QUICKHEAL_SPELL_REJUVENATION);
local maxRankHT = table.getn(SpellIDsHT);
local maxRankRG = table.getn(SpellIDsRG);
--local maxRankRJ = table.getn(SpellIDsRJ);
debug(string.format("Found HT up to rank %d, RG up to rank %d", maxRankHT, maxRankRG));
-- Compensation for health lost during combat
local k=1.0;
local K=1.0;
if InCombat then
k=0.9;
K=0.8;
end
--if UnitLevel('player') < 60 then
-- print('f:QuickHeal_Druid_FindHealSpellToUseNoTarget --you are not 60');
--else
-- print('f:QuickHeal_Druid_FindHealSpellToUseNoTarget --you are 60');
--end
if not forceMaxHPS then
SpellID = SpellIDsHT[1]; HealSize = 44*gnMod+healMod15*PF1; -- Default to rank 1
if healneed > ( 100*gnMod+healMod20*PF8 )*k and ManaLeft >= 55*tsMod*mgMod and maxRankHT >= 2 and SpellIDsHT[2] then SpellID = SpellIDsHT[2]; HealSize = 100*gnMod+healMod20*PF8 end
if healneed > ( 219*gnMod+healMod25*PF14)*K and ManaLeft >= 110*tsMod*mgMod and maxRankHT >= 3 and SpellIDsHT[3] then SpellID = SpellIDsHT[3]; HealSize = 219*gnMod+healMod25*PF14 end
if healneed > ( 404*gnMod+healMod30)*K and ManaLeft >= 185*tsMod*mgMod and maxRankHT >= 4 and SpellIDsHT[4] then SpellID = SpellIDsHT[4]; HealSize = 404*gnMod+healMod30 end
if healneed > ( 633*gnMod+healMod35)*K and ManaLeft >= 270*tsMod*mgMod and maxRankHT >= 5 and SpellIDsHT[5] then SpellID = SpellIDsHT[5]; HealSize = 633*gnMod+healMod35 end
if healneed > ( 818*gnMod+healMod35)*K and ManaLeft >= 335*tsMod*mgMod and maxRankHT >= 6 and SpellIDsHT[6] then SpellID = SpellIDsHT[6]; HealSize = 818*gnMod+healMod35 end
if healneed > (1028*gnMod+healMod35)*K and ManaLeft >= 405*tsMod*mgMod and maxRankHT >= 7 and SpellIDsHT[7] then SpellID = SpellIDsHT[7]; HealSize = 1028*gnMod+healMod35 end
if healneed > (1313*gnMod+healMod35)*K and ManaLeft >= 495*tsMod*mgMod and maxRankHT >= 8 and SpellIDsHT[8] then SpellID = SpellIDsHT[8]; HealSize = 1313*gnMod+healMod35 end
if healneed > (1656*gnMod+healMod35)*K and ManaLeft >= 600*tsMod*mgMod and maxRankHT >= 9 and SpellIDsHT[9] then SpellID = SpellIDsHT[9]; HealSize = 1656*gnMod+healMod35 end
if healneed > (2060*gnMod+healMod35)*K and ManaLeft >= 720*tsMod*mgMod and maxRankHT >= 10 and SpellIDsHT[10] then SpellID = SpellIDsHT[10]; HealSize = 2060*gnMod+healMod35 end
if healneed > (2472*gnMod+healMod35)*K and ManaLeft >= 800*tsMod*mgMod and maxRankHT >= 11 and SpellIDsHT[11] then SpellID = SpellIDsHT[11]; HealSize = 2472*gnMod+healMod35 end
else
SpellID = SpellIDsRG[1]; HealSize = (91*gnMod+healModRG*PFRG1)*iregMod; -- Default to rank 1
if healneed > ( 176*gnMod+healModRG*PFRG2)*iregMod*k and ManaLeft >= 164*tsMod*mgMod and maxRankRG >= 2 then SpellID = SpellIDsRG[2]; HealSize = (176*gnMod+healModRG*PFRG2)*iregMod end
if healneed > ( 257*gnMod+healModRG)*iregMod*k and ManaLeft >= 224*tsMod*mgMod and maxRankRG >= 3 and SpellIDsRG[3] then SpellID = SpellIDsRG[3]; HealSize = (257*gnMod+healModRG)*iregMod end
if healneed > ( 339*gnMod+healModRG)*iregMod*k and ManaLeft >= 280*tsMod*mgMod and maxRankRG >= 4 and SpellIDsRG[4] then SpellID = SpellIDsRG[4]; HealSize = (339*gnMod+healModRG)*iregMod end
if healneed > ( 431*gnMod+healModRG)*iregMod*k and ManaLeft >= 336*tsMod*mgMod and maxRankRG >= 5 and SpellIDsRG[5] then SpellID = SpellIDsRG[5]; HealSize = (431*gnMod+healModRG)*iregMod end
if healneed > ( 543*gnMod+healModRG)*iregMod*k and ManaLeft >= 408*tsMod*mgMod and maxRankRG >= 6 and SpellIDsRG[6] then SpellID = SpellIDsRG[6]; HealSize = (543*gnMod+healModRG)*iregMod end
if healneed > ( 686*gnMod+healModRG)*iregMod*k and ManaLeft >= 492*tsMod*mgMod and maxRankRG >= 7 and SpellIDsRG[7] then SpellID = SpellIDsRG[7]; HealSize = (686*gnMod+healModRG)*iregMod end
if healneed > ( 857*gnMod+healModRG)*iregMod*k and ManaLeft >= 592*tsMod*mgMod and maxRankRG >= 8 and SpellIDsRG[8] then SpellID = SpellIDsRG[8]; HealSize = (857*gnMod+healModRG)*iregMod end
if healneed > (1061*gnMod+healModRG)*iregMod*k and ManaLeft >= 704*tsMod*mgMod and maxRankRG >= 9 and SpellIDsRG[9] then SpellID = SpellIDsRG[9]; HealSize = (1061*gnMod+healModRG)*iregMod end
end
return SpellID,HealSize*hdb;
end
function QuickHeal_Druid_FindHoTSpellToUse(Target, healType, forceMaxRank)
local SpellID = nil;
local HealSize = 0;
-- +Healing-PenaltyFactor = (1-((20-LevelLearnt)*0.0375)) for all spells learnt before level 20
local PF1 = 0.2875;
local PF8 = 0.55;
local PFRG1 = 0.7 * 1.042; -- Rank 1 of RG (1.041 compensates for the 0.50 factor that should be 0.48 for RG1)
local PF14 = 0.775;
local PFRG2 = 0.925;
-- Local aliases to access main module functionality and settings
local RatioFull = QuickHealVariables["RatioFull"];
local RatioHealthy = QuickHeal_GetRatioHealthy();
local UnitHasHealthInfo = QuickHeal_UnitHasHealthInfo;
local EstimateUnitHealNeed = QuickHeal_EstimateUnitHealNeed;
local GetSpellIDs = QuickHeal_GetSpellIDs;
local debug = QuickHeal_debug;
-- Return immediately if no player needs healing
if not Target then
return SpellID,HealSize;
end
-- Determine health and heal need of target
local healneed;
local Health;
if UnitHasHealthInfo(Target) then
-- Full info available
healneed = UnitHealthMax(Target) - UnitHealth(Target) - HealComm:getHeal(UnitName(Target)); -- Implementatio for HealComm
Health = UnitHealth(Target) / UnitHealthMax(Target);
else
-- Estimate target health
healneed = EstimateUnitHealNeed(Target,true);
Health = UnitHealth(Target)/100;
end
-- if BonusScanner is running, get +Healing bonus
local Bonus = 0;
if (BonusScanner) then
Bonus = tonumber(BonusScanner:GetBonus("HEAL"));
debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * Bonus;
local healMod20 = (2.0/3.5) * Bonus;
local healMod25 = (2.5/3.5) * Bonus;
local healMod30 = (3.0/3.5) * Bonus;
local healMod35 = Bonus;
local healModRG = (2.0/3.5) * Bonus * 0.5; -- The 0.5 factor is calculated as DirectHeal/(DirectHeal+HoT)
debug("Final Healing Bonus (1.5,2.0,2.5,3.0,3.5,Regrowth)", healMod15,healMod20,healMod25,healMod30,healMod35,healModRG);
local InCombat = UnitAffectingCombat('player') or UnitAffectingCombat(Target);
-- Gift of Nature - Increases healing by 2% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(3,8);
local gnMod = 2*talentRank/100 + 1;
debug(string.format("Gift of Nature modifier: %f", gnMod));
-- Tranquil Spirit - Decreases mana usage by 2% per rank on HT and RG
local _,_,_,_,talentRank,_ = GetTalentInfo(3,10);
local tsMod = 1 - 2*talentRank/100;
debug(string.format("Tranquil Spirit modifier: %f", tsMod));
-- Moonglow - Decrease mana usage by 3% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(1,13);
local mgMod = 1 - 3*talentRank/100;
debug(string.format("Moonglow modifier: %f", mgMod));
-- Improved Rejuvenation -- Increases Rejuvenation effects by 5% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(3,9);
local irMod = 5*talentRank/100 + 1;
debug(string.format("Improved Rejuvenation modifier: %f", irMod));
local TargetIsHealthy = Health >= RatioHealthy;
local ManaLeft = UnitMana('player');
if TargetIsHealthy then
debug("Target is healthy ",Health);
end
-- Detect Clearcasting (from Omen of Clarity, talent(1,10))
if QuickHeal_DetectBuff('player',"Spell_Shadow_ManaBurn",1) then -- Spell_Shadow_ManaBurn (1)
ManaLeft = UnitManaMax('player'); -- set to max mana so max spell rank will be cast
healneed = 10^6; -- deliberate overheal (mana is free)
debug("BUFF: Clearcasting (Omen of Clarity)");
end
-- Detect Nature's Swiftness (next nature spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Nature_RavenForm") then
debug("BUFF: Nature's Swiftness (out of combat healing forced)");
InCombat = false;
end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-- Get total healing modifier (factor) caused by healing target debuffs
local HDB = QuickHeal_GetHealModifier(Target);
debug("Target debuff healing modifier",HDB);
healneed = healneed/HDB;
-- Get a list of ranks available for all spells
local SpellIDsHT = GetSpellIDs(QUICKHEAL_SPELL_HEALING_TOUCH);
local SpellIDsRG = GetSpellIDs(QUICKHEAL_SPELL_REGROWTH);
local SpellIDsRJ = GetSpellIDs(QUICKHEAL_SPELL_REJUVENATION);
local maxRankHT = table.getn(SpellIDsHT);
local maxRankRG = table.getn(SpellIDsRG);
local maxRankRJ = table.getn(SpellIDsRJ);
debug(string.format("Found HT up to rank %d, RG up to rank %d, RJ up to rank %d", maxRankHT, maxRankRG, maxRankRJ));
-- Compensation for health lost during combat
local k=1.0;
local K=1.0;
if InCombat then
k=0.9;
K=0.8;
end
QuickHeal_debug(string.format("healneed: %f target: %s healType: %s forceMaxRank: %s", healneed, Target, healType, tostring(forceMaxRank)));
--return SpellIDsRJ[1], 32*irMod+gnMod+healMod15;
--if UnitLevel('player') < 60 then
-- print('f:QuickHeal_Druid_FindHoTSpellToUse --you are not 60');
--else
-- print('f:QuickHeal_Druid_FindHoTSpellToUse --you are 60');
--end
if healType == "hot" then
--QuickHeal_debug(string.format("Spiritual Healing modifier: %f", shMod));
--SpellID = SpellIDsR[1]; HealSize = 215*shMod+healMod15; -- Default to Renew
--if Health < QuickHealVariables.RatioFull then
--if Health > QuickHealVariables.RatioHealthyPriest then
if not forceMaxRank then
SpellID = SpellIDsRJ[1]; HealSize = 32*irMod+gnMod+healMod15; -- Default to Renew(Rank 1)
if healneed > (56*irMod+gnMod+healMod15)*k and ManaLeft >= 155 and maxRankRJ >=2 and SpellIDsRJ[2] then SpellID = SpellIDsRJ[2]; HealSize = 56*irMod+gnMod+healMod15 end
if healneed > (116*irMod+gnMod+healMod15)*k and ManaLeft >= 185 and maxRankRJ >=3 and SpellIDsRJ[3] then SpellID = SpellIDsRJ[3]; HealSize = 116*irMod+gnMod+healMod15 end
if healneed > (180*irMod+gnMod+healMod15)*k and ManaLeft >= 215 and maxRankRJ >=4 and SpellIDsRJ[4] then SpellID = SpellIDsRJ[4]; HealSize = 180*irMod+gnMod+healMod15 end
if healneed > (244*irMod+gnMod+healMod15)*k and ManaLeft >= 265 and maxRankRJ >=5 and SpellIDsRJ[5] then SpellID = SpellIDsRJ[5]; HealSize = 244*irMod+gnMod+healMod15 end
if healneed > (304*irMod+gnMod+healMod15)*k and ManaLeft >= 315 and maxRankRJ >=6 and SpellIDsRJ[6] then SpellID = SpellIDsRJ[6]; HealSize = 304*irMod+gnMod+healMod15 end
if healneed > (388*irMod+gnMod+healMod15)*k and ManaLeft >= 380 and maxRankRJ >=7 and SpellIDsRJ[7] then SpellID = SpellIDsRJ[7]; HealSize = 388*irMod+gnMod+healMod15 end
if healneed > (488*irMod+gnMod+healMod15)*k and ManaLeft >= 455 and maxRankRJ >=8 and SpellIDsRJ[8] then SpellID = SpellIDsRJ[8]; HealSize = 488*irMod+gnMod+healMod15 end
if healneed > (688*irMod+gnMod+healMod15)*k and ManaLeft >= 545 and maxRankRJ >=9 and SpellIDsRJ[9] then SpellID = SpellIDsRJ[9]; HealSize = 608*irMod+gnMod+healMod15 end
if healneed > (756*irMod+gnMod+healMod15)*k and ManaLeft >= 655 and maxRankRJ >=10 and SpellIDsRJ[10] then SpellID = SpellIDsRJ[10]; HealSize = 756*irMod+gnMod+healMod15 end
if healneed > (888*irMod+gnMod+healMod15)*k and ManaLeft >= 655 and maxRankRJ >=11 and SpellIDsRJ[11] then SpellID = SpellIDsRJ[11]; HealSize = 888*irMod+gnMod+healMod15 end
else
SpellID = SpellIDsRJ[11]; HealSize = 888*irMod+gnMod+healMod15
if maxRankRJ >=2 and SpellIDsRJ[2] then SpellID = SpellIDsRJ[2]; HealSize = 56*irMod+healMod15 end
if maxRankRJ >=3 and SpellIDsRJ[3] then SpellID = SpellIDsRJ[3]; HealSize = 116*irMod+healMod15 end
if maxRankRJ >=4 and SpellIDsRJ[4] then SpellID = SpellIDsRJ[4]; HealSize = 180*irMod+healMod15 end
if maxRankRJ >=5 and SpellIDsRJ[5] then SpellID = SpellIDsRJ[5]; HealSize = 244*irMod+healMod15 end
if maxRankRJ >=6 and SpellIDsRJ[6] then SpellID = SpellIDsRJ[6]; HealSize = 304*irMod+healMod15 end
if maxRankRJ >=7 and SpellIDsRJ[7] then SpellID = SpellIDsRJ[7]; HealSize = 388*irMod+healMod15 end
if maxRankRJ >=8 and SpellIDsRJ[8] then SpellID = SpellIDsRJ[8]; HealSize = 488*irMod+healMod15 end
if maxRankRJ >=9 and SpellIDsRJ[9] then SpellID = SpellIDsRJ[9]; HealSize = 688*irMod+healMod15 end
if maxRankRJ >=10 and SpellIDsRJ[10] then SpellID = SpellIDsRJ[10]; HealSize = 756*irMod+healMod15 end
if maxRankRJ >=11 and SpellIDsRJ[11] then SpellID = SpellIDsRJ[11]; HealSize = 888*irMod+healMod15 end
end
--end
end
return SpellID,HealSize*HDB;
end
function QuickHeal_Druid_FindHoTSpellToUseNoTarget(maxhealth, healDeficit, healType, multiplier, forceMaxHPS, forceMaxRank, hdb, incombat)
local SpellID = nil;
local HealSize = 0;
-- +Healing-PenaltyFactor = (1-((20-LevelLearnt)*0.0375)) for all spells learnt before level 20
local PF1 = 0.2875;
local PF8 = 0.55;
local PFRG1 = 0.7 * 1.042; -- Rank 1 of RG (1.041 compensates for the 0.50 factor that should be 0.48 for RG1)
local PF14 = 0.775;
local PFRG2 = 0.925;
-- Local aliases to access main module functionality and settings
local RatioFull = QuickHealVariables["RatioFull"];
local RatioHealthy = QuickHeal_GetRatioHealthy();
local UnitHasHealthInfo = QuickHeal_UnitHasHealthInfo;
local EstimateUnitHealNeed = QuickHeal_EstimateUnitHealNeed;
local GetSpellIDs = QuickHeal_GetSpellIDs;
local debug = QuickHeal_debug;
if multiplier == nil then
jgpprint(">>> multiplier is NIL <<<")
--if multiplier > 1.0 then
-- Overheal = true;
--end
elseif multiplier == 1.0 then
jgpprint(">>> multiplier is " .. multiplier .. " <<<")
elseif multiplier > 1.0 then
jgpprint(">>> multiplier is " .. multiplier .. " <<<")
Overheal = true;
end
-- Determine health and heal need of target
local healneed = healDeficit * multiplier;
local Health = healDeficit / maxhealth;
-- if BonusScanner is running, get +Healing bonus
local Bonus = 0;
if (BonusScanner) then
Bonus = tonumber(BonusScanner:GetBonus("HEAL"));
debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * Bonus;
local healMod20 = (2.0/3.5) * Bonus;
local healMod25 = (2.5/3.5) * Bonus;
local healMod30 = (3.0/3.5) * Bonus;
local healMod35 = Bonus;
local healModRG = (2.0/3.5) * Bonus * 0.5; -- The 0.5 factor is calculated as DirectHeal/(DirectHeal+HoT)
debug("Final Healing Bonus (1.5,2.0,2.5,3.0,3.5,Regrowth)", healMod15,healMod20,healMod25,healMod30,healMod35,healModRG);
local InCombat = UnitAffectingCombat('player') or incombat;
-- Gift of Nature - Increases healing by 2% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(3,8);
local gnMod = 2*talentRank/100 + 1;
debug(string.format("Gift of Nature modifier: %f", gnMod));
-- Tranquil Spirit - Decreases mana usage by 2% per rank on HT only
local _,_,_,_,talentRank,_ = GetTalentInfo(3,10);
local tsMod = 1 - 2*talentRank/100;
debug(string.format("Tranquil Spirit modifier: %f", tsMod));
-- Moonglow - Decrease mana usage by 3% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(1,13);
local mgMod = 1 - 3*talentRank/100;
debug(string.format("Moonglow modifier: %f", mgMod));
-- Improved Rejuvenation -- Increases Rejuvenation effects by 5% per rank
local _,_,_,_,talentRank,_ = GetTalentInfo(3,9);
local irMod = 5*talentRank/100 + 1;
debug(string.format("Improved Rejuvenation modifier: %f", irMod));
local TargetIsHealthy = Health >= RatioHealthy;
local ManaLeft = UnitMana('player');
if TargetIsHealthy then
debug("Target is healthy ",Health);
end
-- Detect Clearcasting (from Omen of Clarity, talent(1,10))
if QuickHeal_DetectBuff('player',"Spell_Shadow_ManaBurn",1) then -- Spell_Shadow_ManaBurn (1)
ManaLeft = UnitManaMax('player'); -- set to max mana so max spell rank will be cast
healneed = 10^6; -- deliberate overheal (mana is free)
debug("BUFF: Clearcasting (Omen of Clarity)");
end
-- Detect Nature's Swiftness (next nature spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Nature_RavenForm") then
debug("BUFF: Nature's Swiftness (out of combat healing forced)");
InCombat = false;
end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-- Get total healing modifier (factor) caused by healing target debuffs
--local HDB = QuickHeal_GetHealModifier(Target);
--debug("Target debuff healing modifier",HDB);
healneed = healneed/hdb;
-- Get a list of ranks available for all spells
local SpellIDsHT = GetSpellIDs(QUICKHEAL_SPELL_HEALING_TOUCH);
local SpellIDsRG = GetSpellIDs(QUICKHEAL_SPELL_REGROWTH);
local SpellIDsRJ = GetSpellIDs(QUICKHEAL_SPELL_REJUVENATION);
local maxRankHT = table.getn(SpellIDsHT);
local maxRankRG = table.getn(SpellIDsRG);
local maxRankRJ = table.getn(SpellIDsRJ);
debug(string.format("Found HT up to rank %d, RG up to rank %d, RJ up to rank %d", maxRankHT, maxRankRG, maxRankRJ));
-- Compensation for health lost during combat
local k=1.0;
local K=1.0;
if InCombat then
k=0.9;
K=0.8;
end
--QuickHeal_debug(string.format("healneed: %f target: %s healType: %s forceMaxRank: %s", healneed, Target, healType, tostring(forceMaxRank)));
--return SpellIDsRJ[1], 32*irMod+gnMod+healMod15;
--if UnitLevel('player') < 60 then
-- print('f:QuickHeal_Druid_FindHoTSpellToUseNoTarget --you are not 60');
--else
-- print('f:QuickHeal_Druid_FindHoTSpellToUseNoTarget --you are 60');
--end
SpellID = SpellIDsRJ[1]; HealSize = 32*irMod+gnMod+healMod15; -- Default to Renew(Rank 1)
if healneed > (56*irMod+gnMod+healMod15)*k and ManaLeft >= 155 and maxRankRJ >=2 and SpellIDsRJ[2] then SpellID = SpellIDsRJ[2]; HealSize = 56*irMod+gnMod+healMod15 end
if healneed > (116*irMod+gnMod+healMod15)*k and ManaLeft >= 185 and maxRankRJ >=3 and SpellIDsRJ[3] then SpellID = SpellIDsRJ[3]; HealSize = 116*irMod+gnMod+healMod15 end
if healneed > (180*irMod+gnMod+healMod15)*k and ManaLeft >= 215 and maxRankRJ >=4 and SpellIDsRJ[4] then SpellID = SpellIDsRJ[4]; HealSize = 180*irMod+gnMod+healMod15 end
if healneed > (244*irMod+gnMod+healMod15)*k and ManaLeft >= 265 and maxRankRJ >=5 and SpellIDsRJ[5] then SpellID = SpellIDsRJ[5]; HealSize = 244*irMod+gnMod+healMod15 end
if healneed > (304*irMod+gnMod+healMod15)*k and ManaLeft >= 315 and maxRankRJ >=6 and SpellIDsRJ[6] then SpellID = SpellIDsRJ[6]; HealSize = 304*irMod+gnMod+healMod15 end
if healneed > (388*irMod+gnMod+healMod15)*k and ManaLeft >= 380 and maxRankRJ >=7 and SpellIDsRJ[7] then SpellID = SpellIDsRJ[7]; HealSize = 388*irMod+gnMod+healMod15 end
if healneed > (488*irMod+gnMod+healMod15)*k and ManaLeft >= 455 and maxRankRJ >=8 and SpellIDsRJ[8] then SpellID = SpellIDsRJ[8]; HealSize = 488*irMod+gnMod+healMod15 end
if healneed > (688*irMod+gnMod+healMod15)*k and ManaLeft >= 545 and maxRankRJ >=9 and SpellIDsRJ[9] then SpellID = SpellIDsRJ[9]; HealSize = 608*irMod+gnMod+healMod15 end
if healneed > (756*irMod+gnMod+healMod15)*k and ManaLeft >= 655 and maxRankRJ >=10 and SpellIDsRJ[10] then SpellID = SpellIDsRJ[10]; HealSize = 756*irMod+gnMod+healMod15 end
if healneed > (888*irMod+gnMod+healMod15)*k and ManaLeft >= 655 and maxRankRJ >=11 and SpellIDsRJ[11] then SpellID = SpellIDsRJ[11]; HealSize = 888*irMod+gnMod+healMod15 end
return SpellID,HealSize*hdb;
end
function QuickHeal_Command_Druid(msg)
--if PlayerClass == "priest" then
-- writeLine("DRUID", 0, 1, 0);
--end
local _, _, arg1, arg2, arg3 = string.find(msg, "%s?(%w+)%s?(%w+)%s?(%w+)")
-- match 3 arguments
if arg1 ~= nil and arg2 ~= nil and arg3 ~= nil then
if arg1 == "player" or arg1 == "target" or arg1 == "targettarget" or arg1 == "party" or arg1 == "subgroup" or arg1 == "mt" or arg1 == "nonmt" then
if arg2 == "heal" and arg3 == "max" then
--writeLine(QuickHealData.name .. " qh " .. arg1 .. " HEAL(maxHPS)", 0, 1, 0);
QuickHeal(arg1, nil, nil, true);
return;
end
if arg2 == "hot" and arg3 == "fh" then
--writeLine(QuickHealData.name .. " qh " .. arg1 .. " HOT(max rank & no hp check)", 0, 1, 0);
QuickHOT(arg1, nil, nil, true, true);
return;
end
if arg2 == "hot" and arg3 == "max" then
--writeLine(QuickHealData.name .. " qh " .. arg1 .. " HOT(max rank)", 0, 1, 0);
QuickHOT(arg1, nil, nil, true, false);
return;
end
end
end
-- match 2 arguments
local _, _, arg4, arg5= string.find(msg, "%s?(%w+)%s?(%w+)")
if arg4 ~= nil and arg5 ~= nil then
if arg4 == "debug" then
if arg5 == "on" then
QHV.DebugMode = true;
--writeLine(QuickHealData.name .. " debug mode enabled", 0, 0, 1);
return;
elseif arg5 == "off" then
QHV.DebugMode = false;
--writeLine(QuickHealData.name .. " debug mode disabled", 0, 0, 1);
return;
end
end
if arg4 == "heal" and arg5 == "max" then
--writeLine(QuickHealData.name .. " HEAL (max)", 0, 1, 0);
QuickHeal(nil, nil, nil, true);
return;
end
if arg4 == "hot" and arg5 == "max" then
--writeLine(QuickHealData.name .. " HOT (max)", 0, 1, 0);
QuickHOT(nil, nil, nil, true, false);
return;
end
if arg4 == "hot" and arg5 == "fh" then
--writeLine(QuickHealData.name .. " FH (max rank & no hp check)", 0, 1, 0);
QuickHOT(nil, nil, nil, true, true);
return;
end
if arg4 == "player" or arg4 == "target" or arg4 == "targettarget" or arg4 == "party" or arg4 == "subgroup" or arg4 == "mt" or arg4 == "nonmt" then
if arg5 == "hot" then
--writeLine(QuickHealData.name .. " qh " .. arg1 .. " HOT", 0, 1, 0);
QuickHOT(arg1, nil, nil, false, false);
return;
end
if arg5 == "heal" then
--writeLine(QuickHealData.name .. " qh " .. arg1 .. " HEAL", 0, 1, 0);
QuickHeal(arg1, nil, nil, false);
return;
end
end
end
-- match 1 argument
local cmd = string.lower(msg)
if cmd == "cfg" then
QuickHeal_ToggleConfigurationPanel();
return;
end
if cmd == "toggle" then
QuickHeal_Toggle_Healthy_Threshold();
return;
end
if cmd == "downrank" or cmd == "dr" then
ToggleDownrankWindow()
return;
end
if cmd == "tanklist" or cmd == "tl" then
QH_ShowHideMTListUI();
return;
end
if cmd == "reset" then
QuickHeal_SetDefaultParameters();
writeLine(QuickHealData.name .. " reset to default configuration", 0, 0, 1);
QuickHeal_ToggleConfigurationPanel();
QuickHeal_ToggleConfigurationPanel();
return;
end
if cmd == "heal" then
--writeLine(QuickHealData.name .. " HEAL", 0, 1, 0);
QuickHeal();
return;
end
if cmd == "hot" then
--writeLine(QuickHealData.name .. " HOT", 0, 1, 0);
QuickHOT();
return;
end
if cmd == "" then
--writeLine(QuickHealData.name .. " qh", 0, 1, 0);
QuickHeal(nil);
return;
elseif cmd == "player" or cmd == "target" or cmd == "targettarget" or cmd == "party" or cmd == "subgroup" or cmd == "mt" or cmd == "nonmt" then
--writeLine(QuickHealData.name .. " qh " .. cmd, 0, 1, 0);
QuickHeal(cmd);
return;
end
-- Print usage information if arguments do not match
--writeLine(QuickHealData.name .. " Usage:");
writeLine("== QUICKHEAL USAGE : DRUID ==");
writeLine("/qh cfg - Opens up the configuration panel.");
writeLine("/qh toggle - Switches between High HPS and Normal HPS. Heals (Healthy Threshold 0% or 100%).");
writeLine("/qh downrank | dr - Opens the slider to limit QuickHeal to constrain healing to lower ranks.");
writeLine("/qh tanklist | tl - Toggles display of the main tank list UI.");
writeLine("/qh [mask] [type] [mod] - Heals the party/raid member that most needs it with the best suited healing spell.");
writeLine(" [mask] constrains healing pool to:");
writeLine(" [player] yourself");
writeLine(" [target] your target");
writeLine(" [targettarget] your target's target");
writeLine(" [party] your party");
writeLine(" [mt] main tanks (defined in the configuration panel)");
writeLine(" [nonmt] everyone but the main tanks");
writeLine(" [subgroup] raid subgroups (defined in the configuration panel)");
writeLine(" [type] specifies the use of a [hot] or [heal]");
writeLine(" [mod] (optional) modifies [hot] or [heal] options:");
writeLine(" [heal] modifier options:");
writeLine(" [max] applies maximum rank [heal] to subgroup members that have <100% health");
writeLine(" [hot] modifier options:");
writeLine(" [max] applies maximum rank [hot] to subgroup members that have <100% health and no hot applied");
writeLine(" [fh] applies maximum rank [hot] to subgroup members that have no hot applied regardless of health status");
writeLine("/qh reset - Reset configuration to default parameters for all classes.");
end