View Single Post
01-12-16, 06:06 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Well, for deleting, that event sequence looks pretty straightforward:

1. When you see DELETE_ITEM_CONFIRM, store the name in a temporary variable.
2. When you see ITEM_LOCK_CHANGED, get info about the item in the indicated bag/slot. If the name matches what you saw in #1, you now have the item ID, full item link, or whatever other info you want to keep about the item being deleted.

You could probably add a #3 where you verify that the item was successfully deleted when you see ITEM_UNLOCKED or BAG_UPDATE, but it's probably not necessary.

For selling items, you could hook UseContainerItem; something like:

Code:
hooksecurefunc("UseContainerItem", function(bag, slot)
    -- if the merchant frame is shown, and not to the buyback panel,
    -- then you are selling the indicated item
end)
and then proceed with watching bag events to see when the item successfully leaves your bags.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote