Merge branch 'issue_69_add_experience_button' into 'dev'

Issue 69: Adding incremental buttons to honor, glory and status. Renaming...

See merge request teaml5r/l5r5e!54
This commit is contained in:
Litasa
2026-02-25 21:39:21 +00:00
16 changed files with 157 additions and 42 deletions

View File

@@ -492,7 +492,10 @@
"rarity_modifier": "Rarity modifier",
"item_pattern": "Item Patterns",
"signature_scroll": "Signature Scrolls",
"school_curriculum_journal": "Drop curriculum's journal in sheet to link it"
"school_curriculum_journal": "Drop curriculum's journal in sheet to link it",
"warning": {
"total_less_then_spent": "Total Experience is less then Used Experience."
}
},
"character_types": {
"character": "Player Character",

View File

@@ -492,7 +492,10 @@
"rarity_modifier": "Modificador de rareza",
"item_pattern": "Patrones de objetos",
"signature_scroll": "Pergaminos espaciales",
"school_curriculum_journal": "Arrastra el diario del programa en la hoja para vincularlo"
"school_curriculum_journal": "Arrastra el diario del programa en la hoja para vincularlo",
"warning": {
"total_less_then_spent": "La experiencia total es menor que la experiencia utilizada."
}
},
"character_types": {
"character": "Personaje jugador",

View File

@@ -492,7 +492,10 @@
"rarity_modifier": "Modificateur de rareté",
"item_pattern": "Procédés de fabrication",
"signature_scroll": "Rouleaux de marque",
"school_curriculum_journal": "Déposer un journal de Cursus dans la feuille pour le lier"
"school_curriculum_journal": "Déposer un journal de Cursus dans la feuille pour le lier",
"warning": {
"total_less_then_spent": "L'expérience totale est inférieure à l'expérience utilisée."
}
},
"character_types": {
"character": "Personnage Joueur",

View File

@@ -492,7 +492,10 @@
"rarity_modifier": "Modificatore rarità",
"item_pattern": "Item Patterns",
"signature_scroll": "Signature Scrolls",
"school_curriculum_journal": "Trascina il diario del curriculum sulla scheda per collegarlo"
"school_curriculum_journal": "Trascina il diario del curriculum sulla scheda per collegarlo",
"warning": {
"total_less_then_spent": "L'esperienza totale è inferiore all'esperienza utilizzata."
}
},
"character_types": {
"character": "Personaggio giocante",

View File

@@ -624,6 +624,36 @@ export class BaseCharacterSheetL5r5e extends BaseSheetL5r5e {
});
break;
case "honor":
await this.actor.update({
system: {
social: {
honor: Math.max(0, this.actor.system.social.honor + mod),
},
},
});
break;
case "glory":
await this.actor.update({
system: {
social: {
glory: Math.max(0, this.actor.system.social.glory + mod),
},
},
});
break;
case "status":
await this.actor.update({
system: {
social: {
status: Math.max(0, this.actor.system.social.status + mod),
},
},
});
break;
default:
console.warn("L5R5E | BCS | Unsupported type", type);
break;

View File

