REPO: Code-style change

* Fixed pUnit-unit
This commit is contained in:
Bootz
2011-10-07 10:48:56 -05:00
parent e23fe1845f
commit f1ccb83dc0
43 changed files with 340 additions and 340 deletions
@@ -244,22 +244,22 @@ public:
std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
Unit* pUnit;
Unit* unit;
if ((*i) && (*i)->getSource())
{
pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit)
unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit)
{
//Cast affliction
DoCast(pUnit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
DoCast(unit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK,
SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true);
//Chromatic mutation if target is effected by all afflictions
if (pUnit->HasAura(SPELL_BROODAF_BLUE)
&& pUnit->HasAura(SPELL_BROODAF_BLACK)
&& pUnit->HasAura(SPELL_BROODAF_RED)
&& pUnit->HasAura(SPELL_BROODAF_BRONZE)
&& pUnit->HasAura(SPELL_BROODAF_GREEN))
if (unit->HasAura(SPELL_BROODAF_BLUE)
&& unit->HasAura(SPELL_BROODAF_BLACK)
&& unit->HasAura(SPELL_BROODAF_RED)
&& unit->HasAura(SPELL_BROODAF_BRONZE)
&& unit->HasAura(SPELL_BROODAF_GREEN))
{
//pTarget->RemoveAllAuras();
//DoCast(target, SPELL_CHROMATIC_MUT_1);
@@ -269,8 +269,8 @@ public:
//So instead we instant kill our target
//WORKAROUND
if (pUnit->GetTypeId() == TYPEID_PLAYER)
pUnit->CastSpell(pUnit, 5, false);
if (unit->GetTypeId() == TYPEID_PLAYER)
unit->CastSpell(unit, 5, false);
}
}
}
@@ -141,8 +141,8 @@ public:
{
if (Phase == 2)
{
if (Unit* pUnit = Unit::GetUnit(*me, Attumen))
DoScriptText(SAY_MIDNIGHT_KILL, pUnit);
if (Unit* unit = Unit::GetUnit(*me, Attumen))
DoScriptText(SAY_MIDNIGHT_KILL, unit);
}
}
@@ -359,9 +359,9 @@ struct boss_moroes_guestAI : public ScriptedAI
uint64 TempGUID = GuestGUID[rand()%4];
if (TempGUID)
{
Unit* pUnit = Unit::GetUnit((*me), TempGUID);
if (pUnit && pUnit->isAlive())
return pUnit;
Unit* unit = Unit::GetUnit((*me), TempGUID);
if (unit && unit->isAlive())
return unit;
}
return me;
@@ -424,10 +424,10 @@ public:
for (uint32 i = 0; i < 4; ++i)
{
if (Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000))
if (Creature* unit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000))
{
pUnit->Attack(me->getVictim(), true);
pUnit->setFaction(me->getFaction());
unit->Attack(me->getVictim(), true);
unit->setFaction(me->getFaction());
}
}
@@ -438,10 +438,10 @@ public:
{
for (uint32 i = 0; i < 5; ++i)
{
if (Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
if (Creature* unit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000))
{
pUnit->Attack(me->getVictim(), true);
pUnit->setFaction(me->getFaction());
unit->Attack(me->getVictim(), true);
unit->setFaction(me->getFaction());
}
}
@@ -464,11 +464,11 @@ public:
if (!FlameWreathTarget[i])
continue;
Unit* pUnit = Unit::GetUnit(*me, FlameWreathTarget[i]);
if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
Unit* unit = Unit::GetUnit(*me, FlameWreathTarget[i]);
if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3))
{
pUnit->CastSpell(pUnit, 20476, true, 0, 0, me->GetGUID());
pUnit->CastSpell(pUnit, 11027, true);
unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, 11027, true);
FlameWreathTarget[i] = 0;
}
}
@@ -193,11 +193,11 @@ public:
std::list<HostileReference*>::const_iterator i = m_threatlist.begin();
for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && pUnit->isAlive())
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && unit->isAlive())
{
float threat = me->getThreatManager().getThreat(pUnit);
SummonedUnit->AddThreat(pUnit, threat);
float threat = me->getThreatManager().getThreat(unit);
SummonedUnit->AddThreat(unit, threat);
}
}
}
@@ -211,9 +211,9 @@ public:
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true);
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
unit->CastSpell(unit, SPELL_TELEPORT_CENTER, true);
}
DoCast(me, SPELL_TELEPORT_CENTER, true);
}
@@ -223,10 +223,10 @@ public:
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
// Knockback into the air
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID());
}
}
@@ -235,17 +235,17 @@ public:
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
// Also needs an exception in spell system.
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID());
// Use packet hack
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_SET_CAN_FLY);
data.append(pUnit->GetPackGUID());
data.append(unit->GetPackGUID());
data << uint32(0);
pUnit->SendMessageToSet(&data, true);
unit->SendMessageToSet(&data, true);
}
}
}
@@ -255,17 +255,17 @@ public:
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY);
unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT);
WorldPacket data(12);
data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY);
data.append(pUnit->GetPackGUID());
data.append(unit->GetPackGUID());
data << uint32(0);
pUnit->SendMessageToSet(&data, true);
unit->SendMessageToSet(&data, true);
}
}
}
@@ -527,12 +527,12 @@ public:
{
DoCast(me, SPELL_VANISH);
Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0);
Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0);
DoResetThreat();
if (pUnit)
me->AddThreat(pUnit, 1000.0f);
if (unit)
me->AddThreat(unit, 1000.0f);
InVanish = true;
Vanish_Timer = 30000;
@@ -644,24 +644,24 @@ public:
if (Seed_of_Corruption_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_SEED_OF_CORRUPTION);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_SEED_OF_CORRUPTION);
Seed_of_Corruption_Timer = 10000;
} else Seed_of_Corruption_Timer -= diff;
if (Curse_of_Agony_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_CURSE_OF_AGONY);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_CURSE_OF_AGONY);
Curse_of_Agony_Timer = 13000;
} else Curse_of_Agony_Timer -= diff;
if (Fear_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_FEAR);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_FEAR);
Fear_Timer = 10000;
} else Fear_Timer -= diff;
@@ -806,8 +806,8 @@ public:
if (Blizzard_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_BLIZZARD);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_BLIZZARD);
Blizzard_Timer = 8000;
} else Blizzard_Timer -= diff;
@@ -937,8 +937,8 @@ public:
//if nobody is in melee range than try to use Intercept
if (!InMeleeRange)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_INTERCEPT_STUN);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_INTERCEPT_STUN);
}
Intercept_Stun_Timer = 10000;
@@ -1168,8 +1168,8 @@ public:
if (Purge_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_PURGE);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_PURGE);
Purge_Timer = 15000;
} else Purge_Timer -= diff;
@@ -103,15 +103,15 @@ public:
//for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i)
for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr)
{
//Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]);
Unit* pUnit = Unit::GetUnit(*me, *itr);
if (pUnit)
//Unit* unit = Unit::GetUnit(*me, FelCrystals[i]);
Unit* unit = Unit::GetUnit(*me, *itr);
if (unit)
{
if (!pUnit->isAlive())
CAST_CRE(pUnit)->Respawn(); // Let the core handle setting death state, etc.
if (!unit->isAlive())
CAST_CRE(unit)->Respawn(); // Let the core handle setting death state, etc.
// Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here.
pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
}
@@ -478,8 +478,8 @@ public:
{
me->setFaction(FACTION_HOSTILE);
if (Unit* pUnit = Unit::GetUnit(*me, m_uiDuelerGUID))
AttackStart(pUnit);
if (Unit* unit = Unit::GetUnit(*me, m_uiDuelerGUID))
AttackStart(unit);
}
else
m_uiDuelTimer -= uiDiff;
@@ -569,9 +569,9 @@ public:
std::list<HostileReference*>::const_iterator itr;
for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive() && pUnit != caster)
me->AddThreat(pUnit, caster->getThreatManager().getThreat(pUnit));
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->isAlive() && unit != caster)
me->AddThreat(unit, caster->getThreatManager().getThreat(unit));
}
}
}
@@ -760,11 +760,11 @@ public:
{
for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetPositionZ() > me->GetPositionZ()+5)
if (unit->GetPositionZ() > me->GetPositionZ()+5)
{
me->getThreatManager().modifyThreatPercent(pUnit, -100);
me->getThreatManager().modifyThreatPercent(unit, -100);
}
}
}
@@ -994,9 +994,9 @@ public:
std::list<HostileReference*>::iterator itr;
for (itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr)
{
Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (pUnit)
pPortal->AddThreat(pUnit, 1.0f);
Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid());
if (unit)
pPortal->AddThreat(unit, 1.0f);
}
}
FelfirePortalTimer = 20000;
@@ -160,23 +160,23 @@ class boss_mandokir : public CreatureScript
{
if (WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him
{
Unit* pUnit = Unit::GetUnit(*me, WatchTarget);
Unit* unit = Unit::GetUnit(*me, WatchTarget);
if (pUnit && (
targetX != pUnit->GetPositionX() ||
targetY != pUnit->GetPositionY() ||
targetZ != pUnit->GetPositionZ() ||
pUnit->isInCombat()))
if (unit && (
targetX != unit->GetPositionX() ||
targetY != unit->GetPositionY() ||
targetZ != unit->GetPositionZ() ||
unit->isInCombat()))
{
if (me->IsWithinMeleeRange(pUnit))
if (me->IsWithinMeleeRange(unit))
{
DoCast(pUnit, 24316);
DoCast(unit, 24316);
}
else
{
DoCast(pUnit, SPELL_CHARGE);
//me->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true, 1);
AttackStart(pUnit);
DoCast(unit, SPELL_CHARGE);
//me->SendMonsterMove(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 0, true, 1);
AttackStart(unit);
}
}
}
@@ -198,12 +198,12 @@ class boss_mandokir : public CreatureScript
if ((Watch_Timer < 1000) && endWatch) //1 sec before the debuf expire, store the target position
{
Unit* pUnit = Unit::GetUnit(*me, WatchTarget);
if (pUnit)
Unit* unit = Unit::GetUnit(*me, WatchTarget);
if (unit)
{
targetX = pUnit->GetPositionX();
targetY = pUnit->GetPositionY();
targetZ = pUnit->GetPositionZ();
targetX = unit->GetPositionX();
targetY = unit->GetPositionY();
targetZ = unit->GetPositionZ();
}
endWatch = false;
}
@@ -232,8 +232,8 @@ class boss_mandokir : public CreatureScript
std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin();
for (; i != me->getThreatManager().getThreatList().end(); ++i)
{
Unit* pUnit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (pUnit && me->IsWithinMeleeRange(pUnit))
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && me->IsWithinMeleeRange(unit))
++TargetInRange;
}