Skip to content

Commit 65ec024

Browse files
Cheroxfurry
authored andcommitted
[2601] Implement script support for quest 6402
Signed-off-by: Xfurry <xfurry@scriptdev2.com>
1 parent 68cf557 commit 65ec024

6 files changed

Lines changed: 256 additions & 5 deletions

File tree

scripts/eastern_kingdoms/stormwind_city.cpp

Lines changed: 220 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@
1717
/* ScriptData
1818
SDName: Stormwind_City
1919
SD%Complete: 100
20-
SDComment: Quest support: 1640, 1447, 4185
20+
SDComment: Quest support: 1640, 1447, 4185, 6402.
2121
SDCategory: Stormwind City
2222
EndScriptData */
2323

2424
/* ContentData
2525
npc_bartleby
2626
npc_dashel_stonefist
2727
npc_lady_katrana_prestor
28+
npc_squire_rowe
2829
EndContentData */
2930

3031
#include "precompiled.h"
32+
#include "escort_ai.h"
3133

3234
/*######
3335
## npc_bartleby
@@ -207,6 +209,216 @@ bool GossipSelect_npc_lady_katrana_prestor(Player* pPlayer, Creature* pCreature,
207209
return true;
208210
}
209211

212+
/*######
213+
## npc_squire_rowe
214+
######*/
215+
216+
enum
217+
{
218+
SAY_SIGNAL_SENT = -1000822,
219+
SAY_DISMOUNT = -1000823,
220+
SAY_WELCOME = -1000824,
221+
222+
GOSSIP_ITEM_WINDSOR = -3000106,
223+
224+
GOSSIP_TEXT_ID_DEFAULT = 9063,
225+
GOSSIP_TEXT_ID_PROGRESS = 9064,
226+
GOSSIP_TEXT_ID_START = 9065,
227+
228+
NPC_WINDSOR = 12580,
229+
NPC_WINDSOR_MOUNT = 12581,
230+
231+
QUEST_STORMWIND_RENDEZVOUS = 6402,
232+
QUEST_THE_GREAT_MASQUERADE = 6403,
233+
};
234+
235+
static const DialogueEntry aIntroDialogue[] =
236+
{
237+
{NPC_WINDSOR, 0, 3000}, // wait
238+
{NPC_WINDSOR_MOUNT, 0, 1000}, // summon horse
239+
{SAY_DISMOUNT, NPC_WINDSOR, 2000},
240+
{QUEST_STORMWIND_RENDEZVOUS, 0, 2000}, // face player
241+
{QUEST_THE_GREAT_MASQUERADE, 0, 0}, // say intro to player
242+
{0, 0, 0},
243+
};
244+
245+
static const float aWindsorSpawnLoc[3] = {-9145.68f, 373.79f, 90.64f};
246+
static const float aWindsorMoveLoc[3] = {-9050.39f, 443.55f, 93.05f};
247+
248+
struct MANGOS_DLL_DECL npc_squire_roweAI : public npc_escortAI, private DialogueHelper
249+
{
250+
npc_squire_roweAI(Creature* m_creature) : npc_escortAI(m_creature),
251+
DialogueHelper(aIntroDialogue)
252+
{
253+
m_bIsEventInProgress = false;
254+
Reset();
255+
}
256+
257+
bool m_bIsEventInProgress;
258+
259+
ObjectGuid m_windsorGuid;
260+
ObjectGuid m_horseGuid;
261+
262+
void Reset() { }
263+
264+
void JustSummoned(Creature* pSummoned)
265+
{
266+
if (pSummoned->GetEntry() == NPC_WINDSOR)
267+
{
268+
pSummoned->SetWalk(false);
269+
pSummoned->GetMotionMaster()->MovePoint(1, aWindsorMoveLoc[0], aWindsorMoveLoc[1], aWindsorMoveLoc[2]);
270+
271+
m_windsorGuid = pSummoned->GetObjectGuid();
272+
m_bIsEventInProgress = true;
273+
}
274+
else if (pSummoned->GetEntry() == NPC_WINDSOR_MOUNT)
275+
m_horseGuid = pSummoned->GetObjectGuid();
276+
}
277+
278+
void SummonedCreatureDespawn(Creature* pSummoned)
279+
{
280+
if (pSummoned->GetEntry() == NPC_WINDSOR)
281+
{
282+
m_windsorGuid.Clear();
283+
m_bIsEventInProgress = false;
284+
}
285+
}
286+
287+
void SummonedMovementInform(Creature* pSummoned, uint32 uiMotionType, uint32 uiPointId)
288+
{
289+
if (uiMotionType != POINT_MOTION_TYPE || !uiPointId || pSummoned->GetEntry() != NPC_WINDSOR)
290+
return;
291+
292+
if (uiPointId)
293+
StartNextDialogueText(NPC_WINDSOR);
294+
}
295+
296+
void WaypointReached(uint32 uiPointId)
297+
{
298+
switch(uiPointId)
299+
{
300+
case 2:
301+
m_creature->SetStandState(UNIT_STAND_STATE_KNEEL);
302+
break;
303+
case 3:
304+
m_creature->SetStandState(UNIT_STAND_STATE_STAND);
305+
m_creature->SummonCreature(NPC_WINDSOR, aWindsorSpawnLoc[0], aWindsorSpawnLoc[1], aWindsorSpawnLoc[2], 0, TEMPSUMMON_DEAD_DESPAWN, 0);
306+
break;
307+
case 6:
308+
DoScriptText(SAY_SIGNAL_SENT, m_creature);
309+
m_creature->SetFacingTo(2.15f);
310+
SetEscortPaused(true);
311+
break;
312+
}
313+
}
314+
315+
void JustDidDialogueStep(int32 iEntry)
316+
{
317+
switch(iEntry)
318+
{
319+
case NPC_WINDSOR_MOUNT:
320+
{
321+
if (Creature* pWindsor = m_creature->GetMap()->GetCreature(m_windsorGuid))
322+
{
323+
pWindsor->Unmount();
324+
m_creature->SummonCreature(NPC_WINDSOR_MOUNT, pWindsor->GetPositionX() - 1.0f, pWindsor->GetPositionY() + 1.0f, pWindsor->GetPositionZ(), pWindsor->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 30000);
325+
}
326+
break;
327+
}
328+
case SAY_DISMOUNT:
329+
{
330+
if (Creature* pHorse = m_creature->GetMap()->GetCreature(m_horseGuid))
331+
{
332+
pHorse->SetWalk(false);
333+
pHorse->GetMotionMaster()->MovePoint(1, aWindsorSpawnLoc[0], aWindsorSpawnLoc[1], aWindsorSpawnLoc[2]);
334+
}
335+
break;
336+
}
337+
case QUEST_STORMWIND_RENDEZVOUS:
338+
{
339+
Creature* pWindsor = m_creature->GetMap()->GetCreature(m_windsorGuid);
340+
Player* pPlayer = GetPlayerForEscort();
341+
if (!pWindsor || !pPlayer)
342+
break;
343+
344+
pWindsor->SetFacingToObject(pPlayer);
345+
break;
346+
}
347+
case QUEST_THE_GREAT_MASQUERADE:
348+
{
349+
Creature* pWindsor = m_creature->GetMap()->GetCreature(m_windsorGuid);
350+
Player* pPlayer = GetPlayerForEscort();
351+
if (!pWindsor || !pPlayer)
352+
break;
353+
354+
DoScriptText(SAY_WELCOME, pWindsor, pPlayer);
355+
// Allow players to finish quest and also finish the escort
356+
pWindsor->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
357+
SetEscortPaused(false);
358+
break;
359+
}
360+
}
361+
}
362+
363+
Creature* GetSpeakerByEntry(uint32 uiEntry)
364+
{
365+
if (uiEntry == NPC_WINDSOR)
366+
return m_creature->GetMap()->GetCreature(m_windsorGuid);
367+
368+
return NULL;
369+
}
370+
371+
// Check if the event is already running
372+
bool IsStormwindQuestActive() { return m_bIsEventInProgress; }
373+
374+
void UpdateEscortAI(const uint32 uiDiff) { DialogueUpdate(uiDiff); }
375+
};
376+
377+
CreatureAI* GetAI_npc_squire_rowe(Creature* pCreature)
378+
{
379+
return new npc_squire_roweAI(pCreature);
380+
}
381+
382+
bool GossipHello_npc_squire_rowe(Player* pPlayer, Creature* pCreature)
383+
{
384+
// Allow gossip if quest 6402 is completed but not yet rewarded or 6402 is rewarded but 6403 isn't yet completed
385+
if ((pPlayer->GetQuestStatus(QUEST_STORMWIND_RENDEZVOUS) == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(QUEST_STORMWIND_RENDEZVOUS)) ||
386+
(pPlayer->GetQuestRewardStatus(QUEST_STORMWIND_RENDEZVOUS) && pPlayer->GetQuestStatus(QUEST_THE_GREAT_MASQUERADE) != QUEST_STATUS_COMPLETE))
387+
{
388+
bool bIsEventInProgress = true;
389+
390+
// Check if event is already in progress
391+
if (npc_squire_roweAI* pRoweAI = dynamic_cast<npc_squire_roweAI*>(pCreature->AI()))
392+
bIsEventInProgress = pRoweAI->IsStormwindQuestActive();
393+
394+
// If event is already in progress, then inform the player to wait
395+
if (bIsEventInProgress)
396+
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_ID_PROGRESS, pCreature->GetObjectGuid());
397+
else
398+
{
399+
pPlayer->ADD_GOSSIP_ITEM_ID(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WINDSOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
400+
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_ID_START, pCreature->GetObjectGuid());
401+
}
402+
}
403+
else
404+
pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_ID_DEFAULT, pCreature->GetObjectGuid());
405+
406+
return true;
407+
}
408+
409+
bool GossipSelect_npc_squire_rowe(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
410+
{
411+
if (uiAction == GOSSIP_ACTION_INFO_DEF+1)
412+
{
413+
if (npc_squire_roweAI* pRoweAI = dynamic_cast<npc_squire_roweAI*>(pCreature->AI()))
414+
pRoweAI->Start(true, pPlayer, 0, true, false);
415+
416+
pPlayer->CLOSE_GOSSIP_MENU();
417+
}
418+
419+
return true;
420+
}
421+
210422
void AddSC_stormwind_city()
211423
{
212424
Script* pNewScript;
@@ -228,4 +440,11 @@ void AddSC_stormwind_city()
228440
pNewScript->pGossipHello = &GossipHello_npc_lady_katrana_prestor;
229441
pNewScript->pGossipSelect = &GossipSelect_npc_lady_katrana_prestor;
230442
pNewScript->RegisterSelf();
443+
444+
pNewScript = new Script;
445+
pNewScript->Name = "npc_squire_rowe";
446+
pNewScript->GetAI = &GetAI_npc_squire_rowe;
447+
pNewScript->pGossipHello = &GossipHello_npc_squire_rowe;
448+
pNewScript->pGossipSelect = &GossipSelect_npc_squire_rowe;
449+
pNewScript->RegisterSelf();
231450
}

sd2_revision_nr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#ifndef __SD2_REVISION_NR_H__
22
#define __SD2_REVISION_NR_H__
3-
#define SD2_REVISION_NR "2600"
3+
#define SD2_REVISION_NR "2601"
44
#endif // __SD2_REVISION_NR_H__

sql/mangos_scriptname_full.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ UPDATE creature_template SET ScriptName='npc_kaya' WHERE entry=11856;
10411041
UPDATE creature_template SET ScriptName='npc_bartleby' WHERE entry=6090;
10421042
UPDATE creature_template SET ScriptName='npc_dashel_stonefist' WHERE entry=4961;
10431043
UPDATE creature_template SET ScriptName='npc_lady_katrana_prestor' WHERE entry=1749;
1044+
UPDATE creature_template SET ScriptName='npc_squire_rowe' WHERE entry=17804;
10441045

10451046
/* STRANGLETHORN VALE */
10461047
UPDATE creature_template SET ScriptName='mob_yenniku' WHERE entry=2530;

sql/scriptdev2_script_full.sql

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,11 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen
883883
(-1000818,'I now return to whence I came, only to find myself here once more to relive the same epic tragedy.',0,0,0,0,'Eris Havenfire SAY_EVENT_FAIL_2'),
884884
(-1000819,'The Scourge are upon us! Run! Run for your lives!',0,1,0,0,'Peasant SAY_PEASANT_APPEAR_1'),
885885
(-1000820,'Please help us! The Prince has gone mad!',0,1,0,0,'Peasant SAY_PEASANT_APPEAR_2'),
886-
(-1000821,'Seek sanctuary in Hearthglen! It is our only hope!',0,1,0,0,'Peasant SAY_PEASANT_APPEAR_3');
886+
(-1000821,'Seek sanctuary in Hearthglen! It is our only hope!',0,1,0,0,'Peasant SAY_PEASANT_APPEAR_3'),
887+
888+
(-1000822,'The signal has been sent. He should be arriving shortly.',0,0,0,1,'squire rowe SAY_SIGNAL_SENT'),
889+
(-1000823,'Yawww!',0,0,0,35,'reginald windsor SAY_DISMOUNT'),
890+
(-1000824,'I knew you would come, $N. It is good to see you again, friend.',0,0,0,1,'reginald windsor SAY_WELCOME');
887891

888892
-- -1 033 000 SHADOWFANG KEEP
889893
INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES
@@ -4139,7 +4143,7 @@ INSERT INTO gossip_texts (entry,content_default,comment) VALUES
41394143
(-3000103,'I am ready to travel to you village now.','rainspeaker GOSSIP_ITEM_READY'),
41404144
(-3000104,'<Check for pulse...>','mosswalker victim GOSSIP_ITEM_PULSE'),
41414145
(-3000105,'Ezekiel said that you might have a certain book...','dirty larry GOSSIP_ITEM_BOOK'),
4142-
(-3000106,'REUSE ME','REUSE ME'),
4146+
(-3000106,'Let Marshal Windsor know that I am ready.','squire rowe GOSSIP_ITEM_WINDSOR'),
41434147
(-3000107,'REUSE ME','REUSE ME'),
41444148
(-3000108,'REUSE ME','REUSE ME'),
41454149
(-3000109,'I am ready, Oronok. Let us destroy Cyrukh and free the elements!','oronok torn-heart GOSSIP_ITEM_FIGHT');
@@ -4185,7 +4189,6 @@ INSERT INTO gossip_texts (entry,content_default,comment) VALUES
41854189
INSERT INTO gossip_texts (entry,content_default,comment) VALUES
41864190
(-3564000,'We are ready to fight alongside you, Akama','akama(shade) GOSSIP_ITEM_START_ENCOUNTER');
41874191

4188-
41894192
-- -3 595 000 CULLING OF STRATHOLME
41904193
INSERT INTO gossip_texts (entry,content_default,comment) VALUES
41914194
(-3595000,'What do you think they\'re up to?','chromie GOSSIP_ITEM_ENTRANCE_1'),
@@ -6554,4 +6557,14 @@ INSERT INTO script_waypoint VALUES
65546557
(22424, 81, -3504.23, 4080.47, 92.92, 7000, 'SPELL_TRANSFORM'),
65556558
(22424, 82, -3504.23, 4080.47, 92.92, 20000, 'SAY_SKYWING_END');
65566559

6560+
DELETE FROM script_waypoint WHERE entry=17804;
6561+
INSERT INTO script_waypoint VALUES
6562+
(17804, 0, -9054.86, 443.58, 93.05, 0, ''),
6563+
(17804, 1, -9079.33, 424.49, 92.52, 0, ''),
6564+
(17804, 2, -9086.21, 419.02, 92.32, 3000, ''),
6565+
(17804, 3, -9086.21, 419.02, 92.32, 1000, ''),
6566+
(17804, 4, -9079.33, 424.49, 92.52, 0, ''),
6567+
(17804, 5, -9054.38, 436.30, 93.05, 0, ''),
6568+
(17804, 6, -9042.23, 434.24, 93.37, 5000, 'SAY_SIGNAL_SENT');
6569+
65576570
-- EOF

sql/updates/r2601_mangos.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UPDATE creature_template SET ScriptName='npc_squire_rowe' WHERE entry=17804;

sql/updates/r2601_scriptdev2.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
DELETE FROM script_texts WHERE entry BETWEEN -1000824 AND -1000822;
2+
INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES
3+
(-1000822,'The signal has been sent. He should be arriving shortly.',0,0,0,1,'squire rowe SAY_SIGNAL_SENT'),
4+
(-1000823,'Yawww!',0,0,0,35,'reginald windsor SAY_DISMOUNT'),
5+
(-1000824,'I knew you would come, $N. It is good to see you again, friend.',0,0,0,1,'reginald windsor SAY_WELCOME');
6+
DELETE FROM gossip_texts WHERE entry=-3000106;
7+
INSERT INTO gossip_texts (entry,content_default,comment) VALUES
8+
(-3000106,'Let Marshal Windsor know that I am ready.','squire rowe GOSSIP_ITEM_WINDSOR');
9+
DELETE FROM script_waypoint WHERE entry=17804;
10+
INSERT INTO script_waypoint VALUES
11+
(17804, 0, -9054.86, 443.58, 93.05, 0, ''),
12+
(17804, 1, -9079.33, 424.49, 92.52, 0, ''),
13+
(17804, 2, -9086.21, 419.02, 92.32, 3000, ''),
14+
(17804, 3, -9086.21, 419.02, 92.32, 1000, ''),
15+
(17804, 4, -9079.33, 424.49, 92.52, 0, ''),
16+
(17804, 5, -9054.38, 436.30, 93.05, 0, ''),
17+
(17804, 6, -9042.23, 434.24, 93.37, 5000, 'SAY_SIGNAL_SENT');

0 commit comments

Comments
 (0)