Mercurial > wow > worldplan
comparison QuestPOI.lua @ 35:26dfa661daa7
WorldPlan:
- Quest pins will appear in the flight map. They follow the filter settings applied from the world map.
- Reward filter toggle changed to clear out other reward filters. The assumption being that one is most often looking only for that particular type of quest when they go to use it.
- Fixed filter bar info falling out of sync after player-triggered world map updates.
- Code stuff:
-- Quest pin shown-state management makes better use of OnShow OnHide handlers, SetShown is toggled and it all goes from there
-- WorldQuests module re-factored outside of the top level frame script.
ClassPlan:
- Available missions are now recorded; the mission list can be toggled between in-progress and available by clicking the heading.
author | Nenue |
---|---|
date | Thu, 03 Nov 2016 17:29:15 -0400 |
parents | 0100d923d8c3 |
children | 21bcff08b0f4 |
comparison
equal
deleted
inserted
replaced
34:0100d923d8c3 | 35:26dfa661daa7 |
---|---|
2 -- QuestPOI.lua | 2 -- QuestPOI.lua |
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 | 6 |
7 WorldPlanPOIMixin = {} | |
8 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID | 7 local TQ_GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID -- Return the name of a quest with a given ID |
9 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation | 8 local TQ_GetQuestLocation = C_TaskQuest.GetQuestLocation |
10 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes | 9 local TQ_GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes |
11 local TQ_IsActive = C_TaskQuest.IsActive | 10 local TQ_IsActive = C_TaskQuest.IsActive |
12 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData | 11 local TQ_RequestPreloadRewardData = C_TaskQuest.RequestPreloadRewardData |
166 end | 165 end |
167 return 128, icon, quantity, name, itemID, quality | 166 return 128, icon, quantity, name, itemID, quality |
168 end | 167 end |
169 | 168 |
170 function WorldPlanPOIMixin:OnEnter() | 169 function WorldPlanPOIMixin:OnEnter() |
170 WorldMap_HijackTooltip(self) | |
171 local completed = select(4,GetAchievementInfo(familiars_id)) | 171 local completed = select(4,GetAchievementInfo(familiars_id)) |
172 if not completed then | 172 if not completed then |
173 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then | 173 if self.worldQuestType == LE_QUEST_TAG_TYPE_PET_BATTLE and familiars[self.questID] then |
174 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT') | 174 WorldMapTooltip:SetOwner(self, 'ANCHOR_RIGHT') |
175 WorldMapTooltip:AddLine(self.title, 1, 1, 1) | 175 WorldMapTooltip:AddLine(self.title, 1, 1, 1) |
221 end | 221 end |
222 end | 222 end |
223 TaskPOI_OnEnter(self) | 223 TaskPOI_OnEnter(self) |
224 end | 224 end |
225 function WorldPlanPOIMixin:OnLeave() | 225 function WorldPlanPOIMixin:OnLeave() |
226 WorldMap_RestoreTooltip() | |
226 TaskPOI_OnLeave(self) | 227 TaskPOI_OnLeave(self) |
227 end | 228 end |
228 function WorldPlanPOIMixin:OnMouseDown() | 229 function WorldPlanPOIMixin:OnMouseDown() |
229 TaskPOI_OnClick(self) | 230 TaskPOI_OnClick(self) |
230 end | 231 end |
241 self.floor = info.floor | 242 self.floor = info.floor |
242 self.numObjectives = info.numObjectives or 0 | 243 self.numObjectives = info.numObjectives or 0 |
243 if info.x and info.y then | 244 if info.x and info.y then |
244 self.x = info.x or self.x | 245 self.x = info.x or self.x |
245 self.y = info.y or self.y | 246 self.y = info.y or self.y |
246 qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y) | 247 --qprint('|cFFFF4400applying taskInfo coords:', info.x, info.y) |
247 end | 248 end |
248 | 249 |
249 end | 250 end |
250 | 251 |
251 | 252 |
328 self.itemName = rewardName or self.itemName | 329 self.itemName = rewardName or self.itemName |
329 self.isStale = hasUpdate | 330 self.isStale = hasUpdate |
330 self.isPending = isPending | 331 self.isPending = isPending |
331 | 332 |
332 | 333 |
333 qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending) | 334 --qprint(' |cFF00FFFF'..questID..'|r hasUpdate:', hasUpdate, 'isPending:', isPending, 'isShown', self:IsShown()) |
334 qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID) | 335 --qprint(' ', 'rewardType:', self.rewardType, 'tag:', self.tagID) |
335 qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) | 336 --qprint(' ', tostring(self.title), " |T"..tostring(self.itemTexture)..":12:12|t", tostring(self.itemName)) |
336 end | 337 end |
337 self.cheevos = familiars[self.questID] | 338 self.cheevos = familiars[self.questID] |
338 | 339 |
339 return hasUpdate, isPending | 340 return hasUpdate, isPending |
340 end | 341 end |
344 print('cheevos') | 345 print('cheevos') |
345 end | 346 end |
346 | 347 |
347 -- run from OnShow if .isNew is set | 348 -- run from OnShow if .isNew is set |
348 function WorldPlanPOIMixin:OnNew() | 349 function WorldPlanPOIMixin:OnNew() |
349 self:SetAlpha(0) | 350 |
350 | |
351 if WorldPlan.db.FadeWhileGrouped then | |
352 self.FadeIn.FadeIn:SetToAlpha(0.15) | |
353 self.PendingFade.FadeIn:SetToAlpha(0.15) | |
354 self.PendingFade.FadeIn:SetFromAlpha(0.15) | |
355 else | |
356 self.FadeIn.FadeIn:SetToAlpha(1) | |
357 self.PendingFade.FadeIn:SetToAlpha(1) | |
358 self.PendingFade.FadeIn:SetFromAlpha(1) | |
359 end | |
360 if not self.isAnimating then | 351 if not self.isAnimating then |
352 --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.') | |
353 self:SetAlpha(0) | |
354 if WorldPlan.db.FadeWhileGrouped then | |
355 self.FadeIn.FadeIn:SetToAlpha(0.15) | |
356 self.PendingFade.FadeIn:SetToAlpha(0.15) | |
357 self.PendingFade.FadeOut:SetFromAlpha(0.15) | |
358 else | |
359 self.FadeIn.FadeIn:SetToAlpha(1) | |
360 self.PendingFade.FadeIn:SetToAlpha(1) | |
361 self.PendingFade.FadeOut:SetFromAlpha(1) | |
362 end | |
361 self.isAnimating = true | 363 self.isAnimating = true |
362 WorldPlan:OnNext(function() | 364 self.isNew = nil |
363 self.isNew = nil | 365 self.FadeIn:Play() |
364 self.FadeIn:Play() | |
365 end) | |
366 end | 366 end |
367 end | 367 end |
368 | 368 |
369 function WorldPlanPOIMixin:OnShow () | 369 function WorldPlanPOIMixin:OnShow () |
370 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnShow() update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) | 370 qprint('|cFFFFFF00'..tostring(self:GetName())..':OnShow()|r update:', self.isStale, 'new:', self.isNew, 'animation:', self.isAnimating) |
371 -- pop this on principle | 371 -- pop this on principle |
372 | 372 |
373 if self.isNew or self.isStale then | 373 if self.isNew or self.isStale then |
374 self:Refresh() | 374 self:Refresh() |
375 end | 375 end |
376 | 376 |
377 | 377 |
378 -- is it a new quest? | 378 -- is it a new quest? |
379 if self.isNew then | 379 if self.isNew then |
380 WorldPlan:print('|cFF0088FF', self.title, '|r', self.isNew and 'new', self.isStale and 'stale', self.isAnimating and 'animating') | 380 print('|cFFFFFF00popping new pin handler') |
381 self:OnNew() | 381 self:OnNew() |
382 -- trap new but animating pins here | 382 elseif not self.isAnimating then |
383 else | 383 self:SetAlpha(1) |
384 -- hard show existing self | 384 end |
385 --print('refresh #', questID, 'filtered:', self.filtered, 'hasUpdate', self.hasUpdate) | 385 |
386 self:Show() | 386 --WorldPlan:print(self:GetAlpha()) |
387 end | |
388 | |
389 | 387 |
390 end | 388 end |
391 function WorldPlanPOIMixin:OnHide() | 389 function WorldPlanPOIMixin:OnHide() |
392 qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') | 390 --qprint('|cFFFFFF00["'..tostring(self.title)..'"]|r:OnHide()') |
393 if not self:IsShown() then | 391 if not self:IsShown() then |
394 self.isAnimating = nil | 392 self.isAnimating = nil |
395 self:SetAlpha(0) | 393 self:SetAlpha(1) |
396 end | 394 end |
397 | 395 |
398 end | 396 end |
399 | 397 |
400 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight) | 398 function WorldPlanPOIMixin:SetAnchor(frame, mapID, mapWidth, mapHeight) |
437 | 435 |
438 | 436 |
439 local PIN_UPDATE_DELAY = .016 | 437 local PIN_UPDATE_DELAY = .016 |
440 local TOP_PIN_ID | 438 local TOP_PIN_ID |
441 function WorldPlanPOIMixin:OnUpdate (sinceLast) | 439 function WorldPlanPOIMixin:OnUpdate (sinceLast) |
442 | 440 if self.isNew then |
443 if self.isStale then | 441 print('|cFFFFFF00push new poi stuff') |
444 print('|cFFFFFF00push poi update') | 442 self:OnNew() |
445 self:Refresh() | |
446 return | |
447 end | 443 end |
448 -- control update check intervals | 444 -- control update check intervals |
449 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast | 445 self.throttle = (self.throttle or PIN_UPDATE_DELAY) - sinceLast |
450 if self.throttle <= 0 then | 446 if self.throttle <= 0 then |
451 -- factor overtime into the throttle timer | 447 -- factor overtime into the throttle timer |
452 self.throttle = PIN_UPDATE_DELAY - self.throttle | 448 self.throttle = PIN_UPDATE_DELAY - self.throttle |
453 else | 449 else |
450 return | |
451 end | |
452 if self.isStale and not self.isAnimating then | |
453 print('|cFFFFFF00push poi update') | |
454 self:Refresh() | |
454 return | 455 return |
455 end | 456 end |
456 | 457 |
457 -- query for reward data if it wasn't found in the original scan | 458 -- query for reward data if it wasn't found in the original scan |
458 local questID = self.questID | 459 local questID = self.questID |
503 print('|cFF00FF88'..self:GetName()..'|r:Refresh()') | 504 print('|cFF00FF88'..self:GetName()..'|r:Refresh()') |
504 | 505 |
505 | 506 |
506 | 507 |
507 local questID = self:GetID() | 508 local questID = self:GetID() |
508 local style,subStyle = self:GetTypeInfo(self.rewardType) | 509 local style,subStyle = WorldPlanQuests:GetTypeInfo(self.rewardType) |
509 if self.filtered then | 510 if self.filtered then |
510 subStyle = style.minimized | 511 subStyle = style.minimized |
511 end | 512 end |
512 self.style = style | 513 self.style = style |
513 self.subStyle = subStyle | 514 self.subStyle = subStyle |
580 --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') | 581 --qprint('|cFF88FF00updated', questID, self.title, self.rewardType, (style.showNumber and self.itemNumber) or '') |
581 --print(' - subStyle:', (self.filtered == true), self.subStyle) | 582 --print(' - subStyle:', (self.filtered == true), self.subStyle) |
582 | 583 |
583 | 584 |
584 self:UpdateSize() | 585 self:UpdateSize() |
586 | |
585 self.isStale = nil | 587 self.isStale = nil |
586 end | 588 |
587 | 589 end |
588 | 590 |
591 local cvar_check = { | |
592 [REWARD_CASH] = 'worldQuestFilterGold', | |
593 [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower', | |
594 [REWARD_CURRENCY] = 'worldQuestFilterOrderResources', | |
595 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', | |
596 [REWARD_GEAR] = 'worldQuestFilterEquipment', | |
597 } | |
589 | 598 |
590 | 599 |
591 function QuestPOI:IsShowable () | 600 function QuestPOI:IsShowable () |
592 local print = wqprint | 601 local print = wqprint |
593 local db = WorldPlan.db | 602 local db = WorldPlan.db |
596 self.filtered = nil | 605 self.filtered = nil |
597 self.used = true | 606 self.used = true |
598 | 607 |
599 | 608 |
600 self.questId = self:GetID() | 609 self.questId = self:GetID() |
601 if not (WorldMap_DoesWorldQuestInfoPassFilters(self, false, true)) then | 610 if self.rewardType then |
602 self.filtered = true | 611 if cvar_check[self.rewardType] and not GetCVarBool(cvar_check[self.rewardType]) then |
603 end | |
604 | |
605 for filterKey, value in pairs(WorldPlan.UsedFilters) do | |
606 if self[filterKey] ~= value then | |
607 self.filtered = true | 612 self.filtered = true |
613 end | |
614 else | |
615 for filterKey, value in pairs(WorldPlan.UsedFilters) do | |
616 if self[filterKey] ~= value then | |
617 self.filtered = true | |
618 end | |
608 end | 619 end |
609 end | 620 end |
610 | 621 |
611 if not TQ_IsActive(self.questID) then | 622 if not TQ_IsActive(self.questID) then |
612 self.used = nil | 623 self.used = nil |
676 tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth) | 687 tag:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', borderWidth, -borderWidth) |
677 else | 688 else |
678 tag:Hide() | 689 tag:Hide() |
679 end | 690 end |
680 | 691 |
681 --qprint('using mask:', mask, self.name ) | 692 qprint('using mask:', pinMask, self.name ) |
682 iconBorder:SetMask(pinMask) | 693 iconBorder:SetMask(pinMask) |
683 trackingBorder:SetMask(pinMask) | 694 trackingBorder:SetMask(pinMask) |
684 end | 695 iconBorder:SetTexture(iconBorder:GetTexture()) |
696 trackingBorder:SetTexture(trackingBorder:GetTexture()) | |
697 end |