*Update Blood Furnace script; correctly set instance data and correctly manage doors upon boss kill. Based somewhat on the original script by Paytheo.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2009-06-16 00:51:09 +02:00
parent ef28e35c89
commit a9c75c023b
5 changed files with 256 additions and 40 deletions

View File

@@ -22,6 +22,8 @@ SDCategory: Hellfire Citadel, Blood Furnace
EndScriptData */
#include "precompiled.h"
#include "def_blood_furnace.h"
#define SAY_AGGRO -1542008
@@ -33,8 +35,14 @@ EndScriptData */
struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI
{
boss_broggokAI(Creature *c) : ScriptedAI(c) {}
boss_broggokAI(Creature *c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
Reset();
}
ScriptedInstance* pInstance;
uint32 AcidSpray_Timer;
uint32 PoisonSpawn_Timer;
uint32 PoisonBolt_Timer;
@@ -44,11 +52,17 @@ struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI
AcidSpray_Timer = 10000;
PoisonSpawn_Timer = 5000;
PoisonBolt_Timer = 7000;
ToggleDoors(0, DATA_DOOR4);
if(pInstance)
pInstance->SetData(TYPE_BROGGOK_EVENT, NOT_STARTED);
}
void EnterCombat(Unit *who)
{
DoScriptText(SAY_AGGRO, m_creature);
ToggleDoors(1, DATA_DOOR4);
if(pInstance)
pInstance->SetData(TYPE_BROGGOK_EVENT, IN_PROGRESS);
}
void JustSummoned(Creature *summoned)
@@ -84,6 +98,28 @@ struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI
DoMeleeAttackIfReady();
}
void JustDied(Unit* who)
{
ToggleDoors(0, DATA_DOOR4);
ToggleDoors(0, DATA_DOOR5);
if(pInstance)
pInstance->SetData(TYPE_BROGGOK_EVENT, DONE);
}
void ToggleDoors(uint8 close, uint64 DOOR)
{
if (pInstance)
{
if (GameObject* Doors = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DOOR)))
{
if (close == 1)
Doors->SetGoState(GO_STATE_READY); // Closed
else
Doors->SetGoState(GO_STATE_ACTIVE); // Open
}
}
}
};
CreatureAI* GetAI_boss_broggok(Creature *_Creature)

View File

@@ -68,7 +68,8 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
{
pInstance = (c->GetInstanceData());
HeroicMode = m_creature->GetMap()->IsHeroic();
for(int i=0; i<5; ++i) Channelers[i] = 0;
for(int i=0; i<5; ++i)
Channelers[i] = 0;
}
ScriptedInstance* pInstance;
@@ -92,14 +93,18 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
Firenova = false;
addYell = false;
SummonChannelers();
if(pInstance)
pInstance->SetData(TYPE_KELIDAN_THE_BREAKER_EVENT, NOT_STARTED);
}
void EnterCombat(Unit *who)
{
DoScriptText(SAY_WAKE, m_creature);
if (m_creature->IsNonMeleeSpellCasted(false))
m_creature->InterruptNonMeleeSpells(true);
DoStartMovement(who);
if(pInstance)
pInstance->SetData(TYPE_KELIDAN_THE_BREAKER_EVENT, IN_PROGRESS);
}
void KilledUnit(Unit* victim)
@@ -178,8 +183,11 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
void JustDied(Unit* Killer)
{
DoScriptText(SAY_DIE, m_creature);
if(pInstance)
pInstance->SetData(DATA_KELIDANEVENT, DONE);
ToggleDoors(0, DATA_DOOR1);
ToggleDoors(0, DATA_DOOR6);
if(pInstance)
pInstance->SetData(TYPE_KELIDAN_THE_BREAKER_EVENT, DONE);
}
void UpdateAI(const uint32 diff)
@@ -248,6 +256,20 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
DoMeleeAttackIfReady();
}
void ToggleDoors(uint8 close, uint64 DOOR)
{
if (pInstance)
{
if (GameObject* Doors = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DOOR)))
{
if (close == 1)
Doors->SetGoState(GO_STATE_READY); // Closed
else
Doors->SetGoState(GO_STATE_ACTIVE); // Open
}
}
}
};
CreatureAI* GetAI_boss_kelidan_the_breaker(Creature *_Creature)

View File

