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