forked from GitHub-Mirrors/foundry-sw5e
Add adventuring gear
This commit is contained in:
parent
bd94d75086
commit
9d6fabe8c2
1 changed files with 6 additions and 7 deletions
|
@ -17,10 +17,6 @@ export default class CharacterImporter {
|
||||||
temp: sourceCharacter.attribs.find((e) => e.name == "hp_temp").current
|
temp: sourceCharacter.attribs.find((e) => e.name == "hp_temp").current
|
||||||
};
|
};
|
||||||
|
|
||||||
const ac = {
|
|
||||||
value: sourceCharacter.attribs.find((e) => e.name == "ac").current
|
|
||||||
};
|
|
||||||
|
|
||||||
const abilities = {
|
const abilities = {
|
||||||
str: {
|
str: {
|
||||||
value: sourceCharacter.attribs.find((e) => e.name == "strength").current,
|
value: sourceCharacter.attribs.find((e) => e.name == "strength").current,
|
||||||
|
@ -55,7 +51,6 @@ export default class CharacterImporter {
|
||||||
abilities: abilities,
|
abilities: abilities,
|
||||||
details: details,
|
details: details,
|
||||||
attributes: {
|
attributes: {
|
||||||
ac: ac,
|
|
||||||
hp: hp
|
hp: hp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,15 +146,19 @@ export default class CharacterImporter {
|
||||||
static async addItems(items, actor) {
|
static async addItems(items, actor) {
|
||||||
const weapons = await game.packs.get("sw5e.weapons").getContent();
|
const weapons = await game.packs.get("sw5e.weapons").getContent();
|
||||||
const armors = await game.packs.get("sw5e.armor").getContent();
|
const armors = await game.packs.get("sw5e.armor").getContent();
|
||||||
|
const adventuringGears = await game.packs.get("sw5e.adventuringgear").getContent();
|
||||||
|
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
const weapon = weapons.find((c) => c.name === item);
|
const weapon = weapons.find((c) => c.name.toLowerCase() === item.toLowerCase());
|
||||||
const armor = armors.find((c) => c.name === item);
|
const armor = armors.find((c) => c.name.toLowerCase() === item.toLowerCase());
|
||||||
|
const gear = adventuringGears.find((c) => c.name.toLowerCase() === item.toLowerCase());
|
||||||
|
|
||||||
if (weapon) {
|
if (weapon) {
|
||||||
await actor.createEmbeddedEntity("OwnedItem", weapon.data, { displaySheet: false });
|
await actor.createEmbeddedEntity("OwnedItem", weapon.data, { displaySheet: false });
|
||||||
} else if (armor) {
|
} else if (armor) {
|
||||||
await actor.createEmbeddedEntity("OwnedItem", armor.data, { displaySheet: false });
|
await actor.createEmbeddedEntity("OwnedItem", armor.data, { displaySheet: false });
|
||||||
|
} else if (gear) {
|
||||||
|
await actor.createEmbeddedEntity("OwnedItem", gear.data, { displaySheet: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue