Fix weapon sheet
This commit is contained in:
@@ -25,8 +25,7 @@ export default class OathHammerArmor extends foundry.abstract.TypeDataModel {
|
||||
new fields.StringField({ choices: SYSTEM.ARMOR_TRAITS })
|
||||
)
|
||||
|
||||
// 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 })
|
||||
|
||||
schema.equipped = new fields.BooleanField({ initial: false })
|
||||
schema.cost = new fields.NumberField({ required: true, nullable: false, initial: 0, min: 0 })
|
||||
@@ -45,5 +44,13 @@ export default class OathHammerArmor 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.Armor"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user