mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-07 21:01:37 +00:00
feat(Scripts/Commands): Allow using packetlog command from console (#24406)
This commit is contained in:
@@ -195,7 +195,7 @@ public:
|
|||||||
{ "string", HandleStringCommand, SEC_GAMEMASTER, Console::No },
|
{ "string", HandleStringCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "opendoor", HandleOpenDoorCommand, SEC_GAMEMASTER, Console::No },
|
{ "opendoor", HandleOpenDoorCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "bm", HandleBMCommand, SEC_GAMEMASTER, Console::No },
|
{ "bm", HandleBMCommand, SEC_GAMEMASTER, Console::No },
|
||||||
{ "packetlog", HandlePacketLog, SEC_GAMEMASTER, Console::No }
|
{ "packetlog", HandlePacketLog, SEC_GAMEMASTER, Console::Yes }
|
||||||
};
|
};
|
||||||
|
|
||||||
return commandTable;
|
return commandTable;
|
||||||
@@ -3109,9 +3109,19 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HandlePacketLog(ChatHandler* handler, Optional<bool> enableArg)
|
static bool HandlePacketLog(ChatHandler* handler, Optional<PlayerIdentifier> target, Optional<bool> enableArg)
|
||||||
{
|
{
|
||||||
WorldSession* session = handler->GetSession();
|
if (!target)
|
||||||
|
target = PlayerIdentifier::FromTargetOrSelf(handler);
|
||||||
|
|
||||||
|
if (!target || !target->IsConnected())
|
||||||
|
{
|
||||||
|
handler->SendErrorMessage(LANG_PLAYER_NOT_FOUND);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player* playerTarget = target->GetConnectedPlayer();
|
||||||
|
WorldSession* session = playerTarget->GetSession();
|
||||||
|
|
||||||
if (!session)
|
if (!session)
|
||||||
return false;
|
return false;
|
||||||
@@ -3121,13 +3131,13 @@ public:
|
|||||||
if (*enableArg)
|
if (*enableArg)
|
||||||
{
|
{
|
||||||
session->SetPacketLogging(true);
|
session->SetPacketLogging(true);
|
||||||
handler->SendNotification(LANG_ON);
|
handler->PSendSysMessage("Packet logging enabled for {}.", playerTarget->GetName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
session->SetPacketLogging(false);
|
session->SetPacketLogging(false);
|
||||||
handler->SendNotification(LANG_OFF);
|
handler->PSendSysMessage("Packet logging disabled for {}.", playerTarget->GetName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user