Jump to content

Problem :)


Guest Mash6

Recommended Posts

Hi, I know it's probably not the section to post that problem, but I haven't found anything better.

I am searching how-to change the <GM> when a GM type .gm on in his chat.

If anybody know how to modify this, please tell me :)

I know my english is too bad but I'm French, I hope it's possible to understand what I say. ;)

And other thing, I wanna use PVP Rank and in the patch there are :

===================================================================

--- src/game/Player.h (revision 6340)

+++ src/game/Player.h (working copy)

@@ -423,19 +423,40 @@

PLAYER_TITLE_UNUSED2 = 0x40000000

};

+#define PLAYER_TITLE_MASK_ALLIANCE_PVP \\

+ ( PLAYER_TITLE_PRIVATE | PLAYER_TITLE_CORPORAL | \\

+ PLAYER_TITLE_SERGEANT_A | PLAYER_TITLE_MASTER_SERGEANT | \\

+ PLAYER_TITLE_SERGEANT_MAJOR | PLAYER_TITLE_KNIGHT | \\

+ PLAYER_TITLE_KNIGHT_LIEUTENANT | PLAYER_TITLE_KNIGHT_CAPTAIN | \\

+ PLAYER_TITLE_KNIGHT_CHAMPION | PLAYER_TITLE_LIEUTENANT_COMMANDER | \\

+ PLAYER_TITLE_COMMANDER | PLAYER_TITLE_MARSHAL | \\

+ PLAYER_TITLE_FIELD_MARSHAL | PLAYER_TITLE_GRAND_MARSHAL )

+

+#define PLAYER_TITLE_MASK_HORDE_PVP \\

+ ( PLAYER_TITLE_SCOUT | PLAYER_TITLE_GRUNT | \\

+ PLAYER_TITLE_SERGEANT_H | PLAYER_TITLE_SENIOR_SERGEANT | \\

+ PLAYER_TITLE_FIRST_SERGEANT | PLAYER_TITLE_STONE_GUARD | \\

+ PLAYER_TITLE_BLOOD_GUARD | PLAYER_TITLE_LEGIONNAIRE | \\

+ PLAYER_TITLE_CENTURION | PLAYER_TITLE_CHAMPION | \\

+ PLAYER_TITLE_LIEUTENANT_GENERAL | PLAYER_TITLE_GENERAL | \\

+ PLAYER_TITLE_WARLORD | PLAYER_TITLE_HIGH_WARLORD )

+

+#define PLAYER_TITLE_MASK_ALL_PVP \\

+ ( PLAYER_TITLE_MASK_ALLIANCE_PVP | PLAYER_TITLE_MASK_HORDE_PVP )

+

// used for PLAYER__FIELD_KNOWN_TITLES+1 field

enum PlayerKnownTitles2

{

PLAYER_TITLE_UNUSED3 = 0x00000000,

- PLAYER_TITLE_UNUSED4 = 0x00000001,

- PLAYER_TITLE_UNUSED5 = 0x00000002,

- PLAYER_TITLE_UNUSED6 = 0x00000004,

- PLAYER_TITLE_UNUSED7 = 0x00000008,

- PLAYER_TITLE_UNUSED8 = 0x00000010,

- PLAYER_TITLE_UNUSED9 = 0x00000020,

- PLAYER_TITLE_UNUSED10 = 0x00000040,

- PLAYER_TITLE_UNUSED11 = 0x00000080,

- PLAYER_TITLE_UNUSED12 = 0x00000100,

+ PLAYER_TITLE_CHALLENGER = 0x00000001,

+ PLAYER_TITLE_SCARAB_LORD = 0x00000002,

+ PLAYER_TITLE_CONQUEROR = 0x00000004,

+ PLAYER_TITLE_JUSTICAR = 0x00000008,

+ PLAYER_TITLE_CHAMPION_OF_THE_NAARU= 0x00000010,

+ PLAYER_TITLE_MERCILESS_GLADIATOR = 0x00000020,

+ PLAYER_TITLE_OF_THE_SHATTERED_SUN = 0x00000040,

+ PLAYER_TITLE_HAND_OF_ADAL = 0x00000080,

+ PLAYER_TITLE_VENGEFUL_GLADIATOR = 0x00000100,

PLAYER_TITLE_UNUSED13 = 0x00000200,

PLAYER_TITLE_UNUSED14 = 0x00000400,

PLAYER_TITLE_UNUSED15 = 0x00000800,

But Player.h doesn't contain any of the deleted line, I wanna adapt it but I don't know how to without any line that match with the two files

Link to comment
Share on other sites

I've finally found what i wanted on the line

PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> prefix for something?

In Player.h

It just need the creation of .dev on/off command in level1.cpp to verify the rank of the GM who's just use this command and add a rank to have a developer rank and use it only for devs

Thanks a lot for your time, I will post the modification to use <DEV> In-Game

Link to comment
Share on other sites

It's the same as .gm on but the typo is .dev on and it will display <Dev> behind the name, but I think it's better with a specific rank for example : Developer, and only this rank or upper ranks can use this command and set .dev on to them.

I think it will be released in 1 hours about, after we test it in-game if it work correctly. :)

I'm French so my English is so bad, sorry.

Thank you for your work on mangos

Link to comment
Share on other sites

hmm, intresting, it add <dev> in addition to <gm> or replace it?

maybe make some config option and assign at .gm on/off for all gms >= option

It can be good to add this option, but I think it's really better cause some administrators of servers are developers too, so they will use this and with two commands, they can use it and .gm on cause if you don't create an other command, you can .gm on and it will only display <Dev> and there's no solution to have <GM>, or you must set your rank less than Developer Rank

