Table of Contents

Class MtObject

Namespace
SharpPluginLoader.Core
Assembly
SharpPluginLoader.Core.dll

This class represents the base of most game objects, and serves as a wrapper around the native object.

public class MtObject : NativeWrapper
Inheritance
MtObject
Derived
Inherited Members

Constructors

MtObject()

public MtObject()

MtObject(nint)

public MtObject(nint instance)

Parameters

instance nint

Methods

As<T>()

Casts this object to the specified MtObject subclass.

public T As<T>() where T : MtObject, new()

Returns

T

The casted object

Type Parameters

T

The type to cast to

Remarks

This method isn't actually a cast, but rather a construction of a new object of the specified type. This is because the actual type of the object is unknown at runtime. That means that the new object will have the same instance as this object.

It is also important to note that this method does not perform any type checking. It is recommended to first check the type of the object using the Is(string) method before casting, unless you are certain that the object is of the correct type.

Destroy(bool)

Calls the destructor of this object.

public void Destroy(bool free)

Parameters

free bool

Whether the destructor should deallocate the object or not

GetDti()

Gets the DTI of this object.

public MtDti? GetDti()

Returns

MtDti

The DTI, or null if there is no DTI

GetProperties()

Gets the properties of this object.

public MtPropertyList GetProperties()

Returns

MtPropertyList

The property list containing all properties

GetVirtualFunction(int)

Gets a virtual function from the vtable of this object.

public nint GetVirtualFunction(int index)

Parameters

index int

The index of the virtual function in the vtable

Returns

nint

The requested virtual function

Is(string)

Checks if this object is of the specified type.

public bool Is(string typeName)

Parameters

typeName string

The name of the type to check for

Returns

bool

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.