*Fix a crash caused by shaffar script.
*Fix build. --HG-- branch : trunk
This commit is contained in:
+18
-42
@@ -55,7 +55,7 @@ enum
|
||||
|
||||
struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI
|
||||
{
|
||||
boss_nexusprince_shaffarAI(Creature *c) : ScriptedAI(c) { HasTaunted = false; }
|
||||
boss_nexusprince_shaffarAI(Creature *c) : ScriptedAI(c), summons(me) { HasTaunted = false; }
|
||||
|
||||
uint32 Blink_Timer;
|
||||
uint32 Beacon_Timer;
|
||||
@@ -63,18 +63,11 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI
|
||||
uint32 Frostbolt_Timer;
|
||||
uint32 FrostNova_Timer;
|
||||
|
||||
Creature* Beacon[NR_INITIAL_BEACONS];
|
||||
SummonList summons;
|
||||
|
||||
bool HasTaunted;
|
||||
bool CanBlink;
|
||||
|
||||
void RemoveBeaconFromList(Creature* targetBeacon)
|
||||
{
|
||||
for(uint8 i = 0; i < NR_INITIAL_BEACONS; i++)
|
||||
if(Beacon[i] && Beacon[i]->GetGUID() == targetBeacon->GetGUID())
|
||||
Beacon[i] = NULL;
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
Blink_Timer = 1500;
|
||||
@@ -89,30 +82,14 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI
|
||||
float posX, posY, posZ, angle;
|
||||
m_creature->GetHomePosition(posX, posY, posZ, angle);
|
||||
|
||||
Beacon[0] = m_creature->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000);
|
||||
Beacon[1] = m_creature->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000);
|
||||
Beacon[2] = m_creature->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000);
|
||||
|
||||
for(uint8 i = 0; i < NR_INITIAL_BEACONS; i++)
|
||||
{
|
||||
if(Beacon[i])
|
||||
Beacon[i]->CastSpell(Beacon[i], SPELL_ETHEREAL_BEACON_VISUAL, false);
|
||||
}
|
||||
m_creature->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000);
|
||||
m_creature->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000);
|
||||
m_creature->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000);
|
||||
}
|
||||
|
||||
void EnterEvadeMode()
|
||||
{
|
||||
//Despawn still living initial beacons.
|
||||
for(uint8 i = 0; i < NR_INITIAL_BEACONS; i++)
|
||||
{
|
||||
if(Beacon[i] && Beacon[i]->isAlive())
|
||||
{
|
||||
Beacon[i]->RemoveAllAuras();
|
||||
Beacon[i]->CombatStop();
|
||||
Beacon[i]->StopMoving();
|
||||
Beacon[i]->Kill(Beacon[i]);
|
||||
}
|
||||
}
|
||||
summons.DespawnAll();
|
||||
ScriptedAI::EnterEvadeMode();
|
||||
}
|
||||
|
||||
@@ -134,10 +111,8 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI
|
||||
case 2: DoScriptText(SAY_AGGRO_3, m_creature); break;
|
||||
}
|
||||
|
||||
// Send initial beacons to join the fight if not already
|
||||
for(uint8 i = 0; i < NR_INITIAL_BEACONS; i++)
|
||||
if(Beacon[i] && Beacon[i]->isAlive() && !Beacon[i]->isInCombat())
|
||||
Beacon[i]->AI()->AttackStart(who);
|
||||
DoZoneInCombat();
|
||||
summons.DoZoneInCombat();
|
||||
}
|
||||
|
||||
void JustSummoned(Creature *summoned)
|
||||
@@ -149,6 +124,13 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI
|
||||
if( Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0) )
|
||||
summoned->AI()->AttackStart(target);
|
||||
}
|
||||
|
||||
summons.Summon(summoned);
|
||||
}
|
||||
|
||||
void SummonedCreatureDespawn(Creature *summon)
|
||||
{
|
||||
summons.Despawn(summon);
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* victim)
|
||||
@@ -163,6 +145,7 @@ struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI
|
||||
void JustDied(Unit* Killer)
|
||||
{
|
||||
DoScriptText(SAY_DEAD, m_creature);
|
||||
summons.DespawnAll();
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
@@ -265,14 +248,14 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
|
||||
void EnterCombat(Unit *who)
|
||||
{
|
||||
// Send Shaffar to fight
|
||||
Unit* Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100);
|
||||
Creature* Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100);
|
||||
if(!Shaffar || Shaffar->isDead())
|
||||
{
|
||||
KillSelf();
|
||||
return;
|
||||
}
|
||||
if(!Shaffar->isInCombat())
|
||||
CAST_CRE(Shaffar)->AI()->AttackStart(who);
|
||||
Shaffar->AI()->AttackStart(who);
|
||||
}
|
||||
|
||||
void JustSummoned(Creature *summoned)
|
||||
@@ -280,13 +263,6 @@ struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI
|
||||
summoned->AI()->AttackStart(m_creature->getVictim());
|
||||
}
|
||||
|
||||
void JustDied(Unit* Killer)
|
||||
{
|
||||
Creature *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100);
|
||||
if(Shaffar)
|
||||
CAST_AI(boss_nexusprince_shaffarAI, Shaffar->AI())->RemoveBeaconFromList(m_creature);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!UpdateVictim())
|
||||
|
||||
@@ -269,24 +269,30 @@ public:
|
||||
bool GOHello_go_orb_of_the_blue_flight(Player *plr, GameObject* go)
|
||||
{
|
||||
if(go->GetUInt32Value(GAMEOBJECT_FACTION) == 35){
|
||||
ScriptedInstance* pInstance = (go->GetInstanceData());
|
||||
float x,y,z, dx,dy,dz;
|
||||
ScriptedInstance* pInstance = go->GetInstanceData();
|
||||
float x,y,z;
|
||||
//float dx,dy,dz;
|
||||
go->SummonCreature(CREATURE_POWER_OF_THE_BLUE_DRAGONFLIGHT, plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN, 121000);
|
||||
plr->CastSpell(plr, SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, true);
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, 0);
|
||||
Unit* Kalec = CAST_CRE(Unit::GetUnit(*plr, pInstance->GetData64(DATA_KALECGOS_KJ)));
|
||||
Creature* Kalec = Unit::GetCreature(*plr, pInstance->GetData64(DATA_KALECGOS_KJ));
|
||||
//Kalec->RemoveDynObject(SPELL_RING_OF_BLUE_FLAMES);
|
||||
go->GetPosition(x,y,z);
|
||||
for(uint8 i = 0; i < 4; ++i){
|
||||
DynamicObject* Dyn = Kalec->GetDynObject(SPELL_RING_OF_BLUE_FLAMES);
|
||||
if(Dyn){
|
||||
// this won't work. need rewritten
|
||||
/*
|
||||
for(uint8 i = 0; i < 4; ++i)
|
||||
{
|
||||
if(DynamicObject* Dyn = Kalec->GetDynObject(SPELL_RING_OF_BLUE_FLAMES))
|
||||
{
|
||||
Dyn->GetPosition(dx,dy,dz);
|
||||
if(x == dx && dy == y && dz == z){
|
||||
if(x == dx && dy == y && dz == z)
|
||||
{
|
||||
Dyn->Delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
go->Refresh();
|
||||
}
|
||||
return true;
|
||||
@@ -361,7 +367,11 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI
|
||||
Orb[i]->setActive(true);
|
||||
Orb[i]->Refresh();
|
||||
}
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
// this won't work
|
||||
/*
|
||||
float x,y,z, dx,dy,dz;
|
||||
Orb[random]->GetPosition(x,y,z);
|
||||
for(uint8 i = 0; i < 4; ++i){
|
||||
@@ -373,7 +383,7 @@ struct TRINITY_DLL_DECL boss_kalecgos_kjAI : public ScriptedAI
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
Orb[random]->CastSpell(m_creature, SPELL_RING_OF_BLUE_FLAMES);
|
||||
Orb[random]->SetUInt32Value(GAMEOBJECT_FACTION, 35);
|
||||
Orb[random]->setActive(true);
|
||||
|
||||
Reference in New Issue
Block a user