feat(Core/GameObject): Expand IsSummonedBy() to GameObjects (#14789)

Co-authored-by: jackpoz <giacomopoz@gmail.com>
This commit is contained in:
Skjalf 2023-01-29 09:44:33 -03:00 committed by GitHub
parent 4ecf96c379
commit bf30c66ba4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 191 additions and 95 deletions

View file

@ -25,6 +25,7 @@
#include "QuestDef.h"
#include <list>
class Creature;
class GameObject;
class Unit;
class SpellInfo;
@ -66,6 +67,10 @@ public:
virtual void SpellHit(Unit* /*unit*/, SpellInfo const* /*spellInfo*/) {}
virtual bool CanBeSeen(Player const* /*seer*/) { return true; }
// Called when the gameobject summon successfully other creature
virtual void JustSummoned(Creature* /*summon*/) { }
virtual void SummonedCreatureDespawn(Creature* /*summon*/) { }
virtual void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) { }
};

View file

@ -103,7 +103,7 @@ int32 CritterAI::Permissible(Creature const* creature)
return PERMIT_BASE_NO;
}
void TriggerAI::IsSummonedBy(Unit* summoner)
void TriggerAI::IsSummonedBy(WorldObject* summoner)
{
if (me->m_spells[0])
me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner ? summoner->GetGUID() : ObjectGuid::Empty);

View file

@ -80,7 +80,7 @@ class TriggerAI : public NullCreatureAI
{
public:
explicit TriggerAI(Creature* c) : NullCreatureAI(c) {}
void IsSummonedBy(Unit* summoner) override;
void IsSummonedBy(WorldObject* summoner) override;
static int32 Permissible(Creature const* creature);
};

View file

@ -126,7 +126,7 @@ public:
// Called when the creature summon successfully other creature
virtual void JustSummoned(Creature* /*summon*/) {}
virtual void IsSummonedBy(Unit* /*summoner*/) {}
virtual void IsSummonedBy(WorldObject* /*summoner*/) {}
virtual void SummonedCreatureDespawn(Creature* /*summon*/) {}
virtual void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) {}

View file

@ -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*/)

View file

@ -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;

View file

@ -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);
}
}
}
}

View file

@ -17,6 +17,8 @@
#include "TemporarySummon.h"
#include "CreatureAI.h"
#include "GameObject.h"
#include "GameObjectAI.h"
#include "Log.h"
#include "ObjectAccessor.h"
#include "Pet.h"
@ -250,11 +252,23 @@ void TempSummon::InitStats(uint32 duration)
void TempSummon::InitSummon()
{
Unit* owner = GetSummonerUnit();
WorldObject* owner = GetSummoner();
if (owner)
{
if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->JustSummoned(this);
if (owner->GetTypeId() == TYPEID_UNIT)
{
if (owner->ToCreature()->IsAIEnabled)
{
owner->ToCreature()->AI()->JustSummoned(this);
}
}
else if (owner->GetTypeId() == TYPEID_GAMEOBJECT)
{
if (owner->ToGameObject()->AI())
{
owner->ToGameObject()->AI()->JustSummoned(this);
}
}
}
// Xinef: Allow to call this hook when npc is summoned by gameobject, in this case pass this as summoner to avoid possible null checks
@ -290,9 +304,17 @@ void TempSummon::UnSummon(uint32 msTime)
return;
}
Unit* owner = GetSummonerUnit();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
if (WorldObject* owner = GetSummoner())
{
if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
{
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
}
else if (owner->GetTypeId() == TYPEID_GAMEOBJECT && owner->ToGameObject()->AI())
{
owner->ToGameObject()->AI()->SummonedCreatureDespawn(this);
}
}
AddObjectToRemoveList();
}

View file

@ -34,6 +34,7 @@
#include "DisableMgr.h"
#include "DynamicVisibility.h"
#include "Formulas.h"
#include "GameObjectAI.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
@ -18081,9 +18082,19 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
}
if (TempSummon* summon = creature->ToTempSummon())
if (Unit* summoner = summon->GetSummonerUnit())
if (summoner->ToCreature() && summoner->IsAIEnabled)
{
if (WorldObject* summoner = summon->GetSummoner())
{
if (summoner->ToCreature() && summoner->ToCreature()->IsAIEnabled)
{
summoner->ToCreature()->AI()->SummonedCreatureDies(creature, killer);
}
else if (summoner->ToGameObject() && summoner->ToGameObject()->AI())
{
summoner->ToGameObject()->AI()->SummonedCreatureDies(creature, killer);
}
}
}
// Dungeon specific stuff, only applies to players killing creatures
if (creature->GetInstanceId())

View file

