diff Turok/Modules/Timer/Icon.lua @ 9:9400a0ff8540

Ugh Timer: - container update directionality - talent update iterates over a non-volatile table to carry out updates - index management steps organized - talentRow status implemented, returns the spell associated with the talent chosen from that row CombatLog: - sort out font controls and unbork arguments
author Nenue
date Sun, 21 Feb 2016 13:08:30 -0500
parents a9b8b0866ece
children
line wrap: on
line diff
--- a/Turok/Modules/Timer/Icon.lua	Sun Feb 21 08:49:34 2016 -0500
+++ b/Turok/Modules/Timer/Icon.lua	Sun Feb 21 13:08:30 2016 -0500
@@ -14,7 +14,6 @@
     _G.print('Icon', ...)
   end
 end
-print('Peep!', ...)
 --@end-debug@
 local GetPrint = function(trace)
   if trace then
@@ -80,6 +79,11 @@
   self.icon:SetTexture(self.spellIcon or self.itemIcon)
 end
 
+local function Icon_UpdateCooldown(self)
+  self.spiral:Show()
+  self.spiral:SetCooldown(self.charges and self.chargeStart or (self.override and self.override_start or self.start), self.charges and self.chargeDuration or (self.override and self.override_duration or self.duration))
+  print('spiral:Play() new', self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration)
+end
 
 --- Advances the display state, applying any visual transitions as necessary;
 -- @param self frame object
@@ -130,9 +134,7 @@
 
         -- and is ACTIVE
         self:Show()
-        self.spiral:Show()
-        self.spiral:SetCooldown(self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration)
-        print('spiral:Play() new', self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration)
+        Icon_UpdateCooldown(self)
       end
 
       if previous and previous ~= HIDDEN then
@@ -140,7 +142,6 @@
       -- from visible
         if self.event then
           self.refresh = true
-          self.Retro:Play()
         end
       else
         print(cText('  from non-vis'))
@@ -155,10 +156,7 @@
     --- No-change transitions
     if newState == ACTIVE then
       -- ACTIVE to ACTIVE
-      print(cText(''))
-      self.spiral:Show()
-      self.spiral:SetCooldown(self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration)
-      print('spiral:Play() new', self.charges and self.chargeStart or self.start, self.charges and self.chargeDuration or self.duration)
+      Icon_UpdateCooldown(self)
     else
       print(cPink('stopping spiral'))
       self.spiral:Hide()
@@ -167,7 +165,6 @@
     -- non-HIDDEN to non-HIDDEN and not a dry fire
     if self.event and newState ~= HIDDEN then
       self.refresh = true
-      self.Retro:Play()
     end
   end
 
@@ -175,8 +172,14 @@
     print(cText('  CVars:'))
     local c
     if newState == ACTIVE then
-      print('apply active profile')
-      c = self.cvars.active
+      if self.override then
+        c = self.cvars.override
+        print('apply override profile')
+      else
+        print('apply active profile')
+        c = self.cvars.active
+      end
+
       self.fillState = 1
     else
       print('apply passive profile')
@@ -220,7 +223,7 @@
     -- prevState is set externally
     local time = GetTime()
     if self.expires <= time and self.charges == self.maxCharges then
-      _G.print(self.cvars.type, 'timer expired, set to', (self.cvars.persist and self.flags.passive or self.flags.hidden))
+      print(self.cvars.type, 'timer expired, set to', (self.cvars.persist and self.flags.passive or self.flags.hidden))
       self.percent = 1
       self.duration = 0
       self.expires = 0
@@ -231,8 +234,23 @@
       self.remaining = 0
       self:SetState(self.cvars.persist and self.flags.passive or self.flags.hidden)
     else
-      self.percent = (self.charges and self.charges < self.maxCharges) and ((time  - self.chargeStart) / self.chargeDuration) or ((time  - self.start) / self.duration)
-      self.valueFull = self.expires - time
+      -- unit_aura is too ambiguous
+      if self.override and self.override_expires < time then
+        self.override = nil
+        self:SetState(self.flags.active)
+      end
+
+      if self.override then
+        self.valueFull = self.override_start + self.override_duration - time
+        self.percent = (time - self.override_start) / self.override_duration
+      elseif self.charges and self.charges < self.charges_max then
+        self.valueFull = self.charge_expires - time
+        self.percent = (time - self.charge_start) / self.charge_duration
+      else
+        self.valueFull  = self.expires - time
+        self.percent = (time - self.start) / self.duration
+      end
+
       self.elapsed = time - self.start
       self.remaining = self.duration - time