*Little cleanup in Utgarde Keep.

--HG--
branch : trunk
This commit is contained in:
Anubisss
2009-03-15 22:13:07 +01:00
parent 3de99d25ff
commit 5ea9d6fa23
5 changed files with 61 additions and 50 deletions
@@ -8,12 +8,12 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* ScriptData /* ScriptData
@@ -96,9 +96,6 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI
void Reset() void Reset()
{ {
if(pInstance)
pInstance->SetData(DATA_INGVAR, NOT_STARTED);
if(undead) // Visual Hack if(undead) // Visual Hack
m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_INGVAR_HUMAN); m_creature->SetUInt32Value(UNIT_FIELD_DISPLAYID, MODEL_INGVAR_HUMAN);
@@ -116,6 +113,9 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI
SpawnResTimer = 3000; SpawnResTimer = 3000;
wait_Timer = 0; wait_Timer = 0;
if(pInstance)
pInstance->SetData(DATA_INGVAR_EVENT, NOT_STARTED);
} }
void DamageTaken(Unit *done_by, uint32 &damage) void DamageTaken(Unit *done_by, uint32 &damage)
@@ -160,20 +160,20 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI
void Aggro(Unit *who) void Aggro(Unit *who)
{ {
if(pInstance)
pInstance->SetData(DATA_INGVAR, IN_PROGRESS);
DoYell(YELL_AGGRO_1,LANG_UNIVERSAL,NULL); DoYell(YELL_AGGRO_1,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_AGGRO_1); DoPlaySoundToSet(m_creature,SOUND_AGGRO_1);
if(pInstance)
pInstance->SetData(DATA_INGVAR_EVENT, IN_PROGRESS);
} }
void JustDied(Unit* killer) void JustDied(Unit* killer)
{ {
if(pInstance)
pInstance->SetData(DATA_INGVAR, DONE);
DoYell(YELL_DEAD_2,LANG_UNIVERSAL,NULL); DoYell(YELL_DEAD_2,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_DEAD_2); DoPlaySoundToSet(m_creature,SOUND_DEAD_2);
if(pInstance)
pInstance->SetData(DATA_INGVAR_EVENT, DONE);
} }
void KilledUnit(Unit *victim) void KilledUnit(Unit *victim)
@@ -190,7 +190,6 @@ struct TRINITY_DLL_DECL boss_ingvar_the_plundererAI : public ScriptedAI
} }
} }
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if (!UpdateVictim()) if (!UpdateVictim())
@@ -8,12 +8,12 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* ScriptData /* ScriptData
@@ -120,7 +120,7 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI
ResetTimer(); ResetTimer();
if(pInstance) if(pInstance)
pInstance->SetData(DATA_PRINCEKELESETH, NOT_STARTED); pInstance->SetData(DATA_PRINCEKELESETH_EVENT, NOT_STARTED);
} }
void KilledUnit(Unit *victim) void KilledUnit(Unit *victim)
@@ -133,19 +133,19 @@ struct TRINITY_DLL_DECL boss_kelesethAI : public ScriptedAI
void JustDied(Unit* killer) void JustDied(Unit* killer)
{ {
if(pInstance)
pInstance->SetData(DATA_PRINCEKELESETH, DONE);
DoScriptText(SAY_DEATH, m_creature); DoScriptText(SAY_DEATH, m_creature);
if(pInstance)
pInstance->SetData(DATA_PRINCEKELESETH_EVENT, DONE);
} }
void Aggro(Unit* who) void Aggro(Unit* who)
{ {
if(pInstance)
pInstance->SetData(DATA_PRINCEKELESETH, IN_PROGRESS);
DoScriptText(SAY_AGGRO, m_creature); DoScriptText(SAY_AGGRO, m_creature);
DoZoneInCombat(); DoZoneInCombat();
if(pInstance)
pInstance->SetData(DATA_PRINCEKELESETH_EVENT, IN_PROGRESS);
} }
void ResetTimer(uint32 inc = 0) void ResetTimer(uint32 inc = 0)
@@ -273,7 +273,7 @@ struct TRINITY_DLL_DECL mob_vrykul_skeletonAI : public ScriptedAI
void UpdateAI(const uint32 diff) void UpdateAI(const uint32 diff)
{ {
if(pInstance->GetData(DATA_PRINCEKELESETH) == IN_PROGRESS) if(pInstance->GetData(DATA_PRINCEKELESETH_EVENT) == IN_PROGRESS)
{ {
if(isDead) if(isDead)
{ {
@@ -8,12 +8,12 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* ScriptData /* ScriptData
@@ -94,11 +94,12 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI
ghost = (m_creature->GetEntry() == MOB_SKARVALD_GHOST); ghost = (m_creature->GetEntry() == MOB_SKARVALD_GHOST);
if(!ghost) if(!ghost)
{ {
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT,NOT_STARTED);
Unit* dalronn = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_DALRONN)); Unit* dalronn = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_DALRONN));
if(dalronn && dalronn->isDead()) if(dalronn && dalronn->isDead())
((Creature*)dalronn)->Respawn(); ((Creature*)dalronn)->Respawn();
if(pInstance)
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED);
} }
} }
@@ -109,10 +110,12 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI
DoYell(YELL_SKARVALD_AGGRO,LANG_UNIVERSAL,NULL); DoYell(YELL_SKARVALD_AGGRO,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_SKARVALD_AGGRO); DoPlaySoundToSet(m_creature,SOUND_SKARVALD_AGGRO);
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT,IN_PROGRESS);
Unit* dalronn = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_DALRONN)); Unit* dalronn = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_DALRONN));
if(dalronn && dalronn->isAlive() && !dalronn->getVictim()) if(dalronn && dalronn->isAlive() && !dalronn->getVictim())
dalronn->getThreatManager().addThreat(who,0.0f); dalronn->getThreatManager().addThreat(who,0.0f);
if(pInstance)
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS);
} }
} }
@@ -128,7 +131,8 @@ struct TRINITY_DLL_DECL boss_skarvald_the_constructorAI : public ScriptedAI
DoYell(YELL_SKARVALD_DAL_DIED,LANG_UNIVERSAL,NULL); DoYell(YELL_SKARVALD_DAL_DIED,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_SKARVALD_DAL_DIED); DoPlaySoundToSet(m_creature,SOUND_SKARVALD_DAL_DIED);
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT,DONE); if(pInstance)
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE);
} }
else else
{ {
@@ -248,23 +252,27 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI
ghost = m_creature->GetEntry() == MOB_DALRONN_GHOST; ghost = m_creature->GetEntry() == MOB_DALRONN_GHOST;
if(!ghost) if(!ghost)
{ {
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT,NOT_STARTED);
Unit* skarvald = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SKARVALD)); Unit* skarvald = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SKARVALD));
if(skarvald && skarvald->isDead()) if(skarvald && skarvald->isDead())
((Creature*)skarvald)->Respawn(); ((Creature*)skarvald)->Respawn();
if(pInstance)
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, NOT_STARTED);
} }
} }
void Aggro(Unit *who) void Aggro(Unit *who)
{ {
if(!ghost) if(!ghost)
{ {
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT,IN_PROGRESS);
Unit* skarvald = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SKARVALD)); Unit* skarvald = Unit::GetUnit((*m_creature),pInstance->GetData64(DATA_SKARVALD));
if(skarvald && skarvald->isAlive() && !skarvald->getVictim()) if(skarvald && skarvald->isAlive() && !skarvald->getVictim())
skarvald->getThreatManager().addThreat(who,0.0f); skarvald->getThreatManager().addThreat(who,0.0f);
AggroYell_Timer = 5000; AggroYell_Timer = 5000;
if(pInstance)
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, IN_PROGRESS);
} }
} }
@@ -279,7 +287,8 @@ struct TRINITY_DLL_DECL boss_dalronn_the_controllerAI : public ScriptedAI
DoYell(YELL_DALRONN_SKA_DIED,LANG_UNIVERSAL,NULL); DoYell(YELL_DALRONN_SKA_DIED,LANG_UNIVERSAL,NULL);
DoPlaySoundToSet(m_creature,SOUND_DALRONN_SKA_DIED); DoPlaySoundToSet(m_creature,SOUND_DALRONN_SKA_DIED);
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT,DONE); if(pInstance)
pInstance->SetData(DATA_SKARVALD_DALRONN_EVENT, DONE);
} }
else else
{ {
@@ -8,21 +8,24 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef DEF_UTGARDE_KEEP_H #ifndef DEF_UTGARDE_KEEP_H
#define DEF_UTGARDE_KEEP_H #define DEF_UTGARDE_KEEP_H
#define DATA_PRINCEKELESETH 1 #define DATA_PRINCEKELESETH 1
#define DATA_SKARVALD 2 #define DATA_SKARVALD 3
#define DATA_DALRONN 3 #define DATA_DALRONN 4
#define DATA_INGVAR 4 #define DATA_INGVAR 6
#define DATA_PRINCEKELESETH_EVENT 2
#define DATA_SKARVALD_DALRONN_EVENT 5
#define DATA_INGVAR_EVENT 7
#define DATA_SKARVALD_DALRONN_EVENT 2
#endif #endif
@@ -8,12 +8,12 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* ScriptData /* ScriptData
@@ -98,7 +98,7 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance
void OnCreatureCreate(Creature *creature, uint32 creature_entry) void OnCreatureCreate(Creature *creature, uint32 creature_entry)
{ {
switch(creature->GetEntry()) switch(creature_entry)
{ {
case 23953: Keleseth = creature->GetGUID(); break; case 23953: Keleseth = creature->GetGUID(); break;
case 24201: Dalronn = creature->GetGUID(); break; case 24201: Dalronn = creature->GetGUID(); break;
@@ -119,10 +119,10 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance
{ {
switch(identifier) switch(identifier)
{ {
case DATA_PRINCEKELESETH: return Keleseth; case DATA_PRINCEKELESETH: return Keleseth;
case DATA_DALRONN: return Dalronn; case DATA_DALRONN: return Dalronn;
case DATA_SKARVALD: return Skarvald; case DATA_SKARVALD: return Skarvald;
case DATA_INGVAR: return Ingvar; case DATA_INGVAR: return Ingvar;
} }
return 0; return 0;
@@ -132,7 +132,7 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance
{ {
switch(type) switch(type)
{ {
case DATA_PRINCEKELESETH: case DATA_PRINCEKELESETH_EVENT:
if(data == DONE) if(data == DONE)
{ {
//HandleGameObject(doorname, 0); //HandleGameObject(doorname, 0);
@@ -144,7 +144,7 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance
//HandleGameObject(doorname, 0); //HandleGameObject(doorname, 0);
} }
Encounters[1] = data; break; Encounters[1] = data; break;
case DATA_INGVAR: case DATA_INGVAR_EVENT:
if(data == DONE) if(data == DONE)
{ {
//HandleGameObject(doorname, 0); //HandleGameObject(doorname, 0);
@@ -162,9 +162,9 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance
{ {
switch(type) switch(type)
{ {
case DATA_PRINCEKELESETH: return Encounters[0]; case DATA_PRINCEKELESETH_EVENT: return Encounters[0];
case DATA_SKARVALD_DALRONN_EVENT: return Encounters[1]; case DATA_SKARVALD_DALRONN_EVENT: return Encounters[1];
case DATA_INGVAR: return Encounters[2]; case DATA_INGVAR_EVENT: return Encounters[2];
} }
return 0; return 0;