mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-28 08:06:23 +00:00
fix(Core/LootMgr): Improved drop checks for items that start quests (#19463)
* fix(Core/LootMgr): Improved drop checks for items that start quests to prevent unnecessary or inappropriate drops * Tweaked 2nd condition to only be valid for unique items
This commit is contained in:
@@ -468,9 +468,20 @@ bool LootItem::AllowedForPlayer(Player const* player, ObjectGuid source) const
|
||||
}
|
||||
|
||||
// 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)))
|
||||
if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS))
|
||||
{
|
||||
return false;
|
||||
// Don't drop quest items if the player is missing the relevant quest
|
||||
if (needs_quest && !player->HasQuestForItem(itemid))
|
||||
return false;
|
||||
|
||||
// for items that start quests
|
||||
if (pProto->StartQuest)
|
||||
{
|
||||
// Don't drop the item if the player has already finished the quest OR player already has the item in their inventory, and that item is unique OR the player has not finished a prerequisite quest
|
||||
uint32 prevQuestId = sObjectMgr->GetQuestTemplate(pProto->StartQuest) ? sObjectMgr->GetQuestTemplate(pProto->StartQuest)->GetPrevQuestId() : 0;
|
||||
if (player->GetQuestStatus(pProto->StartQuest) != QUEST_STATUS_NONE || (player->HasItemCount(itemid, pProto->MaxCount) && pProto->MaxCount) || (prevQuestId && !player->GetQuestRewardStatus(prevQuestId)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sScriptMgr->OnAllowedForPlayerLootCheck(player, source))
|
||||
|
||||
Reference in New Issue
Block a user