Core/Cleanup:

* move repeating code into separate method for storing locale strings in ObjectMgr (copy/paste sucks, you know)
* fix 'signed/unsigned' warnings (at least in VS)
* fix some other warnings and cleanup relative code

--HG--
branch : trunk
This commit is contained in:
azazel
2010-08-26 15:54:56 +06:00
parent 6036166716
commit 5fa14f58dc
23 changed files with 195 additions and 379 deletions
@@ -668,16 +668,16 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
{
int32 value = int32((amount*-1)-10);
int32 value = (-1 * amount) - 10;
uint32 defva = uint32(caster->ToPlayer()->GetSkillValue(SKILL_DEFENSE) + caster->ToPlayer()->GetRatingBonusValue(CR_DEFENSE_SKILL));
if (defva > 400)
value += int32((defva-400)*0.15);
value += int32((defva - 400) * 0.15);
// Glyph of Icebound Fortitude
if (AuraEffect const * aurEff = caster->GetAuraEffect(58625,0))
if (AuraEffect const * aurEff = caster->GetAuraEffect(58625, 0))
{
uint32 valMax = aurEff->GetAmount();
int32 valMax = aurEff->GetAmount();
if (value < valMax)
value = valMax;
}
@@ -1908,7 +1908,7 @@ void AuraEffect::PeriodicDummyTick(Unit * target, Unit * caster) const
target->CastSpell((Unit*)NULL, m_spellProto->EffectTriggerSpell[m_effIndex], true);
break;
case 62399: // Overload Circuit
if (target->GetMap()->IsDungeon() && 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
if (Unit *veh = target->GetVehicleBase())
@@ -5920,7 +5920,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
{
SpellEntry const * spell = sSpellStore.LookupEntry(spellId);
for (int i=0; i < spell->StackAmount; ++i)
for (uint32 i = 0; i < spell->StackAmount; ++i)
caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID());
break;
}
@@ -5934,7 +5934,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
if (apply && caster)
{
SpellEntry const * spell = sSpellStore.LookupEntry(spellId);
for (int i=0; i < spell->StackAmount; ++i)
for (uint32 i = 0; i < spell->StackAmount; ++i)
caster->CastSpell(target, spell->Id, true, NULL, NULL, GetCasterGUID());
break;
}
+5 -5
View File
@@ -603,7 +603,7 @@ void Aura::UpdateOwner(uint32 diff, WorldObject * owner)
Update(diff, caster);
if (m_updateTargetMapInterval <= diff)
if (m_updateTargetMapInterval <= int32(diff))
UpdateTargetMap(caster);
else
m_updateTargetMapInterval -= diff;
@@ -631,7 +631,7 @@ void Aura::Update(uint32 diff, Unit * caster)
// handle manaPerSecond/manaPerSecondPerLevel
if (m_timeCla)
{
if (m_timeCla > diff)
if (m_timeCla > int32(diff))
m_timeCla -= diff;
else if (caster)
{
@@ -642,7 +642,7 @@ void Aura::Update(uint32 diff, Unit * caster)
Powers powertype = Powers(m_spellProto->powerType);
if (powertype == POWER_HEALTH)
{
if (caster->GetHealth() > manaPerSecond)
if (int32(caster->GetHealth()) > manaPerSecond)
caster->ModifyHealth(-manaPerSecond);
else
{
@@ -652,7 +652,7 @@ void Aura::Update(uint32 diff, Unit * caster)
}
else
{
if (caster->GetPower(powertype) >= manaPerSecond)
if (int32(caster->GetPower(powertype)) >= manaPerSecond)
caster->ModifyPower(powertype, -manaPerSecond);
else
{
@@ -730,7 +730,7 @@ bool Aura::ModStackAmount(int32 num)
// Modify stack but limit it
int32 stackAmount = m_stackAmount + num;
if (stackAmount > m_spellProto->StackAmount)
if (stackAmount > int32(m_spellProto->StackAmount))
stackAmount = m_spellProto->StackAmount;
else if (stackAmount <= 0) // Last aura from stack removed
{
+4 -4
View File
@@ -988,7 +988,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != pVictim)
{
SpellEntry const * auraSpell = sSpellStore.LookupEntry(sSpellMgr.GetFirstSpellInChain(m_spellInfo->Id));
if ((pVictim->getLevel() + 10) >= auraSpell->spellLevel)
if (uint32(pVictim->getLevel() + 10) >= auraSpell->spellLevel)
ihit->scaleAura = true;
}
return;
@@ -1009,7 +1009,7 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex)
if (m_auraScaleMask && target.effectMask == m_auraScaleMask && m_caster != pVictim)
{
SpellEntry const * auraSpell = sSpellStore.LookupEntry(sSpellMgr.GetFirstSpellInChain(m_spellInfo->Id));
if ((pVictim->getLevel() + 10) >= auraSpell->spellLevel)
if (uint32(pVictim->getLevel() + 10) >= auraSpell->spellLevel)
target.scaleAura = true;
}
@@ -5983,7 +5983,7 @@ SpellCastResult Spell::CheckPower()
// health as power used - need check health amount
if (m_spellInfo->powerType == POWER_HEALTH)
{
if (m_caster->GetHealth() <= m_powerCost)
if (int32(m_caster->GetHealth()) <= m_powerCost)
return SPELL_FAILED_CASTER_AURASTATE;
return SPELL_CAST_OK;
}
@@ -6004,7 +6004,7 @@ SpellCastResult Spell::CheckPower()
// Check power amount
Powers powerType = Powers(m_spellInfo->powerType);
if (m_caster->GetPower(powerType) < m_powerCost)
if (int32(m_caster->GetPower(powerType)) < m_powerCost)
return SPELL_FAILED_NO_POWER;
else
return SPELL_CAST_OK;
+11 -10
View File
@@ -552,7 +552,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if (AuraEffect * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0))
back_damage -= aurEff->GetAmount() * back_damage / 100;
if (back_damage < unitTarget->GetHealth())
if (back_damage < int32(unitTarget->GetHealth()))
m_caster->CastCustomSpell(m_caster, 32409, &back_damage, 0, 0, true);
}
// Mind Blast - applies Mind Trauma if:
@@ -1615,7 +1615,7 @@ void Spell::EffectDummy(uint32 i)
Unit::AttackerSet attackers = unitTarget->getAttackers();
// selected from list 3
for (int i = 0; i < std::min(size_t(3),attackers.size()); ++i)
for (uint32 i = 0; i < std::min(size_t(3), attackers.size()); ++i)
{
Unit::AttackerSet::iterator aItr = attackers.begin();
std::advance(aItr, rand() % attackers.size());
@@ -1968,7 +1968,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
if (!spell)
return;
for (int j=0; j < spell->StackAmount; ++j)
for (uint32 j = 0; j < spell->StackAmount; ++j)
m_caster->CastSpell(unitTarget, spell->Id, true);
return;
}
@@ -1980,7 +1980,7 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
if (!spell)
return;
for (int j=0; j < spell->StackAmount; ++j)
for (uint32 j = 0; j < spell->StackAmount; ++j)
m_caster->CastSpell(unitTarget, spell->Id, true);
return;
}
@@ -2421,14 +2421,14 @@ void Spell::EffectPowerBurn(uint32 i)
// burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn)
if (m_spellInfo->ManaCostPercentage)
{
uint32 maxdamage = m_caster->GetMaxPower(powertype) * damage * 2 / 100;
int32 maxdamage = m_caster->GetMaxPower(powertype) * damage * 2 / 100;
damage = unitTarget->GetMaxPower(powertype) * damage / 100;
if (damage > maxdamage) damage = maxdamage;
}
int32 curPower = int32(unitTarget->GetPower(powertype));
uint32 power = damage;
int32 power = damage;
// resilience reduce mana draining effect at spell crit damage reduction (added in 2.4)
if (powertype == POWER_MANA)
power -= unitTarget->GetSpellCritDamageReduction(power);
@@ -2632,10 +2632,11 @@ void Spell::EffectHealthLeech(uint32 i)
if (m_spellInfo->SpellFamilyFlags[0] & 0x80000)
new_damage = damage;
else
new_damage = int32(damage*multiplier);
new_damage = int32(damage * multiplier);
uint32 curHealth = unitTarget->GetHealth();
new_damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, new_damage);
if (curHealth < new_damage)
if (int32(curHealth) < new_damage)
new_damage = curHealth;
if (m_caster->isAlive())
@@ -3359,7 +3360,7 @@ void Spell::EffectSummonType(uint32 i)
{
float radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
int32 amount = damage > 0 ? damage : 1;
uint32 amount = damage > 0 ? damage : 1;
if (m_spellInfo->Id == 18662) // Curse of Doom
amount = 1;
@@ -7093,7 +7094,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *
//float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
float radius = 5.0f;
int32 amount = damage > 0 ? damage : 1;
uint32 amount = damage > 0 ? damage : 1;
int32 duration = GetSpellDuration(m_spellInfo);
switch (m_spellInfo->Id)
{