diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 28010b28e2f..bb7c3365d44 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -4925,7 +4925,36 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) { m_baseRatingValue[cr]+=(apply ? value : -value); - int32 amount = uint32(m_baseRatingValue[cr]); + // explicit affected values + switch (cr) + { + case CR_HASTE_MELEE: + { + float RatingChange = value / GetRatingCoefficient(cr); + ApplyAttackTimePercentMod(BASE_ATTACK,RatingChange,apply); + ApplyAttackTimePercentMod(OFF_ATTACK,RatingChange,apply); + break; + } + case CR_HASTE_RANGED: + { + float RatingChange = value / GetRatingCoefficient(cr); + ApplyAttackTimePercentMod(RANGED_ATTACK, RatingChange, apply); + break; + } + case CR_HASTE_SPELL: + { + float RatingChange = value / GetRatingCoefficient(cr); + ApplyCastTimePercentMod(RatingChange,apply); + break; + } + } + + UpdateRating(cr); +} + +void Player::UpdateRating(CombatRating cr) +{ + int32 amount = m_baseRatingValue[cr]; // Apply bonus from SPELL_AURA_MOD_RATING_FROM_STAT // stat used stored in miscValueB for this aura AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT); @@ -4936,9 +4965,6 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) amount = 0; SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount)); - float RatingCoeffecient = GetRatingCoefficient(cr); - float RatingChange = 0.0f; - bool affectStats = CanModifyStats(); switch (cr) @@ -4990,18 +5016,9 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) break; case CR_CRIT_TAKEN_SPELL: // Implemented in Unit::SpellCriticalBonus (only for chance to crit) break; - case CR_HASTE_MELEE: - RatingChange = value / RatingCoeffecient; - ApplyAttackTimePercentMod(BASE_ATTACK,RatingChange,apply); - ApplyAttackTimePercentMod(OFF_ATTACK,RatingChange,apply); - break; + case CR_HASTE_MELEE: // Implemented in Player::ApplyRatingMod case CR_HASTE_RANGED: - RatingChange = value / RatingCoeffecient; - ApplyAttackTimePercentMod(RANGED_ATTACK, RatingChange, apply); - break; case CR_HASTE_SPELL: - RatingChange = value / RatingCoeffecient; - ApplyCastTimePercentMod(RatingChange,apply); break; case CR_WEAPON_SKILL_MAINHAND: // Implemented in Unit::RollMeleeOutcomeAgainst case CR_WEAPON_SKILL_OFFHAND: @@ -5021,6 +5038,12 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply) } } +void Player::UpdateAllRatings() +{ + for(int cr = 0; cr < MAX_COMBAT_RATING; ++cr) + UpdateRating(CombatRating(cr)); +} + void Player::SetRegularAttackTime() { for(int i = 0; i < MAX_ATTACK; ++i) @@ -14900,8 +14923,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // cleanup aura list explicitly before skill load wher some spells can be applied RemoveAllAuras(); - _LoadSkills(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSKILLS)); - // make sure the unit is considered out of combat for proper loading ClearInCombat(); @@ -14917,10 +14938,13 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // reset stats before loading any modifiers InitStatsForLevel(); - InitTaxiNodesForLevel(); InitGlyphsForLevel(); + InitTaxiNodesForLevel(); InitRunes(); + // load skills after InitStatsForLevel because it triggering aura apply also + _LoadSkills(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSKILLS)); + // apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods() // Mail diff --git a/src/game/Player.h b/src/game/Player.h index 2bdb0c82a4d..44a3bcb9dfb 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1774,11 +1774,13 @@ class MANGOS_DLL_SPEC Player : public Unit void UpdateDamagePhysical(WeaponAttackType attType); void ApplySpellPowerBonus(int32 amount, bool apply); void UpdateSpellDamageAndHealingBonus(); + void ApplyRatingMod(CombatRating cr, int32 value, bool apply); + void UpdateRating(CombatRating cr); + void UpdateAllRatings(); void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, float& min_damage, float& max_damage); void UpdateDefenseBonusesMod(); - void ApplyRatingMod(CombatRating cr, int32 value, bool apply); float GetMeleeCritFromAgility(); float GetDodgeFromAgility(); float GetSpellCritFromIntellect(); diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index dac6bed077e..bc08d1909d0 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -128,6 +128,7 @@ bool Player::UpdateAllStats() for(int i = POWER_MANA; i < MAX_POWERS; ++i) UpdateMaxPower(Powers(i)); + UpdateAllRatings(); UpdateAllCritPercentages(); UpdateAllSpellCritChances(); UpdateDefenseBonusesMod(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 043a0a22a50..b4cb6d7119b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9143" + #define REVISION_NR "9144" #endif // __REVISION_NR_H__