comparison WorldMap.lua @ 109:caa482329919

POI optimization
author Nenue
date Mon, 10 Jul 2017 18:34:11 -0400
parents WorldQuests.lua@b67ba1078824
children f6ef9a9f5476
comparison
equal deleted inserted replaced
108:b67ba1078824 109:caa482329919
1 -- WorldPlan
2 -- WorldMap.lua
3 -- Created: 11/2/2016 3:40 PM
4 -- %file-revision%
5
6 local print = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or nop
7 local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or nop
8 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or nop
9 local wprint = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or nop
10 local mprint = DEVIAN_WORKSPACE and function(...) _G.print('Canvas', ...) end or nop
11 local _, db = ...
12 local Module = {
13 UsedPositions = {},
14 }
15 WorldPlanMapMixin = Module
16
17 local _G = _G
18 local type, tostring, tonumber, pairs, ipairs = type, tostring, tonumber, pairs, ipairs
19 local MC_GetNumZones, MC_GetZoneInfo = C_MapCanvas.GetNumZones, C_MapCanvas.GetZoneInfo
20 local TQ_GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID -- This function is not yet documented
21 local TQ_GetQuestZoneID = C_TaskQuest.GetQuestZoneID
22 local TQ_IsActive = C_TaskQuest.IsActive
23 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData
24 local pairs, ipairs, tinsert, tremove, wipe = pairs, ipairs, tinsert, tremove, table.wipe
25 local GetTaskInfo, GetTasksTable, HaveQuestData = GetTaskInfo, GetTasksTable, HaveQuestData
26 local GetTime = GetTime
27 local SpellCanTargetQuest, IsQuestIDValidSpellTarget = SpellCanTargetQuest, IsQuestIDValidSpellTarget
28 local tonumber, abs = tonumber, math.abs
29 local GetQuestLogRewardInfo = GetQuestLogRewardInfo
30 local GetCurrentMapAreaID, GetMapInfo, GetMapNameByID = GetCurrentMapAreaID, GetMapInfo, GetMapNameByID
31 local GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestComplete = GetQuestBountyInfoForMapID, GetQuestLogTitle, GetQuestLogIndexByID, IsQuestComplete
32 local HaveQuestRewardData = HaveQuestRewardData
33 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
34 local InCombatLockdown, hooksecurefunc = InCombatLockdown, hooksecurefunc
35
36 local ToggleButton = {}
37 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
38 local WORLD_QUEST_MAPS = { [DALARAN_ID] = 'Dalaran70', [AZSUNA_ID] = 'Azsuna', [VALSHARAH_ID] = "Val'sharah",
39 [HIGHMOUNTAIN_ID] = 'Highmountain', [STORMHEIM_ID] = 'Stormheim', [SURAMAR_ID] = 'Suramar', [EOA_ID] = 'EyeOfAszhara', }
40
41 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD
42 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER
43 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT
44 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES
45 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS
46 local SCALE_FACTORS = { 0.25, 0.7, 1 }
47
48 local BountyBoard = WorldMapFrame.UIElementsFrame.BountyBoard
49 local ActionButton = WorldMapFrame.UIElementsFrame.ActionButton
50 local defaults = {}
51 local completedQuests = {}
52
53 local continentScanned
54 local layoutDirty = true
55 local bountiesDirty = true
56 local artifactPowerDirty = true
57 local hooksDirty = true
58 local currentScale = WorldMapDetailFrame:GetScale()
59 local canTargetQuests
60 local isDataLoaded = true
61 local artifactKnowledgeLevel
62 local superTrackedQuestID
63 local lastRefresh
64 local refreshReason
65
66 local bountyQuests = {}
67 local bountyInfo = {}
68 local bountyDisplayLocation, bountyLockedQuestID, selectedBountyIndex, selectedBountyQuestID
69
70 local totalPins = 0
71 local numShown = 0
72 local numLoaded = 0
73 local numOverlays = 1
74 local scaleConstant = 1
75 local pinBaseIndex = 1550
76 local overlayBaseIndex = 1600
77
78 local artifactKnowldegeSpells = {
79 [207856] = true,
80 [209203] = true,
81 [209204] = true,
82 [209205] = true,
83 [209206] = true,
84 [209207] = true,
85 [209208] = true,
86 [209209] = true,
87 [209210] = true,
88 [209211] = true,
89 [209212] = true,
90 [219978] = true,
91 [227852] = true,
92 [236477] = true,
93 [236489] = true,
94 [236302] = true,
95 [236488] = true,
96 [236490] = true,
97 [240475] = true,
98 [243176] = true,
99 [243177] = true,
100 [243178] = true,
101 [243182] = true,
102 [243183] = true,
103 [243187] = true,
104 [245133] = true,
105 }
106
107 --%debug%
108 local SetTimedCallbackForAllPins = function(seconds, callback)
109 C_Timer.After(seconds, function()
110 for id, pin in pairs(WorldPlanQuests.QuestsByID) do
111 callback(pin)
112 end
113 end)
114 end
115
116 function Module:OnLoad()
117 --print('|cFFFF4400'..self:GetName()..':OnLoad()')
118
119 self:SetParent(WorldMapFrame.UIElementsFrame)
120 WorldPlan:AddHandler(self, defaults)
121
122 for areaID, fileName in pairs(WORLD_QUEST_MAPS) do
123 db.QuestsByZone[areaID] = {}
124 end
125
126 -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level
127 self:RegisterEvent('WORLD_QUEST_COMPLETED_BY_SPELL')
128 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
129 self:RegisterEvent('SKILL_LINES_CHANGED')
130 self:RegisterEvent('ARTIFACT_UPDATE')
131 self:RegisterEvent('QUEST_LOG_UPDATE')
132 self:RegisterEvent('UNIT_SPELLCAST_STOP')
133 end
134
135 function Module:OnEvent (event, ...)
136 print('|cFFFFFF00OnEvent() '..event..'|r', GetTime(), ...)
137 if (event == 'QUEST_LOG_UPDATE') then
138 self:UpdateBounties(event)
139 elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then
140 local questID = ...
141 if questID and db.QuestsByID[questID] then
142 completedQuests[questID] = true
143 db.QuestsByID[questID]:Release()
144 end
145 self:Refresh(event)
146 elseif event == 'SKILL_LINES_CHANGED' or event == 'CURRENT_SPELL_CAST_CHANGED' then
147 self:Refresh(event)
148 elseif event == 'ARTIFACT_UPDATE' then
149 self:UpdateArtifactPower()
150 elseif event == 'MODIFIER_STATE_CHANGED' then
151 self:UpdateModifierState()
152 elseif event == 'SUPER_TRACKED_QUEST_CHANGED' then
153 if superTrackedQuestID and db.QuestsByID[superTrackedQuestID] then
154 db.QuestsByID[superTrackedQuestID].isStale = true
155 end
156 local newID = GetSuperTrackedQuestID()
157 if newID and db.QuestsByID[newID] then
158 db.QuestsByID[newID].isStale = true
159 end
160 elseif event == 'UNIT_SPELLCAST_STOP' then
161 local name, _, _, _, spellID = ...
162 if artifactKnowldegeSpells[spellID] then
163 db.log('AK spellcast ended ' .. tostring(name) .. ' ('.. tostring(spellID)..')')
164 self:UpdateArtifactPower()
165 end
166 end
167 end
168
169 function Module:OnUpdate(sinceLast)
170 if WorldPlanData.DebugEnabled then
171 if self.refreshBenchMarkTicker then
172 --print(self.refreshBenchMarkTicker)
173 self.refreshBenchMarkTicker = self.refreshBenchMarkTicker - 1
174
175 if self.refreshBenchMarkTicker == 0 then
176
177 self.refreshTime = floor((GetTime() - self.refreshBenchMark) * 1000)
178 self.debugMessage:SetText(self.refreshTime)
179 self.refreshBenchMarkTicker = nil
180 end
181 else
182 self.refreshBenchMark = GetTime()
183 end
184 end
185
186 if self.filtersDirty or self.isStale then
187 self:Refresh()
188 end
189
190 if #db.UpdatedPins >= 1 then
191 --print('|cFF00FF88pending update', #db.UpdatedPins)
192 self:UpdateNext()
193 end
194 end
195
196 local callbacks = {}
197 callbacks.ClickWorldMapActionButton = function(WorldQuests)
198 WorldQuests:Refresh('CLICK_MAP_ACTION_BUTTON')
199 end
200 callbacks.WorldMap_UpdateQuestBonusObjectives = function(WorldQuests)
201 WorldQuests:UpdateTaskPOIs()
202 end
203 callbacks.WorldMapFrame_UpdateMap = function(WorldQuests)
204 WorldQuests:RefreshIfChanged('WMF_UPDATE')
205 end
206 callbacks.WorldMapScrollFrame_ReanchorQuestPOIs = function (WorldQuests)
207 WorldQuests:RefreshIfChanged('WMF_REANCHOR')
208 end
209
210 callbacks[BountyBoard] = {}
211 callbacks[BountyBoard].SetSelectedBountyIndex = function(WorldQuests)
212 WorldQuests:UpdateBounties('BOUNTY_SELECTED')
213 for questID, pin in pairs(db.QuestsByID) do
214 pin.checkCriteria = true
215 pin:Refresh()
216 end
217 end
218
219 callbacks[ActionButton] = {}
220 callbacks[ActionButton].UpdateCastingState = function(WorldQuests)
221 for questID, pin in pairs(db.QuestsByID) do
222 pin.checkCursor = true
223 pin:Refresh()
224 end
225 end
226
227 callbacks.UseWorldMapActionButtonSpellOnQuest = function(questID)
228 local pin = db.QuestsByID[questID]
229 -- calling this implies that the pin is used in some way
230 if pin then
231 db.log(pin.title .. ' completed by spell?', IsQuestComplete(pin.questID))
232 pin:OnFilters()
233 pin.isStale = true
234 end
235 end
236
237 function Module:SetupCallbacks()
238 if InCombatLockdown() then
239 return true
240 end
241 print('SetupCallbacks()')
242 for target, arg in pairs(callbacks) do
243 --print(type(target))
244 if type(target) == 'table' then
245 local callerName = target:GetName() or tostring(target)
246 for name, method in pairs(arg) do
247 --print(callerName, arg)
248 hooksecurefunc(target, name, function(...)
249 self:OnSecureHook(callerName .. '.' .. name, method, ...)
250 end)
251 end
252 else
253 hooksecurefunc(target, function(...)
254 self:OnSecureHook(target, arg, ...)
255 end)
256 end
257 end
258 end
259
260 function Module:Setup()
261 --print('|cFFFF4400'..self:GetName()..':Setup()')
262 for mapID, mapName in pairs(WORLD_QUEST_MAPS) do
263 db.QuestsByZone[mapID] = {}
264 end
265
266 hooksDirty = self:SetupCallbacks()
267
268 self:SetAllPoints(WorldMapFrame.UIElementsFrame)
269 self:UpdateArtifactPower()
270 self:UpdateBounties('SETUP')
271 self:Show()
272 end
273
274 function Module:OnMapInfo(isBrokenIsle, isZoomedOut, mapAreaID, isNewMap, isMapOpen)
275 if isNewMap or self.isStale then
276 print('|cFF0088FFOnMapInfo()|r, mapAreaID =', mapAreaID,'visible =', isMapOpen, 'changed =', isNewMap)
277 layoutDirty = true
278 self:Refresh('WORLD_MAP_CHANGED')
279 end
280 end
281
282 function Module:OnConfigUpdate()
283 --print('|cFFFFFF00OnConfigUpdate()|r')
284 if db.Config.FadeWhileGrouped then
285 db.PinAlpha = 0.15
286 else
287 db.PinAlpha = 1
288 end
289
290 if not db.Config.EnablePins then
291 for _, pin in pairs(db.QuestsByID) do
292 pin:SetShown(false)
293 end
294 end
295 end
296
297 function Module:OnSecureHook(callbackName, func, ...)
298 print('|cFFFF4400'..callbackName..'|r', ...)
299 func(self, ...)
300 end
301
302 function Module:UpdateModifierState()
303
304 end
305
306 function Module:UpdateTaskPOIs()
307 canTargetQuests = SpellCanTargetQuest()
308 for i = 1, NUM_WORLDMAP_TASK_POIS do
309 local poiFrame = _G['WorldMapFrameTaskPOI'..i]
310 if poiFrame and poiFrame.worldQuest then
311 local pin = db.QuestsByID[poiFrame.questID]
312 if pin and pin.used and canTargetQuests and IsQuestIDValidSpellTarget(pin.questID) then
313 poiFrame:Show()
314 else
315 poiFrame:Hide()
316 end
317 end
318 end
319 end
320 -- re-anchors and scales pins that have had either of these changed due to data loading delays
321 function Module:UpdateNext()
322 --print('|cFF00FF88UpdateNext()')
323 local pin = tremove(db.UpdatedPins)
324 pin:OnFilters()
325
326 local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1]
327 --print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor)
328 if pin.used then
329 pin:SetShown(true)
330 pin:SetAnchor(nil, pin.x, pin.y, self.hostWidth, self.hostHeight, scaleFactor)
331 pin:Refresh()
332 else
333 print('|cFFFF4400flagging queued pin that got hidden:', pin.title)
334 pin.isStale = true
335 end
336 end
337
338 function Module:UpdateBounties(...)
339 bountiesDirty = nil
340 print('|cFF00FF88BountyInfo()|r', ...)
341 wipe(db.BountiesByFactionID)
342 wipe(db.BountiesByQuestID)
343
344 db.selectedBounty = nil
345 selectedBountyIndex = BountyBoard:GetSelectedBountyIndex()
346 db.Bounties, bountyDisplayLocation, bountyLockedQuestID = GetQuestBountyInfoForMapID(db.currentMapID, db.Bounties)
347 local numBounties = 0
348 for index, info in ipairs(db.Bounties) do
349 numBounties = numBounties + 1
350 info.index = index
351 info.complete = IsQuestComplete(info.questID)
352 if not info.complete then
353 db.BountiesByFactionID[info.factionID] = info
354 db.BountiesByQuestID[info.questID] = info
355 if index == selectedBountyIndex then
356 db.selectedBounty = info
357 selectedBountyQuestID = info.questID
358 end
359 print(' ', index, info.factionID, GetQuestLogTitle(GetQuestLogIndexByID(info.questID)), info.complete, (index == selectedBountyIndex) and 'SELECTED' or '')
360 end
361 end
362 end
363
364 -- check current artifact knowledge and update pins accordingly
365 function Module:UpdateArtifactPower(overrideLevel)
366 if InCombatLockdown() then
367 artifactPowerDirty = true
368 return
369 end
370
371 print('|cFF00FF88UpdateArtifactPower()|r')
372 local _, akLevel = GetCurrencyInfo(1171)
373 if overrideLevel then
374 akLevel = overrideLevel
375 end
376
377 --db.print('current AK', akLevel)
378 if akLevel and (akLevel ~= artifactKnowledgeLevel) or (not artifactKnowledgeLevel) then
379 --print('new ak level', akLevel)
380 db.log('AK update ' .. tostring(artifactKnowledgeLevel) .. ' to '.. tostring(akLevel))
381 for _, pin in pairs(db.QuestsByID) do
382 if (pin.rewardType == REWARD_ARTIFACT_POWER) then
383 print(pin.title, pin.itemNumber)
384 local newAP = pin:UpdateArtifactPower()
385 if newAP then
386 pin.itemNumber = newAP
387 print(newAP)
388 else
389 pin.dataLoaded = nil
390 end
391 pin.isStale = true
392 end
393 end
394 artifactKnowledgeLevel = akLevel
395 end
396 artifactPowerDirty = nil
397 end
398
399 local msg = '|cFF00FF88WorldQuests:Refresh()|r|cFF00FFFF'
400 function Module:Refresh(...)
401
402 if hooksDirty then
403 hooksDirty = self:SetupCallbacks()
404 end
405
406
407 if not self:IsVisible() then
408 print('|cFFFF4400Refresh()|r', ...)
409 return
410 else
411 if lastRefresh == GetTime() then
412 print('|cFFFF4400multiple refreshes tried')
413 end
414 lastRefresh = GetTime()
415 print(msg, lastRefresh, ...)
416 end
417
418
419 if bountiesDirty then
420 self:UpdateBounties()
421 end
422
423 if not db.Config.EnablePins then
424 numShown = 0
425 self.refreshBenchMark = GetTime()
426 self.refreshBenchMarkTicker = 2
427 print('starting bench', self.refreshBenchMark)
428 return
429 end
430
431 scaleConstant = db.isContinentMap and 2 or 3
432 canTargetQuests = SpellCanTargetQuest()
433
434 for index, pin in pairs(db.QuestsByID) do
435 pin.used = nil
436 end
437
438 self:UpdateAnchors(...)
439
440 if artifactPowerDirty and not InCombatLockdown() then
441 self:UpdateArtifactPower()
442 end
443 -- calculate quests shown
444 numShown = 0
445 numLoaded = 0
446 for questID, pin in pairs(db.QuestsByID) do
447 local oV = pin:IsShown()
448 if pin.used then
449 print('show', pin.title)
450 pin.throttle = 1
451 pin:SetShown(true)
452 numShown = numShown + 1
453 if pin.dataLoaded then
454 numLoaded = numLoaded + 1
455 end
456
457 pin.checkCriteria = true
458 pin.checkFilters = true
459 pin:Refresh('WORLDMAP_REFRESH ' .. GetTime())
460
461 else
462 if pin:IsShown() then
463 print('|cFFFF4400need to remove', pin.title)
464
465 end
466
467 pin.hideReason = "Not used in map area " .. (db.currentMapID)
468 pin:SetShown(false)
469 end
470
471 end
472
473
474 --
475 self.refreshBenchMark = GetTime()
476 self.refreshBenchMarkTicker = 2
477 print('starting bench', self.refreshBenchMark)
478
479 --
480
481 layoutDirty = nil
482 self.isStale = nil
483 self.sizesDirty = nil
484 self.isZoomDirty = nil
485
486 if WorldPlanSummary then
487 WorldPlanSummary.isStale = true
488 end
489
490 end
491
492 function Module:RefreshIfChanged(event)
493 local scaleCheck = WorldMapDetailFrame:GetScale()
494 refreshReason = nil
495 if scaleCheck ~= currentScale then
496 refreshReason = 'map scale updated'
497 currentScale = scaleCheck
498 layoutDirty = true
499 elseif self.isStale or layoutDirty then
500 refreshReason = 'layout is marked dirty'
501 end
502 if not refreshReason then
503 return
504 end
505
506 if self:IsVisible() then
507 print('|cFF00FFFFRefreshIfChanged()|r', refreshReason)
508 self:Refresh(event)
509 else
510 print('|cFF00FFFFRefreshIfChanged()|r', refreshReason)
511 self.isStale = true
512 end
513 end
514
515 -- Walks the current map tree and fires updates as needed
516 function Module:UpdateAnchors (event)
517 wipe(self.UsedPositions)
518 local hostWidth, hostHeight = WorldMapPOIFrame:GetSize()
519
520 if (hostWidth ~= self.hostWidth) or (hostHeight ~= self.hostHeight) then
521 self.hostWidth, self.hostHeight = hostWidth, hostHeight
522 layoutDirty = true
523 end
524
525 print('|cFF00FF00UpdateAnchors()', event)
526 local mapFileName, textureHeight, textureWidth, isMicroDungeon, microDungeonMapName = GetMapInfo()
527 if isMicroDungeon then
528 return
529 end
530
531 isDataLoaded = true
532 local taskInfo = TQ_GetQuestsForPlayerByMapID(db.currentMapID)
533 if taskInfo then
534 self:UpdateQuestsForMap(taskInfo, db.currentMapID)
535 end
536 local numZones = MC_GetNumZones(db.currentMapID)
537 if numZones then
538 for i = 1, numZones do
539 local mapAreaID = MC_GetZoneInfo(db.currentMapID, i)
540 local taskInfo = TQ_GetQuestsForPlayerByMapID(mapAreaID, db.currentMapID)
541
542 db.QuestsByZone[mapAreaID] = db.QuestsByZone[mapAreaID] or {}
543
544 if taskInfo then
545 self:UpdateQuestsForMap(taskInfo, mapAreaID)
546 end
547 end
548 end
549 end
550
551 -- Attempt to display the pins for quests in taskInfo
552 function Module:UpdateQuestsForMap(taskInfo, mapID)
553 print('|cFF00FF00UpdateQuestsForMap()|r', GetMapNameByID(mapID), GetMapNameByID(db.currentMapID), layoutDirty)
554 if db.QuestsByZone[mapID] then
555 wipe(db.QuestsByZone[mapID])
556 elseif db.isBrokenIsle then
557 continentScanned = true
558 end
559 db.PinStrata = WorldMapFrame_InWindowedMode() and 'HIGH' or 'FULLSCREEN'
560 print('layoutDirty =',layoutDirty)
561
562 for index, info in pairs(taskInfo) do
563 local questID, x, y = info.questId, info.x, info.y
564 local pin = self:AcquirePin(info)
565 if pin then
566 if pin.canShow then
567 pin.used = true
568 print('using', pin.title, (pin.owningFrame ~= WorldMapFrame))
569 if layoutDirty or (pin.owningFrame ~= WorldMapFrame) then
570 local scaleFactor = SCALE_FACTORS[(not pin.filtered and scaleConstant) or 1]
571 pin.owningFrame = WorldMapFrame
572 pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor)
573
574 end
575 if db.QuestsByZone[mapID] then
576 db.QuestsByZone[mapID][questID] = pin
577 end
578 else
579 print('|cFFFF4400discarding|r', pin.title)
580 end
581 end
582 end
583 end
584
585 -- locates or creates a corresponding pin frame for the provided TaskInfo data
586 function Module:AcquirePin (info)
587 local questID = info.questId
588 if not (questID and QuestUtils_IsQuestWorldQuest(questID)) then
589 return nil
590 end
591 local pin = db.QuestsByID[questID]
592 -- check to avoid creating unnecessary frames
593 if IsQuestComplete(questID) or completedQuests[questID] then
594 completedQuests[questID] = true
595 if pin then
596 pin:Release()
597 end
598 return nil
599 end
600
601 if not pin then
602 local numFree = #db.FreePins
603 if numFree >= 1 then
604 pin = tremove(db.FreePins, numFree)
605 print('|cFF00FF00Acquire()|r Re-using', pin:GetName())
606 else
607 totalPins = totalPins + 1
608 local name = 'WorldPlanQuestMarker' .. numOverlays
609 print('|cFF00FF00Acquire()|r Creating', name)
610 pin = CreateFrame('Frame', name, WorldMapPOIFrame, 'WorldPlanQuestPin')
611
612 pin:SetID(totalPins)
613 numOverlays = numOverlays + 1
614 --pin.iconBorder:SetVertexColor(0,0,0,1)
615 end
616 pin.questID = questID
617 pin.throttle = pin.updateRate
618 pin.currentWidth = nil
619
620 db.QuestsByID[questID] = pin
621 tinsert(db.UsedPins, pin)
622 end
623
624 if info then
625 pin.inProgress = info.inProgress
626 pin.floor = info.floor
627 pin.numObjectives = info.numObjectives or 0
628 if info.x and info.y then
629 if (info.x ~= pin.x) or (info.y ~= pin.y) then
630 pin.isStale = true
631 --rprint('|cFFFF4400SetCoords|r', info.x, info.y)
632 end
633 end
634 end
635
636 pin.x = info.x or pin.x
637 pin.y = info.y or pin.y
638
639 if not HaveQuestRewardData(questID) then
640 TQ_RequestPreloadRewardData(questID);
641 end
642
643 if (not pin.dataLoaded) then
644 local dataLoaded = pin:GetData()
645 if dataLoaded then
646 WorldPlan.dataFlush = true
647 else
648 isDataLoaded = false
649 end
650 end
651
652 pin:OnFilters()
653 pin.isActive = TQ_IsActive(questID)
654 --rprint(pin:GetID(), pin.filtered, pin.used)
655 return pin
656 end
657
658 function Module:Debug(...)
659 print(...)
660 end