comparison QuestPOI.lua @ 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 a2b623043970
children c1612c2c1840
comparison
equal deleted inserted replaced
26:99f6e6ffb2d1 27:4a7e89bffbcb
68 region:SetMask(nil) 68 region:SetMask(nil)
69 region:SetTexture(file) 69 region:SetTexture(file)
70 region:SetMask(mask) 70 region:SetMask(mask)
71 end 71 end
72 72
73 function QuestPOI:OnEnter() 73 function WorldPlanPOIMixin:OnEnter()
74 local completed = select(4,GetAchievementInfo(familiars_id)) 74 local completed = select(4,GetAchievementInfo(familiars_id))
75 if not completed then 75 if not completed then
76 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
77 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT') 77 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT')
78 WorldMapTooltip:AddLine('Family Familiars') 78 WorldMapTooltip:AddLine('Family Familiars')
96 return 96 return
97 end 97 end
98 end 98 end
99 TaskPOI_OnEnter(self) 99 TaskPOI_OnEnter(self)
100 end 100 end
101 function QuestPOI:OnLeave() 101 function WorldPlanPOIMixin:OnLeave()
102 TaskPOI_OnLeave(self) 102 TaskPOI_OnLeave(self)
103 end 103 end
104 function QuestPOI:OnMouseDown() 104 function WorldPlanPOIMixin:OnMouseDown()
105 TaskPOI_OnClick(self) 105 TaskPOI_OnClick(self)
106 end 106 end
107 107
108 108
109 function WorldPlanPOIMixin:SetAchievementProgressTooltip() 109 function WorldPlanPOIMixin:SetAchievementProgressTooltip()
110 print('cheevos') 110 print('cheevos')
111 111
112 112
113 end 113 end
114 114
115 115 function WorldPlanPOIMixin:ShowNew()
116 function QuestPOI:OnShow () 116 self:SetShown(true)
117 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow()') 117 self.isNew = nil
118 self.FadeIn:Play()
119 end
120
121 function WorldPlanPOIMixin:OnShow ()
122 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.hasUpdate, 'new:', self.isNew, 'animation:', self.isAnimating)
123 qprint(debugstack())
118 -- pop this on principle 124 -- pop this on principle
119 self:Refresh() 125 if self.hasUpdate then
120 end 126
121 function QuestPOI:OnHide() 127 self:Refresh()
122 --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') 128 end
123 end 129
124 130 end
125 function QuestPOI:SetAnchor(frame, mapID, mapWidth, mapHeight) 131 function WorldPlanPOIMixin:OnHide()
132 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()')
133 end
134
135 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight)
126 self:ClearAllPoints() 136 self:ClearAllPoints()
127 local dX, dY = TQ_GetQuestLocation(self.questID, mapID) 137 local dX, dY = TQ_GetQuestLocation(self.questID, mapID)
128 if not dX or dX == 0 then 138 if not dX or dX == 0 then
129 local _, x, y = QuestPOIGetIconInfo(self.questID) 139 local _, x, y = QuestPOIGetIconInfo(self.questID)
130 if x and floor(x) ~= 0 then 140 if x and floor(x) ~= 0 then
144 self:SetParent(WorldMapPOIFrame) 154 self:SetParent(WorldMapPOIFrame)
145 self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY) 155 self:SetPoint('CENTER', frame, 'TOPLEFT', pX, pY)
146 end 156 end
147 157
148 158
149 function QuestPOI:OnLoad() 159 function WorldPlanPOIMixin:OnLoad()
160 qprint('|cFF00FF88'..self:GetName()..':OnLoad()|r',WorldPlan.db)
150 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED') 161 self:RegisterEvent('SUPER_TRACKED_QUEST_CHANGED')
151 end 162 self.style = WorldPlan.db.defaultPinStyle
152 163 self.subStyle = WorldPlan.db.defaultPinStyle.continent
153 function QuestPOI:OnEvent(event, ...) 164 end
165
166 function WorldPlanPOIMixin:OnEvent(event, ...)
154 if event == 'SUPER_TRACKED_QUEST_CHANGED' then 167 if event == 'SUPER_TRACKED_QUEST_CHANGED' then
155 if self:IsVisible() then 168 if self:IsVisible() then
156 self:Refresh() 169 self:Refresh()
157 end 170 end
158 end 171 end
159 end 172 end
160 173
161 174
162 local PIN_UPDATE_DELAY = .016 175 local PIN_UPDATE_DELAY = .016
163 local TOP_PIN_ID 176 local TOP_PIN_ID
164 function QuestPOI:OnUpdate (sinceLast) 177 function WorldPlanPOIMixin:OnUpdate (sinceLast)
165 -- control update check intervals 178 -- control update check intervals
166 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast 179 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast
167 if self.throttle <= 0 then 180 if self.throttle <= 0 then
168 -- factor overtime into the throttle timer 181 -- factor overtime into the throttle timer
169 self.throttle = PIN_UPDATE_DELAY - self.throttle 182 self.throttle = PIN_UPDATE_DELAY - self.throttle
232 end 245 end
233 end 246 end
234 247
235 248
236 249
237 function QuestPOI:Refresh () 250 function WorldPlanPOIMixin:Refresh ()
238 local db = WorldPlan.db 251 local db = WorldPlan.db
239 local print = qprint 252 local print = qprint
240 print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) 253 print('|cFF00FF88["'..tostring(self.title)..'"]|r:Refresh()', tostring(self.title), "|T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName))
241 print(self.style) 254 print(self.style)
242 255
243 256
244 257
245 local questID = self.questId 258 local questID = self.questId
246 local style = self.style 259 local style = self.style
260 local subStyle = style[(self.filtered and 'minimized' or 'continent')]
247 local borderMask = style.mask 261 local borderMask = style.mask
248 local borderFill = style.texture 262 local borderFill = style.texture
249 local iconBorder = self.iconBorder 263 local iconBorder = self.iconBorder
250 local icon = self.icon 264 local icon = self.icon
251 local count = self.count 265 local count = self.count
252 266
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 267 self.subStyle = subStyle
268 self.hasNumeric = style.hasNumeric
269 self.numberRGB = style.numberRGB
270 self.showNumber = subStyle.showNumber
271
272
259 print(' - subStyle:', (self.filtered == true), self.subStyle) 273 print(' - subStyle:', (self.filtered == true), self.subStyle)
260 274
261 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName)) 275 --WorldPlan:print(tostring(self.title), "|T"..tostring(self.itemTexture)..":16:16|t", tostring(self.itemName))
262 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask) 276 SetMaskedTexture(icon, self.itemTexture or ICON_UNKNOWN, borderMask)
263 icon:SetAllPoints(self) 277 icon:SetAllPoints(self)
264 278
265 if self.itemName then 279 if self.itemName then
266 local color = self.rewardColor or COMMON_COLOR 280 local color = self.rewardColor or COMMON_COLOR
267 if self.itemNumber and self.target then 281
268 self.count:SetText(color.hex .. tostring(self.itemNumber)) 282
283 self.label:SetShown( self.showNumber)
284 if self.hasNumeric then
285 self.label:SetText(self.itemNumber)
286 self.label:SetTextColor(unpack(self.numberRGB))
269 else 287 else
270 self.count:SetText(nil) 288 self.label:SetText(nil)
271 end 289 end
290
272 end 291 end
273 292
274 SetMaskedTexture(iconBorder, borderFill, borderMask) 293 SetMaskedTexture(iconBorder, borderFill, borderMask)
275 local border = (self.rewardType and db.rewardStyle[self.rewardType]) or (WORLD_QUEST_QUALITY_COLORS[self.rarity] or db.defaultStyle) 294 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) 295 iconBorder:SetVertexColor(border.r, border.g, border.b, border.a)
297 if self.isElite then 316 if self.isElite then
298 self.EliteDecal:Show() 317 self.EliteDecal:Show()
299 else 318 else
300 self.EliteDecal:Hide() 319 self.EliteDecal:Hide()
301 end 320 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 '') 321 qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '')
309 322
310 323
311 self:UpdateSize() 324 self:UpdateSize()
325 self.hasUpdate = nil
312 end 326 end
313 327
314 function WorldPlanFilterPinMixin:OnEnter () 328 function WorldPlanFilterPinMixin:OnEnter ()
315 local filter = WorldPlan.FilterOptions[self:GetID()] 329 local filter = WorldPlan.FilterOptions[self:GetID()]
316 local mapID = GetCurrentMapAreaID() 330 local mapID = GetCurrentMapAreaID()