improve specialized box log messages

This commit is contained in:
Martin Michelsen
2023-11-14 12:24:59 -08:00
parent 6568ba7e32
commit e3956a0a09
5 changed files with 20 additions and 6 deletions
+3
View File
@@ -1658,7 +1658,10 @@ ItemData ItemCreator::on_specialized_box_item_drop(uint16_t entity_id, uint32_t
if (!this->destroyed_boxes.emplace(entity_id).second) { if (!this->destroyed_boxes.emplace(entity_id).second) {
return ItemData(); return ItemData();
} }
return this->item_for_specialized_box(def0, def1, def2);
}
ItemData ItemCreator::item_for_specialized_box(uint32_t def0, uint32_t def1, uint32_t def2) {
ItemData item; ItemData item;
item.data1[0] = (def0 >> 0x18) & 0x0F; item.data1[0] = (def0 >> 0x18) & 0x0F;
item.data1[1] = (def0 >> 0x10) + ((item.data1[0] == 0x00) || (item.data1[0] == 0x01)); item.data1[1] = (def0 >> 0x10) + ((item.data1[0] == 0x00) || (item.data1[0] == 0x01));
+2
View File
@@ -34,6 +34,8 @@ public:
ItemData on_box_item_drop(uint16_t entity_id, uint8_t area); ItemData on_box_item_drop(uint16_t entity_id, uint8_t area);
ItemData on_specialized_box_item_drop(uint16_t entity_id, uint32_t def0, uint32_t def1, uint32_t def2); ItemData on_specialized_box_item_drop(uint16_t entity_id, uint32_t def0, uint32_t def1, uint32_t def2);
static ItemData item_for_specialized_box(uint32_t def0, uint32_t def1, uint32_t def2);
std::vector<ItemData> generate_armor_shop_contents(size_t player_level); std::vector<ItemData> generate_armor_shop_contents(size_t player_level);
std::vector<ItemData> generate_tool_shop_contents(size_t player_level); std::vector<ItemData> generate_tool_shop_contents(size_t player_level);
std::vector<ItemData> generate_weapon_shop_contents(size_t player_level); std::vector<ItemData> generate_weapon_shop_contents(size_t player_level);
+12 -4
View File
@@ -4,6 +4,7 @@
#include <phosg/Random.hh> #include <phosg/Random.hh>
#include <phosg/Strings.hh> #include <phosg/Strings.hh>
#include "ItemCreator.hh"
#include "Loggers.hh" #include "Loggers.hh"
#include "PSOEncryption.hh" #include "PSOEncryption.hh"
#include "Quest.hh" #include "Quest.hh"
@@ -25,10 +26,17 @@ string Map::Enemy::str() const {
name_for_enum(this->type), this->flags, this->last_hit_by_client_id); name_for_enum(this->type), this->flags, this->last_hit_by_client_id);
} }
string Map::Object::str() const { string Map::Object::str(shared_ptr<const ItemNameIndex> name_index) const {
return string_printf("[Map::Object %04hX @%04hX p1=%g (%s) p456=[%08" PRIX32 " %08" PRIX32 " %08" PRIX32 "] floor=%02hhX item_drop_checked=%s]", if (this->param1 <= 0.0f) {
this->base_type, this->section, this->param1, (this->param1 <= 0.0f) ? "specialized" : "generic", auto item = ItemCreator::item_for_specialized_box(this->param4, this->param5, this->param6);
this->param4, this->param5, this->param6, this->floor, this->item_drop_checked ? "true" : "false"); string item_name = name_index ? name_index->describe_item(GameVersion::BB, item) : item.hex();
return string_printf("[Map::Object %04hX @%04hX p1=%g (specialized: %s) floor=%02hhX item_drop_checked=%s]",
this->base_type, this->section, this->param1, item_name.c_str(), this->floor, this->item_drop_checked ? "true" : "false");
} else {
return string_printf("[Map::Object %04hX @%04hX p1=%g (generic) p456=[%08" PRIX32 " %08" PRIX32 " %08" PRIX32 "] floor=%02hhX item_drop_checked=%s]",
this->base_type, this->section, this->param1, this->param4, this->param5, this->param6,
this->floor, this->item_drop_checked ? "true" : "false");
}
} }
void Map::clear() { void Map::clear() {
+2 -1
View File
@@ -9,6 +9,7 @@
#include <vector> #include <vector>
#include "BattleParamsIndex.hh" #include "BattleParamsIndex.hh"
#include "ItemNameIndex.hh"
#include "PSOEncryption.hh" #include "PSOEncryption.hh"
#include "StaticGameData.hh" #include "StaticGameData.hh"
#include "Text.hh" #include "Text.hh"
@@ -204,7 +205,7 @@ struct Map {
uint8_t floor; uint8_t floor;
bool item_drop_checked; bool item_drop_checked;
std::string str() const; std::string str(std::shared_ptr<const ItemNameIndex> name_index) const;
}; };
struct Enemy { struct Enemy {
+1 -1
View File
@@ -3777,7 +3777,7 @@ shared_ptr<Lobby> create_game_generic(
size_t entries_loaded = game->map->objects.size() - start_offset; size_t entries_loaded = game->map->objects.size() - start_offset;
c->log.info("[Map/%zu:o] Loaded %s (%zu entries)", floor, filename.c_str(), entries_loaded); c->log.info("[Map/%zu:o] Loaded %s (%zu entries)", floor, filename.c_str(), entries_loaded);
for (size_t z = start_offset; z < game->map->objects.size(); z++) { for (size_t z = start_offset; z < game->map->objects.size(); z++) {
string e_str = game->map->objects[z].str(); string e_str = game->map->objects[z].str(s->item_name_index);
static_game_data_log.info("(K-%zX) %s", z, e_str.c_str()); static_game_data_log.info("(K-%zX) %s", z, e_str.c_str());
} }
any_map_loaded = true; any_map_loaded = true;