Mercurial > wow > worldplan
comparison QuestPOI.lua @ 116:bf4a36378bb9
- Fixed flight map pins jumping about
author | Nenue |
---|---|
date | Fri, 24 Nov 2017 23:51:44 -0500 |
parents | e8b6c5433128 |
children | 1fcc4fe645dc |
comparison
equal
deleted
inserted
replaced
115:f4dedbad7a11 | 116:bf4a36378bb9 |
---|---|
614 [1506] = true, -- argus waystone | 614 [1506] = true, -- argus waystone |
615 } | 615 } |
616 | 616 |
617 --- Returns true if data has changed (either from loading in or qualifications changed) | 617 --- Returns true if data has changed (either from loading in or qualifications changed) |
618 function QuestPOI:UpdateRewards() | 618 function QuestPOI:UpdateRewards() |
619 dprint('UpdateRewards()', self.questTitle) | |
619 local questID = self.questID | 620 local questID = self.questID |
620 if not HaveQuestRewardData(questID) then | 621 if not HaveQuestRewardData(questID) then |
621 C_TaskQuest.RequestPreloadRewardData(questID); | 622 C_TaskQuest.RequestPreloadRewardData(questID); |
622 return false; | 623 return false; |
623 else | 624 else |
641 if artifactXP > 0 then | 642 if artifactXP > 0 then |
642 rewardAP = artifactXP | 643 rewardAP = artifactXP |
643 rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" | 644 rewardIcon = "Interface\\ICONS\\inv_7xp_inscription_talenttome01" |
644 rewardCount = artifactXP | 645 rewardCount = artifactXP |
645 rewardType = REWARD_ARTIFACT_POWER | 646 rewardType = REWARD_ARTIFACT_POWER |
646 --dprint(' artifactXP', artifactXP) | 647 dprint(' artifactXP', artifactXP) |
647 foundPrimary = true | 648 foundPrimary = true |
648 end | 649 end |
649 | 650 |
650 local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID); | 651 local numQuestCurrencies = GetNumQuestLogRewardCurrencies(questID); |
651 for i = 1, numQuestCurrencies do | 652 for i = 1, numQuestCurrencies do |
682 for i = 1, numQuestRewards do | 683 for i = 1, numQuestRewards do |
683 local name, texture, numItems, quality, isUsable, itemID = GetQuestLogRewardInfo(i, questID) | 684 local name, texture, numItems, quality, isUsable, itemID = GetQuestLogRewardInfo(i, questID) |
684 | 685 |
685 if itemID then | 686 if itemID then |
686 local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID = GetItemInfo(itemID); | 687 local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID = GetItemInfo(itemID); |
687 if ( classID == LE_ITEM_CLASS_WEAPON or classID == LE_ITEM_CLASS_ARMOR or (classID == LE_ITEM_CLASS_GEM and subclassID == LE_ITEM_GEM_ARTIFACTRELIC) ) then | 688 if IsArtifactPowerItem(itemID) then |
688 rewardType = REWARD_GEAR | |
689 rewardIcon = texture | |
690 rewardName = name | |
691 rewardCount = numItems | |
692 foundPrimary = true | |
693 elseif IsArtifactPowerItem(itemID) then | |
694 rewardType = REWARD_ARTIFACT_POWER | 689 rewardType = REWARD_ARTIFACT_POWER |
695 rewardIcon = texture | 690 rewardIcon = texture |
696 rewardName = name | 691 rewardName = name |
697 rewardCount = self:UpdateArtifactPower(itemLink) | 692 rewardCount = self:UpdateArtifactPower(itemLink) |
698 foundPrimary = true | 693 foundPrimary = true |
699 --dprint('is an AP token') | 694 --dprint('is an AP token') |
695 | |
696 | |
697 elseif ( classID == LE_ITEM_CLASS_WEAPON or classID == LE_ITEM_CLASS_ARMOR or (classID == LE_ITEM_CLASS_GEM and subclassID == LE_ITEM_GEM_ARTIFACTRELIC) ) then | |
698 rewardType = REWARD_GEAR | |
699 rewardIcon = texture | |
700 rewardName = name | |
701 rewardCount = numItems | |
702 foundPrimary = true | |
700 elseif classID == LE_ITEM_CLASS_TRADEGOODS then | 703 elseif classID == LE_ITEM_CLASS_TRADEGOODS then |
701 rewardType = REWARD_REAGENT | 704 rewardType = REWARD_REAGENT |
702 rewardIcon = texture | 705 rewardIcon = texture |
703 rewardName = name | 706 rewardName = name |
704 rewardCount = numItems | 707 rewardCount = numItems |
705 foundPrimary = true | 708 foundPrimary = true |
706 end | 709 end |
707 --dprint(' reward', i, name, " |T"..tostring(texture)..":12:12|t", quality, isUsable, itemID) | 710 dprint(' reward', i, name, " |T"..tostring(texture)..":12:12|t", rewardCount, rewardType, isUsable, itemID) |
708 tinsert(rewardItems, { | 711 tinsert(rewardItems, { |
709 name = name, | 712 name = name, |
710 texture = texture, | 713 texture = texture, |
711 numItems = numItems, | 714 numItems = numItems, |
712 quality = quality, | 715 quality = quality, |
742 end | 745 end |
743 end | 746 end |
744 end | 747 end |
745 | 748 |
746 | 749 |
750 local ap_strings = { | |
751 '([%d%.]+) billion ' .. ARTIFACT_POWER, | |
752 '([%d%.]+) million ' .. ARTIFACT_POWER, | |
753 '([%d]+) ' .. ARTIFACT_POWER, | |
754 } | |
755 local ap_factors = {1000000000, 1000000, 1} | |
756 | |
747 function QuestPOI:UpdateArtifactPower(rewardLink) | 757 function QuestPOI:UpdateArtifactPower(rewardLink) |
758 dprint('UpdateArtifactPower') | |
748 if not (rewardLink or self.rewardLink) then | 759 if not (rewardLink or self.rewardLink) then |
749 return | 760 return |
750 end | 761 end |
751 | 762 |
752 self.rewardLink = rewardLink or self.rewardLink | 763 self.rewardLink = rewardLink or self.rewardLink |
755 WorldPlanTooltip:SetOwner(self, 'ANCHOR_NONE') | 766 WorldPlanTooltip:SetOwner(self, 'ANCHOR_NONE') |
756 WorldPlanTooltip:SetHyperlink(rewardLink or self.rewardLink) | 767 WorldPlanTooltip:SetHyperlink(rewardLink or self.rewardLink) |
757 for i = 1, WorldPlanTooltip:NumLines() do | 768 for i = 1, WorldPlanTooltip:NumLines() do |
758 local line = _G['WorldPlanTooltipTextLeft' .. i] | 769 local line = _G['WorldPlanTooltipTextLeft' .. i] |
759 local text = line and line:GetText() | 770 local text = line and line:GetText() |
760 local multiplier = (text:match('million') and 1000000) or 1 | 771 |
761 if text then | 772 if text then |
773 | |
762 text = text:gsub(',', '') | 774 text = text:gsub(',', '') |
763 local ap = text:match('([%d]+) '..ARTIFACT_POWER) | 775 for j, format in ipairs(ap_strings) do |
764 if not ap then | 776 |
765 ap = text:match('([%d%.]+) million '..ARTIFACT_POWER) | 777 local ap = text:match(format) |
766 if ap then | 778 if ap then |
767 ap = tonumber(ap) * 1000000 | 779 |
780 rewardCount = tonumber(ap) * ap_factors[j] | |
781 dprint(' ap text', format, tonumber(ap), ap_factors[j], rewardCount) | |
782 break | |
768 end | 783 end |
769 end | 784 |
770 if ap then | |
771 rewardCount = tonumber(ap) | |
772 end | 785 end |
773 end | 786 end |
774 end | 787 end |
775 return rewardCount | 788 return rewardCount |
776 end | 789 end |
777 | 790 |
778 -- Applies position and sizing parameters to the pin data | 791 -- Applies position and sizing parameters to the pin data |
779 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor) | 792 function QuestPOI:SetAnchor(owner, dX, dY, mapWidth, mapHeight, scaleFactor) |
780 --dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used) | 793 --dprint(self:GetName()..':SetAnchor()', owner, dX, dY, scaleFactor, self.filtered, self.used) |
794 --dprint(debugstack(1,1)) | |
795 --dprint(self:GetPoint(1)) | |
781 if not self.used then | 796 if not self.used then |
782 self.hideReason = 'SetAnchor() on an unused frame.' | 797 self.hideReason = 'SetAnchor() on an unused frame.' |
783 self:HideOrShowFrames(false) | 798 self:HideOrShowFrames(false) |
784 return | 799 return |
785 end | 800 end |
932 self:OnCursor() | 947 self:OnCursor() |
933 end | 948 end |
934 | 949 |
935 local style = DEFAULT_STYLE | 950 local style = DEFAULT_STYLE |
936 if self.filtered or db.IgnoreTimers[self.questID] then | 951 if self.filtered or db.IgnoreTimers[self.questID] then |
937 print('choose minimized') | 952 print('minimized type') |
938 style = MINIMIZED_STYLE | 953 style = MINIMIZED_STYLE |
939 elseif self.dataLoaded then | 954 elseif self.dataLoaded then |
940 print('choose reward type') | 955 print('reward type', self.rewardType) |
941 style = REWARD_TYPE_STYLES[self.rewardType] | 956 style = REWARD_TYPE_STYLES[self.rewardType] |
942 else | 957 else |
943 print('choose default') | 958 print('default type') |
944 end | 959 end |
945 | 960 |
946 local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth | 961 local currentWidth = style.iconWidth or DEFAULT_STYLE.iconWidth |
947 local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth | 962 local borderWidth = style.borderWidth or DEFAULT_STYLE.borderWidth |
948 local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth | 963 local highlightWidth = style.highlightWidth or DEFAULT_STYLE.highlightWidth |
975 end | 990 end |
976 | 991 |
977 if self.itemName then | 992 if self.itemName then |
978 if self.itemNumber and (self.itemNumber > 1) and (not hideNumbers) then | 993 if self.itemNumber and (self.itemNumber > 1) and (not hideNumbers) then |
979 local numberString = self.itemNumber | 994 local numberString = self.itemNumber |
980 if self.itemNumber >= 1000000 then | 995 if self.itemNumber >= 1000000000 then |
981 numberString = (floor(self.itemNumber/100000)/10) .. 'M' | 996 numberString = (floor(self.itemNumber/100000000)/10) .. '|cFFFF8800B|r' |
997 elseif self.itemNumber >= 1000000 then | |
998 numberString = (floor(self.itemNumber/100000)/10) .. '|cFFFFFF00M|r' | |
982 elseif self.itemNumber >= 10000 then | 999 elseif self.itemNumber >= 10000 then |
983 numberString = floor(self.itemNumber/1000) .. 'k' | 1000 numberString = floor(self.itemNumber/1000) .. 'k' |
984 elseif self.itemNumber >= 1000 then | 1001 elseif self.itemNumber >= 1000 then |
985 local numeral = floor(self.itemNumber/1000) | 1002 local numeral = floor(self.itemNumber/1000) |
986 local decimal = mod(self.itemNumber, 1000) | 1003 local decimal = mod(self.itemNumber, 1000) |