Jump to content

Mangos Coding


Guest adriann54

Recommended Posts

I started to learn C++ and I know a little bit.

Is there any kind of tutorial on how to code this thing?

For Example :

if (!caster || caster->GetTypeId() != TYPEID_PLAYER)
return;

What of these things are doing?

( if isn't any caster or caster is not a player then return ? )

Link to comment
Share on other sites

first it's checking to make sure caster exists (not null because the next check would crash, or it would crash later) and then second it's making sure the thing casting the spell is a player or not. If the caster doesnt exist or the spell is being cast by something other than a player, the function ends and doesn't continue.

Link to comment
Share on other sites

I tried to disable PvP in Dalaran ( which I think is a Sanctuary Area ), but I couldn't manage to disable it.

Original Player.cpp:

if(zone->flags & AREA_FLAG_SANCTUARY)                   // in sanctuary
   {
       SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
       if(sWorld.IsFFAPvPRealm())
           SetFFAPvP(false);
   }

Edited Player.cpp

if(zone->flags & AREA_FLAG_SANCTUARY)                   // in sanctuary
   {
       SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
       if(sWorld.IsFFAPvPRealm())
           SetFFAPvP(false);
       pvpInfo.endTimer = time(0);
   }

I also added : UpdatePvP(false);

Link to comment
Share on other sites

×
×
  • 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