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
@@ -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;