Skip to content

Commit

Permalink
Cogwheel fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
TravisSpomer committed May 30, 2024
1 parent 7aa99a4 commit 976ba27
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 44 deletions.
4 changes: 2 additions & 2 deletions Gems.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion GemsBurningCrusade.lua
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ PawnMetaGemQualityLevels =
{ 0, PawnMetaGemData70Rare },
}

PawnCogwheelQualityLevels = {}
PawnCogwheelQualityLevels = nil

PawnMinimumItemLevelToConsiderGems = 100

Expand Down
6 changes: 3 additions & 3 deletions GemsClassic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


if VgerCore.IsClassic then
PawnGemQualityLevels = {}
PawnMetaGemQualityLevels = {}
PawnCogwheelQualityLevels = {}
PawnGemQualityLevels = nil
PawnMetaGemQualityLevels = nil
PawnCogwheelQualityLevels = nil
PawnMinimumItemLevelToConsiderGems = 10000
end
2 changes: 1 addition & 1 deletion GemsWrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,7 @@ PawnMetaGemQualityLevels =
{ 0, PawnMetaGemData70Rare },
}

PawnCogwheelQualityLevels = {}
PawnCogwheelQualityLevels = nil

PawnMinimumItemLevelToConsiderGems = 187

Expand Down
15 changes: 5 additions & 10 deletions Pawn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -3425,15 +3418,17 @@ 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
for _, GemQualityData in pairs(GemQualityLevels) do
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

Expand Down
55 changes: 29 additions & 26 deletions PawnUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Readme.htm
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ <h3><span style="text-decoration: underline;">In</span>compatible addons</h3>
<h2>Updates</h2>
<h3>Version 2.9.5</h3>
<ul>
<li>Cataclysm Support: Added support for the armor specialization skills such as Mail Specialization.</li>
<li>Fixed some problems introduced in Pawn 2.9.4 where Pawn could give you an error when socketing an item.</li>
<li>Cataclysm Classic: Added support for the armor specialization skills such as Mail Specialization.</li>
</ul>
<h3>Version 2.9.4</h3>
<ul>
Expand Down

0 comments on commit 976ba27

Please sign in to comment.