add names in show-battle-params
This commit is contained in:
@@ -9,10 +9,17 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
void BattleParamsIndex::Table::print(FILE* stream) const {
|
||||
auto print_entry = +[](FILE* stream, const PlayerStats& e) {
|
||||
void BattleParamsIndex::Table::print(FILE* stream, Episode episode) const {
|
||||
auto print_entry = [stream, episode](const PlayerStats& e, size_t z) {
|
||||
string names_str;
|
||||
for (auto type : enemy_types_for_battle_param_index(episode, z)) {
|
||||
if (!names_str.empty()) {
|
||||
names_str += ", ";
|
||||
}
|
||||
names_str += phosg::name_for_enum(type);
|
||||
}
|
||||
phosg::fwrite_fmt(stream,
|
||||
"{:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5}",
|
||||
"{:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {:5} {}",
|
||||
e.char_stats.atp,
|
||||
e.char_stats.mst,
|
||||
e.char_stats.evp,
|
||||
@@ -22,15 +29,16 @@ void BattleParamsIndex::Table::print(FILE* stream) const {
|
||||
e.char_stats.lck,
|
||||
e.esp,
|
||||
e.experience,
|
||||
e.meseta);
|
||||
e.meseta,
|
||||
names_str);
|
||||
};
|
||||
|
||||
for (size_t diff = 0; diff < 4; diff++) {
|
||||
phosg::fwrite_fmt(stream, "{} ZZ ATP PSV EVP HP DFP ATA LCK ESP EXP DIFF\n",
|
||||
phosg::fwrite_fmt(stream, "{} ZZ ATP PSV EVP HP DFP ATA LCK ESP EXP DIFF NAMES\n",
|
||||
abbreviation_for_difficulty(diff));
|
||||
for (size_t z = 0; z < 0x60; z++) {
|
||||
phosg::fwrite_fmt(stream, " {:02X} ", z);
|
||||
print_entry(stream, this->stats[diff][z]);
|
||||
print_entry(this->stats[diff][z], z);
|
||||
fputc('\n', stream);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
/* AE00 */ parray<parray<MovementData, 0x60>, 4> movement_data;
|
||||
/* F600 */
|
||||
|
||||
void print(FILE* stream) const;
|
||||
void print(FILE* stream, Episode episode) const;
|
||||
} __packed_ws__(Table, 0xF600);
|
||||
|
||||
BattleParamsIndex(
|
||||
|
||||
@@ -198,6 +198,33 @@ const vector<EnemyType>& enemy_types_for_rare_table_index(Episode episode, uint8
|
||||
}
|
||||
}
|
||||
|
||||
const vector<EnemyType>& enemy_types_for_battle_param_index(Episode episode, uint8_t bp_index) {
|
||||
const auto& generate_table = +[](Episode episode) -> vector<vector<EnemyType>> {
|
||||
vector<vector<EnemyType>> ret;
|
||||
for (const auto& def : type_defs) {
|
||||
if (def.valid_in_episode(episode) && (def.bp_index != 0xFF)) {
|
||||
if (def.bp_index >= ret.size()) {
|
||||
ret.resize(def.bp_index + 1);
|
||||
}
|
||||
ret[def.bp_index].emplace_back(def.type);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
static array<vector<vector<EnemyType>>, 5> data;
|
||||
auto& ret = data.at(static_cast<size_t>(episode));
|
||||
if (ret.empty()) {
|
||||
ret = generate_table(episode);
|
||||
}
|
||||
try {
|
||||
return ret.at(bp_index);
|
||||
} catch (const out_of_range&) {
|
||||
static const vector<EnemyType> empty_vec;
|
||||
return empty_vec;
|
||||
}
|
||||
}
|
||||
|
||||
EnemyType EnemyTypeDefinition::rare_type(Episode episode, uint8_t event, uint8_t floor) const {
|
||||
switch (this->type) {
|
||||
case EnemyType::HILDEBEAR:
|
||||
|
||||
@@ -181,3 +181,4 @@ template <>
|
||||
EnemyType phosg::enum_for_name<EnemyType>(const char* name);
|
||||
|
||||
const std::vector<EnemyType>& enemy_types_for_rare_table_index(Episode episode, uint8_t rt_index);
|
||||
const std::vector<EnemyType>& enemy_types_for_battle_param_index(Episode episode, uint8_t bp_index);
|
||||
|
||||
+6
-6
@@ -2809,17 +2809,17 @@ Action a_show_battle_params(
|
||||
s->load_battle_params();
|
||||
|
||||
phosg::fwrite_fmt(stdout, "Episode 1 multi\n");
|
||||
s->battle_params->get_table(false, Episode::EP1).print(stdout);
|
||||
s->battle_params->get_table(false, Episode::EP1).print(stdout, Episode::EP1);
|
||||
phosg::fwrite_fmt(stdout, "Episode 1 solo\n");
|
||||
s->battle_params->get_table(true, Episode::EP1).print(stdout);
|
||||
s->battle_params->get_table(true, Episode::EP1).print(stdout, Episode::EP1);
|
||||
phosg::fwrite_fmt(stdout, "Episode 2 multi\n");
|
||||
s->battle_params->get_table(false, Episode::EP2).print(stdout);
|
||||
s->battle_params->get_table(false, Episode::EP2).print(stdout, Episode::EP2);
|
||||
phosg::fwrite_fmt(stdout, "Episode 2 solo\n");
|
||||
s->battle_params->get_table(true, Episode::EP2).print(stdout);
|
||||
s->battle_params->get_table(true, Episode::EP2).print(stdout, Episode::EP2);
|
||||
phosg::fwrite_fmt(stdout, "Episode 4 multi\n");
|
||||
s->battle_params->get_table(false, Episode::EP4).print(stdout);
|
||||
s->battle_params->get_table(false, Episode::EP4).print(stdout, Episode::EP4);
|
||||
phosg::fwrite_fmt(stdout, "Episode 4 solo\n");
|
||||
s->battle_params->get_table(true, Episode::EP4).print(stdout);
|
||||
s->battle_params->get_table(true, Episode::EP4).print(stdout, Episode::EP4);
|
||||
});
|
||||
|
||||
Action a_check_supermaps(
|
||||
|
||||
@@ -2252,8 +2252,7 @@ static asio::awaitable<void> on_pick_up_item_generic(
|
||||
// This can happen if the network is slow, and the client tries to pick up
|
||||
// the same item multiple times. Or multiple clients could try to pick up
|
||||
// the same item at approximately the same time; only one should get it.
|
||||
l->log.warning_f("Player {} requests to pick up {:08X}, but the item does not exist; dropping command",
|
||||
client_id, item_id);
|
||||
l->log.warning_f("Player {} requests to pick up {:08X}, but the item does not exist; dropping command", client_id, item_id);
|
||||
|
||||
} else {
|
||||
// This is handled by the server on BB, and by the leader on other versions.
|
||||
@@ -2300,8 +2299,7 @@ static asio::awaitable<void> on_pick_up_item_generic(
|
||||
}
|
||||
}
|
||||
|
||||
if (!c->login->account->check_user_flag(Account::UserFlag::DISABLE_DROP_NOTIFICATION_BROADCAST) &&
|
||||
(fi->flags & 0x1000)) {
|
||||
if (!c->login->account->check_user_flag(Account::UserFlag::DISABLE_DROP_NOTIFICATION_BROADCAST) && (fi->flags & 0x1000)) {
|
||||
uint32_t pi = fi->data.primary_identifier();
|
||||
bool should_send_game_notif, should_send_global_notif;
|
||||
if (is_v1_or_v2(c->version()) && (c->version() != Version::GC_NTE)) {
|
||||
|
||||
Reference in New Issue
Block a user