Quantcast

Handles red, yellow, blue sockets

Silversage of Eitrigg [09-26-11 - 00:30]
Handles red, yellow, blue sockets
Filename
SageGearLevelTooltip.lua
diff --git a/SageGearLevelTooltip.lua b/SageGearLevelTooltip.lua
index cf2cfb4..a001a3f 100644
--- a/SageGearLevelTooltip.lua
+++ b/SageGearLevelTooltip.lua
@@ -150,6 +150,7 @@ local SimplePawnEvaluator do
 		local stats = self:_GetItemStats(itemLink)
 		local total = 0
 		local missedStat, missedStatLabel = nil, nil
+		print("stat eval")
 		for k,v in pairs(stats) do
 			local stat = ITEM_MOD_NAME_MAP[k]
 			if not stat then
@@ -197,6 +198,16 @@ local BestReforgedEvaluator do
 		self.super:_Initialize(instance)
 		instance.coefficients = coefficients
 		instance.label = label
+
+		-- handle sockets
+		local bestStatValue = 0
+		for i,stat in ipairs({"Stamina", "Strength", "Agility", "Intellect", "Spirit"}) do
+		  bestStatValue = math.max(bestStatValue, instance.coefficients[stat] or 0)
+		end
+		local socketValue = bestStatValue * 40    -- cata blue gems
+		instance.coefficients.RedSocket = math.max(socketValue, instance.coefficients.RedSocket or 0)
+		instance.coefficients.BlueSocket = math.max(socketValue, instance.coefficients.BlueSocket or 0)
+		instance.coefficients.YellowSocket = math.max(socketValue, instance.coefficients.YellowSocket or 0)
 	end

 	function class:_GetItemStats(itemLink)