Make the giant boar Trample kill the cadavers.

This commit is contained in:
luis
2026-09-23 18:11:55 -03:00
parent 1c1756a1b5
commit ee02d40e37
5 changed files with 133 additions and 30 deletions
@@ -104,15 +104,8 @@ public:
}
if (sceneEvent == "Trampling Time")
{
if (Creature* giantBoarVehicle = player->GetVehicleCreatureBase())
{
Position targetLoc = giantBoarVehicle->GetFirstCollisionPosition(20.f, 0.f);
giantBoarVehicle->GetMotionMaster()->MoveCharge(targetLoc.GetPositionX(), targetLoc.GetPositionY(), targetLoc.GetPositionZ());
player->CastSpell(player, SPELL_GIANT_BOAR_TRAMPLE, true);
}
}
}
void OnUpdateArea(Player* player, uint32 newArea, uint32 /*oldArea*/) override
{
@@ -360,6 +360,8 @@ enum ExileReachHelpers
NPC_OGRE_RUINS_TORGOK_FIGHTER_A = 156807,
NPC_OGRE_RUINS_TORGOK_FIGHTER_H = 167145,
NPC_OGRE_RUINS_CADAVER_KILL_CREDIT = 165150,
NPC_OGRE_RUINS_MONSTROUS_CADAVER = 157091,
NPC_OGRE_RUINS_ZOMBIE_SERVANT = 156532,
NPC_OGRE_RUINS_TORGOK = 162817,
NPC_OGRE_RUINS_ALARIA = 156803,
NPC_OGRE_RUINS_BJORN = 154300,
@@ -1158,3 +1160,19 @@ static void CancelExilesReachSceneAuras(Player* player)
if (player->HasAura(SPELL_AMBIENCE_SCENE))
player->RemoveAura(SPELL_AMBIENCE_SCENE);
}
// Neutral pandaren are neither Alliance nor Horde, so the faction phase checks hide every quest giver.
// Horde pandaren stay Horde. Alliance pandaren stay Alliance. A neutral one follows the ship deck they are on.
inline bool ExileUsesHorde(Player const* player)
{
if (!player)
return false;
if (player->GetRace() == RACE_PANDAREN_HORDE || player->IsInHorde())
return true;
if (player->GetRace() == RACE_PANDAREN_ALLIANCE || player->IsInAlliance())
return false;
return player->GetAreaId() == AREA_NORTH_SEA_H;
}
@@ -22,6 +22,7 @@
*/
#include "exiles_reach.h"
#include <list>
class exiles_reach_darkmaul_plains_playerscript : public PlayerScript
{
@@ -43,7 +44,7 @@ public:
if (player->IsInHorde())
{
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, !player->HasAura(SPELL_RESIZER_SLAUGHTER) && !player->GetVehicle() && !player->GetQuestStatus(QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, !player->HasAura(SPELL_RESIZER_SLAUGHTER) && !QuestCompletedOrRewarded(player, QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_GENERAL_OGRE_RUINS_TORGOK }, !QuestCompletedOrRewarded(player, QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_HORDE_DARKMAUL_PLAINS_MITHDRAN }, QuestCompletedOrRewarded(player, QUEST_H_FORBIDDEN_QUILBOAR_NECROMANCY));
WowCommunity::PhaseShift(player, { PHASE_HORDE_DARKMAUL_PLAINS_BREKA }, QuestCompletedOrRewarded(player, QUEST_H_DOWN_WITH_THE_QUILBOAR));
@@ -59,7 +60,7 @@ public:
if (player->IsInAlliance())
{
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, QuestsRewarded(player, { QUEST_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_DOWN_WITH_THE_QUILBOAR }) && !player->HasAura(SPELL_RIDING_GIANT_BOAR) && !player->GetQuestStatus(QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, QuestsRewarded(player, { QUEST_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_DOWN_WITH_THE_QUILBOAR }) && !QuestCompletedOrRewarded(player, QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_GENERAL_OGRE_RUINS_TORGOK }, !QuestCompletedOrRewarded(player, QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_ALLIANCE_HARPY_ROOST_MEREDY_RITUAL }, true);
WowCommunity::PhaseShift(player, { PHASE_ALLIANCE_QUILBOAR_BRIARPATCH_15276, PHASE_ALLIANCE_QUILBOAR_BRIARPATCH_16917 }, player->GetQuestStatus(QUEST_DOWN_WITH_THE_QUILBOAR) != QUEST_STATUS_REWARDED);
@@ -1021,6 +1022,100 @@ public:
}
};
namespace
{
void ChargeGiantBoar(Unit* mover)
{
if (!mover)
return;
Position dest = mover->GetFirstCollisionPosition(20.0f, 0.0f);
mover->GetMotionMaster()->MoveCharge(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ());
}
// Trample is what the vehicle button casts. Cadavers only count when this runs.
void TrampleUndeadInFront(Player* player, Unit* boar)
{
if (!player || !boar || player->GetMapId() != MAP_EXILES_REACH)
return;
uint32 const questId = ExileUsesHorde(player) ? QUEST_H_THE_REDEATHER : QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR;
if (player->GetQuestStatus(questId) != QUEST_STATUS_INCOMPLETE)
return;
ChargeGiantBoar(boar);
std::list<Creature*> undead;
player->GetCreatureListWithEntryInGrid(undead, NPC_OGRE_RUINS_MONSTROUS_CADAVER, 25.0f);
player->GetCreatureListWithEntryInGrid(undead, NPC_OGRE_RUINS_ZOMBIE_SERVANT, 25.0f);
for (Creature* creature : undead)
{
if (!creature || !creature->IsAlive() || !player->CanSeeOrDetect(creature))
continue;
bool const inFront = boar->HasInArc(3.14159265f, creature);
bool const pointBlank = boar->IsWithinDist(creature, 10.0f);
if (!inFront && !pointBlank)
continue;
if (creature->GetEntry() == NPC_OGRE_RUINS_MONSTROUS_CADAVER)
{
uint32 const before = player->GetQuestObjectiveProgress(questId, 2);
Unit::Kill(player, creature);
if (before < 8 && player->GetQuestObjectiveProgress(questId, 2) == before)
player->CastSpell(player, SPELL_CADAVER_KILL_CREDIT, true);
}
else
Unit::Kill(player, creature);
}
if (player->GetQuestObjectiveProgress(questId, 2) >= 8)
player->CastSpell(player, SPELL_GIANT_BOAR_PING_VEHICLE, true);
}
}
// ID - 305557 Trample
class spell_giant_boar_trample_305557 : public SpellScriptLoader
{
public:
spell_giant_boar_trample_305557() : SpellScriptLoader("spell_giant_boar_trample_305557") {}
class spell_giant_boar_trample_305557_SpellScript : public SpellScript
{
void HandleOnCast()
{
Unit* caster = GetCaster();
if (!caster)
return;
Player* player = caster->ToPlayer();
if (!player)
player = caster->GetCharmerOrOwnerPlayerOrPlayerItself();
if (!player)
return;
Unit* boar = player->GetVehicleBase();
if (!boar)
boar = caster->GetVehicleBase();
if (!boar)
boar = caster;
TrampleUndeadInFront(player, boar);
}
void Register() override
{
OnCast += SpellCastFn(spell_giant_boar_trample_305557_SpellScript::HandleOnCast);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_giant_boar_trample_305557_SpellScript();
}
};
// ID - 321627 Charge
class spell_giant_boar_charge_321627 : public SpellScriptLoader
{
@@ -1037,23 +1132,19 @@ public:
if (!caster)
return;
// The ride scene casts this at the boar with no destination. A null dest crashed the worldserver.
float x, y, z;
if (WorldLocation const* loc = GetExplTargetDest())
{
x = loc->GetPositionX();
y = loc->GetPositionY();
z = loc->GetPositionZ();
}
else
{
Position dest = caster->GetFirstCollisionPosition(20.f, 0.f);
x = dest.GetPositionX();
y = dest.GetPositionY();
z = dest.GetPositionZ();
}
// The button is cast by the rider. Charging the rider left the boar in place.
Unit* boar = caster->GetVehicleBase();
if (!boar)
boar = caster;
caster->GetMotionMaster()->MoveCharge(x, y, z);
Player* player = caster->ToPlayer();
if (!player)
player = boar->GetCharmerOrOwnerPlayerOrPlayerItself();
if (player)
TrampleUndeadInFront(player, boar);
else
ChargeGiantBoar(boar);
}
void Register()
@@ -1176,6 +1267,7 @@ void AddSC_exiles_reach_darkmaul_plains()
new spell_resizer_hit_305742();
new spell_riding_giant_boar_305068();
new spell_ride_vehicle_173426();
new spell_giant_boar_trample_305557();
new spell_giant_boar_charge_321627();
new spell_giant_boar_ping_vehicle_305559();
}
@@ -47,7 +47,7 @@ public:
if (player->IsInHorde())
{
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, !player->HasAura(SPELL_RESIZER_SLAUGHTER) && !player->GetVehicle() && !player->GetQuestStatus(QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, !player->HasAura(SPELL_RESIZER_SLAUGHTER) && !QuestCompletedOrRewarded(player, QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_HORDE_OGRE_RUINS_SHUJA_RITUAL }, QuestsRewarded(player, { QUEST_H_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_H_DOWN_WITH_THE_QUILBOAR }) && !QuestCompletedOrRewarded(player, QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_HORDE_OGRE_RUINS_SHUJA_QUEST_REWARDER }, QuestCompleted(player, QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_HORDE_OGRE_RUINS_CAMP_OBJECTS }, QuestCompletedOrRewarded(player, QUEST_H_THE_REDEATHER));
@@ -72,7 +72,7 @@ public:
if (player->IsInAlliance())
{
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, QuestsRewarded(player, { QUEST_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_DOWN_WITH_THE_QUILBOAR }) && !player->HasAura(SPELL_RIDING_GIANT_BOAR) && !player->GetQuestStatus(QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, QuestsRewarded(player, { QUEST_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_DOWN_WITH_THE_QUILBOAR }) && !QuestCompletedOrRewarded(player, QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_ALLIANCE_OGRE_RUINS_HENRY_RITUAL }, QuestsRewarded(player, { QUEST_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_DOWN_WITH_THE_QUILBOAR }) && !QuestCompletedOrRewarded(player, QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_ALLIANCE_HRUNS_BARROW_RALIA_RITUAL }, QuestCompleted(player, QUEST_THE_SCOUT_O_MATIC_5000));
WowCommunity::PhaseShift(player, { PHASE_ALLIANCE_OGRE_RUINS_13395 }, QuestCompleted(player, QUEST_THE_SCOUT_O_MATIC_5000));
@@ -71,7 +71,7 @@ public:
if (player->IsInHorde())
{
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, !player->HasAura(SPELL_RESIZER_SLAUGHTER) && !player->HasAura(SPELL_RIDING_GIANT_BOAR) && !player->GetQuestStatus(QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, !player->HasAura(SPELL_RESIZER_SLAUGHTER) && !QuestCompletedOrRewarded(player, QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_HORDE_OGRE_RUINS_SHUJA_RITUAL }, QuestsRewarded(player, { QUEST_H_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_H_DOWN_WITH_THE_QUILBOAR }) && !QuestCompletedOrRewarded(player, QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_HORDE_OGRE_RUINS_SHUJA_QUEST_REWARDER }, QuestCompleted(player, QUEST_H_THE_REDEATHER));
WowCommunity::PhaseShift(player, { PHASE_HORDE_OGRE_RUINS_CAMP_OBJECTS }, QuestCompletedOrRewarded(player, QUEST_H_THE_REDEATHER));
@@ -92,7 +92,7 @@ public:
if (player->IsInAlliance())
{
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, QuestsRewarded(player, { QUEST_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_DOWN_WITH_THE_QUILBOAR }) && !player->HasAura(SPELL_RIDING_GIANT_BOAR) && !player->GetQuestStatus(QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_GENERAL_DARKMAUL_PLAINS_ZOMBIES_AND_CADAVERS }, QuestsRewarded(player, { QUEST_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_DOWN_WITH_THE_QUILBOAR }) && !QuestCompletedOrRewarded(player, QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_ALLIANCE_OGRE_RUINS_HENRY_RITUAL }, QuestsRewarded(player, { QUEST_FORBIDDEN_QUILBOAR_NECROMANCY, QUEST_DOWN_WITH_THE_QUILBOAR }) && !QuestCompletedOrRewarded(player, QUEST_RIDE_OF_THE_SCIENTIFICALLY_ENHANCED_BOAR));
WowCommunity::PhaseShift(player, { PHASE_ALLIANCE_HRUNS_BARROW_RALIA_RITUAL }, QuestCompleted(player, QUEST_THE_SCOUT_O_MATIC_5000));
WowCommunity::PhaseShift(player, { PHASE_ALLIANCE_OGRE_RUINS_13395 }, QuestCompleted(player, QUEST_THE_SCOUT_O_MATIC_5000));