*Integrate Script system to Core
-added ScriptMgr for loading scripts -removed bindings -moved script system to src/game -moved scripts to src/scripts -VC project files updated -cmakes updated (not 100% done yet) NOTE to Devs: -file locations changed -precompiled renamed to ScriptedPch -ecsort_ai renamed to ScriptedEscortAI -follower_ai renamed to ScriptedFollowerAI -guard_ai renamed to ScriptedGuardAI -simple_ai renamed to ScriptedSimpleAI -sc_creature renamed to ScriptedCreature -sc_gossip renamed to ScriptedGossip -sc_instance renamed to ScriptedInstance *use the new headers in scripts, thank you NOTE to ALL: cmake not fully tested, please report any errors with it could make creashes, incompability USE AT YOUR OWN RISK before further tests!! --HG-- branch : trunk
This commit is contained in:
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* Script Data Start
|
||||
SDName: Boss Drakkari Colossus
|
||||
SDAuthor: Manuel
|
||||
SD%Complete: 95 %
|
||||
SDComment: The event with the Living Mojos is not implemented, just is done that when one of the mojos around the boss take damage will make the boss enter in combat!
|
||||
SDCategory:
|
||||
Script Data End */
|
||||
|
||||
#include "ScriptedPch.h"
|
||||
#include "gundrak.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_EMERGE = 54850,
|
||||
|
||||
SPELL_MIGHTY_BLOW = 54719,
|
||||
|
||||
SPELL_MERGE = 54878,
|
||||
SPELL_SURGE = 54801,
|
||||
|
||||
SPELL_FREEZE_ANIM = 16245,
|
||||
|
||||
SPELL_MOJO_PUDDLE = 55627,
|
||||
H_SPELL_MOJO_PUDDLE = 58994,
|
||||
|
||||
SPELL_MOJO_WAVE = 55626,
|
||||
H_SPELL_MOJO_WAVE = 58993
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL boss_drakkari_colossusAI : public ScriptedAI
|
||||
{
|
||||
boss_drakkari_colossusAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
pInstance = pCreature->GetInstanceData();
|
||||
}
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
bool bHealth;
|
||||
bool bHealth1;
|
||||
|
||||
uint32 MightyBlowTimer;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, NOT_STARTED);
|
||||
if(!m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))
|
||||
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
m_creature->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT);
|
||||
m_creature->SetReactState(REACT_PASSIVE);
|
||||
MightyBlowTimer = 10000;
|
||||
bHealth = false;
|
||||
bHealth1 = false;
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* who)
|
||||
{
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void CreatureState(Creature* pWho, bool bRestore = false)
|
||||
{
|
||||
if (!pWho)
|
||||
return;
|
||||
|
||||
if (bRestore)
|
||||
{
|
||||
pWho->clearUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT);
|
||||
pWho->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
if (pWho == m_creature)
|
||||
m_creature->RemoveAura(SPELL_FREEZE_ANIM);
|
||||
}else
|
||||
{
|
||||
pWho->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
pWho->addUnitState(UNIT_STAT_STUNNED | UNIT_STAT_ROOT);
|
||||
if (pWho == m_creature)
|
||||
DoCast(m_creature,SPELL_FREEZE_ANIM);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (!bHealth && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() >= 6)
|
||||
{
|
||||
CreatureState(m_creature, false);
|
||||
DoCast(m_creature,SPELL_FREEZE_ANIM);
|
||||
DoCast(m_creature,SPELL_EMERGE);
|
||||
bHealth = true;
|
||||
}
|
||||
|
||||
if (!bHealth1 && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 5)
|
||||
{
|
||||
DoCast(m_creature,SPELL_EMERGE);
|
||||
CreatureState(m_creature, false);
|
||||
bHealth1 = true;
|
||||
m_creature->RemoveAllAuras();
|
||||
}
|
||||
|
||||
if (MightyBlowTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), SPELL_MIGHTY_BLOW, true);
|
||||
MightyBlowTimer = 10000;
|
||||
} else MightyBlowTimer -= diff;
|
||||
|
||||
if (!m_creature->hasUnitState(UNIT_STAT_STUNNED))
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer)
|
||||
{
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_DRAKKARI_COLOSSUS_EVENT, DONE);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* pSummon)
|
||||
{
|
||||
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 5)
|
||||
pSummon->DealDamage(pSummon, pSummon->GetHealth() * 0.5 , NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
|
||||
pSummon->AI()->AttackStart(m_creature->getVictim());
|
||||
}
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL boss_drakkari_elementalAI : public ScriptedAI
|
||||
{
|
||||
boss_drakkari_elementalAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
pInstance = pCreature->GetInstanceData();
|
||||
if(pInstance)
|
||||
{
|
||||
if (pCreature->GetMap()->IsDungeon())
|
||||
pColossus = CAST_CRE(pCreature->GetUnit(*pCreature, pInstance->GetData64(DATA_DRAKKARI_COLOSSUS)));
|
||||
}
|
||||
}
|
||||
|
||||
Creature* pColossus;
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
uint32 uiSurgeTimer;
|
||||
|
||||
bool bGoToColossus;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
if (pColossus)
|
||||
CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->CreatureState(m_creature, true);
|
||||
uiSurgeTimer = 7000;
|
||||
bGoToColossus = false;
|
||||
}
|
||||
|
||||
void EnterEvadeMode()
|
||||
{
|
||||
m_creature->RemoveFromWorld();
|
||||
}
|
||||
|
||||
void MovementInform(uint32 uiType, uint32 uiId)
|
||||
{
|
||||
if (uiType != POINT_MOTION_TYPE)
|
||||
return;
|
||||
CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->CreatureState(pColossus, true);
|
||||
CAST_AI(boss_drakkari_colossusAI, pColossus->AI())->bHealth1 = false;
|
||||
m_creature->RemoveFromWorld();
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if(!UpdateVictim())
|
||||
return;
|
||||
|
||||
if(!bGoToColossus && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() <= 50 && pColossus->GetHealth()*100 / pColossus->GetMaxHealth() >= 6)
|
||||
{
|
||||
m_creature->InterruptNonMeleeSpells(true);
|
||||
if (pColossus)
|
||||
DoCast(pColossus, SPELL_MERGE);
|
||||
bGoToColossus = true;
|
||||
}
|
||||
|
||||
if (uiSurgeTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), SPELL_SURGE);
|
||||
uiSurgeTimer = 7000;
|
||||
} else uiSurgeTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer)
|
||||
{
|
||||
if (!pColossus)
|
||||
return;
|
||||
pColossus->Kill(pColossus);
|
||||
}
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL npc_living_mojoAI : public ScriptedAI
|
||||
{
|
||||
npc_living_mojoAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
pInstance = pCreature->GetInstanceData();
|
||||
}
|
||||
|
||||
Creature* pColossus;
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
uint32 uiMojoWaveTimer;
|
||||
uint32 uiMojoPuddleTimer;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiMojoWaveTimer = 2000;
|
||||
uiMojoPuddleTimer = 7000;
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* who)
|
||||
{
|
||||
if (pInstance)
|
||||
pColossus = m_creature->GetCreature(*m_creature, pInstance->GetData64(DATA_DRAKKARI_COLOSSUS));
|
||||
|
||||
//Check if the npc is near of Drakkari Colossus.
|
||||
if (pColossus && pColossus->isAlive() && m_creature->IsInRange3d(pColossus->GetHomePosition().GetPositionX(),pColossus->GetHomePosition().GetPositionY(),pColossus->GetHomePosition().GetPositionZ(),0.0f,17.0f))
|
||||
m_creature->SetReactState(REACT_PASSIVE);
|
||||
else
|
||||
m_creature->SetReactState(REACT_AGGRESSIVE);
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* pDone_by, uint32& uiDamage)
|
||||
{
|
||||
if (m_creature->HasReactState(REACT_PASSIVE))
|
||||
{
|
||||
if (pColossus && pColossus->isAlive() && !pColossus->isInCombat())
|
||||
{
|
||||
pColossus->RemoveAura(SPELL_FREEZE_ANIM);
|
||||
pColossus->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
pColossus->SetReactState(REACT_AGGRESSIVE);
|
||||
if (pDone_by && pDone_by->isAlive())
|
||||
pColossus->AI()->AttackStart(pDone_by);
|
||||
EnterEvadeMode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiMojoWaveTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_MOJO_WAVE, H_SPELL_MOJO_WAVE));
|
||||
uiMojoWaveTimer = 15000;
|
||||
} else uiMojoWaveTimer -= diff;
|
||||
|
||||
if (uiMojoPuddleTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_MOJO_PUDDLE, H_SPELL_MOJO_PUDDLE));
|
||||
uiMojoPuddleTimer = 18000;
|
||||
} else uiMojoPuddleTimer -= diff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_boss_drakkari_colossus(Creature* pCreature)
|
||||
{
|
||||
return new boss_drakkari_colossusAI (pCreature);
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_boss_drakkari_elemental(Creature* pCreature)
|
||||
{
|
||||
return new boss_drakkari_elementalAI (pCreature);
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_npc_living_mojo(Creature* pCreature)
|
||||
{
|
||||
return new npc_living_mojoAI (pCreature);
|
||||
}
|
||||
|
||||
void AddSC_boss_drakkari_colossus()
|
||||
{
|
||||
Script* newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "boss_drakkari_colossus";
|
||||
newscript->GetAI = &GetAI_boss_drakkari_colossus;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "boss_drakkari_elemental";
|
||||
newscript->GetAI = &GetAI_boss_drakkari_elemental;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "npc_living_mojo";
|
||||
newscript->GetAI = &GetAI_npc_living_mojo;
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/* Script Data Start
|
||||
SDName: Boss Eck the Ferocious
|
||||
SDAuthor: LordVanMartin
|
||||
SD%Complete:
|
||||
SDComment: Only appears in Heroic mode
|
||||
SDCategory:
|
||||
Script Data End */
|
||||
|
||||
/*** SQL START ***
|
||||
update creature_template set scriptname = '' where entry = '';
|
||||
*** SQL END ***/
|
||||
#include "ScriptedPch.h"
|
||||
#include "gundrak.h"
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_ECK_BERSERK = 55816, //Eck goes berserk, increasing his attack speed by 150% and all damage he deals by 500%.
|
||||
SPELL_ECK_BITE = 55813, //Eck bites down hard, inflicting 150% of his normal damage to an enemy.
|
||||
SPELL_ECK_SPIT = 55814, //Eck spits toxic bile at enemies in a cone in front of him, inflicting 2970 Nature damage and draining 220 mana every 1 sec for 3 sec.
|
||||
SPELL_ECK_SPRING_1 = 55815, //Eck leaps at a distant target. --> Drops aggro and charges a random player. Tank can simply taunt him back.
|
||||
SPELL_ECK_SPRING_2 = 55837 //Eck leaps at a distant target.
|
||||
};
|
||||
struct TRINITY_DLL_DECL boss_eckAI : public ScriptedAI
|
||||
{
|
||||
boss_eckAI(Creature *c) : ScriptedAI(c)
|
||||
{
|
||||
pInstance = c->GetInstanceData();
|
||||
}
|
||||
|
||||
uint32 uiBerserkTimer;
|
||||
uint32 uiBiteTimer;
|
||||
uint32 uiSpitTimer;
|
||||
uint32 uiSpringTimer;
|
||||
|
||||
bool bBerserk;
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiBerserkTimer = 60000 + rand()%30000; //60-90 secs according to wowwiki
|
||||
uiBiteTimer = 5000;
|
||||
uiSpitTimer = 10000;
|
||||
uiSpringTimer = 8000;
|
||||
|
||||
bBerserk = false;
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, NOT_STARTED);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* who)
|
||||
{
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiBiteTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), SPELL_ECK_BITE);
|
||||
uiBiteTimer = 8000 + rand()%4000;
|
||||
} else uiBiteTimer -= diff;
|
||||
|
||||
if (uiSpitTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), SPELL_ECK_SPIT);
|
||||
uiSpitTimer = 6000 + rand()%8000;
|
||||
} else uiSpitTimer -= diff;
|
||||
|
||||
if (uiSpringTimer <= diff)
|
||||
{
|
||||
Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,1);
|
||||
if(pTarget && pTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
DoCast(pTarget, RAND(SPELL_ECK_SPRING_1, SPELL_ECK_SPRING_2));
|
||||
uiSpringTimer = 5000 + rand()%10000;
|
||||
}
|
||||
} else uiSpringTimer -= diff;
|
||||
|
||||
//Berserk on timer or 20% of health
|
||||
if (!bBerserk)
|
||||
{
|
||||
if (uiBerserkTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature, SPELL_ECK_BERSERK);
|
||||
bBerserk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
uiBerserkTimer -= diff;
|
||||
if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 20)
|
||||
{
|
||||
DoCast(m_creature, SPELL_ECK_BERSERK);
|
||||
bBerserk = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer)
|
||||
{
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_ECK_THE_FEROCIOUS_EVENT, DONE);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_boss_eck(Creature* pCreature)
|
||||
{
|
||||
return new boss_eckAI (pCreature);
|
||||
}
|
||||
|
||||
void AddSC_boss_eck()
|
||||
{
|
||||
Script *newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "boss_eck";
|
||||
newscript->GetAI = &GetAI_boss_eck;
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
/* Script Data Start
|
||||
SDName: Boss gal_darah
|
||||
SDAuthor: LordVanMartin
|
||||
SD%Complete:
|
||||
SDComment:
|
||||
SDCategory:
|
||||
Script Data End */
|
||||
|
||||
/*** SQL START ***
|
||||
update creature_template set scriptname = '' where entry = '';
|
||||
*** SQL END ***/
|
||||
#include "ScriptedPch.h"
|
||||
#include "gundrak.h"
|
||||
|
||||
//Spells
|
||||
enum Spells
|
||||
{
|
||||
SPELL_ENRAGE = 55285,
|
||||
H_SPELL_ENRAGE = 59828,
|
||||
SPELL_IMPALING_CHARGE = 54956,
|
||||
H_SPELL_IMPALING_CHARGE = 59827,
|
||||
SPELL_STOMP = 55292,
|
||||
H_SPELL_STOMP = 59826,
|
||||
SPELL_PUNCTURE = 55276,
|
||||
H_SPELL_PUNCTURE = 59826,
|
||||
SPELL_STAMPEDE = 55218,
|
||||
SPELL_WHIRLING_SLASH = 55249,
|
||||
H_SPELL_WHIRLING_SLASH = 55825
|
||||
};
|
||||
|
||||
//Yells
|
||||
enum Yells
|
||||
{
|
||||
SAY_AGGRO = -1604000,
|
||||
SAY_SLAY_1 = -1604001,
|
||||
SAY_SLAY_2 = -1604002,
|
||||
SAY_SLAY_3 = -1604003,
|
||||
SAY_DEATH = -1604004,
|
||||
SAY_SUMMON_RHINO_1 = -1604005,
|
||||
SAY_SUMMON_RHINO_2 = -1604006,
|
||||
SAY_SUMMON_RHINO_3 = -1604007,
|
||||
SAY_TRANSFORM_1 = -1604008, //Phase change
|
||||
SAY_TRANSFORM_2 = -1604009
|
||||
};
|
||||
|
||||
enum CombatPhase
|
||||
{
|
||||
TROLL,
|
||||
RHINO
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL boss_gal_darahAI : public ScriptedAI
|
||||
{
|
||||
boss_gal_darahAI(Creature *c) : ScriptedAI(c)
|
||||
{
|
||||
pInstance = c->GetInstanceData();
|
||||
}
|
||||
|
||||
uint32 uiStampedeTimer;
|
||||
uint32 uiWhirlingSlashTimer;
|
||||
uint32 uiPunctureTimer;
|
||||
uint32 uiEnrageTimer;
|
||||
uint32 uiImpalingChargeTimer;
|
||||
uint32 uiStompTimer;
|
||||
|
||||
CombatPhase Phase;
|
||||
|
||||
uint8 uiPhaseCounter;
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiStampedeTimer = 10000;
|
||||
uiWhirlingSlashTimer = 20000;
|
||||
uiPunctureTimer = 10000;
|
||||
uiEnrageTimer = 15000;
|
||||
uiImpalingChargeTimer = 20000;
|
||||
uiStompTimer = 25000;
|
||||
|
||||
Phase = TROLL;
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_GAL_DARAH_EVENT, NOT_STARTED);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* who)
|
||||
{
|
||||
DoScriptText(SAY_AGGRO, m_creature);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_GAL_DARAH_EVENT, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
switch (Phase)
|
||||
{
|
||||
case TROLL:
|
||||
if (uiPhaseCounter == 2)
|
||||
{
|
||||
//FIX: implement transformation
|
||||
Phase = RHINO;
|
||||
uiPhaseCounter = 0;
|
||||
DoScriptText(SAY_TRANSFORM_1,m_creature);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uiStampedeTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature, SPELL_STAMPEDE);
|
||||
DoScriptText(RAND(SAY_SUMMON_RHINO_1,SAY_SUMMON_RHINO_2,SAY_SUMMON_RHINO_3),m_creature);
|
||||
uiStampedeTimer = 15000;
|
||||
} else uiStampedeTimer -= diff;
|
||||
|
||||
if (uiWhirlingSlashTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_WHIRLING_SLASH, H_SPELL_WHIRLING_SLASH));
|
||||
uiWhirlingSlashTimer = 20000;
|
||||
++uiPhaseCounter;
|
||||
} else uiWhirlingSlashTimer -= diff;
|
||||
}
|
||||
break;
|
||||
case RHINO:
|
||||
if (uiPhaseCounter == 2)
|
||||
{
|
||||
//FIX: implement transformation
|
||||
Phase = TROLL;
|
||||
uiPhaseCounter = 0;
|
||||
DoScriptText(SAY_TRANSFORM_2,m_creature);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uiPunctureTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_PUNCTURE, H_SPELL_PUNCTURE));
|
||||
uiPunctureTimer = 8000;
|
||||
} else uiPunctureTimer -= diff;
|
||||
|
||||
if (uiEnrageTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_ENRAGE, H_SPELL_ENRAGE));
|
||||
uiEnrageTimer = 20000;
|
||||
} else uiEnrageTimer -= diff;
|
||||
|
||||
if (uiStompTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_STOMP, H_SPELL_STOMP));
|
||||
uiStompTimer = 20000;
|
||||
} else uiStompTimer -= diff;
|
||||
|
||||
if (uiImpalingChargeTimer <= diff)
|
||||
{
|
||||
if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))
|
||||
DoCast(pTarget, DUNGEON_MODE(SPELL_IMPALING_CHARGE, H_SPELL_IMPALING_CHARGE));
|
||||
uiImpalingChargeTimer = 30000;
|
||||
++uiPhaseCounter;
|
||||
} else uiImpalingChargeTimer -= diff;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer)
|
||||
{
|
||||
DoScriptText(SAY_DEATH, m_creature);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_GAL_DARAH_EVENT, DONE);
|
||||
}
|
||||
|
||||
void KilledUnit(Unit *victim)
|
||||
{
|
||||
if (victim == m_creature)
|
||||
return;
|
||||
|
||||
DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_boss_gal_darah(Creature* pCreature)
|
||||
{
|
||||
return new boss_gal_darahAI (pCreature);
|
||||
}
|
||||
|
||||
void AddSC_boss_gal_darah()
|
||||
{
|
||||
Script *newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "boss_gal_darah";
|
||||
newscript->GetAI = &GetAI_boss_gal_darah;
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
/* Script Data Start
|
||||
SDName: Boss moorabi
|
||||
SDAuthor: Manuel
|
||||
SD%Complete: 100%
|
||||
SDComment: Maybe needs better timers.
|
||||
SDCategory: Gundrak
|
||||
Script Data End */
|
||||
|
||||
#include "ScriptedPch.h"
|
||||
#include "gundrak.h"
|
||||
|
||||
enum eSpells
|
||||
{
|
||||
SPELL_DETERMINED_STAB = 55104,
|
||||
SPELL_GROUND_TREMOR = 55142,
|
||||
SPELL_NUMBING_SHOUT = 55106,
|
||||
|
||||
SPELL_DETERMINED_GORE = 55102,
|
||||
SPELL_DETERMINED_GORE_1 = 59444,
|
||||
SPELL_QUAKE = 55101,
|
||||
SPELL_NUMBING_ROAR = 55100,
|
||||
|
||||
SPELL_MOJO_FRENZY = 55163,
|
||||
SPELL_TRANSFORMATION = 55098, //Periodic, The caster transforms into a powerful mammoth, increasing Physical damage done by 25% and granting immunity to Stun effects.
|
||||
};
|
||||
|
||||
enum eArchivements
|
||||
{
|
||||
ACHIEVEMENT_LESS_RABI = 2040
|
||||
};
|
||||
|
||||
enum eSays
|
||||
{
|
||||
SAY_AGGRO = -1604010,
|
||||
//SAY_SLAY_1 = -1604011, // not in db
|
||||
SAY_SLAY_2 = -1604012,
|
||||
SAY_SLAY_3 = -1604013,
|
||||
SAY_DEATH = -1604014,
|
||||
SAY_TRANSFORM = -1604015,
|
||||
SAY_QUAKE = -1604016,
|
||||
EMOTE_TRANSFORM = -1604017
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL boss_moorabiAI : public ScriptedAI
|
||||
{
|
||||
boss_moorabiAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
pInstance = pCreature->GetInstanceData();
|
||||
}
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
bool bPhase;
|
||||
|
||||
uint32 uiNumblingShoutTimer;
|
||||
uint32 uiGroundTremorTimer;
|
||||
uint32 uiDeterminedStabTimer;
|
||||
uint32 uiTransformationTImer;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiGroundTremorTimer = 18000;
|
||||
uiNumblingShoutTimer = 10000;
|
||||
uiDeterminedStabTimer = 20000;
|
||||
uiTransformationTImer = 12000;
|
||||
bPhase = false;
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_MOORABI_EVENT, NOT_STARTED);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
DoScriptText(SAY_AGGRO, m_creature);
|
||||
DoCast(m_creature, SPELL_MOJO_FRENZY, true);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_MOORABI_EVENT, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if(!bPhase && m_creature->HasAura(SPELL_TRANSFORMATION))
|
||||
{
|
||||
bPhase = true;
|
||||
m_creature->RemoveAura(SPELL_MOJO_FRENZY);
|
||||
}
|
||||
|
||||
if (uiGroundTremorTimer <= uiDiff)
|
||||
{
|
||||
DoScriptText(SAY_QUAKE, m_creature);
|
||||
if (bPhase)
|
||||
DoCast(m_creature->getVictim(), SPELL_QUAKE, true);
|
||||
else
|
||||
DoCast(m_creature->getVictim(), SPELL_GROUND_TREMOR, true);
|
||||
uiGroundTremorTimer = 10000;
|
||||
} else uiGroundTremorTimer -= uiDiff;
|
||||
|
||||
if (uiNumblingShoutTimer <= uiDiff)
|
||||
{
|
||||
if (bPhase)
|
||||
DoCast(m_creature->getVictim(), SPELL_NUMBING_ROAR, true);
|
||||
else
|
||||
DoCast(m_creature->getVictim(), SPELL_NUMBING_SHOUT, true);
|
||||
uiNumblingShoutTimer = 10000;
|
||||
} else uiNumblingShoutTimer -=uiDiff;
|
||||
|
||||
if (uiDeterminedStabTimer <= uiDiff)
|
||||
{
|
||||
if (bPhase)
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_DETERMINED_GORE, SPELL_DETERMINED_GORE_1));
|
||||
else
|
||||
DoCast(m_creature->getVictim(), SPELL_DETERMINED_STAB, true);
|
||||
uiDeterminedStabTimer = 8000;
|
||||
} else uiDeterminedStabTimer -=uiDiff;
|
||||
|
||||
if (!bPhase && uiTransformationTImer <= uiDiff)
|
||||
{
|
||||
DoScriptText(EMOTE_TRANSFORM, m_creature);
|
||||
DoScriptText(SAY_TRANSFORM, m_creature);
|
||||
DoCast(m_creature, SPELL_TRANSFORMATION, false);
|
||||
uiTransformationTImer = 10000;
|
||||
} else uiTransformationTImer -= uiDiff;
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void JustDied(Unit* pKiller)
|
||||
{
|
||||
DoScriptText(SAY_DEATH, m_creature);
|
||||
|
||||
if (IsHeroic() && !bPhase)
|
||||
{
|
||||
AchievementEntry const *AchievLessRabi = GetAchievementStore()->LookupEntry(ACHIEVEMENT_LESS_RABI);
|
||||
if (AchievLessRabi)
|
||||
{
|
||||
Map* pMap = m_creature->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(AchievLessRabi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_MOORABI_EVENT, DONE);
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* pVictim)
|
||||
{
|
||||
if (pVictim == m_creature)
|
||||
return;
|
||||
|
||||
DoScriptText(RAND(SAY_SLAY_2,SAY_SLAY_3), m_creature);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_boss_moorabi(Creature *pCreature)
|
||||
{
|
||||
return new boss_moorabiAI(pCreature);
|
||||
}
|
||||
|
||||
void AddSC_boss_moorabi()
|
||||
{
|
||||
Script* newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "boss_moorabi";
|
||||
newscript->GetAI = &GetAI_boss_moorabi;
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
/* Script Data Start
|
||||
SDName: Boss slad_ran
|
||||
SDAuthor: LordVanMartin
|
||||
SD%Complete:
|
||||
SDComment:
|
||||
SDCategory:
|
||||
Script Data End */
|
||||
|
||||
/*** SQL START ***
|
||||
update creature_template set scriptname = 'boss_slad_ran' where entry = '';
|
||||
*** SQL END ***/
|
||||
#include "ScriptedPch.h"
|
||||
#include "gundrak.h"
|
||||
|
||||
//Spells
|
||||
enum Spells
|
||||
{
|
||||
SPELL_POISON_NOVA = 55081,
|
||||
H_SPELL_POISON_NOVA = 59842,
|
||||
SPELL_POWERFULL_BITE = 48287,
|
||||
H_SPELL_POWERFULL_BITE = 59840,
|
||||
SPELL_VENOM_BOLT = 54970,
|
||||
H_SPELL_VENOM_BOLT = 59839
|
||||
};
|
||||
|
||||
//Yell
|
||||
enum Yells
|
||||
{
|
||||
SAY_AGGRO = -1604017,
|
||||
SAY_SLAY_1 = -1604018,
|
||||
SAY_SLAY_2 = -1604019,
|
||||
SAY_SLAY_3 = -1604020,
|
||||
SAY_DEATH = -1604021,
|
||||
SAY_SUMMON_SNAKES = -1604022,
|
||||
SAY_SUMMON_CONSTRICTORS = -1604023
|
||||
};
|
||||
|
||||
//Creatures
|
||||
enum Creatures
|
||||
{
|
||||
CREATURE_SNAKE = 29680,
|
||||
CREATURE_CONSTRICTORS = 29713
|
||||
};
|
||||
|
||||
//Creatures' spells
|
||||
enum ConstrictorSpells
|
||||
{
|
||||
SPELL_GRIP_OF_SLAD_RAN = 55093,
|
||||
SPELL_VENOMOUS_BITE = 54987,
|
||||
H_SPELL_VENOMOUS_BITE = 58996
|
||||
};
|
||||
|
||||
// Spawning locations
|
||||
struct Locations
|
||||
{
|
||||
float x, y, z, orientation;
|
||||
};
|
||||
|
||||
static Locations SpawnLoc[]=
|
||||
{
|
||||
{1783.81, 646.637, 133.948, 3.71755},
|
||||
{1775.03, 606.586, 134.165, 1.43117},
|
||||
{1717.39, 630.041, 129.282, 5.96903},
|
||||
{1765.66, 646.542, 134.02, 5.11381},
|
||||
{1716.76, 635.159, 129.282, 0.191986}
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL boss_slad_ranAI : public ScriptedAI
|
||||
{
|
||||
boss_slad_ranAI(Creature *c) : ScriptedAI(c)
|
||||
{
|
||||
pInstance = c->GetInstanceData();
|
||||
}
|
||||
|
||||
uint32 uiPoisonNovaTimer;
|
||||
uint32 uiPowerfullBiteTimer;
|
||||
uint32 uiVenomBoltTimer;
|
||||
uint32 uiSpawnTimer;
|
||||
|
||||
uint8 uiPhase;
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiPoisonNovaTimer = 10000;
|
||||
uiPowerfullBiteTimer = 3000;
|
||||
uiVenomBoltTimer = 15000;
|
||||
uiSpawnTimer = 5000;
|
||||
uiPhase = 0;
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_SLAD_RAN_EVENT, NOT_STARTED);
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* who)
|
||||
{
|
||||
DoScriptText(SAY_AGGRO, m_creature);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_SLAD_RAN_EVENT, IN_PROGRESS);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
//Return since we have no target
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiPoisonNovaTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_POISON_NOVA, H_SPELL_POISON_NOVA));
|
||||
uiPoisonNovaTimer = 15000;
|
||||
} else uiPoisonNovaTimer -= diff;
|
||||
|
||||
if (uiPowerfullBiteTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_POWERFULL_BITE, H_SPELL_POWERFULL_BITE));
|
||||
uiPowerfullBiteTimer = 10000;
|
||||
} else uiPowerfullBiteTimer -= diff;
|
||||
|
||||
if (uiVenomBoltTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_VENOM_BOLT, H_SPELL_VENOM_BOLT));
|
||||
uiVenomBoltTimer = 10000;
|
||||
} else uiVenomBoltTimer -= diff;
|
||||
|
||||
if (uiPhase)
|
||||
{
|
||||
if (uiSpawnTimer <= diff)
|
||||
{
|
||||
if (uiPhase == 1)
|
||||
for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i)
|
||||
m_creature->SummonCreature(CREATURE_SNAKE, SpawnLoc[i].x, SpawnLoc[i].y, SpawnLoc[i].z, SpawnLoc[i].orientation, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
|
||||
if (uiPhase == 2)
|
||||
for (uint8 i = 0; i < DUNGEON_MODE(3, 5); ++i)
|
||||
m_creature->SummonCreature(CREATURE_CONSTRICTORS, SpawnLoc[i].x, SpawnLoc[i].y, SpawnLoc[i].z, SpawnLoc[i].orientation, TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
|
||||
uiSpawnTimer = 5000;
|
||||
} else uiSpawnTimer -= diff;
|
||||
}
|
||||
|
||||
if ((uiPhase == 0) && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 30)
|
||||
{
|
||||
DoScriptText(SAY_SUMMON_SNAKES,m_creature);
|
||||
uiPhase = 1;
|
||||
}
|
||||
if ((uiPhase == 1) && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) < 25)
|
||||
{
|
||||
DoScriptText(SAY_SUMMON_CONSTRICTORS,m_creature);
|
||||
uiPhase = 2;
|
||||
}
|
||||
|
||||
DoMeleeAttackIfReady();
|
||||
}
|
||||
|
||||
void JustDied(Unit* killer)
|
||||
{
|
||||
DoScriptText(SAY_DEATH, m_creature);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->SetData(DATA_SLAD_RAN_EVENT, DONE);
|
||||
}
|
||||
|
||||
void KilledUnit(Unit *victim)
|
||||
{
|
||||
DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), m_creature);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature* summoned)
|
||||
{
|
||||
summoned->GetMotionMaster()->MovePoint(0,m_creature->GetPositionX(),m_creature->GetPositionY(),m_creature->GetPositionZ());
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL mob_slad_ran_constrictorAI : public ScriptedAI
|
||||
{
|
||||
mob_slad_ran_constrictorAI(Creature *c) : ScriptedAI(c) {}
|
||||
|
||||
uint32 uiGripOfSladRanTimer;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiGripOfSladRanTimer = 1000;
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
if (uiGripOfSladRanTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), SPELL_GRIP_OF_SLAD_RAN);
|
||||
uiGripOfSladRanTimer = 5000;
|
||||
} else uiGripOfSladRanTimer -= diff;
|
||||
}
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL mob_slad_ran_viperAI : public ScriptedAI
|
||||
{
|
||||
mob_slad_ran_viperAI(Creature *c) : ScriptedAI(c) {}
|
||||
|
||||
uint32 uiVenomousBiteTimer;
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
uiVenomousBiteTimer = 2000;
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
return;
|
||||
|
||||
if (uiVenomousBiteTimer <= diff)
|
||||
{
|
||||
DoCast(m_creature->getVictim(), DUNGEON_MODE(SPELL_VENOMOUS_BITE, H_SPELL_VENOMOUS_BITE));
|
||||
uiVenomousBiteTimer = 10000;
|
||||
} else uiVenomousBiteTimer -= diff;
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_boss_slad_ran(Creature* pCreature)
|
||||
{
|
||||
return new boss_slad_ranAI (pCreature);
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_mob_slad_ran_constrictor(Creature* pCreature)
|
||||
{
|
||||
return new mob_slad_ran_constrictorAI (pCreature);
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_mob_slad_ran_viper(Creature* pCreature)
|
||||
{
|
||||
return new mob_slad_ran_viperAI (pCreature);
|
||||
}
|
||||
|
||||
void AddSC_boss_slad_ran()
|
||||
{
|
||||
Script *newscript;
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "boss_slad_ran";
|
||||
newscript->GetAI = &GetAI_boss_slad_ran;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "mob_slad_ran_constrictor";
|
||||
newscript->GetAI = &GetAI_mob_slad_ran_constrictor;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "mob_slad_ran_viper";
|
||||
newscript->GetAI = &GetAI_mob_slad_ran_viper;
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef DEF_GUNDRAK_H
|
||||
#define DEF_GUNDRAK_H
|
||||
|
||||
enum Data
|
||||
{
|
||||
DATA_SLAD_RAN_EVENT,
|
||||
DATA_MOORABI_EVENT,
|
||||
DATA_DRAKKARI_COLOSSUS_EVENT,
|
||||
DATA_GAL_DARAH_EVENT,
|
||||
DATA_ECK_THE_FEROCIOUS_EVENT
|
||||
};
|
||||
|
||||
enum Data64
|
||||
{
|
||||
DATA_SLAD_RAN_ALTAR,
|
||||
DATA_MOORABI_ALTAR,
|
||||
DATA_DRAKKARI_COLOSSUS_ALTAR,
|
||||
DATA_SLAD_RAN_STATUE,
|
||||
DATA_MOORABI_STATUE,
|
||||
DATA_DRAKKARI_COLOSSUS_STATUE,
|
||||
DATA_DRAKKARI_COLOSSUS
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,503 @@
|
||||
#include "ScriptedPch.h"
|
||||
#include "gundrak.h"
|
||||
|
||||
#define MAX_ENCOUNTER 5
|
||||
|
||||
/* GunDrak encounters:
|
||||
0 - Slad'Ran
|
||||
1 - Moorabi
|
||||
2 - Drakkari Colossus
|
||||
3 - Gal'Darah
|
||||
4 - Eck the Ferocious
|
||||
*/
|
||||
|
||||
struct TRINITY_DLL_DECL instance_gundrak : public ScriptedInstance
|
||||
{
|
||||
instance_gundrak(Map* pMap) : ScriptedInstance(pMap)
|
||||
{
|
||||
bHeroicMode = pMap->IsHeroic();
|
||||
Initialize();
|
||||
};
|
||||
|
||||
bool bHeroicMode;
|
||||
bool spawnSupport;
|
||||
|
||||
uint32 timer;
|
||||
uint32 phase;
|
||||
uint64 toActivate;
|
||||
|
||||
uint64 uiSladRan;
|
||||
uint64 uiMoorabi;
|
||||
uint64 uiDrakkariColossus;
|
||||
uint64 uiGalDarah;
|
||||
uint64 uiEckTheFerocious;
|
||||
|
||||
uint64 uiSladRanAltar;
|
||||
uint64 uiMoorabiAltar;
|
||||
uint64 uiDrakkariColossusAltar;
|
||||
uint64 uiSladRanStatue;
|
||||
uint64 uiMoorabiStatue;
|
||||
uint64 uiDrakkariColossusStatue;
|
||||
uint64 uiGalDarahStatue;
|
||||
uint64 uiEckTheFerociousDoor;
|
||||
uint64 uiEckTheFerociousDoorBehind;
|
||||
uint64 uiGalDarahDoor1;
|
||||
uint64 uiGalDarahDoor2;
|
||||
uint64 uiBridge;
|
||||
uint64 uiCollision;
|
||||
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
|
||||
GOState uiSladRanStatueState;
|
||||
GOState uiMoorabiStatueState;
|
||||
GOState uiDrakkariColossusStatueState;
|
||||
GOState uiGalDarahStatueState;
|
||||
GOState uiBridgeState;
|
||||
GOState uiCollisionState;
|
||||
|
||||
std::string str_data;
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
spawnSupport = false;
|
||||
|
||||
timer = 0;
|
||||
phase = 0;
|
||||
toActivate = 0;
|
||||
|
||||
uiSladRan = 0;
|
||||
uiMoorabi = 0;
|
||||
uiDrakkariColossus = 0;
|
||||
uiGalDarah = 0;
|
||||
uiEckTheFerocious = 0;
|
||||
|
||||
uiSladRanAltar = 0;
|
||||
uiMoorabiAltar = 0;
|
||||
uiDrakkariColossusAltar = 0;
|
||||
|
||||
uiSladRanStatue = 0;
|
||||
uiMoorabiStatue = 0;
|
||||
uiDrakkariColossusStatue = 0;
|
||||
uiGalDarahStatue = 0;
|
||||
|
||||
uiEckTheFerociousDoor = 0;
|
||||
uiEckTheFerociousDoorBehind = 0;
|
||||
uiGalDarahDoor1 = 0;
|
||||
uiGalDarahDoor2 = 0;
|
||||
|
||||
uiBridge = 0;
|
||||
uiCollision = 0;
|
||||
|
||||
uiSladRanStatueState = GO_STATE_ACTIVE;
|
||||
uiMoorabiStatueState = GO_STATE_ACTIVE;
|
||||
uiDrakkariColossusStatueState = GO_STATE_ACTIVE;
|
||||
uiGalDarahStatueState = GO_STATE_READY;
|
||||
uiBridgeState = GO_STATE_ACTIVE;
|
||||
uiCollisionState = GO_STATE_READY;
|
||||
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
}
|
||||
|
||||
bool IsEncounterInProgress() const
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* pCreature, bool add)
|
||||
{
|
||||
switch(pCreature->GetEntry())
|
||||
{
|
||||
case 29304: uiSladRan = pCreature->GetGUID(); break;
|
||||
case 29305: uiMoorabi = pCreature->GetGUID(); break;
|
||||
case 29306: uiGalDarah = pCreature->GetGUID(); break;
|
||||
case 29307: uiDrakkariColossus = pCreature->GetGUID(); break;
|
||||
case 29932: uiEckTheFerocious = pCreature->GetGUID(); break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnGameObjectCreate(GameObject* pGo, bool add)
|
||||
{
|
||||
switch(pGo->GetEntry())
|
||||
{
|
||||
case 192518:
|
||||
uiSladRanAltar = pGo->GetGUID();
|
||||
// Make sure that they start out as unusuable
|
||||
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
if (m_auiEncounter[0] == DONE)
|
||||
{
|
||||
if (uiSladRanStatueState == GO_STATE_ACTIVE)
|
||||
pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
else
|
||||
{
|
||||
++phase;
|
||||
pGo->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 192519:
|
||||
uiMoorabiAltar = pGo->GetGUID();
|
||||
// Make sure that they start out as unusuable
|
||||
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
if (m_auiEncounter[0] == DONE)
|
||||
{
|
||||
if (uiMoorabiStatueState == GO_STATE_ACTIVE)
|
||||
pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
else
|
||||
{
|
||||
++phase;
|
||||
pGo->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 192520:
|
||||
uiDrakkariColossusAltar = pGo->GetGUID();
|
||||
// Make sure that they start out as unusuable
|
||||
pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
if (m_auiEncounter[0] == DONE)
|
||||
{
|
||||
if (uiDrakkariColossusStatueState == GO_STATE_ACTIVE)
|
||||
pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
else
|
||||
{
|
||||
++phase;
|
||||
pGo->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 192564:
|
||||
uiSladRanStatue = pGo->GetGUID();
|
||||
pGo->SetGoState(uiSladRanStatueState);
|
||||
break;
|
||||
case 192565:
|
||||
uiMoorabiStatue = pGo->GetGUID();
|
||||
pGo->SetGoState(uiMoorabiStatueState);
|
||||
break;
|
||||
case 192566:
|
||||
uiGalDarahStatue = pGo->GetGUID();
|
||||
pGo->SetGoState(uiGalDarahStatueState);
|
||||
break;
|
||||
case 192567:
|
||||
uiDrakkariColossusStatue = pGo->GetGUID();
|
||||
pGo->SetGoState(uiDrakkariColossusStatueState);
|
||||
break;
|
||||
case 192632:
|
||||
uiEckTheFerociousDoor = pGo->GetGUID();
|
||||
if (bHeroicMode && m_auiEncounter[1] == DONE)
|
||||
HandleGameObject(NULL,true,pGo);
|
||||
break;
|
||||
case 192569:
|
||||
uiEckTheFerociousDoorBehind = pGo->GetGUID();
|
||||
if (bHeroicMode && m_auiEncounter[4] == DONE)
|
||||
HandleGameObject(NULL,true,pGo);
|
||||
case 193208:
|
||||
uiGalDarahDoor1 = pGo->GetGUID();
|
||||
if (m_auiEncounter[3] == DONE)
|
||||
HandleGameObject(NULL,true,pGo);
|
||||
break;
|
||||
case 193209:
|
||||
uiGalDarahDoor2 = pGo->GetGUID();
|
||||
if (m_auiEncounter[3] == DONE)
|
||||
HandleGameObject(NULL,true,pGo);
|
||||
break;
|
||||
case 193188:
|
||||
uiBridge = pGo->GetGUID();
|
||||
pGo->SetGoState(uiBridgeState);
|
||||
break;
|
||||
case 192633:
|
||||
uiCollision = pGo->GetGUID();
|
||||
pGo->SetGoState(uiCollisionState);
|
||||
|
||||
// Can't spawn here with SpawnGameObject because pGo isn't added to world yet...
|
||||
if (uiCollisionState == GO_STATE_ACTIVE_ALTERNATIVE)
|
||||
spawnSupport = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void SetData(uint32 type, uint32 data)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case DATA_SLAD_RAN_EVENT:
|
||||
m_auiEncounter[0] = data;
|
||||
if (data == DONE)
|
||||
{
|
||||
GameObject* pGo = instance->GetGameObject(uiSladRanAltar);
|
||||
if (pGo)
|
||||
pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
}
|
||||
break;
|
||||
case DATA_MOORABI_EVENT:
|
||||
m_auiEncounter[1] = data;
|
||||
if (data == DONE)
|
||||
{
|
||||
GameObject* pGo = instance->GetGameObject(uiMoorabiAltar);
|
||||
if (pGo)
|
||||
pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
if (bHeroicMode)
|
||||
HandleGameObject(uiEckTheFerociousDoor,true);
|
||||
}
|
||||
break;
|
||||
case DATA_DRAKKARI_COLOSSUS_EVENT:
|
||||
m_auiEncounter[2] = data;
|
||||
if (data == DONE)
|
||||
{
|
||||
GameObject* pGo = instance->GetGameObject(uiDrakkariColossusAltar);
|
||||
if (pGo)
|
||||
pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1);
|
||||
}
|
||||
break;
|
||||
case DATA_GAL_DARAH_EVENT:
|
||||
m_auiEncounter[3] = data;
|
||||
if (data == DONE)
|
||||
{
|
||||
HandleGameObject(uiGalDarahDoor1,true);
|
||||
HandleGameObject(uiGalDarahDoor2,true);
|
||||
}
|
||||
break;
|
||||
case DATA_ECK_THE_FEROCIOUS_EVENT:
|
||||
m_auiEncounter[4] = data;
|
||||
if (bHeroicMode && data == DONE)
|
||||
HandleGameObject(uiEckTheFerociousDoorBehind,true);
|
||||
break;
|
||||
}
|
||||
|
||||
if (data == DONE)
|
||||
SaveToDB();
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case DATA_SLAD_RAN_EVENT: return m_auiEncounter[0];
|
||||
case DATA_MOORABI_EVENT: return m_auiEncounter[1];
|
||||
case DATA_GAL_DARAH_EVENT: return m_auiEncounter[2];
|
||||
case DATA_DRAKKARI_COLOSSUS_EVENT: return m_auiEncounter[3];
|
||||
case DATA_ECK_THE_FEROCIOUS_EVENT: return m_auiEncounter[4];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case DATA_SLAD_RAN_ALTAR: return uiSladRanAltar;
|
||||
case DATA_MOORABI_ALTAR: return uiMoorabiAltar;
|
||||
case DATA_DRAKKARI_COLOSSUS_ALTAR: return uiDrakkariColossusAltar;
|
||||
case DATA_SLAD_RAN_STATUE: return uiSladRanStatue;
|
||||
case DATA_MOORABI_STATUE: return uiMoorabiStatue;
|
||||
case DATA_DRAKKARI_COLOSSUS_STATUE: return uiDrakkariColossusStatue;
|
||||
case DATA_DRAKKARI_COLOSSUS: return uiDrakkariColossus;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData()
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "G D " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " "
|
||||
<< m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " "
|
||||
<< (uiSladRanStatue ? GetObjState(uiSladRanStatue) : GO_STATE_ACTIVE) << " " << (uiMoorabiStatue ? GetObjState(uiMoorabiStatue) : GO_STATE_ACTIVE) << " "
|
||||
<< (uiDrakkariColossusStatue ? GetObjState(uiDrakkariColossusStatue) : GO_STATE_ACTIVE) << " " << (uiGalDarahStatue ? GetObjState(uiGalDarahStatue) : GO_STATE_READY) << " "
|
||||
<< (uiBridge ? GetObjState(uiBridge) : GO_STATE_ACTIVE) << " " << (uiCollision ? GetObjState(uiCollision) : GO_STATE_READY);
|
||||
|
||||
|
||||
str_data = saveStream.str();
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return str_data;
|
||||
}
|
||||
|
||||
void Load(const char* in)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(in);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
uint16 data0, data1, data2, data3, data4, data5, data6, data7, data8, data9, data10;
|
||||
|
||||
std::istringstream loadStream(in);
|
||||
loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3
|
||||
>> data4 >> data5 >> data6 >> data7 >> data8 >> data9 >> data10;
|
||||
|
||||
if (dataHead1 == 'G' && dataHead2 == 'D')
|
||||
{
|
||||
m_auiEncounter[0] = data0;
|
||||
m_auiEncounter[1] = data1;
|
||||
m_auiEncounter[2] = data2;
|
||||
m_auiEncounter[3] = data3;
|
||||
m_auiEncounter[4] = data4;
|
||||
uiSladRanStatueState = GOState(data5);
|
||||
uiMoorabiStatueState = GOState(data6);
|
||||
uiDrakkariColossusStatueState = GOState(data7);
|
||||
uiGalDarahStatueState = GOState(data8);
|
||||
uiBridgeState = GOState(data9);
|
||||
uiCollisionState = GOState(data10);
|
||||
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
if (m_auiEncounter[i] == IN_PROGRESS)
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
} else OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
bool QueueActivation(uint64 guid, uint32 time)
|
||||
{
|
||||
if (timer)
|
||||
return false;
|
||||
|
||||
toActivate = guid;
|
||||
timer = time;
|
||||
phase++;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Update(uint32 diff)
|
||||
{
|
||||
// Spawn the support for the bridge if necessary
|
||||
if (spawnSupport)
|
||||
{
|
||||
if (GameObject* pCollision = instance->GetGameObject(uiCollision))
|
||||
pCollision->SummonGameObject(192743, pCollision->GetPositionX(), pCollision->GetPositionY(), pCollision->GetPositionZ(), pCollision->GetOrientation(), 0, 0, 0, 0, 0);
|
||||
spawnSupport = false;
|
||||
}
|
||||
|
||||
// If there is nothing to activate, then return
|
||||
if (!toActivate)
|
||||
return;
|
||||
|
||||
if (timer < diff)
|
||||
{
|
||||
timer = 0;
|
||||
if (toActivate == uiBridge)
|
||||
{
|
||||
toActivate = 0;
|
||||
GameObject* pBridge = instance->GetGameObject(uiBridge);
|
||||
GameObject* pCollision = instance->GetGameObject(uiCollision);
|
||||
GameObject* pSladRanStatue = instance->GetGameObject(uiSladRanStatue);
|
||||
GameObject* pMoorabiStatue = instance->GetGameObject(uiMoorabiStatue);
|
||||
GameObject* pDrakkariColossusStatue = instance->GetGameObject(uiDrakkariColossusStatue);
|
||||
GameObject* pGalDarahStatue = instance->GetGameObject(uiGalDarahStatue);
|
||||
|
||||
if (pBridge && pCollision && pSladRanStatue && pMoorabiStatue && pDrakkariColossusStatue && pGalDarahStatue)
|
||||
{
|
||||
pBridge->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
pCollision->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
pSladRanStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
pMoorabiStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
pDrakkariColossusStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
pGalDarahStatue->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE);
|
||||
|
||||
// Add the GO that solidifies the bridge so you can walk on it
|
||||
spawnSupport = true;
|
||||
SaveToDB();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 spell = 0;
|
||||
GameObject* pAltar = NULL;
|
||||
if (toActivate == uiSladRanStatue)
|
||||
{
|
||||
spell = 57071;
|
||||
pAltar = instance->GetGameObject(uiSladRanAltar);
|
||||
} else if (toActivate == uiMoorabiStatue)
|
||||
{
|
||||
spell = 57068;
|
||||
pAltar = instance->GetGameObject(uiMoorabiAltar);
|
||||
} else if (toActivate == uiDrakkariColossusStatue)
|
||||
{
|
||||
spell = 57072;
|
||||
pAltar = instance->GetGameObject(uiDrakkariColossusAltar);
|
||||
}
|
||||
|
||||
// This is a workaround to make the beam cast properly. The caster should be ID 30298 but since the spells
|
||||
// all are with scripted target for that same ID, it will hit itself.
|
||||
if (pAltar)
|
||||
if (Creature* trigger = pAltar->SummonCreature(18721, pAltar->GetPositionX(), pAltar->GetPositionY(), pAltar->GetPositionZ() + 3, pAltar->GetOrientation(), TEMPSUMMON_CORPSE_DESPAWN, 5000))
|
||||
{
|
||||
// Set the trigger model to invisible
|
||||
trigger->SetDisplayId(11686);
|
||||
trigger->CastSpell(trigger, spell, false);
|
||||
}
|
||||
|
||||
if (GameObject* statueGO = instance->GetGameObject(toActivate))
|
||||
statueGO->SetGoState(GO_STATE_READY);
|
||||
|
||||
toActivate = 0;
|
||||
|
||||
if (phase == 3)
|
||||
QueueActivation(uiBridge, 3000);
|
||||
else
|
||||
SaveToDB(); // Don't save in between last statue and bridge turning in case of crash leading to stuck instance
|
||||
}
|
||||
} else timer -= diff;
|
||||
}
|
||||
|
||||
GOState GetObjState(uint64 guid)
|
||||
{
|
||||
if (GameObject* go = instance->GetGameObject(guid))
|
||||
return go->GetGoState();
|
||||
return GO_STATE_ACTIVE;
|
||||
}
|
||||
};
|
||||
|
||||
bool GOHello_altar(Player *pPlayer, GameObject *pGO)
|
||||
{
|
||||
ScriptedInstance *pInstance = pGO->GetInstanceData();
|
||||
uint64 uiStatue;
|
||||
|
||||
pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
|
||||
pGO->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
if (pInstance)
|
||||
{
|
||||
switch(pGO->GetEntry())
|
||||
{
|
||||
case 192518: uiStatue = pInstance->GetData64(DATA_SLAD_RAN_STATUE); break;
|
||||
case 192519: uiStatue = pInstance->GetData64(DATA_MOORABI_STATUE); break;
|
||||
case 192520: uiStatue = pInstance->GetData64(DATA_DRAKKARI_COLOSSUS_STATUE); break;
|
||||
}
|
||||
if (((instance_gundrak*)pInstance)->QueueActivation(uiStatue, 3500))
|
||||
{
|
||||
pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
|
||||
pGO->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
InstanceData* GetInstanceData_instance_gundrak(Map* pMap)
|
||||
{
|
||||
return new instance_gundrak(pMap);
|
||||
}
|
||||
|
||||
void AddSC_instance_gundrak()
|
||||
{
|
||||
Script *newscript;
|
||||
newscript = new Script;
|
||||
newscript->Name = "instance_gundrak";
|
||||
newscript->GetInstanceData = &GetInstanceData_instance_gundrak;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "go_gundrak_altar";
|
||||
newscript->pGOHello = &GOHello_altar;
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
Reference in New Issue
Block a user