Quantcast

Don't show reforging when item level too low

Silversage of Eitrigg [09-09-11 - 02:02]
Don't show reforging when item level too low
Filename
SageGearLevelTooltip.lua
diff --git a/SageGearLevelTooltip.lua b/SageGearLevelTooltip.lua
index d8d2b4d..0cec36f 100644
--- a/SageGearLevelTooltip.lua
+++ b/SageGearLevelTooltip.lua
@@ -74,7 +74,7 @@ local ItemLevelIdCommenter do
 		    and tonumber(itemId)
 		    or ">>" .. itemLink:gsub("|", "!")
 		tooltip:AddDoubleLine(
-				"iLevel " .. level,
+				"iLevel " .. (level or '??'),
 				"id " .. itemId,
 				class.r, class.g, class.b,
 				1, 1, 1)
@@ -214,7 +214,9 @@ local BestReforgedEvaluator do
 		local stats = GetItemStats(itemLink)	-- baseline w/o reforging
 		local rightValue, rightLabel = nil, nil

-		local reforging = self:_FindOptimalReforging(stats)
+		-- if not high enough for reforging, show base stats
+		local reforging = self:_ItemHighEnoughForForging(itemLink)
+				and self:_FindOptimalReforging(stats)
 		if reforging then
 			reforging:AdjustStats(stats)
 			rightValue, rightLabel = reforging:Describe(), reforgingLabel
@@ -226,6 +228,11 @@ local BestReforgedEvaluator do
 		end
 	end

+	function class:_ItemHighEnoughForForging(itemLink)
+		_,_,_,itemLevel = GetItemInfo(itemLink)
+		return itemLevel >= 200
+	end
+
 	function class:_FindOptimalReforging(stats)
 		local maxDelta, maxReforging = 0, nil
 		for index,reforging in pairs(reforgings:All()) do
@@ -430,7 +437,7 @@ SageGearLevelTooltipUpdater:New(methodsToHook)
 				:Cache())

 		--Priest
-		:AddSelfEvaluator("PRIEST", BestReforgedEvaluator:New({label = "Disc Priest", r=0.3, g=0.3, b=1.0},
+		:AddSelfEvaluator("PRIEST", BestReforgedEvaluator:New({label = "Disc Priest", r=0.5, g=0.5, b=1.0},
 						{Intellect=100, Spirit=80, SP=19, Crit=11, Haste=10, Mastery=6})
 						:Cache())
 		:AddSelfEvaluator("PRIEST", BestReforgedEvaluator:New({label = "Holy Priest", r=0.3, g=1.0, b=0.3},