* Rename InstanceData to InstanceScript
* Rename *mgr to their new names in scripts project * Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker. --HG-- branch : trunk rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h
This commit is contained in:
@@ -27,118 +27,121 @@ EndScriptData */
|
||||
#include "wailing_caverns.h"
|
||||
|
||||
#define MAX_ENCOUNTER 9
|
||||
|
||||
struct instance_wailing_caverns : public ScriptedInstance
|
||||
␍class instance_wailing_caverns : public InstanceMapScript
|
||||
{
|
||||
instance_wailing_caverns(Map* pMap) : ScriptedInstance(pMap) {Initialize();};
|
||||
public:
|
||||
instance_wailing_caverns() : InstanceMapScript("instance_wailing_caverns") { }
|
||||
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
|
||||
bool yelled;
|
||||
uint64 NaralexGUID;
|
||||
|
||||
void Initialize()
|
||||
InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap)
|
||||
{
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
yelled = false;
|
||||
NaralexGUID = 0;
|
||||
return new instance_wailing_caverns_InstanceMapScript(pMap);
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
|
||||
struct instance_wailing_caverns_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
if (pCreature->GetEntry() == DATA_NARALEX)
|
||||
NaralexGUID = pCreature->GetGUID();
|
||||
}
|
||||
instance_wailing_caverns_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();};
|
||||
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
switch (type)
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
|
||||
bool yelled;
|
||||
uint64 NaralexGUID;
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
case TYPE_LORD_COBRAHN: m_auiEncounter[0] = data;break;
|
||||
case TYPE_LORD_PYTHAS: m_auiEncounter[1] = data;break;
|
||||
case TYPE_LADY_ANACONDRA: m_auiEncounter[2] = data;break;
|
||||
case TYPE_LORD_SERPENTIS: m_auiEncounter[3] = data;break;
|
||||
case TYPE_NARALEX_EVENT: m_auiEncounter[4] = data;break;
|
||||
case TYPE_NARALEX_PART1: m_auiEncounter[5] = data;break;
|
||||
case TYPE_NARALEX_PART2: m_auiEncounter[6] = data;break;
|
||||
case TYPE_NARALEX_PART3: m_auiEncounter[7] = data;break;
|
||||
case TYPE_MUTANUS_THE_DEVOURER: m_auiEncounter[8] = data;break;
|
||||
case TYPE_NARALEX_YELLED: yelled = true; break;
|
||||
}
|
||||
if (data == DONE)SaveToDB();
|
||||
}
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case TYPE_LORD_COBRAHN: return m_auiEncounter[0];
|
||||
case TYPE_LORD_PYTHAS: return m_auiEncounter[1];
|
||||
case TYPE_LADY_ANACONDRA: return m_auiEncounter[2];
|
||||
case TYPE_LORD_SERPENTIS: return m_auiEncounter[3];
|
||||
case TYPE_NARALEX_EVENT: return m_auiEncounter[4];
|
||||
case TYPE_NARALEX_PART1: return m_auiEncounter[5];
|
||||
case TYPE_NARALEX_PART2: return m_auiEncounter[6];
|
||||
case TYPE_NARALEX_PART3: return m_auiEncounter[7];
|
||||
case TYPE_MUTANUS_THE_DEVOURER: return m_auiEncounter[8];
|
||||
case TYPE_NARALEX_YELLED: return yelled;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 data)
|
||||
{
|
||||
if (data == DATA_NARALEX)return NaralexGUID;
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
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];
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* in)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
yelled = false;
|
||||
NaralexGUID = 0;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(in);
|
||||
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
|
||||
{
|
||||
if (pCreature->GetEntry() == DATA_NARALEX)
|
||||
NaralexGUID = pCreature->GetGUID();
|
||||
}
|
||||
|
||||
std::istringstream loadStream(in);
|
||||
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];
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case TYPE_LORD_COBRAHN: m_auiEncounter[0] = data;break;
|
||||
case TYPE_LORD_PYTHAS: m_auiEncounter[1] = data;break;
|
||||
case TYPE_LADY_ANACONDRA: m_auiEncounter[2] = data;break;
|
||||
case TYPE_LORD_SERPENTIS: m_auiEncounter[3] = data;break;
|
||||
case TYPE_NARALEX_EVENT: m_auiEncounter[4] = data;break;
|
||||
case TYPE_NARALEX_PART1: m_auiEncounter[5] = data;break;
|
||||
case TYPE_NARALEX_PART2: m_auiEncounter[6] = data;break;
|
||||
case TYPE_NARALEX_PART3: m_auiEncounter[7] = data;break;
|
||||
case TYPE_MUTANUS_THE_DEVOURER: m_auiEncounter[8] = data;break;
|
||||
case TYPE_NARALEX_YELLED: yelled = true; break;
|
||||
}
|
||||
if (data == DONE)SaveToDB();
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] != DONE)
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case TYPE_LORD_COBRAHN: return m_auiEncounter[0];
|
||||
case TYPE_LORD_PYTHAS: return m_auiEncounter[1];
|
||||
case TYPE_LADY_ANACONDRA: return m_auiEncounter[2];
|
||||
case TYPE_LORD_SERPENTIS: return m_auiEncounter[3];
|
||||
case TYPE_NARALEX_EVENT: return m_auiEncounter[4];
|
||||
case TYPE_NARALEX_PART1: return m_auiEncounter[5];
|
||||
case TYPE_NARALEX_PART2: return m_auiEncounter[6];
|
||||
case TYPE_NARALEX_PART3: return m_auiEncounter[7];
|
||||
case TYPE_MUTANUS_THE_DEVOURER: return m_auiEncounter[8];
|
||||
case TYPE_NARALEX_YELLED: return yelled;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
uint64 GetData64(uint32 data)
|
||||
{
|
||||
if (data == DATA_NARALEX)return NaralexGUID;
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
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];
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* in)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(in);
|
||||
|
||||
std::istringstream loadStream(in);
|
||||
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];
|
||||
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] != DONE)
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
InstanceData* GetInstanceData_instance_wailing_caverns(Map* pMap)
|
||||
{
|
||||
return new instance_wailing_caverns(pMap);
|
||||
}
|
||||
|
||||
void AddSC_instance_wailing_caverns()
|
||||
{
|
||||
Script *newscript;
|
||||
newscript = new Script;
|
||||
newscript->Name = "instance_wailing_caverns";
|
||||
newscript->GetInstanceData = &GetInstanceData_instance_wailing_caverns;
|
||||
newscript->RegisterSelf();
|
||||
new instance_wailing_caverns();
|
||||
}
|
||||
|
||||
@@ -74,325 +74,327 @@ enum eEnums
|
||||
#define GOSSIP_ID_START_2 699 //The fanglords are dead!
|
||||
#define GOSSIP_ITEM_NARALEX "Let the event begin!"
|
||||
#define ACHIEVEMENT_WAILING_CAVERNS 630
|
||||
|
||||
struct npc_disciple_of_naralexAI : public npc_escortAI
|
||||
␍class npc_disciple_of_naralex : public CreatureScript
|
||||
{
|
||||
npc_disciple_of_naralexAI(Creature *c) : npc_escortAI(c)
|
||||
public:
|
||||
npc_disciple_of_naralex() : CreatureScript("npc_disciple_of_naralex") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
pInstance = c->GetInstanceData();
|
||||
eventTimer = 0;
|
||||
currentEvent = 0;
|
||||
eventProgress = 0;
|
||||
me->setActive(true);
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
return new npc_disciple_of_naralexAI(pCreature);
|
||||
}
|
||||
|
||||
uint32 eventTimer;
|
||||
uint32 currentEvent;
|
||||
uint32 eventProgress;
|
||||
ScriptedInstance *pInstance;
|
||||
|
||||
void WaypointReached(uint32 i)
|
||||
bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
if (!pInstance)
|
||||
return;
|
||||
|
||||
switch (i)
|
||||
InstanceScript *pInstance = pCreature->GetInstanceScript();
|
||||
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
||||
{
|
||||
case 4:
|
||||
eventProgress = 1;
|
||||
currentEvent = TYPE_NARALEX_PART1;
|
||||
pInstance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS);
|
||||
break;
|
||||
case 5:
|
||||
DoScriptText(SAY_MUST_CONTINUE, me);
|
||||
pInstance->SetData(TYPE_NARALEX_PART1, DONE);
|
||||
break;
|
||||
case 11:
|
||||
eventProgress = 1;
|
||||
currentEvent = TYPE_NARALEX_PART2;
|
||||
pInstance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS);
|
||||
break;
|
||||
case 19:
|
||||
DoScriptText(SAY_BEYOND_THIS_CORRIDOR, me);
|
||||
break;
|
||||
case 24:
|
||||
eventProgress = 1;
|
||||
currentEvent = TYPE_NARALEX_PART3;
|
||||
pInstance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS);
|
||||
break;
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
if (pInstance)
|
||||
pInstance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS);
|
||||
|
||||
DoScriptText(SAY_MAKE_PREPARATIONS, pCreature);
|
||||
|
||||
pCreature->setFaction(250);
|
||||
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
|
||||
CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID());
|
||||
CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false);
|
||||
CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Reset()
|
||||
bool OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
InstanceScript *pInstance = pCreature->GetInstanceScript();
|
||||
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* who)
|
||||
{
|
||||
DoScriptText(SAY_ATTACKED, me, who);
|
||||
}
|
||||
|
||||
void JustDied(Unit * /*slayer*/)
|
||||
{
|
||||
if (pInstance)
|
||||
{
|
||||
pInstance->SetData(TYPE_NARALEX_EVENT, FAIL);
|
||||
pInstance->SetData(TYPE_NARALEX_PART1, FAIL);
|
||||
pInstance->SetData(TYPE_NARALEX_PART2, FAIL);
|
||||
pInstance->SetData(TYPE_NARALEX_PART3, FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summoned)
|
||||
{
|
||||
summoned->AI()->AttackStart(me);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (currentEvent != TYPE_NARALEX_PART3)
|
||||
npc_escortAI::UpdateAI(diff);
|
||||
|
||||
if (!pInstance)
|
||||
return;
|
||||
if (eventTimer <= diff)
|
||||
{
|
||||
eventTimer = 0;
|
||||
if (pInstance->GetData(currentEvent) == IN_PROGRESS)
|
||||
pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD_RANK_2, true);
|
||||
if ((pInstance->GetData(TYPE_LORD_COBRAHN) == DONE) && (pInstance->GetData(TYPE_LORD_PYTHAS) == DONE) &&
|
||||
(pInstance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (pInstance->GetData(TYPE_LORD_SERPENTIS) == DONE))
|
||||
{
|
||||
switch (currentEvent)
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NARALEX, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||
pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_2, pCreature->GetGUID());
|
||||
|
||||
if (!pInstance->GetData(TYPE_NARALEX_YELLED))
|
||||
{
|
||||
case TYPE_NARALEX_PART1:
|
||||
if (eventProgress == 1)
|
||||
{
|
||||
++eventProgress;
|
||||
DoScriptText(SAY_TEMPLE_OF_PROMISE, me);
|
||||
me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763, 227.874, -93.3233, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506, 216.645, -93.6756, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
}
|
||||
break;
|
||||
case TYPE_NARALEX_PART2:
|
||||
if (eventProgress == 1)
|
||||
{
|
||||
++eventProgress;
|
||||
DoScriptText(SAY_BANISH_THE_SPIRITS, me);
|
||||
DoCast(me, SPELL_SERPENTINE_CLEANSING);
|
||||
//CAST_AI(npc_escortAI, me->AI())->SetCanDefend(false);
|
||||
eventTimer = 30000;
|
||||
me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261, 273.676, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658, 280.799, -92.8393, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
me->SummonCreature(NPC_DEVIATE_VIPER, -50.002, 278.578, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 2)
|
||||
{
|
||||
//CAST_AI(npc_escortAI, me->AI())->SetCanDefend(true);
|
||||
DoScriptText(SAY_CAVERNS_PURIFIED, me);
|
||||
pInstance->SetData(TYPE_NARALEX_PART2, DONE);
|
||||
if (me->HasAura(SPELL_SERPENTINE_CLEANSING))
|
||||
me->RemoveAura(SPELL_SERPENTINE_CLEANSING);
|
||||
}
|
||||
break;
|
||||
case TYPE_NARALEX_PART3:
|
||||
if (eventProgress == 1)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 4000;
|
||||
me->SetStandState(UNIT_STAND_STATE_KNEEL);
|
||||
DoScriptText(SAY_EMERALD_DREAM, me);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 2)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 15000;
|
||||
//CAST_AI(npc_escortAI, me->AI())->SetCanDefend(false);
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoCast(naralex, SPELL_NARALEXS_AWAKENING, true);
|
||||
DoScriptText(EMOTE_AWAKENING_RITUAL, me);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 3)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 15000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoScriptText(EMOTE_TROUBLED_SLEEP, naralex);
|
||||
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943, 199.701, -103.529, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08, 221.13, -103.609, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007, 227.428, -97.421, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 4)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 30000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413, 207.188, -102.469, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857, 218.645, -102.905, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102, 227.211, -102.752, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372, 235.149, -102.826, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524, 251.113, -102.558, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208, 266.466, -102.977, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167, 274.759, -102.962, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 5)
|
||||
{
|
||||
++eventProgress;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoScriptText(EMOTE_HORRENDOUS_VISION, naralex);
|
||||
me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872, 262.905, -103.503, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
|
||||
DoScriptText(SAY_MUTANUS_THE_DEVOURER, me);
|
||||
pInstance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 6 && pInstance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 3000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
{
|
||||
AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS);
|
||||
if (AchievWC)
|
||||
{
|
||||
Map* pMap = me->GetMap();
|
||||
if (pMap && pMap->IsDungeon())
|
||||
{
|
||||
Map::PlayerList const &players = pMap->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
itr->getSource()->CompletedAchievement(AchievWC);
|
||||
}
|
||||
}
|
||||
if (me->HasAura(SPELL_NARALEXS_AWAKENING))
|
||||
me->RemoveAura(SPELL_NARALEXS_AWAKENING);
|
||||
naralex->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
DoScriptText(SAY_I_AM_AWAKE, naralex);
|
||||
}
|
||||
DoScriptText(SAY_NARALEX_AWAKES, me);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 7)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 6000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoScriptText(SAY_THANK_YOU, naralex);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 8)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 8000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
{
|
||||
DoScriptText(SAY_FAREWELL, naralex);
|
||||
naralex->AddAura(SPELL_FLIGHT_FORM, naralex);
|
||||
}
|
||||
SetRun();
|
||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
me->AddAura(SPELL_FLIGHT_FORM, me);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 9)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 1500;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ());
|
||||
}
|
||||
else
|
||||
if (eventProgress == 10)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 2500;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
{
|
||||
naralex->GetMotionMaster()->MovePoint(0, 117.095512, 247.107971, -96.167870);
|
||||
naralex->GetMotionMaster()->MovePoint(1, 90.388809, 276.135406, -83.389801);
|
||||
}
|
||||
me->GetMotionMaster()->MovePoint(26, 117.095512, 247.107971, -96.167870);
|
||||
me->GetMotionMaster()->MovePoint(27, 144.375443, 281.045837, -82.477135);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 11)
|
||||
{
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
naralex->SetVisibility(VISIBILITY_OFF);
|
||||
me->SetVisibility(VISIBILITY_OFF);
|
||||
pInstance->SetData(TYPE_NARALEX_PART3, DONE);
|
||||
}
|
||||
break;
|
||||
DoScriptText(SAY_AT_LAST, pCreature);
|
||||
pInstance->SetData(TYPE_NARALEX_YELLED, 1);
|
||||
}
|
||||
}
|
||||
} else eventTimer -= diff;
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_npc_disciple_of_naralex(Creature* pCreature)
|
||||
{
|
||||
return new npc_disciple_of_naralexAI(pCreature);
|
||||
}
|
||||
|
||||
bool GossipHello_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature)
|
||||
{
|
||||
ScriptedInstance *pInstance = pCreature->GetInstanceData();
|
||||
|
||||
if (pInstance)
|
||||
{
|
||||
pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD_RANK_2, true);
|
||||
if ((pInstance->GetData(TYPE_LORD_COBRAHN) == DONE) && (pInstance->GetData(TYPE_LORD_PYTHAS) == DONE) &&
|
||||
(pInstance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (pInstance->GetData(TYPE_LORD_SERPENTIS) == DONE))
|
||||
{
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NARALEX, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||
pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_2, pCreature->GetGUID());
|
||||
|
||||
if (!pInstance->GetData(TYPE_NARALEX_YELLED))
|
||||
else
|
||||
{
|
||||
DoScriptText(SAY_AT_LAST, pCreature);
|
||||
pInstance->SetData(TYPE_NARALEX_YELLED, 1);
|
||||
pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_1, pCreature->GetGUID());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_1, pCreature->GetGUID());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GossipSelect_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction)
|
||||
{
|
||||
ScriptedInstance *pInstance = pCreature->GetInstanceData();
|
||||
if (uiAction == GOSSIP_ACTION_INFO_DEF + 1)
|
||||
struct npc_disciple_of_naralexAI : public npc_escortAI
|
||||
{
|
||||
pPlayer->CLOSE_GOSSIP_MENU();
|
||||
if (pInstance)
|
||||
pInstance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS);
|
||||
npc_disciple_of_naralexAI(Creature *c) : npc_escortAI(c)
|
||||
{
|
||||
pInstance = c->GetInstanceScript();
|
||||
eventTimer = 0;
|
||||
currentEvent = 0;
|
||||
eventProgress = 0;
|
||||
me->setActive(true);
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
}
|
||||
|
||||
uint32 eventTimer;
|
||||
uint32 currentEvent;
|
||||
uint32 eventProgress;
|
||||
InstanceScript *pInstance;
|
||||
|
||||
void WaypointReached(uint32 i)
|
||||
{
|
||||
if (!pInstance)
|
||||
return;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case 4:
|
||||
eventProgress = 1;
|
||||
currentEvent = TYPE_NARALEX_PART1;
|
||||
pInstance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS);
|
||||
break;
|
||||
case 5:
|
||||
DoScriptText(SAY_MUST_CONTINUE, me);
|
||||
pInstance->SetData(TYPE_NARALEX_PART1, DONE);
|
||||
break;
|
||||
case 11:
|
||||
eventProgress = 1;
|
||||
currentEvent = TYPE_NARALEX_PART2;
|
||||
pInstance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS);
|
||||
break;
|
||||
case 19:
|
||||
DoScriptText(SAY_BEYOND_THIS_CORRIDOR, me);
|
||||
break;
|
||||
case 24:
|
||||
eventProgress = 1;
|
||||
currentEvent = TYPE_NARALEX_PART3;
|
||||
pInstance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* who)
|
||||
{
|
||||
DoScriptText(SAY_ATTACKED, me, who);
|
||||
}
|
||||
|
||||
void JustDied(Unit * /*slayer*/)
|
||||
{
|
||||
if (pInstance)
|
||||
{
|
||||
pInstance->SetData(TYPE_NARALEX_EVENT, FAIL);
|
||||
pInstance->SetData(TYPE_NARALEX_PART1, FAIL);
|
||||
pInstance->SetData(TYPE_NARALEX_PART2, FAIL);
|
||||
pInstance->SetData(TYPE_NARALEX_PART3, FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summoned)
|
||||
{
|
||||
summoned->AI()->AttackStart(me);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (currentEvent != TYPE_NARALEX_PART3)
|
||||
npc_escortAI::UpdateAI(diff);
|
||||
|
||||
if (!pInstance)
|
||||
return;
|
||||
if (eventTimer <= diff)
|
||||
{
|
||||
eventTimer = 0;
|
||||
if (pInstance->GetData(currentEvent) == IN_PROGRESS)
|
||||
{
|
||||
switch (currentEvent)
|
||||
{
|
||||
case TYPE_NARALEX_PART1:
|
||||
if (eventProgress == 1)
|
||||
{
|
||||
++eventProgress;
|
||||
DoScriptText(SAY_TEMPLE_OF_PROMISE, me);
|
||||
me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763, 227.874, -93.3233, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506, 216.645, -93.6756, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
}
|
||||
break;
|
||||
case TYPE_NARALEX_PART2:
|
||||
if (eventProgress == 1)
|
||||
{
|
||||
++eventProgress;
|
||||
DoScriptText(SAY_BANISH_THE_SPIRITS, me);
|
||||
DoCast(me, SPELL_SERPENTINE_CLEANSING);
|
||||
//CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
|
||||
eventTimer = 30000;
|
||||
me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261, 273.676, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658, 280.799, -92.8393, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
me->SummonCreature(NPC_DEVIATE_VIPER, -50.002, 278.578, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 2)
|
||||
{
|
||||
//CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(true);
|
||||
DoScriptText(SAY_CAVERNS_PURIFIED, me);
|
||||
pInstance->SetData(TYPE_NARALEX_PART2, DONE);
|
||||
if (me->HasAura(SPELL_SERPENTINE_CLEANSING))
|
||||
me->RemoveAura(SPELL_SERPENTINE_CLEANSING);
|
||||
}
|
||||
break;
|
||||
case TYPE_NARALEX_PART3:
|
||||
if (eventProgress == 1)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 4000;
|
||||
me->SetStandState(UNIT_STAND_STATE_KNEEL);
|
||||
DoScriptText(SAY_EMERALD_DREAM, me);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 2)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 15000;
|
||||
//CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false);
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoCast(naralex, SPELL_NARALEXS_AWAKENING, true);
|
||||
DoScriptText(EMOTE_AWAKENING_RITUAL, me);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 3)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 15000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoScriptText(EMOTE_TROUBLED_SLEEP, naralex);
|
||||
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943, 199.701, -103.529, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08, 221.13, -103.609, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007, 227.428, -97.421, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 4)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 30000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413, 207.188, -102.469, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857, 218.645, -102.905, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102, 227.211, -102.752, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372, 235.149, -102.826, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524, 251.113, -102.558, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208, 266.466, -102.977, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167, 274.759, -102.962, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 5)
|
||||
{
|
||||
++eventProgress;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoScriptText(EMOTE_HORRENDOUS_VISION, naralex);
|
||||
me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872, 262.905, -103.503, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000);
|
||||
DoScriptText(SAY_MUTANUS_THE_DEVOURER, me);
|
||||
pInstance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 6 && pInstance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 3000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
{
|
||||
AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS);
|
||||
if (AchievWC)
|
||||
{
|
||||
Map* pMap = me->GetMap();
|
||||
if (pMap && pMap->IsDungeon())
|
||||
{
|
||||
Map::PlayerList const &players = pMap->GetPlayers();
|
||||
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
|
||||
itr->getSource()->CompletedAchievement(AchievWC);
|
||||
}
|
||||
}
|
||||
if (me->HasAura(SPELL_NARALEXS_AWAKENING))
|
||||
me->RemoveAura(SPELL_NARALEXS_AWAKENING);
|
||||
naralex->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
DoScriptText(SAY_I_AM_AWAKE, naralex);
|
||||
}
|
||||
DoScriptText(SAY_NARALEX_AWAKES, me);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 7)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 6000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
DoScriptText(SAY_THANK_YOU, naralex);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 8)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 8000;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
{
|
||||
DoScriptText(SAY_FAREWELL, naralex);
|
||||
naralex->AddAura(SPELL_FLIGHT_FORM, naralex);
|
||||
}
|
||||
SetRun();
|
||||
me->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
me->AddAura(SPELL_FLIGHT_FORM, me);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 9)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 1500;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ());
|
||||
}
|
||||
else
|
||||
if (eventProgress == 10)
|
||||
{
|
||||
++eventProgress;
|
||||
eventTimer = 2500;
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
{
|
||||
naralex->GetMotionMaster()->MovePoint(0, 117.095512, 247.107971, -96.167870);
|
||||
naralex->GetMotionMaster()->MovePoint(1, 90.388809, 276.135406, -83.389801);
|
||||
}
|
||||
me->GetMotionMaster()->MovePoint(26, 117.095512, 247.107971, -96.167870);
|
||||
me->GetMotionMaster()->MovePoint(27, 144.375443, 281.045837, -82.477135);
|
||||
}
|
||||
else
|
||||
if (eventProgress == 11)
|
||||
{
|
||||
if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX)))
|
||||
naralex->SetVisibility(VISIBILITY_OFF);
|
||||
me->SetVisibility(VISIBILITY_OFF);
|
||||
pInstance->SetData(TYPE_NARALEX_PART3, DONE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else eventTimer -= diff;
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
DoScriptText(SAY_MAKE_PREPARATIONS, pCreature);
|
||||
|
||||
pCreature->setFaction(250);
|
||||
pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
|
||||
CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID());
|
||||
CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false);
|
||||
CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AddSC_wailing_caverns()
|
||||
{
|
||||
Script *newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_disciple_of_naralex";
|
||||
newscript->pGossipHello = &GossipHello_npc_disciple_of_naralex;
|
||||
newscript->pGossipSelect = &GossipSelect_npc_disciple_of_naralex;
|
||||
newscript->GetAI = &GetAI_npc_disciple_of_naralex;
|
||||
newscript->RegisterSelf();
|
||||
new npc_disciple_of_naralex();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user