underscore

This commit is contained in:
François-Xavier Guillois
2023-05-18 19:54:32 +02:00
parent 6fc4f79542
commit 03d71ecd3c
9 changed files with 192 additions and 57 deletions
+36 -27
View File
@@ -8,29 +8,38 @@
"TOTEM.self_control": "Sang-Froid", "TOTEM.self_control": "Sang-Froid",
"TOTEM.effort": "Effort", "TOTEM.effort": "Effort",
"TOTEM.group": "Groupe", "TOTEM.group": "Groupe",
"TOTEM.abilities":"Caractéristiques",
"TOTEM.ability":"Caractéristique",
"TOTEM.skills_title":"Compétences",
"TOTEM.skill_title":"Compétence",
"TOTEM.bonus":"Bonus",
"TOTEM.penalty":"Malus",
"TOTEM.reroll":"Relance",
"TOTEM.specialty":"Spécialité",
"TOTEM.difficulty":"Difficulty",
"TOTEM.abilities.vigor":"Vigueur", "TOTEM.vigor_ability":"Vigueur",
"TOTEM.abilities.health":"Santé", "TOTEM.health_ability":"Santé",
"TOTEM.abilities.precision":"Précision", "TOTEM.precision_ability":"Précision",
"TOTEM.abilities.reflexes":"Réflexes", "TOTEM.reflexes_ability":"Réflexes",
"TOTEM.abilities.knowledge":"Savoir", "TOTEM.knowledge_ability":"Savoir",
"TOTEM.abilities.perception":"Perception", "TOTEM.perception_ability":"Perception",
"TOTEM.abilities.will":"Volonté", "TOTEM.will_ability":"Volonté",
"TOTEM.abilities.empathy":"Empathie", "TOTEM.empathy_ability":"Empathie",
"TOTEM.EffectCreate": "Create Effect", "TOTEM.effect_treate": "Create Effect",
"TOTEM.EffectToggle": "Toggle Effect", "TOTEM.effect_toggle": "Toggle Effect",
"TOTEM.EffectEdit": "Edit Effect", "TOTEM.effect_edit": "Edit Effect",
"TOTEM.EffectDelete": "Delete Effect", "TOTEM.effect_delete": "Delete Effect",
"TOTEM.Add": "Add", "TOTEM.Add": "Add",
"TOTEM.SkillLevel.beginner": "Débutant", "TOTEM.skill_level.beginner": "Débutant",
"TOTEM.SkillLevel.proficient": "Confirmé", "TOTEM.skill_level.proficient": "Confirmé",
"TOTEM.SkillLevel.expert": "Expert", "TOTEM.skill_level.expert": "Expert",
"TOTEM.SkillLevel.master": "Maître", "TOTEM.skill_level.master": "Maître",
"TOTEM.SkillLevel.legend": "Légende", "TOTEM.skill_level.legend": "Légende",
"TOTEM.totems.human": "l'Humain", "TOTEM.totems.human": "l'Humain",
"TOTEM.totems.scavenger": "le Prédateur", "TOTEM.totems.scavenger": "le Prédateur",
@@ -42,17 +51,17 @@
"TOTEM.totems.solitary": "le Solitaire", "TOTEM.totems.solitary": "le Solitaire",
"TOTEM.totems.adapted": "l'Adapté", "TOTEM.totems.adapted": "l'Adapté",
"TOTEM.abilityCategory.physical": "Physiques", "TOTEM.ability_category.physical": "Physiques",
"TOTEM.abilityCategory.manual": "Manuelles", "TOTEM.ability_category.manual": "Manuelles",
"TOTEM.abilityCategory.mental": "Mentales", "TOTEM.ability_category.mental": "Mentales",
"TOTEM.abilityCategory.social": "Sociales", "TOTEM.ability_category.social": "Sociales",
"TOTEM.skillCategory.man": "L'Homme", "TOTEM.skill_category.man": "L'Homme",
"TOTEM.skillCategory.animal": "L'Animal", "TOTEM.skill_category.animal": "L'Animal",
"TOTEM.skillCategory.machine": "La Machine", "TOTEM.skill_category.machine": "La Machine",
"TOTEM.skillCategory.weapon": "L'Arme", "TOTEM.skill_category.weapon": "L'Arme",
"TOTEM.skillCategory.survival": "La Survie", "TOTEM.skill_category.survival": "La Survie",
"TOTEM.skillCategory.earth": "La Terre", "TOTEM.skill_category.earth": "La Terre",
"TOTEM.skills.arts":"Arts", "TOTEM.skills.arts":"Arts",
"TOTEM.skills.civilization":"Civilisation", "TOTEM.skills.civilization":"Civilisation",
+8 -4
View File
@@ -1,5 +1,6 @@
import {onManageActiveEffect, prepareActiveEffectCategories} from "../system/effects.mjs"; import {onManageActiveEffect, prepareActiveEffectCategories} from "../system/effects.mjs";
import { TotemActorSheet } from "./actor-sheet.mjs"; import { TotemActorSheet } from "./actor-sheet.mjs";
import { getRollBox } from "../system/dialogs.mjs";
/** /**
* Extend the basic ActorSheet with some very simple modifications * 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. // Handle rolls that supply the formula directly.
if (dataset.roll) { if (dataset.label) {
const label = game.i18n.localize(dataset.label) ? `[ability] ${game.i18n.localize(dataset.label)}` : ''; /*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); console.log($(element).attr('for'));
const NoD = this.actor.system.skills[$(element).attr('for').split('.')[2]]?.value || 0 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
View File
@@ -7,11 +7,11 @@ export const TOTEM = {};
TOTEM.SkillLevels = { TOTEM.SkillLevels = {
1:{ "label":"TOTEM.SkillLevel.beginner", "dicePool":1, "reroll":0}, 1:{ "label":"TOTEM.skill_level.beginner", "dicePool":1, "reroll":0},
2:{ "label":"TOTEM.SkillLevel.proficient", "dicePool":1, "reroll":1}, 2:{ "label":"TOTEM.skill_level.proficient", "dicePool":1, "reroll":1},
3:{ "label":"TOTEM.SkillLevel.expert", "dicePool":2, "reroll":1}, 3:{ "label":"TOTEM.skill_level.expert", "dicePool":2, "reroll":1},
4:{ "label":"TOTEM.SkillLevel.master", "dicePool":2, "reroll":2}, 4:{ "label":"TOTEM.skill_level.master", "dicePool":2, "reroll":2},
5:{ "label":"TOTEM.SkillLevel.legend", "dicePool":3, "reroll":2}, 5:{ "label":"TOTEM.skill_level.legend", "dicePool":3, "reroll":2},
} }
TOTEM.TotemNumbers = { TOTEM.TotemNumbers = {
@@ -29,36 +29,36 @@ TOTEM.TotemNumbers = {
TOTEM.abilityCategories = { TOTEM.abilityCategories = {
"physical": { "physical": {
"label":"TOTEM.abilityCategory.physical" "label":"TOTEM.ability_category.physical"
}, },
"manual": { "manual": {
"label":"TOTEM.abilityCategory.manual" "label":"TOTEM.ability_category.manual"
}, },
"mental": { "mental": {
"label":"TOTEM.abilityCategory.mental" "label":"TOTEM.ability_category.mental"
}, },
"social": { "social": {
"label":"TOTEM.abilityCategory.social" "label":"TOTEM.ability_category.social"
} }
} }
TOTEM.skillCategories = { TOTEM.skillCategories = {
"man": { "man": {
"label":"TOTEM.skillCategory.man" "label":"TOTEM.skill_category.man"
}, },
"animal": { "animal": {
"label":"TOTEM.skillCategory.animal" "label":"TOTEM.skill_category.animal"
}, },
"tool": { "tool": {
"label":"TOTEM.skillCategory.machine" "label":"TOTEM.skill_category.machine"
}, },
"weapon": { "weapon": {
"label":"TOTEM.skillCategory.weapon" "label":"TOTEM.skill_category.weapon"
}, },
"survival": { "survival": {
"label":"TOTEM.skillCategory.survival" "label":"TOTEM.skill_category.survival"
}, },
"world": { "world": {
"label":"TOTEM.skillCategory.earth" "label":"TOTEM.skill_category.earth"
} }
} }
+67
View File
@@ -34,3 +34,70 @@
} }
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);
}
+3
View File
@@ -12,6 +12,9 @@
// "systems/totem/templates/actor/parts/actor-skills.html", // "systems/totem/templates/actor/parts/actor-skills.html",
"systems/totem/templates/actor/parts/actor-items.html", "systems/totem/templates/actor/parts/actor-items.html",
"systems/totem/templates/actor/parts/actor-effects.html", "systems/totem/templates/actor/parts/actor-effects.html",
// additional templates
"systems/totem/templates/roll.hbs",
]); ]);
}; };
+8 -8
View File
@@ -45,56 +45,56 @@
}, },
"abilities": { "abilities": {
"vig": { "vig": {
"label":"TOTEM.abilities.vigor", "label":"TOTEM.vigor_ability",
"value": 0, "value": 0,
"min": 0, "min": 0,
"max": 5, "max": 5,
"category": "physical" "category": "physical"
}, },
"vie": { "vie": {
"label":"TOTEM.abilities.health", "label":"TOTEM.health_ability",
"value": 0, "value": 0,
"min": 0, "min": 0,
"max": 5, "max": 5,
"category": "physical" "category": "physical"
}, },
"pre": { "pre": {
"label":"TOTEM.abilities.precision", "label":"TOTEM.precision_ability",
"value": 0, "value": 0,
"min": 0, "min": 0,
"max": 5, "max": 5,
"category": "manual" "category": "manual"
}, },
"ref": { "ref": {
"label":"TOTEM.abilities.reflexes", "label":"TOTEM.reflexes_ability",
"value": 0, "value": 0,
"min": 0, "min": 0,
"max": 5, "max": 5,
"category": "manual" "category": "manual"
}, },
"sav": { "sav": {
"label":"TOTEM.abilities.knowledge", "label":"TOTEM.knowledge_ability",
"value": 0, "value": 0,
"min": 0, "min": 0,
"max": 5, "max": 5,
"category": "mental" "category": "mental"
}, },
"per": { "per": {
"label":"TOTEM.abilities.perception", "label":"TOTEM.perception_ability",
"value": 0, "value": 0,
"min": 0, "min": 0,
"max": 5, "max": 5,
"category": "mental" "category": "mental"
}, },
"vol": { "vol": {
"label":"TOTEM.abilities.will", "label":"TOTEM.will_ability",
"value": 0, "value": 0,
"min": 0, "min": 0,
"max": 5, "max": 5,
"category": "social" "category": "social"
}, },
"emp": { "emp": {
"label":"TOTEM.abilities.empathy", "label":"TOTEM.empathy_ability",
"value": 0, "value": 0,
"min": 0, "min": 0,
"max": 5, "max": 5,
+2 -2
View File
@@ -41,11 +41,11 @@
<section class="grid grid-4col"> <section class="grid grid-4col">
{{#each config.abilityCategories as |abilityCategory ackey|}} {{#each config.abilityCategories as |abilityCategory ackey|}}
<div> <div>
<h4>{{ localize abilityCategory.label }}</h4> <h4 class="align-center">{{ localize abilityCategory.label }}</h4>
{{#each @root.system.abilities as |ability key|}} {{#each @root.system.abilities as |ability key|}}
{{#ife ability.category ackey }} {{#ife ability.category ackey }}
<div class="ability flexcol flex-group-center items-center"> <div class="ability flexcol flex-group-center items-center">
<label for="system.abilities.{{key}}.value" class="resource-label rollable flexlarge align-left" data-roll="d20+@abilities.{{key}}.mod" data-label="{{ability.label}}">{{ability.label}}</label> <label for="system.abilities.{{key}}.value" class="resource-label rollable flexlarge align-left" data-label="{{ability.label}}">{{ability.label}}</label>
<input type="text" name="system.abilities.{{key}}.value" value="{{ability.value}}" data-dtype="Number"/> <input type="text" name="system.abilities.{{key}}.value" value="{{ability.value}}" data-dtype="Number"/>
</div> </div>
{{/ife}} {{/ife}}
+26
View File
@@ -0,0 +1,26 @@
<div class="ecryme-dv roll attribute">
<div class="dice-roll">
<div class="dice-result">
<div class="dice-formula">
{{ ` + dicePool + `d6 }}
</div>
<div class="dice-tooltip expanded">
<section class="tooltip-part flexrow">
<div class="" style="flex:60%;">
<div class="parameters">
{{ targetText }}
</div>
<div class="dice">
<ol class="dice-rolls">{{ diceString }}</ol>
</div>
</div>
<div class="align-center">
Résultat
<p style="font-weight:bold; font-size:2em;">{{ (total + skill + _trait + _usingSpecialization + _used).toString() }}</p>
</div>
</section>
</div>` +
`<h4 class="dice-total">{{ successText }}</h4>
</div>
</div>
</div>
+26
View File
@@ -0,0 +1,26 @@
<form id="dice-pool-form" class="ecryme-dv-form" data-actor-id="{{ speakerId }}">
<div class="dice-pool flexcol">
<div class="flexrow row">
<label class="label" style="flex: 80%;">{{localize 'TOTEM.skills_title'}}</label>
<input type="number" class="numeric-entry" style="text-align: center;" name="skill" id="skill" required min="0" max="10" {{#if skillScore}}value="{{ skillScore }}"{{/if}}>
</div>
<div class="flexrow row">
<label class="label" style="flex: 80%;">{{localize 'TOTEM.ability'}}</label>
<input type="number" class="numeric-entry" style="text-align: center;" name="trait" id="trait" min="-5" max="5" value="0">
</div>
<div class="flexrow row">
<label class="label">{{localize 'TOTEM.specialty'}}</label>
<input type="checkbox" name="usingSpecialization" id="usingSpecialization" value="2" {{#if specialization}}checked{{/if}}>
</div>
<div class="flexrow row">
<label class="label" style="flex: 80%;">{{localize 'TOTEM.reroll'}}</label>
<input type="number" class="numeric-entry" style="text-align: center;" name="usure" id="usure" required min="0" max="{{#if skillScore}}{{ skillScore }}{{ else }}10{{/if}}" value="0">
</div>
<div class="flexrow row">
<label class="label" style="flex: 80%;">{{localize 'TOTEM.difficulty'}}</label>
<input style="text-align: center;" class="numeric-entry" type="number" name="difficulty" value="8" id="difficulty" min="6" max="18">
</div>
</div>
<p><input type="hidden" name="speakerId" value="{{ speakerId }}" />
<input type="hidden" name="skillLabel" value="{{ skill }}" /></p>
</form>