Add starship, creature and vehicle
This commit is contained in:
@@ -3,17 +3,15 @@ import FTLNomadActorSheet from "./base-actor-sheet.mjs"
|
||||
export default class FTLNomadStarshipSheet extends FTLNomadActorSheet {
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["vehicle"],
|
||||
classes: ["starship"],
|
||||
position: {
|
||||
width: 680,
|
||||
height: 540,
|
||||
height: 640,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["vehicle-content"],
|
||||
contentClasses: ["starship-content"],
|
||||
},
|
||||
actions: {
|
||||
createGear: FTLNomadStarshipSheet.#onCreateGear,
|
||||
createWeapon: FTLNomadStarshipSheet.#onCreateWeapon,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -25,9 +23,6 @@ export default class FTLNomadStarshipSheet extends FTLNomadActorSheet {
|
||||
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",
|
||||
},
|
||||
@@ -35,7 +30,7 @@ export default class FTLNomadStarshipSheet extends FTLNomadActorSheet {
|
||||
|
||||
/** @override */
|
||||
tabGroups = {
|
||||
sheet: "equipment",
|
||||
sheet: "description",
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +39,6 @@ export default class FTLNomadStarshipSheet extends FTLNomadActorSheet {
|
||||
*/
|
||||
#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)) {
|
||||
@@ -61,6 +55,7 @@ export default class FTLNomadStarshipSheet extends FTLNomadActorSheet {
|
||||
|
||||
context.enrichedDescription = await TextEditor.enrichHTML(this.document.system.description, { async: true })
|
||||
context.enrichedNotes = await TextEditor.enrichHTML(this.document.system.notes, { async: true })
|
||||
context.enrichedModifications = await TextEditor.enrichHTML(this.document.system.modifications, { async: true })
|
||||
|
||||
return context
|
||||
}
|
||||
@@ -74,11 +69,6 @@ export default class FTLNomadStarshipSheet extends FTLNomadActorSheet {
|
||||
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 })
|
||||
@@ -88,17 +78,22 @@ export default class FTLNomadStarshipSheet extends FTLNomadActorSheet {
|
||||
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 _onRoll(event, target) {
|
||||
const rollType = $(event.currentTarget).data("roll-type")
|
||||
let item
|
||||
let formula
|
||||
let roll
|
||||
switch (rollType) {
|
||||
case "starship-guns":
|
||||
formula = this.actor.system.guns
|
||||
// Rolll the damage
|
||||
roll = new Roll(formula)
|
||||
await roll.evaluate()
|
||||
roll.toMessage( { flavor: `Starship ${this.actor.name} : Guns Damage` })
|
||||
break
|
||||
default:
|
||||
throw new Error(`Unknown roll type ${rollType}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user