Skip to content

Commit

Permalink
fix. Delete quest items after completing it (azerothcore#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
pangolp authored Feb 22, 2024
1 parent ea69636 commit 3744bb6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/AoeLoot_SC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3744bb6

Please sign in to comment.