mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Vehicle: Fix an assertion when applying SPELL_AURA_SET_VEHICLE_ID on creatures that are already vehicles (#30102)
This commit is contained in:
@@ -52,7 +52,7 @@ UsableSeatNum(0), _me(unit), _vehicleInfo(vehInfo), _creatureEntry(creatureEntry
|
||||
// Set or remove correct flags based on available seats. Will overwrite db data (if wrong).
|
||||
if (UsableSeatNum)
|
||||
_me->SetNpcFlag((_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
|
||||
else
|
||||
else if (!unit->m_unitData->InteractSpellID)
|
||||
_me->RemoveNpcFlag((_me->GetTypeId() == TYPEID_PLAYER ? UNIT_NPC_FLAG_PLAYER_VEHICLE : UNIT_NPC_FLAG_SPELLCLICK));
|
||||
|
||||
InitMovementInfoForBase();
|
||||
|
||||
@@ -5309,13 +5309,19 @@ void AuraEffect::HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode,
|
||||
|
||||
uint32 vehicleId = GetMiscValue();
|
||||
|
||||
target->RemoveVehicleKit();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
if (!target->CreateVehicleKit(vehicleId, 0))
|
||||
return;
|
||||
}
|
||||
else if (target->GetVehicleKit())
|
||||
target->RemoveVehicleKit();
|
||||
else
|
||||
{
|
||||
if (Creature* creature = target->ToCreature())
|
||||
if (uint32 originalVehicleId = creature->GetCreatureTemplate()->VehicleId)
|
||||
creature->CreateVehicleKit(originalVehicleId, creature->GetEntry());
|
||||
}
|
||||
|
||||
if (target->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user