diff --git a/Gems.lua b/Gems.lua index 50a2e3f..6c22d30 100644 --- a/Gems.lua +++ b/Gems.lua @@ -324,8 +324,8 @@ PawnGemQualityLevels = { 0, PawnGemData1 }, } -PawnMetaGemQualityLevels = {} -PawnCogwheelQualityLevels = {} +PawnMetaGemQualityLevels = nil +PawnCogwheelQualityLevels = nil PawnMinimumItemLevelToConsiderGems = 315 -- Sockets on items below this ilvl are ignored by default diff --git a/GemsBurningCrusade.lua b/GemsBurningCrusade.lua index e5ddfbf..faf8d63 100644 --- a/GemsBurningCrusade.lua +++ b/GemsBurningCrusade.lua @@ -336,7 +336,7 @@ PawnMetaGemQualityLevels = { 0, PawnMetaGemData70Rare }, } -PawnCogwheelQualityLevels = {} +PawnCogwheelQualityLevels = nil PawnMinimumItemLevelToConsiderGems = 100 diff --git a/GemsClassic.lua b/GemsClassic.lua index b91b34b..dc16323 100644 --- a/GemsClassic.lua +++ b/GemsClassic.lua @@ -8,8 +8,8 @@ if VgerCore.IsClassic then - PawnGemQualityLevels = {} - PawnMetaGemQualityLevels = {} - PawnCogwheelQualityLevels = {} + PawnGemQualityLevels = nil + PawnMetaGemQualityLevels = nil + PawnCogwheelQualityLevels = nil PawnMinimumItemLevelToConsiderGems = 10000 end diff --git a/GemsWrath.lua b/GemsWrath.lua index 58c52e0..a09b954 100644 --- a/GemsWrath.lua +++ b/GemsWrath.lua @@ -737,7 +737,7 @@ PawnMetaGemQualityLevels = { 0, PawnMetaGemData70Rare }, } -PawnCogwheelQualityLevels = {} +PawnCogwheelQualityLevels = nil PawnMinimumItemLevelToConsiderGems = 187 diff --git a/Pawn.lua b/Pawn.lua index 45b12c1..c8d7d43 100644 --- a/Pawn.lua +++ b/Pawn.lua @@ -2809,6 +2809,7 @@ function PawnGetItemValue(Item, ItemLevel, SocketBonus, ScaleName, DebugMessages local CogwheelQualityLevel = PawnGetGemQualityForItem(PawnCogwheelQualityLevels, ItemLevel) local SocketValue = function(Stat, QualityLevel) + if QualityLevel == nil then return 0 end local Quantity = Item[Stat] if Quantity then local ThisValue = ThisScaleBestGems[Stat .. "Value"][QualityLevel] @@ -2868,15 +2869,7 @@ function PawnGetItemValue(Item, ItemLevel, SocketBonus, ScaleName, DebugMessages end -- In Cataclysm there are also cogwheels for engineering goggles. Sigh. - ThisValue = ScaleValues.CogwheelSocket - if ThisValue then - Stat = "CogwheelSocket" - Quantity = Item[Stat] - if Quantity then - TotalSocketValue = TotalSocketValue + Quantity * ThisValue - if DebugMessages then PawnDebugMessage(format(PawnLocal.ValueCalculationMessage, Quantity, Stat, ThisValue, Quantity * ThisValue)) end - end - end + TotalSocketValue = TotalSocketValue + SocketValue("CogwheelSocket", CogwheelQualityLevel) Total = Total + TotalSocketValue end -- if ShouldIncludeSockets @@ -3425,7 +3418,9 @@ end -- Given a particular item level and a list of gem tables, return the appropriate gem quality level for an item of the given level. -- If ItemLevel is nil, then the highest gem quality is assumed. +-- Will return nil when there are no known gems of that type at all. function PawnGetGemQualityForItem(GemQualityLevels, ItemLevel) + if not GemQualityLevels or #GemQualityLevels == 0 then return nil end if not ItemLevel then return GemQualityLevels[1][1] end local _, GemQualityData, GemLevel @@ -3433,7 +3428,7 @@ function PawnGetGemQualityForItem(GemQualityLevels, ItemLevel) GemLevel = GemQualityData[1] if ItemLevel >= GemLevel then return GemLevel end end - VgerCore.Fail("Couldn't find an appropriate gem quality level for an item of level " .. tostring(ItemLevel) .. " in the specified item table.") + VgerCore.Fail("Pawn couldn't find the right gems to use for an item of level " .. tostring(ItemLevel) .. " (WoW " .. GetBuildInfo() .. ").") return GemLevel end diff --git a/PawnUI.lua b/PawnUI.lua index 349a656..ed507b7 100644 --- a/PawnUI.lua +++ b/PawnUI.lua @@ -1754,38 +1754,41 @@ function PawnUI_ShowBestGems() local _ local GemQualityLevel = PawnGetGemQualityForItem(PawnGemQualityLevels, PawnUIGemQualityLevel) + if GemQualityLevel then - if not VgerCore.IsClassic and not VgerCore.IsMainline then - -- Burning Crusade Classic and Wrath Classic: Divide by color - if #(PawnScaleBestGems[PawnUICurrentScale].RedSocket[GemQualityLevel]) > 0 then - PawnUI_AddGemHeaderLine(format(PawnLocal.UI.GemsColorHeader, RED_GEM)) - for _, GemData in pairs(PawnScaleBestGems[PawnUICurrentScale].RedSocket[GemQualityLevel]) do - PawnUI_AddGemLine(GemData.Name, GemData.Texture, GemData.ID) + if not VgerCore.IsClassic and not VgerCore.IsMainline then + -- Classic starting in Burning Crusade: Divide by color + if #(PawnScaleBestGems[PawnUICurrentScale].RedSocket[GemQualityLevel]) > 0 then + PawnUI_AddGemHeaderLine(format(PawnLocal.UI.GemsColorHeader, RED_GEM)) + for _, GemData in pairs(PawnScaleBestGems[PawnUICurrentScale].RedSocket[GemQualityLevel]) do + PawnUI_AddGemLine(GemData.Name, GemData.Texture, GemData.ID) + end + ShownGems = true end - ShownGems = true - end - if #(PawnScaleBestGems[PawnUICurrentScale].YellowSocket[GemQualityLevel]) > 0 then - PawnUI_AddGemHeaderLine(format(PawnLocal.UI.GemsColorHeader, YELLOW_GEM)) - for _, GemData in pairs(PawnScaleBestGems[PawnUICurrentScale].YellowSocket[GemQualityLevel]) do - PawnUI_AddGemLine(GemData.Name, GemData.Texture, GemData.ID) + if #(PawnScaleBestGems[PawnUICurrentScale].YellowSocket[GemQualityLevel]) > 0 then + PawnUI_AddGemHeaderLine(format(PawnLocal.UI.GemsColorHeader, YELLOW_GEM)) + for _, GemData in pairs(PawnScaleBestGems[PawnUICurrentScale].YellowSocket[GemQualityLevel]) do + PawnUI_AddGemLine(GemData.Name, GemData.Texture, GemData.ID) + end + ShownGems = true end - ShownGems = true - end - if #(PawnScaleBestGems[PawnUICurrentScale].BlueSocket[GemQualityLevel]) > 0 then - PawnUI_AddGemHeaderLine(format(PawnLocal.UI.GemsColorHeader, BLUE_GEM)) - for _, GemData in pairs(PawnScaleBestGems[PawnUICurrentScale].BlueSocket[GemQualityLevel]) do - PawnUI_AddGemLine(GemData.Name, GemData.Texture, GemData.ID) + if #(PawnScaleBestGems[PawnUICurrentScale].BlueSocket[GemQualityLevel]) > 0 then + PawnUI_AddGemHeaderLine(format(PawnLocal.UI.GemsColorHeader, BLUE_GEM)) + for _, GemData in pairs(PawnScaleBestGems[PawnUICurrentScale].BlueSocket[GemQualityLevel]) do + PawnUI_AddGemLine(GemData.Name, GemData.Texture, GemData.ID) + end + ShownGems = true end - ShownGems = true - end - else - -- Non-Classic WoW: All sockets are prismatic - if #(PawnScaleBestGems[PawnUICurrentScale].PrismaticSocket[GemQualityLevel]) > 0 then - for _, GemData in pairs(PawnScaleBestGems[PawnUICurrentScale].PrismaticSocket[GemQualityLevel]) do - PawnUI_AddGemLine(GemData.Name, GemData.Texture, GemData.ID) + else + -- Non-Classic WoW: All sockets are prismatic + if #(PawnScaleBestGems[PawnUICurrentScale].PrismaticSocket[GemQualityLevel]) > 0 then + for _, GemData in pairs(PawnScaleBestGems[PawnUICurrentScale].PrismaticSocket[GemQualityLevel]) do + PawnUI_AddGemLine(GemData.Name, GemData.Texture, GemData.ID) + end + ShownGems = true end - ShownGems = true end + end if not ShownGems then diff --git a/Readme.htm b/Readme.htm index 448744b..c05084a 100644 --- a/Readme.htm +++ b/Readme.htm @@ -309,7 +309,8 @@

Incompatible addons

Updates

Version 2.9.5

Version 2.9.4