From 839f5b95d228fda05f31649d83062a3029e3e2dd Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Fri, 15 Sep 2023 15:39:06 -0300 Subject: [PATCH 1/2] fix: refresh bosstiary tracker kills on boss death --- src/creatures/players/player.cpp | 2 +- src/creatures/players/player.hpp | 4 ++-- src/io/io_bosstiary.cpp | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index b018a9d5e25..c99d06f7bdf 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -1655,7 +1655,7 @@ void Player::onCreatureAppear(Creature* creature, bool isLogin) { } // Reload bestiary tracker - refreshBestiaryMonsterTracker(); + refreshCyclopediaMonsterTracker(); g_game().checkPlayersRecord(); IOLoginData::updateOnlineStatus(guid, true); diff --git a/src/creatures/players/player.hpp b/src/creatures/players/player.hpp index 34bda548582..5f159f0ec37 100644 --- a/src/creatures/players/player.hpp +++ b/src/creatures/players/player.hpp @@ -303,8 +303,8 @@ class Player final : public Creature, public Cylinder, public Bankable { } } - void refreshBestiaryMonsterTracker() const { - refreshCyclopediaMonsterTracker(getCyclopediaMonsterTrackerSet(false), false); + void refreshCyclopediaMonsterTracker(bool isBoss = false) const { + refreshCyclopediaMonsterTracker(getCyclopediaMonsterTrackerSet(isBoss), isBoss); } void refreshCyclopediaMonsterTracker(const phmap::parallel_flat_hash_set> &trackerList, bool isBoss) const { diff --git a/src/io/io_bosstiary.cpp b/src/io/io_bosstiary.cpp index 45a650765c1..afe6c647245 100644 --- a/src/io/io_bosstiary.cpp +++ b/src/io/io_bosstiary.cpp @@ -176,6 +176,7 @@ void IOBosstiary::addBosstiaryKill(Player* player, const std::shared_ptraddBestiaryKillCount(bossId, amount); + player->refreshCyclopediaMonsterTracker(true); auto newBossLevel = getBossCurrentLevel(player, bossId); if (oldBossLevel == newBossLevel) { return; From 5bd4017e0b0454a36a113ac1fd13b2b03371132f Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Fri, 15 Sep 2023 16:49:05 -0300 Subject: [PATCH 2/2] fix: adjust bestiary logic to add kill monster only --- src/creatures/players/player.cpp | 3 --- src/io/iobestiary.cpp | 8 ++------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index c99d06f7bdf..9d9a5e9c54d 100644 --- a/src/creatures/players/player.cpp +++ b/src/creatures/players/player.cpp @@ -1654,9 +1654,6 @@ void Player::onCreatureAppear(Creature* creature, bool isLogin) { } } - // Reload bestiary tracker - refreshCyclopediaMonsterTracker(); - g_game().checkPlayersRecord(); IOLoginData::updateOnlineStatus(guid, true); if (getLevel() < g_configManager().getNumber(ADVENTURERSBLESSING_LEVEL)) { diff --git a/src/io/iobestiary.cpp b/src/io/iobestiary.cpp index 2cb73b40e7e..acfeb561ae6 100644 --- a/src/io/iobestiary.cpp +++ b/src/io/iobestiary.cpp @@ -237,12 +237,8 @@ void IOBestiary::addBestiaryKill(Player* player, const std::shared_ptrgetCyclopediaMonsterTrackerSet(false); - for (const auto mType : trackerUnorderedSet) { - if (raceid == mType->info.raceid) { - player->refreshCyclopediaMonsterTracker(trackerUnorderedSet, false); - } - } + // Reload bestiary tracker + player->refreshCyclopediaMonsterTracker(); } charmRune_t IOBestiary::getCharmFromTarget(Player* player, const std::shared_ptr mtype) {