Add GC V3 EXP dispatcher
This commit is contained in:
@@ -3671,6 +3671,53 @@ static asio::awaitable<void> dispatch_dc_v2_exp_patch(shared_ptr<Client> c) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static asio::awaitable<void> dispatch_gc_v3_exp_patch(shared_ptr<Client> c) {
|
||||
if (c->version() != Version::GC_V3) {
|
||||
co_return;
|
||||
}
|
||||
if (not c->check_flag(Client::Flag::HAS_SEND_FUNCTION_CALL)) {
|
||||
co_return;
|
||||
}
|
||||
if (not c->login || not c->login->account) {
|
||||
co_return;
|
||||
}
|
||||
if (not c->login->account->auto_patches_enabled.count("PsoPeepsGCEXP_enabled")) {
|
||||
co_return;
|
||||
}
|
||||
|
||||
auto l = c->require_lobby();
|
||||
if (not l->is_game()) {
|
||||
co_return;
|
||||
}
|
||||
|
||||
const char* episode_str = nullptr;
|
||||
switch (l->episode) {
|
||||
case Episode::EP1:
|
||||
episode_str = "ep1";
|
||||
break;
|
||||
case Episode::EP2:
|
||||
episode_str = "ep2";
|
||||
break;
|
||||
default:
|
||||
co_return;
|
||||
}
|
||||
|
||||
auto server_state = c->require_server_state();
|
||||
|
||||
string key = "PsoPeepsGCEXP_internal_";
|
||||
key += std::to_string(server_state->psopeeps_gc_exp_multiplier);
|
||||
key += "x_";
|
||||
key += episode_str;
|
||||
|
||||
try {
|
||||
auto fn = server_state->client_functions->get(key, c->specific_version);
|
||||
co_await send_function_call(c, fn);
|
||||
} catch (const out_of_range&) {
|
||||
c->log.warning_f("GC V3 EXP dispatcher could not find client function {}", key);
|
||||
}
|
||||
}
|
||||
|
||||
static asio::awaitable<void> on_trigger_set_event(shared_ptr<Client> c, SubcommandMessage& msg) {
|
||||
auto l = c->require_lobby();
|
||||
if (!l->is_game()) {
|
||||
@@ -3678,6 +3725,7 @@ static asio::awaitable<void> on_trigger_set_event(shared_ptr<Client> c, Subcomma
|
||||
}
|
||||
|
||||
co_await dispatch_dc_v2_exp_patch(c);
|
||||
co_await dispatch_gc_v3_exp_patch(c);
|
||||
|
||||
const auto& cmd = msg.check_size_t<G_TriggerSetEvent_6x67>();
|
||||
auto event_sts = l->map_state->event_states_for_id(c->version(), cmd.floor, cmd.event_id);
|
||||
|
||||
@@ -883,6 +883,11 @@ void ServerState::load_config_early() {
|
||||
throw runtime_error("PsoPeepsDCV2EXPMultiplier must be 5 or 10");
|
||||
}
|
||||
|
||||
this->psopeeps_gc_exp_multiplier = this->config_json->get_int("PsoPeepsGCEXPMultiplier", 5);
|
||||
if ((this->psopeeps_gc_exp_multiplier != 5) && (this->psopeeps_gc_exp_multiplier != 10)) {
|
||||
throw runtime_error("PsoPeepsGCEXPMultiplier must be 5 or 10");
|
||||
}
|
||||
|
||||
this->ip_stack_debug = this->config_json->get_bool("IPStackDebug", false);
|
||||
this->allow_unregistered_users = this->config_json->get_bool("AllowUnregisteredUsers", false);
|
||||
this->allow_pc_nte = this->config_json->get_bool("AllowPCNTE", false);
|
||||
|
||||
@@ -124,6 +124,7 @@ struct ServerState : public std::enable_shared_from_this<ServerState> {
|
||||
uint64_t client_idle_timeout_usecs = 60000000;
|
||||
uint64_t patch_client_idle_timeout_usecs = 300000000;
|
||||
uint64_t psopeeps_dcv2_exp_multiplier = 5;
|
||||
uint64_t psopeeps_gc_exp_multiplier = 5;
|
||||
bool is_debug = false;
|
||||
bool ip_stack_debug = false;
|
||||
bool allow_unregistered_users = false;
|
||||
|
||||
Reference in New Issue
Block a user