Fix various issues with rolls and compendiums
All checks were successful
Release Creation / build (release) Successful in 57s
All checks were successful
Release Creation / build (release) Successful in 57s
This commit is contained in:
@@ -675,7 +675,7 @@ export default class FTLNomadUtils {
|
||||
return [];
|
||||
});
|
||||
|
||||
console.log("Melee Weapons Data", meleeWeaponsData);
|
||||
console.log("Melee Weapons Data", meleeWeaponsData);
|
||||
// Import each melee weapon
|
||||
for (const weapon of meleeWeaponsData) {
|
||||
// Check if the weapon already exists
|
||||
@@ -705,4 +705,51 @@ export default class FTLNomadUtils {
|
||||
}
|
||||
}
|
||||
|
||||
static async importVehicleWeapons() {
|
||||
// Create a melee weapons folder if it doesn't exist
|
||||
const meleeWeaponsFolder = game.folders.getName("Vehicle Weapons") || await Folder.create({
|
||||
name: "Vehicle Weapons", type: "Item"
|
||||
})
|
||||
if (!meleeWeaponsFolder) {
|
||||
console.error("Failed to create Vehicle Weapons folder");
|
||||
return;
|
||||
}
|
||||
// Load the melee weapons JSON file
|
||||
const meleeWeaponsData = await fetch("systems/fvtt-ftl-nomad/assets/json_data/vehicleweapons.json")
|
||||
.then(response => response.json())
|
||||
.catch(error => {
|
||||
console.error("Failed to load vehicle weapons data:", error);
|
||||
return [];
|
||||
});
|
||||
|
||||
console.log("vehicle Weapons Data", meleeWeaponsData);
|
||||
// Import each melee weapon
|
||||
for (const weapon of meleeWeaponsData) {
|
||||
// Check if the weapon already exists
|
||||
const existingWeapon = game.items.find(i => i.name === weapon.name && i.type === "weapon");
|
||||
if (existingWeapon) {
|
||||
console.warn(`Weapon ${weapon.name} already exists, skipping import.`);
|
||||
}
|
||||
// Create the weapon item
|
||||
await Item.create({
|
||||
name: weapon.name,
|
||||
type: "weapon",
|
||||
img: "systems/fvtt-ftl-nomad/assets/icons/icon_weapon.svg",
|
||||
system: {
|
||||
description: weapon.description,
|
||||
damage: weapon.damage,
|
||||
techAge: this.getTechAgeKeyFromLabel(weapon.tech_age),
|
||||
weaponType: "vehicle", //SYSTEM.WEAPON_TYPES.melee.id,
|
||||
rangeType: SYSTEM.WEAPON_RANGE.melee.id,
|
||||
enc: 0,
|
||||
aspect: weapon.aspects,
|
||||
cost: weapon.cost || 0,
|
||||
ammoCost: weapon.ammo_cost || 0,
|
||||
magazine: weapon.mag || 1,
|
||||
},
|
||||
folder: meleeWeaponsFolder.id
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user