Added custom OpenSB help text categories and descriptions
This commit is contained in:
parent
90db1e0fba
commit
57e9d13e6a
@ -2,8 +2,14 @@
|
|||||||
"basicHelpText": "Basic commands are: {}",
|
"basicHelpText": "Basic commands are: {}",
|
||||||
"adminHelpText": "Admin commands are: {}",
|
"adminHelpText": "Admin commands are: {}",
|
||||||
"debugHelpText": "Debug commands are: {}",
|
"debugHelpText": "Debug commands are: {}",
|
||||||
|
"openSbHelpText": "OpenSB commands are: {}",
|
||||||
|
"openSbDebugHelpText": "OpenSB Debug commands are: {}",
|
||||||
|
|
||||||
"debugCommands": {
|
"openSbDebugCommands": {
|
||||||
"run": "Usage /run <lua>. Executes a script on the player and outputs the return value to chat."
|
"run": "Usage /run <lua>. Executes a script on the player and outputs the return value to chat."
|
||||||
|
},
|
||||||
|
|
||||||
|
"openSbCommands": {
|
||||||
|
"swap": "Usage /swap <name>. Swaps the current character, case-insensitive, only substring required."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,12 +53,14 @@ String CommandProcessor::help(ConnectionId connectionId, String const& argumentS
|
|||||||
|
|
||||||
auto assets = Root::singleton().assets();
|
auto assets = Root::singleton().assets();
|
||||||
auto basicCommands = assets->json("/help.config:basicCommands");
|
auto basicCommands = assets->json("/help.config:basicCommands");
|
||||||
|
auto openSbCommands = assets->json("/help.config:openSbCommands");
|
||||||
auto adminCommands = assets->json("/help.config:adminCommands");
|
auto adminCommands = assets->json("/help.config:adminCommands");
|
||||||
auto debugCommands = assets->json("/help.config:debugCommands");
|
auto debugCommands = assets->json("/help.config:debugCommands");
|
||||||
|
auto openSbDebugCommands = assets->json("/help.config:openSbDebugCommands");
|
||||||
|
|
||||||
if (arguments.size()) {
|
if (arguments.size()) {
|
||||||
if (arguments.size() >= 1) {
|
if (arguments.size() >= 1) {
|
||||||
if (auto helpText = basicCommands.optString(arguments[0]).orMaybe(adminCommands.optString(arguments[0])).orMaybe(debugCommands.optString(arguments[0])))
|
if (auto helpText = basicCommands.optString(arguments[0]).orMaybe(openSbCommands.optString(arguments[0])).orMaybe(adminCommands.optString(arguments[0])).orMaybe(debugCommands.optString(arguments[0])).orMaybe(openSbDebugCommands.optString(arguments[0])))
|
||||||
return *helpText;
|
return *helpText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,12 +76,18 @@ String CommandProcessor::help(ConnectionId connectionId, String const& argumentS
|
|||||||
String basicHelpFormat = assets->json("/help.config:basicHelpText").toString();
|
String basicHelpFormat = assets->json("/help.config:basicHelpText").toString();
|
||||||
res = res + strf(basicHelpFormat.utf8Ptr(), commandDescriptions(basicCommands));
|
res = res + strf(basicHelpFormat.utf8Ptr(), commandDescriptions(basicCommands));
|
||||||
|
|
||||||
|
String openSbHelpFormat = assets->json("/help.config:openSbHelpText").toString();
|
||||||
|
res = res + "\n" + strf(openSbHelpFormat.utf8Ptr(), commandDescriptions(openSbCommands));
|
||||||
|
|
||||||
if (!adminCheck(connectionId, "")) {
|
if (!adminCheck(connectionId, "")) {
|
||||||
String adminHelpFormat = assets->json("/help.config:adminHelpText").toString();
|
String adminHelpFormat = assets->json("/help.config:adminHelpText").toString();
|
||||||
res = res + "\n" + strf(adminHelpFormat.utf8Ptr(), commandDescriptions(adminCommands));
|
res = res + "\n" + strf(adminHelpFormat.utf8Ptr(), commandDescriptions(adminCommands));
|
||||||
|
|
||||||
String debugHelpFormat = assets->json("/help.config:debugHelpText").toString();
|
String debugHelpFormat = assets->json("/help.config:debugHelpText").toString();
|
||||||
res = res + "\n" + strf(debugHelpFormat.utf8Ptr(), commandDescriptions(debugCommands));
|
res = res + "\n" + strf(debugHelpFormat.utf8Ptr(), commandDescriptions(debugCommands));
|
||||||
|
|
||||||
|
String openSbDebugHelpFormat = assets->json("/help.config:openSbDebugHelpText").toString();
|
||||||
|
res = res + "\n" + strf(openSbDebugHelpFormat.utf8Ptr(), commandDescriptions(openSbDebugCommands));
|
||||||
}
|
}
|
||||||
|
|
||||||
res = res + "\n" + basicCommands.getString("help");
|
res = res + "\n" + basicCommands.getString("help");
|
||||||
|
Loading…
Reference in New Issue
Block a user