Class BlueprintTool
Tool for operations on blueprints.
Inheritance
Namespace: BlueprintCore.Utils
Assembly: BlueprintCore.dll
Syntax
public static class BlueprintTool
Methods
| Improve this Doc View SourceAddGuidsByName(Dictionary<String, String>)
Adds the provided mapping from Name (key) to Guid (value).
Declaration
public static void AddGuidsByName(Dictionary<string, string> guidsByName)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | guidsByName |
Remarks
After calling this function you can reference blueprints by Name in BlueprintCore APIs.
BlueprintTool.AddGuidsByName(
new Dictionary<string, string> { { "PowerAttackFeat", "9972f33f977fc724c838e59641b2fca5" } });
var conditionsChecker = ConditionsBuilder.New().CasterHasFact("PowerAttackFeat").Build();
AddGuidsByName((String name, String guid)[])
Adds the provided mapping from Name to Guid.
Declaration
public static void AddGuidsByName(params (string name, string guid)[] guidsByName)
Parameters
Type | Name | Description |
---|---|---|
System.ValueTuple<System.String, System.String>[] | guidsByName |
Remarks
After calling this function you can reference blueprints by Name in BlueprintCore APIs.
BlueprintTool.AddGuidsByName(("PowerAttackFeat", "9972f33f977fc724c838e59641b2fca5"));
var conditionsChecker = ConditionsBuilder.New().CasterHasFact("PowerAttackFeat").Build();
Create<T>(String)
Creates a new Blueprint of type T.
Declaration
public static T Create<T>(string name)
where T : SimpleBlueprint, new()
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Remarks
The Name must be registered using AddGuidsByName(Dictionary<String, String>) before calling this. If you prefer using guid references directly use Create<T>(String, String) instead.
Create<T>(String, String)
Creates a new Blueprint of type T with the given Name and Guid.
Declaration
public static T Create<T>(string name, string guid)
where T : SimpleBlueprint, new()
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
System.String | guid |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
Remarks
If you have already registered the Name and Guid using AddGuidsByName(Dictionary<String, String>) you can use Create<T>(String) instead. If you have not this will register the name and associate it with the Guid.
Get<T>(String)
Returns the blueprint with the specified Name or Guid.
Declaration
public static T Get<T>(string nameOrGuid)
where T : SimpleBlueprint
Parameters
Type | Name | Description |
---|---|---|
System.String | nameOrGuid | Use Name if you have registered it using AddGuidsByName(Dictionary<String, String>) or Guid otherwise. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
GetGuidsByName()
Returns the stored mapping of blueprint name to Guid.
Declaration
public static Dictionary<string, string> GetGuidsByName()
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
Remarks
Useful if you want to debug or use this for configuration settings. At a minimum this will contain all blueprints created by your mod, plus any existing blueprints you register a mapping for.
GetRef<TRef>(String)
Returns a blueprint reference for the specified Name or Guid
Declaration
public static TRef GetRef<TRef>(string nameOrGuid)
where TRef : BlueprintReferenceBase
Parameters
Type | Name | Description |
---|---|---|
System.String | nameOrGuid | Use Name if you have registered it using AddGuidsByName(Dictionary<String, String>) or Guid otherwise. |
Returns
Type | Description |
---|---|
TRef | A blueprint reference of type T. If nameOrGuid it returns a non-null, empty reference. |
Type Parameters
Name | Description |
---|---|
TRef |
Remarks
This is based on Kingmaker.Blueprints.BlueprintReferenceBase.CreateTyped``1(Kingmaker.Blueprints.SimpleBlueprint) but does not require fetching the blueprint. This allows referencing a blueprint that has not been created yet. However, if that blueprint is not created before the reference is used it may fail in unpredictable ways.
TryGet<T>(String, out T)
Declaration
public static bool TryGet<T>(string nameOrGuid, out T blueprint)
where T : SimpleBlueprint
Parameters
Type | Name | Description |
---|---|---|
System.String | nameOrGuid | |
T | blueprint | Populated with the blueprint if it exists, null otherwise. |
Returns
Type | Description |
---|---|
System.Boolean | True if the blueprint exists with the specified type, false otherwise |
Type Parameters
Name | Description |
---|---|
T |