diff --git a/sql/scriptdev2/scriptdev2.sql b/sql/scriptdev2/scriptdev2.sql index 04e84f4d631..7a760a33b3d 100644 --- a/sql/scriptdev2/scriptdev2.sql +++ b/sql/scriptdev2/scriptdev2.sql @@ -3186,7 +3186,10 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,commen (-1230043,'You can\'t hide from us. Prepare to burn!',0,1,0,0,'anvilrage guardsman SAY_GUARD_AGGRO'), (-1230044,'That one\'s empty!!',0,0,0,60,'rocknot SAY_BARREL_1'), (-1230045,'Ah, empty again!',0,0,0,35,'rocknot SAY_BARREL_2'), -(-1230046,'ALE!',0,0,0,60,'rocknot SAY_BARREL_3'); +(-1230046,'ALE!',0,0,0,60,'rocknot SAY_BARREL_3'), +(-1230047,'I\m out of here!',0,0,0,60,'rocknot SAY_ROCKNOT_DESPAWN'), +(-1230048,'HALT! There were...reports...of a...disturbance.',0,1,0,0,'Fireguard Destroyer YELL_PATROL_1'), +(-1230049,'We...are...investigating.',0,1,0,0,'Fireguard Destroyer YELL_PATROL_2'); -- -1 249 000 ONYXIA'S LAIR INSERT INTO script_texts (entry,content_default,sound,type,language,emote,comment) VALUES diff --git a/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp b/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp index 18fed28a769..168e8d71539 100644 --- a/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp +++ b/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.cpp @@ -681,7 +681,7 @@ struct npc_phalanxAI : public npc_escortAI switch (uiPointId) { case 0: - m_creature->SetFactionTemporary(14, TEMPFACTION_NONE); + m_creature->SetFactionTemporary(FACTION_DARK_IRON, TEMPFACTION_NONE); DoScriptText(YELL_PHALANX_AGGRO, m_creature); SetRun(true); break; @@ -760,16 +760,17 @@ struct npc_rocknotAI : public npc_escortAI { npc_rocknotAI(Creature* pCreature) : npc_escortAI(pCreature) { - m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData(); + m_pInstance = (instance_blackrock_depths*)pCreature->GetInstanceData(); Reset(); } - ScriptedInstance* m_pInstance; + instance_blackrock_depths* m_pInstance; uint32 m_uiBreakKegTimer; uint32 m_uiBreakDoorTimer; uint32 m_uiEmoteTimer; uint32 m_uiBarReactTimer; + bool m_bIsDoorOpen; void Reset() override { @@ -780,6 +781,7 @@ struct npc_rocknotAI : public npc_escortAI m_uiBreakDoorTimer = 0; m_uiEmoteTimer = 0; m_uiBarReactTimer = 0; + m_bIsDoorOpen = false; } void DoGo(uint32 id, uint32 state) @@ -836,8 +838,11 @@ struct npc_rocknotAI : public npc_escortAI { if (m_uiBreakDoorTimer <= uiDiff) { - // Open the bar back door - DoGo(GO_BAR_DOOR, 2); + // Open the bar back door if relevant + m_pInstance->GetBarDoorIsOpen(m_bIsDoorOpen); + if (!m_bIsDoorOpen) + DoGo(GO_BAR_DOOR, 2); + DoScriptText(SAY_BARREL_3, m_creature); DoGo(GO_BAR_KEG_TRAP, 0); // doesn't work very well, leaving code here for future // spell by trap has effect61 diff --git a/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.h b/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.h index 56e97f62b1d..00fba693659 100644 --- a/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.h +++ b/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/blackrock_depths.h @@ -7,7 +7,7 @@ enum { - MAX_ENCOUNTER = 10, + MAX_ENCOUNTER = 12, MAX_RELIC_DOORS = 12, MAX_DWARFS = 7, MAX_DWARF_RUNES = 7, @@ -23,6 +23,8 @@ enum TYPE_FLAMELASH = 8, TYPE_HURLEY = 9, TYPE_BRIDGE = 10, + TYPE_BAR = 11, + TYPE_PLUGGER = 12, NPC_EMPEROR = 9019, NPC_PRINCESS = 8929, @@ -38,6 +40,7 @@ enum NPC_WATCHER_DOOMGRIP = 9476, NPC_WARBRINGER_CONST = 8905, // Four of them in Relict Vault are related to Doomgrip summon event NPC_LOREGRAIN = 9024, + NPC_FIREGUARD_DESTROYER = 8911, // Jail Break event related NPC_OGRABISI = 9677, @@ -67,6 +70,9 @@ enum NPC_HURLEY_BLACKBREATH = 9537, NPC_BLACKBREATH_CRONY = 9541, NPC_PLUGGER_SPAZZRING = 9499, + NPC_PRIVATE_ROCKNOT = 9503, + NPC_MISTRESS_NAGMARA = 9500, + NPC_RIBBLY_SCREWSPIGGOT = 9543, GO_ARENA_1 = 161525, GO_ARENA_2 = 161522, @@ -112,6 +118,7 @@ enum FACTION_DWARF_HOSTILE = 754, // Hostile faction for the Tomb of the Seven dwarfs FACTION_ARENA_NEUTRAL = 15, // Neutral faction for NPC in top of Arena after event complete + FACTION_DARK_IRON = 54, // Hostile faction for the Grim Guzzler // enum used to handle the various Grim Guzzler bar patron's reaction // depending on the actions and events triggered by players @@ -120,7 +127,11 @@ enum PATRON_HOSTILE = 2, SAY_PISSED_PATRON_1 = -1230037, SAY_PISSED_PATRON_2 = -1230038, - SAY_PISSED_PATRON_3 = -1230039 + SAY_PISSED_PATRON_3 = -1230039, + SAY_ROCKNOT_DESPAWN = -1230047, + YELL_PATROL_1 = -1230048, + YELL_PATROL_2 = -1230049, + SPELL_NAGMARA_VANISH = 15341 }; // Random emotes for Grim Guzzler patrons @@ -184,6 +195,14 @@ static const float aVaultPositions[4] = {821.905f, -338.382f, -50.134f, 3.78736f // Used to summon Hurley Blackbreath static const float aHurleyPositions[4] = {856.0867f, -149.7469f, -49.6719f, 0.05949629f}; +// Used to summon the patrol in Grim Guzzler +static const float aBarPatrolPositions[2][4] = { + {872.7059f, -232.5491f, -43.7525f, 2.069044f}, + {865.5645f, -219.7471f, -43.7033f, 2.033881f} +}; + +static const uint32 aBarPatrolId[3] = {NPC_FIREGUARD_DESTROYER, NPC_ANVILRAGE_OFFICER, NPC_ANVILRAGE_OFFICER}; + // Tomb of the Seven dwarfs static const uint32 aTombDwarfes[MAX_DWARFS] = {NPC_ANGERREL, NPC_SEETHREL, NPC_DOPEREL, NPC_GLOOMREL, NPC_VILEREL, NPC_HATEREL, NPC_DOOMREL}; @@ -216,7 +235,7 @@ class instance_blackrock_depths : public ScriptedInstance // Bar events void SetBarDoorIsOpen() { m_bIsBarDoorOpen = true; } - bool GetBarDoorIsOpen() { return m_bIsBarDoorOpen; } + void GetBarDoorIsOpen(bool& bIsOpen) { bIsOpen = m_bIsBarDoorOpen; } private: void DoCallNextDwarf(); @@ -231,6 +250,8 @@ class instance_blackrock_depths : public ScriptedInstance uint32 m_uiPatronEmoteTimer; void HandleBarPatrons(uint8 uiEventType); uint8 m_uiBrokenKegs; + void HandleBarPatrol(uint8 uiStep); + uint32 m_uiPatrolTimer; uint8 m_uiCofferDoorsOpened; @@ -242,6 +263,7 @@ class instance_blackrock_depths : public ScriptedInstance GuidSet m_sVaultNpcGuids; GuidSet m_sArenaCrowdNpcGuids; GuidSet m_sBarPatronNpcGuids; + GuidSet m_sBarPatrolGuids; }; #endif diff --git a/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp b/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp index 84dd5e16e1c..116f1435108 100644 --- a/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp +++ b/src/scriptdev2/scripts/eastern_kingdoms/blackrock_depths/instance_blackrock_depths.cpp @@ -31,6 +31,7 @@ instance_blackrock_depths::instance_blackrock_depths(Map* pMap) : ScriptedInstan m_uiDwarfRound(0), m_uiDwarfFightTimer(0), m_uiPatronEmoteTimer(2000), + m_uiPatrolTimer(0), m_fArenaCenterX(0.0f), m_fArenaCenterY(0.0f), @@ -70,9 +71,9 @@ void instance_blackrock_depths::OnCreatureCreate(Creature* pCreature) case NPC_TOBIAS: case NPC_DUGHAL: case NPC_LOREGRAIN: + case NPC_RIBBLY_SCREWSPIGGOT: m_mNpcEntryGuidStore[pCreature->GetEntry()] = pCreature->GetObjectGuid(); break; - case NPC_WARBRINGER_CONST: // Golems not in the Relict Vault? if (std::abs(pCreature->GetPositionZ() - aVaultPositions[2]) > 1.0f || !pCreature->IsWithinDist2d(aVaultPositions[0], aVaultPositions[1], 20.0f)) @@ -103,6 +104,14 @@ void instance_blackrock_depths::OnCreatureCreate(Creature* pCreature) case NPC_GUZZLING_PATRON: case NPC_HAMMERED_PATRON: m_sBarPatronNpcGuids.insert(pCreature->GetObjectGuid()); + if (m_auiEncounter[11] == DONE) + pCreature->SetFactionTemporary(FACTION_DARK_IRON, TEMPFACTION_RESTORE_RESPAWN); + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + break; + case NPC_PRIVATE_ROCKNOT: + case NPC_MISTRESS_NAGMARA: + if (m_auiEncounter[11] == DONE) + pCreature->ForcedDespawn(); break; } } @@ -143,14 +152,20 @@ void instance_blackrock_depths::OnObjectCreate(GameObject* pGo) case GO_DWARFRUNE_G01: break; case GO_BAR_DOOR: - if (GetData(TYPE_ROCKNOT) == DONE) - { - // Rocknot event done: set the Grim Guzzler door animation to "broken" - // tell the instance script it is open to prevent some of the other events - pGo->SetGoState(GOState(2)); - SetBarDoorIsOpen(); - } - break; + if (GetData(TYPE_ROCKNOT) == DONE) + { + // Rocknot event done: set the Grim Guzzler door animation to "broken" + // tell the instance script it is open to prevent some of the other events + pGo->SetGoState(GOState(2)); + SetBarDoorIsOpen(); + } else if (m_auiEncounter[10] == DONE || m_auiEncounter[11] == DONE) + { + // bar or Plugger event done: open the Grim Guzzler door + // tell the instance script it is open to prevent some of the other events + DoUseDoorOrButton(GO_BAR_DOOR); + SetBarDoorIsOpen(); + } + break; default: return; @@ -328,6 +343,14 @@ void instance_blackrock_depths::SetData(uint32 uiType, uint32 uiData) case TYPE_BRIDGE: m_auiEncounter[9] = uiData; return; + case TYPE_BAR: + if (uiData == IN_PROGRESS) + HandleBarPatrol(0); + m_auiEncounter[10] = uiData; + break; + case TYPE_PLUGGER: + m_auiEncounter[11] = uiData; + return; } if (uiData == DONE) @@ -338,7 +361,7 @@ void instance_blackrock_depths::SetData(uint32 uiType, uint32 uiData) saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8] << " " - << m_auiEncounter[9]; + << m_auiEncounter[9] << " " << m_auiEncounter[10] << " " << m_auiEncounter[11]; m_strInstData = saveStream.str(); @@ -374,6 +397,10 @@ uint32 instance_blackrock_depths::GetData(uint32 uiType) const return m_auiEncounter[8]; case TYPE_BRIDGE: return m_auiEncounter[9]; + case TYPE_BAR: + return m_auiEncounter[10]; + case TYPE_PLUGGER: + return m_auiEncounter[11]; default: return 0; } @@ -392,7 +419,7 @@ void instance_blackrock_depths::Load(const char* chrIn) std::istringstream loadStream(chrIn); loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] - >> m_auiEncounter[8] >> m_auiEncounter[9]; + >> m_auiEncounter[8] >> m_auiEncounter[9] >> m_auiEncounter[10] >> m_auiEncounter[11]; for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) if (m_auiEncounter[i] == IN_PROGRESS) @@ -484,6 +511,14 @@ void instance_blackrock_depths::OnCreatureDeath(Creature* pCreature) case NPC_HURLEY_BLACKBREATH: SetData(TYPE_HURLEY, DONE); break; + case NPC_RIBBLY_SCREWSPIGGOT: + // Do nothing if the patrol was already spawned or is about to: + // Plugger has made the bar hostile + if (GetData(TYPE_BAR) == IN_PROGRESS || GetData(TYPE_PLUGGER) == IN_PROGRESS || GetData(TYPE_BAR) == DONE || GetData(TYPE_PLUGGER) == DONE) + return; + else + SetData(TYPE_BAR, IN_PROGRESS); + break; } } @@ -569,15 +604,103 @@ void instance_blackrock_depths::HandleBarPatrons(uint8 uiEventType) } } return; - // case when Plugger is aggroed/pickpocketed + // case when Plugger is killed/pickpocketed or mad from stealing case PATRON_HOSTILE: - // Placeholder + for (GuidSet::const_iterator itr = m_sBarPatronNpcGuids.begin(); itr != m_sBarPatronNpcGuids.end(); ++itr) + { + if (Creature* pPatron = instance->GetCreature(*itr)) + { + pPatron->SetFactionTemporary(FACTION_DARK_IRON, TEMPFACTION_RESTORE_RESPAWN); + pPatron->SetStandState(UNIT_STAND_STATE_STAND); + // Patron should also start random movement around their current position (= home) + } + } + // Mistress Nagmara and Private Rocknot despawn if the bar turns hostile + if (Creature* pRocknot = GetSingleCreatureFromStorage(NPC_PRIVATE_ROCKNOT)) + { + DoScriptText(SAY_ROCKNOT_DESPAWN, pRocknot); + pRocknot->ForcedDespawn(); + } + if (Creature* pNagmara = GetSingleCreatureFromStorage(NPC_MISTRESS_NAGMARA)) + { + pNagmara->AI()->DoCastSpellIfCan(pNagmara, SPELL_NAGMARA_VANISH); + pNagmara->ForcedDespawn(); + } return; default: return; } } +void instance_blackrock_depths::HandleBarPatrol(uint8 uiStep) +{ + if (GetData(TYPE_BAR) == DONE) + return; + + switch (uiStep) + { + case 0: + if (Creature* pPlugger = GetSingleCreatureFromStorage(NPC_PLUGGER_SPAZZRING)) + { + // if relevant, open the bar door and tell the instance it is open + if (!m_bIsBarDoorOpen) + { + DoUseDoorOrButton(GO_BAR_DOOR); + SetBarDoorIsOpen(); + } + + // One Fireguard Destroyer and two Anvilrage Officers are spawned + for (uint8 i = 0; i < 3; ++i) + { + float fX, fY, fZ; + // spawn them behind the bar door + pPlugger->GetRandomPoint(aBarPatrolPositions[0][0], aBarPatrolPositions[0][1], aBarPatrolPositions[0][2], 2.0f, fX, fY, fZ); + if (Creature* pSummoned = pPlugger->SummonCreature(aBarPatrolId[i], fX, fY, fZ, aBarPatrolPositions[0][3], TEMPSUMMON_DEAD_DESPAWN, 0)) + { + m_sBarPatrolGuids.insert(pSummoned->GetObjectGuid()); + // move them to the Grim Guzzler + pPlugger->GetRandomPoint(aBarPatrolPositions[1][0], aBarPatrolPositions[1][1], aBarPatrolPositions[1][2], 2.0f, fX, fY, fZ); + pSummoned->GetMotionMaster()->MoveIdle(); + pSummoned->GetMotionMaster()->MovePoint(0,fX, fY, fZ); + } + } + // start timer to handle the yells + m_uiPatrolTimer = 4000; + break; + } + case 1: + for (GuidSet::const_iterator itr = m_sBarPatrolGuids.begin(); itr != m_sBarPatrolGuids.end(); ++itr) + { + if (Creature* pTmp = instance->GetCreature(*itr)) + { + if (pTmp->GetEntry() == NPC_FIREGUARD_DESTROYER) + { + DoScriptText(YELL_PATROL_1, pTmp); + SetData(TYPE_BAR, SPECIAL); // temporary set the status to special before the next yell: event will then be complete + m_uiPatrolTimer = 2000; + break; + } + } + } + break; + case 2: + for (GuidSet::const_iterator itr = m_sBarPatrolGuids.begin(); itr != m_sBarPatrolGuids.end(); ++itr) + { + if (Creature* pTmp = instance->GetCreature(*itr)) + { + if (pTmp->GetEntry() == NPC_FIREGUARD_DESTROYER) + { + DoScriptText(YELL_PATROL_2, pTmp); + SetData(TYPE_BAR, DONE); + m_uiPatrolTimer = 0; + break; + } + } + } + break; + } +} + void instance_blackrock_depths::Update(uint32 uiDiff) { if (m_uiDwarfFightTimer) @@ -607,6 +730,26 @@ void instance_blackrock_depths::Update(uint32 uiDiff) else m_uiPatronEmoteTimer -= uiDiff; } + + if (m_uiPatrolTimer) + { + if (m_uiPatrolTimer <= uiDiff) + { + switch(GetData(TYPE_BAR)) + { + case IN_PROGRESS: + HandleBarPatrol(1); + break; + case SPECIAL: + HandleBarPatrol(2); + break; + default: + break; + } + } + else + m_uiPatrolTimer -= uiDiff; + } } InstanceData* GetInstanceData_instance_blackrock_depths(Map* pMap)