Skip to content

Commit 103611b

Browse files
committed
rest of the owl
1 parent 05e9a15 commit 103611b

3 files changed

Lines changed: 86 additions & 39 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,7 @@ local function isAugmentable(item)
14871487
return (item.sockets and #item.sockets > 0) or (item.base.socketLimit and item.base.socketLimit > 0)
14881488
end
14891489

1490-
function ItemsTabClass:copyAnointsAndAugments(newItem, copyAugments, overwrite, sourceSlotName)
1490+
function ItemsTabClass:CopyAnointsAndAugments(newItem, copyAugments, overwrite, sourceSlotName)
14911491
local isWeapon = newItem.base.tags and (newItem.base.tags.onehand or newItem.base.tags.twohand)
14921492
local isShield = newItem.base.tags and (newItem.base.tags.shield or newItem.base.tags.focus)
14931493
local newItemType = sourceSlotName or (isWeapon and "Weapon 1") or (isShield and "Weapon 2") or newItem.base.type
@@ -1552,7 +1552,7 @@ end
15521552
function ItemsTabClass:CreateDisplayItemFromRaw(itemRaw, normalise)
15531553
local newItem = new("Item", itemRaw)
15541554
if newItem.base then
1555-
self:copyAnointsAndAugments(newItem, main.migrateAugments, false)
1555+
self:CopyAnointsAndAugments(newItem, main.migrateAugments, false)
15561556
if normalise then
15571557
newItem:NormaliseQuality()
15581558
newItem:BuildModList()

src/Classes/TradeQuery.lua

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ on trade site to work on other leagues and realms)]]
304304

