forked from Bestoriop/QuickHeal-Turtle-Wow
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuickHealPriest.lua
More file actions
941 lines (793 loc) · 52 KB
/
QuickHealPriest.lua
File metadata and controls
941 lines (793 loc) · 52 KB
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
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
function QuickHeal_Priest_GetRatioHealthyExplanation()
if QuickHealVariables.RatioHealthyPriest >= QuickHealVariables.RatioFull then
return QUICKHEAL_SPELL_FLASH_HEAL .. " will always be used in combat, and " .. QUICKHEAL_SPELL_LESSER_HEAL .. ", " .. QUICKHEAL_SPELL_HEAL .. " or " .. QUICKHEAL_SPELL_GREATER_HEAL .. " will be used when out of combat. ";
else
if QuickHealVariables.RatioHealthyPriest > 0 then
return QUICKHEAL_SPELL_FLASH_HEAL .. " will be used in combat if the target has less than " .. QuickHealVariables.RatioHealthyPriest*100 .. "% life, and " .. QUICKHEAL_SPELL_LESSER_HEAL .. ", " .. QUICKHEAL_SPELL_HEAL .. " or " .. QUICKHEAL_SPELL_GREATER_HEAL .. " will be used otherwise. ";
else
return QUICKHEAL_SPELL_FLASH_HEAL .. " will never be used. " .. QUICKHEAL_SPELL_LESSER_HEAL .. ", " .. QUICKHEAL_SPELL_HEAL .. " or " .. QUICKHEAL_SPELL_GREATER_HEAL .. " will always be used in and out of combat. ";
end
end
end
function QuickHeal_Priest_FindHealSpellToUse(Target, healType, multiplier, forceMaxHPS)
local SpellID = nil;
local HealSize = 0;
local Overheal = false;
-- 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
-- +Healing-PenaltyFactor = (1-((20-LevelLearnt)*0.0375)) for all spells learnt before level 20
local PF1 = 0.2875;
local PF4 = 0.4;
local PF10 = 0.625;
local PF18 = 0.925;
-- Determine health and healneed of target
local healneed;
local Health;
if QuickHeal_UnitHasHealthInfo(Target) then
-- Full info available
healneed = UnitHealthMax(Target) - UnitHealth(Target) - HealComm:getHeal(UnitName(Target)); -- Implementatin for HealComm
if Overheal then
healneed = healneed * multiplier;
else
--
end
Health = UnitHealth(Target) / UnitHealthMax(Target);
else
-- Estimate target health
healneed = QuickHeal_EstimateUnitHealNeed(Target,true); -- needs HealComm implementation maybe
if Overheal then
healneed = healneed * multiplier;
else
--
end
Health = UnitHealth(Target)/100;
end
jgpprint(">>> healneed is " .. healneed .. " <<<")
-- if BonusScanner is running, get +Healing bonus
local Bonus = 0;
if (BonusScanner) then
Bonus = tonumber(BonusScanner:GetBonus("HEAL"));
QuickHeal_debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Spiritual Guidance - Increases spell damage and healing by up to 5% (per rank) of your total Spirit.
local _,_,_,_,talentRank,_ = GetTalentInfo(2,12);
local _,Spirit,_,_ = UnitStat('player',5);
local sgMod = Spirit * 5*talentRank/100;
QuickHeal_debug(string.format("Spiritual Guidance Bonus: %f", sgMod));
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * (sgMod + Bonus);
local healMod20 = (2.0/3.5) * (sgMod + Bonus);
local healMod25 = (2.5/3.5) * (sgMod + Bonus);
local healMod30 = (3.0/3.5) * (sgMod + Bonus);
QuickHeal_debug("Final Healing Bonus (1.5,2.0,2.5,3.0)", healMod15,healMod20,healMod25,healMod30);
local InCombat = UnitAffectingCombat('player') or UnitAffectingCombat(Target);
-- Spiritual Healing - Increases healing by 6% per rank on all spells
local _,_,_,_,talentRank,_ = GetTalentInfo(2,15);
local shMod = 6*talentRank/100 + 1;
QuickHeal_debug(string.format("Spiritual Healing modifier: %f", shMod));
-- Improved Healing - Decreases mana usage by 5% per rank on LH,H and GH
local _,_,_,_,talentRank,_ = GetTalentInfo(2,11);
local ihMod = 1 - 5*talentRank/100;
QuickHeal_debug(string.format("Improved Healing modifier: %f", ihMod));
local TargetIsHealthy = Health >= QuickHealVariables.RatioHealthyPriest;
local ManaLeft = UnitMana('player');
if TargetIsHealthy then
QuickHeal_debug("Target is healthy",Health);
end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
QuickHeal_debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-- Detect Inner Focus or Spirit of Redemption (hack ManaLeft and healneed)
if QuickHeal_DetectBuff('player',"Spell_Frost_WindWalkOn",1) or QuickHeal_DetectBuff('player',"Spell_Holy_GreaterHeal") then
QuickHeal_debug("Inner Focus or Spirit of Redemption active");
ManaLeft = UnitManaMax('player'); -- Infinite mana
healneed = 10^6; -- Deliberate overheal (mana is free)
end
if Overheal then
QuickHeal_debug("MOOOOOOOOOOOOOOOOOOOOOOOOLTIPLIER");
else
end
-- Get total healing modifier (factor) caused by healing target debuffs
local HDB = QuickHeal_GetHealModifier(Target);
QuickHeal_debug("Target debuff healing modifier",HDB);
healneed = healneed/HDB;
-- Get a list of ranks available for all spells
local SpellIDsLH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_LESSER_HEAL);
local SpellIDsH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_HEAL);
local SpellIDsGH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_GREATER_HEAL);
local SpellIDsFH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_FLASH_HEAL);
local SpellIDsR = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_RENEW);
local maxRankLH = table.getn(SpellIDsLH);
local maxRankH = table.getn(SpellIDsH);
local maxRankGH = table.getn(SpellIDsGH);
local maxRankFH = table.getn(SpellIDsFH);
local maxRankR = table.getn(SpellIDsR);
QuickHeal_debug(string.format("Found LH up to rank %d, H up top rank %d, GH up to rank %d, FH up to rank %d, and R up to max rank %d", maxRankLH, maxRankH, maxRankGH, maxRankFH, maxRankR));
--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 healType = channel
--jgpprint(healType)
--if healType == "channel" and Overheal and healneed == 0 then
-- SpellID = SpellIDsGH[5]; HealSize = 2080*shMod+healMod30;
--end
if healType == "channel" then
jgpprint("CHANNEL HEAL: " .. healType)
-- Find suitable SpellID based on the defined criteria
if not InCombat or TargetIsHealthy or maxRankFH<1 then
-- Not in combat or target is healthy so use the closest available mana efficient healing
QuickHeal_debug(string.format("Not in combat or target healthy or no flash heal available, will use closest available LH, H or GH (not FH)"))
if Health < QuickHealVariables.RatioFull then
SpellID = SpellIDsLH[1]; HealSize = (53+healMod15*PF1)*shMod; -- Default to LH
if healneed > ( 84+healMod20*PF4 )*k*shMod and ManaLeft >= 45*ihMod and maxRankLH >=2 and downRankNH >= 2 and SpellIDsLH[2] then SpellID = SpellIDsLH[2]; HealSize = ( 84+healMod20*PF4 )*shMod end
if healneed > ( 154+healMod25*PF10)*K*shMod and ManaLeft >= 75*ihMod and maxRankLH >=3 and downRankNH >= 3 and SpellIDsLH[3] then SpellID = SpellIDsLH[3]; HealSize = ( 154+healMod25*PF10)*shMod end
if healneed > ( 330+healMod30*PF18)*K*shMod and ManaLeft >= 155*ihMod and maxRankH >=1 and downRankNH >= 4 and SpellIDsH[1] then SpellID = SpellIDsH[1] ; HealSize = ( 330+healMod30*PF18)*shMod end
if healneed > ( 476+healMod30 )*K*shMod and ManaLeft >= 205*ihMod and maxRankH >=2 and downRankNH >= 5 and SpellIDsH[2] then SpellID = SpellIDsH[2] ; HealSize = ( 476+healMod30 )*shMod end
if healneed > ( 624+healMod30 )*K*shMod and ManaLeft >= 255*ihMod and maxRankH >=3 and downRankNH >= 6 and SpellIDsH[3] then SpellID = SpellIDsH[3] ; HealSize = ( 624+healMod30 )*shMod end
if healneed > ( 667+healMod30 )*K*shMod and ManaLeft >= 305*ihMod and maxRankH >=4 and downRankNH >= 7 and SpellIDsH[4] then SpellID = SpellIDsH[4] ; HealSize = ( 667+healMod30 )*shMod end
if healneed > ( 838+healMod30 )*K*shMod and ManaLeft >= 370*ihMod and maxRankGH >=1 and downRankNH >= 8 and SpellIDsGH[1] then SpellID = SpellIDsGH[1]; HealSize = ( 838+healMod30 )*shMod end
if healneed > (1066+healMod30 )*K*shMod and ManaLeft >= 455*ihMod and maxRankGH >=2 and downRankNH >= 9 and SpellIDsGH[2] then SpellID = SpellIDsGH[2]; HealSize = (1066+healMod30 )*shMod end
if healneed > (1328+healMod30 )*K*shMod and ManaLeft >= 545*ihMod and maxRankGH >=3 and downRankNH >= 10 and SpellIDsGH[3] then SpellID = SpellIDsGH[3]; HealSize = (1328+healMod30 )*shMod end
if healneed > (1632+healMod30 )*K*shMod and ManaLeft >= 655*ihMod and maxRankGH >=4 and downRankNH >= 11 and SpellIDsGH[4] then SpellID = SpellIDsGH[4]; HealSize = (1632+healMod30 )*shMod end
if healneed > (1768+healMod30 )*K*shMod and ManaLeft >= 710*ihMod and maxRankGH >=5 and downRankNH >= 12 and SpellIDsGH[5] then SpellID = SpellIDsGH[5]; HealSize = (1768+healMod30 )*shMod end
end
elseif not forceMaxHPS then
-- In combat and target is unhealthy and player has flash heal
QuickHeal_debug(string.format("In combat and target unhealthy and player has flash heal, will only use FH"));
if Health < QuickHealVariables.RatioFull then
SpellID = SpellIDsFH[1]; HealSize = (225+healMod15)*shMod; -- Default to FH
if healneed > (297*shMod+healMod15)*k and ManaLeft >= 155 and maxRankFH >=2 and downRankFH >= 2 and SpellIDsFH[2] then SpellID = SpellIDsFH[2]; HealSize = (297+healMod15)*shMod end
if healneed > (319*shMod+healMod15)*k and ManaLeft >= 185 and maxRankFH >=3 and downRankFH >= 3 and SpellIDsFH[3] then SpellID = SpellIDsFH[3]; HealSize = (319+healMod15)*shMod end
if healneed > (387*shMod+healMod15)*k and ManaLeft >= 215 and maxRankFH >=4 and downRankFH >= 4 and SpellIDsFH[4] then SpellID = SpellIDsFH[4]; HealSize = (387+healMod15)*shMod end
if healneed > (498*shMod+healMod15)*k and ManaLeft >= 265 and maxRankFH >=5 and downRankFH >= 5 and SpellIDsFH[5] then SpellID = SpellIDsFH[5]; HealSize = (498+healMod15)*shMod end
if healneed > (618*shMod+healMod15)*k and ManaLeft >= 315 and maxRankFH >=6 and downRankFH >= 6 and SpellIDsFH[6] then SpellID = SpellIDsFH[6]; HealSize = (618+healMod15)*shMod end
if healneed > (769*shMod+healMod15)*k and ManaLeft >= 380 and maxRankFH >=7 and downRankFH >= 7 and SpellIDsFH[7] then SpellID = SpellIDsFH[7]; HealSize = (769+healMod15)*shMod end
end
elseif forceMaxHPS then
if ManaLeft >= 155 and maxRankFH >=2 and downRankFH >= 2 and SpellIDsFH[2] then SpellID = SpellIDsFH[2]; HealSize = (297+healMod15)*shMod end
if ManaLeft >= 185 and maxRankFH >=3 and downRankFH >= 3 and SpellIDsFH[3] then SpellID = SpellIDsFH[3]; HealSize = (319+healMod15)*shMod end
if ManaLeft >= 215 and maxRankFH >=4 and downRankFH >= 4 and SpellIDsFH[4] then SpellID = SpellIDsFH[4]; HealSize = (387+healMod15)*shMod end
if ManaLeft >= 265 and maxRankFH >=5 and downRankFH >= 5 and SpellIDsFH[5] then SpellID = SpellIDsFH[5]; HealSize = (498+healMod15)*shMod end
if ManaLeft >= 315 and maxRankFH >=6 and downRankFH >= 6 and SpellIDsFH[6] then SpellID = SpellIDsFH[6]; HealSize = (618+healMod15)*shMod end
if ManaLeft >= 380 and maxRankFH >=7 and downRankFH >= 7 and SpellIDsFH[7] then SpellID = SpellIDsFH[7]; HealSize = (769+healMod15)*shMod end
end
end
return SpellID,HealSize*HDB;
end
function QuickHeal_Priest_FindHealSpellToUseNoTarget(maxhealth, healDeficit, healType, multiplier, forceMaxHPS, forceMaxRank, hdb, incombat)
local SpellID = nil;
local HealSize = 0;
local Overheal = false;
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
-- +Healing-PenaltyFactor = (1-((20-LevelLearnt)*0.0375)) for all spells learnt before level 20
local PF1 = 0.2875;
local PF4 = 0.4;
local PF10 = 0.625;
local PF18 = 0.925;
-- 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"));
QuickHeal_debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Spiritual Guidance - Increases spell damage and healing by up to 5% (per rank) of your total Spirit.
local _,_,_,_,talentRank,_ = GetTalentInfo(2,12);
local _,Spirit,_,_ = UnitStat('player',5);
local sgMod = Spirit * 5*talentRank/100;
QuickHeal_debug(string.format("Spiritual Guidance Bonus: %f", sgMod));
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * (sgMod + Bonus);
local healMod20 = (2.0/3.5) * (sgMod + Bonus);
local healMod25 = (2.5/3.5) * (sgMod + Bonus);
local healMod30 = (3.0/3.5) * (sgMod + Bonus);
QuickHeal_debug("Final Healing Bonus (1.5,2.0,2.5,3.0)", healMod15,healMod20,healMod25,healMod30);
local InCombat = UnitAffectingCombat('player') or incombat;
-- Spiritual Healing - Increases healing by 6% per rank on all spells
local _,_,_,_,talentRank,_ = GetTalentInfo(2,15);
local shMod = 6*talentRank/100 + 1;
QuickHeal_debug(string.format("Spiritual Healing modifier: %f", shMod));
-- Improved Healing - Decreases mana usage by 5% per rank on LH,H and GH
local _,_,_,_,talentRank,_ = GetTalentInfo(2,11);
local ihMod = 1 - 5*talentRank/100;
QuickHeal_debug(string.format("Improved Healing modifier: %f", ihMod));
local TargetIsHealthy = Health >= QuickHealVariables.RatioHealthyPriest;
local ManaLeft = UnitMana('player');
if TargetIsHealthy then
QuickHeal_debug("Target is healthy",Health);
end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
QuickHeal_debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-- Detect Inner Focus or Spirit of Redemption (hack ManaLeft and healneed)
if QuickHeal_DetectBuff('player',"Spell_Frost_WindWalkOn",1) or QuickHeal_DetectBuff('player',"Spell_Holy_GreaterHeal") then
QuickHeal_debug("Inner Focus or Spirit of Redemption active");
ManaLeft = UnitManaMax('player'); -- Infinite mana
healneed = 10^6; -- Deliberate overheal (mana is free)
end
-- Get total healing modifier (factor) caused by healing target debuffs
--local HDB = QuickHeal_GetHealModifier(Target);
--QuickHeal_debug("Target debuff healing modifier",HDB);
healneed = healneed/hdb;
-- Get a list of ranks available for all spells
local SpellIDsLH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_LESSER_HEAL);
local SpellIDsH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_HEAL);
local SpellIDsGH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_GREATER_HEAL);
local SpellIDsFH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_FLASH_HEAL);
local SpellIDsR = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_RENEW);
local maxRankLH = table.getn(SpellIDsLH);
local maxRankH = table.getn(SpellIDsH);
local maxRankGH = table.getn(SpellIDsGH);
local maxRankFH = table.getn(SpellIDsFH);
local maxRankR = table.getn(SpellIDsR);
QuickHeal_debug(string.format("Found LH up to rank %d, H up top rank %d, GH up to rank %d, FH up to rank %d, and R up to max rank %d", maxRankLH, maxRankH, maxRankGH, maxRankFH, maxRankR));
--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 not forceMaxHPS then
SpellID = SpellIDsLH[1]; HealSize = (53+healMod15*PF1)*shMod; -- Default to LH
if healneed > ( 84+healMod20*PF4 )*k*shMod and ManaLeft >= 45*ihMod and maxRankLH >=2 and downRankNH >= 2 and SpellIDsLH[2] then SpellID = SpellIDsLH[2]; HealSize = ( 84+healMod20*PF4 )*shMod end
if healneed > ( 154+healMod25*PF10)*K*shMod and ManaLeft >= 75*ihMod and maxRankLH >=3 and downRankNH >= 3 and SpellIDsLH[3] then SpellID = SpellIDsLH[3]; HealSize = ( 154+healMod25*PF10)*shMod end
if healneed > ( 330+healMod30*PF18)*K*shMod and ManaLeft >= 155*ihMod and maxRankH >=1 and downRankNH >= 4 and SpellIDsH[1] then SpellID = SpellIDsH[1] ; HealSize = ( 330+healMod30*PF18)*shMod end
if healneed > ( 476+healMod30 )*K*shMod and ManaLeft >= 205*ihMod and maxRankH >=2 and downRankNH >= 5 and SpellIDsH[2] then SpellID = SpellIDsH[2] ; HealSize = ( 476+healMod30 )*shMod end
if healneed > ( 624+healMod30 )*K*shMod and ManaLeft >= 255*ihMod and maxRankH >=3 and downRankNH >= 6 and SpellIDsH[3] then SpellID = SpellIDsH[3] ; HealSize = ( 624+healMod30 )*shMod end
if healneed > ( 667+healMod30 )*K*shMod and ManaLeft >= 305*ihMod and maxRankH >=4 and downRankNH >= 7 and SpellIDsH[4] then SpellID = SpellIDsH[4] ; HealSize = ( 667+healMod30 )*shMod end
if healneed > ( 838+healMod30 )*K*shMod and ManaLeft >= 370*ihMod and maxRankGH >=1 and downRankNH >= 8 and SpellIDsGH[1] then SpellID = SpellIDsGH[1]; HealSize = ( 838+healMod30 )*shMod end
if healneed > (1066+healMod30 )*K*shMod and ManaLeft >= 455*ihMod and maxRankGH >=2 and downRankNH >= 9 and SpellIDsGH[2] then SpellID = SpellIDsGH[2]; HealSize = (1066+healMod30 )*shMod end
if healneed > (1328+healMod30 )*K*shMod and ManaLeft >= 545*ihMod and maxRankGH >=3 and downRankNH >= 10 and SpellIDsGH[3] then SpellID = SpellIDsGH[3]; HealSize = (1328+healMod30 )*shMod end
if healneed > (1632+healMod30 )*K*shMod and ManaLeft >= 655*ihMod and maxRankGH >=4 and downRankNH >= 11 and SpellIDsGH[4] then SpellID = SpellIDsGH[4]; HealSize = (1632+healMod30 )*shMod end
if healneed > (1768+healMod30 )*K*shMod and ManaLeft >= 710*ihMod and maxRankGH >=5 and downRankNH >= 12 and SpellIDsGH[5] then SpellID = SpellIDsGH[5]; HealSize = (1768+healMod30 )*shMod end
else
SpellID = SpellIDsFH[1]; HealSize = (225+healMod15)*shMod; -- Default to FH
if healneed > (297+healMod15)*k*shMod and ManaLeft >= 155 and maxRankFH >=2 and downRankFH >= 2 and SpellIDsFH[2] then SpellID = SpellIDsFH[2]; HealSize = (297+healMod15)*shMod end
if healneed > (319+healMod15)*k*shMod and ManaLeft >= 185 and maxRankFH >=3 and downRankFH >= 3 and SpellIDsFH[3] then SpellID = SpellIDsFH[3]; HealSize = (319+healMod15)*shMod end
if healneed > (387+healMod15)*k*shMod and ManaLeft >= 215 and maxRankFH >=4 and downRankFH >= 4 and SpellIDsFH[4] then SpellID = SpellIDsFH[4]; HealSize = (387+healMod15)*shMod end
if healneed > (498+healMod15)*k*shMod and ManaLeft >= 265 and maxRankFH >=5 and downRankFH >= 5 and SpellIDsFH[5] then SpellID = SpellIDsFH[5]; HealSize = (498+healMod15)*shMod end
if healneed > (618+healMod15)*k*shMod and ManaLeft >= 315 and maxRankFH >=6 and downRankFH >= 6 and SpellIDsFH[6] then SpellID = SpellIDsFH[6]; HealSize = (618+healMod15)*shMod end
if healneed > (769+healMod15)*k*shMod and ManaLeft >= 380 and maxRankFH >=7 and downRankFH >= 7 and SpellIDsFH[7] then SpellID = SpellIDsFH[7]; HealSize = (769+healMod15)*shMod end
end
return SpellID,HealSize*hdb;
end
function QuickHeal_Priest_FindHoTSpellToUse(Target, healType, forceMaxRank)
local SpellID = nil;
local HealSize = 0;
-- Return immediatly if no player needs healing
if not Target then
return SpellID,HealSize;
end
-- +Healing-PenaltyFactor = (1-((20-LevelLearnt)*0.0375)) for all spells learnt before level 20
local PF1 = 0.2875;
local PF4 = 0.4;
local PF10 = 0.625;
local PF18 = 0.925;
-- Determine health and healneed of target
local healneed;
local Health;
if QuickHeal_UnitHasHealthInfo(Target) then
-- Full info available
healneed = UnitHealthMax(Target) - UnitHealth(Target) - HealComm:getHeal(UnitName(Target)); -- Implementatin for HealComm
Health = UnitHealth(Target) / UnitHealthMax(Target);
else
-- Estimate target health
healneed = QuickHeal_EstimateUnitHealNeed(Target,true); -- needs HealComm implementation maybe
Health = UnitHealth(Target)/100;
end
-- if BonusScanner is running, get +Healing bonus
local Bonus = 0;
if (BonusScanner) then
Bonus = tonumber(BonusScanner:GetBonus("HEAL"));
QuickHeal_debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Spiritual Guidance - Increases spell damage and healing by up to 5% (per rank) of your total Spirit.
local _,_,_,_,talentRank,_ = GetTalentInfo(2,12);
local _,Spirit,_,_ = UnitStat('player',5);
local sgMod = Spirit * 5*talentRank/100;
QuickHeal_debug(string.format("Spiritual Guidance Bonus: %f", sgMod));
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * (sgMod + Bonus);
local healMod20 = (2.0/3.5) * (sgMod + Bonus);
local healMod25 = (2.5/3.5) * (sgMod + Bonus);
local healMod30 = (3.0/3.5) * (sgMod + Bonus);
QuickHeal_debug("Final Healing Bonus (1.5,2.0,2.5,3.0)", healMod15,healMod20,healMod25,healMod30);
local InCombat = UnitAffectingCombat('player') or UnitAffectingCombat(Target);
-- Spiritual Healing - Increases healing by 6% per rank on all spells
local _,_,_,_,talentRank,_ = GetTalentInfo(2,15);
local shMod = 6*talentRank/100 + 1;
QuickHeal_debug(string.format("Spiritual Healing modifier: %f", shMod));
-- Improved Healing - Decreases mana usage by 5% per rank on LH,H and GH
local _,_,_,_,talentRank,_ = GetTalentInfo(2,11);
local ihMod = 1 - 5*talentRank/100;
QuickHeal_debug(string.format("Improved Healing modifier: %f", ihMod));
local TargetIsHealthy = Health >= QuickHealVariables.RatioHealthyPriest;
local ManaLeft = UnitMana('player');
if TargetIsHealthy then
QuickHeal_debug("Target is healthy",Health);
end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
QuickHeal_debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-- Detect Inner Focus or Spirit of Redemption (hack ManaLeft and healneed)
if QuickHeal_DetectBuff('player',"Spell_Frost_WindWalkOn",1) or QuickHeal_DetectBuff('player',"Spell_Holy_GreaterHeal") then
QuickHeal_debug("Inner Focus or Spirit of Redemption active");
ManaLeft = UnitManaMax('player'); -- Infinite mana
healneed = 10^6; -- Deliberate overheal (mana is free)
end
-- Get total healing modifier (factor) caused by healing target debuffs
local HDB = QuickHeal_GetHealModifier(Target);
QuickHeal_debug("Target debuff healing modifier",HDB);
healneed = healneed/HDB;
-- Get a list of ranks available for all spells
local SpellIDsLH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_LESSER_HEAL);
local SpellIDsH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_HEAL);
local SpellIDsGH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_GREATER_HEAL);
local SpellIDsFH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_FLASH_HEAL);
local SpellIDsR = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_RENEW);
local maxRankLH = table.getn(SpellIDsLH);
local maxRankH = table.getn(SpellIDsH);
local maxRankGH = table.getn(SpellIDsGH);
local maxRankFH = table.getn(SpellIDsFH);
local maxRankR = table.getn(SpellIDsR);
QuickHeal_debug(string.format("Found LH up to rank %d, H up top rank %d, GH up to rank %d, FH up to rank %d, and R up to max rank %d", maxRankLH, maxRankH, maxRankGH, maxRankFH, maxRankR));
--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 healType = channel
jgpprint(healType)
if healType == "channel" then
jgpprint("CHANNEL HEAL: " .. healType)
-- Find suitable SpellID based on the defined criteria
if not InCombat or TargetIsHealthy or maxRankFH<1 then
-- Not in combat or target is healthy so use the closest available mana efficient healing
QuickHeal_debug(string.format("Not in combat or target healthy or no flash heal available, will use closest available LH, H or GH (not FH)"))
if Health < QuickHealVariables.RatioFull then
SpellID = SpellIDsLH[1]; HealSize = (53+healMod15*PF1)*shMod; -- Default to LH
if healneed > ( 84+healMod20*PF4 )*k*shMod and ManaLeft >= 45*ihMod and maxRankLH >=2 and downRankNH >= 2 and SpellIDsLH[2] then SpellID = SpellIDsLH[2]; HealSize = ( 84+healMod20*PF4 )*shMod end
if healneed > ( 154+healMod25*PF10)*K*shMod and ManaLeft >= 75*ihMod and maxRankLH >=3 and downRankNH >= 3 and SpellIDsLH[3] then SpellID = SpellIDsLH[3]; HealSize = ( 154+healMod25*PF10)*shMod end
if healneed > ( 330+healMod30*PF18)*K*shMod and ManaLeft >= 155*ihMod and maxRankH >=1 and downRankNH >= 4 and SpellIDsH[1] then SpellID = SpellIDsH[1] ; HealSize = ( 330+healMod30*PF18)*shMod end
if healneed > ( 476+healMod30 )*K*shMod and ManaLeft >= 205*ihMod and maxRankH >=2 and downRankNH >= 5 and SpellIDsH[2] then SpellID = SpellIDsH[2] ; HealSize = ( 476+healMod30 )*shMod end
if healneed > ( 624+healMod30 )*K*shMod and ManaLeft >= 255*ihMod and maxRankH >=3 and downRankNH >= 6 and SpellIDsH[3] then SpellID = SpellIDsH[3] ; HealSize = ( 624+healMod30 )*shMod end
if healneed > ( 667+healMod30 )*K*shMod and ManaLeft >= 305*ihMod and maxRankH >=4 and downRankNH >= 7 and SpellIDsH[4] then SpellID = SpellIDsH[4] ; HealSize = ( 667+healMod30 )*shMod end
if healneed > ( 838+healMod30 )*K*shMod and ManaLeft >= 370*ihMod and maxRankGH >=1 and downRankNH >= 8 and SpellIDsGH[1] then SpellID = SpellIDsGH[1]; HealSize = ( 838+healMod30 )*shMod end
if healneed > (1066+healMod30 )*K*shMod and ManaLeft >= 455*ihMod and maxRankGH >=2 and downRankNH >= 9 and SpellIDsGH[2] then SpellID = SpellIDsGH[2]; HealSize = (1066+healMod30 )*shMod end
if healneed > (1328+healMod30 )*K*shMod and ManaLeft >= 545*ihMod and maxRankGH >=3 and downRankNH >= 10 and SpellIDsGH[3] then SpellID = SpellIDsGH[3]; HealSize = (1328+healMod30 )*shMod end
if healneed > (1632+healMod30 )*K*shMod and ManaLeft >= 655*ihMod and maxRankGH >=4 and downRankNH >= 11 and SpellIDsGH[4] then SpellID = SpellIDsGH[4]; HealSize = (1632+healMod30 )*shMod end
if healneed > (1768+healMod30 )*K*shMod and ManaLeft >= 710*ihMod and maxRankGH >=5 and downRankNH >= 12 and SpellIDsGH[5] then SpellID = SpellIDsGH[5]; HealSize = (1768+healMod30 )*shMod end
end
else
-- In combat and target is unhealthy and player has flash heal
QuickHeal_debug(string.format("In combat and target unhealthy and player has flash heal, will only use FH"));
if Health < QuickHealVariables.RatioFull then
SpellID = SpellIDsFH[1]; HealSize = (225+healMod15)*shMod; -- Default to FH
if healneed > (297+healMod15)*k*shMod and ManaLeft >= 155 and maxRankFH >=2 and downRankFH >= 2 and SpellIDsFH[2] then SpellID = SpellIDsFH[2]; HealSize = (297+healMod15)*shMod end
if healneed > (319+healMod15)*k*shMod and ManaLeft >= 185 and maxRankFH >=3 and downRankFH >= 3 and SpellIDsFH[3] then SpellID = SpellIDsFH[3]; HealSize = (319+healMod15)*shMod end
if healneed > (387+healMod15)*k*shMod and ManaLeft >= 215 and maxRankFH >=4 and downRankFH >= 4 and SpellIDsFH[4] then SpellID = SpellIDsFH[4]; HealSize = (387+healMod15)*shMod end
if healneed > (498+healMod15)*k*shMod and ManaLeft >= 265 and maxRankFH >=5 and downRankFH >= 5 and SpellIDsFH[5] then SpellID = SpellIDsFH[5]; HealSize = (498+healMod15)*shMod end
if healneed > (618+healMod15)*k*shMod and ManaLeft >= 315 and maxRankFH >=6 and downRankFH >= 6 and SpellIDsFH[6] then SpellID = SpellIDsFH[6]; HealSize = (618+healMod15)*shMod end
if healneed > (769+healMod15)*k*shMod and ManaLeft >= 380 and maxRankFH >=7 and downRankFH >= 7 and SpellIDsFH[7] then SpellID = SpellIDsFH[7]; HealSize = (769+healMod15)*shMod end
end
end
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 = SpellIDsR[1]; HealSize = (45+healMod15)*shMod; -- Default to Renew(Rank 1)
if healneed > (100+healMod15)*k*shMod and ManaLeft >= 155 and maxRankR >=2 and SpellIDsR[2] then SpellID = SpellIDsR[2]; HealSize = (100+healMod15)*shMod end
if healneed > (175+healMod15)*k*shMod and ManaLeft >= 185 and maxRankR >=3 and SpellIDsR[3] then SpellID = SpellIDsR[3]; HealSize = (175+healMod15)*shMod end
if healneed > (245+healMod15)*k*shMod and ManaLeft >= 215 and maxRankR >=4 and SpellIDsR[4] then SpellID = SpellIDsR[4]; HealSize = (245+healMod15)*shMod end
if healneed > (270+healMod15)*k*shMod and ManaLeft >= 265 and maxRankR >=5 and SpellIDsR[5] then SpellID = SpellIDsR[5]; HealSize = (270+healMod15)*shMod end
if healneed > (340+healMod15)*k*shMod and ManaLeft >= 315 and maxRankR >=6 and SpellIDsR[6] then SpellID = SpellIDsR[6]; HealSize = (340+healMod15)*shMod end
if healneed > (435+healMod15)*k*shMod and ManaLeft >= 380 and maxRankR >=7 and SpellIDsR[7] then SpellID = SpellIDsR[7]; HealSize = (435+healMod15)*shMod end
if healneed > (555+healMod15)*k*shMod and ManaLeft >= 455 and maxRankR >=8 and SpellIDsR[8] then SpellID = SpellIDsR[8]; HealSize = (555+healMod15)*shMod end
if healneed > (690+healMod15)*k*shMod and ManaLeft >= 545 and maxRankR >=9 and SpellIDsR[9] then SpellID = SpellIDsR[9]; HealSize = (690+healMod15)*shMod end
if healneed > (825+healMod15)*k*shMod and ManaLeft >= 655 and maxRankR >=10 and SpellIDsR[10] then SpellID = SpellIDsR[10]; HealSize = (825+healMod15)*shMod end
else
SpellID = SpellIDsR[10]; HealSize = (825+healMod15)*shMod
if maxRankR >=2 and SpellIDsR[2] then SpellID = SpellIDsR[2]; HealSize = (100+healMod15)*shMod end
if maxRankR >=3 and SpellIDsR[3] then SpellID = SpellIDsR[3]; HealSize = (175+healMod15)*shMod end
if maxRankR >=4 and SpellIDsR[4] then SpellID = SpellIDsR[4]; HealSize = (245+healMod15)*shMod end
if maxRankR >=5 and SpellIDsR[5] then SpellID = SpellIDsR[5]; HealSize = (270+healMod15)*shMod end
if maxRankR >=6 and SpellIDsR[6] then SpellID = SpellIDsR[6]; HealSize = (340+healMod15)*shMod end
if maxRankR >=7 and SpellIDsR[7] then SpellID = SpellIDsR[7]; HealSize = (435+healMod15)*shMod end
if maxRankR >=8 and SpellIDsR[8] then SpellID = SpellIDsR[8]; HealSize = (555+healMod15)*shMod end
if maxRankR >=9 and SpellIDsR[9] then SpellID = SpellIDsR[9]; HealSize = (690+healMod15)*shMod end
if maxRankR >=10 and SpellIDsR[10] then SpellID = SpellIDsR[10]; HealSize = (825+healMod15)*shMod end
end
--end
end
return SpellID,HealSize*HDB;
end
function QuickHeal_Priest_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 PF4 = 0.4;
local PF10 = 0.625;
local PF18 = 0.925;
-- 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"));
QuickHeal_debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Spiritual Guidance - Increases spell damage and healing by up to 5% (per rank) of your total Spirit.
local _,_,_,_,talentRank,_ = GetTalentInfo(2,12);
local _,Spirit,_,_ = UnitStat('player',5);
local sgMod = Spirit * 5*talentRank/100;
QuickHeal_debug(string.format("Spiritual Guidance Bonus: %f", sgMod));
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * (sgMod + Bonus);
local healMod20 = (2.0/3.5) * (sgMod + Bonus);
local healMod25 = (2.5/3.5) * (sgMod + Bonus);
local healMod30 = (3.0/3.5) * (sgMod + Bonus);
QuickHeal_debug("Final Healing Bonus (1.5,2.0,2.5,3.0)", healMod15,healMod20,healMod25,healMod30);
local InCombat = UnitAffectingCombat('player') or incombat;
-- Spiritual Healing - Increases healing by 6% per rank on all spells
local _,_,_,_,talentRank,_ = GetTalentInfo(2,15);
local shMod = 6*talentRank/100 + 1;
QuickHeal_debug(string.format("Spiritual Healing modifier: %f", shMod));
-- Improved Healing - Decreases mana usage by 5% per rank on LH,H and GH
local _,_,_,_,talentRank,_ = GetTalentInfo(2,11);
local ihMod = 1 - 5*talentRank/100;
QuickHeal_debug(string.format("Improved Healing modifier: %f", ihMod));
local TargetIsHealthy = Health >= QuickHealVariables.RatioHealthyPriest;
local ManaLeft = UnitMana('player');
if TargetIsHealthy then
QuickHeal_debug("Target is healthy",Health);
end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
QuickHeal_debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-- Detect Inner Focus or Spirit of Redemption (hack ManaLeft and healneed)
if QuickHeal_DetectBuff('player',"Spell_Frost_WindWalkOn",1) or QuickHeal_DetectBuff('player',"Spell_Holy_GreaterHeal") then
QuickHeal_debug("Inner Focus or Spirit of Redemption active");
ManaLeft = UnitManaMax('player'); -- Infinite mana
healneed = 10^6; -- Deliberate overheal (mana is free)
end
-- Get total healing modifier (factor) caused by healing target debuffs
--local HDB = QuickHeal_GetHealModifier(Target);
--QuickHeal_debug("Target debuff healing modifier",HDB);
healneed = healneed/hdb;
-- if forceMaxRank, feed it an obnoxiously large heal requirement
--if forceMaxRank then
-- print('lollololool');
-- healneed = 10000;
--end
-- Get a list of ranks available for all spells
local SpellIDsLH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_LESSER_HEAL);
local SpellIDsH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_HEAL);
local SpellIDsGH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_GREATER_HEAL);
local SpellIDsFH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_FLASH_HEAL);
local SpellIDsR = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_RENEW);
local maxRankLH = table.getn(SpellIDsLH);
local maxRankH = table.getn(SpellIDsH);
local maxRankGH = table.getn(SpellIDsGH);
local maxRankFH = table.getn(SpellIDsFH);
local maxRankR = table.getn(SpellIDsR);
QuickHeal_debug(string.format("Found LH up to rank %d, H up top rank %d, GH up to rank %d, FH up to rank %d, and R up to max rank %d", maxRankLH, maxRankH, maxRankGH, maxRankFH, maxRankR));
--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
SpellID = SpellIDsR[1]; HealSize = (45+healMod15)*shMod; -- Default to Renew(Rank 1)
if healneed > (100+healMod15)*k*shMod and ManaLeft >= 155 and maxRankR >=2 and SpellIDsR[2] then SpellID = SpellIDsR[2]; HealSize = (100+healMod15)*shMod end
if healneed > (175+healMod15)*k*shMod and ManaLeft >= 185 and maxRankR >=3 and SpellIDsR[3] then SpellID = SpellIDsR[3]; HealSize = (175+healMod15)*shMod end
if healneed > (245+healMod15)*k*shMod and ManaLeft >= 215 and maxRankR >=4 and SpellIDsR[4] then SpellID = SpellIDsR[4]; HealSize = (245+healMod15)*shMod end
if healneed > (270+healMod15)*k*shMod and ManaLeft >= 265 and maxRankR >=5 and SpellIDsR[5] then SpellID = SpellIDsR[5]; HealSize = (270+healMod15)*shMod end
if healneed > (340+healMod15)*k*shMod and ManaLeft >= 315 and maxRankR >=6 and SpellIDsR[6] then SpellID = SpellIDsR[6]; HealSize = (340+healMod15)*shMod end
if healneed > (435+healMod15)*k*shMod and ManaLeft >= 380 and maxRankR >=7 and SpellIDsR[7] then SpellID = SpellIDsR[7]; HealSize = (435+healMod15)*shMod end
if healneed > (555+healMod15)*k*shMod and ManaLeft >= 455 and maxRankR >=8 and SpellIDsR[8] then SpellID = SpellIDsR[8]; HealSize = (555+healMod15)*shMod end
if healneed > (690+healMod15)*k*shMod and ManaLeft >= 545 and maxRankR >=9 and SpellIDsR[9] then SpellID = SpellIDsR[9]; HealSize = (690+healMod15)*shMod end
if healneed > (825+healMod15)*k*shMod and ManaLeft >= 655 and maxRankR >=10 and SpellIDsR[10] then SpellID = SpellIDsR[10]; HealSize = (825+healMod15)*shMod end
return SpellID,HealSize*hdb;
end
function QuickHealSpellID(healneed)
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 PF4 = 0.4;
local PF10 = 0.625;
local PF18 = 0.925;
-- Determine health and healneed of target
--local healneed;
--local Health;
--if QuickHeal_UnitHasHealthInfo(Target) then
-- -- Full info available
-- healneed = UnitHealthMax(Target) - UnitHealth(Target) - HealComm:getHeal(UnitName(Target)); -- Implementatin for HealComm
--
-- Health = UnitHealth(Target) / UnitHealthMax(Target);
--else
-- -- Estimate target health
-- healneed = QuickHeal_EstimateUnitHealNeed(Target,true); -- needs HealComm implementation maybe
--
-- Health = UnitHealth(Target)/100;
--end
-- if BonusScanner is running, get +Healing bonus
local Bonus = 0;
if (BonusScanner) then
Bonus = tonumber(BonusScanner:GetBonus("HEAL"));
QuickHeal_debug(string.format("Equipment Healing Bonus: %d", Bonus));
end
-- Spiritual Guidance - Increases spell damage and healing by up to 5% (per rank) of your total Spirit.
local _,_,_,_,talentRank,_ = GetTalentInfo(2,12);
local _,Spirit,_,_ = UnitStat('player',5);
local sgMod = Spirit * 5*talentRank/100;
QuickHeal_debug(string.format("Spiritual Guidance Bonus: %f", sgMod));
-- Calculate healing bonus
local healMod15 = (1.5/3.5) * (sgMod + Bonus);
local healMod20 = (2.0/3.5) * (sgMod + Bonus);
local healMod25 = (2.5/3.5) * (sgMod + Bonus);
local healMod30 = (3.0/3.5) * (sgMod + Bonus);
QuickHeal_debug("Final Healing Bonus (1.5,2.0,2.5,3.0)", healMod15,healMod20,healMod25,healMod30);
local InCombat = UnitAffectingCombat('player');
-- Spiritual Healing - Increases healing by 6% per rank on all spells
local _,_,_,_,talentRank,_ = GetTalentInfo(2,15);
local shMod = 6*talentRank/100 + 1;
QuickHeal_debug(string.format("Spiritual Healing modifier: %f", shMod));
-- Improved Healing - Decreases mana usage by 5% per rank on LH,H and GH
local _,_,_,_,talentRank,_ = GetTalentInfo(2,11);
local ihMod = 1 - 5*talentRank/100;
QuickHeal_debug(string.format("Improved Healing modifier: %f", ihMod));
local ManaLeft = UnitMana('player');
--if TargetIsHealthy then
-- QuickHeal_debug("Target is healthy",Health);
--end
-- Detect proc of 'Hand of Edward the Odd' mace (next spell is instant cast)
if QuickHeal_DetectBuff('player',"Spell_Holy_SearingLight") then
--QuickHeal_debug("BUFF: Hand of Edward the Odd (out of combat healing forced)");
InCombat = false;
end
-- Detect Inner Focus or Spirit of Redemption (hack ManaLeft and healneed)
if QuickHeal_DetectBuff('player',"Spell_Frost_WindWalkOn",1) or QuickHeal_DetectBuff('player',"Spell_Holy_GreaterHeal") then
--QuickHeal_debug("Inner Focus or Spirit of Redemption active");
ManaLeft = UnitManaMax('player'); -- Infinite mana
healneed = 10^6; -- Deliberate overheal (mana is free)
end
-- Get a list of ranks available for all spells
local SpellIDsLH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_LESSER_HEAL);
local SpellIDsH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_HEAL);
local SpellIDsGH = QuickHeal_GetSpellIDs(QUICKHEAL_SPELL_GREATER_HEAL);
local maxRankLH = table.getn(SpellIDsLH);
local maxRankH = table.getn(SpellIDsH);
local maxRankGH = table.getn(SpellIDsGH);
--QuickHeal_debug(string.format("Found LH up to rank %d, H up top rank %d, GH up to rank %d, FH up to rank %d, and R up to max rank %d", maxRankLH, maxRankH, maxRankGH, maxRankFH, maxRankR));
-- 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 healType = channel
--jgpprint(healType)
SpellID = SpellIDsLH[1]; HealSize = (53+healMod15*PF1)*shMod; -- Default to LH
if healneed > ( 84+healMod20*PF4 )*k*shMod and ManaLeft >= 45*ihMod and maxRankLH >=2 and SpellIDsLH[2] then SpellID = SpellIDsLH[2]; HealSize = ( 84+healMod20*PF4 )*shMod end
if healneed > ( 154+healMod25*PF10)*K*shMod and ManaLeft >= 75*ihMod and maxRankLH >=3 and SpellIDsLH[3] then SpellID = SpellIDsLH[3]; HealSize = ( 154+healMod25*PF10)*shMod end
if healneed > ( 330+healMod30*PF18)*K*shMod and ManaLeft >= 155*ihMod and maxRankH >=1 and SpellIDsH[1] then SpellID = SpellIDsH[1] ; HealSize = ( 330+healMod30*PF18)*shMod end
if healneed > ( 476+healMod30 )*K*shMod and ManaLeft >= 205*ihMod and maxRankH >=2 and SpellIDsH[2] then SpellID = SpellIDsH[2] ; HealSize = ( 476+healMod30 )*shMod end
if healneed > ( 624+healMod30 )*K*shMod and ManaLeft >= 255*ihMod and maxRankH >=3 and SpellIDsH[3] then SpellID = SpellIDsH[3] ; HealSize = ( 624+healMod30 )*shMod end
if healneed > ( 667+healMod30 )*K*shMod and ManaLeft >= 305*ihMod and maxRankH >=4 and SpellIDsH[4] then SpellID = SpellIDsH[4] ; HealSize = ( 667+healMod30 )*shMod end
if healneed > ( 838+healMod30 )*K*shMod and ManaLeft >= 370*ihMod and maxRankGH >=1 and SpellIDsGH[1] then SpellID = SpellIDsGH[1]; HealSize = ( 838+healMod30 )*shMod end
if healneed > (1066+healMod30 )*K*shMod and ManaLeft >= 455*ihMod and maxRankGH >=2 and SpellIDsGH[2] then SpellID = SpellIDsGH[2]; HealSize = (1066+healMod30 )*shMod end
if healneed > (1328+healMod30 )*K*shMod and ManaLeft >= 545*ihMod and maxRankGH >=3 and SpellIDsGH[3] then SpellID = SpellIDsGH[3]; HealSize = (1328+healMod30 )*shMod end
if healneed > (1632+healMod30 )*K*shMod and ManaLeft >= 655*ihMod and maxRankGH >=4 and SpellIDsGH[4] then SpellID = SpellIDsGH[4]; HealSize = (1632+healMod30 )*shMod end
if healneed > (1768+healMod30 )*K*shMod and ManaLeft >= 710*ihMod and maxRankGH >=5 and SpellIDsGH[5] then SpellID = SpellIDsGH[5]; HealSize = (1768+healMod30 )*shMod end
--return SpellID;
-- Get spell info
local SpellName, SpellRank = GetSpellName(SpellID, BOOKTYPE_SPELL);
if SpellRank == "" then
SpellRank = nil
end
local SpellNameAndRank = SpellName .. (SpellRank and " (" .. SpellRank .. ")" or "");
QuickHeal_debug(" Casting: " .. SpellNameAndRank .. " on " .. " NOPE " .. ", ID: " .. SpellID);
local s = "Rank13";
--msg = string.gsub(msg, "^%s*(.-)%s*$", "%1")
local out = string.gsub(SpellRank,"%a+", "");
--QuickHeal_debug(" out: " .. out);
return SpellName, out;
end
function QuickHeal_Command_Priest(msg)
--if PlayerClass == "priest" then
-- writeLine("PRIEST", 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 : PRIEST ==");
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 [heal] or [hot");
writeLine(" [heal] channeled heal");
writeLine(" [hot] heal over time");
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