# HG changeset patch
# User Nenue
# Date 1491822809 14400
# Node ID 78d78dc7782253731e6461c3621adc20ca253874
# Parent 2ba11b25aa7f40d9d18086edb4bffcc08ce47c80
update conditional tweaks
diff -r 2ba11b25aa7f -r 78d78dc77822 QuestPOI.lua
--- a/QuestPOI.lua Sat Apr 08 17:07:58 2017 -0400
+++ b/QuestPOI.lua Mon Apr 10 07:13:29 2017 -0400
@@ -45,8 +45,8 @@
local previousHighlight
local DATA_DEBUG = false
-local PIN_REFRESH_DELAY = .5
-local PIN_REQUEST_DELAY = .1
+local PIN_REFRESH_DELAY = 1
+local PIN_REQUEST_DELAY = .2
local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
@@ -338,21 +338,21 @@
-- attempt to pull pin data
function QuestPOI:GetData ()
- dprint('|cFF00FF88'..self:GetID()..':GetData()|r')
+ --dprint('|cFF00FF88'..self:GetID()..':GetData()|r')
local questID = self.questID
if not questID then
- dprint('|cFFFF4400bad pin|r', self:GetName())
+ --dprint('|cFFFF4400bad pin|r', self:GetName())
return nil
end
local questTitle, factionID, capped = TQ_GetQuestInfoByQuestID(questID)
-- if the title is nil, then wait and try later
if not questTitle then
- dprint('|cFFBB8844dataLoaded|r = false|cFF00FFFF', self.questId)
+ --dprint('|cFFBB8844dataLoaded|r = false|cFF00FFFF', self.questId)
return false
else
self.title, self.factionID, self.capped = questTitle, factionID, capped
- dprint(questTitle, factionID, capped)
+ print(questTitle, factionID, capped)
-- set tag details
local worldQuestType
self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.tradeskillLineIndex = GetQuestTagInfo(questID);
@@ -366,7 +366,7 @@
local id = self.tradeskillLineIndex and select(7, GetProfessionInfo(self.tradeskillLineIndex))
if id then
self.isKnownProfession = true
- qprint('profession' , self.title, id)
+ --qprint('profession' , self.title, id)
tagAtlas = WORLD_QUEST_ICONS_BY_PROFESSION[id]
end
elseif worldQuestType == LE_QUEST_TAG_TYPE_DUNGEON then
@@ -376,7 +376,7 @@
self.tagAtlas = tagAtlas
local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality, xpType, xpName, xpIcon, xpCount = self:UpdateRewards()
- dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality)
+ --dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality)
if dataLoaded then
self.rewardType = rewardType
self.itemName = itemName
@@ -426,7 +426,7 @@
rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01"
rewardCount = artifactXP
rewardType = REWARD_ARTIFACT_POWER
- qprint(' artifactXP', artifactXP)
+ --dprint(' artifactXP', artifactXP)
foundPrimary = true
end
@@ -441,7 +441,7 @@
text = text
})
- qprint(' currency', i, currencyID, name, " |T"..tostring(texture)..":12:12|t")
+ --dprint(' currency', i, currencyID, name, " |T"..tostring(texture)..":12:12|t")
if currencyID == ID_RESOURCES then
rewardIcon = texture
rewardCount = numItems
@@ -494,7 +494,7 @@
local ap = text and text:gsub(',', ''):gsub(' million', '000000'):match('(%d+) '..ARTIFACT_POWER)
if ap then
rewardCount = tonumber(ap)
- print(ap)
+ --dprint(ap)
end
end
@@ -503,7 +503,7 @@
local text = WorldPlanTooltipTextLeft2:GetText()
end
- print('is an AP token')
+ --dprint('is an AP token')
elseif classID == LE_ITEM_CLASS_TRADEGOODS then
rewardType = REWARD_REAGENT
rewardIcon = texture
@@ -513,7 +513,7 @@
end
- qprint(' reward', i, name, " |T"..tostring(texture)..":12:12|t", quality, isUsable, itemID)
+ --dprint(' reward', i, name, " |T"..tostring(texture)..":12:12|t", quality, isUsable, itemID)
tinsert(rewardItems, {
name = name,
texture = texture,
@@ -522,7 +522,7 @@
isUsable = isUsable
})
if not foundPrimary then
- print(' -updating primary')
+ --print(' -updating primary')
rewardType = REWARD_GEAR
rewardIcon = texture
@@ -535,8 +535,8 @@
end
end
- qprint(' '..self.questID..':|cFFFFFF00SetRewardInfo():', numQuestRewards, rewardType)
- qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
+ --dprint(' '..self.questID..':|cFFFFFF00UpdateRewards():', numQuestRewards, rewardType)
+ --dprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
if (self.itemNumber ~= rewardCount) or (self.rewardType ~= rewardType) or (self.itemName ~= rewardName) or (self.itemTexture ~= rewardIcon) then
if DATA_DEBUG and (self.debugTimer <= 0) then
@@ -571,25 +571,33 @@
-- run from OnShow if .isNew is set
-function QuestPOI:StartFade()
- if not self.isAnimating then
- qprint('|cFFFFFF00clearing new status')
+function QuestPOI:OnAnimStart()
+ --qprint('|cFFFFFF00OnAnimStart(|r'..self:GetID()..'|cFFFFFF00)|r', self.fadeEvent)
+ self.isAnimating = true
+ self.isNew = nil
+end
+
+function QuestPOI:TryToFade(event)
+ if self.FadeIn:IsPlaying() then
+ --qprint('|cFFFF4400TryToFade('..self:GetID()..'|cFFFF4400)|r stopping because already in progress')
+ return
+ end
+
+ self.fadeEvent = event
+ if self.dataLoaded then
+ --qprint('|cFFFFFF00TryToFade('..self:GetID()..'|cFFFFFF00)|r', event)
self:SetAlpha(0)
- if self.dataLoaded then
- self:Refresh('POI_ISNEW')
- self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha)
- self.PendingFade.FadeIn:SetToAlpha(db.PinAlpha)
- self.PendingFade.FadeOut:SetFromAlpha(db.PinAlpha)
+ self:Refresh(event)
+ self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha)
+ self.isStale = true
+ self.FadeIn:Play()
+ else
- self.isAnimating = true
- self.isNew = nil
- self.isStale = true
- self.FadeIn:Play()
- end
+ --qprint('|cFFFF4400TryToFade('..self:GetID()..'|cFFFF4400)|r stopping because not loaded')
end
end
-function QuestPOI:EndFade()
+function QuestPOI:OnAnimStop()
self.isAnimating = nil
self:SetAlpha(db.PinAlpha)
end
@@ -597,15 +605,15 @@
function QuestPOI:OnShow ()
if self.isNew then
- self:StartFade()
+ self:TryToFade('POI_ONSHOW_NEW')
else
if not self.isAnimating then
- print('|cFF00FF00Alpha correction')
+ --print('|cFF00FF00Alpha correction')
self:SetAlpha(db.PinAlpha) -- fix stuck alpha
end
if self.isStale then
- print('|cFF00FF00refresh on show')
- self:Refresh('POI_SCRIPT')
+ --print('|cFF00FF00refresh on show')
+ self:Refresh('POI_ONSHOW_STALE')
end
end
self:ShowFrames()
@@ -625,13 +633,14 @@
-- Applies position and sizing parameters to the pin data
function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor)
- dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used)
+ --dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used)
if not self.used then
self.hideReason = 'SetAnchor() on an unused frame.'
self:HideFrames()
return
end
+
if owner then
self:SetParent(owner)
self.Overlay:SetParent(owner)
@@ -640,9 +649,6 @@
owner = self:GetParent()
end
- self:SetFrameLevel(pinBaseIndex + self:GetID())
- self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID())
-
if scaleFactor then
--print('scaleFactor')
@@ -672,7 +678,7 @@
-- Show/Hide the text overlays associated with the quest pin; they aren't hierarchically linked
function QuestPOI:ShowFrames()
if not self:IsShown() then
- print('|cFFFFFF00' ..self:GetName()..':ShowFrames()')
+ -- print('|cFFFFFF00' ..self:GetName()..':ShowFrames()')
-- do not SetShown() here
end
self.Overlay:SetShown(true)
@@ -685,8 +691,6 @@
if not self.hideReason then
self.hideReason = "HideFrames() called"
end
- --print(self:GetName()..':HideFrames()')
- self:SetShown(false)
end
self.Overlay:SetShown(false)
self.count:SetShown(false)
@@ -695,7 +699,7 @@
end
function QuestPOI:OnLoad()
- qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
+ --qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',db.Config)
self.debugTimer = 4
self.title = '|cFF0088FF' .. RETRIEVING_DATA..'|r'
self.isPending = true
@@ -717,7 +721,7 @@
end
end
-
+local updateTime, markTime
function QuestPOI:OnUpdate (sinceLast)
-- control update check intervals
@@ -734,6 +738,7 @@
self.debugTimer = self.debugTimer - sinceLast
if self.debugTimer >= 0 then
print(self.debugTimer)
+ return
end
end
--@end-debug@
@@ -741,13 +746,16 @@
-- query for reward data if it wasn't found in the original scan
if not self.dataLoaded then
- print('|cFFFF4400'..self:GetID()..':|r polling reward info')
local dataLoaded = self:GetData()
if dataLoaded and not tContains(db.UpdatedPins, self) then
- self.PendingFade:Stop()
+ -- self.PendingFade:Stop()
-- scale info from the parent module is needed, so deal with it there
+ --print('|cFF00FF88 queueing for update')
tinsert(db.UpdatedPins, self)
+ else
+
+ --print('|cFFFF4400OnUpdate(|r'..self:GetID()..'|cFFFF4400)|r poll failed')
end
return
end
@@ -761,35 +769,26 @@
function QuestPOI:GetCriteriaState()
local isCriteria, isBounty, isSpellTarget
if self.factionID then
-
- local bounties = db.BountiesByFactionID
- if bounties then
- for factionID, bounty in pairs(bounties) do
-
- if IsQuestCriteriaForBounty(self.questID, bounty.questID) then
- isCriteria = true
- if db.selectedBounty == bounty then
- isBounty = true
- end
- print('|cFF00FF88Criteria:|r', self.questID, bounty.questID, isCriteria, isBounty)
+ for index, bounty in pairs(db.Bounties) do
+ if IsQuestCriteriaForBounty(self.questID, bounty.questID) then
+ isCriteria = true
+ if db.selectedBounty == bounty then
+ isBounty = true
end
+ --dprint('|cFF00FF88Criteria:|r', self.questID, bounty.questID, isCriteria, isBounty)
end
-
-
- print('|cFFFF4400Criteria:|r', self.questID, self.isCriteria, self.isBounty)
-
end
end
isSpellTarget = IsQuestIDValidSpellTarget(self.questID)
if (self.isBounty ~= isBounty) or (self.isCriteria ~= isCriteria) or (self.isSpellTarget ~= isSpellTarget) then
-
+ --wqprint('|cFF00FF00criteria state changed')
self.isBounty = isBounty
self.isCriteria = isCriteria
self.isSpellTarget = isSpellTarget
+ self.isStale = true
return true
end
-
end
-- Called at static intervals and with Refresh
@@ -828,7 +827,7 @@
function QuestPOI:Refresh (event)
- print('|cFF00FF88'..self:GetID()..'|r:Refresh()', event)
+ print('|cFF00FF88Refresh(|r'..self:GetID()..'|cFF00FF88)|r', event, self.title)
local style = DEFAULT_STYLE
if self.dataLoaded and not self.filtered then
@@ -942,11 +941,11 @@
self.isStale = nil
if self.isBounty then
- print('is bounty')
+ --print('is bounty')
iconBorder:SetVertexColor(trackingBorder:GetVertexColor())
trackingBorder:SetVertexColor(unpack(BORDER_SELECTED_BOUNTY))
elseif self.isCriteria then
- print('is criteria of a bounty')
+ --print('is criteria of a bounty')
iconBorder:SetVertexColor(trackingBorder:GetVertexColor())
trackingBorder:SetVertexColor(unpack(BORDER_CRITERIA))
else
diff -r 2ba11b25aa7f -r 78d78dc77822 WorldPlan.lua
--- a/WorldPlan.lua Sat Apr 08 17:07:58 2017 -0400
+++ b/WorldPlan.lua Mon Apr 10 07:13:29 2017 -0400
@@ -32,6 +32,8 @@
db.UsedPins = {}
db.UpdatedPins = {}
db.ReportChunks = {}
+db.Bounties = {}
+db.BountiesByQuestID = {}
db.BountiesByFactionID = {}
-- default color templates
@@ -356,7 +358,12 @@
end
end
local isMapOpen = WorldMapFrame:IsShown()
- local isNewMap = isMapOpen and ((mapAreaID ~= db.currentMapID) or (isMapOpen ~= db.isMapOpen) or (db.isMicroDungeon ~= isMicroDungeon))
+ if not isMapOpen then
+ return
+ end
+
+ local isNewMap = (mapAreaID ~= db.currentMapID) or (isMapOpen ~= db.isMapOpen) or (db.isMicroDungeon ~= isMicroDungeon)
+
db.isMicroDungeon = isMicroDungeon
db.isMapOpen = isMapOpen
@@ -367,6 +374,9 @@
for _, module in ipairs(db.OrderedModules) do
if module.OnMapInfo then
+ if module.Debug then
+ module:Debug(event)
+ end
print(' |cFF00FFFF'..module:GetName() .. ':OnMapInfo()|r')
module:OnMapInfo(isBrokenIsle, isContinent, mapAreaID, isNewMap, isMapOpen)
end
@@ -386,7 +396,7 @@
print('|cFFFF4400currentMapID =', db.currentMapID, ...)
- self:SetCurrentMap(event)
+ self:SetCurrentMap(event .. ' ' .. GetTime())
end
end
end
@@ -639,7 +649,7 @@
for i, module in ipairs(db.OrderedModules) do
if module.Refresh then
print('|cFF00FF00external '..module:GetName()..':Refresh()|r')
- module:Refresh(forced)
+ module:Refresh('WORLDPLAN_REFRESH')
end
end
diff -r 2ba11b25aa7f -r 78d78dc77822 WorldPlan.xml
--- a/WorldPlan.xml Sat Apr 08 17:07:58 2017 -0400
+++ b/WorldPlan.xml Mon Apr 10 07:13:29 2017 -0400
@@ -41,11 +41,14 @@
+
+ self:GetParent():OnAnimStart()
+
- self:GetParent():EndFade()
+ self:GetParent():OnAnimStop()
- self:GetParent():EndFade()
+ self:GetParent():OnAnimStop()
diff -r 2ba11b25aa7f -r 78d78dc77822 WorldQuests.lua
--- a/WorldQuests.lua Sat Apr 08 17:07:58 2017 -0400
+++ b/WorldQuests.lua Mon Apr 10 07:13:29 2017 -0400
@@ -3,11 +3,11 @@
-- Created: 11/2/2016 3:40 PM
-- %file-revision%
-local print = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end
-local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or function() end
-local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
-local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
-local mprint = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or function() end
+local print = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or nop
+local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or nop
+local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop
+local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or nop
+local mprint = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or nop
local _, db = ...
local Module = WorldPlanQuestsMixin
@@ -17,6 +17,7 @@
local TQ_GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID -- This function is not yet documented
local TQ_GetQuestZoneID = C_TaskQuest.GetQuestZoneID
local TQ_IsActive = C_TaskQuest.IsActive
+local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData
local pairs, ipairs, tinsert, tremove, wipe = pairs, ipairs, tinsert, tremove, table.wipe
local GetTaskInfo, GetTasksTable, HaveQuestData = GetTaskInfo, GetTasksTable, HaveQuestData
local GetTime = GetTime
@@ -44,6 +45,8 @@
local BountyBoard = WorldMapFrame.UIElementsFrame.BountyBoard
local ActionButton = WorldMapFrame.UIElementsFrame.ActionButton
+local pinBaseIndex = 1500
+local overlayBaseIndex = 1580
local layoutDirty = true
local bountiesDirty = true
local currentScale = WorldMapDetailFrame:GetScale()
@@ -64,30 +67,18 @@
end)
end
-function Module:OnUpdate(sinceLast)
-
- if self.filtersDirty or self.isStale then
- self:Refresh()
- end
- if #db.UpdatedPins >= 1 then
- print('|cFF00FF88pending updates', #db.UpdatedPins)
- self:RefreshIfQueued()
- end
-
-end
-
function Module:Setup()
- print('|cFFFF4400'..self:GetName()..':Setup()')
+ --print('|cFFFF4400'..self:GetName()..':Setup()')
for mapID, mapName in pairs(WORLD_QUEST_MAPS) do
db.QuestsByZone[mapID] = {}
end
for target, arg in pairs(callbacks) do
- print(type(target))
+ --print(type(target))
if type(target) == 'table' then
local callerName = target:GetName() or tostring(target)
for name, method in pairs(arg) do
- print(callerName, arg)
+ --print(callerName, arg)
hooksecurefunc(target, name, function(...)
self:OnSecureHook(callerName .. '.' .. name, method, ...)
end)
@@ -100,8 +91,8 @@
end
self.Status = CreateFrame('Frame', nil, self)
- self.Status:SetPoint('TOPLEFT', WorldMapPOIFrame, 'TOPLEFT', 0, 0)
- self.Status:SetPoint('BOTTOMRIGHT', WorldMapPOIFrame, 'TOPRIGHT', 0, -4)
+ self.Status:SetPoint('TOPLEFT', WorldMapFrame.UIElementsFrame, 'TOPLEFT', 0, 0)
+ self.Status:SetPoint('BOTTOMRIGHT', WorldMapFrame.UIElementsFrame, 'TOPRIGHT', 0, -4)
self.Status.t = self.Status:CreateTexture(nil, 'OVERLAY')
self.Status.b = self.Status:CreateTexture(nil, 'BACKGROUND')
self.Status.b:SetColorTexture(0,0,0,.25)
@@ -114,15 +105,15 @@
self.Status:SetScript('OnUpdate', function(status)
local translateTo
if numLoaded < numShown then
- translateTo = numLoaded/numShown * status:GetWidth()
+ translateTo = (numLoaded/numShown) * status:GetWidth()
status.t:SetWidth(translateTo)
else
- translateTo = numShown * status:GetWidth()
+ translateTo = status:GetWidth()
status.t:SetWidth(translateTo)
end
end)
- self:SetAllPoints(WorldMapPOIFrame)
+ self:SetAllPoints(WorldMapFrame.UIElementsFrame)
for k,v in pairs( ToggleButton) do
self.Toggle:SetScript(k,v)
end
@@ -138,10 +129,10 @@
WorldQuests:UpdateTaskPOIs()
end
callbacks.WorldMapFrame_UpdateMap = function(WorldQuests)
- WorldQuests:RefreshIfChanged()
+ WorldQuests:RefreshIfChanged('WMF_UPDATE')
end
callbacks.WorldMapScrollFrame_ReanchorQuestPOIs = function (WorldQuests)
- WorldQuests:RefreshIfChanged()
+ WorldQuests:RefreshIfChanged('WMF_REANCHOR')
end
callbacks[BountyBoard] = {}
@@ -156,7 +147,7 @@
end
function Module:OnConfigUpdate()
- print('|cFFFFFF00OnConfigUpdate()|r')
+ --print('|cFFFFFF00OnConfigUpdate()|r')
if db.Config.FadeWhileGrouped then
db.PinAlpha = 0.15
else
@@ -179,29 +170,17 @@
button:Show()
end
-db.UsedPOIs = {}
-function Module:UpdateTaskPOIs()
- canTargetQuests = SpellCanTargetQuest()
- local func = canTargetQuests and 'Show' or 'Hide'
- for i = 1, NUM_WORLDMAP_TASK_POIS do
- local button = _G['WorldMapFrameTaskPOI'..i]
- if button and button.worldQuest then
- button[func](button)
- end
- end
-end
-
function Module:OnSecureHook(callbackName, func, ...)
- rprint('|cFFFF4400'..callbackName..'|r', ...)
+ --rprint('|cFFFF4400'..callbackName..'|r', ...)
func(self, ...)
end
local defaults = {}
local REWARD_UNKNOWN = 768
function Module:OnLoad()
- print('|cFFFF4400'..self:GetName()..':OnLoad()')
+ --print('|cFFFF4400'..self:GetName()..':OnLoad()')
- self:SetParent(WorldMapPOIFrame)
+ self:SetParent(WorldMapFrame.UIElementsFrame)
WorldPlan:AddHandler(self, defaults)
for areaID, fileName in pairs(WORLD_QUEST_MAPS) do
@@ -212,7 +191,7 @@
self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL')
self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
self:RegisterEvent('SKILL_LINES_CHANGED')
- self:RegisterEvent('CURRENT_SPELL_CAST_CHANGED')
+ --self:RegisterEvent('CURRENT_SPELL_CAST_CHANGED')
self:RegisterEvent('ARTIFACT_UPDATE')
self:RegisterEvent('QUEST_LOG_UPDATE')
end
@@ -221,15 +200,14 @@
local superTrackedQuestID
function Module:OnEvent (event, ...)
- print('|cFFFFFF00'..self:GetName()..':OnEvent() '..event..'|r', GetTime(), ...)
+ print('|cFFFFFF00OnEvent() '..event..'|r', GetTime(), ...)
if (event == 'QUEST_LOG_UPDATE') then
self:UpdateBounties(event)
- self:RefreshIfChanged(event)
elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then
local questID = ...
- self:UpdateBounties(event)
if questID and db.QuestsByID[questID] then
db.QuestsByID[questID].complete = true
+ self:ReleasePin(db.QuestsByID[questID])
end
self:Refresh(event)
elseif event == 'SKILL_LINES_CHANGED' or event == 'CURRENT_SPELL_CAST_CHANGED' then
@@ -238,7 +216,7 @@
local akCheck = C_ArtifactUI.GetArtifactKnowledgeMultiplier()
if akCheck and (akCheck ~= artifactKnowledgeMultiplier) then
if artifactKnowledgeMultiplier then
- print('push artifact knowledge update', artifactKnowledgeMultiplier, 'to', akCheck)
+ --print('push artifact knowledge update', artifactKnowledgeMultiplier, 'to', akCheck)
for index, pin in pairs( db.QuestsByID) do
if pin.rewardType == REWARD_ARTIFACT_POWER then
db.log(pin.questID .. ' ' .. tostring(pin.title) .. ' Flagged for artifact power.')
@@ -264,52 +242,85 @@
end
+function Module:OnUpdate(sinceLast)
+
+ if self.refreshBenchMarkTicker then
+ --print(self.refreshBenchMarkTicker)
+ self.refreshBenchMarkTicker = self.refreshBenchMarkTicker - 1
+
+ if self.refreshBenchMarkTicker == 0 then
+
+ self.refreshTime = floor((GetTime() - self.refreshBenchMark) * 1000)/1000
+ self.debugMessage:SetText(self.refreshTime)
+ self.refreshBenchMarkTicker = nil
+ end
+ else
+ self.refreshBenchMark = GetTime()
+ end
+
+ if self.filtersDirty or self.isStale then
+ self:Refresh()
+ end
+ if #db.UpdatedPins >= 1 then
+ --print('|cFF00FF88pending update', #db.UpdatedPins)
+ self:UpdateNext()
+ end
+
+end
+
+function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID, isNewMap, isMapOpen)
+ if isNewMap then
+ print('|cFF0088FFOnMapInfo()|r, mapAreaID =', mapAreaID,'visible =', isMapOpen, 'changed =', isNewMap)
+ layoutDirty = true
+ self:Refresh('WORLD_MAP_CHANGED')
+ else
+
+ --print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r, mapAreaID =', mapAreaID,'visible =', isMapOpen, 'changed =', isNewMap)
+ end
+end
+
+
+function Module:UpdateTaskPOIs()
+ canTargetQuests = SpellCanTargetQuest()
+ local func = canTargetQuests and 'Show' or 'Hide'
+ for i = 1, NUM_WORLDMAP_TASK_POIS do
+ local button = _G['WorldMapFrameTaskPOI'..i]
+ if button and button.worldQuest then
+ button[func](button)
+ end
+ end
+end
local bountyQuests = {}
local bountyInfo = {}
+
local bountyDisplayLocation, bountyLockedQuestID, selectedBountyIndex, selectedBountyQuestID
function Module:UpdateBounties(...)
- print('|cFF00FF88BountyInfo()|r', ...)
+ print('|cFF00FF88BountyInfo()|r', ...)
wipe(db.BountiesByFactionID)
- wipe(bountyQuests)
+ wipe(db.BountiesByQuestID)
db.selectedBounty = nil
selectedBountyIndex = BountyBoard:GetSelectedBountyIndex()
- bountyInfo, bountyDisplayLocation, bountyLockedQuestID = GetQuestBountyInfoForMapID(db.currentMapID, bountyInfo)
+ db.Bounties, bountyDisplayLocation, bountyLockedQuestID = GetQuestBountyInfoForMapID(db.currentMapID, db.Bounties)
local numBounties = 0
- for index, info in ipairs(bountyInfo) do
- if info.factionID then
+ for index, info in ipairs(db.Bounties) do
numBounties = numBounties + 1
info.index = index
info.complete = IsQuestComplete(info.questID)
if not info.complete then
db.BountiesByFactionID[info.factionID] = info
+ db.BountiesByQuestID[info.questID] = info
if index == selectedBountyIndex then
db.selectedBounty = info
selectedBountyQuestID = info.questID
end
print(' ', index, info.factionID, GetQuestLogTitle(GetQuestLogIndexByID(info.questID)), info.complete, (index == selectedBountyIndex) and 'SELECTED' or '')
- bountyQuests[info.questID] = info
end
- end
end
bountiesDirty = nil
end
-function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID, isNewMap, isMapOpen)
- if isNewMap then
- print('|cFF00FF88OnMapInfo()|r, mapAreaID =', mapAreaID,'visible =', isMapOpen, 'changed =', isNewMap)
- if isMapOpen then
- self:Refresh(true)
- else
- self.isStale = true
- end
- else
-
- rprint('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r, mapAreaID =', mapAreaID,'visible =', isMapOpen, 'changed =', isNewMap)
- end
-end
-
local totalPins = 0
local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
@@ -336,21 +347,19 @@
--print('|cFF00FF00Creating', name)
pin = CreateFrame('Frame', name, WorldMapPOIFrame, 'WorldPlanQuestPin')
+ pin:SetID(totalPins)
pin:SetFrameStrata('HIGH')
- pin.GetTypeInfo = function(frame, typeID)
- return self:GetTypeInfo(typeID)
- end
- pin:SetID(totalPins)
numOverlays = numOverlays + 1
--pin.iconBorder:SetVertexColor(0,0,0,1)
end
pin.questID = questID
pin.worldQuest = true
- pin.throttle = 1
+ pin.throttle = pin.updateRate
pin.isNew = true
pin.currentWidth = nil
db.QuestsByID[questID] = pin
tinsert(db.UsedPins, pin)
+
end
if pin and info then
@@ -358,12 +367,22 @@
pin.floor = info.floor
pin.numObjectives = info.numObjectives or 0
if info.x and info.y then
- pin.x = info.x or pin.x
- pin.y = info.y or pin.y
- --rprint('|cFFFF4400coords|r', info.x, info.y)
+ if (info.x ~= pin.x) or (info.y ~= pin.y) then
+ pin.isStale = true
+ --rprint('|cFFFF4400SetCoords|r', info.x, info.y)
+ end
+
end
end
+ pin.x = info.x or pin.x
+ pin.y = info.y or pin.y
+
+ if not HaveQuestData(questID) then
+ TQ_RequestPreloadRewardData(questID);
+ end
+
+
if (not pin.dataLoaded) then
local dataLoaded = pin:GetData()
isDataLoaded = (isDataLoaded and dataLoaded)
@@ -372,8 +391,9 @@
pin.isActive = TQ_IsActive(questID)
+ pin:GetCriteriaState()
pin:CheckFilterRules()
- rprint(pin:GetID(), pin.filtered, pin.used)
+ --rprint(pin:GetID(), pin.filtered, pin.used)
return pin
end
@@ -386,7 +406,7 @@
db.QuestsByID[id] = nil
for i, zone in pairs(db.QuestsByZone) do
- print('-', i, zone[i])
+ --print('-', i, zone[i])
zone[id] = nil
end
db.TasksByID[id] = nil
@@ -397,49 +417,53 @@
tinsert(db.FreePins, pin)
WorldPlan.dataFlush = true
- print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
+ --print('|cFF00FF00-'.. (pin.mapID and GetMapNameByID(pin.mapID) or '???') ..'|r', id, pin.title)
end
-- re-anchors and scales pins that have had either of these changed due to data loading delays
-function Module:RefreshIfQueued()
- print('|cFF00FF88RefreshIfQueued()')
+function Module:UpdateNext()
+ --print('|cFF00FF88UpdateNext()')
local pin = tremove(db.UpdatedPins)
- while pin do
pin:CheckFilterRules()
- local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
- print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor)
- if pin.used then
- pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor)
- if pin.isNew then
- pin:OnShow()
- end
- end
+ local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
+ --print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor)
+ if pin.used then
+ pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor)
+ pin:OnShow()
+ end
- pin = tremove(db.UpdatedPins)
- end
end
+function Module:Debug(...)
+ print(...)
+end
local msg = '|cFF00FF88WorldQuests:Refresh()|r|cFF00FFFF'
+local lastRefresh
function Module:Refresh(...)
+ --
- rprint(msg, ...)
if not self:IsVisible() then
- rprint('|cFF00FF88WorldQuests:Refresh()|r', ...)
- self.isStale = true
- return self:MarkAllPins()
+ print('|cFFFF4400Refresh()|r', ...)
+ --layoutDirty = true
+ return
else
- rprint('|cFF00FF88WorldQuests:Refresh()|r', ...)
- print('|cFF00FF88WorldQuests:Refresh()|r', ...)
+ --
+ if lastRefresh == GetTime() then
+ print('|cFFFF4400multiple refreshes tried')
+ end
+ lastRefresh = GetTime()
+ --rprint(msg, ...)
+ print(msg, lastRefresh, ...)
end
if not db.Config.EnablePins then
numShown = 0
return
end
- wprint(' '..msg)
+ --wprint(' '..msg)
scaleConstant = db.isContinentMap and 2 or 3
canTargetQuests = SpellCanTargetQuest()
@@ -449,10 +473,12 @@
end
self:UpdateAnchors()
+--[[
if bountiesDirty then
- print(' bounties dirty, pushing that')
+ --print(' bounties dirty, pushing that')
self:UpdateBounties()
end
+ --]]
-- calculate quests shown
@@ -462,9 +488,11 @@
local oV = pin:IsShown()
if pin.used then
pin.throttle = 1
+ --[[
if oV == false then
- rprint('|cFF00FF00cleanup +|r', questID, pin.title)
+ --rprint('|cFF00FF00cleanup +|r', questID, pin.title)
end
+ --]]
pin:SetShown(true)
numShown = numShown + 1
if pin.dataLoaded then
@@ -472,36 +500,47 @@
end
else
+ --[[
if oV == true then
rprint('|cFFFF4400 -|r', questID, pin.title)
end
+ --]]
pin.hideReason = "Not used in map area " .. (db.currentMapID)
- pin:HideFrames()
+ pin:SetShown(false)
end
end
-
- print(' ', numShown, 'shown,', numLoaded, 'with data')
+ --print('flags ', layoutDirty, self.isStale)
+ --print(' ', numShown, 'shown,', numLoaded, 'with data')
if numShown > numLoaded then
self.Status:Show()
end
+--
+ if layoutDirty or self.isStale then
+
+ self.refreshBenchMark = GetTime()
+ self.refreshBenchMarkTicker = 2
+ print('starting bench', self.refreshBenchMark)
+ end
+--
layoutDirty = nil
self.isStale = nil
self.sizesDirty = nil
self.isZoomDirty = nil
+
end
local refreshReason
-function Module:RefreshIfChanged()
+function Module:RefreshIfChanged(event)
local scaleCheck = WorldMapDetailFrame:GetScale()
refreshReason = nil
if scaleCheck ~= currentScale then
refreshReason = 'map scale updated'
- self:Refresh('WORLD_MAP_SCALE_CHANGED')
currentScale = scaleCheck
+ layoutDirty = true
elseif self.isStale or layoutDirty then
refreshReason = 'layout is marked dirty'
end
@@ -512,70 +551,56 @@
if self:IsVisible() then
print('|cFF00FFFFRefreshIfChanged()|r', refreshReason)
- self:Refresh('WORLDMAP_QUEUED')
+ self:Refresh(event)
else
- rprint('|cFF00FFFFRefreshIfChanged()|r flagging for later refresh', refreshReason)
+ print('|cFF00FFFFRefreshIfChanged()|r', refreshReason)
self.isStale = true
end
end
-- update visibility states of all pins
function Module:MarkAllPins(pins)
- print(' |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins)
+ --print(' |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins)
pins = pins or db.QuestsByID
for questID, pin in pairs(pins) do
pin.isStale = true
- rprint('|cFF00FF00filter', pin.questID, pin.filtered, 'used:', pin.used)
- end
-end
-
-function Module:UpdateQuestButton(info, mapID)
- local questID, x, y = info.questId, info.x, info.y
- local pin = self:AcquirePin(info)
- if not pin then
- return
- end
-
-
- local doUpdate = pin:GetCriteriaState() or pin.isStale
- --print(' |- ', pin.questID, pin.title)
- rprint('|cFF00FF00update|r', pin.questID, pin.title)
-
- print(doUpdate)
-
- if x and y then
- local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
- pin:SetFrameLevel(PinBaseIndex+pin:GetID())
- pin.owningFrame = WorldMapFrame
- pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor)
- doUpdate = true
- --tinsert(self.UsedPositions, pin)
- end
-
- if doUpdate then
- print(' changed', pin.title, pin.isCriteria, pin.isBounty, pin.scaleFactor)
- if pin:IsVisible() then
- --numUpdated = numUpdated + 1
- pin:Refresh('WORLDMAP_REFRESH')
- else
- --numHidden = numHidden + 1
- pin.isStale = true
- end
- end
-
- if mapID then
- if not db.QuestsByZone[mapID] then
- db.QuestsByZone[mapID] = {}
- end
- db.QuestsByZone[mapID][questID] = pin
+ --rprint('|cFF00FF00filter', pin.questID, pin.filtered, 'used:', pin.used)
end
end
-- Updates quest markers in taskInfo while associating them with the given map
function Module:UpdateQuestsForMap(taskInfo, mapID)
- rprint('Map', GetMapNameByID(mapID), GetMapNameByID(db.currentMapID))
+ if mapID then
+ db.QuestsByZone[mapID] = db.QuestsByZone[mapID] or {}
+ wipe(db.QuestsByZone[mapID])
+ end
+ print('UpdateQuestsForMap()', GetMapNameByID(mapID), GetMapNameByID(db.currentMapID), layoutDirty)
for index, info in pairs(taskInfo) do
- self:UpdateQuestButton(info, mapID)
+
+ local questID, x, y = info.questId, info.x, info.y
+ local pin = self:AcquirePin(info)
+ if pin then
+ print(pin.title, pin.isStale)
+ if pin:IsShown() and (layoutDirty or pin.isStale) then
+ local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
+ pin.owningFrame = WorldMapFrame
+ pin:SetFrameLevel(PinBaseIndex+pin:GetID())
+ pin.Overlay:SetFrameLevel(overlayBaseIndex+pin:GetID())
+ pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor)
+ if pin.isStale then
+ pin:Refresh('WORLDMAP_REFRESH ' .. GetTime())
+ end
+ if mapID then
+ db.QuestsByZone[mapID][questID] = pin
+ end
+ else
+ if layoutDirty then
+ pin.isStale = true
+ end
+ end
+
+
+ end
end
end
@@ -591,7 +616,7 @@
end
- rprint('|cFF00FF00'..self:GetName()..':UpdateAnchors()')
+ --rprint('|cFF00FF00'..self:GetName()..':UpdateAnchors()')
local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
if isMicroDungeon then
return
@@ -618,7 +643,7 @@
self:SetChecked(db.Config.EnablePins and true or false)
end
function ToggleButton:OnClick()
- print(self:GetChecked())
+ --print(self:GetChecked())
db.Config.EnablePins = self:GetChecked()
_G.WorldPlan:OnConfigUpdate()
end
\ No newline at end of file
diff -r 2ba11b25aa7f -r 78d78dc77822 WorldQuests.xml
--- a/WorldQuests.xml Sat Apr 08 17:07:58 2017 -0400
+++ b/WorldQuests.xml Mon Apr 10 07:13:29 2017 -0400
@@ -11,6 +11,17 @@
+
+
+
+
+
+
+
+
+
+
+