Increase version

This commit is contained in:
sladecraven 2021-01-14 10:32:15 +01:00
parent a46250211f
commit b69c515a7c
9 changed files with 79 additions and 35 deletions

View File

@ -46,6 +46,7 @@ export class RdDActorSheet extends ActorSheet {
data.itemsByType.competence, data.itemsByType.competence,
item => item.data.categorie, item => item.data.categorie,
item => { item => {
item.data.isLevelUp = item.data.xp >= RdDItemCompetence.getCompetenceNextXp(item.data.niveau); // Flag de niveau à MAJ
this.actor.checkCompetenceXP(item.name); // Petite vérification experience this.actor.checkCompetenceXP(item.name); // Petite vérification experience
item.data.showCompetence = !data.data.showCompNiveauBase || (Number(item.data.niveau) != Number(RdDUtility.getLevelCategory(item.data.categorie))); item.data.showCompetence = !data.data.showCompNiveauBase || (Number(item.data.niveau) != Number(RdDUtility.getLevelCategory(item.data.categorie)));
// Ignorer les compétences 'troncs' à ce stade // Ignorer les compétences 'troncs' à ce stade
@ -62,6 +63,7 @@ export class RdDActorSheet extends ActorSheet {
if (!currentCarac.derivee) { if (!currentCarac.derivee) {
sum += parseInt(currentCarac.value); sum += parseInt(currentCarac.value);
} }
currentCarac.isLevelUp = (currentCarac.xp >= RdDUtility.getCaracNextXp(currentCarac.value));
} }
data.data.caracSum = sum; data.data.caracSum = sum;

View File

@ -1441,15 +1441,11 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
async checkCaracXP(caracName) { async checkCaracXP(caracName) {
let carac = this.data.data.carac[caracName]; let carac = this.data.data.carac[caracName];
console.log("XP check", carac, caracName);
if (carac && carac.xp > 0) { if (carac && carac.xp > 0) {
let xpNeeded = RdDUtility.getCaracNextXp(carac.value); let xpNeeded = RdDUtility.getCaracNextXp(carac.value);
if (carac.xp >= xpNeeded) { if (carac.xp >= xpNeeded) {
carac = duplicate(carac); carac = duplicate(carac);
carac.value = Number(carac.value) + 1; carac.value = Number(carac.value) + 1;
await this.updateCarac(caracName, carac.value);
carac.xp -= xpNeeded;
await this.updateCaracXP(caracName, carac.xp);
let xpData = { let xpData = {
alias: this.name, alias: this.name,
@ -1470,18 +1466,16 @@ export class RdDActor extends Actor {
if (competence && competence.data.xp > 0) { if (competence && competence.data.xp > 0) {
let xpNeeded = RdDItemCompetence.getCompetenceNextXp(competence.data.niveau); let xpNeeded = RdDItemCompetence.getCompetenceNextXp(competence.data.niveau);
if (competence.data.xp >= xpNeeded) { if (competence.data.xp >= xpNeeded) {
competence.data.xp -= xpNeeded; let newCompetence = duplicate(competence);
competence.data.niveau += 1; newCompetence.data.niveau += 1;
let update = { _id: competence._id, "data.xp": competence.data.xp, "data.niveau": competence.data.niveau };
await this.updateEmbeddedEntity("OwnedItem", update);
let xpData = { let xpData = {
alias: this.name, alias: this.name,
competence: competence.name, competence: newCompetence.name,
niveau: competence.data.niveau, niveau: newCompetence.data.niveau,
xp: competence.data.xp, xp: newCompetence.data.xp,
archetype: competence.data.niveau_archetype, archetype: newCompetence.data.niveau_archetype,
archetypeWarning: competence.data.niveau > competence.data.niveau_archetype archetypeWarning: newCompetence.data.niveau > competence.data.niveau_archetype
} }
ChatUtility.createChatMessage(this.name, "default", { ChatUtility.createChatMessage(this.name, "default", {
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, xpData) content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-competence-xp.html`, xpData)

View File

@ -164,6 +164,7 @@ export class RdDUtility {
'systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/actor-sheet-competence-partial.html',
//Items //Items
'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-competence-sheet.html',
'systems/foundryvtt-reve-de-dragon/templates/item-competencecreature-sheet.html', 'systems/foundryvtt-reve-de-dragon/templates/item-competencecreature-sheet.html',

View File

@ -575,6 +575,14 @@ ul, li {
.alterne-list > .list-item:nth-child(odd) { .alterne-list > .list-item:nth-child(odd) {
background: rgb(160, 130, 100, 0.05); background: rgb(160, 130, 100, 0.05);
} }
.xp-level-up {
margin: 0.125rem;
box-shadow: inset 0px 0px 1px #00000096;
border-radius: 0.25rem;
padding: 0.125rem;
flex: 1 1 5rem;
background: rgba(195, 152, 22, 0.5);
}
.blessures-list ul { .blessures-list ul {
display: flex; display: flex;

View File

@ -2,7 +2,7 @@
"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.2.18", "version": "1.2.19",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5", "minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.8", "compatibleCoreVersion": "0.7.8",

View File

@ -117,7 +117,11 @@
>{{#if data.editCaracComp}}Vérouiller{{else}}Dévérouiller{{/if}}</a></span> >{{#if data.editCaracComp}}Vérouiller{{else}}Dévérouiller{{/if}}</a></span>
<ul class="carac-list alterne-list"> <ul class="carac-list alterne-list">
{{#each data.carac as |carac key|}} {{#each data.carac as |carac key|}}
{{#if carac.isLevelUp}}
<li class="competence flexrow xp-level-up" data-attribute="{{key}}">
{{else}}
<li class="competence flexrow list-item" data-attribute="{{key}}"> <li class="competence flexrow list-item" data-attribute="{{key}}">
{{/if}}
{{#if carac.isTaille}} {{#if carac.isTaille}}
<span class="carac-label flexrow" name="data.carac.{{key}}.label">{{carac.label}}</span> <span class="carac-label flexrow" name="data.carac.{{key}}.label">{{carac.label}}</span>
<input class="carac-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.data.editCaracComp}}disabled{{/unless}} /> <input class="carac-value flexrow" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.data.editCaracComp}}disabled{{/unless}} />
@ -218,7 +222,11 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.competenceByCategory.generale as |comp key|}} {{#each data.competenceByCategory.generale as |comp key|}}
{{#if data.showCompetence}} {{#if data.showCompetence}}
{{#if comp.data.isLevelUp}}
<li class="item flexrow xp-level-up" data-item-id="{{comp._id}}">
{{else}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}"/>
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/> <input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
@ -241,7 +249,11 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.competenceByCategory.particuliere as |comp key|}} {{#each data.competenceByCategory.particuliere as |comp key|}}
{{#if data.showCompetence}} {{#if data.showCompetence}}
{{#if comp.data.isLevelUp}}
<li class="item flexrow xp-level-up" data-item-id="{{comp._id}}">
{{else}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}"/>
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/> <input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
@ -263,7 +275,11 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.competenceByCategory.specialisee as |comp key|}} {{#each data.competenceByCategory.specialisee as |comp key|}}
{{#if data.showCompetence}} {{#if data.showCompetence}}
{{#if comp.data.isLevelUp}}
<li class="item flexrow xp-level-up" data-item-id="{{comp._id}}">
{{else}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}"/>
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/> <input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
@ -288,7 +304,11 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.competenceByCategory.melee as |comp key|}} {{#each data.competenceByCategory.melee as |comp key|}}
{{#if data.showCompetence}} {{#if data.showCompetence}}
{{#if comp.data.isLevelUp}}
<li class="item flexrow xp-level-up" data-item-id="{{comp._id}}">
{{else}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}"/>
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/> <input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
@ -311,7 +331,11 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.competenceByCategory.tir as |comp key|}} {{#each data.competenceByCategory.tir as |comp key|}}
{{#if data.showCompetence}} {{#if data.showCompetence}}
{{#if comp.data.isLevelUp}}
<li class="item flexrow xp-level-up" data-item-id="{{comp._id}}">
{{else}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}"/>
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/> <input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
@ -334,7 +358,11 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.competenceByCategory.lancer as |comp key|}} {{#each data.competenceByCategory.lancer as |comp key|}}
{{#if data.showCompetence}} {{#if data.showCompetence}}
{{#if comp.data.isLevelUp}}
<li class="item flexrow xp-level-up" data-item-id="{{comp._id}}">
{{else}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}"/>
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"{{#unless @root.data.editCaracComp}}disabled{{/unless}}/> <input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number"{{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
@ -357,7 +385,11 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.competenceByCategory.connaissance as |comp key|}} {{#each data.competenceByCategory.connaissance as |comp key|}}
{{#if data.showCompetence}} {{#if data.showCompetence}}
{{#if comp.data.isLevelUp}}
<li class="item flexrow xp-level-up" data-item-id="{{comp._id}}">
{{else}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}"/>
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/> <input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
@ -380,7 +412,11 @@
<ul class="item-list alterne-list"> <ul class="item-list alterne-list">
{{#each data.competenceByCategory.draconic as |comp key|}} {{#each data.competenceByCategory.draconic as |comp key|}}
{{#if data.showCompetence}} {{#if data.showCompetence}}
{{#if comp.data.isLevelUp}}
<li class="item flexrow xp-level-up" data-item-id="{{comp._id}}">
{{else}}
<li class="item flexrow list-item" data-item-id="{{comp._id}}"> <li class="item flexrow list-item" data-item-id="{{comp._id}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/> <img class="sheet-competence-img" src="{{comp.img}}"/>
<span class="competence-label"><a>{{comp.name}}</a></span> <span class="competence-label"><a>{{comp.name}}</a></span>
<input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/> <input class="competence-value" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>

View File

@ -1,3 +1,4 @@
<h4>{{alias}} a progressé dans sa caractéristique {{carac}} ! </h4> <h4>La caractéristique {{carac}} de {{alias}} peut progresser ! </h4>
<div>Sa {{carac}} est désormais de {{value}} ! </div> <div>Son experience dans cette caractéristique est actuellement de {{xp}} </div>
<div>Son experience dans cette caractéristique est de {{xp}} </div> <div>Vous devez ouvrir votre fiche de personnage et appliquer (ou pas) l'augmentation manuellement.</div>

View File

@ -1,6 +1,8 @@
<h4>{{alias}} a progressé dans sa compétence {{competence}} ! </h4> <h4>{{alias}} peut progresser dans sa compétence {{competence}} ! </h4>
<div>Son niveau en {{competence}} est désormais de {{niveau}} pour un archétype de {{archetype}} ! </div> <div>Son niveau en {{competence}} peut évoluer à {{niveau}} pour un archétype de {{archetype}} ! </div>
<div>Son experience dans cette compétence est de {{xp}} </div> <div>Son experience dans cette compétence est de {{xp}}. </div>
<div>Vous devez ouvrir votre fiche de personnage et appliquer (ou pas) l'augmentation manuellement.</div>
{{#if archetypeWarning}} {{#if archetypeWarning}}
<div><strong>ATTENTION !!</strong> Votre compétence a dépassé l'archétype. Veuillez contrôler que votre archétype est à jour, ou bien réduire le niveau de cette compétence.</div> <div><strong>ATTENTION !!</strong> Si vous appliquez cette augmentation, votre compétence dépassera l'archétype.
Veuillez contrôler que votre archétype est à jour, ou bien ne pas augmenter le niveau de cette compétence.</div>
{{/if}} {{/if}}