Mercurial > wow > worldplan
comparison QuestPOI.lua @ 57:54aa7f8ebca8 v1.0-release
- fix profession quests showing when not enabled
- fix profession quest time borders always coloring as urgent
| author | Nenue |
|---|---|
| date | Fri, 20 Jan 2017 19:57:13 -0500 |
| parents | 0749e38081e7 |
| children | bc09961d5a98 |
comparison
equal
deleted
inserted
replaced
| 56:0749e38081e7 | 57:54aa7f8ebca8 |
|---|---|
| 189 end | 189 end |
| 190 | 190 |
| 191 local GetFactionInfoByID, GetQuestObjectiveInfo = GetFactionInfoByID, GetQuestObjectiveInfo | 191 local GetFactionInfoByID, GetQuestObjectiveInfo = GetFactionInfoByID, GetQuestObjectiveInfo |
| 192 | 192 |
| 193 function QuestPOI:OnEnter() | 193 function QuestPOI:OnEnter() |
| 194 if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then | |
| 195 return | |
| 196 end | |
| 194 WorldMap_HijackTooltip(self.owningFrame); | 197 WorldMap_HijackTooltip(self.owningFrame); |
| 195 if self.filtered then | |
| 196 return | |
| 197 end | |
| 198 self:SetFrameLevel(pinBaseIndex+100) | 198 self:SetFrameLevel(pinBaseIndex+100) |
| 199 self.Overlay:SetFrameLevel(pinBaseIndex+101) | 199 self.Overlay:SetFrameLevel(pinBaseIndex+101) |
| 200 | 200 |
| 201 if previousHighlight then | 201 if previousHighlight then |
| 202 previousHighlight:SetFrameLevel(pinBaseIndex+previousHighlight:GetID()) | 202 previousHighlight:SetFrameLevel(pinBaseIndex+previousHighlight:GetID()) |
| 265 --WorldMapTooltip.recalculatePadding = true; | 265 --WorldMapTooltip.recalculatePadding = true; |
| 266 --print(WorldMapTooltip:GetParent()) | 266 --print(WorldMapTooltip:GetParent()) |
| 267 --print(WorldMapTooltip:IsVisible()) | 267 --print(WorldMapTooltip:IsVisible()) |
| 268 end | 268 end |
| 269 function QuestPOI:OnLeave() | 269 function QuestPOI:OnLeave() |
| 270 if self.filtered and (self.questID ~= GetSuperTrackedQuestID()) then | |
| 271 return | |
| 272 end | |
| 270 WorldMap_RestoreTooltip() | 273 WorldMap_RestoreTooltip() |
| 271 self.MouseGlow:Hide() | 274 self.MouseGlow:Hide() |
| 272 WorldMapTooltip:Hide(); | 275 WorldMapTooltip:Hide(); |
| 273 end | 276 end |
| 274 | 277 |
| 422 --qprint('|cFFFFFF00popping new pin handler') | 425 --qprint('|cFFFFFF00popping new pin handler') |
| 423 self:StartFade() | 426 self:StartFade() |
| 424 end | 427 end |
| 425 | 428 |
| 426 if not self.isAnimating then | 429 if not self.isAnimating then |
| 427 self:SetAlpha(1) -- fix stuck alpha | 430 self:SetAlpha(db.PinAlpha) -- fix stuck alpha |
| 428 end | 431 end |
| 429 self.Overlay:SetShown(true) | 432 self.Overlay:SetShown(true) |
| 430 end | 433 end |
| 431 function QuestPOI:OnHide() | 434 function QuestPOI:OnHide() |
| 432 qprint('|cFFFFFF00'..self:GetID()..'r:OnHide()') | 435 qprint('|cFFFFFF00'..self:GetID()..'r:OnHide()') |
| 433 self.isAnimating = nil | 436 self.isAnimating = nil |
| 434 self:SetAlpha(db.PinAlpha) | 437 self:SetAlpha(db.PinAlpha) |
| 435 self.Overlay:SetShown(false) | 438 self.Overlay:SetShown(false) |
| 436 end | 439 end |
| 437 | 440 |
| 441 -- different from owningFrame | |
| 438 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight) | 442 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight) |
| 439 wqprint(self:GetName()..':SetAnchor', self.filtered, self.used) | 443 wqprint(self:GetName()..':SetAnchor', self.filtered, self.used) |
| 440 self:SetParent(owner) | 444 self:SetParent(owner) |
| 441 self:ClearAllPoints() | 445 self:ClearAllPoints() |
| 442 self:SetFrameLevel(pinBaseIndex + self:GetID()) | 446 self:SetFrameLevel(pinBaseIndex + self:GetID()) |
| 467 self.Description = self.Overlay.Description | 471 self.Description = self.Overlay.Description |
| 468 self.timeLabel = self.Overlay.timeLabel | 472 self.timeLabel = self.Overlay.timeLabel |
| 469 self.updateRate = PIN_REQUEST_DELAY | 473 self.updateRate = PIN_REQUEST_DELAY |
| 470 self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r' | 474 self.itemName = '|cFF0088FF' .. RETRIEVING_DATA..'|r' |
| 471 | 475 |
| 472 self:SetScript('OnMouseDown', TaskPOI_OnClick) | |
| 473 | |
| 474 self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4) | 476 self.Overlay:SetPoint('TOPLEFT', self, 'TOPLEFT', 0, 4) |
| 475 self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4) | 477 self.Overlay:SetPoint('BOTTOMRIGHT', self, 'BOTTOMRIGHT', 0, -4) |
| 476 end | 478 end |
| 479 function QuestPOI:OnMouseDown(button) | |
| 480 if button == 'RightButton' then | |
| 481 SetSuperTrackedQuestID(nil) | |
| 482 else | |
| 483 TaskPOI_OnClick(self, button) | |
| 484 end | |
| 485 end | |
| 486 | |
| 477 | 487 |
| 478 function QuestPOI:OnEvent(event, ...) | 488 function QuestPOI:OnEvent(event, ...) |
| 479 if event == 'SUPER_TRACKED_QUEST_CHANGED' then | 489 if event == 'SUPER_TRACKED_QUEST_CHANGED' then |
| 480 self.isStale = true | 490 self.isStale = true |
| 481 end | 491 end |
| 534 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then | 544 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then |
| 535 self:SetShown(false) | 545 self:SetShown(false) |
| 536 end | 546 end |
| 537 end | 547 end |
| 538 | 548 |
| 539 if timeLeft and (timeLeft < 120) then | 549 if tl and (timeLeft < 120) then |
| 540 self.HighlightBorder:SetVertexColor(1,0,0,0.7) | 550 self.HighlightBorder:SetVertexColor(1,0,0,0.7) |
| 541 elseif self.isBounty then | 551 elseif self.isBounty then |
| 542 self.HighlightBorder:SetVertexColor(.25,.5,1,1) | 552 self.HighlightBorder:SetVertexColor(.25,.5,1,1) |
| 543 else | 553 else |
| 544 self.HighlightBorder:SetVertexColor(0,0,0,0.7) | 554 self.HighlightBorder:SetVertexColor(0,0,0,0.7) |
| 548 self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1)) | 558 self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1)) |
| 549 end | 559 end |
| 550 | 560 |
| 551 function QuestPOI:Refresh (fromUser) | 561 function QuestPOI:Refresh (fromUser) |
| 552 | 562 |
| 553 --rprint('|c'..(fromUser and 'FF0088FF' or 'FF00FF88' )..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title) | 563 rprint('|c'..(fromUser and 'FF0088FF' or 'FF00FF88' )..self:GetID()..'|r:Refresh() type =', self.rewardType, 'title =', self.title) |
| 554 | 564 |
| 555 | 565 |
| 556 | 566 |
| 557 local styleType = (self.isPending and STYLE_TYPE_PENDING) or self.rewardType | 567 local styleType = (self.isPending and STYLE_TYPE_PENDING) or self.rewardType |
| 558 local style,subStyle = self:GetTypeInfo(self.rewardType) | 568 local style,subStyle = self:GetTypeInfo(self.rewardType) |
| 567 self.highlightWidth = subStyle.highlightWidth | 577 self.highlightWidth = subStyle.highlightWidth |
| 568 self.tagSize = subStyle.TagSize | 578 self.tagSize = subStyle.TagSize |
| 569 self.maxAlertLevel = subStyle.maxAlertLevel | 579 self.maxAlertLevel = subStyle.maxAlertLevel |
| 570 self.NoIcon = subStyle.NoIcon | 580 self.NoIcon = subStyle.NoIcon |
| 571 | 581 |
| 572 local questID = self:GetID() | 582 local questID = self.questID |
| 573 local iconBorder = self.RewardBorder | 583 local iconBorder = self.RewardBorder |
| 574 local trackingBorder = self.HighlightBorder | 584 local trackingBorder = self.HighlightBorder |
| 575 local icon = self.icon | 585 local icon = self.icon |
| 576 local count = self.count | 586 local count = self.count |
| 577 self.isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID) | 587 self.isBounty = WorldMapFrame.UIElementsFrame.BountyBoard:IsWorldQuestCriteriaForSelectedBounty(self.questID) |
| 637 self.EliteBorder:SetShown(self.isElite and not self.filtered) | 647 self.EliteBorder:SetShown(self.isElite and not self.filtered) |
| 638 | 648 |
| 639 self:UpdateSize() | 649 self:UpdateSize() |
| 640 self:UpdateStatus() | 650 self:UpdateStatus() |
| 641 self.isStale = nil | 651 self.isStale = nil |
| 652 | |
| 653 -- signal filter info update | |
| 654 WorldPlanSummary.isStale = true | |
| 642 end | 655 end |
| 643 | 656 |
| 644 local cvar_check = { | 657 local cvar_check = { |
| 645 [REWARD_CASH] = 'worldQuestFilterGold', | 658 [REWARD_CASH] = 'worldQuestFilterGold', |
| 646 [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower', | 659 [REWARD_ARTIFACT_POWER] = 'worldQuestFilterArtifactPower', |
| 647 [REWARD_CURRENCY] = 'worldQuestFilterOrderResources', | 660 [REWARD_CURRENCY] = 'worldQuestFilterOrderResources', |
| 648 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', | 661 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', |
| 649 [REWARD_GEAR] = 'worldQuestFilterEquipment', | 662 [REWARD_GEAR] = 'worldQuestFilterEquipment', |
| 650 } | 663 } |
| 651 | 664 |
| 652 | 665 function QuestPOI:CheckFilterRules () |
| 653 function QuestPOI:IsFiltered () | |
| 654 local filtered | |
| 655 local usingFilters | |
| 656 for filterKey, value in pairs(db.UsedFilters) do | |
| 657 usingFilters = true | |
| 658 print('|cFFFF4400', filterKey, self[filterKey]) | |
| 659 if self[filterKey] ~= value then | |
| 660 filtered = true | |
| 661 end | |
| 662 end | |
| 663 if self.rewardType and cvar_check[self.rewardType] then | |
| 664 if not GetCVarBool(cvar_check[self.rewardType]) then | |
| 665 filtered = true | |
| 666 end | |
| 667 end | |
| 668 self.filtered = filtered | |
| 669 end | |
| 670 | |
| 671 function QuestPOI:IsShowable () | |
| 672 local print = qprint | 666 local print = qprint |
| 673 local qType = self.worldQuestType | 667 local qType = self.worldQuestType |
| 674 | 668 local filtered |
| 675 if not self.worldQuest then | 669 local canShow = TQ_IsActive(self.questID) |
| 676 --print('ignoring showable check') | |
| 677 return self.used, self.filtered | |
| 678 end | |
| 679 self.used = TQ_IsActive(self.questID) | |
| 680 if SpellCanTargetQuest() then | 670 if SpellCanTargetQuest() then |
| 681 -- hiding so player can click a valid target | 671 -- hiding so player can click a valid target |
| 682 self.used = nil | 672 self.used = nil |
| 683 elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then | 673 elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then |
| 684 if (not self.isKnownProfession) and (db.Config.ShowAllProfessionQuests == false) then | 674 if not(self.isKnownProfession or db.Config.ShowAllProfessionQuests) then |
| 685 self.used = nil | 675 canShow = nil |
| 686 end | 676 end |
| 687 end | 677 end |
| 688 rprint(' '..self.questID..':|cFFFFFF00IsShowable()|r ', self.used, self.title) | 678 if canShow then |
| 679 for filterKey, value in pairs(db.UsedFilters) do | |
| 680 if self[filterKey] ~= value then | |
| 681 if not self.filtered then | |
| 682 print('|cFFFF4400filtering', filterKey, value, '~=', self[filterKey], self.title) | |
| 683 end | |
| 684 | |
| 685 filtered = true | |
| 686 end | |
| 687 end | |
| 688 if self.rewardType and cvar_check[self.rewardType] then | |
| 689 if not GetCVarBool(cvar_check[self.rewardType]) then | |
| 690 filtered = true | |
| 691 end | |
| 692 end | |
| 693 if canShow and self.filtered ~= filtered then | |
| 694 self.isStale = true | |
| 695 print(' '..self.questID..':|cFFFFFF00CheckFilterRules()|r ', canShow, filtered, self.title) | |
| 696 end | |
| 697 | |
| 698 self.filtered = filtered | |
| 699 end | |
| 700 | |
| 701 self.used = canShow | |
| 702 | |
| 703 | |
| 689 end | 704 end |
| 690 | 705 |
| 691 --- Fixes icons upon size update | 706 --- Fixes icons upon size update |
| 692 function QuestPOI:UpdateSize () | 707 function QuestPOI:UpdateSize () |
| 693 | 708 |
| 707 | 722 |
| 708 | 723 |
| 709 self:SetSize(highlightWidth, highlightWidth) | 724 self:SetSize(highlightWidth, highlightWidth) |
| 710 if self.questID == GetSuperTrackedQuestID() then | 725 if self.questID == GetSuperTrackedQuestID() then |
| 711 highlightWidth = highlightWidth + 2 | 726 highlightWidth = highlightWidth + 2 |
| 727 if self.filtered then | |
| 728 self:SetAlpha(db.PinAlpha * 0.5) | |
| 729 else | |
| 730 self:SetAlpha(db.PinAlpha) | |
| 731 end | |
| 732 | |
| 712 end | 733 end |
| 713 | 734 |
| 714 if self.rarity and WORLD_QUEST_QUALITY_COLORS[self.rarity] then | 735 if self.rarity and WORLD_QUEST_QUALITY_COLORS[self.rarity] then |
| 715 highlightWidth = highlightWidth + self.rarity | 736 highlightWidth = highlightWidth + self.rarity |
| 716 end | 737 end |
