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",
"startMonth": "10",
"endDay": "4",
"endMonth": "11"
"endMonth": "11",
"settings": {
"enableSummoning": true
}
},
{
"enabled": true,
@ -704,7 +707,10 @@
"startDay": "7",
"startMonth": "12",
"endDay": "31",
"endMonth": "12"
"endMonth": "12",
"settings": {
"enableSanta": true
}
},
{
"enabled": true,

View File

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

View File

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