Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/GmCommands.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "Player.h"
#include "PlayerScript.h"
#include "ScriptMgr.h"
#include "Chat.h"
#include "ChatCommand.h"
Expand Down Expand Up @@ -85,8 +86,39 @@ class mod_gm_commands_worldscript : public WorldScript
}
};

class mod_gm_commands_playerscript : public PlayerScript
{
public:
mod_gm_commands_playerscript() : PlayerScript("mod_gm_commands_playerscript") {}

void OnPlayerSetServerSideVisibility(Player* player, ServerSideVisibilityType& type, AccountTypes& sec) override
{
if (type != SERVERSIDE_VISIBILITY_GM)
return;

if (!player || player->isGMVisible())
return;

WorldSession* session = player->GetSession();
if (!session)
return;

if (!sGMCommands->IsAccountAllowed(session->GetAccountId()))
return;

if (sec != SEC_PLAYER)
return;

if (!sGMCommands->IsCommandAllowed("gm") && !sGMCommands->IsCommandAllowed("gm visible"))
return;

sec = SEC_GAMEMASTER;
}
};

void AddGmCommandScripts()
{
new GmCommands();
new mod_gm_commands_worldscript();
new mod_gm_commands_playerscript();
}
Loading