diff --git a/SageClass.lua b/SageClass.lua index 9967429..5ad30e8 100644 --- a/SageClass.lua +++ b/SageClass.lua @@ -1,6 +1,6 @@ -- SageClass.lua -local function namespace(s) +function namespace(s) local result = _G for name in s:gmatch("%w+") do result[name] = result[name] or {} diff --git a/SageGearLevel.toc b/SageGearLevel.toc index b8829e5..642fd49 100755 --- a/SageGearLevel.toc +++ b/SageGearLevel.toc @@ -6,5 +6,6 @@ SageClass.lua SageReforge.lua SageItem.lua SageGearLevel.lua +GearStatsRegistry.lua stats.lua SageGearLevelTooltip.lua diff --git a/SageGearLevelTooltip.lua b/SageGearLevelTooltip.lua index 5079321..8126681 100644 --- a/SageGearLevelTooltip.lua +++ b/SageGearLevelTooltip.lua @@ -202,7 +202,7 @@ local BestReforgedEvaluator do -- 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) + 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) @@ -376,14 +376,25 @@ local SageGearLevelTooltipUpdater do end ---------------------------------------------------------------------------------------------------- -SageGearLevelTooltipUpdater:New(methodsToHook) +local tooltipUpdater = SageGearLevelTooltipUpdater:New(methodsToHook) :HookTooltipScript("GameTooltip") :HookTooltipScript("ItemRefTooltip") :HookTooltipScript("ShoppingTooltip1") :HookTooltipScript("ShoppingTooltip2") - :AddItemCommenter(ItemLevelIdCommenter:New()) - + +local DEFAULT_COLOR = {r=0.5, g=0.5, b=0.5} +sage.gear.AllStats(function(spec, class, stats, color) + color = color or DEFAULT_COLOR + print(spec, class, stats, color) + local specInfo = {label = spec, r=color.r, g=color.g, b=color.b} + tooltipUpdater:AddSelfEvaluator( + class, + BestReforgedEvaluator:New(specInfo, stats):Cache()) +end) + +--[[ +tooltipUpdater --DK :AddSelfEvaluator("DEATHKNIGHT", BestReforgedEvaluator:New({label = "Blood DK", r=1.0, g=0.2, b=0.4}, {MeleeDPS=500, Mastery=100, Stamina=100, Agility=69, Dodge=50, Parry=43, Expertise=38, @@ -505,3 +516,4 @@ SageGearLevelTooltipUpdater:New(methodsToHook) :AddSelfEvaluator("WARRIOR", BestReforgedEvaluator:New({label = "Prot Warrior", r=1.0, g=0.4, b=0.4}, {Stamina=100, Mastery=100, Dodge=90, Parry=67, Agility=67, Strength=48, Expertise=19, Hit=10, Crit=7, Armor=6, Haste=1}) :Cache()) +]] \ No newline at end of file