View Single Post
11/18/14, 02:27 AM   #12
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
I've had the same problem with my Addon Mobile Bank Extended.
Since i never switched my Horse, i never had the experience myself,
but one of the Users reported that problem.

The Solution was simpel: only do your logic if the Item is "New" ,which is one of the parameters of the Event.


Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("MobileBank", EVENT_INVENTORY_SINGLE_SLOT_UPDATE, MB.SingleSlotUpdate)
  2.  
  3. function MB.SingleSlotUpdate(eventCode,bagId, slotId, isNewItem, itemSoundCategory, updateReason)
  4.  
  5. -- EVENT_INVENTORY_SINGLE_SLOT_UPDATE (integer eventCode, integer bagId, integer slotId, bool isNewItem, integer itemSoundCategory, integer updateReason)
  6. local bagname = "Unknown"
  7.  
  8.    if bagId == BAG_BACKPACK then bagname = "Backpack" end
  9.    if bagId == BAG_BANK then bagname = "Bank" end
  10.    if bagId == BAG_BUYBACK then bagname = "Buyback" end
  11.    if bagId == BAG_GUILDBANK then bagname = "Guildbank" end  
  12.    if bagId == BAG_WORN then bagname = "Worn" end
  13.  
  14.    debug("Event SingleSlotUpdate fired: " .. bagname .. " Slot: " .. tostring(slotId) .. " (New: "  ..tostring(isNewItem) .. ") / Reason: " .. tostring(updateReason))
  15.  
  16.   if bagname == "Backpack" and isNewItem then
  17.     MB.SavePlayerInvent()
  18.   end
  19. end



Hope this info helps the Authors to fix their Addons.
  Reply With Quote