Core/Vehicles: Fixed crashes in StopCastingCharm happening when unit was attempting to enter 2 vehicles at the same time
Closes #9293 Closes #9618
This commit is contained in:
@@ -3263,7 +3263,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
|
||||
if (aura->IsRemoved())
|
||||
return;
|
||||
|
||||
aura->SetIsSingleTarget(caster && aura->GetSpellInfo()->IsSingleTarget());
|
||||
aura->SetIsSingleTarget(caster && (aura->GetSpellInfo()->IsSingleTarget() || aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE)));
|
||||
if (aura->IsSingleTarget())
|
||||
{
|
||||
ASSERT((IsInWorld() && !IsDuringRemoveFromWorld()) || (aura->GetCasterGUID() == GetGUID()));
|
||||
@@ -3274,7 +3274,7 @@ void Unit::_AddAura(UnitAura* aura, Unit* caster)
|
||||
for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
|
||||
{
|
||||
if ((*itr) != aura &&
|
||||
(*itr)->GetSpellInfo()->IsSingleTargetWith(aura->GetSpellInfo()))
|
||||
(*itr)->IsSingleTargetWith(aura))
|
||||
{
|
||||
(*itr)->Remove();
|
||||
itr = scAuras.begin();
|
||||
|
||||
@@ -803,6 +803,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
ASSERT(Target->GetBase()->HasAuraTypeWithCaster(SPELL_AURA_CONTROL_VEHICLE, Passenger->GetGUID()));
|
||||
|
||||
Target->RemovePendingEventsForSeat(Seat->first);
|
||||
Target->RemovePendingEventsForPassenger(Passenger);
|
||||
|
||||
Passenger->SetVehicle(Target);
|
||||
Seat->second.Passenger = Passenger->GetGUID();
|
||||
@@ -835,7 +836,7 @@ bool VehicleJoinEvent::Execute(uint64, uint32)
|
||||
player->UnsummonPetTemporaryIfAny();
|
||||
}
|
||||
|
||||
if (Seat->second.SeatInfo->m_flags && !(Seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_ALLOW_TURNING))
|
||||
if (Seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_HIDE_PASSENGER)
|
||||
Passenger->AddUnitState(UNIT_STATE_ONVEHICLE);
|
||||
|
||||
Passenger->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
|
||||
|
||||
@@ -937,6 +937,31 @@ bool Aura::CanBeSentToClient() const
|
||||
return !IsPassive() || GetSpellInfo()->HasAreaAuraEffect() || HasEffectType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
|
||||
}
|
||||
|
||||
bool Aura::IsSingleTargetWith(Aura const* aura) const
|
||||
{
|
||||
// Same spell?
|
||||
if (GetSpellInfo()->IsRankOf(aura->GetSpellInfo()))
|
||||
return true;
|
||||
|
||||
SpellSpecificType spec = GetSpellInfo()->GetSpellSpecific();
|
||||
// spell with single target specific types
|
||||
switch (spec)
|
||||
{
|
||||
case SPELL_SPECIFIC_JUDGEMENT:
|
||||
case SPELL_SPECIFIC_MAGE_POLYMORPH:
|
||||
if (aura->GetSpellInfo()->GetSpellSpecific() == spec)
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && aura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Aura::UnregisterSingleTarget()
|
||||
{
|
||||
ASSERT(m_isSingleTarget);
|
||||
@@ -1890,7 +1915,7 @@ bool Aura::CanStackWith(Aura const* existingAura) const
|
||||
if (!veh->GetAvailableSeatCount())
|
||||
return false; // No empty seat available
|
||||
|
||||
return !sameCaster; // Empty seat available (skip rest) and different caster
|
||||
return true; // Empty seat available (skip rest)
|
||||
}
|
||||
|
||||
// spell of same spell rank chain
|
||||
|
||||
@@ -165,8 +165,9 @@ class Aura
|
||||
bool IsRemoved() const { return m_isRemoved; }
|
||||
bool CanBeSentToClient() const;
|
||||
// Single cast aura helpers
|
||||
bool IsSingleTarget() const {return m_isSingleTarget;}
|
||||
void SetIsSingleTarget(bool val) { m_isSingleTarget = val;}
|
||||
bool IsSingleTarget() const {return m_isSingleTarget; }
|
||||
bool IsSingleTargetWith(Aura const* aura) const;
|
||||
void SetIsSingleTarget(bool val) { m_isSingleTarget = val; }
|
||||
void UnregisterSingleTarget();
|
||||
int32 CalcDispelChance(Unit* auraTarget, bool offensive) const;
|
||||
|
||||
|
||||
@@ -1212,28 +1212,6 @@ bool SpellInfo::IsSingleTarget() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SpellInfo::IsSingleTargetWith(SpellInfo const* spellInfo) const
|
||||
{
|
||||
// Same spell?
|
||||
if (IsRankOf(spellInfo))
|
||||
return true;
|
||||
|
||||
SpellSpecificType spec = GetSpellSpecific();
|
||||
// spell with single target specific types
|
||||
switch (spec)
|
||||
{
|
||||
case SPELL_SPECIFIC_JUDGEMENT:
|
||||
case SPELL_SPECIFIC_MAGE_POLYMORPH:
|
||||
if (spellInfo->GetSpellSpecific() == spec)
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SpellInfo::IsAuraExclusiveBySpecificWith(SpellInfo const* spellInfo) const
|
||||
{
|
||||
SpellSpecificType spellSpec1 = GetSpellSpecific();
|
||||
|
||||
@@ -413,7 +413,6 @@ public:
|
||||
bool CanDispelAura(SpellInfo const* aura) const;
|
||||
|
||||
bool IsSingleTarget() const;
|
||||
bool IsSingleTargetWith(SpellInfo const* spellInfo) const;
|
||||
bool IsAuraExclusiveBySpecificWith(SpellInfo const* spellInfo) const;
|
||||
bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const* spellInfo) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user