forked from Bitcoindefi/OpenAO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloadCraftingRecipes.ts
More file actions
27 lines (22 loc) · 861 Bytes
/
Copy pathloadCraftingRecipes.ts
File metadata and controls
27 lines (22 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
export {};
const vars = require("./vars");
const { loadDefaultCraftingRecipesData } = require("./craftingRecipeData");
const { initializeCraftingRecipesFromApi } = require("./gameDataSync");
class LoadCraftingRecipes {
async initialize() {
await this.load();
console.log("Recetas de crafting cargadas.");
}
async load() {
vars.craftingRecipes = loadDefaultCraftingRecipesData();
try {
const result = await initializeCraftingRecipesFromApi();
console.log(
`[GAME DATA] Crafting hidratado desde DB: ${result.loadedRecipes}. Version aplicada: ${result.currentVersion}.`,
);
} catch {
console.warn("[GAME DATA] No se pudo hidratar crafting desde API al iniciar. Se usan datos locales.");
}
}
}
module.exports = LoadCraftingRecipes;