Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_the_scarlet_enclave.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "PassiveAI.h"
9#include "Player.h"
10
11/*####
12## npc_valkyr_battle_maiden
13####*/
14
16{
18};
19
21{
23};
24
26{
27public:
28 npc_valkyr_battle_maiden() : CreatureScript("npc_valkyr_battle_maiden") { }
29
31 {
32 return new npc_valkyr_battle_maidenAI(creature);
33 }
34
36 {
38
40 float x, y, z;
42
44 {
45 me->setActive(true);
46 me->SetVisible(false);
48 me->SetCanFly(true);
49 FlyBackTimer = 500;
50 phase = 0;
51
52 me->GetPosition(x, y, z);
53 z += 4.0f;
54 x -= 3.5f;
55 y -= 5.0f;
56 me->GetMotionMaster()->Clear(false);
57 me->SetPosition(x, y, z, 0.0f);
58 }
59
61 {
62 if (FlyBackTimer <= diff)
63 {
64 Player* player = NULL;
65 if (me->IsSummon())
66 if (Unit* summoner = me->ToTempSummon()->GetSummoner())
67 player = summoner->ToPlayer();
68
69 if (!player)
70 phase = 3;
71
72 switch (phase)
73 {
74 case 0:
75 me->SetWalk(false);
76 me->HandleEmoteCommand(EMOTE_STATE_FLYGRABCLOSED);
77 FlyBackTimer = 500;
78 break;
79 case 1:
80 player->GetClosePoint(x, y, z, me->GetObjectSize());
81 z += 2.5f;
82 x -= 2.0f;
83 y -= 1.5f;
84 me->GetMotionMaster()->MovePoint(0, x, y, z);
85 me->SetTarget(player->GetGUID());
86 me->SetVisible(true);
87 FlyBackTimer = 4500;
88 break;
89 case 2:
90 if (!player->IsRessurectRequested())
91 {
92 me->HandleEmoteCommand(EMOTE_ONESHOT_CUSTOM_SPELL_01);
93 DoCast(player, SPELL_REVIVE, true);
94 Talk(WHISPER_REVIVE, player);
95 }
96 FlyBackTimer = 5000;
97 break;
98 case 3:
99 me->SetVisible(false);
100 FlyBackTimer = 3000;
101 break;
102 case 4:
103 me->DisappearAndDie();
104 break;
105 default:
106 //Nothing To DO
107 break;
108 }
109 ++phase;
110 } else FlyBackTimer-=diff;
111 }
112 };
113};
114
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ EMOTE_ONESHOT_CUSTOM_SPELL_01
@ EMOTE_STATE_FLYGRABCLOSED
@ UNIT_FLAG_NON_ATTACKABLE
Definition Unit.h:626
@ UNIT_FIELD_FLAGS
Says_VBM
Definition chapter1.cpp:328
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
Creature *const me
Definition CreatureAI.h:56
CreatureScript(const char *name)
uint64 GetGUID() const
Definition Object.h:119
Player * ToPlayer()
Definition Object.h:204
PassiveAI(Creature *c)
Definition PassiveAI.cpp:10
bool IsRessurectRequested() const
Definition Player.h:2211
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Definition Unit.h:1367
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
Definition Object.cpp:3070
CreatureAI * GetAI(Creature *creature) const OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void AddSC_the_scarlet_enclave()