v1.6.0 Release Ready.

v1.6.0 Changelog
* Compatible with SPT-Aki v3.2.2
* Updated Readme with new features.
* Combined armorPlusArmorVests into removeGearRestrictions so that it now removes all gear restrictions. Located in config/armor.json
* Adjusted PMC Difficulty Weights to be 0/40/30/30 by default. Located in config/bots.json
* Removed Remove Backpack Filter. Located in config/items.json
* Added Remove Backpack, Container, In Raid Items, and Secured Container Restrictions. Located in config/items.json
* Added the ability to adjust the time it takes to examine items. Located in config/items.json/examineTime
* Added the ability to enable/disable updateTime for traders. Located in config/traders.json If you have custom traders they will need to be added to the updateTime array (Simply copy/paste one of the lines including the {} and add in the traderId for your custom trader.)
* Fixed logic for Fence blacklist because JS sucks /s. Located in config/traders.json
* Cleaned up armor.ts code and moved a lot of the armor materials to their own individual functions.
* Fixed types in items.ts, and cleaned up a lot of functions, and general code.
This commit is contained in:
VforValens 2022-09-05 17:31:19 -04:00
parent 49cdcbc984
commit 2881aebf53
12 changed files with 275 additions and 123 deletions

Binary file not shown.

View File

@ -1,5 +1,5 @@
{
"armorPlusArmorVests": false,
"removeGearRestrictions": false,
"armorMaterials":
{

View File

@ -48,9 +48,9 @@
"weights":
{
"easy": 0,
"normal": 60,
"hard": 20,
"impossible": 20
"normal": 40,
"hard": 30,
"impossible": 30
}
},

View File

@ -24,10 +24,18 @@
},
"examinedByDefault": false,
"removeBackpackFilter": true,
"examineTime":
{
"enabled": false,
"examineTime": 1
},
"removeBackpacksRestrictions": true,
"removeContainersRestrictions": true,
"removeDiscardLimit": true,
"removeItemRestrictions": false,
"removeKeyUsageMax": false,
"removeInRaidItemRestrictions": true,
"removeKeyUsageMax": true,
"removeSecureContainersRestrictions": true,
"roublesMaxStack": 500000,
"dollarsMaxStack": 50000,
"eurosMaxStack": 50000,

View File

@ -1,5 +1,8 @@
{
"updateTime": [
"updateTime":
{
"enabled": false,
"updateTime": [
{
"traderId": "54cb50c76803fa8b248b4571",
"seconds": 3600
@ -35,23 +38,24 @@
{
"traderId": "ragfair",
"seconds": 3600
}
],
}]
},
"minDurabilityForSale": 60,
"traderPriceMultipler": 1,
"minDurabilityForSale": 60,
"fence": {
"fence":
{
"partialRefreshTimeSeconds": 240,
"partialRefreshChangePercent": 15,
"assortSize": 100,
"maxPresetsPercent": 5,
"presetPriceMult": 2.5,
"blacklist": [
"5661632d4bdc2d903d8b456b",
"543be5e94bdc2df1348b4568",
"543be6674bdc2df1348b4569",
"5448bf274bdc2dfc2f8b456a",
"543be5664bdc2dd4348b4569",
"5447bedf4bdc2d87278b4568"]}
"blacklist": ["5661632d4bdc2d903d8b456b",
"543be5e94bdc2df1348b4568",
"543be6674bdc2df1348b4569",
"5448bf274bdc2dfc2f8b456a",
"543be5664bdc2dd4348b4569",
"5447bedf4bdc2d87278b4568"]
}
}

View File

@ -1,6 +1,6 @@
export interface ArmorConfig
{
armorPlusArmorVests: boolean
removeGearRestrictions: boolean
armorMaterials: Armor
}

View File

