fix(Core/SAI): Exclude GMs for player target/event (#22345)

This commit is contained in:
Kitzunu
2025-06-23 02:47:32 +02:00
committed by GitHub
parent 94f941731e
commit 8200f3729e

View File

@@ -3707,10 +3707,12 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
if (!units.empty() && baseObject)
for (WorldObject* unit : units)
if (IsPlayer(unit) && baseObject->IsInRange(unit, float(e.target.playerRange.minDist), float(e.target.playerRange.maxDist)))
if (IsPlayer(unit) && !unit->ToPlayer()->IsGameMaster() && baseObject->IsInRange(unit, float(e.target.playerRange.minDist), float(e.target.playerRange.maxDist)))
targets.push_back(unit);
if (e.target.playerRange.maxCount)
Acore::Containers::RandomResize(targets, e.target.playerRange.maxCount);
break;
}
case SMART_TARGET_PLAYER_DISTANCE:
@@ -4664,10 +4666,9 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
if (!targets.empty())
{
for (WorldObject* target : targets)
{
if (IsPlayer(target))
if (IsPlayer(target) && !target->ToPlayer()->IsGameMaster())
playerCount++;
}
if (playerCount >= e.event.nearPlayer.minCount)
ProcessAction(e, unit);
}
@@ -4683,10 +4684,8 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui
if (!targets.empty())
{
for (WorldObject* target : targets)
{
if (IsPlayer(target))
if (IsPlayer(target) && !target->ToPlayer()->IsGameMaster())
playerCount++;
}
if (playerCount < e.event.nearPlayerNegation.maxCount)
ProcessAction(e, unit);