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
44 changed files with 191 additions and 95 deletions

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;