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:
@@ -42,7 +42,7 @@ namespace Game.Entities
|
|||||||
// Set or remove correct flags based on available seats. Will overwrite db data (if wrong).
|
// Set or remove correct flags based on available seats. Will overwrite db data (if wrong).
|
||||||
if (UsableSeatNum != 0)
|
if (UsableSeatNum != 0)
|
||||||
_me.SetNpcFlag(_me.IsTypeId(TypeId.Player) ? NPCFlags.PlayerVehicle : NPCFlags.SpellClick);
|
_me.SetNpcFlag(_me.IsTypeId(TypeId.Player) ? NPCFlags.PlayerVehicle : NPCFlags.SpellClick);
|
||||||
else
|
else if(unit.m_unitData.InteractSpellID == 0)
|
||||||
_me.RemoveNpcFlag(_me.IsTypeId(TypeId.Player) ? NPCFlags.PlayerVehicle : NPCFlags.SpellClick);
|
_me.RemoveNpcFlag(_me.IsTypeId(TypeId.Player) ? NPCFlags.PlayerVehicle : NPCFlags.SpellClick);
|
||||||
|
|
||||||
InitMovementInfoForBase();
|
InitMovementInfoForBase();
|
||||||
|
|||||||
@@ -4961,13 +4961,23 @@ namespace Game.Spells
|
|||||||
|
|
||||||
int vehicleId = GetMiscValue();
|
int vehicleId = GetMiscValue();
|
||||||
|
|
||||||
|
target.RemoveVehicleKit();
|
||||||
|
|
||||||
if (apply)
|
if (apply)
|
||||||
{
|
{
|
||||||
if (!target.CreateVehicleKit((uint)vehicleId, 0))
|
if (!target.CreateVehicleKit((uint)vehicleId, 0))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (target.GetVehicleKit() != null)
|
else
|
||||||
target.RemoveVehicleKit();
|
{
|
||||||
|
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))
|
if (!target.IsTypeId(TypeId.Player))
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user