diff --git a/Source/Framework/Constants/Spells/SpellConst.cs b/Source/Framework/Constants/Spells/SpellConst.cs index afd95e3dc..6151edc20 100644 --- a/Source/Framework/Constants/Spells/SpellConst.cs +++ b/Source/Framework/Constants/Spells/SpellConst.cs @@ -1983,7 +1983,7 @@ namespace Framework.Constants IgnoreDefaultRatedBattlegroundRestrictions = 0x4000, // Ignore Default Rated Battleground Restrictions DoNotDisplayPowerCost = 0x8000, // Do Not Display Power Cost (client only) NextModalSpellRequiresSameUnitTarget = 0x10000, // Prevents automatically casting the spell from SpellClassOptions::ModalNextSpell after current spell if target was changed (client only) - Unk17 = 0x20000, // 17 + AutocastOffByDefault = 0x20000, // AutoCast Off By Default Unk18 = 0x40000, // 18 Unk19 = 0x80000, // 19 Unk20 = 0x100000, // 20 diff --git a/Source/Game/Entities/Pet.cs b/Source/Game/Entities/Pet.cs index 85446cd83..291696a79 100644 --- a/Source/Game/Entities/Pet.cs +++ b/Source/Game/Entities/Pet.cs @@ -1046,10 +1046,12 @@ namespace Game.Entities if (active == ActiveStates.Decide) // active was not used before, so we save it's autocast/passive state here { - if (spellInfo.IsAutocastable()) - newspell.active = ActiveStates.Disabled; - else + if (!spellInfo.IsAutocastable()) newspell.active = ActiveStates.Passive; + else if (spellInfo.IsAutocastEnabledByDefault()) + newspell.active = ActiveStates.Enabled; + else + newspell.active = ActiveStates.Disabled; } else newspell.active = active; diff --git a/Source/Game/Entities/Unit/CharmInfo.cs b/Source/Game/Entities/Unit/CharmInfo.cs index 805ef795b..bc406857e 100644 --- a/Source/Game/Entities/Unit/CharmInfo.cs +++ b/Source/Game/Entities/Unit/CharmInfo.cs @@ -149,7 +149,7 @@ namespace Game.Entities newstate = ActiveStates.Passive; else { - if (spellInfo.NeedsExplicitUnitTarget()) + if (spellInfo.IsAutocastEnabledByDefault() && spellInfo.NeedsExplicitUnitTarget()) { newstate = ActiveStates.Enabled; ToggleCreatureAutocast(spellInfo, true); @@ -188,7 +188,17 @@ namespace Game.Entities byte j = (byte)((preferredSlot + i) % SharedConst.ActionBarIndexMax); if (PetActionBar[j].GetAction() == 0 && PetActionBar[j].IsActionBarForSpell()) { - SetActionBar(j, spell_id, newstate == ActiveStates.Decide ? spellInfo.IsAutocastable() ? ActiveStates.Disabled : ActiveStates.Passive : newstate); + newstate = new Func(() => + { + if (newstate != ActiveStates.Decide) + return newstate; + if (!spellInfo.IsAutocastable()) + return ActiveStates.Passive; + if (spellInfo.IsAutocastEnabledByDefault()) + return ActiveStates.Enabled; + return ActiveStates.Disabled; + })(); + SetActionBar(j, spell_id, newstate); return true; } } diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index f865ebf25..6f18449e9 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -433,6 +433,11 @@ namespace Game.Spells return true; } + public bool IsAutocastEnabledByDefault() + { + return !HasAttribute(SpellAttr9.AutocastOffByDefault); + } + public bool IsStackableWithRanks() { if (IsPassive())