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
+1 -1
View File
@@ -56,7 +56,7 @@ struct DefaultTargetSelector : public std::unary_function<Unit*, bool>
bool m_playerOnly;
int32 m_aura;
// pUnit: the reference unit
// unit: the reference unit
// dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit
// playerOnly: self explaining
// aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura
+10 -10
View File
@@ -4689,32 +4689,32 @@ bool ChatHandler::HandleGroupRemoveCommand(const char *args)
bool ChatHandler::HandlePossessCommand(const char * /*args*/)
{
Unit* pUnit = getSelectedUnit();
if (!pUnit)
Unit* unit = getSelectedUnit();
if (!unit)
return false;
m_session->GetPlayer()->CastSpell(pUnit, 530, true);
m_session->GetPlayer()->CastSpell(unit, 530, true);
return true;
}
bool ChatHandler::HandleUnPossessCommand(const char * /*args*/)
{
Unit* pUnit = getSelectedUnit();
if (!pUnit)
pUnit = m_session->GetPlayer();
Unit* unit = getSelectedUnit();
if (!unit)
unit = m_session->GetPlayer();
pUnit->RemoveCharmAuras();
unit->RemoveCharmAuras();
return true;
}
bool ChatHandler::HandleBindSightCommand(const char * /*args*/)
{
Unit* pUnit = getSelectedUnit();
if (!pUnit)
Unit* unit = getSelectedUnit();
if (!unit)
return false;
m_session->GetPlayer()->CastSpell(pUnit, 6277, true);
m_session->GetPlayer()->CastSpell(unit, 6277, true);
return true;
}
@@ -1180,16 +1180,16 @@ namespace Trinity
class AllFriendlyCreaturesInGrid
{
public:
AllFriendlyCreaturesInGrid(Unit const* obj) : pUnit(obj) {}
AllFriendlyCreaturesInGrid(Unit const* obj) : unit(obj) {}
bool operator() (Unit* u)
{
if (u->isAlive() && u->IsVisible() && u->IsFriendlyTo(pUnit))
if (u->isAlive() && u->IsVisible() && u->IsFriendlyTo(unit))
return true;
return false;
}
private:
Unit const* pUnit;
Unit const* unit;
};
class AllGameObjectsWithEntryInRange
@@ -1213,9 +1213,9 @@ namespace Trinity
{
public:
AllCreaturesOfEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {}
bool operator() (Unit* pUnit)
bool operator() (Unit* unit)
{
if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit, m_fRange, false))
if (unit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(unit, m_fRange, false))
return true;
return false;
@@ -1230,18 +1230,18 @@ namespace Trinity
class PlayerAtMinimumRangeAway
{
public:
PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : pUnit(unit), fRange(fMinRange) {}
PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : unit(unit), fRange(fMinRange) {}
bool operator() (Player* pPlayer)
{
//No threat list check, must be done explicit if expected to be in combat with creature
if (!pPlayer->isGameMaster() && pPlayer->isAlive() && !pUnit->IsWithinDist(pPlayer, fRange, false))
if (!pPlayer->isGameMaster() && pPlayer->isAlive() && !unit->IsWithinDist(pPlayer, fRange, false))
return true;
return false;
}
private:
Unit const* pUnit;
Unit const* unit;
float fRange;
};
+4 -4
View File
@@ -155,7 +155,7 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t
inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
{
Unit* pUnit = NULL;
Unit* unit = NULL;
if (!obj)
sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
else if (!obj->isType(TYPEMASK_UNIT))
@@ -163,12 +163,12 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow());
else
{
pUnit = obj->ToUnit();
if (!pUnit)
unit = obj->ToUnit();
if (!unit)
sLog->outError("%s %s object could not be casted to unit.",
scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target");
}
return pUnit;
return unit;
}
inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const
@@ -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;
}
@@ -358,9 +358,9 @@ public:
std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive())
targets.push_back(pUnit);
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->isAlive())
targets.push_back(unit);
}
if (targets.empty())
@@ -714,9 +714,9 @@ void hyjalAI::DeSpawnVeins()
return;
if (Faction == 1)
{
Creature* pUnit=Unit::GetCreature((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE));
if (!pUnit)return;
hyjalAI* ai = CAST_AI(hyjalAI, pUnit->AI());
Creature* unit=Unit::GetCreature((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE));
if (!unit)return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
if (!ai)return;
for (uint8 i = 0; i<7; ++i)
{
@@ -725,9 +725,9 @@ void hyjalAI::DeSpawnVeins()
}
} else if (Faction)
{
Creature* pUnit=Unit::GetCreature((*me), pInstance->GetData64(DATA_THRALL));
if (!pUnit)return;
hyjalAI* ai = CAST_AI(hyjalAI, pUnit->AI());
Creature* unit=Unit::GetCreature((*me), pInstance->GetData64(DATA_THRALL));
if (!unit)return;
hyjalAI* ai = CAST_AI(hyjalAI, unit->AI());
if (!ai)return;
for (uint8 i = 7; i<14; ++i)
{
@@ -853,8 +853,8 @@ void hyjalAI::UpdateAI(const uint32 diff)
{
if (BossGUID[i])
{
Unit* pUnit = Unit::GetUnit((*me), BossGUID[i]);
if (pUnit && (!pUnit->isAlive()))
Unit* unit = Unit::GetUnit((*me), BossGUID[i]);
if (unit && (!unit->isAlive()))
{
if (BossGUID[i] == BossGUID[0])
{
@@ -1080,37 +1080,37 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
{
uint8 r = rand()%4;
Creature* pUnit = me->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
for (uint8 i = 0; i < 3; ++i)//summon 3 abominations
{
uint8 r = rand()%4;
Creature* pUnit = me->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
for (uint8 i = 0; i < 5; ++i)//summon 5 gargoyles
{
Creature* pUnit = me->SummonCreature(GARGOYLE, AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(GARGOYLE, AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
pUnit->SetHomePosition(AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3]);
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
unit->SetHomePosition(AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3]);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
break;
@@ -1120,38 +1120,38 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff)
for (uint8 i = 0; i < 26; ++i)//summon infernals
{
Creature* pUnit = me->SummonCreature(GIANT_INFERNAL, InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(GIANT_INFERNAL, InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
pUnit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]);
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
unit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls
{
uint8 r = rand()%4;
Creature* pUnit = me->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
for (uint8 i = 0; i < 5; ++i)//summon 5 abominations
{
uint8 r = rand()%4;
Creature* pUnit = me->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (pUnit)
Creature* unit = me->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000);
if (unit)
{
CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i;
pUnit->setActive(true);
CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction;
CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true;
CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i;
unit->setActive(true);
}
}
break;
@@ -191,12 +191,12 @@ public:
Creature* creature = instance->GetCreature(Azgalor);
if (creature)
{
Creature* pUnit = creature->SummonCreature(21987, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000);
Creature* unit = creature->SummonCreature(21987, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000);
Map* pMap = creature->GetMap();
if (pMap->IsDungeon() && pUnit)
if (pMap->IsDungeon() && unit)
{
pUnit->SetVisible(false);
unit->SetVisible(false);
Map::PlayerList const &PlayerList = pMap->GetPlayers();
if (PlayerList.isEmpty())
return;
@@ -206,7 +206,7 @@ public:
if (i->getSource())
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
pUnit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
unit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID());
i->getSource()->GetSession()->SendPacket(&data);
WorldPacket data2(SMSG_PLAY_SOUND, 4);
@@ -576,11 +576,11 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
Unit* pUnit = Unit::GetUnit(*me, i->first);
Unit* unit = Unit::GetUnit(*me, i->first);
//Only units out of stomach
if (pUnit && i->second == false)
temp.push_back(pUnit);
if (unit && i->second == false)
temp.push_back(unit);
++i;
}
@@ -724,19 +724,19 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
Unit* pUnit = Unit::GetUnit(*me, i->first);
Unit* unit = Unit::GetUnit(*me, i->first);
//Only move units in stomach
if (pUnit && i->second == true)
if (unit && i->second == true)
{
//Teleport each player out
DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
//Cast knockback on them
DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
//Remove the acid debuff
pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
i->second = false;
}
@@ -755,25 +755,25 @@ public:
while (i != Stomach_Map.end())
{
//Check for valid player
Unit* pUnit = Unit::GetUnit(*me, i->first);
Unit* unit = Unit::GetUnit(*me, i->first);
//Only apply to units in stomach
if (pUnit && i->second == true)
if (unit && i->second == true)
{
//Cast digestive acid on them
DoCast(pUnit, SPELL_DIGESTIVE_ACID, true);
DoCast(unit, SPELL_DIGESTIVE_ACID, true);
//Check if player should be kicked from stomach
if (pUnit->IsWithinDist3d(&KickPos, 15.0f))
if (unit->IsWithinDist3d(&KickPos, 15.0f))
{
//Teleport each player out
DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6));
//Cast knockback on them
DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true);
//Remove the acid debuff
pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID);
i->second = false;
}
@@ -805,11 +805,11 @@ public:
if (StomachEnterVisTimer <= diff)
{
//Check for valid player
Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget);
Unit* unit = Unit::GetUnit(*me, StomachEnterTarget);
if (pUnit)
if (unit)
{
DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O);
DoTeleportPlayer(unit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O);
}
StomachEnterTarget = 0;
@@ -87,10 +87,10 @@ 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->GetTypeId() == TYPEID_PLAYER))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
{
DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation());
DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, unit->GetOrientation());
}
}
@@ -535,8 +535,8 @@ public:
SetCombatMovement(true);
if (me->isInCombat())
if (Unit* pUnit = me->getVictim())
me->GetMotionMaster()->MoveChase(pUnit);
if (Unit* unit = me->getVictim())
me->GetMotionMaster()->MoveChase(unit);
}
void MoveToDock()
+4 -4
View File
@@ -160,9 +160,9 @@ public:
switch (uiEventPhase)
{
case 1:
if (Unit* pUnit = Unit::GetUnit(*me, uiPlayerGUID))
if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID))
{
if (GameObject* pGo = pUnit->GetGameObject(SPELL_LUNCH))
if (GameObject* pGo = unit->GetGameObject(SPELL_LUNCH))
{
m_bIsMovingToLunch = true;
me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ());
@@ -174,8 +174,8 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING);
break;
case 3:
if (Player* pUnit = Unit::GetPlayer(*me, uiPlayerGUID))
pUnit->TalkedToCreature(me->GetEntry(), me->GetGUID());
if (Player* unit = Unit::GetPlayer(*me, uiPlayerGUID))
unit->TalkedToCreature(me->GetEntry(), me->GetGUID());
me->UpdateEntry(NPC_KYLE_FRIENDLY);
break;
@@ -223,8 +223,8 @@ public:
uint64 uiGrandChampionBoss1 = 0;
if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID))
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* pUnit = pVehicle->GetPassenger(0))
uiGrandChampionBoss1 = pUnit->GetGUID();
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss1 = unit->GetGUID();
if (pInstance)
{
pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID);
@@ -239,8 +239,8 @@ public:
uint64 uiGrandChampionBoss2 = 0;
if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID))
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* pUnit = pVehicle->GetPassenger(0))
uiGrandChampionBoss2 = pUnit->GetGUID();
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss2 = unit->GetGUID();
if (pInstance)
{
pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID);
@@ -255,8 +255,8 @@ public:
uint64 uiGrandChampionBoss3 = 0;
if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID))
if (Vehicle* pVehicle = pBoss->GetVehicleKit())
if (Unit* pUnit = pVehicle->GetPassenger(0))
uiGrandChampionBoss3 = pUnit->GetGUID();
if (Unit* unit = pVehicle->GetPassenger(0))
uiGrandChampionBoss3 = unit->GetGUID();
if (pInstance)
{
pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID);
@@ -292,14 +292,14 @@ struct boss_faction_championsAI : public ScriptedAI
std::list<HostileReference*> const& tList = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = tList.begin(); itr != tList.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && me->getThreatManager().getThreat(pUnit))
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && me->getThreatManager().getThreat(unit))
{
if (pUnit->GetTypeId()==TYPEID_PLAYER)
if (unit->GetTypeId()==TYPEID_PLAYER)
{
float threat = CalculateThreat(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth());
me->getThreatManager().modifyThreatPercent(pUnit, -100);
me->AddThreat(pUnit, 1000000.0f * threat);
float threat = CalculateThreat(me->GetDistance2d(unit), (float)unit->GetArmor(), unit->GetHealth());
me->getThreatManager().modifyThreatPercent(unit, -100);
me->AddThreat(unit, 1000000.0f * threat);
}
}
}
@@ -114,8 +114,8 @@ struct boss_horAI : ScriptedAI
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
me->SetReactState(REACT_AGGRESSIVE);
if (Unit* pUnit = me->SelectNearestTarget())
AttackStart(pUnit);
if (Unit* unit = me->SelectNearestTarget())
AttackStart(unit);
DoZoneInCombat();
break;
@@ -276,8 +276,8 @@ public:
if (timeBombTimer <= uiDiff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM))
DoCast(pUnit, SPELL_TIME_BOMB);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM))
DoCast(unit, SPELL_TIME_BOMB);
timeBombTimer = urand(20000, 25000);
} else timeBombTimer -= uiDiff;
@@ -137,8 +137,8 @@ public:
if (SpellVoidShiftTimer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_VOID_SHIFT);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_VOID_SHIFT);
SpellVoidShiftTimer = 20000;
} else SpellVoidShiftTimer -=diff;
@@ -1706,12 +1706,12 @@ public:
{
}
void SpellHit(Unit* pUnit, const SpellInfo* pSpell)
void SpellHit(Unit* unit, const SpellInfo* pSpell)
{
if (pSpell->Id == SPELL_NEURAL_NEEDLE && pUnit->GetTypeId() == TYPEID_PLAYER)
if (pSpell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER)
{
++uiPhase;
CasterGUID = pUnit->GetGUID();
CasterGUID = unit->GetGUID();
}
}
+11 -11
View File
@@ -839,12 +839,12 @@ public:
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetPositionZ() <= 286.276f)
if (unit->GetPositionZ() <= 286.276f)
{
me->getThreatManager().resetAllAggro();
me->AddThreat(pUnit, 5.0f);
me->AddThreat(unit, 5.0f);
break;
}
EnterEvadeMode();
@@ -961,12 +961,12 @@ public:
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetPositionZ() <= 286.276f)
if (unit->GetPositionZ() <= 286.276f)
{
me->getThreatManager().resetAllAggro();
me->AddThreat(pUnit, 5.0f);
me->AddThreat(unit, 5.0f);
break;
}
EnterEvadeMode();
@@ -1083,7 +1083,7 @@ public:
}
void EnterCombat(Unit* pUnit)
void EnterCombat(Unit* unit)
{
if (!SummonList.empty())
for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
@@ -1091,7 +1091,7 @@ public:
if (Creature* pTemp = Unit::GetCreature(*me, *itr))
{
pTemp->m_CombatDistance = 100.0f; // ugly hack? we are not in a instance sorry. :(
pTemp->AI()->AttackStart(pUnit);
pTemp->AI()->AttackStart(unit);
}
}
}
@@ -1106,12 +1106,12 @@ public:
std::list<HostileReference*> t_list = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetPositionZ() <= 286.276f)
if (unit->GetPositionZ() <= 286.276f)
{
me->getThreatManager().resetAllAggro();
me->AddThreat(pUnit, 5.0f);
me->AddThreat(unit, 5.0f);
break;
}
EnterEvadeMode();
@@ -185,14 +185,14 @@ public:
void RevertThreatOnTarget(uint64 guid)
{
Unit* pUnit = NULL;
pUnit = Unit::GetUnit((*me), guid);
if (pUnit)
Unit* unit = NULL;
unit = Unit::GetUnit((*me), guid);
if (unit)
{
if (DoGetThreat(pUnit))
DoModifyThreatPercent(pUnit, -100);
if (DoGetThreat(unit))
DoModifyThreatPercent(unit, -100);
if (TargetThreat)
me->AddThreat(pUnit, TargetThreat);
me->AddThreat(unit, TargetThreat);
}
}
@@ -1474,9 +1474,9 @@ public:
std::vector<Unit*> eliteList;
for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE)
eliteList.push_back(pUnit);
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->GetEntry() == ILLIDARI_ELITE)
eliteList.push_back(unit);
}
for (std::vector<Unit*>::const_iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr)
(*itr)->setDeathState(JUST_DIED);
@@ -165,12 +165,12 @@ public:
float Z = TeleportPoint[random].z;
for (uint8 i = 0; i < 3; ++i)
{
Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER))
Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 1);
if (unit && unit->isAlive() && (unit->GetTypeId() == TYPEID_PLAYER))
{
TargetGUID[i] = pUnit->GetGUID();
pUnit->CastSpell(pUnit, SPELL_TELEPORT_VISUAL, true);
DoTeleportPlayer(pUnit, X, Y, Z, pUnit->GetOrientation());
TargetGUID[i] = unit->GetGUID();
unit->CastSpell(unit, SPELL_TELEPORT_VISUAL, true);
DoTeleportPlayer(unit, X, Y, Z, unit->GetOrientation());
}
}
}
@@ -247,12 +247,12 @@ public:
{
for (uint8 i = 0; i < 3; ++i)
{
Unit* pUnit = NULL;
Unit* unit = NULL;
if (TargetGUID[i])
{
pUnit = Unit::GetUnit((*me), TargetGUID[i]);
if (pUnit)
pUnit->CastSpell(pUnit, SPELL_ATTRACTION, true);
unit = Unit::GetUnit((*me), TargetGUID[i]);
if (unit)
unit->CastSpell(unit, SPELL_ATTRACTION, true);
TargetGUID[i] = 0;
}
}
@@ -216,12 +216,12 @@ public:
std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit)
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit)
{
DoModifyThreatPercent(pUnit, -100);
float threat = target->getThreatManager().getThreat(pUnit);
me->AddThreat(pUnit, threat); // This makes it so that the unit has the same amount of threat in Reliquary's threatlist as in the target creature's (One of the Essences).
DoModifyThreatPercent(unit, -100);
float threat = target->getThreatManager().getThreat(unit);
me->AddThreat(unit, threat); // This makes it so that the unit has the same amount of threat in Reliquary's threatlist as in the target creature's (One of the Essences).
}
}
}
@@ -438,9 +438,9 @@ public:
std::list<HostileReference*>::const_iterator itr = m_threatlist.begin();
for (; itr != m_threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) // Only alive players
targets.push_back(pUnit);
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->isAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) // Only alive players
targets.push_back(unit);
}
if (targets.empty())
return; // No targets added for some reason. No point continuing.
@@ -821,14 +821,14 @@ public:
{
bool Yelled = false;
for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature(*me, *itr))
if (Creature* unit = Unit::GetCreature(*me, *itr))
{
if (!Yelled)
{
DoScriptText(SAY_BROKEN_FREE_01, pUnit);
DoScriptText(SAY_BROKEN_FREE_01, unit);
Yelled = true;
}
pUnit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
unit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL);
}
}
++EndingTalkCount;
@@ -838,9 +838,9 @@ public:
if (!BrokenList.empty())
{
for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature(*me, *itr))
if (Creature* unit = Unit::GetCreature(*me, *itr))
// This is the incorrect spell, but can't seem to find the right one.
pUnit->CastSpell(pUnit, 39656, true);
unit->CastSpell(unit, 39656, true);
}
++EndingTalkCount;
SoulRetrieveTimer = 5000;
@@ -849,8 +849,8 @@ public:
if (!BrokenList.empty())
{
for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr)
if (Creature* pUnit = Unit::GetCreature((*me), *itr))
pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0);
if (Creature* unit = Unit::GetCreature((*me), *itr))
unit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0);
}
SoulRetrieveTimer = 0;
break;
@@ -177,13 +177,13 @@ 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 && me->IsWithinMeleeRange(pUnit))
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
if (unit && me->IsWithinMeleeRange(unit))
{
if (pUnit->GetHealth() > health)
if (unit->GetHealth() > health)
{
health = pUnit->GetHealth();
target = pUnit;
health = unit->GetHealth();
target = unit;
}
}
}
@@ -173,9 +173,9 @@ public:
std::list<Unit*> targets;
for (; itr != m_threatlist.end(); ++itr)
{
Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (pUnit && pUnit->isAlive())
targets.push_back(pUnit);
Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid());
if (unit && unit->isAlive())
targets.push_back(unit);
}
targets.sort(Trinity::ObjectDistanceOrderPred(me));
Unit* target = targets.front();
@@ -322,11 +322,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 = DoGetThreat(pUnit);
Blossom->AddThreat(pUnit, threat);
float threat = DoGetThreat(unit);
Blossom->AddThreat(unit, threat);
}
}
}
@@ -389,9 +389,9 @@ public:
Done = true;
if (AggroTargetGUID)
{
Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID);
if (pUnit)
AttackStart(pUnit);
Unit* unit = Unit::GetUnit((*me), AggroTargetGUID);
if (unit)
AttackStart(unit);
DoZoneInCombat();
}
@@ -419,10 +419,10 @@ struct boss_illidari_councilAI : public ScriptedAI
{
for (uint8 i = 0; i < 4; ++i)
{
if (Unit* pUnit = Unit::GetUnit(*me, Council[i]))
if (pUnit != me && pUnit->getVictim())
if (Unit* unit = Unit::GetUnit(*me, Council[i]))
if (unit != me && unit->getVictim())
{
AttackStart(pUnit->getVictim());
AttackStart(unit->getVictim());
return;
}
}
@@ -437,11 +437,11 @@ struct boss_illidari_councilAI : public ScriptedAI
damage /= 4;
for (uint8 i = 0; i < 4; ++i)
{
if (Creature* pUnit = Unit::GetCreature(*me, Council[i]))
if (pUnit != me && damage < pUnit->GetHealth())
if (Creature* unit = Unit::GetCreature(*me, Council[i]))
if (unit != me && damage < unit->GetHealth())
{
pUnit->ModifyHealth(-int32(damage));
pUnit->LowerPlayerDamageReq(damage);
unit->ModifyHealth(-int32(damage));
unit->LowerPlayerDamageReq(damage);
}
}
}
@@ -504,15 +504,15 @@ public:
Unit* SelectCouncilMember()
{
Unit* pUnit = me;
Unit* unit = me;
uint32 member = 0; // He chooses Lady Malande most often
if (rand()%10 == 0) // But there is a chance he picks someone else.
member = urand(1, 3);
if (member != 2) // No need to create another pointer to us using Unit::GetUnit
pUnit = Unit::GetUnit((*me), Council[member]);
return pUnit;
unit = Unit::GetUnit((*me), Council[member]);
return unit;
}
void CastAuraOnCouncil()
@@ -525,9 +525,9 @@ public:
}
for (uint8 i = 0; i < 4; ++i)
{
Unit* pUnit = Unit::GetUnit((*me), Council[i]);
if (pUnit)
pUnit->CastSpell(pUnit, spellid, true, 0, 0, me->GetGUID());
Unit* unit = Unit::GetUnit((*me), Council[i]);
if (unit)
unit->CastSpell(unit, spellid, true, 0, 0, me->GetGUID());
}
}
@@ -538,12 +538,12 @@ public:
if (BlessingTimer <= diff)
{
if (Unit* pUnit = SelectCouncilMember())
if (Unit* unit = SelectCouncilMember())
{
switch (urand(0, 1))
{
case 0: DoCast(pUnit, SPELL_BLESS_SPELLWARD); break;
case 1: DoCast(pUnit, SPELL_BLESS_PROTECTION); break;
case 0: DoCast(unit, SPELL_BLESS_SPELLWARD); break;
case 1: DoCast(unit, SPELL_BLESS_PROTECTION); break;
}
}
BlessingTimer = 60000;
@@ -707,15 +707,15 @@ public:
if (Heal_Timer <= diff)
{
// It can be cast on any of the mobs
Unit* pUnit = NULL;
Unit* unit = NULL;
while (pUnit == NULL || !pUnit->isAlive())
while (unit == NULL || !unit->isAlive())
{
pUnit = selectAdvisorUnit();
unit = selectAdvisorUnit();
}
if (pUnit && pUnit->isAlive())
DoCast(pUnit, SPELL_HEAL);
if (unit && unit->isAlive())
DoCast(unit, SPELL_HEAL);
Heal_Timer = 60000;
} else Heal_Timer -= diff;
@@ -724,26 +724,26 @@ public:
Unit* selectAdvisorUnit()
{
Unit* pUnit = NULL;
Unit* unit = NULL;
if (pInstance)
{
switch (rand()%4)
{
case 0:
pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESS));
unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESS));
break;
case 1:
pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_SHARKKIS));
unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_SHARKKIS));
break;
case 2:
pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_TIDALVESS));
unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_TIDALVESS));
break;
case 3:
pUnit = me;
unit = me;
break;
}
} else pUnit = me;
return pUnit;
} else unit = me;
return unit;
}
};
};
@@ -96,9 +96,9 @@ public:
}
void JustDied(Unit* /*victim*/)
{
Unit* pUnit = Unit::GetUnit((*me), victimGUID);
if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER))
pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER);
Unit* unit = Unit::GetUnit((*me), victimGUID);
if (unit && unit->HasAura(SPELL_INSIDIOUS_WHISPER))
unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER);
}
void DamageTaken(Unit* done_by, uint32 &damage)
@@ -353,13 +353,13 @@ public:
{
if (InnderDemon[i] > 0)
{
Creature* pUnit = Unit::GetCreature((*me), InnderDemon[i]);
if (pUnit && pUnit->isAlive())
Creature* unit = Unit::GetCreature((*me), InnderDemon[i]);
if (unit && unit->isAlive())
{
Unit* unit_target = Unit::GetUnit(*pUnit, CAST_AI(mob_inner_demon::mob_inner_demonAI, pUnit->AI())->victimGUID);
Unit* unit_target = Unit::GetUnit(*unit, CAST_AI(mob_inner_demon::mob_inner_demonAI, unit->AI())->victimGUID);
if (unit_target && unit_target->isAlive())
{
pUnit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true);
unit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true);
DoModifyThreatPercent(unit_target, -100);
}
}
@@ -770,8 +770,8 @@ class boss_kaelthas : public CreatureScript
if (FlameStrike_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_FLAME_STRIKE);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_FLAME_STRIKE);
FlameStrike_Timer = 30000;
}
@@ -784,7 +784,7 @@ class boss_kaelthas : public CreatureScript
for (uint32 i = 0; i < 3; ++i)
{
sLog->outDebug(LOG_FILTER_TSCR, "SD2: Kael'Thas mind control not supported.");
//DoCast(pUnit, SPELL_MIND_CONTROL);
//DoCast(unit, SPELL_MIND_CONTROL);
}
MindControl_Timer = 60000;
@@ -892,11 +892,11 @@ class boss_kaelthas : public CreatureScript
// 1) Kael'thas will portal the whole raid right into his body
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))
{
//Use work around packet to prevent player from being dropped from combat
DoTeleportPlayer(pUnit, afGravityPos[0], afGravityPos[1], afGravityPos[2], pUnit->GetOrientation());
DoTeleportPlayer(unit, afGravityPos[0], afGravityPos[1], afGravityPos[2], unit->GetOrientation());
}
}
@@ -913,20 +913,20 @@ class boss_kaelthas : public CreatureScript
// 2) At that point he will put a Gravity Lapse debuff on everyone
for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i)
{
if (Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()))
{
DoCast(pUnit, SPELL_KNOCKBACK, true);
DoCast(unit, SPELL_KNOCKBACK, true);
//Gravity lapse - needs an exception in Spell system to work
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE, true, 0, 0, me->GetGUID());
pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE, true, 0, 0, me->GetGUID());
unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, me->GetGUID());
//Using packet workaround
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);
}
}
GravityLapse_Timer = 10000;
@@ -946,14 +946,14 @@ class boss_kaelthas : public CreatureScript
//Remove flight
for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i)
{
if (Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()))
{
//Using packet workaround
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);
}
}
@@ -982,8 +982,8 @@ class boss_kaelthas : public CreatureScript
//NetherBeam_Timer
if (NetherBeam_Timer <= diff)
{
if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(pUnit, SPELL_NETHER_BEAM);
if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(unit, SPELL_NETHER_BEAM);
NetherBeam_Timer = 4000;
}
@@ -1286,12 +1286,12 @@ class boss_grand_astromancer_capernian : public CreatureScript
std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList();
for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i)
{
Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid());
Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid());
//if in melee range
if (pUnit && pUnit->IsWithinDistInMap(me, 5))
if (unit && unit->IsWithinDistInMap(me, 5))
{
InMeleeRange = true;
target = pUnit;
target = unit;
break;
}
}
+3 -3
View File
@@ -809,10 +809,10 @@ public:
for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr)
{
if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
{
if (pUnit->GetCreateMana() > 0)
UnitsWithMana.push_back(pUnit);
if (unit->GetCreateMana() > 0)
UnitsWithMana.push_back(unit);
}
}
if (!UnitsWithMana.empty())
@@ -129,9 +129,9 @@ public:
{
if (bCanEat && !bIsEating)
{
if (Unit* pUnit = Unit::GetUnit(*me, uiPlayerGUID))
if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID))
{
if (GameObject* pGo = pUnit->FindNearestGameObject(GO_CARCASS, 10))
if (GameObject* pGo = unit->FindNearestGameObject(GO_CARCASS, 10))
{
if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE)
me->GetMotionMaster()->MovementExpired();