Fix for the "bought_at_rank" value when an Item was on dropped on a sheet.

This commit is contained in:
Vlyan
2021-06-03 18:41:09 +02:00
parent f57ebb0ccd
commit 232ced27fb
2 changed files with 8 additions and 23 deletions

View File

@@ -203,22 +203,7 @@ export class BaseSheetL5r5e extends ActorSheet {
// Item subtype specific // Item subtype specific
switch (item.data.type) { switch (item.data.type) {
case "bond": // no break
case "peculiarity": // no break
case "item_pattern": // no break
case "signature_scroll":
// Modify the bought at rank to the current actor rank
if (this.actor.data.data.identity?.school_rank) {
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
}
break;
case "advancement": case "advancement":
// Modify the bought at rank to the current actor rank
if (this.actor.data.data.identity?.school_rank) {
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
}
// Specific advancements, remove 1 to selected ring/skill // Specific advancements, remove 1 to selected ring/skill
await this.actor.addBonus(item); await this.actor.addBonus(item);
break; break;
@@ -265,21 +250,21 @@ export class BaseSheetL5r5e extends ActorSheet {
item.data.data.xp_cost > 0 ? item.data.data.xp_cost : CONFIG.l5r5e.xp.techniqueCost; item.data.data.xp_cost > 0 ? item.data.data.xp_cost : CONFIG.l5r5e.xp.techniqueCost;
item.data.data.xp_used = item.data.data.xp_cost; item.data.data.xp_used = item.data.data.xp_cost;
} }
// Modify the bought at rank to the current actor rank
if (this.actor.data.data.identity?.school_rank) {
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
}
break; break;
} }
// Modify the bought at rank to the current actor rank
if (item.data.data.bought_at_rank !== undefined && this.actor.data.data.identity?.school_rank) {
item.data.data.bought_at_rank = this.actor.data.data.identity.school_rank;
}
// 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) {
return; return;
} }
return this._onDropItemCreate(item.data.toJSON()); return this._onDropItemCreate(item.data.toObject(false));
} }
/** /**

View File

@@ -4,8 +4,8 @@
"description": "This is an authorised multilingual game system En|Fr|Es, for Legend of the Five Rings (5th Edition) by <a href='https://edge-studio.net/'>Edge Studio</a> <p> - Join the official Discord server: <a href='https://discord.gg/foundryvtt'> Official Discord</a></p><p> - Rejoignez la communauté Francophone: <a href='https://discord.gg/pPSDNJk'>Francophone Discord</a></p>", "description": "This is an authorised multilingual game system En|Fr|Es, for Legend of the Five Rings (5th Edition) by <a href='https://edge-studio.net/'>Edge Studio</a> <p> - Join the official Discord server: <a href='https://discord.gg/foundryvtt'> Official Discord</a></p><p> - Rejoignez la communauté Francophone: <a href='https://discord.gg/pPSDNJk'>Francophone Discord</a></p>",
"url": "https://gitlab.com/teaml5r/l5r5e", "url": "https://gitlab.com/teaml5r/l5r5e",
"manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json", "manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json",
"download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.3.0/raw/l5r5e.zip?job=build", "download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.3.1/raw/l5r5e.zip?job=build",
"version": "1.3.0", "version": "1.3.1",
"minimumCoreVersion": "0.8.5", "minimumCoreVersion": "0.8.5",
"compatibleCoreVersion": "0.8.6", "compatibleCoreVersion": "0.8.6",
"manifestPlusVersion": "1.0.0", "manifestPlusVersion": "1.0.0",