Fix enc for equipments/weapons
All checks were successful
Release Creation / build (release) Successful in 1m34s

This commit is contained in:
2025-07-13 19:30:28 +02:00
parent 8197e3c369
commit d2cbe71731
17 changed files with 71 additions and 38 deletions

View File

@@ -7,11 +7,11 @@ export default class FTLNomadEquipment extends foundry.abstract.TypeDataModel {
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.techAge = new fields.StringField({ required: true, choices: SYSTEM.TECH_AGES, initial : "lateatomic" })
schema.enc = new fields.NumberField({ ...requiredInteger, required: true, initial: 0, min: 0 })
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.cost = new fields.NumberField({ required: true, initial: 1, min: 0 })
return schema
}

View File

@@ -7,12 +7,12 @@ export default class FTLNomadWeapon extends foundry.abstract.TypeDataModel {
const requiredInteger = { required: true, nullable: false, integer: true }
schema.description = new fields.HTMLField({ required: true, textSearch: true })
schema.techAge = new fields.StringField({ required: true, choices: SYSTEM.TECH_AGES, initial : "lateatomic" })
schema.weaponType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_TYPES })
schema.rangeType = new fields.StringField({ required: true, initial: "melee", choices: SYSTEM.WEAPON_RANGE })
schema.damage = new fields.StringField({required: true, initial: "1d6"})
schema.damage = new fields.StringField({required: true, initial: "1d6"})
schema.magazine = new fields.NumberField({ required: true, initial: 1, min: 0 })
schema.range = new fields.SchemaField({
@@ -22,12 +22,12 @@ export default class FTLNomadWeapon extends foundry.abstract.TypeDataModel {
dist: new fields.NumberField({ ...requiredInteger, initial: 0 }),
})
schema.enc = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.enc = new fields.NumberField({ required: true, initial: 1, min: 0 })
schema.aspect = new fields.StringField({ required: true, initial: ""})
schema.cost = new fields.NumberField({ required: true, initial: 0, min: 0 })
schema.ammoCost = new fields.NumberField({ required: true, initial: 0, min: 0 })
return schema
}

View File

@@ -636,6 +636,28 @@ export default class FTLNomadUtils {
}
}
static async fixWeaponsEnc() {
// Iterate over all items of type "weapon" from compendium
const weapons = game.items.filter(i => i.type === "weapon");
for (const weapon of weapons) {
// If the weapon's encumbrance is less than 1, set it to 1
if (weapon.system.enc < 1) {
await weapon.update({ "system.enc": 1 });
}
}
}
static async fixEquipmentEnc() {
// Iterate over all items of type "equipment" from compendium
const equipments = game.items.filter(i => i.type === "equipment");
for (const equipment of equipments) {
// If the equipment's encumbrance is less than 1, set it to
if (equipment.system.enc < 1) {
await equipment.update({ "system.enc": 1 });
}
}
}
static async importMeleeWeapons() {
// Create a melee weapons folder if it doesn't exist
const meleeWeaponsFolder = game.folders.getName("Melee Weapons") || await Folder.create({

Binary file not shown.

Binary file not shown.

View File

@@ -1 +1 @@
MANIFEST-000027
MANIFEST-000035

View File

@@ -1,8 +1,15 @@
2025/07/01-16:01:44.072605 7f0792ffd6c0 Recovering log #25
2025/07/01-16:01:44.082446 7f0792ffd6c0 Delete type=3 #23
2025/07/01-16:01:44.082527 7f0792ffd6c0 Delete type=0 #25
2025/07/01-16:02:15.776378 7f07923ff6c0 Level-0 table #30: started
2025/07/01-16:02:15.776429 7f07923ff6c0 Level-0 table #30: 0 bytes OK
2025/07/01-16:02:15.782796 7f07923ff6c0 Delete type=0 #28
2025/07/01-16:02:15.792835 7f07923ff6c0 Manual compaction at level-0 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)
2025/07/01-16:02:15.792882 7f07923ff6c0 Manual compaction at level-1 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)
2025/07/13-19:19:55.407043 7f3fa77fe6c0 Recovering log #33
2025/07/13-19:19:55.417622 7f3fa77fe6c0 Delete type=3 #31
2025/07/13-19:19:55.417740 7f3fa77fe6c0 Delete type=0 #33
2025/07/13-19:30:09.138052 7f3fa57fa6c0 Level-0 table #38: started
2025/07/13-19:30:09.142514 7f3fa57fa6c0 Level-0 table #38: 69052 bytes OK
2025/07/13-19:30:09.149276 7f3fa57fa6c0 Delete type=0 #36
2025/07/13-19:30:09.149522 7f3fa57fa6c0 Manual compaction at level-0 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)
2025/07/13-19:30:09.149572 7f3fa57fa6c0 Manual compaction at level-1 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at '!items!zv9dwgL3p7ThQn7j' @ 347 : 0
2025/07/13-19:30:09.149581 7f3fa57fa6c0 Compacting 1@1 + 1@2 files
2025/07/13-19:30:09.155375 7f3fa57fa6c0 Generated table #39@1: 273 keys, 107280 bytes
2025/07/13-19:30:09.155393 7f3fa57fa6c0 Compacted 1@1 + 1@2 files => 107280 bytes
2025/07/13-19:30:09.161181 7f3fa57fa6c0 compacted to: files[ 0 0 1 0 0 0 0 ]
2025/07/13-19:30:09.161294 7f3fa57fa6c0 Delete type=2 #14
2025/07/13-19:30:09.161440 7f3fa57fa6c0 Delete type=2 #38
2025/07/13-19:30:09.181330 7f3fa57fa6c0 Manual compaction at level-1 from '!items!zv9dwgL3p7ThQn7j' @ 347 : 0 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)

