-
Notifications
You must be signed in to change notification settings - Fork 0
API UO SendShopReply en
ClassicUO / Basic IDE
Submits an item selection to the most recent active NPC vendor offer. The offer determines whether you buy from or sell to the NPC.
UO.SendShopReply(reply:Any) -> Unit
-
reply— String: "serial:quantity"; separate entries with |, ; or comma. = may replace :. Serial is the entry ID from GetShopList, decimal or 0x, not its graphic or vendor ID. Quantity is a positive integer of units, not stacks; omission means 1. Case-insensitive "accept" or "1" confirms the window draft; an empty string cancels with an empty reply.
Unit: no value, Boolean, total or purchase confirmation is returned. The server decides whether the trade is valid. Check updated items, gold or server messages after submission.
- First open buying or selling with the intended NPC through a game action and wait for its server offer. These commands do not find a vendor, open trade, price a personal vendor item or move items between containers. There is no vendor-ID argument: the most recent offer is used.
- The manager keeps the offer in the game session. Closing graphics retains the offer and draft; reopening restores the view. Closing the shop itself, replying, server closure or disconnection removes it. Bad Newbie automatic buying/selling can handle the offer before a script.
- Reading sends no packets. This is a snapshot of received data, not guaranteed current NPC stock. Amount counts units; GetArrayLength(rows) counts entries. GetShopList reads prices; SendShopReply does not accept a price.
- An explicit list replaces the draft. Repeated serials add quantities, capped at the full offered amount. Unknown serials, invalid or nonpositive quantities reject the entire reply before sending and preserve the offer. SendShopReply reports an error without an offer. "0" is not cancellation: use "".
SessionShops validates complete server lists/prices and stores the offer. The bridge dispatches on the session thread. SessionShop.GetItems formats rows; ParseSelection validates the selection; Reply sends buy packet 0x3B or sell packet 0x9F and closes the offer. ShopGump displays the same data and preserves quantities and scroll when detached. A server close never echoes another reply.
First open buying or selling with the intended NPC through a game action and wait for its server offer. These commands do not find a vendor, open trade, price a personal vendor item or move items between containers. There is no vendor-ID argument: the most recent offer is used.
String: "serial:quantity"; separate entries with |, ; or comma. = may replace :. Serial is the entry ID from GetShopList, decimal or 0x, not its graphic or vendor ID. Quantity is a positive integer of units, not stacks; omission means 1. Case-insensitive "accept" or "1" confirms the window draft; an empty string cancels with an empty reply.
Project source: src/ClassicUO.Client/Game/Managers/ClassicUOInjectionApiBridge.cs; function SendShopReply.
An explicit list replaces the draft. Repeated serials add quantities, capped at the full offered amount. Unknown serials, invalid or nonpositive quantities reject the entire reply before sending and preserve the offer. SendShopReply reports an error without an offer. "0" is not cancellation: use "".
The manager keeps the offer in the game session. Closing graphics retains the offer and draft; reopening restores the view. Closing the shop itself, replying, server closure or disconnection removes it. Bad Newbie automatic buying/selling can handle the offer before a script.
Project source: src/ClassicUO.Client/Game/Managers/SessionShops.cs; function SessionShop.ParseSelection/Reply.
Unit: no value, Boolean, total or purchase confirmation is returned. The server decides whether the trade is valid. Check updated items, gold or server messages after submission.
# Select up to three units from the first entry
#
# Submits an item selection to the most recent active NPC vendor offer. The offer determines
# whether you buy from or sell to the NPC.
#
# Unit: no value, Boolean, total or purchase confirmation is returned. The server decides
# whether the trade is valid. Check updated items, gold or server messages after submission.
SUB Main()
# Selects up to 3 units using the actual first entry serial. This buys in a buy offer and sells
# in a sell offer: check which offer you opened.
VAR rows = UO.GetShopList()
IF GetArrayLength(rows) = 0 THEN
RETURN
END IF
VAR amount = CInt(GetWord(rows[0], 3, "|"))
IF amount > 3 THEN
amount = 3
END IF
IF amount > 0 THEN
UO.SendShopReply(GetWord(rows[0], 0, "|") + ":" + CStr(amount))
END IF
END SUBParameter and execution notes:
- Selects up to 3 units using the actual first entry serial. This buys in a buy offer and sells in a sell offer: check which offer you opened.
# Select one unit per entry within a budget
#
# Submits an item selection to the most recent active NPC vendor offer. The offer determines
# whether you buy from or sell to the NPC.
#
# Unit: no value, Boolean, total or purchase confirmation is returned. The server decides
# whether the trade is valid. Check updated items, gold or server messages after submission.
SUB Main()
# BUY offers only: budget 30, type 0x0E21. Selects one unit per matching entry when price is
# positive and fits the remaining budget. | combines entries into one reply.
VAR budget = 30
VAR reply = ""
VAR rows = UO.GetShopList()
FOR VAR i = 0 TO GetArrayLength(rows) - 1
VAR row = rows[i]
IF GetWord(row, 1, "|") = "0x0E21" THEN
VAR price = CDbl(GetWord(row, 4, "|"))
VAR amount = CInt(GetWord(row, 3, "|"))
IF price > 0 AND price <= budget AND amount > 0 THEN
IF reply <> "" THEN
reply = reply + "|"
END IF
reply = reply + GetWord(row, 0, "|") + ":1"
budget = budget - price
END IF
END IF
NEXT
IF reply <> "" THEN
UO.SendShopReply(reply)
END IF
END SUBParameter and execution notes:
- BUY offers only: budget 30, type 0x0E21. Selects one unit per matching entry when price is positive and fits the remaining budget. | combines entries into one reply.
# Confirm the window draft
#
# Submits an item selection to the most recent active NPC vendor offer. The offer determines
# whether you buy from or sell to the NPC.
#
# Unit: no value, Boolean, total or purchase confirmation is returned. The server decides
# whether the trade is valid. Check updated items, gold or server messages after submission.
SUB Main()
# First select quantities in the shop window. "accept" sends that draft, which survives closing
# graphics. With no selection it sends an empty reply. "1" is an acceptance alias, not an item
# serial.
UO.SendShopReply("accept")
END SUBParameter and execution notes:
- First select quantities in the shop window. "accept" sends that draft, which survives closing graphics. With no selection it sends an empty reply. "1" is an acceptance alias, not an item serial.
# Cancel the offer
#
# Submits an item selection to the most recent active NPC vendor offer. The offer determines
# whether you buy from or sell to the NPC.
#
# Unit: no value, Boolean, total or purchase confirmation is returned. The server decides
# whether the trade is valid. Check updated items, gold or server messages after submission.
SUB Main()
# An empty string sends an empty reply and closes the active offer. Checking GetShopList avoids
# calling with no items, but cannot distinguish an empty offer from no offer.
IF GetArrayLength(UO.GetShopList()) > 0 THEN
UO.SendShopReply("")
END IF
END SUBParameter and execution notes:
- An empty string sends an empty reply and closes the active offer. Checking GetShopList avoids calling with no items, but cannot distinguish an empty offer from no offer.
Shop lists / Списки покупки и продажи
Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
ClassicUO
Bad Newbie & Basic IDE
Найти в справочнике
Клиент и скрипты
Каталоги значений
Разработка и помощь