mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 00:48:56 +01:00
Core/Players: Fix out of bound access (by MoltenDev)
This commit is contained in:
@@ -6174,6 +6174,7 @@ bool Player::UpdateFishingSkill()
|
||||
// bonus abilities in sSkillLineAbilityStore
|
||||
// Used only to avoid scan DBC at each skill grow
|
||||
static uint32 bonusSkillLevels[] = {75, 150, 225, 300, 375, 450};
|
||||
static const size_t bonusSkillLevelsSize = sizeof(bonusSkillLevels) / sizeof(uint32);
|
||||
|
||||
bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
|
||||
{
|
||||
@@ -6211,9 +6212,10 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step)
|
||||
SetUInt32Value(valueIndex, MAKE_SKILL_VALUE(new_value, MaxValue));
|
||||
if (itr->second.uState != SKILL_NEW)
|
||||
itr->second.uState = SKILL_CHANGED;
|
||||
for (uint32* bsl = &bonusSkillLevels[0]; *bsl; ++bsl)
|
||||
for (size_t i = 0; i < bonusSkillLevelsSize; ++i)
|
||||
{
|
||||
if ((SkillValue < *bsl && new_value >= *bsl))
|
||||
uint32 bsl = bonusSkillLevels[i];
|
||||
if (SkillValue < bsl && new_value >= bsl)
|
||||
{
|
||||
learnSkillRewardedSpells(SkillId, new_value);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user