mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-30 19:19:59 +00:00
panel: add combat timer
This commit is contained in:
+1
-1
@@ -897,7 +897,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
|
||||
-- panels
|
||||
pfUI.gui.panel = pfUI.gui:CreateConfigTab("Panel")
|
||||
local values = { "time", "fps", "exp", "gold", "friends", "guild", "durability", "zone", "none" }
|
||||
local values = { "time", "fps", "exp", "gold", "friends", "guild", "durability", "zone", "combat", "none" }
|
||||
pfUI.gui:CreateConfig(pfUI.gui.panel, "Left Panel: Left", pfUI_config.panel.left, "left", "dropdown", values)
|
||||
pfUI.gui:CreateConfig(pfUI.gui.panel, "Left Panel: Center", pfUI_config.panel.left, "center", "dropdown", values)
|
||||
pfUI.gui:CreateConfig(pfUI.gui.panel, "Left Panel: Right", pfUI_config.panel.left, "right", "dropdown", values)
|
||||
|
||||
+31
-1
@@ -95,7 +95,6 @@ pfUI:RegisterModule("panel", function ()
|
||||
elseif arg1 == "RightButton" then
|
||||
pfUI.panel.clock.timerFrame.Snapshot = GetTime()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
pfUI.panel.clock.tick = GetTime()
|
||||
@@ -139,6 +138,37 @@ pfUI:RegisterModule("panel", function ()
|
||||
end
|
||||
end)
|
||||
|
||||
-- Combat Timer
|
||||
pfUI.panel.clock.combat = CreateFrame("Frame", "pfUICombatTimer", UIParent)
|
||||
pfUI.panel.clock.combat:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||
pfUI.panel.clock.combat:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
pfUI.panel.clock.combat:RegisterEvent("PLAYER_REGEN_DISABLED")
|
||||
pfUI.panel.clock.combat:SetScript("OnEvent", function()
|
||||
if event == "PLAYER_REGEN_DISABLED" then
|
||||
if UnitAffectingCombat("player") and not this.combat then
|
||||
this.combat = GetTime()
|
||||
end
|
||||
|
||||
elseif event == "PLAYER_REGEN_ENABLED" then
|
||||
if this.combat then
|
||||
this.lastcombat = GetTime() - this.combat
|
||||
this.combat = nil
|
||||
pfUI.panel:OutputPanel("combat", "|cffffffff" .. SecondsToTime(ceil(this.lastcombat)))
|
||||
end
|
||||
|
||||
elseif event == "PLAYER_ENTERING_WORLD" then
|
||||
pfUI.panel:OutputPanel("combat", "-- Combat --")
|
||||
end
|
||||
end)
|
||||
|
||||
pfUI.panel.clock.combat:SetScript("OnUpdate", function()
|
||||
if not this.tick then this.tick = GetTime() end
|
||||
if GetTime() <= this.tick + 1 then return else this.tick = GetTime() end
|
||||
if this.combat then
|
||||
pfUI.panel:OutputPanel("combat", "|cffffaaaa" .. SecondsToTime(ceil(GetTime() - this.combat)))
|
||||
end
|
||||
end)
|
||||
|
||||
-- Update "exp"
|
||||
function pfUI.panel:UpdateExp ()
|
||||
if UnitLevel("player") ~= 60 then
|
||||
|
||||
Reference in New Issue
Block a user