Skip to content

Repository files navigation

Schedule1 Mixer

npm version npm downloads license: MIT

Open‑source mixing calculator for Schedule 1.


Installation

# npm
npm install @schedule1-tools/mixer

# yarn
yarn add @schedule1-tools/mixer

# pnpm
pnpm add @schedule1-tools/mixer

Quick Start

1. Calculate a mix

import { mixSubstances } from '@schedule1-tools/mixer';

/**
 * mixSubstances(product: Product, substances: Substance[])
 * → computes cost, effects, profit, profitMargin, addiction
 */
const result = mixSubstances('OG Kush', ['Cuke', 'Flu Medicine', 'Gasoline']);
// result → {
//   effects:      ['Be','Se','Eu','To'],
//   cost:         12,
//   sellPrice:    64,
//   profit:       52,
//   profitMargin: 0.81,
//   addiction:    0.44
// }

2. Calculate from a hash

import { mixFromHash } from '@schedule1-tools/mixer';

/**
 * mixFromHash(hash: string)
 * → decode & compute a mix from its shared hash form
 */
const result = mixFromHash('T0cgS3VzaDpBQkM');
// result → {
//   effects:      ['Be','Se','Eu','To'],
//   cost:         12,
//   sellPrice:    64,
//   profit:       52,
//   profitMargin: 0.81,
//   addiction:    0.44
// }

3. Encode & decode mix state

import { decodeMixState, encodeMixState } from '@schedule1-tools/mixer';

/**
 * encodeMixState(state: MixState) → string
 * decodeMixState(hash: string) → MixState
 */
const encoded = encodeMixState({
  product: 'OG Kush',
  substances: ['Cuke', 'Flu Medicine', 'Gasoline'],
});
// encoded → 'T0cgS3VzaDpBQkM'

const decoded = decodeMixState(encoded);
// decoded → { product: 'OG Kush', substances: [...] }

4. Migrate an old mix hash

import { migrateMixHash } from '@schedule1-tools/mixer';

/**
 * migrateMixHash(legacyHash: string): Promise<string|null>
 * → upgrade legacy LZ‑String hash to the new format
 */
const newHash = await migrateMixHash('OLD_BASE64_HASH_HERE');
// newHash → 'T0cgS3VzaDpBQkM' (or null if invalid)

Exports

In addition to the functions above, the package also exports data objects:

  • effects: All effect definitions
  • products: All product definitions
  • substances: All substance definitions
  • effectRulesBySubstance: Transformation rules for each substance
import { effectRulesBySubstance, effects, products, substances } from '@schedule1-tools/mixer';

Contributing

  1. Fork the repo
  2. Create a branch (git checkout -b feat/my-feature)
  3. Run tests & lint (pnpm test && pnpm run format)
  4. Open a PR against main

Please read CONTRIBUTING.md (if present) for more details.


License

MIT © Schedule1 Tools
See LICENSE for details.


Notice

This is a fan‑made project and is not affiliated with, authorized, maintained, sponsored, or endorsed by the developers of Schedule I the game. All game‑related content (names, trademarks, etc.) belongs to its respective owners.

About

The mixing calculator used by Schedule1 Tools. Open source for everyone.

Topics

Resources

Contributing

Stars

7 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages