Add extra repeatable support for prestige
Should have all the null handling required to work with existing profiles
This commit is contained in:
@@ -415,7 +415,7 @@ public class RepeatableQuestController(
|
||||
var questTypePool = GenerateQuestPool(repeatableConfig, pmcData.Info.Level);
|
||||
|
||||
// Add repeatable quests of this loops sub-type (daily/weekly)
|
||||
for (var i = 0; i < GetQuestCount(repeatableConfig, pmcData); i++)
|
||||
for (var i = 0; i < GetQuestCount(repeatableConfig, fullProfile); i++)
|
||||
{
|
||||
var quest = new RepeatableQuest();
|
||||
var lifeline = 0;
|
||||
@@ -780,9 +780,10 @@ public class RepeatableQuestController(
|
||||
/// Get count of repeatable quests profile should have access to
|
||||
/// </summary>
|
||||
/// <param name="repeatableConfig"></param>
|
||||
/// <param name="fullProfile"></param>
|
||||
/// <param name="pmcData">Player profile</param>
|
||||
/// <returns>Quest count</returns>
|
||||
protected int GetQuestCount(RepeatableQuestConfig repeatableConfig, PmcData pmcData)
|
||||
protected int GetQuestCount(RepeatableQuestConfig repeatableConfig, SptProfile fullProfile)
|
||||
{
|
||||
var questCount = repeatableConfig.NumQuests.GetValueOrDefault(0);
|
||||
if (questCount == 0)
|
||||
@@ -791,7 +792,7 @@ public class RepeatableQuestController(
|
||||
}
|
||||
|
||||
// Add elite bonus to daily quests
|
||||
if (string.Equals(repeatableConfig.Name, "daily", StringComparison.OrdinalIgnoreCase) && _profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, pmcData))
|
||||
if (string.Equals(repeatableConfig.Name, "daily", StringComparison.OrdinalIgnoreCase) && _profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, fullProfile.CharacterData.PmcData))
|
||||
// Elite charisma skill gives extra daily quest(s)
|
||||
{
|
||||
questCount += _databaseService
|
||||
@@ -805,13 +806,8 @@ public class RepeatableQuestController(
|
||||
.GetValueOrDefault(0);
|
||||
}
|
||||
|
||||
// Prestige level 2 gives additional daily and weekly
|
||||
// do the logic for all other than "daily_savage"
|
||||
// use bigger than or equal incase modders add more
|
||||
if (repeatableConfig.Name.ToLower() != "daily_savage" && pmcData.Info.PrestigeLevel >= 2)
|
||||
{
|
||||
questCount++;
|
||||
}
|
||||
// Add any extra repeatable quests the profile has unlocked
|
||||
questCount += (int)fullProfile.SptData.ExtraRepeatableQuests.GetValueOrDefault(repeatableConfig.Id, 0);
|
||||
|
||||
return questCount;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace SPTarkov.Server.Core.Helpers
|
||||
}
|
||||
case RewardType.ExtraDailyQuest:
|
||||
{
|
||||
_logger.Info("additional quests will be added when generating repeatables");
|
||||
_profileHelper.AddExtraRepeatableQuest(newProfile, reward.Target, (double)reward.Value);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -730,4 +730,20 @@ public class ProfileHelper(
|
||||
fullProfile.CustomisationUnlocks.Add(rewardToStore);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add the given number of extra repeatable quests for the given type of repeatable to the users profile
|
||||
/// </summary>
|
||||
/// <param name="fullProfile">Profile to add the extra repeatable to</param>
|
||||
/// <param name="repeatableId">The ID of the type of repeatable to increase</param>
|
||||
/// <param name="rewardValue">The number of extra repeatables to add</param>
|
||||
public void AddExtraRepeatableQuest(SptProfile fullProfile, string repeatableId, double rewardValue)
|
||||
{
|
||||
fullProfile.SptData.ExtraRepeatableQuests ??= new Dictionary<string, double>();
|
||||
|
||||
if (!fullProfile.SptData.ExtraRepeatableQuests.TryAdd(repeatableId, 0))
|
||||
{
|
||||
fullProfile.SptData.ExtraRepeatableQuests[repeatableId] += rewardValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -779,6 +779,13 @@ public record Spt
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[JsonPropertyName("extraRepeatableQuests")]
|
||||
public Dictionary<string, double>? ExtraRepeatableQuests
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public record AcceptedCultistReward
|
||||
|
||||
Reference in New Issue
Block a user