From 7cc1e261c123f997f5e12ed201feed9ac946b8da Mon Sep 17 00:00:00 2001 From: Thorsten42 Date: Thu, 24 Sep 2026 16:43:40 +0200 Subject: [PATCH] fix(Core/GameObject): Check faction for quest activation (#27008) Co-authored-by: sogladev --- .../game/Entities/GameObject/GameObject.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 5e09ded7da..931d2a5fde 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -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: