Version 0.9.3 (28-12-2017)

Jarth [12-28-17 - 17:38]
Version 0.9.3 (28-12-2017)
Filename
Changelog
MementoBar.lua
MementoBar.txt
diff --git a/Changelog b/Changelog
index e082e1c..e29b7b2 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,11 @@
 -------------------------------------------------------------------------------
 Memento bar
 -------------------------------------------------------------------------------
+Version 0.9.3 (28-12-2017)
+- Updated the cooldown event from EVENT_ABILITY_COOLDOWN_UPDATED to EVENT_ACTION_UPDATE_COOLDOWNS.
+-- It has less updates, and less spam.
+-- Also unregisters each time it is called.
+
 Version 0.9.2 (26-12-2017)
 - Fixed issue where the border would be visible, when no icons were shown

diff --git a/MementoBar.lua b/MementoBar.lua
index a438379..ec116d9 100644
--- a/MementoBar.lua
+++ b/MementoBar.lua
@@ -13,7 +13,7 @@ local LAM2 = LibStub:GetLibrary("LibAddonMenu-2.0")
 -------------------------------------------------------------------------------------------------
 local ADDON_NAME = "MementoBar"
 local ADDON_VERSION = 0.9
-local ADDON_MINOR_VERSION = 2
+local ADDON_MINOR_VERSION = 3
 local ADDON_AUTHOR = "Jarth"
 local ADDON_WEBSITE = ""
 local MementoBar = {}
@@ -52,7 +52,6 @@ function MementoBar.initializeButtons()
   local index = 0
   local mbHeight = MB_Frame:GetHeight()
   local mbWidth = MB_Frame:GetWidth()
-  --MementoBar.savedVariables.barDepth

   for collectionId in pairs(MementoBar.savedVariables.mementos) do
     if MementoBar.savedVariables.mementos[collectionId].show and IsCollectibleUnlocked(collectionId) then
@@ -173,22 +172,27 @@ function MementoBar.Activate(collectionId)
   local start = GetTimeStamp()
   local cooldownRemaining, cooldownDuration = GetCollectibleCooldownAndDuration(collectionId)
   --d("Activate",cooldownRemaining, cooldownDuration, collectionId, start)
-
+
   local function Update(eventId)
     cooldownRemaining, cooldownDuration = GetCollectibleCooldownAndDuration(collectionId)
+    -- local updateStr ="Update," .. cooldownRemaining .. "," .. cooldownDuration .. "," .. eventId .. "," .. collectionId .. "," .. start .. "," .. GetTimeStamp()
+    -- d(updateStr)
+
     if cooldownRemaining > 0 then
       MementoBar.UpdateLabel(cooldownRemaining)
     elseif (GetTimeStamp() < (start + math.floor(cooldownDuration/1000)))  then
+      --d("Update",cooldownRemaining, cooldownDuration, collectionId, start, GetTimeStamp())
       MementoBar.UpdateLabel(cooldownDuration)
     else
       MementoBar.UpdateLabel("")
-      EVENT_MANAGER:UnregisterForEvent(MementoBar.name, EVENT_ABILITY_COOLDOWN_UPDATED)
+      EVENT_MANAGER:UnregisterForEvent(MementoBar.name, EVENT_ACTION_UPDATE_COOLDOWNS)
     end
   end

   if IsCollectibleUsable(collectionId) then
+    EVENT_MANAGER:UnregisterForEvent(MementoBar.name, EVENT_ACTION_UPDATE_COOLDOWNS)
     UseCollectible(collectionId)
-    EVENT_MANAGER:RegisterForEvent(MementoBar.name, EVENT_ABILITY_COOLDOWN_UPDATED, Update)
+    EVENT_MANAGER:RegisterForEvent(MementoBar.name, EVENT_ACTION_UPDATE_COOLDOWNS, Update)
   end
 end

diff --git a/MementoBar.txt b/MementoBar.txt
index 0cd27ab..9115369 100644
--- a/MementoBar.txt
+++ b/MementoBar.txt
@@ -6,7 +6,7 @@

 ## APIVersion: 100021
 ## Title: Memento Bar
-## Version: 0.9.2
+## Version: 0.9.3
 ## Author: Jarth
 ## Description: Show a hotbar with selected memento's. Activate by button press!
 ##