Corrections voies draconic
- Utilisation du nom de voie (Oniros au lieu de Voie d'Oniros) - compatible anciens sorts - migration des objets existants - amélioration de l'affichage de la liste des sorts
This commit is contained in:
parent
8be4c3343f
commit
9b1a179a71
@ -1,5 +1,8 @@
|
||||
# 12.0
|
||||
## 12.0.24 - Les ajustements d'Astrobazzarh
|
||||
- amélioration
|
||||
- meilleure gestion des noms des voies de draconic
|
||||
- affichage du détail des sorts avec le nom de voie, 'court', la difficulté, le coût
|
||||
- corrections
|
||||
- les tas dans les conteneurs peuvent être désempilés sans rendre le conteneur inutilisable
|
||||
- les conteneurs ne peuvent plus être empilés (pour éviter que le contenu de Schroedinger quand on les sépare)
|
||||
|
@ -238,7 +238,7 @@ export class Mapping {
|
||||
|
||||
static prepareSorts(actor) {
|
||||
const codeVoies = Mapping.getCompetencesCategorie(actor, CATEGORIES_DRACONIC)
|
||||
.map(it => RdDItemSort.getVoieCode(it))
|
||||
.map(it => RdDItemSort.getCodeVoie(it.name))
|
||||
|
||||
return actor.itemTypes[ITEM_TYPES.sort].map(it => Mapping.prepareSort(it, codeVoies))
|
||||
.sort(Misc.ascending(it => `${it.voie} : ${it.description}`))
|
||||
@ -246,7 +246,7 @@ export class Mapping {
|
||||
|
||||
static prepareSort(sort, voies) {
|
||||
return {
|
||||
voie: RdDItemSort.getCodeDraconic(sort, voies),
|
||||
voie: RdDItemSort.getCode(sort, voies),
|
||||
description: Mapping.descriptionSort(sort),
|
||||
bonus: Mapping.bonusCase(sort)
|
||||
}
|
||||
@ -255,17 +255,9 @@ export class Mapping {
|
||||
static descriptionSort(sort) {
|
||||
const ptSeuil = Array(sort.system.coutseuil).map(it => '*')
|
||||
const caseTMR = sort.system.caseTMRspeciale.length > 0 ? Mapping.toVar(sort.system.caseTMRspeciale) : Misc.upperFirst(TMRType[sort.system.caseTMR].name)
|
||||
const ptreve = Mapping.addSpaceToNonNumeric(sort.system.ptreve)
|
||||
const diff = Mapping.addSpaceToNonNumeric(sort.system.difficulte)
|
||||
return `${sort.name}${ptSeuil} (${caseTMR}) R${diff} r${ptreve}`
|
||||
}
|
||||
|
||||
static addSpaceToNonNumeric(value) {
|
||||
return Number.isNumeric(value) || /[-\d].*/.match(String(value)) ? value : ' ' + Mapping.toVar(value)
|
||||
}
|
||||
|
||||
static toVar(value) {
|
||||
return value.replace('variable', 'var')
|
||||
const coutReve = 'r' + RdDItemSort.addSpaceToNonNumeric(sort.system.ptreve)
|
||||
const diff = 'R' + RdDItemSort.addSpaceToNonNumeric(sort.system.difficulte)
|
||||
return `${sort.name}${ptSeuil} (${caseTMR}) ${diff} ${coutReve}`
|
||||
}
|
||||
|
||||
static bonusCase(sort) {
|
||||
|
@ -296,7 +296,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
))
|
||||
break
|
||||
case ITEM_TYPES.competence:
|
||||
formData['system.niveau'] = formData.system.niveau ?? formData.system.base
|
||||
formData['system.niveau'] = formData['system.niveau'] ?? formData['system.base']
|
||||
break
|
||||
}
|
||||
|
||||
|
@ -2,19 +2,32 @@ import { Grammar } from "./grammar.js";
|
||||
import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { ITEM_TYPES } from "./item.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { FLEUVE_COORD, TMRType, TMRUtility } from "./tmr-utility.js";
|
||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||
|
||||
const VOIES_DRACONIC = [
|
||||
export const VOIES_DRACONIC = [
|
||||
{ code: 'O', label: "Voie d'Oniros", short: 'Oniros', ordre: 'a' },
|
||||
{ code: 'H', label: "Voie d'Hypnos", short: 'Hypnos', ordre: 'b' },
|
||||
{ code: 'N', label: "Voie de Narcos", short: 'Narcos', ordre: 'c' },
|
||||
{ code: 'T', label: "Voie de Thanatos", short: 'Thanatos', ordre: 'd' },
|
||||
{ code: 'O/H/N/T', label: "Oniros/Hypnos/Narcos/Thanatos", short: 'Oniros/Hypnos/Narcos/Thanatos', ordre: 'e' },
|
||||
{ code: 'O/H/N', label: "Oniros/Hypnos/Narcos", short: "Oniros/Hypnos/Narcos", ordre: 'f' }
|
||||
{ code: 'O/H/N/T', label: "Oniros/Hypnos/Narcos/Thanatos", short: 'O/H/N/T', ordre: 'e' },
|
||||
{ code: 'O/H/N', label: "Oniros/Hypnos/Narcos", short: "O/H/N", ordre: 'f' }
|
||||
]
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class RdDItemSort extends Item {
|
||||
static preloadHandlebars() {
|
||||
Handlebars.registerHelper('itemSort-spaceIfText', val => RdDItemSort.addSpaceToNonNumeric(val))
|
||||
Handlebars.registerHelper('itemSort-codeDraconic', voie => RdDItemSort.getCode(voie))
|
||||
Handlebars.registerHelper('itemSort-shortDraconic', voie => RdDItemSort.getShortVoie(voie))
|
||||
}
|
||||
|
||||
static addSpaceToNonNumeric(value) {
|
||||
return Number.isNumeric(value) || ['-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'].includes( String(value).charAt[0]) ? value : ' ' + RdDItemSort.toVar(value)
|
||||
}
|
||||
|
||||
static toVar(value) {
|
||||
return value ? value.replace('variable', 'var') : ''
|
||||
}
|
||||
|
||||
static getDraconicsSort(competencesDraconic, sort) {
|
||||
// se baser sur la voie du sort?
|
||||
@ -33,20 +46,23 @@ export class RdDItemSort extends Item {
|
||||
return (VOIES_DRACONIC.find(it => it.code == code)?.ordre ?? '?')
|
||||
}
|
||||
|
||||
static getVoieCode(voie) {
|
||||
return VOIES_DRACONIC.find(it => voie.name.includes(it.short))?.code ?? '?'
|
||||
static getCodeVoie(voie) {
|
||||
return VOIES_DRACONIC.find(it => [it.code, it.short, it.label].includes(voie))?.code ?? '?'
|
||||
}
|
||||
|
||||
static getCodeDraconic(sort, voies = ['O', 'H', 'N', 'T']) {
|
||||
static getShortVoie(voie) {
|
||||
return VOIES_DRACONIC.find(it => [it.code, it.short, it.label].includes(voie))?.short ?? voie
|
||||
}
|
||||
|
||||
static getCode(sort, codeVoies = ['O', 'H', 'N', 'T']) {
|
||||
switch (Grammar.toLowerCaseNoAccent(sort.name)) {
|
||||
case "lecture d'aura":
|
||||
case "detection d'aura":
|
||||
return RdDItemSort.$voiesConnues('O/H/N/T', voies)
|
||||
return RdDItemSort.$voiesConnues('O/H/N/T', codeVoies)
|
||||
case "annulation de magie":
|
||||
return RdDItemSort.$voiesConnues('O/H/N', voies)
|
||||
return RdDItemSort.$voiesConnues('O/H/N', codeVoies)
|
||||
}
|
||||
const voie = VOIES_DRACONIC.find(it => it.label.includes(sort.system.draconic))
|
||||
return voie?.code ?? sort.system.draconic
|
||||
return RdDItemSort.getCodeVoie(sort.system.draconic)
|
||||
}
|
||||
|
||||
static $voiesConnues(voiesSort, voies) {
|
||||
|
@ -5,7 +5,7 @@ import { Monnaie } from "./item-monnaie.js";
|
||||
import { RdDItem, ITEM_TYPES } from "./item.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { RdDRaretes } from "./item/raretes.js";
|
||||
import { RdDCalendrier } from "./time/rdd-calendrier.js";
|
||||
import { VOIES_DRACONIC } from "./item-sort.js";
|
||||
|
||||
class Migration {
|
||||
get code() { return "sample"; }
|
||||
@ -530,6 +530,32 @@ class _11_2_20_MigrationAstrologie extends Migration {
|
||||
}
|
||||
}
|
||||
|
||||
class _12_0_24_MigrationVoieSorts extends Migration {
|
||||
get code() { return "migration-voies-sorts" }
|
||||
get version() { return "12.0.24" }
|
||||
|
||||
async migrate() {
|
||||
await this.applyItemsUpdates(items => items
|
||||
.filter(it => ITEM_TYPES.sort == it.type)
|
||||
.map(it => this.migrateSort(it))
|
||||
)
|
||||
}
|
||||
migrateSort(it) {
|
||||
return {
|
||||
_id: it.id,
|
||||
'system.draconic': this.convertDraconic(it.system.draconic),
|
||||
}
|
||||
}
|
||||
convertDraconic(draconic) {
|
||||
for (let v of VOIES_DRACONIC) {
|
||||
if ([v.label, v.short, v.code].includes(draconic)) {
|
||||
return v.short
|
||||
}
|
||||
}
|
||||
return draconic
|
||||
}
|
||||
}
|
||||
|
||||
export class Migrations {
|
||||
static getMigrations() {
|
||||
return [
|
||||
|
@ -69,6 +69,7 @@ import { ExportScriptarium } from "./actor/export-scriptarium/export-scriptarium
|
||||
import { AppPersonnageAleatoire } from "./actor/random/app-personnage-aleatoire.js"
|
||||
import { RdDActorExportSheet } from "./actor/export-scriptarium/actor-encart-sheet.js"
|
||||
import { RdDStatBlockParser } from "./apps/rdd-import-stats.js"
|
||||
import { RdDItemSort } from "./item-sort.js"
|
||||
|
||||
/**
|
||||
* RdD system
|
||||
@ -122,6 +123,7 @@ export class SystemReveDeDragon {
|
||||
// preload handlebars templates
|
||||
RdDUtility.preloadHandlebarsTemplates()
|
||||
AppPersonnageAleatoire.preloadHandlebars()
|
||||
RdDItemSort.preloadHandlebars()
|
||||
|
||||
/* -------------------------------------------- */
|
||||
ReglesOptionnelles.initSettings()
|
||||
|
@ -4,14 +4,15 @@
|
||||
{{#each (trier sorts) as |sort key|}}
|
||||
<li class="item list-item flexrow" data-item-id="{{sort._id}}" data-attribute="{{key}}" data-tooltip="{{#if sort.system.isrituel}}Rituel{{else}}Sort{{/if}}: {{sort.name}}">
|
||||
<img class="sheet-competence-img" src="{{sort.img}}"/>
|
||||
<span class="item-edit flex-grow-3">
|
||||
<a data-item-id="{{sort._id}}">{{sort.name}}
|
||||
- {{#if sort.system.caseTMRspeciale}}{{sort.system.caseTMRspeciale}}{{else}}{{upperFirst sort.system.caseTMR}}{{/if}}
|
||||
</a>
|
||||
</span>
|
||||
<span class="flex-grow-0-5">{{#if sort.system.isrituel}}Rituel{{/if}}</span>
|
||||
<span class="flex-grow-2">{{sort.system.draconic}}/{{sort.system.difficulte}}</span>
|
||||
<span class="flex-shrink">{{itemSort-shortDraconic sort.system.draconic}}</span>
|
||||
<span class="item-edit flex-grow-3">{{sort.name}}{{#if sort.system.isrituel}}
|
||||
<i class="fa-regular fa-book-sparkles"></i>{{/if}}</span>
|
||||
<span class="flex-grow-2">
|
||||
{{#if sort.system.caseTMRspeciale}}{{sort.system.caseTMRspeciale}}{{else}}{{upperFirst sort.system.caseTMR}}{{/if}}
|
||||
</span>
|
||||
<span class="flex-grow-1">R{{itemSort-spaceIfText sort.system.difficulte}} r{{itemSort-spaceIfText sort.system.ptreve}}</span>
|
||||
<div class="item-controls flex-shrink">
|
||||
<a class="item-edit" data-tooltip="Modifier"><i class="fas fa-edit"></i></a>
|
||||
<a class="item-delete" data-tooltip="Supprimer"><i class="fas fa-trash"></i></a>
|
||||
<a class="item-montrer" data-tooltip="Montrer"><i class="fas fa-comment"></i></a>
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{{#each (trier @root.competences) as |competence key|}}
|
||||
{{#if (eq competence.system.categorie 'draconic')}}
|
||||
<option value="{{competence.name}}">{{competence.name}}</option>
|
||||
<option value="{{itemSort-shortDraconic competence.name}}">{{itemSort-shortDraconic competence.name}}</option>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
<option value="O/H/N/T">Oniros/Hypnos/Narcos/Thanatos</option>
|
||||
|
Loading…
Reference in New Issue
Block a user