Add the Aspect sheet and update some translation keys for the actor sheet
This commit is contained in:
parent
c0d677cd77
commit
763a0982d5
22 changed files with 1277 additions and 84 deletions
829
references/dnd5e-templates.json
Normal file
829
references/dnd5e-templates.json
Normal file
|
|
@ -0,0 +1,829 @@
|
|||
{
|
||||
"Actor": {
|
||||
"types": [
|
||||
"character",
|
||||
"npc",
|
||||
"vehicle",
|
||||
"group"
|
||||
],
|
||||
"templates": {
|
||||
"common": {
|
||||
"abilities": {
|
||||
"str": {
|
||||
"value": 10,
|
||||
"proficient": 0,
|
||||
"max": null,
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"save": ""
|
||||
}
|
||||
},
|
||||
"dex": {
|
||||
"value": 10,
|
||||
"proficient": 0,
|
||||
"max": null,
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"save": ""
|
||||
}
|
||||
},
|
||||
"con": {
|
||||
"value": 10,
|
||||
"proficient": 0,
|
||||
"max": null,
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"save": ""
|
||||
}
|
||||
},
|
||||
"int": {
|
||||
"value": 10,
|
||||
"proficient": 0,
|
||||
"max": null,
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"save": ""
|
||||
}
|
||||
},
|
||||
"wis": {
|
||||
"value": 10,
|
||||
"proficient": 0,
|
||||
"max": null,
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"save": ""
|
||||
}
|
||||
},
|
||||
"cha": {
|
||||
"value": 10,
|
||||
"proficient": 0,
|
||||
"max": null,
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"save": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"ac": {
|
||||
"flat": null,
|
||||
"calc": "default",
|
||||
"formula": ""
|
||||
},
|
||||
"hp": {
|
||||
"value": 10,
|
||||
"max": null,
|
||||
"temp": 0,
|
||||
"tempmax": 0
|
||||
},
|
||||
"init": {
|
||||
"ability": "",
|
||||
"bonus": ""
|
||||
},
|
||||
"movement": {
|
||||
"burrow": null,
|
||||
"climb": null,
|
||||
"fly": null,
|
||||
"swim": null,
|
||||
"walk": null,
|
||||
"units": null,
|
||||
"hover": false
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"biography": {
|
||||
"value": "",
|
||||
"public": ""
|
||||
}
|
||||
},
|
||||
"traits": {
|
||||
"size": "med",
|
||||
"di": {
|
||||
"value": [],
|
||||
"bypasses": [],
|
||||
"custom": ""
|
||||
},
|
||||
"dr": {
|
||||
"value": [],
|
||||
"bypasses": [],
|
||||
"custom": ""
|
||||
},
|
||||
"dv": {
|
||||
"value": [],
|
||||
"bypasses": [],
|
||||
"custom": ""
|
||||
},
|
||||
"ci": {
|
||||
"value": [],
|
||||
"custom": ""
|
||||
}
|
||||
},
|
||||
"currency": {
|
||||
"pp": 0,
|
||||
"gp": 0,
|
||||
"ep": 0,
|
||||
"sp": 0,
|
||||
"cp": 0
|
||||
}
|
||||
},
|
||||
"creature": {
|
||||
"attributes": {
|
||||
"attunement": {
|
||||
"max": 3
|
||||
},
|
||||
"senses": {
|
||||
"darkvision": null,
|
||||
"blindsight": null,
|
||||
"tremorsense": null,
|
||||
"truesight": null,
|
||||
"units": null,
|
||||
"special": ""
|
||||
},
|
||||
"spellcasting": "int"
|
||||
},
|
||||
"details": {
|
||||
"alignment": "",
|
||||
"race": ""
|
||||
},
|
||||
"skills": {
|
||||
"acr": {
|
||||
"value": 0,
|
||||
"ability": "dex",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"ani": {
|
||||
"value": 0,
|
||||
"ability": "wis",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"arc": {
|
||||
"value": 0,
|
||||
"ability": "int",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"ath": {
|
||||
"value": 0,
|
||||
"ability": "str",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"dec": {
|
||||
"value": 0,
|
||||
"ability": "cha",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"his": {
|
||||
"value": 0,
|
||||
"ability": "int",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"ins": {
|
||||
"value": 0,
|
||||
"ability": "wis",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"itm": {
|
||||
"value": 0,
|
||||
"ability": "cha",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"inv": {
|
||||
"value": 0,
|
||||
"ability": "int",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"med": {
|
||||
"value": 0,
|
||||
"ability": "wis",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"nat": {
|
||||
"value": 0,
|
||||
"ability": "int",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"prc": {
|
||||
"value": 0,
|
||||
"ability": "wis",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"prf": {
|
||||
"value": 0,
|
||||
"ability": "cha",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"per": {
|
||||
"value": 0,
|
||||
"ability": "cha",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"rel": {
|
||||
"value": 0,
|
||||
"ability": "int",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"slt": {
|
||||
"value": 0,
|
||||
"ability": "dex",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"ste": {
|
||||
"value": 0,
|
||||
"ability": "dex",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
},
|
||||
"sur": {
|
||||
"value": 0,
|
||||
"ability": "wis",
|
||||
"bonuses": {
|
||||
"check": "",
|
||||
"passive": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"tools": {},
|
||||
"traits": {
|
||||
"languages": {
|
||||
"value": [],
|
||||
"custom": ""
|
||||
}
|
||||
},
|
||||
"spells": {},
|
||||
"bonuses": {
|
||||
"mwak": {
|
||||
"attack": "",
|
||||
"damage": ""
|
||||
},
|
||||
"rwak": {
|
||||
"attack": "",
|
||||
"damage": ""
|
||||
},
|
||||
"msak": {
|
||||
"attack": "",
|
||||
"damage": ""
|
||||
},
|
||||
"rsak": {
|
||||
"attack": "",
|
||||
"damage": ""
|
||||
},
|
||||
"abilities": {
|
||||
"check": "",
|
||||
"save": "",
|
||||
"skill": ""
|
||||
},
|
||||
"spell": {
|
||||
"dc": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"htmlFields": [
|
||||
"details.biography.value",
|
||||
"details.biography.public",
|
||||
"description.full",
|
||||
"description.summary"
|
||||
],
|
||||
"character": {
|
||||
"templates": [
|
||||
"common",
|
||||
"creature"
|
||||
],
|
||||
"attributes": {
|
||||
"hp": {
|
||||
"value": 0,
|
||||
"bonuses": {
|
||||
"level": "",
|
||||
"overall": ""
|
||||
}
|
||||
},
|
||||
"death": {
|
||||
"success": 0,
|
||||
"failure": 0
|
||||
},
|
||||
"exhaustion": 0,
|
||||
"inspiration": false
|
||||
},
|
||||
"details": {
|
||||
"background": "",
|
||||
"originalClass": "",
|
||||
"xp": {
|
||||
"value": 0
|
||||
},
|
||||
"appearance": "",
|
||||
"trait": "",
|
||||
"ideal": "",
|
||||
"bond": "",
|
||||
"flaw": ""
|
||||
},
|
||||
"resources": {
|
||||
"primary": {
|
||||
"value": 0,
|
||||
"max": 0,
|
||||
"sr": false,
|
||||
"lr": false,
|
||||
"label": ""
|
||||
},
|
||||
"secondary": {
|
||||
"value": 0,
|
||||
"max": 0,
|
||||
"sr": false,
|
||||
"lr": false,
|
||||
"label": ""
|
||||
},
|
||||
"tertiary": {
|
||||
"value": 0,
|
||||
"max": 0,
|
||||
"sr": false,
|
||||
"lr": false,
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"traits": {
|
||||
"weaponProf": {
|
||||
"value": [],
|
||||
"custom": ""
|
||||
},
|
||||
"armorProf": {
|
||||
"value": [],
|
||||
"custom": ""
|
||||
},
|
||||
"toolProf": {
|
||||
"value": [],
|
||||
"custom": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"npc": {
|
||||
"templates": [
|
||||
"common",
|
||||
"creature"
|
||||
],
|
||||
"attributes": {
|
||||
"hp": {
|
||||
"max": 10,
|
||||
"formula": ""
|
||||
}
|
||||
},
|
||||
"details": {
|
||||
"type": {
|
||||
"value": "",
|
||||
"subtype": "",
|
||||
"swarm": "",
|
||||
"custom": ""
|
||||
},
|
||||
"environment": "",
|
||||
"cr": 1,
|
||||
"spellLevel": 0,
|
||||
"source": ""
|
||||
},
|
||||
"resources": {
|
||||
"legact": {
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"legres": {
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"lair": {
|
||||
"value": false,
|
||||
"initiative": null
|
||||
}
|
||||
}
|
||||
},
|
||||
"vehicle": {
|
||||
"templates": [
|
||||
"common"
|
||||
],
|
||||
"vehicleType": "water",
|
||||
"abilities": {
|
||||
"int": {
|
||||
"value": 0
|
||||
},
|
||||
"wis": {
|
||||
"value": 0
|
||||
},
|
||||
"cha": {
|
||||
"value": 0
|
||||
}
|
||||
},
|
||||
"attributes": {
|
||||
"ac": {
|
||||
"calc": "flat",
|
||||
"motionless": ""
|
||||
},
|
||||
"actions": {
|
||||
"stations": false,
|
||||
"value": 0,
|
||||
"thresholds": {
|
||||
"2": null,
|
||||
"1": null,
|
||||
"0": null
|
||||
}
|
||||
},
|
||||
"hp": {
|
||||
"value": null,
|
||||
"dt": null,
|
||||
"mt": null
|
||||
},
|
||||
"capacity": {
|
||||
"creature": "",
|
||||
"cargo": 0
|
||||
}
|
||||
},
|
||||
"traits": {
|
||||
"size": "lg",
|
||||
"dimensions": "",
|
||||
"di": {
|
||||
"value": [
|
||||
"poison",
|
||||
"psychic"
|
||||
]
|
||||
},
|
||||
"ci": {
|
||||
"value": [
|
||||
"blinded",
|
||||
"charmed",
|
||||
"deafened",
|
||||
"frightened",
|
||||
"paralyzed",
|
||||
"petrified",
|
||||
"poisoned",
|
||||
"stunned",
|
||||
"unconscious"
|
||||
]
|
||||
}
|
||||
},
|
||||
"cargo": {
|
||||
"crew": [],
|
||||
"passengers": []
|
||||
}
|
||||
},
|
||||
"group": {
|
||||
"description": {
|
||||
"full": "",
|
||||
"summary": ""
|
||||
},
|
||||
"members": [],
|
||||
"attributes": {
|
||||
"movement": {
|
||||
"land": 0,
|
||||
"water": 0,
|
||||
"air": 0
|
||||
}
|
||||
},
|
||||
"currency": {
|
||||
"pp": 0,
|
||||
"gp": 0,
|
||||
"ep": 0,
|
||||
"sp": 0,
|
||||
"cp": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"Item": {
|
||||
"types": [
|
||||
"weapon",
|
||||
"equipment",
|
||||
"consumable",
|
||||
"tool",
|
||||
"loot",
|
||||
"race",
|
||||
"background",
|
||||
"class",
|
||||
"subclass",
|
||||
"spell",
|
||||
"feat",
|
||||
"backpack"
|
||||
],
|
||||
"templates": {
|
||||
"itemDescription": {
|
||||
"description": {
|
||||
"value": "",
|
||||
"chat": "",
|
||||
"unidentified": ""
|
||||
},
|
||||
"source": {}
|
||||
},
|
||||
"physicalItem": {
|
||||
"quantity": 1,
|
||||
"weight": 0,
|
||||
"price": {
|
||||
"value": 0,
|
||||
"denomination": "gp"
|
||||
},
|
||||
"attunement": 0,
|
||||
"equipped": false,
|
||||
"rarity": "",
|
||||
"identified": true
|
||||
},
|
||||
"activatedEffect": {
|
||||
"activation": {
|
||||
"type": "",
|
||||
"cost": null,
|
||||
"condition": ""
|
||||
},
|
||||
"duration": {
|
||||
"value": "",
|
||||
"units": ""
|
||||
},
|
||||
"cover": null,
|
||||
"crewed": false,
|
||||
"target": {
|
||||
"value": null,
|
||||
"width": null,
|
||||
"units": "",
|
||||
"type": ""
|
||||
},
|
||||
"range": {
|
||||
"value": null,
|
||||
"long": null,
|
||||
"units": ""
|
||||
},
|
||||
"uses": {
|
||||
"value": null,
|
||||
"max": "",
|
||||
"per": null,
|
||||
"recovery": ""
|
||||
},
|
||||
"consume": {
|
||||
"type": "",
|
||||
"target": null,
|
||||
"amount": null
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
"ability": null,
|
||||
"actionType": null,
|
||||
"attackBonus": "",
|
||||
"chatFlavor": "",
|
||||
"critical": {
|
||||
"threshold": null,
|
||||
"damage": ""
|
||||
},
|
||||
"damage": {
|
||||
"parts": [],
|
||||
"versatile": ""
|
||||
},
|
||||
"formula": "",
|
||||
"save": {
|
||||
"ability": "",
|
||||
"dc": null,
|
||||
"scaling": "spell"
|
||||
}
|
||||
},
|
||||
"mountable": {
|
||||
"armor": {
|
||||
"value": null
|
||||
},
|
||||
"hp": {
|
||||
"value": null,
|
||||
"max": null,
|
||||
"dt": null,
|
||||
"conditions": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"htmlFields": [
|
||||
"description.value",
|
||||
"description.chat",
|
||||
"description.unidentified"
|
||||
],
|
||||
"background": {
|
||||
"templates": [
|
||||
"itemDescription"
|
||||
],
|
||||
"advancement": []
|
||||
},
|
||||
"backpack": {
|
||||
"templates": [
|
||||
"itemDescription",
|
||||
"physicalItem"
|
||||
],
|
||||
"capacity": {
|
||||
"type": "weight",
|
||||
"value": null,
|
||||
"weightless": false
|
||||
},
|
||||
"currency": {
|
||||
"cp": 0,
|
||||
"sp": 0,
|
||||
"ep": 0,
|
||||
"gp": 0,
|
||||
"pp": 0
|
||||
}
|
||||
},
|
||||
"class": {
|
||||
"templates": [
|
||||
"itemDescription"
|
||||
],
|
||||
"identifier": "",
|
||||
"levels": 1,
|
||||
"hitDice": "d6",
|
||||
"hitDiceUsed": 0,
|
||||
"advancement": [],
|
||||
"spellcasting": {
|
||||
"progression": "none",
|
||||
"ability": ""
|
||||
}
|
||||
},
|
||||
"consumable": {
|
||||
"templates": [
|
||||
"itemDescription",
|
||||
"physicalItem",
|
||||
"activatedEffect",
|
||||
"action"
|
||||
],
|
||||
"consumableType": "potion",
|
||||
"uses": {
|
||||
"autoDestroy": false
|
||||
}
|
||||
},
|
||||
"equipment": {
|
||||
"templates": [
|
||||
"itemDescription",
|
||||
"physicalItem",
|
||||
"activatedEffect",
|
||||
"action",
|
||||
"mountable"
|
||||
],
|
||||
"armor": {
|
||||
"type": "light",
|
||||
"value": null,
|
||||
"dex": null
|
||||
},
|
||||
"baseItem": "",
|
||||
"speed": {
|
||||
"value": null,
|
||||
"conditions": ""
|
||||
},
|
||||
"strength": null,
|
||||
"stealth": false,
|
||||
"proficient": null
|
||||
},
|
||||
"feat": {
|
||||
"templates": [
|
||||
"itemDescription",
|
||||
"activatedEffect",
|
||||
"action"
|
||||
],
|
||||
"type": {
|
||||
"value": "",
|
||||
"subtype": ""
|
||||
},
|
||||
"requirements": "",
|
||||
"recharge": {
|
||||
"value": null,
|
||||
"charged": false
|
||||
}
|
||||
},
|
||||
"loot": {
|
||||
"templates": [
|
||||
"itemDescription",
|
||||
"physicalItem"
|
||||
]
|
||||
},
|
||||
"tool": {
|
||||
"templates": [
|
||||
"itemDescription",
|
||||
"physicalItem"
|
||||
],
|
||||
"toolType": "",
|
||||
"baseItem": "",
|
||||
"ability": "int",
|
||||
"chatFlavor": "",
|
||||
"proficient": null,
|
||||
"bonus": ""
|
||||
},
|
||||
"race": {},
|
||||
"spell": {
|
||||
"templates": [
|
||||
"itemDescription",
|
||||
"activatedEffect",
|
||||
"action"
|
||||
],
|
||||
"level": 1,
|
||||
"school": "",
|
||||
"components": {
|
||||
"vocal": false,
|
||||
"somatic": false,
|
||||
"material": false,
|
||||
"ritual": false,
|
||||
"concentration": false
|
||||
},
|
||||
"materials": {
|
||||
"value": "",
|
||||
"consumed": false,
|
||||
"cost": 0,
|
||||
"supply": 0
|
||||
},
|
||||
"preparation": {
|
||||
"mode": "prepared",
|
||||
"prepared": false
|
||||
},
|
||||
"scaling": {
|
||||
"mode": "none",
|
||||
"formula": null
|
||||
}
|
||||
},
|
||||
"subclass": {
|
||||
"templates": [
|
||||
"itemDescription"
|
||||
],
|
||||
"identifier": "",
|
||||
"classIdentifier": "",
|
||||
"advancement": [],
|
||||
"spellcasting": {
|
||||
"progression": "none",
|
||||
"ability": ""
|
||||
}
|
||||
},
|
||||
"weapon": {
|
||||
"templates": [
|
||||
"itemDescription",
|
||||
"physicalItem",
|
||||
"activatedEffect",
|
||||
"action",
|
||||
"mountable"
|
||||
],
|
||||
"weaponType": "simpleM",
|
||||
"baseItem": "",
|
||||
"properties": {},
|
||||
"proficient": null
|
||||
}
|
||||
},
|
||||
"JournalEntryPage": {
|
||||
"types": [
|
||||
"class"
|
||||
],
|
||||
"htmlFields": [
|
||||
"description.value",
|
||||
"description.additionalHitPoints",
|
||||
"description.additionalTraits",
|
||||
"description.additionalEquipment",
|
||||
"description.subclass"
|
||||
],
|
||||
"class": {
|
||||
"item": "",
|
||||
"description": {
|
||||
"value": "",
|
||||
"additionalHitPoints": "",
|
||||
"additionalTraits": "",
|
||||
"additionalEquipment": "",
|
||||
"subclass": ""
|
||||
},
|
||||
"subclassHeader": "",
|
||||
"subclassItems": []
|
||||
}
|
||||
}
|
||||
}
|
||||
172
references/simple.js
Normal file
172
references/simple.js
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/**
|
||||
* A simple and flexible system for world-building using an arbitrary collection of character and item attributes
|
||||
* Author: Atropos
|
||||
*/
|
||||
|
||||
// Import Modules
|
||||
import { SimpleActor } from "./actor.js";
|
||||
import { SimpleItem } from "./item.js";
|
||||
import { SimpleItemSheet } from "./item-sheet.js";
|
||||
import { SimpleActorSheet } from "./actor-sheet.js";
|
||||
import { preloadHandlebarsTemplates } from "./templates.js";
|
||||
import { createWorldbuildingMacro } from "./macro.js";
|
||||
import { SimpleToken, SimpleTokenDocument } from "./token.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Init hook.
|
||||
*/
|
||||
Hooks.once("init", async function() {
|
||||
console.log(`Initializing Simple Worldbuilding System`);
|
||||
|
||||
/**
|
||||
* Set an initiative formula for the system. This will be updated later.
|
||||
* @type {String}
|
||||
*/
|
||||
CONFIG.Combat.initiative = {
|
||||
formula: "1d20",
|
||||
decimals: 2
|
||||
};
|
||||
|
||||
game.worldbuilding = {
|
||||
SimpleActor,
|
||||
createWorldbuildingMacro
|
||||
};
|
||||
|
||||
// Define custom Document classes
|
||||
CONFIG.Actor.documentClass = SimpleActor;
|
||||
CONFIG.Item.documentClass = SimpleItem;
|
||||
CONFIG.Token.documentClass = SimpleTokenDocument;
|
||||
CONFIG.Token.objectClass = SimpleToken;
|
||||
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
Actors.registerSheet("worldbuilding", SimpleActorSheet, { makeDefault: true });
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
Items.registerSheet("worldbuilding", SimpleItemSheet, { makeDefault: true });
|
||||
|
||||
// Register system settings
|
||||
game.settings.register("worldbuilding", "macroShorthand", {
|
||||
name: "SETTINGS.SimpleMacroShorthandN",
|
||||
hint: "SETTINGS.SimpleMacroShorthandL",
|
||||
scope: "world",
|
||||
type: Boolean,
|
||||
default: true,
|
||||
config: true
|
||||
});
|
||||
|
||||
// Register initiative setting.
|
||||
game.settings.register("worldbuilding", "initFormula", {
|
||||
name: "SETTINGS.SimpleInitFormulaN",
|
||||
hint: "SETTINGS.SimpleInitFormulaL",
|
||||
scope: "world",
|
||||
type: String,
|
||||
default: "1d20",
|
||||
config: true,
|
||||
onChange: formula => _simpleUpdateInit(formula, true)
|
||||
});
|
||||
|
||||
// Retrieve and assign the initiative formula setting.
|
||||
const initFormula = game.settings.get("worldbuilding", "initFormula");
|
||||
_simpleUpdateInit(initFormula);
|
||||
|
||||
/**
|
||||
* Update the initiative formula.
|
||||
* @param {string} formula - Dice formula to evaluate.
|
||||
* @param {boolean} notify - Whether or not to post nofications.
|
||||
*/
|
||||
function _simpleUpdateInit(formula, notify = false) {
|
||||
const isValid = Roll.validate(formula);
|
||||
if ( !isValid ) {
|
||||
if ( notify ) ui.notifications.error(`${game.i18n.localize("SIMPLE.NotifyInitFormulaInvalid")}: ${formula}`);
|
||||
return;
|
||||
}
|
||||
CONFIG.Combat.initiative.formula = formula;
|
||||
}
|
||||
|
||||
/**
|
||||
* Slugify a string.
|
||||
*/
|
||||
Handlebars.registerHelper('slugify', function(value) {
|
||||
return value.slugify({strict: true});
|
||||
});
|
||||
|
||||
// Preload template partials
|
||||
await preloadHandlebarsTemplates();
|
||||
});
|
||||
|
||||
/**
|
||||
* Macrobar hook.
|
||||
*/
|
||||
Hooks.on("hotbarDrop", (bar, data, slot) => createWorldbuildingMacro(data, slot));
|
||||
|
||||
/**
|
||||
* Adds the actor template context menu.
|
||||
*/
|
||||
Hooks.on("getActorDirectoryEntryContext", (html, options) => {
|
||||
|
||||
// Define an actor as a template.
|
||||
options.push({
|
||||
name: game.i18n.localize("SIMPLE.DefineTemplate"),
|
||||
icon: '<i class="fas fa-stamp"></i>',
|
||||
condition: li => {
|
||||
const actor = game.actors.get(li.data("documentId"));
|
||||
return !actor.isTemplate;
|
||||
},
|
||||
callback: li => {
|
||||
const actor = game.actors.get(li.data("documentId"));
|
||||
actor.setFlag("worldbuilding", "isTemplate", true);
|
||||
}
|
||||
});
|
||||
|
||||
// Undefine an actor as a template.
|
||||
options.push({
|
||||
name: game.i18n.localize("SIMPLE.UnsetTemplate"),
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
condition: li => {
|
||||
const actor = game.actors.get(li.data("documentId"));
|
||||
return actor.isTemplate;
|
||||
},
|
||||
callback: li => {
|
||||
const actor = game.actors.get(li.data("documentId"));
|
||||
actor.setFlag("worldbuilding", "isTemplate", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Adds the item template context menu.
|
||||
*/
|
||||
Hooks.on("getItemDirectoryEntryContext", (html, options) => {
|
||||
|
||||
// Define an item as a template.
|
||||
options.push({
|
||||
name: game.i18n.localize("SIMPLE.DefineTemplate"),
|
||||
icon: '<i class="fas fa-stamp"></i>',
|
||||
condition: li => {
|
||||
const item = game.items.get(li.data("documentId"));
|
||||
return !item.isTemplate;
|
||||
},
|
||||
callback: li => {
|
||||
const item = game.items.get(li.data("documentId"));
|
||||
item.setFlag("worldbuilding", "isTemplate", true);
|
||||
}
|
||||
});
|
||||
|
||||
// Undefine an item as a template.
|
||||
options.push({
|
||||
name: game.i18n.localize("SIMPLE.UnsetTemplate"),
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
condition: li => {
|
||||
const item = game.items.get(li.data("documentId"));
|
||||
return item.isTemplate;
|
||||
},
|
||||
callback: li => {
|
||||
const item = game.items.get(li.data("documentId"));
|
||||
item.setFlag("worldbuilding", "isTemplate", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue