mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-16 08:46:09 +00:00
feat(Core/GameObject): Expand IsSummonedBy() to GameObjects (#14789)
Co-authored-by: jackpoz <giacomopoz@gmail.com>
This commit is contained in:
@@ -878,9 +878,9 @@ void SmartAI::ReceiveEmote(Player* player, uint32 textEmote)
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_RECEIVE_EMOTE, player, textEmote);
|
||||
}
|
||||
|
||||
void SmartAI::IsSummonedBy(Unit* summoner)
|
||||
void SmartAI::IsSummonedBy(WorldObject* summoner)
|
||||
{
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_JUST_SUMMONED, summoner);
|
||||
GetScript()->ProcessEventsFor(SMART_EVENT_JUST_SUMMONED, summoner->ToUnit(), 0, 0, false, nullptr, summoner->ToGameObject());
|
||||
}
|
||||
|
||||
void SmartAI::DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType /*damagetype*/)
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
void MovementInform(uint32 MovementType, uint32 Data) override;
|
||||
|
||||
// Called when creature is summoned by another unit
|
||||
void IsSummonedBy(Unit* summoner) override;
|
||||
void IsSummonedBy(WorldObject* summoner) override;
|
||||
|
||||
// Called at any Damage to any victim (before damage apply)
|
||||
void DamageDealt(Unit* doneTo, uint32& damage, DamageEffectType damagetyp) override;
|
||||
|
||||
@@ -3207,13 +3207,23 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
|
||||
// xinef: Get owner of owner
|
||||
if (e.target.owner.useCharmerOrOwner && !targets.empty())
|
||||
{
|
||||
if (Unit* owner = targets.front()->ToUnit())
|
||||
if (WorldObject* owner = targets.front())
|
||||
{
|
||||
targets.clear();
|
||||
|
||||
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->GetCharmerOrOwnerGUID()))
|
||||
if (owner->ToCreature())
|
||||
{
|
||||
targets.push_back(base);
|
||||
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->ToCreature()->GetCharmerOrOwnerGUID()))
|
||||
{
|
||||
targets.push_back(base);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Unit* base = ObjectAccessor::GetUnit(*owner, owner->ToGameObject()->GetOwnerGUID()))
|
||||
{
|
||||
targets.push_back(base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user