ScavXpCounts/types/services/SeasonalEventService.d.ts

160 lines
6.7 KiB
TypeScript
Raw Normal View History

2024-11-12 11:51:30 -07:00
import { BotHelper } from "@spt/helpers/BotHelper";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";
import { IConfig } from "@spt/models/eft/common/IGlobals";
import { Inventory } from "@spt/models/eft/common/tables/IBotType";
import { Season } from "@spt/models/enums/Season";
import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType";
import { IHttpConfig } from "@spt/models/spt/config/IHttpConfig";
import { IQuestConfig } from "@spt/models/spt/config/IQuestConfig";
import { ISeasonalEvent, ISeasonalEventConfig } from "@spt/models/spt/config/ISeasonalEventConfig";
import { IWeatherConfig } from "@spt/models/spt/config/IWeatherConfig";
import { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { DatabaseService } from "@spt/services/DatabaseService";
import { GiftService } from "@spt/services/GiftService";
import { LocalisationService } from "@spt/services/LocalisationService";
import { DatabaseImporter } from "@spt/utils/DatabaseImporter";
2023-08-17 19:49:16 -06:00
export declare class SeasonalEventService {
protected logger: ILogger;
2024-11-12 11:51:30 -07:00
protected databaseService: DatabaseService;
2023-08-17 19:49:16 -06:00
protected databaseImporter: DatabaseImporter;
protected giftService: GiftService;
protected localisationService: LocalisationService;
protected botHelper: BotHelper;
protected profileHelper: ProfileHelper;
protected configServer: ConfigServer;
protected seasonalEventConfig: ISeasonalEventConfig;
protected questConfig: IQuestConfig;
protected httpConfig: IHttpConfig;
2024-04-19 21:23:52 -06:00
protected weatherConfig: IWeatherConfig;
2024-11-12 11:51:30 -07:00
protected halloweenEventActive?: boolean;
protected christmasEventActive?: boolean;
2024-04-19 21:23:52 -06:00
/** All events active at this point in time */
protected currentlyActiveEvents: SeasonalEventType[];
2024-11-12 11:51:30 -07:00
constructor(logger: ILogger, databaseService: DatabaseService, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer);
2023-08-17 19:49:16 -06:00
protected get christmasEventItems(): string[];
protected get halloweenEventItems(): string[];
/**
* Get an array of christmas items found in bots inventories as loot
* @returns array
*/
getChristmasEventItems(): string[];
/**
* Get an array of halloween items found in bots inventories as loot
* @returns array
*/
getHalloweenEventItems(): string[];
itemIsChristmasRelated(itemTpl: string): boolean;
itemIsHalloweenRelated(itemTpl: string): boolean;
/**
* Check if item id exists in christmas or halloween event arrays
* @param itemTpl item tpl to check for
* @returns
*/
itemIsSeasonalRelated(itemTpl: string): boolean;
/**
2024-04-19 21:23:52 -06:00
* Get an array of seasonal items that should not appear
* e.g. if halloween is active, only return christmas items
* or, if halloween and christmas are inactive, return both sets of items
2023-08-17 19:49:16 -06:00
* @returns array of tpl strings
*/
2024-04-19 21:23:52 -06:00
getInactiveSeasonalEventItems(): string[];
2023-08-17 19:49:16 -06:00
/**
* Is a seasonal event currently active
* @returns true if event is active
*/
seasonalEventEnabled(): boolean;
/**
2024-02-23 15:06:00 -07:00
* Is christmas event active
2023-08-17 19:49:16 -06:00
* @returns true if active
*/
christmasEventEnabled(): boolean;
/**
2024-02-23 15:06:00 -07:00
* is halloween event active
2023-08-17 19:49:16 -06:00
* @returns true if active
*/
halloweenEventEnabled(): boolean;
/**
* Is detection of seasonal events enabled (halloween / christmas)
* @returns true if seasonal events should be checked for
*/
isAutomaticEventDetectionEnabled(): boolean;
/**
* Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween
* @param eventName Name of event to get gear changes for
* @returns bots with equipment changes
*/
protected getEventBotGear(eventType: SeasonalEventType): Record<string, Record<string, Record<string, number>>>;
/**
* Get the dates each seasonal event starts and ends at
* @returns Record with event name + start/end date
*/
getEventDetails(): ISeasonalEvent[];
/**
* Look up quest in configs/quest.json
* @param questId Quest to look up
* @param event event type (Christmas/Halloween/None)
* @returns true if related
*/
isQuestRelatedToEvent(questId: string, event: SeasonalEventType): boolean;
/**
2024-02-23 15:06:00 -07:00
* Handle seasonal events
2023-08-17 19:49:16 -06:00
* @param sessionId Players id
*/
2024-02-23 15:06:00 -07:00
enableSeasonalEvents(sessionId: string): void;
protected cacheActiveEvents(): void;
2024-11-12 11:51:30 -07:00
getActiveWeatherSeason(): Season;
2023-08-17 19:49:16 -06:00
/**
* Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService)
2024-04-19 21:23:52 -06:00
* @param botInventory Bots inventory to iterate over
2023-08-17 19:49:16 -06:00
* @param botRole the role of the bot being processed
*/
2024-04-19 21:23:52 -06:00
removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void;
2023-08-17 19:49:16 -06:00
/**
* Make adjusted to server code based on the name of the event passed in
* @param sessionId Player id
* @param globalConfig globals.json
* @param eventName Name of the event to enable. e.g. Christmas
*/
protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void;
2024-04-19 21:23:52 -06:00
protected adjustZryachiyMeleeChance(): void;
protected enableHalloweenSummonEvent(): void;
protected addEventBossesToMaps(eventType: SeasonalEventType): void;
2023-08-17 19:49:16 -06:00
/**
* Change trader icons to be more event themed (Halloween only so far)
* @param eventType What event is active
*/
protected adjustTraderIcons(eventType: SeasonalEventType): void;
/**
* Add lootble items from backpack into patrol.ITEMS_TO_DROP difficulty property
*/
protected addLootItemsToGifterDropItemsList(): void;
/**
* Read in data from seasonalEvents.json and add found equipment items to bots
* @param eventName Name of the event to read equipment in from config
*/
protected addEventGearToBots(eventType: SeasonalEventType): void;
protected addPumpkinsToScavBackpacks(): void;
/**
* Set Khorovod(dancing tree) chance to 100% on all maps that support it
*/
protected enableDancingTree(): void;
/**
* Add santa to maps
*/
protected addGifterBotToMaps(): void;
/**
* Send gift to player if they'e not already received it
* @param playerId Player to send gift to
2024-11-12 11:51:30 -07:00
* @param giftKey Key of gift to give
2023-08-17 19:49:16 -06:00
*/
2024-11-12 11:51:30 -07:00
protected giveGift(playerId: string, giftKey: string): void;
2024-04-19 21:23:52 -06:00
/**
* Get the underlying bot type for an event bot e.g. `peacefullZryachiyEvent` will return `bossZryachiy`
* @param eventBotRole Event bot role type
* @returns Bot role as string
*/
getBaseRoleForEventBot(eventBotRole: string): string;
enableSnow(): void;
2023-08-17 19:49:16 -06:00
}