@@ -22,6 +22,7 @@ SDCategory: Hellfire Citadel, Blood Furnace
EndScriptData */
#include "precompiled.h"
#include "def_blood_furnace.h"
#define SAY_AGGRO_1 -1542009
#define SAY_AGGRO_2 -1542010
@@ -37,7 +38,13 @@ EndScriptData */
struct TRINITY_DLL_DECL boss_the_makerAI : public ScriptedAI
{
boss_the_makerAI(Creature *c) : ScriptedAI(c) {}
boss_the_makerAI(Creature *c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
Reset();
}
ScriptedInstance* pInstance;
uint32 AcidSpray_Timer;
uint32 ExplodingBreaker_Timer;
@@ -49,9 +56,13 @@ struct TRINITY_DLL_DECL boss_the_makerAI : public ScriptedAI
AcidSpray_Timer = 15000;
ExplodingBreaker_Timer = 6000;
Domination_Timer = 120000;
Knockdown_Timer = 10000;
Knockdown_Timer = 10000;
ToggleDoors(0, DATA_DOOR2);
if(pInstance)
pInstance->SetData(TYPE_THE_MAKER_EVENT, NOT_STARTED);
}
void EnterCombat(Unit *who)
{
switch(rand()%3)
@@ -60,6 +71,10 @@ struct TRINITY_DLL_DECL boss_the_makerAI : public ScriptedAI
case 1: DoScriptText(SAY_AGGRO_2, m_creature); break;
case 2: DoScriptText(SAY_AGGRO_3, m_creature); break;
}
ToggleDoors(1, DATA_DOOR2);
if(pInstance)
pInstance->SetData(TYPE_THE_MAKER_EVENT, IN_PROGRESS);
}
void KilledUnit(Unit* victim)
@@ -74,7 +89,12 @@ struct TRINITY_DLL_DECL boss_the_makerAI : public ScriptedAI
void JustDied(Unit* Killer)
{
DoScriptText(SAY_DIE, m_creature);
}
ToggleDoors(0, DATA_DOOR2);
ToggleDoors(0, DATA_DOOR3);
if(pInstance)
pInstance->SetData(TYPE_THE_MAKER_EVENT, DONE);
}
void UpdateAI(const uint32 diff)
{
@@ -114,6 +134,20 @@ struct TRINITY_DLL_DECL boss_the_makerAI : public ScriptedAI
DoMeleeAttackIfReady();
}
void ToggleDoors(uint8 close, uint64 DOOR)
{
if (pInstance)
{
if (GameObject* Doors = GameObject::GetGameObject(*m_creature, pInstance->GetData64(DOOR)))
{
if (close == 1)
Doors->SetGoState(GO_STATE_READY); // Closed
else
Doors->SetGoState(GO_STATE_ACTIVE); // Open
}
}
}
};
CreatureAI* GetAI_boss_the_makerAI(Creature *_Creature)

View File

@@ -1,10 +1,42 @@
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software licensed under GPL version 2
* Please see the included DOCS/LICENSE.TXT for more information */
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DEF_BLOOD_FURNACE_H
#define DEF_BLOOD_FURNACE_H
#define DATA_KELIDANEVENT 1
#define DATA_THE_MAKER 1
#define DATA_BROGGOK 2
#define DATA_KELIDAN_THE_MAKER 3
#define TYPE_THE_MAKER_EVENT 4
#define TYPE_BROGGOK_EVENT 5
#define TYPE_KELIDAN_THE_BREAKER_EVENT 6
#define DATA_DOOR1 7
#define DATA_DOOR2 8
#define DATA_DOOR3 9
#define DATA_DOOR4 10
#define DATA_DOOR5 11
#define DATA_DOOR6 12
#define DATA_PRISON_CELL1 13
#define DATA_PRISON_CELL2 14
#define DATA_PRISON_CELL3 15
#define DATA_PRISON_CELL4 16
#define DATA_PRISON_CELL5 17
#define DATA_PRISON_CELL6 18
#define DATA_PRISON_CELL7 19
#define DATA_PRISON_CELL8 20
#endif

View File

