local Tinkr, Bastion = ... local HolyModule = Bastion.Module:New('holypriest') local Evaluator = Tinkr.Util.Evaluator local Player = Bastion.UnitManager:Get('player') local None = Bastion.UnitManager:Get('none') local Target = Bastion.UnitManager:Get('target') local myconf = Tinkr.Util.Config:New('holy_priest') -- for saving variables local ArcaneTorrent = Bastion.SpellBook:GetSpell(232633) local AutoAttack = Bastion.SpellBook:GetSpell(6603) local AngelicFeather = Bastion.SpellBook:GetSpell(121536) local DesperatePrayer = Bastion.SpellBook:GetSpell(19236) local DispelMagic = Bastion.SpellBook:GetSpell(528) local Fade = Bastion.SpellBook:GetSpell(586) local FlashHeal = Bastion.SpellBook:GetSpell(2061) local HolyNova = Bastion.SpellBook:GetSpell(132157) local HolyWordSalvation = Bastion.SpellBook:GetSpell(265202) local LeapofFaith = Bastion.SpellBook:GetSpell(73325) local Levitate = Bastion.SpellBook:GetSpell(1706) local MassDispel = Bastion.SpellBook:GetSpell(32375) local MindSoothe = Bastion.SpellBook:GetSpell(453) local MindVision = Bastion.SpellBook:GetSpell(2096) local PowerInfusion = Bastion.SpellBook:GetSpell(10060) local PowerWordFortitude = Bastion.SpellBook:GetSpell(21562) local PowerWordLife = Bastion.SpellBook:GetSpell(373481) local PowerWordShield = Bastion.SpellBook:GetSpell(17) local PrayerofMending = Bastion.SpellBook:GetSpell(33076) local PsychicScream = Bastion.SpellBook:GetSpell(8122) local Renew = Bastion.SpellBook:GetSpell(139) local Resurrection = Bastion.SpellBook:GetSpell(2006) local ShadowWordPain = Bastion.SpellBook:GetSpell(589) local Shadowfiend = Bastion.SpellBook:GetSpell(34433) local Smite = Bastion.SpellBook:GetSpell(585) local FocusedWill = Bastion.SpellBook:GetSpell(45243) local CircleofHealing = Bastion.SpellBook:GetSpell(204883) local DivineHymn = Bastion.SpellBook:GetSpell(64843) local DivineWord = Bastion.SpellBook:GetSpell(372760) local GuardianSpirit = Bastion.SpellBook:GetSpell(47788) local Halo = Bastion.SpellBook:GetSpell(120517) local Heal = Bastion.SpellBook:GetSpell(2060) local HolyFire = Bastion.SpellBook:GetSpell(14914) local HolyWordSanctify = Bastion.SpellBook:GetSpell(34861) local HolyWordSerenity = Bastion.SpellBook:GetSpell(2050) local Lightweaver = Bastion.SpellBook:GetSpell(390993) local MassResurrection = Bastion.SpellBook:GetSpell(212036) local PrayerofHealing = Bastion.SpellBook:GetSpell(596) local Purify = Bastion.SpellBook:GetSpell(527) local SurgeofLight = Bastion.SpellBook:GetSpell(114255) local SymbolofHope = Bastion.SpellBook:GetSpell(64901) local MindBlast = Bastion.SpellBook:GetSpell(14914) local Lowest = Bastion.UnitManager:CreateCustomUnit('lowest', function(unit) local lowest = nil local lowestHP = math.huge Bastion.UnitManager:EnumFriends(function(unit) if unit:IsDead() then return false end if Player:GetDistance(unit) > 40 then return false end if not Player:CanSee(unit) then return false end local hp = unit:GetHP() if hp < lowestHP then lowest = unit lowestHP = hp end end) if not lowest then lowest = Player end return lowest end) local Tank = Bastion.UnitManager:CreateCustomUnit('tank', function(unit) local tank = nil Bastion.UnitManager:EnumFriends(function(unit) if Player:GetDistance(unit) > 40 then return false end if not Player:CanSee(unit) then return false end if unit:IsDead() then return false end if unit:IsTank() then tank = unit return true end return false end) if tank == nil then tank = Player end return tank end) local Healer = Bastion.UnitManager:CreateCustomUnit('healer', function(unit) local healer = nil Bastion.UnitManager:EnumFriends(function(unit) if Player:GetDistance(unit) > 40 then return false end if not Player:CanSee(unit) then return false end if unit:IsDead() then return false end if unit:IsHealer() then healer = unit return true end return false end) if healer == nil then healer = Player end return healer end) local PurifyUnit = Bastion.UnitManager:CreateCustomUnit('dispel', function(unit) local lowest = nil local lowestHP = math.huge Bastion.UnitManager:EnumFriends(function(unit) if unit:IsDead() then return false end if not Player:CanSee(unit) then return false end if Player:GetDistance(unit) > 40 then return false end if not unit:IsDead() and Player:CanSee(unit) and unit:GetAuras():HasAnyDispelableAura(Purify) then local hp = unit:GetHP() if hp < lowestHP then lowest = unit lowestHP = hp end end end) if lowest == nil then lowest = None end return lowest end) local SanctifyUnit = Bastion.UnitManager:CreateCustomUnit('sanctify', function(unit) local lowest = nil local lowestHP = math.huge Bastion.UnitManager:EnumFriends(function(unit) if unit:IsDead() then return false end if not Player:CanSee(unit) then return false end if Player:GetDistance(unit) > 40 then return false end if Player:CanSee(unit) and unit:GetPartyHPAround(10, 70) >= 5 then local hp = unit:GetHP() if hp < lowestHP then lowest = unit lowestHP = hp end end end) if lowest == nil then lowest = None end return lowest end) local CoHUnit = Bastion.UnitManager:CreateCustomUnit('coh', function(unit) local lowest = nil local lowestHP = math.huge Bastion.UnitManager:EnumFriends(function(unit) if unit:IsDead() then return false end if not Player:CanSee(unit) then return false end if Player:GetDistance(unit) > 40 then return false end if Player:CanSee(unit) and unit:GetPartyHPAround(30, 80) >= 4 then local hp = unit:GetHP() if hp < lowestHP then lowest = unit lowestHP = hp end end end) if lowest == nil then lowest = None end return lowest end) local Explosive = Bastion.UnitManager:CreateCustomUnit('explosive', function(unit) local explosive = nil Bastion.UnitManager:EnumEnemies(function(unit) if unit:IsDead() then return false end if not Player:CanSee(unit) then return false end if Player:GetDistance(unit) > 40 then return false end if Player:InMelee(unit) and unit:GetID() == 120651 and Player:IsFacing(unit) then explosive = unit return true end end) if explosive == nil then explosive = None end return explosive end) local RestingAPL = Bastion.APL:New('resting') local HealAPL = Bastion.APL:New('heal') local DamageAPL = Bastion.APL:New('damage') -- Resting - Out of Combat Actions local usepwf = myconf:Read('pwf') RestingAPL:AddSpell( PowerWordFortitude:CastableIf(function(self) return usepwf and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and not Player:GetAuras():FindMy(PowerWordFortitude):IsUp() and not IsMounted() end):SetTarget(Player) ) -- HealAPL - Healing here -- Purify HealAPL:AddSpell( Purify:CastableIf(function(self) return PurifyUnit:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and self:IsInRange(PurifyUnit) and PurifyUnit:GetAuras():HasAnyDispelableAura(Purify) end):SetTarget(PurifyUnit) ) -- Symbol of Hope HealAPL:AddSpell( SymbolofHope:CastableIf(function(self) return Healer:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Healer:GetPP() <= 50 end):SetTarget(Player) ) -- Guardian Spirit HealAPL:AddSpell( GuardianSpirit:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Tank:GetHP() <= 40 end):SetTarget(Tank) ) -- Flash Heal with Surge of Light HealAPL:AddSpell( FlashHeal:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetAuras():FindMy(SurgeofLight):IsUp() end):SetTarget(Lowest) ) -- Holy Word: Salvation when the majority of the raid is heavily injured HealAPL:AddSpell( HolyWordSalvation:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetPartyHPAround(40, 50) >= 5 and not Player:IsMoving() end):SetTarget(Player) ) -- Divine Hymn when the majority of the raid is heavily injured HealAPL:AddSpell( DivineHymn:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetPartyHPAround(40, 40) >= 5 and not Player:IsMoving() end):SetTarget(Player) ) -- Divine Word followed by Holy Word: Sanctify (if available) on a cluster of injured allies -- Divine Word followed by Holy Word: Serenity (if available) on an injured ally HealAPL:AddSpell( DivineWord:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and not Player:GetAuras():FindMy(DivineWord):IsUp() and (Lowest:GetHP() <= 60 or SanctifyUnit:GetPartyHPAround(10, 60) >= 5) end):SetTarget(Player) ) -- Holy Word: Sanctify when a cluster of your raid is injured HealAPL:AddSpell( HolyWordSanctify:CastableIf(function(self) return SanctifyUnit:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:CanSee(SanctifyUnit) and SanctifyUnit:GetPartyHPAround(10, 70) >= 5 end):SetTarget(None):OnCast(function(self) local loc = SanctifyUnit:GetPosition() self:Click(loc) end) ) -- Holy Word: Serenity on an injured ally HealAPL:AddSpell( HolyWordSerenity:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Lowest:GetHP() <= 70 end):SetTarget(Lowest) ) -- Circle of Healing on cooldown when at least 4 allies are injured HealAPL:AddSpell( CircleofHealing:CastableIf(function(self) return CoHUnit:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:CanSee(CoHUnit) and CoHUnit:GetPartyHPAround(30, 80) >= 4 end):SetTarget(CoHUnit) ) -- Prayer of Mending on cooldown, usually on the active tank HealAPL:AddSpell( PrayerofMending:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Tank:GetHP() <= 95 end):SetTarget(Tank) ) -- Halo when most of your raid is injured HealAPL:AddSpell( Halo:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetPartyHPAround(30, 70) >= 5 end):SetTarget(Player) ) -- Power Word: Life for emergency triage on an ally below 35% hitpoints HealAPL:AddSpell( PowerWordLife:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Tank:GetHP() <= 35 end):SetTarget(Tank) ) -- Alternate between Flash Heal and Heal and use Lightweaver buff HealAPL:AddSpell( Heal:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetAuras():FindMy(Lightweaver):IsUp() and Lowest:GetHP() <= 90 end):SetTarget(Lowest) ) HealAPL:AddSpell( FlashHeal:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and not Player:GetAuras():FindMy(Lightweaver):IsUp() and Lowest:GetHP() <= 90 end):SetTarget(Lowest) ) -- DamageAPL - DPS spells here -- Cast Shadow Word: Pain if you're moving and nothing else is available DamageAPL:AddSpell( ShadowWordPain:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and not Target:GetAuras():FindMy(ShadowWordPain):IsUp() end):SetTarget(Target) ) -- Cast Smite DamageAPL:AddSpell( Smite:CastableIf(function(self) return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(Target) ) -- Module that dictates APL flow HolyModule:Sync(function() -- Bastion:Print(Lowest) -- if not Player:IsAffectingCombat() then -- RestingAPL:Execute() -- end HealAPL:Execute() -- if Player:IsAffectingCombat() and Target:Exists() and Target:IsHostile() then -- DamageAPL:Execute() -- end end) Bastion:Register(HolyModule) local tab1 = { layoutConfig = { padding = { top = 40 } }, rows = { [1] = { shadpr = { type = 'label', label = 'Open Combat' } }, [2] = { opener = { type = 'dropdown', label = 'Opener', column = 6, order = 1, options = { { text = 'Shadow Word: Pain', value = 'swp'}, { text = 'Shadow Crash', value = 'crash'}, { text = 'None', value = 'none'}, }, initialValue = myconf:Read('opener', 'shield'), onValueChanged = function(_, value) myconf:Write('opener', value) end }, }, [3] = { shadpr = { type = 'label', label = 'Buffs' } }, [4] = { pwf = { type = 'checkbox', label = 'Power Word: Fortitude', column = 12, order = 1, initialValue = myconf:Read('pwf', false), onValueChanged = function(_, flag) myconf:Write('pwf', flag) end }, }, [5] = { shadpr = { type = 'header', label = 'Defensives' } }, [6] = { shield1 = { type = 'checkbox', label = 'Power Word: Shield', column = 6, order = 1, initialValue = myconf:Read('pws', false), onValueChanged = function(_, flag) myconf:Write('pws', flag) end }, shield2 = { type = 'slider', label = 'Player Health', column = 6, order = 2, min = 1, max = 100, precision = 0, initialValue = myconf:Read('pwspercent', 35), onValueChanged = function(_, value) myconf:Write('pwspercent', value) end }, }, [7] = { dispersion1 = { type = 'checkbox', label = 'Dispersion', column = 6, order = 1, initialValue = myconf:Read('dispersion', false), onValueChanged = function(_, flag) myconf:Write('dispersion', flag) end }, dispersion2 = { type = 'slider', label = 'Player Health', column = 6, order = 2, min = 1, max = 100, precision = 0, initialValue = myconf:Read('dispersionpercent', 35), onValueChanged = function(_, value) myconf:Write('dispersionpercent', value) end }, }, [8] = { shadpr = { type = 'header', label = 'Interrupts' } }, [9] = { silence = { type = 'checkbox', label = 'Silence on CD', column = 6, order = 1, initialValue = myconf:Read('silence', false), onValueChanged = function(_, flag) myconf:Write('silence', flag) end }, horror = { type = 'checkbox', label = 'Psychic Horror on CD', column = 6, order = 2, initialValue = myconf:Read('horror', false), onValueChanged = function(_, flag) myconf:Write('horror', flag) end }, }, [10] = { shadpr = { type = 'header', label = 'Purify Disease' } }, [11] = { incombat = { type = 'checkbox', label = 'In Combat', column = 6, order = 1, initialValue = myconf:Read('purifyic', false), onValueChanged = function(_, flag) myconf:Write('purifyic', flag) end }, outcombat = { type = 'checkbox', label = 'Out of Combat', column = 6, order = 2, initialValue = myconf:Read('purifyooc', false), onValueChanged = function(_, flag) myconf:Write('purifyooc', flag) end }, }, [12] = { shadpr = { type = 'header', label = 'Dispel Magic' } }, [13] = { incombat = { type = 'checkbox', label = 'In Combat', column = 12, order = 1, initialValue = myconf:Read('dispelic', false), onValueChanged = function(_, flag) myconf:Write('dispelic', flag) end }, }, [14] = { shadpr = { type = 'header', label = 'Dispel Delay Time' } }, [15] = { delay = { type = 'slider', label = 'In seconds', column = 6, order = 1, min = 0.5, max = 2, precision = 1, initialValue = myconf:Read('dispeldelay', 1), onValueChanged = function(_, value) myconf:Write('dispeldelay', value) end }, }, }, } local tab2 = { layoutConfig = { padding = { top = 40 } }, rows = { [1] = { shadpr = { type = 'header', label = 'Player Healing' } }, [2] = { incombat = { type = 'checkbox', label = 'In Combat Healing', column = 6, order = 1, initialValue = myconf:Read('playericheal', false), onValueChanged = function(_, flag) myconf:Write('playericheal', flag) end }, outcombat = { type = 'checkbox', label = 'Out of Combat Healing', column = 6, order = 2, initialValue = myconf:Read('playeroocheal', false), onValueChanged = function(_, flag) myconf:Write('playeroocheal', flag) end }, }, [3] = { shadowmend1 = { type = 'checkbox', label = 'Shadow Mend', column = 6, order = 1, initialValue = myconf:Read('shadowmend', false), onValueChanged = function(_, flag) myconf:Write('shadowmend', flag) end }, shadowmend2 = { type = 'slider', label = 'Player Health', column = 6, order = 2, min = 1, max = 100, precision = 0, initialValue = myconf:Read('shadowmendpercent', 35), onValueChanged = function(_, value) myconf:Write('shadowmendpercent', value) end }, }, }, } local holypriestconfig = { layoutConfig = { padding = { top = 30 } }, rows = { [1] = { container = { type = 'tab', fullSize = true, tabs = { { name = 'player', title = 'Player Settings', layout = tab1 }, { name = 'group', title = 'Placeholder', layout = tab2 } }, } }, }, } Bastion.settingstemplate(holypriestconfig, 'Holy Priest', 400, 600, 1.00, 1.00, 1.00) --, 0.00, 0.44, 0.87, 'enhsha') --Title of Settings Frame, Width, Height, ClassRGB, Rotation Name -- Class colours -- Death Knight 0.77 0.12 0.23 Red -- Demon Hunter 0.64 0.19 0.79 Dark Magenta -- Druid 1.00 0.49 0.04 Orange -- Evoker 0.20 0.58 0.50 Dark Emerald -- Hunter 0.67 0.83 0.45 Green -- Mage 0.25 0.78 0.92 Light Blue -- Monk 0.00 1.00 0.60 Spring Green -- Paladin 0.96 0.55 0.73 Pink -- Priest 1.00 1.00 1.00 White -- Rogue 1.00 0.96 0.41 Yellow -- Shaman 0.00 0.44 0.87 Blue -- Warlock 0.53 0.53 0.93 Purple -- Warrior 0.78 0.61 0.43 Tan