bolshoytoster / hashlips_art_engine

HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.
MIT License
42 stars 34 forks source link

showing attribute repeatedly in rarity without values #18

Closed sadun619 closed 1 year ago

sadun619 commented 1 year ago

Checklist

Description

when generate rarity it shows attribute over and over without values. Eg. if have 5 layers, rarity showing with generated values for 1 st layer and other 4 layers without generated values. it happens to each layer and showing rarity 25 times.

Screenshot (204)

this is my layer configuration.

Screenshot (205)

it shows unnecessary attributes for all traits, after each layer, like highlighted in above image.

if have 5 layers and 5 traits for each layer. (Total 25 layers), rarity show 25 times for each trait types. (5 with values and 20 without values for one trait type, total have 125. unnecessary 100 and 25 with values)

Steps to reproduce

No response

Expected result

No response

Actual result

No response

Environment

OS Version (uname -a on unix, systeminfo on windows): Node.js version (node -v):

bolshoytoster commented 1 year ago

@sadun619 if you generated a collection then added more images, those extra images would show up since that's how the script gets the list of images.

If you don't want them to show up you could change lines ~64-70: https://github.com/bolshoytoster/hashlips_art_engine/blob/16a9d9c2581ff78f13db064d1e830a0e5d8d2637/utils/rarity.js#L64-L70

to

    if (rarityData[layer][attribute].occurrence == 0) {
        delete rarityData[layer][attribute];
    } else {
      // get chance
      let chance =
        ((rarityData[layer][attribute].occurrence / editionSize) * 100).toFixed(2);

      // show two decimal places in percent
      rarityData[layer][attribute].occurrence =
        `${rarityData[layer][attribute].occurrence} in ${editionSize} editions (${chance} %)`;
    }
sadun619 commented 1 year ago

@sadun619 if you generated a collection then added more images, those extra images would show up since that's how the script gets the list of images.

If you don't want them to show up you could change lines ~64-70:

https://github.com/bolshoytoster/hashlips_art_engine/blob/16a9d9c2581ff78f13db064d1e830a0e5d8d2637/utils/rarity.js#L64-L70

to

    if (rarityData[layer][attribute].occurrence == 0) {
        delete rarityData[layer][attribute];
    } else {
      // get chance
      let chance =
        ((rarityData[layer][attribute].occurrence / editionSize) * 100).toFixed(2);

      // show two decimal places in percent
      rarityData[layer][attribute].occurrence =
        `${rarityData[layer][attribute].occurrence} in ${editionSize} editions (${chance} %)`;
    }

it's working. thank you.