A package for calculating substance mixes in Schedule 1
npm install @schedule1-tools/mixerbash
npm
npm install @schedule1-tools/mixer
yarn
yarn add @schedule1-tools/mixer
pnpm
pnpm add @schedule1-tools/mixer
`
---
Quick Start
$3
`typescript
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
// }
`
$3
`typescript
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
`typescript
import {
encodeMixState,
decodeMixState
} 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: [...] }
`
$3
`typescript
import { migrateMixHash } from '@schedule1-tools/mixer';
/**
* migrateMixHash(legacyHash: string): Promise
* → 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
`typescript
import {
effects,
products,
substances,
effectRulesBySubstance
} 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`