From bda69a556314bd81e4d7fde5a7a860bb7cc73abd Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 7 Jul 2024 19:43:32 +0100 Subject: [PATCH] Added `getMoneyTpls()` --- project/src/generators/LocationLootGenerator.ts | 5 ++--- project/src/helpers/ItemHelper.ts | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/project/src/generators/LocationLootGenerator.ts b/project/src/generators/LocationLootGenerator.ts index f9b17da6..22939756 100644 --- a/project/src/generators/LocationLootGenerator.ts +++ b/project/src/generators/LocationLootGenerator.ts @@ -15,7 +15,6 @@ import { ILooseLoot, Spawnpoint, SpawnpointTemplate, SpawnpointsForced } from "@ import { Item } from "@spt/models/eft/common/tables/IItem"; import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; -import { Money } from "@spt/models/enums/Money"; import { ILocationConfig } from "@spt/models/spt/config/ILocationConfig"; import { ILogger } from "@spt/models/spt/utils/ILogger"; import { ConfigServer } from "@spt/servers/ConfigServer"; @@ -424,9 +423,9 @@ export class LocationLootGenerator .map((x) => x.itemTpl); // Draw random loot - // Money spawn more than once in container + // Allow money to spawn more than once in container let failedToFitCount = 0; - const locklist = [Money.ROUBLES, Money.DOLLARS, Money.EUROS, Money.GP]; + const locklist = this.itemHelper.getMoneyTpls(); // Choose items to add to container, factor in weighting + lock money down // Filter out items picked that're already in the above `tplsForced` array diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index 88d804a7..38afe7b7 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -8,6 +8,7 @@ import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem"; import { BaseClasses } from "@spt/models/enums/BaseClasses"; import { EquipmentSlots } from "@spt/models/enums/EquipmentSlots"; import { ItemTpl } from "@spt/models/enums/ItemTpl"; +import { Money } from "@spt/models/enums/Money"; import { ILogger } from "@spt/models/spt/utils/ILogger"; import { DatabaseService } from "@spt/services/DatabaseService"; import { ItemBaseClassService } from "@spt/services/ItemBaseClassService"; @@ -1916,6 +1917,11 @@ export class ItemHelper return false; } + + public getMoneyTpls(): string[] + { + return Object.values(Money); + } } // eslint-disable-next-line @typescript-eslint/no-namespace