Jump to content

Changing who you can NOT attack in PvP areas


Recommended Posts

Posted

Normally, in PvP areas like Gurubashi Arena, you cannot attack members of your party. What controls who you cannot attack? Could it be extended to, say, your guild, or your race?

  • 2 weeks later...
Posted

I think the main function to modify are IsHostileTo and IsFriendlyTo in Unit.cpp :

   // special cases (Duel)
   if(tester->GetTypeId()==TYPEID_PLAYER && target->GetTypeId()==TYPEID_PLAYER)
   {
       Player const* pTester = (Player const*)tester;
       Player const* pTarget = (Player const*)target;

       // Duel
       if(pTester->duel && pTester->duel->opponent == target && pTester->duel->startTime != 0)
           return false;

       // Group
       if(pTester->GetGroup() && pTester->GetGroup()==pTarget->GetGroup())
           return true;

       // Sanctuary
       if(pTarget->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY) && pTester->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY))
           return true;

       // PvP FFA state
       if(pTester->IsFFAPvP() && pTarget->IsFFAPvP())
           return false;

       //= PvP states
       // Green/Blue (non-attackable)
       if(pTester->GetTeam()==pTarget->GetTeam())
           return true;

       // Blue (friendly/non-attackable) if not PVP, or Yellow/Red in another case (attackable)
       return !pTarget->IsPvP();
   }

Just add some conditions here, or modify the order of them :)

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use