Core/Spells: CastSpell Cleanup

Port From (https://github.com/TrinityCore/TrinityCore/commit/)
This commit is contained in:
hondacrx
2021-04-18 18:42:11 -04:00
parent b1ea7212f3
commit d0faa12ef6
45 changed files with 775 additions and 632 deletions
+7 -7
View File
@@ -103,7 +103,7 @@ namespace Scripts.World.EmeraldDragons
base.Reset();
me.RemoveUnitFlag(UnitFlags.NotSelectable | UnitFlags.NonAttackable);
me.SetReactState(ReactStates.Aggressive);
DoCast(me, SpellIds.MarkOfNatureAura, true);
DoCast(me, SpellIds.MarkOfNatureAura, new CastSpellExtraArgs(true));
_scheduler.Schedule(TimeSpan.FromSeconds(4), task =>
{
@@ -123,8 +123,8 @@ namespace Scripts.World.EmeraldDragons
{
// Seeping Fog appears only as "pairs", and only ONE pair at any given time!
// Despawntime is 2 minutes, so reschedule it for new cast after 2 minutes + a minor "random time" (30 seconds at max)
DoCast(me, SpellIds.SeepingFogLeft, true);
DoCast(me, SpellIds.SeepingFogRight, true);
DoCast(me, SpellIds.SeepingFogLeft, new CastSpellExtraArgs(true));
DoCast(me, SpellIds.SeepingFogRight, new CastSpellExtraArgs(true));
task.Repeat(TimeSpan.FromMinutes(2), TimeSpan.FromMinutes(2.5));
});
}
@@ -245,7 +245,7 @@ namespace Scripts.World.EmeraldDragons
Talk(TextIds.SayYsondreSummonDruids);
for (byte i = 0; i < 10; ++i)
DoCast(me, SpellIds.SummonDruidSpirits, true);
DoCast(me, SpellIds.SummonDruidSpirits, new CastSpellExtraArgs(true));
++_stage;
}
}
@@ -357,7 +357,7 @@ namespace Scripts.World.EmeraldDragons
public override void KilledUnit(Unit who)
{
if (who.IsTypeId(TypeId.Player))
DoCast(who, SpellIds.PutridMushroom, true);
DoCast(who, SpellIds.PutridMushroom, new CastSpellExtraArgs(true));
base.KilledUnit(who);
}
@@ -372,7 +372,7 @@ namespace Scripts.World.EmeraldDragons
if (!HealthAbovePct(100 - 25 * _stage))
{
Talk(TextIds.SayEmerissCastCorruption);
DoCast(me, SpellIds.CorruptionOfEarth, true);
DoCast(me, SpellIds.CorruptionOfEarth, new CastSpellExtraArgs(true));
++_stage;
}
}
@@ -445,7 +445,7 @@ namespace Scripts.World.EmeraldDragons
Talk(TextIds.SayTaerarSummonShades);
foreach (var spell in SpellIds.TaerarShadeSpells)
DoCastVictim(spell, true);
DoCastVictim(spell, new CastSpellExtraArgs(true));
_shades += (byte)SpellIds.TaerarShadeSpells.Length;
DoCast(SpellIds.Shade);
+7 -2
View File
@@ -15,9 +15,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Game.AI;
using Game.Entities;
using Game.Scripting;
using Game.Spells;
using System;
namespace Scripts.World
@@ -27,10 +29,13 @@ namespace Scripts.World
{
public trigger_periodic(Creature creature) : base(creature)
{
var interval = me.GetBaseAttackTime(Framework.Constants.WeaponAttackType.BaseAttack);
var interval = me.GetBaseAttackTime(WeaponAttackType.BaseAttack);
var spell = me.m_spells[0] != 0 ? Global.SpellMgr.GetSpellInfo(me.m_spells[0], me.GetMap().GetDifficultyID()) : null;
_scheduler.Schedule(TimeSpan.FromMilliseconds(interval), task =>
{
me.CastSpell(me, me.m_spells[0], true);
if (spell != null)
me.CastSpell(me, spell.Id, new CastSpellExtraArgs(TriggerCastFlags.FullMask).SetCastDifficulty(spell.Difficulty));
task.Repeat(TimeSpan.FromMilliseconds(interval));
});
}
+16 -16
View File
@@ -695,8 +695,8 @@ namespace Scripts.World.NpcSpecial
public override void Reset()
{
Initialize();
DoCast(me, SpellIds.Brazier, true);
DoCast(me, SpellIds.FieryAura, false);
DoCast(me, SpellIds.Brazier, new CastSpellExtraArgs(true));
DoCast(me, SpellIds.FieryAura, new CastSpellExtraArgs(false));
float x, y, z;
me.GetPosition(out x, out y, out z);
me.Relocate(x, y, z + 0.94f);
@@ -744,7 +744,7 @@ namespace Scripts.World.NpcSpecial
break;
case TextEmotes.Dance:
if (!player.HasAura(SpellIds.Seduction))
DoCast(player, SpellIds.Seduction, true);
DoCast(player, SpellIds.Seduction, new CastSpellExtraArgs(true));
break;
}
}
@@ -1330,7 +1330,7 @@ namespace Scripts.World.NpcSpecial
if (me.IsAttackReady())
{
DoCastVictim(SpellIds.Deathtouch, true);
DoCastVictim(SpellIds.Deathtouch, new CastSpellExtraArgs(true));
me.ResetAttackTimer();
}
}
@@ -1404,7 +1404,7 @@ namespace Scripts.World.NpcSpecial
player.SendGossipMenu(GossipMenus.YourFortuneIsCast, me.GetGUID());
break;
case eTradeskill.GossipActionInfoDef + 6:
DoCast(player, SpellIds.Fortune, false);
DoCast(player, SpellIds.Fortune, new CastSpellExtraArgs(false));
player.SendGossipMenu(GossipMenus.HereIsYourFortune, me.GetGUID());
break;
}
@@ -1449,7 +1449,7 @@ namespace Scripts.World.NpcSpecial
if (spellId != 0)
{
DoCast(player, spellId, false);
DoCast(player, spellId, new CastSpellExtraArgs(false));
player.GetSpellHistory().AddCooldown(spellId, 0, TimeSpan.FromHours(2));
SendAction(player, action);
}
@@ -1509,7 +1509,7 @@ namespace Scripts.World.NpcSpecial
{
if (ExplosionTimer <= diff)
{
DoCast(me, SpellIds.TonkMineDetonate, true);
DoCast(me, SpellIds.TonkMineDetonate, new CastSpellExtraArgs(true));
me.SetDeathState(DeathState.Dead); // unsummon it
}
else
@@ -1654,27 +1654,27 @@ namespace Scripts.World.NpcSpecial
{
case eTradeskill.GossipActionInfoDef + 1: // Borean Tundra
player.CloseGossipMenu();
DoCast(player, SpellIds.BoreanTundra, false);
DoCast(player, SpellIds.BoreanTundra, new CastSpellExtraArgs(false));
break;
case eTradeskill.GossipActionInfoDef + 2: // Howling Fjord
player.CloseGossipMenu();
DoCast(player, SpellIds.HowlingFjord, false);
DoCast(player, SpellIds.HowlingFjord, new CastSpellExtraArgs(false));
break;
case eTradeskill.GossipActionInfoDef + 3: // Sholazar Basin
player.CloseGossipMenu();
DoCast(player, SpellIds.SholazarBasin, false);
DoCast(player, SpellIds.SholazarBasin, new CastSpellExtraArgs(false));
break;
case eTradeskill.GossipActionInfoDef + 4: // Icecrown
player.CloseGossipMenu();
DoCast(player, SpellIds.Icecrown, false);
DoCast(player, SpellIds.Icecrown, new CastSpellExtraArgs(false));
break;
case eTradeskill.GossipActionInfoDef + 5: // Storm peaks
player.CloseGossipMenu();
DoCast(player, SpellIds.StormPeaks, false);
DoCast(player, SpellIds.StormPeaks, new CastSpellExtraArgs(false));
break;
case eTradeskill.GossipActionInfoDef + 6: // Underground
player.CloseGossipMenu();
DoCast(player, SpellIds.Underground, false);
DoCast(player, SpellIds.Underground, new CastSpellExtraArgs(false));
break;
}
@@ -1931,7 +1931,7 @@ namespace Scripts.World.NpcSpecial
}
else
//me.CastSpell(me, GetFireworkSpell(me.GetEntry()), true);
me.CastSpell(me.GetPositionX(), me.GetPositionY(), me.GetPositionZ(), GetFireworkSpell(me.GetEntry()), true);
me.CastSpell(me.GetPosition(), GetFireworkSpell(me.GetEntry()), new CastSpellExtraArgs(true));
}
}
@@ -2253,9 +2253,9 @@ namespace Scripts.World.NpcSpecial
case GossipMenus.OptionIdIronforgeSilvermoonPennant:
case GossipMenus.OptionIdStormwindThunderbluffPennant:
if (IsArgentSquire())
DoCastSelf(Misc.bannerSpells[gossipListId - 3].Item1, true);
DoCastSelf(Misc.bannerSpells[gossipListId - 3].Item1, new CastSpellExtraArgs(true));
else
DoCastSelf(Misc.bannerSpells[gossipListId - 3].Item2, true);
DoCastSelf(Misc.bannerSpells[gossipListId - 3].Item2, new CastSpellExtraArgs(true));
break;
}
player.PlayerTalkClass.SendCloseGossip();