comparison QuestPOI.lua @ 9:a2b623043970 v1.0-rc

WorldQuests: - Filter interface controls reworked: Left-Click toggles inclusive filtering, right-click toggle exclusion, and holding ctrl or shift will flip or reset the other filters of that type respectively. - Fix QuestPOI texture masks disappearing when toggling filter options * new masks aren't applied until SetTexture() is called, making a seemingly redundant call necessary for the change to manifest - Implemented configuration data storage and retrieval; tracking menu options should actually do something now. - Ignore remaining time for Profession quests that aren't part of the player's profession loadout - Alternate tooltip data appears for Pet Battle quests involved in the Family Familar achievement. A list of outstanding criteria is provided in the POI tooltip, and the quest name is highlighted in the filter tooltip. ClassPlan: - actually handle the mission complete icon
author Nenue
date Sun, 23 Oct 2016 17:18:31 -0400
parents 802abb8a10ea
children 4a7e89bffbcb
comparison
equal deleted inserted replaced
8:802abb8a10ea 9:a2b623043970
3 -- Created: 10/1/2016 7:21 PM 3 -- Created: 10/1/2016 7:21 PM
4 -- %file-revision% 4 -- %file-revision%
5 -- 5 --
6 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation 6 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation
7 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes 7 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes
8 local TQ_IsActive = C_TaskQuest.IsActive
8 local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame 9 local QuestPOIGetIconInfo, WorldMapPOIFrame = QuestPOIGetIconInfo, WorldMapPOIFrame
9 10
10 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end 11 local print = DEVIAN_WORKSPACE and function(...) _G.print('WP', ...) end or function() end
11 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end 12 local qprint = DEVIAN_WORKSPACE and function(...) _G.print('POI', ...) end or function() end
12 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end 13 local iprint = DEVIAN_WORKSPACE and function(...) _G.print('ItemScan', ...) end or function() end
13 local QuestPOI = WorldPlanPOIMixin 14 local QuestPOI = WorldPlanPOIMixin
15
16 local ICON_UNKNOWN = "Interface\\ICONS\\inv_misc_questionmark"
17 local ICON_MONEY = "Interface\\Buttons\\UI-GroupLoot-Coin-Up"
18
19 local POI_BORDER_MASK = "Interface\\Minimap\\UI-Minimap-Background"
20 local POI_BORDER_FILL = "Interface\\BUTTONS\\YELLOWORANGE64"
21 local POI_BORDER_BLUE = "Interface\\BUTTONS\\GRADBLUE"
22 local POI_BORDER_RED = "Interface\\BUTTONS\\RedGrad64"
23 local POI_BORDER_YELLOW = "Interface\\BUTTONS\\YELLOWORANGE64"
24 local POI_BORDER_GREEN = "Interface\\BUTTONS\\GREENGRAD64"
14 25
15 local familiars = { 26 local familiars = {
16 [42159] = {npc = 106552, name = 'Nightwatcher Merayl'}, 27 [42159] = {npc = 106552, name = 'Nightwatcher Merayl'},
17 [40277] = {npc = 97804, name = 'Tiffany Nelson'}, 28 [40277] = {npc = 97804, name = 'Tiffany Nelson'},
18 [40298] = {npc = 99182, name = 'Sir Galveston'}, 29 [40298] = {npc = 99182, name = 'Sir Galveston'},
49 r=0, g=1, b=0, 60 r=0, g=1, b=0,
50 continentAlpha = .3, 61 continentAlpha = .3,
51 }, -- 7 days + 1 minute 62 }, -- 7 days + 1 minute
52 } 63 }
53 64
65 -- update a masked texture without messing up its blending mask
66 local SetMaskedTexture = function(region, file, mask)
67 mask = mask or POI_BORDER_MASK
68 region:SetMask(nil)
69 region:SetTexture(file)
70 region:SetMask(mask)
71 end
54 72
55 function QuestPOI:OnEnter() 73 function QuestPOI:OnEnter()
56 local completed = select(4,GetAchievementInfo(familiars_id)) 74 local completed = select(4,GetAchievementInfo(familiars_id))
57 if not completed then 75 if not completed then
58 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then 76 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then
116 end 134 end
117 end 135 end
118 self.x = dX 136 self.x = dX
119 self.y = dY 137 self.y = dY
120 138
121 print(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY)) 139 qprint(' |cFF00FF00'..self.questID..':|r', format("%0.2f %0.2f", dX, dY))
122 140
123 local pX = (dX * mapWidth) 141 local pX = (dX * mapWidth)
124 local pY = (-dY * mapHeight) 142 local pY = (-dY * mapHeight)
125 143
126 self:SetParent(WorldMapPOIFrame) 144 self:SetParent(WorldMapPOIFrame)
196 break 214 break
197 end 215 end
198 end 216 end
199 else 217 else
200 -- remove self in a timely manner 218 -- remove self in a timely manner
201 if not self.isPending then 219 if not TQ_IsActive(self.questID) then
202 self:Hide() 220 print('|cFFFF4400'..self:GetName()..' pin hard timeout')
221 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then
222 self:Hide()
223 end
203 end 224 end
204 end 225 end
205 self.timeThreschold = tl 226 self.timeThreschold = tl
206 227
207 if self:IsMouseOver() then 228 if self:IsMouseOver() then
209 else 230 else
210 self.MouseGlow:Hide() 231 self.MouseGlow:Hide()
211 end 232 end
212 end 233 end
213 234
235
236
237 function QuestPOI:Refresh ()
238 local db = WorldPlan.db
239 local print = qprint
240 print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
241 print(self.style)
242
243
244
245 local questID = self.questId
246 local style = self.style
247 local borderMask = style.mask
248 local borderFill = style.texture
249 local iconBorder = self.iconBorder
250 local icon = self.icon
251 local count = self.count
252
253
254 local subStyle = self.filtered and 'minimized' or 'continent'
255 if subStyle ~= self.subStyle then
256 print( ' - changed subStyle, need to redo masks')
257 end
258 self.subStyle = subStyle
259 print(' - subStyle:', (self.filtered == true), self.subStyle)
260
261 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
262 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
263 icon:SetAllPoints(self)
264
265 if self.itemName then
266 local color = self.rewardColor or COMMON_COLOR
267 if self.itemNumber and self.target then
268 self.count:SetText(color.hex .. tostring(self.itemNumber))
269 else
270 self.count:SetText(nil)
271 end
272 end
273
274 SetMaskedTexture(iconBorder, borderFill, borderMask)
275 local border = (self.rewardType and db.rewardStyle[self.rewardType]) or (WORLD_QUEST_QUALITY_COLORS[self.rarity] or db.defaultStyle)
276 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
277 iconBorder:SetDesaturated(true)
278
279 local trackingBorder = self.supertrackBorder
280
281 self.highlight:SetMask(nil)
282 if questID == GetSuperTrackedQuestID() then
283 trackingBorder:SetVertexColor(0,0,0,1)
284 else
285 trackingBorder:SetVertexColor(0,0,0,0.5)
286 end
287 self.highlight:SetAllPoints(trackingBorder)
288
289 SetMaskedTexture(trackingBorder, borderFill, borderMask)
290 self.highlight:SetMask(borderMask)
291
292 local qType = self.worldQuestType
293 self.tagIcon:SetAtlas(self.tagAtlas)
294 self.tagIcon:SetTexCoord(0,1,0,1)
295
296
297 if self.isElite then
298 self.EliteDecal:Show()
299 else
300 self.EliteDecal:Hide()
301 end
302
303 if style.showNumber then
304 self.label:SetText(self.itemNumber)
305 else
306 self.label:SetText(nil)
307 end
308 qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
309
310
311 self:UpdateSize()
312 end
214 313
215 function WorldPlanFilterPinMixin:OnEnter () 314 function WorldPlanFilterPinMixin:OnEnter ()
216 local filter = WorldPlan.FilterOptions[self:GetID()] 315 local filter = WorldPlan.FilterOptions[self:GetID()]
217 local mapID = GetCurrentMapAreaID() 316 local mapID = GetCurrentMapAreaID()
218 local quests = (mapID == WorldPlan.BrokenIsleID) and WorldPlan.QuestsByID or WorldPlan.QuestsByZone[mapID] 317 local quests = (mapID == WorldPlan.BrokenIsleID) and WorldPlan.QuestsByID or WorldPlan.QuestsByZone[mapID]