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: