From 6bcb297de4d5231373a3e2bf2b40e527b91cdf46 Mon Sep 17 00:00:00 2001 From: Rat Date: Wed, 14 Apr 2010 23:07:41 +0200 Subject: *code cleanup *totally destroyed m_creature, use "me" for future coding --HG-- branch : trunk --- src/scripts/world/boss_emeriss.cpp | 16 +- src/scripts/world/boss_taerar.cpp | 30 +-- src/scripts/world/boss_ysondre.cpp | 14 +- src/scripts/world/guards.cpp | 8 +- src/scripts/world/mob_generic_creature.cpp | 42 ++--- src/scripts/world/npcs_special.cpp | 294 ++++++++++++++--------------- 6 files changed, 202 insertions(+), 202 deletions(-) (limited to 'src/scripts/world') diff --git a/src/scripts/world/boss_emeriss.cpp b/src/scripts/world/boss_emeriss.cpp index fd930f6838f..0dcb30bd55d 100644 --- a/src/scripts/world/boss_emeriss.cpp +++ b/src/scripts/world/boss_emeriss.cpp @@ -59,7 +59,7 @@ struct boss_emerissAI : public ScriptedAI void Aggro(Unit* pWho) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, me); } void UpdateAI(const uint32 uiDiff) @@ -82,7 +82,7 @@ struct boss_emerissAI : public ScriptedAI //NoxiousBreath_Timer if (m_uiNoxiousBreath_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); + DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); m_uiNoxiousBreath_Timer = 14000 + rand()%6000; } else @@ -91,7 +91,7 @@ struct boss_emerissAI : public ScriptedAI //Tailsweep every 2 seconds if (m_uiTailSweep_Timer <= uiDiff) { - DoCast(m_creature, SPELL_TAILSWEEP); + DoCast(me, SPELL_TAILSWEEP); m_uiTailSweep_Timer = 2000; } else @@ -100,7 +100,7 @@ struct boss_emerissAI : public ScriptedAI //MarkOfNature_Timer //if (m_uiMarkOfNature_Timer <= uiDiff) //{ - // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); + // DoCast(me->getVictim(), SPELL_MARKOFNATURE); // m_uiMarkOfNature_Timer = 45000; //} //else @@ -109,7 +109,7 @@ struct boss_emerissAI : public ScriptedAI //VolatileInfection_Timer if (m_uiVolatileInfection_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_VOLATILEINFECTION); + DoCast(me->getVictim(), SPELL_VOLATILEINFECTION); m_uiVolatileInfection_Timer = 7000 + rand()%5000; } else @@ -117,11 +117,11 @@ struct boss_emerissAI : public ScriptedAI //CorruptionofEarth_Timer //CorruptionofEarth at 75%, 50% and 25% - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) + if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiCorruptionsCasted))) { ++m_uiCorruptionsCasted; // prevent casting twice on same hp - DoScriptText(SAY_CASTCORRUPTION, m_creature); - DoCast(m_creature->getVictim(), SPELL_CORRUPTIONOFEARTH); + DoScriptText(SAY_CASTCORRUPTION, me); + DoCast(me->getVictim(), SPELL_CORRUPTIONOFEARTH); } DoMeleeAttackIfReady(); diff --git a/src/scripts/world/boss_taerar.cpp b/src/scripts/world/boss_taerar.cpp index 82c02ec8e3e..b394e3240c5 100644 --- a/src/scripts/world/boss_taerar.cpp +++ b/src/scripts/world/boss_taerar.cpp @@ -81,7 +81,7 @@ struct boss_taerarAI : public ScriptedAI void EnterCombat(Unit* pWho) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, me); } void JustSummoned(Creature* pSummoned) @@ -95,8 +95,8 @@ struct boss_taerarAI : public ScriptedAI if (m_bShades && m_uiShades_Timer <= uiDiff) { //Become unbanished again - m_creature->setFaction(14); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); m_bShades = false; } else if (m_bShades) @@ -124,7 +124,7 @@ struct boss_taerarAI : public ScriptedAI //NoxiousBreath_Timer if (m_uiNoxiousBreath_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); + DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); m_uiNoxiousBreath_Timer = 14000 + rand()%6000; } else @@ -133,7 +133,7 @@ struct boss_taerarAI : public ScriptedAI //Tailsweep every 2 seconds if (m_uiTailSweep_Timer <= uiDiff) { - DoCast(m_creature, SPELL_TAILSWEEP); + DoCast(me, SPELL_TAILSWEEP); m_uiTailSweep_Timer = 2000; } else @@ -142,7 +142,7 @@ struct boss_taerarAI : public ScriptedAI //MarkOfNature_Timer //if (m_uiMarkOfNature_Timer <= uiDiff) //{ - // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); + // DoCast(me->getVictim(), SPELL_MARKOFNATURE); // m_uiMarkOfNature_Timer = 45000; //} //else @@ -151,7 +151,7 @@ struct boss_taerarAI : public ScriptedAI //ArcaneBlast_Timer if (m_uiArcaneBlast_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_ARCANEBLAST); + DoCast(me->getVictim(), SPELL_ARCANEBLAST); m_uiArcaneBlast_Timer = 7000 + rand()%5000; } else @@ -160,25 +160,25 @@ struct boss_taerarAI : public ScriptedAI //BellowingRoar_Timer if (m_uiBellowingRoar_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_BELLOWINGROAR); + DoCast(me->getVictim(), SPELL_BELLOWINGROAR); m_uiBellowingRoar_Timer = 20000 + rand()%10000; } else m_uiBellowingRoar_Timer -= uiDiff; //Summon 3 Shades at 75%, 50% and 25% (if bShades is true we already left in line 117, no need to check here again) - if (!m_bShades && (m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) + if (!m_bShades && (me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiShadesSummoned))) { if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) { //Inturrupt any spell casting - m_creature->InterruptNonMeleeSpells(false); + me->InterruptNonMeleeSpells(false); //horrible workaround, need to fix - m_creature->setFaction(35); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - DoScriptText(SAY_SUMMONSHADE, m_creature); + DoScriptText(SAY_SUMMONSHADE, me); int iSize = sizeof(m_auiSpellSummonShade) / sizeof(uint32); @@ -217,7 +217,7 @@ struct boss_shadeoftaerarAI : public ScriptedAI //PoisonCloud_Timer if (m_uiPoisonCloud_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_POSIONCLOUD); + DoCast(me->getVictim(), SPELL_POSIONCLOUD); m_uiPoisonCloud_Timer = 30000; } else @@ -226,7 +226,7 @@ struct boss_shadeoftaerarAI : public ScriptedAI //PosionBreath_Timer if (m_uiPosionBreath_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_POSIONBREATH); + DoCast(me->getVictim(), SPELL_POSIONBREATH); m_uiPosionBreath_Timer = 12000; } else diff --git a/src/scripts/world/boss_ysondre.cpp b/src/scripts/world/boss_ysondre.cpp index bac9fe81010..9413e1b19d6 100644 --- a/src/scripts/world/boss_ysondre.cpp +++ b/src/scripts/world/boss_ysondre.cpp @@ -65,7 +65,7 @@ struct boss_ysondreAI : public ScriptedAI void EnterCombat(Unit* pWho) { - DoScriptText(SAY_AGGRO, m_creature); + DoScriptText(SAY_AGGRO, me); } void JustSummoned(Creature* pSummoned) @@ -93,7 +93,7 @@ struct boss_ysondreAI : public ScriptedAI //NoxiousBreath_Timer if (m_uiNoxiousBreath_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_NOXIOUSBREATH); + DoCast(me->getVictim(), SPELL_NOXIOUSBREATH); m_uiNoxiousBreath_Timer = 14000 + rand()%6000; } else @@ -113,7 +113,7 @@ struct boss_ysondreAI : public ScriptedAI //MarkOfNature_Timer //if (m_uiMarkOfNature_Timer <= uiDiff) //{ - // DoCast(m_creature->getVictim(), SPELL_MARKOFNATURE); + // DoCast(me->getVictim(), SPELL_MARKOFNATURE); // m_uiMarkOfNature_Timer = 45000; //} //else @@ -132,12 +132,12 @@ struct boss_ysondreAI : public ScriptedAI m_uiLightningWave_Timer -= uiDiff; //Summon Druids - if ((m_creature->GetHealth()*100 / m_creature->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) + if ((me->GetHealth()*100 / me->GetMaxHealth()) <= (100-(25*m_uiSummonDruidModifier))) { - DoScriptText(SAY_SUMMONDRUIDS, m_creature); + DoScriptText(SAY_SUMMONDRUIDS, me); for (int i = 0; i < 10; ++i) - DoCast(m_creature, SPELL_SUMMONDRUIDS, true); + DoCast(me, SPELL_SUMMONDRUIDS, true); ++m_uiSummonDruidModifier; } @@ -166,7 +166,7 @@ struct mob_dementeddruidsAI : public ScriptedAI //MoonFire_Timer if (m_uiMoonFire_Timer <= uiDiff) { - DoCast(m_creature->getVictim(), SPELL_MOONFIRE); + DoCast(me->getVictim(), SPELL_MOONFIRE); m_uiMoonFire_Timer = 5000; } else diff --git a/src/scripts/world/guards.cpp b/src/scripts/world/guards.cpp index 3d6edd9c1c3..95aa4a381ba 100644 --- a/src/scripts/world/guards.cpp +++ b/src/scripts/world/guards.cpp @@ -2552,7 +2552,7 @@ struct guard_shattrath_aldorAI : public guardAI { if (Exile_Timer <= diff) { - if (Unit* temp = Unit::GetUnit(*m_creature,PlayerGUID)) + if (Unit* temp = Unit::GetUnit(*me,PlayerGUID)) { temp->CastSpell(temp,SPELL_EXILE,true); temp->CastSpell(temp,SPELL_BANISH_TELEPORT,true); @@ -2564,7 +2564,7 @@ struct guard_shattrath_aldorAI : public guardAI } else if (Banish_Timer <= diff) { - Unit* temp = m_creature->getVictim(); + Unit* temp = me->getVictim(); if (temp && temp->GetTypeId() == TYPEID_PLAYER) { DoCast(temp, SPELL_BANISHED_SHATTRATH_A); @@ -2748,7 +2748,7 @@ struct guard_shattrath_scryerAI : public guardAI { if (Exile_Timer <= diff) { - if (Unit* temp = Unit::GetUnit(*m_creature,PlayerGUID)) + if (Unit* temp = Unit::GetUnit(*me,PlayerGUID)) { temp->CastSpell(temp,SPELL_EXILE,true); temp->CastSpell(temp,SPELL_BANISH_TELEPORT,true); @@ -2760,7 +2760,7 @@ struct guard_shattrath_scryerAI : public guardAI } else if (Banish_Timer <= diff) { - Unit* temp = m_creature->getVictim(); + Unit* temp = me->getVictim(); if (temp && temp->GetTypeId() == TYPEID_PLAYER) { DoCast(temp, SPELL_BANISHED_SHATTRATH_S); diff --git a/src/scripts/world/mob_generic_creature.cpp b/src/scripts/world/mob_generic_creature.cpp index f3b0b864f78..48845050a8f 100644 --- a/src/scripts/world/mob_generic_creature.cpp +++ b/src/scripts/world/mob_generic_creature.cpp @@ -43,7 +43,7 @@ struct generic_creatureAI : public ScriptedAI void EnterCombat(Unit *who) { - if (!m_creature->IsWithinMeleeRange(who)) + if (!me->IsWithinMeleeRange(who)) { IsSelfRooted = true; } @@ -57,16 +57,16 @@ struct generic_creatureAI : public ScriptedAI else GlobalCooldown = 0; //Buff timer (only buff when we are alive and not in combat - if (!m_creature->isInCombat() && m_creature->isAlive()) + if (!me->isInCombat() && me->isAlive()) if (BuffTimer <= diff) { //Find a spell that targets friendly and applies an aura (these are generally buffs) - SpellEntry const *info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); + SpellEntry const *info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); if (info && !GlobalCooldown) { //Cast the buff spell - DoCastSpell(m_creature, info); + DoCastSpell(me, info); //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; @@ -82,52 +82,52 @@ struct generic_creatureAI : public ScriptedAI return; //If we are within range melee the target - if (m_creature->IsWithinMeleeRange(m_creature->getVictim())) + if (me->IsWithinMeleeRange(me->getVictim())) { //Make sure our attack is ready and we arn't currently casting - if (m_creature->isAttackReady() && !m_creature->IsNonMeleeSpellCasted(false)) + if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) { bool Healing = false; SpellEntry const *info = NULL; //Select a healing spell if less than 30% hp - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30) - info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + if (me->GetHealth()*100 / me->GetMaxHealth() < 30) + info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); //No healing spell available, select a hostile spell if (info) Healing = true; - else info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); + else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); //50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell - if (info && (rand() % (m_creature->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) + if (info && (rand() % (me->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) { //Cast the spell - if (Healing)DoCastSpell(m_creature, info); - else DoCastSpell(m_creature->getVictim(), info); + if (Healing)DoCastSpell(me, info); + else DoCastSpell(me->getVictim(), info); //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; } - else m_creature->AttackerStateUpdate(m_creature->getVictim()); + else me->AttackerStateUpdate(me->getVictim()); - m_creature->resetAttackTimer(); + me->resetAttackTimer(); } } else { //Only run this code if we arn't already casting - if (!m_creature->IsNonMeleeSpellCasted(false)) + if (!me->IsNonMeleeSpellCasted(false)) { bool Healing = false; SpellEntry const *info = NULL; //Select a healing spell if less than 30% hp ONLY 33% of the time - if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30 && rand() % 3 == 0) - info = SelectSpell(m_creature, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0) + info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) if (info) Healing = true; - else info = SelectSpell(m_creature->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); + else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); //Found a spell, check if we arn't on cooldown if (info && !GlobalCooldown) @@ -139,8 +139,8 @@ struct generic_creatureAI : public ScriptedAI } //Cast spell - if (Healing) DoCastSpell(m_creature,info); - else DoCastSpell(m_creature->getVictim(),info); + if (Healing) DoCastSpell(me,info); + else DoCastSpell(me->getVictim(),info); //Set our global cooldown GlobalCooldown = GENERIC_CREATURE_COOLDOWN; @@ -149,7 +149,7 @@ struct generic_creatureAI : public ScriptedAI else if (IsSelfRooted) { //Cancel our current spell and then allow movement agian - m_creature->InterruptNonMeleeSpells(false); + me->InterruptNonMeleeSpells(false); IsSelfRooted = false; } } diff --git a/src/scripts/world/npcs_special.cpp b/src/scripts/world/npcs_special.cpp index 3ab437c0503..b3b9406ca00 100644 --- a/src/scripts/world/npcs_special.cpp +++ b/src/scripts/world/npcs_special.cpp @@ -143,7 +143,7 @@ struct npc_air_force_botsAI : public ScriptedAI Creature* SummonGuard() { - Creature* pSummoned = m_creature->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); + Creature* pSummoned = me->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); if (pSummoned) m_uiSpawnedGUID = pSummoned->GetGUID(); @@ -158,7 +158,7 @@ struct npc_air_force_botsAI : public ScriptedAI Creature* GetSummonedGuard() { - Creature* pCreature = Unit::GetCreature(*m_creature, m_uiSpawnedGUID); + Creature* pCreature = Unit::GetCreature(*me, m_uiSpawnedGUID); if (pCreature && pCreature->isAlive()) return pCreature; @@ -171,7 +171,7 @@ struct npc_air_force_botsAI : public ScriptedAI if (!m_pSpawnAssoc) return; - if (pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho)) + if (pWho->isTargetableForAttack() && me->IsHostileTo(pWho)) { Player* pPlayerTarget = pWho->GetTypeId() == TYPEID_PLAYER ? CAST_PLR(pWho) : NULL; @@ -189,7 +189,7 @@ struct npc_air_force_botsAI : public ScriptedAI { case SPAWNTYPE_ALARMBOT: { - if (!pWho->IsWithinDistInMap(m_creature, RANGE_GUARDS_MARK)) + if (!pWho->IsWithinDistInMap(me, RANGE_GUARDS_MARK)) return; Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK); @@ -224,7 +224,7 @@ struct npc_air_force_botsAI : public ScriptedAI } case SPAWNTYPE_TRIPWIRE_ROOFTOP: { - if (!pWho->IsWithinDistInMap(m_creature, RANGE_TRIPWIRE)) + if (!pWho->IsWithinDistInMap(me, RANGE_TRIPWIRE)) return; if (!pLastSpawnedGuard) @@ -305,8 +305,8 @@ struct npc_chicken_cluckAI : public ScriptedAI void Reset() { ResetFlagTimer = 120000; - m_creature->setFaction(FACTION_CHICKEN); - m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->setFaction(FACTION_CHICKEN); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); } void EnterCombat(Unit *who) {} @@ -314,7 +314,7 @@ struct npc_chicken_cluckAI : public ScriptedAI void UpdateAI(const uint32 diff) { // Reset flags after a certain time has passed so that the next player has to start the 'event' again - if (m_creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) { if (ResetFlagTimer <= diff) { @@ -334,17 +334,17 @@ struct npc_chicken_cluckAI : public ScriptedAI case TEXTEMOTE_CHICKEN: if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand()%30 == 1) { - m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - m_creature->setFaction(FACTION_FRIENDLY); - DoScriptText(EMOTE_HELLO, m_creature); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->setFaction(FACTION_FRIENDLY); + DoScriptText(EMOTE_HELLO, me); } break; case TEXTEMOTE_CHEER: if (pPlayer->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_COMPLETE) { - m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - m_creature->setFaction(FACTION_FRIENDLY); - DoScriptText(EMOTE_CLUCK_TEXT, m_creature); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + me->setFaction(FACTION_FRIENDLY); + DoScriptText(EMOTE_CLUCK_TEXT, me); } break; } @@ -391,16 +391,16 @@ struct npc_dancing_flamesAI : public ScriptedAI { active = true; can_iteract = 3500; - DoCast(m_creature, SPELL_BRAZIER, true); - DoCast(m_creature, SPELL_FIERY_AURA, false); + DoCast(me, SPELL_BRAZIER, true); + DoCast(me, SPELL_FIERY_AURA, false); float x, y, z; - m_creature->GetPosition(x,y,z); - m_creature->Relocate(x,y,z + 0.94f); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + me->GetPosition(x,y,z); + me->Relocate(x,y,z + 0.94f); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); WorldPacket data; //send update position to client - m_creature->BuildHeartBeatMsg(&data); - m_creature->SendMessageToSet(&data,true); + me->BuildHeartBeatMsg(&data); + me->SendMessageToSet(&data,true); } void UpdateAI(const uint32 diff) @@ -410,7 +410,7 @@ struct npc_dancing_flamesAI : public ScriptedAI if (can_iteract <= diff){ active = true; can_iteract = 3500; - m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); + me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); } else can_iteract -= diff; } } @@ -419,20 +419,20 @@ struct npc_dancing_flamesAI : public ScriptedAI void ReceiveEmote(Player* pPlayer, uint32 emote) { - if (m_creature->IsWithinLOS(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()) && m_creature->IsWithinDistInMap(pPlayer,30.0f)) + if (me->IsWithinLOS(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ()) && me->IsWithinDistInMap(pPlayer,30.0f)) { - m_creature->SetInFront(pPlayer); + me->SetInFront(pPlayer); active = false; WorldPacket data; - m_creature->BuildHeartBeatMsg(&data); - m_creature->SendMessageToSet(&data,true); + me->BuildHeartBeatMsg(&data); + me->SendMessageToSet(&data,true); switch(emote) { - case TEXTEMOTE_KISS: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; - case TEXTEMOTE_WAVE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case TEXTEMOTE_BOW: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; - case TEXTEMOTE_JOKE: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; + case TEXTEMOTE_KISS: me->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; + case TEXTEMOTE_WAVE: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; + case TEXTEMOTE_BOW: me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; + case TEXTEMOTE_JOKE: me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; case TEXTEMOTE_DANCE: { if (!pPlayer->HasAura(SPELL_SEDUCTION)) @@ -547,7 +547,7 @@ struct npc_doctorAI : public ScriptedAI Event = false; - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } void BeginEvent(Player* pPlayer); @@ -575,29 +575,29 @@ struct npc_injured_patientAI : public ScriptedAI Coord = NULL; //no select - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //no regen health - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); //to make them lay with face down - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_DEAD); - uint32 mobId = m_creature->GetEntry(); + uint32 mobId = me->GetEntry(); switch (mobId) { //lower max health case 12923: case 12938: //Injured Soldier - m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.75)); + me->SetHealth(uint32(me->GetMaxHealth()*.75)); break; case 12924: case 12936: //Badly injured Soldier - m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.50)); + me->SetHealth(uint32(me->GetMaxHealth()*.50)); break; case 12925: case 12937: //Critically injured Soldier - m_creature->SetHealth(uint32(m_creature->GetMaxHealth()*.25)); + me->SetHealth(uint32(me->GetMaxHealth()*.25)); break; } } @@ -606,38 +606,38 @@ struct npc_injured_patientAI : public ScriptedAI void SpellHit(Unit *caster, const SpellEntry *spell) { - if (caster->GetTypeId() == TYPEID_PLAYER && m_creature->isAlive() && spell->Id == 20804) + if (caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && spell->Id == 20804) { if ((CAST_PLR(caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) if (Doctorguid) - if (Creature* Doctor = Unit::GetCreature(*m_creature, Doctorguid)) - CAST_AI(npc_doctorAI, Doctor->AI())->PatientSaved(m_creature, CAST_PLR(caster), Coord); + if (Creature* Doctor = Unit::GetCreature(*me, Doctorguid)) + CAST_AI(npc_doctorAI, Doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord); //make not selectable - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); //regen health - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); //stand up - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); + me->SetUInt32Value(UNIT_FIELD_BYTES_1, UNIT_STAND_STATE_STAND); - DoScriptText(RAND(SAY_DOC1,SAY_DOC2,SAY_DOC3), m_creature); + DoScriptText(RAND(SAY_DOC1,SAY_DOC2,SAY_DOC3), me); - uint32 mobId = m_creature->GetEntry(); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + uint32 mobId = me->GetEntry(); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); switch (mobId) { case 12923: case 12924: case 12925: - m_creature->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ); + me->GetMotionMaster()->MovePoint(0, H_RUNTOX, H_RUNTOY, H_RUNTOZ); break; case 12936: case 12937: case 12938: - m_creature->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ); + me->GetMotionMaster()->MovePoint(0, A_RUNTOX, A_RUNTOY, A_RUNTOZ); break; } } @@ -646,21 +646,21 @@ struct npc_injured_patientAI : public ScriptedAI void UpdateAI(const uint32 diff) { //lower HP on every world tick makes it a useful counter, not officlone though - if (m_creature->isAlive() && m_creature->GetHealth() > 6) + if (me->isAlive() && me->GetHealth() > 6) { - m_creature->SetHealth(uint32(m_creature->GetHealth()-5)); + me->SetHealth(uint32(me->GetHealth()-5)); } - if (m_creature->isAlive() && m_creature->GetHealth() <= 6) + if (me->isAlive() && me->GetHealth() <= 6) { - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - m_creature->setDeathState(JUST_DIED); - m_creature->SetFlag(UNIT_DYNAMIC_FLAGS, 32); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setDeathState(JUST_DIED); + me->SetFlag(UNIT_DYNAMIC_FLAGS, 32); if (Doctorguid) { - if (Creature* Doctor = Unit::GetCreature((*m_creature), Doctorguid)) + if (Creature* Doctor = Unit::GetCreature((*me), Doctorguid)) CAST_AI(npc_doctorAI, Doctor->AI())->PatientDied(Coord); } } @@ -685,7 +685,7 @@ void npc_doctorAI::BeginEvent(Player* pPlayer) PatientDiedCount = 0; PatientSavedCount = 0; - switch(m_creature->GetEntry()) + switch(me->GetEntry()) { case DOCTOR_ALLIANCE: for (uint8 i = 0; i < ALLIANCE_COORDS; ++i) @@ -698,7 +698,7 @@ void npc_doctorAI::BeginEvent(Player* pPlayer) } Event = true; - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } void npc_doctorAI::PatientDied(Location* Point) @@ -741,7 +741,7 @@ void npc_doctorAI::PatientSaved(Creature* soldier, Player* pPlayer, Location* Po std::list::const_iterator itr; for (itr = Patients.begin(); itr != Patients.end(); ++itr) { - if (Creature* Patient = Unit::GetCreature((*m_creature), *itr)) + if (Creature* Patient = Unit::GetCreature((*me), *itr)) Patient->setDeathState(JUST_DIED); } } @@ -781,7 +781,7 @@ void npc_doctorAI::UpdateAI(const uint32 diff) std::vector::iterator itr = Coordinates.begin()+rand()%Coordinates.size(); uint32 patientEntry = 0; - switch(m_creature->GetEntry()) + switch(me->GetEntry()) { case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[rand()%3]; break; case DOCTOR_HORDE: patientEntry = HordeSoldierId[rand()%3]; break; @@ -792,7 +792,7 @@ void npc_doctorAI::UpdateAI(const uint32 diff) Point = *itr; - Patient = m_creature->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); + Patient = me->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); if (Patient) { @@ -800,7 +800,7 @@ void npc_doctorAI::UpdateAI(const uint32 diff) Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); Patients.push_back(Patient->GetGUID()); - CAST_AI(npc_injured_patientAI, Patient->AI())->Doctorguid = m_creature->GetGUID(); + CAST_AI(npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID(); if (Point) CAST_AI(npc_injured_patientAI, Patient->AI())->Coord = Point; @@ -883,9 +883,9 @@ struct npc_garments_of_questsAI : public npc_escortAI RunAwayTimer = 5000; - m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); + me->SetStandState(UNIT_STAND_STATE_KNEEL); //expect database to have RegenHealth=0 - m_creature->SetHealth(int(m_creature->GetMaxHealth()*0.7)); + me->SetHealth(int(me->GetMaxHealth()*0.7)); } void EnterCombat(Unit *who) {} @@ -895,7 +895,7 @@ struct npc_garments_of_questsAI : public npc_escortAI if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1) { //not while in combat - if (m_creature->isInCombat()) + if (me->isInCombat()) return; //nothing to be done now @@ -904,21 +904,21 @@ struct npc_garments_of_questsAI : public npc_escortAI if (pCaster->GetTypeId() == TYPEID_PLAYER) { - switch(m_creature->GetEntry()) + switch(me->GetEntry()) { case ENTRY_SHAYA: if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_MOON) == QUEST_STATUS_INCOMPLETE) { if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_SHAYA_THANKS,m_creature,pCaster); + DoScriptText(SAY_SHAYA_THANKS,me,pCaster); bCanRun = true; } else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,pCaster); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); bIsHealed = true; } } @@ -928,14 +928,14 @@ struct npc_garments_of_questsAI : public npc_escortAI { if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_ROBERTS_THANKS,m_creature,pCaster); + DoScriptText(SAY_ROBERTS_THANKS,me,pCaster); bCanRun = true; } else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,pCaster); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); bIsHealed = true; } } @@ -945,14 +945,14 @@ struct npc_garments_of_questsAI : public npc_escortAI { if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_DOLF_THANKS,m_creature,pCaster); + DoScriptText(SAY_DOLF_THANKS,me,pCaster); bCanRun = true; } else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,pCaster); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); bIsHealed = true; } } @@ -962,14 +962,14 @@ struct npc_garments_of_questsAI : public npc_escortAI { if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_KORJA_THANKS,m_creature,pCaster); + DoScriptText(SAY_KORJA_THANKS,me,pCaster); bCanRun = true; } else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,pCaster); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); bIsHealed = true; } } @@ -979,14 +979,14 @@ struct npc_garments_of_questsAI : public npc_escortAI { if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_DG_KEL_THANKS,m_creature,pCaster); + DoScriptText(SAY_DG_KEL_THANKS,me,pCaster); bCanRun = true; } else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { caster = pCaster->GetGUID(); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED,m_creature,pCaster); + me->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_COMMON_HEALED,me,pCaster); bIsHealed = true; } } @@ -995,7 +995,7 @@ struct npc_garments_of_questsAI : public npc_escortAI //give quest credit, not expect any special quest objectives if (bCanRun) - CAST_PLR(pCaster)->TalkedToCreature(m_creature->GetEntry(),m_creature->GetGUID()); + CAST_PLR(pCaster)->TalkedToCreature(me->GetEntry(),me->GetGUID()); } } } @@ -1006,19 +1006,19 @@ struct npc_garments_of_questsAI : public npc_escortAI void UpdateAI(const uint32 diff) { - if (bCanRun && !m_creature->isInCombat()) + if (bCanRun && !me->isInCombat()) { if (RunAwayTimer <= diff) { - if (Unit *pUnit = Unit::GetUnit(*m_creature,caster)) + if (Unit *pUnit = Unit::GetUnit(*me,caster)) { - switch(m_creature->GetEntry()) + switch(me->GetEntry()) { - case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE,m_creature,pUnit); break; - case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE,m_creature,pUnit); break; - case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE,m_creature,pUnit); break; - case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE,m_creature,pUnit); break; - case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE,m_creature,pUnit); break; + case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE,me,pUnit); break; + case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE,me,pUnit); break; + case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE,me,pUnit); break; + case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE,me,pUnit); break; + case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE,me,pUnit); break; } Start(false,true,true); @@ -1051,7 +1051,7 @@ struct npc_guardianAI : public ScriptedAI void Reset() { - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); } void EnterCombat(Unit *who) @@ -1063,10 +1063,10 @@ struct npc_guardianAI : public ScriptedAI if (!UpdateVictim()) return; - if (m_creature->isAttackReady()) + if (me->isAttackReady()) { - DoCast(m_creature->getVictim(), SPELL_DEATHTOUCH, true); - m_creature->resetAttackTimer(); + DoCast(me->getVictim(), SPELL_DEATHTOUCH, true); + me->resetAttackTimer(); } } }; @@ -1441,13 +1441,13 @@ struct npc_steam_tonkAI : public ScriptedAI if (apply) { // Initialize the action bar without the melee attack command - m_creature->InitCharmInfo(); - m_creature->GetCharmInfo()->InitEmptyActionBar(false); + me->InitCharmInfo(); + me->GetCharmInfo()->InitEmptyActionBar(false); - m_creature->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); } else - m_creature->SetReactState(REACT_AGGRESSIVE); + me->SetReactState(REACT_AGGRESSIVE); } }; @@ -1463,7 +1463,7 @@ struct npc_tonk_mineAI : public ScriptedAI { npc_tonk_mineAI(Creature *c) : ScriptedAI(c) { - m_creature->SetReactState(REACT_PASSIVE); + me->SetReactState(REACT_PASSIVE); } uint32 ExplosionTimer; @@ -1481,8 +1481,8 @@ struct npc_tonk_mineAI : public ScriptedAI { if (ExplosionTimer <= diff) { - DoCast(m_creature, SPELL_TONK_MINE_DETONATE, true); - m_creature->setDeathState(DEAD); // unsummon it + DoCast(me, SPELL_TONK_MINE_DETONATE, true); + me->setDeathState(DEAD); // unsummon it } else ExplosionTimer -= diff; } @@ -1506,7 +1506,7 @@ struct npc_brewfest_revelerAI : public ScriptedAI return; if (emote == TEXTEMOTE_DANCE) - m_creature->CastSpell(pPlayer, 41586, false); + me->CastSpell(pPlayer, 41586, false); } }; @@ -1532,13 +1532,13 @@ struct npc_winter_revelerAI : public ScriptedAI if (emote == TEXTEMOTE_KISS) { - m_creature->CastSpell(m_creature, 26218, false); + me->CastSpell(me, 26218, false); pPlayer->CastSpell(pPlayer, 26218, false); switch (urand(0,2)) { - case 0: m_creature->CastSpell(pPlayer, 26207, false); break; - case 1: m_creature->CastSpell(pPlayer, 26206, false); break; - case 2: m_creature->CastSpell(pPlayer, 45036, false); break; + case 0: me->CastSpell(pPlayer, 26207, false); break; + case 1: me->CastSpell(pPlayer, 26206, false); break; + case 2: me->CastSpell(pPlayer, 45036, false); break; } } } @@ -1580,7 +1580,7 @@ struct npc_snake_trap_serpentsAI : public ScriptedAI Spawn = true; SpellTimer = 0; - CreatureInfo const *Info = m_creature->GetCreatureInfo(); + CreatureInfo const *Info = me->GetCreatureInfo(); if (Info->Entry == C_VIPER) IsViper = true; @@ -1589,24 +1589,24 @@ struct npc_snake_trap_serpentsAI : public ScriptedAI //Add delta to make them not all hit the same time uint32 delta = (rand() % 7) * 100; - m_creature->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); - m_creature->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower); + me->SetStatFloatValue(UNIT_FIELD_BASEATTACKTIME, Info->baseattacktime + delta); + me->SetStatFloatValue(UNIT_FIELD_RANGED_ATTACK_POWER , Info->attackpower); } //Redefined for random target selection: void MoveInLineOfSight(Unit *who) { - if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) + if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) { - if (m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; - float attackRadius = m_creature->GetAttackDistance(who); - if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) + float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) { if (!(rand() % RAND)) { - m_creature->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); + me->setAttackTimer(BASE_ATTACK, (rand() % 10) * 100); SpellTimer = (rand() % 10) * 100; AttackStart(who); } @@ -1620,15 +1620,15 @@ struct npc_snake_trap_serpentsAI : public ScriptedAI { Spawn = false; // Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target - if (!m_creature->getVictim() && m_creature->isSummon()) - if (Unit * Owner = CAST_SUM(m_creature)->GetSummoner()) + if (!me->getVictim() && me->isSummon()) + if (Unit * Owner = CAST_SUM(me)->GetSummoner()) if (Owner->getAttackerForHelper()) AttackStart(Owner->getAttackerForHelper()); } - if (!m_creature->getVictim()) + if (!me->getVictim()) { - if (m_creature->isInCombat()) + if (me->isInCombat()) DoStopAttack(); return; } @@ -1645,7 +1645,7 @@ struct npc_snake_trap_serpentsAI : public ScriptedAI else spell = SPELL_CRIPPLING_POISON; - DoCast(m_creature->getVictim(), spell); + DoCast(me->getVictim(), spell); } SpellTimer = VIPER_TIMER; @@ -1653,7 +1653,7 @@ struct npc_snake_trap_serpentsAI : public ScriptedAI else //Venomous Snake { if (urand(0,2) == 0) //33% chance to cast - DoCast(m_creature->getVictim(), SPELL_DEADLY_POISON); + DoCast(me->getVictim(), SPELL_DEADLY_POISON); SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; } } else SpellTimer -= diff; @@ -1685,25 +1685,25 @@ struct mob_mojoAI : public ScriptedAI { victimGUID = 0; hearts = 15000; - if (Unit* own = m_creature->GetOwner()) - m_creature->GetMotionMaster()->MoveFollow(own,0,0); + if (Unit* own = me->GetOwner()) + me->GetMotionMaster()->MoveFollow(own,0,0); } void Aggro(Unit *who){} void UpdateAI(const uint32 diff) { - if (m_creature->HasAura(20372)) + if (me->HasAura(20372)) { if (hearts <= diff) { - m_creature->RemoveAurasDueToSpell(20372); + me->RemoveAurasDueToSpell(20372); hearts = 15000; } hearts -= diff; } } void ReceiveEmote(Player* pPlayer, uint32 emote) { - m_creature->HandleEmoteCommand(emote); - Unit* own = m_creature->GetOwner(); + me->HandleEmoteCommand(emote); + Unit* own = me->GetOwner(); if (!own || own->GetTypeId() != TYPEID_PLAYER || CAST_PLR(own)->GetTeam() != pPlayer->GetTeam()) return; if (emote == TEXTEMOTE_KISS) @@ -1724,17 +1724,17 @@ struct mob_mojoAI : public ScriptedAI break; case 7:whisp.append(SAY_RANDOM_MOJO7);break; } - m_creature->MonsterWhisper(whisp.c_str(),pPlayer->GetGUID()); + me->MonsterWhisper(whisp.c_str(),pPlayer->GetGUID()); if (victimGUID) { Player* victim = Unit::GetPlayer(victimGUID); if (victim) victim->RemoveAura(43906);//remove polymorph frog thing } - m_creature->AddAura(43906,pPlayer);//add polymorph frog thing + me->AddAura(43906,pPlayer);//add polymorph frog thing victimGUID = pPlayer->GetGUID(); - DoCast(m_creature, 20372, true);//tag.hearts - m_creature->GetMotionMaster()->MoveFollow(pPlayer,0,0); + DoCast(me, 20372, true);//tag.hearts + me->GetMotionMaster()->MoveFollow(pPlayer,0,0); hearts = 15000; } } @@ -1775,7 +1775,7 @@ struct npc_mirror_image : CasterAI if (owner && !me->hasUnitState(UNIT_STAT_FOLLOW)) { me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, m_creature->GetFollowAngle(), MOTION_SLOT_ACTIVE); + me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE); } } }; @@ -1801,9 +1801,9 @@ struct npc_ebon_gargoyleAI : CasterAI despawnTimer = 0; // Find victim of Summon Gargoyle spell std::list targets; - Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_creature, m_creature, 30); - Trinity::UnitListSearcher searcher(m_creature, targets, u_check); - m_creature->VisitNearbyObject(30, searcher); + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 30); + Trinity::UnitListSearcher searcher(me, targets, u_check); + me->VisitNearbyObject(30, searcher); for (std::list::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) if ((*iter)->GetAura(49206,owner->GetGUID())) { @@ -1833,7 +1833,7 @@ struct npc_ebon_gargoyleAI : CasterAI // Stop Fighting me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true); // Sanctuary - me->CastSpell(m_creature, 54661, true); + me->CastSpell(me, 54661, true); me->SetReactState(REACT_PASSIVE); // Fly Away @@ -1877,7 +1877,7 @@ struct npc_lightwellAI : public PassiveAI void Reset() { - DoCast(m_creature, 59907, false); // Spell for Lightwell Charges + DoCast(me, 59907, false); // Spell for Lightwell Charges } }; @@ -1898,9 +1898,9 @@ struct npc_training_dummy : Scripted_NoMovementAI uint32 DespawnTimer; void Reset() { - m_creature->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate - m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave - m_creature->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); + me->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate + me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave + me->ApplySpellImmune(0, IMMUNITY_MECHANIC, MECHANIC_STUN, true); ResetTimer = 10000; DespawnTimer = 15000; } @@ -1929,8 +1929,8 @@ struct npc_training_dummy : Scripted_NoMovementAI { if (!UpdateVictim()) return; - if (!m_creature->hasUnitState(UNIT_STAT_STUNNED)) - m_creature->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate + if (!me->hasUnitState(UNIT_STAT_STUNNED)) + me->SetControlled(true,UNIT_STAT_STUNNED);//disable rotate if (m_Entry != 2674 && m_Entry != 2673) { @@ -1946,7 +1946,7 @@ struct npc_training_dummy : Scripted_NoMovementAI else { if (DespawnTimer <= diff) - m_creature->ForcedDespawn(); + me->ForcedDespawn(); else DespawnTimer -= diff; } @@ -1971,11 +1971,11 @@ struct npc_shadowfiendAI : public ScriptedAI void DamageTaken(Unit* pKiller, uint32 &damage) { - if (m_creature->isSummon()) - if (Unit* pOwner = CAST_SUM(m_creature)->GetSummoner()) + if (me->isSummon()) + if (Unit* pOwner = CAST_SUM(me)->GetSummoner()) { if (pOwner->HasAura(GLYPH_OF_SHADOWFIEND)) - if (damage >= m_creature->GetHealth()) + if (damage >= me->GetHealth()) pOwner->CastSpell(pOwner,GLYPH_OF_SHADOWFIEND_MANA,true); } } -- cgit v1.2.3