Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: refresh bosstiary tracker kills on boss death #1605

Merged
merged 3 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1654,9 +1654,6 @@ void Player::onCreatureAppear(Creature* creature, bool isLogin) {
}
}

// Reload bestiary tracker
refreshBestiaryMonsterTracker();

g_game().checkPlayersRecord();
IOLoginData::updateOnlineStatus(guid, true);
if (getLevel() < g_configManager().getNumber(ADVENTURERSBLESSING_LEVEL)) {
Expand Down
4 changes: 2 additions & 2 deletions src/creatures/players/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::shared_ptr<MonsterType>> &trackerList, bool isBoss) const {
Expand Down
1 change: 1 addition & 0 deletions src/io/io_bosstiary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ void IOBosstiary::addBosstiaryKill(Player* player, const std::shared_ptr<Monster

auto oldBossLevel = getBossCurrentLevel(player, bossId);
player->addBestiaryKillCount(bossId, amount);
player->refreshCyclopediaMonsterTracker(true);
auto newBossLevel = getBossCurrentLevel(player, bossId);
if (oldBossLevel == newBossLevel) {
return;
Expand Down
8 changes: 2 additions & 6 deletions src/io/iobestiary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,8 @@ void IOBestiary::addBestiaryKill(Player* player, const std::shared_ptr<MonsterTy
}
}

const auto &trackerUnorderedSet = player->getCyclopediaMonsterTrackerSet(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<MonsterType> mtype) {
Expand Down