- Add min extract requirement property

- Fix warnings
- Convert string to mongoId
This commit is contained in:
Cj
2025-10-01 01:51:57 -04:00
parent d68a51f031
commit e57f03bd28
4 changed files with 32 additions and 10 deletions
@@ -518,7 +518,9 @@
],
"questConfig": {
"Exploration": {
"minExtracts": 1,
"maxExtracts": 4,
"minExtractsWithSpecificExit": 1,
"maxExtractsWithSpecificExit": 2,
"possibleSkillRewards": [
"Endurance",
@@ -1606,8 +1608,10 @@
],
"questConfig": {
"Exploration": {
"minExtracts": 5,
"maxExtracts": 15,
"maxExtractsWithSpecificExit": 4,
"minExtractsWithSpecificExit": 3,
"maxExtractsWithSpecificExit": 7,
"possibleSkillRewards": [
"Endurance",
"Strength",
@@ -2628,7 +2632,9 @@
"Strength",
"Vitality"
],
"minExtracts": 1,
"maxExtracts": 3,
"minExtractsWithSpecificExit": 1,
"maxExtractsWithSpecificExit": 1,
"specificExits": {
"chance": 20,
@@ -116,10 +116,10 @@ public class ExplorationQuestGenerator(
out LocationInfo? locationInfo
)
{
if (pool.Pool?.Exploration?.Locations?.Count is null or 0)
if (pool.Pool.Exploration.Locations?.Count is null or 0)
{
// there are no more locations left for exploration; delete it as a possible quest type
pool.Types = pool.Types?.Where(t => t != "Exploration").ToList();
pool.Types = pool.Types.Where(t => t != "Exploration").ToList();
locationInfo = null;
return false;
}
@@ -129,7 +129,7 @@ public class ExplorationQuestGenerator(
var locationKey = randomUtil.DrawRandomFromDict(pool.Pool.Exploration.Locations)[0];
// Make the location info object
var locationTarget = pool.Pool!.Exploration!.Locations![locationKey];
var locationTarget = pool.Pool.Exploration.Locations![locationKey];
var requiresSpecificExtract = randomUtil.GetChance100(repeatableConfig.QuestConfig.Exploration.SpecificExits.Chance);
@@ -146,15 +146,19 @@ public class ExplorationQuestGenerator(
/// <summary>
/// Get the number of times the player needs to exit
/// </summary>
/// <param name="config">Exploration config</param>
/// <param name="explorationConfig">Exploration config</param>
/// <param name="requiresSpecificExtract">Is this a specific extract</param>
/// <returns>Number of exit requirements</returns>
protected int GetNumberOfExits(Exploration config, bool requiresSpecificExtract)
protected int GetNumberOfExits(Exploration explorationConfig, bool requiresSpecificExtract)
{
// Different max extract count when specific extract needed
var exitTimesMax = requiresSpecificExtract ? config.MaximumExtractsWithSpecificExit : config.MaximumExtracts + 1;
var exitTimesMin = requiresSpecificExtract ? explorationConfig.MinimumExtractsWithSpecificExit : explorationConfig.MinimumExtracts;
return randomUtil.RandInt(1, exitTimesMax);
// Different max extract count when specific extract needed
var exitTimesMax = requiresSpecificExtract
? explorationConfig.MaximumExtractsWithSpecificExit + 1
: explorationConfig.MaximumExtracts + 1;
return randomUtil.RandInt(exitTimesMin, exitTimesMax);
}
/// <summary>
@@ -329,7 +329,7 @@ public record QuestConditionCounter
public record QuestConditionCounterCondition
{
[JsonPropertyName("id")]
public string? Id { get; set; }
public MongoId? Id { get; set; }
[JsonPropertyName("dynamicLocale")]
public bool? DynamicLocale { get; set; }
@@ -361,12 +361,24 @@ public record RepeatableQuestTypesConfig
public record Exploration : BaseQuestConfig
{
/// <summary>
/// Minimum extract count that a per map extract requirement can be generated with
/// </summary>
[JsonPropertyName("minExtracts")]
public required int MinimumExtracts { get; set; }
/// <summary>
/// Maximum extract count that a per map extract requirement can be generated with
/// </summary>
[JsonPropertyName("maxExtracts")]
public required int MaximumExtracts { get; set; }
/// <summary>
/// Minimum extract count that a specific extract can be generated with
/// </summary>
[JsonPropertyName("minExtractsWithSpecificExit")]
public required int MinimumExtractsWithSpecificExit { get; set; }
/// <summary>
/// Maximum extract count that a specific extract can be generated with
/// </summary>