Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_dragonblight.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/* ScriptData
7SDName: Dragonblight
8SD%Complete: 100
9SDComment:
10SDCategory: Dragonblight
11EndScriptData */
12
13/* ContentData
14npc_alexstrasza_wr_gate
15EndContentData */
16
17#include "ScriptMgr.h"
18#include "ScriptedCreature.h"
19#include "ScriptedGossip.h"
20#include "SpellScript.h"
21#include "SpellAuraEffects.h"
22#include "ScriptedEscortAI.h"
23#include "Vehicle.h"
24#include "CombatAI.h"
25#include "Player.h"
26
28{
29 // Quest
32
33 // Movie
35};
36
37#define GOSSIP_ITEM_WHAT_HAPPENED "Alexstrasza, can you show me what happened here?"
38
40{
41public:
42 npc_alexstrasza_wr_gate() : CreatureScript("npc_alexstrasza_wr_gate") { }
43
44 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
45 {
46 if (creature->IsQuestGiver())
47 player->PrepareQuestMenu(creature->GetGUID());
48
49 if (player->GetQuestRewardStatus(QUEST_RETURN_TO_AG_A) || player->GetQuestRewardStatus(QUEST_RETURN_TO_AG_H))
51
52 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
53 return true;
54 }
55
56 bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) OVERRIDE
57 {
58 player->PlayerTalkClass->ClearMenus();
59 if (action == GOSSIP_ACTION_INFO_DEF+1)
60 {
61 player->CLOSE_GOSSIP_MENU();
62 player->SendMovieStart(MOVIE_ID_GATES);
63 }
64
65 return true;
66 }
67};
68
69/*######
70## Quest Strengthen the Ancients (12096|12092)
71######*/
72
86
87class spell_q12096_q12092_dummy : public SpellScriptLoader // Strengthen the Ancients: On Interact Dummy to Woodlands Walker
88{
89public:
90 spell_q12096_q12092_dummy() : SpellScriptLoader("spell_q12096_q12092_dummy") { }
91
93 {
95
96 void HandleDummy(SpellEffIndex /*effIndex*/)
97 {
98 uint32 roll = rand() % 2;
99
100 Creature* tree = GetHitCreature();
101 Player* player = GetCaster()->ToPlayer();
102
103 if (!tree || !player)
104 return;
105
107
108 if (roll == 1) // friendly version
109 {
110 tree->CastSpell(player, SPELL_CREATE_ITEM_BARK);
111 tree->AI()->Talk(SAY_WALKER_FRIENDLY, player);
112 tree->DespawnOrUnsummon(1000);
113 }
114 else if (roll == 0) // enemy version
115 {
116 tree->AI()->Talk(SAY_WALKER_ENEMY, player);
118 tree->Attack(player, true);
119 }
120 }
121
126 };
127
132};
133
134class spell_q12096_q12092_bark : public SpellScriptLoader // Bark of the Walkers
135{
136public:
137 spell_q12096_q12092_bark() : SpellScriptLoader("spell_q12096_q12092_bark") { }
138
140 {
142
143 void HandleDummy(SpellEffIndex /*effIndex*/)
144 {
145 Creature* lothalor = GetHitCreature();
146 if (!lothalor || lothalor->GetEntry() != NPC_LOTHALOR)
147 return;
148
149 lothalor->AI()->Talk(SAY_LOTHALOR);
150 lothalor->RemoveAura(SPELL_CONFUSED);
151 lothalor->DespawnOrUnsummon(4000);
152 }
153
158 };
159
164};
165
166/*######
167## Quest: Defending Wyrmrest Temple ID: 12372
168######*/
169
171{
172 // Quest data
175
176 // Gossip data
178
179 // Spells data
181 SPELL_DEFENDER_ON_LOW_HEALTH_EMOTE = 52421, // ID - 52421 Wyrmrest Defender: On Low Health Boss Emote to Controller - Random /self/
182 SPELL_RENEW = 49263, // casted to heal drakes
184
185 // Texts data
188};
189
190#define GOSSIP_ITEM_1 "We need to get into the fight. Are you ready?"
191
193{
194 public:
195 npc_wyrmrest_defender() : CreatureScript("npc_wyrmrest_defender") { }
196
197 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
198 {
199 if (player->GetQuestStatus(QUEST_DEFENDING_WYRMREST_TEMPLE) == QUEST_STATUS_INCOMPLETE)
200 {
202 player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DEF1, creature->GetGUID());
203 }
204 else
205 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
206
207 return true;
208 }
209
210 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
211 {
212 player->PlayerTalkClass->ClearMenus();
213 if (action == GOSSIP_ACTION_INFO_DEF+1)
214 {
215 player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_DEF2, creature->GetGUID());
216 // Makes player cast trigger spell for 49207 on self
217 player->CastSpell(player, SPELL_CHARACTER_SCRIPT, true);
218 // The gossip should not auto close
219 }
220
221 return true;
222 }
223
225 {
226 npc_wyrmrest_defenderAI(Creature* creature) : VehicleAI(creature) { }
227
230
232
234 {
235 hpWarningReady = true;
236 renewRecoveryCanCheck = false;
237
239 }
240
242 {
243 // Check system for Health Warning should happen first time whenever get under 30%,
244 // after it should be able to happen only after recovery of last renew is fully done (20 sec),
245 // next one used won't interfere
246 if (hpWarningReady && me->GetHealthPct() <= 30.0f)
247 {
249 hpWarningReady = false;
250 }
251
253 {
254 if (RenewRecoveryChecker <= diff)
255 {
256 renewRecoveryCanCheck = false;
257 hpWarningReady = true;
258 }
259 else RenewRecoveryChecker -= diff;
260 }
261 }
262
263 void SpellHit(Unit* /*caster*/, SpellInfo const* spell) OVERRIDE
264 {
265 switch (spell->Id)
266 {
268 Talk(WHISPER_MOUNTED, me->GetCharmerOrOwner());
271 break;
272 // Both below are for checking low hp warning
274 Talk(BOSS_EMOTE_ON_LOW_HEALTH, me->GetCharmerOrOwner());
275 break;
276 case SPELL_RENEW:
278 {
279 RenewRecoveryChecker = 20000;
280 }
282 break;
283 }
284 }
285 };
286
288 {
289 return new npc_wyrmrest_defenderAI(creature);
290 }
291};
292
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_DUMMY
#define SpellEffectFn(F, I, N)
@ UNIT_NPC_FLAG_SPELLCLICK
Definition Unit.h:711
@ UNIT_FLAG_IMMUNE_TO_NPC
Definition Unit.h:634
@ UNIT_FLAG_PVP_ATTACKABLE
Definition Unit.h:628
@ UNIT_FLAG_IMMUNE_TO_PC
Definition Unit.h:633
@ UNIT_FIELD_NPC_FLAGS
@ UNIT_FIELD_FLAGS
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
Creature *const me
Definition CreatureAI.h:56
void DespawnOrUnsummon(uint32 msTimeToDespawn=0)
CreatureAI * AI() const
Definition Creature.h:483
CreatureScript(const char *name)
Player * ToPlayer()
Definition Object.h:204
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition Object.cpp:1280
uint32 GetEntry() const
Definition Object.h:125
Creature * GetHitCreature()
HookList< EffectHandler > OnEffectHitTarget
Unit * GetCaster()
SpellScriptLoader(const char *name)
Definition Unit.h:1367
void setFaction(uint32 faction)
Definition Unit.h:1699
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
bool Attack(Unit *victim, bool meleeAttack)
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *, uint32, uint32 action) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
PrepareSpellScript(spell_q12096_q12092_bark_SpellScript)
SpellScript * GetSpellScript() const OVERRIDE
PrepareSpellScript(spell_q12096_q12092_dummy_SpellScript)
SpellScript * GetSpellScript() const OVERRIDE
VehicleAI(Creature *c)
Definition CombatAI.cpp:262
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void SpellHit(Unit *, SpellInfo const *spell) OVERRIDE
#define GOSSIP_ITEM_WHAT_HAPPENED
void AddSC_dragonblight()
#define GOSSIP_ITEM_1
@ WHISPER_MOUNTED
@ QUEST_DEFENDING_WYRMREST_TEMPLE
@ GOSSIP_TEXTID_DEF1
@ SPELL_CHARACTER_SCRIPT
@ GOSSIP_TEXTID_DEF2
@ SPELL_RENEW
@ SPELL_WYRMREST_DEFENDER_MOUNT
@ BOSS_EMOTE_ON_LOW_HEALTH
@ SPELL_DEFENDER_ON_LOW_HEALTH_EMOTE
StrengthenAncientsMisc
@ SPELL_CONFUSED
@ SAY_LOTHALOR
@ SAY_WALKER_ENEMY
@ SPELL_CREATE_ITEM_BARK
@ NPC_LOTHALOR
@ FACTION_WALKER_ENEMY
@ SAY_WALKER_FRIENDLY
AlexstraszaWrGate
@ QUEST_RETURN_TO_AG_A
@ QUEST_RETURN_TO_AG_H
@ MOVIE_ID_GATES