View Single Post
06-30-20, 01:45 AM   #1
sh4dowburn
A Murloc Raider
 
sh4dowburn's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2019
Posts: 8
Question [HELP] script NOT working with Class identify

hi guyz,
i wrote this script for auto abandon items and open stuffs,

lately, added CLASS to avoid some of my characater abandon valuable items,
but it's not working correctly(the items i need to abandon when i played mage its not working. so sorry for forgot to mention it.) and i dont know how to make it work.

pls help me out, thank you guyz...
btw, it's for classic.

Lua Code:
  1. local UnitClass,GetContainerNumSlots,GetContainerItemInfo,PickupContainerItem,DeleteCursorItem,UseContainerItem,select
  2.     = UnitClass,GetContainerNumSlots,GetContainerItemInfo,PickupContainerItem,DeleteCursorItem,UseContainerItem,select
  3.    
  4. local n, filename, Id = UnitClass("player")
  5. local x
  6. if (n == "Mage") then x = true else x = false end
  7.  
  8. local items = { -- abandon list
  9.  
  10.   --food
  11.   [4608] = x,
  12.   [4599] = x,
  13.  
  14. }
  15.  
  16. local open = { -- open list
  17.  
  18. [20767] = true,
  19. [2744] = true,
  20. [5523] = true,
  21. [5524] = true,
  22. [7973] = true,
  23. [15874] = true,
  24. [21150] = true,
  25.  
  26. }
  27.  
  28. local f = CreateFrame('Frame', nil, UIParent)
  29. f:RegisterEvent('LOOT_CLOSED')
  30. f:SetScript('OnEvent', function(self, event, ...)
  31.   for b = 0, 4 do
  32.     for s = 1, GetContainerNumSlots(b) do
  33.       local id = select(10,GetContainerItemInfo(b,s))
  34.  
  35.       if items[id] then PickupContainerItem(b,s) DeleteCursorItem()
  36.       --print("clean")
  37.       end
  38.  
  39.       if open[id] then UseContainerItem(b, s)
  40.       --print("open")
  41.       end
  42.     end
  43.   end
  44. end)

Last edited by sh4dowburn : 06-30-20 at 03:34 AM.
  Reply With Quote