From 0076535905e3568ea963f0a5cf1f7b17ae670864 Mon Sep 17 00:00:00 2001 From: patou01 <2592673+patou01@users.noreply.github.com> Date: Sat, 2 Oct 2021 13:19:14 +0200 Subject: [PATCH] fix(Core/Loot): players can roll on unique items they already own (#8003) Players should not be able to roll on items they already have. This commit removes that. - Closes https://github.com/azerothcore/azerothcore-wotlk/issues/7896 Co-authored-by: Skjalf <47818697+Nyeriah@users.noreply.github.com> --- src/server/game/Loot/LootMgr.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 417bc9fa6..b35aea3aa 100644 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -428,6 +428,14 @@ bool LootItem::AllowedForPlayer(Player const* player, bool isGivenByMasterLooter return false; } + // Checking for unique or unique(XX) objects + // master looter should still be able to see the loot to give to people. + // casting to avoid warnings, it's unlikely there's an item with unique but 2^31 items allowed. + if (!isMasterLooter && pProto->MaxCount > 0 && ((int32)player->GetItemCount(itemid, true) >= pProto->MaxCount)) + { + return false; + } + // not show loot for not own team if ((pProto->Flags2 & ITEM_FLAGS_EXTRA_HORDE_ONLY) && player->GetTeamId(true) != TEAM_HORDE) {