jessev14 / custom-character-sheet-sections

GNU General Public License v3.0
0 stars 5 forks source link

Feature Question/Request - Setting Multiple items to the same Custom Category in Bulk #4

Closed TheErikkuBlade closed 2 years ago

TheErikkuBlade commented 2 years ago

So as the name suggests, I'm looking to see if there's an easy way to set multiple features/items to the same category. It's a feature I'd personally like to see implemented if it doesn't already exist.

I've no idea how challenging something like this is, so if it's too much to ask for I understand lol.

jessev14 commented 2 years ago

the "custom section" data on an item is just a flag, which you can update in a macro. something like this should work.

// Names of items to apply custom section
const itemNames = [
    "item1",
    "item2",
    "item3"
];

// Name of custom section
const customSectionName = "New Section";

const items = itemNames.map(name => game.items.getName(name));

for (const item of items) {
    await item.setFlag("custom-character-sheet-sections", "sectionName", customSectionName);
}

the above only works for items in the item directory sidebar, but it's not a difficult change if you want to apply it to items already on an actor.

TheErikkuBlade commented 2 years ago

Sweet! Thanks!