Inital release of mod
This commit is contained in:
commit
5f4286215a
9
.eslintignore
Normal file
9
.eslintignore
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Exclude these folders from linting
|
||||||
|
node_modules
|
||||||
|
dist/
|
||||||
|
types/
|
||||||
|
|
||||||
|
# Exclude these filetypes from linting
|
||||||
|
*.json
|
||||||
|
*.txt
|
||||||
|
*.exe
|
75
.eslintrc.json
Normal file
75
.eslintrc.json
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
12
mod.code-workspace
Normal file
12
mod.code-workspace
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extensions": {
|
||||||
|
"recommendations": [
|
||||||
|
"dbaeumer.vscode-eslint"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
2310
package-lock.json
generated
Normal file
2310
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
package.json
Normal file
20
package.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "Chomps UwUifier",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "src/mod.js",
|
||||||
|
"license": "See License file",
|
||||||
|
"author": "Chomp Kekw",
|
||||||
|
"akiVersion": "3.5.*",
|
||||||
|
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "16.18.10",
|
||||||
|
"@typescript-eslint/eslint-plugin": "5.46.1",
|
||||||
|
"@typescript-eslint/parser": "5.46.1",
|
||||||
|
"bestzip": "2.2.1",
|
||||||
|
"eslint": "8.30.0",
|
||||||
|
"fs-extra": "11.1.0",
|
||||||
|
"glob": "8.0.3",
|
||||||
|
"tsyringe": "4.7.0",
|
||||||
|
"typescript": "4.9.4"
|
||||||
|
}
|
||||||
|
}
|
101
src/mod.js
Normal file
101
src/mod.js
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
class Mod {
|
||||||
|
postDBLoad(container) {
|
||||||
|
const DatabaseServer = container.resolve("DatabaseServer");
|
||||||
|
const logger = container.resolve("WinstonLogger");
|
||||||
|
const database = DatabaseServer.getTables();
|
||||||
|
const enlocale = database.locales.global.en;
|
||||||
|
const bearNames = database.bots.types.bear.firstName;
|
||||||
|
const usecNames = database.bots.types.usec.firstName;
|
||||||
|
for (const index in bearNames) {
|
||||||
|
bearNames[index] += "-Chan";
|
||||||
|
}
|
||||||
|
const replacementtable = {
|
||||||
|
"\n": "\n",
|
||||||
|
"\r": "\r",
|
||||||
|
" L": " L",
|
||||||
|
"L ": "L ",
|
||||||
|
"L": "W",
|
||||||
|
"Aw": "Aw",
|
||||||
|
"Tw": "Tw",
|
||||||
|
// " W": " W",
|
||||||
|
// "W": "R",
|
||||||
|
"r ": "r ",
|
||||||
|
" R": " W",
|
||||||
|
" r": " w",
|
||||||
|
"R": "W",
|
||||||
|
"r": "w",
|
||||||
|
"Ab": "Awb",
|
||||||
|
"Ac": "Awc",
|
||||||
|
// "Ad": "Adw",
|
||||||
|
"Ae": "Aw",
|
||||||
|
"Af": "Awf",
|
||||||
|
"Ag": "Agw",
|
||||||
|
"Aj": "Awj",
|
||||||
|
"Ak": "Awk",
|
||||||
|
"Am": "Awm",
|
||||||
|
"An": "Awn",
|
||||||
|
"Ap": "Awp",
|
||||||
|
"Aq": "Awq",
|
||||||
|
// "Ar": "Awr",
|
||||||
|
"Av": "Awv",
|
||||||
|
"Ax": "Awx",
|
||||||
|
"Ue": "Uwe",
|
||||||
|
"Your": "Y-Y-Youw",
|
||||||
|
"You": "UwU",
|
||||||
|
"OO": "OwO",
|
||||||
|
"With": "Wiff"
|
||||||
|
};
|
||||||
|
for (let i in replacementtable) {
|
||||||
|
replacementtable[i.toLowerCase()] = replacementtable[i].toLowerCase();
|
||||||
|
replacementtable[i.toUpperCase()] = replacementtable[i].toUpperCase();
|
||||||
|
}
|
||||||
|
for (const index in usecNames) {
|
||||||
|
usecNames[index] = this.uwuify(usecNames[index], replacementtable, logger);
|
||||||
|
usecNames[index] += "-Chan";
|
||||||
|
}
|
||||||
|
const blacklist = [];
|
||||||
|
for (const localekey in enlocale) {
|
||||||
|
if (blacklist.includes(localekey)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const value = enlocale[localekey];
|
||||||
|
if (value.includes("/color")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (value.includes("{onlyfoundinraid}")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (value.includes("{durability}")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (value.includes("CHARACTER")) {
|
||||||
|
enlocale[localekey] = "CHAWAWCTER ^-^";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (value.includes("Attention! This is a Beta version of Escape from Tarkov.")) {
|
||||||
|
// SHOULD BE IMPROVED
|
||||||
|
enlocale[localekey] = "Attention?!?! *looks at you* This is a Beta vewsion of Escawpe fwom Tawkov";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
enlocale[localekey] = this.uwuify(value, replacementtable, logger);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uwuify(stringtouwuify, replacementtable, logger) {
|
||||||
|
if (stringtouwuify === "") {
|
||||||
|
return stringtouwuify;
|
||||||
|
}
|
||||||
|
var re = new RegExp(Object.keys(replacementtable).join("|"), "gi");
|
||||||
|
const string = stringtouwuify.replace(re, function (matched) {
|
||||||
|
const replacement = replacementtable[matched];
|
||||||
|
if (!replacement) {
|
||||||
|
//logger.error(`Could not find replacement for ${matched}`); Catching Error
|
||||||
|
return matched;
|
||||||
|
}
|
||||||
|
return replacementtable[matched];
|
||||||
|
});
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = { mod: new Mod() };
|
132
src/mod.ts
Normal file
132
src/mod.ts
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
import type { IPostDBLoadMod } from "@spt-aki/models/external/IPostDBLoadMod";
|
||||||
|
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
|
||||||
|
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
||||||
|
import { DependencyContainer } from "tsyringe";
|
||||||
|
|
||||||
|
class Mod implements IPostDBLoadMod
|
||||||
|
{
|
||||||
|
public postDBLoad(container: DependencyContainer): void
|
||||||
|
{
|
||||||
|
const DatabaseServer: DatabaseServer = container.resolve<DatabaseServer>("DatabaseServer");
|
||||||
|
const logger = container.resolve<ILogger>("WinstonLogger");
|
||||||
|
const database = DatabaseServer.getTables();
|
||||||
|
const enlocale = database.locales.global.en;
|
||||||
|
|
||||||
|
const bearNames = database.bots.types.bear.firstName
|
||||||
|
const usecNames = database.bots.types.usec.firstName
|
||||||
|
|
||||||
|
for (const index in bearNames)
|
||||||
|
{
|
||||||
|
bearNames[index] += "-Chan"
|
||||||
|
}
|
||||||
|
|
||||||
|
const replacementtable =
|
||||||
|
{
|
||||||
|
"\n": "\n",
|
||||||
|
"\r": "\r",
|
||||||
|
" L": " L",
|
||||||
|
"L ": "L ",
|
||||||
|
"L": "W",
|
||||||
|
"Aw": "Aw",
|
||||||
|
"Tw": "Tw",
|
||||||
|
// " W": " W",
|
||||||
|
// "W": "R",
|
||||||
|
"r ": "r ",
|
||||||
|
" R": " W",
|
||||||
|
" r": " w",
|
||||||
|
"R": "W",
|
||||||
|
"r": "w",
|
||||||
|
"Ab": "Awb",
|
||||||
|
"Ac": "Awc",
|
||||||
|
// "Ad": "Adw",
|
||||||
|
"Ae": "Aw",
|
||||||
|
"Af": "Awf",
|
||||||
|
"Ag": "Agw",
|
||||||
|
"Aj": "Awj",
|
||||||
|
"Ak": "Awk",
|
||||||
|
"Am": "Awm",
|
||||||
|
"An": "Awn",
|
||||||
|
"Ap": "Awp",
|
||||||
|
"Aq": "Awq",
|
||||||
|
// "Ar": "Awr",
|
||||||
|
"Av": "Awv",
|
||||||
|
"Ax": "Awx",
|
||||||
|
"Ue": "Uwe",
|
||||||
|
"Your": "Y-Y-Youw",
|
||||||
|
"You": "UwU",
|
||||||
|
"OO": "OwO",
|
||||||
|
"With": "Wiff"
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i in replacementtable)
|
||||||
|
{
|
||||||
|
replacementtable[i.toLowerCase()] = replacementtable[i].toLowerCase()
|
||||||
|
replacementtable[i.toUpperCase()] = replacementtable[i].toUpperCase()
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const index in usecNames)
|
||||||
|
{
|
||||||
|
usecNames[index]= this.uwuify(usecNames[index], replacementtable, logger)
|
||||||
|
|
||||||
|
usecNames[index] += "-Chan"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const blacklist = []
|
||||||
|
for (const localekey in enlocale)
|
||||||
|
{
|
||||||
|
if (blacklist.includes(localekey))
|
||||||
|
{
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const value = enlocale[localekey];
|
||||||
|
if (value.includes("/color"))
|
||||||
|
{
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (value.includes("{onlyfoundinraid}"))
|
||||||
|
{
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (value.includes("{durability}"))
|
||||||
|
{
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (value.includes("CHARACTER"))
|
||||||
|
{
|
||||||
|
enlocale[localekey] = "CHAWAWCTER ^-^"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (value.includes("Attention! This is a Beta version of Escape from Tarkov."))
|
||||||
|
{
|
||||||
|
// SHOULD BE IMPROVED
|
||||||
|
enlocale[localekey] = "Attention?!?! *looks at you* This is a Beta vewsion of Escawpe fwom Tawkov"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
enlocale[localekey] = this.uwuify(value, replacementtable, logger)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private uwuify(stringtouwuify: string, replacementtable, logger: ILogger): string
|
||||||
|
{
|
||||||
|
if (stringtouwuify === "")
|
||||||
|
{
|
||||||
|
return stringtouwuify
|
||||||
|
}
|
||||||
|
var re = new RegExp(Object.keys(replacementtable).join("|"),"gi");
|
||||||
|
const string = stringtouwuify.replace(re, function(matched)
|
||||||
|
{
|
||||||
|
const replacement = replacementtable[matched]
|
||||||
|
if (!replacement)
|
||||||
|
{
|
||||||
|
//logger.error(`Could not find replacement for ${matched}`); Catching Error
|
||||||
|
return matched
|
||||||
|
}
|
||||||
|
return replacementtable[matched];
|
||||||
|
})
|
||||||
|
return string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { mod: new Mod() }
|
25
tsconfig.json
Normal file
25
tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"module": "CommonJS",
|
||||||
|
"target": "es2020",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"downlevelIteration": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"outDir": "tmp",
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@spt-aki/*": ["./types/*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lib": [
|
||||||
|
"es2020"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"src/*",
|
||||||
|
"src/**/*"
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user