Quantcast

Fixed GUI issue.

F16Gaming [07-07-12 - 23:26]
Fixed GUI issue.

Added debug command to toggle displaying of NPC IDs in tooltip.
Filename
Command.lua
KillTrack.lua
Tools.lua
diff --git a/Command.lua b/Command.lua
index 52fd8da..82b8ba7 100644
--- a/Command.lua
+++ b/Command.lua
@@ -141,9 +141,9 @@ C:Register({"time", "timer"}, function(args)
 		KT:Msg("Usage: time [<seconds>s][<minutes>m][<hours>h]")
 		return
 	end
-
+
 	local s, m, h
-
+
 	if #args == 1 then
 		if not tonumber(args[1]) then
 			args[1] = args[1]:lower()
@@ -184,6 +184,10 @@ C:Register({"countmode", "cm", "count", "counttype", "changecount", "switchcount
 	KT:ToggleCountMode()
 end)

+C:Register({"debug", "toggledebug", "d", "td"}, function(args)
+	KT:ToggleDebug()
+end)
+
 for i,v in ipairs(C.Slash) do
 	_G["SLASH_" .. KT.Name:upper() .. i] = "/" .. v
 end
diff --git a/KillTrack.lua b/KillTrack.lua
index 51af202..579c65a 100644
--- a/KillTrack.lua
+++ b/KillTrack.lua
@@ -44,6 +44,7 @@ local DamageTrack = {}

 if KT.Version == "@" .. "project-version" .. "@" then
 	KT.Version = "Development"
+	KT.Debug = true
 end

 function KT:OnEvent(_, event, ...)
@@ -109,13 +110,26 @@ end

 function KT.Events.UPDATE_MOUSEOVER_UNIT(self, ...)
 	if UnitIsPlayer("mouseover") then return end
-	if not UnitCanAttack("player", "mouseover") then return end
 	local id = KTT:GUIDToID(UnitGUID("mouseover"))
-	local gKills, cKills = self:GetKills(id)
-	GameTooltip:AddLine(("Killed %d (%d) times."):format(cKills, gKills), 1, 1, 1)
+	if UnitCanAttack("player", "mouseover") then
+		local gKills, cKills = self:GetKills(id)
+		GameTooltip:AddLine(("Killed %d (%d) times."):format(cKills, gKills), 1, 1, 1)
+	end
+	if KT.Debug then
+		GameTooltip:AddLine(("ID = %d"):format(id))
+	end
 	GameTooltip:Show()
 end

+function KT:ToggleDebug()
+	self.Debug = not self.Debug
+	if self.Debug then
+		KT:Msg("Debug enabled!")
+	else
+		KT:Msg("Debug disabled!")
+	end
+end
+
 function KT:IsInGroup(unit)
 	if unit == UnitName("player") then return true end
 	if UnitInParty(unit) then return true end
diff --git a/Tools.lua b/Tools.lua
index 1488b29..f18cb61 100644
--- a/Tools.lua
+++ b/Tools.lua
@@ -65,5 +65,5 @@ end
 -----------------

 function KTT:GUIDToID(guid)
-	return tonumber(guid:sub(-12, -9), 16)
+	return tonumber(guid:sub(6, 10), 16)
 end