3.9.0-DEV #29
@ -8,4 +8,4 @@ Dive into a specific mod folder and follow the instructions in the `README.md` f
|
|||||||
|
|
||||||
# Mod Upgrade Guide
|
# Mod Upgrade Guide
|
||||||
|
|
||||||
Read [Here](https://hub.sp-tarkov.com/doc/entry/51-modding-in-2-4-0/)
|
Read [Here](https://hub.sp-tarkov.com/doc/entry/51-modding-in-spt-3-x-x/)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ScopesAndTypes",
|
"name": "ScopesAndTypes",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Chomp",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Chomp",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { inject, injectable } from "tsyringe";
|
import { inject, injectable } from "tsyringe";
|
||||||
|
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
import { Processing } from "./Processing";
|
import { Processing } from "./Processing";
|
||||||
|
|
||||||
@ -11,7 +12,7 @@ export class MyMod
|
|||||||
// All these types are automatically wired when the container resolves the bean creation
|
// All these types are automatically wired when the container resolves the bean creation
|
||||||
constructor(
|
constructor(
|
||||||
@inject("Processing") private processing: Processing,
|
@inject("Processing") private processing: Processing,
|
||||||
@inject("WinstonLogger") private logger: ILogger
|
@inject("WinstonLogger") private logger: ILogger,
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { inject, injectable } from "tsyringe";
|
import { inject, injectable } from "tsyringe";
|
||||||
|
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
@ -9,7 +10,7 @@ export class Processing
|
|||||||
private calls = 0;
|
private calls = 0;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@inject("WinstonLogger") private logger: ILogger
|
@inject("WinstonLogger") private logger: ILogger,
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { DependencyContainer, Lifecycle } from "tsyringe";
|
import { DependencyContainer, Lifecycle } from "tsyringe";
|
||||||
|
|
||||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||||
import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
|
import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
|
||||||
import { MyMod } from "./MyMod";
|
import { MyMod } from "./MyMod";
|
||||||
@ -29,4 +30,4 @@ class Mod implements IPreAkiLoadMod, IPostAkiLoadMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() }
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,15 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "BundleLoading",
|
"name": "BundleLoading",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"author": "Chomp",
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "src/mod.js",
|
|
||||||
"isBundleMod": true,
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": true,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -23,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Chomp",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
|
import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
|
|
||||||
@ -13,4 +14,4 @@ class Mod implements IPostAkiLoadMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() }
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ClassExtensionOverride",
|
"name": "ClassExtensionOverride",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Chomp",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Chomp",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { inject, injectable } from "tsyringe";
|
||||||
|
|
||||||
import { LauncherCallbacks } from "@spt-aki/callbacks/LauncherCallbacks";
|
import { LauncherCallbacks } from "@spt-aki/callbacks/LauncherCallbacks";
|
||||||
import { LauncherController } from "@spt-aki/controllers/LauncherController";
|
import { LauncherController } from "@spt-aki/controllers/LauncherController";
|
||||||
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
|
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
|
||||||
@ -5,7 +7,6 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
|||||||
import { SaveServer } from "@spt-aki/servers/SaveServer";
|
import { SaveServer } from "@spt-aki/servers/SaveServer";
|
||||||
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||||
import { Watermark } from "@spt-aki/utils/Watermark";
|
import { Watermark } from "@spt-aki/utils/Watermark";
|
||||||
import { inject, injectable } from "tsyringe";
|
|
||||||
|
|
||||||
// We need to declare this class as injectable, this will add the container
|
// We need to declare this class as injectable, this will add the container
|
||||||
// metadata
|
// metadata
|
||||||
@ -20,7 +21,7 @@ export class MyCustomLauncherCallbacks extends LauncherCallbacks // <<<<=== This
|
|||||||
@inject("LauncherController") launcherController: LauncherController,
|
@inject("LauncherController") launcherController: LauncherController,
|
||||||
@inject("SaveServer") saveServer: SaveServer,
|
@inject("SaveServer") saveServer: SaveServer,
|
||||||
@inject("Watermark") watermark: Watermark,
|
@inject("Watermark") watermark: Watermark,
|
||||||
@inject("WinstonLogger") private logger: ILogger
|
@inject("WinstonLogger") private logger: ILogger,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// Pass the parent class (LauncherCallbacks) the dependencies it needs to work
|
// Pass the parent class (LauncherCallbacks) the dependencies it needs to work
|
||||||
@ -39,5 +40,4 @@ export class MyCustomLauncherCallbacks extends LauncherCallbacks // <<<<=== This
|
|||||||
this.logger.success("Our custom method is dancing baby!");
|
this.logger.success("Our custom method is dancing baby!");
|
||||||
return "Lets dance";
|
return "Lets dance";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod"
|
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod"
|
||||||
import { MyCustomLauncherCallbacks } from "./MyCustomLauncherCallbacks";
|
import { MyCustomLauncherCallbacks } from "./MyCustomLauncherCallbacks";
|
||||||
|
|
||||||
@ -18,15 +19,14 @@ class Mod implements IPreAkiLoadMod
|
|||||||
// https://dev.sp-tarkov.com/SPT-AKI/Server/src/branch/development/project/src/di/Container.ts
|
// https://dev.sp-tarkov.com/SPT-AKI/Server/src/branch/development/project/src/di/Container.ts
|
||||||
// In this scenario we want to override LauncherCallbacks, so we find the proper registry:
|
// In this scenario we want to override LauncherCallbacks, so we find the proper registry:
|
||||||
//
|
//
|
||||||
// depContainer.register<LauncherCallbacks>("LauncherCallbacks", {useClass: LauncherCallbacks});
|
// depContainer.register<LauncherCallbacks>("LauncherCallbacks", { useClass: LauncherCallbacks });
|
||||||
//
|
//
|
||||||
// So what we want to do is register it with EXACTLY the same token
|
// So what we want to do is register it with EXACTLY the same token
|
||||||
container.register<MyCustomLauncherCallbacks>("MyCustomLauncherCallbacks", MyCustomLauncherCallbacks);
|
container.register<MyCustomLauncherCallbacks>("MyCustomLauncherCallbacks", MyCustomLauncherCallbacks);
|
||||||
container.register("LauncherCallbacks", {useToken: "MyCustomLauncherCallbacks"});
|
container.register("LauncherCallbacks", { useToken: "MyCustomLauncherCallbacks" });
|
||||||
|
|
||||||
// Now that its registered, the server will automatically find this dependency and use it where ever its needed
|
// Now that its registered, the server will automatically find this dependency and use it where ever its needed
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() }
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "13AddTrader",
|
"name": "13AddTrader",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Shirito",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Shirito",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -23,18 +23,18 @@ export class FluentAssortConstructor
|
|||||||
* @param itemTpl Tpl id of the item you want trader to sell
|
* @param itemTpl Tpl id of the item you want trader to sell
|
||||||
* @param itemId Optional - set your own Id, otherwise unique id will be generated
|
* @param itemId Optional - set your own Id, otherwise unique id will be generated
|
||||||
*/
|
*/
|
||||||
public createSingleAssortItem(itemTpl: string, itemId = undefined): FluentAssortConstructor
|
public createSingleAssortItem(itemTpl: string, itemId: string = undefined): FluentAssortConstructor
|
||||||
{
|
{
|
||||||
// Create item ready for insertion into assort table
|
// Create item ready for insertion into assort table
|
||||||
const newItemToAdd: Item = {
|
const newItemToAdd: Item = {
|
||||||
_id: !itemId ? this.hashUtil.generate(): itemId,
|
_id: itemId ?? this.hashUtil.generate(),
|
||||||
_tpl: itemTpl,
|
_tpl: itemTpl,
|
||||||
parentId: "hideout", // Should always be "hideout"
|
parentId: "hideout", // Should always be "hideout"
|
||||||
slotId: "hideout", // Should always be "hideout"
|
slotId: "hideout", // Should always be "hideout"
|
||||||
upd: {
|
upd: {
|
||||||
UnlimitedCount: false,
|
UnlimitedCount: false,
|
||||||
StackObjectsCount: 100
|
StackObjectsCount: 100,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
this.itemsToSell.push(newItemToAdd);
|
this.itemsToSell.push(newItemToAdd);
|
||||||
@ -47,10 +47,7 @@ export class FluentAssortConstructor
|
|||||||
items[0].parentId = "hideout";
|
items[0].parentId = "hideout";
|
||||||
items[0].slotId = "hideout";
|
items[0].slotId = "hideout";
|
||||||
|
|
||||||
if (!items[0].upd)
|
items[0].upd ??= {};
|
||||||
{
|
|
||||||
items[0].upd = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
items[0].upd.UnlimitedCount = false;
|
items[0].upd.UnlimitedCount = false;
|
||||||
items[0].upd.StackObjectsCount = 100;
|
items[0].upd.StackObjectsCount = 100;
|
||||||
@ -99,14 +96,12 @@ export class FluentAssortConstructor
|
|||||||
|
|
||||||
public addMoneyCost(currencyType: Money, amount: number): FluentAssortConstructor
|
public addMoneyCost(currencyType: Money, amount: number): FluentAssortConstructor
|
||||||
{
|
{
|
||||||
this.barterScheme[this.itemsToSell[0]._id] = [
|
this.barterScheme[this.itemsToSell[0]._id] = [[
|
||||||
[
|
|
||||||
{
|
{
|
||||||
count: amount,
|
count: amount,
|
||||||
_tpl: currencyType
|
_tpl: currencyType,
|
||||||
}
|
},
|
||||||
]
|
]];
|
||||||
];
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -121,8 +116,8 @@ export class FluentAssortConstructor
|
|||||||
this.barterScheme[sellableItemId] = [[
|
this.barterScheme[sellableItemId] = [[
|
||||||
{
|
{
|
||||||
count: count,
|
count: count,
|
||||||
_tpl: itemTpl
|
_tpl: itemTpl,
|
||||||
}
|
},
|
||||||
]];
|
]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -139,10 +134,9 @@ export class FluentAssortConstructor
|
|||||||
// No barter for item, add it fresh
|
// No barter for item, add it fresh
|
||||||
this.barterScheme[sellableItemId][0].push({
|
this.barterScheme[sellableItemId][0].push({
|
||||||
count: count,
|
count: count,
|
||||||
_tpl: itemTpl
|
_tpl: itemTpl,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
|
@ -12,21 +12,22 @@ import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
|||||||
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
|
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
|
||||||
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
|
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
|
||||||
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
|
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
|
||||||
|
|
||||||
// New trader settings
|
|
||||||
import * as baseJson from "../db/base.json";
|
|
||||||
import { TraderHelper } from "./traderHelpers";
|
|
||||||
import { FluentAssortConstructor as FluentAssortCreator } from "./fluentTraderAssortCreator";
|
|
||||||
import { Money } from "@spt-aki/models/enums/Money";
|
import { Money } from "@spt-aki/models/enums/Money";
|
||||||
import { Traders } from "@spt-aki/models/enums/Traders";
|
import { Traders } from "@spt-aki/models/enums/Traders";
|
||||||
import { HashUtil } from "@spt-aki/utils/HashUtil";
|
import { HashUtil } from "@spt-aki/utils/HashUtil";
|
||||||
|
|
||||||
|
// New trader settings
|
||||||
|
import * as baseJson from "../db/base.json";
|
||||||
|
|
||||||
|
import { TraderHelper } from "./traderHelpers";
|
||||||
|
import { FluentAssortConstructor as FluentAssortCreator } from "./fluentTraderAssortCreator";
|
||||||
|
|
||||||
class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod
|
class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod
|
||||||
{
|
{
|
||||||
private mod: string
|
private mod: string;
|
||||||
private logger: ILogger
|
private logger: ILogger;
|
||||||
private traderHelper: TraderHelper
|
private traderHelper: TraderHelper;
|
||||||
private fluentAssortCreator: FluentAssortCreator
|
private fluentAssortCreator: FluentAssortCreator;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.mod = "13AddTrader"; // Set name of mod so we can log it to console later
|
this.mod = "13AddTrader"; // Set name of mod so we can log it to console later
|
||||||
@ -86,7 +87,8 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod
|
|||||||
|
|
||||||
// Add milk
|
// Add milk
|
||||||
const MILK_ID = "575146b724597720a27126d5"; // Can find item ids in `database\templates\items.json` or with https://db.sp-tarkov.com/search
|
const MILK_ID = "575146b724597720a27126d5"; // Can find item ids in `database\templates\items.json` or with https://db.sp-tarkov.com/search
|
||||||
this.fluentAssortCreator.createSingleAssortItem(MILK_ID)
|
this.fluentAssortCreator
|
||||||
|
.createSingleAssortItem(MILK_ID)
|
||||||
.addStackCount(200)
|
.addStackCount(200)
|
||||||
.addBuyRestriction(10)
|
.addBuyRestriction(10)
|
||||||
.addMoneyCost(Money.ROUBLES, 2000)
|
.addMoneyCost(Money.ROUBLES, 2000)
|
||||||
@ -94,9 +96,10 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod
|
|||||||
.export(tables.traders[baseJson._id]);
|
.export(tables.traders[baseJson._id]);
|
||||||
|
|
||||||
// Add 3x bitcoin + salewa for milk barter
|
// Add 3x bitcoin + salewa for milk barter
|
||||||
const BITCOIN_ID = "59faff1d86f7746c51718c9c"
|
const BITCOIN_ID = "59faff1d86f7746c51718c9c";
|
||||||
const SALEWA_ID = "544fb45d4bdc2dee738b4568";
|
const SALEWA_ID = "544fb45d4bdc2dee738b4568";
|
||||||
this.fluentAssortCreator.createSingleAssortItem(MILK_ID)
|
this.fluentAssortCreator
|
||||||
|
.createSingleAssortItem(MILK_ID)
|
||||||
.addStackCount(100)
|
.addStackCount(100)
|
||||||
.addBarterCost(BITCOIN_ID, 3)
|
.addBarterCost(BITCOIN_ID, 3)
|
||||||
.addBarterCost(SALEWA_ID, 1)
|
.addBarterCost(SALEWA_ID, 1)
|
||||||
@ -105,7 +108,8 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod
|
|||||||
|
|
||||||
|
|
||||||
// Add glock as money purchase
|
// Add glock as money purchase
|
||||||
this.fluentAssortCreator.createComplexAssortItem(this.traderHelper.createGlock())
|
this.fluentAssortCreator
|
||||||
|
.createComplexAssortItem(this.traderHelper.createGlock())
|
||||||
.addUnlimitedStackCount()
|
.addUnlimitedStackCount()
|
||||||
.addMoneyCost(Money.ROUBLES, 20000)
|
.addMoneyCost(Money.ROUBLES, 20000)
|
||||||
.addBuyRestriction(3)
|
.addBuyRestriction(3)
|
||||||
@ -113,7 +117,8 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod
|
|||||||
.export(tables.traders[baseJson._id]);
|
.export(tables.traders[baseJson._id]);
|
||||||
|
|
||||||
// Add mp133 preset as mayo barter
|
// Add mp133 preset as mayo barter
|
||||||
this.fluentAssortCreator.createComplexAssortItem(tables.globals.ItemPresets["584148f2245977598f1ad387"]._items)
|
this.fluentAssortCreator
|
||||||
|
.createComplexAssortItem(tables.globals.ItemPresets["584148f2245977598f1ad387"]._items)
|
||||||
.addStackCount(200)
|
.addStackCount(200)
|
||||||
.addBarterCost("5bc9b156d4351e00367fbce9", 1)
|
.addBarterCost("5bc9b156d4351e00367fbce9", 1)
|
||||||
.addBuyRestriction(3)
|
.addBuyRestriction(3)
|
||||||
@ -128,4 +133,4 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new SampleTrader() }
|
export const mod = new SampleTrader();
|
||||||
|
@ -11,6 +11,7 @@ export class TraderHelper
|
|||||||
/**
|
/**
|
||||||
* Add profile picture to our trader
|
* Add profile picture to our trader
|
||||||
* @param baseJson json file for trader (db/base.json)
|
* @param baseJson json file for trader (db/base.json)
|
||||||
|
* @param modName mod folder name
|
||||||
* @param preAkiModLoader mod loader class - used to get the mods file path
|
* @param preAkiModLoader mod loader class - used to get the mods file path
|
||||||
* @param imageRouter image router class - used to register the trader image path so we see their image on trader page
|
* @param imageRouter image router class - used to register the trader image path so we see their image on trader page
|
||||||
* @param traderImageName Filename of the trader icon to use
|
* @param traderImageName Filename of the trader icon to use
|
||||||
@ -38,8 +39,9 @@ export class TraderHelper
|
|||||||
traderId: baseJson._id,
|
traderId: baseJson._id,
|
||||||
seconds: {
|
seconds: {
|
||||||
min: refreshTimeSecondsMin,
|
min: refreshTimeSecondsMin,
|
||||||
max: refreshTimeSecondsMax
|
max: refreshTimeSecondsMax,
|
||||||
} };
|
},
|
||||||
|
};
|
||||||
|
|
||||||
traderConfig.updateTime.push(traderRefreshRecord);
|
traderConfig.updateTime.push(traderRefreshRecord);
|
||||||
}
|
}
|
||||||
@ -60,15 +62,13 @@ export class TraderHelper
|
|||||||
questassort: {
|
questassort: {
|
||||||
started: {},
|
started: {},
|
||||||
success: {},
|
success: {},
|
||||||
fail: {}
|
fail: {},
|
||||||
} // questassort is empty as trader has no assorts unlocked by quests
|
}, // questassort is empty as trader has no assorts unlocked by quests
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create basic data for trader + add empty assorts table for trader
|
* Create basic data for trader + add empty assorts table for trader
|
||||||
* @param tables SPT db
|
|
||||||
* @param jsonUtil SPT JSON utility class
|
|
||||||
* @returns ITraderAssort
|
* @returns ITraderAssort
|
||||||
*/
|
*/
|
||||||
private createAssortTable(): ITraderAssort
|
private createAssortTable(): ITraderAssort
|
||||||
@ -78,8 +78,8 @@ export class TraderHelper
|
|||||||
nextResupply: 0,
|
nextResupply: 0,
|
||||||
items: [],
|
items: [],
|
||||||
barter_scheme: {},
|
barter_scheme: {},
|
||||||
loyal_level_items: {}
|
loyal_level_items: {},
|
||||||
}
|
};
|
||||||
|
|
||||||
return assortTable;
|
return assortTable;
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ export class TraderHelper
|
|||||||
// Add the base first
|
// Add the base first
|
||||||
glock.push({ // Add the base weapon first
|
glock.push({ // Add the base weapon first
|
||||||
_id: "glockBase", // Ids dont matter, as long as they are unique (can use hashUtil.generate() if you dont want to type every id by hand)
|
_id: "glockBase", // Ids dont matter, as long as they are unique (can use hashUtil.generate() if you dont want to type every id by hand)
|
||||||
_tpl: "5a7ae0c351dfba0017554310" // This is the weapons tpl, found on: https://db.sp-tarkov.com/search
|
_tpl: "5a7ae0c351dfba0017554310", // This is the weapons tpl, found on: https://db.sp-tarkov.com/search
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add barrel
|
// Add barrel
|
||||||
@ -104,7 +104,7 @@ export class TraderHelper
|
|||||||
_id: "glockbarrel",
|
_id: "glockbarrel",
|
||||||
_tpl: "5a6b60158dc32e000a31138b",
|
_tpl: "5a6b60158dc32e000a31138b",
|
||||||
parentId: "glockBase", // This is a sub item, you need to define its parent its attached to / inserted into
|
parentId: "glockBase", // This is a sub item, you need to define its parent its attached to / inserted into
|
||||||
slotId: "mod_barrel" // Required for mods, you need to define what 'role' they have
|
slotId: "mod_barrel", // Required for mods, you need to define what 'role' they have
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add reciever
|
// Add reciever
|
||||||
@ -112,7 +112,7 @@ export class TraderHelper
|
|||||||
_id: "glockReciever",
|
_id: "glockReciever",
|
||||||
_tpl:"5a9685b1a2750c0032157104",
|
_tpl:"5a9685b1a2750c0032157104",
|
||||||
parentId: "glockBase",
|
parentId: "glockBase",
|
||||||
slotId: "mod_reciever"
|
slotId: "mod_reciever",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add compensator
|
// Add compensator
|
||||||
@ -120,7 +120,7 @@ export class TraderHelper
|
|||||||
_id: "glockCompensator",
|
_id: "glockCompensator",
|
||||||
_tpl:"5a7b32a2e899ef00135e345a",
|
_tpl:"5a7b32a2e899ef00135e345a",
|
||||||
parentId: "glockReciever", // The parent of this mod is the reciever NOT weapon, be careful to get the correct parent
|
parentId: "glockReciever", // The parent of this mod is the reciever NOT weapon, be careful to get the correct parent
|
||||||
slotId: "mod_muzzle"
|
slotId: "mod_muzzle",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add Pistol grip
|
// Add Pistol grip
|
||||||
@ -128,7 +128,7 @@ export class TraderHelper
|
|||||||
_id: "glockPistolGrip",
|
_id: "glockPistolGrip",
|
||||||
_tpl:"5a7b4960e899ef197b331a2d",
|
_tpl:"5a7b4960e899ef197b331a2d",
|
||||||
parentId: "glockBase",
|
parentId: "glockBase",
|
||||||
slotId: "mod_pistol_grip"
|
slotId: "mod_pistol_grip",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add front sight
|
// Add front sight
|
||||||
@ -136,7 +136,7 @@ export class TraderHelper
|
|||||||
_id: "glockRearSight",
|
_id: "glockRearSight",
|
||||||
_tpl: "5a6f5d528dc32e00094b97d9",
|
_tpl: "5a6f5d528dc32e00094b97d9",
|
||||||
parentId: "glockReciever",
|
parentId: "glockReciever",
|
||||||
slotId: "mod_sight_rear"
|
slotId: "mod_sight_rear",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add rear sight
|
// Add rear sight
|
||||||
@ -144,7 +144,7 @@ export class TraderHelper
|
|||||||
_id: "glockFrontSight",
|
_id: "glockFrontSight",
|
||||||
_tpl: "5a6f58f68dc32e000a311390",
|
_tpl: "5a6f58f68dc32e000a311390",
|
||||||
parentId: "glockReciever",
|
parentId: "glockReciever",
|
||||||
slotId: "mod_sight_front"
|
slotId: "mod_sight_front",
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add magazine
|
// Add magazine
|
||||||
@ -152,7 +152,7 @@ export class TraderHelper
|
|||||||
_id: "glockMagazine",
|
_id: "glockMagazine",
|
||||||
_tpl: "630769c4962d0247b029dc60",
|
_tpl: "630769c4962d0247b029dc60",
|
||||||
parentId: "glockBase",
|
parentId: "glockBase",
|
||||||
slotId: "mod_magazine"
|
slotId: "mod_magazine",
|
||||||
});
|
});
|
||||||
|
|
||||||
return glock;
|
return glock;
|
||||||
@ -171,7 +171,8 @@ export class TraderHelper
|
|||||||
public addTraderToLocales(baseJson: any, tables: IDatabaseTables, fullName: string, firstName: string, nickName: string, location: string, description: string)
|
public addTraderToLocales(baseJson: any, tables: IDatabaseTables, fullName: string, firstName: string, nickName: string, location: string, description: string)
|
||||||
{
|
{
|
||||||
// For each language, add locale for the new trader
|
// For each language, add locale for the new trader
|
||||||
const locales = Object.values(tables.locales.global) as Record<string, string>[];
|
const locales = Object.values(tables.locales.global);
|
||||||
|
|
||||||
for (const locale of locales) {
|
for (const locale of locales) {
|
||||||
locale[`${baseJson._id} FullName`] = fullName;
|
locale[`${baseJson._id} FullName`] = fullName;
|
||||||
locale[`${baseJson._id} FirstName`] = firstName;
|
locale[`${baseJson._id} FirstName`] = firstName;
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "AfterDBLoadHook",
|
"name": "AfterDBLoadHook",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Chomp",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Chomp",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -47,4 +47,4 @@ class Mod implements IPreAkiLoadMod, IPostAkiLoadMod, IPostDBLoadMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() }
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "HttpListenerExample",
|
"name": "HttpListenerExample",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Alex",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "clodan",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
|
|
||||||
import { IHttpListener } from "@spt-aki/servers/http/IHttpListener";
|
import { IHttpListener } from "@spt-aki/servers/http/IHttpListener";
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
|
||||||
|
|
||||||
export class Type2HttpListener implements IHttpListener
|
export class Type2HttpListener implements IHttpListener
|
||||||
{
|
{
|
||||||
@ -7,10 +8,10 @@ export class Type2HttpListener implements IHttpListener
|
|||||||
{
|
{
|
||||||
return req.method === "GET" && req.url?.includes("/type2-custom-url");
|
return req.method === "GET" && req.url?.includes("/type2-custom-url");
|
||||||
}
|
}
|
||||||
public handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): void
|
|
||||||
|
public async handle(sessionId: string, req: IncomingMessage, resp: ServerResponse): Promise<void>
|
||||||
{
|
{
|
||||||
resp.writeHead(200, "OK");
|
resp.writeHead(200, "OK");
|
||||||
resp.end("[2] This is the second example of a mod hooking into the HttpServer");
|
resp.end("[2] This is the second example of a mod hooking into the HttpServer");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||||
import { HttpListenerModService } from "@spt-aki/services/mod/httpListener/HttpListenerModService";
|
import { HttpListenerModService } from "@spt-aki/services/mod/httpListener/HttpListenerModService";
|
||||||
import { IncomingMessage, ServerResponse } from "http";
|
|
||||||
import { Type2HttpListener } from "./Type2HttpListener";
|
import { Type2HttpListener } from "./Type2HttpListener";
|
||||||
|
|
||||||
class Mod implements IPreAkiLoadMod
|
class Mod implements IPreAkiLoadMod
|
||||||
@ -28,4 +29,4 @@ class Mod implements IPreAkiLoadMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() }
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ImporterUtil",
|
"name": "ImporterUtil",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Chomp",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Chomp",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
|
import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
|
||||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
import { ImporterUtil } from "@spt-aki/utils/ImporterUtil";
|
import { ImporterUtil } from "@spt-aki/utils/ImporterUtil";
|
||||||
import { DependencyContainer } from "tsyringe";
|
|
||||||
import { ConfigsModelBase } from "./model/ConfigsModel";
|
import { ConfigsModelBase } from "./model/ConfigsModel";
|
||||||
|
|
||||||
class Mod implements IPreAkiLoadMod {
|
class Mod implements IPreAkiLoadMod {
|
||||||
@ -22,4 +23,4 @@ class Mod implements IPreAkiLoadMod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() };
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,22 +1,20 @@
|
|||||||
{
|
{
|
||||||
"name": "AsyncWithDependency1",
|
"name": "AsyncWithDependency1",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Chomp",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
"modDependencies": {
|
"main": "src/mod.js",
|
||||||
"17AsyncImporterWithDependency2": "~1"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
"buildinfo": "node ./build.mjs --verbose"
|
"buildinfo": "node ./build.mjs --verbose"
|
||||||
},
|
},
|
||||||
|
"modDependencies": {
|
||||||
|
"17AsyncImporterWithDependency2": "~1"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "20.11",
|
"@types/node": "20.11",
|
||||||
"@typescript-eslint/eslint-plugin": "7.2",
|
"@typescript-eslint/eslint-plugin": "7.2",
|
||||||
@ -25,9 +23,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Chomp",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
|
import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
|
||||||
import { IPreAkiLoadModAsync } from "@spt-aki/models/external/IPreAkiLoadModAsync";
|
import { IPreAkiLoadModAsync } from "@spt-aki/models/external/IPreAkiLoadModAsync";
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
import { ImporterUtil } from "@spt-aki/utils/ImporterUtil";
|
import { ImporterUtil } from "@spt-aki/utils/ImporterUtil";
|
||||||
import { DependencyContainer } from "tsyringe";
|
|
||||||
import { ConfigsModelBase } from "./model/ConfigsModel";
|
import { ConfigsModelBase } from "./model/ConfigsModel";
|
||||||
|
|
||||||
class Mod implements IPreAkiLoadModAsync {
|
class Mod implements IPreAkiLoadModAsync {
|
||||||
@ -27,4 +28,4 @@ class Mod implements IPreAkiLoadModAsync {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() };
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "AsyncWithDependency2",
|
"name": "AsyncWithDependency2",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Chomp",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Chomp",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
|
import { PreAkiModLoader } from "@spt-aki/loaders/PreAkiModLoader";
|
||||||
import { IPreAkiLoadModAsync } from "@spt-aki/models/external/IPreAkiLoadModAsync";
|
import { IPreAkiLoadModAsync } from "@spt-aki/models/external/IPreAkiLoadModAsync";
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
import { ImporterUtil } from "@spt-aki/utils/ImporterUtil";
|
import { ImporterUtil } from "@spt-aki/utils/ImporterUtil";
|
||||||
import { DependencyContainer } from "tsyringe";
|
|
||||||
import { ConfigsModelBase } from "./model/ConfigsModel";
|
import { ConfigsModelBase } from "./model/ConfigsModel";
|
||||||
|
|
||||||
class Mod implements IPreAkiLoadModAsync {
|
class Mod implements IPreAkiLoadModAsync {
|
||||||
@ -27,4 +28,4 @@ class Mod implements IPreAkiLoadModAsync {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() };
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "CustomItemService",
|
"name": "CustomItemService",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Choccy",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Choccy",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,13 @@ class Mod implements IPostDBLoadMod, IPostAkiLoadMod
|
|||||||
overrideProperties: {
|
overrideProperties: {
|
||||||
Chambers: [
|
Chambers: [
|
||||||
{
|
{
|
||||||
"_name": "patron_in_weapon_000",
|
_name: "patron_in_weapon_000",
|
||||||
"_id": "61f7c9e189e6fb1a5e3ea791",
|
_id: "61f7c9e189e6fb1a5e3ea791",
|
||||||
"_parent": "CustomMP18",
|
_parent: "CustomMP18",
|
||||||
"_props": {
|
_props: {
|
||||||
"filters": [
|
filters: [
|
||||||
{
|
{
|
||||||
"Filter": [
|
Filter: [
|
||||||
"560d5e524bdc2d25448b4571",
|
"560d5e524bdc2d25448b4571",
|
||||||
"5d6e6772a4b936088465b17c",
|
"5d6e6772a4b936088465b17c",
|
||||||
"5d6e67fba4b9361bc73bc779",
|
"5d6e67fba4b9361bc73bc779",
|
||||||
@ -41,16 +41,16 @@ class Mod implements IPostDBLoadMod, IPostAkiLoadMod
|
|||||||
"5d6e68b3a4b9361bca7e50b5",
|
"5d6e68b3a4b9361bca7e50b5",
|
||||||
"5d6e6891a4b9361bd473feea",
|
"5d6e6891a4b9361bd473feea",
|
||||||
"5d6e689ca4b9361bc8618956",
|
"5d6e689ca4b9361bc8618956",
|
||||||
"5d6e68d1a4b93622fe60e845"
|
"5d6e68d1a4b93622fe60e845",
|
||||||
]
|
],
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"_required": false,
|
],
|
||||||
"_mergeSlotWithChildren": false,
|
},
|
||||||
"_proto": "55d4af244bdc2d962f8b4571"
|
_required: false,
|
||||||
}
|
_mergeSlotWithChildren: false,
|
||||||
]
|
_proto: "55d4af244bdc2d962f8b4571",
|
||||||
|
},
|
||||||
|
],
|
||||||
}, //Overried properties basically tell the server on what data inside _props to be modified from the cloned item, in this example i am modifying the ammo used to be 12G
|
}, //Overried properties basically tell the server on what data inside _props to be modified from the cloned item, in this example i am modifying the ammo used to be 12G
|
||||||
parentId: "5447b6094bdc2dc3278b4567", //ParentId refers to the Node item the gun will be under, you can check it in https://db.sp-tarkov.com/search
|
parentId: "5447b6094bdc2dc3278b4567", //ParentId refers to the Node item the gun will be under, you can check it in https://db.sp-tarkov.com/search
|
||||||
newId: "CustomMP18", //The new id of our cloned item
|
newId: "CustomMP18", //The new id of our cloned item
|
||||||
@ -59,22 +59,24 @@ class Mod implements IPostDBLoadMod, IPostAkiLoadMod
|
|||||||
handbookParentId: "5b5f78e986f77447ed5636b1", //Handbook Parent Id refers to the category the gun will be under
|
handbookParentId: "5b5f78e986f77447ed5636b1", //Handbook Parent Id refers to the category the gun will be under
|
||||||
//you see those side box tab thing that only select gun under specific icon? Handbook parent can be found in Aki_Data\Server\database\templates.
|
//you see those side box tab thing that only select gun under specific icon? Handbook parent can be found in Aki_Data\Server\database\templates.
|
||||||
locales: {
|
locales: {
|
||||||
"en": {
|
en: {
|
||||||
name: "MP-18 12g",
|
name: "MP-18 12g",
|
||||||
shortName: "Custom MP18",
|
shortName: "Custom MP18",
|
||||||
description: "A custom MP18 chambered in 12G"
|
description: "A custom MP18 chambered in 12G",
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
CustomItem.createItemFromClone(ExampleCloneItem); //Basically calls the function and tell the server to add our Cloned new item into the server
|
CustomItem.createItemFromClone(ExampleCloneItem); //Basically calls the function and tell the server to add our Cloned new item into the server
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if our item is in the server or not
|
//Check if our item is in the server or not
|
||||||
public postAkiLoad(container: DependencyContainer): void {
|
public postAkiLoad(container: DependencyContainer): void {
|
||||||
const db = container.resolve<DatabaseServer>("DatabaseServer");
|
const db = container.resolve<DatabaseServer>("DatabaseServer");
|
||||||
const item = db.getTables().templates.items;
|
const item = db.getTables().templates.items;
|
||||||
|
|
||||||
console.log(item["CustomMP18"]._props)
|
console.log(item["CustomMP18"]._props);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() }
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "UseExternalLibraries",
|
"name": "UseExternalLibraries",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "TheSparta",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -25,9 +23,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "TheSparta",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
198
TypeScript/19UseExternalLibraries/pnpm-lock.yaml
generated
198
TypeScript/19UseExternalLibraries/pnpm-lock.yaml
generated
@ -1,198 +0,0 @@
|
|||||||
lockfileVersion: '6.0'
|
|
||||||
|
|
||||||
settings:
|
|
||||||
autoInstallPeers: true
|
|
||||||
excludeLinksFromLockfile: false
|
|
||||||
|
|
||||||
dependencies:
|
|
||||||
ora-classic:
|
|
||||||
specifier: 5.4.2
|
|
||||||
version: 5.4.2
|
|
||||||
|
|
||||||
packages:
|
|
||||||
|
|
||||||
/ansi-regex@5.0.1:
|
|
||||||
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ansi-styles@4.3.0:
|
|
||||||
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dependencies:
|
|
||||||
color-convert: 2.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/base64-js@1.5.1:
|
|
||||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/bl@4.1.0:
|
|
||||||
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
|
|
||||||
dependencies:
|
|
||||||
buffer: 5.7.1
|
|
||||||
inherits: 2.0.4
|
|
||||||
readable-stream: 3.6.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/buffer@5.7.1:
|
|
||||||
resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==}
|
|
||||||
dependencies:
|
|
||||||
base64-js: 1.5.1
|
|
||||||
ieee754: 1.2.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/chalk@4.1.2:
|
|
||||||
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dependencies:
|
|
||||||
ansi-styles: 4.3.0
|
|
||||||
supports-color: 7.2.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/cli-cursor@3.1.0:
|
|
||||||
resolution: {integrity: sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dependencies:
|
|
||||||
restore-cursor: 3.1.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/cli-spinners@2.9.1:
|
|
||||||
resolution: {integrity: sha512-jHgecW0pxkonBJdrKsqxgRX9AcG+u/5k0Q7WPDfi8AogLAdwxEkyYYNWwZ5GvVFoFx2uiY1eNcSK00fh+1+FyQ==}
|
|
||||||
engines: {node: '>=6'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/clone@1.0.4:
|
|
||||||
resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==}
|
|
||||||
engines: {node: '>=0.8'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/color-convert@2.0.1:
|
|
||||||
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
|
||||||
engines: {node: '>=7.0.0'}
|
|
||||||
dependencies:
|
|
||||||
color-name: 1.1.4
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/color-name@1.1.4:
|
|
||||||
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/defaults@1.0.4:
|
|
||||||
resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==}
|
|
||||||
dependencies:
|
|
||||||
clone: 1.0.4
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/has-flag@4.0.0:
|
|
||||||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ieee754@1.2.1:
|
|
||||||
resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/inherits@2.0.4:
|
|
||||||
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/is-interactive@1.0.0:
|
|
||||||
resolution: {integrity: sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/is-unicode-supported@0.1.0:
|
|
||||||
resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/log-symbols@4.1.0:
|
|
||||||
resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dependencies:
|
|
||||||
chalk: 4.1.2
|
|
||||||
is-unicode-supported: 0.1.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/mimic-fn@2.1.0:
|
|
||||||
resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==}
|
|
||||||
engines: {node: '>=6'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/onetime@5.1.2:
|
|
||||||
resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==}
|
|
||||||
engines: {node: '>=6'}
|
|
||||||
dependencies:
|
|
||||||
mimic-fn: 2.1.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ora-classic@5.4.2:
|
|
||||||
resolution: {integrity: sha512-/xX8D5AMHB+LnvEJHOglmq6pXwm65CQ/gqPrIjIN5GJ1Bl9KC9fSmgzR/FwjrtalDj/WVxukAVuH8GP00Zpiaw==}
|
|
||||||
engines: {node: '>=10'}
|
|
||||||
dependencies:
|
|
||||||
bl: 4.1.0
|
|
||||||
chalk: 4.1.2
|
|
||||||
cli-cursor: 3.1.0
|
|
||||||
cli-spinners: 2.9.1
|
|
||||||
is-interactive: 1.0.0
|
|
||||||
is-unicode-supported: 0.1.0
|
|
||||||
log-symbols: 4.1.0
|
|
||||||
strip-ansi: 6.0.1
|
|
||||||
wcwidth: 1.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/readable-stream@3.6.2:
|
|
||||||
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
|
|
||||||
engines: {node: '>= 6'}
|
|
||||||
dependencies:
|
|
||||||
inherits: 2.0.4
|
|
||||||
string_decoder: 1.3.0
|
|
||||||
util-deprecate: 1.0.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/restore-cursor@3.1.0:
|
|
||||||
resolution: {integrity: sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dependencies:
|
|
||||||
onetime: 5.1.2
|
|
||||||
signal-exit: 3.0.7
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/safe-buffer@5.2.1:
|
|
||||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/signal-exit@3.0.7:
|
|
||||||
resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/string_decoder@1.3.0:
|
|
||||||
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==}
|
|
||||||
dependencies:
|
|
||||||
safe-buffer: 5.2.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/strip-ansi@6.0.1:
|
|
||||||
resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dependencies:
|
|
||||||
ansi-regex: 5.0.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/supports-color@7.2.0:
|
|
||||||
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
|
|
||||||
engines: {node: '>=8'}
|
|
||||||
dependencies:
|
|
||||||
has-flag: 4.0.0
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/util-deprecate@1.0.2:
|
|
||||||
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/wcwidth@1.0.1:
|
|
||||||
resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==}
|
|
||||||
dependencies:
|
|
||||||
defaults: 1.0.4
|
|
||||||
dev: false
|
|
@ -1,21 +1,21 @@
|
|||||||
import { DependencyContainer } from 'tsyringe';
|
import path from "node:path";
|
||||||
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
|
import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
|
||||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
import { VFS } from "@spt-aki/utils/VFS";
|
import { VFS } from "@spt-aki/utils/VFS";
|
||||||
import { jsonc } from 'jsonc';
|
import { jsonc } from "jsonc";
|
||||||
|
|
||||||
// Our dynamically imported package (via pnpm) not bundled into the server
|
// Our dynamically imported package (via pnpm) not bundled into the server
|
||||||
import ora from "ora-classic";
|
import ora from "ora-classic";
|
||||||
import path from "path";
|
|
||||||
|
|
||||||
class Mod implements IPreAkiLoadMod, IPostAkiLoadMod {
|
class Mod implements IPreAkiLoadMod, IPostAkiLoadMod {
|
||||||
public preAkiLoad(container: DependencyContainer): void {
|
public preAkiLoad(container: DependencyContainer): void {
|
||||||
const VFS = container.resolve<VFS>("VFS");
|
const vfs = container.resolve<VFS>("VFS");
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("WinstonLogger");
|
||||||
|
|
||||||
const parsedJsonC = jsonc.parse(VFS.readFile(path.resolve(__dirname, "../test.jsonc")));
|
const parsedJsonC = jsonc.parse(vfs.readFile(path.resolve(__dirname, "../test.jsonc")));
|
||||||
|
|
||||||
logger.success(jsonc.stringify(parsedJsonC, null, "\t")); // you could use the built in JSON api here if you really wanted too aswell, i used jsonc to really drive home the point that it works
|
logger.success(jsonc.stringify(parsedJsonC, null, "\t")); // you could use the built in JSON api here if you really wanted too aswell, i used jsonc to really drive home the point that it works
|
||||||
}
|
}
|
||||||
@ -38,6 +38,4 @@ class Mod implements IPreAkiLoadMod, IPostAkiLoadMod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export const mod = new Mod();
|
||||||
mod: new Mod()
|
|
||||||
}
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,15 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "LogToConsole",
|
"name": "LogToConsole",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "Chomp",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
|
||||||
"isBundleMod": false,
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -23,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "Chomp",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { DependencyContainer } from "tsyringe";
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
import { IPreAkiLoadMod } from "@spt-aki/models/external/IPreAkiLoadMod";
|
||||||
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor";
|
import { LogTextColor } from "@spt-aki/models/spt/logging/LogTextColor";
|
||||||
@ -7,7 +8,7 @@ import { LogBackgroundColor } from "@spt-aki/models/spt/logging/LogBackgroundCol
|
|||||||
class Mod implements IPreAkiLoadMod
|
class Mod implements IPreAkiLoadMod
|
||||||
{
|
{
|
||||||
// Code added here will load BEFORE the server has started loading
|
// Code added here will load BEFORE the server has started loading
|
||||||
preAkiLoad(container: DependencyContainer): void
|
public preAkiLoad(container: DependencyContainer): void
|
||||||
{
|
{
|
||||||
// get the logger from the server container
|
// get the logger from the server container
|
||||||
const logger = container.resolve<ILogger>("WinstonLogger");
|
const logger = container.resolve<ILogger>("WinstonLogger");
|
||||||
@ -19,4 +20,4 @@ class Mod implements IPreAkiLoadMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { mod: new Mod() }
|
export const mod = new Mod();
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
@ -1,7 +1,8 @@
|
|||||||
# Exclude these folders from linting
|
# Exclude these folders from linting
|
||||||
node_modules
|
**/node_modules
|
||||||
dist/
|
/tmp
|
||||||
types/
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
# Exclude these filetypes from linting
|
# Exclude these filetypes from linting
|
||||||
*.json
|
*.json
|
||||||
|
@ -47,7 +47,7 @@ Some resources to get you started:
|
|||||||
|
|
||||||
## **Coding Guidelines**
|
## **Coding Guidelines**
|
||||||
|
|
||||||
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"license"`, `"author"`, and `"akiVersion"`.
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"akiVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
import os from "os";
|
|
||||||
import path from "path";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import { dirname } from "path";
|
|
||||||
import ignore from "ignore";
|
import ignore from "ignore";
|
||||||
import archiver from "archiver";
|
import archiver from "archiver";
|
||||||
import winston from "winston";
|
import winston from "winston";
|
||||||
@ -165,7 +164,7 @@ async function main() {
|
|||||||
* @returns {string} The absolute path of the current working directory.
|
* @returns {string} The absolute path of the current working directory.
|
||||||
*/
|
*/
|
||||||
function getCurrentDirectory() {
|
function getCurrentDirectory() {
|
||||||
return dirname(fileURLToPath(import.meta.url));
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -225,10 +224,9 @@ function createProjectName(packageJson) {
|
|||||||
// Remove any non-alphanumeric characters from the author and name.
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
const author = packageJson.author.replace(/\W/g, "");
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
const name = packageJson.name.replace(/\W/g, "");
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
const version = packageJson.version;
|
|
||||||
|
|
||||||
// Ensure the name is lowercase, as per the package.json specification.
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
return `${author}-${name}-${version}`.toLowerCase();
|
return `${author}-${name}`.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
],
|
],
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"dbaeumer.vscode-eslint"
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "CustomChatBot",
|
"name": "CustomChatBot",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "src/mod.js",
|
|
||||||
"license": "MIT",
|
|
||||||
"author": "clodan",
|
|
||||||
"akiVersion": "~3.9",
|
"akiVersion": "~3.9",
|
||||||
"loadBefore": [],
|
"loadBefore": [],
|
||||||
"loadAfter": [],
|
"loadAfter": [],
|
||||||
"incompatibilities": [],
|
"incompatibilities": [],
|
||||||
"contributors": [],
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup": "npm i",
|
"setup": "npm i",
|
||||||
"build": "node ./build.mjs",
|
"build": "node ./build.mjs",
|
||||||
@ -22,9 +20,11 @@
|
|||||||
"eslint": "8.57",
|
"eslint": "8.57",
|
||||||
"fs-extra": "11.2",
|
"fs-extra": "11.2",
|
||||||
"ignore": "^5.2",
|
"ignore": "^5.2",
|
||||||
"os": "^0.1",
|
|
||||||
"tsyringe": "4.8.0",
|
"tsyringe": "4.8.0",
|
||||||
"typescript": "5.4",
|
"typescript": "5.4",
|
||||||
"winston": "3.12"
|
"winston": "3.12"
|
||||||
}
|
},
|
||||||
|
"author": "clodan",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,26 @@
|
|||||||
|
import { inject, injectable } from "tsyringe";
|
||||||
|
|
||||||
import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot";
|
import { IDialogueChatBot } from "@spt-aki/helpers/Dialogue/IDialogueChatBot";
|
||||||
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
|
import { ISendMessageRequest } from "@spt-aki/models/eft/dialog/ISendMessageRequest";
|
||||||
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
|
import { IUserDialogInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
|
||||||
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
|
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
|
||||||
import { MailSendService } from "@spt-aki/services/MailSendService";
|
import { MailSendService } from "@spt-aki/services/MailSendService";
|
||||||
import { inject, injectable } from "tsyringe";
|
|
||||||
|
|
||||||
// \/ dont forger this annotation here!
|
// \/ dont forger this annotation here!
|
||||||
@injectable()
|
@injectable()
|
||||||
export class CustomChatBot implements IDialogueChatBot
|
export class CustomChatBot implements IDialogueChatBot
|
||||||
{
|
{
|
||||||
public constructor(
|
constructor(
|
||||||
@inject("MailSendService") protected mailSendService: MailSendService,
|
@inject("MailSendService") protected mailSendService: MailSendService,
|
||||||
)
|
)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
public getChatBot(): IUserDialogInfo
|
public getChatBot(): IUserDialogInfo
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
_id: "modderBuddy",
|
_id: "modderBuddy",
|
||||||
info: {
|
aid: 9999999,
|
||||||
|
Info: {
|
||||||
Level: 1,
|
Level: 1,
|
||||||
MemberCategory: MemberCategory.SHERPA,
|
MemberCategory: MemberCategory.SHERPA,
|
||||||
Nickname: "Buddy",
|
Nickname: "Buddy",
|
||||||
@ -37,5 +38,4 @@ export class CustomChatBot implements IDialogueChatBot
|
|||||||
);
|
);
|
||||||
return request.dialogId;
|
return request.dialogId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { DependencyContainer } from 'tsyringe';
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod";
|
import { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod";
|
||||||
import { DialogueController } from "@spt-aki/controllers/DialogueController";
|
import { DialogueController } from "@spt-aki/controllers/DialogueController";
|
||||||
import { CustomChatBot } from './CustomChatBot';
|
import { CustomChatBot } from "./CustomChatBot";
|
||||||
|
|
||||||
class Mod implements IPostDBLoadMod {
|
class Mod implements IPostDBLoadMod {
|
||||||
public postDBLoad(container: DependencyContainer): void {
|
public postDBLoad(container: DependencyContainer): void {
|
||||||
@ -12,6 +12,4 @@ class Mod implements IPostDBLoadMod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
export const mod = new Mod();
|
||||||
mod: new Mod()
|
|
||||||
}
|
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"outDir": "tmp",
|
"outDir": "tmp",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@spt-aki/*": [ "./types/*" ],
|
"@spt-aki/*": ["./types/*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"exclude": [ "node_modules", "dist", "tmp" ],
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user