mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-21 15:27:47 -04:00
*code cleanup
*totally destroyed m_creature, use "me" for future coding --HG-- branch : trunk
This commit is contained in:
@@ -105,7 +105,7 @@ struct example_creatureAI : public ScriptedAI
|
||||
m_uiSpell3Timer = 19000; // 19 seconds
|
||||
m_uiBeserkTimer = 120000; // 2 minutes
|
||||
|
||||
m_creature->RestoreFaction();
|
||||
me->RestoreFaction();
|
||||
}
|
||||
|
||||
//*** HANDLED FUNCTION ***
|
||||
@@ -113,7 +113,7 @@ struct example_creatureAI : public ScriptedAI
|
||||
void EnterCombat(Unit* pWho)
|
||||
{
|
||||
//Say some stuff
|
||||
DoScriptText(SAY_AGGRO, m_creature, pWho);
|
||||
DoScriptText(SAY_AGGRO, me, pWho);
|
||||
}
|
||||
|
||||
//*** HANDLED FUNCTION ***
|
||||
@@ -128,22 +128,22 @@ struct example_creatureAI : public ScriptedAI
|
||||
// Called when going out of combat. Reset is called just after.
|
||||
void EnterEvadeMode()
|
||||
{
|
||||
DoScriptText(SAY_EVADE, m_creature);
|
||||
DoScriptText(SAY_EVADE, me);
|
||||
}
|
||||
|
||||
//*** HANDLED FUNCTION ***
|
||||
//Our Receive emote function
|
||||
void ReceiveEmote(Player* pPlayer, uint32 uiTextEmote)
|
||||
{
|
||||
m_creature->HandleEmoteCommand(uiTextEmote);
|
||||
me->HandleEmoteCommand(uiTextEmote);
|
||||
|
||||
switch(uiTextEmote)
|
||||
{
|
||||
case TEXTEMOTE_DANCE:
|
||||
DoScriptText(SAY_DANCE, m_creature);
|
||||
DoScriptText(SAY_DANCE, me);
|
||||
break;
|
||||
case TEXTEMOTE_SALUTE:
|
||||
DoScriptText(SAY_SALUTE, m_creature);
|
||||
DoScriptText(SAY_SALUTE, me);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -153,13 +153,13 @@ struct example_creatureAI : public ScriptedAI
|
||||
void UpdateAI(const uint32 uiDiff)
|
||||
{
|
||||
//Out of combat timers
|
||||
if (!m_creature->getVictim())
|
||||
if (!me->getVictim())
|
||||
{
|
||||
//Random Say timer
|
||||
if (m_uiSayTimer <= uiDiff)
|
||||
{
|
||||
//Random switch between 5 outcomes
|
||||
DoScriptText(RAND(SAY_RANDOM_0,SAY_RANDOM_1,SAY_RANDOM_2,SAY_RANDOM_3,SAY_RANDOM_4), m_creature);
|
||||
DoScriptText(RAND(SAY_RANDOM_0,SAY_RANDOM_1,SAY_RANDOM_2,SAY_RANDOM_3,SAY_RANDOM_4), me);
|
||||
|
||||
m_uiSayTimer = 45000; //Say something agian in 45 seconds
|
||||
}
|
||||
@@ -169,7 +169,7 @@ struct example_creatureAI : public ScriptedAI
|
||||
//Rebuff timer
|
||||
if (m_uiRebuffTimer <= uiDiff)
|
||||
{
|
||||
DoCast(m_creature, SPELL_BUFF);
|
||||
DoCast(me, SPELL_BUFF);
|
||||
m_uiRebuffTimer = 900000; //Rebuff agian in 15 minutes
|
||||
}
|
||||
else
|
||||
@@ -185,9 +185,9 @@ struct example_creatureAI : public ScriptedAI
|
||||
{
|
||||
//Cast spell one on our current target.
|
||||
if (rand()%50 > 10)
|
||||
DoCast(m_creature->getVictim(), SPELL_ONE_ALT);
|
||||
else if (m_creature->IsWithinDist(m_creature->getVictim(), 25.0f))
|
||||
DoCast(m_creature->getVictim(), SPELL_ONE);
|
||||
DoCast(me->getVictim(), SPELL_ONE_ALT);
|
||||
else if (me->IsWithinDist(me->getVictim(), 25.0f))
|
||||
DoCast(me->getVictim(), SPELL_ONE);
|
||||
|
||||
m_uiSpell1Timer = 5000;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ struct example_creatureAI : public ScriptedAI
|
||||
if (m_uiSpell2Timer <= uiDiff)
|
||||
{
|
||||
//Cast spell two on our current target.
|
||||
DoCast(m_creature->getVictim(), SPELL_TWO);
|
||||
DoCast(me->getVictim(), SPELL_TWO);
|
||||
m_uiSpell2Timer = 37000;
|
||||
}
|
||||
else
|
||||
@@ -211,7 +211,7 @@ struct example_creatureAI : public ScriptedAI
|
||||
if (m_uiSpell3Timer <= uiDiff)
|
||||
{
|
||||
//Cast spell one on our current target.
|
||||
DoCast(m_creature->getVictim(), SPELL_THREE);
|
||||
DoCast(me->getVictim(), SPELL_THREE);
|
||||
|
||||
m_uiSpell3Timer = 19000;
|
||||
}
|
||||
@@ -221,8 +221,8 @@ struct example_creatureAI : public ScriptedAI
|
||||
if (m_uiBeserkTimer <= uiDiff)
|
||||
{
|
||||
//Say our line then cast uber death spell
|
||||
DoScriptText(SAY_BERSERK, m_creature, m_creature->getVictim());
|
||||
DoCast(m_creature->getVictim(), SPELL_BERSERK);
|
||||
DoScriptText(SAY_BERSERK, me, me->getVictim());
|
||||
DoCast(me->getVictim(), SPELL_BERSERK);
|
||||
|
||||
//Cast our beserk spell agian in 12 seconds if we didn't kill everyone
|
||||
m_uiBeserkTimer = 12000;
|
||||
@@ -236,8 +236,8 @@ struct example_creatureAI : public ScriptedAI
|
||||
{
|
||||
//Go to next phase
|
||||
++m_uiPhase;
|
||||
DoScriptText(SAY_PHASE, m_creature);
|
||||
DoCast(m_creature, SPELL_FRENZY);
|
||||
DoScriptText(SAY_PHASE, me);
|
||||
DoCast(me, SPELL_FRENZY);
|
||||
}
|
||||
else
|
||||
m_uiPhaseTimer -= uiDiff;
|
||||
|
||||
@@ -60,7 +60,7 @@ struct example_escortAI : public npc_escortAI
|
||||
|
||||
void JustSummoned(Creature* pSummoned)
|
||||
{
|
||||
pSummoned->AI()->AttackStart(m_creature);
|
||||
pSummoned->AI()->AttackStart(me);
|
||||
}
|
||||
|
||||
// Pure Virtual Functions (Have to be implemented)
|
||||
@@ -69,17 +69,17 @@ struct example_escortAI : public npc_escortAI
|
||||
switch (uiWP)
|
||||
{
|
||||
case 1:
|
||||
DoScriptText(SAY_WP_1, m_creature);
|
||||
DoScriptText(SAY_WP_1, me);
|
||||
break;
|
||||
case 3:
|
||||
DoScriptText(SAY_WP_2, m_creature);
|
||||
m_creature->SummonCreature(NPC_FELBOAR, m_creature->GetPositionX()+5.0f, m_creature->GetPositionY()+7.0f, m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
|
||||
DoScriptText(SAY_WP_2, me);
|
||||
me->SummonCreature(NPC_FELBOAR, me->GetPositionX()+5.0f, me->GetPositionY()+7.0f, me->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000);
|
||||
break;
|
||||
case 4:
|
||||
if (Player* pPlayer = GetPlayerForEscort())
|
||||
{
|
||||
//pTmpPlayer is the target of the text
|
||||
DoScriptText(SAY_WP_3, m_creature, pPlayer);
|
||||
DoScriptText(SAY_WP_3, me, pPlayer);
|
||||
//pTmpPlayer is the source of the text
|
||||
DoScriptText(SAY_WP_4, pPlayer);
|
||||
}
|
||||
@@ -92,10 +92,10 @@ struct example_escortAI : public npc_escortAI
|
||||
if (HasEscortState(STATE_ESCORT_ESCORTING))
|
||||
{
|
||||
if (Player* pPlayer = GetPlayerForEscort())
|
||||
DoScriptText(SAY_AGGRO1, m_creature, pPlayer);
|
||||
DoScriptText(SAY_AGGRO1, me, pPlayer);
|
||||
}
|
||||
else
|
||||
DoScriptText(SAY_AGGRO2, m_creature);
|
||||
DoScriptText(SAY_AGGRO2, me);
|
||||
}
|
||||
|
||||
void Reset()
|
||||
@@ -111,16 +111,16 @@ struct example_escortAI : public npc_escortAI
|
||||
if (Player* pPlayer = GetPlayerForEscort())
|
||||
{
|
||||
// not a likely case, code here for the sake of example
|
||||
if (pKiller == m_creature)
|
||||
if (pKiller == me)
|
||||
{
|
||||
DoScriptText(SAY_DEATH_1, m_creature, pPlayer);
|
||||
DoScriptText(SAY_DEATH_1, me, pPlayer);
|
||||
}
|
||||
else
|
||||
DoScriptText(SAY_DEATH_2, m_creature, pPlayer);
|
||||
DoScriptText(SAY_DEATH_2, me, pPlayer);
|
||||
}
|
||||
}
|
||||
else
|
||||
DoScriptText(SAY_DEATH_3, m_creature);
|
||||
DoScriptText(SAY_DEATH_3, me);
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 uiDiff)
|
||||
@@ -129,12 +129,12 @@ struct example_escortAI : public npc_escortAI
|
||||
npc_escortAI::UpdateAI(uiDiff);
|
||||
|
||||
//Combat check
|
||||
if (m_creature->getVictim())
|
||||
if (me->getVictim())
|
||||
{
|
||||
if (m_uiDeathCoilTimer <= uiDiff)
|
||||
{
|
||||
DoScriptText(SAY_SPELL, m_creature);
|
||||
DoCast(m_creature->getVictim(), SPELL_DEATH_COIL, false);
|
||||
DoScriptText(SAY_SPELL, me);
|
||||
DoCast(me->getVictim(), SPELL_DEATH_COIL, false);
|
||||
m_uiDeathCoilTimer = 4000;
|
||||
}
|
||||
else
|
||||
@@ -147,15 +147,15 @@ struct example_escortAI : public npc_escortAI
|
||||
{
|
||||
if (m_uiChatTimer <= uiDiff)
|
||||
{
|
||||
if (m_creature->HasAura(SPELL_ELIXIR_OF_FORTITUDE, 0))
|
||||
if (me->HasAura(SPELL_ELIXIR_OF_FORTITUDE, 0))
|
||||
{
|
||||
DoScriptText(SAY_RAND_1, m_creature);
|
||||
DoCast(m_creature, SPELL_BLUE_FIREWORK, false);
|
||||
DoScriptText(SAY_RAND_1, me);
|
||||
DoCast(me, SPELL_BLUE_FIREWORK, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoScriptText(SAY_RAND_2, m_creature);
|
||||
DoCast(m_creature, SPELL_ELIXIR_OF_FORTITUDE, false);
|
||||
DoScriptText(SAY_RAND_2, me);
|
||||
DoCast(me, SPELL_ELIXIR_OF_FORTITUDE, false);
|
||||
}
|
||||
|
||||
m_uiChatTimer = 12000;
|
||||
|
||||
Reference in New Issue
Block a user