diff --git a/src/ProxyCommands.cc b/src/ProxyCommands.cc index e30b7803..7b587c04 100644 --- a/src/ProxyCommands.cc +++ b/src/ProxyCommands.cc @@ -751,10 +751,39 @@ static bool process_client_81(shared_ptr, template static bool process_client_60_62_6C_6D_C9_CB(shared_ptr s, ProxyServer::LinkedSession& session, uint16_t command, uint32_t flag, string& data) { - if (session.license && !data.empty() && (data[0] == 0x06)) { - auto& cmd = check_size_t(data); - if (cmd.guild_card_number == session.license->serial_number) { - cmd.guild_card_number = session.remote_guild_card_number; + if (session.license && !data.empty()) { + if (data[0] == 0x06) { + auto& cmd = check_size_t(data); + if (cmd.guild_card_number == session.license->serial_number) { + cmd.guild_card_number = session.remote_guild_card_number; + } + } else if (data[0] == 0x2F || data[0] == 0x4C) { + if (session.infinite_hp) { + vector subs; + for (size_t amount = 1020; amount > 0;) { + auto& sub1 = subs.emplace_back(); + sub1.word[0] = 0x029A; + sub1.byte[2] = session.lobby_client_id; + sub1.byte[3] = 0x00; + auto& sub2 = subs.emplace_back(); + sub2.word[0] = 0x0000; + sub2.byte[2] = PlayerStatsChange::ADD_HP; + sub2.byte[3] = (amount > 0xFF) ? 0xFF : amount; + amount -= sub2.byte[3]; + } + session.send_to_end(false, 0x60, 0x00, subs.data(), subs.size() * sizeof(PSOSubcommand)); + } + } else if (data[0] == 0x48) { + if (session.infinite_tp) { + PSOSubcommand subs[2]; + subs[0].word[0] = 0x029A; + subs[0].byte[2] = session.lobby_client_id; + subs[0].byte[3] = 0x00; + subs[1].word[0] = 0x0000; + subs[1].byte[2] = PlayerStatsChange::ADD_TP; + subs[1].byte[3] = 0xFF; + session.send_to_end(false, 0x60, 0x00, &subs[0], sizeof(subs)); + } } } return process_client_60_62_6C_6D_C9_CB(s, session, command, flag, data); diff --git a/src/ProxyServer.cc b/src/ProxyServer.cc index 7113a266..f2fff0ed 100644 --- a/src/ProxyServer.cc +++ b/src/ProxyServer.cc @@ -436,6 +436,8 @@ ProxyServer::LinkedSession::LinkedSession( suppress_newserv_commands(true), enable_chat_filter(true), enable_switch_assist(false), + infinite_hp(false), + infinite_tp(false), save_files(false), function_call_return_value(-1), override_section_id(-1), diff --git a/src/ProxyServer.hh b/src/ProxyServer.hh index 8435b530..94c5d47d 100644 --- a/src/ProxyServer.hh +++ b/src/ProxyServer.hh @@ -61,6 +61,8 @@ public: bool suppress_newserv_commands; bool enable_chat_filter; bool enable_switch_assist; + bool infinite_hp; + bool infinite_tp; bool save_files; int64_t function_call_return_value; // -1 = don't block function calls G_SwitchStateChanged_6x05 last_switch_enabled_command; diff --git a/src/ServerShell.cc b/src/ServerShell.cc index ef56baeb..d9187c96 100644 --- a/src/ServerShell.cc +++ b/src/ServerShell.cc @@ -130,6 +130,10 @@ Proxy commands (these will only work when exactly one client is connected):\n\ all chat messages that begin with a $ are not sent to the remote server.\n\ This can prevent embarrassing situations if the remote server isn\'t a\n\ newserv instance and you have newserv commands in your chat shortcuts.\n\ + set-infinite-hp \n\ + set-infinite-tp \n\ + Enable or disable infinite HP or TP. When infinite HP is enabled, attacks\n\ + that would kill you in one hit will still do so.\n\ set-switch-assist \n\ Enable or disable switch assist. When switch assist is on, the proxy will\n\ remember the last \"enable switch\" command that you send, and will send it\n\ @@ -384,6 +388,14 @@ Proxy commands (these will only work when exactly one client is connected):\n\ auto session = this->get_proxy_session(); set_boolean(&session->suppress_newserv_commands, command_args); + } else if (command_name == "set-infinite-hp") { + auto session = this->get_proxy_session(); + set_boolean(&session->infinite_hp, command_args); + + } else if (command_name == "set-infinite-tp") { + auto session = this->get_proxy_session(); + set_boolean(&session->infinite_tp, command_args); + } else if (command_name == "set-switch-assist") { auto session = this->get_proxy_session(); set_boolean(&session->enable_switch_assist, command_args);