So it's useless

Link to comment
Share on other sites

Hi everybody,

I just finished to code this.

Tested In Game, works very fine.

I didn't modify the .gm command a lot, just the minimum to don't have bugs or things like this.

Here is the code I used :

Add this in Level1.cpp

bool ChatHandler::HandleDevCommand(const char* args)
{
   if(!*args)
   {
       if(m_session->GetPlayer()->isDev())
       {
           m_session->SendNotification(LANG_DEV_ON);
       } else {
           m_session->SendNotification(LANG_DEV_OFF);
       }
       return true;
   }

   std::string argstr = (char*)args;

   if (argstr == "on")
   {
       if(m_session->GetPlayer()->isGameMaster())
       {
           m_session->GetPlayer()->SetGameMaster(false);
           m_session->SendNotification(LANG_GM_OFF);
       }
       m_session->GetPlayer()->SetDev(true);
       m_session->SendNotification(LANG_DEV_ON);
       #ifdef _DEBUG_VMAPS
       VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
       vMapManager->processCommand("stoplog");
       #endif
       return true;
   }

   if (argstr == "off")
   {
       m_session->GetPlayer()->SetDev(false);
       m_session->SendNotification(LANG_DEV_OFF);
       #ifdef _DEBUG_VMAPS
       VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
       vMapManager->processCommand("startlog");
       #endif
       return true;
   }

   SendSysMessage(LANG_USE_BOL);
   SetSentErrorMessage(true);
   return false;
}

Then add this in Chat.cpp

{ "dev",            SEC_ADMINISTRATOR,    false, &ChatHandler::HandleDevCommand,                   "", NULL },

And this to Chat.h

bool HandleDevCommand(const char* args);

Then modify the .gm command like this, in Level1.cpp :

bool ChatHandler::HandleGMCommand(const char* args)
{
   if(!*args)
   {
       if(m_session->GetPlayer()->isGameMaster())
       {
           m_session->SendNotification(LANG_GM_ON);
       } else {
           m_session->SendNotification(LANG_GM_OFF);
       }
       return true;
   }

   std::string argstr = (char*)args;

   if (argstr == "on")
   {
       if(m_session->GetPlayer()->isDev())
       {
           m_session->GetPlayer()->SetDev(false);
           m_session->SendNotification(LANG_DEV_OFF);
       }
       m_session->GetPlayer()->SetGameMaster(true);
       m_session->SendNotification(LANG_GM_ON);
       #ifdef _DEBUG_VMAPS
       VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
       vMapManager->processCommand("stoplog");
       #endif
       return true;
   }

   if (argstr == "off")
   {
       m_session->GetPlayer()->SetGameMaster(false);
       m_session->SendNotification(LANG_GM_OFF);
       #ifdef _DEBUG_VMAPS
       VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
       vMapManager->processCommand("startlog");
       #endif
       return true;
   }

   SendSysMessage(LANG_USE_BOL);
   SetSentErrorMessage(true);
   return false;
}

Then, add this in Player.cpp :

void Player::SetDev(bool on)
{
   if(on)
   {
       m_ExtraFlags |= PLAYER_EXTRA_GM_ON;
       setFaction(35);
       SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);

       CallForAllControlledUnits(SetGameMasterOnHelper(),true,true,true,false);

       SetFFAPvP(false);
       ResetContestedPvP();

       getHostileRefManager().setOnlineOfflineState(false);
       CombatStopWithPets();

       SetPhaseMask(PHASEMASK_ANYWHERE,false);             // see and visible in all phases
   }
   else
   {
       // restore phase
       AuraList const& phases = GetAurasByType(SPELL_AURA_PHASE);
       SetPhaseMask(!phases.empty() ? phases.front()->GetMiscValue() : PHASEMASK_NORMAL,false);

       m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
       setFactionForRace(getRace());
       RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);

       CallForAllControlledUnits(SetGameMasterOffHelper(getFaction()),true,true,true,false);

       // restore FFA PvP Server state
       if(sWorld.IsFFAPvPRealm())
           SetFFAPvP(true);

       // restore FFA PvP area state, remove not allowed for GM mounts
       UpdateArea(m_areaUpdateId);

       getHostileRefManager().setOnlineOfflineState(true);
   }

   m_camera.UpdateVisibilityForOwner();
   UpdateObjectVisibility();
}

Then add this to Player.h :

bool isDev() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; }
void SetDev(bool on);

This have to go in Language.h :

LANG_DEV_ON                          = 20112,
LANG_DEV_OFF                          = 20113,

I used this ids for my core, you can and you should edit this.

And finally, the SQL file :

DELETE FROM `command` WHERE name IN ('dev');
INSERT INTO `command` (name, security, help) VALUES
('dev',3,'Syntaxe: .dev[on/off] Active ou Désactive le mode DEV en jeu.\\r\\n\\r Syntax: .dev [on/off]\\r\\n\\r\\nEnable or Disable in game DEV MODE.'),
DELETE FROM mangos_string WHERE `entry` IN (20044, 20045);
insert into `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) values
(20112,'DEV mode is ON',NULL,'Mode Dev activé',NULL,NULL,NULL,NULL,NULL,NULL),
(20113,'DEV mode is OFF',NULL,'Mode Dev désactivé',NULL,NULL,NULL,NULL,NULL,NULL);

Here you can also edit the command description.

Note that, it's in english and in french ;)

Want to see what happen in game ?

Watch this !

dev_macwarrior.png

Cordially,

MacWarrior.

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