Skip to content

Commit 9811d7c

Browse files
committed
Fix radius jewel weight generation
1 parent f06527f commit 9811d7c

2 files changed

Lines changed: 2936 additions & 15999 deletions

File tree

src/Classes/TradeQueryGenerator.lua

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ function TradeQueryGeneratorClass:ProcessMod(mod, tradeQueryStatsParsed, itemCat
246246

247247
local statOrder = modLine:find("Nearby Enemies have %-") ~= nil and mod.statOrder[index + 1] or mod.statOrder[index] -- hack to get minus res mods associated with the correct statOrder
248248
local uniqueIndex = mod.group ~= "" and tostring(statOrder).."_"..mod.group or tostring(statOrder)
249+
-- ensure that regular jewel and radius jewel mods don't get the same index
250+
if mod.nodeType then
251+
uniqueIndex = uniqueIndex.."Radius"
252+
end
249253

250254
if self.modData[modType][uniqueIndex] == nil then
251255
if tradeMod == nil then
@@ -717,9 +721,6 @@ function TradeQueryGeneratorClass:StartQuery(slot, options)
717721
elseif slot.slotName == "Belt" then
718722
itemCategoryQueryStr = "accessory.belt"
719723
itemCategory = "Belt"
720-
elseif slot.slotName:find("Time-Lost") ~= nil then
721-
itemCategoryQueryStr = "jewel"
722-
itemCategory = "RadiusJewel"
723724
elseif slot.slotName:find("Jewel") ~= nil then
724725
itemCategoryQueryStr = "jewel"
725726
itemCategory = options.jewelType .. "Jewel"
@@ -745,6 +746,13 @@ function TradeQueryGeneratorClass:StartQuery(slot, options)
745746

746747
-- Create a temp item for the slot with no mods
747748
local itemRawStr = "Rarity: RARE\nStat Tester\n" .. testItemType
749+
if options.jewelType == "Radius" then
750+
itemRawStr = [[Rarity: RARE
751+
Stat Tester
752+
Time-Lost Sapphire
753+
Radius: Small
754+
Implicits: 0]]
755+
end
748756
local testItem = new("Item", itemRawStr)
749757

750758
-- Calculate base output with a blank item
@@ -783,7 +791,25 @@ function TradeQueryGeneratorClass:ExecuteQuery()
783791
self:GeneratePassiveNodeWeights(self.modData.AllocatesXEnchant)
784792
return
785793
end
786-
self:GenerateModWeights(self.modData["Explicit"])
794+
795+
-- the trade site has no filters for jewel categories, so we can remove the
796+
-- other mods to filter the category. this should also free up some filter slots.
797+
if self.calcContext.options.jewelType == "Radius" then
798+
local radiusMods = {}
799+
-- local baseMods = {}
800+
for k, v in pairs(self.modData["Explicit"]) do
801+
if v.RadiusJewel then
802+
radiusMods[k] = v
803+
end
804+
end
805+
806+
self:GenerateModWeights(radiusMods)
807+
else
808+
-- radius mods are not filtered out here, but they valued at zero and
809+
-- ignored as the base item won't have a "radius:" line
810+
self:GenerateModWeights(self.modData["Explicit"])
811+
end
812+
787813
self:GenerateModWeights(self.modData["Implicit"])
788814
if self.calcContext.options.includeCorrupted then
789815
self:GenerateModWeights(self.modData["Corrupted"])
@@ -1028,7 +1054,7 @@ Remove: anoints are completely ignored, and removed from items.]]
10281054

10291055

10301056
if isJewelSlot then
1031-
controls.jewelType = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 100, 18}, { "Any", "Base", "Radius" }, function(index, value) end) -- this does nothing atm
1057+
controls.jewelType = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 100, 18}, { "Base", "Radius" }, function(index, value) end)
10321058
controls.jewelType.selIndex = self.lastJewelType or 1
10331059
controls.jewelTypeLabel = new("LabelControl", {"RIGHT",controls.jewelType,"LEFT"}, {-5, 0, 0, 16}, "Jewel Type:")
10341060
updateLastAnchor(controls.jewelType)
@@ -1109,7 +1135,7 @@ Remove: anoints are completely ignored, and removed from items.]]
11091135
end
11101136
if controls.jewelType then
11111137
self.lastJewelType = controls.jewelType.selIndex
1112-
options.jewelType = controls.jewelType.list[controls.jewelType.selIndex]
1138+
options.jewelType = controls.jewelType:GetSelValue()
11131139
end
11141140
if controls.maxPrice.buf then
11151141
options.maxPrice = tonumber(controls.maxPrice.buf)

0 commit comments

Comments
 (0)