Fix sheet + gemmes #204

This commit is contained in:
sladecraven 2021-10-29 09:53:35 +02:00
parent d923199e03
commit 52332c2ab1
6 changed files with 104 additions and 4 deletions

View File

@ -3,6 +3,7 @@ import { RdDUtility } from "./rdd-utility.js";
import { RdDAlchimie } from "./rdd-alchimie.js"; import { RdDAlchimie } from "./rdd-alchimie.js";
import { RdDItemCompetence } from "./item-competence.js"; import { RdDItemCompetence } from "./item-competence.js";
import { RdDHerbes } from "./rdd-herbes.js"; import { RdDHerbes } from "./rdd-herbes.js";
import { RdDGemme } from "./rdd-gemme.js";
import { Misc } from "./misc.js"; import { Misc } from "./misc.js";
import { HtmlUtility } from "./html-utility.js"; import { HtmlUtility } from "./html-utility.js";
import { ReglesOptionelles } from "./regles-optionelles.js"; import { ReglesOptionelles } from "./regles-optionelles.js";
@ -92,6 +93,10 @@ export class RdDItemSheet extends ItemSheet {
if (formData.type == 'recettealchimique') { if (formData.type == 'recettealchimique') {
RdDAlchimie.processManipulation(objectData, this.actor && this.actor.id); RdDAlchimie.processManipulation(objectData, this.actor && this.actor.id);
} }
if (formData.type == 'gemme') {
formData.gemmeTypeList = RdDGemme.getGemmeTypeOptionList();
RdDGemme.calculDataDerivees( formData.data );
}
if (formData.type == 'potion') { if (formData.type == 'potion') {
if (this.dateUpdated) { if (this.dateUpdated) {
formData.data.prdate = this.dateUpdated; formData.data.prdate = this.dateUpdated;

35
module/rdd-gemme.js Normal file
View File

@ -0,0 +1,35 @@
const tableGemmes = {
"almaze": { label: "Almaze", couleur: "Blanc"},
"aquafane": { label: "Aquafane", couleur: "Vert Profond"},
"asterite": { label: "Astérite", couleur: "Bleu, Violet ou Blanc"},
"cyanolithe": { label: "Cyanolithe", couleur: "Bleu Intense"},
"larmededragon": { label: "Larme de Dragon", couleur: "Rouge Intense"},
"muska": { label: "Muska", couleur: "Violet Profond"},
"nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense"},
"nebuleuse": { label: "Nébuleuse", couleur: "Brouillard Intense, Rose, Vert ou Bleu Pâle"},
"oeildetigre": { label: "Oeil de Tigre", couleur: "Jaune"},
"scarlatine": { label: "Scarlatine", couleur: "Rouge Clair ou Orangé"},
"seliphane": { label: "Séliphane", couleur: "Vert Lumineux"},
"tournelune": { label: "Tournelune", couleur: "Violet ou Bleu"},
"zebraide": { label: "Zebraïde", couleur: "Bandes Bicolores, toutes couleurs"}
}
export class RdDGemme extends Item {
static getGemmeTypeOptionList() {
let options = ""
for (let gemmeKey in tableGemmes) {
let gemmeData = tableGemmes[gemmeKey];
options += `<option value="${gemmeKey}">${gemmeData.label}</option>`
}
return options;
}
static calculDataDerivees(data) {
data.cout = (data.taille * data.purete) + data.qualite;
data.inertie = 7 - data.purete;
data.enchantabilite = data.taille - data.inertie;
}
}

View File

@ -178,7 +178,9 @@ Hooks.once("init", async function () {
types: ["signedraconique"], types: ["signedraconique"],
makeDefault: true makeDefault: true
}); });
Items.registerSheet("foundryvtt-reve-de-dragon", RdDItemSheet, { makeDefault: true }); Items.registerSheet("foundryvtt-reve-de-dragon", RdDItemSheet, { types: ["arme", "armure", "objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle",
"tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation", "casetmr", "recettealchimique", "gemme",
"musique", "chant", "danse", "jeu", "recettecuisine", "maladie", "poison", "oeuvre", "nourritureboisson"], makeDefault: true });
CONFIG.Combat.documentClass = RdDCombatManager; CONFIG.Combat.documentClass = RdDCombatManager;
// préparation des différents modules // préparation des différents modules

View File

@ -2,11 +2,11 @@
"name": "foundryvtt-reve-de-dragon", "name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon", "title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT", "description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.5.10", "version": "1.5.11",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.8.0", "minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "0.8.9", "compatibleCoreVersion": "0.8.9",
"templateVersion": 118, "templateVersion": 119,
"author": "LeRatierBretonnien", "author": "LeRatierBretonnien",
"authors": [ "authors": [
{ {

View File

@ -571,7 +571,7 @@
"Item": { "Item": {
"types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle", "types": ["objet", "arme", "armure", "conteneur", "competence", "sort", "herbe", "ingredient", "livre", "potion", "munition", "rencontresTMR", "queue", "ombre", "souffle",
"tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation", "casetmr", "recettealchimique", "tete", "competencecreature", "tarot", "monnaie", "nombreastral", "tache", "meditation", "casetmr", "recettealchimique",
"musique", "chant", "danse", "jeu", "recettecuisine", "maladie", "poison", "oeuvre", "nourritureboisson", "signedraconique" ], "musique", "chant", "danse", "jeu", "recettecuisine", "maladie", "poison", "oeuvre", "nourritureboisson", "signedraconique", "gemme" ],
"objet": { "objet": {
"description": "", "description": "",
"descriptionmj": "", "descriptionmj": "",
@ -582,6 +582,16 @@
"qualite": 0, "qualite": 0,
"cout": 0 "cout": 0
}, },
"gemme": {
"type": "",
"description": "",
"cout": 0,
"taille": 0,
"purete": 0,
"inertie": 0,
"enchantabilite": 0,
"qualite": 0
},
"conteneur": { "conteneur": {
"description": "", "description": "",
"descriptionmj": "", "descriptionmj": "",

View File

@ -0,0 +1,48 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}" />
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
</div>
</header>
{{!-- Sheet Body --}}
<section class="sheet-body">
<div class="form-group">
<label>Type</label>
<select name="data.type" id="type" data-dtype="String">
{{#select data.type}}
{{{gemmeTypeList}}}
{{/select}}
</select>
</div>
<div class="form-group">
<label>Taille</label>
<input class="attribute-value" type="text" name="data.taille" value="{{data.taille}}" data-dtype="Number" />
</div>
<div class="form-group">
<label>Pureté</label>
<input class="attribute-value" type="text" name="data.purete" value="{{data.purete}}" data-dtype="Number" />
</div>
<div class="form-group">
<label>Qualité</label>
<input class="attribute-value" type="text" name="data.qualite" value="{{data.qualite}}" data-dtype="Number" />
</div>
<div class="form-group">
<label>Inertie</label>
<input class="attribute-value" type="text" name="data.inertie" value="{{data.inertie}}" data-dtype="Number" />
</div>
<div class="form-group">
<label>Enchantabilité</label>
<input class="attribute-value" type="text" name="data.enchantabilite" value="{{data.enchantabilite}}" data-dtype="Number" />
</div>
<div class="form-group">
<label>Prix</label>
<input class="attribute-value" type="text" name="data.cout" value="{{data.cout}}" data-dtype="Number" />
</div>
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.html"}}
</section>
</form>