[12660] Implement mount capabilities by Shauren.

Also  update AreaFlags enum, implement mount capabilities check at teleport.

----------------------------
commit is partially based on ec5eabdc69
This commit is contained in:
sanctum32 2013-08-05 23:43:55 +03:00 committed by Antz
parent a253344a02
commit 46d4f07052
8 changed files with 105 additions and 36 deletions

View file

@ -187,7 +187,58 @@ void WorldSession::HandleMoveWorldportAckOpcode()
// mount allow check
if (!mEntry->IsMountAllowed())
{
_player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
_player->RemoveSpellsCausingAura(SPELL_AURA_FLY);
}
else
{
// recheck mount capabilities at far teleport
Unit::AuraList const& mMountAuras = _player->GetAurasByType(SPELL_AURA_MOUNTED);
for (Unit::AuraList::const_iterator itr = mMountAuras.begin(); itr != mMountAuras.end(); )
{
Aura const* aura = *itr;
// mount is no longer suitable
MountCapabilityEntry const* entry = _player->GetMountCapability(aura->GetSpellEffect()->EffectMiscValueB);
if (!entry)
{
_player->RemoveAurasDueToSpell(aura->GetId());
itr = mMountAuras.begin();
continue;
}
// mount capability changed
if (entry->Id != aura->GetModifier()->m_amount)
{
if (MountCapabilityEntry const* oldEntry = sMountCapabilityStore.LookupEntry(aura->GetModifier()->m_amount))
_player->RemoveAurasDueToSpell(oldEntry->SpeedModSpell);
_player->CastSpell(_player, entry->SpeedModSpell, true);
const_cast<Aura*>(aura)->ChangeAmount(entry->Id);
}
++itr;
}
uint32 zone, area;
_player->GetZoneAndAreaId(zone, area);
// recheck fly auras
Unit::AuraList const& mFlyAuras = _player->GetAurasByType(SPELL_AURA_FLY);
for (Unit::AuraList::const_iterator itr = mFlyAuras.begin(); itr != mFlyAuras.end(); )
{
Aura const* aura = *itr;
if (!_player->CanStartFlyInArea(_player->GetMapId(), zone, area))
{
_player->RemoveAurasDueToSpell(aura->GetId());
itr = mFlyAuras.begin();
continue;
}
++itr;
}
}
// honorless target
if (GetPlayer()->pvpInfo.inHostileArea)