Core/Misc: Minor cleanup and code style fix

This commit is contained in:
tobmaps
2011-07-15 07:12:54 +07:00
parent 26b3f00dac
commit 944fb4c1b7
@@ -420,7 +420,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
if (!amount && caster) if (!amount && caster)
if (uint64 itemGUID = GetBase()->GetCastItemGUID()) if (uint64 itemGUID = GetBase()->GetCastItemGUID())
if (Player* playerCaster = caster->ToPlayer()) if (Player* playerCaster = caster->ToPlayer())
if (Item *castItem = playerCaster->GetItemByGuid(itemGUID)) if (Item* castItem = playerCaster->GetItemByGuid(itemGUID))
if (castItem->GetItemSuffixFactor()) if (castItem->GetItemSuffixFactor())
{ {
ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId())); ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(castItem->GetItemRandomPropertyId()));
@@ -523,7 +523,7 @@ int32 AuraEffect::CalculateAmount(Unit* caster)
float bonus = 0.8068f; float bonus = 0.8068f;
// Borrowed Time // Borrowed Time
if (AuraEffect const* pAurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_PRIEST, 2899, 1)) if (AuraEffect const* pAurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2899, 1))
bonus += CalculatePctN(1.0f, pAurEff->GetAmount()); bonus += CalculatePctN(1.0f, pAurEff->GetAmount());
DoneActualBenefit += caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * bonus; DoneActualBenefit += caster->SpellBaseHealingBonus(GetSpellSchoolMask(m_spellProto)) * bonus;
@@ -1026,7 +1026,7 @@ void AuraEffect::HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply)
void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply) void AuraEffect::HandleEffect(Unit* target, uint8 mode, bool apply)
{ {
AuraApplication * aurApp = GetBase()->GetApplicationOfTarget(target->GetGUID()); AuraApplication* aurApp = GetBase()->GetApplicationOfTarget(target->GetGUID());
ASSERT(aurApp); ASSERT(aurApp);
HandleEffect(aurApp, mode, apply); HandleEffect(aurApp, mode, apply);
} }
@@ -1054,7 +1054,7 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
Unit::AuraApplicationMap & auras = target->GetAppliedAuras(); Unit::AuraApplicationMap & auras = target->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter) for (Unit::AuraApplicationMap::iterator iter = auras.begin(); iter != auras.end(); ++iter)
{ {
Aura * aura = iter->second->GetBase(); Aura* aura = iter->second->GetBase();
// only passive auras-active auras should have amount set on spellcast and not be affected // only passive auras-active auras should have amount set on spellcast and not be affected
// if aura is casted by others, it will not be affected // if aura is casted by others, it will not be affected
if ((aura->IsPassive() || aura->GetSpellProto()->AttributesEx2 & SPELL_ATTR2_ALWAYS_APPLY_MODIFIERS) && aura->GetCasterGUID() == guid && sSpellMgr->IsAffectedByMod(aura->GetSpellProto(), m_spellmod)) if ((aura->IsPassive() || aura->GetSpellProto()->AttributesEx2 & SPELL_ATTR2_ALWAYS_APPLY_MODIFIERS) && aura->GetCasterGUID() == guid && sSpellMgr->IsAffectedByMod(aura->GetSpellProto(), m_spellmod))
@@ -1063,23 +1063,23 @@ void AuraEffect::ApplySpellMod(Unit* target, bool apply)
{ {
for (uint8 i = 0; i<MAX_SPELL_EFFECTS; ++i) for (uint8 i = 0; i<MAX_SPELL_EFFECTS; ++i)
{ {
if (AuraEffect * aurEff = aura->GetEffect(i)) if (AuraEffect* aurEff = aura->GetEffect(i))
aurEff->RecalculateAmount(); aurEff->RecalculateAmount();
} }
} }
else if (GetMiscValue() == SPELLMOD_EFFECT1) else if (GetMiscValue() == SPELLMOD_EFFECT1)
{ {
if (AuraEffect * aurEff = aura->GetEffect(0)) if (AuraEffect* aurEff = aura->GetEffect(0))
aurEff->RecalculateAmount(); aurEff->RecalculateAmount();
} }
else if (GetMiscValue() == SPELLMOD_EFFECT2) else if (GetMiscValue() == SPELLMOD_EFFECT2)
{ {
if (AuraEffect * aurEff = aura->GetEffect(1)) if (AuraEffect* aurEff = aura->GetEffect(1))
aurEff->RecalculateAmount(); aurEff->RecalculateAmount();
} }
else //if (modOp == SPELLMOD_EFFECT3) else //if (modOp == SPELLMOD_EFFECT3)
{ {
if (AuraEffect * aurEff = aura->GetEffect(2)) if (AuraEffect* aurEff = aura->GetEffect(2))
aurEff->RecalculateAmount(); aurEff->RecalculateAmount();
} }
} }
@@ -1152,7 +1152,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
if (!caster || caster->GetTypeId() != TYPEID_PLAYER) if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
return; return;
// Get SPELL_AURA_MOD_POWER_REGEN aura from spell // Get SPELL_AURA_MOD_POWER_REGEN aura from spell
if (AuraEffect * aurEff = GetBase()->GetEffect(0)) if (AuraEffect* aurEff = GetBase()->GetEffect(0))
{ {
if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN) if (aurEff->GetAuraType() != SPELL_AURA_MOD_POWER_REGEN)
{ {
@@ -1205,7 +1205,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
break; break;
case 66823: case 67618: case 67619: case 67620: // Paralytic Toxin case 66823: case 67618: case 67619: case 67620: // Paralytic Toxin
// Get 0 effect aura // Get 0 effect aura
if (AuraEffect *slow = GetBase()->GetEffect(0)) if (AuraEffect* slow = GetBase()->GetEffect(0))
{ {
int32 newAmount = slow->GetAmount() - 10; int32 newAmount = slow->GetAmount() - 10;
if (newAmount < -100) if (newAmount < -100)
@@ -1226,7 +1226,7 @@ void AuraEffect::UpdatePeriodic(Unit* caster)
if (GetSpellProto()->SpellFamilyFlags[1] & 0x00004000) if (GetSpellProto()->SpellFamilyFlags[1] & 0x00004000)
{ {
// Get 0 effect aura // Get 0 effect aura
if (AuraEffect *slow = GetBase()->GetEffect(0)) if (AuraEffect* slow = GetBase()->GetEffect(0))
{ {
int32 newAmount = slow->GetAmount() + GetAmount(); int32 newAmount = slow->GetAmount() + GetAmount();
if (newAmount > 0) if (newAmount > 0)
@@ -2008,7 +2008,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
{ {
// get furor proc chance // get furor proc chance
uint32 FurorChance = 0; uint32 FurorChance = 0;
if (AuraEffect const *dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0)) if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
FurorChance = std::max(dummy->GetAmount(), 0); FurorChance = std::max(dummy->GetAmount(), 0);
switch (GetMiscValue()) switch (GetMiscValue())
@@ -2117,7 +2117,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
if (target->getClass() == CLASS_DRUID) if (target->getClass() == CLASS_DRUID)
{ {
// Dash // Dash
if (AuraEffect * aurEff =target->GetAuraEffect(SPELL_AURA_MOD_INCREASE_SPEED, SPELLFAMILY_DRUID, 0, 0, 0x8)) if (AuraEffect* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_INCREASE_SPEED, SPELLFAMILY_DRUID, 0, 0, 0x8))
aurEff->RecalculateAmount(); aurEff->RecalculateAmount();
// Disarm handling // Disarm handling
@@ -2125,7 +2125,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
// and also HandleAuraModDisarm is not triggered // and also HandleAuraModDisarm is not triggered
if (!target->CanUseAttackType(BASE_ATTACK)) if (!target->CanUseAttackType(BASE_ATTACK))
{ {
if (Item *pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND)) if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
{ {
target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), NULL, apply); target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), NULL, apply);
} }
@@ -2561,7 +2561,7 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
// Handle damage modification, shapeshifted druids are not affected // Handle damage modification, shapeshifted druids are not affected
if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm()) if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
{ {
if (Item *pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{ {
uint8 attacktype = Player::GetAttackBySlot(slot); uint8 attacktype = Player::GetAttackBySlot(slot);
@@ -2770,7 +2770,7 @@ void AuraEffect::HandleAuraModPetTalentsPoints(AuraApplication const* aurApp, ui
return; return;
// Recalculate pet talent points // Recalculate pet talent points
if (Pet *pet = target->ToPlayer()->GetPet()) if (Pet* pet = target->ToPlayer()->GetPet())
pet->InitTalentForLevel(); pet->InitTalentForLevel();
} }
@@ -3449,7 +3449,7 @@ void AuraEffect::HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint
{ {
if (target->ToPlayer()->InBattleground()) if (target->ToPlayer()->InBattleground())
{ {
if (Battleground *bg = target->ToPlayer()->GetBattleground()) if (Battleground* bg = target->ToPlayer()->GetBattleground())
bg->EventPlayerDroppedFlag(target->ToPlayer()); bg->EventPlayerDroppedFlag(target->ToPlayer());
} }
else else
@@ -4650,7 +4650,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
return; return;
// ..while they are casting // ..while they are casting
if (target->IsNonMeleeSpellCasted(false, false, true, false, false)) if (target->IsNonMeleeSpellCasted(false, false, true, false, false))
if (AuraEffect * aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARRIOR, 2775, 0)) if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_FLAT_MODIFIER, SPELLFAMILY_WARRIOR, 2775, 0))
switch (aurEff->GetId()) switch (aurEff->GetId())
{ {
// Unrelenting Assault, rank 1 // Unrelenting Assault, rank 1
@@ -4684,8 +4684,8 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->CastSpell(target, 34027, true, NULL, this); target->CastSpell(target, 34027, true, NULL, this);
// set 3 stacks and 3 charges (to make all auras not disappear at once) // set 3 stacks and 3 charges (to make all auras not disappear at once)
Aura * owner_aura = target->GetAura(34027, GetCasterGUID()); Aura* owner_aura = target->GetAura(34027, GetCasterGUID());
Aura * pet_aura = pet->GetAura(58914, GetCasterGUID()); Aura* pet_aura = pet->GetAura(58914, GetCasterGUID());
if (owner_aura) if (owner_aura)
{ {
owner_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount); owner_aura->SetStackAmount(owner_aura->GetSpellProto()->StackAmount);
@@ -4719,7 +4719,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
{ {
target->CastSpell(target, 55166, true, NULL, this); target->CastSpell(target, 55166, true, NULL, this);
// set 3 stacks and 3 charges (to make all auras not disappear at once) // set 3 stacks and 3 charges (to make all auras not disappear at once)
Aura * owner_aura = target->GetAura(55166, GetCasterGUID()); Aura* owner_aura = target->GetAura(55166, GetCasterGUID());
if (owner_aura) if (owner_aura)
{ {
// This aura lasts 2 sec, need this hack to properly proc spells // This aura lasts 2 sec, need this hack to properly proc spells
@@ -4766,7 +4766,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
break; break;
case 49028: case 49028:
if (caster) if (caster)
if (AuraEffect *aurEff = caster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon if (AuraEffect* aurEff = caster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon
GetBase()->SetDuration(GetBase()->GetDuration() + aurEff->GetAmount()); GetBase()->SetDuration(GetBase()->GetDuration() + aurEff->GetAmount());
break; break;
case 52916: // Honor Among Thieves case 52916: // Honor Among Thieves
@@ -4848,7 +4848,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
case 2584: // Waiting to Resurrect case 2584: // Waiting to Resurrect
// Waiting to resurrect spell cancel, we must remove player from resurrect queue // Waiting to resurrect spell cancel, we must remove player from resurrect queue
if (target->GetTypeId() == TYPEID_PLAYER) if (target->GetTypeId() == TYPEID_PLAYER)
if (Battleground *bg = target->ToPlayer()->GetBattleground()) if (Battleground* bg = target->ToPlayer()->GetBattleground())
bg->RemovePlayerFromResurrectQueue(target->GetGUID()); bg->RemovePlayerFromResurrectQueue(target->GetGUID());
break; break;
case 36730: // Flame Strike case 36730: // Flame Strike
@@ -5012,7 +5012,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (!caster) if (!caster)
break; break;
Unit *owner = caster->GetOwner(); Unit* owner = caster->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER) if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{ {
if (apply) if (apply)
@@ -5028,7 +5028,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (!caster) if (!caster)
break; break;
Unit *owner = caster->GetOwner(); Unit* owner = caster->GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER) if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{ {
if (apply) if (apply)
@@ -5195,7 +5195,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
uint64 guid = caster->m_SummonSlot[3]; uint64 guid = caster->m_SummonSlot[3];
if (guid) if (guid)
{ {
Creature *totem = caster->GetMap()->GetCreature(guid); Creature* totem = caster->GetMap()->GetCreature(guid);
if (totem && totem->isTotem()) if (totem && totem->isTotem())
caster->ToPlayer()->CastSpell(totem, 6277, true); caster->ToPlayer()->CastSpell(totem, 6277, true);
} }
@@ -5235,7 +5235,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
if (apply) if (apply)
{ {
if (!target->HasAura(48266) && !target->HasAura(63611)) if (!target->HasAura(48266) && !target->HasAura(63611))
target->CastSpell(target, 63611, true); target->CastSpell(target, 63611, true, NULL, this);
} }
else else
target->RemoveAurasDueToSpell(63611); target->RemoveAurasDueToSpell(63611);
@@ -5282,7 +5282,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mod
if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000)) if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000))
{ {
// Glyph of Drain Soul - chance to create an additional Soul Shard // Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect *aur = caster->GetAuraEffect(58070, 0)) if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
if (roll_chance_i(aur->GetMiscValue())) if (roll_chance_i(aur->GetMiscValue()))
caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :) caster->CastSpell(caster, 58068, true, 0, aur); // We _could_ simply do ++count here, but Blizz does it this way :)
} }
@@ -5632,7 +5632,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
if (target->GetMap()->IsDungeon() && int(target->GetAppliedAuras().count(62399)) >= (target->GetMap()->IsHeroic() ? 4 : 2)) if (target->GetMap()->IsDungeon() && int(target->GetAppliedAuras().count(62399)) >= (target->GetMap()->IsHeroic() ? 4 : 2))
{ {
target->CastSpell(target, 62475, true); // System Shutdown target->CastSpell(target, 62475, true); // System Shutdown
if (Unit *veh = target->GetVehicleBase()) if (Unit* veh = target->GetVehicleBase())
veh->CastSpell(target, 62475, true); veh->CastSpell(target, 62475, true);
} }
break; break;
@@ -6218,7 +6218,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
{ {
caster->CastSpell(caster, 43836, true, 0, this); caster->CastSpell(caster, 43836, true, 0, this);
// Glyph of Drain Soul - chance to create an additional Soul Shard // Glyph of Drain Soul - chance to create an additional Soul Shard
if (AuraEffect *aur = caster->GetAuraEffect(58070, 0)) if (AuraEffect* aur = caster->GetAuraEffect(58070, 0))
if (roll_chance_i(aur->GetMiscValue())) if (roll_chance_i(aur->GetMiscValue()))
caster->CastSpell(caster, 58068, true, 0, aur); caster->CastSpell(caster, 58068, true, 0, aur);
} }
@@ -6715,7 +6715,7 @@ void AuraEffect::HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp
Unit* triggerTarget = eventInfo.GetProcTarget(); Unit* triggerTarget = eventInfo.GetProcTarget();
uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[m_effIndex]; uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[m_effIndex];
if (SpellEntry const *triggeredSpellInfo = sSpellStore.LookupEntry(triggerSpellId)) if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggerSpellId))
{ {
int32 basepoints0 = GetAmount(); int32 basepoints0 = GetAmount();
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId()); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandleProcTriggerSpellWithValueAuraProc: Triggering spell %u with value %d from aura %u proc", triggeredSpellInfo->Id, basepoints0, GetId());