@ -219,10 +219,15 @@ public:
{
npc_burning_spiritAI(Creature* creature) : ScriptedAI(creature) {}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
_flamelasherGUID = summoner->GetGUID();
me->GetMotionMaster()->MoveFollow(summoner, 0.f, 0.f);
me->GetMotionMaster()->MoveFollow(summoner->ToCreature(), 0.f, 0.f);
}
void EnterEvadeMode(EvadeReason /*why*/) override

View file

@ -86,7 +86,7 @@ public:
BossAI::EnterEvadeMode(why);
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
events.ScheduleEvent(EVENT_SUMMONED_1, 1000);
}

View file

@ -69,7 +69,7 @@ public:
frenzy15 = false;
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
StartTalking(TALK_SUMMON, 8 * IN_MILLISECONDS);
}

View file

@ -174,7 +174,7 @@ public:
me->DespawnOrUnsummon();
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
Talk(EMOTE_BLACKHAND_DISMOUNT);
}

View file

@ -981,7 +981,7 @@ public:
{
npc_vaelastrasz_the_redAI(Creature* creature) : CreatureAI(creature) { }
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
{

View file

@ -871,7 +871,7 @@ struct npc_corrupted_totem : public ScriptedAI
}
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
me->SetInCombatWithZone();
@ -942,7 +942,7 @@ struct npc_drakonid_spawner : public ScriptedAI
}
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
DoCastSelf(SPELL_SPAWN_DRAKONID_GEN);
_scheduler.Schedule(10s, 60s, [this](TaskContext /*context*/)

View file

@ -387,9 +387,14 @@ public:
int room;
Unit* Gandling;
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
Gandling = summoner;
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
Gandling = summoner->ToCreature();
if (instance)
{
room = Gandling->GetAI()->GetData(GANDLING_ROOM_TO_USE); // it's set just before my spawn

View file

@ -106,7 +106,7 @@ public:
me->DespawnOrUnsummon(1);
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
events2.Reset();
events2.ScheduleEvent(INTRO_1, 1000);

View file

@ -72,7 +72,7 @@ struct boss_kormok : public ScriptedAI
_summons.DespawnAll();
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
Talk(TALK_SUMMON);

View file

@ -132,7 +132,7 @@ struct boss_jarien : public BossAI
_Reset();
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
Talk(SAY_JARIEN_ON_SUMMON_0);
@ -257,7 +257,7 @@ struct boss_sothos : public BossAI
_Reset();
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
_scheduler.Schedule(12s, [this](TaskContext /*context*/)
{

View file

@ -57,7 +57,7 @@ public:
{
boss_gahzrankaAI(Creature* creature) : BossAI(creature, DATA_GAHZRANKA) { }
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
me->GetMotionMaster()->MovePath(me->GetEntry() * 10, false);
}

View file

@ -217,7 +217,7 @@ struct npc_shade_of_jindo : public ScriptedAI
{
npc_shade_of_jindo(Creature* creature) : ScriptedAI(creature) { }
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
DoZoneInCombat();
DoCastSelf(SPELL_SHADE_OF_JINDO_PASSIVE, true);

View file

@ -1809,7 +1809,7 @@ struct npc_direbrew_minion : public ScriptedAI
DoZoneInCombat();
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
if (Creature* coren = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_COREN)))
{

View file

@ -161,16 +161,19 @@ public:
_events.ScheduleEvent(EVENT_NOSUMMON, 50000);
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (summoner->GetTypeId() != TYPEID_PLAYER || !summoner->GetVehicle())
return;
_tigerGuid = summoner->GetVehicle()->GetBase()->GetGUID();
if (Unit* tiger = ObjectAccessor::GetUnit(*me, _tigerGuid))
if (Player* player = summoner->ToPlayer())
{
me->AddThreat(tiger, 500000.0f);
DoCast(me, SPELL_FURIOUS_BITE);
if (Vehicle* vehicle = player->GetVehicle())
{
_tigerGuid = vehicle->GetBase()->GetGUID();
if (Unit* tiger = ObjectAccessor::GetUnit(*me, _tigerGuid))
{
me->AddThreat(tiger, 500000.0f);
DoCast(me, SPELL_FURIOUS_BITE);
}
}
}
}

View file

@ -320,7 +320,7 @@ public:
}
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
std::list<Player*> playerOnQuestList;
Acore::AnyPlayerInObjectRangeCheck checker(me, 5.0f);

View file

@ -119,7 +119,7 @@ struct npc_taldaram_flamesphere : public NullCreatureAI
}
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
// Replace sphere instantly if sphere is summoned after prince death
if (instance->GetBossState(DATA_PRINCE_TALDARAM) != IN_PROGRESS)

View file

@ -225,7 +225,7 @@ public:
// Prevent EvadeMode
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
// Let Zarithrian count as summoner. _instance cant be null since we got GetRubySanctumAI
if (Creature* zarithrian = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(NPC_GENERAL_ZARITHRIAN)))

View file

