Hi i wanna make a core mod that will remove all pvp flags when you enter a certain zone or if you are in a certain zone

Example: you are in a contested area and another player comes but he is pvp flaged and when he enters his flags will be removed and he won't be able to attack the other players

Player.cpp

void Player::UpdateArea(uint32 newArea) 
{ 
      // FFA_PVP flags are area and not zone id dependent 
      // so apply them accordingly 
      m_areaUpdateId    = newArea; 

      AreaTableEntry const* area = GetAreaEntryByAreaID(newArea); 
      pvpInfo.inFFAPvPArea = area && (area->flags & AREA_FLAG_ARENA); 
      UpdatePvPState(true); 

      UpdateAreaDependentAuras(newArea); 

      // previously this was in UpdateZone (but after UpdateArea) so nothing will break 
      pvpInfo.inNoPvPArea = false; 
      if (area && area->IsSanctuary())    // in sanctuary 
      { 
          SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY); 
          pvpInfo.inNoPvPArea = true; 
          CombatStopWithPets(); 
      } 
      else 
          RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
  if (area && area->ID == id Zona) 
     { 
          SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); 
     }

All that I could find. In principle, it is possible to make.

3.3.5 patch...

if (area && area->mapid == map)
     {
          SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);
     }

5 (edited by Baynar 2016-06-23 12:03:31)

Seems like some zones cannot be flaged as sanctuary

EDIT: Problem as that some areas even if flagged as Sanctuary in AreaTable.dbc they are not being flagged as Sanctuary

My example in AreaTable.dbc i flagged zone as Sanctuary but ingame the zones WAS a Sanctuary about 50% zone flag was missing but players could not do damage to other player but can still attack them so i had to make it like this

if (zone->flags & AREA_FLAG_SANCTUARY || GetAreaId() == 2408)                   // in sanctuary

cause the flag was not placed from the database

Use NORMAL realm type insetad of PvP - this should fix your issue.

"A little hard-work never killed anyone important." - Abe