Création du compendium Faune, Flore, Minéraux
- les tables d'environnement se basent sur ce seul compendium - les tables de compendiums peuvent chercher plusieurs types d'items - déplacement de la botanique - déplacement des sels alchimiques depuis l'équipement - modification de l'équipement de départ - modification des acteurs (lien vers compendium de l'item source)
This commit is contained in:
@ -16,7 +16,7 @@ const CONFIGURABLE_COMPENDIUMS = {
|
||||
'rencontres': { label: "Rencontres dans les TMR", type: "Item" },
|
||||
'tetes-de-dragon-pour-haut-revants': { label: "Têtes de dragons (haut-rêvant)", type: "Item" },
|
||||
'tetes-de-dragon-pour-tous-personnages': { label: "Têtes de dragons (tous)", type: "Item" },
|
||||
'botanique': { label: "Herbes & plantes", type: "Item" },
|
||||
'faune-flore-mineraux': { label: "Herbes & plantes", type: "Item" },
|
||||
'equipement': { label: "Equipements", type: "Item" },
|
||||
}
|
||||
|
||||
@ -172,17 +172,17 @@ export class SystemCompendiums extends FormApplication {
|
||||
*/
|
||||
export class CompendiumTable {
|
||||
|
||||
constructor(compendium, type, subType, sorting = undefined) {
|
||||
constructor(compendium, type, subTypes, sorting = undefined) {
|
||||
this.compendium = compendium;
|
||||
this.type = type;
|
||||
this.subType = subType;
|
||||
this.subTypes = subTypes;
|
||||
this.sorting = sorting ?? Misc.ascending(it => it.name);
|
||||
}
|
||||
|
||||
async getContent(itemFrequence = it => it.system.frequence, filter = it => true) {
|
||||
return await SystemCompendiums.getContent(this.compendium,
|
||||
this.type,
|
||||
it => this.subType == it.type && filter(it),
|
||||
it => this.subTypes.includes(it.type) && filter(it),
|
||||
itemFrequence,
|
||||
this.sorting);
|
||||
}
|
||||
@ -194,12 +194,12 @@ export class CompendiumTable {
|
||||
|
||||
async getRandom(itemFrequence = it => it.system.frequence, filter = it => true, forcedRoll = undefined) {
|
||||
const table = await this.buildTable(itemFrequence, filter);
|
||||
return await CompendiumTableHelpers.getRandom(table, this.type, this.subType, forcedRoll, SystemCompendiums.getCompendium(compendium));
|
||||
return await CompendiumTableHelpers.getRandom(table, this.type, this.subTypes, forcedRoll, SystemCompendiums.getCompendium(compendium));
|
||||
}
|
||||
|
||||
async toChatMessage(itemFrequence = it => it.system.frequence, filter = it => true, typeName = undefined) {
|
||||
const table = await this.buildTable(itemFrequence, filter);
|
||||
await CompendiumTableHelpers.tableToChatMessage(table, this.type, this.subType, typeName);
|
||||
await CompendiumTableHelpers.tableToChatMessage(table, this.type, this.subTypes, typeName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -220,9 +220,9 @@ export class CompendiumTableHelpers {
|
||||
});
|
||||
}
|
||||
|
||||
static async getRandom(table, type, subType, forcedRoll = undefined, localisation = undefined) {
|
||||
static async getRandom(table, type, subTypes, forcedRoll = undefined, localisation = undefined) {
|
||||
if (table.length == 0) {
|
||||
ui.notifications.warn(`Aucun ${Misc.typeName(type, subType)} trouvé dans ${localisation ?? ' les compendiums'}`);
|
||||
ui.notifications.warn(`Aucun ${Misc.typeName(type, subTypes[0])} trouvé dans ${localisation ?? ' les compendiums'}`);
|
||||
return undefined;
|
||||
}
|
||||
return await CompendiumTableHelpers.selectRow(table, forcedRoll);
|
||||
@ -270,10 +270,10 @@ export class CompendiumTableHelpers {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async tableToChatMessage(table, type, subType, typeName = undefined) {
|
||||
static async tableToChatMessage(table, type, subTypes, typeName = undefined) {
|
||||
const flavorContent = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-compendium-table.html', {
|
||||
img: RdDItem.getDefaultImg(subType),
|
||||
typeName: typeName ?? Misc.typeName(type, subType),
|
||||
img: RdDItem.getDefaultImg(subTypes[0]),
|
||||
typeName: typeName ?? Misc.typeName(type, subTypes[0]),
|
||||
table,
|
||||
isGM: game.user.isGM,
|
||||
});
|
||||
|
Reference in New Issue
Block a user