/
local reagents = { |
["MAGE"] = { 17031,17032,17020, }, --{ Rune of Teleportation, Rune of Portals, Arcane Powder, }, |
["SHAMAN"] = { 17030, }, --{ Ankh, }, |
["PALADIN"] = { 17033,21177, }, --{ Symbol of Divinity, Symbol of Kings, }, |
["PRIEST"] = { 44615, }, --{ Devout Candle, }, |
["DEATHKNIGHT"] = { 37201, }, --{ Corpse Dust, }, |
["DRUID"] = { 44614,44605, }, --{ Starleaf Seed, Wild Spineleaf, }, |
["WARLOCK"] = { 6265, }, --{ Soul Shard, }, |
["MAGE"] = { |
["17031"] = false, -- Rune of Teleportation |
["17032"] = false, -- Rune of Portals |
["17020"] = false, -- Arcane Powder |
["17056"] = 57925, -- Light Feather = Glyph of Slow Fall |
}, |
["SHAMAN"] = { |
["17030"] = 58059, -- Ankh = Glyph of Renewed Life |
["17058"] = 58057, -- Fish Oil = Glyph of Water Walking |
["17057"] = 58055, -- Shiny Fish Scale = Glyph of Water Breathing |
}, |
["PALADIN"] = { |
["17033"] = false, -- Symbol of Divinity |
["21177"] = false, -- Symbol of Kings |
}, |
["PRIEST"] = { |
["44615"] = false, -- Devout Candle |
["17056"] = 57987, -- Light Feather = Glyph of Levitate |
}, |
["DEATHKNIGHT"] = { |
["37201"] = 60200, -- Corpse Dust = Glyph of Raise Dead |
}, |
["DRUID"] = { |
["44614"] = 57857, -- Starleaf Seed = Glyph of Unburdened Rebirth |
["44605"] = false, -- Wild Spineleaf |
}, |
["WARLOCK"] = { |
["6265"] = false, -- Soul Shard |
["5565"] = false, -- Infernal Stone |
["16583"] = false, -- Demonic Figurine |
}, |
} |
--[[ next version? |
local glyphs = { |
["SHAMAN"] = { 58339, }, --{ Glyph of Renewed Life, }, |
["DEATHKNIGHT"] = { 60200, }, --{ Glyph of Raise Dead, }, |
["DRUID"] = { 58288, }, --{ Glyph of Unburdened Rebirth }, |
} |
]] |
local class = select(2,UnitClass("player")) |
local tmp = {} |
text = "Reagents", |
icon = "Interface\\Icons\\Spell_Holy_Dizzy", |
OnEnter = function(self) |
GameTooltip:SetOwner(self, "ANCHOR_NONE") |
GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT") |
GameTooltip:ClearLines() |
GameTooltip:AddLine("Reagents left:") |
for k,v in pairs(reagents[class]) do |
GameTooltip:AddDoubleLine(GetItemInfo(v),GetItemCount(v),0,1,0) |
GameTooltip:AddTexture(select(10,GetItemInfo(v))) |
end |
GameTooltip:Show() |
if next(tmp) then |
GameTooltip:SetOwner(self, "ANCHOR_NONE") |
GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT") |
GameTooltip:ClearLines() |
GameTooltip:AddLine("Reagents left:") |
for k,v in pairs(tmp) do |
if GetItemInfo(v) then |
GameTooltip:AddDoubleLine(GetItemInfo(v),GetItemCount(v),0,1,0) |
GameTooltip:AddTexture(select(10,GetItemInfo(v))) |
end |
end |
GameTooltip:Show() |
end |
end, |
OnLeave = function() |
GameTooltip:Hide() |
end, |
}) |
local function checkglyphs(spellID) |
local found |
for i=1,6 do |
local foo = select(3,GetGlyphSocketInfo(i)) |
if foo == spellID then |
found = true |
end |
end |
if not found then return true end |
end |
local f = CreateFrame("Frame") |
f:RegisterEvent("BAG_UPDATE") |
f:RegisterEvent("PLAYER_LOGIN") |
f:SetScript("OnEvent",function() |
wipe(tmp) |
for k,v in pairs(reagents[class]) do |
table.insert(tmp,GetItemCount(v)) |
if checkglyphs(v) then table.insert(tmp,k) end |
end |
ReagentLDB.text = table.concat(tmp, '/') |
local str |
for k,v in pairs(tmp) do |
str = (str and str ..'/' or '') .. GetItemCount(v) |
end |
if str ~= nil then ReagentLDB.text = str else ReagentLDB.text = "Reagents" end |
end) |
end |
## Title: Reagent Broker |
## Author: Mikma |
## Notes: Reagent Tracker for LibDataBroker |
## Version: 1.01 |
## Version: 1.1 |
LibStub.lua |
CallbackHandler-1.0.lua |