Fixed getNewlyAccessibleQuestsWhenStartingQuest()
not filtering out quests flagged for non-player side
This commit is contained in:
parent
fdbbc47e59
commit
2516354451
@ -88,7 +88,7 @@ export class QuestController
|
||||
}
|
||||
|
||||
// Filter out bear quests for usec and vice versa
|
||||
if (this.questIsForOtherSide(profile.Info.Side, quest._id))
|
||||
if (this.questHelper.questIsForOtherSide(profile.Info.Side, quest._id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -272,29 +272,6 @@ export class QuestController
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the quest for the opposite side the player is on
|
||||
* @param playerSide Player side (usec/bear)
|
||||
* @param questId QuestId to check
|
||||
*/
|
||||
protected questIsForOtherSide(playerSide: string, questId: string): boolean
|
||||
{
|
||||
const isUsec = playerSide.toLowerCase() === "usec";
|
||||
if (isUsec && this.questConfig.bearOnlyQuests.includes(questId))
|
||||
{
|
||||
// player is usec and quest is bear only, skip
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isUsec && this.questConfig.usecOnlyQuests.includes(questId))
|
||||
{
|
||||
// player is bear and quest is usec only, skip
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle QuestAccept event
|
||||
* Handle the client accepting a quest and starting it
|
||||
|
@ -464,7 +464,7 @@ export class QuestHelper
|
||||
{
|
||||
// Get quest acceptance data from profile
|
||||
const profile: IPmcData = this.profileHelper.getPmcProfile(sessionID);
|
||||
const startedQuestInProfile = profile.Quests.find((x) => x.qid === startedQuestId);
|
||||
const startedQuestInProfile = profile.Quests.find((profileQuest) => profileQuest.qid === startedQuestId);
|
||||
|
||||
// Get quests that
|
||||
const eligibleQuests = this.getQuestsFromDb().filter((quest) =>
|
||||
@ -484,6 +484,12 @@ export class QuestHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip quest if its flagged as for other side
|
||||
if (this.questIsForOtherSide(profile.Info.Side, quest._id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const standingRequirements = this.questConditionHelper.getStandingConditions(
|
||||
quest.conditions.AvailableForStart,
|
||||
);
|
||||
@ -514,6 +520,29 @@ export class QuestHelper
|
||||
return this.getQuestsWithOnlyLevelRequirementStartCondition(eligibleQuests);
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the quest for the opposite side the player is on
|
||||
* @param playerSide Player side (usec/bear)
|
||||
* @param questId QuestId to check
|
||||
*/
|
||||
public questIsForOtherSide(playerSide: string, questId: string): boolean
|
||||
{
|
||||
const isUsec = playerSide.toLowerCase() === "usec";
|
||||
if (isUsec && this.questConfig.bearOnlyQuests.includes(questId))
|
||||
{
|
||||
// player is usec and quest is bear only, skip
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isUsec && this.questConfig.usecOnlyQuests.includes(questId))
|
||||
{
|
||||
// player is bear and quest is usec only, skip
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get quests that can be shown to player after failing a quest
|
||||
* @param failedQuestId Id of the quest failed by player
|
||||
@ -890,10 +919,14 @@ export class QuestHelper
|
||||
);
|
||||
break;
|
||||
case QuestRewardType.EXPERIENCE:
|
||||
this.profileHelper.addExperienceToPmc(sessionId, parseInt(<string>reward.value)); // this must occur first as the output object needs to take the modified profile exp value
|
||||
this.profileHelper.addExperienceToPmc(sessionId, Number.parseInt(<string>reward.value)); // this must occur first as the output object needs to take the modified profile exp value
|
||||
break;
|
||||
case QuestRewardType.TRADER_STANDING:
|
||||
this.traderHelper.addStandingToTrader(sessionId, reward.target, parseFloat(<string>reward.value));
|
||||
this.traderHelper.addStandingToTrader(
|
||||
sessionId,
|
||||
reward.target,
|
||||
Number.parseFloat(<string>reward.value),
|
||||
);
|
||||
break;
|
||||
case QuestRewardType.TRADER_UNLOCK:
|
||||
this.traderHelper.setTraderUnlockedState(reward.target, true, sessionId);
|
||||
|
Loading…
Reference in New Issue
Block a user