All help text

This commit is contained in:
Aaron Kimbre 2024-04-02 23:53:30 -05:00
parent 6ed85badd8
commit a447f1ce72

View File

@ -107,6 +107,36 @@ void SlashCommandHandler::RegisterCommand(Command command) {
CommandInfos.push_back(command); CommandInfos.push_back(command);
}; };
void SlashCommandHandler::HandleChatCommand(const std::u16string& chat, Entity* entity, const SystemAddress& sysAddr) {
auto input = GeneralUtils::UTF16ToWTF8(chat);
if (input.empty() || input.front() != u'/') return;
std::string command = input.substr(1, input.find(' ') - 1);
std::string args = input.substr(input.find(' ') + 1, std::string::npos);
if (args.front() == '/') args.clear();
LOG("Handling command \"%s\" with args \"%s\"", command.c_str(), args.c_str());
if (RegisteredCommands.contains(command)) {
if (entity->GetGMLevel() >= RegisteredCommands[command].requiredLevel) {
Database::Get()->InsertSlashCommandUsage(entity->GetObjectID(), input);
RegisteredCommands[command].handle(entity, sysAddr, args);
return;
} else {
// We don't need to tell normies they aren't high enough level
if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) return;
std::ostringstream feedback;
feedback << "You are not high enough GM level to use " << std::quoted(command) << "";
GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(feedback.str()));
}
} else {
// We don't need to tell normies commands don't exist
if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) return;
std::ostringstream feedback;
feedback << "Command " << std::quoted(command) << " does not exist!";
GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(feedback.str()));
}
}
void SlashCommandHandler::Startup() { void SlashCommandHandler::Startup() {
// Register Dev Commands // Register Dev Commands
@ -191,35 +221,35 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ShutdownUniverseCommand); RegisterCommand(ShutdownUniverseCommand);
Command SetMinifigCommand { Command SetMinifigCommand {
.help = "", .help = "Alters your player's minifig",
.info = "", .info = "Alters your player's minifig. Body part can be one of \"Eyebrows\", \"Eyes\", \"HairColor\", \"HairStyle\", \"Pants\", \"LeftHand\", \"Mouth\", \"RightHand\", \"Shirt\", or \"Hands\". Changing minifig parts could break the character so this command is limited to GMs.",
.aliases = { "setminifig" }, .aliases = { "setminifig" },
.handle = DEVGMCommands::SetMinifig, .handle = DEVGMCommands::SetMinifig,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::FORUM_MODERATOR
}; };
RegisterCommand(SetMinifigCommand); RegisterCommand(SetMinifigCommand);
Command TestMapCommand { Command TestMapCommand {
.help = "", .help = "Transfers you to the given zone",
.info = "", .info = "Transfers you to the given zone by id and clone id. Add \"force\" to skip checking if the zone is accessible (this can softlock your character, though, if you e.g. try to teleport to Frostburgh).",
.aliases = { "testmap", "tm" }, .aliases = { "testmap", "tm" },
.handle = DEVGMCommands::TestMap, .handle = DEVGMCommands::TestMap,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::FORUM_MODERATOR
}; };
RegisterCommand(TestMapCommand); RegisterCommand(TestMapCommand);
Command ReportProxPhysCommand { Command ReportProxPhysCommand {
.help = "", .help = "Display proximity sensor info",
.info = "", .info = "Prints to console the position and radius of proximity sensors.",
.aliases = { "reportproxphys" }, .aliases = { "reportproxphys" },
.handle = DEVGMCommands::ReportProxPhys, .handle = DEVGMCommands::ReportProxPhys,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::OPERATOR
}; };
RegisterCommand(ReportProxPhysCommand); RegisterCommand(ReportProxPhysCommand);
Command SpawnPhysicsVertsCommand { Command SpawnPhysicsVertsCommand {
.help = "", .help = "Spawns a 1x1 brick at all vertices of phantom physics objects",
.info = "", .info = "Spawns a 1x1 brick at all vertices of phantom physics objects",
.aliases = { "spawnphysicsverts" }, .aliases = { "spawnphysicsverts" },
.handle = DEVGMCommands::SpawnPhysicsVerts, .handle = DEVGMCommands::SpawnPhysicsVerts,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -227,17 +257,17 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SpawnPhysicsVertsCommand); RegisterCommand(SpawnPhysicsVertsCommand);
Command TeleportCommand { Command TeleportCommand {
.help = "", .help = "Teleports you",
.info = "", .info = "Teleports you. If no Y is given, you are teleported to the height of the terrain or physics object at (x, z)",
.aliases = { "teleport", "tele", "tp" }, .aliases = { "teleport", "tele", "tp" },
.handle = DEVGMCommands::Teleport, .handle = DEVGMCommands::Teleport,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::JUNIOR_DEVELOPER
}; };
RegisterCommand(TeleportCommand); RegisterCommand(TeleportCommand);
Command ActivateSpawnerCommand { Command ActivateSpawnerCommand {
.help = "", .help = "Activates spawner by name",
.info = "", .info = "Activates spawner by name",
.aliases = { "activatespawner" }, .aliases = { "activatespawner" },
.handle = DEVGMCommands::ActivateSpawner, .handle = DEVGMCommands::ActivateSpawner,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -245,8 +275,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ActivateSpawnerCommand); RegisterCommand(ActivateSpawnerCommand);
Command AddMissionCommand { Command AddMissionCommand {
.help = "", .help = "Accepts the mission, adding it to your journal.",
.info = "", .info = "Accepts the mission, adding it to your journal.",
.aliases = { "addmission" }, .aliases = { "addmission" },
.handle = DEVGMCommands::AddMission, .handle = DEVGMCommands::AddMission,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -254,8 +284,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(AddMissionCommand); RegisterCommand(AddMissionCommand);
Command BoostCommand { Command BoostCommand {
.help = "", .help = "Adds boost to a vehicle",
.info = "", .info = "Adds a passive boost action if you are in a vehicle. If time is given it will end after that amount of time",
.aliases = { "boost" }, .aliases = { "boost" },
.handle = DEVGMCommands::Boost, .handle = DEVGMCommands::Boost,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -263,8 +293,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(BoostCommand); RegisterCommand(BoostCommand);
Command UnboostCommand { Command UnboostCommand {
.help = "", .help = "Removes a passive vehicle boost",
.info = "", .info = "Removes a passive vehicle boost",
.aliases = { "unboost" }, .aliases = { "unboost" },
.handle = DEVGMCommands::Unboost, .handle = DEVGMCommands::Unboost,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -272,8 +302,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(UnboostCommand); RegisterCommand(UnboostCommand);
Command BuffCommand { Command BuffCommand {
.help = "", .help = "Applies a buff",
.info = "", .info = "Applies a buff with the given id for the given number of seconds",
.aliases = { "buff" }, .aliases = { "buff" },
.handle = DEVGMCommands::Buff, .handle = DEVGMCommands::Buff,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -281,8 +311,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(BuffCommand); RegisterCommand(BuffCommand);
Command BuffMeCommand { Command BuffMeCommand {
.help = "", .help = "Sets health, armor, and imagination to 999",
.info = "", .info = "Sets health, armor, and imagination to 999",
.aliases = { "buffme" }, .aliases = { "buffme" },
.handle = DEVGMCommands::BuffMe, .handle = DEVGMCommands::BuffMe,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -290,8 +320,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(BuffMeCommand); RegisterCommand(BuffMeCommand);
Command BuffMedCommand { Command BuffMedCommand {
.help = "", .help = "Sets health, armor, and imagination to 9",
.info = "", .info = "Sets health, armor, and imagination to 9",
.aliases = { "buffmed" }, .aliases = { "buffmed" },
.handle = DEVGMCommands::BuffMed, .handle = DEVGMCommands::BuffMed,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -299,8 +329,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(BuffMedCommand); RegisterCommand(BuffMedCommand);
Command ClearFlagCommand { Command ClearFlagCommand {
.help = "", .help = "Clear a player flag",
.info = "", .info = "Removes the given health or inventory flag from your player. Equivalent of calling `/setflag off <flag id>`",
.aliases = { "clearflag" }, .aliases = { "clearflag" },
.handle = DEVGMCommands::ClearFlag, .handle = DEVGMCommands::ClearFlag,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -308,8 +338,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ClearFlagCommand); RegisterCommand(ClearFlagCommand);
Command CompleteMissionCommand { Command CompleteMissionCommand {
.help = "", .help = "Completes the mission",
.info = "", .info = "Completes the mission, removing it from your journal",
.aliases = { "completemission" }, .aliases = { "completemission" },
.handle = DEVGMCommands::CompleteMission, .handle = DEVGMCommands::CompleteMission,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -317,8 +347,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(CompleteMissionCommand); RegisterCommand(CompleteMissionCommand);
Command CreatePrivateCommand { Command CreatePrivateCommand {
.help = "", .help = "Creates a private zone with password",
.info = "", .info = "Creates a private zone with password",
.aliases = { "createprivate" }, .aliases = { "createprivate" },
.handle = DEVGMCommands::CreatePrivate, .handle = DEVGMCommands::CreatePrivate,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -326,8 +356,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(CreatePrivateCommand); RegisterCommand(CreatePrivateCommand);
Command DebugUiCommand { Command DebugUiCommand {
.help = "", .help = "Toggle Debug UI",
.info = "", .info = "Toggle Debug UI",
.aliases = { "debugui" }, .aliases = { "debugui" },
.handle = DEVGMCommands::DebugUi, .handle = DEVGMCommands::DebugUi,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -335,8 +365,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(DebugUiCommand); RegisterCommand(DebugUiCommand);
Command DismountCommand { Command DismountCommand {
.help = "", .help = "Dismounts you from the vehicle or mount",
.info = "", .info = "Dismounts you from the vehicle or mount",
.aliases = { "dismount" }, .aliases = { "dismount" },
.handle = DEVGMCommands::Dismount, .handle = DEVGMCommands::Dismount,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -344,8 +374,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(DismountCommand); RegisterCommand(DismountCommand);
Command ReloadConfigCommand { Command ReloadConfigCommand {
.help = "", .help = "Reload Server configs",
.info = "", .info = "Reloads the server with the new config values.",
.aliases = { "reloadconfig", "reload-config" }, .aliases = { "reloadconfig", "reload-config" },
.handle = DEVGMCommands::ReloadConfig, .handle = DEVGMCommands::ReloadConfig,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -353,8 +383,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ReloadConfigCommand); RegisterCommand(ReloadConfigCommand);
Command ForceSaveCommand { Command ForceSaveCommand {
.help = "", .help = "Force save your player",
.info = "", .info = "While saving to database usually happens on regular intervals and when you disconnect from the server, this command saves your player's data to the database",
.aliases = { "forcesave", "force-save" }, .aliases = { "forcesave", "force-save" },
.handle = DEVGMCommands::ForceSave, .handle = DEVGMCommands::ForceSave,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -362,8 +392,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ForceSaveCommand); RegisterCommand(ForceSaveCommand);
Command FreecamCommand { Command FreecamCommand {
.help = "", .help = "Toggles freecam mode",
.info = "", .info = "Toggles freecam mode",
.aliases = { "freecam" }, .aliases = { "freecam" },
.handle = DEVGMCommands::Freecam, .handle = DEVGMCommands::Freecam,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -371,17 +401,17 @@ void SlashCommandHandler::Startup() {
RegisterCommand(FreecamCommand); RegisterCommand(FreecamCommand);
Command FreeMoneyCommand { Command FreeMoneyCommand {
.help = "", .help = "Give yourself coins",
.info = "", .info = "Give yourself coins",
.aliases = { "freemoney" }, .aliases = { "freemoney", "givemoney", "money", "givecoins", "coins"},
.handle = DEVGMCommands::FreeMoney, .handle = DEVGMCommands::FreeMoney,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
}; };
RegisterCommand(FreeMoneyCommand); RegisterCommand(FreeMoneyCommand);
Command GetNavmeshHeightCommand { Command GetNavmeshHeightCommand {
.help = "", .help = "Display the navmesh height",
.info = "", .info = "Display the navmesh height at your current position",
.aliases = { "getnavmeshheight" }, .aliases = { "getnavmeshheight" },
.handle = DEVGMCommands::GetNavmeshHeight, .handle = DEVGMCommands::GetNavmeshHeight,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -389,8 +419,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(GetNavmeshHeightCommand); RegisterCommand(GetNavmeshHeightCommand);
Command GiveUScoreCommand { Command GiveUScoreCommand {
.help = "", .help = "Gives uscore",
.info = "", .info = "Gives uscore",
.aliases = { "giveuscore" }, .aliases = { "giveuscore" },
.handle = DEVGMCommands::GiveUScore, .handle = DEVGMCommands::GiveUScore,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -398,8 +428,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(GiveUScoreCommand); RegisterCommand(GiveUScoreCommand);
Command GmAddItemCommand { Command GmAddItemCommand {
.help = "", .help = "Give yourseld an item",
.info = "", .info = "Adds the given item to your inventory by id",
.aliases = { "gmadditem", "give" }, .aliases = { "gmadditem", "give" },
.handle = DEVGMCommands::GmAddItem, .handle = DEVGMCommands::GmAddItem,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -407,8 +437,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(GmAddItemCommand); RegisterCommand(GmAddItemCommand);
Command InspectCommand { Command InspectCommand {
.help = "", .help = "Inspect an object",
.info = "", .info = "Finds the closest entity with the given component or LNV variable (ignoring players and racing cars), printing its ID, distance from the player, and whether it is sleeping, as well as the the IDs of all components the entity has. See detailed usage in the DLU docs",
.aliases = { "inspect" }, .aliases = { "inspect" },
.handle = DEVGMCommands::Inspect, .handle = DEVGMCommands::Inspect,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -416,8 +446,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(InspectCommand); RegisterCommand(InspectCommand);
Command ListSpawnsCommand { Command ListSpawnsCommand {
.help = "", .help = "List spawn points for players",
.info = "", .info = "Lists all the character spawn points in the zone. Additionally, this command will display the current scene that plays when the character lands in the next zone, if there is one.",
.aliases = { "list-spawns", "listspawns" }, .aliases = { "list-spawns", "listspawns" },
.handle = DEVGMCommands::ListSpawns, .handle = DEVGMCommands::ListSpawns,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -425,8 +455,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ListSpawnsCommand); RegisterCommand(ListSpawnsCommand);
Command LocRowCommand { Command LocRowCommand {
.help = "", .help = "Prints the your current position and rotation information to the console",
.info = "", .info = "Prints the your current position and rotation information to the console",
.aliases = { "locrow" }, .aliases = { "locrow" },
.handle = DEVGMCommands::LocRow, .handle = DEVGMCommands::LocRow,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -434,8 +464,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(LocRowCommand); RegisterCommand(LocRowCommand);
Command LookupCommand { Command LookupCommand {
.help = "", .help = "Lookup an object",
.info = "", .info = "Searches through the Objects table in the client SQLite database for items whose display name, name, or description contains the query. Query can be multiple words delimited by spaces.",
.aliases = { "lookup" }, .aliases = { "lookup" },
.handle = DEVGMCommands::Lookup, .handle = DEVGMCommands::Lookup,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -443,8 +473,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(LookupCommand); RegisterCommand(LookupCommand);
Command PlayAnimationCommand { Command PlayAnimationCommand {
.help = "", .help = "Play an animation with given ID",
.info = "", .info = "Play an animation with given ID",
.aliases = { "playanimation", "playanim" }, .aliases = { "playanimation", "playanim" },
.handle = DEVGMCommands::PlayAnimation, .handle = DEVGMCommands::PlayAnimation,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -452,8 +482,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(PlayAnimationCommand); RegisterCommand(PlayAnimationCommand);
Command PlayEffectCommand { Command PlayEffectCommand {
.help = "", .help = "Plays an effect",
.info = "", .info = "Plays an effect",
.aliases = { "playeffect" }, .aliases = { "playeffect" },
.handle = DEVGMCommands::PlayEffect, .handle = DEVGMCommands::PlayEffect,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -461,8 +491,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(PlayEffectCommand); RegisterCommand(PlayEffectCommand);
Command PlayLvlFxCommand { Command PlayLvlFxCommand {
.help = "", .help = "Plays the level up animation on your character",
.info = "", .info = "Plays the level up animation on your character",
.aliases = { "playlvlfx" }, .aliases = { "playlvlfx" },
.handle = DEVGMCommands::PlayLvlFx, .handle = DEVGMCommands::PlayLvlFx,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -470,8 +500,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(PlayLvlFxCommand); RegisterCommand(PlayLvlFxCommand);
Command PlayRebuildFxCommand { Command PlayRebuildFxCommand {
.help = "", .help = "Plays the quickbuild animation on your character",
.info = "", .info = "Plays the quickbuild animation on your character",
.aliases = { "playrebuildfx" }, .aliases = { "playrebuildfx" },
.handle = DEVGMCommands::PlayRebuildFx, .handle = DEVGMCommands::PlayRebuildFx,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -479,8 +509,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(PlayRebuildFxCommand); RegisterCommand(PlayRebuildFxCommand);
Command PosCommand { Command PosCommand {
.help = "", .help = "Displays your current position in chat and in the console",
.info = "", .info = "Displays your current position in chat and in the console",
.aliases = { "pos" }, .aliases = { "pos" },
.handle = DEVGMCommands::Pos, .handle = DEVGMCommands::Pos,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -488,8 +518,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(PosCommand); RegisterCommand(PosCommand);
Command RefillStatsCommand { Command RefillStatsCommand {
.help = "", .help = "Refills health, armor, and imagination to their maximum level",
.info = "", .info = "Refills health, armor, and imagination to their maximum level",
.aliases = { "refillstats" }, .aliases = { "refillstats" },
.handle = DEVGMCommands::RefillStats, .handle = DEVGMCommands::RefillStats,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -497,8 +527,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(RefillStatsCommand); RegisterCommand(RefillStatsCommand);
Command ReforgeCommand { Command ReforgeCommand {
.help = "", .help = "Reforges an item",
.info = "", .info = "Reforges an item",
.aliases = { "reforge" }, .aliases = { "reforge" },
.handle = DEVGMCommands::Reforge, .handle = DEVGMCommands::Reforge,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -506,8 +536,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ReforgeCommand); RegisterCommand(ReforgeCommand);
Command ResetMissionCommand { Command ResetMissionCommand {
.help = "", .help = "Sets the state of the mission to accepted but not yet started",
.info = "", .info = "Sets the state of the mission to accepted but not yet started",
.aliases = { "resetmission" }, .aliases = { "resetmission" },
.handle = DEVGMCommands::ResetMission, .handle = DEVGMCommands::ResetMission,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -515,8 +545,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ResetMissionCommand); RegisterCommand(ResetMissionCommand);
Command RotCommand { Command RotCommand {
.help = "", .help = "Displays your current rotation in chat and in the console",
.info = "", .info = "Displays your current rotation in chat and in the console",
.aliases = { "rot" }, .aliases = { "rot" },
.handle = DEVGMCommands::Rot, .handle = DEVGMCommands::Rot,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -524,8 +554,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(RotCommand); RegisterCommand(RotCommand);
Command RunMacroCommand { Command RunMacroCommand {
.help = "", .help = "Run a macro",
.info = "", .info = "Runs any command macro found in `./res/macros/`",
.aliases = { "runmacro" }, .aliases = { "runmacro" },
.handle = DEVGMCommands::RunMacro, .handle = DEVGMCommands::RunMacro,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -533,8 +563,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(RunMacroCommand); RegisterCommand(RunMacroCommand);
Command SetControlSchemeCommand { Command SetControlSchemeCommand {
.help = "", .help = "Sets the character control scheme to the specified number",
.info = "", .info = "Sets the character control scheme to the specified number",
.aliases = { "setcontrolscheme" }, .aliases = { "setcontrolscheme" },
.handle = DEVGMCommands::SetControlScheme, .handle = DEVGMCommands::SetControlScheme,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -542,17 +572,17 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SetControlSchemeCommand); RegisterCommand(SetControlSchemeCommand);
Command SetCurrencyCommand { Command SetCurrencyCommand {
.help = "", .help = "Sets your coins",
.info = "", .info = "Sets your coins",
.aliases = { "setcurrency" }, .aliases = { "setcurrency", "setcoins" },
.handle = DEVGMCommands::SetCurrency, .handle = DEVGMCommands::SetCurrency,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
}; };
RegisterCommand(SetCurrencyCommand); RegisterCommand(SetCurrencyCommand);
Command SetFlagCommand { Command SetFlagCommand {
.help = "", .help = "Set a player flag",
.info = "", .info = "Sets the given inventory or health flag to the given value, where value can be one of \"on\" or \"off\". If no value is given, by default this adds the flag to your character (equivalent of calling `/setflag on <flag id>`)",
.aliases = { "setflag" }, .aliases = { "setflag" },
.handle = DEVGMCommands::SetFlag, .handle = DEVGMCommands::SetFlag,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -560,17 +590,17 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SetFlagCommand); RegisterCommand(SetFlagCommand);
Command SetInventorySizeCommand { Command SetInventorySizeCommand {
.help = "", .help = "Set your inventory size",
.info = "", .info = "Sets your inventory size to the given size. If `inventory` is provided, the number or string will be used to set that inventory to the requested size",
.aliases = { "setinventorysize" }, .aliases = { "setinventorysize", "setinvsize", "setinvensize" },
.handle = DEVGMCommands::SetInventorySize, .handle = DEVGMCommands::SetInventorySize,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
}; };
RegisterCommand(SetInventorySizeCommand); RegisterCommand(SetInventorySizeCommand);
Command SetUiStateCommand { Command SetUiStateCommand {
.help = "", .help = "Changes UI state",
.info = "", .info = "Changes UI state",
.aliases = { "setuistate" }, .aliases = { "setuistate" },
.handle = DEVGMCommands::SetUiState, .handle = DEVGMCommands::SetUiState,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -578,8 +608,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SetUiStateCommand); RegisterCommand(SetUiStateCommand);
Command SpawnCommand { Command SpawnCommand {
.help = "", .help = "Spawns an object at your location by id",
.info = "", .info = "Spawns an object at your location by id",
.aliases = { "spawn" }, .aliases = { "spawn" },
.handle = DEVGMCommands::Spawn, .handle = DEVGMCommands::Spawn,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -596,8 +626,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SpawnGroupCommand); RegisterCommand(SpawnGroupCommand);
Command SpeedBoostCommand { Command SpeedBoostCommand {
.help = "", .help = "Set the players speed multiplier",
.info = "", .info = "Sets the speed multiplier to the given amount. `/speedboost 1.5` will set the speed multiplier to 1.5x the normal speed",
.aliases = { "speedboost" }, .aliases = { "speedboost" },
.handle = DEVGMCommands::SpeedBoost, .handle = DEVGMCommands::SpeedBoost,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -605,8 +635,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SpeedBoostCommand); RegisterCommand(SpeedBoostCommand);
Command StartCelebrationCommand { Command StartCelebrationCommand {
.help = "", .help = "Starts a celebration effect on your character",
.info = "", .info = "Starts a celebration effect on your character",
.aliases = { "startcelebration" }, .aliases = { "startcelebration" },
.handle = DEVGMCommands::StartCelebration, .handle = DEVGMCommands::StartCelebration,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -614,8 +644,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(StartCelebrationCommand); RegisterCommand(StartCelebrationCommand);
Command StopEffectCommand { Command StopEffectCommand {
.help = "", .help = "Stops the given effect",
.info = "", .info = "Stops the given effect",
.aliases = { "stopeffect" }, .aliases = { "stopeffect" },
.handle = DEVGMCommands::StopEffect, .handle = DEVGMCommands::StopEffect,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -623,8 +653,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(StopEffectCommand); RegisterCommand(StopEffectCommand);
Command ToggleCommand { Command ToggleCommand {
.help = "", .help = "Toggles UI state",
.info = "", .info = "Toggles UI state",
.aliases = { "toggle" }, .aliases = { "toggle" },
.handle = DEVGMCommands::Toggle, .handle = DEVGMCommands::Toggle,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -632,8 +662,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ToggleCommand); RegisterCommand(ToggleCommand);
Command TpAllCommand { Command TpAllCommand {
.help = "", .help = "Teleports all characters to your current position",
.info = "", .info = "Teleports all characters to your current position",
.aliases = { "tpall" }, .aliases = { "tpall" },
.handle = DEVGMCommands::TpAll, .handle = DEVGMCommands::TpAll,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -641,8 +671,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(TpAllCommand); RegisterCommand(TpAllCommand);
Command TriggerSpawnerCommand { Command TriggerSpawnerCommand {
.help = "", .help = "Triggers spawner by name",
.info = "", .info = "Triggers spawner by name",
.aliases = { "triggerspawner" }, .aliases = { "triggerspawner" },
.handle = DEVGMCommands::TriggerSpawner, .handle = DEVGMCommands::TriggerSpawner,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -650,8 +680,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(TriggerSpawnerCommand); RegisterCommand(TriggerSpawnerCommand);
Command UnlockEmoteCommand { Command UnlockEmoteCommand {
.help = "", .help = "Unlocks for your character the emote of the given id",
.info = "", .info = "Unlocks for your character the emote of the given id",
.aliases = { "unlock-emote", "unlockemote" }, .aliases = { "unlock-emote", "unlockemote" },
.handle = DEVGMCommands::UnlockEmote, .handle = DEVGMCommands::UnlockEmote,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -659,8 +689,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(UnlockEmoteCommand); RegisterCommand(UnlockEmoteCommand);
Command SetLevelCommand { Command SetLevelCommand {
.help = "", .help = "Set player level",
.info = "", .info = "Sets the using entities level to the requested level. Takes an optional parameter of an in-game players username to set the level of",
.aliases = { "setlevel" }, .aliases = { "setlevel" },
.handle = DEVGMCommands::SetLevel, .handle = DEVGMCommands::SetLevel,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -668,8 +698,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SetLevelCommand); RegisterCommand(SetLevelCommand);
Command SetSkillSlotCommand { Command SetSkillSlotCommand {
.help = "", .help = "Set an action slot to a specific skill",
.info = "", .info = "Set an action slot to a specific skill",
.aliases = { "setskillslot" }, .aliases = { "setskillslot" },
.handle = DEVGMCommands::SetSkillSlot, .handle = DEVGMCommands::SetSkillSlot,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -677,8 +707,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SetSkillSlotCommand); RegisterCommand(SetSkillSlotCommand);
Command SetFactionCommand { Command SetFactionCommand {
.help = "", .help = "Set the players faction",
.info = "", .info = "Clears the users current factions and sets it",
.aliases = { "setfaction" }, .aliases = { "setfaction" },
.handle = DEVGMCommands::SetFaction, .handle = DEVGMCommands::SetFaction,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -686,8 +716,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SetFactionCommand); RegisterCommand(SetFactionCommand);
Command AddFactionCommand { Command AddFactionCommand {
.help = "", .help = "Add the faction to the users list of factions",
.info = "", .info = "Add the faction to the users list of factions",
.aliases = { "addfaction" }, .aliases = { "addfaction" },
.handle = DEVGMCommands::AddFaction, .handle = DEVGMCommands::AddFaction,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -695,8 +725,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(AddFactionCommand); RegisterCommand(AddFactionCommand);
Command GetFactionsCommand { Command GetFactionsCommand {
.help = "", .help = "Shows the player's factions",
.info = "", .info = "Shows the player's factions",
.aliases = { "getfactions" }, .aliases = { "getfactions" },
.handle = DEVGMCommands::GetFactions, .handle = DEVGMCommands::GetFactions,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -704,8 +734,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(GetFactionsCommand); RegisterCommand(GetFactionsCommand);
Command SetRewardCodeCommand { Command SetRewardCodeCommand {
.help = "", .help = "Set a reward code for your account",
.info = "", .info = "Sets the rewardcode for the account you are logged into if it's a valid rewardcode, See cdclient table `RewardCodes`",
.aliases = { "setrewardcode" }, .aliases = { "setrewardcode" },
.handle = DEVGMCommands::SetRewardCode, .handle = DEVGMCommands::SetRewardCode,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -713,17 +743,17 @@ void SlashCommandHandler::Startup() {
RegisterCommand(SetRewardCodeCommand); RegisterCommand(SetRewardCodeCommand);
Command CrashCommand { Command CrashCommand {
.help = "", .help = "Crash the server",
.info = "", .info = "Crashes the server",
.aliases = { "crash", "pumpkin" }, .aliases = { "crash", "pumpkin" },
.handle = DEVGMCommands::Crash, .handle = DEVGMCommands::Crash,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
}; };
RegisterCommand(CrashCommand); RegisterCommand(CrashCommand);
Command RollLootCommand { Command RollLootCommand {
.help = "", .help = "Simulate loot rolls",
.info = "", .info = "Given a `loot matrix index`, look for `item id` in that matrix `amount` times and print to the chat box statistics of rolling that loot matrix.",
.aliases = { "rollloot", "roll-loot" }, .aliases = { "rollloot", "roll-loot" },
.handle = DEVGMCommands::RollLoot, .handle = DEVGMCommands::RollLoot,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -731,8 +761,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(RollLootCommand); RegisterCommand(RollLootCommand);
Command CastSkillCommand { Command CastSkillCommand {
.help = "", .help = "Casts the skill as the player",
.info = "", .info = "Casts the skill as the player",
.aliases = { "castskill" }, .aliases = { "castskill" },
.handle = DEVGMCommands::CastSkill, .handle = DEVGMCommands::CastSkill,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
@ -740,10 +770,10 @@ void SlashCommandHandler::Startup() {
RegisterCommand(CastSkillCommand); RegisterCommand(CastSkillCommand);
Command DeleteInvenCommand { Command DeleteInvenCommand {
.help = "", .help = "Delete all items from a specified inventory",
.info = "", .info = "Delete all items from a specified inventory",
.aliases = { "deleteinven" }, .aliases = { "deleteinven" },
.handle = DEVGMCommands::CastSkill, .handle = DEVGMCommands::DeleteInven,
.requiredLevel = eGameMasterLevel::DEVELOPER .requiredLevel = eGameMasterLevel::DEVELOPER
}; };
RegisterCommand(DeleteInvenCommand); RegisterCommand(DeleteInvenCommand);
@ -961,8 +991,8 @@ void SlashCommandHandler::Startup() {
RegisterCommand(ResurrectCommand); RegisterCommand(ResurrectCommand);
Command InstanceInfoCommand { Command InstanceInfoCommand {
.help = "", .help = "Display LWOZoneID info for the current zone",
.info = "", .info = "Display LWOZoneID info for the current zone",
.aliases = { "instanceinfo" }, .aliases = { "instanceinfo" },
.handle = GMZeroCommands::InstanceInfo, .handle = GMZeroCommands::InstanceInfo,
.requiredLevel = eGameMasterLevel::CIVILIAN .requiredLevel = eGameMasterLevel::CIVILIAN
@ -971,36 +1001,6 @@ void SlashCommandHandler::Startup() {
} }
void SlashCommandHandler::HandleChatCommand(const std::u16string& chat, Entity* entity, const SystemAddress& sysAddr) {
auto input = GeneralUtils::UTF16ToWTF8(chat);
if (input.empty() || input.front() != u'/') return;
std::string command = input.substr(1, input.find(' ') - 1);
std::string args = input.substr(input.find(' ') + 1, std::string::npos);
if (args.front() == '/') args.clear();
LOG("Handling command \"%s\" with args \"%s\"", command.c_str(), args.c_str());
if (RegisteredCommands.contains(command)) {
if (entity->GetGMLevel() >= RegisteredCommands[command].requiredLevel) {
Database::Get()->InsertSlashCommandUsage(entity->GetObjectID(), input);
RegisteredCommands[command].handle(entity, sysAddr, args);
return;
} else {
// We don't need to tell normies they aren't high enough level
if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) return;
std::ostringstream feedback;
feedback << "You are not high enough GM level to use " << std::quoted(command) << "";
GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(feedback.str()));
}
} else {
// We don't need to tell normies commands don't exist
if (entity->GetGMLevel() == eGameMasterLevel::CIVILIAN) return;
std::ostringstream feedback;
feedback << "Command " << std::quoted(command) << " does not exist!";
GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(feedback.str()));
}
}
namespace GMZeroCommands { namespace GMZeroCommands {
void Help(Entity* entity, const SystemAddress& sysAddr, const std::string args) { void Help(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
if (args.empty()) { if (args.empty()) {
@ -1011,6 +1011,8 @@ namespace GMZeroCommands {
if (command.requiredLevel > entity->GetGMLevel()) continue; if (command.requiredLevel > entity->GetGMLevel()) continue;
helpMessage << "/" << command.aliases[0] << ": " << command.help << "\n*"; helpMessage << "/" << command.aliases[0] << ": " << command.help << "\n*";
} }
LOG("HELP TEXT IS: \n%s",helpMessage.str().c_str() );
GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(helpMessage.str().substr(0, helpMessage.str().size() - 2))); GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(helpMessage.str().substr(0, helpMessage.str().size() - 2)));
} else { } else {
bool foundCommand = false; bool foundCommand = false;
@ -1019,12 +1021,13 @@ namespace GMZeroCommands {
foundCommand = true; foundCommand = true;
if (entity->GetGMLevel() >= command.requiredLevel) { if (entity->GetGMLevel() >= command.requiredLevel) {
std::ostringstream commandDetails; std::ostringstream commandDetails;
commandDetails << "----- " << command.aliases[0] << " -----n*"; commandDetails << "----- " << command.aliases[0] << " -----\n*";
commandDetails << command.info << "\n*"; commandDetails << command.info << "\n*";
if (command.aliases.size() > 1) { if (command.aliases.size() > 1) {
commandDetails << "Aliases: "; commandDetails << "Aliases: ";
std::copy(command.aliases.begin(), command.aliases.end(), std::ostream_iterator<std::string>(commandDetails, ", ")); std::copy(command.aliases.begin(), command.aliases.end(), std::ostream_iterator<std::string>(commandDetails, ", "));
} }
LOG("HELP TEXT IS: \n%s",commandDetails.str().c_str() );
GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(commandDetails.str().substr(0, commandDetails.str().size() - 2))); GameMessages::SendSlashCommandFeedbackText(entity, GeneralUtils::ASCIIToUTF16(commandDetails.str().substr(0, commandDetails.str().size() - 2)));
} }
} }