From e3002dd602019c246ee8789133b6f5ddaf03849d Mon Sep 17 00:00:00 2001 From: LeRatierBretonnier Date: Sun, 19 Apr 2026 00:43:33 +0200 Subject: [PATCH] Migration FOundry v13/v14 --- mgt2.bundle.js | 5352 +++++++++-------- mgt2.bundle.js.map | 2 +- package.json | 8 + rollup.config.mjs | 8 + src/module/actors/actor.js | 6 +- src/module/actors/character.js | 16 +- src/module/applications/sheets/_module.mjs | 4 + .../applications/sheets/base-actor-sheet.mjs | 104 + .../applications/sheets/character-sheet.mjs | 848 +++ src/module/applications/sheets/item-sheet.mjs | 253 + .../applications/sheets/vehicule-sheet.mjs | 24 + src/module/core.js | 18 +- src/module/datamodels.js | 485 -- src/module/models/character.mjs | 96 + src/module/models/index.mjs | 16 + src/module/models/items/armor.mjs | 23 + src/module/models/items/base-item.mjs | 41 + src/module/models/items/career.mjs | 21 + src/module/models/items/computer.mjs | 18 + src/module/models/items/contact.mjs | 27 + src/module/models/items/container.mjs | 16 + src/module/models/items/disease.mjs | 13 + src/module/models/items/equipment.mjs | 14 + src/module/models/items/item.mjs | 15 + src/module/models/items/species.mjs | 22 + src/module/models/items/talent.mjs | 27 + src/module/models/items/weapon.mjs | 30 + src/module/models/vehicule.mjs | 33 + 28 files changed, 4584 insertions(+), 2956 deletions(-) create mode 100644 package.json create mode 100644 rollup.config.mjs create mode 100644 src/module/applications/sheets/_module.mjs create mode 100644 src/module/applications/sheets/base-actor-sheet.mjs create mode 100644 src/module/applications/sheets/character-sheet.mjs create mode 100644 src/module/applications/sheets/item-sheet.mjs create mode 100644 src/module/applications/sheets/vehicule-sheet.mjs delete mode 100644 src/module/datamodels.js create mode 100644 src/module/models/character.mjs create mode 100644 src/module/models/index.mjs create mode 100644 src/module/models/items/armor.mjs create mode 100644 src/module/models/items/base-item.mjs create mode 100644 src/module/models/items/career.mjs create mode 100644 src/module/models/items/computer.mjs create mode 100644 src/module/models/items/contact.mjs create mode 100644 src/module/models/items/container.mjs create mode 100644 src/module/models/items/disease.mjs create mode 100644 src/module/models/items/equipment.mjs create mode 100644 src/module/models/items/item.mjs create mode 100644 src/module/models/items/species.mjs create mode 100644 src/module/models/items/talent.mjs create mode 100644 src/module/models/items/weapon.mjs create mode 100644 src/module/models/vehicule.mjs diff --git a/mgt2.bundle.js b/mgt2.bundle.js index fcfd495..cb7db94 100644 --- a/mgt2.bundle.js +++ b/mgt2.bundle.js @@ -1,2694 +1,3129 @@ -const fields = foundry.data.fields; -class CharacterData extends foundry.abstract.TypeDataModel { - static defineSchema() { - return { - name: new fields.StringField({ required: false, blank: false, trim: true }), - life: new fields.SchemaField({ - value: new fields.NumberField({ required: false, initial: 0, integer: true }), - max: new fields.NumberField({ required: true, initial: 0, integer: true }) - }), - personal: new fields.SchemaField({ - title: new fields.StringField({ required: false, blank: true, trim: true }), - species: new fields.StringField({ required: false, blank: true, trim: true }), - speciesText: new fields.SchemaField({ - description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }), - descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true }) - }), - age: new fields.StringField({ required: false, blank: true, trim: true }), - gender: new fields.StringField({ required: false, blank: true, trim: true }), - pronouns: new fields.StringField({ required: false, blank: true, trim: true }), - homeworld: new fields.StringField({ required: false, blank: true, trim: true }), - ucp: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - traits: new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ) - }), - biography: new fields.HTMLField({ required: false, blank: true, trim: true }), - characteristics: new fields.SchemaField({ - strength: createCharacteristicField(true, true), - dexterity: createCharacteristicField(true, true), - endurance: createCharacteristicField(true, true), - intellect: createCharacteristicField(true, false), - education: createCharacteristicField(true, false), - social: createCharacteristicField(true, false), - morale: createCharacteristicField(true, false), - luck: createCharacteristicField(true, false), - sanity: createCharacteristicField(true, false), - charm: createCharacteristicField(true, false), - psionic: createCharacteristicField(true, false), - other: createCharacteristicField(true, false) - }), - health: new fields.SchemaField({ - radiations: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }) - }), - study: new fields.SchemaField({ - skill: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - total: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }), - completed: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }) - }), - finance: new fields.SchemaField({ - pension: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - credits: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - cashOnHand: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - debt: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - livingCost: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - monthlyShipPayments: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - notes: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }) - }), - containerView: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - containerDropIn: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - notes: new fields.HTMLField({ required: false, blank: true, trim: true }), - inventory: new fields.SchemaField({ - armor: new fields.NumberField({ required: true, initial: 0, integer: true }), - weight: new fields.NumberField({ required: true, initial: 0, min: 0, integer: false }), - encumbrance: new fields.SchemaField({ - normal: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - heavy: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }) - }) - }), - states: new fields.SchemaField({ - encumbrance: new fields.BooleanField({ required: false, initial: false }), - fatigue: new fields.BooleanField({ required: false, initial: false }), - unconscious: new fields.BooleanField({ required: false, initial: false }), - surgeryRequired: new fields.BooleanField({ required: false, initial: false }) - }), - config: new fields.SchemaField({ - psionic: new fields.BooleanField({ required: false, initial: true }), - initiative: new fields.StringField({ required: false, blank: true, initial: "dexterity" }), - damages: new fields.SchemaField({ - rank1: new fields.StringField({ required: false, blank: true, initial: "strength" }), - rank2: new fields.StringField({ required: false, blank: true, initial: "dexterity" }), - rank3: new fields.StringField({ required: false, blank: true, initial: "endurance" }) - }) - }) - }; - } -} -class VehiculeData extends foundry.abstract.TypeDataModel { - static defineSchema() { - return { - name: new fields.StringField({ required: false, blank: false, trim: true }), - skillId: new fields.StringField({ required: false, initial: "", blank: true, trim: true }), - speed: new fields.SchemaField({ - cruise: new fields.StringField({ required: false, initial: "Slow", blank: true }), - maximum: new fields.StringField({ required: false, initial: "Medium", blank: true }) - }), - agility: new fields.NumberField({ required: false, min: 0, integer: true }), - crew: new fields.NumberField({ required: false, min: 0, integer: true }), - passengers: new fields.NumberField({ required: false, min: 0, integer: true }), - cargo: new fields.NumberField({ required: false, min: 0, integer: false }), - //hull - life: new fields.SchemaField({ - value: new fields.NumberField({ required: true, initial: 0, integer: true }), - max: new fields.NumberField({ required: true, initial: 0, integer: true }) - }), - shipping: new fields.NumberField({ required: false, min: 0, integer: true }), - cost: new fields.NumberField({ required: false, min: 0, integer: true }), - armor: new fields.SchemaField({ - front: new fields.NumberField({ required: true, initial: 0, integer: true }), - rear: new fields.NumberField({ required: true, initial: 0, integer: true }), - sides: new fields.NumberField({ required: true, initial: 0, integer: true }) - }), - skills: new fields.SchemaField({ - // Skill Level - autopilot: new fields.NumberField({ required: true, initial: 0, integer: true }) - // Communication Range - // Navigation - // Sensors - // Camouflage / Recon - // Stealth - }) - // config: new fields.SchemaField({ - // }) - }; - } -} -class ItemBaseData extends foundry.abstract.TypeDataModel { - static defineSchema() { - const fields2 = foundry.data.fields; - const schema = { - //name: new fields.StringField({ required: true, blank: true, trim: true, nullable: true }), - description: new fields2.StringField({ required: false, blank: true, trim: true, nullable: true }), - //type: new fields.StringField({ required: false, blank: false }), - subType: new fields2.StringField({ required: false, blank: false, nullable: true }) - }; - return schema; - } -} -class PhysicalItemData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - schema.quantity = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true }); - schema.weight = new fields.NumberField({ required: true, initial: 0, min: 0, integer: false }); - schema.weightless = new fields.BooleanField({ required: false, initial: false }); - schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); - schema.tl = new fields.StringField({ required: true, blank: false, initial: "TL12" }); - schema.container = new fields.SchemaField({ - //inContainer: new fields.BooleanField({ required: false, initial: false }), - id: new fields.StringField({ required: false, blank: true }) - }); - schema.roll = new fields.SchemaField({ - characteristic: new fields.StringField({ required: false, blank: true, trim: true }), - skill: new fields.StringField({ required: false, blank: true, trim: true }), - difficulty: new fields.StringField({ required: false, blank: true, trim: true }) - }); - schema.trash = new fields.BooleanField({ required: false, initial: false }); - return schema; - } -} -class ItemData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - schema.subType.initial = "loot"; - schema.software = new fields.SchemaField({ - bandwidth: new fields.NumberField({ required: false, initial: 0, min: 0, max: 10, integer: true }), - effect: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - computerId: new fields.StringField({ required: false, blank: true, initial: "" }) - }); - return schema; - } -} -class EquipmentData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - schema.equipped = new fields.BooleanField({ required: false, initial: false }); - schema.augment = new fields.SchemaField({ - improvement: new fields.StringField({ required: false, blank: true, trim: true }) - }); - schema.subType.initial = "equipment"; - return schema; - } -} -class DiseaseData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - schema.subType.initial = "disease"; - schema.difficulty = new fields.StringField({ required: true, initial: "Average" }); - schema.damage = new fields.StringField({ required: false, blank: true }); - schema.interval = new fields.StringField({ required: false, blank: true }); - return schema; - } -} -class CareerData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - schema.difficulty = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); - schema.damage = new fields.StringField({ required: false, blank: true }); - schema.interval = new fields.StringField({ required: false, blank: true }); - schema.assignment = new fields.StringField({ required: false, blank: true }); - schema.terms = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.rank = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.events = new fields.ArrayField( - new fields.SchemaField({ - age: new fields.NumberField({ required: false, integer: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - return schema; - } -} -class TalentData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - schema.subType.initial = "skill"; - schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); - schema.level = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); - schema.skill = new fields.SchemaField({ - speciality: new fields.StringField({ required: false, blank: true, trim: true }), - reduceEncumbrance: new fields.BooleanField({ required: false, initial: false }) - }); - schema.psionic = new fields.SchemaField({ - reach: new fields.StringField({ required: false, blank: true, trim: true }), - cost: new fields.NumberField({ required: false, initial: 1, min: 0, integer: true }), - duration: new fields.StringField({ required: false, blank: true, trim: true }), - durationUnit: new fields.StringField({ required: false }) - }); - schema.roll = new fields.SchemaField({ - characteristic: new fields.StringField({ required: false, blank: true, trim: true }), - skill: new fields.StringField({ required: false, blank: true, trim: true }), - difficulty: new fields.StringField({ required: false, blank: true, trim: true }) - }); - return schema; - } -} -class ContactData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - schema.subType.initial = "skill"; - schema.cost = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true }); - schema.skill = new fields.SchemaField({ - speciality: new fields.StringField({ required: false, blank: true, trim: true }), - characteristic: new fields.StringField({ required: false, blank: true, trim: true }) - }); - schema.status = new fields.StringField({ required: false, blank: true, trim: true, initial: "Alive" }); - schema.attitude = new fields.StringField({ required: false, blank: true, trim: true, initial: "Unknow" }); - schema.relation = new fields.StringField({ required: false, blank: true, trim: true, initial: "Contact" }); - schema.title = new fields.StringField({ required: false, blank: true, trim: true }); - schema.nickname = new fields.StringField({ required: false, blank: true, trim: true }); - schema.species = new fields.StringField({ required: false, blank: true, trim: true }); - schema.gender = new fields.StringField({ required: false, blank: true, trim: true }); - schema.pronouns = new fields.StringField({ required: false, blank: true, trim: true }); - schema.homeworld = new fields.StringField({ required: false, blank: true, trim: true }); - schema.location = new fields.StringField({ required: false, blank: true, trim: true }); - schema.occupation = new fields.StringField({ required: false, blank: true, trim: true }); - schema.notes = new fields.HTMLField({ required: false, blank: true, trim: true }); - return schema; - } -} -class WeaponData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - schema.equipped = new fields.BooleanField({ required: false, initial: false }); - schema.range = new fields.SchemaField({ - isMelee: new fields.BooleanField({ required: false, initial: false }), - value: new fields.NumberField({ required: false, integer: true, nullable: true }), - unit: new fields.StringField({ required: false, blank: true, nullable: true }) - }), //schema.tons = new fields.NumberField({ required: false, initial: 0, min: 0, integer: false }); - schema.damage = new fields.StringField({ required: false, blank: true, trim: true }); - schema.magazine = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.magazineCost = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.traits = new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - schema.options = new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - return schema; - } -} -class ArmorData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - schema.equipped = new fields.BooleanField({ required: false, initial: false }); - schema.radiations = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.protection = new fields.StringField({ required: false, blank: false, trim: true }); - schema.requireSkill = new fields.StringField({ required: false, blank: false }); - schema.requireSkillLevel = new fields.NumberField({ required: false, min: 0, integer: true }); - schema.powered = new fields.BooleanField({ required: false, initial: false }); - schema.options = new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - return schema; - } -} -class ComputerData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - schema.processing = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.processingUsed = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.overload = new fields.BooleanField({ required: false, initial: false }); - schema.options = new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - return schema; - } -} -class SpeciesData extends foundry.abstract.TypeDataModel { - static defineSchema() { - const fields2 = foundry.data.fields; - const schema = { - description: new fields2.StringField({ required: false, blank: true, trim: true, nullable: true }), - descriptionLong: new fields2.HTMLField({ required: false, blank: true, trim: true }), - traits: new fields2.ArrayField( - new fields2.SchemaField({ - name: new fields2.StringField({ required: true, blank: true, trim: true }), - description: new fields2.StringField({ required: false, blank: true, trim: true }) - }) - ), - modifiers: new fields2.ArrayField( - new fields2.SchemaField({ - characteristic: new fields2.StringField({ required: false, blank: true, trim: true }), - value: new fields2.NumberField({ required: false, integer: true, nullable: true }) - }) - ) - }; - return schema; - } -} -class ItemContainerData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - schema.onHand = new fields.BooleanField({ required: false, initial: false }); - schema.location = new fields.StringField({ required: false, blank: true, trim: true }); - schema.count = new fields.NumberField({ required: false, initial: 0, integer: true }); - schema.weight = new fields.NumberField({ required: false, initial: 0, integer: false }); - schema.weightless = new fields.BooleanField({ required: false, initial: false }); - schema.locked = new fields.BooleanField({ required: false, initial: false }); - schema.lockedDescription = new fields.StringField({ required: false, blank: true, trim: true, nullable: true }); - return schema; - } -} +const fields$d = foundry.data.fields; + function createCharacteristicField(show = true, showMax = false) { - return new fields.SchemaField({ - value: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - max: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }), - dm: new fields.NumberField({ required: false, initial: 0, integer: true }), - show: new fields.BooleanField({ required: false, initial: show }), - showMax: new fields.BooleanField({ required: false, initial: showMax }) - }); + return new fields$d.SchemaField({ + value: new fields$d.NumberField({ required: true, initial: 0, min: 0, integer: true }), + max: new fields$d.NumberField({ required: false, initial: 0, min: 0, integer: true }), + dm: new fields$d.NumberField({ required: false, initial: 0, integer: true }), + show: new fields$d.BooleanField({ required: false, initial: show }), + showMax: new fields$d.BooleanField({ required: false, initial: showMax }) + }); +} + +class ItemBaseData extends foundry.abstract.TypeDataModel { + static defineSchema() { + return { + description: new fields$d.StringField({ required: false, blank: true, trim: true, nullable: true }), + subType: new fields$d.StringField({ required: false, blank: false, nullable: true }) + }; + } +} + +class PhysicalItemData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.quantity = new fields$d.NumberField({ required: true, initial: 1, min: 0, integer: true }); + schema.weight = new fields$d.NumberField({ required: true, initial: 0, min: 0, integer: false }); + schema.weightless = new fields$d.BooleanField({ required: false, initial: false }); + schema.cost = new fields$d.NumberField({ required: true, initial: 0, min: 0, integer: true }); + schema.tl = new fields$d.StringField({ required: true, blank: false, initial: "TL12" }); + schema.container = new fields$d.SchemaField({ + id: new fields$d.StringField({ required: false, blank: true }) + }); + schema.roll = new fields$d.SchemaField({ + characteristic: new fields$d.StringField({ required: false, blank: true, trim: true }), + skill: new fields$d.StringField({ required: false, blank: true, trim: true }), + difficulty: new fields$d.StringField({ required: false, blank: true, trim: true }) + }); + schema.trash = new fields$d.BooleanField({ required: false, initial: false }); + return schema; + } +} + +const fields$c = foundry.data.fields; + +class CharacterData extends foundry.abstract.TypeDataModel { + + static defineSchema() { + return { + name: new fields$c.StringField({ required: false, blank: false, trim: true }), + life: new fields$c.SchemaField({ + value: new fields$c.NumberField({ required: false, initial: 0, integer: true }), + max: new fields$c.NumberField({ required: true, initial: 0, integer: true }) + }), + personal: new fields$c.SchemaField({ + title: new fields$c.StringField({ required: false, blank: true, trim: true }), + species: new fields$c.StringField({ required: false, blank: true, trim: true }), + speciesText: new fields$c.SchemaField({ + description: new fields$c.StringField({ required: false, blank: true, trim: true, nullable: true }), + descriptionLong: new fields$c.HTMLField({ required: false, blank: true, trim: true }) + }), + age: new fields$c.StringField({ required: false, blank: true, trim: true }), + gender: new fields$c.StringField({ required: false, blank: true, trim: true }), + pronouns: new fields$c.StringField({ required: false, blank: true, trim: true }), + homeworld: new fields$c.StringField({ required: false, blank: true, trim: true }), + ucp: new fields$c.StringField({ required: false, blank: true, trim: true, initial: "" }), + traits: new fields$c.ArrayField( + new fields$c.SchemaField({ + name: new fields$c.StringField({ required: true, blank: true, trim: true }), + description: new fields$c.StringField({ required: false, blank: true, trim: true }) + }) + ) + }), + biography: new fields$c.HTMLField({ required: false, blank: true, trim: true }), + + characteristics: new fields$c.SchemaField({ + strength: createCharacteristicField(true, true), + dexterity: createCharacteristicField(true, true), + endurance: createCharacteristicField(true, true), + intellect: createCharacteristicField(true, false), + education: createCharacteristicField(true, false), + social: createCharacteristicField(true, false), + morale: createCharacteristicField(true, false), + luck: createCharacteristicField(true, false), + sanity: createCharacteristicField(true, false), + charm: createCharacteristicField(true, false), + psionic: createCharacteristicField(true, false), + other: createCharacteristicField(true, false) + }), + + health: new fields$c.SchemaField({ + radiations: new fields$c.NumberField({ required: false, initial: 0, min: 0, integer: true }) + }), + study: new fields$c.SchemaField({ + skill: new fields$c.StringField({ required: false, blank: true, trim: true, initial: "" }), + total: new fields$c.NumberField({ required: false, initial: 0, min: 0, integer: true }), + completed: new fields$c.NumberField({ required: false, initial: 0, min: 0, integer: true }) + }), + finance: new fields$c.SchemaField({ + pension: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: true }), + credits: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: true }), + cashOnHand: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: true }), + debt: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: true }), + livingCost: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: true }), + monthlyShipPayments: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: true }), + notes: new fields$c.StringField({ required: false, blank: true, trim: true, initial: "" }) + }), + containerView: new fields$c.StringField({ required: false, blank: true, trim: true, initial: "" }), + containerDropIn: new fields$c.StringField({ required: false, blank: true, trim: true, initial: "" }), + notes: new fields$c.HTMLField({ required: false, blank: true, trim: true }), + + inventory: new fields$c.SchemaField({ + armor: new fields$c.NumberField({ required: true, initial: 0, integer: true }), + weight: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: false }), + encumbrance: new fields$c.SchemaField({ + normal: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: true }), + heavy: new fields$c.NumberField({ required: true, initial: 0, min: 0, integer: true }) + }) + }), + states: new fields$c.SchemaField({ + encumbrance: new fields$c.BooleanField({ required: false, initial: false }), + fatigue: new fields$c.BooleanField({ required: false, initial: false }), + unconscious: new fields$c.BooleanField({ required: false, initial: false }), + surgeryRequired: new fields$c.BooleanField({ required: false, initial: false }) + }), + + config: new fields$c.SchemaField({ + psionic: new fields$c.BooleanField({ required: false, initial: true }), + initiative: new fields$c.StringField({ required: false, blank: true, initial: "dexterity" }), + damages: new fields$c.SchemaField({ + rank1: new fields$c.StringField({ required: false, blank: true, initial: "strength" }), + rank2: new fields$c.StringField({ required: false, blank: true, initial: "dexterity" }), + rank3: new fields$c.StringField({ required: false, blank: true, initial: "endurance" }) + }) + }) + }; + } +} + +const fields$b = foundry.data.fields; + +class VehiculeData extends foundry.abstract.TypeDataModel { + + static defineSchema() { + return { + name: new fields$b.StringField({ required: false, blank: false, trim: true }), + skillId: new fields$b.StringField({ required: false, initial: "", blank: true, trim: true }), + speed: new fields$b.SchemaField({ + cruise: new fields$b.StringField({ required: false, initial: "Slow", blank: true }), + maximum: new fields$b.StringField({ required: false, initial: "Medium", blank: true }) + }), + agility: new fields$b.NumberField({ required: false, min: 0, integer: true }), + crew: new fields$b.NumberField({ required: false, min: 0, integer: true }), + passengers: new fields$b.NumberField({ required: false, min: 0, integer: true }), + cargo: new fields$b.NumberField({ required: false, min: 0, integer: false }), + life: new fields$b.SchemaField({ + value: new fields$b.NumberField({ required: true, initial: 0, integer: true }), + max: new fields$b.NumberField({ required: true, initial: 0, integer: true }) + }), + shipping: new fields$b.NumberField({ required: false, min: 0, integer: true }), + cost: new fields$b.NumberField({ required: false, min: 0, integer: true }), + armor: new fields$b.SchemaField({ + front: new fields$b.NumberField({ required: true, initial: 0, integer: true }), + rear: new fields$b.NumberField({ required: true, initial: 0, integer: true }), + sides: new fields$b.NumberField({ required: true, initial: 0, integer: true }) + }), + skills: new fields$b.SchemaField({ + autopilot: new fields$b.NumberField({ required: true, initial: 0, integer: true }) + }) + }; + } +} + +const fields$a = foundry.data.fields; + +class ItemData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.subType.initial = "loot"; + schema.software = new fields$a.SchemaField({ + bandwidth: new fields$a.NumberField({ required: false, initial: 0, min: 0, max: 10, integer: true }), + effect: new fields$a.StringField({ required: false, blank: true, trim: true, initial: "" }), + computerId: new fields$a.StringField({ required: false, blank: true, initial: "" }) + }); + return schema; + } +} + +const fields$9 = foundry.data.fields; + +class EquipmentData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.equipped = new fields$9.BooleanField({ required: false, initial: false }); + schema.augment = new fields$9.SchemaField({ + improvement: new fields$9.StringField({ required: false, blank: true, trim: true }) + }); + schema.subType.initial = "equipment"; // augment, clothing, trinket, toolkit, equipment + return schema; + } +} + +const fields$8 = foundry.data.fields; + +class DiseaseData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.subType.initial = "disease"; // disease, poison + schema.difficulty = new fields$8.StringField({ required: true, initial: "Average" }); + schema.damage = new fields$8.StringField({ required: false, blank: true }); + schema.interval = new fields$8.StringField({ required: false, blank: true }); + return schema; + } +} + +const fields$7 = foundry.data.fields; + +class CareerData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.difficulty = new fields$7.NumberField({ required: true, initial: 0, min: 0, integer: true }); + schema.damage = new fields$7.StringField({ required: false, blank: true }); + schema.interval = new fields$7.StringField({ required: false, blank: true }); + schema.assignment = new fields$7.StringField({ required: false, blank: true }); + schema.terms = new fields$7.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.rank = new fields$7.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.events = new fields$7.ArrayField( + new fields$7.SchemaField({ + age: new fields$7.NumberField({ required: false, integer: true }), + description: new fields$7.StringField({ required: false, blank: true, trim: true }) + }) + ); + return schema; + } +} + +const fields$6 = foundry.data.fields; + +class TalentData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.subType.initial = "skill"; + schema.cost = new fields$6.NumberField({ required: true, initial: 0, min: 0, integer: true }); + schema.level = new fields$6.NumberField({ required: true, initial: 0, min: 0, integer: true }); + schema.skill = new fields$6.SchemaField({ + speciality: new fields$6.StringField({ required: false, blank: true, trim: true }), + reduceEncumbrance: new fields$6.BooleanField({ required: false, initial: false }) + }); + schema.psionic = new fields$6.SchemaField({ + reach: new fields$6.StringField({ required: false, blank: true, trim: true }), + cost: new fields$6.NumberField({ required: false, initial: 1, min: 0, integer: true }), + duration: new fields$6.StringField({ required: false, blank: true, trim: true }), + durationUnit: new fields$6.StringField({ required: false }) + }); + schema.roll = new fields$6.SchemaField({ + characteristic: new fields$6.StringField({ required: false, blank: true, trim: true }), + skill: new fields$6.StringField({ required: false, blank: true, trim: true }), + difficulty: new fields$6.StringField({ required: false, blank: true, trim: true }) + }); + return schema; + } +} + +const fields$5 = foundry.data.fields; + +class ContactData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.subType.initial = "skill"; + schema.cost = new fields$5.NumberField({ required: true, initial: 1, min: 0, integer: true }); + schema.skill = new fields$5.SchemaField({ + speciality: new fields$5.StringField({ required: false, blank: true, trim: true }), + characteristic: new fields$5.StringField({ required: false, blank: true, trim: true }) + }); + schema.status = new fields$5.StringField({ required: false, blank: true, trim: true, initial: "Alive" }); + schema.attitude = new fields$5.StringField({ required: false, blank: true, trim: true, initial: "Unknow" }); + schema.relation = new fields$5.StringField({ required: false, blank: true, trim: true, initial: "Contact" }); + schema.title = new fields$5.StringField({ required: false, blank: true, trim: true }); + schema.nickname = new fields$5.StringField({ required: false, blank: true, trim: true }); + schema.species = new fields$5.StringField({ required: false, blank: true, trim: true }); + schema.gender = new fields$5.StringField({ required: false, blank: true, trim: true }); + schema.pronouns = new fields$5.StringField({ required: false, blank: true, trim: true }); + schema.homeworld = new fields$5.StringField({ required: false, blank: true, trim: true }); + schema.location = new fields$5.StringField({ required: false, blank: true, trim: true }); + schema.occupation = new fields$5.StringField({ required: false, blank: true, trim: true }); + schema.notes = new fields$5.HTMLField({ required: false, blank: true, trim: true }); + return schema; + } +} + +const fields$4 = foundry.data.fields; + +class WeaponData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.equipped = new fields$4.BooleanField({ required: false, initial: false }); + schema.range = new fields$4.SchemaField({ + isMelee: new fields$4.BooleanField({ required: false, initial: false }), + value: new fields$4.NumberField({ required: false, integer: true, nullable: true }), + unit: new fields$4.StringField({ required: false, blank: true, nullable: true }) + }); + schema.damage = new fields$4.StringField({ required: false, blank: true, trim: true }); + schema.magazine = new fields$4.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.magazineCost = new fields$4.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.traits = new fields$4.ArrayField( + new fields$4.SchemaField({ + name: new fields$4.StringField({ required: true, blank: true, trim: true }), + description: new fields$4.StringField({ required: false, blank: true, trim: true }) + }) + ); + schema.options = new fields$4.ArrayField( + new fields$4.SchemaField({ + name: new fields$4.StringField({ required: true, blank: true, trim: true }), + description: new fields$4.StringField({ required: false, blank: true, trim: true }) + }) + ); + return schema; + } +} + +const fields$3 = foundry.data.fields; + +class ArmorData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.equipped = new fields$3.BooleanField({ required: false, initial: false }); + schema.radiations = new fields$3.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.protection = new fields$3.StringField({ required: false, blank: false, trim: true }); + // A Traveller suffers DM-1 to all checks per missing skill level in the required skill. + schema.requireSkill = new fields$3.StringField({ required: false, blank: false }); + schema.requireSkillLevel = new fields$3.NumberField({ required: false, min: 0, integer: true }); + // Powered armour supports its own weight and is effectively weightless for encumbrance. + schema.powered = new fields$3.BooleanField({ required: false, initial: false }); + schema.options = new fields$3.ArrayField( + new fields$3.SchemaField({ + name: new fields$3.StringField({ required: true, blank: true, trim: true }), + description: new fields$3.StringField({ required: false, blank: true, trim: true }) + }) + ); + return schema; + } +} + +const fields$2 = foundry.data.fields; + +class ComputerData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.processing = new fields$2.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.processingUsed = new fields$2.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.overload = new fields$2.BooleanField({ required: false, initial: false }); + schema.options = new fields$2.ArrayField( + new fields$2.SchemaField({ + name: new fields$2.StringField({ required: true, blank: true, trim: true }), + description: new fields$2.StringField({ required: false, blank: true, trim: true }) + }) + ); + return schema; + } +} + +const fields$1 = foundry.data.fields; + +class ItemContainerData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.onHand = new fields$1.BooleanField({ required: false, initial: false }); + schema.location = new fields$1.StringField({ required: false, blank: true, trim: true }); + schema.count = new fields$1.NumberField({ required: false, initial: 0, integer: true }); + schema.weight = new fields$1.NumberField({ required: false, initial: 0, integer: false }); + schema.weightless = new fields$1.BooleanField({ required: false, initial: false }); + schema.locked = new fields$1.BooleanField({ required: false, initial: false }); // GM only + schema.lockedDescription = new fields$1.StringField({ required: false, blank: true, trim: true, nullable: true }); + return schema; + } +} + +const fields = foundry.data.fields; + +class SpeciesData extends foundry.abstract.TypeDataModel { + static defineSchema() { + return { + description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }), + descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true }), + traits: new fields.ArrayField( + new fields.SchemaField({ + name: new fields.StringField({ required: true, blank: true, trim: true }), + description: new fields.StringField({ required: false, blank: true, trim: true }) + }) + ), + modifiers: new fields.ArrayField( + new fields.SchemaField({ + characteristic: new fields.StringField({ required: false, blank: true, trim: true }), + value: new fields.NumberField({ required: false, integer: true, nullable: true }) + }) + ) + }; + } } const MGT2 = {}; + MGT2.MetricRange = Object.freeze({ - meter: "MGT2.MetricRange.meter", - kilometer: "MGT2.MetricRange.kilometer" + meter: "MGT2.MetricRange.meter", + kilometer: "MGT2.MetricRange.kilometer" }); + MGT2.MetricWeight = Object.freeze({ - kilogram: "MGT2.MetricWeight.kilogram", - ton: "MGT2.MetricWeight.ton" + kilogram: "MGT2.MetricWeight.kilogram", + ton: "MGT2.MetricWeight.ton" }); + MGT2.Difficulty = Object.freeze({ - NA: "MGT2.Difficulty.NA", - Simple: "MGT2.Difficulty.Simple", - Easy: "MGT2.Difficulty.Easy", - Routine: "MGT2.Difficulty.Routine", - Average: "MGT2.Difficulty.Average", - Difficult: "MGT2.Difficulty.Difficult", - VeryDifficult: "MGT2.Difficulty.VeryDifficult", - Formidable: "MGT2.Difficulty.Formidable", - Impossible: "MGT2.Difficulty.Impossible" + NA: "MGT2.Difficulty.NA", + Simple: "MGT2.Difficulty.Simple", + Easy: "MGT2.Difficulty.Easy", + Routine: "MGT2.Difficulty.Routine", + Average: "MGT2.Difficulty.Average", + Difficult: "MGT2.Difficulty.Difficult", + VeryDifficult: "MGT2.Difficulty.VeryDifficult", + Formidable: "MGT2.Difficulty.Formidable", + Impossible: "MGT2.Difficulty.Impossible" }); + MGT2.ItemSubType = Object.freeze({ - loot: "MGT2.ItemSubType.loot", - software: "MGT2.ItemSubType.software" + loot: "MGT2.ItemSubType.loot", + software: "MGT2.ItemSubType.software" }); + MGT2.EquipmentSubType = Object.freeze({ - augment: "MGT2.EquipmentSubType.augment", - clothing: "MGT2.EquipmentSubType.clothing", - equipment: "MGT2.EquipmentSubType.equipment", - trinket: "MGT2.EquipmentSubType.trinket", - toolkit: "MGT2.EquipmentSubType.toolkit" + augment: "MGT2.EquipmentSubType.augment", + clothing: "MGT2.EquipmentSubType.clothing", + equipment: "MGT2.EquipmentSubType.equipment", + trinket: "MGT2.EquipmentSubType.trinket", + toolkit: "MGT2.EquipmentSubType.toolkit" }); + MGT2.TalentSubType = Object.freeze({ - skill: "MGT2.TalentSubType.skill", - psionic: "MGT2.TalentSubType.psionic" + skill: "MGT2.TalentSubType.skill", + psionic: "MGT2.TalentSubType.psionic" }); + MGT2.DiseaseSubType = Object.freeze({ - disease: "MGT2.DiseaseSubType.disease", - poison: "MGT2.DiseaseSubType.poison", - wound: "MGT2.DiseaseSubType.wound" + disease: "MGT2.DiseaseSubType.disease", + poison: "MGT2.DiseaseSubType.poison", + wound: "MGT2.DiseaseSubType.wound" }); + MGT2.PsionicReach = Object.freeze({ - NA: "MGT2.PsionicReach.NA", - Personal: "MGT2.PsionicReach.Personal", - Close: "MGT2.PsionicReach.Close", - Short: "MGT2.PsionicReach.Short", - Medium: "MGT2.PsionicReach.Medium", - Long: "MGT2.PsionicReach.Long", - VeryLong: "MGT2.PsionicReach.VeryLong", - Distant: "MGT2.PsionicReach.Distant", - VeryDistant: "MGT2.PsionicReach.VeryDistant", - Continental: "MGT2.PsionicReach.Continental", - Planetary: "MGT2.PsionicReach.Planetary" + NA: "MGT2.PsionicReach.NA", + Personal: "MGT2.PsionicReach.Personal", + Close: "MGT2.PsionicReach.Close", + Short: "MGT2.PsionicReach.Short", + Medium: "MGT2.PsionicReach.Medium", + Long: "MGT2.PsionicReach.Long", + VeryLong: "MGT2.PsionicReach.VeryLong", + Distant: "MGT2.PsionicReach.Distant", + VeryDistant: "MGT2.PsionicReach.VeryDistant", + Continental: "MGT2.PsionicReach.Continental", + Planetary: "MGT2.PsionicReach.Planetary" }); + MGT2.ContactRelations = Object.freeze({ - Allie: "MGT2.Contact.Relation.Allie", - Contact: "MGT2.Contact.Relation.Contact", - Rival: "MGT2.Contact.Relation.Rival", - Enemy: "MGT2.Contact.Relation.Enemy" + Allie: "MGT2.Contact.Relation.Allie", + Contact: "MGT2.Contact.Relation.Contact", + Rival: "MGT2.Contact.Relation.Rival", + Enemy: "MGT2.Contact.Relation.Enemy" }); + MGT2.ContactStatus = Object.freeze({ - Alive: "MGT2.Contact.Status.Alive", - Unknow: "MGT2.Contact.Status.Unknow", - Dead: "MGT2.Contact.Status.Dead" + Alive: "MGT2.Contact.Status.Alive", + Unknow: "MGT2.Contact.Status.Unknow", + Dead: "MGT2.Contact.Status.Dead" }); + MGT2.Attitudes = Object.freeze({ - Unknow: "MGT2.Contact.Attitude.Unknow", - Hostile: "MGT2.Contact.Attitude.Hostile", - Unfriendly: "MGT2.Contact.Attitude.Unfriendly", - Indifferent: "MGT2.Contact.Attitude.Indifferent", - Friendly: "MGT2.Contact.Attitude.Friendly", - Helpful: "MGT2.Contact.Attitude.Helpful", - Complicated: "MGT2.Contact.Attitude.Complicated" + Unknow: "MGT2.Contact.Attitude.Unknow", + Hostile: "MGT2.Contact.Attitude.Hostile", + Unfriendly: "MGT2.Contact.Attitude.Unfriendly", + Indifferent: "MGT2.Contact.Attitude.Indifferent", + Friendly: "MGT2.Contact.Attitude.Friendly", + Helpful: "MGT2.Contact.Attitude.Helpful", + Complicated: "MGT2.Contact.Attitude.Complicated" }); + MGT2.Characteristics = Object.freeze({ - strength: "MGT2.Characteristics.strength.name", - dexterity: "MGT2.Characteristics.dexterity.name", - endurance: "MGT2.Characteristics.endurance.name", - intellect: "MGT2.Characteristics.intellect.name", - education: "MGT2.Characteristics.education.name", - social: "MGT2.Characteristics.social.name", - morale: "MGT2.Characteristics.morale.name", - luck: "MGT2.Characteristics.luck.name", - sanity: "MGT2.Characteristics.sanity.name", - charm: "MGT2.Characteristics.charm.name", - psionic: "MGT2.Characteristics.psionic.name", - other: "MGT2.Characteristics.other.name" + strength: "MGT2.Characteristics.strength.name", + dexterity: "MGT2.Characteristics.dexterity.name", + endurance: "MGT2.Characteristics.endurance.name", + intellect: "MGT2.Characteristics.intellect.name", + education: "MGT2.Characteristics.education.name", + social: "MGT2.Characteristics.social.name", + morale: "MGT2.Characteristics.morale.name", + luck: "MGT2.Characteristics.luck.name", + sanity: "MGT2.Characteristics.sanity.name", + charm: "MGT2.Characteristics.charm.name", + psionic: "MGT2.Characteristics.psionic.name", + other: "MGT2.Characteristics.other.name" }); + MGT2.InitiativeCharacteristics = Object.freeze({ - dexterity: "MGT2.Characteristics.dexterity.name", - intellect: "MGT2.Characteristics.intellect.name" + dexterity: "MGT2.Characteristics.dexterity.name", + intellect: "MGT2.Characteristics.intellect.name" }); + MGT2.DamageCharacteristics = Object.freeze({ - strength: "MGT2.Characteristics.strength.name", - dexterity: "MGT2.Characteristics.dexterity.name", - endurance: "MGT2.Characteristics.endurance.name" + strength: "MGT2.Characteristics.strength.name", + dexterity: "MGT2.Characteristics.dexterity.name", + endurance: "MGT2.Characteristics.endurance.name" }); + MGT2.TL = Object.freeze({ - NA: "MGT2.TL.NA", - Unknow: "MGT2.TL.Unknow", - NotIdentified: "MGT2.TL.NotIdentified", - TL00: "MGT2.TL.L00", - TL01: "MGT2.TL.L01", - TL02: "MGT2.TL.L02", - TL03: "MGT2.TL.L03", - TL04: "MGT2.TL.L04", - TL05: "MGT2.TL.L05", - TL06: "MGT2.TL.L06", - TL07: "MGT2.TL.L07", - TL08: "MGT2.TL.L08", - TL09: "MGT2.TL.L09", - TL10: "MGT2.TL.L10", - TL11: "MGT2.TL.L11", - TL12: "MGT2.TL.L12", - TL13: "MGT2.TL.L13", - TL14: "MGT2.TL.L14", - TL15: "MGT2.TL.L15" + NA: "MGT2.TL.NA", + Unknow: "MGT2.TL.Unknow", + NotIdentified: "MGT2.TL.NotIdentified", + TL00: "MGT2.TL.L00", + TL01: "MGT2.TL.L01", + TL02: "MGT2.TL.L02", + TL03: "MGT2.TL.L03", + TL04: "MGT2.TL.L04", + TL05: "MGT2.TL.L05", + TL06: "MGT2.TL.L06", + TL07: "MGT2.TL.L07", + TL08: "MGT2.TL.L08", + TL09: "MGT2.TL.L09", + TL10: "MGT2.TL.L10", + TL11: "MGT2.TL.L11", + TL12: "MGT2.TL.L12", + TL13: "MGT2.TL.L13", + TL14: "MGT2.TL.L14", + TL15: "MGT2.TL.L15" }); + MGT2.Timeframes = Object.freeze({ - Normal: "MGT2.Timeframes.Normal", - Slower: "MGT2.Timeframes.Slower", - Faster: "MGT2.Timeframes.Faster" + Normal: "MGT2.Timeframes.Normal", + Slower: "MGT2.Timeframes.Slower", + Faster: "MGT2.Timeframes.Faster" }); + MGT2.SpeedBands = Object.freeze({ - Stoppped: "MGT2.SpeedBands.Stoppped", - Idle: "MGT2.SpeedBands.Idle", - VerySlow: "MGT2.SpeedBands.VerySlow", - Slow: "MGT2.SpeedBands.Slow", - Medium: "MGT2.SpeedBands.Medium", - High: "MGT2.SpeedBands.High.", - Fast: "MGT2.SpeedBands.Fast", - VeryFast: "MGT2.SpeedBands.VeryFast", - Subsonic: "MGT2.SpeedBands.Subsonic", - Hypersonic: "MGT2.SpeedBands.Hypersonic" + Stoppped: "MGT2.SpeedBands.Stoppped", + Idle: "MGT2.SpeedBands.Idle", + VerySlow: "MGT2.SpeedBands.VerySlow", + Slow: "MGT2.SpeedBands.Slow", + Medium: "MGT2.SpeedBands.Medium", + High: "MGT2.SpeedBands.High.", + Fast: "MGT2.SpeedBands.Fast", + VeryFast: "MGT2.SpeedBands.VeryFast", + Subsonic: "MGT2.SpeedBands.Subsonic", + Hypersonic: "MGT2.SpeedBands.Hypersonic" }); + MGT2.Durations = Object.freeze({ - Seconds: "MGT2.Durations.Seconds", - Minutes: "MGT2.Durations.Minutes", - Heures: "MGT2.Durations.Heures" + Seconds: "MGT2.Durations.Seconds", + Minutes: "MGT2.Durations.Minutes", + Heures: "MGT2.Durations.Heures" }); class ActorCharacter { - static preCreate($this, data, options, user) { - $this.updateSource({ prototypeToken: { actorLink: true } }); - } - static prepareData(actorData) { - actorData.initiative = this.getInitiative(actorData); - } - static getInitiative($this) { - let c = $this.system.config.initiative; - return $this.system.characteristics[c].dm; - } - static async onDeleteDescendantDocuments($this, parent, collection, documents, ids, options, userId) { - const toDeleteIds = []; - const itemToUpdates = []; - for (let d of documents) { - if (d.type === "container") { + static preCreate($this, data, options, user) { + $this.updateSource({ prototypeToken: { actorLink: true } }); // QoL + } + + static prepareData(actorData) { + actorData.initiative = this.getInitiative(actorData); + } + + static getInitiative($this) { + let c = $this.system.config.initiative; + return $this.system.characteristics[c].dm; + } + + static async onDeleteDescendantDocuments($this, parent, collection, documents, ids, options, userId) { + const toDeleteIds = []; + const itemToUpdates = []; + + for (let d of documents) { + if (d.type === "container") { + // Delete content + for (let item of $this.items) { + if (item.system.hasOwnProperty("container") && item.system.container.id === d._id) + toDeleteIds.push(item._id); + } + } else if (d.type === "computer") { + // Eject software + for (let item of $this.items) { + if (item.system.hasOwnProperty("software") && item.system.computerId === d._id) { + let clone = foundry.utils.deepClone(item); + clone.system.software.computerId = ""; + itemToUpdates.push(clone); + } + } + } + } + + if (toDeleteIds.length > 0) + await $this.deleteEmbeddedDocuments("Item", toDeleteIds); + + if (itemToUpdates.length > 0) + await $this.updateEmbeddedDocuments('Item', itemToUpdates); + + await this.recalculateWeight($this); + } + + static async onUpdateDescendantDocuments($this, parent, collection, documents, changes, options, userId) { + await this.calculEncumbranceAndWeight($this, parent, collection, documents, changes, options, userId); + await this.calculComputers($this, parent, collection, documents, changes, options, userId); + } + + static async calculComputers($this, parent, collection, documents, changes, options, userId) { + let change; + let i = 0; + + let recalculProcessing = false; + for (let d of documents) { + if (changes[i].hasOwnProperty("system")) { + change = changes[i]; + if (d.type === "item" && d.system.subType === "software") { + if (change.system.software.hasOwnProperty("bandwidth") || change.system.software.hasOwnProperty("computerId")) { + recalculProcessing = true; + break; + } + } + } + } + + if (recalculProcessing) { + let updatedComputers = []; + let computerChanges = {}; + let computers = []; + + for (let item of $this.items) { + if (item.system.trash === true) continue; + if (item.type === "computer") { + computers.push(item); + computerChanges[item._id] = { processingUsed: 0 }; + } + } + + for (let item of $this.items) { + if (item.type !== "item" && item.system.subType !== "software") continue; + + if (item.system.software.hasOwnProperty("computerId") && item.system.software.computerId !== "") { + computerChanges[item.system.software.computerId].processingUsed += item.system.software.bandwidth; + } + } + + for (let computer of computers) { + let newProcessingUsed = computerChanges[computer._id].processingUsed; + if (computer.system.processingUsed !== newProcessingUsed) { + const cloneComputer = foundry.utils.deepClone($this.getEmbeddedDocument("Item", computer._id)); + cloneComputer.system.processingUsed = newProcessingUsed; + cloneComputer.system.overload = cloneComputer.system.processingUsed > cloneComputer.system.processing; + updatedComputers.push(cloneComputer); + } + } + + if (updatedComputers.length > 0) { + await $this.updateEmbeddedDocuments('Item', updatedComputers); + } + } + } + + static async calculEncumbranceAndWeight($this, parent, collection, documents, changes, options, userId) { + let recalculEncumbrance = false; + let recalculWeight = false; + + let change; + let i = 0; + for (let d of documents) { + if (changes[i].hasOwnProperty("system")) { + change = changes[i]; + + if (d.type === "armor" || + d.type === "computer" || + d.type === "gear" || + d.type === "item" || + d.type === "weapon") { + if (change.system.hasOwnProperty("quantity") || + change.system.hasOwnProperty("weight") || + change.system.hasOwnProperty("weightless") || + change.system.hasOwnProperty("container") || + change.system.hasOwnProperty("equipped") || + d.type === "armor") { + recalculWeight = true; + } + } else if (d.type === "talent" && d.system.subType === "skill") { + if (change.system.level || (change.system?.hasOwnProperty("skill") && change.system?.skill.hasOwnProperty("reduceEncumbrance"))) { + recalculEncumbrance = true; + } + } else if (d.type === "container" && (change.system.hasOwnProperty("onHand") || change.system.hasOwnProperty("weightless"))) { + recalculWeight = true; + } + } + i++; + } + + if (recalculEncumbrance || recalculWeight) { + const cloneActor = foundry.utils.deepClone($this); + + await this.recalculateArmor($this, cloneActor); + + if (recalculEncumbrance) { + //console.log("recalculEncumbrance"); + const str = $this.system.characteristics.strength.value; + const end = $this.system.characteristics.endurance.value; + let sumSkill = 0; + $this.items.filter(x => x.type === "talent" && x.system.subType === "skill" && x.system.skill.reduceEncumbrance === true).forEach(x => sumSkill += x.system.level); + let normal = str + end + sumSkill; + let heavy = normal * 2; + + cloneActor.system.states.encumbrance = $this.system.inventory.weight > normal; + cloneActor.system.encumbrance.normal = normal; + cloneActor.system.encumbrance.heavy = heavy; + } + + if (recalculWeight) + await this.recalculateWeight($this, cloneActor); + } + } + + static async recalculateArmor($this, cloneActor) { + if (cloneActor === null || cloneActor === undefined) + cloneActor = foundry.utils.deepClone($this); + + let armor = 0; for (let item of $this.items) { - if (item.system.hasOwnProperty("container") && item.system.container.id === d._id) - toDeleteIds.push(item._id); + if (item.type === "armor") { + if (item.system.equipped === true && !isNaN(item.system.protection)) { + armor += (+item.system.protection || 0); + } + } } - } else if (d.type === "computer") { + + cloneActor.system.inventory.armor = armor; + } + + static async recalculateWeight($this, cloneActor) { + + if (cloneActor === null || cloneActor === undefined) + cloneActor = foundry.utils.deepClone($this); + + let updatedContainers = []; + let containerChanges = {}; + + //console.log("recalculWeight"); + let containers = []; + + // List all containers for (let item of $this.items) { - if (item.system.hasOwnProperty("software") && item.system.computerId === d._id) { - let clone = duplicate(item); - clone.system.software.computerId = ""; - itemToUpdates.push(clone); - } + if (item.system.trash === true) continue; + + if (item.type === "container") { + containers.push(item); + containerChanges[item._id] = { count: 0, weight: 0 }; + } } - } - } - if (toDeleteIds.length > 0) - await $this.deleteEmbeddedDocuments("Item", toDeleteIds); - if (itemToUpdates.length > 0) - await $this.updateEmbeddedDocuments("Item", itemToUpdates); - await this.recalculateWeight($this); - } - static async onUpdateDescendantDocuments($this, parent, collection, documents, changes, options, userId) { - await this.calculEncumbranceAndWeight($this, parent, collection, documents, changes, options, userId); - await this.calculComputers($this, parent, collection, documents, changes, options, userId); - } - static async calculComputers($this, parent, collection, documents, changes, options, userId) { - let change; - let i = 0; - let recalculProcessing = false; - for (let d of documents) { - if (changes[i].hasOwnProperty("system")) { - change = changes[i]; - if (d.type === "item" && d.system.subType === "software") { - if (change.system.software.hasOwnProperty("bandwidth") || change.system.software.hasOwnProperty("computerId")) { - recalculProcessing = true; - break; - } + + let onHandWeight = 0; + for (let item of $this.items) { + if (item.type === "container") continue; + if (item.system.hasOwnProperty("weightless") && item.system.weightless === true) continue; + + let itemWeight = 0; + if (item.system.hasOwnProperty("weight")) { + let itemQty = item.system.quantity; + if (!isNaN(itemQty) && itemQty > 0) { + itemWeight = item.system.weight; + if (itemWeight > 0) { + itemWeight *= itemQty; + } + } + + if (item.type === "armor") { + if (item.system.equipped === true) { + if (item.system.powered === true) + itemWeight = 0; + else + itemWeight *= 0.25; // mass of armor that is being worn by 75% OPTIONAL + } + } + + if (item.system.container && item.system.container.id && item.system.container.id !== "") { + // bad deleted container id + if (containerChanges.hasOwnProperty(item.system.container.id)) { + containerChanges[item.system.container.id].weight += Math.round(itemWeight * 10) / 10; + containerChanges[item.system.container.id].count += item.system.quantity; + } + } else { + onHandWeight += Math.round(itemWeight * 10) / 10; + } + } } - } - } - if (recalculProcessing) { - let updatedComputers = []; - let computerChanges = {}; - let computers = []; - for (let item of $this.items) { - if (item.system.trash === true) - continue; - if (item.type === "computer") { - computers.push(item); - computerChanges[item._id] = { processingUsed: 0 }; + + //cloneActor.system.inventory.weight = onHandWeight.toFixed(1); + + // Check containers new weight + for (let container of containers) { + let newWeight = containerChanges[container._id].weight; + let newCount = containerChanges[container._id].count; + if (container.system.weight !== newWeight || container.system.count !== newCount) { + //const cloneContainer = foundry.utils.deepClone(); + const cloneContainer = foundry.utils.deepClone($this.getEmbeddedDocument("Item", container._id)); + //foundry.utils.setProperty(cloneContainer, "system.weight", newWeight); + cloneContainer.system.weight = newWeight; + cloneContainer.system.count = newCount; + updatedContainers.push(cloneContainer); + + if (container.system.onHand === true && + (container.system.weight > 0 || container.system.weightless !== true)) { + onHandWeight += container.system.weight; + } + } } - } - for (let item of $this.items) { - if (item.type !== "item" && item.system.subType !== "software") - continue; - if (item.system.software.hasOwnProperty("computerId") && item.system.software.computerId !== "") { - computerChanges[item.system.software.computerId].processingUsed += item.system.software.bandwidth; + + cloneActor.system.inventory.weight = onHandWeight; + cloneActor.system.states.encumbrance = onHandWeight > $this.system.inventory.encumbrance.normal; + + + await $this.update(cloneActor); + + if (updatedContainers.length > 0) { + await $this.updateEmbeddedDocuments('Item', updatedContainers); } - } - for (let computer of computers) { - let newProcessingUsed = computerChanges[computer._id].processingUsed; - if (computer.system.processingUsed !== newProcessingUsed) { - const cloneComputer = duplicate($this.getEmbeddedDocument("Item", computer._id)); - cloneComputer.system.processingUsed = newProcessingUsed; - cloneComputer.system.overload = cloneComputer.system.processingUsed > cloneComputer.system.processing; - updatedComputers.push(cloneComputer); + } + + static async preUpdate($this, changed, options, user) { + // Calc encumbrance + + const newStr = foundry.utils.getProperty(changed, "system.characteristics.strength.value") ?? $this.system.characteristics.strength.value; + const newEnd = foundry.utils.getProperty(changed, "system.characteristics.endurance.value") ?? $this.system.characteristics.endurance.value; + if ((newStr !== $this.system.characteristics.strength.value) || (newEnd !== $this.system.characteristics.endurance.value)) { + let sumSkill = 0; + $this.items.filter(x => x.type === "talent" && x.system.subType === "skill" && x.system.skill.reduceEncumbrance === true).forEach(x => sumSkill += x.system.level); + let normal = newStr + newEnd + sumSkill; + let heavy = normal * 2; + foundry.utils.setProperty(changed, "system.inventory.encumbrance.normal", normal); + foundry.utils.setProperty(changed, "system.inventory.encumbrance.heavy", heavy); } - } - if (updatedComputers.length > 0) { - await $this.updateEmbeddedDocuments("Item", updatedComputers); - } + + //console.log(foundry.utils.getProperty(changed, "system.characteristics.strength.value")); + const characteristicModified = this.computeCharacteristics(changed); + const strengthValue = foundry.utils.getProperty(changed, "system.characteristics.strength.value") ?? $this.system.characteristics.strength.value; + const strengthMax = foundry.utils.getProperty(changed, "system.characteristics.strength.max") ?? $this.system.characteristics.strength.max; + const dexterityValue = foundry.utils.getProperty(changed, "system.characteristics.dexterity.value") ?? $this.system.characteristics.dexterity.value; + const dexterityMax = foundry.utils.getProperty(changed, "system.characteristics.dexterity.max") ?? $this.system.characteristics.dexterity.max; + const enduranceValue = foundry.utils.getProperty(changed, "system.characteristics.endurance.value") ?? $this.system.characteristics.endurance.value; + const enduranceMax = foundry.utils.getProperty(changed, "system.characteristics.endurance.max") ?? $this.system.characteristics.endurance.max; + const lifeValue = strengthValue + dexterityValue + enduranceValue; + const lifeMax = strengthMax + dexterityMax + enduranceMax; + + if ($this.system.life.value !== lifeValue) + foundry.utils.setProperty(changed, "system.life.value", lifeValue); + if ($this.system.life.max !== lifeMax) + foundry.utils.setProperty(changed, "system.life.max", lifeMax); + + if (characteristicModified && $this.system.personal.ucp === undefined || $this.system.personal.ucp === "") ; + //} + + // Apply changes in Actor size to Token width/height + // if ( "size" in (this.system.traits || {}) ) { + // const newSize = foundry.utils.getProperty(changed, "system.traits.size"); + // if ( newSize && (newSize !== this.system.traits?.size) ) { + // let size = CONFIG.DND5E.tokenSizes[newSize]; + // if ( !foundry.utils.hasProperty(changed, "prototypeToken.width") ) { + // changed.prototypeToken ||= {}; + // changed.prototypeToken.height = size; + // changed.prototypeToken.width = size; + // } + // } + // } } - } - static async calculEncumbranceAndWeight($this, parent, collection, documents, changes, options, userId) { - var _a, _b; - let recalculEncumbrance = false; - let recalculWeight = false; - let change; - let i = 0; - for (let d of documents) { - if (changes[i].hasOwnProperty("system")) { - change = changes[i]; - if (d.type === "armor" || d.type === "computer" || d.type === "gear" || d.type === "item" || d.type === "weapon") { - if (change.system.hasOwnProperty("quantity") || change.system.hasOwnProperty("weight") || change.system.hasOwnProperty("weightless") || change.system.hasOwnProperty("container") || change.system.hasOwnProperty("equipped") || d.type === "armor") { - recalculWeight = true; - } - } else if (d.type === "talent" && d.system.subType === "skill") { - if (change.system.level || ((_a = change.system) == null ? void 0 : _a.hasOwnProperty("skill")) && ((_b = change.system) == null ? void 0 : _b.skill.hasOwnProperty("reduceEncumbrance"))) { - recalculEncumbrance = true; - } - } else if (d.type === "container" && (change.system.hasOwnProperty("onHand") || change.system.hasOwnProperty("weightless"))) { - recalculWeight = true; + + // static applyHealing($this, amount) { + // if (isNaN(amount) || amount === 0) return; + + // const strength = $this.system.characteristics.strength; + // const dexterity = $this.system.characteristics.dexterity; + // const endurance = $this.system.characteristics.endurance; + + // const data = { + // strength: { value: strength.value }, + // dexterity: { value: dexterity.value }, + // endurance: { value: endurance.value } + // }; + + + + // $this.update({ system: { characteristics: data } }); + // } + + static applyDamage($this, amount) { + if (isNaN(amount) || amount === 0) return; + const rank1 = $this.system.config.damages.rank1; + const rank2 = $this.system.config.damages.rank2; + const rank3 = $this.system.config.damages.rank3; + + const data = {}; + data[rank1] = { value: $this.system.characteristics[rank1].value }; + data[rank2] = { value: $this.system.characteristics[rank2].value }; + data[rank3] = { value: $this.system.characteristics[rank3].value }; + + if (amount < 0) amount = Math.abs(amount); + + for (const [key, rank] of Object.entries(data)) { + if (rank.value > 0) { + if (rank.value >= amount) { + rank.value -= amount; + amount = 0; + } else { + amount -= rank.value; + rank.value = 0; + } + rank.dm = this.getModifier(rank.value); + if (amount <= 0) break; + } } - } - i++; + + $this.update({ system: { characteristics: data } }); } - if (recalculEncumbrance || recalculWeight) { - const cloneActorSystem = duplicate($this.system); - await this.recalculateArmor($this, cloneActorSystem); - if (!recalculEncumbrance && !recalculWeight) - await $this.update({ system: cloneActorSystem }); - if (recalculEncumbrance) { - const str = Number($this.system.characteristics.strength.value); - const end = Number($this.system.characteristics.endurance.value); - let sumSkill = 0; - $this.items.filter((x) => x.type === "talent" && x.system.subType === "skill" && x.system.skill.reduceEncumbrance === true).forEach((x) => sumSkill += Number(x.system.level)); - let normal = str + end + sumSkill; - let heavy = normal * 2; - cloneActorSystem.states.encumbrance = $this.system.inventory.weight > normal; - cloneActorSystem.encumbrance.normal = normal; - cloneActorSystem.encumbrance.heavy = heavy; - if (!recalculWeight) - await $this.update({ system: cloneActorSystem }); - } - if (recalculWeight) - await this.recalculateWeight($this, cloneActorSystem); - } - } - static async recalculateArmor($this, cloneActorSystem) { - if (cloneActorSystem === null || cloneActorSystem === void 0) - cloneActorSystem = foundry.utils.duplicate($this.system); - let armor = 0; - for (let item of $this.items) { - if (item.type === "armor") { - if (item.system.equipped === true && !isNaN(item.system.protection)) { - armor += +item.system.protection || 0; + + static getContainers($this) { + const containers = []; + for (let item of $this.items) { + if (item.type == "container") { + containers.push(item); + } } - } + + containers.sort(this.compareByName); + + return containers; } - cloneActorSystem.inventory.armor = armor; - } - static async recalculateWeight($this, cloneActorSystem) { - if (cloneActorSystem === null || cloneActorSystem === void 0) - cloneActorSystem = foundry.utils.duplicate($this.system); - let updatedContainers = []; - let containerChanges = {}; - let containers = []; - for (let item of $this.items) { - if (item.system.trash === true) - continue; - if (item.type === "container") { - containers.push(item); - containerChanges[item._id] = { count: 0, weight: 0 }; - } - } - let onHandWeight = 0; - for (let item of $this.items) { - if (item.type === "container") - continue; - if (item.system.hasOwnProperty("weightless") && item.system.weightless === true) - continue; - let itemWeight = 0; - if (item.system.hasOwnProperty("weight")) { - let itemQty = item.system.quantity; - if (!isNaN(itemQty) && itemQty > 0) { - itemWeight = item.system.weight; - if (itemWeight > 0) { - itemWeight *= itemQty; - } + + static getComputers($this) { + const containers = []; + for (let item of $this.items) { + if (item.type == "computer") { + containers.push(item); + } } - if (item.type === "armor") { - if (item.system.equipped === true) { - if (item.system.powered === true) - itemWeight = 0; - else - itemWeight *= 0.25; - } + + containers.sort(this.compareByName); + + return containers; + } + + static getSkills($this) { + const skills = []; + for (let item of $this.items) { + if (item.type === "talent" && item.system.subType === "skill") { + skills.push(item); + } } - if (item.system.container && item.system.container.id && item.system.container.id !== "") { - if (containerChanges.hasOwnProperty(item.system.container.id)) { - containerChanges[item.system.container.id].weight += Math.round(itemWeight * 10) / 10; - containerChanges[item.system.container.id].count += item.system.quantity; - } - } else { - onHandWeight += Math.round(itemWeight * 10) / 10; + + skills.sort(this.compareByName); + + return skills; + } + + static computeCharacteristics(changed) { + let modified = this.computeCharacteristic(changed, "strength"); + + if (this.computeCharacteristic(changed, "dexterity") && !modified) modified = true; + if (this.computeCharacteristic(changed, "endurance") && !modified) modified = true; + if (this.computeCharacteristic(changed, "intellect") && !modified) modified = true; + if (this.computeCharacteristic(changed, "education") && !modified) modified = true; + if (this.computeCharacteristic(changed, "social") && !modified) modified = true; + if (this.computeCharacteristic(changed, "morale") && !modified) modified = true; + if (this.computeCharacteristic(changed, "luck") && !modified) modified = true; + if (this.computeCharacteristic(changed, "sanity") && !modified) modified = true; + if (this.computeCharacteristic(changed, "charm") && !modified) modified = true; + if (this.computeCharacteristic(changed, "psionic") && !modified) modified = true; + if (this.computeCharacteristic(changed, "other") && !modified) modified = true; + + return modified; + } + + static computeCharacteristic(changed, name) { + //if (isNaN(c.value) || c.value <= 0) c.value = 0; + //c.dm = this._getModifier(c.value) + const path = `system.characteristics.${name}`; + const newValue = foundry.utils.getProperty(changed, path + ".value");// || this.system.characteristics[name].value; + if (newValue) { + const dm = this.getModifier(newValue); + foundry.utils.setProperty(changed, path + ".dm", dm); + return true; } - } + + return false; } - for (let container of containers) { - let newWeight = containerChanges[container._id].weight; - let newCount = containerChanges[container._id].count; - if (container.system.weight !== newWeight || container.system.count !== newCount) { - const cloneContainer = duplicate($this.getEmbeddedDocument("Item", container._id)); - cloneContainer.system.weight = newWeight; - cloneContainer.system.count = newCount; - updatedContainers.push(cloneContainer); - if (container.system.onHand === true && (container.system.weight > 0 || container.system.weightless !== true)) { - onHandWeight += container.system.weight; + + static getModifier(value) { + if (isNaN(value) || value <= 0) return -3; + if (value >= 1 && value <= 2) return -2; + if (value >= 3 && value <= 5) return -1; + if (value >= 6 && value <= 8) return 0; + if (value >= 9 && value <= 11) return 1; + if (value >= 12 && value <= 14) return 2; + + return 3; + } + + static compareByName(a, b) { + if (!a.hasOwnProperty("name") || !b.hasOwnProperty("name")) { + return 0; } - } + return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); } - cloneActorSystem.inventory.weight = onHandWeight; - cloneActorSystem.states.encumbrance = onHandWeight > $this.system.inventory.encumbrance.normal; - await $this.update({ system: cloneActorSystem }); - if (updatedContainers.length > 0) { - await $this.updateEmbeddedDocuments("Item", updatedContainers); - } - } - static async preUpdate($this, changed, options, user) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const newStr = Number((_a = foundry.utils.getProperty(changed, "system.characteristics.strength.value")) != null ? _a : $this.system.characteristics.strength.value); - const newEnd = Number((_b = foundry.utils.getProperty(changed, "system.characteristics.endurance.value")) != null ? _b : $this.system.characteristics.endurance.value); - if (newStr !== $this.system.characteristics.strength.value || newEnd !== $this.system.characteristics.endurance.value) { - let sumSkill = 0; - $this.items.filter((x) => x.type === "talent" && x.system.subType === "skill" && x.system.skill.reduceEncumbrance === true).forEach((x) => sumSkill += Number(x.system.level)); - let normal = newStr + newEnd + sumSkill; - let heavy = normal * 2; - foundry.utils.setProperty(changed, "system.inventory.encumbrance.normal", normal); - foundry.utils.setProperty(changed, "system.inventory.encumbrance.heavy", heavy); - } - const characteristicModified = this.computeCharacteristics(changed); - const strengthValue = Number((_c = foundry.utils.getProperty(changed, "system.characteristics.strength.value")) != null ? _c : $this.system.characteristics.strength.value); - const strengthMax = Number((_d = foundry.utils.getProperty(changed, "system.characteristics.strength.max")) != null ? _d : $this.system.characteristics.strength.max); - const dexterityValue = Number((_e = foundry.utils.getProperty(changed, "system.characteristics.dexterity.value")) != null ? _e : $this.system.characteristics.dexterity.value); - const dexterityMax = Number((_f = foundry.utils.getProperty(changed, "system.characteristics.dexterity.max")) != null ? _f : $this.system.characteristics.dexterity.max); - const enduranceValue = Number((_g = foundry.utils.getProperty(changed, "system.characteristics.endurance.value")) != null ? _g : $this.system.characteristics.endurance.value); - const enduranceMax = Number((_h = foundry.utils.getProperty(changed, "system.characteristics.endurance.max")) != null ? _h : $this.system.characteristics.endurance.max); - const lifeValue = strengthValue + dexterityValue + enduranceValue; - const lifeMax = strengthMax + dexterityMax + enduranceMax; - if ($this.system.life.value !== lifeValue) - foundry.utils.setProperty(changed, "system.life.value", lifeValue); - if ($this.system.life.max !== lifeMax) - foundry.utils.setProperty(changed, "system.life.max", lifeMax); - if (characteristicModified && $this.system.personal.ucp === void 0 || $this.system.personal.ucp === "") ; - } - // static applyHealing($this, amount) { - // if (isNaN(amount) || amount === 0) return; - // const strength = $this.system.characteristics.strength; - // const dexterity = $this.system.characteristics.dexterity; - // const endurance = $this.system.characteristics.endurance; - // const data = { - // strength: { value: strength.value }, - // dexterity: { value: dexterity.value }, - // endurance: { value: endurance.value } - // }; - // $this.update({ system: { characteristics: data } }); - // } - static applyDamage($this, amount) { - if (isNaN(amount) || amount === 0) - return; - const rank1 = $this.system.config.damages.rank1; - const rank2 = $this.system.config.damages.rank2; - const rank3 = $this.system.config.damages.rank3; - const data = {}; - data[rank1] = { value: $this.system.characteristics[rank1].value }; - data[rank2] = { value: $this.system.characteristics[rank2].value }; - data[rank3] = { value: $this.system.characteristics[rank3].value }; - if (amount < 0) - amount = Math.abs(amount); - for (const [key, rank] of Object.entries(data)) { - if (rank.value > 0) { - if (rank.value >= amount) { - rank.value -= amount; - amount = 0; - } else { - amount -= rank.value; - rank.value = 0; - } - rank.dm = this.getModifier(rank.value); - if (amount <= 0) - break; - } - } - $this.update({ system: { characteristics: data } }); - } - static getContainers($this) { - const containers = []; - for (let item of $this.items) { - if (item.type == "container") { - containers.push(item); - } - } - containers.sort(this.compareByName); - return containers; - } - static getComputers($this) { - const containers = []; - for (let item of $this.items) { - if (item.type == "computer") { - containers.push(item); - } - } - containers.sort(this.compareByName); - return containers; - } - static getSkills($this) { - const skills = []; - for (let item of $this.items) { - if (item.type === "talent" && item.system.subType === "skill") { - skills.push(item); - } - } - skills.sort(this.compareByName); - return skills; - } - static computeCharacteristics(changed) { - let modified = this.computeCharacteristic(changed, "strength"); - if (this.computeCharacteristic(changed, "dexterity") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "endurance") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "intellect") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "education") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "social") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "morale") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "luck") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "sanity") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "charm") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "psionic") && !modified) - modified = true; - if (this.computeCharacteristic(changed, "other") && !modified) - modified = true; - return modified; - } - static computeCharacteristic(changed, name) { - const path = `system.characteristics.${name}`; - const newValue = Number(foundry.utils.getProperty(changed, path + ".value")); - if (newValue && !isNaN(newValue)) { - const dm = this.getModifier(newValue); - foundry.utils.setProperty(changed, path + ".dm", dm); - return true; - } - return false; - } - static getModifier(value) { - if (isNaN(value) || value <= 0) - return -3; - if (value >= 1 && value <= 2) - return -2; - if (value >= 3 && value <= 5) - return -1; - if (value >= 6 && value <= 8) - return 0; - if (value >= 9 && value <= 11) - return 1; - if (value >= 12 && value <= 14) - return 2; - return 3; - } - static compareByName(a, b) { - if (!a.hasOwnProperty("name") || !b.hasOwnProperty("name")) { - return 0; - } - return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); - } } class MGT2Combatant extends Combatant { + } + class TravellerActor extends Actor { - // _onUpdate(data, options, userId) { - // super._onUpdate(data, options, userId); - // console.log("_onUpdate"); - // console.log(data); - // if (data.system?.characteristics) { - // // Calc encumbrance - // if (data.system.characteristics.strength || data.system.characteristics.endurance) { - // data.system.encumbrance.normal = 0; - // data.system.encumbrance.heavy = 0; - // } - // } - // // If benefits were changed - // //if (data.system?.benefits) { - // // this.updateBenefitsOnActor(); - // //} - // // this.actor.computeCharacteristics(formData); - // } - /* - initiative if(!token?.combatant) return ui.notifications.warn("You are missing a selected token or combatant."); const bonus = await Dialog.prompt({ title: "Roll Initiative", content: ``, callback: (html) => html[0].querySelector("input").value, rejectClose: false }); const roll = await new Roll(`1d12 + ${bonus}`).evaluate({async: true}); await roll.toMessage({ flavor: `${token.actor.name} rolls initiative!`, speaker: ChatMessage.getSpeaker({actor: token.actor}) }); await token.combatant.update({initiative: roll.total}); - */ + + prepareDerivedData() { if (this.type === "character") { this.system.initiative = ActorCharacter.getInitiative(this); } } + async _preCreate(data, options, user) { - if (await super._preCreate(data, options, user) === false) - return false; + if ( (await super._preCreate(data, options, user)) === false ) return false; + if (this.type === "character") { ActorCharacter.preCreate(this, data, options, user); } } + async _onDeleteDescendantDocuments(parent, collection, documents, ids, options, userId) { await super._onDeleteDescendantDocuments(parent, collection, documents, ids, options, userId); + if (this.type === "character") { await ActorCharacter.onDeleteDescendantDocuments(this, parent, collection, documents, ids, options, userId); } } + async _onUpdateDescendantDocuments(parent, collection, documents, changes, options, userId) { super._onUpdateDescendantDocuments(parent, collection, documents, changes, options, userId); + //console.log("_onUpdateDescendantDocuments"); + if (this.type === "character") { await ActorCharacter.onUpdateDescendantDocuments(this, parent, collection, documents, changes, options, userId); } } + async _preUpdate(changed, options, user) { - if (await super._preUpdate(changed, options, user) === false) - return false; + if ((await super._preUpdate(changed, options, user)) === false) return false; + if (this.type === "character") { await ActorCharacter.preUpdate(this, changed, options, user); } } + getInitiative($this) { if (this.type === "character") { return ActorCharacter.getInitiative(this); } } + applyDamage(amount) { if (this.type === "character") { ActorCharacter.applyDamage(this, amount); } } + getContainers() { if (this.type === "character") { return ActorCharacter.getContainers(this); } + return []; } + getComputers() { if (this.type === "character") { return ActorCharacter.getComputers(this); } + return []; } + getSkills() { if (this.type === "character") { return ActorCharacter.getSkills(this); } + return []; } + async recalculateWeight() { if (this.type === "character") { return ActorCharacter.recalculateWeight(this); } } - async recalculateArmor() { - if (this.type === "character") { - return ActorCharacter.recalculateArmor(this); - } - } + } class TravellerItem extends Item { + /** @inheritdoc */ prepareDerivedData() { super.prepareDerivedData(); + } + async _preUpdate(changed, options, user) { - var _a, _b, _c; - if (await super._preUpdate(changed, options, user) === false) - return false; + if ((await super._preUpdate(changed, options, user)) === false) return false; + if (this.type === "computer") { - const newProcessing = (_a = foundry.utils.getProperty(changed, "system.processing")) != null ? _a : this.system.processing; + // Overload + const newProcessing = foundry.utils.getProperty(changed, "system.processing") ?? this.system.processing; if (newProcessing !== this.system.processing) { let overload = this.system.processingUsed > newProcessing; foundry.utils.setProperty(changed, "system.overload", overload); } } - if (this.type === "computer" || this.type === "container" || this.type === "item" && this.system.subType === "software") { - const newQty = (_b = foundry.utils.getProperty(changed, "system.quantity")) != null ? _b : this.system.quantity; + + // Qty max 1 + if (this.type === "computer" || this.type === "container" || (this.type === "item" && this.system.subType === "software")) { + const newQty = foundry.utils.getProperty(changed, "system.quantity") ?? this.system.quantity; if (newQty !== this.system.quantity && newQty > 1) { foundry.utils.setProperty(changed, "system.quantity", 1); } } + + // No Weight if (this.type === "item" && this.system.subType === "software") { - const newWeight = (_c = foundry.utils.getProperty(changed, "system.weight")) != null ? _c : this.system.weight; + const newWeight = foundry.utils.getProperty(changed, "system.weight") ?? this.system.weight; if (newWeight !== this.system.weight && newWeight > 0) { foundry.utils.setProperty(changed, "system.weight", 0); } } } + getRollDisplay() { if (this.type === "talent") { if (this.system.subType === "skill") { let label; - if (this.system.skill.speciality !== "" && this.system.skill.speciality !== void 0) { + if (this.system.skill.speciality !== "" && this.system.skill.speciality !== undefined) { label = `${this.name} (${this.system.skill.speciality})`; } else { label = this.name; } + if (this.system.level > 0) label += ` (+${this.system.level})`; else if (this.system.level < 0) label += ` (${this.system.level})`; + return label; } else if (this.system.subType === "psionic") ; } + return name; } } -var __defProp = Object.defineProperty; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - return value; -}; -const _MGT2Helper = class _MGT2Helper { - static hasValue(object, property) { - return object !== void 0 && object.hasOwnProperty(property) && object[property] !== null && object[property] !== void 0 && object[property] !== ""; - } - static getItemsWeight(items) { - let weight = 0; - for (let i of items) { - let item = i.hasOwnProperty("system") ? i.system : i; - if (item.hasOwnProperty("weightless") && item.weightless === true) { - continue; - } - if (item.hasOwnProperty("weight")) { - let itemQty = item.quantity; - if (!isNaN(itemQty) && itemQty > 0) { - let itemWeight = item.weight; - if (itemWeight > 0) { - weight += itemWeight * itemQty; - } - } - } - } - return weight; - } - static generateUID() { - let result = ""; - const characters = "abcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < 36; i++) { - const randomIndex = Math.floor(Math.random() * characters.length); - result += characters.charAt(randomIndex); - if (i === 8 || i === 12 || i === 16 || i === 20) - result += "-"; - } - return result; - } - static compareByName(a, b) { - if (!a.hasOwnProperty("name") || !b.hasOwnProperty("name")) { - return 0; - } - return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); - } - static getDisplayDM(dm) { - if (dm === 0) - return " (0)"; - if (dm > 0) - return ` (+${dm})`; - if (dm < 0) - return ` (${dm})`; - return ""; - } - static getFormulaDM(dm) { - if (dm === 0) - return "+0"; - if (dm > 0) - return `+${dm}`; - if (dm < 0) - return `${dm}`; - return ""; - } - static getDiceResults(roll) { - const results = []; - for (const die of roll.dice) { - results.push(die.results); - } - return results.flat(2); - } - static getDiceTotal(roll) { - let total = 0; - for (const die of roll.dice) { - total += die.total; - } - return total; - } - static getDifficultyValue(difficulty) { - switch (difficulty) { - case "Simple": - return 2; - case "Easy": - return 4; - case "Routine": - return 6; - case "Average": - return 8; - case "Difficult": - return 10; - case "VeryDifficult": - return 12; - case "Formidable": - return 14; - case "Impossible": - return 16; - default: - return 0; - } - } - static getDifficultyDisplay(difficulty) { - switch (difficulty) { - case "Simple": - return game.i18n.localize("MGT2.Difficulty.Simple") + " (2+)"; - case "Easy": - return game.i18n.localize("MGT2.Difficulty.Easy") + " (4+)"; - case "Routine": - return game.i18n.localize("MGT2.Difficulty.Routine") + " (6+)"; - case "Average": - return game.i18n.localize("MGT2.Difficulty.Average") + " (8+)"; - case "Difficult": - return game.i18n.localize("MGT2.Difficulty.Difficult") + " (10+)"; - case "VeryDifficult": - return game.i18n.localize("MGT2.Difficulty.VeryDifficult") + " (12+)"; - case "Formidable": - return game.i18n.localize("MGT2.Difficulty.Formidable") + " (14+)"; - case "Impossible": - return game.i18n.localize("MGT2.Difficulty.Impossible") + " (16+)"; - default: - return null; - } - } - static getRangeDisplay(range) { - let value = Number(range.value); - if (isNaN(value)) - return null; - let label; - if (range.unit !== null && range.unit !== void 0 && range.unit !== "") - label = game.i18n.localize(`MGT2.MetricRange.${range.unit}`).toLowerCase(); - else - label = ""; - return `${value}${label}`; - } - static getWeightLabel() { - return game.i18n.localize("MGT2.MetricSystem.Weight.kg"); - } - static getDistanceLabel() { - return game.i18n.localize("MGT2.MetricSystem.Distance.km"); - } - static getIntegerFromInput(data) { - return Math.trunc(this.getNumberFromInput(data)); - } - static getNumberFromInput(data) { - if (data === void 0 || data === null) - return 0; - if (typeof data === "string") { - let converted2 = Number(data.replace(/\s+/g, "").replace(this.badDecimalSeparator, this.decimalSeparator).trim()); - if (isNaN(converted2)) - return 0; - return converted2; - } - let converted = Number(data); - if (isNaN(converted)) - return 0; - return converted; - } - static convertWeightForDisplay(weight) { - return weight; - } - static convertWeightFromInput(weight) { - return Math.round(weight * 10) / 10; - } - static getDataFromDropEvent(event) { - var _a; - try { - return JSON.parse((_a = event.dataTransfer) == null ? void 0 : _a.getData("text/plain")); - } catch (err) { - return false; - } - } - static async getItemDataFromDropData(dropData) { - var _a; - let item; - if (((_a = game.modules.get("monks-enhanced-journal")) == null ? void 0 : _a.active) && dropData.itemId && dropData.uuid.includes("JournalEntry")) { - await fromUuid(dropData.uuid); - } else if (dropData.hasOwnProperty("uuid")) { - item = await fromUuid(dropData.uuid); - } else { - let uuid = `${dropData.type}.${dropData.data._id}`; - item = await fromUuid(uuid); - } - if (!item) { - throw new Error(game.i18n.localize("Errors.CouldNotFindItem").replace("_ITEM_ID_", dropData.uuid)); - } - if (item.pack) { - const pack = game.packs.get(item.pack); - item = await (pack == null ? void 0 : pack.getDocument(item._id)); - } - return foundry.utils.deepClone(item); - } -}; -__publicField(_MGT2Helper, "POUNDS_CONVERT", 2.20462262185); -__publicField(_MGT2Helper, "decimalSeparator"); -__publicField(_MGT2Helper, "badDecimalSeparator"); -_MGT2Helper.decimalSeparator = Number(1.1).toLocaleString().charAt(1); -_MGT2Helper.badDecimalSeparator = _MGT2Helper.decimalSeparator === "." ? "," : "."; -__publicField(_MGT2Helper, "format", function() { - var s = arguments[0]; - for (var i = 0; i < arguments.length - 1; i++) { - var reg = new RegExp("\\{" + i + "\\}", "gm"); - s = s.replace(reg, arguments[i + 1]); - } - return s; -}); -let MGT2Helper = _MGT2Helper; +const { HandlebarsApplicationMixin: HandlebarsApplicationMixin$1 } = foundry.applications.api; -class TravellerItemSheet extends ItemSheet { - /** @inheritdoc */ - static get defaultOptions() { - const options = super.defaultOptions; - return foundry.utils.mergeObject(options, { - classes: ["mgt2", game.settings.get("mgt2", "theme"), "sheet"], - width: 630, - tabs: [{ navSelector: ".horizontal-tabs", contentSelector: ".itemsheet-panel", initial: "tab1" }] - }); - } - /* -------------------------------------------- */ - get template() { - const path = "systems/mgt2/templates/items"; - return `${path}/${this.item.type}-sheet.html`; - } - /** @inheritdoc */ - async getData(options) { - const context = await super.getData(options); - const item = context.item; - const source = item.toObject(); - context.config = CONFIG.MGT2; - const settings = {}; - settings.usePronouns = game.settings.get("mgt2", "usePronouns"); - let containers = null; - let computers = null; - let hadContainer; - if (context.item.actor != null) { - hadContainer = true; - containers = [{ "name": "", "_id": "" }].concat(context.item.actor.getContainers()); - computers = [{ "name": "", "_id": "" }].concat(context.item.actor.getComputers()); - } else { - hadContainer = false; +class MGT2ActorSheet extends HandlebarsApplicationMixin$1(foundry.applications.sheets.ActorSheetV2) { + + static SHEET_MODES = { EDIT: 0, PLAY: 1 } + + constructor(options = {}) { + super(options); + this._sheetMode = this.constructor.SHEET_MODES.PLAY; } - let weight = null; - if (item.system.hasOwnProperty("weight")) { - weight = MGT2Helper.convertWeightForDisplay(item.system.weight); + + /** @override */ + static DEFAULT_OPTIONS = { + classes: ["mgt2", "sheet", "actor"], + position: { + width: 780, + }, + form: { + submitOnChange: true, + closeOnSubmit: false, + }, + window: { + resizable: true, + }, + dragDrop: [{ dragSelector: ".drag-item-list", dropSelector: ".drop-item-list" }], + actions: { + toggleSheet: MGT2ActorSheet.#onToggleSheet, + }, } - let unitlabels = { - weight: MGT2Helper.getWeightLabel() - }; - let skills = []; - if (this.actor !== null) { - for (let item2 of this.actor.items) { - if (item2.type === "talent") { - if (item2.system.subType === "skill") - skills.push({ _id: item2._id, name: item2.getRollDisplay() }); + + get isPlayMode() { + if (this._sheetMode === undefined) this._sheetMode = this.constructor.SHEET_MODES.PLAY; + return this._sheetMode === this.constructor.SHEET_MODES.PLAY; + } + + get isEditMode() { + if (this._sheetMode === undefined) this._sheetMode = this.constructor.SHEET_MODES.PLAY; + return this._sheetMode === this.constructor.SHEET_MODES.EDIT; + } + + tabGroups = { primary: "stats" } + + /** @override */ + async _prepareContext() { + const base = await super._prepareContext(); + const actor = this.document; + return { + ...base, + actor: actor, + // Flat shorthands for template backward-compat (AppV1 style) + name: actor.name, + img: actor.img, + cssClass: this.isEditable ? "editable" : "locked", + system: actor.system, + source: actor.toObject(), + fields: actor.schema.fields, + systemFields: actor.system.schema.fields, + isEditable: this.isEditable, + isEditMode: this.isEditMode, + isPlayMode: this.isPlayMode, + isGM: game.user.isGM, + config: CONFIG.MGT2, + }; + } + + /** @override */ + _onRender(context, options) { + super._onRender(context, options); + this._activateTabGroups(); + } + + _activateTabGroups() { + for (const [group, activeTab] of Object.entries(this.tabGroups)) { + const nav = this.element.querySelector(`nav[data-group="${group}"]`); + if (!nav) continue; + + nav.querySelectorAll('[data-tab]').forEach(link => { + link.classList.toggle('active', link.dataset.tab === activeTab); + link.addEventListener('click', event => { + event.preventDefault(); + this.tabGroups[group] = link.dataset.tab; + this.render(); + }); + }); + + this.element.querySelectorAll(`[data-group="${group}"][data-tab]`).forEach(content => { + content.classList.toggle('active', content.dataset.tab === activeTab); + }); } - } } - skills.sort(MGT2Helper.compareByName); - skills = [{ _id: "NP", name: game.i18n.localize("MGT2.Items.NotProficient") }].concat(skills); - foundry.utils.mergeObject(context, { - source: source.system, - system: item.system, - settings, - containers, - computers, - hadContainer, - weight, - unitlabels, - editable: this.isEditable, - isGM: game.user.isGM, - skills, - config: CONFIG - //rollData: this.item.getRollData(), - }); - return context; - } - /* -------------------------------------------- */ - /** @inheritdoc */ - activateListeners(html) { - super.activateListeners(html); - if (!this.isEditable) - return; - html.find("div.itemsheet-panel").each((i, li) => { - }); - if (this.item.type == "career") { - html.find(".event-create").click(this._onCareerEventCreate.bind(this)); - html.find(".event-delete").click(this._onCareerEventDelete.bind(this)); - } else if (this.item.type == "armor" || this.item.type == "computer" || this.item.type == "species" || this.item.type == "weapon") { - html.find(".options-create").click(this._onOptionCreate.bind(this)); - html.find(".options-delete").click(this._onOptionDelete.bind(this)); + + /** @override */ + _canDragDrop(selector) { + return this.isEditable; } - if (this.item.type == "species") { - html.find(".modifiers-create").click(this._onModifierEventCreate.bind(this)); - html.find(".modifiers-delete").click(this._onModifierEventDelete.bind(this)); + + static async #onToggleSheet(event) { + event.preventDefault(); + this._sheetMode = this.isPlayMode + ? this.constructor.SHEET_MODES.EDIT + : this.constructor.SHEET_MODES.PLAY; + this.render(); } - } - async _onModifierEventCreate(event) { - event.preventDefault(); - await this._onSubmit(event); - let modifiers = this.item.system.modifiers; - let index; - if (modifiers.length === 0) { - modifiers = {}; - modifiers["0"] = { characteristic: "Endurance", value: null }; - } else { - index = Math.max(...Object.keys(modifiers)); - index++; - modifiers[index] = { characteristic: "Endurance", value: null }; +} + +class MGT2Helper { + static POUNDS_CONVERT = 2.20462262185; + + static decimalSeparator; + static badDecimalSeparator; + + static { + this.decimalSeparator = Number(1.1).toLocaleString().charAt(1); + this.badDecimalSeparator = (this.decimalSeparator === "." ? "," : "."); } - let update = { - system: { - modifiers - } - }; - return this.item.update(update); - } - async _onModifierEventDelete(event) { - event.preventDefault(); - await this._onSubmit(event); - const element = event.currentTarget.closest(".modifiers-part"); - const modifiers = foundry.utils.deepClone(this.item.system.modifiers); - let index = Number(element.dataset.modifiersPart); - const newModifiers = []; - let entries = Object.entries(modifiers); - if (entries.length > 1) { - for (const [key, value] of entries) { - if (key != index) - newModifiers.push(value); - } - } - let update = { - system: { - modifiers: newModifiers - } - }; - return this.item.update(update); - } - async _onCareerEventCreate(event) { - event.preventDefault(); - await this._onSubmit(event); - let events = this.item.system.events; - let index; - if (events.length === 0) { - events = {}; - events["0"] = { age: "", description: "" }; - } else { - index = Math.max(...Object.keys(events)); - index++; - events[index] = { age: "", description: "" }; - } - let update = { - system: { - events - } - }; - return this.item.update(update); - } - async _onCareerEventDelete(event) { - event.preventDefault(); - await this._onSubmit(event); - const element = event.currentTarget.closest(".events-part"); - const events = foundry.utils.deepClone(this.item.system.events); - let index = Number(element.dataset.eventsPart); - const newEvents = []; - let entries = Object.entries(events); - if (entries.length > 1) { - for (const [key, value] of entries) { - if (key != index) - newEvents.push(value); - } - } - let update = { - system: { - events: newEvents - } - }; - return this.item.update(update); - } - async _onOptionCreate(event) { - event.preventDefault(); - await this._onSubmit(event); - const property = event.currentTarget.dataset.property; - let options = this.item.system[property]; - let index; - if (options.length === 0) { - options = {}; - options["0"] = { name: "", description: "" }; - } else { - index = Math.max(...Object.keys(options)); - index++; - options[index] = { name: "", description: "" }; - } - let update = {}; - update[`system.${property}`] = options; - return this.item.update(update); - } - async _onOptionDelete(event) { - event.preventDefault(); - await this._onSubmit(event); - const element = event.currentTarget.closest(".options-part"); - const property = element.dataset.property; - const options = foundry.utils.deepClone(this.item.system[property]); - let index = Number(element.dataset.optionsPart); - const newOptions = []; - let entries = Object.entries(options); - if (entries.length > 1) { - for (const [key, value] of entries) { - if (key != index) - newOptions.push(value); - } - } - let update = {}; - update[`system.${property}`] = newOptions; - return this.item.update(update); - } - // async _onTraitCreate(event) { - // event.preventDefault(); - // await this._onSubmit(event); - // const traits = this.item.system.traits; - // return this.item.update({ "system.traits.parts": traits.parts.concat([["", ""]]) }); - // } - // async _onTraitDelete(event) { - // event.preventDefault(); - // await this._onSubmit(event); - // const element = event.currentTarget.closest(".traits-part"); - // const traits = foundry.utils.deepClone(this.item.system.traits); - // traits.parts.splice(Number(element.dataset.traitsPart), 1); - // return this.item.update({ "system.traits.parts": traits.parts }); - // } - _getSubmitData(updateData = {}) { - const formData = foundry.utils.expandObject(super._getSubmitData(updateData)); - if (formData.hasOwnProperty("system") && formData.system.hasOwnProperty("container") && this.item.system.hasOwnProperty("equipped")) { - const equippedChange = this.item.system.equipped !== formData.system.equipped; - const containerChange = this.item.system.container.id !== formData.system.container.id; - if (equippedChange) { - if (formData.system.equipped === true) { - formData.system.container = { - //inContainer: false, - id: "" - }; + + static format = function() { + var s = arguments[0]; + for (var i = 0; i < arguments.length - 1; i++) { + var reg = new RegExp("\\{" + i + "\\}", "gm"); + s = s.replace(reg, arguments[i + 1]); } - } else if (containerChange) { - if (formData.system.container.id !== "" && (this.item.system.container.id === "" || this.item.system.container.id === null)) { - formData.system.equipped = false; + return s; + } + + static hasValue(object, property) { + return object !== undefined && object.hasOwnProperty(property) && object[property] !== null && object[property] !== undefined && object[property] !== ""; + } + + static getItemsWeight(items) { + let weight = 0; + for (let i of items) { + let item = i.hasOwnProperty("system") ? i.system : i; + if (item.hasOwnProperty("weightless") && item.weightless === true) { + continue; + } + + if (item.hasOwnProperty("weight")) { + let itemQty = item.quantity; + if (!isNaN(itemQty) && itemQty > 0) { + let itemWeight = item.weight; + if (itemWeight > 0) { + weight += itemWeight * itemQty; + } + } + } } - } + return weight; } - if (formData.hasOwnProperty("weight")) { - formData.system.weight = MGT2Helper.convertWeightFromInput(formData.weight); - delete formData.weight; + + static generateUID() { + let result = ''; + const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; + + for (let i = 0; i < 36; i++) { + const randomIndex = Math.floor(Math.random() * characters.length); + result += characters.charAt(randomIndex); + if (i === 8 || i === 12 || i === 16 || i === 20) + result += "-"; + } + + return result; } - if (formData.system.hasOwnProperty("quantity")) { - formData.system.quantity = MGT2Helper.getIntegerFromInput(formData.system.quantity); + + static compareByName(a, b) { + if (!a.hasOwnProperty("name") || !b.hasOwnProperty("name")) { + return 0; + } + return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); } - if (formData.system.hasOwnProperty("cost")) { - formData.system.cost = MGT2Helper.getIntegerFromInput(formData.system.cost); + + static getDisplayDM(dm) { + if (dm === 0) return " (0)"; + if (dm > 0) return ` (+${dm})`; + if (dm < 0) return ` (${dm})`; + return ""; + } + static getFormulaDM(dm) { + if (dm === 0) return "+0"; + if (dm > 0) return `+${dm}`; + if (dm < 0) return `${dm}`; + return ""; + } + + static getDiceResults(roll) { + const results = []; + for (const die of roll.dice) { + results.push(die.results); + } + return results.flat(2); + } + + static getDiceTotal(roll) { + let total = 0; + for (const die of roll.dice) { + total += die.total; + } + return total; + } + + static getDifficultyValue(difficulty) { + switch(difficulty) { + case "Simple": return 2; + case "Easy": return 4; + case "Routine": return 6; + case "Average": return 8; + case "Difficult": return 10; + case "VeryDifficult": return 12; + case "Formidable": return 14; + case "Impossible": return 16; + default: + return 0; + } + } + + static getDifficultyDisplay(difficulty) { + switch(difficulty) { + case "Simple": return game.i18n.localize("MGT2.Difficulty.Simple") + " (2+)"; + case "Easy": return game.i18n.localize("MGT2.Difficulty.Easy") + " (4+)"; + case "Routine": return game.i18n.localize("MGT2.Difficulty.Routine") + " (6+)"; + case "Average": return game.i18n.localize("MGT2.Difficulty.Average") + " (8+)"; + case "Difficult": return game.i18n.localize("MGT2.Difficulty.Difficult") + " (10+)"; + case "VeryDifficult": return game.i18n.localize("MGT2.Difficulty.VeryDifficult") + " (12+)"; + case "Formidable": return game.i18n.localize("MGT2.Difficulty.Formidable") + " (14+)"; + case "Impossible": return game.i18n.localize("MGT2.Difficulty.Impossible") + " (16+)"; + default: + return null; + } + } + + static getRangeDisplay(range) { + let value = Number(range.value); + + if (isNaN(value)) return null; + + let label; + //if (game.settings.get("mgt2", "useDistanceMetric") === true) { + if (range.unit !== null && range.unit !== undefined && range.unit !== "") + label = game.i18n.localize(`MGT2.MetricRange.${range.unit}`).toLowerCase(); + else + label = ""; + //} else { + // TODO + //} + + return `${value}${label}`; + } + + static getWeightLabel() { + //const label = game.settings.get("mgt2", "useWeightMetric") === true ? "MGT2.MetricSystem.Weight.kg" : "MGT2.ImperialSystem.Weight.lb"; + //return game.i18n.localize(label); + return game.i18n.localize("MGT2.MetricSystem.Weight.kg"); + } + + static getDistanceLabel() { + //const label = game.settings.get("mgt2", "useDistanceMetric") === true ? "MGT2.MetricSystem.Distance.km" : "MGT2.ImperialSystem.Distance.mi"; + //return game.i18n.localize(label); + return game.i18n.localize("MGT2.MetricSystem.Distance.km"); + } + + static getIntegerFromInput(data) { + return Math.trunc(this.getNumberFromInput(data)); + } + + static getNumberFromInput(data) { + if (data === undefined || data === null) return 0; + + if (typeof data === "string") { + let converted = Number(data.replace(/\s+/g, '').replace(this.badDecimalSeparator, this.decimalSeparator).trim()); + if (isNaN(converted)) + return 0; + + return converted; + } + + let converted = Number(data); + + if (isNaN(converted)) + return 0; + + return converted; + } + + static convertWeightForDisplay(weight) { + //if (game.settings.get("mgt2", "useWeightMetric") === true || weight === 0) + return weight; + + // Metric to Imperial + //const pounds = weight * this.POUNDS_CONVERT; + //return Math.round(pounds * 10) / 10; + } + + static convertWeightFromInput(weight) { + //if (game.settings.get("mgt2", "useWeightMetric") === true || weight === 0) + return Math.round(weight * 10) / 10; + + // Imperial to Metric + //const kg = this.POUNDS_CONVERT / weight; + //return Math.round(kg * 10) / 10; + } + + static getDataFromDropEvent(event) { + try { + return JSON.parse(event.dataTransfer?.getData("text/plain")); + } catch (err) { + return false; + } + + //if ( data.type !== "Item" ) return false; + //const item = await Item.implementation.fromDropData(data); + } + + static async getItemDataFromDropData(dropData) { + //console.log("getItemDataFromDropData"); + let item; + if (game.modules.get("monks-enhanced-journal")?.active && dropData.itemId && dropData.uuid.includes("JournalEntry")) { + await fromUuid(dropData.uuid); + } else if (dropData.hasOwnProperty("uuid")) { + item = await fromUuid(dropData.uuid); + } else { + let uuid = `${dropData.type}.${dropData.data._id}`; + item = await fromUuid(uuid); + } + + if (!item) { + throw new Error(game.i18n.localize("Errors.CouldNotFindItem").replace("_ITEM_ID_", dropData.uuid)); + } + if (item.pack) { + const pack = game.packs.get(item.pack); + item = await pack?.getDocument(item._id); + } + return deepClone(item); } - return foundry.utils.flattenObject(formData); - } } class RollPromptDialog extends Dialog { - constructor(dialogData = {}, options = {}) { - super(dialogData, options); - this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet", "dialog"]; - } - static async create(options) { - const htmlContent = await renderTemplate("systems/mgt2/templates/roll-prompt.html", { - config: CONFIG.MGT2, - //formula: formula, - characteristics: options.characteristics, - characteristic: options.characteristic, - skills: options.skills, - skill: options.skill, - fatigue: options.fatigue, - encumbrance: options.encumbrance, - difficulty: options.difficulty - }); - const results = new Promise((resolve) => { - new this({ - title: options.title, - content: htmlContent, - buttons: { - boon: { - label: game.i18n.localize("MGT2.RollPrompt.Boon"), - callback: (html) => { - const formData = new FormDataExtended(html[0].querySelector("form")).object; - formData.diceModifier = "dl"; - resolve(formData); - } - }, - submit: { - label: game.i18n.localize("MGT2.RollPrompt.Roll"), - icon: '', - callback: (html) => { - const formData = new FormDataExtended(html[0].querySelector("form")).object; - resolve(formData); - } - }, - bane: { - label: game.i18n.localize("MGT2.RollPrompt.Bane"), - //icon: '', - callback: (html) => { - const formData = new FormDataExtended(html[0].querySelector("form")).object; - formData.diceModifier = "dh"; - resolve(formData); - } - } - } - //close: () => { resolve(false) } - }).render(true); - }); - return results; - } + constructor(dialogData = {}, options = {}) { + super(dialogData, options); + this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet", "dialog"]; + } + + static async create(options) { + + const htmlContent = await renderTemplate('systems/mgt2/templates/roll-prompt.html', { + config: CONFIG.MGT2, + //formula: formula, + characteristics: options.characteristics, + characteristic: options.characteristic, + skills: options.skills, + skill: options.skill, + fatigue: options.fatigue, + encumbrance: options.encumbrance, + difficulty: options.difficulty + }); + + const results = new Promise(resolve => { + new this({ + title: options.title, + content: htmlContent, + buttons: { + boon: { + label: game.i18n.localize("MGT2.RollPrompt.Boon"), + callback: (html) => { + const formData = new FormDataExtended(html[0].querySelector('form')).object; + formData.diceModifier = "dl"; + resolve(formData); + } + }, + submit: { + label: game.i18n.localize("MGT2.RollPrompt.Roll"), + icon: '', + callback: (html) => { + const formData = new FormDataExtended(html[0].querySelector('form')).object; + resolve(formData); + }, + }, + bane: { + label: game.i18n.localize("MGT2.RollPrompt.Bane"), + //icon: '', + callback: (html) => { + const formData = new FormDataExtended(html[0].querySelector('form')).object; + formData.diceModifier = "dh"; + resolve(formData); + } + } + } + //close: () => { resolve(false) } + }).render(true); + }); + + //console.log(Promise.resolve(results)); + return results; + } } + class RollPromptHelper { - static async roll(options) { - return await RollPromptDialog.create(options); - } - static async promptForFruitTraits() { - const htmlContent = await renderTemplate("systems/mgt2/templateschat/chat/roll-prompt.html"); - return new Promise((resolve, reject) => { - const dialog = new Dialog({ - title: "Fruit Traits", - content: htmlContent, - buttons: { - submit: { - label: "Roll", - icon: '', - callback: (html) => { - const formData = new FormDataExtended(html[0].querySelector("form")).toObject(); - resolve(formData); - } - }, - skip: { - label: "Cancel", - callback: () => resolve(null) - } - }, - render: (html) => { - }, - close: () => { - reject("User closed dialog without making a selection."); - } - }); - dialog.render(true); - }); - } + + static async roll(options) { + return await RollPromptDialog.create(options); + } + + static async promptForFruitTraits() { + const htmlContent = await renderTemplate('systems/mgt2/templateschat/chat/roll-prompt.html'); + + return new Promise((resolve, reject) => { + const dialog = new Dialog({ + title: "Fruit Traits", + content: htmlContent, + buttons: { + submit: { + label: "Roll", + icon: '', + callback: (html) => { + const formData = new FormDataExtended(html[0].querySelector('form')) + .toObject(); + + //verifyFruitInputs(formData); + + resolve(formData); + }, + }, + skip: { + label: "Cancel", + callback: () => resolve(null), + } + }, + render: (html) => { + //html.on('click', 'button[data-preset]', handleFruitPreset); + }, + close: () => { + reject('User closed dialog without making a selection.'); + }, + }); + + dialog.render(true); + }); + } } class EditorFullViewDialog extends Dialog { - constructor(dialogData = {}, options = {}) { - super(dialogData, options); - this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet"]; - this.options.resizable = true; - } - static async create(title, html) { - const htmlContent = await renderTemplate("systems/mgt2/templates/editor-fullview.html", { - config: CONFIG.MGT2, - html - }); - const results = new Promise((resolve) => { - new this({ - title, - content: htmlContent, - buttons: { - //close: { label: game.i18n.localize("MGT2.Close") } - } - }).render(true); - }); - return results; - } + constructor(dialogData = {}, options = {}) { + super(dialogData, options); + this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet"]; + this.options.resizable = true; + } + + static async create(title, html) { + const htmlContent = await renderTemplate("systems/mgt2/templates/editor-fullview.html", { + config: CONFIG.MGT2, + html: html + }); + + const results = new Promise(resolve => { + new this({ + title: title, + content: htmlContent, + buttons: { + //close: { label: game.i18n.localize("MGT2.Close") } + } + }).render(true); + }); + + return results; + } } + class ActorConfigDialog extends Dialog { - constructor(dialogData = {}, options = {}) { - super(dialogData, options); - this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet"]; - } - static async create(system) { - const htmlContent = await renderTemplate("systems/mgt2/templates/actors/actor-config-sheet.html", { - config: CONFIG.MGT2, - system - }); - const results = new Promise((resolve) => { - new this({ - title: "Configuration", - content: htmlContent, - buttons: { - submit: { - label: game.i18n.localize("MGT2.Save"), - icon: '', - callback: (html) => { - const formData = new FormDataExtended(html[0].querySelector("form")).object; - resolve(formData); - } - } - } - }).render(true); - }); - return results; - } + constructor(dialogData = {}, options = {}) { + super(dialogData, options); + this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet"]; + } + + static async create(system) { + const htmlContent = await renderTemplate("systems/mgt2/templates/actors/actor-config-sheet.html", { + config: CONFIG.MGT2, + system: system + }); + + const results = new Promise(resolve => { + new this({ + title: "Configuration", + content: htmlContent, + buttons: { + submit: { + label: game.i18n.localize("MGT2.Save"), + icon: '', + callback: (html) => { + const formData = new FormDataExtended(html[0].querySelector('form')).object; + resolve(formData); + }, + } + } + }).render(true); + }); + + return results; + } } + class ActorCharacteristicDialog extends Dialog { - // https://foundryvtt.wiki/en/development/api/dialog - constructor(dialogData = {}, options = {}) { - super(dialogData, options); - this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet"]; - } - static async create(name, show, showMax, showAll = false) { - const htmlContent = await renderTemplate("systems/mgt2/templates/actors/actor-config-characteristic-sheet.html", { - name, - show, - showMax, - showAll - }); - const results = new Promise((resolve) => { - new this({ - title: "Configuration: " + name, - content: htmlContent, - buttons: { - submit: { - label: game.i18n.localize("MGT2.Save"), - icon: '', - callback: (html) => { - const formData = new FormDataExtended(html[0].querySelector("form")).object; - resolve(formData); - } - } - } - }).render(true); - }); - return results; - } + // https://foundryvtt.wiki/en/development/api/dialog + constructor(dialogData = {}, options = {}) { + super(dialogData, options); + this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet"]; + } + + static async create(name, show, showMax, showAll = false) { + const htmlContent = await renderTemplate("systems/mgt2/templates/actors/actor-config-characteristic-sheet.html", { + name: name, + show: show, + showMax: showMax, + showAll: showAll + }); + + const results = new Promise(resolve => { + new this({ + title: "Configuration: " + name, + content: htmlContent, + buttons: { + submit: { + label: game.i18n.localize("MGT2.Save"), + icon: '', + callback: (html) => { + const formData = new FormDataExtended(html[0].querySelector('form')).object; + resolve(formData); + }, + } + } + }).render(true); + }); + + return results; + } } + class TraitEditDialog extends Dialog { - constructor(dialogData = {}, options = {}) { - super(dialogData, options); - this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet"]; - } - static async create(data) { - const htmlContent = await renderTemplate("systems/mgt2/templates/actors/trait-sheet.html", { - config: CONFIG.MGT2, - data - }); - const title = data.hasOwnProperty("name") && data.name !== void 0 ? data.name : game.i18n.localize("MGT2.Actor.EditTrait"); - const results = new Promise((resolve) => { - new this({ - title, - content: htmlContent, - buttons: { - submit: { - label: game.i18n.localize("MGT2.Save"), - icon: '', - callback: (html) => { - const formData = new FormDataExtended(html[0].querySelector("form")).object; - resolve(formData); - } - } - //cancel: { label: "Cancel" } - } - // close: (html) => { - // console.log("This always is logged no matter which option is chosen"); - // const formData = new FormDataExtended(html[0].querySelector('form')).object; - // resolve(formData); - // } - }).render(true); - }); - return results; - } + constructor(dialogData = {}, options = {}) { + super(dialogData, options); + this.options.classes = ["mgt2", game.settings.get("mgt2", "theme"), "sheet"]; + } + + static async create(data) { + const htmlContent = await renderTemplate("systems/mgt2/templates/actors/trait-sheet.html", { + config: CONFIG.MGT2, + data: data + }); + const title = data.hasOwnProperty("name") && data.name !== undefined ? data.name : game.i18n.localize("MGT2.Actor.EditTrait"); + const results = new Promise(resolve => { + new this({ + title: title, + content: htmlContent, + buttons: { + submit: { + label: game.i18n.localize("MGT2.Save"), + icon: '', + callback: (html) => { + const formData = new FormDataExtended(html[0].querySelector('form')).object; + resolve(formData); + }, + } + //cancel: { label: "Cancel" } + } + // close: (html) => { + // console.log("This always is logged no matter which option is chosen"); + // const formData = new FormDataExtended(html[0].querySelector('form')).object; + // resolve(formData); + // } + }).render(true); + }); + + return results; + } } + class CharacterPrompts { - static async openConfig(system) { - return await ActorConfigDialog.create(system); - } - static async openCharacteristic(name, hide, showMax, showAll = false) { - return await ActorCharacteristicDialog.create(name, hide, showMax, showAll); - } - static async openTraitEdit(data) { - return await TraitEditDialog.create(data); - } - static async openEditorFullView(title, html) { - return await EditorFullViewDialog.create(title, html); - } + + static async openConfig(system) { + return await ActorConfigDialog.create(system); + } + + static async openCharacteristic(name, hide, showMax, showAll = false) { + return await ActorCharacteristicDialog.create(name, hide, showMax, showAll); + } + + static async openTraitEdit(data) { + return await TraitEditDialog.create(data); + } + + static async openEditorFullView(title, html) { + return await EditorFullViewDialog.create(title, html); + } } -class TravellerActorSheet extends ActorSheet { - /** @inheritdoc */ - static get defaultOptions() { - const options = super.defaultOptions; - if (game.user.isGM || options.editable) - options.dragDrop.push({ dragSelector: ".drag-item-list", dropSelector: ".drop-item-list" }); - return foundry.utils.mergeObject(options, { - classes: ["mgt2", game.settings.get("mgt2", "theme"), "sheet", "actor", "character", "nopad"], - template: "systems/mgt2/templates/actors/actor-sheet.html", - width: 780, - //height: 600, - tabs: [ - { navSelector: ".sheet-sidebar", contentSelector: "form" }, - { navSelector: "nav[data-group='characteristics']", contentSelector: "section.characteristics-panel", initial: "core" }, - { navSelector: "nav[data-group='inventory']", contentSelector: "div.tab[data-tab='inventory']", initial: "onhand" } - ] - }); - } - async getData(options) { - const context = super.getData(options); - this._prepareCharacterItems(context); - return context.data; - } - _prepareCharacterItems(sheetData) { - const actorData = sheetData.data; - actorData.isGM = game.user.isGM; - actorData.showTrash = false; - actorData.initiative = this.actor.getInitiative(); - const weapons = []; - const armors = []; - const augments = []; - const computers = []; - const softwares = []; - const items = []; - const equipments = []; - const containerItems = []; - const careers = []; - const skills = []; - const psionics = []; - const diseases = []; - const wounds = []; - const contacts = []; - const settings = { - weightUnit: "kg", - //weightUnit: game.settings.get("mgt2", "useWeightMetric") ? "kg" : "lb", - usePronouns: game.settings.get("mgt2", "usePronouns"), - useGender: game.settings.get("mgt2", "useGender"), - showLife: game.settings.get("mgt2", "showLife") - }; - actorData.settings = settings; - const actorContainers = []; - for (let item of sheetData.items) { - if (item.type === "container") { - actorContainers.push(item); - } else if (item.type === "computer") { - computers.push(item); - item.subItems = []; - if (item.system.overload === true) - item.overloadClass = "computer-overload"; - } +class TravellerCharacterSheet extends MGT2ActorSheet { + + /** @override */ + static DEFAULT_OPTIONS = { + ...super.DEFAULT_OPTIONS, + classes: [...super.DEFAULT_OPTIONS.classes, "character", "nopad"], + window: { + ...super.DEFAULT_OPTIONS.window, + title: "TYPES.Actor.character", + }, + actions: { + ...super.DEFAULT_OPTIONS.actions, + createItem: TravellerCharacterSheet.#onCreateItem, + editItem: TravellerCharacterSheet.#onEditItem, + deleteItem: TravellerCharacterSheet.#onDeleteItem, + equipItem: TravellerCharacterSheet.#onEquipItem, + itemStorageIn: TravellerCharacterSheet.#onItemStorageIn, + itemStorageOut: TravellerCharacterSheet.#onItemStorageOut, + softwareEject: TravellerCharacterSheet.#onSoftwareEject, + createContainer: TravellerCharacterSheet.#onContainerCreate, + editContainer: TravellerCharacterSheet.#onContainerEdit, + deleteContainer: TravellerCharacterSheet.#onContainerDelete, + roll: TravellerCharacterSheet.#onRoll, + openConfig: TravellerCharacterSheet.#onOpenConfig, + openCharacteristic: TravellerCharacterSheet.#onOpenCharacteristic, + traitCreate: TravellerCharacterSheet.#onTraitCreate, + traitEdit: TravellerCharacterSheet.#onTraitEdit, + traitDelete: TravellerCharacterSheet.#onTraitDelete, + openEditor: TravellerCharacterSheet.#onOpenEditor, + }, } - actorContainers.sort(MGT2Helper.compareByName); - const containers = [{ "name": game.i18n.localize("MGT2.Items.SelectAll"), "_id": "", "display": game.i18n.localize("MGT2.Items.SelectAll") }].concat(actorContainers); - const containerIndex = /* @__PURE__ */ new Map(); - for (let c of actorContainers) { - containerIndex.set(c._id, c); - if (c.system.weight > 0) { - c.weight = MGT2Helper.convertWeightForDisplay(c.system.weight) + " " + settings.weightUnit; - c.display = c.name.length > 12 ? `${c.name.substring(0, 12)}... (${c.weight})` : `${c.name} (${c.weight})`; - } else { - c.display = c.name.length > 12 ? c.name.substring(0, 12) + "..." : c.name; - } - if (c.system.onHand === true) - c.subItems = []; + + /** @override */ + static PARTS = { + sheet: { + template: "systems/mgt2/templates/actors/actor-sheet.html", + }, } - let currentContainerView; - if (actorData.system.containerView !== "") { - currentContainerView = containerIndex.get(actorData.system.containerView); - if (currentContainerView !== void 0) { - actorData.containerView = currentContainerView; - actorData.containerWeight = MGT2Helper.convertWeightForDisplay(currentContainerView.system.weight); - } else { - currentContainerView = null; - actorData.containerWeight = MGT2Helper.convertWeightForDisplay(0); - } - } else { - currentContainerView = null; - actorData.containerWeight = MGT2Helper.convertWeightForDisplay(0); + + /** @override */ + tabGroups = { + primary: "inventory", + characteristics: "core", + inventory: "onhand", } - actorData.containerShowAll = actorData.system.containerView === ""; - for (let i of sheetData.items) { - let item = i.system; - if (i.system.hasOwnProperty("weight") && i.system.weight > 0) { - if (isNaN(i.system.quantity)) - i.weight = MGT2Helper.convertWeightForDisplay(i.system.weight) + " " + settings.weightUnit; - else - i.weight = MGT2Helper.convertWeightForDisplay(i.system.weight * i.system.quantity) + " " + settings.weightUnit; - } - if (item.hasOwnProperty("container") && item.container.id !== "" && item.container.id !== void 0) { - let container = containerIndex.get(item.container.id); - if (container === void 0) { - if (actorData.containerShowAll) { - i.containerName = "#deleted#"; - containerItems.push(i); - } - continue; + + /** @override */ + async _prepareContext() { + const context = await super._prepareContext(); + const actor = this.document; + + context.settings = { + weightUnit: "kg", + usePronouns: game.settings.get("mgt2", "usePronouns"), + useGender: game.settings.get("mgt2", "useGender"), + showLife: game.settings.get("mgt2", "showLife"), + }; + context.isGM = game.user.isGM; + context.showTrash = false; + context.initiative = actor.getInitiative(); + + this._prepareCharacterItems(context); + + return context; + } + + _prepareCharacterItems(context) { + const actor = this.document; + const settings = context.settings; + const items = actor.items; + + const weapons = [], armors = [], augments = [], computers = [], softwares = []; + const miscItems = [], equipments = [], containerItems = [], careers = []; + const skills = [], psionics = [], diseases = [], wounds = [], contacts = []; + const actorContainers = []; + + for (let i of items) { + if (i.type === "container") { + actorContainers.push(i); + } else if (i.type === "computer") { + computers.push(i); + i._subItems = []; + if (i.system.overload === true) + i._overloadClass = "computer-overload"; + } } - if (container.system.locked && !game.user.isGM) - continue; - if (container.system.onHand === true) { - container.subItems.push(i); - } - if (actorData.containerShowAll || !actorData.containerShowAll && actorData.system.containerView == item.container.id) { - if (container === void 0) - i.containerName = "#deleted#"; - else - i.containerName = container.name; - containerItems.push(i); - } - continue; - } - if (i.system.hasOwnProperty("equipped")) { - i.canEquip = true; - if (i.system.equipped === true) - i.toggleClass = "active"; - } else { - i.canEquip = false; - } - switch (i.type) { - case "equipment": - switch (i.system.subType) { - case "augment": - augments.push(i); - break; - default: - equipments.push(i); - break; - } - break; - case "armor": - armors.push(i); - if (i.system.options && i.system.options.length > 0) { - i.subInfo = i.system.options.map((x) => x.name).join(", "); - } - break; - case "computer": - if (i.system.options && i.system.options.length > 0) { - i.subInfo = i.system.options.map((x) => x.name).join(", "); - } - break; - case "item": - if (i.system.subType === "software") { - if (i.system.software.computerId && i.system.software.computerId !== "") { - const computer = computers.find((x) => x._id === i.system.software.computerId); - if (computer !== void 0) - computer.subItems.push(i); - else - softwares.push(i); + + actorContainers.sort(MGT2Helper.compareByName); + + const containers = [{ name: "(tous)", _id: "" }].concat(actorContainers); + const containerIndex = new Map(); + + for (let c of actorContainers) { + containerIndex.set(c._id, c); + + if (c.system.weight > 0) { + const w = MGT2Helper.convertWeightForDisplay(c.system.weight) + " " + settings.weightUnit; + c._display = c.name.length > 12 ? `${c.name.substring(0, 12)}... (${w})` : `${c.name} (${w})`; } else { - if (i.system.software.bandwidth > 0) - i.display = `${i.name} (${i.system.software.bandwidth})`; - else - i.display = i.name; - softwares.push(i); + c._display = c.name.length > 12 ? c.name.substring(0, 12) + "..." : c.name; } - } else { - items.push(i); - } - break; - case "weapon": - if (i.system.range.isMelee) - i.range = game.i18n.localize("MGT2.Melee"); - else { - i.range = MGT2Helper.getRangeDisplay(i.system.range); - } - if (i.system.traits && i.system.traits.length > 0) { - i.subInfo = i.system.traits.map((x) => x.name).join(", "); - } - weapons.push(i); - break; - case "career": - careers.push(i); - break; - case "contact": - contacts.push(i); - break; - case "disease": - switch (i.system.subType) { - case "wound": - wounds.push(i); - break; - default: - diseases.push(i); - break; - } - break; - case "talent": - if (i.system.subType === "skill") { - skills.push(i); - } else { - if (MGT2Helper.hasValue(i.system.psionic, "reach")) { - i.reach = game.i18n.localize(`MGT2.PsionicReach.${i.system.psionic.reach}`); + + if (c.system.onHand === true) + c._subItems = []; + } + + const containerView = actor.system.containerView; + let currentContainerView = containerView !== "" ? containerIndex.get(containerView) : null; + + context.containerView = currentContainerView || null; + context.containerWeight = currentContainerView + ? MGT2Helper.convertWeightForDisplay(currentContainerView.system.weight) + : MGT2Helper.convertWeightForDisplay(0); + context.containerShowAll = containerView === ""; + + for (let i of items) { + const item = i.system; + + if (item.hasOwnProperty("weight") && item.weight > 0) { + i._weight = isNaN(item.quantity) + ? MGT2Helper.convertWeightForDisplay(item.weight) + " " + settings.weightUnit + : MGT2Helper.convertWeightForDisplay(item.weight * item.quantity) + " " + settings.weightUnit; } - if (MGT2Helper.hasValue(i.system.roll, "difficulty")) { - i.difficulty = game.i18n.localize(`MGT2.Difficulty.${i.system.roll.difficulty}`); + + if (item.hasOwnProperty("container") && item.container.id !== "" && item.container.id !== undefined) { + const container = containerIndex.get(item.container.id); + if (container === undefined) { + if (context.containerShowAll) { + i._containerName = "#deleted#"; + containerItems.push(i); + } + continue; + } + + if (container.system.locked && !game.user.isGM) continue; + + if (container.system.onHand === true) + container._subItems.push(i); + + if (context.containerShowAll || actor.system.containerView === item.container.id) { + i._containerName = container.name; + containerItems.push(i); + } + continue; } - psionics.push(i); - } - break; - case "container": - if (i.system.onHand === true) { - items.push(i); - } - break; - } - } - actorData.encumbranceNormal = MGT2Helper.convertWeightForDisplay(actorData.system.inventory.encumbrance.normal); - actorData.encumbranceHeavy = MGT2Helper.convertWeightForDisplay(actorData.system.inventory.encumbrance.heavy); - if (actorData.system.inventory.weight > actorData.system.inventory.encumbrance.heavy) { - actorData.encumbranceClasses = "encumbrance-heavy"; - actorData.encumbrance = 2; - } else if (actorData.system.inventory.weight > actorData.system.inventory.encumbrance.normal) { - actorData.encumbranceClasses = "encumbrance-normal"; - actorData.encumbrance = 1; - } else { - actorData.encumbrance = 0; - } - if (softwares.length > 0) { - softwares.sort(MGT2Helper.compareByName); - actorData.softwares = softwares; - } - augments.sort(this.compareEquippedByName); - actorData.augments = augments; - armors.sort(this.compareEquippedByName); - actorData.armors = armors; - computers.sort(this.compareEquippedByName); - actorData.computers = computers; - actorData.careers = careers; - contacts.sort(MGT2Helper.compareByName); - actorData.contacts = contacts; - containers.sort(MGT2Helper.compareByName); - actorData.containers = containers; - diseases.sort(MGT2Helper.compareByName); - actorData.diseases = diseases; - actorData.wounds = wounds; - equipments.sort(this.compareEquippedByName); - actorData.equipments = equipments; - items.sort(this.compareEquippedByName); - actorData.items = items; - actorContainers.sort(MGT2Helper.compareByName); - actorData.actorContainers = actorContainers; - skills.sort(MGT2Helper.compareByName); - actorData.skills = skills; - psionics.sort(MGT2Helper.compareByName); - actorData.psionics = psionics; - weapons.sort(this.compareEquippedByName); - actorData.weapons = weapons; - if (containerItems.length > 0) { - containerItems.sort((a, b) => { - const containerResult = a.containerName.localeCompare(b.containerName); - if (containerResult !== 0) - return containerResult; - return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); - }); - } - actorData.containerItems = containerItems; - } - compareEquippedByName(a, b) { - return a.name.toLowerCase().localeCompare(b.name.toLowerCase()); - } - activateListeners(html) { - super.activateListeners(html); - if (!this.options.editable) - return; - html.find(".container-create").click(this._onContainerCreate.bind(this)); - html.find(".container-edit").click((ev) => { - const container = this.actor.getEmbeddedDocument("Item", this.actor.system.containerView); - container.sheet.render(true); - }); - html.find(".container-delete").click((ev) => { - ev.preventDefault(); - const containers = this.actor.getContainers(); - const container = containers.find((x) => x._id == this.actor.system.containerView); - const containerItems = this.actor.items.filter((x) => x.system.hasOwnProperty("container") && x.system.container.id === container._id); - if (containerItems.length > 0) { - for (let item of containerItems) { - let clone = duplicate(item); - clone.system.container.id = ""; - this.actor.updateEmbeddedDocuments("Item", [clone]); - } - } - const cloneActor = duplicate(this.actor); - cloneActor.system.containerView = ""; - if (cloneActor.system.containerDropIn === container._id) { - cloneActor.system.containerDropIn = ""; - const remainingContainers = containers.filter((x) => x._id !== container._id); - if (remainingContainers.length > 0) - cloneActor.system.containerDropIn = remainingContainers[0]._id; - } - this.actor.deleteEmbeddedDocuments("Item", [container._id]); - this.actor.update(cloneActor); - }); - html.find(".item-create").click(this._onItemCreate.bind(this)); - html.find(".item-edit").click((ev) => { - ev.preventDefault(); - const html2 = $(ev.currentTarget).parents("[data-item-id]"); - const item = this.actor.getEmbeddedDocument("Item", html2.data("itemId")); - item.sheet.render(true); - }); - html.find(".item-delete").click((ev) => { - ev.preventDefault(); - const html2 = $(ev.currentTarget).parents("[data-item-id]"); - this.actor.deleteEmbeddedDocuments("Item", [html2.data("itemId")]); - html2.slideUp(200, () => this.render(false)); - }); - html.find("a.item-equip").click(this._onItemEquip.bind(this)); - html.find("a.item-storage-out").click(this._onItemStorageOut.bind(this)); - html.find("a.item-storage-in").click(this._onItemStorageIn.bind(this)); - html.find("a.software-eject").click(this._onSoftwareEject.bind(this)); - html.find("a[data-roll]").click(this._onRoll.bind(this)); - html.find('a[name="config"]').click(this._onOpenConfig.bind(this)); - html.find("a[data-cfg-characteristic]").click(this._onOpenCharacteristic.bind(this)); - html.find(".traits-create").click(this._onTraitCreate.bind(this)); - html.find(".traits-edit").click(this._onTraitEdit.bind(this)); - html.find(".traits-delete").click(this._onTraitDelete.bind(this)); - html.find('a[data-editor="open"]').click(this._onOpenEditor.bind(this)); - } - async _onOpenEditor(event) { - event.preventDefault(); - await CharacterPrompts.openEditorFullView(this.actor.system.personal.species, this.actor.system.personal.speciesText.descriptionLong); - } - async _onTraitCreate(event) { - event.preventDefault(); - await this._onSubmit(event); - let traits = this.actor.system.personal.traits; - let index; - if (traits.length === 0) { - traits = {}; - traits["0"] = { name: "", description: "" }; - } else { - index = Math.max(...Object.keys(traits)); - index++; - traits[index] = { name: "", description: "" }; - } - return this.actor.update({ system: { personal: { traits } } }); - } - async _onTraitEdit(event) { - event.preventDefault(); - const index = $(event.currentTarget).parents("[data-traits-part]").data("traits-part"); - const trait = this.actor.system.personal.traits[index]; - let result = await CharacterPrompts.openTraitEdit(trait); - const traits = this.actor.system.personal.traits; - traits[index].name = result.name; - traits[index].description = result.description; - return this.actor.update({ system: { personal: { traits } } }); - } - async _onTraitDelete(event) { - event.preventDefault(); - await this._onSubmit(event); - const element = event.currentTarget.closest(".traits-part"); - const traits = foundry.utils.deepClone(this.actor.system.personal.traits); - let index = Number(element.dataset.traitsPart); - const newTraits = []; - let entries = Object.entries(traits); - if (entries.length > 1) { - for (const [key, value] of entries) { - if (key != index) - newTraits.push(value); - } - } - return this.actor.update({ system: { personal: { traits: newTraits } } }); - } - async _onOpenConfig(ev) { - ev.preventDefault(); - const userConfig = await CharacterPrompts.openConfig(this.actor.system); - if (userConfig) { - this.actor.update({ "system.config": userConfig }); - } - } - async _onOpenCharacteristic(ev) { - ev.preventDefault(); - const name = ev.currentTarget.dataset.cfgCharacteristic; - const c = this.actor.system.characteristics[name]; - let showAll = false; - for (const [key, value] of Object.entries(this.actor.system.characteristics)) { - if (!value.show) { - showAll = true; - break; - } - } - const userConfig = await CharacterPrompts.openCharacteristic(game.i18n.localize(`MGT2.Characteristics.${name}.name`), c.show, c.showMax, showAll); - if (userConfig) { - const data = { - system: { - characteristics: {} - } - }; - data.system.characteristics[name] = { - show: userConfig.show, - showMax: userConfig.showMax - }; - if (userConfig.showAll === true) { - for (const [key, value] of Object.entries(this.actor.system.characteristics)) { - if (key !== name && !value.show) { - data.system.characteristics[key] = { show: true }; - } - } - } - this.actor.update(data); - } - } - async _onRoll(event) { - event.preventDefault(); - const rollOptions = { - rollTypeName: game.i18n.localize("MGT2.RollPrompt.Roll"), - rollObjectName: "", - characteristics: [{ _id: "", name: "" }], - characteristic: "", - skills: [], - skill: "", - fatigue: this.actor.system.states.fatigue, - encumbrance: this.actor.system.states.encumbrance, - difficulty: null, - damageFormula: null - }; - const cardButtons = []; - for (const [key, label] of Object.entries(MGT2.Characteristics)) { - const c = this.actor.system.characteristics[key]; - if (c.show) { - rollOptions.characteristics.push({ _id: key, name: game.i18n.localize(label) + MGT2Helper.getDisplayDM(c.dm) }); - } - } - for (let item of this.actor.items) { - if (item.type === "talent") { - if (item.system.subType === "skill") - rollOptions.skills.push({ _id: item._id, name: item.getRollDisplay() }); - } - } - rollOptions.skills.sort(MGT2Helper.compareByName); - rollOptions.skills = [{ _id: "NP", name: game.i18n.localize("MGT2.Items.NotProficient") }].concat(rollOptions.skills); - let itemObj = null; - let isInitiative = false; - const button = event.currentTarget; - if (button.dataset.roll === "initiative") { - rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.InitiativeRoll"); - rollOptions.characteristic = this.actor.system.config.initiative; - isInitiative = true; - } else if (button.dataset.roll === "characteristic") { - rollOptions.characteristic = button.dataset.rollCharacteristic; - rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.CharacteristicRoll"); - rollOptions.rollObjectName = game.i18n.localize(`MGT2.Characteristics.${rollOptions.characteristic}.name`); - } else { - if (button.dataset.roll === "skill") { - rollOptions.skill = button.dataset.rollSkill; - itemObj = this.actor.getEmbeddedDocument("Item", rollOptions.skill); - rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.SkillRoll"); - rollOptions.rollObjectName = itemObj.name; - } else { - if (button.dataset.roll === "psionic") { - rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.PsionicRoll"); - } - } - if (itemObj === null && button.dataset.itemId) { - itemObj = this.actor.getEmbeddedDocument("Item", button.dataset.itemId); - rollOptions.rollObjectName = itemObj.name; - if (itemObj.type === "weapon") - rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.weapon"); - else if (itemObj.type === "armor") - rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.armor"); - else if (itemObj.type === "computer") - rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.computer"); - } - if (button.dataset.roll === "psionic") { - rollOptions.rollObjectName = itemObj.name; - if (MGT2Helper.hasValue(itemObj.system.psionic, "duration")) { - cardButtons.push({ - label: game.i18n.localize("MGT2.Items.Duration"), - formula: itemObj.system.psionic.duration, - message: { - objectName: itemObj.name, - flavor: "{0} ".concat(game.i18n.localize(`MGT2.Durations.${itemObj.system.psionic.durationUnit}`)) + + if (item.hasOwnProperty("equipped")) { + i._canEquip = true; + i._toggleClass = item.equipped ? "active" : ""; + } else { + i._canEquip = false; + } + + switch (i.type) { + case "equipment": + (i.system.subType === "augment" ? augments : equipments).push(i); + break; + + case "armor": + if (i.system.options?.length > 0) + i._subInfo = i.system.options.map(x => x.name).join(", "); + armors.push(i); + break; + + case "computer": + if (i.system.options?.length > 0) + i._subInfo = i.system.options.map(x => x.name).join(", "); + break; + + case "item": + if (i.system.subType === "software") { + if (i.system.software.computerId && i.system.software.computerId !== "") { + const computer = computers.find(x => x._id === i.system.software.computerId); + if (computer !== undefined) computer._subItems.push(i); + else softwares.push(i); + } else { + i._display = i.system.software.bandwidth > 0 + ? `${i.name} (${i.system.software.bandwidth})` + : i.name; + softwares.push(i); + } + } else { + miscItems.push(i); + } + break; + + case "weapon": + i._range = i.system.range.isMelee + ? game.i18n.localize("MGT2.Melee") + : MGT2Helper.getRangeDisplay(i.system.range); + if (i.system.traits?.length > 0) + i._subInfo = i.system.traits.map(x => x.name).join(", "); + weapons.push(i); + break; + + case "career": + careers.push(i); + break; + + case "contact": + contacts.push(i); + break; + + case "disease": + (i.system.subType === "wound" ? wounds : diseases).push(i); + break; + + case "talent": + if (i.system.subType === "skill") { + skills.push(i); + } else { + if (MGT2Helper.hasValue(i.system.psionic, "reach")) + i._reach = game.i18n.localize(`MGT2.PsionicReach.${i.system.psionic.reach}`); + if (MGT2Helper.hasValue(i.system.roll, "difficulty")) + i._difficulty = game.i18n.localize(`MGT2.Difficulty.${i.system.roll.difficulty}`); + psionics.push(i); + } + break; + + case "container": + if (i.system.onHand === true) + miscItems.push(i); + break; } - }); } - } - if (itemObj.system.hasOwnProperty("damage")) { - rollOptions.damageFormula = itemObj.system.damage; - if (itemObj.type === "disease") { - if (itemObj.system.subTypetype === "disease") { - rollOptions.rollTypeName = game.i18n.localize("MGT2.DiseaseSubType.disease"); - } else if (itemObj.system.subTypetype === "poison") { - rollOptions.rollTypeName = game.i18n.localize("MGT2.DiseaseSubType.poison"); - } - } - } - if (itemObj.system.hasOwnProperty("roll")) { - if (MGT2Helper.hasValue(itemObj.system.roll, "characteristic")) { - rollOptions.characteristic = itemObj.system.roll.characteristic; - } - if (MGT2Helper.hasValue(itemObj.system.roll, "skill")) { - rollOptions.skill = itemObj.system.roll.skill; - } - if (MGT2Helper.hasValue(itemObj.system.roll, "difficulty")) { - rollOptions.difficulty = itemObj.system.roll.difficulty; - } - } - } - const userRollData = await RollPromptHelper.roll(rollOptions); - const rollModifiers = []; - const rollFormulaParts = []; - if (userRollData.diceModifier) { - rollFormulaParts.push("3d6"); - rollFormulaParts.push(userRollData.diceModifier); - } else { - rollFormulaParts.push("2d6"); - } - if (userRollData.hasOwnProperty("characteristic") && userRollData.characteristic !== "") { - let c = this.actor.system.characteristics[userRollData.characteristic]; - let dm = c.dm; - rollFormulaParts.push(MGT2Helper.getFormulaDM(dm)); - rollModifiers.push(game.i18n.localize(`MGT2.Characteristics.${userRollData.characteristic}.name`) + MGT2Helper.getDisplayDM(dm)); - } - if (userRollData.hasOwnProperty("skill") && userRollData.skill !== "") { - if (userRollData.skill === "NP") { - rollFormulaParts.push("-3"); - rollModifiers.push(game.i18n.localize("MGT2.Items.NotProficient")); - } else { - const skillObj = this.actor.getEmbeddedDocument("Item", userRollData.skill); - rollFormulaParts.push(MGT2Helper.getFormulaDM(skillObj.system.level)); - rollModifiers.push(skillObj.getRollDisplay()); - } - } - if (userRollData.hasOwnProperty("psionic") && userRollData.psionic !== "") { - let psionicObj = this.actor.getEmbeddedDocument("Item", userRollData.psionic); - rollFormulaParts.push(MGT2Helper.getFormulaDM(psionicObj.system.level)); - rollModifiers.push(psionicObj.getRollDisplay()); - } - if (userRollData.hasOwnProperty("timeframes") && userRollData.timeframes !== "" && userRollData.timeframes !== "Normal") { - rollModifiers.push(game.i18n.localize(`MGT2.Timeframes.${userRollData.timeframes}`)); - rollFormulaParts.push(userRollData.timeframes === "Slower" ? "+2" : "-2"); - } - if (userRollData.hasOwnProperty("encumbrance") && userRollData.encumbrance === true) { - rollFormulaParts.push("-2"); - rollModifiers.push(game.i18n.localize("MGT2.Actor.Encumbrance") + " -2"); - } - if (userRollData.hasOwnProperty("fatigue") && userRollData.fatigue === true) { - rollFormulaParts.push("-2"); - rollModifiers.push(game.i18n.localize("MGT2.Actor.Fatigue") + " -2"); - } - if (userRollData.hasOwnProperty("customDM") && userRollData.customDM !== "") { - let s = userRollData.customDM.trim(); - if (/^[0-9]/.test(s)) - rollFormulaParts.push("+"); - rollFormulaParts.push(s); - } - if (MGT2Helper.hasValue(userRollData, "difficulty")) { - rollOptions.difficulty = userRollData.difficulty; - } - const rollData = this.actor.getRollData(); - const rollFormula = rollFormulaParts.join(""); - if (!Roll.validate(rollFormula)) { - ui.notifications.error(game.i18n.localize("MGT2.Errors.InvalidRollFormula")); - return; - } - let roll = await new Roll(rollFormula, rollData).roll({ async: true, rollMode: userRollData.rollMode }); - if (isInitiative && this.token && this.token.combatant) { - await this.token.combatant.update({ initiative: roll.total }); - } - const chatData = { - user: game.user.id, - speaker: this.actor ? ChatMessage.getSpeaker({ actor: this.actor }) : null, - formula: roll._formula, - //flavor: isPrivate ? null : flavor, - tooltip: await roll.getTooltip(), - total: Math.round(roll.total * 100) / 100, - type: CONST.CHAT_MESSAGE_TYPES.ROLL, - showButtons: true, - showLifeButtons: false, - showRollRequest: false, - rollTypeName: rollOptions.rollTypeName, - rollObjectName: rollOptions.rollObjectName, - rollModifiers, - showRollDamage: rollOptions.damageFormula !== null && rollOptions.damageFormula !== "", - cardButtons - }; - if (MGT2Helper.hasValue(rollOptions, "difficulty")) { - chatData.rollDifficulty = rollOptions.difficulty; - chatData.rollDifficultyLabel = game.i18n.localize(`MGT2.Difficulty.${rollOptions.difficulty}`); - if (roll.total >= MGT2Helper.getDifficultyValue(rollOptions.difficulty)) { - chatData.rollSuccess = true; - } else { - chatData.rollFailure = true; - } - } - const html = await renderTemplate("systems/mgt2/templates/chat/roll.html", chatData); - chatData.content = html; - let flags = null; - if (rollOptions.damageFormula !== null && rollOptions.damageFormula !== "") { - flags = { mgt2: { damage: { formula: rollOptions.damageFormula, rollObjectName: rollOptions.rollObjectName, rollTypeName: rollOptions.rollTypeName } } }; - } - if (cardButtons.length > 0) { - if (flags === null) - flags = { mgt2: {} }; - flags.mgt2.buttons = cardButtons; - } - if (flags !== null) - chatData.flags = flags; - return roll.toMessage(chatData); - } - _onItemCreate(ev) { - ev.preventDefault(); - const html = $(ev.currentTarget); - const data = { - name: html.data("create-name"), - type: html.data("type-item") - }; - if (html.data("subtype")) { - data.system = { - subType: html.data("subtype") - }; - } - const cls = getDocumentClass("Item"); - return cls.create(data, { parent: this.actor }); - } - _onItemEquip(ev) { - ev.preventDefault(); - const html = $(ev.currentTarget).parents("[data-item-id]"); - const item = duplicate(this.actor.getEmbeddedDocument("Item", html.data("itemId"))); - item.system.equipped = !item.system.equipped; - this.actor.updateEmbeddedDocuments("Item", [item]); - } - _onItemStorageIn(ev) { - ev.preventDefault(); - const html = $(ev.currentTarget).parents("[data-item-id]"); - const item = duplicate(this.actor.getEmbeddedDocument("Item", html.data("itemId"))); - if (item.type === "container") { - item.system.onHand = false; - } else { - let container; - const containers = this.actor.getContainers(); - if (this.actor.system.containerDropIn == "" || this.actor.system.containerDropIn === null) { - if (containers.length === 0) { - const cls = getDocumentClass("Item"); - container = cls.create({ name: game.i18n.localize("MGT2.Actor.NewContainer"), type: "container" }, { parent: this.actor }); + + const byName = MGT2Helper.compareByName; + const byEquipName = (a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()); + + context.encumbranceNormal = MGT2Helper.convertWeightForDisplay(actor.system.inventory.encumbrance.normal); + context.encumbranceHeavy = MGT2Helper.convertWeightForDisplay(actor.system.inventory.encumbrance.heavy); + + const totalWeight = actor.system.inventory.weight; + if (totalWeight > actor.system.inventory.encumbrance.heavy) { + context.encumbranceClasses = "encumbrance-heavy"; + context.encumbrance = 2; + } else if (totalWeight > actor.system.inventory.encumbrance.normal) { + context.encumbranceClasses = "encumbrance-normal"; + context.encumbrance = 1; } else { - container = containers[0]; + context.encumbrance = 0; } - } else { - container = containers.find((x) => x._id == this.actor.system.containerDropIn); - } - if (container.system.locked) { - if (game.user.isGM) { - item.system.container.id = container._id; - } else { - ui.notifications.error("Objet verrouill\xE9"); + + if (softwares.length > 0) { softwares.sort(byName); context.softwares = softwares; } + augments.sort(byEquipName); context.augments = augments; + armors.sort(byEquipName); context.armors = armors; + computers.sort(byEquipName); context.computers = computers; + context.careers = careers; + contacts.sort(byName); context.contacts = contacts; + containers.sort(byName); context.containers = containers; + diseases.sort(byName); context.diseases = diseases; + context.wounds = wounds; + equipments.sort(byEquipName); context.equipments = equipments; + miscItems.sort(byEquipName); context.items = miscItems; + actorContainers.sort(byName); context.actorContainers = actorContainers; + skills.sort(byName); context.skills = skills; + psionics.sort(byName); context.psionics = psionics; + weapons.sort(byEquipName); context.weapons = weapons; + + if (containerItems.length > 0) { + containerItems.sort((a, b) => { + const r = a._containerName.localeCompare(b._containerName); + return r !== 0 ? r : a.name.toLowerCase().localeCompare(b.name.toLowerCase()); + }); } - } else { - item.system.container.id = container._id; - } + context.containerItems = containerItems; } - this.actor.updateEmbeddedDocuments("Item", [item]); - } - _onItemStorageOut(ev) { - ev.preventDefault(); - const html = $(ev.currentTarget).parents("[data-item-id]"); - const item = duplicate(this.actor.getEmbeddedDocument("Item", html.data("itemId"))); - item.system.container.id = ""; - this.actor.updateEmbeddedDocuments("Item", [item]); - } - _onSoftwareEject(ev) { - ev.preventDefault(); - const html = $(ev.currentTarget).parents("[data-item-id]"); - const item = duplicate(this.actor.getEmbeddedDocument("Item", html.data("itemId"))); - item.system.software.computerId = ""; - this.actor.updateEmbeddedDocuments("Item", [item]); - } - _onContainerCreate(ev) { - ev.preventDefault(); - const cls = getDocumentClass("Item"); - return cls.create({ name: game.i18n.localize("MGT2.Actor.NewContainer"), type: "container" }, { parent: this.actor }); - } - _canDragDrop(selector) { - return this.isEditable; - } - async _onDrop(event) { - event.preventDefault(); - event.stopImmediatePropagation(); - const dropData = MGT2Helper.getDataFromDropEvent(event); - if (!dropData) - return false; - const sourceItemData = await MGT2Helper.getItemDataFromDropData(dropData); - if (sourceItemData.type === "species") { - const update = { - system: { - personal: { - species: sourceItemData.name, - speciesText: { - description: sourceItemData.system.description, - descriptionLong: sourceItemData.system.descriptionLong + + // ========================================================= + // Event Binding (AppV2 _onRender — replaces jQuery activateListeners) + // Templates still use CSS class selectors, so we bind manually here. + // ========================================================= + + /** @override */ + _onRender(context, options) { + super._onRender(context, options); + const html = this.element; + if (!this.isEditable) return; + + this._bindClassEvent(html, ".roll", "click", TravellerCharacterSheet.#onRoll); + this._bindClassEvent(html, ".cfg-characteristic", "click", TravellerCharacterSheet.#onOpenCharacteristic); + this._bindClassEvent(html, ".item-create", "click", TravellerCharacterSheet.#onCreateItem); + this._bindClassEvent(html, ".item-edit", "click", TravellerCharacterSheet.#onEditItem); + this._bindClassEvent(html, ".item-delete", "click", TravellerCharacterSheet.#onDeleteItem); + this._bindClassEvent(html, ".item-equip", "click", TravellerCharacterSheet.#onEquipItem); + this._bindClassEvent(html, ".item-storage-in", "click", TravellerCharacterSheet.#onItemStorageIn); + this._bindClassEvent(html, ".item-storage-out", "click", TravellerCharacterSheet.#onItemStorageOut); + this._bindClassEvent(html, ".software-eject", "click", TravellerCharacterSheet.#onSoftwareEject); + this._bindClassEvent(html, ".container-create", "click", TravellerCharacterSheet.#onContainerCreate); + this._bindClassEvent(html, ".container-edit", "click", TravellerCharacterSheet.#onContainerEdit); + this._bindClassEvent(html, ".container-delete", "click", TravellerCharacterSheet.#onContainerDelete); + this._bindClassEvent(html, ".traits-create", "click", TravellerCharacterSheet.#onTraitCreate); + this._bindClassEvent(html, ".traits-edit", "click", TravellerCharacterSheet.#onTraitEdit); + this._bindClassEvent(html, ".traits-delete", "click", TravellerCharacterSheet.#onTraitDelete); + this._bindClassEvent(html, "[data-editor='open']", "click", TravellerCharacterSheet.#onOpenEditor); + html.querySelector("[name='config']")?.addEventListener("click", (ev) => TravellerCharacterSheet.#onOpenConfig.call(this, ev, ev.currentTarget)); + } + + /** Helper: bind a handler to all matching elements, with `this` set to the sheet instance */ + _bindClassEvent(html, selector, event, handler) { + for (const el of html.querySelectorAll(selector)) { + el.addEventListener(event, (ev) => handler.call(this, ev, ev.currentTarget)); + } + } + + // ========================================================= + // Drag & Drop + // ========================================================= + + /** @override */ + async _onDrop(event) { + event.preventDefault(); + event.stopImmediatePropagation(); + const dropData = MGT2Helper.getDataFromDropEvent(event); + if (!dropData) return false; + + const sourceItemData = await MGT2Helper.getItemDataFromDropData(dropData); + + if (sourceItemData.type === "species") { + const update = { + system: { + personal: { + species: sourceItemData.name, + speciesText: { + description: sourceItemData.system.description, + descriptionLong: sourceItemData.system.descriptionLong, + }, + }, + }, + }; + update.system.personal.traits = this.actor.system.personal.traits.concat(sourceItemData.system.traits); + + if (sourceItemData.system.modifiers?.length > 0) { + update.system.characteristics = {}; + for (let modifier of sourceItemData.system.modifiers) { + if (MGT2Helper.hasValue(modifier, "characteristic") && MGT2Helper.hasValue(modifier, "value")) { + const c = this.actor.system.characteristics[modifier.characteristic]; + const updateValue = { value: c.value + modifier.value }; + if (c.showMax) updateValue.max = c.max + modifier.value; + update.system.characteristics[modifier.characteristic] = updateValue; + } + } } - } + + this.actor.update(update); + return true; } - }; - update.system.personal.traits = this.actor.system.personal.traits.concat(sourceItemData.system.traits); - if (sourceItemData.system.modifiers && sourceItemData.system.modifiers.length > 0) { - update.system.characteristics = {}; - for (let modifier of sourceItemData.system.modifiers) { - if (MGT2Helper.hasValue(modifier, "characteristic") && MGT2Helper.hasValue(modifier, "value")) { - const c = this.actor.system.characteristics[modifier.characteristic]; - const updateValue = { value: c.value }; - updateValue.value += modifier.value; - if (c.showMax) { - updateValue.max = c.max + modifier.value; + + if (["contact", "disease", "career", "talent"].includes(sourceItemData.type)) { + let transferData = {}; + try { transferData = sourceItemData.toJSON(); } catch (e) { transferData = sourceItemData; } + delete transferData._id; + delete transferData.id; + await this.actor.createEmbeddedDocuments("Item", [transferData]); + return true; + } + + if (!["armor", "weapon", "computer", "container", "item", "equipment"].includes(sourceItemData.type)) return false; + + const target = event.target.closest(".table-row"); + let targetId = null; + let targetItem = null; + if (target !== null) { + targetId = target.dataset.itemId; + targetItem = this.actor.getEmbeddedDocument("Item", targetId); + } + + let sourceItem = this.actor.getEmbeddedDocument("Item", sourceItemData.id); + if (sourceItem) { + if (!targetItem) return false; + sourceItem = foundry.utils.deepClone(sourceItem); + if (sourceItem._id === targetId) return false; + + if (targetItem.type === "item" || targetItem.type === "equipment") { + if (targetItem.system.subType === "software") + sourceItem.system.software.computerId = targetItem.system.software.computerId; + else + sourceItem.system.container.id = targetItem.system.container.id; + this.actor.updateEmbeddedDocuments("Item", [sourceItem]); + return true; + } else if (targetItem.type === "computer") { + sourceItem.system.software.computerId = targetId; + this.actor.updateEmbeddedDocuments("Item", [sourceItem]); + return true; + } else if (targetItem.type === "container") { + if (targetItem.system.locked && !game.user.isGM) { + ui.notifications.error("Verrouillé"); + } else { + sourceItem.system.container.id = targetId; + this.actor.updateEmbeddedDocuments("Item", [sourceItem]); + return true; + } } - update.system.characteristics[modifier.characteristic] = updateValue; - } - } - } - this.actor.update(update); - return true; - } - if (sourceItemData.type === "contact" || sourceItemData.type === "disease" || sourceItemData.type === "career" || sourceItemData.type === "talent") { - let transferData = {}; - try { - transferData = sourceItemData.toJSON(); - } catch (err) { - transferData = sourceItemData; - } - delete transferData._id; - delete transferData.id; - await this.actor.createEmbeddedDocuments("Item", [transferData]); - return true; - } - if (sourceItemData.type !== "armor" && sourceItemData.type !== "weapon" && sourceItemData.type !== "computer" && sourceItemData.type !== "container" && sourceItemData.type !== "item" && sourceItemData.type !== "equipment") - return false; - const target = event.target.closest(".table-row"); - let targetId = null; - let targetItem = null; - if (target !== null && target !== void 0) { - targetId = target.dataset.itemId; - targetItem = this.actor.getEmbeddedDocument("Item", targetId); - } - let sourceItem = this.actor.getEmbeddedDocument("Item", sourceItemData.id); - if (sourceItem) { - if (targetItem === null || targetItem === void 0) - return false; - sourceItem = duplicate(sourceItem); - if (sourceItem._id === targetId) - return false; - if (targetItem.type === "item" || targetItem.type === "equipment") { - if (targetItem.system.subType === "software") { - sourceItem.system.software.computerId = targetItem.system.software.computerId; } else { - sourceItem.system.container.id = targetItem.system.container.id; + let transferData = {}; + try { transferData = sourceItemData.toJSON(); } catch (e) { transferData = sourceItemData; } + delete transferData._id; + delete transferData.id; + + const recalcWeight = transferData.system.hasOwnProperty("weight"); + + if (transferData.system.hasOwnProperty("container")) transferData.system.container.id = ""; + if (transferData.type === "item" && transferData.system.subType === "software") transferData.system.software.computerId = ""; + if (transferData.type === "container") transferData.system.onHand = true; + if (transferData.system.hasOwnProperty("equipment")) transferData.system.equipped = false; + + if (targetItem !== null) { + if (transferData.type === "item" && transferData.system.subType === "software") { + if (targetItem.type === "item" && targetItem.system.subType === "software") + transferData.system.software.computerId = targetItem.system.software.computerId; + else if (targetItem.type === "computer") + transferData.system.software.computerId = targetItem._id; + } else if (["armor", "computer", "equipment", "item", "weapon"].includes(transferData.type)) { + if (targetItem.type === "container") { + if (!targetItem.system.locked || game.user.isGM) + transferData.system.container.id = targetId; + } else { + transferData.system.container.id = targetItem.system.container.id; + } + } + } + + await this.actor.createEmbeddedDocuments("Item", [transferData]); + if (recalcWeight) await this.actor.recalculateWeight(); } - this.actor.updateEmbeddedDocuments("Item", [sourceItem]); return true; - } else if (targetItem.type === "computer") { - sourceItem.system.software.computerId = targetId; - this.actor.updateEmbeddedDocuments("Item", [sourceItem]); - return true; - } else if (targetItem.type === "container") { - if (targetItem.system.locked && !game.user.isGM) - ui.notifications.error("Verrouill\xE9"); - else { - sourceItem.system.container.id = targetId; - this.actor.updateEmbeddedDocuments("Item", [sourceItem]); - return true; + } + + // ========================================================= + // Actions (static private methods) + // ========================================================= + + static async #onCreateItem(event, target) { + event.preventDefault(); + const data = { + name: target.dataset.createName, + type: target.dataset.typeItem, + }; + if (target.dataset.subtype) { + data.system = { subType: target.dataset.subtype }; } - } - } else { - let transferData = {}; - try { - transferData = sourceItemData.toJSON(); - } catch (err) { - transferData = sourceItemData; - } - delete transferData._id; - delete transferData.id; - const recalcWeight = transferData.system.hasOwnProperty("weight"); - if (transferData.system.hasOwnProperty("container")) - transferData.system.container.id = ""; - if (transferData.type === "item" && transferData.system.subType === "software") - transferData.system.software.computerId = ""; - if (transferData.type === "container") - transferData.onHand = true; - if (transferData.system.hasOwnProperty("equipment")) - transferData.system.equipped = false; - if (targetItem !== null) { - if (transferData.type === "item" && transferData.system.subType === "software") { - if (targetItem.type === "item" && targetItem.system.subType === "software") { - transferData.system.software.computerId = targetItem.system.software.computerId; - } else if (targetItem.type === "computer") { - transferData.system.software.computerId = targetItem._id; - } - } else if (transferData.type === "armor" || transferData.type === "computer" || transferData.type === "equipment" || transferData.type === "item" || transferData.type === "weapon") { - if (targetItem.type === "container") { - if (!targetItem.system.locked || game.user.isGM) { - transferData.system.container.id = targetId; + const cls = getDocumentClass("Item"); + return cls.create(data, { parent: this.actor }); + } + + static async #onEditItem(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = this.actor.getEmbeddedDocument("Item", li?.dataset.itemId); + if (item) item.sheet.render(true); + } + + static async #onDeleteItem(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + if (!li?.dataset.itemId) return; + this.actor.deleteEmbeddedDocuments("Item", [li.dataset.itemId]); + } + + static async #onEquipItem(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument("Item", li?.dataset.itemId)); + if (!item) return; + item.system.equipped = !item.system.equipped; + this.actor.updateEmbeddedDocuments("Item", [item]); + } + + static async #onItemStorageIn(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument("Item", li?.dataset.itemId)); + if (!item) return; + + if (item.type === "container") { + item.system.onHand = false; + } else { + const containers = this.actor.getContainers(); + let container; + const dropInId = this.actor.system.containerDropIn; + + if (!dropInId) { + container = containers.length === 0 + ? await getDocumentClass("Item").create({ name: "New container", type: "container" }, { parent: this.actor }) + : containers[0]; + } else { + container = containers.find(x => x._id === dropInId); } - } else { - if (MGT2Helper.hasValue(targetItem.system.container, "id")) - transferData.system.container.id = targetItem.system.container.id; + + if (container?.system.locked && !game.user.isGM) { + ui.notifications.error("Objet verrouillé"); + return; + } + item.system.container.id = container._id; + } + this.actor.updateEmbeddedDocuments("Item", [item]); + } + + static async #onItemStorageOut(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument("Item", li?.dataset.itemId)); + if (!item) return; + item.system.container.id = ""; + this.actor.updateEmbeddedDocuments("Item", [item]); + } + + static async #onSoftwareEject(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument("Item", li?.dataset.itemId)); + if (!item) return; + item.system.software.computerId = ""; + this.actor.updateEmbeddedDocuments("Item", [item]); + } + + static async #onContainerCreate(event) { + event.preventDefault(); + const cls = getDocumentClass("Item"); + return cls.create({ name: "New container", type: "container" }, { parent: this.actor }); + } + + static async #onContainerEdit(event) { + event.preventDefault(); + const container = this.actor.getEmbeddedDocument("Item", this.actor.system.containerView); + if (container) container.sheet.render(true); + } + + static async #onContainerDelete(event) { + event.preventDefault(); + const containers = this.actor.getContainers(); + const container = containers.find(x => x._id === this.actor.system.containerView); + if (!container) return; + + const containerItems = this.actor.items.filter( + x => x.system.hasOwnProperty("container") && x.system.container.id === container._id + ); + + if (containerItems.length > 0) { + for (let item of containerItems) { + let clone = foundry.utils.deepClone(item); + clone.system.container.id = ""; + this.actor.updateEmbeddedDocuments("Item", [clone]); + } + } + + const cloneActor = foundry.utils.deepClone(this.actor); + cloneActor.system.containerView = ""; + if (cloneActor.system.containerDropIn === container._id) { + cloneActor.system.containerDropIn = ""; + const remaining = containers.filter(x => x._id !== container._id); + if (remaining.length > 0) cloneActor.system.containerDropIn = remaining[0]._id; + } + + this.actor.deleteEmbeddedDocuments("Item", [container._id]); + this.actor.update(cloneActor); + } + + static async #onRoll(event, target) { + event.preventDefault(); + + const rollOptions = { + rollTypeName: game.i18n.localize("MGT2.RollPrompt.Roll"), + rollObjectName: "", + characteristics: [{ _id: "", name: "" }], + characteristic: "", + skills: [], + skill: "", + fatigue: this.actor.system.states.fatigue, + encumbrance: this.actor.system.states.encumbrance, + difficulty: null, + damageFormula: null, + }; + + const cardButtons = []; + for (const [key, label] of Object.entries(MGT2.Characteristics)) { + const c = this.actor.system.characteristics[key]; + if (c.show) { + rollOptions.characteristics.push({ + _id: key, + name: game.i18n.localize(label) + MGT2Helper.getDisplayDM(c.dm), + }); + } + } + + for (let item of this.actor.items) { + if (item.type === "talent" && item.system.subType === "skill") + rollOptions.skills.push({ _id: item._id, name: item.getRollDisplay() }); + } + + rollOptions.skills.sort(MGT2Helper.compareByName); + rollOptions.skills = [{ _id: "NP", name: game.i18n.localize("MGT2.Items.NotProficient") }].concat(rollOptions.skills); + + let itemObj = null; + let isInitiative = false; + const rollType = target.dataset.roll; + + if (rollType === "initiative") { + rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.InitiativeRoll"); + rollOptions.characteristic = this.actor.system.config.initiative; + isInitiative = true; + } else if (rollType === "characteristic") { + rollOptions.characteristic = target.dataset.rollCharacteristic; + rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.CharacteristicRoll"); + rollOptions.rollObjectName = game.i18n.localize(`MGT2.Characteristics.${rollOptions.characteristic}.name`); + } else { + if (rollType === "skill") { + rollOptions.skill = target.dataset.rollSkill; + itemObj = this.actor.getEmbeddedDocument("Item", rollOptions.skill); + rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.SkillRoll"); + rollOptions.rollObjectName = itemObj.name; + } else if (rollType === "psionic") { + rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.PsionicRoll"); + } + + if (itemObj === null && target.dataset.itemId) { + itemObj = this.actor.getEmbeddedDocument("Item", target.dataset.itemId); + rollOptions.rollObjectName = itemObj.name; + if (itemObj.type === "weapon") rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.weapon"); + else if (itemObj.type === "armor") rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.armor"); + else if (itemObj.type === "computer") rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.computer"); + } + + if (rollType === "psionic" && itemObj) { + rollOptions.rollObjectName = itemObj.name; + if (MGT2Helper.hasValue(itemObj.system.psionic, "duration")) { + cardButtons.push({ + label: game.i18n.localize("MGT2.Items.Duration"), + formula: itemObj.system.psionic.duration, + message: { + objectName: itemObj.name, + flavor: "{0} ".concat(game.i18n.localize(`MGT2.Durations.${itemObj.system.psionic.durationUnit}`)), + }, + }); + } + } + + if (itemObj?.system.hasOwnProperty("damage")) { + rollOptions.damageFormula = itemObj.system.damage; + if (itemObj.type === "disease") { + if (itemObj.system.subType === "disease") + rollOptions.rollTypeName = game.i18n.localize("MGT2.DiseaseSubType.disease"); + else if (itemObj.system.subType === "poison") + rollOptions.rollTypeName = game.i18n.localize("MGT2.DiseaseSubType.poison"); + } + } + + if (itemObj?.system.hasOwnProperty("roll")) { + if (MGT2Helper.hasValue(itemObj.system.roll, "characteristic")) rollOptions.characteristic = itemObj.system.roll.characteristic; + if (MGT2Helper.hasValue(itemObj.system.roll, "skill")) rollOptions.skill = itemObj.system.roll.skill; + if (MGT2Helper.hasValue(itemObj.system.roll, "difficulty")) rollOptions.difficulty = itemObj.system.roll.difficulty; + } + } + + const userRollData = await RollPromptHelper.roll(rollOptions); + + const rollModifiers = []; + const rollFormulaParts = []; + + if (userRollData.diceModifier) { + rollFormulaParts.push("3d6", userRollData.diceModifier); + } else { + rollFormulaParts.push("2d6"); + } + + if (userRollData.characteristic) { + const c = this.actor.system.characteristics[userRollData.characteristic]; + rollFormulaParts.push(MGT2Helper.getFormulaDM(c.dm)); + rollModifiers.push(game.i18n.localize(`MGT2.Characteristics.${userRollData.characteristic}.name`) + MGT2Helper.getDisplayDM(c.dm)); + } + + if (userRollData.skill) { + if (userRollData.skill === "NP") { + rollFormulaParts.push("-3"); + rollModifiers.push(game.i18n.localize("MGT2.Items.NotProficient")); + } else { + const skillObj = this.actor.getEmbeddedDocument("Item", userRollData.skill); + rollFormulaParts.push(MGT2Helper.getFormulaDM(skillObj.system.level)); + rollModifiers.push(skillObj.getRollDisplay()); + } + } + + if (userRollData.psionic) { + const psionicObj = this.actor.getEmbeddedDocument("Item", userRollData.psionic); + rollFormulaParts.push(MGT2Helper.getFormulaDM(psionicObj.system.level)); + rollModifiers.push(psionicObj.getRollDisplay()); + } + + if (userRollData.timeframes && userRollData.timeframes !== "" && userRollData.timeframes !== "Normal") { + rollModifiers.push(game.i18n.localize(`MGT2.Timeframes.${userRollData.timeframes}`)); + rollFormulaParts.push(userRollData.timeframes === "Slower" ? "+2" : "-2"); + } + + if (userRollData.encumbrance === true) { + rollFormulaParts.push("-2"); + rollModifiers.push(game.i18n.localize("MGT2.Actor.Encumbrance") + " -2"); + } + + if (userRollData.fatigue === true) { + rollFormulaParts.push("-2"); + rollModifiers.push(game.i18n.localize("MGT2.Actor.Fatigue") + " -2"); + } + + if (userRollData.customDM) { + const s = userRollData.customDM.trim(); + if (/^[0-9]/.test(s)) rollFormulaParts.push("+"); + rollFormulaParts.push(s); + } + + if (MGT2Helper.hasValue(userRollData, "difficulty")) rollOptions.difficulty = userRollData.difficulty; + + const rollFormula = rollFormulaParts.join(""); + if (!Roll.validate(rollFormula)) { + ui.notifications.error(game.i18n.localize("MGT2.Errors.InvalidRollFormula")); + return; + } + + let roll = await new Roll(rollFormula, this.actor.getRollData()).roll({ async: true, rollMode: userRollData.rollMode }); + + if (isInitiative && this.token?.combatant) { + await this.token.combatant.update({ initiative: roll.total }); + } + + const chatData = { + user: game.user.id, + speaker: this.actor ? ChatMessage.getSpeaker({ actor: this.actor }) : null, + formula: roll._formula, + tooltip: await roll.getTooltip(), + total: Math.round(roll.total * 100) / 100, + type: CONST.CHAT_MESSAGE_TYPES.ROLL, + showButtons: true, + showLifeButtons: false, + showRollRequest: false, + rollTypeName: rollOptions.rollTypeName, + rollObjectName: rollOptions.rollObjectName, + rollModifiers: rollModifiers, + showRollDamage: rollOptions.damageFormula !== null && rollOptions.damageFormula !== "", + cardButtons: cardButtons, + }; + + if (MGT2Helper.hasValue(rollOptions, "difficulty")) { + chatData.rollDifficulty = rollOptions.difficulty; + chatData.rollDifficultyLabel = MGT2Helper.getDifficultyDisplay(rollOptions.difficulty); + if (roll.total >= MGT2Helper.getDifficultyValue(rollOptions.difficulty)) + chatData.rollSuccess = true; else - transferData.system.container.id = ""; - } + chatData.rollFailure = true; } - } - (await this.actor.createEmbeddedDocuments("Item", [transferData]))[0]; - if (transferData.actor) ; - if (recalcWeight) { - await this.actor.recalculateWeight(this.actor); - } + + const html = await renderTemplate("systems/mgt2/templates/chat/roll.html", chatData); + chatData.content = html; + + let flags = null; + if (rollOptions.damageFormula) { + flags = { mgt2: { damage: { formula: rollOptions.damageFormula, rollObjectName: rollOptions.rollObjectName, rollTypeName: rollOptions.rollTypeName } } }; + } + if (cardButtons.length > 0) { + if (!flags) flags = { mgt2: {} }; + flags.mgt2.buttons = cardButtons; + } + if (flags) chatData.flags = flags; + + return roll.toMessage(chatData); + } + + static async #onOpenConfig(event) { + event.preventDefault(); + const userConfig = await CharacterPrompts.openConfig(this.actor.system); + if (userConfig) this.actor.update({ "system.config": userConfig }); + } + + static async #onOpenCharacteristic(event, target) { + event.preventDefault(); + const name = target.dataset.cfgCharacteristic; + const c = this.actor.system.characteristics[name]; + + let showAll = false; + for (const value of Object.values(this.actor.system.characteristics)) { + if (!value.show) { showAll = true; break; } + } + + const userConfig = await CharacterPrompts.openCharacteristic( + game.i18n.localize(`MGT2.Characteristics.${name}.name`), + c.show, c.showMax, showAll + ); + + if (userConfig) { + const data = { system: { characteristics: {} } }; + data.system.characteristics[name] = { show: userConfig.show, showMax: userConfig.showMax }; + + if (userConfig.showAll === true) { + for (const [key, value] of Object.entries(this.actor.system.characteristics)) { + if (key !== name && !value.show) + data.system.characteristics[key] = { show: true }; + } + } + this.actor.update(data); + } + } + + static async #onTraitCreate(event) { + event.preventDefault(); + let traits = this.actor.system.personal.traits; + let newTraits; + if (traits.length === 0) { + newTraits = [{ name: "", description: "" }]; + } else { + newTraits = [...traits, { name: "", description: "" }]; + } + return this.actor.update({ system: { personal: { traits: newTraits } } }); + } + + static async #onTraitEdit(event, target) { + event.preventDefault(); + const element = target.closest("[data-traits-part]"); + const index = Number(element.dataset.traitsPart); + const trait = this.actor.system.personal.traits[index]; + const result = await CharacterPrompts.openTraitEdit(trait); + const traits = [...this.actor.system.personal.traits]; + traits[index] = { ...traits[index], name: result.name, description: result.description }; + return this.actor.update({ system: { personal: { traits: traits } } }); + } + + static async #onTraitDelete(event, target) { + event.preventDefault(); + const element = target.closest("[data-traits-part]"); + const index = Number(element.dataset.traitsPart); + const traits = foundry.utils.deepClone(this.actor.system.personal.traits); + const newTraits = Object.entries(traits) + .filter(([key]) => Number(key) !== index) + .map(([, value]) => value); + return this.actor.update({ system: { personal: { traits: newTraits } } }); + } + + static async #onOpenEditor(event) { + event.preventDefault(); + await CharacterPrompts.openEditorFullView( + this.actor.system.personal.species, + this.actor.system.personal.speciesText.descriptionLong + ); } - return true; - } - _getSubmitData(updateData = {}) { - const formData = foundry.utils.expandObject(super._getSubmitData(updateData)); - return foundry.utils.flattenObject(formData); - } } +class TravellerVehiculeSheet extends MGT2ActorSheet { + + /** @override */ + static DEFAULT_OPTIONS = { + ...super.DEFAULT_OPTIONS, + classes: [...super.DEFAULT_OPTIONS.classes, "vehicule", "nopad"], + window: { + ...super.DEFAULT_OPTIONS.window, + title: "TYPES.Actor.vehicule", + }, + } + + /** @override */ + static PARTS = { + sheet: { + template: "systems/mgt2/templates/actors/vehicule-sheet.html", + }, + } + + /** @override */ + tabGroups = { primary: "stats" } +} + +const { HandlebarsApplicationMixin } = foundry.applications.api; + +class TravellerItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) { + + /** @override */ + static DEFAULT_OPTIONS = { + classes: ["mgt2", "sheet", "item"], + position: { width: 630 }, + form: { + submitOnChange: true, + closeOnSubmit: false, + }, + window: { resizable: true }, + actions: { + careerEventCreate: TravellerItemSheet.#onCareerEventCreate, + careerEventDelete: TravellerItemSheet.#onCareerEventDelete, + optionCreate: TravellerItemSheet.#onOptionCreate, + optionDelete: TravellerItemSheet.#onOptionDelete, + modifierCreate: TravellerItemSheet.#onModifierCreate, + modifierDelete: TravellerItemSheet.#onModifierDelete, + }, + } + + /** @override */ + static PARTS = { + sheet: { + // template is dynamic — resolved in _prepareContext / _renderHTML + template: "", + }, + } + + /** Resolve template dynamically based on item type */ + get template() { + return `systems/mgt2/templates/items/${this.document.type}-sheet.html`; + } + + tabGroups = { primary: "tab1" } + + /** @override */ + async _prepareContext() { + const item = this.document; + const source = item.toObject(); + + const settings = { + usePronouns: game.settings.get("mgt2", "usePronouns"), + }; + + let containers = null; + let computers = null; + let hadContainer = false; + + if (item.actor !== null) { + hadContainer = true; + containers = [{ name: "", _id: "" }].concat(item.actor.getContainers()); + computers = [{ name: "", _id: "" }].concat(item.actor.getComputers()); + } + + let weight = null; + if (item.system.hasOwnProperty("weight")) { + weight = MGT2Helper.convertWeightForDisplay(item.system.weight); + } + + let skills = []; + if (this.actor !== null) { + for (let actorItem of this.actor.items) { + if (actorItem.type === "talent" && actorItem.system.subType === "skill") + skills.push({ _id: actorItem._id, name: actorItem.getRollDisplay() }); + } + } + skills.sort(MGT2Helper.compareByName); + skills = [{ _id: "NP", name: game.i18n.localize("MGT2.Items.NotProficient") }].concat(skills); + + return { + item: item, + document: item, + cssClass: this.isEditable ? "editable" : "locked", + system: item.system, + source: source.system, + fields: item.schema.fields, + systemFields: item.system.schema.fields, + isEditable: this.isEditable, + isGM: game.user.isGM, + config: CONFIG, + settings: settings, + containers: containers, + computers: computers, + hadContainer: hadContainer, + weight: weight, + unitlabels: { weight: MGT2Helper.getWeightLabel() }, + skills: skills, + }; + } + + /** @override — resolve the per-type template before rendering */ + async _renderHTML(context, options) { + const templatePath = `systems/mgt2/templates/items/${this.document.type}-sheet.html`; + const html = await renderTemplate(templatePath, context); + return { sheet: html }; + } + + /** @override — put rendered HTML into the window content */ + _replaceHTML(result, content, options) { + content.innerHTML = result.sheet; + this._activateTabGroups(); + this._bindItemEvents(); + } + + /** Bind CSS class-based events (templates not yet migrated to data-action) */ + _bindItemEvents() { + const html = this.element; + if (!this.isEditable) return; + const bind = (sel, handler) => { + for (const el of html.querySelectorAll(sel)) { + el.addEventListener("click", (ev) => handler.call(this, ev, ev.currentTarget)); + } + }; + bind(".event-create", TravellerItemSheet.#onCareerEventCreate); + bind(".event-delete", TravellerItemSheet.#onCareerEventDelete); + bind(".options-create", TravellerItemSheet.#onOptionCreate); + bind(".options-delete", TravellerItemSheet.#onOptionDelete); + bind(".modifiers-create", TravellerItemSheet.#onModifierCreate); + bind(".modifiers-delete", TravellerItemSheet.#onModifierDelete); + } + + _activateTabGroups() { + for (const [group, activeTab] of Object.entries(this.tabGroups)) { + const nav = this.element.querySelector(`nav[data-group="${group}"], .horizontal-tabs`); + if (!nav) continue; + + nav.querySelectorAll('[data-tab]').forEach(link => { + link.classList.toggle('active', link.dataset.tab === activeTab); + link.addEventListener('click', event => { + event.preventDefault(); + this.tabGroups[group] = link.dataset.tab; + this.render(); + }); + }); + + this.element.querySelectorAll(`.itemsheet-panel [data-tab], [data-group="${group}"][data-tab]`).forEach(content => { + content.classList.toggle('active', content.dataset.tab === activeTab); + }); + } + } + + /** @override — process form data before submit (weight/qty/cost conversions + container logic) */ + _prepareSubmitData(event, form, formData) { + const data = foundry.utils.expandObject(formData.object); + + if (data.hasOwnProperty("weight")) { + data.system = data.system || {}; + data.system.weight = MGT2Helper.convertWeightFromInput(data.weight); + delete data.weight; + } + + if (data.system?.hasOwnProperty("quantity")) { + data.system.quantity = MGT2Helper.getIntegerFromInput(data.system.quantity); + } + + if (data.system?.hasOwnProperty("cost")) { + data.system.cost = MGT2Helper.getIntegerFromInput(data.system.cost); + } + + // Container/equipped logic + if (data.system?.hasOwnProperty("container") && this.document.system.hasOwnProperty("equipped")) { + const equippedChange = this.document.system.equipped !== data.system.equipped; + const containerChange = this.document.system.container?.id !== data.system.container?.id; + + if (equippedChange && data.system.equipped === true) { + data.system.container = { id: "" }; + } else if (containerChange && data.system.container?.id !== "" && this.document.system.container?.id === "") { + data.system.equipped = false; + } + } + + return foundry.utils.flattenObject(data); + } + + // ========================================================= + // Actions + // ========================================================= + + static async #onCareerEventCreate(event) { + event.preventDefault(); + const events = this.document.system.events; + let newEvents; + if (!events || events.length === 0) { + newEvents = [{ age: "", description: "" }]; + } else { + newEvents = [...events, { age: "", description: "" }]; + } + return this.document.update({ system: { events: newEvents } }); + } + + static async #onCareerEventDelete(event, target) { + event.preventDefault(); + const element = target.closest("[data-events-part]"); + const index = Number(element.dataset.eventsPart); + const events = foundry.utils.deepClone(this.document.system.events); + const newEvents = Object.entries(events) + .filter(([key]) => Number(key) !== index) + .map(([, val]) => val); + return this.document.update({ system: { events: newEvents } }); + } + + static async #onOptionCreate(event, target) { + event.preventDefault(); + const property = target.dataset.property; + const options = this.document.system[property]; + let newOptions; + if (!options || options.length === 0) { + newOptions = [{ name: "", description: "" }]; + } else { + newOptions = [...options, { name: "", description: "" }]; + } + return this.document.update({ [`system.${property}`]: newOptions }); + } + + static async #onOptionDelete(event, target) { + event.preventDefault(); + const element = target.closest("[data-options-part]"); + const property = element.dataset.property; + const index = Number(element.dataset.optionsPart); + const options = foundry.utils.deepClone(this.document.system[property]); + const newOptions = Object.entries(options) + .filter(([key]) => Number(key) !== index) + .map(([, val]) => val); + return this.document.update({ [`system.${property}`]: newOptions }); + } + + static async #onModifierCreate(event) { + event.preventDefault(); + const modifiers = this.document.system.modifiers; + let newModifiers; + if (!modifiers || modifiers.length === 0) { + newModifiers = [{ characteristic: "Endurance", value: null }]; + } else { + newModifiers = [...modifiers, { characteristic: "Endurance", value: null }]; + } + return this.document.update({ system: { modifiers: newModifiers } }); + } + + static async #onModifierDelete(event, target) { + event.preventDefault(); + const element = target.closest("[data-modifiers-part]"); + const index = Number(element.dataset.modifiersPart); + const modifiers = foundry.utils.deepClone(this.document.system.modifiers); + const newModifiers = Object.entries(modifiers) + .filter(([key]) => Number(key) !== index) + .map(([, val]) => val); + return this.document.update({ system: { modifiers: newModifiers } }); + } +} + +/** + * Define a set of template paths to pre-load + * Pre-loaded templates are compiled and cached for fast access when rendering + * @return {Promise} + */ const preloadHandlebarsTemplates = async function() { - const templatePaths = [ - "systems/mgt2/templates/items/parts/sheet-configuration.html", - "systems/mgt2/templates/items/parts/sheet-physical-item.html", - "systems/mgt2/templates/roll-prompt.html", - "systems/mgt2/templates/chat/roll.html", - //"systems/mgt2/templates/chat/roll-characteristic.html", - "systems/mgt2/templates/actors/actor-config-sheet.html", - "systems/mgt2/templates/actors/actor-config-characteristic-sheet.html", - "systems/mgt2/templates/actors/trait-sheet.html", - "systems/mgt2/templates/editor-fullview.html" - //"systems/mgt2/templates/actors/parts/actor-characteristic.html" - ]; - return loadTemplates(templatePaths); -}; + + const templatePaths = [ + "systems/mgt2/templates/items/parts/sheet-configuration.html", + "systems/mgt2/templates/items/parts/sheet-physical-item.html", + "systems/mgt2/templates/roll-prompt.html", + "systems/mgt2/templates/chat/roll.html", + //"systems/mgt2/templates/chat/roll-characteristic.html", + "systems/mgt2/templates/actors/actor-config-sheet.html", + "systems/mgt2/templates/actors/actor-config-characteristic-sheet.html", + "systems/mgt2/templates/actors/trait-sheet.html", + "systems/mgt2/templates/editor-fullview.html" + //"systems/mgt2/templates/actors/parts/actor-characteristic.html" + ]; + + return loadTemplates(templatePaths); + }; class ChatHelper { - // _injectContent(message, type, html) { - // _setupCardListeners(message, html); - // } - static setupCardListeners(message, html, messageData) { - if (!message || !html) { - return; + + + // _injectContent(message, type, html) { + + // _setupCardListeners(message, html); + + // } + + + static setupCardListeners(message, html, messageData) { + if (!message || !html) { + return; + } + // if (SettingsUtility.getSettingValue(SETTING_NAMES.MANUAL_DAMAGE_MODE) > 0) { + // html.find('.card-buttons').find(`[data-action='rsr-${ROLL_TYPE.DAMAGE}']`).click(async event => { + // await _processDamageButtonEvent(message, event); + // }); + // } + html.find('button[data-action="rollDamage"]').click(async event => { + //ui.notifications.warn("rollDamage"); + await this._processRollDamageButtonEvent(message, event); + }); + + html.find('button[data-action="damage"]').click(async event => { + //ui.notifications.warn("damage"); + await this._applyChatCardDamage(message, event); + //await _processApplyButtonEvent(message, event); + }); + + html.find('button[data-action="healing"]').click(async event => { + ui.notifications.warn("healing"); + //await _processApplyTotalButtonEvent(message, event); + }); + + html.find('button[data-index]').click(async event => { + + await this._processRollButtonEvent(message, event); + }); } - html.find('button[data-action="rollDamage"]').click(async (event) => { - await this._processRollDamageButtonEvent(message, event); - }); - html.find('button[data-action="damage"]').click(async (event) => { - await this._applyChatCardDamage(message, event); - }); - html.find('button[data-action="healing"]').click(async (event) => { - ui.notifications.warn("healing"); - }); - html.find("button[data-index]").click(async (event) => { - await this._processRollButtonEvent(message, event); - }); - } - static async _processRollButtonEvent(message, event) { - event.preventDefault(); - event.stopPropagation(); - let buttons = message.flags.mgt2.buttons; - const index = event.target.dataset.index; - const button = buttons[index]; - let roll = await new Roll(button.formula, {}).roll({ async: true }); - const chatData = { - user: game.user.id, - speaker: message.speaker, - formula: roll._formula, - tooltip: await roll.getTooltip(), - total: Math.round(roll.total * 100) / 100, - //formula: isPrivate ? "???" : roll._formula, - //tooltip: isPrivate ? "" : await roll.getTooltip(), - //total: isPrivate ? "?" : Math.round(roll.total * 100) / 100, - type: CONST.CHAT_MESSAGE_TYPES.ROLL, - rollObjectName: button.message.objectName, - rollMessage: MGT2Helper.format(button.message.flavor, Math.round(roll.total * 100) / 100) - }; - const html = await renderTemplate("systems/mgt2/templates/chat/roll.html", chatData); - chatData.content = html; - return roll.toMessage(chatData); - } - static async _processRollDamageButtonEvent(message, event) { - event.preventDefault(); - event.stopPropagation(); - let rollFormula = message.flags.mgt2.damage.formula; - let roll = await new Roll(rollFormula, {}).roll({ async: true }); - let speaker; - let selectTokens = canvas.tokens.controlled; - if (selectTokens.length > 0) { - speaker = selectTokens[0].actor; - } else { - speaker = game.user.character; + + static async _processRollButtonEvent(message, event) { + event.preventDefault(); + event.stopPropagation(); + let buttons = message.flags.mgt2.buttons; + const index = event.target.dataset.index; + const button = buttons[index]; + let roll = await new Roll(button.formula, {}).roll({ async: true }); + //console.log(message); + + const chatData = { + user: game.user.id, + speaker: message.speaker, + formula: roll._formula, + tooltip: await roll.getTooltip(), + total: Math.round(roll.total * 100) / 100, + //formula: isPrivate ? "???" : roll._formula, + //tooltip: isPrivate ? "" : await roll.getTooltip(), + //total: isPrivate ? "?" : Math.round(roll.total * 100) / 100, + type: CONST.CHAT_MESSAGE_TYPES.ROLL, + rollObjectName: button.message.objectName, + rollMessage: MGT2Helper.format(button.message.flavor, Math.round(roll.total * 100) / 100), + }; + + const html = await renderTemplate("systems/mgt2/templates/chat/roll.html", chatData); + chatData.content = html; + return roll.toMessage(chatData); + } + + static async _processRollDamageButtonEvent(message, event) { + event.preventDefault(); + event.stopPropagation(); + let rollFormula = message.flags.mgt2.damage.formula; + + let roll = await new Roll(rollFormula, {}).roll({ async: true }); + + let speaker; + let selectTokens = canvas.tokens.controlled; + if (selectTokens.length > 0) { + speaker = selectTokens[0].actor; + } else { + speaker = game.user.character; + } + + let rollTypeName = message.flags.mgt2.damage.rollTypeName ? message.flags.mgt2.damage.rollTypeName + " DAMAGE" : null; + + const chatData = { + user: game.user.id, + speaker: ChatMessage.getSpeaker({ actor: speaker }), + formula: roll._formula, + tooltip: await roll.getTooltip(), + total: Math.round(roll.total * 100) / 100, + type: CONST.CHAT_MESSAGE_TYPES.ROLL, + showButtons: true, + hasDamage: true, + rollTypeName: rollTypeName, + rollObjectName: message.flags.mgt2.damage.rollObjectName + }; + + const html = await renderTemplate("systems/mgt2/templates/chat/roll.html", chatData); + chatData.content = html; + + return roll.toMessage(chatData); + } + + async _processDamageButtonEvent(message, event) { + event.preventDefault(); + event.stopPropagation(); + + //message.flags[MODULE_SHORT].manualDamage = false + //message.flags[MODULE_SHORT].renderDamage = true; + // current user/actor + + await ItemUtility.runItemAction(null, message, ROLL_TYPE.DAMAGE); + } + + static _applyChatCardDamage(message, event) { + const roll = message.rolls[0]; + return Promise.all(canvas.tokens.controlled.map(t => { + const a = t.actor; + return a.applyDamage(roll.total); + })); } - let rollTypeName = message.flags.mgt2.damage.rollTypeName ? message.flags.mgt2.damage.rollTypeName + " DAMAGE" : null; - const chatData = { - user: game.user.id, - speaker: ChatMessage.getSpeaker({ actor: speaker }), - formula: roll._formula, - tooltip: await roll.getTooltip(), - total: Math.round(roll.total * 100) / 100, - type: CONST.CHAT_MESSAGE_TYPES.ROLL, - showButtons: true, - hasDamage: true, - rollTypeName, - rollObjectName: message.flags.mgt2.damage.rollObjectName - }; - const html = await renderTemplate("systems/mgt2/templates/chat/roll.html", chatData); - chatData.content = html; - return roll.toMessage(chatData); - } - async _processDamageButtonEvent(message, event) { - event.preventDefault(); - event.stopPropagation(); - await ItemUtility.runItemAction(null, message, ROLL_TYPE.DAMAGE); - } - static _applyChatCardDamage(message, event) { - const roll = message.rolls[0]; - return Promise.all(canvas.tokens.controlled.map((t) => { - const a = t.actor; - return a.applyDamage(roll.total); - })); - } } -const registerSettings = function() { - game.settings.register("mgt2", "theme", { - name: "MGT2.Settings.theme.name", - hint: "MGT2.Settings.theme.hint", - scope: "client", - config: true, - default: "black-and-red", - type: String, - choices: { - "black-and-red": "MGT2.Themes.BlackAndRed", - "mwamba": "MGT2.Themes.Mwamba", - "blue": "MGT2.Themes.Blue" - }, - requiresReload: true - }); - game.settings.register("mgt2", "usePronouns", { - name: "MGT2.Settings.usePronouns.name", - hint: "MGT2.Settings.usePronouns.hint", - default: false, - scope: "world", - type: Boolean, - config: true, - requiresReload: false - }); - game.settings.register("mgt2", "useGender", { - name: "MGT2.Settings.useGender.name", - hint: "MGT2.Settings.useGender.hint", - default: false, - scope: "world", - type: Boolean, - config: true, - requiresReload: false - }); - game.settings.register("mgt2", "showLife", { - name: "MGT2.Settings.showLife.name", - hint: "MGT2.Settings.showLife.hint", - default: false, - scope: "world", - type: Boolean, - config: true, - requiresReload: false - }); +const registerSettings = function () { + + game.settings.register("mgt2", "theme", { + name: "MGT2.Settings.theme.name", + hint: "MGT2.Settings.theme.hint", + scope: "client", + config: true, + default: "black-and-red", + type: String, + choices: { + "black-and-red": "MGT2.Themes.BlackAndRed", + "mwamba": "MGT2.Themes.Mwamba", + "blue": "MGT2.Themes.Blue" + }, + requiresReload: true + }); + + game.settings.register('mgt2', 'usePronouns', { + name: "MGT2.Settings.usePronouns.name", + hint: "MGT2.Settings.usePronouns.hint", + default: false, + scope: 'world', + type: Boolean, + config: true, + requiresReload: false + }); + + game.settings.register('mgt2', 'useGender', { + name: "MGT2.Settings.useGender.name", + hint: "MGT2.Settings.useGender.hint", + default: false, + scope: 'world', + type: Boolean, + config: true, + requiresReload: false + }); + + game.settings.register('mgt2', 'showLife', { + name: "MGT2.Settings.showLife.name", + hint: "MGT2.Settings.showLife.hint", + default: false, + scope: 'world', + type: Boolean, + config: true, + requiresReload: false + }); + + // game.settings.register('mgt2', 'useWeightMetric', { + // name: "MGT2.Settings.useWeightMetric.name", + // hint: "MGT2.Settings.useWeightMetric.hint", + // default: true, + // scope: 'world', + // type: Boolean, + // config: true, + // requiresReload: true + // }); + + // game.settings.register('mgt2', 'useDistanceMetric', { + // name: "MGT2.Settings.useDistanceMetric.name", + // hint: "MGT2.Settings.useDistanceMetric.hint", + // default: true, + // scope: 'world', + // type: Boolean, + // config: true, + // requiresReload: true + // }); + + // game.settings.register('mgt2', 'showTrash', { + // name: "Show Trash tab to Player", + // hint: "Player can see the Trash tab and recover item", + // default: false, + // scope: 'world', + // type: Boolean, + // config: true, + // requiresReload: false + // }); + + /*game.settings.register('mgt2', 'containerDropIn', { + name: "Test", + hint: "Mon hint", + default: true, + scope: 'client', + type: Boolean, + config: true + });*/ }; function registerHandlebarsHelpers() { - Handlebars.registerHelper("showDM", function(dm) { - if (dm === 0) - return "0"; - if (dm > 0) - return `+${dm}`; - if (dm < 0) - return `${dm}`; + Handlebars.registerHelper('showDM', function (dm) { + if (dm === 0) return "0"; + if (dm > 0) return `+${dm}`; + if (dm < 0) return `${dm}`; return ""; }); } -Hooks.once("init", async function() { + +Hooks.once("init", async function () { CONFIG.MGT2 = MGT2; CONFIG.Combat.initiative = { formula: "2d6 + @initiative", decimals: 2 }; + CONFIG.Actor.trackableAttributes = { character: { - bar: [ - "life", + bar: ["life", "characteristics.strength", "characteristics.dexterity", "characteristics.endurance", @@ -2702,9 +3137,8 @@ Hooks.once("init", async function() { "characteristics.psionic", "characteristics.other" ], - value: [ - "life.value", - "health.radiations", + value: ["life.value", + "health.radiations", "characteristics.strength.value", "characteristics.dexterity.value", "characteristics.endurance.value", @@ -2716,26 +3150,34 @@ Hooks.once("init", async function() { "characteristics.sanity.value", "characteristics.charm.value", "characteristics.psionic.value", - "characteristics.other.value" - ] + "characteristics.other.value"] } }; + game.mgt2 = { TravellerActor, TravellerItem }; + registerHandlebarsHelpers(); registerSettings(); + CONFIG.Combatant.documentClass = MGT2Combatant; CONFIG.Actor.documentClass = TravellerActor; CONFIG.Item.documentClass = TravellerItem; - Actors.unregisterSheet("core", ActorSheet); - Actors.registerSheet("mgt2", TravellerActorSheet, { types: ["character"], makeDefault: true, label: "Traveller Sheet" }); - Items.unregisterSheet("core", ItemSheet); - Items.registerSheet("mgt2", TravellerItemSheet, { makeDefault: true }); + + foundry.documents.collections.Actors.unregisterSheet("core", foundry.appv1.sheets.ActorSheet); + foundry.documents.collections.Actors.registerSheet("mgt2", TravellerCharacterSheet, { types: ["character"], makeDefault: true, label: "Traveller Sheet" }); + foundry.documents.collections.Actors.registerSheet("mgt2", TravellerVehiculeSheet, { types: ["vehicule"], makeDefault: true, label: "Vehicule Sheet" }); + + foundry.documents.collections.Items.unregisterSheet("core", foundry.appv1.sheets.ItemSheet); + foundry.documents.collections.Items.registerSheet("mgt2", TravellerItemSheet, { makeDefault: true }); + Object.assign(CONFIG.Actor.dataModels, { - "character": CharacterData + "character": CharacterData, + "vehicule": VehiculeData }); + Object.assign(CONFIG.Item.dataModels, { "item": ItemData, "equipment": EquipmentData, @@ -2749,9 +3191,13 @@ Hooks.once("init", async function() { "container": ItemContainerData, "species": SpeciesData }); + + Hooks.on("renderChatMessage", (message, html, messageData) => { ChatHelper.setupCardListeners(message, html, messageData); }); + + // Preload template partials await preloadHandlebarsTemplates(); }); diff --git a/mgt2.bundle.js.map b/mgt2.bundle.js.map index 39f21a8..052f4c9 100644 --- a/mgt2.bundle.js.map +++ b/mgt2.bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"mgt2.bundle.js","sources":["src/module/datamodels.js","src/module/config.js","src/module/actors/character.js","src/module/actors/actor.js","src/module/item.js","src/module/helper.js","src/module/item-sheet.js","src/module/roll-prompt.js","src/module/actors/character-prompts.js","src/module/actors/character-sheet.js","src/module/templates.js","src/module/chatHelper.js","src/module/settings.js","src/module/core.js"],"sourcesContent":["// https://foundryvtt.com/article/system-data-models/\r\n// https://foundryvtt.com/api/classes/foundry.data.fields.NumberField.html\r\n// https://foundryvtt.com/api/v10/classes/foundry.data.fields.DataField.html\r\nconst fields = foundry.data.fields;\r\n\r\nexport class CharacterData extends foundry.abstract.TypeDataModel {\r\n\r\n static defineSchema() {\r\n // XP\r\n return {\r\n name: new fields.StringField({ required: false, blank: false, trim: true }),\r\n life: new fields.SchemaField({\r\n value: new fields.NumberField({ required: false, initial: 0, integer: true }),\r\n max: new fields.NumberField({ required: true, initial: 0, integer: true })\r\n }),\r\n personal: new fields.SchemaField({\r\n title: new fields.StringField({ required: false, blank: true, trim: true }),\r\n species: new fields.StringField({ required: false, blank: true, trim: true }),\r\n speciesText: new fields.SchemaField({\r\n description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }),\r\n descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true })\r\n }),\r\n age: new fields.StringField({ required: false, blank: true, trim: true }),\r\n gender: new fields.StringField({ required: false, blank: true, trim: true }),\r\n pronouns: new fields.StringField({ required: false, blank: true, trim: true }),\r\n homeworld: new fields.StringField({ required: false, blank: true, trim: true }),\r\n ucp: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\r\n traits: new fields.ArrayField(\r\n new fields.SchemaField({\r\n name: new fields.StringField({ required: true, blank: true, trim: true }),\r\n description: new fields.StringField({ required: false, blank: true, trim: true })\r\n })\r\n )\r\n }),\r\n biography: new fields.HTMLField({ required: false, blank: true, trim: true }),\r\n\r\n characteristics: new fields.SchemaField({\r\n strength: createCharacteristicField(true, true),\r\n dexterity: createCharacteristicField(true, true),\r\n endurance: createCharacteristicField(true, true),\r\n intellect: createCharacteristicField(true, false),\r\n education: createCharacteristicField(true, false),\r\n social: createCharacteristicField(true, false),\r\n morale: createCharacteristicField(true, false),\r\n luck: createCharacteristicField(true, false),\r\n sanity: createCharacteristicField(true, false),\r\n charm: createCharacteristicField(true, false),\r\n psionic: createCharacteristicField(true, false),\r\n other: createCharacteristicField(true, false)\r\n }),\r\n\r\n health: new fields.SchemaField({\r\n radiations: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true })\r\n }),\r\n study: new fields.SchemaField({\r\n skill: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\r\n total: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }),\r\n completed: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true })\r\n }),\r\n finance: new fields.SchemaField({\r\n pension: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\r\n credits: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\r\n cashOnHand: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\r\n debt: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\r\n livingCost: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\r\n monthlyShipPayments: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\r\n notes: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" })\r\n }),\r\n containerView: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\r\n containerDropIn: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\r\n notes: new fields.HTMLField({ required: false, blank: true, trim: true }),\r\n\r\n inventory: new fields.SchemaField({\r\n armor: new fields.NumberField({ required: true, initial: 0, integer: true }),\r\n weight: new fields.NumberField({ required: true, initial: 0, min: 0, integer: false }),\r\n encumbrance: new fields.SchemaField({\r\n normal: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\r\n heavy: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true })\r\n })\r\n }),\r\n states: new fields.SchemaField({\r\n encumbrance: new fields.BooleanField({ required: false, initial: false }),\r\n fatigue: new fields.BooleanField({ required: false, initial: false }),\r\n unconscious: new fields.BooleanField({ required: false, initial: false }),\r\n surgeryRequired: new fields.BooleanField({ required: false, initial: false })\r\n }),\r\n\r\n config: new fields.SchemaField({\r\n psionic: new fields.BooleanField({ required: false, initial: true }),\r\n initiative: new fields.StringField({ required: false, blank: true, initial: \"dexterity\" }),\r\n damages: new fields.SchemaField({\r\n rank1: new fields.StringField({ required: false, blank: true, initial: \"strength\" }),\r\n rank2: new fields.StringField({ required: false, blank: true, initial: \"dexterity\" }),\r\n rank3: new fields.StringField({ required: false, blank: true, initial: \"endurance\" })\r\n })\r\n })\r\n };\r\n }\r\n}\r\n\r\n// export class CreatureData extends foundry.abstract.TypeDataModel {\r\n// static defineSchema() {\r\n// return {\r\n// name: new fields.StringField({ required: false, blank: false, trim: true }),\r\n// TL: new fields.StringField({ required: true, blank: false, initial: \"NA\" }),\r\n// species: new fields.StringField({ required: false, blank: true, trim: true }),\r\n// //cost: new fields.NumberField({ required: true, integer: true }),\r\n// armor: new fields.NumberField({ required: false, initial: 0, integer: true }),\r\n// life: new fields.SchemaField({\r\n// value: new fields.NumberField({ required: false, initial: 0, integer: true }),\r\n// max: new fields.NumberField({ required: true, initial: 0, integer: true })\r\n// }),\r\n\r\n// speed: new fields.StringField({ required: false, initial: \"4m\", blank: true, trim: true }),\r\n\r\n// traits: new fields.ArrayField(\r\n// new fields.SchemaField({\r\n// name: new fields.StringField({ required: true, blank: true, trim: true }),\r\n// description: new fields.StringField({ required: false, blank: true, trim: true })\r\n// })\r\n// ),\r\n\r\n// description: new fields.HTMLField({ required: false, blank: true, trim: true }),\r\n// behaviour: new fields.StringField({ required: false, blank: true, trim: true })\r\n// }\r\n// };\r\n// }\r\n\r\n// export class NPCData extends CreatureData {\r\n// static defineSchema() {\r\n// const schema = super.defineSchema();\r\n// // Species, Gender, Age\r\n// // STR, DEX, END, INT,. EDU, SOC, PSI, SKILL/Psy, equipment\r\n// // Status\r\n// schema.secret = new fields.HTMLField({ required: false, blank: true, trim: true });\r\n\r\n// return schema;\r\n// }\r\n// }\r\n\r\nexport class VehiculeData extends foundry.abstract.TypeDataModel {\r\n\r\n static defineSchema() {\r\n return {\r\n name: new fields.StringField({ required: false, blank: false, trim: true }),\r\n\r\n skillId: new fields.StringField({ required: false, initial: \"\", blank: true, trim: true }),\r\n speed: new fields.SchemaField({\r\n cruise: new fields.StringField({ required: false, initial: \"Slow\", blank: true }),\r\n maximum: new fields.StringField({ required: false, initial: \"Medium\", blank: true })\r\n }),\r\n agility: new fields.NumberField({ required: false, min: 0, integer: true }),\r\n crew: new fields.NumberField({ required: false, min: 0, integer: true }),\r\n passengers: new fields.NumberField({ required: false, min: 0, integer: true }),\r\n cargo: new fields.NumberField({ required: false, min: 0, integer: false }),\r\n //hull\r\n life: new fields.SchemaField({\r\n value: new fields.NumberField({ required: true, initial: 0, integer: true }),\r\n max: new fields.NumberField({ required: true, initial: 0, integer: true })\r\n }),\r\n shipping: new fields.NumberField({ required: false, min: 0, integer: true }),\r\n cost: new fields.NumberField({ required: false, min: 0, integer: true }),\r\n armor: new fields.SchemaField({\r\n front: new fields.NumberField({ required: true, initial: 0, integer: true }),\r\n rear: new fields.NumberField({ required: true, initial: 0, integer: true }),\r\n sides: new fields.NumberField({ required: true, initial: 0, integer: true })\r\n }),\r\n\r\n skills: new fields.SchemaField({\r\n // Skill Level\r\n autopilot: new fields.NumberField({ required: true, initial: 0, integer: true })\r\n // Communication Range\r\n // Navigation\r\n // Sensors\r\n // Camouflage / Recon\r\n // Stealth\r\n })\r\n // config: new fields.SchemaField({\r\n // })\r\n };\r\n }\r\n}\r\n\r\nclass ItemBaseData extends foundry.abstract.TypeDataModel {\r\n static defineSchema() {\r\n const fields = foundry.data.fields;\r\n const schema = {\r\n //name: new fields.StringField({ required: true, blank: true, trim: true, nullable: true }),\r\n description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }),\r\n //type: new fields.StringField({ required: false, blank: false }),\r\n subType: new fields.StringField({ required: false, blank: false, nullable: true })\r\n };\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nclass PhysicalItemData extends ItemBaseData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n schema.quantity = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true });\r\n schema.weight = new fields.NumberField({ required: true, initial: 0, min: 0, integer: false });\r\n schema.weightless = new fields.BooleanField({ required: false, initial: false });\r\n schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true });\r\n schema.tl = new fields.StringField({ required: true, blank: false, initial: \"TL12\" });\r\n schema.container = new fields.SchemaField({\r\n //inContainer: new fields.BooleanField({ required: false, initial: false }),\r\n id: new fields.StringField({ required: false, blank: true })\r\n });\r\n\r\n schema.roll = new fields.SchemaField({\r\n characteristic: new fields.StringField({ required: false, blank: true, trim: true }),\r\n skill: new fields.StringField({ required: false, blank: true, trim: true }),\r\n difficulty: new fields.StringField({ required: false, blank: true, trim: true })\r\n });\r\n\r\n schema.trash = new fields.BooleanField({ required: false, initial: false });\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class ItemData extends PhysicalItemData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n schema.subType.initial = \"loot\";\r\n schema.software = new fields.SchemaField({\r\n bandwidth: new fields.NumberField({ required: false, initial: 0, min: 0, max: 10, integer: true }),\r\n effect: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\r\n computerId: new fields.StringField({ required: false, blank: true, initial: \"\" })\r\n });\r\n return schema;\r\n }\r\n}\r\n\r\nexport class EquipmentData extends PhysicalItemData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n // augment, clothes\r\n schema.equipped = new fields.BooleanField({ required: false, initial: false });\r\n //schema.skillModifier = new fields.StringField({ required: false, blank: true });\r\n //schema.characteristicModifier = new fields.StringField({ required: false, blank: true });\r\n\r\n schema.augment = new fields.SchemaField({\r\n improvement: new fields.StringField({ required: false, blank: true, trim: true })\r\n });\r\n\r\n schema.subType.initial = \"equipment\"; // augment, clothing, trinket, toolkit, equipment\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class DiseaseData extends ItemBaseData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n schema.subType.initial = \"disease\"; // disease;poison\r\n schema.difficulty = new fields.StringField({ required: true, initial: \"Average\" });\r\n schema.damage = new fields.StringField({ required: false, blank: true });\r\n schema.interval = new fields.StringField({ required: false, blank: true });\r\n return schema;\r\n }\r\n}\r\n\r\nexport class CareerData extends ItemBaseData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n\r\n schema.difficulty = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true });\r\n schema.damage = new fields.StringField({ required: false, blank: true });\r\n schema.interval = new fields.StringField({ required: false, blank: true });\r\n\r\n schema.assignment = new fields.StringField({ required: false, blank: true });\r\n schema.terms = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\r\n schema.rank = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\r\n schema.events = new fields.ArrayField(\r\n new fields.SchemaField({\r\n age: new fields.NumberField({ required: false, integer: true }),\r\n description: new fields.StringField({ required: false, blank: true, trim: true })\r\n })\r\n );\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class TalentData extends ItemBaseData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n\r\n schema.subType.initial = \"skill\";\r\n schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true })\r\n schema.level = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true })\r\n schema.skill = new fields.SchemaField({\r\n speciality: new fields.StringField({ required: false, blank: true, trim: true }),\r\n reduceEncumbrance: new fields.BooleanField({ required: false, initial: false })\r\n });\r\n\r\n schema.psionic = new fields.SchemaField({\r\n reach: new fields.StringField({ required: false, blank: true, trim: true }),\r\n cost: new fields.NumberField({ required: false, initial: 1, min: 0, integer: true }),\r\n duration: new fields.StringField({ required: false, blank: true, trim: true }),\r\n durationUnit: new fields.StringField({ required: false })\r\n });\r\n\r\n schema.roll = new fields.SchemaField({\r\n characteristic: new fields.StringField({ required: false, blank: true, trim: true }),\r\n skill: new fields.StringField({ required: false, blank: true, trim: true }),\r\n difficulty: new fields.StringField({ required: false, blank: true, trim: true })\r\n });\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class ContactData extends ItemBaseData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n\r\n schema.subType.initial = \"skill\";\r\n schema.cost = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true })\r\n\r\n schema.skill = new fields.SchemaField({\r\n speciality: new fields.StringField({ required: false, blank: true, trim: true }),\r\n characteristic: new fields.StringField({ required: false, blank: true, trim: true })\r\n });\r\n\r\n schema.status = new fields.StringField({ required: false, blank: true, trim: true, initial: \"Alive\" });\r\n schema.attitude = new fields.StringField({ required: false, blank: true, trim: true, initial: \"Unknow\" });\r\n schema.relation = new fields.StringField({ required: false, blank: true, trim: true, initial: \"Contact\" });\r\n schema.title = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.nickname = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.species = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.gender = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.pronouns = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.homeworld = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.location = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.occupation = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.notes = new fields.HTMLField({ required: false, blank: true, trim: true });\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class WeaponData extends PhysicalItemData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n schema.equipped = new fields.BooleanField({ required: false, initial: false });\r\n schema.range = new fields.SchemaField({\r\n isMelee: new fields.BooleanField({ required: false, initial: false }),\r\n value: new fields.NumberField({ required: false, integer: true, nullable: true }),\r\n unit: new fields.StringField({ required: false, blank: true, nullable: true })\r\n }),\r\n //schema.tons = new fields.NumberField({ required: false, initial: 0, min: 0, integer: false });\r\n schema.damage = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.magazine = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\r\n schema.magazineCost = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\r\n schema.traits = new fields.ArrayField(\r\n new fields.SchemaField({\r\n name: new fields.StringField({ required: true, blank: true, trim: true }),\r\n description: new fields.StringField({ required: false, blank: true, trim: true })\r\n })\r\n );\r\n schema.options = new fields.ArrayField(\r\n new fields.SchemaField({\r\n name: new fields.StringField({ required: true, blank: true, trim: true }),\r\n description: new fields.StringField({ required: false, blank: true, trim: true })\r\n })\r\n );\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class ArmorData extends PhysicalItemData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n schema.equipped = new fields.BooleanField({ required: false, initial: false });\r\n schema.radiations = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\r\n schema.protection = new fields.StringField({ required: false, blank: false, trim: true });\r\n\r\n // Some armours have a required skill. A Traveller suffers DM-1 to all checks taken in the armour per missing\r\n // skill level. For example, a Traveller with Vacc Suit skill 0 who is in a suit that requires Vacc Suit 2 would have\r\n // DM-2 to all their checks. Not having the skill at all inflicts the usual DM-3 unskilled penalty instead.\r\n schema.requireSkill = new fields.StringField({ required: false, blank: false });\r\n schema.requireSkillLevel = new fields.NumberField({ required: false, min: 0, integer: true });\r\n\r\n //requirements: new fields.StringField({ required: false, blank: false, trim: true }),\r\n\r\n // As powered armour, battle dress supports its own weight. While powered and active, the mass of battle dress\r\n // does not count against the encumbrance of the wearer and is effectively weightless.\r\n schema.powered = new fields.BooleanField({ required: false, initial: false });\r\n schema.options = new fields.ArrayField(\r\n new fields.SchemaField({\r\n name: new fields.StringField({ required: true, blank: true, trim: true }),\r\n description: new fields.StringField({ required: false, blank: true, trim: true })\r\n })\r\n );\r\n\r\n // Characteristics Modifiers (Pirate of Drinax - ASLAN BATTLE DRESS STR/DEX, Slot)\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class ComputerData extends PhysicalItemData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n\r\n schema.processing = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\r\n schema.processingUsed = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\r\n schema.overload = new fields.BooleanField({ required: false, initial: false });\r\n //schema.softwares = new fields.ArrayField(new fields.StringField({ required: false, blank: true, trim: true }));\r\n schema.options = new fields.ArrayField(\r\n new fields.SchemaField({\r\n name: new fields.StringField({ required: true, blank: true, trim: true }),\r\n description: new fields.StringField({ required: false, blank: true, trim: true })\r\n })\r\n );\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class SoftwareData extends ItemBaseData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n\r\n schema.bandwidth = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\r\n schema.inUse = new fields.BooleanField({ required: false, initial: false });\r\n schema.computer = new fields.StringField({ required: false, blank: true, nullable: true });\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class SpeciesData extends foundry.abstract.TypeDataModel {\r\n static defineSchema() {\r\n const fields = foundry.data.fields;\r\n const schema = {\r\n description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }),\r\n descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true }),\r\n traits: new fields.ArrayField(\r\n new fields.SchemaField({\r\n name: new fields.StringField({ required: true, blank: true, trim: true }),\r\n description: new fields.StringField({ required: false, blank: true, trim: true })\r\n })\r\n ),\r\n modifiers: new fields.ArrayField(\r\n new fields.SchemaField({\r\n characteristic: new fields.StringField({ required: false, blank: true, trim: true }),\r\n value: new fields.NumberField({ required: false, integer: true, nullable: true })\r\n })\r\n )\r\n };\r\n\r\n return schema;\r\n }\r\n}\r\n\r\nexport class ItemContainerData extends ItemBaseData {\r\n static defineSchema() {\r\n const schema = super.defineSchema();\r\n\r\n schema.onHand = new fields.BooleanField({ required: false, initial: false });\r\n schema.location = new fields.StringField({ required: false, blank: true, trim: true });\r\n schema.count = new fields.NumberField({ required: false, initial: 0, integer: true });\r\n schema.weight = new fields.NumberField({ required: false, initial: 0, integer: false });\r\n schema.weightless = new fields.BooleanField({ required: false, initial: false });\r\n\r\n schema.locked = new fields.BooleanField({ required: false, initial: false }); // GM only\r\n schema.lockedDescription = new fields.StringField({ required: false, blank: true, trim: true, nullable: true });\r\n return schema;\r\n }\r\n}\r\n\r\nfunction createCharacteristicField(show = true, showMax = false) {\r\n return new fields.SchemaField({\r\n value: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\r\n max: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }),\r\n dm: new fields.NumberField({ required: false, initial: 0, integer: true }),\r\n show: new fields.BooleanField({ required: false, initial: show }),\r\n showMax: new fields.BooleanField({ required: false, initial: showMax })\r\n });\r\n}","export const MGT2 = {};\r\n\r\nMGT2.MetricRange = Object.freeze({\r\n meter: \"MGT2.MetricRange.meter\",\r\n kilometer: \"MGT2.MetricRange.kilometer\"\r\n});\r\n\r\nMGT2.MetricWeight = Object.freeze({\r\n kilogram: \"MGT2.MetricWeight.kilogram\",\r\n ton: \"MGT2.MetricWeight.ton\"\r\n});\r\n\r\nMGT2.Difficulty = Object.freeze({\r\n NA: \"MGT2.Difficulty.NA\",\r\n Simple: \"MGT2.Difficulty.Simple\",\r\n Easy: \"MGT2.Difficulty.Easy\",\r\n Routine: \"MGT2.Difficulty.Routine\",\r\n Average: \"MGT2.Difficulty.Average\",\r\n Difficult: \"MGT2.Difficulty.Difficult\",\r\n VeryDifficult: \"MGT2.Difficulty.VeryDifficult\",\r\n Formidable: \"MGT2.Difficulty.Formidable\",\r\n Impossible: \"MGT2.Difficulty.Impossible\"\r\n});\r\n\r\nMGT2.ItemSubType = Object.freeze({\r\n loot: \"MGT2.ItemSubType.loot\",\r\n software: \"MGT2.ItemSubType.software\"\r\n});\r\n\r\nMGT2.EquipmentSubType = Object.freeze({\r\n augment: \"MGT2.EquipmentSubType.augment\",\r\n clothing: \"MGT2.EquipmentSubType.clothing\",\r\n equipment: \"MGT2.EquipmentSubType.equipment\",\r\n trinket: \"MGT2.EquipmentSubType.trinket\",\r\n toolkit: \"MGT2.EquipmentSubType.toolkit\"\r\n});\r\n\r\nMGT2.TalentSubType = Object.freeze({\r\n skill: \"MGT2.TalentSubType.skill\",\r\n psionic: \"MGT2.TalentSubType.psionic\"\r\n});\r\n\r\nMGT2.DiseaseSubType = Object.freeze({\r\n disease: \"MGT2.DiseaseSubType.disease\",\r\n poison: \"MGT2.DiseaseSubType.poison\",\r\n wound: \"MGT2.DiseaseSubType.wound\"\r\n});\r\n\r\nMGT2.PsionicReach = Object.freeze({\r\n NA: \"MGT2.PsionicReach.NA\",\r\n Personal: \"MGT2.PsionicReach.Personal\",\r\n Close: \"MGT2.PsionicReach.Close\",\r\n Short: \"MGT2.PsionicReach.Short\",\r\n Medium: \"MGT2.PsionicReach.Medium\",\r\n Long: \"MGT2.PsionicReach.Long\",\r\n VeryLong: \"MGT2.PsionicReach.VeryLong\",\r\n Distant: \"MGT2.PsionicReach.Distant\",\r\n VeryDistant: \"MGT2.PsionicReach.VeryDistant\",\r\n Continental: \"MGT2.PsionicReach.Continental\",\r\n Planetary: \"MGT2.PsionicReach.Planetary\"\r\n});\r\n\r\nMGT2.ContactRelations = Object.freeze({\r\n Allie: \"MGT2.Contact.Relation.Allie\",\r\n Contact: \"MGT2.Contact.Relation.Contact\",\r\n Rival: \"MGT2.Contact.Relation.Rival\",\r\n Enemy: \"MGT2.Contact.Relation.Enemy\"\r\n});\r\n\r\nMGT2.ContactStatus = Object.freeze({\r\n Alive: \"MGT2.Contact.Status.Alive\",\r\n Unknow: \"MGT2.Contact.Status.Unknow\",\r\n Dead: \"MGT2.Contact.Status.Dead\"\r\n});\r\n\r\nMGT2.Attitudes = Object.freeze({\r\n Unknow: \"MGT2.Contact.Attitude.Unknow\",\r\n Hostile: \"MGT2.Contact.Attitude.Hostile\",\r\n Unfriendly: \"MGT2.Contact.Attitude.Unfriendly\",\r\n Indifferent: \"MGT2.Contact.Attitude.Indifferent\",\r\n Friendly: \"MGT2.Contact.Attitude.Friendly\",\r\n Helpful: \"MGT2.Contact.Attitude.Helpful\",\r\n Complicated: \"MGT2.Contact.Attitude.Complicated\"\r\n});\r\n\r\nMGT2.Characteristics = Object.freeze({\r\n strength: \"MGT2.Characteristics.strength.name\",\r\n dexterity: \"MGT2.Characteristics.dexterity.name\",\r\n endurance: \"MGT2.Characteristics.endurance.name\",\r\n intellect: \"MGT2.Characteristics.intellect.name\",\r\n education: \"MGT2.Characteristics.education.name\",\r\n social: \"MGT2.Characteristics.social.name\",\r\n morale: \"MGT2.Characteristics.morale.name\",\r\n luck: \"MGT2.Characteristics.luck.name\",\r\n sanity: \"MGT2.Characteristics.sanity.name\",\r\n charm: \"MGT2.Characteristics.charm.name\",\r\n psionic: \"MGT2.Characteristics.psionic.name\",\r\n other: \"MGT2.Characteristics.other.name\"\r\n});\r\n\r\nMGT2.InitiativeCharacteristics = Object.freeze({\r\n dexterity: \"MGT2.Characteristics.dexterity.name\",\r\n intellect: \"MGT2.Characteristics.intellect.name\"\r\n});\r\n\r\nMGT2.DamageCharacteristics = Object.freeze({\r\n strength: \"MGT2.Characteristics.strength.name\",\r\n dexterity: \"MGT2.Characteristics.dexterity.name\",\r\n endurance: \"MGT2.Characteristics.endurance.name\"\r\n});\r\n\r\nMGT2.TL = Object.freeze({\r\n NA: \"MGT2.TL.NA\",\r\n Unknow: \"MGT2.TL.Unknow\",\r\n NotIdentified: \"MGT2.TL.NotIdentified\",\r\n TL00: \"MGT2.TL.L00\",\r\n TL01: \"MGT2.TL.L01\",\r\n TL02: \"MGT2.TL.L02\",\r\n TL03: \"MGT2.TL.L03\",\r\n TL04: \"MGT2.TL.L04\",\r\n TL05: \"MGT2.TL.L05\",\r\n TL06: \"MGT2.TL.L06\",\r\n TL07: \"MGT2.TL.L07\",\r\n TL08: \"MGT2.TL.L08\",\r\n TL09: \"MGT2.TL.L09\",\r\n TL10: \"MGT2.TL.L10\",\r\n TL11: \"MGT2.TL.L11\",\r\n TL12: \"MGT2.TL.L12\",\r\n TL13: \"MGT2.TL.L13\",\r\n TL14: \"MGT2.TL.L14\",\r\n TL15: \"MGT2.TL.L15\"\r\n});\r\n\r\nMGT2.Timeframes = Object.freeze({\r\n Normal: \"MGT2.Timeframes.Normal\",\r\n Slower: \"MGT2.Timeframes.Slower\",\r\n Faster: \"MGT2.Timeframes.Faster\"\r\n});\r\n\r\nMGT2.SpeedBands = Object.freeze({\r\n Stoppped: \"MGT2.SpeedBands.Stoppped\",\r\n Idle: \"MGT2.SpeedBands.Idle\",\r\n VerySlow: \"MGT2.SpeedBands.VerySlow\",\r\n Slow: \"MGT2.SpeedBands.Slow\",\r\n Medium: \"MGT2.SpeedBands.Medium\",\r\n High: \"MGT2.SpeedBands.High.\",\r\n Fast: \"MGT2.SpeedBands.Fast\",\r\n VeryFast: \"MGT2.SpeedBands.VeryFast\",\r\n Subsonic: \"MGT2.SpeedBands.Subsonic\",\r\n Hypersonic: \"MGT2.SpeedBands.Hypersonic\"\r\n});\r\n\r\nMGT2.Durations = Object.freeze({\r\n Seconds: \"MGT2.Durations.Seconds\",\r\n Minutes: \"MGT2.Durations.Minutes\",\r\n Heures: \"MGT2.Durations.Heures\"\r\n});","export class ActorCharacter {\r\n static preCreate($this, data, options, user) {\r\n $this.updateSource({ prototypeToken: { actorLink: true } }) // QoL\r\n }\r\n\r\n static prepareData(actorData) {\r\n actorData.initiative = this.getInitiative(actorData);\r\n }\r\n\r\n static getInitiative($this) {\r\n let c = $this.system.config.initiative;\r\n return $this.system.characteristics[c].dm;\r\n }\r\n\r\n static async onDeleteDescendantDocuments($this, parent, collection, documents, ids, options, userId) {\r\n const toDeleteIds = [];\r\n const itemToUpdates = [];\r\n\r\n for (let d of documents) {\r\n if (d.type === \"container\") {\r\n // Delete content\r\n for (let item of $this.items) {\r\n if (item.system.hasOwnProperty(\"container\") && item.system.container.id === d._id)\r\n toDeleteIds.push(item._id);\r\n }\r\n } else if (d.type === \"computer\") {\r\n // Eject software\r\n for (let item of $this.items) {\r\n if (item.system.hasOwnProperty(\"software\") && item.system.computerId === d._id) {\r\n let clone = duplicate(item);\r\n clone.system.software.computerId = \"\";\r\n itemToUpdates.push(clone);\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (toDeleteIds.length > 0)\r\n await $this.deleteEmbeddedDocuments(\"Item\", toDeleteIds);\r\n\r\n if (itemToUpdates.length > 0)\r\n await $this.updateEmbeddedDocuments('Item', itemToUpdates);\r\n\r\n await this.recalculateWeight($this);\r\n }\r\n\r\n static async onUpdateDescendantDocuments($this, parent, collection, documents, changes, options, userId) {\r\n await this.calculEncumbranceAndWeight($this, parent, collection, documents, changes, options, userId);\r\n await this.calculComputers($this, parent, collection, documents, changes, options, userId);\r\n }\r\n\r\n static async calculComputers($this, parent, collection, documents, changes, options, userId) {\r\n let change;\r\n let i = 0;\r\n\r\n let recalculProcessing = false;\r\n for (let d of documents) {\r\n if (changes[i].hasOwnProperty(\"system\")) {\r\n change = changes[i];\r\n if (d.type === \"item\" && d.system.subType === \"software\") {\r\n if (change.system.software.hasOwnProperty(\"bandwidth\") || change.system.software.hasOwnProperty(\"computerId\")) {\r\n recalculProcessing = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (recalculProcessing) {\r\n let updatedComputers = [];\r\n let computerChanges = {};\r\n let computers = [];\r\n\r\n for (let item of $this.items) {\r\n if (item.system.trash === true) continue;\r\n if (item.type === \"computer\") {\r\n computers.push(item);\r\n computerChanges[item._id] = { processingUsed: 0 };\r\n }\r\n }\r\n\r\n for (let item of $this.items) {\r\n if (item.type !== \"item\" && item.system.subType !== \"software\") continue;\r\n\r\n if (item.system.software.hasOwnProperty(\"computerId\") && item.system.software.computerId !== \"\") {\r\n computerChanges[item.system.software.computerId].processingUsed += item.system.software.bandwidth;\r\n }\r\n }\r\n\r\n for (let computer of computers) {\r\n let newProcessingUsed = computerChanges[computer._id].processingUsed;\r\n if (computer.system.processingUsed !== newProcessingUsed) {\r\n const cloneComputer = duplicate($this.getEmbeddedDocument(\"Item\", computer._id));\r\n cloneComputer.system.processingUsed = newProcessingUsed;\r\n cloneComputer.system.overload = cloneComputer.system.processingUsed > cloneComputer.system.processing;\r\n updatedComputers.push(cloneComputer);\r\n }\r\n }\r\n\r\n if (updatedComputers.length > 0) {\r\n await $this.updateEmbeddedDocuments('Item', updatedComputers);\r\n }\r\n }\r\n }\r\n\r\n static async calculEncumbranceAndWeight($this, parent, collection, documents, changes, options, userId) {\r\n let recalculEncumbrance = false;\r\n let recalculWeight = false;\r\n\r\n let change;\r\n let i = 0;\r\n for (let d of documents) {\r\n if (changes[i].hasOwnProperty(\"system\")) {\r\n change = changes[i];\r\n\r\n if (d.type === \"armor\" ||\r\n d.type === \"computer\" ||\r\n d.type === \"gear\" ||\r\n d.type === \"item\" ||\r\n d.type === \"weapon\") {\r\n if (change.system.hasOwnProperty(\"quantity\") ||\r\n change.system.hasOwnProperty(\"weight\") ||\r\n change.system.hasOwnProperty(\"weightless\") ||\r\n change.system.hasOwnProperty(\"container\") ||\r\n change.system.hasOwnProperty(\"equipped\") ||\r\n d.type === \"armor\") {\r\n recalculWeight = true;\r\n }\r\n } else if (d.type === \"talent\" && d.system.subType === \"skill\") {\r\n if (change.system.level || (change.system?.hasOwnProperty(\"skill\") && change.system?.skill.hasOwnProperty(\"reduceEncumbrance\"))) {\r\n recalculEncumbrance = true;\r\n }\r\n } else if (d.type === \"container\" && (change.system.hasOwnProperty(\"onHand\") || change.system.hasOwnProperty(\"weightless\"))) {\r\n recalculWeight = true;\r\n }\r\n }\r\n i++;\r\n }\r\n\r\n if (recalculEncumbrance || recalculWeight) {\r\n const cloneActorSystem = duplicate($this.system);\r\n\r\n await this.recalculateArmor($this, cloneActorSystem);\r\n if (!recalculEncumbrance && !recalculWeight)\r\n await $this.update({ system: cloneActorSystem });\r\n\r\n if (recalculEncumbrance) {\r\n\r\n const str = Number($this.system.characteristics.strength.value);\r\n const end = Number($this.system.characteristics.endurance.value);\r\n let sumSkill = 0;\r\n $this.items.filter(x => x.type === \"talent\" && x.system.subType === \"skill\" && x.system.skill.reduceEncumbrance === true).forEach(x => sumSkill += Number(x.system.level));\r\n let normal = str + end + sumSkill;\r\n let heavy = normal * 2;\r\n\r\n cloneActorSystem.states.encumbrance = $this.system.inventory.weight > normal;\r\n cloneActorSystem.encumbrance.normal = normal;\r\n cloneActorSystem.encumbrance.heavy = heavy;\r\n\r\n if (!recalculWeight)\r\n await $this.update({ system: cloneActorSystem });\r\n }\r\n\r\n if (recalculWeight)\r\n await this.recalculateWeight($this, cloneActorSystem);\r\n }\r\n }\r\n\r\n static async recalculateArmor($this, cloneActorSystem) {\r\n if (cloneActorSystem === null || cloneActorSystem === undefined)\r\n cloneActorSystem = foundry.utils.duplicate($this.system);\r\n\r\n let armor = 0;\r\n for (let item of $this.items) {\r\n if (item.type === \"armor\") {\r\n if (item.system.equipped === true && !isNaN(item.system.protection)) {\r\n armor += (+item.system.protection || 0);\r\n }\r\n }\r\n }\r\n\r\n cloneActorSystem.inventory.armor = armor;\r\n }\r\n\r\n static async recalculateWeight($this, cloneActorSystem) {\r\n\r\n if (cloneActorSystem === null || cloneActorSystem === undefined)\r\n cloneActorSystem = foundry.utils.duplicate($this.system);\r\n\r\n let updatedContainers = [];\r\n let containerChanges = {};\r\n\r\n //console.log(\"recalculWeight\");\r\n let containers = [];\r\n\r\n // List all containers\r\n for (let item of $this.items) {\r\n if (item.system.trash === true) continue;\r\n\r\n if (item.type === \"container\") {\r\n containers.push(item);\r\n containerChanges[item._id] = { count: 0, weight: 0 };\r\n }\r\n }\r\n\r\n let onHandWeight = 0;\r\n for (let item of $this.items) {\r\n if (item.type === \"container\") continue;\r\n if (item.system.hasOwnProperty(\"weightless\") && item.system.weightless === true) continue;\r\n\r\n let itemWeight = 0;\r\n if (item.system.hasOwnProperty(\"weight\")) {\r\n let itemQty = item.system.quantity\r\n if (!isNaN(itemQty) && itemQty > 0) {\r\n itemWeight = item.system.weight;\r\n if (itemWeight > 0) {\r\n itemWeight *= itemQty;\r\n }\r\n }\r\n\r\n if (item.type === \"armor\") {\r\n if (item.system.equipped === true) {\r\n if (item.system.powered === true)\r\n itemWeight = 0;\r\n else\r\n itemWeight *= 0.25; // mass of armor that is being worn by 75% OPTIONAL\r\n }\r\n }\r\n\r\n if (item.system.container && item.system.container.id && item.system.container.id !== \"\") {\r\n // bad deleted container id\r\n if (containerChanges.hasOwnProperty(item.system.container.id)) {\r\n containerChanges[item.system.container.id].weight += Math.round(itemWeight * 10) / 10;\r\n containerChanges[item.system.container.id].count += item.system.quantity;\r\n }\r\n } else {\r\n onHandWeight += Math.round(itemWeight * 10) / 10;\r\n }\r\n }\r\n }\r\n\r\n //cloneActor.system.inventory.weight = onHandWeight.toFixed(1);\r\n\r\n // Check containers new weight\r\n for (let container of containers) {\r\n let newWeight = containerChanges[container._id].weight;\r\n let newCount = containerChanges[container._id].count;\r\n if (container.system.weight !== newWeight || container.system.count !== newCount) {\r\n //const cloneContainer = duplicate();\r\n const cloneContainer = duplicate($this.getEmbeddedDocument(\"Item\", container._id));\r\n //foundry.utils.setProperty(cloneContainer, \"system.weight\", newWeight);\r\n cloneContainer.system.weight = newWeight;\r\n cloneContainer.system.count = newCount;\r\n updatedContainers.push(cloneContainer);\r\n\r\n if (container.system.onHand === true &&\r\n (container.system.weight > 0 || container.system.weightless !== true)) {\r\n onHandWeight += container.system.weight;\r\n }\r\n }\r\n }\r\n\r\n cloneActorSystem.inventory.weight = onHandWeight;\r\n cloneActorSystem.states.encumbrance = onHandWeight > $this.system.inventory.encumbrance.normal;\r\n\r\n\r\n await $this.update({ system: cloneActorSystem });\r\n\r\n if (updatedContainers.length > 0) {\r\n await $this.updateEmbeddedDocuments('Item', updatedContainers);\r\n }\r\n }\r\n\r\n static async preUpdate($this, changed, options, user) {\r\n // Calc encumbrance\r\n\r\n const newStr = Number(foundry.utils.getProperty(changed, \"system.characteristics.strength.value\") ?? $this.system.characteristics.strength.value);\r\n const newEnd = Number(foundry.utils.getProperty(changed, \"system.characteristics.endurance.value\") ?? $this.system.characteristics.endurance.value);\r\n if ((newStr !== $this.system.characteristics.strength.value) || (newEnd !== $this.system.characteristics.endurance.value)) {\r\n let sumSkill = 0;\r\n $this.items.filter(x => x.type === \"talent\" && x.system.subType === \"skill\" && x.system.skill.reduceEncumbrance === true).forEach(x => sumSkill += Number(x.system.level));\r\n let normal = newStr + newEnd + sumSkill;\r\n let heavy = normal * 2;\r\n foundry.utils.setProperty(changed, \"system.inventory.encumbrance.normal\", normal);\r\n foundry.utils.setProperty(changed, \"system.inventory.encumbrance.heavy\", heavy);\r\n }\r\n\r\n //console.log(foundry.utils.getProperty(changed, \"system.characteristics.strength.value\"));\r\n const characteristicModified = this.computeCharacteristics(changed);\r\n const strengthValue = Number(foundry.utils.getProperty(changed, \"system.characteristics.strength.value\") ?? $this.system.characteristics.strength.value);\r\n const strengthMax = Number(foundry.utils.getProperty(changed, \"system.characteristics.strength.max\") ?? $this.system.characteristics.strength.max);\r\n const dexterityValue = Number(foundry.utils.getProperty(changed, \"system.characteristics.dexterity.value\") ?? $this.system.characteristics.dexterity.value);\r\n const dexterityMax = Number(foundry.utils.getProperty(changed, \"system.characteristics.dexterity.max\") ?? $this.system.characteristics.dexterity.max);\r\n const enduranceValue = Number(foundry.utils.getProperty(changed, \"system.characteristics.endurance.value\") ?? $this.system.characteristics.endurance.value);\r\n const enduranceMax = Number(foundry.utils.getProperty(changed, \"system.characteristics.endurance.max\") ?? $this.system.characteristics.endurance.max);\r\n const lifeValue = strengthValue + dexterityValue + enduranceValue;\r\n const lifeMax = strengthMax + dexterityMax + enduranceMax;\r\n\r\n if ($this.system.life.value !== lifeValue)\r\n foundry.utils.setProperty(changed, \"system.life.value\", lifeValue);\r\n if ($this.system.life.max !== lifeMax)\r\n foundry.utils.setProperty(changed, \"system.life.max\", lifeMax);\r\n\r\n if (characteristicModified && $this.system.personal.ucp === undefined || $this.system.personal.ucp === \"\") {\r\n // calc\r\n\r\n }\r\n //}\r\n\r\n // Apply changes in Actor size to Token width/height\r\n // if ( \"size\" in (this.system.traits || {}) ) {\r\n // const newSize = foundry.utils.getProperty(changed, \"system.traits.size\");\r\n // if ( newSize && (newSize !== this.system.traits?.size) ) {\r\n // let size = CONFIG.DND5E.tokenSizes[newSize];\r\n // if ( !foundry.utils.hasProperty(changed, \"prototypeToken.width\") ) {\r\n // changed.prototypeToken ||= {};\r\n // changed.prototypeToken.height = size;\r\n // changed.prototypeToken.width = size;\r\n // }\r\n // }\r\n // }\r\n }\r\n\r\n // static applyHealing($this, amount) {\r\n // if (isNaN(amount) || amount === 0) return;\r\n\r\n // const strength = $this.system.characteristics.strength;\r\n // const dexterity = $this.system.characteristics.dexterity;\r\n // const endurance = $this.system.characteristics.endurance;\r\n\r\n // const data = {\r\n // strength: { value: strength.value },\r\n // dexterity: { value: dexterity.value },\r\n // endurance: { value: endurance.value }\r\n // };\r\n\r\n\r\n\r\n // $this.update({ system: { characteristics: data } });\r\n // }\r\n\r\n static applyDamage($this, amount) {\r\n if (isNaN(amount) || amount === 0) return;\r\n const rank1 = $this.system.config.damages.rank1;\r\n const rank2 = $this.system.config.damages.rank2;\r\n const rank3 = $this.system.config.damages.rank3;\r\n\r\n const data = {};\r\n data[rank1] = { value: $this.system.characteristics[rank1].value };\r\n data[rank2] = { value: $this.system.characteristics[rank2].value };\r\n data[rank3] = { value: $this.system.characteristics[rank3].value };\r\n\r\n if (amount < 0) amount = Math.abs(amount);\r\n\r\n for (const [key, rank] of Object.entries(data)) {\r\n if (rank.value > 0) {\r\n if (rank.value >= amount) {\r\n rank.value -= amount;\r\n amount = 0;\r\n } else {\r\n amount -= rank.value;\r\n rank.value = 0;\r\n }\r\n rank.dm = this.getModifier(rank.value);\r\n if (amount <= 0) break;\r\n }\r\n }\r\n\r\n $this.update({ system: { characteristics: data } });\r\n }\r\n\r\n static getContainers($this) {\r\n const containers = [];\r\n for (let item of $this.items) {\r\n if (item.type == \"container\") {\r\n containers.push(item);\r\n }\r\n }\r\n\r\n containers.sort(this.compareByName);\r\n\r\n return containers;\r\n }\r\n\r\n static getComputers($this) {\r\n const containers = [];\r\n for (let item of $this.items) {\r\n if (item.type == \"computer\") {\r\n containers.push(item);\r\n }\r\n }\r\n\r\n containers.sort(this.compareByName);\r\n\r\n return containers;\r\n }\r\n\r\n static getSkills($this) {\r\n const skills = [];\r\n for (let item of $this.items) {\r\n if (item.type === \"talent\" && item.system.subType === \"skill\") {\r\n skills.push(item);\r\n }\r\n }\r\n\r\n skills.sort(this.compareByName);\r\n\r\n return skills;\r\n }\r\n\r\n static computeCharacteristics(changed) {\r\n let modified = this.computeCharacteristic(changed, \"strength\");\r\n\r\n if (this.computeCharacteristic(changed, \"dexterity\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"endurance\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"intellect\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"education\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"social\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"morale\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"luck\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"sanity\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"charm\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"psionic\") && !modified) modified = true;\r\n if (this.computeCharacteristic(changed, \"other\") && !modified) modified = true;\r\n\r\n return modified;\r\n }\r\n\r\n static computeCharacteristic(changed, name) {\r\n //if (isNaN(c.value) || c.value <= 0) c.value = 0;\r\n //c.dm = this._getModifier(c.value)\r\n const path = `system.characteristics.${name}`;\r\n const newValue = Number(foundry.utils.getProperty(changed, path + \".value\"));\r\n if (newValue && !isNaN(newValue)) {\r\n const dm = this.getModifier(newValue);\r\n foundry.utils.setProperty(changed, path + \".dm\", dm);\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n static getModifier(value) {\r\n if (isNaN(value) || value <= 0) return -3;\r\n if (value >= 1 && value <= 2) return -2;\r\n if (value >= 3 && value <= 5) return -1;\r\n if (value >= 6 && value <= 8) return 0;\r\n if (value >= 9 && value <= 11) return 1;\r\n if (value >= 12 && value <= 14) return 2;\r\n\r\n return 3;\r\n }\r\n\r\n static compareByName(a, b) {\r\n if (!a.hasOwnProperty(\"name\") || !b.hasOwnProperty(\"name\")) {\r\n return 0;\r\n }\r\n return a.name.toLowerCase().localeCompare(b.name.toLowerCase());\r\n }\r\n}","import { ActorCharacter } from \"./character.js\";\n\nexport class MGT2Combatant extends Combatant {\n \n}\n\nexport class TravellerActor extends Actor {\n\n // _onUpdate(data, options, userId) {\n // super._onUpdate(data, options, userId);\n // console.log(\"_onUpdate\");\n // console.log(data);\n // if (data.system?.characteristics) {\n\n // // Calc encumbrance\n // if (data.system.characteristics.strength || data.system.characteristics.endurance) {\n // data.system.encumbrance.normal = 0;\n // data.system.encumbrance.heavy = 0;\n // }\n // }\n // // If benefits were changed\n // //if (data.system?.benefits) {\n // // this.updateBenefitsOnActor();\n // //}\n // // this.actor.computeCharacteristics(formData);\n // }\n\n /*\n initiative if(!token?.combatant) return ui.notifications.warn(\"You are missing a selected token or combatant.\"); const bonus = await Dialog.prompt({ title: \"Roll Initiative\", content: ``, callback: (html) => html[0].querySelector(\"input\").value, rejectClose: false }); const roll = await new Roll(`1d12 + ${bonus}`).evaluate({async: true}); await roll.toMessage({ flavor: `${token.actor.name} rolls initiative!`, speaker: ChatMessage.getSpeaker({actor: token.actor}) }); await token.combatant.update({initiative: roll.total});\n */\n\n prepareDerivedData() {\n if (this.type === \"character\") {\n this.system.initiative = ActorCharacter.getInitiative(this);\n }\n }\n\n async _preCreate(data, options, user) {\n if ( (await super._preCreate(data, options, user)) === false ) return false;\n \n if (this.type === \"character\") {\n ActorCharacter.preCreate(this, data, options, user);\n }\n }\n\n async _onDeleteDescendantDocuments(parent, collection, documents, ids, options, userId) {\n await super._onDeleteDescendantDocuments(parent, collection, documents, ids, options, userId);\n\n if (this.type === \"character\") {\n await ActorCharacter.onDeleteDescendantDocuments(this, parent, collection, documents, ids, options, userId);\n }\n }\n\n async _onUpdateDescendantDocuments(parent, collection, documents, changes, options, userId) {\n super._onUpdateDescendantDocuments(parent, collection, documents, changes, options, userId);\n //console.log(\"_onUpdateDescendantDocuments\");\n\n if (this.type === \"character\") {\n await ActorCharacter.onUpdateDescendantDocuments(this, parent, collection, documents, changes, options, userId);\n }\n }\n\n async _preUpdate(changed, options, user) {\n if ((await super._preUpdate(changed, options, user)) === false) return false;\n\n if (this.type === \"character\") {\n await ActorCharacter.preUpdate(this, changed, options, user);\n }\n }\n\n getInitiative($this) {\n if (this.type === \"character\") {\n return ActorCharacter.getInitiative(this);\n }\n }\n\n applyDamage(amount) {\n if (this.type === \"character\") {\n ActorCharacter.applyDamage(this, amount);\n }\n }\n\n getContainers() {\n if (this.type === \"character\") {\n return ActorCharacter.getContainers(this);\n }\n\n return [];\n }\n\n getComputers() {\n if (this.type === \"character\") {\n return ActorCharacter.getComputers(this);\n }\n\n return [];\n }\n\n getSkills() {\n if (this.type === \"character\") {\n return ActorCharacter.getSkills(this);\n }\n\n return [];\n }\n\n async recalculateWeight() {\n if (this.type === \"character\") {\n return ActorCharacter.recalculateWeight(this);\n }\n }\n\n async recalculateArmor() {\n if (this.type === \"character\") {\n return ActorCharacter.recalculateArmor(this);\n }\n }\n}\n","export class TravellerItem extends Item {\n\n /** @inheritdoc */\n prepareDerivedData() {\n super.prepareDerivedData();\n\n }\n\n async _preUpdate(changed, options, user) {\n if ((await super._preUpdate(changed, options, user)) === false) return false;\n\n if (this.type === \"computer\") {\n // Overload\n const newProcessing = foundry.utils.getProperty(changed, \"system.processing\") ?? this.system.processing;\n if (newProcessing !== this.system.processing) {\n let overload = this.system.processingUsed > newProcessing;\n foundry.utils.setProperty(changed, \"system.overload\", overload);\n }\n }\n\n // Qty max 1\n if (this.type === \"computer\" || this.type === \"container\" || (this.type === \"item\" && this.system.subType === \"software\")) {\n const newQty = foundry.utils.getProperty(changed, \"system.quantity\") ?? this.system.quantity;\n if (newQty !== this.system.quantity && newQty > 1) {\n foundry.utils.setProperty(changed, \"system.quantity\", 1);\n }\n }\n\n // No Weight\n if (this.type === \"item\" && this.system.subType === \"software\") {\n const newWeight = foundry.utils.getProperty(changed, \"system.weight\") ?? this.system.weight;\n if (newWeight !== this.system.weight && newWeight > 0) {\n foundry.utils.setProperty(changed, \"system.weight\", 0);\n }\n }\n }\n\n getRollDisplay() {\n if (this.type === \"talent\") {\n if (this.system.subType === \"skill\") {\n let label;\n if (this.system.skill.speciality !== \"\" && this.system.skill.speciality !== undefined) {\n label = `${this.name} (${this.system.skill.speciality})`;\n } else {\n label = this.name;\n }\n\n if (this.system.level > 0)\n label += ` (+${this.system.level})`;\n else if (this.system.level < 0)\n label += ` (${this.system.level})`;\n\n return label;\n } else if (this.system.subType === \"psionic\") {\n\n }\n }\n\n return name;\n }\n}\n","export class MGT2Helper {\r\n static POUNDS_CONVERT = 2.20462262185;\r\n\r\n static decimalSeparator;\r\n static badDecimalSeparator;\r\n\r\n static {\r\n this.decimalSeparator = Number(1.1).toLocaleString().charAt(1);\r\n this.badDecimalSeparator = (this.decimalSeparator === \".\" ? \",\" : \".\");\r\n }\r\n\r\n static format = function() {\r\n var s = arguments[0];\r\n for (var i = 0; i < arguments.length - 1; i++) { \r\n var reg = new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\"); \r\n s = s.replace(reg, arguments[i + 1]);\r\n }\r\n return s;\r\n }\r\n\r\n static hasValue(object, property) {\r\n return object !== undefined && object.hasOwnProperty(property) && object[property] !== null && object[property] !== undefined && object[property] !== \"\";\r\n }\r\n\r\n static getItemsWeight(items) {\r\n let weight = 0;\r\n for (let i of items) {\r\n let item = i.hasOwnProperty(\"system\") ? i.system : i;\r\n if (item.hasOwnProperty(\"weightless\") && item.weightless === true) {\r\n continue;\r\n }\r\n\r\n if (item.hasOwnProperty(\"weight\")) {\r\n let itemQty = item.quantity\r\n if (!isNaN(itemQty) && itemQty > 0) {\r\n let itemWeight = item.weight;\r\n if (itemWeight > 0) {\r\n weight += itemWeight * itemQty;\r\n }\r\n }\r\n }\r\n }\r\n return weight;\r\n }\r\n\r\n static generateUID() {\r\n let result = '';\r\n const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';\r\n\r\n for (let i = 0; i < 36; i++) {\r\n const randomIndex = Math.floor(Math.random() * characters.length);\r\n result += characters.charAt(randomIndex);\r\n if (i === 8 || i === 12 || i === 16 || i === 20)\r\n result += \"-\";\r\n }\r\n\r\n return result;\r\n }\r\n\r\n static compareByName(a, b) {\r\n if (!a.hasOwnProperty(\"name\") || !b.hasOwnProperty(\"name\")) {\r\n return 0;\r\n }\r\n return a.name.toLowerCase().localeCompare(b.name.toLowerCase());\r\n }\r\n\r\n static getDisplayDM(dm) {\r\n if (dm === 0) return \" (0)\";\r\n if (dm > 0) return ` (+${dm})`;\r\n if (dm < 0) return ` (${dm})`;\r\n return \"\";\r\n }\r\n static getFormulaDM(dm) {\r\n if (dm === 0) return \"+0\";\r\n if (dm > 0) return `+${dm}`;\r\n if (dm < 0) return `${dm}`;\r\n return \"\";\r\n }\r\n\r\n static getDiceResults(roll) {\r\n const results = [];\r\n for (const die of roll.dice) {\r\n results.push(die.results);\r\n }\r\n return results.flat(2);\r\n }\r\n\r\n static getDiceTotal(roll) {\r\n let total = 0;\r\n for (const die of roll.dice) {\r\n total += die.total;\r\n }\r\n return total;\r\n }\r\n\r\n static getDifficultyValue(difficulty) {\r\n switch(difficulty) {\r\n case \"Simple\": return 2;\r\n case \"Easy\": return 4;\r\n case \"Routine\": return 6;\r\n case \"Average\": return 8;\r\n case \"Difficult\": return 10;\r\n case \"VeryDifficult\": return 12;\r\n case \"Formidable\": return 14;\r\n case \"Impossible\": return 16;\r\n default:\r\n return 0;\r\n }\r\n }\r\n\r\n static getDifficultyDisplay(difficulty) {\r\n switch(difficulty) {\r\n case \"Simple\": return game.i18n.localize(\"MGT2.Difficulty.Simple\") + \" (2+)\";\r\n case \"Easy\": return game.i18n.localize(\"MGT2.Difficulty.Easy\") + \" (4+)\";\r\n case \"Routine\": return game.i18n.localize(\"MGT2.Difficulty.Routine\") + \" (6+)\";\r\n case \"Average\": return game.i18n.localize(\"MGT2.Difficulty.Average\") + \" (8+)\";\r\n case \"Difficult\": return game.i18n.localize(\"MGT2.Difficulty.Difficult\") + \" (10+)\";\r\n case \"VeryDifficult\": return game.i18n.localize(\"MGT2.Difficulty.VeryDifficult\") + \" (12+)\";\r\n case \"Formidable\": return game.i18n.localize(\"MGT2.Difficulty.Formidable\") + \" (14+)\";\r\n case \"Impossible\": return game.i18n.localize(\"MGT2.Difficulty.Impossible\") + \" (16+)\";\r\n default:\r\n return null;\r\n }\r\n }\r\n\r\n static getRangeDisplay(range) {\r\n let value = Number(range.value);\r\n\r\n if (isNaN(value)) return null;\r\n\r\n let label;\r\n //if (game.settings.get(\"mgt2\", \"useDistanceMetric\") === true) {\r\n if (range.unit !== null && range.unit !== undefined && range.unit !== \"\")\r\n label = game.i18n.localize(`MGT2.MetricRange.${range.unit}`).toLowerCase();\r\n else\r\n label = \"\";\r\n //} else {\r\n // TODO\r\n //}\r\n\r\n return `${value}${label}`;\r\n }\r\n\r\n static getWeightLabel() {\r\n //const label = game.settings.get(\"mgt2\", \"useWeightMetric\") === true ? \"MGT2.MetricSystem.Weight.kg\" : \"MGT2.ImperialSystem.Weight.lb\";\r\n //return game.i18n.localize(label);\r\n return game.i18n.localize(\"MGT2.MetricSystem.Weight.kg\");\r\n }\r\n\r\n static getDistanceLabel() {\r\n //const label = game.settings.get(\"mgt2\", \"useDistanceMetric\") === true ? \"MGT2.MetricSystem.Distance.km\" : \"MGT2.ImperialSystem.Distance.mi\";\r\n //return game.i18n.localize(label);\r\n return game.i18n.localize(\"MGT2.MetricSystem.Distance.km\");\r\n }\r\n\r\n static getIntegerFromInput(data) {\r\n return Math.trunc(this.getNumberFromInput(data));\r\n }\r\n\r\n static getNumberFromInput(data) {\r\n if (data === undefined || data === null) return 0;\r\n\r\n if (typeof data === \"string\") {\r\n let converted = Number(data.replace(/\\s+/g, '').replace(this.badDecimalSeparator, this.decimalSeparator).trim());\r\n if (isNaN(converted))\r\n return 0;\r\n\r\n return converted;\r\n }\r\n\r\n let converted = Number(data);\r\n\r\n if (isNaN(converted))\r\n return 0;\r\n\r\n return converted;\r\n }\r\n\r\n static convertWeightForDisplay(weight) {\r\n //if (game.settings.get(\"mgt2\", \"useWeightMetric\") === true || weight === 0)\r\n return weight;\r\n\r\n // Metric to Imperial\r\n //const pounds = weight * this.POUNDS_CONVERT;\r\n //return Math.round(pounds * 10) / 10;\r\n }\r\n\r\n static convertWeightFromInput(weight) {\r\n //if (game.settings.get(\"mgt2\", \"useWeightMetric\") === true || weight === 0)\r\n return Math.round(weight * 10) / 10;\r\n\r\n // Imperial to Metric\r\n //const kg = this.POUNDS_CONVERT / weight;\r\n //return Math.round(kg * 10) / 10;\r\n }\r\n\r\n static getDataFromDropEvent(event) {\r\n let data;\r\n try {\r\n return JSON.parse(event.dataTransfer?.getData(\"text/plain\"));\r\n } catch (err) {\r\n return false;\r\n }\r\n\r\n //if ( data.type !== \"Item\" ) return false;\r\n //const item = await Item.implementation.fromDropData(data);\r\n }\r\n\r\n static async getItemDataFromDropData(dropData) {\r\n //console.log(\"getItemDataFromDropData\");\r\n let item;\r\n if (game.modules.get(\"monks-enhanced-journal\")?.active && dropData.itemId && dropData.uuid.includes(\"JournalEntry\")) {\r\n const journalEntry = await fromUuid(dropData.uuid);\r\n } else if (dropData.hasOwnProperty(\"uuid\")) {\r\n item = await fromUuid(dropData.uuid);\r\n } else {\r\n let uuid = `${dropData.type}.${dropData.data._id}`;\r\n item = await fromUuid(uuid);\r\n }\r\n\r\n if (!item) {\r\n throw new Error(game.i18n.localize(\"Errors.CouldNotFindItem\").replace(\"_ITEM_ID_\", dropData.uuid));\r\n }\r\n if (item.pack) {\r\n const pack = game.packs.get(item.pack);\r\n item = await pack?.getDocument(item._id);\r\n }\r\n return foundry.utils.deepClone(item);\r\n }\r\n}","import { MGT2Helper } from \"./helper.js\";\n\n/**\n * Extend the basic ItemSheet with some very simple modifications\n * @extends {ItemSheet}\n */\nexport class TravellerItemSheet extends ItemSheet {\n\n /** @inheritdoc */\n static get defaultOptions() {\n const options = super.defaultOptions;\n return foundry.utils.mergeObject(options, {\n classes: [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"],\n width: 630,\n tabs: [{ navSelector: \".horizontal-tabs\", contentSelector: \".itemsheet-panel\", initial: \"tab1\" }]\n });\n }\n\n /* -------------------------------------------- */\n\n get template() {\n const path = \"systems/mgt2/templates/items\";\n return `${path}/${this.item.type}-sheet.html`;\n }\n\n /** @inheritdoc */\n async getData(options) {\n const context = await super.getData(options);\n //console.log('-=getData=-');\n //console.log(context);\n const item = context.item;\n\n const source = item.toObject();\n context.config = CONFIG.MGT2;\n\n const settings = {};\n settings.usePronouns = game.settings.get(\"mgt2\", \"usePronouns\");\n\n let containers = null;\n let computers = null;;\n let hadContainer;\n if (context.item.actor != null) {\n hadContainer = true;\n containers = [{ \"name\": \"\", \"_id\": \"\" }].concat(context.item.actor.getContainers());\n computers = [{ \"name\": \"\", \"_id\": \"\" }].concat(context.item.actor.getComputers());\n } else {\n hadContainer = false;\n }\n\n let weight = null;\n if (item.system.hasOwnProperty(\"weight\")) {\n weight = MGT2Helper.convertWeightForDisplay(item.system.weight);\n }\n let unitlabels = {\n weight: MGT2Helper.getWeightLabel()\n };\n let skills = [];\n\n if (this.actor !== null) {\n for (let item of this.actor.items) {\n if (item.type === \"talent\") {\n if (item.system.subType === \"skill\")\n skills.push({ _id: item._id, name: item.getRollDisplay() });\n }\n }\n }\n \n skills.sort(MGT2Helper.compareByName);\n skills = [{ _id: \"NP\", name: game.i18n.localize(\"MGT2.Items.NotProficient\") }].concat(skills);\n\n foundry.utils.mergeObject(context, {\n source: source.system,\n system: item.system,\n settings: settings,\n containers: containers,\n computers: computers,\n hadContainer: hadContainer,\n weight: weight,\n unitlabels: unitlabels,\n editable: this.isEditable,\n isGM: game.user.isGM,\n skills: skills,\n config: CONFIG\n //rollData: this.item.getRollData(),\n });\n\n return context;\n }\n\n /* -------------------------------------------- */\n\n /** @inheritdoc */\n activateListeners(html) {\n super.activateListeners(html);\n\n // Everything below here is only needed if the sheet is editable\n if (!this.isEditable) return;\n\n //let handler = ev => this._onDropCustom(ev);\n\n //console.log(html);\n // itemsheet-panel\n //html.addEventListener(\"dragstart\", this._onDropCustom, false);\n html.find('div.itemsheet-panel').each((i, li) => {\n // //if (li.classList.contains(\"inventory-header\")) return;\n //li.setAttribute(\"draggable\", true);\n //li.addEventListener(\"drop\", handler, false);\n });\n\n\n //html.find('div.dropitem').each((i, li) => {\n // //if (li.classList.contains(\"inventory-header\")) return;\n // li.setAttribute(\"draggable\", true);\n // li.addEventListener(\"dragstart\", handler, false);\n //});\n\n // if (this.item.type == \"weapon\") {\n // html.find('.trait-create').click(this._onTraitCreate.bind(this));\n // html.find('.trait-delete').click(this._onTraitDelete.bind(this));\n // }\n\n if (this.item.type == \"career\") {\n html.find('.event-create').click(this._onCareerEventCreate.bind(this));\n html.find('.event-delete').click(this._onCareerEventDelete.bind(this));\n }\n\n else if (this.item.type == \"armor\" ||\n this.item.type == \"computer\" ||\n this.item.type == \"species\" ||\n this.item.type == \"weapon\") {\n html.find('.options-create').click(this._onOptionCreate.bind(this));\n html.find('.options-delete').click(this._onOptionDelete.bind(this));\n }\n\n if (this.item.type == \"species\") {\n html.find('.modifiers-create').click(this._onModifierEventCreate.bind(this));\n html.find('.modifiers-delete').click(this._onModifierEventDelete.bind(this));\n }\n }\n\n async _onModifierEventCreate(event) {\n event.preventDefault();\n await this._onSubmit(event);\n\n let modifiers = this.item.system.modifiers;\n let index;\n if (modifiers.length === 0) {\n modifiers = {};\n modifiers[\"0\"] = { characteristic: \"Endurance\", value: null };\n } else {\n index = Math.max(...Object.keys(modifiers));\n index++;\n modifiers[index] = { characteristic: \"Endurance\", value: null };\n }\n\n let update = {\n system: {\n modifiers: modifiers\n }\n };\n\n return this.item.update(update);\n }\n\n async _onModifierEventDelete(event) {\n event.preventDefault();\n await this._onSubmit(event);\n const element = event.currentTarget.closest(\".modifiers-part\");\n const modifiers = foundry.utils.deepClone(this.item.system.modifiers);\n let index = Number(element.dataset.modifiersPart);\n\n const newModifiers = [];\n let entries = Object.entries(modifiers);\n if (entries.length > 1) {\n for (const [key, value] of entries) {\n if (key != index)\n newModifiers.push(value);\n }\n }\n\n let update = {\n system: {\n modifiers: newModifiers\n }\n };\n \n return this.item.update(update);\n }\n\n async _onCareerEventCreate(event) {\n event.preventDefault();\n await this._onSubmit(event);\n\n let events = this.item.system.events;\n let index;\n if (events.length === 0) {\n events = {};\n events[\"0\"] = { age: \"\", description: \"\" };\n } else {\n index = Math.max(...Object.keys(events));\n index++;\n events[index] = { age: \"\", description: \"\" };\n }\n\n let update = {\n system: {\n events: events\n }\n };\n\n return this.item.update(update);\n }\n\n async _onCareerEventDelete(event) {\n event.preventDefault();\n await this._onSubmit(event);\n const element = event.currentTarget.closest(\".events-part\");\n const events = foundry.utils.deepClone(this.item.system.events);\n let index = Number(element.dataset.eventsPart);\n\n const newEvents = [];\n let entries = Object.entries(events);\n if (entries.length > 1) {\n for (const [key, value] of entries) {\n if (key != index)\n newEvents.push(value);\n }\n }\n\n let update = {\n system: {\n events: newEvents\n }\n };\n \n return this.item.update(update);\n }\n\n async _onOptionCreate(event) {\n event.preventDefault();\n await this._onSubmit(event);\n\n //const subType = event.currentTarget.dataset.subType;\n const property = event.currentTarget.dataset.property;\n\n //let options = this.item.system[subType][property];\n let options = this.item.system[property];\n let index;\n if (options.length === 0) {\n options = {};\n options[\"0\"] = { name: \"\", description: \"\" };\n } else {\n index = Math.max(...Object.keys(options));\n index++;\n options[index] = { name: \"\", description: \"\" };\n }\n\n let update = {};\n //update[`system.${subType}.${property}`] = options;\n update[`system.${property}`] = options;\n return this.item.update(update);\n }\n\n async _onOptionDelete(event) {\n event.preventDefault();\n await this._onSubmit(event);\n const element = event.currentTarget.closest(\".options-part\");\n //const subType = element.dataset.subType;\n const property = element.dataset.property;\n //const options = foundry.utils.deepClone(this.item.system[subType][property]);\n const options = foundry.utils.deepClone(this.item.system[property]);\n let index = Number(element.dataset.optionsPart);\n\n const newOptions = [];\n let entries = Object.entries(options);\n if (entries.length > 1) {\n for (const [key, value] of entries) {\n if (key != index)\n newOptions.push(value);\n }\n }\n\n let update = {};\n //update[`system.${subType}.${property}`] = newOptions;\n update[`system.${property}`] = newOptions;\n return this.item.update(update);\n }\n\n // async _onTraitCreate(event) {\n // event.preventDefault();\n // await this._onSubmit(event);\n // const traits = this.item.system.traits;\n // return this.item.update({ \"system.traits.parts\": traits.parts.concat([[\"\", \"\"]]) });\n // }\n\n // async _onTraitDelete(event) {\n // event.preventDefault();\n // await this._onSubmit(event);\n // const element = event.currentTarget.closest(\".traits-part\");\n // const traits = foundry.utils.deepClone(this.item.system.traits);\n // traits.parts.splice(Number(element.dataset.traitsPart), 1);\n // return this.item.update({ \"system.traits.parts\": traits.parts });\n // }\n\n _getSubmitData(updateData = {}) {\n const formData = foundry.utils.expandObject(super._getSubmitData(updateData));\n\n // Gestion des containers\n if (formData.hasOwnProperty(\"system\") && formData.system.hasOwnProperty(\"container\") &&\n (this.item.system.hasOwnProperty(\"equipped\"))) {\n //*console.log('-=_getSubmitData=-');\n //console.log(this.item.system.onHand);\n //console.log(formData.system.onHand);\n //const onHandChange = this.item.system.onHand !== formData.system.onHand;\n const equippedChange = this.item.system.equipped !== formData.system.equipped;\n const containerChange = this.item.system.container.id !== formData.system.container.id;\n // Maintenant équipé\n if (equippedChange) {\n if (formData.system.equipped === true) {\n //formData.system.onHand = true;\n //console.log(\"clear container\");\n formData.system.container = {\n //inContainer: false,\n id: \"\"\n };\n }\n }\n\n /*else if (onHandChange) {\n // Maintenant à portée\n if (formData.system.onHand === true) {\n //console.log(\"clear container\");\n formData.system.container = {\n inContainer: false,\n id: \"\"\n };\n } else {\n formData.system.equipped = false;\n }\n }*/\n\n else if (containerChange) {\n // Mise en storage\n if (formData.system.container.id !== \"\" && (this.item.system.container.id === \"\" || this.item.system.container.id === null)) {\n //console.log(\"put in container\");\n //formData.system.onHand = false;\n formData.system.equipped = false;\n //formData.system.container.inContainer = true;\n }\n }\n }\n\n // if (this.item.type == \"weapon\") {\n // const traits = formData.system?.traits;\n // if (traits)\n // traits.parts = Object.values(traits?.parts || {}).map(d => [d[0] || \"\", d[1] || \"\"]);\n // }\n\n // else if (this.item.type == \"career\") {\n // const events = formData.system?.events;\n // if (events)\n // events.parts = Object.values(events?.parts || {}).map(d => [d[0] || \"\", d[1] || \"\"]);\n // }\n\n // else if (this.item.type == \"equipment\") {\n // if (this.item.system.subType == \"armor\") {\n // // const armor = formData.system?.armor;\n // // if (armor)\n // // //options.parts = Object.values(options?.parts || {}).map(d => [d[0] || \"\", d[1] || \"\"]);\n // // console.log(armor.options);\n // // armor.options = Object.values(armor?.options || {})\n // // .map(d => [d.name || \"\", d.description || \"\"]);\n // // console.log(armor.options);\n // } else if (this.item.system.subType == \"computer\") {\n // const computer = formData.system?.computer;\n // if (computer)\n // //options.parts = Object.values(options?.parts || {}).map(d => [d[0] || \"\", d[1] || \"\"]);\n // computer.options = Object.values(computer?.options || {}).map(d => [d[0] || \"\", d[1] || \"\"]);\n // }\n // }\n\n if (formData.hasOwnProperty(\"weight\")) {\n formData.system.weight = MGT2Helper.convertWeightFromInput(formData.weight);\n delete formData.weight;\n }\n\n if (formData.system.hasOwnProperty(\"quantity\")) {\n formData.system.quantity = MGT2Helper.getIntegerFromInput(formData.system.quantity);\n }\n\n if (formData.system.hasOwnProperty(\"cost\")) {\n formData.system.cost = MGT2Helper.getIntegerFromInput(formData.system.cost);\n }\n //console.log(\"before flatten\");\n //console.log(formData);\n //console.log(\"after flatten\");\n // let x = foundry.utils.flattenObject(formData);;\n // console.log(x);\n // return x;\n return foundry.utils.flattenObject(formData);\n }\n}\n","class RollPromptDialog extends Dialog {\r\n constructor(dialogData = {}, options = {}) {\r\n super(dialogData, options);\r\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\", \"dialog\"];\r\n }\r\n\r\n static async create(options) {\r\n\r\n const htmlContent = await renderTemplate('systems/mgt2/templates/roll-prompt.html', {\r\n config: CONFIG.MGT2,\r\n //formula: formula,\r\n characteristics: options.characteristics,\r\n characteristic: options.characteristic,\r\n skills: options.skills,\r\n skill: options.skill,\r\n fatigue: options.fatigue,\r\n encumbrance: options.encumbrance,\r\n difficulty: options.difficulty\r\n });\r\n\r\n const results = new Promise(resolve => {\r\n new this({\r\n title: options.title,\r\n content: htmlContent,\r\n buttons: {\r\n boon: {\r\n label: game.i18n.localize(\"MGT2.RollPrompt.Boon\"),\r\n callback: (html) => {\r\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\r\n formData.diceModifier = \"dl\";\r\n resolve(formData);\r\n }\r\n },\r\n submit: {\r\n label: game.i18n.localize(\"MGT2.RollPrompt.Roll\"),\r\n icon: '',\r\n callback: (html) => {\r\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\r\n resolve(formData);\r\n },\r\n },\r\n bane: {\r\n label: game.i18n.localize(\"MGT2.RollPrompt.Bane\"),\r\n //icon: '',\r\n callback: (html) => {\r\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\r\n formData.diceModifier = \"dh\";\r\n resolve(formData);\r\n }\r\n }\r\n }\r\n //close: () => { resolve(false) }\r\n }).render(true);\r\n });\r\n\r\n //console.log(Promise.resolve(results));\r\n return results;\r\n }\r\n}\r\n\r\nexport class RollPromptHelper {\r\n\r\n static async roll(options) {\r\n return await RollPromptDialog.create(options);\r\n }\r\n\r\n static async promptForFruitTraits() {\r\n const htmlContent = await renderTemplate('systems/mgt2/templateschat/chat/roll-prompt.html');\r\n\r\n return new Promise((resolve, reject) => {\r\n const dialog = new Dialog({\r\n title: \"Fruit Traits\",\r\n content: htmlContent,\r\n buttons: {\r\n submit: {\r\n label: \"Roll\",\r\n icon: '',\r\n callback: (html) => {\r\n const formData = new FormDataExtended(html[0].querySelector('form'))\r\n .toObject();\r\n\r\n //verifyFruitInputs(formData);\r\n\r\n resolve(formData);\r\n },\r\n },\r\n skip: {\r\n label: \"Cancel\",\r\n callback: () => resolve(null),\r\n }\r\n },\r\n render: (html) => {\r\n //html.on('click', 'button[data-preset]', handleFruitPreset);\r\n },\r\n close: () => {\r\n reject('User closed dialog without making a selection.');\r\n },\r\n });\r\n\r\n dialog.render(true);\r\n });\r\n }\r\n}","class EditorFullViewDialog extends Dialog {\r\n constructor(dialogData = {}, options = {}) {\r\n super(dialogData, options);\r\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"];\r\n this.options.resizable = true;\r\n }\r\n\r\n static async create(title, html) {\r\n const htmlContent = await renderTemplate(\"systems/mgt2/templates/editor-fullview.html\", {\r\n config: CONFIG.MGT2,\r\n html: html\r\n });\r\n\r\n const results = new Promise(resolve => {\r\n new this({\r\n title: title,\r\n content: htmlContent,\r\n buttons: {\r\n //close: { label: game.i18n.localize(\"MGT2.Close\") }\r\n }\r\n }).render(true);\r\n });\r\n\r\n return results;\r\n }\r\n}\r\n\r\nclass ActorConfigDialog extends Dialog {\r\n constructor(dialogData = {}, options = {}) {\r\n super(dialogData, options);\r\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"];\r\n }\r\n\r\n static async create(system) {\r\n const htmlContent = await renderTemplate(\"systems/mgt2/templates/actors/actor-config-sheet.html\", {\r\n config: CONFIG.MGT2,\r\n system: system\r\n });\r\n\r\n const results = new Promise(resolve => {\r\n new this({\r\n title: \"Configuration\",\r\n content: htmlContent,\r\n buttons: {\r\n submit: {\r\n label: game.i18n.localize(\"MGT2.Save\"),\r\n icon: '',\r\n callback: (html) => {\r\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\r\n resolve(formData);\r\n },\r\n }\r\n }\r\n }).render(true);\r\n });\r\n\r\n return results;\r\n }\r\n}\r\n\r\nclass ActorCharacteristicDialog extends Dialog {\r\n // https://foundryvtt.wiki/en/development/api/dialog\r\n constructor(dialogData = {}, options = {}) {\r\n super(dialogData, options);\r\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"];\r\n }\r\n\r\n static async create(name, show, showMax, showAll = false) {\r\n const htmlContent = await renderTemplate(\"systems/mgt2/templates/actors/actor-config-characteristic-sheet.html\", {\r\n name: name,\r\n show: show,\r\n showMax: showMax,\r\n showAll: showAll\r\n });\r\n\r\n const results = new Promise(resolve => {\r\n new this({\r\n title: \"Configuration: \" + name,\r\n content: htmlContent,\r\n buttons: {\r\n submit: {\r\n label: game.i18n.localize(\"MGT2.Save\"),\r\n icon: '',\r\n callback: (html) => {\r\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\r\n resolve(formData);\r\n },\r\n }\r\n }\r\n }).render(true);\r\n });\r\n\r\n return results;\r\n }\r\n}\r\n\r\nclass TraitEditDialog extends Dialog {\r\n constructor(dialogData = {}, options = {}) {\r\n super(dialogData, options);\r\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"];\r\n }\r\n\r\n static async create(data) {\r\n const htmlContent = await renderTemplate(\"systems/mgt2/templates/actors/trait-sheet.html\", {\r\n config: CONFIG.MGT2,\r\n data: data\r\n });\r\n const title = data.hasOwnProperty(\"name\") && data.name !== undefined ? data.name : game.i18n.localize(\"MGT2.Actor.EditTrait\");\r\n const results = new Promise(resolve => {\r\n new this({\r\n title: title,\r\n content: htmlContent,\r\n buttons: {\r\n submit: {\r\n label: game.i18n.localize(\"MGT2.Save\"),\r\n icon: '',\r\n callback: (html) => {\r\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\r\n resolve(formData);\r\n },\r\n }\r\n //cancel: { label: \"Cancel\" }\r\n }\r\n // close: (html) => {\r\n // console.log(\"This always is logged no matter which option is chosen\");\r\n // const formData = new FormDataExtended(html[0].querySelector('form')).object;\r\n // resolve(formData);\r\n // }\r\n }).render(true);\r\n });\r\n\r\n return results;\r\n }\r\n}\r\n\r\nexport class CharacterPrompts {\r\n\r\n static async openConfig(system) {\r\n return await ActorConfigDialog.create(system);\r\n }\r\n\r\n static async openCharacteristic(name, hide, showMax, showAll = false) {\r\n return await ActorCharacteristicDialog.create(name, hide, showMax, showAll);\r\n }\r\n\r\n static async openTraitEdit(data) {\r\n return await TraitEditDialog.create(data);\r\n }\r\n\r\n static async openEditorFullView(title, html) {\r\n return await EditorFullViewDialog.create(title, html);\r\n } \r\n}","import { MGT2 } from \"../config.js\";\nimport { MGT2Helper } from \"../helper.js\";\nimport { RollPromptHelper } from \"../roll-prompt.js\";\nimport { CharacterPrompts } from \"./character-prompts.js\";\n\nexport class TravellerActorSheet extends ActorSheet {\n\n /** @inheritdoc */\n static get defaultOptions() {\n const options = super.defaultOptions;\n\n if (game.user.isGM || options.editable)\n options.dragDrop.push({ dragSelector: \".drag-item-list\", dropSelector: \".drop-item-list\" });\n\n return foundry.utils.mergeObject(options, {\n classes: [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\", \"actor\", \"character\", \"nopad\"],\n template: \"systems/mgt2/templates/actors/actor-sheet.html\",\n width: 780,\n //height: 600,\n tabs: [\n { navSelector: \".sheet-sidebar\", contentSelector: \"form\" },\n { navSelector: \"nav[data-group='characteristics']\", contentSelector: \"section.characteristics-panel\", initial: \"core\" },\n { navSelector: \"nav[data-group='inventory']\", contentSelector: \"div.tab[data-tab='inventory']\", initial: \"onhand\" }\n ]\n });\n }\n\n async getData(options) {\n const context = super.getData(options);\n //console.log(context);\n /*const context = {\n actor: this.actor,\n source: source.system\n \n }*/\n\n this._prepareCharacterItems(context);\n\n /*context.biographyHTML = await TextEditor.enrichHTML(context.data.system.biography, {\n secrets: this.actor.isOwner,\n rollData: context.rollData,\n async: true,\n relativeTo: this.actor\n });*/\n\n return context.data;\n }\n\n _prepareCharacterItems(sheetData) {\n const actorData = sheetData.data;\n actorData.isGM = game.user.isGM;\n actorData.showTrash = false;//game.user.isGM || game.settings.get(\"mgt2\", \"showTrash\");\n actorData.initiative = this.actor.getInitiative();\n\n const weapons = [];\n const armors = [];\n const augments = [];\n const computers = [];\n const softwares = [];\n const items = [];\n const equipments = [];\n\n const containerItems = [];\n const careers = [];\n const skills = [];\n const psionics = [];\n const diseases = [];\n const wounds = [];\n const contacts = [];\n\n const settings = {\n weightUnit: \"kg\",\n //weightUnit: game.settings.get(\"mgt2\", \"useWeightMetric\") ? \"kg\" : \"lb\",\n usePronouns: game.settings.get(\"mgt2\", \"usePronouns\"),\n useGender: game.settings.get(\"mgt2\", \"useGender\"),\n showLife: game.settings.get(\"mgt2\", \"showLife\")\n };\n actorData.settings = settings;\n\n const actorContainers = [];//sheetData.actor.getContainers();\n\n for (let item of sheetData.items) {\n if (item.type === \"container\") {\n actorContainers.push(item);\n } else if (item.type === \"computer\") {\n computers.push(item);\n item.subItems = [];\n if (item.system.overload === true)\n item.overloadClass = \"computer-overload\";\n }\n }\n\n actorContainers.sort(MGT2Helper.compareByName);\n\n const containers = [{ \"name\": game.i18n.localize(\"MGT2.Items.SelectAll\"), \"_id\": \"\", \"display\": game.i18n.localize(\"MGT2.Items.SelectAll\") }].concat(actorContainers);\n const containerIndex = new Map();\n\n for (let c of actorContainers) {\n containerIndex.set(c._id, c);\n\n if (c.system.weight > 0) {\n c.weight = MGT2Helper.convertWeightForDisplay(c.system.weight) + \" \" + settings.weightUnit;\n c.display = c.name.length > 12 ? `${c.name.substring(0, 12)}... (${c.weight})` : `${c.name} (${c.weight})`;\n } else {\n c.display = c.name.length > 12 ? c.name.substring(0, 12) + \"...\" : c.name;\n }\n\n if (c.system.onHand === true/* && c.system.count > 0*/)\n c.subItems = [];\n }\n\n let currentContainerView;\n if (actorData.system.containerView !== \"\") {\n currentContainerView = containerIndex.get(actorData.system.containerView);\n if (currentContainerView !== undefined) {\n actorData.containerView = currentContainerView;\n actorData.containerWeight = MGT2Helper.convertWeightForDisplay(currentContainerView.system.weight);\n } else {\n currentContainerView = null;\n actorData.containerWeight = MGT2Helper.convertWeightForDisplay(0);\n }\n } else {\n currentContainerView = null;\n actorData.containerWeight = MGT2Helper.convertWeightForDisplay(0);\n }\n\n actorData.containerShowAll = actorData.system.containerView === \"\";\n\n for (let i of sheetData.items) {\n let item = i.system;\n\n if (i.system.hasOwnProperty(\"weight\") && i.system.weight > 0) {\n if (isNaN(i.system.quantity))\n i.weight = MGT2Helper.convertWeightForDisplay(i.system.weight) + \" \" + settings.weightUnit;\n else\n i.weight = MGT2Helper.convertWeightForDisplay(i.system.weight * i.system.quantity) + \" \" + settings.weightUnit;\n }\n\n // Item in Storage\n if (item.hasOwnProperty(\"container\") && item.container.id !== \"\" && item.container.id !== undefined) {\n let container = containerIndex.get(item.container.id);\n if (container === undefined) { // container deleted\n if (actorData.containerShowAll) {\n i.containerName = \"#deleted#\";\n containerItems.push(i);\n }\n continue;\n }\n\n if (container.system.locked && !game.user.isGM) continue;\n\n if (container.system.onHand === true) {\n container.subItems.push(i);\n }\n\n if (actorData.containerShowAll || (!actorData.containerShowAll && actorData.system.containerView == item.container.id)) {\n if (container === undefined)\n i.containerName = \"#deleted#\";\n else\n i.containerName = container.name;\n\n containerItems.push(i);\n }\n\n continue;\n }\n\n if (i.system.hasOwnProperty(\"equipped\")) {\n i.canEquip = true;\n if (i.system.equipped === true)\n i.toggleClass = \"active\";\n } else {\n i.canEquip = false;\n }\n\n switch (i.type) {\n case \"equipment\":\n switch (i.system.subType) {\n case \"augment\":\n augments.push(i);\n break;\n\n default:\n equipments.push(i);\n break;\n }\n break;\n\n case \"armor\":\n armors.push(i);\n if (i.system.options && i.system.options.length > 0) {\n i.subInfo = i.system.options.map(x => x.name).join(\", \");\n }\n break;\n\n case \"computer\":\n //computers.push(i);\n if (i.system.options && i.system.options.length > 0) {\n i.subInfo = i.system.options.map(x => x.name).join(\", \");\n }\n break;\n\n case \"item\":\n if (i.system.subType === \"software\") {\n if (i.system.software.computerId && i.system.software.computerId !== \"\") {\n const computer = computers.find(x => x._id === i.system.software.computerId);\n if (computer !== undefined)\n computer.subItems.push(i);\n else\n softwares.push(i);\n } else {\n if (i.system.software.bandwidth > 0)\n i.display = `${i.name} (${i.system.software.bandwidth})`;\n else\n i.display = i.name;\n softwares.push(i);\n }\n } else {\n items.push(i);\n }\n break;\n\n case \"weapon\":\n if (i.system.range.isMelee)\n i.range = game.i18n.localize(\"MGT2.Melee\")\n else {\n i.range = MGT2Helper.getRangeDisplay(i.system.range);\n }\n\n // Traits\n // if (i.system.traits == undefined)\n // i.system.traits = {\n // parts: []\n // };\n\n // let traits = i.system.traits.parts.map(x => x[0]);\n\n // traits.sort();\n // i.traits = traits.join(\", \");\n // if (i.system.options && i.system.options.length > 0) {\n // i.subInfo = i.system.options.map(x => x.name).join(\", \");\n // }\n if (i.system.traits && i.system.traits.length > 0) {\n i.subInfo = i.system.traits.map(x => x.name).join(\", \");\n }\n\n weapons.push(i);\n break;\n\n case \"career\":\n careers.push(i);\n break;\n\n case \"contact\":\n contacts.push(i);\n break;\n\n case \"disease\":\n switch (i.system.subType) {\n case \"wound\":\n wounds.push(i);\n break;\n\n default:\n diseases.push(i);\n break;\n }\n break;\n\n case \"talent\":\n if (i.system.subType === \"skill\") {\n skills.push(i);\n } else {\n if (MGT2Helper.hasValue(i.system.psionic, \"reach\")) {\n i.reach = game.i18n.localize(`MGT2.PsionicReach.${i.system.psionic.reach}`);\n }\n\n if (MGT2Helper.hasValue(i.system.roll, \"difficulty\")) {\n i.difficulty = game.i18n.localize(`MGT2.Difficulty.${i.system.roll.difficulty}`);\n //i.difficulty = MGT2Helper.getDifficultyDisplay(i.system.roll.difficulty);\n }\n psionics.push(i);\n }\n break;\n\n case \"container\":\n if (i.system.onHand === true) {\n items.push(i);\n // sous item\n }\n break;\n }\n }\n\n // let weight = MGT2Helper.getItemsWeight(weapons) +\n // MGT2Helper.getItemsWeight(augments) +\n // MGT2Helper.getItemsWeight(armors) +\n // MGT2Helper.getItemsWeight(computers) +\n // MGT2Helper.getItemsWeight(items);\n\n //let containerWeight = MGT2Helper.getItemsWeight(containerItems);\n\n actorData.encumbranceNormal = MGT2Helper.convertWeightForDisplay(actorData.system.inventory.encumbrance.normal);\n actorData.encumbranceHeavy = MGT2Helper.convertWeightForDisplay(actorData.system.inventory.encumbrance.heavy);\n //actorData.weight = MGT2Helper.convertWeightForDisplay(weight); // actorData.system.inventory.weight\n //actorData.containerWeight = MGT2Helper.convertWeightForDisplay(containerWeight);\n //actorData.dropInContainer = \n\n if (actorData.system.inventory.weight > actorData.system.inventory.encumbrance.heavy) {\n actorData.encumbranceClasses = \"encumbrance-heavy\"\n actorData.encumbrance = 2;\n } else if (actorData.system.inventory.weight > actorData.system.inventory.encumbrance.normal) {\n actorData.encumbranceClasses = \"encumbrance-normal\"\n actorData.encumbrance = 1;\n } else {\n actorData.encumbrance = 0;\n }\n\n if (softwares.length > 0) {\n softwares.sort(MGT2Helper.compareByName);\n actorData.softwares = softwares;\n }\n\n augments.sort(this.compareEquippedByName);\n actorData.augments = augments;\n\n armors.sort(this.compareEquippedByName);\n actorData.armors = armors;\n\n computers.sort(this.compareEquippedByName);\n actorData.computers = computers;\n\n //careers.sort(this.compareByName);\n actorData.careers = careers; // First In First Out\n\n contacts.sort(MGT2Helper.compareByName);\n actorData.contacts = contacts;\n\n containers.sort(MGT2Helper.compareByName);\n actorData.containers = containers;\n\n diseases.sort(MGT2Helper.compareByName);\n actorData.diseases = diseases;\n\n actorData.wounds = wounds;\n\n equipments.sort(this.compareEquippedByName);\n actorData.equipments = equipments;\n\n items.sort(this.compareEquippedByName);\n actorData.items = items;\n\n actorContainers.sort(MGT2Helper.compareByName);\n actorData.actorContainers = actorContainers;\n\n skills.sort(MGT2Helper.compareByName);\n actorData.skills = skills;\n\n psionics.sort(MGT2Helper.compareByName);\n actorData.psionics = psionics;\n\n weapons.sort(this.compareEquippedByName);\n actorData.weapons = weapons;\n\n if (containerItems.length > 0) {\n containerItems.sort((a, b) => {\n const containerResult = a.containerName.localeCompare(b.containerName);\n if (containerResult !== 0) return containerResult;\n\n return a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n });\n }\n\n actorData.containerItems = containerItems;\n }\n\n compareEquippedByName(a, b) {\n //if (a.system.hasOwnProperty(\"equipped\") && !b.system.hasOwnProperty(\"equipped\")) return -1;\n //if (!a.system.hasOwnProperty(\"equipped\") && b.system.hasOwnProperty(\"equipped\")) return 1;\n\n //if (a.system.equipped === true && b.system.equipped === false) return -1;\n //if (a.system.equipped === false && b.system.equipped === true) return 1;\n\n return a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n }\n\n activateListeners(html) {\n super.activateListeners(html);\n\n // Everything below here is only needed if the sheet is editable\n if (!this.options.editable) return;\n\n // if (this.actor.isOwner) {\n // let handler = ev => this._onDragStart(ev);\n\n // html.find('div.dropitem').each((i, e) => {\n // //if (li.classList.contains(\"inventory-header\")) return;\n // e.setAttribute(\"draggable\", true);\n // e.addEventListener(\"dragstart\", handler, false);\n // });\n // }\n\n html.find('.container-create').click(this._onContainerCreate.bind(this));\n html.find('.container-edit').click(ev => {\n const container = this.actor.getEmbeddedDocument(\"Item\", this.actor.system.containerView);\n container.sheet.render(true);\n });\n\n html.find('.container-delete').click(ev => {\n ev.preventDefault();\n const containers = this.actor.getContainers();\n const container = containers.find(x => x._id == this.actor.system.containerView);\n const containerItems = this.actor.items.filter(x => x.system.hasOwnProperty(\"container\") && x.system.container.id === container._id);\n\n if (containerItems.length > 0) {\n for (let item of containerItems) {\n let clone = duplicate(item);\n clone.system.container.id = \"\";\n this.actor.updateEmbeddedDocuments('Item', [clone]);\n }\n }\n\n const cloneActor = duplicate(this.actor);\n cloneActor.system.containerView = \"\";\n if (cloneActor.system.containerDropIn === container._id) {\n cloneActor.system.containerDropIn = \"\";\n const remainingContainers = containers.filter(x => x._id !== container._id);\n if (remainingContainers.length > 0)\n cloneActor.system.containerDropIn = remainingContainers[0]._id;\n }\n this.actor.deleteEmbeddedDocuments(\"Item\", [container._id]);\n this.actor.update(cloneActor);\n });\n\n html.find('.item-create').click(this._onItemCreate.bind(this));\n html.find('.item-edit').click(ev => {\n ev.preventDefault();\n const html = $(ev.currentTarget).parents(\"[data-item-id]\");\n const item = this.actor.getEmbeddedDocument(\"Item\", html.data(\"itemId\"));\n item.sheet.render(true);\n });\n\n html.find('.item-delete').click(ev => {\n ev.preventDefault();\n const html = $(ev.currentTarget).parents(\"[data-item-id]\");\n // ev.ctrlKey === true\n\n this.actor.deleteEmbeddedDocuments(\"Item\", [html.data(\"itemId\")]);\n html.slideUp(200, () => this.render(false));\n });\n html.find('a.item-equip').click(this._onItemEquip.bind(this));\n html.find('a.item-storage-out').click(this._onItemStorageOut.bind(this));\n html.find('a.item-storage-in').click(this._onItemStorageIn.bind(this));\n html.find('a.software-eject').click(this._onSoftwareEject.bind(this));\n\n html.find('a[data-roll]').click(this._onRoll.bind(this));\n html.find('a[name=\"config\"]').click(this._onOpenConfig.bind(this));\n html.find('a[data-cfg-characteristic]').click(this._onOpenCharacteristic.bind(this));\n html.find('.traits-create').click(this._onTraitCreate.bind(this));\n html.find('.traits-edit').click(this._onTraitEdit.bind(this));\n html.find('.traits-delete').click(this._onTraitDelete.bind(this));\n html.find('a[data-editor=\"open\"]').click(this._onOpenEditor.bind(this));\n };\n\n async _onOpenEditor(event) {\n event.preventDefault();\n await CharacterPrompts.openEditorFullView(this.actor.system.personal.species, this.actor.system.personal.speciesText.descriptionLong);\n }\n\n async _onTraitCreate(event) {\n event.preventDefault();\n await this._onSubmit(event);\n let traits = this.actor.system.personal.traits;\n let index;\n if (traits.length === 0) {\n traits = {};\n traits[\"0\"] = { name: \"\", description: \"\" };\n } else {\n index = Math.max(...Object.keys(traits));\n index++;\n traits[index] = { name: \"\", description: \"\" };\n }\n\n return this.actor.update({ system: { personal: { traits: traits } } });\n }\n\n async _onTraitEdit(event) {\n event.preventDefault();\n const index = $(event.currentTarget).parents(\"[data-traits-part]\").data(\"traits-part\");\n const trait = this.actor.system.personal.traits[index];\n let result = await CharacterPrompts.openTraitEdit(trait);\n const traits = this.actor.system.personal.traits;\n traits[index].name = result.name;\n traits[index].description = result.description;\n return this.actor.update({ system: { personal: { traits: traits } } });\n }\n\n async _onTraitDelete(event) {\n event.preventDefault();\n await this._onSubmit(event);\n const element = event.currentTarget.closest(\".traits-part\");\n const traits = foundry.utils.deepClone(this.actor.system.personal.traits);\n let index = Number(element.dataset.traitsPart);\n\n const newTraits = [];\n let entries = Object.entries(traits);\n if (entries.length > 1) {\n for (const [key, value] of entries) {\n if (key != index)\n newTraits.push(value);\n }\n }\n\n return this.actor.update({ system: { personal: { traits: newTraits } } });\n }\n\n async _onOpenConfig(ev) {\n ev.preventDefault();\n //console.log(this.actor.system);\n const userConfig = await CharacterPrompts.openConfig(this.actor.system);\n //console.log(userData);\n // {initiative: 'dexterity', damage.rank1: 'strength', damage.rank2: 'dexterity', damage.rank3: 'endurance'}\n if (userConfig) {\n this.actor.update({ \"system.config\": userConfig });\n }\n }\n\n async _onOpenCharacteristic(ev) {\n ev.preventDefault();\n const name = ev.currentTarget.dataset.cfgCharacteristic;\n const c = this.actor.system.characteristics[name];\n\n let showAll = false;\n for (const [key, value] of Object.entries(this.actor.system.characteristics)) {\n if (!value.show) {\n showAll = true;\n break;\n }\n }\n\n const userConfig = await CharacterPrompts.openCharacteristic(game.i18n.localize(`MGT2.Characteristics.${name}.name`), c.show, c.showMax, showAll);\n\n // {hide: false, showMax: true, showAll: false}\n if (userConfig) {\n const data = {\n system: {\n characteristics: {}\n }\n };\n\n data.system.characteristics[name] = {\n show: userConfig.show,\n showMax: userConfig.showMax\n };\n\n if (userConfig.showAll === true) {\n for (const [key, value] of Object.entries(this.actor.system.characteristics)) {\n if (key !== name && !value.show) {\n data.system.characteristics[key] = { show: true };\n }\n }\n }\n\n this.actor.update(data);\n }\n }\n\n async _onRoll(event) {\n event.preventDefault();\n\n const rollOptions = {\n rollTypeName: game.i18n.localize(\"MGT2.RollPrompt.Roll\"),\n rollObjectName: \"\",\n characteristics: [{ _id: \"\", name: \"\" }],\n characteristic: \"\",\n skills: [],\n skill: \"\",\n fatigue: this.actor.system.states.fatigue,\n encumbrance: this.actor.system.states.encumbrance,\n difficulty: null,\n damageFormula: null\n };\n\n // TODO Convertir le bouton des dégâts\n const cardButtons = [];\n\n for (const [key, label] of Object.entries(MGT2.Characteristics)) {\n const c = this.actor.system.characteristics[key];\n if (c.show) {\n rollOptions.characteristics.push({ _id: key, name: game.i18n.localize(label) + MGT2Helper.getDisplayDM(c.dm) });\n }\n }\n\n for (let item of this.actor.items) {\n if (item.type === \"talent\") {\n if (item.system.subType === \"skill\")\n rollOptions.skills.push({ _id: item._id, name: item.getRollDisplay() });\n }\n }\n\n rollOptions.skills.sort(MGT2Helper.compareByName);\n rollOptions.skills = [{ _id: \"NP\", name: game.i18n.localize(\"MGT2.Items.NotProficient\") }].concat(rollOptions.skills);\n\n let itemObj = null;\n let isInitiative = false;\n const button = event.currentTarget;\n if (button.dataset.roll === \"initiative\") {\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.RollPrompt.InitiativeRoll\");\n rollOptions.characteristic = this.actor.system.config.initiative;\n isInitiative = true;\n } else if (button.dataset.roll === \"characteristic\") {\n rollOptions.characteristic = button.dataset.rollCharacteristic;\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.RollPrompt.CharacteristicRoll\");\n rollOptions.rollObjectName = game.i18n.localize(`MGT2.Characteristics.${rollOptions.characteristic}.name`);\n } else {\n\n if (button.dataset.roll === \"skill\") {\n rollOptions.skill = button.dataset.rollSkill;\n itemObj = this.actor.getEmbeddedDocument(\"Item\", rollOptions.skill);\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.RollPrompt.SkillRoll\");\n rollOptions.rollObjectName = itemObj.name;\n } else {\n if (button.dataset.roll === \"psionic\") {\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.RollPrompt.PsionicRoll\");\n }\n }\n\n if (itemObj === null && button.dataset.itemId) {\n itemObj = this.actor.getEmbeddedDocument(\"Item\", button.dataset.itemId);\n rollOptions.rollObjectName = itemObj.name;\n if (itemObj.type === \"weapon\")\n rollOptions.rollTypeName = game.i18n.localize(\"TYPES.Item.weapon\");\n else if (itemObj.type === \"armor\")\n rollOptions.rollTypeName = game.i18n.localize(\"TYPES.Item.armor\");\n else if (itemObj.type === \"computer\")\n rollOptions.rollTypeName = game.i18n.localize(\"TYPES.Item.computer\");\n }\n\n if (button.dataset.roll === \"psionic\") {\n rollOptions.rollObjectName = itemObj.name;\n if (MGT2Helper.hasValue(itemObj.system.psionic, \"duration\")) {\n cardButtons.push({\n label: game.i18n.localize(\"MGT2.Items.Duration\"),\n formula: itemObj.system.psionic.duration,\n message: {\n objectName: itemObj.name,\n flavor: \"{0} \".concat(game.i18n.localize(`MGT2.Durations.${itemObj.system.psionic.durationUnit}`)) \n }\n });\n }\n }\n\n if (itemObj.system.hasOwnProperty(\"damage\")) {\n rollOptions.damageFormula = itemObj.system.damage;\n if (itemObj.type === \"disease\") {\n if (itemObj.system.subTypetype === \"disease\") {\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.DiseaseSubType.disease\");\n } else if (itemObj.system.subTypetype === \"poison\") {\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.DiseaseSubType.poison\");\n }\n }\n }\n\n if (itemObj.system.hasOwnProperty(\"roll\")) {\n if (MGT2Helper.hasValue(itemObj.system.roll, \"characteristic\")) {\n rollOptions.characteristic = itemObj.system.roll.characteristic;\n }\n\n if (MGT2Helper.hasValue(itemObj.system.roll, \"skill\")) {\n rollOptions.skill = itemObj.system.roll.skill;\n }\n\n if (MGT2Helper.hasValue(itemObj.system.roll, \"difficulty\")) {\n rollOptions.difficulty = itemObj.system.roll.difficulty;\n }\n }\n }\n\n const userRollData = await RollPromptHelper.roll(rollOptions);\n\n const rollModifiers = [];\n const rollFormulaParts = [];\n if (userRollData.diceModifier) {\n rollFormulaParts.push(\"3d6\");\n rollFormulaParts.push(userRollData.diceModifier);\n } else {\n rollFormulaParts.push(\"2d6\");\n }\n\n if (userRollData.hasOwnProperty(\"characteristic\") && userRollData.characteristic !== \"\") {\n let c = this.actor.system.characteristics[userRollData.characteristic];\n let dm = c.dm;\n rollFormulaParts.push(MGT2Helper.getFormulaDM(dm));\n rollModifiers.push(game.i18n.localize(`MGT2.Characteristics.${userRollData.characteristic}.name`) + MGT2Helper.getDisplayDM(dm));\n }\n\n if (userRollData.hasOwnProperty(\"skill\") && userRollData.skill !== \"\") {\n if (userRollData.skill === \"NP\") {\n rollFormulaParts.push(\"-3\");\n rollModifiers.push(game.i18n.localize(\"MGT2.Items.NotProficient\"));\n } else {\n const skillObj = this.actor.getEmbeddedDocument(\"Item\", userRollData.skill);\n rollFormulaParts.push(MGT2Helper.getFormulaDM(skillObj.system.level));\n rollModifiers.push(skillObj.getRollDisplay());\n }\n }\n\n if (userRollData.hasOwnProperty(\"psionic\") && userRollData.psionic !== \"\") {\n let psionicObj = this.actor.getEmbeddedDocument(\"Item\", userRollData.psionic);\n rollFormulaParts.push(MGT2Helper.getFormulaDM(psionicObj.system.level));\n rollModifiers.push(psionicObj.getRollDisplay());\n }\n\n if (userRollData.hasOwnProperty(\"timeframes\") &&\n userRollData.timeframes !== \"\" &&\n userRollData.timeframes !== \"Normal\") {\n rollModifiers.push(game.i18n.localize(`MGT2.Timeframes.${userRollData.timeframes}`));\n rollFormulaParts.push(userRollData.timeframes === \"Slower\" ? \"+2\" : \"-2\");\n }\n\n if (userRollData.hasOwnProperty(\"encumbrance\") && userRollData.encumbrance === true) {\n rollFormulaParts.push(\"-2\");\n\n rollModifiers.push(game.i18n.localize(\"MGT2.Actor.Encumbrance\") + \" -2\");\n }\n\n if (userRollData.hasOwnProperty(\"fatigue\") && userRollData.fatigue === true) {\n rollFormulaParts.push(\"-2\");\n rollModifiers.push(game.i18n.localize(\"MGT2.Actor.Fatigue\") + \" -2\");\n }\n\n if (userRollData.hasOwnProperty(\"customDM\") && userRollData.customDM !== \"\") {\n let s = userRollData.customDM.trim();\n if (/^[0-9]/.test(s))\n rollFormulaParts.push(\"+\");\n rollFormulaParts.push(s);\n }\n\n if (MGT2Helper.hasValue(userRollData, \"difficulty\")) {\n rollOptions.difficulty = userRollData.difficulty;\n }\n\n const rollData = this.actor.getRollData();\n\n const rollFormula = rollFormulaParts.join(\"\");\n\n if (!Roll.validate(rollFormula)) {\n ui.notifications.error(game.i18n.localize(\"MGT2.Errors.InvalidRollFormula\"));\n return;\n }\n\n let roll = await new Roll(rollFormula, rollData).roll({ async: true, rollMode: userRollData.rollMode });\n\n if (isInitiative && this.token && this.token.combatant) {\n await this.token.combatant.update({ initiative: roll.total });\n }\n\n let isPrivate = false;\n //let flavor = \"Roule!\";\n const chatData = {\n user: game.user.id,\n speaker: this.actor ? ChatMessage.getSpeaker({ actor: this.actor }) : null,\n formula: isPrivate ? \"???\" : roll._formula,\n //flavor: isPrivate ? null : flavor,\n tooltip: isPrivate ? \"\" : await roll.getTooltip(),\n total: isPrivate ? \"?\" : Math.round(roll.total * 100) / 100,\n type: CONST.CHAT_MESSAGE_TYPES.ROLL,\n showButtons: true,\n showLifeButtons: false,\n showRollRequest: false,\n rollTypeName: rollOptions.rollTypeName,\n rollObjectName: rollOptions.rollObjectName,\n rollModifiers: rollModifiers,\n showRollDamage: rollOptions.damageFormula !== null && rollOptions.damageFormula !== \"\",\n cardButtons: cardButtons\n };\n\n if (MGT2Helper.hasValue(rollOptions, \"difficulty\")) {\n chatData.rollDifficulty = rollOptions.difficulty;\n chatData.rollDifficultyLabel = game.i18n.localize(`MGT2.Difficulty.${rollOptions.difficulty}`);\n \n if (roll.total >= MGT2Helper.getDifficultyValue(rollOptions.difficulty)) {\n chatData.rollSuccess = true;\n } else {\n chatData.rollFailure = true;\n }\n }\n\n const html = await renderTemplate(\"systems/mgt2/templates/chat/roll.html\", chatData);\n chatData.content = html;\n\n let flags = null;\n\n if (rollOptions.damageFormula !== null && rollOptions.damageFormula !== \"\") {\n flags = { mgt2: { damage: { formula: rollOptions.damageFormula, rollObjectName: rollOptions.rollObjectName, rollTypeName: rollOptions.rollTypeName } } };\n }\n\n if (cardButtons.length > 0) {\n if (flags === null) flags = { mgt2: {} };\n flags.mgt2.buttons = cardButtons;\n }\n\n if (flags !== null)\n chatData.flags = flags;\n\n return roll.toMessage(chatData);\n }\n\n _onItemCreate(ev) {\n ev.preventDefault();\n const html = $(ev.currentTarget);\n\n const data = {\n name: html.data(\"create-name\"),\n type: html.data(\"type-item\")\n };\n\n if (html.data(\"subtype\")) {\n data.system = {\n subType: html.data(\"subtype\")\n };\n }\n\n const cls = getDocumentClass(\"Item\");\n\n return cls.create(data, { parent: this.actor });\n }\n\n _onItemEquip(ev) {\n ev.preventDefault();\n const html = $(ev.currentTarget).parents(\"[data-item-id]\");\n const item = duplicate(this.actor.getEmbeddedDocument(\"Item\", html.data(\"itemId\")));\n item.system.equipped = !item.system.equipped;\n this.actor.updateEmbeddedDocuments('Item', [item]);\n }\n\n _onItemStorageIn(ev) {\n ev.preventDefault();\n const html = $(ev.currentTarget).parents(\"[data-item-id]\");\n const item = duplicate(this.actor.getEmbeddedDocument(\"Item\", html.data(\"itemId\")));\n if (item.type === \"container\") {\n item.system.onHand = false;\n } else {\n let container;\n const containers = this.actor.getContainers();\n if (this.actor.system.containerDropIn == \"\" || this.actor.system.containerDropIn === null) {\n // Placer dans le premier container\n if (containers.length === 0) {\n // Create default container\n const cls = getDocumentClass(\"Item\");\n container = cls.create({ name: game.i18n.localize(\"MGT2.Actor.NewContainer\"), type: \"container\" }, { parent: this.actor });\n } else {\n container = containers[0];\n }\n } else {\n container = containers.find(x => x._id == this.actor.system.containerDropIn);\n }\n\n if (container.system.locked) {\n if (game.user.isGM) {\n item.system.container.id = container._id;\n } else {\n ui.notifications.error(\"Objet verrouillé\");\n }\n } else {\n item.system.container.id = container._id;\n }\n\n }\n this.actor.updateEmbeddedDocuments('Item', [item]);\n }\n\n _onItemStorageOut(ev) {\n ev.preventDefault();\n const html = $(ev.currentTarget).parents(\"[data-item-id]\");\n const item = duplicate(this.actor.getEmbeddedDocument(\"Item\", html.data(\"itemId\")));\n item.system.container.id = \"\";\n //item.system.container.inContainer = false;\n this.actor.updateEmbeddedDocuments('Item', [item]);\n }\n\n _onSoftwareEject(ev) {\n ev.preventDefault();\n const html = $(ev.currentTarget).parents(\"[data-item-id]\");\n const item = duplicate(this.actor.getEmbeddedDocument(\"Item\", html.data(\"itemId\")));\n item.system.software.computerId = \"\";\n this.actor.updateEmbeddedDocuments('Item', [item]);\n }\n\n _onContainerCreate(ev) {\n ev.preventDefault();\n const cls = getDocumentClass(\"Item\");\n return cls.create({ name: game.i18n.localize(\"MGT2.Actor.NewContainer\"), type: \"container\" }, { parent: this.actor });\n }\n\n _canDragDrop(selector) {\n return this.isEditable;\n }\n\n async _onDrop(event) {\n //console.log(\"_onDrop\");\n //console.log(event);\n event.preventDefault();\n event.stopImmediatePropagation();\n const dropData = MGT2Helper.getDataFromDropEvent(event);\n if (!dropData) return false;\n\n const sourceItemData = await MGT2Helper.getItemDataFromDropData(dropData);\n\n if (sourceItemData.type === \"species\") {\n const update = {\n system: {\n personal: {\n species: sourceItemData.name,\n speciesText: {\n description: sourceItemData.system.description,\n descriptionLong: sourceItemData.system.descriptionLong\n },\n }\n }\n };\n\n update.system.personal.traits = this.actor.system.personal.traits.concat(sourceItemData.system.traits);\n\n // characteristics\n if (sourceItemData.system.modifiers && sourceItemData.system.modifiers.length > 0) {\n update.system.characteristics = {};\n for (let modifier of sourceItemData.system.modifiers) {\n if (MGT2Helper.hasValue(modifier, \"characteristic\") && MGT2Helper.hasValue(modifier, \"value\")) {\n const c = this.actor.system.characteristics[modifier.characteristic];\n const updateValue = { value: c.value };\n updateValue.value += modifier.value;\n if (c.showMax) {\n updateValue.max = c.max + modifier.value;\n }\n\n update.system.characteristics[modifier.characteristic] = updateValue;\n }\n }\n\n // recalcul modifier?\n }\n\n this.actor.update(update);\n\n return true;\n }\n\n // Simple drop\n if (sourceItemData.type === \"contact\" || sourceItemData.type === \"disease\" ||\n sourceItemData.type === \"career\" || sourceItemData.type === \"talent\") {\n let transferData = {};\n try {\n transferData = sourceItemData.toJSON();\n } catch (err) {\n transferData = sourceItemData;\n }\n\n delete transferData._id;\n delete transferData.id;\n await this.actor.createEmbeddedDocuments(\"Item\", [transferData]);\n return true;\n }\n\n // Supported drop (don't drop vehicule stuff)\n if (sourceItemData.type !== \"armor\" && sourceItemData.type !== \"weapon\" &&\n sourceItemData.type !== \"computer\" && sourceItemData.type !== \"container\" &&\n sourceItemData.type !== \"item\" && sourceItemData.type !== \"equipment\") return false;\n\n const target = event.target.closest(\".table-row\");\n let targetId = null;\n let targetItem = null;\n\n if (target !== null && target !== undefined) {\n targetId = target.dataset.itemId;\n targetItem = this.actor.getEmbeddedDocument(\"Item\", targetId);\n }\n\n let sourceItem = this.actor.getEmbeddedDocument(\"Item\", sourceItemData.id);\n if (sourceItem) { // same actor item move\n if (targetItem === null || targetItem === undefined) return false;\n\n sourceItem = duplicate(sourceItem);\n if (sourceItem._id === targetId) return false; // Same item\n\n if (targetItem.type === \"item\" || targetItem.type === \"equipment\") {\n // SOFTWARE --> COMPUTER\n if (targetItem.system.subType === \"software\") {\n sourceItem.system.software.computerId = targetItem.system.software.computerId;\n } else {\n sourceItem.system.container.id = targetItem.system.container.id;\n }\n this.actor.updateEmbeddedDocuments('Item', [sourceItem]);\n return true;\n } else if (targetItem.type === \"computer\") {\n sourceItem.system.software.computerId = targetId;\n this.actor.updateEmbeddedDocuments('Item', [sourceItem]);\n return true;\n } else if (targetItem.type === \"container\") {\n // locked refuse\n if (targetItem.system.locked && !game.user.isGM)\n ui.notifications.error(\"Verrouillé\");\n else {\n sourceItem.system.container.id = targetId;\n this.actor.updateEmbeddedDocuments('Item', [sourceItem]);\n return true;\n }\n }\n } else {\n // Copy item from other source\n let transferData = {};\n try {\n transferData = sourceItemData.toJSON();\n } catch (err) {\n transferData = sourceItemData;\n }\n\n //const sourceItemId = transferData._id;\n\n delete transferData._id;\n delete transferData.id;\n\n const recalcWeight = transferData.system.hasOwnProperty(\"weight\");\n\n // Normalize data\n if (transferData.system.hasOwnProperty(\"container\"))\n transferData.system.container.id = \"\";\n if (transferData.type === \"item\" && transferData.system.subType === \"software\")\n transferData.system.software.computerId = \"\";\n\n if (transferData.type === \"container\")\n transferData.onHand = true;\n\n if (transferData.system.hasOwnProperty(\"equipment\"))\n transferData.system.equipped = false;\n\n\n if (targetItem !== null) {\n // Handle computer & container\n if (transferData.type === \"item\" && transferData.system.subType === \"software\") {\n if (targetItem.type === \"item\" && targetItem.system.subType === \"software\") {\n transferData.system.software.computerId = targetItem.system.software.computerId;\n\n } else if (targetItem.type === \"computer\") {\n transferData.system.software.computerId = targetItem._id;\n }\n } else if (transferData.type === \"armor\" || transferData.type === \"computer\" || transferData.type === \"equipment\" || transferData.type === \"item\" || transferData.type === \"weapon\") {\n if (targetItem.type === \"container\") {\n if (!targetItem.system.locked || game.user.isGM) {\n transferData.system.container.id = targetId;\n }\n } else {\n if (MGT2Helper.hasValue(targetItem.system.container, \"id\"))\n transferData.system.container.id = targetItem.system.container.id;\n else\n transferData.system.container.id = \"\";\n }\n }\n }\n\n const addedItem = (await this.actor.createEmbeddedDocuments(\"Item\", [transferData]))[0];\n\n if (transferData.actor) {\n // delete item\n // if container, tranferts content onHand true\n }\n\n\n if (recalcWeight) {\n await this.actor.recalculateWeight(this.actor);\n }\n }\n return true;\n }\n\n _getSubmitData(updateData = {}) {\n const formData = foundry.utils.expandObject(super._getSubmitData(updateData));\n // this.actor.computeCharacteristics(formData);\n return foundry.utils.flattenObject(formData);\n }\n}\n","/**\r\n * Define a set of template paths to pre-load\r\n * Pre-loaded templates are compiled and cached for fast access when rendering\r\n * @return {Promise}\r\n */\r\nexport const preloadHandlebarsTemplates = async function() {\r\n\r\n const templatePaths = [\r\n \"systems/mgt2/templates/items/parts/sheet-configuration.html\",\r\n \"systems/mgt2/templates/items/parts/sheet-physical-item.html\",\r\n \"systems/mgt2/templates/roll-prompt.html\",\r\n \"systems/mgt2/templates/chat/roll.html\",\r\n //\"systems/mgt2/templates/chat/roll-characteristic.html\",\r\n \"systems/mgt2/templates/actors/actor-config-sheet.html\",\r\n \"systems/mgt2/templates/actors/actor-config-characteristic-sheet.html\",\r\n \"systems/mgt2/templates/actors/trait-sheet.html\",\r\n \"systems/mgt2/templates/editor-fullview.html\"\r\n //\"systems/mgt2/templates/actors/parts/actor-characteristic.html\"\r\n ];\r\n \r\n return loadTemplates(templatePaths);\r\n };","import { MGT2Helper } from \"./helper.js\";\r\n\r\nexport class ChatHelper {\r\n\r\n\r\n // _injectContent(message, type, html) {\r\n\r\n // _setupCardListeners(message, html);\r\n\r\n // }\r\n\r\n\r\n static setupCardListeners(message, html, messageData) {\r\n if (!message || !html) {\r\n return;\r\n }\r\n // if (SettingsUtility.getSettingValue(SETTING_NAMES.MANUAL_DAMAGE_MODE) > 0) {\r\n // html.find('.card-buttons').find(`[data-action='rsr-${ROLL_TYPE.DAMAGE}']`).click(async event => {\r\n // await _processDamageButtonEvent(message, event);\r\n // });\r\n // }\r\n html.find('button[data-action=\"rollDamage\"]').click(async event => {\r\n //ui.notifications.warn(\"rollDamage\");\r\n await this._processRollDamageButtonEvent(message, event);\r\n });\r\n\r\n html.find('button[data-action=\"damage\"]').click(async event => {\r\n //ui.notifications.warn(\"damage\");\r\n await this._applyChatCardDamage(message, event);\r\n //await _processApplyButtonEvent(message, event);\r\n });\r\n\r\n html.find('button[data-action=\"healing\"]').click(async event => {\r\n ui.notifications.warn(\"healing\");\r\n //await _processApplyTotalButtonEvent(message, event);\r\n });\r\n\r\n html.find('button[data-index]').click(async event => {\r\n \r\n await this._processRollButtonEvent(message, event);\r\n });\r\n }\r\n\r\n static async _processRollButtonEvent(message, event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n let buttons = message.flags.mgt2.buttons;\r\n const index = event.target.dataset.index;\r\n const button = buttons[index];\r\n let roll = await new Roll(button.formula, {}).roll({ async: true });\r\n //console.log(message);\r\n\r\n const chatData = {\r\n user: game.user.id,\r\n speaker: message.speaker,\r\n formula: roll._formula,\r\n tooltip: await roll.getTooltip(),\r\n total: Math.round(roll.total * 100) / 100,\r\n //formula: isPrivate ? \"???\" : roll._formula,\r\n //tooltip: isPrivate ? \"\" : await roll.getTooltip(),\r\n //total: isPrivate ? \"?\" : Math.round(roll.total * 100) / 100,\r\n type: CONST.CHAT_MESSAGE_TYPES.ROLL,\r\n rollObjectName: button.message.objectName,\r\n rollMessage: MGT2Helper.format(button.message.flavor, Math.round(roll.total * 100) / 100),\r\n };\r\n\r\n const html = await renderTemplate(\"systems/mgt2/templates/chat/roll.html\", chatData);\r\n chatData.content = html;\r\n return roll.toMessage(chatData);\r\n }\r\n\r\n static async _processRollDamageButtonEvent(message, event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n let rollFormula = message.flags.mgt2.damage.formula;\r\n\r\n let roll = await new Roll(rollFormula, {}).roll({ async: true });\r\n\r\n let speaker;\r\n let selectTokens = canvas.tokens.controlled;\r\n if (selectTokens.length > 0) {\r\n speaker = selectTokens[0].actor;\r\n } else {\r\n speaker = game.user.character;\r\n }\r\n\r\n let rollTypeName = message.flags.mgt2.damage.rollTypeName ? message.flags.mgt2.damage.rollTypeName + \" DAMAGE\" : null;\r\n\r\n const chatData = {\r\n user: game.user.id,\r\n speaker: ChatMessage.getSpeaker({ actor: speaker }),\r\n formula: roll._formula,\r\n tooltip: await roll.getTooltip(),\r\n total: Math.round(roll.total * 100) / 100,\r\n type: CONST.CHAT_MESSAGE_TYPES.ROLL,\r\n showButtons: true,\r\n hasDamage: true,\r\n rollTypeName: rollTypeName,\r\n rollObjectName: message.flags.mgt2.damage.rollObjectName\r\n };\r\n\r\n const html = await renderTemplate(\"systems/mgt2/templates/chat/roll.html\", chatData);\r\n chatData.content = html;\r\n\r\n return roll.toMessage(chatData);\r\n }\r\n\r\n async _processDamageButtonEvent(message, event) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n //message.flags[MODULE_SHORT].manualDamage = false\r\n //message.flags[MODULE_SHORT].renderDamage = true; \r\n // current user/actor\r\n\r\n await ItemUtility.runItemAction(null, message, ROLL_TYPE.DAMAGE);\r\n }\r\n\r\n static _applyChatCardDamage(message, event) {\r\n const roll = message.rolls[0];\r\n return Promise.all(canvas.tokens.controlled.map(t => {\r\n const a = t.actor;\r\n return a.applyDamage(roll.total);\r\n }));\r\n }\r\n}","export const registerSettings = function () {\r\n\r\n // https://foundryvtt.com/api/classes/client.ClientSettings.html#register\r\n /*game.settings.register('mgt2', 'test', {\r\n name: \"Test\",\r\n hint: \"A description of the registered setting and its behavior.\",\r\n scope: \"client\", // This specifies a client-stored setting\r\n config: true, // This specifies that the setting appears in the configuration view\r\n requiresReload: false, // This will prompt the user to reload the application for the setting to take effect.\r\n type: String,\r\n choices: { // If choices are defined, the resulting setting will be a select menu\r\n \"a\": \"Option A\",\r\n \"b\": \"Option B\"\r\n }\r\n });*/\r\n\r\n // User can Create WEapon/Armor/Augment/Computer/Item DEFAUT TRUE\r\n\r\n game.settings.register(\"mgt2\", \"theme\", {\r\n name: \"MGT2.Settings.theme.name\",\r\n hint: \"MGT2.Settings.theme.hint\",\r\n scope: \"client\",\r\n config: true,\r\n default: \"black-and-red\",\r\n type: String,\r\n choices: {\r\n \"black-and-red\": \"MGT2.Themes.BlackAndRed\",\r\n \"mwamba\": \"MGT2.Themes.Mwamba\",\r\n \"blue\": \"MGT2.Themes.Blue\"\r\n },\r\n requiresReload: true\r\n });\r\n\r\n game.settings.register('mgt2', 'usePronouns', {\r\n name: \"MGT2.Settings.usePronouns.name\",\r\n hint: \"MGT2.Settings.usePronouns.hint\",\r\n default: false,\r\n scope: 'world',\r\n type: Boolean,\r\n config: true,\r\n requiresReload: false\r\n });\r\n\r\n game.settings.register('mgt2', 'useGender', {\r\n name: \"MGT2.Settings.useGender.name\",\r\n hint: \"MGT2.Settings.useGender.hint\",\r\n default: false,\r\n scope: 'world',\r\n type: Boolean,\r\n config: true,\r\n requiresReload: false\r\n });\r\n\r\n game.settings.register('mgt2', 'showLife', {\r\n name: \"MGT2.Settings.showLife.name\",\r\n hint: \"MGT2.Settings.showLife.hint\",\r\n default: false,\r\n scope: 'world',\r\n type: Boolean,\r\n config: true,\r\n requiresReload: false\r\n });\r\n\r\n // game.settings.register('mgt2', 'useWeightMetric', {\r\n // name: \"MGT2.Settings.useWeightMetric.name\",\r\n // hint: \"MGT2.Settings.useWeightMetric.hint\",\r\n // default: true,\r\n // scope: 'world',\r\n // type: Boolean,\r\n // config: true,\r\n // requiresReload: true\r\n // });\r\n\r\n // game.settings.register('mgt2', 'useDistanceMetric', {\r\n // name: \"MGT2.Settings.useDistanceMetric.name\",\r\n // hint: \"MGT2.Settings.useDistanceMetric.hint\",\r\n // default: true,\r\n // scope: 'world',\r\n // type: Boolean,\r\n // config: true,\r\n // requiresReload: true\r\n // });\r\n\r\n // game.settings.register('mgt2', 'showTrash', {\r\n // name: \"Show Trash tab to Player\",\r\n // hint: \"Player can see the Trash tab and recover item\",\r\n // default: false,\r\n // scope: 'world',\r\n // type: Boolean,\r\n // config: true,\r\n // requiresReload: false\r\n // });\r\n\r\n /*game.settings.register('mgt2', 'containerDropIn', {\r\n name: \"Test\",\r\n hint: \"Mon hint\",\r\n default: true,\r\n scope: 'client',\r\n type: Boolean,\r\n config: true\r\n });*/\r\n};\r\n","import {\n CharacterData,\n ItemData,\n EquipmentData,\n DiseaseData,\n CareerData,\n TalentData,\n ContactData,\n ArmorData,\n ComputerData,\n WeaponData,\n ItemContainerData,\n SpeciesData\n} from \"./datamodels.js\";\n\nimport { MGT2 } from \"./config.js\";\nimport { TravellerActor, MGT2Combatant } from \"./actors/actor.js\";\nimport { TravellerItem } from \"./item.js\";\nimport { TravellerItemSheet } from \"./item-sheet.js\";\nimport { TravellerActorSheet } from \"./actors/character-sheet.js\";\nimport { preloadHandlebarsTemplates } from \"./templates.js\";\n//import { MGT2Helper } from \"./helper.js\";\nimport {ChatHelper} from \"./chatHelper.js\";\n//import { preloadHandlebarsTemplates } from \"./templates.js\";\n//import { createWorldbuildingMacro } from \"./macro.js\";\n//import { SimpleToken, SimpleTokenDocument } from \"./token.js\";\n// https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD03-systemjson\n// https://gitlab.com/asacolips-projects/foundry-mods/foundryvtt-system-tutorial\n// https://travellertoolsdemo.azurewebsites.net/contacts\n// https://foundryvtt.wiki/en/development/guides/SD-tutorial/SD08-Creating-HTML-templates-for-your-actor-sheets\n// https://foundryvtt.com/article/system-data-models/\n// https://handlebarsjs.com/guide/#what-is-handlebars\n// https://gitlab.com/custom-system-builder/custom-system-builder/-/blob/develop/template.json?ref_type=heads\n\n// https://foundryvtt.com/article/system-data-models/\n/* -------------------------------------------- */\n/* Foundry VTT Initialization */\n/* -------------------------------------------- */\nimport { registerSettings } from \"./settings.js\";\n\nfunction registerHandlebarsHelpers() {\n Handlebars.registerHelper('showDM', function (dm) {\n if (dm === 0) return \"0\";\n if (dm > 0) return `+${dm}`;\n if (dm < 0) return `${dm}`;\n return \"\";\n });\n}\n\nHooks.once(\"init\", async function () {\n CONFIG.MGT2 = MGT2;\n CONFIG.Combat.initiative = {\n formula: \"2d6 + @initiative\",\n decimals: 2\n };\n\n CONFIG.Actor.trackableAttributes = {\n character: {\n bar: [\"life\",\n \"characteristics.strength\",\n \"characteristics.dexterity\",\n \"characteristics.endurance\",\n \"characteristics.intellect\",\n \"characteristics.education\",\n \"characteristics.social\",\n \"characteristics.morale\",\n \"characteristics.luck\",\n \"characteristics.sanity\",\n \"characteristics.charm\",\n \"characteristics.psionic\",\n \"characteristics.other\"\n ],\n value: [\"life.value\",\n \"health.radiations\",\n \"characteristics.strength.value\",\n \"characteristics.dexterity.value\",\n \"characteristics.endurance.value\",\n \"characteristics.intellect.value\",\n \"characteristics.education.value\",\n \"characteristics.social.value\",\n \"characteristics.morale.value\",\n \"characteristics.luck.value\",\n \"characteristics.sanity.value\",\n \"characteristics.charm.value\",\n \"characteristics.psionic.value\",\n \"characteristics.other.value\"]\n }\n };\n\n game.mgt2 = {\n TravellerActor,\n TravellerItem\n };\n\n registerHandlebarsHelpers();\n registerSettings();\n\n CONFIG.Combatant.documentClass = MGT2Combatant;\n CONFIG.Actor.documentClass = TravellerActor;\n CONFIG.Item.documentClass = TravellerItem;\n //CONFIG.Token.documentClass = SimpleTokenDocument;\n //CONFIG.Token.objectClass = SimpleToken;\n\n Actors.unregisterSheet(\"core\", ActorSheet);\n Actors.registerSheet(\"mgt2\", TravellerActorSheet, { types: [\"character\"], makeDefault: true, label: \"Traveller Sheet\" });\n\n Items.unregisterSheet(\"core\", ItemSheet);\n Items.registerSheet(\"mgt2\", TravellerItemSheet, { makeDefault: true });\n\n Object.assign(CONFIG.Actor.dataModels, {\n \"character\": CharacterData\n });\n\n Object.assign(CONFIG.Item.dataModels, {\n \"item\": ItemData,\n \"equipment\": EquipmentData,\n \"disease\": DiseaseData,\n \"career\": CareerData,\n \"talent\": TalentData,\n \"contact\": ContactData,\n \"weapon\": WeaponData,\n \"computer\": ComputerData,\n \"armor\": ArmorData,\n \"container\": ItemContainerData,\n \"species\": SpeciesData\n });\n\n\n Hooks.on(\"renderChatMessage\", (message, html, messageData) => {\n //console.log(\"renderChatMessage\");\n ChatHelper.setupCardListeners(message, html, messageData);\n });\n\n // Preload template partials\n await preloadHandlebarsTemplates();\n});\n\n// function addChatMessageContextOptions(html, options) {\n// let canApply = li => {\n// const message = game.messages.get(li.data(\"messageId\"));\n// return message?.isRoll && message?.isContentVisible && canvas.tokens?.controlled.length;\n// };\n\n// options.push(\n// {\n// name: game.i18n.localize(\"DND5E.ChatContextDamage\"),\n// icon: '',\n// condition: canApply,\n// callback: li => applyChatCardDamage(li)\n// },\n// {\n// name: game.i18n.localize(\"DND5E.ChatContextHealing\"),\n// icon: '',\n// condition: canApply,\n// callback: li => applyChatCardDamage(li)\n// }\n// );\n// return options;\n// }\n\n\n\n//Hooks.on(\"getChatLogEntryContext\", addChatMessageContextOptions);\n\n\n\n\n\nexport { MGT2 };"],"names":["fields","converted","item","html"],"mappings":"AAGA,MAAM,MAAA,GAAS,QAAQ,IAAK,CAAA,MAAA,CAAA;AAEf,MAAA,aAAA,SAAsB,OAAQ,CAAA,QAAA,CAAS,aAAc,CAAA;AAAA,EAE9D,OAAO,YAAe,GAAA;AAElB,IAAO,OAAA;AAAA,MACH,IAAA,EAAM,IAAI,MAAA,CAAO,WAAY,CAAA,EAAE,QAAU,EAAA,KAAA,EAAO,KAAO,EAAA,KAAA,EAAO,IAAM,EAAA,IAAA,EAAM,CAAA;AAAA,MAC1E,IAAA,EAAM,IAAI,MAAA,CAAO,WAAY,CAAA;AAAA,QACzB,KAAA,EAAO,IAAI,MAAA,CAAO,WAAY,CAAA,EAAE,QAAU,EAAA,KAAA,EAAO,OAAS,EAAA,CAAA,EAAG,OAAS,EAAA,IAAA,EAAM,CAAA;AAAA,QAC5E,GAAA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AAO,CAAA,IAAA,CAAK,UAAY,EAAA;AAAA,IACpC,MAAQ,EAAA,QAAA;AAAA,IACR,WAAa,EAAA,aAAA;AAAA,IACb,SAAW,EAAA,WAAA;AAAA,IACX,QAAU,EAAA,UAAA;AAAA,IACV,QAAU,EAAA,UAAA;AAAA,IACV,SAAW,EAAA,WAAA;AAAA,IACX,QAAU,EAAA,UAAA;AAAA,IACV,UAAY,EAAA,YAAA;AAAA,IACZ,OAAS,EAAA,SAAA;AAAA,IACT,WAAa,EAAA,iBAAA;AAAA,IACb,SAAW,EAAA,WAAA;AAAA,GACZ,CAAA,CAAA;AAGD,EAAA,KAAA,CAAM,EAAG,CAAA,mBAAA,EAAqB,CAAC,OAAA,EAAS,MAAM,WAAgB,KAAA;AAE5D,IAAW,UAAA,CAAA,kBAAA,CAAmB,OAAS,EAAA,IAAA,EAAM,WAAW,CAAA,CAAA;AAAA,GACzD,CAAA,CAAA;AAGD,EAAA,MAAM,0BAA2B,EAAA,CAAA;AACnC,CAAC,CAAA;;;;"} \ No newline at end of file +{"version":3,"file":"mgt2.bundle.js","sources":["src/module/models/items/base-item.mjs","src/module/models/character.mjs","src/module/models/vehicule.mjs","src/module/models/items/item.mjs","src/module/models/items/equipment.mjs","src/module/models/items/disease.mjs","src/module/models/items/career.mjs","src/module/models/items/talent.mjs","src/module/models/items/contact.mjs","src/module/models/items/weapon.mjs","src/module/models/items/armor.mjs","src/module/models/items/computer.mjs","src/module/models/items/container.mjs","src/module/models/items/species.mjs","src/module/config.js","src/module/actors/character.js","src/module/actors/actor.js","src/module/item.js","src/module/applications/sheets/base-actor-sheet.mjs","src/module/helper.js","src/module/roll-prompt.js","src/module/actors/character-prompts.js","src/module/applications/sheets/character-sheet.mjs","src/module/applications/sheets/vehicule-sheet.mjs","src/module/applications/sheets/item-sheet.mjs","src/module/templates.js","src/module/chatHelper.js","src/module/settings.js","src/module/core.js"],"sourcesContent":["const fields = foundry.data.fields;\n\nexport function createCharacteristicField(show = true, showMax = false) {\n return new fields.SchemaField({\n value: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\n max: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }),\n dm: new fields.NumberField({ required: false, initial: 0, integer: true }),\n show: new fields.BooleanField({ required: false, initial: show }),\n showMax: new fields.BooleanField({ required: false, initial: showMax })\n });\n}\n\nexport class ItemBaseData extends foundry.abstract.TypeDataModel {\n static defineSchema() {\n return {\n description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }),\n subType: new fields.StringField({ required: false, blank: false, nullable: true })\n };\n }\n}\n\nexport class PhysicalItemData extends ItemBaseData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.quantity = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true });\n schema.weight = new fields.NumberField({ required: true, initial: 0, min: 0, integer: false });\n schema.weightless = new fields.BooleanField({ required: false, initial: false });\n schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true });\n schema.tl = new fields.StringField({ required: true, blank: false, initial: \"TL12\" });\n schema.container = new fields.SchemaField({\n id: new fields.StringField({ required: false, blank: true })\n });\n schema.roll = new fields.SchemaField({\n characteristic: new fields.StringField({ required: false, blank: true, trim: true }),\n skill: new fields.StringField({ required: false, blank: true, trim: true }),\n difficulty: new fields.StringField({ required: false, blank: true, trim: true })\n });\n schema.trash = new fields.BooleanField({ required: false, initial: false });\n return schema;\n }\n}\n","import { createCharacteristicField } from \"./items/base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class CharacterData extends foundry.abstract.TypeDataModel {\n\n static defineSchema() {\n return {\n name: new fields.StringField({ required: false, blank: false, trim: true }),\n life: new fields.SchemaField({\n value: new fields.NumberField({ required: false, initial: 0, integer: true }),\n max: new fields.NumberField({ required: true, initial: 0, integer: true })\n }),\n personal: new fields.SchemaField({\n title: new fields.StringField({ required: false, blank: true, trim: true }),\n species: new fields.StringField({ required: false, blank: true, trim: true }),\n speciesText: new fields.SchemaField({\n description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }),\n descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true })\n }),\n age: new fields.StringField({ required: false, blank: true, trim: true }),\n gender: new fields.StringField({ required: false, blank: true, trim: true }),\n pronouns: new fields.StringField({ required: false, blank: true, trim: true }),\n homeworld: new fields.StringField({ required: false, blank: true, trim: true }),\n ucp: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\n traits: new fields.ArrayField(\n new fields.SchemaField({\n name: new fields.StringField({ required: true, blank: true, trim: true }),\n description: new fields.StringField({ required: false, blank: true, trim: true })\n })\n )\n }),\n biography: new fields.HTMLField({ required: false, blank: true, trim: true }),\n\n characteristics: new fields.SchemaField({\n strength: createCharacteristicField(true, true),\n dexterity: createCharacteristicField(true, true),\n endurance: createCharacteristicField(true, true),\n intellect: createCharacteristicField(true, false),\n education: createCharacteristicField(true, false),\n social: createCharacteristicField(true, false),\n morale: createCharacteristicField(true, false),\n luck: createCharacteristicField(true, false),\n sanity: createCharacteristicField(true, false),\n charm: createCharacteristicField(true, false),\n psionic: createCharacteristicField(true, false),\n other: createCharacteristicField(true, false)\n }),\n\n health: new fields.SchemaField({\n radiations: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true })\n }),\n study: new fields.SchemaField({\n skill: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\n total: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }),\n completed: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true })\n }),\n finance: new fields.SchemaField({\n pension: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\n credits: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\n cashOnHand: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\n debt: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\n livingCost: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\n monthlyShipPayments: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\n notes: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" })\n }),\n containerView: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\n containerDropIn: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\n notes: new fields.HTMLField({ required: false, blank: true, trim: true }),\n\n inventory: new fields.SchemaField({\n armor: new fields.NumberField({ required: true, initial: 0, integer: true }),\n weight: new fields.NumberField({ required: true, initial: 0, min: 0, integer: false }),\n encumbrance: new fields.SchemaField({\n normal: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }),\n heavy: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true })\n })\n }),\n states: new fields.SchemaField({\n encumbrance: new fields.BooleanField({ required: false, initial: false }),\n fatigue: new fields.BooleanField({ required: false, initial: false }),\n unconscious: new fields.BooleanField({ required: false, initial: false }),\n surgeryRequired: new fields.BooleanField({ required: false, initial: false })\n }),\n\n config: new fields.SchemaField({\n psionic: new fields.BooleanField({ required: false, initial: true }),\n initiative: new fields.StringField({ required: false, blank: true, initial: \"dexterity\" }),\n damages: new fields.SchemaField({\n rank1: new fields.StringField({ required: false, blank: true, initial: \"strength\" }),\n rank2: new fields.StringField({ required: false, blank: true, initial: \"dexterity\" }),\n rank3: new fields.StringField({ required: false, blank: true, initial: \"endurance\" })\n })\n })\n };\n }\n}\n","const fields = foundry.data.fields;\n\nexport default class VehiculeData extends foundry.abstract.TypeDataModel {\n\n static defineSchema() {\n return {\n name: new fields.StringField({ required: false, blank: false, trim: true }),\n skillId: new fields.StringField({ required: false, initial: \"\", blank: true, trim: true }),\n speed: new fields.SchemaField({\n cruise: new fields.StringField({ required: false, initial: \"Slow\", blank: true }),\n maximum: new fields.StringField({ required: false, initial: \"Medium\", blank: true })\n }),\n agility: new fields.NumberField({ required: false, min: 0, integer: true }),\n crew: new fields.NumberField({ required: false, min: 0, integer: true }),\n passengers: new fields.NumberField({ required: false, min: 0, integer: true }),\n cargo: new fields.NumberField({ required: false, min: 0, integer: false }),\n life: new fields.SchemaField({\n value: new fields.NumberField({ required: true, initial: 0, integer: true }),\n max: new fields.NumberField({ required: true, initial: 0, integer: true })\n }),\n shipping: new fields.NumberField({ required: false, min: 0, integer: true }),\n cost: new fields.NumberField({ required: false, min: 0, integer: true }),\n armor: new fields.SchemaField({\n front: new fields.NumberField({ required: true, initial: 0, integer: true }),\n rear: new fields.NumberField({ required: true, initial: 0, integer: true }),\n sides: new fields.NumberField({ required: true, initial: 0, integer: true })\n }),\n skills: new fields.SchemaField({\n autopilot: new fields.NumberField({ required: true, initial: 0, integer: true })\n })\n };\n }\n}\n","import { PhysicalItemData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class ItemData extends PhysicalItemData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.subType.initial = \"loot\";\n schema.software = new fields.SchemaField({\n bandwidth: new fields.NumberField({ required: false, initial: 0, min: 0, max: 10, integer: true }),\n effect: new fields.StringField({ required: false, blank: true, trim: true, initial: \"\" }),\n computerId: new fields.StringField({ required: false, blank: true, initial: \"\" })\n });\n return schema;\n }\n}\n","import { PhysicalItemData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class EquipmentData extends PhysicalItemData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.equipped = new fields.BooleanField({ required: false, initial: false });\n schema.augment = new fields.SchemaField({\n improvement: new fields.StringField({ required: false, blank: true, trim: true })\n });\n schema.subType.initial = \"equipment\"; // augment, clothing, trinket, toolkit, equipment\n return schema;\n }\n}\n","import { ItemBaseData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class DiseaseData extends ItemBaseData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.subType.initial = \"disease\"; // disease, poison\n schema.difficulty = new fields.StringField({ required: true, initial: \"Average\" });\n schema.damage = new fields.StringField({ required: false, blank: true });\n schema.interval = new fields.StringField({ required: false, blank: true });\n return schema;\n }\n}\n","import { ItemBaseData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class CareerData extends ItemBaseData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.difficulty = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true });\n schema.damage = new fields.StringField({ required: false, blank: true });\n schema.interval = new fields.StringField({ required: false, blank: true });\n schema.assignment = new fields.StringField({ required: false, blank: true });\n schema.terms = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\n schema.rank = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\n schema.events = new fields.ArrayField(\n new fields.SchemaField({\n age: new fields.NumberField({ required: false, integer: true }),\n description: new fields.StringField({ required: false, blank: true, trim: true })\n })\n );\n return schema;\n }\n}\n","import { ItemBaseData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class TalentData extends ItemBaseData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.subType.initial = \"skill\";\n schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true });\n schema.level = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true });\n schema.skill = new fields.SchemaField({\n speciality: new fields.StringField({ required: false, blank: true, trim: true }),\n reduceEncumbrance: new fields.BooleanField({ required: false, initial: false })\n });\n schema.psionic = new fields.SchemaField({\n reach: new fields.StringField({ required: false, blank: true, trim: true }),\n cost: new fields.NumberField({ required: false, initial: 1, min: 0, integer: true }),\n duration: new fields.StringField({ required: false, blank: true, trim: true }),\n durationUnit: new fields.StringField({ required: false })\n });\n schema.roll = new fields.SchemaField({\n characteristic: new fields.StringField({ required: false, blank: true, trim: true }),\n skill: new fields.StringField({ required: false, blank: true, trim: true }),\n difficulty: new fields.StringField({ required: false, blank: true, trim: true })\n });\n return schema;\n }\n}\n","import { ItemBaseData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class ContactData extends ItemBaseData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.subType.initial = \"skill\";\n schema.cost = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true });\n schema.skill = new fields.SchemaField({\n speciality: new fields.StringField({ required: false, blank: true, trim: true }),\n characteristic: new fields.StringField({ required: false, blank: true, trim: true })\n });\n schema.status = new fields.StringField({ required: false, blank: true, trim: true, initial: \"Alive\" });\n schema.attitude = new fields.StringField({ required: false, blank: true, trim: true, initial: \"Unknow\" });\n schema.relation = new fields.StringField({ required: false, blank: true, trim: true, initial: \"Contact\" });\n schema.title = new fields.StringField({ required: false, blank: true, trim: true });\n schema.nickname = new fields.StringField({ required: false, blank: true, trim: true });\n schema.species = new fields.StringField({ required: false, blank: true, trim: true });\n schema.gender = new fields.StringField({ required: false, blank: true, trim: true });\n schema.pronouns = new fields.StringField({ required: false, blank: true, trim: true });\n schema.homeworld = new fields.StringField({ required: false, blank: true, trim: true });\n schema.location = new fields.StringField({ required: false, blank: true, trim: true });\n schema.occupation = new fields.StringField({ required: false, blank: true, trim: true });\n schema.notes = new fields.HTMLField({ required: false, blank: true, trim: true });\n return schema;\n }\n}\n","import { PhysicalItemData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class WeaponData extends PhysicalItemData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.equipped = new fields.BooleanField({ required: false, initial: false });\n schema.range = new fields.SchemaField({\n isMelee: new fields.BooleanField({ required: false, initial: false }),\n value: new fields.NumberField({ required: false, integer: true, nullable: true }),\n unit: new fields.StringField({ required: false, blank: true, nullable: true })\n });\n schema.damage = new fields.StringField({ required: false, blank: true, trim: true });\n schema.magazine = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\n schema.magazineCost = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\n schema.traits = new fields.ArrayField(\n new fields.SchemaField({\n name: new fields.StringField({ required: true, blank: true, trim: true }),\n description: new fields.StringField({ required: false, blank: true, trim: true })\n })\n );\n schema.options = new fields.ArrayField(\n new fields.SchemaField({\n name: new fields.StringField({ required: true, blank: true, trim: true }),\n description: new fields.StringField({ required: false, blank: true, trim: true })\n })\n );\n return schema;\n }\n}\n","import { PhysicalItemData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class ArmorData extends PhysicalItemData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.equipped = new fields.BooleanField({ required: false, initial: false });\n schema.radiations = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\n schema.protection = new fields.StringField({ required: false, blank: false, trim: true });\n // A Traveller suffers DM-1 to all checks per missing skill level in the required skill.\n schema.requireSkill = new fields.StringField({ required: false, blank: false });\n schema.requireSkillLevel = new fields.NumberField({ required: false, min: 0, integer: true });\n // Powered armour supports its own weight and is effectively weightless for encumbrance.\n schema.powered = new fields.BooleanField({ required: false, initial: false });\n schema.options = new fields.ArrayField(\n new fields.SchemaField({\n name: new fields.StringField({ required: true, blank: true, trim: true }),\n description: new fields.StringField({ required: false, blank: true, trim: true })\n })\n );\n return schema;\n }\n}\n","import { PhysicalItemData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class ComputerData extends PhysicalItemData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.processing = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\n schema.processingUsed = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true });\n schema.overload = new fields.BooleanField({ required: false, initial: false });\n schema.options = new fields.ArrayField(\n new fields.SchemaField({\n name: new fields.StringField({ required: true, blank: true, trim: true }),\n description: new fields.StringField({ required: false, blank: true, trim: true })\n })\n );\n return schema;\n }\n}\n","import { ItemBaseData } from \"./base-item.mjs\";\nconst fields = foundry.data.fields;\n\nexport default class ItemContainerData extends ItemBaseData {\n static defineSchema() {\n const schema = super.defineSchema();\n schema.onHand = new fields.BooleanField({ required: false, initial: false });\n schema.location = new fields.StringField({ required: false, blank: true, trim: true });\n schema.count = new fields.NumberField({ required: false, initial: 0, integer: true });\n schema.weight = new fields.NumberField({ required: false, initial: 0, integer: false });\n schema.weightless = new fields.BooleanField({ required: false, initial: false });\n schema.locked = new fields.BooleanField({ required: false, initial: false }); // GM only\n schema.lockedDescription = new fields.StringField({ required: false, blank: true, trim: true, nullable: true });\n return schema;\n }\n}\n","const fields = foundry.data.fields;\n\nexport default class SpeciesData extends foundry.abstract.TypeDataModel {\n static defineSchema() {\n return {\n description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }),\n descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true }),\n traits: new fields.ArrayField(\n new fields.SchemaField({\n name: new fields.StringField({ required: true, blank: true, trim: true }),\n description: new fields.StringField({ required: false, blank: true, trim: true })\n })\n ),\n modifiers: new fields.ArrayField(\n new fields.SchemaField({\n characteristic: new fields.StringField({ required: false, blank: true, trim: true }),\n value: new fields.NumberField({ required: false, integer: true, nullable: true })\n })\n )\n };\n }\n}\n","export const MGT2 = {};\n\nMGT2.MetricRange = Object.freeze({\n meter: \"MGT2.MetricRange.meter\",\n kilometer: \"MGT2.MetricRange.kilometer\"\n});\n\nMGT2.MetricWeight = Object.freeze({\n kilogram: \"MGT2.MetricWeight.kilogram\",\n ton: \"MGT2.MetricWeight.ton\"\n});\n\nMGT2.Difficulty = Object.freeze({\n NA: \"MGT2.Difficulty.NA\",\n Simple: \"MGT2.Difficulty.Simple\",\n Easy: \"MGT2.Difficulty.Easy\",\n Routine: \"MGT2.Difficulty.Routine\",\n Average: \"MGT2.Difficulty.Average\",\n Difficult: \"MGT2.Difficulty.Difficult\",\n VeryDifficult: \"MGT2.Difficulty.VeryDifficult\",\n Formidable: \"MGT2.Difficulty.Formidable\",\n Impossible: \"MGT2.Difficulty.Impossible\"\n});\n\nMGT2.ItemSubType = Object.freeze({\n loot: \"MGT2.ItemSubType.loot\",\n software: \"MGT2.ItemSubType.software\"\n});\n\nMGT2.EquipmentSubType = Object.freeze({\n augment: \"MGT2.EquipmentSubType.augment\",\n clothing: \"MGT2.EquipmentSubType.clothing\",\n equipment: \"MGT2.EquipmentSubType.equipment\",\n trinket: \"MGT2.EquipmentSubType.trinket\",\n toolkit: \"MGT2.EquipmentSubType.toolkit\"\n});\n\nMGT2.TalentSubType = Object.freeze({\n skill: \"MGT2.TalentSubType.skill\",\n psionic: \"MGT2.TalentSubType.psionic\"\n});\n\nMGT2.DiseaseSubType = Object.freeze({\n disease: \"MGT2.DiseaseSubType.disease\",\n poison: \"MGT2.DiseaseSubType.poison\",\n wound: \"MGT2.DiseaseSubType.wound\"\n});\n\nMGT2.PsionicReach = Object.freeze({\n NA: \"MGT2.PsionicReach.NA\",\n Personal: \"MGT2.PsionicReach.Personal\",\n Close: \"MGT2.PsionicReach.Close\",\n Short: \"MGT2.PsionicReach.Short\",\n Medium: \"MGT2.PsionicReach.Medium\",\n Long: \"MGT2.PsionicReach.Long\",\n VeryLong: \"MGT2.PsionicReach.VeryLong\",\n Distant: \"MGT2.PsionicReach.Distant\",\n VeryDistant: \"MGT2.PsionicReach.VeryDistant\",\n Continental: \"MGT2.PsionicReach.Continental\",\n Planetary: \"MGT2.PsionicReach.Planetary\"\n});\n\nMGT2.ContactRelations = Object.freeze({\n Allie: \"MGT2.Contact.Relation.Allie\",\n Contact: \"MGT2.Contact.Relation.Contact\",\n Rival: \"MGT2.Contact.Relation.Rival\",\n Enemy: \"MGT2.Contact.Relation.Enemy\"\n});\n\nMGT2.ContactStatus = Object.freeze({\n Alive: \"MGT2.Contact.Status.Alive\",\n Unknow: \"MGT2.Contact.Status.Unknow\",\n Dead: \"MGT2.Contact.Status.Dead\"\n});\n\nMGT2.Attitudes = Object.freeze({\n Unknow: \"MGT2.Contact.Attitude.Unknow\",\n Hostile: \"MGT2.Contact.Attitude.Hostile\",\n Unfriendly: \"MGT2.Contact.Attitude.Unfriendly\",\n Indifferent: \"MGT2.Contact.Attitude.Indifferent\",\n Friendly: \"MGT2.Contact.Attitude.Friendly\",\n Helpful: \"MGT2.Contact.Attitude.Helpful\",\n Complicated: \"MGT2.Contact.Attitude.Complicated\"\n});\n\nMGT2.Characteristics = Object.freeze({\n strength: \"MGT2.Characteristics.strength.name\",\n dexterity: \"MGT2.Characteristics.dexterity.name\",\n endurance: \"MGT2.Characteristics.endurance.name\",\n intellect: \"MGT2.Characteristics.intellect.name\",\n education: \"MGT2.Characteristics.education.name\",\n social: \"MGT2.Characteristics.social.name\",\n morale: \"MGT2.Characteristics.morale.name\",\n luck: \"MGT2.Characteristics.luck.name\",\n sanity: \"MGT2.Characteristics.sanity.name\",\n charm: \"MGT2.Characteristics.charm.name\",\n psionic: \"MGT2.Characteristics.psionic.name\",\n other: \"MGT2.Characteristics.other.name\"\n});\n\nMGT2.InitiativeCharacteristics = Object.freeze({\n dexterity: \"MGT2.Characteristics.dexterity.name\",\n intellect: \"MGT2.Characteristics.intellect.name\"\n});\n\nMGT2.DamageCharacteristics = Object.freeze({\n strength: \"MGT2.Characteristics.strength.name\",\n dexterity: \"MGT2.Characteristics.dexterity.name\",\n endurance: \"MGT2.Characteristics.endurance.name\"\n});\n\nMGT2.TL = Object.freeze({\n NA: \"MGT2.TL.NA\",\n Unknow: \"MGT2.TL.Unknow\",\n NotIdentified: \"MGT2.TL.NotIdentified\",\n TL00: \"MGT2.TL.L00\",\n TL01: \"MGT2.TL.L01\",\n TL02: \"MGT2.TL.L02\",\n TL03: \"MGT2.TL.L03\",\n TL04: \"MGT2.TL.L04\",\n TL05: \"MGT2.TL.L05\",\n TL06: \"MGT2.TL.L06\",\n TL07: \"MGT2.TL.L07\",\n TL08: \"MGT2.TL.L08\",\n TL09: \"MGT2.TL.L09\",\n TL10: \"MGT2.TL.L10\",\n TL11: \"MGT2.TL.L11\",\n TL12: \"MGT2.TL.L12\",\n TL13: \"MGT2.TL.L13\",\n TL14: \"MGT2.TL.L14\",\n TL15: \"MGT2.TL.L15\"\n});\n\nMGT2.Timeframes = Object.freeze({\n Normal: \"MGT2.Timeframes.Normal\",\n Slower: \"MGT2.Timeframes.Slower\",\n Faster: \"MGT2.Timeframes.Faster\"\n});\n\nMGT2.SpeedBands = Object.freeze({\n Stoppped: \"MGT2.SpeedBands.Stoppped\",\n Idle: \"MGT2.SpeedBands.Idle\",\n VerySlow: \"MGT2.SpeedBands.VerySlow\",\n Slow: \"MGT2.SpeedBands.Slow\",\n Medium: \"MGT2.SpeedBands.Medium\",\n High: \"MGT2.SpeedBands.High.\",\n Fast: \"MGT2.SpeedBands.Fast\",\n VeryFast: \"MGT2.SpeedBands.VeryFast\",\n Subsonic: \"MGT2.SpeedBands.Subsonic\",\n Hypersonic: \"MGT2.SpeedBands.Hypersonic\"\n});\n\nMGT2.Durations = Object.freeze({\n Seconds: \"MGT2.Durations.Seconds\",\n Minutes: \"MGT2.Durations.Minutes\",\n Heures: \"MGT2.Durations.Heures\"\n});","export class ActorCharacter {\n static preCreate($this, data, options, user) {\n $this.updateSource({ prototypeToken: { actorLink: true } }) // QoL\n }\n\n static prepareData(actorData) {\n actorData.initiative = this.getInitiative(actorData);\n }\n\n static getInitiative($this) {\n let c = $this.system.config.initiative;\n return $this.system.characteristics[c].dm;\n }\n\n static async onDeleteDescendantDocuments($this, parent, collection, documents, ids, options, userId) {\n const toDeleteIds = [];\n const itemToUpdates = [];\n\n for (let d of documents) {\n if (d.type === \"container\") {\n // Delete content\n for (let item of $this.items) {\n if (item.system.hasOwnProperty(\"container\") && item.system.container.id === d._id)\n toDeleteIds.push(item._id);\n }\n } else if (d.type === \"computer\") {\n // Eject software\n for (let item of $this.items) {\n if (item.system.hasOwnProperty(\"software\") && item.system.computerId === d._id) {\n let clone = foundry.utils.deepClone(item);\n clone.system.software.computerId = \"\";\n itemToUpdates.push(clone);\n }\n }\n }\n }\n\n if (toDeleteIds.length > 0)\n await $this.deleteEmbeddedDocuments(\"Item\", toDeleteIds);\n\n if (itemToUpdates.length > 0)\n await $this.updateEmbeddedDocuments('Item', itemToUpdates);\n\n await this.recalculateWeight($this);\n }\n\n static async onUpdateDescendantDocuments($this, parent, collection, documents, changes, options, userId) {\n await this.calculEncumbranceAndWeight($this, parent, collection, documents, changes, options, userId);\n await this.calculComputers($this, parent, collection, documents, changes, options, userId);\n }\n\n static async calculComputers($this, parent, collection, documents, changes, options, userId) {\n let change;\n let i = 0;\n\n let recalculProcessing = false;\n for (let d of documents) {\n if (changes[i].hasOwnProperty(\"system\")) {\n change = changes[i];\n if (d.type === \"item\" && d.system.subType === \"software\") {\n if (change.system.software.hasOwnProperty(\"bandwidth\") || change.system.software.hasOwnProperty(\"computerId\")) {\n recalculProcessing = true;\n break;\n }\n }\n }\n }\n\n if (recalculProcessing) {\n let updatedComputers = [];\n let computerChanges = {};\n let computers = [];\n\n for (let item of $this.items) {\n if (item.system.trash === true) continue;\n if (item.type === \"computer\") {\n computers.push(item);\n computerChanges[item._id] = { processingUsed: 0 };\n }\n }\n\n for (let item of $this.items) {\n if (item.type !== \"item\" && item.system.subType !== \"software\") continue;\n\n if (item.system.software.hasOwnProperty(\"computerId\") && item.system.software.computerId !== \"\") {\n computerChanges[item.system.software.computerId].processingUsed += item.system.software.bandwidth;\n }\n }\n\n for (let computer of computers) {\n let newProcessingUsed = computerChanges[computer._id].processingUsed;\n if (computer.system.processingUsed !== newProcessingUsed) {\n const cloneComputer = foundry.utils.deepClone($this.getEmbeddedDocument(\"Item\", computer._id));\n cloneComputer.system.processingUsed = newProcessingUsed;\n cloneComputer.system.overload = cloneComputer.system.processingUsed > cloneComputer.system.processing;\n updatedComputers.push(cloneComputer);\n }\n }\n\n if (updatedComputers.length > 0) {\n await $this.updateEmbeddedDocuments('Item', updatedComputers);\n }\n }\n }\n\n static async calculEncumbranceAndWeight($this, parent, collection, documents, changes, options, userId) {\n let recalculEncumbrance = false;\n let recalculWeight = false;\n\n let change;\n let i = 0;\n for (let d of documents) {\n if (changes[i].hasOwnProperty(\"system\")) {\n change = changes[i];\n\n if (d.type === \"armor\" ||\n d.type === \"computer\" ||\n d.type === \"gear\" ||\n d.type === \"item\" ||\n d.type === \"weapon\") {\n if (change.system.hasOwnProperty(\"quantity\") ||\n change.system.hasOwnProperty(\"weight\") ||\n change.system.hasOwnProperty(\"weightless\") ||\n change.system.hasOwnProperty(\"container\") ||\n change.system.hasOwnProperty(\"equipped\") ||\n d.type === \"armor\") {\n recalculWeight = true;\n }\n } else if (d.type === \"talent\" && d.system.subType === \"skill\") {\n if (change.system.level || (change.system?.hasOwnProperty(\"skill\") && change.system?.skill.hasOwnProperty(\"reduceEncumbrance\"))) {\n recalculEncumbrance = true;\n }\n } else if (d.type === \"container\" && (change.system.hasOwnProperty(\"onHand\") || change.system.hasOwnProperty(\"weightless\"))) {\n recalculWeight = true;\n }\n }\n i++;\n }\n\n if (recalculEncumbrance || recalculWeight) {\n const cloneActor = foundry.utils.deepClone($this);\n\n await this.recalculateArmor($this, cloneActor);\n\n if (recalculEncumbrance) {\n //console.log(\"recalculEncumbrance\");\n const str = $this.system.characteristics.strength.value;\n const end = $this.system.characteristics.endurance.value;\n let sumSkill = 0;\n $this.items.filter(x => x.type === \"talent\" && x.system.subType === \"skill\" && x.system.skill.reduceEncumbrance === true).forEach(x => sumSkill += x.system.level);\n let normal = str + end + sumSkill;\n let heavy = normal * 2;\n\n cloneActor.system.states.encumbrance = $this.system.inventory.weight > normal;\n cloneActor.system.encumbrance.normal = normal;\n cloneActor.system.encumbrance.heavy = heavy;\n }\n\n if (recalculWeight)\n await this.recalculateWeight($this, cloneActor);\n }\n }\n\n static async recalculateArmor($this, cloneActor) {\n if (cloneActor === null || cloneActor === undefined)\n cloneActor = foundry.utils.deepClone($this);\n\n let armor = 0;\n for (let item of $this.items) {\n if (item.type === \"armor\") {\n if (item.system.equipped === true && !isNaN(item.system.protection)) {\n armor += (+item.system.protection || 0);\n }\n }\n }\n\n cloneActor.system.inventory.armor = armor;\n }\n\n static async recalculateWeight($this, cloneActor) {\n\n if (cloneActor === null || cloneActor === undefined)\n cloneActor = foundry.utils.deepClone($this);\n\n let updatedContainers = [];\n let containerChanges = {};\n\n //console.log(\"recalculWeight\");\n let containers = [];\n\n // List all containers\n for (let item of $this.items) {\n if (item.system.trash === true) continue;\n\n if (item.type === \"container\") {\n containers.push(item);\n containerChanges[item._id] = { count: 0, weight: 0 };\n }\n }\n\n let onHandWeight = 0;\n for (let item of $this.items) {\n if (item.type === \"container\") continue;\n if (item.system.hasOwnProperty(\"weightless\") && item.system.weightless === true) continue;\n\n let itemWeight = 0;\n if (item.system.hasOwnProperty(\"weight\")) {\n let itemQty = item.system.quantity\n if (!isNaN(itemQty) && itemQty > 0) {\n itemWeight = item.system.weight;\n if (itemWeight > 0) {\n itemWeight *= itemQty;\n }\n }\n\n if (item.type === \"armor\") {\n if (item.system.equipped === true) {\n if (item.system.powered === true)\n itemWeight = 0;\n else\n itemWeight *= 0.25; // mass of armor that is being worn by 75% OPTIONAL\n }\n }\n\n if (item.system.container && item.system.container.id && item.system.container.id !== \"\") {\n // bad deleted container id\n if (containerChanges.hasOwnProperty(item.system.container.id)) {\n containerChanges[item.system.container.id].weight += Math.round(itemWeight * 10) / 10;\n containerChanges[item.system.container.id].count += item.system.quantity;\n }\n } else {\n onHandWeight += Math.round(itemWeight * 10) / 10;\n }\n }\n }\n\n //cloneActor.system.inventory.weight = onHandWeight.toFixed(1);\n\n // Check containers new weight\n for (let container of containers) {\n let newWeight = containerChanges[container._id].weight;\n let newCount = containerChanges[container._id].count;\n if (container.system.weight !== newWeight || container.system.count !== newCount) {\n //const cloneContainer = foundry.utils.deepClone();\n const cloneContainer = foundry.utils.deepClone($this.getEmbeddedDocument(\"Item\", container._id));\n //foundry.utils.setProperty(cloneContainer, \"system.weight\", newWeight);\n cloneContainer.system.weight = newWeight;\n cloneContainer.system.count = newCount;\n updatedContainers.push(cloneContainer);\n\n if (container.system.onHand === true &&\n (container.system.weight > 0 || container.system.weightless !== true)) {\n onHandWeight += container.system.weight;\n }\n }\n }\n\n cloneActor.system.inventory.weight = onHandWeight;\n cloneActor.system.states.encumbrance = onHandWeight > $this.system.inventory.encumbrance.normal;\n\n\n await $this.update(cloneActor);\n\n if (updatedContainers.length > 0) {\n await $this.updateEmbeddedDocuments('Item', updatedContainers);\n }\n }\n\n static async preUpdate($this, changed, options, user) {\n // Calc encumbrance\n\n const newStr = foundry.utils.getProperty(changed, \"system.characteristics.strength.value\") ?? $this.system.characteristics.strength.value;\n const newEnd = foundry.utils.getProperty(changed, \"system.characteristics.endurance.value\") ?? $this.system.characteristics.endurance.value;\n if ((newStr !== $this.system.characteristics.strength.value) || (newEnd !== $this.system.characteristics.endurance.value)) {\n let sumSkill = 0;\n $this.items.filter(x => x.type === \"talent\" && x.system.subType === \"skill\" && x.system.skill.reduceEncumbrance === true).forEach(x => sumSkill += x.system.level);\n let normal = newStr + newEnd + sumSkill;\n let heavy = normal * 2;\n foundry.utils.setProperty(changed, \"system.inventory.encumbrance.normal\", normal);\n foundry.utils.setProperty(changed, \"system.inventory.encumbrance.heavy\", heavy);\n }\n\n //console.log(foundry.utils.getProperty(changed, \"system.characteristics.strength.value\"));\n const characteristicModified = this.computeCharacteristics(changed);\n const strengthValue = foundry.utils.getProperty(changed, \"system.characteristics.strength.value\") ?? $this.system.characteristics.strength.value;\n const strengthMax = foundry.utils.getProperty(changed, \"system.characteristics.strength.max\") ?? $this.system.characteristics.strength.max;\n const dexterityValue = foundry.utils.getProperty(changed, \"system.characteristics.dexterity.value\") ?? $this.system.characteristics.dexterity.value;\n const dexterityMax = foundry.utils.getProperty(changed, \"system.characteristics.dexterity.max\") ?? $this.system.characteristics.dexterity.max;\n const enduranceValue = foundry.utils.getProperty(changed, \"system.characteristics.endurance.value\") ?? $this.system.characteristics.endurance.value;\n const enduranceMax = foundry.utils.getProperty(changed, \"system.characteristics.endurance.max\") ?? $this.system.characteristics.endurance.max;\n const lifeValue = strengthValue + dexterityValue + enduranceValue;\n const lifeMax = strengthMax + dexterityMax + enduranceMax;\n\n if ($this.system.life.value !== lifeValue)\n foundry.utils.setProperty(changed, \"system.life.value\", lifeValue);\n if ($this.system.life.max !== lifeMax)\n foundry.utils.setProperty(changed, \"system.life.max\", lifeMax);\n\n if (characteristicModified && $this.system.personal.ucp === undefined || $this.system.personal.ucp === \"\") {\n // calc\n\n }\n //}\n\n // Apply changes in Actor size to Token width/height\n // if ( \"size\" in (this.system.traits || {}) ) {\n // const newSize = foundry.utils.getProperty(changed, \"system.traits.size\");\n // if ( newSize && (newSize !== this.system.traits?.size) ) {\n // let size = CONFIG.DND5E.tokenSizes[newSize];\n // if ( !foundry.utils.hasProperty(changed, \"prototypeToken.width\") ) {\n // changed.prototypeToken ||= {};\n // changed.prototypeToken.height = size;\n // changed.prototypeToken.width = size;\n // }\n // }\n // }\n }\n\n // static applyHealing($this, amount) {\n // if (isNaN(amount) || amount === 0) return;\n\n // const strength = $this.system.characteristics.strength;\n // const dexterity = $this.system.characteristics.dexterity;\n // const endurance = $this.system.characteristics.endurance;\n\n // const data = {\n // strength: { value: strength.value },\n // dexterity: { value: dexterity.value },\n // endurance: { value: endurance.value }\n // };\n\n\n\n // $this.update({ system: { characteristics: data } });\n // }\n\n static applyDamage($this, amount) {\n if (isNaN(amount) || amount === 0) return;\n const rank1 = $this.system.config.damages.rank1;\n const rank2 = $this.system.config.damages.rank2;\n const rank3 = $this.system.config.damages.rank3;\n\n const data = {};\n data[rank1] = { value: $this.system.characteristics[rank1].value };\n data[rank2] = { value: $this.system.characteristics[rank2].value };\n data[rank3] = { value: $this.system.characteristics[rank3].value };\n\n if (amount < 0) amount = Math.abs(amount);\n\n for (const [key, rank] of Object.entries(data)) {\n if (rank.value > 0) {\n if (rank.value >= amount) {\n rank.value -= amount;\n amount = 0;\n } else {\n amount -= rank.value;\n rank.value = 0;\n }\n rank.dm = this.getModifier(rank.value);\n if (amount <= 0) break;\n }\n }\n\n $this.update({ system: { characteristics: data } });\n }\n\n static getContainers($this) {\n const containers = [];\n for (let item of $this.items) {\n if (item.type == \"container\") {\n containers.push(item);\n }\n }\n\n containers.sort(this.compareByName);\n\n return containers;\n }\n\n static getComputers($this) {\n const containers = [];\n for (let item of $this.items) {\n if (item.type == \"computer\") {\n containers.push(item);\n }\n }\n\n containers.sort(this.compareByName);\n\n return containers;\n }\n\n static getSkills($this) {\n const skills = [];\n for (let item of $this.items) {\n if (item.type === \"talent\" && item.system.subType === \"skill\") {\n skills.push(item);\n }\n }\n\n skills.sort(this.compareByName);\n\n return skills;\n }\n\n static computeCharacteristics(changed) {\n let modified = this.computeCharacteristic(changed, \"strength\");\n\n if (this.computeCharacteristic(changed, \"dexterity\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"endurance\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"intellect\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"education\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"social\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"morale\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"luck\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"sanity\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"charm\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"psionic\") && !modified) modified = true;\n if (this.computeCharacteristic(changed, \"other\") && !modified) modified = true;\n\n return modified;\n }\n\n static computeCharacteristic(changed, name) {\n //if (isNaN(c.value) || c.value <= 0) c.value = 0;\n //c.dm = this._getModifier(c.value)\n const path = `system.characteristics.${name}`;\n const newValue = foundry.utils.getProperty(changed, path + \".value\");// || this.system.characteristics[name].value;\n if (newValue) {\n const dm = this.getModifier(newValue);\n foundry.utils.setProperty(changed, path + \".dm\", dm);\n return true;\n }\n\n return false;\n }\n\n static getModifier(value) {\n if (isNaN(value) || value <= 0) return -3;\n if (value >= 1 && value <= 2) return -2;\n if (value >= 3 && value <= 5) return -1;\n if (value >= 6 && value <= 8) return 0;\n if (value >= 9 && value <= 11) return 1;\n if (value >= 12 && value <= 14) return 2;\n\n return 3;\n }\n\n static compareByName(a, b) {\n if (!a.hasOwnProperty(\"name\") || !b.hasOwnProperty(\"name\")) {\n return 0;\n }\n return a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n }\n}","import { ActorCharacter } from \"./character.js\";\n\nexport class MGT2Combatant extends Combatant {\n \n}\n\nexport class TravellerActor extends Actor {\n\n\n prepareDerivedData() {\n if (this.type === \"character\") {\n this.system.initiative = ActorCharacter.getInitiative(this);\n }\n }\n\n async _preCreate(data, options, user) {\n if ( (await super._preCreate(data, options, user)) === false ) return false;\n \n if (this.type === \"character\") {\n ActorCharacter.preCreate(this, data, options, user);\n }\n }\n\n async _onDeleteDescendantDocuments(parent, collection, documents, ids, options, userId) {\n await super._onDeleteDescendantDocuments(parent, collection, documents, ids, options, userId);\n\n if (this.type === \"character\") {\n await ActorCharacter.onDeleteDescendantDocuments(this, parent, collection, documents, ids, options, userId);\n }\n }\n\n async _onUpdateDescendantDocuments(parent, collection, documents, changes, options, userId) {\n super._onUpdateDescendantDocuments(parent, collection, documents, changes, options, userId);\n //console.log(\"_onUpdateDescendantDocuments\");\n\n if (this.type === \"character\") {\n await ActorCharacter.onUpdateDescendantDocuments(this, parent, collection, documents, changes, options, userId);\n }\n }\n\n async _preUpdate(changed, options, user) {\n if ((await super._preUpdate(changed, options, user)) === false) return false;\n\n if (this.type === \"character\") {\n await ActorCharacter.preUpdate(this, changed, options, user);\n }\n }\n\n getInitiative($this) {\n if (this.type === \"character\") {\n return ActorCharacter.getInitiative(this);\n }\n }\n\n applyDamage(amount) {\n if (this.type === \"character\") {\n ActorCharacter.applyDamage(this, amount);\n }\n }\n\n getContainers() {\n if (this.type === \"character\") {\n return ActorCharacter.getContainers(this);\n }\n\n return [];\n }\n\n getComputers() {\n if (this.type === \"character\") {\n return ActorCharacter.getComputers(this);\n }\n\n return [];\n }\n\n getSkills() {\n if (this.type === \"character\") {\n return ActorCharacter.getSkills(this);\n }\n\n return [];\n }\n\n async recalculateWeight() {\n if (this.type === \"character\") {\n return ActorCharacter.recalculateWeight(this);\n }\n }\n\n}\n","export class TravellerItem extends Item {\n\n /** @inheritdoc */\n prepareDerivedData() {\n super.prepareDerivedData();\n\n }\n\n async _preUpdate(changed, options, user) {\n if ((await super._preUpdate(changed, options, user)) === false) return false;\n\n if (this.type === \"computer\") {\n // Overload\n const newProcessing = foundry.utils.getProperty(changed, \"system.processing\") ?? this.system.processing;\n if (newProcessing !== this.system.processing) {\n let overload = this.system.processingUsed > newProcessing;\n foundry.utils.setProperty(changed, \"system.overload\", overload);\n }\n }\n\n // Qty max 1\n if (this.type === \"computer\" || this.type === \"container\" || (this.type === \"item\" && this.system.subType === \"software\")) {\n const newQty = foundry.utils.getProperty(changed, \"system.quantity\") ?? this.system.quantity;\n if (newQty !== this.system.quantity && newQty > 1) {\n foundry.utils.setProperty(changed, \"system.quantity\", 1);\n }\n }\n\n // No Weight\n if (this.type === \"item\" && this.system.subType === \"software\") {\n const newWeight = foundry.utils.getProperty(changed, \"system.weight\") ?? this.system.weight;\n if (newWeight !== this.system.weight && newWeight > 0) {\n foundry.utils.setProperty(changed, \"system.weight\", 0);\n }\n }\n }\n\n getRollDisplay() {\n if (this.type === \"talent\") {\n if (this.system.subType === \"skill\") {\n let label;\n if (this.system.skill.speciality !== \"\" && this.system.skill.speciality !== undefined) {\n label = `${this.name} (${this.system.skill.speciality})`;\n } else {\n label = this.name;\n }\n\n if (this.system.level > 0)\n label += ` (+${this.system.level})`;\n else if (this.system.level < 0)\n label += ` (${this.system.level})`;\n\n return label;\n } else if (this.system.subType === \"psionic\") {\n\n }\n }\n\n return name;\n }\n}\n","const { HandlebarsApplicationMixin } = foundry.applications.api;\n\nexport default class MGT2ActorSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ActorSheetV2) {\n\n static SHEET_MODES = { EDIT: 0, PLAY: 1 }\n\n constructor(options = {}) {\n super(options);\n this._sheetMode = this.constructor.SHEET_MODES.PLAY;\n }\n\n /** @override */\n static DEFAULT_OPTIONS = {\n classes: [\"mgt2\", \"sheet\", \"actor\"],\n position: {\n width: 780,\n },\n form: {\n submitOnChange: true,\n closeOnSubmit: false,\n },\n window: {\n resizable: true,\n },\n dragDrop: [{ dragSelector: \".drag-item-list\", dropSelector: \".drop-item-list\" }],\n actions: {\n toggleSheet: MGT2ActorSheet.#onToggleSheet,\n },\n }\n\n get isPlayMode() {\n if (this._sheetMode === undefined) this._sheetMode = this.constructor.SHEET_MODES.PLAY;\n return this._sheetMode === this.constructor.SHEET_MODES.PLAY;\n }\n\n get isEditMode() {\n if (this._sheetMode === undefined) this._sheetMode = this.constructor.SHEET_MODES.PLAY;\n return this._sheetMode === this.constructor.SHEET_MODES.EDIT;\n }\n\n tabGroups = { primary: \"stats\" }\n\n /** @override */\n async _prepareContext() {\n const base = await super._prepareContext();\n const actor = this.document;\n return {\n ...base,\n actor: actor,\n // Flat shorthands for template backward-compat (AppV1 style)\n name: actor.name,\n img: actor.img,\n cssClass: this.isEditable ? \"editable\" : \"locked\",\n system: actor.system,\n source: actor.toObject(),\n fields: actor.schema.fields,\n systemFields: actor.system.schema.fields,\n isEditable: this.isEditable,\n isEditMode: this.isEditMode,\n isPlayMode: this.isPlayMode,\n isGM: game.user.isGM,\n config: CONFIG.MGT2,\n };\n }\n\n /** @override */\n _onRender(context, options) {\n super._onRender(context, options);\n this._activateTabGroups();\n }\n\n _activateTabGroups() {\n for (const [group, activeTab] of Object.entries(this.tabGroups)) {\n const nav = this.element.querySelector(`nav[data-group=\"${group}\"]`);\n if (!nav) continue;\n\n nav.querySelectorAll('[data-tab]').forEach(link => {\n link.classList.toggle('active', link.dataset.tab === activeTab);\n link.addEventListener('click', event => {\n event.preventDefault();\n this.tabGroups[group] = link.dataset.tab;\n this.render();\n });\n });\n\n this.element.querySelectorAll(`[data-group=\"${group}\"][data-tab]`).forEach(content => {\n content.classList.toggle('active', content.dataset.tab === activeTab);\n });\n }\n }\n\n /** @override */\n _canDragDrop(selector) {\n return this.isEditable;\n }\n\n static async #onToggleSheet(event) {\n event.preventDefault();\n this._sheetMode = this.isPlayMode\n ? this.constructor.SHEET_MODES.EDIT\n : this.constructor.SHEET_MODES.PLAY;\n this.render();\n }\n}\n","export class MGT2Helper {\n static POUNDS_CONVERT = 2.20462262185;\n\n static decimalSeparator;\n static badDecimalSeparator;\n\n static {\n this.decimalSeparator = Number(1.1).toLocaleString().charAt(1);\n this.badDecimalSeparator = (this.decimalSeparator === \".\" ? \",\" : \".\");\n }\n\n static format = function() {\n var s = arguments[0];\n for (var i = 0; i < arguments.length - 1; i++) { \n var reg = new RegExp(\"\\\\{\" + i + \"\\\\}\", \"gm\"); \n s = s.replace(reg, arguments[i + 1]);\n }\n return s;\n }\n\n static hasValue(object, property) {\n return object !== undefined && object.hasOwnProperty(property) && object[property] !== null && object[property] !== undefined && object[property] !== \"\";\n }\n\n static getItemsWeight(items) {\n let weight = 0;\n for (let i of items) {\n let item = i.hasOwnProperty(\"system\") ? i.system : i;\n if (item.hasOwnProperty(\"weightless\") && item.weightless === true) {\n continue;\n }\n\n if (item.hasOwnProperty(\"weight\")) {\n let itemQty = item.quantity\n if (!isNaN(itemQty) && itemQty > 0) {\n let itemWeight = item.weight;\n if (itemWeight > 0) {\n weight += itemWeight * itemQty;\n }\n }\n }\n }\n return weight;\n }\n\n static generateUID() {\n let result = '';\n const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';\n\n for (let i = 0; i < 36; i++) {\n const randomIndex = Math.floor(Math.random() * characters.length);\n result += characters.charAt(randomIndex);\n if (i === 8 || i === 12 || i === 16 || i === 20)\n result += \"-\";\n }\n\n return result;\n }\n\n static compareByName(a, b) {\n if (!a.hasOwnProperty(\"name\") || !b.hasOwnProperty(\"name\")) {\n return 0;\n }\n return a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n }\n\n static getDisplayDM(dm) {\n if (dm === 0) return \" (0)\";\n if (dm > 0) return ` (+${dm})`;\n if (dm < 0) return ` (${dm})`;\n return \"\";\n }\n static getFormulaDM(dm) {\n if (dm === 0) return \"+0\";\n if (dm > 0) return `+${dm}`;\n if (dm < 0) return `${dm}`;\n return \"\";\n }\n\n static getDiceResults(roll) {\n const results = [];\n for (const die of roll.dice) {\n results.push(die.results);\n }\n return results.flat(2);\n }\n\n static getDiceTotal(roll) {\n let total = 0;\n for (const die of roll.dice) {\n total += die.total;\n }\n return total;\n }\n\n static getDifficultyValue(difficulty) {\n switch(difficulty) {\n case \"Simple\": return 2;\n case \"Easy\": return 4;\n case \"Routine\": return 6;\n case \"Average\": return 8;\n case \"Difficult\": return 10;\n case \"VeryDifficult\": return 12;\n case \"Formidable\": return 14;\n case \"Impossible\": return 16;\n default:\n return 0;\n }\n }\n\n static getDifficultyDisplay(difficulty) {\n switch(difficulty) {\n case \"Simple\": return game.i18n.localize(\"MGT2.Difficulty.Simple\") + \" (2+)\";\n case \"Easy\": return game.i18n.localize(\"MGT2.Difficulty.Easy\") + \" (4+)\";\n case \"Routine\": return game.i18n.localize(\"MGT2.Difficulty.Routine\") + \" (6+)\";\n case \"Average\": return game.i18n.localize(\"MGT2.Difficulty.Average\") + \" (8+)\";\n case \"Difficult\": return game.i18n.localize(\"MGT2.Difficulty.Difficult\") + \" (10+)\";\n case \"VeryDifficult\": return game.i18n.localize(\"MGT2.Difficulty.VeryDifficult\") + \" (12+)\";\n case \"Formidable\": return game.i18n.localize(\"MGT2.Difficulty.Formidable\") + \" (14+)\";\n case \"Impossible\": return game.i18n.localize(\"MGT2.Difficulty.Impossible\") + \" (16+)\";\n default:\n return null;\n }\n }\n\n static getRangeDisplay(range) {\n let value = Number(range.value);\n\n if (isNaN(value)) return null;\n\n let label;\n //if (game.settings.get(\"mgt2\", \"useDistanceMetric\") === true) {\n if (range.unit !== null && range.unit !== undefined && range.unit !== \"\")\n label = game.i18n.localize(`MGT2.MetricRange.${range.unit}`).toLowerCase();\n else\n label = \"\";\n //} else {\n // TODO\n //}\n\n return `${value}${label}`;\n }\n\n static getWeightLabel() {\n //const label = game.settings.get(\"mgt2\", \"useWeightMetric\") === true ? \"MGT2.MetricSystem.Weight.kg\" : \"MGT2.ImperialSystem.Weight.lb\";\n //return game.i18n.localize(label);\n return game.i18n.localize(\"MGT2.MetricSystem.Weight.kg\");\n }\n\n static getDistanceLabel() {\n //const label = game.settings.get(\"mgt2\", \"useDistanceMetric\") === true ? \"MGT2.MetricSystem.Distance.km\" : \"MGT2.ImperialSystem.Distance.mi\";\n //return game.i18n.localize(label);\n return game.i18n.localize(\"MGT2.MetricSystem.Distance.km\");\n }\n\n static getIntegerFromInput(data) {\n return Math.trunc(this.getNumberFromInput(data));\n }\n\n static getNumberFromInput(data) {\n if (data === undefined || data === null) return 0;\n\n if (typeof data === \"string\") {\n let converted = Number(data.replace(/\\s+/g, '').replace(this.badDecimalSeparator, this.decimalSeparator).trim());\n if (isNaN(converted))\n return 0;\n\n return converted;\n }\n\n let converted = Number(data);\n\n if (isNaN(converted))\n return 0;\n\n return converted;\n }\n\n static convertWeightForDisplay(weight) {\n //if (game.settings.get(\"mgt2\", \"useWeightMetric\") === true || weight === 0)\n return weight;\n\n // Metric to Imperial\n //const pounds = weight * this.POUNDS_CONVERT;\n //return Math.round(pounds * 10) / 10;\n }\n\n static convertWeightFromInput(weight) {\n //if (game.settings.get(\"mgt2\", \"useWeightMetric\") === true || weight === 0)\n return Math.round(weight * 10) / 10;\n\n // Imperial to Metric\n //const kg = this.POUNDS_CONVERT / weight;\n //return Math.round(kg * 10) / 10;\n }\n\n static getDataFromDropEvent(event) {\n let data;\n try {\n return JSON.parse(event.dataTransfer?.getData(\"text/plain\"));\n } catch (err) {\n return false;\n }\n\n //if ( data.type !== \"Item\" ) return false;\n //const item = await Item.implementation.fromDropData(data);\n }\n\n static async getItemDataFromDropData(dropData) {\n //console.log(\"getItemDataFromDropData\");\n let item;\n if (game.modules.get(\"monks-enhanced-journal\")?.active && dropData.itemId && dropData.uuid.includes(\"JournalEntry\")) {\n const journalEntry = await fromUuid(dropData.uuid);\n } else if (dropData.hasOwnProperty(\"uuid\")) {\n item = await fromUuid(dropData.uuid);\n } else {\n let uuid = `${dropData.type}.${dropData.data._id}`;\n item = await fromUuid(uuid);\n }\n\n if (!item) {\n throw new Error(game.i18n.localize(\"Errors.CouldNotFindItem\").replace(\"_ITEM_ID_\", dropData.uuid));\n }\n if (item.pack) {\n const pack = game.packs.get(item.pack);\n item = await pack?.getDocument(item._id);\n }\n return deepClone(item);\n }\n}","class RollPromptDialog extends Dialog {\n constructor(dialogData = {}, options = {}) {\n super(dialogData, options);\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\", \"dialog\"];\n }\n\n static async create(options) {\n\n const htmlContent = await renderTemplate('systems/mgt2/templates/roll-prompt.html', {\n config: CONFIG.MGT2,\n //formula: formula,\n characteristics: options.characteristics,\n characteristic: options.characteristic,\n skills: options.skills,\n skill: options.skill,\n fatigue: options.fatigue,\n encumbrance: options.encumbrance,\n difficulty: options.difficulty\n });\n\n const results = new Promise(resolve => {\n new this({\n title: options.title,\n content: htmlContent,\n buttons: {\n boon: {\n label: game.i18n.localize(\"MGT2.RollPrompt.Boon\"),\n callback: (html) => {\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\n formData.diceModifier = \"dl\";\n resolve(formData);\n }\n },\n submit: {\n label: game.i18n.localize(\"MGT2.RollPrompt.Roll\"),\n icon: '',\n callback: (html) => {\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\n resolve(formData);\n },\n },\n bane: {\n label: game.i18n.localize(\"MGT2.RollPrompt.Bane\"),\n //icon: '',\n callback: (html) => {\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\n formData.diceModifier = \"dh\";\n resolve(formData);\n }\n }\n }\n //close: () => { resolve(false) }\n }).render(true);\n });\n\n //console.log(Promise.resolve(results));\n return results;\n }\n}\n\nexport class RollPromptHelper {\n\n static async roll(options) {\n return await RollPromptDialog.create(options);\n }\n\n static async promptForFruitTraits() {\n const htmlContent = await renderTemplate('systems/mgt2/templateschat/chat/roll-prompt.html');\n\n return new Promise((resolve, reject) => {\n const dialog = new Dialog({\n title: \"Fruit Traits\",\n content: htmlContent,\n buttons: {\n submit: {\n label: \"Roll\",\n icon: '',\n callback: (html) => {\n const formData = new FormDataExtended(html[0].querySelector('form'))\n .toObject();\n\n //verifyFruitInputs(formData);\n\n resolve(formData);\n },\n },\n skip: {\n label: \"Cancel\",\n callback: () => resolve(null),\n }\n },\n render: (html) => {\n //html.on('click', 'button[data-preset]', handleFruitPreset);\n },\n close: () => {\n reject('User closed dialog without making a selection.');\n },\n });\n\n dialog.render(true);\n });\n }\n}","class EditorFullViewDialog extends Dialog {\n constructor(dialogData = {}, options = {}) {\n super(dialogData, options);\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"];\n this.options.resizable = true;\n }\n\n static async create(title, html) {\n const htmlContent = await renderTemplate(\"systems/mgt2/templates/editor-fullview.html\", {\n config: CONFIG.MGT2,\n html: html\n });\n\n const results = new Promise(resolve => {\n new this({\n title: title,\n content: htmlContent,\n buttons: {\n //close: { label: game.i18n.localize(\"MGT2.Close\") }\n }\n }).render(true);\n });\n\n return results;\n }\n}\n\nclass ActorConfigDialog extends Dialog {\n constructor(dialogData = {}, options = {}) {\n super(dialogData, options);\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"];\n }\n\n static async create(system) {\n const htmlContent = await renderTemplate(\"systems/mgt2/templates/actors/actor-config-sheet.html\", {\n config: CONFIG.MGT2,\n system: system\n });\n\n const results = new Promise(resolve => {\n new this({\n title: \"Configuration\",\n content: htmlContent,\n buttons: {\n submit: {\n label: game.i18n.localize(\"MGT2.Save\"),\n icon: '',\n callback: (html) => {\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\n resolve(formData);\n },\n }\n }\n }).render(true);\n });\n\n return results;\n }\n}\n\nclass ActorCharacteristicDialog extends Dialog {\n // https://foundryvtt.wiki/en/development/api/dialog\n constructor(dialogData = {}, options = {}) {\n super(dialogData, options);\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"];\n }\n\n static async create(name, show, showMax, showAll = false) {\n const htmlContent = await renderTemplate(\"systems/mgt2/templates/actors/actor-config-characteristic-sheet.html\", {\n name: name,\n show: show,\n showMax: showMax,\n showAll: showAll\n });\n\n const results = new Promise(resolve => {\n new this({\n title: \"Configuration: \" + name,\n content: htmlContent,\n buttons: {\n submit: {\n label: game.i18n.localize(\"MGT2.Save\"),\n icon: '',\n callback: (html) => {\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\n resolve(formData);\n },\n }\n }\n }).render(true);\n });\n\n return results;\n }\n}\n\nclass TraitEditDialog extends Dialog {\n constructor(dialogData = {}, options = {}) {\n super(dialogData, options);\n this.options.classes = [\"mgt2\", game.settings.get(\"mgt2\", \"theme\"), \"sheet\"];\n }\n\n static async create(data) {\n const htmlContent = await renderTemplate(\"systems/mgt2/templates/actors/trait-sheet.html\", {\n config: CONFIG.MGT2,\n data: data\n });\n const title = data.hasOwnProperty(\"name\") && data.name !== undefined ? data.name : game.i18n.localize(\"MGT2.Actor.EditTrait\");\n const results = new Promise(resolve => {\n new this({\n title: title,\n content: htmlContent,\n buttons: {\n submit: {\n label: game.i18n.localize(\"MGT2.Save\"),\n icon: '',\n callback: (html) => {\n const formData = new FormDataExtended(html[0].querySelector('form')).object;\n resolve(formData);\n },\n }\n //cancel: { label: \"Cancel\" }\n }\n // close: (html) => {\n // console.log(\"This always is logged no matter which option is chosen\");\n // const formData = new FormDataExtended(html[0].querySelector('form')).object;\n // resolve(formData);\n // }\n }).render(true);\n });\n\n return results;\n }\n}\n\nexport class CharacterPrompts {\n\n static async openConfig(system) {\n return await ActorConfigDialog.create(system);\n }\n\n static async openCharacteristic(name, hide, showMax, showAll = false) {\n return await ActorCharacteristicDialog.create(name, hide, showMax, showAll);\n }\n\n static async openTraitEdit(data) {\n return await TraitEditDialog.create(data);\n }\n\n static async openEditorFullView(title, html) {\n return await EditorFullViewDialog.create(title, html);\n } \n}","import MGT2ActorSheet from \"./base-actor-sheet.mjs\";\nimport { MGT2 } from \"../../config.js\";\nimport { MGT2Helper } from \"../../helper.js\";\nimport { RollPromptHelper } from \"../../roll-prompt.js\";\nimport { CharacterPrompts } from \"../../actors/character-prompts.js\";\n\nexport default class TravellerCharacterSheet extends MGT2ActorSheet {\n\n /** @override */\n static DEFAULT_OPTIONS = {\n ...super.DEFAULT_OPTIONS,\n classes: [...super.DEFAULT_OPTIONS.classes, \"character\", \"nopad\"],\n window: {\n ...super.DEFAULT_OPTIONS.window,\n title: \"TYPES.Actor.character\",\n },\n actions: {\n ...super.DEFAULT_OPTIONS.actions,\n createItem: TravellerCharacterSheet.#onCreateItem,\n editItem: TravellerCharacterSheet.#onEditItem,\n deleteItem: TravellerCharacterSheet.#onDeleteItem,\n equipItem: TravellerCharacterSheet.#onEquipItem,\n itemStorageIn: TravellerCharacterSheet.#onItemStorageIn,\n itemStorageOut: TravellerCharacterSheet.#onItemStorageOut,\n softwareEject: TravellerCharacterSheet.#onSoftwareEject,\n createContainer: TravellerCharacterSheet.#onContainerCreate,\n editContainer: TravellerCharacterSheet.#onContainerEdit,\n deleteContainer: TravellerCharacterSheet.#onContainerDelete,\n roll: TravellerCharacterSheet.#onRoll,\n openConfig: TravellerCharacterSheet.#onOpenConfig,\n openCharacteristic: TravellerCharacterSheet.#onOpenCharacteristic,\n traitCreate: TravellerCharacterSheet.#onTraitCreate,\n traitEdit: TravellerCharacterSheet.#onTraitEdit,\n traitDelete: TravellerCharacterSheet.#onTraitDelete,\n openEditor: TravellerCharacterSheet.#onOpenEditor,\n },\n }\n\n /** @override */\n static PARTS = {\n sheet: {\n template: \"systems/mgt2/templates/actors/actor-sheet.html\",\n },\n }\n\n /** @override */\n tabGroups = {\n primary: \"inventory\",\n characteristics: \"core\",\n inventory: \"onhand\",\n }\n\n /** @override */\n async _prepareContext() {\n const context = await super._prepareContext();\n const actor = this.document;\n\n context.settings = {\n weightUnit: \"kg\",\n usePronouns: game.settings.get(\"mgt2\", \"usePronouns\"),\n useGender: game.settings.get(\"mgt2\", \"useGender\"),\n showLife: game.settings.get(\"mgt2\", \"showLife\"),\n };\n context.isGM = game.user.isGM;\n context.showTrash = false;\n context.initiative = actor.getInitiative();\n\n this._prepareCharacterItems(context);\n\n return context;\n }\n\n _prepareCharacterItems(context) {\n const actor = this.document;\n const settings = context.settings;\n const items = actor.items;\n\n const weapons = [], armors = [], augments = [], computers = [], softwares = [];\n const miscItems = [], equipments = [], containerItems = [], careers = [];\n const skills = [], psionics = [], diseases = [], wounds = [], contacts = [];\n const actorContainers = [];\n\n for (let i of items) {\n if (i.type === \"container\") {\n actorContainers.push(i);\n } else if (i.type === \"computer\") {\n computers.push(i);\n i._subItems = [];\n if (i.system.overload === true)\n i._overloadClass = \"computer-overload\";\n }\n }\n\n actorContainers.sort(MGT2Helper.compareByName);\n\n const containers = [{ name: \"(tous)\", _id: \"\" }].concat(actorContainers);\n const containerIndex = new Map();\n\n for (let c of actorContainers) {\n containerIndex.set(c._id, c);\n\n if (c.system.weight > 0) {\n const w = MGT2Helper.convertWeightForDisplay(c.system.weight) + \" \" + settings.weightUnit;\n c._display = c.name.length > 12 ? `${c.name.substring(0, 12)}... (${w})` : `${c.name} (${w})`;\n } else {\n c._display = c.name.length > 12 ? c.name.substring(0, 12) + \"...\" : c.name;\n }\n\n if (c.system.onHand === true)\n c._subItems = [];\n }\n\n const containerView = actor.system.containerView;\n let currentContainerView = containerView !== \"\" ? containerIndex.get(containerView) : null;\n\n context.containerView = currentContainerView || null;\n context.containerWeight = currentContainerView\n ? MGT2Helper.convertWeightForDisplay(currentContainerView.system.weight)\n : MGT2Helper.convertWeightForDisplay(0);\n context.containerShowAll = containerView === \"\";\n\n for (let i of items) {\n const item = i.system;\n\n if (item.hasOwnProperty(\"weight\") && item.weight > 0) {\n i._weight = isNaN(item.quantity)\n ? MGT2Helper.convertWeightForDisplay(item.weight) + \" \" + settings.weightUnit\n : MGT2Helper.convertWeightForDisplay(item.weight * item.quantity) + \" \" + settings.weightUnit;\n }\n\n if (item.hasOwnProperty(\"container\") && item.container.id !== \"\" && item.container.id !== undefined) {\n const container = containerIndex.get(item.container.id);\n if (container === undefined) {\n if (context.containerShowAll) {\n i._containerName = \"#deleted#\";\n containerItems.push(i);\n }\n continue;\n }\n\n if (container.system.locked && !game.user.isGM) continue;\n\n if (container.system.onHand === true)\n container._subItems.push(i);\n\n if (context.containerShowAll || actor.system.containerView === item.container.id) {\n i._containerName = container.name;\n containerItems.push(i);\n }\n continue;\n }\n\n if (item.hasOwnProperty(\"equipped\")) {\n i._canEquip = true;\n i._toggleClass = item.equipped ? \"active\" : \"\";\n } else {\n i._canEquip = false;\n }\n\n switch (i.type) {\n case \"equipment\":\n (i.system.subType === \"augment\" ? augments : equipments).push(i);\n break;\n\n case \"armor\":\n if (i.system.options?.length > 0)\n i._subInfo = i.system.options.map(x => x.name).join(\", \");\n armors.push(i);\n break;\n\n case \"computer\":\n if (i.system.options?.length > 0)\n i._subInfo = i.system.options.map(x => x.name).join(\", \");\n break;\n\n case \"item\":\n if (i.system.subType === \"software\") {\n if (i.system.software.computerId && i.system.software.computerId !== \"\") {\n const computer = computers.find(x => x._id === i.system.software.computerId);\n if (computer !== undefined) computer._subItems.push(i);\n else softwares.push(i);\n } else {\n i._display = i.system.software.bandwidth > 0\n ? `${i.name} (${i.system.software.bandwidth})`\n : i.name;\n softwares.push(i);\n }\n } else {\n miscItems.push(i);\n }\n break;\n\n case \"weapon\":\n i._range = i.system.range.isMelee\n ? game.i18n.localize(\"MGT2.Melee\")\n : MGT2Helper.getRangeDisplay(i.system.range);\n if (i.system.traits?.length > 0)\n i._subInfo = i.system.traits.map(x => x.name).join(\", \");\n weapons.push(i);\n break;\n\n case \"career\":\n careers.push(i);\n break;\n\n case \"contact\":\n contacts.push(i);\n break;\n\n case \"disease\":\n (i.system.subType === \"wound\" ? wounds : diseases).push(i);\n break;\n\n case \"talent\":\n if (i.system.subType === \"skill\") {\n skills.push(i);\n } else {\n if (MGT2Helper.hasValue(i.system.psionic, \"reach\"))\n i._reach = game.i18n.localize(`MGT2.PsionicReach.${i.system.psionic.reach}`);\n if (MGT2Helper.hasValue(i.system.roll, \"difficulty\"))\n i._difficulty = game.i18n.localize(`MGT2.Difficulty.${i.system.roll.difficulty}`);\n psionics.push(i);\n }\n break;\n\n case \"container\":\n if (i.system.onHand === true)\n miscItems.push(i);\n break;\n }\n }\n\n const byName = MGT2Helper.compareByName;\n const byEquipName = (a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n\n context.encumbranceNormal = MGT2Helper.convertWeightForDisplay(actor.system.inventory.encumbrance.normal);\n context.encumbranceHeavy = MGT2Helper.convertWeightForDisplay(actor.system.inventory.encumbrance.heavy);\n\n const totalWeight = actor.system.inventory.weight;\n if (totalWeight > actor.system.inventory.encumbrance.heavy) {\n context.encumbranceClasses = \"encumbrance-heavy\";\n context.encumbrance = 2;\n } else if (totalWeight > actor.system.inventory.encumbrance.normal) {\n context.encumbranceClasses = \"encumbrance-normal\";\n context.encumbrance = 1;\n } else {\n context.encumbrance = 0;\n }\n\n if (softwares.length > 0) { softwares.sort(byName); context.softwares = softwares; }\n augments.sort(byEquipName); context.augments = augments;\n armors.sort(byEquipName); context.armors = armors;\n computers.sort(byEquipName); context.computers = computers;\n context.careers = careers;\n contacts.sort(byName); context.contacts = contacts;\n containers.sort(byName); context.containers = containers;\n diseases.sort(byName); context.diseases = diseases;\n context.wounds = wounds;\n equipments.sort(byEquipName); context.equipments = equipments;\n miscItems.sort(byEquipName); context.items = miscItems;\n actorContainers.sort(byName); context.actorContainers = actorContainers;\n skills.sort(byName); context.skills = skills;\n psionics.sort(byName); context.psionics = psionics;\n weapons.sort(byEquipName); context.weapons = weapons;\n\n if (containerItems.length > 0) {\n containerItems.sort((a, b) => {\n const r = a._containerName.localeCompare(b._containerName);\n return r !== 0 ? r : a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n });\n }\n context.containerItems = containerItems;\n }\n\n // =========================================================\n // Event Binding (AppV2 _onRender — replaces jQuery activateListeners)\n // Templates still use CSS class selectors, so we bind manually here.\n // =========================================================\n\n /** @override */\n _onRender(context, options) {\n super._onRender(context, options);\n const html = this.element;\n if (!this.isEditable) return;\n\n this._bindClassEvent(html, \".roll\", \"click\", TravellerCharacterSheet.#onRoll);\n this._bindClassEvent(html, \".cfg-characteristic\", \"click\", TravellerCharacterSheet.#onOpenCharacteristic);\n this._bindClassEvent(html, \".item-create\", \"click\", TravellerCharacterSheet.#onCreateItem);\n this._bindClassEvent(html, \".item-edit\", \"click\", TravellerCharacterSheet.#onEditItem);\n this._bindClassEvent(html, \".item-delete\", \"click\", TravellerCharacterSheet.#onDeleteItem);\n this._bindClassEvent(html, \".item-equip\", \"click\", TravellerCharacterSheet.#onEquipItem);\n this._bindClassEvent(html, \".item-storage-in\", \"click\", TravellerCharacterSheet.#onItemStorageIn);\n this._bindClassEvent(html, \".item-storage-out\", \"click\", TravellerCharacterSheet.#onItemStorageOut);\n this._bindClassEvent(html, \".software-eject\", \"click\", TravellerCharacterSheet.#onSoftwareEject);\n this._bindClassEvent(html, \".container-create\", \"click\", TravellerCharacterSheet.#onContainerCreate);\n this._bindClassEvent(html, \".container-edit\", \"click\", TravellerCharacterSheet.#onContainerEdit);\n this._bindClassEvent(html, \".container-delete\", \"click\", TravellerCharacterSheet.#onContainerDelete);\n this._bindClassEvent(html, \".traits-create\", \"click\", TravellerCharacterSheet.#onTraitCreate);\n this._bindClassEvent(html, \".traits-edit\", \"click\", TravellerCharacterSheet.#onTraitEdit);\n this._bindClassEvent(html, \".traits-delete\", \"click\", TravellerCharacterSheet.#onTraitDelete);\n this._bindClassEvent(html, \"[data-editor='open']\", \"click\", TravellerCharacterSheet.#onOpenEditor);\n html.querySelector(\"[name='config']\")?.addEventListener(\"click\", (ev) => TravellerCharacterSheet.#onOpenConfig.call(this, ev, ev.currentTarget));\n }\n\n /** Helper: bind a handler to all matching elements, with `this` set to the sheet instance */\n _bindClassEvent(html, selector, event, handler) {\n for (const el of html.querySelectorAll(selector)) {\n el.addEventListener(event, (ev) => handler.call(this, ev, ev.currentTarget));\n }\n }\n\n // =========================================================\n // Drag & Drop\n // =========================================================\n\n /** @override */\n async _onDrop(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n const dropData = MGT2Helper.getDataFromDropEvent(event);\n if (!dropData) return false;\n\n const sourceItemData = await MGT2Helper.getItemDataFromDropData(dropData);\n\n if (sourceItemData.type === \"species\") {\n const update = {\n system: {\n personal: {\n species: sourceItemData.name,\n speciesText: {\n description: sourceItemData.system.description,\n descriptionLong: sourceItemData.system.descriptionLong,\n },\n },\n },\n };\n update.system.personal.traits = this.actor.system.personal.traits.concat(sourceItemData.system.traits);\n\n if (sourceItemData.system.modifiers?.length > 0) {\n update.system.characteristics = {};\n for (let modifier of sourceItemData.system.modifiers) {\n if (MGT2Helper.hasValue(modifier, \"characteristic\") && MGT2Helper.hasValue(modifier, \"value\")) {\n const c = this.actor.system.characteristics[modifier.characteristic];\n const updateValue = { value: c.value + modifier.value };\n if (c.showMax) updateValue.max = c.max + modifier.value;\n update.system.characteristics[modifier.characteristic] = updateValue;\n }\n }\n }\n\n this.actor.update(update);\n return true;\n }\n\n if ([\"contact\", \"disease\", \"career\", \"talent\"].includes(sourceItemData.type)) {\n let transferData = {};\n try { transferData = sourceItemData.toJSON(); } catch (e) { transferData = sourceItemData; }\n delete transferData._id;\n delete transferData.id;\n await this.actor.createEmbeddedDocuments(\"Item\", [transferData]);\n return true;\n }\n\n if (![\"armor\", \"weapon\", \"computer\", \"container\", \"item\", \"equipment\"].includes(sourceItemData.type)) return false;\n\n const target = event.target.closest(\".table-row\");\n let targetId = null;\n let targetItem = null;\n if (target !== null) {\n targetId = target.dataset.itemId;\n targetItem = this.actor.getEmbeddedDocument(\"Item\", targetId);\n }\n\n let sourceItem = this.actor.getEmbeddedDocument(\"Item\", sourceItemData.id);\n if (sourceItem) {\n if (!targetItem) return false;\n sourceItem = foundry.utils.deepClone(sourceItem);\n if (sourceItem._id === targetId) return false;\n\n if (targetItem.type === \"item\" || targetItem.type === \"equipment\") {\n if (targetItem.system.subType === \"software\")\n sourceItem.system.software.computerId = targetItem.system.software.computerId;\n else\n sourceItem.system.container.id = targetItem.system.container.id;\n this.actor.updateEmbeddedDocuments(\"Item\", [sourceItem]);\n return true;\n } else if (targetItem.type === \"computer\") {\n sourceItem.system.software.computerId = targetId;\n this.actor.updateEmbeddedDocuments(\"Item\", [sourceItem]);\n return true;\n } else if (targetItem.type === \"container\") {\n if (targetItem.system.locked && !game.user.isGM) {\n ui.notifications.error(\"Verrouillé\");\n } else {\n sourceItem.system.container.id = targetId;\n this.actor.updateEmbeddedDocuments(\"Item\", [sourceItem]);\n return true;\n }\n }\n } else {\n let transferData = {};\n try { transferData = sourceItemData.toJSON(); } catch (e) { transferData = sourceItemData; }\n delete transferData._id;\n delete transferData.id;\n\n const recalcWeight = transferData.system.hasOwnProperty(\"weight\");\n\n if (transferData.system.hasOwnProperty(\"container\")) transferData.system.container.id = \"\";\n if (transferData.type === \"item\" && transferData.system.subType === \"software\") transferData.system.software.computerId = \"\";\n if (transferData.type === \"container\") transferData.system.onHand = true;\n if (transferData.system.hasOwnProperty(\"equipment\")) transferData.system.equipped = false;\n\n if (targetItem !== null) {\n if (transferData.type === \"item\" && transferData.system.subType === \"software\") {\n if (targetItem.type === \"item\" && targetItem.system.subType === \"software\")\n transferData.system.software.computerId = targetItem.system.software.computerId;\n else if (targetItem.type === \"computer\")\n transferData.system.software.computerId = targetItem._id;\n } else if ([\"armor\", \"computer\", \"equipment\", \"item\", \"weapon\"].includes(transferData.type)) {\n if (targetItem.type === \"container\") {\n if (!targetItem.system.locked || game.user.isGM)\n transferData.system.container.id = targetId;\n } else {\n transferData.system.container.id = targetItem.system.container.id;\n }\n }\n }\n\n await this.actor.createEmbeddedDocuments(\"Item\", [transferData]);\n if (recalcWeight) await this.actor.recalculateWeight();\n }\n return true;\n }\n\n // =========================================================\n // Actions (static private methods)\n // =========================================================\n\n static async #onCreateItem(event, target) {\n event.preventDefault();\n const data = {\n name: target.dataset.createName,\n type: target.dataset.typeItem,\n };\n if (target.dataset.subtype) {\n data.system = { subType: target.dataset.subtype };\n }\n const cls = getDocumentClass(\"Item\");\n return cls.create(data, { parent: this.actor });\n }\n\n static async #onEditItem(event, target) {\n event.preventDefault();\n const li = target.closest(\"[data-item-id]\");\n const item = this.actor.getEmbeddedDocument(\"Item\", li?.dataset.itemId);\n if (item) item.sheet.render(true);\n }\n\n static async #onDeleteItem(event, target) {\n event.preventDefault();\n const li = target.closest(\"[data-item-id]\");\n if (!li?.dataset.itemId) return;\n this.actor.deleteEmbeddedDocuments(\"Item\", [li.dataset.itemId]);\n }\n\n static async #onEquipItem(event, target) {\n event.preventDefault();\n const li = target.closest(\"[data-item-id]\");\n const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument(\"Item\", li?.dataset.itemId));\n if (!item) return;\n item.system.equipped = !item.system.equipped;\n this.actor.updateEmbeddedDocuments(\"Item\", [item]);\n }\n\n static async #onItemStorageIn(event, target) {\n event.preventDefault();\n const li = target.closest(\"[data-item-id]\");\n const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument(\"Item\", li?.dataset.itemId));\n if (!item) return;\n\n if (item.type === \"container\") {\n item.system.onHand = false;\n } else {\n const containers = this.actor.getContainers();\n let container;\n const dropInId = this.actor.system.containerDropIn;\n\n if (!dropInId) {\n container = containers.length === 0\n ? await getDocumentClass(\"Item\").create({ name: \"New container\", type: \"container\" }, { parent: this.actor })\n : containers[0];\n } else {\n container = containers.find(x => x._id === dropInId);\n }\n\n if (container?.system.locked && !game.user.isGM) {\n ui.notifications.error(\"Objet verrouillé\");\n return;\n }\n item.system.container.id = container._id;\n }\n this.actor.updateEmbeddedDocuments(\"Item\", [item]);\n }\n\n static async #onItemStorageOut(event, target) {\n event.preventDefault();\n const li = target.closest(\"[data-item-id]\");\n const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument(\"Item\", li?.dataset.itemId));\n if (!item) return;\n item.system.container.id = \"\";\n this.actor.updateEmbeddedDocuments(\"Item\", [item]);\n }\n\n static async #onSoftwareEject(event, target) {\n event.preventDefault();\n const li = target.closest(\"[data-item-id]\");\n const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument(\"Item\", li?.dataset.itemId));\n if (!item) return;\n item.system.software.computerId = \"\";\n this.actor.updateEmbeddedDocuments(\"Item\", [item]);\n }\n\n static async #onContainerCreate(event) {\n event.preventDefault();\n const cls = getDocumentClass(\"Item\");\n return cls.create({ name: \"New container\", type: \"container\" }, { parent: this.actor });\n }\n\n static async #onContainerEdit(event) {\n event.preventDefault();\n const container = this.actor.getEmbeddedDocument(\"Item\", this.actor.system.containerView);\n if (container) container.sheet.render(true);\n }\n\n static async #onContainerDelete(event) {\n event.preventDefault();\n const containers = this.actor.getContainers();\n const container = containers.find(x => x._id === this.actor.system.containerView);\n if (!container) return;\n\n const containerItems = this.actor.items.filter(\n x => x.system.hasOwnProperty(\"container\") && x.system.container.id === container._id\n );\n\n if (containerItems.length > 0) {\n for (let item of containerItems) {\n let clone = foundry.utils.deepClone(item);\n clone.system.container.id = \"\";\n this.actor.updateEmbeddedDocuments(\"Item\", [clone]);\n }\n }\n\n const cloneActor = foundry.utils.deepClone(this.actor);\n cloneActor.system.containerView = \"\";\n if (cloneActor.system.containerDropIn === container._id) {\n cloneActor.system.containerDropIn = \"\";\n const remaining = containers.filter(x => x._id !== container._id);\n if (remaining.length > 0) cloneActor.system.containerDropIn = remaining[0]._id;\n }\n\n this.actor.deleteEmbeddedDocuments(\"Item\", [container._id]);\n this.actor.update(cloneActor);\n }\n\n static async #onRoll(event, target) {\n event.preventDefault();\n\n const rollOptions = {\n rollTypeName: game.i18n.localize(\"MGT2.RollPrompt.Roll\"),\n rollObjectName: \"\",\n characteristics: [{ _id: \"\", name: \"\" }],\n characteristic: \"\",\n skills: [],\n skill: \"\",\n fatigue: this.actor.system.states.fatigue,\n encumbrance: this.actor.system.states.encumbrance,\n difficulty: null,\n damageFormula: null,\n };\n\n const cardButtons = [];\n for (const [key, label] of Object.entries(MGT2.Characteristics)) {\n const c = this.actor.system.characteristics[key];\n if (c.show) {\n rollOptions.characteristics.push({\n _id: key,\n name: game.i18n.localize(label) + MGT2Helper.getDisplayDM(c.dm),\n });\n }\n }\n\n for (let item of this.actor.items) {\n if (item.type === \"talent\" && item.system.subType === \"skill\")\n rollOptions.skills.push({ _id: item._id, name: item.getRollDisplay() });\n }\n\n rollOptions.skills.sort(MGT2Helper.compareByName);\n rollOptions.skills = [{ _id: \"NP\", name: game.i18n.localize(\"MGT2.Items.NotProficient\") }].concat(rollOptions.skills);\n\n let itemObj = null;\n let isInitiative = false;\n const rollType = target.dataset.roll;\n\n if (rollType === \"initiative\") {\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.RollPrompt.InitiativeRoll\");\n rollOptions.characteristic = this.actor.system.config.initiative;\n isInitiative = true;\n } else if (rollType === \"characteristic\") {\n rollOptions.characteristic = target.dataset.rollCharacteristic;\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.RollPrompt.CharacteristicRoll\");\n rollOptions.rollObjectName = game.i18n.localize(`MGT2.Characteristics.${rollOptions.characteristic}.name`);\n } else {\n if (rollType === \"skill\") {\n rollOptions.skill = target.dataset.rollSkill;\n itemObj = this.actor.getEmbeddedDocument(\"Item\", rollOptions.skill);\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.RollPrompt.SkillRoll\");\n rollOptions.rollObjectName = itemObj.name;\n } else if (rollType === \"psionic\") {\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.RollPrompt.PsionicRoll\");\n }\n\n if (itemObj === null && target.dataset.itemId) {\n itemObj = this.actor.getEmbeddedDocument(\"Item\", target.dataset.itemId);\n rollOptions.rollObjectName = itemObj.name;\n if (itemObj.type === \"weapon\") rollOptions.rollTypeName = game.i18n.localize(\"TYPES.Item.weapon\");\n else if (itemObj.type === \"armor\") rollOptions.rollTypeName = game.i18n.localize(\"TYPES.Item.armor\");\n else if (itemObj.type === \"computer\") rollOptions.rollTypeName = game.i18n.localize(\"TYPES.Item.computer\");\n }\n\n if (rollType === \"psionic\" && itemObj) {\n rollOptions.rollObjectName = itemObj.name;\n if (MGT2Helper.hasValue(itemObj.system.psionic, \"duration\")) {\n cardButtons.push({\n label: game.i18n.localize(\"MGT2.Items.Duration\"),\n formula: itemObj.system.psionic.duration,\n message: {\n objectName: itemObj.name,\n flavor: \"{0} \".concat(game.i18n.localize(`MGT2.Durations.${itemObj.system.psionic.durationUnit}`)),\n },\n });\n }\n }\n\n if (itemObj?.system.hasOwnProperty(\"damage\")) {\n rollOptions.damageFormula = itemObj.system.damage;\n if (itemObj.type === \"disease\") {\n if (itemObj.system.subType === \"disease\")\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.DiseaseSubType.disease\");\n else if (itemObj.system.subType === \"poison\")\n rollOptions.rollTypeName = game.i18n.localize(\"MGT2.DiseaseSubType.poison\");\n }\n }\n\n if (itemObj?.system.hasOwnProperty(\"roll\")) {\n if (MGT2Helper.hasValue(itemObj.system.roll, \"characteristic\")) rollOptions.characteristic = itemObj.system.roll.characteristic;\n if (MGT2Helper.hasValue(itemObj.system.roll, \"skill\")) rollOptions.skill = itemObj.system.roll.skill;\n if (MGT2Helper.hasValue(itemObj.system.roll, \"difficulty\")) rollOptions.difficulty = itemObj.system.roll.difficulty;\n }\n }\n\n const userRollData = await RollPromptHelper.roll(rollOptions);\n\n const rollModifiers = [];\n const rollFormulaParts = [];\n\n if (userRollData.diceModifier) {\n rollFormulaParts.push(\"3d6\", userRollData.diceModifier);\n } else {\n rollFormulaParts.push(\"2d6\");\n }\n\n if (userRollData.characteristic) {\n const c = this.actor.system.characteristics[userRollData.characteristic];\n rollFormulaParts.push(MGT2Helper.getFormulaDM(c.dm));\n rollModifiers.push(game.i18n.localize(`MGT2.Characteristics.${userRollData.characteristic}.name`) + MGT2Helper.getDisplayDM(c.dm));\n }\n\n if (userRollData.skill) {\n if (userRollData.skill === \"NP\") {\n rollFormulaParts.push(\"-3\");\n rollModifiers.push(game.i18n.localize(\"MGT2.Items.NotProficient\"));\n } else {\n const skillObj = this.actor.getEmbeddedDocument(\"Item\", userRollData.skill);\n rollFormulaParts.push(MGT2Helper.getFormulaDM(skillObj.system.level));\n rollModifiers.push(skillObj.getRollDisplay());\n }\n }\n\n if (userRollData.psionic) {\n const psionicObj = this.actor.getEmbeddedDocument(\"Item\", userRollData.psionic);\n rollFormulaParts.push(MGT2Helper.getFormulaDM(psionicObj.system.level));\n rollModifiers.push(psionicObj.getRollDisplay());\n }\n\n if (userRollData.timeframes && userRollData.timeframes !== \"\" && userRollData.timeframes !== \"Normal\") {\n rollModifiers.push(game.i18n.localize(`MGT2.Timeframes.${userRollData.timeframes}`));\n rollFormulaParts.push(userRollData.timeframes === \"Slower\" ? \"+2\" : \"-2\");\n }\n\n if (userRollData.encumbrance === true) {\n rollFormulaParts.push(\"-2\");\n rollModifiers.push(game.i18n.localize(\"MGT2.Actor.Encumbrance\") + \" -2\");\n }\n\n if (userRollData.fatigue === true) {\n rollFormulaParts.push(\"-2\");\n rollModifiers.push(game.i18n.localize(\"MGT2.Actor.Fatigue\") + \" -2\");\n }\n\n if (userRollData.customDM) {\n const s = userRollData.customDM.trim();\n if (/^[0-9]/.test(s)) rollFormulaParts.push(\"+\");\n rollFormulaParts.push(s);\n }\n\n if (MGT2Helper.hasValue(userRollData, \"difficulty\")) rollOptions.difficulty = userRollData.difficulty;\n\n const rollFormula = rollFormulaParts.join(\"\");\n if (!Roll.validate(rollFormula)) {\n ui.notifications.error(game.i18n.localize(\"MGT2.Errors.InvalidRollFormula\"));\n return;\n }\n\n let roll = await new Roll(rollFormula, this.actor.getRollData()).roll({ async: true, rollMode: userRollData.rollMode });\n\n if (isInitiative && this.token?.combatant) {\n await this.token.combatant.update({ initiative: roll.total });\n }\n\n const chatData = {\n user: game.user.id,\n speaker: this.actor ? ChatMessage.getSpeaker({ actor: this.actor }) : null,\n formula: roll._formula,\n tooltip: await roll.getTooltip(),\n total: Math.round(roll.total * 100) / 100,\n type: CONST.CHAT_MESSAGE_TYPES.ROLL,\n showButtons: true,\n showLifeButtons: false,\n showRollRequest: false,\n rollTypeName: rollOptions.rollTypeName,\n rollObjectName: rollOptions.rollObjectName,\n rollModifiers: rollModifiers,\n showRollDamage: rollOptions.damageFormula !== null && rollOptions.damageFormula !== \"\",\n cardButtons: cardButtons,\n };\n\n if (MGT2Helper.hasValue(rollOptions, \"difficulty\")) {\n chatData.rollDifficulty = rollOptions.difficulty;\n chatData.rollDifficultyLabel = MGT2Helper.getDifficultyDisplay(rollOptions.difficulty);\n if (roll.total >= MGT2Helper.getDifficultyValue(rollOptions.difficulty))\n chatData.rollSuccess = true;\n else\n chatData.rollFailure = true;\n }\n\n const html = await renderTemplate(\"systems/mgt2/templates/chat/roll.html\", chatData);\n chatData.content = html;\n\n let flags = null;\n if (rollOptions.damageFormula) {\n flags = { mgt2: { damage: { formula: rollOptions.damageFormula, rollObjectName: rollOptions.rollObjectName, rollTypeName: rollOptions.rollTypeName } } };\n }\n if (cardButtons.length > 0) {\n if (!flags) flags = { mgt2: {} };\n flags.mgt2.buttons = cardButtons;\n }\n if (flags) chatData.flags = flags;\n\n return roll.toMessage(chatData);\n }\n\n static async #onOpenConfig(event) {\n event.preventDefault();\n const userConfig = await CharacterPrompts.openConfig(this.actor.system);\n if (userConfig) this.actor.update({ \"system.config\": userConfig });\n }\n\n static async #onOpenCharacteristic(event, target) {\n event.preventDefault();\n const name = target.dataset.cfgCharacteristic;\n const c = this.actor.system.characteristics[name];\n\n let showAll = false;\n for (const value of Object.values(this.actor.system.characteristics)) {\n if (!value.show) { showAll = true; break; }\n }\n\n const userConfig = await CharacterPrompts.openCharacteristic(\n game.i18n.localize(`MGT2.Characteristics.${name}.name`),\n c.show, c.showMax, showAll\n );\n\n if (userConfig) {\n const data = { system: { characteristics: {} } };\n data.system.characteristics[name] = { show: userConfig.show, showMax: userConfig.showMax };\n\n if (userConfig.showAll === true) {\n for (const [key, value] of Object.entries(this.actor.system.characteristics)) {\n if (key !== name && !value.show)\n data.system.characteristics[key] = { show: true };\n }\n }\n this.actor.update(data);\n }\n }\n\n static async #onTraitCreate(event) {\n event.preventDefault();\n let traits = this.actor.system.personal.traits;\n let newTraits;\n if (traits.length === 0) {\n newTraits = [{ name: \"\", description: \"\" }];\n } else {\n newTraits = [...traits, { name: \"\", description: \"\" }];\n }\n return this.actor.update({ system: { personal: { traits: newTraits } } });\n }\n\n static async #onTraitEdit(event, target) {\n event.preventDefault();\n const element = target.closest(\"[data-traits-part]\");\n const index = Number(element.dataset.traitsPart);\n const trait = this.actor.system.personal.traits[index];\n const result = await CharacterPrompts.openTraitEdit(trait);\n const traits = [...this.actor.system.personal.traits];\n traits[index] = { ...traits[index], name: result.name, description: result.description };\n return this.actor.update({ system: { personal: { traits: traits } } });\n }\n\n static async #onTraitDelete(event, target) {\n event.preventDefault();\n const element = target.closest(\"[data-traits-part]\");\n const index = Number(element.dataset.traitsPart);\n const traits = foundry.utils.deepClone(this.actor.system.personal.traits);\n const newTraits = Object.entries(traits)\n .filter(([key]) => Number(key) !== index)\n .map(([, value]) => value);\n return this.actor.update({ system: { personal: { traits: newTraits } } });\n }\n\n static async #onOpenEditor(event) {\n event.preventDefault();\n await CharacterPrompts.openEditorFullView(\n this.actor.system.personal.species,\n this.actor.system.personal.speciesText.descriptionLong\n );\n }\n}\n","import MGT2ActorSheet from \"./base-actor-sheet.mjs\";\n\nexport default class TravellerVehiculeSheet extends MGT2ActorSheet {\n\n /** @override */\n static DEFAULT_OPTIONS = {\n ...super.DEFAULT_OPTIONS,\n classes: [...super.DEFAULT_OPTIONS.classes, \"vehicule\", \"nopad\"],\n window: {\n ...super.DEFAULT_OPTIONS.window,\n title: \"TYPES.Actor.vehicule\",\n },\n }\n\n /** @override */\n static PARTS = {\n sheet: {\n template: \"systems/mgt2/templates/actors/vehicule-sheet.html\",\n },\n }\n\n /** @override */\n tabGroups = { primary: \"stats\" }\n}\n","const { HandlebarsApplicationMixin } = foundry.applications.api;\nimport { MGT2Helper } from \"../../helper.js\";\n\nexport default class TravellerItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {\n\n /** @override */\n static DEFAULT_OPTIONS = {\n classes: [\"mgt2\", \"sheet\", \"item\"],\n position: { width: 630 },\n form: {\n submitOnChange: true,\n closeOnSubmit: false,\n },\n window: { resizable: true },\n actions: {\n careerEventCreate: TravellerItemSheet.#onCareerEventCreate,\n careerEventDelete: TravellerItemSheet.#onCareerEventDelete,\n optionCreate: TravellerItemSheet.#onOptionCreate,\n optionDelete: TravellerItemSheet.#onOptionDelete,\n modifierCreate: TravellerItemSheet.#onModifierCreate,\n modifierDelete: TravellerItemSheet.#onModifierDelete,\n },\n }\n\n /** @override */\n static PARTS = {\n sheet: {\n // template is dynamic — resolved in _prepareContext / _renderHTML\n template: \"\",\n },\n }\n\n /** Resolve template dynamically based on item type */\n get template() {\n return `systems/mgt2/templates/items/${this.document.type}-sheet.html`;\n }\n\n tabGroups = { primary: \"tab1\" }\n\n /** @override */\n async _prepareContext() {\n const item = this.document;\n const source = item.toObject();\n\n const settings = {\n usePronouns: game.settings.get(\"mgt2\", \"usePronouns\"),\n };\n\n let containers = null;\n let computers = null;\n let hadContainer = false;\n\n if (item.actor !== null) {\n hadContainer = true;\n containers = [{ name: \"\", _id: \"\" }].concat(item.actor.getContainers());\n computers = [{ name: \"\", _id: \"\" }].concat(item.actor.getComputers());\n }\n\n let weight = null;\n if (item.system.hasOwnProperty(\"weight\")) {\n weight = MGT2Helper.convertWeightForDisplay(item.system.weight);\n }\n\n let skills = [];\n if (this.actor !== null) {\n for (let actorItem of this.actor.items) {\n if (actorItem.type === \"talent\" && actorItem.system.subType === \"skill\")\n skills.push({ _id: actorItem._id, name: actorItem.getRollDisplay() });\n }\n }\n skills.sort(MGT2Helper.compareByName);\n skills = [{ _id: \"NP\", name: game.i18n.localize(\"MGT2.Items.NotProficient\") }].concat(skills);\n\n return {\n item: item,\n document: item,\n cssClass: this.isEditable ? \"editable\" : \"locked\",\n system: item.system,\n source: source.system,\n fields: item.schema.fields,\n systemFields: item.system.schema.fields,\n isEditable: this.isEditable,\n isGM: game.user.isGM,\n config: CONFIG,\n settings: settings,\n containers: containers,\n computers: computers,\n hadContainer: hadContainer,\n weight: weight,\n unitlabels: { weight: MGT2Helper.getWeightLabel() },\n skills: skills,\n };\n }\n\n /** @override — resolve the per-type template before rendering */\n async _renderHTML(context, options) {\n const templatePath = `systems/mgt2/templates/items/${this.document.type}-sheet.html`;\n const html = await renderTemplate(templatePath, context);\n return { sheet: html };\n }\n\n /** @override — put rendered HTML into the window content */\n _replaceHTML(result, content, options) {\n content.innerHTML = result.sheet;\n this._activateTabGroups();\n this._bindItemEvents();\n }\n\n /** Bind CSS class-based events (templates not yet migrated to data-action) */\n _bindItemEvents() {\n const html = this.element;\n if (!this.isEditable) return;\n const bind = (sel, handler) => {\n for (const el of html.querySelectorAll(sel)) {\n el.addEventListener(\"click\", (ev) => handler.call(this, ev, ev.currentTarget));\n }\n };\n bind(\".event-create\", TravellerItemSheet.#onCareerEventCreate);\n bind(\".event-delete\", TravellerItemSheet.#onCareerEventDelete);\n bind(\".options-create\", TravellerItemSheet.#onOptionCreate);\n bind(\".options-delete\", TravellerItemSheet.#onOptionDelete);\n bind(\".modifiers-create\", TravellerItemSheet.#onModifierCreate);\n bind(\".modifiers-delete\", TravellerItemSheet.#onModifierDelete);\n }\n\n _activateTabGroups() {\n for (const [group, activeTab] of Object.entries(this.tabGroups)) {\n const nav = this.element.querySelector(`nav[data-group=\"${group}\"], .horizontal-tabs`);\n if (!nav) continue;\n\n nav.querySelectorAll('[data-tab]').forEach(link => {\n link.classList.toggle('active', link.dataset.tab === activeTab);\n link.addEventListener('click', event => {\n event.preventDefault();\n this.tabGroups[group] = link.dataset.tab;\n this.render();\n });\n });\n\n this.element.querySelectorAll(`.itemsheet-panel [data-tab], [data-group=\"${group}\"][data-tab]`).forEach(content => {\n content.classList.toggle('active', content.dataset.tab === activeTab);\n });\n }\n }\n\n /** @override — process form data before submit (weight/qty/cost conversions + container logic) */\n _prepareSubmitData(event, form, formData) {\n const data = foundry.utils.expandObject(formData.object);\n\n if (data.hasOwnProperty(\"weight\")) {\n data.system = data.system || {};\n data.system.weight = MGT2Helper.convertWeightFromInput(data.weight);\n delete data.weight;\n }\n\n if (data.system?.hasOwnProperty(\"quantity\")) {\n data.system.quantity = MGT2Helper.getIntegerFromInput(data.system.quantity);\n }\n\n if (data.system?.hasOwnProperty(\"cost\")) {\n data.system.cost = MGT2Helper.getIntegerFromInput(data.system.cost);\n }\n\n // Container/equipped logic\n if (data.system?.hasOwnProperty(\"container\") && this.document.system.hasOwnProperty(\"equipped\")) {\n const equippedChange = this.document.system.equipped !== data.system.equipped;\n const containerChange = this.document.system.container?.id !== data.system.container?.id;\n\n if (equippedChange && data.system.equipped === true) {\n data.system.container = { id: \"\" };\n } else if (containerChange && data.system.container?.id !== \"\" && this.document.system.container?.id === \"\") {\n data.system.equipped = false;\n }\n }\n\n return foundry.utils.flattenObject(data);\n }\n\n // =========================================================\n // Actions\n // =========================================================\n\n static async #onCareerEventCreate(event) {\n event.preventDefault();\n const events = this.document.system.events;\n let newEvents;\n if (!events || events.length === 0) {\n newEvents = [{ age: \"\", description: \"\" }];\n } else {\n newEvents = [...events, { age: \"\", description: \"\" }];\n }\n return this.document.update({ system: { events: newEvents } });\n }\n\n static async #onCareerEventDelete(event, target) {\n event.preventDefault();\n const element = target.closest(\"[data-events-part]\");\n const index = Number(element.dataset.eventsPart);\n const events = foundry.utils.deepClone(this.document.system.events);\n const newEvents = Object.entries(events)\n .filter(([key]) => Number(key) !== index)\n .map(([, val]) => val);\n return this.document.update({ system: { events: newEvents } });\n }\n\n static async #onOptionCreate(event, target) {\n event.preventDefault();\n const property = target.dataset.property;\n const options = this.document.system[property];\n let newOptions;\n if (!options || options.length === 0) {\n newOptions = [{ name: \"\", description: \"\" }];\n } else {\n newOptions = [...options, { name: \"\", description: \"\" }];\n }\n return this.document.update({ [`system.${property}`]: newOptions });\n }\n\n static async #onOptionDelete(event, target) {\n event.preventDefault();\n const element = target.closest(\"[data-options-part]\");\n const property = element.dataset.property;\n const index = Number(element.dataset.optionsPart);\n const options = foundry.utils.deepClone(this.document.system[property]);\n const newOptions = Object.entries(options)\n .filter(([key]) => Number(key) !== index)\n .map(([, val]) => val);\n return this.document.update({ [`system.${property}`]: newOptions });\n }\n\n static async #onModifierCreate(event) {\n event.preventDefault();\n const modifiers = this.document.system.modifiers;\n let newModifiers;\n if (!modifiers || modifiers.length === 0) {\n newModifiers = [{ characteristic: \"Endurance\", value: null }];\n } else {\n newModifiers = [...modifiers, { characteristic: \"Endurance\", value: null }];\n }\n return this.document.update({ system: { modifiers: newModifiers } });\n }\n\n static async #onModifierDelete(event, target) {\n event.preventDefault();\n const element = target.closest(\"[data-modifiers-part]\");\n const index = Number(element.dataset.modifiersPart);\n const modifiers = foundry.utils.deepClone(this.document.system.modifiers);\n const newModifiers = Object.entries(modifiers)\n .filter(([key]) => Number(key) !== index)\n .map(([, val]) => val);\n return this.document.update({ system: { modifiers: newModifiers } });\n }\n}\n","/**\n * Define a set of template paths to pre-load\n * Pre-loaded templates are compiled and cached for fast access when rendering\n * @return {Promise}\n */\nexport const preloadHandlebarsTemplates = async function() {\n\n const templatePaths = [\n \"systems/mgt2/templates/items/parts/sheet-configuration.html\",\n \"systems/mgt2/templates/items/parts/sheet-physical-item.html\",\n \"systems/mgt2/templates/roll-prompt.html\",\n \"systems/mgt2/templates/chat/roll.html\",\n //\"systems/mgt2/templates/chat/roll-characteristic.html\",\n \"systems/mgt2/templates/actors/actor-config-sheet.html\",\n \"systems/mgt2/templates/actors/actor-config-characteristic-sheet.html\",\n \"systems/mgt2/templates/actors/trait-sheet.html\",\n \"systems/mgt2/templates/editor-fullview.html\"\n //\"systems/mgt2/templates/actors/parts/actor-characteristic.html\"\n ];\n \n return loadTemplates(templatePaths);\n };","import { MGT2Helper } from \"./helper.js\";\n\nexport class ChatHelper {\n\n\n // _injectContent(message, type, html) {\n\n // _setupCardListeners(message, html);\n\n // }\n\n\n static setupCardListeners(message, html, messageData) {\n if (!message || !html) {\n return;\n }\n // if (SettingsUtility.getSettingValue(SETTING_NAMES.MANUAL_DAMAGE_MODE) > 0) {\n // html.find('.card-buttons').find(`[data-action='rsr-${ROLL_TYPE.DAMAGE}']`).click(async event => {\n // await _processDamageButtonEvent(message, event);\n // });\n // }\n html.find('button[data-action=\"rollDamage\"]').click(async event => {\n //ui.notifications.warn(\"rollDamage\");\n await this._processRollDamageButtonEvent(message, event);\n });\n\n html.find('button[data-action=\"damage\"]').click(async event => {\n //ui.notifications.warn(\"damage\");\n await this._applyChatCardDamage(message, event);\n //await _processApplyButtonEvent(message, event);\n });\n\n html.find('button[data-action=\"healing\"]').click(async event => {\n ui.notifications.warn(\"healing\");\n //await _processApplyTotalButtonEvent(message, event);\n });\n\n html.find('button[data-index]').click(async event => {\n \n await this._processRollButtonEvent(message, event);\n });\n }\n\n static async _processRollButtonEvent(message, event) {\n event.preventDefault();\n event.stopPropagation();\n let buttons = message.flags.mgt2.buttons;\n const index = event.target.dataset.index;\n const button = buttons[index];\n let roll = await new Roll(button.formula, {}).roll({ async: true });\n //console.log(message);\n\n const chatData = {\n user: game.user.id,\n speaker: message.speaker,\n formula: roll._formula,\n tooltip: await roll.getTooltip(),\n total: Math.round(roll.total * 100) / 100,\n //formula: isPrivate ? \"???\" : roll._formula,\n //tooltip: isPrivate ? \"\" : await roll.getTooltip(),\n //total: isPrivate ? \"?\" : Math.round(roll.total * 100) / 100,\n type: CONST.CHAT_MESSAGE_TYPES.ROLL,\n rollObjectName: button.message.objectName,\n rollMessage: MGT2Helper.format(button.message.flavor, Math.round(roll.total * 100) / 100),\n };\n\n const html = await renderTemplate(\"systems/mgt2/templates/chat/roll.html\", chatData);\n chatData.content = html;\n return roll.toMessage(chatData);\n }\n\n static async _processRollDamageButtonEvent(message, event) {\n event.preventDefault();\n event.stopPropagation();\n let rollFormula = message.flags.mgt2.damage.formula;\n\n let roll = await new Roll(rollFormula, {}).roll({ async: true });\n\n let speaker;\n let selectTokens = canvas.tokens.controlled;\n if (selectTokens.length > 0) {\n speaker = selectTokens[0].actor;\n } else {\n speaker = game.user.character;\n }\n\n let rollTypeName = message.flags.mgt2.damage.rollTypeName ? message.flags.mgt2.damage.rollTypeName + \" DAMAGE\" : null;\n\n const chatData = {\n user: game.user.id,\n speaker: ChatMessage.getSpeaker({ actor: speaker }),\n formula: roll._formula,\n tooltip: await roll.getTooltip(),\n total: Math.round(roll.total * 100) / 100,\n type: CONST.CHAT_MESSAGE_TYPES.ROLL,\n showButtons: true,\n hasDamage: true,\n rollTypeName: rollTypeName,\n rollObjectName: message.flags.mgt2.damage.rollObjectName\n };\n\n const html = await renderTemplate(\"systems/mgt2/templates/chat/roll.html\", chatData);\n chatData.content = html;\n\n return roll.toMessage(chatData);\n }\n\n async _processDamageButtonEvent(message, event) {\n event.preventDefault();\n event.stopPropagation();\n\n //message.flags[MODULE_SHORT].manualDamage = false\n //message.flags[MODULE_SHORT].renderDamage = true; \n // current user/actor\n\n await ItemUtility.runItemAction(null, message, ROLL_TYPE.DAMAGE);\n }\n\n static _applyChatCardDamage(message, event) {\n const roll = message.rolls[0];\n return Promise.all(canvas.tokens.controlled.map(t => {\n const a = t.actor;\n return a.applyDamage(roll.total);\n }));\n }\n}","export const registerSettings = function () {\n\n game.settings.register(\"mgt2\", \"theme\", {\n name: \"MGT2.Settings.theme.name\",\n hint: \"MGT2.Settings.theme.hint\",\n scope: \"client\",\n config: true,\n default: \"black-and-red\",\n type: String,\n choices: {\n \"black-and-red\": \"MGT2.Themes.BlackAndRed\",\n \"mwamba\": \"MGT2.Themes.Mwamba\",\n \"blue\": \"MGT2.Themes.Blue\"\n },\n requiresReload: true\n });\n\n game.settings.register('mgt2', 'usePronouns', {\n name: \"MGT2.Settings.usePronouns.name\",\n hint: \"MGT2.Settings.usePronouns.hint\",\n default: false,\n scope: 'world',\n type: Boolean,\n config: true,\n requiresReload: false\n });\n\n game.settings.register('mgt2', 'useGender', {\n name: \"MGT2.Settings.useGender.name\",\n hint: \"MGT2.Settings.useGender.hint\",\n default: false,\n scope: 'world',\n type: Boolean,\n config: true,\n requiresReload: false\n });\n\n game.settings.register('mgt2', 'showLife', {\n name: \"MGT2.Settings.showLife.name\",\n hint: \"MGT2.Settings.showLife.hint\",\n default: false,\n scope: 'world',\n type: Boolean,\n config: true,\n requiresReload: false\n });\n\n // game.settings.register('mgt2', 'useWeightMetric', {\n // name: \"MGT2.Settings.useWeightMetric.name\",\n // hint: \"MGT2.Settings.useWeightMetric.hint\",\n // default: true,\n // scope: 'world',\n // type: Boolean,\n // config: true,\n // requiresReload: true\n // });\n\n // game.settings.register('mgt2', 'useDistanceMetric', {\n // name: \"MGT2.Settings.useDistanceMetric.name\",\n // hint: \"MGT2.Settings.useDistanceMetric.hint\",\n // default: true,\n // scope: 'world',\n // type: Boolean,\n // config: true,\n // requiresReload: true\n // });\n\n // game.settings.register('mgt2', 'showTrash', {\n // name: \"Show Trash tab to Player\",\n // hint: \"Player can see the Trash tab and recover item\",\n // default: false,\n // scope: 'world',\n // type: Boolean,\n // config: true,\n // requiresReload: false\n // });\n\n /*game.settings.register('mgt2', 'containerDropIn', {\n name: \"Test\",\n hint: \"Mon hint\",\n default: true,\n scope: 'client',\n type: Boolean,\n config: true\n });*/\n};\n","import {\n CharacterData,\n VehiculeData,\n ItemData,\n EquipmentData,\n DiseaseData,\n CareerData,\n TalentData,\n ContactData,\n ArmorData,\n ComputerData,\n WeaponData,\n ItemContainerData,\n SpeciesData\n} from \"./models/index.mjs\";\n\nimport { MGT2 } from \"./config.js\";\nimport { TravellerActor, MGT2Combatant } from \"./actors/actor.js\";\nimport { TravellerItem } from \"./item.js\";\nimport { TravellerItemSheet, TravellerCharacterSheet, TravellerVehiculeSheet } from \"./applications/sheets/_module.mjs\";\nimport { preloadHandlebarsTemplates } from \"./templates.js\";\n//import { MGT2Helper } from \"./helper.js\";\nimport {ChatHelper} from \"./chatHelper.js\";\n\n/* -------------------------------------------- */\n/* Foundry VTT Initialization */\n/* -------------------------------------------- */\nimport { registerSettings } from \"./settings.js\";\n\nfunction registerHandlebarsHelpers() {\n Handlebars.registerHelper('showDM', function (dm) {\n if (dm === 0) return \"0\";\n if (dm > 0) return `+${dm}`;\n if (dm < 0) return `${dm}`;\n return \"\";\n });\n}\n\nHooks.once(\"init\", async function () {\n CONFIG.MGT2 = MGT2;\n CONFIG.Combat.initiative = {\n formula: \"2d6 + @initiative\",\n decimals: 2\n };\n\n CONFIG.Actor.trackableAttributes = {\n character: {\n bar: [\"life\",\n \"characteristics.strength\",\n \"characteristics.dexterity\",\n \"characteristics.endurance\",\n \"characteristics.intellect\",\n \"characteristics.education\",\n \"characteristics.social\",\n \"characteristics.morale\",\n \"characteristics.luck\",\n \"characteristics.sanity\",\n \"characteristics.charm\",\n \"characteristics.psionic\",\n \"characteristics.other\"\n ],\n value: [\"life.value\",\n \"health.radiations\",\n \"characteristics.strength.value\",\n \"characteristics.dexterity.value\",\n \"characteristics.endurance.value\",\n \"characteristics.intellect.value\",\n \"characteristics.education.value\",\n \"characteristics.social.value\",\n \"characteristics.morale.value\",\n \"characteristics.luck.value\",\n \"characteristics.sanity.value\",\n \"characteristics.charm.value\",\n \"characteristics.psionic.value\",\n \"characteristics.other.value\"]\n }\n };\n\n game.mgt2 = {\n TravellerActor,\n TravellerItem\n };\n\n registerHandlebarsHelpers();\n registerSettings();\n\n CONFIG.Combatant.documentClass = MGT2Combatant;\n CONFIG.Actor.documentClass = TravellerActor;\n CONFIG.Item.documentClass = TravellerItem;\n\n foundry.documents.collections.Actors.unregisterSheet(\"core\", foundry.appv1.sheets.ActorSheet);\n foundry.documents.collections.Actors.registerSheet(\"mgt2\", TravellerCharacterSheet, { types: [\"character\"], makeDefault: true, label: \"Traveller Sheet\" });\n foundry.documents.collections.Actors.registerSheet(\"mgt2\", TravellerVehiculeSheet, { types: [\"vehicule\"], makeDefault: true, label: \"Vehicule Sheet\" });\n\n foundry.documents.collections.Items.unregisterSheet(\"core\", foundry.appv1.sheets.ItemSheet);\n foundry.documents.collections.Items.registerSheet(\"mgt2\", TravellerItemSheet, { makeDefault: true });\n\n Object.assign(CONFIG.Actor.dataModels, {\n \"character\": CharacterData,\n \"vehicule\": VehiculeData\n });\n\n Object.assign(CONFIG.Item.dataModels, {\n \"item\": ItemData,\n \"equipment\": EquipmentData,\n \"disease\": DiseaseData,\n \"career\": CareerData,\n \"talent\": TalentData,\n \"contact\": ContactData,\n \"weapon\": WeaponData,\n \"computer\": ComputerData,\n \"armor\": ArmorData,\n \"container\": ItemContainerData,\n \"species\": SpeciesData\n });\n\n\n Hooks.on(\"renderChatMessage\", (message, html, messageData) => {\n ChatHelper.setupCardListeners(message, html, messageData);\n });\n\n // Preload template partials\n await preloadHandlebarsTemplates();\n});\n\nexport { MGT2 };"],"names":["fields","HandlebarsApplicationMixin"],"mappings":"AAAA,MAAMA,QAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM;;AAE3B,SAAS,yBAAyB,CAAC,IAAI,GAAG,IAAI,EAAE,OAAO,GAAG,KAAK,EAAE;AACxE,IAAI,OAAO,IAAIA,QAAM,CAAC,WAAW,CAAC;AAClC,QAAQ,KAAK,EAAE,IAAIA,QAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5F,QAAQ,GAAG,EAAE,IAAIA,QAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3F,QAAQ,EAAE,EAAE,IAAIA,QAAM,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAClF,QAAQ,IAAI,EAAE,IAAIA,QAAM,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AACzE,QAAQ,OAAO,EAAE,IAAIA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B,GAAG,CAAC;;AAEJ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;AACxC,IAAI,MAAM,EAAE,QAAQ;AACpB,IAAI,WAAW,EAAE,aAAa;AAC9B,IAAI,SAAS,EAAE,WAAW;AAC1B,IAAI,QAAQ,EAAE,UAAU;AACxB,IAAI,QAAQ,EAAE,UAAU;AACxB,IAAI,SAAS,EAAE,WAAW;AAC1B,IAAI,QAAQ,EAAE,UAAU;AACxB,IAAI,UAAU,EAAE,YAAY;AAC5B,IAAI,OAAO,EAAE,SAAS;AACtB,IAAI,WAAW,EAAE,iBAAiB;AAClC,IAAI,SAAS,EAAE;AACf,GAAG,CAAC;;;AAGJ,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,KAAK;AAChE,IAAI,UAAU,CAAC,kBAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC;AAC7D,EAAE,CAAC,CAAC;;AAEJ;AACA,EAAE,MAAM,0BAA0B,EAAE;AACpC,CAAC,CAAC;;;;"} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..fc87e57 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "name": "foundryvtt-mgt2", + "description": "Mongoose Traveller 2nd Edition for FoundryVTT", + "scripts": { + "build": "rollup -c rollup.config.mjs", + "watch": "rollup -c rollup.config.mjs --watch" + } +} diff --git a/rollup.config.mjs b/rollup.config.mjs new file mode 100644 index 0000000..e92eec9 --- /dev/null +++ b/rollup.config.mjs @@ -0,0 +1,8 @@ +export default { + input: 'src/module/core.js', + output: { + file: 'mgt2.bundle.js', + format: 'es', + sourcemap: true, + }, +}; diff --git a/src/module/actors/actor.js b/src/module/actors/actor.js index 76e1be9..ea4eaf6 100644 --- a/src/module/actors/actor.js +++ b/src/module/actors/actor.js @@ -82,6 +82,10 @@ export class TravellerActor extends Actor { return []; } - + async recalculateWeight() { + if (this.type === "character") { + return ActorCharacter.recalculateWeight(this); + } + } } diff --git a/src/module/actors/character.js b/src/module/actors/character.js index b96595d..a558686 100644 --- a/src/module/actors/character.js +++ b/src/module/actors/character.js @@ -27,7 +27,7 @@ export class ActorCharacter { // Eject software for (let item of $this.items) { if (item.system.hasOwnProperty("software") && item.system.computerId === d._id) { - let clone = duplicate(item); + let clone = foundry.utils.deepClone(item); clone.system.software.computerId = ""; itemToUpdates.push(clone); } @@ -41,7 +41,7 @@ export class ActorCharacter { if (itemToUpdates.length > 0) await $this.updateEmbeddedDocuments('Item', itemToUpdates); - await this.recalculateWeight(); + await this.recalculateWeight($this); } static async onUpdateDescendantDocuments($this, parent, collection, documents, changes, options, userId) { @@ -90,7 +90,7 @@ export class ActorCharacter { for (let computer of computers) { let newProcessingUsed = computerChanges[computer._id].processingUsed; if (computer.system.processingUsed !== newProcessingUsed) { - const cloneComputer = duplicate($this.getEmbeddedDocument("Item", computer._id)); + const cloneComputer = foundry.utils.deepClone($this.getEmbeddedDocument("Item", computer._id)); cloneComputer.system.processingUsed = newProcessingUsed; cloneComputer.system.overload = cloneComputer.system.processingUsed > cloneComputer.system.processing; updatedComputers.push(cloneComputer); @@ -138,7 +138,7 @@ export class ActorCharacter { } if (recalculEncumbrance || recalculWeight) { - const cloneActor = duplicate($this); + const cloneActor = foundry.utils.deepClone($this); await this.recalculateArmor($this, cloneActor); @@ -163,7 +163,7 @@ export class ActorCharacter { static async recalculateArmor($this, cloneActor) { if (cloneActor === null || cloneActor === undefined) - cloneActor = duplicate($this); + cloneActor = foundry.utils.deepClone($this); let armor = 0; for (let item of $this.items) { @@ -180,7 +180,7 @@ export class ActorCharacter { static async recalculateWeight($this, cloneActor) { if (cloneActor === null || cloneActor === undefined) - cloneActor = duplicate($this); + cloneActor = foundry.utils.deepClone($this); let updatedContainers = []; let containerChanges = {}; @@ -241,8 +241,8 @@ export class ActorCharacter { let newWeight = containerChanges[container._id].weight; let newCount = containerChanges[container._id].count; if (container.system.weight !== newWeight || container.system.count !== newCount) { - //const cloneContainer = duplicate(); - const cloneContainer = duplicate($this.getEmbeddedDocument("Item", container._id)); + //const cloneContainer = foundry.utils.deepClone(); + const cloneContainer = foundry.utils.deepClone($this.getEmbeddedDocument("Item", container._id)); //foundry.utils.setProperty(cloneContainer, "system.weight", newWeight); cloneContainer.system.weight = newWeight; cloneContainer.system.count = newCount; diff --git a/src/module/applications/sheets/_module.mjs b/src/module/applications/sheets/_module.mjs new file mode 100644 index 0000000..0b4a0f4 --- /dev/null +++ b/src/module/applications/sheets/_module.mjs @@ -0,0 +1,4 @@ +export { default as MGT2ActorSheet } from "./base-actor-sheet.mjs"; +export { default as TravellerCharacterSheet } from "./character-sheet.mjs"; +export { default as TravellerVehiculeSheet } from "./vehicule-sheet.mjs"; +export { default as TravellerItemSheet } from "./item-sheet.mjs"; diff --git a/src/module/applications/sheets/base-actor-sheet.mjs b/src/module/applications/sheets/base-actor-sheet.mjs new file mode 100644 index 0000000..658ccc7 --- /dev/null +++ b/src/module/applications/sheets/base-actor-sheet.mjs @@ -0,0 +1,104 @@ +const { HandlebarsApplicationMixin } = foundry.applications.api; + +export default class MGT2ActorSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ActorSheetV2) { + + static SHEET_MODES = { EDIT: 0, PLAY: 1 } + + constructor(options = {}) { + super(options); + this._sheetMode = this.constructor.SHEET_MODES.PLAY; + } + + /** @override */ + static DEFAULT_OPTIONS = { + classes: ["mgt2", "sheet", "actor"], + position: { + width: 780, + }, + form: { + submitOnChange: true, + closeOnSubmit: false, + }, + window: { + resizable: true, + }, + dragDrop: [{ dragSelector: ".drag-item-list", dropSelector: ".drop-item-list" }], + actions: { + toggleSheet: MGT2ActorSheet.#onToggleSheet, + }, + } + + get isPlayMode() { + if (this._sheetMode === undefined) this._sheetMode = this.constructor.SHEET_MODES.PLAY; + return this._sheetMode === this.constructor.SHEET_MODES.PLAY; + } + + get isEditMode() { + if (this._sheetMode === undefined) this._sheetMode = this.constructor.SHEET_MODES.PLAY; + return this._sheetMode === this.constructor.SHEET_MODES.EDIT; + } + + tabGroups = { primary: "stats" } + + /** @override */ + async _prepareContext() { + const base = await super._prepareContext(); + const actor = this.document; + return { + ...base, + actor: actor, + // Flat shorthands for template backward-compat (AppV1 style) + name: actor.name, + img: actor.img, + cssClass: this.isEditable ? "editable" : "locked", + system: actor.system, + source: actor.toObject(), + fields: actor.schema.fields, + systemFields: actor.system.schema.fields, + isEditable: this.isEditable, + isEditMode: this.isEditMode, + isPlayMode: this.isPlayMode, + isGM: game.user.isGM, + config: CONFIG.MGT2, + }; + } + + /** @override */ + _onRender(context, options) { + super._onRender(context, options); + this._activateTabGroups(); + } + + _activateTabGroups() { + for (const [group, activeTab] of Object.entries(this.tabGroups)) { + const nav = this.element.querySelector(`nav[data-group="${group}"]`); + if (!nav) continue; + + nav.querySelectorAll('[data-tab]').forEach(link => { + link.classList.toggle('active', link.dataset.tab === activeTab); + link.addEventListener('click', event => { + event.preventDefault(); + this.tabGroups[group] = link.dataset.tab; + this.render(); + }); + }); + + this.element.querySelectorAll(`[data-group="${group}"][data-tab]`).forEach(content => { + content.classList.toggle('active', content.dataset.tab === activeTab); + }); + } + } + + /** @override */ + _canDragDrop(selector) { + return this.isEditable; + } + + static async #onToggleSheet(event) { + event.preventDefault(); + this._sheetMode = this.isPlayMode + ? this.constructor.SHEET_MODES.EDIT + : this.constructor.SHEET_MODES.PLAY; + this.render(); + } +} diff --git a/src/module/applications/sheets/character-sheet.mjs b/src/module/applications/sheets/character-sheet.mjs new file mode 100644 index 0000000..8fb5a4a --- /dev/null +++ b/src/module/applications/sheets/character-sheet.mjs @@ -0,0 +1,848 @@ +import MGT2ActorSheet from "./base-actor-sheet.mjs"; +import { MGT2 } from "../../config.js"; +import { MGT2Helper } from "../../helper.js"; +import { RollPromptHelper } from "../../roll-prompt.js"; +import { CharacterPrompts } from "../../actors/character-prompts.js"; + +export default class TravellerCharacterSheet extends MGT2ActorSheet { + + /** @override */ + static DEFAULT_OPTIONS = { + ...super.DEFAULT_OPTIONS, + classes: [...super.DEFAULT_OPTIONS.classes, "character", "nopad"], + window: { + ...super.DEFAULT_OPTIONS.window, + title: "TYPES.Actor.character", + }, + actions: { + ...super.DEFAULT_OPTIONS.actions, + createItem: TravellerCharacterSheet.#onCreateItem, + editItem: TravellerCharacterSheet.#onEditItem, + deleteItem: TravellerCharacterSheet.#onDeleteItem, + equipItem: TravellerCharacterSheet.#onEquipItem, + itemStorageIn: TravellerCharacterSheet.#onItemStorageIn, + itemStorageOut: TravellerCharacterSheet.#onItemStorageOut, + softwareEject: TravellerCharacterSheet.#onSoftwareEject, + createContainer: TravellerCharacterSheet.#onContainerCreate, + editContainer: TravellerCharacterSheet.#onContainerEdit, + deleteContainer: TravellerCharacterSheet.#onContainerDelete, + roll: TravellerCharacterSheet.#onRoll, + openConfig: TravellerCharacterSheet.#onOpenConfig, + openCharacteristic: TravellerCharacterSheet.#onOpenCharacteristic, + traitCreate: TravellerCharacterSheet.#onTraitCreate, + traitEdit: TravellerCharacterSheet.#onTraitEdit, + traitDelete: TravellerCharacterSheet.#onTraitDelete, + openEditor: TravellerCharacterSheet.#onOpenEditor, + }, + } + + /** @override */ + static PARTS = { + sheet: { + template: "systems/mgt2/templates/actors/actor-sheet.html", + }, + } + + /** @override */ + tabGroups = { + primary: "inventory", + characteristics: "core", + inventory: "onhand", + } + + /** @override */ + async _prepareContext() { + const context = await super._prepareContext(); + const actor = this.document; + + context.settings = { + weightUnit: "kg", + usePronouns: game.settings.get("mgt2", "usePronouns"), + useGender: game.settings.get("mgt2", "useGender"), + showLife: game.settings.get("mgt2", "showLife"), + }; + context.isGM = game.user.isGM; + context.showTrash = false; + context.initiative = actor.getInitiative(); + + this._prepareCharacterItems(context); + + return context; + } + + _prepareCharacterItems(context) { + const actor = this.document; + const settings = context.settings; + const items = actor.items; + + const weapons = [], armors = [], augments = [], computers = [], softwares = []; + const miscItems = [], equipments = [], containerItems = [], careers = []; + const skills = [], psionics = [], diseases = [], wounds = [], contacts = []; + const actorContainers = []; + + for (let i of items) { + if (i.type === "container") { + actorContainers.push(i); + } else if (i.type === "computer") { + computers.push(i); + i._subItems = []; + if (i.system.overload === true) + i._overloadClass = "computer-overload"; + } + } + + actorContainers.sort(MGT2Helper.compareByName); + + const containers = [{ name: "(tous)", _id: "" }].concat(actorContainers); + const containerIndex = new Map(); + + for (let c of actorContainers) { + containerIndex.set(c._id, c); + + if (c.system.weight > 0) { + const w = MGT2Helper.convertWeightForDisplay(c.system.weight) + " " + settings.weightUnit; + c._display = c.name.length > 12 ? `${c.name.substring(0, 12)}... (${w})` : `${c.name} (${w})`; + } else { + c._display = c.name.length > 12 ? c.name.substring(0, 12) + "..." : c.name; + } + + if (c.system.onHand === true) + c._subItems = []; + } + + const containerView = actor.system.containerView; + let currentContainerView = containerView !== "" ? containerIndex.get(containerView) : null; + + context.containerView = currentContainerView || null; + context.containerWeight = currentContainerView + ? MGT2Helper.convertWeightForDisplay(currentContainerView.system.weight) + : MGT2Helper.convertWeightForDisplay(0); + context.containerShowAll = containerView === ""; + + for (let i of items) { + const item = i.system; + + if (item.hasOwnProperty("weight") && item.weight > 0) { + i._weight = isNaN(item.quantity) + ? MGT2Helper.convertWeightForDisplay(item.weight) + " " + settings.weightUnit + : MGT2Helper.convertWeightForDisplay(item.weight * item.quantity) + " " + settings.weightUnit; + } + + if (item.hasOwnProperty("container") && item.container.id !== "" && item.container.id !== undefined) { + const container = containerIndex.get(item.container.id); + if (container === undefined) { + if (context.containerShowAll) { + i._containerName = "#deleted#"; + containerItems.push(i); + } + continue; + } + + if (container.system.locked && !game.user.isGM) continue; + + if (container.system.onHand === true) + container._subItems.push(i); + + if (context.containerShowAll || actor.system.containerView === item.container.id) { + i._containerName = container.name; + containerItems.push(i); + } + continue; + } + + if (item.hasOwnProperty("equipped")) { + i._canEquip = true; + i._toggleClass = item.equipped ? "active" : ""; + } else { + i._canEquip = false; + } + + switch (i.type) { + case "equipment": + (i.system.subType === "augment" ? augments : equipments).push(i); + break; + + case "armor": + if (i.system.options?.length > 0) + i._subInfo = i.system.options.map(x => x.name).join(", "); + armors.push(i); + break; + + case "computer": + if (i.system.options?.length > 0) + i._subInfo = i.system.options.map(x => x.name).join(", "); + break; + + case "item": + if (i.system.subType === "software") { + if (i.system.software.computerId && i.system.software.computerId !== "") { + const computer = computers.find(x => x._id === i.system.software.computerId); + if (computer !== undefined) computer._subItems.push(i); + else softwares.push(i); + } else { + i._display = i.system.software.bandwidth > 0 + ? `${i.name} (${i.system.software.bandwidth})` + : i.name; + softwares.push(i); + } + } else { + miscItems.push(i); + } + break; + + case "weapon": + i._range = i.system.range.isMelee + ? game.i18n.localize("MGT2.Melee") + : MGT2Helper.getRangeDisplay(i.system.range); + if (i.system.traits?.length > 0) + i._subInfo = i.system.traits.map(x => x.name).join(", "); + weapons.push(i); + break; + + case "career": + careers.push(i); + break; + + case "contact": + contacts.push(i); + break; + + case "disease": + (i.system.subType === "wound" ? wounds : diseases).push(i); + break; + + case "talent": + if (i.system.subType === "skill") { + skills.push(i); + } else { + if (MGT2Helper.hasValue(i.system.psionic, "reach")) + i._reach = game.i18n.localize(`MGT2.PsionicReach.${i.system.psionic.reach}`); + if (MGT2Helper.hasValue(i.system.roll, "difficulty")) + i._difficulty = game.i18n.localize(`MGT2.Difficulty.${i.system.roll.difficulty}`); + psionics.push(i); + } + break; + + case "container": + if (i.system.onHand === true) + miscItems.push(i); + break; + } + } + + const byName = MGT2Helper.compareByName; + const byEquipName = (a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()); + + context.encumbranceNormal = MGT2Helper.convertWeightForDisplay(actor.system.inventory.encumbrance.normal); + context.encumbranceHeavy = MGT2Helper.convertWeightForDisplay(actor.system.inventory.encumbrance.heavy); + + const totalWeight = actor.system.inventory.weight; + if (totalWeight > actor.system.inventory.encumbrance.heavy) { + context.encumbranceClasses = "encumbrance-heavy"; + context.encumbrance = 2; + } else if (totalWeight > actor.system.inventory.encumbrance.normal) { + context.encumbranceClasses = "encumbrance-normal"; + context.encumbrance = 1; + } else { + context.encumbrance = 0; + } + + if (softwares.length > 0) { softwares.sort(byName); context.softwares = softwares; } + augments.sort(byEquipName); context.augments = augments; + armors.sort(byEquipName); context.armors = armors; + computers.sort(byEquipName); context.computers = computers; + context.careers = careers; + contacts.sort(byName); context.contacts = contacts; + containers.sort(byName); context.containers = containers; + diseases.sort(byName); context.diseases = diseases; + context.wounds = wounds; + equipments.sort(byEquipName); context.equipments = equipments; + miscItems.sort(byEquipName); context.items = miscItems; + actorContainers.sort(byName); context.actorContainers = actorContainers; + skills.sort(byName); context.skills = skills; + psionics.sort(byName); context.psionics = psionics; + weapons.sort(byEquipName); context.weapons = weapons; + + if (containerItems.length > 0) { + containerItems.sort((a, b) => { + const r = a._containerName.localeCompare(b._containerName); + return r !== 0 ? r : a.name.toLowerCase().localeCompare(b.name.toLowerCase()); + }); + } + context.containerItems = containerItems; + } + + // ========================================================= + // Event Binding (AppV2 _onRender — replaces jQuery activateListeners) + // Templates still use CSS class selectors, so we bind manually here. + // ========================================================= + + /** @override */ + _onRender(context, options) { + super._onRender(context, options); + const html = this.element; + if (!this.isEditable) return; + + this._bindClassEvent(html, ".roll", "click", TravellerCharacterSheet.#onRoll); + this._bindClassEvent(html, ".cfg-characteristic", "click", TravellerCharacterSheet.#onOpenCharacteristic); + this._bindClassEvent(html, ".item-create", "click", TravellerCharacterSheet.#onCreateItem); + this._bindClassEvent(html, ".item-edit", "click", TravellerCharacterSheet.#onEditItem); + this._bindClassEvent(html, ".item-delete", "click", TravellerCharacterSheet.#onDeleteItem); + this._bindClassEvent(html, ".item-equip", "click", TravellerCharacterSheet.#onEquipItem); + this._bindClassEvent(html, ".item-storage-in", "click", TravellerCharacterSheet.#onItemStorageIn); + this._bindClassEvent(html, ".item-storage-out", "click", TravellerCharacterSheet.#onItemStorageOut); + this._bindClassEvent(html, ".software-eject", "click", TravellerCharacterSheet.#onSoftwareEject); + this._bindClassEvent(html, ".container-create", "click", TravellerCharacterSheet.#onContainerCreate); + this._bindClassEvent(html, ".container-edit", "click", TravellerCharacterSheet.#onContainerEdit); + this._bindClassEvent(html, ".container-delete", "click", TravellerCharacterSheet.#onContainerDelete); + this._bindClassEvent(html, ".traits-create", "click", TravellerCharacterSheet.#onTraitCreate); + this._bindClassEvent(html, ".traits-edit", "click", TravellerCharacterSheet.#onTraitEdit); + this._bindClassEvent(html, ".traits-delete", "click", TravellerCharacterSheet.#onTraitDelete); + this._bindClassEvent(html, "[data-editor='open']", "click", TravellerCharacterSheet.#onOpenEditor); + html.querySelector("[name='config']")?.addEventListener("click", (ev) => TravellerCharacterSheet.#onOpenConfig.call(this, ev, ev.currentTarget)); + } + + /** Helper: bind a handler to all matching elements, with `this` set to the sheet instance */ + _bindClassEvent(html, selector, event, handler) { + for (const el of html.querySelectorAll(selector)) { + el.addEventListener(event, (ev) => handler.call(this, ev, ev.currentTarget)); + } + } + + // ========================================================= + // Drag & Drop + // ========================================================= + + /** @override */ + async _onDrop(event) { + event.preventDefault(); + event.stopImmediatePropagation(); + const dropData = MGT2Helper.getDataFromDropEvent(event); + if (!dropData) return false; + + const sourceItemData = await MGT2Helper.getItemDataFromDropData(dropData); + + if (sourceItemData.type === "species") { + const update = { + system: { + personal: { + species: sourceItemData.name, + speciesText: { + description: sourceItemData.system.description, + descriptionLong: sourceItemData.system.descriptionLong, + }, + }, + }, + }; + update.system.personal.traits = this.actor.system.personal.traits.concat(sourceItemData.system.traits); + + if (sourceItemData.system.modifiers?.length > 0) { + update.system.characteristics = {}; + for (let modifier of sourceItemData.system.modifiers) { + if (MGT2Helper.hasValue(modifier, "characteristic") && MGT2Helper.hasValue(modifier, "value")) { + const c = this.actor.system.characteristics[modifier.characteristic]; + const updateValue = { value: c.value + modifier.value }; + if (c.showMax) updateValue.max = c.max + modifier.value; + update.system.characteristics[modifier.characteristic] = updateValue; + } + } + } + + this.actor.update(update); + return true; + } + + if (["contact", "disease", "career", "talent"].includes(sourceItemData.type)) { + let transferData = {}; + try { transferData = sourceItemData.toJSON(); } catch (e) { transferData = sourceItemData; } + delete transferData._id; + delete transferData.id; + await this.actor.createEmbeddedDocuments("Item", [transferData]); + return true; + } + + if (!["armor", "weapon", "computer", "container", "item", "equipment"].includes(sourceItemData.type)) return false; + + const target = event.target.closest(".table-row"); + let targetId = null; + let targetItem = null; + if (target !== null) { + targetId = target.dataset.itemId; + targetItem = this.actor.getEmbeddedDocument("Item", targetId); + } + + let sourceItem = this.actor.getEmbeddedDocument("Item", sourceItemData.id); + if (sourceItem) { + if (!targetItem) return false; + sourceItem = foundry.utils.deepClone(sourceItem); + if (sourceItem._id === targetId) return false; + + if (targetItem.type === "item" || targetItem.type === "equipment") { + if (targetItem.system.subType === "software") + sourceItem.system.software.computerId = targetItem.system.software.computerId; + else + sourceItem.system.container.id = targetItem.system.container.id; + this.actor.updateEmbeddedDocuments("Item", [sourceItem]); + return true; + } else if (targetItem.type === "computer") { + sourceItem.system.software.computerId = targetId; + this.actor.updateEmbeddedDocuments("Item", [sourceItem]); + return true; + } else if (targetItem.type === "container") { + if (targetItem.system.locked && !game.user.isGM) { + ui.notifications.error("Verrouillé"); + } else { + sourceItem.system.container.id = targetId; + this.actor.updateEmbeddedDocuments("Item", [sourceItem]); + return true; + } + } + } else { + let transferData = {}; + try { transferData = sourceItemData.toJSON(); } catch (e) { transferData = sourceItemData; } + delete transferData._id; + delete transferData.id; + + const recalcWeight = transferData.system.hasOwnProperty("weight"); + + if (transferData.system.hasOwnProperty("container")) transferData.system.container.id = ""; + if (transferData.type === "item" && transferData.system.subType === "software") transferData.system.software.computerId = ""; + if (transferData.type === "container") transferData.system.onHand = true; + if (transferData.system.hasOwnProperty("equipment")) transferData.system.equipped = false; + + if (targetItem !== null) { + if (transferData.type === "item" && transferData.system.subType === "software") { + if (targetItem.type === "item" && targetItem.system.subType === "software") + transferData.system.software.computerId = targetItem.system.software.computerId; + else if (targetItem.type === "computer") + transferData.system.software.computerId = targetItem._id; + } else if (["armor", "computer", "equipment", "item", "weapon"].includes(transferData.type)) { + if (targetItem.type === "container") { + if (!targetItem.system.locked || game.user.isGM) + transferData.system.container.id = targetId; + } else { + transferData.system.container.id = targetItem.system.container.id; + } + } + } + + await this.actor.createEmbeddedDocuments("Item", [transferData]); + if (recalcWeight) await this.actor.recalculateWeight(); + } + return true; + } + + // ========================================================= + // Actions (static private methods) + // ========================================================= + + static async #onCreateItem(event, target) { + event.preventDefault(); + const data = { + name: target.dataset.createName, + type: target.dataset.typeItem, + }; + if (target.dataset.subtype) { + data.system = { subType: target.dataset.subtype }; + } + const cls = getDocumentClass("Item"); + return cls.create(data, { parent: this.actor }); + } + + static async #onEditItem(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = this.actor.getEmbeddedDocument("Item", li?.dataset.itemId); + if (item) item.sheet.render(true); + } + + static async #onDeleteItem(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + if (!li?.dataset.itemId) return; + this.actor.deleteEmbeddedDocuments("Item", [li.dataset.itemId]); + } + + static async #onEquipItem(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument("Item", li?.dataset.itemId)); + if (!item) return; + item.system.equipped = !item.system.equipped; + this.actor.updateEmbeddedDocuments("Item", [item]); + } + + static async #onItemStorageIn(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument("Item", li?.dataset.itemId)); + if (!item) return; + + if (item.type === "container") { + item.system.onHand = false; + } else { + const containers = this.actor.getContainers(); + let container; + const dropInId = this.actor.system.containerDropIn; + + if (!dropInId) { + container = containers.length === 0 + ? await getDocumentClass("Item").create({ name: "New container", type: "container" }, { parent: this.actor }) + : containers[0]; + } else { + container = containers.find(x => x._id === dropInId); + } + + if (container?.system.locked && !game.user.isGM) { + ui.notifications.error("Objet verrouillé"); + return; + } + item.system.container.id = container._id; + } + this.actor.updateEmbeddedDocuments("Item", [item]); + } + + static async #onItemStorageOut(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument("Item", li?.dataset.itemId)); + if (!item) return; + item.system.container.id = ""; + this.actor.updateEmbeddedDocuments("Item", [item]); + } + + static async #onSoftwareEject(event, target) { + event.preventDefault(); + const li = target.closest("[data-item-id]"); + const item = foundry.utils.deepClone(this.actor.getEmbeddedDocument("Item", li?.dataset.itemId)); + if (!item) return; + item.system.software.computerId = ""; + this.actor.updateEmbeddedDocuments("Item", [item]); + } + + static async #onContainerCreate(event) { + event.preventDefault(); + const cls = getDocumentClass("Item"); + return cls.create({ name: "New container", type: "container" }, { parent: this.actor }); + } + + static async #onContainerEdit(event) { + event.preventDefault(); + const container = this.actor.getEmbeddedDocument("Item", this.actor.system.containerView); + if (container) container.sheet.render(true); + } + + static async #onContainerDelete(event) { + event.preventDefault(); + const containers = this.actor.getContainers(); + const container = containers.find(x => x._id === this.actor.system.containerView); + if (!container) return; + + const containerItems = this.actor.items.filter( + x => x.system.hasOwnProperty("container") && x.system.container.id === container._id + ); + + if (containerItems.length > 0) { + for (let item of containerItems) { + let clone = foundry.utils.deepClone(item); + clone.system.container.id = ""; + this.actor.updateEmbeddedDocuments("Item", [clone]); + } + } + + const cloneActor = foundry.utils.deepClone(this.actor); + cloneActor.system.containerView = ""; + if (cloneActor.system.containerDropIn === container._id) { + cloneActor.system.containerDropIn = ""; + const remaining = containers.filter(x => x._id !== container._id); + if (remaining.length > 0) cloneActor.system.containerDropIn = remaining[0]._id; + } + + this.actor.deleteEmbeddedDocuments("Item", [container._id]); + this.actor.update(cloneActor); + } + + static async #onRoll(event, target) { + event.preventDefault(); + + const rollOptions = { + rollTypeName: game.i18n.localize("MGT2.RollPrompt.Roll"), + rollObjectName: "", + characteristics: [{ _id: "", name: "" }], + characteristic: "", + skills: [], + skill: "", + fatigue: this.actor.system.states.fatigue, + encumbrance: this.actor.system.states.encumbrance, + difficulty: null, + damageFormula: null, + }; + + const cardButtons = []; + for (const [key, label] of Object.entries(MGT2.Characteristics)) { + const c = this.actor.system.characteristics[key]; + if (c.show) { + rollOptions.characteristics.push({ + _id: key, + name: game.i18n.localize(label) + MGT2Helper.getDisplayDM(c.dm), + }); + } + } + + for (let item of this.actor.items) { + if (item.type === "talent" && item.system.subType === "skill") + rollOptions.skills.push({ _id: item._id, name: item.getRollDisplay() }); + } + + rollOptions.skills.sort(MGT2Helper.compareByName); + rollOptions.skills = [{ _id: "NP", name: game.i18n.localize("MGT2.Items.NotProficient") }].concat(rollOptions.skills); + + let itemObj = null; + let isInitiative = false; + const rollType = target.dataset.roll; + + if (rollType === "initiative") { + rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.InitiativeRoll"); + rollOptions.characteristic = this.actor.system.config.initiative; + isInitiative = true; + } else if (rollType === "characteristic") { + rollOptions.characteristic = target.dataset.rollCharacteristic; + rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.CharacteristicRoll"); + rollOptions.rollObjectName = game.i18n.localize(`MGT2.Characteristics.${rollOptions.characteristic}.name`); + } else { + if (rollType === "skill") { + rollOptions.skill = target.dataset.rollSkill; + itemObj = this.actor.getEmbeddedDocument("Item", rollOptions.skill); + rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.SkillRoll"); + rollOptions.rollObjectName = itemObj.name; + } else if (rollType === "psionic") { + rollOptions.rollTypeName = game.i18n.localize("MGT2.RollPrompt.PsionicRoll"); + } + + if (itemObj === null && target.dataset.itemId) { + itemObj = this.actor.getEmbeddedDocument("Item", target.dataset.itemId); + rollOptions.rollObjectName = itemObj.name; + if (itemObj.type === "weapon") rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.weapon"); + else if (itemObj.type === "armor") rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.armor"); + else if (itemObj.type === "computer") rollOptions.rollTypeName = game.i18n.localize("TYPES.Item.computer"); + } + + if (rollType === "psionic" && itemObj) { + rollOptions.rollObjectName = itemObj.name; + if (MGT2Helper.hasValue(itemObj.system.psionic, "duration")) { + cardButtons.push({ + label: game.i18n.localize("MGT2.Items.Duration"), + formula: itemObj.system.psionic.duration, + message: { + objectName: itemObj.name, + flavor: "{0} ".concat(game.i18n.localize(`MGT2.Durations.${itemObj.system.psionic.durationUnit}`)), + }, + }); + } + } + + if (itemObj?.system.hasOwnProperty("damage")) { + rollOptions.damageFormula = itemObj.system.damage; + if (itemObj.type === "disease") { + if (itemObj.system.subType === "disease") + rollOptions.rollTypeName = game.i18n.localize("MGT2.DiseaseSubType.disease"); + else if (itemObj.system.subType === "poison") + rollOptions.rollTypeName = game.i18n.localize("MGT2.DiseaseSubType.poison"); + } + } + + if (itemObj?.system.hasOwnProperty("roll")) { + if (MGT2Helper.hasValue(itemObj.system.roll, "characteristic")) rollOptions.characteristic = itemObj.system.roll.characteristic; + if (MGT2Helper.hasValue(itemObj.system.roll, "skill")) rollOptions.skill = itemObj.system.roll.skill; + if (MGT2Helper.hasValue(itemObj.system.roll, "difficulty")) rollOptions.difficulty = itemObj.system.roll.difficulty; + } + } + + const userRollData = await RollPromptHelper.roll(rollOptions); + + const rollModifiers = []; + const rollFormulaParts = []; + + if (userRollData.diceModifier) { + rollFormulaParts.push("3d6", userRollData.diceModifier); + } else { + rollFormulaParts.push("2d6"); + } + + if (userRollData.characteristic) { + const c = this.actor.system.characteristics[userRollData.characteristic]; + rollFormulaParts.push(MGT2Helper.getFormulaDM(c.dm)); + rollModifiers.push(game.i18n.localize(`MGT2.Characteristics.${userRollData.characteristic}.name`) + MGT2Helper.getDisplayDM(c.dm)); + } + + if (userRollData.skill) { + if (userRollData.skill === "NP") { + rollFormulaParts.push("-3"); + rollModifiers.push(game.i18n.localize("MGT2.Items.NotProficient")); + } else { + const skillObj = this.actor.getEmbeddedDocument("Item", userRollData.skill); + rollFormulaParts.push(MGT2Helper.getFormulaDM(skillObj.system.level)); + rollModifiers.push(skillObj.getRollDisplay()); + } + } + + if (userRollData.psionic) { + const psionicObj = this.actor.getEmbeddedDocument("Item", userRollData.psionic); + rollFormulaParts.push(MGT2Helper.getFormulaDM(psionicObj.system.level)); + rollModifiers.push(psionicObj.getRollDisplay()); + } + + if (userRollData.timeframes && userRollData.timeframes !== "" && userRollData.timeframes !== "Normal") { + rollModifiers.push(game.i18n.localize(`MGT2.Timeframes.${userRollData.timeframes}`)); + rollFormulaParts.push(userRollData.timeframes === "Slower" ? "+2" : "-2"); + } + + if (userRollData.encumbrance === true) { + rollFormulaParts.push("-2"); + rollModifiers.push(game.i18n.localize("MGT2.Actor.Encumbrance") + " -2"); + } + + if (userRollData.fatigue === true) { + rollFormulaParts.push("-2"); + rollModifiers.push(game.i18n.localize("MGT2.Actor.Fatigue") + " -2"); + } + + if (userRollData.customDM) { + const s = userRollData.customDM.trim(); + if (/^[0-9]/.test(s)) rollFormulaParts.push("+"); + rollFormulaParts.push(s); + } + + if (MGT2Helper.hasValue(userRollData, "difficulty")) rollOptions.difficulty = userRollData.difficulty; + + const rollFormula = rollFormulaParts.join(""); + if (!Roll.validate(rollFormula)) { + ui.notifications.error(game.i18n.localize("MGT2.Errors.InvalidRollFormula")); + return; + } + + let roll = await new Roll(rollFormula, this.actor.getRollData()).roll({ async: true, rollMode: userRollData.rollMode }); + + if (isInitiative && this.token?.combatant) { + await this.token.combatant.update({ initiative: roll.total }); + } + + const chatData = { + user: game.user.id, + speaker: this.actor ? ChatMessage.getSpeaker({ actor: this.actor }) : null, + formula: roll._formula, + tooltip: await roll.getTooltip(), + total: Math.round(roll.total * 100) / 100, + type: CONST.CHAT_MESSAGE_TYPES.ROLL, + showButtons: true, + showLifeButtons: false, + showRollRequest: false, + rollTypeName: rollOptions.rollTypeName, + rollObjectName: rollOptions.rollObjectName, + rollModifiers: rollModifiers, + showRollDamage: rollOptions.damageFormula !== null && rollOptions.damageFormula !== "", + cardButtons: cardButtons, + }; + + if (MGT2Helper.hasValue(rollOptions, "difficulty")) { + chatData.rollDifficulty = rollOptions.difficulty; + chatData.rollDifficultyLabel = MGT2Helper.getDifficultyDisplay(rollOptions.difficulty); + if (roll.total >= MGT2Helper.getDifficultyValue(rollOptions.difficulty)) + chatData.rollSuccess = true; + else + chatData.rollFailure = true; + } + + const html = await renderTemplate("systems/mgt2/templates/chat/roll.html", chatData); + chatData.content = html; + + let flags = null; + if (rollOptions.damageFormula) { + flags = { mgt2: { damage: { formula: rollOptions.damageFormula, rollObjectName: rollOptions.rollObjectName, rollTypeName: rollOptions.rollTypeName } } }; + } + if (cardButtons.length > 0) { + if (!flags) flags = { mgt2: {} }; + flags.mgt2.buttons = cardButtons; + } + if (flags) chatData.flags = flags; + + return roll.toMessage(chatData); + } + + static async #onOpenConfig(event) { + event.preventDefault(); + const userConfig = await CharacterPrompts.openConfig(this.actor.system); + if (userConfig) this.actor.update({ "system.config": userConfig }); + } + + static async #onOpenCharacteristic(event, target) { + event.preventDefault(); + const name = target.dataset.cfgCharacteristic; + const c = this.actor.system.characteristics[name]; + + let showAll = false; + for (const value of Object.values(this.actor.system.characteristics)) { + if (!value.show) { showAll = true; break; } + } + + const userConfig = await CharacterPrompts.openCharacteristic( + game.i18n.localize(`MGT2.Characteristics.${name}.name`), + c.show, c.showMax, showAll + ); + + if (userConfig) { + const data = { system: { characteristics: {} } }; + data.system.characteristics[name] = { show: userConfig.show, showMax: userConfig.showMax }; + + if (userConfig.showAll === true) { + for (const [key, value] of Object.entries(this.actor.system.characteristics)) { + if (key !== name && !value.show) + data.system.characteristics[key] = { show: true }; + } + } + this.actor.update(data); + } + } + + static async #onTraitCreate(event) { + event.preventDefault(); + let traits = this.actor.system.personal.traits; + let newTraits; + if (traits.length === 0) { + newTraits = [{ name: "", description: "" }]; + } else { + newTraits = [...traits, { name: "", description: "" }]; + } + return this.actor.update({ system: { personal: { traits: newTraits } } }); + } + + static async #onTraitEdit(event, target) { + event.preventDefault(); + const element = target.closest("[data-traits-part]"); + const index = Number(element.dataset.traitsPart); + const trait = this.actor.system.personal.traits[index]; + const result = await CharacterPrompts.openTraitEdit(trait); + const traits = [...this.actor.system.personal.traits]; + traits[index] = { ...traits[index], name: result.name, description: result.description }; + return this.actor.update({ system: { personal: { traits: traits } } }); + } + + static async #onTraitDelete(event, target) { + event.preventDefault(); + const element = target.closest("[data-traits-part]"); + const index = Number(element.dataset.traitsPart); + const traits = foundry.utils.deepClone(this.actor.system.personal.traits); + const newTraits = Object.entries(traits) + .filter(([key]) => Number(key) !== index) + .map(([, value]) => value); + return this.actor.update({ system: { personal: { traits: newTraits } } }); + } + + static async #onOpenEditor(event) { + event.preventDefault(); + await CharacterPrompts.openEditorFullView( + this.actor.system.personal.species, + this.actor.system.personal.speciesText.descriptionLong + ); + } +} diff --git a/src/module/applications/sheets/item-sheet.mjs b/src/module/applications/sheets/item-sheet.mjs new file mode 100644 index 0000000..038dd72 --- /dev/null +++ b/src/module/applications/sheets/item-sheet.mjs @@ -0,0 +1,253 @@ +const { HandlebarsApplicationMixin } = foundry.applications.api; +import { MGT2Helper } from "../../helper.js"; + +export default class TravellerItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) { + + /** @override */ + static DEFAULT_OPTIONS = { + classes: ["mgt2", "sheet", "item"], + position: { width: 630 }, + form: { + submitOnChange: true, + closeOnSubmit: false, + }, + window: { resizable: true }, + actions: { + careerEventCreate: TravellerItemSheet.#onCareerEventCreate, + careerEventDelete: TravellerItemSheet.#onCareerEventDelete, + optionCreate: TravellerItemSheet.#onOptionCreate, + optionDelete: TravellerItemSheet.#onOptionDelete, + modifierCreate: TravellerItemSheet.#onModifierCreate, + modifierDelete: TravellerItemSheet.#onModifierDelete, + }, + } + + /** @override */ + static PARTS = { + sheet: { + // template is dynamic — resolved in _prepareContext / _renderHTML + template: "", + }, + } + + /** Resolve template dynamically based on item type */ + get template() { + return `systems/mgt2/templates/items/${this.document.type}-sheet.html`; + } + + tabGroups = { primary: "tab1" } + + /** @override */ + async _prepareContext() { + const item = this.document; + const source = item.toObject(); + + const settings = { + usePronouns: game.settings.get("mgt2", "usePronouns"), + }; + + let containers = null; + let computers = null; + let hadContainer = false; + + if (item.actor !== null) { + hadContainer = true; + containers = [{ name: "", _id: "" }].concat(item.actor.getContainers()); + computers = [{ name: "", _id: "" }].concat(item.actor.getComputers()); + } + + let weight = null; + if (item.system.hasOwnProperty("weight")) { + weight = MGT2Helper.convertWeightForDisplay(item.system.weight); + } + + let skills = []; + if (this.actor !== null) { + for (let actorItem of this.actor.items) { + if (actorItem.type === "talent" && actorItem.system.subType === "skill") + skills.push({ _id: actorItem._id, name: actorItem.getRollDisplay() }); + } + } + skills.sort(MGT2Helper.compareByName); + skills = [{ _id: "NP", name: game.i18n.localize("MGT2.Items.NotProficient") }].concat(skills); + + return { + item: item, + document: item, + cssClass: this.isEditable ? "editable" : "locked", + system: item.system, + source: source.system, + fields: item.schema.fields, + systemFields: item.system.schema.fields, + isEditable: this.isEditable, + isGM: game.user.isGM, + config: CONFIG, + settings: settings, + containers: containers, + computers: computers, + hadContainer: hadContainer, + weight: weight, + unitlabels: { weight: MGT2Helper.getWeightLabel() }, + skills: skills, + }; + } + + /** @override — resolve the per-type template before rendering */ + async _renderHTML(context, options) { + const templatePath = `systems/mgt2/templates/items/${this.document.type}-sheet.html`; + const html = await renderTemplate(templatePath, context); + return { sheet: html }; + } + + /** @override — put rendered HTML into the window content */ + _replaceHTML(result, content, options) { + content.innerHTML = result.sheet; + this._activateTabGroups(); + this._bindItemEvents(); + } + + /** Bind CSS class-based events (templates not yet migrated to data-action) */ + _bindItemEvents() { + const html = this.element; + if (!this.isEditable) return; + const bind = (sel, handler) => { + for (const el of html.querySelectorAll(sel)) { + el.addEventListener("click", (ev) => handler.call(this, ev, ev.currentTarget)); + } + }; + bind(".event-create", TravellerItemSheet.#onCareerEventCreate); + bind(".event-delete", TravellerItemSheet.#onCareerEventDelete); + bind(".options-create", TravellerItemSheet.#onOptionCreate); + bind(".options-delete", TravellerItemSheet.#onOptionDelete); + bind(".modifiers-create", TravellerItemSheet.#onModifierCreate); + bind(".modifiers-delete", TravellerItemSheet.#onModifierDelete); + } + + _activateTabGroups() { + for (const [group, activeTab] of Object.entries(this.tabGroups)) { + const nav = this.element.querySelector(`nav[data-group="${group}"], .horizontal-tabs`); + if (!nav) continue; + + nav.querySelectorAll('[data-tab]').forEach(link => { + link.classList.toggle('active', link.dataset.tab === activeTab); + link.addEventListener('click', event => { + event.preventDefault(); + this.tabGroups[group] = link.dataset.tab; + this.render(); + }); + }); + + this.element.querySelectorAll(`.itemsheet-panel [data-tab], [data-group="${group}"][data-tab]`).forEach(content => { + content.classList.toggle('active', content.dataset.tab === activeTab); + }); + } + } + + /** @override — process form data before submit (weight/qty/cost conversions + container logic) */ + _prepareSubmitData(event, form, formData) { + const data = foundry.utils.expandObject(formData.object); + + if (data.hasOwnProperty("weight")) { + data.system = data.system || {}; + data.system.weight = MGT2Helper.convertWeightFromInput(data.weight); + delete data.weight; + } + + if (data.system?.hasOwnProperty("quantity")) { + data.system.quantity = MGT2Helper.getIntegerFromInput(data.system.quantity); + } + + if (data.system?.hasOwnProperty("cost")) { + data.system.cost = MGT2Helper.getIntegerFromInput(data.system.cost); + } + + // Container/equipped logic + if (data.system?.hasOwnProperty("container") && this.document.system.hasOwnProperty("equipped")) { + const equippedChange = this.document.system.equipped !== data.system.equipped; + const containerChange = this.document.system.container?.id !== data.system.container?.id; + + if (equippedChange && data.system.equipped === true) { + data.system.container = { id: "" }; + } else if (containerChange && data.system.container?.id !== "" && this.document.system.container?.id === "") { + data.system.equipped = false; + } + } + + return foundry.utils.flattenObject(data); + } + + // ========================================================= + // Actions + // ========================================================= + + static async #onCareerEventCreate(event) { + event.preventDefault(); + const events = this.document.system.events; + let newEvents; + if (!events || events.length === 0) { + newEvents = [{ age: "", description: "" }]; + } else { + newEvents = [...events, { age: "", description: "" }]; + } + return this.document.update({ system: { events: newEvents } }); + } + + static async #onCareerEventDelete(event, target) { + event.preventDefault(); + const element = target.closest("[data-events-part]"); + const index = Number(element.dataset.eventsPart); + const events = foundry.utils.deepClone(this.document.system.events); + const newEvents = Object.entries(events) + .filter(([key]) => Number(key) !== index) + .map(([, val]) => val); + return this.document.update({ system: { events: newEvents } }); + } + + static async #onOptionCreate(event, target) { + event.preventDefault(); + const property = target.dataset.property; + const options = this.document.system[property]; + let newOptions; + if (!options || options.length === 0) { + newOptions = [{ name: "", description: "" }]; + } else { + newOptions = [...options, { name: "", description: "" }]; + } + return this.document.update({ [`system.${property}`]: newOptions }); + } + + static async #onOptionDelete(event, target) { + event.preventDefault(); + const element = target.closest("[data-options-part]"); + const property = element.dataset.property; + const index = Number(element.dataset.optionsPart); + const options = foundry.utils.deepClone(this.document.system[property]); + const newOptions = Object.entries(options) + .filter(([key]) => Number(key) !== index) + .map(([, val]) => val); + return this.document.update({ [`system.${property}`]: newOptions }); + } + + static async #onModifierCreate(event) { + event.preventDefault(); + const modifiers = this.document.system.modifiers; + let newModifiers; + if (!modifiers || modifiers.length === 0) { + newModifiers = [{ characteristic: "Endurance", value: null }]; + } else { + newModifiers = [...modifiers, { characteristic: "Endurance", value: null }]; + } + return this.document.update({ system: { modifiers: newModifiers } }); + } + + static async #onModifierDelete(event, target) { + event.preventDefault(); + const element = target.closest("[data-modifiers-part]"); + const index = Number(element.dataset.modifiersPart); + const modifiers = foundry.utils.deepClone(this.document.system.modifiers); + const newModifiers = Object.entries(modifiers) + .filter(([key]) => Number(key) !== index) + .map(([, val]) => val); + return this.document.update({ system: { modifiers: newModifiers } }); + } +} diff --git a/src/module/applications/sheets/vehicule-sheet.mjs b/src/module/applications/sheets/vehicule-sheet.mjs new file mode 100644 index 0000000..e57a6e6 --- /dev/null +++ b/src/module/applications/sheets/vehicule-sheet.mjs @@ -0,0 +1,24 @@ +import MGT2ActorSheet from "./base-actor-sheet.mjs"; + +export default class TravellerVehiculeSheet extends MGT2ActorSheet { + + /** @override */ + static DEFAULT_OPTIONS = { + ...super.DEFAULT_OPTIONS, + classes: [...super.DEFAULT_OPTIONS.classes, "vehicule", "nopad"], + window: { + ...super.DEFAULT_OPTIONS.window, + title: "TYPES.Actor.vehicule", + }, + } + + /** @override */ + static PARTS = { + sheet: { + template: "systems/mgt2/templates/actors/vehicule-sheet.html", + }, + } + + /** @override */ + tabGroups = { primary: "stats" } +} diff --git a/src/module/core.js b/src/module/core.js index a3bda7b..5b882d5 100644 --- a/src/module/core.js +++ b/src/module/core.js @@ -1,5 +1,6 @@ import { CharacterData, + VehiculeData, ItemData, EquipmentData, DiseaseData, @@ -11,13 +12,12 @@ import { WeaponData, ItemContainerData, SpeciesData -} from "./datamodels.js"; +} from "./models/index.mjs"; import { MGT2 } from "./config.js"; import { TravellerActor, MGT2Combatant } from "./actors/actor.js"; import { TravellerItem } from "./item.js"; -import { TravellerItemSheet } from "./item-sheet.js"; -import { TravellerActorSheet } from "./actors/character-sheet.js"; +import { TravellerItemSheet, TravellerCharacterSheet, TravellerVehiculeSheet } from "./applications/sheets/_module.mjs"; import { preloadHandlebarsTemplates } from "./templates.js"; //import { MGT2Helper } from "./helper.js"; import {ChatHelper} from "./chatHelper.js"; @@ -88,14 +88,16 @@ Hooks.once("init", async function () { CONFIG.Actor.documentClass = TravellerActor; CONFIG.Item.documentClass = TravellerItem; - Actors.unregisterSheet("core", ActorSheet); - Actors.registerSheet("mgt2", TravellerActorSheet, { types: ["character"], makeDefault: true, label: "Traveller Sheet" }); + foundry.documents.collections.Actors.unregisterSheet("core", foundry.appv1.sheets.ActorSheet); + foundry.documents.collections.Actors.registerSheet("mgt2", TravellerCharacterSheet, { types: ["character"], makeDefault: true, label: "Traveller Sheet" }); + foundry.documents.collections.Actors.registerSheet("mgt2", TravellerVehiculeSheet, { types: ["vehicule"], makeDefault: true, label: "Vehicule Sheet" }); - Items.unregisterSheet("core", ItemSheet); - Items.registerSheet("mgt2", TravellerItemSheet, { makeDefault: true }); + foundry.documents.collections.Items.unregisterSheet("core", foundry.appv1.sheets.ItemSheet); + foundry.documents.collections.Items.registerSheet("mgt2", TravellerItemSheet, { makeDefault: true }); Object.assign(CONFIG.Actor.dataModels, { - "character": CharacterData + "character": CharacterData, + "vehicule": VehiculeData }); Object.assign(CONFIG.Item.dataModels, { diff --git a/src/module/datamodels.js b/src/module/datamodels.js deleted file mode 100644 index 8098027..0000000 --- a/src/module/datamodels.js +++ /dev/null @@ -1,485 +0,0 @@ -// https://foundryvtt.com/article/system-data-models/ -// https://foundryvtt.com/api/classes/foundry.data.fields.NumberField.html -// https://foundryvtt.com/api/v10/classes/foundry.data.fields.DataField.html -const fields = foundry.data.fields; - -export class CharacterData extends foundry.abstract.TypeDataModel { - - static defineSchema() { - // XP - return { - name: new fields.StringField({ required: false, blank: false, trim: true }), - life: new fields.SchemaField({ - value: new fields.NumberField({ required: false, initial: 0, integer: true }), - max: new fields.NumberField({ required: true, initial: 0, integer: true }) - }), - personal: new fields.SchemaField({ - title: new fields.StringField({ required: false, blank: true, trim: true }), - species: new fields.StringField({ required: false, blank: true, trim: true }), - speciesText: new fields.SchemaField({ - description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }), - descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true }) - }), - age: new fields.StringField({ required: false, blank: true, trim: true }), - gender: new fields.StringField({ required: false, blank: true, trim: true }), - pronouns: new fields.StringField({ required: false, blank: true, trim: true }), - homeworld: new fields.StringField({ required: false, blank: true, trim: true }), - ucp: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - traits: new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ) - }), - biography: new fields.HTMLField({ required: false, blank: true, trim: true }), - - characteristics: new fields.SchemaField({ - strength: createCharacteristicField(true, true), - dexterity: createCharacteristicField(true, true), - endurance: createCharacteristicField(true, true), - intellect: createCharacteristicField(true, false), - education: createCharacteristicField(true, false), - social: createCharacteristicField(true, false), - morale: createCharacteristicField(true, false), - luck: createCharacteristicField(true, false), - sanity: createCharacteristicField(true, false), - charm: createCharacteristicField(true, false), - psionic: createCharacteristicField(true, false), - other: createCharacteristicField(true, false) - }), - - health: new fields.SchemaField({ - radiations: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }) - }), - study: new fields.SchemaField({ - skill: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - total: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }), - completed: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }) - }), - finance: new fields.SchemaField({ - pension: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - credits: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - cashOnHand: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - debt: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - livingCost: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - monthlyShipPayments: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - notes: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }) - }), - containerView: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - containerDropIn: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - notes: new fields.HTMLField({ required: false, blank: true, trim: true }), - - inventory: new fields.SchemaField({ - armor: new fields.NumberField({ required: true, initial: 0, integer: true }), - weight: new fields.NumberField({ required: true, initial: 0, min: 0, integer: false }), - encumbrance: new fields.SchemaField({ - normal: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - heavy: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }) - }) - }), - states: new fields.SchemaField({ - encumbrance: new fields.BooleanField({ required: false, initial: false }), - fatigue: new fields.BooleanField({ required: false, initial: false }), - unconscious: new fields.BooleanField({ required: false, initial: false }), - surgeryRequired: new fields.BooleanField({ required: false, initial: false }) - }), - - config: new fields.SchemaField({ - psionic: new fields.BooleanField({ required: false, initial: true }), - initiative: new fields.StringField({ required: false, blank: true, initial: "dexterity" }), - damages: new fields.SchemaField({ - rank1: new fields.StringField({ required: false, blank: true, initial: "strength" }), - rank2: new fields.StringField({ required: false, blank: true, initial: "dexterity" }), - rank3: new fields.StringField({ required: false, blank: true, initial: "endurance" }) - }) - }) - }; - } -} - -// export class CreatureData extends foundry.abstract.TypeDataModel { -// static defineSchema() { -// return { -// name: new fields.StringField({ required: false, blank: false, trim: true }), -// TL: new fields.StringField({ required: true, blank: false, initial: "NA" }), -// species: new fields.StringField({ required: false, blank: true, trim: true }), -// //cost: new fields.NumberField({ required: true, integer: true }), -// armor: new fields.NumberField({ required: false, initial: 0, integer: true }), -// life: new fields.SchemaField({ -// value: new fields.NumberField({ required: false, initial: 0, integer: true }), -// max: new fields.NumberField({ required: true, initial: 0, integer: true }) -// }), - -// speed: new fields.StringField({ required: false, initial: "4m", blank: true, trim: true }), - -// traits: new fields.ArrayField( -// new fields.SchemaField({ -// name: new fields.StringField({ required: true, blank: true, trim: true }), -// description: new fields.StringField({ required: false, blank: true, trim: true }) -// }) -// ), - -// description: new fields.HTMLField({ required: false, blank: true, trim: true }), -// behaviour: new fields.StringField({ required: false, blank: true, trim: true }) -// } -// }; -// } - -// export class NPCData extends CreatureData { -// static defineSchema() { -// const schema = super.defineSchema(); -// // Species, Gender, Age -// // STR, DEX, END, INT,. EDU, SOC, PSI, SKILL/Psy, equipment -// // Status -// schema.secret = new fields.HTMLField({ required: false, blank: true, trim: true }); - -// return schema; -// } -// } - -export class VehiculeData extends foundry.abstract.TypeDataModel { - - static defineSchema() { - return { - name: new fields.StringField({ required: false, blank: false, trim: true }), - - skillId: new fields.StringField({ required: false, initial: "", blank: true, trim: true }), - speed: new fields.SchemaField({ - cruise: new fields.StringField({ required: false, initial: "Slow", blank: true }), - maximum: new fields.StringField({ required: false, initial: "Medium", blank: true }) - }), - agility: new fields.NumberField({ required: false, min: 0, integer: true }), - crew: new fields.NumberField({ required: false, min: 0, integer: true }), - passengers: new fields.NumberField({ required: false, min: 0, integer: true }), - cargo: new fields.NumberField({ required: false, min: 0, integer: false }), - //hull - life: new fields.SchemaField({ - value: new fields.NumberField({ required: true, initial: 0, integer: true }), - max: new fields.NumberField({ required: true, initial: 0, integer: true }) - }), - shipping: new fields.NumberField({ required: false, min: 0, integer: true }), - cost: new fields.NumberField({ required: false, min: 0, integer: true }), - armor: new fields.SchemaField({ - front: new fields.NumberField({ required: true, initial: 0, integer: true }), - rear: new fields.NumberField({ required: true, initial: 0, integer: true }), - sides: new fields.NumberField({ required: true, initial: 0, integer: true }) - }), - - skills: new fields.SchemaField({ - // Skill Level - autopilot: new fields.NumberField({ required: true, initial: 0, integer: true }) - // Communication Range - // Navigation - // Sensors - // Camouflage / Recon - // Stealth - }) - // config: new fields.SchemaField({ - // }) - }; - } -} - -class ItemBaseData extends foundry.abstract.TypeDataModel { - static defineSchema() { - const fields = foundry.data.fields; - const schema = { - //name: new fields.StringField({ required: true, blank: true, trim: true, nullable: true }), - description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }), - //type: new fields.StringField({ required: false, blank: false }), - subType: new fields.StringField({ required: false, blank: false, nullable: true }) - }; - - return schema; - } -} - -class PhysicalItemData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - schema.quantity = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true }); - schema.weight = new fields.NumberField({ required: true, initial: 0, min: 0, integer: false }); - schema.weightless = new fields.BooleanField({ required: false, initial: false }); - schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); - schema.tl = new fields.StringField({ required: true, blank: false, initial: "TL12" }); - schema.container = new fields.SchemaField({ - //inContainer: new fields.BooleanField({ required: false, initial: false }), - id: new fields.StringField({ required: false, blank: true }) - }); - - schema.roll = new fields.SchemaField({ - characteristic: new fields.StringField({ required: false, blank: true, trim: true }), - skill: new fields.StringField({ required: false, blank: true, trim: true }), - difficulty: new fields.StringField({ required: false, blank: true, trim: true }) - }); - - schema.trash = new fields.BooleanField({ required: false, initial: false }); - - return schema; - } -} - -export class ItemData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - schema.subType.initial = "loot"; - schema.software = new fields.SchemaField({ - bandwidth: new fields.NumberField({ required: false, initial: 0, min: 0, max: 10, integer: true }), - effect: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), - computerId: new fields.StringField({ required: false, blank: true, initial: "" }) - }); - return schema; - } -} - -export class EquipmentData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - // augment, clothes - schema.equipped = new fields.BooleanField({ required: false, initial: false }); - //schema.skillModifier = new fields.StringField({ required: false, blank: true }); - //schema.characteristicModifier = new fields.StringField({ required: false, blank: true }); - - schema.augment = new fields.SchemaField({ - improvement: new fields.StringField({ required: false, blank: true, trim: true }) - }); - - schema.subType.initial = "equipment"; // augment, clothing, trinket, toolkit, equipment - - return schema; - } -} - -export class DiseaseData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - schema.subType.initial = "disease"; // disease;poison - schema.difficulty = new fields.StringField({ required: true, initial: "Average" }); - schema.damage = new fields.StringField({ required: false, blank: true }); - schema.interval = new fields.StringField({ required: false, blank: true }); - return schema; - } -} - -export class CareerData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - - schema.difficulty = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); - schema.damage = new fields.StringField({ required: false, blank: true }); - schema.interval = new fields.StringField({ required: false, blank: true }); - - schema.assignment = new fields.StringField({ required: false, blank: true }); - schema.terms = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.rank = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.events = new fields.ArrayField( - new fields.SchemaField({ - age: new fields.NumberField({ required: false, integer: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - - return schema; - } -} - -export class TalentData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - - schema.subType.initial = "skill"; - schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }) - schema.level = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }) - schema.skill = new fields.SchemaField({ - speciality: new fields.StringField({ required: false, blank: true, trim: true }), - reduceEncumbrance: new fields.BooleanField({ required: false, initial: false }) - }); - - schema.psionic = new fields.SchemaField({ - reach: new fields.StringField({ required: false, blank: true, trim: true }), - cost: new fields.NumberField({ required: false, initial: 1, min: 0, integer: true }), - duration: new fields.StringField({ required: false, blank: true, trim: true }), - durationUnit: new fields.StringField({ required: false }) - }); - - schema.roll = new fields.SchemaField({ - characteristic: new fields.StringField({ required: false, blank: true, trim: true }), - skill: new fields.StringField({ required: false, blank: true, trim: true }), - difficulty: new fields.StringField({ required: false, blank: true, trim: true }) - }); - - return schema; - } -} - -export class ContactData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - - schema.subType.initial = "skill"; - schema.cost = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true }) - - schema.skill = new fields.SchemaField({ - speciality: new fields.StringField({ required: false, blank: true, trim: true }), - characteristic: new fields.StringField({ required: false, blank: true, trim: true }) - }); - - schema.status = new fields.StringField({ required: false, blank: true, trim: true, initial: "Alive" }); - schema.attitude = new fields.StringField({ required: false, blank: true, trim: true, initial: "Unknow" }); - schema.relation = new fields.StringField({ required: false, blank: true, trim: true, initial: "Contact" }); - schema.title = new fields.StringField({ required: false, blank: true, trim: true }); - schema.nickname = new fields.StringField({ required: false, blank: true, trim: true }); - schema.species = new fields.StringField({ required: false, blank: true, trim: true }); - schema.gender = new fields.StringField({ required: false, blank: true, trim: true }); - schema.pronouns = new fields.StringField({ required: false, blank: true, trim: true }); - schema.homeworld = new fields.StringField({ required: false, blank: true, trim: true }); - schema.location = new fields.StringField({ required: false, blank: true, trim: true }); - schema.occupation = new fields.StringField({ required: false, blank: true, trim: true }); - schema.notes = new fields.HTMLField({ required: false, blank: true, trim: true }); - - return schema; - } -} - -export class WeaponData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - schema.equipped = new fields.BooleanField({ required: false, initial: false }); - schema.range = new fields.SchemaField({ - isMelee: new fields.BooleanField({ required: false, initial: false }), - value: new fields.NumberField({ required: false, integer: true, nullable: true }), - unit: new fields.StringField({ required: false, blank: true, nullable: true }) - }), - //schema.tons = new fields.NumberField({ required: false, initial: 0, min: 0, integer: false }); - schema.damage = new fields.StringField({ required: false, blank: true, trim: true }); - schema.magazine = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.magazineCost = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.traits = new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - schema.options = new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - - return schema; - } -} - -export class ArmorData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - schema.equipped = new fields.BooleanField({ required: false, initial: false }); - schema.radiations = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.protection = new fields.StringField({ required: false, blank: false, trim: true }); - - // Some armours have a required skill. A Traveller suffers DM-1 to all checks taken in the armour per missing - // skill level. For example, a Traveller with Vacc Suit skill 0 who is in a suit that requires Vacc Suit 2 would have - // DM-2 to all their checks. Not having the skill at all inflicts the usual DM-3 unskilled penalty instead. - schema.requireSkill = new fields.StringField({ required: false, blank: false }); - schema.requireSkillLevel = new fields.NumberField({ required: false, min: 0, integer: true }); - - //requirements: new fields.StringField({ required: false, blank: false, trim: true }), - - // As powered armour, battle dress supports its own weight. While powered and active, the mass of battle dress - // does not count against the encumbrance of the wearer and is effectively weightless. - schema.powered = new fields.BooleanField({ required: false, initial: false }); - schema.options = new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - - // Characteristics Modifiers (Pirate of Drinax - ASLAN BATTLE DRESS STR/DEX, Slot) - - return schema; - } -} - -export class ComputerData extends PhysicalItemData { - static defineSchema() { - const schema = super.defineSchema(); - - schema.processing = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.processingUsed = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.overload = new fields.BooleanField({ required: false, initial: false }); - //schema.softwares = new fields.ArrayField(new fields.StringField({ required: false, blank: true, trim: true })); - schema.options = new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ); - - return schema; - } -} - -export class SoftwareData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - - schema.bandwidth = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); - schema.inUse = new fields.BooleanField({ required: false, initial: false }); - schema.computer = new fields.StringField({ required: false, blank: true, nullable: true }); - - return schema; - } -} - -export class SpeciesData extends foundry.abstract.TypeDataModel { - static defineSchema() { - const fields = foundry.data.fields; - const schema = { - description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }), - descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true }), - traits: new fields.ArrayField( - new fields.SchemaField({ - name: new fields.StringField({ required: true, blank: true, trim: true }), - description: new fields.StringField({ required: false, blank: true, trim: true }) - }) - ), - modifiers: new fields.ArrayField( - new fields.SchemaField({ - characteristic: new fields.StringField({ required: false, blank: true, trim: true }), - value: new fields.NumberField({ required: false, integer: true, nullable: true }) - }) - ) - }; - - return schema; - } -} - -export class ItemContainerData extends ItemBaseData { - static defineSchema() { - const schema = super.defineSchema(); - - schema.onHand = new fields.BooleanField({ required: false, initial: false }); - schema.location = new fields.StringField({ required: false, blank: true, trim: true }); - schema.count = new fields.NumberField({ required: false, initial: 0, integer: true }); - schema.weight = new fields.NumberField({ required: false, initial: 0, integer: false }); - schema.weightless = new fields.BooleanField({ required: false, initial: false }); - - schema.locked = new fields.BooleanField({ required: false, initial: false }); // GM only - schema.lockedDescription = new fields.StringField({ required: false, blank: true, trim: true, nullable: true }); - return schema; - } -} - -function createCharacteristicField(show = true, showMax = false) { - return new fields.SchemaField({ - value: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), - max: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }), - dm: new fields.NumberField({ required: false, initial: 0, integer: true }), - show: new fields.BooleanField({ required: false, initial: show }), - showMax: new fields.BooleanField({ required: false, initial: showMax }) - }); -} \ No newline at end of file diff --git a/src/module/models/character.mjs b/src/module/models/character.mjs new file mode 100644 index 0000000..4ece334 --- /dev/null +++ b/src/module/models/character.mjs @@ -0,0 +1,96 @@ +import { createCharacteristicField } from "./items/base-item.mjs"; +const fields = foundry.data.fields; + +export default class CharacterData extends foundry.abstract.TypeDataModel { + + static defineSchema() { + return { + name: new fields.StringField({ required: false, blank: false, trim: true }), + life: new fields.SchemaField({ + value: new fields.NumberField({ required: false, initial: 0, integer: true }), + max: new fields.NumberField({ required: true, initial: 0, integer: true }) + }), + personal: new fields.SchemaField({ + title: new fields.StringField({ required: false, blank: true, trim: true }), + species: new fields.StringField({ required: false, blank: true, trim: true }), + speciesText: new fields.SchemaField({ + description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }), + descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true }) + }), + age: new fields.StringField({ required: false, blank: true, trim: true }), + gender: new fields.StringField({ required: false, blank: true, trim: true }), + pronouns: new fields.StringField({ required: false, blank: true, trim: true }), + homeworld: new fields.StringField({ required: false, blank: true, trim: true }), + ucp: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), + traits: new fields.ArrayField( + new fields.SchemaField({ + name: new fields.StringField({ required: true, blank: true, trim: true }), + description: new fields.StringField({ required: false, blank: true, trim: true }) + }) + ) + }), + biography: new fields.HTMLField({ required: false, blank: true, trim: true }), + + characteristics: new fields.SchemaField({ + strength: createCharacteristicField(true, true), + dexterity: createCharacteristicField(true, true), + endurance: createCharacteristicField(true, true), + intellect: createCharacteristicField(true, false), + education: createCharacteristicField(true, false), + social: createCharacteristicField(true, false), + morale: createCharacteristicField(true, false), + luck: createCharacteristicField(true, false), + sanity: createCharacteristicField(true, false), + charm: createCharacteristicField(true, false), + psionic: createCharacteristicField(true, false), + other: createCharacteristicField(true, false) + }), + + health: new fields.SchemaField({ + radiations: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }) + }), + study: new fields.SchemaField({ + skill: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), + total: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }), + completed: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }) + }), + finance: new fields.SchemaField({ + pension: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), + credits: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), + cashOnHand: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), + debt: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), + livingCost: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), + monthlyShipPayments: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), + notes: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }) + }), + containerView: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), + containerDropIn: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), + notes: new fields.HTMLField({ required: false, blank: true, trim: true }), + + inventory: new fields.SchemaField({ + armor: new fields.NumberField({ required: true, initial: 0, integer: true }), + weight: new fields.NumberField({ required: true, initial: 0, min: 0, integer: false }), + encumbrance: new fields.SchemaField({ + normal: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), + heavy: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }) + }) + }), + states: new fields.SchemaField({ + encumbrance: new fields.BooleanField({ required: false, initial: false }), + fatigue: new fields.BooleanField({ required: false, initial: false }), + unconscious: new fields.BooleanField({ required: false, initial: false }), + surgeryRequired: new fields.BooleanField({ required: false, initial: false }) + }), + + config: new fields.SchemaField({ + psionic: new fields.BooleanField({ required: false, initial: true }), + initiative: new fields.StringField({ required: false, blank: true, initial: "dexterity" }), + damages: new fields.SchemaField({ + rank1: new fields.StringField({ required: false, blank: true, initial: "strength" }), + rank2: new fields.StringField({ required: false, blank: true, initial: "dexterity" }), + rank3: new fields.StringField({ required: false, blank: true, initial: "endurance" }) + }) + }) + }; + } +} diff --git a/src/module/models/index.mjs b/src/module/models/index.mjs new file mode 100644 index 0000000..f7f9296 --- /dev/null +++ b/src/module/models/index.mjs @@ -0,0 +1,16 @@ +// Actor DataModels +export { default as CharacterData } from "./character.mjs"; +export { default as VehiculeData } from "./vehicule.mjs"; + +// Item DataModels +export { default as ItemData } from "./items/item.mjs"; +export { default as EquipmentData } from "./items/equipment.mjs"; +export { default as DiseaseData } from "./items/disease.mjs"; +export { default as CareerData } from "./items/career.mjs"; +export { default as TalentData } from "./items/talent.mjs"; +export { default as ContactData } from "./items/contact.mjs"; +export { default as WeaponData } from "./items/weapon.mjs"; +export { default as ArmorData } from "./items/armor.mjs"; +export { default as ComputerData } from "./items/computer.mjs"; +export { default as ItemContainerData } from "./items/container.mjs"; +export { default as SpeciesData } from "./items/species.mjs"; diff --git a/src/module/models/items/armor.mjs b/src/module/models/items/armor.mjs new file mode 100644 index 0000000..4dc8892 --- /dev/null +++ b/src/module/models/items/armor.mjs @@ -0,0 +1,23 @@ +import { PhysicalItemData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class ArmorData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.equipped = new fields.BooleanField({ required: false, initial: false }); + schema.radiations = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.protection = new fields.StringField({ required: false, blank: false, trim: true }); + // A Traveller suffers DM-1 to all checks per missing skill level in the required skill. + schema.requireSkill = new fields.StringField({ required: false, blank: false }); + schema.requireSkillLevel = new fields.NumberField({ required: false, min: 0, integer: true }); + // Powered armour supports its own weight and is effectively weightless for encumbrance. + schema.powered = new fields.BooleanField({ required: false, initial: false }); + schema.options = new fields.ArrayField( + new fields.SchemaField({ + name: new fields.StringField({ required: true, blank: true, trim: true }), + description: new fields.StringField({ required: false, blank: true, trim: true }) + }) + ); + return schema; + } +} diff --git a/src/module/models/items/base-item.mjs b/src/module/models/items/base-item.mjs new file mode 100644 index 0000000..eb21a6c --- /dev/null +++ b/src/module/models/items/base-item.mjs @@ -0,0 +1,41 @@ +const fields = foundry.data.fields; + +export function createCharacteristicField(show = true, showMax = false) { + return new fields.SchemaField({ + value: new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }), + max: new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }), + dm: new fields.NumberField({ required: false, initial: 0, integer: true }), + show: new fields.BooleanField({ required: false, initial: show }), + showMax: new fields.BooleanField({ required: false, initial: showMax }) + }); +} + +export class ItemBaseData extends foundry.abstract.TypeDataModel { + static defineSchema() { + return { + description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }), + subType: new fields.StringField({ required: false, blank: false, nullable: true }) + }; + } +} + +export class PhysicalItemData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.quantity = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true }); + schema.weight = new fields.NumberField({ required: true, initial: 0, min: 0, integer: false }); + schema.weightless = new fields.BooleanField({ required: false, initial: false }); + schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); + schema.tl = new fields.StringField({ required: true, blank: false, initial: "TL12" }); + schema.container = new fields.SchemaField({ + id: new fields.StringField({ required: false, blank: true }) + }); + schema.roll = new fields.SchemaField({ + characteristic: new fields.StringField({ required: false, blank: true, trim: true }), + skill: new fields.StringField({ required: false, blank: true, trim: true }), + difficulty: new fields.StringField({ required: false, blank: true, trim: true }) + }); + schema.trash = new fields.BooleanField({ required: false, initial: false }); + return schema; + } +} diff --git a/src/module/models/items/career.mjs b/src/module/models/items/career.mjs new file mode 100644 index 0000000..ae4ae93 --- /dev/null +++ b/src/module/models/items/career.mjs @@ -0,0 +1,21 @@ +import { ItemBaseData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class CareerData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.difficulty = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); + schema.damage = new fields.StringField({ required: false, blank: true }); + schema.interval = new fields.StringField({ required: false, blank: true }); + schema.assignment = new fields.StringField({ required: false, blank: true }); + schema.terms = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.rank = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.events = new fields.ArrayField( + new fields.SchemaField({ + age: new fields.NumberField({ required: false, integer: true }), + description: new fields.StringField({ required: false, blank: true, trim: true }) + }) + ); + return schema; + } +} diff --git a/src/module/models/items/computer.mjs b/src/module/models/items/computer.mjs new file mode 100644 index 0000000..470641f --- /dev/null +++ b/src/module/models/items/computer.mjs @@ -0,0 +1,18 @@ +import { PhysicalItemData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class ComputerData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.processing = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.processingUsed = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.overload = new fields.BooleanField({ required: false, initial: false }); + schema.options = new fields.ArrayField( + new fields.SchemaField({ + name: new fields.StringField({ required: true, blank: true, trim: true }), + description: new fields.StringField({ required: false, blank: true, trim: true }) + }) + ); + return schema; + } +} diff --git a/src/module/models/items/contact.mjs b/src/module/models/items/contact.mjs new file mode 100644 index 0000000..eeff7ff --- /dev/null +++ b/src/module/models/items/contact.mjs @@ -0,0 +1,27 @@ +import { ItemBaseData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class ContactData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.subType.initial = "skill"; + schema.cost = new fields.NumberField({ required: true, initial: 1, min: 0, integer: true }); + schema.skill = new fields.SchemaField({ + speciality: new fields.StringField({ required: false, blank: true, trim: true }), + characteristic: new fields.StringField({ required: false, blank: true, trim: true }) + }); + schema.status = new fields.StringField({ required: false, blank: true, trim: true, initial: "Alive" }); + schema.attitude = new fields.StringField({ required: false, blank: true, trim: true, initial: "Unknow" }); + schema.relation = new fields.StringField({ required: false, blank: true, trim: true, initial: "Contact" }); + schema.title = new fields.StringField({ required: false, blank: true, trim: true }); + schema.nickname = new fields.StringField({ required: false, blank: true, trim: true }); + schema.species = new fields.StringField({ required: false, blank: true, trim: true }); + schema.gender = new fields.StringField({ required: false, blank: true, trim: true }); + schema.pronouns = new fields.StringField({ required: false, blank: true, trim: true }); + schema.homeworld = new fields.StringField({ required: false, blank: true, trim: true }); + schema.location = new fields.StringField({ required: false, blank: true, trim: true }); + schema.occupation = new fields.StringField({ required: false, blank: true, trim: true }); + schema.notes = new fields.HTMLField({ required: false, blank: true, trim: true }); + return schema; + } +} diff --git a/src/module/models/items/container.mjs b/src/module/models/items/container.mjs new file mode 100644 index 0000000..e72368e --- /dev/null +++ b/src/module/models/items/container.mjs @@ -0,0 +1,16 @@ +import { ItemBaseData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class ItemContainerData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.onHand = new fields.BooleanField({ required: false, initial: false }); + schema.location = new fields.StringField({ required: false, blank: true, trim: true }); + schema.count = new fields.NumberField({ required: false, initial: 0, integer: true }); + schema.weight = new fields.NumberField({ required: false, initial: 0, integer: false }); + schema.weightless = new fields.BooleanField({ required: false, initial: false }); + schema.locked = new fields.BooleanField({ required: false, initial: false }); // GM only + schema.lockedDescription = new fields.StringField({ required: false, blank: true, trim: true, nullable: true }); + return schema; + } +} diff --git a/src/module/models/items/disease.mjs b/src/module/models/items/disease.mjs new file mode 100644 index 0000000..92494d6 --- /dev/null +++ b/src/module/models/items/disease.mjs @@ -0,0 +1,13 @@ +import { ItemBaseData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class DiseaseData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.subType.initial = "disease"; // disease, poison + schema.difficulty = new fields.StringField({ required: true, initial: "Average" }); + schema.damage = new fields.StringField({ required: false, blank: true }); + schema.interval = new fields.StringField({ required: false, blank: true }); + return schema; + } +} diff --git a/src/module/models/items/equipment.mjs b/src/module/models/items/equipment.mjs new file mode 100644 index 0000000..097ae7e --- /dev/null +++ b/src/module/models/items/equipment.mjs @@ -0,0 +1,14 @@ +import { PhysicalItemData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class EquipmentData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.equipped = new fields.BooleanField({ required: false, initial: false }); + schema.augment = new fields.SchemaField({ + improvement: new fields.StringField({ required: false, blank: true, trim: true }) + }); + schema.subType.initial = "equipment"; // augment, clothing, trinket, toolkit, equipment + return schema; + } +} diff --git a/src/module/models/items/item.mjs b/src/module/models/items/item.mjs new file mode 100644 index 0000000..abb49da --- /dev/null +++ b/src/module/models/items/item.mjs @@ -0,0 +1,15 @@ +import { PhysicalItemData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class ItemData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.subType.initial = "loot"; + schema.software = new fields.SchemaField({ + bandwidth: new fields.NumberField({ required: false, initial: 0, min: 0, max: 10, integer: true }), + effect: new fields.StringField({ required: false, blank: true, trim: true, initial: "" }), + computerId: new fields.StringField({ required: false, blank: true, initial: "" }) + }); + return schema; + } +} diff --git a/src/module/models/items/species.mjs b/src/module/models/items/species.mjs new file mode 100644 index 0000000..3d4fb6e --- /dev/null +++ b/src/module/models/items/species.mjs @@ -0,0 +1,22 @@ +const fields = foundry.data.fields; + +export default class SpeciesData extends foundry.abstract.TypeDataModel { + static defineSchema() { + return { + description: new fields.StringField({ required: false, blank: true, trim: true, nullable: true }), + descriptionLong: new fields.HTMLField({ required: false, blank: true, trim: true }), + traits: new fields.ArrayField( + new fields.SchemaField({ + name: new fields.StringField({ required: true, blank: true, trim: true }), + description: new fields.StringField({ required: false, blank: true, trim: true }) + }) + ), + modifiers: new fields.ArrayField( + new fields.SchemaField({ + characteristic: new fields.StringField({ required: false, blank: true, trim: true }), + value: new fields.NumberField({ required: false, integer: true, nullable: true }) + }) + ) + }; + } +} diff --git a/src/module/models/items/talent.mjs b/src/module/models/items/talent.mjs new file mode 100644 index 0000000..46c0a8b --- /dev/null +++ b/src/module/models/items/talent.mjs @@ -0,0 +1,27 @@ +import { ItemBaseData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class TalentData extends ItemBaseData { + static defineSchema() { + const schema = super.defineSchema(); + schema.subType.initial = "skill"; + schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); + schema.level = new fields.NumberField({ required: true, initial: 0, min: 0, integer: true }); + schema.skill = new fields.SchemaField({ + speciality: new fields.StringField({ required: false, blank: true, trim: true }), + reduceEncumbrance: new fields.BooleanField({ required: false, initial: false }) + }); + schema.psionic = new fields.SchemaField({ + reach: new fields.StringField({ required: false, blank: true, trim: true }), + cost: new fields.NumberField({ required: false, initial: 1, min: 0, integer: true }), + duration: new fields.StringField({ required: false, blank: true, trim: true }), + durationUnit: new fields.StringField({ required: false }) + }); + schema.roll = new fields.SchemaField({ + characteristic: new fields.StringField({ required: false, blank: true, trim: true }), + skill: new fields.StringField({ required: false, blank: true, trim: true }), + difficulty: new fields.StringField({ required: false, blank: true, trim: true }) + }); + return schema; + } +} diff --git a/src/module/models/items/weapon.mjs b/src/module/models/items/weapon.mjs new file mode 100644 index 0000000..e1b0273 --- /dev/null +++ b/src/module/models/items/weapon.mjs @@ -0,0 +1,30 @@ +import { PhysicalItemData } from "./base-item.mjs"; +const fields = foundry.data.fields; + +export default class WeaponData extends PhysicalItemData { + static defineSchema() { + const schema = super.defineSchema(); + schema.equipped = new fields.BooleanField({ required: false, initial: false }); + schema.range = new fields.SchemaField({ + isMelee: new fields.BooleanField({ required: false, initial: false }), + value: new fields.NumberField({ required: false, integer: true, nullable: true }), + unit: new fields.StringField({ required: false, blank: true, nullable: true }) + }); + schema.damage = new fields.StringField({ required: false, blank: true, trim: true }); + schema.magazine = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.magazineCost = new fields.NumberField({ required: false, initial: 0, min: 0, integer: true }); + schema.traits = new fields.ArrayField( + new fields.SchemaField({ + name: new fields.StringField({ required: true, blank: true, trim: true }), + description: new fields.StringField({ required: false, blank: true, trim: true }) + }) + ); + schema.options = new fields.ArrayField( + new fields.SchemaField({ + name: new fields.StringField({ required: true, blank: true, trim: true }), + description: new fields.StringField({ required: false, blank: true, trim: true }) + }) + ); + return schema; + } +} diff --git a/src/module/models/vehicule.mjs b/src/module/models/vehicule.mjs new file mode 100644 index 0000000..ac4e8b5 --- /dev/null +++ b/src/module/models/vehicule.mjs @@ -0,0 +1,33 @@ +const fields = foundry.data.fields; + +export default class VehiculeData extends foundry.abstract.TypeDataModel { + + static defineSchema() { + return { + name: new fields.StringField({ required: false, blank: false, trim: true }), + skillId: new fields.StringField({ required: false, initial: "", blank: true, trim: true }), + speed: new fields.SchemaField({ + cruise: new fields.StringField({ required: false, initial: "Slow", blank: true }), + maximum: new fields.StringField({ required: false, initial: "Medium", blank: true }) + }), + agility: new fields.NumberField({ required: false, min: 0, integer: true }), + crew: new fields.NumberField({ required: false, min: 0, integer: true }), + passengers: new fields.NumberField({ required: false, min: 0, integer: true }), + cargo: new fields.NumberField({ required: false, min: 0, integer: false }), + life: new fields.SchemaField({ + value: new fields.NumberField({ required: true, initial: 0, integer: true }), + max: new fields.NumberField({ required: true, initial: 0, integer: true }) + }), + shipping: new fields.NumberField({ required: false, min: 0, integer: true }), + cost: new fields.NumberField({ required: false, min: 0, integer: true }), + armor: new fields.SchemaField({ + front: new fields.NumberField({ required: true, initial: 0, integer: true }), + rear: new fields.NumberField({ required: true, initial: 0, integer: true }), + sides: new fields.NumberField({ required: true, initial: 0, integer: true }) + }), + skills: new fields.SchemaField({ + autopilot: new fields.NumberField({ required: true, initial: 0, integer: true }) + }) + }; + } +}