From 40aa42da4960b5bbfd11f1e145a9c45abb0bb717 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 3 Jul 2022 15:01:29 +0100 Subject: [PATCH] Update example 2 to use new entrypoint --- TypeScript/2EditDatabase/src/mod.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/TypeScript/2EditDatabase/src/mod.ts b/TypeScript/2EditDatabase/src/mod.ts index 0aa7079..40fdaa7 100644 --- a/TypeScript/2EditDatabase/src/mod.ts +++ b/TypeScript/2EditDatabase/src/mod.ts @@ -1,26 +1,23 @@ import { DependencyContainer } from "tsyringe"; import { IMod } from "@spt-aki/models/external/mod"; +import { IAfterDBLoadMod } from "@spt-aki/models/external/IAfterDBLoadMod"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; -class Mod implements IMod +class Mod implements IMod, IAfterDBLoadMod { - // not used for this example - public load(container: DependencyContainer): void - { return } - - public delayedLoad(container: DependencyContainer): void - { + public loadAfterDbInit(container: DependencyContainer): void + { // get database from server const databaseServer = container.resolve("DatabaseServer"); // Get all the in-memory json found in /assets/database const tables = databaseServer.getTables(); - // find the ledx item by its Id + // Find the ledx item by its Id const ledx = tables.templates.items["5c0530ee86f774697952d952"]; - // update one of its properties to be true + // Update one of its properties to be true ledx._props.CanSellOnRagfair = true; @@ -28,6 +25,14 @@ class Mod implements IMod // get globals settings and set flea market min level to be 1 tables.globals.config.RagFair.minUserLevel = 1; } + + // not used for this example + public load(container: DependencyContainer): void + { return } + + // not used for this example + public delayedLoad(container: DependencyContainer): void + { return } } module.exports = { mod: new Mod() } \ No newline at end of file