mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 18:24:12 +00:00
feat: slashcommands for showall, findplayer, get/openhttpmoninfo, and debug world packet (#1545)
* feat: showall, findplayer, get/openhttpmoninfo http monitor info is planned to be used later, just putting in info that i've since reverse engineered and don't want lost Additionally add debug world packet for duture dev use Tested all new commands and variation of command arguments * fix missing newline at eofs * address most feedback * Compormise and use struct with (de)serialize * remove httpmoninfo commands
This commit is contained in:
@@ -878,8 +878,26 @@ void SlashCommandHandler::Startup() {
|
||||
};
|
||||
RegisterCommand(TitleCommand);
|
||||
|
||||
Command ShowAllCommand{
|
||||
.help = "Show all online players across World Servers",
|
||||
.info = "Usage: /showall (displayZoneData: Default 1) (displayIndividualPlayers: Default 1)",
|
||||
.aliases = { "showall" },
|
||||
.handle = GMGreaterThanZeroCommands::ShowAll,
|
||||
.requiredLevel = eGameMasterLevel::JUNIOR_MODERATOR
|
||||
};
|
||||
RegisterCommand(ShowAllCommand);
|
||||
|
||||
Command FindPlayerCommand{
|
||||
.help = "Find the World Server a player is in if they are online",
|
||||
.info = "Find the World Server a player is in if they are online",
|
||||
.aliases = { "findplayer" },
|
||||
.handle = GMGreaterThanZeroCommands::FindPlayer,
|
||||
.requiredLevel = eGameMasterLevel::JUNIOR_MODERATOR
|
||||
};
|
||||
RegisterCommand(FindPlayerCommand);
|
||||
|
||||
// Register GM Zero Commands
|
||||
|
||||
Command HelpCommand{
|
||||
.help = "Display command info",
|
||||
.info = "If a command is given, display detailed info on that command. Otherwise display a list of commands with short desctiptions.",
|
||||
|
@@ -70,4 +70,4 @@ namespace DEVGMCommands {
|
||||
void RollLoot(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
void CastSkill(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
void DeleteInven(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
}
|
||||
}
|
||||
|
@@ -287,4 +287,39 @@ namespace GMGreaterThanZeroCommands {
|
||||
std::string name = entity->GetCharacter()->GetName() + " - " + args;
|
||||
GameMessages::SendSetName(entity->GetObjectID(), GeneralUtils::UTF8ToUTF16(name), UNASSIGNED_SYSTEM_ADDRESS);
|
||||
}
|
||||
|
||||
void ShowAll(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||
bool displayZoneData = true;
|
||||
bool displayIndividualPlayers = true;
|
||||
const auto splitArgs = GeneralUtils::SplitString(args, ' ');
|
||||
|
||||
if (!splitArgs.empty() && !splitArgs.at(0).empty()) displayZoneData = splitArgs.at(0) == "1";
|
||||
if (splitArgs.size() > 1) displayIndividualPlayers = splitArgs.at(1) == "1";
|
||||
|
||||
ShowAllRequest request {
|
||||
.requestor = entity->GetObjectID(),
|
||||
.displayZoneData = displayZoneData,
|
||||
.displayIndividualPlayers = displayIndividualPlayers
|
||||
};
|
||||
|
||||
CBITSTREAM;
|
||||
request.Serialize(bitStream);
|
||||
Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false);
|
||||
}
|
||||
|
||||
void FindPlayer(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||
if (args.empty()) {
|
||||
GameMessages::SendSlashCommandFeedbackText(entity, u"No player Given");
|
||||
return;
|
||||
}
|
||||
|
||||
FindPlayerRequest request {
|
||||
.requestor = entity->GetObjectID(),
|
||||
.playerName = LUWString(args)
|
||||
};
|
||||
|
||||
CBITSTREAM;
|
||||
request.Serialize(bitStream);
|
||||
Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false);
|
||||
}
|
||||
}
|
||||
|
@@ -10,4 +10,6 @@ namespace GMGreaterThanZeroCommands {
|
||||
void GmInvis(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
void SetName(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
void Title(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
}
|
||||
void ShowAll(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
void FindPlayer(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
}
|
||||
|
Reference in New Issue
Block a user