Skip to main content
The Deno 2 Release Candidate is here
Learn more
class SeasonalEventService
import { SeasonalEventService } from "https://deno.land/x/sptaki@1.2.0/services/SeasonalEventService.d.ts";

Constructors

new
SeasonalEventService(
logger: ILogger,
databaseServer: DatabaseServer,
databaseImporter: DatabaseImporter,
giftService: GiftService,
localisationService: LocalisationService,
botHelper: BotHelper,
profileHelper: ProfileHelper,
configServer: ConfigServer,
)

Properties

protected
botHelper: BotHelper
protected
christmasEventActive: boolean
protected
readonly
christmasEventItems: string[]
protected
configServer: ConfigServer
protected
currentlyActiveEvents: SeasonalEventType[]

All events active at this point in time

protected
databaseImporter: DatabaseImporter
protected
databaseServer: DatabaseServer
protected
giftService: GiftService
protected
halloweenEventActive: boolean
protected
readonly
halloweenEventItems: string[]
protected
httpConfig: IHttpConfig
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
profileHelper: ProfileHelper
protected
questConfig: IQuestConfig
protected
seasonalEventConfig: ISeasonalEventConfig
protected
weatherConfig: IWeatherConfig

Methods

protected
addEventBossesToMaps(eventType: SeasonalEventType): void
protected
addEventGearToBots(eventType: SeasonalEventType): void

Read in data from seasonalEvents.json and add found equipment items to bots

protected
addGifterBotToMaps(): void

Add santa to maps

Add lootble items from backpack into patrol.ITEMS_TO_DROP difficulty property

protected
adjustTraderIcons(eventType: SeasonalEventType): void

Change trader icons to be more event themed (Halloween only so far)

protected
adjustZryachiyMeleeChance(): void
protected
cacheActiveEvents(): void
protected
enableDancingTree(): void

Set Khorovod(dancing tree) chance to 100% on all maps that support it

protected
getEventBotGear(eventType: SeasonalEventType): Record<string, Record<string, Record<string, number>>>

Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween

protected
giveGift(playerId: string, giftkey: string): void

Send gift to player if they'e not already received it

protected
updateGlobalEvents(
sessionId: string,
globalConfig: IConfig,
eventType: SeasonalEventType,
): void

Make adjusted to server code based on the name of the event passed in

Is christmas event active

enableSeasonalEvents(sessionId: string): void

Handle seasonal events

enableSnow(): void
getBaseRoleForEventBot(eventBotRole: string): string

Get the underlying bot type for an event bot e.g. peacefullZryachiyEvent will return bossZryachiy

Get an array of christmas items found in bots inventories as loot

Get the dates each seasonal event starts and ends at

Get an array of halloween items found in bots inventories as loot

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

is halloween event active

Is detection of seasonal events enabled (halloween / christmas)

isQuestRelatedToEvent(questId: string, event: SeasonalEventType): boolean

Look up quest in configs/quest.json

itemIsChristmasRelated(itemTpl: string): boolean
itemIsHalloweenRelated(itemTpl: string): boolean
itemIsSeasonalRelated(itemTpl: string): boolean

Check if item id exists in christmas or halloween event arrays

removeChristmasItemsFromBotInventory(botInventory: Inventory, botRole: string): void

Iterate through bots inventory and loot to find and remove christmas items (as defined in SeasonalEventService)

Is a seasonal event currently active