Update item sheets

This commit is contained in:
2024-12-04 03:06:33 +01:00
parent 91c468e736
commit 1cc3a0bc21
26 changed files with 6117 additions and 772 deletions

View File

@ -8,4 +8,3 @@ export { default as CthulhuEternalArmorSheet } from "./sheets/armor-sheet.mjs"
export { default as CthulhuEternalMentalDisorderSheet } from "./sheets/mentaldisorder-sheet.mjs"
export { default as CthulhuEternalGearSheet } from "./sheets/gear-sheet.mjs"
export { default as CthulhuEternalMotivationSheet } from "./sheets/motivation-sheet.mjs"
export { default as CthulhuEternalManager } from "./manager.mjs"

View File

@ -1,142 +0,0 @@
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api
import { SYSTEM } from "../config/system.mjs"
/**
* An application for configuring the permissions which are available to each User role.
* @extends ApplicationV2
* @mixes HandlebarsApplication
* @alias PermissionConfig
*/
export default class CthulhuEternalManager extends HandlebarsApplicationMixin(ApplicationV2) {
static DEFAULT_OPTIONS = {
id: "cthulhueternal-application-manager",
tag: "form",
window: {
contentClasses: ["cthulhueternal-manager"],
title: "CTHULHUETERNAL.Manager.title",
resizable: true,
},
position: {
width: "auto",
height: "auto",
top: 80,
left: 400,
},
form: {
closeOnSubmit: true,
},
actions: {
resourceAll: CthulhuEternalManager.#onResourceAll,
resourceOne: CthulhuEternalManager.#onResourceOne,
saveAll: CthulhuEternalManager.#onSaveAll,
saveOne: CthulhuEternalManager.#onSaveOne,
openSheet: CthulhuEternalManager.#onOpenSheet,
},
}
/** @override */
static PARTS = {
main: {
template: "systems/fvtt-cthulhu-eternal/templates/manager.hbs",
},
}
/* -------------------------------------------- */
/* Rendering */
/* -------------------------------------------- */
/** @override */
async _prepareContext(_options = {}) {
return {
players: game.users.filter((u) => u.hasPlayerOwner && u.active),
}
}
static async #onResourceAll(event, target) {
const value = event.target.dataset.resource
CthulhuEternalManager.askRollForAll("resource", value)
}
static async #onSaveAll(event, target) {
const value = event.target.dataset.save
CthulhuEternalManager.askRollForAll("save", value)
}
static #onResourceOne(event, target) {
const value = event.target.dataset.resource
const recipient = event.target.parentElement.dataset.userId
const name = event.target.parentElement.dataset.characterName
CthulhuEternalManager.askRollForOne("resource", value, recipient, name)
}
static async #onSaveOne(event, target) {
const value = event.target.dataset.save
const recipient = event.target.parentElement.dataset.userId
const name = event.target.parentElement.dataset.characterName
CthulhuEternalManager.askRollForOne("save", value, recipient, name)
}
static #onOpenSheet(event, target) {
const characterId = event.target.dataset.characterId
game.actors.get(characterId).sheet.render(true)
}
static async askRollForAll(type, value, title = null, avantage = null) {
let label = game.i18n.localize(`CTHULHUETERNAL.Manager.${value}`)
let text = game.i18n.format("CTHULHUETERNAL.Chat.askRollForAll", { value: label })
if (avantage) {
switch (avantage) {
case "++":
text += ` ${game.i18n.localize("CTHULHUETERNAL.Roll.doubleAvantage")}`
break
case "+":
text += ` ${game.i18n.localize("CTHULHUETERNAL.Roll.avantage")}`
break
case "-":
text += ` ${game.i18n.localize("CTHULHUETERNAL.Roll.desavantage")}`
break
case "--":
text += ` ${game.i18n.localize("CTHULHUETERNAL.Roll.doubleDesavantage")}`
break
default:
break
}
}
ChatMessage.create({
user: game.user.id,
content: await renderTemplate(`systems/fvtt-cthulhu-eternal/templates/chat-ask-roll.hbs`, {
title: title !== null ? title : "",
text: text,
rollType: type,
value: value,
avantage: avantage,
}),
flags: { tenebris: { typeMessage: "askRoll" } },
})
}
static async askRollForOne(type, value, recipient, name) {
let label = game.i18n.localize(`CTHULHUETERNAL.Manager.${value}`)
const text = game.i18n.format("CTHULHUETERNAL.Chat.askRollForOne", { value: label, name: name })
game.socket.emit(`system.${SYSTEM.id}`, {
action: "askRoll",
data: {
userId: recipient,
},
})
ChatMessage.create({
user: game.user.id,
content: await renderTemplate(`systems/fvtt-cthulhu-eternal/templates/chat-ask-roll.hbs`, {
text: text,
rollType: type,
value: value,
}),
whisper: [recipient],
flags: { tenebris: { typeMessage: "askRoll" } },
})
}
}

