feat(headset desc)
This commit is contained in:
parent
86b601f012
commit
af5fcc9115
6 changed files with 2478 additions and 0 deletions
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
[
|
||||||
|
["5e4d34ca86f774264f758330", 59, 55],
|
||||||
|
["6033fa48ffd42c541047f728", 64, 55],
|
||||||
|
["5aa2ba71e5b5b000137b758f", 66, 54],
|
||||||
|
["5c165d832e2216398b5a7e36", 66, 56],
|
||||||
|
["5645bcc04bdc2d363b8b4572", 66, 54],
|
||||||
|
["5f60cd6cf2bcbb675b00dac6", 66, 55],
|
||||||
|
["5a16b9fffcdbcb0176308b34", 67, 57],
|
||||||
|
["5b432b965acfc47a8774094e", 67, 50],
|
||||||
|
["628e4e576d783146b124c64d", 69, 57],
|
||||||
|
["66b5f68de98be930d701c00e", 70, 57],
|
||||||
|
["66b5f6985891c84aab75ca76", 71, 59],
|
||||||
|
["66b5f693acff495a294927e3", 71, 57],
|
||||||
|
["66b5f69ea7f72d197e70bcdb", 71, 57],
|
||||||
|
["66b5f6a28ca68c6461709ed8", 71, 59]
|
||||||
|
]
|
||||||
2272
user/mods/redlaser42- Better Headset Descriptions/package-lock.json
generated
Normal file
2272
user/mods/redlaser42- Better Headset Descriptions/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"name": "Better Headset Descriptions",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"sptVersion": "~3.11",
|
||||||
|
"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": "redlaser42",
|
||||||
|
"contributors": [],
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
44
user/mods/redlaser42- Better Headset Descriptions/src/mod.ts
Normal file
44
user/mods/redlaser42- Better Headset Descriptions/src/mod.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
|
import { IPostDBLoadMod } from "@spt/models/external/IPostDBLoadMod";
|
||||||
|
import { DatabaseServer } from "@spt/servers/DatabaseServer";
|
||||||
|
import { IDatabaseTables } from "@spt/models/spt/server/IDatabaseTables";
|
||||||
|
import { ItemHelper } from "@spt/helpers/ItemHelper";
|
||||||
|
import { BaseClasses } from "@spt/models/enums/BaseClasses";
|
||||||
|
import { LocaleService } from "@spt/services/LocaleService.d"
|
||||||
|
import { FileSystemSync } from "@spt/utils/FileSystemSync";
|
||||||
|
import { jsonc } from "jsonc";
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
|
class Mod implements IPostDBLoadMod
|
||||||
|
{
|
||||||
|
public postDBLoad(container: DependencyContainer): void {
|
||||||
|
const LocaleHelper = container.resolve<LocaleService>("LocaleService");
|
||||||
|
const locale: LocaleService = LocaleHelper.getDesiredGameLocale();
|
||||||
|
const localeDB: Record<string, string> = LocaleHelper.getLocaleDb();
|
||||||
|
const fileSystem = container.resolve<FileSystemSync>("FileSystemSync");
|
||||||
|
|
||||||
|
//Config Variables
|
||||||
|
const hearingColor = "#598559";
|
||||||
|
const ambientColor = "#f59542";
|
||||||
|
//load config file
|
||||||
|
const headsetConfigs: [string, number, number][] = jsonc.parse(fileSystem.read(path.resolve(__dirname, "../config/headset-config.json")));
|
||||||
|
|
||||||
|
//Update function
|
||||||
|
const headsetDescUpdate = (itemID: string, Hearing: number, Ambient: number): void => {
|
||||||
|
const headsetDesc = localeDB[`${itemID} Description`];
|
||||||
|
const headsetDescNew = headsetDesc +
|
||||||
|
`\n\n <color=${hearingColor}>Rated Hearing Distance: ${Hearing} meters</color>\n` +
|
||||||
|
` <color=${ambientColor}>Ambient Noise Canceling: -${Ambient}db</color>`;
|
||||||
|
localeDB[`${itemID} Description`] = headsetDescNew;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop and apply
|
||||||
|
for (const [itemID, hearing, ambient] of headsetConfigs) {
|
||||||
|
headsetDescUpdate(itemID, hearing, ambient);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const mod = new Mod();
|
||||||
|
|
@ -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"],
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue