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:
@@ -0,0 +1,6 @@
|
|||||||
|
--
|
||||||
|
DELETE FROM `smart_scripts` WHERE `entryorguid` IN (18498,18499,18500,18501,18503) AND `source_type`=0 AND `event_type` IN (1, 7);
|
||||||
|
|
||||||
|
DELETE FROM `smart_scripts` WHERE `entryorguid`=18497 AND `source_type`=0 AND `id`=6;
|
||||||
|
INSERT INTO `smart_scripts` VALUES
|
||||||
|
(18497,0,6,0,7,0,100,0,0,0,0,0,0,41,0,0,0,0,0,0,204,0,0,0,0,0,0,0,0,'Auchenai Monk - On Evade - Despawn all summons');
|
||||||
@@ -810,6 +810,7 @@ void SmartAI::KilledUnit(Unit* victim)
|
|||||||
void SmartAI::JustSummoned(Creature* creature)
|
void SmartAI::JustSummoned(Creature* creature)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_SUMMONED_UNIT, creature);
|
GetScript()->ProcessEventsFor(SMART_EVENT_SUMMONED_UNIT, creature);
|
||||||
|
GetScript()->AddCreatureSummon(creature->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::SummonedCreatureDies(Creature* summon, Unit* /*killer*/)
|
void SmartAI::SummonedCreatureDies(Creature* summon, Unit* /*killer*/)
|
||||||
@@ -890,6 +891,7 @@ void SmartAI::DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType /*damag
|
|||||||
void SmartAI::SummonedCreatureDespawn(Creature* unit)
|
void SmartAI::SummonedCreatureDespawn(Creature* unit)
|
||||||
{
|
{
|
||||||
GetScript()->ProcessEventsFor(SMART_EVENT_SUMMON_DESPAWNED, unit);
|
GetScript()->ProcessEventsFor(SMART_EVENT_SUMMON_DESPAWNED, unit);
|
||||||
|
GetScript()->RemoveCreatureSummon(unit->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SmartAI::CorpseRemoved(uint32& respawnDelay)
|
void SmartAI::CorpseRemoved(uint32& respawnDelay)
|
||||||
|
|||||||
@@ -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_NONE:
|
||||||
case SMART_TARGET_POSITION:
|
case SMART_TARGET_POSITION:
|
||||||
@@ -4560,3 +4578,13 @@ bool SmartScript::IsInPhase(uint32 p) const
|
|||||||
|
|
||||||
return ((1 << (mEventPhase - 1)) & p) != 0;
|
return ((1 << (mEventPhase - 1)) & p) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SmartScript::AddCreatureSummon(ObjectGuid const& guid)
|
||||||
|
{
|
||||||
|
_summonList.insert(guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SmartScript::RemoveCreatureSummon(ObjectGuid const& guid)
|
||||||
|
{
|
||||||
|
_summonList.erase(guid);
|
||||||
|
}
|
||||||
|
|||||||
@@ -232,6 +232,9 @@ public:
|
|||||||
bool AllowPhaseReset() const { return _allowPhaseReset; }
|
bool AllowPhaseReset() const { return _allowPhaseReset; }
|
||||||
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
|
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
|
||||||
|
|
||||||
|
void AddCreatureSummon(ObjectGuid const& guid);
|
||||||
|
void RemoveCreatureSummon(ObjectGuid const& guid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void IncPhase(uint32 p);
|
void IncPhase(uint32 p);
|
||||||
void DecPhase(uint32 p);
|
void DecPhase(uint32 p);
|
||||||
@@ -306,6 +309,8 @@ private:
|
|||||||
SmartScriptHolder s;
|
SmartScriptHolder s;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GuidUnorderedSet _summonList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -413,6 +413,14 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SMART_TARGET_SUMMONED_CREATURES:
|
||||||
|
{
|
||||||
|
if (e.target.summonedCreatures.entry && !IsCreatureValid(e, e.target.summonedCreatures.entry))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SMART_TARGET_HOSTILE_SECOND_AGGRO:
|
case SMART_TARGET_HOSTILE_SECOND_AGGRO:
|
||||||
case SMART_TARGET_HOSTILE_LAST_AGGRO:
|
case SMART_TARGET_HOSTILE_LAST_AGGRO:
|
||||||
case SMART_TARGET_HOSTILE_RANDOM:
|
case SMART_TARGET_HOSTILE_RANDOM:
|
||||||
|
|||||||
@@ -1407,8 +1407,9 @@ enum SMARTAI_TARGETS
|
|||||||
SMART_TARGET_PLAYER_WITH_AURA = 201, // spellId, negation, MaxDist, MinDist, set target.o to a number to random resize the list
|
SMART_TARGET_PLAYER_WITH_AURA = 201, // spellId, negation, MaxDist, MinDist, set target.o to a number to random resize the list
|
||||||
SMART_TARGET_RANDOM_POINT = 202, // range, amount (for summoning creature), self als middle (0/1) else use xyz
|
SMART_TARGET_RANDOM_POINT = 202, // range, amount (for summoning creature), self als middle (0/1) else use xyz
|
||||||
SMART_TARGET_ROLE_SELECTION = 203, // Range Max, TargetMask (Tanks (1), Healer (2) Damage (4)), resize list
|
SMART_TARGET_ROLE_SELECTION = 203, // Range Max, TargetMask (Tanks (1), Healer (2) Damage (4)), resize list
|
||||||
|
SMART_TARGET_SUMMONED_CREATURES = 204, // Entry
|
||||||
|
|
||||||
SMART_TARGET_AC_END = 204 // placeholder
|
SMART_TARGET_AC_END = 205 // placeholder
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SmartTarget
|
struct SmartTarget
|
||||||
@@ -1564,6 +1565,11 @@ struct SmartTarget
|
|||||||
uint32 distMin;
|
uint32 distMin;
|
||||||
} playerWithAura;
|
} playerWithAura;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
uint32 entry;
|
||||||
|
} summonedCreatures;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32 param1;
|
uint32 param1;
|
||||||
|
|||||||
Reference in New Issue
Block a user