fix(Core/SmartScripts): Implemented new target type: SMART_TARGET_SUM… (#13880)

* fix(Core/SmartScripts): Implemented new target type: SMART_TARGET_SUMMONED_CREATURES.

Fixes #13787

* Update.

* Update.
This commit is contained in:
UltraNix
2022-12-06 13:41:05 +01:00
committed by GitHub
parent ac65434f3f
commit 95652e14d5
6 changed files with 56 additions and 1 deletions

View File

@@ -3334,6 +3334,24 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
}
}
}
break;
}
case SMART_TARGET_SUMMONED_CREATURES:
{
if (me)
{
for (ObjectGuid const& guid : _summonList)
{
if (!e.target.summonedCreatures.entry || guid.GetEntry() == e.target.summonedCreatures.entry)
{
if (Creature* creature = me->GetMap()->GetCreature(guid))
{
targets.push_back(creature);
}
}
}
}
break;
}
case SMART_TARGET_NONE:
case SMART_TARGET_POSITION:
@@ -4560,3 +4578,13 @@ bool SmartScript::IsInPhase(uint32 p) const
return ((1 << (mEventPhase - 1)) & p) != 0;
}
void SmartScript::AddCreatureSummon(ObjectGuid const& guid)
{
_summonList.insert(guid);
}
void SmartScript::RemoveCreatureSummon(ObjectGuid const& guid)
{
_summonList.erase(guid);
}