diff options
| -rw-r--r-- | src/server/game/Handlers/LootHandler.cpp | 4 | ||||
| -rw-r--r-- | src/server/game/Loot/Loot.cpp | 24 | ||||
| -rw-r--r-- | src/server/game/Loot/Loot.h | 2 | 
3 files changed, 21 insertions, 9 deletions
diff --git a/src/server/game/Handlers/LootHandler.cpp b/src/server/game/Handlers/LootHandler.cpp index a685d6c0fbc..557cab0cb4e 100644 --- a/src/server/game/Handlers/LootHandler.cpp +++ b/src/server/game/Handlers/LootHandler.cpp @@ -453,7 +453,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)      ItemPosCountVec dest;      InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count); -    if (item.follow_loot_rules && !item.AllowedForPlayer(target)) +    if (!item.AllowedForPlayer(target, true))          msg = EQUIP_ERR_YOU_CAN_NEVER_USE_THAT_ITEM;      if (msg != EQUIP_ERR_OK)      { @@ -463,8 +463,6 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)              _player->SendLootError(lootguid, LOOT_ERROR_MASTER_INV_FULL);          else              _player->SendLootError(lootguid, LOOT_ERROR_MASTER_OTHER); - -        target->SendEquipError(msg, nullptr, nullptr, item.itemid);          return;      } diff --git a/src/server/game/Loot/Loot.cpp b/src/server/game/Loot/Loot.cpp index 140e614541b..b893557de98 100644 --- a/src/server/game/Loot/Loot.cpp +++ b/src/server/game/Loot/Loot.cpp @@ -54,7 +54,7 @@ LootItem::LootItem(LootStoreItem const& li)  }  // Basic checks for player/item compatibility - if false no chance to see the item in the loot -bool LootItem::AllowedForPlayer(Player const* player) const +bool LootItem::AllowedForPlayer(Player const* player, bool isGivenByMasterLooter) const  {      // DB conditions check      if (!sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(player), conditions)) @@ -64,10 +64,6 @@ bool LootItem::AllowedForPlayer(Player const* player) const      if (!pProto)          return false; -    // not show loot for players without profession or those who already know the recipe -    if ((pProto->Flags & ITEM_FLAG_HIDE_UNUSABLE_RECIPE) && (!player->HasSkill(pProto->RequiredSkill) || player->HasSpell(pProto->Spells[1].SpellId))) -        return false; -      // not show loot for not own team      if ((pProto->Flags2 & ITEM_FLAG2_FACTION_HORDE) && player->GetTeam() != HORDE)          return false; @@ -75,6 +71,24 @@ bool LootItem::AllowedForPlayer(Player const* player) const      if ((pProto->Flags2 & ITEM_FLAG2_FACTION_ALLIANCE) && player->GetTeam() != ALLIANCE)          return false; +    // Master looter can see certain items even if the character can't loot them +    if (!isGivenByMasterLooter && player->GetGroup() && player->GetGroup()->GetMasterLooterGuid() == player->GetGUID()) +    { +        // check quest requirements +        if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && (needs_quest || pProto->StartQuest)) +            return false; + +        return true; +    } + +    // Don't allow loot for players without profession or those who already know the recipe +    if ((pProto->Flags & ITEM_FLAG_HIDE_UNUSABLE_RECIPE) && (!player->HasSkill(pProto->RequiredSkill) || player->HasSpell(pProto->Spells[1].SpellId))) +        return false; + +    // Don't allow to loot soulbound recipes that the player has already learned +    if (pProto->Class == ITEM_CLASS_RECIPE && pProto->Bonding == BIND_WHEN_PICKED_UP && pProto->Spells[1].SpellId != 0 && player->HasSpell(pProto->Spells[1].SpellId)) +        return false; +      // check quest requirements      if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->StartQuest && player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))          return false; diff --git a/src/server/game/Loot/Loot.h b/src/server/game/Loot/Loot.h index c6a52ab1c3f..89be2bbd307 100644 --- a/src/server/game/Loot/Loot.h +++ b/src/server/game/Loot/Loot.h @@ -149,7 +149,7 @@ struct TC_GAME_API LootItem                   { };      // Basic checks for player/item compatibility - if false no chance to see the item in the loot -    bool AllowedForPlayer(Player const* player) const; +    bool AllowedForPlayer(Player const* player, bool isGivenByMasterLooter = false) const;      void AddAllowedLooter(Player const* player);      GuidSet const& GetAllowedLooters() const { return allowedGUIDs; }  };  | 
