Go to most recent revision | Compare with Previous | Blame | View Log
-- Combat Clock -- By : Icecoldcoke function CombatClock_OnLoad() this:RegisterEvent("PLAYER_REGEN_DISABLED"); this:RegisterEvent("PLAYER_REGEN_ENABLED"); this:RegisterEvent("VARIABLES_LOADED") end function CombatClock_OnInitialize() SLASH_COMBATCLOCK1 = "/cc"; SLASH_COMBATCLOCK2 = "/coco"; SlashCmdList["COMBATCLOCK"] = CombatClock_Command; if (not CombatClock_min) then CombatClock_min = 00 end if (not CombatClock_showAlways) then CombatClock_showAlways = true end end function CombatClock_Command(CombatClock_arg) if CombatClock_arg == "" then DEFAULT_CHAT_FRAME:AddMessage("----------[CC]Comands List-----------") DEFAULT_CHAT_FRAME:AddMessage("-------------------------------------") DEFAULT_CHAT_FRAME:AddMessage("/cc showalways - Toggles showing SW after combat") DEFAULT_CHAT_FRAME:AddMessage("/cc 00-60 - Sets the minimum minutes") end if CombatClock_arg == "SHOWALWAYS" or CombatClock_arg == "showalways" then if (CombatClock_showAlways == true) then CombatClock_showAlways = false DEFAULT_CHAT_FRAME:AddMessage("[CC]Stopwatch will no longer be shown after combat ends.") elseif (CombatClock_showAlways == false) then CombatClock_showAlways = true DEFAULT_CHAT_FRAME:AddMessage("[CC]Stopwatch will now be shown after combat ends.") end end if (CombatClock_arg ~= "") and (CombatClock_arg ~= "SHOWALWAYS") and (CombatClock_arg ~= "showalways") then CombatClock_min = CombatClock_arg DEFAULT_CHAT_FRAME:AddMessage("[CC]Minimum minutes has been set to :" .. CombatClock_min); end end function CombatClock_OnEvent() if (event == "VARIABLES_LOADED") then CombatClock_OnInitialize() end if (event == "PLAYER_REGEN_DISABLED") then Stopwatch_Clear() Stopwatch_Play() StopwatchFrame:Show() SetDesaturation(StopwatchPlayPauseButton:GetNormalTexture(), 1) SetDesaturation(StopwatchResetButton:GetNormalTexture(), 1) StopwatchPlayPauseButton:Disable() StopwatchResetButton:Disable() end if (event == "PLAYER_REGEN_ENABLED") then Stopwatch_Pause() SetDesaturation(StopwatchPlayPauseButton:GetNormalTexture()) SetDesaturation(StopwatchResetButton:GetNormalTexture()) StopwatchPlayPauseButton:Enable() StopwatchResetButton:Enable() if (CombatClock_showAlways == false) then StopwatchFrame:Hide() end if (CombatClock_min <= StopwatchTickerMinute:GetText()) then DEFAULT_CHAT_FRAME:AddMessage("[CC]Combat Ended in (MM:SS): "..StopwatchTickerMinute:GetText()..":"..StopwatchTickerSecond:GetText()) end end end