ReflectionPlugin
Provides reflection helpers to operate using types without needing to reference their assemblies at runtime.
About this mod Author’s original text
Reflection Plugin
This unofficial TaleSpire dependency plugin which allows plugins to access types, methods, fields, properties and events
using reflection. This allows plugins to access BR libraries without needing to add the BR assembly as a reference which
makes the plugin more resilient if BR changes the namespace or location of the type.
This is a succesor to the short lived GenClassPlugin. It uses Reflection styles operations but provides helpers functions
for easily getting references to types, methods, field, properties and events.
Install
Use R2ModMan or similar installer to install this asset pack.
Generally this plugin will be added automatically as a dependency of another plugin that uses it.
Usage
Type(string typeName, string has = null, string hasType = null, int resultIndex = 0)
Creates a System.Type based on the string typeName. If the "has" array is provided the type must have properties or fields
that match the names provide in the array. If the "hasType" array is provided, the type must have properties of the type
specified (using string names). Lastly if the match returns multiple results, the resultIndex can be used to chose which
Type to actually use.
If a type will be used frequently, defining a variable to hold it will be more efficient since the code will not have to
try to find the corresponding type each time.
For example:
System.Type _LocalClient = Type("_LocalClient");
object cid = Reflection.Property(_LocalClient, "SelectedCreatureId").GetValue(null);
ClosedType(string typeBase, string typeClosed, string has = null, string hasType = null, int resultIndex = 0)
Same as the Type method above but allows creation of Type that close other types (e.g. types in the format A).
For example:
System.Type _SimpleSingletonBehaviourControllerManager = Reflection.ClosedType("SimpleSingletonBehaviour", "ControllerManager");
New(Type type, object constructorParamaters)
Creates a new instance of the given type using the constructor parameters provided. Usually chained with Type (see above).
For example: `
object counter = Reflection.New(Type("CreatureGuid"), new object { cid.ToString() });
HasMethod(Type type, string methodName, string parameterTypes = null)
Check if the given type has the specified method. If the parameterTypes array is provided, the method must match the
parameter types specified (using string names). A null parameter in the parameterTypes array means any type.
Usually chained with Type (see above). For example: `HasMethod(Type("Counter"),"Increment", new string { "System.Single" });`
Method(Type type, string methodName, string parameterTypes = null)
Returns the specified method on the specified type. If the parameterTypes array is provided, the method must match the
parameter types specified (using string names). A null parameter in the parameterTypes array means any type.
Used first method found if search results in multiple matching methods.
Usually chained with Type (see above). For example: `Method(Type("Counter"),"Increment", new string { "System.Single" });`
Methods(Type type, string methodName, string parameterTypes = null)
Returns the specified methods on the specified type. If the parameterTypes array is provided, the method must match the
parameter types specified (using string names). A null parameter in the parameterTypes array means any type.
Returns all methods matching the search parameters.
Usually chained with Type (see above). For example: `Methods(Type("Counter"),"Increment");`
Execute(MethodInfo method, object instance, object parameters, int resultIndex = 0)
Invokes the specified method using the specified instance and the specified parameters. Normally the method returns the
return value of the invoked method. Any out parameters are updated in the array of input parameters. However, to make it
easier to access a single out parameter directly, the resultIndex can be used to indicated the result to be returned.
If the invoked me
Install & use Install: follow the bundled instructions
- Unzip the archive from playbuff and read the bundled readme / instructions first.
- Most mods rely on the game's mod loader — the usual route is a community mod manager (such as r2modman): pick this game, install, and it handles the loader and dependencies.
- For a manual install, put the mod files into the matching Mod / plugins folder inside the game directory.
- Launch the game to confirm it loaded; mods with listed dependencies need those installed as well.
Install locations vary a lot between mods — the bundled readme is the most reliable guide.
Install these first, or the mod will not work: