comparison Modules/ArtifactPower.lua @ 117:589045559484 v720.0

ArtifactPower: - cleanup of tooltip stats - green = available with XP currently invested, blue = available with XP from inventory
author Nenue
date Wed, 17 May 2017 08:23:27 -0400
parents ddfe19d70a34
children 0f47780a83c4
comparison
equal deleted inserted replaced
116:ddfe19d70a34 117:589045559484
895 self[k] = v 895 self[k] = v
896 end 896 end
897 897
898 self.isFishing = fishing 898 self.isFishing = fishing
899 -- this can change between artifact parses 899 -- this can change between artifact parses
900 local totalAP = (itemID ~= UNDERLIGHT_ANGLER_ID) and ((self:GetParent().bankAP or 0) + (self:GetParent().bagAP or 0)) or (self:GetParent().fishingAP or 0) 900 local unusedXP = (itemID ~= UNDERLIGHT_ANGLER_ID) and ((self:GetParent().bankAP or 0) + (self:GetParent().bagAP or 0)) or (self:GetParent().fishingAP or 0)
901 print(totalAP) 901 print('unspent:', unusedXP)
902 902
903 -- currentXP what has been spent on the artifact 903 -- current standing artifact XP (what appears in the artifact ui)
904 -- actualXP amount 904 -- actual artifact XP after any unlocked points are spent
905 -- totalXP 905 -- total total of invested and inventory XP
906 local actualXP = artifact.currentXP + totalAP 906 -- totalCost total of costs between current and actual level
907 local actualXP = artifact.currentXP
907 local actualLevel = artifact.level 908 local actualLevel = artifact.level
908 local actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier) 909 local actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier)
909 910 local totalXP = actualXP + unusedXP
911 local totalCost = actualCost
912 local totalLevel = actualLevel
913
914 print('tier:', artifact.tier)
915 print('current:', self.level, self.currentXP, '/', self.currentCost)
910 while actualXP >= actualCost do 916 while actualXP >= actualCost do
911 actualXP = actualXP - actualCost 917 actualXP = actualXP - actualCost
912 actualLevel = actualLevel + 1 918 actualLevel = actualLevel + 1
913 actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier) 919 actualCost = C_ArtifactUI.GetCostForPointAtRank(actualLevel, artifact.tier)
914 print('* ', actualLevel, actualXP, actualCost) 920
915 end 921 print('* ', actualLevel, actualXP, actualCost, totalCost)
922 end
923 print('actual:', actualLevel, actualXP, '/', actualCost)
924
925
926 if unusedXP > 0 then
927 local remaining = totalXP
928 local nextCost = artifact.currentCost
929 totalCost = nextCost
930 while remaining > nextCost do
931 totalLevel = totalLevel + 1
932 totalCost = totalCost + nextCost
933 nextCost = C_ArtifactUI.GetCostForPointAtRank(totalLevel, artifact.tier)
934 remaining = remaining - nextCost
935 print('|cFFFFFF00+ ', totalLevel, remaining, '/', nextCost)
936 end
937
938 end
939 print('total:', totalLevel, totalXP, '/', totalCost)
940
941 self.currentLevel = self.level
942
943
916 self.actualCost = actualCost 944 self.actualCost = actualCost
917 self.actualLevel = actualLevel 945 self.actualLevel = actualLevel
918 self.actualXP = actualXP 946 self.actualXP = actualXP
919 self.totalXP = artifact.currentXP + totalAP 947
948 self.totalXP = totalXP
949 self.totalCost = totalCost
950 self.totalLevel = totalLevel
951
920 952
921 953
922 if index ~= 1 then 954 if index ~= 1 then
923 self:ClearAllPoints() 955 self:ClearAllPoints()
924 self:SetPoint('TOPLEFT', self.relativeFrame, 'TOPRIGHT', 4, 0) 956 self:SetPoint('TOPLEFT', self.relativeFrame, 'TOPRIGHT', 4, 0)
946 print(self.currentXP, self.actualXP, self.potentialXP) 978 print(self.currentXP, self.actualXP, self.potentialXP)
947 if self.actualLevel ~= self.level then 979 if self.actualLevel ~= self.level then
948 980
949 levelText = self.actualLevel 981 levelText = self.actualLevel
950 r1, g1, b1 = 0, 1, 0 982 r1, g1, b1 = 0, 1, 0
951 r2, g2, b2 = 0, 1, 0 983 --r2, g2, b2 = 0, 1, 0
952 xpText = ShortNumberString(self.actualXP) 984 xpText = ShortNumberString(self.actualXP)
953 costText = ShortNumberString(self.actualCost) 985 costText = ShortNumberString(self.actualCost)
954 remainingText = ShortNumberString(self.actualCost-self.actualXP) 986 remainingText = ShortNumberString(self.actualCost-self.actualXP)
955 --[[elseif self.potentialLevel ~= self.level then 987 --[[elseif self.potentialLevel ~= self.level then
956 r1, g1, b1 = 0, 1, 1 988 r1, g1, b1 = 0, 1, 1
957 r2, g2, b2 = 0, 1, 1 989 r2, g2, b2 = 0, 1, 1
958 costText = ShortNumberString(self.potentialCost) 990 costText = ShortNumberString(self.potentialCost)
959 remainingText = ShortNumberString(self.potentialCost-self.potentialXP) 991 remainingText = ShortNumberString(self.potentialCost-self.potentialXP)
960 --]] 992 --]]
993 elseif self.totalLevel ~= self.actualLevel then
994 r1, g1, b1 = 0, 1, 1
961 end 995 end
962 996
963 self.Level:SetText(levelText) 997 self.Level:SetText(levelText)
964 self.CurrentXP:SetText( xpText ) 998 self.CurrentXP:SetText( xpText )
965 self.RemainingCost:SetText(remainingText) 999 self.RemainingCost:SetText(remainingText)
1005 else 1039 else
1006 self.AdjustedProgress:Hide() 1040 self.AdjustedProgress:Hide()
1007 self.AdjustedLine:Hide() 1041 self.AdjustedLine:Hide()
1008 end 1042 end
1009 1043
1044 if self.actualLevel ~= self.currentLevel then
1045 self:SetNormalTexture([[Interface\Buttons\UI-Quickslot-Depress]], 'ADD')
1046 self:GetNormalTexture():SetBlendMode('BLEND')
1047 self:GetNormalTexture():SetVertexColor(1,1,1)
1048 else
1049 self:SetNormalTexture(nil, 'ADD')
1050
1051 end
1052
1053
1010 1054
1011 1055
1012 self.Icon:SetTexture(self.texture) 1056 self.Icon:SetTexture(self.texture)
1013 end 1057 end
1014 1058
1045 1089
1046 function Artifact:OnEnter() 1090 function Artifact:OnEnter()
1047 GameTooltip:SetOwner(self, 'ANCHOR_CURSOR') 1091 GameTooltip:SetOwner(self, 'ANCHOR_CURSOR')
1048 GameTooltip:SetText(self.name) 1092 GameTooltip:SetText(self.name)
1049 GameTooltip:AddLine(ShortNumberString(self.currentXP) .. ' / '..ShortNumberString(self.currentCost), 1, 1, 0) 1093 GameTooltip:AddLine(ShortNumberString(self.currentXP) .. ' / '..ShortNumberString(self.currentCost), 1, 1, 0)
1050 if self.totalXP ~= self.currentXP then
1051 GameTooltip:AddLine(ShortNumberString(self.totalXP) .. ' total XP', 0, 1, 1)
1052 if self.actualXP ~= self.potentialXP then
1053 GameTooltip:AddLine(ShortNumberString(self.actualXP) .. ' / ' .. ShortNumberString(self.actualCost).. ' after', 0, 1, 0)
1054 end
1055 end
1056 if self.actualLevel ~= self.level then 1094 if self.actualLevel ~= self.level then
1057 GameTooltip:AddLine(ShortNumberString(self.actualLevel - self.level) .. ' points unlocked', 0, 1, 1) 1095 GameTooltip:AddLine(ShortNumberString(self.actualLevel - self.level) .. ' points unlocked', 0, 1, 0)
1058 end 1096 end
1059 if self.currentXP < self.currentCost then 1097 if self.currentXP < self.currentCost then
1060 GameTooltip:AddLine(ShortNumberString(self.currentCost - self.currentXP) .. ' needed') 1098 GameTooltip:AddLine(ShortNumberString(self.currentCost - self.currentXP) .. ' for level ' .. (self.currentLevel+1), 1, 1, 0)
1099 else
1100 GameTooltip:AddLine(ShortNumberString(self.actualCost - self.actualXP) .. ' for level ' .. (self.actualLevel+1), 0, 1, 0)
1101 end
1102 if self.totalLevel ~= self.actualLevel then
1103 GameTooltip:AddLine('Level ' .. self.totalLevel .. ' with unspent tokens', 0, 1, 1)
1061 end 1104 end
1062 1105
1063 GameTooltip:Show() 1106 GameTooltip:Show()
1064 end 1107 end
1065 function Artifact:OnLeave() 1108 function Artifact:OnLeave()