mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-27 22:16:11 +00:00
refactor(Scripts/EoE): Make use of creature/GO storages (#24724)
This commit is contained in:
@@ -235,8 +235,8 @@ struct boss_malygos : public BossAI
|
||||
{
|
||||
float angle = me->GetOrientation();
|
||||
float dist = 75.0f;
|
||||
if (Creature* c = me->SummonCreature(NPC_PORTAL, me->GetPositionX() + cos(angle) * dist, me->GetPositionY() + std::sin(angle) * dist, me->GetPositionZ(), FourSidesPos[id].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 13000))
|
||||
me->CastSpell(c, SPELL_PORTAL_BEAM, false);
|
||||
if (Creature* portal = me->SummonCreature(NPC_PORTAL, me->GetPositionX() + cos(angle) * dist, me->GetPositionY() + std::sin(angle) * dist, me->GetPositionZ(), FourSidesPos[id].GetOrientation(), TEMPSUMMON_TIMED_DESPAWN, 13000))
|
||||
me->CastSpell(portal, SPELL_PORTAL_BEAM, false);
|
||||
timer2 = INTRO_MOVEMENT_INTERVAL - 10000;
|
||||
}
|
||||
break;
|
||||
@@ -245,8 +245,8 @@ struct boss_malygos : public BossAI
|
||||
events.RescheduleEvent(EVENT_INTRO_LAND, 0ms, 1);
|
||||
break;
|
||||
case MI_POINT_VORTEX_CENTER:
|
||||
if (Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 15000))
|
||||
c->CastSpell(c, SPELL_VORTEX_VISUAL, true);
|
||||
if (Creature* trigger = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 15000))
|
||||
trigger->CastSpell(trigger, SPELL_VORTEX_VISUAL, true);
|
||||
events.RescheduleEvent(EVENT_START_VORTEX_REAL, 1s, 1);
|
||||
break;
|
||||
case MI_POINT_CENTER_GROUND_PH_2:
|
||||
@@ -394,12 +394,12 @@ struct boss_malygos : public BossAI
|
||||
case EVENT_SUMMON_POWER_SPARK:
|
||||
{
|
||||
uint8 random = urand(0, 3);
|
||||
if (Creature* c = me->SummonCreature(NPC_PORTAL, FourSidesPos[random], TEMPSUMMON_TIMED_DESPAWN, 6000))
|
||||
c->CastSpell(c, SPELL_PORTAL_BEAM, false);
|
||||
if (Creature* c = me->SummonCreature(NPC_POWER_SPARK, FourSidesPos[random], TEMPSUMMON_MANUAL_DESPAWN, 0))
|
||||
if (Creature* portal = me->SummonCreature(NPC_PORTAL, FourSidesPos[random], TEMPSUMMON_TIMED_DESPAWN, 6000))
|
||||
portal->CastSpell(portal, SPELL_PORTAL_BEAM, false);
|
||||
if (Creature* spark = me->SummonCreature(NPC_POWER_SPARK, FourSidesPos[random], TEMPSUMMON_MANUAL_DESPAWN, 0))
|
||||
{
|
||||
c->AI()->DoAction(ACTION_POWER_SPARK_FOLLOW);
|
||||
c->AI()->Talk(EMOTE_POWER_SPARK);
|
||||
spark->AI()->DoAction(ACTION_POWER_SPARK_FOLLOW);
|
||||
spark->AI()->Talk(EMOTE_POWER_SPARK);
|
||||
}
|
||||
|
||||
events.Repeat(20s, 30s);
|
||||
@@ -444,47 +444,47 @@ struct boss_malygos : public BossAI
|
||||
{
|
||||
vp->SetDisableGravity(true);
|
||||
|
||||
me->GetMap()->DoForAllPlayers([&](Player* pPlayer)
|
||||
me->GetMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
if (!pPlayer->IsAlive() || pPlayer->IsGameMaster())
|
||||
if (!player->IsAlive() || player->IsGameMaster())
|
||||
return;
|
||||
|
||||
Position plrpos;
|
||||
float playerAngle = CenterPos.GetAngle(pPlayer);
|
||||
float playerAngle = CenterPos.GetAngle(player);
|
||||
plrpos.m_positionX = CenterPos.GetPositionX() + cos(playerAngle) * 5.0f;
|
||||
plrpos.m_positionY = CenterPos.GetPositionY() + std::sin(playerAngle) * 5.0f;
|
||||
plrpos.m_positionZ = CenterPos.GetPositionZ() + 18.0f;
|
||||
plrpos.SetOrientation(plrpos.GetAngle(&CenterPos));
|
||||
|
||||
if (Creature* c = me->SummonCreature(NPC_VORTEX, plrpos, TEMPSUMMON_TIMED_DESPAWN, 15000))
|
||||
if (Creature* vortex = me->SummonCreature(NPC_VORTEX, plrpos, TEMPSUMMON_TIMED_DESPAWN, 15000))
|
||||
{
|
||||
pPlayer->CastSpell(pPlayer, SPELL_FREEZE_ANIM, true);
|
||||
pPlayer->CastSpell(c, SPELL_VORTEX_CONTROL_VEHICLE, true);
|
||||
if (!pPlayer->GetVehicle()) // didn't work somehow, try again with a different way, if fails - break
|
||||
player->CastSpell(player, SPELL_FREEZE_ANIM, true);
|
||||
player->CastSpell(vortex, SPELL_VORTEX_CONTROL_VEHICLE, true);
|
||||
if (!player->GetVehicle()) // didn't work somehow, try again with a different way, if fails - break
|
||||
{
|
||||
pPlayer->EnterVehicle(c, 0);
|
||||
if (!pPlayer->GetVehicle())
|
||||
player->EnterVehicle(vortex, 0);
|
||||
if (!player->GetVehicle())
|
||||
return;
|
||||
}
|
||||
//pPlayer->ClearUnitState(UNIT_STATE_ONVEHICLE);
|
||||
//player->ClearUnitState(UNIT_STATE_ONVEHICLE);
|
||||
|
||||
Movement::MoveSplineInit init(pPlayer); // TODO: has to be removed and handled with vehicle exit and vehicle enter code
|
||||
Movement::MoveSplineInit init(player); // TODO: has to be removed and handled with vehicle exit and vehicle enter code
|
||||
init.MoveTo(CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ());
|
||||
init.SetFacing(pPlayer->GetOrientation());
|
||||
init.SetFacing(player->GetOrientation());
|
||||
init.SetTransportExit();
|
||||
init.Launch();
|
||||
|
||||
pPlayer->SetUnitMovementFlags(MOVEMENTFLAG_NONE);
|
||||
pPlayer->SetDisableGravity(true);
|
||||
player->SetUnitMovementFlags(MOVEMENTFLAG_NONE);
|
||||
player->SetDisableGravity(true);
|
||||
|
||||
WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8);
|
||||
data << pPlayer->GetPackGUID();
|
||||
pPlayer->SendMessageToSet(&data, true);
|
||||
data << player->GetPackGUID();
|
||||
player->SendMessageToSet(&data, true);
|
||||
|
||||
sScriptMgr->AnticheatSetUnderACKmount(pPlayer);
|
||||
sScriptMgr->AnticheatSetUnderACKmount(player);
|
||||
|
||||
pPlayer->SetGuidValue(PLAYER_FARSIGHT, vp->GetGUID());
|
||||
c->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
player->SetGuidValue(PLAYER_FARSIGHT, vp->GetGUID());
|
||||
vortex->SetUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -538,9 +538,9 @@ struct boss_malygos : public BossAI
|
||||
float dist = 22.0f;
|
||||
float angle = M_PI / 2 + ((float)i / MAX_NEXUS_LORDS) * 2 * M_PI;
|
||||
if (Creature* disk = me->SummonCreature(NPC_HOVER_DISK, CenterPos.GetPositionX() + cos(angle) * dist, CenterPos.GetPositionY() + std::sin(angle) * dist, CenterPos.GetPositionZ() + 30.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0))
|
||||
if (Creature* c = me->SummonCreature(NPC_NEXUS_LORD, *disk, TEMPSUMMON_MANUAL_DESPAWN, 0))
|
||||
if (Creature* lord = me->SummonCreature(NPC_NEXUS_LORD, *disk, TEMPSUMMON_MANUAL_DESPAWN, 0))
|
||||
{
|
||||
c->EnterVehicle(disk, 0);
|
||||
lord->EnterVehicle(disk, 0);
|
||||
disk->AI()->DoAction(ACTION_DISK_START_MOVING);
|
||||
}
|
||||
}
|
||||
@@ -549,9 +549,9 @@ struct boss_malygos : public BossAI
|
||||
float dist = 30.0f;
|
||||
float angle = 0.0f + ((float)i / MAX_SCIONS_OF_ETERNITY) * 2 * M_PI;
|
||||
if (Creature* disk = me->SummonCreature(NPC_HOVER_DISK, CenterPos.GetPositionX() + cos(angle) * dist, CenterPos.GetPositionY() + std::sin(angle) * dist, CenterPos.GetPositionZ() + 30.0f, 0.0f, TEMPSUMMON_MANUAL_DESPAWN, 0))
|
||||
if (Creature* c = me->SummonCreature(NPC_SCION_OF_ETERNITY, *disk, TEMPSUMMON_MANUAL_DESPAWN, 0))
|
||||
if (Creature* scion = me->SummonCreature(NPC_SCION_OF_ETERNITY, *disk, TEMPSUMMON_MANUAL_DESPAWN, 0))
|
||||
{
|
||||
c->EnterVehicle(disk, 0);
|
||||
scion->EnterVehicle(disk, 0);
|
||||
disk->AI()->DoAction(ACTION_DISK_START_MOVING);
|
||||
}
|
||||
}
|
||||
@@ -595,8 +595,8 @@ struct boss_malygos : public BossAI
|
||||
events.RescheduleEvent(EVENT_SPELL_SURGE_OF_POWER, 1500ms, 1);
|
||||
break;
|
||||
case EVENT_SPELL_SURGE_OF_POWER:
|
||||
if (Creature* c = me->SummonCreature(NPC_SURGE_OF_POWER, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 10000))
|
||||
me->CastSpell(c, SPELL_SURGE_OF_POWER, false);
|
||||
if (Creature* surge = me->SummonCreature(NPC_SURGE_OF_POWER, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 10000))
|
||||
me->CastSpell(surge, SPELL_SURGE_OF_POWER, false);
|
||||
Talk(SAY_SURGE_OF_POWER);
|
||||
events.RescheduleEvent(EVENT_CLEAR_TARGET, 10s, 1);
|
||||
events.RescheduleEvent(EVENT_RESUME_FLYING_CIRCLES_PH_2, 10s, 1);
|
||||
@@ -632,11 +632,11 @@ struct boss_malygos : public BossAI
|
||||
me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_CHANGE_DIMENSIONS, 2s);
|
||||
break;
|
||||
case EVENT_DESTROY_PLATFORM_0:
|
||||
if (Creature* c = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 3000))
|
||||
if (Creature* trigger = me->SummonCreature(NPC_WORLD_TRIGGER_LAOI, CenterPos, TEMPSUMMON_TIMED_DESPAWN, 3000))
|
||||
{
|
||||
c->SetFaction(me->GetFaction());
|
||||
c->CastSpell(c, SPELL_DESTROY_PLATFORM_VISUAL, true);
|
||||
c->CastSpell(c, SPELL_DESTROY_PLATFORM_EFFECT, false);
|
||||
trigger->SetFaction(me->GetFaction());
|
||||
trigger->CastSpell(trigger, SPELL_DESTROY_PLATFORM_VISUAL, true);
|
||||
trigger->CastSpell(trigger, SPELL_DESTROY_PLATFORM_EFFECT, false);
|
||||
}
|
||||
me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_OBSCURE_SPACE, 1s);
|
||||
events.RescheduleEvent(EVENT_MOVE_TO_PHASE_3_POSITION, 2s, 1);
|
||||
@@ -784,7 +784,7 @@ struct boss_malygos : public BossAI
|
||||
|
||||
struct npc_vortex_ride : public VehicleAI
|
||||
{
|
||||
npc_vortex_ride(Creature* pCreature) : VehicleAI(pCreature)
|
||||
npc_vortex_ride(Creature* creature) : VehicleAI(creature)
|
||||
{
|
||||
vortexRadius = urand(22, 28);
|
||||
float h = urand(15, 30);
|
||||
@@ -810,15 +810,15 @@ struct npc_vortex_ride : public VehicleAI
|
||||
if (!pass || apply || !pass->IsPlayer())
|
||||
return;
|
||||
|
||||
Player* plr = pass->ToPlayer();
|
||||
float speed = plr->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()) / (1.0f * 0.001f);
|
||||
plr->SetDisableGravity(false); // packet only would lead to issues elsewhere
|
||||
plr->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), speed);
|
||||
plr->RemoveAura(SPELL_FREEZE_ANIM);
|
||||
plr->SetGuidValue(PLAYER_FARSIGHT, ObjectGuid::Empty);
|
||||
Player* player = pass->ToPlayer();
|
||||
float speed = player->GetDistance(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()) / (1.0f * 0.001f);
|
||||
player->SetDisableGravity(false); // packet only would lead to issues elsewhere
|
||||
player->GetMotionMaster()->MoveCharge(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), speed);
|
||||
player->RemoveAura(SPELL_FREEZE_ANIM);
|
||||
player->SetGuidValue(PLAYER_FARSIGHT, ObjectGuid::Empty);
|
||||
|
||||
sScriptMgr->AnticheatSetCanFlybyServer(plr, false);
|
||||
sScriptMgr->AnticheatSetUnderACKmount(plr);
|
||||
sScriptMgr->AnticheatSetCanFlybyServer(player, false);
|
||||
sScriptMgr->AnticheatSetUnderACKmount(player);
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
@@ -848,15 +848,15 @@ struct npc_vortex_ride : public VehicleAI
|
||||
float dist = 2 * me->GetDistance2d(newx, newy);
|
||||
if (me->GetVehicleKit())
|
||||
if (Unit* pass = me->GetVehicleKit()->GetPassenger(0))
|
||||
if (Player* plr = pass->ToPlayer())
|
||||
if (Player* player = pass->ToPlayer())
|
||||
{
|
||||
if (!bUpdatedFlying && timer)
|
||||
{
|
||||
bUpdatedFlying = true;
|
||||
plr->SetDisableGravity(true);
|
||||
player->SetDisableGravity(true);
|
||||
}
|
||||
|
||||
plr->SendMonsterMove(me->GetPositionX() + dist * cos(arcangle), me->GetPositionY() + dist * std::sin(arcangle), me->GetPositionZ(), VORTEX_DEFAULT_DIFF * 2, SPLINEFLAG_FLYING);
|
||||
player->SendMonsterMove(me->GetPositionX() + dist * cos(arcangle), me->GetPositionY() + dist * std::sin(arcangle), me->GetPositionZ(), VORTEX_DEFAULT_DIFF * 2, SPLINEFLAG_FLYING);
|
||||
me->Relocate(newx, newy);
|
||||
}
|
||||
|
||||
@@ -873,27 +873,27 @@ struct npc_vortex_ride : public VehicleAI
|
||||
|
||||
struct npc_power_spark : public NullCreatureAI
|
||||
{
|
||||
npc_power_spark(Creature* pCreature) : NullCreatureAI(pCreature)
|
||||
npc_power_spark(Creature* creature) : NullCreatureAI(creature)
|
||||
{
|
||||
pInstance = me->GetInstanceScript();
|
||||
_instance = me->GetInstanceScript();
|
||||
me->CastSpell(me, SPELL_POWER_SPARK_VISUAL, false);
|
||||
CheckTimer = 1000;
|
||||
MoveTimer = 0;
|
||||
_checkTimer = 1000;
|
||||
_moveTimer = 0;
|
||||
}
|
||||
|
||||
InstanceScript* pInstance;
|
||||
uint16 CheckTimer;
|
||||
uint16 MoveTimer;
|
||||
InstanceScript* _instance;
|
||||
uint16 _checkTimer;
|
||||
uint16 _moveTimer;
|
||||
|
||||
void DoAction(int32 param) override
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case ACTION_POWER_SPARK_FOLLOW:
|
||||
MoveTimer = 1;
|
||||
_moveTimer = 1;
|
||||
break;
|
||||
case ACTION_POWER_SPARK_STOP:
|
||||
MoveTimer = 0;
|
||||
_moveTimer = 0;
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
me->DisableSpline();
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 0.05f, FORCED_MOVEMENT_NONE, 7.0f);
|
||||
@@ -910,7 +910,7 @@ struct npc_power_spark : public NullCreatureAI
|
||||
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
|
||||
return;
|
||||
|
||||
MoveTimer = 0;
|
||||
_moveTimer = 0;
|
||||
me->GetMotionMaster()->MoveIdle();
|
||||
me->DisableSpline();
|
||||
me->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), CenterPos.GetPositionZ(), FORCED_MOVEMENT_NONE, 100.0f);
|
||||
@@ -925,39 +925,40 @@ struct npc_power_spark : public NullCreatureAI
|
||||
if (me->HasUnitFlag(UNIT_FLAG_NON_ATTACKABLE))
|
||||
return;
|
||||
|
||||
if (CheckTimer <= diff)
|
||||
if (_checkTimer <= diff)
|
||||
{
|
||||
if (pInstance)
|
||||
if (Creature* c = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_MALYGOS_GUID)))
|
||||
if (me->IsWithinDist3d(c, 12.0f))
|
||||
if (_instance)
|
||||
{
|
||||
if (Creature* malygos = _instance->GetCreature(DATA_MALYGOS))
|
||||
{
|
||||
if (me->IsWithinDist3d(malygos, 12.0f))
|
||||
{
|
||||
me->CastSpell(c, SPELL_POWER_SPARK_MALYGOS_BUFF, true);
|
||||
me->CastSpell(malygos, SPELL_POWER_SPARK_MALYGOS_BUFF, true);
|
||||
me->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
CheckTimer = 1000;
|
||||
}
|
||||
}
|
||||
_checkTimer = 1000;
|
||||
}
|
||||
else
|
||||
CheckTimer -= diff;
|
||||
_checkTimer -= diff;
|
||||
|
||||
if (MoveTimer)
|
||||
if (_moveTimer <= diff)
|
||||
{
|
||||
if (MoveTimer <= diff)
|
||||
{
|
||||
if (pInstance)
|
||||
if (Creature* c = pInstance->instance->GetCreature(pInstance->GetGuidData(DATA_MALYGOS_GUID)))
|
||||
me->GetMotionMaster()->MovePoint(0, *c);
|
||||
MoveTimer = 2000;
|
||||
}
|
||||
else
|
||||
MoveTimer -= diff;
|
||||
if (_instance)
|
||||
if (Creature* malygos = _instance->GetCreature(DATA_MALYGOS))
|
||||
me->GetMotionMaster()->MovePoint(0, *malygos);
|
||||
_moveTimer = 2000;
|
||||
}
|
||||
else
|
||||
_moveTimer -= diff;
|
||||
}
|
||||
};
|
||||
|
||||
struct npc_nexus_lord : public ScriptedAI
|
||||
{
|
||||
npc_nexus_lord(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
npc_nexus_lord(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
timer = 0;
|
||||
@@ -1016,28 +1017,28 @@ struct npc_nexus_lord : public ScriptedAI
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
if (Vehicle* v = me->GetVehicle())
|
||||
v->RemoveAllPassengers();
|
||||
if (Vehicle* vehicle = me->GetVehicle())
|
||||
vehicle->RemoveAllPassengers();
|
||||
}
|
||||
};
|
||||
|
||||
struct npc_scion_of_eternity : public ScriptedAI
|
||||
{
|
||||
npc_scion_of_eternity(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
npc_scion_of_eternity(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
me->CastSpell(me, SPELL_TELEPORT_VISUAL, true);
|
||||
ScheduleTimedEvent(20s, 25s, [&]
|
||||
{
|
||||
GuidVector guids;
|
||||
me->GetMap()->DoForAllPlayers([&](Player* pPlayer)
|
||||
me->GetMap()->DoForAllPlayers([&](Player* player)
|
||||
{
|
||||
if (pPlayer->IsAlive() && !pPlayer->GetVehicle())
|
||||
guids.push_back(pPlayer->GetGUID());
|
||||
if (player->IsAlive() && !player->GetVehicle())
|
||||
guids.push_back(player->GetGUID());
|
||||
});
|
||||
if (!guids.empty())
|
||||
if (Player* plr = ObjectAccessor::GetPlayer(*me, guids.at(urand(0, guids.size() - 1))))
|
||||
me->CastSpell(plr, SPELL_SCION_ARCANE_BARRAGE);
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*me, guids.at(urand(0, guids.size() - 1))))
|
||||
me->CastSpell(player, SPELL_SCION_ARCANE_BARRAGE);
|
||||
}, 5s, 8s);
|
||||
}
|
||||
|
||||
@@ -1051,8 +1052,8 @@ struct npc_scion_of_eternity : public ScriptedAI
|
||||
|
||||
void JustDied(Unit* killer) override
|
||||
{
|
||||
if (Vehicle* v = me->GetVehicle())
|
||||
v->RemoveAllPassengers();
|
||||
if (Vehicle* vehicle = me->GetVehicle())
|
||||
vehicle->RemoveAllPassengers();
|
||||
|
||||
if (killer)
|
||||
if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
|
||||
@@ -1065,7 +1066,7 @@ struct npc_scion_of_eternity : public ScriptedAI
|
||||
|
||||
struct npc_hover_disk : public VehicleAI
|
||||
{
|
||||
npc_hover_disk(Creature* pCreature) : VehicleAI(pCreature)
|
||||
npc_hover_disk(Creature* creature) : VehicleAI(creature)
|
||||
{
|
||||
events.Reset();
|
||||
}
|
||||
@@ -1120,72 +1121,61 @@ struct npc_hover_disk : public VehicleAI
|
||||
if (type != POINT_MOTION_TYPE)
|
||||
return;
|
||||
|
||||
switch (id)
|
||||
if (id == MI_POINT_NEXUS_LORD)
|
||||
{
|
||||
case MI_POINT_SCION:
|
||||
events.RescheduleEvent(EVENT_DISK_MOVE_NEXT_POINT, 0ms);
|
||||
break;
|
||||
case MI_POINT_NEXUS_LORD:
|
||||
if (me->GetPositionZ() > CenterPos.GetPositionZ() + 2.0f)
|
||||
events.RescheduleEvent(EVENT_DISK_MOVE_NEXT_POINT, 0ms);
|
||||
else if (Vehicle* v = me->GetVehicleKit())
|
||||
if (Unit* pass = v->GetPassenger(0))
|
||||
if (Creature* c = pass->ToCreature())
|
||||
else if (Vehicle* vehicle = me->GetVehicleKit())
|
||||
if (Unit* passenger = vehicle->GetPassenger(0))
|
||||
if (Creature* creature = passenger->ToCreature())
|
||||
{
|
||||
c->SetReactState(REACT_AGGRESSIVE);
|
||||
if (Player* plr = c->SelectNearestPlayer(100.0f))
|
||||
c->AI()->AttackStart(plr);
|
||||
creature->SetReactState(REACT_AGGRESSIVE);
|
||||
if (Player* player = creature->SelectNearestPlayer(100.0f))
|
||||
creature->AI()->AttackStart(player);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (id == MI_POINT_SCION)
|
||||
events.RescheduleEvent(EVENT_DISK_MOVE_NEXT_POINT, 0ms);
|
||||
}
|
||||
|
||||
void DoAction(int32 param) override
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case ACTION_DISK_START_MOVING:
|
||||
if (Vehicle* v = me->GetVehicleKit())
|
||||
if (Unit* pass = v->GetPassenger(0))
|
||||
switch (pass->GetEntry())
|
||||
{
|
||||
case NPC_NEXUS_LORD:
|
||||
{
|
||||
float angle = CenterPos.GetAngle(me);
|
||||
float newangle = angle - 0.5f;
|
||||
if (newangle < 0.0f) newangle += 2 * M_PI;
|
||||
float newz = me->GetPositionZ() - 4.0f;
|
||||
if (newz < CenterPos.GetPositionZ()) newz = CenterPos.GetPositionZ();
|
||||
me->GetMotionMaster()->MovePoint(MI_POINT_NEXUS_LORD, CenterPos.GetPositionX() + cos(newangle) * 22.0f, CenterPos.GetPositionY() + std::sin(newangle) * 22.0f, newz);
|
||||
}
|
||||
break;
|
||||
case NPC_SCION_OF_ETERNITY:
|
||||
{
|
||||
float angle = CenterPos.GetAngle(me);
|
||||
float newangle = angle - 0.3f;
|
||||
if (newangle < 0.0f) newangle += 2 * M_PI;
|
||||
float newz = me->GetPositionZ() - 2.0f;
|
||||
if (newz < CenterPos.GetPositionZ() + 20.0f) newz = CenterPos.GetPositionZ() + 20.0f;
|
||||
me->GetMotionMaster()->MovePoint(MI_POINT_SCION, CenterPos.GetPositionX() + cos(newangle) * 30.0f, CenterPos.GetPositionY() + std::sin(newangle) * 30.0f, newz);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (param != ACTION_DISK_START_MOVING)
|
||||
return;
|
||||
|
||||
if (Vehicle* vehicle = me->GetVehicleKit())
|
||||
if (Unit* pass = vehicle->GetPassenger(0))
|
||||
{
|
||||
if (pass->GetEntry() == NPC_NEXUS_LORD)
|
||||
{
|
||||
float angle = CenterPos.GetAngle(me);
|
||||
float newangle = angle - 0.5f;
|
||||
if (newangle < 0.0f)
|
||||
newangle += 2 * M_PI;
|
||||
float newz = me->GetPositionZ() - 4.0f;
|
||||
if (newz < CenterPos.GetPositionZ())
|
||||
newz = CenterPos.GetPositionZ();
|
||||
me->GetMotionMaster()->MovePoint(MI_POINT_NEXUS_LORD, CenterPos.GetPositionX() + cos(newangle) * 22.0f, CenterPos.GetPositionY() + std::sin(newangle) * 22.0f, newz);
|
||||
}
|
||||
else if (pass->GetEntry() == NPC_SCION_OF_ETERNITY)
|
||||
{
|
||||
float angle = CenterPos.GetAngle(me);
|
||||
float newangle = angle - 0.3f;
|
||||
if (newangle < 0.0f)
|
||||
newangle += 2 * M_PI;
|
||||
float newz = me->GetPositionZ() - 2.0f;
|
||||
if (newz < CenterPos.GetPositionZ() + 20.0f)
|
||||
newz = CenterPos.GetPositionZ() + 20.0f;
|
||||
me->GetMotionMaster()->MovePoint(MI_POINT_SCION, CenterPos.GetPositionX() + cos(newangle) * 30.0f, CenterPos.GetPositionY() + std::sin(newangle) * 30.0f, newz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
events.Update(diff);
|
||||
|
||||
switch (events.ExecuteEvent())
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case EVENT_DISK_MOVE_NEXT_POINT:
|
||||
if (events.ExecuteEvent() == EVENT_DISK_MOVE_NEXT_POINT)
|
||||
DoAction(ACTION_DISK_START_MOVING);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MoveInLineOfSight(Unit* /*who*/) override {}
|
||||
@@ -1194,7 +1184,7 @@ struct npc_hover_disk : public VehicleAI
|
||||
|
||||
struct npc_alexstrasza : public ScriptedAI
|
||||
{
|
||||
npc_alexstrasza(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
npc_alexstrasza(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
me->SetCanFly(true);
|
||||
me->SetDisableGravity(true);
|
||||
@@ -1276,8 +1266,8 @@ struct go_the_focusing_iris : public GameObjectAI
|
||||
|
||||
bool GossipHello(Player* /*user*/, bool /*reportUse*/) override
|
||||
{
|
||||
if (InstanceScript* pInstance = me->GetInstanceScript())
|
||||
pInstance->SetData(DATA_IRIS_ACTIVATED, 0);
|
||||
if (InstanceScript* instance = me->GetInstanceScript())
|
||||
instance->SetData(DATA_IRIS_ACTIVATED, 0);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1292,18 +1282,18 @@ class spell_eoe_ph3_surge_of_power : public SpellScript
|
||||
bool Load() override
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (Creature* c = caster->ToCreature())
|
||||
if (Creature* creature = caster->ToCreature())
|
||||
{
|
||||
uint8 i = 0;
|
||||
std::list<Unit*> drakes;
|
||||
c->AI()->SelectTargetList(drakes, (c->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SelectTargetMethod::Random, 0, 0.0f, false, true, 57403 /*only drakes have this aura*/);
|
||||
creature->AI()->SelectTargetList(drakes, (creature->GetMap()->GetSpawnMode() == 0 ? 1 : 3), SelectTargetMethod::Random, 0, 0.0f, false, true, 57403 /*only drakes have this aura*/);
|
||||
for (std::list<Unit*>::iterator itr = drakes.begin(); itr != drakes.end() && i < 3; ++itr)
|
||||
{
|
||||
DrakeGUID[i++] = (*itr)->GetGUID();
|
||||
if (Vehicle* v = (*itr)->GetVehicleKit())
|
||||
if (Unit* p = v->GetPassenger(0))
|
||||
if (Player* plr = p->ToPlayer())
|
||||
c->AI()->Talk(EMOTE_SURGE_OF_POWER_WARNING_P3, plr);
|
||||
if (Vehicle* vehicle = (*itr)->GetVehicleKit())
|
||||
if (Unit* passenger = vehicle->GetPassenger(0))
|
||||
if (Player* player = passenger->ToPlayer())
|
||||
creature->AI()->Talk(EMOTE_SURGE_OF_POWER_WARNING_P3, player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,10 +54,12 @@ enum NPCs
|
||||
enum Data
|
||||
{
|
||||
DATA_MALYGOS = 0,
|
||||
DATA_IRIS,
|
||||
DATA_EXIT_PORTAL,
|
||||
DATA_NEXUS_PLATFORM,
|
||||
DATA_IRIS_ACTIVATED,
|
||||
DATA_SET_IRIS_INACTIVE,
|
||||
DATA_HIDE_IRIS_AND_PORTAL,
|
||||
DATA_MALYGOS_GUID,
|
||||
};
|
||||
|
||||
enum eSpells
|
||||
|
||||
@@ -21,68 +21,60 @@
|
||||
#include "Vehicle.h"
|
||||
#include "eye_of_eternity.h"
|
||||
|
||||
ObjectData const creatureData[] =
|
||||
{
|
||||
{ NPC_MALYGOS, DATA_MALYGOS },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
ObjectData const gameobjectData[] =
|
||||
{
|
||||
{ GO_IRIS_N, DATA_IRIS },
|
||||
{ GO_IRIS_H, DATA_IRIS },
|
||||
{ GO_EXIT_PORTAL, DATA_EXIT_PORTAL },
|
||||
{ GO_NEXUS_PLATFORM, DATA_NEXUS_PLATFORM },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
struct instance_eye_of_eternity : public InstanceScript
|
||||
{
|
||||
instance_eye_of_eternity(Map* pMap) : InstanceScript(pMap) { Initialize(); }
|
||||
|
||||
ObjectGuid NPC_MalygosGUID;
|
||||
ObjectGuid GO_IrisGUID;
|
||||
ObjectGuid GO_ExitPortalGUID;
|
||||
ObjectGuid GO_PlatformGUID;
|
||||
bool bPokeAchiev;
|
||||
|
||||
void Initialize() override
|
||||
instance_eye_of_eternity(Map* pMap) : InstanceScript(pMap)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
bPokeAchiev = false;
|
||||
LoadObjectData(creatureData, gameobjectData);
|
||||
Initialize();
|
||||
_pokeAchievementValid = false;
|
||||
}
|
||||
|
||||
bool _pokeAchievementValid = false;
|
||||
|
||||
void OnPlayerEnter(Player* player) override
|
||||
{
|
||||
if (GetBossState(DATA_MALYGOS) != DONE)
|
||||
return;
|
||||
|
||||
ProcessEvent(nullptr, EVENT_IRIS_ACTIVATED);
|
||||
if (GameObject* go = instance->GetGameObject(GO_IrisGUID))
|
||||
if (go->GetPhaseMask() != 2)
|
||||
go->SetPhaseMask(2, true);
|
||||
if (GameObject* iris = GetGameObject(DATA_IRIS))
|
||||
if (iris->GetPhaseMask() != 2)
|
||||
iris->SetPhaseMask(2, true);
|
||||
|
||||
if (player && player->IsAlive())
|
||||
player->CastSpell(player, SPELL_SUMMON_RED_DRAGON_BUDDY, true);
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
void OnGameObjectCreate(GameObject* gameobject) override
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_MALYGOS:
|
||||
NPC_MalygosGUID = creature->GetGUID();
|
||||
break;
|
||||
}
|
||||
}
|
||||
InstanceScript::OnGameObjectCreate(gameobject);
|
||||
|
||||
void OnGameObjectCreate(GameObject* go) override
|
||||
{
|
||||
switch (go->GetEntry())
|
||||
uint32 entry = gameobject->GetEntry();
|
||||
if ((entry == GO_IRIS_N || entry == GO_IRIS_H) && GetBossState(DATA_MALYGOS) == DONE)
|
||||
gameobject->SetPhaseMask(2, true);
|
||||
|
||||
if (entry == GO_NEXUS_PLATFORM && GetBossState(DATA_MALYGOS) == DONE)
|
||||
{
|
||||
case GO_IRIS_N:
|
||||
case GO_IRIS_H:
|
||||
GO_IrisGUID = go->GetGUID();
|
||||
if (GetBossState(DATA_MALYGOS) == DONE)
|
||||
go->SetPhaseMask(2, true);
|
||||
break;
|
||||
case GO_EXIT_PORTAL:
|
||||
GO_ExitPortalGUID = go->GetGUID();
|
||||
break;
|
||||
case GO_NEXUS_PLATFORM:
|
||||
GO_PlatformGUID = go->GetGUID();
|
||||
if (GetBossState(DATA_MALYGOS) == DONE)
|
||||
{
|
||||
go->ModifyHealth(-int32(PLATFORM_DESTROY_DAMAGE));
|
||||
go->EnableCollision(false);
|
||||
}
|
||||
break;
|
||||
gameobject->ModifyHealth(-int32(PLATFORM_DESTROY_DAMAGE));
|
||||
gameobject->EnableCollision(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,23 +84,29 @@ struct instance_eye_of_eternity : public InstanceScript
|
||||
{
|
||||
case DATA_IRIS_ACTIVATED:
|
||||
if (GetBossState(DATA_MALYGOS) == NOT_STARTED)
|
||||
if (Creature* c = instance->GetCreature(NPC_MalygosGUID))
|
||||
if (Player* plr = c->SelectNearestPlayer(250.0f))
|
||||
c->AI()->AttackStart(plr);
|
||||
break;
|
||||
case DATA_SET_IRIS_INACTIVE:
|
||||
if (GameObject* go = instance->GetGameObject(GO_IrisGUID))
|
||||
{
|
||||
HandleGameObject(GO_IrisGUID, true, go);
|
||||
if (Creature* c = go->SummonCreature(NPC_WORLD_TRIGGER_LAOI, *go, TEMPSUMMON_TIMED_DESPAWN, 10000))
|
||||
c->CastSpell(c, SPELL_IRIS_ACTIVATED, true);
|
||||
if (Creature* malygos = GetCreature(DATA_MALYGOS))
|
||||
{
|
||||
if (Player* player = malygos->SelectNearestPlayer(250.0f))
|
||||
malygos->AI()->AttackStart(player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DATA_SET_IRIS_INACTIVE:
|
||||
{
|
||||
if (GameObject* iris = GetGameObject(DATA_IRIS))
|
||||
{
|
||||
HandleGameObject(ObjectGuid::Empty, true, iris);
|
||||
if (Creature* trigger = iris->SummonCreature(NPC_WORLD_TRIGGER_LAOI, *iris, TEMPSUMMON_TIMED_DESPAWN, 10000))
|
||||
trigger->CastSpell(trigger, SPELL_IRIS_ACTIVATED, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DATA_HIDE_IRIS_AND_PORTAL:
|
||||
if (GameObject* go = instance->GetGameObject(GO_IrisGUID))
|
||||
go->SetPhaseMask(2, true);
|
||||
if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID))
|
||||
go->SetPhaseMask(2, true);
|
||||
if (GameObject* iris = GetGameObject(DATA_IRIS))
|
||||
iris->SetPhaseMask(2, true);
|
||||
if (GameObject* portal = GetGameObject(DATA_EXIT_PORTAL))
|
||||
portal->SetPhaseMask(2, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -118,63 +116,54 @@ struct instance_eye_of_eternity : public InstanceScript
|
||||
if (!InstanceScript::SetBossState(type, state))
|
||||
return false;
|
||||
|
||||
if (type == DATA_MALYGOS)
|
||||
if (type != DATA_MALYGOS)
|
||||
return true;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case NOT_STARTED:
|
||||
bPokeAchiev = false;
|
||||
if (GameObject* go = instance->GetGameObject(GO_IrisGUID))
|
||||
{
|
||||
go->SetPhaseMask(1, true);
|
||||
HandleGameObject(GO_IrisGUID, false, go);
|
||||
}
|
||||
if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID))
|
||||
go->SetPhaseMask(1, true);
|
||||
if (GameObject* go = instance->GetGameObject(GO_PlatformGUID))
|
||||
{
|
||||
go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, nullptr, true);
|
||||
go->EnableCollision(true);
|
||||
}
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
bPokeAchiev = (instance->GetPlayersCountExceptGMs() < (instance->GetSpawnMode() == 0 ? (uint32)9 : (uint32)21));
|
||||
break;
|
||||
case DONE:
|
||||
bPokeAchiev = false;
|
||||
if (GameObject* go = instance->GetGameObject(GO_ExitPortalGUID))
|
||||
go->SetPhaseMask(1, true);
|
||||
if (Creature* c = instance->GetCreature(NPC_MalygosGUID))
|
||||
c->SummonCreature(NPC_ALEXSTRASZA, 798.0f, 1268.0f, 299.0f, 2.45f, TEMPSUMMON_MANUAL_DESPAWN);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case NOT_STARTED:
|
||||
_pokeAchievementValid = false;
|
||||
if (GameObject* iris = GetGameObject(DATA_IRIS))
|
||||
{
|
||||
iris->SetPhaseMask(1, true);
|
||||
HandleGameObject(iris->GetGUID(), false, iris);
|
||||
}
|
||||
if (GameObject* portal = GetGameObject(DATA_EXIT_PORTAL))
|
||||
portal->SetPhaseMask(1, true);
|
||||
if (GameObject* platform = GetGameObject(DATA_NEXUS_PLATFORM))
|
||||
{
|
||||
platform->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, nullptr, true);
|
||||
platform->EnableCollision(true);
|
||||
}
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
_pokeAchievementValid = (instance->GetPlayersCountExceptGMs() < (instance->GetSpawnMode() == 0 ? (uint32)9 : (uint32)21));
|
||||
break;
|
||||
case DONE:
|
||||
_pokeAchievementValid = false;
|
||||
if (GameObject* portal = GetGameObject(DATA_EXIT_PORTAL))
|
||||
portal->SetPhaseMask(1, true);
|
||||
if (Creature* malygos = GetCreature(DATA_MALYGOS))
|
||||
malygos->SummonCreature(NPC_ALEXSTRASZA, 798.0f, 1268.0f, 299.0f, 2.45f, TEMPSUMMON_MANUAL_DESPAWN);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
ObjectGuid GetGuidData(uint32 type) const override
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DATA_MALYGOS_GUID:
|
||||
return NPC_MalygosGUID;
|
||||
}
|
||||
|
||||
return ObjectGuid::Empty;
|
||||
}
|
||||
|
||||
void ProcessEvent(WorldObject* /*unit*/, uint32 eventId) override
|
||||
{
|
||||
if (eventId == EVENT_IRIS_ACTIVATED)
|
||||
if (GameObject* go = instance->GetGameObject(GO_PlatformGUID))
|
||||
if (Creature* c = instance->GetCreature(NPC_MalygosGUID))
|
||||
{
|
||||
go->ModifyHealth(-int32(PLATFORM_DESTROY_DAMAGE), c);
|
||||
go->EnableCollision(false);
|
||||
}
|
||||
if (eventId != EVENT_IRIS_ACTIVATED)
|
||||
return;
|
||||
|
||||
if (GameObject* platform = GetGameObject(DATA_NEXUS_PLATFORM))
|
||||
if (Creature* malygos = GetCreature(DATA_MALYGOS))
|
||||
{
|
||||
platform->ModifyHealth(-int32(PLATFORM_DESTROY_DAMAGE), malygos);
|
||||
platform->EnableCollision(false);
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* /*target*/, uint32 /*miscvalue1*/) override
|
||||
@@ -183,7 +172,7 @@ struct instance_eye_of_eternity : public InstanceScript
|
||||
{
|
||||
case ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_10:
|
||||
case ACHIEV_CRITERIA_A_POKE_IN_THE_EYE_25:
|
||||
return bPokeAchiev;
|
||||
return _pokeAchievementValid;
|
||||
case ACHIEV_CRITERIA_DENYIN_THE_SCION_10:
|
||||
case ACHIEV_CRITERIA_DENYIN_THE_SCION_25:
|
||||
return source && source->GetVehicle() && source->GetVehicle()->GetVehicleInfo()->m_ID == 224;
|
||||
|
||||
Reference in New Issue
Block a user