diff options
| author | jackpoz <giacomopoz@gmail.com> | 2021-04-10 21:14:36 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2021-04-10 21:14:36 +0200 |
| commit | 11d9a4e2518a7deef59086bdfad6803285b45724 (patch) | |
| tree | 6290c6f41c1f0b80cdd15f7248086a18fea70915 /src | |
| parent | 8354a5fe5491366b5350786702eb41ceda87d549 (diff) | |
Core/PlayerStats: Fix PlayerSave.Stats.MinLevel not saving spell crit percentage
Fix PlayerSave.Stats.MinLevel always saving 0.0f in spellCritPct database field of table character_stats. As there is a percentage for each school but the table has only 1 column, the max value will be saved.
Fix #15928
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 1264f1128e7..f166bbdf985 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -20268,7 +20268,13 @@ void Player::_SaveStats(CharacterDatabaseTransaction trans) const stmt->setFloat(index++, GetFloatValue(PLAYER_PARRY_PERCENTAGE)); stmt->setFloat(index++, GetFloatValue(PLAYER_CRIT_PERCENTAGE)); stmt->setFloat(index++, GetFloatValue(PLAYER_RANGED_CRIT_PERCENTAGE)); - stmt->setFloat(index++, GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1)); + + // Store the max spell scrit percentage out of all the possible schools + float spellCrit = 0.0f; + for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) + spellCrit = std::max(spellCrit, GetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + i)); + stmt->setFloat(index++, spellCrit); + stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_ATTACK_POWER)); stmt->setUInt32(index++, GetUInt32Value(UNIT_FIELD_RANGED_ATTACK_POWER)); stmt->setUInt32(index++, GetBaseSpellPowerBonus()); |
