implement infinite hp/tp on proxy server
This commit is contained in:
+33
-4
@@ -751,10 +751,39 @@ static bool process_client_81(shared_ptr<ServerState>,
|
|||||||
template <typename SendGuildCardCmdT>
|
template <typename SendGuildCardCmdT>
|
||||||
static bool process_client_60_62_6C_6D_C9_CB(shared_ptr<ServerState> s,
|
static bool process_client_60_62_6C_6D_C9_CB(shared_ptr<ServerState> s,
|
||||||
ProxyServer::LinkedSession& session, uint16_t command, uint32_t flag, string& data) {
|
ProxyServer::LinkedSession& session, uint16_t command, uint32_t flag, string& data) {
|
||||||
if (session.license && !data.empty() && (data[0] == 0x06)) {
|
if (session.license && !data.empty()) {
|
||||||
auto& cmd = check_size_t<SendGuildCardCmdT>(data);
|
if (data[0] == 0x06) {
|
||||||
if (cmd.guild_card_number == session.license->serial_number) {
|
auto& cmd = check_size_t<SendGuildCardCmdT>(data);
|
||||||
cmd.guild_card_number = session.remote_guild_card_number;
|
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<PSOSubcommand> 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<void>(s, session, command, flag, data);
|
return process_client_60_62_6C_6D_C9_CB<void>(s, session, command, flag, data);
|
||||||
|
|||||||
@@ -436,6 +436,8 @@ ProxyServer::LinkedSession::LinkedSession(
|
|||||||
suppress_newserv_commands(true),
|
suppress_newserv_commands(true),
|
||||||
enable_chat_filter(true),
|
enable_chat_filter(true),
|
||||||
enable_switch_assist(false),
|
enable_switch_assist(false),
|
||||||
|
infinite_hp(false),
|
||||||
|
infinite_tp(false),
|
||||||
save_files(false),
|
save_files(false),
|
||||||
function_call_return_value(-1),
|
function_call_return_value(-1),
|
||||||
override_section_id(-1),
|
override_section_id(-1),
|
||||||
|
|||||||
@@ -61,6 +61,8 @@ public:
|
|||||||
bool suppress_newserv_commands;
|
bool suppress_newserv_commands;
|
||||||
bool enable_chat_filter;
|
bool enable_chat_filter;
|
||||||
bool enable_switch_assist;
|
bool enable_switch_assist;
|
||||||
|
bool infinite_hp;
|
||||||
|
bool infinite_tp;
|
||||||
bool save_files;
|
bool save_files;
|
||||||
int64_t function_call_return_value; // -1 = don't block function calls
|
int64_t function_call_return_value; // -1 = don't block function calls
|
||||||
G_SwitchStateChanged_6x05 last_switch_enabled_command;
|
G_SwitchStateChanged_6x05 last_switch_enabled_command;
|
||||||
|
|||||||
@@ -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\
|
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\
|
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\
|
newserv instance and you have newserv commands in your chat shortcuts.\n\
|
||||||
|
set-infinite-hp <on|off>\n\
|
||||||
|
set-infinite-tp <on|off>\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 <on|off>\n\
|
set-switch-assist <on|off>\n\
|
||||||
Enable or disable switch assist. When switch assist is on, the proxy will\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\
|
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();
|
auto session = this->get_proxy_session();
|
||||||
set_boolean(&session->suppress_newserv_commands, command_args);
|
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") {
|
} else if (command_name == "set-switch-assist") {
|
||||||
auto session = this->get_proxy_session();
|
auto session = this->get_proxy_session();
|
||||||
set_boolean(&session->enable_switch_assist, command_args);
|
set_boolean(&session->enable_switch_assist, command_args);
|
||||||
|
|||||||
Reference in New Issue
Block a user