Core/Players: Add player race argument to Player::LearnSkillRewardedSpells
Port From (https://github.com/TrinityCore/TrinityCore/commit/d1209a83889ce26e29edc1ac19717eb6012e3a1d)
This commit is contained in:
@@ -346,6 +346,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
void _LoadSkills(SQLResult result)
|
void _LoadSkills(SQLResult result)
|
||||||
{
|
{
|
||||||
|
Race race = GetRace();
|
||||||
uint count = 0;
|
uint count = 0;
|
||||||
Dictionary<uint, uint> loadedSkillValues = new();
|
Dictionary<uint, uint> loadedSkillValues = new();
|
||||||
if (!result.IsEmpty())
|
if (!result.IsEmpty())
|
||||||
@@ -362,11 +363,11 @@ namespace Game.Entities
|
|||||||
var value = result.Read<ushort>(1);
|
var value = result.Read<ushort>(1);
|
||||||
var max = result.Read<ushort>(2);
|
var max = result.Read<ushort>(2);
|
||||||
|
|
||||||
SkillRaceClassInfoRecord rcEntry = Global.DB2Mgr.GetSkillRaceClassInfo(skill, GetRace(), GetClass());
|
SkillRaceClassInfoRecord rcEntry = Global.DB2Mgr.GetSkillRaceClassInfo(skill, race, GetClass());
|
||||||
if (rcEntry == null)
|
if (rcEntry == null)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Player, "Character: {0}(GUID: {1} Race: {2} Class: {3}) has skill {4} not allowed for his race/class combination",
|
Log.outError(LogFilter.Player, "Character: {0}(GUID: {1} Race: {2} Class: {3}) has skill {4} not allowed for his race/class combination",
|
||||||
GetName(), GetGUID().ToString(), GetRace(), GetClass(), skill);
|
GetName(), GetGUID().ToString(), race, GetClass(), skill);
|
||||||
mSkillStatus.Add(skill, new SkillStatusData(0, SkillState.Deleted));
|
mSkillStatus.Add(skill, new SkillStatusData(0, SkillState.Deleted));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -428,7 +429,7 @@ namespace Game.Entities
|
|||||||
// Learn skill rewarded spells after all skills have been loaded to prevent learning a skill from them before its loaded with proper value from DB
|
// Learn skill rewarded spells after all skills have been loaded to prevent learning a skill from them before its loaded with proper value from DB
|
||||||
foreach (var skill in loadedSkillValues)
|
foreach (var skill in loadedSkillValues)
|
||||||
{
|
{
|
||||||
LearnSkillRewardedSpells(skill.Key, skill.Value);
|
LearnSkillRewardedSpells(skill.Key, skill.Value, race);
|
||||||
List<SkillLineRecord> childSkillLines = Global.DB2Mgr.GetSkillLinesForParentSkill(skill.Key);
|
List<SkillLineRecord> childSkillLines = Global.DB2Mgr.GetSkillLinesForParentSkill(skill.Key);
|
||||||
if (childSkillLines != null)
|
if (childSkillLines != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
void UpdateSkillsForLevel()
|
void UpdateSkillsForLevel()
|
||||||
{
|
{
|
||||||
|
Race race = GetRace();
|
||||||
ushort maxSkill = GetMaxSkillValueForLevel();
|
ushort maxSkill = GetMaxSkillValueForLevel();
|
||||||
SkillInfo skillInfoField = m_activePlayerData.Skill;
|
SkillInfo skillInfoField = m_activePlayerData.Skill;
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update level dependent skillline spells
|
// Update level dependent skillline spells
|
||||||
LearnSkillRewardedSpells(rcEntry.SkillID, skillInfoField.SkillRank[pair.Value.Pos]);
|
LearnSkillRewardedSpells(rcEntry.SkillID, skillInfoField.SkillRank[pair.Value.Pos], race);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +430,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
if (value < bsl && new_value >= bsl)
|
if (value < bsl && new_value >= bsl)
|
||||||
{
|
{
|
||||||
LearnSkillRewardedSpells(skillId, new_value);
|
LearnSkillRewardedSpells(skillId, new_value, GetRace());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1082,7 +1083,7 @@ namespace Game.Entities
|
|||||||
SetSkillRank(skillStatusData.Pos, (ushort)newVal);
|
SetSkillRank(skillStatusData.Pos, (ushort)newVal);
|
||||||
SetSkillMaxRank(skillStatusData.Pos, (ushort)maxVal);
|
SetSkillMaxRank(skillStatusData.Pos, (ushort)maxVal);
|
||||||
|
|
||||||
LearnSkillRewardedSpells(id, newVal);
|
LearnSkillRewardedSpells(id, newVal, GetRace());
|
||||||
// if skill value is going up, update enchantments after setting the new value
|
// if skill value is going up, update enchantments after setting the new value
|
||||||
if (newVal > currVal)
|
if (newVal > currVal)
|
||||||
{
|
{
|
||||||
@@ -1237,7 +1238,7 @@ namespace Game.Entities
|
|||||||
auraEffect.HandleEffect(this, AuraEffectHandleModes.Skill, true);
|
auraEffect.HandleEffect(this, AuraEffectHandleModes.Skill, true);
|
||||||
|
|
||||||
// Learn all spells for skill
|
// Learn all spells for skill
|
||||||
LearnSkillRewardedSpells(id, newVal);
|
LearnSkillRewardedSpells(id, newVal, GetRace());
|
||||||
UpdateCriteria(CriteriaType.SkillRaised, id);
|
UpdateCriteria(CriteriaType.SkillRaised, id);
|
||||||
UpdateCriteria(CriteriaType.AchieveSkillStep, id);
|
UpdateCriteria(CriteriaType.AchieveSkillStep, id);
|
||||||
}
|
}
|
||||||
@@ -1560,9 +1561,9 @@ namespace Game.Entities
|
|||||||
public uint GetLastPotionId() { return m_lastPotionId; }
|
public uint GetLastPotionId() { return m_lastPotionId; }
|
||||||
public void SetLastPotionId(uint item_id) { m_lastPotionId = item_id; }
|
public void SetLastPotionId(uint item_id) { m_lastPotionId = item_id; }
|
||||||
|
|
||||||
void LearnSkillRewardedSpells(uint skillId, uint skillValue)
|
void LearnSkillRewardedSpells(uint skillId, uint skillValue, Race race)
|
||||||
{
|
{
|
||||||
long raceMask = SharedConst.GetMaskForRace(GetRace());
|
long raceMask = SharedConst.GetMaskForRace(race);
|
||||||
uint classMask = GetClassMask();
|
uint classMask = GetClassMask();
|
||||||
|
|
||||||
List<SkillLineAbilityRecord> skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId);
|
List<SkillLineAbilityRecord> skillLineAbilities = Global.DB2Mgr.GetSkillLineAbilitiesBySkill(skillId);
|
||||||
|
|||||||
Reference in New Issue
Block a user