diff --git a/README.md b/README.md index 9ab2dde..2f34e93 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ This repo contains the opensource parts of | Name | What does this do? | Getting Started | | --------------------------: | :------------------------------------------- | :--------------------------------- | +| `@skyblock-finance/actions` | Recipes, etc. | [README](/packages/actions#readme) | | `@skyblock-finance/schemas` | Strong validation for Skyblock API responses | [README](/packages/schemas#readme) | ## Contributing diff --git a/packages/actions/README.md b/packages/actions/README.md new file mode 100644 index 0000000..a514309 --- /dev/null +++ b/packages/actions/README.md @@ -0,0 +1,3 @@ +# @skyblock-finance/actions + +This package contains actions players can take in Hypixel Skyblock diff --git a/packages/actions/data/$schema.json b/packages/actions/data/$schema.json new file mode 100644 index 0000000..8f5ed34 --- /dev/null +++ b/packages/actions/data/$schema.json @@ -0,0 +1,131 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema", + "additionalProperties": false, + "definitions": { + "currencyAction": { + "additionalProperties": false, + "properties": { + "amount": { + "type": "number" + }, + "type": { + "enum": ["bit", "coin", "mote", "north-star"], + "type": "string" + } + }, + "required": ["amount", "type"] + }, + "itemAction": { + "additionalProperties": false, + "properties": { + "amount": { + "type": "number" + }, + "id": { + "type": "string" + }, + "type": { + "const": "item" + } + }, + "required": ["id", "amount", "type"], + "type": "object" + } + }, + "properties": { + "$schema": { + "type": "string" + }, + "actions": { + "items": { + "additionalProperties": false, + "properties": { + "inputs": { + "items": { + "oneOf": [ + { "$ref": "#/definitions/currencyAction" }, + { "$ref": "#/definitions/itemAction" } + ], + "type": "object" + }, + "type": "array" + }, + "outputs": { + "items": { + "oneOf": [ + { "$ref": "#/definitions/currencyAction" }, + { "$ref": "#/definitions/itemAction" } + ], + "type": "object" + }, + "type": "array" + }, + "place": { + "items": { + "oneOf": [ + { + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "type": { + "const": "item" + } + }, + "required": ["id", "type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "grid": { + "items": { + "maxLength": 9, + "minLength": 9, + "oneOf": [ + { "$ref": "#/definitions/itemAction" }, + { "type": "null" } + ] + }, + "type": "array" + }, + "type": { + "const": "workbench" + } + }, + "required": ["type"], + "type": "object" + }, + { + "additionalProperties": false, + "properties": { + "id": { + "type": "string" + }, + "type": { + "const": "npc" + } + }, + "required": ["id", "type"], + "type": "object" + } + ], + "type": "object" + }, + "type": "array" + }, + "requirements": { + "items": {}, + "type": "array" + } + }, + "required": ["inputs", "outputs", "place"], + "type": "object" + }, + "type": "array" + } + }, + "required": ["actions"], + "type": "object" +} diff --git a/packages/actions/data/actions.json b/packages/actions/data/actions.json new file mode 100644 index 0000000..f85633a --- /dev/null +++ b/packages/actions/data/actions.json @@ -0,0 +1,60 @@ +{ + "$schema": "./$schema.json", + "actions": [ + { + "inputs": [ + { "amount": 16, "id": "ENCHANTED_COAL", "type": "item" }, + { "amount": 1, "id": "ENCHANTED_SULPHUR", "type": "item" } + ], + "outputs": [{ "amount": 4, "id": "SULPHURIC_COAL", "type": "item" }], + "place": [ + { + "grid": [ + null, + { "amount": 4, "id": "COAL", "type": "item" }, + null, + { "amount": 4, "id": "COAL", "type": "item" }, + { "amount": 1, "id": "ENCHANTED_SULPHUR", "type": "item" }, + { "amount": 4, "id": "COAL", "type": "item" }, + null, + { "amount": 4, "id": "COAL", "type": "item" }, + null + ], + "type": "workbench" + } + ], + "requirements": [] + }, + { + "inputs": [ + { "amount": 16, "id": "ENCHANTED_COAL", "type": "item" }, + { "amount": 4, "id": "CHILI_PEPPER", "type": "item" }, + { "amount": 1, "id": "ENCHANTED_SULPHUR", "type": "item" } + ], + "outputs": [{ "amount": 12, "id": "SULPHURIC_COAL", "type": "item" }], + "place": [ + { + "grid": [ + { "amount": 1, "id": "CHILI_PEPPER", "type": "item" }, + { "amount": 4, "id": "COAL", "type": "item" }, + { "amount": 1, "id": "CHILI_PEPPER", "type": "item" }, + { "amount": 4, "id": "COAL", "type": "item" }, + { "amount": 1, "id": "ENCHANTED_SULPHUR", "type": "item" }, + { "amount": 4, "id": "COAL", "type": "item" }, + { "amount": 1, "id": "CHILI_PEPPER", "type": "item" }, + { "amount": 4, "id": "COAL", "type": "item" }, + { "amount": 1, "id": "CHILI_PEPPER", "type": "item" } + ], + "type": "workbench" + } + ], + "requirements": [ + { + "collection": "CHILI_PEPPER", + "tier": 2, + "type": "COLLECTION" + } + ] + } + ] +} diff --git a/packages/actions/package.json b/packages/actions/package.json new file mode 100644 index 0000000..73c017d --- /dev/null +++ b/packages/actions/package.json @@ -0,0 +1,42 @@ +{ + "bugs": { + "url": "https://github.com/skyblock-finance/skyblock-finance-opensource/issues" + }, + "dependencies": {}, + "devDependencies": { + "@types/bun": "latest" + }, + "files": [ + "dist", + "source" + ], + "keywords": [ + "hypixel-skyblock", + "hypixel", + "skyblock-finance" + ], + "license": "MIT", + "main": "dist/index.js", + "name": "@skyblock-finance/actions", + "peerDependencies": { + "typescript": ">= 4" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/skyblock-finance/skyblock-finance-opensource" + }, + "scripts": { + "build": "rm -rf dist && tsc --build", + "check:arethetypeswrong": "bun run attw --pack .", + "check:eslint": "bun run eslint --max-warnings=0 .", + "check:prettier": "bun --bun run --cwd ../.. prettier --check packages/actions", + "check:publint": "bun --bun run publint", + "fix:eslint": "bun run check:eslint --fix", + "fix:prettier": "bun --bun run check:prettier --write", + "publish-package": "npm publish --access public --provenance" + }, + "sideEffects": false, + "type": "commonjs", + "types": "dist/index.d.ts", + "version": "0.0.1" +} diff --git a/packages/actions/tsconfig.json b/packages/actions/tsconfig.json new file mode 100644 index 0000000..aef7945 --- /dev/null +++ b/packages/actions/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "Node", + "outDir": "./dist", + "rootDir": "./source", + "tsBuildInfoFile": "./dist/.tsbuildinfo", + "types": ["bun"] + }, + "exclude": ["source/**/*.test.ts"], + "extends": "../../tsconfig.json", + "include": ["source/**/*.ts"] +}