ZH TW UO Topic containers - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
家 · C# · IDE · UO API · A–Z · 範例 · Languages
閱讀內容,打開並選擇目標容器。關閉或尚未裝載的貨櫃不會向客戶提供完整的物品清單。
| 主題 | 命令與解釋 |
|---|---|
| Backpack | UO.Backpack |
| Bank | UO.ObjAtLayerEx · UO.OpenContainer |
| OpenContainer | UO.OpenContainer |
| LastContainer | UO.LastContainer |
| ContainerOf | UO.ContainerOf · UO.GetParent |
| IsContainer | UO.IsContainer |
| 嵌套容器 | UO.GetContent · UO.FindTypeEx · UO.FindTypesArrayEx |
| Receiving Container | UO.SetReceivingContainer · UO.UnsetReceivingContainer |
| Catch Bag | UO.SetCatchBag · UO.UnsetCatchBag |
| Container Transfers | UO.MoveItem · UO.MoveItems · UO.MassMove · UO.EmptyContainer |
UO.ContainerOf · UO.GetParent · UO.ContainerOff
UO.SetReceivingContainer · UO.UnsetReceivingContainer
UO.SetCatchBag · UO.UnsetCatchBag
每個命令卡都有幾個獨立的場景:直接程式碼、函數和類別。以下是精選的簡短場景;限制和全面分析是有可能的。
UO.OpenContainer("lasttarget");UO.Print("Select a chest or corpse");
var sent = UO.EmptyContainer(350);
if (Truth(sent == 0))
{
UO.Print("Cancelled, empty, unavailable, or a transfer failed");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Backpack();返回目前角色裝備背包的ID。
沒有參數。
int - serial/ID,而非 graphic/type、圖層、項目數或 bool。 0—當前沒有物件。所有32位serial均被保存;檢查 != 0,而不是 == true 或 > 0。儲存的結果不會自行更新。在目前播放器的Backpack圖層上搜尋未刪除的項目。沒有/被摧毀的玩家,沒有移除背包或包包 - 0。返回容器,而不是內容;不建立新包。
- 沒有參數。通过游戏流上的Invoke读取本地数据;取消脚本会中断对该线程的等待。不发送包裹,不打开容器/目标,也不转移物品。
- 除非被腳本變數覆蓋,否則將再次讀取不含括號的內建self/backpack。字串名稱由接收命令處理。在攜帶目的地中,「self」表示背包,UO.Self()返回角色的serial。對於 ID 容器,明確使用 UO.Backpack()。
- World.Clear 移除玩家;隨後的讀數產生0。進入世界或更換裝備包都可以改變ID。單獨的讀取不是原子的。非零 ID 不證明連線、伺服器解析或內容載入。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
將一次呼叫的結果輸出到日誌。數值不會轉換成 bool;若結果是陣列,則顯示元素數量。
var result = UO.Backpack();
UO.Print("Backpack: " + Convert.ToString(result));參數與執行流程:
- id 儲存一次呼叫的結果; HEX 將 serial 格式化為日誌。此範例沒有選擇或使用任何內容。
var id = UO.Backpack();
UO.Print("ID: " + Hex(id));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");參數與執行流程:
- before/after 以250 ms 的間隔讀取。 UO.Wait 僅作為範例添加。相等意味著最終的ID相同;中間的變化可能會被錯過。
return await RunScenarioAsync();
async Task<object?> RunScenarioAsync()
{
var before = UO.Backpack();
await Delay(250);
var after = UO.Backpack();
if (Truth(before != after))
{
UO.Print("ID changed: " + Hex(after));
}
return null;
}
Task Delay(object? milliseconds) => WaitAsync(checked((int)Convert.ToDouble(milliseconds)));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- 候選人 - 已保存IDLastTarget。 IsOwnSerial(候選者)取 1 serial 並回傳 bool:true 為目前非零自己的 ID,否則為 false。完整給出了函數定義;目標不變。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var candidate = UO.LastTarget();
if (Truth(Truth(IsOwnSerial(candidate)) == true))
{
UO.Print("Own object selected");
}
else
{
UO.Print("Different object or no own object");
}
return null;
}
dynamic IsOwnSerial(dynamic candidate)
{
var current = UO.Backpack();
return Truth(current != 0) && Truth(current == candidate);
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: int / Integer.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
內部實作程式碼,不能作為獨立腳本執行。
case "backpack": return new InjectionValue(bridge.Backpack);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
string UO.ContainerOf(object? name);讀取該項目的直接父項。
-
name— 特定对象的串行/ID:int、十进制/十六进制字符串或设置别名self、backpack、lasttarget、lastobject 或名称AddObject。這不是graphic/type。
「0x40001234」形式的string - 容器/角色擁有者的serial。對於地面上的物品,它是“0x00000000”或“0xFFFFFFFF”。對於未知名稱/物件或手機 - “0x00000000”。它不是容器的graphic,不是專案本身的ID,也不是嵌套包的根擁有者。
- 讀取本地item的Container字段,無需遞歸遍歷和呼叫伺服器。在解釋空結果之前檢查Exists。 Ground 使用兩種有效的表示形式。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
將一次呼叫的結果輸出到日誌。數值不會轉換成 bool;若結果是陣列,則顯示元素數量。
var result = UO.ContainerOf("backpack");
UO.Print("ContainerOf: " + Convert.ToString(result));參數與執行流程:
- 專案是找到的堆疊的serial。 type=0x0EED 僅由FindType 傳輸。
- Parent 表示實際的背包,而不是包含背包的角色。
var item = UO.FindType(0x0EED, -1, "backpack");
if (Truth(item != ""))
{
var parent = UO.ContainerOf(item);
UO.Print(Convert.ToString(parent));
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- 爭論的焦點是背包本身。
- 裝備背包的父級將是角色的serial。
return RunScenario();
object? RunScenario()
{
var bag = UO.GetSerial("backpack");
if (Truth(UO.Exists(bag)))
{
UO.Print(Convert.ToString(UO.ContainerOf(bag)));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- GetContent("ground") 給出容器外的 ID 物品。
- 土地的兩種表述都是有效的。沒有 Exists 的空父級不足以推斷項目的位置。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var items = UO.GetContent("ground");
if (Truth(ArrayLength(items) > 0))
{
var item = items[0];
if (Truth(UO.Exists(item)))
{
UO.Print(Convert.ToString(UO.ContainerOf(item)));
}
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: name (Any)
結果: string / String.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ContainerOf. -
InjectionScript.Runtime.InjectionApiUO.TryGetObject:TryGetObject(name, out int id). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ContainerOf:bridge.ContainerOf(id).
內部實作程式碼,不能作為獨立腳本執行。
public string ContainerOf(InjectionValue name)
{
if (TryGetObject(name, out int id))
{
var containerId = bridge.ContainerOf(id);
if (containerId < 0)
return "0xFFFFFFFF";
return $"0x{containerId:X8}";
}
return "0x00000000";
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.ContainerOff();重設指定的接收運行時容器。
沒有參數。
void - 無回傳值。
- 呼叫UnsetReceivingContainer並寫入State.ReceivingContainer=0。如果背包可用,則以下沒有明確分配的Grab操作將使用背包。項目不會移動,容器視窗也不會關閉。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
指令是獨立的陳述式。前面的訊息表示呼叫開始,並非伺服器已完成動作的確認。
UO.Print("Calling UO.ContainerOff");
UO.ContainerOff();參數與執行流程:
- 狀態ReceivingContainer變為0。
UO.ContainerOff();參數與執行流程:
- 任務已清除;該操作不會移動內容。
return RunScenario();
object? RunScenario()
{
UO.SetReceivingContainer("backpack");
UO.ContainerOff();
return null;
}參數與執行流程:
- 空狀態允許重複重置。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.ContainerOff();
UO.ContainerOff();
return null;
}
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.UnsetReceivingContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UnsetReceivingContainer:bridge.UnsetReceivingContainer().
內部實作程式碼,不能作為獨立腳本執行。
public void UnsetReceivingContainer() => bridge.UnsetReceivingContainer();Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetContent(object? id);直接讀取地面上貨櫃或裝載物品的內容。
-
id— Serial/ID 具體對象: int、十進制/十六進位字串或已建立的別名 self, backpack, lasttarget, lastobject 或姓名 AddObject。這不是 graphic/type。條款 my/backpack 選擇背包。僅明確 0, "0“ 或者 ”ground「選擇土地。別名未知,背包遺失,負面 ID 或不適當的值類型會導致空數組。
每個直接子級的陣列 - serial。對於ground/0 - 容器外的物品;考慮正常接地標記 0 和 0xFFFFFFFF。如果沒有條目,則傳回空數組。此清單包含 ID,而非 type,且沒有圖層。
- 讀取客戶端已經下載的資料。該命令不會開啟容器、移動項目或從整個伺服器下載物件。
- 陣列 - 索引從 0 開始的陣列。保存在var,訪問前檢查ArrayLength。拍攝快照後,元素可能會從世界中消失:在採取行動之前檢查Exists(serial)。
- 沒有嵌套袋的遞歸遍歷、距離排序、Ignore或FindDistance/FindVertical過濾器。常規的FindType快照保持不變。
- 未打開的箱子可能看起來是空的:沒有收到資料並不能證明伺服器是空的。首先使用打開的容器並等待其內容物。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
將一次呼叫的結果輸出到日誌。數值不會轉換成 bool;若結果是陣列,則顯示元素數量。
object? result = UO.GetContent("backpack");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));參數與執行流程:
- ID="backpack" - 目前角色的背包,僅限直接嵌套物品。
- 長度 - 記錄數/ID。這不是堆疊中的金額數量。空列表給出0。
var items = UO.GetContent("backpack");
UO.Print(Convert.ToString(ArrayLength(items)));
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;參數與執行流程:
- ID="backpack" - 目前角色的背包,僅限直接嵌套物品。
- items[i] — 數字 serial。十六進制僅用於輸出。循環不存取最後一個索引。
return RunScenario();
object? RunScenario()
{
var items = UO.GetContent("backpack");
var i = 0;
while (Truth(i < ArrayLength(items)))
{
UO.Print("0x" + Hex(items[i]));
i = i + 1;
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- ID="backpack" - 目前角色的背包,僅限直接嵌套物品。
- 檢查兩個不同的事情:快照中的記錄和物件現在是否存在。沒有明確排序的順序並不意味著接近。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var items = UO.GetContent("backpack");
if (Truth(ArrayLength(items) > 0))
{
var first = items[0];
if (Truth(UO.Exists(first)))
{
UO.Print(UO.GetName(first));
}
}
else
{
UO.Print("Empty list");
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}參數與執行流程:
- ID="ground" 明確選擇地面。 NPC/players 不包含在此清單中。
- 這裡的搜尋半徑不限於FindDistance。對於過濾器type和距離,有GetWorldItems(type,顏色,距離)。
var groundItems = UO.GetContent("ground");
UO.Print(Convert.ToString(ArrayLength(groundItems)));
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: id (Any)
結果: dynamic / Any.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Text:Text(0). -
InjectionScript.Runtime.NumberConversions.TryStr2Int:NumberConversions.TryStr2Int(text, out int literal). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(text). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetEquipment:bridge.GetEquipment(container). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetContent:bridge.GetContent(container). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
內部實作程式碼,不能作為獨立腳本執行。
case "getcontent":
case "getequipment":
{
InjectionValue selection = arguments[0];
bool ground = false, explicitZero;
int container;
if (selection.Kind == InjectionValueKind.String)
{
string text = Text(0).Trim();
ground = text.Equals("ground", StringComparison.OrdinalIgnoreCase);
explicitZero = NumberConversions.TryStr2Int(text, out int literal) && literal == 0;
container = ground ? 0 : text.Equals("my", StringComparison.OrdinalIgnoreCase)
? bridge.Backpack : GetObject(text);
}
else
{
if (selection.Kind != InjectionValueKind.Integer && selection.Kind != InjectionValueKind.Decimal)
return new InjectionValue(Array.Empty<InjectionValue>());
container = Arg(0);
explicitZero = selection.Kind == InjectionValueKind.Integer ? selection.Integer == 0 : selection.Decimal == 0d;
}
// Only an explicit ground/zero selector may query world items.
if (container < 0 || container == 0 && !ground && !explicitZero)
return new InjectionValue(Array.Empty<InjectionValue>());
bool equipment = name.Equals("GetEquipment", StringComparison.OrdinalIgnoreCase);
int[] items = equipment
? container == 0 ? Array.Empty<int>() : bridge.GetEquipment(container)
: bridge.GetContent(container);
return new InjectionValue(items.Select(serial => new InjectionValue(serial)).ToArray());
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.GetParent(object? objID);讀取該項目的直接父項。
-
objID— 特定对象的串行/ID:int、十进制/十六进制字符串或设置别名self、backpack、lasttarget、lastobject 或名称AddObject。這不是graphic/type。
int - serial 容器/角色擁有者。對於地面上的物品,它是0或-1(位0xFFFFFFFF),取決於客戶端的輸入。對於未知物體或移動設備 - 0。它不是容器的graphic,不是專案本身的ID,也不是嵌套包的根擁有者。
- 讀取本地item的Container字段,無需遞歸遍歷和呼叫伺服器。在解釋空結果之前檢查Exists。 Ground 使用兩種有效的表示形式。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
將一次呼叫的結果輸出到日誌。數值不會轉換成 bool;若結果是陣列,則顯示元素數量。
object? result = UO.GetParent("backpack");
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));參數與執行流程:
- 專案是找到的堆疊的serial。 type=0x0EED 僅由FindType 傳輸。
- Parent 表示實際的背包,而不是包含背包的角色。
var item = UO.FindType(0x0EED, -1, "backpack");
if (Truth(item != ""))
{
var parent = UO.GetParent(item);
UO.Print(Convert.ToString(parent));
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- 爭論的焦點是背包本身。
- 裝備背包的父級將是角色的serial。
return RunScenario();
object? RunScenario()
{
var bag = UO.GetSerial("backpack");
if (Truth(UO.Exists(bag)))
{
UO.Print(Convert.ToString(UO.GetParent(bag)));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- GetContent("ground") 給出容器外的 ID 物品。
- 土地的兩種表述都是有效的。沒有 Exists 的空父級不足以推斷項目的位置。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var items = UO.GetContent("ground");
if (Truth(ArrayLength(items) > 0))
{
var item = items[0];
if (Truth(UO.Exists(item)))
{
UO.Print(Convert.ToString(UO.GetParent(item)));
}
}
return null;
}
int ArrayLength(object? value) => value is System.Array array ? array.Length : 0;
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: objID (Any)
結果: dynamic / Any.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.ContainerOf:bridge.ContainerOf(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
內部實作程式碼,不能作為獨立腳本執行。
case "getparent": return new InjectionValue(bridge.ContainerOf(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.Ground();傳回搜尋容器參數或傳送目的地的特殊土地指示符。
沒有參數。
int,永远是0。这个零是有效的地面指示符,不是false,不是搜索错误,不是ID项目,graphic,地图编号或坐标。不要檢查Ground()作為成功的標誌;檢查傳遞該值的搜尋或傳輸結果。
- 沒有參數。 Ground() 呼叫本身不搜尋任何東西,不移動任何東西,不開啟目標,不傳送資料包,也不改變先前搜尋的結果。進入遊戲前,同樣返回0。
- 發送 FindType、FindList、Count、FindTypeEx、FindTypesArrayEx、CountEx 或 MoveItem 指令到容器/目標位置。搜尋會看到載入的世界對象,但不會載入遠處的儲存格。用於傳輸到地面 X/Y/Z - 世界座標,而不是容器視窗像素。
- FindType(type, color) 仍然在庫存中尋找:第二個參數是顏色。對於土地,寫 FindType(type,顏色,UO.Ground())。在舊緊湊型FindType/MoveItem中,數字-1表示庫存;在相容的FindTypeEx/FindTypesArrayEx/CountEx - 1 也允許作為接地。使用UO.Ground()或明確名稱ground,請勿在未經檢查的情況下在不同指令之間傳遞數字名稱。
- 命令與上述範例之間的符號差異描述了該客戶端。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
將一次呼叫的結果輸出到日誌。數值不會轉換成 bool;若結果是陣列,則顯示元素數量。
var result = UO.Ground();
UO.Print("Ground: " + Convert.ToString(result));參數與執行流程:
- 目的地接收int0,Print輸出該數字。呼叫本身不會丟棄任何內容。
var destination = UO.Ground();
UO.Print(Convert.ToString(destination));參數與執行流程:
- 0x0EED - 金色圖形;第二個-1表示任何hue。 Ground() 設定全域搜索,false 停用容器遞歸。如果沒有結果,FindTypeEx 回傳 1 serial 或 0。 != 0 檢查此serial。使用當前的FindDistance/FindVertical和列表Ignore。
return RunScenario();
object? RunScenario()
{
var id = UO.FindTypeEx(0x0EED, -1, UO.Ground(), false);
if (Truth(id != 0))
{
UO.Print(Hex(id));
}
else
{
UO.Print("0");
}
return null;
}
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- FindGroundTypes(firstType、secondType、半徑、高度)搜尋半徑=5、高度=10的黃金0x0EED和黑珍珠0x0F7A。宣告變數類型[1]建立兩個儲存格;顏色[0]和容器[0] - 各一個。整個堆疊算一個結果;類型/顏色是可選的,相交的容器不會重複ID。函數傳回已儲存的陣列serial;最終恢復了這兩個極限。每個ID的主要輸出。完整給出了功能代碼。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var ids = FindGroundTypes(0x0EED, 0x0F7A, 5, 10);
foreach (var id in ids)
{
UO.Print(Hex(id));
}
return null;
}
dynamic FindGroundTypes(dynamic firstType, dynamic secondType, dynamic radius, dynamic height)
{
var oldDistance = UO.FindDistance();
var oldVertical = UO.FindVertical();
dynamic[] types = new dynamic[checked((int)(1) + 1)];
types[0] = firstType;
types[1] = secondType;
dynamic[] colors = new dynamic[checked((int)(0) + 1)];
colors[0] = -1;
dynamic[] containers = new dynamic[checked((int)(0) + 1)];
containers[0] = UO.Ground();
try
{
UO.FindDistance(radius);
UO.FindVertical(height);
UO.FindTypesArrayEx(types, colors, containers, false);
return UO.GetFoundItems();
}
finally
{
UO.FindDistance(oldDistance);
UO.FindVertical(oldVertical);
}
}
string Hex(object? value) => Convert.ToInt64(value).ToString("X");
}參數與執行流程:
- 將 0x40001001 替換為可用項目的 serial。 IsObjectExists 首先檢查已載入的物件。 MoveItem(物品、金額、目的地、X、Y、Z):金額=0 - 整個堆棧、Ground() - 土地、GetX/GetY/GetZ - 角色的世界單元。若客戶端接受了轉帳請求,結果為1,否則為0。這是MoveItem的結果,而不是Ground(),也不是來自伺服器的傳送確認。
var item = 0x40001001;
if (Truth(UO.IsObjectExists(item)))
{
var result = UO.MoveItem(item, 0, UO.Ground(), UO.GetX("self"), UO.GetY("self"), UO.GetZ("self"));
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: int / Integer.
呼叫時:
內部實作程式碼,不能作為獨立腳本執行。
case "ground": return new InjectionValue(0);Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
int UO.IsContainer(object? objID);檢查已載入項目的圖形類型的tiledata中的Container標誌。
-
objID— 特定对象的强制 serial/ID:int,十六进制字符串或别名 self、backpack、lasttarget、lastobject、lastcontainer、laststatus、finditem、lastcorpse或名稱AddObject。這不是graphic/type。未指定的名稱解析為0;該指令不會開啟任何新目標。
int 1 - 已知項目在其 graphic 資料中具有容器屬性。 int 0 - 沒有這樣的標誌,該物件是mobile,未知或已刪除。这不是容器中物品的数量,不是打开口香糖的标志,也不是对内容物访问的确认。
該命令的結果是一個數字標誌: 1 表示滿足條件, 0 - 未實現。後 var 結果=命令(...)檢查是否(結果!= 0) 或 if (結果 == 0)。儲存一次呼叫的結果:重複呼叫可以再次執行該操作或讀取已經變更的狀態。
- 讀取本機用戶端模型;無需向伺服器發出請求,無需等待或移動。
- 結果指的是閱讀的那一刻。在UO.Wait或其他操作之後,物件及其標誌可能會發生變化。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
將一次呼叫的結果輸出到日誌。數值不會轉換成 bool;若結果是陣列,則顯示元素數量。
var result = UO.IsContainer(UO.GetSerial("lastobject"));
UO.Print("IsContainer: " + Convert.ToString(result));參數與執行流程:
- item 是物件 lastobject 的 serial,而非其 type。
- 此命令僅讀取容器屬性,並不會開啟它。
var item = UO.GetSerial("lastobject");
if (Truth(UO.IsContainer(item)))
{
UO.Print("Known container: " + item);
}
else
{
UO.Print("Not a known container");
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- 必須提前選擇袋子,並且必須讓客戶知道其中的內容。
- FindType接收type黃金,任何hue和serial容器。空結果並不能證明伺服器容器是空的。
return RunScenario();
object? RunScenario()
{
var bag = UO.GetSerial("lasttarget");
if (Truth(UO.IsContainer(bag)))
{
var found = UO.FindType(0x0EED, -1, bag);
UO.Print("Known gold item: " + found);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- Exists 和 IsContainer 回答相同 serial 的不同問題。
- 如果tiledata不合適或尚未可用,分類可能與預期不同;不要用它作為胸部權利的檢查。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var bag = UO.GetSerial("backpack");
var exists = UO.Exists(bag);
var container = UO.IsContainer(bag);
UO.Print("Loaded: " + Convert.ToString(exists));
UO.Print("Container flag: " + Convert.ToString(container));
return null;
}
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: objID (Any)
結果: int / Integer.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.IsContainer:bridge.IsContainer(Arg(0)). -
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility::Arg:Arg(0).
內部實作程式碼,不能作為獨立腳本執行。
case "iscontainer": return new InjectionValue(bridge.IsContainer(Arg(0)));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
dynamic UO.LastContainer();讀取最後一個容器的serial。
沒有參數。
int — 已儲存serial; 0 表示未安裝serial。它不是bool,也不是graphic/type;非零的ID可能不再存在於世界上。
- 欄位來源:_world.LastContainer。該指令不會選擇、使用或攻擊該物件。
- 讀取目前本地狀態。沒有軟體包、目標或自動更新;個別讀取可能會看到不同的狀態。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
將一次呼叫的結果輸出到日誌。數值不會轉換成 bool;若結果是陣列,則顯示元素數量。
object? result = UO.LastContainer();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));參數與執行流程:
- 讀取最後一個容器的serial。
var id = UO.LastContainer();
UO.Print(Hex(id));
string Hex(object? value) => Convert.ToInt64(value).ToString("X");參數與執行流程:
- 欄位來源:_world.LastContainer。該指令不會選擇、使用或攻擊該物件。
return RunScenario();
object? RunScenario()
{
var id = UO.LastContainer();
if (Truth(id != 0) && Truth(UO.Exists(id)))
{
UO.Print(UO.GetName(id));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- 讀取目前本地狀態。沒有軟體包、目標或自動更新;個別讀取可能會看到不同的狀態。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var before = UO.LastContainer();
UO.Wait(500);
var after = UO.LastContainer();
UO.Print(before = after);
return null;
}
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: dynamic / Any.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.GetLastContainer:bridge.GetLastContainer().
內部實作程式碼,不能作為獨立腳本執行。
case "lastcontainer": return new InjectionValue(bridge.GetLastContainer());Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.OpenContainer(object? id);
void UO.OpenContainer(object? id, object? timeout);請求打開容器。
-
id— 序列/ID 物件:int,數字/十六進位字串或已建立的別名,例如「lasttarget」。這不是graphic/type。在採取行動之前檢查裝載的物體。 -
timeout— 可選 int,毫秒;預設為0。負值不會增加預期。
void - 沒有值。使用單獨的線路撥打電話;完成並不確認伺服器的操作。
- Bridge.OpenContainer 呼叫UseObject(id),然後僅當逾時>0 時才呼叫UO.Wait(timeout)。停頓是固定的;不檢查容器的存在/內容。
- 沒有超時就沒有暫停。暫停結束不應被視為內容已開啟或完全載入的證據。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
指令是獨立的陳述式。前面的訊息表示呼叫開始,並非伺服器已完成動作的確認。
UO.Print("Calling UO.OpenContainer");
UO.OpenContainer("lasttarget");參數與執行流程:
- 請求打開容器。
UO.OpenContainer("lasttarget");參數與執行流程:
- Bridge.OpenContainer 呼叫UseObject(id),然後僅當逾時>0 時才呼叫UO.Wait(timeout)。停頓是固定的;不檢查容器的存在/內容。
return RunScenario();
object? RunScenario()
{
if (Truth(UO.Exists("lasttarget")))
{
UO.OpenContainer("lasttarget", 1000);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;參數與執行流程:
- 沒有超時就沒有暫停。暫停結束不應被視為內容已開啟或完全載入的證據。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var id = UO.GetSerial("lasttarget");
if (Truth(UO.Exists(id)))
{
UO.OpenContainer(id, 1000);
UO.Print(UO.GetName(id));
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: id (Any)
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.OpenContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.OpenContainer:bridge.OpenContainer(GetObject(id), 0). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id).
內部實作程式碼,不能作為獨立腳本執行。
public void OpenContainer(InjectionValue id) => bridge.OpenContainer(GetObject(id), 0);參數: id (Any), timeout (Any)
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.OpenContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.OpenContainer:bridge.OpenContainer(GetObject(id), NumberConversions.ToInt(timeout)). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id). -
InjectionScript.Runtime.NumberConversions.ToInt:NumberConversions.ToInt(timeout).
內部實作程式碼,不能作為獨立腳本執行。
public void OpenContainer(InjectionValue id, InjectionValue timeout) => bridge.OpenContainer(GetObject(id), NumberConversions.ToInt(timeout));Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetCatchBag();
void UO.SetCatchBag(object? container);-
container— 容器的序號,其保存的名稱「backpack」或「my」。 0 取消分配。如果沒有參數,則使用 lastobject - 最後應用的對象,而不是重置。如果名稱未解析為正數serial,則分配將被刪除。安裝本身不會檢查伺服器可用性和物件遷移的適用性。
void:無回傳值。如果 UO.SetCatchBag(...),則不能使用 var 結果 = UO.SetCatchBag(...),或期望數字 1 作為確認。實際的移動由單獨的命令執行,例如Grab。
- UO.SetCatchBag()和UO.SetReceivingContainer()具有不同的不帶參數的形式值:第一個採用lastobject,第二個重置容器。
- 明確重設:UO.UnsetCatchBag()、UO.UnsetReceivingContainer() 或 UO.SetCatchBag(0)。重置後,Grab 將使用其背包,無需單獨分配。
- 設定serial並不意味著伺服器將允許該項目放置在那裡。在實際傳輸過程中會檢查距離、存在性和可用性。
- 在常規用戶端主機中,此狀態資料取自GetPersistentState管理器,並且對於同一世界/設定檔的腳本/聊天/巨集是通用的,且不屬於一個腳本。另一個進程或明顯獨立的InjectionRuntimeState具有不同的狀態。載入/清除設定檔可以取代它;已儲存的serial仍然會根據載入的世界進行檢查。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
指令是獨立的陳述式。前面的訊息表示呼叫開始,並非伺服器已完成動作的確認。
UO.Print("Calling UO.SetCatchBag");
UO.SetCatchBag();參數與執行流程:
- 單一容器參數接收字串“backpack”。運行時允許它在你的背包的serial中。
- 該呼叫寫在單獨的行上,沒有 var 結果,因為它會傳回 Unit。訊息Print描述了設置,並不確認項目的傳輸。
var destination = "backpack";
UO.SetCatchBag(destination);
UO.Print("Receiving container: own backpack");參數與執行流程:
- 此重載沒有參數:內部名稱為lastobject。
- 空括號並不意味著重置。只需雙擊即可預先選擇適當的容器。實際攜帶包的可用性取決於遊戲的當前狀態。
return RunScenario();
object? RunScenario()
{
UO.SetCatchBag();
UO.Print("Destination taken from lastobject");
return null;
}參數與執行流程:
- 在第一次呼叫中,container=bag 包含十六進位字串 serial。 0x40001234是一個例子,你需要將其替換為你自己的值。
- 在第二次呼叫中,container=0取消分配它。以下沒有明確容器的 Grab 使用背包。
- 重設位於預期進位區塊之後。設定和重置不會傳回結果,也不會自行移動項目。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var bag = "0x40001234";
UO.SetCatchBag(bag);
UO.Print("Configured destination: " + bag);
UO.SetCatchBag(0);
UO.Print("Destination reset to the normal backpack fallback");
return null;
}
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer:SetReceivingContainer(arguments.Length > 0 ? arguments[0].ToString() : "lastobject"). -
InjectionScript.Runtime.InjectionValue.ToString:arguments[0].ToString().
內部實作程式碼,不能作為獨立腳本執行。
case "setcatchbag":
SetReceivingContainer(arguments.Length > 0 ? arguments[0].ToString() : "lastobject");
break;參數: container (Any)
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer:SetReceivingContainer(arguments.Length > 0 ? arguments[0].ToString() : "lastobject"). -
InjectionScript.Runtime.InjectionValue.ToString:arguments[0].ToString().
內部實作程式碼,不能作為獨立腳本執行。
case "setcatchbag":
SetReceivingContainer(arguments.Length > 0 ? arguments[0].ToString() : "lastobject");
break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.SetReceivingContainer();
void UO.SetReceivingContainer(object? id);設定未來 Grab 的接收容器。
-
id- 可選serial/別名。 “my”/“backpack”-當前背包。正數ID被保留,不進行存在性檢查;0/負數/無參數清除設定。
void - 沒有值。使用單獨的線路撥打電話;完成並不確認伺服器的操作。
- 字串已解析為GetObject,但特殊的 my/backpack 除外。橋接器.SetReceivingContainer 分配狀態.ReceivingContainer。此呼叫不會傳輸該項目。
- 清除後,Grab 在沒有明確目的的情況下使用背包。正值ID本身並不能確認容器已載入或可供伺服器存取。
- 在常規用戶端主機中,此狀態資料取自GetPersistentState管理器,並且對於同一世界/設定檔的腳本/聊天/巨集是通用的,且不屬於一個腳本。另一個進程或明顯獨立的InjectionRuntimeState具有不同的狀態。載入/清除設定檔可以取代它;已儲存的serial仍然會根據載入的世界進行檢查。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
指令是獨立的陳述式。前面的訊息表示呼叫開始,並非伺服器已完成動作的確認。
UO.Print("Calling UO.SetReceivingContainer");
UO.SetReceivingContainer();參數與執行流程:
- 設定未來 Grab 的接收容器。
UO.SetReceivingContainer("backpack");參數與執行流程:
- 字串已解析為GetObject,但特殊的 my/backpack 除外。橋接器.SetReceivingContainer 分配狀態.ReceivingContainer。此呼叫不會傳輸該項目。
return RunScenario();
object? RunScenario()
{
UO.SetReceivingContainer();
return null;
}參數與執行流程:
- 清除後,Grab 在沒有明確目的的情況下使用背包。正值ID本身並不能確認容器已載入或可供伺服器存取。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
var bag = UO.GetSerial("lastcontainer");
if (Truth(UO.IsContainer(bag)))
{
UO.SetReceivingContainer(bag);
}
return null;
}
bool Truth(object? value) => value is bool flag ? flag : value is string text ? !string.IsNullOrEmpty(text) : value != null && Convert.ToDouble(value) != 0;
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer. -
InjectionScript.Runtime.InjectionApiUO.UnsetReceivingContainer:UnsetReceivingContainer().
內部實作程式碼,不能作為獨立腳本執行。
public void SetReceivingContainer() => UnsetReceivingContainer();參數: id (Integer/String)
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UnsetReceivingContainer:bridge.UnsetReceivingContainer(). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.SetReceivingContainer:bridge.SetReceivingContainer(id).
內部實作程式碼,不能作為獨立腳本執行。
public void SetReceivingContainer(int id)
{
if (id <= 0)
bridge.UnsetReceivingContainer();
else
bridge.SetReceivingContainer(id);
}參數: id (Integer/String)
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer. -
InjectionScript.Runtime.InjectionApiUO.SetReceivingContainer:SetReceivingContainer(bridge.Backpack). -
InjectionScript.Runtime.InjectionApiUO.GetObject:GetObject(id). -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.Backpack:bridge.Backpack.
內部實作程式碼,不能作為獨立腳本執行。
public void SetReceivingContainer(string id)
{
string name = (id ?? string.Empty).Trim();
if (name.Equals("my", StringComparison.OrdinalIgnoreCase)
|| name.Equals("backpack", StringComparison.OrdinalIgnoreCase))
{
SetReceivingContainer(bridge.Backpack);
return;
}
SetReceivingContainer(GetObject(id));
}Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UnsetCatchBag();清理 Grab 的接收容器。
沒有參數。
void - 沒有值。使用單獨的線路撥打電話;完成並不確認伺服器的操作。
- ExecuteLegacyManualAlias 呼叫UnsetReceivingContainer;橋分配ReceivingContainer=0。隨後的Grab使用的是背包。這不是去除袋子。
- 僅修改或顯示指定的本機資料。該命令沒有伺服器確認。
- 在常規用戶端主機中,此狀態資料取自GetPersistentState管理器,並且對於同一世界/設定檔的腳本/聊天/巨集是通用的,且不屬於一個腳本。另一個進程或明顯獨立的InjectionRuntimeState具有不同的狀態。載入/清除設定檔可以取代它;已儲存的serial仍然會根據載入的世界進行檢查。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
指令是獨立的陳述式。前面的訊息表示呼叫開始,並非伺服器已完成動作的確認。
UO.Print("Calling UO.UnsetCatchBag");
UO.UnsetCatchBag();參數與執行流程:
- 清理 Grab 的接收容器。
UO.UnsetCatchBag();參數與執行流程:
- ExecuteLegacyManualAlias 呼叫UnsetReceivingContainer;橋分配ReceivingContainer=0。隨後的Grab使用的是背包。這不是去除袋子。
return RunScenario();
object? RunScenario()
{
UO.SetCatchBag("backpack");
UO.UnsetCatchBag();
return null;
}參數與執行流程:
- 僅修改或顯示指定的本機資料。該命令沒有伺服器確認。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.UnsetCatchBag();
UO.Print(UO.Backpack());
return null;
}
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteLegacyManualAlias. -
InjectionScript.Runtime.InjectionApiUO.UnsetReceivingContainer:UnsetReceivingContainer().
內部實作程式碼,不能作為獨立腳本執行。
case "unsetcatchbag": UnsetReceivingContainer(); break;Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
void UO.UnsetReceivingContainer();清除保存的接收容器。
沒有參數。
void - 沒有值。使用單獨的線路撥打電話;完成並不確認伺服器的操作。
- UnsetReceivingContainer 賦值ReceivingContainer=0。隨後的 Grab 使用了一個沒有明確用途的背包。物品不會轉移。
- 僅修改或顯示指定的本機資料。該命令沒有伺服器確認。
- 在常規用戶端主機中,此狀態資料取自GetPersistentState管理器,並且對於同一世界/設定檔的腳本/聊天/巨集是通用的,且不屬於一個腳本。另一個進程或明顯獨立的InjectionRuntimeState具有不同的狀態。載入/清除設定檔可以取代它;已儲存的serial仍然會根據載入的世界進行檢查。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
指令是獨立的陳述式。前面的訊息表示呼叫開始,並非伺服器已完成動作的確認。
UO.Print("Calling UO.UnsetReceivingContainer");
UO.UnsetReceivingContainer();參數與執行流程:
- 清除保存的接收容器。
UO.UnsetReceivingContainer();參數與執行流程:
- UnsetReceivingContainer 賦值ReceivingContainer=0。隨後的 Grab 使用了一個沒有明確用途的背包。物品不會轉移。
return RunScenario();
object? RunScenario()
{
UO.SetReceivingContainer("backpack");
UO.UnsetReceivingContainer();
return null;
}參數與執行流程:
- 僅修改或顯示指定的本機資料。該命令沒有伺服器確認。
return new ScriptScenario(UO, WaitAsync, Args, Cancellation, Checkpoint).RunScenario();
class ScriptScenario
{
private readonly global::ClassicUO.CSharp.CSharpGameApi UO;
private readonly Func<int, Task> WaitAsync;
private readonly string[] Args;
private readonly CancellationToken Cancellation;
private readonly Action Checkpoint;
public ScriptScenario(global::ClassicUO.CSharp.CSharpGameApi api, Func<int, Task> wait, string[] args, CancellationToken cancellation, Action checkpoint)
{
UO = api;
WaitAsync = wait;
Args = args;
Cancellation = cancellation;
Checkpoint = checkpoint;
}
public object? RunScenario()
{
UO.UnsetReceivingContainer();
UO.Print(UO.Backpack());
return null;
}
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: void / Unit.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.UnsetReceivingContainer. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.UnsetReceivingContainer:bridge.UnsetReceivingContainer().
內部實作程式碼,不能作為獨立腳本執行。
public void UnsetReceivingContainer() => bridge.UnsetReceivingContainer();