fixes v12

This commit is contained in:
rwanoux
2024-06-24 08:41:59 +02:00
parent 9d74f5fe14
commit f4a56aa6b0
61 changed files with 485 additions and 422 deletions
+54 -60
View File
@@ -1,6 +1,6 @@
export class TotemPicker extends Application {
constructor(linkEl, actor) {
super();
this.linkEl = linkEl;
@@ -9,14 +9,14 @@ export class TotemPicker extends Application {
/* -------------------------------------------- */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
id:"TOTEM_PICKER",
title:game.i18n.localize("VERMINE.totem_picker"),
template:'systems/vermine2047/templates/applications/choose-totem.hbs',
popOut:true,
resizable:true,
height:"800",
width:"800"
return foundry.utils.mergeObject(super.defaultOptions, {
id: "TOTEM_PICKER",
title: game.i18n.localize("VERMINE.totem_picker"),
template: 'systems/vermine2047/templates/applications/choose-totem.hbs',
popOut: true,
resizable: true,
height: "800",
width: "800"
});
}
@@ -24,26 +24,20 @@ export class TotemPicker extends Application {
// Send data to the template
return {
config: CONFIG.VERMINE,
/*anarchy: this.gmAnarchy.getAnarchy(),
convergences: this.gmConvergence.getConvergences(),
difficultyPools: this.gmDifficulty.getDifficultyData(),
options: {
classes: [game.system.anarchy.styles.selectCssClass()]
}*/
}
}
activateListeners(html) {
super.activateListeners(html);
html.find('.totem').click(event => {
const totem = $(event.target).parent('a').data('totem');
if (totem != null){
this.actor.update({ 'system.identity.totem': totem });
}
this.close();
});
html.find('.totem').click(event => {
const totem = $(event.target).parent('a').data('totem');
if (totem != null) {
this.actor.update({ 'system.identity.totem': totem });
}
this.close();
});
}
/*async _updateObject(event, formData) {
// console.log(formData.exampleInput);
}*/
@@ -52,7 +46,7 @@ export class TotemPicker extends Application {
export class ActorPicker extends Application {
constructor(linkEl, actor) {
super();
this.linkEl = linkEl;
@@ -61,14 +55,14 @@ export class ActorPicker extends Application {
/* -------------------------------------------- */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
id:"ACTOR_PICKER",
title:game.i18n.localize("VERMINE.actor_picker"),
template:'systems/vermine2047/templates/applications/choose-actor.hbs',
popOut:true,
resizable:true,
height:"350",
width:"600"
return foundry.utils.mergeObject(super.defaultOptions, {
id: "ACTOR_PICKER",
title: game.i18n.localize("VERMINE.actor_picker"),
template: 'systems/vermine2047/templates/applications/choose-actor.hbs',
popOut: true,
resizable: true,
height: "350",
width: "600"
});
}
@@ -78,49 +72,49 @@ export class ActorPicker extends Application {
// Send data to the template
const npcs = game.actors.filter(a => a.type == "npc");
const characters = game.actors.filter(a => a.type == "character");
const encounters = game.actors.filter(a => a.type == "npc" || a.type == 'character');
const all = game.actors.filter(a => a.type == "npc" || a.type == 'character');
const type = $(this.linkEl).data('type');
let actorsList = [];
if (type == 'members'){
if (type == 'members') {
actorsList = characters;
} else if (type == 'relations'){
actorsList = npc;
} else if (type == 'relations') {
actorsList = npc;//[...npc, ...characters];
} else {
actorsList = encounters;
actorsList = all;
}
return {
config: CONFIG.VERMINE,
actorsList: actorsList
config: CONFIG.VERMINE,
actorsList: actorsList
}
}
activateListeners(html) {
async activateListeners(html) {
super.activateListeners(html);
html.find('.actor').click(event => {
const actorId = $(event.target).parent('div').data('id');
const type = $(this.linkEl).data('type');
let actorsList = [];
html.find('.actor').click(async (event) => {
const actorId = $(event.target).parent('div').data('actor-id');
const type = $(this.linkEl).data('type');
let actorsList = [];
if (type == 'members'){
actorsList = this.actor.system.members;
} else if (type == 'encounters'){
actorsList = this.actor.system.encounters;
}
if (!Array.isArray(actorsList)){
actorsList = [];
}
if (type == 'members') {
actorsList = this.actor.system.members;
} else if (type == 'encounters') {
actorsList = this.actor.system.encounters;
}
if (!Array.isArray(actorsList)) {
actorsList = [];
}
actorsList.push(actorId);
actorsList.push(actorId);
if (type == 'members'){
actorsList = this.actor.system.members;
this.actor.update({ 'system.members': actorsList });
} else if (type == 'encounters'){
this.actor.update({ 'system.encounters': actorsList });
}
if (type == 'members') {
actorsList = this.actor.system.members;
this.actor.update({ 'system.members': actorsList });
} else if (type == 'encounters') {
this.actor.update({ 'system.encounters': actorsList });
}
});
});
}
}