diff ObjectiveTracker/BonusObjectives.lua @ 31:48b3e3959a0a

- clean up method arguments
author Nenue
date Thu, 14 Apr 2016 19:39:05 -0400
parents 7583684becf4
children a3afe6c3771e
line wrap: on
line diff
--- a/ObjectiveTracker/BonusObjectives.lua	Thu Apr 14 17:11:13 2016 -0400
+++ b/ObjectiveTracker/BonusObjectives.lua	Thu Apr 14 19:39:05 2016 -0400
@@ -246,36 +246,24 @@
   Default.UpdateObjectives(handler, block)
 end
 
-Bonus.UpdateLine = function(handler, block, line, data)
+Bonus.UpdateLine = function(handler, objectiveType, line, data)
   local info = block.info
   local print = lprint
-
+  local text, attachment = '', nil
   line.displayColor = 'FFFFFF'
-  line.displayText = data.text
-  line.progress = 0
   print('  ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text)
   if data.objectiveType == 'progressbar' then
-    line.widgetType = 'ProgressBar'
     print('    |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID)))
     data.value = GetQuestProgressBarPercent(info.questID) or 0
     data.maxValue = 100
-    if  data.value >= data.maxValue then
-      line.progress = 1
-    elseif data.value > 0 then
-      line.progress = 2
-    end
-    line.format = PERCENTAGE_STRING
-    local widget = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
+    attachment = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
+    attachment:SetPoint('TOP', line, 'TOP', 0, 0)
+    attachment.status:SetFormattedText(PERCENTAGE_STRING, (data.value / data.maxValue))
     print('    |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue)
-    widget:SetPoint('TOP', line, 'TOP', 0, 0)
-
-    line.widget = widget
-    line.height = widget.height
   else
-    line.displayText = data.text
-    line.widget = nil
+    text = data.text
   end
-  return line
+  return text, attachment
 end
 
 Bonus.Select = function(self)