diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-04-18 23:58:18 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2025-05-11 11:39:34 +0200 |
commit | de2d7a8bfd53784e967b1d8f9436a09b26ca4b45 (patch) | |
tree | f9910a7e081c33bb0030b4a5ed2f94c8247fdf1e /src | |
parent | 75ec470530be77b2cd9832a8b255fcb9768c5f9b (diff) |
Core/DataStores: Convert SkillLineAbilityAcquireMethod to enum class
(cherry picked from commit 531afa6bcc485db7c115e5ab5d874bda2cbf642e)
Diffstat (limited to 'src')
-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 56d713c1a68..5090201adf7 100644 --- a/src/server/game/DataStores/DB2Structure.h +++ b/src/server/game/DataStores/DB2Structure.h @@ -3068,6 +3068,7 @@ struct SkillLineAbilityEntry int16 SkillupSkillLineID; std::array<int32, 2> CharacterPoints; + 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 4121681e77b..fdd3562ef53 100644 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -1820,11 +1820,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 d117f3739e7..07119b7fabd 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2759,7 +2759,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); } @@ -23728,7 +23728,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; @@ -23768,12 +23768,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; @@ -23805,7 +23805,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 08c66eeffee..93bb74ce7fe 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2302,7 +2302,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); @@ -4950,7 +4950,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); |