comparison ObjectiveTracker/BonusObjectives.lua @ 31:48b3e3959a0a

- clean up method arguments
author Nenue
date Thu, 14 Apr 2016 19:39:05 -0400
parents 7583684becf4
children a3afe6c3771e
comparison
equal deleted inserted replaced
30:7583684becf4 31:48b3e3959a0a
244 --- Update hooks 244 --- Update hooks
245 Bonus.UpdateObjectives = function(handler, block) 245 Bonus.UpdateObjectives = function(handler, block)
246 Default.UpdateObjectives(handler, block) 246 Default.UpdateObjectives(handler, block)
247 end 247 end
248 248
249 Bonus.UpdateLine = function(handler, block, line, data) 249 Bonus.UpdateLine = function(handler, objectiveType, line, data)
250 local info = block.info 250 local info = block.info
251 local print = lprint 251 local print = lprint
252 252 local text, attachment = '', nil
253 line.displayColor = 'FFFFFF' 253 line.displayColor = 'FFFFFF'
254 line.displayText = data.text
255 line.progress = 0
256 print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text) 254 print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text)
257 if data.objectiveType == 'progressbar' then 255 if data.objectiveType == 'progressbar' then
258 line.widgetType = 'ProgressBar'
259 print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID))) 256 print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID)))
260 data.value = GetQuestProgressBarPercent(info.questID) or 0 257 data.value = GetQuestProgressBarPercent(info.questID) or 0
261 data.maxValue = 100 258 data.maxValue = 100
262 if data.value >= data.maxValue then 259 attachment = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
263 line.progress = 1 260 attachment:SetPoint('TOP', line, 'TOP', 0, 0)
264 elseif data.value > 0 then 261 attachment.status:SetFormattedText(PERCENTAGE_STRING, (data.value / data.maxValue))
265 line.progress = 2
266 end
267 line.format = PERCENTAGE_STRING
268 local widget = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
269 print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue) 262 print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue)
270 widget:SetPoint('TOP', line, 'TOP', 0, 0)
271
272 line.widget = widget
273 line.height = widget.height
274 else 263 else
275 line.displayText = data.text 264 text = data.text
276 line.widget = nil 265 end
277 end 266 return text, attachment
278 return line
279 end 267 end
280 268
281 Bonus.Select = function(self) 269 Bonus.Select = function(self)
282 Bonus:OnTurnIn(self.info.questID) 270 Bonus:OnTurnIn(self.info.questID)
283 end 271 end