Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function()
- -- lookup table of rogue stuff; true means "show even if 0"
- local poison_ids = {
- [3775] = false, -- Crippling Poison
- [3776] = false, -- Crippling Poison
- [2892] = false, -- Deadly Poison
- [2893] = false, -- Deadly Poison II
- [8984] = false, -- Deadly Poison III
- [8985] = false, -- Deadly Poison IV
- [20844] = false, -- Deadly Poison V
- [6947] = false, -- Insant Poison
- [6949] = false, -- Instant Poison II
- [6950] = false, -- Instant Poison III
- [8926] = false, -- Instant Poison IV
- [8927] = false, -- Instant Poison V
- [8928] = false, -- Instant Poison VI
- [5654] = false, -- Instant Toxin
- [5237] = false, -- Mind-numbing Poison
- [6951] = false, -- Mind-numbing Poison II
- [9186] = false, -- Mind-numbing Poison III
- [10918] = false, -- Wound Poison
- [10920] = false, -- Wound Poison II
- [10921] = false, -- Wound Poison III
- [10922] = false, -- Wound Poison IV
- [5140] = true, -- Flash Powder, always want some
- [5530] = true -- Thistle Tea, also always want this
- }
- local poisons_in_bags = {}
- local items_in_bags = {}
- -- get a total of all the bag items by item ID
- for i=0,4 do
- local bagname = GetBagName(i)
- if bagname then
- local avail = GetContainerNumSlots(i)
- for slot = 1, avail do
- id = GetContainerItemID(i, slot)
- if (id) then
- texture, count, locked, quality, readable, lootable, link, isFiltered, hasNoValue, itemID = GetContainerItemInfo(i, slot)
- if (items_in_bags[id]) then
- items_in_bags[id] = items_in_bags[id] + count
- else
- items_in_bags[id] = count
- end
- end
- end
- end
- end
- -- which of those items are poisons
- local poison_list = {}
- for poisonId, mustHave in pairs(poison_ids) do
- -- if we have to have them, default to 0
- if (poison_ids[poisonId]) then
- poison_list[poisonId] = 0
- end
- if (items_in_bags[poisonId]) then
- poison_list[poisonId] = items_in_bags[poisonId]
- end
- end
- local howmany = ""
- local sorted = {}
- for k, v in pairs(poison_list) do
- table.insert(sorted,{k,v})
- end
- table.sort(sorted, function(a,b) return a[2] < b[2] end)
- for _, v in ipairs(sorted) do
- pname, link, quality, iLevel, reqLevel, class, subclass, maxStack, equipSlot, texture, vendorPrice = GetItemInfo(v[1])
- num = v[2]
- local alert = ""
- if (num <= 5) then
- alert = "|cffff0000"
- end
- howmany = howmany .. format("%s%s: %d|r\n", alert, pname, num)
- end
- return howmany
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement