diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp | 66 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/shadowfang_keep/shadowfang_keep.cpp | 54 |
2 files changed, 107 insertions, 13 deletions
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; |