This project provides a C# Polyglot Notebook (.dib) for converting raw Eco game recipe JSON data into TypeScript files compatible with the EcoCraftingTool (EcoCalc) web application.
It automates data synchronization between a running Eco server (via API or local JSON export) and the EcoCalc project’s TypeScript data models.
EcoCalc uses TypeScript source files (recipes.ts, items.ts, skills.ts, crafting-tables.ts, etc.) to represent all game data.
This notebook reads the original Eco recipes JSON, either from the server's API, and generates updated .ts files that EcoCalc can immediately use.
- Fetch live data directly from an Eco server API (
/api/v1/plugins/EcoPriceCalculator/recipes) - Deserialize and cleanse the JSON for compatibility with EcoCalc structures
- Automatically split multi-skill crafting tables into profession-specific versions
(e.g.Sawmill→Sawmill (Carpentry)andSawmill (Logging)) - Generate new TypeScript source files for:
- Recipes
- Items
- Skills
- Crafting Tables
- Preserve backups of original
.tsfiles with timestamps - Automatic cleanup of old backups and temporary output directories
- Toggleable logic via flags (e.g.,
GenerateCraftingTableBySkill = true)
- Load the JSON data
Directly from the API endpoint. - Deserialize into structured objects
Converts JSON into strongly typed C# classes likeRecipeCollection,EcoCalcItem, etc. - Optionally process recipes
If enabled, splits crafting tables by profession. - Convert to TypeScript
Uses methods likeConvertToTypeScriptRecipes,ConvertToTypeScriptItems, etc. - Write and back up
Generates.tsfiles insideCustomRecipes/and replaces the originals in the EcoCalc project.
Backs up the originals as_YYYYMMDD_HHmmss.ts.
- VS Code with the Polyglot Notebooks extension
- .NET 6.0 or newer
- Newtonsoft.Json and System.Text.Json (handled via
#r "nuget: ...")
| TypeScript File | Description |
|---|---|
recipes.ts |
Full list of all crafting recipes |
items.ts |
Item definitions used across recipes |
skills.ts |
Skill definitions and metadata |
crafting-tables.ts |
Crafting table definitions, including profession-specific variants |
All generated files are backed up automatically as:
recipes_20250306_182719.ts
| Variable | Description | Default |
|---|---|---|
GenerateCraftingTableBySkill |
Split shared crafting tables by skill | true |
basePath |
Path to EcoCalc /src/assets/data/ directory |
(set manually in notebook) |
- Open
ConvertEcojsonToEcoCalcTs.dibin VS Code. - Set your paths and flags (top of the notebook).
- Run the notebook:
- Fetches data
- Cleans it
- Converts to
.ts - Backs up originals
- Review generated files in
CustomRecipes/or directly in your EcoCalc repo.
getCraftingTableByNameID('SawmillObject')
```6
### After
```ts
getCraftingTableByNameID('SawmillCarpentryObject')
getCraftingTableByNameID('SawmillLoggingObject')This ensures profession-specific upgrades and specialization mechanics work correctly in EcoCalc.
Each time the notebook runs:
- Original files are backed up with timestamps
- Previous backups are automatically pruned
CustomRecipes/output directory is cleaned before regeneration
EcoCalc (also known as Eco Crafting Calculator) is an open-source web tool designed to help Eco players and server administrators manage recipes, materials, and crafting workflows.
This notebook was created to extend EcoCalc’s data generation pipeline, allowing users to:
- Pull live recipe data from Eco servers
- Automatically generate profession-split crafting tables
- Keep EcoCalc’s TypeScript data (
recipes.ts,items.ts, etc.) up-to-date with the latest Eco content
Mr Jobber Man - greenleafcalc.co.uk
For inspiring this automation workflow and integrating it into the Greenleaf Eco Server Tools project.
His Greenleaf calculator uses the data generated by this notebook to power real-time custom recipe calculations and visualizations.
- EcoCalc / EcoCraftingTool by aritchie05 - the base project this converter integrates with
- Mr Jobber Man - for practical implementation and testing
- Alin Boros - creator of this notebook and conversion logic