Fix weapon sheet

This commit is contained in:
2026-03-08 14:48:49 +01:00
parent 317c4990bc
commit 31318317a7
14 changed files with 135 additions and 61 deletions

View File

@@ -16,8 +16,7 @@ export default class OathHammerEquipment extends foundry.abstract.TypeDataModel
// Item slots occupied when carried. 0 = small item (no slots).
schema.slots = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 })
// Rarity: DV for Fortune check when purchasing; 0 = always available
schema.rarity = new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 6 })
schema.rarity = new fields.StringField({ required: true, initial: "common", choices: SYSTEM.RARITY_CHOICES })
// Light radius in feet — only relevant for light-source items (Candle/Lamp/Lantern/Torch)
schema.lightRadius = new fields.NumberField({ required: false, nullable: true, initial: null, min: 0 })
@@ -28,5 +27,13 @@ export default class OathHammerEquipment extends foundry.abstract.TypeDataModel
return schema
}
static migrateData(source) {
if (typeof source.rarity === "number") {
const map = { 0: "common", 1: "uncommon", 2: "rare", 3: "very-rare", 4: "legendary", 5: "legendary", 6: "legendary" }
source.rarity = map[source.rarity] ?? "common"
}
return super.migrateData(source)
}
static LOCALIZATION_PREFIXES = ["OATHHAMMER.Equipment"]
}