Some progression work, and fixed start rank level to 1
This commit is contained in:
@@ -252,8 +252,9 @@
|
|||||||
"total": "Total",
|
"total": "Total",
|
||||||
"spent": "Used",
|
"spent": "Used",
|
||||||
"saved": "Saved",
|
"saved": "Saved",
|
||||||
"rank": "Rank Total Xp: ",
|
"rank": "Rank Total Xp",
|
||||||
"curriculum": "in curriculum"
|
"curriculum": "in curriculum",
|
||||||
|
"curriculum_validate": "Complete this rank"
|
||||||
},
|
},
|
||||||
"npc": {
|
"npc": {
|
||||||
"types": {
|
"types": {
|
||||||
|
|||||||
@@ -252,8 +252,9 @@
|
|||||||
"total": "Total",
|
"total": "Total",
|
||||||
"spent": "Usada",
|
"spent": "Usada",
|
||||||
"saved": "Restante",
|
"saved": "Restante",
|
||||||
"rank": "Rank Total Xp: ",
|
"rank": "Rank Total Xp",
|
||||||
"curriculum": "in curriculum"
|
"curriculum": "in curriculum",
|
||||||
|
"curriculum_validate": "Complete this rank"
|
||||||
},
|
},
|
||||||
"npc": {
|
"npc": {
|
||||||
"types": {
|
"types": {
|
||||||
|
|||||||
@@ -252,8 +252,9 @@
|
|||||||
"total": "Totale",
|
"total": "Totale",
|
||||||
"spent": "Dépensée",
|
"spent": "Dépensée",
|
||||||
"saved": "Restante",
|
"saved": "Restante",
|
||||||
"rank": "Xp Total du rang : ",
|
"total_xp_rank": "Xp Total du rang",
|
||||||
"curriculum": "Inclus dans le cursus"
|
"curriculum": "Inclus dans le cursus",
|
||||||
|
"curriculum_validate": "Valider la progression"
|
||||||
},
|
},
|
||||||
"npc": {
|
"npc": {
|
||||||
"types": {
|
"types": {
|
||||||
|
|||||||
@@ -64,25 +64,6 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if technique is allowed for this character
|
|
||||||
if (
|
|
||||||
!game.user.isGM &&
|
|
||||||
item.data.type === "technique" &&
|
|
||||||
!this.actor.data.data.techniques[item.data.data.technique_type]
|
|
||||||
) {
|
|
||||||
new Dialog({
|
|
||||||
title: game.i18n.localize("l5r5e.techniques.title"),
|
|
||||||
content: game.i18n.localize("l5r5e.techniques.not_allowed"),
|
|
||||||
buttons: {
|
|
||||||
ok: {
|
|
||||||
label: game.i18n.localize("l5r5e.global.ok"),
|
|
||||||
icon: '<i class="fas fa-check"></i>',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}).render(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dropped a item with same "id" as one owned, add qte instead
|
// Dropped a item with same "id" as one owned, add qte instead
|
||||||
if (item.data.data.quantity && this.actor.data.items) {
|
if (item.data.data.quantity && this.actor.data.items) {
|
||||||
const tmpItem = this.actor.data.items.find((e) => e.name === item.name && e.type === item.type);
|
const tmpItem = this.actor.data.items.find((e) => e.name === item.name && e.type === item.type);
|
||||||
@@ -104,6 +85,31 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Item subtype specific
|
||||||
|
switch (item.data.type) {
|
||||||
|
case "advancement":
|
||||||
|
// Modify the bought at rank to the current actor rank
|
||||||
|
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "technique":
|
||||||
|
// Check if technique is allowed for this character
|
||||||
|
if (!game.user.isGM && !this.actor.data.data.techniques[item.data.data.technique_type]) {
|
||||||
|
new Dialog({
|
||||||
|
title: game.i18n.localize("l5r5e.techniques.title"),
|
||||||
|
content: game.i18n.localize("l5r5e.techniques.not_allowed"),
|
||||||
|
buttons: {
|
||||||
|
ok: {
|
||||||
|
label: game.i18n.localize("l5r5e.global.ok"),
|
||||||
|
icon: '<i class="fas fa-check"></i>',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).render(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Ok add item - Foundry override cause props
|
// Ok add item - Foundry override cause props
|
||||||
const allowed = Hooks.call("dropActorSheetData", this.actor, this, item);
|
const allowed = Hooks.call("dropActorSheetData", this.actor, this, item);
|
||||||
if (allowed === false) {
|
if (allowed === false) {
|
||||||
@@ -159,6 +165,18 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
html.find(`.item-curriculum`).on("click", (event) => {
|
html.find(`.item-curriculum`).on("click", (event) => {
|
||||||
this._switchSubItemCurriculum(event);
|
this._switchSubItemCurriculum(event);
|
||||||
});
|
});
|
||||||
|
html.find(`button[name=validate-curriculum]`).on("click", (event) => {
|
||||||
|
this.actor.data.data.identity.school_rank = this.actor.data.data.identity.school_rank + 1;
|
||||||
|
// Update actor
|
||||||
|
this.actor.update({
|
||||||
|
data: {
|
||||||
|
identity: {
|
||||||
|
school_rank: this.actor.data.data.identity.school_rank,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.render(false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,6 +198,12 @@ export class BaseSheetL5r5e extends ActorSheet {
|
|||||||
type: type,
|
type: type,
|
||||||
});
|
});
|
||||||
const item = this.actor.getOwnedItem(created._id);
|
const item = this.actor.getOwnedItem(created._id);
|
||||||
|
|
||||||
|
// assign current school rank to the new tech
|
||||||
|
if (item.data.type === "advancement") {
|
||||||
|
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
|
||||||
|
}
|
||||||
|
|
||||||
item.sheet.render(true);
|
item.sheet.render(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,33 +39,45 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
|
|||||||
getData() {
|
getData() {
|
||||||
const sheetData = super.getData();
|
const sheetData = super.getData();
|
||||||
|
|
||||||
// Sort Items by rank 0->6 for advancements tab
|
// Sort Items by rank 1->6 for advancements tab
|
||||||
sheetData.items.sort((a, b) => {
|
sheetData.items.sort((a, b) => {
|
||||||
return (a.data.bought_at_rank || 0) - (b.data.bought_at_rank || 0);
|
return (a.data.bought_at_rank || 1) - (b.data.bought_at_rank || 1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Min rank = 1
|
||||||
|
this.actor.data.data.identity.school_rank = Math.max(1, this.actor.data.data.identity.school_rank);
|
||||||
|
|
||||||
// Xp spent only in current rank
|
// Xp spent only in current rank
|
||||||
sheetData.data.xp_spent_rank = this.getXpSpentInThisRank();
|
const totalXp = this._getXpSpent();
|
||||||
|
sheetData.data.xp_spent_rank = totalXp.rank;
|
||||||
|
sheetData.data.xp_spent = totalXp.total;
|
||||||
|
sheetData.data.xp_saved = sheetData.data.xp_total - sheetData.data.xp_spent;
|
||||||
|
sheetData.data.xp_goal = CONFIG.l5r5e.xpPerRank[this.actor.data.data.identity.school_rank - 1] || null;
|
||||||
|
|
||||||
return sheetData;
|
return sheetData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current total xp spent for this rank
|
* Return the total xp spent and the current total xp spent for this rank
|
||||||
*/
|
*/
|
||||||
getXpSpentInThisRank() {
|
_getXpSpent() {
|
||||||
const currentRank = this.actor.data.data.identity.school_rank || 0;
|
const total = {
|
||||||
return this.actor.items.reduce((tot, item) => {
|
total: 0,
|
||||||
if (currentRank + 1 === item.data.data.rank) {
|
rank: 0,
|
||||||
let xp = item.data.data.xp_used || 0;
|
};
|
||||||
|
const currentRank = this.actor.data.data.identity.school_rank;
|
||||||
|
this.actor.items.map((item) => {
|
||||||
|
let xp = item.data.data.xp_used || 0;
|
||||||
|
total.total = total.total + xp;
|
||||||
|
|
||||||
|
if (currentRank === item.data.data.rank) {
|
||||||
// if not in curriculum, xp spent /2 for this item
|
// if not in curriculum, xp spent /2 for this item
|
||||||
if (!item.data.data.in_curriculum && xp > 0) {
|
if (!item.data.data.in_curriculum && xp > 0) {
|
||||||
xp = Math.floor(xp / 2);
|
xp = Math.floor(xp / 2);
|
||||||
}
|
}
|
||||||
return tot + xp;
|
total.rank = total.rank + xp;
|
||||||
}
|
}
|
||||||
return tot;
|
});
|
||||||
}, 0);
|
return total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ L5R5E.paths = {
|
|||||||
|
|
||||||
L5R5E.stances = ["earth", "air", "water", "fire", "void"];
|
L5R5E.stances = ["earth", "air", "water", "fire", "void"];
|
||||||
L5R5E.techniques = ["kata", "kiho", "invocation", "ritual", "shuji", "maho", "ninjutsu"];
|
L5R5E.techniques = ["kata", "kiho", "invocation", "ritual", "shuji", "maho", "ninjutsu"];
|
||||||
|
L5R5E.xpPerRank = [20, 24, 32, 44, 60];
|
||||||
|
|
||||||
// Map SkillId - CategoryId
|
// Map SkillId - CategoryId
|
||||||
L5R5E.skills = new Map();
|
L5R5E.skills = new Map();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"clan": "",
|
"clan": "",
|
||||||
"family": "",
|
"family": "",
|
||||||
"school": "",
|
"school": "",
|
||||||
"school_rank": 0,
|
"school_rank": 1,
|
||||||
"roles": ""
|
"roles": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,20 +2,15 @@
|
|||||||
<legend>{{ localize 'l5r5e.experience'}}</legend>
|
<legend>{{ localize 'l5r5e.experience'}}</legend>
|
||||||
<label class="attribute-label">
|
<label class="attribute-label">
|
||||||
{{ localize 'l5r5e.advancements.total' }}
|
{{ localize 'l5r5e.advancements.total' }}
|
||||||
<input class="centered-input select-on-focus" type="number" name="data.advancement.xp_total" value="{{ data.advancement.xp_total }}" data-dtype="Number" min="0" placeholder="0"/>
|
<input class="centered-input select-on-focus" type="number" name="data.xp_total" value="{{ data.xp_total }}" data-dtype="Number" min="0" placeholder="0"/>
|
||||||
</label>
|
</label>
|
||||||
<label class="attribute-label">
|
<label class="attribute-label">
|
||||||
{{ localize 'l5r5e.advancements.spent' }}
|
{{ localize 'l5r5e.advancements.spent' }}
|
||||||
<input class="centered-input select-on-focus" type="number" name="data.xp_spent" value="{{ data.xp_spent }}" data-dtype="Number" min="0" placeholder="0"/>
|
<input class="centered-input select-on-focus" type="number" name="data.xp_spent" value="{{ data.xp_spent }}" data-dtype="Number" min="0" placeholder="0" disabled/>
|
||||||
</label>
|
</label>
|
||||||
<label class="attribute-label">
|
<label class="attribute-label">
|
||||||
{{ localize 'l5r5e.advancements.saved' }}
|
{{ localize 'l5r5e.advancements.saved' }}
|
||||||
<input class="centered-input select-on-focus" type="number" name="data.advancement.xp_saved" value="{{ data.advancement.xp_saved }}" data-dtype="Number" min="0" placeholder="0"/>
|
<input class="centered-input select-on-focus" type="number" name="data.xp_saved" value="{{ data.xp_saved }}" data-dtype="Number" min="0" placeholder="0" disabled/>
|
||||||
</label>
|
|
||||||
|
|
||||||
<label class="attribute-label">
|
|
||||||
{{ localize 'l5r5e.advancements.rank' }}
|
|
||||||
{{ data.xp_spent_rank }}
|
|
||||||
</label>
|
</label>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset class="advancement">
|
<fieldset class="advancement">
|
||||||
@@ -37,6 +32,22 @@
|
|||||||
{{> 'systems/l5r5e/templates/actors/character/advancement.html' advancement=advancement editable=../editable }}
|
{{> 'systems/l5r5e/templates/actors/character/advancement.html' advancement=advancement editable=../editable }}
|
||||||
{{/ifCond}}
|
{{/ifCond}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
<tfooter class="flex">
|
||||||
|
<tr class="flexrow row">
|
||||||
|
<th class="">
|
||||||
|
{{#ifCond data.xp_spent_rank '>=' data.xp_goal}}
|
||||||
|
<button type="button" name="validate-curriculum">
|
||||||
|
<i class='fas fa-check-square'></i> {{ localize 'l5r5e.advancements.curriculum_validate' }}
|
||||||
|
</button>
|
||||||
|
{{/ifCond}}
|
||||||
|
</th>
|
||||||
|
<th class="">
|
||||||
|
{{ localize 'l5r5e.advancements.total_xp_rank' }} ({{data.identity.school_rank}}) :
|
||||||
|
{{ data.xp_spent_rank }}
|
||||||
|
{{#if data.xp_goal}}/{{data.xp_goal}}{{/if}}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tfooter>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<label class="attribute-label">
|
<label class="attribute-label">
|
||||||
{{ localize 'l5r5e.schoolrank' }}
|
{{ localize 'l5r5e.schoolrank' }}
|
||||||
<input type="number" name="data.identity.school_rank" value="{{data.identity.school_rank}}" class="select-on-focus" data-dtype="Number" min="0" placeholder="0"/>
|
<input type="number" name="data.identity.school_rank" value="{{data.identity.school_rank}}" class="select-on-focus" data-dtype="Number" min="1" placeholder="1"/>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<label class="attribute-label">
|
<label class="attribute-label">
|
||||||
{{ localize 'l5r5e.schoolrank' }}
|
{{ localize 'l5r5e.schoolrank' }}
|
||||||
<input type="number" name="data.identity.school_rank" value="{{data.identity.school_rank}}" class="select-on-focus" data-dtype="Number" min="0" placeholder="0"/>
|
<input type="number" name="data.identity.school_rank" value="{{data.identity.school_rank}}" class="select-on-focus" data-dtype="Number" min="1" placeholder="1"/>
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
Reference in New Issue
Block a user