Mercurial > wow > buffalo2
changeset 31:48b3e3959a0a
- clean up method arguments
author | Nenue |
---|---|
date | Thu, 14 Apr 2016 19:39:05 -0400 |
parents | 7583684becf4 |
children | a3afe6c3771e |
files | ObjectiveTracker/AutoQuestPopups.lua ObjectiveTracker/BonusObjectives.lua ObjectiveTracker/Events.lua ObjectiveTracker/Frame.lua ObjectiveTracker/Quests.lua |
diffstat | 5 files changed, 88 insertions(+), 110 deletions(-) [+] |
line wrap: on
line diff
--- a/ObjectiveTracker/AutoQuestPopups.lua Thu Apr 14 17:11:13 2016 -0400 +++ b/ObjectiveTracker/AutoQuestPopups.lua Thu Apr 14 19:39:05 2016 -0400 @@ -49,14 +49,14 @@ end end -AutoQuest.Select = function(self) +AutoQuest.Select = function(handler, block) - if self.info.popupType == 'OFFER' then - ShowQuestOffer(self.info.questIndex) + if block.info.popupType == 'OFFER' then + ShowQuestOffer(block.info.questLogIndex) else - ShowQuestComplete(self.info.questIndex) + ShowQuestComplete(block.info.questLogIndex) end - RemoveAutoQuestPopUp(self.info.questID) + RemoveAutoQuestPopUp(block.info.questID) end AutoQuest.Link = T.Quest.Link
--- 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)
--- a/ObjectiveTracker/Events.lua Thu Apr 14 17:11:13 2016 -0400 +++ b/ObjectiveTracker/Events.lua Thu Apr 14 19:39:05 2016 -0400 @@ -30,6 +30,10 @@ print('cleaning dead WatchInfo entry') Quest.WatchInfo[info.watchIndex] = nil end + if Quest.itemButtons[info.questID] then + -- hide for now, it will get cleaned up shortly + Quest.itemButtons[info.questID]:Hide() + end T:Update(OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST) end
--- a/ObjectiveTracker/Frame.lua Thu Apr 14 17:11:13 2016 -0400 +++ b/ObjectiveTracker/Frame.lua Thu Apr 14 19:39:05 2016 -0400 @@ -37,9 +37,9 @@ local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0} local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE' -local titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125} -local titlebg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125 } -local titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125} +local titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .2} +local titlebg_daily = {'HORIZONTAL', 0, .7, 1, 0, 0, 1, .7, .2 } +local titlebg_account = {'HORIZONTAL', 0, .45, 1, 0, 0, .45, 1, .2} local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE' local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 } @@ -53,7 +53,27 @@ local titleIndent, textIndent,selectionIndent = 2, 5, 50 local lineColors = { - text = {.5,.75,1}, + normal = { + text = {.5,.75,1}, + }, + completed = { + text = {1,0,.1} + }, + failed = { + text = {1,0,0 } + }, + autocomplete = { + text = {0,1,0 } + }, + object = { + text = {0,1,1} + }, + monster = { + text = {1,1,0} + }, + item = { + text = {1,.25,.5} + } } local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed @@ -106,43 +126,45 @@ local print = lprint local lineIndex = block.currentLine + 1 local line = handler:GetLine(block) + line.index = lineIndex line:ClearAllPoints() line:SetPoint('LEFT', block, 'LEFT', 0, 0) - line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing) + line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, 0) line:SetPoint('RIGHT', block, 'RIGHT', 0, 0) line:Show() - local r, g, b, a = 1, 1, 1, 1 - if lineColors[template] then - r, g, b = unpack(lineColors[template]) - end - + print(' |cFF0088FFAddLine >>|r', block, '::', block.endPoint:GetName(),'"'.. text .. '"', attachment, template) line.status:SetText(text) line.height = floor(line.status:GetStringHeight()+.5) + textSpacing line:SetHeight(line.height) + + local r, g, b, a = 1, 1, 1, 1 + if lineColors[template] then + r, g, b = unpack(lineColors[template].text) + end line.status:SetTextColor(r, g, b, a) -- For progressbar and timer lines, status text may be used as the title heading if attachment then - local widgetPosition = 0 - attachment:SetPoint('TOP', line, 'TOP', 0, -block.attachmentHeight) + local widgetOffset = 0 + if text and #text >= 1 then + widgetOffset = line.status:GetHeight() + textSpacing + line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + attachment.height + print(' |cFFFF0088doing things with captioned widget') + else + print(' |cFFFF0088doing things with a widget') + end + attachment:SetPoint('TOP', line, 'TOP', 0, -widgetOffset) attachment:Show() - if text and #text >= 1 then - widgetPosition = line.status:GetHeight() + textSpacing - line.status:SetText(text) - line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + attachment.height - print(' - progressbar has text, adjust') - end - else - print(' |cFFFF0088no attachments') end - block.endIndex = line.index - block.attachmentHeight = block.attachmentHeight + (line.height + textSpacing) + block.attachmentHeight = block.attachmentHeight + line.height print(' |cFF0088FFsetting line #'..lineIndex..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height, "|cFF0088FFpoint:|r", line:GetPoint(1), "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N')) block.currentLine = lineIndex - block.endPoint = line + block.endPoint = line.statusbg -- edge used for the next block + + return lineIndex end --- Creates or retrieves a complete line data object @@ -152,13 +174,13 @@ local lines = block.lines if not lineIndex then lineIndex = block.currentLine + 1 - print('fetching the "next" line:', lineIndex) + print(' fetching the "next" line:', lineIndex) else - print('fetching explicit offset:', lineIndex) + print(' fetching explicit offset:', lineIndex) end block.numLines = max(block.numLines, lineIndex) - print('|cFF00FFFFnumLines:|r', block.numLines, '|cFF00FFFFcurrentLine:|r', block.currentLine) + print(' |cFF00FFFFposition|r', block.currentLine, '|cFF00FFFFof|r|cFFFFFF00' , block.numLines) if not lines[lineIndex] then print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex) @@ -209,7 +231,7 @@ block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) block.titlebg:SetTexture(1,1,1,1) - block.titlebg:SetGradientAlpha(unpack(Module.colors.default.titlebg)) + block.titlebg:SetGradientAlpha(unpack(titlebg)) block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) @@ -220,7 +242,7 @@ block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0) block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0) block.statusbg:SetTexture(1,1,1,1) - block.statusbg:SetGradientAlpha(unpack(Module.colors.default.textbg)) + block.statusbg:SetGradientAlpha(unpack(textbg)) block.SelectionOverlay:SetGradientAlpha(unpack(Module.colors.default.selectionbg)) block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) @@ -530,10 +552,11 @@ --block.highlight:SetPoint('TOPLEFT', block, 'TOPLEFT', 0, 1) --block.lowlight:SetPoint('BOTTOMLEFT', block, 'BOTTOMLEFT', 0, 1) - tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative) - tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative) - tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative) - + if info.tagInfo then + tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative) + tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative) + tagPoint, tagAnchor, tagRelative = handler:AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative) + end return block end @@ -545,24 +568,21 @@ Default.UpdateObjectives = function(handler, block) local print = lprint local info = block.info - print(' |cFF00FF00default objectives routine', block:GetName()) + print('|cFF00FF00default.objectives', block:GetName()) + -- reset the starting positions block.endPoint = block.titlebg block.attachmentHeight = 0 block.currentLine = 0 - -- reset the starting positions - block.attachmentHeight = 0 - block.endPoint = block.titlebg - local completionScore, completionMax = 0, 0 local displayObjectiveHeader = false + block.attachmentHeight = 0 + local text, attachment, template + if info.statusKey and (Devian and Devian.InWorkspace()) then + handler:AddLine(block, info.statusKey, nil) + end - --- The first line is going to be used no matter what, so it is hard-pulled. - -- It also ensures that we're in the right position for cleaning up the leftover lines. - block.attachmentHeight = 0 - - local text, attachment if info.description and #info.description >= 1 then print(' |cFF00FFFF header line:|r', info.description) text = info.description @@ -572,16 +592,16 @@ if (info.isComplete or info.numObjectives == 0) and info.completionText then print(' overriding line #1 for completion text:', info.completionText) text = info.completionText - Module.AddLine(block, text, nil) + handler:AddLine(block, text, nil) else if info.objectives then for i, data in ipairs(info.objectives) do local line = handler:GetLine(block) displayObjectiveHeader = true line.height = 0 - text, attachment = handler:UpdateLine(block, line, data) + text, attachment, template = handler:UpdateLine(block, line, data) print(' |cFF88FF00#', i, data.type, text) - handler:AddLine(block, text, attachment) + handler:AddLine(block, text, attachment, template) end end @@ -595,25 +615,9 @@ end if block.currentLine > 0 then - block.attachmentHeight = block.attachmentHeight + textSpacing * 2 + block.attachmentHeight = block.attachmentHeight + textSpacing print(' |cFF00FF00attachment:', block.attachmentHeight) end - - - if debug then - for i, region in ipairs(block.debug) do - for j = 1, region:GetNumPoints() do - local _, target = region:GetPoint(j) - if target:IsVisible() then - region:Hide() - else - region:Show() - end - end - end - end - - block.completionScore = completionScore / completionMax end @@ -623,7 +627,7 @@ -- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively -Default.UpdateLine = function(block, line) +Default.UpdateLine = function(handler, block, line, data) if line.finished then line.progress = 2 elseif line.quantity > 0 then @@ -631,7 +635,7 @@ else line.progress = 0 end - return line.displayText, line.widget + return data.text, line.widget, 'normal' end ---------- --- Top level methods
--- a/ObjectiveTracker/Quests.lua Thu Apr 14 17:11:13 2016 -0400 +++ b/ObjectiveTracker/Quests.lua Thu Apr 14 19:39:05 2016 -0400 @@ -77,28 +77,7 @@ Quest.UpdateLine = function(handler, block, line, data) local print = lprint local objectiveType = data.type - local r, g, b, a = 0, 1, 1, 1 - - line.progress = 0 - if data.finished then - line.progress = 2 - r, g, b, a = 0, 1, 0, 1 - elseif objectiveType == 'monster' then - r, g, b, a = 1, .55, .2, 1 - elseif objectiveType == 'item' then - r, g, b, a = .8, .8, .8, 1 - elseif objectiveType == 'object' then - r, g, b, a = 1, 1, 1, 1 - elseif objectiveType == 'player' then - r, g, b, a = 0, 0.8, 1, 1 - end - print(format(' |cFF%02X%02X%02X%0.1f, %0.1f, %0.1f|r', (r * 255), g * 255, b * 255, r, g, b)) - - line.displayColor = {r, g, b, a} - line.status:SetTextColor(r, g, b, a) - line.displayText = data.text - - return data.text, nil + return data.text, nil, objectiveType end ----------------------------- @@ -213,6 +192,7 @@ requiredMoney = requiredMoney, playerMoney = playerMoney, } + tinsert(objectives, moneyInfo) end -- time limit @@ -225,6 +205,7 @@ timeElapsed = timeElapsed, failureTime = failureTime, } + tinsert(objectives, timerInfo) end end end @@ -363,6 +344,7 @@ q.isComplete = isComplete q.isStory = isStory q.isTask = isTask + q.statusKey = temp_status q.selected = (questID == superTrackQuestID) -- call directly so artifact data doesn't become an issue self.WatchInfo[watchIndex] = q