mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-18 14:10:18 -04:00
Core/SAI: Allow SMART_ACTION_SUMMON_CREATURE to summon more than 1 creature
Add 6th parameter "count" to SMART_ACTION_SUMMON_CREATURE action to summon more than 1 creature. For backward compatibility, a value of 0 will be treated as 1.
(cherry picked from commit 5628ca7f7c)
This commit is contained in:
@@ -1291,6 +1291,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
ObjectGuid privateObjectOwner;
|
||||
if (flags.HasFlag(SmartActionSummonCreatureFlags::PersonalSpawn))
|
||||
privateObjectOwner = summoner->IsPrivateObject() ? summoner->GetPrivateObjectOwner() : summoner->GetGUID();
|
||||
uint32 spawnsCount = std::max(e.action.summonCreature.count, 1u);
|
||||
|
||||
float x, y, z, o;
|
||||
for (WorldObject* target : targets)
|
||||
@@ -1300,17 +1301,23 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
y += e.target.y;
|
||||
z += e.target.z;
|
||||
o += e.target.o;
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, Milliseconds(e.action.summonCreature.duration), privateObjectOwner))
|
||||
if (e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(target->ToUnit());
|
||||
for (uint32 counter = 0; counter < spawnsCount; counter++)
|
||||
{
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, Milliseconds(e.action.summonCreature.duration), privateObjectOwner))
|
||||
if (e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(target->ToUnit());
|
||||
}
|
||||
}
|
||||
|
||||
if (e.GetTargetType() != SMART_TARGET_POSITION)
|
||||
break;
|
||||
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, e.target.x, e.target.y, e.target.z, e.target.o, (TempSummonType)e.action.summonCreature.type, Milliseconds(e.action.summonCreature.duration), privateObjectOwner))
|
||||
if (unit && e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(unit);
|
||||
for (uint32 counter = 0; counter < spawnsCount; counter++)
|
||||
{
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, e.target.x, e.target.y, e.target.z, e.target.o, (TempSummonType)e.action.summonCreature.type, Milliseconds(e.action.summonCreature.duration), privateObjectOwner))
|
||||
if (unit && e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(unit);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SUMMON_GO:
|
||||
|
||||
Reference in New Issue
Block a user