Added spt friend code VERYSPOOKY to enable halloween/zombies

This commit is contained in:
Dev 2024-11-15 19:01:27 +00:00
parent 6ab1309ce6
commit ef7ed5870a
2 changed files with 27 additions and 0 deletions

View File

@ -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;

View File

@ -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
*/