Scripts/Creature: Update Dancing Flames

Port From (https://github.com/TrinityCore/TrinityCore/commit/2d4f087f85c1647ce9df875eef6394146be00b1a)
This commit is contained in:
hondacrx
2022-05-29 22:45:04 -04:00
parent 42e17b0c6f
commit 22238656ae
+23 -45
View File
@@ -143,9 +143,9 @@ namespace Scripts.World.NpcSpecial
public const uint GuardsMark = 38067; public const uint GuardsMark = 38067;
//Dancingflames //Dancingflames
public const uint Brazier = 45423; public const uint SummonBrazier = 45423;
public const uint Seduction = 47057; public const uint BrazierDance = 45427;
public const uint FieryAura = 45427; public const uint FierySeduction = 47057;
//RibbonPole //RibbonPole
public const uint RibbonDanceCosmetic = 29726; public const uint RibbonDanceCosmetic = 29726;
@@ -609,73 +609,53 @@ namespace Scripts.World.NpcSpecial
[Script] [Script]
class npc_dancing_flames : ScriptedAI class npc_dancing_flames : ScriptedAI
{ {
public npc_dancing_flames(Creature creature) : base(creature) public npc_dancing_flames(Creature creature) : base(creature) { }
{
Initialize();
}
void Initialize()
{
Active = true;
CanIteract = 3500;
}
bool Active;
uint CanIteract;
public override void Reset() public override void Reset()
{ {
Initialize(); DoCastSelf(SpellIds.SummonBrazier, new CastSpellExtraArgs(true));
DoCast(me, SpellIds.Brazier, new CastSpellExtraArgs(true)); DoCastSelf(SpellIds.BrazierDance, new CastSpellExtraArgs(false));
DoCast(me, SpellIds.FieryAura, new CastSpellExtraArgs(false)); me.SetEmoteState(Emote.StateDance);
float x, y, z; float x, y, z;
me.GetPosition(out x, out y, out z); me.GetPosition(out x, out y, out z);
me.Relocate(x, y, z + 0.94f); me.Relocate(x, y, z + 1.05f);
me.SetDisableGravity(true);
me.HandleEmoteCommand(Emote.OneshotDance);
} }
public override void UpdateAI(uint diff) public override void UpdateAI(uint diff)
{ {
if (!Active) _scheduler.Update(diff);
{
if (CanIteract <= diff)
{
Active = true;
CanIteract = 3500;
me.HandleEmoteCommand(Emote.OneshotDance);
}
else
CanIteract -= diff;
}
} }
public override void JustEngagedWith(Unit who) { }
public override void ReceiveEmote(Player player, TextEmotes emote) public override void ReceiveEmote(Player player, TextEmotes emote)
{ {
if (me.IsWithinLOS(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ()) && me.IsWithinDistInMap(player, 30.0f)) if (me.IsWithinLOS(player.GetPositionX(), player.GetPositionY(), player.GetPositionZ()) && me.IsWithinDistInMap(player, 30.0f))
{ {
me.SetFacingToObject(player); // She responds to emotes not instantly but ~1500ms later
Active = false; // If you first /bow, then /wave before dancing flames bow back, it doesnt bow at all and only does wave
// If you're performing emotes too fast, she will not respond to them
// Means she just replaces currently scheduled event with new after receiving new emote
_scheduler.CancelAll();
switch (emote) switch (emote)
{ {
case TextEmotes.Kiss: case TextEmotes.Kiss:
me.HandleEmoteCommand(Emote.OneshotShy); _scheduler.Schedule(TimeSpan.FromMilliseconds(1500), context => me.HandleEmoteCommand(Emote.OneshotShy));
break; break;
case TextEmotes.Wave: case TextEmotes.Wave:
me.HandleEmoteCommand(Emote.OneshotWave); _scheduler.Schedule(TimeSpan.FromMilliseconds(1500), context => me.HandleEmoteCommand(Emote.OneshotWave));
break; break;
case TextEmotes.Bow: case TextEmotes.Bow:
me.HandleEmoteCommand(Emote.OneshotBow); _scheduler.Schedule(TimeSpan.FromMilliseconds(1500), context => me.HandleEmoteCommand(Emote.OneshotBow));
break; break;
case TextEmotes.Joke: case TextEmotes.Joke:
me.HandleEmoteCommand(Emote.OneshotLaugh); _scheduler.Schedule(TimeSpan.FromMilliseconds(1500), context => me.HandleEmoteCommand(Emote.OneshotLaugh));
break; break;
case TextEmotes.Dance: case TextEmotes.Dance:
if (!player.HasAura(SpellIds.Seduction)) if (!player.HasAura(SpellIds.FierySeduction))
DoCast(player, SpellIds.Seduction, new CastSpellExtraArgs(true)); {
DoCast(player, SpellIds.FierySeduction, new CastSpellExtraArgs(true));
me.SetFacingTo(me.GetAbsoluteAngle(player));
}
break; break;
} }
} }
@@ -1797,7 +1777,6 @@ namespace Scripts.World.NpcSpecial
struct TrainWrecker struct TrainWrecker
{ {
public const int ActionWrecked = 1;
public const int EventDoJump = 1; public const int EventDoJump = 1;
public const int EventDoFacing = 2; public const int EventDoFacing = 2;
public const int EventDoWreck = 3; public const int EventDoWreck = 3;
@@ -1885,7 +1864,6 @@ namespace Scripts.World.NpcSpecial
if (target) if (target)
{ {
me.CastSpell(target, SpellIds.WreckTrain, false); me.CastSpell(target, SpellIds.WreckTrain, false);
target.GetAI().DoAction(TrainWrecker.ActionWrecked);
_timer = 2 * Time.InMilliseconds; _timer = 2 * Time.InMilliseconds;
_nextAction = TrainWrecker.EventDoDance; _nextAction = TrainWrecker.EventDoDance;
} }