Compare commits

..

No commits in common. "9b37533bdf769848afb4034ea6eba9c7b98ea577" and "80435b6bcae174656dccdae7f62fd37edb560503" have entirely different histories.

10 changed files with 35 additions and 48 deletions

View File

@ -50,12 +50,12 @@ export class ExportScriptarium {
} }
exportActors(actors, targetName) { exportActors(actors, targetName) {
const eol = '\n\r' const eol = '\n'
const header = Misc.join(this.getHeaderLine(), ';') const header = Misc.join(this.getHeaderLine(), ';')
const actorLines = actors.map(actor => Misc.join(this.getActorLine(actor), ';')) const actorLines = actors.map(actor => Misc.join(this.getActorLine(actor), ';'))
const data = Misc.join([header, ...actorLines], eol) const data = Misc.join([header, ...actorLines], eol)
const filename = `scriptarium-${targetName?.slugify()}.csv`; const filename = `scriptatium-${targetName?.slugify()}.csv`;
saveDataToFile(data, "text/csv;charset=windows-1252", `${filename}`); saveDataToFile(data, "text/csv", `${filename}`);
} }
getHeaderLine() { getHeaderLine() {
@ -65,6 +65,7 @@ export class ExportScriptarium {
getActorLine(actor) { getActorLine(actor) {
const context = Mapping.prepareContext(actor) const context = Mapping.prepareContext(actor)
return this.mapping.map(it => it.getter(actor, context)) return this.mapping.map(it => it.getter(actor, context))
//.map(it => JSON.stringify(it))
.map(it => this.$escapeQuotes(it)) .map(it => this.$escapeQuotes(it))
.map(it => it.replaceAll("\n", " ").replaceAll("\r", "")) .map(it => it.replaceAll("\n", " ").replaceAll("\r", ""))
} }

View File

@ -53,7 +53,6 @@ const TABLEAU_SORTS = [...Array(NB_SORTS).keys()]
const MAPPING_BASE = [ const MAPPING_BASE = [
{ column: "ID", getter: (actor, context) => actor.id }, { column: "ID", getter: (actor, context) => actor.id },
{ column: "name", getter: (actor, context) => actor.name }, { column: "name", getter: (actor, context) => actor.name },
{ column: "metier", getter: (actor, context) => actor.system.metier },
// { column: "biographie", getter: (actor, context) => actor.system.biographie }, // { column: "biographie", getter: (actor, context) => actor.system.biographie },
{ column: "taille", getter: (actor, context) => actor.system.carac.taille.value }, { column: "taille", getter: (actor, context) => actor.system.carac.taille.value },
{ column: "apparence", getter: (actor, context) => actor.system.carac.apparence.value }, { column: "apparence", getter: (actor, context) => actor.system.carac.apparence.value },
@ -81,8 +80,7 @@ const MAPPING_BASE = [
{ column: "armure", getter: (actor, context) => Mapping.getArmure(actor, context) }, { column: "armure", getter: (actor, context) => Mapping.getArmure(actor, context) },
{ column: "protection", getter: (actor, context) => Mapping.getProtectionArmure(actor, context) }, { column: "protection", getter: (actor, context) => Mapping.getProtectionArmure(actor, context) },
{ column: "malus-armure", getter: (actor, context) => Mapping.getMalusArmure(actor, context) }, { column: "malus-armure", getter: (actor, context) => Mapping.getMalusArmure(actor, context) },
{ column: "esquive", getter: (actor, context) => Mapping.getEsquive(context) }, { column: "esquive", getter: (actor, context) => Mapping.getEsquiveNiveau(context) },
{ column: "esquive-armure", getter: (actor, context) => Mapping.getEsquiveArmure(context) },
{ column: "competences", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_COMPETENCES) }, { column: "competences", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_COMPETENCES) },
{ column: "draconic", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_DRACONIC) }, { column: "draconic", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_DRACONIC) },
] ]
@ -183,7 +181,7 @@ export class Mapping {
const esquive = esquives[0] const esquive = esquives[0]
return { return {
name: esquive.name, name: esquive.name,
niveau: esquive.system.niveau niveau: Misc.toSignedString(esquive.system.niveau)
} }
} }
return undefined return undefined
@ -244,16 +242,10 @@ export class Mapping {
return context?.armure?.malus ?? 0 return context?.armure?.malus ?? 0
} }
static getEsquive(context) { static getEsquiveNiveau(context) {
if (context.esquive) {
return Misc.toSignedString(context.esquive.niveau)
}
return ''
}
static getEsquiveArmure(context) {
if (context.esquive) { if (context.esquive) {
const niveau = context.esquive.niveau + context.armure.malus const niveau = context.esquive.niveau + context.armure.malus
return Misc.toSignedString(niveau) return niveau > 0 ? ('+' + niveau) : ('' + niveau)
} }
return '' return ''
} }

View File

