[11557] Duel related fixes

* Implement duel allowed check base at proper area flag AREA_FLAG_DUEL (0x00000040)
  This allow duels for example in capital area 4570 and allow/fogbid correctly some other zones and areas.
* Implement duel cancel at leave duel allowed area
* Fixed code for duels work in sunctuary if area allow duels.
This commit is contained in:
VladimirMangos 2011-05-29 01:42:47 +04:00
parent 7205023415
commit 4a087e6bda
8 changed files with 89 additions and 63 deletions

View file

@ -640,14 +640,13 @@ void Spell::FillTargetMap()
break;
}
if(m_caster->GetTypeId() == TYPEID_PLAYER)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
Player *me = (Player*)m_caster;
for (UnitList::const_iterator itr = tmpUnitMap.begin(); itr != tmpUnitMap.end(); ++itr)
{
Unit *owner = (*itr)->GetOwner();
Unit *u = owner ? owner : (*itr);
if(u!=m_caster && u->IsPvP() && (!me->duel || me->duel->opponent != u))
Player *targetOwner = (*itr)->GetCharmerOrOwnerPlayerOrPlayerItself();
if (targetOwner && targetOwner != me && targetOwner->IsPvP() && !me->IsInDuelWith(targetOwner))
{
me->UpdatePvP(true);
me->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);