mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 22:26:22 +00:00
fix(Core/Creatures): Implemented `SUMMON_PROP_FLAG_ONLY_VISIBLE_TO_SU… (#14054)
* fix(Core/Creatures): Implemented `SUMMON_PROP_FLAG_ONLY_VISIBLE_TO_SUMMONER` summon flag. Fixes #6674 * Update.
This commit is contained in:
@@ -1267,10 +1267,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
}
|
||||
case SMART_ACTION_SUMMON_CREATURE:
|
||||
{
|
||||
WorldObject* summoner = GetBaseObject() ? GetBaseObject() : unit;
|
||||
EnumFlag<SmartActionSummonCreatureFlags> flags(static_cast<SmartActionSummonCreatureFlags>(e.action.summonCreature.flags));
|
||||
bool preferUnit = flags.HasFlag(SmartActionSummonCreatureFlags::PreferUnit);
|
||||
WorldObject* summoner = preferUnit ? unit : Coalesce<WorldObject>(GetBaseObject(), unit);
|
||||
if (!summoner)
|
||||
break;
|
||||
|
||||
bool personalSpawn = flags.HasFlag(SmartActionSummonCreatureFlags::PersonalSpawn);
|
||||
|
||||
if (e.GetTargetType() == SMART_TARGET_RANDOM_POINT)
|
||||
{
|
||||
float range = (float)e.target.randomPoint.range;
|
||||
@@ -1282,7 +1286,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
randomPoint = me->GetRandomPoint(me->GetPosition(), range);
|
||||
else
|
||||
randomPoint = me->GetRandomPoint(srcPos, range);
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, randomPoint, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration))
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, randomPoint, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration, 0, nullptr, personalSpawn))
|
||||
{
|
||||
if (unit && e.action.summonCreature.attackInvoker)
|
||||
summon->AI()->AttackStart(unit);
|
||||
@@ -1301,7 +1305,7 @@ 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, e.action.summonCreature.duration))
|
||||
if (Creature* summon = summoner->SummonCreature(e.action.summonCreature.creature, x, y, z, o, (TempSummonType)e.action.summonCreature.type, e.action.summonCreature.duration, nullptr, personalSpawn))
|
||||
{
|
||||
if (e.action.summonCreature.attackInvoker == 2) // pussywizard: proper attackInvoker implementation
|
||||
summon->AI()->AttackStart(unit);
|
||||
|
||||
@@ -534,7 +534,7 @@ enum SMART_ACTION
|
||||
SMART_ACTION_ACTIVATE_GOBJECT = 9, //
|
||||
SMART_ACTION_RANDOM_EMOTE = 10, // EmoteId1, EmoteId2, EmoteId3...
|
||||
SMART_ACTION_CAST = 11, // SpellId, CastFlags, LimitTargets
|
||||
SMART_ACTION_SUMMON_CREATURE = 12, // CreatureID, summonType, duration in ms, attackInvoker, attackScriptOwner
|
||||
SMART_ACTION_SUMMON_CREATURE = 12, // CreatureID, summonType, duration in ms, attackInvoker, attackScriptOwner, flags(SmartActionSummonCreatureFlags)
|
||||
SMART_ACTION_THREAT_SINGLE_PCT = 13, // Threat%
|
||||
SMART_ACTION_THREAT_ALL_PCT = 14, // Threat%
|
||||
SMART_ACTION_CALL_AREAEXPLOREDOREVENTHAPPENS = 15, // QuestID
|
||||
@@ -696,6 +696,17 @@ enum SMART_ACTION
|
||||
SMART_ACTION_AC_END = 225, // placeholder
|
||||
};
|
||||
|
||||
enum class SmartActionSummonCreatureFlags
|
||||
{
|
||||
None = 0,
|
||||
PersonalSpawn = 1,
|
||||
PreferUnit = 2,
|
||||
|
||||
All = PersonalSpawn | PreferUnit
|
||||
};
|
||||
|
||||
DEFINE_ENUM_FLAG(SmartActionSummonCreatureFlags);
|
||||
|
||||
struct SmartAction
|
||||
{
|
||||
SMART_ACTION type;
|
||||
@@ -820,6 +831,7 @@ struct SmartAction
|
||||
uint32 duration;
|
||||
SAIBool attackInvoker;
|
||||
uint32 attackScriptOwner;
|
||||
uint32 flags; // SmartActionSummonCreatureFlags
|
||||
} summonCreature;
|
||||
|
||||
struct
|
||||
|
||||
Reference in New Issue
Block a user