move item tables to a separate directory

This commit is contained in:
Martin Michelsen
2023-10-21 22:48:27 -07:00
parent 8f2f7670b2
commit ba7a3fc4c6
20 changed files with 26 additions and 21 deletions
+1 -1
View File
@@ -296,7 +296,7 @@ Some commands only work on the game server and not on the proxy server. The chat
* `$maxlevel <level>`: Sets the maximum level for players to join the current game. (This only applies when joining; if a player joins and then levels up past this level during the game, they are not kicked out, but won't be able to rejoin if they leave.) * `$maxlevel <level>`: Sets the maximum level for players to join the current game. (This only applies when joining; if a player joins and then levels up past this level during the game, they are not kicked out, but won't be able to rejoin if they leave.)
* `$minlevel <level>`: Sets the minimum level for players to join the current game. * `$minlevel <level>`: Sets the minimum level for players to join the current game.
* `$password <password>`: Sets the game's join password. To unlock the game, run `$password` with nothing after it. * `$password <password>`: Sets the game's join password. To unlock the game, run `$password` with nothing after it.
* `$raretable`: Switches between using the client's or the server's drop table. No effect on BB (the server's drop table is always used). The server's rare tables are defined in JSON files in the system/rare-tables directory. * `$raretable`: Switches between using the client's or the server's drop table. No effect on BB (the server's drop table is always used). The server's rare tables are defined in JSON files in the system/item-tables directory.
* Episode 3 commands (game server only) * Episode 3 commands (game server only)
* `$spec`: Toggles the allow spectators flag for Episode 3 games. If any players are spectating when this flag is disabled, they will be sent back to the lobby. * `$spec`: Toggles the allow spectators flag for Episode 3 games. If any players are spectating when this flag is disabled, they will be sent back to the lobby.
+3 -3
View File
@@ -48,12 +48,12 @@ void Lobby::create_item_creator() {
shared_ptr<const RareItemSet> rare_item_set; shared_ptr<const RareItemSet> rare_item_set;
if (this->base_version == GameVersion::BB) { if (this->base_version == GameVersion::BB) {
rare_item_set = s->rare_item_sets.at("default-v4"); rare_item_set = s->rare_item_sets.at("rare-table-v4");
} else if (this->base_version == GameVersion::GC || this->base_version == GameVersion::XB) { } else if (this->base_version == GameVersion::GC || this->base_version == GameVersion::XB) {
rare_item_set = s->rare_item_sets.at("default-v3"); rare_item_set = s->rare_item_sets.at("rare-table-v3");
} else { } else {
// TODO: Should there be a separate table for V1 eventually? // TODO: Should there be a separate table for V1 eventually?
rare_item_set = s->rare_item_sets.at("default-v2"); rare_item_set = s->rare_item_sets.at("rare-table-v2");
} }
this->item_creator.reset(new ItemCreator( this->item_creator.reset(new ItemCreator(
s->common_item_set, s->common_item_set,
+20 -15
View File
@@ -923,8 +923,12 @@ void ServerState::load_word_select_table() {
void ServerState::load_item_tables() { void ServerState::load_item_tables() {
config_log.info("Loading rare item sets"); config_log.info("Loading rare item sets");
for (const auto& filename : list_directory_sorted("system/rare-tables")) { for (const auto& filename : list_directory_sorted("system/item-tables")) {
string path = "system/rare-tables/" + filename; if (!starts_with(filename, "rare-table-")) {
continue;
}
string path = "system/item-tables/" + filename;
size_t ext_offset = filename.rfind('.'); size_t ext_offset = filename.rfind('.');
string basename = (ext_offset == string::npos) ? filename : filename.substr(0, ext_offset); string basename = (ext_offset == string::npos) ? filename : filename.substr(0, ext_offset);
@@ -954,9 +958,10 @@ void ServerState::load_item_tables() {
} }
} }
if (!this->rare_item_sets.count("default-v4")) { if (!this->rare_item_sets.count("rare-table-v4")) {
config_log.info("default-v4 rare item set is not available; loading from BB data"); config_log.info("rare-table-v4 rare item set is not available; loading from BB data");
this->rare_item_sets.emplace("default-v4", new RELRareItemSet(this->load_bb_file("ItemRT.rel"))); shared_ptr<string> data(new string(load_file("system/blueburst/ItemRT.rel")));
this->rare_item_sets.emplace("rare-table-v4", new RELRareItemSet(data));
} }
// Note: These files don't exist in BB, so we use the GC versions of them // Note: These files don't exist in BB, so we use the GC versions of them
@@ -964,25 +969,25 @@ void ServerState::load_item_tables() {
// parameters for Episode 4 implicitly. // parameters for Episode 4 implicitly.
config_log.info("Loading common item table"); config_log.info("Loading common item table");
shared_ptr<string> pt_data(new string(load_file( shared_ptr<string> pt_data(new string(load_file(
"system/blueburst/ItemPT_GC.gsl"))); "system/item-tables/ItemPT-gc.gsl")));
this->common_item_set.reset(new CommonItemSet(pt_data)); this->common_item_set.reset(new CommonItemSet(pt_data));
config_log.info("Loading armor table"); config_log.info("Loading armor table");
shared_ptr<string> armor_data(new string(load_file( shared_ptr<string> armor_data(new string(load_file(
"system/blueburst/ArmorRandom_GC.rel"))); "system/item-tables/ArmorRandom-gc.rel")));
this->armor_random_set.reset(new ArmorRandomSet(armor_data)); this->armor_random_set.reset(new ArmorRandomSet(armor_data));
config_log.info("Loading tool table"); config_log.info("Loading tool table");
shared_ptr<string> tool_data(new string(load_file( shared_ptr<string> tool_data(new string(load_file(
"system/blueburst/ToolRandom_GC.rel"))); "system/item-tables/ToolRandom-gc.rel")));
this->tool_random_set.reset(new ToolRandomSet(tool_data)); this->tool_random_set.reset(new ToolRandomSet(tool_data));
config_log.info("Loading weapon tables"); config_log.info("Loading weapon tables");
const char* filenames[4] = { const char* filenames[4] = {
"system/blueburst/WeaponRandomNormal_GC.rel", "system/item-tables/WeaponRandomNormal-gc.rel",
"system/blueburst/WeaponRandomHard_GC.rel", "system/item-tables/WeaponRandomHard-gc.rel",
"system/blueburst/WeaponRandomVeryHard_GC.rel", "system/item-tables/WeaponRandomVeryHard-gc.rel",
"system/blueburst/WeaponRandomUltimate_GC.rel", "system/item-tables/WeaponRandomUltimate-gc.rel",
}; };
for (size_t z = 0; z < 4; z++) { for (size_t z = 0; z < 4; z++) {
shared_ptr<string> weapon_data(new string(load_file(filenames[z]))); shared_ptr<string> weapon_data(new string(load_file(filenames[z])));
@@ -991,17 +996,17 @@ void ServerState::load_item_tables() {
config_log.info("Loading tekker adjustment table"); config_log.info("Loading tekker adjustment table");
shared_ptr<string> tekker_data(new string(load_file( shared_ptr<string> tekker_data(new string(load_file(
"system/blueburst/JudgeItem_GC.rel"))); "system/item-tables/JudgeItem-gc.rel")));
this->tekker_adjustment_set.reset(new TekkerAdjustmentSet(tekker_data)); this->tekker_adjustment_set.reset(new TekkerAdjustmentSet(tekker_data));
config_log.info("Loading item definition table"); config_log.info("Loading item definition table");
shared_ptr<string> pmt_data(new string(prs_decompress(load_file( shared_ptr<string> pmt_data(new string(prs_decompress(load_file(
"system/blueburst/ItemPMT.prs")))); "system/item-tables/ItemPMT-bb.prs"))));
this->item_parameter_table.reset(new ItemParameterTable(pmt_data)); this->item_parameter_table.reset(new ItemParameterTable(pmt_data));
config_log.info("Loading mag evolution table"); config_log.info("Loading mag evolution table");
shared_ptr<string> mag_data(new string(prs_decompress(load_file( shared_ptr<string> mag_data(new string(prs_decompress(load_file(
"system/blueburst/ItemMagEdit.prs")))); "system/item-tables/ItemMagEdit-bb.prs"))));
this->mag_evolution_table.reset(new MagEvolutionTable(mag_data)); this->mag_evolution_table.reset(new MagEvolutionTable(mag_data));
} }
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
../item-tables/ItemMagEdit-bb.prs
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
../item-tables/ItemPMT-bb.prs
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
../item-tables/ItemRT-bb.rel
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
{ {
// Rare table for PSO DC and PC. // Rare table for PSO DC and PC.
// See default-v4.json for a description of how this file works. // See rare-table-v4.json for a description of how this file works.
// This file is only used when client rare tables are overridden. By default, // This file is only used when client rare tables are overridden. By default,
// the client controls rare drops and this table is ignored. // the client controls rare drops and this table is ignored.
"Normal": { "Normal": {
@@ -1,6 +1,6 @@
{ {
// Rare table for PSO GC and XB. // Rare table for PSO GC and XB.
// See default-v4.json for a description of how this file works. // See rare-table-v4.json for a description of how this file works.
// This file is only used when client rare tables are overridden. By default, // This file is only used when client rare tables are overridden. By default,
// the client controls rare drops and this table is ignored. // the client controls rare drops and this table is ignored.
"Normal": { "Normal": {