*Minor clean in scripts.

*Add some checks in scripts.

--HG--
branch : trunk
This commit is contained in:
Anubisss
2009-05-01 01:06:19 +02:00
parent eb9328e4db
commit 16913c63c3
50 changed files with 437 additions and 364 deletions
@@ -79,6 +79,9 @@ struct TRINITY_DLL_DECL boss_taerarAI : public ScriptedAI
void SummonShades(Unit* victim) void SummonShades(Unit* victim)
{ {
if(!victim)
return;
Rand = rand()%15; Rand = rand()%15;
switch (rand()%2) switch (rand()%2)
{ {
@@ -69,6 +69,9 @@ struct TRINITY_DLL_DECL boss_ysondreAI : public ScriptedAI
void SummonDruids(Unit* victim) void SummonDruids(Unit* victim)
{ {
if(!victim)
return;
Rand = rand()%10; Rand = rand()%10;
switch (rand()%2) switch (rand()%2)
{ {
+1 -1
View File
@@ -47,7 +47,7 @@ struct TRINITY_DLL_DECL npc_testAI : public npc_escortAI
{ {
m_creature->Say("Wild Felboar attack!", LANG_UNIVERSAL, 0); m_creature->Say("Wild Felboar attack!", LANG_UNIVERSAL, 0);
Creature* temp = m_creature->SummonCreature(21878, m_creature->GetPositionX()+5, m_creature->GetPositionY()+7, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); Creature* temp = m_creature->SummonCreature(21878, m_creature->GetPositionX()+5, m_creature->GetPositionY()+7, m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
if(temp)
temp->AI()->AttackStart(m_creature); temp->AI()->AttackStart(m_creature);
} }
break; break;
@@ -69,8 +69,10 @@ struct TRINITY_DLL_DECL npc_chicken_cluckAI : public ScriptedAI
if(m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) if(m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER))
{ {
if(ResetFlagTimer < diff) if(ResetFlagTimer < diff)
{
EnterEvadeMode(); EnterEvadeMode();
else ResetFlagTimer -= diff; return;
}else ResetFlagTimer -= diff;
} }
if(UpdateVictim()) if(UpdateVictim())
@@ -46,6 +46,7 @@ struct TRINITY_DLL_DECL npc_ravenholdtAI : public ScriptedAI
void Aggro(Unit* who) { } void Aggro(Unit* who) { }
}; };
CreatureAI* GetAI_npc_ravenholdt(Creature *_Creature) CreatureAI* GetAI_npc_ravenholdt(Creature *_Creature)
{ {
return new npc_ravenholdtAI (_Creature); return new npc_ravenholdtAI (_Creature);
@@ -261,7 +261,10 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
}else Apprentice_Timer -= diff; }else Apprentice_Timer -= diff;
if( CanEvade ) if( CanEvade )
{
EnterEvadeMode(); EnterEvadeMode();
return;
}
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
} }
@@ -154,7 +154,8 @@ struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI
{ {
//second top aggro target in normal, random target in heroic correct? //second top aggro target in normal, random target in heroic correct?
Unit *target = NULL; Unit *target = NULL;
if (HeroicMode ? target = SelectUnit(SELECT_TARGET_RANDOM,0) : target = SelectUnit(SELECT_TARGET_TOPAGGRO,1)) target = HeroicMode ? SelectUnit(SELECT_TARGET_RANDOM,0) : SelectUnit(SELECT_TARGET_TOPAGGRO,1);
if (target)
DoCast(target,HeroicMode ? H_SPELL_POLYMORPH : SPELL_POLYMORPH); DoCast(target,HeroicMode ? H_SPELL_POLYMORPH : SPELL_POLYMORPH);
Sheep_Timer = 15000+rand()%2500; Sheep_Timer = 15000+rand()%2500;
}else Sheep_Timer -= diff; }else Sheep_Timer -= diff;
@@ -77,7 +77,6 @@ struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public ScriptedAI
IsBanished = true; IsBanished = true;
} }
else pInstance->SetData(TYPE_HELLMAW,FAIL); else pInstance->SetData(TYPE_HELLMAW,FAIL);
if (pInstance->GetData(TYPE_OVERSEER) == DONE) if (pInstance->GetData(TYPE_OVERSEER) == DONE)
{ {
if (m_creature->HasAura(SPELL_BANISH,0)) if (m_creature->HasAura(SPELL_BANISH,0))
@@ -156,6 +156,7 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI
banish_Timer = 17000; banish_Timer = 17000;
HelpYell = false; HelpYell = false;
destroyPortals(); destroyPortals();
if(pInstance) if(pInstance)
pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED);
} }
@@ -168,9 +169,12 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI
{ {
Creature *Portal = NULL; Creature *Portal = NULL;
Portal = m_creature->SummonCreature(MOB_VOID_PORTAL,VoidPortalCoords[i][0],VoidPortalCoords[i][1],VoidPortalCoords[i][2],0,TEMPSUMMON_CORPSE_DESPAWN,3000000); Portal = m_creature->SummonCreature(MOB_VOID_PORTAL,VoidPortalCoords[i][0],VoidPortalCoords[i][1],VoidPortalCoords[i][2],0,TEMPSUMMON_CORPSE_DESPAWN,3000000);
if(Portal)
{
PortalsGuid[i] = Portal->GetGUID(); PortalsGuid[i] = Portal->GetGUID();
Portal->CastSpell(Portal,SPELL_VOID_PORTAL_VISUAL,false); Portal->CastSpell(Portal,SPELL_VOID_PORTAL_VISUAL,false);
} }
}
sumportals = true; sumportals = true;
summonTraveler_Timer = 5000; summonTraveler_Timer = 5000;
} }
@@ -221,6 +225,7 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI
{ {
DoScriptText(SAY_DEATH, m_creature); DoScriptText(SAY_DEATH, m_creature);
destroyPortals(); destroyPortals();
if(pInstance) if(pInstance)
pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE); pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE);
} }
@@ -234,6 +239,7 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI
case 2: DoScriptText(SAY_AGGRO3, m_creature); break; case 2: DoScriptText(SAY_AGGRO3, m_creature); break;
} }
summonPortals(); summonPortals();
if(pInstance) if(pInstance)
pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS);
} }
@@ -251,7 +257,6 @@ struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if (!UpdateVictim()) if (!UpdateVictim())
return; return;
@@ -71,6 +71,7 @@ struct TRINITY_DLL_DECL mobs_spitelashesAI : public ScriptedAI
m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->DealDamage(m_creature, m_creature->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse(); //you don't see any corpse on off. m_creature->RemoveCorpse(); //you don't see any corpse on off.
EnterEvadeMode(); //spellhit will be set to false EnterEvadeMode(); //spellhit will be set to false
return;
} }
// walk 5 seconds before summoning // walk 5 seconds before summoning
if( spellhit && morphtimer<5000 ) if( spellhit && morphtimer<5000 )
@@ -162,7 +162,7 @@ struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI
EnterEvadeMode(); EnterEvadeMode();
//set creature health //set creature health
m_creature->SetHealth(int(m_creature->GetMaxHealth()*.1)); m_creature->SetHealth(int(m_creature->GetMaxHealth()*.1));
return;
}else UnSpawnTimer -= diff; }else UnSpawnTimer -= diff;
} }
@@ -512,11 +512,14 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI
Step = 1; Step = 1;
EventStarted = true; EventStarted = true;
Creature* Spark = m_creature->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); Creature* Spark = m_creature->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000);
if(Spark)
{
SparkGUID = Spark->GetGUID(); SparkGUID = Spark->GetGUID();
Spark->setActive(true); Spark->setActive(true);
Spark->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); Spark->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
m_creature->GetMotionMaster()->MovePoint(0, -5092.26, -11252, 0.71);
Spark->GetMotionMaster()->MovePoint(0, -5080.70, -11253.61, 0.56); Spark->GetMotionMaster()->MovePoint(0, -5080.70, -11253.61, 0.56);
}
m_creature->GetMotionMaster()->MovePoint(0, -5092.26, -11252, 0.71);
SayTimer = 23000; SayTimer = 23000;
} }
@@ -533,8 +536,11 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI
return 1000; return 1000;
case 2: case 2:
DoScriptText(GEEZLE_SAY_1, m_creature, Spark); DoScriptText(GEEZLE_SAY_1, m_creature, Spark);
if(Spark)
{
Spark->SetInFront(m_creature); Spark->SetInFront(m_creature);
m_creature->SetInFront(Spark); m_creature->SetInFront(Spark);
}
return 5000; return 5000;
case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000;
case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000;
@@ -544,9 +550,11 @@ struct TRINITY_DLL_DECL npc_geezleAI : public ScriptedAI
case 8: DoScriptText(GEEZLE_SAY_7, m_creature, Spark); return 2000; case 8: DoScriptText(GEEZLE_SAY_7, m_creature, Spark); return 2000;
case 9: case 9:
m_creature->GetMotionMaster()->MoveTargetedHome(); m_creature->GetMotionMaster()->MoveTargetedHome();
if(Spark)
Spark->GetMotionMaster()->MovePoint(0, -5030.95, -11291.99, 7.97); Spark->GetMotionMaster()->MovePoint(0, -5030.95, -11291.99, 7.97);
return 20000; return 20000;
case 10: case 10:
if(Spark)
Spark->DealDamage(Spark,Spark->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); Spark->DealDamage(Spark,Spark->GetHealth(),NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
//DespawnNagaFlag(false); //DespawnNagaFlag(false);
m_creature->SetVisibility(VISIBILITY_OFF); m_creature->SetVisibility(VISIBILITY_OFF);
@@ -145,6 +145,7 @@ struct TRINITY_DLL_DECL npc_taskmaster_fizzuleAI : public ScriptedAI
if( Reset_Timer < diff ) if( Reset_Timer < diff )
{ {
EnterEvadeMode(); EnterEvadeMode();
return;
} else Reset_Timer -= diff; } else Reset_Timer -= diff;
} }
@@ -1067,6 +1067,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
void BeginTalk() void BeginTalk()
{ {
if(pInstance)
pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, IN_PROGRESS); pInstance->SetData(DATA_ILLIDANSTORMRAGEEVENT, IN_PROGRESS);
for(uint8 i = 0; i < 2; i++) for(uint8 i = 0; i < 2; i++)
@@ -1670,6 +1671,7 @@ bool GOHello_cage_trap(Player* plr, GameObject* go)
CellLock<GridReadGuard> cell_lock(cell, pair); CellLock<GridReadGuard> cell_lock(cell, pair);
cell_lock->Visit(cell_lock, cSearcher, *(plr->GetMap())); cell_lock->Visit(cell_lock, cSearcher, *(plr->GetMap()));
if(trigger)
((cage_trap_triggerAI*)trigger->AI())->Active = true; ((cage_trap_triggerAI*)trigger->AI())->Active = true;
go->SetUInt32Value(GAMEOBJECT_STATE, 0); go->SetUInt32Value(GAMEOBJECT_STATE, 0);
return true; return true;
@@ -398,6 +398,7 @@ struct TRINITY_DLL_DECL boss_essence_of_sufferingAI : public ScriptedAI
targets.sort(TargetDistanceOrder(m_creature)); // Sort players by distance. targets.sort(TargetDistanceOrder(m_creature)); // Sort players by distance.
targets.resize(1); // Only need closest target. targets.resize(1); // Only need closest target.
Unit* target = targets.front(); // Get the first target. Unit* target = targets.front(); // Get the first target.
if(target)
target->CastSpell(m_creature, SPELL_FIXATE_TAUNT, true); target->CastSpell(m_creature, SPELL_FIXATE_TAUNT, true);
DoResetThreat(); DoResetThreat();
m_creature->AddThreat(target,1000000); m_creature->AddThreat(target,1000000);
@@ -476,8 +476,10 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
m_creature->GetMotionMaster()->MoveTargetedHome(); m_creature->GetMotionMaster()->MoveTargetedHome();
} }
if(ResetTimer < diff) if(ResetTimer < diff)
{
EnterEvadeMode();// Reset a little while after killing Akama, evade and respawn Akama EnterEvadeMode();// Reset a little while after killing Akama, evade and respawn Akama
else ResetTimer -= diff; return;
}else ResetTimer -= diff;
} }
DoMeleeAttackIfReady(); DoMeleeAttackIfReady();
@@ -195,9 +195,6 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI
{ {
if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0, 999, true)) if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0, 999, true))
{ {
if(!target)
target = m_creature->getVictim();
DoCast(target, SPELL_VOLCANIC_SUMMON); DoCast(target, SPELL_VOLCANIC_SUMMON);
DoScriptText(EMOTE_GROUND_CRACK, m_creature); DoScriptText(EMOTE_GROUND_CRACK, m_creature);
SummonVolcanoTimer = 10000; SummonVolcanoTimer = 10000;
@@ -269,13 +266,14 @@ struct TRINITY_DLL_DECL npc_volcanoAI : public ScriptedAI
{ {
uint64 SupremusGUID = pInstance->GetData64(DATA_SUPREMUS); uint64 SupremusGUID = pInstance->GetData64(DATA_SUPREMUS);
Creature* Supremus = (Unit::GetCreature((*m_creature), SupremusGUID)); Creature* Supremus = (Unit::GetCreature((*m_creature), SupremusGUID));
if(!Eruption && !((boss_supremusAI*)Supremus->AI())->Phase1) if(!Eruption && Supremus && !((boss_supremusAI*)Supremus->AI())->Phase1)
{ {
Eruption = true; Eruption = true;
DoCast(m_creature, SPELL_VOLCANIC_ERUPTION); DoCast(m_creature, SPELL_VOLCANIC_ERUPTION);
} }
else if(Eruption && ((boss_supremusAI*)Supremus->AI())->Phase1) else if((Eruption && Supremus && ((boss_supremusAI*)Supremus->AI())->Phase1) || !Supremus)
{ {
if(m_creature->HasAura(SPELL_VOLCANIC_ERUPTION, 0))
m_creature->RemoveAura(SPELL_VOLCANIC_ERUPTION, 0); m_creature->RemoveAura(SPELL_VOLCANIC_ERUPTION, 0);
} }
CheckTimer = 1500; CheckTimer = 1500;
@@ -382,8 +382,12 @@ struct TRINITY_DLL_DECL boss_teron_gorefiendAI : public ScriptedAI
AttackStart(pUnit); AttackStart(pUnit);
DoZoneInCombat(); DoZoneInCombat();
}else EnterEvadeMode(); }
else
{
EnterEvadeMode();
return;
}
}else AggroTimer -= diff; }else AggroTimer -= diff;
} }
@@ -372,6 +372,7 @@ struct TRINITY_DLL_DECL boss_illidari_councilAI : public ScriptedAI
{ {
error_log(ERROR_INST_DATA); error_log(ERROR_INST_DATA);
EnterEvadeMode(); EnterEvadeMode();
return;
} }
DoZoneInCombat(); DoZoneInCombat();
// Load GUIDs on first aggro because the creature guids are only set as the creatures are created in world- // Load GUIDs on first aggro because the creature guids are only set as the creatures are created in world-
@@ -713,8 +713,11 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player *player, Creature *_Creature,
{ {
case GOSSIP_ACTION_INFO_DEF+1: case GOSSIP_ACTION_INFO_DEF+1:
player->CLOSE_GOSSIP_MENU(); player->CLOSE_GOSSIP_MENU();
if(pInstance)
{
pInstance->SetData(TYPE_THRALL_EVENT,IN_PROGRESS); pInstance->SetData(TYPE_THRALL_EVENT,IN_PROGRESS);
pInstance->SetData(TYPE_THRALL_PART1,IN_PROGRESS); pInstance->SetData(TYPE_THRALL_PART1,IN_PROGRESS);
}
DoScriptText(SAY_TH_START_EVENT_PART1, _Creature); DoScriptText(SAY_TH_START_EVENT_PART1, _Creature);
@@ -732,6 +735,7 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player *player, Creature *_Creature,
case GOSSIP_ACTION_INFO_DEF+20: case GOSSIP_ACTION_INFO_DEF+20:
player->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC3, _Creature->GetGUID()); player->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC3, _Creature->GetGUID());
_Creature->SummonCreature(SKARLOC_MOUNT,2038.81,270.26,63.20,5.41,TEMPSUMMON_TIMED_DESPAWN,12000); _Creature->SummonCreature(SKARLOC_MOUNT,2038.81,270.26,63.20,5.41,TEMPSUMMON_TIMED_DESPAWN,12000);
if(pInstance)
pInstance->SetData(TYPE_THRALL_PART2,IN_PROGRESS); pInstance->SetData(TYPE_THRALL_PART2,IN_PROGRESS);
DoScriptText(SAY_TH_START_EVENT_PART2, _Creature); DoScriptText(SAY_TH_START_EVENT_PART2, _Creature);
@@ -741,6 +745,7 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player *player, Creature *_Creature,
case GOSSIP_ACTION_INFO_DEF+3: case GOSSIP_ACTION_INFO_DEF+3:
player->CLOSE_GOSSIP_MENU(); player->CLOSE_GOSSIP_MENU();
if(pInstance)
pInstance->SetData(TYPE_THRALL_PART3,IN_PROGRESS); pInstance->SetData(TYPE_THRALL_PART3,IN_PROGRESS);
((npc_thrall_old_hillsbradAI*)_Creature->AI())->StartWP(); ((npc_thrall_old_hillsbradAI*)_Creature->AI())->StartWP();
break; break;
@@ -827,6 +832,7 @@ bool GossipSelect_npc_taretha(Player *player, Creature *_Creature, uint32 sender
if( pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS ) if( pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS )
{ {
if(pInstance)
pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS); pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS);
if(pInstance->GetData64(DATA_EPOCH) == 0) if(pInstance->GetData64(DATA_EPOCH) == 0)
_Creature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); _Creature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000);
@@ -131,7 +131,6 @@ struct TRINITY_DLL_DECL boss_fathomlord_karathressAI : public ScriptedAI
Creature* pAdvisor = NULL; Creature* pAdvisor = NULL;
for( int i=0; i<3; i++ ) for( int i=0; i<3; i++ )
if(RAdvisors[i]) if(RAdvisors[i])
{ {
pAdvisor = (Unit::GetCreature((*m_creature), RAdvisors[i])); pAdvisor = (Unit::GetCreature((*m_creature), RAdvisors[i]));
@@ -76,7 +76,8 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI
{ {
boss_the_lurker_belowAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature) boss_the_lurker_belowAI(Creature *c) : Scripted_NoMovementAI(c), Summons(m_creature)
{ {
pInstance = ((ScriptedInstance*)c->GetInstanceData()); SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SPOUT_ANIM); pInstance = ((ScriptedInstance*)c->GetInstanceData());
SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_SPOUT_ANIM);
if(TempSpell) if(TempSpell)
{ {
TempSpell->Effect[0] = 0;//remove all spell effect, only anim is needed TempSpell->Effect[0] = 0;//remove all spell effect, only anim is needed
@@ -227,7 +228,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
{ {
Player *target = i->getSource(); Player *target = i->getSource();
if(target->isAlive() && m_creature->HasInArc((double)diff/20000*(double)M_PI*2,target) && m_creature->GetDistance(target) <= SPOUT_DIST && !target->IsInWater()) if(target && target->isAlive() && m_creature->HasInArc((double)diff/20000*(double)M_PI*2,target) && m_creature->GetDistance(target) <= SPOUT_DIST && !target->IsInWater())
DoCast(target,SPELL_SPOUT,true);//only knock back palyers in arc, in 100yards, not in water DoCast(target,SPELL_SPOUT,true);//only knock back palyers in arc, in 100yards, not in water
} }
} }
@@ -370,6 +371,7 @@ struct TRINITY_DLL_DECL boss_the_lurker_belowAI : public Scripted_NoMovementAI
Summoned = m_creature->SummonCreature(MOB_COILFANG_AMBUSHER,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); Summoned = m_creature->SummonCreature(MOB_COILFANG_AMBUSHER,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
else Summoned = m_creature->SummonCreature(MOB_COILFANG_GUARDIAN,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0); else Summoned = m_creature->SummonCreature(MOB_COILFANG_GUARDIAN,AddPos[i][0],AddPos[i][1],AddPos[i][2], 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if(Summoned)
Summons.Summon(Summoned); Summons.Summon(Summoned);
Spawned = true; Spawned = true;
} }
@@ -206,6 +206,7 @@ struct TRINITY_DLL_DECL boss_morogrim_tidewalkerAI : public ScriptedAI
{ {
Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0); Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0);
Creature* Murloc = m_creature->SummonCreature(MurlocCords[i][0],MurlocCords[i][1],MurlocCords[i][2],MurlocCords[i][3],MurlocCords[i][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); Creature* Murloc = m_creature->SummonCreature(MurlocCords[i][0],MurlocCords[i][1],MurlocCords[i][2],MurlocCords[i][3],MurlocCords[i][4], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000);
if(target && Murloc)
Murloc->AI()->AttackStart(target); Murloc->AI()->AttackStart(target);
} }
DoScriptText(EMOTE_EARTHQUAKE, m_creature); DoScriptText(EMOTE_EARTHQUAKE, m_creature);
@@ -63,6 +63,9 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance
virtual void Update(uint32 diff) virtual void Update(uint32 diff)
{ {
if(!IronCladDoor || !DefiasCannon || !DoorLever)
return;
switch(State) switch(State)
{ {
case CANNON_GUNPOWDER_USED: case CANNON_GUNPOWDER_USED:
@@ -107,6 +110,9 @@ struct TRINITY_DLL_DECL instance_deadmines : public ScriptedInstance
void MoveCreaturesInside() void MoveCreaturesInside()
{ {
if(!DefiasPirate1 || !DefiasPirate2 || !DefiasCompanion)
return;
MoveCreatureInside(DefiasPirate1); MoveCreatureInside(DefiasPirate1);
MoveCreatureInside(DefiasPirate2); MoveCreatureInside(DefiasPirate2);
MoveCreatureInside(DefiasCompanion); MoveCreatureInside(DefiasCompanion);
@@ -62,7 +62,10 @@ struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI
if (!m_creature->GetUInt32Value(UNIT_FIELD_BYTES_1)) if (!m_creature->GetUInt32Value(UNIT_FIELD_BYTES_1))
{ {
if(lifeTimer < diff) if(lifeTimer < diff)
m_creature->AI()->EnterEvadeMode(); {
EnterEvadeMode();
return;
}
else else
lifeTimer -= diff; lifeTimer -= diff;
} }
@@ -62,7 +62,10 @@ struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI
if (!m_creature->GetUInt32Value(UNIT_FIELD_BYTES_1)) if (!m_creature->GetUInt32Value(UNIT_FIELD_BYTES_1))
{ {
if(lifeTimer < diff) if(lifeTimer < diff)
m_creature->AI()->EnterEvadeMode(); {
EnterEvadeMode();
return;
}
else else
lifeTimer -= diff; lifeTimer -= diff;
} }
@@ -182,8 +182,11 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI
DoScriptText(SAY_PROGRESS3, m_creature, player); DoScriptText(SAY_PROGRESS3, m_creature, player);
Creature* Summ1 = m_creature->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0); Creature* Summ1 = m_creature->SummonCreature(16342, 7627.083984, -7532.538086, 152.128616, 1.082733, TEMPSUMMON_DEAD_DESPAWN, 0);
Creature* Summ2 = m_creature->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0); Creature* Summ2 = m_creature->SummonCreature(16343, 7620.432129, -7532.550293, 152.454865, 0.827478, TEMPSUMMON_DEAD_DESPAWN, 0);
if(Summ1 && Summ2)
{
Summ1->Attack(m_creature, true); Summ1->Attack(m_creature, true);
Summ2->Attack(player, true); Summ2->Attack(player, true);
}
m_creature->AI()->AttackStart(Summ1); m_creature->AI()->AttackStart(Summ1);
break; break;
} }
@@ -280,9 +280,10 @@ struct TRINITY_DLL_DECL boss_high_king_maulgarAI : public ScriptedAI
Unit* target = NULL; Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM, 0); target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if (target) if (target)
{
AttackStart(target); AttackStart(target);
DoCast(target, SPELL_BERSERKER_C); DoCast(target, SPELL_BERSERKER_C);
}
Charging_Timer = 20000; Charging_Timer = 20000;
}else Charging_Timer -= diff; }else Charging_Timer -= diff;
@@ -308,8 +308,10 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI
if(!summoned) if(!summoned)
{ {
Creature* Vazruden = m_creature->SummonCreature(ENTRY_VAZRUDEN,VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,6000000); Creature* Vazruden = m_creature->SummonCreature(ENTRY_VAZRUDEN,VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,6000000);
if(Vazruden)
VazrudenGUID = Vazruden->GetGUID(); VazrudenGUID = Vazruden->GetGUID();
Creature* Nazan = m_creature->SummonCreature(ENTRY_NAZAN,VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,6000000); Creature* Nazan = m_creature->SummonCreature(ENTRY_NAZAN,VazrudenMiddle[0],VazrudenMiddle[1],VazrudenMiddle[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,6000000);
if(Nazan)
NazanGUID = Nazan->GetGUID(); NazanGUID = Nazan->GetGUID();
summoned = true; summoned = true;
m_creature->SetVisibility(VISIBILITY_OFF); m_creature->SetVisibility(VISIBILITY_OFF);
@@ -391,6 +393,7 @@ struct TRINITY_DLL_DECL boss_vazruden_the_heraldAI : public ScriptedAI
{ {
UnsummonAdds(); UnsummonAdds();
EnterEvadeMode(); EnterEvadeMode();
return;
} }
}else }else
{ {
@@ -276,6 +276,7 @@ struct TRINITY_DLL_DECL boss_warchief_kargath_bladefistAI : public ScriptedAI
if ( tempx > 255 || tempx < 205) if ( tempx > 255 || tempx < 205)
{ {
EnterEvadeMode(); EnterEvadeMode();
return;
} }
resetcheck_timer = 5000; resetcheck_timer = 5000;
}else resetcheck_timer -= diff; }else resetcheck_timer -= diff;
@@ -130,6 +130,7 @@ struct TRINITY_DLL_DECL boss_curatorAI : public ScriptedAI
{ {
Unit* target = NULL; Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1); target = SelectUnit(SELECT_TARGET_TOPAGGRO, 1);
if(target)
DoCast(target, SPELL_HATEFUL_BOLT); DoCast(target, SPELL_HATEFUL_BOLT);
HatefulBoltTimer = 15000; HatefulBoltTimer = 15000;
@@ -104,9 +104,6 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
void StartEvent() void StartEvent()
{ {
if(!pInstance)
return;
if(pInstance) if(pInstance)
pInstance->SetData(DATA_MOROES_EVENT, IN_PROGRESS); pInstance->SetData(DATA_MOROES_EVENT, IN_PROGRESS);
} }
@@ -266,7 +263,10 @@ struct TRINITY_DLL_DECL boss_moroesAI : public ScriptedAI
return; return;
if(pInstance && !pInstance->GetData(DATA_MOROES_EVENT)) if(pInstance && !pInstance->GetData(DATA_MOROES_EVENT))
{
EnterEvadeMode(); EnterEvadeMode();
return;
}
if(!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) if(!Enrage && m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30)
{ {
@@ -117,7 +117,12 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI
{ {
m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
m_creature->RemoveCorpse(); m_creature->RemoveCorpse();
}else pInstance->SetData(DATA_NIGHTBANE_EVENT, NOT_STARTED); }
else
{
if(pInstance)
pInstance->SetData(DATA_NIGHTBANE_EVENT, NOT_STARTED);
}
HandleTerraceDoors(true); HandleTerraceDoors(true);
@@ -288,6 +288,7 @@ struct TRINITY_DLL_DECL npc_barnesAI : public npc_escortAI
{ {
RaidWiped = true; RaidWiped = true;
EnterEvadeMode(); EnterEvadeMode();
return;
} }
WipeTimer = 15000; WipeTimer = 15000;
@@ -507,6 +508,8 @@ struct TRINITY_DLL_DECL npc_image_of_medivhAI : public ScriptedAI
Step = 1; Step = 1;
EventStarted = true; EventStarted = true;
Creature* Arcanagos = m_creature->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000); Creature* Arcanagos = m_creature->SummonCreature(MOB_ARCANAGOS,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,20000);
if(!Arcanagos)
return;
ArcanagosGUID = Arcanagos->GetGUID(); ArcanagosGUID = Arcanagos->GetGUID();
Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING); Arcanagos->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT + MOVEMENTFLAG_LEVITATING);
(*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]); (*Arcanagos).GetMotionMaster()->MovePoint(0,ArcanagosPos[0],ArcanagosPos[1],ArcanagosPos[2]);
@@ -153,6 +153,7 @@ struct TRINITY_DLL_DECL boss_vexallusAI : public ScriptedAI
{ {
Unit* target = NULL; Unit* target = NULL;
target = SelectUnit(SELECT_TARGET_RANDOM, 0); target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target)
DoCast(target, SPELL_ARCANE_SHOCK); DoCast(target, SPELL_ARCANE_SHOCK);
ArcaneShockTimer = 8000; ArcaneShockTimer = 8000;
}else ArcaneShockTimer -= diff; }else ArcaneShockTimer -= diff;