Update example 2 to use new entrypoint

This commit is contained in:
Chomp 2022-07-03 15:01:29 +01:00
parent 8b2547dc51
commit 40aa42da49

View File

@ -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>("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() }