# HG changeset patch # User Nenue # Date 1459448920 14400 # Node ID 18eee961038e22f040314b9dfd5b46d69e1566ee # Parent 3397aae1f44d9da197064aed9f81786778eebd2d - more action button debug diff -r 3397aae1f44d -r 18eee961038e ObjectiveFrame.lua --- a/ObjectiveFrame.lua Thu Mar 31 07:32:05 2016 -0400 +++ b/ObjectiveFrame.lua Thu Mar 31 14:28:40 2016 -0400 @@ -387,52 +387,12 @@ -- * height of whatever display widget is involved in conveying the task -- * number of non-wrapped text lines to account for line space; may be discarded depending on things -- * boolean that determines listening for money events or not - t.attachmentHeight = 0 - for o, obj in ipairs(t.info.objectives) do - --- achievement criteria - if obj.flags then + t.attachmentHeight, text = mod.UpdateObjectives(t, info, text) - if bit.band(obj.flags, 0x00000001) > 0 then - obj.type = 'ProgressBar' - obj.widget = mod.SetWidget(obj, info) - elseif bit.band(obj.flags, 0x00000002) then - obj.type = 'Hidden' - obj.widget = nil - else - obj.type = 'Text' - obj.widget = nil - text = text .. ((text == '') and "" or "\n") .. obj.text - end - - print(obj.type, obj.text, obj.quantityString) - --- none of the above (most quests) - else - local line = obj.text - if obj.type == 'monster' then - line = '|cFFFFFF00' .. line .. '|r' - elseif obj.type == 'item' then - line = '|cFF44BBFF' .. line .. '|r' - elseif obj.type == 'object' then - line = '|cFFFFFFFF' .. line .. '|r' - end - text = text .. ((text == '') and "" or "\n") .. line - end - - if obj.widget then - t.attachmentHeight = t.attachmentHeight + obj.widget.height - end - - end t.objectives:SetText(text) t.objectives:SetWordWrap(true) - -- todo: set up a SecureActionButton template - if info.specialItem and not info.itemButton then - print(' - |cFF00FFFFupdate item button') - mod.SetItemButton(t, info) - end - elseif info.description then t.objectives:SetText(info.description) @@ -447,6 +407,13 @@ style = 'Super' end + if info.specialItem then + print(' - |cFF00FFFFupdate item button') + info.itemButton = mod.SetItemButton(t, info) + else + --info.itemButton = nil + end + --- metrics are calculated in SetStyle t:SetStyle(style) t:Show() @@ -455,6 +422,50 @@ return t end +mod.UpdateObjectives = function(block, info, text) + local attachmentHeight = 0 + for o, obj in ipairs(info.objectives) do + --- achievement criteria + if obj.flags then + + + if bit.band(obj.flags, 0x00000001) > 0 then + obj.type = 'ProgressBar' + obj.widget = mod.SetWidget(obj, info) + elseif bit.band(obj.flags, 0x00000002) then + obj.type = 'Hidden' + obj.widget = nil + else + obj.type = 'Text' + obj.widget = nil + text = text .. ((text == '') and "" or "\n") .. obj.text + end + + print(obj.type, obj.text, obj.quantityString) + --- none of the above (most quests) + else + local line = obj.text + local color = '00FFFF' + if obj.finished then + color = 'FFFFFF' + elseif obj.type == 'monster' then + color = 'FFFF00' + elseif obj.type == 'item' then + color = '44DDFF' + elseif obj.type == 'object' then + color = 'FF44DD' + end + text = text .. ((text == '') and "" or "\n") .. '|cFF'..color.. line .. '|r' + end + + if obj.widget then + attachmentHeight = attachmentHeight + obj.widget.height + end + + end + return attachmentHeight, text +end + mod.UpdateTracker = function(handler) print('|cFF00FF88UpdateTracker(|r|cFFFF4400' .. type(handler) .. '|r :: |cFF88FFFF' .. tostring(handler) .. '|r') local tracker = handler.Tracker @@ -603,14 +614,14 @@ for questID, itemButton in pairs(usedButtons) do local questIndex = mod.Quest.Info[questID].questLogIndex print('|cFF00FFFF', questID, itemButton:GetName()) - local block = mod.Quest.LogBlock[questID] - print(block:GetTop()) + local block = mod.Quest.LogBlock[questIndex] if block then + print(block:GetTop()) if IsQuestWatched(questIndex) then -- Dispatch the probe block:SetScript('OnUpdate', function() print('|cFFFFFF00probing', block:GetName()) - if block:GetBottom() then + if block:GetBottom() and not InCombatLockdown() then print('|cFF00FF00ding ding ding!') mod.UpdateBlockAction(block, itemButton, previousItem) block:SetScript('OnUpdate', nil)