157 lines
6.3 KiB
TypeScript
157 lines
6.3 KiB
TypeScript
/* eslint-disable @typescript-eslint/brace-style */
|
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
import type { DependencyContainer } from "tsyringe";
|
|
|
|
import type { ILogger } from "@spt/models/spt/utils/ILogger";
|
|
|
|
import type { ItemHelper } from "@spt/helpers/ItemHelper";
|
|
import type { ConfigServer } from "@spt/servers/ConfigServer";
|
|
import type { DatabaseServer } from "@spt/servers/DatabaseServer";
|
|
import type { IDatabaseTables } from "@spt/models/spt/server/IDatabaseTables";
|
|
import type { IPostDBLoadMod } from "@spt/models/external/IPostDBLoadMod";
|
|
|
|
import { BaseClasses } from "@spt/models/enums/BaseClasses";
|
|
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
|
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
|
import { Traders } from "@spt/models/enums/Traders";
|
|
import type { IBotConfig } from "@spt/models/spt/config/IBotConfig";
|
|
import type { IPmcConfig } from "@spt/models/spt/config/IPmcConfig";
|
|
import type { IHideoutConfig } from "@spt/models/spt/config/IHideoutConfig";
|
|
import type { ILocationConfig } from "@spt/models/spt/config/ILocationConfig";
|
|
|
|
class Mod implements IPostDBLoadMod {
|
|
private logger: ILogger;
|
|
|
|
private itemHelper: ItemHelper;
|
|
|
|
private dbServer: DatabaseServer;
|
|
private dbTables: IDatabaseTables;
|
|
|
|
private configServer: ConfigServer;
|
|
private iBotConfig: IBotConfig;
|
|
private iPmcConfig: IPmcConfig;
|
|
private iHideoutConfig: IHideoutConfig;
|
|
private iLocationConfig: ILocationConfig;
|
|
|
|
public postDBLoad(container: DependencyContainer): void {
|
|
this.logger = container.resolve<ILogger>("WinstonLogger");
|
|
this.itemHelper = container.resolve<ItemHelper>("ItemHelper");
|
|
this.configServer = container.resolve<ConfigServer>("ConfigServer");
|
|
this.dbServer = container.resolve<DatabaseServer>("DatabaseServer");
|
|
this.dbTables = this.dbServer.getTables();
|
|
this.iBotConfig = this.configServer.getConfig(ConfigTypes.BOT);
|
|
this.iPmcConfig = this.configServer.getConfig(ConfigTypes.PMC);
|
|
this.iHideoutConfig = this.configServer.getConfig(ConfigTypes.HIDEOUT);
|
|
this.iLocationConfig = this.configServer.getConfig(ConfigTypes.LOCATION);
|
|
|
|
// this.removePmcBackpackLoot(); // handled by LootingBots
|
|
this.nerfScavLoot();
|
|
this.improveHideout();
|
|
this.disableFleaMarket();
|
|
this.buffLoot();
|
|
this.multiplyWeaponSkillProgressionRate(2);
|
|
this.removeTraderLimits();
|
|
}
|
|
|
|
private nerfScavLoot() {
|
|
const scav = this.dbTables.bots.types["assault"];
|
|
|
|
scav.inventory.items.Pockets[ItemTpl.CONTAINER_GINGY_KEYCHAIN] = 4; // Gingy, def. 52
|
|
scav.inventory.items.Pockets[ItemTpl.CONTAINER_WZ_WALLET] = 2; // WZ, def. 43
|
|
scav.inventory.items.Pockets[ItemTpl.CONTAINER_SIMPLE_WALLET] = 15; // Wallet, def. 193
|
|
scav.inventory.items.Pockets[ItemTpl.DRUGS_VASELINE_BALM] = 1; // Vaseline, def. 15
|
|
scav.inventory.items.Pockets[ItemTpl.DRUGS_IBUPROFEN_PAINKILLERS] = 2; // Ibuprofen, def. 21
|
|
|
|
scav.generation.items.pocketLoot.weights = {
|
|
"0": 4,
|
|
"1": 10,
|
|
"2": 2,
|
|
"3": 1
|
|
};
|
|
scav.generation.items.backpackLoot.weights = {
|
|
"0": 10,
|
|
"1": 10,
|
|
"2": 1
|
|
};
|
|
scav.generation.items.grenades.weights = { "0": 7, "1": 1 };
|
|
scav.generation.items.currency.weights = { "0": 5, "1": 1 };
|
|
scav.generation.items.drugs.weights = { "0": 8, "1": 1 };
|
|
scav.generation.items.stims.weights = { "0": 40, "1": 1 };
|
|
scav.generation.items.healing.weights = { "0": 7, "1": 10, "2": 1 };
|
|
|
|
// make keys less likely
|
|
for (const item in scav.inventory.items.Backpack) {
|
|
if (!this.itemHelper.isOfBaseclass(item, BaseClasses.KEY)) {
|
|
scav.inventory.items.Backpack[item] *= 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
private removePmcBackpackLoot() {
|
|
this.iPmcConfig.looseWeaponInBackpackChancePercent = 0;
|
|
|
|
const usec = this.dbTables.bots.types["usec"];
|
|
usec.generation.items.backpackLoot.weights = { "0": 1, "1": 0 };
|
|
usec.generation.items.pocketLoot.weights = { "0": 1, "1": 0 };
|
|
usec.generation.items.vestLoot.weights = { "0": 1, "1": 0 };
|
|
|
|
const bear = this.dbTables.bots.types["bear"];
|
|
bear.generation.items.backpackLoot.weights = { "0": 1, "1": 0 };
|
|
bear.generation.items.pocketLoot.weights = { "0": 1, "1": 0 };
|
|
bear.generation.items.vestLoot.weights = { "0": 1, "1": 0 };
|
|
|
|
const pmcRnd = this.iBotConfig.equipment["pmc"].randomisation;
|
|
for (let i = 0; i < pmcRnd.length; i++) {
|
|
if (pmcRnd[i].generation) {
|
|
delete pmcRnd[i].generation["backpackLoot"];
|
|
delete pmcRnd[i].generation["pocketLoot"];
|
|
delete pmcRnd[i].generation["vestLoot"];
|
|
}
|
|
}
|
|
}
|
|
|
|
private improveHideout() {
|
|
this.iHideoutConfig.overrideBuildTimeSeconds = 0;
|
|
}
|
|
|
|
private disableFleaMarket() {
|
|
this.dbTables.globals.config.RagFair.minUserLevel = 69;
|
|
}
|
|
|
|
private removeTraderLimits() {
|
|
const traders = this.dbTables.traders;
|
|
for (const trader in traders) {
|
|
if (trader !== "ragfair" && trader !== Traders.LIGHTHOUSEKEEPER) {
|
|
for (const level in traders[trader].assort.items) {
|
|
if (traders[trader].assort.items[level].upd !== undefined && traders[trader].assort.items[level].upd["BuyRestrictionMax"] !== undefined) {
|
|
delete traders[trader].assort.items[level].upd["BuyRestrictionMax"];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private buffLoot() {
|
|
this.iLocationConfig.looseLootMultiplier.rezervbase = 3.3;
|
|
|
|
const staticX = 1.2;
|
|
const looseX = 1.2;
|
|
|
|
for (const i in this.iLocationConfig.staticLootMultiplier) {
|
|
this.iLocationConfig.staticLootMultiplier[i] *= staticX;
|
|
}
|
|
|
|
for (const i in this.iLocationConfig.looseLootMultiplier) {
|
|
this.iLocationConfig.looseLootMultiplier[i] *= looseX;
|
|
}
|
|
}
|
|
|
|
private multiplyWeaponSkillProgressionRate(x: number) {
|
|
if (x !== 1) {
|
|
this.dbTables.globals.config.SkillsSettings.WeaponSkillProgressRate *= x;
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = { mod: new Mod() };
|