diff options
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
-rwxr-xr-x | src/server/game/Spells/SpellMgr.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 0b8276f2c74..e0f50baba41 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3177,6 +3177,34 @@ bool SpellMgr::CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCast } } + bool isVehicleAura1 = false; + bool isVehicleAura2 = false; + uint8 i = 0; + while (i < MAX_SPELL_EFFECTS && !(isVehicleAura1 && isVehicleAura2)) + { + if (spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_CONTROL_VEHICLE) + isVehicleAura1 = true; + if (spellInfo_2->EffectApplyAuraName[i] == SPELL_AURA_CONTROL_VEHICLE) + isVehicleAura2 = true; + + ++i; + } + + if (isVehicleAura1 && isVehicleAura2) + { + Vehicle* veh = NULL; + if (aura1->GetOwner()->ToUnit()) + veh = aura1->GetOwner()->ToUnit()->GetVehicleKit(); + + if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later + return true; + + if (!veh->GetAvailableSeatCount()) + return false; // No empty seat available + + return true; // Empty seat available (skip rest) + } + uint32 spellId_1 = GetLastSpellInChain(spellInfo_1->Id); uint32 spellId_2 = GetLastSpellInChain(spellInfo_2->Id); |