Mercurial > wow > worldplan
comparison QuestPOI.lua @ 69:31de7e9e7849
stop hiding pins when the timeleft returns 0; use C_TQ.IsActive
| author | Nenue |
|---|---|
| date | Wed, 05 Apr 2017 11:36:06 -0400 |
| parents | 96183f981acb |
| children | d6c0bed32c51 |
comparison
equal
deleted
inserted
replaced
| 68:cce68795f955 | 69:31de7e9e7849 |
|---|---|
| 57 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD | 57 local REWARD_CASH = WORLD_QUEST_REWARD_TYPE_FLAG_GOLD |
| 58 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER | 58 local REWARD_ARTIFACT_POWER = WORLD_QUEST_REWARD_TYPE_FLAG_ARTIFACT_POWER |
| 59 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT | 59 local REWARD_GEAR = WORLD_QUEST_REWARD_TYPE_FLAG_EQUIPMENT |
| 60 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES | 60 local REWARD_CURRENCY = WORLD_QUEST_REWARD_TYPE_FLAG_ORDER_RESOURCES |
| 61 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS | 61 local REWARD_REAGENT = WORLD_QUEST_REWARD_TYPE_FLAG_MATERIALS |
| 62 local REWARD_HONOR = WORLD_QUEST_REWARD_TYPE_FLAG_HONOR | 62 |
| 63 local REWARD_TYPE_NAMES = { | |
| 64 [REWARD_CASH] = 'Money', | |
| 65 [REWARD_ARTIFACT_POWER] = 'AP', | |
| 66 [REWARD_GEAR] = 'Equipment', | |
| 67 [REWARD_CURRENCY] = 'Currency', | |
| 68 [REWARD_REAGENT] = 'Trade Goods' | |
| 69 } | |
| 63 | 70 |
| 64 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP | 71 local LE_QUEST_TAG_TYPE_PVP = LE_QUEST_TAG_TYPE_PVP |
| 65 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE | 72 local LE_QUEST_TAG_TYPE_PET_BATTLE = LE_QUEST_TAG_TYPE_PET_BATTLE |
| 66 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON | 73 local LE_QUEST_TAG_TYPE_DUNGEON = LE_QUEST_TAG_TYPE_DUNGEON |
| 67 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION | 74 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION |
| 73 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION | 80 local LE_QUEST_TAG_TYPE_PROFESSION = LE_QUEST_TAG_TYPE_PROFESSION |
| 74 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL | 81 local LE_QUEST_TAG_TYPE_NORMAL = LE_QUEST_TAG_TYPE_NORMAL |
| 75 | 82 |
| 76 local DEFAULT_STYLE = { | 83 local DEFAULT_STYLE = { |
| 77 border = {1,1,1}, | 84 border = {1,1,1}, |
| 85 textColor = {1,1,1,1}, | |
| 78 x = 0, y = 0, | 86 x = 0, y = 0, |
| 79 desaturated = true, | 87 desaturated = true, |
| 80 iconMask = "Interface\\Minimap\\UI-Minimap-Background", | 88 iconMask = "Interface\\Minimap\\UI-Minimap-Background", |
| 81 borderMask = "Interface\\Minimap\\UI-Minimap-Background", | 89 borderMask = "Interface\\Minimap\\UI-Minimap-Background", |
| 82 rewardMark = "Interface\\Minimap\\UI-Minimap-Background", | 90 rewardMark = "Interface\\Minimap\\UI-Minimap-Background", |
| 101 [REWARD_ARTIFACT_POWER] = {}, | 109 [REWARD_ARTIFACT_POWER] = {}, |
| 102 [REWARD_GEAR] = { | 110 [REWARD_GEAR] = { |
| 103 | 111 |
| 104 hideNumber = true, | 112 hideNumber = true, |
| 105 }, | 113 }, |
| 106 [REWARD_CURRENCY] = {}, | 114 [REWARD_CURRENCY] = { |
| 115 textColor = {1,1,0,.5} | |
| 116 }, | |
| 107 [REWARD_REAGENT] = { | 117 [REWARD_REAGENT] = { |
| 108 | 118 |
| 109 hideNumber = true, | 119 hideNumber = true, |
| 110 }, | 120 }, |
| 111 } | 121 } |
| 363 tagAtlas = "worldquest-icon-dungeon" | 373 tagAtlas = "worldquest-icon-dungeon" |
| 364 end | 374 end |
| 365 self.worldQuestType = worldQuestType | 375 self.worldQuestType = worldQuestType |
| 366 self.tagAtlas = tagAtlas | 376 self.tagAtlas = tagAtlas |
| 367 | 377 |
| 368 local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality = self:UpdateRewards() | 378 local dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality, xpType, xpName, xpIcon, xpCount = self:UpdateRewards() |
| 369 dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality) | 379 dprint('|cFFBB8844 dataLoaded|r =', dataLoaded, rewardType, itemName, itemTexture, itemNumber, quality) |
| 370 if dataLoaded then | 380 if dataLoaded then |
| 371 self.rewardType = rewardType | 381 self.rewardType = rewardType |
| 372 self.itemName = itemName | 382 self.itemName = itemName |
| 373 self.itemTexture = itemTexture | 383 self.itemTexture = itemTexture |
| 374 self.itemNumber = itemNumber | 384 self.itemNumber = itemNumber |
| 375 self.itemQuality = quality | 385 self.itemQuality = quality |
| 376 self.dataLoaded = true | 386 self.dataLoaded = true |
| 377 self.isStale = true | 387 self.isStale = true |
| 388 self.xpType, self.xpName, self.xpIcon, self.xpCount = xpType, xpName, xpIcon, xpCount | |
| 389 | |
| 378 end | 390 end |
| 379 end | 391 end |
| 380 | 392 |
| 381 | 393 |
| 382 return self.dataLoaded | 394 return self.dataLoaded |
| 383 end | 395 end |
| 396 | |
| 397 local ID_RESOURCES = 1220 | |
| 398 local ID_LEGIONFALL = 1342 | |
| 384 | 399 |
| 385 --- Returns true if data has changed (either from loading in or qualifications changed) | 400 --- Returns true if data has changed (either from loading in or qualifications changed) |
| 386 function QuestPOI:UpdateRewards() | 401 function QuestPOI:UpdateRewards() |
| 387 local questID = self.questID | 402 local questID = self.questID |
| 388 if not HaveQuestRewardData(questID) then | 403 if not HaveQuestRewardData(questID) then |
| 391 else | 406 else |
| 392 local rewardMoney, rewardAP, rewardHonor | 407 local rewardMoney, rewardAP, rewardHonor |
| 393 local rewardItems, rewardCurrency = {}, {} | 408 local rewardItems, rewardCurrency = {}, {} |
| 394 local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality | 409 local rewardIcon, rewardName, rewardCount, rewardStyle, rewardType, itemID, quantity, quality |
| 395 local xpIcon, xpName, xpCount, xpType | 410 local xpIcon, xpName, xpCount, xpType |
| 411 local foundPrimary | |
| 396 | 412 |
| 397 if (GetNumQuestLogRewardCurrencies(questID) > 0 or GetNumQuestLogRewards(questID) > 0 or GetQuestLogRewardMoney(questID) > 0 or GetQuestLogRewardArtifactXP(questID) > 0 or GetQuestLogRewardHonor(questID)) then | 413 if (GetNumQuestLogRewardCurrencies(questID) > 0 or GetNumQuestLogRewards(questID) > 0 or GetQuestLogRewardMoney(questID) > 0 or GetQuestLogRewardArtifactXP(questID) > 0 or GetQuestLogRewardHonor(questID)) then |
| 398 local money = GetQuestLogRewardMoney(questID) | 414 local money = GetQuestLogRewardMoney(questID) |
| 399 if money > 0 then | 415 if money > 0 then |
| 400 rewardMoney = money | 416 rewardMoney = money |
| 409 rewardAP = artifactXP | 425 rewardAP = artifactXP |
| 410 rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" | 426 rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" |
| 411 rewardCount = artifactXP | 427 rewardCount = artifactXP |
| 412 rewardType = REWARD_ARTIFACT_POWER | 428 rewardType = REWARD_ARTIFACT_POWER |
| 413 qprint(' artifactXP', artifactXP) | 429 qprint(' artifactXP', artifactXP) |
| 430 foundPrimary = true | |
| 414 end | 431 end |
| 415 | 432 |
| 416 local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID); | 433 local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID); |
| 417 for i = 1, numQuestCurrencies do | 434 for i = 1, numQuestCurrencies do |
| 418 local name, texture, numItems = GetQuestLogRewardCurrencyInfo(i, questID); | 435 local name, texture, numItems, currencyID = GetQuestLogRewardCurrencyInfo(i, questID); |
| 419 local text = BONUS_OBJECTIVE_REWARD_WITH_COUNT_FORMAT:format(texture, numItems, name); | 436 local text = BONUS_OBJECTIVE_REWARD_WITH_COUNT_FORMAT:format(texture, numItems, name); |
| 420 tinsert(rewardCurrency, { | 437 tinsert(rewardCurrency, { |
| 421 name = name, | 438 name = name, |
| 422 texture = texture, | 439 texture = texture, |
| 423 numItems = numItems, | 440 numItems = numItems, |
| 424 text = text | 441 text = text |
| 425 }) | 442 }) |
| 426 qprint(' currency', i, name, " |T"..tostring(texture)..":12:12|t") | 443 |
| 427 rewardIcon = texture | 444 qprint(' currency', i, currencyID, name, " |T"..tostring(texture)..":12:12|t") |
| 428 rewardCount = numItems | 445 if currencyID == ID_RESOURCES then |
| 429 rewardName = name | 446 rewardIcon = texture |
| 430 rewardType = REWARD_CURRENCY | 447 rewardCount = numItems |
| 448 rewardName = name | |
| 449 rewardType = REWARD_CURRENCY | |
| 450 foundPrimary = true | |
| 451 elseif currencyID == ID_LEGIONFALL then | |
| 452 xpIcon = texture | |
| 453 xpCount = numItems | |
| 454 xpName = name | |
| 455 xpType = REWARD_CURRENCY | |
| 456 end | |
| 457 | |
| 431 end | 458 end |
| 432 local honorAmount = GetQuestLogRewardHonor(questID); | 459 local honorAmount = GetQuestLogRewardHonor(questID); |
| 433 if honorAmount > 0 then | 460 if honorAmount > 0 then |
| 434 xpIcon = "Interface\\ICONS\\Achievement_LegionPVPTier4" | 461 xpIcon = "Interface\\ICONS\\Achievement_LegionPVPTier4" |
| 435 xpCount = honorAmount | 462 xpCount = honorAmount |
| 437 xpType = HONOR_CURRENCY | 464 xpType = HONOR_CURRENCY |
| 438 end | 465 end |
| 439 | 466 |
| 440 local numQuestRewards = GetNumQuestLogRewards(questID); | 467 local numQuestRewards = GetNumQuestLogRewards(questID); |
| 441 if numQuestRewards > 0 then | 468 if numQuestRewards > 0 then |
| 442 local foundPrimary | |
| 443 for i = 1, numQuestRewards do | 469 for i = 1, numQuestRewards do |
| 444 local name, texture, numItems, quality, isUsable, itemID = GetQuestLogRewardInfo(i, questID) | 470 local name, texture, numItems, quality, isUsable, itemID = GetQuestLogRewardInfo(i, questID) |
| 445 | 471 |
| 446 if itemID then | 472 if itemID then |
| 447 local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID = GetItemInfo(itemID); | 473 local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID = GetItemInfo(itemID); |
| 494 numItems = numItems, | 520 numItems = numItems, |
| 495 quality = quality, | 521 quality = quality, |
| 496 isUsable = isUsable | 522 isUsable = isUsable |
| 497 }) | 523 }) |
| 498 if not foundPrimary then | 524 if not foundPrimary then |
| 525 print(' -updating primary') | |
| 499 rewardType = REWARD_GEAR | 526 rewardType = REWARD_GEAR |
| 500 | 527 |
| 501 rewardIcon = texture | 528 rewardIcon = texture |
| 502 rewardName = name | 529 rewardName = name |
| 503 rewardCount = numItems | 530 rewardCount = numItems |
| 514 if (self.itemNumber ~= rewardCount) or (self.rewardType ~= rewardType) or (self.itemName ~= rewardName) or (self.itemTexture ~= rewardIcon) then | 541 if (self.itemNumber ~= rewardCount) or (self.rewardType ~= rewardType) or (self.itemName ~= rewardName) or (self.itemTexture ~= rewardIcon) then |
| 515 if DATA_DEBUG and (self.debugTimer <= 0) then | 542 if DATA_DEBUG and (self.debugTimer <= 0) then |
| 516 return false | 543 return false |
| 517 end | 544 end |
| 518 | 545 |
| 519 return true, rewardType, rewardName, rewardIcon, rewardCount, quality | 546 return true, rewardType, rewardName, rewardIcon, rewardCount, quality, xpType, xpName, xpIcon, xpCount |
| 520 | 547 |
| 521 else | 548 else |
| 522 return false | 549 return false |
| 523 end | 550 end |
| 524 end | 551 end |
| 544 | 571 |
| 545 -- run from OnShow if .isNew is set | 572 -- run from OnShow if .isNew is set |
| 546 | 573 |
| 547 function QuestPOI:StartFade() | 574 function QuestPOI:StartFade() |
| 548 if not self.isAnimating then | 575 if not self.isAnimating then |
| 549 --qprint('|cFFFFFF00'.. self.title .. ' added to quest log.') | 576 qprint('|cFFFFFF00clearing new status') |
| 550 self:SetAlpha(0) | 577 self:SetAlpha(0) |
| 578 if self.dataLoaded then | |
| 579 self:Refresh() | |
| 551 self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha) | 580 self.FadeIn.FadeIn:SetToAlpha(db.PinAlpha) |
| 552 self.PendingFade.FadeIn:SetToAlpha(db.PinAlpha) | 581 self.PendingFade.FadeIn:SetToAlpha(db.PinAlpha) |
| 553 self.PendingFade.FadeOut:SetFromAlpha(db.PinAlpha) | 582 self.PendingFade.FadeOut:SetFromAlpha(db.PinAlpha) |
| 554 | 583 |
| 555 self.isAnimating = true | 584 self.isAnimating = true |
| 556 self.isNew = nil | 585 self.isNew = nil |
| 557 self.isStale = true | 586 self.isStale = true |
| 558 self.FadeIn:Play() | 587 self.FadeIn:Play() |
| 588 end | |
| 559 end | 589 end |
| 560 end | 590 end |
| 561 | 591 |
| 562 function QuestPOI:EndFade() | 592 function QuestPOI:EndFade() |
| 563 self.isAnimating = nil | 593 self.isAnimating = nil |
| 564 self:SetAlpha(db.PinAlpha) | 594 self:SetAlpha(db.PinAlpha) |
| 565 end | 595 end |
| 566 | 596 |
| 567 function QuestPOI:OnShow () | 597 function QuestPOI:OnShow () |
| 568 | 598 |
| 569 if self.isStale then | |
| 570 qprint('|cFF0088FFflagged for refresh') | |
| 571 self:Refresh() | |
| 572 end | |
| 573 | |
| 574 if self.isNew then | 599 if self.isNew then |
| 575 qprint('|cFFFFFF00popping new pin handler') | |
| 576 self:StartFade() | 600 self:StartFade() |
| 577 end | 601 else |
| 578 | 602 if not self.isAnimating then |
| 579 if not self.isAnimating then | 603 print('|cFF00FF00Alpha correction') |
| 580 self:SetAlpha(db.PinAlpha) -- fix stuck alpha | 604 self:SetAlpha(db.PinAlpha) -- fix stuck alpha |
| 581 end | 605 end |
| 582 | 606 if self.isStale then |
| 607 print('|cFF00FF00refresh on show') | |
| 608 self:Refresh() | |
| 609 end | |
| 610 end | |
| 583 self:ShowFrames() | 611 self:ShowFrames() |
| 584 end | 612 end |
| 585 | 613 |
| 586 function QuestPOI:OnHide() | 614 function QuestPOI:OnHide() |
| 587 --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()') | 615 --DEFAULT_CHAT_FRAME:AddMessage('|cFFFFFF00'..self:GetName()..'|r:OnHide()') |
| 588 self:HideFrames() | 616 self:HideFrames() |
| 589 -- reset flags | 617 -- reset flags |
| 590 self:SetAlpha(db.PinAlpha) | 618 self:SetAlpha(db.PinAlpha) |
| 591 self.isAnimating = nil | 619 self.isAnimating = nil |
| 620 if db.Config.DebugEnabled then | |
| 621 db.log(tostring(self.questID) .. ' ' .. tostring(self.title) .. "\n" .. tostring(REWARD_TYPE_NAMES[self.rewardType]) .. ' ' .. tostring(self.itemName) .. ' ' .. tostring(self.itemNumber) .. "\n|cFFFF4400" .. (self.hideReason or 'NO_MESSAGE') .. "|r\n|cFF00FFFF" .. debugstack(2,3,0) .. '|r') | |
| 622 end | |
| 623 self.hideReason = nil | |
| 592 end | 624 end |
| 593 | 625 |
| 594 -- Applies position and sizing parameters to the pin data | 626 -- Applies position and sizing parameters to the pin data |
| 595 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor) | 627 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor) |
| 596 dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used) | 628 dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used) |
| 597 if not self.used then | 629 if not self.used then |
| 630 self.hideReason = 'SetAnchor() on an unused frame.' | |
| 598 self:HideFrames() | 631 self:HideFrames() |
| 599 return | 632 return |
| 600 end | 633 end |
| 601 | 634 |
| 602 if owner then | 635 if owner then |
| 614 self:SetFrameLevel(pinBaseIndex + self:GetID()) | 647 self:SetFrameLevel(pinBaseIndex + self:GetID()) |
| 615 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) | 648 self.Overlay:SetFrameLevel(overlayBaseIndex + self:GetID()) |
| 616 | 649 |
| 617 local scaleChanged | 650 local scaleChanged |
| 618 if scaleFactor and (self.scaleFactor ~= scaleFactor) then | 651 if scaleFactor and (self.scaleFactor ~= scaleFactor) then |
| 619 print('scaleFactor') | 652 --print('scaleFactor') |
| 620 self:SetScale(scaleFactor) | 653 self:SetScale(scaleFactor) |
| 621 self.Overlay:SetScale(scaleFactor) | 654 self.Overlay:SetScale(scaleFactor) |
| 622 self.scaleFactor = scaleFactor | 655 self.scaleFactor = scaleFactor |
| 623 scaleChanged = true | 656 scaleChanged = true |
| 624 end | 657 end |
| 643 function QuestPOI:ShowFrames() | 676 function QuestPOI:ShowFrames() |
| 644 if not self:IsShown() then | 677 if not self:IsShown() then |
| 645 print('|cFFFFFF00' ..self:GetName()..':ShowFrames()') | 678 print('|cFFFFFF00' ..self:GetName()..':ShowFrames()') |
| 646 -- do not SetShown() here | 679 -- do not SetShown() here |
| 647 end | 680 end |
| 648 | |
| 649 self.count:SetShown(true) | |
| 650 self.Overlay:SetShown(true) | 681 self.Overlay:SetShown(true) |
| 651 self.count:SetShown(true) | 682 self.count:SetShown(true) |
| 652 self.timeLabel:SetShown(true) | 683 self.timeLabel:SetShown(true) |
| 653 end | 684 end |
| 654 | 685 |
| 655 function QuestPOI:HideFrames() | 686 function QuestPOI:HideFrames() |
| 656 if self:IsShown() then | 687 if self:IsShown() then |
| 657 print(self:GetName()..':HideFrames()') | 688 if not self.hideReason then |
| 689 self.hideReason = "HideFrames() called" | |
| 690 end | |
| 691 --print(self:GetName()..':HideFrames()') | |
| 658 self:SetShown(false) | 692 self:SetShown(false) |
| 659 end | 693 end |
| 660 self.count:SetShown(false) | |
| 661 self.Overlay:SetShown(false) | 694 self.Overlay:SetShown(false) |
| 662 self.count:SetShown(false) | 695 self.count:SetShown(false) |
| 663 self.timeLabel:SetShown(false) | 696 self.timeLabel:SetShown(false) |
| 664 self.used = nil | 697 self.used = nil |
| 665 end | 698 end |
| 707 end | 740 end |
| 708 end | 741 end |
| 709 --@end-debug@ | 742 --@end-debug@ |
| 710 | 743 |
| 711 -- query for reward data if it wasn't found in the original scan | 744 -- query for reward data if it wasn't found in the original scan |
| 712 local questID = self.questID | 745 |
| 713 if not self.dataLoaded then | 746 if not self.dataLoaded then |
| 714 print('|cFFFF4400'..self:GetID()..':|r polling reward info') | 747 print('|cFFFF4400'..self:GetID()..':|r polling reward info') |
| 715 if not (self.isAnimating) then | 748 |
| 716 self.PendingFade:Play() | |
| 717 end | |
| 718 local dataLoaded = self:GetData() | 749 local dataLoaded = self:GetData() |
| 719 if dataLoaded and not tContains(db.UpdatedPins, self) then | 750 if dataLoaded and not tContains(db.UpdatedPins, self) then |
| 720 | 751 |
| 721 print('|cFF00FF88'..self:GetID()..':|r reward info loaded! queue it up') | 752 print('|cFF00FF88'..self:GetID()..':|r delayed reward info, queueing for update') |
| 722 | 753 self.PendingFade:Stop() |
| 723 tinsert(db.UpdatedPins, self) | 754 tinsert(db.UpdatedPins, self) |
| 724 end | 755 end |
| 725 return | 756 return |
| 726 else | 757 end |
| 727 if self.PendingFade:IsPlaying() then | 758 |
| 728 print('|cFFFF4400'..self:GetID()..':|r cancel fader') | 759 if self.maxAlertLevel then |
| 729 self.PendingFade:Stop() | 760 self:UpdateStatus() |
| 730 end | 761 end |
| 731 | 762 |
| 732 if self.isStale then | |
| 733 print(self.questID, '|cFFFFFF00flagged for update') | |
| 734 self:CheckFilterRules() | |
| 735 self:Refresh() | |
| 736 return | |
| 737 end | |
| 738 end | |
| 739 | |
| 740 self:UpdateStatus() | |
| 741 end | 763 end |
| 742 | 764 |
| 743 -- Called at static intervals and with Refresh | 765 -- Called at static intervals and with Refresh |
| 744 function QuestPOI:UpdateStatus() | 766 function QuestPOI:UpdateStatus() |
| 745 -- update time elements | 767 -- update time elements |
| 752 | 774 |
| 753 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel) | 775 local text, timeState = WorldPlan:GetTimeInfo(timeLeft, self.maxAlertLevel) |
| 754 if tl ~= timeState then | 776 if tl ~= timeState then |
| 755 tl = timeState | 777 tl = timeState |
| 756 self.timeLabel:SetText(text) | 778 self.timeLabel:SetText(text) |
| 757 end | |
| 758 else | |
| 759 if self.worldQuestType ~= LE_QUEST_TAG_TYPE_PROFESSION then | |
| 760 self:HideFrames() | |
| 761 end | 779 end |
| 762 end | 780 end |
| 763 | 781 |
| 764 if tl and (timeLeft < 120) then | 782 if tl and (timeLeft < 120) then |
| 765 self.HighlightBorder:SetVertexColor(1,0,0,0.7) | 783 self.HighlightBorder:SetVertexColor(1,0,0,0.7) |
| 769 self.HighlightBorder:SetVertexColor(0,0,0,0.7) | 787 self.HighlightBorder:SetVertexColor(0,0,0,0.7) |
| 770 end | 788 end |
| 771 self.alertLevel = tl | 789 self.alertLevel = tl |
| 772 self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1)) | 790 self.timeLabel:SetShown(self.worldQuest and (self.maxAlertLevel >= 1)) |
| 773 else | 791 else |
| 774 if not self.completed then | 792 self.hideReason = "No longer active." |
| 775 self.completed = true | 793 self:HideFrames() |
| 776 self:HideFrames() | 794 |
| 777 end | |
| 778 end | 795 end |
| 779 end | 796 end |
| 780 | 797 |
| 781 | 798 |
| 782 function QuestPOI:Refresh () | 799 function QuestPOI:Refresh () |
| 797 local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth | 814 local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth |
| 798 local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth | 815 local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth |
| 799 local tagSize = style.TagSize or DEFAULT_STYLE.TagSize | 816 local tagSize = style.TagSize or DEFAULT_STYLE.TagSize |
| 800 local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon | 817 local hideIcon = style.hideIcon or DEFAULT_STYLE.hideIcon |
| 801 local borderColor = style.border or DEFAULT_STYLE.border | 818 local borderColor = style.border or DEFAULT_STYLE.border |
| 819 local textColor = style.textColor or DEFAULT_STYLE.textColor | |
| 802 local questID = self.questID | 820 local questID = self.questID |
| 803 local iconBorder = self.RewardBorder | 821 local iconBorder = self.RewardBorder |
| 804 local trackingBorder = self.HighlightBorder | 822 local trackingBorder = self.HighlightBorder |
| 805 local icon = self.icon | 823 local icon = self.icon |
| 806 local count = self.count | 824 local count = self.count |
| 827 if decimal > 100 then | 845 if decimal > 100 then |
| 828 numberString = numberString .. '.' .. tostring(floor(decimal/100)) | 846 numberString = numberString .. '.' .. tostring(floor(decimal/100)) |
| 829 end | 847 end |
| 830 numberString = numberString .. 'k' | 848 numberString = numberString .. 'k' |
| 831 end | 849 end |
| 850 | |
| 832 self.count:SetText(numberString) | 851 self.count:SetText(numberString) |
| 852 self.count:SetTextColor(unpack(textColor)) | |
| 833 self.count:Show() | 853 self.count:Show() |
| 834 else | 854 else |
| 835 self.count:SetText(nil) | 855 self.count:SetText(nil) |
| 836 self.count:Hide() | 856 self.count:Hide() |
| 837 end | 857 end |
| 905 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', | 925 [REWARD_REAGENT]= 'worldQuestFilterProfessionMaterials', |
| 906 [REWARD_GEAR] = 'worldQuestFilterEquipment', | 926 [REWARD_GEAR] = 'worldQuestFilterEquipment', |
| 907 } | 927 } |
| 908 | 928 |
| 909 | 929 |
| 910 | |
| 911 function QuestPOI:CheckFilterRules () | 930 function QuestPOI:CheckFilterRules () |
| 912 local print = qprint | 931 local print = qprint |
| 913 local qType = self.worldQuestType | 932 local qType = self.worldQuestType |
| 914 local filtered | 933 local filtered |
| 915 local canShow = TQ_IsActive(self.questID) | 934 local canShow = TQ_IsActive(self.questID) |
| 916 if SpellCanTargetQuest() then | 935 |
| 917 -- hiding so player can click a valid target | 936 if db.canTargetQuests then |
| 918 self.used = nil | 937 self:EnableMouse(false) |
| 919 elseif qType == LE_QUEST_TAG_TYPE_PROFESSION then | 938 if not IsQuestIDValidSpellTarget(self.questID) then |
| 939 self.hideReason = "Not a valid spell target." | |
| 940 self:SetShown(false) | |
| 941 return | |
| 942 end | |
| 943 else | |
| 944 self:EnableMouse(true) | |
| 945 end | |
| 946 | |
| 947 if qType == LE_QUEST_TAG_TYPE_PROFESSION then | |
| 920 if not(self.isKnownProfession or db.Config.ShowAllProfessionQuests) then | 948 if not(self.isKnownProfession or db.Config.ShowAllProfessionQuests) then |
| 921 canShow = nil | 949 canShow = nil |
| 922 end | 950 end |
| 923 end | 951 end |
| 924 if canShow then | 952 if canShow then |
| 940 self.isStale = true | 968 self.isStale = true |
| 941 print(' '..self.questID..':|cFFFFFF00CheckFilterRules()|r ', canShow, filtered, self.title) | 969 print(' '..self.questID..':|cFFFFFF00CheckFilterRules()|r ', canShow, filtered, self.title) |
| 942 end | 970 end |
| 943 self.filtered = filtered | 971 self.filtered = filtered |
| 944 end | 972 end |
| 945 | |
| 946 self.used = canShow | 973 self.used = canShow |
| 947 | 974 if not canShow then |
| 948 | 975 self.hideReason = "Failed filter check." |
| 976 end | |
| 977 self:SetShown(canShow) | |
| 949 end | 978 end |
| 950 | 979 |
| 951 --- Fixes icons upon size update | 980 --- Fixes icons upon size update |
| 952 function QuestPOI:UpdateSize () | 981 function QuestPOI:UpdateSize () |
| 953 | 982 |
