Migration datamodels !
This commit is contained in:
@@ -9,14 +9,17 @@
|
||||
/* -------------------------------------------- */
|
||||
// Import Modules
|
||||
import { WastelandActor } from "./wasteland-actor.js";
|
||||
import { WastelandItemSheet } from "./wasteland-item-sheet.js";
|
||||
import { WastelandActorSheet } from "./wasteland-actor-sheet.js";
|
||||
import { WastelandCreatureSheet } from "./wasteland-creature-sheet.js";
|
||||
import { WastelandUtility } from "./wasteland-utility.js";
|
||||
import { WastelandCombat } from "./wasteland-combat.js";
|
||||
import { WastelandItem } from "./wasteland-item.js";
|
||||
import { WASTELAND_CONFIG } from "./wasteland-config.js";
|
||||
|
||||
// Import DataModels
|
||||
import * as models from "./models/index.mjs";
|
||||
|
||||
// Import AppV2 Sheets
|
||||
import * as sheets from "./applications/sheets/_module.mjs";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
@@ -45,35 +48,112 @@ Hooks.once("init", async function () {
|
||||
// Define custom Entity classes
|
||||
CONFIG.Combat.documentClass = WastelandCombat
|
||||
CONFIG.Actor.documentClass = WastelandActor
|
||||
CONFIG.Item.documentClass = WastelandItem
|
||||
game.system.wasteland = {
|
||||
config: WASTELAND_CONFIG
|
||||
CONFIG.Actor.dataModels = {
|
||||
personnage: models.PersonnageDataModel,
|
||||
creature: models.CreatureDataModel
|
||||
}
|
||||
|
||||
CONFIG.Item.documentClass = WastelandItem
|
||||
CONFIG.Item.dataModels = {
|
||||
arme: models.ArmeDataModel,
|
||||
artifex: models.ArtifexDataModel,
|
||||
bouclier: models.BouclierDataModel,
|
||||
capacite: models.CapaciteDataModel,
|
||||
charme: models.CharmeDataModel,
|
||||
competence: models.CompetenceDataModel,
|
||||
don: models.DonDataModel,
|
||||
equipement: models.EquipementDataModel,
|
||||
heritage: models.HeritageDataModel,
|
||||
hubris: models.HubrisDataModel,
|
||||
metier: models.MetierDataModel,
|
||||
monnaie: models.MonnaieDataModel,
|
||||
mutation: models.MutationDataModel,
|
||||
origine: models.OrigineDataModel,
|
||||
peuple: models.PeupleDataModel,
|
||||
pouvoir: models.PouvoirDataModel,
|
||||
protection: models.ProtectionDataModel
|
||||
}
|
||||
|
||||
game.system.wasteland = {
|
||||
config: WASTELAND_CONFIG,
|
||||
models,
|
||||
sheets
|
||||
}
|
||||
|
||||
// Initialize dynamic config options that need to be available immediately
|
||||
// Create option lists inline to ensure they're available
|
||||
const listeNiveauSkill = {}
|
||||
for (let i = 0; i <= 10; i++) {
|
||||
listeNiveauSkill[`${i}`] = `${i}`
|
||||
}
|
||||
game.system.wasteland.config.listeNiveauSkill = listeNiveauSkill
|
||||
|
||||
const listeNiveauAttribut = {}
|
||||
for (let i = 0; i <= 10; i++) {
|
||||
listeNiveauAttribut[`${i}`] = `${i}`
|
||||
}
|
||||
game.system.wasteland.config.listeNiveauAttribut = listeNiveauAttribut
|
||||
|
||||
const listeNiveauCreature = {}
|
||||
for (let i = 0; i <= 35; i++) {
|
||||
listeNiveauCreature[`${i}`] = `${i}`
|
||||
}
|
||||
game.system.wasteland.config.listeNiveauCreature = listeNiveauCreature
|
||||
|
||||
const modificateurOptions = []
|
||||
for (let i = -15; i <= 15; i++) {
|
||||
modificateurOptions.push({ key: i, label: `${i >= 0 ? '+' : ''}${i}` })
|
||||
}
|
||||
game.system.wasteland.config.modificateurOptions = modificateurOptions
|
||||
|
||||
const pointsAmeOptions = {}
|
||||
for (let i = 0; i <= 20; i++) {
|
||||
pointsAmeOptions[`${i}`] = `${i}`
|
||||
}
|
||||
game.system.wasteland.config.pointsAmeOptions = pointsAmeOptions
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Register sheet application classes
|
||||
|
||||
// Register AppV2 Actor Sheets
|
||||
foundry.documents.collections.Actors.unregisterSheet("core", foundry.appv1.sheets.ActorSheet);
|
||||
foundry.documents.collections.Actors.registerSheet("fvtt-wasteland", WastelandActorSheet, { types: ["personnage"], makeDefault: true })
|
||||
foundry.documents.collections.Actors.registerSheet("fvtt-wasteland", WastelandCreatureSheet, { types: ["creature"], makeDefault: false });
|
||||
foundry.documents.collections.Actors.registerSheet("fvtt-wasteland", sheets.WastelandPersonnageSheet, { types: ["personnage"], makeDefault: true });
|
||||
foundry.documents.collections.Actors.registerSheet("fvtt-wasteland", sheets.WastelandCreatureSheet, { types: ["creature"], makeDefault: true });
|
||||
|
||||
// Register AppV2 Item Sheets
|
||||
foundry.documents.collections.Items.unregisterSheet("core", foundry.appv1.sheets.ItemSheet);
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", WastelandItemSheet, { makeDefault: true })
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandArmeSheet, { types: ["arme"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandArtifexSheet, { types: ["artifex"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandBouclierSheet, { types: ["bouclier"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandCapaciteSheet, { types: ["capacite"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandCharmeSheet, { types: ["charme"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandCompetenceSheet, { types: ["competence"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandDonSheet, { types: ["don"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandEquipementSheet, { types: ["equipement"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandHeritageSheet, { types: ["heritage"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandHubrisSheet, { types: ["hubris"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandMetierSheet, { types: ["metier"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandMonnaieSheet, { types: ["monnaie"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandMutationSheet, { types: ["mutation"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandOrigineSheet, { types: ["origine"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandPeupleSheet, { types: ["peuple"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandPouvoirSheet, { types: ["pouvoir"], makeDefault: true });
|
||||
foundry.documents.collections.Items.registerSheet("fvtt-wasteland", sheets.WastelandProtectionSheet, { types: ["protection"], makeDefault: true });
|
||||
|
||||
WastelandUtility.init();
|
||||
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
function welcomeMessage() {
|
||||
async function welcomeMessage() {
|
||||
const templateData = {};
|
||||
const html = await foundry.applications.handlebars.renderTemplate("systems/fvtt-wasteland/templates/chat-welcome-message.hbs", templateData);
|
||||
|
||||
ChatMessage.create({
|
||||
user: game.user.id,
|
||||
whisper: [game.user.id],
|
||||
content: `<div id="welcome-message-Wasteland"><span class="rdd-roll-part">
|
||||
<strong>Bienvenue dans les Wasteland !</strong>
|
||||
<p>Les livres de Wasteland sont nécessaires pour jouer : https://www.titam-france.fr</p>
|
||||
<p>Wasteland est jeu de rôle publié par Titam France/Sombres projets, tout les droits leur appartiennent.</p>
|
||||
<p>Système développé par LeRatierBretonnien, avec le support de Prêtre. Plus d'infos et aides sur le <a href="https://discord.gg/pPSDNJk">Discord FR de Foundry</a>.</p>
|
||||
` });
|
||||
content: html
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user