@@ -56,6 +56,9 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
// Split Others advancements, and calculate xp spent and add it to total
this._prepareOthersAdvancement(sheetData);
// Update spent_xp to actor
this.actor.system.xp_spent = sheetData.data.system.xp_spent;
// Total
sheetData.data.system.xp_saved = Math.floor(
parseInt(sheetData.data.system.xp_total) - parseInt(sheetData.data.system.xp_spent)
@@ -114,6 +117,9 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
// Money +/-
html.find(".money-control").on("click", this._modifyMoney.bind(this));
// XP +/-
html.find(".xp-control").on("click", this._modifyXP.bind(this));
// Advancements Tab to current rank onload
// TODO class "Active" Bug on load, dunno why :/
this._tabs
@@ -285,6 +291,35 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
this.render(false);
}
/**
* Add or Subtract XP (+/- buttons)
* @param {Event} event
* @private
*/
async _modifyXP(event) {
event.preventDefault();
event.stopPropagation();
const elmt = $(event.currentTarget);
let mod = elmt.data("value");
if (!mod) {
return;
}
const new_xp_total = Math.max(0, this.actor.system.xp_total + mod);
this.actor.update({
system: {
xp_total: new_xp_total,
},
});
if(this.actor.system.xp_spent > new_xp_total) {
ui.notifications.warn("l5r5e.advancements.warning.total_less_then_spent", { localize: true })
}
this.render(false);
}
/**
* Add +1 to actor school rank
* @param {Event} event

File diff suppressed because one or more lines are too long

View File

@@ -10,8 +10,6 @@
.readiness {
flex: 0 0 100%;
display: flex;
flex-wrap: wrap;
ul {
display: flex;
@@ -21,15 +19,20 @@
li {
flex: 25%;
display: inline-grid;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
.attributes-buttons {
position: relative;
line-height: 13px;
top: 0.3rem;
right: 1.2rem;
width: 12px;
.increment-control {
position: absolute;
right: -0.70rem;
top: 15%;
display: flex;
flex-direction: column;
gap:0.1rem;
line-height: 1;
}
strong {
@@ -40,14 +43,19 @@
}
label {
flex: 100%;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
input {
background: transparent;
border: 0 none;
text-align: center;
margin: 0.3rem 1.6rem 0 1.5rem;
margin: 0;
padding: 0;
width: 2rem;
}
&:after {
@@ -55,8 +63,6 @@
width: 2rem;
height: 2rem;
position: absolute;
right: calc(50% - 0.9rem);
top: 0.1rem;
background: transparent url("../assets/icons/circle.svg") no-repeat 0 0;
background-size: contain;
opacity: 0.25;
@@ -64,9 +70,6 @@
}
&:nth-child(1) {
input {
margin: 0.3rem 1rem 0 1.5rem;
}
&:after {
transform: rotate(0deg);
}
@@ -79,9 +82,6 @@
}
&:nth-child(3) {
input {
margin: 0.3rem 1rem 0 1.5rem;
}
&:after {
transform: rotate(180deg);
}

View File

@@ -326,7 +326,7 @@
margin: 0.25rem 0;
flex-direction: row-reverse;
strong {
flex: 0 0 calc(100% - 3.5rem);
flex: 0 0 calc(100% - 4.5rem);
}
input {
flex: 0 0 3rem;
@@ -444,7 +444,7 @@
width: 3.5rem;
}
}
.attributes-buttons {
.increment-control {
line-height: 13px;
position: relative;
top: 0.2rem;
@@ -751,12 +751,22 @@
flex: calc(100% / 3);
padding: 0.5rem;
font-size: 0.85rem;
align-items: center;
input {
margin-left: 0.5rem;
}
}
.xp-buttons,
.money-buttons {
line-height: 13px;
padding-left: 0.3em;
}
.increment-control {
display: flex;
flex-direction: column;
align-items: center;
padding-left: 0.2rem;
flex: none;
}
}

View File

@@ -13,9 +13,9 @@
<div class="readiness">
<ul>
<li>
<label class="attribute-label-casualties">
<label class="attribute-label casualties">
<input name="system.battle_readiness.casualties_strength.value" type="number" value="{{data.system.battle_readiness.casualties_strength.value}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="attributes-buttons">
<span class="increment-control casualties">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="casualties" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="casualties" data-value="-1"></i>
</span>
@@ -23,15 +23,15 @@
<strong>{{localize 'l5r5e.army.battle_readiness.casualties'}}</strong>
</li>
<li>
<label class="attribute-label-strength">
<label class="attribute-label strength">
<input name="system.battle_readiness.casualties_strength.max" type="number" value="{{data.system.battle_readiness.casualties_strength.max}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
<strong>{{localize 'l5r5e.army.battle_readiness.strength'}}</strong>
</li>
<li>
<label class="attribute-label-panic">
<label class="attribute-label panic">
<input name="system.battle_readiness.panic_discipline.value" type="number" value="{{data.system.battle_readiness.panic_discipline.value}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="attributes-buttons">
<span class="increment-control panic">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="panic" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="panic" data-value="-1"></i>
</span>
@@ -39,7 +39,7 @@
<strong>{{localize 'l5r5e.army.battle_readiness.panic'}}</strong>
</li>
<li>
<label class="attribute-label-discipline">
<label class="attribute-label discipline">
<input name="system.battle_readiness.panic_discipline.max" type="number" value="{{data.system.battle_readiness.panic_discipline.max}}" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
<strong>{{localize 'l5r5e.army.battle_readiness.discipline'}}</strong>

View File

@@ -7,7 +7,7 @@
<label class="attribute-label">
<strong>{{localize 'l5r5e.attributes.fatigue'}}</strong>
<input class="centered-input select-on-focus" type="number" name="system.fatigue.value" value="{{data.system.fatigue.value}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="attributes-buttons">
<span class="increment-control fatigue">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="fatigue" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="fatigue" data-value="-1"></i>
</span>
@@ -22,7 +22,7 @@
<label class="attribute-label">
<strong>{{localize 'l5r5e.attributes.strife'}}</strong>
<input class="centered-input select-on-focus" type="number" name="system.strife.value" value="{{data.system.strife.value}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="attributes-buttons">
<span class="increment-control strife">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="strife" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="strife" data-value="-1"></i>
</span>

View File

@@ -3,6 +3,10 @@
<label class="attribute-label">
{{localize 'l5r5e.advancements.total'}}
<input class="centered-input select-on-focus" type="number" name="system.xp_total" value="{{data.system.xp_total}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="increment-control xp">
<i class="xp-control pointer-choice fa fa-plus-square" data-type="xp" data-value="1"></i>
<i class="xp-control pointer-choice fa fa-minus-square" data-type="xp" data-value="-1"></i>
</span>
</label>
<label class="attribute-label">
{{localize 'l5r5e.advancements.spent'}}

View File

@@ -1,25 +1,25 @@
<fieldset class="money money-wrapper">
<legend class="section-header">{{localize 'l5r5e.money.title'}}</legend>
<label>
<label class="attribute-label money">
{{localize 'l5r5e.money.koku'}}
<input name="system.money.koku" type="number" value="{{data.system.money.koku}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="money-buttons">
<span class="increment-control money">
<i class="money-control pointer-choice fa fa-plus-square" data-type="koku" data-value="1"></i>
<i class="money-control pointer-choice fa fa-minus-square" data-type="koku" data-value="-1"></i>
</span>
</label>
<label>
<label class="attribute-label money">
{{localize 'l5r5e.money.bu'}}
<input name="system.money.bu" type="number" value="{{data.system.money.bu}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="money-buttons">
<span class="increment-control money">
<i class="money-control pointer-choice fa fa-plus-square" data-type="bu" data-value="1"></i>
<i class="money-control pointer-choice fa fa-minus-square" data-type="bu" data-value="-1"></i>
</span>
</label>
<label>
<label class="attribute-label money">
{{localize 'l5r5e.money.zeni'}}
<input name="system.money.zeni" type="number" value="{{data.system.money.zeni}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="money-buttons">
<span class="increment-control money">
<i class="money-control pointer-choice fa fa-plus-square" data-type="zeni" data-value="1"></i>
<i class="money-control pointer-choice fa fa-minus-square" data-type="zeni" data-value="-1"></i>
</span>

View File

@@ -2,18 +2,30 @@
<li>
<label class="attribute-label centered-input">
<strong>{{localize 'l5r5e.social.honor'}}</strong>
<span class="increment-control honor">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="honor" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="honor" data-value="-1"></i>
</span>
<input class="centered-input select-on-focus" type="number" name="system.social.honor" value="{{data.system.social.honor}}" data-dtype="Number" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
</li>
<li>
<label class="attribute-label centered-input">
<strong>{{localize 'l5r5e.social.glory'}}</strong>
<span class="increment-control glory">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="glory" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="glory" data-value="-1"></i>
</span>
<input class="centered-input select-on-focus" type="number" name="system.social.glory" value="{{data.system.social.glory}}" data-dtype="Number" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
</li>
<li>
<label class="attribute-label centered-input">
<strong>{{localize 'l5r5e.social.status'}}</strong>
<span class="increment-control status">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="status" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="status" data-value="-1"></i>
</span>
<input class="centered-input select-on-focus" type="number" name="system.social.status" value="{{data.system.social.status}}" data-dtype="Number" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
</li>

View File

@@ -7,7 +7,7 @@
<label class="attribute-label">
<strong>{{localize 'l5r5e.attributes.fatigue'}}</strong>
<input class="centered-input select-on-focus" type="number" name="system.fatigue.value" value="{{data.system.fatigue.value}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="attributes-buttons">
<span class="increment-control fatigue">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="fatigue" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="fatigue" data-value="-1"></i>
</span>
@@ -22,7 +22,7 @@
<label class="attribute-label">
<strong>{{localize 'l5r5e.attributes.strife'}}</strong>
<input class="centered-input select-on-focus" type="number" name="system.strife.value" value="{{data.system.strife.value}}" data-dtype="Number" min="0" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
<span class="attributes-buttons">
<span class="increment-control strife">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="strife" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="strife" data-value="-1"></i>
</span>

View File

@@ -2,18 +2,30 @@
<li>
<label class="attribute-label centered-input">
<strong>{{localize 'l5r5e.social.honor'}}</strong>
<span class="increment-control honor">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="honor" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="honor" data-value="-1"></i>
</span>
<input class="centered-input select-on-focus" type="number" name="system.social.honor" value="{{data.system.social.honor}}" data-dtype="Number" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
</li>
<li>
<label class="attribute-label centered-input">
<strong>{{localize 'l5r5e.social.glory'}}</strong>
<span class="increment-control glory">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="glory" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="glory" data-value="-1"></i>
</span>
<input class="centered-input select-on-focus" type="number" name="system.social.glory" value="{{data.system.social.glory}}" data-dtype="Number" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
</li>
<li>
<label class="attribute-label centered-input">
<strong>{{localize 'l5r5e.social.status'}}</strong>
<span class="increment-control status">
<i class="addsub-control pointer-choice fa fa-plus-square" data-type="status" data-value="1"></i>
<i class="addsub-control pointer-choice fa fa-minus-square" data-type="status" data-value="-1"></i>
</span>
<input class="centered-input select-on-focus" type="number" name="system.social.status" value="{{data.system.social.status}}" data-dtype="Number" placeholder="0" {{^if data.editable_not_soft_locked}}disabled{{/if}}/>
</label>
</li>