diff options
3 files changed, 153 insertions, 13 deletions
diff --git a/sql/updates/r991_scriptdev2.sql b/sql/updates/r991_scriptdev2.sql new file mode 100644 index 00000000000..b75da0b15d4 --- /dev/null +++ b/sql/updates/r991_scriptdev2.sql @@ -0,0 +1,46 @@ +DELETE FROM script_waypoint WHERE entry=3849; +INSERT INTO script_waypoint VALUES +(3849, 0, -250.923431, 2116.264160, 81.179, 0, 'SAY_FREE_AD'), +(3849, 1, -255.048538, 2119.392578, 81.179, 0, ''), +(3849, 2, -254.129105, 2123.454346, 81.179, 0, ''), +(3849, 3, -253.897552, 2130.873535, 81.179, 0, ''), +(3849, 4, -249.889435, 2142.307861, 86.972, 0, ''), +(3849, 5, -248.204926, 2144.017090, 87.013, 0, ''), +(3849, 6, -240.552826, 2140.552734, 87.012, 0, ''), +(3849, 7, -237.513916, 2142.066650, 87.012, 0, ''), +(3849, 8, -235.638138, 2149.231689, 90.587, 0, ''), +(3849, 9, -237.188019, 2151.946045, 90.624, 0, ''), +(3849, 10, -241.162064, 2153.649658, 90.624, 0, 'SAY_OPEN_DOOR_AD'), +(3849, 11, -241.129700, 2154.562988, 90.624, 5000, ''), +(3849, 12, -241.129700, 2154.562988, 90.624, 5000, 'SAY_POST1_DOOR_AD'), +(3849, 13, -241.129700, 2154.562988, 90.624, 25000, 'SAY_POST2_DOOR_AD'); + +DELETE FROM script_waypoint WHERE entry=3850; +INSERT INTO script_waypoint VALUES +(3850, 0, -241.816895, 2122.904053, 81.179, 0, 'SAY_FREE_AS'), +(3850, 1, -247.139297, 2124.886475, 81.179, 0, ''), +(3850, 2, -253.179184, 2127.406738, 81.179, 0, ''), +(3850, 3, -253.897552, 2130.873535, 81.179, 0, ''), +(3850, 4, -249.889435, 2142.307861, 86.972, 0, ''), +(3850, 5, -248.204926, 2144.017090, 87.013, 0, ''), +(3850, 6, -240.552826, 2140.552734, 87.012, 0, ''), +(3850, 7, -237.513916, 2142.066650, 87.012, 0, ''), +(3850, 8, -235.638138, 2149.231689, 90.587, 0, ''), +(3850, 9, -237.188019, 2151.946045, 90.624, 0, ''), +(3850, 10, -241.162064, 2153.649658, 90.624, 0, 'SAY_OPEN_DOOR_AS'), +(3850, 11, -241.129700, 2154.562988, 90.624, 5000, 'cast'), +(3850, 12, -241.129700, 2154.562988, 90.624, 5000, 'SAY_POST_DOOR_AS'), +(3850, 13, -241.129700, 2154.562988, 90.624, 25000, ''); + +UPDATE script_texts SET content_default='Follow me and I\'ll open the courtyard door for you.', language=7, comment='prisoner ashcrombe SAY_FREE_AS' WHERE entry=-1033000; + +DELETE FROM script_texts WHERE entry BETWEEN -1033008 AND -1033001; +INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES +(-1033001,'I have just the spell to get this door open. Too bad the cell doors weren\'t locked so haphazardly.',0,0,7,1,'prisoner ashcrombe SAY_OPEN_DOOR_AS'), +(-1033002,'There it is! Wide open. Good luck to you conquering what lies beyond. I must report back to the Kirin Tor at once!',0,0,7,1,'prisoner ashcrombe SAY_POST_DOOR_AS'), +(-1033003,'Free from this wretched cell at last! Let me show you to the courtyard....',0,0,1,1,'prisoner adamant SAY_FREE_AD'), +(-1033004,'You are indeed courageous for wanting to brave the horrors that lie beyond this door.',0,0,1,1,'prisoner adamant SAY_OPEN_DOOR_AD'), +(-1033005,'There we go!',0,0,1,1,'prisoner adamant SAY_POST1_DOOR_AD'), +(-1033006,'Good luck with Arugal. I must hurry back to Hadrec now.',0,0,1,1,'prisoner adamant SAY_POST2_DOOR_AD'), +(-1033007,'About time someone killed the wretch.',0,0,1,1,'prisoner adamant SAY_BOSS_DIE_AD'), +(-1033008,'For once I agree with you... scum.',0,0,7,1,'prisoner ashcrombe SAY_BOSS_DIE_AS'); diff --git a/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp b/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp index 0364c132447..3a788d2e863 100644 --- a/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp +++ b/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp @@ -26,6 +26,18 @@ EndScriptData */ #define ENCOUNTERS 4 +enum +{ + SAY_BOSS_DIE_AD = -1033007, + SAY_BOSS_DIE_AS = -1033008, + + NPC_ASH = 3850, + NPC_ADA = 3849, + + GO_COURTYARD_DOOR = 18895, //door to open when talking to NPC's + GO_SORCERER_DOOR = 18972, //door to open when Fenrus the Devourer + GO_ARUGAL_DOOR = 18971 //door to open when Wolf Master Nandos +}; struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance { instance_shadowfang_keep(Map *map) : ScriptedInstance(map) {Initialize();}; @@ -33,12 +45,18 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance uint32 Encounter[ENCOUNTERS]; std::string str_data; + uint64 uiAshGUID; + uint64 uiAdaGUID; + uint64 DoorCourtyardGUID; uint64 DoorSorcererGUID; uint64 DoorArugalGUID; void Initialize() { + uiAshGUID = 0; + uiAdaGUID = 0; + DoorCourtyardGUID = 0; DoorSorcererGUID = 0; DoorArugalGUID = 0; @@ -63,13 +81,34 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance return NULL; } + void OnCreatureCreate(Creature* pCreature, uint32 uiCreature) + { + switch(pCreature->GetEntry()) + { + case NPC_ASH: uiAshGUID = pCreature->GetGUID(); break; + case NPC_ADA: uiAdaGUID = pCreature->GetGUID(); break; + } + } + void OnObjectCreate(GameObject *go) { switch(go->GetEntry()) { - case 18895: DoorCourtyardGUID = go->GetGUID(); break; - case 18972: DoorSorcererGUID = go->GetGUID(); break; - case 18971: DoorArugalGUID = go->GetGUID(); break; + case GO_COURTYARD_DOOR: + DoorCourtyardGUID = go->GetGUID(); + if (Encounter[0] == DONE) + go->SetGoState(0); + break; + case GO_SORCERER_DOOR: + DoorSorcererGUID = go->GetGUID(); + if (Encounter[2] == DONE) + go->SetGoState(0); + break; + case GO_ARUGAL_DOOR: + DoorArugalGUID = go->GetGUID(); + if (Encounter[3] == DONE) + go->SetGoState(0); + break; } } @@ -87,6 +126,23 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance go->SetGoState(state); } + void DoSpeech() + { + Player* pPlayer = GetPlayerInMap(); + + if (pPlayer) + { + Unit* pAda = Unit::GetUnit(*pPlayer,uiAdaGUID); + Unit* pAsh = Unit::GetUnit(*pPlayer,uiAshGUID); + + if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive()) + { + DoScriptText(SAY_BOSS_DIE_AD,pAda); + DoScriptText(SAY_BOSS_DIE_AS,pAsh); + } + } + } + void SetData(uint32 type, uint32 data) { switch(type) @@ -97,6 +153,8 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance Encounter[0] = data; break; case TYPE_RETHILGORE: + if (data == DONE) + DoSpeech(); Encounter[1] = data; break; case TYPE_FENRUS: @@ -160,8 +218,10 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance loadStream >> Encounter[0] >> Encounter[1] >> Encounter[2] >> Encounter[3]; for(uint8 i = 0; i < ENCOUNTERS; ++i) + { if (Encounter[i] == IN_PROGRESS) Encounter[i] = NOT_STARTED; + } OUT_LOAD_INST_DATA_COMPLETE; } diff --git a/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp b/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp index 6c8f0939b5c..f4b49b5f524 100644 --- a/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp +++ b/src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp @@ -35,7 +35,16 @@ EndContentData */ enum { - SAY_FREE = -1033000 + SAY_FREE_AS = -1033000, + SAY_OPEN_DOOR_AS = -1033001, + SAY_POST_DOOR_AS = -1033002, + SAY_FREE_AD = -1033003, + SAY_OPEN_DOOR_AD = -1033004, + SAY_POST1_DOOR_AD = -1033005, + SAY_POST2_DOOR_AD = -1033006, + + SPELL_UNLOCK = 6421, + NPC_ASH = 3850 }; #define GOSSIP_ITEM_DOOR "Thanks, I'll follow you to the door." @@ -45,16 +54,45 @@ struct TRINITY_DLL_DECL npc_shadowfang_prisonerAI : public npc_escortAI npc_shadowfang_prisonerAI(Creature *c) : npc_escortAI(c) { pInstance = ((ScriptedInstance*)c->GetInstanceData()); + uiNpcEntry = c->GetEntry(); } ScriptedInstance *pInstance; + uint32 uiNpcEntry; - void WaypointReached(uint32 i) + void WaypointReached(uint32 uiPoint) { - if( pInstance && i == 6) + switch(uiPoint) { - DoScriptText(SAY_FREE, m_creature); - pInstance->SetData(TYPE_FREE_NPC, DONE); + case 0: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_FREE_AS, m_creature); + else + DoScriptText(SAY_FREE_AD, m_creature); + break; + case 10: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_OPEN_DOOR_AS, m_creature); + else + DoScriptText(SAY_OPEN_DOOR_AD, m_creature); + break; + case 11: + if (uiNpcEntry == NPC_ASH) + DoCast(m_creature, SPELL_UNLOCK); + break; + case 12: + if (uiNpcEntry == NPC_ASH) + DoScriptText(SAY_POST_DOOR_AS, m_creature); + else + DoScriptText(SAY_POST1_DOOR_AD, m_creature); + + if (pInstance) + pInstance->SetData(TYPE_FREE_NPC, DONE); + break; + case 13: + if (uiNpcEntry != NPC_ASH) + DoScriptText(SAY_POST2_DOOR_AD, m_creature); + break; } } @@ -93,16 +131,12 @@ bool GossipSelect_npc_shadowfang_prisoner(Player* pPlayer, Creature* pCreature, return true; } -/*###### -## AddSC -######*/ - void AddSC_shadowfang_keep() { Script *newscript; newscript = new Script; - newscript->Name="npc_shadowfang_prisoner"; + newscript->Name = "npc_shadowfang_prisoner"; newscript->pGossipHello = &GossipHello_npc_shadowfang_prisoner; newscript->pGossipSelect = &GossipSelect_npc_shadowfang_prisoner; newscript->GetAI = &GetAI_npc_shadowfang_prisoner; |
