Mercurial > wow > buffalo2
diff ObjectiveTracker/Widgets.lua @ 35:69d03f8e293e
- separated layout and data logic between Frame.lua and Update.lua
- solved disappearing tracker mystery
author | Nenue |
---|---|
date | Sun, 17 Apr 2016 11:07:48 -0400 |
parents | 9856ebc63fa4 |
children | e84d645c8ab8 |
line wrap: on
line diff
--- a/ObjectiveTracker/Widgets.lua Sun Apr 17 00:21:45 2016 -0400 +++ b/ObjectiveTracker/Widgets.lua Sun Apr 17 11:07:48 2016 -0400 @@ -444,4 +444,53 @@ end T.UpdateWidget.Hidden = function (self) self.height= 0 +end + + +--- Queue any active item buttons for update for that frame +local iprint = B.print('ItemButton') +local Quest = T.Quest +local IsQuestWatched, InCombatLockdown = IsQuestWatched, InCombatLockdown +T.UpdateActionButtons = function(updateReason) + local print = iprint + Scroller.snap_upper = 0 + Scroller.snap_lower = 0 + local print = B.print('ItemButton') + if updateReason then + print = B.print('IB_'..updateReason) + end + + local previousItem + for questID, itemButton in pairs(Quest.itemButtons) do + local info= T.Quest.Info[questID] + + print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName()) + local block = T.Quest.QuestBlock[questID] + if block then + -- Dispatch the probe + if IsQuestWatched(info.logIndex) then + itemButton.previousItem = previousItem + print(' |cFFFFFF00probing', block:GetName()) + 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 + block:SetScript('OnUpdate', nil) + + end + end) + previousItem = itemButton + else + print('hidden block or unwatched quest') + itemButton.previousItem = nil + itemButton:Hide() + end + elseif itemButton:IsVisible() then + print(' |cFFFF0088hiding unwatched quest button', itemButton:GetName()) + itemButton.previousItem = nil + itemButton:Hide() + else + print(' |cFFBBBBBBignoring hidden log quest button', itemButton:GetName()) + end + end end \ No newline at end of file