Mercurial > wow > worldplan
comparison WorldQuests.lua @ 103:8cdd62e7a224
- Solved the quest pins remaining visible issue
| author | Nenue |
|---|---|
| date | Sun, 28 May 2017 19:50:42 -0400 |
| parents | fbd4ead2a19f |
| children | 9f664a0ef8a8 |
comparison
equal
deleted
inserted
replaced
| 101:b68af1e44bdc | 103:8cdd62e7a224 |
|---|---|
| 43 local SCALE_FACTORS = { 0.25, 0.7, 1 } | 43 local SCALE_FACTORS = { 0.25, 0.7, 1 } |
| 44 | 44 |
| 45 local BountyBoard = WorldMapFrame.UIElementsFrame.BountyBoard | 45 local BountyBoard = WorldMapFrame.UIElementsFrame.BountyBoard |
| 46 local ActionButton = WorldMapFrame.UIElementsFrame.ActionButton | 46 local ActionButton = WorldMapFrame.UIElementsFrame.ActionButton |
| 47 local defaults = {} | 47 local defaults = {} |
| 48 local completedQuests = {} | |
| 48 | 49 |
| 49 local continentScanned | 50 local continentScanned |
| 50 local layoutDirty = true | 51 local layoutDirty = true |
| 51 local bountiesDirty = true | 52 local bountiesDirty = true |
| 52 local artifactPowerDirty = true | 53 local artifactPowerDirty = true |
| 133 if (event == 'QUEST_LOG_UPDATE') then | 134 if (event == 'QUEST_LOG_UPDATE') then |
| 134 self:UpdateBounties(event) | 135 self:UpdateBounties(event) |
| 135 elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then | 136 elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then |
| 136 local questID = ... | 137 local questID = ... |
| 137 if questID and db.QuestsByID[questID] then | 138 if questID and db.QuestsByID[questID] then |
| 139 completedQuests[questID] = true | |
| 138 db.QuestsByID[questID]:Release() | 140 db.QuestsByID[questID]:Release() |
| 139 end | 141 end |
| 140 self:Refresh(event) | 142 self:Refresh(event) |
| 141 elseif event == 'SKILL_LINES_CHANGED' or event == 'CURRENT_SPELL_CAST_CHANGED' then | 143 elseif event == 'SKILL_LINES_CHANGED' or event == 'CURRENT_SPELL_CAST_CHANGED' then |
| 142 self:Refresh(event) | 144 self:Refresh(event) |
| 329 pin.isStale = true | 331 pin.isStale = true |
| 330 end | 332 end |
| 331 end | 333 end |
| 332 | 334 |
| 333 function Module:UpdateBounties(...) | 335 function Module:UpdateBounties(...) |
| 334 print('|cFF00FF88BountyInfo()|r', ...) | 336 bountiesDirty = nil |
| 337 print('|cFF00FF88BountyInfo()|r', ...) | |
| 335 wipe(db.BountiesByFactionID) | 338 wipe(db.BountiesByFactionID) |
| 336 wipe(db.BountiesByQuestID) | 339 wipe(db.BountiesByQuestID) |
| 337 | 340 |
| 338 db.selectedBounty = nil | 341 db.selectedBounty = nil |
| 339 selectedBountyIndex = BountyBoard:GetSelectedBountyIndex() | 342 selectedBountyIndex = BountyBoard:GetSelectedBountyIndex() |
| 351 selectedBountyQuestID = info.questID | 354 selectedBountyQuestID = info.questID |
| 352 end | 355 end |
| 353 print(' ', index, info.factionID, GetQuestLogTitle(GetQuestLogIndexByID(info.questID)), info.complete, (index == selectedBountyIndex) and 'SELECTED' or '') | 356 print(' ', index, info.factionID, GetQuestLogTitle(GetQuestLogIndexByID(info.questID)), info.complete, (index == selectedBountyIndex) and 'SELECTED' or '') |
| 354 end | 357 end |
| 355 end | 358 end |
| 356 bountiesDirty = nil | |
| 357 end | 359 end |
| 358 | 360 |
| 359 -- check current artifact knowledge and update pins accordingly | 361 -- check current artifact knowledge and update pins accordingly |
| 360 function Module:UpdateArtifactPower(overrideLevel) | 362 function Module:UpdateArtifactPower(overrideLevel) |
| 361 if InCombatLockdown() then | 363 if InCombatLockdown() then |
| 408 end | 410 end |
| 409 lastRefresh = GetTime() | 411 lastRefresh = GetTime() |
| 410 print(msg, lastRefresh, ...) | 412 print(msg, lastRefresh, ...) |
| 411 end | 413 end |
| 412 | 414 |
| 415 | |
| 416 if bountiesDirty then | |
| 417 self:UpdateBounties() | |
| 418 end | |
| 419 | |
| 413 if not db.Config.EnablePins then | 420 if not db.Config.EnablePins then |
| 414 numShown = 0 | 421 numShown = 0 |
| 415 self.refreshBenchMark = GetTime() | 422 self.refreshBenchMark = GetTime() |
| 416 self.refreshBenchMarkTicker = 2 | 423 self.refreshBenchMarkTicker = 2 |
| 417 print('starting bench', self.refreshBenchMark) | 424 print('starting bench', self.refreshBenchMark) |
| 575 function Module:AcquirePin (info) | 582 function Module:AcquirePin (info) |
| 576 local questID = info.questId | 583 local questID = info.questId |
| 577 if not (questID and QuestUtils_IsQuestWorldQuest(questID)) then | 584 if not (questID and QuestUtils_IsQuestWorldQuest(questID)) then |
| 578 return nil | 585 return nil |
| 579 end | 586 end |
| 580 if IsQuestComplete(questID) then | 587 local pin = db.QuestsByID[questID] |
| 588 -- check to avoid creating unnecessary frames | |
| 589 if IsQuestComplete(questID) or completedQuests[questID] then | |
| 590 completedQuests[questID] = true | |
| 591 if pin then | |
| 592 pin:Release() | |
| 593 end | |
| 581 return nil | 594 return nil |
| 582 end | 595 end |
| 583 | 596 |
| 584 | |
| 585 local pin = db.QuestsByID[questID] | |
| 586 if not pin then | 597 if not pin then |
| 587 local numFree = #db.FreePins | 598 local numFree = #db.FreePins |
| 588 if numFree >= 1 then | 599 if numFree >= 1 then |
| 589 pin = tremove(db.FreePins, numFree) | 600 pin = tremove(db.FreePins, numFree) |
| 590 print('|cFF00FF00Acquire()|r Re-using', pin:GetName()) | 601 print('|cFF00FF00Acquire()|r Re-using', pin:GetName()) |
| 604 | 615 |
| 605 db.QuestsByID[questID] = pin | 616 db.QuestsByID[questID] = pin |
| 606 tinsert(db.UsedPins, pin) | 617 tinsert(db.UsedPins, pin) |
| 607 end | 618 end |
| 608 | 619 |
| 609 if IsQuestComplete(questID) then | 620 if info then |
| 610 pin:Release() | |
| 611 return nil | |
| 612 elseif info then | |
| 613 pin.inProgress = info.inProgress | 621 pin.inProgress = info.inProgress |
| 614 pin.floor = info.floor | 622 pin.floor = info.floor |
| 615 pin.numObjectives = info.numObjectives or 0 | 623 pin.numObjectives = info.numObjectives or 0 |
| 616 if info.x and info.y then | 624 if info.x and info.y then |
| 617 if (info.x ~= pin.x) or (info.y ~= pin.y) then | 625 if (info.x ~= pin.x) or (info.y ~= pin.y) then |
