diff --git a/Core/MultiBotComm.lua b/Core/MultiBotComm.lua index 6349bfa..1cdb319 100644 --- a/Core/MultiBotComm.lua +++ b/Core/MultiBotComm.lua @@ -15,6 +15,7 @@ local STATE_FRAMING_CAPABILITY = "STATE_FRAMING_V1" local STRATEGY_MUTATION_CAPABILITY = "STRATEGY_MUTATION_V1" local OUTFIT_CAPABILITY = "OUTFIT_V1" local INVENTORY_CAPABILITY = "INVENTORY_V1" +local INVENTORY_BULK_SELL_CAPABILITY = "INVENTORY_BULK_SELL_V1" local STATE_TIMEOUT_SECONDS = 5.0 local STATES_TIMEOUT_SECONDS = 15.0 local STRATEGY_MUTATION_TIMEOUT_SECONDS = 5.0 @@ -213,6 +214,7 @@ local function ensureBridgeState() state.strategyMutationCapable = state.strategyMutationCapable or false state.outfitCapable = state.outfitCapable or false state.inventoryCapable = state.inventoryCapable or false + state.inventoryBulkSellCapable = state.inventoryBulkSellCapable or false state.strategyMutationSeq = state.strategyMutationSeq or 0 state.strategyMutationCommands = state.strategyMutationCommands or {} state.weaponEnchantDebugSeq = state.weaponEnchantDebugSeq or 0 @@ -1518,7 +1520,19 @@ function Comm.RunInventoryItemAction(name, action, itemId, count) action = string.upper(trim(action)) itemId = tonumber(itemId or 0) or 0 count = tonumber(count or 0) or 0 - if name == "" or action == "" or itemId <= 0 or count < 0 or not state.connected then + + local allowsZeroItemId = action == "SELL_GREY" or action == "SELL_VENDOR" + if name == "" or action == "" or itemId < 0 or count < 0 or not state.connected then + return false + end + if allowsZeroItemId then + if state.inventoryCapable ~= true or state.inventoryBulkSellCapable ~= true then + return false + end + if itemId ~= 0 or count ~= 0 then + return false + end + elseif itemId <= 0 then return false end @@ -1566,6 +1580,7 @@ function Comm.MarkDisconnected(reason) state.strategyMutationCapable = false state.outfitCapable = false state.inventoryCapable = false + state.inventoryBulkSellCapable = false state.stateFramingCapable = false local pendingTokens = {} @@ -3239,6 +3254,7 @@ function Comm.HandleAddonMessage(prefix, message, distribution, sender) state.strategyMutationCapable = false state.outfitCapable = false state.inventoryCapable = false + state.inventoryBulkSellCapable = false for capability in string.gmatch(payload or "", "([^,]+)") do capability = trim(capability) if capability == STATE_FRAMING_CAPABILITY then @@ -3249,6 +3265,8 @@ function Comm.HandleAddonMessage(prefix, message, distribution, sender) state.outfitCapable = true elseif capability == INVENTORY_CAPABILITY then state.inventoryCapable = true + elseif capability == INVENTORY_BULK_SELL_CAPABILITY then + state.inventoryBulkSellCapable = true end end debugPrint("ADDON:RX", "CAPS", payload or "") @@ -4453,6 +4471,7 @@ function Comm.OnPlayerEnteringWorld() state.strategyMutationCapable = false state.outfitCapable = false state.inventoryCapable = false + state.inventoryBulkSellCapable = false state.strategyMutationCommands = {} state.details = {} state.stats = {} diff --git a/Locales/MultiBotAceLocale-deDE.lua b/Locales/MultiBotAceLocale-deDE.lua index 4a8cbb6..c42b6f5 100644 --- a/Locales/MultiBotAceLocale-deDE.lua +++ b/Locales/MultiBotAceLocale-deDE.lua @@ -125,6 +125,10 @@ local deDEValues = { ["info.inventory.action.GBANK_DEPOSIT"] = "Gildenbankeinzahlung", ["info.inventory.action.GBANK_WITHDRAW"] = "Gildenbankabhebung", ["info.inventory.action.BUY_ITEM"] = "Gegenstand kaufen", + ["info.inventory.action.SELL_GREY"] = "Graue Gegenstände verkaufen", + ["info.inventory.item_action.sell_grey.ok"] = "Graue Gegenstände verkauft: %d.", + ["info.inventory.action.SELL_VENDOR"] = "Verkaufbare Gegenstände verkaufen", + ["info.inventory.item_action.sell_vendor.ok"] = "Verkaufbare Gegenstände verkauft: %d.", ["info.inventory.item_action.ok"] = "%s: %s x%d.", ["info.inventory.item_action.err"] = "%s fehlgeschlagen: %s", ["info.inventory.item_action.failed"] = "%s fehlgeschlagen.", diff --git a/Locales/MultiBotAceLocale-enGB.lua b/Locales/MultiBotAceLocale-enGB.lua index 9bba4e6..c6ffd94 100644 --- a/Locales/MultiBotAceLocale-enGB.lua +++ b/Locales/MultiBotAceLocale-enGB.lua @@ -125,6 +125,10 @@ local enGBValues = { ["info.inventory.action.GBANK_DEPOSIT"] = "Guild bank deposit", ["info.inventory.action.GBANK_WITHDRAW"] = "Guild bank withdrawal", ["info.inventory.action.BUY_ITEM"] = "Buy item", + ["info.inventory.action.SELL_GREY"] = "Sell grey items", + ["info.inventory.item_action.sell_grey.ok"] = "Grey item sale: %d item(s) sold.", + ["info.inventory.action.SELL_VENDOR"] = "Sell vendor items", + ["info.inventory.item_action.sell_vendor.ok"] = "Vendor item sale: %d item(s) sold.", ["info.inventory.item_action.ok"] = "%s: %s x%d.", ["info.inventory.item_action.err"] = "%s failed: %s", ["info.inventory.item_action.failed"] = "%s failed.", diff --git a/Locales/MultiBotAceLocale-enUS.lua b/Locales/MultiBotAceLocale-enUS.lua index 9fe8d20..45ce42d 100644 --- a/Locales/MultiBotAceLocale-enUS.lua +++ b/Locales/MultiBotAceLocale-enUS.lua @@ -125,6 +125,10 @@ local enUSValues = { ["info.inventory.action.GBANK_DEPOSIT"] = "Guild bank deposit", ["info.inventory.action.GBANK_WITHDRAW"] = "Guild bank withdrawal", ["info.inventory.action.BUY_ITEM"] = "Buy item", + ["info.inventory.action.SELL_GREY"] = "Sell grey items", + ["info.inventory.item_action.sell_grey.ok"] = "Grey item sale: %d item(s) sold.", + ["info.inventory.action.SELL_VENDOR"] = "Sell vendor items", + ["info.inventory.item_action.sell_vendor.ok"] = "Vendor item sale: %d item(s) sold.", ["info.inventory.item_action.ok"] = "%s: %s x%d.", ["info.inventory.item_action.err"] = "%s failed: %s", ["info.inventory.item_action.failed"] = "%s failed.", diff --git a/Locales/MultiBotAceLocale-esES.lua b/Locales/MultiBotAceLocale-esES.lua index 697c882..81a87bf 100644 --- a/Locales/MultiBotAceLocale-esES.lua +++ b/Locales/MultiBotAceLocale-esES.lua @@ -125,6 +125,10 @@ local esESValues = { ["info.inventory.action.GBANK_DEPOSIT"] = "Depósito en banco de hermandad", ["info.inventory.action.GBANK_WITHDRAW"] = "Retiro de banco de hermandad", ["info.inventory.action.BUY_ITEM"] = "Comprar objeto", + ["info.inventory.action.SELL_GREY"] = "Vender objetos grises", + ["info.inventory.item_action.sell_grey.ok"] = "Venta de objetos grises: %d objeto(s) vendido(s).", + ["info.inventory.action.SELL_VENDOR"] = "Vender objetos vendibles", + ["info.inventory.item_action.sell_vendor.ok"] = "Venta de objetos vendibles: %d objeto(s) vendido(s).", ["info.inventory.item_action.ok"] = "%s: %s x%d.", ["info.inventory.item_action.err"] = "%s falló: %s", ["info.inventory.item_action.failed"] = "%s falló.", diff --git a/Locales/MultiBotAceLocale-frFR.lua b/Locales/MultiBotAceLocale-frFR.lua index 8303638..bff1c45 100644 --- a/Locales/MultiBotAceLocale-frFR.lua +++ b/Locales/MultiBotAceLocale-frFR.lua @@ -125,6 +125,10 @@ local frFRValues = { ["info.inventory.action.GBANK_DEPOSIT"] = "Dépôt banque de guilde", ["info.inventory.action.GBANK_WITHDRAW"] = "Retrait banque de guilde", ["info.inventory.action.BUY_ITEM"] = "Achat objet", + ["info.inventory.action.SELL_GREY"] = "Vente des objets gris", + ["info.inventory.item_action.sell_grey.ok"] = "Vente des objets gris : %d objet(s) vendu(s).", + ["info.inventory.action.SELL_VENDOR"] = "Vente des objets vendables", + ["info.inventory.item_action.sell_vendor.ok"] = "Vente des objets vendables : %d objet(s) vendu(s).", ["info.inventory.item_action.ok"] = "%s : %s x%d.", ["info.inventory.item_action.err"] = "%s échoué : %s", ["info.inventory.item_action.failed"] = "%s échoué.", diff --git a/Locales/MultiBotAceLocale-koKR.lua b/Locales/MultiBotAceLocale-koKR.lua index 2394a76..c5234e6 100644 --- a/Locales/MultiBotAceLocale-koKR.lua +++ b/Locales/MultiBotAceLocale-koKR.lua @@ -125,6 +125,10 @@ local koKRValues = { ["info.inventory.action.GBANK_DEPOSIT"] = "길드 은행 입금", ["info.inventory.action.GBANK_WITHDRAW"] = "길드 은행 인출", ["info.inventory.action.BUY_ITEM"] = "아이템 구매", + ["info.inventory.action.SELL_GREY"] = "회색 아이템 판매", + ["info.inventory.item_action.sell_grey.ok"] = "회색 아이템 %d개를 판매했습니다.", + ["info.inventory.action.SELL_VENDOR"] = "판매 가능 아이템 판매", + ["info.inventory.item_action.sell_vendor.ok"] = "판매 가능 아이템 %d개를 판매했습니다.", ["info.inventory.item_action.ok"] = "%s: %s x%d.", ["info.inventory.item_action.err"] = "%s 실패: %s", ["info.inventory.item_action.failed"] = "%s 실패.", diff --git a/Locales/MultiBotAceLocale-ruRU.lua b/Locales/MultiBotAceLocale-ruRU.lua index 72c2751..96aa4bf 100644 --- a/Locales/MultiBotAceLocale-ruRU.lua +++ b/Locales/MultiBotAceLocale-ruRU.lua @@ -125,6 +125,10 @@ local ruRUValues = { ["info.inventory.action.GBANK_DEPOSIT"] = "Вклад в банк гильдии", ["info.inventory.action.GBANK_WITHDRAW"] = "Снятие из банка гильдии", ["info.inventory.action.BUY_ITEM"] = "Покупка предмета", + ["info.inventory.action.SELL_GREY"] = "Продажа серых предметов", + ["info.inventory.item_action.sell_grey.ok"] = "Продано серых предметов: %d.", + ["info.inventory.action.SELL_VENDOR"] = "Продажа предметов торговцу", + ["info.inventory.item_action.sell_vendor.ok"] = "Продано торговцу предметов: %d.", ["info.inventory.item_action.ok"] = "%s: %s x%d.", ["info.inventory.item_action.err"] = "%s не удалось: %s", ["info.inventory.item_action.failed"] = "%s не удалось.", diff --git a/Locales/MultiBotAceLocale-zhCN.lua b/Locales/MultiBotAceLocale-zhCN.lua index 8e68fcb..d3ffc9e 100644 --- a/Locales/MultiBotAceLocale-zhCN.lua +++ b/Locales/MultiBotAceLocale-zhCN.lua @@ -125,6 +125,10 @@ local zhCNValues = { ["info.inventory.action.GBANK_DEPOSIT"] = "公会银行存入", ["info.inventory.action.GBANK_WITHDRAW"] = "公会银行取出", ["info.inventory.action.BUY_ITEM"] = "购买物品", + ["info.inventory.action.SELL_GREY"] = "出售灰色物品", + ["info.inventory.item_action.sell_grey.ok"] = "已出售 %d 件灰色物品。", + ["info.inventory.action.SELL_VENDOR"] = "出售可售物品", + ["info.inventory.item_action.sell_vendor.ok"] = "已出售 %d 件可售物品。", ["info.inventory.item_action.ok"] = "%s:%s x%d。", ["info.inventory.item_action.err"] = "%s 失败:%s", ["info.inventory.item_action.failed"] = "%s 失败。", diff --git a/UI/MultiBotInventoryFrame.lua b/UI/MultiBotInventoryFrame.lua index e6d3e16..033c0b3 100644 --- a/UI/MultiBotInventoryFrame.lua +++ b/UI/MultiBotInventoryFrame.lua @@ -1037,6 +1037,29 @@ local function runInventoryInstantAction(botName, command, options) end local function runFilteredBulkSell(cmd) + local bridgeAction = nil + if cmd == "s *" then + bridgeAction = "SELL_GREY" + elseif cmd == "s vendor" then + bridgeAction = "SELL_VENDOR" + end + + if bridgeAction + and MultiBot.bridge and MultiBot.bridge.connected == true + and MultiBot.bridge.inventoryCapable == true + and MultiBot.bridge.inventoryBulkSellCapable == true then + if not (MultiBot.Comm and MultiBot.Comm.RunInventoryItemAction) then + return false + end + + local token = MultiBot.Comm.RunInventoryItemAction(botName, bridgeAction, 0, 0) + if token then + return true + end + + return false + end + local inventory = MultiBot.inventory local itemsFrame = inventory and inventory.frames and inventory.frames.Items local itemButtons = itemsFrame and itemsFrame.buttons diff --git a/UI/MultiBotInventoryItem.lua b/UI/MultiBotInventoryItem.lua index 38ea056..51ad909 100644 --- a/UI/MultiBotInventoryItem.lua +++ b/UI/MultiBotInventoryItem.lua @@ -541,12 +541,24 @@ function MultiBot.OnBridgeInventoryItemActionResult(botName, action, itemId, res end if result == "OK" then - addInventorySystemMessage(string.format( - inventoryItemL("inventory.item_action.ok", "%s: %s x%d."), - actionLabel, - itemName, - tonumber(moved or 0) or 0 - )) + if action == "SELL_GREY" then + addInventorySystemMessage(string.format( + inventoryItemL("inventory.item_action.sell_grey.ok", "Grey item sale: %d item(s) sold."), + tonumber(moved or 0) or 0 + )) + elseif action == "SELL_VENDOR" then + addInventorySystemMessage(string.format( + inventoryItemL("inventory.item_action.sell_vendor.ok", "Vendor item sale: %d item(s) sold."), + tonumber(moved or 0) or 0 + )) + else + addInventorySystemMessage(string.format( + inventoryItemL("inventory.item_action.ok", "%s: %s x%d."), + actionLabel, + itemName, + tonumber(moved or 0) or 0 + )) + end requestInventoryPostActionRefresh(botName, 0.45, 1.20) if MultiBot.RefreshBotBank and (action == "BANK_DEPOSIT" or action == "BANK_WITHDRAW") then