@ -24,7 +24,7 @@ export class DialogCreateSigneDraconique extends Dialog {
} }
constructor(dialogData, html) { constructor(dialogData, html) {
let options = { classes: ["DialogCreateSigneDraconiqueActors"], width: 500, height: 650, 'z-index': 99999 }; let options = { classes: ["DialogCreateSigneDraconiqueActorsActors"], width: 500, height: 650, 'z-index': 99999 };
let conf = { let conf = {
title: "Créer un signe", title: "Créer un signe",
content: html, content: html,

View File

@ -1,5 +1,4 @@
import { Grammar } from "./grammar.js"; import { Grammar } from "./grammar.js";
import { RdDItem } from "./item.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
const competenceTroncs = [["Esquive", "Dague", "Corps à corps"], const competenceTroncs = [["Esquive", "Dague", "Corps à corps"],
@ -24,12 +23,12 @@ const limitesArchetypes = [
]; ];
/* -------------------------------------------- */ /* -------------------------------------------- */
export const CATEGORIES_COMPETENCES = { const categoriesCompetences = {
"generale": { base: -4, label: "Générales" }, "generale": { base: -4, label: "Générales" },
"particuliere": { base: -8, label: "Particulières" }, "particuliere": { base: -8, label: "Particulières" },
"specialisee": { base: -11, label: "Spécialisées" }, "specialisee": { base: -11, label: "Spécialisées" },
"connaissance": { base: -11, label: "Connaissances" }, "connaissance": { base: -11, label: "Connaissances" },
"draconic": { base: -11, label: "Draconic" }, "draconic": { base: -11, label: "Draconics" },
"melee": { base: -6, label: "Mêlée" }, "melee": { base: -6, label: "Mêlée" },
"tir": { base: -8, label: "Tir" }, "tir": { base: -8, label: "Tir" },
"lancer": { base: -8, label: "Lancer" } "lancer": { base: -8, label: "Lancer" }
@ -50,13 +49,15 @@ const competence_xp_cumul = _buildCumulXP();
export class RdDItemCompetence extends Item { export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static getLabelCategorie(category) { static getCategories() {
return CATEGORIES_COMPETENCES[category].label; return categoriesCompetences;
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static getLabelCategorie(category) {
return categoriesCompetences[category].label;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static getNiveauBase(category, itemType) { static getNiveauBase(category, categories = categoriesCompetences) {
let categories = RdDItem.getCategories(itemType)
return categories[category]?.base ?? 0; return categories[category]?.base ?? 0;
} }
@ -190,7 +191,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */ /* -------------------------------------------- */
static isNiveauBase(item) { static isNiveauBase(item) {
return Number(item.system.niveau) == RdDItemCompetence.getNiveauBase(item.system.categorie, item.type); return Number(item.system.niveau) == RdDItemCompetence.getNiveauBase(item.system.categorie, item.getCategories());
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -2,7 +2,7 @@
import { ITEM_TYPES } from "./item.js"; import { ITEM_TYPES } from "./item.js";
import { RdDCombatManager } from "./rdd-combat.js"; import { RdDCombatManager } from "./rdd-combat.js";
export const CATEGORIES_COMPETENCES_CREATURES = { const categories = {
"generale": { base: 0, label: "Générale" }, "generale": { base: 0, label: "Générale" },
"naturelle": { base: 0, label: "Arme naturelle" }, "naturelle": { base: 0, label: "Arme naturelle" },
"melee": { base: 0, label: "Mêlée" }, "melee": { base: 0, label: "Mêlée" },
@ -15,6 +15,10 @@ export const CATEGORIES_COMPETENCES_CREATURES = {
/* -------------------------------------------- */ /* -------------------------------------------- */
export class RdDItemCompetenceCreature extends Item { export class RdDItemCompetenceCreature extends Item {
static getCategories() {
return categories;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
static setRollDataCreature(rollData) { static setRollDataCreature(rollData) {
rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.system.carac_value } } rollData.carac = { "carac_creature": { label: rollData.competence.name, value: rollData.competence.system.carac_value } }

View File

@ -12,7 +12,7 @@ import { SystemCompendiums } from "./settings/system-compendiums.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { RdDTimestamp } from "./time/rdd-timestamp.js"; import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
import { ITEM_TYPES, RdDItem } from "./item.js"; import { ITEM_TYPES } from "./item.js";
/** /**
* Extend the basic ItemSheet for RdD specific items * Extend the basic ItemSheet for RdD specific items
@ -107,7 +107,7 @@ export class RdDItemSheet extends ItemSheet {
} }
const competences = await SystemCompendiums.getCompetences('personnage'); const competences = await SystemCompendiums.getCompetences('personnage');
formData.categories = RdDItem.getCategories(this.item.type) formData.categories = this.item.getCategories()
if (this.item.type == 'tache' || this.item.type == 'livre' || this.item.type == 'meditation' || this.item.type == 'oeuvre') { if (this.item.type == 'tache' || this.item.type == 'livre' || this.item.type == 'meditation' || this.item.type == 'oeuvre') {
formData.caracList = foundry.utils.duplicate(game.model.Actor.personnage.carac) formData.caracList = foundry.utils.duplicate(game.model.Actor.personnage.carac)
formData.caracList["reve-actuel"] = foundry.utils.duplicate(game.model.Actor.personnage.reve.reve) formData.caracList["reve-actuel"] = foundry.utils.duplicate(game.model.Actor.personnage.reve.reve)
@ -258,7 +258,7 @@ export class RdDItemSheet extends ItemSheet {
if (this.item.isCompetence()) { if (this.item.isCompetence()) {
const categorie = event.currentTarget.value; const categorie = event.currentTarget.value;
const level = RdDItemCompetence.getNiveauBase(categorie, this.item.type); const level = RdDItemCompetence.getNiveauBase(categorie, this.item.getCategories());
this.item.system.base = level; this.item.system.base = level;
this.html.find('[name="system.base"]').val(level); this.html.find('[name="system.base"]').val(level);
} }

View File

@ -6,8 +6,8 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js";
import { RdDUtility } from "./rdd-utility.js"; import { RdDUtility } from "./rdd-utility.js";
import { SystemCompendiums } from "./settings/system-compendiums.js"; import { SystemCompendiums } from "./settings/system-compendiums.js";
import { RdDRaretes } from "./item/raretes.js"; import { RdDRaretes } from "./item/raretes.js";
import { CATEGORIES_COMPETENCES } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { CATEGORIES_COMPETENCES_CREATURES } from "./item-competencecreature.js"; import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
export const ACTOR_TYPES = { export const ACTOR_TYPES = {
personnage: 'personnage', personnage: 'personnage',
@ -172,11 +172,9 @@ export class RdDItem extends Item {
static getItemTypesInventaire(mode = 'materiel') { static getItemTypesInventaire(mode = 'materiel') {
return typesInventaire[mode ?? 'materiel'] return typesInventaire[mode ?? 'materiel']
} }
static getItemTypesDraconiques() { static getItemTypesDraconiques() {
return typesObjetsDraconiques; return typesObjetsDraconiques;
} }
static getItemTypesEnvironnement() { static getItemTypesEnvironnement() {
return typesEnvironnement; return typesEnvironnement;
} }
@ -185,16 +183,6 @@ export class RdDItem extends Item {
return typesObjetsOeuvres return typesObjetsOeuvres
} }
static getCategories(itemType) {
switch (itemType) {
case ITEM_TYPES.competence:
return CATEGORIES_COMPETENCES
case ITEM_TYPES.competencecreature:
return CATEGORIES_COMPETENCES_CREATURES
}
return {}
}
constructor(docData, context = {}) { constructor(docData, context = {}) {
if (!context.rdd?.ready) { if (!context.rdd?.ready) {
foundry.utils.mergeObject(context, { rdd: { ready: true } }); foundry.utils.mergeObject(context, { rdd: { ready: true } });
@ -274,6 +262,13 @@ export class RdDItem extends Item {
isPresentDansMilieux(milieux) { isPresentDansMilieux(milieux) {
return this.getEnvironnements(milieux).length > 0 return this.getEnvironnements(milieux).length > 0
} }
getCategories() {
switch (this.type) {
case ITEM_TYPES.competence: return RdDItemCompetence.getCategories()
case ITEM_TYPES.competencecreature: return RdDItemCompetenceCreature.getCategories()
}
return {}
}
getEnvironnements(milieux = undefined) { getEnvironnements(milieux = undefined) {
const environnements = this.isInventaire() ? this.system.environnement : undefined; const environnements = this.isInventaire() ? this.system.environnement : undefined;

View File

@ -534,7 +534,6 @@
}, },
"primaryTokenAttribute": "sante.vie", "primaryTokenAttribute": "sante.vie",
"secondaryTokenAttribute": "sante.endurance", "secondaryTokenAttribute": "sante.endurance",
"background": "systems/foundryvtt-reve-de-dragon/styles/img/reve-de-dragon-cover.webp",
"media": [ "media": [
{ {
"type": "icon", "type": "icon",

View File

@ -15,7 +15,6 @@
} }
}, },
"background": { "background": {
"metier": "",
"biographie": "Histoire personnelle...", "biographie": "Histoire personnelle...",
"notes": "Notes", "notes": "Notes",
"notesmj": "Notes du MJ", "notesmj": "Notes du MJ",

View File

@ -172,10 +172,6 @@
<label for="system.poids">Poids :</label> <label for="system.poids">Poids :</label>
<input class="flex-grow" type="text" name="system.poids" value="{{system.poids}}" data-dtype="String"/> <input class="flex-grow" type="text" name="system.poids" value="{{system.poids}}" data-dtype="String"/>
</li> </li>
<li class="item flexrow list-item">
<label for="system.metier">Métier :</label>
<input class="flex-grow" type="text" name="system.metier" value="{{system.metier}}" data-dtype="String"/>
</li>
</ul> </ul>
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
<li class="item flexrow list-item"> <li class="item flexrow list-item">