fix(Core/GameObject): Check faction for quest activation (#27008)

Co-authored-by: sogladev <[email protected]>
This commit is contained in:
Thorsten42
2026-09-24 11:43:40 -03:00
committed by GitHub
co-authored by sogladev
parent 72ac3d9cf2
commit 7cc1e261c1
@@ -29,6 +29,7 @@
#include "ObjectMgr.h"
#include "OutdoorPvPMgr.h"
#include "PoolMgr.h"
#include "ReputationMgr.h"
#include "ScriptMgr.h"
#include "SpellMgr.h"
#include "Transport.h"
@@ -1316,6 +1317,21 @@ bool GameObject::ActivateToQuest(Player* target) const
if (!GetGOInfo()->IsGameObjectForQuests())
return false;
FactionTemplateEntry const* gameObjectFaction =
sFactionTemplateStore.LookupEntry(GetUInt32Value(GAMEOBJECT_FACTION));
FactionTemplateEntry const* playerFaction = target->GetFactionTemplateEntry();
if (gameObjectFaction && playerFaction &&
(gameObjectFaction->IsHostileToAlliancePlayers() || gameObjectFaction->IsHostileToHordePlayers()))
{
// Faction templates 101/102 have no ourMask, so check hostility from the gameobject to the player.
bool isHostile = gameObjectFaction->IsHostileTo(*playerFaction);
if (ReputationRank const* forcedRank = target->GetReputationMgr().GetForcedRankIfAny(gameObjectFaction))
isHostile = *forcedRank <= REP_HOSTILE;
if (isHostile)
return false;
}
switch (GetGoType())
{
case GAMEOBJECT_TYPE_QUESTGIVER: