ZH TW API UO Info - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
UO.Info
C# 簽章
string UO.Info();
string UO.Info(object? serial);
string UO.Info(object? type, object? x = null, object? y = null);
string UO.Info(object? type, object? x, object? y, object? z);
行為與結果
呼叫來源決定顯示方式:遊戲圖形聊天指令會開啟含欄位、數值、Ctrl+C 與捲動的表格。一般 C# 腳本只取得報告字串,不開視窗或目標游標,即使遊戲視窗已開啟亦然。僅能讀取用戶端已知資料。
圖形聊天中的無參數 Info 和 InfoTile 會要求選取目標。腳本中的 Info() 讀取最後物件目標或玩家;InfoTile() 讀取玩家腳下的地形。serial、type 和座標可指定物件或地塊。InfoTile(x,y,map) 的第三個參數是地圖編號。
參數
serial— 物件序號或已儲存的別名。type— 物品圖形 ID;-1 表示指定位置的任何類型。x— 世界 X 座標。y— 世界 Y 座標。z— Z 高度;簡短形式使用 0。
UO.Info(type: 0x0EED) 讀取最近的已載入同類型物件,不會開啟目標游標。容器內物品以最上層擁有者的位置計算距離;距離相同時依 serial 決定。此命令不會載入用戶端未知的伺服器物件。UO.Info(serial) 仍代表序號,而非 type。指定座標時必須同時提供 x 和 y;僅提供一個座標會傳回錯誤說明,不會開啟目標游標。聊天形式 #info type 0x0EED 使用相同的最近物件搜尋。
聊天指令
#info
#UO.Info id 0x40001234
#info type 0x0EED
#info xy 1450 1690
#info type 0x0EED xy 1450 1690 0
完整 C# 範例
每個程式碼區塊都是完整的獨立 .csx。請替換範例 serial、type 與座標;參數順序及 C# 具名參數依照簽章。
1
string report = UO.Info(0x40001234);
UO.Print(report);
2
string InspectSelf() => UO.Info("self");
UO.Print(InspectSelf());
3
foreach (int serial in new[] { 0x40001234, 0x40005678 })
{
string report = UO.Info(serial);
UO.Print(report);
}
4
new CommandSample().Execute(UO);
sealed class CommandSample
{
public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
{
string report = api.Info(0x40001234);
api.Print(report);
}
}
內部呼叫
CSharpGameApi.Info
-> CSharpScriptGlobals
-> InjectionScript.Runtime.InjectionApiUO.Info
ClassicUOInjectionApiBridge -> YokoInfoReport -> YokoInfoGump
ushort goldType = 0x0EED;
string report = UO.Info(type: goldType);
UO.Print(report);
int playerX = UO.GetX();
int playerY = UO.GetY();
int playerZ = UO.GetZ();
string report = UO.Info(type: 0x0EED, x: playerX, y: playerY, z: playerZ);
UO.Print(report);