Mercurial > wow > worldplan
changeset 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 | 3066f3ef1258 |
files | FlightMap.lua QuestPOI.lua WorldPlan.lua WorldPlan.xml WorldQuests.lua |
diffstat | 5 files changed, 260 insertions(+), 227 deletions(-) [+] |
line wrap: on
line diff
--- a/FlightMap.lua Tue Dec 27 19:46:40 2016 -0500 +++ b/FlightMap.lua Thu Dec 29 13:31:20 2016 -0500 @@ -91,38 +91,40 @@ for i, info in ipairs(taskInfo) do if HaveQuestData(info.questId) then if QuestUtils_IsQuestWorldQuest(info.questId) then - local pin = db.QuestsByID[info.questId] - if not db.QuestsByID[info.questId] then - pin = WorldPlanQuests:AcquirePin(info, zoneMapID) + local pin = WorldPlanQuests:AcquirePin(info, zoneMapID) + if pin then + + print(pin:GetID(), pin.used, pin.filtered) + + if pin.used then + print(i, pin.x, pin.y, pin.used, pin.isNew, pin.isStale, pin:IsShown(), pin:GetAlpha()) + pinsToRemove[info.questId] = nil; + + local frame = self.activePins[info.questId] + if not frame then + frame = self:GetMap():AcquirePin("WorldPlanFlightPin") + print(alpha1, alpha2, alpha3) + print(scale1, scale2, scale3) + frame:SetAlphaLimits(alpha1, alpha2, alpha3) + frame:SetScalingLimits(scale1, scale2, scale3); + frame:SetFrameLevel(1000 + self:GetMap():GetNumActivePinsByTemplate("WorldPlanFlightPin")); + frame:Show() + self.activePins[info.questId] = frame + end + frame:SetPosition(info.x, info.y) + frame.pin = pin + + pin.owningFrame = frame:GetMap() + pin.throttle = 1 + pin.isStale = true + + pin:SetParent(frame) + pin:ClearAllPoints() + pin:SetPoint('CENTER', frame, 'CENTER') + end + pin:SetShown(pin.used) end - pin:IsShowable() - if pin.used then - print(i, pin.x, pin.y, pin.used, pin.isNew, pin.isStale, pin:IsShown(), pin:GetAlpha()) - pinsToRemove[info.questId] = nil; - - local frame = self.activePins[info.questId] - if not frame then - frame = self:GetMap():AcquirePin("WorldPlanFlightPin") - print(alpha1, alpha2, alpha3) - print(scale1, scale2, scale3) - frame:SetAlphaLimits(alpha1, alpha2, alpha3) - frame:SetScalingLimits(scale1, scale2, scale3); - frame:SetFrameLevel(1000 + self:GetMap():GetNumActivePinsByTemplate("WorldPlanFlightPin")); - frame:Show() - self.activePins[info.questId] = frame - end - frame:SetPosition(info.x, info.y) - frame.pin = pin - - pin.owningFrame = frame:GetMap() - pin.isStale = true - pin:SetParent(frame) - pin:ClearAllPoints() - pin:SetPoint('CENTER', frame, 'CENTER') - - end - pin:SetShown(pin.used) end end end @@ -140,9 +142,21 @@ end end + + + function WorldPlanDataProvider:OnEvent() end +function WorldPlanDataPinMixin:OnLoad() + self.UpdateTooltip = self.OnMouseEnter; + + -- Flight points can nudge world quests. + self:SetNudgeTargetFactor(0.015); + self:SetNudgeZoomedOutFactor(1.0); + self:SetNudgeZoomedInFactor(0.25); +end + function WorldPlanDataPinMixin:OnShow() end
--- a/QuestPOI.lua Tue Dec 27 19:46:40 2016 -0500 +++ b/QuestPOI.lua Thu Dec 29 13:31:20 2016 -0500 @@ -25,6 +25,7 @@ local wqprint = DEVIAN_WORKSPACE and function(...) _G.print('WorldQuests', ...) end or function() end local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end local rprint = DEVIAN_WORKSPACE and function(...) _G.print('WQRefresh', ...) end or function() end +local dprint = DEVIAN_WORKSPACE and function(...) _G.print('WQData', ...) end or function() end local QuestPOI = WorldPlanPOIMixin @@ -60,7 +61,7 @@ -- Pin color/display variables db.TooltipExtras = db.TooltipExtras or {} -- idiot-proofing - +db.PinAlpha = 1 local familiars = { [42159] = 'Nightwatcher Merayl', @@ -109,22 +110,18 @@ local _, name, _, completed, _, _, _, _, _, icon = GetAchievementInfo(achievementID) if not completed then - WorldMapTooltip:AddLine(" ") - WorldMapTooltip:AddLine("Achievements:") - WorldMapTooltip:AddLine(' |T'..icon..':20:20|t '..name) - local numItems = GetAchievementNumCriteria(achievementID) local numNeeded = 0 local tooltipLines = {} for i =1, numItems do local criteriaName, criteriaType, completed, _, _, _, _, subAchievementID = GetAchievementCriteriaInfo(achievementID, i) - print(GetAchievementCriteriaInfo(achievementID, i)) + --print(GetAchievementCriteriaInfo(achievementID, i)) if not completed then - print('::', criteriaName, completed, subAchievementID) + --print('::', criteriaName, completed, subAchievementID) if criteriaType == 8 then local _, _, _, completed, _, _, _, _, _, subIcon = GetAchievementInfo(subAchievementID) - print(' -', criteriaName, completed, subIcon) + --print(' -', criteriaName, completed, subIcon) if not completed then local numCompleted = 0 local numSubItems = GetAchievementNumCriteria(subAchievementID) @@ -132,7 +129,7 @@ for j = 1, numSubItems do local subName, _, completed = GetAchievementCriteriaInfo(subAchievementID, j) - print(' -',subName, completed) + --print(' -',subName, completed) if completed then numCompleted = numCompleted + 1 else @@ -154,14 +151,14 @@ end end end - if numNeeded >= 1 then + if hasInfo then + WorldMapTooltip:AddLine(" ") + WorldMapTooltip:AddLine("Achievements:") + WorldMapTooltip:AddLine(' |T'..icon..':20:20|t '..name) for i, line in ipairs(tooltipLines) do WorldMapTooltip:AddLine(line) end - else - WorldMapTooltip:AddLine('Criteria completed!', 0, 1, 0) end - end return hasInfo end @@ -193,13 +190,12 @@ function QuestPOI:OnEnter() if not WorldMapFrame:IsVisible() then WorldMap_HijackTooltip(self.owningFrame) - else - if self.filtered then - return - end + end + if self.filtered then + return end WorldMapTooltip:SetOwner(self, "ANCHOR_RIGHT"); - print('doing tooltip stuff') + --print('doing tooltip stuff') -- Can't add stuff after, so most of the blizzard tooltip hook is simply copied over local questID = self.questID @@ -267,10 +263,10 @@ -- attempt to pull pin data local GetQuestTagInfo, GetProfessionInfo = GetQuestTagInfo, GetProfessionInfo function QuestPOI:GetData () - qprint('|cFF00FF88'..self:GetName()..':GetWorldQuestInfo()|r') + dprint('|cFF00FF88'..self:GetID()..':GetData()|r') local questID = self.questID if not questID then - rprint('|cFFFF4400bad pin|r', self:GetName()) + dprint('|cFFFF4400bad pin|r', self:GetName()) return nil end @@ -278,10 +274,14 @@ -- if the title is nil, then wait and try later if not questTitle then self.isPending = true - rprint('|cFFBB8844nodata|r|cFF00FFFF', self.questId) + dprint('|cFFBB8844isPending=true|r|cFF00FFFF', self.questId) else self.title, self.factionID, self.capped = questTitle, factionID, capped - rprint('|cFFBB8844 data|r|cFF00FFFF', (self.isPending and 'late|r' or 'jit|r'), self.title, '|r', self.factionID) + dprint('|cFFBB8844 data|r|cFF00FFFF', (self.isPending and '|cFFFF4400delayed|r' or '|cFF00FF00success|r'), self.title, '|r', self.factionID) + if self.dataLoaded then + dprint(' |cFFFF4400overwriting data|r') + end + -- set tag details local worldQuestType self.tagID, self.tagName, worldQuestType, self.rarity, self.isElite, self.tradeskillLineIndex = GetQuestTagInfo(questID); @@ -312,6 +312,7 @@ qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) if self.itemTexture and self.itemName and self.title then + self.dataLoaded = true self.isPending = nil self.throttle = 1 self.updateRate = PIN_REFRESH_DELAY @@ -348,9 +349,9 @@ rewardType = REWARD_CASH end - print(' '..self.questID..':|cFFFFFF00SetRewardInfo():', rewardType) + qprint(' '..self.questID..':|cFFFFFF00SetRewardInfo():', numRewards, rewardType) self.itemNumber = tonumber(rewardCount or self.itemNumber) - self.rewardType = rewardType or REWARD_GEAR + self.rewardType = rewardType self.quality = quality self.itemTexture = rewardIcon or self.itemTexture @@ -373,20 +374,15 @@ end -- run from OnShow if .isNew is set -function QuestPOI:OnNew() +function QuestPOI:StartFade() if not self.isAnimating then --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.') self:SetAlpha(0) - if db.Config.FadeWhileGrouped then - self.FadeIn.FadeIn:SetToAlpha(0.15) - self.PendingFade.FadeIn:SetToAlpha(0.15) - self.PendingFade.FadeOut:SetFromAlpha(0.15) - else - self.FadeIn.FadeIn:SetToAlpha(1) - self.PendingFade.FadeIn:SetToAlpha(1) - self.PendingFade.FadeOut:SetFromAlpha(1) - end + self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha) + self.PendingFade.FadeIn:SetToAlpha(db.PinAlpha) + self.PendingFade.FadeOut:SetFromAlpha(db.PinAlpha) + self.isAnimating = true self.isNew = nil self.isStale = true @@ -394,58 +390,73 @@ end end +function QuestPOI:EndFade() + self.isAnimating = nil + self:SetAlpha(db.PinAlpha) +end + function QuestPOI:OnShow () if self.isNew then qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) --qprint('|cFFFFFF00popping new pin handler') - self:OnNew() + self:StartFade() elseif not self.isAnimating then self:SetAlpha(1) -- fix stuck alpha end - if self.isNew or self.isStale then + if self.isStale then + qprint('|cFF0088FFflagged for refresh') self:Refresh() end --WorldPlan:print(self:GetAlpha()) + if not self.Overlay:IsShown() then + self:StartFade() + end + + + self.Overlay:SetShown(true) end function QuestPOI:OnHide() - --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') - if not self:IsShown() then - self.isAnimating = nil - self:SetAlpha(1) - end - + qprint('|cFFFFFF00'..self:GetID()..'r:OnHide()') + self.isAnimating = nil + self:SetAlpha(db.PinAlpha) self.Overlay:SetShown(false) end -function QuestPOI:SetAnchor(frame, mapID, mapWidth, mapHeight) - qprint(' |cFF00FF00'..self:GetName()..':SetAnchor()|r', self.questID, mapID) - self:ClearAllPoints() - local dX, dY = TQ_GetQuestLocation(self.questID) - if not dX or dX == 0 then - local _, x, y = QuestPOIGetIconInfo(self.questID) - if x and floor(x) ~= 0 then - dX, dY = x, y - else - dX, dY = self.x, self.y +local overlayBaseIndex = 1300 +function QuestPOI:SetAnchor(dX, dY, mapWidth, mapHeight) + local oX, oY = self.x, self.y + if not (dX and dY) then + local dX, dY = TQ_GetQuestLocation(self.questID) + if not dX or dX == 0 then + local _, x, y = QuestPOIGetIconInfo(self.questID) + if x and floor(x) ~= 0 then + dX, dY = x, y + else + dX, dY = self.x, self.y + end end end - local oX, oY = self.x, self.y - self.x = dX - self.y = dY - - + if not (mapHeight and mapWidth) then + mapWidth, mapHeight = self:GetParent():GetSize() + end local pX = (dX * mapWidth) local pY = (-dY * mapHeight) - if oX ~= dX then - wqprint(' |cFF00FF00'..self.questID..':|r', oX, dX, format("%0.2f %0.2f", pX, pY)) - end - self:SetParent(WorldMapPOIFrame) - self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY) + self.x = dX + self.y = dY + self:ClearAllPoints() + self:SetPoint('CENTER', self:GetParent(), 'TOPLEFT', pX, pY) + self:SetShown(self.used) + + self.Overlay:SetParent(self:GetParent()) + self.Overlay:ClearAllPoints() + self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4) + self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4) + self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) end function QuestPOI:OnLoad() @@ -489,10 +500,11 @@ -- query for reward data if it wasn't found in the original scan local questID = self.questID if self.isPending then - self:GetData() - if not (self.PendingFade:IsPlaying() or self.isAnimating) then + print('|cFFFF4400'..self:GetID()..':|r polling reward info') + if not (self.isAnimating) then self.PendingFade:Play() end + self:GetData() return else if self.PendingFade:IsPlaying() then @@ -525,12 +537,15 @@ -function QuestPOI:Refresh () - print('|cFF00FF88'..self:GetName()..'|r:Refresh()') +function QuestPOI:Refresh (fromUser) + + --rprint('|c'..(fromUser and 'FF0088FF' or 'FF00FF88' )..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title) + + local styleType = (self.isPending and STYLE_TYPE_PENDING) or self.rewardType local style,subStyle = self:GetTypeInfo(self.rewardType) - if self.filtered then + if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then subStyle = style.minimized end self.style = style @@ -587,11 +602,9 @@ icon:SetVertexColor(style.r, style.g, style.b) end - local borderStyle = style iconBorder:SetMask("Interface\\Minimap\\UI-Minimap-Background") iconBorder:SetTexture(PENDING_BORDER) - - iconBorder:SetVertexColor(borderStyle.r, borderStyle.g, borderStyle.b, 1) + iconBorder:SetVertexColor(style.r, style.g, style.b, 1) iconBorder:SetDesaturated(true) iconBorder:SetAlpha(subStyle.alpha or 1) @@ -599,15 +612,9 @@ trackingBorder:SetTexture(PENDING_BORDER) trackingBorder:SetVertexColor(0,0,0,1) - self.tagIcon:SetShown(self.tagSize and true or false) + self.tagIcon:SetShown((not self.filtered) and true or false) self.tagIcon:SetAtlas(self.tagAtlas) - self.tagIcon:SetAlpha(subStyle.alpha or 1) - self.Overlay:SetShown(true) - self.Overlay:ClearAllPoints(self) - self.Overlay:SetParent(self:GetParent()) - self.Overlay:SetFrameLevel(self:GetFrameLevel()+200) - self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4) - self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4) + self.EliteBorder:SetShown(self.isElite and not self.filtered) @@ -639,7 +646,7 @@ filtered = true end end - return filtered + self.filtered = filtered end function QuestPOI:IsShowable () @@ -647,27 +654,22 @@ local qType = self.worldQuestType if not self.worldQuest then - print('ignoring showable check') + --print('ignoring showable check') return self.used, self.filtered end self.used = TQ_IsActive(self.questID) - if qType == LE_QUEST_TAG_TYPE_PROFESSION then - qprint('hide flags:', (not self.isKnownProfession), (db.Config.ShowAllProfessionQuests == false)) if (not self.isKnownProfession) and (db.Config.ShowAllProfessionQuests == false) then - qprint(self.used) self.used = nil - qprint(self.used) end end - print(' '..self.questID..':|cFFFFFF00IsShowable()|r ', self.used, self.title) - return self.used + rprint(' '..self.questID..':|cFFFFFF00IsShowable()|r ', self.used, self.title) end --- Fixes icons upon size update function QuestPOI:UpdateSize () - qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', self.style, self.subStyle) + --qprint('|cFF00BB88'..self:GetID()..'|r:UpdateSize()', self.style, self.subStyle) local style = self.style local subStyle = self.subStyle
--- a/WorldPlan.lua Tue Dec 27 19:46:40 2016 -0500 +++ b/WorldPlan.lua Thu Dec 29 13:31:20 2016 -0500 @@ -61,7 +61,7 @@ minimized = { r = 0, g = 0, b = 0, a = 0.1, iconWidth = 8, - borderWidth = 1, + borderWidth = 0, alpha = 0.5, highlightWidth = 0, maxAlertLevel = 0, @@ -97,9 +97,90 @@ WorldPlanData[key] = true end end + for _, module in ipairs(db.OrderedModules) do + if module.OnConfigUpdate then + module:OnConfigUpdate() + end + end _G.WorldPlan:Refresh() end +-- insert visual options into the tracking button menu +local DropDown_Initialize = function (self, callback, dropType) + if self ~= WorldMapFrameDropDown then + return + end + local config = WorldPlanData + local info = UIDropDownMenu_CreateInfo() + info.text = "" + info.isTitle = true + UIDropDownMenu_AddButton(info) + info.text = "|cFF00AAFFWorldPlan|r" + info.isTitle = true + UIDropDownMenu_AddButton(info) + info.isTitle = nil + info.disabled = nil + info.keepShownOnClick = true + info.tooltipOnButton = 1 + + info.text = "Enable" + info.isNotRadio = true + info.value = "EnablePins" + info.checked = config.EnablePins + info.tooltipTitle = "Enable World Quest Overlays" + info.tooltipText = "Toggle the detail layers here." + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Display All Profession Quests" + info.isNotRadio = true + info.value = "ShowAllProfessionQuests" + info.checked = config.ShowAllProfessionQuests + info.tooltipTitle = "Hidden Quests" + info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI." + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Show Continent Pins" + info.isNotRadio = true + info.value = "DisplayContinentPins" + info.checked = config.DisplayContinentPins + info.tooltipTitle = "Continent Pins" + info.tooltipText = "Display quest pins on the continent map (may get cramped)." + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Show Summary" + info.isNotRadio = true + info.value = "DisplayContinentSummary" + info.tooltipTitle = "Summary Bar" + info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info." + info.checked = config.DisplayContinentSummary + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + --[[ + + info.text = "Nudge Pins" + info.isNotRadio = true + info.value = "NudgePins" + info.tooltipTitle = "Pin Nudging" + info.tooltipText = "Adjust the position of quest pins that overlap." + info.checked = config.NudgePins + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + + info.text = "Fade Whiled Grouped" + info.isNotRadio = true + info.value = "FadeWhileGrouped" + info.tooltipTitle = "Group Fade" + info.tooltipText = "Reduce pin alpha when grouped, so player dots are easier to see." + info.checked = config.FadeWhileGrouped + info.func = DropDown_OnClick + UIDropDownMenu_AddButton(info) + --]] +end + + function db.print(...) for i = 1, select('#', ...) do tinsert(db.ReportChunks, tostring(select(i, ...))) @@ -292,12 +373,15 @@ if not module.RegisterEvent then module.RegisterEvent = self.RegisterEvent end + if module.OnConfigUpdate then + module:OnConfigUpdate() + end end self.initialized = true - hooksecurefunc("UIDropDownMenu_Initialize", self.OnDropDownInitialize) + hooksecurefunc("UIDropDownMenu_Initialize", DropDown_Initialize) hooksecurefunc("WorldMapTrackingOptionsDropDown_OnClick", function(button) print("|cFF0088FFWorldMapTrackingOptionsDropDown_OnClick|r") @@ -457,80 +541,6 @@ self.isStale = nil end --- insert visual options into the tracking button menu -WorldPlanCore.OnDropDownInitialize = function (self, callback, dropType) - if self ~= WorldMapFrameDropDown then - return - end - local config = WorldPlanData - local info = UIDropDownMenu_CreateInfo() - info.text = "" - info.isTitle = true - UIDropDownMenu_AddButton(info) - info.text = "|cFF00AAFFWorldPlan|r" - info.isTitle = true - UIDropDownMenu_AddButton(info) - info.isTitle = nil - info.disabled = nil - info.keepShownOnClick = true - info.tooltipOnButton = 1 - - info.text = "Enable" - info.isNotRadio = true - info.value = "EnablePins" - info.checked = config.EnablePins - info.tooltipTitle = "Enable World Quest Overlays" - info.tooltipText = "Toggle the detail layers here." - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - - info.text = "Display All Profession Quests" - info.isNotRadio = true - info.value = "ShowAllProfessionQuests" - info.checked = config.ShowAllProfessionQuests - info.tooltipTitle = "Hidden Quests" - info.tooltipText = "Display work order and profession-related quests that are skipped by the default UI." - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - - info.text = "Show Continent Pins" - info.isNotRadio = true - info.value = "DisplayContinentPins" - info.checked = config.DisplayContinentPins - info.tooltipTitle = "Continent Pins" - info.tooltipText = "Display quest pins on the continent map (may get cramped)." - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - - info.text = "Show Summary" - info.isNotRadio = true - info.value = "DisplayContinentSummary" - info.tooltipTitle = "Summary Bar" - info.tooltipText = "Display a summary of active world quests. Note: requires directly viewing Broken Isle and Dalaran maps to gain complete info." - info.checked = config.DisplayContinentSummary - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - --[[ - - info.text = "Nudge Pins" - info.isNotRadio = true - info.value = "NudgePins" - info.tooltipTitle = "Pin Nudging" - info.tooltipText = "Adjust the position of quest pins that overlap." - info.checked = config.NudgePins - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - - info.text = "Fade Whiled Grouped" - info.isNotRadio = true - info.value = "FadeWhileGrouped" - info.tooltipTitle = "Group Fade" - info.tooltipText = "Reduce pin alpha when grouped, so player dots are easier to see." - info.checked = config.FadeWhileGrouped - info.func = DropDown_OnClick - UIDropDownMenu_AddButton(info) - --]] -end -------------------------------------------------------------------------------------------------------------------- -------------------
--- a/WorldPlan.xml Tue Dec 27 19:46:40 2016 -0500 +++ b/WorldPlan.xml Thu Dec 29 13:31:20 2016 -0500 @@ -39,7 +39,7 @@ <Button name="WorldPlanQuestPin" virtual="true" hidden="true" frameStrata="TOOLTIP" mixin="WorldPlanPOIMixin"> <Animations> <AnimationGroup parentKey="FadeIn" setToFinalAlpha="true" looping="NONE"> - <Alpha parentKey="FadeIn" duration="0.15" fromAlpha="0" toAlpha="1" order="1" /> + <Alpha parentKey="FadeIn" duration="0.45" fromAlpha="0" toAlpha="1" order="1" /> <Scripts> <OnPlay> self:GetParent().highlight:Show()
--- 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