Mercurial > wow > buffalo2
changeset 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 | 48b3e3959a0a |
files | ObjectiveTracker/Achievements.lua ObjectiveTracker/AutoQuestPopups.lua ObjectiveTracker/BonusObjectives.lua ObjectiveTracker/Frame.lua ObjectiveTracker/ObjectiveTracker.lua ObjectiveTracker/ObjectiveTracker.xml ObjectiveTracker/Quests.lua ObjectiveTracker/Scenarios.lua |
diffstat | 8 files changed, 693 insertions(+), 443 deletions(-) [+] |
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
--- a/ObjectiveTracker/AutoQuestPopups.lua Wed Apr 13 21:53:24 2016 -0400 +++ b/ObjectiveTracker/AutoQuestPopups.lua Thu Apr 14 17:11:13 2016 -0400 @@ -27,10 +27,11 @@ self.Info[questID] = self.Info[questID] or {} local popup = self.Info[questID] + popup.questID = questID + popup.id = questID popup.title = title popup.description = type popup.popupType = type - popup.questID = questID popup.questLogIndex = questLogIndex popup.popupIndex = popupIndex
--- a/ObjectiveTracker/BonusObjectives.lua Wed Apr 13 21:53:24 2016 -0400 +++ b/ObjectiveTracker/BonusObjectives.lua Thu Apr 14 17:11:13 2016 -0400 @@ -154,6 +154,7 @@ t.isOnMap = isOnMap t.existingTask = existingTask t.questID = questID + t.id = questID t.objectives = {} t.taskIndex = i
--- a/ObjectiveTracker/Frame.lua Wed Apr 13 21:53:24 2016 -0400 +++ b/ObjectiveTracker/Frame.lua Thu Apr 14 17:11:13 2016 -0400 @@ -4,29 +4,26 @@ -- @file-revision@ @file-hash@ -- Created: 3/30/2016 12:49 AM local B = select(2,...).frame -local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') +local Module = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent -local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs +local Default, AutoQuest, Quest, Bonus, Cheevs = Module.DefaultHandler, Module.AutoQuest, Module.Quest, Module.Bonus, Module.Cheevs local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow local print = B.print('Tracker') local unitLevel = 1 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON local debug = false --------------------------------------------------------------------- ---- Global frame layout --------------------------------------------------------------------- --- Upvalues local Wrapper = _G.VeneerObjectiveWrapper local Scroller = Wrapper.scrollArea local Scroll = _G.VeneerObjectiveScroll -local orderedHandlers = T.orderedHandlers -local orderedNames = T.orderedNames +local orderedHandlers = Module.orderedHandlers +local orderedNames = Module.orderedNames --- Temp values set during updates local wrapperWidth, wrapperHeight @@ -36,7 +33,7 @@ --- todo: source these from config local itemButtonSize, itemButtonSpacing = 36, 1 -local headerHeight, headerColor, headerSpacing = 16, {1,1,1,1}, 2 +local headerHeight, headerColor, headerSpacing = 16, {1,.75,0,1}, 2 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' @@ -55,6 +52,10 @@ local titleSpacing, textSpacing, blockSpacing = 3, 3, 1 local titleIndent, textIndent,selectionIndent = 2, 5, 50 +local lineColors = { + text = {.5,.75,1}, +} + local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } @@ -64,135 +65,101 @@ local tprint = B.print('Tracker') local lprint = B.print('Line') -local currentPosition, anchorFrame, anchorPoint - ---- Positioning and stuff -local tick = 0 -function T:Update (reason, ...) - tick = tick + 1 - local print = tprint - reason = reason or OBJECTIVE_TRACKER_UPDATE_REASON - local updateWrapper = 0 - local hasStuff - local insertingStuff - - print(format('%d |cFFFF%04X Update()', tick, lshift(reason, 4)), reason, ...) - currentPosition = 0 - anchorPoint = 'TOP' - anchorFrame = Scroll - - local wrapperHeight = 0 - for id, handler in pairs(T.orderedHandlers) do - local frame = handler.frame - - print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents))) - if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then - handler:Update(reason, ...) - print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched) - insertingStuff = true - else - print(' |cFFFF0088'..id..'|r', 'no reason to update') - end - - if handler.numWatched >= 1 then - hasStuff = true - currentPosition = currentPosition + 1 - frame:SetParent(Scroll) - frame:SetPoint('TOP', anchorFrame, anchorPoint, 0, 0) - print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint) - anchorFrame = handler.frame - anchorPoint = 'BOTTOM' - - print('current frame height:', frame.height) - wrapperHeight = wrapperHeight + frame.height - print('|cFFFF0088total height:', wrapperHeight) - else - handler.frame:Hide() - end - end - - - if hasStuff or insertingStuff then - print('updating height to', wrapperHeight) - Wrapper:SetHeight(wrapperHeight) - Scroller:SetHeight(wrapperHeight) - Scroll:SetHeight(wrapperHeight) - Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0) - print('|cFFFF8800Wrapper:', Wrapper:GetSize()) - for i = 1, Wrapper:GetNumPoints() do - print(' ', Wrapper:GetPoint(i)) - end - print(' |cFF00FFFFScroller:', Scroller:GetSize()) - for i = 1, Scroller:GetNumPoints() do - print(' ', Scroller:GetPoint(i)) - end - print(' |cFF00FFFFScroll:', Scroll:GetSize()) - for i = 1, Scroll:GetNumPoints() do - print(' ', Scroll:GetPoint(i)) - end - - Wrapper:Show() - Scroller:Show() - Scroll:Show() - end - Quest.GetClosest() - --T.UpdateActionButtons(reason) -end - -T.AddBlock = function(self, block) +Default.AddBlock = function(self, block, blockIndex) + local blockIndex = blockIndex or (self.currentBlock + 1) local print = bprint local tracker = self.frame local info = block.info - block:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0) + + block.index = blockIndex + block:SetPoint('TOPLEFT', self.frame, 'TOPLEFT', 0, block.offset) block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) + self.currentBlock = blockIndex self.currentAnchor = block print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height) tracker.height = tracker.height + block.height - self.numBlocks = max(self.numBlocks, info.blockIndex) + self.numBlocks = max(self.numBlocks, blockIndex) self.actualBlocks = self.actualBlocks + 1 end --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) -T.AddTag = function (block, tagName, tagPoint, tagAnchor, tagRelative) +Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative) local print = bprint - local tag = block[tagName] - if block.info[tagName] and tag then - tag:SetTexCoord(unpack(block.info[tagName])) - tag:Show() - tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0) - tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT' - else - block[tagName]:Hide() + + for order, tagName in ipairs(block.info.tagInfo) do + local tag = block[tagName] + if block.tagCoords[tagName] and tag then + tag:SetTexCoord(unpack(block.tagCoords[tagName])) + tag:Show() + tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0) + tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT' + else + block[tagName]:Hide() + end end + return tagPoint, tagAnchor, tagRelative end --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call. -T.AddLine = function(block, line) +Default.AddLine = function(handler, block, text, attachment, template) local print = lprint + local lineIndex = block.currentLine + 1 + local line = handler:GetLine(block) line:ClearAllPoints() line:SetPoint('LEFT', block, 'LEFT', 0, 0) line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing) line:SetPoint('RIGHT', block, 'RIGHT', 0, 0) - line:SetHeight(line.height) line:Show() + local r, g, b, a = 1, 1, 1, 1 + if lineColors[template] then + r, g, b = unpack(lineColors[template]) + end + + line.status:SetText(text) + line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + line:SetHeight(line.height) + 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) + 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.numLines = block.numLines + 1 block.attachmentHeight = block.attachmentHeight + (line.height + textSpacing) - print(' |cFF0088FFsetting line #'..block.numLines..' for|r', block.info.title, "\n |cFF0088FFsize:|r", 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 end --- Creates or retrieves a complete line data object -T.GetLine = function(handler, block, lineIndex) +Default.GetLine = function(handler, block, lineIndex) local print = lprint local blockIndex = block.index - if not block.lines then - block.lines = {} + local lines = block.lines + if not lineIndex then + lineIndex = block.currentLine + 1 + print('fetching the "next" line:', lineIndex) + else + print('fetching explicit offset:', lineIndex) end - local lines = block.lines + + block.numLines = max(block.numLines, lineIndex) + print('|cFF00FFFFnumLines:|r', block.numLines, '|cFF00FFFFcurrentLine:|r', block.currentLine) + if not lines[lineIndex] then print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex) lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective') @@ -220,7 +187,7 @@ --- Creates or retrieves a complete block frame object -T.GetBlock = function(handler, blockIndex) +Default.GetBlock = function(handler, blockIndex) local print = bprint local block = handler.usedBlocks[blockIndex] @@ -229,19 +196,20 @@ block = handler.freeBlocks[#handler.freeBlocks] handler.freeBlocks[#handler.freeBlocks] = nil else - block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, Scroll, 'VeneerTrackerBlock') + block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, handler.frame, 'VeneerTrackerBlock') - - - local c = T.Conf.Wrapper + local c = Module.Conf.Wrapper block.index = blockIndex + block.lines = {} + block.numLines = 0 + block.currentLine = 0 block:SetWidth(c.Width) block.title:SetSpacing(c.TitleSpacing) block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) block.titlebg:SetTexture(1,1,1,1) - block.titlebg:SetGradientAlpha(unpack(T.colors.default.titlebg)) + block.titlebg:SetGradientAlpha(unpack(Module.colors.default.titlebg)) block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) @@ -252,9 +220,9 @@ 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(T.colors.default.textbg)) + block.statusbg:SetGradientAlpha(unpack(Module.colors.default.textbg)) - block.SelectionOverlay:SetGradientAlpha(unpack(T.colors.default.selectionbg)) + block.SelectionOverlay:SetGradientAlpha(unpack(Module.colors.default.selectionbg)) block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) block.SelectionOverlay:SetPoint('BOTTOMRIGHT') @@ -286,10 +254,131 @@ return handler.usedBlocks[blockIndex] end +local currentPosition, anchorFrame, anchorPoint +--- Positioning and stuff +local tick = 0 +local maxReason = 0 +function Module:Update (reason, ...) + tick = tick + 1 + -- is this the first time updating? + if maxReason == 0 then + reason = OBJECTIVE_TRACKER_UPDATE_ALL + elseif not reason then + reason = OBJECTIVE_TRACKER_UPDATE_REASON + end + + local print = tprint + local updateWrapper = 0 + local hasStuff + local insertingStuff + + print(format('%d |cFFFF%04X Update()', tick, lshift(reason, 4)), reason, ...) + currentPosition = 0 + anchorPoint = 'TOP' + anchorFrame = Scroll + + local wrapperHeight = 0 + for id, handler in pairs(Module.orderedHandlers) do + local frame = handler.frame + + print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents))) + if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then + handler:UpdateTracker(reason, ...) + print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched) + insertingStuff = true + else + print(' |cFFFF0088'..id..'|r', 'no reason to update') + end + + if handler.numWatched >= 1 then + hasStuff = true + currentPosition = currentPosition + 1 + frame.destinationOffset = -wrapperHeight + if frame.previousOffset ~= wrapperHeight and frame:IsVisible() then + print(frame.SlideIn.translation) + local postFrame, postPoint = anchorFrame, anchorPoint + local delta = frame.destinationOffset - frame.previousOffset + local _, _, _, _, offset = frame:GetPoint(1) + print(' |cFF00BBFFstart slide for', delta, 'pixels, from', frame.previousOffset, '(', offset, ')') + frame.SlideIn.translation:SetTarget(frame) + frame.SlideIn.translation:SetOffset(0, delta) + frame.SlideIn:Play() + for i, b in ipairs(handler.usedBlocks) do + b.SlideIn.translation:SetOffset(0, delta) + b.SlideIn:Play() + end + frame.SlideIn:SetScript('OnFinished', function() + print(' |cFF00BBFFsliding finished:', delta, 'pixels covered') + frame:SetParent(Scroll) + frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) + frame.previousOffset = frame.destinationOffset + frame.SlideIn:SetScript('OnFinished', nil) + if Wrapper.destinationHeight then + Wrapper:SetHeight(Wrapper.destinationHeight) + Scroller:SetHeight(Wrapper.destinationHeight) + Scroll:SetHeight(Wrapper.destinationHeight) + Wrapper.previousHeight = Wrapper.destinationHeight + Wrapper.destinationHeight = nil + end + + end) + else + print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint) + frame:SetParent(Scroll) + frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) + end + + frame:Show() + anchorFrame = handler.frame + anchorPoint = 'BOTTOM' + + print('current frame height:', frame.height) + wrapperHeight = wrapperHeight + frame.height + print('|cFFFF0088total height:', wrapperHeight) + else + frame:SetPoint('TOP', Scroll, 'TOP', 0, 0) + frame.destinationOffset = 0 + frame.previousOffset = 0 + handler.frame:Hide() + end + end + + + if hasStuff or insertingStuff then + print('updating height to', wrapperHeight) + if wrapperHeight > Wrapper.previousHeight then + Wrapper:SetHeight(wrapperHeight) + Scroller:SetHeight(wrapperHeight) + Scroll:SetHeight(wrapperHeight) + Wrapper.previousHeight = wrapperHeight + Wrapper.destinationHeight = wrapperHeight + end + Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0) + print('|cFFFF8800Wrapper:', Wrapper:GetSize()) + for i = 1, Wrapper:GetNumPoints() do + print(' ', Wrapper:GetPoint(i)) + end + print(' |cFF00FFFFScroller:', Scroller:GetSize()) + for i = 1, Scroller:GetNumPoints() do + print(' ', Scroller:GetPoint(i)) + end + print(' |cFF00FFFFScroll:', Scroll:GetSize()) + for i = 1, Scroll:GetNumPoints() do + print(' ', Scroll:GetPoint(i)) + end + + Wrapper:Show() + Scroller:Show() + Scroll:Show() + end + Quest.GetClosest() + --Module.UpdateActionButtons(reason) +end + --- Content generator base -Default.Update = function (self, reason, ...) +Default.UpdateTracker = function (handler, reason, id, isNew) local print = tprint - local tracker = self.frame + local tracker = handler.frame local blockIndex = 0 tracker.previousHeight = tracker.height tracker.height = 0 @@ -298,37 +387,37 @@ tracker.titlebg:SetHeight(headerHeight) tracker.title:SetTextColor(unpack(headerColor)) - self.currentAnchor = tracker.titlebg - self.numWatched = self:GetNumWatched() - self.actualBlocks = 0 - for watchIndex = 1, 25 do - blockIndex = blockIndex + 1 - if watchIndex <= self.numWatched then - local info = self:GetInfo(watchIndex) - if info then - local currentBlock = self:UpdateBlock(blockIndex, info) - T.AddBlock(self, currentBlock) - else - print(' |cFFFF0000bad GetInfo data for #'..watchIndex) - end - elseif watchIndex <= self.actualBlocks then - local used = self.usedBlocks - local free = self.freeBlocks - print('clean up dead quest block') - if used[blockIndex] then - used[blockIndex]:Hide() - used[blockIndex]:ClearAllPoints() - free[#free+1]= used[blockIndex] - used[blockIndex] = nil - end + handler.updateReason = reason + handler.numWatched = handler:GetNumWatched() + handler.currentBlock = 0 + handler.currentAnchor = tracker.titlebg + local blockPosition = -headerHeight + for blockIndex = 1, handler.numWatched do + local currentBlock = handler:UpdateBlock(blockIndex, id, isNew) + if currentBlock then + currentBlock.offset = blockPosition + handler:AddBlock(currentBlock) + blockPosition = blockPosition - currentBlock.height else print(' |cFFFF9900END|r @', blockIndex) break -- done with quest stuff end end + for i = handler.currentBlock+1, handler.numBlocks do + local used = handler.usedBlocks + local free = handler.freeBlocks + print('clean up dead quest block') + if used[i] then + used[i]:Hide() + used[i]:ClearAllPoints() + free[#free+1]= used[blockIndex] + used[i] = nil + end + end - if self.actualBlocks >= 1 then + + if handler.currentBlock >= 1 then tracker.height = tracker.height + headerHeight tracker:Show() @@ -353,14 +442,24 @@ -- @param blockNum the ordered block to be updated, not a watchIndex value -- @param info the reference returned by the GetXInfo functions -- REMEMBER: t.info and questData[questID] are the same table -Default.UpdateBlock = function (handler, blockIndex, info) +Default.UpdateBlock = function (handler, blockIndex, id, added) local print = bprint - print(' Read list item |cFF00FFFF'..blockIndex..'|r') - if not blockIndex or not info then + print(' Updating |cFF00FF00'..handler.displayName..'|r|cFF00FFFF'..blockIndex..'|r') + if not blockIndex then + return + end + local info = handler:GetInfo(blockIndex) -- should match up with whatever the internal watch list has + if not info then return end local frame = handler.frame - local block = T.GetBlock(handler, blockIndex) + local block = handler:GetBlock(blockIndex) + + block.questID = info.questID + if id == info.questID then + --block.questFadeIn:Play() + end + block.handler = handler block.info = info block.mainStyle = info.mainStyle or 'Normal' @@ -371,28 +470,22 @@ if info.questLogIndex then handler.LogBlock[info.questLogIndex] = block end if info.watchIndex then handler.WatchBlock[info.watchIndex] = block end handler.BlockInfo[blockIndex] = info - - block.endPoint = block.titlebg - block.attachmentHeight = 0 handler:UpdateObjectives(block) block.title:SetText(info.title) local titleHeight = floor(block.title:GetHeight()+.5) - local statusHeight = floor(block.status:GetHeight()+.5) - local attachmentHeight =floor(block.attachmentHeight + .5) local titlebgHeight = titleHeight + titleSpacing*2 - local statusbgHeight = statusHeight + textSpacing*2 - block.titlebg:SetHeight(titlebgHeight) + local statusHeight = floor(block.status:GetHeight()+.5) + local statusbgHeight = statusHeight + textSpacing*2 + local attachmentHeight =floor(block.attachmentHeight + .5) print(' |cFF0088FFanchor to', handler.currentAnchor:GetName()) + print(' |cFF00FF00attachment:|r', attachmentHeight, '|cFF00FF00title:|r', titlebgHeight, '('.. titleHeight..')') + --block.titlebg:SetHeight(block.title:GetHeight() + Module.Conf.Wrapper.TitleSpacing) + block.height = titlebgHeight + attachmentHeight - print(' |cFF00FF00total sizes:') - print(' attachment:', attachmentHeight) - print(' title:', titlebgHeight, '('.. titleHeight..')') - --block.titlebg:SetHeight(block.title:GetHeight() + T.Conf.Wrapper.TitleSpacing) - block.height = titlebgHeight + attachmentHeight if statusHeight > 1 then block.height = block.height + statusbgHeight print(' status:', statusbgHeight, '('.. statusHeight..')') @@ -408,7 +501,7 @@ if info.specialItem and not info.itemButton then print(' - |cFF00FFFFgenerating item button for info set') - info.itemButton = T.SetItemButton(block, info) + info.itemButton = Module.SetItemButton(block, info) else --info.itemButton = nil end @@ -437,9 +530,9 @@ --block.highlight:SetPoint('TOPLEFT', block, 'TOPLEFT', 0, 1) --block.lowlight:SetPoint('BOTTOMLEFT', block, 'BOTTOMLEFT', 0, 1) - tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative) - tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative) - tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative) + 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) return block end @@ -453,6 +546,9 @@ local print = lprint local info = block.info print(' |cFF00FF00default objectives routine', block:GetName()) + block.endPoint = block.titlebg + block.attachmentHeight = 0 + block.currentLine = 0 -- reset the starting positions block.attachmentHeight = 0 @@ -463,97 +559,47 @@ --- 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. - local lineIndex = 1 - local line = T.GetLine(handler, block, lineIndex) - block.numLines = 0 block.attachmentHeight = 0 + local text, attachment if info.description and #info.description >= 1 then print(' |cFF00FFFF header line:|r', info.description) - line.status:SetText(info.description) - line.height = floor(line.status:GetStringHeight()+.5) + textSpacing - if line.widget then - line.widget:Hide() - end - T.AddLine(block, line) - - lineIndex = lineIndex + 1 - line = T.GetLine(handler, block, lineIndex) + text = info.description + handler:AddLine(block, text, nil) end if (info.isComplete or info.numObjectives == 0) and info.completionText then print(' overriding line #1 for completion text:', info.completionText) - line.status:SetText(info.completionText) - line.height = floor(line.status:GetStringHeight()+.5) + textSpacing - if line.widget then - line.widget:Hide() - end - T.AddLine(block, line) + text = info.completionText + Module.AddLine(block, text, nil) else if info.objectives then for i, data in ipairs(info.objectives) do - print(' |cFF88FF00#', i, data.type, data.text) + local line = handler:GetLine(block) displayObjectiveHeader = true line.height = 0 - handler:UpdateLine(block, line, data) + text, attachment = handler:UpdateLine(block, line, data) + print(' |cFF88FF00#', i, data.type, text) + handler:AddLine(block, text, attachment) - -- For progressbar and timer lines, status text may be used as the title heading - if line.widget then - local widgetPosition = 0 - --- WIDGET POSITION ------------------------------------------------- - line.widget:SetPoint('TOP', line, 'TOP', 0, -widgetPosition) - line.widget:Show() - line.height = line.widget:GetHeight() + textSpacing - --------------------------------------------------------------------- - if line.displayText and #line.displayText >= 1 then - widgetPosition = line.status:GetHeight() + textSpacing - line.status:SetText(line.displayText) - line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + line.widget.height - print(' - progressbar has text, adjust') - end - elseif line.displayText then - line.status:SetText(line.displayText) - line.height = floor(line.status:GetStringHeight()+.5) - end - - T.AddLine(block, line) - - --print(' sz', line:GetWidth(), line:GetHeight(), 'pt', line:GetPoint(1)) - --print(' |cFF44BBFF#', i, 'anchoring line, size:', line.height, 'current endpoint:', line.statusbg) - - lineIndex = lineIndex + 1 - line = T.GetLine(handler, block, lineIndex) end end end - while (block.lines[lineIndex+1]) do - print(' - hide |cFFFF0088'..lineIndex..'|r') - block.lines[lineIndex]:Hide() - lineIndex = lineIndex +1 + for i = block.currentLine + 1, block.numLines do + print(i, block.numLines) + print(' - hide |cFFFF0088'..i..'|r', block.lines[i]) + block.lines[i]:ClearAllPoints() + block.lines[i]:Hide() end - - - if lineIndex > 0 then + if block.currentLine > 0 then block.attachmentHeight = block.attachmentHeight + textSpacing * 2 print(' |cFF00FF00attachment:', block.attachmentHeight) end - --[[ - local lines = handler.lines[block.index] - if lines and #lines > block.numLines then - print(' |cFFFF008' .. (#lines - block.numLines) .. ' extra lines to hide.') - for i = block.numLines + 1, #lines do - print(' hide', i, lines[i]:GetName()) - lines[i]:Hide() - end - end - ]] - - if debug then for i, region in ipairs(block.debug) do for j = 1, region:GetNumPoints() do @@ -585,14 +631,14 @@ else line.progress = 0 end - return line + return line.displayText, line.widget end ---------- --- Top level methods --- Queue any active item buttons for update for that frame local iprint = B.print('ItemButton') -T.UpdateActionButtons = function(updateReason) +Module.UpdateActionButtons = function(updateReason) local print = iprint Scroller.snap_upper = 0 Scroller.snap_lower = 0 @@ -603,10 +649,10 @@ local previousItem for questID, itemButton in pairs(Quest.itemButtons) do - local info= T.Quest.Info[questID] + local info= Module.Quest.Info[questID] print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName()) - local block = T.Quest.QuestBlock[questID] + local block = Module.Quest.QuestBlock[questID] if block then -- Dispatch the probe if IsQuestWatched(info.questLogIndex) then @@ -615,7 +661,7 @@ block:SetScript('OnUpdate', function() if block:GetBottom() and not InCombatLockdown() then print(' '..block:GetName()..' |cFF00FF00probe hit!') - T.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope + Module.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope block:SetScript('OnUpdate', nil) end @@ -636,13 +682,13 @@ end end -T.UpdateBlockAction = function (block, itemButton) +Module.UpdateBlockAction = function (block, itemButton) local print = iprint print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()') if itemButton.questID ~= block.info.questID then print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID) -- something happened between this and last frame, go back and set new probes - return T.UpdateActionButtons() + return Module.UpdateActionButtons() end local previousItem = itemButton.previousItem @@ -691,18 +737,18 @@ itemButton:Show() end -T.UpdateItemButtonCooldown = function(button) +Module.UpdateItemButtonCooldown = function(button) end Default.Select = function(handler, block) - T:Update(handler.watchReasonModule) + Module:Update(handler.watchReasonModule) end Default.Open = function(handler, block) - T:Update(handler.watchReasonModule) + Module:Update(handler.watchReasonModule) end Default.Remove = function(handler, block) - T:Update(handler.watchReasonModule) + Module:Update(handler.watchReasonModule) end Default.Report = function(handler, block) print('Stats:', handler.numWatched,'items tracked,', handler.numBlocks,'blocks assigned.') @@ -724,7 +770,7 @@ self.initialButton = nil self.modChatLink = nil self.modQuestWatch = nil - T:Update(self.handler.updateReasonModule) + Module:Update(self.handler.updateReasonModule) print('|cFFFF8800'..tostring(self:GetName())..':MouseUp()|r') end Default.OnMouseDown = function(self, button)
--- a/ObjectiveTracker/ObjectiveTracker.lua Wed Apr 13 21:53:24 2016 -0400 +++ b/ObjectiveTracker/ObjectiveTracker.lua Thu Apr 14 17:11:13 2016 -0400 @@ -7,7 +7,6 @@ local pairs, setmetatable, type, tostring, band, format = _G.pairs, _G.setmetatable, _G.type, _G.tostring, bit.band, string.format local ipairs, tinsert, hooksecurefunc = _G.ipairs, _G.tinsert, _G.hooksecurefunc local PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText = PlaySoundFile, IsQuestTask, SortQuestWatches, GetCurrentMapAreaID, GetZoneText, GetMinimapZoneText -local AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS = AddQuestWatch, SetSuperTrackedQuestID, GetNumQuestWatches, AUTO_QUEST_WATCH, MAX_WATCHABLE_QUESTS local QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone = QuestPOIUpdateIcons, GetCVar, IsPlayerInMicroDungeon, WorldMapFrame, GetCVarBool, SetMapToCurrentZone local AddAutoQuestPopUp = AddAutoQuestPopUp local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') @@ -247,6 +246,7 @@ local frame = CreateFrame('Frame', trackerName, _G.VeneerObjectiveScroll, 'VeneerTrackerTemplate') frame.title:SetText(handler.displayName) frame:SetWidth(c.Width) + frame.previousOffset = 0 handler.frame = frame handler.numBlocks = 0 @@ -266,18 +266,23 @@ Event.QUEST_LOG_UPDATE = function() return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + OBJECTIVE_TRACKER_UPDATE_MODULE_BONUS_OBJECTIVE end -Event.QUEST_ACCEPTED = function(questLogIndex, questID) +local GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID = GetNumQuestWatches, AddQuestWatch, SetSuperTrackedQuestID +Event.QUEST_ACCEPTED = function(questLogIndex, questID, added) if ( IsQuestTask(questID) ) then return OBJECTIVE_TRACKER_UPDATE_TASK_ADDED, questID else - if ( AUTO_QUEST_WATCH == "1" and GetNumQuestWatches() < MAX_WATCHABLE_QUESTS ) then + if ( _G.AUTO_QUEST_WATCH == "1" ) then AddQuestWatch(questLogIndex); SetSuperTrackedQuestID(questID); end - return OBJECTIVE_TRACKER_UPDATE_MODULE_QUEST + return OBJECTIVE_TRACKER_UPDATE_QUEST_ADDED, questID, added end end +Event.QUEST_REMOVED = function(questLogIndex, questID) + return OBJECTIVE_TRACKER_UPDATE_QUEST, questID, false +end + Event.QUEST_WATCH_LIST_CHANGED = function(questID, added) if ( added ) then if ( not IsQuestTask(questID) ) then @@ -428,13 +433,15 @@ end end else - Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]]) + --Play([[Interface\Addons\SharedMedia_MyMedia\sound\Heart.ogg]]) reason = Event[event] end else - Play([[Interface\Addons\SharedMedia_MyMedia\sound\Quack.ogg]]) + print('no event handler set for', event) + Play([[Interface\Addons\SharedMedia_MyMedia\sound\IM.ogg]]) end if reason then + print('update reason:', reason, 'args:', arg1, arg2, arg3) T:Update(reason, arg1, arg2, arg3) else print('no reason value returned') @@ -491,7 +498,7 @@ end local c = T.Conf.Wrapper - + Wrapper.previousHeight = 0 Scroller:SetScrollChild(Scroll) Scroller:SetWidth(c.Width) Scroll:SetWidth(c.Width) @@ -504,7 +511,6 @@ local from, target, to, x, y = Wrapper:GetPoint(1) print(from, target:GetName(), to, x,y) - T:Update() -- run once to prime the data structure T.UpdateActionButtons()
--- a/ObjectiveTracker/ObjectiveTracker.xml Wed Apr 13 21:53:24 2016 -0400 +++ b/ObjectiveTracker/ObjectiveTracker.xml Thu Apr 14 17:11:13 2016 -0400 @@ -1,4 +1,6 @@ -<Ui> +<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ +..\FrameXML\UI.xsd"> + <Frame name="VeneerObjectiveWrapper" parent="UIParent" movable="true" frameStrata="LOW"> <TitleRegion> @@ -49,39 +51,9 @@ <Anchor point="BOTTOMRIGHT" /> </Anchors> </Texture> - <!--<Texture desatuated="true" parentKey="LineGlow" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_LineGlow" useAtlasSize="true"> - <Anchors> - <Anchor point="LEFT" relativeKey="$parent.Background" x="-21" y="18"/> - </Anchors> - </Texture> - <Texture parentKey="SoftGlow" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_Glow" useAtlasSize="true"> - <Anchors> - <Anchor point="CENTER" relativeKey="$parent.Background" relativePoint="LEFT" x="49" y="20"/> - </Anchors> - </Texture> - <Texture parentKey="StarBurst" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_StarBurst" useAtlasSize="true"> - <Anchors> - <Anchor point="CENTER" relativeKey="$parent.SoftGlow" x="29"/> - </Anchors> - </Texture> - <Texture parentKey="LineSheen" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_LineBurst"> - <Size x="60" y="15"/> - <Anchors> - <Anchor point="CENTER" relativeKey="$parent.SoftGlow" x="29" y="-13"/> - </Anchors> - </Texture>--> </Layer> <Layer level="OVERLAY"> - <!--<Texture name="$parentTCR" parentKey="outlineClosed" file="Interface\FrameGeneral\UI-Frame"> - <Size x="40" y="30" /> - <Color r="1" g="1" b="1" a="1" /> - <TexCoords top=".0156" bottom=".0265" left=".625" right=".875" /> - <Anchors> - <Anchor point="TOPRIGHT" relativePoint="TOPRIGHT" x="2" y="2" /> - </Anchors> - </Texture>--> - </Layer> </Layers> <Frames> @@ -191,6 +163,35 @@ <!-- Background panels --> <Frame name="VeneerTrackerTemplate" parent="UIParent" virtual="true" hidden="true"> + <Scripts> + <OnHide> + self.headerFade:Stop() + </OnHide> + </Scripts> + <Animations> + <AnimationGroup name="$parentSlideIn" parentKey="SlideIn" ignoreFramerateThrottle="true"> + <Translation parentKey="translation" offsetX="0" offsetY="0" smoothing="OUT" order="1" duration=".25" /> + </AnimationGroup> + <AnimationGroup name="$parentHeaderFade" parentKey="headerFade" setToFinalAlpha="true" ignoreFramerateThrottle="true"> + <Alpha childKey="LineGlow" duration="0.15" order="1" fromAlpha="0" toAlpha="1"/> + <Alpha childKey="LineGlow" startDelay="0.25" duration="0.65" order="1" fromAlpha="1" toAlpha="0"/> + <Scale childKey="LineGlow" duration="0.15" order="1" fromScaleX="0.1" fromScaleY="1.5" toScaleX="2" toScaleY="1.5"> + <Origin point="CENTER"> + <Offset x="-50" y="0"/> + </Origin> + </Scale> + <Translation childKey="LineGlow" duration="0.75" order="1" offsetX="65" offsetY="0"/> + <Alpha childKey="SoftGlow" duration="0.25" order="1" fromAlpha="0" toAlpha="1"/> + <Alpha childKey="SoftGlow" startDelay="0.25" duration="0.5" order="1" fromAlpha="1" toAlpha="0"/> + <Scale childKey="SoftGlow" duration="0.25" order="1" fromScaleX="0.5" fromScaleY="0.5" toScaleX="0.8" toScaleY="0.8"/> + <Alpha childKey="StarBurst" duration="0.25" order="1" fromAlpha="0" toAlpha="1"/> + <Alpha childKey="StarBurst" startDelay="0.25" duration="0.5" order="1" fromAlpha="1" toAlpha="0"/> + <Scale childKey="StarBurst" duration="0.25" order="1" fromScaleX="0.5" fromScaleY="0.5" toScaleX="1" toScaleY="1"/> + <Alpha childKey="LineSheen" startDelay="0.15" duration="0.5" order="1" fromAlpha="0" toAlpha="0.75"/> + <Alpha childKey="LineSheen" startDelay="0.75" duration="0.5" order="1" fromAlpha="0.75" toAlpha="0"/> + <Translation childKey="LineSheen" startDelay="0.15" duration="1.5" order="1" offsetX="280" offsetY="0"/> + </AnimationGroup> + </Animations> <Layers> <Layer level="BACKGROUND"> <Texture name="$parentTitleBackground" parentKey="titlebg"> @@ -205,6 +206,29 @@ </Gradient> </Texture> </Layer> + <Layer level="ARTWORK"> + <Texture parentKey="StarBurst" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_StarBurst" useAtlasSize="true"> + <Anchors> + <Anchor point="LEFT" relativePoint="BOTTOMLEFT" relativeKey="$parent.titlebg"/> + </Anchors> + </Texture> + <Texture parentKey="LineSheen" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_LineBurst"> + <Size x="60" y="15"/> + <Anchors> + <Anchor point="LEFT" relativePoint="BOTTOMLEFT" relativeKey="$parent.titlebg" x="0" y="0"/> + </Anchors> + </Texture> + <Texture parentKey="LineGlow" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_LineGlow" useAtlasSize="true"> + <Anchors> + <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeKey="$parent.titlebg" x="-50" y="18"/> + </Anchors> + </Texture> + <Texture parentKey="SoftGlow" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_Glow" useAtlasSize="true"> + <Anchors> + <Anchor point="CENTER" relativeKey="$parent.titlebg" relativePoint="BOTTOMLEFT" x="20" y="20"/> + </Anchors> + </Texture> + </Layer> <Layer level="OVERLAY"> <FontString name="$parentTitle" inherits="VeneerFontHighlight" text="OBJ" parentKey="title" justifyH="LEFT"> <Anchors> @@ -224,21 +248,47 @@ </FontString> </Layer> </Layers> + </Frame> + + + <Frame name="VeneerTrackerBlock" parent="VeneerObjectiveScroll" virtual="true"> <Animations> - <AnimationGroup parentKey="headerFade" setToFinalAlpha="true"> - <Alpha childKey="titlebg" duration="0.7" fromAlpha="1" toAlpha="0" order="1" /> + <AnimationGroup name="$parentSlideIn" parentKey="SlideIn" ignoreFramerateThrottle="true"> + <Translation parentKey="translation" offsetX="0" offsetY="0" smoothing="OUT" order="1" duration=".25" /> + </AnimationGroup> + <AnimationGroup parentKey="questFadeIn" setToFinalAlpha="true" ignoreFramerateThrottle="true"> + <Alpha duration="0.25" order="1" fromAlpha="0" toAlpha="1"/> + <Scale duration="0.25" order="1" fromScaleX="0.1" fromScaleY="0.1" toScaleX="1" toScaleY="1"> + <Origin point="CENTER"> + <Offset x="-50" y="0"/> + </Origin> + </Scale> + <Translation childKey="LineGlow" duration="0.75" order="1" offsetX="65" offsetY="0"/> + <Alpha childKey="SoftGlow" duration="0.25" order="1" fromAlpha="0" toAlpha="1"/> + <Alpha childKey="SoftGlow" startDelay="0.25" duration="0.5" order="1" fromAlpha="1" toAlpha="0"/> + <Scale childKey="SoftGlow" duration="0.25" order="1" fromScaleX="0.5" fromScaleY="0.5" toScaleX="0.8" toScaleY="0.8"/> + <Alpha childKey="StarBurst" duration="0.25" order="1" fromAlpha="0" toAlpha="1"/> + <Alpha childKey="StarBurst" startDelay="0.25" duration="0.5" order="1" fromAlpha="1" toAlpha="0"/> + <Scale childKey="StarBurst" duration="0.25" order="1" fromScaleX="0.5" fromScaleY="0.5" toScaleX="1" toScaleY="1"/> + <Alpha childKey="LineSheen" startDelay="0.15" duration="0.5" order="1" fromAlpha="0" toAlpha="0.75"/> + <Alpha childKey="LineSheen" startDelay="0.75" duration="0.5" order="1" fromAlpha="0.75" toAlpha="0"/> + <Translation childKey="LineSheen" startDelay="0.15" duration="1.5" order="1" offsetX="280" offsetY="0"/> + <Scripts> + <OnPlay> + self.animating = true + </OnPlay> + <OnFinished> + self.animating = nil + </OnFinished> + </Scripts> </AnimationGroup> </Animations> - </Frame> - - - <Frame name="VeneerTrackerBlock" parent="VeneerObjectiveScroll" virtual="true"> <Layers> <Layer level="BACKGROUND"> <Texture name="$parentTitleBackground" parentKey="titlebg"> <Color r="1" g="1" b="1" a="1" /> <Anchors> - <Anchor point="LEFTTOP" x="0" y="0" /> + <Anchor point="TOPLEFT" x="0" y="0" /> <Anchor point="RIGHT" /> </Anchors> </Texture> @@ -257,6 +307,28 @@ </Texture> </Layer> <Layer level="ARTWORK"> + <Texture parentKey="StarBurst" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_StarBurst" useAtlasSize="true"> + <Anchors> + <Anchor point="LEFT" relativePoint="BOTTOMLEFT" relativeKey="$parent.titlebg"/> + </Anchors> + </Texture> + <Texture parentKey="LineSheen" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_LineBurst"> + <Size x="60" y="15"/> + <Anchors> + <Anchor point="LEFT" relativePoint="BOTTOMLEFT" relativeKey="$parent.titlebg" x="0" y="0"/> + </Anchors> + </Texture> + <Texture parentKey="LineGlow" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_LineGlow" useAtlasSize="true"> + <Anchors> + <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeKey="$parent.titlebg" x="-50" y="18"/> + </Anchors> + </Texture> + <Texture parentKey="SoftGlow" hidden="false" alpha="0" alphaMode="ADD" atlas="OBJFX_Glow" useAtlasSize="true"> + <Anchors> + <Anchor point="CENTER" relativeKey="$parent.titlebg" relativePoint="BOTTOMLEFT" x="20" y="20"/> + </Anchors> + </Texture> + <Texture name="$parentItemTile" parentKey="icon" alphaMode="BLEND" hidden="true"> <Anchors> <Anchor point="TOPRIGHT" x="0" y="0" /> @@ -487,13 +559,13 @@ <Include file="Widgets.xml" /> <Script file="ObjectiveTracker.lua" /> - <Script file="Frame.lua" /> <Script file="Quests.lua" /> <Script file="Achievements.lua" /> <Script file="AutoQuestPopups.lua" /> <Script file="BonusObjectives.lua" /> <Script file="ScenarioObjectives.lua" /> <Script file="ExerienceBar.lua" /> + <Script file="Frame.lua" /> <Script file="Events.lua" /> <Script file="Widgets.lua" /> <!-- <Script file="ObjectiveStyle.lua" /> -->
--- a/ObjectiveTracker/Quests.lua Wed Apr 13 21:53:24 2016 -0400 +++ b/ObjectiveTracker/Quests.lua Thu Apr 14 17:11:13 2016 -0400 @@ -1,7 +1,13 @@ local B = select(2,...).frame local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band -local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText +local GetQuestWatchInfo, GetQuestLogCompletionText = GetQuestWatchInfo, GetQuestLogCompletionText +local GetQuestLogLeaderBoard, GetNumQuestLogEntries, GetQuestLogTitle = GetQuestLogLeaderBoard, GetNumQuestLogEntries, GetQuestLogTitle +local GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown = GetQuestLogSpecialItemInfo, GetQuestLogSpecialItemCooldown +local GetSuperTrackedQuestID, GetMoney, C_Scenario, GetCVarBool, GetNumQuestWatches = GetSuperTrackedQuestID, GetMoney, C_Scenario, GetCVarBool, GetNumQuestWatches +local GetQuestTagInfo, GetMoneyString, GetDistanceSqToQuest, GetQuestFactionGroup = GetQuestTagInfo, GetMoneyString, GetDistanceSqToQuest, GetQuestFactionGroup +local QUEST_TAG_ACCOUNT, LE_QUEST_FACTION_HORDE, LE_QUEST_FREQUENCY_DAILY, LE_QUEST_FREQUENCY_WEEKLY = QUEST_TAG_ACCOUNT, LE_QUEST_FACTION_HORDE, LE_QUEST_FREQUENCY_DAILY, LE_QUEST_FREQUENCY_WEEKLY +local QUEST_TAG_TCOORDS, IsQuestSequenced = QUEST_TAG_TCOORDS, IsQuestSequenced local Default, Quest = T.DefaultHandler, T.Quest local format = format local print = B.print('Tracker') @@ -10,6 +16,7 @@ local colors = T.colors local tprint = B.print('Tracker') +local superTrackQuestID, playerMoney, inScenario, showPOIs Quest.Update = function(self, reason, ...) local print = tprint print('QuestTracker:Update() received') @@ -91,50 +98,255 @@ line.status:SetTextColor(r, g, b, a) line.displayText = data.text - return line + return data.text, nil end ----------------------------- --- QUEST -Quest.POI = {} Quest.QuestBlock = {} Quest.LogBlock = {} Quest.LogInfo = {} function Quest:GetNumWatched () print(self.name, self) + superTrackQuestID = GetSuperTrackedQuestID() + playerMoney = GetMoney(); + inScenario = C_Scenario.IsInScenario(); + showPOIs = GetCVarBool("questPOI"); self.numAll = GetNumQuestLogEntries() self.numWatched = GetNumQuestWatches() return self.numWatched, self.numAll end + +--- Returns an iterable table from which tracker blocks can be filled out. Data includes: +-- All entry-layer GetXInfo return values +-- Manifest of line data to be displayed in relation to the tracked object Quest.GetInfo = function (self, watchIndex) local print = iprint - print('|cFF00DDFFQuest|r.|cFF0088FFGetInfo(|r'.. tostring(watchIndex)..'|r)') - local questID, title, questIndex, numObjectives, requiredMoney, _, - _, isAutoComplete, failureTime, timeElapsed, questType, _, _, _, _ = GetQuestWatchInfo(watchIndex) + print('') + print('|cFF00DDFFindex: |r'.. tostring(watchIndex)) - if not questIndex then + local questID, title, questLogIndex, numObjectives, requiredMoney, isComplete, startEvent, isAutoComplete, + failureTime, timeElapsed, questType, isTask, isStory, isOnMap, hasLocalPOI = GetQuestWatchInfo(watchIndex) + if ( not questID ) then return end + local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questLogIndex) - local _, level, suggestedGroup, isHeader, isCollapsed, isComplete, frequency, _, startEvent, displayQuestID, isOnMap, hasLocalPOI, isTask, isStory = GetQuestLogTitle(questIndex) - - - if not questID then - return - end Quest.Info[questID] = Quest.Info[questID] or {} + local showQuest = true + if isTask then + showQuest = false + end + local q = Quest.Info[questID] + -- re-use Blizzard logic for consistency + local watchMoney = false; + local tagID, typeTag, frequencyTag, completionTag, completionText + local isAccount, isFaction, isWeekly, isDaily = false, false, false, false + local isBreadcrumb = false + local questFailed = false + local watchMoney = false + local timerInfo, moneyInfo = false, false + local objectives = q.objectives or {} + + + -- Case 1: completed quest or "go to thing" breadcrumb + -- * 1 line containing the completion text + if ( isComplete and isComplete < 0 ) then + isComplete = false + questFailed = true + elseif ( numObjectives == 0 and playerMoney >= requiredMoney and not startEvent ) then + isComplete = true; + questFailed = false + if ( requiredMoney == 0 ) then + isBreadcrumb = true; + end + end + print('|cFF0088FFflags:|r', (isComplete and 'isComplete' or ''), (questFailed and 'questFailed' or ''), (isBreadcrumb and 'isBreadcrumb' or '')) + + -- completion message? + local isSequenced = IsQuestSequenced(questID) + local temp_status = '' + if ( isComplete ) then + temp_status = 'COMPLETED_OBJECTIVES' + objectives = Quest.GetObjectives(questLogIndex, numObjectives, true, isSequenced, isStory) + if ( isAutoComplete ) then + temp_status = 'AUTOCOMPLETE_OBJECTIVES' + completionText = _G.QUEST_WATCH_CLICK_TO_COMPLETE + else + if ( isBreadcrumb ) then + temp_status = 'COMPLETE_BREADCRUMB' + completionText = GetQuestLogCompletionText(questLogIndex) + else + temp_status = 'COMPLETE_READY_FOR_TURN_IN' + completionText = _G.QUEST_WATCH_QUEST_READY + end + end + elseif ( questFailed ) then + temp_status = 'FAILED' + -- Case 2: failed quest + -- * 1 status line; hide other info + completionText = _G.FAILED + else + + temp_status = 'PROGRESS_OBJECTIVES' + -- Case 3: quest in progress + -- * Multiple objective lines + -- * Possible extra lines for money and timer data respectively + objectives = Quest.GetObjectives(questLogIndex, numObjectives, false, isSequenced, isStory) + q.objectives = objectives + + --- anything past here gets appended to existing objectives + + -- money + if ( requiredMoney > playerMoney ) then + + temp_status = temp_status .. '_MONEY' + local text = GetMoneyString(playerMoney).." / "..GetMoneyString(requiredMoney); + moneyInfo = { + type = 'money', + text = text, + finished = false, + requiredMoney = requiredMoney, + playerMoney = playerMoney, + } + end + + -- time limit + if ( failureTime ) then + temp_status = temp_status .. '_TIMED' + if ( timeElapsed and timeElapsed <= failureTime ) then + timerInfo = { + type = 'timer', + finished = false, + timeElapsed = timeElapsed, + failureTime = failureTime, + } + end + end + end + q.numObjectives = numObjectives + q.objectives = objectives + q.moneyInfo = moneyInfo + q.timerInfo = timerInfo + q.completionText = completionText + + -- POI data + local POI = false + if ( showPOIs ) then + POI = { + questID = questID, + questLogIndex = questLogIndex, + } + local poiButton; + if ( hasLocalPOI ) then + + if ( isComplete ) then + POI.type = 'normal' + else + POI.type = 'numeric' + end + elseif ( isComplete ) then + POI.type = 'remote' + end + + local distance, onContinent = GetDistanceSqToQuest(questLogIndex) + if distance ~= nil and distance > 0 then + POI.distance = distance + POI.onContinent = onContinent + end + end + q.POI = POI + + --- Block Tags + -- completionTag - in progres, complete, failed, autocomplete + -- typeTag - account, faction, pvp, dungeon, group + -- frequencyTag - daily/weekly + local questTagID, tagName = GetQuestTagInfo(questID) + local tagInfo = {} + local tagCoords = {} + local factionGroup = GetQuestFactionGroup(questID); + if( questTagID and questTagID == QUEST_TAG_ACCOUNT ) then + if( factionGroup ) then + tagID = "ALLIANCE" + if ( factionGroup == LE_QUEST_FACTION_HORDE ) then + tagID = "HORDE" + end + isFaction = true + else + tagID = QUEST_TAG_ACCOUNT + isAccount = true + end + tagInfo['typeTag'] = tagID + tagCoords['typeTag'] = QUEST_TAG_TCOORDS[tagID] + elseif ( factionGroup) then + tagID = "ALLIANCE" + if ( factionGroup == LE_QUEST_FACTION_HORDE ) then + tagID = "HORDE" + end + isFaction = true + tagInfo['typeTag'] = tagID + tagCoords['typeTag'] = QUEST_TAG_TCOORDS[tagID] + end + + if( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) then + tagID = 'DAILY' + tagInfo['frequencyTag'] = tagID + tagCoords['frequencyTag'] = QUEST_TAG_TCOORDS[tagID] + isDaily = true + elseif( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) )then + tagID = 'WEEKLY' + tagInfo['frequencyTag'] = tagID + tagCoords['frequencyTag'] = QUEST_TAG_TCOORDS[tagID] + isWeekly = true + elseif( questTagID ) then + tagID = questTagID + end + + if( isComplete ) then + tagInfo['completionTag'] = 'COMPLETED' + elseif ( questFailed ) then + tagInfo['completionTag'] = 'FAILED' + end + tagCoords['completionTag'] = QUEST_TAG_TCOORDS[tagInfo['completionTag']] + + q.tagInfo = tagInfo + q.tagCoords = tagCoords + -- establishes the primary block tag for view compacting + q.tagID = tagID + q.tagName = tagName + + -- action button information + local link, icon, charges = GetQuestLogSpecialItemInfo(questLogIndex) + local start, duration, enable = GetQuestLogSpecialItemCooldown(questLogIndex) + if link or icon or charges then + q.specialItem = { + questID = questID, + questLogIndex = questLogIndex, + link = link, + charges = charges, + icon = icon, + start = start, + duration = duration, + enable = enable, + } + end + + -- resolved data + + -- raw data q.watchIndex = watchIndex q.type = 'Quest' + q.id = questID q.questID = questID q.title = title q.level = level q.displayQuestID = displayQuestID q.suggestedGroup = suggestedGroup - q.questLogIndex = questIndex + q.questLogIndex = questLogIndex q.numObjectives = numObjectives q.requiredMoney = requiredMoney q.isComplete = isComplete @@ -152,155 +364,53 @@ q.isStory = isStory q.isTask = isTask - --- resolve icon type and template - local questTagID, tagName = GetQuestTagInfo(questID) - local tagID + q.selected = (questID == superTrackQuestID) -- call directly so artifact data doesn't become an issue + self.WatchInfo[watchIndex] = q + self.LogInfo[questLogIndex] = q - local factionGroup = GetQuestFactionGroup(questID); - if( questTagID and questTagID == QUEST_TAG_ACCOUNT ) then - if( factionGroup ) then - tagID = "ALLIANCE"; - if ( factionGroup == LE_QUEST_FACTION_HORDE ) then - tagID = "HORDE"; + if Devian and Devian.InWorkspace() then + print('|cFF00DDFFstatus:|r', temp_status, '|cFF00FF00questLogIndex|r:', title) + local temp ={} + local data_txt = '|cFFFF4400values:|r' + for k,v in pairs(q) do + if type(v) =='number' then + data_txt = data_txt .. ' |cFFFFFF00'..k..'|r: ' .. tostring(v) + elseif type(v) == 'table' then + tinsert(temp, k) end - q.isFaction = true - else - tagID = QUEST_TAG_ACCOUNT; - q.isAccount = true end - q.typeTag = QUEST_TAG_TCOORDS[tagID] - elseif ( factionGroup) then - tagID = "ALLIANCE"; - if ( factionGroup == LE_QUEST_FACTION_HORDE ) then - tagID = "HORDE"; + print(data_txt) + sort(temp, function(a,b) return a < b end) + for i, k in ipairs(temp) do + print('|cFF00FF00'..k..'|r') + for kk,v in pairs(q[k]) do + print(' ', kk, '=', v) + end end - q.isFaction = true end - if( frequency == LE_QUEST_FREQUENCY_DAILY and (not isComplete or isComplete == 0) ) then - tagID = "DAILY"; - q.frequencyTag = QUEST_TAG_TCOORDS["DAILY"] - q.isDaily = true - elseif( frequency == LE_QUEST_FREQUENCY_WEEKLY and (not isComplete or isComplete == 0) )then - tagID = "WEEKLY"; - q.frequencyTag = QUEST_TAG_TCOORDS["WEEKLY"] - q.isWeekly = true - elseif( questTagID ) then - tagID = questTagID; - end + return q +end - if ( isComplete and isComplete < 0 ) then - q.completionTag = QUEST_TAG_TCOORDS["FAILED"] - q.isFailed = true - elseif isComplete then - q.completionTag = QUEST_TAG_TCOORDS["COMPLETED"] - end - - - q.tagID = questTagID - q.tagName = tagName - --q.isBreadCrumb = isBreadCrumb - q.completionText= GetQuestLogCompletionText(questIndex) - q.numObjectives = GetNumQuestLeaderBoards(questIndex) - q.objectives = {} - for i = 1, q.numObjectives do - local text, type, finished = GetQuestLogLeaderBoard(i, questIndex) +Quest.GetObjectives = function(questLogIndex, numObjectives, isComplete, isSequenced, isStory) + local objectives = {} + for i = 1, numObjectives do + local text, type, finished = GetQuestLogLeaderBoard(i, questLogIndex) print(format(' #%d %s %s %s', i, tostring(type), tostring(text), tostring(finished))) - q.objectives[i] = { + objectives[i] = { index = i, type = type, text = text, finished = finished } - if type == 'event' then - elseif type == 'monster' then - elseif type == 'object' then - elseif type == 'reputation' then - elseif type == 'item' then - end end - - if requiredMoney >= 1 then - local money = GetMoney() - local moneyText = money - local requiredSilver, requiredCopper - local requiredGold = (requiredMoney > 10000) and (floor(requiredMoney/10000)) or nil - if mod(requiredMoney, 10000) ~= 0 then - requiredSilver = (requiredMoney > 100) and (mod(requiredMoney, 10000) / 100) or nil - if mod(requiredMoney, 100) ~= 0 then - requiredCopper = mod(requiredMoney, 100) - end - end - - -- round the money value down - if requiredMoney > 9999 and not (requiredSilver or requiredCopper) then - moneyText = floor(money/10000) - elseif requiredMoney < 10000 and mod(requiredMoney,100) == 0 then - moneyText = floor(money/100) - end - - local text = moneyText - local index = #q.objectives + 1 - local finished = (GetMoney() >= requiredMoney) - - if not finished then - text = text .. ' / ' .. GetCoinTextureString(requiredMoney, 12) - else - text = '' .. GetCoinTextureString(requiredMoney, 12) - end - q.objectives[index] = { - index = index, - type = 'progressbar', - quantity = money, - requiredQuantity = requiredMoney, - text = text, - finished = finished - } - print(format(' #%d %s %s %s', index, 'money', text, tostring(finished))) - end - - - local link, icon, charges = GetQuestLogSpecialItemInfo(questIndex) - local start, duration, enable = GetQuestLogSpecialItemCooldown(questIndex) - if link or icon or charges then - q.specialItem = { - questID = questID, - questIndex = questIndex, - link = link, - charges = charges, - icon = icon, - start = start, - duration = duration, - enable = enable, - } - end - - if QuestHasPOIInfo(questID) then - local distance, onContinent = GetDistanceSqToQuest(questIndex) - if distance ~= nil and distance > 0 then - self.POI[questIndex] = { - questIndex = questIndex, - questID = questID, - distance = distance, - onContinent = onContinent - } - end - end - - - q.selected = (questID == GetSuperTrackedQuestID()) -- call directly so artifact data doesn't become an issue - self.WatchInfo[watchIndex] = q - self.LogInfo[questIndex] = q - print('- logIndex =', questIndex, 'title =', title) - for k,v in pairs(q) do - print('|cFFFFFF00'..k..'|r:', v) - end - return q + return objectives end +local huge, sqrt = math.huge, math.sqrt Quest.GetClosest = function() local minID, minTitle - local minDist = math.huge + local minDist = huge local numQuests = GetNumQuestLogEntries() for questIndex = 1, numQuests do local distance, onContinent = GetDistanceSqToQuest(questIndex) @@ -312,7 +422,7 @@ end end - print('nearest quest is', minTitle, 'by', math.sqrt(minDist)) + print('nearest quest is', minTitle, 'by', sqrt(minDist)) return minID, minTitle, minDist end
--- a/ObjectiveTracker/Scenarios.lua Wed Apr 13 21:53:24 2016 -0400 +++ b/ObjectiveTracker/Scenarios.lua Thu Apr 14 17:11:13 2016 -0400 @@ -3,4 +3,11 @@ -- @project-revision@ @project-hash@ -- @file-revision@ @file-hash@ -- Created: 4/13/2016 8:17 PM +local B = select(2,...).frame +local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') +local Scenario = Module.Scenario + +Scenario.GetNumWatched = function() +end +