Rename function getAllSeasonalEventItems() to getInactiveSeasonalEventItems()

This commit is contained in:
Dev 2023-11-01 11:35:05 +00:00
parent fc5eabc73d
commit 37b7712602
6 changed files with 20 additions and 20 deletions

View File

@ -152,8 +152,7 @@ export class BotGenerator
bot.Info.Nickname = this.generateBotNickname(botJsonTemplate, botGenerationDetails.isPlayerScav, botRole, sessionId);
const skipChristmasItems = !this.seasonalEventService.christmasEventEnabled();
if (skipChristmasItems)
if (!this.seasonalEventService.christmasEventEnabled())
{
this.seasonalEventService.removeChristmasItemsFromBotInventory(botJsonTemplate.inventory, botGenerationDetails.role);
}

View File

@ -38,7 +38,7 @@ export class FenceBaseAssortGenerator
*/
public generateFenceBaseAssorts(): void
{
const blockedSeasonalItems = this.seasonalEventService.getAllSeasonalEventItems();
const blockedSeasonalItems = this.seasonalEventService.getInactiveSeasonalEventItems();
const baseFenceAssort = this.databaseServer.getTables().traders[Traders.FENCE].assort;

View File

@ -431,7 +431,7 @@ export class LocationGenerator
protected getPossibleLootItemsForContainer(containerTypeId: string, staticLootDist: Record<string, IStaticLootDetails>): ProbabilityObjectArray<string, number>
{
const seasonalEventActive = this.seasonalEventService.seasonalEventEnabled();
const seasonalItemTplBlacklist = this.seasonalEventService.getAllSeasonalEventItems();
const seasonalItemTplBlacklist = this.seasonalEventService.getInactiveSeasonalEventItems();
const itemDistribution = new ProbabilityObjectArray<string>(this.mathUtil, this.jsonUtil);
for (const icd of staticLootDist[containerTypeId].itemDistribution)
@ -533,7 +533,7 @@ export class LocationGenerator
// Iterate over spawnpoints
const seasonalEventActive = this.seasonalEventService.seasonalEventEnabled();
const seasonalItemTplBlacklist = this.seasonalEventService.getAllSeasonalEventItems();
const seasonalItemTplBlacklist = this.seasonalEventService.getInactiveSeasonalEventItems();
for (const spawnPoint of chosenSpawnpoints)
{
if (!spawnPoint.template)
@ -623,7 +623,7 @@ export class LocationGenerator
}
const seasonalEventActive = this.seasonalEventService.seasonalEventEnabled();
const seasonalItemTplBlacklist = this.seasonalEventService.getAllSeasonalEventItems();
const seasonalItemTplBlacklist = this.seasonalEventService.getInactiveSeasonalEventItems();
// Add remaining forced loot to array
for (const forcedLootItem of forcedSpawnPoints)
{

View File

@ -53,7 +53,7 @@ export class PMCLootGenerator
if (!this.seasonalEventService.seasonalEventEnabled())
{
// Blacklist seasonal items
itemBlacklist.push(...this.seasonalEventService.getAllSeasonalEventItems());
itemBlacklist.push(...this.seasonalEventService.getInactiveSeasonalEventItems());
}
const itemsToAdd = Object.values(items).filter(item => allowedItemTypes.includes(item._parent)
@ -89,7 +89,7 @@ export class PMCLootGenerator
if (!this.seasonalEventService.seasonalEventEnabled())
{
// Blacklist seasonal items
itemBlacklist.push(...this.seasonalEventService.getAllSeasonalEventItems());
itemBlacklist.push(...this.seasonalEventService.getInactiveSeasonalEventItems());
}
const itemsToAdd = Object.values(items).filter(item => allowedItemTypes.includes(item._parent)
@ -134,7 +134,7 @@ export class PMCLootGenerator
if (!this.seasonalEventService.seasonalEventEnabled())
{
// Blacklist seasonal items
itemBlacklist.push(...this.seasonalEventService.getAllSeasonalEventItems());
itemBlacklist.push(...this.seasonalEventService.getInactiveSeasonalEventItems());
}
const itemsToAdd = Object.values(items).filter(item => allowedItemTypes.includes(item._parent)

View File

@ -76,7 +76,7 @@ export class RagfairAssortGenerator
];
const seasonalEventActive = this.seasonalEventService.seasonalEventEnabled();
const seasonalItemTplBlacklist = this.seasonalEventService.getAllSeasonalEventItems();
const seasonalItemTplBlacklist = this.seasonalEventService.getInactiveSeasonalEventItems();
for (const item of items)
{
if (!this.itemHelper.isValidItem(item._id, ragfairItemInvalidBaseTypes))

View File

@ -105,11 +105,12 @@ export class SeasonalEventService
}
/**
* Get an array of items that appear during a seasonal event
* returns multiple seasonal event items if they are both active
* Get an array of seasonal items that should not appear
* e.g. if halloween is active, only return christmas items
* or, if halloween and christmas are inactive, return both sets of items
* @returns array of tpl strings
*/
public getAllSeasonalEventItems(): string[]
public getInactiveSeasonalEventItems(): string[]
{
const items = [];
if (!this.christmasEventEnabled())
@ -237,10 +238,10 @@ export class SeasonalEventService
/**
* Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService)
* @param nodeInventory Bots inventory to iterate over
* @param botInventory Bots inventory to iterate over
* @param botRole the role of the bot being processed
*/
public removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void
public removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void
{
const christmasItems = this.getChristmasEventItems();
const equipmentSlotsToFilter = ["FaceCover", "Headwear", "Backpack", "TacticalVest"];
@ -249,25 +250,25 @@ export class SeasonalEventService
// Remove christmas related equipment
for (const equipmentSlotKey of equipmentSlotsToFilter)
{
if (!nodeInventory.equipment[equipmentSlotKey])
if (!botInventory.equipment[equipmentSlotKey])
{
this.logger.warning(this.localisationService.getText("seasonal-missing_equipment_slot_on_bot", {equipmentSlot: equipmentSlotKey, botRole: botRole}));
}
const equipment: Record<string, number> = nodeInventory.equipment[equipmentSlotKey];
const equipment: Record<string, number> = botInventory.equipment[equipmentSlotKey];
// eslint-disable-next-line @typescript-eslint/no-unused-vars
nodeInventory.equipment[equipmentSlotKey] = Object.fromEntries(Object.entries(equipment).filter(([index]) => !christmasItems.includes(index)));
botInventory.equipment[equipmentSlotKey] = Object.fromEntries(Object.entries(equipment).filter(([index]) => !christmasItems.includes(index)));
}
// Remove christmas related loot from loot containers
for (const lootContainerKey of lootContainersToFilter)
{
if (!nodeInventory.items[lootContainerKey])
if (!botInventory.items[lootContainerKey])
{
this.logger.warning(this.localisationService.getText("seasonal-missing_loot_container_slot_on_bot", {lootContainer: lootContainerKey, botRole: botRole}));
}
nodeInventory.items[lootContainerKey] = nodeInventory.items[lootContainerKey].filter((x: string) => !christmasItems.includes(x));
botInventory.items[lootContainerKey] = botInventory.items[lootContainerKey].filter((x: string) => !christmasItems.includes(x));
}
}