hide section ID for empty persistent games

This commit is contained in:
Martin Michelsen
2025-10-11 17:35:48 -07:00
parent 41026fbd93
commit 3c32a66064
7 changed files with 53 additions and 39 deletions
+5 -4
View File
@@ -1433,11 +1433,12 @@ ChatCommandDefinition cc_lobby_info(
if (l->max_level == 0xFFFFFFFF) {
lines.emplace_back(std::format("$C6{:08X}$C7 L$C6{}+$C7", l->lobby_id, l->min_level + 1));
} else {
lines.emplace_back(std::format(
"$C6{:08X}$C7 L$C6{}-{}$C7", l->lobby_id, l->min_level + 1, l->max_level + 1));
lines.emplace_back(std::format("$C6{:08X}$C7 L$C6{}-{}$C7", l->lobby_id, l->min_level + 1, l->max_level + 1));
}
uint8_t effective_section_id = l->effective_section_id();
if (effective_section_id < 10) {
lines.emplace_back(std::format("$C7Section ID: $C6{}$C7", name_for_section_id(effective_section_id)));
}
lines.emplace_back(std::format(
"$C7Section ID: $C6{}$C7", name_for_section_id(l->effective_section_id())));
switch (l->drop_mode) {
case ServerDropMode::DISABLED:
+12 -2
View File
@@ -379,7 +379,12 @@ std::shared_ptr<phosg::JSON> HTTPServer::generate_lobby_json(
ret->emplace("QuestInProgress", l->check_flag(Lobby::Flag::QUEST_IN_PROGRESS));
ret->emplace("JoinableQuestInProgress", l->check_flag(Lobby::Flag::JOINABLE_QUEST_IN_PROGRESS));
ret->emplace("Variations", l->variations.json());
ret->emplace("SectionID", name_for_section_id(l->effective_section_id()));
uint8_t effective_section_id = l->effective_section_id();
if (effective_section_id < 10) {
ret->emplace("SectionID", name_for_section_id(effective_section_id));
} else {
ret->emplace("SectionID", nullptr);
}
ret->emplace("Mode", name_for_mode(l->mode));
ret->emplace("Difficulty", name_for_difficulty(l->difficulty));
ret->emplace("BaseEXPMultiplier", l->base_exp_multiplier);
@@ -634,7 +639,12 @@ std::shared_ptr<phosg::JSON> HTTPServer::generate_summary_json() const {
game_json.emplace("QuestSelectionInProgress", l->check_flag(Lobby::Flag::QUEST_SELECTION_IN_PROGRESS));
game_json.emplace("QuestInProgress", l->check_flag(Lobby::Flag::QUEST_IN_PROGRESS));
game_json.emplace("JoinableQuestInProgress", l->check_flag(Lobby::Flag::JOINABLE_QUEST_IN_PROGRESS));
game_json.emplace("SectionID", name_for_section_id(l->effective_section_id()));
uint8_t effective_section_id = l->effective_section_id();
if (effective_section_id < 10) {
game_json.emplace("SectionID", name_for_section_id(effective_section_id));
} else {
game_json.emplace("SectionID", nullptr);
}
game_json.emplace("Mode", name_for_mode(l->mode));
game_json.emplace("Difficulty", name_for_difficulty(l->difficulty));
game_json.emplace("Quest", l->quest ? l->quest->json() : phosg::JSON(nullptr));
+6 -2
View File
@@ -211,6 +211,10 @@ void Lobby::create_item_creator(Version logic_version) {
} else {
rand_crypt = make_shared<MT19937Generator>(this->rand_crypt->seed());
}
uint8_t effective_section_id = this->effective_section_id();
if (effective_section_id >= 10) {
effective_section_id = 0x00;
}
this->item_creator = make_shared<ItemCreator>(
s->common_item_set(logic_version, this->quest),
s->rare_item_set(logic_version, this->quest),
@@ -223,7 +227,7 @@ void Lobby::create_item_creator(Version logic_version) {
this->episode,
(this->mode == GameMode::SOLO) ? GameMode::NORMAL : this->mode,
this->difficulty,
this->effective_section_id(),
effective_section_id,
rand_crypt,
this->quest ? this->quest->meta.battle_rules : nullptr);
}
@@ -239,7 +243,7 @@ uint8_t Lobby::effective_section_id() const {
if (leader) {
return leader->character_file()->disp.visual.section_id;
}
return 0;
return 0xFF;
}
uint16_t Lobby::quest_version_flags() const {
+1 -1
View File
@@ -206,7 +206,7 @@ struct Lobby : public std::enable_shared_from_this<Lobby> {
std::shared_ptr<ServerState> require_server_state() const;
std::shared_ptr<ChallengeParameters> require_challenge_params() const;
void create_item_creator(Version logic_version = Version::UNKNOWN);
uint8_t effective_section_id() const;
uint8_t effective_section_id() const; // Returns 0xFF if not assigned (e.g. empty persistent game)
uint16_t quest_version_flags() const;
uint8_t client_extension_flags() const;
void load_maps();
+4 -1
View File
@@ -2246,7 +2246,10 @@ static asio::awaitable<void> on_09(shared_ptr<Client> c, Channel::Message& msg)
// time, send page 2 (extended info)
if (info.empty()) {
c->last_game_info_requested = 0;
info += std::format("Section ID: {}\n", name_for_section_id(game->effective_section_id()));
uint8_t effective_section_id = game->effective_section_id();
if (effective_section_id < 10) {
info += std::format("Section ID: {}\n", name_for_section_id(effective_section_id));
}
if (game->max_level != 0xFFFFFFFF) {
info += std::format("Req. level: {}-{}\n", game->min_level + 1, game->max_level + 1);
} else if (game->min_level != 0) {
+5 -1
View File
@@ -4377,7 +4377,11 @@ static asio::awaitable<void> on_identify_item_bb(shared_ptr<Client> c, Subcomman
p->disp.stats.meseta -= 100;
c->bb_identify_result = p->inventory.items[x].data;
c->bb_identify_result.data1[4] &= 0x7F;
l->item_creator->apply_tekker_deltas(c->bb_identify_result, l->effective_section_id());
uint8_t effective_section_id = l->effective_section_id();
if (effective_section_id >= 10) {
throw std::runtime_error("effective section ID is not valid");
}
l->item_creator->apply_tekker_deltas(c->bb_identify_result, effective_section_id);
send_item_identify_result(c);
} else {
+20 -28
View File
@@ -19562,43 +19562,35 @@ I 56583 2025-05-23 21:27:15 - [Commands] Sending to C-4 (Jess Lv.51) @ ipss:N-1:
I 56583 2025-05-23 21:27:15 - [Commands] Received from C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=09 flag=00)
0000 | 09 00 0C 00 44 00 00 44 15 00 00 00 | D D
I 56583 2025-05-23 21:27:15 - [Commands] Sending to C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=11 flag=00)
0000 | 11 00 64 00 00 00 00 00 00 00 00 00 53 65 63 74 | d Sect
0010 | 69 6F 6E 20 49 44 3A 20 56 69 72 69 64 69 61 0A | ion ID: Viridia
0020 | 09 43 36 43 68 65 61 74 73 20 65 6E 61 62 6C 65 | C6Cheats enable
0030 | 64 09 43 37 0A 09 43 36 50 65 72 73 69 73 74 65 | d C7 C6Persiste
0040 | 6E 63 65 20 65 6E 61 62 6C 65 64 09 43 37 0A 09 | nce enabled C7
0050 | 43 36 50 72 69 76 61 74 65 20 64 72 6F 70 73 09 | C6Private drops
0060 | 43 37 00 00 | C7
0000 | 11 00 50 00 00 00 00 00 00 00 00 00 09 43 36 43 | P C6C
0010 | 68 65 61 74 73 20 65 6E 61 62 6C 65 64 09 43 37 | heats enabled C7
0020 | 0A 09 43 36 50 65 72 73 69 73 74 65 6E 63 65 20 | C6Persistence
0030 | 65 6E 61 62 6C 65 64 09 43 37 0A 09 43 36 50 72 | enabled C7 C6Pr
0040 | 69 76 61 74 65 20 64 72 6F 70 73 09 43 37 00 00 | ivate drops C7
I 56583 2025-05-23 21:27:16 - [Commands] Received from C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=09 flag=00)
0000 | 09 00 0C 00 44 00 00 44 15 00 00 00 | D D
I 56583 2025-05-23 21:27:16 - [Commands] Sending to C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=11 flag=00)
0000 | 11 00 64 00 00 00 00 00 00 00 00 00 53 65 63 74 | d Sect
0010 | 69 6F 6E 20 49 44 3A 20 56 69 72 69 64 69 61 0A | ion ID: Viridia
0020 | 09 43 36 43 68 65 61 74 73 20 65 6E 61 62 6C 65 | C6Cheats enable
0030 | 64 09 43 37 0A 09 43 36 50 65 72 73 69 73 74 65 | d C7 C6Persiste
0040 | 6E 63 65 20 65 6E 61 62 6C 65 64 09 43 37 0A 09 | nce enabled C7
0050 | 43 36 50 72 69 76 61 74 65 20 64 72 6F 70 73 09 | C6Private drops
0060 | 43 37 00 00 | C7
0000 | 11 00 50 00 00 00 00 00 00 00 00 00 09 43 36 43 | P C6C
0010 | 68 65 61 74 73 20 65 6E 61 62 6C 65 64 09 43 37 | heats enabled C7
0020 | 0A 09 43 36 50 65 72 73 69 73 74 65 6E 63 65 20 | C6Persistence
0030 | 65 6E 61 62 6C 65 64 09 43 37 0A 09 43 36 50 72 | enabled C7 C6Pr
0040 | 69 76 61 74 65 20 64 72 6F 70 73 09 43 37 00 00 | ivate drops C7
I 56583 2025-05-23 21:27:17 - [Commands] Received from C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=09 flag=00)
0000 | 09 00 0C 00 44 00 00 44 15 00 00 00 | D D
I 56583 2025-05-23 21:27:17 - [Commands] Sending to C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=11 flag=00)
0000 | 11 00 64 00 00 00 00 00 00 00 00 00 53 65 63 74 | d Sect
0010 | 69 6F 6E 20 49 44 3A 20 56 69 72 69 64 69 61 0A | ion ID: Viridia
0020 | 09 43 36 43 68 65 61 74 73 20 65 6E 61 62 6C 65 | C6Cheats enable
0030 | 64 09 43 37 0A 09 43 36 50 65 72 73 69 73 74 65 | d C7 C6Persiste
0040 | 6E 63 65 20 65 6E 61 62 6C 65 64 09 43 37 0A 09 | nce enabled C7
0050 | 43 36 50 72 69 76 61 74 65 20 64 72 6F 70 73 09 | C6Private drops
0060 | 43 37 00 00 | C7
0000 | 11 00 50 00 00 00 00 00 00 00 00 00 09 43 36 43 | P C6C
0010 | 68 65 61 74 73 20 65 6E 61 62 6C 65 64 09 43 37 | heats enabled C7
0020 | 0A 09 43 36 50 65 72 73 69 73 74 65 6E 63 65 20 | C6Persistence
0030 | 65 6E 61 62 6C 65 64 09 43 37 0A 09 43 36 50 72 | enabled C7 C6Pr
0040 | 69 76 61 74 65 20 64 72 6F 70 73 09 43 37 00 00 | ivate drops C7
I 56583 2025-05-23 21:27:18 - [Commands] Received from C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=09 flag=00)
0000 | 09 00 0C 00 44 00 00 44 15 00 00 00 | D D
I 56583 2025-05-23 21:27:18 - [Commands] Sending to C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=11 flag=00)
0000 | 11 00 64 00 00 00 00 00 00 00 00 00 53 65 63 74 | d Sect
0010 | 69 6F 6E 20 49 44 3A 20 56 69 72 69 64 69 61 0A | ion ID: Viridia
0020 | 09 43 36 43 68 65 61 74 73 20 65 6E 61 62 6C 65 | C6Cheats enable
0030 | 64 09 43 37 0A 09 43 36 50 65 72 73 69 73 74 65 | d C7 C6Persiste
0040 | 6E 63 65 20 65 6E 61 62 6C 65 64 09 43 37 0A 09 | nce enabled C7
0050 | 43 36 50 72 69 76 61 74 65 20 64 72 6F 70 73 09 | C6Private drops
0060 | 43 37 00 00 | C7
0000 | 11 00 50 00 00 00 00 00 00 00 00 00 09 43 36 43 | P C6C
0010 | 68 65 61 74 73 20 65 6E 61 62 6C 65 64 09 43 37 | heats enabled C7
0020 | 0A 09 43 36 50 65 72 73 69 73 74 65 6E 63 65 20 | C6Persistence
0030 | 65 6E 61 62 6C 65 64 09 43 37 0A 09 43 36 50 72 | enabled C7 C6Pr
0040 | 69 76 61 74 65 20 64 72 6F 70 73 09 43 37 00 00 | ivate drops C7
I 56583 2025-05-23 21:27:19 - [Commands] Received from C-4 (Jess Lv.51) @ ipss:N-1:127.0.0.1:49211 (version=GC_V3 command=10 flag=00)
0000 | 10 00 0C 00 44 00 00 44 15 00 00 00 | D D
I 56583 2025-05-23 21:27:19 - [Lobby:00000015:FloorItems:00] Added floor item CC000000 at 264.563, 264.725 with drop number 0 with flags 00F