diff Turok.lua @ 5:8a9a6637f082

focusbar data collection tracking db info declarations to main chunk
author Nenue
date Tue, 15 Dec 2015 10:10:22 -0500
parents 62f9b057c91b
children
line wrap: on
line diff
--- a/Turok.lua	Tue Dec 15 10:09:20 2015 -0500
+++ b/Turok.lua	Tue Dec 15 10:10:22 2015 -0500
@@ -138,7 +138,9 @@
 
   print('I... am Turok')
 
-  self.stats = {}
+  self.stats = {
+    maxpower = UnitPowerMax('player')
+  }
 
 
   T.focusbar = T:CreateBar('TkFocusBar', db.focusbar)
@@ -146,6 +148,12 @@
   T:AddLabel(fb, db.focusbar)
   fb:Update(UnitPower("player"), 0, UnitPowerMax("player"))
   T:Bar_SetUpdateHandler(fb, function(self)
-      T.Bar_Update(fb, UnitPower("player"))
+      local pp = UnitPower("player")
+      if pp == T.stats.maxpower and not T.stats.capped then
+        T.stats.capped = true
+      elseif T.stats.capped then
+          T.stats.capped = false
+      end
+      T.Bar_Update(fb, pp)
   end)
 end