add $call command

This commit is contained in:
Martin Michelsen
2023-09-25 09:44:57 -07:00
parent 995a05c409
commit 65f8dea0da
3 changed files with 24 additions and 1 deletions
+1
View File
@@ -267,6 +267,7 @@ Some commands only work on the game server and not on the proxy server. The chat
* Debugging commands
* `$debug` (game server only): Enable or disable debug. You need the DEBUG permission in your user license to use this command. When debug is enabled, you'll see in-game messages from the server when you take certain actions. You'll also be placed into the highest available slot in lobbies and games instead of the lowest, which is useful for finding commands for which newserv doesn't handle client IDs properly. This setting also disables certain safeguards and allows you to do some things that might crash your client.
* `$call <function-id>`: Call a quest function on your client.
* `$gc` (game server only): Send your own Guild Card to yourself.
* `$persist` (game server only): Enable or disable persistence for the current lobby or game. This determines whether the lobby/game is deleted when the last player leaves. You need the DEBUG permission in your user license to use this command because there are no game state checks when you do this. For example, if you make a game persistent, start a quest, then leave the game, the game can't be joined by anyone but also can't be deleted.
* `$sc <data>`: Send a command to yourself.
+22
View File
@@ -383,6 +383,27 @@ static void proxy_command_exit(shared_ptr<ProxyServer::LinkedSession> ses, const
}
}
static void server_command_call(shared_ptr<Client> c, const std::u16string& args) {
auto l = c->require_lobby();
if (l->is_game() && l->quest) {
S_ConfirmQuestStatistic_V3_BB_AB cmd;
cmd.function_id = stoul(encode_sjis(args), nullptr, 0);
send_command_t(c, 0xAB, 0x00, cmd);
} else {
send_text_message(c, u"$C6You must be in\nquest to use this\ncommand");
}
}
static void proxy_command_call(shared_ptr<ProxyServer::LinkedSession> ses, const std::u16string& args) {
if (ses->is_in_game && ses->is_in_quest) {
S_ConfirmQuestStatistic_V3_BB_AB cmd;
cmd.function_id = stoul(encode_sjis(args), nullptr, 0);
ses->client_channel.send(0xAB, 0x00, &cmd, sizeof(cmd));
} else {
send_text_message(ses->client_channel, u"$C6You must be in\nquest to use this\ncommand");
}
}
static void server_command_get_self_card(shared_ptr<Client> c, const std::u16string&) {
send_guild_card(c, c);
}
@@ -1488,6 +1509,7 @@ static const unordered_map<u16string, ChatCommandDefinition> chat_commands({
{u"$ax", {server_command_ax, nullptr}},
{u"$ban", {server_command_ban, nullptr}},
{u"$bbchar", {server_command_convert_char_to_bb, nullptr}},
{u"$call", {server_command_call, proxy_command_call}},
{u"$cheat", {server_command_cheat, nullptr}},
{u"$debug", {server_command_debug, nullptr}},
{u"$defrange", {server_command_ep3_set_def_dice_range, nullptr}},
+1 -1
View File
@@ -242,7 +242,7 @@
["Ep3 commands", "Show commands used\nin Episode 3 games", "These commands can be used in Episode 3 games.\n\n$C8Before battle begins:$C7\n$C6%sinftime$C7: Disable all battle time limits, regardless\n of limits set in battle rules\n$C6%sdefrange <min>-<max>$C7: Set the DEF dice range for\n the next battle\n\n$C8During battle:$C7\n$C6%sspec$C7: Allow or forbid spectators\n$C6%sstat <what>$C7: Show a live statistic\n$C6%ssurrender$C7: Immediately lose the current battle\n\n$C8In game after battle:$C7\n$C6%ssaverec <name>$C7: Save recording of the last battle"],
["Cheat commands", "Show commands used\nfor cheating", "These commands can be used to cheat.\n\n$C8In a game:$C7\n$C6%scheat$C7: Enable or disable cheat mode\n\n$C8When cheat mode is enabled:$C7\n$C6%sinfhp$C7 / $C6%sinftp$C7: Enable or disable infinite HP or TP\n$C6%swarpme <area-id>$C7: Warp yourself to the given area\n$C6%swarpall <area-id>$C7: Warp everyone to the given area\n$C6%snext$C7: Warp yourself to the next area\n$C6%sswa$C7: Enable or disable switch assist\n$C6%si <name>$C7 / $C6%si <hex>$C7: Create an item\n\n$C8Episode 3 only:$C7\n$C6%sunset <index>$C7: Remove one of your set cards from\n the field"],
["Admin commands", "Show commands used\nfor setting server\noptions", "These commands provide administration functions.\n\n$C6%sevent <event>$C7: Set the holiday in the current lobby\n$C6%sallevent <event>$C7: Set the holiday in all lobbies\n$C6%sann <message>$C7: Send an announcement message to\n all players\n$C6%sax <message>$C7: Send a message to the server\n$C6%ssilence <who>$C7: Silence or unsilence a player\n$C6%skick <who>$C7: Disconnect a player\n$C6%sban <who>$C7: Ban a player"],
["Debug commands", "Show commands used\nfor debugging", "These commands are used for debugging.\n\n$C6%sdebug$C7: Enable or disable debug messages\n$C6%sgc$C7: Send your own Guild Card to yourself\n$C6%spersist$C7: Cause game to not close when last player\n leaves\n$C6%ssc <data>$C7: Send a command to yourself\n\n$C8Proxy only:$C7\n$C6%sss <data>$C7: Send a command to the remote server"],
["Debug commands", "Show commands used\nfor debugging", "These commands are used for debugging.\n\n$C6%sdebug$C7: Enable or disable debug messages\n$C6%scall <id>$C7: Call a quest function\n$C6%sgc$C7: Send your own Guild Card to yourself\n$C6%spersist$C7: Cause game to not close when last player\n leaves\n$C6%ssc <data>$C7: Send a command to yourself\n\n$C8Proxy only:$C7\n$C6%sss <data>$C7: Send a command to the remote server"],
["Using $i", "$C7Show how to use\nthe %si command", "The %si command is used to create items.\nUse it like this (for example):\n\n$C6%si Double Cannon +10 0/0/20/15/35$C7\n$C6%si Hell Pallasch$C7\n$C6%si Black Ring +5DEF$C7\n$C6%si Knight/Power++$C7\n$C6%si Sato 5/50/10.5/50 120% 200IQ$C7\n$C6%si Trimate x3$C7\n$C6%si 1000 Meseta$C7\n\nYou can also use a hex code instead of a name\n(this is the same as the Sato example above):\n\n$C6%si 023F7300F40188131A04881378C80000$C7"],
["Using $edit", "$C7Show how to use\nthe %sedit command", "%sedit is used in PSOBB to change character stats.\nUse one of the following subcommands:\n\n$C6%sedit ATP <value>$C7\n$C6%sedit MST <value>$C7\n$C6%sedit EVP <value>$C7\n$C6%sedit HP <value>$C7\n$C6%sedit DFP <value>$C7\n$C6%sedit ATA <value>$C7\n$C6%sedit LCK <value>$C7\n$C6%sedit MESETA <amount>$C7\n$C6%sedit EXP <amount>$C7\n$C6%sedit LEVEL <level>$C7\n$C6%sedit NAMECOLOR <color in hex, AARRGGBB format>$C7\n$C6%sedit SECID <section ID name>$C7\n$C6%sedit NAME <new character name>$C7\n$C6%sedit NPC <NPC name>$C7\n$C6%sedit TECH <technique name> <new technique level>$C7\n\nNPC names: none, ninja, rico, sonic, knuckles,\n flowen, elly\n\nTechnique names: foie, gifoie, rafoie, barta,\n gibarta, rabarta, zonde, gizonde, razonde,\n grants, deband, jellen, zalure, shifta, ryuker,\n resta, anti, reverser, megid, all"],
["Using $bbchar", "$C7Show how to use\nthe %sbbchar command", "%sbbchar is used to convert a character from an\nolder version of PSO to Blue Burst format and save\nit on this server. Use the command like this:\n\n$C6%sbbchar <username> <password> <slot>$C7\n\nIf the username and password are correct, the\ncharacter that you're currently playing as will be\nconverted to PSOBB format and saved under that\naccount, in the specified character slot (1-4)."],