@skyblock-finance/actions
Version:
This package contains actions players can take in Hypixel Skyblock
105 lines (104 loc) • 3.25 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.actionDefinitionSchema = exports.actionSchema = exports.actionRequirementSchema = exports.actionPlaceSchema = exports.npcIdSchema = exports.actionIoSchema = exports.actionIoItemSchema = exports.actionIoCurrencySchema = exports.actionIoCrystalSchema = void 0;
const v4_1 = require("zod/v4");
exports.actionIoCrystalSchema = v4_1.z.strictObject({
amount: v4_1.z.number(),
id: v4_1.z.string(),
type: v4_1.z.literal('crystal'),
});
exports.actionIoCurrencySchema = v4_1.z.strictObject({
amount: v4_1.z.number(),
id: v4_1.z.enum([
'bingo-point',
'bit',
'coin',
'copper',
'gem',
'forge-second',
'mote',
'north-star',
'pest',
'second',
'usd',
]),
type: v4_1.z.literal('currency'),
});
exports.actionIoItemSchema = v4_1.z.strictObject({
amount: v4_1.z.number(),
id: v4_1.z.string(),
type: v4_1.z.literal('item'),
});
exports.actionIoSchema = v4_1.z.discriminatedUnion('type', [
exports.actionIoCrystalSchema,
exports.actionIoCurrencySchema,
exports.actionIoItemSchema,
]);
exports.npcIdSchema = v4_1.z.enum([
'ADVENTURER',
'ALCHEMIST',
'BINGO',
'BUBU',
'BULVAR',
'EINARY',
'ELIZABETH',
'FISHING_MERCHANT',
'HILDA',
'MARTHOS',
'PHILLIP',
'PLUMBER_JOE',
'SEYMOUR',
'SKYMART',
'SMITHMONGER',
]);
exports.actionPlaceSchema = v4_1.z.discriminatedUnion('type', [
v4_1.z.strictObject({
left: exports.actionIoItemSchema,
right: exports.actionIoItemSchema,
type: v4_1.z.literal('anvil'),
}),
v4_1.z.strictObject({
type: v4_1.z.literal('forge'),
}),
v4_1.z.strictObject({
id: exports.npcIdSchema,
type: v4_1.z.literal('npc'),
}),
v4_1.z.strictObject({
type: v4_1.z.literal('website'),
url: v4_1.z.url(),
}),
v4_1.z.strictObject({
grid: v4_1.z.array(exports.actionIoItemSchema.nullable()).length(9),
type: v4_1.z.literal('workbench'),
}),
]);
/**
* NOTE: This schema uses uppercase to align 1-to-1 with the Skyblock Items API's requirements format.
*/
exports.actionRequirementSchema = v4_1.z.discriminatedUnion('type', [
v4_1.z.strictObject({
collection: v4_1.z.enum(['GEMSTONE' /* to be added as-needed */]),
tier: v4_1.z.int().min(1).max(10),
type: v4_1.z.literal('COLLECTION'),
}),
v4_1.z.strictObject({
level: v4_1.z.int().min(1).max(60),
skill: v4_1.z.enum(['MINING' /* to be added as-needed */]),
type: v4_1.z.literal('SKILL'),
}),
v4_1.z.strictObject({
tier: v4_1.z.int().min(1).max(10),
type: v4_1.z.literal('HEART_OF_THE_MOUNTAIN'),
}),
]);
exports.actionSchema = v4_1.z.strictObject({
inputs: v4_1.z.array(exports.actionIoSchema),
outputs: v4_1.z.array(exports.actionIoSchema),
place: v4_1.z.array(exports.actionPlaceSchema),
requirements: v4_1.z.array(exports.actionRequirementSchema).optional(),
});
exports.actionDefinitionSchema = v4_1.z.strictObject({
$schema: v4_1.z.string().optional(),
actions: v4_1.z.array(exports.actionSchema),
});