* Backport the Blood Furnace script from TC2 ( Do not merge into TC2 !! )

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2009-06-16 18:26:24 +02:00
parent 19225e8880
commit a19f62b551
5 changed files with 301 additions and 97 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* 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
@@ -6,22 +6,24 @@
*
* 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
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* ScriptData
SDName: Boss_Broggok
SD%Complete: 100
SDComment:
SD%Complete: 70
SDComment: pre-event not made
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,32 +52,45 @@ 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 Aggro(Unit *who)
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)
{
summoned->setFaction(16);
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
summoned->CastSpell(summoned,SPELL_POISON,false,0,0,m_creature->GetGUID());
}
void UpdateAI(const uint32 diff)
{
if (!UpdateVictim())
if (!UpdateVictim() )
return;
if(AcidSpray_Timer < diff)
if (AcidSpray_Timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_SLIME_SPRAY);
AcidSpray_Timer = 4000+rand()%8000;
}else AcidSpray_Timer -=diff;
if(PoisonBolt_Timer < diff)
if (PoisonBolt_Timer < diff)
{
DoCast(m_creature->getVictim(),SPELL_POISON_BOLT);
PoisonBolt_Timer = 4000+rand()%8000;
}else PoisonBolt_Timer -=diff;
if(PoisonSpawn_Timer < diff)
if (PoisonSpawn_Timer < diff)
{
DoCast(m_creature,SPELL_POISON_CLOUD);
PoisonSpawn_Timer = 20000;
@@ -77,9 +98,31 @@ 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_broggokAI(Creature *_Creature)
CreatureAI* GetAI_boss_broggok(Creature *_Creature)
{
return new boss_broggokAI (_Creature);
}
@@ -88,8 +131,7 @@ void AddSC_boss_broggok()
{
Script *newscript;
newscript = new Script;
newscript->Name="boss_broggok";
newscript->GetAI = &GetAI_boss_broggokAI;
newscript->Name = "boss_broggok";
newscript->GetAI = &GetAI_boss_broggok;
newscript->RegisterSelf();
}

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* 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
@@ -62,19 +62,14 @@ const float ShadowmoonChannelers[5][4]=
{316,-109,-24.6,1.257}
};
class TRINITY_DLL_DECL BurningNovaAura : public Aura
{
public:
BurningNovaAura(SpellEntry *spell, uint32 eff, Unit *target, Unit *caster) : Aura(spell, eff, NULL, target, caster, NULL){}
};
struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
{
boss_kelidan_the_breakerAI(Creature *c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
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;
@@ -98,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 Aggro(Unit *who)
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)
@@ -184,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)
@@ -232,14 +234,16 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
DoScriptText(SAY_NOVA, m_creature);
if(SpellEntry *nova = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_BURNING_NOVA))
if(SpellEntry *nova = GET_SPELL(SPELL_BURNING_NOVA))
{
for(uint32 i = 0; i < 3; ++i)
if(nova->Effect[i] == SPELL_EFFECT_APPLY_AURA)
{
Aura *Aur = new BurningNovaAura(nova, i, m_creature, m_creature);
m_creature->AddAura(Aur);
}
uint8 eff_mask=0;
for (int i=0; i<3; i++)
{
if (!nova->Effect[i])
continue;
eff_mask|=1<<i;
}
m_creature->AddAura(new Aura(nova, eff_mask, NULL, m_creature, m_creature));
}
if (HeroicMode)
@@ -252,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)
@@ -273,7 +291,7 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
{
mob_shadowmoon_channelerAI(Creature *c) : ScriptedAI(c)
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
pInstance = (c->GetInstanceData());
HeroicMode = m_creature->GetMap()->IsHeroic();
}
@@ -293,10 +311,10 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
m_creature->InterruptNonMeleeSpells(true);
}
void Aggro(Unit* who)
void EnterCombat(Unit* who)
{
if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature))
((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerEngaged(who);
if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
CAST_AI(boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerEngaged(who);
if (m_creature->IsNonMeleeSpellCasted(false))
m_creature->InterruptNonMeleeSpells(true);
DoStartMovement(who);
@@ -304,8 +322,8 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
void JustDied(Unit* Killer)
{
if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature))
((boss_kelidan_the_breakerAI*)Kelidan->AI())->ChannelerDied(Killer);
if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
CAST_AI(boss_kelidan_the_breakerAI, Kelidan->AI())->ChannelerDied(Killer);
}
void UpdateAI(const uint32 diff)
@@ -315,9 +333,9 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
if(check_Timer < diff)
{
if (!m_creature->IsNonMeleeSpellCasted(false))
if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100, m_creature))
if(Creature *Kelidan = me->FindNearestCreature(ENTRY_KELIDAN, 100))
{
uint64 channeler = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature);
uint64 channeler = CAST_AI(boss_kelidan_the_breakerAI, Kelidan->AI())->GetChanneled(m_creature);
if(Unit *channeled = Unit::GetUnit(*m_creature, channeler))
DoCast(channeled,SPELL_CHANNELING);
}

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2006 - 2008 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
/* Copyright (C) 2006 - 2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* 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
@@ -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,10 +56,14 @@ 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 Aggro(Unit *who)
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,77 +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 OnCreatureCreate(Creature *creature, uint32 creature_entry)
{
switch(creature->GetEntry())
{
case 17381: The_MakerGUID = creature->GetGUID(); break;
case 17380: BroggokGUID = creature->GetGUID(); break;
case 17377: Kelidan_The_BreakerGUID = creature->GetGUID(); break;
}
}
void OnObjectCreate(GameObject *go)
{
switch(go->GetEntry())
{
case ENTRY_SEWER1: Sewer1GUID = go->GetGUID(); break;
case ENTRY_SEWER2: Sewer2GUID = go->GetGUID(); break;
}
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 (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();
}
Player* GetPlayerInMap()
uint64 GetData64(uint32 data)
{
Map::PlayerList const& players = instance->GetPlayers();
if (!players.isEmpty())
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;
}
void HandleGameObject(uint64 guid, uint32 state)
{
Player *player = GetPlayerInMap();
if (!player || !guid)
{
debug_log("TSCR: Blood Furnace: HandleGameObject fail");
return;
}
if (GameObject *go = GameObject::GetGameObject(*player,guid))
go->SetGoState(state);
return 0;
}
void SetData(uint32 type, uint32 data)
{
switch(type)
{
case DATA_KELIDANEVENT:
if( data == DONE )
{
HandleGameObject(Sewer1GUID,0);
HandleGameObject(Sewer2GUID,0);
}
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);