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 🙏

© 2026 – Pkg Stats / Ryan Hefner

miaoda-game-draft-pool-core

v0.3.0

Published

Engine-agnostic finite draft pool with tiered weighted offers, reservation/commit/release lifecycle, committed-copy reclamation, deterministic RNG, probability inspection, conservation checks, and serializable snapshots. Backs auto-battler shared shops, c

Downloads

520

Readme

miaoda-game-draft-pool-core

Use this engine-independent package for finite auto-battler shops, card drafts, rotating markets, recruit boards, and limited prize pools. Unlike a loot table, it owns finite inventory and the lifecycle available -> reserved -> committed, with release and reclaim paths.

Install

pnpm add miaoda-game-draft-pool-core

Create, buy, and release offers

import { DraftPool } from 'miaoda-game-draft-pool-core';

const pool = new DraftPool([
  { id: 'guard', tier: 'one', count: 20, value: { unitId: 'guard', cost: 1 } },
  { id: 'mage', tier: 'two', count: 12, value: { unitId: 'mage', cost: 2 } },
], { seed: 2026 });

const offer = pool.createOffer({
  id: 'player-1-shop', ownerId: 'player-1', slots: 5,
  tierWeights: [{ tier: 'one', weight: 75 }, { tier: 'two', weight: 25 }],
});

if (offer.ok) {
  const bought = pool.commitSlot(offer.offer.id, 0);
  pool.releaseOffer(offer.offer.id); // returns unbought reserved copies
  if (bought.ok) pool.reclaim([{ entryId: bought.entryId, count: 1 }]);
}

Offer creation and refresh are atomic: a shortage consumes neither stock nor RNG, and a failed refresh keeps the old offer. Selection chooses a tier by its weights, then copies proportionally within the non-empty tier. available + reserved + committed always equals the initial catalog count.

Probabilities and ownership

Use probabilities(tierWeights) for exact next-slot odds instead of duplicating selection math. ownerId is metadata, not authorization. Full offers include other owners' reservations and future RNG position, so keep snapshots and pool state on a trusted host; do not send them directly to a player who should not see hidden inventory.

Saving

snapshot contains catalog compatibility data, active offers, committed state, and RNG position. Restore with the same catalog ordering and counts. The catalog signature detects incompatible rules but is not authentication or anti-cheat protection. Persist current RNG state when a resumed shop must continue rather than restart from its seed.

Combine pool changes with wallet and roster changes inside an authoritative transaction, for example through miaoda-game-command-core. This package does not own currency, timers, inventory, or UI.

Public API

DraftPool, DraftRng, offer/slot lifecycle methods, probabilities, snapshot types, DraftEntry, TierWeight, and result/failure types are exported.