# HG changeset patch
# User Nenue
# Date 1491406566 14400
# Node ID 31de7e9e78498712bc9b30a6383b9c1284f24dc8
# Parent cce68795f9550178c6a30e459cc2958640dca174
stop hiding pins when the timeleft returns 0; use C_TQ.IsActive
diff -r cce68795f955 -r 31de7e9e7849 FilterBar.lua
--- a/FilterBar.lua Sun Apr 02 13:51:24 2017 -0400
+++ b/FilterBar.lua Wed Apr 05 11:36:06 2017 -0400
@@ -78,12 +78,13 @@
self:ClearAllPoints()
self:SetPoint('TOPRIGHT')
WorldPlan:AddHandler(self)
- for index, info in ipairs(db.DefaultFilters) do
+ --[[for index, info in ipairs(db.DefaultFilters) do
info.zone = db.DefaultFilterType
info.continent = db.DefaultFilterType
info.pinMask = "Interface\\Minimap\\UI-Minimap-Background"
WorldPlan:AddTypeInfo(self,index, info)
end
+ --]]
end
@@ -165,7 +166,6 @@
end
function Module:Reset()
- self.pinLayout = self:GetTypeInfo(255)
self:GetFilters()
end
diff -r cce68795f955 -r 31de7e9e7849 QuestPOI.lua
--- a/QuestPOI.lua Sun Apr 02 13:51:24 2017 -0400
+++ b/QuestPOI.lua Wed Apr 05 11:36:06 2017 -0400
@@ -59,7 +59,14 @@
local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT
local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES
local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS
-local REWARD_HONOR = WORLD_QUEST_REWARD_TYPE_FLAG_HONOR
+
+local REWARD_TYPE_NAMES = {
+ [REWARD_CASH] = 'Money',
+ [REWARD_ARTIFACT_POWER] = 'AP',
+ [REWARD_GEAR] = 'Equipment',
+ [REWARD_CURRENCY] = 'Currency',
+ [REWARD_REAGENT] = 'Trade Goods'
+}
local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP
local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE
@@ -75,6 +82,7 @@
local DEFAULT_STYLE = {
border = {1,1,1},
+ textColor = {1,1,1,1},
x = 0, y = 0,
desaturated = true,
iconMask = "Interface\\Minimap\\UI-Minimap-Background",
@@ -103,7 +111,9 @@
hideNumber = true,
},
- [REWARD_CURRENCY] = {},
+ [REWARD_CURRENCY] = {
+ textColor = {1,1,0,.5}
+ },
[REWARD_REAGENT] = {
hideNumber = true,
@@ -365,7 +375,7 @@
self.worldQuestType = worldQuestType
self.tagAtlas = tagAtlas
- local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality = self:UpdateRewards()
+ local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality, xpType, xpName, xpIcon, xpCount = self:UpdateRewards()
dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality)
if dataLoaded then
self.rewardType = rewardType
@@ -375,6 +385,8 @@
self.itemQuality = quality
self.dataLoaded = true
self.isStale = true
+ self.xpType, self.xpName, self.xpIcon, self.xpCount = xpType, xpName, xpIcon, xpCount
+
end
end
@@ -382,6 +394,9 @@
return self.dataLoaded
end
+local ID_RESOURCES = 1220
+local ID_LEGIONFALL = 1342
+
--- Returns true if data has changed (either from loading in or qualifications changed)
function QuestPOI:UpdateRewards()
local questID = self.questID
@@ -393,6 +408,7 @@
local rewardItems, rewardCurrency = {}, {}
local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality
local xpIcon, xpName, xpCount, xpType
+ local foundPrimary
if (GetNumQuestLogRewardCurrencies(questID) > 0 or GetNumQuestLogRewards(questID) > 0 or GetQuestLogRewardMoney(questID) > 0 or GetQuestLogRewardArtifactXP(questID) > 0 or GetQuestLogRewardHonor(questID)) then
local money = GetQuestLogRewardMoney(questID)
@@ -411,11 +427,12 @@
rewardCount = artifactXP
rewardType = REWARD_ARTIFACT_POWER
qprint(' artifactXP', artifactXP)
+ foundPrimary = true
end
local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID);
for i = 1, numQuestCurrencies do
- local name, texture, numItems = GetQuestLogRewardCurrencyInfo(i, questID);
+ local name, texture, numItems, currencyID = GetQuestLogRewardCurrencyInfo(i, questID);
local text = BONUS_OBJECTIVE_REWARD_WITH_COUNT_FORMAT:format(texture, numItems, name);
tinsert(rewardCurrency, {
name = name,
@@ -423,11 +440,21 @@
numItems = numItems,
text = text
})
- qprint(' currency', i, name, " |T"..tostring(texture)..":12:12|t")
- rewardIcon = texture
- rewardCount = numItems
- rewardName = name
- rewardType = REWARD_CURRENCY
+
+ qprint(' currency', i, currencyID, name, " |T"..tostring(texture)..":12:12|t")
+ if currencyID == ID_RESOURCES then
+ rewardIcon = texture
+ rewardCount = numItems
+ rewardName = name
+ rewardType = REWARD_CURRENCY
+ foundPrimary = true
+ elseif currencyID == ID_LEGIONFALL then
+ xpIcon = texture
+ xpCount = numItems
+ xpName = name
+ xpType = REWARD_CURRENCY
+ end
+
end
local honorAmount = GetQuestLogRewardHonor(questID);
if honorAmount > 0 then
@@ -439,7 +466,6 @@
local numQuestRewards = GetNumQuestLogRewards(questID);
if numQuestRewards > 0 then
- local foundPrimary
for i = 1, numQuestRewards do
local name, texture, numItems, quality, isUsable, itemID = GetQuestLogRewardInfo(i, questID)
@@ -496,6 +522,7 @@
isUsable = isUsable
})
if not foundPrimary then
+ print(' -updating primary')
rewardType = REWARD_GEAR
rewardIcon = texture
@@ -516,7 +543,7 @@
return false
end
- return true, rewardType, rewardName, rewardIcon, rewardCount, quality
+ return true, rewardType, rewardName, rewardIcon, rewardCount, quality, xpType, xpName, xpIcon, xpCount
else
return false
@@ -546,16 +573,19 @@
function QuestPOI:StartFade()
if not self.isAnimating then
- --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.')
+ qprint('|cFFFFFF00clearing new status')
self:SetAlpha(0)
+ if self.dataLoaded then
+ self:Refresh()
self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha)
self.PendingFade.FadeIn:SetToAlpha(db.PinAlpha)
self.PendingFade.FadeOut:SetFromAlpha(db.PinAlpha)
- self.isAnimating = true
- self.isNew = nil
- self.isStale = true
- self.FadeIn:Play()
+ self.isAnimating = true
+ self.isNew = nil
+ self.isStale = true
+ self.FadeIn:Play()
+ end
end
end
@@ -566,20 +596,18 @@
function QuestPOI:OnShow ()
- if self.isStale then
- qprint('|cFF0088FFflagged for refresh')
- self:Refresh()
+ if self.isNew then
+ self:StartFade()
+ else
+ if not self.isAnimating then
+ print('|cFF00FF00Alpha correction')
+ self:SetAlpha(db.PinAlpha) -- fix stuck alpha
+ end
+ if self.isStale then
+ print('|cFF00FF00refresh on show')
+ self:Refresh()
+ end
end
-
- if self.isNew then
- qprint('|cFFFFFF00popping new pin handler')
- self:StartFade()
- end
-
- if not self.isAnimating then
- self:SetAlpha(db.PinAlpha) -- fix stuck alpha
- end
-
self:ShowFrames()
end
@@ -589,12 +617,17 @@
-- reset flags
self:SetAlpha(db.PinAlpha)
self.isAnimating = nil
+ if db.Config.DebugEnabled then
+ db.log(tostring(self.questID) .. ' ' .. tostring(self.title) .. "\n" .. tostring(REWARD_TYPE_NAMES[self.rewardType]) .. ' ' .. tostring(self.itemName) .. ' ' .. tostring(self.itemNumber) .. "\n|cFFFF4400" .. (self.hideReason or 'NO_MESSAGE') .. "|r\n|cFF00FFFF" .. debugstack(2,3,0) .. '|r')
+ end
+ self.hideReason = nil
end
-- 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)
if not self.used then
+ self.hideReason = 'SetAnchor() on an unused frame.'
self:HideFrames()
return
end
@@ -616,7 +649,7 @@
local scaleChanged
if scaleFactor and (self.scaleFactor ~= scaleFactor) then
- print('scaleFactor')
+ --print('scaleFactor')
self:SetScale(scaleFactor)
self.Overlay:SetScale(scaleFactor)
self.scaleFactor = scaleFactor
@@ -645,8 +678,6 @@
print('|cFFFFFF00' ..self:GetName()..':ShowFrames()')
-- do not SetShown() here
end
-
- self.count:SetShown(true)
self.Overlay:SetShown(true)
self.count:SetShown(true)
self.timeLabel:SetShown(true)
@@ -654,10 +685,12 @@
function QuestPOI:HideFrames()
if self:IsShown() then
- print(self:GetName()..':HideFrames()')
+ if not self.hideReason then
+ self.hideReason = "HideFrames() called"
+ end
+ --print(self:GetName()..':HideFrames()')
self:SetShown(false)
end
- self.count:SetShown(false)
self.Overlay:SetShown(false)
self.count:SetShown(false)
self.timeLabel:SetShown(false)
@@ -709,35 +742,24 @@
--@end-debug@
-- query for reward data if it wasn't found in the original scan
- local questID = self.questID
+
if not self.dataLoaded then
print('|cFFFF4400'..self:GetID()..':|r polling reward info')
- if not (self.isAnimating) then
- self.PendingFade:Play()
- end
+
local dataLoaded = self:GetData()
if dataLoaded and not tContains(db.UpdatedPins, self) then
- print('|cFF00FF88'..self:GetID()..':|r reward info loaded! queue it up')
-
+ print('|cFF00FF88'..self:GetID()..':|r delayed reward info, queueing for update')
+ self.PendingFade:Stop()
tinsert(db.UpdatedPins, self)
end
return
- else
- if self.PendingFade:IsPlaying() then
- print('|cFFFF4400'..self:GetID()..':|r cancel fader')
- self.PendingFade:Stop()
- end
-
- if self.isStale then
- print(self.questID, '|cFFFFFF00flagged for update')
- self:CheckFilterRules()
- self:Refresh()
- return
- end
end
- self:UpdateStatus()
+ if self.maxAlertLevel then
+ self:UpdateStatus()
+ end
+
end
-- Called at static intervals and with Refresh
@@ -755,10 +777,6 @@
tl = timeState
self.timeLabel:SetText(text)
end
- else
- if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
- self:HideFrames()
- end
end
if tl and (timeLeft < 120) then
@@ -771,10 +789,9 @@
self.alertLevel = tl
self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1))
else
- if not self.completed then
- self.completed = true
- self:HideFrames()
- end
+ self.hideReason = "No longer active."
+ self:HideFrames()
+
end
end
@@ -799,6 +816,7 @@
local tagSize = style.TagSize or DEFAULT_STYLE.TagSize
local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon
local borderColor = style.border or DEFAULT_STYLE.border
+ local textColor = style.textColor or DEFAULT_STYLE.textColor
local questID = self.questID
local iconBorder = self.RewardBorder
local trackingBorder = self.HighlightBorder
@@ -829,7 +847,9 @@
end
numberString = numberString .. 'k'
end
+
self.count:SetText(numberString)
+ self.count:SetTextColor(unpack(textColor))
self.count:Show()
else
self.count:SetText(nil)
@@ -907,16 +927,24 @@
}
-
function QuestPOI:CheckFilterRules ()
local print = qprint
local qType = self.worldQuestType
local filtered
local canShow = TQ_IsActive(self.questID)
- if SpellCanTargetQuest() then
- -- hiding so player can click a valid target
- self.used = nil
- elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then
+
+ if db.canTargetQuests then
+ self:EnableMouse(false)
+ if not IsQuestIDValidSpellTarget(self.questID) then
+ self.hideReason = "Not a valid spell target."
+ self:SetShown(false)
+ return
+ end
+ else
+ self:EnableMouse(true)
+ end
+
+ if qType == LE_QUEST_TAG_TYPE_PROFESSION then
if not(self.isKnownProfession or db.Config.ShowAllProfessionQuests) then
canShow = nil
end
@@ -942,10 +970,11 @@
end
self.filtered = filtered
end
-
self.used = canShow
-
-
+ if not canShow then
+ self.hideReason = "Failed filter check."
+ end
+ self:SetShown(canShow)
end
--- Fixes icons upon size update
diff -r cce68795f955 -r 31de7e9e7849 WorldPlan.lua
--- a/WorldPlan.lua Sun Apr 02 13:51:24 2017 -0400
+++ b/WorldPlan.lua Wed Apr 05 11:36:06 2017 -0400
@@ -11,6 +11,7 @@
local BROKEN_ISLES_ID = 1007
local GetCurrentMapAreaID = GetCurrentMapAreaID
local GetTime, IsLoggedIn = GetTime, IsLoggedIn
+local DEBUG_HISTORY = {}
-- Define tables here so the pointers match up
WorldPlanCore = { defaults = {}, modules = {}, TaskQueue = {}, }
@@ -192,6 +193,50 @@
end
end
+function db.log(msg)
+ WorldPlanData.Debug = WorldPlanData.Debug or {}
+ tinsert(WorldPlanData.Debug, msg)
+ tinsert(DEBUG_HISTORY, msg)
+ if WorldPlanDebug:IsShown() then
+ WorldPlanDebug:Update()
+ end
+end
+
+WorldPlanDebugMixin = {
+ OnLoad = function(self)
+ self:SetFont("Interface\\Addons\\Devian\\font\\SourceCodePro-Regular.ttf", 13, 'NORMAL')
+ self:SetJustifyH('LEFT')
+ self:SetFading(false)
+ self:SetMaxLines(2048)
+ self.loadedMessages = 0
+ end,
+ OnShow = function(self)
+ if self.loadedMessages < #DEBUG_HISTORY then
+ self:Update()
+ end
+ end,
+ Update = function(self)
+ for i = self.loadedMessages, #DEBUG_HISTORY do
+ self:AddMessage(DEBUG_HISTORY[i])
+ self.loadedMessages = i
+ end
+ end ,
+ OnMouseWheel = function(self, delta)
+
+ local up = delta > 0
+ if IsControlKeyDown() then
+ if up then self:ScrollToTop()
+ else self:ScrollToBottom() end
+ elseif IsShiftKeyDown() then
+ if up then self:PageUp()
+ else self:PageDown() end
+ else
+ if up then self:ScrollUp()
+ else self:ScrollDown() end
+ end
+end
+}
+
function WorldPlanCore:OnConfigUpdate()
for _, module in ipairs(db.OrderedModules) do
if module.OnConfigUpdate then
@@ -389,7 +434,16 @@
if not WorldPlanData then
WorldPlanData = {key = 0}
end
+
+ -- debug info
WorldPlanData.key = (WorldPlanData.key or 0) + 1
+ WorldPlanData.Debug = WorldPlanData.Debug or {}
+ for _, msg in ipairs(WorldPlanData.Debug) do
+ tinsert(DEBUG_HISTORY, msg)
+ end
+ tinsert(DEBUG_HISTORY, '--SESSION BREAK--')
+ wipe(WorldPlanData.Debug)
+
db.Config = WorldPlanData
for k,v in pairs(db.DefaultConfig) do
--[===[@non-debug@
@@ -484,6 +538,14 @@
self:print('WorldPlanSummary:Refresh(true)')
WorldPlanSummary:Refresh(true)
end
+ elseif arg1 == 'log' then
+ WorldPlanDebug:SetShown(true)
+ elseif arg1 == 'debug' then
+ if WorldPlanData then
+ WorldPlanData.DebugEnabled = (not WorldPlanData.DebugEnabled)
+ self:print(WorldPlanData.DebugEnabled and "Debugger on." or "Debugger off.")
+ end
+
else
self:print('Refreshing data.')
self:Refresh(true)
diff -r cce68795f955 -r 31de7e9e7849 WorldPlan.xml
--- a/WorldPlan.xml Sun Apr 02 13:51:24 2017 -0400
+++ b/WorldPlan.xml Wed Apr 05 11:36:06 2017 -0400
@@ -81,6 +81,7 @@
+
@@ -173,5 +174,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r cce68795f955 -r 31de7e9e7849 WorldQuests.lua
--- a/WorldQuests.lua Sun Apr 02 13:51:24 2017 -0400
+++ b/WorldQuests.lua Wed Apr 05 11:36:06 2017 -0400
@@ -13,7 +13,7 @@
local pairs, ipairs, tinsert, tremove, wipe = pairs, ipairs, tinsert, tremove, table.wipe
local GetTaskInfo, GetTasksTable, HaveQuestData = GetTaskInfo, GetTasksTable, HaveQuestData
local GetTime = GetTime
-local SpellCanTargetQuest = SpellCanTargetQuest
+local SpellCanTargetQuest, IsQuestIDValidSpellTarget = SpellCanTargetQuest, IsQuestIDValidSpellTarget
local tonumber, abs = tonumber, math.abs
local GetQuestLogRewardInfo = GetQuestLogRewardInfo
local GetCurrentMapAreaID, GetMapInfo, GetMapNameByID = GetCurrentMapAreaID, GetMapInfo, GetMapNameByID
@@ -25,6 +25,8 @@
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 ToggleButton = {}
+local callbacks = {}
local PinBaseIndex = 1200
local BROKEN_ISLES_ID, DALARAN_ID, AZSUNA_ID, VALSHARAH_ID, HIGHMOUNTAIN_ID, STORMHEIM_ID, SURAMAR_ID, EOA_ID = 1007, 1014, 1015,1018, 1024, 1017, 1033, 1096
local WORLD_QUEST_MAPS = { [DALARAN_ID] = 'Dalaran70', [AZSUNA_ID] = 'Azsuna', [VALSHARAH_ID] = "Val'sharah",
@@ -39,12 +41,12 @@
0.25, 0.7, 1
}
-local ToggleButton = {}
+local currentScale = WorldMapDetailFrame:GetScale()
+local canTargetQuests
local numShown = 0
local numLoaded = 0
-local isDataLoaded
-local numPins = 0
-local NumPinFrames = 1
+local isDataLoaded = true
+local numOverlays = 1
local scaleConstant = 1
Module.TasksByID = {}
@@ -69,42 +71,28 @@
end
-local currentScale = WorldMapDetailFrame:GetScale()
-function Module:RefreshIfChanged()
- local scaleCheck = WorldMapDetailFrame:GetScale()
- if scaleCheck ~= currentScale then
- print('|cFF00FF88scale changed from', currentScale, 'to', scaleCheck)
- self:Refresh()
- currentScale = scaleCheck
- end
-end
function Module:Setup()
print('|cFFFF4400'..self:GetName()..':Setup()')
-
for mapID, mapName in pairs(WORLD_QUEST_MAPS) do
db.QuestsByZone[mapID] = {}
end
-
- hooksecurefunc("ClickWorldMapActionButton", function () self:OnClickWorldMapActionButton() end)
- hooksecurefunc("WorldMapScrollFrame_ReanchorQuestPOIs", function()
- print("WorldMapScrollFrame_ReanchorQuestPOIs")
- self:RefreshIfChanged()
- end)
- hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function ()
- self:OnUpdateQuestBonusObjectives()
- end)
- hooksecurefunc("WorldMapFrame_UpdateMap", function()
- print("WorldMapFrame_UpdateMap")
- self:RefreshIfChanged()
- end)
- WorldMapFrame.UIElementsFrame.BountyBoard:SetSelectedBountyChangedCallback(function()
- self:OnSelectedBountyChanged()
- end);
- WorldMapFrame.UIElementsFrame.ActionButton:SetOnCastChangedCallback(function()
- print("CastChangedCallback")
- self:Refresh(true)
- end);
+ for target, arg in pairs(callbacks) do
+ print(type(target))
+ if type(target) == 'table' then
+ local callerName = target:GetName()
+ for name, method in pairs(arg) do
+ print(callerName, arg)
+ hooksecurefunc(target, name, function(...)
+ self:OnSecureHook(callerName .. '.' .. arg, method, ...)
+ end)
+ end
+ else
+ hooksecurefunc(target, function(...)
+ self:OnSecureHook(target, arg, ...)
+ end)
+ end
+ end
self.Status = CreateFrame('Frame', nil, self)
self.Status:SetPoint('TOPLEFT', WorldMapPOIFrame, 'TOPLEFT', 0, 0)
@@ -127,8 +115,6 @@
translateTo = numShown * status:GetWidth()
status.t:SetWidth(translateTo)
end
-
-
end)
self:SetAllPoints(WorldMapPOIFrame)
@@ -137,6 +123,29 @@
end
self:Show()
end
+callbacks.ClickWorldMapActionButton = function(WorldQuests)
+ WorldQuests:GetUsedPOIs()
+end
+callbacks.WorldMap_UpdateQuestBonusObjectives = function(WorldQuests)
+ WorldQuests:GetUsedPOIs()
+end
+callbacks.WorldMapFrame_UpdateMap = function(WorldQuests)
+ WorldQuests:RefreshIfChanged()
+end
+callbacks.WorldMapScrollFrame_ReanchorQuestPOIs = function (WorldQuests)
+ WorldQuests:RefreshIfChanged()
+end
+callbacks[WorldMapFrame.UIElementsFrame.BountyBoard] = {
+ SetSelectedBountyIndex = function(WorldQuests)
+ WorldQuests:UpdateBountyInfo()
+ end
+}
+callbacks[WorldMapFrame.UIElementsFrame.ActionButton] = {
+ UpdateCastingState = function(WorldQuests)
+ WorldQuests:Refresh(true)
+ end
+}
+
local GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted = GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestFlaggedCompleted
function Module:UpdateBountyInfo()
@@ -181,10 +190,6 @@
db.BountyUpdate = nil
end
-function Module:OnSelectedBountyChanged()
- self:UpdateBountyInfo()
-end
-
function Module:OnConfigUpdate()
print('|cFFFFFF00OnConfigUpdate()|r')
if db.Config.FadeWhileGrouped then
@@ -217,25 +222,23 @@
end
end
-function Module:UpdateBlizzButtons()
-
- local func = SpellCanTargetQuest() and InternalShowButton or InternalHideButton
+db.UsedPOIs = {}
+function Module:GetUsedPOIs()
+ db.canTargetQuests = SpellCanTargetQuest()
+ local func = db.canTargetQuests and InternalShowButton or InternalHideButton
+ wipe(db.UsedPOIs)
for i = 1, NUM_WORLDMAP_TASK_POIS do
local button = _G['WorldMapFrameTaskPOI'..i]
if button and button.worldQuest then
func(button, i)
+ db.UsedPOIs[button.questID] = button
end
end
end
-function Module:OnUpdateQuestBonusObjectives()
- rprint('|cFFFF4400WorldMap_UpdateQuestBonusObjectives')
- self:UpdateBlizzButtons()
-end
-
-function Module:OnClickWorldMapActionButton()
- rprint('|cFFFF4400ClickWorldMapActionButton')
- self:UpdateBlizzButtons()
+function Module:OnSecureHook(callbackName, func, ...)
+ rprint('|cFFFF4400'..callbackName..'|r', ...)
+ func(self, ...)
end
local defaults = {}
@@ -255,6 +258,7 @@
self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
self:RegisterEvent('SKILL_LINES_CHANGED')
self:RegisterEvent('CURRENT_SPELL_CAST_CHANGED')
+ self:RegisterEvent('ARTIFACT_UPDATE')
end
function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID, isNewMap, isMapOpen)
@@ -278,15 +282,11 @@
function Module:OnEvent (event, ...)
print('|cFFFFFF00'..self:GetName()..':OnEvent() '..event..'|r', GetTime(), ...)
- if (event == 'QUEST_LOG_UPDATE') or (event == 'SUPER_TRACKED_QUEST_CHANGED') then
- local questID, added = ...
- if questID and added then
- local questPOI = self:AcquirePin(questID)
- questPOI:GetQuestInfo()
- questPOI.isStale = true
+ if (event == 'QUEST_LOG_UPDATE') then
+ if self:IsVisible() then
+ self:Refresh()
+ else
self.isStale = true
- else
- self:Refresh()
end
print('WorldMapFrame', WorldMapFrame:IsVisible(), 'hasUpdates:', self.isStale)
elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then
@@ -303,9 +303,10 @@
print('push artifact knowledge update', self.akLevel, 'to', ak)
self.akLevel = ak
for index, pin in pairs( db.QuestsByID) do
- pin.dataLoaded = nil
+ if pin.rewardType == REWARD_ARTIFACT_POWER then
+ pin.dataLoaded = nil
+ end
end
- self:Refresh()
end
elseif event == 'SUPER_TRACKED_QUEST_CHANGED' then
if superTrackedQuestID and db.QuestsByID[superTrackedQuestID] then
@@ -339,7 +340,7 @@
--print('|cFF00FF00Re-using', pin:GetName())
else
totalPins = totalPins + 1
- local name = 'WorldPlanQuestMarker' .. NumPinFrames
+ local name = 'WorldPlanQuestMarker' .. numOverlays
--print('|cFF00FF00Creating', name)
pin = CreateFrame('Frame', name, WorldMapPOIFrame, 'WorldPlanQuestPin')
@@ -348,7 +349,7 @@
return self:GetTypeInfo(typeID)
end
pin:SetID(totalPins)
- NumPinFrames = NumPinFrames + 1
+ numOverlays = numOverlays + 1
--pin.iconBorder:SetVertexColor(0,0,0,1)
end
pin.questID = questID
@@ -381,7 +382,6 @@
pin.isActive = TQ_IsActive(questID)
pin:CheckFilterRules()
rprint(pin:GetID(), pin.filtered, pin.used)
- pin:SetShown(pin.used)
return pin
end
@@ -520,7 +520,14 @@
local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor)
pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor)
+
+ if pin.isNew then
+ pin:OnShow()
+ end
+
+
pin = tremove(db.UpdatedPins)
+
end
end
@@ -607,6 +614,7 @@
return self:MarkAllPins()
end
if not db.Config.EnablePins then
+ numShown = 0
return
end
@@ -618,13 +626,10 @@
pin.used = nil
end
- if SpellCanTargetQuest() then
- self:UpdateBlizzButtons()
- else
- self:UpdateAnchors(nil)
- end
+ canTargetQuests = SpellCanTargetQuest()
+ self:UpdateAnchors()
- --local showQuestPOI = db.Config.EnablePins
+ -- calculate quests shown
numShown = 0
numLoaded = 0
for questID, pin in pairs(db.QuestsByID) do
@@ -644,6 +649,7 @@
if oV == true then
rprint('|cFFFF4400 -|r', questID, pin.title)
end
+ pin.hideReason = "Not used in map area " .. (db.currentMapID)
pin:HideFrames()
end
end
@@ -659,6 +665,18 @@
self.isZoomDirty = nil
end
+function Module:RefreshIfChanged()
+ local scaleCheck = WorldMapDetailFrame:GetScale()
+ if scaleCheck ~= currentScale then
+ print('|cFF00FF88scale changed from', currentScale, 'to', scaleCheck)
+ self:Refresh()
+ currentScale = scaleCheck
+ elseif self.isStale then
+ print('|cFF00FF88isStale flag was set')
+ self:Refresh()
+ end
+end
+
-- update visibility states of all pins
function Module:MarkAllPins(pins)
print(' |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins)
@@ -676,10 +694,8 @@
return
end
-
--print(' |- ', pin.questID, pin.title)
rprint('|cFF00FF00update|r', pin.questID, pin.title)
-
if x and y then
local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
pin:SetFrameLevel(PinBaseIndex+pin:GetID())
@@ -688,10 +704,10 @@
--tinsert(self.UsedPositions, pin)
end
-
if self:IsVisible() and (pin.isStale) then
pin:Refresh()
end
+
if mapID then
if not db.QuestsByZone[mapID] then
db.QuestsByZone[mapID] = {}
@@ -700,15 +716,16 @@
end
end
-function Module:UpdateMap(taskInfo, mapID)
+-- Updates quest markers in taskInfo while associating them with the given map
+function Module:UpdateQuestsForMap(taskInfo, mapID)
rprint('Map', GetMapNameByID(mapID), GetMapNameByID(db.currentMapID))
for index, info in pairs(taskInfo) do
self:UpdateQuestButton(info, mapID)
end
end
+-- Used to refresh the visible quest markers
function Module:UpdateAnchors ()
-
wipe(self.UsedPositions)
print(' |cFF00FF00'..self:GetName()..':UpdateAnchors()')
self.hostWidth, self.hostHeight = WorldMapPOIFrame:GetSize()
@@ -720,13 +737,11 @@
if isMicroDungeon then
return
end
- -- starts as true
+
isDataLoaded = true
-
- numPins = 0
local taskInfo = TQ_GetQuestsForPlayerByMapID(db.currentMapID)
if taskInfo then
- self:UpdateMap(taskInfo, db.currentMapID)
+ self:UpdateQuestsForMap(taskInfo, db.currentMapID)
end
local numZones = MC_GetNumZones(db.currentMapID)
if numZones then
@@ -734,7 +749,7 @@
local mapAreaID = MC_GetZoneInfo(db.currentMapID, i)
local taskInfo = TQ_GetQuestsForPlayerByMapID(mapAreaID, db.currentMapID)
if taskInfo then
- self:UpdateMap(taskInfo, mapAreaID)
+ self:UpdateQuestsForMap(taskInfo, mapAreaID)
end
end
end