Compare commits
No commits in common. "a65326d658ffdacc41e8e616123b44a5133cd8d1" and "16e40b0ed84a7eec21073229b0ea1afcdb61eedd" have entirely different histories.
a65326d658
...
16e40b0ed8
@ -1,7 +1,4 @@
|
||||
# 12.0
|
||||
## 12.0.9 - Le scriptorium d'Astrobazzarh
|
||||
- ajout d'une fonction avancée pour exporter les personnages dans un format csv
|
||||
|
||||
## 12.0.8 - La quincaillerie d'Astrobazzarh
|
||||
- le propriétaire est indiqué dans les feuilles d'équipements/compétences/...
|
||||
- Ecaille d'efficacité
|
||||
|
@ -32,7 +32,7 @@ import { RdDItemBlessure } from "./item/blessure.js";
|
||||
import { AppAstrologie } from "./sommeil/app-astrologie.js";
|
||||
import { RdDEmpoignade } from "./rdd-empoignade.js";
|
||||
import { ExperienceLog, XP_TOPIC } from "./actor/experience-log.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
import { RdDBaseActorSang } from "./actor/base-actor-sang.js";
|
||||
import { RdDCoeur } from "./coeur/rdd-coeur.js";
|
||||
import { DialogChoixXpCarac } from "./dialog-choix-xp-carac.js";
|
||||
@ -92,7 +92,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
canReceive(item) {
|
||||
return ![ITEM_TYPES.competencecreature, ITEM_TYPES.tarot, ITEM_TYPES.service].includes(item.type)
|
||||
return ![TYPES.competencecreature, TYPES.tarot, TYPES.service].includes(item.type)
|
||||
}
|
||||
|
||||
isPersonnageJoueur() {
|
||||
@ -125,7 +125,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getMalusArmure() {
|
||||
return this.itemTypes[ITEM_TYPES.armure].filter(it => it.system.equipe)
|
||||
return this.itemTypes[TYPES.armure].filter(it => it.system.equipe)
|
||||
.map(it => it.system.malus)
|
||||
.reduce(Misc.sum(), 0);
|
||||
}
|
||||
@ -142,7 +142,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getDemiReve() { return this.system.reve.tmrpos.coord }
|
||||
getDraconicList() { return this.itemTypes[ITEM_TYPES.competence].filter(it => it.system.categorie == 'draconic') }
|
||||
getDraconicList() { return this.itemTypes[TYPES.competence].filter(it => it.system.categorie == 'draconic') }
|
||||
getBestDraconic() { return foundry.utils.duplicate(this.getDraconicList().sort(Misc.descending(it => it.system.niveau)).find(it => true)) }
|
||||
getDraconicOuPossession() {
|
||||
return [...this.getDraconicList().filter(it => it.system.niveau >= 0),
|
||||
@ -153,7 +153,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $perteRevePotionsEnchantees() {
|
||||
let potions = this.itemTypes[ITEM_TYPES.potion]
|
||||
let potions = this.itemTypes[TYPES.potion]
|
||||
.filter(it => Grammar.includesLowerCaseNoAccent(it.system.categorie, 'enchanté') && !it.system.prpermanent)
|
||||
|
||||
const potionUpdates = await Promise.all(potions.map(async it => {
|
||||
@ -345,7 +345,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async _recupererBlessures(message, isMaladeEmpoisonne) {
|
||||
const timestamp = game.system.rdd.calendrier.getTimestamp()
|
||||
const blessures = this.filterItems(it => it.system.gravite > 0, ITEM_TYPES.blessure).sort(Misc.ascending(it => it.system.gravite))
|
||||
const blessures = this.filterItems(it => it.system.gravite > 0, TYPES.blessure).sort(Misc.ascending(it => it.system.gravite))
|
||||
|
||||
await Promise.all(blessures.map(async b => b.recuperationBlessure({
|
||||
actor: this,
|
||||
@ -361,7 +361,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async _recupererVie(message, isMaladeEmpoisonne) {
|
||||
const tData = this.system
|
||||
let blessures = this.filterItems(it => it.system.gravite > 0, ITEM_TYPES.blessure);
|
||||
let blessures = this.filterItems(it => it.system.gravite > 0, TYPES.blessure);
|
||||
if (blessures.length > 0) {
|
||||
return
|
||||
}
|
||||
@ -636,7 +636,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async sortMisEnReserve(sort, draconic, coord, ptreve) {
|
||||
await this.createEmbeddedDocuments("Item", [{
|
||||
type: ITEM_TYPES.sortreserve,
|
||||
type: TYPES.sortreserve,
|
||||
name: sort.name,
|
||||
img: sort.img,
|
||||
system: { sortid: sort._id, draconic: (draconic?.name ?? sort.system.draconic), ptreve: ptreve, coord: coord, heurecible: 'Vaisseau' }
|
||||
@ -991,24 +991,24 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
buildTMRInnaccessible() {
|
||||
return this.items.filter(it => it.type == ITEM_TYPES.casetmr).filter(it => EffetsDraconiques.isInnaccessible(it)).map(it => it.system.coord)
|
||||
return this.items.filter(it => it.type == TYPES.casetmr).filter(it => EffetsDraconiques.isInnaccessible(it)).map(it => it.system.coord)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getRencontresTMR() {
|
||||
return this.itemTypes[ITEM_TYPES.rencontre];
|
||||
return this.itemTypes[TYPES.rencontre];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async deleteRencontreTMRAtPosition() {
|
||||
const rencontreIds = this.itemTypes[ITEM_TYPES.rencontre].filter(this.filterRencontreTMRDemiReve()).map(it => it.id)
|
||||
const rencontreIds = this.itemTypes[TYPES.rencontre].filter(this.filterRencontreTMRDemiReve()).map(it => it.id)
|
||||
if (rencontreIds.length > 0) {
|
||||
await this.deleteEmbeddedDocuments('Item', rencontreIds)
|
||||
}
|
||||
}
|
||||
|
||||
getRencontreTMREnAttente() {
|
||||
return this.itemTypes[ITEM_TYPES.rencontre].find(this.filterRencontreTMRDemiReve())
|
||||
return this.itemTypes[TYPES.rencontre].find(this.filterRencontreTMRDemiReve())
|
||||
}
|
||||
|
||||
filterRencontreTMRDemiReve() {
|
||||
@ -1160,11 +1160,11 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (result) { return result }
|
||||
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.potion: return await this.consommerPotion(item, onActionItem);
|
||||
case ITEM_TYPES.livre: return await this.actionLire(item);
|
||||
case ITEM_TYPES.conteneur: return await item.sheet.render(true);
|
||||
case ITEM_TYPES.herbe: return await this.actionHerbe(item, onActionItem);
|
||||
case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return await this.actionRefoulement(item);
|
||||
case TYPES.potion: return await this.consommerPotion(item, onActionItem);
|
||||
case TYPES.livre: return await this.actionLire(item);
|
||||
case TYPES.conteneur: return await item.sheet.render(true);
|
||||
case TYPES.herbe: return await this.actionHerbe(item, onActionItem);
|
||||
case TYPES.queue: case TYPES.ombre: return await this.actionRefoulement(item);
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
@ -1559,7 +1559,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
xpData
|
||||
})
|
||||
if (hideChatMessage) {
|
||||
ChatUtility.blindMessageToGM({ content: content })
|
||||
ChatUtility.blindMessageToGM({ content: content });
|
||||
}
|
||||
else {
|
||||
ChatMessage.create({
|
||||
@ -1826,7 +1826,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
blessuresASoigner() {
|
||||
return (this.itemTypes[ITEM_TYPES.blessure])
|
||||
return (this.itemTypes[TYPES.blessure])
|
||||
.filter(it => it.system.gravite > 0 && it.system.gravite <= 6)
|
||||
.filter(it => !(it.system.premierssoins.done && it.system.soinscomplets.done))
|
||||
.sort(Misc.descending(b => (b.system.premierssoins.done ? "A" : "B") + b.system.gravite))
|
||||
@ -3065,7 +3065,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
async nouvelleIncarnation() {
|
||||
let incarnation = this.toObject();
|
||||
|
||||
incarnation.items = Array.from(this.items.filter(it => it.type == ITEM_TYPES.competence),
|
||||
incarnation.items = Array.from(this.items.filter(it => it.type == TYPES.competence),
|
||||
it => {
|
||||
it = it.toObject();
|
||||
it.id = undefined;
|
||||
|
@ -12,7 +12,7 @@ import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
import { RdDBaseActor } from "./base-actor.js";
|
||||
import { RdDItemCompetenceCreature } from "../item-competencecreature.js";
|
||||
import { StatusEffects } from "../settings/status-effects.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { TYPES } from "../item.js";
|
||||
import { Targets } from "../targets.js";
|
||||
import { RdDPossession } from "../rdd-possession.js";
|
||||
import { RdDCombat } from "../rdd-combat.js";
|
||||
@ -108,14 +108,14 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
|
||||
async $finDeRoundSupprimerObsoletes() {
|
||||
const obsoletes = []
|
||||
.concat(this.itemTypes[ITEM_TYPES.empoignade].filter(it => it.system.pointsemp <= 0))
|
||||
.concat(this.itemTypes[ITEM_TYPES.possession].filter(it => it.system.compteur < -2 || it.system.compteur > 2))
|
||||
.concat(this.itemTypes[TYPES.empoignade].filter(it => it.system.pointsemp <= 0))
|
||||
.concat(this.itemTypes[TYPES.possession].filter(it => it.system.compteur < -2 || it.system.compteur > 2))
|
||||
.map(it => it.id);
|
||||
await this.deleteEmbeddedDocuments('Item', obsoletes);
|
||||
}
|
||||
|
||||
async $finDeRoundEmpoignade() {
|
||||
const immobilisations = this.itemTypes[ITEM_TYPES.empoignade].filter(it => it.system.pointsemp >= 2 && it.system.empoigneurid == this.id);
|
||||
const immobilisations = this.itemTypes[TYPES.empoignade].filter(it => it.system.pointsemp >= 2 && it.system.empoigneurid == this.id);
|
||||
immobilisations.forEach(emp => RdDEmpoignade.onImmobilisation(this,
|
||||
game.actors.get(emp.system.empoigneid),
|
||||
emp
|
||||
@ -151,13 +151,13 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
}
|
||||
|
||||
getPossession(possessionId) {
|
||||
return this.itemTypes[ITEM_TYPES.possession].find(it => it.system.possessionid == possessionId);
|
||||
return this.itemTypes[TYPES.possession].find(it => it.system.possessionid == possessionId);
|
||||
}
|
||||
getPossessions() {
|
||||
return this.itemTypes[ITEM_TYPES.possession];
|
||||
return this.itemTypes[TYPES.possession];
|
||||
}
|
||||
getEmpoignades() {
|
||||
return this.itemTypes[ITEM_TYPES.empoignade];
|
||||
return this.itemTypes[TYPES.empoignade];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -322,7 +322,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||
const competence = this.getCompetence(idOrName);
|
||||
let rollData = { carac: this.system.carac, competence: competence, arme: options.arme }
|
||||
if (competence.type == ITEM_TYPES.competencecreature) {
|
||||
if (competence.type == TYPES.competencecreature) {
|
||||
const arme = RdDItemCompetenceCreature.armeCreature(competence)
|
||||
if (arme && options.tryTarget && Targets.hasTargets()) {
|
||||
Targets.selectOneToken(target => {
|
||||
@ -396,7 +396,19 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
}
|
||||
|
||||
$getCompetenceArme(arme, competenceName) {
|
||||
return RdDItemArme.getCompetenceArme(arme, competenceName)
|
||||
switch (arme.type) {
|
||||
case TYPES.competencecreature:
|
||||
return arme.name
|
||||
case TYPES.arme:
|
||||
switch (competenceName) {
|
||||
case 'competence': return arme.system.competence;
|
||||
case 'unemain': return RdDItemArme.competence1Mains(arme);
|
||||
case 'deuxmains': return RdDItemArme.competence2Mains(arme);
|
||||
case 'tir': return arme.system.tir;
|
||||
case 'lancer': return arme.system.lancer;
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
verifierForceMin(item) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { MAX_ENDURANCE_FATIGUE, RdDUtility } from "../rdd-utility.js";
|
||||
import { ReglesOptionnelles } from "../settings/regles-optionnelles.js";
|
||||
import { STATUSES } from "../settings/status-effects.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { TYPES } from "../item.js";
|
||||
import { RdDBaseActorReve } from "./base-actor-reve.js";
|
||||
import { RdDDice } from "../rdd-dice.js";
|
||||
import { RdDItemBlessure } from "../item/blessure.js";
|
||||
@ -50,9 +50,9 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
||||
|
||||
isDead() { return this.system.sante.vie.value < -this.getSConst() }
|
||||
|
||||
nbBlessuresLegeres() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isLegere()).length }
|
||||
nbBlessuresGraves() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isGrave()).length }
|
||||
nbBlessuresCritiques() { return this.itemTypes[ITEM_TYPES.blessure].filter(it => it.isCritique()).length }
|
||||
nbBlessuresLegeres() { return this.itemTypes[TYPES.blessure].filter(it => it.isLegere()).length }
|
||||
nbBlessuresGraves() { return this.itemTypes[TYPES.blessure].filter(it => it.isGrave()).length }
|
||||
nbBlessuresCritiques() { return this.itemTypes[TYPES.blessure].filter(it => it.isCritique()).length }
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeResumeBlessure() {
|
||||
@ -197,7 +197,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
||||
}
|
||||
|
||||
async supprimerBlessures(filterToDelete) {
|
||||
const toDelete = this.filterItems(filterToDelete, ITEM_TYPES.blessure)
|
||||
const toDelete = this.filterItems(filterToDelete, TYPES.blessure)
|
||||
.map(it => it.id);
|
||||
await this.deleteEmbeddedDocuments('Item', toDelete);
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { Misc } from "../misc.js";
|
||||
import { DialogSplitItem } from "../dialog-split-item.js";
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
import { Monnaie } from "../item-monnaie.js";
|
||||
import { RdDItem, ITEM_TYPES } from "../item.js";
|
||||
import { RdDItem, TYPES } from "../item.js";
|
||||
import { RdDItemCompetenceCreature } from "../item-competencecreature.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -51,7 +51,7 @@ export class RdDBaseActorSheet extends ActorSheet {
|
||||
this.objetVersConteneur = RdDUtility.buildArbreDeConteneurs(formData.conteneurs, formData.inventaires);
|
||||
this._appliquerRechercheObjets(formData.conteneurs, formData.inventaires);
|
||||
formData.conteneurs = RdDUtility.conteneursRacine(formData.conteneurs);
|
||||
formData.competences.filter(it => it.type == ITEM_TYPES.competencecreature)
|
||||
formData.competences.filter(it => it.type == TYPES.competencecreature)
|
||||
.forEach(it => it.isdommages = RdDItemCompetenceCreature.isDommages(it))
|
||||
return formData;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { ChatUtility } from "../chat-utility.js";
|
||||
import { SYSTEM_SOCKET_ID } from "../constants.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { Monnaie } from "../item-monnaie.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { TYPES } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDAudio } from "../rdd-audio.js";
|
||||
import { RdDConfirm } from "../rdd-confirm.js";
|
||||
@ -704,7 +704,7 @@ export class RdDBaseActor extends Actor {
|
||||
|
||||
async actionPrincipale(item, onActionItem = async () => { }) {
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.conteneur: return await item.sheet.render(true);
|
||||
case TYPES.conteneur: return await item.sheet.render(true);
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ENTITE_INCARNE } from "../constants.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { TYPES } from "../item.js";
|
||||
import { STATUSES } from "../settings/status-effects.js";
|
||||
import { RdDBaseActorSang } from "./base-actor-sang.js";
|
||||
|
||||
@ -12,7 +12,7 @@ export class RdDCreature extends RdDBaseActorSang {
|
||||
isCreature() { return true }
|
||||
|
||||
canReceive(item) {
|
||||
return item.type == ITEM_TYPES.competencecreature || item.isInventaire();
|
||||
return item.type == TYPES.competencecreature || item.isInventaire();
|
||||
}
|
||||
|
||||
async remiseANeuf() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ENTITE_INCARNE, ENTITE_NONINCARNE } from "../constants.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { TYPES } from "../item.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDEncaisser } from "../rdd-roll-encaisser.js";
|
||||
import { STATUSES } from "../settings/status-effects.js";
|
||||
@ -12,7 +12,7 @@ export class RdDEntite extends RdDBaseActorReve {
|
||||
}
|
||||
|
||||
canReceive(item) {
|
||||
return item.type == ITEM_TYPES.competencecreature
|
||||
return item.type == TYPES.competencecreature
|
||||
}
|
||||
|
||||
isEntite(typeentite = []) {
|
||||
@ -29,7 +29,7 @@ export class RdDEntite extends RdDBaseActorReve {
|
||||
getChance() { return this.getReve() }
|
||||
|
||||
getDraconicOuPossession() {
|
||||
return this.itemTypes[ITEM_TYPES.competencecreature]
|
||||
return this.itemTypes[TYPES.competencecreature]
|
||||
.filter(it => it.system.categorie == 'possession')
|
||||
.sort(Misc.descending(it => it.system.niveau))
|
||||
.find(it => true);
|
||||
|
@ -1,78 +0,0 @@
|
||||
import { LOG_HEAD } from "../../constants.js"
|
||||
import { ACTOR_TYPES } from "../../item.js"
|
||||
import { Misc } from "../../misc.js"
|
||||
import { EXPORT_CSV_SCRIPTARIUM, OptionsAvancees } from "../../settings/options-avancees.js"
|
||||
import { Mapping } from "./mapping.js"
|
||||
|
||||
const IMG_SCRIPTARIUM = '<img class="context-menu-img" src="systems/foundryvtt-reve-de-dragon/styles/img/ui/scriptarium.svg">'
|
||||
|
||||
export class ExportScriptarium {
|
||||
|
||||
static init() {
|
||||
ExportScriptarium.INSTANCE = new ExportScriptarium()
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.mapping = Mapping.getMapping()
|
||||
Hooks.on("getActorDirectoryFolderContext", (actorDirectory, menus) => { ExportScriptarium.INSTANCE.onActorDirectoryMenu(actorDirectory, menus) })
|
||||
Hooks.on("getActorDirectoryEntryContext", (actorDirectory, menus) => { ExportScriptarium.INSTANCE.onActorDirectoryMenu(actorDirectory, menus) })
|
||||
}
|
||||
|
||||
onActorDirectoryMenu(actorDirectory, menus) {
|
||||
menus.push({
|
||||
name: 'Export Personnages',
|
||||
icon: IMG_SCRIPTARIUM,
|
||||
condition: (target) => game.user.isGM &&
|
||||
OptionsAvancees.isUsing(EXPORT_CSV_SCRIPTARIUM) &&
|
||||
this.$getActors(actorDirectory, target).length > 0,
|
||||
callback: target => this.exportActors(this.$getActors(actorDirectory, target), this.$getTargetName(actorDirectory, target))
|
||||
})
|
||||
}
|
||||
$getTargetName(actorDirectory, target) {
|
||||
const li = target.closest(".directory-item")
|
||||
const folderId = li.data("folderId")
|
||||
const actorId = li.data("documentId")
|
||||
return actorId
|
||||
? game.actors.get(actorId).name
|
||||
: actorDirectory.folders.find(it => it.id == folderId).name
|
||||
}
|
||||
$getActors(actorDirectory, target) {
|
||||
const li = target.closest(".directory-item")
|
||||
const folderId = li.data("folderId")
|
||||
const actorId = li.data("documentId")
|
||||
const actors = actorId
|
||||
? [game.actors.get(actorId)]
|
||||
: folderId
|
||||
? actorDirectory.folders.find(it => it.id == folderId).contents
|
||||
: []
|
||||
return actors.filter(it => it.type == ACTOR_TYPES.personnage)
|
||||
}
|
||||
|
||||
exportActors(actors, targetName) {
|
||||
const eol = '\n\r'
|
||||
const header = Misc.join(this.getHeaderLine(), ';')
|
||||
const actorLines = actors.map(actor => Misc.join(this.getActorLine(actor), ';'))
|
||||
const data = Misc.join([header, ...actorLines], eol)
|
||||
const filename = `scriptatium-${targetName?.slugify()}.csv`;
|
||||
saveDataToFile(data, "text/csv", `${filename}`);
|
||||
}
|
||||
|
||||
getHeaderLine() {
|
||||
return this.mapping.map(it => it.column)
|
||||
}
|
||||
|
||||
getActorLine(actor) {
|
||||
const context = Mapping.prepareContext(actor)
|
||||
return this.mapping.map(it => it.getter(actor, context))
|
||||
.map(it => this.$escapeQuotes(it))
|
||||
.map(it => it.replaceAll("\n", " ").replaceAll("\r", ""))
|
||||
}
|
||||
|
||||
$escapeQuotes(it) {
|
||||
it = '' + it
|
||||
if (it.includes('"') || it.includes(';')) {
|
||||
return `"${it.replaceAll('"', '\\"')}"`
|
||||
}
|
||||
return it
|
||||
}
|
||||
}
|
@ -1,303 +0,0 @@
|
||||
import { Grammar } from "../../grammar.js"
|
||||
import { RdDItemArme } from "../../item-arme.js"
|
||||
import { RdDItemCompetence } from "../../item-competence.js"
|
||||
import { RdDItemSort } from "../../item-sort.js"
|
||||
import { ITEM_TYPES } from "../../item.js"
|
||||
import { Misc } from "../../misc.js"
|
||||
import { RdDTimestamp } from "../../time/rdd-timestamp.js"
|
||||
import { TMRConstants } from "../../tmr-constants.js"
|
||||
import { TMRUtility } from "../../tmr-utility.js"
|
||||
|
||||
const CATEGORIES_COMPETENCES = [
|
||||
"generale",
|
||||
"particuliere",
|
||||
"specialisee",
|
||||
"connaissance",
|
||||
]
|
||||
const CATEGORIES_DRACONIC = [
|
||||
"draconic",
|
||||
]
|
||||
|
||||
const CATEGORIES_COMBAT = [
|
||||
"melee",
|
||||
"tir",
|
||||
"lancer"
|
||||
]
|
||||
|
||||
const NIVEAU_BASE = {
|
||||
"generale": -4,
|
||||
"particuliere": -8,
|
||||
"specialisee": -11,
|
||||
"connaissance": -11,
|
||||
"draconic": -11,
|
||||
"melee": -6,
|
||||
"tir": -8,
|
||||
"lancer": -8,
|
||||
}
|
||||
|
||||
class ColumnMappingFactory {
|
||||
static createMappingArme(part, i) {
|
||||
return { column: `arme-${part}-${i}`, getter: (actor, context) => Mapping.getArme(actor, context, part, i) }
|
||||
}
|
||||
|
||||
static createMappingSort(part, i) {
|
||||
return { column: `sort-${part}-${i}`, getter: (actor, context) => Mapping.getSort(actor, context, part, i) }
|
||||
}
|
||||
}
|
||||
|
||||
const NB_ARMES = 10
|
||||
const NB_SORTS = 20
|
||||
const TABLEAU_ARMES = [...Array(NB_ARMES).keys()]
|
||||
const TABLEAU_SORTS = [...Array(NB_SORTS).keys()]
|
||||
|
||||
const MAPPING_BASE = [
|
||||
{ column: "ID", getter: (actor, context) => actor.id },
|
||||
{ column: "name", getter: (actor, context) => actor.name },
|
||||
// { column: "biographie", getter: (actor, context) => actor.system.biographie },
|
||||
{ column: "taille", getter: (actor, context) => actor.system.carac.taille.value },
|
||||
{ column: "apparence", getter: (actor, context) => actor.system.carac.apparence.value },
|
||||
{ column: "constitution", getter: (actor, context) => actor.system.carac.constitution.value },
|
||||
{ column: "force", getter: (actor, context) => actor.system.carac.force.value },
|
||||
{ column: "agilite", getter: (actor, context) => actor.system.carac.agilite.value },
|
||||
{ column: "dexterite", getter: (actor, context) => actor.system.carac.dexterite.value },
|
||||
{ column: "vue", getter: (actor, context) => actor.system.carac.vue.value },
|
||||
{ column: "ouie", getter: (actor, context) => actor.system.carac.ouie.value },
|
||||
{ column: "odoratgout", getter: (actor, context) => actor.system.carac.odoratgout.value },
|
||||
{ column: "volonte", getter: (actor, context) => actor.system.carac.volonte.value },
|
||||
{ column: "intellect", getter: (actor, context) => actor.system.carac.intellect.value },
|
||||
{ column: "empathie", getter: (actor, context) => actor.system.carac.empathie.value },
|
||||
{ column: "reve", getter: (actor, context) => actor.system.carac.reve.value },
|
||||
{ column: "chance", getter: (actor, context) => actor.system.carac.chance.value },
|
||||
{ column: "melee", getter: (actor, context) => actor.system.carac.melee.value },
|
||||
{ column: "tir", getter: (actor, context) => actor.system.carac.tir.value },
|
||||
{ column: "lancer", getter: (actor, context) => actor.system.carac.lancer.value },
|
||||
{ column: "derobee", getter: (actor, context) => actor.system.carac.derobee.value },
|
||||
{ column: "vie", getter: (actor, context) => actor.system.sante.vie.max },
|
||||
{ column: "plusdom", getter: (actor, context) => actor.system.attributs.plusdom.value },
|
||||
{ column: "protectionnaturelle", getter: (actor, context) => actor.system.attributs.protection.value },
|
||||
{ column: "endurance", getter: (actor, context) => actor.system.sante.endurance.max },
|
||||
{ column: "description", getter: (actor, context) => Mapping.getDescription(actor) },
|
||||
{ column: "armure", getter: (actor, context) => Mapping.getArmure(actor, context) },
|
||||
{ column: "protection", getter: (actor, context) => Mapping.getProtectionArmure(actor, context) },
|
||||
{ column: "malus-armure", getter: (actor, context) => Mapping.getMalusArmure(actor, context) },
|
||||
{ column: "esquive", getter: (actor, context) => Mapping.getEsquive(actor, context) },
|
||||
{ column: "esquive-niv", getter: (actor, context) => Mapping.getEsquiveNiveau(context) },
|
||||
{ column: "competences", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_COMPETENCES) },
|
||||
{ column: "draconic", getter: (actor, context) => Mapping.getCompetences(actor, CATEGORIES_DRACONIC) },
|
||||
]
|
||||
|
||||
const MAPPING_ARMES = TABLEAU_ARMES.map(i => ColumnMappingFactory.createMappingArme('name', i))
|
||||
.concat(TABLEAU_ARMES.map(i => ColumnMappingFactory.createMappingArme('niveau', i)))
|
||||
.concat(TABLEAU_ARMES.map(i => ColumnMappingFactory.createMappingArme('init', i)))
|
||||
.concat(TABLEAU_ARMES.map(i => ColumnMappingFactory.createMappingArme('dom', i)))
|
||||
const MAPPING_SORTS = TABLEAU_SORTS.map(i => ColumnMappingFactory.createMappingSort('voie', i))
|
||||
.concat(TABLEAU_SORTS.map(i => ColumnMappingFactory.createMappingSort('description', i)))
|
||||
.concat(TABLEAU_SORTS.map(i => ColumnMappingFactory.createMappingSort('bonus', i)))
|
||||
const MAPPING = MAPPING_BASE
|
||||
.concat(MAPPING_ARMES)
|
||||
.concat(MAPPING_SORTS)
|
||||
|
||||
export class Mapping {
|
||||
|
||||
static getMapping() {
|
||||
return MAPPING
|
||||
}
|
||||
|
||||
static prepareContext(actor) {
|
||||
return {
|
||||
armes: Mapping.prepareArmes(actor),
|
||||
armure: Mapping.prepareArmure(actor),
|
||||
esquive: Mapping.prepareEsquive(actor),
|
||||
sorts: Mapping.prepareSorts(actor)
|
||||
}
|
||||
}
|
||||
|
||||
static prepareArmes(actor) {
|
||||
return actor.items.filter(it => it.type == ITEM_TYPES.arme)
|
||||
.map(arme => {
|
||||
const compToUse = RdDItemArme.getCompetenceArme(arme, 'competence');
|
||||
const comp = actor.getCompetence(compToUse);
|
||||
const bonusDom = Mapping.calculBonusDom(comp, actor)
|
||||
return {
|
||||
name: arme.name,
|
||||
niveau: comp.system.niveau,
|
||||
init: Mapping.calculBaseInit(actor, comp.system.categorie) + comp.system.niveau,
|
||||
dom: Number(arme.system.dommages) + bonusDom
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
static calculBonusDom(comp, actor) {
|
||||
// TODO: reuse dmg calc?
|
||||
const appliesBonusDom = ['melee', 'lancer'].includes(comp.system.categorie)
|
||||
return appliesBonusDom ? Number(actor.system.attributs.plusdom.value) : 0
|
||||
}
|
||||
|
||||
static calculBaseInit(actor, categorie) {
|
||||
// TODO: reuse init calc?
|
||||
const mapping = MAPPING_BASE.find(it => it.column == categorie)
|
||||
if (mapping) {
|
||||
switch (categorie) {
|
||||
case 'melee':
|
||||
case 'tir':
|
||||
case 'lancer':
|
||||
const caracteristique = Number(actor.system.carac[categorie].value)
|
||||
return Math.floor(caracteristique / 2)
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
static prepareArmure(actor) {
|
||||
const armures = actor.itemTypes[ITEM_TYPES.armure].filter(it => it.system.equipe)
|
||||
if (armures.length > 1) {
|
||||
console.warn(`${actor.name} a équipé ${armures.length} armures, seule la première sera considérée`)
|
||||
}
|
||||
if (armures.length > 0) {
|
||||
const armure = armures[0]
|
||||
return {
|
||||
name: armure.name,
|
||||
protection: armure.system.protection,
|
||||
malus: armure.system.malus ?? 0
|
||||
}
|
||||
}
|
||||
return {
|
||||
name: '',
|
||||
protection: actor.system.attributs.protection.value,
|
||||
malus: 0
|
||||
}
|
||||
}
|
||||
|
||||
static prepareEsquive(actor) {
|
||||
const esquives = actor.getCompetences("Esquive")
|
||||
if (esquives.length > 0) {
|
||||
const esquive = esquives[0]
|
||||
return {
|
||||
name: esquive.name,
|
||||
niveau: esquive.system.niveau
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
static prepareSorts(actor) {
|
||||
return actor.itemTypes[ITEM_TYPES.sort].map(it => {
|
||||
return {
|
||||
voie: it.system.voie,
|
||||
description: Mapping.descriptionSort(it),
|
||||
bonus: Mapping.bonusCase(it)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static descriptionSort(sort) {
|
||||
const ptSeuil = Array(sort.system.coutseuil).map(it => '*')
|
||||
const caseTMR = sort.system.caseTMRspeciale.length > 0 ? sort.system.caseTMRspeciale : sort.system.caseTMR
|
||||
return `${sort.name}${ptSeuil} (${caseTMR}) R${sort.system.difficulte} r${sort.system.ptreve}`
|
||||
}
|
||||
|
||||
static bonusCase(sort) {
|
||||
const list = RdDItemSort.buildBonusCaseList(sort.system.bonuscase, false).sort(Misc.descending(it => it.bonus))
|
||||
if (list.length > 0) {
|
||||
const bonus = list[0]
|
||||
return `+${bonus.bonus}% en ${bonus.case}`
|
||||
}
|
||||
}
|
||||
|
||||
static getDescription(actor) {
|
||||
const sexe = actor.system.sexe
|
||||
const sexeFeminin = sexe.length > 0 && sexe.charAt(0).toLowerCase() == 'f' ? 'Née' : 'Né'
|
||||
const race = ['', 'humain'].includes(Grammar.toLowerCaseNoAccent(actor.system.race)) ? '' : (actor.system.race + ' ')
|
||||
const heure = actor.system.heure
|
||||
const hn = `${sexeFeminin} à l'heure ${RdDTimestamp.definition(heure).avecArticle}`
|
||||
const age = actor.system.age ? `${actor.system.age} ans` : undefined
|
||||
const taille = actor.system.taille
|
||||
const poids = actor.system.poids
|
||||
const cheveux = actor.system.cheveux ? `cheveux ${actor.system.cheveux}` : undefined
|
||||
const yeux = actor.system.yeux ? `yeux ${actor.system.yeux}` : undefined
|
||||
const beaute = actor.system.beaute ? `Beauté ${actor.system.beaute}` : undefined
|
||||
const list = [race, hn, age, taille, poids, cheveux, yeux, beaute]
|
||||
return Misc.join(list.filter(it => it), ', ')
|
||||
}
|
||||
|
||||
static getArmure(actor, context) {
|
||||
return context.armure?.name ?? ''
|
||||
}
|
||||
|
||||
static getProtectionArmure(actor, context) {
|
||||
return Number(context?.armure?.protection ?? 0) + Number(actor.system.attributs.protection.value)
|
||||
}
|
||||
|
||||
static getMalusArmure(actor, context) {
|
||||
return context?.armure?.malus ?? 0
|
||||
}
|
||||
|
||||
static getEsquive(actor, context) {
|
||||
return context.esquive?.name ?? ''
|
||||
}
|
||||
|
||||
static getEsquiveNiveau(context) {
|
||||
if (context.esquive) {
|
||||
const niveau = context.esquive.niveau + context.armure.malus
|
||||
return niveau > 0 ? ('+' + niveau) : ('' + niveau)
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
static getCompetences(actor, categories) {
|
||||
const competences = Mapping.getCompetencesCategorie(actor, categories)
|
||||
if (competences.length == 0) {
|
||||
return ''
|
||||
}
|
||||
const byCartegories = Mapping.competencesByCategoriesByNiveau(competences, categories)
|
||||
const txtByCategories = Object.values(byCartegories)
|
||||
.map(it => it.competencesParNiveau)
|
||||
.map(byNiveau => {
|
||||
const niveaux = Object.keys(byNiveau).map(it => Number(it)).sort(Misc.ascending())
|
||||
if (niveaux.length == 0) {
|
||||
return ''
|
||||
}
|
||||
const txtCategorieByNiveau = niveaux.map(niveau => {
|
||||
const names = Misc.join(byNiveau[niveau].map(it => it.name).sort(Misc.ascending()), ', ')
|
||||
return names + ': ' + Misc.toSignedString(niveau)
|
||||
}
|
||||
)
|
||||
const txtCategorie = Misc.join(txtCategorieByNiveau, ' / ')
|
||||
return txtCategorie
|
||||
}).filter(it => it != '')
|
||||
|
||||
return Misc.join(txtByCategories, ' / ')
|
||||
}
|
||||
|
||||
static competencesByCategoriesByNiveau(competences, categories) {
|
||||
return categories.map(c => {
|
||||
return {
|
||||
categorie: c,
|
||||
competencesParNiveau: Misc.classify(
|
||||
competences.filter(comp => comp.system.categorie == c),
|
||||
comp => comp.system.niveau)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
static getArme(actor, context, part, numero) {
|
||||
if (numero < context.armes.length) {
|
||||
return context.armes[numero][part] ?? ''
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
static getCompetencesCategorie(actor, categories) {
|
||||
return actor.itemTypes[ITEM_TYPES.competence]
|
||||
.filter(it => categories.includes(it.system.categorie))
|
||||
.filter(it => !RdDItemCompetence.isNiveauBase(it))
|
||||
}
|
||||
|
||||
static getSort(actor, context, part, numero) {
|
||||
if (numero < context.sorts.length) {
|
||||
return context.sorts[numero][part]
|
||||
}
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js"
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
import { RdDCombatManager } from "./rdd-combat.js";
|
||||
|
||||
const nomCategorieParade = {
|
||||
@ -20,35 +20,19 @@ const nomCategorieParade = {
|
||||
export class RdDItemArme extends Item {
|
||||
|
||||
static isArme(item) {
|
||||
return item.type == ITEM_TYPES.arme || RdDItemCompetenceCreature.getCategorieAttaque(item);
|
||||
return item.type == TYPES.arme || RdDItemCompetenceCreature.getCategorieAttaque(item);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getArme(arme) {
|
||||
switch (arme ? arme.type : '') {
|
||||
case ITEM_TYPES.arme: return arme;
|
||||
case ITEM_TYPES.competencecreature:
|
||||
case TYPES.arme: return arme;
|
||||
case TYPES.competencecreature:
|
||||
return RdDItemCompetenceCreature.armeCreature(arme);
|
||||
}
|
||||
return RdDItemArme.mainsNues();
|
||||
}
|
||||
|
||||
static getCompetenceArme(arme, competenceName) {
|
||||
switch (arme.type) {
|
||||
case ITEM_TYPES.competencecreature:
|
||||
return arme.name
|
||||
case ITEM_TYPES.arme:
|
||||
switch (competenceName) {
|
||||
case 'competence': return arme.system.competence;
|
||||
case 'unemain': return RdDItemArme.competence1Mains(arme);
|
||||
case 'deuxmains': return RdDItemArme.competence2Mains(arme);
|
||||
case 'tir': return arme.system.tir;
|
||||
case 'lancer': return arme.system.lancer;
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
static computeNiveauArmes(armes, competences) {
|
||||
for (const arme of armes) {
|
||||
arme.system.niveau = RdDItemArme.niveauCompetenceArme(arme, competences);
|
||||
@ -84,14 +68,14 @@ export class RdDItemArme extends Item {
|
||||
return armeData.system.categorie_parade;
|
||||
}
|
||||
// pour compatibilité avec des personnages existants
|
||||
if (armeData.type == ITEM_TYPES.competencecreature || armeData.system.categorie == 'creature') {
|
||||
if (armeData.type == TYPES.competencecreature || armeData.system.categorie == 'creature') {
|
||||
return armeData.system.categorie_parade || (armeData.system.isparade ? 'armes-naturelles' : '');
|
||||
}
|
||||
if (!armeData.type.match(/arme|competencecreature/)) {
|
||||
return '';
|
||||
}
|
||||
if (armeData.system.competence == undefined) {
|
||||
return ITEM_TYPES.competencecreature;
|
||||
return TYPES.competencecreature;
|
||||
}
|
||||
let compname = armeData.system.competence.toLowerCase();
|
||||
if (compname.match(/^(dague de jet|javelot|fouet|arc|arbalête|fronde|hache de jet|fléau)$/)) return '';
|
||||
@ -173,19 +157,18 @@ export class RdDItemArme extends Item {
|
||||
}
|
||||
return armeData;
|
||||
}
|
||||
static competence2Mains(arme) {
|
||||
return arme.system.competence.replace(" 1 main", " 2 mains");
|
||||
}
|
||||
|
||||
static competence1Mains(arme) {
|
||||
return arme.system.competence.replace(" 2 mains", " 1 main");
|
||||
}
|
||||
|
||||
static competence2Mains(arme) {
|
||||
return arme.system.competence.replace(" 1 main", " 2 mains");
|
||||
}
|
||||
|
||||
static isArmeUtilisable(arme) {
|
||||
switch (arme.type) {
|
||||
case ITEM_TYPES.arme: return arme.system.equipe && (arme.system.resistance > 0 || arme.system.portee_courte > 0)
|
||||
case ITEM_TYPES.competencecreature: return true
|
||||
case TYPES.arme: return arme.system.equipe && (arme.system.resistance > 0 || arme.system.portee_courte > 0)
|
||||
case TYPES.competencecreature: return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
@ -201,7 +184,7 @@ export class RdDItemArme extends Item {
|
||||
return {
|
||||
_id: competence?.id,
|
||||
name: 'Corps à corps',
|
||||
type: ITEM_TYPES.arme,
|
||||
type: TYPES.arme,
|
||||
img: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp',
|
||||
system: {
|
||||
initiative: RdDCombatManager.calculInitiative(competence.system.niveau, melee),
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
import { RdDCombatManager } from "./rdd-combat.js";
|
||||
|
||||
const categories = {
|
||||
@ -54,7 +54,7 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isCompetenceAttaque(item) {
|
||||
if (item.type == ITEM_TYPES.competencecreature) {
|
||||
if (item.type == TYPES.competencecreature) {
|
||||
switch (item.system.categorie) {
|
||||
case "melee":
|
||||
case "tir":
|
||||
@ -68,7 +68,7 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
}
|
||||
|
||||
static getCategorieAttaque(item) {
|
||||
if (item.type == ITEM_TYPES.competencecreature) {
|
||||
if (item.type == TYPES.competencecreature) {
|
||||
switch (item.system.categorie) {
|
||||
case "melee":
|
||||
case "tir":
|
||||
@ -82,7 +82,7 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
return undefined
|
||||
}
|
||||
static isDommages(item) {
|
||||
if (item.type == ITEM_TYPES.competencecreature) {
|
||||
if (item.type == TYPES.competencecreature) {
|
||||
switch (item.system.categorie) {
|
||||
case "melee":
|
||||
case "tir":
|
||||
@ -94,7 +94,7 @@ export class RdDItemCompetenceCreature extends Item {
|
||||
return false
|
||||
}
|
||||
static isParade(item) {
|
||||
if (item.type == ITEM_TYPES.competencecreature) {
|
||||
if (item.type == TYPES.competencecreature) {
|
||||
switch (item.system.categorie) {
|
||||
case "melee":
|
||||
case "naturelle":
|
||||
|
@ -12,7 +12,7 @@ import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet for RdD specific items
|
||||
@ -101,7 +101,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
isComestible: this.item.getUtilisationCuisine(),
|
||||
options: RdDSheetUtility.mergeDocumentRights(this.options, this.item, this.isEditable),
|
||||
}
|
||||
if (this.item.type == ITEM_TYPES.competencecreature) {
|
||||
if (this.item.type == TYPES.competencecreature) {
|
||||
formData.isparade = RdDItemCompetenceCreature.isParade(this.item)
|
||||
formData.isdommages = RdDItemCompetenceCreature.isDommages(this.item)
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { TMRUtility } from "./tmr-utility.js";
|
||||
|
||||
@ -45,7 +44,7 @@ export class RdDItemSort extends Item {
|
||||
*/
|
||||
static getBonusCaseList(item, newCase = false) {
|
||||
// Gestion spéciale case bonus
|
||||
if (item.type == ITEM_TYPES.sort) {
|
||||
if (item.type == 'sort') {
|
||||
return RdDItemSort.buildBonusCaseList(item.system.bonuscase, newCase);
|
||||
}
|
||||
return undefined;
|
||||
|
118
module/item.js
118
module/item.js
@ -9,15 +9,7 @@ import { RdDRaretes } from "./item/raretes.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
|
||||
export const ACTOR_TYPES = {
|
||||
personnage: 'personnage',
|
||||
creature: 'creature',
|
||||
entite: 'entite',
|
||||
commerce: 'commerce',
|
||||
vehicule: 'vehicule'
|
||||
}
|
||||
|
||||
export const ITEM_TYPES = {
|
||||
export const TYPES = {
|
||||
competence: 'competence',
|
||||
competencecreature: 'competencecreature',
|
||||
empoignade: 'empoignade',
|
||||
@ -64,33 +56,33 @@ export const ITEM_TYPES = {
|
||||
}
|
||||
|
||||
const typesInventaireMateriel = [
|
||||
ITEM_TYPES.arme,
|
||||
ITEM_TYPES.armure,
|
||||
ITEM_TYPES.conteneur,
|
||||
ITEM_TYPES.faune,
|
||||
ITEM_TYPES.gemme,
|
||||
ITEM_TYPES.herbe,
|
||||
ITEM_TYPES.plante,
|
||||
ITEM_TYPES.ingredient,
|
||||
ITEM_TYPES.livre,
|
||||
ITEM_TYPES.monnaie,
|
||||
ITEM_TYPES.munition,
|
||||
ITEM_TYPES.nourritureboisson,
|
||||
ITEM_TYPES.objet,
|
||||
ITEM_TYPES.potion,
|
||||
TYPES.arme,
|
||||
TYPES.armure,
|
||||
TYPES.conteneur,
|
||||
TYPES.faune,
|
||||
TYPES.gemme,
|
||||
TYPES.herbe,
|
||||
TYPES.plante,
|
||||
TYPES.ingredient,
|
||||
TYPES.livre,
|
||||
TYPES.monnaie,
|
||||
TYPES.munition,
|
||||
TYPES.nourritureboisson,
|
||||
TYPES.objet,
|
||||
TYPES.potion,
|
||||
]
|
||||
const typesInventaire = {
|
||||
materiel: typesInventaireMateriel,
|
||||
all: ['service'].concat(typesInventaireMateriel),
|
||||
}
|
||||
|
||||
const typesObjetsOeuvres = [ITEM_TYPES.oeuvre, ITEM_TYPES.recettecuisine, ITEM_TYPES.musique, ITEM_TYPES.chant, ITEM_TYPES.danse, ITEM_TYPES.jeu]
|
||||
const typesObjetsDraconiques = [ITEM_TYPES.queue, ITEM_TYPES.ombre, ITEM_TYPES.souffle, ITEM_TYPES.tete, ITEM_TYPES.signedraconique, ITEM_TYPES.sortreserve, ITEM_TYPES.rencontre]
|
||||
const typesObjetsConnaissance = [ITEM_TYPES.meditation, ITEM_TYPES.recettealchimique, ITEM_TYPES.sort]
|
||||
const typesObjetsEffet = [ITEM_TYPES.possession, ITEM_TYPES.poison, ITEM_TYPES.maladie, ITEM_TYPES.blessure]
|
||||
const typesObjetsCompetence = [ITEM_TYPES.competence, ITEM_TYPES.competencecreature]
|
||||
const typesObjetsTemporels = [ITEM_TYPES.blessure, ITEM_TYPES.poison, ITEM_TYPES.maladie, ITEM_TYPES.queue, ITEM_TYPES.ombre, ITEM_TYPES.souffle, ITEM_TYPES.signedraconique, ITEM_TYPES.rencontre]
|
||||
const typesObjetsEquipable = [ITEM_TYPES.arme, ITEM_TYPES.armure, ITEM_TYPES.objet];
|
||||
const typesObjetsOeuvres = [TYPES.oeuvre, TYPES.recettecuisine, TYPES.musique, TYPES.chant, TYPES.danse, TYPES.jeu]
|
||||
const typesObjetsDraconiques = [TYPES.queue, TYPES.ombre, TYPES.souffle, TYPES.tete, TYPES.signedraconique, TYPES.sortreserve, TYPES.rencontre]
|
||||
const typesObjetsConnaissance = [TYPES.meditation, TYPES.recettealchimique, TYPES.sort]
|
||||
const typesObjetsEffet = [TYPES.possession, TYPES.poison, TYPES.maladie, TYPES.blessure]
|
||||
const typesObjetsCompetence = [TYPES.competence, TYPES.competencecreature]
|
||||
const typesObjetsTemporels = [TYPES.blessure, TYPES.poison, TYPES.maladie, TYPES.queue, TYPES.ombre, TYPES.souffle, TYPES.signedraconique, TYPES.rencontre]
|
||||
const typesObjetsEquipable = [TYPES.arme, TYPES.armure, TYPES.objet];
|
||||
const typesEnvironnement = typesInventaireMateriel;
|
||||
const encBrin = 0.00005; // un brin = 1 décigramme = 1/10g = 1/10000kg = 1/20000 enc
|
||||
const encPepin = 0.0007; /* un pépin de gemme = 1/10 cm3 = 1/1000 l = 3.5/1000 kg = 7/2000 kg = 7/1000 enc
|
||||
@ -149,12 +141,12 @@ export class RdDItem extends Item {
|
||||
static isFieldInventaireModifiable(type, field) {
|
||||
switch (field) {
|
||||
case 'quantite':
|
||||
if ([ITEM_TYPES.conteneur].includes(type)) {
|
||||
if ([TYPES.conteneur].includes(type)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case 'cout':
|
||||
if ([ITEM_TYPES.monnaie].includes(type)) {
|
||||
if ([TYPES.monnaie].includes(type)) {
|
||||
return game.user.isGM;
|
||||
}
|
||||
break;
|
||||
@ -203,15 +195,15 @@ export class RdDItem extends Item {
|
||||
|
||||
getUniteQuantite() {
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.monnaie: return "(Pièces)"
|
||||
case ITEM_TYPES.herbe:
|
||||
case TYPES.monnaie: return "(Pièces)"
|
||||
case TYPES.herbe:
|
||||
switch (this.system.categorie) {
|
||||
case 'Alchimie': case 'Repos': case 'Soin':
|
||||
return "(Brins)"
|
||||
case 'Cuisine': return '';
|
||||
}
|
||||
return '';
|
||||
case ITEM_TYPES.ingredient: return "(Pépins ou Brins)"
|
||||
case TYPES.ingredient: return "(Pépins ou Brins)"
|
||||
}
|
||||
return '';
|
||||
}
|
||||
@ -220,13 +212,13 @@ export class RdDItem extends Item {
|
||||
return typesObjetsEquipable.includes(this.type)
|
||||
}
|
||||
|
||||
isCompetencePersonnage() { return this.type == ITEM_TYPES.competence }
|
||||
isCompetenceCreature() { return this.type == ITEM_TYPES.competencecreature }
|
||||
isConteneur() { return this.type == ITEM_TYPES.conteneur; }
|
||||
isMonnaie() { return this.type == ITEM_TYPES.monnaie; }
|
||||
isPotion() { return this.type == ITEM_TYPES.potion; }
|
||||
isNourritureBoisson() { return this.type == ITEM_TYPES.nourritureboisson; }
|
||||
isService() { return this.type == ITEM_TYPES.service; }
|
||||
isCompetencePersonnage() { return this.type == TYPES.competence }
|
||||
isCompetenceCreature() { return this.type == TYPES.competencecreature }
|
||||
isConteneur() { return this.type == TYPES.conteneur; }
|
||||
isMonnaie() { return this.type == TYPES.monnaie; }
|
||||
isPotion() { return this.type == TYPES.potion; }
|
||||
isNourritureBoisson() { return this.type == TYPES.nourritureboisson; }
|
||||
isService() { return this.type == TYPES.service; }
|
||||
|
||||
isCompetence() { return typesObjetsCompetence.includes(this.type) }
|
||||
isEsquive() {
|
||||
@ -245,27 +237,27 @@ export class RdDItem extends Item {
|
||||
return this.isCompetence() && ['melee', 'tir', 'lancer'].includes(this.system.categorie)
|
||||
}
|
||||
|
||||
isCompetencePossession() { return ITEM_TYPES.competencecreature == this.type && this.system.categorie == "possession" }
|
||||
isCompetencePossession() { return TYPES.competencecreature == this.type && this.system.categorie == "possession" }
|
||||
isTemporel() { return typesObjetsTemporels.includes(this.type) }
|
||||
isOeuvre() { return typesObjetsOeuvres.includes(this.type) }
|
||||
isDraconique() { return RdDItem.getItemTypesDraconiques().includes(this.type) }
|
||||
isQueueDragon() { return [ITEM_TYPES.queue, ITEM_TYPES.ombre].includes(this.type) }
|
||||
isQueueDragon() { return [TYPES.queue, TYPES.ombre].includes(this.type) }
|
||||
isEffet() { return typesObjetsEffet.includes(this.type) }
|
||||
isConnaissance() { return typesObjetsConnaissance.includes(this.type) }
|
||||
|
||||
isInventaire(mode = 'materiel') { return RdDItem.getItemTypesInventaire(mode).includes(this.type); }
|
||||
isBoisson() { return this.isNourritureBoisson() && this.system.boisson; }
|
||||
isAlcool() { return this.isNourritureBoisson() && this.system.boisson && this.system.alcoolise; }
|
||||
isHerbeAPotion() { return this.type == ITEM_TYPES.herbe && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos'); }
|
||||
isBlessure() { return this.type == ITEM_TYPES.blessure }
|
||||
isHerbeAPotion() { return this.type == TYPES.herbe && (this.system.categorie == 'Soin' || this.system.categorie == 'Repos'); }
|
||||
isBlessure() { return this.type == TYPES.blessure }
|
||||
|
||||
isPresentDansMilieux(milieux) {
|
||||
return this.getEnvironnements(milieux).length > 0
|
||||
}
|
||||
getCategories() {
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.competence: return RdDItemCompetence.getCategories()
|
||||
case ITEM_TYPES.competencecreature: return RdDItemCompetenceCreature.getCategories()
|
||||
case TYPES.competence: return RdDItemCompetence.getCategories()
|
||||
case TYPES.competencecreature: return RdDItemCompetenceCreature.getCategories()
|
||||
}
|
||||
return {}
|
||||
}
|
||||
@ -349,15 +341,15 @@ export class RdDItem extends Item {
|
||||
|
||||
getUtilisation() {
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.potion:
|
||||
case TYPES.potion:
|
||||
switch (this.system.categorie) {
|
||||
case 'Alchimie': case 'AlchimieEnchante': case 'AlchimieAutre': return 'alchimie'
|
||||
case 'Cuisine': return 'cuisine'
|
||||
case 'Remede': case 'Repos': case 'ReposEnchante': case 'Soin': case 'SoinEnchante': return 'soins'
|
||||
}
|
||||
return '';
|
||||
case ITEM_TYPES.nourritureboisson: return 'cuisine';
|
||||
case ITEM_TYPES.herbe: case ITEM_TYPES.faune: case ITEM_TYPES.ingredient: case ITEM_TYPES.plante:
|
||||
case TYPES.nourritureboisson: return 'cuisine';
|
||||
case TYPES.herbe: case TYPES.faune: case TYPES.ingredient: case TYPES.plante:
|
||||
switch (this.system.categorie) {
|
||||
case 'Cuisine': return 'cuisine';
|
||||
case 'Toxique': case 'Poison': return 'poison';
|
||||
@ -372,9 +364,9 @@ export class RdDItem extends Item {
|
||||
getUtilisationCuisine() {
|
||||
if (this.getUtilisation() == 'cuisine') {
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.nourritureboisson:
|
||||
case TYPES.nourritureboisson:
|
||||
return 'pret';
|
||||
case ITEM_TYPES.herbe: case ITEM_TYPES.faune: case ITEM_TYPES.ingredient: case ITEM_TYPES.plante:
|
||||
case TYPES.herbe: case TYPES.faune: case TYPES.ingredient: case TYPES.plante:
|
||||
return 'brut';
|
||||
}
|
||||
}
|
||||
@ -382,7 +374,7 @@ export class RdDItem extends Item {
|
||||
}
|
||||
|
||||
isCristalAlchimique() {
|
||||
return this.type == ITEM_TYPES.objet && Grammar.includesLowerCaseNoAccent(this.name, 'cristal alchimique') && this.system.quantite > 0;
|
||||
return this.type == TYPES.objet && Grammar.includesLowerCaseNoAccent(this.name, 'cristal alchimique') && this.system.quantite > 0;
|
||||
}
|
||||
|
||||
isMagique() {
|
||||
@ -410,11 +402,11 @@ export class RdDItem extends Item {
|
||||
|
||||
getEnc() {
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.service:
|
||||
case TYPES.service:
|
||||
return 0;
|
||||
case ITEM_TYPES.herbe:
|
||||
case TYPES.herbe:
|
||||
return this.getEncHerbe();
|
||||
case ITEM_TYPES.gemme:
|
||||
case TYPES.gemme:
|
||||
return encPepin * this.system.taille;
|
||||
}
|
||||
return Math.max(this.system.encombrement ?? 0, 0);
|
||||
@ -492,7 +484,7 @@ export class RdDItem extends Item {
|
||||
|
||||
getActionPrincipale(options = { warnIfNot: true }) {
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.conteneur: return 'Ouvrir';
|
||||
case TYPES.conteneur: return 'Ouvrir';
|
||||
}
|
||||
if (this.actor?.isPersonnage()) {
|
||||
const warn = options.warnIfNot;
|
||||
@ -500,11 +492,11 @@ export class RdDItem extends Item {
|
||||
return 'Cuisiner';
|
||||
}
|
||||
switch (this.type) {
|
||||
case ITEM_TYPES.nourritureboisson: return this._actionOrWarnQuantiteZero(this.system.boisson ? 'Boire' : 'Manger', warn);
|
||||
case ITEM_TYPES.potion: return this._actionOrWarnQuantiteZero('Consommer', warn);
|
||||
case ITEM_TYPES.livre: return this._actionOrWarnQuantiteZero('Lire', warn);
|
||||
case ITEM_TYPES.herbe: return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined;
|
||||
case ITEM_TYPES.queue: case ITEM_TYPES.ombre: return this.system.refoulement > 0 ? 'Refouler' : undefined;
|
||||
case TYPES.nourritureboisson: return this._actionOrWarnQuantiteZero(this.system.boisson ? 'Boire' : 'Manger', warn);
|
||||
case TYPES.potion: return this._actionOrWarnQuantiteZero('Consommer', warn);
|
||||
case TYPES.livre: return this._actionOrWarnQuantiteZero('Lire', warn);
|
||||
case TYPES.herbe: return this.isHerbeAPotion() ? this._actionOrWarnQuantiteZero('Décoction', warn) : undefined;
|
||||
case TYPES.queue: case TYPES.ombre: return this.system.refoulement > 0 ? 'Refouler' : undefined;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
|
@ -2,7 +2,7 @@ import { RdDBaseActor } from "./actor/base-actor.js";
|
||||
import { LOG_HEAD, SYSTEM_RDD } from "./constants.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
import { Monnaie } from "./item-monnaie.js";
|
||||
import { RdDItem, ITEM_TYPES } from "./item.js";
|
||||
import { RdDItem, TYPES } from "./item.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDRaretes } from "./item/raretes.js";
|
||||
import { RdDCalendrier } from "./time/rdd-calendrier.js";
|
||||
@ -465,7 +465,7 @@ class _10_7_19_CategorieCompetenceCreature extends Migration {
|
||||
|
||||
async migrate() {
|
||||
await this.applyItemsUpdates(items => items
|
||||
.filter(it => ITEM_TYPES.competencecreature == it.type)
|
||||
.filter(it => TYPES.competencecreature == it.type)
|
||||
.map(it => this.migrateCompetenceCreature(it))
|
||||
);
|
||||
}
|
||||
@ -502,7 +502,7 @@ class _10_7_19_PossessionsEntiteVictime extends Migration {
|
||||
|
||||
async migrate() {
|
||||
await this.applyItemsUpdates(items => items
|
||||
.filter(it => ITEM_TYPES.possession == it.type)
|
||||
.filter(it => TYPES.possession == it.type)
|
||||
.map(it => this.migratePossession(it))
|
||||
);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { STATUSES } from "./settings/status-effects.js";
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
@ -92,18 +92,18 @@ export class RdDEmpoignade {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isEmpoignadeEnCours(actor) {
|
||||
return actor.itemTypes[ITEM_TYPES.empoignade].find(it => it.system.pointsemp > 0)
|
||||
return actor.itemTypes[TYPES.empoignade].find(it => it.system.pointsemp > 0)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getEmpoignadeById(actor, id) {
|
||||
let emp = actor.itemTypes[ITEM_TYPES.empoignade].find(it => it.system.empoignadeid == id)
|
||||
let emp = actor.itemTypes[TYPES.empoignade].find(it => it.system.empoignadeid == id)
|
||||
return emp && foundry.utils.duplicate(emp) || undefined;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getEmpoignade(attacker, defender) {
|
||||
let emp = attacker.itemTypes[ITEM_TYPES.empoignade].find(it =>
|
||||
let emp = attacker.itemTypes[TYPES.empoignade].find(it =>
|
||||
(it.system.empoigneurid == attacker.id && it.system.empoigneid == defender.id) ||
|
||||
(it.system.empoigneurid == defender.id && it.system.empoigneid == attacker.id)
|
||||
)
|
||||
|
@ -6,7 +6,7 @@ import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
export class RdDHerbes extends Item {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async onReady() {
|
||||
static async initializeHerbes() {
|
||||
this.herbesSoins = await RdDHerbes.listCategorieHerbes('Soin');
|
||||
this.herbesRepos = await RdDHerbes.listCategorieHerbes('Repos');
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RdDItemArme } from "./item-arme.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
|
||||
export class RdDHotbar {
|
||||
|
||||
@ -35,7 +35,7 @@ export class RdDHotbar {
|
||||
|
||||
static async addToHotbar(item, slot) {
|
||||
switch (item?.type ?? '') {
|
||||
case ITEM_TYPES.arme:
|
||||
case TYPES.arme:
|
||||
{
|
||||
// Les armes peuvent avoir plusieurs usages
|
||||
if (item.system.competence != '') {
|
||||
@ -54,12 +54,12 @@ export class RdDHotbar {
|
||||
}
|
||||
}
|
||||
return
|
||||
case ITEM_TYPES.competencecreature:
|
||||
case TYPES.competencecreature:
|
||||
const categorie = RdDItemCompetenceCreature.getCategorieAttaque(item) ?? 'competence';
|
||||
await this.createItemMacro(item, slot, categorie)
|
||||
return
|
||||
default:
|
||||
case ITEM_TYPES.competence:
|
||||
case TYPES.competence:
|
||||
await this.createItemMacro(item, slot++, 'competence')
|
||||
if (item.isCorpsACorps()) {
|
||||
await this.createItemMacro(item, slot++, 'pugilat')
|
||||
@ -79,7 +79,7 @@ export class RdDHotbar {
|
||||
* Actor - open actor sheet
|
||||
* Journal - open journal sheet
|
||||
*/
|
||||
static init() {
|
||||
static initDropbar() {
|
||||
|
||||
Hooks.on('hotbarDrop', (bar, documentData, slot) => {
|
||||
|
||||
@ -88,9 +88,9 @@ export class RdDHotbar {
|
||||
const item = fromUuidSync(documentData.uuid) ?? this.actor.items.get(documentData.uuid)
|
||||
console.log('DROP', documentData, item)
|
||||
switch (item?.type) {
|
||||
case ITEM_TYPES.arme:
|
||||
case ITEM_TYPES.competence:
|
||||
case ITEM_TYPES.competencecreature:
|
||||
case TYPES.arme:
|
||||
case TYPES.competence:
|
||||
case TYPES.competencecreature:
|
||||
this.addToHotbar(item, slot)
|
||||
return false
|
||||
}
|
||||
@ -116,9 +116,9 @@ export class RdDHotbar {
|
||||
|
||||
// Trigger the item roll
|
||||
switch (item.type) {
|
||||
case ITEM_TYPES.arme:
|
||||
case TYPES.arme:
|
||||
return actor.rollArme(item, categorieArme);
|
||||
case ITEM_TYPES.competence:
|
||||
case TYPES.competence:
|
||||
if (item.isCorpsACorps()) {
|
||||
switch (categorieArme) {
|
||||
case 'pugilat':
|
||||
@ -128,7 +128,7 @@ export class RdDHotbar {
|
||||
}
|
||||
}
|
||||
return actor.rollCompetence(item);
|
||||
case ITEM_TYPES.competencecreature:
|
||||
case TYPES.competencecreature:
|
||||
return item.system.iscombat && !item.system.isparade
|
||||
? actor.rollArme(item, categorieArme)
|
||||
: actor.rollCompetence(item);
|
||||
|
@ -1,72 +1,69 @@
|
||||
import { SYSTEM_RDD, SYSTEM_SOCKET_ID, RDD_CONFIG } from "./constants.js"
|
||||
import { Migrations } from './migrations.js'
|
||||
import { SYSTEM_RDD, SYSTEM_SOCKET_ID, RDD_CONFIG } from "./constants.js";
|
||||
import { Migrations } from './migrations.js';
|
||||
|
||||
import { RdDUtility } from "./rdd-utility.js"
|
||||
import { TMRUtility } from "./tmr-utility.js"
|
||||
import { TMRRencontres } from "./tmr-rencontres.js"
|
||||
import { RdDCalendrier } from "./time/rdd-calendrier.js"
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js"
|
||||
import { DialogChronologie } from "./dialog-chronologie.js"
|
||||
import { RdDUtility } from "./rdd-utility.js";
|
||||
import { TMRUtility } from "./tmr-utility.js";
|
||||
import { TMRRencontres } from "./tmr-rencontres.js";
|
||||
import { RdDCalendrier } from "./time/rdd-calendrier.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { DialogChronologie } from "./dialog-chronologie.js";
|
||||
|
||||
import { RdDResolutionTable } from "./rdd-resolution-table.js"
|
||||
import { RdDTokenHud } from "./rdd-token-hud.js"
|
||||
import { RdDCommands } from "./rdd-commands.js"
|
||||
import { RdDCombatManager, RdDCombat } from "./rdd-combat.js"
|
||||
import { ChatUtility } from "./chat-utility.js"
|
||||
import { StatusEffects } from "./settings/status-effects.js"
|
||||
import { RdDCompendiumOrganiser } from "./rdd-compendium-organiser.js"
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"
|
||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
import { RdDTokenHud } from "./rdd-token-hud.js";
|
||||
import { RdDCommands } from "./rdd-commands.js";
|
||||
import { RdDCombatManager, RdDCombat } from "./rdd-combat.js";
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { StatusEffects } from "./settings/status-effects.js";
|
||||
import { RdDCompendiumOrganiser } from "./rdd-compendium-organiser.js";
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||
import { RdDHotbar } from "./rdd-hotbar-drop.js"
|
||||
import { EffetsDraconiques } from "./tmr/effets-draconiques.js"
|
||||
import { RdDHerbes } from "./rdd-herbes.js"
|
||||
import { RdDDice } from "./rdd-dice.js"
|
||||
import { RdDPossession } from "./rdd-possession.js"
|
||||
import { Misc } from "./misc.js"
|
||||
import { EffetsDraconiques } from "./tmr/effets-draconiques.js";
|
||||
import { RdDHerbes } from "./rdd-herbes.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
import { RdDPossession } from "./rdd-possession.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
import { SystemCompendiums } from "./settings/system-compendiums.js"
|
||||
import { Environnement } from "./environnement.js"
|
||||
import { SystemCompendiums } from "./settings/system-compendiums.js";
|
||||
import { Environnement } from "./environnement.js";
|
||||
|
||||
import { RdDActor } from "./actor.js"
|
||||
import { RdDBaseActor } from "./actor/base-actor.js"
|
||||
import { RdDCommerce } from "./actor/commerce.js"
|
||||
import { RdDEntite } from "./actor/entite.js"
|
||||
import { RdDVehicule } from "./actor/vehicule.js"
|
||||
import { RdDActorSheet } from "./actor-sheet.js"
|
||||
import { RdDCommerceSheet } from "./actor/commerce-sheet.js"
|
||||
import { RdDCreatureSheet } from "./actor/creature-sheet.js"
|
||||
import { RdDActorEntiteSheet } from "./actor/entite-sheet.js"
|
||||
import { RdDActorVehiculeSheet } from "./actor/vehicule-sheet.js"
|
||||
import { RdDActor } from "./actor.js";
|
||||
import { RdDBaseActor } from "./actor/base-actor.js";
|
||||
import { RdDCommerce } from "./actor/commerce.js";
|
||||
import { RdDEntite } from "./actor/entite.js";
|
||||
import { RdDVehicule } from "./actor/vehicule.js";
|
||||
import { RdDActorSheet } from "./actor-sheet.js";
|
||||
import { RdDCommerceSheet } from "./actor/commerce-sheet.js";
|
||||
import { RdDCreatureSheet } from "./actor/creature-sheet.js";
|
||||
import { RdDActorEntiteSheet } from "./actor/entite-sheet.js";
|
||||
import { RdDActorVehiculeSheet } from "./actor/vehicule-sheet.js";
|
||||
|
||||
import { RdDItem } from "./item.js"
|
||||
import { RdDItemBlessure } from "./item/blessure.js"
|
||||
import { RdDItemService } from "./item/service.js"
|
||||
import { RdDItemMaladie } from "./item/maladie.js"
|
||||
import { RdDItemPoison } from "./item/poison.js"
|
||||
import { RdDItemSigneDraconique } from "./item/signedraconique.js"
|
||||
import { RdDItemQueue } from "./item/queue.js"
|
||||
import { RdDItemOmbre } from "./item/ombre.js"
|
||||
import { RdDItemSouffle } from "./item/souffle.js"
|
||||
import { RdDRencontre } from "./item/rencontre.js"
|
||||
import { RdDItem } from "./item.js";
|
||||
import { RdDItemBlessure } from "./item/blessure.js";
|
||||
import { RdDItemService } from "./item/service.js";
|
||||
import { RdDItemMaladie } from "./item/maladie.js";
|
||||
import { RdDItemPoison } from "./item/poison.js";
|
||||
import { RdDItemSigneDraconique } from "./item/signedraconique.js";
|
||||
import { RdDItemQueue } from "./item/queue.js";
|
||||
import { RdDItemOmbre } from "./item/ombre.js";
|
||||
import { RdDItemSouffle } from "./item/souffle.js";
|
||||
import { RdDRencontre } from "./item/rencontre.js";
|
||||
|
||||
import { RdDItemSheet } from "./item-sheet.js"
|
||||
import { RdDBlessureItemSheet } from "./item/sheet-blessure.js"
|
||||
import { RdDServiceItemSheet } from "./item/sheet-service.js"
|
||||
import { RdDRencontreItemSheet } from "./item/sheet-rencontre.js"
|
||||
import { RdDHerbeItemSheet } from "./item/sheet-herbe.js"
|
||||
import { RdDPlanteItemSheet } from "./item/sheet-plante.js"
|
||||
import { RdDIngredientItemSheet } from "./item/sheet-ingredient.js"
|
||||
import { RdDFauneItemSheet } from "./item/sheet-faune.js"
|
||||
import { RdDConteneurItemSheet } from "./item/sheet-conteneur.js"
|
||||
import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js"
|
||||
import { RdDItemInventaireSheet } from "./item/sheet-base-inventaire.js"
|
||||
import { AppAstrologie } from "./sommeil/app-astrologie.js"
|
||||
import { RdDItemArmure } from "./item/armure.js"
|
||||
import { AutoAdjustDarkness as AutoAdjustDarkness } from "./time/auto-adjust-darkness.js"
|
||||
import { RdDCreature } from "./actor/creature.js"
|
||||
import { RdDTMRDialog } from "./rdd-tmr-dialog.js"
|
||||
import { RdDActorExportSheet } from "./actor/actor-export-sheet.js"
|
||||
import { OptionsAvancees } from "./settings/options-avancees.js"
|
||||
import { ExportScriptarium } from "./actor/export-scriptarium/export-scriptarium.js"
|
||||
import { RdDItemSheet } from "./item-sheet.js";
|
||||
import { RdDBlessureItemSheet } from "./item/sheet-blessure.js";
|
||||
import { RdDServiceItemSheet } from "./item/sheet-service.js";
|
||||
import { RdDRencontreItemSheet } from "./item/sheet-rencontre.js";
|
||||
import { RdDHerbeItemSheet } from "./item/sheet-herbe.js";
|
||||
import { RdDPlanteItemSheet } from "./item/sheet-plante.js";
|
||||
import { RdDIngredientItemSheet } from "./item/sheet-ingredient.js";
|
||||
import { RdDFauneItemSheet } from "./item/sheet-faune.js";
|
||||
import { RdDConteneurItemSheet } from "./item/sheet-conteneur.js";
|
||||
import { RdDSigneDraconiqueItemSheet } from "./item/sheet-signedraconique.js";
|
||||
import { RdDItemInventaireSheet } from "./item/sheet-base-inventaire.js";
|
||||
import { AppAstrologie } from "./sommeil/app-astrologie.js";
|
||||
import { RdDItemArmure } from "./item/armure.js";
|
||||
import { AutoAdjustDarkness as AutoAdjustDarkness } from "./time/auto-adjust-darkness.js";
|
||||
import { RdDCreature } from "./actor/creature.js";
|
||||
import { RdDTMRDialog } from "./rdd-tmr-dialog.js";
|
||||
|
||||
/**
|
||||
* RdD system
|
||||
@ -83,9 +80,9 @@ export class SystemReveDeDragon {
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.config = RDD_CONFIG
|
||||
this.RdDUtility = RdDUtility
|
||||
this.RdDHotbar = RdDHotbar
|
||||
this.config = RDD_CONFIG;
|
||||
this.RdDUtility = RdDUtility;
|
||||
this.RdDHotbar = RdDHotbar;
|
||||
this.itemClasses = {
|
||||
armure: RdDItemArmure,
|
||||
blessure: RdDItemBlessure,
|
||||
@ -111,42 +108,42 @@ export class SystemReveDeDragon {
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
async onInit() {
|
||||
game.system.rdd = this
|
||||
this.AppAstrologie = AppAstrologie
|
||||
game.system.rdd = this;
|
||||
this.AppAstrologie = AppAstrologie;
|
||||
|
||||
|
||||
console.log(`Initializing Reve de Dragon System`)
|
||||
console.log(`Initializing Reve de Dragon System`);
|
||||
|
||||
// preload handlebars templates
|
||||
RdDUtility.preloadHandlebarsTemplates()
|
||||
RdDUtility.preloadHandlebarsTemplates();
|
||||
|
||||
/* -------------------------------------------- */
|
||||
this.initSystemSettings()
|
||||
this.initSystemSettings();
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Set an initiative formula for the system
|
||||
CONFIG.Combat.initiative = {
|
||||
formula: "1+(1d6/10)",
|
||||
decimals: 2
|
||||
}
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
game.socket.on(SYSTEM_SOCKET_ID, async (sockmsg) => {
|
||||
console.log(">>>>> MSG RECV", sockmsg)
|
||||
console.log(">>>>> MSG RECV", sockmsg);
|
||||
try {
|
||||
RdDUtility.onSocketMessage(sockmsg)
|
||||
RdDCombat.onSocketMessage(sockmsg)
|
||||
ChatUtility.onSocketMessage(sockmsg)
|
||||
RdDBaseActor.onSocketMessage(sockmsg)
|
||||
RdDUtility.onSocketMessage(sockmsg);
|
||||
RdDCombat.onSocketMessage(sockmsg);
|
||||
ChatUtility.onSocketMessage(sockmsg);
|
||||
RdDBaseActor.onSocketMessage(sockmsg);
|
||||
} catch (e) {
|
||||
console.error('game.socket.on(SYSTEM_SOCKET_ID) Exception: ', sockmsg, ' => ', e)
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Define custom Entity classes
|
||||
CONFIG.Actor.documentClass = RdDBaseActor
|
||||
CONFIG.Item.documentClass = RdDItem
|
||||
CONFIG.Actor.documentClass = RdDBaseActor;
|
||||
CONFIG.Item.documentClass = RdDItem;
|
||||
CONFIG.RDD = {
|
||||
resolutionTable: RdDResolutionTable.resolutionTable,
|
||||
carac_array: RdDUtility.getCaracArray(),
|
||||
@ -156,31 +153,30 @@ export class SystemReveDeDragon {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet)
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDCommerceSheet, { types: ["commerce"], makeDefault: true })
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDActorExportSheet, { types: ["personnage"], makeDefault: false })
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDActorSheet, { types: ["personnage"], makeDefault: true })
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDCreatureSheet, { types: ["creature"], makeDefault: true })
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDActorVehiculeSheet, { types: ["vehicule"], makeDefault: true })
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDActorEntiteSheet, { types: ["entite"], makeDefault: true })
|
||||
Items.unregisterSheet("core", ItemSheet)
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDCommerceSheet, { types: ["commerce"], makeDefault: true });
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDActorSheet, { types: ["personnage"], makeDefault: true });
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDCreatureSheet, { types: ["creature"], makeDefault: true });
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDActorVehiculeSheet, { types: ["vehicule"], makeDefault: true });
|
||||
Actors.registerSheet(SYSTEM_RDD, RdDActorEntiteSheet, { types: ["entite"], makeDefault: true });
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
|
||||
RdDItemSheet.register(RdDSigneDraconiqueItemSheet)
|
||||
RdDItemSheet.register(RdDRencontreItemSheet)
|
||||
RdDItemSheet.register(RdDConteneurItemSheet)
|
||||
RdDItemSheet.register(RdDHerbeItemSheet)
|
||||
RdDItemSheet.register(RdDFauneItemSheet)
|
||||
RdDItemSheet.register(RdDPlanteItemSheet)
|
||||
RdDItemSheet.register(RdDIngredientItemSheet)
|
||||
RdDItemSheet.register(RdDServiceItemSheet)
|
||||
RdDItemSheet.register(RdDBlessureItemSheet)
|
||||
RdDItemSheet.register(RdDSigneDraconiqueItemSheet);
|
||||
RdDItemSheet.register(RdDRencontreItemSheet);
|
||||
RdDItemSheet.register(RdDConteneurItemSheet);
|
||||
RdDItemSheet.register(RdDHerbeItemSheet);
|
||||
RdDItemSheet.register(RdDFauneItemSheet);
|
||||
RdDItemSheet.register(RdDPlanteItemSheet);
|
||||
RdDItemSheet.register(RdDIngredientItemSheet);
|
||||
RdDItemSheet.register(RdDServiceItemSheet);
|
||||
RdDItemSheet.register(RdDBlessureItemSheet);
|
||||
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
||||
types: [
|
||||
"objet", "arme", "armure", "livre", "potion", "munition",
|
||||
"monnaie", "nourritureboisson", "gemme",
|
||||
], makeDefault: true
|
||||
})
|
||||
});
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
|
||||
types: [
|
||||
"competence", "competencecreature",
|
||||
@ -189,32 +185,31 @@ export class SystemReveDeDragon {
|
||||
"nombreastral", "tache", "maladie", "poison", "possession",
|
||||
"tarot", "extraitpoetique", "empoignade"
|
||||
], makeDefault: true
|
||||
})
|
||||
CONFIG.Combat.documentClass = RdDCombatManager
|
||||
});
|
||||
CONFIG.Combat.documentClass = RdDCombatManager;
|
||||
|
||||
// préparation des différents modules
|
||||
AutoAdjustDarkness.init()
|
||||
RdDTimestamp.init()
|
||||
RdDCalendrier.init()
|
||||
SystemCompendiums.init()
|
||||
DialogChronologie.init()
|
||||
ReglesOptionnelles.init()
|
||||
OptionsAvancees.init()
|
||||
RdDUtility.init()
|
||||
RdDDice.init()
|
||||
RdDCommands.init()
|
||||
RdDCombatManager.init()
|
||||
RdDTokenHud.init()
|
||||
RdDBaseActor.init()
|
||||
RdDCompendiumOrganiser.init()
|
||||
AutoAdjustDarkness.init();
|
||||
RdDTimestamp.init();
|
||||
RdDCalendrier.init();
|
||||
SystemCompendiums.init();
|
||||
DialogChronologie.init();
|
||||
ReglesOptionnelles.init();
|
||||
RdDUtility.init();
|
||||
RdDDice.init();
|
||||
RdDCommands.init();
|
||||
RdDCombatManager.init();
|
||||
RdDTokenHud.init();
|
||||
RdDBaseActor.init();
|
||||
RdDCompendiumOrganiser.init();
|
||||
EffetsDraconiques.init()
|
||||
TMRUtility.init()
|
||||
TMRUtility.init();
|
||||
await RdDTMRDialog.init()
|
||||
RdDHotbar.init()
|
||||
RdDPossession.init()
|
||||
TMRRencontres.init()
|
||||
Environnement.init()
|
||||
ExportScriptarium.init()
|
||||
RdDHotbar.initDropbar();
|
||||
RdDPossession.init();
|
||||
TMRRencontres.init();
|
||||
Environnement.init();
|
||||
|
||||
}
|
||||
|
||||
initSystemSettings() {
|
||||
@ -230,7 +225,7 @@ export class SystemReveDeDragon {
|
||||
"avant-encaissement": "Avant l'encaissement",
|
||||
},
|
||||
default: "avant-encaissement"
|
||||
})
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
game.settings.register(SYSTEM_RDD, "supprimer-dialogues-combat-chat", {
|
||||
@ -240,7 +235,7 @@ export class SystemReveDeDragon {
|
||||
config: true,
|
||||
default: true,
|
||||
type: Boolean
|
||||
})
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
game.settings.register(SYSTEM_RDD, "activer-sons-audio", {
|
||||
@ -250,8 +245,7 @@ export class SystemReveDeDragon {
|
||||
config: true,
|
||||
default: true,
|
||||
type: Boolean
|
||||
})
|
||||
|
||||
});
|
||||
/* -------------------------------------------- */
|
||||
game.settings.register(SYSTEM_RDD, "appliquer-famine-soif", {
|
||||
name: "Notifier de la famine et la soif pour",
|
||||
@ -265,7 +259,7 @@ export class SystemReveDeDragon {
|
||||
"famine-soif": "la famine et la soif",
|
||||
},
|
||||
default: "aucun"
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async onReady() {
|
||||
@ -273,47 +267,47 @@ export class SystemReveDeDragon {
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
game.system.rdd.calendrier = new RdDCalendrier()
|
||||
game.system.rdd.calendrier = new RdDCalendrier();
|
||||
if (Misc.isUniqueConnectedGM()) {
|
||||
new Migrations().migrate()
|
||||
this.messageDeBienvenue()
|
||||
import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter => {
|
||||
new Migrations().migrate();
|
||||
this.messageDeBienvenue();
|
||||
import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter=>{
|
||||
console.log("ClassCounter loaded", moduleCounter)
|
||||
moduleCounter.ClassCounter.registerUsageCount()
|
||||
}).catch(err =>
|
||||
}).catch(err=>
|
||||
console.log("No stats available, giving up.")
|
||||
)
|
||||
}
|
||||
|
||||
StatusEffects.onReady()
|
||||
RdDHerbes.onReady()
|
||||
RdDDice.onReady()
|
||||
StatusEffects.onReady();
|
||||
RdDHerbes.initializeHerbes();
|
||||
RdDDice.onReady();
|
||||
/* -------------------------------------------- */
|
||||
/* Affiche/Init le calendrier */
|
||||
game.system.rdd.calendrier.display()
|
||||
game.system.rdd.calendrier.display();
|
||||
// Avertissement si joueur sans personnage
|
||||
if (!game.user.isGM && game.user.character == undefined) {
|
||||
ui.notifications.info("Attention ! Vous n'êtes connecté à aucun personnage !")
|
||||
ui.notifications.info("Attention ! Vous n'êtes connecté à aucun personnage !");
|
||||
ChatMessage.create({
|
||||
content: "<b>ATTENTION</b> Le joueur " + game.user.name + " n'est connecté à aucun personnage !",
|
||||
user: game.user.id
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
messageDeBienvenue() {
|
||||
if (game.user.isGM) {
|
||||
ChatUtility.removeChatMessageContaining('<div id="message-bienvenue-rdd">')
|
||||
ChatUtility.removeChatMessageContaining('<div id="message-bienvenue-rdd">');
|
||||
ChatMessage.create({
|
||||
user: game.user.id,
|
||||
content: `<div id="message-bienvenue-rdd"><span class="rdd-roll-part">Bienvenue dans le Rêve des Dragons !</span>
|
||||
<br>Vous trouverez quelques informations pour démarrer dans ce document : @Compendium[foundryvtt-reve-de-dragon.rappel-des-regles.7uGrUHGdPu0EmIu2]{Documentation MJ/Joueurs}
|
||||
<br>La commande <code>/aide</code> dans le chat permet de voir les commandes spécifiques à Rêve de Dragon.</div>
|
||||
` })
|
||||
` });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SystemReveDeDragon.start()
|
||||
SystemReveDeDragon.start();
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
import { RdDRoll } from "./rdd-roll.js";
|
||||
import { RdDItemCompetenceCreature } from "./item-competencecreature.js";
|
||||
import { Targets } from "./targets.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* On part du principe qu'une entité démarre tjs
|
||||
@ -20,9 +20,9 @@ export class RdDPossession {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static searchPossessionFromEntite(attacker, defender) {
|
||||
let poss = attacker.items.find(poss => poss.type == ITEM_TYPES.possession && poss.system.victime.actorid == defender.id);
|
||||
let poss = attacker.items.find(poss => poss.type == TYPES.possession && poss.system.victime.actorid == defender.id);
|
||||
if (!poss) {
|
||||
poss = defender.items.find(poss => poss.type == ITEM_TYPES.possession && poss.system.victime.actorid == defender.id);
|
||||
poss = defender.items.find(poss => poss.type == TYPES.possession && poss.system.victime.actorid == defender.id);
|
||||
}
|
||||
return poss && foundry.utils.duplicate(poss) || undefined;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import { RdDDice } from "./rdd-dice.js";
|
||||
import { STATUSES } from "./settings/status-effects.js";
|
||||
import { RdDRencontre } from "./item/rencontre.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
const TMR_DISPLAY_SIZE = {
|
||||
@ -208,11 +208,11 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
get sortsReserve() {
|
||||
return this.actor.itemTypes[ITEM_TYPES.sortreserve];
|
||||
return this.actor.itemTypes[TYPES.sortreserve];
|
||||
}
|
||||
|
||||
getSortsReserve(coord) {
|
||||
return this.actor.itemTypes[ITEM_TYPES.sortreserve].filter(// Reserve sur une case fleuve ou normale
|
||||
return this.actor.itemTypes[TYPES.sortreserve].filter(// Reserve sur une case fleuve ou normale
|
||||
TMRUtility.getTMR(coord).type == 'fleuve'
|
||||
? it => TMRUtility.getTMR(it.system.coord).type == 'fleuve'
|
||||
: it => it.system.coord == coord
|
||||
@ -270,7 +270,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
_getTokensSortsReserve() {
|
||||
const sortsReserve = this.actor.itemTypes[ITEM_TYPES.sortreserve];
|
||||
const sortsReserve = this.actor.itemTypes[TYPES.sortreserve];
|
||||
return Misc.concat(sortsReserve.map(sortReserve =>
|
||||
EffetsDraconiques.sortReserve.tokens(this.pixiTMR, sortReserve, () => sortReserve.system.coord)))
|
||||
}
|
||||
|
@ -1,91 +0,0 @@
|
||||
import { SYSTEM_RDD } from "../constants.js"
|
||||
import { Misc } from "../misc.js"
|
||||
|
||||
export const EXPORT_CSV_SCRIPTARIUM = 'export-csv-scriptarium'
|
||||
|
||||
const OPTIONS_AVANCEES = [
|
||||
{ group: 'Menus', name: EXPORT_CSV_SCRIPTARIUM, descr: "Proposer le menu d'export csv Scriptarium (raffraichissement requis)" },
|
||||
]
|
||||
|
||||
export class OptionsAvancees extends FormApplication {
|
||||
static init() {
|
||||
for (const regle of OPTIONS_AVANCEES) {
|
||||
const name = regle.name
|
||||
const id = OptionsAvancees._getId(name)
|
||||
game.settings.register(SYSTEM_RDD, id, { name: id, scope: regle.scope ?? "world", config: false, default: regle.default == undefined ? true : regle.default, type: Boolean })
|
||||
}
|
||||
|
||||
game.settings.registerMenu(SYSTEM_RDD, "rdd-options-avancees", {
|
||||
name: "Configurer les options avancées",
|
||||
label: "Options avancées",
|
||||
hint: "Ouvre la fenêtre de configuration des options avancées",
|
||||
icon: "fas fa-bars",
|
||||
type: OptionsAvancees
|
||||
})
|
||||
}
|
||||
|
||||
constructor(...args) {
|
||||
super(...args)
|
||||
}
|
||||
|
||||
static _getId(name) {
|
||||
return `rdd-advanced-${name}`
|
||||
}
|
||||
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
id: "options-avancees",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/settings/options-avancees.hbs",
|
||||
height: 650,
|
||||
width: 550,
|
||||
minimizable: false,
|
||||
closeOnSubmit: true,
|
||||
title: "Options avancées"
|
||||
}, { inplace: false })
|
||||
}
|
||||
|
||||
getData() {
|
||||
let formData = super.getData()
|
||||
const regles = OPTIONS_AVANCEES.filter(it => game.user.isGM || it.scope == "client")
|
||||
.map(it => {
|
||||
it = foundry.utils.duplicate(it)
|
||||
it.id = OptionsAvancees._getId(it.name)
|
||||
it.active = OptionsAvancees.isSet(it.name)
|
||||
return it
|
||||
})
|
||||
formData.regles = regles
|
||||
formData.groups = Misc.classify(regles, it => it.group)
|
||||
return formData
|
||||
}
|
||||
|
||||
static getSettingKey(name){
|
||||
return `${SYSTEM_RDD}.${this._getId(name)}`
|
||||
}
|
||||
|
||||
static isUsing(name) {
|
||||
return OptionsAvancees.isSet(name)
|
||||
}
|
||||
|
||||
static isSet(name) {
|
||||
return game.settings.get(SYSTEM_RDD, OptionsAvancees._getId(name))
|
||||
}
|
||||
|
||||
static set(name, value) {
|
||||
return game.settings.set(SYSTEM_RDD, OptionsAvancees._getId(name), value ? true : false)
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
html.find(".select-option").click((event) => {
|
||||
if (event.currentTarget.attributes.name) {
|
||||
let id = event.currentTarget.attributes.name.value
|
||||
let isChecked = event.currentTarget.checked
|
||||
game.settings.set(SYSTEM_RDD, id, isChecked)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async _updateObject(event, formData) {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export class ReglesOptionnelles extends FormApplication {
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
id: "regles-optionnelles",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/settings/regles-optionnelles.hbs",
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/settings/regles-optionnelles.html",
|
||||
height: 650,
|
||||
width: 550,
|
||||
minimizable: false,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { MAX_NOMBRE_ASTRAL, RdDTimestamp, WORLD_TIMESTAMP_SETTING } from "./rdd-timestamp.js";
|
||||
import { RdDCalendrierEditor } from "./rdd-calendrier-editor.js";
|
||||
import { RdDResolutionTable } from "../rdd-resolution-table.js";
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { RdDDice } from "../rdd-dice.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { DialogChronologie } from "../dialog-chronologie.js";
|
||||
|
@ -15,18 +15,18 @@ export const RDD_MINUTES_PAR_JOUR = 1440; //RDD_HEURES_PAR_JOUR * RDD_MINUTES_PA
|
||||
const ROUNDS_PAR_MINUTE = 10;
|
||||
|
||||
const DEFINITION_HEURES = [
|
||||
{ key: "vaisseau", article: "du ", label: "Vaisseau", lettreFont: 'v', saison: "Printemps", darkness: 0.9 },
|
||||
{ key: "sirene", article: "de la ", label: "Sirène", lettreFont: 'i', saison: "Printemps", darkness: 0.1 },
|
||||
{ key: "faucon", article: "du ", label: "Faucon", lettreFont: 'f', saison: "Printemps", darkness: 0 },
|
||||
{ key: "couronne", article: "de la ", label: "Couronne", lettreFont: '', saison: "Eté", darkness: 0 },
|
||||
{ key: "dragon", article: "du ", label: "Dragon", lettreFont: 'd', saison: "Eté", darkness: 0 },
|
||||
{ key: "epees", article: "des ", label: "Epées", lettreFont: 'e', saison: "Eté", darkness: 0 },
|
||||
{ key: "lyre", article: "de la ", label: "Lyre", lettreFont: 'l', saison: "Automne", darkness: 0.1 },
|
||||
{ key: "serpent", article: "du ", label: "Serpent", lettreFont: 's', saison: "Automne", darkness: 0.9 },
|
||||
{ key: "poissonacrobate", article: "du ", label: "Poisson Acrobate", lettreFont: 'p', saison: "Automne", darkness: 1 },
|
||||
{ key: "araignee", article: "de l'", label: "Araignée", lettreFont: 'a', saison: "Hiver", darkness: 1 },
|
||||
{ key: "roseau", article: "du ", label: "Roseau", lettreFont: 'r', saison: "Hiver", darkness: 1 },
|
||||
{ key: "chateaudormant", article: "du ", label: "Château Dormant", lettreFont: 'c', saison: "Hiver", darkness: 1 },
|
||||
{ key: "vaisseau", label: "Vaisseau", lettreFont: 'v', saison: "Printemps", darkness: 0.9 },
|
||||
{ key: "sirene", label: "Sirène", lettreFont: 'i', saison: "Printemps", darkness: 0.1 },
|
||||
{ key: "faucon", label: "Faucon", lettreFont: 'f', saison: "Printemps", darkness: 0 },
|
||||
{ key: "couronne", label: "Couronne", lettreFont: '', saison: "Eté", darkness: 0 },
|
||||
{ key: "dragon", label: "Dragon", lettreFont: 'd', saison: "Eté", darkness: 0 },
|
||||
{ key: "epees", label: "Epées", lettreFont: 'e', saison: "Eté", darkness: 0 },
|
||||
{ key: "lyre", label: "Lyre", lettreFont: 'l', saison: "Automne", darkness: 0.1 },
|
||||
{ key: "serpent", label: "Serpent", lettreFont: 's', saison: "Automne", darkness: 0.9 },
|
||||
{ key: "poissonacrobate", label: "Poisson Acrobate", lettreFont: 'p', saison: "Automne", darkness: 1 },
|
||||
{ key: "araignee", label: "Araignée", lettreFont: 'a', saison: "Hiver", darkness: 1 },
|
||||
{ key: "roseau", label: "Roseau", lettreFont: 'r', saison: "Hiver", darkness: 1 },
|
||||
{ key: "chateaudormant", label: "Château Dormant", lettreFont: 'c', saison: "Hiver", darkness: 1 },
|
||||
]
|
||||
|
||||
const FORMULES_DUREE = [
|
||||
@ -64,7 +64,6 @@ export class RdDTimestamp {
|
||||
DEFINITION_HEURES[i].hh = RdDTimestamp.hh(i);
|
||||
DEFINITION_HEURES[i].icon = RdDTimestamp.iconeHeure(i);
|
||||
DEFINITION_HEURES[i].webp = DEFINITION_HEURES[i].icon.replace(".svg", ".webp");
|
||||
DEFINITION_HEURES[i].avecArticle = DEFINITION_HEURES[i].article + DEFINITION_HEURES[i].label
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { TYPES } from "../item.js";
|
||||
import { TMRUtility } from "../tmr-utility.js";
|
||||
import { PixiTMR } from "./pixi-tmr.js";
|
||||
|
||||
@ -12,10 +12,10 @@ export class Draconique {
|
||||
static init() {
|
||||
}
|
||||
|
||||
static isCaseTMR(item) { return item.type == ITEM_TYPES.casetmr; }
|
||||
static isCaseTMR(item) { return item.type == TYPES.casetmr; }
|
||||
static isQueueDragon(item) { return item.isQueueDragon(); }
|
||||
static isSouffleDragon(item) { return item.type == ITEM_TYPES.souffle; }
|
||||
static isTeteDragon(item) { return item.type == ITEM_TYPES.tete; }
|
||||
static isSouffleDragon(item) { return item.type == TYPES.souffle; }
|
||||
static isTeteDragon(item) { return item.type == TYPES.tete; }
|
||||
static isQueueSouffle(item) { return Draconique.isQueueDragon(item) || Draconique.isSouffleDragon(item); }
|
||||
|
||||
static register(draconique, code = undefined) {
|
||||
|
@ -18,7 +18,7 @@ import { Periple } from "./periple.js";
|
||||
import { UrgenceDraconique } from "./urgence-draconique.js";
|
||||
import { Grammar } from "../grammar.js";
|
||||
import { AugmentationSeuil } from "./augmentation-seuil.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { TYPES } from "../item.js";
|
||||
|
||||
export class EffetsDraconiques {
|
||||
static carteTmr = new CarteTmr();
|
||||
@ -122,11 +122,11 @@ export class EffetsDraconiques {
|
||||
}
|
||||
|
||||
static tetesDragon(actor, name) {
|
||||
return actor.itemTypes[ITEM_TYPES.tete].filter(it => Grammar.includesLowerCaseNoAccent(it.name, name));
|
||||
return actor.itemTypes[TYPES.tete].filter(it => Grammar.includesLowerCaseNoAccent(it.name, name));
|
||||
}
|
||||
|
||||
static soufflesDragon(actor, name) {
|
||||
return actor.itemTypes[ITEM_TYPES.souffle].filter(it => Grammar.includesLowerCaseNoAccent(it.name, name));
|
||||
return actor.itemTypes[TYPES.souffle].filter(it => Grammar.includesLowerCaseNoAccent(it.name, name));
|
||||
}
|
||||
|
||||
static queuesDragon(actor, name) {
|
||||
@ -134,7 +134,7 @@ export class EffetsDraconiques {
|
||||
}
|
||||
|
||||
static queuesSoufflesDragon(actor, name) {
|
||||
return actor.filterItems(it => [ITEM_TYPES.queue, ITEM_TYPES.ombre, ITEM_TYPES.souffle].includes(it.type) && Grammar.includesLowerCaseNoAccent(it.name, name));
|
||||
return actor.filterItems(it => [TYPES.queue, TYPES.ombre, TYPES.souffle].includes(it.type) && Grammar.includesLowerCaseNoAccent(it.name, name));
|
||||
}
|
||||
|
||||
static countAugmentationSeuil(actor) {
|
||||
|
@ -5,7 +5,7 @@ import { RdDRollTables } from "../rdd-rolltables.js";
|
||||
import { TMRUtility } from "../tmr-utility.js";
|
||||
import { tmrTokenZIndex } from "../tmr-constants.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
import { ITEM_TYPES } from "../item.js";
|
||||
import { TYPES } from "../item.js";
|
||||
import { TMRAnimations } from "./animation.js";
|
||||
|
||||
export class UrgenceDraconique extends Draconique {
|
||||
@ -14,7 +14,7 @@ export class UrgenceDraconique extends Draconique {
|
||||
match(item) { return Draconique.isQueueDragon(item) && Grammar.toLowerCaseNoAccent(item.name).includes('urgence draconique'); }
|
||||
manualMessage() { return false }
|
||||
async onActorCreateOwned(actor, queue) {
|
||||
const coordSortsReserve = actor.itemTypes[ITEM_TYPES.sortreserve].map(it => it.system.coord) ?? [];
|
||||
const coordSortsReserve = actor.itemTypes[TYPES.sortreserve].map(it => it.system.coord) ?? [];
|
||||
if (coordSortsReserve.length == 0) {
|
||||
// La queue se transforme en idée fixe
|
||||
const ideeFixe = await RdDRollTables.getIdeeFixe();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ITEM_TYPES } from "../item.js"
|
||||
import { TYPES } from "../item.js"
|
||||
import { RdDItemCompetence } from "../item-competence.js"
|
||||
import { ChatUtility } from "../chat-utility.js"
|
||||
import { Misc } from "../misc.js"
|
||||
@ -69,7 +69,7 @@ export class DialogFatigueVoyage extends Dialog {
|
||||
}
|
||||
const competencesVoyage = {}
|
||||
CODES_COMPETENCES_VOYAGE.forEach(codeSurvie => {
|
||||
competencesVoyage[codeSurvie] = RdDItemCompetence.findCompetence(actor.itemTypes[ITEM_TYPES.competence], codeSurvie, { onMessage: () => { } })
|
||||
competencesVoyage[codeSurvie] = RdDItemCompetence.findCompetence(actor.itemTypes[TYPES.competence], codeSurvie, { onMessage: () => { } })
|
||||
})
|
||||
TABLEAU_FATIGUE_MARCHE.forEach(terrain => {
|
||||
actorParameters.survies[terrain.code] = Misc.join(
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 56 KiB |
@ -572,15 +572,6 @@ input:is(.blessure-premiers_soins, .blessure-soins_complets) {
|
||||
border: none;
|
||||
padding: 0.1rem;
|
||||
}
|
||||
.context-menu-img {
|
||||
max-width: 2rem;
|
||||
max-height: 1rem;
|
||||
flex-grow: 0;
|
||||
margin: 0.2rem 0.3rem 0 0;
|
||||
vertical-align: middle;
|
||||
border: none;
|
||||
padding: 0rem;
|
||||
}
|
||||
|
||||
.button-img {
|
||||
vertical-align: baseline;
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"id": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"version": "12.0.9",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.9.zip",
|
||||
"version": "12.0.8",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.8.zip",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json",
|
||||
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
|
||||
"compatibility": {
|
||||
|
@ -21,7 +21,6 @@
|
||||
"race": "Humain",
|
||||
"yeux": "",
|
||||
"cheveux": "",
|
||||
"taille": "",
|
||||
"poids": "",
|
||||
"heure": "",
|
||||
"sexe": "",
|
||||
|
@ -1,13 +0,0 @@
|
||||
<form autocomplete="off" onsubmit="event.preventDefault();">
|
||||
{{#each groups as |group key|}}
|
||||
<h3>{{key}}</h3>
|
||||
<ul>
|
||||
{{#each group as |regle r|}}
|
||||
<li>
|
||||
<input class="select-option" type="checkbox" name="{{regle.id}}" {{#if regle.active}}checked{{/if}}/>
|
||||
<label>{{regle.descr}}</label>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/each}}
|
||||
</form>
|
Loading…
Reference in New Issue
Block a user