Core/Scripting: Runes in UBRS Dragonspire Hall now activate and open door.

Closes #4414
This commit is contained in:
Malcrom committed 2013-06-23 11:32:57 -02:30
1 parent b669a2142e
commit 7c19fb8d0e
2 files changed
+249 -62

No files matched your search

@@ -18,25 +18,38 @@
#ifndef DEF_BLACKROCK_SPIRE_H #ifndef DEF_BLACKROCK_SPIRE_H
#define DEF_BLACKROCK_SPIRE_H #define DEF_BLACKROCK_SPIRE_H
enum Data uint32 const EncounterCount = 22;
#define UBRSScriptName "instance_blackrock_spire"
enum DataTypes
{ {
DATA_OMOKK, DATA_OMOKK = 0,
DATA_SHADOW_HUNTER_VOSHGAJIN, DATA_SHADOW_HUNTER_VOSHGAJIN = 1,
DATA_WARMASTER_VOONE, DATA_WARMASTER_VOONE = 2,
DATA_MOTHER_SMOLDERWEB, DATA_MOTHER_SMOLDERWEB = 3,
DATA_UROK_DOOMHOWL, // not scripted DATA_UROK_DOOMHOWL = 4, // not scripted
DATA_QUARTERMASTER_ZIGRIS, DATA_QUARTERMASTER_ZIGRIS = 5,
DATA_GIZRUL_THE_SLAVENER, // not scripted DATA_GIZRUL_THE_SLAVENER = 6, // not scripted
DATA_HALYCON, DATA_HALYCON = 7,
DATA_OVERLORD_WYRMTHALAK, DATA_OVERLORD_WYRMTHALAK = 8,
DATA_PYROGAURD_EMBERSEER, DATA_PYROGAURD_EMBERSEER = 9,
DATA_WARCHIEF_REND_BLACKHAND, DATA_WARCHIEF_REND_BLACKHAND = 10,
DATA_GYTH, DATA_GYTH = 11,
DATA_THE_BEAST, DATA_THE_BEAST = 12,
DATA_GENERAL_DRAKKISATH, DATA_GENERAL_DRAKKISATH = 13,
DATA_DRAGONSPIRE_ROOM, // Extra
DATA_DRAGONSPIRE_ROOM = 14,
DATA_ROOM_1_RUNE = 15,
DATA_ROOM_2_RUNE = 16,
DATA_ROOM_3_RUNE = 17,
DATA_ROOM_4_RUNE = 18,
DATA_ROOM_5_RUNE = 19,
DATA_ROOM_6_RUNE = 20,
DATA_ROOM_7_RUNE = 21
}; };
enum Npc
enum CreaturesIds
{ {
NPC_OMOKK = 9196, NPC_OMOKK = 9196,
NPC_SHADOW_HUNTER_VOSHGAJIN = 9236, NPC_SHADOW_HUNTER_VOSHGAJIN = 9236,
@@ -54,23 +67,21 @@ enum Npc
NPC_GENERAL_DRAKKISATH = 10363, NPC_GENERAL_DRAKKISATH = 10363,
NPC_BLACKHAND_DREADWEAVER = 9817, NPC_BLACKHAND_DREADWEAVER = 9817,
NPC_BLACKHAND_SUMMONER = 9818, NPC_BLACKHAND_SUMMONER = 9818,
NPC_BLACKHAND_VETERAN = 9819, NPC_BLACKHAND_VETERAN = 9819
}; };
enum AdditionalData enum AdditionalData
{ {
SPELL_SUMMON_ROOKERY_WHELP = 15745, SPELL_SUMMON_ROOKERY_WHELP = 15745,
MAX_ENCOUNTER = 14,
MAX_DRAGONSPIRE_HALL_RUNES = 7, MAX_DRAGONSPIRE_HALL_RUNES = 7,
EVENT_PYROGUARD_EMBERSEER = 4884, EVENT_PYROGUARD_EMBERSEER = 4884,
AREATRIGGER_ENTER_UBRS = 2046, AREATRIGGER_ENTER_UBRS = 2046,
AREATRIGGER_STADIUM = 2026, AREATRIGGER_STADIUM = 2026
}; };
enum GameObjects enum GameObjectsIds
{ {
GO_WHELP_SPAWNER = 175622, // trap spawned by go id 175124 GO_WHELP_SPAWNER = 175622, // trap spawned by go id 175124
// Doors // Doors
GO_EMBERSEER_IN = 175244, // First door to Pyroguard Emberseer GO_EMBERSEER_IN = 175244, // First door to Pyroguard Emberseer
GO_DOORS = 175705, // Second door to Pyroguard Emberseer GO_DOORS = 175705, // Second door to Pyroguard Emberseer
@@ -80,8 +91,7 @@ enum GameObjects
GO_GYTH_EXIT_DOOR = 175186, GO_GYTH_EXIT_DOOR = 175186,
GO_DRAKKISATH_DOOR_1 = 175946, GO_DRAKKISATH_DOOR_1 = 175946,
GO_DRAKKISATH_DOOR_2 = 175947, GO_DRAKKISATH_DOOR_2 = 175947,
// Runes in dragonspire hall
// Runes
GO_ROOM_1_RUNE = 175197, GO_ROOM_1_RUNE = 175197,
GO_ROOM_2_RUNE = 175199, GO_ROOM_2_RUNE = 175199,
GO_ROOM_3_RUNE = 175195, GO_ROOM_3_RUNE = 175195,
@@ -89,15 +99,14 @@ enum GameObjects
GO_ROOM_5_RUNE = 175198, GO_ROOM_5_RUNE = 175198,
GO_ROOM_6_RUNE = 175196, GO_ROOM_6_RUNE = 175196,
GO_ROOM_7_RUNE = 175194, GO_ROOM_7_RUNE = 175194,
// Runes in emberseers room
GO_EMBERSEER_RUNE_1 = 175266, GO_EMBERSEER_RUNE_1 = 175266,
GO_EMBERSEER_RUNE_2 = 175267, GO_EMBERSEER_RUNE_2 = 175267,
GO_EMBERSEER_RUNE_3 = 175268, GO_EMBERSEER_RUNE_3 = 175268,
GO_EMBERSEER_RUNE_4 = 175269, GO_EMBERSEER_RUNE_4 = 175269,
GO_EMBERSEER_RUNE_5 = 175270, GO_EMBERSEER_RUNE_5 = 175270,
GO_EMBERSEER_RUNE_6 = 175271, GO_EMBERSEER_RUNE_6 = 175271,
GO_EMBERSEER_RUNE_7 = 175272, GO_EMBERSEER_RUNE_7 = 175272
}; };
#endif #endif
@@ -15,50 +15,35 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "ObjectDefines.h"
#include "ObjectMgr.h"
#include "ScriptMgr.h" #include "ScriptMgr.h"
#include "ScriptedCreature.h" #include "ScriptedCreature.h"
#include "blackrock_spire.h" #include "blackrock_spire.h"
#include "InstanceScript.h"
uint32 const DragonspireRunes[7] = { GO_ROOM_1_RUNE, GO_ROOM_2_RUNE, GO_ROOM_3_RUNE, GO_ROOM_4_RUNE, GO_ROOM_5_RUNE, GO_ROOM_6_RUNE, GO_ROOM_7_RUNE };
uint32 const DragonspireMobs[3] = { NPC_BLACKHAND_DREADWEAVER, NPC_BLACKHAND_SUMMONER, NPC_BLACKHAND_VETERAN };
enum EventIds
{
EVENT_DARGONSPIRE_ROOM_STORE = 1,
EVENT_DARGONSPIRE_ROOM_CHECK = 2
};
class instance_blackrock_spire : public InstanceMapScript class instance_blackrock_spire : public InstanceMapScript
{ {
public: public:
instance_blackrock_spire() : InstanceMapScript("instance_blackrock_spire", 229) { } instance_blackrock_spire() : InstanceMapScript(UBRSScriptName, 229) { }
InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_blackrock_spireMapScript(map);
}
struct instance_blackrock_spireMapScript : public InstanceScript struct instance_blackrock_spireMapScript : public InstanceScript
{ {
instance_blackrock_spireMapScript(InstanceMap* map) : InstanceScript(map) {} instance_blackrock_spireMapScript(InstanceMap* map) : InstanceScript(map) { }
uint32 encounter[MAX_ENCOUNTER];
std::string m_strInstData;
uint64 HighlordOmokk;
uint64 ShadowHunterVoshgajin;
uint64 WarMasterVoone;
uint64 MotherSmolderweb;
uint64 UrokDoomhowl;
uint64 QuartermasterZigris;
uint64 GizrultheSlavener;
uint64 Halycon;
uint64 OverlordWyrmthalak;
uint64 PyroguardEmberseer;
uint64 WarchiefRendBlackhand;
uint64 Gyth;
uint64 TheBeast;
uint64 GeneralDrakkisath;
uint64 go_emberseerin;
uint64 go_doors;
uint64 go_emberseerout;
uint64 go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES];
uint8 Runemaxprotectors[MAX_DRAGONSPIRE_HALL_RUNES];
uint8 Runeprotectorsdead[MAX_DRAGONSPIRE_HALL_RUNES];
void Initialize() void Initialize()
{ {
SetBossNumber(MAX_ENCOUNTER); SetBossNumber(EncounterCount);
HighlordOmokk = 0; HighlordOmokk = 0;
ShadowHunterVoshgajin = 0; ShadowHunterVoshgajin = 0;
WarMasterVoone = 0; WarMasterVoone = 0;
@@ -78,9 +63,15 @@ public:
go_emberseerout = 0; go_emberseerout = 0;
} }
void OnPlayerEnter(Player* player)
{
if ((GetBossState(DATA_DRAGONSPIRE_ROOM) != DONE))
Events.ScheduleEvent(EVENT_DARGONSPIRE_ROOM_STORE, 4000);
}
bool IsEncounterInProgress() const bool IsEncounterInProgress() const
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < EncounterCount; ++i)
{ {
if (encounter[i] == IN_PROGRESS) if (encounter[i] == IN_PROGRESS)
return true; return true;
@@ -150,33 +141,56 @@ public:
break; break;
case GO_EMBERSEER_IN: case GO_EMBERSEER_IN:
go_emberseerin = go->GetGUID(); go_emberseerin = go->GetGUID();
if ((GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE))
go->SetGoState(GO_STATE_ACTIVE);
break; break;
case GO_DOORS: case GO_DOORS:
go_doors = go->GetGUID(); go_doors = go->GetGUID();
if ((GetBossState(DATA_DRAGONSPIRE_ROOM) == DONE))
go->SetGoState(GO_STATE_ACTIVE);
break; break;
case GO_EMBERSEER_OUT: case GO_EMBERSEER_OUT:
go_emberseerout = go->GetGUID(); go_emberseerout = go->GetGUID();
if ((GetBossState(DATA_PYROGAURD_EMBERSEER) == DONE))
go->SetGoState(GO_STATE_ACTIVE);
break; break;
case GO_ROOM_1_RUNE: case GO_ROOM_1_RUNE:
go_roomrunes[0] = go->GetGUID(); go_roomrunes[0] = go->GetGUID();
if ((GetBossState(DATA_ROOM_1_RUNE) == DONE))
go->SetGoState(GO_STATE_READY);
break; break;
case GO_ROOM_2_RUNE: case GO_ROOM_2_RUNE:
go_roomrunes[1] = go->GetGUID(); go_roomrunes[1] = go->GetGUID();
if ((GetBossState(DATA_ROOM_2_RUNE) == DONE))
go->SetGoState(GO_STATE_READY);
break; break;
case GO_ROOM_3_RUNE: case GO_ROOM_3_RUNE:
go_roomrunes[2] = go->GetGUID(); go_roomrunes[2] = go->GetGUID();
if ((GetBossState(DATA_ROOM_3_RUNE) == DONE))
go->SetGoState(GO_STATE_READY);
break; break;
case GO_ROOM_4_RUNE: case GO_ROOM_4_RUNE:
go_roomrunes[3] = go->GetGUID(); go_roomrunes[3] = go->GetGUID();
if ((GetBossState(DATA_ROOM_4_RUNE) == DONE))
go->SetGoState(GO_STATE_READY);
break; break;
case GO_ROOM_5_RUNE: case GO_ROOM_5_RUNE:
go_roomrunes[4] = go->GetGUID(); go_roomrunes[4] = go->GetGUID();
if ((GetBossState(DATA_ROOM_5_RUNE) == DONE))
go->SetGoState(GO_STATE_READY);
break; break;
case GO_ROOM_6_RUNE: case GO_ROOM_6_RUNE:
go_roomrunes[5] = go->GetGUID(); go_roomrunes[5] = go->GetGUID();
if ((GetBossState(DATA_ROOM_6_RUNE) == DONE))
go->SetGoState(GO_STATE_READY);
break; break;
case GO_ROOM_7_RUNE: case GO_ROOM_7_RUNE:
go_roomrunes[6] = go->GetGUID(); go_roomrunes[6] = go->GetGUID();
if ((GetBossState(DATA_ROOM_7_RUNE) == DONE))
go->SetGoState(GO_STATE_READY);
break; break;
} }
} }
@@ -202,7 +216,7 @@ public:
case DATA_GYTH: case DATA_GYTH:
case DATA_THE_BEAST: case DATA_THE_BEAST:
case DATA_GENERAL_DRAKKISATH: case DATA_GENERAL_DRAKKISATH:
break; case DATA_DRAGONSPIRE_ROOM:
default: default:
break; break;
} }
@@ -229,57 +243,192 @@ public:
{ {
case DATA_OMOKK: case DATA_OMOKK:
return HighlordOmokk; return HighlordOmokk;
break;
case DATA_SHADOW_HUNTER_VOSHGAJIN: case DATA_SHADOW_HUNTER_VOSHGAJIN:
return ShadowHunterVoshgajin; return ShadowHunterVoshgajin;
break;
case DATA_WARMASTER_VOONE: case DATA_WARMASTER_VOONE:
return WarMasterVoone; return WarMasterVoone;
break;
case DATA_MOTHER_SMOLDERWEB: case DATA_MOTHER_SMOLDERWEB:
return MotherSmolderweb; return MotherSmolderweb;
break;
case DATA_UROK_DOOMHOWL: case DATA_UROK_DOOMHOWL:
return UrokDoomhowl; return UrokDoomhowl;
break;
case DATA_QUARTERMASTER_ZIGRIS: case DATA_QUARTERMASTER_ZIGRIS:
return QuartermasterZigris; return QuartermasterZigris;
break;
case DATA_GIZRUL_THE_SLAVENER: case DATA_GIZRUL_THE_SLAVENER:
return GizrultheSlavener; return GizrultheSlavener;
break;
case DATA_HALYCON: case DATA_HALYCON:
return Halycon; return Halycon;
break;
case DATA_OVERLORD_WYRMTHALAK: case DATA_OVERLORD_WYRMTHALAK:
return OverlordWyrmthalak; return OverlordWyrmthalak;
break;
case DATA_PYROGAURD_EMBERSEER: case DATA_PYROGAURD_EMBERSEER:
return PyroguardEmberseer; return PyroguardEmberseer;
break;
case DATA_WARCHIEF_REND_BLACKHAND: case DATA_WARCHIEF_REND_BLACKHAND:
return WarchiefRendBlackhand; return WarchiefRendBlackhand;
break;
case DATA_GYTH: case DATA_GYTH:
return Gyth; return Gyth;
break;
case DATA_THE_BEAST: case DATA_THE_BEAST:
return TheBeast; return TheBeast;
break;
case DATA_GENERAL_DRAKKISATH: case DATA_GENERAL_DRAKKISATH:
return GeneralDrakkisath; return GeneralDrakkisath;
break;
case GO_EMBERSEER_IN: case GO_EMBERSEER_IN:
return go_emberseerin; return go_emberseerin;
break;
case GO_DOORS: case GO_DOORS:
return go_doors; return go_doors;
break;
case GO_EMBERSEER_OUT: case GO_EMBERSEER_OUT:
return go_emberseerout; return go_emberseerout;
break;
case GO_ROOM_1_RUNE: case GO_ROOM_1_RUNE:
return go_roomrunes[0]; return go_roomrunes[0];
break;
case GO_ROOM_2_RUNE: case GO_ROOM_2_RUNE:
return go_roomrunes[1]; return go_roomrunes[1];
case GO_ROOM_3_RUNE: case GO_ROOM_3_RUNE:
return go_roomrunes[2]; return go_roomrunes[2];
break;
case GO_ROOM_4_RUNE: case GO_ROOM_4_RUNE:
return go_roomrunes[3]; return go_roomrunes[3];
break;
case GO_ROOM_5_RUNE: case GO_ROOM_5_RUNE:
return go_roomrunes[4]; return go_roomrunes[4];
break;
case GO_ROOM_6_RUNE: case GO_ROOM_6_RUNE:
return go_roomrunes[5]; return go_roomrunes[5];
break;
case GO_ROOM_7_RUNE: case GO_ROOM_7_RUNE:
return go_roomrunes[6]; return go_roomrunes[6];
break;
} }
return 0; return 0;
} }
void Update(uint32 diff)
{
Events.Update(diff);
while (uint32 eventId = Events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_DARGONSPIRE_ROOM_STORE:
Dragonspireroomstore();
Events.ScheduleEvent(EVENT_DARGONSPIRE_ROOM_CHECK, 2500);
break;
case EVENT_DARGONSPIRE_ROOM_CHECK:
Dragonspireroomcheck();
if ((GetBossState(DATA_DRAGONSPIRE_ROOM) != DONE))
Events.ScheduleEvent(EVENT_DARGONSPIRE_ROOM_CHECK, 2500);
break;
default:
break;
}
}
}
void Dragonspireroomstore()
{
uint8 creaturecount = 0;
for (uint8 i = 0; i < 7; ++i)
{
if (GameObject* rune = instance->GetGameObject(go_roomrunes[i]))
{
for (uint8 ii = 0; ii < 3; ++ii)
{
std::list<Creature*> creatureList;
GetCreatureListWithEntryInGrid(creatureList, rune, DragonspireMobs[ii], 15.0f);
for (std::list<Creature*>::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr)
{
if (Creature* creatureList = *itr)
{
runecreaturelist[i] [creaturecount] = creatureList->GetGUID();
++creaturecount;
}
}
}
creaturecount = 0;
}
}
}
void Dragonspireroomcheck()
{
for (uint8 i = 0; i < 7; ++i)
{
bool _mobAlive = false;
if (GameObject* rune = instance->GetGameObject(go_roomrunes[i]))
{
if (rune->GetGoState() == GO_STATE_ACTIVE)
{
for (uint8 ii = 0; ii < 5; ++ii)
{
if (Creature* mob = instance->GetCreature(runecreaturelist[i] [ii]))
{
if (mob->IsAlive())
_mobAlive = true;
}
}
}
if (!_mobAlive && rune->GetGoState() == GO_STATE_ACTIVE)
{
rune->SetGoState(GO_STATE_READY);
switch (rune->GetEntry())
{
case GO_ROOM_1_RUNE:
SetBossState(DATA_ROOM_1_RUNE, DONE);
break;
case GO_ROOM_2_RUNE:
SetBossState(DATA_ROOM_2_RUNE, DONE);
break;
case GO_ROOM_3_RUNE:
SetBossState(DATA_ROOM_3_RUNE, DONE);
break;
case GO_ROOM_4_RUNE:
SetBossState(DATA_ROOM_4_RUNE, DONE);
break;
case GO_ROOM_5_RUNE:
SetBossState(DATA_ROOM_5_RUNE, DONE);
break;
case GO_ROOM_6_RUNE:
SetBossState(DATA_ROOM_6_RUNE, DONE);
break;
case GO_ROOM_7_RUNE:
SetBossState(DATA_ROOM_7_RUNE, DONE);
break;
}
}
if (GetBossState(DATA_ROOM_1_RUNE) == DONE && GetBossState(DATA_ROOM_2_RUNE) == DONE && GetBossState(DATA_ROOM_3_RUNE) == DONE &&
GetBossState(DATA_ROOM_4_RUNE) == DONE &&GetBossState(DATA_ROOM_5_RUNE) == DONE && GetBossState(DATA_ROOM_6_RUNE) == DONE &&
GetBossState(DATA_ROOM_7_RUNE) == DONE)
{
SetBossState(DATA_DRAGONSPIRE_ROOM, DONE);
if (GameObject* door1 = instance->GetGameObject(go_emberseerin))
door1->SetGoState(GO_STATE_ACTIVE);
if (GameObject* door2 = instance->GetGameObject(go_doors))
door2->SetGoState(GO_STATE_ACTIVE);
}
}
}
}
std::string GetSaveData() std::string GetSaveData()
{ {
OUT_SAVE_INST_DATA; OUT_SAVE_INST_DATA;
@@ -308,7 +457,7 @@ public:
if (dataHead1 == 'B' && dataHead2 == 'S') if (dataHead1 == 'B' && dataHead2 == 'S')
{ {
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) for (uint8 i = 0; i < EncounterCount; ++i)
{ {
uint32 tmpState; uint32 tmpState;
loadStream >> tmpState; loadStream >> tmpState;
@@ -319,8 +468,37 @@ public:
OUT_LOAD_INST_DATA_COMPLETE; OUT_LOAD_INST_DATA_COMPLETE;
} }
protected:
EventMap Events;
uint32 encounter[EncounterCount];
std::string m_strInstData;
uint64 HighlordOmokk;
uint64 ShadowHunterVoshgajin;
uint64 WarMasterVoone;
uint64 MotherSmolderweb;
uint64 UrokDoomhowl;
uint64 QuartermasterZigris;
uint64 GizrultheSlavener;
uint64 Halycon;
uint64 OverlordWyrmthalak;
uint64 PyroguardEmberseer;
uint64 WarchiefRendBlackhand;
uint64 Gyth;
uint64 TheBeast;
uint64 GeneralDrakkisath;
uint64 go_emberseerin;
uint64 go_doors;
uint64 go_emberseerout;
uint64 go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES];
uint64 runecreaturelist[7] [5];
}; };
InstanceScript* GetInstanceScript(InstanceMap* map) const
{
return new instance_blackrock_spireMapScript(map);
}
}; };
void AddSC_instance_blackrock_spire() void AddSC_instance_blackrock_spire()