ClearVision/types/services/SeasonalEventService.d.ts

145 lines
6.1 KiB
TypeScript
Raw Normal View History

2023-05-18 15:57:25 -04:00
import { BotHelper } from "../helpers/BotHelper";
2023-09-02 22:34:11 -04:00
import { ProfileHelper } from "../helpers/ProfileHelper";
import { IConfig } from "../models/eft/common/IGlobals";
2023-05-18 15:57:25 -04:00
import { Inventory } from "../models/eft/common/tables/IBotType";
2023-09-02 22:34:11 -04:00
import { SeasonalEventType } from "../models/enums/SeasonalEventType";
import { IHttpConfig } from "../models/spt/config/IHttpConfig";
import { IQuestConfig } from "../models/spt/config/IQuestConfig";
2023-05-18 15:57:25 -04:00
import { ISeasonalEvent, ISeasonalEventConfig } from "../models/spt/config/ISeasonalEventConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
2023-09-02 22:34:11 -04:00
import { DatabaseImporter } from "../utils/DatabaseImporter";
import { GiftService } from "./GiftService";
2023-05-18 15:57:25 -04:00
import { LocalisationService } from "./LocalisationService";
export declare class SeasonalEventService {
protected logger: ILogger;
protected databaseServer: DatabaseServer;
2023-09-02 22:34:11 -04:00
protected databaseImporter: DatabaseImporter;
protected giftService: GiftService;
2023-05-18 15:57:25 -04:00
protected localisationService: LocalisationService;
protected botHelper: BotHelper;
2023-09-02 22:34:11 -04:00
protected profileHelper: ProfileHelper;
2023-05-18 15:57:25 -04:00
protected configServer: ConfigServer;
protected seasonalEventConfig: ISeasonalEventConfig;
2023-09-02 22:34:11 -04:00
protected questConfig: IQuestConfig;
protected httpConfig: IHttpConfig;
constructor(logger: ILogger, databaseServer: DatabaseServer, databaseImporter: DatabaseImporter, giftService: GiftService, localisationService: LocalisationService, botHelper: BotHelper, profileHelper: ProfileHelper, configServer: ConfigServer);
2023-05-18 15:57:25 -04: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;
/**
* Get an array of items that appear during a seasonal event
* returns multiple seasonal event items if they are both active
* @returns array of tpl strings
*/
getAllSeasonalEventItems(): string[];
/**
2023-09-02 22:34:11 -04:00
* Get an array of seasonal items that should be blocked as season is not currently active
2023-05-18 15:57:25 -04:00
* @returns Array of tpl strings
*/
getSeasonalEventItemsToBlock(): string[];
/**
* Is a seasonal event currently active
* @returns true if event is active
*/
seasonalEventEnabled(): boolean;
/**
2023-09-02 22:34:11 -04:00
* Is christmas event active (Globals eventtype array contains even name)
2023-05-18 15:57:25 -04:00
* @returns true if active
*/
christmasEventEnabled(): boolean;
/**
2023-09-02 22:34:11 -04:00
* is halloween event active (Globals eventtype array contains even name)
2023-05-18 15:57:25 -04: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
*/
2023-09-02 22:34:11 -04:00
protected getEventBotGear(eventType: SeasonalEventType): Record<string, Record<string, Record<string, number>>>;
2023-05-18 15:57:25 -04:00
/**
* Get the dates each seasonal event starts and ends at
* @returns Record with event name + start/end date
*/
getEventDetails(): ISeasonalEvent[];
2023-09-02 22:34:11 -04:00
/**
* 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;
2023-05-18 15:57:25 -04:00
/**
* Check if current date falls inside any of the seasons events pased in, if so, handle them
2023-09-02 22:34:11 -04:00
* @param sessionId Players id
2023-05-18 15:57:25 -04:00
*/
2023-09-02 22:34:11 -04:00
checkForAndEnableSeasonalEvents(sessionId: string): void;
2023-05-18 15:57:25 -04:00
/**
* Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService)
* @param nodeInventory Bots inventory to iterate over
* @param botRole the role of the bot being processed
*/
removeChristmasItemsFromBotInventory(nodeInventory: Inventory, botRole: string): void;
/**
* Make adjusted to server code based on the name of the event passed in
2023-09-02 22:34:11 -04:00
* @param sessionId Player id
2023-05-18 15:57:25 -04:00
* @param globalConfig globals.json
* @param eventName Name of the event to enable. e.g. Christmas
*/
2023-09-02 22:34:11 -04:00
protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void;
/**
* Change trader icons to be more event themed (Halloween only so far)
* @param eventType What event is active
*/
protected adjustTraderIcons(eventType: SeasonalEventType): void;
2023-05-18 15:57:25 -04:00
/**
* 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
*/
2023-09-02 22:34:11 -04:00
protected addEventGearToBots(eventType: SeasonalEventType): void;
2023-05-18 15:57:25 -04:00
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;
2023-09-02 22:34:11 -04:00
/**
* Send gift to player if they'e not already received it
* @param playerId Player to send gift to
* @param giftkey Key of gift to give
*/
protected giveGift(playerId: string, giftkey: string): void;
2023-05-18 15:57:25 -04:00
}