Mercurial > wow > worldplan
comparison WorldQuests.lua @ 100:fbd4ead2a19f v1.4.11
- More attempts to fix quest markers re-appearing when completed via the order hall spells. Hard to test due to cooldown.
author | Nenue |
---|---|
date | Thu, 18 May 2017 16:43:14 -0400 |
parents | d594c5c4a4a3 |
children | 4d1520186ea4 8cdd62e7a224 |
comparison
equal
deleted
inserted
replaced
99:cffecc347e90 | 100:fbd4ead2a19f |
---|---|
66 local totalPins = 0 | 66 local totalPins = 0 |
67 local numShown = 0 | 67 local numShown = 0 |
68 local numLoaded = 0 | 68 local numLoaded = 0 |
69 local numOverlays = 1 | 69 local numOverlays = 1 |
70 local scaleConstant = 1 | 70 local scaleConstant = 1 |
71 local pinBaseIndex = 1500 | 71 local pinBaseIndex = 1550 |
72 local overlayBaseIndex = 1580 | 72 local overlayBaseIndex = 1600 |
73 | 73 |
74 local artifactKnowldegeSpells = { | 74 local artifactKnowldegeSpells = { |
75 [207856] = true, | 75 [207856] = true, |
76 [209203] = true, | 76 [209203] = true, |
77 [209204] = true, | 77 [209204] = true, |
203 end | 203 end |
204 | 204 |
205 callbacks[BountyBoard] = {} | 205 callbacks[BountyBoard] = {} |
206 callbacks[BountyBoard].SetSelectedBountyIndex = function(WorldQuests) | 206 callbacks[BountyBoard].SetSelectedBountyIndex = function(WorldQuests) |
207 WorldQuests:UpdateBounties('BOUNTY_SELECTED') | 207 WorldQuests:UpdateBounties('BOUNTY_SELECTED') |
208 WorldQuests:Refresh('BOUNTY_SELECTED') | 208 for questID, pin in pairs(db.QuestsByID) do |
209 pin.checkCriteria = true | |
210 pin:Refresh() | |
211 end | |
209 end | 212 end |
210 | 213 |
211 callbacks[ActionButton] = {} | 214 callbacks[ActionButton] = {} |
212 callbacks[ActionButton].UpdateCastingState = function(WorldQuests) | 215 callbacks[ActionButton].UpdateCastingState = function(WorldQuests) |
213 WorldQuests:Refresh('CASTING_STATE_CHANGED') | 216 for questID, pin in pairs(db.QuestsByID) do |
217 pin.checkCursor = true | |
218 pin:Refresh() | |
219 end | |
214 end | 220 end |
215 | 221 |
216 callbacks.UseWorldMapActionButtonSpellOnQuest = function(questID) | 222 callbacks.UseWorldMapActionButtonSpellOnQuest = function(questID) |
217 local pin = db.QuestsByID[questID] | 223 local pin = db.QuestsByID[questID] |
218 -- calling this implies that the pin is used in some way | 224 -- calling this implies that the pin is used in some way |
219 if pin then | 225 if pin then |
220 pin:CheckFilterRules() | 226 db.log(pin.title .. ' completed by spell?', IsQuestComplete(pin.questID)) |
227 pin:OnFilters() | |
221 pin.isStale = true | 228 pin.isStale = true |
222 end | 229 end |
223 end | 230 end |
224 | 231 |
225 function Module:SetupCallbacks() | 232 function Module:SetupCallbacks() |
307 end | 314 end |
308 -- re-anchors and scales pins that have had either of these changed due to data loading delays | 315 -- re-anchors and scales pins that have had either of these changed due to data loading delays |
309 function Module:UpdateNext() | 316 function Module:UpdateNext() |
310 --print('|cFF00FF88UpdateNext()') | 317 --print('|cFF00FF88UpdateNext()') |
311 local pin = tremove(db.UpdatedPins) | 318 local pin = tremove(db.UpdatedPins) |
312 pin:CheckFilterRules() | 319 pin:OnFilters() |
313 | 320 |
314 local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1] | 321 local scaleFactor = SCALE_FACTORS[(pin.dataLoaded and not pin.filtered) and scaleConstant or 1] |
315 --print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor) | 322 --print(pin.title, pin.dataLoaded and not pin.filtered, scaleFactor) |
316 if pin.used then | 323 if pin.used then |
317 pin:SetShown(true) | 324 pin:SetShown(true) |
435 numShown = numShown + 1 | 442 numShown = numShown + 1 |
436 if pin.dataLoaded then | 443 if pin.dataLoaded then |
437 numLoaded = numLoaded + 1 | 444 numLoaded = numLoaded + 1 |
438 end | 445 end |
439 | 446 |
447 pin.checkCriteria = true | |
448 pin.checkFilters = true | |
449 pin:Refresh('WORLDMAP_REFRESH ' .. GetTime()) | |
450 | |
440 else | 451 else |
441 if pin:IsShown() then | 452 if pin:IsShown() then |
442 print('|cFFFF4400need to remove', pin.title) | 453 print('|cFFFF4400need to remove', pin.title) |
443 | 454 |
444 end | 455 end |
538 print('layoutDirty =',layoutDirty) | 549 print('layoutDirty =',layoutDirty) |
539 | 550 |
540 for index, info in pairs(taskInfo) do | 551 for index, info in pairs(taskInfo) do |
541 local questID, x, y = info.questId, info.x, info.y | 552 local questID, x, y = info.questId, info.x, info.y |
542 local pin = self:AcquirePin(info) | 553 local pin = self:AcquirePin(info) |
543 | 554 if pin then |
544 if pin.canShow then | 555 if pin.canShow then |
545 pin.used = true | 556 pin.used = true |
546 print('using', pin.title, (pin.owningFrame ~= WorldMapFrame)) | 557 print('using', pin.title, (pin.owningFrame ~= WorldMapFrame)) |
547 if layoutDirty or (pin.owningFrame ~= WorldMapFrame) then | 558 if layoutDirty or (pin.owningFrame ~= WorldMapFrame) then |
548 local scaleFactor = SCALE_FACTORS[(not pin.filtered and scaleConstant) or 1] | 559 local scaleFactor = SCALE_FACTORS[(not pin.filtered and scaleConstant) or 1] |
549 pin.owningFrame = WorldMapFrame | 560 pin.owningFrame = WorldMapFrame |
550 pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor) | 561 pin:SetAnchor(WorldMapPOIFrame, x, y, self.hostWidth, self.hostHeight, scaleFactor) |
551 if pin.isStale then | 562 |
552 pin:Refresh('WORLDMAP_REFRESH ' .. GetTime()) | |
553 end | 563 end |
554 end | 564 if db.QuestsByZone[mapID] then |
555 if db.QuestsByZone[mapID] then | 565 db.QuestsByZone[mapID][questID] = pin |
556 db.QuestsByZone[mapID][questID] = pin | 566 end |
557 end | 567 else |
558 else | 568 print('|cFFFF4400discarding|r', pin.title) |
559 print('|cFFFF4400discarding|r', pin.title) | 569 end |
560 end | 570 end |
561 end | 571 end |
562 end | 572 end |
563 | 573 |
564 -- locates or creates a corresponding pin frame for the provided TaskInfo data | 574 -- locates or creates a corresponding pin frame for the provided TaskInfo data |
565 function Module:AcquirePin (info) | 575 function Module:AcquirePin (info) |
566 local questID = info.questId | 576 local questID = info.questId |
567 if not (questID and QuestUtils_IsQuestWorldQuest(questID)) then | 577 if not (questID and QuestUtils_IsQuestWorldQuest(questID)) then |
568 return nil | 578 return nil |
569 end | 579 end |
580 if IsQuestComplete(questID) then | |
581 return nil | |
582 end | |
583 | |
570 | 584 |
571 local pin = db.QuestsByID[questID] | 585 local pin = db.QuestsByID[questID] |
572 if not pin then | 586 if not pin then |
573 local numFree = #db.FreePins | 587 local numFree = #db.FreePins |
574 if numFree >= 1 then | 588 if numFree >= 1 then |
575 pin = tremove(db.FreePins, numFree) | 589 pin = tremove(db.FreePins, numFree) |
576 print('|cFF00FF00Re-using', pin:GetName()) | 590 print('|cFF00FF00Acquire()|r Re-using', pin:GetName()) |
577 else | 591 else |
578 totalPins = totalPins + 1 | 592 totalPins = totalPins + 1 |
579 local name = 'WorldPlanQuestMarker' .. numOverlays | 593 local name = 'WorldPlanQuestMarker' .. numOverlays |
580 print('|cFF00FF00Creating', name) | 594 print('|cFF00FF00Acquire()|r Creating', name) |
581 pin = CreateFrame('Frame', name, WorldMapPOIFrame, 'WorldPlanQuestPin') | 595 pin = CreateFrame('Frame', name, WorldMapPOIFrame, 'WorldPlanQuestPin') |
582 | 596 |
583 pin:SetID(totalPins) | 597 pin:SetID(totalPins) |
584 numOverlays = numOverlays + 1 | 598 numOverlays = numOverlays + 1 |
585 --pin.iconBorder:SetVertexColor(0,0,0,1) | 599 --pin.iconBorder:SetVertexColor(0,0,0,1) |
586 end | 600 end |
587 pin.questID = questID | 601 pin.questID = questID |
588 pin.worldQuest = true | |
589 pin.throttle = pin.updateRate | 602 pin.throttle = pin.updateRate |
590 pin.isNew = true | |
591 pin.currentWidth = nil | 603 pin.currentWidth = nil |
604 | |
592 db.QuestsByID[questID] = pin | 605 db.QuestsByID[questID] = pin |
593 tinsert(db.UsedPins, pin) | 606 tinsert(db.UsedPins, pin) |
594 end | 607 end |
595 | 608 |
596 if IsQuestComplete(questID) then | 609 if IsQuestComplete(questID) then |
622 else | 635 else |
623 isDataLoaded = false | 636 isDataLoaded = false |
624 end | 637 end |
625 end | 638 end |
626 | 639 |
640 pin:OnFilters() | |
627 pin.isActive = TQ_IsActive(questID) | 641 pin.isActive = TQ_IsActive(questID) |
628 pin:GetCriteriaState() | |
629 pin:CheckFilterRules() | |
630 --rprint(pin:GetID(), pin.filtered, pin.used) | 642 --rprint(pin:GetID(), pin.filtered, pin.used) |
631 return pin | 643 return pin |
632 end | 644 end |
633 | 645 |
634 function Module:Debug(...) | 646 function Module:Debug(...) |