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,
item => item.data.categorie,
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
item.data.showCompetence = !data.data.showCompNiveauBase || (Number(item.data.niveau) != Number(RdDUtility.getLevelCategory(item.data.categorie)));
// Ignorer les compétences 'troncs' à ce stade
@ -62,6 +63,7 @@ export class RdDActorSheet extends ActorSheet {
if (!currentCarac.derivee) {
sum += parseInt(currentCarac.value);
}
currentCarac.isLevelUp = (currentCarac.xp >= RdDUtility.getCaracNextXp(currentCarac.value));
}
data.data.caracSum = sum;

View File

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

View File

@ -2,7 +2,7 @@
"name": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"description": "Rêve de Dragon RPG for FoundryVTT",
"version": "1.2.18",
"version": "1.2.19",
"manifestPlusVersion": "1.0.0",
"minimumCoreVersion": "0.7.5",
"compatibleCoreVersion": "0.7.8",

View File

@ -117,7 +117,11 @@
>{{#if data.editCaracComp}}Vérouiller{{else}}Dévérouiller{{/if}}</a></span>
<ul class="carac-list alterne-list">
{{#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}}">
{{/if}}
{{#if carac.isTaille}}
<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}} />
@ -218,19 +222,23 @@
<ul class="item-list alterne-list">
{{#each data.competenceByCategory.generale as |comp key|}}
{{#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}}">
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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-xp" type="text" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
{{#if ../data.montrerArchetype}}
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
{{/if}}
</li>
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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-xp" type="text" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
{{#if ../data.montrerArchetype}}
<input class="competence-archetype" type="text" compname="{{comp.name}}" value="{{numberFormat comp.data.niveau_archetype decimals=0 sign=true}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
{{/if}}
</li>
{{/if}}
{{/each}}
</ul>
@ -241,7 +249,11 @@
<ul class="item-list alterne-list">
{{#each data.competenceByCategory.particuliere as |comp key|}}
{{#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}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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}}/>
@ -263,8 +275,12 @@
<ul class="item-list alterne-list">
{{#each data.competenceByCategory.specialisee as |comp key|}}
{{#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}}">
<img class="sheet-competence-img" src="{{comp.img}}"/>
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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-xp" type="text" compname="{{comp.name}}" value="{{comp.data.xp}}" data-dtype="number" {{#unless @root.data.editCaracComp}}disabled{{/unless}}/>
@ -288,7 +304,11 @@
<ul class="item-list alterne-list">
{{#each data.competenceByCategory.melee as |comp key|}}
{{#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}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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}}/>
@ -311,7 +331,11 @@
<ul class="item-list alterne-list">
{{#each data.competenceByCategory.tir as |comp key|}}
{{#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}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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}}/>
@ -334,7 +358,11 @@
<ul class="item-list alterne-list">
{{#each data.competenceByCategory.lancer as |comp key|}}
{{#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}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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}}/>
@ -357,7 +385,11 @@
<ul class="item-list alterne-list">
{{#each data.competenceByCategory.connaissance as |comp key|}}
{{#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}}">
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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}}/>
@ -380,8 +412,12 @@
<ul class="item-list alterne-list">
{{#each data.competenceByCategory.draconic as |comp key|}}
{{#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}}">
<img class="sheet-competence-img" src="{{comp.img}}"/>
{{/if}}
<img class="sheet-competence-img" src="{{comp.img}}"/>
<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-xp" type="text" name="data.competenceByCategory.draconic[{{key}}].data.xp" compname="{{comp.name}}" value="{{comp.data.xp}}" 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>
<div>Sa {{carac}} est désormais de {{value}} ! </div>
<div>Son experience dans cette caractéristique est de {{xp}} </div>
<h4>La caractéristique {{carac}} de {{alias}} peut progresser ! </h4>
<div>Son experience dans cette caractéristique est actuellement 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>
<div>Son niveau en {{competence}} est désormais de {{niveau}} pour un archétype de {{archetype}} ! </div>
<div>Son experience dans cette compétence est de {{xp}} </div>
<h4>{{alias}} peut progresser dans sa compétence {{competence}} ! </h4>
<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>Vous devez ouvrir votre fiche de personnage et appliquer (ou pas) l'augmentation manuellement.</div>
{{#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}}