*Replace pointers to Guids in Kelidan script - by Iskander

--HG--
branch : trunk
This commit is contained in:
Blaymoira
2009-01-21 19:22:32 +01:00
parent a39d1daeb4
commit 8dc780bfda
3 changed files with 48 additions and 39 deletions

View File

@@ -1 +1 @@
update creature_template set scriptname='npc_snake_trap_serpents' where entry in (19921, 19833);
update creature_template set scriptname='npc_snake_trap_serpents' where entry in (19921, 19833);

View File

@@ -74,7 +74,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
{
pInstance = ((ScriptedInstance*)c->GetInstanceData());
HeroicMode = m_creature->GetMap()->IsHeroic();
for(int i=0; i<5; i++) Channelers[i] = NULL;
for(int i=0; i<5; ++i) Channelers[i] = 0;
Reset();
}
@@ -88,7 +88,7 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
uint32 check_Timer;
bool Firenova;
bool addYell;
Creature *Channelers[5];
uint64 Channelers[5];
void Reset()
{
@@ -133,44 +133,50 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
default: DoScriptText(SAY_ADD_AGGRO_3, m_creature); break;
}
}
for(int i=0; i<5; i++)
if(who && Channelers[i] && !Channelers[i]->isInCombat())
Channelers[i]->AI()->AttackStart(who);
for(int i=0; i<5; ++i)
{
Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]);
if(who && channeler && !channeler->isInCombat())
channeler->AI()->AttackStart(who);
}
}
void ChannelerDied(Unit* killer)
{
for(int i=0; i<5; i++)
if(Channelers[i] && Channelers[i]->isAlive())
return;
for(int i=0; i<5; ++i)
{
Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]);
if(channeler && channeler->isAlive())
return;
}
if(killer)
m_creature->AI()->AttackStart(killer);
}
Creature* GetChanneled(Creature *channeler)
uint64 GetChanneled(Creature *channeler1)
{
SummonChannelers();
if(!channeler) return NULL;
if(!channeler1) return NULL;
int i;
for(i=0; i<5; i++)
if(Channelers[i] && Channelers[i]->GetGUID()==channeler->GetGUID())
break;
for(i=0; i<5; ++i)
{
Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]);
if(channeler && channeler->GetGUID()==channeler1->GetGUID())
break;
}
return Channelers[(i+2)%5];
}
void SummonChannelers()
{
for(int i=0; i<5; i++)
if(!Channelers[i] || Channelers[i]->isDead())
Channelers[i] = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000);
}
void JustSummoned(Creature *summon)
{
for(int i=0; i<5; i++)
if(!Channelers[i] || Channelers[i]->isDead())
return;
DoCast(m_creature,SPELL_EVOCATION);
for(int i=0; i<5; ++i)
{
Creature *channeler = (Creature*)Unit::GetUnit(*m_creature, Channelers[i]);
if(!channeler || channeler->isDead())
channeler = m_creature->SummonCreature(ENTRY_CHANNELER,ShadowmoonChannelers[i][0],ShadowmoonChannelers[i][1],ShadowmoonChannelers[i][2],ShadowmoonChannelers[i][3],TEMPSUMMON_CORPSE_TIMED_DESPAWN,300000);
Channelers[i] = channeler->GetGUID();
}
}
void JustDied(Unit* Killer)
@@ -309,8 +315,11 @@ struct TRINITY_DLL_DECL mob_shadowmoon_channelerAI : public ScriptedAI
{
if (!m_creature->IsNonMeleeSpellCasted(false))
if(Creature *Kelidan = (Creature *)FindCreature(ENTRY_KELIDAN, 100))
if(Creature *channeled = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature))
DoCast(channeled,SPELL_CHANNELING);
{
uint64 channeler = ((boss_kelidan_the_breakerAI*)Kelidan->AI())->GetChanneled(m_creature);
if(Unit *channeled = Unit::GetUnit(*m_creature, channeler))
DoCast(channeled,SPELL_CHANNELING);
}
check_Timer = 5000;
}else check_Timer -= diff;
return;

View File

@@ -24,30 +24,30 @@ EndScriptData */
#include "precompiled.h"
#include "def_blood_furnace.h"
#define ENTRY_DOOR1 181823
#define ENTRY_DOOR2 181766
#define ENTRY_SEWER1 181823
#define ENTRY_SEWER2 181766
struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance
{
instance_blood_furnace(Map *map) : ScriptedInstance(map) {Initialize();};
uint64 Door1GUID;
uint64 Door2GUID;
uint64 Sewer1GUID;
uint64 Sewer2GUID;
void Initialize()
{
Door1GUID = 0;
Door2GUID = 0;
Sewer1GUID = 0;
Sewer2GUID = 0;
}
void OnObjectCreate(GameObject *go)
{
switch(go->GetEntry())
{
case ENTRY_DOOR1: Door1GUID = go->GetGUID(); break;
case ENTRY_DOOR2: Door2GUID = go->GetGUID(); break;
case ENTRY_SEWER1: Sewer1GUID = go->GetGUID(); break;
case ENTRY_SEWER2: Sewer2GUID = go->GetGUID(); break;
}
}
@@ -64,7 +64,7 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance
}
}
debug_log("SD2: Instance Blood Furnace: GetPlayerInMap, but PlayerList is empty!");
debug_log("TSCR: Instance Blood Furnace: GetPlayerInMap, but PlayerList is empty!");
return NULL;
}
@@ -74,7 +74,7 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance
if (!player || !guid)
{
debug_log("SD2: Blood Furnace: HandleGameObject fail");
debug_log("TSCR: Blood Furnace: HandleGameObject fail");
return;
}
@@ -89,8 +89,8 @@ struct TRINITY_DLL_DECL instance_blood_furnace : public ScriptedInstance
case DATA_KELIDANEVENT:
if( data == DONE )
{
HandleGameObject(Door1GUID,0);
HandleGameObject(Door2GUID,0);
HandleGameObject(Sewer1GUID,0);
HandleGameObject(Sewer2GUID,0);
}
break;
}