Improve seasonal system to give gifts during event
Add additional equipment to PMCs when event is active
This commit is contained in:
parent
3378d2f6fb
commit
41ef304d97
@ -48,33 +48,25 @@
|
||||
|
||||
]
|
||||
},
|
||||
"Halloween 2023": {
|
||||
"items": [{
|
||||
"_id": "1274650827982e40930946f4",
|
||||
"_tpl": "6389c6463485cf0eeb260715",
|
||||
"upd": {
|
||||
"StackObjectsCount": 30
|
||||
},
|
||||
"parentId": "64b99751053fc8a45106fa55"
|
||||
}
|
||||
],
|
||||
"sender": "System",
|
||||
"messageText": "Halloween Event Text",
|
||||
"timestampToSend": 42069,
|
||||
"collectionTimeHours": 48,
|
||||
"associatedEvent": "Halloween"
|
||||
},
|
||||
"Christmas 2022": {
|
||||
"items": [{
|
||||
"Christmas2022": {
|
||||
"items": [
|
||||
{
|
||||
"_id": "a89075c1a18874dd6404a6d7",
|
||||
"_tpl": "5aafbde786f774389d0cbc0f",
|
||||
"upd": {
|
||||
"StackObjectsCount": 5
|
||||
"StackObjectsCount": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"_id": "a89075c1b188g4dd6404a3d7",
|
||||
"_tpl": "6389c6463485cf0eeb260715",
|
||||
"upd": {
|
||||
"StackObjectsCount": 1
|
||||
}
|
||||
},
|
||||
],
|
||||
"sender": "System",
|
||||
"messageText": "Christmas Event Text",
|
||||
"messageText": "Merry christmas!",
|
||||
"timestampToSend": 42069,
|
||||
"associatedEvent": "Christmas"
|
||||
},
|
||||
|
@ -12,7 +12,9 @@
|
||||
"62a5c2c98ec41a51b34739c0": 1,
|
||||
"62a5c333ec21e50cad3b5dc6": 1,
|
||||
"62a5c41e8ec41a51b34739c3": 1,
|
||||
"635267ab3c89e2112001f826": 1
|
||||
"635267ab3c89e2112001f826": 1,
|
||||
"5bd06f5d86f77427101ad47c": 1,
|
||||
"5e54f79686f7744022011103": 1
|
||||
},
|
||||
"Headwear": {
|
||||
"59ef13ca86f77445fd0e2483": 2
|
||||
@ -22,7 +24,43 @@
|
||||
"Scabbard": {
|
||||
"63495c500c297e20065a08b1": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"bear": {
|
||||
"FaceCover": {
|
||||
"5bd071d786f7747e707b93a3": 5,
|
||||
"5bd0716d86f774171822ef4b": 5,
|
||||
"5bd06f5d86f77427101ad47c": 5,
|
||||
"6176a48d732a664031271438": 5,
|
||||
"6176a40f0b8c0312ac75a3d3": 5,
|
||||
"62a5c2c98ec41a51b34739c0": 5,
|
||||
"62a5c333ec21e50cad3b5dc6": 5,
|
||||
"62a5c41e8ec41a51b34739c3": 5,
|
||||
"635267ab3c89e2112001f826": 5,
|
||||
"5bd06f5d86f77427101ad47c": 5,
|
||||
"5e54f79686f7744022011103": 5
|
||||
},
|
||||
"Headwear": {
|
||||
"59ef13ca86f77445fd0e2483": 25
|
||||
}
|
||||
},
|
||||
"usec": {
|
||||
"FaceCover": {
|
||||
"5bd071d786f7747e707b93a3": 5,
|
||||
"5bd0716d86f774171822ef4b": 5,
|
||||
"5bd06f5d86f77427101ad47c": 5,
|
||||
"6176a48d732a664031271438": 5,
|
||||
"6176a40f0b8c0312ac75a3d3": 5,
|
||||
"62a5c2c98ec41a51b34739c0": 5,
|
||||
"62a5c333ec21e50cad3b5dc6": 5,
|
||||
"62a5c41e8ec41a51b34739c3": 5,
|
||||
"635267ab3c89e2112001f826": 5,
|
||||
"5bd06f5d86f77427101ad47c": 5,
|
||||
"5e54f79686f7744022011103": 5
|
||||
},
|
||||
"Headwear": {
|
||||
"59ef13ca86f77445fd0e2483": 25
|
||||
}
|
||||
}
|
||||
},
|
||||
"christmas": {
|
||||
"bossgluhar": {
|
||||
@ -230,6 +268,13 @@
|
||||
"startMonth": "12",
|
||||
"endDay": "31",
|
||||
"endMonth": "12"
|
||||
}, {
|
||||
"name": "newyears",
|
||||
"type": "NEW_YEARS",
|
||||
"startDay": "1",
|
||||
"startMonth": "1",
|
||||
"endDay": "7",
|
||||
"endMonth": "1"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ export class GameController
|
||||
|
||||
if (this.seasonalEventService.isAutomaticEventDetectionEnabled())
|
||||
{
|
||||
this.seasonalEventService.checkForAndEnableSeasonalEvents();
|
||||
this.seasonalEventService.checkForAndEnableSeasonalEvents(sessionID);
|
||||
}
|
||||
|
||||
if (pmcProfile?.Skills?.Common)
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { inject, injectable } from "tsyringe";
|
||||
|
||||
import { BotHelper } from "../helpers/BotHelper";
|
||||
import { ProfileHelper } from "../helpers/ProfileHelper";
|
||||
import { IConfig } from "../models/eft/common/IGlobals";
|
||||
import { Inventory } from "../models/eft/common/tables/IBotType";
|
||||
import { ConfigTypes } from "../models/enums/ConfigTypes";
|
||||
@ -13,6 +14,7 @@ import { ILogger } from "../models/spt/utils/ILogger";
|
||||
import { ConfigServer } from "../servers/ConfigServer";
|
||||
import { DatabaseServer } from "../servers/DatabaseServer";
|
||||
import { DatabaseImporter } from "../utils/DatabaseImporter";
|
||||
import { GiftService } from "./GiftService";
|
||||
import { LocalisationService } from "./LocalisationService";
|
||||
|
||||
@injectable()
|
||||
@ -26,8 +28,10 @@ export class SeasonalEventService
|
||||
@inject("WinstonLogger") protected logger: ILogger,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("DatabaseImporter") protected databaseImporter: DatabaseImporter,
|
||||
@inject("GiftService") protected giftService: GiftService,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@inject("BotHelper") protected botHelper: BotHelper,
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer
|
||||
)
|
||||
{
|
||||
@ -213,8 +217,9 @@ export class SeasonalEventService
|
||||
|
||||
/**
|
||||
* Check if current date falls inside any of the seasons events pased in, if so, handle them
|
||||
* @param sessionId Players id
|
||||
*/
|
||||
public checkForAndEnableSeasonalEvents(): void
|
||||
public checkForAndEnableSeasonalEvents(sessionId: string): void
|
||||
{
|
||||
const globalConfig = this.databaseServer.getTables().globals.config;
|
||||
const currentDate = new Date();
|
||||
@ -229,7 +234,7 @@ export class SeasonalEventService
|
||||
if (currentDate >= eventStartDate
|
||||
&& currentDate <= eventEndDate)
|
||||
{
|
||||
this.updateGlobalEvents(globalConfig, event.type);
|
||||
this.updateGlobalEvents(sessionId, globalConfig, event.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -272,10 +277,11 @@ export class SeasonalEventService
|
||||
|
||||
/**
|
||||
* 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(globalConfig: IConfig, eventType: SeasonalEventType): void
|
||||
protected updateGlobalEvents(sessionId: string, globalConfig: IConfig, eventType: SeasonalEventType): void
|
||||
{
|
||||
switch (eventType.toLowerCase())
|
||||
{
|
||||
@ -286,7 +292,7 @@ export class SeasonalEventService
|
||||
globalConfig.Health.ProfileHealthSettings.DefaultStimulatorBuff = "Buffs_Halloween";
|
||||
this.addEventGearToBots(eventType);
|
||||
this.addPumpkinsToScavBackpacks();
|
||||
//this.adjustTraderIcons(eventType);
|
||||
this.adjustTraderIcons(eventType);
|
||||
break;
|
||||
case SeasonalEventType.CHRISTMAS.toLowerCase():
|
||||
globalConfig.EventType = globalConfig.EventType.filter(x => x !== "None");
|
||||
@ -295,6 +301,10 @@ export class SeasonalEventService
|
||||
this.addGifterBotToMaps();
|
||||
this.addLootItemsToGifterDropItemsList();
|
||||
this.enableDancingTree();
|
||||
this.giveGift(sessionId, "Christmas2022");
|
||||
break;
|
||||
case SeasonalEventType.NEW_YEARS.toLowerCase():
|
||||
this.giveGift(sessionId, "NewYear2021");
|
||||
break;
|
||||
default:
|
||||
// Likely a mod event
|
||||
@ -436,4 +446,18 @@ export class SeasonalEventService
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
if (!this.profileHelper.playerHasRecievedGift(playerId, giftkey))
|
||||
{
|
||||
this.giftService.sendGiftToPlayer(playerId, giftkey);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user