diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-04-18 23:58:18 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-04-18 23:58:18 +0200 |
commit | 531afa6bcc485db7c115e5ab5d874bda2cbf642e (patch) | |
tree | b3ee4a4e6d96fe6569f746dcd8a3032b75c01d90 | |
parent | a5108d262616e267f549b18eb72ab7245af6bece (diff) |
Core/DataStores: Convert SkillLineAbilityAcquireMethod to enum class
-rw-r--r-- | src/server/game/DataStores/DB2Structure.h | 1 | ||||
-rw-r--r-- | src/server/game/DataStores/DBCEnums.h | 10 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 14 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 4 |
4 files changed, 16 insertions, 13 deletions
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h index 387795998d9..4af8e10f860 100644 --- a/src/server/game/DataStores/DB2Structure.h +++ b/src/server/game/DataStores/DB2Structure.h @@ -3541,6 +3541,7 @@ struct SkillLineAbilityEntry int16 TradeSkillCategoryID; int16 SkillupSkillLineID; + SkillLineAbilityAcquireMethod GetAcquireMethod() const { return static_cast<SkillLineAbilityAcquireMethod>(AcquireMethod); } EnumFlag<SkillLineAbilityFlags> GetFlags() const { return static_cast<SkillLineAbilityFlags>(Flags); } }; diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index 054c4bbdebd..80f5389d5a4 100644 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -2057,11 +2057,13 @@ enum class SkillLineFlags : uint16 DEFINE_ENUM_FLAG(SkillLineFlags); -enum AbilytyLearnType +enum class SkillLineAbilityAcquireMethod : int32 { - SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE = 1, // Spell state will update depending on skill value - SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN = 2, // Spell will be learned/removed together with entire skill - SKILL_LINE_ABILITY_REWARDED_FROM_QUEST = 4 // Learned as quest reward, also re-learned if missing + Learned = 0, + AutomaticSkillRank = 1, // Spell state will update depending on skill value + AutomaticCharLevel = 2, // Spell will be learned/removed together with entire skill + NeverLearned = 3, + LearnedOrAutomaticCharLevel = 4, }; enum class SkillLineAbilityFlags diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index e3bfe6de90f..5e73bb3fb20 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -3115,7 +3115,7 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent continue; // Runeforging special case - if ((_spell_idx->second->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN && !HasSkill(_spell_idx->second->SkillLine)) || ((_spell_idx->second->SkillLine == SKILL_RUNEFORGING) && _spell_idx->second->TrivialSkillLineRankHigh == 0)) + if ((_spell_idx->second->GetAcquireMethod() == SkillLineAbilityAcquireMethod::AutomaticCharLevel && !HasSkill(_spell_idx->second->SkillLine)) || ((_spell_idx->second->SkillLine == SKILL_RUNEFORGING) && _spell_idx->second->TrivialSkillLineRankHigh == 0)) if (SkillRaceClassInfoEntry const* rcInfo = sDB2Manager.GetSkillRaceClassInfo(_spell_idx->second->SkillLine, GetRace(), GetClass())) LearnDefaultSkill(rcInfo); } @@ -25107,7 +25107,7 @@ void Player::LearnQuestRewardedSpells(Quest const* quest) SkillLineAbilityMapBounds skills = sSpellMgr->GetSkillLineAbilityMapBounds(learned_0); for (auto skillItr = skills.first; skillItr != skills.second; ++skillItr) { - if (skillItr->second->AcquireMethod == SKILL_LINE_ABILITY_REWARDED_FROM_QUEST) + if (skillItr->second->GetAcquireMethod() == SkillLineAbilityAcquireMethod::LearnedOrAutomaticCharLevel) { found = true; break; @@ -25147,12 +25147,12 @@ void Player::LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue, Races r if (!spellInfo) continue; - switch (ability->AcquireMethod) + switch (ability->GetAcquireMethod()) { - case SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE: - case SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN: + case SkillLineAbilityAcquireMethod::AutomaticSkillRank: + case SkillLineAbilityAcquireMethod::AutomaticCharLevel: break; - case SKILL_LINE_ABILITY_REWARDED_FROM_QUEST: + case SkillLineAbilityAcquireMethod::LearnedOrAutomaticCharLevel: if (!ability->GetFlags().HasFlag(SkillLineAbilityFlags::CanFallbackToLearnedOnSkillLearn) || !spellInfo->MeetsFutureSpellPlayerCondition(this)) continue; @@ -25175,7 +25175,7 @@ void Player::LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue, Races r continue; // need unlearn spell - if (int32(skillValue) < ability->MinSkillLineRank && ability->AcquireMethod == SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE) + if (int32(skillValue) < ability->MinSkillLineRank && ability->GetAcquireMethod() == SkillLineAbilityAcquireMethod::AutomaticSkillRank) RemoveSpell(ability->Spell); // need learn else if (!IsInWorld()) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 855b9d00194..d82e5f7b3c7 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2178,7 +2178,7 @@ void SpellMgr::LoadPetLevelupSpellMap() for (SkillLineAbilityEntry const* skillLine : *skillLineAbilities) { - if (skillLine->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN) + if (skillLine->GetAcquireMethod() != SkillLineAbilityAcquireMethod::AutomaticCharLevel) continue; SpellInfo const* spell = GetSpellInfo(skillLine->Spell, DIFFICULTY_NONE); @@ -5352,7 +5352,7 @@ void SpellMgr::LoadPetFamilySpellsStore() if (skillLine->SkillLine != cFamily->SkillLine[0] && skillLine->SkillLine != cFamily->SkillLine[1]) continue; - if (skillLine->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN) + if (skillLine->GetAcquireMethod() != SkillLineAbilityAcquireMethod::AutomaticCharLevel) continue; sPetFamilySpellsStore[cFamily->ID].insert(spellInfo->Id); |