diff --git a/lang/en.json b/lang/en.json
index 8930796..6f41842 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -1,10 +1,6 @@
{
- "TOTEM.AbilityStrAbbr": "str",
- "TOTEM.AbilityConAbbr": "con",
- "TOTEM.AbilityDexAbbr": "dex",
- "TOTEM.AbilityIntAbbr": "int",
- "TOTEM.AbilityWisAbbr": "wis",
- "TOTEM.AbilityChaAbbr": "cha",
+ "TOTEM.WorldSettings.GameMode.Name":"Choix du mode de jeu",
+ "TOTEM.WorldSettings.GameMode.Hint":"À l’image de certains jeux vidéo proposant différents, Vermine 2047 permet aux joueurs de choisir leur Mode de jeu et de fixer eux-mêmes le degré de réalisme, de surnaturel et de dangerosité de l’univers.",
"TOTEM.level": "Niveau",
"TOTEM.pool": "Réserve",
diff --git a/module/sheets/actor-sheet.mjs b/module/sheets/actor-sheet.mjs
index 53147b9..7278632 100644
--- a/module/sheets/actor-sheet.mjs
+++ b/module/sheets/actor-sheet.mjs
@@ -43,7 +43,6 @@ export class TotemActorSheet extends ActorSheet {
// Prepare character data and items.
if (actorData.type == 'character') {
this._prepareItems(context);
- this._prepareCharacterData(context);
}
// Prepare NPC data and items.
@@ -60,171 +59,5 @@ export class TotemActorSheet extends ActorSheet {
return context;
}
- /**
- * Organize and classify Items for Character sheets.
- *
- * @param {Object} actorData The actor to prepare.
- *
- * @return {undefined}
- */
- _prepareCharacterData(context) {
- // Handle ability scores.
- for (let [k, v] of Object.entries(context.system.abilities)) {
- v.label = game.i18n.localize(context.system.abilities[k].label) ?? k;
- }
- }
-
- /**
- * Organize and classify Items for Character sheets.
- *
- * @param {Object} actorData The actor to prepare.
- *
- * @return {undefined}
- */
- _prepareItems(context) {
- // Initialize containers.
- const gear = [];
- const features = [];
- const spells = {
- 0: [],
- 1: [],
- 2: [],
- 3: [],
- 4: [],
- 5: [],
- 6: [],
- 7: [],
- 8: [],
- 9: []
- };
-
- // Iterate through items, allocating to containers
- for (let i of context.items) {
- i.img = i.img || DEFAULT_TOKEN;
- // Append to gear.
- if (i.type === 'item') {
- gear.push(i);
- }
- // Append to features.
- else if (i.type === 'feature') {
- features.push(i);
- }
- // Append to spells.
- else if (i.type === 'spell') {
- if (i.system.spellLevel != undefined) {
- spells[i.system.spellLevel].push(i);
- }
- }
- }
-
- // Assign and return
- context.gear = gear;
- context.features = features;
- context.spells = spells;
- }
-
- /* -------------------------------------------- */
-
- /** @override */
- activateListeners(html) {
- super.activateListeners(html);
-
- // Render the item sheet for viewing/editing prior to the editable check.
- html.find('.item-edit').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
- const item = this.actor.items.get(li.data("itemId"));
- item.sheet.render(true);
- });
-
- // -------------------------------------------------------------
- // Everything below here is only needed if the sheet is editable
- if (!this.isEditable) return;
-
- // Add Inventory Item
- html.find('.item-create').click(this._onItemCreate.bind(this));
-
- // Delete Inventory Item
- html.find('.item-delete').click(ev => {
- const li = $(ev.currentTarget).parents(".item");
- const item = this.actor.items.get(li.data("itemId"));
- item.delete();
- li.slideUp(200, () => this.render(false));
- });
-
- // Active Effect management
- html.find(".effect-control").click(ev => onManageActiveEffect(ev, this.actor));
-
- // Rollable abilities.
- html.find('.rollable').click(this._onRoll.bind(this));
-
- // Drag events for macros.
- if (this.actor.isOwner) {
- let handler = ev => this._onDragStart(ev);
- html.find('li.item').each((i, li) => {
- if (li.classList.contains("inventory-header")) return;
- li.setAttribute("draggable", true);
- li.addEventListener("dragstart", handler, false);
- });
- }
- }
-
- /**
- * Handle creating a new Owned Item for the actor using initial data defined in the HTML dataset
- * @param {Event} event The originating click event
- * @private
- */
- async _onItemCreate(event) {
- event.preventDefault();
- const header = event.currentTarget;
- // Get the type of item to create.
- const type = header.dataset.type;
- // Grab any data associated with this control.
- const data = duplicate(header.dataset);
- // Initialize a default name.
- const name = `New ${type.capitalize()}`;
- // Prepare the item object.
- const itemData = {
- name: name,
- type: type,
- system: data
- };
- // Remove the type from the dataset since it's in the itemData.type prop.
- delete itemData.system["type"];
-
- // Finally, create the item!
- return await Item.create(itemData, {parent: this.actor});
- }
-
- /**
- * Handle clickable rolls.
- * @param {Event} event The originating click event
- * @private
- */
- _onRoll(event) {
- event.preventDefault();
- const element = event.currentTarget;
- const dataset = element.dataset;
-
- // Handle item rolls.
- if (dataset.rollType) {
- if (dataset.rollType == 'item') {
- const itemId = element.closest('.item').dataset.itemId;
- const item = this.actor.items.get(itemId);
- if (item) return item.roll();
- }
- }
-
- // Handle rolls that supply the formula directly.
- if (dataset.roll) {
- let label = dataset.label ? `[ability] ${dataset.label}` : '';
- let roll = new Roll(dataset.roll, this.actor.getRollData());
- roll.toMessage({
- speaker: ChatMessage.getSpeaker({ actor: this.actor }),
- flavor: label,
- rollMode: game.settings.get('core', 'rollMode'),
- });
- return roll;
- }
- }
}
diff --git a/module/sheets/character-sheet.mjs b/module/sheets/character-sheet.mjs
index b3d6006..dac8392 100644
--- a/module/sheets/character-sheet.mjs
+++ b/module/sheets/character-sheet.mjs
@@ -20,7 +20,7 @@ export class TotemCharacterSheet extends TotemActorSheet {
/** @override */
get template() {
- return `systems/totem/templates/actor/actor-${this.actor.type}-sheet.html`;
+ return `systems/totem/templates/actor/actor-character-sheet.html`;
}
/* -------------------------------------------- */
@@ -205,7 +205,7 @@ export class TotemCharacterSheet extends TotemActorSheet {
event.preventDefault();
const element = event.currentTarget;
const dataset = element.dataset;
-
+ console.log("Ceci est un jet d'un personnage joueur");
// Handle item rolls.
if (dataset.rollType) {
if (dataset.rollType == 'item') {
@@ -217,14 +217,10 @@ export class TotemCharacterSheet extends TotemActorSheet {
// Handle rolls that supply the formula directly.
if (dataset.roll) {
- let label = dataset.label ? `[ability] ${dataset.label}` : '';
- let roll = new Roll(dataset.roll, this.actor.getRollData());
- roll.toMessage({
- speaker: ChatMessage.getSpeaker({ actor: this.actor }),
- flavor: label,
- rollMode: game.settings.get('core', 'rollMode'),
- });
- return 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);
+ const NoD = this.actor.system.skills[$(element).attr('for').split('.')[2]]?.value || 0
+ return game.totem.TotemRoll.roll(this.actor.id, label, NoD, 0, {});
}
}
diff --git a/module/system/hooks.mjs b/module/system/hooks.mjs
index 3894d34..735cd6e 100644
--- a/module/system/hooks.mjs
+++ b/module/system/hooks.mjs
@@ -1,4 +1,3 @@
-import { TotemFight } from './fight.mjs';
export const registerHooks = function () {
/**
@@ -34,7 +33,7 @@ export const registerHooks = function () {
});
Hooks.on('getSceneControlButtons', (controls) => {
- controls.find((c) => c.name === 'token').tools.push({
+ /*controls.find((c) => c.name === 'token').tools.push({
name: 'Dice Roller',
title: game.i18n.localize("TOTEM.RollTool"),
icon: 'fas fa-dice-d6',
@@ -42,7 +41,7 @@ export const registerHooks = function () {
onClick() {
TotemRoll.ui();
}
- });
+ });*/
});
/* -------------------------------------------- */
@@ -50,7 +49,7 @@ export const registerHooks = function () {
/* -------------------------------------------- */
Hooks.on("preCreateActor", function (actor) {
- console.log('pre create actor', actor);
+ // console.log('pre create actor', actor);
if (actor.img == "icons/svg/mystery-man.svg") {
// actor.updateSource({"img": `systems/totem/icons/actors/${actor.type}.webp`});
// item.updateSource({"img": `systems/totem/icons/competence.webp`});
@@ -90,6 +89,18 @@ export const registerHooks = function () {
}*/
}
});
+
+ /* Hooks.on("chatCommandsReady", function (chatCommands) {
+ chatCommands.registerCommand(chatCommands.createCommandFromData({
+ commandKey: "/dr",
+ invokeOnCommand: (chatlog, messageText, chatdata) => {
+ Roll.get().parse(messageText);
+ },
+ shouldDisplayToChat: false,
+ iconClass: "fa-dice-d6",
+ description: "Roll Totem check"
+ }));
+ });*/
}
diff --git a/module/system/roll.js b/module/system/roll.js
deleted file mode 100644
index cd8e706..0000000
--- a/module/system/roll.js
+++ /dev/null
@@ -1,284 +0,0 @@
-import { getActorSkillScore, updateActorSkillScore } from "./functions.mjs";
-
-export class TotemRoll {
- async performTest(dicePool, target, trait, usingSpecialization, difficulty, skill, params, actor) {
- const r = new Roll(dicePool + 'd6');
- r.roll();
- let _trait = trait || 0;
- let _usingSpecialization = usingSpecialization || 0;
- let _skillLabel = (params.skill != undefined) ? game.i18n.format(params.skill) : "";
- let _used = (params.usure != undefined) ? params.usure : 0;
- let diceString = '';
- let total = 0;
-
- // affichage des valeurs
- let targetText = _skillLabel + ' : ' + skill + ' (+'+ _used +')';
- if (trait)
- targetText += ', '+ game.i18n.format('TOTEM.Traits') + ' : ' + _trait;
- if (_usingSpecialization != 0)
- targetText += ', '+ game.i18n.format('TOTEM.UsingSpecialization');
- if (difficulty)
- targetText += '
'+ game.i18n.format('TOTEM.Against') +': ' + Math.abs(difficulty);
-
- // affichage des jets
- for (let i = 0; i < dicePool; i++) {
- let result = r.terms[0].results[i].result;
- if (result == 6) {
- diceString += '