Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Inconsistent handling of actor's system.details.source data #483

Closed
MaxPat931 opened this issue Feb 1, 2024 · 2 comments
Closed
Assignees
Labels
bug Functionality which is not working as intended dnd-phandelver-below Issues related to Phandelver and Below: The Shattered Obelisk

Comments

@MaxPat931
Copy link

What happened?

Source data is not consistent across actors, and missing for several as well

image
image
image

What package are you reporting this for?

Phandelver and Below: The Shattered Obelisk

Version

1.0.0

Relevant log output

No response

@MaxPat931 MaxPat931 added the bug Functionality which is not working as intended label Feb 1, 2024
@aaclayton aaclayton added the dnd-phandelver-below Issues related to Phandelver and Below: The Shattered Obelisk label Feb 1, 2024
@MaxPat931
Copy link
Author

MaxPat931 commented Feb 22, 2024

It looks like the latest update did standardize all the SRD references into Custom, but there are still inconsistencies for the PBSO entries (Book or Custom, and or &, with or without The Shattered Obelisk)
image

I adapted this from something else in #macro-polo, but seemed to work well and give all the PBSO actors consistent Source data, based on whether or not an actor of a matching name exists in the SRD compendium, and changes the SRD matches to have the same data as the SRD compendium, and will log out the changes, just in case.
(Of course, this is just for the compendium actors, the in world actors, and tokens would need to be updated as well)

const srdMonsPack = game.packs.get("dnd5e.monsters");
const pbsoMonsPack = game.packs.get("dnd-phandelver-below.pbso-bestiary")

const matches = new Set(pbsoMonsPack.index.map(e => e.name)).intersection(new Set(srdMonsPack.index.map(e => e.name)));
for (let match of matches) {
    const targetSource = await pbsoMonsPack.getDocument(pbsoMonsPack.index.getName(match)._id);
    if (targetSource.system.details.source.book === "SRD 5.1") {
        console.log(targetSource.name, "Correct!")
        continue};
    console.log("SRD-TARGETSOURCE-OLD", targetSource.name, targetSource.system.details.source)
    await targetSource.update({ 'system.details.source.book': "SRD 5.1", 'system.details.source.custom': "", 'system.details.source.license': "CC-BY-4.0" })
    console.log("SRD-TARGETSOURCE-NEW", targetSource.name, targetSource.system.details.source)
}

const uniques = new Set(pbsoMonsPack.index.map(e => e.name)).difference(new Set(srdMonsPack.index.map(e => e.name)));
for (let unique of uniques) {
    const targetSource = await pbsoMonsPack.getDocument(pbsoMonsPack.index.getName(unique)._id);
    if (targetSource.system.details.source.book === "Phandelver and Below: The Shattered Obelisk")  {
        console.log(targetSource.name, "Correct!")
        continue};
    console.log("PBSO-TARGETSOURCE-OLD", targetSource.name, targetSource.system.details.source)
    await targetSource.update({ 'system.details.source.book': "Phandelver and Below: The Shattered Obelisk", 'system.details.source.custom': "" })
    console.log("PBSO-TARGETSOURCE-NEW", targetSource.name, targetSource.system.details.source)
}

@mattexdee mattexdee self-assigned this Jun 13, 2024
@mattexdee mattexdee added this to the Phandelver and Below 1.2 milestone Jun 13, 2024
@mattexdee
Copy link
Contributor

Fixed as part of our 1.2.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality which is not working as intended dnd-phandelver-below Issues related to Phandelver and Below: The Shattered Obelisk
Projects
None yet
Development

No branches or pull requests

3 participants