Core/Players: Implemented AREA_FLAG_ALLOW_DUELS. Duels should be possible only at areas with this flag. Tnx to Destalker for pointing out this flag

This commit is contained in:
tobmaps
2011-05-29 02:40:37 +07:00
parent fade2383cc
commit 9f1a4f33c0
2 changed files with 6 additions and 14 deletions
+5 -13
View File
@@ -5397,24 +5397,16 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUIDLow()))
return;
// Players can only fight a duel with each other outside (=not inside dungeons and not in capital cities)
// Don't have to check the target's map since you cannot challenge someone across maps
if (caster->GetMap()->Instanceable())
//if (mapid != 0 && mapid != 1 && mapid != 530 && mapid != 571 && mapid != 609)
// Players can only fight a duel in zones with this flag
AreaTableEntry const* casterAreaEntry = GetAreaEntryByAreaID(caster->GetAreaId());
if (casterAreaEntry && !(casterAreaEntry->flags & AREA_FLAG_ALLOW_DUELS))
{
SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
return;
}
AreaTableEntry const* casterAreaEntry = GetAreaEntryByAreaID(caster->GetZoneId());
if (casterAreaEntry && (casterAreaEntry->flags & AREA_FLAG_CAPITAL))
{
SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
return;
}
AreaTableEntry const* targetAreaEntry = GetAreaEntryByAreaID(target->GetZoneId());
if (targetAreaEntry && (targetAreaEntry->flags & AREA_FLAG_CAPITAL))
AreaTableEntry const* targetAreaEntry = GetAreaEntryByAreaID(target->GetAreaId());
if (targetAreaEntry && !(targetAreaEntry->flags & AREA_FLAG_ALLOW_DUELS))
{
SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
return;