mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +00:00
fix(Scripts/TrialOfChampion): fail and send custom spell error when trying to mount without lance equipped (#19932)
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
|
||||
enum MountSpells
|
||||
{
|
||||
SPELL_LANCE_EQUIPPED = 62853,
|
||||
SPELL_PLAYER_VEHICLE_DEFEND = 66482,
|
||||
SPELL_MINIONS_DEFEND = 64100,
|
||||
SPELL_BOSS_DEFEND = 62719,
|
||||
@@ -152,16 +153,9 @@ public:
|
||||
return GetTrialOfTheChampionAI<npc_toc5_player_vehicleAI>(pCreature);
|
||||
}
|
||||
|
||||
struct npc_toc5_player_vehicleAI : public NullCreatureAI
|
||||
struct npc_toc5_player_vehicleAI : public VehicleAI
|
||||
{
|
||||
npc_toc5_player_vehicleAI(Creature* pCreature) : NullCreatureAI(pCreature)
|
||||
{
|
||||
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
|
||||
m_ConditionsTimer = 1000;
|
||||
}
|
||||
|
||||
ConditionList conditions;
|
||||
uint16 m_ConditionsTimer;
|
||||
npc_toc5_player_vehicleAI(Creature* creature) : VehicleAI(creature) { }
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
@@ -203,23 +197,25 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//void EnterEvadeMode() { CreatureAI::EnterEvadeMode(); }
|
||||
void MoveInLineOfSight(Unit* /*who*/) override {}
|
||||
void UpdateAI(uint32 diff) override
|
||||
bool BeforeSpellClick(Unit* clicker) override
|
||||
{
|
||||
if (m_ConditionsTimer <= diff)
|
||||
{
|
||||
if (!conditions.empty())
|
||||
if (Unit* passenger = me->GetVehicleKit()->GetPassenger(0))
|
||||
if (!sConditionMgr->IsObjectMeetToConditions(passenger, me, conditions))
|
||||
passenger->ExitVehicle();
|
||||
m_ConditionsTimer = VEHICLE_CONDITION_CHECK_TIME;
|
||||
}
|
||||
else
|
||||
m_ConditionsTimer -= diff;
|
||||
if (!clicker->IsPlayer())
|
||||
return true;
|
||||
|
||||
if (clicker->IsInDisallowedMountForm())
|
||||
clicker->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
if (clicker->HasAura(SPELL_LANCE_EQUIPPED))
|
||||
return true;
|
||||
|
||||
WorldPacket data(SMSG_CAST_FAILED, 1 + 4 + 1);
|
||||
data << uint8(0); // single cast or multi 2.3 (0/1)
|
||||
data << uint32(VEHICLE_SPELL_RIDE_HARDCODED);
|
||||
data << uint8(SPELL_FAILED_CUSTOM_ERROR);
|
||||
data << uint32(SPELL_CUSTOM_ERROR_MUST_HAVE_LANCE_EQUIPPED);
|
||||
clicker->ToPlayer()->GetSession()->SendPacket(&data);
|
||||
return false;
|
||||
}
|
||||
void AttackStart(Unit* /*who*/) override {}
|
||||
void JustEngagedWith(Unit* /*who*/) override {}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user