hide section ID for empty persistent games
This commit is contained in:
+5
-4
@@ -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
@@ -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
@@ -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
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user