mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/DataStores: Convert SkillLineAbilityAcquireMethod to enum class
This commit is contained in:
@@ -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); }
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user