Mercurial > wow > worldplan
comparison WorldQuests.lua @ 66:e43e10c5576b
Update for Legion Patch 7.2
- Massive performance improvements through largely re-written update routines.
- Removed AP token caching until reliable mechanisms for detecting AK shifts can be resolved.
author | Nenue |
---|---|
date | Thu, 30 Mar 2017 02:32:44 -0400 |
parents | 02f1d3bce558 |
children | 96183f981acb |
comparison
equal
deleted
inserted
replaced
65:02f1d3bce558 | 66:e43e10c5576b |
---|---|
32 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD | 32 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD |
33 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER | 33 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER |
34 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT | 34 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT |
35 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES | 35 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES |
36 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS | 36 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS |
37 local SCALE_FACTORS = { | |
38 0.25, 0.7, 1 | |
39 } | |
37 | 40 |
38 local numShown = 0 | 41 local numShown = 0 |
39 local numLoaded = 0 | 42 local numLoaded = 0 |
40 local isDataLoaded | 43 local isDataLoaded |
41 local numPins = 0 | 44 local numPins = 0 |
42 local NumPinFrames = 1 | 45 local NumPinFrames = 1 |
46 local scaleConstant = 1 | |
43 Module.TasksByID = {} | 47 Module.TasksByID = {} |
44 | 48 |
45 --%debug% | 49 --%debug% |
46 local SetTimedCallbackForAllPins = function(seconds, callback) | 50 local SetTimedCallbackForAllPins = function(seconds, callback) |
47 C_Timer.After(seconds, function() | 51 C_Timer.After(seconds, function() |
50 end | 54 end |
51 end) | 55 end) |
52 end | 56 end |
53 | 57 |
54 function Module:OnUpdate(sinceLast) | 58 function Module:OnUpdate(sinceLast) |
55 if self.filtersDirty or self.isStale then | 59 if self.filtersDirty or self.isStale or self.isZoomDirty then |
56 self:Refresh() | 60 self:Refresh() |
57 end | 61 end |
58 end | 62 end |
59 | 63 |
60 local InternalDoRefresh = function (self) | 64 local InternalDoRefresh = function (self) |
150 print('|cFFFF4400'..self:GetName()..':OnLoad()') | 154 print('|cFFFF4400'..self:GetName()..':OnLoad()') |
151 | 155 |
152 self:SetParent(WorldMapPOIFrame) | 156 self:SetParent(WorldMapPOIFrame) |
153 WorldPlan:AddHandler(self, defaults) | 157 WorldPlan:AddHandler(self, defaults) |
154 | 158 |
155 local rgbWhite = {1, 1, 1 } | |
156 WorldPlan:AddTypeInfo(self, REWARD_UNKNOWN, { r = 0, g = 0, b = 0}) | |
157 WorldPlan:AddTypeInfo(self, REWARD_REAGENT, { r = 0, g = 1, b = .5 }) | |
158 WorldPlan:AddTypeInfo(self, REWARD_ARTIFACT_POWER, { r = 1, g = .25, b = .5, hasNumeric = true, numberRGB = rgbWhite }) | |
159 WorldPlan:AddTypeInfo(self, REWARD_GEAR, { r = .3, g = .7, b = 1 }) | |
160 WorldPlan:AddTypeInfo(self, REWARD_CURRENCY, { r = 1, g = 1, b = 0, hasNumeric = true, numberRGB = {1,1,0}, }) | |
161 WorldPlan:AddTypeInfo(self, REWARD_CASH, { r = 1, g = 1, b = .32, pinMask = false, rewardMask = false }) | |
162 | |
163 for areaID, fileName in pairs(WORLD_QUEST_MAPS) do | 159 for areaID, fileName in pairs(WORLD_QUEST_MAPS) do |
164 db.QuestsByZone[areaID] = {} | 160 db.QuestsByZone[areaID] = {} |
165 end | 161 end |
166 | 162 |
167 -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level | 163 -- WORLD_MAP_UPDATE and PLAYER_ENTERING_WORLD are passed down from a higher level |
288 local dataLoaded = pin:GetData() | 284 local dataLoaded = pin:GetData() |
289 isDataLoaded = (isDataLoaded and dataLoaded) | 285 isDataLoaded = (isDataLoaded and dataLoaded) |
290 WorldPlan.dataFlush = true | 286 WorldPlan.dataFlush = true |
291 end | 287 end |
292 | 288 |
289 | |
293 pin.isActive = TQ_IsActive(questID) | 290 pin.isActive = TQ_IsActive(questID) |
294 | |
295 pin:CheckFilterRules() | 291 pin:CheckFilterRules() |
296 rprint(pin:GetID(), pin.filtered, pin.used) | 292 rprint(pin:GetID(), pin.filtered, pin.used) |
297 | 293 |
298 return pin | 294 return pin |
299 end | 295 end |
428 if not mapID then | 424 if not mapID then |
429 -- info not available yet | 425 -- info not available yet |
430 return | 426 return |
431 end | 427 end |
432 | 428 |
429 local scalingConstant = 1 | |
430 local style = DEFAULT_STYLE | |
431 if self.dataLoaded then | |
432 style = REWARD_TYPE_STYLES[self.rewardType] | |
433 scalingConstant = db.isContinentMap and 2 or 3 | |
434 end | |
435 | |
436 local pinScale = SCALE_FACTORS[scalingConstant] | |
437 print(pinScale) | |
438 self:SetScale(pinScale) | |
439 self.Overlay:SetScale(pinScale) | |
433 | 440 |
434 print('|cFF00FF88'..self:GetName()..':UpdateWorldQuests()|r', 'map:', mapID, 'realMap:', db.currentMapID) | 441 print('|cFF00FF88'..self:GetName()..':UpdateWorldQuests()|r', 'map:', mapID, 'realMap:', db.currentMapID) |
435 | 442 |
436 | 443 |
437 self.isStale = nil | 444 self.isStale = nil |
492 self.isStale = true | 499 self.isStale = true |
493 return self:MarkAllPins() | 500 return self:MarkAllPins() |
494 end | 501 end |
495 wprint(' |cFF00FF88'..self:GetName()..':Refresh()|r') | 502 wprint(' |cFF00FF88'..self:GetName()..':Refresh()|r') |
496 | 503 |
504 scaleConstant = db.isContinentMap and 2 or 3 | |
497 for index, pin in pairs(db.QuestsByID) do | 505 for index, pin in pairs(db.QuestsByID) do |
498 pin.used = nil | 506 pin.used = nil |
499 end | 507 end |
500 | 508 |
501 if SpellCanTargetQuest() then | 509 if SpellCanTargetQuest() then |
535 end | 543 end |
536 | 544 |
537 | 545 |
538 self.isStale = nil | 546 self.isStale = nil |
539 self.sizesDirty = nil | 547 self.sizesDirty = nil |
548 self.isZoomDirty = nil | |
540 end | 549 end |
541 | 550 |
542 -- update visibility states of all pins | 551 -- update visibility states of all pins |
543 function Module:MarkAllPins(pins) | 552 function Module:MarkAllPins(pins) |
544 print(' |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins) | 553 print(' |cFFFFFF00'..self:GetName()..':MarkAllPins()|r', pins) |
559 | 568 |
560 print('~ ', pin.mapID, pin.questID, pin.title) | 569 print('~ ', pin.mapID, pin.questID, pin.title) |
561 rprint('|cFF00FF00update|r', pin.questID, pin.title) | 570 rprint('|cFF00FF00update|r', pin.questID, pin.title) |
562 | 571 |
563 if x and y then | 572 if x and y then |
573 local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1] | |
564 pin:SetFrameLevel(PinBaseIndex+pin:GetID()) | 574 pin:SetFrameLevel(PinBaseIndex+pin:GetID()) |
565 pin.owningFrame = WorldMapFrame | 575 pin.owningFrame = WorldMapFrame |
566 pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight) | 576 pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor) |
567 --tinsert(self.UsedPositions, pin) | 577 --tinsert(self.UsedPositions, pin) |
568 end | 578 end |
569 if self:IsVisible() and pin.isStale then | 579 |
580 | |
581 if self:IsVisible() and (pin.isStale) then | |
570 pin:Refresh() | 582 pin:Refresh() |
571 end | 583 end |
572 if mapID then | 584 if mapID then |
573 if not db.QuestsByZone[mapID] then | 585 if not db.QuestsByZone[mapID] then |
574 db.QuestsByZone[mapID] = {} | 586 db.QuestsByZone[mapID] = {} |