diff --git a/project/assets/images/traders/halloween/579dc571d53a0658a154fbec.png b/project/assets/images/traders/halloween/579dc571d53a0658a154fbec.png new file mode 100644 index 00000000..764d6d2a Binary files /dev/null and b/project/assets/images/traders/halloween/579dc571d53a0658a154fbec.png differ diff --git a/project/assets/images/traders/halloween/59b91ca086f77469a81232e4.png b/project/assets/images/traders/halloween/59b91ca086f77469a81232e4.png new file mode 100644 index 00000000..8b056c99 Binary files /dev/null and b/project/assets/images/traders/halloween/59b91ca086f77469a81232e4.png differ diff --git a/project/assets/images/traders/halloween/59b91cab86f77469aa5343ca.png b/project/assets/images/traders/halloween/59b91cab86f77469aa5343ca.png new file mode 100644 index 00000000..b9a129ac Binary files /dev/null and b/project/assets/images/traders/halloween/59b91cab86f77469aa5343ca.png differ diff --git a/project/assets/images/traders/halloween/59b91cb486f77469a81232e5.png b/project/assets/images/traders/halloween/59b91cb486f77469a81232e5.png new file mode 100644 index 00000000..0176b2fb Binary files /dev/null and b/project/assets/images/traders/halloween/59b91cb486f77469a81232e5.png differ diff --git a/project/assets/images/traders/halloween/59b91cbd86f77469aa5343cb.png b/project/assets/images/traders/halloween/59b91cbd86f77469aa5343cb.png new file mode 100644 index 00000000..9f1f5f42 Binary files /dev/null and b/project/assets/images/traders/halloween/59b91cbd86f77469aa5343cb.png differ diff --git a/project/assets/images/traders/halloween/5a7c2ebb86f7746e324a06ab.png b/project/assets/images/traders/halloween/5a7c2ebb86f7746e324a06ab.png new file mode 100644 index 00000000..941243e3 Binary files /dev/null and b/project/assets/images/traders/halloween/5a7c2ebb86f7746e324a06ab.png differ diff --git a/project/assets/images/traders/halloween/5ac3b86a86f77461491d1ad8.png b/project/assets/images/traders/halloween/5ac3b86a86f77461491d1ad8.png new file mode 100644 index 00000000..f6d8a4d9 Binary files /dev/null and b/project/assets/images/traders/halloween/5ac3b86a86f77461491d1ad8.png differ diff --git a/project/assets/images/traders/halloween/5c06531a86f7746319710e1b.png b/project/assets/images/traders/halloween/5c06531a86f7746319710e1b.png new file mode 100644 index 00000000..7b0443e6 Binary files /dev/null and b/project/assets/images/traders/halloween/5c06531a86f7746319710e1b.png differ diff --git a/project/src/services/SeasonalEventService.ts b/project/src/services/SeasonalEventService.ts index 4bc3bfae..27fde9c9 100644 --- a/project/src/services/SeasonalEventService.ts +++ b/project/src/services/SeasonalEventService.ts @@ -5,12 +5,14 @@ import { Config } from "../models/eft/common/IGlobals"; import { Inventory } from "../models/eft/common/tables/IBotType"; import { ConfigTypes } from "../models/enums/ConfigTypes"; import { SeasonalEventType } from "../models/enums/SeasonalEventType"; +import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { IQuestConfig } from "../models/spt/config/IQuestConfig"; import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig"; import { ILocationData } from "../models/spt/server/ILocations"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; import { DatabaseServer } from "../servers/DatabaseServer"; +import { DatabaseImporter } from "../utils/DatabaseImporter"; import { LocalisationService } from "./LocalisationService"; @injectable() @@ -18,10 +20,12 @@ export class SeasonalEventService { protected seasonalEventConfig: ISeasonalEventConfig; protected questConfig: IQuestConfig; + protected httpConfig: IHttpConfig; constructor( @inject("WinstonLogger") protected logger: ILogger, @inject("DatabaseServer") protected databaseServer: DatabaseServer, + @inject("DatabaseImporter") protected databaseImporter: DatabaseImporter, @inject("LocalisationService") protected localisationService: LocalisationService, @inject("BotHelper") protected botHelper: BotHelper, @inject("ConfigServer") protected configServer: ConfigServer @@ -29,6 +33,7 @@ export class SeasonalEventService { this.seasonalEventConfig = this.configServer.getConfig(ConfigTypes.SEASONAL_EVENT); this.questConfig = this.configServer.getConfig(ConfigTypes.QUEST); + this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP); } protected get christmasEventItems(): string[] @@ -281,6 +286,7 @@ export class SeasonalEventService globalConfig.Health.ProfileHealthSettings.DefaultStimulatorBuff = "Buffs_Halloween"; this.addEventGearToBots(eventType); this.addPumpkinsToScavBackpacks(); + //this.adjustTraderIcons(eventType); break; case SeasonalEventType.CHRISTMAS.toLowerCase(): globalConfig.EventType = globalConfig.EventType.filter(x => x !== "None"); @@ -297,6 +303,32 @@ export class SeasonalEventService } } + /** + * Change trader icons to be more event themed (Halloween only so far) + * @param eventType What event is active + */ + protected adjustTraderIcons(eventType: SeasonalEventType): void + { + switch (eventType.toLowerCase()) + { + case SeasonalEventType.HALLOWEEN.toLowerCase(): + this.httpConfig.serverImagePathOverride["./assets/images/traders/5a7c2ebb86f7746e324a06ab.png"] = "./assets/images/traders/halloween/5a7c2ebb86f7746e324a06ab.png"; + this.httpConfig.serverImagePathOverride["./assets/images/traders/5ac3b86a86f77461491d1ad8.png"] = "./assets/images/traders/halloween/5ac3b86a86f77461491d1ad8.png"; + this.httpConfig.serverImagePathOverride["Aki_Data/Server/images/traders/5c06531a86f7746319710e1b.png"] = "Aki_Data/Server/images/traders/halloween/5c06531a86f7746319710e1b.png"; + this.httpConfig.serverImagePathOverride["Aki_Data/Server/images/traders/59b91ca086f77469a81232e4.png"] = "Aki_Data/Server/images/traders/halloween/59b91ca086f77469a81232e4.png"; + this.httpConfig.serverImagePathOverride["Aki_Data/Server/images/traders/59b91cab86f77469aa5343ca.png"] = "Aki_Data/Server/images/traders/halloween/59b91cab86f77469aa5343ca.png"; + this.httpConfig.serverImagePathOverride["Aki_Data/Server/images/traders/59b91cb486f77469a81232e5.png"] = "Aki_Data/Server/images/traders/halloween/59b91cb486f77469a81232e5.png"; + this.httpConfig.serverImagePathOverride["Aki_Data/Server/images/traders/59b91cbd86f77469aa5343cb.png"] = "Aki_Data/Server/images/traders/halloween/59b91cbd86f77469aa5343cb.png"; + this.httpConfig.serverImagePathOverride["Aki_Data/Server/images/traders/579dc571d53a0658a154fbec.png"] = "Aki_Data/Server/images/traders/halloween/579dc571d53a0658a154fbec.png"; + break; + case SeasonalEventType.CHRISTMAS.toLowerCase(): + // TODO: find christmas trader icons + break; + } + + this.databaseImporter.loadImages(`${this.databaseImporter.getSptDataPath()}images/`, ["traders"], ["/files/trader/avatar/"]); + } + /** * Add lootble items from backpack into patrol.ITEMS_TO_DROP difficulty property */ diff --git a/project/src/utils/DatabaseImporter.ts b/project/src/utils/DatabaseImporter.ts index 1233c3e9..9b96fb30 100644 --- a/project/src/utils/DatabaseImporter.ts +++ b/project/src/utils/DatabaseImporter.ts @@ -38,10 +38,21 @@ export class DatabaseImporter implements OnLoad { this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP); } + + /** + * Get path to aki data + * @returns path to data + */ + public getSptDataPath(): string + { + return (globalThis.G_RELEASE_CONFIGURATION) + ? "Aki_Data/Server/" + : "./assets/"; + } public async onLoad(): Promise { - this.filepath = (globalThis.G_RELEASE_CONFIGURATION) ? "Aki_Data/Server/" : "./assets/"; + this.filepath = this.getSptDataPath(); if (globalThis.G_RELEASE_CONFIGURATION) { @@ -69,7 +80,9 @@ export class DatabaseImporter implements OnLoad await this.hydrateDatabase(this.filepath); - this.loadImages(`${this.filepath}images/`, [ + const imageFilePath = `${this.filepath}images/`; + const directories = this.vfs.getDirs(imageFilePath); + this.loadImages(imageFilePath, directories, [ "/files/CONTENT/banners/", "/files/handbook/", "/files/Hideout/", @@ -143,9 +156,8 @@ export class DatabaseImporter implements OnLoad * Find and map files with image router inside a designated path * @param filepath Path to find files in */ - public loadImages(filepath: string, routes: string[]): void + public loadImages(filepath: string, directories: string[], routes: string[]): void { - const directories = this.vfs.getDirs(filepath); for (const directoryIndex in directories) { // Get all files in directory @@ -160,6 +172,7 @@ export class DatabaseImporter implements OnLoad const pathOverride = this.getImagePathOverride(imagePath); if (pathOverride) { + this.logger.debug(`overrode route: ${routeKey} endpoint: ${imagePath} with ${pathOverride}`); imagePath = pathOverride; }