View File

@@ -1,8 +1,8 @@
2025/07/01-16:01:15.636283 7f0793fff6c0 Recovering log #21
2025/07/01-16:01:15.646077 7f0793fff6c0 Delete type=3 #19
2025/07/01-16:01:15.646127 7f0793fff6c0 Delete type=0 #21
2025/07/01-16:01:40.532816 7f07923ff6c0 Level-0 table #26: started
2025/07/01-16:01:40.532850 7f07923ff6c0 Level-0 table #26: 0 bytes OK
2025/07/01-16:01:40.540246 7f07923ff6c0 Delete type=0 #24
2025/07/01-16:01:40.552759 7f07923ff6c0 Manual compaction at level-0 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)
2025/07/01-16:01:40.552792 7f07923ff6c0 Manual compaction at level-1 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)
2025/07/13-10:30:52.384204 7f3fa77fe6c0 Recovering log #29
2025/07/13-10:30:52.394989 7f3fa77fe6c0 Delete type=3 #27
2025/07/13-10:30:52.395058 7f3fa77fe6c0 Delete type=0 #29
2025/07/13-10:33:26.219686 7f3fa57fa6c0 Level-0 table #34: started
2025/07/13-10:33:26.219728 7f3fa57fa6c0 Level-0 table #34: 0 bytes OK
2025/07/13-10:33:26.225987 7f3fa57fa6c0 Delete type=0 #32
2025/07/13-10:33:26.233983 7f3fa57fa6c0 Manual compaction at level-0 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)
2025/07/13-10:33:26.244796 7f3fa57fa6c0 Manual compaction at level-1 from '!folders!AuBtSOj1mJmh88qx' @ 72057594037927935 : 1 .. '!items!zv9dwgL3p7ThQn7j' @ 0 : 0; will stop at (end)

Binary file not shown.

View File

@@ -1 +1 @@
MANIFEST-000006
MANIFEST-000014

View File

@@ -1,7 +1,8 @@
2025/07/01-16:01:44.085326 7f07937fe6c0 Recovering log #4
2025/07/01-16:01:44.094948 7f07937fe6c0 Delete type=3 #2
2025/07/01-16:01:44.095019 7f07937fe6c0 Delete type=0 #4
2025/07/01-16:02:15.782915 7f07923ff6c0 Level-0 table #9: started
2025/07/01-16:02:15.786720 7f07923ff6c0 Level-0 table #9: 44762 bytes OK
2025/07/01-16:02:15.792657 7f07923ff6c0 Delete type=0 #7
2025/07/01-16:02:15.792848 7f07923ff6c0 Manual compaction at level-0 from '!actors!3pydTJsM73Z4o0V6' @ 72057594037927935 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at (end)
2025/07/13-19:19:55.423004 7f3fa5ffb6c0 Recovering log #12
2025/07/13-19:19:55.432450 7f3fa5ffb6c0 Delete type=3 #10
2025/07/13-19:19:55.432507 7f3fa5ffb6c0 Delete type=0 #12
2025/07/13-19:30:09.131809 7f3fa57fa6c0 Level-0 table #17: started
2025/07/13-19:30:09.131855 7f3fa57fa6c0 Level-0 table #17: 0 bytes OK
2025/07/13-19:30:09.137925 7f3fa57fa6c0 Delete type=0 #15
2025/07/13-19:30:09.149491 7f3fa57fa6c0 Manual compaction at level-0 from '!actors!3pydTJsM73Z4o0V6' @ 72057594037927935 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at (end)
2025/07/13-19:30:09.149534 7f3fa57fa6c0 Manual compaction at level-1 from '!actors!3pydTJsM73Z4o0V6' @ 72057594037927935 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at (end)

View File

@@ -1,5 +1,8 @@
2025/07/01-16:01:15.662939 7f0793fff6c0 Delete type=3 #1
2025/07/01-16:01:40.514143 7f07923ff6c0 Level-0 table #5: started
2025/07/01-16:01:40.514174 7f07923ff6c0 Level-0 table #5: 0 bytes OK
2025/07/01-16:01:40.520152 7f07923ff6c0 Delete type=0 #3
2025/07/01-16:01:40.526461 7f07923ff6c0 Manual compaction at level-0 from 'undefined' @ 72057594037927935 : 1 .. 'undefined' @ 0 : 0; will stop at (end)
2025/07/13-10:30:52.399161 7f3fa5ffb6c0 Recovering log #8
2025/07/13-10:30:52.409521 7f3fa5ffb6c0 Delete type=3 #6
2025/07/13-10:30:52.409646 7f3fa5ffb6c0 Delete type=0 #8
2025/07/13-10:33:26.202414 7f3fa57fa6c0 Level-0 table #13: started
2025/07/13-10:33:26.202485 7f3fa57fa6c0 Level-0 table #13: 0 bytes OK
2025/07/13-10:33:26.208789 7f3fa57fa6c0 Delete type=0 #11
2025/07/13-10:33:26.233915 7f3fa57fa6c0 Manual compaction at level-0 from '!actors!3pydTJsM73Z4o0V6' @ 72057594037927935 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at (end)
2025/07/13-10:33:26.234020 7f3fa57fa6c0 Manual compaction at level-1 from '!actors!3pydTJsM73Z4o0V6' @ 72057594037927935 : 1 .. '!folders!vRnrOJqSMlxbSgyX' @ 0 : 0; will stop at (end)

Binary file not shown.