-
Notifications
You must be signed in to change notification settings - Fork 13
_Selector API
To Insert/Remove Selectors to/from a Progression/Feat, you have two options: The Config Method or directly calling the API
{
"FileVersion": 1,
"Progressions": [
{
"UUID": "class-progression-uuid - use this or UUIDs, but not both",
"UUIDs": ["first-class-progression-uuid", "second-class-progression-uuid"],
"Selectors": [
{
"modGuid": "UUID of Required Mod (Optional)",
"Action": "Insert",
"Function": "SelectSpells, AddSpells, SelectSkills, SelectAbilities, SelectAbilityBonus, SelectEquipment, SelectSkillsExpertise, SelectPassives, ReplacePassives",
"Params": {
"Guid": "uuid of list",
"Amount": "amount to be selectable",
// (See API section for other parameters)
}
}
]
}
]
}
{
"FileVersion": 1,
"Progressions": [
{
"UUID": "class-progression-uuid - use this or UUIDs, but not both",
"UUIDs": ["first-class-progression-uuid", "second-class-progression-uuid"],
"Selectors": [
{
"modGuid": "UUID of Required Mod (Optional)",
"Action": "Remove",
"Function": "SelectSpells, AddSpells, SelectSkills, SelectAbilities, SelectAbilityBonus, SelectEquipment, SelectSkillsExpertise, SelectPassives, ReplacePassives",
"UUID": "uuid of list referenced in selectors first parameter",
}
]
}
]
}
The Compatibility Framework contains an API Endpoint to insert Selectors, allowing further compatibility among mods that deal with Feats and Progressions.
Api.RemoveSelectors
local payload = {
TargetUUID = "feat or progression UUID",
FileType = "Either Feat or Progression",
Function = "Type of Selector",
ListUUID = "List UUID referenced in selector's first parameter"
}
Api.InsertSelectors
This will require a specific object, which will contain information on your Mod's UUID, the Target Progression's UUID, The type of Function you want to use, whether you want to Overwrite the existing selector (not currently functional), and the Parameters needed for your Selector.
This is a template for what the object can contain (it will not contain every value present):
SelectorTemplate = {
modGuid = "", -- UUID of provider mod
Target = "", -- UUID of Feat/progression
FileType = "", -- Either "Feat" or "Progression", defaulting to "Progression"
Function = "", -- SelectSpells, AddSpells, SelectSkills, SelectAbilities, SelectAbilityBonus, SelectEquipment, SelectSkillsExpertise, SelectPassives"
Params = {
Guid = "", -- Used in All
Amount = "", -- Used in All but AddSpells (?)
Arg3 = "", -- Used in SelectSpells and AddSpells for amount Prepared/Swappable
Arg4 = "", -- Used in SelectSkillsExpertise, but not actually used anywhere, likely SelectorId
SelectorId = "BardCantrip", -- Reference to entry in Defaultvalues to populate default selections
CastingAbility = "", -- Used in Select Spells, AddSpells
ActionResource = "", -- UUID representation, used in Select Spells, AddSpells
PrepareType = "AlwaysPrepared", -- Used in SelectSpells, AddSpells. Values: Default, AlwaysPrepared
CooldownType = "UntilRest", -- Used in SelectSpells, AddSpells. Values: Default, UntilRest
BonusType = "AbilityBonus", -- Used in SelectAbilityBonus
LimitToProficiency = "false" -- Used in SelectSkillsExpertise to limit options to those you're proficient in. Optional, defaults to `true`.
Amounts = {
2, 1 -- Used in SelectAbilityBonus, maps to the amounts you get to add to each option
}
}
}
To use this, you would do the following:
if Ext.Mod.IsModLoaded("67fbbd53-7c7d-4cfa-9409-6d737b4d92a9") then
local selectors = {
{
modGuid = "meta.lsx UUID value",
Target = "UUID OF FEAT/PROGRESSION",
FileType = "Feat or Progression",
FileType = "Progression",
Params = {
UUID = "Equipment Set UUID",
Amount = "Number of selections available from set",
SelectorId = "SelectorId Value from your DefaultValues/Equipment.lsx"
}
},
}
local function OnStatsLoaded()
Mods.SubclassCompatibilityFramework.Api.InsertSelectors(selectors)
end
Ext.Events.StatsLoaded:Subscribe(OnStatsLoaded)
end
This example is for SelectEquipment
. Just replace the selector with your own based on the below example objects.
Here's a breakdown of what it's doing:
- Checks if CF is loaded, and if so, defines Selectors object.
- Creates a function
OnSessionLoaded()
, which calls the CF'sInsertSelector()
API Endpoint and passes through the Selectors object. - Calls
OnSessionLoaded()
once a game has begun.
There are a few different types of selectors. These sample objects will help you build out your Selector.
To insert SelectSpells(), you would create this object:
Selectors = {
DescriptiveSelectorName = {
modGuid = "UUID OF YOUR MOD",
Target = "UUID OF FEAT/PROGRESSION",
FileType = "Feat or Progression",
Function = "SelectSpells",
Params = {
Guid = "SpellList Entry UUID",
Amount = "Number of selections available, defaults to 1",
SwapAmount = "Number of spells that can be swapped, defaults to 0",
SelectorId = "(Optional), SelectorId value of `DefaultValue/Spells.lsx`",
CastingAbility = "(Optional), Name of Attribute you'll use to cast with",
ActionResource = "(Optional), UUID of Action Resource you'll use to cast the spells",
PrepareType = "(Optional), AlwaysPrepared or Default (defaults to Default)",
CooldownType = "(Optional), UntilRest or Default (defaults to Default)"
}
}
}
To insert AddSpells(), you would create this object:
Selectors = {
DescriptiveSelectorName = {
modGuid = "UUID OF YOUR MOD",
Target = "UUID OF FEAT/PROGRESSION",
FileType = "Feat or Progression",
Function = "AddSpells",
Params = {
Guid = "SpellList Entry UUID",
SelectorId = "(Optional), SelectorId value of `DefaultValue/Spells.lsx`",
CastingAbility = "(Optional), Name of Attribute you'll use to cast with",
ActionResource = "(Optional), UUID of Action Resource you'll use to cast the spells",
PrepareType = "(Optional), AlwaysPrepared or Default (defaults to Default)",
CooldownType = "(Optional), UntilRest or Default (defaults to Default)"
}
}
}
To insert SelectPassives() or SelectEquipment(), you would create this object:
Selectors = {
DescriptiveSelectorName = {
modGuid = "UUID OF YOUR MOD",
Target = "UUID OF FEAT/PROGRESSION",
FileType = "Feat or Progression",
Function = "SelectPassives or SelectEquipment",
Params = {
Guid = "PassiveList/EquipmentList Entry UUID",
Amount = "Number of selections available",
SelectorId = "(Optional), SelectorId value of DefaultValue/Equipment.lsx or DefaultValue/Passives.lsx"
}
}
}
To insert SelectAbilityBonus(), you would create this object:
Selectors = {
DescriptiveSelectorName = {
modGuid = "UUID OF YOUR MOD",
Target = "UUID OF FEAT/PROGRESSION",
FileType = "Feat or Progression",
Function = "SelectAbilityBonus",
Params = {
Guid = "AbilityList Entry UUID",
Amount = "Number of selections available, defaults to 0",
BonusType= "AbilityBonus",
Amounts= {
"Number of first selection, defaults to 2", "Number of second selection, defaults to 1", ...
}
}
}
}
To insert SelectSkills(), you would create this object:
Selectors = {
DescriptiveSelectorName = {
modGuid = "UUID OF YOUR MOD",
Target = "UUID OF FEAT/PROGRESSION",
FileType = "Feat or Progression",
Function = "SelectSkills",
Params = {
Guid = "SkillList Entry UUID",
Amount = "Number of selections available, default to 0",
SelectorId= "(Optional) SelectorId value of DefaultValue/Skills.lsx",
}
}
}
To insert SelectSkillsExpertise(), you would create this object:
Selectors = {
DescriptiveSelectorName = {
modGuid = "UUID OF YOUR MOD",
Target = "UUID OF FEAT/PROGRESSION",
FileType = "Feat or Progression",
Function = "SelectSkillsExpertise",
Params = {
Guid = "SkillList Entry UUID",
Amount = "Number of selections available, default to 0",
LimitToProficiency = "(Optional) Defaults to true. Limits selectable options to those you have proficiency in.",
SelectorId = "(Optional) SelectorId value of DefaultValue/Skills.lsx"
}
}
}