An API for managing and interacting with the EToH Joke Towers Difficulty Chart. This package provides a structured way to define, organize, and retrieve difficulty levels, complete with metadata such as names, images, colors, and ratings.
npm install ejtimport Difficulty, { rgb } from "ejt-difficulty-chart";
const automatic = Difficulty.Automatic;
console.log(automatic.name); // "Automatic"
console.log(automatic.layoutRating); // -17
console.log(automatic.color); // { r: 214, g: 255, b: 186 }
const sameDifficulty = Difficulty.get("Automatic");
console.log(sameDifficulty === automatic); // true
const custom = new Difficulty("CustomDifficulty")
.setName("Custom Difficulty")
.setDescription("A locally defined difficulty.")
.setVisualRating("42")
.setLayoutRating(42)
.setClass(1)
.setColor(rgb(255, 0, 0))
.setImage("https://example.com/custom.png");Colours use 8-bit RGB channel values. The rgb helper validates each channel and returns an immutable plain object.
Requires Node.js 18 or newer.
npm install
npm testnpm run build regenerates the difficulty data and compiles the library with the standard TypeScript compiler. The Python scraper in scraper/ is unchanged and can still be run independently.
MIT. See LICENSE.