aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/DataStores/DB2Structure.h2
-rw-r--r--src/server/game/DataStores/DBCEnums.h8
-rw-r--r--src/server/game/Entities/Player/Player.cpp15
-rw-r--r--src/server/game/Spells/SpellInfo.cpp10
-rw-r--r--src/server/game/Spells/SpellInfo.h4
5 files changed, 37 insertions, 2 deletions
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h
index 282f401f4c8..6a03d0d138c 100644
--- a/src/server/game/DataStores/DB2Structure.h
+++ b/src/server/game/DataStores/DB2Structure.h
@@ -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
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index 2fda4f5b3af..068a699fedb 100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -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,
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 07ea9207ede..1494f8615f3 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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))
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index c005bfab5bd..c58ae80fa1a 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -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);
+}
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index aa5c6400a3f..be0dda67508 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -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();