Skip to content

Commit

Permalink
Disable printing load message by default
Browse files Browse the repository at this point in the history
Users can re-enable it with the command
    /kt loadmessage
(The command toggles showing/not showing message on load)

Fixes #18
  • Loading branch information
Sharparam committed Nov 20, 2021
1 parent 2a475c2 commit 0d6fbe1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Command.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function C:HandleCommand(command, args)
end

C:Register("__DEFAULT__", function()
KT:Msg("/kt loadmessage - Toggles showing a message when AddOn loads.")
KT:Msg("/kt target - Display number of kills on target mob.")
KT:Msg("/kt lookup <name> - Display number of kills on <name>, <name> can also be NPC ID.")
KT:Msg("/kt print - Toggle printing kill updates to chat.")
Expand All @@ -82,6 +83,10 @@ C:Register("__DEFAULT__", function()
KT:Msg("/kt - Displays this help message.")
end)

C:Register({"loadmessage", "lm"}, function()
KT:ToggleLoadMessage()
end)

C:Register({"target", "t", "tar"}, function()
if not UnitExists("target") or UnitIsPlayer("target") then return end
local id = KTT:GUIDToID(UnitGUID("target"))
Expand Down
18 changes: 17 additions & 1 deletion KillTrack.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function KT.Events.ADDON_LOADED(self, ...)
_G["KILLTRACK"] = {}
end
self.Global = _G["KILLTRACK"]
if type(self.Global.LOAD_MESSAGE) ~= "boolean" then
self.Global.LOAD_MESSAGE = false
end
if type(self.Global.PRINTKILLS) ~= "boolean" then
self.Global.PRINTKILLS = false
end
Expand Down Expand Up @@ -173,7 +176,11 @@ function KT.Events.ADDON_LOADED(self, ...)
self.CharGlobal.MOBS = {}
end
self.PlayerName = UnitName("player")
self:Msg("AddOn Loaded!")

if self.Global.LOAD_MESSAGE then
self:Msg("AddOn Loaded!")
end

self.Session.Start = time()
self.Broker:OnLoad()
end
Expand Down Expand Up @@ -281,6 +288,15 @@ function KT.Events.ENCOUNTER_END(self, _, _, _, size)
end
end

function KT:ToggleLoadMessage()
self.Global.LOAD_MESSAGE = not self.Global.LOAD_MESSAGE
if self.Global.LOAD_MESSAGE then
KT:Msg("Now showing message on AddOn load")
else
KT:Msg("No longer showing message on AddOn load")
end
end

function KT:ToggleExp()
self.Global.SHOW_EXP = not self.Global.SHOW_EXP
if self.Global.SHOW_EXP then
Expand Down

0 comments on commit 0d6fbe1

Please sign in to comment.