Added ability to enable/disable certain sub-events during seasonal events

This commit is contained in:
Dev 2024-10-27 15:37:18 +00:00
parent 22b6ee2741
commit bc3ac3d3e6
3 changed files with 28 additions and 16 deletions

View File

@ -695,7 +695,10 @@
"startDay": "24", "startDay": "24",
"startMonth": "10", "startMonth": "10",
"endDay": "4", "endDay": "4",
"endMonth": "11" "endMonth": "11",
"settings": {
"enableSummoning": true
}
}, },
{ {
"enabled": true, "enabled": true,
@ -704,7 +707,10 @@
"startDay": "7", "startDay": "7",
"startMonth": "12", "startMonth": "12",
"endDay": "31", "endDay": "31",
"endMonth": "12" "endMonth": "12",
"settings": {
"enableSanta": true
}
}, },
{ {
"enabled": true, "enabled": true,

View File

@ -21,6 +21,7 @@ export interface ISeasonalEvent {
startMonth: number; startMonth: number;
endDay: number; endDay: number;
endMonth: number; endMonth: number;
settings?: Record<string, boolean>;
} }
export interface IGifterSetting { export interface IGifterSetting {

View File

@ -31,7 +31,7 @@ export class SeasonalEventService {
protected christmasEventActive?: boolean = undefined; protected christmasEventActive?: boolean = undefined;
/** All events active at this point in time */ /** All events active at this point in time */
protected currentlyActiveEvents: SeasonalEventType[] = []; protected currentlyActiveEvents: ISeasonalEvent[] = [];
constructor( constructor(
@inject("PrimaryLogger") protected logger: ILogger, @inject("PrimaryLogger") protected logger: ILogger,
@ -223,7 +223,7 @@ export class SeasonalEventService {
if (!event.enabled) { if (!event.enabled) {
continue; continue;
} }
this.currentlyActiveEvents.push(SeasonalEventType[event.type]); this.currentlyActiveEvents.push(event);
if (SeasonalEventType[event.type] === SeasonalEventType.CHRISTMAS) { if (SeasonalEventType[event.type] === SeasonalEventType.CHRISTMAS) {
this.christmasEventActive = true; this.christmasEventActive = true;
@ -337,28 +337,33 @@ export class SeasonalEventService {
* @param globalConfig globals.json * @param globalConfig globals.json
* @param eventName Name of the event to enable. e.g. Christmas * @param eventName Name of the event to enable. e.g. Christmas
*/ */
protected updateGlobalEvents(globalConfig: IConfig, eventType: SeasonalEventType): void { protected updateGlobalEvents(globalConfig: IConfig, event: ISeasonalEvent): void {
this.logger.success(`${eventType} event is active`); this.logger.success(`event: ${event.type} is active`);
switch (eventType.toLowerCase()) { switch (event.type.toLowerCase()) {
case SeasonalEventType.HALLOWEEN.toLowerCase(): case SeasonalEventType.HALLOWEEN.toLowerCase():
globalConfig.EventType = globalConfig.EventType.filter((x) => x !== "None"); globalConfig.EventType = globalConfig.EventType.filter((x) => x !== "None");
globalConfig.EventType.push("Halloween"); globalConfig.EventType.push("Halloween");
globalConfig.EventType.push("HalloweenIllumination"); globalConfig.EventType.push("HalloweenIllumination");
globalConfig.Health.ProfileHealthSettings.DefaultStimulatorBuff = "Buffs_Halloween"; globalConfig.Health.ProfileHealthSettings.DefaultStimulatorBuff = "Buffs_Halloween";
this.addEventGearToBots(eventType); this.addEventGearToBots(event.type);
this.adjustZryachiyMeleeChance(); this.adjustZryachiyMeleeChance();
if (event.settings?.enableSummoning) {
this.enableHalloweenSummonEvent(); this.enableHalloweenSummonEvent();
this.addEventBossesToMaps(eventType); this.addEventBossesToMaps(event.type);
}
this.addPumpkinsToScavBackpacks(); this.addPumpkinsToScavBackpacks();
this.adjustTraderIcons(eventType); this.adjustTraderIcons(event.type);
break; break;
case SeasonalEventType.CHRISTMAS.toLowerCase(): case SeasonalEventType.CHRISTMAS.toLowerCase():
globalConfig.EventType = globalConfig.EventType.filter((x) => x !== "None"); globalConfig.EventType = globalConfig.EventType.filter((x) => x !== "None");
globalConfig.EventType.push("Christmas"); globalConfig.EventType.push("Christmas");
this.addEventGearToBots(eventType); this.addEventGearToBots(event.type);
if (event.settings?.enableSanta) {
this.addGifterBotToMaps(); this.addGifterBotToMaps();
this.addLootItemsToGifterDropItemsList(); this.addLootItemsToGifterDropItemsList();
}
this.enableDancingTree(); this.enableDancingTree();
break; break;
case SeasonalEventType.NEW_YEARS.toLowerCase(): case SeasonalEventType.NEW_YEARS.toLowerCase():
@ -375,7 +380,7 @@ export class SeasonalEventService {
break; break;
default: default:
// Likely a mod event // Likely a mod event
this.addEventGearToBots(eventType); this.addEventGearToBots(event.type);
break; break;
} }
} }
@ -384,7 +389,7 @@ export class SeasonalEventService {
if (this.currentlyActiveEvents) { if (this.currentlyActiveEvents) {
const globalConfig = this.databaseService.getGlobals().config; const globalConfig = this.databaseService.getGlobals().config;
for (const event of this.currentlyActiveEvents) { for (const event of this.currentlyActiveEvents) {
switch (event.toLowerCase()) { switch (event.type.toLowerCase()) {
case SeasonalEventType.CHRISTMAS.toLowerCase(): case SeasonalEventType.CHRISTMAS.toLowerCase():
this.giveGift(sessionId, "Christmas2022"); this.giveGift(sessionId, "Christmas2022");
break; break;