File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 11#include " Player.h"
2+ #include " PlayerScript.h"
23#include " ScriptMgr.h"
34#include " Chat.h"
45#include " ChatCommand.h"
@@ -85,8 +86,39 @@ class mod_gm_commands_worldscript : public WorldScript
8586 }
8687};
8788
89+ class mod_gm_commands_playerscript : public PlayerScript
90+ {
91+ public:
92+ mod_gm_commands_playerscript () : PlayerScript(" mod_gm_commands_playerscript" ) {}
93+
94+ void OnPlayerSetServerSideVisibility (Player* player, ServerSideVisibilityType& type, AccountTypes& sec) override
95+ {
96+ if (type != SERVERSIDE_VISIBILITY_GM)
97+ return ;
98+
99+ if (!player || player->isGMVisible ())
100+ return ;
101+
102+ WorldSession* session = player->GetSession ();
103+ if (!session)
104+ return ;
105+
106+ if (!sGMCommands ->IsAccountAllowed (session->GetAccountId ()))
107+ return ;
108+
109+ if (sec != SEC_PLAYER)
110+ return ;
111+
112+ if (!sGMCommands ->IsCommandAllowed (" gm" ) && !sGMCommands ->IsCommandAllowed (" gm visible" ))
113+ return ;
114+
115+ sec = SEC_GAMEMASTER;
116+ }
117+ };
118+
88119void AddGmCommandScripts ()
89120{
90121 new GmCommands ();
91122 new mod_gm_commands_worldscript ();
123+ new mod_gm_commands_playerscript ();
92124}
You can’t perform that action at this time.
0 commit comments