Skip to content

Commit

Permalink
feature(actions): Initial Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianWendelborn committed May 9, 2024
1 parent 9e788e3 commit 8477331
Show file tree
Hide file tree
Showing 7 changed files with 255 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This repo contains the opensource parts of <https://skyblock.finance>

| 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
Expand Down
3 changes: 3 additions & 0 deletions packages/actions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @skyblock-finance/actions

This package contains actions players can take in Hypixel Skyblock
131 changes: 131 additions & 0 deletions packages/actions/data/$schema.json
Original file line number Diff line number Diff line change
@@ -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"
}
60 changes: 60 additions & 0 deletions packages/actions/data/actions.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
]
}
42 changes: 42 additions & 0 deletions packages/actions/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
13 changes: 13 additions & 0 deletions packages/actions/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"]
}
5 changes: 5 additions & 0 deletions packages/actions/turbo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://turbo.build/schema.json",
"extends": ["//"],
"pipeline": {}
}

0 comments on commit 8477331

Please sign in to comment.