Repository navigation
ZH TW API UO ShardPath
Codex edited this page Nov 6, 2026
·
3 revisions
Українська · Русский · English · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어
家 · C# · IDE · UO API · A–Z · 範例 · Languages
dynamic UO.ShardPath();讀取目前設定檔的路徑。
沒有參數。
string — 橋接欄位的文字。 CurrentProfilePath;如果沒有可用數據,則可能會出現空字串。這不是連接符號,也不是數字ID。
- ExecuteClientApiCompatibility 返回網橋。 CurrentProfilePath 不更改設定檔或伺服器選擇。
- 讀取目前本地狀態。沒有軟體包、目標或自動更新;個別讀取可能會看到不同的狀態。
每個範例都可以儲存為單獨的檔案.csx並在IDE中運行。 UO物件和等待函數提供當前遊戲會話的主機。將演示 serial 名稱、座標和地址替換為您自己的。
將這段程式碼存為獨立的 .csx 檔案執行。參數直接出現在呼叫中;請將範例名稱、serial 和網址替換成自己的值。
將一次呼叫的結果輸出到日誌。數值不會轉換成 bool;若結果是陣列,則顯示元素數量。
object? result = UO.ShardPath();
UO.Print(result is Array values ? "Count: " + values.Length : Convert.ToString(result));參數與執行流程:
- 讀取目前設定檔的路徑。
var value = UO.ShardPath();
UO.Print(value);參數與執行流程:
- ExecuteClientApiCompatibility 返回網橋。 CurrentProfilePath 不更改設定檔或伺服器選擇。
return RunScenario();
object? RunScenario()
{
var value = UO.ShardPath();
if (Truth(Len(value) > 0))
{
UO.TextPrint(value);
}
return null;
}
int Len(object? value) => Convert.ToString(value)?.Length ?? 0;
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.ShardPath();
UO.Wait(500);
var after = UO.ShardPath();
UO.Print(before == after);
return null;
}
}C# 區分大小寫。請使用正確的 UO 名稱。數值旗標應與 0 比較;只有回傳型別為 bool 時才使用 bool。
參數: 沒有參數。
結果: dynamic / Any.
呼叫時:
-
InjectionScript.Runtime.InjectionApiUO.ExecuteClientApiCompatibility. -
ClassicUO.Game.Managers.ClassicUOInjectionApiBridge.CurrentProfilePath:bridge.CurrentProfilePath.
內部實作程式碼,不能作為獨立腳本執行。
case "shardpath":
case "clientprofilepath": return new InjectionValue(bridge.CurrentProfilePath);ClassicUO — Bad Newbie & C# Scripts IDE