comparison ObjectiveFrame.lua @ 5:e9b61fd5f607

- use IsQuestWatched as the determinant for setting action button updates - check for block match-up in deferred action button updates
author Nenue
date Thu, 31 Mar 2016 15:58:08 -0400
parents 18eee961038e
children 589de8ea05b9
comparison
equal deleted inserted replaced
4:18eee961038e 5:e9b61fd5f607
354 --print(t:GetName(), t:GetSize()) 354 --print(t:GetName(), t:GetSize())
355 --print(t:GetPoint(1)) 355 --print(t:GetPoint(1))
356 356
357 t.info = info 357 t.info = info
358 358
359 if info.questID then handler.QuestBlock[info.questID] = t end
359 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = t end 360 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = t end
360 if info.watchIndex then handler.WatchBlock[info.watchIndex] = t end 361 if info.watchIndex then handler.WatchBlock[info.watchIndex] = t end
361 362
362 info.blockIndex = blockIndex 363 info.blockIndex = blockIndex
363 handler.BlockInfo[blockIndex] = info 364 handler.BlockInfo[blockIndex] = info
405 style = 'Complete' 406 style = 'Complete'
406 elseif info.superTracked then 407 elseif info.superTracked then
407 style = 'Super' 408 style = 'Super'
408 end 409 end
409 410
410 if info.specialItem then 411 if info.specialItem and not info.itemButton then
411 print(' - |cFF00FFFFupdate item button') 412 print(' - |cFF00FFFFgenerating item button for info set')
412 info.itemButton = mod.SetItemButton(t, info) 413 info.itemButton = mod.SetItemButton(t, info)
413 else 414 else
414 --info.itemButton = nil 415 --info.itemButton = nil
415 end 416 end
416 417
611 --- Queue any active item buttons for update for that frame 612 --- Queue any active item buttons for update for that frame
612 mod.UpdateActionButtons = function() 613 mod.UpdateActionButtons = function()
613 local previousItem 614 local previousItem
614 for questID, itemButton in pairs(usedButtons) do 615 for questID, itemButton in pairs(usedButtons) do
615 local questIndex = mod.Quest.Info[questID].questLogIndex 616 local questIndex = mod.Quest.Info[questID].questLogIndex
616 print('|cFF00FFFF', questID, itemButton:GetName()) 617 print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName())
617 local block = mod.Quest.LogBlock[questIndex] 618 local block = mod.Quest.QuestBlock[questID]
618 if block then 619 if block then
619 print(block:GetTop()) 620 -- Dispatch the probe
620 if IsQuestWatched(questIndex) then 621 if IsQuestWatched(questIndex) then
621 -- Dispatch the probe 622
623 print(' |cFFFFFF00probing', block:GetName())
622 block:SetScript('OnUpdate', function() 624 block:SetScript('OnUpdate', function()
623 print('|cFFFFFF00probing', block:GetName()) 625 if block:GetBottom() and not InCombatLockdown() then
624 if block:GetBottom() and not InCombatLockdown() then 626 print(' '..block:GetName()..' |cFF00FF00probe hit!')
625 print('|cFF00FF00ding ding ding!') 627 mod.UpdateBlockAction(block, itemButton, previousItem)
626 mod.UpdateBlockAction(block, itemButton, previousItem) 628 block:SetScript('OnUpdate', nil)
627 block:SetScript('OnUpdate', nil) 629 end
628 end 630 end)
629 end)
630 return
631 else 631 else
632 mod.FreeItemButtons(block) 632 print('hidden block or unwatched quest')
633 itemButton:Hide()
633 end 634 end
635 else
636 print(' |cFFFF0088missing block data', itemButton:GetName())
634 end 637 end
635 end 638 end
636 end 639 end
637 640
638 mod.UpdateBlockAction = function (block, itemButton, previousItem) 641 mod.UpdateBlockAction = function (block, itemButton, previousItem)
639 if block.itemButton ~= itemButton then 642 print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()')
640 block.itemButton = itemButton 643 if itemButton.questID ~= block.info.questID then
641 end 644 print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID)
642 if itemButton.block ~= block then 645
643 itemButton.block = block 646 return mod.UpdateActionButtons()
644 end 647 end
645 648
646 if block:GetBottom() < Scroller:GetBottom() then 649 if block:GetBottom() < Scroller:GetBottom() then
647 print('|cFFFFFF00bottom not fully visible') 650 print('** ',block:GetName() ,'|cFFFFFF00bottom not fully visible')
648 if previousItem then 651 if previousItem then
649 previousItem:ClearAllPoints() 652 previousItem:ClearAllPoints()
650 previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, 4) 653 previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, 4)
651 end 654 end
652 itemButton:ClearAllPoints() 655 itemButton:ClearAllPoints()
653 itemButton:SetPoint('BOTTOMRIGHT', UIParent, 'BOTTOMLEFT', Wrapper:GetLeft(), Wrapper:GetBottom()) 656 itemButton:SetPoint('BOTTOMRIGHT', UIParent, 'BOTTOMLEFT', Wrapper:GetLeft(), Wrapper:GetBottom())
654 itemButton:Show() 657 itemButton:Show()
655 else 658 else
656 print('|cFF00FF00visible positions') 659 print('** ',block:GetName() ,'|cFF00FF00visible positions')
657 itemButton:ClearAllPoints() 660 itemButton:ClearAllPoints()
658 itemButton:SetPoint('TOPRIGHT', UIParent, 'BOTTOMLEFT', block:GetLeft(), block:GetTop()) 661 itemButton:SetPoint('TOPRIGHT', UIParent, 'BOTTOMLEFT', block:GetLeft(), block:GetTop())
659 itemButton:Show() 662 itemButton:Show()
660 end 663 end
661 end 664 end