View File

@ -1,5 +1,5 @@
export const BOND_TYPE = {
"individual": "CTHULHUETERNAL.Weapon.WeaponType.melee",
"community": "CTHULHUETERNAL.Weapon.WeaponType.ranged"
"individual": "CTHULHUETERNAL.BondType.individual",
"community": "CTHULHUETERNAL.BondType.community"
}

View File

@ -7,9 +7,9 @@ export const CHARACTERISTICS = Object.freeze({
id: "int",
label: "CTHULHUETERNAL.Character.int.label"
},
wis: {
id: "wis",
label: "CTHULHUETERNAL.Character.wis.label"
pow: {
id: "pow",
label: "CTHULHUETERNAL.Character.pow.label"
},
dex: {
id: "dex",
@ -22,36 +22,6 @@ export const CHARACTERISTICS = Object.freeze({
cha: {
id: "cha",
label: "CTHULHUETERNAL.Character.cha.label"
},
app: {
id: "app",
label: "CTHULHUETERNAL.Character.app.label"
},
})
export const SAVES = Object.freeze({
str: {
id: "str",
label: "CTHULHUETERNAL.Character.str.label"
},
agility: {
id: "agility",
label: "CTHULHUETERNAL.Character.agility.label"
},
dying: {
id: "dying",
label: "CTHULHUETERNAL.Character.dying.label"
},
will: {
id: "will",
label: "CTHULHUETERNAL.Character.will.label"
},
dodge: {
id: "dodge",
label: "CTHULHUETERNAL.Character.dodge.label"
},
toughness: {
id: "toughness",
label: "CTHULHUETERNAL.Character.toughness.label"
}
})

View File

@ -1,44 +0,0 @@
/**
* Menu spécifique au système
*/
export function initControlButtons() {
CONFIG.Canvas.layers.tenebris = { layerClass: ControlsLayer, group: "primary" }
Hooks.on("getSceneControlButtons", (btns) => {
let menu = []
menu.push({
name: "fortune",
title: game.i18n.localize("TENEBRIS.Fortune.title"),
icon: "fa-solid fa-clover",
button: true,
onClick: () => {
if (!foundry.applications.instances.has("tenebris-application-fortune")) {
game.system.applicationFortune.render(true)
} else game.system.applicationFortune.close()
},
})
if (game.user.isGM) {
menu.push({
name: "gm-manager",
title: game.i18n.localize("TENEBRIS.Manager.title"),
icon: "fa-solid fa-users",
button: true,
onClick: () => {
if (!foundry.applications.instances.has("tenebris-application-manager")) {
game.system.applicationManager.render(true)
} else game.system.applicationManager.close()
},
})
}
btns.push({
name: "tenebris",
title: "Cthulhu CthulhuEternal",
icon: "tenebris",
layer: "tenebris",
tools: menu,
})
})
}

View File

@ -105,21 +105,21 @@ export default class CthulhuEternalRoll extends Roll {
switch (this.type) {
case ROLL_TYPE.SAVE:
const saveLabel = game.i18n.localize(`TENEBRIS.Character.FIELDS.caracteristiques.${this.target}.valeur.label`)
text = game.i18n.format("TENEBRIS.Roll.save", { save: saveLabel })
const saveLabel = game.i18n.localize(`CTHULHUETERNAL.Character.FIELDS.caracteristiques.${this.target}.valeur.label`)
text = game.i18n.format("CTHULHUETERNAL.Roll.save", { save: saveLabel })
text = text.concat("<br>").concat(`Seuil : ${this.treshold}`)
break
case ROLL_TYPE.RESOURCE:
const resourceLabel = game.i18n.localize(`TENEBRIS.Character.FIELDS.ressources.${this.target}.valeur.label`)
text = game.i18n.format("TENEBRIS.Roll.resource", { resource: resourceLabel })
const resourceLabel = game.i18n.localize(`CTHULHUETERNAL.Character.FIELDS.ressources.${this.target}.valeur.label`)
text = game.i18n.format("CTHULHUETERNAL.Roll.resource", { resource: resourceLabel })
break
case ROLL_TYPE.DAMAGE:
const damageLabel = this.target
text = game.i18n.format("TENEBRIS.Roll.damage", { item: damageLabel })
text = game.i18n.format("CTHULHUETERNAL.Roll.damage", { item: damageLabel })
break
case ROLL_TYPE.ATTACK:
const attackLabel = this.target
text = game.i18n.format("TENEBRIS.Roll.attack", { item: attackLabel })
text = game.i18n.format("CTHULHUETERNAL.Roll.attack", { item: attackLabel })
break
}
return text
@ -131,7 +131,7 @@ export default class CthulhuEternalRoll extends Roll {
* @returns {string} A formatted string containing the value, help, hindrance, and modifier.
*/
_createIntroTextTooltip() {
let tooltip = game.i18n.format("TENEBRIS.Tooltip.saveIntroTextTooltip", { value: this.value, aide: this.aide, gene: this.gene, modificateur: this.modificateur })
let tooltip = game.i18n.format("CTHULHUETERNAL.Tooltip.saveIntroTextTooltip", { value: this.value, aide: this.aide, gene: this.gene, modificateur: this.modificateur })
if (this.hasTarget) {
tooltip = tooltip.concat(`<br>Cible : ${this.targetName}`)
}
@ -160,9 +160,9 @@ export default class CthulhuEternalRoll extends Roll {
// Formula for a resource roll
if (options.rollType === ROLL_TYPE.RESOURCE) {
let ressource = game.i18n.localize(`TENEBRIS.Character.FIELDS.ressources.${options.rollTarget}.valeur.label`)
let ressource = game.i18n.localize(`CTHULHUETERNAL.Character.FIELDS.ressources.${options.rollTarget}.valeur.label`)
if (formula === "0" || formula === "") {
ui.notifications.warn(game.i18n.format("TENEBRIS.Warning.plusDeRessource", { ressource: ressource }))
ui.notifications.warn(game.i18n.format("CTHULHUETERNAL.Warning.plusDeRessource", { ressource: ressource }))
return null
}
}
@ -266,10 +266,10 @@ export default class CthulhuEternalRoll extends Roll {
const content = await renderTemplate("systems/fvtt-cthulhu-eternal/templates/roll-dialog.hbs", dialogContext)
const title = CthulhuEternalRoll.createTitle(options.rollType, options.rollTarget)
const label = game.i18n.localize("TENEBRIS.Roll.roll")
const label = game.i18n.localize("CTHULHUETERNAL.Roll.roll")
const rollContext = await foundry.applications.api.DialogV2.wait({
window: { title: title },
classes: ["lethalfantasy"],
classes: ["fvtt-cthulhu-eternal"],
content,
buttons: [
{
@ -429,15 +429,15 @@ export default class CthulhuEternalRoll extends Roll {
static createTitle(type, target) {
switch (type) {
case ROLL_TYPE.SAVE:
return `${game.i18n.localize("TENEBRIS.Dialog.titleSave")} : ${game.i18n.localize(`TENEBRIS.Manager.${target}`)}`
return `${game.i18n.localize("CTHULHUETERNAL.Dialog.titleSave")} : ${game.i18n.localize(`CTHULHUETERNAL.Manager.${target}`)}`
case ROLL_TYPE.RESOURCE:
return `${game.i18n.localize("TENEBRIS.Dialog.titleResource")} : ${game.i18n.localize(`TENEBRIS.Manager.${target}`)}`
return `${game.i18n.localize("CTHULHUETERNAL.Dialog.titleResource")} : ${game.i18n.localize(`CTHULHUETERNAL.Manager.${target}`)}`
case ROLL_TYPE.DAMAGE:
return `${game.i18n.localize("TENEBRIS.Dialog.titleDamage")} : ${target}`
return `${game.i18n.localize("CTHULHUETERNAL.Dialog.titleDamage")} : ${target}`
case ROLL_TYPE.ATTACK:
return `${game.i18n.localize("TENEBRIS.Dialog.titleAttack")} : ${target}`
return `${game.i18n.localize("CTHULHUETERNAL.Dialog.titleAttack")} : ${target}`
default:
return game.i18n.localize("TENEBRIS.Dialog.titleStandard")
return game.i18n.localize("CTHULHUETERNAL.Dialog.titleStandard")
}
}
@ -543,25 +543,25 @@ export default class CthulhuEternalRoll extends Roll {
static _convertAvantages(value) {
switch (value) {
case "1":
return game.i18n.localize("TENEBRIS.Roll.doubleDesavantage")
return game.i18n.localize("CTHULHUETERNAL.Roll.doubleDesavantage")
case "2":
return game.i18n.localize("TENEBRIS.Roll.desavantage")
return game.i18n.localize("CTHULHUETERNAL.Roll.desavantage")
case "3":
return game.i18n.localize("TENEBRIS.Roll.normal")
return game.i18n.localize("CTHULHUETERNAL.Roll.normal")
case "4":
return game.i18n.localize("TENEBRIS.Roll.avantage")
return game.i18n.localize("CTHULHUETERNAL.Roll.avantage")
case "5":
return game.i18n.localize("TENEBRIS.Roll.doubleAvantage")
return game.i18n.localize("CTHULHUETERNAL.Roll.doubleAvantage")
case "--":
return game.i18n.localize("TENEBRIS.Roll.doubleDesavantage")
return game.i18n.localize("CTHULHUETERNAL.Roll.doubleDesavantage")
case "-":
return game.i18n.localize("TENEBRIS.Roll.desavantage")
return game.i18n.localize("CTHULHUETERNAL.Roll.desavantage")
case "=":
return game.i18n.localize("TENEBRIS.Roll.normal")
return game.i18n.localize("CTHULHUETERNAL.Roll.normal")
case "+":
return game.i18n.localize("TENEBRIS.Roll.avantage")
return game.i18n.localize("CTHULHUETERNAL.Roll.avantage")
case "++":
return game.i18n.localize("TENEBRIS.Roll.doubleAvantage")
return game.i18n.localize("CTHULHUETERNAL.Roll.doubleAvantage")
}
}

View File

@ -14,9 +14,7 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
const characteristicField = (label) => {
const schema = {
value: new fields.NumberField({ ...requiredInteger, initial: 3, min: 0 }),
percent: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 100 }),
attackMod: new fields.NumberField({ ...requiredInteger, initial: 0 }),
defenseMod: new fields.NumberField({ ...requiredInteger, initial: 0 })
feature: new fields.StringField({ required: true, nullable: false, initial: "" })
}
return new fields.SchemaField(schema, { label })
}
@ -28,44 +26,44 @@ export default class CthulhuEternalProtagonist extends foundry.abstract.TypeData
}, {}),
)
schema.wp = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
exhausted: new fields.BooleanField({ required: true, initial: false })
})
schema.hp = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
})
schema.perception = new fields.SchemaField({
schema.san = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
bonus: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
recoverySAN: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
violence: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
helplessness: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
breakingPoint: new fields.BooleanField({ required: true, initial: false })
})
schema.grit = new fields.SchemaField({
earned: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
current: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
schema.luck = new fields.SchemaField({
earned: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
current: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
schema.movement = new fields.SchemaField({
walk: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
jog: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
sprint: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
run: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
armorAdjust: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
schema.damageBonus = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
schema.resources = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
hand: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
stowed: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
storage: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
schema.biodata = new fields.SchemaField({
class: new fields.StringField({ required: true, nullable: false, initial: "" }),
level: new fields.NumberField({ ...requiredInteger, initial: 1, min: 1 }),
mortal: new fields.StringField({ required: true, nullable: false, initial: "" }),
alignment: new fields.StringField({ required: true, nullable: false, initial: "" }),
age: new fields.NumberField({ ...requiredInteger, initial: 15, min: 6 }),
height: new fields.NumberField({ ...requiredInteger, initial: 170, min: 50 }),
gender: new fields.StringField({ required: true, nullable: false, initial: "" }),
home: new fields.StringField({ required: true, nullable: false, initial: "" }),
birthplace: new fields.StringField({ required: true, nullable: false, initial: "" }),
eyes: new fields.StringField({ required: true, nullable: false, initial: "" }),
hair: new fields.StringField({ required: true, nullable: false, initial: "" })
})
schema.developmentPoints = new fields.SchemaField({
total: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
remaining: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
})
return schema
}

View File

@ -12,7 +12,7 @@ export default class LethalFantasySkill extends foundry.abstract.TypeDataModel {
schema.weaponType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_TYPE })
schema.damage = new fields.StringField({required: true, initial: "1d6"})
schema.baseRange = new fields.StringField({required: true, initial: ""})
schema.rangeDistance = new fields.StringField({ required: true, initial: "yard", choices: SYSTEM.WEAPON_RANGE_UNIT })
schema.rangeUnit = new fields.StringField({ required: true, initial: "yard", choices: SYSTEM.WEAPON_RANGE_UNIT })
schema.lethality = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.killRadius = new fields.NumberField({ required: true, initial: 0, min: 0 })