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
+1 -1
View File
@@ -239,7 +239,7 @@ enum AreaFlags
AREA_FLAG_SLAVE_CAPITAL = 0x00000008, // city and city subsones
AREA_FLAG_UNK3 = 0x00000010, // can't find common meaning
AREA_FLAG_SLAVE_CAPITAL2 = 0x00000020, // slave capital city flag?
AREA_FLAG_UNK4 = 0x00000040, // many zones have this flag
AREA_FLAG_ALLOW_DUELS = 0x00000040, // allow to duel here
AREA_FLAG_ARENA = 0x00000080, // arena, both instanced and world arenas
AREA_FLAG_CAPITAL = 0x00000100, // main capital city flag
AREA_FLAG_CITY = 0x00000200, // only for one zone named "City" (where it located?)
+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;