add UnlockAllAreas config option

This commit is contained in:
Martin Michelsen
2024-03-18 10:03:37 -07:00
parent 93d97d3e5b
commit 325f7c6efc
5 changed files with 43 additions and 0 deletions
+34
View File
@@ -4322,6 +4322,40 @@ shared_ptr<Lobby> create_game_generic(
game->quest_flag_values = make_unique<QuestFlags>();
game->quest_flags_known = make_unique<QuestFlags>();
}
if (s->unlock_all_areas) {
static const vector<uint16_t> flags_ep1_v123 = {0x0017, 0x0020, 0x002A};
static const vector<uint16_t> flags_ep1_v4 = {0x01F9, 0x0201, 0x0207};
static const vector<uint16_t> flags_ep2_v123 = {0x004C, 0x004F, 0x0052};
static const vector<uint16_t> flags_ep2_v4 = {0x021B, 0x0225, 0x022F};
static const vector<uint16_t> flags_ep4_v4 = {0x02BD, 0x02BE, 0x02BF, 0x02C0, 0x02C1};
const vector<uint16_t>* flags_to_enable;
switch (game->episode) {
case Episode::EP1:
flags_to_enable = is_v4(game->base_version) ? &flags_ep1_v4 : &flags_ep1_v123;
break;
case Episode::EP2:
flags_to_enable = is_v4(game->base_version) ? &flags_ep2_v4 : &flags_ep2_v123;
break;
case Episode::EP4:
flags_to_enable = &flags_ep1_v4;
break;
default:
flags_to_enable = nullptr;
}
if (flags_to_enable) {
for (uint16_t flag_num : *flags_to_enable) {
game->quest_flag_values->set(game->difficulty, flag_num);
if (game->quest_flags_known) {
game->quest_flags_known->set(game->difficulty, flag_num);
}
}
c->config.set_flag(Client::Flag::SHOULD_SEND_ARTIFICIAL_FLAG_STATE);
}
}
game->switch_flags = make_unique<SwitchFlags>();
return game;
+1
View File
@@ -890,6 +890,7 @@ void ServerState::load_config_early() {
this->allow_dc_pc_games = this->config_json->get_bool("AllowDCPCGames", true);
this->allow_gc_xb_games = this->config_json->get_bool("AllowGCXBGames", true);
this->enable_chat_commands = this->config_json->get_bool("EnableChatCommands", true);
this->unlock_all_areas = this->config_json->get_bool("UnlockAllAreas", false);
this->version_name_colors.reset();
try {
+1
View File
@@ -91,6 +91,7 @@ struct ServerState : public std::enable_shared_from_this<ServerState> {
bool allow_dc_pc_games = true;
bool allow_gc_xb_games = true;
bool enable_chat_commands = true;
bool unlock_all_areas = false;
std::unique_ptr<std::array<uint32_t, NUM_NON_PATCH_VERSIONS>> version_name_colors;
uint8_t allowed_drop_modes_v1_v2_normal = 0x1F;
uint8_t allowed_drop_modes_v1_v2_battle = 0x07;
+6
View File
@@ -957,6 +957,12 @@
// available on the proxy server.
"CheatModeBehavior": "OnByDefault",
// Whether to unlock all areas by default in Ep1/2/4 games. If this is on,
// the Ragol warp in Pioneer 2 will allow access to all base areas (Forest 1,
// Cave 1, Mine 1, and Ruins 1 in Episode 1, for example) even if the player
// who created the game does not yet have access to those areas.
"UnlockAllAreas": false,
// Whether to enable rare drop notifications by default. Players can toggle
// this behavior for themselves with the $itemnotifs command.
"RareNotificationsEnabledByDefaultV1V2": false,
+1
View File
@@ -30,6 +30,7 @@
"DefaultDropModeV4Battle": "SERVER_SHARED",
"DefaultDropModeV4Challenge": "SERVER_SHARED",
"CheatModeBehavior": "OnByDefault",
"UnlockAllAreas": false,
"RareNotificationsEnabledByDefault": false,
"LocalAddress": "en0",