fix getting new quests on accepting others, fix dialog type and null guards
This commit is contained in:
@@ -408,7 +408,7 @@ public class BotController(
|
||||
|
||||
public int GetBotCap(string location)
|
||||
{
|
||||
var botCap = _botConfig.MaxBotCap[location.ToLower()];
|
||||
var botCap = _botConfig.MaxBotCap.GetValueOrDefault(location);
|
||||
if (location == "default")
|
||||
{
|
||||
_logger.Warning(
|
||||
|
||||
@@ -336,7 +336,7 @@ public class QuestHelper(
|
||||
{
|
||||
return (
|
||||
condition.ConditionType == "Quest" &&
|
||||
(condition.Target?.Item?.Contains(startedQuestId) ?? false) &&
|
||||
((condition.Target?.Item?.Contains(startedQuestId) ?? false) || (condition.Target?.List?.Contains(startedQuestId) ?? false))&&
|
||||
(condition.Status?.Contains(QuestStatusEnum.Started) ?? false)
|
||||
);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ public class QuestHelper(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!QuestIsProfileWhitelisted(profile.Info.GameVersion, quest.Id))
|
||||
if (QuestIsProfileWhitelisted(profile.Info.GameVersion, quest.Id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -949,8 +949,7 @@ public class QuestHelper(
|
||||
public ItemEventRouterResponse CompleteQuest(PmcData pmcData, CompleteQuestRequestData body, string sessionID)
|
||||
{
|
||||
var completeQuestResponse = _eventOutputHolder.GetOutput(sessionID);
|
||||
|
||||
var completedQuest = GetQuestFromDb(body.QuestId, pmcData);
|
||||
|
||||
var preCompleteProfileQuests = _cloner.Clone(pmcData.Quests);
|
||||
|
||||
var completedQuestId = body.QuestId;
|
||||
@@ -1008,10 +1007,7 @@ public class QuestHelper(
|
||||
{
|
||||
completeQuestResponse.ProfileChanges[sessionID].QuestsStatus.AddRange(questStatusChanges);
|
||||
}
|
||||
|
||||
// Recalculate level in event player leveled up
|
||||
pmcData.Info.Level = _playerService.CalculateLevel(pmcData);
|
||||
|
||||
|
||||
return completeQuestResponse;
|
||||
}
|
||||
|
||||
@@ -1326,8 +1322,8 @@ public class QuestHelper(
|
||||
{
|
||||
// If quest has prereq of completed quest + availableAfter value > 0 (quest has wait time)
|
||||
var nextQuestWaitCondition = quest.Conditions?.AvailableForStart?.FirstOrDefault(
|
||||
x => (x.Target?.List?.Contains(completedQuestId) ?? false) && x.AvailableAfter > 0
|
||||
);
|
||||
x => ((x.Target?.List?.Contains(completedQuestId) ?? false) || (x.Target?.Item?.Contains(completedQuestId) ?? false)) && x.AvailableAfter > 0
|
||||
); // as we have to use the ListOrT type now, check both List and Item for the above checks
|
||||
|
||||
if (nextQuestWaitCondition is not null)
|
||||
{
|
||||
|
||||
@@ -13,44 +13,20 @@ using SptCommon.Annotations;
|
||||
namespace Core.Helpers
|
||||
{
|
||||
[Injectable]
|
||||
public class RewardHelper
|
||||
public class RewardHelper(
|
||||
ISptLogger<RewardHelper> _logger,
|
||||
HashUtil _hashUtil,
|
||||
TimeUtil _timeUtil,
|
||||
ItemHelper _itemHelper,
|
||||
DatabaseService _databaseService,
|
||||
ProfileHelper _profileHelper,
|
||||
LocalisationService _localisationService,
|
||||
TraderHelper _traderHelper,
|
||||
PresetHelper _presetHelper,
|
||||
ICloner _cloner,
|
||||
PlayerService _playerService
|
||||
)
|
||||
{
|
||||
private readonly ISptLogger<RewardHelper> _logger;
|
||||
private readonly HashUtil _hashUtil;
|
||||
private readonly TimeUtil _timeUtil;
|
||||
private readonly ItemHelper _itemHelper;
|
||||
private readonly DatabaseService _databaseService;
|
||||
private readonly ProfileHelper _profileHelper;
|
||||
private readonly LocalisationService _localisationService;
|
||||
private readonly TraderHelper _traderHelper;
|
||||
private readonly PresetHelper _presetHelper;
|
||||
private readonly ICloner _cloner;
|
||||
|
||||
public RewardHelper(
|
||||
ISptLogger<RewardHelper> logger,
|
||||
HashUtil hashUtil,
|
||||
TimeUtil timeUtil,
|
||||
ItemHelper itemHelper,
|
||||
DatabaseService databaseService,
|
||||
ProfileHelper profileHelper,
|
||||
LocalisationService localisationService,
|
||||
TraderHelper traderHelper,
|
||||
PresetHelper presetHelper,
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
_logger = logger;
|
||||
_hashUtil = hashUtil;
|
||||
_timeUtil = timeUtil;
|
||||
_itemHelper = itemHelper;
|
||||
_databaseService = databaseService;
|
||||
_profileHelper = profileHelper;
|
||||
_localisationService = localisationService;
|
||||
_traderHelper = traderHelper;
|
||||
_presetHelper = presetHelper;
|
||||
_cloner = cloner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the given rewards to the passed in profile
|
||||
* @param rewards List of rewards to apply
|
||||
@@ -102,6 +78,8 @@ namespace Core.Helpers
|
||||
sessionId,
|
||||
int.Parse(reward.Value.ToString())
|
||||
); // this must occur first as the output object needs to take the modified profile exp value
|
||||
// Recalculate level in event player leveled up
|
||||
pmcProfile.Info.Level = _playerService.CalculateLevel(pmcProfile);
|
||||
break;
|
||||
case RewardType.TraderStanding:
|
||||
_traderHelper.AddStandingToTrader(
|
||||
|
||||
@@ -5,6 +5,6 @@ namespace Core.Models.Eft.Dialog;
|
||||
|
||||
public record SetDialogReadRequestData : IRequestData
|
||||
{
|
||||
[JsonPropertyName("dialogId")]
|
||||
[JsonPropertyName("dialogs")]
|
||||
public List<string>? Dialogs { get; set; }
|
||||
}
|
||||
|
||||
@@ -60,7 +60,8 @@ public class SptWebSocketConnectionHandler(
|
||||
}
|
||||
|
||||
// Once the websocket dies, we dispose of it
|
||||
_logger.Debug(_localisationService.GetText("websocket-socket_lost_deleting_handle"));
|
||||
//_logger.Debug(_localisationService.GetText("websocket-socket_lost_deleting_handle"));
|
||||
// this is expected and relayed via "Player has disconnected" i dont think this is needed
|
||||
lock (_lockObject)
|
||||
{
|
||||
if (_socketAliveTimers.TryGetValue(sessionID, out var timer))
|
||||
|
||||
Reference in New Issue
Block a user