EN Shop Lists - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

Buying and selling: rule owners and vendor offers

Українська · English · Русский · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

The setting belongs to this script execution. A new run copies the independent engine/chat defaults once, not the graphical Profile. A script setter changes neither the GUI nor other runs already executing. Named objects, types, equipment sets, Ignore lists and globals deliberately retain their documented shared scope.

A standalone chat command changes the lasting engine context: later commands read that value and new runs copy it. Existing runs keep their own values. Chat automation has its own controller and keeps operating after the command returns; GUI automation uses separate settings.

Rules from every enabled list (Enabled=true) are processed, independently of which list the GUI editor displays. The default list is preserved; orphaned list references are recovered as disabled lists.

The controller processes an actual vendor offer received from the server, applies quantity/price limits and sends a buy/sell request. A getter does not open trading. Delay is scheduled after a request; it is not Wait and does not reschedule an existing deadline. Script automation ends when its run completes or is stopped. Keep the run active for the intended actions; a script that only configures rules and returns does not leave a background controller.

Script automation runs while its execution is active; completion or Stop removes its controller. In the example, 5000 is a wait in milliseconds during which you manually open the desired NPC offer. Configuring a rule neither opens trading nor confirms a transaction.

Creates, updates or removes a rule in this execution’s default list. A new rule is enabled, but a disabled list is not automatically enabled. Graphical profile settings do not change.

-1 or 65535 means any color; 0 means uncolored. Use 0…65534 for an exact hue.

A positive unit limit per offer, capped at 65535. Zero or a negative value removes the rule, unlike Amount=0 in the typed DTO. This is not a target backpack balance.

Clears this owner’s buy/sell rules and disables both automations. List definitions and loot rules remain. The command does not cancel a request already sent to the server.

Default: Buy/Sell color=-1, quantity=1; Buy maxPrice=0, name="".

C# uses a typed array: the getter returns a separate copy and the setter replaces the entire array. Editing a returned object alone does not change automation. Chat passes JSON with snake_case field names.

See execution state and gameplay settings.

Standalone examples

Replace demonstration serials or names with your own before running. Each block is a complete, separate .csx without a hidden wrapper.

buy rules

UO.AutoBuyRules(Array.Empty<global::ClassicUO.CSharp.GameplayItemRule>());
UO.AutoBuyLists(new[] { new global::ClassicUO.CSharp.GameplayRuleList { Id = "default", Name = "Default", Enabled = true } });
UO.Buy(0x0E21, -1, 10, 4, "");
UO.Wait(5000);

sell rules

UO.AutoSellRules(Array.Empty<global::ClassicUO.CSharp.GameplayItemRule>());
UO.AutoSellLists(new[] { new global::ClassicUO.CSharp.GameplayRuleList { Id = "default", Name = "Default", Enabled = true } });
UO.Sell(0x0F51, -1, 3);
UO.Wait(5000);

UO.GetShopList

foreach (string row in UO.GetShopList())
    UO.Print(row);

UO.AutoBuy · UO.AutoBuyEx · UO.AutoSell · UO.Buy · UO.Sell · UO.ClearShopList · UO.GetShopList · UO.SendShopReply