Skip to content

Instantly share code, notes, and snippets.

@eliyastein
Last active April 12, 2021 23:09
Show Gist options
  • Select an option

  • Save eliyastein/8b49e312036b173fe5e98bb8fb2cd27e to your computer and use it in GitHub Desktop.

Select an option

Save eliyastein/8b49e312036b173fe5e98bb8fb2cd27e to your computer and use it in GitHub Desktop.
let seed = tokenData.hash;
let traits = []
let dna = seed.substring(2, seed.length);
const BOOLS = dna.split("").map(h => parseInt(Number("0x" + h), 10) % 2);
const INTS = dna.split("").map(h => parseInt(Number("0x" + h), 10));
const COLORS = dna.match(/.{2}/g).map(h => parseInt(Number("0x" + h), 10));
OFFSET = (function () {
o = COLORS[22] * INTS[5] * INTS[9];
if (o < 100 && BOOLS[3]) {
o = o * COLORS[10] * 30;
}
else if (o > 5000 && BOOLS[3]) {
o = o * COLORS[15] * 1.2;
}
return o;
})()
traits.push("Offset: " + OFFSET)
if (BOOLS[22] && BOOLS[5]){
traits.push("Widener: Random");
} else if(BOOLS[13]){
traits.push("Widener: Static");
} else {
traits.push("Widener: None");
}
if (BOOLS[3]){
traits.push("Pre-Wash: True");
if (BOOLS[9]) {
traits.push("Wash: True");
} else {
traits.push("Wash: False");
}
} else {
traits.push("Pre-Wash: False");
traits.push("Wash: False");
}
if (BOOLS[5]) {
traits.push("Ring Expander: True");
} else {
traits.push("Ring Expander: False");
}
if (BOOLS[7]) {
traits.push("Accelerator: True");
} else {
traits.push("Accelerator: False");
}
traits.push("Cell Alpha: " + Math.round(COLORS[1] * 0.6))
console.log(traits);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment