Skip to content

Commit

Permalink
fix: refresh bosstiary tracker kills on boss death (#1605)
Browse files Browse the repository at this point in the history
I wasn't updating the deaths on the tracker when a new one was killed.
  • Loading branch information
dudantas authored Sep 16, 2023
1 parent 5f1f98e commit d65fb54
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
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

0 comments on commit d65fb54

Please sign in to comment.