Ajout bouton augmenter niveau #475
@ -440,6 +440,14 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
RdDUtility.toggleAfficheContenu(myID);
|
RdDUtility.toggleAfficheContenu(myID);
|
||||||
this.render(true);
|
this.render(true);
|
||||||
});
|
});
|
||||||
|
html.find('.carac-xp-augmenter').click((event) => {
|
||||||
|
let caracName = event.currentTarget.name.replace("augmenter.", "");
|
||||||
|
this.actor.updateCaracXPAuto(caracName);
|
||||||
|
});
|
||||||
|
html.find('.competence-xp-augmenter').click((event) => {
|
||||||
|
let compName = event.currentTarget.attributes.compname.value;
|
||||||
|
this.actor.updateCompetenceXPAuto(compName);
|
||||||
|
});
|
||||||
|
|
||||||
if (this.options.editCaracComp) {
|
if (this.options.editCaracComp) {
|
||||||
// On carac change
|
// On carac change
|
||||||
|
@ -793,6 +793,40 @@ export class RdDActor extends Actor {
|
|||||||
await this.update({ [`data.carac.${caracName}.xp`]: caracXP ?? 0 });
|
await this.update({ [`data.carac.${caracName}.xp`]: caracXP ?? 0 });
|
||||||
this.checkCaracXP(caracName);
|
this.checkCaracXP(caracName);
|
||||||
}
|
}
|
||||||
|
async updateCaracXPAuto(caracName) {
|
||||||
|
if (caracName == 'Taille') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let carac = RdDActor._findCaracByName(Misc.templateData(this).carac, caracName);
|
||||||
|
if (carac) {
|
||||||
|
carac = duplicate(carac);
|
||||||
|
let xp = Number(carac.xp);
|
||||||
|
let value = Number(carac.value);
|
||||||
|
while (xp >= RdDCarac.getCaracNextXp(value) && xp > 0) {
|
||||||
|
xp -= RdDCarac.getCaracNextXp(value);
|
||||||
|
value++;
|
||||||
|
}
|
||||||
|
carac.xp = xp;
|
||||||
|
carac.value = value;
|
||||||
|
await this.update({ [`data.carac.${caracName}`]: carac });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async updateCompetenceXPAuto(compName) {
|
||||||
|
let competence = this.getCompetence(compName);
|
||||||
|
if (competence) {
|
||||||
|
let compData = Misc.data(competence);
|
||||||
|
let xp = Number(compData.data.xp);
|
||||||
|
let niveau = Number(compData.data.niveau);
|
||||||
|
while (xp >= RdDItemCompetence.getCompetenceNextXp(niveau) && xp > 0) {
|
||||||
|
xp -= RdDItemCompetence.getCompetenceNextXp(niveau);
|
||||||
|
niveau++;
|
||||||
|
}
|
||||||
|
competence.update({
|
||||||
|
"data.xp": xp,
|
||||||
|
"data.niveau": niveau,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCreatureCompetence(compName, fieldName, compValue) {
|
async updateCreatureCompetence(compName, fieldName, compValue) {
|
||||||
@ -2002,7 +2036,7 @@ export class RdDActor extends Actor {
|
|||||||
value: niveauSuivant,
|
value: niveauSuivant,
|
||||||
xp: carac.xp
|
xp: carac.xp
|
||||||
}
|
}
|
||||||
if (display){
|
if (display) {
|
||||||
ChatUtility.createChatMessage(this.name, "default", {
|
ChatUtility.createChatMessage(this.name, "default", {
|
||||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, checkXp)
|
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-actor-carac-xp.html`, checkXp)
|
||||||
});
|
});
|
||||||
|
@ -219,7 +219,7 @@ export class RdDUtility {
|
|||||||
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
Handlebars.registerHelper('caseTmr-label', coord => TMRUtility.getTMRLabel(coord));
|
||||||
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
|
Handlebars.registerHelper('caseTmr-type', coord => TMRUtility.getTMRType(coord));
|
||||||
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
|
Handlebars.registerHelper('typeTmr-name', coord => TMRUtility.typeTmrName(coord));
|
||||||
Handlebars.registerHelper('equals', (a, b) => a == b);
|
|
||||||
Handlebars.registerHelper('sortCompetence', competences => competences.sort((a, b) => {
|
Handlebars.registerHelper('sortCompetence', competences => competences.sort((a, b) => {
|
||||||
if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) {
|
if (a.name.startsWith("Survie") && b.name.startsWith("Survie")) {
|
||||||
if (a.name.includes("Cité")) return -1;
|
if (a.name.includes("Cité")) return -1;
|
||||||
|
@ -471,15 +471,15 @@ table {border: 1px solid #7a7971;}
|
|||||||
.rdd-roll-part{
|
.rdd-roll-part{
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-radius: 6px; padding: 3px;
|
border-radius: 6px; padding: 3px;
|
||||||
background:linear-gradient(30deg, rgba(191, 149, 63, 0.3), rgba(252, 246, 186, 0.3), rgba(179, 135, 40, 0.3), rgba(251, 245, 183, 0.3), rgba(170, 119, 28, 0.3));
|
background: linear-gradient(30deg, rgba(191, 149, 63, 0.3), rgba(252, 246, 186, 0.3), rgba(179, 135, 40, 0.3), rgba(251, 245, 183, 0.3), rgba(170, 119, 28, 0.3));
|
||||||
}
|
}
|
||||||
.rdd-roll-sign{
|
.rdd-roll-sign{
|
||||||
border-radius: 6px; padding: 3px;
|
border-radius: 6px; padding: 3px;
|
||||||
background:linear-gradient(30deg, rgba(61, 55, 93, 0.3), rgba(178, 179, 196, 0.3), rgba(59, 62, 63, 0.6), rgba(206, 204, 199, 0.3), rgba(61, 46, 49, 0.3));
|
background: linear-gradient(30deg, rgba(61, 55, 93, 0.3), rgba(178, 179, 196, 0.3), rgba(59, 62, 63, 0.6), rgba(206, 204, 199, 0.3), rgba(61, 46, 49, 0.3));
|
||||||
}
|
}
|
||||||
.rdd-roll-norm{
|
.rdd-roll-norm{
|
||||||
border-radius: 6px; padding: 3px;
|
border-radius: 6px; padding: 3px;
|
||||||
background:linear-gradient(30deg, rgba(7, 76, 0, 0.3), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.1), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.3));
|
background: linear-gradient(30deg, rgba(7, 76, 0, 0.3), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.1), rgba(66, 163, 65, 0.2), rgba(184, 226, 163, 0.3));
|
||||||
}
|
}
|
||||||
.rdd-roll-notSign, .rdd-roll-echec{
|
.rdd-roll-notSign, .rdd-roll-echec{
|
||||||
border-radius: 6px; padding: 3px;
|
border-radius: 6px; padding: 3px;
|
||||||
@ -714,7 +714,7 @@ ul, li {
|
|||||||
border-radius: 0.25rem;
|
border-radius: 0.25rem;
|
||||||
padding: 0.125rem;
|
padding: 0.125rem;
|
||||||
flex: 1 1 5rem;
|
flex: 1 1 5rem;
|
||||||
background: rgba(195, 152, 22, 0.5) !important;
|
background: linear-gradient(30deg, rgba(191, 149, 63, 0.5), rgba(252, 246, 186, 0.5), rgba(179, 135, 40, 0.5), rgba(251, 245, 183, 0.5), rgba(170, 119, 28, 0.3)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.blessures-list ul {
|
.blessures-list ul {
|
||||||
@ -1473,7 +1473,7 @@ display: inline-flex;
|
|||||||
|
|
||||||
.tooltip .ttt-xp {
|
.tooltip .ttt-xp {
|
||||||
width: 250px;
|
width: 250px;
|
||||||
background: rgba(220,220,210,0.95);
|
background: rgba(220,220,210,0.95) !important;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
padding: 3px 0;
|
padding: 3px 0;
|
||||||
|
@ -4,6 +4,12 @@
|
|||||||
<img class="sheet-competence-img" src="{{img}}"/>
|
<img class="sheet-competence-img" src="{{img}}"/>
|
||||||
<span class="competence-label">{{name}}</span>
|
<span class="competence-label">{{name}}</span>
|
||||||
</a>
|
</a>
|
||||||
|
{{#if data.isLevelUp}}
|
||||||
|
<span class="tooltiptext ttt-xp">Vous pouvez dépenser {{data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
|
||||||
|
<a class="item-control competence-xp-augmenter" compname="{{name}}" title="Augmenter">
|
||||||
|
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||||
|
</a>
|
||||||
|
{{/if}}
|
||||||
<input class="competence-value" type="text" compname="{{name}}"
|
<input class="competence-value" type="text" compname="{{name}}"
|
||||||
value="{{numberFormat data.niveau decimals=0 sign=true}}" data-dtype="number"
|
value="{{numberFormat data.niveau decimals=0 sign=true}}" data-dtype="number"
|
||||||
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
||||||
@ -20,12 +26,11 @@
|
|||||||
value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
|
value="{{numberFormat data.niveau_archetype decimals=0 sign=true}}" data-dtype="number"
|
||||||
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
{{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if data.isLevelUp}}
|
{{#unless @root.options.hideControls}}
|
||||||
<span class="tooltiptext ttt-xp">Vous pouvez dépenser {{data.xpNext}} points d'Experience pour augmenter de 1 votre compétence {{name}}</span>
|
<div class="item-controls">
|
||||||
{{/if}}
|
<a class="item-control item-edit" title="Modifier"><i class="fas fa-edit"></i></a>
|
||||||
<div class="item-controls {{#if @root.options.hideControls}}hidden-controls{{/if}}">
|
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
|
||||||
<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>
|
</div>
|
||||||
|
{{/unless}}
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
@ -121,7 +121,7 @@
|
|||||||
<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}}
|
{{#if carac.isLevelUp}}
|
||||||
<li class="competence flexrow xp-level-up" data-attribute="{{key}}">
|
<li class="competence flexrow item-list xp-level-up" data-attribute="{{key}}">
|
||||||
{{else}}
|
{{else}}
|
||||||
<li class="competence flexrow list-item" data-attribute="{{key}}">
|
<li class="competence flexrow list-item" data-attribute="{{key}}">
|
||||||
{{/if}}
|
{{/if}}
|
||||||
@ -136,16 +136,21 @@
|
|||||||
<label class="carac-xp"/>
|
<label class="carac-xp"/>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if carac.isLevelUp}}
|
{{#if carac.isLevelUp}}
|
||||||
<span class="carac-label tooltip" name="data.carac.{{key}}.label">
|
<span class="carac-label tooltip" name="data.carac.{{key}}.label">
|
||||||
<span class="tooltiptext ttt-xp">
|
<span class="tooltiptext ttt-xp">
|
||||||
Vous pouvez dépenser {{carac.xpNext}} points d'Experience pour augmenter de 1 votre caractéristique {{carac.label}}
|
Vous pouvez dépenser {{carac.xpNext}} points d'Experience pour augmenter de 1 votre caractéristique {{carac.label}}
|
||||||
</span>
|
</span>
|
||||||
<a name={{key}}>{{carac.label}}</a></span>
|
<a name={{key}}>{{carac.label}}</a></span>
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="carac-label tooltip" name="data.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
|
<span class="carac-label tooltip" name="data.carac.{{key}}.label"><a name={{key}}>{{carac.label}}</a></span>
|
||||||
|
{{/if}}
|
||||||
|
<input class="carac-value" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
||||||
|
<input class="carac-xp" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
||||||
|
{{#if carac.isLevelUp}}
|
||||||
|
<a class="item-control carac-xp-augmenter" name="augmenter.{{key}}" title="Augmenter">
|
||||||
|
<i class="fas fa-arrow-alt-circle-up"></i>
|
||||||
|
</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<input class="carac-value" type="text" name="data.carac.{{key}}.value" value="{{carac.value}}" data-dtype="{{carac.type}}" {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
|
||||||
<input class="carac-xp" type="text" name="data.carac.{{key}}.xp" value="{{carac.xp}}" data-dtype="number" {{#unless @root.options.editCaracComp}}disabled{{/unless}} />
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
Reference in New Issue
Block a user