ZH TW API UO Dismount - LIHACHTETAN/ClassicUO-Bad-Newbie-CSharp-Scripts-IDE GitHub Wiki

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

UO.Dismount

C# 簽章

int UO.Dismount();

行為與結果

Mount 與 Dismount 直接傳送使用物件請求,不需要手動雙擊,也不會套用戰鬥模式攻擊行為。int 是 Mount 層目前物品的 serial,並非成功旗標。伺服器回覆是非同步的:Mount 可能仍回傳 0,Dismount 可能回傳移除前的 serial。請在回覆後檢查 ObjAtLayer("Mount")。

參數

沒有參數。

每個程式碼區塊都是完整的獨立 .csx。請替換範例 serial、type 與座標;參數順序及 C# 具名參數依照簽章。

聊天指令

#dismount

完整 C# 範例

每個程式碼區塊都是完整的獨立 .csx。請替換範例 serial、type 與座標;參數順序及 C# 具名參數依照簽章。

1

int mountLayerSerial = UO.Dismount();
UO.Print(UO.Int2Hex(mountLayerSerial));

2

var before = UO.ObjAtLayer("Mount");
int currentSerial = UO.Dismount();
UO.Print($"{before} -> {UO.Int2Hex(currentSerial)}");

3

UO.Dismount();
await WaitAsync(250);
UO.Print(Convert.ToString(UO.ObjAtLayer("Mount")));

4

new CommandSample().Execute(UO);

sealed class CommandSample
{
    public void Execute(global::ClassicUO.CSharp.CSharpGameApi api)
    {
        int mountLayerSerial = api.Dismount();
        api.Print(api.Int2Hex(mountLayerSerial));
    }
}

內部呼叫

CSharpGameApi.Dismount
  -> CSharpScriptGlobals
  -> InjectionScript.Runtime.InjectionApiUO.Dismount
ClassicUOInjectionApiBridge -> NativeMountController.Request
  -> OutgoingPackets.Send_UseObjectRequest (0x06)
  -> MountedLayerSerialUnsafe -> Player.FindItemByLayer(Layer.Mount)

來源

ClassicUO · ServUO BaseMount

ClassicUO.Game.Managers.NativeMountController.Request