Skip to content

Commit 3744bb6

Browse files
authored
fix. Delete quest items after completing it (azerothcore#26)
1 parent ea69636 commit 3744bb6

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/AoeLoot_SC.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,26 @@ class AoeLoot_Player : public PlayerScript
193193
{
194194
OnCreatureLootAOE(player);
195195
}
196+
197+
/*
198+
* This function is responsible for deleting the player's leftover items.
199+
* But it only deletes those that are from a quest, and that cannot be obtained if the quest were not being carried out.
200+
* Since there are some items that can be obtained even if you are not doing a quest.
201+
*/
202+
203+
void OnPlayerCompleteQuest(Player* player, Quest const* quest) override
204+
{
205+
for (uint8 i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
206+
{
207+
if (ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(quest->RequiredItemId[i]))
208+
{
209+
if ((itemTemplate->Bonding == BIND_QUEST_ITEM) && (!quest->IsRepeatable()))
210+
{
211+
player->DestroyItemCount(quest->RequiredItemId[i], 9999, true);
212+
}
213+
}
214+
}
215+
}
196216
};
197217

198218
void AddSC_AoeLoot()

0 commit comments

Comments
 (0)