aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Loot/Loot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Loot/Loot.cpp')
-rw-r--r--src/server/game/Loot/Loot.cpp45
1 files changed, 40 insertions, 5 deletions
diff --git a/src/server/game/Loot/Loot.cpp b/src/server/game/Loot/Loot.cpp
index 73ccbca886e..5132a4b4e52 100644
--- a/src/server/game/Loot/Loot.cpp
+++ b/src/server/game/Loot/Loot.cpp
@@ -57,7 +57,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))
@@ -67,10 +67,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->GetFlags() & ITEM_FLAG_HIDE_UNUSABLE_RECIPE) && (!player->HasSkill(pProto->GetRequiredSkill()) || player->HasSpell(pProto->Effects[1]->SpellID)))
- return false;
-
// not show loot for not own team
if ((pProto->GetFlags2() & ITEM_FLAG2_FACTION_HORDE) && player->GetTeam() != HORDE)
return false;
@@ -78,6 +74,45 @@ bool LootItem::AllowedForPlayer(Player const* player) const
if ((pProto->GetFlags2() & 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->GetStartQuest()))
+ return false;
+
+ return true;
+ }
+
+ // Don't allow loot for players without profession or those who already know the recipe
+ if (pProto->GetFlags() & ITEM_FLAG_HIDE_UNUSABLE_RECIPE)
+ {
+ if (!player->HasSkill(pProto->GetRequiredSkill()))
+ return false;
+
+ for (ItemEffectEntry const* itemEffect : pProto->Effects)
+ {
+ if (itemEffect->TriggerType != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
+ continue;
+
+ if (player->HasSpell(itemEffect->SpellID))
+ return false;
+ }
+ }
+
+ // Don't allow to loot soulbound recipes that the player has already learned
+ if (pProto->GetClass() == ITEM_CLASS_RECIPE && pProto->GetBonding() == BIND_ON_ACQUIRE)
+ {
+ for (ItemEffectEntry const* itemEffect : pProto->Effects)
+ {
+ if (itemEffect->TriggerType != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
+ continue;
+
+ if (player->HasSpell(itemEffect->SpellID))
+ return false;
+ }
+ }
+
// check quest requirements
if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->GetStartQuest() && player->GetQuestStatus(pProto->GetStartQuest()) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))
return false;