Core/Vehicle: Fix an assertion when applying SPELL_AURA_SET_VEHICLE_ID on creatures that are already vehicles
Port From (https://github.com/TrinityCore/TrinityCore/commit/53f0f2e5da3e7e6a9e6fa926e2f51ac8b506caa9)
This commit is contained in:
@@ -4961,13 +4961,23 @@ namespace Game.Spells
|
||||
|
||||
int vehicleId = GetMiscValue();
|
||||
|
||||
target.RemoveVehicleKit();
|
||||
|
||||
if (apply)
|
||||
{
|
||||
if (!target.CreateVehicleKit((uint)vehicleId, 0))
|
||||
return;
|
||||
}
|
||||
else if (target.GetVehicleKit() != null)
|
||||
target.RemoveVehicleKit();
|
||||
else
|
||||
{
|
||||
Creature creature = target.ToCreature();
|
||||
if (creature != null)
|
||||
{
|
||||
uint originalVehicleId = creature.GetCreatureTemplate().VehicleId;
|
||||
if (originalVehicleId != 0)
|
||||
creature.CreateVehicleKit(originalVehicleId, creature.GetEntry());
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user