@ -1456,7 +1456,7 @@ public:
{
npc_living_infernoAI(Creature* creature) : ScriptedAI(creature) { }
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
me->SetInCombatWithZone();
me->CastSpell(me, SPELL_BLAZING_AURA, true);

View file

@ -1369,7 +1369,7 @@ public:
float _groundZ;
bool exploded;
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
if (InstanceScript* instance = me->GetInstanceScript())
{

View file

@ -318,7 +318,7 @@ public:
EventMap events;
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
events.ScheduleEvent(1, 450);
events.ScheduleEvent(2, 12000);
@ -404,24 +404,29 @@ public:
DoAction(-1337);
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;
if (Vehicle* v = summoner->GetVehicle())
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
if (Vehicle* v = summoner->ToUnit()->GetVehicle())
if (Unit* u = v->GetBase())
if (u->GetEntry() == NPC_BONE_SPIKE && u->GetTypeId() == TYPEID_UNIT)
u->ToCreature()->AI()->DoAction(-1337);
ObjectGuid petGUID = summoner->GetPetGUID();
summoner->SetPetGUID(ObjectGuid::Empty);
me->CastSpell(summoner, SPELL_IMPALED, true);
summoner->CastSpell(me, SPELL_RIDE_VEHICLE, true);
ObjectGuid petGUID = summoner->ToUnit()->GetPetGUID();
summoner->ToUnit()->SetPetGUID(ObjectGuid::Empty);
me->CastSpell(summoner->ToUnit(), SPELL_IMPALED, true);
summoner->ToUnit()->CastSpell(me, SPELL_RIDE_VEHICLE, true);
//summoner->ClearUnitState(UNIT_STATE_ONVEHICLE);
summoner->SetPetGUID(petGUID);
summoner->GetMotionMaster()->Clear();
summoner->StopMoving();
summoner->ToUnit()->SetPetGUID(petGUID);
summoner->ToUnit()->GetMotionMaster()->Clear();
summoner->ToUnit()->StopMoving();
events.ScheduleEvent(1, 8000);
hasTrappedUnit = true;
}

View file

@ -756,7 +756,7 @@ public:
targetGUID = guid;
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
if (InstanceScript* instance = me->GetInstanceScript())
if (Creature* professor = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_PROFESSOR_PUTRICIDE)))

View file

@ -358,13 +358,18 @@ public:
EventMap events;
InstanceScript* instance;
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;
me->AddThreat(summoner, 500000.0f);
AttackStart(summoner);
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
me->AddThreat(summoner->ToUnit(), 500000.0f);
AttackStart(summoner->ToUnit());
}
void JustDied(Unit* /*killer*/) override
@ -437,7 +442,7 @@ public:
EventMap events;
InstanceScript* instance;
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
if (Player* p = me->SelectNearestPlayer(100.0f))
AttackStart(p);

View file

@ -2339,7 +2339,7 @@ public:
}
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
// player is the spellcaster so register summon manually
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
@ -3121,11 +3121,16 @@ public:
EventMap _events;
InstanceScript* _instance;
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_THE_LICH_KING)))
{
me->SetWalk(false);
@ -3134,13 +3139,13 @@ public:
path.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), 843.0f));
me->GetMotionMaster()->MoveSplinePath(&path);
ObjectGuid petGUID = summoner->GetPetGUID();
summoner->SetPetGUID(ObjectGuid::Empty);
summoner->StopMoving();
me->CastSpell(summoner, SPELL_HARVEST_SOUL_VEHICLE, true);
ObjectGuid petGUID = summoner->ToUnit()->GetPetGUID();
summoner->ToUnit()->SetPetGUID(ObjectGuid::Empty);
summoner->ToUnit()->StopMoving();
me->CastSpell(summoner->ToUnit(), SPELL_HARVEST_SOUL_VEHICLE, true);
//summoner->ClearUnitState(UNIT_STATE_ONVEHICLE);
summoner->SendMovementFlagUpdate(true);
summoner->SetPetGUID(petGUID);
summoner->ToUnit()->SendMovementFlagUpdate(true);
summoner->ToUnit()->SetPetGUID(petGUID);
_events.Reset();
_events.ScheduleEvent(EVENT_MOVE_TO_LICH_KING, 1000);
_events.ScheduleEvent(EVENT_TELEPORT, 6250);
@ -3652,7 +3657,7 @@ public:
uint16 timer;
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
float destX, destY, destZ;
me->GetPosition(destX, destY);

View file

@ -977,7 +977,7 @@ public:
ScriptedAI::AttackStart(who);
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
if (Creature* valithria = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)))
AttackStart(valithria);

View file

