Merge branch 'v1.4-choic-type-item' into 'v1.4'
Améliorer le choix du type d'objet à créer #143 See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!252
This commit is contained in:
commit
ebe877400a
44
lang/fr.json
Normal file
44
lang/fr.json
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"ACTOR": {
|
||||||
|
"TypePersonnage": "Personnage",
|
||||||
|
"TypeCreature": "Créature",
|
||||||
|
"TypeEntite": "Entité de cauchemar",
|
||||||
|
"TypeVehicule": "Véhicule"
|
||||||
|
},
|
||||||
|
"ITEM": {
|
||||||
|
"TypeObjet": "Objet",
|
||||||
|
"TypeCompetence": "Compétence",
|
||||||
|
"TypeCompetencecreature": "Compétence de créature",
|
||||||
|
"TypeMaladie": "Maladie",
|
||||||
|
"TypePoison": "Poison",
|
||||||
|
"TypeNombreastral": "Nombre astral",
|
||||||
|
"TypeTarot": "Carte de tarot",
|
||||||
|
"TypeCasetmr": "TMR spéciale",
|
||||||
|
"TypeRencontresTMR": "Rencontre TMR",
|
||||||
|
"TypeMunition": "Munition",
|
||||||
|
"TypeMonnaie": "Monnaie",
|
||||||
|
"TypeHerbe": "Herbe ou plante",
|
||||||
|
"TypeIngredient": "Ingrédient",
|
||||||
|
"TypeLivre": "Livre",
|
||||||
|
"TypePotion": "Potion",
|
||||||
|
"TypeArme": "Arme",
|
||||||
|
"TypeArmure": "Armure",
|
||||||
|
"TypeConteneur": "Conteneur",
|
||||||
|
"TypeNourritureboisson": "Nourriture & boisson",
|
||||||
|
"TypeChant": "Chant",
|
||||||
|
"TypeDanse": "Danse",
|
||||||
|
"TypeMusique": "Musique",
|
||||||
|
"TypeOeuvre": "Oeuvre",
|
||||||
|
"TypeTache": "Tâche",
|
||||||
|
"TypeJeu": "Jeu",
|
||||||
|
"TypeRecettealchimique": "Recette alchimique",
|
||||||
|
"TypeRecettecuisine": "Recette de cuisine",
|
||||||
|
"TypeSort": "Sort",
|
||||||
|
"TypeMeditation": "Méditation",
|
||||||
|
"TypeSignedraconique": "Signe draconique",
|
||||||
|
"TypeQueue": "Queue de Dragon",
|
||||||
|
"TypeOmbre": "Ombre de Thanatos",
|
||||||
|
"TypeSouffle": "Souffle de Dragon",
|
||||||
|
"TypeTete": "Tête de Dragon"
|
||||||
|
}
|
||||||
|
}
|
@ -108,6 +108,16 @@ export class Misc {
|
|||||||
return Misc.data(it)?.data ?? {}
|
return Misc.data(it)?.data ?? {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getEntityTypeLabel(entity) {
|
||||||
|
const documentName = entity?.documentName;
|
||||||
|
const type = entity?.data.type;
|
||||||
|
if (documentName === 'Actor' || documentName === 'Item') {
|
||||||
|
const label = CONFIG[documentName]?.typeLabels?.[type] ?? type;
|
||||||
|
return game.i18n.has(label) ? game.i18n.localize(label) : t;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
static connectedGMOrUser(ownerId = undefined) {
|
static connectedGMOrUser(ownerId = undefined) {
|
||||||
if (ownerId && game.user.id == ownerId) {
|
if (ownerId && game.user.id == ownerId) {
|
||||||
return ownerId;
|
return ownerId;
|
||||||
|
@ -13,7 +13,7 @@ export class RdDAudio {
|
|||||||
let audioData = context2file[context];
|
let audioData = context2file[context];
|
||||||
if ( audioData ) {
|
if ( audioData ) {
|
||||||
let audioPath = "systems/foundryvtt-reve-de-dragon/sounds/" + audioData.file;
|
let audioPath = "systems/foundryvtt-reve-de-dragon/sounds/" + audioData.file;
|
||||||
console.log(`wfrp4e | Playing Sound: ${audioPath}`)
|
console.log(`foundryvtt-reve-de-dragon | Playing Sound: ${audioPath}`)
|
||||||
AudioHelper.play({ src: audioPath }, audioData.isGlobal);
|
AudioHelper.play({ src: audioPath }, audioData.isGlobal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1207,8 +1207,7 @@ export class RdDCombat {
|
|||||||
data: {
|
data: {
|
||||||
attackerId: this.attackerId,
|
attackerId: this.attackerId,
|
||||||
defenderTokenId: defenderTokenId,
|
defenderTokenId: defenderTokenId,
|
||||||
attackerRoll: attackerRoll,
|
attackerRoll: attackerRoll
|
||||||
gmId: Misc.connectedGMOrUser(),
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,5 @@
|
|||||||
import { Misc } from "./misc.js";
|
import { Misc } from "./misc.js";
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
|
||||||
/**
|
|
||||||
* Mapping des types d'Item/Actor vers le nom d'affichage.
|
|
||||||
* Par défaut, on prend le type avec la première lettre
|
|
||||||
* majuscule, pas besoin d'ajouter tous les types.
|
|
||||||
*/
|
|
||||||
const typeDisplayName = {
|
|
||||||
"competence": "Compétence",
|
|
||||||
"herbe": "Plante",
|
|
||||||
"ingredient": "Ingrédient",
|
|
||||||
"queue": "Queue de Dragon",
|
|
||||||
"ombre": "Ombre de Thanatos",
|
|
||||||
"souffle": "Souffle de Dragon",
|
|
||||||
"tete": "Tête de Dragon",
|
|
||||||
"nourritureboisson": "Nourriture & boisson",
|
|
||||||
"rencontresTMR": "Rencontre des TMR",
|
|
||||||
"competencecreature": "Compétence de créature",
|
|
||||||
"nombreastral": "Nombre astral",
|
|
||||||
"casetmr": "Effet sur TMR",
|
|
||||||
"recettealchimique": "Recette alchimique",
|
|
||||||
"recettecuisine": "Recette de cuisine",
|
|
||||||
"tarot": "Carte de tarot draconique",
|
|
||||||
"tache": "Tâche",
|
|
||||||
"meditation": "Méditation",
|
|
||||||
"musique": "Mélodie",
|
|
||||||
"chant": "Chanson",
|
|
||||||
"creature": "Créature",
|
|
||||||
"entite": "Entité",
|
|
||||||
"vehicule": "Véhicule"
|
|
||||||
}
|
|
||||||
|
|
||||||
export class RddCompendiumOrganiser {
|
export class RddCompendiumOrganiser {
|
||||||
static init() {
|
static init() {
|
||||||
Hooks.on('renderCompendium', async (pack, html, data) => RddCompendiumOrganiser.onRenderCompendium(pack, html, data))
|
Hooks.on('renderCompendium', async (pack, html, data) => RddCompendiumOrganiser.onRenderCompendium(pack, html, data))
|
||||||
@ -38,22 +7,23 @@ export class RddCompendiumOrganiser {
|
|||||||
|
|
||||||
static async onRenderCompendium(compendium, html, data) {
|
static async onRenderCompendium(compendium, html, data) {
|
||||||
console.log('onRenderCompendium', compendium, html, data);
|
console.log('onRenderCompendium', compendium, html, data);
|
||||||
let pack = compendium.collection
|
const pack = compendium.collection
|
||||||
if (pack.metadata.system === 'foundryvtt-reve-de-dragon') {
|
if (pack.metadata.system === 'foundryvtt-reve-de-dragon') {
|
||||||
html.find('.directory-item').each((i, element) => {
|
html.find('.directory-item').each((i, element) => {
|
||||||
const entity = pack.get(element.dataset.documentId);
|
RddCompendiumOrganiser.setEntityTypeName(pack, element);
|
||||||
const entityName = entity?.documentName;
|
|
||||||
if (entityName === 'Actor' || entityName === 'Item') {
|
|
||||||
const entityType = entity.data.type;
|
|
||||||
const typeName = typeDisplayName[entityType] ?? Misc.upperFirst(entitytype);
|
|
||||||
RddCompendiumOrganiser.insertEntityType(element, typeName);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static insertEntityType(element, type) {
|
static async setEntityTypeName(pack, element) {
|
||||||
element.children[1].insertAdjacentHTML('afterbegin', `<label>${type}: </label>`);
|
const label = Misc.getEntityTypeLabel(await pack.getDocument(element.dataset.documentId));
|
||||||
|
RddCompendiumOrganiser.insertEntityType(element, label);
|
||||||
|
}
|
||||||
|
|
||||||
|
static insertEntityType(element, label) {
|
||||||
|
if (label) {
|
||||||
|
element.children[1].insertAdjacentHTML('afterbegin', `<label class="type-compendium">${label}: </label>`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -51,7 +51,7 @@ export class RdDHotbar {
|
|||||||
macro = await Macro.create({
|
macro = await Macro.create({
|
||||||
name: journal.data.name,
|
name: journal.data.name,
|
||||||
type: "script",
|
type: "script",
|
||||||
img: "systems/wfrp4e/icons/buildings/scroll.png",
|
img: "systems/foundryvtt-reve-de-dragon/icons/templates/icone_parchement_vierge.png",
|
||||||
command: command
|
command: command
|
||||||
}, { displaySheet: false })
|
}, { displaySheet: false })
|
||||||
game.user.assignHotbarMacro(macro, slot);
|
game.user.assignHotbarMacro(macro, slot);
|
||||||
|
File diff suppressed because one or more lines are too long
@ -530,6 +530,10 @@ table {border: 1px solid #7a7971;}
|
|||||||
overflow: visible;
|
overflow: visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.type-compendium{
|
||||||
|
font-size: 0.60rem;
|
||||||
|
}
|
||||||
|
|
||||||
/* ======================================== */
|
/* ======================================== */
|
||||||
/* Sheet */
|
/* Sheet */
|
||||||
.window-app.sheet .window-content .sheet-header{
|
.window-app.sheet .window-content .sheet-header{
|
||||||
|
@ -320,7 +320,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"library": false,
|
"library": false,
|
||||||
"languages": [],
|
"languages": [
|
||||||
|
{ "lang": "en", "name": "English", "path": "lang/fr.json", "unreal": "this is a trick"},
|
||||||
|
{ "lang": "fr", "name": "Français", "path": "lang/fr.json" }
|
||||||
|
],
|
||||||
"gridDistance": 1,
|
"gridDistance": 1,
|
||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
"primaryTokenAttribute": "sante.vie",
|
"primaryTokenAttribute": "sante.vie",
|
||||||
|
Loading…
Reference in New Issue
Block a user