Mercurial > wow > buffalo2
diff ObjectiveTracker/BonusObjectives.lua @ 34:9856ebc63fa4
- half solution to Update being fired multiple times during load
- change securefunc handlers to dispense a reason code; catch that reason code in the enclosure passed to hooksecurefunc, and decide whether to update or not from there.
author | Nenue |
---|---|
date | Sun, 17 Apr 2016 00:21:45 -0400 |
parents | 64f2a9bbea79 |
children | a487841050be |
line wrap: on
line diff
--- a/ObjectiveTracker/BonusObjectives.lua Fri Apr 15 17:01:06 2016 -0400 +++ b/ObjectiveTracker/BonusObjectives.lua Sun Apr 17 00:21:45 2016 -0400 @@ -95,7 +95,7 @@ local existingTasks = {} self.WatchInfo = {} print('|cFFFFFF00Bonus.GetNumWatched()|r', #tasks) - print(' TasksTable pull:') + print(' |cFF00FFFFInternalGetTaskInfo|r:') for i, questID in ipairs(tasks) do local isInArea, isOnMap, numObjectives = InternalGetTaskInfo(questID) local existingTask = self.QuestBlock[questID] @@ -131,12 +131,11 @@ t.objectives[objectiveIndex] = t.objectives[objectiveIndex] or {} local o = t.objectives[objectiveIndex] - o.objectiveIndex = objectiveIndex + o.index = objectiveIndex o.text = text - o.objectiveType = objectiveType + o.type = objectiveType o.finished = finished o.displayAsObjective = displayAsObjective - print(' |cFF00FF88*', objectiveIndex, text) end T.SetRewards(t, questID) @@ -147,7 +146,7 @@ taskTitle = GetMapNameByID(GetCurrentMapAreaID()) end end - + t.numObjectives = numObjectives t.isInArea = isInArea t.isOnMap = isOnMap t.existingTask = existingTask @@ -188,13 +187,30 @@ end end - print('|cFFFF8800'..block.name..':OnTurnIn call', questID, xp, money) - local savedTasks = B.Conf.TasksLog + print('|cFFFF8800'..block:GetName()..':OnTurnIn call', questID, xp, money) + local savedTasks = B.Conf.TasksLog or {} info.completedTime = GetTime() info.animate = true - T.SetAnimate(handler.watchReasonModule) - savedTasks[questID] = info + T.SetAnimate(self.updateReasonModule) + savedTasks[questID] = { + id = questID, + title = info.title, + finished = true, + numObjectives = info.numObjectives, + objectives = info.objectives, + rewardInfo = info.rewardInfo, + } + B.Conf.TasksLog = savedTasks + + print(' ## CONF TASKLOG ##') + for i, t in pairs(savedTasks[questID]) do + print(' |cFFFFFF00'.. tostring(i)..'|r', t) + + end + for o, j in ipairs(savedTasks[questID].objectives) do + print(' |cFF00FFFF#'.. o ..'|r', j.type, j.finished) + end print('adding', info.title, 'to cache') end @@ -209,6 +225,7 @@ --- Update hooks Bonus.UpdateObjectives = function(handler, block) Default.UpdateObjectives(handler, block) + return 'default' end Bonus.UpdateLine = function(handler, block, line, data) @@ -216,22 +233,30 @@ local print = lprint local text, attachment = '', nil line.displayColor = 'FFFFFF' - print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text) - if data.objectiveType == 'progressbar' then + if data.type == 'progressbar' then print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID))) local percent = 100 - attachment = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex) + attachment = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.index) if not data.finished then percent = GetQuestProgressBarPercent(info.questID) end + data.value = percent + data.maxValue = 100 + + print(attachment:GetNumPoints()) + for i = 1, attachment:GetNumPoints() do + print(' ',attachment:GetPoint(i)) + end + + attachment.value = percent attachment.maxValue = 100 attachment:SetPoint('TOP', line, 'TOP', 0, 0) - attachment.status:SetFormattedText(PERCENTAGE_STRING, (percent / 100)) + attachment.status:SetFormattedText(PERCENTAGE_STRING, percent) + print(attachment.status:GetText()) print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue) - else - text = data.text end + text = data.text return text, attachment end