Update example 2 to use new entrypoint
This commit is contained in:
parent
8b2547dc51
commit
40aa42da49
@ -1,15 +1,12 @@
|
|||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { IMod } from "@spt-aki/models/external/mod";
|
import { IMod } from "@spt-aki/models/external/mod";
|
||||||
|
import { IAfterDBLoadMod } from "@spt-aki/models/external/IAfterDBLoadMod";
|
||||||
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||||
|
|
||||||
class Mod implements IMod
|
class Mod implements IMod, IAfterDBLoadMod
|
||||||
{
|
{
|
||||||
// not used for this example
|
public loadAfterDbInit(container: DependencyContainer): void
|
||||||
public load(container: DependencyContainer): void
|
|
||||||
{ return }
|
|
||||||
|
|
||||||
public delayedLoad(container: DependencyContainer): void
|
|
||||||
{
|
{
|
||||||
// get database from server
|
// get database from server
|
||||||
const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
|
const databaseServer = container.resolve<DatabaseServer>("DatabaseServer");
|
||||||
@ -17,10 +14,10 @@ class Mod implements IMod
|
|||||||
// Get all the in-memory json found in /assets/database
|
// Get all the in-memory json found in /assets/database
|
||||||
const tables = databaseServer.getTables();
|
const tables = databaseServer.getTables();
|
||||||
|
|
||||||
// find the ledx item by its Id
|
// Find the ledx item by its Id
|
||||||
const ledx = tables.templates.items["5c0530ee86f774697952d952"];
|
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;
|
ledx._props.CanSellOnRagfair = true;
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +25,14 @@ class Mod implements IMod
|
|||||||
// get globals settings and set flea market min level to be 1
|
// get globals settings and set flea market min level to be 1
|
||||||
tables.globals.config.RagFair.minUserLevel = 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() }
|
module.exports = { mod: new Mod() }
|
Loading…
x
Reference in New Issue
Block a user