* 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:
@@ -53,205 +53,207 @@ enum eEnums
|
||||
SPELL_MAGNETIC_PULL = 28337,
|
||||
SPELL_KNOCK_BACK = 24199, //Knockback spell until correct implementation is made
|
||||
};
|
||||
|
||||
struct boss_gruulAI : public ScriptedAI
|
||||
␍class boss_gruul : public CreatureScript
|
||||
{
|
||||
boss_gruulAI(Creature *c) : ScriptedAI(c)
|
||||
public:
|
||||
boss_gruul() : CreatureScript("boss_gruul") { }
|
||||
|
||||
CreatureAI* GetAI(Creature* pCreature) const
|
||||
{
|
||||
pInstance = c->GetInstanceData();
|
||||
return new boss_gruulAI (pCreature);
|
||||
}
|
||||
|
||||
ScriptedInstance *pInstance;
|
||||
|
||||
uint32 m_uiGrowth_Timer;
|
||||
uint32 m_uiCaveIn_Timer;
|
||||
uint32 m_uiCaveIn_StaticTimer;
|
||||
uint32 m_uiGroundSlamTimer;
|
||||
uint32 m_uiHurtfulStrike_Timer;
|
||||
uint32 m_uiReverberation_Timer;
|
||||
|
||||
bool m_bPerformingGroundSlam;
|
||||
|
||||
void Reset()
|
||||
struct boss_gruulAI : public ScriptedAI
|
||||
{
|
||||
m_uiGrowth_Timer= 30000;
|
||||
m_uiCaveIn_Timer= 27000;
|
||||
m_uiCaveIn_StaticTimer = 30000;
|
||||
m_uiGroundSlamTimer= 35000;
|
||||
m_bPerformingGroundSlam= false;
|
||||
m_uiHurtfulStrike_Timer= 8000;
|
||||
m_uiReverberation_Timer= 60000+45000;
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit * /*who*/)
|
||||
{
|
||||
DoScriptText(SAY_AGGRO, me);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_GRUULEVENT, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void KilledUnit()
|
||||
{
|
||||
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*Killer*/)
|
||||
{
|
||||
DoScriptText(SAY_DEATH, me);
|
||||
|
||||
if (pInstance)
|
||||
boss_gruulAI(Creature *c) : ScriptedAI(c)
|
||||
{
|
||||
pInstance->SetData(DATA_GRUULEVENT, DONE);
|
||||
pInstance->HandleGameObject(pInstance->GetData64(DATA_GRUULDOOR), true); // Open the encounter door
|
||||
pInstance = c->GetInstanceScript();
|
||||
}
|
||||
}
|
||||
|
||||
void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell)
|
||||
{
|
||||
//This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction
|
||||
//It's initially wrong, since this will cause fall damage, which is by comments, not intended.
|
||||
if (pSpell->Id == SPELL_GROUND_SLAM)
|
||||
InstanceScript *pInstance;
|
||||
|
||||
uint32 m_uiGrowth_Timer;
|
||||
uint32 m_uiCaveIn_Timer;
|
||||
uint32 m_uiCaveIn_StaticTimer;
|
||||
uint32 m_uiGroundSlamTimer;
|
||||
uint32 m_uiHurtfulStrike_Timer;
|
||||
uint32 m_uiReverberation_Timer;
|
||||
|
||||
bool m_bPerformingGroundSlam;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
if (pTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
m_uiGrowth_Timer= 30000;
|
||||
m_uiCaveIn_Timer= 27000;
|
||||
m_uiCaveIn_StaticTimer = 30000;
|
||||
m_uiGroundSlamTimer= 35000;
|
||||
m_bPerformingGroundSlam= false;
|
||||
m_uiHurtfulStrike_Timer= 8000;
|
||||
m_uiReverberation_Timer= 60000+45000;
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_GRUULEVENT, NOT_STARTED);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit * /*who*/)
|
||||
{
|
||||
DoScriptText(SAY_AGGRO, me);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_GRUULEVENT, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void KilledUnit()
|
||||
{
|
||||
DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*Killer*/)
|
||||
{
|
||||
DoScriptText(SAY_DEATH, me);
|
||||
|
||||
if (pInstance)
|
||||
{
|
||||
switch (urand(0,1))
|
||||
pInstance->SetData(DATA_GRUULEVENT, DONE);
|
||||
pInstance->HandleGameObject(pInstance->GetData64(DATA_GRUULDOOR), true); // Open the encounter door
|
||||
}
|
||||
}
|
||||
|
||||
void SpellHitTarget(Unit* pTarget, const SpellEntry* pSpell)
|
||||
{
|
||||
//This to emulate effect1 (77) of SPELL_GROUND_SLAM, knock back to any direction
|
||||
//It's initially wrong, since this will cause fall damage, which is by comments, not intended.
|
||||
if (pSpell->Id == SPELL_GROUND_SLAM)
|
||||
{
|
||||
if (pTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
case 0: pTarget->CastSpell(pTarget, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID()); break;
|
||||
case 1: pTarget->CastSpell(pTarget, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID()); break;
|
||||
switch (urand(0,1))
|
||||
{
|
||||
case 0: pTarget->CastSpell(pTarget, SPELL_MAGNETIC_PULL, true, NULL, NULL, me->GetGUID()); break;
|
||||
case 1: pTarget->CastSpell(pTarget, SPELL_KNOCK_BACK, true, NULL, NULL, me->GetGUID()); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//this part should be in the core
|
||||
if (pSpell->Id == SPELL_SHATTER)
|
||||
{
|
||||
//this spell must have custom handling in the core, dealing damage based on distance
|
||||
pTarget->CastSpell(pTarget, SPELL_SHATTER_EFFECT, true);
|
||||
|
||||
if (pTarget->HasAura(SPELL_STONED))
|
||||
pTarget->RemoveAurasDueToSpell(SPELL_STONED);
|
||||
|
||||
//clear this, if we are still performing
|
||||
if (m_bPerformingGroundSlam)
|
||||
{
|
||||
m_bPerformingGroundSlam = false;
|
||||
|
||||
//and correct movement, if not already
|
||||
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE)
|
||||
{
|
||||
if (me->getVictim())
|
||||
me->GetMotionMaster()->MoveChase(me->getVictim());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//this part should be in the core
|
||||
if (pSpell->Id == SPELL_SHATTER)
|
||||
void UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
//this spell must have custom handling in the core, dealing damage based on distance
|
||||
pTarget->CastSpell(pTarget, SPELL_SHATTER_EFFECT, true);
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (pTarget->HasAura(SPELL_STONED))
|
||||
pTarget->RemoveAurasDueToSpell(SPELL_STONED);
|
||||
// Growth
|
||||
// Gruul can cast this spell up to 30 times
|
||||
if (m_uiGrowth_Timer <= uiDiff)
|
||||
{
|
||||
DoScriptText(EMOTE_GROW, me);
|
||||
DoCast(me, SPELL_GROWTH);
|
||||
m_uiGrowth_Timer = 30000;
|
||||
}
|
||||
else
|
||||
m_uiGrowth_Timer -= uiDiff;
|
||||
|
||||
//clear this, if we are still performing
|
||||
if (m_bPerformingGroundSlam)
|
||||
{
|
||||
m_bPerformingGroundSlam = false;
|
||||
|
||||
//and correct movement, if not already
|
||||
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != TARGETED_MOTION_TYPE)
|
||||
if (m_uiGroundSlamTimer <= uiDiff)
|
||||
{
|
||||
if (me->getVictim())
|
||||
me->GetMotionMaster()->MoveChase(me->getVictim());
|
||||
m_uiGroundSlamTimer =120000;
|
||||
m_uiHurtfulStrike_Timer= 8000;
|
||||
|
||||
if (m_uiReverberation_Timer < 10000) //Give a little time to the players to undo the damage from shatter
|
||||
m_uiReverberation_Timer += 10000;
|
||||
|
||||
DoCast(me, SPELL_SHATTER);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
// Growth
|
||||
// Gruul can cast this spell up to 30 times
|
||||
if (m_uiGrowth_Timer <= uiDiff)
|
||||
{
|
||||
DoScriptText(EMOTE_GROW, me);
|
||||
DoCast(me, SPELL_GROWTH);
|
||||
m_uiGrowth_Timer = 30000;
|
||||
}
|
||||
else
|
||||
m_uiGrowth_Timer -= uiDiff;
|
||||
|
||||
if (m_bPerformingGroundSlam)
|
||||
{
|
||||
if (m_uiGroundSlamTimer <= uiDiff)
|
||||
{
|
||||
m_uiGroundSlamTimer =120000;
|
||||
m_uiHurtfulStrike_Timer= 8000;
|
||||
|
||||
if (m_uiReverberation_Timer < 10000) //Give a little time to the players to undo the damage from shatter
|
||||
m_uiReverberation_Timer += 10000;
|
||||
|
||||
DoCast(me, SPELL_SHATTER);
|
||||
}
|
||||
else
|
||||
m_uiGroundSlamTimer -= uiDiff;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Hurtful Strike
|
||||
if (m_uiHurtfulStrike_Timer <= uiDiff)
|
||||
{
|
||||
Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
|
||||
|
||||
if (pTarget && me->IsWithinMeleeRange(me->getVictim()))
|
||||
DoCast(pTarget, SPELL_HURTFUL_STRIKE);
|
||||
else
|
||||
DoCast(me->getVictim(), SPELL_HURTFUL_STRIKE);
|
||||
|
||||
m_uiHurtfulStrike_Timer= 8000;
|
||||
m_uiGroundSlamTimer -= uiDiff;
|
||||
}
|
||||
else
|
||||
m_uiHurtfulStrike_Timer -= uiDiff;
|
||||
|
||||
// Reverberation
|
||||
if (m_uiReverberation_Timer <= uiDiff)
|
||||
{
|
||||
DoCast(me->getVictim(), SPELL_REVERBERATION, true);
|
||||
m_uiReverberation_Timer = 15000 + rand()%10000;
|
||||
// Hurtful Strike
|
||||
if (m_uiHurtfulStrike_Timer <= uiDiff)
|
||||
{
|
||||
Unit *pTarget = SelectUnit(SELECT_TARGET_TOPAGGRO,1);
|
||||
|
||||
if (pTarget && me->IsWithinMeleeRange(me->getVictim()))
|
||||
DoCast(pTarget, SPELL_HURTFUL_STRIKE);
|
||||
else
|
||||
DoCast(me->getVictim(), SPELL_HURTFUL_STRIKE);
|
||||
|
||||
m_uiHurtfulStrike_Timer= 8000;
|
||||
}
|
||||
else
|
||||
m_uiHurtfulStrike_Timer -= uiDiff;
|
||||
|
||||
// Reverberation
|
||||
if (m_uiReverberation_Timer <= uiDiff)
|
||||
{
|
||||
DoCast(me->getVictim(), SPELL_REVERBERATION, true);
|
||||
m_uiReverberation_Timer = 15000 + rand()%10000;
|
||||
}
|
||||
else
|
||||
m_uiReverberation_Timer -= uiDiff;
|
||||
|
||||
// Cave In
|
||||
if (m_uiCaveIn_Timer <= uiDiff)
|
||||
{
|
||||
if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
|
||||
DoCast(pTarget, SPELL_CAVE_IN);
|
||||
|
||||
if (m_uiCaveIn_StaticTimer >= 4000)
|
||||
m_uiCaveIn_StaticTimer -= 2000;
|
||||
|
||||
m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer;
|
||||
}
|
||||
else
|
||||
m_uiCaveIn_Timer -= uiDiff;
|
||||
|
||||
// Ground Slam, Gronn Lord's Grasp, Stoned, Shatter
|
||||
if (m_uiGroundSlamTimer <= uiDiff)
|
||||
{
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
|
||||
m_bPerformingGroundSlam= true;
|
||||
m_uiGroundSlamTimer = 10000;
|
||||
|
||||
DoCast(me, SPELL_GROUND_SLAM);
|
||||
}
|
||||
else
|
||||
m_uiGroundSlamTimer -= uiDiff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
else
|
||||
m_uiReverberation_Timer -= uiDiff;
|
||||
|
||||
// Cave In
|
||||
if (m_uiCaveIn_Timer <= uiDiff)
|
||||
{
|
||||
if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0))
|
||||
DoCast(pTarget, SPELL_CAVE_IN);
|
||||
|
||||
if (m_uiCaveIn_StaticTimer >= 4000)
|
||||
m_uiCaveIn_StaticTimer -= 2000;
|
||||
|
||||
m_uiCaveIn_Timer = m_uiCaveIn_StaticTimer;
|
||||
}
|
||||
else
|
||||
m_uiCaveIn_Timer -= uiDiff;
|
||||
|
||||
// Ground Slam, Gronn Lord's Grasp, Stoned, Shatter
|
||||
if (m_uiGroundSlamTimer <= uiDiff)
|
||||
{
|
||||
me->GetMotionMaster()->Clear();
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
|
||||
m_bPerformingGroundSlam= true;
|
||||
m_uiGroundSlamTimer = 10000;
|
||||
|
||||
DoCast(me, SPELL_GROUND_SLAM);
|
||||
}
|
||||
else
|
||||
m_uiGroundSlamTimer -= uiDiff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_boss_gruul(Creature* pCreature)
|
||||
{
|
||||
return new boss_gruulAI (pCreature);
|
||||
}
|
||||
|
||||
void AddSC_boss_gruul()
|
||||
{
|
||||
Script *newscript;
|
||||
newscript = new Script;
|
||||
newscript->Name = "boss_gruul";
|
||||
newscript->GetAI = &GetAI_boss_gruul;
|
||||
newscript->RegisterSelf();
|
||||
new boss_gruul();
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,164 +32,166 @@ EndScriptData */
|
||||
1 - High King Maulgar event
|
||||
2 - Gruul event
|
||||
*/
|
||||
|
||||
struct instance_gruuls_lair : public ScriptedInstance
|
||||
␍class instance_gruuls_lair : public InstanceMapScript
|
||||
{
|
||||
instance_gruuls_lair(Map* pMap) : ScriptedInstance(pMap) {Initialize();};
|
||||
public:
|
||||
instance_gruuls_lair() : InstanceMapScript("instance_gruuls_lair") { }
|
||||
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
|
||||
uint64 MaulgarEvent_Tank;
|
||||
uint64 KigglerTheCrazed;
|
||||
uint64 BlindeyeTheSeer;
|
||||
uint64 OlmTheSummoner;
|
||||
uint64 KroshFirehand;
|
||||
uint64 Maulgar;
|
||||
|
||||
uint64 MaulgarDoor;
|
||||
uint64 GruulDoor;
|
||||
|
||||
void Initialize()
|
||||
InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap)
|
||||
{
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
MaulgarEvent_Tank = 0;
|
||||
KigglerTheCrazed = 0;
|
||||
BlindeyeTheSeer = 0;
|
||||
OlmTheSummoner = 0;
|
||||
KroshFirehand = 0;
|
||||
Maulgar = 0;
|
||||
|
||||
MaulgarDoor = 0;
|
||||
GruulDoor = 0;
|
||||
return new instance_gruuls_lair_InstanceMapScript(pMap);
|
||||
}
|
||||
|
||||
bool IsEncounterInProgress() const
|
||||
struct instance_gruuls_lair_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS) return true;
|
||||
instance_gruuls_lair_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();};
|
||||
|
||||
return false;
|
||||
}
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
|
||||
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
|
||||
{
|
||||
switch(pCreature->GetEntry())
|
||||
uint64 MaulgarEvent_Tank;
|
||||
uint64 KigglerTheCrazed;
|
||||
uint64 BlindeyeTheSeer;
|
||||
uint64 OlmTheSummoner;
|
||||
uint64 KroshFirehand;
|
||||
uint64 Maulgar;
|
||||
|
||||
uint64 MaulgarDoor;
|
||||
uint64 GruulDoor;
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
case 18835: KigglerTheCrazed = pCreature->GetGUID(); break;
|
||||
case 18836: BlindeyeTheSeer = pCreature->GetGUID(); break;
|
||||
case 18834: OlmTheSummoner = pCreature->GetGUID(); break;
|
||||
case 18832: KroshFirehand = pCreature->GetGUID(); break;
|
||||
case 18831: Maulgar = pCreature->GetGUID(); break;
|
||||
}
|
||||
}
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
void OnGameObjectCreate(GameObject* pGo, bool /*add*/)
|
||||
{
|
||||
switch(pGo->GetEntry())
|
||||
{
|
||||
case 184468:
|
||||
MaulgarDoor = pGo->GetGUID();
|
||||
if (m_auiEncounter[0] == DONE) HandleGameObject(NULL, true, pGo);
|
||||
break;
|
||||
case 184662: GruulDoor = pGo->GetGUID(); break;
|
||||
}
|
||||
}
|
||||
MaulgarEvent_Tank = 0;
|
||||
KigglerTheCrazed = 0;
|
||||
BlindeyeTheSeer = 0;
|
||||
OlmTheSummoner = 0;
|
||||
KroshFirehand = 0;
|
||||
Maulgar = 0;
|
||||
|
||||
void SetData64(uint32 type, uint64 data)
|
||||
{
|
||||
if (type == DATA_MAULGAREVENT_TANK)
|
||||
MaulgarEvent_Tank = data;
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 identifier)
|
||||
{
|
||||
switch(identifier)
|
||||
{
|
||||
case DATA_MAULGAREVENT_TANK: return MaulgarEvent_Tank;
|
||||
case DATA_KIGGLERTHECRAZED: return KigglerTheCrazed;
|
||||
case DATA_BLINDEYETHESEER: return BlindeyeTheSeer;
|
||||
case DATA_OLMTHESUMMONER: return OlmTheSummoner;
|
||||
case DATA_KROSHFIREHAND: return KroshFirehand;
|
||||
case DATA_MAULGARDOOR: return MaulgarDoor;
|
||||
case DATA_GRUULDOOR: return GruulDoor;
|
||||
case DATA_MAULGAR: return Maulgar;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case DATA_MAULGAREVENT:
|
||||
if (data == DONE) HandleGameObject(MaulgarDoor, true);
|
||||
m_auiEncounter[0] = data; break;
|
||||
case DATA_GRUULEVENT:
|
||||
if (data == IN_PROGRESS) HandleGameObject(GruulDoor, false);
|
||||
else HandleGameObject(GruulDoor, true);
|
||||
m_auiEncounter[1] = data; break;
|
||||
MaulgarDoor = 0;
|
||||
GruulDoor = 0;
|
||||
}
|
||||
|
||||
if (data == DONE)
|
||||
SaveToDB();
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
switch(type)
|
||||
bool IsEncounterInProgress() const
|
||||
{
|
||||
case DATA_MAULGAREVENT: return m_auiEncounter[0];
|
||||
case DATA_GRUULEVENT: return m_auiEncounter[1];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS) return true;
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
std::ostringstream stream;
|
||||
stream << m_auiEncounter[0] << " " << m_auiEncounter[1];
|
||||
char* out = new char[stream.str().length() + 1];
|
||||
strcpy(out, stream.str().c_str());
|
||||
if (out)
|
||||
{
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return out;
|
||||
return false;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Load(const char* in)
|
||||
{
|
||||
if (!in)
|
||||
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
switch(pCreature->GetEntry())
|
||||
{
|
||||
case 18835: KigglerTheCrazed = pCreature->GetGUID(); break;
|
||||
case 18836: BlindeyeTheSeer = pCreature->GetGUID(); break;
|
||||
case 18834: OlmTheSummoner = pCreature->GetGUID(); break;
|
||||
case 18832: KroshFirehand = pCreature->GetGUID(); break;
|
||||
case 18831: Maulgar = pCreature->GetGUID(); break;
|
||||
}
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(in);
|
||||
std::istringstream stream(in);
|
||||
stream >> m_auiEncounter[0] >> m_auiEncounter[1];
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead.
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
void OnGameObjectCreate(GameObject* pGo, bool /*add*/)
|
||||
{
|
||||
switch(pGo->GetEntry())
|
||||
{
|
||||
case 184468:
|
||||
MaulgarDoor = pGo->GetGUID();
|
||||
if (m_auiEncounter[0] == DONE) HandleGameObject(NULL, true, pGo);
|
||||
break;
|
||||
case 184662: GruulDoor = pGo->GetGUID(); break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetData64(uint32 type, uint64 data)
|
||||
{
|
||||
if (type == DATA_MAULGAREVENT_TANK)
|
||||
MaulgarEvent_Tank = data;
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 identifier)
|
||||
{
|
||||
switch(identifier)
|
||||
{
|
||||
case DATA_MAULGAREVENT_TANK: return MaulgarEvent_Tank;
|
||||
case DATA_KIGGLERTHECRAZED: return KigglerTheCrazed;
|
||||
case DATA_BLINDEYETHESEER: return BlindeyeTheSeer;
|
||||
case DATA_OLMTHESUMMONER: return OlmTheSummoner;
|
||||
case DATA_KROSHFIREHAND: return KroshFirehand;
|
||||
case DATA_MAULGARDOOR: return MaulgarDoor;
|
||||
case DATA_GRUULDOOR: return GruulDoor;
|
||||
case DATA_MAULGAR: return Maulgar;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case DATA_MAULGAREVENT:
|
||||
if (data == DONE) HandleGameObject(MaulgarDoor, true);
|
||||
m_auiEncounter[0] = data; break;
|
||||
case DATA_GRUULEVENT:
|
||||
if (data == IN_PROGRESS) HandleGameObject(GruulDoor, false);
|
||||
else HandleGameObject(GruulDoor, true);
|
||||
m_auiEncounter[1] = data; break;
|
||||
}
|
||||
|
||||
if (data == DONE)
|
||||
SaveToDB();
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case DATA_MAULGAREVENT: return m_auiEncounter[0];
|
||||
case DATA_GRUULEVENT: return m_auiEncounter[1];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
std::ostringstream stream;
|
||||
stream << m_auiEncounter[0] << " " << m_auiEncounter[1];
|
||||
char* out = new char[stream.str().length() + 1];
|
||||
strcpy(out, stream.str().c_str());
|
||||
if (out)
|
||||
{
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return out;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Load(const char* in)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(in);
|
||||
std::istringstream stream(in);
|
||||
stream >> m_auiEncounter[0] >> m_auiEncounter[1];
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead.
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
InstanceData* GetInstanceData_instance_gruuls_lair(Map* pMap)
|
||||
{
|
||||
return new instance_gruuls_lair(pMap);
|
||||
}
|
||||
|
||||
void AddSC_instance_gruuls_lair()
|
||||
{
|
||||
Script *newscript;
|
||||
newscript = new Script;
|
||||
newscript->Name = "instance_gruuls_lair";
|
||||
newscript->GetInstanceData = &GetInstanceData_instance_gruuls_lair;
|
||||
newscript->RegisterSelf();
|
||||
new instance_gruuls_lair();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user