Merge branch '3.9.0-DEV' of https://dev.sp-tarkov.com/SPT-AKI/Server into 3.9.0-DEV

This commit is contained in:
Dev 2024-05-16 11:10:41 +01:00
commit 5def42416b
73 changed files with 632 additions and 468 deletions

1
.gitignore vendored
View File

@ -18,6 +18,7 @@ project/src/__coverage__/
## visual studio
.vs
.idea
.vscode
slnx.sqlite
slnx-journal.sqlite

View File

@ -6,16 +6,16 @@ This is the Server project for the Single Player Tarkov mod for Escape From Tark
- [Features](#features)
- [Installation](#installation)
- [Requirements](#requirements)
- [Initial Setup](#initial-setup)
- [Requirements](#requirements)
- [Initial Setup](#initial-setup)
- [Development](#development)
- [Commands](#commands)
- [Debugging](#debugging)
- [Mod Debugging](#mod-debugging)
- [Commands](#commands)
- [Debugging](#debugging)
- [Mod Debugging](#mod-debugging)
- [Contributing](#contributing)
- [Branches](#branchs)
- [Pull Request Guidelines](#pull-request-guidelines)
- [Tests](#tests)
- [Branches](#branchs)
- [Pull Request Guidelines](#pull-request-guidelines)
- [Tests](#tests)
- [License](#license)
## Features
@ -31,10 +31,11 @@ This project has been built in [Visual Studio Code](https://code.visualstudio.co
There are a number of VSC extensions that we recommended for this project. VSC will prompt you to install these when you open the workspace file. If you do not see the prompt, you can install them manually:
- [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) - Editor Settings Synchronization
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) - Linting for Coding Issues & Naming Conventions
- [Vitest](https://marketplace.visualstudio.com/items?itemName=vitest.explorer) - Debugging Tests
- [SPT ID Highlighter](https://marketplace.visualstudio.com/items?itemName=refringe.spt-id-highlighter) - Converts IDs to Names
- [Format Code Action](https://marketplace.visualstudio.com/items?itemName=rohit-gohri.format-code-action) - Custom Format-on-save Actions
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) - Code Formatting
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) - Linting for Coding Issues & Naming Conventions
### Initial Setup
@ -42,9 +43,9 @@ To prepare the project for development you will need to:
1. Run `git clone https://dev.sp-tarkov.com/SPT-AKI/Server.git server` to clone the repository.
2. Run `git lfs pull` to download LFS files locally.
2. Open the `project/mod.code-workspace` file in Visual Studio Code (VSC).
3. Run `nvm use 20.11.1` in the VSC terminal.
4. Run `npm install` in the VSC terminal.
3. Open the `project/mod.code-workspace` file in Visual Studio Code (VSC).
4. Run `nvm use 20.11.1` in the VSC terminal.
5. Run `npm install` in the VSC terminal.
## Development
@ -52,24 +53,27 @@ To prepare the project for development you will need to:
The following commands are available after the initial setup. Run them with `npm run <command>`.
| Command | Description |
|--------------------------|-----------------------------------------------------------------------|
| `check:circular` | Check for circular dependencies in the project. |
| `lint` | Check the project for coding standards and style/formatting issues. |
| `lint:fix` | Automatically fix coding standard issues and style/formatting issues. |
| `test` | Run all tests. |
| `test:watch` | Run tests in watch mode. Tests will re-run when files are changed. |
| `test:coverage` | Run tests and generate a coverage report. |
| `test:ui` | Run tests in UI mode. This will open a browser window to view tests. |
| `build:release` | Build the project for release. |
| `build:debug` | Build the project for debugging. |
| `build:bleeding` | Build the project on the bleeding edge. |
| `build:bleedingmods` | Build the project on the bleeding edge with mods. |
| `run:build` | Run the project in build mode. |
| `run:debug` | Run the project in debug mode. |
| `run:profiler` | Run the project in profiler mode. |
| `gen:types` | Generate types for the project. |
| `gen:docs` | Generate documentation for the project. |
| Command | Description |
| -------------------- | ----------------------------------------------------------------------------- |
| `check:circular` | Check for circular dependencies in the project. |
| `lint` | Check the project for coding standards and post-Prettier formatting issues. |
| `lint:fix` | Automatically fix coding standard issues and post-Prettier formatting issues. |
| `style` | Check the project for coding standards and post-Prettier formatting issues. |
| `style:fix` | Automatically fix coding standard issues and post-Prettier formatting issues. |
| `format` | Run Prettier and then ESLint Stylistic to fix code formatting. |
| `test` | Run all tests. |
| `test:watch` | Run tests in watch mode. Tests will re-run when files are changed. |
| `test:coverage` | Run tests and generate a coverage report. |
| `test:ui` | Run tests in UI mode. This will open a browser window to view tests. |
| `build:release` | Build the project for release. |
| `build:debug` | Build the project for debugging. |
| `build:bleeding` | Build the project on the bleeding edge. |
| `build:bleedingmods` | Build the project on the bleeding edge with mods. |
| `run:build` | Run the project in build mode. |
| `run:debug` | Run the project in debug mode. |
| `run:profiler` | Run the project in profiler mode. |
| `gen:types` | Generate types for the project. |
| `gen:docs` | Generate documentation for the project. |
### Debugging
@ -85,29 +89,29 @@ We're really excited that you're interested in contributing! Before submitting y
### Branchs
- __master__
- **master**
The default branch used for the latest stable release. This branch is protected and typically is only merges with release branches.
- __3.9.0-DEV__
- **3.9.0-DEV**
Development for the next minor release of SPT. Minor releases target the latest version of EFT. Late in the minor release cycle the EFT version is frozen for stability to prepare for release. Larger changes to the project structure may be included in minor releases.
- __3.8.1-DEV__
- **3.8.4-DEV**
Development for the next hotfix release of SPT. Hotfix releases include bug fixes and minor features that do not effect the coding structure of the project. Special care is taken to not break server mod stability. These always target the same version of EFT as the last minor release.
### Pull Request Guidelines
- __Keep Them Small__
- **Keep Them Small**
If you're fixing a bug, try to keep the changes to the bug fix only. If you're adding a feature, try to keep the changes to the feature only. This will make it easier to review and merge your changes.
- __Perform a Self-Review__
- **Perform a Self-Review**
Before submitting your changes, review your own code. This will help you catch any mistakes you may have made.
- __Remove Noise__
- **Remove Noise**
Remove any unnecessary changes to white space, code style formatting, or some text change that has no impact related to the intention of the PR.
- __Create a Meaningful Title__
- **Create a Meaningful Title**
When creating a PR, make sure the title is meaningful and describes the changes you've made.
- __Write Detailed Commit Messages__
- **Write Detailed Commit Messages**
Bring out your table manners, speak the Queen's English and be on your best behaviour.
### Style Guide
We use ESLint Stylistic to enforce a consistent code style. Please run `npm run lint` and/or `npm run lint:fix` before submitting your changes. This is made easier by using the recommended VSC extensions to automatically format your code whenever you save a file.
We use a combination of Prettier and ESLint Stylistic to enforce a consistent code style. Please run `npm run format` before submitting your changes. This is made easier by using the recommended VSC extensions to automatically format your code whenever you save a file.
### Tests

View File

@ -3,13 +3,10 @@
"plugin:@typescript-eslint/recommended",
"plugin:@stylistic/recommended-extends",
"plugin:import/recommended",
"plugin:import/typescript"
],
"plugins": [
"@typescript-eslint",
"@stylistic",
"import"
"plugin:import/typescript",
"prettier"
],
"plugins": ["@typescript-eslint", "@stylistic", "import", "unused-imports", "switch-allman"],
"settings": {
"import/resolver": {
"typescript": {
@ -26,81 +23,83 @@
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/explicit-module-boundary-types": ["error", {
"allowArgumentsExplicitlyTypedAsAny": true
}],
"@typescript-eslint/naming-convention": ["error", {
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "allow"
}, {
"selector": "typeLike",
"format": ["PascalCase"]
}, {
"selector": "objectLiteralProperty",
"format": ["PascalCase", "camelCase", "snake_case"],
"leadingUnderscore": "allow"
}, {
"selector": "typeProperty",
"format": ["PascalCase", "camelCase"],
"leadingUnderscore": "allow"
}, {
"selector": "enumMember",
"format": ["UPPER_CASE"]
}, {
"selector": "property",
"modifiers": ["readonly", "static"],
"format": ["UPPER_CASE"]
}],
"@typescript-eslint/explicit-module-boundary-types": [
"error",
{
"allowArgumentsExplicitlyTypedAsAny": true
}
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "allow"
},
{
"selector": "typeLike",
"format": ["PascalCase"]
},
{
"selector": "objectLiteralProperty",
"format": ["PascalCase", "camelCase", "snake_case"],
"leadingUnderscore": "allow"
},
{
"selector": "typeProperty",
"format": ["PascalCase", "camelCase"],
"leadingUnderscore": "allow"
},
{
"selector": "enumMember",
"format": ["UPPER_CASE"]
},
{
"selector": "property",
"modifiers": ["readonly", "static"],
"format": ["UPPER_CASE"]
}
],
"@stylistic/indent": ["error", 4, { "MemberExpression": 1, "SwitchCase": 1 }],
"@stylistic/brace-style": ["error", "allman", { "allowSingleLine": false }],
"@stylistic/semi": ["error", "always"],
"@stylistic/quotes": ["error", "double", { "avoidEscape": true }],
"@stylistic/linebreak-style": ["error", "unix"],
"@stylistic/max-len": ["error", {
"code": 120,
"tabWidth": 4,
"ignoreComments": true,
"ignoreTrailingComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}],
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"@stylistic/no-confusing-arrow": ["error", {"allowParens": true}],
"@stylistic/no-extra-parens": ["error", "all", {
"returnAssign": false,
"nestedBinaryExpressions": false,
"ternaryOperandBinaryExpressions": false,
"enforceForArrowConditionals": false
}],
"@stylistic/new-parens": "error",
"@stylistic/newline-per-chained-call": ["error", { "ignoreChainWithDepth": 3 }],
"@stylistic/no-extra-semi": "error",
"@stylistic/no-floating-decimal": "error",
"@stylistic/no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1 }],
"@stylistic/switch-colon-spacing": "error",
"@stylistic/type-annotation-spacing": "error",
"@stylistic/type-generic-spacing": ["error"],
"@stylistic/type-named-tuple-spacing": ["error"],
"@stylistic/wrap-regex": "error",
"@stylistic/yield-star-spacing": ["error", "both"],
"import/order": ["error", {
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"pathGroups": [
{
"pattern": "tsyringe",
"group": "builtin",
"position": "before"
}
],
"newlines-between": "never",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
"@stylistic/operator-linebreak": ["error", "before"],
"@stylistic/arrow-parens": ["error", "always"],
"@stylistic/max-len": [
"warn",
{
"code": 121, // +1 to prevent conflicts with Prettier rule.
"tabWidth": 4,
"ignoreComments": true,
"ignoreTrailingComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true
}
}]
],
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"pathGroups": [
{
"pattern": "tsyringe",
"group": "builtin",
"position": "before"
}
],
"newlines-between": "never",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
],
"unused-imports/no-unused-imports-ts": "error",
"switch-allman/case-allman": "error"
},
"overrides": [
{

10
project/.prettierignore Normal file
View File

@ -0,0 +1,10 @@
**/.git
**/.pkg-cache
**/.vscode
**/build
**/node_modules
**/types
**/tests/__cache__
**/tests/__coverage__
.editorconfig
src/services/ModCompilerService.ts

3
project/.prettierrc Normal file
View File

@ -0,0 +1,3 @@
{
"quoteProps": "consistent"
}

View File

@ -1,8 +0,0 @@
{
"recommendations": [
"EditorConfig.EditorConfig",
"vitest.explorer",
"refringe.spt-id-highlighter",
"dbaeumer.vscode-eslint"
]
}

View File

@ -1,35 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "node",
"runtimeVersion": "20.11.1",
"runtimeExecutable": "npm",
"request": "launch",
"sourceMaps": true,
"runtimeArgs": [
"run",
"run:debug"
],
"outFiles": [
"!**/node_modules/**"
],
"cwd": "${workspaceFolder}",
"outputCapture": "std"
},
{
"name": "Run Vitest Tests",
"type": "node",
"runtimeVersion": "20.11.1",
"runtimeExecutable": "npm",
"request": "launch",
"runtimeArgs": [
"run",
"test"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}

View File

@ -1,17 +1,52 @@
{
"folders": [
{
"path": "."
}
"path": ".",
},
],
"settings": {
"window.title": "SPT-AKI Server",
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"eslint.debug": true,
"eslint.experimental.useFlatConfig": false
}
"editor.formatOnSave": false, // We use an extension to format on save.
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": ["source.formatDocument", "source.fixAll.eslint"],
"eslint.debug": false,
"eslint.experimental.useFlatConfig": false,
},
"extensions": {
"recommendations": [
"EditorConfig.EditorConfig", // EditorConfig file format support.
"vitest.explorer", // ViTest test runner.
"refringe.spt-id-highlighter", // Highly SPT IDs.
"rohit-gohri.format-code-action", // Custom format on save actions.
"esbenp.prettier-vscode", // Prettier code formatter.
"dbaeumer.vscode-eslint", // ESLint code linter and formatter.
],
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "node",
"runtimeVersion": "20.11.1",
"runtimeExecutable": "npm",
"request": "launch",
"sourceMaps": true,
"runtimeArgs": ["run", "run:debug"],
"outFiles": ["!**/node_modules/**"],
"cwd": "${workspaceFolder}",
"outputCapture": "std",
},
{
"name": "Run Vitest Tests",
"type": "node",
"runtimeVersion": "20.11.1",
"runtimeExecutable": "npm",
"request": "launch",
"runtimeArgs": ["run", "test"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
},
],
},
}

View File

@ -14,6 +14,9 @@
"check:circular": "madge --circular --ts-config tsconfig.json --extensions ts ./src/",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"style": "prettier src --check",
"style:fix": "prettier src --write",
"format": "npm run style:fix && npm run lint:fix",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
@ -67,8 +70,12 @@
"@yao-pkg/pkg-fetch": "3.5.9",
"cross-env": "~7.0",
"eslint": "~8.57",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "~3.6",
"eslint-plugin-import": "~2.29",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-switch-allman": "^1.0.2",
"eslint-plugin-unused-imports": "^3.2.0",
"fs-extra": "~11.2",
"gulp": "~4.0",
"gulp-decompress": "~3.0",
@ -77,9 +84,11 @@
"gulp-rename": "~2.0",
"madge": "~6.1",
"minimist": "~1.2",
"prettier": "^3.2.5",
"resedit": "~2.0",
"ts-node-dev": "~2.0",
"tsconfig-paths": "~4.2",
"tslint-config-prettier": "^1.18.0",
"typedoc": "~0.25",
"typemoq": "~2.1",
"typescript-eslint": "~7.8",

View File

@ -3,21 +3,19 @@ import { MatchController } from "@spt-aki/controllers/MatchController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest";
import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse";
import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest";
import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IGroupCurrentResponse } from "@spt-aki/models/eft/match/IGroupCurrentResponse";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
import { IMatchGroupCurrentResponse } from "@spt-aki/models/eft/match/IMatchGroupCurrentResponse";
import { IMatchGroupInviteSendRequest } from "@spt-aki/models/eft/match/IMatchGroupInviteSendRequest";
import { IMatchGroupPlayerRemoveRequest } from "@spt-aki/models/eft/match/IMatchGroupPlayerRemoveRequest";
import { IMatchGroupStartGameRequest } from "@spt-aki/models/eft/match/IMatchGroupStartGameRequest";
import { IMatchGroupStatusRequest } from "@spt-aki/models/eft/match/IMatchGroupStatusRequest";
import { IMatchGroupStatusResponse } from "@spt-aki/models/eft/match/IMatchGroupStatusResponse";
import { IMatchGroupTransferRequest } from "@spt-aki/models/eft/match/IMatchGroupTransferRequest";
import { IProfileStatusResponse } from "@spt-aki/models/eft/match/IProfileStatusResponse";
import { IPutMetricsRequestData } from "@spt-aki/models/eft/match/IPutMetricsRequestData";
import { IRemovePlayerFromGroupRequest } from "@spt-aki/models/eft/match/IRemovePlayerFromGroupRequest";
import { ISendGroupInviteRequest } from "@spt-aki/models/eft/match/ISendGroupInviteRequest";
import { ITransferGroupRequest } from "@spt-aki/models/eft/match/ITransferGroupRequest";
import { IRequestIdRequest } from "@spt-aki/models/eft/match/IRequestIdRequest";
import { IUpdatePingRequestData } from "@spt-aki/models/eft/match/IUpdatePingRequestData";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
@ -59,7 +57,7 @@ export class MatchCallbacks
url: string,
info: IEmptyRequestData,
sessionID: string,
): IGetBodyResponseData<IGroupCurrentResponse>
): IGetBodyResponseData<IMatchGroupCurrentResponse>
{
return this.httpResponse.getBody({ squad: [] });
}
@ -78,7 +76,11 @@ export class MatchCallbacks
/** Handle client/match/group/invite/send */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData<string>
public sendGroupInvite(
url: string,
info: IMatchGroupInviteSendRequest,
sessionID: string,
): IGetBodyResponseData<string>
{
return this.httpResponse.getBody("2427943f23698ay9f2863735");
}
@ -87,9 +89,9 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public acceptGroupInvite(
url: string,
info: IAcceptGroupInviteRequest,
info: IRequestIdRequest,
sessionId: string,
): IGetBodyResponseData<IAcceptGroupInviteResponse[]>
): IGetBodyResponseData<IGroupCharacter[]>
{
const result = [];
result.push({});
@ -101,7 +103,7 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public declineGroupInvite(
url: string,
info: IDeclineGroupInviteRequest,
info: IRequestIdRequest,
sessionId: string,
): IGetBodyResponseData<boolean>
{
@ -112,7 +114,7 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public cancelGroupInvite(
url: string,
info: ICancelGroupInviteRequest,
info: IRequestIdRequest,
sessionID: string,
): IGetBodyResponseData<boolean>
{
@ -123,7 +125,7 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public transferGroup(
url: string,
info: ITransferGroupRequest,
info: IMatchGroupTransferRequest,
sessionId: string,
): IGetBodyResponseData<boolean>
{
@ -160,9 +162,9 @@ export class MatchCallbacks
/** Handle match/group/start_game */
public joinMatch(
url: string,
info: IJoinMatchRequestData,
info: IMatchGroupStartGameRequest,
sessionID: string,
): IGetBodyResponseData<IJoinMatchResult>
): IGetBodyResponseData<IProfileStatusResponse>
{
return this.httpResponse.getBody(this.matchController.joinMatch(info, sessionID));
}
@ -182,16 +184,16 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getGroupStatus(
url: string,
info: IGetGroupStatusRequestData,
info: IMatchGroupStatusRequest,
sessionID: string,
): IGetBodyResponseData<IGetGroupStatusResponse>
): IGetBodyResponseData<IMatchGroupStatusResponse>
{
return this.httpResponse.getBody(this.matchController.getGroupStatus(info));
}
/** Handle client/match/group/delete */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public deleteGroup(url: string, info: any, sessionID: string): IGetBodyResponseData<boolean>
public deleteGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
{
this.matchController.deleteGroup(info);
return this.httpResponse.getBody(true);
@ -208,7 +210,7 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public removePlayerFromGroup(
url: string,
info: IRemovePlayerFromGroupRequest,
info: IMatchGroupPlayerRemoveRequest,
sessionID: string,
): IGetBodyResponseData<boolean>
{

View File

@ -7,11 +7,11 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
import { IMatchGroupStartGameRequest } from "@spt-aki/models/eft/match/IMatchGroupStartGameRequest";
import { IMatchGroupStatusRequest } from "@spt-aki/models/eft/match/IMatchGroupStatusRequest";
import { IMatchGroupStatusResponse } from "@spt-aki/models/eft/match/IMatchGroupStatusResponse";
import { IProfileStatusResponse } from "@spt-aki/models/eft/match/IProfileStatusResponse";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { MessageType } from "@spt-aki/models/enums/MessageType";
import { Traders } from "@spt-aki/models/enums/Traders";
@ -76,9 +76,9 @@ export class MatchController
/** Handle match/group/start_game */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult
public joinMatch(info: IMatchGroupStartGameRequest, sessionId: string): IProfileStatusResponse
{
const output: IJoinMatchResult = { maxPveCountExceeded: false, profiles: [] };
const output: IProfileStatusResponse = { maxPveCountExceeded: false, profiles: [] };
// get list of players joining into the match
output.profiles.push({
@ -92,7 +92,7 @@ export class MatchController
location: "TODO get location",
raidMode: "Online",
mode: "deathmatch",
shortid: null,
shortId: null,
// eslint-disable-next-line @typescript-eslint/naming-convention
additional_info: null,
});
@ -102,7 +102,7 @@ export class MatchController
/** Handle client/match/group/status */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getGroupStatus(info: IGetGroupStatusRequestData): IGetGroupStatusResponse
public getGroupStatus(info: IMatchGroupStatusRequest): IMatchGroupStatusResponse
{
return { players: [], maxPveCountExceeded: false };
}

View File

@ -1,8 +1,10 @@
import { inject, injectable } from "tsyringe";
import { INotification, NotificationType } from "@spt-aki/models/eft/notifier/INotifier";
import { Dialogue, IUserDialogInfo, Message } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IWsChatMessageReceived } from "@spt-aki/models/eft/ws/IWsChatMessageReceived";
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
import { MessageType } from "@spt-aki/models/enums/MessageType";
import { NotificationEventType } from "@spt-aki/models/enums/NotificationEventType";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { WebSocketServer } from "@spt-aki/servers/WebSocketServer";
import { NotificationService } from "@spt-aki/services/NotificationService";
@ -24,7 +26,7 @@ export class NotificationSendHelper
* @param sessionID
* @param notificationMessage
*/
public sendMessage(sessionID: string, notificationMessage: INotification): void
public sendMessage(sessionID: string, notificationMessage: IWsNotificationEvent): void
{
if (this.webSocketServer.isConnectionWebSocket(sessionID))
{
@ -65,8 +67,8 @@ export class NotificationSendHelper
};
dialog.messages.push(message);
const notification: INotification = {
type: NotificationType.NEW_MESSAGE,
const notification: IWsChatMessageReceived = {
type: NotificationEventType.CHAT_MESSAGE_RECEIVED,
eventId: message._id,
dialogId: message.uid,
message: message,

View File

@ -1,7 +1,10 @@
import { inject, injectable } from "tsyringe";
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { INotification, NotificationType } from "@spt-aki/models/eft/notifier/INotifier";
import { Message, MessageContentRagfair } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IWsChatMessageReceived } from "@spt-aki/models/eft/ws/IWsChatMessageReceived";
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
import { IWsRagfairOfferSold } from "@spt-aki/models/eft/ws/IWsRagfairOfferSold";
import { NotificationEventType } from "@spt-aki/models/enums/NotificationEventType";
@injectable()
export class NotifierHelper
@ -9,12 +12,12 @@ export class NotifierHelper
/**
* The default notification sent when waiting times out.
*/
protected defaultNotification: INotification = { type: NotificationType.PING, eventId: "ping" };
protected defaultNotification: IWsNotificationEvent = { type: NotificationEventType.PING, eventId: "ping" };
constructor(@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper)
{}
public getDefaultNotification(): INotification
public getDefaultNotification(): IWsNotificationEvent
{
return this.defaultNotification;
}
@ -28,12 +31,11 @@ export class NotifierHelper
public createRagfairOfferSoldNotification(
dialogueMessage: Message,
ragfairData: MessageContentRagfair,
): INotification
): IWsRagfairOfferSold
{
return {
type: NotificationType.RAGFAIR_OFFER_SOLD,
type: NotificationEventType.RAGFAIR_OFFER_SOLD,
eventId: dialogueMessage._id,
dialogId: dialogueMessage.uid,
...ragfairData,
};
}
@ -43,10 +45,10 @@ export class NotifierHelper
* @param dialogueMessage
* @returns
*/
public createNewMessageNotification(dialogueMessage: Message): INotification
public createNewMessageNotification(dialogueMessage: Message): IWsChatMessageReceived
{
return {
type: NotificationType.NEW_MESSAGE,
type: NotificationEventType.CHAT_MESSAGE_RECEIVED,
eventId: dialogueMessage._id,
dialogId: dialogueMessage.uid,
message: dialogueMessage,

View File

@ -1,4 +0,0 @@
export interface IAcceptGroupInviteRequest
{
requestId: string
}

View File

@ -1,19 +0,0 @@
export interface IAcceptGroupInviteResponse
{
_id: string
aid: number
Info: PlayerInviteInfo
isLeader: boolean
isReady: boolean
}
export interface PlayerInviteInfo
{
Nickname: string
Side: string
Level: number
MemberCategory: number
GameVersion: string
SavageLockTime: number
SavageNickname: string
}

View File

@ -1,4 +0,0 @@
export interface ICancelGroupInviteRequest
{
requestId: string
}

View File

@ -1,8 +0,0 @@
import { RaidMode } from "@spt-aki/models/enums/RaidMode";
export interface ICreateGroupRequestData
{
location: string
raidMode: RaidMode
startInGroup: boolean
}

View File

@ -1,4 +0,0 @@
export interface IDeclineGroupInviteRequest
{
requestId: string;
}

View File

@ -1,25 +0,0 @@
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
export interface IGetGroupStatusResponse
{
players: IPlayer[]
maxPveCountExceeded: boolean
}
export interface IPlayer
{
aid: string
_id: string
lookingGroup: boolean
IsLeader: boolean
IsReady: boolean
Info: ICurrentGroupMemberInfo
}
export interface ICurrentGroupMemberInfo
{
Nickname: string
Side: string
Level: string
MemberCategory: MemberCategory
}

View File

@ -1,4 +0,0 @@
export interface IGetProfileRequestData
{
profileId: string
}

View File

@ -1,71 +1,8 @@
export interface IGetRaidConfigurationRequestData
import { IRaidSettings } from "@spt-aki/models/eft/match/IRaidSettings";
export interface IGetRaidConfigurationRequestData extends IRaidSettings
{
keyId: string
side: string
location: string
timeVariant: string
raidMode: string
metabolismDisabled: boolean
playersSpawnPlace: string
timeAndWeatherSettings: TimeAndWeatherSettings
botSettings: BotSettings
wavesSettings: WavesSettings
CanShowGroupPreview: boolean
MaxGroupCount: number
}
// {
// keyId: "",
// side: "Pmc",
// location: "factory4_day",
// timeVariant: "CURR", or "PAST"
// raidMode: "Local",
// metabolismDisabled: false,
// playersSpawnPlace: "SamePlace",
// timeAndWeatherSettings: {
// isRandomTime: false,
// isRandomWeather: false,
// cloudinessType: "Clear",
// rainType: "NoRain",
// windType: "Light",
// fogType: "NoFog",
// timeFlowType: "x1",
// hourOfDay: -1
// },
// botSettings: {
// isScavWars: false,
// botAmount: "AsOnline"
// },
// wavesSettings: {
// botAmount: "AsOnline",
// botDifficulty: "AsOnline",
// isBosses: true,
// isTaggedAndCursed: false
// }
// }
export interface TimeAndWeatherSettings
{
isRandomTime: boolean
isRandomWeather: boolean
cloudinessType: string
rainType: string
windType: string
fogType: string
timeFlowType: string
hourOfDay: number
}
export interface BotSettings
{
isScavWars: boolean
botAmount: string
}
export interface WavesSettings
{
botAmount: string
botDifficulty: string
isBosses: boolean
isTaggedAndCursed: boolean
}

View File

@ -0,0 +1,41 @@
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
export interface IGroupCharacter
{
_id: string
aid: number
Info: {
Nickname: string
Side: string
Level: number
MemberCategory: MemberCategory
GameVersion?: string
SavageLockTime?: number
SavageNickname?: string
hasCoopExtension?: boolean
}
PlayerVisualRepresentation?: {
Info: {
Side: string
Level: number
Nickname: string
MemberCategory: MemberCategory
GameVersion: string
}
Customization: {
Head: string
Body: string
Feet: string
Hands: string
}
Equipment: {
Id: string
Items: Item[]
}
}
isLeader: boolean
isReady?: boolean
region?: string
lookingGroup?: boolean
}

View File

@ -1,13 +0,0 @@
export interface IGroupCurrentResponse
{
squad: ISquadMember[]
}
export interface ISquadMember
{
_id: string
aid: number
Info: any
isLeader: boolean
isReady: boolean
}

View File

@ -1,12 +0,0 @@
export interface IJoinMatchRequestData
{
groupId: string
servers: Server[]
}
export interface Server
{
ping: number
ip: string
port: string
}

View File

@ -1,21 +0,0 @@
export interface IJoinMatchResult
{
maxPveCountExceeded: boolean
profiles: IJoinMatchPlayerProfile[]
}
export interface IJoinMatchPlayerProfile
{
profileid: string
profileToken: string
status: string
sid: string
ip: string
port: number
version: string
location: string
raidMode: string
mode: string
shortid: string
additional_info: any[]
}

View File

@ -0,0 +1,6 @@
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
export interface IMatchGroupCurrentResponse
{
squad: IGroupCharacter[]
}

View File

@ -0,0 +1,5 @@
export interface IMatchGroupInviteSendRequest
{
to: string
inLobby: boolean
}

View File

@ -0,0 +1,4 @@
export interface IMatchGroupPlayerRemoveRequest
{
aidToKick: string
}

View File

@ -0,0 +1,7 @@
import { IServer } from "@spt-aki/models/eft/match/IServer";
export interface IMatchGroupStartGameRequest
{
groupId: string
servers: IServer[]
}

View File

@ -1,6 +1,6 @@
import { RaidMode } from "@spt-aki/models/enums/RaidMode";
export interface IGetGroupStatusRequestData
export interface IMatchGroupStatusRequest
{
location: string
savage: boolean

View File

@ -0,0 +1,7 @@
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
export interface IMatchGroupStatusResponse
{
players: IGroupCharacter[]
maxPveCountExceeded: boolean
}

View File

@ -0,0 +1,4 @@
export interface IMatchGroupTransferRequest
{
aidToChange: string
}

View File

@ -0,0 +1,4 @@
export interface IProfileStatusRequest
{
groupId: number
}

View File

@ -0,0 +1,7 @@
import { ISessionStatus } from "@spt-aki/models/eft/match/ISessionStatus";
export interface IProfileStatusResponse
{
maxPveCountExceeded: boolean
profiles: ISessionStatus[]
}

View File

@ -0,0 +1,50 @@
import { DateTime } from "@spt-aki/models/enums/DateTime";
import { PlayersSpawnPlace } from "@spt-aki/models/enums/PlayersSpawnPlace";
import { RaidMode } from "@spt-aki/models/enums/RaidMode";
import { BotAmount } from "@spt-aki/models/enums/RaidSettings/BotAmount";
import { BotDifficulty } from "@spt-aki/models/enums/RaidSettings/BotDifficulty";
import { CloudinessType } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/CloudinessType";
import { FogType } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/FogType";
import { RainType } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/RainType";
import { TimeFlowType } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/TimeFlowType";
import { WindSpeed } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/WindSpeed";
import { SideType } from "@spt-aki/models/enums/SideType";
export interface IRaidSettings
{
location: string
timeVariant: DateTime
raidMode: RaidMode
metabolismDisabled: boolean
playersSpawnPlace: PlayersSpawnPlace
timeAndWeatherSettings: TimeAndWeatherSettings
botSettings: BotSettings
wavesSettings: WavesSettings
side: SideType
}
export interface TimeAndWeatherSettings
{
isRandomTime: boolean
isRandomWeather: boolean
cloudinessType: CloudinessType
rainType: RainType
fogType: FogType
windType: WindSpeed
timeFlowType: TimeFlowType
hourOfDay: number
}
export interface BotSettings
{
isScavWars: boolean
botAmount: BotAmount
}
export interface WavesSettings
{
botAmount: BotAmount
botDifficulty: BotDifficulty
isBosses: boolean
isTaggedAndCursed: boolean
}

View File

@ -1,4 +0,0 @@
export interface IRemovePlayerFromGroupRequest
{
aidToKick: string
}

View File

@ -0,0 +1,4 @@
export interface IRequestIdRequest
{
requestId: string
}

View File

@ -1,5 +0,0 @@
export interface ISendGroupInviteRequest
{
to: string
inLobby: boolean
}

View File

@ -0,0 +1,6 @@
export interface IServer
{
ping: number
ip: string
port: number
}

View File

@ -0,0 +1,16 @@
export interface ISessionStatus
{
profileid: string
profileToken: string
status: string
ip: string
port: number
sid: string
version?: string
location?: string
raidMode?: string
mode?: string
shortId?: string
// eslint-disable-next-line @typescript-eslint/naming-convention
additional_info?: any[]
}

View File

@ -1,4 +0,0 @@
export interface ITransferGroupRequest
{
aidToChange: string
}

View File

@ -1,49 +1,9 @@
import { Message } from "@spt-aki/models/eft/profile/IAkiProfile";
export interface INotifierChannel
{
server: string
// eslint-disable-next-line @typescript-eslint/naming-convention
channel_id: string
url: string
notifierServer: string
ws: string
}
export interface INotification
{
type: NotificationType
eventId: string
dialogId?: string
message?: Message
}
export enum NotificationType
{
RAGFAIR_OFFER_SOLD = "RagfairOfferSold",
RAGFAIR_RATING_CHANGE = "RagfairRatingChange",
/** ChatMessageReceived */
NEW_MESSAGE = "new_message",
PING = "ping",
TRADER_SUPPLY = "TraderSupply",
TRADER_STANDING = "TraderStanding",
UNLOCK_TRADER = "UnlockTrader",
GROUP_MATCH_RAID_SETTINGS = "groupMatchRaidSettings",
GROUP_MATCH_RAID_NOT_READY = "groupMatchRaidNotReady",
GROUP_MATCH_RAID_READY = "groupMatchRaidReady",
GROUP_MATCH_INVITE_ACCEPT = "groupMatchInviteAccept",
GROUP_MATCH_INVITE_DECLINE = "groupMatchInviteDecline",
GROUP_MATCH_INVITE_SEND = "groupMatchInviteSend",
GROUP_MATCH_LEADER_CHANGED = "groupMatchLeaderChanged",
GROUP_MATCH_START_GAME = "groupMatchStartGame",
GROUP_MATCH_USER_LEAVE = "groupMatchUserLeave",
GROUP_MATCH_WAS_REMOVED = "groupMatchWasRemoved",
GROUP_MATCH_USER_BAD_VERSION = "groupMatchUserHasBadVersion",
USER_CONFIRMED = "userConfirmed",
CHANNEL_DELETED = "channel_deleted",
FRIEND_LIST_REQUEST_ACCEPTED = "friendListRequestAccept",
FRIEND_LIST_REQUEST_DECLINED = "friendListRequestDecline",
FRIEND_LIST_NEW_REQUEST = "friendListNewRequest",
FRIEND_LIST_REMOVED_FROM_FRIEND_LIST = "youAreRemovedFromFriendList",
YOU_ARE_ADDED_TO_IGNORE_LIST = "YouWereAddedToIgnoreList",
YOU_ARE_REMOVED_FROM_IGNORE_LIST = "youAreRemoveFromIgnoreList"
}

View File

@ -0,0 +1,6 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsAid extends IWsNotificationEvent
{
aid: number
}

View File

@ -0,0 +1,7 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsAidNickname extends IWsNotificationEvent
{
aid: number
Nickname: string
}

View File

@ -0,0 +1,10 @@
import { Message } from "@spt-aki/models/eft/profile/IAkiProfile";
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
import { IGroupCharacter } from "../match/IGroupCharacter";
export interface IWsChatMessageReceived extends IWsNotificationEvent
{
dialogId: string
message: Message
profiles?: IGroupCharacter[]
}

View File

@ -0,0 +1,6 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsGroupId extends IWsNotificationEvent
{
groupId: string
}

View File

@ -0,0 +1,7 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
import { IGroupCharacter } from "../match/IGroupCharacter";
export interface IWsGroupMatchInviteAccept extends IWsNotificationEvent, IGroupCharacter
{
}

View File

@ -0,0 +1,7 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsGroupMatchInviteDecline extends IWsNotificationEvent
{
aid: number
Nickname: string
}

View File

@ -0,0 +1,9 @@
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsGroupMatchInviteSend extends IWsNotificationEvent
{
requestId: string
from: number
members: IGroupCharacter[]
}

View File

@ -0,0 +1,6 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsGroupMatchLeaderChanged extends IWsNotificationEvent
{
owner: number
}

View File

@ -0,0 +1,7 @@
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsGroupMatchRaidReady extends IWsNotificationEvent
{
extendedProfile: IGroupCharacter
}

View File

@ -0,0 +1,7 @@
import { IRaidSettings } from "@spt-aki/models/eft/match/IRaidSettings";
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsGroupMatchRaidSettings extends IWsNotificationEvent
{
raidSettings: IRaidSettings
}

View File

@ -0,0 +1,5 @@
export interface IWsNotificationEvent
{
type: string
eventId: string
}

View File

@ -0,0 +1,6 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsPing extends IWsNotificationEvent
{
}

View File

@ -0,0 +1,8 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
export interface IWsRagfairOfferSold extends IWsNotificationEvent
{
offerId: string
count: number
handbookId: string
}

View File

@ -0,0 +1,20 @@
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
import { ProfileStatus } from "@spt-aki/models/enums/ProfileStatus";
import { RaidMode } from "@spt-aki/models/enums/RaidMode";
export interface IWsUserConfirmed extends IWsNotificationEvent
{
profileid: string
profileToken: string
status: ProfileStatus
ip: string
port: number
sid: string
version: string
location: string
raidMode: RaidMode
mode: string
shortId: string
// eslint-disable-next-line @typescript-eslint/naming-convention
additional_info: any[]
}

View File

@ -0,0 +1,5 @@
export enum DateTime
{
CURR = "CURR",
PAST = "PAST",
}

View File

@ -0,0 +1,29 @@
export enum NotificationEventType
{
RAGFAIR_OFFER_SOLD = "RagfairOfferSold",
RAGFAIR_RATING_CHANGE = "RagfairRatingChange",
CHAT_MESSAGE_RECEIVED = "new_message",
PING = "ping",
TRADER_SUPPLY = "TraderSupply",
TRADER_STANDING = "TraderStanding",
UNLOCK_TRADER = "UnlockTrader",
GROUP_MATCH_RAID_SETTINGS = "groupMatchRaidSettings",
GROUP_MATCH_RAID_NOT_READY = "groupMatchRaidNotReady",
GROUP_MATCH_RAID_READY = "groupMatchRaidReady",
GROUP_MATCH_INVITE_ACCEPT = "groupMatchInviteAccept",
GROUP_MATCH_INVITE_DECLINE = "groupMatchInviteDecline",
GROUP_MATCH_INVITE_SEND = "groupMatchInviteSend",
GROUP_MATCH_LEADER_CHANGED = "groupMatchLeaderChanged",
GROUP_MATCH_START_GAME = "groupMatchStartGame",
GROUP_MATCH_USER_LEAVE = "groupMatchUserLeave",
GROUP_MATCH_WAS_REMOVED = "groupMatchWasRemoved",
GROUP_MATCH_USER_BAD_VERSION = "groupMatchUserHasBadVersion",
USER_CONFIRMED = "userConfirmed",
CHANNEL_DELETED = "channel_deleted",
FRIEND_LIST_REQUEST_ACCEPTED = "friendListRequestAccept",
FRIEND_LIST_REQUEST_DECLINED = "friendListRequestDecline",
FRIEND_LIST_NEW_REQUEST = "friendListNewRequest",
FRIEND_LIST_REMOVED_FROM_FRIEND_LIST = "youAreRemovedFromFriendList",
YOU_ARE_ADDED_TO_IGNORE_LIST = "YouWereAddedToIgnoreList",
YOU_ARE_REMOVED_FROM_IGNORE_LIST = "youAreRemoveFromIgnoreList",
}

View File

@ -0,0 +1,6 @@
export enum PlayersSpawnPlace
{
SAME_PLACE = "SamePlace",
DIFFERENT_PLACES = "DifferentPlaces",
AT_THE_ENDS_OF_THE_MAP = "AtTheEndsOfTheMap",
}

View File

@ -0,0 +1,8 @@
export enum ProfileStatus
{
FREE = "Free",
MATCH_WAIT = "MatchWait",
BUSY = "Busy",
LEAVING = "Leaving",
TRANSFER = "Transfer",
}

View File

@ -1,6 +1,7 @@
export enum BotAmount
{
AS_ONLINE = "AsOnline",
NO_BOTS = "NoBots",
LOW = "Low",
MEDIUM = "Medium",
HIGH = "High",

View File

@ -0,0 +1,9 @@
export enum CloudinessType
{
CLEAR = "Clear",
PARTLY_CLOUDY = "PartlyCloudy",
CLOUDY = "Cloudy",
CLOUDY_WITH_GAPS = "CloudyWithGaps",
HEAVY_CLOUD_COVER = "HeavyCloudCover",
THUNDER_CLOUD = "Thundercloud",
}

View File

@ -0,0 +1,8 @@
export enum FogType
{
NO_FOG = "NoFog",
FAINT = "Faint",
FOG = "Fog",
HEAVY = "Heavy",
CONTINUOUS = "Continuous",
}

View File

@ -0,0 +1,8 @@
export enum RainType
{
NO_RAIN = "NoRain",
DRIZZLING = "Drizzling",
RAIN = "Rain",
HEAVY = "Heavy",
SHOWER = "Shower",
}

View File

@ -0,0 +1,11 @@
export enum TimeFlowType
{
X0 = "x0",
X0_14 = "x0_14",
X0_25 = "x0_25",
X0_5 = "x0_5",
X1 = "x1",
X2 = "x2",
X4 = "x4",
X8 = "x8",
}

View File

@ -0,0 +1,8 @@
export enum WindSpeed
{
LIGHT = "Light",
MODERATE = "Moderate",
STRONG = "Strong",
VERY_STRONG = "VeryStrong",
HURRICANE = "Hurricane",
}

View File

@ -0,0 +1,6 @@
export enum SideType
{
PMC = "Pmc",
SAVAGE = "Savage",
RANDOM = "Random",
}

View File

@ -4,10 +4,10 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGroupCurrentResponse } from "@spt-aki/models/eft/match/IGroupCurrentResponse";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
import { IMatchGroupCurrentResponse } from "@spt-aki/models/eft/match/IMatchGroupCurrentResponse";
import { IMatchGroupStatusResponse } from "@spt-aki/models/eft/match/IMatchGroupStatusResponse";
import { IProfileStatusResponse } from "@spt-aki/models/eft/match/IProfileStatusResponse";
@injectable()
export class MatchStaticRouter extends StaticRouter
@ -41,7 +41,7 @@ export class MatchStaticRouter extends StaticRouter
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IJoinMatchResult>> =>
): Promise<IGetBodyResponseData<IProfileStatusResponse>> =>
{
return this.matchCallbacks.joinMatch(url, info, sessionID);
},
@ -84,7 +84,7 @@ export class MatchStaticRouter extends StaticRouter
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IGetGroupStatusResponse>> =>
): Promise<IGetBodyResponseData<IMatchGroupStatusResponse>> =>
{
return this.matchCallbacks.getGroupStatus(url, info, sessionID);
},
@ -96,7 +96,7 @@ export class MatchStaticRouter extends StaticRouter
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IJoinMatchResult>> =>
): Promise<IGetBodyResponseData<IProfileStatusResponse>> =>
{
return this.matchCallbacks.joinMatch(url, info, sessionID);
},
@ -115,7 +115,7 @@ export class MatchStaticRouter extends StaticRouter
info: IEmptyRequestData,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IGroupCurrentResponse>> =>
): Promise<IGetBodyResponseData<IMatchGroupCurrentResponse>> =>
{
return this.matchCallbacks.groupCurrent(url, info, sessionID);
},
@ -153,7 +153,7 @@ export class MatchStaticRouter extends StaticRouter
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IAcceptGroupInviteResponse[]>> =>
): Promise<IGetBodyResponseData<IGroupCharacter[]>> =>
{
return this.matchCallbacks.acceptGroupInvite(url, info, sessionID);
},

View File

@ -3,8 +3,9 @@ import { inject, injectable } from "tsyringe";
import WebSocket from "ws";
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper";
import { INotification, NotificationType } from "@spt-aki/models/eft/notifier/INotifier";
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { NotificationEventType } from "@spt-aki/models/enums/NotificationEventType";
import { IHttpConfig } from "@spt-aki/models/spt/config/IHttpConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
@ -29,7 +30,7 @@ export class WebSocketServer
}
protected httpConfig: IHttpConfig;
protected defaultNotification: INotification = { type: NotificationType.PING, eventId: "ping" };
protected defaultNotification: IWsNotificationEvent = { type: NotificationEventType.PING, eventId: "ping" };
protected webSocketServer: WebSocket.Server;
protected webSockets: Record<string, WebSocket.WebSocket> = {};
@ -62,7 +63,7 @@ export class WebSocketServer
this.webSocketServer.addListener("connection", this.wsOnConnection.bind(this));
}
public sendMessage(sessionID: string, output: INotification): void
public sendMessage(sessionID: string, output: IWsNotificationEvent): void
{
try
{

View File

@ -1,5 +1,4 @@
import { inject, injectable } from "tsyringe";
import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";

View File

@ -85,8 +85,7 @@ export class ModCompilerService
protected async compile(fileNames: string[], options: ts.CompilerOptions): Promise<void>
{
// C:/snapshot/project || /snapshot/project
const baseDir: string = __dirname.replace(/\\/g, "/").split("/").slice(0, 3)
.join("/");
const baseDir: string = __dirname.replace(/\\/g, "/").split("/").slice(0, 3).join("/");
for (const filePath of fileNames)
{
@ -140,7 +139,7 @@ export class ModCompilerService
*/
protected areFilesReady(fileNames: string[]): boolean
{
return fileNames.filter(x => !this.vfs.exists(x.replace(".ts", ".js"))).length === 0;
return fileNames.filter((x) => !this.vfs.exists(x.replace(".ts", ".js"))).length === 0;
}
/**
@ -150,6 +149,6 @@ export class ModCompilerService
*/
protected delay(ms: number): Promise<unknown>
{
return new Promise(resolve => setTimeout(resolve, ms));
return new Promise((resolve) => setTimeout(resolve, ms));
}
}

View File

@ -1,5 +1,5 @@
import { injectable } from "tsyringe";
import { INotification } from "@spt-aki/models/eft/notifier/INotifier";
import { IWsNotificationEvent } from "@spt-aki/models/eft/ws/IWsNotificationEvent";
@injectable()
export class NotificationService
@ -37,7 +37,7 @@ export class NotificationService
/**
* Add message to queue
*/
public add(sessionID: string, message: INotification): void
public add(sessionID: string, message: IWsNotificationEvent): void
{
this.get(sessionID).push(message);
}