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:
Hondacrx
2024-09-01 16:23:42 -04:00
parent 03e2904f0d
commit 3945a662eb
2 changed files with 13 additions and 3 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ namespace Game.Entities
// Set or remove correct flags based on available seats. Will overwrite db data (if wrong).
if (UsableSeatNum != 0)
_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);
InitMovementInfoForBase();
+12 -2
View File
@@ -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;