[9397] Fixed unexpected rounding in healamount = healamount * int32(TakenTotalMod);

This commit is contained in:
VladimirMangos 2010-02-16 00:24:28 +03:00
parent 9e4829ecef
commit f9db93e78b
7 changed files with 41 additions and 40 deletions

View file

@ -8447,7 +8447,7 @@ uint32 ObjectMgr::GetScriptId(const char *name)
ScriptNameMap::const_iterator itr = ScriptNameMap::const_iterator itr =
std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name); std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name);
if(itr == m_scriptNames.end() || *itr != name) return 0; if(itr == m_scriptNames.end() || *itr != name) return 0;
return itr - m_scriptNames.begin(); return uint32(itr - m_scriptNames.begin());
} }
void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids) void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids)

View file

@ -259,7 +259,7 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
m_charmInfo->LoadPetActionBar(fields[13].GetCppString()); m_charmInfo->LoadPetActionBar(fields[13].GetCppString());
// since last save (in seconds) // since last save (in seconds)
uint32 timediff = uint32(time(NULL) - fields[14].GetUInt32()); uint32 timediff = uint32(time(NULL) - fields[14].GetUInt64());
m_resetTalentsCost = fields[15].GetUInt32(); m_resetTalentsCost = fields[15].GetUInt32();
m_resetTalentsTime = fields[16].GetUInt64(); m_resetTalentsTime = fields[16].GetUInt64();

View file

@ -12038,27 +12038,27 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
case ITEM_MOD_AGILITY: case ITEM_MOD_AGILITY:
sLog.outDebug("+ %u AGILITY",enchant_amount); sLog.outDebug("+ %u AGILITY",enchant_amount);
HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply); HandleStatModifier(UNIT_MOD_STAT_AGILITY, TOTAL_VALUE, float(enchant_amount), apply);
ApplyStatBuffMod(STAT_AGILITY, enchant_amount, apply); ApplyStatBuffMod(STAT_AGILITY, float(enchant_amount), apply);
break; break;
case ITEM_MOD_STRENGTH: case ITEM_MOD_STRENGTH:
sLog.outDebug("+ %u STRENGTH",enchant_amount); sLog.outDebug("+ %u STRENGTH",enchant_amount);
HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply); HandleStatModifier(UNIT_MOD_STAT_STRENGTH, TOTAL_VALUE, float(enchant_amount), apply);
ApplyStatBuffMod(STAT_STRENGTH, enchant_amount, apply); ApplyStatBuffMod(STAT_STRENGTH, float(enchant_amount), apply);
break; break;
case ITEM_MOD_INTELLECT: case ITEM_MOD_INTELLECT:
sLog.outDebug("+ %u INTELLECT",enchant_amount); sLog.outDebug("+ %u INTELLECT",enchant_amount);
HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply); HandleStatModifier(UNIT_MOD_STAT_INTELLECT, TOTAL_VALUE, float(enchant_amount), apply);
ApplyStatBuffMod(STAT_INTELLECT, enchant_amount, apply); ApplyStatBuffMod(STAT_INTELLECT, float(enchant_amount), apply);
break; break;
case ITEM_MOD_SPIRIT: case ITEM_MOD_SPIRIT:
sLog.outDebug("+ %u SPIRIT",enchant_amount); sLog.outDebug("+ %u SPIRIT",enchant_amount);
HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply); HandleStatModifier(UNIT_MOD_STAT_SPIRIT, TOTAL_VALUE, float(enchant_amount), apply);
ApplyStatBuffMod(STAT_SPIRIT, enchant_amount, apply); ApplyStatBuffMod(STAT_SPIRIT, float(enchant_amount), apply);
break; break;
case ITEM_MOD_STAMINA: case ITEM_MOD_STAMINA:
sLog.outDebug("+ %u STAMINA",enchant_amount); sLog.outDebug("+ %u STAMINA",enchant_amount);
HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply); HandleStatModifier(UNIT_MOD_STAT_STAMINA, TOTAL_VALUE, float(enchant_amount), apply);
ApplyStatBuffMod(STAT_STAMINA, enchant_amount, apply); ApplyStatBuffMod(STAT_STAMINA, float(enchant_amount), apply);
break; break;
case ITEM_MOD_DEFENSE_SKILL_RATING: case ITEM_MOD_DEFENSE_SKILL_RATING:
((Player*)this)->ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply); ((Player*)this)->ApplyRatingMod(CR_DEFENSE_SKILL, enchant_amount, apply);

View file