@ -5,16 +5,25 @@ export interface ItemsConfig
escapeStash: Stash
eodStash: Stash
examinedByDefault: boolean
removeBackpackFilter: boolean
examineTime: ExamineTime
removeBackpacksRestrictions: boolean
removeContainersRestrictions: boolean
removeDiscardLimit: boolean
removeItemRestrictions: boolean
removeInRaidItemRestrictions: boolean
removeKeyUsageMax: boolean
removeSecureContainersRestrictions: boolean
dollarsMaxStack: number
eurosMaxStack: number
roublesMaxStack: number
weightModifier: number
}
export interface ExamineTime
{
enabled: boolean
examineTime: number
}
export interface Stash
{
vertical: number

View File

@ -1,16 +1,26 @@
export interface TradersConfig {
updateTime: UpdateTime[];
traderPriceMultipler: number;
export interface TradersConfig
{
updateTime: UpdateTime;
minDurabilityForSale: number;
traderPriceMultipler: number;
fence: FenceConfig;
}
export interface UpdateTime {
export interface UpdateTime
{
enabled: boolean;
updateTime: UpdateTime1[];
}
export interface UpdateTime1
{
traderId: string;
seconds: number;
}
export interface FenceConfig {
export interface FenceConfig
{
partialRefreshTimeSeconds: number;
partialRefreshChangePercent: number;
assortSize: number;

View File

@ -1,6 +1,6 @@
{
"name": "Valens-AIO",
"version": "1.5.2",
"version": "1.6.0",
"main": "src/mod.js",
"license": "CC BY-NC-ND 4.0",
"author": "Valens",

View File

@ -27,113 +27,194 @@ export class Armor
const steel = this.modConfig.armorMaterials.armoredSteel;
const ceramic = this.modConfig.armorMaterials.ceramic;
const glass = this.modConfig.armorMaterials.glass;
const armor = this.tables.getTables().globals.config.ArmorMaterials;
if (mod.armorPlusArmorVests)
if (mod.removeGearRestrictions)
{
const armors = this.tables.getTables().templates.items;
for (const armor in armors)
{
armors[armor]._props.BlocksArmorVest = false;
}
this.removeGearRestrictions();
this.logger.info("Gear Restrictions Removed");
}
if (uhmwpe.destructibility != 0.45 || uhmwpe.minRepairDegradation != 0.01 || uhmwpe.maxRepairDegradation != 0.03
|| uhmwpe.explosionDestructibility != 0.4 || uhmwpe.minRepairKitDegradation != 0.005 || uhmwpe.maxRepairKitDegradation != 0.025)
{
armor.UHMWPE.Destructibility = uhmwpe.destructibility;
armor.UHMWPE.MinRepairDegradation = uhmwpe.minRepairDegradation;
armor.UHMWPE.MaxRepairDegradation = uhmwpe.maxRepairDegradation;
armor.UHMWPE.ExplosionDestructibility = uhmwpe.explosionDestructibility;
armor.UHMWPE.MinRepairKitDegradation = uhmwpe.minRepairKitDegradation;
armor.UHMWPE.MaxRepairKitDegradation = uhmwpe.maxRepairKitDegradation;
this.uhmwpe();
this.logger.info("UHMWPE Armor Materials Patched");
}
if (aramid.destructibility != 0.25 || aramid.minRepairDegradation != 0.03 || aramid.maxRepairDegradation != 0.07
|| aramid.explosionDestructibility != 0.2 || aramid.minRepairKitDegradation != 0.025 || aramid.maxRepairKitDegradation != 0.065)
{
armor.Aramid.Destructibility = aramid.destructibility;
armor.Aramid.MinRepairDegradation = aramid.minRepairDegradation;
armor.Aramid.MaxRepairDegradation = aramid.maxRepairDegradation;
armor.Aramid.ExplosionDestructibility = aramid.explosionDestructibility;
armor.Aramid.MinRepairKitDegradation = aramid.minRepairKitDegradation;
armor.Aramid.MaxRepairKitDegradation = aramid.maxRepairKitDegradation;
this.aramid();
this.logger.info("Aramid Armor Materials Patched");
}
if (combined.destructibility != 0.5 || combined.minRepairDegradation != 0.1 || combined.maxRepairDegradation != 0.15
|| combined.explosionDestructibility != 0.4 || combined.minRepairKitDegradation != 0.009 || combined.maxRepairKitDegradation != 0.014)
{
armor.Combined.Destructibility = combined.destructibility;
armor.Combined.MinRepairDegradation = combined.minRepairDegradation;
armor.Combined.MaxRepairDegradation = combined.maxRepairDegradation;
armor.Combined.ExplosionDestructibility = combined.explosionDestructibility;
armor.Combined.MinRepairKitDegradation = combined.minRepairKitDegradation;
armor.Combined.MaxRepairKitDegradation = combined.maxRepairKitDegradation;
this.combined();
this.logger.info("Combined Armor Materials Patched");
}
if (titan.destructibility != 0.55 || titan.minRepairDegradation != 0.06 || titan.maxRepairDegradation != 0.1
|| titan.explosionDestructibility != 0.5 || titan.minRepairKitDegradation != 0.055 || titan.maxRepairKitDegradation != 0.09)
{
armor.Titan.Destructibility = titan.destructibility;
armor.Titan.MinRepairDegradation = titan.minRepairDegradation;
armor.Titan.MaxRepairDegradation = titan.maxRepairDegradation;
armor.Titan.ExplosionDestructibility = titan.explosionDestructibility;
armor.Titan.MinRepairKitDegradation = titan.minRepairKitDegradation;
armor.Titan.MaxRepairKitDegradation = titan.maxRepairKitDegradation;
this.titan();
this.logger.info("Titan Armor Materials Patched");
}
if (aluminium.destructibility != 0.6 || aluminium.minRepairDegradation != 0.06 || aluminium.maxRepairDegradation != 0.1
|| aluminium.explosionDestructibility != 0.6 || aluminium.minRepairKitDegradation != 0.055 || aluminium.maxRepairKitDegradation != 0.09)
{
armor.Aluminium.Destructibility = aluminium.destructibility;
armor.Aluminium.MinRepairDegradation = aluminium.minRepairDegradation;
armor.Aluminium.MaxRepairDegradation = aluminium.maxRepairDegradation;
armor.Aluminium.ExplosionDestructibility = aluminium.explosionDestructibility;
armor.Aluminium.MinRepairKitDegradation = aluminium.minRepairKitDegradation;
armor.Aluminium.MaxRepairKitDegradation = aluminium.maxRepairKitDegradation;
this.aluminium();
this.logger.info("Aluminium Armor Materials Patched");
}
if (steel.destructibility != 0.7 || steel.minRepairDegradation != 0.01 || steel.maxRepairDegradation != 0.03
|| steel.explosionDestructibility != 0.6 || steel.minRepairKitDegradation != 0.005 || steel.maxRepairKitDegradation != 0.025)
{
armor.ArmoredSteel.Destructibility = steel.destructibility;
armor.ArmoredSteel.MinRepairDegradation = steel.minRepairDegradation;
armor.ArmoredSteel.MaxRepairDegradation = steel.maxRepairDegradation;
armor.ArmoredSteel.ExplosionDestructibility = steel.explosionDestructibility;
armor.ArmoredSteel.MinRepairKitDegradation = steel.minRepairKitDegradation;
armor.ArmoredSteel.MaxRepairKitDegradation = steel.maxRepairKitDegradation;
this.steel();
this.logger.info("Steel Armor Materials Patched");
}
if (ceramic.destructibility != 0.8 || ceramic.minRepairDegradation != 0.17 || ceramic.maxRepairDegradation != 0.22
|| ceramic.explosionDestructibility != 0.7 || ceramic.minRepairKitDegradation != 0.155 || ceramic.maxRepairKitDegradation != 0.2)
{
armor.Ceramic.Destructibility = ceramic.destructibility;
armor.Ceramic.MinRepairDegradation = ceramic.minRepairDegradation;
armor.Ceramic.MaxRepairDegradation = ceramic.maxRepairDegradation;
armor.Ceramic.ExplosionDestructibility = ceramic.explosionDestructibility;
armor.Ceramic.MinRepairKitDegradation = ceramic.minRepairKitDegradation;
armor.Ceramic.MaxRepairKitDegradation = ceramic.maxRepairKitDegradation;
this.ceramic();
this.logger.info("Ceramic Armor Materials Patched");
}
if (glass.destructibility != 0.8 || glass.minRepairDegradation != 0.23 || glass.maxRepairDegradation != 0.42
|| glass.explosionDestructibility != 0.8 || glass.minRepairKitDegradation != 0.21 || glass.maxRepairKitDegradation != 0.38)
{
armor.Glass.Destructibility = glass.destructibility;
armor.Glass.MinRepairDegradation = glass.minRepairDegradation;
armor.Glass.MaxRepairDegradation = glass.maxRepairDegradation;
armor.Glass.ExplosionDestructibility = glass.explosionDestructibility;
armor.Glass.MinRepairKitDegradation = glass.minRepairKitDegradation;
armor.Glass.MaxRepairKitDegradation = glass.maxRepairKitDegradation;
this.glass();
this.logger.info("Glass Armor Materials Patched");
}
}
// Functions start
// Removes all restrictions from gear/equipment.
private removeGearRestrictions():void
{
const armors = this.tables.getTables().templates.items;
for (const armor in armors)
{
const item = armors[armor]._props;
item.BlocksArmorVest = false;
item.BlocksCollapsible = false;
item.BlocksEarpiece = false;
item.BlocksEyewear = false;
item.BlocksFaceCover = false;
item.BlocksFolding = false;
item.BlocksHeadwear = false;
}
}
private uhmwpe(): void
{
const uhmwpe = this.modConfig.armorMaterials.uhmwpe;
const armor = this.tables.getTables().globals.config.ArmorMaterials.UHMWPE;
armor.Destructibility = uhmwpe.destructibility;
armor.MinRepairDegradation = uhmwpe.minRepairDegradation;
armor.MaxRepairDegradation = uhmwpe.maxRepairDegradation;
armor.ExplosionDestructibility = uhmwpe.explosionDestructibility;
armor.MinRepairKitDegradation = uhmwpe.minRepairKitDegradation;
armor.MaxRepairKitDegradation = uhmwpe.maxRepairKitDegradation;
}
private aramid(): void
{
const aramid = this.modConfig.armorMaterials.aramid;
const armor = this.tables.getTables().globals.config.ArmorMaterials.Aramid;
armor.Destructibility = aramid.destructibility;
armor.MinRepairDegradation = aramid.minRepairDegradation;
armor.MaxRepairDegradation = aramid.maxRepairDegradation;
armor.ExplosionDestructibility = aramid.explosionDestructibility;
armor.MinRepairKitDegradation = aramid.minRepairKitDegradation;
armor.MaxRepairKitDegradation = aramid.maxRepairKitDegradation;
this.logger.info("Aramid Armor Materials Patched");
}
private combined(): void
{
const combined = this.modConfig.armorMaterials.combined;
const armor = this.tables.getTables().globals.config.ArmorMaterials.Combined;
armor.Destructibility = combined.destructibility;
armor.MinRepairDegradation = combined.minRepairDegradation;
armor.MaxRepairDegradation = combined.maxRepairDegradation;
armor.ExplosionDestructibility = combined.explosionDestructibility;
armor.MinRepairKitDegradation = combined.minRepairKitDegradation;
armor.MaxRepairKitDegradation = combined.maxRepairKitDegradation;
}
private titan(): void
{
const titan = this.modConfig.armorMaterials.titan;
const armor = this.tables.getTables().globals.config.ArmorMaterials.Titan;
armor.Destructibility = titan.destructibility;
armor.MinRepairDegradation = titan.minRepairDegradation;
armor.MaxRepairDegradation = titan.maxRepairDegradation;
armor.ExplosionDestructibility = titan.explosionDestructibility;
armor.MinRepairKitDegradation = titan.minRepairKitDegradation;
armor.MaxRepairKitDegradation = titan.maxRepairKitDegradation;
}
private aluminium(): void
{
const aluminium = this.modConfig.armorMaterials.aluminium;
const armor = this.tables.getTables().globals.config.ArmorMaterials.Aluminium;
armor.Destructibility = aluminium.destructibility;
armor.MinRepairDegradation = aluminium.minRepairDegradation;
armor.MaxRepairDegradation = aluminium.maxRepairDegradation;
armor.ExplosionDestructibility = aluminium.explosionDestructibility;
armor.MinRepairKitDegradation = aluminium.minRepairKitDegradation;
armor.MaxRepairKitDegradation = aluminium.maxRepairKitDegradation;
}
private steel(): void
{
const steel = this.modConfig.armorMaterials.armoredSteel;
const armor = this.tables.getTables().globals.config.ArmorMaterials.ArmoredSteel;
armor.Destructibility = steel.destructibility;
armor.MinRepairDegradation = steel.minRepairDegradation;
armor.MaxRepairDegradation = steel.maxRepairDegradation;
armor.ExplosionDestructibility = steel.explosionDestructibility;
armor.MinRepairKitDegradation = steel.minRepairKitDegradation;
armor.MaxRepairKitDegradation = steel.maxRepairKitDegradation;
}
private ceramic(): void
{
const ceramic = this.modConfig.armorMaterials.ceramic;
const armor = this.tables.getTables().globals.config.ArmorMaterials.Ceramic;
armor.Destructibility = ceramic.destructibility;
armor.MinRepairDegradation = ceramic.minRepairDegradation;
armor.MaxRepairDegradation = ceramic.maxRepairDegradation;
armor.ExplosionDestructibility = ceramic.explosionDestructibility;
armor.MinRepairKitDegradation = ceramic.minRepairKitDegradation;
armor.MaxRepairKitDegradation = ceramic.maxRepairKitDegradation;
}
private glass(): void
{
const glass = this.modConfig.armorMaterials.glass;
const armor = this.tables.getTables().globals.config.ArmorMaterials.Glass;
armor.Destructibility = glass.destructibility;
armor.MinRepairDegradation = glass.minRepairDegradation;
armor.MaxRepairDegradation = glass.maxRepairDegradation;
armor.ExplosionDestructibility = glass.explosionDestructibility;
armor.MinRepairKitDegradation = glass.minRepairKitDegradation;
armor.MaxRepairKitDegradation = glass.maxRepairKitDegradation;
}
}

View File

@ -1,13 +1,15 @@
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { ItemsConfig } from "../config/ts/items";
import { Logger } from "./logger";
import { BaseClasses } from "@spt-aki/models/enums/BaseClasses";
export class Items
{
private modConfig: ItemsConfig = require("../config/items.json")
private logger: Logger;
private tables: DatabaseServer;
private items: any;
private items: Record<string, ITemplateItem>;
constructor(logger: Logger, databaseServer: DatabaseServer)
{
@ -29,16 +31,36 @@ export class Items
// Weight Modifier. Multiplier of Weight *= modConfig.weightModifier
if (this.modConfig.weightModifier != 1)
{
this.updateWeight();
this.newWeightModifier();
this.logger.info(`Weight Multipler patched to ${this.modConfig.weightModifier}`);
}
// Removes the ExcludedFilter on Backpacks
// which in turn enables common containers to spawn in the loot pool of AI.
if (this.modConfig.removeBackpackFilter)
// Removes Backpacks Restrictions.
if (this.modConfig.removeBackpacksRestrictions)
{
this.updateBackpacks();
this.logger.info(`Backpack Restrictions Removed: ${this.modConfig.removeBackpackFilter}`)
this.removeBackpacksRestrictions();
this.logger.info("Removed Backpacks Restrictions");
}
// Remove Secured Containers Restrictions.
if (this.modConfig.removeSecureContainersRestrictions)
{
this.removeSecureContainersRestrictions();
this.logger.info("Removed Secured Containers Restrictions");
}
// Remove Common Containers Restricitons.
if (this.modConfig.removeContainersRestrictions)
{
this.removeContainersRestrictions();
this.logger.info("Removed Container Restrictions");
}
// Remove In Raid Item Restrictions.
if (this.modConfig.removeInRaidItemRestrictions)
{
this.removeInRaidItemRestrictions();
this.logger.info("Removed In Raid Item Restrictions");
}
// Standard Stash Size Changes
@ -101,26 +123,24 @@ export class Items
this.logger.info(`Euro Max Stack set to ${this.modConfig.eurosMaxStack}`, true);
}
// Remove ExcludedFilter Restrictions from all items. Push into Filters numerous Node categories.
if (this.modConfig.removeItemRestrictions)
{
this.removeItemRestrictions();
this.logger.info("Removed Item Restrictions");
}
// Remove the Discard Limit from in raid restrictions.
if (this.modConfig.removeDiscardLimit)
{
this.removeDiscardLimit();
this.logger.info("Removed Discard Limit");
}
if (this.modConfig.examineTime.enabled)
{
this.changeExamineTime();
}
}
// Functions Functions.
// Updates the weight modifier (as a multiplier) for all items in database/templates/items.json
private updateWeight(): void
private newWeightModifier(): void
{
for (const item in this.items)
{
@ -132,42 +152,48 @@ export class Items
}
// Updates backpacks and removes any values in the ExcludedFilter under props > Grids > props > filters > ExcludedFilter in database/templates/items.json
private updateBackpacks(): void
private removeBackpacksRestrictions(): void
{
for (const item in this.items)
for (const id in this.items)
{
if (this.items[item]._parent === "5448e53e4bdc2d60728b4567")
const base = this.items[id];
const mod = this.modConfig;
if (mod.removeBackpacksRestrictions && base._parent === BaseClasses.BACKPACK && base._props.Grids[0]._props.filters.length > 0)
{
for (const i in this.items[item]._props.Grids)
{
const grid = this.items[item]._props.Grids[i];
grid._props.filters[0].ExcludedFilter = [];
}
base._props.Grids[0]._props.filters = [];
}
}
}
// Removes any values in the ExcludedFilter for all items under _props > _Grids > _props > filters > ExcludedFilter in database/templates/items.json
private removeItemRestrictions(): void
private removeContainersRestrictions():void
{
for (const item in this.items)
for (const id in this.items)
{
for (const i in this.items[item]._props?.Grids)
const base = this.items[id];
const mod = this.modConfig;
if (mod.removeContainersRestrictions && base._parent === BaseClasses.SIMPLE_CONTAINER && base._props.Grids[0]._props.filters.length > 0)
{
const grids = this.items[item]._props?.Grids[i];
for (const j in grids._props.filters)
{
const filters = grids._props.filters[j];
if (!filters.ExcludedFilter)
{
filters.ExcludedFilter = [];
filters.Filter.concat(..."5448e54d4bdc2dcc718b4568", "55802f3e4bdc2de7118b4584", "5448fe124bdc2da5018b4567", "543be5664bdc2dd4348b4569", "5447e0e74bdc2d3c308b4567", "543be6674bdc2df1348b4569", "5645bcb74bdc2ded0b8b4578", "550aa4154bdc2dd8348b456b", "5448e53e4bdc2d60728b4567", "5422acb9af1c889c16000029", "5a341c4086f77401f2541505", "5795f317245977243854e041", "5448bf274bdc2dfc2f8b456a");
}
}
base._props.Grids[0]._props.filters = [];
}
}
}
private removeSecureContainersRestrictions(): void
{
for (const id in this.items)
{
const base = this.items[id];
const mod = this.modConfig;
if (mod.removeSecureContainersRestrictions && base._parent === BaseClasses.MOD_CONTAINER && base._props.Grids[0]._props.filters.length > 0)
{
base._props.Grids[0]._props.filters = [];
}
}
}
private updateStandardStash(): void
{
this.items["566abbc34bdc2d92178b4576"]._props.Grids[0]._props.cellsV = this.modConfig.standardStash.vertical;
@ -224,4 +250,18 @@ export class Items
this.items[itemId]._props.DiscardLimit = -1;
}
}
private changeExamineTime(): void
{
const mod = this.modConfig;
for (const item in this.items)
{
this.items[item]._props.ExamineTime = mod.examineTime.examineTime;
}
}
private removeInRaidItemRestrictions(): void
{
this.tables.getTables().globals.config.RestrictionsInRaid = [];
}
}

View File

@ -21,7 +21,7 @@ export class Traders
{
const mod = this.modConfig;
if (mod.updateTime != this.traderConfig.updateTime)
if (mod.updateTime.enabled)
{
this.updateTime();
}
@ -46,8 +46,8 @@ export class Traders
{
const mod = this.modConfig;
const trader = this.traderConfig;
trader.updateTime = mod.updateTime;
this.logger.info(`Update Time Set to ${mod.updateTime}`);
trader.updateTime = mod.updateTime.updateTime;
this.logger.info("Update Time Patched");
}
private traderPriceMultiplier(): void