Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_zangarmarsh.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: Zangarmarsh
8SD%Complete: 100
9SDComment: Quest support: 9752, 9785, 9803, 10009. Mark Of ... buffs.
10SDCategory: Zangarmarsh
11EndScriptData */
12
13/* ContentData
14npcs_ashyen_and_keleth
15npc_cooshcoosh
16npc_elder_kuruti
17npc_mortog_steamhead
18npc_kayra_longmane
19npc_timothy_daniels
20EndContentData */
21
22#include "ScriptMgr.h"
23#include "ScriptedCreature.h"
24#include "ScriptedGossip.h"
25#include "ScriptedEscortAI.h"
26#include "Player.h"
27#include "WorldSession.h"
28
29/*######
30## npcs_ashyen_and_keleth
31######*/
32
33#define GOSSIP_ITEM_BLESS_ASH "Grant me your mark, wise ancient."
34#define GOSSIP_ITEM_BLESS_KEL "Grant me your mark, mighty ancient."
35
53
55{
56public:
57 npcs_ashyen_and_keleth() : CreatureScript("npcs_ashyen_and_keleth") { }
58
59 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
60 {
61 if (player->GetReputationRank(942) > REP_NEUTRAL)
62 {
63 if (creature->GetEntry() == NPC_ASHYEN)
65
66 if (creature->GetEntry() == NPC_KELETH)
68 }
69 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
70
71 return true;
72 }
73
74 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
75 {
76 player->PlayerTalkClass->ClearMenus();
77 if (action == GOSSIP_ACTION_INFO_DEF+1)
78 {
79 creature->setPowerType(POWER_MANA);
80 creature->SetMaxPower(POWER_MANA, 200); //set a "fake" mana value, we can't depend on database doing it in this case
81 creature->SetPower(POWER_MANA, 200);
82
83 if (creature->GetEntry() == NPC_ASHYEN) //check which Creature we are dealing with
84 {
85 uint32 spell = 0;
86 switch (player->GetReputationRank(942))
87 { //mark of lore
88 case REP_FRIENDLY:
89 spell = SPELL_BLESS_ASH_FRI;
90 break;
91 case REP_HONORED:
92 spell = SPELL_BLESS_ASH_HON;
93 break;
94 case REP_REVERED:
95 spell = SPELL_BLESS_ASH_REV;
96 break;
97 case REP_EXALTED:
98 spell = SPELL_BLESS_ASH_EXA;
99 break;
100 default:
101 break;
102 }
103
104 if (spell)
105 {
106 creature->CastSpell(player, spell, true);
107 creature->AI()->Talk(GOSSIP_REWARD_BLESS);
108 }
109 }
110
111 if (creature->GetEntry() == NPC_KELETH)
112 {
113 uint32 spell = 0;
114 switch (player->GetReputationRank(942)) //mark of war
115 {
116 case REP_FRIENDLY:
117 spell = SPELL_BLESS_KEL_FRI;
118 break;
119 case REP_HONORED:
120 spell = SPELL_BLESS_KEL_HON;
121 break;
122 case REP_REVERED:
123 spell = SPELL_BLESS_KEL_REV;
124 break;
125 case REP_EXALTED:
126 spell = SPELL_BLESS_KEL_EXA;
127 break;
128 default:
129 break;
130 }
131
132 if (spell)
133 {
134 creature->CastSpell(player, spell, true);
135 creature->AI()->Talk(GOSSIP_REWARD_BLESS);
136 }
137 }
138 player->CLOSE_GOSSIP_MENU();
139 player->TalkedToCreature(creature->GetEntry(), creature->GetGUID());
140 }
141 return true;
142 }
143};
144
145/*######
146## npc_cooshcoosh
147######*/
148
149#define GOSSIP_COOSH "You owe Sim'salabim money. Hand them over or die!"
150
157
159{
160public:
161 npc_cooshcoosh() : CreatureScript("npc_cooshcoosh") { }
162
164 {
165 npc_cooshcooshAI(Creature* creature) : ScriptedAI(creature)
166 {
167 m_uiNormFaction = creature->getFaction();
168 }
169
172
174 {
175 LightningBolt_Timer = 2000;
176 if (me->getFaction() != m_uiNormFaction)
177 me->setFaction(m_uiNormFaction);
178 }
179
180 void EnterCombat(Unit* /*who*/) OVERRIDE { }
181
183 {
184 if (!UpdateVictim())
185 return;
186
187 if (LightningBolt_Timer <= diff)
188 {
190 LightningBolt_Timer = 5000;
191 } else LightningBolt_Timer -= diff;
192
194 }
195 };
196
198 {
199 return new npc_cooshcooshAI(creature);
200 }
201
202 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
203 {
204 if (player->GetQuestStatus(QUEST_CRACK_SKULLS) == QUEST_STATUS_INCOMPLETE)
206
207 player->SEND_GOSSIP_MENU(9441, creature->GetGUID());
208 return true;
209 }
210
211 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
212 {
213 player->PlayerTalkClass->ClearMenus();
214 if (action == GOSSIP_ACTION_INFO_DEF)
215 {
216 player->CLOSE_GOSSIP_MENU();
217 creature->setFaction(FACTION_HOSTILE_CO);
218 creature->AI()->AttackStart(player);
219 }
220 return true;
221 }
222};
223
224/*######
225## npc_elder_kuruti
226######*/
227
228#define GOSSIP_ITEM_KUR1 "Greetings, elder. It is time for your people to end their hostility towards the draenei and their allies."
229#define GOSSIP_ITEM_KUR2 "I did not mean to deceive you, elder. The draenei of Telredor thought to approach you in a way that would seem familiar to you."
230#define GOSSIP_ITEM_KUR3 "I will tell them. Farewell, elder."
231
233{
234public:
235 npc_elder_kuruti() : CreatureScript("npc_elder_kuruti") { }
236
237 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
238 {
239 if (player->GetQuestStatus(9803) == QUEST_STATUS_INCOMPLETE)
241
242 player->SEND_GOSSIP_MENU(9226, creature->GetGUID());
243
244 return true;
245 }
246
247 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
248 {
249 player->PlayerTalkClass->ClearMenus();
250 switch (action)
251 {
254 player->SEND_GOSSIP_MENU(9227, creature->GetGUID());
255 break;
256 case GOSSIP_ACTION_INFO_DEF + 1:
258 player->SEND_GOSSIP_MENU(9229, creature->GetGUID());
259 break;
260 case GOSSIP_ACTION_INFO_DEF + 2:
261 {
262 if (!player->HasItemCount(24573))
263 {
264 ItemPosCountVec dest;
265 uint32 itemId = 24573;
266 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, NULL);
267 if (msg == EQUIP_ERR_OK)
268 {
269 player->StoreNewItem(dest, itemId, true);
270 }
271 else
272 player->SendEquipError(msg, NULL, NULL, itemId);
273 }
274 player->SEND_GOSSIP_MENU(9231, creature->GetGUID());
275 break;
276 }
277 }
278 return true;
279 }
280};
281
282/*######
283## npc_mortog_steamhead
284######*/
286{
287public:
288 npc_mortog_steamhead() : CreatureScript("npc_mortog_steamhead") { }
289
290 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
291 {
292 if (creature->IsVendor() && player->GetReputationRank(942) == REP_EXALTED)
294
295 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
296
297 return true;
298 }
299
300 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
301 {
302 player->PlayerTalkClass->ClearMenus();
303 if (action == GOSSIP_ACTION_TRADE)
304 player->GetSession()->SendListInventory(creature->GetGUID());
305 return true;
306 }
307};
308
309/*######
310## npc_kayra_longmane
311######*/
312
324
326{
327public:
328 npc_kayra_longmane() : CreatureScript("npc_kayra_longmane") { }
329
331 {
332 npc_kayra_longmaneAI(Creature* creature) : npc_escortAI(creature) { }
333
334 void Reset() OVERRIDE { }
335
337 {
338 Player* player = GetPlayerForEscort();
339 if (!player)
340 return;
341
342 switch (waypointId)
343 {
344 case 4:
345 Talk(SAY_AMBUSH1, player);
348 break;
349 case 5:
350 Talk(SAY_PROGRESS, player);
351 SetRun();
352 break;
353 case 16:
354 Talk(SAY_AMBUSH2, player);
357 break;
358 case 17:
359 SetRun(false);
360 break;
361 case 25:
362 Talk(SAY_END, player);
364 break;
365 }
366 }
367 };
368
369 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
370 {
371 if (quest->GetQuestId() == QUEST_ESCAPE_FROM)
372 {
373 creature->AI()->Talk(SAY_START, player);
374
375 if (npc_escortAI* pEscortAI = CAST_AI(npc_kayra_longmane::npc_kayra_longmaneAI, creature->AI()))
376 pEscortAI->Start(false, false, player->GetGUID());
377 }
378 return true;
379 }
380
382 {
383 return new npc_kayra_longmaneAI(creature);
384 }
385};
386
387/*######
388## npc_timothy_daniels
389######*/
390
391#define GOSSIP_TIMOTHY_DANIELS_ITEM1 "Specialist, eh? Just what kind of specialist are you, anyway?"
392#define GOSSIP_TEXT_BROWSE_POISONS "Let me browse your reagents and poison supplies."
393
398
400{
401public:
402 npc_timothy_daniels() : CreatureScript("npc_timothy_daniels") { }
403
404 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
405 {
406 if (creature->IsQuestGiver())
407 player->PrepareQuestMenu(creature->GetGUID());
408
409 if (creature->IsVendor())
411
413 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
414 return true;
415 }
416
417 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
418 {
419 player->PlayerTalkClass->ClearMenus();
420 switch (action)
421 {
423 player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TIMOTHY_DANIELS1, creature->GetGUID());
424 break;
426 player->GetSession()->SendListInventory(creature->GetGUID());
427 break;
428 }
429
430 return true;
431 }
432};
433
434/*######
435## AddSC
436######*/
437
439{
441 new npc_cooshcoosh();
442 new npc_elder_kuruti();
444 new npc_kayra_longmane();
446}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ GOSSIP_ICON_VENDOR
Definition GossipDef.h:47
InventoryResult
Definition Item.h:27
@ EQUIP_ERR_OK
Definition Item.h:28
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:777
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
#define CAST_AI(a, b)
#define GOSSIP_TEXT_BROWSE_GOODS
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_TRADE
@ GOSSIP_ACTION_INFO_DEF
@ POWER_MANA
@ REP_EXALTED
@ REP_HONORED
@ REP_REVERED
@ REP_FRIENDLY
@ REP_NEUTRAL
@ NULL_BAG
Definition Unit.h:336
@ NULL_SLOT
Definition Unit.h:337
@ SPELL_LIGHTNING_BOLT
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void GroupEventHappens(uint32 questId, WorldObject const *pEventObject)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
uint32 getFaction() const
Definition Unit.h:1695
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
@ SAY_END
Creature * me
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint32 despawntime)
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Player * GetPlayerForEscort()
void SetRun(bool on=true)
npc_escortAI(Creature *creature)
void WaypointReached(uint32 waypointId) OVERRIDE
@ SAY_START
@ QUEST_CRACK_SKULLS
#define GOSSIP_ITEM_KUR1
#define GOSSIP_TIMOTHY_DANIELS_ITEM1
#define GOSSIP_ITEM_BLESS_ASH
@ QUEST_CRACK_SKULLS
@ FACTION_HOSTILE_CO
@ SPELL_LIGHTNING_BOLT
#define GOSSIP_TEXT_BROWSE_POISONS
void AddSC_zangarmarsh()
@ GOSSIP_TEXTID_TIMOTHY_DANIELS1
#define GOSSIP_ITEM_KUR2
#define GOSSIP_COOSH
AshyenAndKeleth
@ SPELL_BLESS_ASH_HON
@ GOSSIP_REWARD_BLESS
@ SPELL_BLESS_KEL_HON
@ SPELL_BLESS_KEL_REV
@ SPELL_BLESS_KEL_FRI
@ NPC_KELETH
@ NPC_ASHYEN
@ SPELL_BLESS_ASH_FRI
@ SPELL_BLESS_KEL_EXA
@ SPELL_BLESS_ASH_EXA
@ SPELL_BLESS_ASH_REV
#define GOSSIP_ITEM_KUR3
#define GOSSIP_ITEM_BLESS_KEL
@ SAY_PROGRESS
@ SAY_START
@ SAY_AMBUSH2
@ QUEST_ESCAPE_FROM
@ NPC_SLAVEBINDER
@ SAY_AMBUSH1