Added a "description" field on the PC/NPC sheet, displayed in limited view

This commit is contained in:
Vlyan
2021-05-26 13:55:39 +02:00
parent c82a3324d8
commit b883689b63
8 changed files with 60 additions and 68 deletions

View File

@@ -13,6 +13,7 @@ __! Be certain to carefully back up any critical user data before installing thi
- To change the linked property, drop any property on the item pattern sheet. - To change the linked property, drop any property on the item pattern sheet.
- Added an optional "Specificity" technique type to serve as a catch-all (by request). - Added an optional "Specificity" technique type to serve as a catch-all (by request).
- Added Mantis Clan compendium entries. - Added Mantis Clan compendium entries.
- Added a "Description" in PC/NPC sheet: this field is used in limited view (public description, "notes" are private).
- Fix : rnkMessage not passing on actor object for NPCs (thanks to Bragma). - Fix : rnkMessage not passing on actor object for NPCs (thanks to Bragma).
- Fix : The "Crescent Moon Style" technique rank from 4 to 2. - Fix : The "Crescent Moon Style" technique rank from 4 to 2.
- Fix : Drop an advancement on a PC/NPC sheet now correctly add the bonus to the Actor (ex Air +1). - Fix : Drop an advancement on a PC/NPC sheet now correctly add the bonus to the Actor (ex Air +1).

View File

