diff --git a/src/AoeLoot_SC.cpp b/src/AoeLoot_SC.cpp index f13aba9..6209d21 100644 --- a/src/AoeLoot_SC.cpp +++ b/src/AoeLoot_SC.cpp @@ -193,6 +193,26 @@ class AoeLoot_Player : public PlayerScript { OnCreatureLootAOE(player); } + + /* + * This function is responsible for deleting the player's leftover items. + * But it only deletes those that are from a quest, and that cannot be obtained if the quest were not being carried out. + * Since there are some items that can be obtained even if you are not doing a quest. + */ + + void OnPlayerCompleteQuest(Player* player, Quest const* quest) override + { + for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i) + { + if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i])) + { + if ((itemTemplate->Bonding == BIND_QUEST_ITEM) && (!quest->IsRepeatable())) + { + player->DestroyItemCount(quest->RequiredItemId[i], 9999, true); + } + } + } + } }; void AddSC_AoeLoot()