mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-03 20:20:01 +00:00
panel: add option to display soulshard count
This commit is contained in:
+1
-1
@@ -949,7 +949,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
|
||||
-- panels
|
||||
pfUI.gui.panel = pfUI.gui:CreateConfigTab("Panel")
|
||||
local values = { "time", "fps", "exp", "gold", "friends", "guild", "durability", "zone", "combat", "ammo", "none" }
|
||||
local values = { "time", "fps", "exp", "gold", "friends", "guild", "durability", "zone", "combat", "ammo", "soulshard", "none" }
|
||||
pfUI.gui:CreateConfig(pfUI.gui.panel, "Left Panel: Left", C.panel.left, "left", "dropdown", values)
|
||||
pfUI.gui:CreateConfig(pfUI.gui.panel, "Left Panel: Center", C.panel.left, "center", "dropdown", values)
|
||||
pfUI.gui:CreateConfig(pfUI.gui.panel, "Left Panel: Right", C.panel.left, "right", "dropdown", values)
|
||||
|
||||
@@ -6,6 +6,7 @@ pfUI:RegisterModule("panel", function ()
|
||||
|
||||
pfUI.panel = CreateFrame("Frame",nil,UIParent)
|
||||
pfUI.panel:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
pfUI.panel:RegisterEvent("BAG_UPDATE")
|
||||
pfUI.panel:RegisterEvent("PLAYER_MONEY")
|
||||
pfUI.panel:RegisterEvent("UNIT_INVENTORY_CHANGED")
|
||||
pfUI.panel:RegisterEvent("PLAYER_XP_UPDATE")
|
||||
@@ -32,9 +33,12 @@ pfUI:RegisterModule("panel", function ()
|
||||
pfUI.panel:UpdateRepair()
|
||||
pfUI.panel:UpdateZone()
|
||||
pfUI.panel:UpdateAmmo()
|
||||
pfUI.panel:UpdateSoulshard()
|
||||
elseif event == "PLAYER_MONEY" then
|
||||
pfUI.panel:UpdateGold()
|
||||
pfUI.panel:UpdateRepair()
|
||||
elseif event == "BAG_UPDATE" then
|
||||
pfUI.panel:UpdateSoulshard()
|
||||
elseif event == "UNIT_INVENTORY_CHANGED" then
|
||||
pfUI.panel:UpdateAmmo()
|
||||
elseif event == "PLAYER_XP_UPDATE" then
|
||||
@@ -389,6 +393,27 @@ pfUI:RegisterModule("panel", function ()
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI.panel:UpdateSoulshard()
|
||||
local count = 0
|
||||
local _, class = UnitClass("player")
|
||||
|
||||
if class == "WARLOCK" then
|
||||
for bag=0,4 do
|
||||
for slot=1,GetContainerNumSlots(bag) do
|
||||
local link = GetContainerItemLink(bag,slot)
|
||||
if link then
|
||||
local _, _, id = string.find(link, "item:(%d+):%d+:%d+:%d+")
|
||||
if id == "6265" then
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pfUI.panel:OutputPanel("soulshard", "Soulshards: " .. count, tooltip)
|
||||
end
|
||||
|
||||
function pfUI.panel:OutputPanel(entry, value, tooltip, func)
|
||||
-- return if not yet fully initialized
|
||||
if not pfUI.panel.minimap then return end
|
||||
|
||||
Reference in New Issue
Block a user