From 3dc73557145b78c96f40f3551c6ea47e630f437f Mon Sep 17 00:00:00 2001 From: Platinum Date: Sun, 11 Jun 2023 16:51:25 +1000 Subject: [PATCH] Add logging and add licence stuff --- .vscode/settings.json | 2 +- package.json | 2 +- src/mod.ts | 30 +++++++++++++++++++++++++----- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6474294..9351658 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ { - "licenser.projectName": "SPT Realism Ammo Stats", + "licenser.projectName": "Two Slot Extended Mags", "licenser.license": "GPLv3" } \ No newline at end of file diff --git a/package.json b/package.json index 6dd6ee1..e482143 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "2 Slot Extended Mags", + "name": "Two Slot Extended Mags", "version": "1.0.0", "main": "src/mod.js", "license": "GPLv3", diff --git a/src/mod.ts b/src/mod.ts index 80c37a6..0214c78 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -1,4 +1,19 @@ - +// Copyright (C) 2023 Platinum +// +// This file is part of Two Slot Extended Mags. +// +// Two Slot Extended Mags is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Two Slot Extended Mags is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Two Slot Extended Mags. If not, see . import { DependencyContainer } from "tsyringe"; @@ -12,6 +27,8 @@ import config from "../config.json"; class TwoSlotExtendedMags implements IPostDBLoadMod { private logger: ILogger; + readonly modName = "Two Slot Extended Mags"; + public postDBLoad(container: DependencyContainer): void { this.logger = container.resolve("WinstonLogger"); @@ -20,11 +37,11 @@ class TwoSlotExtendedMags implements IPostDBLoadMod { const itemTable = tables.templates.items; this.updateExtendedMagsInventorySlotSize(itemTable); - - this.logger.success(`Downsized!`); } private updateExtendedMagsInventorySlotSize(itemTable: Record): void { + let itemsChanged = 0; + for (const itemId in itemTable) { const item = itemTable[itemId]; @@ -36,8 +53,13 @@ class TwoSlotExtendedMags implements IPostDBLoadMod { if (itemProp.ExtraSizeDown) { itemProp.ExtraSizeDown--; } + + itemsChanged++; } } + + this.logger.success(`[${this.modName}]: Updated ${itemsChanged} extended mags.`); + this.logger.success(`[${this.modName}]: Please delete the "AppData\\Local\\Temp\\Battlestate Games\\EscapeFromTarkov\\Icon Cache" folder if you have issues with the icon size.`); } private isExtendedMag(item: ITemplateItem): boolean { @@ -57,8 +79,6 @@ class TwoSlotExtendedMags implements IPostDBLoadMod { private getMagazineCapacity(itemProp: Props): number { return itemProp.Cartridges?.find(cartridge => cartridge._max_count != null)?._max_count; } - - } module.exports = { mod: new TwoSlotExtendedMags() };