Advertisement
perpsexityhehe

Untitled

May 14th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. function()
  2.  
  3. -- lookup table of rogue stuff; true means "show even if 0"
  4. local poison_ids = {
  5. [3775] = false, -- Crippling Poison
  6. [3776] = false, -- Crippling Poison
  7. [2892] = false, -- Deadly Poison
  8. [2893] = false, -- Deadly Poison II
  9. [8984] = false, -- Deadly Poison III
  10. [8985] = false, -- Deadly Poison IV
  11. [20844] = false, -- Deadly Poison V
  12. [6947] = false, -- Insant Poison
  13. [6949] = false, -- Instant Poison II
  14. [6950] = false, -- Instant Poison III
  15. [8926] = false, -- Instant Poison IV
  16. [8927] = false, -- Instant Poison V
  17. [8928] = false, -- Instant Poison VI
  18. [5654] = false, -- Instant Toxin
  19. [5237] = false, -- Mind-numbing Poison
  20. [6951] = false, -- Mind-numbing Poison II
  21. [9186] = false, -- Mind-numbing Poison III
  22. [10918] = false, -- Wound Poison
  23. [10920] = false, -- Wound Poison II
  24. [10921] = false, -- Wound Poison III
  25. [10922] = false, -- Wound Poison IV
  26. [5140] = true, -- Flash Powder, always want some
  27. [5530] = true -- Thistle Tea, also always want this
  28. }
  29.  
  30. local poisons_in_bags = {}
  31. local items_in_bags = {}
  32.  
  33. -- get a total of all the bag items by item ID
  34. for i=0,4 do
  35. local bagname = GetBagName(i)
  36. if bagname then
  37. local avail = GetContainerNumSlots(i)
  38. for slot = 1, avail do
  39. id = GetContainerItemID(i, slot)
  40. if (id) then
  41. texture, count, locked, quality, readable, lootable, link, isFiltered, hasNoValue, itemID = GetContainerItemInfo(i, slot)
  42. if (items_in_bags[id]) then
  43. items_in_bags[id] = items_in_bags[id] + count
  44. else
  45. items_in_bags[id] = count
  46. end
  47. end
  48. end
  49. end
  50. end
  51.  
  52. -- which of those items are poisons
  53. local poison_list = {}
  54. for poisonId, mustHave in pairs(poison_ids) do
  55. -- if we have to have them, default to 0
  56. if (poison_ids[poisonId]) then
  57. poison_list[poisonId] = 0
  58. end
  59. if (items_in_bags[poisonId]) then
  60. poison_list[poisonId] = items_in_bags[poisonId]
  61. end
  62. end
  63.  
  64. local howmany = ""
  65. local sorted = {}
  66. for k, v in pairs(poison_list) do
  67. table.insert(sorted,{k,v})
  68. end
  69.  
  70. table.sort(sorted, function(a,b) return a[2] < b[2] end)
  71.  
  72. for _, v in ipairs(sorted) do
  73. pname, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(v[1])
  74. num = v[2]
  75. local alert = ""
  76. if (num <= 5) then
  77. alert = "|cffff0000"
  78. end
  79.  
  80. howmany = howmany .. format("%s%s: %d|r\n", alert, pname, num)
  81. end
  82. return howmany
  83. end
  84.  
  85.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement