Jump to content

Mangos Coding


Recommended Posts

Posted

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 ? )

Posted

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.

Posted

No tutoriel except this forum and some comment on the code.

Like you see knowing some language like C++ is not enought to fast understaind large project like Mangos. But with some reading and testing you/we/i can understaind more everyday :)

Posted

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);

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