Various fixes
This commit is contained in:
parent
02f8207fb7
commit
f26cd7670c
@ -14,8 +14,8 @@ export class HeritiersActorSheet extends ActorSheet {
|
|||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
classes: ["fvtt-les-heritiers", "sheet", "actor"],
|
classes: ["fvtt-les-heritiers", "sheet", "actor"],
|
||||||
template: "systems/fvtt-les-heritiers/templates/actor-sheet.html",
|
template: "systems/fvtt-les-heritiers/templates/actor-sheet.html",
|
||||||
width: 640,
|
width: 780,
|
||||||
height: 720,
|
height: 840,
|
||||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats" }],
|
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats" }],
|
||||||
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
|
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
|
||||||
editScore: false
|
editScore: false
|
||||||
@ -38,7 +38,8 @@ export class HeritiersActorSheet extends ActorSheet {
|
|||||||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
||||||
limited: this.object.limited,
|
limited: this.object.limited,
|
||||||
skills: this.actor.getSkills(),
|
skills: this.actor.getSkills(),
|
||||||
utileSkills :this.actor.organizeUtileSkills(),
|
utileSkillsMental :this.actor.organizeUtileSkills("mental"),
|
||||||
|
utileSkillsPhysical :this.actor.organizeUtileSkills("physical"),
|
||||||
futileSkills :this.actor.organizeFutileSkills(),
|
futileSkills :this.actor.organizeFutileSkills(),
|
||||||
contacts: this.actor.organizeContacts(),
|
contacts: this.actor.organizeContacts(),
|
||||||
armes: duplicate(this.actor.getWeapons()),
|
armes: duplicate(this.actor.getWeapons()),
|
||||||
@ -136,6 +137,10 @@ export class HeritiersActorSheet extends ActorSheet {
|
|||||||
const key = $(event.currentTarget).data("key")
|
const key = $(event.currentTarget).data("key")
|
||||||
this.actor.rollCarac(key, false)
|
this.actor.rollCarac(key, false)
|
||||||
})
|
})
|
||||||
|
html.find('.roll-rang').click((event) => {
|
||||||
|
const key = $(event.currentTarget).data("rang-key")
|
||||||
|
this.actor.rollRang(key, false)
|
||||||
|
})
|
||||||
html.find('.roll-competence').click((event) => {
|
html.find('.roll-competence').click((event) => {
|
||||||
const li = $(event.currentTarget).parents(".item")
|
const li = $(event.currentTarget).parents(".item")
|
||||||
let compId = li.data("item-id")
|
let compId = li.data("item-id")
|
||||||
|
@ -141,7 +141,7 @@ export class HeritiersActor extends Actor {
|
|||||||
return this.getItemSorted( ["capacitenaturelle"])
|
return this.getItemSorted( ["capacitenaturelle"])
|
||||||
}
|
}
|
||||||
getFee() {
|
getFee() {
|
||||||
return this.items.filter(item => item.type =="fee")
|
return this.items.find(item => item.type =="fee")
|
||||||
}
|
}
|
||||||
getProfils() {
|
getProfils() {
|
||||||
return this.getItemSorted( ["profil"])
|
return this.getItemSorted( ["profil"])
|
||||||
@ -174,23 +174,25 @@ export class HeritiersActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
organizeUtileSkills() {
|
organizeUtileSkills(kind = "mental") {
|
||||||
let comp = {}
|
let comp = {}
|
||||||
for (let key in game.system.lesheritiers.config.competenceProfil) {
|
for (let key in game.system.lesheritiers.config.competenceProfil) {
|
||||||
|
if ( game.system.lesheritiers.config.competenceProfil[key].kind == kind)
|
||||||
comp[key] = []
|
comp[key] = []
|
||||||
}
|
}
|
||||||
for (let item of this.items) {
|
for (let item of this.items) {
|
||||||
if (item.type == "competence") {
|
if (item.type == "competence") {
|
||||||
if (item.system.categorie == "utile") {
|
if (item.system.categorie == "utile" && comp[item.system.profil]) {
|
||||||
this.prepareUtileSkill(item)
|
this.prepareUtileSkill(item)
|
||||||
comp[item.system.profil].push(item)
|
comp[item.system.profil].push(item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let key in comp) {
|
for (let key in comp) {
|
||||||
HeritiersUtility.sortArrayObjectsByName(comp[key])
|
HeritiersUtility.sortArrayObjectsByName(comp[key])
|
||||||
}
|
}
|
||||||
return comp
|
return Object.fromEntries(Object.entries(comp).sort())
|
||||||
}
|
}
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
organizeContacts() {
|
organizeContacts() {
|
||||||
@ -553,6 +555,16 @@ export class HeritiersActor extends Actor {
|
|||||||
rollDialog.render(true)
|
rollDialog.render(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
async rollRang(key, isInit = false) {
|
||||||
|
let rollData = this.getCommonRollData()
|
||||||
|
rollData.mode = "rang"
|
||||||
|
rollData.rang = this.system.rang[key]
|
||||||
|
rollData.rangKey = key
|
||||||
|
let rollDialog = await HeritiersRollDialog.create(this, rollData)
|
||||||
|
rollDialog.render(true)
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rollCompetence(compId) {
|
async rollCompetence(compId) {
|
||||||
let rollData = this.getCommonRollData(compId)
|
let rollData = this.getCommonRollData(compId)
|
||||||
|
@ -25,12 +25,12 @@ export const HERITIERS_CONFIG = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
competenceProfil : {
|
competenceProfil : {
|
||||||
"aventurier": "Aventurier",
|
"aventurier": {kind: "physical", name: "Aventurier"},
|
||||||
"roublard": "Roublard",
|
"roublard": {kind: "physical",name: "Roublard"},
|
||||||
"combattant": "Combattant",
|
"combattant": {kind: "physical",name:"Combattant"},
|
||||||
"erudit": "Erudit",
|
"erudit": {kind: "mental",name:"Erudit"},
|
||||||
"savant": "Savant",
|
"savant": {kind: "mental",name:"Savant"},
|
||||||
"gentleman": "Gentleman"
|
"gentleman": {kind: "mental",name:"Gentleman"}
|
||||||
},
|
},
|
||||||
baseTestPouvoir: {
|
baseTestPouvoir: {
|
||||||
"feerie": "Féerie",
|
"feerie": "Féerie",
|
||||||
|
@ -44,30 +44,14 @@ export class HeritiersUtility {
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static sortByName(table) {
|
static sortByName(table) {
|
||||||
return table.sort(function (a, b) {
|
return table.sort(function (a, b) {
|
||||||
let fa = a.name.toLowerCase(),
|
return a.name.localeCompare(b.name);
|
||||||
fb = b.name.toLowerCase();
|
|
||||||
if (fa < fb) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (fa > fb) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static sortArrayObjectsByName(myArray) {
|
static sortArrayObjectsByName(myArray) {
|
||||||
myArray.sort((a, b) => {
|
myArray.sort((a, b) => {
|
||||||
let fa = a.name.toLowerCase();
|
return a.name.localeCompare(b.name);
|
||||||
let fb = b.name.toLowerCase();
|
|
||||||
if (fa < fb) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (fa > fb) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +114,7 @@ export class HeritiersUtility {
|
|||||||
'systems/fvtt-les-heritiers/templates/partial-item-header.html',
|
'systems/fvtt-les-heritiers/templates/partial-item-header.html',
|
||||||
'systems/fvtt-les-heritiers/templates/partial-item-description.html',
|
'systems/fvtt-les-heritiers/templates/partial-item-description.html',
|
||||||
'systems/fvtt-les-heritiers/templates/partial-item-nav.html',
|
'systems/fvtt-les-heritiers/templates/partial-item-nav.html',
|
||||||
|
'systems/fvtt-les-heritiers/templates/partial-utile-skills.html',
|
||||||
'systems/fvtt-les-heritiers/templates/partial-list-niveau.html'
|
'systems/fvtt-les-heritiers/templates/partial-list-niveau.html'
|
||||||
]
|
]
|
||||||
return loadTemplates(templatePaths);
|
return loadTemplates(templatePaths);
|
||||||
@ -358,14 +343,19 @@ export class HeritiersUtility {
|
|||||||
rollData.nbDice = (rollData.useTricherie || rollData.useHeritage) ? 3 : 1
|
rollData.nbDice = (rollData.useTricherie || rollData.useHeritage) ? 3 : 1
|
||||||
rollData.diceFormula = rollData.nbDice + rollData.mainDice + "kh1"
|
rollData.diceFormula = rollData.nbDice + rollData.mainDice + "kh1"
|
||||||
//console.log("BEFORE COMP", rollData)
|
//console.log("BEFORE COMP", rollData)
|
||||||
|
|
||||||
|
let rangValue = 0
|
||||||
|
if (rollData.rang) {
|
||||||
|
rangValue = rollData.rang.value
|
||||||
|
}
|
||||||
if (rollData.competence) {
|
if (rollData.competence) {
|
||||||
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
|
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
|
||||||
let specBonus = (rollData.useSpecialite) ? 1 : 0
|
let specBonus = (rollData.useSpecialite) ? 1 : 0
|
||||||
rollData.diceFormula += `+${rollData.carac.value}+${rollData.competence.system.niveau}+${specBonus}+${rollData.bonusMalusContext}+${compmod}`
|
rollData.diceFormula += `+${rollData.carac.value}+${rangValue}+${rollData.competence.system.niveau}+${specBonus}+${rollData.bonusMalusContext}+${compmod}`
|
||||||
} else if (rollData.pouvoirBase) {
|
} else if (rollData.pouvoirBase) {
|
||||||
rollData.diceFormula += `+${rollData.pouvoirBase.value}+${rollData.bonusMalusContext}`
|
rollData.diceFormula += `+${rollData.pouvoirBase.value}+${rangValue}+${rollData.bonusMalusContext}`
|
||||||
} else {
|
} else {
|
||||||
rollData.diceFormula += `+${rollData.carac.value}+${rollData.bonusMalusContext}`
|
rollData.diceFormula += `+${rollData.carac.value}+${rangValue}+${rollData.bonusMalusContext}`
|
||||||
}
|
}
|
||||||
rollData.diceFormula += `+${rollData.pvMalus}`
|
rollData.diceFormula += `+${rollData.pvMalus}`
|
||||||
|
|
||||||
|
@ -653,6 +653,9 @@ ul, li {
|
|||||||
padding-left: 0.25rem;
|
padding-left: 0.25rem;
|
||||||
margin-right: 0.25rem;
|
margin-right: 0.25rem;
|
||||||
}
|
}
|
||||||
|
.specialisarion-margin {
|
||||||
|
margin-left: 1.5rem;
|
||||||
|
}
|
||||||
.short-label {
|
.short-label {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "fvtt-les-heritiers",
|
"id": "fvtt-les-heritiers",
|
||||||
"description": "Les Héritiers pour FoundryVTT",
|
"description": "Les Héritiers pour FoundryVTT",
|
||||||
"version": "10.0.25",
|
"version": "10.0.26",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Uberwald/LeRatierBretonnien",
|
"name": "Uberwald/LeRatierBretonnien",
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"gridUnits": "m",
|
"gridUnits": "m",
|
||||||
"license": "LICENSE.txt",
|
"license": "LICENSE.txt",
|
||||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/raw/branch/master/system.json",
|
"manifest": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/raw/branch/master/system.json",
|
||||||
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.25.zip",
|
"download": "https://www.uberwald.me/gitea/public/fvtt-les-heritiers/archive/fvtt-les-heritiers-10.0.26.zip",
|
||||||
"languages": [
|
"languages": [
|
||||||
{
|
{
|
||||||
"lang": "fr",
|
"lang": "fr",
|
||||||
|
@ -117,18 +117,22 @@
|
|||||||
},
|
},
|
||||||
"rang": {
|
"rang": {
|
||||||
"tricherie": {
|
"tricherie": {
|
||||||
|
"label": "Tricherie",
|
||||||
"value": 0,
|
"value": 0,
|
||||||
"max": 0
|
"max": 0
|
||||||
},
|
},
|
||||||
"feerie": {
|
"feerie": {
|
||||||
|
"label": "Féerie",
|
||||||
"value": 0,
|
"value": 0,
|
||||||
"max": 0
|
"max": 0
|
||||||
},
|
},
|
||||||
"masque": {
|
"masque": {
|
||||||
|
"label": "Masque",
|
||||||
"value": 0,
|
"value": 0,
|
||||||
"max": 0
|
"max": 0
|
||||||
},
|
},
|
||||||
"heritage": {
|
"heritage": {
|
||||||
|
"label": "Héritage",
|
||||||
"value": 0,
|
"value": 0,
|
||||||
"max": 0,
|
"max": 0,
|
||||||
"scenarios": 0
|
"scenarios": 0
|
||||||
|
@ -78,42 +78,21 @@
|
|||||||
|
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
|
|
||||||
{{#each utileSkills as |skillList keyProfil|}}
|
<div class="grid-2col">
|
||||||
<div class="sheet-box color-bg-archetype">
|
|
||||||
<ul class="item-list alternate-list">
|
|
||||||
<li class="item flexrow">
|
|
||||||
<span class="item-field-label-long">
|
|
||||||
<h3><label class="items-title-text">{{upperFirst keyProfil}}</label></h3>
|
|
||||||
</span>
|
|
||||||
<span class="item-field-label-short">
|
|
||||||
<label class="short-label">Niveau</label>
|
|
||||||
</span>
|
|
||||||
<div class="item-filler"> </div>
|
|
||||||
</li>
|
|
||||||
{{#each skillList as |skill key|}}
|
|
||||||
<li class="item flexrow " data-item-id="{{skill._id}}" data-item-type="competence">
|
|
||||||
<span class="item-field-label-long roll-style"><a class="roll-competence item-field-label-short"
|
|
||||||
data-attr-key="tochoose">{{skill.name}}</a></span>
|
|
||||||
<select class="item-field-label-short edit-item-data" type="text"
|
|
||||||
data-item-field="niveau" value="{{skill.system.niveau}}" data-dtype="Number">
|
|
||||||
{{#select skill.system.niveau}}
|
|
||||||
{{> systems/fvtt-les-heritiers/templates/partial-list-niveau.html}}
|
|
||||||
{{/select}}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<input type="checkbox" class="item-field-label-short edit-item-data" data-item-field="predilection" {{checked skill.system.predilection}}/>
|
<div>
|
||||||
|
{{#each utileSkillsPhysical as |skillList keyProfil|}}
|
||||||
<span class="item-field-label-long2">{{skill.specList}}</span>
|
{{> systems/fvtt-les-heritiers/templates/partial-utile-skills.html skillList=skillList keyProfil=keyProfil}}
|
||||||
|
|
||||||
<div class="item-controls item-controls-fixed">
|
|
||||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
|
||||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
{{#each utileSkillsMental as |skillList keyProfil|}}
|
||||||
|
{{> systems/fvtt-les-heritiers/templates/partial-utile-skills.html skillList=skillList keyProfil=keyProfil}}
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
|
||||||
|
|
||||||
<div class="sheet-box color-bg-archetype">
|
<div class="sheet-box color-bg-archetype">
|
||||||
<ul class="item-list alternate-list">
|
<ul class="item-list alternate-list">
|
||||||
@ -295,11 +274,11 @@
|
|||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<ul>
|
<ul>
|
||||||
<li class="flexrow item">
|
<li class="flexrow item">
|
||||||
<label class="item-field-label-medium">Féerie</label>
|
<label class="item-field-label-medium roll-style"><a class="roll-rang item-field-label-short" data-rang-key="feerie">Féerie</a></label>
|
||||||
<input type="text" class="item-field-label-short" name="system.rang.feerie.value" value="{{system.rang.feerie.value}}" data-dtype="Number" />
|
<input type="text" class="item-field-label-short" name="system.rang.feerie.value" value="{{system.rang.feerie.value}}" data-dtype="Number" />
|
||||||
<input type="text" class="item-field-label-short" name="system.rang.feerie.max" value="{{system.rang.feerie.max}}" data-dtype="Number" />
|
<input type="text" class="item-field-label-short" name="system.rang.feerie.max" value="{{system.rang.feerie.max}}" data-dtype="Number" />
|
||||||
<span class="item-field-label-long"></span>
|
<span class="item-field-label-long"></span>
|
||||||
<label class="item-field-label-medium">Masque</label>
|
<label class="item-field-label-medium roll-style"><a class="roll-rang item-field-label-short" data-rang-key="masque">Masque</a></label>
|
||||||
<input type="text" class="item-field-label-short" name="system.rang.masque.value" value="{{system.rang.masque.value}}" data-dtype="Number" />
|
<input type="text" class="item-field-label-short" name="system.rang.masque.value" value="{{system.rang.masque.value}}" data-dtype="Number" />
|
||||||
<input type="text" class="item-field-label-short" name="system.rang.masque.max" value="{{system.rang.masque.max}}" data-dtype="Number" />
|
<input type="text" class="item-field-label-short" name="system.rang.masque.max" value="{{system.rang.masque.max}}" data-dtype="Number" />
|
||||||
</li>
|
</li>
|
||||||
|
@ -20,6 +20,10 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li class="heritiers-roll">Caractéristique : {{carac.label}} ({{carac.value}})</li>
|
<li class="heritiers-roll">Caractéristique : {{carac.label}} ({{carac.value}})</li>
|
||||||
|
|
||||||
|
{{#if rang}}
|
||||||
|
<li>{{rang.label}} : {{rang.value}}</li>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if competence}}
|
{{#if competence}}
|
||||||
<li>Compétence : {{competence.name}} ({{competence.system.niveau}})</li>
|
<li>Compétence : {{competence.name}} ({{competence.system.niveau}})</li>
|
||||||
{{#if useSpecialite}}
|
{{#if useSpecialite}}
|
||||||
|
36
templates/partial-utile-skills.html
Normal file
36
templates/partial-utile-skills.html
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<div class="sheet-box color-bg-archetype">
|
||||||
|
<ul class="item-list alternate-list">
|
||||||
|
<li class="item flexrow">
|
||||||
|
<span class="item-field-label-long">
|
||||||
|
<h3><label class="items-title-text">{{upperFirst keyProfil}}</label></h3>
|
||||||
|
</span>
|
||||||
|
<span class="item-field-label-short">
|
||||||
|
<label class="short-label">Niveau</label>
|
||||||
|
</span>
|
||||||
|
<div class="item-filler"> </div>
|
||||||
|
</li>
|
||||||
|
{{#each skillList as |skill key|}}
|
||||||
|
<li class="item flexrow " data-item-id="{{skill._id}}" data-item-type="competence">
|
||||||
|
<span class="item-field-label-long roll-style"><a class="roll-competence item-field-label-short"
|
||||||
|
data-attr-key="tochoose">{{skill.name}}</a></span>
|
||||||
|
<select class="item-field-label-short edit-item-data" type="text"
|
||||||
|
data-item-field="niveau" value="{{skill.system.niveau}}" data-dtype="Number">
|
||||||
|
{{#select skill.system.niveau}}
|
||||||
|
{{> systems/fvtt-les-heritiers/templates/partial-list-niveau.html}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
<input type="checkbox" class="item-field-label-short edit-item-data" data-item-field="predilection" {{checked skill.system.predilection}}/>
|
||||||
|
<div class="item-controls item-controls-fixed">
|
||||||
|
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||||
|
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
{{#if (count skill.specList)}}
|
||||||
|
<li class="item flexrow" data-item-id="{{skill._id}}" data-item-type="competence">
|
||||||
|
<span class="specialisarion-margin item-field-label-long2">{{skill.specList}}</span>
|
||||||
|
</li>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{/each}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
@ -8,6 +8,13 @@
|
|||||||
|
|
||||||
<div class="flexcol">
|
<div class="flexcol">
|
||||||
|
|
||||||
|
{{#if (eq mode "rang")}}
|
||||||
|
<div class="flexrow">
|
||||||
|
<span class="roll-dialog-label">{{rang.label}}</span>
|
||||||
|
<span class="roll-dialog-label">{{rang.value}}</span>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if (eq mode "carac")}}
|
{{#if (eq mode "carac")}}
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="roll-dialog-label">Caracteristique</span>
|
<span class="roll-dialog-label">Caracteristique</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user