diff ObjectiveTracker/Achievements.lua @ 30:7583684becf4

- implement procedural block contents generation - redo anchor calculations to allow for transitional animation - attempt to sort out event handling quirks related to autopopup quest completion and turn-in - revise the data structures created by the different GetInfo's - start on trimming out redundant variables
author Nenue
date Thu, 14 Apr 2016 17:11:13 -0400
parents adcd7c328d07
children 9856ebc63fa4
line wrap: on
line diff
--- a/ObjectiveTracker/Achievements.lua	Wed Apr 13 21:53:24 2016 -0400
+++ b/ObjectiveTracker/Achievements.lua	Thu Apr 14 17:11:13 2016 -0400
@@ -6,7 +6,7 @@
 local B = select(2,...).frame
 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
 local band = bit.band
-local ChatEdit_InsertLink, RemoveTrackedAchievement, GetAchievementLink, AchievementFrame, AchievementFrame_LoadUI = ChatEdit_InsertLink, RemoveTrackedAchievement, GetAchievementLink, AchievementFrame, AchievementFrame_LoadUI
+local RemoveTrackedAchievement, GetAchievementLink = RemoveTrackedAchievement, GetAchievementLink
 local AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement = AchievementFrame_ToggleAchievementFrame, AchievementFrame_SelectAchievement
 local GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo = GetTime, GetAchievementNumCriteria, GetAchievementCriteriaInfo
 local GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo = GetNumTrackedAchievements, GetTrackedAchievements, GetAchievementInfo
@@ -29,11 +29,16 @@
   local c = self.Info[cheevID]
   c.type = 'Cheevs'
   c.watchIndex = index
+  c.id = cheevID
   c.cheevID = cheevID
   c.title = name
   c.points, c.completed, c.month, c.day, c.year, c.description, c.flags, c.icon, c.rewardText, c.isGuildAch, c.wasEarnedByMe, c.earnedBy =
   points, completed, month, day, year, description, flags, icon, rewardText, isGuildAch, wasEarnedByMe, earnedBy
   c.numObjectives = GetAchievementNumCriteria(cheevID)
+
+  local tagInfo = {}
+
+
   c.objectives = {}
   for i = 1, c.numObjectives do
     local description, type, completed, quantity, requiredQuantity, characterName, flags, assetID, quantityString, criteriaID = GetAchievementCriteriaInfo(cheevID, i)
@@ -54,6 +59,7 @@
   end
   print('Cheevs.|cFF0088FFGetInfo|r('..index..')', 'obj:', GetAchievementNumCriteria(cheevID), name, description)
 
+  c.tagInfo = tagInfo
   self.WatchInfo[index] = c
   return self.Info[cheevID]
 end
@@ -61,6 +67,7 @@
 --- Content handlers
 Cheevs.UpdateLine = function(handler, block, line, data)
   local print = B.print('CheevsLine')
+  local attachment
   line.progress = 0
   print('  ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text)
   if data.flags then
@@ -82,35 +89,35 @@
   end
   print('line.type =', data.type)
   print('  ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID)
+  return line.displayText, line.widget
 end
 
-Cheevs.Select = function(self)
-  T:Update(Cheevs.updateReasonModule)
+Cheevs.Select = function(self, block)
+  Cheevs.Link(self, block)
 end
 
-Cheevs.Remove = function(self)
+Cheevs.Remove = function(self, block)
 
-  RemoveTrackedAchievement(self.info.cheevID)
+  RemoveTrackedAchievement(block.info.cheevID)
 end
 Cheevs.OnMouseUp = function(self, button)
 
   Default.OnMouseUp(self, button)
 end
-Cheevs.Link = function(self)
-
-  local achievementLink = GetAchievementLink(self.info.cheevID);
+Cheevs.Link = function(self, block)
+  local achievementLink = GetAchievementLink(block.info.cheevID);
   if ( achievementLink ) then
-    ChatEdit_InsertLink(achievementLink);
+    _G.ChatEdit_InsertLink(achievementLink);
   end
 end
 
-Cheevs.Open = function(self)
+Cheevs.Open = function(self, block)
 
-  if ( not AchievementFrame ) then
-    AchievementFrame_LoadUI();
+  if ( not _G.AchievementFrame ) then
+    _G.AchievementFrame_LoadUI();
   end
-  if ( not AchievementFrame:IsShown() ) then
-    AchievementFrame_ToggleAchievementFrame();
+  if ( not _G.AchievementFrame:IsShown() ) then
+    _G.AchievementFrame_ToggleAchievementFrame();
   end
-  AchievementFrame_SelectAchievement(self.info.cheevID);
+  _G.AchievementFrame_SelectAchievement(block.info.cheevID);
 end