From ef7ed5870a9350ae5fcbe0717c39d272a6d6a91d Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 15 Nov 2024 19:01:27 +0000 Subject: [PATCH] Added spt friend code `VERYSPOOKY` to enable halloween/zombies --- .../src/helpers/Dialogue/SptDialogueChatBot.ts | 16 ++++++++++++++++ project/src/services/SeasonalEventService.ts | 11 +++++++++++ 2 files changed, 27 insertions(+) diff --git a/project/src/helpers/Dialogue/SptDialogueChatBot.ts b/project/src/helpers/Dialogue/SptDialogueChatBot.ts index 737af204..35c3bfdb 100644 --- a/project/src/helpers/Dialogue/SptDialogueChatBot.ts +++ b/project/src/helpers/Dialogue/SptDialogueChatBot.ts @@ -6,11 +6,13 @@ import { ConfigTypes } from "@spt/models/enums/ConfigTypes"; import { GiftSentResult } from "@spt/models/enums/GiftSentResult"; import { MemberCategory } from "@spt/models/enums/MemberCategory"; import { Season } from "@spt/models/enums/Season"; +import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType"; import { ICoreConfig } from "@spt/models/spt/config/ICoreConfig"; import { IWeatherConfig } from "@spt/models/spt/config/IWeatherConfig"; import { ConfigServer } from "@spt/servers/ConfigServer"; import { GiftService } from "@spt/services/GiftService"; import { MailSendService } from "@spt/services/MailSendService"; +import { SeasonalEventService } from "@spt/services/SeasonalEventService"; import { RandomUtil } from "@spt/utils/RandomUtil"; import { inject, injectable } from "tsyringe"; @@ -23,6 +25,7 @@ export class SptDialogueChatBot implements IDialogueChatBot { @inject("ProfileHelper") protected profileHelper: ProfileHelper, @inject("RandomUtil") protected randomUtil: RandomUtil, @inject("MailSendService") protected mailSendService: MailSendService, + @inject("SeasonalEventService") protected seasonalEventService: SeasonalEventService, @inject("GiftService") protected giftService: GiftService, @inject("ConfigServer") protected configServer: ConfigServer, ) { @@ -156,6 +159,19 @@ export class SptDialogueChatBot implements IDialogueChatBot { ); } + if (requestInput === "veryspooky") { + const enableEventResult = this.seasonalEventService.forceSeasonalEvent(SeasonalEventType.HALLOWEEN); + if (enableEventResult) { + this.mailSendService.sendUserMessageToPlayer( + sessionId, + sptFriendUser, + this.randomUtil.getArrayValue([ + "Halloween event has been enabled, restart your game client before starting a raid", + ]), + ); + } + } + if (requestInput === "givemespace") { const stashRowGiftId = "StashRows"; const maxGiftsToSendCount = this.coreConfig.features.chatbotFeatures.commandUseLimits[stashRowGiftId] ?? 5; diff --git a/project/src/services/SeasonalEventService.ts b/project/src/services/SeasonalEventService.ts index 82df8aeb..25caae1f 100644 --- a/project/src/services/SeasonalEventService.ts +++ b/project/src/services/SeasonalEventService.ts @@ -211,6 +211,17 @@ export class SeasonalEventService { } } + public forceSeasonalEvent(eventType: SeasonalEventType): boolean { + const globalConfig = this.databaseService.getGlobals().config; + const event = this.seasonalEventConfig.events.find((event) => SeasonalEventType[event.type] === eventType); + if (!event) { + return false; + } + this.updateGlobalEvents(globalConfig, event); + + return true; + } + /** * Store active events inside class array property `currentlyActiveEvents` + set class properties: christmasEventActive/halloweenEventActive */