From 0b4ae7a097233c5770e5bcd358377484b50be8b1 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Fri, 14 Feb 2025 13:28:09 +0100 Subject: [PATCH] Add missing items/actors --- ftl-nomad.mjs | 12 +- module/applications/_module.mjs | 6 +- .../sheets/creature-ability-sheet.mjs | 28 +++ .../{npc-sheet.mjs => creature-sheet.mjs} | 0 .../sheets/creature-trait-sheet.mjs | 28 +++ module/applications/sheets/implant-sheet.mjs | 27 +++ module/applications/sheets/starship-sheet.mjs | 117 +++++++++ module/applications/sheets/talent-sheet.mjs | 2 +- module/applications/sheets/vehicle-sheet.mjs | 10 +- module/config/system.mjs | 28 ++- module/models/_module.mjs | 6 +- module/models/armor.mjs | 7 +- module/models/creature-ability.mjs | 16 ++ module/models/creature-trait.mjs | 16 ++ module/models/{npc.mjs => creature.mjs} | 2 +- module/models/equipment.mjs | 9 +- module/models/implant.mjs | 22 ++ module/models/psionic.mjs | 9 - module/models/starship.mjs | 31 +++ module/models/talent.mjs | 51 +--- module/models/vehicle.mjs | 5 +- module/models/weapon.mjs | 5 +- styles/character.less | 46 ++-- styles/{npc.less => creature.less} | 0 styles/fvtt-ftl-nomad.less | 7 +- styles/implant.less | 22 ++ styles/psionic.less | 2 +- styles/starship.less | 223 ++++++++++++++++++ styles/talent.less | 2 +- system.json | 13 +- 30 files changed, 636 insertions(+), 116 deletions(-) create mode 100644 module/applications/sheets/creature-ability-sheet.mjs rename module/applications/sheets/{npc-sheet.mjs => creature-sheet.mjs} (100%) create mode 100644 module/applications/sheets/creature-trait-sheet.mjs create mode 100644 module/applications/sheets/implant-sheet.mjs create mode 100644 module/applications/sheets/starship-sheet.mjs create mode 100644 module/models/creature-ability.mjs create mode 100644 module/models/creature-trait.mjs rename module/models/{npc.mjs => creature.mjs} (97%) create mode 100644 module/models/implant.mjs create mode 100644 module/models/starship.mjs rename styles/{npc.less => creature.less} (100%) create mode 100644 styles/implant.less create mode 100644 styles/starship.less diff --git a/ftl-nomad.mjs b/ftl-nomad.mjs index 4111845..ec14fd6 100644 --- a/ftl-nomad.mjs +++ b/ftl-nomad.mjs @@ -34,7 +34,8 @@ Hooks.once("init", function () { CONFIG.Actor.dataModels = { protagonist: models.FTLNomadCharacter, vehicle: models.FTLNomadVehicle, - creature: models.FTLNomadNPC + creature: models.FTLNomadNPC, + starship: models.FTLNomadStarship } CONFIG.Item.documentClass = documents.FTLNomadItem @@ -44,14 +45,16 @@ Hooks.once("init", function () { armor: models.FTLNomadArmor, talent: models.FTLNomadTalent, language: models.FTLNomadLanguage, - equipment: models.FTLNomadEquipment + equipment: models.FTLNomadEquipment, + implant: models.FTLNomadImplant } // Register sheet application classes Actors.unregisterSheet("core", ActorSheet) Actors.registerSheet("fvtt-ftl-nomad", applications.FTLNomadCharacterSheet , { types: ["character"], makeDefault: true }) Actors.registerSheet("fvtt-ftl-nomad", applications.FTLNomadVehicleSheet, { types: ["vehicle"], makeDefault: true }) - Actors.registerSheet("fvtt-ftl-nomad", applications.FTLNomadNPCSheet, { types: ["npc"], makeDefault: true }) + Actors.registerSheet("fvtt-ftl-nomad", applications.FTLNomadCreatureSheet, { types: ["creature"], makeDefault: true }) + Actors.registerSheet("fvtt-ftl-nomad", applications.FTLNomadStarshipSheet, { types: ["starship"], makeDefault: true }) Items.unregisterSheet("core", ItemSheet) Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadPsionicSheet, { types: ["psionic"], makeDefault: true }) @@ -60,6 +63,9 @@ Hooks.once("init", function () { Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadWeaponSheet, { types: ["weapon"], makeDefault: true }) Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadArmorSheet, { types: ["armor"], makeDefault: true }) Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadEquipmentSheet, { types: ["equipment"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadImplantSheet, { types: ["implant"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadCreatureTraitSheet, { types: ["creature-trait"], makeDefault: true }) + Items.registerSheet("fvtt-ftl-nomad", applications.FTLNomadCreatureAbilitySheet, { types: ["creature-ability"], makeDefault: true }) // Other Document Configuration CONFIG.ChatMessage.documentClass = documents.FTLNomadChatMessage diff --git a/module/applications/_module.mjs b/module/applications/_module.mjs index 25658e4..d7f7bf8 100644 --- a/module/applications/_module.mjs +++ b/module/applications/_module.mjs @@ -6,5 +6,9 @@ export { default as FTLNomadLanguageSheet } from "./sheets/language-sheet.mjs" export { default as FTLNomadTalentSheet } from "./sheets/talent-sheet.mjs" export { default as FTLNomadCharacterSheet } from "./sheets/character-sheet.mjs" export { default as FTLNomadEquipmentSheet } from "./sheets/equipment-sheet.mjs" -export { default as FTLNomadNPCSheet } from "./sheets/npc-sheet.mjs" +export { default as FTLNomadNPCSheet } from "./sheets/creature-sheet.mjs" +export { default as FTLNomadImplantSheet } from "./sheets/implant-sheet.mjs" +export { default as FTLNomadStarshipSheet } from "./sheets/starship-sheet.mjs" +export { default as FTLNomadCreatureTraitSheet } from "./sheets/creature-trait-sheet.mjs" +export { default as FTLNomadCreatureAbilitySheet } from "./sheets/creature-ability-sheet.mjs" diff --git a/module/applications/sheets/creature-ability-sheet.mjs b/module/applications/sheets/creature-ability-sheet.mjs new file mode 100644 index 0000000..e470011 --- /dev/null +++ b/module/applications/sheets/creature-ability-sheet.mjs @@ -0,0 +1,28 @@ +import FTLNomadItemSheet from "./base-item-sheet.mjs" + +export default class FTLNomadCreatureAbilitySheet extends FTLNomadItemSheet { + /** @override */ + static DEFAULT_OPTIONS = { + classes: ["creature-ability"], + position: { + width: 600, + }, + window: { + contentClasses: ["creature-ability-content"], + }, + } + + /** @override */ + static PARTS = { + main: { + template: "systems/fvtt-ftl-nomad/templates/creature-ability.hbs", + }, + } + + /** @override */ + async _prepareContext() { + const context = await super._prepareContext() + context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true }) + return context + } +} diff --git a/module/applications/sheets/npc-sheet.mjs b/module/applications/sheets/creature-sheet.mjs similarity index 100% rename from module/applications/sheets/npc-sheet.mjs rename to module/applications/sheets/creature-sheet.mjs diff --git a/module/applications/sheets/creature-trait-sheet.mjs b/module/applications/sheets/creature-trait-sheet.mjs new file mode 100644 index 0000000..bfa2e75 --- /dev/null +++ b/module/applications/sheets/creature-trait-sheet.mjs @@ -0,0 +1,28 @@ +import FTLNomadItemSheet from "./base-item-sheet.mjs" + +export default class FTLNomadCreatureTraitSheet extends FTLNomadItemSheet { + /** @override */ + static DEFAULT_OPTIONS = { + classes: ["creature-trait"], + position: { + width: 600, + }, + window: { + contentClasses: ["creature-trait-content"], + }, + } + + /** @override */ + static PARTS = { + main: { + template: "systems/fvtt-ftl-nomad/templates/creature-trait.hbs", + }, + } + + /** @override */ + async _prepareContext() { + const context = await super._prepareContext() + context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true }) + return context + } +} diff --git a/module/applications/sheets/implant-sheet.mjs b/module/applications/sheets/implant-sheet.mjs new file mode 100644 index 0000000..25c0fc1 --- /dev/null +++ b/module/applications/sheets/implant-sheet.mjs @@ -0,0 +1,27 @@ +import FTLNomadItemSheet from "./base-item-sheet.mjs" + +export default class FTLNomadImplantSheet extends FTLNomadItemSheet { + /** @override */ + static DEFAULT_OPTIONS = { + classes: ["implant"], + position: { + width: 600, + }, + window: { + contentClasses: ["implant-content"], + }, + } + + /** @override */ + static PARTS = { + main: { + template: "systems/fvtt-cthulhu-eternal/templates/implant.hbs", + }, + } + + /** @override */ + async _prepareContext() { + const context = await super._prepareContext() + return context + } +} diff --git a/module/applications/sheets/starship-sheet.mjs b/module/applications/sheets/starship-sheet.mjs new file mode 100644 index 0000000..2096e17 --- /dev/null +++ b/module/applications/sheets/starship-sheet.mjs @@ -0,0 +1,117 @@ +import FTLNomadActorSheet from "./base-actor-sheet.mjs" + +export default class FTLNomadStarshipSheet extends FTLNomadActorSheet { + /** @override */ + static DEFAULT_OPTIONS = { + classes: ["vehicle"], + position: { + width: 680, + height: 540, + }, + window: { + contentClasses: ["vehicle-content"], + }, + actions: { + createGear: FTLNomadStarshipSheet.#onCreateGear, + createWeapon: FTLNomadStarshipSheet.#onCreateWeapon, + }, + } + + /** @override */ + static PARTS = { + main: { + template: "systems/fvtt-ftl-nomad/templates/starship-main.hbs", + }, + tabs: { + template: "templates/generic/tab-navigation.hbs", + }, + equipment: { + template: "systems/fvtt-ftl-nomad/templates/starship-equipment.hbs", + }, + description: { + template: "systems/fvtt-ftl-nomad/templates/starship-description.hbs", + }, + } + + /** @override */ + tabGroups = { + sheet: "equipment", + } + + /** + * Prepare an array of form header tabs. + * @returns {Record>} + */ + #getTabs() { + const tabs = { + equipment: { id: "equipment", group: "sheet", icon: "fa-solid fa-shapes", label: "FTLNOMAD.Label.equipment" }, + description: { id: "description", group: "sheet", icon: "fa-solid fa-book", label: "FTLNOMAD.Label.description" }, + } + for (const v of Object.values(tabs)) { + v.active = this.tabGroups[v.group] === v.id + v.cssClass = v.active ? "active" : "" + } + return tabs + } + + /** @override */ + async _prepareContext() { + const context = await super._prepareContext() + context.tabs = this.#getTabs() + + context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true }) + context.enrichedNotes = await TextEditor.enrichHTML(this.document.system.notes, { async: true }) + + return context + } + + _generateTooltip(type, target) { + } + + /** @override */ + async _preparePartContext(partId, context) { + const doc = this.document + switch (partId) { + case "main": + break + case "equipment": + context.tab = context.tabs.equipment + context.weapons = doc.itemTypes.weapon + context.gears = doc.itemTypes.gear + break + case "description": + context.tab = context.tabs.description + context.enrichedDescription = await TextEditor.enrichHTML(doc.system.description, { async: true }) + context.enrichedNotes = await TextEditor.enrichHTML(doc.system.notes, { async: true }) + break + } + return context + } + + /** + * Creates a new attack item directly from the sheet and embeds it into the document. + * @param {Event} event The initiating click event. + * @param {HTMLElement} target The current target of the event listener. + */ + static #onCreateGear(event, target) { + this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newGear"), type: "gear" }]) + } + + static #onCreateWeapon(event, target) { + this.document.createEmbeddedDocuments("Item", [{ name: game.i18n.localize("FTLNOMAD.Label.newWeapon"), type: "weapon" }]) + } + + + async _onDrop(event) { + if (!this.isEditable || !this.isEditMode) return + const data = TextEditor.getDragEventData(event) + + // Handle different data types + switch (data.type) { + case "Item": + const item = await fromUuid(data.uuid) + return super._onDropItem(item) + } + } + +} diff --git a/module/applications/sheets/talent-sheet.mjs b/module/applications/sheets/talent-sheet.mjs index 62eefcb..34d136a 100644 --- a/module/applications/sheets/talent-sheet.mjs +++ b/module/applications/sheets/talent-sheet.mjs @@ -15,7 +15,7 @@ export default class FTLNomadTalentSheet extends FTLNomadItemSheet { /** @override */ static PARTS = { main: { - template: "systems/fvtt-cthulhu-eternal/templates/talent.hbs", + template: "systems/fvtt-ftl-nomad/templates/talent.hbs", }, } diff --git a/module/applications/sheets/vehicle-sheet.mjs b/module/applications/sheets/vehicle-sheet.mjs index d2ef880..cdf0e4e 100644 --- a/module/applications/sheets/vehicle-sheet.mjs +++ b/module/applications/sheets/vehicle-sheet.mjs @@ -12,24 +12,24 @@ export default class FTLNomadVehicleSheet extends FTLNomadActorSheet { contentClasses: ["vehicle-content"], }, actions: { - createGear: CthulhuEternalVehicleSheet.#onCreateGear, - createWeapon: CthulhuEternalVehicleSheet.#onCreateWeapon, + createGear: FTLNomadVehicleSheet.#onCreateGear, + createWeapon: FTLNomadVehicleSheet.#onCreateWeapon, }, } /** @override */ static PARTS = { main: { - template: "systems/fvtt-cthulhu-eternal/templates/vehicle-main.hbs", + template: "systems/fvtt-ftl-nomad/templates/vehicle-main.hbs", }, tabs: { template: "templates/generic/tab-navigation.hbs", }, equipment: { - template: "systems/fvtt-cthulhu-eternal/templates/vehicle-equipment.hbs", + template: "systems/fvtt-ftl-nomad/templates/vehicle-equipment.hbs", }, description: { - template: "systems/fvtt-cthulhu-eternal/templates/vehicle-description.hbs", + template: "systems/fvtt-ftl-nomad/templates/vehicle-description.hbs", }, } diff --git a/module/config/system.mjs b/module/config/system.mjs index 8f29b6e..6566556 100644 --- a/module/config/system.mjs +++ b/module/config/system.mjs @@ -35,12 +35,38 @@ export const SKILLS = { "technology": { id: "technology", label: "FTLNOMAD.Skill.Technology" } } +export const TECH_AGES = { + "notech": { id: "notech", level: 0, label: "FTLNOMAD.TechAge.NoTech" }, + "earlyprimitive": { id: "earlyprimitive", label: "FTLNOMAD.TechAge.EarlyPrimitive", level: 1 }, + "lateprimitive": { id: "lateprimitive", label: "FTLNOMAD.TechAge.LatePrimitive", level: 2 }, + "earlymechanical": { id: "earlymechanical", label: "FTLNOMAD.TechAge.EarlyMechanical", level: 3 }, + "latemechanical": { id: "latemechanical", label: "FTLNOMAD.TechAge.LateMechanical", level: 4 }, + "earlyatomic": { id: "earlyatomic", label: "FTLNOMAD.TechAge.EarlyAtomic", level: 5 }, + "lateatomic": { id: "lateatomic", label: "FTLNOMAD.TechAge.LateAtomic", level: 6 }, + "earlyspace": { id: "earlyspace", label: "FTLNOMAD.TechAge.EarlySpace", level: 7 }, + "latespace": { id: "latespace", label: "FTLNOMAD.TechAge.LateSpace", level: 8 }, + "earlyinterstellar": { id: "earlyinterstellar", label: "FTLNOMAD.TechAge.EarlyInterstellar", level: 9 }, + "lateinterstellar": { id: "lateinterstellar", label: "FTLNOMAD.TechAge.LateInterstellar", level: 10 }, + "earlygalactic" : { id: "earlygalactic", label: "FTLNOMAD.TechAge.EarlyGalactic", level: 11 }, + "lategalactic": { id: "lategalactic", label: "FTLNOMAD.TechAge.LateGalactic", level: 12 }, + "cosmic": { id: "cosmic", label: "FTLNOMAD.TechAge.Cosmic", level: 13 } +} + +export const WEAPON_RANGE = { + "melee": {id: "melee", label: "FTLNOMAD.Weapon.Range.Melee"}, + "handgun": {id: "handgun", label: "FTLNOMAD.Weapon.Range.Handgun"}, + "rifle" : {id: "rifle", label: "FTLNOMAD.Weapon.Range.Rifle"}, + "longrange": {id: "longrange", label: "FTLNOMAD.Weapon.Range.LongRange"}, +} + /** * Include all constant definitions within the SYSTEM global export * @type {Object} */ export const SYSTEM = { id: SYSTEM_ID, - SKILLS: SKILLS, + TECH_AGES, + WEAPON_RANGE, + SKILLS, ASCII } diff --git a/module/models/_module.mjs b/module/models/_module.mjs index bfff58f..616059c 100644 --- a/module/models/_module.mjs +++ b/module/models/_module.mjs @@ -3,8 +3,12 @@ export { default as FTLNomadPsionic } from "./psionic.mjs" export { default as FTLNomadLanguage } from "./language.mjs" export { default as FTLNomadTalent } from "./talent.mjs" export { default as FTLNomadArmor } from "./armor.mjs" -export { default as FTLNomadNPC } from "./npc.mjs" +export { default as FTLNomadCreature } from "./creature.mjs" export { default as FTLNomadVehicle } from "./vehicle.mjs" export { default as FTLNomadCharacter } from "./character.mjs" export { default as FTLNomadEquipment } from "./equipment.mjs" +export { default as FTLNomadImplant } from "./implant.mjs" +export { default as FTLNomadStarship } from "./starship.mjs" +export { default as FTLNomadCreatureTrait } from "./creature-trait.mjs" +export { default as FTLNomadCreatureAbility } from "./creature-ability.mjs" diff --git a/module/models/armor.mjs b/module/models/armor.mjs index c212703..44b81ef 100644 --- a/module/models/armor.mjs +++ b/module/models/armor.mjs @@ -7,11 +7,10 @@ export default class FTLNomadArmor extends foundry.abstract.TypeDataModel { schema.description = new fields.HTMLField({ required: true, textSearch: true }) - let setting = game.settings.get("fvtt-cthulhu-eternal", "settings-era") || "modern" - schema.settings = new fields.StringField({ required: true, initial: setting, choices: SYSTEM.AVAILABLE_SETTINGS }) - + schema.techage = new fields.StringField({ required: true, choices: SYSTEM.TECH_AGES, initial : "latenuclear" }) schema.protection = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }) - schema.resourceLevel = new fields.NumberField({ required: true, initial: 0, min: 0 }) + schema.enc = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }) + schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 }) return schema } diff --git a/module/models/creature-ability.mjs b/module/models/creature-ability.mjs new file mode 100644 index 0000000..8f274f0 --- /dev/null +++ b/module/models/creature-ability.mjs @@ -0,0 +1,16 @@ +import { SYSTEM } from "../config/system.mjs"; + +export default class FTLNomadCreatureAbility extends foundry.abstract.TypeDataModel { + static defineSchema() { + const fields = foundry.data.fields; + const schema = {}; + + schema.isadvantage = new fields.BooleanField({ required: true, initial: false }); + schema.description = new fields.HTMLField({ required: true, textSearch: true }) + + return schema; + } + + /** @override */ + static LOCALIZATION_PREFIXES = ["FTLNomad.CreatureAbility"]; +} \ No newline at end of file diff --git a/module/models/creature-trait.mjs b/module/models/creature-trait.mjs new file mode 100644 index 0000000..5f417c8 --- /dev/null +++ b/module/models/creature-trait.mjs @@ -0,0 +1,16 @@ +import { SYSTEM } from "../config/system.mjs"; + +export default class FTLNomadCreatureTrait extends foundry.abstract.TypeDataModel { + static defineSchema() { + const fields = foundry.data.fields; + const schema = {}; + + schema.isadvantage = new fields.BooleanField({ required: true, initial: false }); + schema.description = new fields.HTMLField({ required: true, textSearch: true }) + + return schema; + } + + /** @override */ + static LOCALIZATION_PREFIXES = ["FTLNomad.CreatureTrait"]; +} \ No newline at end of file diff --git a/module/models/npc.mjs b/module/models/creature.mjs similarity index 97% rename from module/models/npc.mjs rename to module/models/creature.mjs index 7f5f3b8..9cee692 100644 --- a/module/models/npc.mjs +++ b/module/models/creature.mjs @@ -1,7 +1,7 @@ import { SYSTEM } from "../config/system.mjs" import FTLNomadRoll from "../documents/roll.mjs" -export default class FTLNomadNPC extends foundry.abstract.TypeDataModel { +export default class FTLNomadCreature extends foundry.abstract.TypeDataModel { static defineSchema() { const fields = foundry.data.fields const requiredInteger = { required: true, nullable: false, integer: true } diff --git a/module/models/equipment.mjs b/module/models/equipment.mjs index dcd4119..409e6cc 100644 --- a/module/models/equipment.mjs +++ b/module/models/equipment.mjs @@ -8,11 +8,10 @@ export default class FTLNomadEquipment extends foundry.abstract.TypeDataModel { schema.description = new fields.HTMLField({ required: true, textSearch: true }) - let setting = game.settings.get("fvtt-cthulhu-eternal", "settings-era") || "modern" - schema.settings = new fields.StringField({ required: true, initial: setting, choices: SYSTEM.AVAILABLE_SETTINGS }) - - schema.resourceLevel = new fields.NumberField({ required: true, initial: 0, min: 0 }) - schema.state = new fields.StringField({ required: true, initial: "pristine", choices: SYSTEM.EQUIPMENT_STATES }) + schema.techage = new fields.StringField({ required: true, choices: SYSTEM.TECH_AGES, initial : "latenuclear" }) + + schema.enc = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }) + schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 }) return schema } diff --git a/module/models/implant.mjs b/module/models/implant.mjs new file mode 100644 index 0000000..ca4f15b --- /dev/null +++ b/module/models/implant.mjs @@ -0,0 +1,22 @@ +import { SYSTEM } from "../config/system.mjs" + +export default class FTLNomadImplant extends foundry.abstract.TypeDataModel { + static defineSchema() { + const fields = foundry.data.fields + const schema = {} + const requiredInteger = { required: true, nullable: false, integer: true } + + schema.description = new fields.HTMLField({ required: true, textSearch: true }) + + schema.techage = new fields.StringField({ required: true, choices: SYSTEM.TECH_AGES, initial : "latenuclear" }) + + schema.enc = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }) + schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 }) + + return schema + } + + /** @override */ + static LOCALIZATION_PREFIXES = ["FTLNOMAD.Implant"] + +} diff --git a/module/models/psionic.mjs b/module/models/psionic.mjs index 2c67e95..a6bbbf1 100644 --- a/module/models/psionic.mjs +++ b/module/models/psionic.mjs @@ -8,15 +8,6 @@ export default class FTLNomadPsionic extends foundry.abstract.TypeDataModel { schema.description = new fields.HTMLField({ required: true, textSearch: true }) - let setting = game.settings.get("fvtt-cthulhu-eternal", "settings-era") || "modern" - schema.settings = new fields.StringField({ required: true, initial: setting, choices: SYSTEM.AVAILABLE_SETTINGS }) - - schema.base = new fields.StringField({ required: true, initial: "0" }) - schema.bonus = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 }) - schema.diceEvolved = new fields.BooleanField({ required: true, initial: true }) - schema.rollFailed = new fields.BooleanField({ required: true, initial: false }) - schema.isAdversary = new fields.BooleanField({ required: true, initial: false }) - return schema } diff --git a/module/models/starship.mjs b/module/models/starship.mjs new file mode 100644 index 0000000..49b964b --- /dev/null +++ b/module/models/starship.mjs @@ -0,0 +1,31 @@ +import { SYSTEM } from "../config/system.mjs" +import FTLNomadRoll from "../documents/roll.mjs" + +export default class FTLNomadStarship extends foundry.abstract.TypeDataModel { + static defineSchema() { + const fields = foundry.data.fields + const requiredInteger = { required: true, nullable: false, integer: true } + const schema = {} + + schema.agility = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }) + schema.hullType = new fields.StringField({ required: true, initial: "small", choices: SYSTEM.STARSHIP_HULL }) + schema.endurance = new fields.StringField({ required: true, initial: "" }) + schema.armor = new fields.StringField({ required: true, initial: "" }) + schema.crew = new fields.NumberField({ ...requiredInteger, initial: 1, min: 1 }) + schema.cargo = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }) + schema.guns = new fields.StringField({ required: true, initial: "1d6" }) + schema.travelMultiplier = new fields.NumberField({ required: true, initial: 1, min: 0 }) + schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 }) + schema.monthlyCost = new fields.NumberField({ required: true, initial: 0, min: 0 }) + + schema.description = new fields.HTMLField({ required: true, textSearch: true }) + schema.modifications = new fields.HTMLField({ required: true, textSearch: true }) + schema.notes = new fields.HTMLField({ required: true, textSearch: true }) + + return schema + } + + /** @override */ + static LOCALIZATION_PREFIXES = ["FTLNomad.Starship"] + +} diff --git a/module/models/talent.mjs b/module/models/talent.mjs index c94eaa4..5add64e 100644 --- a/module/models/talent.mjs +++ b/module/models/talent.mjs @@ -5,55 +5,8 @@ export default class FTLNomadTalent extends foundry.abstract.TypeDataModel { const fields = foundry.data.fields; const schema = {}; - let setting = game.settings.get("fvtt-cthulhu-eternal", "settings-era") || "modern" - schema.minimumEra = new fields.StringField({ required: true, initial: setting, choices: SYSTEM.AVAILABLE_SETTINGS }) - - schema.creationDate = new fields.StringField({ - required: true, - initial: "", - textSearch: true - }); - - // Language field - schema.language = new fields.StringField({ - required: true, - initial: "Latin", - textSearch: true - }); - - // studyTime field - schema.studyTime = new fields.StringField({ - required: true, - initial: "X days", - textSearch: true - }); - - // SAN loss field - schema.sanLoss = new fields.StringField({ - required: true, - initial: "1d4", - textSearch: true - }); - - // Unnatural skill field - schema.unnaturalSkill = new fields.StringField({ - required: true, - initial: "1d4", - textSearch: true - }); - - schema.rituals = new fields.StringField({ - required: true, - initial: "", - textSearch: true - }); - - schema.otherBenefits = new fields.StringField({ - required: true, - initial: "", - textSearch: true - }); - + schema.isadvantage = new fields.BooleanField({ required: true, initial: false }); + schema.description = new fields.HTMLField({ required: true, textSearch: true }) return schema; diff --git a/module/models/vehicle.mjs b/module/models/vehicle.mjs index 80bb190..630a634 100644 --- a/module/models/vehicle.mjs +++ b/module/models/vehicle.mjs @@ -1,15 +1,12 @@ import { SYSTEM } from "../config/system.mjs" import FTLNomadRoll from "../documents/roll.mjs" -export default class CthulhuEternalVehicle extends foundry.abstract.TypeDataModel { +export default class FTLNomadVehicle extends foundry.abstract.TypeDataModel { static defineSchema() { const fields = foundry.data.fields const requiredInteger = { required: true, nullable: false, integer: true } const schema = {} - let setting = game.settings.get("fvtt-cthulhu-eternal", "settings-era") || "modern" - schema.settings = new fields.StringField({ required: true, initial: setting, choices: SYSTEM.AVAILABLE_SETTINGS }) - schema.hp = new fields.SchemaField({ value: new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 }), max: new fields.NumberField({ ...requiredInteger, initial: 1, min: 0 }) diff --git a/module/models/weapon.mjs b/module/models/weapon.mjs index c5b611e..8b65181 100644 --- a/module/models/weapon.mjs +++ b/module/models/weapon.mjs @@ -8,9 +8,11 @@ export default class FTLNomadWeapon extends foundry.abstract.TypeDataModel { schema.description = new fields.HTMLField({ required: true, textSearch: true }) - schema.weaponType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_TYPE }) + schema.rangeType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_RANGE }) schema.damage = new fields.StringField({required: true, initial: "1d6"}) + schema.magazine = new fields.NumberField({ required: true, initial: 1, min: 0 }) + schema.range = new fields.SchemaField({ close: new fields.NumberField({ ...requiredInteger, initial: 0 }), near: new fields.NumberField({ ...requiredInteger, initial: 0 }), @@ -22,6 +24,7 @@ export default class FTLNomadWeapon extends foundry.abstract.TypeDataModel { schema.aspect = new fields.StringField({ required: true, initial: ""}) schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 }) + schema.ammoCost = new fields.NumberField({ required: true, initial: 0, min: 0 }) return schema } diff --git a/styles/character.less b/styles/character.less index 6069581..31a904c 100644 --- a/styles/character.less +++ b/styles/character.less @@ -1,6 +1,6 @@ -.protagonist-content { +.character-content { .sheet-common(); - .protagonist-sheet-common(); + .character-sheet-common(); overflow: scroll; } @@ -8,33 +8,33 @@ background-color: var(--color-light-1); } -.protagonist-main { +.character-main { background-color: var(--color-light-1); display: flex; - .protagonist-pc { + .character-pc { display: flex; gap: 4px; flex: 1; - .protagonist-left { + .character-left { min-width: 180px; display: flex; flex-direction: column; - .protagonist-left-image { + .character-left-image { display: flex; justify-content: center; align-items: center; padding-bottom: 8px; - .protagonist-img { + .character-img { height: 140px; width: auto; border: none; } } - .protagonist-hp { + .character-hp { gap: 2px; align-items: center; input { @@ -53,13 +53,13 @@ } } - .protagonist-dv, - .protagonist-dmax { + .character-dv, + .character-dmax { .form-fields { flex: none; } } - .protagonist-dmax-edit { + .character-dmax-edit { input { display: flex; width: 60px; @@ -72,12 +72,12 @@ } } - .protagonist-right { + .character-right { display: flex; flex-direction: column; gap: 5px; - .protagonist-name { + .character-name { display: flex; input { font-family: var(--font-title); @@ -172,22 +172,22 @@ } } - .protagonist-pc-play { + .character-pc-play { min-width: 500px; } - .protagonist-pc-edit { + .character-pc-edit { min-width: 650px; } - .protagonist-characteristics { + .character-characteristics { background-color: var(--color-light-1); display: flex; flex-direction: column; gap: 5px; flex: 1; - .protagonist-characteristic { + .character-characteristic { display: flex; align-items: center; .rollable:hover, @@ -218,16 +218,16 @@ } } - .protagonist-characteristic-play { + .character-characteristic-play { min-width: 225px; } - .protagonist-characteristic-edit { + .character-characteristic-edit { min-width: 400px; } } -.protagonist-biography { +.character-biography { background-color: var(--color-light-1); prose-mirror.inactive { min-height: 40px; @@ -275,7 +275,7 @@ } } -.tab.protagonist-skills { +.tab.character-skills { background-color: var(--color-light-1); display: grid; grid-template-columns: 1fr; @@ -323,7 +323,7 @@ } } -.tab.protagonist-status { +.tab.character-status { background-color: var(--color-light-1); display: grid; grid-template-columns: 1fr; @@ -455,7 +455,7 @@ } } -.tab.protagonist-equipment { +.tab.character-equipment { background-color: var(--color-light-1); display: grid; grid-template-columns: 1fr; diff --git a/styles/npc.less b/styles/creature.less similarity index 100% rename from styles/npc.less rename to styles/creature.less diff --git a/styles/fvtt-ftl-nomad.less b/styles/fvtt-ftl-nomad.less index 0b38495..dbf730e 100644 --- a/styles/fvtt-ftl-nomad.less +++ b/styles/fvtt-ftl-nomad.less @@ -1,17 +1,20 @@ @import "fonts.less"; @import "global.less"; -.fvtt-cthulhu-eternal { +.fvtt-ftl-nomad { @import "mixins.less"; @import "character.less"; @import "vehicle.less"; - @import "npc.less"; + @import "starship.less"; + @import "creature.less"; @import "weapon.less"; @import "armor.less"; @import "equipment.less"; @import "language.less"; @import "psionic.less"; @import "talent.less"; + @import "creature-trait.less"; + @import "creature-ability.less"; @import "chat.less"; } diff --git a/styles/implant.less b/styles/implant.less new file mode 100644 index 0000000..0a4d9e5 --- /dev/null +++ b/styles/implant.less @@ -0,0 +1,22 @@ +.implant-content { + .sheet-common(); + .item-sheet-common(); + + fieldset { + margin-top: 8px; + background-color: var(--color-light-1); + } + + .header { + background-color: var(--color-light-1); + display: flex; + img { + width: 50px; + height: 50px; + } + } + + label { + flex: 10%; + } +} diff --git a/styles/psionic.less b/styles/psionic.less index 8f8c4c0..887f5a2 100644 --- a/styles/psionic.less +++ b/styles/psionic.less @@ -1,4 +1,4 @@ -.ritual-content { +.psionic-content { .sheet-common(); .item-sheet-common(); diff --git a/styles/starship.less b/styles/starship.less new file mode 100644 index 0000000..23d0f82 --- /dev/null +++ b/styles/starship.less @@ -0,0 +1,223 @@ +.starship-content { + .sheet-common(); + .starship-sheet-common(); + overflow: scroll; +} + +.sheet-tabs { + background-color: var(--color-light-1); +} + +.starship-main { + background-color: var(--color-light-1); + display: flex; + + .starship-pc { + display: flex; + gap: 4px; + flex: 1; + + .starship-left { + min-width: 180px; + display: flex; + flex-direction: column; + + .starship-left-image { + display: flex; + justify-content: center; + align-items: center; + padding-bottom: 8px; + .starship-img { + height: 140px; + width: auto; + border: none; + } + } + + } + + .starship-right { + display: flex; + flex-direction: column; + gap: 5px; + + .starship-name { + display: flex; + input { + font-family: var(--font-title); + font-size: calc(var(--font-size-standard) * 1.4); + width: 400px; + } + } + + .starship-infos { + display: flex; + flex-direction: column; + gap: 4px; + + label { + min-width: 120px; + } + + .starship-hp { + display: flex; + gap: 2px; + align-items: center; + .starship-hp-value { + .form-fields input { + flex: none; + width: 50px; + margin-left: 4px; + font-size: calc(var(--font-size-standard) * 1.4); + } + } + .starship-hp-max { + clear: both; + display: flex; + flex-direction: row; + flex-wrap: wrap; + margin: 3px 0; + align-items: center; + input { + width: 50px; + text-align: center; + font-size: calc(var(--font-size-standard) * 1.4); + } + } + .hp-separator { + font-size: calc(var(--font-size-standard) * 1.2); + display: flex; + align-items: center; + justify-content: center; + } + } + } + } + } + + .starship-pc-play { + min-width: 500px; + } + + .starship-pc-edit { + min-width: 650px; + } +} + +.starship-biography { + background-color: var(--color-light-1); + prose-mirror.inactive { + min-height: 40px; + } + prose-mirror.active { + min-height: 150px; + } + .field-label { + margin-left: 8px; + } + + + .biodata { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 8px; + label { + min-width: 3.0rem; + } + .feature { + display: flex; + align-items: center; + gap: 4px; + min-width: 18rem; + max-width: 18rem; + } + } + +} + +.tab.starship-equipment { + background-color: var(--color-light-1); + display: grid; + grid-template-columns: 1fr; + legend { + a { + font-size: calc(var(--font-size-standard) * 1.4); + padding-left: 5px; + } + } + .weapons { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: 4px; + .weapon { + display: flex; + align-items: center; + gap: 4px; + min-width: 13rem; + max-width: 13srem; + .rollable:hover, + .rollable:focus { + text-shadow: 0 0 8px var(--color-shadow-primary); + cursor: pointer; + } + .controls { + min-width: 2rem; + max-width: 2rem; + } + .damage { + min-width: 5rem; + max-width: 5rem; + } + .name { + min-width: 8rem; + max-width: 8rem; + } + .item-img { + width: 32px; + height: 32px; + margin: 4px 0 0 0; + } + } + } + .gears { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 4px; + .gear { + display: flex; + align-items: center; + gap: 4px; + min-width: 13rem; + max-width: 13srem; + .rollable:hover, + .rollable:focus { + text-shadow: 0 0 8px var(--color-shadow-primary); + cursor: pointer; + } + .controls { + min-width: 2rem; + max-width: 2rem; + } + .damage { + min-width: 5rem; + max-width: 5rem; + } + .name { + min-width: 8rem; + max-width: 8rem; + } + .item-img { + width: 32px; + height: 32px; + margin: 4px 0 0 0; + } + } + } + + prose-mirror.inactive { + min-height: 40px; + } + prose-mirror.active { + min-height: 150px; + } +} diff --git a/styles/talent.less b/styles/talent.less index 30f860e..40689e7 100644 --- a/styles/talent.less +++ b/styles/talent.less @@ -1,4 +1,4 @@ -.tome-content { +.talent-content { .sheet-common(); .item-sheet-common(); diff --git a/system.json b/system.json index 5d97730..f60be14 100644 --- a/system.json +++ b/system.json @@ -35,15 +35,20 @@ "documentTypes": { "Actor": { "character": { "htmlFields": ["description", "notes"] }, - "npc": { "htmlFields": ["description", "notes"] }, + "creature": { "htmlFields": ["description", "notes"] }, "vehicle": { "htmlFields": ["description", "notes"] }, - "ship": { "htmlFields": ["description", "notes"] } + "starship": { "htmlFields": ["description", "notes"] } }, "Item": { - "skill": { "htmlFields": ["description"] }, + "talent": { "htmlFields": ["description"] }, "weapon": { "htmlFields": ["description"] }, "armor": { "htmlFields": ["description"] }, - "gear": { "htmlFields": ["description"] } + "equipment": { "htmlFields": ["description"] }, + "psionic": { "htmlFields": ["description"] }, + "creature-trait": { "htmlFields": ["description"] }, + "creature-ability": { "htmlFields": ["description"] }, + "implant": { "htmlFields": ["description"] }, + "language": { "htmlFields": ["description"] } } }, "packs": [