@ -3506,7 +3506,7 @@ void Aura::HandleAuraTrackStealthed(bool apply, bool /*Real*/)
void Aura::HandleAuraModScale(bool apply, bool /*Real*/) void Aura::HandleAuraModScale(bool apply, bool /*Real*/)
{ {
m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X, m_modifier.m_amount, apply); m_target->ApplyPercentModFloatValue(OBJECT_FIELD_SCALE_X, float(m_modifier.m_amount), apply);
} }
void Aura::HandleModPossess(bool apply, bool Real) void Aura::HandleModPossess(bool apply, bool Real)
@ -4221,7 +4221,7 @@ void Aura::HandleModThreat(bool apply, bool Real)
if (m_target->GetTypeId() == TYPEID_PLAYER) if (m_target->GetTypeId() == TYPEID_PLAYER)
for(int8 x=0;x < MAX_SPELL_SCHOOL;x++) for(int8 x=0;x < MAX_SPELL_SCHOOL;x++)
if (m_modifier.m_miscvalue & int32(1<<x)) if (m_modifier.m_miscvalue & int32(1<<x))
ApplyPercentModFloatVar(m_target->m_threatModifier[x], m_modifier.m_amount, apply); ApplyPercentModFloatVar(m_target->m_threatModifier[x], float(m_modifier.m_amount), apply);
} }
void Aura::HandleAuraModTotalThreat(bool apply, bool Real) void Aura::HandleAuraModTotalThreat(bool apply, bool Real)
@ -4888,7 +4888,7 @@ void Aura::HandleAuraModResistanceExclusive(bool apply, bool /*Real*/)
{ {
m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), BASE_VALUE, float(m_modifier.m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER) if(m_target->GetTypeId() == TYPEID_PLAYER)
m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, m_modifier.m_amount, apply); m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply);
} }
} }
} }
@ -4901,7 +4901,7 @@ void Aura::HandleAuraModResistance(bool apply, bool /*Real*/)
{ {
m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + x), TOTAL_VALUE, float(m_modifier.m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet())
m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, m_modifier.m_amount, apply); m_target->ApplyResistanceBuffModsMod(SpellSchools(x), m_positive, float(m_modifier.m_amount), apply);
} }
} }
} }
@ -4934,8 +4934,8 @@ void Aura::HandleModResistancePercent(bool apply, bool /*Real*/)
m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet())
{ {
m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, m_modifier.m_amount, apply); m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), true, float(m_modifier.m_amount), apply);
m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, m_modifier.m_amount, apply); m_target->ApplyResistanceBuffModsPercentMod(SpellSchools(i), false, float(m_modifier.m_amount), apply);
} }
} }
} }
@ -4978,7 +4978,7 @@ void Aura::HandleAuraModStat(bool apply, bool /*Real*/)
//m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply); //m_target->ApplyStatMod(Stats(i), m_modifier.m_amount,apply);
m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet())
m_target->ApplyStatBuffMod(Stats(i), m_modifier.m_amount, apply); m_target->ApplyStatBuffMod(Stats(i), float(m_modifier.m_amount), apply);
} }
} }
} }
@ -5078,7 +5078,7 @@ void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/)
{ {
m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UnitMods(UNIT_MOD_STAT_START + i), TOTAL_PCT, float(m_modifier.m_amount), apply);
if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet()) if(m_target->GetTypeId() == TYPEID_PLAYER || ((Creature*)m_target)->isPet())
m_target->ApplyStatPercentBuffMod(Stats(i), m_modifier.m_amount, apply ); m_target->ApplyStatPercentBuffMod(Stats(i), float(m_modifier.m_amount), apply );
} }
} }
@ -5430,22 +5430,22 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real)
void Aura::HandleModCastingSpeed(bool apply, bool /*Real*/) void Aura::HandleModCastingSpeed(bool apply, bool /*Real*/)
{ {
m_target->ApplyCastTimePercentMod(m_modifier.m_amount,apply); m_target->ApplyCastTimePercentMod(float(m_modifier.m_amount),apply);
} }
void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool /*Real*/) void Aura::HandleModMeleeRangedSpeedPct(bool apply, bool /*Real*/)
{ {
m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply);
m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply);
m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply);
} }
void Aura::HandleModCombatSpeedPct(bool apply, bool /*Real*/) void Aura::HandleModCombatSpeedPct(bool apply, bool /*Real*/)
{ {
m_target->ApplyCastTimePercentMod(m_modifier.m_amount, apply); m_target->ApplyCastTimePercentMod(float(m_modifier.m_amount), apply);
m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply);
m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply);
m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply);
} }
void Aura::HandleModAttackSpeed(bool apply, bool /*Real*/) void Aura::HandleModAttackSpeed(bool apply, bool /*Real*/)
@ -5453,26 +5453,26 @@ void Aura::HandleModAttackSpeed(bool apply, bool /*Real*/)
if(!m_target->isAlive() ) if(!m_target->isAlive() )
return; return;
m_target->ApplyAttackTimePercentMod(BASE_ATTACK,m_modifier.m_amount,apply); m_target->ApplyAttackTimePercentMod(BASE_ATTACK,float(m_modifier.m_amount),apply);
} }
void Aura::HandleHaste(bool apply, bool /*Real*/) void Aura::HandleHaste(bool apply, bool /*Real*/)
{ {
m_target->ApplyAttackTimePercentMod(BASE_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(BASE_ATTACK, float(m_modifier.m_amount), apply);
m_target->ApplyAttackTimePercentMod(OFF_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(OFF_ATTACK, float(m_modifier.m_amount), apply);
m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply);
} }
void Aura::HandleAuraModRangedHaste(bool apply, bool /*Real*/) void Aura::HandleAuraModRangedHaste(bool apply, bool /*Real*/)
{ {
m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply);
} }
void Aura::HandleRangedAmmoHaste(bool apply, bool /*Real*/) void Aura::HandleRangedAmmoHaste(bool apply, bool /*Real*/)
{ {
if(m_target->GetTypeId() != TYPEID_PLAYER) if(m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
m_target->ApplyAttackTimePercentMod(RANGED_ATTACK,m_modifier.m_amount, apply); m_target->ApplyAttackTimePercentMod(RANGED_ATTACK, float(m_modifier.m_amount), apply);
} }
/********************************/ /********************************/

View file

@ -8996,8 +8996,8 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
if (Aura *dummy = pVictim->GetDummyAura(45182)) if (Aura *dummy = pVictim->GetDummyAura(45182))
{ {
float mod = -((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_SPELL)*2*4; float mod = -((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_SPELL)*2*4;
if (mod < dummy->GetModifier()->m_amount) if (mod < float(dummy->GetModifier()->m_amount))
mod = dummy->GetModifier()->m_amount; mod = float(dummy->GetModifier()->m_amount);
TakenTotalMod *= (mod+100.0f)/100.0f; TakenTotalMod *= (mod+100.0f)/100.0f;
} }
} }
@ -9182,7 +9182,7 @@ bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
crit_chance = GetFloatValue( PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask)); crit_chance = GetFloatValue( PLAYER_SPELL_CRIT_PERCENTAGE1 + GetFirstSchoolInMask(schoolMask));
else else
{ {
crit_chance = m_baseSpellCritChance; crit_chance = float(m_baseSpellCritChance);
crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask); crit_chance += GetTotalAuraModifierByMiscMask(SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL, schoolMask);
} }
// taken // taken
@ -9383,18 +9383,18 @@ int32 Unit::SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, int32
float TakenTotalMod = 1.0f; float TakenTotalMod = 1.0f;
// Healing taken percent // Healing taken percent
float minval = pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT); float minval = float(pVictim->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
if(minval) if(minval)
TakenTotalMod *= (100.0f + minval) / 100.0f; TakenTotalMod *= (100.0f + minval) / 100.0f;
float maxval = pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT); float maxval = float(pVictim->GetMaxPositiveAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
if(maxval) if(maxval)
TakenTotalMod *= (100.0f + maxval) / 100.0f; TakenTotalMod *= (100.0f + maxval) / 100.0f;
// No heal amount for this class spells // No heal amount for this class spells
if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE) if (spellProto->DmgClass == SPELL_DAMAGE_CLASS_NONE)
{ {
healamount = healamount * int32(TakenTotalMod); healamount = int32(healamount * TakenTotalMod);
return healamount < 0 ? 0 : healamount; return healamount < 0 ? 0 : healamount;
} }
@ -9912,8 +9912,8 @@ uint32 Unit::MeleeDamageBonus(Unit *pVictim, uint32 pdamage,WeaponAttackType att
continue; continue;
float mod = ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*(-8.0f); float mod = ((Player*)pVictim)->GetRatingBonusValue(CR_CRIT_TAKEN_MELEE)*(-8.0f);
if (mod < (*i)->GetModifier()->m_amount) if (mod < float((*i)->GetModifier()->m_amount))
mod = (*i)->GetModifier()->m_amount; mod = float((*i)->GetModifier()->m_amount);
TakenPercent *= (mod + 100.0f) / 100.0f; TakenPercent *= (mod + 100.0f) / 100.0f;
} }
@ -10084,7 +10084,8 @@ float Unit::GetWeaponProcChance() const
float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM) const float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM) const
{ {
// proc per minute chance calculation // proc per minute chance calculation
if (PPM <= 0.0f) return 0.0f; if (PPM <= 0.0f)
return 0.0f;
return WeaponSpeed * PPM / 600.0f; // result is chance in percents (probability = Speed_in_sec * (PPM / 60)) return WeaponSpeed * PPM / 600.0f; // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
} }

View file

@ -545,7 +545,7 @@ int WorldSocket::handle_input_missing_data (void)
recv_size); recv_size);
if (n <= 0) if (n <= 0)
return n; return (int)n;
message_block.wr_ptr (n); message_block.wr_ptr (n);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9396" #define REVISION_NR "9397"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__