Added seasonal item handling inside daily quest reward generation code

This commit is contained in:
Dev 2024-03-04 17:13:36 +00:00
parent 52ebdf7483
commit a5de871c92

View File

@ -40,6 +40,7 @@ import { ItemFilterService } from "@spt-aki/services/ItemFilterService";
import { LocalisationService } from "@spt-aki/services/LocalisationService"; import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { PaymentService } from "@spt-aki/services/PaymentService"; import { PaymentService } from "@spt-aki/services/PaymentService";
import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService"; import { ProfileFixerService } from "@spt-aki/services/ProfileFixerService";
import { SeasonalEventService } from "@spt-aki/services/SeasonalEventService";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { MathUtil } from "@spt-aki/utils/MathUtil"; import { MathUtil } from "@spt-aki/utils/MathUtil";
@ -72,6 +73,7 @@ export class RepeatableQuestGenerator
@inject("ObjectId") protected objectId: ObjectId, @inject("ObjectId") protected objectId: ObjectId,
@inject("ItemFilterService") protected itemFilterService: ItemFilterService, @inject("ItemFilterService") protected itemFilterService: ItemFilterService,
@inject("RepeatableQuestHelper") protected repeatableQuestHelper: RepeatableQuestHelper, @inject("RepeatableQuestHelper") protected repeatableQuestHelper: RepeatableQuestHelper,
@inject("SeasonalEventService") protected seasonalEventService: SeasonalEventService,
@inject("ConfigServer") protected configServer: ConfigServer, @inject("ConfigServer") protected configServer: ConfigServer,
) )
{ {
@ -1252,6 +1254,9 @@ export class RepeatableQuestGenerator
traderId: string, traderId: string,
): [string, ITemplateItem][] ): [string, ITemplateItem][]
{ {
// Get an array of seasonal items that should not be shown right now as seasonal event is not active
const seasonalItems = this.seasonalEventService.getInactiveSeasonalEventItems();
// check for specific baseclasses which don't make sense as reward item // check for specific baseclasses which don't make sense as reward item
// also check if the price is greater than 0; there are some items whose price can not be found // also check if the price is greater than 0; there are some items whose price can not be found
// those are not in the game yet (e.g. AGS grenade launcher) // those are not in the game yet (e.g. AGS grenade launcher)
@ -1265,7 +1270,14 @@ export class RepeatableQuestGenerator
return false; return false;
} }
const traderWhitelist = repeatableQuestConfig.traderWhitelist.find((x) => x.traderId === traderId); if (seasonalItems.includes(tpl))
{
return false;
}
const traderWhitelist = repeatableQuestConfig.traderWhitelist.find((trader) =>
trader.traderId === traderId
);
return this.isValidRewardItem(tpl, repeatableQuestConfig, traderWhitelist?.rewardBaseWhitelist); return this.isValidRewardItem(tpl, repeatableQuestConfig, traderWhitelist?.rewardBaseWhitelist);
}, },
); );