Refactor item property parsing and centralize utility functions
- Moved `parseItemProps` function to `core/utils.ts` for reuse across modules. - Updated various services to import and utilize the centralized `parseItemProps`. - Introduced new utility functions for handling consumable cooldowns and healing calculations. - Enhanced mob management with a new repository system, allowing for dynamic loading and validation of mob definitions from the database. - Added admin functions for creating, updating, listing, and deleting mobs, with validation using Zod. - Implemented tests for mob management functionalities. - Improved error handling and logging throughout the mob and consumable services.
This commit is contained in:
@@ -212,6 +212,15 @@ async function bootstrap() {
|
||||
logger.error({ err: e }, "Error cargando eventos");
|
||||
}
|
||||
|
||||
// Inicializar repositorio de mobs (intenta cargar mobs desde DB si existe)
|
||||
try {
|
||||
// import dinamico para evitar ciclos en startup
|
||||
const { initializeMobRepository } = await import("./game/mobs/mobData.js");
|
||||
await initializeMobRepository();
|
||||
} catch (e) {
|
||||
logger.warn({ err: e }, "No se pudo inicializar el repositorio de mobs");
|
||||
}
|
||||
|
||||
// Registrar comandos en segundo plano con reintentos; no bloquea el arranque del bot
|
||||
withRetry("Registrar slash commands", async () => {
|
||||
await registeringCommands();
|
||||
|
||||
Reference in New Issue
Block a user