underscore
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {onManageActiveEffect, prepareActiveEffectCategories} from "../system/effects.mjs";
|
||||
import { TotemActorSheet } from "./actor-sheet.mjs";
|
||||
import { getRollBox } from "../system/dialogs.mjs";
|
||||
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
@@ -216,11 +217,14 @@ export class TotemCharacterSheet extends TotemActorSheet {
|
||||
}
|
||||
|
||||
// Handle rolls that supply the formula directly.
|
||||
if (dataset.roll) {
|
||||
const label = game.i18n.localize(dataset.label) ? `[ability] ${game.i18n.localize(dataset.label)}` : '';
|
||||
console.log($(element).attr('for'), this.actor.system.skills[$(element).attr('for').split('.')[2]].value);
|
||||
if (dataset.label) {
|
||||
/*const label = game.i18n.localize(dataset.label) ? `[ability] ${game.i18n.localize(dataset.label)}` : '';
|
||||
console.log($(element).attr('for'));
|
||||
const NoD = this.actor.system.skills[$(element).attr('for').split('.')[2]]?.value || 0
|
||||
return game.totem.TotemRoll.roll(this.actor.id, label, NoD, 0, {});
|
||||
return game.totem.TotemRoll.roll(this.actor.id, label, NoD, 0, {});*/
|
||||
let data = {};
|
||||
getRollBox(data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -7,11 +7,11 @@ export const TOTEM = {};
|
||||
|
||||
|
||||
TOTEM.SkillLevels = {
|
||||
1:{ "label":"TOTEM.SkillLevel.beginner", "dicePool":1, "reroll":0},
|
||||
2:{ "label":"TOTEM.SkillLevel.proficient", "dicePool":1, "reroll":1},
|
||||
3:{ "label":"TOTEM.SkillLevel.expert", "dicePool":2, "reroll":1},
|
||||
4:{ "label":"TOTEM.SkillLevel.master", "dicePool":2, "reroll":2},
|
||||
5:{ "label":"TOTEM.SkillLevel.legend", "dicePool":3, "reroll":2},
|
||||
1:{ "label":"TOTEM.skill_level.beginner", "dicePool":1, "reroll":0},
|
||||
2:{ "label":"TOTEM.skill_level.proficient", "dicePool":1, "reroll":1},
|
||||
3:{ "label":"TOTEM.skill_level.expert", "dicePool":2, "reroll":1},
|
||||
4:{ "label":"TOTEM.skill_level.master", "dicePool":2, "reroll":2},
|
||||
5:{ "label":"TOTEM.skill_level.legend", "dicePool":3, "reroll":2},
|
||||
}
|
||||
|
||||
TOTEM.TotemNumbers = {
|
||||
@@ -29,36 +29,36 @@ TOTEM.TotemNumbers = {
|
||||
|
||||
TOTEM.abilityCategories = {
|
||||
"physical": {
|
||||
"label":"TOTEM.abilityCategory.physical"
|
||||
"label":"TOTEM.ability_category.physical"
|
||||
},
|
||||
"manual": {
|
||||
"label":"TOTEM.abilityCategory.manual"
|
||||
"label":"TOTEM.ability_category.manual"
|
||||
},
|
||||
"mental": {
|
||||
"label":"TOTEM.abilityCategory.mental"
|
||||
"label":"TOTEM.ability_category.mental"
|
||||
},
|
||||
"social": {
|
||||
"label":"TOTEM.abilityCategory.social"
|
||||
"label":"TOTEM.ability_category.social"
|
||||
}
|
||||
}
|
||||
|
||||
TOTEM.skillCategories = {
|
||||
"man": {
|
||||
"label":"TOTEM.skillCategory.man"
|
||||
"label":"TOTEM.skill_category.man"
|
||||
},
|
||||
"animal": {
|
||||
"label":"TOTEM.skillCategory.animal"
|
||||
"label":"TOTEM.skill_category.animal"
|
||||
},
|
||||
"tool": {
|
||||
"label":"TOTEM.skillCategory.machine"
|
||||
"label":"TOTEM.skill_category.machine"
|
||||
},
|
||||
"weapon": {
|
||||
"label":"TOTEM.skillCategory.weapon"
|
||||
"label":"TOTEM.skill_category.weapon"
|
||||
},
|
||||
"survival": {
|
||||
"label":"TOTEM.skillCategory.survival"
|
||||
"label":"TOTEM.skill_category.survival"
|
||||
},
|
||||
"world": {
|
||||
"label":"TOTEM.skillCategory.earth"
|
||||
"label":"TOTEM.skill_category.earth"
|
||||
}
|
||||
}
|
||||
@@ -33,4 +33,71 @@
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const getRollBox = async function(data) {
|
||||
let html = await renderTemplate('systems/totem/templates/roll.hbs', data);
|
||||
let ui = new Dialog({
|
||||
title: game.i18n.localize("TOTEM.RollTool"),
|
||||
content: html,
|
||||
buttons: {
|
||||
roll: {
|
||||
label: game.i18n.localize('TOTEM.RollDice'),
|
||||
callback: (html) => {
|
||||
let form = html.find('#dice-pool-form');
|
||||
if (!form[0].checkValidity()) {
|
||||
throw "Invalid Data";
|
||||
}
|
||||
let target = 0, trait, usingSpecialization, difficulty, skill = 0, params = {};
|
||||
form.serializeArray().forEach(e => {
|
||||
switch (e.name) {
|
||||
case "difficulty":
|
||||
if (e.value != "")
|
||||
difficulty = -e.value;
|
||||
break;
|
||||
case "skillLabel":
|
||||
params.skill = e.value;
|
||||
break;
|
||||
case "usure":
|
||||
params.usure = +e.value;
|
||||
break;
|
||||
case "skill":
|
||||
skill = +e.value;
|
||||
break;
|
||||
case "trait":
|
||||
trait = +e.value;
|
||||
break;
|
||||
case "usingSpecialization":
|
||||
if (e.value && +e.value > 1)
|
||||
usingSpecialization = +e.value;
|
||||
break;
|
||||
}
|
||||
|
||||
// prise en compte de l'usure sur la feuille de perso
|
||||
if (params.usure != undefined){
|
||||
updateActorSkillScore(actor, data.skill, 'spent', data.skillSpent + parseInt(params.usure,10));
|
||||
}
|
||||
});
|
||||
return EcrymeRoll.get().performTest(data.dicePool, target, trait, usingSpecialization, difficulty, skill, params, actor);
|
||||
}
|
||||
},
|
||||
close: {
|
||||
label: game.i18n.localize('Close'),
|
||||
callback: () => { }
|
||||
}
|
||||
},
|
||||
render: function (h) {
|
||||
h.find("#skills-radio input").change(function () {
|
||||
let s = $(this).attr("data-skill");
|
||||
h.find(".trait-list .hidden").removeClass("show");
|
||||
let f = h.find(".trait-list ." + s);
|
||||
f.addClass("show");
|
||||
if (f.length == 0) {
|
||||
h.find(".use-trait input").attr("disabled", "disabled").prop("checked", false);
|
||||
} else
|
||||
h.find(".use-trait input").attr("disabled", null);
|
||||
});
|
||||
}
|
||||
});
|
||||
ui.render(true);
|
||||
}
|
||||
@@ -12,6 +12,9 @@
|
||||
// "systems/totem/templates/actor/parts/actor-skills.html",
|
||||
"systems/totem/templates/actor/parts/actor-items.html",
|
||||
"systems/totem/templates/actor/parts/actor-effects.html",
|
||||
|
||||
// additional templates
|
||||
"systems/totem/templates/roll.hbs",
|
||||
]);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user