*Remove assertion from packet handler. Assertions should not be put in such places because we can't trust clients nor network.
*Do not allow to charm mounted units. --HG-- branch : trunk
This commit is contained in:
@@ -15204,6 +15204,10 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type)
|
|||||||
if (!charmer)
|
if (!charmer)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// unmount players when charmed
|
||||||
|
if (GetTypeId() == TYPEID_PLAYER)
|
||||||
|
Unmount();
|
||||||
|
|
||||||
assert(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
|
assert(type != CHARM_TYPE_POSSESS || charmer->GetTypeId() == TYPEID_PLAYER);
|
||||||
assert((type == CHARM_TYPE_VEHICLE) == IsVehicle());
|
assert((type == CHARM_TYPE_VEHICLE) == IsVehicle());
|
||||||
|
|
||||||
|
|||||||
@@ -538,11 +538,7 @@ void WorldSession::HandleSpellClick(WorldPacket & recv_data)
|
|||||||
|
|
||||||
// TODO: Unit::SetCharmedBy: 28782 is not in world but 0 is trying to charm it! -> crash
|
// TODO: Unit::SetCharmedBy: 28782 is not in world but 0 is trying to charm it! -> crash
|
||||||
if (!unit->IsInWorld())
|
if (!unit->IsInWorld())
|
||||||
{
|
|
||||||
sLog.outCrash("Spell click target %u is not in world!", unit->GetEntry());
|
|
||||||
assert(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(unit->GetEntry());
|
SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(unit->GetEntry());
|
||||||
for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
||||||
|
|||||||
@@ -3932,9 +3932,6 @@ void AuraEffect::HandleModPossessPet(AuraApplication const * aurApp, uint8 mode,
|
|||||||
if (caster->ToPlayer()->GetPet() != target)
|
if (caster->ToPlayer()->GetPet() != target)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (target->IsVehicle()) //Avoid crash when mind controling vehicles due to an assert in Unit::SetCharmedBy
|
|
||||||
return;
|
|
||||||
|
|
||||||
target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
|
target->SetCharmedBy(caster, CHARM_TYPE_POSSESS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
|||||||
&Spell::EffectActivateObject, // 86 SPELL_EFFECT_ACTIVATE_OBJECT
|
&Spell::EffectActivateObject, // 86 SPELL_EFFECT_ACTIVATE_OBJECT
|
||||||
&Spell::EffectWMODamage, // 87 SPELL_EFFECT_WMO_DAMAGE
|
&Spell::EffectWMODamage, // 87 SPELL_EFFECT_WMO_DAMAGE
|
||||||
&Spell::EffectWMORepair, // 88 SPELL_EFFECT_WMO_REPAIR
|
&Spell::EffectWMORepair, // 88 SPELL_EFFECT_WMO_REPAIR
|
||||||
&Spell::EffectUnused, // 89 SPELL_EFFECT_WMO_CHANGE
|
&Spell::EffectUnused, // 89 SPELL_EFFECT_WMO_CHANGE // 0 intact // 1 damaged // 2 destroyed // 3 rebuilding
|
||||||
&Spell::EffectKillCreditPersonal, // 90 SPELL_EFFECT_KILL_CREDIT Kill credit but only for single person
|
&Spell::EffectKillCreditPersonal, // 90 SPELL_EFFECT_KILL_CREDIT Kill credit but only for single person
|
||||||
&Spell::EffectUnused, // 91 SPELL_EFFECT_THREAT_ALL one spell: zzOLDBrainwash
|
&Spell::EffectUnused, // 91 SPELL_EFFECT_THREAT_ALL one spell: zzOLDBrainwash
|
||||||
&Spell::EffectEnchantHeldItem, // 92 SPELL_EFFECT_ENCHANT_HELD_ITEM
|
&Spell::EffectEnchantHeldItem, // 92 SPELL_EFFECT_ENCHANT_HELD_ITEM
|
||||||
|
|||||||
@@ -5391,6 +5391,9 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
|
if (target->GetTypeId() == TYPEID_UNIT && target->ToCreature()->IsVehicle())
|
||||||
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
return SPELL_FAILED_BAD_IMPLICIT_TARGETS;
|
||||||
|
|
||||||
|
if (target->IsMounted())
|
||||||
|
return SPELL_FAILED_CANT_BE_CHARMED;
|
||||||
|
|
||||||
if (target->GetCharmerGUID())
|
if (target->GetCharmerGUID())
|
||||||
return SPELL_FAILED_CHARMED;
|
return SPELL_FAILED_CHARMED;
|
||||||
|
|
||||||
@@ -6442,6 +6445,8 @@ bool Spell::CheckTarget(Unit* target, uint32 eff)
|
|||||||
case SPELL_AURA_AOE_CHARM:
|
case SPELL_AURA_AOE_CHARM:
|
||||||
if (target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
|
if (target->GetTypeId() == TYPEID_UNIT && target->IsVehicle())
|
||||||
return false;
|
return false;
|
||||||
|
if (target->IsMounted())
|
||||||
|
return false;
|
||||||
if (target->GetCharmerGUID())
|
if (target->GetCharmerGUID())
|
||||||
return false;
|
return false;
|
||||||
if (int32 damage = CalculateDamage(eff, target))
|
if (int32 damage = CalculateDamage(eff, target))
|
||||||
|
|||||||
Reference in New Issue
Block a user