305305
-- Fetches Box
306306
self.maxFetchPerSearchDefault = 2
307-
self.controls.fetchCountEdit = new("EditControl", {"TOPRIGHT", nil, "TOPRIGHT"}, {-12, 19, 154, row_height}, "", "Fetch Pages", "%D", 3, function(buf)
307+
self.controls.fetchCountEdit = new("EditControl", {"TOPRIGHT", nil, "TOPRIGHT"}, {-12, 19, 150, row_height}, "", "Fetch Pages", "%D", 3, function(buf)
308308
self.maxFetchPages = m_min(m_max(tonumber(buf) or self.maxFetchPerSearchDefault, 1), 10)
309309
self.tradeQueryRequests.maxFetchPerSearch = 10 * self.maxFetchPages
310310
self.controls.fetchCountEdit.focusValue = self.maxFetchPages
@@ -912,23 +912,29 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
912912
self:SetNotice(context.controls.pbNotice, "")
913913
end
914914

915-
-- TODO: REPLACE AUGS
916-
-- -- replace eldritch mods or enchants if the user requested
917-
-- -- so in TradeQueryGenerator
918-
-- if self.tradeQueryGenerator.lastCopyEldritch or
919-
-- self.tradeQueryGenerator.lastCopyEnchantMode == "Copy Current" then
920-
-- for i, _ in ipairs(items) do
921-
-- local item = new("Item", items[i].item_string)
922-
-- self.itemsTab:CopyAnointsAndEldritchImplicits(item, true, true, context.slotTbl.slotName)
923-
-- items[i].item_string = item:BuildRaw()
924-
-- end
925-
-- elseif self.tradeQueryGenerator.lastCopyEnchantMode == "Remove" then
926-
-- for i, _ in ipairs(items) do
927-
-- local item = new("Item", items[i].item_string)
928-
-- item.enchantModLines = {}
929-
-- items[i].item_string = item:BuildRaw()
930-
-- end
931-
-- end
915+
if self.tradeQueryGenerator.lastAugmentBehaviour == "Copy Current" or self.tradeQueryGenerator.lastAnointBehaviour == "Copy Current" then
916+
for i, _ in ipairs(items) do
917+
local item = new("Item", items[i].item_string)
918+
self.itemsTab:CopyAnointsAndAugments(item, true, true, context.slotTbl.slotName)
919+
items[i].item_string = item:BuildRaw()
920+
end
921+
elseif self.tradeQueryGenerator.lastAugmentBehaviour == "Remove" then
922+
for item_idx, _ in ipairs(items) do
923+
local item = new("Item", items[item_idx].item_string)
924+
-- sockets are kept as-is so the user can see e.g. exceptional or corrupted sockets
925+
for rune_idx, _ in ipairs(item.runes or {}) do
926+
item.runes[rune_idx] = "None"
927+
end
928+
item:UpdateRunes()
929+
items[item_idx].item_string = item:BuildRaw()
930+
end
931+
elseif self.tradeQueryGenerator.lastAnointBehaviour == "Remove" then
932+
for i, _ in ipairs(items) do
933+
local item = new("Item", items[i].item_string)
934+
item.enchantModLines = {}
935+
items[i].item_string = item:BuildRaw()
936+
end
937+
end
932938

933939
self.resultTbl[context.row_idx] = items
934940
self:UpdateControlsWithItems(context.row_idx)

src/Classes/TradeQueryGenerator.lua

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -967,32 +967,65 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb
967967

968968
local isJewelSlot = slot and slot.slotName:find("Jewel") ~= nil
969969

970+
local lastItemAnchor
971+
local function updateLastAnchor(anchor, height)
972+
lastItemAnchor = anchor
973+
popupHeight = popupHeight + (height or 23)
974+
end
975+
970976
controls.includeCorrupted = new("CheckBoxControl", {"TOP",nil,"TOP"}, {-40, 30, 18}, "Corrupted Mods:", function(state) end, "Includes corruption implicit modifiers in the weighted sum.\nNote that there is a maximum search filter count which means this might cause other weights to not be included.")
971977
controls.includeCorrupted.state = not context.slotTbl.alreadyCorrupted and (self.lastIncludeCorrupted == nil or self.lastIncludeCorrupted == true)
972978
controls.includeCorrupted.enabled = not context.slotTbl.alreadyCorrupted
979+
updateLastAnchor(controls.includeCorrupted)
973980

974-
local canHaveRunes = slot and (slot.slotName:find("Weapon 1") or slot.slotName:find("Weapon 2") or slot.slotName:find("Helmet") or slot.slotName:find("Body Armour") or slot.slotName:find("Gloves") or slot.slotName:find("Boots"))
975-
controls.includeRunes = new("CheckBoxControl", {"TOPRIGHT",controls.includeCorrupted,"BOTTOMRIGHT"}, {0, 5, 18}, "Rune Mods:", function(state) end)
976-
controls.includeRunes.state = canHaveRunes and (self.lastIncludeRunes == nil or self.lastIncludeRunes == true)
977-
controls.includeRunes.enabled = canHaveRunes
978981

979-
local lastItemAnchor = controls.includeRunes
982+
980983

981-
local function updateLastAnchor(anchor, height)
982-
lastItemAnchor = anchor
983-
popupHeight = popupHeight + (height or 23)
984+
controls.includeMirrored = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, {0, 5, 18}, "Mirrored Items:", function(state) end)
985+
controls.includeMirrored.state = (self.lastIncludeMirrored == nil or self.lastIncludeMirrored == true)
986+
updateLastAnchor(controls.includeMirrored)
987+
988+
-- there are also some exceptions like the darkness enthroned belt, but runes on these are not yet working pob
989+
local isAugmentableSlot = slot and (slot.slotName:find("Weapon 1") or slot.slotName:find("Weapon 2") or slot.slotName:find("Helmet") or slot.slotName:find("Body Armour") or slot.slotName:find("Gloves") or slot.slotName:find("Boots"))
990+
if isAugmentableSlot then
991+
local augmentTooltip = [[Controls how augments are used in the search.
992+
993+
Copy Current: augments in weights are skipped and augments are replaced with the current augments when possible.
994+
Usually the best opinion as this ensures the augments makes sense for your build.
995+
996+
Keep: augments will be included in weights and will not be changed on items.
997+
Best used when you value an augment greatly, and cannot add it yourself.
998+
999+
Remove: augments are completely ignored, and removed from items.]]
1000+
controls.augmentBehaviour = new("DropDownControl", {"TOPLEFT", lastItemAnchor, "BOTTOMLEFT"}, {0, 5, 110, 18}, {"Copy Current", "Keep", "Remove"}, function(state) end, augmentTooltip)
1001+
controls.augmentBehaviour:SetSel(self.lastAugmentBehaviourIdx or 1)
1002+
controls.augmentBehaviourLabel = new("LabelControl", { "RIGHT", controls.augmentBehaviour, "LEFT" },
1003+
{ -4, 0, 80, 16 }, "Rune Behaviour:")
1004+
updateLastAnchor(controls.augmentBehaviour)
1005+
end
1006+
1007+
local isAmulet = slot and (slot.slotName:find("Amulet"))
1008+
if isAmulet then
1009+
local augmentTooltip = [[Controls how anoints are used in the search.
1010+
1011+
Copy Current: anoints are replaced with the current anoint when possible.
1012+
Usually the best opinion as this ensures the anoint makes sense for your build.
1013+
1014+
Keep: anoints will not be changed on items.
1015+
Best used when you cannot add one yourself. Note that weights cannot be generated for anoints.
1016+
1017+
Remove: anoints are completely ignored, and removed from items.]]
1018+
controls.anointBehaviour = new("DropDownControl", {"TOPLEFT", lastItemAnchor, "BOTTOMLEFT"}, {0, 5, 110, 18}, {"Copy Current", "Keep", "Remove"}, function(state) end, augmentTooltip)
1019+
controls.anointBehaviour:SetSel(self.lastAnointBehaviourIdx or 1)
1020+
controls.anointBehaviourLabel = new("LabelControl", { "RIGHT", controls.anointBehaviour, "LEFT" },
1021+
{ -4, 0, 80, 16 }, "Anoint Behaviour:")
1022+
updateLastAnchor(controls.anointBehaviour)
9841023
end
9851024

9861025
if context.slotTbl.unique then
9871026
options.special = { itemName = context.slotTbl.slotName }
9881027
end
9891028

990-
controls.includeMirrored = new("CheckBoxControl", {"TOPRIGHT",lastItemAnchor,"BOTTOMRIGHT"}, {0, 5, 18}, "Mirrored Items:", function(state) end)
991-
controls.includeMirrored.state = (self.lastIncludeMirrored == nil or self.lastIncludeMirrored == true)
992-
updateLastAnchor(controls.includeMirrored)
993-
994-
-- TODO: aug copy
995-
9961029

9971030
if isJewelSlot then
9981031
controls.jewelType = new("DropDownControl", {"TOPLEFT",lastItemAnchor,"BOTTOMLEFT"}, {0, 5, 100, 18}, { "Any", "Base", "Radius" }, function(index, value) end) -- this does nothing atm
@@ -1054,17 +1087,25 @@ function TradeQueryGeneratorClass:RequestQuery(slot, context, statWeights, callb
10541087

10551088
self.tradeTypeIndex = context.controls.tradeTypeSelection.selIndex
10561089

1057-
-- TODO: copy aug
1058-
-- self.lastCopyEnchantMode = controls.copyEnchantMode and controls.copyEnchantMode:GetSelValue()
1059-
10601090
if controls.includeMirrored then
10611091
self.lastIncludeMirrored, options.includeMirrored = controls.includeMirrored.state, controls.includeMirrored.state
10621092
end
10631093
if controls.includeCorrupted then
10641094
self.lastIncludeCorrupted, options.includeCorrupted = controls.includeCorrupted.state, controls.includeCorrupted.state
10651095
end
1066-
if controls.includeRunes then
1067-
self.lastIncludeRunes, options.includeRunes = controls.includeRunes.state, controls.includeRunes.state
1096+
if controls.augmentBehaviour then
1097+
-- remember setting
1098+
self.lastAugmentBehaviourIdx = controls.augmentBehaviour.selIndex
1099+
-- used by TradeQuery to change augments accordingly
1100+
self.lastAugmentBehaviour = controls.augmentBehaviour:GetSelValue()
1101+
-- whether weights should be generated
1102+
options.includeRunes = controls.augmentBehaviour:GetSelValue() == "Keep"
1103+
end
1104+
if controls.anointBehaviour then
1105+
-- remember setting
1106+
self.lastAnointBehaviourIdx = controls.anointBehaviour.selIndex
1107+
-- used by TradeQuery to change anoints accordingly
1108+
self.lastAnointBehaviour = controls.anointBehaviour:GetSelValue()
10681109
end
10691110
if controls.jewelType then
10701111
self.lastJewelType = controls.jewelType.selIndex

0 commit comments

Comments
 (0)