VforValens
065c5098b9
* Bugfixes for non-working features * Code Refactor, and cleanup * Separated out all instances of the config files to their own separate entities. DebugMode is the only entity existing within the original config.json which will enable logging in the server for every feature enabled. * Removed Progression from the AIO and separated it out to its own individual modification. New Features * Added SMG In Holsters to Weapons.json * Added Skill Progression/Fatigue rates to Skills.json * Added Remove Discard Limit, and Remove Item Restrictions to Items.json * Reworked Insurance, and added minHr, maxHr, and storageMaxHr alongside the previously existing priceCoefficient, and returnChance in Insurance.json * Added Armor Materials to Armor.json
265 lines
8.1 KiB
TypeScript
265 lines
8.1 KiB
TypeScript
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
|
import { Logger } from "./logger";
|
|
import { Grenade, Ammo762x51, Ammo762x54, Ammo338Lapua, Ammo46x30, Ammo57x28, Ammo762x25, Ammo9x18, Ammo9x19, Ammo9x21, Ammo357Mag, Ammo45ACP, Ammo545x39, Ammo556x45, Ammo300Blackout, Ammo762x39, Ammo9x39, Ammo366TKM, Ammo127x55, Ammo12Gauge, Ammo20Gauge, Ammo23x75, Ammo30x29, Ammo26x75 } from "@spt-aki/models/enums/AmmoTypes";
|
|
import { AmmoConfig } from "../config/ts/ammo";
|
|
|
|
export class Ammo
|
|
{
|
|
private modConfig: AmmoConfig = require("../config/ammo.json")
|
|
private logger: Logger;
|
|
private tables: DatabaseServer;
|
|
|
|
constructor(logger: Logger, databaseServer: DatabaseServer)
|
|
{
|
|
this.logger = logger;
|
|
this.tables = databaseServer;
|
|
}
|
|
|
|
public updateAmmo(): void
|
|
{
|
|
const items = this.tables.getTables().templates.items;
|
|
const mod = this.modConfig.stacks;
|
|
|
|
|
|
// Sets HE grenades from GLaunchers max stacks.
|
|
if (mod.grenades != 1)
|
|
{
|
|
for (const value of Object.values(Grenade))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.grenades
|
|
this.logger.info(`Grenade Max Stacks set to ${mod.grenades}`);
|
|
}
|
|
}
|
|
|
|
// Sets .338 Lapua Magnum max stacks.
|
|
if (mod.a338Lapua != 30)
|
|
{
|
|
for (const value of Object.values(Ammo338Lapua))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a338Lapua
|
|
this.logger.info(`.338 Lapua Magnum Max Stacks set to ${mod.a338Lapua}`);
|
|
}
|
|
}
|
|
|
|
// Sets 12.7x55mm max stacks.
|
|
if (mod.a127x55 != 30)
|
|
{
|
|
for (const value of Object.values(Ammo127x55))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a127x55
|
|
this.logger.info(`12.7x55mm Max Stacks set to ${mod.a127x55}`);
|
|
}
|
|
}
|
|
|
|
// Sets 7.62x54mm max stacks.
|
|
if (mod.a762x54 != 40)
|
|
{
|
|
for (const value of Object.values(Ammo762x54))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a762x54
|
|
this.logger.info(`7.62x54R Max Stacks set to ${mod.a762x54}`);
|
|
}
|
|
}
|
|
|
|
// Sets 7.62x51mm max stacks.
|
|
if (mod.a762x51 != 40)
|
|
{
|
|
for (const value of Object.values(Ammo762x51))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a762x51
|
|
this.logger.info(`7.62x51mm Max Stacks set to ${mod.a762x51}`);
|
|
}
|
|
}
|
|
|
|
// Sets 9x39mm max stacks.
|
|
if (mod.a9x39 != 50)
|
|
{
|
|
for (const value of Object.values(Ammo9x39))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a9x39
|
|
this.logger.info(`9x39mm Max Stacks set to ${mod.a9x39}`);
|
|
}
|
|
}
|
|
|
|
// Sets .366 TKM max stacks.
|
|
if (mod.a366TKM != 50)
|
|
{
|
|
for (const value of Object.values(Ammo366TKM))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a366TKM
|
|
this.logger.info(`.366 TKM Max Stacks set to ${mod.a366TKM}`);
|
|
}
|
|
}
|
|
|
|
// Sets 7.62x39mm max stacks.
|
|
if (mod.a762x39 != 60)
|
|
{
|
|
for (const value of Object.values(Ammo762x39))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a762x39
|
|
this.logger.info(`7.62x39mm Max Stacks set to ${mod.a762x39}`);
|
|
}
|
|
}
|
|
|
|
// Sets 7.62x35mm (.300 Blackout) max stacks.
|
|
if (mod.a762x35 != 60)
|
|
{
|
|
for (const value of Object.values(Ammo300Blackout))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a762x35
|
|
this.logger.info(`762x35mm Max Stacks set to ${mod.a762x35}`);
|
|
}
|
|
}
|
|
|
|
// Sets 5.56x45mm max stacks.
|
|
if (mod.a556x45 != 60)
|
|
{
|
|
for (const value of Object.values(Ammo556x45))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a556x45
|
|
this.logger.info(`5.56x45mm Max Stacks set to ${mod.a556x45}`);
|
|
}
|
|
}
|
|
|
|
// Sets 5.45x39mm max stacks.
|
|
if (mod.a545x39 != 60)
|
|
{
|
|
for (const value of Object.values(Ammo545x39))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a545x39
|
|
this.logger.info(`5.45x39mm Max Stacks set to ${mod.a545x39}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a57x28 != 60)
|
|
{
|
|
for (const value of Object.values(Ammo57x28))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a57x28
|
|
this.logger.info(`5.7x28mm Max Stacks set to ${mod.a57x28}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a46x30 != 70)
|
|
{
|
|
for (const value of Object.values(Ammo46x30))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a46x30
|
|
this.logger.info(`4.6x30mm Max Stacks set to ${mod.a46x30}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a357Mag != 30)
|
|
{
|
|
for (const value of Object.values(Ammo357Mag))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a357Mag
|
|
this.logger.info(`.357 Magnum Max Stacks set to ${mod.a357Mag}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a1143x23ACP != 50)
|
|
{
|
|
for (const value of Object.values(Ammo45ACP))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a1143x23ACP
|
|
this.logger.info(`.45 ACP Max Stacks set to ${mod.a1143x23ACP}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a762x25 != 50)
|
|
{
|
|
for (const value of Object.values(Ammo762x25))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a762x25
|
|
this.logger.info(`7.62x25mm TT Max Stacks set to ${mod.a762x25}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a9x21 != 50)
|
|
{
|
|
for (const value of Object.values(Ammo9x21))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a9x21
|
|
this.logger.info(`9x21mm Max Stacks set to ${mod.a9x21}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a9x19 != 50)
|
|
{
|
|
for (const value of Object.values(Ammo9x19))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a9x19
|
|
this.logger.info(`9x19mm Max Stacks set to ${mod.a9x19}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a9x18 != 50)
|
|
{
|
|
for (const value of Object.values(Ammo9x18))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a9x18
|
|
this.logger.info(`9x18mm Max Stacks set to ${mod.a9x18}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a23x75 != 15)
|
|
{
|
|
for (const value of Object.values(Ammo23x75))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a23x75
|
|
this.logger.info(`23x75mm KS-23 Max Stacks set to ${mod.a23x75}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a12Gauge != 20)
|
|
{
|
|
for (const value of Object.values(Ammo12Gauge))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a12Gauge
|
|
this.logger.info(`12 Gauge Max Stacks set to ${mod.a12Gauge}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a20Gauge != 20)
|
|
{
|
|
for (const value of Object.values(Ammo20Gauge))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a20Gauge
|
|
this.logger.info(`20 Gauge Max Stacks set to ${mod.a20Gauge}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a30x29 != 1)
|
|
{
|
|
for (const value of Object.values(Ammo30x29))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a30x29
|
|
this.logger.info(`VOG-30x29mm Max Stacks set to ${mod.a30x29}`);
|
|
}
|
|
}
|
|
|
|
|
|
if (mod.a26x75 != 1)
|
|
{
|
|
for (const value of Object.values(Ammo26x75))
|
|
{
|
|
items[value]._props.StackMaxSize = mod.a26x75
|
|
this.logger.info(`Flare Max Stacks set to ${mod.a26x75}`);
|
|
}
|
|
}
|
|
}
|
|
}
|