tab on 20q and Hide rank 0 (initial) on progession

This commit is contained in:
Vlyan
2020-12-30 17:34:14 +01:00
parent 2074caa125
commit 05354e9c6b
5 changed files with 583 additions and 572 deletions

View File

@@ -73,10 +73,14 @@ export class CharacterSheetL5r5e extends BaseSheetL5r5e {
xp = Math.floor(xp / 2); xp = Math.floor(xp / 2);
} }
const rank = Math.max(0, item.data.bought_at_rank - 1); const rank = Math.max(0, item.data.bought_at_rank);
if (rank < 1) {
// Ignore starting comp/items
return;
}
if (!adv[rank]) { if (!adv[rank]) {
adv[rank] = { adv[rank] = {
rank: rank + 1, rank: rank,
spent: 0, spent: 0,
goal: CONFIG.l5r5e.xp.costPerRank[rank] || null, goal: CONFIG.l5r5e.xp.costPerRank[rank] || null,
list: [], list: [],

View File

@@ -33,7 +33,8 @@ export class TwentyQuestionsDialog extends FormApplication {
template: CONFIG.l5r5e.paths.templates + "actors/twenty-questions-dialog.html", template: CONFIG.l5r5e.paths.templates + "actors/twenty-questions-dialog.html",
title: game.i18n.localize("l5r5e.twenty_questions.title"), title: game.i18n.localize("l5r5e.twenty_questions.title"),
width: 600, width: 600,
height: 600, height: 800,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "part1" }],
resizable: true, resizable: true,
closeOnSubmit: false, closeOnSubmit: false,
submitOnClose: false, submitOnClose: false,

View File

@@ -209,10 +209,10 @@ export class TwentyQuestions {
* Fill a actor data from this object * Fill a actor data from this object
*/ */
async toActor(actor, itemsCache) { async toActor(actor, itemsCache) {
const actorDatas = duplicate(actor.data.data); const actorDatas = actor.data.data;
const formData = this.data; const formData = this.data;
// Update the actor real datas // Update the actor
actorDatas.zeni = Math.floor(formData.step2.wealth * 50); actorDatas.zeni = Math.floor(formData.step2.wealth * 50);
actorDatas.identity = { actorDatas.identity = {
...actorDatas.identity, ...actorDatas.identity,
@@ -268,24 +268,24 @@ export class TwentyQuestions {
await actor.deleteEmbeddedEntity("OwnedItem", deleteIds); await actor.deleteEmbeddedEntity("OwnedItem", deleteIds);
// Add items in 20Q to actor // Add items in 20Q to actor
Object.values(itemsCache).forEach((types) => { for (const types of Object.values(itemsCache)) {
types.forEach((item) => { for (const item of types) {
const itemData = duplicate(item.data); const itemData = duplicate(item.data);
if (itemData.data?.bought_at_rank) { if (itemData.data?.bought_at_rank) {
itemData.data.bought_at_rank = 0; itemData.data.bought_at_rank = 0;
} }
actor.createEmbeddedEntity("OwnedItem", itemData); if (itemData.data?.xp_spent) {
}); itemData.data.xp_spent = 0;
}); }
await actor.createEmbeddedEntity("OwnedItem", itemData);
}
}
// Update actor // Update actor
actor.update({ await actor.update({
name: (formData.step2.family + " " + formData.step19.firstname).trim(), name: (formData.step2.family + " " + formData.step19.firstname).trim(),
data: diffObject(actor.data.data, actorDatas), data: actor.data.data,
}); });
// TODO Tmp
// console.log(actor);
} }
/** /**

View File

@@ -8,7 +8,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.xp = { L5R5E.xp = {
costPerRank: [20, 24, 32, 44, 60], costPerRank: [0, 20, 24, 32, 44, 60],
ringCostMultiplier: 3, ringCostMultiplier: 3,
skillCostMultiplier: 2, skillCostMultiplier: 2,
techniqueCost: 3, techniqueCost: 3,

File diff suppressed because it is too large Load Diff