fixe hexa radios

This commit is contained in:
rwanoux
2024-05-15 10:36:45 +02:00
parent a970e9335c
commit 5c3301b88e
3 changed files with 37 additions and 15 deletions
+26 -9
View File
@@ -40,6 +40,8 @@ export class VermineActorSheet extends ActorSheet {
// Add the actor's data to context.data for easier access, as well as flags.
context.system = actorData.system;
context.flags = actorData.flags;
//add system config for convenience use
context.config = CONFIG.VERMINE;
// Add roll data for TinyMCE editors.
@@ -48,6 +50,7 @@ export class VermineActorSheet extends ActorSheet {
// Prepare active effects
context.effects = prepareActiveEffectCategories(this.actor.effects);
return context;
}
@@ -92,22 +95,33 @@ export class VermineActorSheet extends ActorSheet {
}
//click on wound radio
html.find('.hexa [type="radio"]').change(ev => {
ev.preventDefault()
console.log(ev.target.checked, "CHECK______________________")
html.find('.hexa [type="radio"]').click(ev => {
ev.preventDefault();
ev.stopPropagation();
return this._onClickRadioHexa(ev)
})
}
_onClickRadioHexa(ev) {
console.log("________________iiiiiii")
if (!ev.currentTarget.checked) { return false };
ev.preventDefault();
let prop = ev.currentTarget.name;
let input = ev.currentTarget;
console.log(input.value, input.name);
let update = {};
update[prop] = ev.currentTarget.value - 1
update[input.name] = 0
let propTree = input.name.split('.')
let current = this.actor;
for (let prop of propTree) {
current = current[prop]
}
if (current != input.value) {
update[input.name] = parseInt(input.value)
} else {
update[input.name] = parseInt(input.value) - 1;
}
this.actor.update(update)
return this.actor.update(update)
}
async _onMinMaxEdit(event) {
@@ -162,4 +176,7 @@ export class VermineActorSheet extends ActorSheet {
// Finally, create the item!
return await Item.create(itemData, { parent: this.actor });
}
async getGroup() {
return await game.actors.find(group => { group == group - 1 })
}
}
+5
View File
@@ -56,6 +56,11 @@ export class VermineCharacterSheet extends VermineActorSheet {
// Add roll data for TinyMCE editors.
context.rollData = context.actor.getRollData();
//get the group actor
context.group = this.getGroup()
// Prepare active effects
context.effects = prepareActiveEffectCategories(this.actor.effects);