Mercurial > wow > worldplan
changeset 27:4a7e89bffbcb r27-beta
- Order Hall resource rewards now show numerals in quest pins.
- Fixed an occasional lua error that occurs when opening the quest map for the first time.
- Fixed another source of textures losing their masks.
author | Nenue |
---|---|
date | Thu, 27 Oct 2016 06:18:16 -0400 |
parents | 99f6e6ffb2d1 |
children | 3f4368c4a49b |
files | ClassPlan.lua QuestPOI.lua WorldPlan.lua |
diffstat | 3 files changed, 116 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- a/ClassPlan.lua Tue Oct 25 12:32:34 2016 -0400 +++ b/ClassPlan.lua Thu Oct 27 06:18:16 2016 -0400 @@ -30,13 +30,23 @@ ClassPlanMissionMixin = { templateName = 'ClassPlanMissionEntry', - events = {'GARRISON_MISSION_LIST_UPDATE', 'GARRISON_MISSION_STARTED', 'GARRISON_MISSION_FINISHED', 'GARRISON_LANDINGPAGE_SHIPMENTS'},} + events = { + 'GARRISON_MISSION_LIST_UPDATE', + 'GARRISON_MISSION_STARTED', + 'GARRISON_MISSION_FINISHED', + 'GARRISON_LANDINGPAGE_SHIPMENTS'},} ClassPlanShipmentMixin = { templateName = 'ClassPlanShipmentEntry', parent = false, point = 'TOPRIGHT', relativePoint ='TOPRIGHT', - events = {'GARRISON_LANDINGPAGE_SHIPMENTS', 'GARRISON_TALENT_UPDATE', "GARRISON_TALENT_COMPLETE", "GARRISON_SHIPMENT_RECEIVED"}, + events = { + 'GARRISON_LANDINGPAGE_SHIPMENTS', + 'GARRISON_TALENT_UPDATE', + "GARRISON_TALENT_COMPLETE", + "GARRISON_SHIPMENT_RECEIVED", + 'GARRISON_FOLLOWER_LIST_UPDATE', + 'GARRISON_SHOW_LANDING_PAGE'}, } setmetatable(ClassPlanShipmentMixin, {__index = ClassPlanMissionMixin}) local core, MissionsHandler, ShipmentsHandler = ClassOrderPlanCore, ClassPlanMissionMixin, ClassPlanShipmentMixin
--- a/QuestPOI.lua Tue Oct 25 12:32:34 2016 -0400 +++ b/QuestPOI.lua Thu Oct 27 06:18:16 2016 -0400 @@ -70,7 +70,7 @@ region:SetMask(mask) end -function QuestPOI:OnEnter() +function WorldPlanPOIMixin:OnEnter() local completed = select(4,GetAchievementInfo(familiars_id)) if not completed then if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then @@ -98,10 +98,10 @@ end TaskPOI_OnEnter(self) end -function QuestPOI:OnLeave() +function WorldPlanPOIMixin:OnLeave() TaskPOI_OnLeave(self) end -function QuestPOI:OnMouseDown() +function WorldPlanPOIMixin:OnMouseDown() TaskPOI_OnClick(self) end @@ -112,17 +112,27 @@ end - -function QuestPOI:OnShow () - qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow()') - -- pop this on principle - self:Refresh() -end -function QuestPOI:OnHide() - --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') +function WorldPlanPOIMixin:ShowNew() + self:SetShown(true) + self.isNew = nil + self.FadeIn:Play() end -function QuestPOI:SetAnchor(frame, mapID, mapWidth, mapHeight) +function WorldPlanPOIMixin:OnShow () + qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.hasUpdate, 'new:', self.isNew, 'animation:', self.isAnimating) + qprint(debugstack()) + -- pop this on principle + if self.hasUpdate then + + self:Refresh() + end + +end +function WorldPlanPOIMixin:OnHide() + qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') +end + +function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight) self:ClearAllPoints() local dX, dY = TQ_GetQuestLocation(self.questID, mapID) if not dX or dX == 0 then @@ -146,11 +156,14 @@ end -function QuestPOI:OnLoad() +function WorldPlanPOIMixin:OnLoad() + qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db) self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') + self.style = WorldPlan.db.defaultPinStyle + self.subStyle = WorldPlan.db.defaultPinStyle.continent end -function QuestPOI:OnEvent(event, ...) +function WorldPlanPOIMixin:OnEvent(event, ...) if event == 'SUPER_TRACKED_QUEST_CHANGED' then if self:IsVisible() then self:Refresh() @@ -161,7 +174,7 @@ local PIN_UPDATE_DELAY = .016 local TOP_PIN_ID -function QuestPOI:OnUpdate (sinceLast) +function WorldPlanPOIMixin:OnUpdate (sinceLast) -- control update check intervals self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast if self.throttle <= 0 then @@ -234,7 +247,7 @@ -function QuestPOI:Refresh () +function WorldPlanPOIMixin:Refresh () local db = WorldPlan.db local print = qprint print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) @@ -244,18 +257,19 @@ local questID = self.questId local style = self.style + local subStyle = style[(self.filtered and 'minimized' or 'continent')] local borderMask = style.mask local borderFill = style.texture local iconBorder = self.iconBorder local icon = self.icon local count = self.count + self.subStyle = subStyle + self.hasNumeric = style.hasNumeric + self.numberRGB = style.numberRGB + self.showNumber = subStyle.showNumber - local subStyle = self.filtered and 'minimized' or 'continent' - if subStyle ~= self.subStyle then - print( ' - changed subStyle, need to redo masks') - end - self.subStyle = subStyle + print(' - subStyle:', (self.filtered == true), self.subStyle) --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName)) @@ -264,11 +278,16 @@ if self.itemName then local color = self.rewardColor or COMMON_COLOR - if self.itemNumber and self.target then - self.count:SetText(color.hex .. tostring(self.itemNumber)) + + + self.label:SetShown( self.showNumber) + if self.hasNumeric then + self.label:SetText(self.itemNumber) + self.label:SetTextColor(unpack(self.numberRGB)) else - self.count:SetText(nil) + self.label:SetText(nil) end + end SetMaskedTexture(iconBorder, borderFill, borderMask) @@ -299,16 +318,11 @@ else self.EliteDecal:Hide() end - - if style.showNumber then - self.label:SetText(self.itemNumber) - else - self.label:SetText(nil) - end qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') self:UpdateSize() + self.hasUpdate = nil end function WorldPlanFilterPinMixin:OnEnter ()
--- a/WorldPlan.lua Tue Oct 25 12:32:34 2016 -0400 +++ b/WorldPlan.lua Thu Oct 27 06:18:16 2016 -0400 @@ -86,7 +86,8 @@ r = 1, g = 1, b = 1, x = 0, y = 0, desaturated = true, - mask = POI_BORDER_MASK, + pinMask = POI_BORDER_MASK, + rewardMask = POI_BORDER_MASK, texture = POI_BORDER_FILL, continent = { PinSize = 18, @@ -94,6 +95,7 @@ TrackingBorder = 2, TagSize = 6, TimeleftStage = 3, + showNumber = true, }, zone = { PinSize = 22, @@ -101,6 +103,7 @@ TrackingBorder = 2, TagSize = 12, TimeleftStage = 3, + showNumber = true, }, minimized = { PinSize = 4, @@ -108,6 +111,7 @@ TrackingBorder = 2, NoIcon = true, TimeleftStage = 1, + showNumber = false, } } local POI_REWARD_TYPE = setmetatable({}, { @@ -138,13 +142,16 @@ } POI_REWARD_TYPE[REWARD_ARTIFACT_POWER] = { r = 1, g = .25, b = .5, - showNumber = true, + hasNumeric = true, + numberRGB = {1, 1, 1}, } POI_REWARD_TYPE[REWARD_GEAR] = { r = .1, g = .2, b = 1, } POI_REWARD_TYPE[REWARD_CURRENCY] = { r = 1, g = 1, b = 0, + hasNumeric = true, + numberRGB = {1, 1, 1}, } POI_REWARD_TYPE[REWARD_CASH] = { r = 0, g = 0, b = 0, @@ -160,7 +167,7 @@ defaultPinStyle = POI_DEFAULT_TYPE, rewardStyle = POI_REWARD_TYPE, filterStyle = POI_FILTER_STYLE, - ShowAllProfessionQuests = true, + ShowAllProfessionQuests = false, DisplayContinentSummary = true, DisplayContinentPins = true, NotifyWhenNewQuests = true, @@ -229,6 +236,7 @@ end end) end + print('inserting task #', #tasksQueue+1, func) tinsert(tasksQueue, func) end @@ -337,15 +345,24 @@ self:RegisterEvent("SKILL_LINES_CHANGED") self:RegisterEvent("ARTIFACT_XP_UPDATE") self:RegisterEvent("ADDON_LOADED") + self:SetParent(WorldMapFrame) WorldPlan.modules = { WorldQuests, FilterBar, WorldPlanFlightMapMixin, } end +function WorldPlan:OnShow() + print(self:GetName()..':OnShow()') + if self.isStale then + self:RefreshAll() + end + +end + function WorldPlan:OnEvent (event, ...) print() - print(event, ...) + print(event, self.initialized) if event == 'ADDON_LOADED' then local addon = ... if addon == "Blizzard_FlightMap" then @@ -359,11 +376,12 @@ elseif event == 'WORLD_MAP_UPDATE' then self.currentMapID = GetCurrentMapAreaID() self:RefreshAll() - end - for i, module in ipairs(self.modules) do - if module.OnEvent then - print('forwarding to', tostring(module)) - module:OnEvent(event, ...) + else + for i, module in ipairs(self.modules) do + if module.OnEvent then + print('forwarding to', tostring(module)) + module:OnEvent(event, ...) + end end end end @@ -526,7 +544,7 @@ end function WorldQuests:OnEvent (event, ...) - print('|cFFFFFF00'..tostring(self)..':OnEvent()'..event..'|r', ...) + print('|cFFFFFF00'..tostring(self)..':OnEvent()'..event..'|r', GetTime(), ...) if event == 'QUEST_LOG_UPDATE' then local questID, added = ... if questID and added then @@ -534,6 +552,11 @@ else self:GetPinsForMap() end + print('WorldMapFrame', WorldMapFrame:IsVisible(), 'doRefresh:', hasNewQuestPins) + if WorldMapFrame:IsVisible() and hasNewQuestPins then + self:Refresh(true) + end + elseif event == 'WORLD_QUEST_COMPLETED_BY_SPELL' then local questID = ... if questID and QuestsByID[questID] then @@ -645,16 +668,11 @@ end end end - if hasNewQuestPins and not self.fullSearch then - print('|cFF00FF00NEW PINS DO ANCHOR THINGS') - self:Refresh (true) - hasNewQuestPins = nil - end end -- create or update the pin using the given questID and C_TaskQuest results function WorldQuests:GetPinByQuestID (questID, taskInfo) - if (QuestMapFrame_IsQuestWorldQuest (questID)) then + local questTitle, rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality, _ local pin = self:AcquirePin(questID, taskInfo) @@ -701,7 +719,6 @@ QuestsByFaction[factionID] = QuestsByFaction[factionID] or {} QuestsByFaction[factionID][questID] = pin end - pin.title = questTitle or "|cFFFF0000Retrieving..." pin.factionID = factionID pin.capped = capped @@ -728,7 +745,6 @@ pin.tradeskillLineIndex = tradeskillLineIndex pin.rarity = rarity pin.tagAtlas = tagAtlas - end -- flag unresolved info if not (rewardIcon and rewardName) then @@ -751,6 +767,8 @@ end pin.isPending = nil end + + pin.title = questTitle or "|cFFFF0000Retrieving..." pin.itemTexture = rewardIcon or pin.itemTexture pin.itemName = rewardName or pin.itemName @@ -850,7 +868,6 @@ for questID, pin in pairs(QuestsByID) do -- can we show it? if showQuestPOI and (pin.used) then - pin:Refresh() if fadeGrouped then pin:SetAlpha(0.25) @@ -862,9 +879,7 @@ if not pin.isAnimating then pin.isAnimating = true OnNext(function() - pin.isNew = nil - pin:Show() - pin.FadeIn:Play() + pin:ShowNew() end) if not notifyPlayed then for k,v in pairs(NotificationTypes) do @@ -883,7 +898,8 @@ else -- hard show existing pin print('refresh #', questID, 'filtered:', pin.filtered) - pin:Show() + pin.hasUpdate = true + pin:Show(true) tinsert(debug_show,questID) end else @@ -996,11 +1012,10 @@ --- Fixes icons upon size update function QuestPOI:UpdateSize (style, subStyle) self.style = self.style or POI_DEFAULT_TYPE - self.subStyle = self.subStyle or 'continent' + style = style or self.style + subStyle = subStyle or self.subStyle - style = style or self.style - subStyle = style[subStyle or self.subStyle] - + qprint('|cFF00FF88'..self:GetName()..'|r:UpdateSize()', style, subStyle) self.currentWidth = subStyle.PinSize self.borderSize = subStyle.Border @@ -1009,17 +1024,26 @@ self.TimeleftStage = subStyle.TimeleftStage self.NoIcon = subStyle.NoIcon + self:SetSize(self.currentWidth, self.currentWidth) + local icon = self.icon local iconBorder = self.iconBorder local trackingBorder = self.supertrackBorder local tag = self.tagIcon - local style = self.style or POI_DEFAULT_TYPE - local mask = style.mask or POI_BORDER_FILL + local pinMask = style.pinMask + local rewardMask = style.rewardMask - self.icon:SetMask(nil) - self.iconBorder:SetMask(nil) - self.supertrackBorder:SetMask(nil) + if self.NoIcon then + self.icon:Hide() + else + self.icon:Show() + icon:SetMask(nil) + icon:SetMask(rewardMask) + icon:SetTexture(self.icon:GetTexture()) + end + iconBorder:SetMask(nil) + trackingBorder:SetMask(nil) local borderWidth = self.borderSize @@ -1042,16 +1066,9 @@ end --qprint('using mask:', mask, self.name ) - self.icon:SetMask(mask) - self.icon:SetTexture(self.icon:GetTexture()) - self.iconBorder:SetMask(mask) - self.supertrackBorder:SetMask(mask) + iconBorder:SetMask(pinMask) + trackingBorder:SetMask(pinMask) - if self.NoIcon then - self.icon:Hide() - else - self.icon:Show() - end end @@ -1236,6 +1253,8 @@ self:SetFrameStrata('HIGH') self:SetFrameLevel(151) self:SetScript('OnUpdate', nil) + self.style = db.filterStyle + self.subStyle = db.defaultPinStyle.continent end function FilterPin:OnUpdate ()