Add 18.1CustomItemServiceLootBox & 13.1AddTraderWithAssortJSON (#32)
Created 18.1CustomItemServiceLootBox as an extension of 18CustomItemService. Created 13.1AddTraderWithAssortJSON as a replacement / extension of 13AddTrader Co-authored-by: acidphantasm <127812106+acidphantasm@users.noreply.github.com> Reviewed-on: #32 Co-authored-by: acidphantasm <acidphantasm@noreply.dev.sp-tarkov.com> Co-committed-by: acidphantasm <acidphantasm@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
a49021934b
commit
88ad186bf5
20
TypeScript/13.1AddTraderWithAssortJSON/.buildignore
Normal file
20
TypeScript/13.1AddTraderWithAssortJSON/.buildignore
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/.buildignore
|
||||||
|
/.DS_Store
|
||||||
|
/.editorconfig
|
||||||
|
/.eslintignore
|
||||||
|
/.eslintrc.json
|
||||||
|
/.git
|
||||||
|
/.github
|
||||||
|
/.gitignore
|
||||||
|
/.gitlab
|
||||||
|
/.nvmrc
|
||||||
|
/.prettierrc
|
||||||
|
/.vscode
|
||||||
|
/build.mjs
|
||||||
|
/dist
|
||||||
|
/images
|
||||||
|
/mod.code-workspace
|
||||||
|
/node_modules
|
||||||
|
/package-lock.json
|
||||||
|
/tsconfig.json
|
||||||
|
/types
|
10
TypeScript/13.1AddTraderWithAssortJSON/.eslintignore
Normal file
10
TypeScript/13.1AddTraderWithAssortJSON/.eslintignore
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Exclude these folders from linting
|
||||||
|
**/node_modules
|
||||||
|
/tmp
|
||||||
|
/dist
|
||||||
|
/types
|
||||||
|
|
||||||
|
# Exclude these filetypes from linting
|
||||||
|
*.json
|
||||||
|
*.txt
|
||||||
|
*.exe
|
98
TypeScript/13.1AddTraderWithAssortJSON/.eslintrc.json
Normal file
98
TypeScript/13.1AddTraderWithAssortJSON/.eslintrc.json
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
|
"@typescript-eslint/no-unused-vars": 1,
|
||||||
|
"@typescript-eslint/no-empty-interface": 0,
|
||||||
|
"@typescript-eslint/no-namespace": 0,
|
||||||
|
"@typescript-eslint/comma-dangle": 1,
|
||||||
|
"@typescript-eslint/func-call-spacing": 2,
|
||||||
|
"@typescript-eslint/quotes": 1,
|
||||||
|
"@typescript-eslint/brace-style": [
|
||||||
|
"warn",
|
||||||
|
"allman"
|
||||||
|
],
|
||||||
|
"@typescript-eslint/naming-convention": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"selector": "default",
|
||||||
|
"format": [
|
||||||
|
"camelCase"
|
||||||
|
],
|
||||||
|
"leadingUnderscore": "allow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "typeLike",
|
||||||
|
"format": [
|
||||||
|
"PascalCase"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "objectLiteralProperty",
|
||||||
|
"format": [
|
||||||
|
"PascalCase",
|
||||||
|
"camelCase"
|
||||||
|
],
|
||||||
|
"leadingUnderscore": "allow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "typeProperty",
|
||||||
|
"format": [
|
||||||
|
"PascalCase",
|
||||||
|
"camelCase"
|
||||||
|
],
|
||||||
|
"leadingUnderscore": "allow"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"selector": "enumMember",
|
||||||
|
"format": [
|
||||||
|
"UPPER_CASE"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/indent": [
|
||||||
|
"warn",
|
||||||
|
4
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-unused-expressions": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"allowShortCircuit": false,
|
||||||
|
"allowTernary": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/keyword-spacing": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"before": true,
|
||||||
|
"after": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"allowArgumentsExplicitlyTypedAsAny": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.mjs",
|
||||||
|
"*.ts"
|
||||||
|
],
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
66
TypeScript/13.1AddTraderWithAssortJSON/README.md
Normal file
66
TypeScript/13.1AddTraderWithAssortJSON/README.md
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# Welcome to the SPT Modding Project
|
||||||
|
|
||||||
|
This project is designed to streamline the initial setup process for building and creating mods in the SPT environment. Follow this guide to set up your environment efficiently.
|
||||||
|
|
||||||
|
## **Table of Contents**
|
||||||
|
- [NodeJS Setup](#nodejs-setup)
|
||||||
|
- [IDE Setup](#ide-setup)
|
||||||
|
- [Workspace Configuration](#workspace-configuration)
|
||||||
|
- [Environment Setup](#environment-setup)
|
||||||
|
- [Essential Concepts](#essential-concepts)
|
||||||
|
- [Coding Guidelines](#coding-guidelines)
|
||||||
|
- [Distribution Guidelines](#distribution-guidelines)
|
||||||
|
|
||||||
|
## **NodeJS Setup**
|
||||||
|
|
||||||
|
Before you begin, ensure to install NodeJS version `v20.11.1`, which has been tested thoroughly with our mod templates and build scripts. Download it from the [official NodeJS website](https://nodejs.org/).
|
||||||
|
|
||||||
|
After installation, it's advised to reboot your system.
|
||||||
|
|
||||||
|
## **IDE Setup**
|
||||||
|
|
||||||
|
For this project, you can work with either [VSCodium](https://vscodium.com/) or [VSCode](https://code.visualstudio.com/). However, we strongly recommend using VSCode, as all development and testing have been carried out using this IDE, ensuring a smoother experience and compatibility with the project setups. Either way, we have a prepared a workspace file to assist you in setting up your environment.
|
||||||
|
|
||||||
|
## **Workspace Configuration**
|
||||||
|
|
||||||
|
With NodeJS and your chosen IDE ready, initiate the `mod.code-workspace` file using your IDE:
|
||||||
|
|
||||||
|
> File -> Open Workspace from File...
|
||||||
|
|
||||||
|
Upon project loading, consider installing recommended plugins like the ESLint plugin.
|
||||||
|
|
||||||
|
## **Environment Setup**
|
||||||
|
|
||||||
|
An automated task is available to configure your environment for Typescript utilization:
|
||||||
|
|
||||||
|
> Terminal -> Run Task... -> Show All Tasks... -> npm: install
|
||||||
|
|
||||||
|
Note: Preserve the `node_modules` folder as it contains necessary dependencies for Typescript and other functionalities.
|
||||||
|
|
||||||
|
## **Essential Concepts**
|
||||||
|
|
||||||
|
Prioritize understanding Dependency Injection and Inversion of Control, the architectural principles SPT adopts. Comprehensive guidelines will be available on the hub upon release.
|
||||||
|
|
||||||
|
Some resources to get you started:
|
||||||
|
- [A quick intro to Dependency Injection](https://www.freecodecamp.org/news/a-quick-intro-to-dependency-injection-what-it-is-and-when-to-use-it-7578c84fa88f/)
|
||||||
|
- [Understanding Inversion of Control (IoC) Principle](https://medium.com/@amitkma/understanding-inversion-of-control-ioc-principle-163b1dc97454)
|
||||||
|
|
||||||
|
## **Coding Guidelines**
|
||||||
|
|
||||||
|
Focus your mod development around the `mod.ts` file. In the `package.json` file, only alter these properties: `"name"`, `"version"`, `"sptVersion"`, `"loadBefore"`, `"loadAfter"`, `"incompatibilities"`, `"isBundleMod"`, `"author"`, and `"license"`.
|
||||||
|
|
||||||
|
New to Typescript? Find comprehensive documentation on the [official website](https://www.typescriptlang.org/docs/).
|
||||||
|
|
||||||
|
## **Distribution Guidelines**
|
||||||
|
|
||||||
|
Automated tasks are set up to bundle all necessary files for your mod to function in SPT:
|
||||||
|
|
||||||
|
> Terminal -> Run Task... -> Show All Tasks... -> npm: build
|
||||||
|
|
||||||
|
The ZIP output, located in the `dist` directory, contains all required files. Ensure all files are included and modify the `.buildignore` file as needed. This ZIP file is your uploadable asset for the hub.
|
||||||
|
|
||||||
|
## **Conclusion**
|
||||||
|
|
||||||
|
With this setup, you're ready to begin modding with SPT. If you run into any trouble be sure to check out the [modding documentation on the hub](https://hub.sp-tarkov.com/doc/lexicon/66-modding/). If you really get stuck feel free to join us in the [#mods-development](https://discord.com/channels/875684761291599922/875803116409323562) official Discord channel.
|
||||||
|
|
||||||
|
Build something awesome!
|
381
TypeScript/13.1AddTraderWithAssortJSON/build.mjs
Normal file
381
TypeScript/13.1AddTraderWithAssortJSON/build.mjs
Normal file
@ -0,0 +1,381 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build Script
|
||||||
|
*
|
||||||
|
* This script automates the build process for server-side SPT mod projects, facilitating the creation of distributable
|
||||||
|
* mod packages. It performs a series of operations as outlined below:
|
||||||
|
* - Loads the .buildignore file, which is used to list files that should be ignored during the build process.
|
||||||
|
* - Loads the package.json to get project details so a descriptive name can be created for the mod package.
|
||||||
|
* - Creates a distribution directory and a temporary working directory.
|
||||||
|
* - Copies files to the temporary directory while respecting the .buildignore rules.
|
||||||
|
* - Creates a zip archive of the project files.
|
||||||
|
* - Moves the zip file to the root of the distribution directory.
|
||||||
|
* - Cleans up the temporary directory.
|
||||||
|
*
|
||||||
|
* It's typical that this script be customized to suit the needs of each project. For example, the script can be updated
|
||||||
|
* to perform additional operations, such as moving the mod package to a specific location or uploading it to a server.
|
||||||
|
* This script is intended to be a starting point for developers to build upon.
|
||||||
|
*
|
||||||
|
* Usage:
|
||||||
|
* - Run this script using npm: `npm run build`
|
||||||
|
* - Use `npm run buildinfo` for detailed logging.
|
||||||
|
*
|
||||||
|
* Note:
|
||||||
|
* - Ensure that all necessary Node.js modules are installed before running the script: `npm install`
|
||||||
|
* - The script reads configurations from the `package.json` and `.buildignore` files; ensure they are correctly set up.
|
||||||
|
*
|
||||||
|
* @author Refringe
|
||||||
|
* @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 ignore from "ignore";
|
||||||
|
import archiver from "archiver";
|
||||||
|
import winston from "winston";
|
||||||
|
|
||||||
|
// Get the command line arguments to determine whether to use verbose logging.
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
const verbose = args.includes("--verbose") || args.includes("-v");
|
||||||
|
|
||||||
|
// Configure the Winston logger to use colours.
|
||||||
|
const logColors = {
|
||||||
|
error: "red",
|
||||||
|
warn: "yellow",
|
||||||
|
info: "grey",
|
||||||
|
success: "green",
|
||||||
|
};
|
||||||
|
winston.addColors(logColors);
|
||||||
|
|
||||||
|
// Create a logger instance to log build progress. Configure the logger levels to allow for different levels of logging
|
||||||
|
// based on the verbosity flag, and set the console transport to log messages of the appropriate level.
|
||||||
|
const logger = winston.createLogger({
|
||||||
|
levels: {
|
||||||
|
error: 0,
|
||||||
|
warn: 1,
|
||||||
|
success: 2,
|
||||||
|
info: 3,
|
||||||
|
},
|
||||||
|
format: winston.format.combine(
|
||||||
|
winston.format.colorize(),
|
||||||
|
winston.format.printf(info => {
|
||||||
|
return `${info.level}: ${info.message}`;
|
||||||
|
})
|
||||||
|
),
|
||||||
|
transports: [
|
||||||
|
new winston.transports.Console({
|
||||||
|
level: verbose ? "info" : "success",
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The main function orchestrates the build process for creating a distributable mod package. It leverages a series of
|
||||||
|
* helper functions to perform various tasks such as loading configuration files, setting up directories, copying files
|
||||||
|
* according to `.buildignore` rules, and creating a ZIP archive of the project files.
|
||||||
|
*
|
||||||
|
* Utilizes the Winston logger to provide information on the build status at different stages of the process.
|
||||||
|
*
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
async function main() {
|
||||||
|
// Get the current directory where the script is being executed
|
||||||
|
const currentDir = getCurrentDirectory();
|
||||||
|
|
||||||
|
// Defining at this scope because we need to use it in the finally block.
|
||||||
|
let projectDir;
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Load the .buildignore file to set up an ignore handler for the build process.
|
||||||
|
const buildIgnorePatterns = await loadBuildIgnoreFile(currentDir);
|
||||||
|
|
||||||
|
// Load the package.json file to get project details.
|
||||||
|
const packageJson = await loadPackageJson(currentDir);
|
||||||
|
|
||||||
|
// Create a descriptive name for the mod package.
|
||||||
|
const projectName = createProjectName(packageJson);
|
||||||
|
logger.log("success", `Project name created: ${projectName}`);
|
||||||
|
|
||||||
|
// Remove the old distribution directory and create a fresh one.
|
||||||
|
const distDir = await removeOldDistDirectory(currentDir);
|
||||||
|
logger.log("info", "Distribution directory successfully cleaned.");
|
||||||
|
|
||||||
|
// Create a temporary working directory to perform the build operations.
|
||||||
|
projectDir = await createTemporaryDirectoryWithProjectName(projectName);
|
||||||
|
logger.log("success", "Temporary working directory successfully created.");
|
||||||
|
logger.log("info", projectDir);
|
||||||
|
|
||||||
|
// Copy files to the temporary directory while respecting the .buildignore rules.
|
||||||
|
logger.log("info", "Beginning copy operation using .buildignore file...");
|
||||||
|
await copyFiles(currentDir, projectDir, buildIgnorePatterns);
|
||||||
|
logger.log("success", "Files successfully copied to temporary directory.");
|
||||||
|
|
||||||
|
// Create a zip archive of the project files.
|
||||||
|
logger.log("info", "Beginning folder compression...");
|
||||||
|
const zipFilePath = path.join(path.dirname(projectDir), `${projectName}.zip`);
|
||||||
|
await createZipFile(projectDir, zipFilePath, "user/mods/" + projectName);
|
||||||
|
logger.log("success", "Archive successfully created.");
|
||||||
|
logger.log("info", zipFilePath);
|
||||||
|
|
||||||
|
// Move the zip file inside of the project directory, within the temporary working directory.
|
||||||
|
const zipFileInProjectDir = path.join(projectDir, `${projectName}.zip`);
|
||||||
|
await fs.move(zipFilePath, zipFileInProjectDir);
|
||||||
|
logger.log("success", "Archive successfully moved.");
|
||||||
|
logger.log("info", zipFileInProjectDir);
|
||||||
|
|
||||||
|
// Move the temporary directory into the distribution directory.
|
||||||
|
await fs.move(projectDir, distDir);
|
||||||
|
logger.log("success", "Temporary directory successfully moved into project distribution directory.");
|
||||||
|
|
||||||
|
// Log the success message. Write out the path to the mod package.
|
||||||
|
logger.log("success", "------------------------------------");
|
||||||
|
logger.log("success", "Build script completed successfully!");
|
||||||
|
logger.log("success", "Your mod package has been created in the 'dist' directory:");
|
||||||
|
logger.log("success", `/${path.relative(process.cwd(), path.join(distDir, `${projectName}.zip`))}`);
|
||||||
|
logger.log("success", "------------------------------------");
|
||||||
|
if (!verbose) {
|
||||||
|
logger.log("success", "To see a detailed build log, use `npm run buildinfo`.");
|
||||||
|
logger.log("success", "------------------------------------");
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// If any of the file operations fail, log the error.
|
||||||
|
logger.log("error", "An error occurred: " + err);
|
||||||
|
} finally {
|
||||||
|
// Clean up the temporary directory, even if the build fails.
|
||||||
|
if (projectDir) {
|
||||||
|
try {
|
||||||
|
await fs.promises.rm(projectDir, { force: true, recursive: true });
|
||||||
|
logger.log("info", "Cleaned temporary directory.");
|
||||||
|
} catch (err) {
|
||||||
|
logger.log("error", "Failed to clean temporary directory: " + err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the current working directory where the script is being executed. This directory is used as a reference
|
||||||
|
* point for various file operations throughout the build process, ensuring that paths are resolved correctly regardless
|
||||||
|
* of the location from which the script is invoked.
|
||||||
|
*
|
||||||
|
* @returns {string} The absolute path of the current working directory.
|
||||||
|
*/
|
||||||
|
function getCurrentDirectory() {
|
||||||
|
return path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the `.buildignore` file and sets up an ignore handler using the `ignore` module. The `.buildignore` file
|
||||||
|
* contains a list of patterns describing files and directories that should be ignored during the build process. The
|
||||||
|
* ignore handler created by this method is used to filter files and directories when copying them to the temporary
|
||||||
|
* directory, ensuring that only necessary files are included in the final mod package.
|
||||||
|
*
|
||||||
|
* @param {string} currentDirectory - The absolute path of the current working directory.
|
||||||
|
* @returns {Promise<ignore>} A promise that resolves to an ignore handler.
|
||||||
|
*/
|
||||||
|
async function loadBuildIgnoreFile(currentDir) {
|
||||||
|
const buildIgnorePath = path.join(currentDir, ".buildignore");
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Attempt to read the contents of the .buildignore file asynchronously.
|
||||||
|
const fileContent = await fs.promises.readFile(buildIgnorePath, "utf-8");
|
||||||
|
|
||||||
|
// Return a new ignore instance and add the rules from the .buildignore file (split by newlines).
|
||||||
|
return ignore().add(fileContent.split("\n"));
|
||||||
|
} catch (err) {
|
||||||
|
logger.log("warn", "Failed to read .buildignore file. No files or directories will be ignored.");
|
||||||
|
|
||||||
|
// Return an empty ignore instance, ensuring the build process can continue.
|
||||||
|
return ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the `package.json` file and returns its content as a JSON object. The `package.json` file contains important
|
||||||
|
* project details such as the name and version, which are used in later stages of the build process to create a
|
||||||
|
* descriptive name for the mod package. The method reads the file from the current working directory, ensuring that it
|
||||||
|
* accurately reflects the current state of the project.
|
||||||
|
*
|
||||||
|
* @param {string} currentDirectory - The absolute path of the current working directory.
|
||||||
|
* @returns {Promise<Object>} A promise that resolves to a JSON object containing the contents of the `package.json`.
|
||||||
|
*/
|
||||||
|
async function loadPackageJson(currentDir) {
|
||||||
|
const packageJsonPath = path.join(currentDir, "package.json");
|
||||||
|
|
||||||
|
// Read the contents of the package.json file asynchronously as a UTF-8 string.
|
||||||
|
const packageJsonContent = await fs.promises.readFile(packageJsonPath, "utf-8");
|
||||||
|
|
||||||
|
return JSON.parse(packageJsonContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a descriptive name for the mod package using details from the `package.json` file. The name is created by
|
||||||
|
* concatenating the project name, version, and a timestamp, resulting in a unique and descriptive file name for each
|
||||||
|
* build. This name is used as the base name for the temporary working directory and the final ZIP archive, helping to
|
||||||
|
* identify different versions of the mod package easily.
|
||||||
|
*
|
||||||
|
* @param {Object} packageJson - A JSON object containing the contents of the `package.json` file.
|
||||||
|
* @returns {string} A string representing the constructed project name.
|
||||||
|
*/
|
||||||
|
function createProjectName(packageJson) {
|
||||||
|
// Remove any non-alphanumeric characters from the author and name.
|
||||||
|
const author = packageJson.author.replace(/\W/g, "");
|
||||||
|
const name = packageJson.name.replace(/\W/g, "");
|
||||||
|
|
||||||
|
// Ensure the name is lowercase, as per the package.json specification.
|
||||||
|
return `${author}-${name}`.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines the location of the distribution directory where the final mod package will be stored and deletes any
|
||||||
|
* existing distribution directory to ensure a clean slate for the build process.
|
||||||
|
*
|
||||||
|
* @param {string} currentDirectory - The absolute path of the current working directory.
|
||||||
|
* @returns {Promise<string>} A promise that resolves to the absolute path to the distribution directory.
|
||||||
|
*/
|
||||||
|
async function removeOldDistDirectory(projectDir) {
|
||||||
|
const distPath = path.join(projectDir, "dist");
|
||||||
|
await fs.remove(distPath);
|
||||||
|
return distPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a temporary working directory using the project name. This directory serves as a staging area where project
|
||||||
|
* files are gathered before being archived into the final mod package. The method constructs a unique directory path
|
||||||
|
* by appending the project name to a base temporary directory path, ensuring that each build has its own isolated
|
||||||
|
* working space. This approach facilitates clean and organized build processes, avoiding potential conflicts with other
|
||||||
|
* builds.
|
||||||
|
*
|
||||||
|
* @param {string} currentDirectory - The absolute path of the current working directory.
|
||||||
|
* @param {string} projectName - The constructed project name, used to create a unique path for the temporary directory.
|
||||||
|
* @returns {Promise<string>} A promise that resolves to the absolute path of the newly created temporary directory.
|
||||||
|
*/
|
||||||
|
async function createTemporaryDirectoryWithProjectName(projectName) {
|
||||||
|
// Create a new directory in the system's temporary folder to hold the project files.
|
||||||
|
const tempDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "spt-mod-build-"));
|
||||||
|
|
||||||
|
// Create a subdirectory within the temporary directory using the project name for this specific build.
|
||||||
|
const projectDir = path.join(tempDir, projectName);
|
||||||
|
await fs.ensureDir(projectDir);
|
||||||
|
|
||||||
|
return projectDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the project files to the temporary directory while respecting the rules defined in the `.buildignore` file.
|
||||||
|
* The method is recursive, iterating over all files and directories in the source directory and using the ignore
|
||||||
|
* handler to filter out files and directories that match the patterns defined in the `.buildignore` file. This ensures
|
||||||
|
* that only the necessary files are included in the final mod package, adhering to the specifications defined by the
|
||||||
|
* developer in the `.buildignore` file.
|
||||||
|
*
|
||||||
|
* The copy operations are delayed and executed in parallel to improve efficiency and reduce the build time. This is
|
||||||
|
* achieved by creating an array of copy promises and awaiting them all at the end of the function.
|
||||||
|
*
|
||||||
|
* @param {string} sourceDirectory - The absolute path of the current working directory.
|
||||||
|
* @param {string} destinationDirectory - The absolute path of the temporary directory where the files will be copied.
|
||||||
|
* @param {Ignore} ignoreHandler - The ignore handler created from the `.buildignore` file.
|
||||||
|
* @returns {Promise<void>} A promise that resolves when all copy operations are completed successfully.
|
||||||
|
*/
|
||||||
|
async function copyFiles(srcDir, destDir, ignoreHandler) {
|
||||||
|
try {
|
||||||
|
// Read the contents of the source directory to get a list of entries (files and directories).
|
||||||
|
const entries = await fs.promises.readdir(srcDir, { withFileTypes: true });
|
||||||
|
|
||||||
|
// Initialize an array to hold the promises returned by recursive calls to copyFiles and copyFile operations.
|
||||||
|
const copyOperations = [];
|
||||||
|
|
||||||
|
for (const entry of entries) {
|
||||||
|
// Define the source and destination paths for each entry.
|
||||||
|
const srcPath = path.join(srcDir, entry.name);
|
||||||
|
const destPath = path.join(destDir, entry.name);
|
||||||
|
|
||||||
|
// Get the relative path of the source file to check against the ignore handler.
|
||||||
|
const relativePath = path.relative(process.cwd(), srcPath);
|
||||||
|
|
||||||
|
// If the ignore handler dictates that this file should be ignored, skip to the next iteration.
|
||||||
|
if (ignoreHandler.ignores(relativePath)) {
|
||||||
|
logger.log("info", `Ignored: /${path.relative(process.cwd(), srcPath)}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.isDirectory()) {
|
||||||
|
// If the entry is a directory, create the corresponding temporary directory and make a recursive call
|
||||||
|
// to copyFiles to handle copying the contents of the directory.
|
||||||
|
await fs.ensureDir(destPath);
|
||||||
|
copyOperations.push(copyFiles(srcPath, destPath, ignoreHandler));
|
||||||
|
} else {
|
||||||
|
// If the entry is a file, add a copyFile operation to the copyOperations array and log the event when
|
||||||
|
// the operation is successful.
|
||||||
|
copyOperations.push(
|
||||||
|
fs.copy(srcPath, destPath).then(() => {
|
||||||
|
logger.log("info", `Copied: /${path.relative(process.cwd(), srcPath)}`);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Await all copy operations to ensure all files and directories are copied before exiting the function.
|
||||||
|
await Promise.all(copyOperations);
|
||||||
|
} catch (err) {
|
||||||
|
// Log an error message if any error occurs during the copy process.
|
||||||
|
logger.log("error", "Error copying files: " + err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ZIP archive of the project files located in the temporary directory. The method uses the `archiver` module
|
||||||
|
* to create a ZIP file, which includes all the files that have been copied to the temporary directory during the build
|
||||||
|
* process. The ZIP file is named using the project name, helping to identify the contents of the archive easily.
|
||||||
|
*
|
||||||
|
* @param {string} directoryPath - The absolute path of the temporary directory containing the project files.
|
||||||
|
* @param {string} projectName - The constructed project name, used to name the ZIP file.
|
||||||
|
* @returns {Promise<string>} A promise that resolves to the absolute path of the created ZIP file.
|
||||||
|
*/
|
||||||
|
async function createZipFile(directoryToZip, zipFilePath, containerDirName) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
// Create a write stream to the specified ZIP file path.
|
||||||
|
const output = fs.createWriteStream(zipFilePath);
|
||||||
|
|
||||||
|
// Create a new archiver instance with ZIP format and maximum compression level.
|
||||||
|
const archive = archiver("zip", {
|
||||||
|
zlib: { level: 9 },
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set up an event listener for the 'close' event to resolve the promise when the archiver has finalized.
|
||||||
|
output.on("close", function () {
|
||||||
|
logger.log("info", "Archiver has finalized. The output and the file descriptor have closed.");
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set up an event listener for the 'warning' event to handle warnings appropriately, logging them or rejecting
|
||||||
|
// the promise based on the error code.
|
||||||
|
archive.on("warning", function (err) {
|
||||||
|
if (err.code === "ENOENT") {
|
||||||
|
logger.log("warn", `Archiver issued a warning: ${err.code} - ${err.message}`);
|
||||||
|
} else {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set up an event listener for the 'error' event to reject the promise if any error occurs during archiving.
|
||||||
|
archive.on("error", function (err) {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Pipe archive data to the file.
|
||||||
|
archive.pipe(output);
|
||||||
|
|
||||||
|
// Add the directory to the archive, under the provided directory name.
|
||||||
|
archive.directory(directoryToZip, containerDirName);
|
||||||
|
|
||||||
|
// Finalize the archive, indicating that no more files will be added and triggering the 'close' event once all
|
||||||
|
// data has been written.
|
||||||
|
archive.finalize();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Engage!
|
||||||
|
main();
|
124
TypeScript/13.1AddTraderWithAssortJSON/db/assort.json
Normal file
124
TypeScript/13.1AddTraderWithAssortJSON/db/assort.json
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
{
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"_id": "MILK_ID",
|
||||||
|
"_tpl": "575146b724597720a27126d5",
|
||||||
|
"parentId": "hideout",
|
||||||
|
"slotId": "hideout",
|
||||||
|
"upd": {
|
||||||
|
"UnlimitedCount": false,
|
||||||
|
"StackObjectsCount": 200,
|
||||||
|
"BuyRestrictionMax": 10,
|
||||||
|
"BuyRestrictionCurrent": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "MILK_ID_BARTER",
|
||||||
|
"_tpl": "575146b724597720a27126d5",
|
||||||
|
"parentId": "hideout",
|
||||||
|
"slotId": "hideout",
|
||||||
|
"upd": {
|
||||||
|
"UnlimitedCount": false,
|
||||||
|
"StackObjectsCount": 200,
|
||||||
|
"BuyRestrictionMax": 10,
|
||||||
|
"BuyRestrictionCurrent": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "HELMET_ID",
|
||||||
|
"_tpl": "5b40e3f35acfc40016388218",
|
||||||
|
"parentId": "hideout",
|
||||||
|
"slotId": "hideout",
|
||||||
|
"upd": {
|
||||||
|
"UnlimitedCount": false,
|
||||||
|
"StackObjectsCount": 200,
|
||||||
|
"BuyRestrictionMax": 10,
|
||||||
|
"BuyRestrictionCurrent": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "HELMET_SOFT_ARMOUR_TOP_ID",
|
||||||
|
"_tpl": "657f95bff92cd718b701550c",
|
||||||
|
"parentId": "HELMET_ID",
|
||||||
|
"slotId": "Helmet_top"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "HELMET_SOFT_ARMOUR_BACK_ID",
|
||||||
|
"_tpl": "657f9605f4c82973640b2358",
|
||||||
|
"parentId": "HELMET_ID",
|
||||||
|
"slotId": "Helmet_back"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "HELMET_ID_BARTER",
|
||||||
|
"_tpl": "5b40e3f35acfc40016388218",
|
||||||
|
"parentId": "hideout",
|
||||||
|
"slotId": "hideout",
|
||||||
|
"upd": {
|
||||||
|
"UnlimitedCount": false,
|
||||||
|
"StackObjectsCount": 200,
|
||||||
|
"BuyRestrictionMax": 10,
|
||||||
|
"BuyRestrictionCurrent": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "HELMET_SOFT_ARMOUR_TOP_ID_BARTER",
|
||||||
|
"_tpl": "657f95bff92cd718b701550c",
|
||||||
|
"parentId": "HELMET_ID_BARTER",
|
||||||
|
"slotId": "Helmet_top"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"_id": "HELMET_SOFT_ARMOUR_BACK_ID_BARTER",
|
||||||
|
"_tpl": "657f9605f4c82973640b2358",
|
||||||
|
"parentId": "HELMET_ID_BARTER",
|
||||||
|
"slotId": "Helmet_back"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"barter_scheme": {
|
||||||
|
"MILK_ID": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"count": 2000,
|
||||||
|
"_tpl": "5449016a4bdc2d6f028b456f"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"MILK_ID_BARTER": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"count": 3,
|
||||||
|
"_tpl": "59faff1d86f7746c51718c9c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"count": 1,
|
||||||
|
"_tpl": "544fb45d4bdc2dee738b4568"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"HELMET_ID": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"count": 2000,
|
||||||
|
"_tpl": "5449016a4bdc2d6f028b456f"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"HELMET_ID_BARTER": [
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"count": 3,
|
||||||
|
"_tpl": "59faff1d86f7746c51718c9c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"count": 1,
|
||||||
|
"_tpl": "544fb45d4bdc2dee738b4568"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"loyal_level_items": {
|
||||||
|
"MILK_ID": 1,
|
||||||
|
"MILK_ID_BARTER": 1,
|
||||||
|
"HELMET_ID": 1,
|
||||||
|
"HELMET_ID_BARTER": 1
|
||||||
|
}
|
||||||
|
}
|
93
TypeScript/13.1AddTraderWithAssortJSON/db/base.json
Normal file
93
TypeScript/13.1AddTraderWithAssortJSON/db/base.json
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
{
|
||||||
|
"_id": "cat",
|
||||||
|
"working": true,
|
||||||
|
"availableInRaid": false,
|
||||||
|
"items_buy": {
|
||||||
|
"category": [
|
||||||
|
"5422acb9af1c889c16000029",
|
||||||
|
"5448e8d04bdc2ddf718b4569"
|
||||||
|
],
|
||||||
|
"id_list": []
|
||||||
|
},
|
||||||
|
"items_buy_prohibited": {},
|
||||||
|
"customization_seller": false,
|
||||||
|
"name": "Cat",
|
||||||
|
"surname": " ",
|
||||||
|
"nickname": "Maxwell",
|
||||||
|
"location": "Here is the cat shop",
|
||||||
|
"avatar": "/files/trader/avatar/cat.jpg",
|
||||||
|
"balance_rub": 5000000,
|
||||||
|
"balance_dol": 0,
|
||||||
|
"balance_eur": 0,
|
||||||
|
"unlockedByDefault": true,
|
||||||
|
"discount": 0,
|
||||||
|
"discount_end": 0,
|
||||||
|
"buyer_up": true,
|
||||||
|
"currency": "RUB",
|
||||||
|
"nextResupply": 1615141448,
|
||||||
|
"repair": {
|
||||||
|
"availability": false,
|
||||||
|
"quality": "2",
|
||||||
|
"excluded_id_list": [],
|
||||||
|
"excluded_category": [],
|
||||||
|
"currency": "5449016a4bdc2d6f028b456f",
|
||||||
|
"currency_coefficient": 1,
|
||||||
|
"price_rate": 10
|
||||||
|
},
|
||||||
|
"insurance": {
|
||||||
|
"availability": false,
|
||||||
|
"min_payment": 0,
|
||||||
|
"min_return_hour": 0,
|
||||||
|
"max_return_hour": 0,
|
||||||
|
"max_storage_time": 99,
|
||||||
|
"excluded_category": []
|
||||||
|
},
|
||||||
|
"gridHeight": 150,
|
||||||
|
"loyaltyLevels": [{
|
||||||
|
"minLevel": 1,
|
||||||
|
"minSalesSum": 0,
|
||||||
|
"minStanding": 0,
|
||||||
|
"buy_price_coef": 38,
|
||||||
|
"repair_price_coef": 175,
|
||||||
|
"insurance_price_coef": 10,
|
||||||
|
"exchange_price_coef": 0,
|
||||||
|
"heal_price_coef": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sell_category": [
|
||||||
|
"82e7fac0b7495d72d4083356",
|
||||||
|
"ac705d3440c1407645e33579",
|
||||||
|
"dc97aee367144dc03389405d",
|
||||||
|
"7ffcc96aa06c7e90940330c5",
|
||||||
|
"e8f46e3ad74b9d862121f9dc",
|
||||||
|
"5b47574386f77428ca22b33e",
|
||||||
|
"5b47574386f77428ca22b33f",
|
||||||
|
"5b5f78dc86f77409407a7f8e",
|
||||||
|
"5b47574386f77428ca22b346",
|
||||||
|
"5b47574386f77428ca22b340",
|
||||||
|
"5b47574386f77428ca22b344",
|
||||||
|
"5b47574386f77428ca22b342",
|
||||||
|
"5b47574386f77428ca22b341",
|
||||||
|
"5b47574386f77428ca22b345",
|
||||||
|
"5b47574386f77428ca22b343",
|
||||||
|
"5b5f71b386f774093f2ecf11",
|
||||||
|
"5b5f71c186f77409407a7ec0",
|
||||||
|
"5b5f71de86f774093f2ecf13",
|
||||||
|
"5b5f724186f77447ed5636ad",
|
||||||
|
"5b5f736886f774094242f193",
|
||||||
|
"5b5f73ec86f774093e6cb4fd",
|
||||||
|
"5b5f74cc86f77447ec5d770a",
|
||||||
|
"5b5f750686f774093e6cb503",
|
||||||
|
"5b5f751486f77447ec5d770c",
|
||||||
|
"5b5f752e86f774093e6cb505",
|
||||||
|
"5b5f754a86f774094242f19b",
|
||||||
|
"5b5f755f86f77447ec5d770e",
|
||||||
|
"5b5f757486f774093e6cb507",
|
||||||
|
"5b5f75b986f77447ec5d7710",
|
||||||
|
"5b5f75c686f774094242f19f",
|
||||||
|
"5b5f75e486f77447ec5d7712",
|
||||||
|
"5b5f760586f774093e6cb509",
|
||||||
|
"5b5f761f86f774094242f1a1",
|
||||||
|
"5b5f764186f77447ec5d7714"
|
||||||
|
]
|
||||||
|
}
|
13
TypeScript/13.1AddTraderWithAssortJSON/mod.code-workspace
Normal file
13
TypeScript/13.1AddTraderWithAssortJSON/mod.code-workspace
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extensions": {
|
||||||
|
"recommendations": [
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"refringe.spt-id-highlighter"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
30
TypeScript/13.1AddTraderWithAssortJSON/package.json
Normal file
30
TypeScript/13.1AddTraderWithAssortJSON/package.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"name": "13.1AddTraderWithAssortJSON",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"sptVersion": "~3.9",
|
||||||
|
"loadBefore": [],
|
||||||
|
"loadAfter": [],
|
||||||
|
"incompatibilities": [],
|
||||||
|
"isBundleMod": false,
|
||||||
|
"main": "src/mod.js",
|
||||||
|
"scripts": {
|
||||||
|
"setup": "npm i",
|
||||||
|
"build": "node ./build.mjs",
|
||||||
|
"buildinfo": "node ./build.mjs --verbose"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "20.11",
|
||||||
|
"@typescript-eslint/eslint-plugin": "7.2",
|
||||||
|
"@typescript-eslint/parser": "7.2",
|
||||||
|
"archiver": "^6.0",
|
||||||
|
"eslint": "8.57",
|
||||||
|
"fs-extra": "11.2",
|
||||||
|
"ignore": "^5.2",
|
||||||
|
"tsyringe": "4.8.0",
|
||||||
|
"typescript": "5.4",
|
||||||
|
"winston": "3.12"
|
||||||
|
},
|
||||||
|
"author": "acidphantasm",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
BIN
TypeScript/13.1AddTraderWithAssortJSON/res/cat.jpg
Normal file
BIN
TypeScript/13.1AddTraderWithAssortJSON/res/cat.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
96
TypeScript/13.1AddTraderWithAssortJSON/src/mod.ts
Normal file
96
TypeScript/13.1AddTraderWithAssortJSON/src/mod.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
|
// SPT types
|
||||||
|
import { IPreSptLoadMod } from "@spt/models/external/IPreSptLoadMod";
|
||||||
|
import { IPostDBLoadMod } from "@spt/models/external/IPostDBLoadMod";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { PreSptModLoader } from "@spt/loaders/PreSptModLoader";
|
||||||
|
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||||
|
import { ImageRouter } from "@spt/routers/ImageRouter";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||||
|
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||||
|
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
|
import { JsonUtil } from "@spt/utils/JsonUtil";
|
||||||
|
import { Traders } from "@spt/models/enums/Traders";
|
||||||
|
|
||||||
|
// New trader settings
|
||||||
|
import baseJson = require("../db/base.json");
|
||||||
|
import assortJson = require("../db/assort.json");
|
||||||
|
|
||||||
|
import { TraderHelper } from "./traderHelpers";
|
||||||
|
|
||||||
|
class SampleTrader implements IPreSptLoadMod, IPostDBLoadMod
|
||||||
|
{
|
||||||
|
private mod: string;
|
||||||
|
private logger: ILogger;
|
||||||
|
private traderHelper: TraderHelper;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.mod = "acidphantasm-131AddTraderWithAssortJSON"; // Set name of mod so we can log it to console later - match this to your folder name that's built for \user\mods\
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some work needs to be done prior to SPT code being loaded, registering the profile image + setting trader update time inside the trader config json
|
||||||
|
* @param container Dependency container
|
||||||
|
*/
|
||||||
|
public preSptLoad(container: DependencyContainer): void
|
||||||
|
{
|
||||||
|
// Get a logger
|
||||||
|
this.logger = container.resolve<ILogger>("WinstonLogger");
|
||||||
|
this.logger.debug(`[${this.mod}] preSpt Loading... `);
|
||||||
|
|
||||||
|
// Get SPT code/data we need later
|
||||||
|
const preSptModLoader: PreSptModLoader = container.resolve<PreSptModLoader>("PreSptModLoader");
|
||||||
|
const imageRouter: ImageRouter = container.resolve<ImageRouter>("ImageRouter");
|
||||||
|
const configServer = container.resolve<ConfigServer>("ConfigServer");
|
||||||
|
const traderConfig: ITraderConfig = configServer.getConfig<ITraderConfig>(ConfigTypes.TRADER);
|
||||||
|
const ragfairConfig = configServer.getConfig<IRagfairConfig>(ConfigTypes.RAGFAIR);
|
||||||
|
|
||||||
|
// Create helper class and use it to register our traders image/icon + set its stock refresh time
|
||||||
|
this.traderHelper = new TraderHelper();
|
||||||
|
this.traderHelper.registerProfileImage(baseJson, this.mod, preSptModLoader, imageRouter, "cat.jpg");
|
||||||
|
this.traderHelper.setTraderUpdateTime(traderConfig, baseJson, 3600, 4000);
|
||||||
|
|
||||||
|
// Add trader to trader enum
|
||||||
|
Traders[baseJson._id] = baseJson._id;
|
||||||
|
|
||||||
|
// Add trader to flea market
|
||||||
|
ragfairConfig.traders[baseJson._id] = true;
|
||||||
|
|
||||||
|
this.logger.debug(`[${this.mod}] preSpt Loaded`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Majority of trader-related work occurs after the spt database has been loaded but prior to SPT code being run
|
||||||
|
* @param container Dependency container
|
||||||
|
*/
|
||||||
|
public postDBLoad(container: DependencyContainer): void
|
||||||
|
{
|
||||||
|
this.logger.debug(`[${this.mod}] postDb Loading... `);
|
||||||
|
|
||||||
|
// Resolve SPT classes we'll use
|
||||||
|
const databaseServer: DatabaseServer = container.resolve<DatabaseServer>("DatabaseServer");
|
||||||
|
const jsonUtil: JsonUtil = container.resolve<JsonUtil>("JsonUtil");
|
||||||
|
|
||||||
|
// Get a reference to the database tables
|
||||||
|
const tables = databaseServer.getTables();
|
||||||
|
|
||||||
|
// Add new trader to the trader dictionary in DatabaseServer - this is where the assort json is loaded
|
||||||
|
/*
|
||||||
|
* The assortJSON includes the following:
|
||||||
|
* Milk available for roubles at LL1
|
||||||
|
* Milk available for item barter at LL1
|
||||||
|
* Helmet w/ soft armour available for roubles at LL1
|
||||||
|
* Helmet w/ soft armour available for item barter at LL1
|
||||||
|
*
|
||||||
|
* It is *highly recommended* to use MongoIDs for the IDs in the assort, this example does not in order to make it easier to understand.
|
||||||
|
*/
|
||||||
|
this.traderHelper.addTraderToDb(baseJson, tables, jsonUtil, assortJson);
|
||||||
|
this.traderHelper.addTraderToLocales(baseJson, tables, baseJson.name, "Cat", baseJson.nickname, baseJson.location, "This is the cat shop");
|
||||||
|
|
||||||
|
this.logger.debug(`[${this.mod}] postDb Loaded`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const mod = new SampleTrader();
|
91
TypeScript/13.1AddTraderWithAssortJSON/src/traderHelpers.ts
Normal file
91
TypeScript/13.1AddTraderWithAssortJSON/src/traderHelpers.ts
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
import { PreSptModLoader } from "@spt/loaders/PreSptModLoader";
|
||||||
|
import { ITraderBase, ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
|
||||||
|
import { ITraderConfig, UpdateTime } from "@spt/models/spt/config/ITraderConfig";
|
||||||
|
import { IDatabaseTables } from "@spt/models/spt/server/IDatabaseTables";
|
||||||
|
import { ImageRouter } from "@spt/routers/ImageRouter";
|
||||||
|
import { JsonUtil } from "@spt/utils/JsonUtil";
|
||||||
|
|
||||||
|
export class TraderHelper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Add profile picture to our trader
|
||||||
|
* @param baseJson json file for trader (db/base.json)
|
||||||
|
* @param modName mod folder name
|
||||||
|
* @param preSptModLoader 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 traderImageName Filename of the trader icon to use
|
||||||
|
*/
|
||||||
|
public registerProfileImage(baseJson: any, modName: string, preSptModLoader: PreSptModLoader, imageRouter: ImageRouter, traderImageName: string): void
|
||||||
|
{
|
||||||
|
// Reference the mod "res" folder
|
||||||
|
const imageFilepath = `./${preSptModLoader.getModPath(modName)}res`;
|
||||||
|
|
||||||
|
// Register a route to point to the profile picture - remember to remove the .jpg from it
|
||||||
|
imageRouter.addRoute(baseJson.avatar.replace(".jpg", ""), `${imageFilepath}/${traderImageName}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add record to trader config to set the refresh time of trader in seconds (default is 60 minutes)
|
||||||
|
* @param traderConfig trader config to add our trader to
|
||||||
|
* @param baseJson json file for trader (db/base.json)
|
||||||
|
* @param refreshTimeSecondsMin How many seconds between trader stock refresh min time
|
||||||
|
* @param refreshTimeSecondsMax How many seconds between trader stock refresh max time
|
||||||
|
*/
|
||||||
|
public setTraderUpdateTime(traderConfig: ITraderConfig, baseJson: any, refreshTimeSecondsMin: number, refreshTimeSecondsMax: number): void
|
||||||
|
{
|
||||||
|
// Add refresh time in seconds to config
|
||||||
|
const traderRefreshRecord: UpdateTime = {
|
||||||
|
traderId: baseJson._id,
|
||||||
|
seconds: {
|
||||||
|
min: refreshTimeSecondsMin,
|
||||||
|
max: refreshTimeSecondsMax,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
traderConfig.updateTime.push(traderRefreshRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add our new trader to the database
|
||||||
|
* @param traderDetailsToAdd trader details
|
||||||
|
* @param tables database
|
||||||
|
* @param jsonUtil json utility class
|
||||||
|
*/
|
||||||
|
public addTraderToDb(traderDetailsToAdd: any, tables: IDatabaseTables, jsonUtil: JsonUtil, assortJson : any): void
|
||||||
|
{
|
||||||
|
// Add trader to trader table, key is the traders id
|
||||||
|
tables.traders[traderDetailsToAdd._id] = {
|
||||||
|
assort: jsonUtil.deserialize(jsonUtil.serialize(assortJson)) as ITraderAssort, // Deserialise/serialise creates a copy of the json and allows us to cast it as an ITraderAssort
|
||||||
|
base: jsonUtil.deserialize(jsonUtil.serialize(traderDetailsToAdd)) as ITraderBase, // Deserialise/serialise creates a copy of the json and allows us to cast it as an ITraderBase
|
||||||
|
questassort: {
|
||||||
|
started: {},
|
||||||
|
success: {},
|
||||||
|
fail: {},
|
||||||
|
}, // questassort is empty as trader has no assorts unlocked by quests
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add traders name/location/description to the locale table
|
||||||
|
* @param baseJson json file for trader (db/base.json)
|
||||||
|
* @param tables database tables
|
||||||
|
* @param fullName Complete name of trader
|
||||||
|
* @param firstName First name of trader
|
||||||
|
* @param nickName Nickname of trader
|
||||||
|
* @param location Location of trader (e.g. "Here in the cat shop")
|
||||||
|
* @param description Description of trader
|
||||||
|
*/
|
||||||
|
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
|
||||||
|
const locales = Object.values(tables.locales.global);
|
||||||
|
|
||||||
|
for (const locale of locales) {
|
||||||
|
locale[`${baseJson._id} FullName`] = fullName;
|
||||||
|
locale[`${baseJson._id} FirstName`] = firstName;
|
||||||
|
locale[`${baseJson._id} Nickname`] = nickName;
|
||||||
|
locale[`${baseJson._id} Location`] = location;
|
||||||
|
locale[`${baseJson._id} Description`] = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
TypeScript/13.1AddTraderWithAssortJSON/tsconfig.json
Normal file
18
TypeScript/13.1AddTraderWithAssortJSON/tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"module": "NodeNext",
|
||||||
|
"target": "ES2022",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"downlevelIteration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"outDir": "tmp",
|
||||||
|
"paths": {
|
||||||
|
"@spt/*": ["./types/*"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules", "dist", "tmp"],
|
||||||
|
}
|
6
TypeScript/13.1AddTraderWithAssortJSON/types/ErrorHandler.d.ts
vendored
Normal file
6
TypeScript/13.1AddTraderWithAssortJSON/types/ErrorHandler.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export declare class ErrorHandler {
|
||||||
|
private logger;
|
||||||
|
private readLine;
|
||||||
|
constructor();
|
||||||
|
handleCriticalError(err: Error): void;
|
||||||
|
}
|
5
TypeScript/13.1AddTraderWithAssortJSON/types/Program.d.ts
vendored
Normal file
5
TypeScript/13.1AddTraderWithAssortJSON/types/Program.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export declare class Program {
|
||||||
|
private errorHandler;
|
||||||
|
constructor();
|
||||||
|
start(): Promise<void>;
|
||||||
|
}
|
21
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/AchievementCallbacks.d.ts
vendored
Normal file
21
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/AchievementCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import { AchievementController } from "@spt/controllers/AchievementController";
|
||||||
|
import { ProfileController } from "@spt/controllers/ProfileController";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { ICompletedAchievementsResponse } from "@spt/models/eft/profile/ICompletedAchievementsResponse";
|
||||||
|
import { IGetAchievementsResponse } from "@spt/models/eft/profile/IGetAchievementsResponse";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class AchievementCallbacks {
|
||||||
|
protected achievementController: AchievementController;
|
||||||
|
protected profileController: ProfileController;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
constructor(achievementController: AchievementController, profileController: ProfileController, httpResponse: HttpResponseUtil);
|
||||||
|
/**
|
||||||
|
* Handle client/achievement/list
|
||||||
|
*/
|
||||||
|
getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetAchievementsResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/achievement/statistic
|
||||||
|
*/
|
||||||
|
statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ICompletedAchievementsResponse>;
|
||||||
|
}
|
43
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/BotCallbacks.d.ts
vendored
Normal file
43
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/BotCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import { BotController } from "@spt/controllers/BotController";
|
||||||
|
import { IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { Difficulties } from "@spt/models/eft/common/tables/IBotType";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class BotCallbacks {
|
||||||
|
protected botController: BotController;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
constructor(botController: BotController, httpResponse: HttpResponseUtil);
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/bot/limit
|
||||||
|
* Is called by client to define each bot roles wave limit
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/bot/difficulty
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/bot/difficulties
|
||||||
|
* @returns dictionary of every bot and its diffiulty settings
|
||||||
|
*/
|
||||||
|
getAllBotDifficulties(url: string, info: IEmptyRequestData, sessionID: string): Record<string, Difficulties>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/bot/generate
|
||||||
|
* @returns IGetBodyResponseData
|
||||||
|
*/
|
||||||
|
generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): Promise<IGetBodyResponseData<IBotBase[]>>;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/bot/maxCap
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
getBotCap(url: string, info: any, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/bot/getBotBehaviours
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
getBotBehaviours(): string;
|
||||||
|
}
|
34
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/BuildsCallbacks.d.ts
vendored
Normal file
34
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/BuildsCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { BuildController } from "@spt/controllers/BuildController";
|
||||||
|
import { ISetMagazineRequest } from "@spt/models/eft/builds/ISetMagazineRequest";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||||
|
import { IPresetBuildActionRequestData } from "@spt/models/eft/presetBuild/IPresetBuildActionRequestData";
|
||||||
|
import { IRemoveBuildRequestData } from "@spt/models/eft/presetBuild/IRemoveBuildRequestData";
|
||||||
|
import { IUserBuilds } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class BuildsCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected buildController: BuildController;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, buildController: BuildController);
|
||||||
|
/**
|
||||||
|
* Handle client/builds/list
|
||||||
|
*/
|
||||||
|
getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IUserBuilds>;
|
||||||
|
/**
|
||||||
|
* Handle client/builds/magazine/save
|
||||||
|
*/
|
||||||
|
createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle client/builds/weapon/save
|
||||||
|
*/
|
||||||
|
setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle client/builds/equipment/save
|
||||||
|
*/
|
||||||
|
setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle client/builds/delete
|
||||||
|
*/
|
||||||
|
deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData;
|
||||||
|
}
|
16
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/BundleCallbacks.d.ts
vendored
Normal file
16
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/BundleCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { BundleLoader } from "@spt/loaders/BundleLoader";
|
||||||
|
import { IHttpConfig } from "@spt/models/spt/config/IHttpConfig";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class BundleCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected bundleLoader: BundleLoader;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected httpConfig: IHttpConfig;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, bundleLoader: BundleLoader, configServer: ConfigServer);
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/bundles
|
||||||
|
*/
|
||||||
|
getBundles(url: string, info: any, sessionID: string): string;
|
||||||
|
getBundle(url: string, info: any, sessionID: string): string;
|
||||||
|
}
|
28
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/ClientLogCallbacks.d.ts
vendored
Normal file
28
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/ClientLogCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { ClientLogController } from "@spt/controllers/ClientLogController";
|
||||||
|
import { ModLoadOrder } from "@spt/loaders/ModLoadOrder";
|
||||||
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||||
|
import { IClientLogRequest } from "@spt/models/spt/logging/IClientLogRequest";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
/** Handle client logging related events */
|
||||||
|
export declare class ClientLogCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected clientLogController: ClientLogController;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected modLoadOrder: ModLoadOrder;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, clientLogController: ClientLogController, configServer: ConfigServer, localisationService: LocalisationService, modLoadOrder: ModLoadOrder);
|
||||||
|
/**
|
||||||
|
* Handle /singleplayer/log
|
||||||
|
*/
|
||||||
|
clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle /singleplayer/release
|
||||||
|
*/
|
||||||
|
releaseNotes(): string;
|
||||||
|
/**
|
||||||
|
* Handle /singleplayer/enableBSGlogging
|
||||||
|
*/
|
||||||
|
bsgLogging(): string;
|
||||||
|
}
|
35
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/CustomizationCallbacks.d.ts
vendored
Normal file
35
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/CustomizationCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import { CustomizationController } from "@spt/controllers/CustomizationController";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { ISuit } from "@spt/models/eft/common/tables/ITrader";
|
||||||
|
import { IBuyClothingRequestData } from "@spt/models/eft/customization/IBuyClothingRequestData";
|
||||||
|
import { IGetSuitsResponse } from "@spt/models/eft/customization/IGetSuitsResponse";
|
||||||
|
import { IWearClothingRequestData } from "@spt/models/eft/customization/IWearClothingRequestData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class CustomizationCallbacks {
|
||||||
|
protected customizationController: CustomizationController;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
constructor(customizationController: CustomizationController, saveServer: SaveServer, httpResponse: HttpResponseUtil);
|
||||||
|
/**
|
||||||
|
* Handle client/trading/customization/storage
|
||||||
|
* @returns IGetSuitsResponse
|
||||||
|
*/
|
||||||
|
getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetSuitsResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/trading/customization
|
||||||
|
* @returns ISuit[]
|
||||||
|
*/
|
||||||
|
getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ISuit[]>;
|
||||||
|
/**
|
||||||
|
* Handle CustomizationWear event
|
||||||
|
*/
|
||||||
|
wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle CustomizationBuy event
|
||||||
|
*/
|
||||||
|
buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
}
|
89
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/DataCallbacks.d.ts
vendored
Normal file
89
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/DataCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
import { HideoutController } from "@spt/controllers/HideoutController";
|
||||||
|
import { RagfairController } from "@spt/controllers/RagfairController";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IGlobals } from "@spt/models/eft/common/IGlobals";
|
||||||
|
import { ICustomizationItem } from "@spt/models/eft/common/tables/ICustomizationItem";
|
||||||
|
import { IHandbookBase } from "@spt/models/eft/common/tables/IHandbookBase";
|
||||||
|
import { IGetItemPricesResponse } from "@spt/models/eft/game/IGetItemPricesResponse";
|
||||||
|
import { IHideoutArea } from "@spt/models/eft/hideout/IHideoutArea";
|
||||||
|
import { IHideoutProduction } from "@spt/models/eft/hideout/IHideoutProduction";
|
||||||
|
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
|
||||||
|
import { IHideoutSettingsBase } from "@spt/models/eft/hideout/IHideoutSettingsBase";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { ISettingsBase } from "@spt/models/spt/server/ISettingsBase";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
/**
|
||||||
|
* Handle client requests
|
||||||
|
*/
|
||||||
|
export declare class DataCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected ragfairController: RagfairController;
|
||||||
|
protected hideoutController: HideoutController;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, traderHelper: TraderHelper, databaseService: DatabaseService, ragfairController: RagfairController, hideoutController: HideoutController);
|
||||||
|
/**
|
||||||
|
* Handle client/settings
|
||||||
|
* @returns ISettingsBase
|
||||||
|
*/
|
||||||
|
getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ISettingsBase>;
|
||||||
|
/**
|
||||||
|
* Handle client/globals
|
||||||
|
* @returns IGlobals
|
||||||
|
*/
|
||||||
|
getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGlobals>;
|
||||||
|
/**
|
||||||
|
* Handle client/items
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle client/handbook/templates
|
||||||
|
* @returns IHandbookBase
|
||||||
|
*/
|
||||||
|
getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHandbookBase>;
|
||||||
|
/**
|
||||||
|
* Handle client/customization
|
||||||
|
* @returns Record<string, ICustomizationItem
|
||||||
|
*/
|
||||||
|
getTemplateSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, ICustomizationItem>>;
|
||||||
|
/**
|
||||||
|
* Handle client/account/customization
|
||||||
|
* @returns string[]
|
||||||
|
*/
|
||||||
|
getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/hideout/settings
|
||||||
|
* @returns IHideoutSettingsBase
|
||||||
|
*/
|
||||||
|
getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutSettingsBase>;
|
||||||
|
getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutArea[]>;
|
||||||
|
gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutProduction[]>;
|
||||||
|
getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutScavCase[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/languages
|
||||||
|
*/
|
||||||
|
getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, string>>;
|
||||||
|
/**
|
||||||
|
* Handle client/menu/locale
|
||||||
|
*/
|
||||||
|
getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string>;
|
||||||
|
/**
|
||||||
|
* Handle client/locale
|
||||||
|
*/
|
||||||
|
getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle client/hideout/qte/list
|
||||||
|
*/
|
||||||
|
getQteList(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle client/items/prices/
|
||||||
|
* Called when viewing a traders assorts
|
||||||
|
* TODO - fully implement this
|
||||||
|
*/
|
||||||
|
getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetItemPricesResponse>;
|
||||||
|
}
|
111
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/DialogueCallbacks.d.ts
vendored
Normal file
111
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/DialogueCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
import { DialogueController } from "@spt/controllers/DialogueController";
|
||||||
|
import { OnUpdate } from "@spt/di/OnUpdate";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IUIDRequestData } from "@spt/models/eft/common/request/IUIDRequestData";
|
||||||
|
import { IAcceptFriendRequestData, ICancelFriendRequestData, IDeclineFriendRequestData } from "@spt/models/eft/dialog/IAcceptFriendRequestData";
|
||||||
|
import { IAddUserGroupMailRequest } from "@spt/models/eft/dialog/IAddUserGroupMailRequest";
|
||||||
|
import { IChangeGroupMailOwnerRequest } from "@spt/models/eft/dialog/IChangeGroupMailOwnerRequest";
|
||||||
|
import { IChatServer } from "@spt/models/eft/dialog/IChatServer";
|
||||||
|
import { IClearMailMessageRequest } from "@spt/models/eft/dialog/IClearMailMessageRequest";
|
||||||
|
import { ICreateGroupMailRequest } from "@spt/models/eft/dialog/ICreateGroupMailRequest";
|
||||||
|
import { IDeleteFriendRequest } from "@spt/models/eft/dialog/IDeleteFriendRequest";
|
||||||
|
import { IFriendRequestData } from "@spt/models/eft/dialog/IFriendRequestData";
|
||||||
|
import { IFriendRequestSendResponse } from "@spt/models/eft/dialog/IFriendRequestSendResponse";
|
||||||
|
import { IGetAllAttachmentsRequestData } from "@spt/models/eft/dialog/IGetAllAttachmentsRequestData";
|
||||||
|
import { IGetAllAttachmentsResponse } from "@spt/models/eft/dialog/IGetAllAttachmentsResponse";
|
||||||
|
import { IGetChatServerListRequestData } from "@spt/models/eft/dialog/IGetChatServerListRequestData";
|
||||||
|
import { IGetFriendListDataResponse } from "@spt/models/eft/dialog/IGetFriendListDataResponse";
|
||||||
|
import { IGetMailDialogInfoRequestData } from "@spt/models/eft/dialog/IGetMailDialogInfoRequestData";
|
||||||
|
import { IGetMailDialogListRequestData } from "@spt/models/eft/dialog/IGetMailDialogListRequestData";
|
||||||
|
import { IGetMailDialogViewRequestData } from "@spt/models/eft/dialog/IGetMailDialogViewRequestData";
|
||||||
|
import { IGetMailDialogViewResponseData } from "@spt/models/eft/dialog/IGetMailDialogViewResponseData";
|
||||||
|
import { IPinDialogRequestData } from "@spt/models/eft/dialog/IPinDialogRequestData";
|
||||||
|
import { IRemoveDialogRequestData } from "@spt/models/eft/dialog/IRemoveDialogRequestData";
|
||||||
|
import { IRemoveMailMessageRequest } from "@spt/models/eft/dialog/IRemoveMailMessageRequest";
|
||||||
|
import { IRemoveUserGroupMailRequest } from "@spt/models/eft/dialog/IRemoveUserGroupMailRequest";
|
||||||
|
import { ISendMessageRequest } from "@spt/models/eft/dialog/ISendMessageRequest";
|
||||||
|
import { ISetDialogReadRequestData } from "@spt/models/eft/dialog/ISetDialogReadRequestData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||||
|
import { DialogueInfo } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class DialogueCallbacks implements OnUpdate {
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected dialogueController: DialogueController;
|
||||||
|
constructor(hashUtil: HashUtil, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, dialogueController: DialogueController);
|
||||||
|
/**
|
||||||
|
* Handle client/friend/list
|
||||||
|
* @returns IGetFriendListDataResponse
|
||||||
|
*/
|
||||||
|
getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetFriendListDataResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/chatServer/list
|
||||||
|
* @returns IChatServer[]
|
||||||
|
*/
|
||||||
|
getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData<IChatServer[]>;
|
||||||
|
/** Handle client/mail/dialog/list */
|
||||||
|
getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData<DialogueInfo[]>;
|
||||||
|
/** Handle client/mail/dialog/view */
|
||||||
|
getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData<IGetMailDialogViewResponseData>;
|
||||||
|
/** Handle client/mail/dialog/info */
|
||||||
|
getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData<DialogueInfo>;
|
||||||
|
/** Handle client/mail/dialog/remove */
|
||||||
|
removeDialog(url: string, info: IRemoveDialogRequestData, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
/** Handle client/mail/dialog/pin */
|
||||||
|
pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
/** Handle client/mail/dialog/unpin */
|
||||||
|
unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
/** Handle client/mail/dialog/read */
|
||||||
|
setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/mail/dialog/getAllAttachments
|
||||||
|
* @returns IGetAllAttachmentsResponse
|
||||||
|
*/
|
||||||
|
getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData<IGetAllAttachmentsResponse | undefined>;
|
||||||
|
/** Handle client/mail/msg/send */
|
||||||
|
sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData<string>;
|
||||||
|
/** Handle client/friend/request/list/outbox */
|
||||||
|
listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/friend/request/list/inbox
|
||||||
|
*/
|
||||||
|
listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/friend/request/send
|
||||||
|
*/
|
||||||
|
sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData<IFriendRequestSendResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/friend/request/accept-all
|
||||||
|
*/
|
||||||
|
acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle client/friend/request/accept
|
||||||
|
*/
|
||||||
|
acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>;
|
||||||
|
/**
|
||||||
|
* Handle client/friend/request/decline
|
||||||
|
*/
|
||||||
|
declineFriendRequest(url: string, request: IDeclineFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>;
|
||||||
|
/**
|
||||||
|
* Handle client/friend/request/cancel
|
||||||
|
*/
|
||||||
|
cancelFriendRequest(url: string, request: ICancelFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** Handle client/friend/delete */
|
||||||
|
deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData;
|
||||||
|
/** Handle client/friend/ignore/set */
|
||||||
|
ignoreFriend(url: string, request: IUIDRequestData, sessionID: string): INullResponseData;
|
||||||
|
/** Handle client/friend/ignore/remove */
|
||||||
|
unIgnoreFriend(url: string, request: IUIDRequestData, sessionID: string): INullResponseData;
|
||||||
|
clearMail(url: string, request: IClearMailMessageRequest, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
removeMail(url: string, request: IRemoveMailMessageRequest, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
createGroupMail(url: string, info: ICreateGroupMailRequest, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
changeMailGroupOwner(url: string, info: IChangeGroupMailOwnerRequest, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
addUserToMail(url: string, info: IAddUserGroupMailRequest, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
removeUserFromMail(url: string, info: IRemoveUserGroupMailRequest, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
onUpdate(timeSinceLastRun: number): Promise<boolean>;
|
||||||
|
getRoute(): string;
|
||||||
|
}
|
85
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/GameCallbacks.d.ts
vendored
Normal file
85
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/GameCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
import { GameController } from "@spt/controllers/GameController";
|
||||||
|
import { OnLoad } from "@spt/di/OnLoad";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IUIDRequestData } from "@spt/models/eft/common/request/IUIDRequestData";
|
||||||
|
import { ICheckVersionResponse } from "@spt/models/eft/game/ICheckVersionResponse";
|
||||||
|
import { ICurrentGroupResponse } from "@spt/models/eft/game/ICurrentGroupResponse";
|
||||||
|
import { IGameConfigResponse } from "@spt/models/eft/game/IGameConfigResponse";
|
||||||
|
import { IGameEmptyCrcRequestData } from "@spt/models/eft/game/IGameEmptyCrcRequestData";
|
||||||
|
import { IGameKeepAliveResponse } from "@spt/models/eft/game/IGameKeepAliveResponse";
|
||||||
|
import { IGameLogoutResponseData } from "@spt/models/eft/game/IGameLogoutResponseData";
|
||||||
|
import { IGameModeRequestData } from "@spt/models/eft/game/IGameModeRequestData";
|
||||||
|
import { IGameModeResponse } from "@spt/models/eft/game/IGameModeResponse";
|
||||||
|
import { IGameStartResponse } from "@spt/models/eft/game/IGameStartResponse";
|
||||||
|
import { IGetRaidTimeRequest } from "@spt/models/eft/game/IGetRaidTimeRequest";
|
||||||
|
import { IGetRaidTimeResponse } from "@spt/models/eft/game/IGetRaidTimeResponse";
|
||||||
|
import { IServerDetails } from "@spt/models/eft/game/IServerDetails";
|
||||||
|
import { IVersionValidateRequestData } from "@spt/models/eft/game/IVersionValidateRequestData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { Watermark } from "@spt/utils/Watermark";
|
||||||
|
export declare class GameCallbacks implements OnLoad {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected watermark: Watermark;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected gameController: GameController;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, watermark: Watermark, saveServer: SaveServer, gameController: GameController);
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
getRoute(): string;
|
||||||
|
/**
|
||||||
|
* Handle client/game/version/validate
|
||||||
|
* @returns INullResponseData
|
||||||
|
*/
|
||||||
|
versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle client/game/start
|
||||||
|
* @returns IGameStartResponse
|
||||||
|
*/
|
||||||
|
gameStart(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGameStartResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/logout
|
||||||
|
* Save profiles on game close
|
||||||
|
* @returns IGameLogoutResponseData
|
||||||
|
*/
|
||||||
|
gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGameLogoutResponseData>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/config
|
||||||
|
* @returns IGameConfigResponse
|
||||||
|
*/
|
||||||
|
getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData<IGameConfigResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/mode
|
||||||
|
* @returns IGameModeResponse
|
||||||
|
*/
|
||||||
|
getGameMode(url: string, info: IGameModeRequestData, sessionID: string): IGetBodyResponseData<IGameModeResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/server/list
|
||||||
|
*/
|
||||||
|
getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IServerDetails[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/match/group/current
|
||||||
|
*/
|
||||||
|
getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ICurrentGroupResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/checkVersion
|
||||||
|
*/
|
||||||
|
validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ICheckVersionResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/keepalive
|
||||||
|
* @returns IGameKeepAliveResponse
|
||||||
|
*/
|
||||||
|
gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGameKeepAliveResponse>;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/version
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
getVersion(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
reportNickname(url: string, info: IUIDRequestData, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/getRaidTime
|
||||||
|
* @returns string
|
||||||
|
*/
|
||||||
|
getRaidTime(url: string, request: IGetRaidTimeRequest, sessionID: string): IGetRaidTimeResponse;
|
||||||
|
}
|
8
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/HandbookCallbacks.d.ts
vendored
Normal file
8
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/HandbookCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { HandbookController } from "@spt/controllers/HandbookController";
|
||||||
|
import { OnLoad } from "@spt/di/OnLoad";
|
||||||
|
export declare class HandbookCallbacks implements OnLoad {
|
||||||
|
protected handbookController: HandbookController;
|
||||||
|
constructor(handbookController: HandbookController);
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
getRoute(): string;
|
||||||
|
}
|
48
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/HealthCallbacks.d.ts
vendored
Normal file
48
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/HealthCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { HealthController } from "@spt/controllers/HealthController";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IHealthTreatmentRequestData } from "@spt/models/eft/health/IHealthTreatmentRequestData";
|
||||||
|
import { IOffraidEatRequestData } from "@spt/models/eft/health/IOffraidEatRequestData";
|
||||||
|
import { IOffraidHealRequestData } from "@spt/models/eft/health/IOffraidHealRequestData";
|
||||||
|
import { ISyncHealthRequestData } from "@spt/models/eft/health/ISyncHealthRequestData";
|
||||||
|
import { IWorkoutData } from "@spt/models/eft/health/IWorkoutData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class HealthCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected healthController: HealthController;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, healthController: HealthController);
|
||||||
|
/**
|
||||||
|
* Custom spt server request found in modules/HealthSynchronizer.cs
|
||||||
|
* @param url
|
||||||
|
* @param info HealthListener.Instance.CurrentHealth class
|
||||||
|
* @param sessionID session id
|
||||||
|
* @returns empty response, no data sent back to client
|
||||||
|
*/
|
||||||
|
syncHealth(url: string, info: ISyncHealthRequestData, sessionID: string): IGetBodyResponseData<string>;
|
||||||
|
/**
|
||||||
|
* Custom spt server request found in modules/QTEPatch.cs
|
||||||
|
* @param url
|
||||||
|
* @param info HealthListener.Instance.CurrentHealth class
|
||||||
|
* @param sessionID session id
|
||||||
|
* @returns empty response, no data sent back to client
|
||||||
|
*/
|
||||||
|
handleWorkoutEffects(url: string, info: IWorkoutData, sessionID: string): IGetBodyResponseData<string>;
|
||||||
|
/**
|
||||||
|
* Handle Eat
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
offraidEat(pmcData: IPmcData, body: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle Heal
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
offraidHeal(pmcData: IPmcData, body: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle RestoreHealth
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
}
|
80
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/HideoutCallbacks.d.ts
vendored
Normal file
80
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/HideoutCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import { HideoutController } from "@spt/controllers/HideoutController";
|
||||||
|
import { OnUpdate } from "@spt/di/OnUpdate";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IHandleQTEEventRequestData } from "@spt/models/eft/hideout/IHandleQTEEventRequestData";
|
||||||
|
import { IHideoutCancelProductionRequestData } from "@spt/models/eft/hideout/IHideoutCancelProductionRequestData";
|
||||||
|
import { IHideoutContinuousProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutContinuousProductionStartRequestData";
|
||||||
|
import { IHideoutImproveAreaRequestData } from "@spt/models/eft/hideout/IHideoutImproveAreaRequestData";
|
||||||
|
import { IHideoutPutItemInRequestData } from "@spt/models/eft/hideout/IHideoutPutItemInRequestData";
|
||||||
|
import { IHideoutScavCaseStartRequestData } from "@spt/models/eft/hideout/IHideoutScavCaseStartRequestData";
|
||||||
|
import { IHideoutSingleProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutSingleProductionStartRequestData";
|
||||||
|
import { IHideoutTakeItemOutRequestData } from "@spt/models/eft/hideout/IHideoutTakeItemOutRequestData";
|
||||||
|
import { IHideoutTakeProductionRequestData } from "@spt/models/eft/hideout/IHideoutTakeProductionRequestData";
|
||||||
|
import { IHideoutToggleAreaRequestData } from "@spt/models/eft/hideout/IHideoutToggleAreaRequestData";
|
||||||
|
import { IHideoutUpgradeCompleteRequestData } from "@spt/models/eft/hideout/IHideoutUpgradeCompleteRequestData";
|
||||||
|
import { IHideoutUpgradeRequestData } from "@spt/models/eft/hideout/IHideoutUpgradeRequestData";
|
||||||
|
import { IRecordShootingRangePoints } from "@spt/models/eft/hideout/IRecordShootingRangePoints";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
export declare class HideoutCallbacks implements OnUpdate {
|
||||||
|
protected hideoutController: HideoutController;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected hideoutConfig: IHideoutConfig;
|
||||||
|
constructor(hideoutController: HideoutController, // TODO: delay needed
|
||||||
|
configServer: ConfigServer);
|
||||||
|
/**
|
||||||
|
* Handle HideoutUpgrade event
|
||||||
|
*/
|
||||||
|
upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutUpgradeComplete event
|
||||||
|
*/
|
||||||
|
upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutPutItemsInAreaSlots
|
||||||
|
*/
|
||||||
|
putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutTakeItemsFromAreaSlots event
|
||||||
|
*/
|
||||||
|
takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutToggleArea event
|
||||||
|
*/
|
||||||
|
toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutSingleProductionStart event
|
||||||
|
*/
|
||||||
|
singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutScavCaseProductionStart event
|
||||||
|
*/
|
||||||
|
scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutContinuousProductionStart
|
||||||
|
*/
|
||||||
|
continuousProductionStart(pmcData: IPmcData, body: IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutTakeProduction event
|
||||||
|
*/
|
||||||
|
takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutQuickTimeEvent
|
||||||
|
*/
|
||||||
|
handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/items/moving - RecordShootingRangePoints
|
||||||
|
*/
|
||||||
|
recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/items/moving - RecordShootingRangePoints
|
||||||
|
*/
|
||||||
|
improveArea(pmcData: IPmcData, request: IHideoutImproveAreaRequestData, sessionId: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/items/moving - HideoutCancelProductionCommand
|
||||||
|
*/
|
||||||
|
cancelProduction(pmcData: IPmcData, request: IHideoutCancelProductionRequestData, sessionId: string): IItemEventRouterResponse;
|
||||||
|
onUpdate(timeSinceLastRun: number): Promise<boolean>;
|
||||||
|
getRoute(): string;
|
||||||
|
}
|
9
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/HttpCallbacks.d.ts
vendored
Normal file
9
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/HttpCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { OnLoad } from "@spt/di/OnLoad";
|
||||||
|
import { HttpServer } from "@spt/servers/HttpServer";
|
||||||
|
export declare class HttpCallbacks implements OnLoad {
|
||||||
|
protected httpServer: HttpServer;
|
||||||
|
constructor(httpServer: HttpServer);
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
getRoute(): string;
|
||||||
|
getImage(): string;
|
||||||
|
}
|
63
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/InraidCallbacks.d.ts
vendored
Normal file
63
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/InraidCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import { InraidController } from "@spt/controllers/InraidController";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||||
|
import { IItemDeliveryRequestData } from "@spt/models/eft/inRaid/IItemDeliveryRequestData";
|
||||||
|
import { IRegisterPlayerRequestData } from "@spt/models/eft/inRaid/IRegisterPlayerRequestData";
|
||||||
|
import { ISaveProgressRequestData } from "@spt/models/eft/inRaid/ISaveProgressRequestData";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
/**
|
||||||
|
* Handle client requests
|
||||||
|
*/
|
||||||
|
export declare class InraidCallbacks {
|
||||||
|
protected inraidController: InraidController;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
constructor(inraidController: InraidController, httpResponse: HttpResponseUtil);
|
||||||
|
/**
|
||||||
|
* Handle client/location/getLocalloot
|
||||||
|
* Store active map in profile + applicationContext
|
||||||
|
* @param url
|
||||||
|
* @param info register player request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns Null http response
|
||||||
|
*/
|
||||||
|
registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle raid/profile/save
|
||||||
|
* @param url
|
||||||
|
* @param info Save progress request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns Null http response
|
||||||
|
*/
|
||||||
|
saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/raid/endstate
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
getRaidEndState(): string;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/raid/menu
|
||||||
|
* @returns JSON as string
|
||||||
|
*/
|
||||||
|
getRaidMenuSettings(): string;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/airdrop/config
|
||||||
|
* @returns JSON as string
|
||||||
|
*/
|
||||||
|
getAirdropConfig(): string;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/btr/config
|
||||||
|
* @returns JSON as string
|
||||||
|
*/
|
||||||
|
getBTRConfig(): string;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/traderServices/getTraderServices
|
||||||
|
*/
|
||||||
|
getTraderServices(url: string, info: IEmptyRequestData, sessionId: string): string;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/traderServices/itemDelivery
|
||||||
|
*/
|
||||||
|
itemDelivery(url: string, request: IItemDeliveryRequestData, sessionId: string): INullResponseData;
|
||||||
|
getTraitorScavHostileChance(url: string, info: IEmptyRequestData, sessionId: string): string;
|
||||||
|
getSandboxMaxPatrolValue(url: string, info: IEmptyRequestData, sessionId: string): string;
|
||||||
|
getBossConvertSettings(url: string, info: IEmptyRequestData, sessionId: string): string;
|
||||||
|
}
|
32
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/InsuranceCallbacks.d.ts
vendored
Normal file
32
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/InsuranceCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { InsuranceController } from "@spt/controllers/InsuranceController";
|
||||||
|
import { OnUpdate } from "@spt/di/OnUpdate";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { IGetInsuranceCostRequestData } from "@spt/models/eft/insurance/IGetInsuranceCostRequestData";
|
||||||
|
import { IGetInsuranceCostResponseData } from "@spt/models/eft/insurance/IGetInsuranceCostResponseData";
|
||||||
|
import { IInsureRequestData } from "@spt/models/eft/insurance/IInsureRequestData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IInsuranceConfig } from "@spt/models/spt/config/IInsuranceConfig";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { InsuranceService } from "@spt/services/InsuranceService";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class InsuranceCallbacks implements OnUpdate {
|
||||||
|
protected insuranceController: InsuranceController;
|
||||||
|
protected insuranceService: InsuranceService;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected insuranceConfig: IInsuranceConfig;
|
||||||
|
constructor(insuranceController: InsuranceController, insuranceService: InsuranceService, httpResponse: HttpResponseUtil, configServer: ConfigServer);
|
||||||
|
/**
|
||||||
|
* Handle client/insurance/items/list/cost
|
||||||
|
* @returns IGetInsuranceCostResponseData
|
||||||
|
*/
|
||||||
|
getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData<IGetInsuranceCostResponseData>;
|
||||||
|
/**
|
||||||
|
* Handle Insure event
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
onUpdate(secondsSinceLastRun: number): Promise<boolean>;
|
||||||
|
getRoute(): string;
|
||||||
|
}
|
61
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/InventoryCallbacks.d.ts
vendored
Normal file
61
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/InventoryCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import { InventoryController } from "@spt/controllers/InventoryController";
|
||||||
|
import { QuestController } from "@spt/controllers/QuestController";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IInventoryBindRequestData } from "@spt/models/eft/inventory/IInventoryBindRequestData";
|
||||||
|
import { IInventoryCreateMarkerRequestData } from "@spt/models/eft/inventory/IInventoryCreateMarkerRequestData";
|
||||||
|
import { IInventoryDeleteMarkerRequestData } from "@spt/models/eft/inventory/IInventoryDeleteMarkerRequestData";
|
||||||
|
import { IInventoryEditMarkerRequestData } from "@spt/models/eft/inventory/IInventoryEditMarkerRequestData";
|
||||||
|
import { IInventoryExamineRequestData } from "@spt/models/eft/inventory/IInventoryExamineRequestData";
|
||||||
|
import { IInventoryFoldRequestData } from "@spt/models/eft/inventory/IInventoryFoldRequestData";
|
||||||
|
import { IInventoryMergeRequestData } from "@spt/models/eft/inventory/IInventoryMergeRequestData";
|
||||||
|
import { IInventoryMoveRequestData } from "@spt/models/eft/inventory/IInventoryMoveRequestData";
|
||||||
|
import { IInventoryReadEncyclopediaRequestData } from "@spt/models/eft/inventory/IInventoryReadEncyclopediaRequestData";
|
||||||
|
import { IInventoryRemoveRequestData } from "@spt/models/eft/inventory/IInventoryRemoveRequestData";
|
||||||
|
import { IInventorySortRequestData } from "@spt/models/eft/inventory/IInventorySortRequestData";
|
||||||
|
import { IInventorySplitRequestData } from "@spt/models/eft/inventory/IInventorySplitRequestData";
|
||||||
|
import { IInventorySwapRequestData } from "@spt/models/eft/inventory/IInventorySwapRequestData";
|
||||||
|
import { IInventoryTagRequestData } from "@spt/models/eft/inventory/IInventoryTagRequestData";
|
||||||
|
import { IInventoryToggleRequestData } from "@spt/models/eft/inventory/IInventoryToggleRequestData";
|
||||||
|
import { IInventoryTransferRequestData } from "@spt/models/eft/inventory/IInventoryTransferRequestData";
|
||||||
|
import { IOpenRandomLootContainerRequestData } from "@spt/models/eft/inventory/IOpenRandomLootContainerRequestData";
|
||||||
|
import { IRedeemProfileRequestData } from "@spt/models/eft/inventory/IRedeemProfileRequestData";
|
||||||
|
import { ISetFavoriteItems } from "@spt/models/eft/inventory/ISetFavoriteItems";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IFailQuestRequestData } from "@spt/models/eft/quests/IFailQuestRequestData";
|
||||||
|
export declare class InventoryCallbacks {
|
||||||
|
protected inventoryController: InventoryController;
|
||||||
|
protected questController: QuestController;
|
||||||
|
constructor(inventoryController: InventoryController, questController: QuestController);
|
||||||
|
/** Handle client/game/profile/items/moving Move event */
|
||||||
|
moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/** Handle Remove event */
|
||||||
|
removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/** Handle Split event */
|
||||||
|
splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
transferItem(pmcData: IPmcData, request: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/** Handle Swap */
|
||||||
|
swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/** Handle ReadEncyclopedia */
|
||||||
|
readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle ApplyInventoryChanges */
|
||||||
|
sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/** Handle OpenRandomLootContainer */
|
||||||
|
openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
redeemProfileReward(pmcData: IPmcData, body: IRedeemProfileRequestData, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
setFavoriteItem(pmcData: IPmcData, body: ISetFavoriteItems, sessionId: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* TODO - MOVE INTO QUEST CODE
|
||||||
|
* Handle game/profile/items/moving - QuestFail
|
||||||
|
*/
|
||||||
|
failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
}
|
19
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/ItemEventCallbacks.d.ts
vendored
Normal file
19
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/ItemEventCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { Warning } from "@spt/models/eft/itemEvent/IItemEventRouterBase";
|
||||||
|
import { IItemEventRouterRequest } from "@spt/models/eft/itemEvent/IItemEventRouterRequest";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { ItemEventRouter } from "@spt/routers/ItemEventRouter";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class ItemEventCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected itemEventRouter: ItemEventRouter;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, itemEventRouter: ItemEventRouter);
|
||||||
|
handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): Promise<IGetBodyResponseData<IItemEventRouterResponse>>;
|
||||||
|
/**
|
||||||
|
* Return true if the passed in list of warnings contains critical issues
|
||||||
|
* @param warnings The list of warnings to check for critical errors
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
private isCriticalError;
|
||||||
|
protected getErrorCode(warnings: Warning[]): number;
|
||||||
|
}
|
29
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/LauncherCallbacks.d.ts
vendored
Normal file
29
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/LauncherCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { LauncherController } from "@spt/controllers/LauncherController";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IChangeRequestData } from "@spt/models/eft/launcher/IChangeRequestData";
|
||||||
|
import { ILoginRequestData } from "@spt/models/eft/launcher/ILoginRequestData";
|
||||||
|
import { IRegisterData } from "@spt/models/eft/launcher/IRegisterData";
|
||||||
|
import { IRemoveProfileData } from "@spt/models/eft/launcher/IRemoveProfileData";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { Watermark } from "@spt/utils/Watermark";
|
||||||
|
export declare class LauncherCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected launcherController: LauncherController;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected watermark: Watermark;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, launcherController: LauncherController, saveServer: SaveServer, watermark: Watermark);
|
||||||
|
connect(): string;
|
||||||
|
login(url: string, info: ILoginRequestData, sessionID: string): string;
|
||||||
|
register(url: string, info: IRegisterData, sessionID: string): "FAILED" | "OK";
|
||||||
|
get(url: string, info: ILoginRequestData, sessionID: string): string;
|
||||||
|
changeUsername(url: string, info: IChangeRequestData, sessionID: string): "FAILED" | "OK";
|
||||||
|
changePassword(url: string, info: IChangeRequestData, sessionID: string): "FAILED" | "OK";
|
||||||
|
wipe(url: string, info: IRegisterData, sessionID: string): "FAILED" | "OK";
|
||||||
|
getServerVersion(): string;
|
||||||
|
ping(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
removeProfile(url: string, info: IRemoveProfileData, sessionID: string): string;
|
||||||
|
getCompatibleTarkovVersion(): string;
|
||||||
|
getLoadedServerMods(): string;
|
||||||
|
getServerModsProfileUsed(url: string, info: IEmptyRequestData, sessionId: string): string;
|
||||||
|
}
|
18
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/LocationCallbacks.d.ts
vendored
Normal file
18
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/LocationCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { LocationController } from "@spt/controllers/LocationController";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
|
||||||
|
import { ILocationsGenerateAllResponse } from "@spt/models/eft/common/ILocationsSourceDestinationBase";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { IGetLocationRequestData } from "@spt/models/eft/location/IGetLocationRequestData";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class LocationCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected locationController: LocationController;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, locationController: LocationController);
|
||||||
|
/** Handle client/locations */
|
||||||
|
getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ILocationsGenerateAllResponse>;
|
||||||
|
/** Handle client/location/getLocalloot */
|
||||||
|
getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData<ILocationBase>;
|
||||||
|
/** Handle client/location/getAirdropLoot */
|
||||||
|
getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
}
|
76
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/MatchCallbacks.d.ts
vendored
Normal file
76
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/MatchCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import { MatchController } from "@spt/controllers/MatchController";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||||
|
import { IEndOfflineRaidRequestData } from "@spt/models/eft/match/IEndOfflineRaidRequestData";
|
||||||
|
import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData";
|
||||||
|
import { IGroupCharacter } from "@spt/models/eft/match/IGroupCharacter";
|
||||||
|
import { IMatchGroupCurrentResponse } from "@spt/models/eft/match/IMatchGroupCurrentResponse";
|
||||||
|
import { IMatchGroupInviteSendRequest } from "@spt/models/eft/match/IMatchGroupInviteSendRequest";
|
||||||
|
import { IMatchGroupPlayerRemoveRequest } from "@spt/models/eft/match/IMatchGroupPlayerRemoveRequest";
|
||||||
|
import { IMatchGroupStartGameRequest } from "@spt/models/eft/match/IMatchGroupStartGameRequest";
|
||||||
|
import { IMatchGroupStatusRequest } from "@spt/models/eft/match/IMatchGroupStatusRequest";
|
||||||
|
import { IMatchGroupStatusResponse } from "@spt/models/eft/match/IMatchGroupStatusResponse";
|
||||||
|
import { IMatchGroupTransferRequest } from "@spt/models/eft/match/IMatchGroupTransferRequest";
|
||||||
|
import { IProfileStatusResponse } from "@spt/models/eft/match/IProfileStatusResponse";
|
||||||
|
import { IPutMetricsRequestData } from "@spt/models/eft/match/IPutMetricsRequestData";
|
||||||
|
import { IRequestIdRequest } from "@spt/models/eft/match/IRequestIdRequest";
|
||||||
|
import { IUpdatePingRequestData } from "@spt/models/eft/match/IUpdatePingRequestData";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { JsonUtil } from "@spt/utils/JsonUtil";
|
||||||
|
export declare class MatchCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected jsonUtil: JsonUtil;
|
||||||
|
protected matchController: MatchController;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, matchController: MatchController, databaseService: DatabaseService);
|
||||||
|
/** Handle client/match/updatePing */
|
||||||
|
updatePing(url: string, info: IUpdatePingRequestData, sessionID: string): INullResponseData;
|
||||||
|
exitMatch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData;
|
||||||
|
/** Handle client/match/group/exit_from_menu */
|
||||||
|
exitToMenu(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData;
|
||||||
|
groupCurrent(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IMatchGroupCurrentResponse>;
|
||||||
|
startGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData;
|
||||||
|
stopGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData;
|
||||||
|
/** Handle client/match/group/invite/send */
|
||||||
|
sendGroupInvite(url: string, info: IMatchGroupInviteSendRequest, sessionID: string): IGetBodyResponseData<string>;
|
||||||
|
/** Handle client/match/group/invite/accept */
|
||||||
|
acceptGroupInvite(url: string, info: IRequestIdRequest, sessionId: string): IGetBodyResponseData<IGroupCharacter[]>;
|
||||||
|
/** Handle client/match/group/invite/decline */
|
||||||
|
declineGroupInvite(url: string, info: IRequestIdRequest, sessionId: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** Handle client/match/group/invite/cancel */
|
||||||
|
cancelGroupInvite(url: string, info: IRequestIdRequest, sessionID: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** Handle client/match/group/transfer */
|
||||||
|
transferGroup(url: string, info: IMatchGroupTransferRequest, sessionId: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** Handle client/match/group/invite/cancel-all */
|
||||||
|
cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** @deprecated - not called on raid start/end or game start/exit */
|
||||||
|
putMetrics(url: string, info: IPutMetricsRequestData, sessionId: string): INullResponseData;
|
||||||
|
serverAvailable(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** Handle match/group/start_game */
|
||||||
|
joinMatch(url: string, info: IMatchGroupStartGameRequest, sessionID: string): IGetBodyResponseData<IProfileStatusResponse>;
|
||||||
|
/** Handle client/getMetricsConfig */
|
||||||
|
getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData<string>;
|
||||||
|
/**
|
||||||
|
* Called periodically while in a group
|
||||||
|
* Handle client/match/group/status
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
getGroupStatus(url: string, info: IMatchGroupStatusRequest, sessionID: string): IGetBodyResponseData<IMatchGroupStatusResponse>;
|
||||||
|
/** Handle client/match/group/delete */
|
||||||
|
deleteGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>;
|
||||||
|
leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** Handle client/match/group/player/remove */
|
||||||
|
removePlayerFromGroup(url: string, info: IMatchGroupPlayerRemoveRequest, sessionID: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** Handle client/match/offline/end */
|
||||||
|
endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData;
|
||||||
|
/** Handle client/raid/configuration */
|
||||||
|
getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData;
|
||||||
|
/** Handle client/raid/configuration-by-profile */
|
||||||
|
getConfigurationByProfile(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData;
|
||||||
|
/** Handle client/match/group/raid/ready */
|
||||||
|
raidReady(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData<boolean>;
|
||||||
|
/** Handle client/match/group/raid/not-ready */
|
||||||
|
notRaidReady(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData<boolean>;
|
||||||
|
}
|
20
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/ModCallbacks.d.ts
vendored
Normal file
20
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/ModCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { OnLoad } from "@spt/di/OnLoad";
|
||||||
|
import { PostSptModLoader } from "@spt/loaders/PostSptModLoader";
|
||||||
|
import { IHttpConfig } from "@spt/models/spt/config/IHttpConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { HttpFileUtil } from "@spt/utils/HttpFileUtil";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class ModCallbacks implements OnLoad {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected httpFileUtil: HttpFileUtil;
|
||||||
|
protected postSptModLoader: PostSptModLoader;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected httpConfig: IHttpConfig;
|
||||||
|
constructor(logger: ILogger, httpResponse: HttpResponseUtil, httpFileUtil: HttpFileUtil, postSptModLoader: PostSptModLoader, localisationService: LocalisationService, configServer: ConfigServer);
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
getRoute(): string;
|
||||||
|
}
|
14
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/NoteCallbacks.d.ts
vendored
Normal file
14
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/NoteCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { NoteController } from "@spt/controllers/NoteController";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { INoteActionData } from "@spt/models/eft/notes/INoteActionData";
|
||||||
|
export declare class NoteCallbacks {
|
||||||
|
protected noteController: NoteController;
|
||||||
|
constructor(noteController: NoteController);
|
||||||
|
/** Handle AddNote event */
|
||||||
|
addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle EditNote event */
|
||||||
|
editNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle DeleteNote event */
|
||||||
|
deleteNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
}
|
34
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/NotifierCallbacks.d.ts
vendored
Normal file
34
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/NotifierCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import { NotifierController } from "@spt/controllers/NotifierController";
|
||||||
|
import { HttpServerHelper } from "@spt/helpers/HttpServerHelper";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IUIDRequestData } from "@spt/models/eft/common/request/IUIDRequestData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { INotifierChannel } from "@spt/models/eft/notifier/INotifier";
|
||||||
|
import { ISelectProfileResponse } from "@spt/models/eft/notifier/ISelectProfileResponse";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { JsonUtil } from "@spt/utils/JsonUtil";
|
||||||
|
export declare class NotifierCallbacks {
|
||||||
|
protected httpServerHelper: HttpServerHelper;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected jsonUtil: JsonUtil;
|
||||||
|
protected notifierController: NotifierController;
|
||||||
|
constructor(httpServerHelper: HttpServerHelper, httpResponse: HttpResponseUtil, jsonUtil: JsonUtil, notifierController: NotifierController);
|
||||||
|
/**
|
||||||
|
* If we don't have anything to send, it's ok to not send anything back
|
||||||
|
* because notification requests can be long-polling. In fact, we SHOULD wait
|
||||||
|
* until we actually have something to send because otherwise we'd spam the client
|
||||||
|
* and the client would abort the connection due to spam.
|
||||||
|
*/
|
||||||
|
sendNotification(sessionID: string, req: any, resp: any, data: any): void;
|
||||||
|
/** Handle push/notifier/get */
|
||||||
|
/** Handle push/notifier/getwebsocket */
|
||||||
|
getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData<any[]>;
|
||||||
|
/** Handle client/notifier/channel/create */
|
||||||
|
createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<INotifierChannel>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/select
|
||||||
|
* @returns ISelectProfileResponse
|
||||||
|
*/
|
||||||
|
selectProfile(url: string, info: IUIDRequestData, sessionID: string): IGetBodyResponseData<ISelectProfileResponse>;
|
||||||
|
notify(url: string, info: any, sessionID: string): string;
|
||||||
|
}
|
8
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/PresetCallbacks.d.ts
vendored
Normal file
8
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/PresetCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { PresetController } from "@spt/controllers/PresetController";
|
||||||
|
import { OnLoad } from "@spt/di/OnLoad";
|
||||||
|
export declare class PresetCallbacks implements OnLoad {
|
||||||
|
protected presetController: PresetController;
|
||||||
|
constructor(presetController: PresetController);
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
getRoute(): string;
|
||||||
|
}
|
90
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/ProfileCallbacks.d.ts
vendored
Normal file
90
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/ProfileCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
import { ProfileController } from "@spt/controllers/ProfileController";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||||
|
import { IGetMiniProfileRequestData } from "@spt/models/eft/launcher/IGetMiniProfileRequestData";
|
||||||
|
import { GetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData";
|
||||||
|
import { ICreateProfileResponse } from "@spt/models/eft/profile/ICreateProfileResponse";
|
||||||
|
import { IGetOtherProfileRequest } from "@spt/models/eft/profile/IGetOtherProfileRequest";
|
||||||
|
import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse";
|
||||||
|
import { IGetProfileSettingsRequest } from "@spt/models/eft/profile/IGetProfileSettingsRequest";
|
||||||
|
import { IProfileChangeNicknameRequestData } from "@spt/models/eft/profile/IProfileChangeNicknameRequestData";
|
||||||
|
import { IProfileChangeVoiceRequestData } from "@spt/models/eft/profile/IProfileChangeVoiceRequestData";
|
||||||
|
import { IProfileCreateRequestData } from "@spt/models/eft/profile/IProfileCreateRequestData";
|
||||||
|
import { ISearchFriendRequestData } from "@spt/models/eft/profile/ISearchFriendRequestData";
|
||||||
|
import { ISearchFriendResponse } from "@spt/models/eft/profile/ISearchFriendResponse";
|
||||||
|
import { IValidateNicknameRequestData } from "@spt/models/eft/profile/IValidateNicknameRequestData";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
/** Handle profile related client events */
|
||||||
|
export declare class ProfileCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected profileController: ProfileController;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, timeUtil: TimeUtil, profileController: ProfileController, profileHelper: ProfileHelper);
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/create
|
||||||
|
*/
|
||||||
|
createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData<ICreateProfileResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/list
|
||||||
|
* Get the complete player profile (scav + pmc character)
|
||||||
|
*/
|
||||||
|
getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IPmcData[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/savage/regenerate
|
||||||
|
* Handle the creation of a scav profile for player
|
||||||
|
* Occurs post-raid and when profile first created immediately after character details are confirmed by player
|
||||||
|
* @param url
|
||||||
|
* @param info empty
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns Profile object
|
||||||
|
*/
|
||||||
|
regenerateScav(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IPmcData[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/voice/change event
|
||||||
|
*/
|
||||||
|
changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/nickname/change event
|
||||||
|
* Client allows player to adjust their profile name
|
||||||
|
*/
|
||||||
|
changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData<any>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/nickname/validate
|
||||||
|
*/
|
||||||
|
validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData<any>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/nickname/reserved
|
||||||
|
*/
|
||||||
|
getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string>;
|
||||||
|
/**
|
||||||
|
* Handle client/profile/status
|
||||||
|
* Called when creating a character when choosing a character face/voice
|
||||||
|
*/
|
||||||
|
getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<GetProfileStatusResponseData>;
|
||||||
|
/**
|
||||||
|
* Handle client/profile/view
|
||||||
|
* Called when viewing another players profile
|
||||||
|
*/
|
||||||
|
getOtherProfile(url: string, request: IGetOtherProfileRequest, sessionID: string): IGetBodyResponseData<IGetOtherProfileResponse>;
|
||||||
|
/**
|
||||||
|
* Handle client/profile/settings
|
||||||
|
*/
|
||||||
|
getProfileSettings(url: string, info: IGetProfileSettingsRequest, sessionId: string): IGetBodyResponseData<string>;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/search
|
||||||
|
*/
|
||||||
|
searchFriend(url: string, info: ISearchFriendRequestData, sessionID: string): IGetBodyResponseData<ISearchFriendResponse[]>;
|
||||||
|
/**
|
||||||
|
* Handle launcher/profile/info
|
||||||
|
*/
|
||||||
|
getMiniProfile(url: string, info: IGetMiniProfileRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle /launcher/profiles
|
||||||
|
*/
|
||||||
|
getAllMiniProfiles(url: string, info: IEmptyRequestData, sessionID: string): string;
|
||||||
|
}
|
44
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/QuestCallbacks.d.ts
vendored
Normal file
44
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/QuestCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import { QuestController } from "@spt/controllers/QuestController";
|
||||||
|
import { RepeatableQuestController } from "@spt/controllers/RepeatableQuestController";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IQuest } from "@spt/models/eft/common/tables/IQuest";
|
||||||
|
import { IPmcDataRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IAcceptQuestRequestData } from "@spt/models/eft/quests/IAcceptQuestRequestData";
|
||||||
|
import { ICompleteQuestRequestData } from "@spt/models/eft/quests/ICompleteQuestRequestData";
|
||||||
|
import { IHandoverQuestRequestData } from "@spt/models/eft/quests/IHandoverQuestRequestData";
|
||||||
|
import { IListQuestsRequestData } from "@spt/models/eft/quests/IListQuestsRequestData";
|
||||||
|
import { IRepeatableQuestChangeRequest } from "@spt/models/eft/quests/IRepeatableQuestChangeRequest";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class QuestCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected questController: QuestController;
|
||||||
|
protected repeatableQuestController: RepeatableQuestController;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, questController: QuestController, repeatableQuestController: RepeatableQuestController);
|
||||||
|
/**
|
||||||
|
* Handle RepeatableQuestChange event
|
||||||
|
*/
|
||||||
|
changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle QuestAccept event
|
||||||
|
*/
|
||||||
|
acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle QuestComplete event
|
||||||
|
*/
|
||||||
|
completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle QuestHandover event
|
||||||
|
*/
|
||||||
|
handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/quest/list
|
||||||
|
*/
|
||||||
|
listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData<IQuest[]>;
|
||||||
|
/**
|
||||||
|
* Handle client/repeatalbeQuests/activityPeriods
|
||||||
|
*/
|
||||||
|
activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IPmcDataRepeatableQuest[]>;
|
||||||
|
}
|
62
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/RagfairCallbacks.d.ts
vendored
Normal file
62
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/RagfairCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import { RagfairController } from "@spt/controllers/RagfairController";
|
||||||
|
import { OnLoad } from "@spt/di/OnLoad";
|
||||||
|
import { OnUpdate } from "@spt/di/OnUpdate";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IAddOfferRequestData } from "@spt/models/eft/ragfair/IAddOfferRequestData";
|
||||||
|
import { IExtendOfferRequestData } from "@spt/models/eft/ragfair/IExtendOfferRequestData";
|
||||||
|
import { IGetItemPriceResult } from "@spt/models/eft/ragfair/IGetItemPriceResult";
|
||||||
|
import { IGetMarketPriceRequestData } from "@spt/models/eft/ragfair/IGetMarketPriceRequestData";
|
||||||
|
import { IGetOffersResult } from "@spt/models/eft/ragfair/IGetOffersResult";
|
||||||
|
import { IGetRagfairOfferByIdRequest } from "@spt/models/eft/ragfair/IGetRagfairOfferByIdRequest";
|
||||||
|
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||||
|
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||||
|
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||||
|
import { ISendRagfairReportRequestData } from "@spt/models/eft/ragfair/ISendRagfairReportRequestData";
|
||||||
|
import { IStorePlayerOfferTaxAmountRequestData } from "@spt/models/eft/ragfair/IStorePlayerOfferTaxAmountRequestData";
|
||||||
|
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { RagfairServer } from "@spt/servers/RagfairServer";
|
||||||
|
import { RagfairTaxService } from "@spt/services/RagfairTaxService";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
/**
|
||||||
|
* Handle ragfair related callback events
|
||||||
|
*/
|
||||||
|
export declare class RagfairCallbacks implements OnLoad, OnUpdate {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected ragfairServer: RagfairServer;
|
||||||
|
protected ragfairController: RagfairController;
|
||||||
|
protected ragfairTaxService: RagfairTaxService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected ragfairConfig: IRagfairConfig;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, ragfairServer: RagfairServer, ragfairController: RagfairController, ragfairTaxService: RagfairTaxService, configServer: ConfigServer);
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
getRoute(): string;
|
||||||
|
onUpdate(timeSinceLastRun: number): Promise<boolean>;
|
||||||
|
/**
|
||||||
|
* Handle client/ragfair/search
|
||||||
|
* Handle client/ragfair/find
|
||||||
|
*/
|
||||||
|
search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData<IGetOffersResult>;
|
||||||
|
/** Handle client/ragfair/itemMarketPrice */
|
||||||
|
getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData<IGetItemPriceResult>;
|
||||||
|
/** Handle RagFairAddOffer event */
|
||||||
|
addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle RagFairRemoveOffer event */
|
||||||
|
removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle RagFairRenewOffer event */
|
||||||
|
extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle /client/items/prices
|
||||||
|
* Called when clicking an item to list on flea
|
||||||
|
*/
|
||||||
|
getFleaPrices(url: string, request: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, number>>;
|
||||||
|
/** Handle client/reports/ragfair/send */
|
||||||
|
sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData;
|
||||||
|
storePlayerOfferTaxAmount(url: string, request: IStorePlayerOfferTaxAmountRequestData, sessionId: string): INullResponseData;
|
||||||
|
/** Handle client/ragfair/offer/findbyid */
|
||||||
|
getFleaOfferById(url: string, request: IGetRagfairOfferByIdRequest, sessionID: string): IGetBodyResponseData<IRagfairOffer>;
|
||||||
|
}
|
27
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/RepairCallbacks.d.ts
vendored
Normal file
27
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/RepairCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { RepairController } from "@spt/controllers/RepairController";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IRepairActionDataRequest } from "@spt/models/eft/repair/IRepairActionDataRequest";
|
||||||
|
import { ITraderRepairActionDataRequest } from "@spt/models/eft/repair/ITraderRepairActionDataRequest";
|
||||||
|
export declare class RepairCallbacks {
|
||||||
|
protected repairController: RepairController;
|
||||||
|
constructor(repairController: RepairController);
|
||||||
|
/**
|
||||||
|
* Handle TraderRepair event
|
||||||
|
* use trader to repair item
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param traderRepairRequest Request object
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
traderRepair(pmcData: IPmcData, traderRepairRequest: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle Repair event
|
||||||
|
* Use repair kit to repair item
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param repairRequest Request object
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
repair(pmcData: IPmcData, repairRequest: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse;
|
||||||
|
}
|
14
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/SaveCallbacks.d.ts
vendored
Normal file
14
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/SaveCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { OnLoad } from "@spt/di/OnLoad";
|
||||||
|
import { OnUpdate } from "@spt/di/OnUpdate";
|
||||||
|
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
export declare class SaveCallbacks implements OnLoad, OnUpdate {
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected coreConfig: ICoreConfig;
|
||||||
|
constructor(saveServer: SaveServer, configServer: ConfigServer);
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
getRoute(): string;
|
||||||
|
onUpdate(secondsSinceLastRun: number): Promise<boolean>;
|
||||||
|
}
|
18
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/TradeCallbacks.d.ts
vendored
Normal file
18
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/TradeCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { TradeController } from "@spt/controllers/TradeController";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IProcessBaseTradeRequestData } from "@spt/models/eft/trade/IProcessBaseTradeRequestData";
|
||||||
|
import { IProcessRagfairTradeRequestData } from "@spt/models/eft/trade/IProcessRagfairTradeRequestData";
|
||||||
|
import { ISellScavItemsToFenceRequestData } from "@spt/models/eft/trade/ISellScavItemsToFenceRequestData";
|
||||||
|
export declare class TradeCallbacks {
|
||||||
|
protected tradeController: TradeController;
|
||||||
|
constructor(tradeController: TradeController);
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/items/moving TradingConfirm event
|
||||||
|
*/
|
||||||
|
processTrade(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle RagFairBuyOffer event */
|
||||||
|
processRagfairTrade(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle SellAllFromSavage event */
|
||||||
|
sellAllFromSavage(pmcData: IPmcData, body: ISellScavItemsToFenceRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
}
|
22
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/TraderCallbacks.d.ts
vendored
Normal file
22
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/TraderCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { TraderController } from "@spt/controllers/TraderController";
|
||||||
|
import { OnLoad } from "@spt/di/OnLoad";
|
||||||
|
import { OnUpdate } from "@spt/di/OnUpdate";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { ITraderAssort, ITraderBase } from "@spt/models/eft/common/tables/ITrader";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class TraderCallbacks implements OnLoad, OnUpdate {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected traderController: TraderController;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, // TODO: delay required
|
||||||
|
traderController: TraderController);
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
onUpdate(): Promise<boolean>;
|
||||||
|
getRoute(): string;
|
||||||
|
/** Handle client/trading/api/traderSettings */
|
||||||
|
getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>;
|
||||||
|
/** Handle client/trading/api/getTrader */
|
||||||
|
getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase>;
|
||||||
|
/** Handle client/trading/api/getTraderAssort */
|
||||||
|
getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderAssort>;
|
||||||
|
}
|
15
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/WeatherCallbacks.d.ts
vendored
Normal file
15
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/WeatherCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { WeatherController } from "@spt/controllers/WeatherController";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
||||||
|
import { IWeatherData } from "@spt/models/eft/weather/IWeatherData";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class WeatherCallbacks {
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected weatherController: WeatherController;
|
||||||
|
constructor(httpResponse: HttpResponseUtil, weatherController: WeatherController);
|
||||||
|
/**
|
||||||
|
* Handle client/weather
|
||||||
|
* @returns IWeatherData
|
||||||
|
*/
|
||||||
|
getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IWeatherData>;
|
||||||
|
}
|
12
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/WishlistCallbacks.d.ts
vendored
Normal file
12
TypeScript/13.1AddTraderWithAssortJSON/types/callbacks/WishlistCallbacks.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { WishlistController } from "@spt/controllers/WishlistController";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IWishlistActionData } from "@spt/models/eft/wishlist/IWishlistActionData";
|
||||||
|
export declare class WishlistCallbacks {
|
||||||
|
protected wishlistController: WishlistController;
|
||||||
|
constructor(wishlistController: WishlistController);
|
||||||
|
/** Handle AddToWishList event */
|
||||||
|
addToWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle RemoveFromWishList event */
|
||||||
|
removeFromWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
}
|
20
TypeScript/13.1AddTraderWithAssortJSON/types/context/ApplicationContext.d.ts
vendored
Normal file
20
TypeScript/13.1AddTraderWithAssortJSON/types/context/ApplicationContext.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { ContextVariable } from "@spt/context/ContextVariable";
|
||||||
|
import { ContextVariableType } from "@spt/context/ContextVariableType";
|
||||||
|
export declare class ApplicationContext {
|
||||||
|
private variables;
|
||||||
|
private static holderMaxSize;
|
||||||
|
/**
|
||||||
|
* Called like:
|
||||||
|
* ```
|
||||||
|
* const registerPlayerInfo = this.applicationContext.getLatestValue(ContextVariableType.REGISTER_PLAYER_REQUEST).getValue<IRegisterPlayerRequestData>();
|
||||||
|
*
|
||||||
|
* const activePlayerSessionId = this.applicationContext.getLatestValue(ContextVariableType.SESSION_ID).getValue<string>();
|
||||||
|
*
|
||||||
|
* const matchInfo = this.applicationContext.getLatestValue(ContextVariableType.RAID_CONFIGURATION).getValue<IGetRaidConfigurationRequestData>();
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
getLatestValue(type: ContextVariableType): ContextVariable | undefined;
|
||||||
|
getValues(type: ContextVariableType): ContextVariable[] | undefined;
|
||||||
|
addValue(type: ContextVariableType, value: any): void;
|
||||||
|
clearValues(type: ContextVariableType): void;
|
||||||
|
}
|
10
TypeScript/13.1AddTraderWithAssortJSON/types/context/ContextVariable.d.ts
vendored
Normal file
10
TypeScript/13.1AddTraderWithAssortJSON/types/context/ContextVariable.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { ContextVariableType } from "@spt/context/ContextVariableType";
|
||||||
|
export declare class ContextVariable {
|
||||||
|
private value;
|
||||||
|
private timestamp;
|
||||||
|
private type;
|
||||||
|
constructor(value: any, type: ContextVariableType);
|
||||||
|
getValue<T>(): T;
|
||||||
|
getTimestamp(): Date;
|
||||||
|
getType(): ContextVariableType;
|
||||||
|
}
|
11
TypeScript/13.1AddTraderWithAssortJSON/types/context/ContextVariableType.d.ts
vendored
Normal file
11
TypeScript/13.1AddTraderWithAssortJSON/types/context/ContextVariableType.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export declare enum ContextVariableType {
|
||||||
|
/** Logged in users session id */
|
||||||
|
SESSION_ID = 0,
|
||||||
|
/** Currently acive raid information */
|
||||||
|
RAID_CONFIGURATION = 1,
|
||||||
|
/** Timestamp when client first connected */
|
||||||
|
CLIENT_START_TIMESTAMP = 2,
|
||||||
|
/** When player is loading into map and loot is requested */
|
||||||
|
REGISTER_PLAYER_REQUEST = 3,
|
||||||
|
RAID_ADJUSTMENTS = 4
|
||||||
|
}
|
23
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/AchievementController.d.ts
vendored
Normal file
23
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/AchievementController.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { ICompletedAchievementsResponse } from "@spt/models/eft/profile/ICompletedAchievementsResponse";
|
||||||
|
import { IGetAchievementsResponse } from "@spt/models/eft/profile/IGetAchievementsResponse";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
/**
|
||||||
|
* Logic for handling In Raid callbacks
|
||||||
|
*/
|
||||||
|
export declare class AchievementController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
constructor(logger: ILogger, databaseService: DatabaseService);
|
||||||
|
/**
|
||||||
|
* Get base achievements
|
||||||
|
* @param sessionID Session id
|
||||||
|
*/
|
||||||
|
getAchievements(sessionID: string): IGetAchievementsResponse;
|
||||||
|
/**
|
||||||
|
* Shows % of 'other' players who've completed each achievement
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @returns ICompletedAchievementsResponse
|
||||||
|
*/
|
||||||
|
getAchievementStatistics(sessionId: string): ICompletedAchievementsResponse;
|
||||||
|
}
|
136
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/BotController.d.ts
vendored
Normal file
136
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/BotController.d.ts
vendored
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
import { ApplicationContext } from "@spt/context/ApplicationContext";
|
||||||
|
import { BotGenerator } from "@spt/generators/BotGenerator";
|
||||||
|
import { BotDifficultyHelper } from "@spt/helpers/BotDifficultyHelper";
|
||||||
|
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { MinMax } from "@spt/models/common/MinMax";
|
||||||
|
import { Condition, IGenerateBotsRequestData } from "@spt/models/eft/bot/IGenerateBotsRequestData";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { IBotCore } from "@spt/models/eft/common/tables/IBotCore";
|
||||||
|
import { Difficulty } from "@spt/models/eft/common/tables/IBotType";
|
||||||
|
import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
|
||||||
|
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
|
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { BotGenerationCacheService } from "@spt/services/BotGenerationCacheService";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class BotController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected botGenerator: BotGenerator;
|
||||||
|
protected botHelper: BotHelper;
|
||||||
|
protected botDifficultyHelper: BotDifficultyHelper;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected botGenerationCacheService: BotGenerationCacheService;
|
||||||
|
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected applicationContext: ApplicationContext;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected botConfig: IBotConfig;
|
||||||
|
protected pmcConfig: IPmcConfig;
|
||||||
|
constructor(logger: ILogger, databaseService: DatabaseService, botGenerator: BotGenerator, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, weightedRandomHelper: WeightedRandomHelper, botGenerationCacheService: BotGenerationCacheService, matchBotDetailsCacheService: MatchBotDetailsCacheService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, profileHelper: ProfileHelper, configServer: ConfigServer, applicationContext: ApplicationContext, randomUtil: RandomUtil, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Return the number of bot load-out varieties to be generated
|
||||||
|
* @param type bot Type we want the load-out gen count for
|
||||||
|
* @returns number of bots to generate
|
||||||
|
*/
|
||||||
|
getBotPresetGenerationLimit(type: string): number;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/bot/difficulty
|
||||||
|
* Get the core.json difficulty settings from database/bots
|
||||||
|
* @returns IBotCore
|
||||||
|
*/
|
||||||
|
getBotCoreDifficulty(): IBotCore;
|
||||||
|
/**
|
||||||
|
* Get bot difficulty settings
|
||||||
|
* Adjust PMC settings to ensure they engage the correct bot types
|
||||||
|
* @param type what bot the server is requesting settings for
|
||||||
|
* @param diffLevel difficulty level server requested settings for
|
||||||
|
* @param ignoreRaidSettings should raid settings chosen pre-raid be ignored
|
||||||
|
* @returns Difficulty object
|
||||||
|
*/
|
||||||
|
getBotDifficulty(type: string, diffLevel: string, ignoreRaidSettings?: boolean): Difficulty;
|
||||||
|
getAllBotDifficulties(): Record<string, any>;
|
||||||
|
/**
|
||||||
|
* Generate bot profiles and store in cache
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param info bot generation request info
|
||||||
|
* @returns IBotBase array
|
||||||
|
*/
|
||||||
|
generate(sessionId: string, info: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||||
|
/**
|
||||||
|
* On first bot generation bots are generated and stored inside a cache, ready to be used later
|
||||||
|
* @param request Bot generation request object
|
||||||
|
* @param pmcProfile Player profile
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
protected generateBotsFirstTime(request: IGenerateBotsRequestData, pmcProfile: IPmcData, sessionId: string): Promise<IBotBase[]>;
|
||||||
|
/**
|
||||||
|
* Create a BotGenerationDetails for the bot generator to use
|
||||||
|
* @param condition Client data defining bot type and difficulty
|
||||||
|
* @param pmcProfile Player who is generating bots
|
||||||
|
* @param allPmcsHaveSameNameAsPlayer Should all PMCs have same name as player
|
||||||
|
* @param pmcLevelRangeForMap Min/max levels for PMCs to generate within
|
||||||
|
* @param botCountToGenerate How many bots to generate
|
||||||
|
* @param generateAsPmc Force bot being generated a PMC
|
||||||
|
* @returns BotGenerationDetails
|
||||||
|
*/
|
||||||
|
protected getBotGenerationDetailsForWave(condition: Condition, pmcProfile: IPmcData, allPmcsHaveSameNameAsPlayer: boolean, pmcLevelRangeForMap: MinMax, botCountToGenerate: number, generateAsPmc: boolean): BotGenerationDetails;
|
||||||
|
/**
|
||||||
|
* Get players profile level
|
||||||
|
* @param pmcProfile Profile to get level from
|
||||||
|
* @returns Level as number
|
||||||
|
*/
|
||||||
|
protected getPlayerLevelFromProfile(pmcProfile: IPmcData): number;
|
||||||
|
/**
|
||||||
|
* Generate many bots and store then on the cache
|
||||||
|
* @param condition the condition details to generate the bots with
|
||||||
|
* @param botGenerationDetails the bot details to generate the bot with
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @returns A promise for the bots to be done generating
|
||||||
|
*/
|
||||||
|
protected generateWithBotDetails(condition: Condition, botGenerationDetails: BotGenerationDetails, sessionId: string): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Generate a single bot and store in the cache
|
||||||
|
* @param botGenerationDetails the bot details to generate the bot with
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param cacheKey the cache key to store the bot with
|
||||||
|
* @returns A promise for the bot to be stored
|
||||||
|
*/
|
||||||
|
protected generateSingleBotAndStoreInCache(botGenerationDetails: BotGenerationDetails, sessionId: string, cacheKey: string): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Pull a single bot out of cache and return, if cache is empty add bots to it and then return
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param request Bot generation request object
|
||||||
|
* @returns Single IBotBase object
|
||||||
|
*/
|
||||||
|
protected returnSingleBotFromCache(sessionId: string, request: IGenerateBotsRequestData): Promise<IBotBase[]>;
|
||||||
|
protected updateBotGenerationDetailsToRandomBoss(botGenerationDetails: BotGenerationDetails, possibleBossTypeWeights: Record<string, number>): void;
|
||||||
|
/**
|
||||||
|
* Get the difficulty passed in, if its not "asonline", get selected difficulty from config
|
||||||
|
* @param requestedDifficulty
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
getPMCDifficulty(requestedDifficulty: string): string;
|
||||||
|
/**
|
||||||
|
* Get the max number of bots allowed on a map
|
||||||
|
* Looks up location player is entering when getting cap value
|
||||||
|
* @param location The map location cap was requested for
|
||||||
|
* @returns cap number
|
||||||
|
*/
|
||||||
|
getBotCap(location: string): number;
|
||||||
|
getAiBotBrainTypes(): any;
|
||||||
|
}
|
38
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/BuildController.d.ts
vendored
Normal file
38
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/BuildController.d.ts
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { ISetMagazineRequest } from "@spt/models/eft/builds/ISetMagazineRequest";
|
||||||
|
import { IPresetBuildActionRequestData } from "@spt/models/eft/presetBuild/IPresetBuildActionRequestData";
|
||||||
|
import { IRemoveBuildRequestData } from "@spt/models/eft/presetBuild/IRemoveBuildRequestData";
|
||||||
|
import { IUserBuilds } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
export declare class BuildController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, databaseService: DatabaseService, profileHelper: ProfileHelper, localisationService: LocalisationService, itemHelper: ItemHelper, saveServer: SaveServer, cloner: ICloner);
|
||||||
|
/** Handle client/handbook/builds/my/list */
|
||||||
|
getUserBuilds(sessionID: string): IUserBuilds;
|
||||||
|
/** Handle client/builds/weapon/save */
|
||||||
|
saveWeaponBuild(sessionId: string, body: IPresetBuildActionRequestData): void;
|
||||||
|
/** Handle client/builds/equipment/save event */
|
||||||
|
saveEquipmentBuild(sessionID: string, request: IPresetBuildActionRequestData): void;
|
||||||
|
/** Handle client/builds/delete */
|
||||||
|
removeBuild(sessionID: string, request: IRemoveBuildRequestData): void;
|
||||||
|
protected removePlayerBuild(idToRemove: string, sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Handle client/builds/magazine/save
|
||||||
|
*/
|
||||||
|
createMagazineTemplate(sessionId: string, request: ISetMagazineRequest): void;
|
||||||
|
}
|
10
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/ClientLogController.d.ts
vendored
Normal file
10
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/ClientLogController.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { IClientLogRequest } from "@spt/models/spt/logging/IClientLogRequest";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
export declare class ClientLogController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
constructor(logger: ILogger);
|
||||||
|
/**
|
||||||
|
* Handle /singleplayer/log
|
||||||
|
*/
|
||||||
|
clientLog(logRequest: IClientLogRequest): void;
|
||||||
|
}
|
70
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/CustomizationController.d.ts
vendored
Normal file
70
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/CustomizationController.d.ts
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { ISuit } from "@spt/models/eft/common/tables/ITrader";
|
||||||
|
import { ClothingItem, IBuyClothingRequestData } from "@spt/models/eft/customization/IBuyClothingRequestData";
|
||||||
|
import { IWearClothingRequestData } from "@spt/models/eft/customization/IWearClothingRequestData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
export declare class CustomizationController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected readonly clothingIds: {
|
||||||
|
lowerParentId: string;
|
||||||
|
upperParentId: string;
|
||||||
|
};
|
||||||
|
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseService: DatabaseService, saveServer: SaveServer, localisationService: LocalisationService, profileHelper: ProfileHelper);
|
||||||
|
/**
|
||||||
|
* Get purchasable clothing items from trader that match players side (usec/bear)
|
||||||
|
* @param traderID trader to look up clothing for
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns ISuit array
|
||||||
|
*/
|
||||||
|
getTraderSuits(traderID: string, sessionID: string): ISuit[];
|
||||||
|
/**
|
||||||
|
* Handle CustomizationWear event
|
||||||
|
* Equip one to many clothing items to player
|
||||||
|
*/
|
||||||
|
wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle CustomizationBuy event
|
||||||
|
* Purchase/unlock a clothing item from a trader
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param buyClothingRequest Request object
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
buyClothing(pmcData: IPmcData, buyClothingRequest: IBuyClothingRequestData, sessionId: string): IItemEventRouterResponse;
|
||||||
|
protected getTraderClothingOffer(sessionId: string, offerId: string): ISuit;
|
||||||
|
/**
|
||||||
|
* Has an outfit been purchased by a player
|
||||||
|
* @param suitId clothing id
|
||||||
|
* @param sessionID Session id of profile to check for clothing in
|
||||||
|
* @returns true if already purchased
|
||||||
|
*/
|
||||||
|
protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean;
|
||||||
|
/**
|
||||||
|
* Update output object and player profile with purchase details
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param clothingItems Clothing purchased
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
protected payForClothingItems(sessionId: string, pmcData: IPmcData, clothingItems: ClothingItem[], output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Update output object and player profile with purchase details for single piece of clothing
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param clothingItem Clothing item purchased
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void;
|
||||||
|
protected getAllTraderSuits(sessionID: string): ISuit[];
|
||||||
|
}
|
154
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/DialogueController.d.ts
vendored
Normal file
154
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/DialogueController.d.ts
vendored
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
import { IDialogueChatBot } from "@spt/helpers/Dialogue/IDialogueChatBot";
|
||||||
|
import { DialogueHelper } from "@spt/helpers/DialogueHelper";
|
||||||
|
import { IFriendRequestData } from "@spt/models/eft/dialog/IFriendRequestData";
|
||||||
|
import { IFriendRequestSendResponse } from "@spt/models/eft/dialog/IFriendRequestSendResponse";
|
||||||
|
import { IGetAllAttachmentsResponse } from "@spt/models/eft/dialog/IGetAllAttachmentsResponse";
|
||||||
|
import { IGetFriendListDataResponse } from "@spt/models/eft/dialog/IGetFriendListDataResponse";
|
||||||
|
import { IGetMailDialogViewRequestData } from "@spt/models/eft/dialog/IGetMailDialogViewRequestData";
|
||||||
|
import { IGetMailDialogViewResponseData } from "@spt/models/eft/dialog/IGetMailDialogViewResponseData";
|
||||||
|
import { ISendMessageRequest } from "@spt/models/eft/dialog/ISendMessageRequest";
|
||||||
|
import { Dialogue, DialogueInfo, ISptProfile, IUserDialogInfo, Message } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { MessageType } from "@spt/models/enums/MessageType";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { MailSendService } from "@spt/services/MailSendService";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class DialogueController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected dialogueHelper: DialogueHelper;
|
||||||
|
protected mailSendService: MailSendService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected dialogueChatBots: IDialogueChatBot[];
|
||||||
|
constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, dialogueHelper: DialogueHelper, mailSendService: MailSendService, localisationService: LocalisationService, configServer: ConfigServer, dialogueChatBots: IDialogueChatBot[]);
|
||||||
|
registerChatBot(chatBot: IDialogueChatBot): void;
|
||||||
|
/** Handle onUpdate spt event */
|
||||||
|
update(): void;
|
||||||
|
/**
|
||||||
|
* Handle client/friend/list
|
||||||
|
* @returns IGetFriendListDataResponse
|
||||||
|
*/
|
||||||
|
getFriendList(sessionID: string): IGetFriendListDataResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/mail/dialog/list
|
||||||
|
* Create array holding trader dialogs and mail interactions with player
|
||||||
|
* Set the content of the dialogue on the list tab.
|
||||||
|
* @param sessionID Session Id
|
||||||
|
* @returns array of dialogs
|
||||||
|
*/
|
||||||
|
generateDialogueList(sessionID: string): DialogueInfo[];
|
||||||
|
/**
|
||||||
|
* Get the content of a dialogue
|
||||||
|
* @param dialogueID Dialog id
|
||||||
|
* @param sessionID Session Id
|
||||||
|
* @returns DialogueInfo
|
||||||
|
*/
|
||||||
|
getDialogueInfo(dialogueID: string, sessionID: string): DialogueInfo;
|
||||||
|
/**
|
||||||
|
* Get the users involved in a dialog (player + other party)
|
||||||
|
* @param dialog The dialog to check for users
|
||||||
|
* @param messageType What type of message is being sent
|
||||||
|
* @param sessionID Player id
|
||||||
|
* @returns IUserDialogInfo array
|
||||||
|
*/
|
||||||
|
getDialogueUsers(dialog: Dialogue, messageType: MessageType, sessionID: string): IUserDialogInfo[] | undefined;
|
||||||
|
/**
|
||||||
|
* Handle client/mail/dialog/view
|
||||||
|
* Handle player clicking 'messenger' and seeing all the messages they've recieved
|
||||||
|
* Set the content of the dialogue on the details panel, showing all the messages
|
||||||
|
* for the specified dialogue.
|
||||||
|
* @param request Get dialog request
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @returns IGetMailDialogViewResponseData object
|
||||||
|
*/
|
||||||
|
generateDialogueView(request: IGetMailDialogViewRequestData, sessionId: string): IGetMailDialogViewResponseData;
|
||||||
|
/**
|
||||||
|
* Get dialog from player profile, create if doesn't exist
|
||||||
|
* @param profile Player profile
|
||||||
|
* @param request get dialog request (params used when dialog doesnt exist in profile)
|
||||||
|
* @returns Dialogue
|
||||||
|
*/
|
||||||
|
protected getDialogByIdFromProfile(profile: ISptProfile, request: IGetMailDialogViewRequestData): Dialogue;
|
||||||
|
/**
|
||||||
|
* Get the users involved in a mail between two entities
|
||||||
|
* @param fullProfile Player profile
|
||||||
|
* @param dialogUsers The participants of the mail
|
||||||
|
* @returns IUserDialogInfo array
|
||||||
|
*/
|
||||||
|
protected getProfilesForMail(fullProfile: ISptProfile, dialogUsers?: IUserDialogInfo[]): IUserDialogInfo[];
|
||||||
|
/**
|
||||||
|
* Get a count of messages with attachments from a particular dialog
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param dialogueID Dialog id
|
||||||
|
* @returns Count of messages with attachments
|
||||||
|
*/
|
||||||
|
protected getUnreadMessagesWithAttachmentsCount(sessionID: string, dialogueID: string): number;
|
||||||
|
/**
|
||||||
|
* Does array have messages with uncollected rewards (includes expired rewards)
|
||||||
|
* @param messages Messages to check
|
||||||
|
* @returns true if uncollected rewards found
|
||||||
|
*/
|
||||||
|
protected messagesHaveUncollectedRewards(messages: Message[]): boolean;
|
||||||
|
/**
|
||||||
|
* Handle client/mail/dialog/remove
|
||||||
|
* Remove an entire dialog with an entity (trader/user)
|
||||||
|
* @param dialogueId id of the dialog to remove
|
||||||
|
* @param sessionId Player id
|
||||||
|
*/
|
||||||
|
removeDialogue(dialogueId: string, sessionId: string): void;
|
||||||
|
/** Handle client/mail/dialog/pin && Handle client/mail/dialog/unpin */
|
||||||
|
setDialoguePin(dialogueId: string, shouldPin: boolean, sessionId: string): void;
|
||||||
|
/**
|
||||||
|
* Handle client/mail/dialog/read
|
||||||
|
* Set a dialog to be read (no number alert/attachment alert)
|
||||||
|
* @param dialogueIds Dialog ids to set as read
|
||||||
|
* @param sessionId Player profile id
|
||||||
|
*/
|
||||||
|
setRead(dialogueIds: string[], sessionId: string): void;
|
||||||
|
/**
|
||||||
|
* Handle client/mail/dialog/getAllAttachments
|
||||||
|
* Get all uncollected items attached to mail in a particular dialog
|
||||||
|
* @param dialogueId Dialog to get mail attachments from
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @returns IGetAllAttachmentsResponse
|
||||||
|
*/
|
||||||
|
getAllAttachments(dialogueId: string, sessionId: string): IGetAllAttachmentsResponse | undefined;
|
||||||
|
/** client/mail/msg/send */
|
||||||
|
sendMessage(sessionId: string, request: ISendMessageRequest): string;
|
||||||
|
/**
|
||||||
|
* Get messages from a specific dialog that have items not expired
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param dialogueId Dialog to get mail attachments from
|
||||||
|
* @returns Message array
|
||||||
|
*/
|
||||||
|
protected getActiveMessagesFromDialog(sessionId: string, dialogueId: string): Message[];
|
||||||
|
/**
|
||||||
|
* Return array of messages with uncollected items (includes expired)
|
||||||
|
* @param messages Messages to parse
|
||||||
|
* @returns messages with items to collect
|
||||||
|
*/
|
||||||
|
protected getMessagesWithAttachments(messages: Message[]): Message[];
|
||||||
|
/**
|
||||||
|
* Delete expired items from all messages in player profile. triggers when updating traders.
|
||||||
|
* @param sessionId Session id
|
||||||
|
*/
|
||||||
|
protected removeExpiredItemsFromMessages(sessionId: string): void;
|
||||||
|
/**
|
||||||
|
* Removes expired items from a message in player profile
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param dialogueId Dialog id
|
||||||
|
*/
|
||||||
|
protected removeExpiredItemsFromMessage(sessionId: string, dialogueId: string): void;
|
||||||
|
/**
|
||||||
|
* Has a dialog message expired
|
||||||
|
* @param message Message to check expiry of
|
||||||
|
* @returns true or false
|
||||||
|
*/
|
||||||
|
protected messageHasExpired(message: Message): boolean;
|
||||||
|
/** Handle client/friend/request/send */
|
||||||
|
sendFriendRequest(sessionID: string, request: IFriendRequestData): IFriendRequestSendResponse;
|
||||||
|
}
|
180
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/GameController.d.ts
vendored
Normal file
180
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/GameController.d.ts
vendored
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
import { ApplicationContext } from "@spt/context/ApplicationContext";
|
||||||
|
import { HideoutHelper } from "@spt/helpers/HideoutHelper";
|
||||||
|
import { HttpServerHelper } from "@spt/helpers/HttpServerHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { PreSptModLoader } from "@spt/loaders/PreSptModLoader";
|
||||||
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { ICheckVersionResponse } from "@spt/models/eft/game/ICheckVersionResponse";
|
||||||
|
import { ICurrentGroupResponse } from "@spt/models/eft/game/ICurrentGroupResponse";
|
||||||
|
import { IGameConfigResponse } from "@spt/models/eft/game/IGameConfigResponse";
|
||||||
|
import { IGameKeepAliveResponse } from "@spt/models/eft/game/IGameKeepAliveResponse";
|
||||||
|
import { IGameModeRequestData } from "@spt/models/eft/game/IGameModeRequestData";
|
||||||
|
import { IGetRaidTimeRequest } from "@spt/models/eft/game/IGetRaidTimeRequest";
|
||||||
|
import { IGetRaidTimeResponse } from "@spt/models/eft/game/IGetRaidTimeResponse";
|
||||||
|
import { IServerDetails } from "@spt/models/eft/game/IServerDetails";
|
||||||
|
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
|
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
|
||||||
|
import { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
||||||
|
import { IHttpConfig } from "@spt/models/spt/config/IHttpConfig";
|
||||||
|
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||||
|
import { ILootConfig } from "@spt/models/spt/config/ILootConfig";
|
||||||
|
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
||||||
|
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { CustomLocationWaveService } from "@spt/services/CustomLocationWaveService";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { GiftService } from "@spt/services/GiftService";
|
||||||
|
import { ItemBaseClassService } from "@spt/services/ItemBaseClassService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { OpenZoneService } from "@spt/services/OpenZoneService";
|
||||||
|
import { ProfileActivityService } from "@spt/services/ProfileActivityService";
|
||||||
|
import { ProfileFixerService } from "@spt/services/ProfileFixerService";
|
||||||
|
import { RaidTimeAdjustmentService } from "@spt/services/RaidTimeAdjustmentService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class GameController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected preSptModLoader: PreSptModLoader;
|
||||||
|
protected httpServerHelper: HttpServerHelper;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected hideoutHelper: HideoutHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected profileFixerService: ProfileFixerService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected customLocationWaveService: CustomLocationWaveService;
|
||||||
|
protected openZoneService: OpenZoneService;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected itemBaseClassService: ItemBaseClassService;
|
||||||
|
protected giftService: GiftService;
|
||||||
|
protected raidTimeAdjustmentService: RaidTimeAdjustmentService;
|
||||||
|
protected profileActivityService: ProfileActivityService;
|
||||||
|
protected applicationContext: ApplicationContext;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected httpConfig: IHttpConfig;
|
||||||
|
protected coreConfig: ICoreConfig;
|
||||||
|
protected locationConfig: ILocationConfig;
|
||||||
|
protected ragfairConfig: IRagfairConfig;
|
||||||
|
protected hideoutConfig: IHideoutConfig;
|
||||||
|
protected pmcConfig: IPmcConfig;
|
||||||
|
protected lootConfig: ILootConfig;
|
||||||
|
protected botConfig: IBotConfig;
|
||||||
|
constructor(logger: ILogger, databaseService: DatabaseService, timeUtil: TimeUtil, hashUtil: HashUtil, preSptModLoader: PreSptModLoader, httpServerHelper: HttpServerHelper, randomUtil: RandomUtil, hideoutHelper: HideoutHelper, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, customLocationWaveService: CustomLocationWaveService, openZoneService: OpenZoneService, seasonalEventService: SeasonalEventService, itemBaseClassService: ItemBaseClassService, giftService: GiftService, raidTimeAdjustmentService: RaidTimeAdjustmentService, profileActivityService: ProfileActivityService, applicationContext: ApplicationContext, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
load(): void;
|
||||||
|
/**
|
||||||
|
* Handle client/game/start
|
||||||
|
*/
|
||||||
|
gameStart(_url: string, _info: IEmptyRequestData, sessionID: string, startTimeStampMS: number): void;
|
||||||
|
protected adjustHideoutCraftTimes(overrideSeconds: number): void;
|
||||||
|
/**
|
||||||
|
* Adjust all hideout craft times to be no higher than the override
|
||||||
|
*/
|
||||||
|
protected adjustHideoutBuildTimes(overrideSeconds: number): void;
|
||||||
|
protected adjustLocationBotValues(): void;
|
||||||
|
/**
|
||||||
|
* Out of date/incorrectly made trader mods forget this data
|
||||||
|
*/
|
||||||
|
protected checkTraderRepairValuesExist(): void;
|
||||||
|
protected addCustomLooseLootPositions(): void;
|
||||||
|
protected adjustLooseLootSpawnProbabilities(): void;
|
||||||
|
/** Apply custom limits on bot types as defined in configs/location.json/botTypeLimits */
|
||||||
|
protected adjustMapBotLimits(): void;
|
||||||
|
/**
|
||||||
|
* Handle client/game/config
|
||||||
|
*/
|
||||||
|
getGameConfig(sessionID: string): IGameConfigResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/game/mode
|
||||||
|
*/
|
||||||
|
getGameMode(sessionID: string, info: IGameModeRequestData): any;
|
||||||
|
/**
|
||||||
|
* Handle client/server/list
|
||||||
|
*/
|
||||||
|
getServer(sessionId: string): IServerDetails[];
|
||||||
|
/**
|
||||||
|
* Handle client/match/group/current
|
||||||
|
*/
|
||||||
|
getCurrentGroup(sessionId: string): ICurrentGroupResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/checkVersion
|
||||||
|
*/
|
||||||
|
getValidGameVersion(sessionId: string): ICheckVersionResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/game/keepalive
|
||||||
|
*/
|
||||||
|
getKeepAlive(sessionId: string): IGameKeepAliveResponse;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/settings/getRaidTime
|
||||||
|
*/
|
||||||
|
getRaidTime(sessionId: string, request: IGetRaidTimeRequest): IGetRaidTimeResponse;
|
||||||
|
/**
|
||||||
|
* BSG have two values for shotgun dispersion, we make sure both have the same value
|
||||||
|
*/
|
||||||
|
protected fixShotgunDispersions(): void;
|
||||||
|
/**
|
||||||
|
* Players set botReload to a high value and don't expect the crazy fast reload speeds, give them a warn about it
|
||||||
|
* @param pmcProfile Player profile
|
||||||
|
*/
|
||||||
|
protected warnOnActiveBotReloadSkill(pmcProfile: IPmcData): void;
|
||||||
|
protected setAllDbItemsAsSellableOnFlea(): void;
|
||||||
|
/**
|
||||||
|
* When player logs in, iterate over all active effects and reduce timer
|
||||||
|
* @param pmcProfile Profile to adjust values for
|
||||||
|
*/
|
||||||
|
protected updateProfileHealthValues(pmcProfile: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Waves with an identical min/max values spawn nothing, the number of bots that spawn is the difference between min and max
|
||||||
|
*/
|
||||||
|
protected fixBrokenOfflineMapWaves(): void;
|
||||||
|
/**
|
||||||
|
* Make Rogues spawn later to allow for scavs to spawn first instead of rogues filling up all spawn positions
|
||||||
|
*/
|
||||||
|
protected fixRoguesSpawningInstantlyOnLighthouse(): void;
|
||||||
|
/**
|
||||||
|
* Send starting gifts to profile after x days
|
||||||
|
* @param pmcProfile Profile to add gifts to
|
||||||
|
*/
|
||||||
|
protected sendPraporGiftsToNewProfiles(pmcProfile: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Find and split waves with large numbers of bots into smaller waves - BSG appears to reduce the size of these
|
||||||
|
* waves to one bot when they're waiting to spawn for too long
|
||||||
|
*/
|
||||||
|
protected splitBotWavesIntoSingleWaves(): void;
|
||||||
|
/**
|
||||||
|
* Get a list of installed mods and save their details to the profile being used
|
||||||
|
* @param fullProfile Profile to add mod details to
|
||||||
|
*/
|
||||||
|
protected saveActiveModsToProfile(fullProfile: ISptProfile): void;
|
||||||
|
/**
|
||||||
|
* Check for any missing assorts inside each traders assort.json data, checking against traders questassort.json
|
||||||
|
*/
|
||||||
|
protected validateQuestAssortUnlocksExist(): void;
|
||||||
|
/**
|
||||||
|
* Add the logged in players name to PMC name pool
|
||||||
|
* @param pmcProfile Profile of player to get name from
|
||||||
|
*/
|
||||||
|
protected addPlayerToPMCNames(pmcProfile: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Check for a dialog with the key 'undefined', and remove it
|
||||||
|
* @param fullProfile Profile to check for dialog in
|
||||||
|
*/
|
||||||
|
protected checkForAndRemoveUndefinedDialogs(fullProfile: ISptProfile): void;
|
||||||
|
/**
|
||||||
|
* Blank out the "test" mail message from prapor
|
||||||
|
*/
|
||||||
|
protected removePraporTestMessage(): void;
|
||||||
|
/**
|
||||||
|
* Make non-trigger-spawned raiders spawn earlier + always
|
||||||
|
*/
|
||||||
|
protected adjustLabsRaiderSpawnRate(): void;
|
||||||
|
protected logProfileDetails(fullProfile: ISptProfile): void;
|
||||||
|
}
|
8
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/HandbookController.d.ts
vendored
Normal file
8
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/HandbookController.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||||
|
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||||
|
export declare class HandbookController {
|
||||||
|
protected databaseServer: DatabaseServer;
|
||||||
|
protected handbookHelper: HandbookHelper;
|
||||||
|
constructor(databaseServer: DatabaseServer, handbookHelper: HandbookHelper);
|
||||||
|
load(): void;
|
||||||
|
}
|
70
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/HealthController.d.ts
vendored
Normal file
70
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/HealthController.d.ts
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
import { HealthHelper } from "@spt/helpers/HealthHelper";
|
||||||
|
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IHealthTreatmentRequestData } from "@spt/models/eft/health/IHealthTreatmentRequestData";
|
||||||
|
import { IOffraidEatRequestData } from "@spt/models/eft/health/IOffraidEatRequestData";
|
||||||
|
import { IOffraidHealRequestData } from "@spt/models/eft/health/IOffraidHealRequestData";
|
||||||
|
import { ISyncHealthRequestData } from "@spt/models/eft/health/ISyncHealthRequestData";
|
||||||
|
import { IWorkoutData } from "@spt/models/eft/health/IWorkoutData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { PaymentService } from "@spt/services/PaymentService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
export declare class HealthController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected paymentService: PaymentService;
|
||||||
|
protected inventoryHelper: InventoryHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected healthHelper: HealthHelper;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, itemHelper: ItemHelper, paymentService: PaymentService, inventoryHelper: InventoryHelper, localisationService: LocalisationService, httpResponse: HttpResponseUtil, healthHelper: HealthHelper, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* stores in-raid player health
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param info Request data
|
||||||
|
* @param sessionID Player id
|
||||||
|
* @param addEffects Should effects found be added or removed from profile
|
||||||
|
* @param deleteExistingEffects Should all prior effects be removed before apply new ones
|
||||||
|
*/
|
||||||
|
saveVitality(pmcData: IPmcData, info: ISyncHealthRequestData, sessionID: string, addEffects?: boolean, deleteExistingEffects?: boolean): void;
|
||||||
|
/**
|
||||||
|
* When healing in menu
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Healing request
|
||||||
|
* @param sessionID Player id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
offraidHeal(pmcData: IPmcData, request: IOffraidHealRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle Eat event
|
||||||
|
* Consume food/water outside of a raid
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Eat request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
offraidEat(pmcData: IPmcData, request: IOffraidEatRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle RestoreHealth event
|
||||||
|
* Occurs on post-raid healing page
|
||||||
|
* @param pmcData player profile
|
||||||
|
* @param healthTreatmentRequest Request data from client
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
healthTreatment(pmcData: IPmcData, healthTreatmentRequest: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* applies skills from hideout workout.
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param info Request data
|
||||||
|
* @param sessionID
|
||||||
|
*/
|
||||||
|
applyWorkoutChanges(pmcData: IPmcData, info: IWorkoutData, sessionId: string): void;
|
||||||
|
}
|
269
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/HideoutController.d.ts
vendored
Normal file
269
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/HideoutController.d.ts
vendored
Normal file
@ -0,0 +1,269 @@
|
|||||||
|
import { ScavCaseRewardGenerator } from "@spt/generators/ScavCaseRewardGenerator";
|
||||||
|
import { HideoutHelper } from "@spt/helpers/HideoutHelper";
|
||||||
|
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PaymentHelper } from "@spt/helpers/PaymentHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { HideoutArea, ITaskConditionCounter, Product } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { HideoutUpgradeCompleteRequestData } from "@spt/models/eft/hideout/HideoutUpgradeCompleteRequestData";
|
||||||
|
import { IHandleQTEEventRequestData } from "@spt/models/eft/hideout/IHandleQTEEventRequestData";
|
||||||
|
import { IHideoutArea, Stage } from "@spt/models/eft/hideout/IHideoutArea";
|
||||||
|
import { IHideoutCancelProductionRequestData } from "@spt/models/eft/hideout/IHideoutCancelProductionRequestData";
|
||||||
|
import { IHideoutContinuousProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutContinuousProductionStartRequestData";
|
||||||
|
import { IHideoutImproveAreaRequestData } from "@spt/models/eft/hideout/IHideoutImproveAreaRequestData";
|
||||||
|
import { IHideoutProduction } from "@spt/models/eft/hideout/IHideoutProduction";
|
||||||
|
import { IHideoutPutItemInRequestData } from "@spt/models/eft/hideout/IHideoutPutItemInRequestData";
|
||||||
|
import { IHideoutScavCaseStartRequestData } from "@spt/models/eft/hideout/IHideoutScavCaseStartRequestData";
|
||||||
|
import { IHideoutSingleProductionStartRequestData } from "@spt/models/eft/hideout/IHideoutSingleProductionStartRequestData";
|
||||||
|
import { IHideoutTakeItemOutRequestData } from "@spt/models/eft/hideout/IHideoutTakeItemOutRequestData";
|
||||||
|
import { IHideoutTakeProductionRequestData } from "@spt/models/eft/hideout/IHideoutTakeProductionRequestData";
|
||||||
|
import { IHideoutToggleAreaRequestData } from "@spt/models/eft/hideout/IHideoutToggleAreaRequestData";
|
||||||
|
import { IHideoutUpgradeRequestData } from "@spt/models/eft/hideout/IHideoutUpgradeRequestData";
|
||||||
|
import { IQteData } from "@spt/models/eft/hideout/IQteData";
|
||||||
|
import { IRecordShootingRangePoints } from "@spt/models/eft/hideout/IRecordShootingRangePoints";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { HideoutAreas } from "@spt/models/enums/HideoutAreas";
|
||||||
|
import { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { FenceService } from "@spt/services/FenceService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { PlayerService } from "@spt/services/PlayerService";
|
||||||
|
import { ProfileActivityService } from "@spt/services/ProfileActivityService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class HideoutController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected inventoryHelper: InventoryHelper;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected playerService: PlayerService;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected paymentHelper: PaymentHelper;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected hideoutHelper: HideoutHelper;
|
||||||
|
protected scavCaseRewardGenerator: ScavCaseRewardGenerator;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected profileActivityService: ProfileActivityService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected fenceService: FenceService;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
/** Key used in TaskConditionCounters array */
|
||||||
|
protected static nameTaskConditionCountersCrafting: string;
|
||||||
|
protected hideoutConfig: IHideoutConfig;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, databaseService: DatabaseService, randomUtil: RandomUtil, inventoryHelper: InventoryHelper, itemHelper: ItemHelper, saveServer: SaveServer, playerService: PlayerService, presetHelper: PresetHelper, paymentHelper: PaymentHelper, eventOutputHolder: EventOutputHolder, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, hideoutHelper: HideoutHelper, scavCaseRewardGenerator: ScavCaseRewardGenerator, localisationService: LocalisationService, profileActivityService: ProfileActivityService, configServer: ConfigServer, fenceService: FenceService, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Handle HideoutUpgrade event
|
||||||
|
* Start a hideout area upgrade
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request upgrade start request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
startUpgrade(pmcData: IPmcData, request: IHideoutUpgradeRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Handle HideoutUpgradeComplete event
|
||||||
|
* Complete a hideout area upgrade
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Completed upgrade request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
upgradeComplete(pmcData: IPmcData, request: HideoutUpgradeCompleteRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Upgrade wall status to visible in profile if medstation/water collector are both level 1
|
||||||
|
* @param pmcData Player profile
|
||||||
|
*/
|
||||||
|
protected checkAndUpgradeWall(pmcData: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* @param pmcData Profile to edit
|
||||||
|
* @param output Object to send back to client
|
||||||
|
* @param sessionID Session/player id
|
||||||
|
* @param profileParentHideoutArea Current hideout area for profile
|
||||||
|
* @param dbHideoutArea Hideout area being upgraded
|
||||||
|
* @param hideoutStage Stage hideout area is being upgraded to
|
||||||
|
*/
|
||||||
|
protected addContainerImprovementToProfile(output: IItemEventRouterResponse, sessionID: string, pmcData: IPmcData, profileParentHideoutArea: HideoutArea, dbHideoutArea: IHideoutArea, hideoutStage: Stage): void;
|
||||||
|
/**
|
||||||
|
* Add an inventory item to profile from a hideout area stage data
|
||||||
|
* @param pmcData Profile to update
|
||||||
|
* @param dbHideoutData Hideout area from db being upgraded
|
||||||
|
* @param hideoutStage Stage area upgraded to
|
||||||
|
*/
|
||||||
|
protected addUpdateInventoryItemToProfile(pmcData: IPmcData, dbHideoutData: IHideoutArea, hideoutStage: Stage): void;
|
||||||
|
/**
|
||||||
|
* @param output Object to send to client
|
||||||
|
* @param sessionID Session/player id
|
||||||
|
* @param areaType Hideout area that had stash added
|
||||||
|
* @param hideoutDbData Hideout area that caused addition of stash
|
||||||
|
* @param hideoutStage Hideout area upgraded to this
|
||||||
|
*/
|
||||||
|
protected addContainerUpgradeToClientOutput(output: IItemEventRouterResponse, sessionID: string, areaType: HideoutAreas, hideoutDbData: IHideoutArea, hideoutStage: Stage): void;
|
||||||
|
/**
|
||||||
|
* Handle HideoutPutItemsInAreaSlots
|
||||||
|
* Create item in hideout slot item array, remove item from player inventory
|
||||||
|
* @param pmcData Profile data
|
||||||
|
* @param addItemToHideoutRequest reqeust from client to place item in area slot
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse object
|
||||||
|
*/
|
||||||
|
putItemsInAreaSlots(pmcData: IPmcData, addItemToHideoutRequest: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutTakeItemsFromAreaSlots event
|
||||||
|
* Remove item from hideout area and place into player inventory
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Take item out of area request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
takeItemsFromAreaSlots(pmcData: IPmcData, request: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Find resource item in hideout area, add copy to player inventory, remove Item from hideout slot
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param pmcData Profile to update
|
||||||
|
* @param removeResourceRequest client request
|
||||||
|
* @param output response to send to client
|
||||||
|
* @param hideoutArea Area fuel is being removed from
|
||||||
|
* @returns IItemEventRouterResponse response
|
||||||
|
*/
|
||||||
|
protected removeResourceFromArea(sessionID: string, pmcData: IPmcData, removeResourceRequest: IHideoutTakeItemOutRequestData, output: IItemEventRouterResponse, hideoutArea: HideoutArea): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutToggleArea event
|
||||||
|
* Toggle area on/off
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Toggle area request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
toggleArea(pmcData: IPmcData, request: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutSingleProductionStart event
|
||||||
|
* Start production for an item from hideout area
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param body Start prodution of single item request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutScavCaseProductionStart event
|
||||||
|
* Handles event after clicking 'start' on the scav case hideout page
|
||||||
|
* @param pmcData player profile
|
||||||
|
* @param body client request object
|
||||||
|
* @param sessionID session id
|
||||||
|
* @returns item event router response
|
||||||
|
*/
|
||||||
|
scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Adjust scav case time based on fence standing
|
||||||
|
*
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param productionTime Time to complete scav case in seconds
|
||||||
|
* @returns Adjusted scav case time in seconds
|
||||||
|
*/
|
||||||
|
protected getScavCaseTime(pmcData: IPmcData, productionTime: number): number;
|
||||||
|
/**
|
||||||
|
* Add generated scav case rewards to player profile
|
||||||
|
* @param pmcData player profile to add rewards to
|
||||||
|
* @param rewards reward items to add to profile
|
||||||
|
* @param recipeId recipe id to save into Production dict
|
||||||
|
*/
|
||||||
|
protected addScavCaseRewardsToProfile(pmcData: IPmcData, rewards: Product[], recipeId: string): void;
|
||||||
|
/**
|
||||||
|
* Start production of continuously created item
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Continious production request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
continuousProductionStart(pmcData: IPmcData, request: IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle HideoutTakeProduction event
|
||||||
|
* Take completed item out of hideout area and place into player inventory
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Remove production from area request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
takeProduction(pmcData: IPmcData, request: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Take recipe-type production out of hideout area and place into player inventory
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param recipe Completed recipe of item
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Remove production from area request
|
||||||
|
* @param output Output object to update
|
||||||
|
*/
|
||||||
|
protected handleRecipe(sessionID: string, recipe: IHideoutProduction, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Get the "CounterHoursCrafting" TaskConditionCounter from a profile
|
||||||
|
* @param pmcData Profile to get counter from
|
||||||
|
* @param recipe Recipe being crafted
|
||||||
|
* @returns ITaskConditionCounter
|
||||||
|
*/
|
||||||
|
protected getHoursCraftingTaskConditionCounter(pmcData: IPmcData, recipe: IHideoutProduction): ITaskConditionCounter;
|
||||||
|
/**
|
||||||
|
* Handles generating case rewards and sending to player inventory
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Get rewards from scavcase craft request
|
||||||
|
* @param output Output object to update
|
||||||
|
*/
|
||||||
|
protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Get quick time event list for hideout
|
||||||
|
* // TODO - implement this
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @returns IQteData array
|
||||||
|
*/
|
||||||
|
getQteList(sessionId: string): IQteData[];
|
||||||
|
/**
|
||||||
|
* Handle HideoutQuickTimeEvent on client/game/profile/items/moving
|
||||||
|
* Called after completing workout at gym
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param pmcData Profile to adjust
|
||||||
|
* @param request QTE result object
|
||||||
|
*/
|
||||||
|
handleQTEEventOutcome(sessionId: string, pmcData: IPmcData, request: IHandleQTEEventRequestData, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Record a high score from the shooting range into a player profiles overallcounters
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param pmcData Profile to update
|
||||||
|
* @param request shooting range score request
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
recordShootingRangePoints(sessionId: string, pmcData: IPmcData, request: IRecordShootingRangePoints): void;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/items/moving - HideoutImproveArea
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param pmcData Profile to improve area in
|
||||||
|
* @param request Improve area request data
|
||||||
|
*/
|
||||||
|
improveArea(sessionId: string, pmcData: IPmcData, request: IHideoutImproveAreaRequestData): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/items/moving HideoutCancelProductionCommand
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param pmcData Profile with craft to cancel
|
||||||
|
* @param request Cancel production request data
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
cancelProduction(sessionId: string, pmcData: IPmcData, request: IHideoutCancelProductionRequestData): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Function called every x seconds as part of onUpdate event
|
||||||
|
*/
|
||||||
|
update(): void;
|
||||||
|
}
|
195
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/InraidController.d.ts
vendored
Normal file
195
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/InraidController.d.ts
vendored
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
import { ApplicationContext } from "@spt/context/ApplicationContext";
|
||||||
|
import { PlayerScavGenerator } from "@spt/generators/PlayerScavGenerator";
|
||||||
|
import { HealthHelper } from "@spt/helpers/HealthHelper";
|
||||||
|
import { InRaidHelper } from "@spt/helpers/InRaidHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { QuestHelper } from "@spt/helpers/QuestHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { IRegisterPlayerRequestData } from "@spt/models/eft/inRaid/IRegisterPlayerRequestData";
|
||||||
|
import { ISaveProgressRequestData } from "@spt/models/eft/inRaid/ISaveProgressRequestData";
|
||||||
|
import { PlayerRaidEndState } from "@spt/models/enums/PlayerRaidEndState";
|
||||||
|
import { IAirdropConfig } from "@spt/models/spt/config/IAirdropConfig";
|
||||||
|
import { IBTRConfig } from "@spt/models/spt/config/IBTRConfig";
|
||||||
|
import { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
||||||
|
import { IInRaidConfig } from "@spt/models/spt/config/IInRaidConfig";
|
||||||
|
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||||
|
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
|
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||||
|
import { ITraderServiceModel } from "@spt/models/spt/services/ITraderServiceModel";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { InsuranceService } from "@spt/services/InsuranceService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { MailSendService } from "@spt/services/MailSendService";
|
||||||
|
import { MatchBotDetailsCacheService } from "@spt/services/MatchBotDetailsCacheService";
|
||||||
|
import { PmcChatResponseService } from "@spt/services/PmcChatResponseService";
|
||||||
|
import { TraderServicesService } from "@spt/services/TraderServicesService";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
|
/**
|
||||||
|
* Logic for handling In Raid callbacks
|
||||||
|
*/
|
||||||
|
export declare class InraidController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected pmcChatResponseService: PmcChatResponseService;
|
||||||
|
protected matchBotDetailsCacheService: MatchBotDetailsCacheService;
|
||||||
|
protected questHelper: QuestHelper;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected playerScavGenerator: PlayerScavGenerator;
|
||||||
|
protected healthHelper: HealthHelper;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected traderServicesService: TraderServicesService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected insuranceService: InsuranceService;
|
||||||
|
protected inRaidHelper: InRaidHelper;
|
||||||
|
protected applicationContext: ApplicationContext;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected mailSendService: MailSendService;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected airdropConfig: IAirdropConfig;
|
||||||
|
protected btrConfig: IBTRConfig;
|
||||||
|
protected inRaidConfig: IInRaidConfig;
|
||||||
|
protected traderConfig: ITraderConfig;
|
||||||
|
protected locationConfig: ILocationConfig;
|
||||||
|
protected ragfairConfig: IRagfairConfig;
|
||||||
|
protected hideoutConfig: IHideoutConfig;
|
||||||
|
protected botConfig: IBotConfig;
|
||||||
|
constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, databaseService: DatabaseService, pmcChatResponseService: PmcChatResponseService, matchBotDetailsCacheService: MatchBotDetailsCacheService, questHelper: QuestHelper, itemHelper: ItemHelper, profileHelper: ProfileHelper, playerScavGenerator: PlayerScavGenerator, healthHelper: HealthHelper, traderHelper: TraderHelper, traderServicesService: TraderServicesService, localisationService: LocalisationService, insuranceService: InsuranceService, inRaidHelper: InRaidHelper, applicationContext: ApplicationContext, configServer: ConfigServer, mailSendService: MailSendService, randomUtil: RandomUtil);
|
||||||
|
/**
|
||||||
|
* Save locationId to active profiles inraid object AND app context
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param info Register player request
|
||||||
|
*/
|
||||||
|
addPlayer(sessionID: string, info: IRegisterPlayerRequestData): void;
|
||||||
|
/**
|
||||||
|
* Handle raid/profile/save
|
||||||
|
* Save profile state to disk
|
||||||
|
* Handles pmc/pscav
|
||||||
|
* @param offraidData post-raid request data
|
||||||
|
* @param sessionID Session id
|
||||||
|
*/
|
||||||
|
savePostRaidProgress(offraidData: ISaveProgressRequestData, sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Handle updating player profile post-pmc raid
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param postRaidRequest Post-raid data
|
||||||
|
*/
|
||||||
|
protected savePmcProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void;
|
||||||
|
/**
|
||||||
|
* Make changes to PMC profile after they've died in raid,
|
||||||
|
* Alter body part hp, handle insurance, delete inventory items, remove carried quest items
|
||||||
|
* @param postRaidSaveRequest Post-raid save request
|
||||||
|
* @param pmcData Pmc profile
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns Updated profile object
|
||||||
|
*/
|
||||||
|
protected performPostRaidActionsWhenDead(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData, sessionID: string): IPmcData;
|
||||||
|
/**
|
||||||
|
* Adjust player characters body part hp post-raid
|
||||||
|
* @param postRaidSaveRequest post raid data
|
||||||
|
* @param pmcData player profile
|
||||||
|
*/
|
||||||
|
protected updatePmcHealthPostRaid(postRaidSaveRequest: ISaveProgressRequestData, pmcData: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Reduce body part hp to % of max
|
||||||
|
* @param pmcData profile to edit
|
||||||
|
* @param multiplier multiplier to apply to max health
|
||||||
|
*/
|
||||||
|
protected reducePmcHealthToPercent(pmcData: IPmcData, multiplier: number): void;
|
||||||
|
/**
|
||||||
|
* Handle updating the profile post-pscav raid
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param postRaidRequest Post-raid data of raid
|
||||||
|
*/
|
||||||
|
protected savePlayerScavProgress(sessionID: string, postRaidRequest: ISaveProgressRequestData): void;
|
||||||
|
/**
|
||||||
|
* merge two dictionaries together
|
||||||
|
* Prioritise pair that has true as a value
|
||||||
|
* @param primary main dictionary
|
||||||
|
* @param secondary Secondary dictionary
|
||||||
|
*/
|
||||||
|
protected mergePmcAndScavEncyclopedias(primary: IPmcData, secondary: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Post-scav-raid any charisma increase must be propigated into PMC profile
|
||||||
|
* @param postRaidServerScavProfile Scav profile after adjustments made from raid
|
||||||
|
* @param postRaidServerPmcProfile Pmc profile after raid
|
||||||
|
* @param preRaidScavCharismaProgress charisma progress value pre-raid
|
||||||
|
*/
|
||||||
|
protected updatePmcCharismaSkillPostScavRaid(postRaidServerScavProfile: IPmcData, postRaidServerPmcProfile: IPmcData, preRaidScavCharismaProgress: number): void;
|
||||||
|
/**
|
||||||
|
* Does provided profile contain any condition counters
|
||||||
|
* @param profile Profile to check for condition counters
|
||||||
|
* @returns Profile has condition counters
|
||||||
|
*/
|
||||||
|
protected profileHasConditionCounters(profile: IPmcData): boolean;
|
||||||
|
/**
|
||||||
|
* Scav quest progress isnt transferred automatically from scav to pmc, we do this manually
|
||||||
|
* @param scavProfile Scav profile with quest progress post-raid
|
||||||
|
* @param pmcProfile Server pmc profile to copy scav quest progress into
|
||||||
|
*/
|
||||||
|
protected migrateScavQuestProgressToPmcProfile(scavProfile: IPmcData, pmcProfile: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Is the player dead after a raid - dead is anything other than "survived" / "runner"
|
||||||
|
* @param statusOnExit exit value from offraidData object
|
||||||
|
* @returns true if dead
|
||||||
|
*/
|
||||||
|
protected isPlayerDead(statusOnExit: PlayerRaidEndState): boolean;
|
||||||
|
/**
|
||||||
|
* Mark inventory items as FiR if player survived raid, otherwise remove FiR from them
|
||||||
|
* @param offraidData Save Progress Request
|
||||||
|
*/
|
||||||
|
protected markOrRemoveFoundInRaidItems(offraidData: ISaveProgressRequestData): void;
|
||||||
|
/**
|
||||||
|
* Update profile after player completes scav raid
|
||||||
|
* @param scavData Scav profile
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param offraidData Post-raid save request
|
||||||
|
* @param pmcData Pmc profile
|
||||||
|
* @param isDead Is player dead
|
||||||
|
*/
|
||||||
|
protected handlePostRaidPlayerScavProcess(scavData: IPmcData, sessionID: string, offraidData: ISaveProgressRequestData, pmcData: IPmcData, isDead: boolean): void;
|
||||||
|
/**
|
||||||
|
* Update profile with scav karma values based on in-raid actions
|
||||||
|
* @param pmcData Pmc profile
|
||||||
|
* @param offraidData Post-raid save request
|
||||||
|
* @param scavData Scav profile
|
||||||
|
*/
|
||||||
|
protected handlePostRaidPlayerScavKarmaChanges(pmcData: IPmcData, offraidData: ISaveProgressRequestData, scavData: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Get the inraid config from configs/inraid.json
|
||||||
|
* @returns InRaid Config
|
||||||
|
*/
|
||||||
|
getInraidConfig(): IInRaidConfig;
|
||||||
|
/**
|
||||||
|
* Get airdrop config from configs/airdrop.json
|
||||||
|
* @returns Airdrop config
|
||||||
|
*/
|
||||||
|
getAirdropConfig(): IAirdropConfig;
|
||||||
|
/**
|
||||||
|
* Get BTR config from configs/btr.json
|
||||||
|
* @returns Airdrop config
|
||||||
|
*/
|
||||||
|
getBTRConfig(): IBTRConfig;
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/traderServices/getTraderServices
|
||||||
|
* @returns Trader services data
|
||||||
|
*/
|
||||||
|
getTraderServices(sessionId: string, traderId: string): ITraderServiceModel[];
|
||||||
|
/**
|
||||||
|
* Handle singleplayer/traderServices/itemDelivery
|
||||||
|
*/
|
||||||
|
itemDelivery(sessionId: string, traderId: string, items: Item[]): void;
|
||||||
|
getTraitorScavHostileChance(url: string, sessionID: string): number;
|
||||||
|
getSandboxMaxPatrolValue(url: string, sessionID: string): number;
|
||||||
|
getBossConvertSettings(url: string, sessionId: string): string[];
|
||||||
|
}
|
207
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/InsuranceController.d.ts
vendored
Normal file
207
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/InsuranceController.d.ts
vendored
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
import { DialogueHelper } from "@spt/helpers/DialogueHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { IGetInsuranceCostRequestData } from "@spt/models/eft/insurance/IGetInsuranceCostRequestData";
|
||||||
|
import { IGetInsuranceCostResponseData } from "@spt/models/eft/insurance/IGetInsuranceCostResponseData";
|
||||||
|
import { IInsureRequestData } from "@spt/models/eft/insurance/IInsureRequestData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { Insurance } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { IInsuranceConfig } from "@spt/models/spt/config/IInsuranceConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { InsuranceService } from "@spt/services/InsuranceService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { MailSendService } from "@spt/services/MailSendService";
|
||||||
|
import { PaymentService } from "@spt/services/PaymentService";
|
||||||
|
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { MathUtil } from "@spt/utils/MathUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class InsuranceController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected mathUtil: MathUtil;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected dialogueHelper: DialogueHelper;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected paymentService: PaymentService;
|
||||||
|
protected insuranceService: InsuranceService;
|
||||||
|
protected mailSendService: MailSendService;
|
||||||
|
protected ragfairPriceService: RagfairPriceService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected insuranceConfig: IInsuranceConfig;
|
||||||
|
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, hashUtil: HashUtil, eventOutputHolder: EventOutputHolder, timeUtil: TimeUtil, saveServer: SaveServer, databaseService: DatabaseService, itemHelper: ItemHelper, profileHelper: ProfileHelper, dialogueHelper: DialogueHelper, weightedRandomHelper: WeightedRandomHelper, traderHelper: TraderHelper, paymentService: PaymentService, insuranceService: InsuranceService, mailSendService: MailSendService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Process insurance items of all profiles prior to being given back to the player through the mail service.
|
||||||
|
*
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
processReturn(): void;
|
||||||
|
/**
|
||||||
|
* Process insurance items of a single profile prior to being given back to the player through the mail service.
|
||||||
|
*
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
processReturnByProfile(sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Get all insured items that are ready to be processed in a specific profile.
|
||||||
|
*
|
||||||
|
* @param sessionID Session ID of the profile to check.
|
||||||
|
* @param time The time to check ready status against. Current time by default.
|
||||||
|
* @returns All insured items that are ready to be processed.
|
||||||
|
*/
|
||||||
|
protected filterInsuredItems(sessionID: string, time?: number): Insurance[];
|
||||||
|
/**
|
||||||
|
* This method orchestrates the processing of insured items in a profile.
|
||||||
|
*
|
||||||
|
* @param insuranceDetails The insured items to process.
|
||||||
|
* @param sessionID The session ID that should receive the processed items.
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
protected processInsuredItems(insuranceDetails: Insurance[], sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Count all items in all insurance packages.
|
||||||
|
* @param insurance
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
protected countAllInsuranceItems(insurance: Insurance[]): number;
|
||||||
|
/**
|
||||||
|
* Remove an insurance package from a profile using the package's system data information.
|
||||||
|
*
|
||||||
|
* @param sessionID The session ID of the profile to remove the package from.
|
||||||
|
* @param index The array index of the insurance package to remove.
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
protected removeInsurancePackageFromProfile(sessionID: string, insPackage: Insurance): void;
|
||||||
|
/**
|
||||||
|
* Finds the items that should be deleted based on the given Insurance object.
|
||||||
|
*
|
||||||
|
* @param rootItemParentID - The ID that should be assigned to all "hideout"/root items.
|
||||||
|
* @param insured - The insurance object containing the items to evaluate for deletion.
|
||||||
|
* @returns A Set containing the IDs of items that should be deleted.
|
||||||
|
*/
|
||||||
|
protected findItemsToDelete(rootItemParentID: string, insured: Insurance): Set<string>;
|
||||||
|
/**
|
||||||
|
* Initialize a Map object that holds main-parents to all of their attachments. Note that "main-parent" in this
|
||||||
|
* context refers to the parent item that an attachment is attached to. For example, a suppressor attached to a gun,
|
||||||
|
* not the backpack that the gun is located in (the gun's parent).
|
||||||
|
*
|
||||||
|
* @param rootItemParentID - The ID that should be assigned to all "hideout"/root items.
|
||||||
|
* @param insured - The insurance object containing the items to evaluate.
|
||||||
|
* @param itemsMap - A Map object for quick item look-up by item ID.
|
||||||
|
* @returns A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
*/
|
||||||
|
protected populateParentAttachmentsMap(rootItemParentID: string, insured: Insurance, itemsMap: Map<string, Item>): Map<string, Item[]>;
|
||||||
|
/**
|
||||||
|
* Remove attachments that can not be moddable in-raid from the parentAttachmentsMap. If no moddable attachments
|
||||||
|
* remain, the parent is removed from the map as well.
|
||||||
|
*
|
||||||
|
* @param parentAttachmentsMap - A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
* @param itemsMap - A Map object for quick item look-up by item ID.
|
||||||
|
* @returns A Map object containing parent item IDs to arrays of their attachment items which are not moddable in-raid.
|
||||||
|
*/
|
||||||
|
protected removeNonModdableAttachments(parentAttachmentsMap: Map<string, Item[]>, itemsMap: Map<string, Item>): Map<string, Item[]>;
|
||||||
|
/**
|
||||||
|
* Process "regular" insurance items. Any insured item that is not an attached, attachment is considered a "regular"
|
||||||
|
* item. This method iterates over them, preforming item deletion rolls to see if they should be deleted. If so,
|
||||||
|
* they (and their attached, attachments, if any) are marked for deletion in the toDelete Set.
|
||||||
|
*
|
||||||
|
* @param insured The insurance object containing the items to evaluate.
|
||||||
|
* @param toDelete A Set to keep track of items marked for deletion.
|
||||||
|
* @param parentAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
protected processRegularItems(insured: Insurance, toDelete: Set<string>, parentAttachmentsMap: Map<string, Item[]>): void;
|
||||||
|
/**
|
||||||
|
* Process parent items and their attachments, updating the toDelete Set accordingly.
|
||||||
|
*
|
||||||
|
* @param mainParentToAttachmentsMap A Map object containing parent item IDs to arrays of their attachment items.
|
||||||
|
* @param itemsMap A Map object for quick item look-up by item ID.
|
||||||
|
* @param traderId The trader ID from the Insurance object.
|
||||||
|
* @param toDelete A Set object to keep track of items marked for deletion.
|
||||||
|
*/
|
||||||
|
protected processAttachments(mainParentToAttachmentsMap: Map<string, Item[]>, itemsMap: Map<string, Item>, traderId: string, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Takes an array of attachment items that belong to the same main-parent item, sorts them in descending order by
|
||||||
|
* their maximum price. For each attachment, a roll is made to determine if a deletion should be made. Once the
|
||||||
|
* number of deletions has been counted, the attachments are added to the toDelete Set, starting with the most
|
||||||
|
* valuable attachments first.
|
||||||
|
*
|
||||||
|
* @param attachments The array of attachment items to sort, filter, and roll.
|
||||||
|
* @param traderId The ID of the trader to that has ensured these items.
|
||||||
|
* @param toDelete The array that accumulates the IDs of the items to be deleted.
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
protected processAttachmentByParent(attachments: Item[], traderId: string, toDelete: Set<string>): void;
|
||||||
|
protected logAttachmentsBeingRemoved(attachmentIdsToRemove: string[], attachments: Item[], attachmentPrices: Record<string, number>): void;
|
||||||
|
protected weightAttachmentsByPrice(attachments: Item[]): Record<string, number>;
|
||||||
|
/**
|
||||||
|
* Get count of items to remove from weapon (take into account trader + price of attachment)
|
||||||
|
* @param weightedAttachmentByPrice Dict of item Tpls and thier rouble price
|
||||||
|
* @param traderId Trader attachment insured against
|
||||||
|
* @returns Attachment count to remove
|
||||||
|
*/
|
||||||
|
protected getAttachmentCountToRemove(weightedAttachmentByPrice: Record<string, number>, traderId: string): number;
|
||||||
|
/**
|
||||||
|
* Remove items from the insured items that should not be returned to the player.
|
||||||
|
*
|
||||||
|
* @param insured The insured items to process.
|
||||||
|
* @param toDelete The items that should be deleted.
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
protected removeItemsFromInsurance(insured: Insurance, toDelete: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Handle sending the insurance message to the user that potentially contains the valid insurance items.
|
||||||
|
*
|
||||||
|
* @param sessionID The session ID that should receive the insurance message.
|
||||||
|
* @param insurance The context of insurance to use.
|
||||||
|
* @returns void
|
||||||
|
*/
|
||||||
|
protected sendMail(sessionID: string, insurance: Insurance): void;
|
||||||
|
/**
|
||||||
|
* Determines whether an insured item should be removed from the player's inventory based on a random roll and
|
||||||
|
* trader-specific return chance.
|
||||||
|
*
|
||||||
|
* @param traderId The ID of the trader who insured the item.
|
||||||
|
* @param insuredItem Optional. The item to roll for. Only used for logging.
|
||||||
|
* @returns true if the insured item should be removed from inventory, false otherwise, or undefined on error.
|
||||||
|
*/
|
||||||
|
protected rollForDelete(traderId: string, insuredItem?: Item): boolean | undefined;
|
||||||
|
/**
|
||||||
|
* Handle Insure event
|
||||||
|
* Add insurance to an item
|
||||||
|
*
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param body Insurance request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse object to send to client
|
||||||
|
*/
|
||||||
|
insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/insurance/items/list/cost
|
||||||
|
* Calculate insurance cost
|
||||||
|
*
|
||||||
|
* @param request request object
|
||||||
|
* @param sessionID session id
|
||||||
|
* @returns IGetInsuranceCostResponseData object to send to client
|
||||||
|
*/
|
||||||
|
cost(request: IGetInsuranceCostRequestData, sessionID: string): IGetInsuranceCostResponseData;
|
||||||
|
}
|
231
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/InventoryController.d.ts
vendored
Normal file
231
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/InventoryController.d.ts
vendored
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
import { LootGenerator } from "@spt/generators/LootGenerator";
|
||||||
|
import { HideoutHelper } from "@spt/helpers/HideoutHelper";
|
||||||
|
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PaymentHelper } from "@spt/helpers/PaymentHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { QuestHelper } from "@spt/helpers/QuestHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IInventoryBindRequestData } from "@spt/models/eft/inventory/IInventoryBindRequestData";
|
||||||
|
import { IInventoryCreateMarkerRequestData } from "@spt/models/eft/inventory/IInventoryCreateMarkerRequestData";
|
||||||
|
import { IInventoryDeleteMarkerRequestData } from "@spt/models/eft/inventory/IInventoryDeleteMarkerRequestData";
|
||||||
|
import { IInventoryEditMarkerRequestData } from "@spt/models/eft/inventory/IInventoryEditMarkerRequestData";
|
||||||
|
import { IInventoryExamineRequestData } from "@spt/models/eft/inventory/IInventoryExamineRequestData";
|
||||||
|
import { IInventoryFoldRequestData } from "@spt/models/eft/inventory/IInventoryFoldRequestData";
|
||||||
|
import { IInventoryMergeRequestData } from "@spt/models/eft/inventory/IInventoryMergeRequestData";
|
||||||
|
import { IInventoryMoveRequestData } from "@spt/models/eft/inventory/IInventoryMoveRequestData";
|
||||||
|
import { IInventoryReadEncyclopediaRequestData } from "@spt/models/eft/inventory/IInventoryReadEncyclopediaRequestData";
|
||||||
|
import { IInventoryRemoveRequestData } from "@spt/models/eft/inventory/IInventoryRemoveRequestData";
|
||||||
|
import { IInventorySortRequestData } from "@spt/models/eft/inventory/IInventorySortRequestData";
|
||||||
|
import { IInventorySplitRequestData } from "@spt/models/eft/inventory/IInventorySplitRequestData";
|
||||||
|
import { IInventorySwapRequestData } from "@spt/models/eft/inventory/IInventorySwapRequestData";
|
||||||
|
import { IInventoryTagRequestData } from "@spt/models/eft/inventory/IInventoryTagRequestData";
|
||||||
|
import { IInventoryToggleRequestData } from "@spt/models/eft/inventory/IInventoryToggleRequestData";
|
||||||
|
import { IInventoryTransferRequestData } from "@spt/models/eft/inventory/IInventoryTransferRequestData";
|
||||||
|
import { IOpenRandomLootContainerRequestData } from "@spt/models/eft/inventory/IOpenRandomLootContainerRequestData";
|
||||||
|
import { IRedeemProfileRequestData } from "@spt/models/eft/inventory/IRedeemProfileRequestData";
|
||||||
|
import { ISetFavoriteItems } from "@spt/models/eft/inventory/ISetFavoriteItems";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { FenceService } from "@spt/services/FenceService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { MapMarkerService } from "@spt/services/MapMarkerService";
|
||||||
|
import { PlayerService } from "@spt/services/PlayerService";
|
||||||
|
import { RagfairOfferService } from "@spt/services/RagfairOfferService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class InventoryController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected fenceService: FenceService;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected inventoryHelper: InventoryHelper;
|
||||||
|
protected questHelper: QuestHelper;
|
||||||
|
protected hideoutHelper: HideoutHelper;
|
||||||
|
protected ragfairOfferService: RagfairOfferService;
|
||||||
|
protected mapMarkerService: MapMarkerService;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected paymentHelper: PaymentHelper;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected playerService: PlayerService;
|
||||||
|
protected lootGenerator: LootGenerator;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected httpResponseUtil: HttpResponseUtil;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, itemHelper: ItemHelper, randomUtil: RandomUtil, databaseService: DatabaseService, fenceService: FenceService, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, questHelper: QuestHelper, hideoutHelper: HideoutHelper, ragfairOfferService: RagfairOfferService, mapMarkerService: MapMarkerService, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, traderHelper: TraderHelper, localisationService: LocalisationService, playerService: PlayerService, lootGenerator: LootGenerator, eventOutputHolder: EventOutputHolder, httpResponseUtil: HttpResponseUtil, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Move Item
|
||||||
|
* change location of item with parentId and slotId
|
||||||
|
* transfers items from one profile to another if fromOwner/toOwner is set in the body.
|
||||||
|
* otherwise, move is contained within the same profile_f.
|
||||||
|
* @param pmcData Profile
|
||||||
|
* @param moveRequest Move request data
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
moveItem(pmcData: IPmcData, moveRequest: IInventoryMoveRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Get a event router response with inventory trader message
|
||||||
|
* @param output Item event router response
|
||||||
|
* @returns Item event router response
|
||||||
|
*/
|
||||||
|
protected appendTraderExploitErrorResponse(output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Handle Remove event
|
||||||
|
* Implements functionality "Discard" from Main menu (Stash etc.)
|
||||||
|
* Removes item from PMC Profile
|
||||||
|
*/
|
||||||
|
discardItem(pmcData: IPmcData, request: IInventoryRemoveRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Split Item
|
||||||
|
* spliting 1 stack into 2
|
||||||
|
* @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile)
|
||||||
|
* @param request Split request
|
||||||
|
* @param sessionID Session/player id
|
||||||
|
* @param output Client response
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
splitItem(pmcData: IPmcData, request: IInventorySplitRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Fully merge 2 inventory stacks together into one stack (merging where both stacks remain is called 'transfer')
|
||||||
|
* Deletes item from `body.item` and adding number of stacks into `body.with`
|
||||||
|
* @param pmcData Player profile (unused, getOwnerInventoryItems() gets profile)
|
||||||
|
* @param body Merge request
|
||||||
|
* @param sessionID Player id
|
||||||
|
* @param output Client response
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* TODO: Adds no data to output to send to client, is this by design?
|
||||||
|
* Transfer items from one stack into another while keeping original stack
|
||||||
|
* Used to take items from scav inventory into stash or to insert ammo into mags (shotgun ones) and reloading weapon by clicking "Reload"
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param body Transfer request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Swap Item
|
||||||
|
* its used for "reload" if you have weapon in hands and magazine is somewhere else in rig or backpack in equipment
|
||||||
|
* Also used to swap items using quick selection on character screen
|
||||||
|
*/
|
||||||
|
swapItem(pmcData: IPmcData, request: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handles folding of Weapons
|
||||||
|
*/
|
||||||
|
foldItem(pmcData: IPmcData, request: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Toggles "Toggleable" items like night vision goggles and face shields.
|
||||||
|
* @param pmcData player profile
|
||||||
|
* @param body Toggle request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Add a tag to an inventory item
|
||||||
|
* @param pmcData profile with item to add tag to
|
||||||
|
* @param body tag request data
|
||||||
|
* @param sessionID session id
|
||||||
|
* @returns client response object
|
||||||
|
*/
|
||||||
|
tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Bind an inventory item to the quick access menu at bottom of player screen
|
||||||
|
* Handle bind event
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param bindRequest Reqeust object
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
bindItem(pmcData: IPmcData, bindRequest: IInventoryBindRequestData, sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Unbind an inventory item from quick access menu at bottom of player screen
|
||||||
|
* Handle unbind event
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param bindRequest Request object
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
unbindItem(pmcData: IPmcData, request: IInventoryBindRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Handles examining an item
|
||||||
|
* @param pmcData player profile
|
||||||
|
* @param body request object
|
||||||
|
* @param sessionID session id
|
||||||
|
* @param output Client response
|
||||||
|
* @returns response
|
||||||
|
*/
|
||||||
|
examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Flag an item as seen in profiles encyclopedia + add inspect xp to profile
|
||||||
|
* @param itemTpls Inspected item tpls
|
||||||
|
* @param fullProfile Profile to add xp to
|
||||||
|
*/
|
||||||
|
protected flagItemsAsInspectedAndRewardXp(itemTpls: string[], fullProfile: ISptProfile): void;
|
||||||
|
/**
|
||||||
|
* Get the tplid of an item from the examine request object
|
||||||
|
* @param request Response request
|
||||||
|
* @returns tplId
|
||||||
|
*/
|
||||||
|
protected getExaminedItemTpl(request: IInventoryExamineRequestData): string;
|
||||||
|
readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle ApplyInventoryChanges
|
||||||
|
* Sorts supplied items.
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request sort request
|
||||||
|
* @param sessionID Session id
|
||||||
|
*/
|
||||||
|
sortInventory(pmcData: IPmcData, request: IInventorySortRequestData, sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Add note to a map
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Add marker request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
createMapMarker(pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Delete a map marker
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Delete marker request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
deleteMapMarker(pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Edit an existing map marker
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param request Edit marker request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
editMapMarker(pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Handle OpenRandomLootContainer event
|
||||||
|
* Handle event fired when a container is unpacked (currently only the halloween pumpkin)
|
||||||
|
* @param pmcData Profile data
|
||||||
|
* @param body Open loot container request data
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param output Client response
|
||||||
|
*/
|
||||||
|
openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, output: IItemEventRouterResponse): void;
|
||||||
|
redeemProfileReward(pmcData: IPmcData, request: IRedeemProfileRequestData, sessionId: string): void;
|
||||||
|
setFavoriteItem(pmcData: IPmcData, request: ISetFavoriteItems, sessionId: string): void;
|
||||||
|
}
|
65
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/LauncherController.d.ts
vendored
Normal file
65
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/LauncherController.d.ts
vendored
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import { HttpServerHelper } from "@spt/helpers/HttpServerHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { PreSptModLoader } from "@spt/loaders/PreSptModLoader";
|
||||||
|
import { IChangeRequestData } from "@spt/models/eft/launcher/IChangeRequestData";
|
||||||
|
import { ILoginRequestData } from "@spt/models/eft/launcher/ILoginRequestData";
|
||||||
|
import { IRegisterData } from "@spt/models/eft/launcher/IRegisterData";
|
||||||
|
import { IConnectResponse } from "@spt/models/eft/profile/IConnectResponse";
|
||||||
|
import { Info, ModDetails } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig";
|
||||||
|
import { IPackageJsonData } from "@spt/models/spt/mod/IPackageJsonData";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class LauncherController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected httpServerHelper: HttpServerHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected preSptModLoader: PreSptModLoader;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected coreConfig: ICoreConfig;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, timeUtil: TimeUtil, randomUtil: RandomUtil, saveServer: SaveServer, httpServerHelper: HttpServerHelper, profileHelper: ProfileHelper, databaseService: DatabaseService, localisationService: LocalisationService, preSptModLoader: PreSptModLoader, configServer: ConfigServer);
|
||||||
|
connect(): IConnectResponse;
|
||||||
|
/**
|
||||||
|
* Get descriptive text for each of the profile edtions a player can choose, keyed by profile.json profile type e.g. "Edge Of Darkness"
|
||||||
|
* @returns Dictionary of profile types with related descriptive text
|
||||||
|
*/
|
||||||
|
protected getProfileDescriptions(): Record<string, string>;
|
||||||
|
find(sessionId: string): Info;
|
||||||
|
login(info: ILoginRequestData): string;
|
||||||
|
register(info: IRegisterData): string;
|
||||||
|
protected createAccount(info: IRegisterData): string;
|
||||||
|
protected generateProfileId(): string;
|
||||||
|
protected formatID(timeStamp: number, counter: number): string;
|
||||||
|
changeUsername(info: IChangeRequestData): string;
|
||||||
|
changePassword(info: IChangeRequestData): string;
|
||||||
|
/**
|
||||||
|
* Handle launcher requesting profile be wiped
|
||||||
|
* @param info IRegisterData
|
||||||
|
* @returns Session id
|
||||||
|
*/
|
||||||
|
wipe(info: IRegisterData): string;
|
||||||
|
getCompatibleTarkovVersion(): string;
|
||||||
|
/**
|
||||||
|
* Get the mods the server has currently loaded
|
||||||
|
* @returns Dictionary of mod name and mod details
|
||||||
|
*/
|
||||||
|
getLoadedServerMods(): Record<string, IPackageJsonData>;
|
||||||
|
/**
|
||||||
|
* Get the mods a profile has ever loaded into game with
|
||||||
|
* @param sessionId Player id
|
||||||
|
* @returns Array of mod details
|
||||||
|
*/
|
||||||
|
getServerModsProfileUsed(sessionId: string): ModDetails[];
|
||||||
|
}
|
80
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/LocationController.d.ts
vendored
Normal file
80
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/LocationController.d.ts
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import { ApplicationContext } from "@spt/context/ApplicationContext";
|
||||||
|
import { LocationGenerator } from "@spt/generators/LocationGenerator";
|
||||||
|
import { LootGenerator } from "@spt/generators/LootGenerator";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
|
||||||
|
import { ILocationsGenerateAllResponse } from "@spt/models/eft/common/ILocationsSourceDestinationBase";
|
||||||
|
import { IAirdropLootResult } from "@spt/models/eft/location/IAirdropLootResult";
|
||||||
|
import { IGetLocationRequestData } from "@spt/models/eft/location/IGetLocationRequestData";
|
||||||
|
import { AirdropTypeEnum } from "@spt/models/enums/AirdropType";
|
||||||
|
import { IAirdropConfig } from "@spt/models/spt/config/IAirdropConfig";
|
||||||
|
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||||
|
import { LootRequest } from "@spt/models/spt/services/LootRequest";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { RaidTimeAdjustmentService } from "@spt/services/RaidTimeAdjustmentService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class LocationController {
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected locationGenerator: LocationGenerator;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected raidTimeAdjustmentService: RaidTimeAdjustmentService;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
protected lootGenerator: LootGenerator;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected applicationContext: ApplicationContext;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected airdropConfig: IAirdropConfig;
|
||||||
|
protected locationConfig: ILocationConfig;
|
||||||
|
constructor(hashUtil: HashUtil, randomUtil: RandomUtil, weightedRandomHelper: WeightedRandomHelper, logger: ILogger, locationGenerator: LocationGenerator, localisationService: LocalisationService, raidTimeAdjustmentService: RaidTimeAdjustmentService, itemFilterService: ItemFilterService, lootGenerator: LootGenerator, databaseService: DatabaseService, timeUtil: TimeUtil, configServer: ConfigServer, applicationContext: ApplicationContext, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Handle client/location/getLocalloot
|
||||||
|
* Get a location (map) with generated loot data
|
||||||
|
* @param sessionId Player id
|
||||||
|
* @param request Map request to generate
|
||||||
|
* @returns ILocationBase
|
||||||
|
*/
|
||||||
|
get(sessionId: string, request: IGetLocationRequestData): ILocationBase;
|
||||||
|
/**
|
||||||
|
* Generate a maps base location and loot
|
||||||
|
* @param name Map name
|
||||||
|
* @returns ILocationBase
|
||||||
|
*/
|
||||||
|
protected generate(name: string): ILocationBase;
|
||||||
|
/**
|
||||||
|
* Handle client/locations
|
||||||
|
* Get all maps base location properties without loot data
|
||||||
|
* @param sessionId Players Id
|
||||||
|
* @returns ILocationsGenerateAllResponse
|
||||||
|
*/
|
||||||
|
generateAll(sessionId: string): ILocationsGenerateAllResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/location/getAirdropLoot
|
||||||
|
* Get loot for an airdrop container
|
||||||
|
* Generates it randomly based on config/airdrop.json values
|
||||||
|
* @returns Array of LootItem objects
|
||||||
|
*/
|
||||||
|
getAirdropLoot(): IAirdropLootResult;
|
||||||
|
/**
|
||||||
|
* Randomly pick a type of airdrop loot using weighted values from config
|
||||||
|
* @returns airdrop type value
|
||||||
|
*/
|
||||||
|
protected chooseAirdropType(): AirdropTypeEnum;
|
||||||
|
/**
|
||||||
|
* Get the configuration for a specific type of airdrop
|
||||||
|
* @param airdropType Type of airdrop to get settings for
|
||||||
|
* @returns LootRequest
|
||||||
|
*/
|
||||||
|
protected getAirdropLootConfigByType(airdropType: AirdropTypeEnum): LootRequest;
|
||||||
|
}
|
104
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/MatchController.d.ts
vendored
Normal file
104
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/MatchController.d.ts
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
import { ApplicationContext } from "@spt/context/ApplicationContext";
|
||||||
|
import { LootGenerator } from "@spt/generators/LootGenerator";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IEndOfflineRaidRequestData } from "@spt/models/eft/match/IEndOfflineRaidRequestData";
|
||||||
|
import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData";
|
||||||
|
import { IMatchGroupStartGameRequest } from "@spt/models/eft/match/IMatchGroupStartGameRequest";
|
||||||
|
import { IMatchGroupStatusRequest } from "@spt/models/eft/match/IMatchGroupStatusRequest";
|
||||||
|
import { IMatchGroupStatusResponse } from "@spt/models/eft/match/IMatchGroupStatusResponse";
|
||||||
|
import { IProfileStatusResponse } from "@spt/models/eft/match/IProfileStatusResponse";
|
||||||
|
import { IInRaidConfig } from "@spt/models/spt/config/IInRaidConfig";
|
||||||
|
import { IMatchConfig } from "@spt/models/spt/config/IMatchConfig";
|
||||||
|
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
||||||
|
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { BotGenerationCacheService } from "@spt/services/BotGenerationCacheService";
|
||||||
|
import { BotLootCacheService } from "@spt/services/BotLootCacheService";
|
||||||
|
import { MailSendService } from "@spt/services/MailSendService";
|
||||||
|
import { MatchLocationService } from "@spt/services/MatchLocationService";
|
||||||
|
import { ProfileSnapshotService } from "@spt/services/ProfileSnapshotService";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class MatchController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected matchLocationService: MatchLocationService;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected botLootCacheService: BotLootCacheService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected profileSnapshotService: ProfileSnapshotService;
|
||||||
|
protected botGenerationCacheService: BotGenerationCacheService;
|
||||||
|
protected mailSendService: MailSendService;
|
||||||
|
protected lootGenerator: LootGenerator;
|
||||||
|
protected applicationContext: ApplicationContext;
|
||||||
|
protected matchConfig: IMatchConfig;
|
||||||
|
protected inRaidConfig: IInRaidConfig;
|
||||||
|
protected traderConfig: ITraderConfig;
|
||||||
|
protected pmcConfig: IPmcConfig;
|
||||||
|
constructor(logger: ILogger, saveServer: SaveServer, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, profileHelper: ProfileHelper, matchLocationService: MatchLocationService, traderHelper: TraderHelper, botLootCacheService: BotLootCacheService, configServer: ConfigServer, profileSnapshotService: ProfileSnapshotService, botGenerationCacheService: BotGenerationCacheService, mailSendService: MailSendService, lootGenerator: LootGenerator, applicationContext: ApplicationContext);
|
||||||
|
getEnabled(): boolean;
|
||||||
|
/** Handle client/match/group/delete */
|
||||||
|
deleteGroup(info: any): void;
|
||||||
|
/** Handle match/group/start_game */
|
||||||
|
joinMatch(info: IMatchGroupStartGameRequest, sessionId: string): IProfileStatusResponse;
|
||||||
|
/** Handle client/match/group/status */
|
||||||
|
getGroupStatus(info: IMatchGroupStatusRequest): IMatchGroupStatusResponse;
|
||||||
|
/**
|
||||||
|
* Handle /client/raid/configuration
|
||||||
|
* @param request Raid config request
|
||||||
|
* @param sessionID Session id
|
||||||
|
*/
|
||||||
|
startOfflineRaid(request: IGetRaidConfigurationRequestData, sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Convert a difficulty value from pre-raid screen to a bot difficulty
|
||||||
|
* @param botDifficulty dropdown difficulty value
|
||||||
|
* @returns bot difficulty
|
||||||
|
*/
|
||||||
|
protected convertDifficultyDropdownIntoBotDifficulty(botDifficulty: string): string;
|
||||||
|
/** Handle client/match/offline/end */
|
||||||
|
endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void;
|
||||||
|
/**
|
||||||
|
* Did player take a COOP extract
|
||||||
|
* @param extractName Name of extract player took
|
||||||
|
* @returns True if coop extract
|
||||||
|
*/
|
||||||
|
protected extractWasViaCoop(extractName: string): boolean;
|
||||||
|
protected sendCoopTakenFenceMessage(sessionId: string): void;
|
||||||
|
/**
|
||||||
|
* Handle when a player extracts using a coop extract - add rep to fence
|
||||||
|
* @param sessionId Session/player id
|
||||||
|
* @param pmcData Profile
|
||||||
|
* @param extractName Name of extract taken
|
||||||
|
*/
|
||||||
|
protected handleCoopExtract(sessionId: string, pmcData: IPmcData, extractName: string): void;
|
||||||
|
/**
|
||||||
|
* Was extract by car
|
||||||
|
* @param extractName name of extract
|
||||||
|
* @returns true if car extract
|
||||||
|
*/
|
||||||
|
protected extractWasViaCar(extractName: string): boolean;
|
||||||
|
/**
|
||||||
|
* Handle when a player extracts using a car - Add rep to fence
|
||||||
|
* @param extractName name of the extract used
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param sessionId Session id
|
||||||
|
*/
|
||||||
|
protected handleCarExtract(extractName: string, pmcData: IPmcData, sessionId: string): void;
|
||||||
|
/**
|
||||||
|
* Get the fence rep gain from using a car or coop extract
|
||||||
|
* @param pmcData Profile
|
||||||
|
* @param baseGain amount gained for the first extract
|
||||||
|
* @param extractCount Number of times extract was taken
|
||||||
|
* @returns Fence standing after taking extract
|
||||||
|
*/
|
||||||
|
protected getFenceStandingAfterExtract(pmcData: IPmcData, baseGain: number, extractCount: number): number;
|
||||||
|
}
|
11
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/NoteController.d.ts
vendored
Normal file
11
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/NoteController.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { INoteActionData } from "@spt/models/eft/notes/INoteActionData";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
export declare class NoteController {
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
constructor(eventOutputHolder: EventOutputHolder);
|
||||||
|
addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
editNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
deleteNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
}
|
23
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/NotifierController.d.ts
vendored
Normal file
23
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/NotifierController.d.ts
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { HttpServerHelper } from "@spt/helpers/HttpServerHelper";
|
||||||
|
import { NotifierHelper } from "@spt/helpers/NotifierHelper";
|
||||||
|
import { INotifierChannel } from "@spt/models/eft/notifier/INotifier";
|
||||||
|
import { NotificationService } from "@spt/services/NotificationService";
|
||||||
|
export declare class NotifierController {
|
||||||
|
protected notifierHelper: NotifierHelper;
|
||||||
|
protected httpServerHelper: HttpServerHelper;
|
||||||
|
protected notificationService: NotificationService;
|
||||||
|
protected pollInterval: number;
|
||||||
|
protected timeout: number;
|
||||||
|
constructor(notifierHelper: NotifierHelper, httpServerHelper: HttpServerHelper, notificationService: NotificationService);
|
||||||
|
/**
|
||||||
|
* Resolve an array of session notifications.
|
||||||
|
*
|
||||||
|
* If no notifications are currently queued then intermittently check for new notifications until either
|
||||||
|
* one or more appear or when a timeout expires.
|
||||||
|
* If no notifications are available after the timeout, use a default message.
|
||||||
|
*/
|
||||||
|
notifyAsync(sessionID: string): Promise<unknown>;
|
||||||
|
getServer(sessionID: string): string;
|
||||||
|
/** Handle client/notifier/channel/create */
|
||||||
|
getChannel(sessionID: string): INotifierChannel;
|
||||||
|
}
|
10
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/PresetController.d.ts
vendored
Normal file
10
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/PresetController.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
export declare class PresetController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
constructor(logger: ILogger, presetHelper: PresetHelper, databaseService: DatabaseService);
|
||||||
|
initialize(): void;
|
||||||
|
}
|
126
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/ProfileController.d.ts
vendored
Normal file
126
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/ProfileController.d.ts
vendored
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
import { PlayerScavGenerator } from "@spt/generators/PlayerScavGenerator";
|
||||||
|
import { DialogueHelper } from "@spt/helpers/DialogueHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { QuestHelper } from "@spt/helpers/QuestHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IMiniProfile } from "@spt/models/eft/launcher/IMiniProfile";
|
||||||
|
import { GetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData";
|
||||||
|
import { IGetOtherProfileRequest } from "@spt/models/eft/profile/IGetOtherProfileRequest";
|
||||||
|
import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse";
|
||||||
|
import { IGetProfileSettingsRequest } from "@spt/models/eft/profile/IGetProfileSettingsRequest";
|
||||||
|
import { IProfileChangeNicknameRequestData } from "@spt/models/eft/profile/IProfileChangeNicknameRequestData";
|
||||||
|
import { IProfileChangeVoiceRequestData } from "@spt/models/eft/profile/IProfileChangeVoiceRequestData";
|
||||||
|
import { IProfileCreateRequestData } from "@spt/models/eft/profile/IProfileCreateRequestData";
|
||||||
|
import { ISearchFriendRequestData } from "@spt/models/eft/profile/ISearchFriendRequestData";
|
||||||
|
import { ISearchFriendResponse } from "@spt/models/eft/profile/ISearchFriendResponse";
|
||||||
|
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { IValidateNicknameRequestData } from "@spt/models/eft/profile/IValidateNicknameRequestData";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { MailSendService } from "@spt/services/MailSendService";
|
||||||
|
import { ProfileFixerService } from "@spt/services/ProfileFixerService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class ProfileController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected profileFixerService: ProfileFixerService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected mailSendService: MailSendService;
|
||||||
|
protected playerScavGenerator: PlayerScavGenerator;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected dialogueHelper: DialogueHelper;
|
||||||
|
protected questHelper: QuestHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, cloner: ICloner, timeUtil: TimeUtil, saveServer: SaveServer, databaseService: DatabaseService, itemHelper: ItemHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, seasonalEventService: SeasonalEventService, mailSendService: MailSendService, playerScavGenerator: PlayerScavGenerator, eventOutputHolder: EventOutputHolder, traderHelper: TraderHelper, dialogueHelper: DialogueHelper, questHelper: QuestHelper, profileHelper: ProfileHelper);
|
||||||
|
/**
|
||||||
|
* Handle /launcher/profiles
|
||||||
|
*/
|
||||||
|
getMiniProfiles(): IMiniProfile[];
|
||||||
|
/**
|
||||||
|
* Handle launcher/profile/info
|
||||||
|
*/
|
||||||
|
getMiniProfile(sessionID: string): IMiniProfile;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/list
|
||||||
|
*/
|
||||||
|
getCompleteProfile(sessionID: string): IPmcData[];
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/create
|
||||||
|
* @param info Client reqeust object
|
||||||
|
* @param sessionID Player id
|
||||||
|
* @returns Profiles _id value
|
||||||
|
*/
|
||||||
|
createProfile(info: IProfileCreateRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* make profiles pmcData.Inventory.equipment unique
|
||||||
|
* @param pmcData Profile to update
|
||||||
|
*/
|
||||||
|
protected updateInventoryEquipmentId(pmcData: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Delete a profile
|
||||||
|
* @param sessionID Id of profile to delete
|
||||||
|
*/
|
||||||
|
protected deleteProfileBySessionId(sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Iterate over all quests in player profile, inspect rewards for the quests current state (accepted/completed)
|
||||||
|
* and send rewards to them in mail
|
||||||
|
* @param profileDetails Player profile
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @param response Event router response
|
||||||
|
*/
|
||||||
|
protected givePlayerStartingQuestRewards(profileDetails: ISptProfile, sessionID: string, response: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* For each trader reset their state to what a level 1 player would see
|
||||||
|
* @param sessionId Session id of profile to reset
|
||||||
|
*/
|
||||||
|
protected resetAllTradersInProfile(sessionId: string): void;
|
||||||
|
/**
|
||||||
|
* Generate a player scav object
|
||||||
|
* PMC profile MUST exist first before pscav can be generated
|
||||||
|
* @param sessionID
|
||||||
|
* @returns IPmcData object
|
||||||
|
*/
|
||||||
|
generatePlayerScav(sessionID: string): IPmcData;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/nickname/validate
|
||||||
|
*/
|
||||||
|
validateNickname(info: IValidateNicknameRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/nickname/change event
|
||||||
|
* Client allows player to adjust their profile name
|
||||||
|
*/
|
||||||
|
changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/voice/change event
|
||||||
|
*/
|
||||||
|
changeVoice(info: IProfileChangeVoiceRequestData, sessionID: string): void;
|
||||||
|
/**
|
||||||
|
* Handle client/game/profile/search
|
||||||
|
*/
|
||||||
|
getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[];
|
||||||
|
/**
|
||||||
|
* Handle client/profile/status
|
||||||
|
*/
|
||||||
|
getProfileStatus(sessionId: string): GetProfileStatusResponseData;
|
||||||
|
getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse;
|
||||||
|
/**
|
||||||
|
* Handle client/profile/settings
|
||||||
|
*/
|
||||||
|
setChosenProfileIcon(sessionId: string, request: IGetProfileSettingsRequest): void;
|
||||||
|
}
|
196
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/QuestController.d.ts
vendored
Normal file
196
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/QuestController.d.ts
vendored
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
import { DialogueHelper } from "@spt/helpers/DialogueHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { QuestConditionHelper } from "@spt/helpers/QuestConditionHelper";
|
||||||
|
import { QuestHelper } from "@spt/helpers/QuestHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IQuestStatus } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { IQuest, IQuestCondition } from "@spt/models/eft/common/tables/IQuest";
|
||||||
|
import { IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IAcceptQuestRequestData } from "@spt/models/eft/quests/IAcceptQuestRequestData";
|
||||||
|
import { ICompleteQuestRequestData } from "@spt/models/eft/quests/ICompleteQuestRequestData";
|
||||||
|
import { IFailQuestRequestData } from "@spt/models/eft/quests/IFailQuestRequestData";
|
||||||
|
import { IHandoverQuestRequestData } from "@spt/models/eft/quests/IHandoverQuestRequestData";
|
||||||
|
import { IQuestConfig } from "@spt/models/spt/config/IQuestConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocaleService } from "@spt/services/LocaleService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { MailSendService } from "@spt/services/MailSendService";
|
||||||
|
import { PlayerService } from "@spt/services/PlayerService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class QuestController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected httpResponseUtil: HttpResponseUtil;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected dialogueHelper: DialogueHelper;
|
||||||
|
protected mailSendService: MailSendService;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected questHelper: QuestHelper;
|
||||||
|
protected questConditionHelper: QuestConditionHelper;
|
||||||
|
protected playerService: PlayerService;
|
||||||
|
protected localeService: LocaleService;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected questConfig: IQuestConfig;
|
||||||
|
constructor(logger: ILogger, timeUtil: TimeUtil, httpResponseUtil: HttpResponseUtil, eventOutputHolder: EventOutputHolder, databaseService: DatabaseService, itemHelper: ItemHelper, dialogueHelper: DialogueHelper, mailSendService: MailSendService, profileHelper: ProfileHelper, traderHelper: TraderHelper, questHelper: QuestHelper, questConditionHelper: QuestConditionHelper, playerService: PlayerService, localeService: LocaleService, seasonalEventService: SeasonalEventService, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Handle client/quest/list
|
||||||
|
* Get all quests visible to player
|
||||||
|
* Exclude quests with incomplete preconditions (level/loyalty)
|
||||||
|
* @param sessionID session id
|
||||||
|
* @returns array of IQuest
|
||||||
|
*/
|
||||||
|
getClientQuests(sessionID: string): IQuest[];
|
||||||
|
/**
|
||||||
|
* Does a provided quest have a level requirement equal to or below defined level
|
||||||
|
* @param quest Quest to check
|
||||||
|
* @param playerLevel level of player to test against quest
|
||||||
|
* @returns true if quest can be seen/accepted by player of defined level
|
||||||
|
*/
|
||||||
|
protected playerLevelFulfillsQuestRequirement(quest: IQuest, playerLevel: number): boolean;
|
||||||
|
/**
|
||||||
|
* Should a quest be shown to the player in trader quest screen
|
||||||
|
* @param questId Quest to check
|
||||||
|
* @returns true = show to player
|
||||||
|
*/
|
||||||
|
protected showEventQuestToPlayer(questId: string): boolean;
|
||||||
|
/**
|
||||||
|
* Handle QuestAccept event
|
||||||
|
* Handle the client accepting a quest and starting it
|
||||||
|
* Send starting rewards if any to player and
|
||||||
|
* Send start notification if any to player
|
||||||
|
* @param pmcData Profile to update
|
||||||
|
* @param acceptedQuest Quest accepted
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns Client response
|
||||||
|
*/
|
||||||
|
acceptQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle the client accepting a repeatable quest and starting it
|
||||||
|
* Send starting rewards if any to player and
|
||||||
|
* Send start notification if any to player
|
||||||
|
* @param pmcData Profile to update with new quest
|
||||||
|
* @param acceptedQuest Quest being accepted
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
acceptRepeatableQuest(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
protected createAcceptedQuestClientResponse(sessionID: string, pmcData: IPmcData, repeatableQuestProfile: IRepeatableQuest): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Look for an accepted quest inside player profile, return matching
|
||||||
|
* @param pmcData Profile to search through
|
||||||
|
* @param acceptedQuest Quest to search for
|
||||||
|
* @returns IRepeatableQuest
|
||||||
|
*/
|
||||||
|
protected getRepeatableQuestFromProfile(pmcData: IPmcData, acceptedQuest: IAcceptQuestRequestData): IRepeatableQuest;
|
||||||
|
/**
|
||||||
|
* Handle QuestComplete event
|
||||||
|
* Update completed quest in profile
|
||||||
|
* Add newly unlocked quests to profile
|
||||||
|
* Also recalculate their level due to exp rewards
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param body Completed quest request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns ItemEvent client response
|
||||||
|
*/
|
||||||
|
completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Return a list of quests that would fail when supplied quest is completed
|
||||||
|
* @param completedQuestId quest completed id
|
||||||
|
* @returns array of IQuest objects
|
||||||
|
*/
|
||||||
|
protected getQuestsFailedByCompletingQuest(completedQuestId: string, pmcProfile: IPmcData): IQuest[];
|
||||||
|
/**
|
||||||
|
* Remove a quest entirely from a profile
|
||||||
|
* @param sessionId Player id
|
||||||
|
* @param questIdToRemove Qid of quest to remove
|
||||||
|
*/
|
||||||
|
protected removeQuestFromScavProfile(sessionId: string, questIdToRemove: string): void;
|
||||||
|
/**
|
||||||
|
* Return quests that have different statuses
|
||||||
|
* @param preQuestStatusus Quests before
|
||||||
|
* @param postQuestStatuses Quests after
|
||||||
|
* @returns QuestStatusChange array
|
||||||
|
*/
|
||||||
|
protected getQuestsWithDifferentStatuses(preQuestStatusus: IQuestStatus[], postQuestStatuses: IQuestStatus[]): IQuestStatus[] | undefined;
|
||||||
|
/**
|
||||||
|
* Send a popup to player on successful completion of a quest
|
||||||
|
* @param sessionID session id
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param completedQuestId Completed quest id
|
||||||
|
* @param questRewards Rewards given to player
|
||||||
|
*/
|
||||||
|
protected sendSuccessDialogMessageOnQuestComplete(sessionID: string, pmcData: IPmcData, completedQuestId: string, questRewards: Item[]): void;
|
||||||
|
/**
|
||||||
|
* Look for newly available quests after completing a quest with a requirement to wait x minutes (time-locked) before being available and add data to profile
|
||||||
|
* @param pmcData Player profile to update
|
||||||
|
* @param quests Quests to look for wait conditions in
|
||||||
|
* @param completedQuestId Quest just completed
|
||||||
|
*/
|
||||||
|
protected addTimeLockedQuestsToProfile(pmcData: IPmcData, quests: IQuest[], completedQuestId: string): void;
|
||||||
|
/**
|
||||||
|
* Fail the provided quests
|
||||||
|
* Update quest in profile, otherwise add fresh quest object with failed status
|
||||||
|
* @param sessionID session id
|
||||||
|
* @param pmcData player profile
|
||||||
|
* @param questsToFail quests to fail
|
||||||
|
* @param output Client output
|
||||||
|
*/
|
||||||
|
protected failQuests(sessionID: string, pmcData: IPmcData, questsToFail: IQuest[], output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Handle QuestHandover event
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param handoverQuestRequest handover item request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
handoverQuest(pmcData: IPmcData, handoverQuestRequest: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Show warning to user and write to log that repeatable quest failed a condition check
|
||||||
|
* @param handoverQuestRequest Quest request
|
||||||
|
* @param output Response to send to user
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
protected showRepeatableQuestInvalidConditionError(handoverQuestRequest: IHandoverQuestRequestData, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Show warning to user and write to log quest item handed over did not match what is required
|
||||||
|
* @param handoverQuestRequest Quest request
|
||||||
|
* @param itemHandedOver Non-matching item found
|
||||||
|
* @param handoverRequirements Quest handover requirements
|
||||||
|
* @param output Response to send to user
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
protected showQuestItemHandoverMatchError(handoverQuestRequest: IHandoverQuestRequestData, itemHandedOver: Item, handoverRequirements: IQuestCondition, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Increment a backend counter stored value by an amount,
|
||||||
|
* Create counter if it does not exist
|
||||||
|
* @param pmcData Profile to find backend counter in
|
||||||
|
* @param conditionId backend counter id to update
|
||||||
|
* @param questId quest id counter is associated with
|
||||||
|
* @param counterValue value to increment the backend counter with
|
||||||
|
*/
|
||||||
|
protected updateProfileTaskConditionCounterValue(pmcData: IPmcData, conditionId: string, questId: string, counterValue: number): void;
|
||||||
|
/**
|
||||||
|
* Handle /client/game/profile/items/moving - QuestFail
|
||||||
|
* @param pmcData Pmc profile
|
||||||
|
* @param request Fail qeust request
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
failQuest(pmcData: IPmcData, request: IFailQuestRequestData, sessionID: string, output: IItemEventRouterResponse): IItemEventRouterResponse;
|
||||||
|
}
|
211
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/RagfairController.d.ts
vendored
Normal file
211
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/RagfairController.d.ts
vendored
Normal file
@ -0,0 +1,211 @@
|
|||||||
|
import { RagfairOfferGenerator } from "@spt/generators/RagfairOfferGenerator";
|
||||||
|
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||||
|
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PaymentHelper } from "@spt/helpers/PaymentHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { RagfairHelper } from "@spt/helpers/RagfairHelper";
|
||||||
|
import { RagfairOfferHelper } from "@spt/helpers/RagfairOfferHelper";
|
||||||
|
import { RagfairSellHelper } from "@spt/helpers/RagfairSellHelper";
|
||||||
|
import { RagfairSortHelper } from "@spt/helpers/RagfairSortHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITraderAssort } from "@spt/models/eft/common/tables/ITrader";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { IAddOfferRequestData, Requirement } from "@spt/models/eft/ragfair/IAddOfferRequestData";
|
||||||
|
import { IExtendOfferRequestData } from "@spt/models/eft/ragfair/IExtendOfferRequestData";
|
||||||
|
import { IGetItemPriceResult } from "@spt/models/eft/ragfair/IGetItemPriceResult";
|
||||||
|
import { IGetMarketPriceRequestData } from "@spt/models/eft/ragfair/IGetMarketPriceRequestData";
|
||||||
|
import { IGetOffersResult } from "@spt/models/eft/ragfair/IGetOffersResult";
|
||||||
|
import { IGetRagfairOfferByIdRequest } from "@spt/models/eft/ragfair/IGetRagfairOfferByIdRequest";
|
||||||
|
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||||
|
import { IRemoveOfferRequestData } from "@spt/models/eft/ragfair/IRemoveOfferRequestData";
|
||||||
|
import { ISearchRequestData } from "@spt/models/eft/ragfair/ISearchRequestData";
|
||||||
|
import { IProcessBuyTradeRequestData } from "@spt/models/eft/trade/IProcessBuyTradeRequestData";
|
||||||
|
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { RagfairServer } from "@spt/servers/RagfairServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { PaymentService } from "@spt/services/PaymentService";
|
||||||
|
import { RagfairOfferService } from "@spt/services/RagfairOfferService";
|
||||||
|
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||||
|
import { RagfairRequiredItemsService } from "@spt/services/RagfairRequiredItemsService";
|
||||||
|
import { RagfairTaxService } from "@spt/services/RagfairTaxService";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
/**
|
||||||
|
* Handle RagfairCallback events
|
||||||
|
*/
|
||||||
|
export declare class RagfairController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected ragfairServer: RagfairServer;
|
||||||
|
protected ragfairPriceService: RagfairPriceService;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected ragfairSellHelper: RagfairSellHelper;
|
||||||
|
protected ragfairTaxService: RagfairTaxService;
|
||||||
|
protected ragfairSortHelper: RagfairSortHelper;
|
||||||
|
protected ragfairOfferHelper: RagfairOfferHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected paymentService: PaymentService;
|
||||||
|
protected handbookHelper: HandbookHelper;
|
||||||
|
protected paymentHelper: PaymentHelper;
|
||||||
|
protected inventoryHelper: InventoryHelper;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected ragfairHelper: RagfairHelper;
|
||||||
|
protected ragfairOfferService: RagfairOfferService;
|
||||||
|
protected ragfairRequiredItemsService: RagfairRequiredItemsService;
|
||||||
|
protected ragfairOfferGenerator: RagfairOfferGenerator;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected ragfairConfig: IRagfairConfig;
|
||||||
|
constructor(logger: ILogger, timeUtil: TimeUtil, httpResponse: HttpResponseUtil, eventOutputHolder: EventOutputHolder, ragfairServer: RagfairServer, ragfairPriceService: RagfairPriceService, databaseService: DatabaseService, itemHelper: ItemHelper, saveServer: SaveServer, ragfairSellHelper: RagfairSellHelper, ragfairTaxService: RagfairTaxService, ragfairSortHelper: RagfairSortHelper, ragfairOfferHelper: RagfairOfferHelper, profileHelper: ProfileHelper, paymentService: PaymentService, handbookHelper: HandbookHelper, paymentHelper: PaymentHelper, inventoryHelper: InventoryHelper, traderHelper: TraderHelper, ragfairHelper: RagfairHelper, ragfairOfferService: RagfairOfferService, ragfairRequiredItemsService: RagfairRequiredItemsService, ragfairOfferGenerator: RagfairOfferGenerator, localisationService: LocalisationService, configServer: ConfigServer);
|
||||||
|
/**
|
||||||
|
* Handles client/ragfair/find
|
||||||
|
* Returns flea offers that match required search parameters
|
||||||
|
* @param sessionID Player id
|
||||||
|
* @param searchRequest Search request data
|
||||||
|
* @returns IGetOffersResult
|
||||||
|
*/
|
||||||
|
getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult;
|
||||||
|
/**
|
||||||
|
* Handle client/ragfair/offer/findbyid
|
||||||
|
* Occurs when searching for `#x` on flea
|
||||||
|
* @param sessionId Player id
|
||||||
|
* @param request Request data
|
||||||
|
* @returns IRagfairOffer
|
||||||
|
*/
|
||||||
|
getOfferById(sessionId: string, request: IGetRagfairOfferByIdRequest): IRagfairOffer;
|
||||||
|
/**
|
||||||
|
* Get offers for the client based on type of search being performed
|
||||||
|
* @param searchRequest Client search request data
|
||||||
|
* @param itemsToAdd Comes from ragfairHelper.filterCategories()
|
||||||
|
* @param traderAssorts Trader assorts
|
||||||
|
* @param pmcProfile Player profile
|
||||||
|
* @returns array of offers
|
||||||
|
*/
|
||||||
|
protected getOffersForSearchType(searchRequest: ISearchRequestData, itemsToAdd: string[], traderAssorts: Record<string, ITraderAssort>, pmcProfile: IPmcData): IRagfairOffer[];
|
||||||
|
/**
|
||||||
|
* Get categories for the type of search being performed, linked/required/all
|
||||||
|
* @param searchRequest Client search request data
|
||||||
|
* @param offers Ragfair offers to get categories for
|
||||||
|
* @returns record with templates + counts
|
||||||
|
*/
|
||||||
|
protected getSpecificCategories(pmcProfile: IPmcData, searchRequest: ISearchRequestData, offers: IRagfairOffer[]): Record<string, number>;
|
||||||
|
/**
|
||||||
|
* Add index to all offers passed in (0-indexed)
|
||||||
|
* @param offers Offers to add index value to
|
||||||
|
*/
|
||||||
|
protected addIndexValueToOffers(offers: IRagfairOffer[]): void;
|
||||||
|
/**
|
||||||
|
* Update a trader flea offer with buy restrictions stored in the traders assort
|
||||||
|
* @param offer Flea offer to update
|
||||||
|
* @param fullProfile Players full profile
|
||||||
|
*/
|
||||||
|
protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: ISptProfile): void;
|
||||||
|
/**
|
||||||
|
* Adjust ragfair offer stack count to match same value as traders assort stack count
|
||||||
|
* @param offer Flea offer to adjust stack size of
|
||||||
|
*/
|
||||||
|
protected setTraderOfferStackSize(offer: IRagfairOffer): void;
|
||||||
|
/**
|
||||||
|
* Is the flea search being performed a 'linked' search type
|
||||||
|
* @param info Search request
|
||||||
|
* @returns True if it is a 'linked' search type
|
||||||
|
*/
|
||||||
|
protected isLinkedSearch(info: ISearchRequestData): boolean;
|
||||||
|
/**
|
||||||
|
* Is the flea search being performed a 'required' search type
|
||||||
|
* @param info Search request
|
||||||
|
* @returns True if it is a 'required' search type
|
||||||
|
*/
|
||||||
|
protected isRequiredSearch(info: ISearchRequestData): boolean;
|
||||||
|
/**
|
||||||
|
* Check all profiles and sell player offers / send player money for listing if it sold
|
||||||
|
*/
|
||||||
|
update(): void;
|
||||||
|
/**
|
||||||
|
* Called when creating an offer on flea, fills values in top right corner
|
||||||
|
* @param getPriceRequest
|
||||||
|
* @returns min/avg/max values for an item based on flea offers available
|
||||||
|
*/
|
||||||
|
getItemMinAvgMaxFleaPriceValues(getPriceRequest: IGetMarketPriceRequestData): IGetItemPriceResult;
|
||||||
|
/**
|
||||||
|
* List item(s) on flea for sale
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param offerRequest Flea list creation offer
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
addPlayerOffer(pmcData: IPmcData, offerRequest: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Charge player a listing fee for using flea, pulls charge from data previously sent by client
|
||||||
|
* @param sessionID Player id
|
||||||
|
* @param rootItem Base item being listed (used when client tax cost not found and must be done on server)
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param requirementsPriceInRub Rouble cost player chose for listing (used when client tax cost not found and must be done on server)
|
||||||
|
* @param itemStackCount How many items were listed in player (used when client tax cost not found and must be done on server)
|
||||||
|
* @param offerRequest Add offer request object from client
|
||||||
|
* @param output IItemEventRouterResponse
|
||||||
|
* @returns True if charging tax to player failed
|
||||||
|
*/
|
||||||
|
protected chargePlayerTaxFee(sessionID: string, rootItem: Item, pmcData: IPmcData, requirementsPriceInRub: number, itemStackCount: number, offerRequest: IAddOfferRequestData, output: IItemEventRouterResponse): boolean;
|
||||||
|
/**
|
||||||
|
* Is the item to be listed on the flea valid
|
||||||
|
* @param offerRequest Client offer request
|
||||||
|
* @param errorMessage message to show to player when offer is invalid
|
||||||
|
* @returns Is offer valid
|
||||||
|
*/
|
||||||
|
protected isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean;
|
||||||
|
/**
|
||||||
|
* Get the handbook price in roubles for the items being listed
|
||||||
|
* @param requirements
|
||||||
|
* @returns Rouble price
|
||||||
|
*/
|
||||||
|
protected calculateRequirementsPriceInRub(requirements: Requirement[]): number;
|
||||||
|
/**
|
||||||
|
* Using item ids from flea offer request, find corresponding items from player inventory and return as array
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param itemIdsFromFleaOfferRequest Ids from request
|
||||||
|
* @returns Array of items from player inventory
|
||||||
|
*/
|
||||||
|
protected getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): {
|
||||||
|
items: Item[] | undefined;
|
||||||
|
errorMessage: string | undefined;
|
||||||
|
};
|
||||||
|
createPlayerOffer(sessionId: string, requirements: Requirement[], items: Item[], sellInOnePiece: boolean): IRagfairOffer;
|
||||||
|
getAllFleaPrices(): Record<string, number>;
|
||||||
|
getStaticPrices(): Record<string, number>;
|
||||||
|
/**
|
||||||
|
* User requested removal of the offer, actually reduces the time to 71 seconds,
|
||||||
|
* allowing for the possibility of extending the auction before it's end time
|
||||||
|
* @param removeRequest Remove offer request
|
||||||
|
* @param sessionId Players id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
removeOffer(removeRequest: IRemoveOfferRequestData, sessionId: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Extend a ragfair offers listing time
|
||||||
|
* @param extendRequest Extend offer request
|
||||||
|
* @param sessionId Players id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
extendOffer(extendRequest: IExtendOfferRequestData, sessionId: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Create a basic trader request object with price and currency type
|
||||||
|
* @param currency What currency: RUB, EURO, USD
|
||||||
|
* @param value Amount of currency
|
||||||
|
* @returns IProcessBuyTradeRequestData
|
||||||
|
*/
|
||||||
|
protected createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData;
|
||||||
|
}
|
45
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/RepairController.d.ts
vendored
Normal file
45
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/RepairController.d.ts
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { QuestHelper } from "@spt/helpers/QuestHelper";
|
||||||
|
import { RepairHelper } from "@spt/helpers/RepairHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IRepairActionDataRequest } from "@spt/models/eft/repair/IRepairActionDataRequest";
|
||||||
|
import { ITraderRepairActionDataRequest } from "@spt/models/eft/repair/ITraderRepairActionDataRequest";
|
||||||
|
import { IRepairConfig } from "@spt/models/spt/config/IRepairConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { PaymentService } from "@spt/services/PaymentService";
|
||||||
|
import { RepairService } from "@spt/services/RepairService";
|
||||||
|
export declare class RepairController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected questHelper: QuestHelper;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected paymentService: PaymentService;
|
||||||
|
protected repairHelper: RepairHelper;
|
||||||
|
protected repairService: RepairService;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected repairConfig: IRepairConfig;
|
||||||
|
constructor(logger: ILogger, eventOutputHolder: EventOutputHolder, databaseService: DatabaseService, questHelper: QuestHelper, traderHelper: TraderHelper, paymentService: PaymentService, repairHelper: RepairHelper, repairService: RepairService, profileHelper: ProfileHelper);
|
||||||
|
/**
|
||||||
|
* Handle TraderRepair event
|
||||||
|
* Repair with trader
|
||||||
|
* @param sessionID session id
|
||||||
|
* @param body endpoint request data
|
||||||
|
* @param pmcData player profile
|
||||||
|
* @returns item event router action
|
||||||
|
*/
|
||||||
|
traderRepair(sessionID: string, body: ITraderRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Handle Repair event
|
||||||
|
* Repair with repair kit
|
||||||
|
* @param sessionID session id
|
||||||
|
* @param body endpoint request data
|
||||||
|
* @param pmcData player profile
|
||||||
|
* @returns item event router action
|
||||||
|
*/
|
||||||
|
repairWithKit(sessionID: string, body: IRepairActionDataRequest, pmcData: IPmcData): IItemEventRouterResponse;
|
||||||
|
}
|
167
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/RepeatableQuestController.d.ts
vendored
Normal file
167
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/RepeatableQuestController.d.ts
vendored
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
import { RepeatableQuestGenerator } from "@spt/generators/RepeatableQuestGenerator";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { QuestHelper } from "@spt/helpers/QuestHelper";
|
||||||
|
import { RepeatableQuestHelper } from "@spt/helpers/RepeatableQuestHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IPmcDataRepeatableQuest, IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
import { IRepeatableQuestChangeRequest } from "@spt/models/eft/quests/IRepeatableQuestChangeRequest";
|
||||||
|
import { ELocationName } from "@spt/models/enums/ELocationName";
|
||||||
|
import { IQuestConfig, IRepeatableQuestConfig } from "@spt/models/spt/config/IQuestConfig";
|
||||||
|
import { IGetRepeatableByIdResult } from "@spt/models/spt/quests/IGetRepeatableByIdResult";
|
||||||
|
import { IQuestTypePool } from "@spt/models/spt/repeatable/IQuestTypePool";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { PaymentService } from "@spt/services/PaymentService";
|
||||||
|
import { ProfileFixerService } from "@spt/services/ProfileFixerService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { ObjectId } from "@spt/utils/ObjectId";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class RepeatableQuestController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected profileFixerService: ProfileFixerService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected paymentService: PaymentService;
|
||||||
|
protected objectId: ObjectId;
|
||||||
|
protected repeatableQuestGenerator: RepeatableQuestGenerator;
|
||||||
|
protected repeatableQuestHelper: RepeatableQuestHelper;
|
||||||
|
protected questHelper: QuestHelper;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected questConfig: IQuestConfig;
|
||||||
|
constructor(logger: ILogger, databaseService: DatabaseService, timeUtil: TimeUtil, randomUtil: RandomUtil, httpResponse: HttpResponseUtil, profileHelper: ProfileHelper, profileFixerService: ProfileFixerService, localisationService: LocalisationService, eventOutputHolder: EventOutputHolder, paymentService: PaymentService, objectId: ObjectId, repeatableQuestGenerator: RepeatableQuestGenerator, repeatableQuestHelper: RepeatableQuestHelper, questHelper: QuestHelper, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Handle client/repeatalbeQuests/activityPeriods
|
||||||
|
* Returns an array of objects in the format of repeatable quests to the client.
|
||||||
|
* repeatableQuestObject = {
|
||||||
|
* id: Unique Id,
|
||||||
|
* name: "Daily",
|
||||||
|
* endTime: the time when the quests expire
|
||||||
|
* activeQuests: currently available quests in an array. Each element of quest type format (see assets/database/templates/repeatableQuests.json).
|
||||||
|
* inactiveQuests: the quests which were previously active (required by client to fail them if they are not completed)
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* The method checks if the player level requirement for repeatable quests (e.g. daily lvl5, weekly lvl15) is met and if the previously active quests
|
||||||
|
* are still valid. This ischecked by endTime persisted in profile accordning to the resetTime configured for each repeatable kind (daily, weekly)
|
||||||
|
* in QuestCondig.js
|
||||||
|
*
|
||||||
|
* If the condition is met, new repeatableQuests are created, old quests (which are persisted in the profile.RepeatableQuests[i].activeQuests) are
|
||||||
|
* moved to profile.RepeatableQuests[i].inactiveQuests. This memory is required to get rid of old repeatable quest data in the profile, otherwise
|
||||||
|
* they'll litter the profile's Quests field.
|
||||||
|
* (if the are on "Succeed" but not "Completed" we keep them, to allow the player to complete them and get the rewards)
|
||||||
|
* The new quests generated are again persisted in profile.RepeatableQuests
|
||||||
|
*
|
||||||
|
* @param {string} sessionID Player's session id
|
||||||
|
*
|
||||||
|
* @returns {array} Array of "repeatableQuestObjects" as described above
|
||||||
|
*/
|
||||||
|
getClientRepeatableQuests(sessionID: string): IPmcDataRepeatableQuest[];
|
||||||
|
/**
|
||||||
|
* Expire quests and replace expired quests with ready-to-hand-in quests inside generatedRepeatables.activeQuests
|
||||||
|
* @param generatedRepeatables Repeatables to process (daily/weekly)
|
||||||
|
* @param pmcData Player profile
|
||||||
|
*/
|
||||||
|
protected processExpiredQuests(generatedRepeatables: IPmcDataRepeatableQuest, pmcData: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Check if a repeatable quest type (daily/weekly) is active for the given profile
|
||||||
|
* @param repeatableConfig Repeatable quest config
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @returns True if profile is allowed to access dailies
|
||||||
|
*/
|
||||||
|
protected canProfileAccessRepeatableQuests(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): boolean;
|
||||||
|
/**
|
||||||
|
* Does player have daily scav quests unlocked
|
||||||
|
* @param pmcData Player profile to check
|
||||||
|
* @returns True if unlocked
|
||||||
|
*/
|
||||||
|
protected playerHasDailyScavQuestsUnlocked(pmcData: IPmcData): boolean;
|
||||||
|
/**
|
||||||
|
* Does player have daily pmc quests unlocked
|
||||||
|
* @param pmcData Player profile to check
|
||||||
|
* @param repeatableConfig Config of daily type to check
|
||||||
|
* @returns True if unlocked
|
||||||
|
*/
|
||||||
|
protected playerHasDailyPmcQuestsUnlocked(pmcData: IPmcData, repeatableConfig: IRepeatableQuestConfig): boolean;
|
||||||
|
/**
|
||||||
|
* Get the number of quests to generate - takes into account charisma state of player
|
||||||
|
* @param repeatableConfig Config
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @returns Quest count
|
||||||
|
*/
|
||||||
|
protected getQuestCount(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): number;
|
||||||
|
/**
|
||||||
|
* Get repeatable quest data from profile from name (daily/weekly), creates base repeatable quest object if none exists
|
||||||
|
* @param repeatableConfig daily/weekly config
|
||||||
|
* @param pmcData Profile to search
|
||||||
|
* @returns IPmcDataRepeatableQuest
|
||||||
|
*/
|
||||||
|
protected getRepeatableQuestSubTypeFromProfile(repeatableConfig: IRepeatableQuestConfig, pmcData: IPmcData): IPmcDataRepeatableQuest;
|
||||||
|
/**
|
||||||
|
* Just for debug reasons. Draws dailies a random assort of dailies extracted from dumps
|
||||||
|
*/
|
||||||
|
generateDebugDailies(dailiesPool: any, factory: any, number: number): any;
|
||||||
|
/**
|
||||||
|
* Used to create a quest pool during each cycle of repeatable quest generation. The pool will be subsequently
|
||||||
|
* narrowed down during quest generation to avoid duplicate quests. Like duplicate extractions or elimination quests
|
||||||
|
* where you have to e.g. kill scavs in same locations.
|
||||||
|
* @param repeatableConfig main repeatable quest config
|
||||||
|
* @param pmcLevel level of pmc generating quest pool
|
||||||
|
* @returns IQuestTypePool
|
||||||
|
*/
|
||||||
|
protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool;
|
||||||
|
protected createBaseQuestPool(repeatableConfig: IRepeatableQuestConfig): IQuestTypePool;
|
||||||
|
/**
|
||||||
|
* Return the locations this PMC is allowed to get daily quests for based on their level
|
||||||
|
* @param locations The original list of locations
|
||||||
|
* @param pmcLevel The players level
|
||||||
|
* @returns A filtered list of locations that allow the player PMC level to access it
|
||||||
|
*/
|
||||||
|
protected getAllowedLocationsForPmcLevel(locations: Record<ELocationName, string[]>, pmcLevel: number): Partial<Record<ELocationName, string[]>>;
|
||||||
|
/**
|
||||||
|
* Return true if the given pmcLevel is allowed on the given location
|
||||||
|
* @param location The location name to check
|
||||||
|
* @param pmcLevel The level of the pmc
|
||||||
|
* @returns True if the given pmc level is allowed to access the given location
|
||||||
|
*/
|
||||||
|
protected isPmcLevelAllowedOnLocation(location: string, pmcLevel: number): boolean;
|
||||||
|
debugLogRepeatableQuestIds(pmcData: IPmcData): void;
|
||||||
|
/**
|
||||||
|
* Handle RepeatableQuestChange event
|
||||||
|
*
|
||||||
|
* Replace a players repeatable quest
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param changeRequest Request object
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
changeRepeatableQuest(pmcData: IPmcData, changeRequest: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Find a repeatable (daily/weekly/scav) from a players profile by its id
|
||||||
|
* @param questId Id of quest to find
|
||||||
|
* @param pmcData Profile that contains quests to look through
|
||||||
|
* @returns IGetRepeatableByIdResult
|
||||||
|
*/
|
||||||
|
protected getRepeatableById(questId: string, pmcData: IPmcData): IGetRepeatableByIdResult;
|
||||||
|
protected attemptToGenerateRepeatableQuest(pmcData: IPmcData, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
|
||||||
|
/**
|
||||||
|
* Some accounts have access to free repeatable quest refreshes
|
||||||
|
* Track the usage of them inside players profile
|
||||||
|
* @param fullProfile Player profile
|
||||||
|
* @param repeatableSubType Can be daily / weekly / scav repeatable
|
||||||
|
* @param repeatableTypeName Subtype of repeatable quest: daily / weekly / scav
|
||||||
|
* @returns Is the repeatable being replaced for free
|
||||||
|
*/
|
||||||
|
protected useFreeRefreshIfAvailable(fullProfile: ISptProfile, repeatableSubType: IPmcDataRepeatableQuest, repeatableTypeName: string): boolean;
|
||||||
|
}
|
96
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/TradeController.d.ts
vendored
Normal file
96
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/TradeController.d.ts
vendored
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { TradeHelper } from "@spt/helpers/TradeHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITraderBase } from "@spt/models/eft/common/tables/ITrader";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IRagfairOffer } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||||
|
import { IProcessBaseTradeRequestData } from "@spt/models/eft/trade/IProcessBaseTradeRequestData";
|
||||||
|
import { IOfferRequest, IProcessRagfairTradeRequestData } from "@spt/models/eft/trade/IProcessRagfairTradeRequestData";
|
||||||
|
import { ISellScavItemsToFenceRequestData } from "@spt/models/eft/trade/ISellScavItemsToFenceRequestData";
|
||||||
|
import { Traders } from "@spt/models/enums/Traders";
|
||||||
|
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
|
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { RagfairServer } from "@spt/servers/RagfairServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { MailSendService } from "@spt/services/MailSendService";
|
||||||
|
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class TradeController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
protected tradeHelper: TradeHelper;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected ragfairServer: RagfairServer;
|
||||||
|
protected httpResponse: HttpResponseUtil;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected ragfairPriceService: RagfairPriceService;
|
||||||
|
protected mailSendService: MailSendService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected ragfairConfig: IRagfairConfig;
|
||||||
|
protected traderConfig: ITraderConfig;
|
||||||
|
constructor(logger: ILogger, databaseService: DatabaseService, eventOutputHolder: EventOutputHolder, tradeHelper: TradeHelper, timeUtil: TimeUtil, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, ragfairServer: RagfairServer, httpResponse: HttpResponseUtil, localisationService: LocalisationService, ragfairPriceService: RagfairPriceService, mailSendService: MailSendService, configServer: ConfigServer);
|
||||||
|
/** Handle TradingConfirm event */
|
||||||
|
confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle RagFairBuyOffer event */
|
||||||
|
confirmRagfairTrading(pmcData: IPmcData, request: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Buy an item off the flea sold by a trader
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param fleaOffer Offer being purchased
|
||||||
|
* @param requestOffer request data from client
|
||||||
|
* @param output Output to send back to client
|
||||||
|
*/
|
||||||
|
protected buyTraderItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Buy an item off the flea sold by a PMC
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @param fleaOffer Offer being purchased
|
||||||
|
* @param requestOffer Request data from client
|
||||||
|
* @param output Output to send back to client
|
||||||
|
*/
|
||||||
|
protected buyPmcItemFromRagfair(sessionId: string, pmcData: IPmcData, fleaOffer: IRagfairOffer, requestOffer: IOfferRequest, output: IItemEventRouterResponse): void;
|
||||||
|
/**
|
||||||
|
* Does Player have necessary trader loyalty to purchase flea offer
|
||||||
|
* @param sellerIsTrader is seller trader
|
||||||
|
* @param fleaOffer FLea offer being bought
|
||||||
|
* @param pmcData Player profile
|
||||||
|
* @returns True if player can buy offer
|
||||||
|
*/
|
||||||
|
protected playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean;
|
||||||
|
/** Handle SellAllFromSavage event */
|
||||||
|
sellScavItemsToFence(pmcData: IPmcData, request: ISellScavItemsToFenceRequestData, sessionId: string): IItemEventRouterResponse;
|
||||||
|
/**
|
||||||
|
* Send the specified rouble total to player as mail
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param trader Trader to sell items to
|
||||||
|
* @param output IItemEventRouterResponse
|
||||||
|
*/
|
||||||
|
protected mailMoneyToPlayer(sessionId: string, roublesToSend: number, trader: Traders): void;
|
||||||
|
/**
|
||||||
|
* Looks up an items children and gets total handbook price for them
|
||||||
|
* @param parentItemId parent item that has children we want to sum price of
|
||||||
|
* @param items All items (parent + children)
|
||||||
|
* @param handbookPrices Prices of items from handbook
|
||||||
|
* @param traderDetails Trader being sold to to perform buy category check against
|
||||||
|
* @returns Rouble price
|
||||||
|
*/
|
||||||
|
protected getPriceOfItemAndChildren(parentItemId: string, items: Item[], handbookPrices: Record<string, number>, traderDetails: ITraderBase): number;
|
||||||
|
}
|
61
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/TraderController.d.ts
vendored
Normal file
61
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/TraderController.d.ts
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
import { FenceBaseAssortGenerator } from "@spt/generators/FenceBaseAssortGenerator";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { TraderAssortHelper } from "@spt/helpers/TraderAssortHelper";
|
||||||
|
import { TraderHelper } from "@spt/helpers/TraderHelper";
|
||||||
|
import { ITraderAssort, ITraderBase } from "@spt/models/eft/common/tables/ITrader";
|
||||||
|
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { FenceService } from "@spt/services/FenceService";
|
||||||
|
import { TraderAssortService } from "@spt/services/TraderAssortService";
|
||||||
|
import { TraderPurchasePersisterService } from "@spt/services/TraderPurchasePersisterService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class TraderController {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected traderAssortHelper: TraderAssortHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected traderHelper: TraderHelper;
|
||||||
|
protected traderAssortService: TraderAssortService;
|
||||||
|
protected traderPurchasePersisterService: TraderPurchasePersisterService;
|
||||||
|
protected fenceService: FenceService;
|
||||||
|
protected fenceBaseAssortGenerator: FenceBaseAssortGenerator;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected traderConfig: ITraderConfig;
|
||||||
|
constructor(logger: ILogger, timeUtil: TimeUtil, databaseService: DatabaseService, traderAssortHelper: TraderAssortHelper, profileHelper: ProfileHelper, traderHelper: TraderHelper, traderAssortService: TraderAssortService, traderPurchasePersisterService: TraderPurchasePersisterService, fenceService: FenceService, fenceBaseAssortGenerator: FenceBaseAssortGenerator, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Runs when onLoad event is fired
|
||||||
|
* Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService
|
||||||
|
* Store timestamp of next assort refresh in nextResupply property of traders .base object
|
||||||
|
*/
|
||||||
|
load(): void;
|
||||||
|
/**
|
||||||
|
* Runs when onUpdate is fired
|
||||||
|
* If current time is > nextResupply(expire) time of trader, refresh traders assorts and
|
||||||
|
* Fence is handled slightly differently
|
||||||
|
* @returns has run
|
||||||
|
*/
|
||||||
|
update(): boolean;
|
||||||
|
/**
|
||||||
|
* Handle client/trading/api/traderSettings
|
||||||
|
* Return an array of all traders
|
||||||
|
* @param sessionID Session id
|
||||||
|
* @returns array if ITraderBase objects
|
||||||
|
*/
|
||||||
|
getAllTraders(sessionID: string): ITraderBase[];
|
||||||
|
/**
|
||||||
|
* Order traders by their traderId (Ttid)
|
||||||
|
* @param traderA First trader to compare
|
||||||
|
* @param traderB Second trader to compare
|
||||||
|
* @returns 1,-1 or 0
|
||||||
|
*/
|
||||||
|
protected sortByTraderId(traderA: ITraderBase, traderB: ITraderBase): number;
|
||||||
|
/** Handle client/trading/api/getTrader */
|
||||||
|
getTrader(sessionID: string, traderID: string): ITraderBase;
|
||||||
|
/** Handle client/trading/api/getTraderAssort */
|
||||||
|
getAssort(sessionId: string, traderId: string): ITraderAssort;
|
||||||
|
}
|
19
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/WeatherController.d.ts
vendored
Normal file
19
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/WeatherController.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { WeatherGenerator } from "@spt/generators/WeatherGenerator";
|
||||||
|
import { IWeatherData } from "@spt/models/eft/weather/IWeatherData";
|
||||||
|
import { IWeatherConfig } from "@spt/models/spt/config/IWeatherConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
export declare class WeatherController {
|
||||||
|
protected weatherGenerator: WeatherGenerator;
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected weatherConfig: IWeatherConfig;
|
||||||
|
constructor(weatherGenerator: WeatherGenerator, logger: ILogger, configServer: ConfigServer);
|
||||||
|
/** Handle client/weather */
|
||||||
|
generate(): IWeatherData;
|
||||||
|
/**
|
||||||
|
* Get the current in-raid time (MUST HAVE PLAYER LOGGED INTO CLIENT TO WORK)
|
||||||
|
* @returns Date object
|
||||||
|
*/
|
||||||
|
getCurrentInRaidTime(): Date;
|
||||||
|
}
|
12
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/WishlistController.d.ts
vendored
Normal file
12
TypeScript/13.1AddTraderWithAssortJSON/types/controllers/WishlistController.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { IWishlistActionData } from "@spt/models/eft/wishlist/IWishlistActionData";
|
||||||
|
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||||
|
export declare class WishlistController {
|
||||||
|
protected eventOutputHolder: EventOutputHolder;
|
||||||
|
constructor(eventOutputHolder: EventOutputHolder);
|
||||||
|
/** Handle AddToWishList */
|
||||||
|
addToWishList(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
/** Handle RemoveFromWishList event */
|
||||||
|
removeFromWishList(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse;
|
||||||
|
}
|
19
TypeScript/13.1AddTraderWithAssortJSON/types/di/Container.d.ts
vendored
Normal file
19
TypeScript/13.1AddTraderWithAssortJSON/types/di/Container.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
/**
|
||||||
|
* Handle the registration of classes to be used by the Dependency Injection code
|
||||||
|
*/
|
||||||
|
export declare class Container {
|
||||||
|
static registerPostLoadTypes(container: DependencyContainer, childContainer: DependencyContainer): void;
|
||||||
|
static registerTypes(depContainer: DependencyContainer): void;
|
||||||
|
static registerPrimaryDependencies(depContainer: DependencyContainer): void;
|
||||||
|
static registerListTypes(depContainer: DependencyContainer): void;
|
||||||
|
private static registerUtils;
|
||||||
|
private static registerRouters;
|
||||||
|
private static registerGenerators;
|
||||||
|
private static registerHelpers;
|
||||||
|
private static registerLoaders;
|
||||||
|
private static registerCallbacks;
|
||||||
|
private static registerServices;
|
||||||
|
private static registerServers;
|
||||||
|
private static registerControllers;
|
||||||
|
}
|
4
TypeScript/13.1AddTraderWithAssortJSON/types/di/OnLoad.d.ts
vendored
Normal file
4
TypeScript/13.1AddTraderWithAssortJSON/types/di/OnLoad.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export interface OnLoad {
|
||||||
|
onLoad(): Promise<void>;
|
||||||
|
getRoute(): string;
|
||||||
|
}
|
4
TypeScript/13.1AddTraderWithAssortJSON/types/di/OnUpdate.d.ts
vendored
Normal file
4
TypeScript/13.1AddTraderWithAssortJSON/types/di/OnUpdate.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export interface OnUpdate {
|
||||||
|
onUpdate(timeSinceLastRun: number): Promise<boolean>;
|
||||||
|
getRoute(): string;
|
||||||
|
}
|
38
TypeScript/13.1AddTraderWithAssortJSON/types/di/Router.d.ts
vendored
Normal file
38
TypeScript/13.1AddTraderWithAssortJSON/types/di/Router.d.ts
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IItemEventRouterResponse } from "@spt/models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
|
import { ISptProfile } from "@spt/models/eft/profile/ISptProfile";
|
||||||
|
export declare class Router {
|
||||||
|
protected handledRoutes: HandledRoute[];
|
||||||
|
getTopLevelRoute(): string;
|
||||||
|
protected getHandledRoutes(): HandledRoute[];
|
||||||
|
protected getInternalHandledRoutes(): HandledRoute[];
|
||||||
|
canHandle(url: string, partialMatch?: boolean): boolean;
|
||||||
|
}
|
||||||
|
export declare class StaticRouter extends Router {
|
||||||
|
private routes;
|
||||||
|
constructor(routes: RouteAction[]);
|
||||||
|
handleStatic(url: string, info: any, sessionID: string, output: string): Promise<any>;
|
||||||
|
getHandledRoutes(): HandledRoute[];
|
||||||
|
}
|
||||||
|
export declare class DynamicRouter extends Router {
|
||||||
|
private routes;
|
||||||
|
constructor(routes: RouteAction[]);
|
||||||
|
handleDynamic(url: string, info: any, sessionID: string, output: string): Promise<any>;
|
||||||
|
getHandledRoutes(): HandledRoute[];
|
||||||
|
}
|
||||||
|
export declare class ItemEventRouterDefinition extends Router {
|
||||||
|
handleItemEvent(url: string, pmcData: IPmcData, body: any, sessionID: string, output: IItemEventRouterResponse): Promise<any>;
|
||||||
|
}
|
||||||
|
export declare class SaveLoadRouter extends Router {
|
||||||
|
handleLoad(profile: ISptProfile): ISptProfile;
|
||||||
|
}
|
||||||
|
export declare class HandledRoute {
|
||||||
|
route: string;
|
||||||
|
dynamic: boolean;
|
||||||
|
constructor(route: string, dynamic: boolean);
|
||||||
|
}
|
||||||
|
export declare class RouteAction {
|
||||||
|
url: string;
|
||||||
|
action: (url: string, info: any, sessionID: string, output: string) => Promise<any>;
|
||||||
|
constructor(url: string, action: (url: string, info: any, sessionID: string, output: string) => Promise<any>);
|
||||||
|
}
|
6
TypeScript/13.1AddTraderWithAssortJSON/types/di/Serializer.d.ts
vendored
Normal file
6
TypeScript/13.1AddTraderWithAssortJSON/types/di/Serializer.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/// <reference types="node" />
|
||||||
|
import { IncomingMessage, ServerResponse } from "node:http";
|
||||||
|
export declare class Serializer {
|
||||||
|
serialize(sessionID: string, req: IncomingMessage, resp: ServerResponse, body: any): void;
|
||||||
|
canHandle(something: string): boolean;
|
||||||
|
}
|
258
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotEquipmentModGenerator.d.ts
vendored
Normal file
258
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotEquipmentModGenerator.d.ts
vendored
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
import { BotGeneratorHelper } from "@spt/helpers/BotGeneratorHelper";
|
||||||
|
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||||
|
import { BotWeaponGeneratorHelper } from "@spt/helpers/BotWeaponGeneratorHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { ProbabilityHelper } from "@spt/helpers/ProbabilityHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { IPreset } from "@spt/models/eft/common/IGlobals";
|
||||||
|
import { Mods, ModsChances } from "@spt/models/eft/common/tables/IBotType";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITemplateItem, Slot } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { ModSpawn } from "@spt/models/enums/ModSpawn";
|
||||||
|
import { IChooseRandomCompatibleModResult } from "@spt/models/spt/bots/IChooseRandomCompatibleModResult";
|
||||||
|
import { IFilterPlateModsForSlotByLevelResult } from "@spt/models/spt/bots/IFilterPlateModsForSlotByLevelResult";
|
||||||
|
import { IGenerateEquipmentProperties } from "@spt/models/spt/bots/IGenerateEquipmentProperties";
|
||||||
|
import { IGenerateWeaponRequest } from "@spt/models/spt/bots/IGenerateWeaponRequest";
|
||||||
|
import { IModToSpawnRequest } from "@spt/models/spt/bots/IModToSpawnRequest";
|
||||||
|
import { EquipmentFilterDetails, EquipmentFilters, IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { BotEquipmentFilterService } from "@spt/services/BotEquipmentFilterService";
|
||||||
|
import { BotEquipmentModPoolService } from "@spt/services/BotEquipmentModPoolService";
|
||||||
|
import { BotWeaponModLimitService } from "@spt/services/BotWeaponModLimitService";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class BotEquipmentModGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected probabilityHelper: ProbabilityHelper;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected botEquipmentFilterService: BotEquipmentFilterService;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected botWeaponModLimitService: BotWeaponModLimitService;
|
||||||
|
protected botHelper: BotHelper;
|
||||||
|
protected botGeneratorHelper: BotGeneratorHelper;
|
||||||
|
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected botEquipmentModPoolService: BotEquipmentModPoolService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected botConfig: IBotConfig;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, probabilityHelper: ProbabilityHelper, databaseService: DatabaseService, itemHelper: ItemHelper, botEquipmentFilterService: BotEquipmentFilterService, itemFilterService: ItemFilterService, profileHelper: ProfileHelper, botWeaponModLimitService: BotWeaponModLimitService, botHelper: BotHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, weightedRandomHelper: WeightedRandomHelper, presetHelper: PresetHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Check mods are compatible and add to array
|
||||||
|
* @param equipment Equipment item to add mods to
|
||||||
|
* @param modPool Mod list to choose frm
|
||||||
|
* @param parentId parentid of item to add mod to
|
||||||
|
* @param parentTemplate template objet of item to add mods to
|
||||||
|
* @param forceSpawn should this mod be forced to spawn
|
||||||
|
* @returns Item + compatible mods as an array
|
||||||
|
*/
|
||||||
|
generateModsForEquipment(equipment: Item[], parentId: string, parentTemplate: ITemplateItem, settings: IGenerateEquipmentProperties, shouldForceSpawn?: boolean): Item[];
|
||||||
|
/**
|
||||||
|
* Filter a bots plate pool based on its current level
|
||||||
|
* @param settings Bot equipment generation settings
|
||||||
|
* @param modSlot Armor slot being filtered
|
||||||
|
* @param existingPlateTplPool Plates tpls to choose from
|
||||||
|
* @param armorItem
|
||||||
|
* @returns Array of plate tpls to choose from
|
||||||
|
*/
|
||||||
|
protected filterPlateModsForSlotByLevel(settings: IGenerateEquipmentProperties, modSlot: string, existingPlateTplPool: string[], armorItem: ITemplateItem): IFilterPlateModsForSlotByLevelResult;
|
||||||
|
/**
|
||||||
|
* Add mods to a weapon using the provided mod pool
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param request Data used to generate the weapon
|
||||||
|
* @returns Weapon + mods array
|
||||||
|
*/
|
||||||
|
generateModsForWeapon(sessionId: string, request: IGenerateWeaponRequest): Item[];
|
||||||
|
/**
|
||||||
|
* Is this modslot a front or rear sight
|
||||||
|
* @param modSlot Slot to check
|
||||||
|
* @returns true if it's a front/rear sight
|
||||||
|
*/
|
||||||
|
protected modIsFrontOrRearSight(modSlot: string, tpl: string): boolean;
|
||||||
|
/**
|
||||||
|
* Does the provided mod details show the mod can hold a scope
|
||||||
|
* @param modSlot e.g. mod_scope, mod_mount
|
||||||
|
* @param modsParentId Parent id of mod item
|
||||||
|
* @returns true if it can hold a scope
|
||||||
|
*/
|
||||||
|
protected modSlotCanHoldScope(modSlot: string, modsParentId: string): boolean;
|
||||||
|
/**
|
||||||
|
* Set mod spawn chances to defined amount
|
||||||
|
* @param modSpawnChances Chance dictionary to update
|
||||||
|
*/
|
||||||
|
protected adjustSlotSpawnChances(modSpawnChances: ModsChances, modSlotsToAdjust: string[], newChancePercent: number): void;
|
||||||
|
/**
|
||||||
|
* Does the provided modSlot allow muzzle-related items
|
||||||
|
* @param modSlot Slot id to check
|
||||||
|
* @param modsParentId OPTIONAL: parent id of modslot being checked
|
||||||
|
* @returns True if modSlot can have muzzle-related items
|
||||||
|
*/
|
||||||
|
protected modSlotCanHoldMuzzleDevices(modSlot: string, modsParentId?: string): boolean;
|
||||||
|
/**
|
||||||
|
* Sort mod slots into an ordering that maximises chance of a successful weapon generation
|
||||||
|
* @param unsortedSlotKeys Array of mod slot strings to sort
|
||||||
|
* @returns Sorted array
|
||||||
|
*/
|
||||||
|
protected sortModKeys(unsortedSlotKeys: string[]): string[];
|
||||||
|
/**
|
||||||
|
* Get a Slot property for an item (chamber/cartridge/slot)
|
||||||
|
* @param modSlot e.g patron_in_weapon
|
||||||
|
* @param parentTemplate item template
|
||||||
|
* @returns Slot item
|
||||||
|
*/
|
||||||
|
protected getModItemSlotFromDb(modSlot: string, parentTemplate: ITemplateItem): Slot;
|
||||||
|
/**
|
||||||
|
* Randomly choose if a mod should be spawned, 100% for required mods OR mod is ammo slot
|
||||||
|
* @param itemSlot slot the item sits in
|
||||||
|
* @param modSlot slot the mod sits in
|
||||||
|
* @param modSpawnChances Chances for various mod spawns
|
||||||
|
* @param botEquipConfig Various config settings for generating this type of bot
|
||||||
|
* @returns ModSpawn.SPAWN when mod should be spawned, ModSpawn.DEFAULT_MOD when default mod should spawn, ModSpawn.SKIP when mod is skipped
|
||||||
|
*/
|
||||||
|
protected shouldModBeSpawned(itemSlot: Slot, modSlot: string, modSpawnChances: ModsChances, botEquipConfig: EquipmentFilters): ModSpawn;
|
||||||
|
/**
|
||||||
|
* Choose a mod to fit into the desired slot
|
||||||
|
* @param request Data used to choose an appropriate mod with
|
||||||
|
* @returns itemHelper.getItem() result
|
||||||
|
*/
|
||||||
|
protected chooseModToPutIntoSlot(request: IModToSpawnRequest): [boolean, ITemplateItem] | undefined;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param modPool Pool of mods that can be picked from
|
||||||
|
* @param parentSlot Slot the picked mod will have as a parent
|
||||||
|
* @param choiceTypeEnum How should chosen tpl be treated: DEFAULT_MOD/SPAWN/SKIP
|
||||||
|
* @param weapon Array of weapon items chosen item will be added to
|
||||||
|
* @param modSlotName Name of slot picked mod will be placed into
|
||||||
|
* @returns Chosen weapon details
|
||||||
|
*/
|
||||||
|
protected pickWeaponModTplForSlotFromPool(modPool: string[], parentSlot: Slot, choiceTypeEnum: ModSpawn, weapon: Item[], modSlotName: string): IChooseRandomCompatibleModResult;
|
||||||
|
/**
|
||||||
|
* Filter mod pool down based on various criteria:
|
||||||
|
* Is slot flagged as randomisable
|
||||||
|
* Is slot required
|
||||||
|
* Is slot flagged as default mod only
|
||||||
|
* @param itemModPool Existing pool of mods to choose
|
||||||
|
* @param itemSpawnCategory How should slot be handled
|
||||||
|
* @param parentTemplate Mods parent
|
||||||
|
* @param weaponTemplate Mods root parent (weapon/equipment)
|
||||||
|
* @param modSlot name of mod slot to choose for
|
||||||
|
* @param botEquipBlacklist A blacklist of items not allowed to be picked
|
||||||
|
* @param isRandomisableSlot Slot is flagged as a randomisable slot
|
||||||
|
* @returns Array of mod tpls
|
||||||
|
*/
|
||||||
|
protected getModPoolForSlot(itemModPool: Record<string, string[]>, itemSpawnCategory: ModSpawn, parentTemplate: ITemplateItem, weaponTemplate: ITemplateItem, modSlot: string, botEquipBlacklist: EquipmentFilterDetails, isRandomisableSlot: boolean): string[];
|
||||||
|
/**
|
||||||
|
* Get default preset for weapon OR get specific weapon presets for edge cases (mp5/silenced dvl)
|
||||||
|
* @param weaponTemplate Weapons db template
|
||||||
|
* @param parentItemTpl Tpl of the parent item
|
||||||
|
* @returns Default preset found
|
||||||
|
*/
|
||||||
|
protected getMatchingPreset(weaponTemplate: ITemplateItem, parentItemTpl: string): IPreset | undefined;
|
||||||
|
/**
|
||||||
|
* Temp fix to prevent certain combinations of weapons with mods that are known to be incompatible
|
||||||
|
* @param weapon Array of items that make up a weapon
|
||||||
|
* @param modTpl Mod to check compatibility with weapon
|
||||||
|
* @returns True if incompatible
|
||||||
|
*/
|
||||||
|
protected weaponModComboIsIncompatible(weapon: Item[], modTpl: string): boolean;
|
||||||
|
/**
|
||||||
|
* Create a mod item with provided parameters as properties + add upd property
|
||||||
|
* @param modId _id
|
||||||
|
* @param modTpl _tpl
|
||||||
|
* @param parentId parentId
|
||||||
|
* @param modSlot slotId
|
||||||
|
* @param modTemplate Used to add additional properties in the upd object
|
||||||
|
* @param botRole The bots role mod is being created for
|
||||||
|
* @returns Item object
|
||||||
|
*/
|
||||||
|
protected createModItem(modId: string, modTpl: string, parentId: string, modSlot: string, modTemplate: ITemplateItem, botRole: string): Item;
|
||||||
|
/**
|
||||||
|
* Get a list of containers that hold ammo
|
||||||
|
* e.g. mod_magazine / patron_in_weapon_000
|
||||||
|
* @returns string array
|
||||||
|
*/
|
||||||
|
protected getAmmoContainers(): string[];
|
||||||
|
/**
|
||||||
|
* Get a random mod from an items compatible mods Filter array
|
||||||
|
* @param fallbackModTpl Default value to return if parentSlot Filter is empty
|
||||||
|
* @param parentSlot Item mod will go into, used to get compatible items
|
||||||
|
* @param modSlot Slot to get mod to fill
|
||||||
|
* @param items Items to ensure picked mod is compatible with
|
||||||
|
* @returns Item tpl
|
||||||
|
*/
|
||||||
|
protected getRandomModTplFromItemDb(fallbackModTpl: string, parentSlot: Slot, modSlot: string, items: Item[]): string | undefined;
|
||||||
|
/**
|
||||||
|
* Check if mod exists in db + is for a required slot
|
||||||
|
* @param modToAdd Db template of mod to check
|
||||||
|
* @param slotAddedToTemplate Slot object the item will be placed as child into
|
||||||
|
* @param modSlot Slot the mod will fill
|
||||||
|
* @param parentTemplate Db template of the mods being added
|
||||||
|
* @param botRole Bots wildspawntype (assault/pmcBot/exUsec etc)
|
||||||
|
* @returns True if valid for slot
|
||||||
|
*/
|
||||||
|
protected isModValidForSlot(modToAdd: [boolean, ITemplateItem], slotAddedToTemplate: Slot, modSlot: string, parentTemplate: ITemplateItem, botRole: string): boolean;
|
||||||
|
/**
|
||||||
|
* Find mod tpls of a provided type and add to modPool
|
||||||
|
* @param desiredSlotName Slot to look up and add we are adding tpls for (e.g mod_scope)
|
||||||
|
* @param modTemplate db object for modItem we get compatible mods from
|
||||||
|
* @param modPool Pool of mods we are adding to
|
||||||
|
* @param botEquipBlacklist A blacklist of items that cannot be picked
|
||||||
|
*/
|
||||||
|
protected addCompatibleModsForProvidedMod(desiredSlotName: string, modTemplate: ITemplateItem, modPool: Mods, botEquipBlacklist: EquipmentFilterDetails): void;
|
||||||
|
/**
|
||||||
|
* Get the possible items that fit a slot
|
||||||
|
* @param parentItemId item tpl to get compatible items for
|
||||||
|
* @param modSlot Slot item should fit in
|
||||||
|
* @param botEquipBlacklist Equipment that should not be picked
|
||||||
|
* @returns Array of compatible items for that slot
|
||||||
|
*/
|
||||||
|
protected getDynamicModPool(parentItemId: string, modSlot: string, botEquipBlacklist: EquipmentFilterDetails): string[];
|
||||||
|
/**
|
||||||
|
* Take a list of tpls and filter out blacklisted values using itemFilterService + botEquipmentBlacklist
|
||||||
|
* @param allowedMods Base mods to filter
|
||||||
|
* @param botEquipBlacklist Equipment blacklist
|
||||||
|
* @param modSlot Slot mods belong to
|
||||||
|
* @returns Filtered array of mod tpls
|
||||||
|
*/
|
||||||
|
protected filterWeaponModsByBlacklist(allowedMods: string[], botEquipBlacklist: EquipmentFilterDetails, modSlot: string): string[];
|
||||||
|
/**
|
||||||
|
* With the shotgun revolver (60db29ce99594040e04c4a27) 12.12 introduced CylinderMagazines.
|
||||||
|
* Those magazines (e.g. 60dc519adf4c47305f6d410d) have a "Cartridges" entry with a _max_count=0.
|
||||||
|
* Ammo is not put into the magazine directly but assigned to the magazine's slots: The "camora_xxx" slots.
|
||||||
|
* This function is a helper called by generateModsForItem for mods with parent type "CylinderMagazine"
|
||||||
|
* @param items The items where the CylinderMagazine's camora are appended to
|
||||||
|
* @param modPool ModPool which should include available cartridges
|
||||||
|
* @param cylinderMagParentId The CylinderMagazine's UID
|
||||||
|
* @param cylinderMagTemplate The CylinderMagazine's template
|
||||||
|
*/
|
||||||
|
protected fillCamora(items: Item[], modPool: Mods, cylinderMagParentId: string, cylinderMagTemplate: ITemplateItem): void;
|
||||||
|
/**
|
||||||
|
* Take a record of camoras and merge the compatible shells into one array
|
||||||
|
* @param camorasWithShells Dictionary of camoras we want to merge into one array
|
||||||
|
* @returns String array of shells for multiple camora sources
|
||||||
|
*/
|
||||||
|
protected mergeCamoraPools(camorasWithShells: Record<string, string[]>): string[];
|
||||||
|
/**
|
||||||
|
* Filter out non-whitelisted weapon scopes
|
||||||
|
* Controlled by bot.json weaponSightWhitelist
|
||||||
|
* e.g. filter out rifle scopes from SMGs
|
||||||
|
* @param weapon Weapon scopes will be added to
|
||||||
|
* @param scopes Full scope pool
|
||||||
|
* @param botWeaponSightWhitelist Whitelist of scope types by weapon base type
|
||||||
|
* @returns Array of scope tpls that have been filtered to just ones allowed for that weapon type
|
||||||
|
*/
|
||||||
|
protected filterSightsByWeaponType(weapon: Item, scopes: string[], botWeaponSightWhitelist: Record<string, string[]>): string[];
|
||||||
|
}
|
168
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotGenerator.d.ts
vendored
Normal file
168
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotGenerator.d.ts
vendored
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
import { BotInventoryGenerator } from "@spt/generators/BotInventoryGenerator";
|
||||||
|
import { BotLevelGenerator } from "@spt/generators/BotLevelGenerator";
|
||||||
|
import { BotDifficultyHelper } from "@spt/helpers/BotDifficultyHelper";
|
||||||
|
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { IBaseJsonSkills, IBaseSkill, IBotBase, Info, Health as PmcHealth, Skills as botSkills } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { Appearance, Health, IBotType, Inventory } from "@spt/models/eft/common/tables/IBotType";
|
||||||
|
import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
|
||||||
|
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
|
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { BotEquipmentFilterService } from "@spt/services/BotEquipmentFilterService";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class BotGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected botInventoryGenerator: BotInventoryGenerator;
|
||||||
|
protected botLevelGenerator: BotLevelGenerator;
|
||||||
|
protected botEquipmentFilterService: BotEquipmentFilterService;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected botHelper: BotHelper;
|
||||||
|
protected botDifficultyHelper: BotDifficultyHelper;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected botConfig: IBotConfig;
|
||||||
|
protected pmcConfig: IPmcConfig;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, profileHelper: ProfileHelper, databaseService: DatabaseService, botInventoryGenerator: BotInventoryGenerator, botLevelGenerator: BotLevelGenerator, botEquipmentFilterService: BotEquipmentFilterService, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botDifficultyHelper: BotDifficultyHelper, seasonalEventService: SeasonalEventService, localisationService: LocalisationService, itemFilterService: ItemFilterService, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Generate a player scav bot object
|
||||||
|
* @param role e.g. assault / pmcbot
|
||||||
|
* @param difficulty easy/normal/hard/impossible
|
||||||
|
* @param botTemplate base bot template to use (e.g. assault/pmcbot)
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
generatePlayerScav(sessionId: string, role: string, difficulty: string, botTemplate: IBotType): IBotBase;
|
||||||
|
/**
|
||||||
|
* Create 1 bots of the type/side/difficulty defined in botGenerationDetails
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param botGenerationDetails details on how to generate bots
|
||||||
|
* @returns constructed bot
|
||||||
|
*/
|
||||||
|
prepareAndGenerateBot(sessionId: string, botGenerationDetails: BotGenerationDetails): IBotBase;
|
||||||
|
/**
|
||||||
|
* Get a clone of the default bot base object and adjust its role/side/difficulty values
|
||||||
|
* @param botRole Role bot should have
|
||||||
|
* @param botSide Side bot should have
|
||||||
|
* @param difficulty Difficult bot should have
|
||||||
|
* @returns Cloned bot base
|
||||||
|
*/
|
||||||
|
protected getPreparedBotBase(botRole: string, botSide: string, difficulty: string): IBotBase;
|
||||||
|
/**
|
||||||
|
* Get a clone of the database\bots\base.json file
|
||||||
|
* @returns IBotBase object
|
||||||
|
*/
|
||||||
|
protected getCloneOfBotBase(): IBotBase;
|
||||||
|
/**
|
||||||
|
* Create a IBotBase object with equipment/loot/exp etc
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param bot Bots base file
|
||||||
|
* @param botJsonTemplate Bot template from db/bots/x.json
|
||||||
|
* @param botGenerationDetails details on how to generate the bot
|
||||||
|
* @returns IBotBase object
|
||||||
|
*/
|
||||||
|
protected generateBot(sessionId: string, bot: IBotBase, botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails): IBotBase;
|
||||||
|
protected addAdditionalPocketLootWeightsForUnheardBot(botJsonTemplate: IBotType): void;
|
||||||
|
/**
|
||||||
|
* Remove items from item.json/lootableItemBlacklist from bots inventory
|
||||||
|
* @param botInventory Bot to filter
|
||||||
|
*/
|
||||||
|
protected removeBlacklistedLootFromBotTemplate(botInventory: Inventory): void;
|
||||||
|
/**
|
||||||
|
* Choose various appearance settings for a bot using weights: head/body/feet/hands
|
||||||
|
* @param bot Bot to adjust
|
||||||
|
* @param appearance Appearance settings to choose from
|
||||||
|
* @param botGenerationDetails Generation details
|
||||||
|
*/
|
||||||
|
protected setBotAppearance(bot: IBotBase, appearance: Appearance, botGenerationDetails: BotGenerationDetails): void;
|
||||||
|
/**
|
||||||
|
* Create a bot nickname
|
||||||
|
* @param botJsonTemplate x.json from database
|
||||||
|
* @param botGenerationDetails
|
||||||
|
* @param botRole role of bot e.g. assault
|
||||||
|
* @param sessionId OPTIONAL: profile session id
|
||||||
|
* @returns Nickname for bot
|
||||||
|
*/
|
||||||
|
protected generateBotNickname(botJsonTemplate: IBotType, botGenerationDetails: BotGenerationDetails, botRole: string, sessionId?: string): string;
|
||||||
|
protected shouldSimulatePlayerScavName(botRole: string, isPlayerScav: boolean): boolean;
|
||||||
|
protected addPlayerScavNameSimulationSuffix(nickname: string): string;
|
||||||
|
/**
|
||||||
|
* Log the number of PMCs generated to the debug console
|
||||||
|
* @param output Generated bot array, ready to send to client
|
||||||
|
*/
|
||||||
|
protected logPmcGeneratedCount(output: IBotBase[]): void;
|
||||||
|
/**
|
||||||
|
* Converts health object to the required format
|
||||||
|
* @param healthObj health object from bot json
|
||||||
|
* @param playerScav Is a pscav bot being generated
|
||||||
|
* @returns PmcHealth object
|
||||||
|
*/
|
||||||
|
protected generateHealth(healthObj: Health, playerScav?: boolean): PmcHealth;
|
||||||
|
/**
|
||||||
|
* Get a bots skills with randomsied progress value between the min and max values
|
||||||
|
* @param botSkills Skills that should have their progress value randomised
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
protected generateSkills(botSkills: IBaseJsonSkills): botSkills;
|
||||||
|
/**
|
||||||
|
* Randomise the progress value of passed in skills based on the min/max value
|
||||||
|
* @param skills Skills to randomise
|
||||||
|
* @param isCommonSkills Are the skills 'common' skills
|
||||||
|
* @returns Skills with randomised progress values as an array
|
||||||
|
*/
|
||||||
|
protected getSkillsWithRandomisedProgressValue(skills: Record<string, IBaseSkill>, isCommonSkills: boolean): IBaseSkill[];
|
||||||
|
/**
|
||||||
|
* Generate an id+aid for a bot and apply
|
||||||
|
* @param bot bot to update
|
||||||
|
* @returns updated IBotBase object
|
||||||
|
*/
|
||||||
|
protected addIdsToBot(bot: IBotBase): void;
|
||||||
|
/**
|
||||||
|
* Update a profiles profile.Inventory.equipment value with a freshly generated one
|
||||||
|
* Update all inventory items that make use of this value too
|
||||||
|
* @param profile Profile to update
|
||||||
|
*/
|
||||||
|
protected generateInventoryId(profile: IBotBase): void;
|
||||||
|
/**
|
||||||
|
* Randomise a bots game version and account category
|
||||||
|
* Chooses from all the game versions (standard, eod etc)
|
||||||
|
* Chooses account type (default, Sherpa, etc)
|
||||||
|
* @param botInfo bot info object to update
|
||||||
|
* @returns Chosen game version
|
||||||
|
*/
|
||||||
|
protected setRandomisedGameVersionAndCategory(botInfo: Info): string;
|
||||||
|
/**
|
||||||
|
* Add a side-specific (usec/bear) dogtag item to a bots inventory
|
||||||
|
* @param bot bot to add dogtag to
|
||||||
|
* @returns Bot with dogtag added
|
||||||
|
*/
|
||||||
|
protected addDogtagToBot(bot: IBotBase): void;
|
||||||
|
/**
|
||||||
|
* Get a dogtag tpl that matches the bots game version and side
|
||||||
|
* @param side Usec/Bear
|
||||||
|
* @param gameVersion edge_of_darkness / standard
|
||||||
|
* @returns item tpl
|
||||||
|
*/
|
||||||
|
protected getDogtagTplByGameVersionAndSide(side: string, gameVersion: string): string;
|
||||||
|
/**
|
||||||
|
* Adjust a PMCs pocket tpl to UHD if necessary, otherwise do nothing
|
||||||
|
* @param bot Pmc object to adjust
|
||||||
|
*/
|
||||||
|
protected setPmcPocketsByGameVersion(bot: IBotBase): void;
|
||||||
|
}
|
122
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotInventoryGenerator.d.ts
vendored
Normal file
122
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotInventoryGenerator.d.ts
vendored
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
import { BotEquipmentModGenerator } from "@spt/generators/BotEquipmentModGenerator";
|
||||||
|
import { BotLootGenerator } from "@spt/generators/BotLootGenerator";
|
||||||
|
import { BotWeaponGenerator } from "@spt/generators/BotWeaponGenerator";
|
||||||
|
import { BotGeneratorHelper } from "@spt/helpers/BotGeneratorHelper";
|
||||||
|
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { Inventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { Chances, Equipment, Generation, IBotType, Inventory } from "@spt/models/eft/common/tables/IBotType";
|
||||||
|
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
|
||||||
|
import { IGenerateEquipmentProperties } from "@spt/models/spt/bots/IGenerateEquipmentProperties";
|
||||||
|
import { EquipmentFilterDetails, IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { BotEquipmentModPoolService } from "@spt/services/BotEquipmentModPoolService";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class BotInventoryGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected botWeaponGenerator: BotWeaponGenerator;
|
||||||
|
protected botLootGenerator: BotLootGenerator;
|
||||||
|
protected botGeneratorHelper: BotGeneratorHelper;
|
||||||
|
protected botHelper: BotHelper;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected botEquipmentModPoolService: BotEquipmentModPoolService;
|
||||||
|
protected botEquipmentModGenerator: BotEquipmentModGenerator;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected botConfig: IBotConfig;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, databaseService: DatabaseService, botWeaponGenerator: BotWeaponGenerator, botLootGenerator: BotLootGenerator, botGeneratorHelper: BotGeneratorHelper, botHelper: BotHelper, weightedRandomHelper: WeightedRandomHelper, itemHelper: ItemHelper, localisationService: LocalisationService, botEquipmentModPoolService: BotEquipmentModPoolService, botEquipmentModGenerator: BotEquipmentModGenerator, configServer: ConfigServer);
|
||||||
|
/**
|
||||||
|
* Add equipment/weapons/loot to bot
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param botJsonTemplate Base json db file for the bot having its loot generated
|
||||||
|
* @param botRole Role bot has (assault/pmcBot)
|
||||||
|
* @param isPmc Is bot being converted into a pmc
|
||||||
|
* @param botLevel Level of bot being generated
|
||||||
|
* @param chosenGameVersion Game version for bot, only really applies for PMCs
|
||||||
|
* @returns PmcInventory object with equipment/weapons/loot
|
||||||
|
*/
|
||||||
|
generateInventory(sessionId: string, botJsonTemplate: IBotType, botRole: string, isPmc: boolean, botLevel: number, chosenGameVersion: string): PmcInventory;
|
||||||
|
/**
|
||||||
|
* Create a pmcInventory object with all the base/generic items needed
|
||||||
|
* @returns PmcInventory object
|
||||||
|
*/
|
||||||
|
protected generateInventoryBase(): PmcInventory;
|
||||||
|
/**
|
||||||
|
* Add equipment to a bot
|
||||||
|
* @param templateInventory bot/x.json data from db
|
||||||
|
* @param wornItemChances Chances items will be added to bot
|
||||||
|
* @param botRole Role bot has (assault/pmcBot)
|
||||||
|
* @param botInventory Inventory to add equipment to
|
||||||
|
* @param botLevel Level of bot
|
||||||
|
* @param chosenGameVersion Game version for bot, only really applies for PMCs
|
||||||
|
*/
|
||||||
|
protected generateAndAddEquipmentToBot(templateInventory: Inventory, wornItemChances: Chances, botRole: string, botInventory: PmcInventory, botLevel: number, chosenGameVersion: string): void;
|
||||||
|
/**
|
||||||
|
* Remove non-armored rigs from parameter data
|
||||||
|
* @param templateEquipment Equpiment to filter TacticalVest of
|
||||||
|
*/
|
||||||
|
protected filterRigsToThoseWithProtection(templateEquipment: Equipment): void;
|
||||||
|
/**
|
||||||
|
* Remove armored rigs from parameter data
|
||||||
|
* @param templateEquipment Equpiment to filter TacticalVest of
|
||||||
|
*/
|
||||||
|
protected filterRigsToThoseWithoutProtection(templateEquipment: Equipment): void;
|
||||||
|
/**
|
||||||
|
* Add a piece of equipment with mods to inventory from the provided pools
|
||||||
|
* @param settings Values to adjust how item is chosen and added to bot
|
||||||
|
* @returns true when item added
|
||||||
|
*/
|
||||||
|
protected generateEquipment(settings: IGenerateEquipmentProperties): boolean;
|
||||||
|
/**
|
||||||
|
* Get all possible mods for item and filter down based on equipment blacklist from bot.json config
|
||||||
|
* @param itemTpl Item mod pool is being retrieved and filtered
|
||||||
|
* @param equipmentBlacklist blacklist to filter mod pool with
|
||||||
|
* @returns Filtered pool of mods
|
||||||
|
*/
|
||||||
|
protected getFilteredDynamicModsForItem(itemTpl: string, equipmentBlacklist: EquipmentFilterDetails[]): Record<string, string[]>;
|
||||||
|
/**
|
||||||
|
* Work out what weapons bot should have equipped and add them to bot inventory
|
||||||
|
* @param templateInventory bot/x.json data from db
|
||||||
|
* @param equipmentChances Chances bot can have equipment equipped
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param botInventory Inventory to add weapons to
|
||||||
|
* @param botRole assault/pmcBot/bossTagilla etc
|
||||||
|
* @param isPmc Is the bot being generated as a pmc
|
||||||
|
* @param itemGenerationLimitsMinMax Limits for items the bot can have
|
||||||
|
* @param botLevel level of bot having weapon generated
|
||||||
|
*/
|
||||||
|
protected generateAndAddWeaponsToBot(templateInventory: Inventory, equipmentChances: Chances, sessionId: string, botInventory: PmcInventory, botRole: string, isPmc: boolean, itemGenerationLimitsMinMax: Generation, botLevel: number): void;
|
||||||
|
/**
|
||||||
|
* Calculate if the bot should have weapons in Primary/Secondary/Holster slots
|
||||||
|
* @param equipmentChances Chances bot has certain equipment
|
||||||
|
* @returns What slots bot should have weapons generated for
|
||||||
|
*/
|
||||||
|
protected getDesiredWeaponsForBot(equipmentChances: Chances): {
|
||||||
|
slot: EquipmentSlots;
|
||||||
|
shouldSpawn: boolean;
|
||||||
|
}[];
|
||||||
|
/**
|
||||||
|
* Add weapon + spare mags/ammo to bots inventory
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param weaponSlot Weapon slot being generated
|
||||||
|
* @param templateInventory bot/x.json data from db
|
||||||
|
* @param botInventory Inventory to add weapon+mags/ammo to
|
||||||
|
* @param equipmentChances Chances bot can have equipment equipped
|
||||||
|
* @param botRole assault/pmcBot/bossTagilla etc
|
||||||
|
* @param isPmc Is the bot being generated as a pmc
|
||||||
|
* @param itemGenerationWeights
|
||||||
|
*/
|
||||||
|
protected addWeaponAndMagazinesToInventory(sessionId: string, weaponSlot: {
|
||||||
|
slot: EquipmentSlots;
|
||||||
|
shouldSpawn: boolean;
|
||||||
|
}, templateInventory: Inventory, botInventory: PmcInventory, equipmentChances: Chances, botRole: string, isPmc: boolean, itemGenerationWeights: Generation, botLevel: number): void;
|
||||||
|
}
|
37
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotLevelGenerator.d.ts
vendored
Normal file
37
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotLevelGenerator.d.ts
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { MinMax } from "@spt/models/common/MinMax";
|
||||||
|
import { IRandomisedBotLevelResult } from "@spt/models/eft/bot/IRandomisedBotLevelResult";
|
||||||
|
import { IBotBase } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { BotGenerationDetails } from "@spt/models/spt/bots/BotGenerationDetails";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class BotLevelGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
constructor(logger: ILogger, randomUtil: RandomUtil, databaseService: DatabaseService);
|
||||||
|
/**
|
||||||
|
* Return a randomised bot level and exp value
|
||||||
|
* @param levelDetails Min and max of level for bot
|
||||||
|
* @param botGenerationDetails Details to help generate a bot
|
||||||
|
* @param bot Bot the level is being generated for
|
||||||
|
* @returns IRandomisedBotLevelResult object
|
||||||
|
*/
|
||||||
|
generateBotLevel(levelDetails: MinMax, botGenerationDetails: BotGenerationDetails, bot: IBotBase): IRandomisedBotLevelResult;
|
||||||
|
/**
|
||||||
|
* Get the highest level a bot can be relative to the players level, but no further than the max size from globals.exp_table
|
||||||
|
* @param botGenerationDetails Details to help generate a bot
|
||||||
|
* @param levelDetails
|
||||||
|
* @param maxLevel Max possible level
|
||||||
|
* @returns Highest level possible for bot
|
||||||
|
*/
|
||||||
|
protected getHighestRelativeBotLevel(botGenerationDetails: BotGenerationDetails, levelDetails: MinMax, maxLevel: number): number;
|
||||||
|
/**
|
||||||
|
* Get the lowest level a bot can be relative to the players level, but no lower than 1
|
||||||
|
* @param botGenerationDetails Details to help generate a bot
|
||||||
|
* @param levelDetails
|
||||||
|
* @param maxlevel Max level allowed
|
||||||
|
* @returns Lowest level possible for bot
|
||||||
|
*/
|
||||||
|
protected getLowestRelativeBotLevel(botGenerationDetails: BotGenerationDetails, levelDetails: MinMax, maxlevel: number): number;
|
||||||
|
}
|
148
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotLootGenerator.d.ts
vendored
Normal file
148
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotLootGenerator.d.ts
vendored
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
import { BotWeaponGenerator } from "@spt/generators/BotWeaponGenerator";
|
||||||
|
import { BotGeneratorHelper } from "@spt/helpers/BotGeneratorHelper";
|
||||||
|
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||||
|
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||||
|
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { Inventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { IBotType, Inventory, ModsChances } from "@spt/models/eft/common/tables/IBotType";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots";
|
||||||
|
import { IItemSpawnLimitSettings } from "@spt/models/spt/bots/IItemSpawnLimitSettings";
|
||||||
|
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
|
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { BotLootCacheService } from "@spt/services/BotLootCacheService";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class BotLootGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected inventoryHelper: InventoryHelper;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected handbookHelper: HandbookHelper;
|
||||||
|
protected botGeneratorHelper: BotGeneratorHelper;
|
||||||
|
protected botWeaponGenerator: BotWeaponGenerator;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected botHelper: BotHelper;
|
||||||
|
protected botLootCacheService: BotLootCacheService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected botConfig: IBotConfig;
|
||||||
|
protected pmcConfig: IPmcConfig;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, itemHelper: ItemHelper, inventoryHelper: InventoryHelper, databaseService: DatabaseService, handbookHelper: HandbookHelper, botGeneratorHelper: BotGeneratorHelper, botWeaponGenerator: BotWeaponGenerator, weightedRandomHelper: WeightedRandomHelper, botHelper: BotHelper, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
protected getItemSpawnLimitsForBot(botRole: string): IItemSpawnLimitSettings;
|
||||||
|
/**
|
||||||
|
* Add loot to bots containers
|
||||||
|
* @param sessionId Session id
|
||||||
|
* @param botJsonTemplate Base json db file for the bot having its loot generated
|
||||||
|
* @param isPmc Will bot be a pmc
|
||||||
|
* @param botRole Role of bot, e.g. asssult
|
||||||
|
* @param botInventory Inventory to add loot to
|
||||||
|
* @param botLevel Level of bot
|
||||||
|
*/
|
||||||
|
generateLoot(sessionId: string, botJsonTemplate: IBotType, isPmc: boolean, botRole: string, botInventory: PmcInventory, botLevel: number): void;
|
||||||
|
/**
|
||||||
|
* Get an array of the containers a bot has on them (pockets/backpack/vest)
|
||||||
|
* @param botInventory Bot to check
|
||||||
|
* @returns Array of available slots
|
||||||
|
*/
|
||||||
|
protected getAvailableContainersBotCanStoreItemsIn(botInventory: PmcInventory): EquipmentSlots[];
|
||||||
|
/**
|
||||||
|
* Force healing items onto bot to ensure they can heal in-raid
|
||||||
|
* @param botInventory Inventory to add items to
|
||||||
|
* @param botRole Role of bot (pmcBEAR/pmcUSEC)
|
||||||
|
*/
|
||||||
|
protected addForcedMedicalItemsToPmcSecure(botInventory: PmcInventory, botRole: string): void;
|
||||||
|
/**
|
||||||
|
* Get a biased random number
|
||||||
|
* @param min Smallest size
|
||||||
|
* @param max Biggest size
|
||||||
|
* @param nValue Value to bias choice
|
||||||
|
* @returns Chosen number
|
||||||
|
*/
|
||||||
|
protected getRandomisedCount(min: number, max: number, nValue: number): number;
|
||||||
|
/**
|
||||||
|
* Take random items from a pool and add to an inventory until totalItemCount or totalValueLimit or space limit is reached
|
||||||
|
* @param pool Pool of items to pick from with weight
|
||||||
|
* @param equipmentSlots What equipment slot will the loot items be added to
|
||||||
|
* @param totalItemCount Max count of items to add
|
||||||
|
* @param inventoryToAddItemsTo Bot inventory loot will be added to
|
||||||
|
* @param botRole Role of the bot loot is being generated for (assault/pmcbot)
|
||||||
|
* @param itemSpawnLimits Item spawn limits the bot must adhere to
|
||||||
|
* @param totalValueLimitRub Total value of loot allowed in roubles
|
||||||
|
* @param isPmc Is bot being generated for a pmc
|
||||||
|
*/
|
||||||
|
protected addLootFromPool(pool: Record<string, number>, equipmentSlots: string[], totalItemCount: number, inventoryToAddItemsTo: PmcInventory, botRole: string, itemSpawnLimits?: IItemSpawnLimitSettings, totalValueLimitRub?: number, isPmc?: boolean, containersIdFull?: Set<string>): void;
|
||||||
|
protected createWalletLoot(walletId: string): Item[][];
|
||||||
|
/**
|
||||||
|
* Some items need child items to function, add them to the itemToAddChildrenTo array
|
||||||
|
* @param itemToAddTemplate Db template of item to check
|
||||||
|
* @param itemToAddChildrenTo Item to add children to
|
||||||
|
* @param isPmc Is the item being generated for a pmc (affects money/ammo stack sizes)
|
||||||
|
* @param botRole role bot has that owns item
|
||||||
|
*/
|
||||||
|
protected addRequiredChildItemsToParent(itemToAddTemplate: ITemplateItem, itemToAddChildrenTo: Item[], isPmc: boolean, botRole: string): void;
|
||||||
|
/**
|
||||||
|
* Add generated weapons to inventory as loot
|
||||||
|
* @param botInventory inventory to add preset to
|
||||||
|
* @param equipmentSlot slot to place the preset in (backpack)
|
||||||
|
* @param templateInventory bots template, assault.json
|
||||||
|
* @param modChances chances for mods to spawn on weapon
|
||||||
|
* @param botRole bots role .e.g. pmcBot
|
||||||
|
* @param isPmc are we generating for a pmc
|
||||||
|
*/
|
||||||
|
protected addLooseWeaponsToInventorySlot(sessionId: string, botInventory: PmcInventory, equipmentSlot: string, templateInventory: Inventory, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number, containersIdFull?: Set<string>): void;
|
||||||
|
/**
|
||||||
|
* Hydrate item limit array to contain items that have a limit for a specific bot type
|
||||||
|
* All values are set to 0
|
||||||
|
* @param botRole Role the bot has
|
||||||
|
* @param limitCount
|
||||||
|
*/
|
||||||
|
protected initItemLimitArray(botRole: string, limitCount: Record<string, number>): void;
|
||||||
|
/**
|
||||||
|
* Check if an item has reached its bot-specific spawn limit
|
||||||
|
* @param itemTemplate Item we check to see if its reached spawn limit
|
||||||
|
* @param botRole Bot type
|
||||||
|
* @param itemSpawnLimits
|
||||||
|
* @returns true if item has reached spawn limit
|
||||||
|
*/
|
||||||
|
protected itemHasReachedSpawnLimit(itemTemplate: ITemplateItem, botRole: string, itemSpawnLimits: IItemSpawnLimitSettings): boolean;
|
||||||
|
/**
|
||||||
|
* Randomise the stack size of a money object, uses different values for pmc or scavs
|
||||||
|
* @param botRole Role bot has that has money stack
|
||||||
|
* @param itemTemplate item details from db
|
||||||
|
* @param moneyItem Money item to randomise
|
||||||
|
*/
|
||||||
|
protected randomiseMoneyStackSize(botRole: string, itemTemplate: ITemplateItem, moneyItem: Item): void;
|
||||||
|
/**
|
||||||
|
* Randomise the size of an ammo stack
|
||||||
|
* @param isPmc Is ammo on a PMC bot
|
||||||
|
* @param itemTemplate item details from db
|
||||||
|
* @param ammoItem Ammo item to randomise
|
||||||
|
*/
|
||||||
|
protected randomiseAmmoStackSize(isPmc: boolean, itemTemplate: ITemplateItem, ammoItem: Item): void;
|
||||||
|
/**
|
||||||
|
* Get spawn limits for a specific bot type from bot.json config
|
||||||
|
* If no limit found for a non pmc bot, fall back to defaults
|
||||||
|
* @param botRole what role does the bot have
|
||||||
|
* @returns Dictionary of tplIds and limit
|
||||||
|
*/
|
||||||
|
protected getItemSpawnLimitsForBotType(botRole: string): Record<string, number>;
|
||||||
|
/**
|
||||||
|
* Get the parentId or tplId of item inside spawnLimits object if it exists
|
||||||
|
* @param itemTemplate item we want to look for in spawn limits
|
||||||
|
* @param spawnLimits Limits to check for item
|
||||||
|
* @returns id as string, otherwise undefined
|
||||||
|
*/
|
||||||
|
protected getMatchingIdFromSpawnLimits(itemTemplate: ITemplateItem, spawnLimits: Record<string, number>): string;
|
||||||
|
}
|
184
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotWeaponGenerator.d.ts
vendored
Normal file
184
TypeScript/13.1AddTraderWithAssortJSON/types/generators/BotWeaponGenerator.d.ts
vendored
Normal file
@ -0,0 +1,184 @@
|
|||||||
|
import { BotEquipmentModGenerator } from "@spt/generators/BotEquipmentModGenerator";
|
||||||
|
import { IInventoryMagGen } from "@spt/generators/weapongen/IInventoryMagGen";
|
||||||
|
import { BotGeneratorHelper } from "@spt/helpers/BotGeneratorHelper";
|
||||||
|
import { BotWeaponGeneratorHelper } from "@spt/helpers/BotWeaponGeneratorHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { Inventory as PmcInventory } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { GenerationData, Inventory, ModsChances } from "@spt/models/eft/common/tables/IBotType";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { GenerateWeaponResult } from "@spt/models/spt/bots/GenerateWeaponResult";
|
||||||
|
import { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
||||||
|
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
||||||
|
import { IRepairConfig } from "@spt/models/spt/config/IRepairConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { BotWeaponModLimitService } from "@spt/services/BotWeaponModLimitService";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { RepairService } from "@spt/services/RepairService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class BotWeaponGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected botGeneratorHelper: BotGeneratorHelper;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected botWeaponGeneratorHelper: BotWeaponGeneratorHelper;
|
||||||
|
protected botWeaponModLimitService: BotWeaponModLimitService;
|
||||||
|
protected botEquipmentModGenerator: BotEquipmentModGenerator;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected repairService: RepairService;
|
||||||
|
protected inventoryMagGenComponents: IInventoryMagGen[];
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected readonly modMagazineSlotId = "mod_magazine";
|
||||||
|
protected botConfig: IBotConfig;
|
||||||
|
protected pmcConfig: IPmcConfig;
|
||||||
|
protected repairConfig: IRepairConfig;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, databaseService: DatabaseService, itemHelper: ItemHelper, weightedRandomHelper: WeightedRandomHelper, botGeneratorHelper: BotGeneratorHelper, randomUtil: RandomUtil, configServer: ConfigServer, botWeaponGeneratorHelper: BotWeaponGeneratorHelper, botWeaponModLimitService: BotWeaponModLimitService, botEquipmentModGenerator: BotEquipmentModGenerator, localisationService: LocalisationService, repairService: RepairService, inventoryMagGenComponents: IInventoryMagGen[], cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Pick a random weapon based on weightings and generate a functional weapon
|
||||||
|
* @param equipmentSlot Primary/secondary/holster
|
||||||
|
* @param botTemplateInventory e.g. assault.json
|
||||||
|
* @param weaponParentId
|
||||||
|
* @param modChances
|
||||||
|
* @param botRole role of bot, e.g. assault/followerBully
|
||||||
|
* @param isPmc Is weapon generated for a pmc
|
||||||
|
* @returns GenerateWeaponResult object
|
||||||
|
*/
|
||||||
|
generateRandomWeapon(sessionId: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult;
|
||||||
|
/**
|
||||||
|
* Get a random weighted weapon from a bots pool of weapons
|
||||||
|
* @param equipmentSlot Primary/secondary/holster
|
||||||
|
* @param botTemplateInventory e.g. assault.json
|
||||||
|
* @returns weapon tpl
|
||||||
|
*/
|
||||||
|
pickWeightedWeaponTplFromPool(equipmentSlot: string, botTemplateInventory: Inventory): string;
|
||||||
|
/**
|
||||||
|
* Generated a weapon based on the supplied weapon tpl
|
||||||
|
* @param weaponTpl weapon tpl to generate (use pickWeightedWeaponTplFromPool())
|
||||||
|
* @param equipmentSlot slot to fit into, primary/secondary/holster
|
||||||
|
* @param botTemplateInventory e.g. assault.json
|
||||||
|
* @param weaponParentId ParentId of the weapon being generated
|
||||||
|
* @param modChances Dictionary of item types and % chance weapon will have that mod
|
||||||
|
* @param botRole e.g. assault/exusec
|
||||||
|
* @param isPmc Is weapon being generated for a pmc
|
||||||
|
* @returns GenerateWeaponResult object
|
||||||
|
*/
|
||||||
|
generateWeaponByTpl(sessionId: string, weaponTpl: string, equipmentSlot: string, botTemplateInventory: Inventory, weaponParentId: string, modChances: ModsChances, botRole: string, isPmc: boolean, botLevel: number): GenerateWeaponResult;
|
||||||
|
/**
|
||||||
|
* Insert a cartridge(s) into a weapon
|
||||||
|
* Handles all chambers - patron_in_weapon, patron_in_weapon_000 etc
|
||||||
|
* @param weaponWithModsArray Weapon and mods
|
||||||
|
* @param ammoTpl Cartridge to add to weapon
|
||||||
|
* @param chamberSlotIds name of slots to create or add ammo to
|
||||||
|
*/
|
||||||
|
protected addCartridgeToChamber(weaponWithModsArray: Item[], ammoTpl: string, chamberSlotIds: string[]): void;
|
||||||
|
/**
|
||||||
|
* Create array with weapon base as only element and
|
||||||
|
* add additional properties based on weapon type
|
||||||
|
* @param weaponTpl Weapon tpl to create item with
|
||||||
|
* @param weaponParentId Weapons parent id
|
||||||
|
* @param equipmentSlot e.g. primary/secondary/holster
|
||||||
|
* @param weaponItemTemplate db template for weapon
|
||||||
|
* @param botRole for durability values
|
||||||
|
* @returns Base weapon item in array
|
||||||
|
*/
|
||||||
|
protected constructWeaponBaseArray(weaponTpl: string, weaponParentId: string, equipmentSlot: string, weaponItemTemplate: ITemplateItem, botRole: string): Item[];
|
||||||
|
/**
|
||||||
|
* Get the mods necessary to kit out a weapon to its preset level
|
||||||
|
* @param weaponTpl weapon to find preset for
|
||||||
|
* @param equipmentSlot the slot the weapon will be placed in
|
||||||
|
* @param weaponParentId Value used for the parentid
|
||||||
|
* @returns array of weapon mods
|
||||||
|
*/
|
||||||
|
protected getPresetWeaponMods(weaponTpl: string, equipmentSlot: string, weaponParentId: string, itemTemplate: ITemplateItem, botRole: string): Item[];
|
||||||
|
/**
|
||||||
|
* Checks if all required slots are occupied on a weapon and all it's mods
|
||||||
|
* @param weaponItemArray Weapon + mods
|
||||||
|
* @param botRole role of bot weapon is for
|
||||||
|
* @returns true if valid
|
||||||
|
*/
|
||||||
|
protected isWeaponValid(weaponItemArray: Item[], botRole: string): boolean;
|
||||||
|
/**
|
||||||
|
* Generates extra magazines or bullets (if magazine is internal) and adds them to TacticalVest and Pockets.
|
||||||
|
* Additionally, adds extra bullets to SecuredContainer
|
||||||
|
* @param generatedWeaponResult object with properties for generated weapon (weapon mods pool / weapon template / ammo tpl)
|
||||||
|
* @param magWeights Magazine weights for count to add to inventory
|
||||||
|
* @param inventory Inventory to add magazines to
|
||||||
|
* @param botRole The bot type we're getting generating extra mags for
|
||||||
|
*/
|
||||||
|
addExtraMagazinesToInventory(generatedWeaponResult: GenerateWeaponResult, magWeights: GenerationData, inventory: PmcInventory, botRole: string): void;
|
||||||
|
/**
|
||||||
|
* Add Grendaes for UBGL to bots vest and secure container
|
||||||
|
* @param weaponMods Weapon array with mods
|
||||||
|
* @param generatedWeaponResult result of weapon generation
|
||||||
|
* @param inventory bot inventory to add grenades to
|
||||||
|
*/
|
||||||
|
protected addUbglGrenadesToBotInventory(weaponMods: Item[], generatedWeaponResult: GenerateWeaponResult, inventory: PmcInventory): void;
|
||||||
|
/**
|
||||||
|
* Add ammo to the secure container
|
||||||
|
* @param stackCount How many stacks of ammo to add
|
||||||
|
* @param ammoTpl Ammo type to add
|
||||||
|
* @param stackSize Size of the ammo stack to add
|
||||||
|
* @param inventory Player inventory
|
||||||
|
*/
|
||||||
|
protected addAmmoToSecureContainer(stackCount: number, ammoTpl: string, stackSize: number, inventory: PmcInventory): void;
|
||||||
|
/**
|
||||||
|
* Get a weapons magazine tpl from a weapon template
|
||||||
|
* @param weaponMods mods from a weapon template
|
||||||
|
* @param weaponTemplate Weapon to get magazine tpl for
|
||||||
|
* @param botRole the bot type we are getting the magazine for
|
||||||
|
* @returns magazine tpl string
|
||||||
|
*/
|
||||||
|
protected getMagazineTplFromWeaponTemplate(weaponMods: Item[], weaponTemplate: ITemplateItem, botRole: string): string;
|
||||||
|
/**
|
||||||
|
* Finds and return a compatible ammo tpl based on the bots ammo weightings (x.json/inventory/equipment/ammo)
|
||||||
|
* @param ammo a list of ammo tpls the weapon can use
|
||||||
|
* @param weaponTemplate the weapon we want to pick ammo for
|
||||||
|
* @returns an ammo tpl that works with the desired gun
|
||||||
|
*/
|
||||||
|
protected getWeightedCompatibleAmmo(ammo: Record<string, Record<string, number>>, weaponTemplate: ITemplateItem): string;
|
||||||
|
/**
|
||||||
|
* Get a weapons compatible cartridge caliber
|
||||||
|
* @param weaponTemplate Weapon to look up caliber of
|
||||||
|
* @returns caliber as string
|
||||||
|
*/
|
||||||
|
protected getWeaponCaliber(weaponTemplate: ITemplateItem): string;
|
||||||
|
/**
|
||||||
|
* Fill existing magazines to full, while replacing their contents with specified ammo
|
||||||
|
* @param weaponMods Weapon with children
|
||||||
|
* @param magazine Magazine item
|
||||||
|
* @param cartridgeTpl Cartridge to insert into magazine
|
||||||
|
*/
|
||||||
|
protected fillExistingMagazines(weaponMods: Item[], magazine: Item, cartridgeTpl: string): void;
|
||||||
|
/**
|
||||||
|
* Add desired ammo tpl as item to weaponmods array, placed as child to UBGL
|
||||||
|
* @param weaponMods Weapon with children
|
||||||
|
* @param ubglMod UBGL item
|
||||||
|
* @param ubglAmmoTpl Grenade ammo tpl
|
||||||
|
*/
|
||||||
|
protected fillUbgl(weaponMods: Item[], ubglMod: Item, ubglAmmoTpl: string): void;
|
||||||
|
/**
|
||||||
|
* Add cartridge item to weapon Item array, if it already exists, update
|
||||||
|
* @param weaponWithMods Weapon items array to amend
|
||||||
|
* @param magazine magazine item details we're adding cartridges to
|
||||||
|
* @param chosenAmmoTpl cartridge to put into the magazine
|
||||||
|
* @param newStackSize how many cartridges should go into the magazine
|
||||||
|
* @param magazineTemplate magazines db template
|
||||||
|
*/
|
||||||
|
protected addOrUpdateMagazinesChildWithAmmo(weaponWithMods: Item[], magazine: Item, chosenAmmoTpl: string, magazineTemplate: ITemplateItem): void;
|
||||||
|
/**
|
||||||
|
* Fill each Camora with a bullet
|
||||||
|
* @param weaponMods Weapon mods to find and update camora mod(s) from
|
||||||
|
* @param magazineId magazine id to find and add to
|
||||||
|
* @param ammoTpl ammo template id to hydate with
|
||||||
|
*/
|
||||||
|
protected fillCamorasWithAmmo(weaponMods: Item[], magazineId: string, ammoTpl: string): void;
|
||||||
|
}
|
57
TypeScript/13.1AddTraderWithAssortJSON/types/generators/FenceBaseAssortGenerator.d.ts
vendored
Normal file
57
TypeScript/13.1AddTraderWithAssortJSON/types/generators/FenceBaseAssortGenerator.d.ts
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { ITraderConfig } from "@spt/models/spt/config/ITraderConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { FenceService } from "@spt/services/FenceService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
export declare class FenceBaseAssortGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected handbookHelper: HandbookHelper;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected fenceService: FenceService;
|
||||||
|
protected traderConfig: ITraderConfig;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, databaseService: DatabaseService, handbookHelper: HandbookHelper, itemHelper: ItemHelper, presetHelper: PresetHelper, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, localisationService: LocalisationService, configServer: ConfigServer, fenceService: FenceService);
|
||||||
|
/**
|
||||||
|
* Create base fence assorts dynamically and store in memory
|
||||||
|
*/
|
||||||
|
generateFenceBaseAssorts(): void;
|
||||||
|
/**
|
||||||
|
* Check ammo in boxes + loose ammos has a penetration value above the configured value in trader.json / ammoMaxPenLimit
|
||||||
|
* @param rootItemDb Ammo box or ammo item from items.db
|
||||||
|
* @returns True if penetration value is above limit set in config
|
||||||
|
*/
|
||||||
|
protected isAmmoAbovePenetrationLimit(rootItemDb: ITemplateItem): boolean;
|
||||||
|
/**
|
||||||
|
* Get the penetration power value of an ammo, works with ammo boxes and raw ammos
|
||||||
|
* @param rootItemDb Ammo box or ammo item from items.db
|
||||||
|
* @returns Penetration power of passed in item, undefined if it doesnt have a power
|
||||||
|
*/
|
||||||
|
protected getAmmoPenetrationPower(rootItemDb: ITemplateItem): number | undefined;
|
||||||
|
/**
|
||||||
|
* Add soft inserts + armor plates to an armor
|
||||||
|
* @param armor Armor item array to add mods into
|
||||||
|
* @param itemDbDetails Armor items db template
|
||||||
|
*/
|
||||||
|
protected addChildrenToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void;
|
||||||
|
/**
|
||||||
|
* Check if item is valid for being added to fence assorts
|
||||||
|
* @param item Item to check
|
||||||
|
* @returns true if valid fence item
|
||||||
|
*/
|
||||||
|
protected isValidFenceItem(item: ITemplateItem): boolean;
|
||||||
|
}
|
150
TypeScript/13.1AddTraderWithAssortJSON/types/generators/LocationGenerator.d.ts
vendored
Normal file
150
TypeScript/13.1AddTraderWithAssortJSON/types/generators/LocationGenerator.d.ts
vendored
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
import { ContainerHelper } from "@spt/helpers/ContainerHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { IContainerMinMax, IStaticAmmoDetails, IStaticContainer, IStaticContainerData, IStaticForcedProps, IStaticLootDetails } from "@spt/models/eft/common/ILocation";
|
||||||
|
import { ILocationBase } from "@spt/models/eft/common/ILocationBase";
|
||||||
|
import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@spt/models/eft/common/ILooseLoot";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { MathUtil } from "@spt/utils/MathUtil";
|
||||||
|
import { ObjectId } from "@spt/utils/ObjectId";
|
||||||
|
import { ProbabilityObjectArray, RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export interface IContainerItem {
|
||||||
|
items: Item[];
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
}
|
||||||
|
export interface IContainerGroupCount {
|
||||||
|
/** Containers this group has + probabilty to spawn */
|
||||||
|
containerIdsWithProbability: Record<string, number>;
|
||||||
|
/** How many containers the map should spawn with this group id */
|
||||||
|
chosenCount: number;
|
||||||
|
}
|
||||||
|
export declare class LocationGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected objectId: ObjectId;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected mathUtil: MathUtil;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected containerHelper: ContainerHelper;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected locationConfig: ILocationConfig;
|
||||||
|
constructor(logger: ILogger, databaseService: DatabaseService, objectId: ObjectId, randomUtil: RandomUtil, itemHelper: ItemHelper, mathUtil: MathUtil, seasonalEventService: SeasonalEventService, containerHelper: ContainerHelper, presetHelper: PresetHelper, localisationService: LocalisationService, itemFilterService: ItemFilterService, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Create an array of container objects with randomised loot
|
||||||
|
* @param locationBase Map base to generate containers for
|
||||||
|
* @param staticAmmoDist Static ammo distribution
|
||||||
|
* @returns Array of container objects
|
||||||
|
*/
|
||||||
|
generateStaticContainers(locationBase: ILocationBase, staticAmmoDist: Record<string, IStaticAmmoDetails[]>): SpawnpointTemplate[];
|
||||||
|
/**
|
||||||
|
* Get containers with a non-100% chance to spawn OR are NOT on the container type randomistion blacklist
|
||||||
|
* @param staticContainers
|
||||||
|
* @returns IStaticContainerData array
|
||||||
|
*/
|
||||||
|
protected getRandomisableContainersOnMap(staticContainers: IStaticContainerData[]): IStaticContainerData[];
|
||||||
|
/**
|
||||||
|
* Get containers with 100% spawn rate or have a type on the randomistion ignore list
|
||||||
|
* @param staticContainersOnMap
|
||||||
|
* @returns IStaticContainerData array
|
||||||
|
*/
|
||||||
|
protected getGuaranteedContainers(staticContainersOnMap: IStaticContainerData[]): IStaticContainerData[];
|
||||||
|
/**
|
||||||
|
* Choose a number of containers based on their probabilty value to fulfil the desired count in containerData.chosenCount
|
||||||
|
* @param groupId Name of the group the containers are being collected for
|
||||||
|
* @param containerData Containers and probability values for a groupId
|
||||||
|
* @returns List of chosen container Ids
|
||||||
|
*/
|
||||||
|
protected getContainersByProbabilty(groupId: string, containerData: IContainerGroupCount): string[];
|
||||||
|
/**
|
||||||
|
* Get a mapping of each groupid and the containers in that group + count of containers to spawn on map
|
||||||
|
* @param containersGroups Container group values
|
||||||
|
* @returns dictionary keyed by groupId
|
||||||
|
*/
|
||||||
|
protected getGroupIdToContainerMappings(staticContainerGroupData: IStaticContainer | Record<string, IContainerMinMax>, staticContainersOnMap: IStaticContainerData[]): Record<string, IContainerGroupCount>;
|
||||||
|
/**
|
||||||
|
* Choose loot to put into a static container based on weighting
|
||||||
|
* Handle forced items + seasonal item removal when not in season
|
||||||
|
* @param staticContainer The container itself we will add loot to
|
||||||
|
* @param staticForced Loot we need to force into the container
|
||||||
|
* @param staticLootDist staticLoot.json
|
||||||
|
* @param staticAmmoDist staticAmmo.json
|
||||||
|
* @param locationName Name of the map to generate static loot for
|
||||||
|
* @returns IStaticContainerProps
|
||||||
|
*/
|
||||||
|
protected addLootToContainer(staticContainer: IStaticContainerData, staticForced: IStaticForcedProps[], staticLootDist: Record<string, IStaticLootDetails>, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, locationName: string): IStaticContainerData;
|
||||||
|
/**
|
||||||
|
* Get a 2d grid of a containers item slots
|
||||||
|
* @param containerTpl Tpl id of the container
|
||||||
|
* @returns number[][]
|
||||||
|
*/
|
||||||
|
protected getContainerMapping(containerTpl: string): number[][];
|
||||||
|
/**
|
||||||
|
* Look up a containers itemcountDistribution data and choose an item count based on the found weights
|
||||||
|
* @param containerTypeId Container to get item count for
|
||||||
|
* @param staticLootDist staticLoot.json
|
||||||
|
* @param locationName Map name (to get per-map multiplier for from config)
|
||||||
|
* @returns item count
|
||||||
|
*/
|
||||||
|
protected getWeightedCountOfContainerItems(containerTypeId: string, staticLootDist: Record<string, IStaticLootDetails>, locationName: string): number;
|
||||||
|
/**
|
||||||
|
* Get all possible loot items that can be placed into a container
|
||||||
|
* Do not add seasonal items if found + current date is inside seasonal event
|
||||||
|
* @param containerTypeId Contianer to get possible loot for
|
||||||
|
* @param staticLootDist staticLoot.json
|
||||||
|
* @returns ProbabilityObjectArray of item tpls + probabilty
|
||||||
|
*/
|
||||||
|
protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record<string, IStaticLootDetails>): ProbabilityObjectArray<string, number>;
|
||||||
|
protected getLooseLootMultiplerForLocation(location: string): number;
|
||||||
|
protected getStaticLootMultiplerForLocation(location: string): number;
|
||||||
|
/**
|
||||||
|
* Create array of loose + forced loot using probability system
|
||||||
|
* @param dynamicLootDist
|
||||||
|
* @param staticAmmoDist
|
||||||
|
* @param locationName Location to generate loot for
|
||||||
|
* @returns Array of spawn points with loot in them
|
||||||
|
*/
|
||||||
|
generateDynamicLoot(dynamicLootDist: ILooseLoot, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, locationName: string): SpawnpointTemplate[];
|
||||||
|
/**
|
||||||
|
* Add forced spawn point loot into loot parameter array
|
||||||
|
* @param lootLocationTemplates array to add forced loot spawn locations to
|
||||||
|
* @param forcedSpawnPoints forced Forced loot locations that must be added
|
||||||
|
* @param locationName Name of map currently having force loot created for
|
||||||
|
*/
|
||||||
|
protected addForcedLoot(lootLocationTemplates: SpawnpointTemplate[], forcedSpawnPoints: SpawnpointsForced[], locationName: string): void;
|
||||||
|
/**
|
||||||
|
* Create array of item (with child items) and return
|
||||||
|
* @param chosenComposedKey Key we want to look up items for
|
||||||
|
* @param spawnPoint Dynamic spawn point item we want will be placed in
|
||||||
|
* @param staticAmmoDist ammo distributions
|
||||||
|
* @returns IContainerItem
|
||||||
|
*/
|
||||||
|
protected createDynamicLootItem(chosenComposedKey: string, spawnPoint: Spawnpoint, staticAmmoDist: Record<string, IStaticAmmoDetails[]>): IContainerItem;
|
||||||
|
/**
|
||||||
|
* Replace the _id value for base item + all children items parentid value
|
||||||
|
* @param itemWithChildren Item with mods to update
|
||||||
|
* @param newId new id to add on chidren of base item
|
||||||
|
*/
|
||||||
|
protected reparentItemAndChildren(itemWithChildren: Item[], newId?: string): void;
|
||||||
|
/**
|
||||||
|
* Find an item in array by its _tpl, handle differently if chosenTpl is a weapon
|
||||||
|
* @param items Items array to search
|
||||||
|
* @param chosenTpl Tpl we want to get item with
|
||||||
|
* @returns Item object
|
||||||
|
*/
|
||||||
|
protected getItemInArray(items: Item[], chosenTpl: string): Item | undefined;
|
||||||
|
protected createStaticLootItem(chosenTpl: string, staticAmmoDist: Record<string, IStaticAmmoDetails[]>, parentId?: string): IContainerItem;
|
||||||
|
}
|
113
TypeScript/13.1AddTraderWithAssortJSON/types/generators/LootGenerator.d.ts
vendored
Normal file
113
TypeScript/13.1AddTraderWithAssortJSON/types/generators/LootGenerator.d.ts
vendored
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
import { InventoryHelper } from "@spt/helpers/InventoryHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { IPreset } from "@spt/models/eft/common/IGlobals";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { ISealedAirdropContainerSettings, RewardDetails } from "@spt/models/spt/config/IInventoryConfig";
|
||||||
|
import { LootItem } from "@spt/models/spt/services/LootItem";
|
||||||
|
import { LootRequest } from "@spt/models/spt/services/LootRequest";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { RagfairLinkedItemService } from "@spt/services/RagfairLinkedItemService";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
type ItemLimit = {
|
||||||
|
current: number;
|
||||||
|
max: number;
|
||||||
|
};
|
||||||
|
export declare class LootGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected inventoryHelper: InventoryHelper;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected ragfairLinkedItemService: RagfairLinkedItemService;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, databaseService: DatabaseService, randomUtil: RandomUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, inventoryHelper: InventoryHelper, weightedRandomHelper: WeightedRandomHelper, localisationService: LocalisationService, ragfairLinkedItemService: RagfairLinkedItemService, itemFilterService: ItemFilterService);
|
||||||
|
/**
|
||||||
|
* Generate a list of items based on configuration options parameter
|
||||||
|
* @param options parameters to adjust how loot is generated
|
||||||
|
* @returns An array of loot items
|
||||||
|
*/
|
||||||
|
createRandomLoot(options: LootRequest): LootItem[];
|
||||||
|
/**
|
||||||
|
* Filter armor items by their front plates protection level - top if its a helmet
|
||||||
|
* @param armor Armor preset to check
|
||||||
|
* @param options Loot request options - armor level etc
|
||||||
|
* @returns True if item has desired armor level
|
||||||
|
*/
|
||||||
|
protected isArmorOfDesiredProtectionLevel(armor: IPreset, options: LootRequest): boolean;
|
||||||
|
/**
|
||||||
|
* Construct item limit record to hold max and current item count for each item type
|
||||||
|
* @param limits limits as defined in config
|
||||||
|
* @returns record, key: item tplId, value: current/max item count allowed
|
||||||
|
*/
|
||||||
|
protected initItemLimitCounter(limits: Record<string, number>): Record<string, ItemLimit>;
|
||||||
|
/**
|
||||||
|
* Find a random item in items.json and add to result array
|
||||||
|
* @param items items to choose from
|
||||||
|
* @param itemTypeCounts item limit counts
|
||||||
|
* @param options item filters
|
||||||
|
* @param result array to add found item to
|
||||||
|
* @returns true if item was valid and added to pool
|
||||||
|
*/
|
||||||
|
protected findAndAddRandomItemToLoot(items: [string, ITemplateItem][], itemTypeCounts: Record<string, {
|
||||||
|
current: number;
|
||||||
|
max: number;
|
||||||
|
}>, options: LootRequest, result: LootItem[]): boolean;
|
||||||
|
/**
|
||||||
|
* Get a randomised stack count for an item between its StackMinRandom and StackMaxSize values
|
||||||
|
* @param item item to get stack count of
|
||||||
|
* @param options loot options
|
||||||
|
* @returns stack count
|
||||||
|
*/
|
||||||
|
protected getRandomisedStackCount(item: ITemplateItem, options: LootRequest): number;
|
||||||
|
/**
|
||||||
|
* Find a random item in items.json and add to result array
|
||||||
|
* @param presetPool Presets to choose from
|
||||||
|
* @param itemTypeCounts Item limit counts
|
||||||
|
* @param itemBlacklist Items to skip
|
||||||
|
* @param result Array to add chosen preset to
|
||||||
|
* @returns true if preset was valid and added to pool
|
||||||
|
*/
|
||||||
|
protected findAndAddRandomPresetToLoot(presetPool: IPreset[], itemTypeCounts: Record<string, {
|
||||||
|
current: number;
|
||||||
|
max: number;
|
||||||
|
}>, itemBlacklist: string[], result: LootItem[]): boolean;
|
||||||
|
/**
|
||||||
|
* Sealed weapon containers have a weapon + associated mods inside them + assortment of other things (food/meds)
|
||||||
|
* @param containerSettings sealed weapon container settings
|
||||||
|
* @returns Array of item with children arrays
|
||||||
|
*/
|
||||||
|
getSealedWeaponCaseLoot(containerSettings: ISealedAirdropContainerSettings): Item[][];
|
||||||
|
/**
|
||||||
|
* Get non-weapon mod rewards for a sealed container
|
||||||
|
* @param containerSettings Sealed weapon container settings
|
||||||
|
* @param weaponDetailsDb Details for the weapon to reward player
|
||||||
|
* @returns Array of item with children arrays
|
||||||
|
*/
|
||||||
|
protected getSealedContainerNonWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, weaponDetailsDb: ITemplateItem): Item[][];
|
||||||
|
/**
|
||||||
|
* Iterate over the container weaponModRewardLimits settings and create an array of weapon mods to reward player
|
||||||
|
* @param containerSettings Sealed weapon container settings
|
||||||
|
* @param linkedItemsToWeapon All items that can be attached/inserted into weapon
|
||||||
|
* @param chosenWeaponPreset The weapon preset given to player as reward
|
||||||
|
* @returns Array of item with children arrays
|
||||||
|
*/
|
||||||
|
protected getSealedContainerWeaponModRewards(containerSettings: ISealedAirdropContainerSettings, linkedItemsToWeapon: ITemplateItem[], chosenWeaponPreset: IPreset): Item[][];
|
||||||
|
/**
|
||||||
|
* Handle event-related loot containers - currently just the halloween jack-o-lanterns that give food rewards
|
||||||
|
* @param rewardContainerDetails
|
||||||
|
* @returns Array of item with children arrays
|
||||||
|
*/
|
||||||
|
getRandomLootContainerLoot(rewardContainerDetails: RewardDetails): Item[][];
|
||||||
|
}
|
||||||
|
export {};
|
56
TypeScript/13.1AddTraderWithAssortJSON/types/generators/PMCLootGenerator.d.ts
vendored
Normal file
56
TypeScript/13.1AddTraderWithAssortJSON/types/generators/PMCLootGenerator.d.ts
vendored
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { WeightedRandomHelper } from "@spt/helpers/WeightedRandomHelper";
|
||||||
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
/**
|
||||||
|
* Handle the generation of dynamic PMC loot in pockets and backpacks
|
||||||
|
* and the removal of blacklisted items
|
||||||
|
*/
|
||||||
|
export declare class PMCLootGenerator {
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
protected ragfairPriceService: RagfairPriceService;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected weightedRandomHelper: WeightedRandomHelper;
|
||||||
|
protected pocketLootPool: Record<string, number>;
|
||||||
|
protected vestLootPool: Record<string, number>;
|
||||||
|
protected backpackLootPool: Record<string, number>;
|
||||||
|
protected pmcConfig: IPmcConfig;
|
||||||
|
constructor(itemHelper: ItemHelper, databaseService: DatabaseService, configServer: ConfigServer, itemFilterService: ItemFilterService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, weightedRandomHelper: WeightedRandomHelper);
|
||||||
|
/**
|
||||||
|
* Create an array of loot items a PMC can have in their pockets
|
||||||
|
* @returns string array of tpls
|
||||||
|
*/
|
||||||
|
generatePMCPocketLootPool(botRole: string): Record<string, number>;
|
||||||
|
/**
|
||||||
|
* Create an array of loot items a PMC can have in their vests
|
||||||
|
* @returns string array of tpls
|
||||||
|
*/
|
||||||
|
generatePMCVestLootPool(botRole: string): Record<string, number>;
|
||||||
|
/**
|
||||||
|
* Check if item has a width/height that lets it fit into a 2x2 slot
|
||||||
|
* 1x1 / 1x2 / 2x1 / 2x2
|
||||||
|
* @param item Item to check size of
|
||||||
|
* @returns true if it fits
|
||||||
|
*/
|
||||||
|
protected itemFitsInto2By2Slot(item: ITemplateItem): boolean;
|
||||||
|
/**
|
||||||
|
* Check if item has a width/height that lets it fit into a 1x2 slot
|
||||||
|
* 1x1 / 1x2 / 2x1
|
||||||
|
* @param item Item to check size of
|
||||||
|
* @returns true if it fits
|
||||||
|
*/
|
||||||
|
protected itemFitsInto1By2Slot(item: ITemplateItem): boolean;
|
||||||
|
/**
|
||||||
|
* Create an array of loot items a PMC can have in their backpack
|
||||||
|
* @returns string array of tpls
|
||||||
|
*/
|
||||||
|
generatePMCBackpackLootPool(botRole: string): Record<string, number>;
|
||||||
|
}
|
84
TypeScript/13.1AddTraderWithAssortJSON/types/generators/PlayerScavGenerator.d.ts
vendored
Normal file
84
TypeScript/13.1AddTraderWithAssortJSON/types/generators/PlayerScavGenerator.d.ts
vendored
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
import { BotGenerator } from "@spt/generators/BotGenerator";
|
||||||
|
import { BotGeneratorHelper } from "@spt/helpers/BotGeneratorHelper";
|
||||||
|
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { IPmcData } from "@spt/models/eft/common/IPmcData";
|
||||||
|
import { IBotBase, Skills, Stats } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { IBotType } from "@spt/models/eft/common/tables/IBotType";
|
||||||
|
import { IPlayerScavConfig, KarmaLevel } from "@spt/models/spt/config/IPlayerScavConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { BotLootCacheService } from "@spt/services/BotLootCacheService";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { FenceService } from "@spt/services/FenceService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class PlayerScavGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected botGeneratorHelper: BotGeneratorHelper;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected botHelper: BotHelper;
|
||||||
|
protected fenceService: FenceService;
|
||||||
|
protected botLootCacheService: BotLootCacheService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected botGenerator: BotGenerator;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected playerScavConfig: IPlayerScavConfig;
|
||||||
|
constructor(logger: ILogger, randomUtil: RandomUtil, databaseService: DatabaseService, hashUtil: HashUtil, itemHelper: ItemHelper, botGeneratorHelper: BotGeneratorHelper, saveServer: SaveServer, profileHelper: ProfileHelper, botHelper: BotHelper, fenceService: FenceService, botLootCacheService: BotLootCacheService, localisationService: LocalisationService, botGenerator: BotGenerator, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Update a player profile to include a new player scav profile
|
||||||
|
* @param sessionID session id to specify what profile is updated
|
||||||
|
* @returns profile object
|
||||||
|
*/
|
||||||
|
generate(sessionID: string): IPmcData;
|
||||||
|
/**
|
||||||
|
* Add items picked from `playerscav.lootItemsToAddChancePercent`
|
||||||
|
* @param possibleItemsToAdd dict of tpl + % chance to be added
|
||||||
|
* @param scavData
|
||||||
|
* @param containersToAddTo Possible slotIds to add loot to
|
||||||
|
*/
|
||||||
|
protected addAdditionalLootToPlayerScavContainers(possibleItemsToAdd: Record<string, number>, scavData: IBotBase, containersToAddTo: string[]): void;
|
||||||
|
/**
|
||||||
|
* Get the scav karama level for a profile
|
||||||
|
* Is also the fence trader rep level
|
||||||
|
* @param pmcData pmc profile
|
||||||
|
* @returns karma level
|
||||||
|
*/
|
||||||
|
protected getScavKarmaLevel(pmcData: IPmcData): number;
|
||||||
|
/**
|
||||||
|
* Get a baseBot template
|
||||||
|
* If the parameter doesnt match "assault", take parts from the loot type and apply to the return bot template
|
||||||
|
* @param botTypeForLoot bot type to use for inventory/chances
|
||||||
|
* @returns IBotType object
|
||||||
|
*/
|
||||||
|
protected constructBotBaseTemplate(botTypeForLoot: string): IBotType;
|
||||||
|
/**
|
||||||
|
* Adjust equipment/mod/item generation values based on scav karma levels
|
||||||
|
* @param karmaSettings Values to modify the bot template with
|
||||||
|
* @param baseBotNode bot template to modify according to karama level settings
|
||||||
|
*/
|
||||||
|
protected adjustBotTemplateWithKarmaSpecificSettings(karmaSettings: KarmaLevel, baseBotNode: IBotType): void;
|
||||||
|
protected getScavSkills(scavProfile: IPmcData): Skills;
|
||||||
|
protected getDefaultScavSkills(): Skills;
|
||||||
|
protected getScavStats(scavProfile: IPmcData): Stats;
|
||||||
|
protected getScavLevel(scavProfile: IPmcData): number;
|
||||||
|
protected getScavExperience(scavProfile: IPmcData): number;
|
||||||
|
/**
|
||||||
|
* Set cooldown till pscav is playable
|
||||||
|
* take into account scav cooldown bonus
|
||||||
|
* @param scavData scav profile
|
||||||
|
* @param pmcData pmc profile
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
protected setScavCooldownTimer(scavData: IPmcData, pmcData: IPmcData): IPmcData;
|
||||||
|
}
|
50
TypeScript/13.1AddTraderWithAssortJSON/types/generators/RagfairAssortGenerator.d.ts
vendored
Normal file
50
TypeScript/13.1AddTraderWithAssortJSON/types/generators/RagfairAssortGenerator.d.ts
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { IPreset } from "@spt/models/eft/common/IGlobals";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
export declare class RagfairAssortGenerator {
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected databaseServer: DatabaseServer;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected generatedAssortItems: Item[][];
|
||||||
|
protected ragfairConfig: IRagfairConfig;
|
||||||
|
protected ragfairItemInvalidBaseTypes: string[];
|
||||||
|
constructor(hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseServer: DatabaseServer, seasonalEventService: SeasonalEventService, configServer: ConfigServer);
|
||||||
|
/**
|
||||||
|
* Get an array of arrays that can be sold on the flea
|
||||||
|
* Each sub array contains item + children (if any)
|
||||||
|
* @returns array of arrays
|
||||||
|
*/
|
||||||
|
getAssortItems(): Item[][];
|
||||||
|
/**
|
||||||
|
* Check internal generatedAssortItems array has objects
|
||||||
|
* @returns true if array has objects
|
||||||
|
*/
|
||||||
|
protected assortsAreGenerated(): boolean;
|
||||||
|
/**
|
||||||
|
* Generate an array of arrays (item + children) the flea can sell
|
||||||
|
* @returns array of arrays (item + children)
|
||||||
|
*/
|
||||||
|
protected generateRagfairAssortItems(): Item[][];
|
||||||
|
/**
|
||||||
|
* Get presets from globals to add to flea
|
||||||
|
* ragfairConfig.dynamic.showDefaultPresetsOnly decides if its all presets or just defaults
|
||||||
|
* @returns IPreset array
|
||||||
|
*/
|
||||||
|
protected getPresetsToAdd(): IPreset[];
|
||||||
|
/**
|
||||||
|
* Create a base assort item and return it with populated values + 999999 stack count + unlimited count = true
|
||||||
|
* @param tplId tplid to add to item
|
||||||
|
* @param id id to add to item
|
||||||
|
* @returns Hydrated Item object
|
||||||
|
*/
|
||||||
|
protected createRagfairAssortRootItem(tplId: string, id?: string): Item;
|
||||||
|
}
|
225
TypeScript/13.1AddTraderWithAssortJSON/types/generators/RagfairOfferGenerator.d.ts
vendored
Normal file
225
TypeScript/13.1AddTraderWithAssortJSON/types/generators/RagfairOfferGenerator.d.ts
vendored
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
import { RagfairAssortGenerator } from "@spt/generators/RagfairAssortGenerator";
|
||||||
|
import { BotHelper } from "@spt/helpers/BotHelper";
|
||||||
|
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PaymentHelper } from "@spt/helpers/PaymentHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
|
||||||
|
import { RagfairServerHelper } from "@spt/helpers/RagfairServerHelper";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { IBarterScheme } from "@spt/models/eft/common/tables/ITrader";
|
||||||
|
import { IRagfairOffer, IRagfairOfferUser, OfferRequirement } from "@spt/models/eft/ragfair/IRagfairOffer";
|
||||||
|
import { Dynamic, IArmorPlateBlacklistSettings, IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { SaveServer } from "@spt/servers/SaveServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { FenceService } from "@spt/services/FenceService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { RagfairOfferService } from "@spt/services/RagfairOfferService";
|
||||||
|
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||||
|
export declare class RagfairOfferGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected timeUtil: TimeUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected ragfairServerHelper: RagfairServerHelper;
|
||||||
|
protected profileHelper: ProfileHelper;
|
||||||
|
protected handbookHelper: HandbookHelper;
|
||||||
|
protected botHelper: BotHelper;
|
||||||
|
protected saveServer: SaveServer;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected ragfairAssortGenerator: RagfairAssortGenerator;
|
||||||
|
protected ragfairOfferService: RagfairOfferService;
|
||||||
|
protected ragfairPriceService: RagfairPriceService;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected paymentHelper: PaymentHelper;
|
||||||
|
protected fenceService: FenceService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected ragfairConfig: IRagfairConfig;
|
||||||
|
protected allowedFleaPriceItemsForBarter: {
|
||||||
|
tpl: string;
|
||||||
|
price: number;
|
||||||
|
}[];
|
||||||
|
/** Internal counter to ensure each offer created has a unique value for its intId property */
|
||||||
|
protected offerCounter: number;
|
||||||
|
constructor(logger: ILogger, hashUtil: HashUtil, randomUtil: RandomUtil, timeUtil: TimeUtil, databaseService: DatabaseService, ragfairServerHelper: RagfairServerHelper, profileHelper: ProfileHelper, handbookHelper: HandbookHelper, botHelper: BotHelper, saveServer: SaveServer, presetHelper: PresetHelper, ragfairAssortGenerator: RagfairAssortGenerator, ragfairOfferService: RagfairOfferService, ragfairPriceService: RagfairPriceService, localisationService: LocalisationService, paymentHelper: PaymentHelper, fenceService: FenceService, itemHelper: ItemHelper, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Create a flea offer and store it in the Ragfair server offers array
|
||||||
|
* @param userID Owner of the offer
|
||||||
|
* @param time Time offer is listed at
|
||||||
|
* @param items Items in the offer
|
||||||
|
* @param barterScheme Cost of item (currency or barter)
|
||||||
|
* @param loyalLevel Loyalty level needed to buy item
|
||||||
|
* @param sellInOnePiece Flags sellInOnePiece to be true
|
||||||
|
* @returns Created flea offer
|
||||||
|
*/
|
||||||
|
createAndAddFleaOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer;
|
||||||
|
/**
|
||||||
|
* Create an offer object ready to send to ragfairOfferService.addOffer()
|
||||||
|
* @param userID Owner of the offer
|
||||||
|
* @param time Time offer is listed at
|
||||||
|
* @param items Items in the offer
|
||||||
|
* @param barterScheme Cost of item (currency or barter)
|
||||||
|
* @param loyalLevel Loyalty level needed to buy item
|
||||||
|
* @param sellInOnePiece Set StackObjectsCount to 1
|
||||||
|
* @returns IRagfairOffer
|
||||||
|
*/
|
||||||
|
protected createOffer(userID: string, time: number, items: Item[], barterScheme: IBarterScheme[], loyalLevel: number, sellInOnePiece?: boolean): IRagfairOffer;
|
||||||
|
/**
|
||||||
|
* Create the user object stored inside each flea offer object
|
||||||
|
* @param userID user creating the offer
|
||||||
|
* @param isTrader Is the user creating the offer a trader
|
||||||
|
* @returns IRagfairOfferUser
|
||||||
|
*/
|
||||||
|
createUserDataForFleaOffer(userID: string, isTrader: boolean): IRagfairOfferUser;
|
||||||
|
/**
|
||||||
|
* Calculate the offer price that's listed on the flea listing
|
||||||
|
* @param offerRequirements barter requirements for offer
|
||||||
|
* @returns rouble cost of offer
|
||||||
|
*/
|
||||||
|
protected convertOfferRequirementsIntoRoubles(offerRequirements: OfferRequirement[]): number;
|
||||||
|
/**
|
||||||
|
* Get avatar url from trader table in db
|
||||||
|
* @param isTrader Is user we're getting avatar for a trader
|
||||||
|
* @param userId persons id to get avatar of
|
||||||
|
* @returns url of avatar
|
||||||
|
*/
|
||||||
|
protected getAvatarUrl(isTrader: boolean, userId: string): string;
|
||||||
|
/**
|
||||||
|
* Convert a count of currency into roubles
|
||||||
|
* @param currencyCount amount of currency to convert into roubles
|
||||||
|
* @param currencyType Type of currency (euro/dollar/rouble)
|
||||||
|
* @returns count of roubles
|
||||||
|
*/
|
||||||
|
protected calculateRoublePrice(currencyCount: number, currencyType: string): number;
|
||||||
|
/**
|
||||||
|
* Check userId, if its a player, return their pmc _id, otherwise return userId parameter
|
||||||
|
* @param userId Users Id to check
|
||||||
|
* @returns Users Id
|
||||||
|
*/
|
||||||
|
protected getTraderId(userId: string): string;
|
||||||
|
/**
|
||||||
|
* Get a flea trading rating for the passed in user
|
||||||
|
* @param userId User to get flea rating of
|
||||||
|
* @returns Flea rating value
|
||||||
|
*/
|
||||||
|
protected getRating(userId: string): number;
|
||||||
|
/**
|
||||||
|
* Is the offers user rating growing
|
||||||
|
* @param userID user to check rating of
|
||||||
|
* @returns true if its growing
|
||||||
|
*/
|
||||||
|
protected getRatingGrowing(userID: string): boolean;
|
||||||
|
/**
|
||||||
|
* Get number of section until offer should expire
|
||||||
|
* @param userID Id of the offer owner
|
||||||
|
* @param time Time the offer is posted
|
||||||
|
* @returns number of seconds until offer expires
|
||||||
|
*/
|
||||||
|
protected getOfferEndTime(userID: string, time: number): number;
|
||||||
|
/**
|
||||||
|
* Create multiple offers for items by using a unique list of items we've generated previously
|
||||||
|
* @param expiredOffers optional, expired offers to regenerate
|
||||||
|
*/
|
||||||
|
generateDynamicOffers(expiredOffers?: Item[][]): Promise<void>;
|
||||||
|
/**
|
||||||
|
* @param assortItemWithChildren Item with its children to process into offers
|
||||||
|
* @param isExpiredOffer is an expired offer
|
||||||
|
* @param config Ragfair dynamic config
|
||||||
|
*/
|
||||||
|
protected createOffersFromAssort(assortItemWithChildren: Item[], isExpiredOffer: boolean, config: Dynamic): Promise<void>;
|
||||||
|
/**
|
||||||
|
* iterate over an items chidren and look for plates above desired level and remove them
|
||||||
|
* @param presetWithChildren preset to check for plates
|
||||||
|
* @param plateSettings Settings
|
||||||
|
* @returns True if plate removed
|
||||||
|
*/
|
||||||
|
protected removeBannedPlatesFromPreset(presetWithChildren: Item[], plateSettings: IArmorPlateBlacklistSettings): boolean;
|
||||||
|
/**
|
||||||
|
* Create one flea offer for a specific item
|
||||||
|
* @param itemWithChildren Item to create offer for
|
||||||
|
* @param isPreset Is item a weapon preset
|
||||||
|
* @param itemDetails raw db item details
|
||||||
|
* @returns Item array
|
||||||
|
*/
|
||||||
|
protected createSingleOfferForItem(itemWithChildren: Item[], isPreset: boolean, itemDetails: [boolean, ITemplateItem]): Promise<void>;
|
||||||
|
/**
|
||||||
|
* Generate trader offers on flea using the traders assort data
|
||||||
|
* @param traderID Trader to generate offers for
|
||||||
|
*/
|
||||||
|
generateFleaOffersForTrader(traderID: string): void;
|
||||||
|
/**
|
||||||
|
* Get array of an item with its mods + condition properties (e.g durability)
|
||||||
|
* Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition
|
||||||
|
* @param userID id of owner of item
|
||||||
|
* @param itemWithMods Item and mods, get condition of first item (only first array item is modified)
|
||||||
|
* @param itemDetails db details of first item
|
||||||
|
*/
|
||||||
|
protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void;
|
||||||
|
/**
|
||||||
|
* Get the relevant condition id if item tpl matches in ragfair.json/condition
|
||||||
|
* @param tpl Item to look for matching condition object
|
||||||
|
* @returns condition id
|
||||||
|
*/
|
||||||
|
protected getDynamicConditionIdForTpl(tpl: string): string | undefined;
|
||||||
|
/**
|
||||||
|
* Alter an items condition based on its item base type
|
||||||
|
* @param conditionSettingsId also the parentId of item being altered
|
||||||
|
* @param itemWithMods Item to adjust condition details of
|
||||||
|
* @param itemDetails db item details of first item in array
|
||||||
|
*/
|
||||||
|
protected randomiseItemCondition(conditionSettingsId: string, itemWithMods: Item[], itemDetails: ITemplateItem): void;
|
||||||
|
/**
|
||||||
|
* Adjust an items durability/maxDurability value
|
||||||
|
* @param item item (weapon/armor) to Adjust
|
||||||
|
* @param itemDbDetails Weapon details from db
|
||||||
|
* @param maxMultiplier Value to multiply max durability by
|
||||||
|
* @param currentMultiplier Value to multiply current durability by
|
||||||
|
*/
|
||||||
|
protected randomiseWeaponDurability(item: Item, itemDbDetails: ITemplateItem, maxMultiplier: number, currentMultiplier: number): void;
|
||||||
|
/**
|
||||||
|
* Randomise the durabiltiy values for an armors plates and soft inserts
|
||||||
|
* @param armorWithMods Armor item with its child mods
|
||||||
|
* @param currentMultiplier Chosen multipler to use for current durability value
|
||||||
|
* @param maxMultiplier Chosen multipler to use for max durability value
|
||||||
|
*/
|
||||||
|
protected randomiseArmorDurabilityValues(armorWithMods: Item[], currentMultiplier: number, maxMultiplier: number): void;
|
||||||
|
/**
|
||||||
|
* Add missing conditions to an item if needed
|
||||||
|
* Durabiltiy for repairable items
|
||||||
|
* HpResource for medical items
|
||||||
|
* @param item item to add conditions to
|
||||||
|
*/
|
||||||
|
protected addMissingConditions(item: Item): void;
|
||||||
|
/**
|
||||||
|
* Create a barter-based barter scheme, if not possible, fall back to making barter scheme currency based
|
||||||
|
* @param offerItems Items for sale in offer
|
||||||
|
* @returns Barter scheme
|
||||||
|
*/
|
||||||
|
protected createBarterBarterScheme(offerItems: Item[]): IBarterScheme[];
|
||||||
|
/**
|
||||||
|
* Get an array of flea prices + item tpl, cached in generator class inside `allowedFleaPriceItemsForBarter`
|
||||||
|
* @returns array with tpl/price values
|
||||||
|
*/
|
||||||
|
protected getFleaPricesAsArray(): {
|
||||||
|
tpl: string;
|
||||||
|
price: number;
|
||||||
|
}[];
|
||||||
|
/**
|
||||||
|
* Create a random currency-based barter scheme for an array of items
|
||||||
|
* @param offerWithChildren Items on offer
|
||||||
|
* @param isPackOffer Is the barter scheme being created for a pack offer
|
||||||
|
* @param multipler What to multiply the resulting price by
|
||||||
|
* @returns Barter scheme for offer
|
||||||
|
*/
|
||||||
|
protected createCurrencyBarterScheme(offerWithChildren: Item[], isPackOffer: boolean, multipler?: number): IBarterScheme[];
|
||||||
|
}
|
138
TypeScript/13.1AddTraderWithAssortJSON/types/generators/RepeatableQuestGenerator.d.ts
vendored
Normal file
138
TypeScript/13.1AddTraderWithAssortJSON/types/generators/RepeatableQuestGenerator.d.ts
vendored
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
import { RepeatableQuestRewardGenerator } from "@spt/generators/RepeatableQuestRewardGenerator";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { RepeatableQuestHelper } from "@spt/helpers/RepeatableQuestHelper";
|
||||||
|
import { Exit } from "@spt/models/eft/common/ILocationBase";
|
||||||
|
import { TraderInfo } from "@spt/models/eft/common/tables/IBotBase";
|
||||||
|
import { IQuestCondition, IQuestConditionCounterCondition } from "@spt/models/eft/common/tables/IQuest";
|
||||||
|
import { IRepeatableQuest } from "@spt/models/eft/common/tables/IRepeatableQuests";
|
||||||
|
import { IBossInfo, IEliminationConfig, IQuestConfig, IRepeatableQuestConfig } from "@spt/models/spt/config/IQuestConfig";
|
||||||
|
import { IQuestTypePool } from "@spt/models/spt/repeatable/IQuestTypePool";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { MathUtil } from "@spt/utils/MathUtil";
|
||||||
|
import { ObjectId } from "@spt/utils/ObjectId";
|
||||||
|
import { ProbabilityObjectArray, RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class RepeatableQuestGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected mathUtil: MathUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected objectId: ObjectId;
|
||||||
|
protected repeatableQuestHelper: RepeatableQuestHelper;
|
||||||
|
protected repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected questConfig: IQuestConfig;
|
||||||
|
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, databaseService: DatabaseService, itemHelper: ItemHelper, localisationService: LocalisationService, objectId: ObjectId, repeatableQuestHelper: RepeatableQuestHelper, repeatableQuestRewardGenerator: RepeatableQuestRewardGenerator, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* This method is called by /GetClientRepeatableQuests/ and creates one element of quest type format (see assets/database/templates/repeatableQuests.json).
|
||||||
|
* It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest
|
||||||
|
* @param pmcLevel Player's level for requested items and reward generation
|
||||||
|
* @param pmcTraderInfo Players traper standing/rep levels
|
||||||
|
* @param questTypePool Possible quest types pool
|
||||||
|
* @param repeatableConfig Repeatable quest config
|
||||||
|
* @returns IRepeatableQuest
|
||||||
|
*/
|
||||||
|
generateRepeatableQuest(pmcLevel: number, pmcTraderInfo: Record<string, TraderInfo>, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
|
||||||
|
/**
|
||||||
|
* Generate a randomised Elimination quest
|
||||||
|
* @param pmcLevel Player's level for requested items and reward generation
|
||||||
|
* @param traderId Trader from which the quest will be provided
|
||||||
|
* @param questTypePool Pools for quests (used to avoid redundant quests)
|
||||||
|
* @param repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
|
||||||
|
* @returns Object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json)
|
||||||
|
*/
|
||||||
|
protected generateEliminationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
|
||||||
|
/**
|
||||||
|
* Get a number of kills neded to complete elimination quest
|
||||||
|
* @param targetKey Target type desired e.g. anyPmc/bossBully/Savage
|
||||||
|
* @param targetsConfig Config
|
||||||
|
* @param eliminationConfig Config
|
||||||
|
* @returns Number of AI to kill
|
||||||
|
*/
|
||||||
|
protected getEliminationKillCount(targetKey: string, targetsConfig: ProbabilityObjectArray<string, IBossInfo>, eliminationConfig: IEliminationConfig): number;
|
||||||
|
/**
|
||||||
|
* A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json)
|
||||||
|
* This is a helper method for GenerateEliminationQuest to create a location condition.
|
||||||
|
*
|
||||||
|
* @param {string} location the location on which to fulfill the elimination quest
|
||||||
|
* @returns {IEliminationCondition} object of "Elimination"-location-subcondition
|
||||||
|
*/
|
||||||
|
protected generateEliminationLocation(location: string[]): IQuestConditionCounterCondition;
|
||||||
|
/**
|
||||||
|
* Create kill condition for an elimination quest
|
||||||
|
* @param target Bot type target of elimination quest e.g. "AnyPmc", "Savage"
|
||||||
|
* @param targetedBodyParts Body parts player must hit
|
||||||
|
* @param distance Distance from which to kill (currently only >= supported
|
||||||
|
* @param allowedWeapon What weapon must be used - undefined = any
|
||||||
|
* @param allowedWeaponCategory What category of weapon must be used - undefined = any
|
||||||
|
* @returns IEliminationCondition object
|
||||||
|
*/
|
||||||
|
protected generateEliminationCondition(target: string, targetedBodyParts: string[], distance: number, allowedWeapon: string, allowedWeaponCategory: string): IQuestConditionCounterCondition;
|
||||||
|
/**
|
||||||
|
* Generates a valid Completion quest
|
||||||
|
*
|
||||||
|
* @param {integer} pmcLevel player's level for requested items and reward generation
|
||||||
|
* @param {string} traderId trader from which the quest will be provided
|
||||||
|
* @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
|
||||||
|
* @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json)
|
||||||
|
*/
|
||||||
|
protected generateCompletionQuest(pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
|
||||||
|
/**
|
||||||
|
* A repeatable quest, besides some more or less static components, exists of reward and condition (see assets/database/templates/repeatableQuests.json)
|
||||||
|
* This is a helper method for GenerateCompletionQuest to create a completion condition (of which a completion quest theoretically can have many)
|
||||||
|
*
|
||||||
|
* @param {string} itemTpl id of the item to request
|
||||||
|
* @param {integer} value amount of items of this specific type to request
|
||||||
|
* @returns {object} object of "Completion"-condition
|
||||||
|
*/
|
||||||
|
protected generateCompletionAvailableForFinish(itemTpl: string, value: number): IQuestCondition;
|
||||||
|
/**
|
||||||
|
* Generates a valid Exploration quest
|
||||||
|
*
|
||||||
|
* @param {integer} pmcLevel player's level for reward generation
|
||||||
|
* @param {string} traderId trader from which the quest will be provided
|
||||||
|
* @param {object} questTypePool Pools for quests (used to avoid redundant quests)
|
||||||
|
* @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest
|
||||||
|
* @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json)
|
||||||
|
*/
|
||||||
|
protected generateExplorationQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
|
||||||
|
/**
|
||||||
|
* Filter a maps exits to just those for the desired side
|
||||||
|
* @param locationKey Map id (e.g. factory4_day)
|
||||||
|
* @param playerSide Scav/Pmc
|
||||||
|
* @returns Array of Exit objects
|
||||||
|
*/
|
||||||
|
protected getLocationExitsForSide(locationKey: string, playerSide: string): Exit[];
|
||||||
|
protected generatePickupQuest(pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, repeatableConfig: IRepeatableQuestConfig): IRepeatableQuest;
|
||||||
|
/**
|
||||||
|
* Convert a location into an quest code can read (e.g. factory4_day into 55f2d3fd4bdc2d5f408b4567)
|
||||||
|
* @param locationKey e.g factory4_day
|
||||||
|
* @returns guid
|
||||||
|
*/
|
||||||
|
protected getQuestLocationByMapId(locationKey: string): string;
|
||||||
|
/**
|
||||||
|
* Exploration repeatable quests can specify a required extraction point.
|
||||||
|
* This method creates the according object which will be appended to the conditions array
|
||||||
|
*
|
||||||
|
* @param {string} exit The exit name to generate the condition for
|
||||||
|
* @returns {object} Exit condition
|
||||||
|
*/
|
||||||
|
protected generateExplorationExitCondition(exit: Exit): IQuestConditionCounterCondition;
|
||||||
|
/**
|
||||||
|
* Generates the base object of quest type format given as templates in assets/database/templates/repeatableQuests.json
|
||||||
|
* The templates include Elimination, Completion and Extraction quest types
|
||||||
|
*
|
||||||
|
* @param {string} type Quest type: "Elimination", "Completion" or "Extraction"
|
||||||
|
* @param {string} traderId Trader from which the quest will be provided
|
||||||
|
* @param {string} side Scav daily or pmc daily/weekly quest
|
||||||
|
* @returns {object} Object which contains the base elements for repeatable quests of the requests type
|
||||||
|
* (needs to be filled with reward and conditions by called to make a valid quest)
|
||||||
|
*/
|
||||||
|
protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest;
|
||||||
|
}
|
156
TypeScript/13.1AddTraderWithAssortJSON/types/generators/RepeatableQuestRewardGenerator.d.ts
vendored
Normal file
156
TypeScript/13.1AddTraderWithAssortJSON/types/generators/RepeatableQuestRewardGenerator.d.ts
vendored
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
import { HandbookHelper } from "@spt/helpers/HandbookHelper";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { IQuestReward, IQuestRewards } from "@spt/models/eft/common/tables/IQuest";
|
||||||
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { IBaseQuestConfig, IQuestConfig, IRepeatableQuestConfig, IRewardScaling } from "@spt/models/spt/config/IQuestConfig";
|
||||||
|
import { IQuestRewardValues } from "@spt/models/spt/repeatable/IQuestRewardValues";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||||
|
import { MathUtil } from "@spt/utils/MathUtil";
|
||||||
|
import { ObjectId } from "@spt/utils/ObjectId";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
export declare class RepeatableQuestRewardGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected mathUtil: MathUtil;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected handbookHelper: HandbookHelper;
|
||||||
|
protected localisationService: LocalisationService;
|
||||||
|
protected objectId: ObjectId;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected cloner: ICloner;
|
||||||
|
protected questConfig: IQuestConfig;
|
||||||
|
constructor(logger: ILogger, randomUtil: RandomUtil, mathUtil: MathUtil, databaseService: DatabaseService, itemHelper: ItemHelper, presetHelper: PresetHelper, handbookHelper: HandbookHelper, localisationService: LocalisationService, objectId: ObjectId, itemFilterService: ItemFilterService, seasonalEventService: SeasonalEventService, configServer: ConfigServer, cloner: ICloner);
|
||||||
|
/**
|
||||||
|
* Generate the reward for a mission. A reward can consist of
|
||||||
|
* - Experience
|
||||||
|
* - Money
|
||||||
|
* - Items
|
||||||
|
* - Trader Reputation
|
||||||
|
*
|
||||||
|
* The reward is dependent on the player level as given by the wiki. The exact mapping of pmcLevel to
|
||||||
|
* experience / money / items / trader reputation can be defined in QuestConfig.js
|
||||||
|
*
|
||||||
|
* There's also a random variation of the reward the spread of which can be also defined in the config.
|
||||||
|
*
|
||||||
|
* Additionally, a scaling factor w.r.t. quest difficulty going from 0.2...1 can be used
|
||||||
|
*
|
||||||
|
* @param {integer} pmcLevel player's level
|
||||||
|
* @param {number} difficulty a reward scaling factor from 0.2 to 1
|
||||||
|
* @param {string} traderId the trader for reputation gain (and possible in the future filtering of reward item type based on trader)
|
||||||
|
* @param {object} repeatableConfig The configuration for the repeatable kind (daily, weekly) as configured in QuestConfig for the requested quest
|
||||||
|
* @returns {object} object of "Reward"-type that can be given for a repeatable mission
|
||||||
|
*/
|
||||||
|
generateReward(pmcLevel: number, difficulty: number, traderId: string, repeatableConfig: IRepeatableQuestConfig, questConfig: IBaseQuestConfig): IQuestRewards;
|
||||||
|
protected getQuestRewardValues(rewardScaling: IRewardScaling, difficulty: number, pmcLevel: number): IQuestRewardValues;
|
||||||
|
/**
|
||||||
|
* Get an array of items + stack size to give to player as reward that fit inside of a rouble budget
|
||||||
|
* @param itemPool All possible items to choose rewards from
|
||||||
|
* @param maxItemCount Total number of items to reward
|
||||||
|
* @param itemRewardBudget Rouble buget all item rewards must fit in
|
||||||
|
* @param repeatableConfig config for quest type
|
||||||
|
* @returns Items and stack size
|
||||||
|
*/
|
||||||
|
protected getRewardableItemsFromPoolWithinBudget(itemPool: ITemplateItem[], maxItemCount: number, itemRewardBudget: number, repeatableConfig: IRepeatableQuestConfig): {
|
||||||
|
item: ITemplateItem;
|
||||||
|
stackSize: number;
|
||||||
|
}[];
|
||||||
|
/**
|
||||||
|
* Choose a random Weapon preset that fits inside of a rouble amount limit
|
||||||
|
* @param roublesBudget
|
||||||
|
* @param rewardIndex
|
||||||
|
* @returns IQuestReward
|
||||||
|
*/
|
||||||
|
protected getRandomWeaponPresetWithinBudget(roublesBudget: number, rewardIndex: number): {
|
||||||
|
weapon: IQuestReward;
|
||||||
|
price: number;
|
||||||
|
} | undefined;
|
||||||
|
/**
|
||||||
|
* @param rewardItems List of reward items to filter
|
||||||
|
* @param roublesBudget The budget remaining for rewards
|
||||||
|
* @param minPrice The minimum priced item to include
|
||||||
|
* @returns True if any items remain in `rewardItems`, false otherwise
|
||||||
|
*/
|
||||||
|
protected filterRewardPoolWithinBudget(rewardItems: ITemplateItem[], roublesBudget: number, minPrice: number): ITemplateItem[];
|
||||||
|
/**
|
||||||
|
* Get a randomised number a reward items stack size should be based on its handbook price
|
||||||
|
* @param item Reward item to get stack size for
|
||||||
|
* @returns matching stack size for the passed in items price
|
||||||
|
*/
|
||||||
|
protected getRandomisedRewardItemStackSizeByPrice(item: ITemplateItem): number;
|
||||||
|
/**
|
||||||
|
* Should reward item have stack size increased (25% chance)
|
||||||
|
* @param item Item to increase reward stack size of
|
||||||
|
* @param maxRoublePriceToStack Maximum rouble price an item can be to still be chosen for stacking
|
||||||
|
* @param randomChanceToPass Additional randomised chance of passing
|
||||||
|
* @returns True if items stack size can be increased
|
||||||
|
*/
|
||||||
|
protected canIncreaseRewardItemStackSize(item: ITemplateItem, maxRoublePriceToStack: number, randomChanceToPass?: number): boolean;
|
||||||
|
/**
|
||||||
|
* Get a count of cartridges that fits the rouble budget amount provided
|
||||||
|
* e.g. how many M80s for 50,000 roubles
|
||||||
|
* @param itemSelected Cartridge
|
||||||
|
* @param roublesBudget Rouble budget
|
||||||
|
* @param rewardNumItems
|
||||||
|
* @returns Count that fits budget (min 1)
|
||||||
|
*/
|
||||||
|
protected calculateAmmoStackSizeThatFitsBudget(itemSelected: ITemplateItem, roublesBudget: number, rewardNumItems: number): number;
|
||||||
|
/**
|
||||||
|
* Select a number of items that have a colelctive value of the passed in parameter
|
||||||
|
* @param repeatableConfig Config
|
||||||
|
* @param roublesBudget Total value of items to return
|
||||||
|
* @param traderId Id of the trader who will give player reward
|
||||||
|
* @returns Array of reward items that fit budget
|
||||||
|
*/
|
||||||
|
protected chooseRewardItemsWithinBudget(repeatableConfig: IRepeatableQuestConfig, roublesBudget: number, traderId: string): ITemplateItem[];
|
||||||
|
/**
|
||||||
|
* Helper to create a reward item structured as required by the client
|
||||||
|
*
|
||||||
|
* @param {string} tpl ItemId of the rewarded item
|
||||||
|
* @param {integer} count Amount of items to give
|
||||||
|
* @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index
|
||||||
|
* @param preset Optional array of preset items
|
||||||
|
* @returns {object} Object of "Reward"-item-type
|
||||||
|
*/
|
||||||
|
protected generateItemReward(tpl: string, count: number, index: number): IQuestReward;
|
||||||
|
/**
|
||||||
|
* Helper to create a reward item structured as required by the client
|
||||||
|
*
|
||||||
|
* @param {string} tpl ItemId of the rewarded item
|
||||||
|
* @param {integer} count Amount of items to give
|
||||||
|
* @param {integer} index All rewards will be appended to a list, for unknown reasons the client wants the index
|
||||||
|
* @param preset Optional array of preset items
|
||||||
|
* @returns {object} Object of "Reward"-item-type
|
||||||
|
*/
|
||||||
|
protected generatePresetReward(tpl: string, count: number, index: number, preset?: Item[]): IQuestReward;
|
||||||
|
/**
|
||||||
|
* Picks rewardable items from items.json
|
||||||
|
* This means they must:
|
||||||
|
* - Fit into the inventory
|
||||||
|
* - Shouldn't be keys
|
||||||
|
* - Have a price greater than 0
|
||||||
|
* @param repeatableQuestConfig Config file
|
||||||
|
* @param traderId Id of trader who will give reward to player
|
||||||
|
* @returns List of rewardable items [[_tpl, itemTemplate],...]
|
||||||
|
*/
|
||||||
|
getRewardableItems(repeatableQuestConfig: IRepeatableQuestConfig, traderId: string): [string, ITemplateItem][];
|
||||||
|
/**
|
||||||
|
* Checks if an id is a valid item. Valid meaning that it's an item that may be a reward
|
||||||
|
* or content of bot loot. Items that are tested as valid may be in a player backpack or stash.
|
||||||
|
* @param {string} tpl template id of item to check
|
||||||
|
* @returns True if item is valid reward
|
||||||
|
*/
|
||||||
|
protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig, itemBaseWhitelist: string[]): boolean;
|
||||||
|
protected getMoneyReward(traderId: string, rewardRoubles: number, rewardIndex: number): IQuestReward;
|
||||||
|
}
|
98
TypeScript/13.1AddTraderWithAssortJSON/types/generators/ScavCaseRewardGenerator.d.ts
vendored
Normal file
98
TypeScript/13.1AddTraderWithAssortJSON/types/generators/ScavCaseRewardGenerator.d.ts
vendored
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { PresetHelper } from "@spt/helpers/PresetHelper";
|
||||||
|
import { Item } from "@spt/models/eft/common/tables/IItem";
|
||||||
|
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
|
||||||
|
import { IHideoutScavCase } from "@spt/models/eft/hideout/IHideoutScavCase";
|
||||||
|
import { IScavCaseConfig } from "@spt/models/spt/config/IScavCaseConfig";
|
||||||
|
import { RewardCountAndPriceDetails, ScavCaseRewardCountsAndPrices } from "@spt/models/spt/hideout/ScavCaseRewardCountsAndPrices";
|
||||||
|
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||||
|
import { ConfigServer } from "@spt/servers/ConfigServer";
|
||||||
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
||||||
|
import { ItemFilterService } from "@spt/services/ItemFilterService";
|
||||||
|
import { RagfairPriceService } from "@spt/services/RagfairPriceService";
|
||||||
|
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||||
|
import { HashUtil } from "@spt/utils/HashUtil";
|
||||||
|
import { RandomUtil } from "@spt/utils/RandomUtil";
|
||||||
|
/**
|
||||||
|
* Handle the creation of randomised scav case rewards
|
||||||
|
*/
|
||||||
|
export declare class ScavCaseRewardGenerator {
|
||||||
|
protected logger: ILogger;
|
||||||
|
protected randomUtil: RandomUtil;
|
||||||
|
protected hashUtil: HashUtil;
|
||||||
|
protected itemHelper: ItemHelper;
|
||||||
|
protected presetHelper: PresetHelper;
|
||||||
|
protected databaseService: DatabaseService;
|
||||||
|
protected ragfairPriceService: RagfairPriceService;
|
||||||
|
protected seasonalEventService: SeasonalEventService;
|
||||||
|
protected itemFilterService: ItemFilterService;
|
||||||
|
protected configServer: ConfigServer;
|
||||||
|
protected scavCaseConfig: IScavCaseConfig;
|
||||||
|
protected dbItemsCache: ITemplateItem[];
|
||||||
|
protected dbAmmoItemsCache: ITemplateItem[];
|
||||||
|
constructor(logger: ILogger, randomUtil: RandomUtil, hashUtil: HashUtil, itemHelper: ItemHelper, presetHelper: PresetHelper, databaseService: DatabaseService, ragfairPriceService: RagfairPriceService, seasonalEventService: SeasonalEventService, itemFilterService: ItemFilterService, configServer: ConfigServer);
|
||||||
|
/**
|
||||||
|
* Create an array of rewards that will be given to the player upon completing their scav case build
|
||||||
|
* @param recipeId recipe of the scav case craft
|
||||||
|
* @returns Product array
|
||||||
|
*/
|
||||||
|
generate(recipeId: string): Item[][];
|
||||||
|
/**
|
||||||
|
* Get all db items that are not blacklisted in scavcase config or global blacklist
|
||||||
|
* Store in class field
|
||||||
|
*/
|
||||||
|
protected cacheDbItems(): void;
|
||||||
|
/**
|
||||||
|
* Pick a number of items to be rewards, the count is defined by the values in `itemFilters` param
|
||||||
|
* @param items item pool to pick rewards from
|
||||||
|
* @param itemFilters how the rewards should be filtered down (by item count)
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
protected pickRandomRewards(items: ITemplateItem[], itemFilters: RewardCountAndPriceDetails, rarity: string): ITemplateItem[];
|
||||||
|
/**
|
||||||
|
* Choose if money should be a reward based on the moneyRewardChancePercent config chance in scavCaseConfig
|
||||||
|
* @returns true if reward should be money
|
||||||
|
*/
|
||||||
|
protected rewardShouldBeMoney(): boolean;
|
||||||
|
/**
|
||||||
|
* Choose if ammo should be a reward based on the ammoRewardChancePercent config chance in scavCaseConfig
|
||||||
|
* @returns true if reward should be ammo
|
||||||
|
*/
|
||||||
|
protected rewardShouldBeAmmo(): boolean;
|
||||||
|
/**
|
||||||
|
* Choose from rouble/dollar/euro at random
|
||||||
|
*/
|
||||||
|
protected getRandomMoney(): ITemplateItem;
|
||||||
|
/**
|
||||||
|
* Get a random ammo from items.json that is not in the ammo blacklist AND inside the price rage defined in scavcase.json config
|
||||||
|
* @param rarity The rarity this ammo reward is for
|
||||||
|
* @returns random ammo item from items.json
|
||||||
|
*/
|
||||||
|
protected getRandomAmmo(rarity: string): ITemplateItem;
|
||||||
|
/**
|
||||||
|
* Take all the rewards picked create the Product object array ready to return to calling code
|
||||||
|
* Also add a stack count to ammo and money
|
||||||
|
* @param rewardItems items to convert
|
||||||
|
* @returns Product array
|
||||||
|
*/
|
||||||
|
protected randomiseContainerItemRewards(rewardItems: ITemplateItem[], rarity: string): Item[][];
|
||||||
|
/**
|
||||||
|
* @param dbItems all items from the items.json
|
||||||
|
* @param itemFilters controls how the dbItems will be filtered and returned (handbook price)
|
||||||
|
* @returns filtered dbItems array
|
||||||
|
*/
|
||||||
|
protected getFilteredItemsByPrice(dbItems: ITemplateItem[], itemFilters: RewardCountAndPriceDetails): ITemplateItem[];
|
||||||
|
/**
|
||||||
|
* Gathers the reward min and max count params for each reward quality level from config and scavcase.json into a single object
|
||||||
|
* @param scavCaseDetails scavcase.json values
|
||||||
|
* @returns ScavCaseRewardCountsAndPrices object
|
||||||
|
*/
|
||||||
|
protected getScavCaseRewardCountsAndPrices(scavCaseDetails: IHideoutScavCase): ScavCaseRewardCountsAndPrices;
|
||||||
|
/**
|
||||||
|
* Randomises the size of ammo and money stacks
|
||||||
|
* @param itemToCalculate ammo or money item
|
||||||
|
* @param rarity rarity (common/rare/superrare)
|
||||||
|
* @returns value to set stack count to
|
||||||
|
*/
|
||||||
|
protected getRandomAmountRewardForScavCase(itemToCalculate: ITemplateItem, rarity: string): number;
|
||||||
|
}
|
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