Skip to content

Commit ace17cc

Browse files
vaisestLocalIdentity
andauthored
Trader: Heart of the Well, Against the Darkness, Desecrated mods, Rune-only mods, Breach tree mods (#2121)
* Add Heart of the Well to trader and include desecrated mods * Use array syntax for stringify() for a more diff friendly format * Add Against the Darkness to trader * Widen trader layout by 35px * Adjust trader result layout * Add "can roll X" related mods to trader * Add 0.5 breach mods to trader * Also add breach crafted mods * Fix breach mods which appear on both rings and belts in QueryMods.lua * Fix issues Fix crash on no jewel socket Fix tooltip and calc to use selected socket * Fix spelling --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent e73ae80 commit ace17cc

5 files changed

Lines changed: 14517 additions & 7917 deletions

File tree

src/Classes/TradeQuery.lua

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,22 @@ Highest Weight - Displays the order retrieved from trade]]
557557
return hideRowFunc(self, row_count)
558558
end
559559

560+
row_count = row_count + 1
561+
self.slotTables[row_count] = { slotName = "Heart of the Well", unique = true, selectedJewelNodeId = activeSocketList[1] }
562+
self:PriceItemRowDisplay(row_count, top_pane_alignment_ref, row_vertical_padding, row_height)
563+
self.controls["name"..row_count].y = self.controls["name"..row_count].y + (row_height + row_vertical_padding)
564+
self.controls["name"..row_count].shown = function()
565+
return hideRowFunc(self, row_count)
566+
end
567+
568+
row_count = row_count + 1
569+
self.slotTables[row_count] = { slotName = "Against the Darkness", unique = true, selectedJewelNodeId = activeSocketList[1] }
570+
self:PriceItemRowDisplay(row_count, top_pane_alignment_ref, row_vertical_padding, row_height)
571+
self.controls["name"..row_count].y = self.controls["name"..row_count].y + (row_height + row_vertical_padding)
572+
self.controls["name"..row_count].shown = function()
573+
return hideRowFunc(self, row_count)
574+
end
575+
560576
-- fix case where the row count is reduced from the last time the popup was
561577
-- opened, which would leave extra row controls in the menu
562578
for k, v in pairs(self.controls) do
@@ -571,7 +587,7 @@ Highest Weight - Displays the order retrieved from trade]]
571587
local effective_row_count = row_count - ((scrollBarShown and #slotTables >= 19) and #slotTables-19 or 0) + 2 + 2 -- Two top menu rows, two bottom rows, slots after #19 overlap the other controls at the bottom of the pane
572588
self.effective_rows_height = row_height * (effective_row_count - #slotTables + (18 - (#slotTables > 37 and 3 or 0))) -- scrollBar height, "18 - slotTables > 37" logic is fine tuning whitespace after last row
573589
self.pane_height = (row_height + row_vertical_padding) * effective_row_count + 3 * pane_margins_vertical + row_height / 2
574-
local pane_width = 850 + (scrollBarShown and 25 or 0)
590+
local pane_width = 885 + (scrollBarShown and 25 or 0)
575591

576592
self.controls.scrollBar = new("ScrollBarControl", {"TOPRIGHT", self.controls["StatWeightMultipliersButton"],"TOPRIGHT"}, {0, 25, 18, 0}, 50, "VERTICAL", false)
577593
self.controls.scrollBar.shown = function() return scrollBarShown end
@@ -778,7 +794,9 @@ function TradeQueryClass:GetResultEvaluation(row_idx, result_index, calcFunc, ba
778794
self.lastComparedWeightList[row_idx][result_index] = self.statSortSelectionList
779795
end
780796

781-
local slotName = self.slotTables[row_idx].nodeId and "Jewel " .. tostring(self.slotTables[row_idx].nodeId) or self.slotTables[row_idx].slotName
797+
local slotTbl = self.slotTables[row_idx]
798+
local jewelNodeId = slotTbl.nodeId or slotTbl.selectedJewelNodeId
799+
local slotName = jewelNodeId and "Jewel " .. tostring(jewelNodeId) or slotTbl.slotName
782800
if slotName == "Megalomaniac" then
783801
local addedNodes = {}
784802
for nodeName in (result.item_string.."\r\n"):gmatch("Allocates (.-)\r?\n") do
@@ -941,8 +959,8 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
941959
slotTbl.slotName == "Watcher's Eye" and self:findValidSlotForWatchersEye() or
942960
slotTbl.fullName and self.itemsTab.slots[slotTbl.fullName]) -- fullName for Abyssal Sockets
943961
local nameColor = slotTbl.unique and colorCodes.UNIQUE or "^7"
944-
controls["name"..row_idx] = new("LabelControl", top_pane_alignment_ref, {0, row_idx*(row_height + row_vertical_padding), 100, row_height - 4}, nameColor..slotTbl.slotName)
945-
controls["bestButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, {100 + 8, 0, 80, row_height}, "Find best", function()
962+
controls["name"..row_idx] = new("LabelControl", top_pane_alignment_ref, {0, row_idx*(row_height + row_vertical_padding), 135, row_height - 4}, nameColor..slotTbl.slotName)
963+
controls["bestButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, {135 + 8, 0, 80, row_height}, "Find best", function()
946964
self.tradeQueryGenerator:RequestQuery(activeSlot, { slotTbl = slotTbl, controls = controls, row_idx = row_idx }, self.statSortSelectionList, function(context, query, errMsg)
947965
if errMsg then
948966
self:SetNotice(context.controls.pbNotice, colorCodes.NEGATIVE .. errMsg)
@@ -1070,28 +1088,33 @@ you can add them, copy the link here, and press "Price Item" to evaluate the ite
10701088
local isAuthorized = main.api.authToken ~= nil
10711089
local validURL = controls["uri"..row_idx].validURL
10721090
local isSearching = controls["priceButton"..row_idx].label == "Searching..."
1073-
return isAuthorized and validURL and not isSearching
1091+
local selectedJewelSlot = slotTbl.selectedJewelNodeId and self.itemsTab.sockets[slotTbl.selectedJewelNodeId]
1092+
local hasRequiredJewelSlot = not slotTbl.unique or slotTbl.slotName == "Megalomaniac" or selectedJewelSlot and not selectedJewelSlot.inactive
1093+
return isAuthorized and validURL and not isSearching and hasRequiredJewelSlot
10741094
end
10751095
controls["priceButton"..row_idx].tooltipFunc = function(tooltip)
10761096
tooltip:Clear()
10771097
if not main.api.authToken then
10781098
tooltip:AddLine(16, "You must log in to use the search feature")
10791099
elseif not controls["uri"..row_idx].validURL then
10801100
tooltip:AddLine(16, "Enter a valid trade URL")
1101+
elseif slotTbl.unique and slotTbl.slotName ~= "Megalomaniac"
1102+
and (not slotTbl.selectedJewelNodeId or not self.itemsTab.sockets[slotTbl.selectedJewelNodeId] or self.itemsTab.sockets[slotTbl.selectedJewelNodeId].inactive) then
1103+
tooltip:AddLine(16, "Requires an active Jewel Socket")
10811104
end
10821105
end
10831106
local clampItemIndex = function(index)
10841107
return m_min(m_max(index or 1, 1), self.sortedResultTbl[row_idx] and #self.sortedResultTbl[row_idx] or 1)
10851108
end
1086-
controls["changeButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, {100 + 8, 0, 80, row_height}, "<< Search", function()
1109+
controls["changeButton"..row_idx] = new("ButtonControl", { "LEFT", controls["name"..row_idx], "LEFT"}, {135 + 8, 0, 80, row_height}, "<< Search", function()
10871110
self.itemIndexTbl[row_idx] = nil
10881111
self.sortedResultTbl[row_idx] = nil
10891112
self.resultTbl[row_idx] = nil
10901113
self.totalPrice[row_idx] = nil
10911114
self.controls.fullPrice.label = "Total Price: " .. self:GetTotalPriceString()
10921115
end)
10931116
controls["changeButton"..row_idx].shown = function() return self.resultTbl[row_idx] end
1094-
controls["resultDropdown"..row_idx] = new("DropDownControl", { "TOPLEFT", controls["changeButton"..row_idx], "TOPRIGHT"}, {8, 0, 325, row_height}, {}, function(index)
1117+
controls["resultDropdown"..row_idx] = new("DropDownControl", { "TOPLEFT", controls["changeButton"..row_idx], "TOPRIGHT"}, {8, 0, 351, row_height}, {}, function(index)
10951118
self.itemIndexTbl[row_idx] = self.sortedResultTbl[row_idx][index].index
10961119
self:SetFetchResultReturn(row_idx, self.itemIndexTbl[row_idx])
10971120
end)
@@ -1108,7 +1131,8 @@ you can add them, copy the link here, and press "Price Item" to evaluate the ite
11081131
end
11091132
local item = new("Item", result.item_string)
11101133
tooltip:Clear()
1111-
self.itemsTab:AddItemTooltip(tooltip, item, activeSlot)
1134+
local tooltipSlot = slotTbl.selectedJewelNodeId and self.itemsTab.sockets[slotTbl.selectedJewelNodeId] or activeSlot
1135+
self.itemsTab:AddItemTooltip(tooltip, item, tooltipSlot)
11121136
tooltip:AddSeparator(10)
11131137
tooltip:AddLine(16, string.format("^7Price: %s %s", result.amount, result.currency))
11141138
end
@@ -1118,8 +1142,9 @@ you can add them, copy the link here, and press "Price Item" to evaluate the ite
11181142
-- pass "true" to not auto equip it as we will have our own logic
11191143
self.itemsTab:AddDisplayItem(true)
11201144
-- Autoequip it
1121-
local slot = slotTbl.nodeId and self.itemsTab.sockets[slotTbl.nodeId] or self.itemsTab.slots[slotTbl.slotName]
1122-
if slot and slotTbl.slotName == slot.label and slot:IsShown() and self.itemsTab:IsItemValidForSlot(item, slot.slotName) then
1145+
local jewelNodeId = slotTbl.nodeId or slotTbl.selectedJewelNodeId
1146+
local slot = jewelNodeId and self.itemsTab.sockets[jewelNodeId] or self.itemsTab.slots[slotTbl.slotName]
1147+
if slot and (jewelNodeId or slotTbl.slotName == slot.label) and slot:IsShown() and self.itemsTab:IsItemValidForSlot(item, slot.slotName) then
11231148
slot:SetSelItemId(item.id)
11241149
self.itemsTab:PopulateSlots()
11251150
self.itemsTab:AddUndoState()
@@ -1135,15 +1160,16 @@ you can add them, copy the link here, and press "Price Item" to evaluate the ite
11351160
-- item.baseName is nil and throws error in the following AddItemTooltip func
11361161
-- if the item is unidentified
11371162
local item = new("Item", item_string)
1138-
self.itemsTab:AddItemTooltip(tooltip, item, activeSlot, true)
1163+
local tooltipSlot = slotTbl.selectedJewelNodeId and self.itemsTab.sockets[slotTbl.selectedJewelNodeId] or activeSlot
1164+
self.itemsTab:AddItemTooltip(tooltip, item, tooltipSlot, true)
11391165
end
11401166
end
11411167
controls["importButton"..row_idx].enabled = function()
11421168
return self.itemIndexTbl[row_idx] and self.resultTbl[row_idx][self.itemIndexTbl[row_idx]].item_string ~= nil
11431169
end
11441170
-- Whisper so we can copy to clipboard
11451171
controls["whisperButton" .. row_idx] = new("ButtonControl",
1146-
{ "TOPLEFT", controls["importButton" .. row_idx], "TOPRIGHT" }, { 8, 0, 170, row_height }, function()
1172+
{ "TOPLEFT", controls["importButton" .. row_idx], "TOPRIGHT" }, { 8, 0, 155, row_height }, function()
11471173
local itemResult = self.itemIndexTbl[row_idx] and self.resultTbl[row_idx][self.itemIndexTbl[row_idx]]
11481174

11491175
if not itemResult then return "" end

0 commit comments

Comments
 (0)