Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion Core/MultiBotComm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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
Expand All @@ -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 "")
Expand Down Expand Up @@ -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 = {}
Expand Down
4 changes: 4 additions & 0 deletions Locales/MultiBotAceLocale-deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 4 additions & 0 deletions Locales/MultiBotAceLocale-enGB.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 4 additions & 0 deletions Locales/MultiBotAceLocale-enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
4 changes: 4 additions & 0 deletions Locales/MultiBotAceLocale-esES.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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ó.",
Expand Down
4 changes: 4 additions & 0 deletions Locales/MultiBotAceLocale-frFR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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é.",
Expand Down
4 changes: 4 additions & 0 deletions Locales/MultiBotAceLocale-koKR.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 실패.",
Expand Down
4 changes: 4 additions & 0 deletions Locales/MultiBotAceLocale-ruRU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 не удалось.",
Expand Down
4 changes: 4 additions & 0 deletions Locales/MultiBotAceLocale-zhCN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 失败。",
Expand Down
23 changes: 23 additions & 0 deletions UI/MultiBotInventoryFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment thread
Wishmaster117 marked this conversation as resolved.
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
Expand Down
24 changes: 18 additions & 6 deletions UI/MultiBotInventoryItem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading