Skip to content

Commit

Permalink
Merge pull request #5 from FinalAsgard/feature/AddPopupNotifcation
Browse files Browse the repository at this point in the history
Closes #1 Added a configurable annoying pop up window
  • Loading branch information
jonzenor authored Dec 7, 2022
2 parents f52a9e9 + 8e0739d commit d1237d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
21 changes: 13 additions & 8 deletions Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1237d5

Please sign in to comment.