From 8e0739d439202b39bab72fc6b263ce6551ab21c7 Mon Sep 17 00:00:00 2001 From: Jon Zenor Date: Tue, 6 Dec 2022 21:43:50 -0700 Subject: [PATCH] Closes #1 Added a configurable annoying pop up window --- Core.lua | 21 +++++++++++++-------- README.md | 12 +++++++++--- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Core.lua b/Core.lua index 8a2c0c6..331f06a 100644 --- a/Core.lua +++ b/Core.lua @@ -7,13 +7,14 @@ local defaults = { deaths = 0, lastDeath = time(), guildAnnounce = false, + usePopupAlert = false, } function f:OnEvent(event, addOnName) if addOnName == "Death_Counter" then - print("Death Counter Loaded") + --print("Death Counter Loaded") FADeathCounterDB = FADeathCounterDB or CopyTable(defaults) - --self:InitializeOptions() + self:InitializeOptions() end if event == "PLAYER_DEAD" then @@ -35,11 +36,11 @@ function f:InitializeOptions() local cb = CreateFrame("CheckButton", nil, self.panel, "InterfaceOptionsCheckButtonTemplate") cb:SetPoint("TOPLEFT", 20, -20) - cb.Text:SetText("Announce Death to Guild") + cb.Text:SetText("Use a pop up alert") cb:HookScript("OnClick", function(_, btn, down) - FADeathCounterDB.guildAnnounce = cb:GetChecked() + FADeathCounterDB.usePopupAlert = cb:GetChecked() end) - cb:SetChecked(FADeathCounterDB.guildAnnounce) + cb:SetChecked(FADeathCounterDB.usePopupAlert) InterfaceOptions_AddCategory(self.panel) end @@ -58,7 +59,12 @@ function f:PrintDeaths(deathTimeString) useText = "Last death was " end - print(useText .. deathTimeString .. "ago") + messageText = useText .. deathTimeString .. "ago" + print(messageText) + + if (FADeathCounterDB.usePopupAlert == true) then + message("You died " .. FADeathCounterDB.deaths .. " times.\n\n" .. messageText) + end end function f:RecordDeathTime(currentTime) @@ -100,11 +106,10 @@ function f:CalculateTimesinceDeath(lastDiedTimeStamp, currentTimeStamp) end SlashCmdList.DEATHCOUNTER = function(msg) - --[[ Coming soon... + if msg == "config" then InterfaceOptionsFrame_OpenToCategory(f.panel) end - --]] if msg == "help" then print("/dcr -- Show your death count stats") diff --git a/README.md b/README.md index 18bdbb5..dff38b0 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,15 @@ For any of the commands you can use ``/dcr`` as a shortcut for ``/deathcounter`` | Command | Description | | ------------- | ------------- | -|``/deathcounter`` | Tell you how many times you have died, and how long you've been alive for. | -|``/deathcounter help`` | Show a help message with this list of commands. | -|``/deathcounter reset confirm`` | Erase the stats and start fresh. (For debug testing only) | +| ``/deathcounter`` | Tell you how many times you have died, and how long you've been alive for. | +| ``/deathcounter help`` | Show a help message with this list of commands. | +| ``/deathcounter reset confirm`` | Erase the stats and start fresh. (For debug testing only) | +| ``/deathcounter config`` | Open up the configuration options | + + +## Configuration Options + +**Use PopUp Alert:** Will give the death information in a pop up window so you can't miss it. ## Authors