@ -352,8 +352,13 @@ public:
bool JustSummoned;
uint16 despawnTimer;
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
if (m_pInstance->GetBossState(DATA_EREGOS) == IN_PROGRESS)
if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true))
eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos
@ -363,13 +368,13 @@ public:
switch (me->GetEntry())
{
case NPC_RUBY_DRAKE:
me->CastSpell(summoner, SPELL_RIDE_RUBY_DRAKE_QUE);
me->CastSpell(summoner->ToUnit(), SPELL_RIDE_RUBY_DRAKE_QUE);
break;
case NPC_EMERALD_DRAKE:
me->CastSpell(summoner, SPELL_RIDE_EMERALD_DRAKE_QUE);
me->CastSpell(summoner->ToUnit(), SPELL_RIDE_EMERALD_DRAKE_QUE);
break;
case NPC_AMBER_DRAKE:
me->CastSpell(summoner, SPELL_RIDE_AMBER_DRAKE_QUE);
me->CastSpell(summoner->ToUnit(), SPELL_RIDE_AMBER_DRAKE_QUE);
break;
default:
return;

View file

@ -412,7 +412,7 @@ public:
vezax->AI()->DoAction(1);
}
void IsSummonedBy(Unit* /*summoner*/) override
void IsSummonedBy(WorldObject* /*summoner*/) override
{
Talk(SAY_EMOTE_VAPORS);
}

View file

@ -670,7 +670,7 @@ public:
me->DespawnOrUnsummon(3s, 0s);
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
me->SetFacingToObject(summoner);
Position pos = summoner->GetPosition();
@ -1677,7 +1677,7 @@ public:
return 5;
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner || summoner->GetTypeId() != TYPEID_PLAYER)
return;
@ -1689,7 +1689,7 @@ public:
summoner->ToPlayer()->SendDirectMessage(&data);
if (id == 1)
if (Aura* aura = summoner->GetAura(47189)) // Transform Aura
if (Aura* aura = summoner->ToUnit()->GetAura(47189)) // Transform Aura
aura->SetDuration(aura->GetDuration() - MINUTE * IN_MILLISECONDS);
}
};

View file

@ -1292,19 +1292,24 @@ public:
return nullptr;
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;
summoner->CastSpell(summoner, SPELL_WAITING_FOR_A_BOMBER, true);
summoner->CastSpell(summoner, SPELL_FLIGHT_ORDERS, true);
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
summoner->ToUnit()->CastSpell(summoner->ToUnit(), SPELL_WAITING_FOR_A_BOMBER, true);
summoner->ToUnit()->CastSpell(summoner->ToUnit(), SPELL_FLIGHT_ORDERS, true);
events.ScheduleEvent(EVENT_START_FLIGHT, 0);
events.ScheduleEvent(EVENT_TAKE_PASSENGER, 3000);
me->SetCanFly(true);
me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING);
me->SetSpeed(MOVE_FLIGHT, 0.1f);
me->SetFaction(summoner->GetFaction());
me->SetFaction(summoner->ToUnit()->GetFaction());
}
void DamageTaken(Unit* who, uint32&, DamageEffectType, SpellSchoolMask) override
@ -2129,7 +2134,7 @@ public:
EventMap events;
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;

View file

@ -294,7 +294,7 @@ public:
me->DespawnOrUnsummon(1);
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;

View file

@ -1108,7 +1108,7 @@ public:
timer = 500;
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (summoner && summoner->isType(TYPEMASK_PLAYER))
playerGuid = summoner->GetGUID();

View file

@ -236,7 +236,7 @@ public:
me->GetMotionMaster()->MoveRandom(5.0f);
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;

View file

@ -407,7 +407,7 @@ public:
}
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;

View file

@ -727,7 +727,7 @@ struct npc_pet_gen_fetch_ball : public NullCreatureAI
uint32 checkTimer;
ObjectGuid targetGUID;
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;

View file

@ -459,13 +459,18 @@ public:
{
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (!summoner)
return;
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
_summonerGuid = summoner->GetGUID();
me->GetMotionMaster()->MoveFollow(summoner, 0.0f, 0.0f);
me->GetMotionMaster()->MoveFollow(summoner->ToUnit(), 0.0f, 0.0f);
}
void MovementInform(uint32 moveType, uint32 data) override

View file

@ -2521,7 +2521,7 @@ public:
{
npc_venomhide_hatchlingAI(Creature* creature) : ScriptedAI(creature) {}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
if (summoner->GetTypeId() != TYPEID_PLAYER)
{
@ -2597,9 +2597,14 @@ public:
events.ScheduleEvent(EVENT_FLAME_BREATH, 12s);
}
void IsSummonedBy(Unit* summoner) override
void IsSummonedBy(WorldObject* summoner) override
{
me->GetMotionMaster()->MoveFollow(summoner, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
if (summoner->GetTypeId() != TYPEID_UNIT)
{
return;
}
me->GetMotionMaster()->MoveFollow(summoner->ToUnit(), PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
}
void UpdateAI(uint32 diff) override