Skip to content

Commit

Permalink
fixed databroker display on login to work without having to show the …
Browse files Browse the repository at this point in the history
…frame also added a reset command for the honor per hour tracking
  • Loading branch information
mynian committed Mar 12, 2021
1 parent 087b895 commit 51bc09f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
21 changes: 17 additions & 4 deletions HonorTrack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,18 @@ function SlashCmdList.HONORTRACK(msg, editBox)
htgoalset = false
--Let the user know we reset the goal
print("Honor Track: Honor Goal reset")
--User input something that isn't a command
--Reset the honor per hour tracker to zero
elseif string.lower(command) == 'hprreset' then
--set the honor per hour variable to 0
hthonorgained = 0
print("Honor Track: Your honor per hour statistic has been reset.")
--User entered something that is not a valid command
else
--Let the user know what the proper slash command syntax is
print("Honor Track: Available commands are show, hide and goal")
print("Honor Track: Available commands are show, hide, hprreset and goal")
print("Honor Track: To set goal, use /honortrack goal ####")
print("Honor Track: To reset goal, use /honortrack goal reset")
print("Honor Track: To reset your honor per hour statistic, use /honortrack hprreset")
end
end

Expand Down Expand Up @@ -249,8 +255,6 @@ local httimer = 0

--Honor per hour calculation function. This runs every screen update so we need to throttle the updates down to something slower so the output in the frame isn't updating visually at whatever the user's fps is
local function OnUpdate(self, elapsed)
--local variable declaration
local hthonorperhour
--count the screen refresh time for the throttle
htcounter = htcounter + elapsed
--time the refreshes so we can see how much time has passed for the per hour calculation
Expand Down Expand Up @@ -312,6 +316,15 @@ function events:PLAYER_ENTERING_WORLD(...)
UpdateHonor(self)
UpdateGoal(self)
SetState(self)
if hthonorperhour == nil then
hthonorperhour = 0
Addon.HonorPerHourAmount:SetText(hthonorperhour)
dataobj.text = string.format("%.2f Honor Per Hour", hthonorperhour)
else
hthonorperhour = hthonorperhour
Addon.HonorPerHourAmount:SetText(hthonorperhour)
dataobj.text = string.format("%.2f Honor Per Hour", hthonorperhour)
end
end

--Tell the client that we want to run these functions when the player's honor amount updates
Expand Down
4 changes: 2 additions & 2 deletions HonorTrack.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Interface: 90005
## Title: Honor Track
## Notes: Shows your current honor info and allows you to set a goal
## Version: 3.0.1
## SavedVariablesPerCharacter: hthonorgoal, htgoalset, htvisible
## Version: 3.0.2
## SavedVariablesPerCharacter: hthonorgoal, htgoalset, htvisible, hthonorperhour

LibStub.lua
CallbackHandler-1.0.lua
Expand Down

0 comments on commit 51bc09f

Please sign in to comment.