fix(Core/AI): validate stored targets (#12489)

Co-authored-by: Meji <meji46@users.noreply.github.com>
Co-authored-by: Ariel Silva <ariel-@users.noreply.github.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>

Co-authored-by: Meji <meji46@users.noreply.github.com>
Co-authored-by: Ariel Silva <ariel-@users.noreply.github.com>
Co-authored-by: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
Nefertumm
2022-07-24 13:06:11 -03:00
committed by GitHub
parent 5bcc54a617
commit f0777d1fd3
4 changed files with 98 additions and 23 deletions

View File

@@ -297,7 +297,7 @@ void SmartAI::EndPath(bool fail)
mEscortNPCFlags = 0;
}
ObjectVector const* targets = GetScript()->GetStoredTargetVector(SMART_ESCORT_TARGETS);
ObjectVector const* targets = GetScript()->GetStoredTargetVector(SMART_ESCORT_TARGETS, *me);
if (targets && mEscortQuestID)
{
if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
@@ -535,7 +535,7 @@ void SmartAI::UpdateAI(uint32 diff)
bool SmartAI::IsEscortInvokerInRange()
{
if (ObjectVector const* targets = GetScript()->GetStoredTargetVector(SMART_ESCORT_TARGETS))
if (ObjectVector const* targets = GetScript()->GetStoredTargetVector(SMART_ESCORT_TARGETS, *me))
{
float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST * 2 : SMART_ESCORT_MAX_PLAYER_DIST;
if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))