Fixed accepting a quest bringing in blacklisted event quests
(cherry picked from commit fe614ad73f
)
This commit is contained in:
parent
6378ee5ee7
commit
007b1d4789
@ -18,7 +18,6 @@ import { IHandoverQuestRequestData } from "@spt/models/eft/quests/IHandoverQuest
|
||||
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||
import { MessageType } from "@spt/models/enums/MessageType";
|
||||
import { QuestStatus } from "@spt/models/enums/QuestStatus";
|
||||
import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType";
|
||||
import { IQuestConfig } from "@spt/models/spt/config/IQuestConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
import { EventOutputHolder } from "@spt/routers/EventOutputHolder";
|
||||
@ -28,7 +27,6 @@ import { LocaleService } from "@spt/services/LocaleService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
import { PlayerService } from "@spt/services/PlayerService";
|
||||
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -53,7 +51,6 @@ export class QuestController
|
||||
@inject("QuestConditionHelper") protected questConditionHelper: QuestConditionHelper,
|
||||
@inject("PlayerService") protected playerService: PlayerService,
|
||||
@inject("LocaleService") protected localeService: LocaleService,
|
||||
@inject("SeasonalEventService") protected seasonalEventService: SeasonalEventService,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
@inject("PrimaryCloner") protected cloner: ICloner,
|
||||
@ -92,7 +89,7 @@ export class QuestController
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this.showEventQuestToPlayer(quest._id))
|
||||
if (!this.questHelper.showEventQuestToPlayer(quest._id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -235,46 +232,6 @@ export class QuestController
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a quest be shown to the player in trader quest screen
|
||||
* @param questId Quest to check
|
||||
* @returns true = show to player
|
||||
*/
|
||||
protected showEventQuestToPlayer(questId: string): boolean
|
||||
{
|
||||
const isChristmasEventActive = this.seasonalEventService.christmasEventEnabled();
|
||||
const isHalloweenEventActive = this.seasonalEventService.halloweenEventEnabled();
|
||||
|
||||
// Not christmas + quest is for christmas
|
||||
if (
|
||||
!isChristmasEventActive
|
||||
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.CHRISTMAS)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not halloween + quest is for halloween
|
||||
if (
|
||||
!isHalloweenEventActive
|
||||
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.HALLOWEEN)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Should non-season event quests be shown to player
|
||||
if (
|
||||
!this.questConfig.showNonSeasonalEventQuests
|
||||
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.NONE)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle QuestAccept event
|
||||
* Handle the client accepting a quest and starting it
|
||||
|
@ -18,6 +18,7 @@ import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
|
||||
import { MessageType } from "@spt/models/enums/MessageType";
|
||||
import { QuestRewardType } from "@spt/models/enums/QuestRewardType";
|
||||
import { QuestStatus } from "@spt/models/enums/QuestStatus";
|
||||
import { SeasonalEventType } from "@spt/models/enums/SeasonalEventType";
|
||||
import { SkillTypes } from "@spt/models/enums/SkillTypes";
|
||||
import { IQuestConfig } from "@spt/models/spt/config/IQuestConfig";
|
||||
import { ILogger } from "@spt/models/spt/utils/ILogger";
|
||||
@ -27,6 +28,7 @@ import { DatabaseService } from "@spt/services/DatabaseService";
|
||||
import { LocaleService } from "@spt/services/LocaleService";
|
||||
import { LocalisationService } from "@spt/services/LocalisationService";
|
||||
import { MailSendService } from "@spt/services/MailSendService";
|
||||
import { SeasonalEventService } from "@spt/services/SeasonalEventService";
|
||||
import { ICloner } from "@spt/utils/cloners/ICloner";
|
||||
import { HashUtil } from "@spt/utils/HashUtil";
|
||||
import { TimeUtil } from "@spt/utils/TimeUtil";
|
||||
@ -50,6 +52,7 @@ export class QuestHelper
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("PaymentHelper") protected paymentHelper: PaymentHelper,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@inject("SeasonalEventService") protected seasonalEventService: SeasonalEventService,
|
||||
@inject("TraderHelper") protected traderHelper: TraderHelper,
|
||||
@inject("PresetHelper") protected presetHelper: PresetHelper,
|
||||
@inject("MailSendService") protected mailSendService: MailSendService,
|
||||
@ -472,12 +475,12 @@ export class QuestHelper
|
||||
{
|
||||
// Quest is accessible to player when the accepted quest passed into param is started
|
||||
// e.g. Quest A passed in, quest B is looped over and has requirement of A to be started, include it
|
||||
const acceptedQuestCondition = quest.conditions.AvailableForStart.find((x) =>
|
||||
const acceptedQuestCondition = quest.conditions.AvailableForStart.find((condition) =>
|
||||
{
|
||||
return (
|
||||
x.conditionType === "Quest"
|
||||
&& x.target?.includes(startedQuestId)
|
||||
&& x.status?.includes(QuestStatus.Started)
|
||||
condition.conditionType === "Quest"
|
||||
&& condition.target?.includes(startedQuestId)
|
||||
&& condition.status?.includes(QuestStatus.Started)
|
||||
);
|
||||
});
|
||||
|
||||
@ -487,6 +490,12 @@ export class QuestHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip locked event quests
|
||||
if (!this.showEventQuestToPlayer(quest._id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip quest if its flagged as for other side
|
||||
if (this.questIsForOtherSide(profile.Info.Side, quest._id))
|
||||
{
|
||||
@ -525,6 +534,46 @@ export class QuestHelper
|
||||
return this.getQuestsWithOnlyLevelRequirementStartCondition(eligibleQuests);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a seasonal/event quest be shown to the player
|
||||
* @param questId Quest to check
|
||||
* @returns true = show to player
|
||||
*/
|
||||
public showEventQuestToPlayer(questId: string): boolean
|
||||
{
|
||||
const isChristmasEventActive = this.seasonalEventService.christmasEventEnabled();
|
||||
const isHalloweenEventActive = this.seasonalEventService.halloweenEventEnabled();
|
||||
|
||||
// Not christmas + quest is for christmas
|
||||
if (
|
||||
!isChristmasEventActive
|
||||
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.CHRISTMAS)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Not halloween + quest is for halloween
|
||||
if (
|
||||
!isHalloweenEventActive
|
||||
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.HALLOWEEN)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Should non-season event quests be shown to player
|
||||
if (
|
||||
!this.questConfig.showNonSeasonalEventQuests
|
||||
&& this.seasonalEventService.isQuestRelatedToEvent(questId, SeasonalEventType.NONE)
|
||||
)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the quest for the opposite side the player is on
|
||||
* @param playerSide Player side (usec/bear)
|
||||
|
Loading…
Reference in New Issue
Block a user