ArcEmu: Limit Gm Commands To Some Characters - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Limit Gm Commands To Some Characters

#1 User is offline   Last1 

  • Member
  • Pip
  • Group: Members
  • Posts: 53
  • Joined: 23-November 09
  • Gender:Male

Posted 09 September 2010 - 12:15 PM

This patch allows GM commands to be restricted to characters instead of accounts. To make the first GM set the active_cheats field to 256 in the characters table. As long as the first GM has z permission he can make other characters GMs with ".cheat gm".

I have two realms with one log on server, so I set all the accounts to be GMs below level z and then limit who can use GM commands with this patch. Everyone can use GM commands on the test server but only a few can on the other.

I have not done a lot of testing with this, so all feedback would be appreciated.

Index: src/arcemu-world/Chat.cpp
===================================================================
--- src/arcemu-world/Chat.cpp    (revision 3625)
+++ src/arcemu-world/Chat.cpp    (working copy)
@@ -445,6 +445,7 @@
     {
         { "status",      'm', &ChatHandler::HandleShowCheatsCommand,       "Shows active cheats.",                            NULL, 0, 0, 0 },
         { "taxi",        'm', &ChatHandler::HandleTaxiCheatCommand,        "Enables all taxi nodes.",                         NULL, 0, 0, 0 },
+        { "gm",          'z', &ChatHandler::HandleGmModeCommand,           "Sets character to GM.",                           NULL, 0, 0, 0 },
         { "cooldown",    'm', &ChatHandler::HandleCooldownCheatCommand,    "Enables no cooldown cheat.",                      NULL, 0, 0, 0 },
         { "casttime",    'm', &ChatHandler::HandleCastTimeCheatCommand,    "Enables no cast time cheat.",                     NULL, 0, 0, 0 },
         { "power",       'm', &ChatHandler::HandlePowerCheatCommand,       "Disables mana consumption etc.",                  NULL, 0, 0, 0 },
@@ -806,7 +807,8 @@
 
 bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, WorldSession *m_session)
 {
-    std::string cmd = "";
+    Player * plr = m_session->GetPlayer();
+    std::string cmd = "";
 
     // get command
     while (*text != ' ' && *text != '\0')
@@ -820,6 +822,9 @@
     if(!cmd.length())
         return false;
 
+    if(plr->GmMode == false)
+        return false;
+
     for(uint32 i = 0; table[i].Name != NULL; i++)
     {
         if(!hasStringAbbr(table[i].Name, cmd.c_str()))
Index: src/arcemu-world/Chat.h
===================================================================
--- src/arcemu-world/Chat.h    (revision 3625)
+++ src/arcemu-world/Chat.h    (working copy)
@@ -457,6 +457,7 @@
     bool HandleModifyBitCommand(const char* args, WorldSession* m_session);
     bool HandleBattlegroundExitCommand(const char* args, WorldSession* m_session);
     bool HandleExitInstanceCommand(const char* args, WorldSession* m_session);
+    bool HandleGmModeCommand(const char* args, WorldSession* m_session);
     bool HandleCooldownCheatCommand(const char* args, WorldSession* m_session);
     bool HandleCastTimeCheatCommand(const char* args, WorldSession* m_session);
     bool HandlePowerCheatCommand(const char* args, WorldSession* m_session);
@@ -573,6 +574,8 @@
     bool HandleQuestStartCommand(const char * args, WorldSession * m_session);
     bool HandleQuestStatusCommand(const char * args, WorldSession * m_session);
 
+    bool HandleQuestRequirementCommand(const char * args, WorldSession * m_session);
+    
     /** AI AGENT DEBUG COMMANDS */
     bool HandleAIAgentDebugBegin(const char * args, WorldSession * m_session);
     bool HandleAIAgentDebugContinue(const char * args, WorldSession * m_session);
Index: src/arcemu-world/Level3.cpp
===================================================================
--- src/arcemu-world/Level3.cpp    (revision 3625)
+++ src/arcemu-world/Level3.cpp    (working copy)
@@ -1203,6 +1203,47 @@
     return true;
 }
 
+bool ChatHandler::HandleGmModeCommand(const char* args, WorldSession* m_session)
+{
+    Player * plyr = getSelectedChar(m_session, true);
+    if (!plyr)
+        return true;
+
+    if (!*args)
+    {
+        if (plyr->GmMode)
+            args = "off";
+        else
+            args = "on";
+    }
+
+    if (stricmp(args, "on") == 0)
+    {
+        plyr->GmMode = true;
+        BlueSystemMessage(m_session, "%s is now a GM.", plyr->GetName());
+        GreenSystemMessageToPlr(plyr, "You are a now GM.", m_session->GetPlayer()->GetName());
+    }
+    else if ((stricmp(args, "off") == 0)&&(plyr->GetGUID() != m_session->GetPlayer()->GetGUID()))
+    {
+        //turn off othr cheats when removing GM privileges
+        plyr->GmMode = false;
+        plyr->CooldownCheat = false;
+        plyr->CastTimeCheat = false;
+        plyr->GodModeCheat = false;
+        plyr->PowerCheat = false;
+        plyr->FlyCheat = false;
+        plyr->TriggerpassCheat = false;
+        plyr->ItemStackCheat = false;
+        plyr->m_isGmInvisible = false;
+        plyr->bInvincible = false;
+        BlueSystemMessage(m_session, "%s is no longer a GM.", plyr->GetName());
+        GreenSystemMessageToPlr(plyr, "You are no longer a GM", m_session->GetPlayer()->GetName());
+    }
+    else
+        return false;
+    return true;
+}
+
 bool ChatHandler::HandleCastTimeCheatCommand(const char* args, WorldSession* m_session)
 {
     Player * plyr = getSelectedChar(m_session, true);
@@ -1357,6 +1398,7 @@
         inactive++;
 
     GreenSystemMessage(m_session, "Showing cheat status for: %s", plyr->GetName());
+    print_cheat_status("GM Mode", plyr->GmMode);
     print_cheat_status("Cooldown", plyr->CooldownCheat);
     print_cheat_status("CastTime", plyr->CastTimeCheat);
     print_cheat_status("GodMode", plyr->GodModeCheat);
Index: src/arcemu-world/Player.cpp
===================================================================
--- src/arcemu-world/Player.cpp    (revision 3625)
+++ src/arcemu-world/Player.cpp    (working copy)
@@ -171,6 +171,7 @@
 PowerCheat(false),
 GodModeCheat(false),
 FlyCheat(false),
+GmMode(false),
 
 //FIX for professions
 weapon_proficiency(0x4000), //2^14
@@ -2384,6 +2385,8 @@
         active_cheats |= 0x40;
     if( TriggerpassCheat )
         active_cheats |= 0x80;
+    if( GmMode )
+        active_cheats |= 0x100;
 
     std::stringstream ss;
 
@@ -2938,6 +2941,8 @@
         ItemStackCheat = true;
     if(active_cheats & 0x80)
         TriggerpassCheat = true;
+    if(active_cheats & 0x100)
+        GmMode = true;
 
     // Process exploration data.
     LoadFieldsFromString(get_next_field.GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_LENGTH);
Index: src/arcemu-world/Player.h
===================================================================
--- src/arcemu-world/Player.h    (revision 3625)
+++ src/arcemu-world/Player.h    (working copy)
@@ -1801,6 +1801,7 @@
     void ClearSplinePackets();
     bool ExitInstance();
     void SaveEntryPoint(uint32 mapId);
+    bool GmMode;
     bool CooldownCheat;
     bool CastTimeCheat;
     bool GodModeCheat;

Attached File(s)


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users