mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-05 20:13:48 +00:00
feat(Core/GameObject): Expand IsSummonedBy() to GameObjects (#14789)
Co-authored-by: jackpoz <giacomopoz@gmail.com>
This commit is contained in:
@@ -1369,7 +1369,7 @@ public:
|
||||
float _groundZ;
|
||||
bool exploded;
|
||||
|
||||
void IsSummonedBy(Unit* /*summoner*/) override
|
||||
void IsSummonedBy(WorldObject* /*summoner*/) override
|
||||
{
|
||||
if (InstanceScript* instance = me->GetInstanceScript())
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)))
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user