Core/Spells: Implemented SPELL_ATTR9_AUTOCAST_OFF_BY_DEFAULT
Port From (https://github.com/TrinityCore/TrinityCore/commit/24096f6b661161f296bfef4a3303789f245873c4)
This commit is contained in:
@@ -1983,7 +1983,7 @@ namespace Framework.Constants
|
|||||||
IgnoreDefaultRatedBattlegroundRestrictions = 0x4000, // Ignore Default Rated Battleground Restrictions
|
IgnoreDefaultRatedBattlegroundRestrictions = 0x4000, // Ignore Default Rated Battleground Restrictions
|
||||||
DoNotDisplayPowerCost = 0x8000, // Do Not Display Power Cost (client only)
|
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)
|
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
|
Unk18 = 0x40000, // 18
|
||||||
Unk19 = 0x80000, // 19
|
Unk19 = 0x80000, // 19
|
||||||
Unk20 = 0x100000, // 20
|
Unk20 = 0x100000, // 20
|
||||||
|
|||||||
@@ -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 (active == ActiveStates.Decide) // active was not used before, so we save it's autocast/passive state here
|
||||||
{
|
{
|
||||||
if (spellInfo.IsAutocastable())
|
if (!spellInfo.IsAutocastable())
|
||||||
newspell.active = ActiveStates.Disabled;
|
|
||||||
else
|
|
||||||
newspell.active = ActiveStates.Passive;
|
newspell.active = ActiveStates.Passive;
|
||||||
|
else if (spellInfo.IsAutocastEnabledByDefault())
|
||||||
|
newspell.active = ActiveStates.Enabled;
|
||||||
|
else
|
||||||
|
newspell.active = ActiveStates.Disabled;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
newspell.active = active;
|
newspell.active = active;
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace Game.Entities
|
|||||||
newstate = ActiveStates.Passive;
|
newstate = ActiveStates.Passive;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (spellInfo.NeedsExplicitUnitTarget())
|
if (spellInfo.IsAutocastEnabledByDefault() && spellInfo.NeedsExplicitUnitTarget())
|
||||||
{
|
{
|
||||||
newstate = ActiveStates.Enabled;
|
newstate = ActiveStates.Enabled;
|
||||||
ToggleCreatureAutocast(spellInfo, true);
|
ToggleCreatureAutocast(spellInfo, true);
|
||||||
@@ -188,7 +188,17 @@ namespace Game.Entities
|
|||||||
byte j = (byte)((preferredSlot + i) % SharedConst.ActionBarIndexMax);
|
byte j = (byte)((preferredSlot + i) % SharedConst.ActionBarIndexMax);
|
||||||
if (PetActionBar[j].GetAction() == 0 && PetActionBar[j].IsActionBarForSpell())
|
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<ActiveStates>(() =>
|
||||||
|
{
|
||||||
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,6 +433,11 @@ namespace Game.Spells
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsAutocastEnabledByDefault()
|
||||||
|
{
|
||||||
|
return !HasAttribute(SpellAttr9.AutocastOffByDefault);
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsStackableWithRanks()
|
public bool IsStackableWithRanks()
|
||||||
{
|
{
|
||||||
if (IsPassive())
|
if (IsPassive())
|
||||||
|
|||||||
Reference in New Issue
Block a user