Mercurial > wow > worldplan
diff WorldQuests.lua @ 49:dbd81d49af02
- Solve more frame data flagging issues
- Unify method for resolving filter and visibility states
- Flight Map modifications respect filter settings
- Solve initial draw issues with tag icon, filter state handling
- Solve issues with text layer synchronization during map changes
author | Nenue |
---|---|
date | Thu, 29 Dec 2016 13:31:20 -0500 |
parents | c0b88bd1e40b |
children | 6439015d74b1 |
line wrap: on
line diff
--- a/WorldQuests.lua Tue Dec 27 19:46:40 2016 -0500 +++ b/WorldQuests.lua Thu Dec 29 13:31:20 2016 -0500 @@ -59,6 +59,14 @@ hooksecurefunc("WorldMap_UpdateQuestBonusObjectives", function () self:OnUpdateQuestBonusObjectives() end) end +function Module:OnConfigUpdate() + if db.Config.FadeWhileGrouped then + db.PinAlpha = 0.15 + else + db.PinAlpha = 1 + end +end + local InternalHideButton = function(button, index) button:Hide() if button.questID and db.QuestsByID[button.questID] then @@ -117,6 +125,7 @@ end function Module:OnMapInfo() + print('|cFFFFFF00'..self:GetName()..':OnMapInfo()|r visible =', self:IsVisible()) if self:IsVisible() then self:Refresh(true) else @@ -161,7 +170,7 @@ return nil end - + -- if we're grabbing a pin, the filters need to be checked local pin = db.QuestsByID[questID] if not pin then local numFree = #db.FreePins @@ -202,8 +211,16 @@ end end - pin:GetData() - C_TaskQuest.RequestPreloadRewardData(info.questId) + if not pin.dataLoaded then + pin:GetData() + C_TaskQuest.RequestPreloadRewardData(info.questId) + end + + pin:IsFiltered() + pin:IsShowable() + pin.isStale = true + rprint(pin:GetID(), pin.filtered, pin.used) + return pin end @@ -281,7 +298,7 @@ if not itemID then return end - --print('GetRewardHeader', questID) + qprint('GetRewardHeader', questID) scanner:SetOwner(WorldPlan, "ANCHOR_NONE") scanner:SetItemByID(itemID) @@ -314,7 +331,7 @@ quantity = text:match("Item Level ([%d\+]+)") return REWARD_GEAR, icon, quantity, name, itemID, quality elseif text:match("Crafting Reagent") then - --print('|cFFFF4400it is a reagent', text) + qprint('|cFFFF4400it is a reagent', text) return REWARD_REAGENT, icon, quantity, name, itemID, quality end end @@ -323,7 +340,7 @@ if ttl3 then local text = ttl3:GetText() if text and text:match("Crafting Reagent") then - --print('|cFFFF4400it is a reagent', text) + qprint('|cFFFF4400it is a reagent', text) return REWARD_REAGENT, icon, quantity, name, itemID, quality end end @@ -394,7 +411,9 @@ end function Module:Refresh(fromUser) + self.isUserTriggered = fromUser self.currentMapID = GetCurrentMapAreaID() + rprint('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal') print('|cFF00FF88'..self:GetName()..':Refresh()|r', fromUser or '|cFFFFFF00internal') if not self:IsVisible() then print(' not visible, flag for later') @@ -407,10 +426,10 @@ pin.used = nil end - self:SetFilteredPins(db.QuestsByID) self:UpdateAnchors(nil, fromUser) self:Cleanup (fromUser) self.isStale = nil + self.isUserTriggered = nil end -- update visibility states of all pins @@ -418,7 +437,6 @@ print(' |cFFFFFF00'..self:GetName()..':SetFilteredPins()|r', pins) pins = pins or db.QuestsByID for questID, pin in pairs(pins) do - pin.filtered = pin:IsFiltered() pin.isStale = true rprint('|cFF00FF00filter', pin.questID, pin.filtered, 'used:', pin.used) end @@ -433,22 +451,20 @@ end - print('~ ', pin.mapID, pin.questID, pin.title) - rprint('|cFF00FF00update|r', x, y, pin.title) - pin:IsShowable() + --print('~ ', pin.mapID, pin.questID, pin.title) + rprint('|cFF00FF00update|r', x, y, pin.mapID, pin.questID, pin.title) if x and y then - pin.x = x pin.y = y - pin:SetFrameLevel(PinBaseIndex+numPins) - pin:SetPoint('CENTER', self.hostFrame, 'TOPLEFT', self.hostWidth * pin.x, -self.hostHeight * pin.y) + pin.owningFrame = self.hostFrame pin.throttle = 1 - pin:SetShown(pin.used) + + pin:SetParent(self.hostFrame) + pin:SetFrameLevel(PinBaseIndex+pin:GetID()) + pin:SetAnchor(pin.x, pin.y, self.hostWidth, self.hostHeight) tinsert(self.UsedPositions, pin) end - pin.owningFrame = self.hostFrame - pin:SetParent(self.hostFrame) if mapID then if not db.QuestsByZone[mapID] then @@ -459,15 +475,13 @@ end function Module:UpdateMap(taskInfo, mapID) - print('Map', GetMapNameByID(mapID), GetMapNameByID(self.currentMapID)) + rprint('Map', GetMapNameByID(mapID), GetMapNameByID(db.currentMapID)) for index, info in pairs(taskInfo) do self:UpdateQuestButton(info, mapID) end end function Module:UpdateAnchors (fromUser) - - wipe(self.UsedPositions) print(' |cFF00FF00'..self:GetName()..':UpdateAnchors()', fromUser) self.hostFrame = WorldMapPOIFrame @@ -482,23 +496,20 @@ end numPins = 0 - local taskInfo = TQ_GetQuestsForPlayerByMapID(self.currentMapID) + local taskInfo = TQ_GetQuestsForPlayerByMapID(db.currentMapID) if taskInfo then - self:UpdateMap(taskInfo, self.currentMapID) + self:UpdateMap(taskInfo, db.currentMapID) end - local numZones = MC_GetNumZones(self.currentMapID) + local numZones = MC_GetNumZones(db.currentMapID) if numZones then for i = 1, numZones do local mapAreaID = MC_GetZoneInfo(self.currentMapID, i) - local taskInfo = TQ_GetQuestsForPlayerByMapID(mapAreaID, self.currentMapID) + local taskInfo = TQ_GetQuestsForPlayerByMapID(mapAreaID, db.currentMapID) if taskInfo then self:UpdateMap(taskInfo, mapAreaID) end end end - if self.filtersDirty then - self:SetFilteredPins(db.QuestsByID) - end end -- shows, animates, or hides pins based on their current visibility flags @@ -511,7 +522,6 @@ for questID, pin in pairs(db.QuestsByID) do local oV = pin:IsShown() if pin.used then - pin.throttle = 1 if oV == false then print('|cFF00FF00cleanup +|r', questID, pin.title) @@ -520,13 +530,9 @@ if oV == true then print('|cFFFF4400 -|r', questID, pin.title) end + pin.isStale = true + pin:SetShown(false) end - pin:SetShown(pin.used or false) - - if pin.worldQuest and (not C_TaskQuest.IsActive(pin.questID)) then - self:ReleasePin(pin) - end - pin.isStale = true end end