diff --git a/scripts/shadowpriest.lua b/scripts/shadowpriest.lua index 0625181..04cb142 100644 --- a/scripts/shadowpriest.lua +++ b/scripts/shadowpriest.lua @@ -37,6 +37,7 @@ local Dispersion = Bastion.SpellBook:GetSpell(47585) local Halo = Bastion.SpellBook:GetSpell(120644) local MindFlay = Bastion.SpellBook:GetSpell(15407) local MindFlayInsanity = Bastion.SpellBook:GetSpell(391399) +local MindSear = Bastion.SpellBook:GetSpell(48045) local MindSpike = Bastion.SpellBook:GetSpell(73510) local Mindbender = Bastion.SpellBook:GetSpell(200174) local ShadowCrash = Bastion.SpellBook:GetSpell(205385) @@ -113,6 +114,7 @@ local RestingAPL = Bastion.APL:New('resting') local OpenerAPL = Bastion.APL:New('opener') local STAPL = Bastion.APL:New('st') local AOEAPL = Bastion.APL:New('aoe') +local DefensivesAPL = Bastion.APL:New('defensives') local UtilityAPL = Bastion.APL:New('utility') -- Resting - Out of Combat Actions @@ -135,7 +137,7 @@ RestingAPL:AddSpell( local opener = myconf:Read('opener') OpenerAPL:AddSpell( ShadowCrash:CastableIf(function(self) - return opener == 'crash' and Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return opener == 'crash' and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(None):OnCast(function(self) local loc = Target:GetPosition() self:Click(loc) @@ -147,10 +149,31 @@ OpenerAPL:AddSpell( end):SetTarget(Target) ) +-- Defensive spells +-- Power Word: Shield +local pws = myconf:Read('pws') +local pwspercent = myconf:Read('pwspercent') +DefensivesAPL:AddSpell( + PowerWordShield:CastableIf(function(self) + return pws and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and not Player:GetAuras():FindMy(PowerWordShield):IsUp() + and Player:GetHP() <= pwspercent + end):SetTarget(Player) +) +-- Dispersion +local dispersion = myconf:Read('dispersion') +local dispersionpercent = myconf:Read('dispersionpercent') +DefensivesAPL:AddSpell( + Dispersion:CastableIf(function(self) + return dispersion and self:IsKnownAndUsable() and Player:GetHP() <= dispersionpercent + end):SetTarget(Player) +) + -- Utility spells +-- Interrupt with Silence +local silence = myconf:Read('silence') UtilityAPL:AddSpell( Silence:CastableIf(function(self) - return InterruptTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return silence and InterruptTarget:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(InterruptTarget) ) @@ -164,38 +187,45 @@ STAPL:AddSpell( -- Cast Mindbender on cooldown STAPL:AddSpell( Mindbender:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(Target) ) -- Cast Dark Ascension on cooldown STAPL:AddSpell( DarkAscension:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(Player) ) -- Cast Power Infusion if Dark Ascension is active STAPL:AddSpell( PowerInfusion:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetAuras():FindMy(DarkAscension):IsUp() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetAuras():FindMy(DarkAscension):IsUp() end):SetTarget(Player) ) -- Use offensive trinkets and potions. -- Cast Mind Blast if you have two charges STAPL:AddSpell( MindBlast:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and MindBlast:GetCharges() == 2 + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and MindBlast:GetCharges() == 2 end):SetTarget(Target) ) -- Cast Shadow Word: Death if Mindbender is active STAPL:AddSpell( ShadowWordDeath:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and checktotem("Mindbender") + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and checktotem("Mindbender") + end):SetTarget(Target) +) +-- Cast Mind Sear to avoid over capping Insanity, consider holding it small amounts of time for mobs to group up. 3+ targets +STAPL:AddSpell( + MindSear:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Target:GetEnemies(10) >= 3 end):SetTarget(Target) ) -- Cast Devouring Plague if you're close to capping Insanity or the debuff will expire STAPL:AddSpell( DevouringPlague:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetPower(Enum.PowerType.Insanity) >= 80 + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetPower(Enum.PowerType.Insanity) >= 80 + and Target:GetEnemies(10) <= 2 end):SetTarget(Target) ) -- Cast Vampiric Touch if you are within pandemic range to maintain uptime @@ -208,25 +238,25 @@ STAPL:AddSpell( -- Cast Shadow Word: Death if the target is below 20% hp STAPL:AddSpell( ShadowWordDeath:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Target:GetHealthPercent() <= 20 + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Target:GetHealthPercent() <= 20 end):SetTarget(Target) ) -- Cast Mind Blast STAPL:AddSpell( MindBlast:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(Target) ) -- Cast Mindgames STAPL:AddSpell( Mindgames:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(Target) ) -- Cast Shadow Crash, even if your DoTs are not close to expiring STAPL:AddSpell( ShadowCrash:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(None):OnCast(function(self) local loc = Target:GetPosition() self:Click(loc) @@ -235,37 +265,43 @@ STAPL:AddSpell( -- Cast Void Torrent STAPL:AddSpell( VoidTorrent:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + end):SetTarget(Target) +) +-- Cast Halo +STAPL:AddSpell( + Halo:CastableIf(function(self) + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Target:GetEnemies(10) >= 2 end):SetTarget(Target) ) -- Cast Mind Spike if you have a Surge of Darkness proc STAPL:AddSpell( MindSpike:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetAuras():FindMy(SurgeofDarkness):IsUp() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:GetAuras():FindMy(SurgeofDarkness):IsUp() end):SetTarget(Target) ) -- Cast Mind Flay: Insanity STAPL:AddSpell( MindFlayInsanity:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(Target) ) -- Cast Mind Spike STAPL:AddSpell( MindSpike:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Target:GetEnemies(10) == 1 end):SetTarget(Target) ) -- Cast Mind Flay STAPL:AddSpell( MindFlay:CastableIf(function(self) - return Target:Exists() and self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() end):SetTarget(Target) ) -- Cast Shadow Word: Pain if you're moving and nothing else is available STAPL:AddSpell( ShadowWordPain:CastableIf(function(self) - return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and not Player:IsMoving() + return self:IsKnownAndUsable() and not Player:IsCastingOrChanneling() and Player:IsMoving() end):SetTarget(Target) ) @@ -274,10 +310,12 @@ ShadowModule:Sync(function() if not Player:IsAffectingCombat() then RestingAPL:Execute() end - if not Player:IsAffectingCombat() and Target:Exists() then + if not Player:IsAffectingCombat() and Target:Exists() and Target:IsHostile() and not Target:IsDead() then OpenerAPL:Execute() end - if Player:IsAffectingCombat() and Target:Exists() then + if Player:IsAffectingCombat() and Target:Exists() and Target:IsHostile() and not Target:IsDead() then + UtilityAPL:Execute() + DefensivesAPL:Execute() STAPL:Execute() end end) @@ -308,7 +346,7 @@ local tab1 = initialValue = myconf:Read('shadowform', false), onValueChanged = function(_, flag) myconf:Write('shadowform', flag) end }, }, - [5] = { shadpr = { type = 'header', label = 'Defensives' } }, + [5] = { shadpr = { type = 'label', label = 'Defensives' } }, [6] = { shield1 = { type = 'checkbox', label = 'Power Word: Shield', column = 6, order = 1, initialValue = myconf:Read('pws', false), @@ -328,38 +366,11 @@ local tab1 = initialValue = myconf:Read('dispersionpercent', 35), onValueChanged = function(_, value) myconf:Write('dispersionpercent', value) end }, }, - [8] = { shadpr = { type = 'header', label = 'Interrupts' } }, + [8] = { shadpr = { type = 'label', label = 'Interrupts' } }, - [9] = { silence = { type = 'checkbox', label = 'Silence on CD', column = 6, order = 1, + [9] = { silence = { type = 'checkbox', label = 'Silence on CD', column = 12, 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 }, }, + onValueChanged = function(_, flag) myconf:Write('silence', flag) end }, }, }, } @@ -368,7 +379,7 @@ local tab2 = { layoutConfig = { padding = { top = 40 } }, rows = { - [1] = { shadpr = { type = 'header', label = 'Player Healing' } }, + [1] = { shadpr = { type = 'label', label = 'Player Healing' } }, [2] = { incombat = { type = 'checkbox', label = 'In Combat Healing', column = 6, order = 1, initialValue = myconf:Read('playericheal', false), @@ -404,7 +415,7 @@ local shadpriestconfig = { layout = tab1 }, { - name = 'group', + name = 'placeholder', title = 'Placeholder', layout = tab2 } @@ -413,7 +424,7 @@ local shadpriestconfig = { }, }, } -Bastion.settingstemplate(shadpriestconfig, 'Shadow 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 +Bastion.settingstemplate(shadpriestconfig, 'Shadow Priest', 400, 500, 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 diff --git a/src/GUI/Gui.lua b/src/GUI/Gui.lua index c322073..cf783c0 100644 --- a/src/GUI/Gui.lua +++ b/src/GUI/Gui.lua @@ -86,17 +86,17 @@ function Bastion.settingstemplate(config, title, width, height, newr, newg, newb } local settingsframe = StdUi:Window(UIParent, width, height, title) - settingsmenua = guiconf:Read("settingsmenua") - settingsmenuc = guiconf:Read("settingsmenuc") - settingsmenud = guiconf:Read("settingsmenud") - settingsmenue = guiconf:Read("settingsmenue") + local settingsmenua = guiconf:Read("settingsmenua") + local settingsmenuc = guiconf:Read("settingsmenuc") + local settingsmenud = guiconf:Read("settingsmenud") + local settingsmenue = guiconf:Read("settingsmenue") settingsframe:Hide() settingsframe:SetPoint(settingsmenua, nil, settingsmenuc, settingsmenud, settingsmenue) StdUi:BuildWindow(settingsframe, config) StdUi:EasyLayout(settingsframe, { padding = { top = 40 } }) settingsframe:SetScript("OnDragStop", function(self) local a,b,c,d,e = self:GetPoint() - Bastion:Print(a,b,c,d,e) + --Bastion:Print(a,b,c,d,e) self:StopMovingOrSizing() guiconf:Write("settingsmenua", a) guiconf:Write("settingsmenuc", c) @@ -113,32 +113,32 @@ function Bastion.settingstemplate(config, title, width, height, newr, newg, newb buttons.dpsenabled = false buttons.healenabled = false buttons.rotationenabled = false - mainmenua = guiconf:Read("mainmenua") - mainmenuc = guiconf:Read("mainmenuc") - mainmenud = guiconf:Read("mainmenud") - mainmenue = guiconf:Read("mainmenue") - _G.mainmenu = StdUi:Window(nil, 150, 280, title) + local mainmenua = guiconf:Read("mainmenua") + local mainmenuc = guiconf:Read("mainmenuc") + local mainmenud = guiconf:Read("mainmenud") + local mainmenue = guiconf:Read("mainmenue") + _G.mainmenu = StdUi:Window(nil, 260, 110, title) mainmenu:Hide() mainmenu:SetPoint(mainmenua, nil, mainmenuc, mainmenud, mainmenue) - local aoebutton = StdUi:HighlightButton(mainmenu, 130, 20, 'AOE') - StdUi:GlueTop(aoebutton, mainmenu, 10, -40, 'LEFT') - local buffsbutton = StdUi:HighlightButton(mainmenu, 130, 20, 'Buffs') - StdUi:GlueTop(buffsbutton, aoebutton, 0, -30, 'LEFT') - local cooldownsbutton = StdUi:HighlightButton(mainmenu, 130, 20, 'Cooldowns') - StdUi:GlueTop(cooldownsbutton, buffsbutton, 0, -30, 'LEFT') - local dispelbutton = StdUi:HighlightButton(mainmenu, 130, 20, 'Dispel') - StdUi:GlueTop(dispelbutton, cooldownsbutton, 0, -30, 'LEFT') - local dpsbutton = StdUi:HighlightButton(mainmenu, 130, 20, 'DPS') - StdUi:GlueTop(dpsbutton, dispelbutton, 0, -30, 'LEFT') - local healbutton = StdUi:HighlightButton(mainmenu, 130, 20, 'Heal') - StdUi:GlueTop(healbutton, dpsbutton, 0, -30, 'LEFT') - local enablebutton = StdUi:HighlightButton(mainmenu, 130, 20, 'Rotation') - StdUi:GlueTop(enablebutton, healbutton, 0, -30, 'LEFT') - local settingsbutton = StdUi:Button(mainmenu, 130, 20, 'Settings') - StdUi:GlueTop(settingsbutton, enablebutton, 0, -30, 'LEFT') + local aoebutton = StdUi:HighlightButton(mainmenu, 80, 20, 'AOE') + StdUi:GlueTop(aoebutton, mainmenu, 5, -35, 'LEFT') + local buffsbutton = StdUi:HighlightButton(mainmenu, 80, 20, 'Buffs') + StdUi:GlueRight(buffsbutton, aoebutton, 5, 0, nil) + local cooldownsbutton = StdUi:HighlightButton(mainmenu, 80, 20, 'Cooldowns') + StdUi:GlueRight(cooldownsbutton, buffsbutton, 5, 0, nil) + local dispelbutton = StdUi:HighlightButton(mainmenu, 80, 20, 'Dispel') + StdUi:GlueTop(dispelbutton, aoebutton, 0, -25, 'LEFT') + local dpsbutton = StdUi:HighlightButton(mainmenu, 80, 20, 'DPS') + StdUi:GlueRight(dpsbutton, dispelbutton, 5, 0, nil) + local healbutton = StdUi:HighlightButton(mainmenu, 80, 20, 'Heal') + StdUi:GlueRight(healbutton, dpsbutton, 5, 0, nil) + local enablebutton = StdUi:HighlightButton(mainmenu, 80, 20, 'Rotation') + StdUi:GlueTop(enablebutton, dispelbutton, 0, -25, 'LEFT') + local settingsbutton = StdUi:Button(mainmenu, 80, 20, 'Settings') + StdUi:GlueRight(settingsbutton, enablebutton, 5, 0, nil) mainmenu:SetScript("OnDragStop", function(self) local a,b,c,d,e = self:GetPoint() - Bastion:Print(a,b,c,d,e) + --Bastion:Print(a,b,c,d,e) self:StopMovingOrSizing() guiconf:Write("mainmenua", a) guiconf:Write("mainmenuc", c) @@ -157,10 +157,10 @@ function Bastion.settingstemplate(config, title, width, height, newr, newg, newb --Enable/Disable AOE Button OnClick aoebutton:SetScript('OnClick', function() if buttons.aoeenabled == false then - cooldownsbutton:LockHighlight() + aoebutton:LockHighlight() buttons.aoeenabled = true elseif buttons.aoeenabled == true then - cooldownsbutton:UnlockHighlight() + aoebutton:UnlockHighlight() buttons.aoeenabled = false end end)