Core/Players: - Fixed auto learning class abilities that are rewarded from quests if starting Exile's Reach in case player chose not to start there (#26036)

This commit is contained in:
Matan Shukry
2021-02-10 00:06:45 +02:00
committed by GitHub
parent 9e9fb667ec
commit b4bdc4eea6
5 changed files with 37 additions and 2 deletions

View File

@@ -2717,6 +2717,8 @@ struct SkillLineAbilityEntry
int16 UniqueBit;
int16 TradeSkillCategoryID;
int16 SkillupSkillLineID;
EnumFlag<SkillLineAbilityFlags> GetFlags() const { return EnumFlag<SkillLineAbilityFlags>(static_cast<SkillLineAbilityFlags>(Flags)); }
};
struct SkillRaceClassInfoEntry

View File

@@ -1027,6 +1027,14 @@ enum AbilytyLearnType
SKILL_LINE_ABILITY_REWARDED_FROM_QUEST = 4 // Learned as quest reward, also re-learned if missing
};
enum class SkillLineAbilityFlags
{
CanFallbackToLearnedOnSkillLearn = 0x80, // The skill is rewarded from a quest if player started on exile's reach
};
DEFINE_ENUM_FLAG(SkillLineAbilityFlags);
enum GlyphSlotType
{
GLYPH_SLOT_MAJOR = 0,

View File

@@ -24801,8 +24801,19 @@ void Player::LearnSkillRewardedSpells(uint32 skillId, uint32 skillValue)
if (!spellInfo)
continue;
if (ability->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE && ability->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN)
continue;
switch (ability->AcquireMethod)
{
case SKILL_LINE_ABILITY_LEARNED_ON_SKILL_VALUE:
case SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN:
break;
case SKILL_LINE_ABILITY_REWARDED_FROM_QUEST:
if (!ability->GetFlags().HasFlag(SkillLineAbilityFlags::CanFallbackToLearnedOnSkillLearn) ||
!spellInfo->MeetsFutureSpellPlayerCondition(this))
continue;
break;
default:
continue;
}
// AcquireMethod == 2 && NumSkillUps == 1 --> automatically learn riding skill spell, else we skip it (client shows riding in spellbook as trainable).
if (skillId == SKILL_RIDING && (ability->AcquireMethod != SKILL_LINE_ABILITY_LEARNED_ON_SKILL_LEARN || ability->NumSkillUps != 1))

View File

@@ -1127,6 +1127,7 @@ SpellInfo::SpellInfo(SpellNameEntry const* spellName, ::Difficulty difficulty, S
IconFileDataId = _misc ? _misc->SpellIconFileDataID : 0;
ActiveIconFileDataId = _misc ? _misc->ActiveIconFileDataID : 0;
ContentTuningId = _misc ? _misc->ContentTuningID : 0;
ShowFutureSpellPlayerConditionID = _misc ? _misc->ShowFutureSpellPlayerConditionID : 0;
_visuals = std::move(visuals);
@@ -4532,3 +4533,12 @@ void SpellInfo::_UnloadImplicitTargetConditionLists()
}
}
}
bool SpellInfo::MeetsFutureSpellPlayerCondition(Player const* player) const
{
if (ShowFutureSpellPlayerConditionID == 0)
return false;
PlayerConditionEntry const* playerCondition = sPlayerConditionStore.LookupEntry(ShowFutureSpellPlayerConditionID);
return !playerCondition || ConditionMgr::IsPlayerMeetingCondition(player, playerCondition);
}

View File

@@ -509,6 +509,7 @@ class TC_GAME_API SpellInfo
uint32 IconFileDataId;
uint32 ActiveIconFileDataId;
uint32 ContentTuningId;
uint32 ShowFutureSpellPlayerConditionID;
LocalizedString const* SpellName;
float ConeAngle;
float Width;
@@ -686,6 +687,9 @@ class TC_GAME_API SpellInfo
uint32 GetAllowedMechanicMask() const;
// Player Condition
bool MeetsFutureSpellPlayerCondition(Player const* player) const;
private:
// loading helpers
void _InitializeExplicitTargetMask();