Core/Players: Fixed learning riding spells

Port From (https://github.com/TrinityCore/TrinityCore/commit/ae1dd8caf009b394cfc77592fdeff74809ab170b)
This commit is contained in:
hondacrx
2024-01-29 15:33:16 -05:00
parent 65048a8357
commit eddd539cfe
3 changed files with 16 additions and 8 deletions
@@ -60,6 +60,8 @@ namespace Framework.Constants
public const uint WarmodeEnlistedSpellOutside = 269083;
public const uint SpellExperienceEliminated = 206662;
public const uint SpellApprenticeRiding = 33389;
public const uint SpellJourneymanRiding = 33391;
public const uint CurrencyMaxCapAncientMana = 2000;
+12 -6
View File
@@ -1654,10 +1654,6 @@ namespace Game.Entities
continue;
}
// AcquireMethod == 2 && NumSkillUps == 1 -. automatically learn riding skill spell, else we skip it (client shows riding in spellbook as trainable).
if (skillId == (uint)SkillType.Riding && (ability.AcquireMethod != AbilityLearnType.OnSkillLearn || ability.NumSkillUps != 1))
continue;
// Check race if set
var raceMask = new RaceMask<long>(ability.RaceMask);
if (!raceMask.IsEmpty() && !raceMask.HasRace(race))
@@ -1667,8 +1663,18 @@ namespace Game.Entities
if (ability.ClassMask != 0 && !Convert.ToBoolean(ability.ClassMask & classMask))
continue;
// check level, skip class spells if not high enough
if (GetLevel() < spellInfo.SpellLevel)
// Check level, skip class spells if not high enough
uint requiredLevel = Math.Max(spellInfo.SpellLevel, spellInfo.BaseLevel);
// riding special cases
if (skillId == (uint)SkillType.Riding)
{
if ((GetClassMask() & ((1 << ((int)Class.Deathknight - 1)) | (1 << ((int)Class.DemonHunter - 1)))) != 0
&& (ability.Spell == PlayerConst.SpellApprenticeRiding || ability.Spell == PlayerConst.SpellJourneymanRiding))
requiredLevel = 0;
}
if (requiredLevel > GetLevel())
continue;
// need unlearn spell
+2 -2
View File
@@ -6083,11 +6083,11 @@ namespace Game
var raceMask = new RaceMask<long>(rcInfo.RaceMask);
for (Race raceIndex = Race.Human; raceIndex < Race.Max; ++raceIndex)
{
if (raceMask.HasRace(raceIndex))
if (raceMask.IsEmpty() || raceMask.HasRace(raceIndex))
{
for (Class classIndex = Class.Warrior; classIndex < Class.Max; ++classIndex)
{
if (rcInfo.ClassMask == -1 || Convert.ToBoolean((1 << ((int)classIndex - 1)) & rcInfo.ClassMask))
if (rcInfo.ClassMask == -1 || rcInfo.ClassMask == 0 || Convert.ToBoolean((1 << ((int)classIndex - 1)) & rcInfo.ClassMask))
{
PlayerInfo info = _playerInfo.LookupByKey(Tuple.Create(raceIndex, classIndex));
if (info != null)