diff options
Diffstat (limited to 'src/server/game/Loot/Loot.cpp')
| -rw-r--r-- | src/server/game/Loot/Loot.cpp | 24 | 
1 files changed, 19 insertions, 5 deletions
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;  | 
