mirror of
https://gitcode.com/GitHub_Trending/az/azerothcore-wotlk.git
synced 2026-10-10 07:06:38 +08:00
fix(Core/GameObject): Check faction for quest activation (#27008)
Co-authored-by: sogladev <[email protected]>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user