@@ -26,63 +26,155 @@ EndScriptData */
#define ENTRY_SEWER1 181823
#define ENTRY_SEWER2 181766
#define ENCOUNTERS 3
struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance
{
instance_blood_furnace(Map *map) : ScriptedInstance(map) {Initialize();};
uint64 The_MakerGUID;
uint64 BroggokGUID;
uint64 Kelidan_The_BreakerGUID;
uint64 Sewer1GUID;
uint64 Sewer2GUID;
uint64 Door1GUID;
uint64 Door2GUID;
uint64 Door3GUID;
uint64 Door4GUID;
uint64 Door5GUID;
uint64 Door6GUID;
uint64 PrisonCell1GUID;
uint64 PrisonCell2GUID;
uint64 PrisonCell3GUID;
uint64 PrisonCell4GUID;
uint64 PrisonCell5GUID;
uint64 PrisonCell6GUID;
uint64 PrisonCell7GUID;
uint64 PrisonCell8GUID;
uint32 Encounter[ENCOUNTERS];
void Initialize()
{
Sewer1GUID = 0;
Sewer2GUID = 0;
The_MakerGUID = 0;
BroggokGUID = 0;
Kelidan_The_BreakerGUID = 0;
Door1GUID = 0;
Door2GUID = 0;
Door3GUID = 0;
Door4GUID = 0;
Door5GUID = 0;
Door6GUID = 0;
PrisonCell1GUID = 0;
PrisonCell2GUID = 0;
PrisonCell3GUID = 0;
PrisonCell4GUID = 0;
PrisonCell5GUID = 0;
PrisonCell6GUID = 0;
PrisonCell7GUID = 0;
PrisonCell8GUID = 0;
for(uint8 i = 0; i < ENCOUNTERS; i++)
Encounter[i] = NOT_STARTED;
}
void OnGameObjectCreate(GameObject *go, bool add)
void OnCreatureCreate(Creature *creature, uint32 creature_entry)
{
switch(go->GetEntry())
switch(creature->GetEntry())
{
case ENTRY_SEWER1: Sewer1GUID = go->GetGUID(); break;
case ENTRY_SEWER2: Sewer2GUID = go->GetGUID(); break;
case 17381: The_MakerGUID = creature->GetGUID(); break;
case 17380: BroggokGUID = creature->GetGUID(); break;
case 17377: Kelidan_The_BreakerGUID = creature->GetGUID(); break;
}
}
Player* GetPlayerInMap()
void OnObjectCreate(GameObject *go)
{
Map::PlayerList const& players = instance->GetPlayers();
if (go->GetEntry() == 181766) //Final exit door
Door1GUID = go->GetGUID();
if (go->GetEntry() == 181811) //The Maker Front door
Door2GUID = go->GetGUID();
if (go->GetEntry() == 181812) //The Maker Rear door
Door3GUID = go->GetGUID();
if (go->GetEntry() == 181822) //Broggok Front door
Door4GUID = go->GetGUID();
if (go->GetEntry() == 181819) //Broggok Rear door
Door5GUID = go->GetGUID();
if (go->GetEntry() == 181823) //Kelidan exit door
Door6GUID = go->GetGUID();
if (!players.isEmpty())
if (go->GetEntry() == 181813) //The Maker prison cell front right
PrisonCell1GUID = go->GetGUID();
if (go->GetEntry() == 181814) //The Maker prison cell back right
PrisonCell2GUID = go->GetGUID();
if (go->GetEntry() == 181816) //The Maker prison cell front left
PrisonCell3GUID = go->GetGUID();
if (go->GetEntry() == 181815) //The Maker prison cell back left
PrisonCell4GUID = go->GetGUID();
if (go->GetEntry() == 181821) //Broggok prison cell front right
PrisonCell5GUID = go->GetGUID();
if (go->GetEntry() == 181818) //Broggok prison cell back right
PrisonCell6GUID = go->GetGUID();
if (go->GetEntry() == 181820) //Broggok prison cell front left
PrisonCell7GUID = go->GetGUID();
if (go->GetEntry() == 181817) //Broggok prison cell back left
PrisonCell8GUID = go->GetGUID();
}
uint64 GetData64(uint32 data)
{
switch(data)
{
for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
if (Player* plr = itr->getSource())
return plr;
}
case DATA_THE_MAKER: return The_MakerGUID;
case DATA_BROGGOK: return BroggokGUID;
case DATA_KELIDAN_THE_MAKER: return Kelidan_The_BreakerGUID;
case DATA_DOOR1: return Door1GUID;
case DATA_DOOR2: return Door2GUID;
case DATA_DOOR3: return Door3GUID;
case DATA_DOOR4: return Door4GUID;
case DATA_DOOR5: return Door5GUID;
case DATA_DOOR6: return Door6GUID;
case DATA_PRISON_CELL1: return PrisonCell1GUID;
case DATA_PRISON_CELL2: return PrisonCell2GUID;
case DATA_PRISON_CELL3: return PrisonCell3GUID;
case DATA_PRISON_CELL4: return PrisonCell4GUID;
case DATA_PRISON_CELL5: return PrisonCell5GUID;
case DATA_PRISON_CELL6: return PrisonCell6GUID;
case DATA_PRISON_CELL7: return PrisonCell7GUID;
case DATA_PRISON_CELL8: return PrisonCell8GUID;
}
debug_log("TSCR: Instance Blood Furnace: GetPlayerInMap, but PlayerList is empty!");
return NULL;
return 0;
}
void SetData(uint32 type, uint32 data)
{
switch(type)
{
case DATA_KELIDANEVENT:
if( data == DONE )
{
HandleGameObject(Sewer1GUID, true);
HandleGameObject(Sewer2GUID, true);
}
break;
}
switch(data)
{
case TYPE_THE_MAKER_EVENT: Encounter[0] = data; break;
case TYPE_BROGGOK_EVENT: Encounter[1] = data; break;
case TYPE_KELIDAN_THE_BREAKER_EVENT: Encounter[2] = data; break;
}
}
uint32 GetData(uint32 data)
{
switch(data)
{
case TYPE_THE_MAKER_EVENT: return Encounter[0];
case TYPE_BROGGOK_EVENT: return Encounter[1];
case TYPE_KELIDAN_THE_BREAKER_EVENT: return Encounter[2];
}
return 0;
}
};
InstanceData* GetInstanceData_instance_blood_furnace(Map* map)
{
return new instance_blood_furnace(map);