Core/Spells: implement reputation requirements for spells (mostly used in guild spells such as Guild Page)

This commit is contained in:
Ovahlord committed 2023-08-13 11:48:20 +02:00
1 parent e936684e78
commit a57e27e6d3
3 files changed
+9

No files matched your search

+5
View File
@@ -5916,6 +5916,11 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
return SPELL_FAILED_REQUIRES_SPELL_FOCUS;
}
// check reputation
if (m_spellInfo->MinFactionId && m_spellInfo->MinReputation && m_caster->IsPlayer())
if (m_caster->ToPlayer()->GetReputationRank(m_spellInfo->MinFactionId) < static_cast<ReputationRank>(m_spellInfo->MinReputation))
return SPELL_FAILED_REPUTATION;
SpellCastResult castResult = SPELL_CAST_OK;
// always (except passive spells) check items (only player related checks)
+2
View File
@@ -967,6 +967,8 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntry const** effe
SpellCastingRequirementsEntry const* _castreq = GetSpellCastingRequirements();
RequiresSpellFocus = _castreq ? _castreq->RequiresSpellFocus : 0;
FacingCasterFlags = _castreq ? SpellFacingCasterFlags(_castreq->FacingCasterFlags) : SpellFacingCasterFlags::None;
MinFactionId = _castreq ? _castreq->MinFactionID : 0;
MinReputation = _castreq ? _castreq->MinReputation : 0;
AreaGroupId = _castreq ? _castreq->RequiredAreasID : -1;
// SpellCategoriesEntry
+2
View File
@@ -415,6 +415,8 @@ class TC_GAME_API SpellInfo
flag96 SpellFamilyFlags;
uint32 DmgClass;
uint32 PreventionType;
uint32 MinFactionId;
uint32 MinReputation;
int32 AreaGroupId;
uint32 SchoolMask;
uint32 SpellDifficultyId;