totem picker done

This commit is contained in:
François-Xavier Guillois
2023-08-31 19:18:37 +02:00
parent 987bb9fd6e
commit ff6be3989e
8 changed files with 152 additions and 28 deletions
+1 -1
View File
@@ -272,7 +272,7 @@ export class VermineCharacterSheet extends VermineActorSheet {
const el = event.currentTarget;
// const dataset = el.dataset;
const totemPicker = new TotemPicker(el);
const totemPicker = new TotemPicker(el, this.actor);
totemPicker.render(true);
}
+15 -6
View File
@@ -1,10 +1,12 @@
export class TotemPicker extends Application {
constructor(element) {
constructor(linkEl, actor) {
super();
this.linkEl = linkEl;
this.actor = actor;
}
/* -------------------------------------------- */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
@@ -20,8 +22,9 @@ export class TotemPicker extends Application {
getData() {
// Send data to the template
return {
config: CONFIG.VERMINE
config: CONFIG.VERMINE,
/*anarchy: this.gmAnarchy.getAnarchy(),
convergences: this.gmConvergence.getConvergences(),
difficultyPools: this.gmDifficulty.getDifficultyData(),
@@ -33,10 +36,16 @@ export class TotemPicker extends Application {
activateListeners(html) {
super.activateListeners(html);
// html.find('.app-title-bar').mousedown(event => this.handleDrag.onMouseDown(event));
html.find('.totem').click(event => {
const totem = $(event.target).parent('a').data('totem');
if (totem != null){
this.actor.update({ 'system.identity.totem': totem });
}
});
}
async _updateObject(event, formData) {
/*async _updateObject(event, formData) {
// console.log(formData.exampleInput);
}
}*/
}
+12
View File
@@ -77,6 +77,18 @@ VERMINE.totems = {
"loner": "TOTEMS.loner.name",
"adapted": "TOTEMS.adapted.name"
}
VERMINE.totem_opposites = {
"human":"TOTEMS.adapted.name",
"predator": "TOTEMS.scavenger.name" ,
"scavenger": "TOTEMS.predator.name" ,
"symbiote": "TOTEMS.parasite.name" ,
"parasite": "TOTEMS.symbiote.name" ,
"builder": "TOTEMS.horde.name" ,
"horde": "TOTEMS.builder.name" ,
"hive": "TOTEMS.loner.name" ,
"loner": "TOTEMS.hive.name",
"adapted": "TOTEMS.human.name"
}
VERMINE.origins = {"aon":"Aon",
"avhorae": "Avhorae" ,
+14
View File
@@ -46,6 +46,20 @@ export const registerHandlebarsHelpers = function () {
return game.i18n.localize(arrayLabel +"."+objectLabel+".name");
});
Handlebars.registerHelper('smarttlk', function (arrayLabel,objectLabel, key) {
return game.i18n.localize(arrayLabel +"."+objectLabel+"."+key);
});
Handlebars.registerHelper('smartcfg', function (configLabel, objectLabel) {
let text = "";
text = game.i18n.localize(CONFIG.VERMINE[configLabel][objectLabel]);
if (text == null){
text = CONFIG.VERMINE[configLabel][objectLabel];
}
return text;
});
// return skill level information
Handlebars.registerHelper('skillLevel', function (property, level, options) {
if (level < 1 || level > 5)