Blackfathom Deeps: Implemented event related with gameobject Fire of Aku'mai.

--HG--
branch : trunk
This commit is contained in:
_manuel_
2010-01-03 15:55:42 -03:00
parent 4a31d579bd
commit 8d051d9645
5 changed files with 201 additions and 51 deletions

View File

@@ -289,6 +289,7 @@ UPDATE `gameobject_template` SET `ScriptName`='go_blackfathom_altar' WHERE `entr
UPDATE `creature_template` SET `ScriptName`='boss_gelihast' WHERE `entry`=6243;
UPDATE `creature_template` SET `ScriptName`='boss_kelris' WHERE `entry`=4832;
UPDATE `creature_template` SET `ScriptName`='boss_aku_mai' WHERE `entry`=4829;
UPDATE `creature_template` SET `ScriptName`='npc_blackfathom_deeps_event' WHERE `entry` IN (4823,4825,4977,4978);
/* BLACKROCK DEPTHS */

View File

@@ -0,0 +1 @@
UPDATE `creature_template` SET `ScriptName`='npc_blackfathom_deeps_event' WHERE `entry` IN (4823,4825,4977,4978);

View File

@@ -19,11 +19,16 @@
#include "precompiled.h"
#include "blackfathom_deeps.h"
enum Spells
enum eSpells
{
SPELL_BLESSING_OF_BLACKFATHOM = 8733
SPELL_BLESSING_OF_BLACKFATHOM = 8733,
SPELL_RAVAGE = 8391,
SPELL_FROST_NOVA = 865,
SPELL_FROST_BOLT_VOLLEY = 8398
};
const Position HomePosition = {-815.817,-145.299,-25.870, 0};
bool GoHello_blackfathom_altar(Player *pPlayer, GameObject* pGo)
{
if (!pPlayer->HasAura(SPELL_BLESSING_OF_BLACKFATHOM))
@@ -34,7 +39,7 @@ bool GoHello_blackfathom_altar(Player *pPlayer, GameObject* pGo)
bool GoHello_blackfathom_fire(Player *pPlayer, GameObject* pGo)
{
ScriptedInstance *pInstance = pGo->GetInstanceData();
if (pInstance)
{
pGo->SetGoState(GO_STATE_ACTIVE);
@@ -45,6 +50,121 @@ bool GoHello_blackfathom_fire(Player *pPlayer, GameObject* pGo)
return false;
}
struct TRINITY_DLL_DECL npc_blackfathom_deeps_eventAI : public ScriptedAI
{
npc_blackfathom_deeps_eventAI(Creature* pCreature) : ScriptedAI(pCreature)
{
if (pCreature->isSummon())
{
pCreature->SetHomePosition(HomePosition);
AttackPlayer();
}
pInstance = pCreature->GetInstanceData();
}
ScriptedInstance* pInstance;
uint32 uiRavageTimer;
uint32 uiFrostNovaTimer;
uint32 uiFrostBoltVolleyTimer;
bool bFlee;
void Reset()
{
bFlee = false;
uiRavageTimer = urand(5000,8000);
uiFrostNovaTimer = urand(9000,12000);
uiFrostBoltVolleyTimer = urand(2000,4000);
}
void AttackPlayer()
{
Map::PlayerList const &PlList = m_creature->GetMap()->GetPlayers();
if(PlList.isEmpty())
return;
for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i)
{
if(Player* pPlayer = i->getSource())
{
if(pPlayer->isGameMaster())
continue;
if(pPlayer->isAlive())
{
m_creature->SetInCombatWith(pPlayer);
pPlayer->SetInCombatWith(m_creature);
m_creature->AddThreat(pPlayer, 0.0f);
}
}
}
}
void UpdateAI(const uint32 uiDiff)
{
if (!UpdateVictim())
return;
switch (m_creature->GetEntry())
{
case NPC_AKU_MAI_SNAPJAW:
{
if (uiRavageTimer <= uiDiff)
{
DoCast(m_creature->getVictim(), SPELL_RAVAGE);
uiRavageTimer = urand(9000,14000);
} else uiRavageTimer -= uiDiff;
break;
}
case NPC_MURKSHALLOW_SOFTSHELL:
case NPC_BARBED_CRUSTACEAN:
{
if (!bFlee && HealthBelowPct(15))
{
bFlee = true;
m_creature->DoFleeToGetAssistance();
}
break;
}
case NPC_AKU_MAI_SERVANT:
{
if (uiFrostBoltVolleyTimer <= uiDiff)
{
if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
{
if (pTarget)
DoCast(pTarget, SPELL_FROST_BOLT_VOLLEY);
}
uiFrostBoltVolleyTimer = urand(5000,8000);
} else uiFrostBoltVolleyTimer -= uiDiff;
if (uiFrostNovaTimer <= uiDiff)
{
DoCastAOE(SPELL_FROST_NOVA,false);
uiFrostNovaTimer = urand(25000,30000);
} else uiFrostNovaTimer -= uiDiff;
break;
}
}
DoMeleeAttackIfReady();
}
void JustDied(Unit* pKiller)
{
if (m_creature->isSummon()) //we are not a normal spawn.
if (pInstance)
pInstance->SetData(DATA_EVENT, pInstance->GetData(DATA_EVENT) + 1);
}
};
CreatureAI* GetAI_npc_blackfathom_deeps_event(Creature* pCreature)
{
return new npc_blackfathom_deeps_eventAI (pCreature);
}
void AddSC_blackfathom_deeps()
{
@@ -58,4 +178,9 @@ void AddSC_blackfathom_deeps()
newscript->Name = "go_blackfathom_fire";
newscript->pGOHello = &GoHello_blackfathom_fire;
newscript->RegisterSelf();
}
newscript = new Script;
newscript->Name = "npc_blackfathom_deeps_event";
newscript->GetAI = &GetAI_npc_blackfathom_deeps_event;
newscript->RegisterSelf();
}

View File

@@ -23,13 +23,19 @@ enum Data
TYPE_KELRIS,
TYPE_SHRINE,
TYPE_AKU_MAI,
DATA_FIRE
DATA_FIRE,
DATA_EVENT
};
enum Creatures
{
NPC_TWILIGHT_LORD_KELRIS = 4832,
NPC_LORGUS_JETT = 12902
NPC_LORGUS_JETT = 12902,
NPC_AKU_MAI_SNAPJAW = 4825,
NPC_MURKSHALLOW_SOFTSHELL = 4977,
NPC_AKU_MAI_SERVANT = 4978,
NPC_BARBED_CRUSTACEAN = 4823
};
enum GameObjects

View File

@@ -30,14 +30,22 @@ EndScriptData */
Encounter 1 = Twilight Lord Kelris
Encounter 2 = Shrine event
Encounter 3 = Aku'Mai
Must kill twilight lord for shrine event to be possible
*/
const Position LorgusPosition[4] =
{ { -458.500610, -38.343079, -33.474445 },
{ -469.423615, -88.400513, -39.265102 },
{ -622.354980, -10.350100, -22.777000 },
{ -759.640564, 16.658913, -29.159529 }
{
{ -458.500610, -38.343079, -33.474445 },
{ -469.423615, -88.400513, -39.265102 },
{ -622.354980, -10.350100, -22.777000 },
{ -759.640564, 16.658913, -29.159529 }
};
const Position SpawnsLocation[] =
{
{-775.431, -153.853, -25.871, 3.207},
{-775.404, -174.132, -25.871, 3.185},
{-862.430, -154.937, -25.871, 0.060},
{-862.193, -174.251, -25.871, 6.182},
};
struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance
@@ -55,6 +63,7 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance
uint8 m_auiEncounter[MAX_ENCOUNTER];
uint8 m_uiCountFires;
uint8 uiDeathTimes;
void Initialize()
{
@@ -69,6 +78,7 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance
m_uiAltarOfTheDeepsGUID = 0;
m_uiMainDoorGUID = 0;
m_uiCountFires = 0;
uiDeathTimes = 0;
}
void OnCreatureCreate(Creature* pCreature, bool add)
@@ -90,23 +100,15 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance
{
case GO_FIRE_OF_AKU_MAI_1:
m_uiShrine1GUID = pGo->GetGUID();
pGo->SetGoState(GO_STATE_READY);
pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
break;
case GO_FIRE_OF_AKU_MAI_2:
m_uiShrine2GUID = pGo->GetGUID();
pGo->SetGoState(GO_STATE_READY);
pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
break;
case GO_FIRE_OF_AKU_MAI_3:
m_uiShrine3GUID = pGo->GetGUID();
pGo->SetGoState(GO_STATE_READY);
pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
break;
case GO_FIRE_OF_AKU_MAI_4:
m_uiShrine4GUID = pGo->GetGUID();
pGo->SetGoState(GO_STATE_READY);
pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
break;
case GO_SHRINE_OF_GELIHAST:
m_uiShrineOfGelihastGUID = pGo->GetGUID();
@@ -136,20 +138,6 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance
if (GameObject *pGo = instance->GetGameObject(m_uiShrineOfGelihastGUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
break;
case TYPE_KELRIS:
m_auiEncounter[1] = uiData;
if (uiData == DONE)
{
if (GameObject *pGo = instance->GetGameObject(m_uiShrine1GUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
if (GameObject *pGo = instance->GetGameObject(m_uiShrine2GUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
if (GameObject *pGo = instance->GetGameObject(m_uiShrine3GUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
if (GameObject *pGo = instance->GetGameObject(m_uiShrine4GUID))
pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
}
break;
case TYPE_AKU_MAI:
m_auiEncounter[3] = uiData;
if (uiData == DONE)
@@ -158,8 +146,51 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance
break;
case DATA_FIRE:
m_uiCountFires = uiData;
if (uiData == 4)
CheckFires();
switch (m_uiCountFires)
{
case 1:
if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID))
{
pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
}
break;
case 2:
if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID))
{
for (uint8 i = 0; i < 2; ++i)
{
pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
}
}
break;
case 3:
if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID))
{
pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
}
break;
case 4:
if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID))
{
pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
}
break;
}
break;
case DATA_EVENT:
uiDeathTimes = uiData;
if (uiDeathTimes == 18)
HandleGameObject(m_uiMainDoorGUID,true);
break;
}
}
@@ -178,6 +209,8 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance
return m_auiEncounter[3];
case DATA_FIRE:
return m_uiCountFires;
case DATA_EVENT:
return uiDeathTimes;
}
return 0;
@@ -205,22 +238,6 @@ struct TRINITY_DLL_DECL instance_blackfathom_deeps : public ScriptedInstance
return 0;
}
void CheckFires()
{
GameObject *pShrine1 = instance->GetGameObject(m_uiShrine1GUID);
GameObject *pShrine2 = instance->GetGameObject(m_uiShrine2GUID);
GameObject *pShrine3 = instance->GetGameObject(m_uiShrine3GUID);
GameObject *pShrine4 = instance->GetGameObject(m_uiShrine4GUID);
if (pShrine1 && pShrine1->GetGoState() == GO_STATE_ACTIVE &&
pShrine2 && pShrine2->GetGoState() == GO_STATE_ACTIVE &&
pShrine3 && pShrine3->GetGoState() == GO_STATE_ACTIVE &&
pShrine4 && pShrine4->GetGoState() == GO_STATE_ACTIVE)
{
HandleGameObject(m_uiMainDoorGUID,true);
m_auiEncounter[2] = DONE;
}
}
};
InstanceData* GetInstanceData_instance_blackfathom_deeps(Map* pMap)