@@ -134,7 +134,7 @@ export class BaseSheetL5r5e extends ActorSheet {
* @override * @override
*/ */
activateEditor(name, options = {}, initialContent = "") { activateEditor(name, options = {}, initialContent = "") {
if (name === "data.notes.value" && initialContent) { if (["data.notes", "data.description"].includes(name) && initialContent) {
initialContent = game.l5r5e.HelpersL5r5e.convertSymbols(initialContent, false); initialContent = game.l5r5e.HelpersL5r5e.convertSymbols(initialContent, false);
} }
super.activateEditor(name, options, initialContent); super.activateEditor(name, options, initialContent);
@@ -148,8 +148,11 @@ export class BaseSheetL5r5e extends ActorSheet {
* @override * @override
*/ */
async _updateObject(event, formData) { async _updateObject(event, formData) {
if (formData["data.notes.value"]) { if (formData["data.notes"]) {
formData["data.notes.value"] = game.l5r5e.HelpersL5r5e.convertSymbols(formData["data.notes.value"], true); formData["data.notes"] = game.l5r5e.HelpersL5r5e.convertSymbols(formData["data.notes"], true);
}
if (formData["data.description"]) {
formData["data.description"] = game.l5r5e.HelpersL5r5e.convertSymbols(formData["data.description"], true);
} }
return super._updateObject(event, formData); return super._updateObject(event, formData);
} }

View File

@@ -22,7 +22,7 @@ export default class HooksL5r5e {
*/ */
static async ready() { static async ready() {
// Migration stuff // Migration stuff
if (game.l5r5e.migrations.needUpdate()) { if (game.l5r5e.migrations.needUpdate(game.l5r5e.migrations.NEEDED_VERSION)) {
game.l5r5e.migrations.migrateWorld(); game.l5r5e.migrations.migrateWorld();
} }

View File

@@ -9,12 +9,13 @@ export class MigrationL5r5e {
static NEEDED_VERSION = "1.3.0"; static NEEDED_VERSION = "1.3.0";
/** /**
* Return true if the current world need some updates * Return true if the version need some updates
* @returns {boolean} * @param {string} version
* @return {boolean}
*/ */
static needUpdate() { static needUpdate(version) {
const currentVersion = game.settings.get("l5r5e", "systemMigrationVersion"); const currentVersion = game.settings.get("l5r5e", "systemMigrationVersion");
return currentVersion && foundry.utils.isNewerVersion(MigrationL5r5e.NEEDED_VERSION, currentVersion); return currentVersion && foundry.utils.isNewerVersion(version, currentVersion);
} }
/** /**
@@ -26,6 +27,10 @@ export class MigrationL5r5e {
return; return;
} }
// if (MigrationL5r5e.needUpdate("1.3.0")) {
// ChatMessage.create({"content": "<strong>L5R5E v1.3.0 :</strong><br>"});
// }
// Warn the users // Warn the users
ui.notifications.info( ui.notifications.info(
`Applying L5R5e System Migration for version ${game.system.data.version}.` + `Applying L5R5e System Migration for version ${game.system.data.version}.` +
@@ -190,35 +195,42 @@ export class MigrationL5r5e {
const actorData = actor.data; const actorData = actor.data;
// ***** Start of 1.1.0 ***** // ***** Start of 1.1.0 *****
// Add "Prepared" in actor if (MigrationL5r5e.needUpdate("1.1.0")) {
if (actorData.prepared === undefined) { // Add "Prepared" in actor
updateData["data.prepared"] = true; if (actorData.prepared === undefined) {
} updateData["data.prepared"] = true;
}
// NPC are now without autostats, we need to save the value // NPC are now without autostats, we need to save the value
if (actor.type === "npc") { if (actor.type === "npc") {
if (actorData.endurance < 1) { if (actorData.endurance < 1) {
updateData["data.endurance"] = (Number(actorData.rings.earth) + Number(actorData.rings.fire)) * 2; updateData["data.endurance"] = (Number(actorData.rings.earth) + Number(actorData.rings.fire)) * 2;
updateData["data.composure"] = (Number(actorData.rings.earth) + Number(actorData.rings.water)) * 2; updateData["data.composure"] = (Number(actorData.rings.earth) + Number(actorData.rings.water)) * 2;
updateData["data.focus"] = Number(actorData.rings.air) + Number(actorData.rings.fire); updateData["data.focus"] = Number(actorData.rings.air) + Number(actorData.rings.fire);
updateData["data.vigilance"] = Math.ceil( updateData["data.vigilance"] = Math.ceil(
(Number(actorData.rings.air) + Number(actorData.rings.water)) / 2 (Number(actorData.rings.air) + Number(actorData.rings.water)) / 2
); );
}
} }
} }
// ***** End of 1.1.0 ***** // ***** End of 1.1.0 *****
// ***** Start of 1.3.0 ***** // ***** Start of 1.3.0 *****
// NPC have now more thant a Strength and a Weakness if (MigrationL5r5e.needUpdate("1.3.0")) {
if (actor.type === "npc" && actorData.rings_affinities) { // PC/NPC removed notes useless props "value"
updateData["data.rings_affinities." + actorData.rings_affinities.strength.ring] = updateData["data.notes"] = actorData.notes.value;
actorData.rings_affinities.strength.value;
updateData["data.rings_affinities." + actorData.rings_affinities.weakness.ring] =
actorData.rings_affinities.weakness.value;
// Delete old keys : not working :'( // NPC have now more thant a Strength and a Weakness
updateData["-=data.rings_affinities.strength"] = null; if (actor.type === "npc" && actorData.rings_affinities) {
updateData["-=data.rings_affinities.weakness"] = null; updateData["data.rings_affinities." + actorData.rings_affinities.strength.ring] =
actorData.rings_affinities.strength.value;
updateData["data.rings_affinities." + actorData.rings_affinities.weakness.ring] =
actorData.rings_affinities.weakness.value;
// Delete old keys : not working :'(
updateData["-=data.rings_affinities.strength"] = null;
updateData["-=data.rings_affinities.weakness"] = null;
}
} }
// ***** End of 1.3.0 ***** // ***** End of 1.3.0 *****

View File

@@ -21,6 +21,8 @@
} }
}, },
"social": { "social": {
"notes": "",
"description": "",
"social": { "social": {
"honor": 0, "honor": 0,
"glory": 0, "glory": 0,
@@ -109,14 +111,12 @@
"character": { "character": {
"templates": ["identity", "rings", "social", "skills", "techniques", "conflict", "advancement"], "templates": ["identity", "rings", "social", "skills", "techniques", "conflict", "advancement"],
"zeni": 0, "zeni": 0,
"notes": "",
"twenty_questions": {} "twenty_questions": {}
}, },
"npc": { "npc": {
"templates": ["rings", "social", "techniques", "conflict"], "templates": ["rings", "social", "techniques", "conflict"],
"type": "minion", "type": "minion",
"attitude": "", "attitude": "",
"notes": "",
"conflict_rank": { "conflict_rank": {
"martial": 0, "martial": 0,
"social": 0 "social": 0

View File

@@ -55,7 +55,15 @@
</ul> </ul>
</fieldset> </fieldset>
</div> </div>
{{!-- Description (npc have it on header) --}}
{{#ifCond data.type '==' "character"}}
<fieldset class="narrative-description">
<legend class="text-block-header">{{localize 'l5r5e.description' }}</legend>
{{editor content=data.data.description target="data.description" button=true editable=options.editable}}
</fieldset>
{{/ifCond}}
{{!-- Notes (private) --}}
<fieldset class="narrative-note"> <fieldset class="narrative-note">
<legend class="text-block-header">{{localize 'l5r5e.notes' }}</legend> <legend class="text-block-header">{{localize 'l5r5e.notes' }}</legend>
{{editor content=data.data.notes.value target="data.notes.value" button=true editable=options.editable}} {{editor content=data.data.notes target="data.notes" button=true editable=options.editable}}
</fieldset> </fieldset>

View File

@@ -3,38 +3,6 @@
{{!-- Sheet Header --}} {{!-- Sheet Header --}}
<div class="sheet-header"> <div class="sheet-header">
<h1 class="charname"><input name="name" type="text" value="{{data.name}}" placeholder="Name"/></h1> <h1 class="charname"><input name="name" type="text" value="{{data.name}}" placeholder="Name"/></h1>
{{!-- Sheet identity --}} {{{data.data.description}}}
<ul class="identity-content">
<li>
<label class="attribute-label">
{{localize 'l5r5e.clan'}}
<input type="text" name="data.identity.clan" value="{{data.data.identity.clan}}"/>
</label>
</li>
<li>
<label class="attribute-label">
{{localize 'l5r5e.family'}}
<input type="text" name="data.identity.family" value="{{data.data.identity.family}}"/>
</label>
</li>
<li>
<label class="attribute-label">
{{localize 'l5r5e.schoolrank'}}
<input type="number" name="data.identity.school_rank" value="{{data.data.identity.school_rank}}" class="select-on-focus" data-dtype="Number" min="1" placeholder="1"/>
</label>
</li>
<li>
<label class="attribute-label">
{{localize 'l5r5e.school'}}
<input type="text" name="data.identity.school" value="{{data.data.identity.school}}"/>
</label>
</li>
<li>
<label class="attribute-label">
{{localize 'l5r5e.roles'}}
<input type="text" name="data.identity.roles" value="{{data.data.identity.roles}}"/>
</label>
</li>
</ul>
</div> </div>
</form> </form>

View File

@@ -7,8 +7,8 @@
{{> 'systems/l5r5e/templates/actors/npc/identity.html'}} {{> 'systems/l5r5e/templates/actors/npc/identity.html'}}
</div> </div>
<fieldset class="npc-note"> <fieldset class="npc-note">
<legend class="text-block-header">{{localize 'l5r5e.notes'}}</legend> <legend class="text-block-header">{{localize 'l5r5e.description'}}</legend>
{{editor content=data.data.notes.value target="data.notes.value" button=true editable=options.editable}} {{editor content=data.data.description target="data.description" button=true editable=options.editable}}
</fieldset> </fieldset>
<div class="header-fields"> <div class="header-fields">
<h2>{{localize 'l5r5e.social.title'}}</h2> <h2>{{localize 'l5r5e.social.title'}}</h2>