Add missing items/actors

This commit is contained in:
2025-02-14 13:28:09 +01:00
parent b29cbfb8fa
commit 0b4ae7a097
30 changed files with 636 additions and 116 deletions

View File

@@ -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"

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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<string, Partial<ApplicationTab>>}
*/
#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)
}
}
}

View File

@@ -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",
},
}

View File

@@ -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",
},
}