Core/DataStores: Convert SkillLineAbilityAcquireMethod to enum

Port From (https://github.com/TrinityCore/TrinityCore/commit/531afa6bcc485db7c115e5ab5d874bda2cbf642e)
This commit is contained in:
Hondacrx
2025-08-10 17:16:47 -04:00
parent 600b06856a
commit 5096795793
5 changed files with 33 additions and 13 deletions
+6 -4
View File
@@ -47,11 +47,13 @@ namespace Framework.Constants
RacialForThePurposeOfTemporaryRaceChange = 0x8000, RacialForThePurposeOfTemporaryRaceChange = 0x8000,
} }
public enum AbilityLearnType : int public enum SkillLineAbilityAcquireMethod : int
{ {
OnSkillValue = 1, // Spell state will update depending on skill value Learned = 0,
OnSkillLearn = 2, // Spell will be learned/removed together with entire skill AutomaticSkillRank = 1, // Spell state will update depending on skill value
RewardedFromQuest = 4 // Learned as quest reward, also re-learned if missing AutomaticCharLevel = 2, // Spell will be learned/removed together with entire skill
NeverLearned = 3,
LearnedOrAutomaticCharLevel = 4,
} }
[Flags] [Flags]
+1 -1
View File
@@ -107,7 +107,7 @@ namespace Game.DataStorage
public short MinSkillLineRank; public short MinSkillLineRank;
public int ClassMask; public int ClassMask;
public uint SupercedesSpell; public uint SupercedesSpell;
public AbilityLearnType AcquireMethod; public SkillLineAbilityAcquireMethod AcquireMethod;
public ushort TrivialSkillLineRankHigh; public ushort TrivialSkillLineRankHigh;
public ushort TrivialSkillLineRankLow; public ushort TrivialSkillLineRankLow;
public int Flags; public int Flags;
+1 -1
View File
@@ -125,7 +125,7 @@ namespace Game.Entities
var skills = Global.SpellMgr.GetSkillLineAbilityMapBounds(learned_0); var skills = Global.SpellMgr.GetSkillLineAbilityMapBounds(learned_0);
foreach (var skillLine in skills) foreach (var skillLine in skills)
{ {
if (skillLine.AcquireMethod == AbilityLearnType.RewardedFromQuest) if (skillLine.AcquireMethod == SkillLineAbilityAcquireMethod.LearnedOrAutomaticCharLevel)
{ {
found = true; found = true;
break; break;
+5 -5
View File
@@ -1660,10 +1660,10 @@ namespace Game.Entities
switch (ability.AcquireMethod) switch (ability.AcquireMethod)
{ {
case AbilityLearnType.OnSkillValue: case SkillLineAbilityAcquireMethod.AutomaticSkillRank:
case AbilityLearnType.OnSkillLearn: case SkillLineAbilityAcquireMethod.AutomaticCharLevel:
break; break;
case AbilityLearnType.RewardedFromQuest: case SkillLineAbilityAcquireMethod.LearnedOrAutomaticCharLevel:
if (!ability.HasFlag(SkillLineAbilityFlags.CanFallbackToLearnedOnSkillLearn) || if (!ability.HasFlag(SkillLineAbilityFlags.CanFallbackToLearnedOnSkillLearn) ||
!spellInfo.MeetsFutureSpellPlayerCondition(this)) !spellInfo.MeetsFutureSpellPlayerCondition(this))
continue; continue;
@@ -1687,7 +1687,7 @@ namespace Game.Entities
continue; continue;
// need unlearn spell // need unlearn spell
if (skillValue < ability.MinSkillLineRank && ability.AcquireMethod == AbilityLearnType.OnSkillValue) if (skillValue < ability.MinSkillLineRank && ability.AcquireMethod == SkillLineAbilityAcquireMethod.AutomaticSkillRank)
RemoveSpell(ability.Spell); RemoveSpell(ability.Spell);
// need learn // need learn
else if (!IsInWorld) else if (!IsInWorld)
@@ -2847,7 +2847,7 @@ namespace Game.Entities
continue; continue;
// Runeforging special case // Runeforging special case
if ((_spell_idx.AcquireMethod == AbilityLearnType.OnSkillLearn && !HasSkill((SkillType)_spell_idx.SkillLine)) if ((_spell_idx.AcquireMethod == SkillLineAbilityAcquireMethod.AutomaticCharLevel && !HasSkill((SkillType)_spell_idx.SkillLine))
|| ((_spell_idx.SkillLine == (int)SkillType.Runeforging) && _spell_idx.TrivialSkillLineRankHigh == 0)) || ((_spell_idx.SkillLine == (int)SkillType.Runeforging) && _spell_idx.TrivialSkillLineRankHigh == 0))
{ {
SkillRaceClassInfoRecord rcInfo = Global.DB2Mgr.GetSkillRaceClassInfo(_spell_idx.SkillLine, GetRace(), GetClass()); SkillRaceClassInfoRecord rcInfo = Global.DB2Mgr.GetSkillRaceClassInfo(_spell_idx.SkillLine, GetRace(), GetClass());
+20 -2
View File
@@ -1860,7 +1860,7 @@ namespace Game.Entities
foreach (var skillLine in skillLineAbilities) foreach (var skillLine in skillLineAbilities)
{ {
if (skillLine.AcquireMethod != AbilityLearnType.OnSkillLearn) if (skillLine.AcquireMethod != SkillLineAbilityAcquireMethod.AutomaticCharLevel)
continue; continue;
SpellInfo spell = GetSpellInfo(skillLine.Spell, Difficulty.None); SpellInfo spell = GetSpellInfo(skillLine.Spell, Difficulty.None);
@@ -4650,6 +4650,24 @@ namespace Game.Entities
spellInfo._LoadSqrtTargetLimit(5, 0, null, 1, null, null); spellInfo._LoadSqrtTargetLimit(5, 0, null, 1, null, null);
}); });
// Ice Nova
ApplySpellFix([157997], spellInfo =>
{
spellInfo._LoadSqrtTargetLimit(8, 0, null, 2, null, null);
});
// Raze
ApplySpellFix([400254], spellInfo =>
{
spellInfo._LoadSqrtTargetLimit(5, 0, null, 2, null, null);
});
// Explosive Shot
ApplySpellFix([212680], spellInfo =>
{
spellInfo._LoadSqrtTargetLimit(5, 0, 212431, 1, null, null);
});
Log.outInfo(LogFilter.ServerLoading, $"Loaded SpellInfo target caps in {Time.GetMSTimeDiffToNow(oldMSTime)} ms"); Log.outInfo(LogFilter.ServerLoading, $"Loaded SpellInfo target caps in {Time.GetMSTimeDiffToNow(oldMSTime)} ms");
} }
@@ -4677,7 +4695,7 @@ namespace Game.Entities
if (skillLine.SkillLine != cFamily.SkillLine[0] && skillLine.SkillLine != cFamily.SkillLine[1]) if (skillLine.SkillLine != cFamily.SkillLine[0] && skillLine.SkillLine != cFamily.SkillLine[1])
continue; continue;
if (skillLine.AcquireMethod != AbilityLearnType.OnSkillLearn) if (skillLine.AcquireMethod != SkillLineAbilityAcquireMethod.AutomaticCharLevel)
continue; continue;
Global.SpellMgr.PetFamilySpellsStorage.Add(cFamily.Id, spellInfo.Id); Global.SpellMgr.PetFamilySpellsStorage.Add(cFamily.Id, spellInfo.Id);