diff --git a/src/creatures/players/player.cpp b/src/creatures/players/player.cpp index 5594955f8c4..099e333136e 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 - refreshBestiaryMonsterTracker(); - g_game().checkPlayersRecord(); IOLoginData::updateOnlineStatus(guid, true); if (getLevel() < g_configManager().getNumber(ADVENTURERSBLESSING_LEVEL)) { 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/game/game.cpp b/src/game/game.cpp index 425693e4a77..7889c412cec 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -9087,6 +9087,7 @@ void Game::playerRotatePodium(uint32_t playerId, const Position &pos, uint8_t st // We retrieve the outfit information to be able to rotate the podium of renown in the new direction Outfit_t newOutfit; newOutfit.lookType = InternalGame::getCustomAttributeValue(item, "LookType"); + newOutfit.lookAddons = InternalGame::getCustomAttributeValue(item, "LookAddons"); newOutfit.lookHead = InternalGame::getCustomAttributeValue(item, "LookHead"); newOutfit.lookBody = InternalGame::getCustomAttributeValue(item, "LookBody"); newOutfit.lookLegs = InternalGame::getCustomAttributeValue(item, "LookLegs"); diff --git a/src/io/functions/iologindata_load_player.cpp b/src/io/functions/iologindata_load_player.cpp index 39dcf910fc1..f8e6e785563 100644 --- a/src/io/functions/iologindata_load_player.cpp +++ b/src/io/functions/iologindata_load_player.cpp @@ -219,7 +219,7 @@ void IOLoginDataLoad::loadPlayerBlessings(Player* player, DBResult_ptr result) { } } -void IOLoginDataLoad::loadPlayerConditions(const Player* player, DBResult_ptr result) { +void IOLoginDataLoad::loadPlayerConditions(Player* player, DBResult_ptr result) { if (!result || !player) { g_logger().warn("[IOLoginData::loadPlayer] - Player or Result nullptr: {}", __FUNCTION__); return; @@ -230,14 +230,10 @@ void IOLoginDataLoad::loadPlayerConditions(const Player* player, DBResult_ptr re PropStream propStream; propStream.init(attr, attrSize); - std::list> conditionList; Condition* condition = Condition::createCondition(propStream); while (condition) { - std::unique_ptr uniqueCondition(condition); - if (uniqueCondition->unserialize(propStream)) { - conditionList.push_front(std::move(uniqueCondition)); - } else { - uniqueCondition.release(); // Release memory ownership + if (condition->unserialize(propStream)) { + player->storedConditionList.push_front(condition); } condition = Condition::createCondition(propStream); } diff --git a/src/io/functions/iologindata_load_player.hpp b/src/io/functions/iologindata_load_player.hpp index 9ea937c7de0..b1c9fe7c18d 100644 --- a/src/io/functions/iologindata_load_player.hpp +++ b/src/io/functions/iologindata_load_player.hpp @@ -17,7 +17,7 @@ class IOLoginDataLoad : public IOLoginData { static bool preLoadPlayer(Player* player, const std::string &name); static void loadPlayerExperience(Player* player, DBResult_ptr result); static void loadPlayerBlessings(Player* player, DBResult_ptr result); - static void loadPlayerConditions(const Player* player, DBResult_ptr result); + static void loadPlayerConditions(Player* player, DBResult_ptr result); static void loadPlayerDefaultOutfit(Player* player, DBResult_ptr result); static void loadPlayerSkullSystem(Player* player, DBResult_ptr result); static void loadPlayerSkill(Player* player, DBResult_ptr result); 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; 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) { diff --git a/src/lua/functions/items/item_functions.cpp b/src/lua/functions/items/item_functions.cpp index 5b3802377bb..76e5cde3120 100644 --- a/src/lua/functions/items/item_functions.cpp +++ b/src/lua/functions/items/item_functions.cpp @@ -848,6 +848,20 @@ int ItemFunctions::luaItemIsInsideDepot(lua_State* L) { return 1; } +int ItemFunctions::luaItemIsContainer(lua_State* L) { + // item:isContainer() + const auto item = getUserdata(L, 1); + if (!item) { + reportErrorFunc(getErrorDesc(LUA_ERROR_ITEM_NOT_FOUND)); + pushBoolean(L, false); + return 1; + } + + const auto &it = Item::items[item->getID()]; + pushBoolean(L, it.isContainer()); + return 1; +} + int ItemFunctions::luaItemGetTier(lua_State* L) { // item:getTier() const Item* item = getUserdata(L, 1); diff --git a/src/lua/functions/items/item_functions.hpp b/src/lua/functions/items/item_functions.hpp index e890f2df1f7..a9100b2316a 100644 --- a/src/lua/functions/items/item_functions.hpp +++ b/src/lua/functions/items/item_functions.hpp @@ -75,6 +75,7 @@ class ItemFunctions final : LuaScriptInterface { registerMethod(L, "Item", "setDuration", ItemFunctions::luaItemSetDuration); registerMethod(L, "Item", "isInsideDepot", ItemFunctions::luaItemIsInsideDepot); + registerMethod(L, "Item", "isContainer", ItemFunctions::luaItemIsContainer); registerMethod(L, "Item", "getTier", ItemFunctions::luaItemGetTier); registerMethod(L, "Item", "setTier", ItemFunctions::luaItemSetTier); @@ -145,6 +146,7 @@ class ItemFunctions final : LuaScriptInterface { static int luaItemSetDuration(lua_State* L); static int luaItemIsInsideDepot(lua_State* L); + static int luaItemIsContainer(lua_State* L); static int luaItemGetTier(lua_State* L); static int luaItemSetTier(lua_State* L);