Core/Misc: Some random cleanups and code style fixes

This commit is contained in:
tobmaps
2011-06-20 04:04:20 +07:00
parent 24764a674b
commit afd524f36b
5 changed files with 53 additions and 53 deletions
+5 -5
View File
@@ -992,7 +992,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama
return;
}
Unit *pVictim = damageInfo->target;
Unit* pVictim = damageInfo->target;
if (!pVictim || !pVictim->isAlive())
return;
@@ -1095,7 +1095,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
if (damageInfo == 0)
return;
Unit *pVictim = damageInfo->target;
Unit* pVictim = damageInfo->target;
if (!pVictim)
return;
@@ -1325,7 +1325,7 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
{
Unit *pVictim = damageInfo->target;
Unit* pVictim = damageInfo->target;
if (!pVictim->isAlive() || pVictim->HasUnitState(UNIT_STAT_IN_FLIGHT) || (pVictim->HasUnitState(UNIT_STAT_ONVEHICLE) && pVictim->GetVehicleBase() != this) || (pVictim->GetTypeId() == TYPEID_UNIT && pVictim->ToCreature()->IsInEvadeMode()))
return;
@@ -5716,7 +5716,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return true;
// Crititcal counted -> roll chance
if (roll_chance_i(triggerAmount))
CastSpell(this, 48108, true, castItem, triggeredByAura);
CastSpell(this, 48108, true, castItem, triggeredByAura);
}
counter->SetAmount(25);
return true;
@@ -16759,7 +16759,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
{
if (itr->second.IsFitToRequirements(clicker, this))
{
Unit *caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
Unit* caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_CLICKER) ? clicker : this;
Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
uint64 origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();
@@ -6027,8 +6027,8 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster)
else
{
Creature* c = target->ToCreature();
if (!c || (c && !sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature())) ||
(c && !c->AI()->sOnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()))))
if (!c || !sScriptMgr->OnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex()), target->ToCreature()) ||
!c->AI()->sOnDummyEffect(caster, GetId(), SpellEffIndex(GetEffIndex())))
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellAuraTick: Spell %u has non-existent spell %u in EffectTriggered[%d] and is therefor not triggered.", GetId(), triggerSpellId, GetEffIndex());
}
}
+2 -2
View File
@@ -1075,7 +1075,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case 44544: // Fingers of Frost
{
// See if we already have the indicator aura. If not, create one.
if (Aura *aur = target->GetAura(74396))
if (Aura* aur = target->GetAura(74396))
{
// Aura already there. Refresh duration and set original charges
aur->SetCharges(2);
@@ -2041,7 +2041,7 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster)
targetList.push_back(GetUnitOwner());
case SPELL_EFFECT_APPLY_AREA_AURA_OWNER:
{
if (Unit *owner = GetUnitOwner()->GetCharmerOrOwner())
if (Unit* owner = GetUnitOwner()->GetCharmerOrOwner())
if (GetUnitOwner()->IsWithinDistInMap(owner, radius))
targetList.push_back(owner);
break;
+42 -42
View File
@@ -357,7 +357,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
uint8 count = 0;
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID != m_caster->GetGUID())
if (Player *target = ObjectAccessor::GetPlayer(*m_caster, ihit->targetGUID))
if (Player* target = ObjectAccessor::GetPlayer(*m_caster, ihit->targetGUID))
if (target->HasAura(m_triggeredByAuraSpell->Id))
++count;
if (count)
@@ -1008,7 +1008,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (player && player->GetQuestStatus(11379) == QUEST_STATUS_INCOMPLETE)
{
Creature *creature = player->FindNearestCreature(19973, 10, false);
Creature* creature = player->FindNearestCreature(19973, 10, false);
if (!creature)
{
SendCastResult(SPELL_FAILED_NOT_HERE);
@@ -1147,8 +1147,8 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
{
if (m_targets.HasTraj())
{
if (Vehicle *vehicle = m_caster->GetVehicleKit())
if (Unit *passenger = vehicle->GetPassenger(damage - 1))
if (Vehicle* vehicle = m_caster->GetVehicleKit())
if (Unit* passenger = vehicle->GetPassenger(damage - 1))
{
std::list<Unit*> unitList;
// use 99 because it is 3d search
@@ -1157,9 +1157,9 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
Unit* target = NULL;
for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
{
if (Vehicle *seat = (*itr)->GetVehicleKit())
if (Vehicle* seat = (*itr)->GetVehicleKit())
if (!seat->GetPassenger(0))
if (Unit *device = seat->GetPassenger(2))
if (Unit* device = seat->GetPassenger(2))
if (!device->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
{
float dist = (*itr)->GetExactDistSq(&m_targets.m_dstPos);
@@ -1419,7 +1419,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
if (!unitTarget)
return;
// Restorative Totems
if (Unit *owner = m_caster->GetOwner())
if (Unit* owner = m_caster->GetOwner())
if (AuraEffect *dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 338, 1))
AddPctN(damage, dummy->GetAmount());
@@ -1481,7 +1481,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
case 49560: // Death Grip
Position pos;
GetSummonPosition(effIndex, pos);
if (Unit *unit = unitTarget->GetVehicleBase()) // what is this for?
if (Unit* unit = unitTarget->GetVehicleBase()) // what is this for?
unit->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
else if (!unitTarget->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
unitTarget->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
@@ -1773,7 +1773,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)
// Priest Shadowfiend (34433) need apply mana gain trigger aura on pet
case 41967:
{
if (Unit *pet = unitTarget->GetGuardianPet())
if (Unit* pet = unitTarget->GetGuardianPet())
pet->CastSpell(pet, 28305, true);
return;
}
@@ -2090,7 +2090,7 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)unitTarget;
Player* _player = unitTarget->ToPlayer();
uint32 spellToUnlearn = m_spellInfo->EffectTriggerSpell[effIndex];
_player->removeSpell(spellToUnlearn);
@@ -2203,7 +2203,7 @@ void Spell::SpellDamageHeal(SpellEffIndex /*effIndex*/)
if (unitTarget && unitTarget->isAlive() && damage >= 0)
{
// Try to get original caster
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
Unit* caster = m_originalCasterGUID ? m_originalCaster : m_caster;
// Skip if m_originalCaster not available
if (!caster)
@@ -2530,7 +2530,7 @@ void Spell::EffectPersistentAA(SpellEffIndex effIndex)
if (Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius);
Unit *caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
Unit* caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
// Caster not in world, might be spell triggered from aura removal
if (!caster->IsInWorld())
return;
@@ -2955,7 +2955,7 @@ void Spell::EffectProficiency(SpellEffIndex /*effIndex*/)
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *p_target = (Player*)unitTarget;
Player* p_target = unitTarget->ToPlayer();
uint32 subClassMask = m_spellInfo->EquippedItemSubClassMask;
if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask))
@@ -3739,7 +3739,7 @@ void Spell::EffectTameCreature(SpellEffIndex /*effIndex*/)
void Spell::EffectSummonPet(SpellEffIndex effIndex)
{
Player *owner = NULL;
Player* owner = NULL;
if (m_originalCaster)
{
if (m_originalCaster->GetTypeId() == TYPEID_PLAYER)
@@ -3758,7 +3758,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
return;
}
Pet *OldSummon = owner->GetPet();
Pet* OldSummon = owner->GetPet();
// if pet requested type already exist
if (OldSummon)
@@ -3822,9 +3822,9 @@ void Spell::EffectLearnPetSpell(SpellEffIndex effIndex)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)m_caster;
Player* _player = m_caster->ToPlayer();
Pet *pet = _player->GetPet();
Pet* pet = _player->GetPet();
if (!pet)
return;
if (!pet->isAlive())
@@ -4273,7 +4273,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player *pl = m_caster->ToPlayer();
Player* pl = m_caster->ToPlayer();
Battleground* bg = pl->GetBattleground();
switch(pGameObj->GetMapId())
@@ -4487,11 +4487,11 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
// Plant Warmaul Ogre Banner
case 32307:
{
Player *p_caster = dynamic_cast<Player*>(m_caster);
Player* p_caster = dynamic_cast<Player*>(m_caster);
if (!p_caster)
break;
p_caster->RewardPlayerAndGroupAtEvent(18388, unitTarget);
Creature *cTarget = dynamic_cast<Creature*>(unitTarget);
Creature* cTarget = dynamic_cast<Creature*>(unitTarget);
if (!cTarget)
break;
cTarget->setDeathState(CORPSE);
@@ -5070,9 +5070,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
}
case 62428: // Load into Catapult
{
if (Vehicle *seat = m_caster->GetVehicleKit())
if (Unit *passenger = seat->GetPassenger(0))
if (Unit *demolisher = m_caster->GetVehicleBase())
if (Vehicle* seat = m_caster->GetVehicleKit())
if (Unit* passenger = seat->GetPassenger(0))
if (Unit* demolisher = m_caster->GetVehicleBase())
passenger->CastSpell(demolisher, damage, true);
return;
}
@@ -5080,9 +5080,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
{
if (unitTarget)
{
if (Vehicle *seat = m_caster->GetVehicleKit())
if (Vehicle* seat = m_caster->GetVehicleKit())
{
if (Creature *oldContainer = dynamic_cast<Creature*>(seat->GetPassenger(1)))
if (Creature* oldContainer = dynamic_cast<Creature*>(seat->GetPassenger(1)))
oldContainer->DisappearAndDie();
// TODO: a hack, range = 11, should after some time cast, otherwise too far
m_caster->CastSpell(seat->GetBase(), 62496, true);
@@ -5194,7 +5194,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
case 64142: // Upper Deck - Create Foam Sword
if (unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *plr = unitTarget->ToPlayer();
Player* plr = unitTarget->ToPlayer();
static uint32 const itemId[] = {45061, 45176, 45177, 45178, 45179, 0};
// player can only have one of these items
for (uint32 const *itr = &itemId[0]; *itr; ++itr)
@@ -5392,8 +5392,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *caster = (Player*)m_caster;
Player *target = (Player*)unitTarget;
Player* caster = m_caster->ToPlayer();
Player* target = unitTarget->ToPlayer();
// caster or target already have requested duel
if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow()))
@@ -5419,7 +5419,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
uint32 gameobject_id = m_spellInfo->EffectMiscValue[effIndex];
Map *map = m_caster->GetMap();
Map* map = m_caster->GetMap();
if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id,
map, m_caster->GetPhaseMask(),
m_caster->GetPositionX()+(unitTarget->GetPositionX()-m_caster->GetPositionX())/2 ,
@@ -5672,13 +5672,13 @@ void Spell::EffectFeedPet(SpellEffIndex effIndex)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)m_caster;
Player* _player = m_caster->ToPlayer();
Item* foodItem = m_targets.getItemTarget();
if (!foodItem)
return;
Pet *pet = _player->GetPet();
Pet* pet = _player->GetPet();
if (!pet)
return;
@@ -5871,7 +5871,7 @@ void Spell::EffectReputation(SpellEffIndex effIndex)
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)unitTarget;
Player* _player = unitTarget->ToPlayer();
int32 rep_change = damage;//+1; // field store reputation change -1
@@ -5948,7 +5948,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
mana = CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), damage);
}
Player *plr = unitTarget->ToPlayer();
Player* plr = unitTarget->ToPlayer();
plr->ResurrectPlayer(0.0f);
plr->SetHealth(health);
@@ -6080,7 +6080,7 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex)
void Spell::EffectQuestClear(SpellEffIndex effIndex)
{
Player *pPlayer = NULL;
Player* pPlayer = NULL;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
pPlayer = m_caster->ToPlayer();
else if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER)
@@ -6179,8 +6179,8 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/)
{
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *_player = (Player*)m_caster;
Pet *pet = _player->GetPet();
Player* _player = m_caster->ToPlayer();
Pet* pet = _player->GetPet();
if (!pet)
return;
if (pet->isAlive())
@@ -6664,7 +6664,7 @@ void Spell::EffectActivateRune(SpellEffIndex effIndex)
if (m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *plr = (Player*)m_caster;
Player* plr = m_caster->ToPlayer();
if (plr->getClass() != CLASS_DEATH_KNIGHT)
return;
@@ -6703,7 +6703,7 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex)
return;
uint32 creatureEntry = m_spellInfo->EffectMiscValue[effIndex];
Pet * pet = unitTarget->CreateTamedPetFrom(creatureEntry, m_spellInfo->Id);
Pet* pet = unitTarget->CreateTamedPetFrom(creatureEntry, m_spellInfo->Id);
if (!pet)
return;
@@ -6747,7 +6747,7 @@ void Spell::EffectWMODamage(SpellEffIndex /*effIndex*/)
{
if (gameObjTarget && gameObjTarget->GetGoType() == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
{
Unit *caster = m_originalCaster;
Unit* caster = m_originalCaster;
if (!caster)
return;
@@ -6765,7 +6765,7 @@ void Spell::EffectWMODamage(SpellEffIndex /*effIndex*/)
WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8+8+8+4+4);
data.append(gameObjTarget->GetPackGUID());
data.append(caster->GetPackGUID());
if (Unit *who = caster->GetCharmerOrOwner())
if (Unit* who = caster->GetCharmerOrOwner())
data.append(who->GetPackGUID());
else
data << uint8(0);
@@ -6814,7 +6814,7 @@ void Spell::EffectWMOChange(SpellEffIndex effIndex)
void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *properties)
{
Unit *caster = m_originalCaster;
Unit* caster = m_originalCaster;
if (!caster)
return;
@@ -7005,7 +7005,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER)
return;
Player *p_caster = (Player*)m_caster;
Player* p_caster = m_caster->ToPlayer();
uint32 button_id = m_spellInfo->EffectMiscValue[effIndex] + 132;
uint32 n_buttons = m_spellInfo->EffectMiscValueB[effIndex];
+2 -2
View File
@@ -2850,7 +2850,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
else if ((spellproto->SpellFamilyFlags[0] & 0x40000) && spellproto->SpellIconID == 132)
return DIMINISHING_SCATTER_SHOT;
// Entrapment (own diminishing)
else if ((spellproto->SpellVisual[0] == 7484) && spellproto->SpellIconID == 20)
else if (spellproto->SpellVisual[0] == 7484 && spellproto->SpellIconID == 20)
return DIMINISHING_ENTRAPMENT;
// Wyvern Sting mechanic is MECHANIC_SLEEP but the diminishing is DIMINISHING_DISORIENT
else if ((spellproto->SpellFamilyFlags[1] & 0x1000) && spellproto->SpellIconID == 1721)
@@ -2862,7 +2862,7 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
}
case SPELLFAMILY_PALADIN:
{
// Judgement of Justice - limit duration to 10s in PvP
// Judgement of Justice - limit duration to 10s in PvP
if (spellproto->SpellFamilyFlags[0] & 0x100000)
return DIMINISHING_LIMITONLY;
// Turn Evil