npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

z3r-patch

v1.0.4

Published

A JS module for patching ALTTPR seeds

Downloads

23

Readme

z3r-patch

About

z3r-patch is a lightweight JavaScript module for patching randomizer seeds generated on alttpr.com.

Note: z3r-patch is NOT approved for use in official races at this time. This may be subject to change in the future.

Installation

You can install z3r-patch in your Node.js project with the following command:

npm install z3r-patch

If you are using Deno, you can import the module in your source code:

import patch from "npm:z3r-patch";

Usage

To use z3r-patch in your project, use ES6 import syntax. You cannot import z3r-patch with require.

import patch from "z3r-patch"; // OK!
const { default: patch } = await import("z3r-patch"); // OK!
const patch = require("z3r-patch"); // WRONG!

After generating your seed on alttpr.com, you can apply it to your legally obtained JP 1.0 ALTTP ROM:

import * as fs from "node:fs/promises";
import patch from "z3r-patch";

// Generate seed with open 7/7 settings:
const seed = await fetch("https://alttpr.com/api/randomizer", {
    method: "post",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        accessibility: "items",
        crystals: {
            ganon: "7",
            tower: "7"
        },
        dungeon_items: "standard",
        enemizer: {
            boss_shuffle: "none",
            enemy_damage: "default",
            enemy_health: "default",
            enemy_shuffle: "none"
        },
        entrances: "none",
        glitches: "none",
        goal: "ganon",
        hints: "off",
        item: {
            functionality: "normal",
            pool: "normal"
        },
        item_placement: "advanced",
        lang: "en",
        mode: "open",
        spoilers: "on",
        tournament: false,
        weapons: "randomized"
    })
}).then(res => res.json());

// Fetch a custom sprite's .zspr file:
const angel = await fetch("https://alttpr-assets.s3.us-east-2.amazonaws.com/angel.1.zspr")
    .then(res => res.arrayBuffer());

// Apply the seed patches and post-generation options:
const rom = await patch(pathToJp10Rom, seed, {
    heartColor: "blue",
    heartSpeed: "half",
    quickswap: true,
    reduceFlash: true,
    sfxShuffle: true,
    sprite: angel
});

// Write the patched ROM to a new file:
await fs.writeFile(`./${seed.hash}.sfc`, rom);

z3r-patch supports the following post-generation settings:

  • Changing your heart color
  • Changing the heart beep speed
  • Item quickswap
  • Toggling background music
  • Toggling MSU-1 resume
  • Toggling reduced flashing
  • Changing your sprite, including using custom sprites
  • Extended palette shuffling options
  • Changing your menu speed (NOT RACE LEGAL)
  • Randomizing sound effects (NOT RACE LEGAL)

API

export default function(base: string, seed: VTSeed, options: PatchOptions): Promise<Uint8Array>;

interface VTSeed {
    generated: string;
    hash: string;
    logic: string;
    patch: Record<number, number[]>[];
    size: number;
    spoiler: object;
    current_rom_hash?: string;
}

interface PatchOptions {
    heartSpeed?: "off" | "quarter" | "half" | "normal" | "double";
    heartColor?: "red" | "blue" | "green" | "yellow";
    menuSpeed?: "slow" | "normal" | "fast" | "instant";
    quickswap?: boolean;
    backgroundMusic?: boolean;
    msu1Resume?: boolean;
    reduceFlash?: boolean;
    paletteShuffle?: boolean | PaletteMode | PaletteRandomizerOptions<SeedValue>;
    sfxShuffle?: boolean;
    sprite?: ArrayBuffer;
}

/* From @jaxxy/z3pr-js:1.0.2 */
interface PaletteRandomizerOptions<T extends SeedValue> {
    mode?: PaletteMode;
    randomize_overworld?: boolean;
    randomize_dungeon?: boolean;
    randomize_link_sprite?: boolean;
    randomize_sword?: boolean;
    randomize_shield?: boolean;
    randomize_hud?: boolean;
    seed?: T;
}

type SeedValue = number | [number, number] | [number, number, number];
type PaletteMode = "none" | "maseya" | "grayscale" | "negative" | "blackout" | "classic" | "dizzy" | "sick" | "puke";