Merge pull request #201 from hulkhan22/fix/arms-legs
fix: Send correct bodyparts to client for daily quests
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
namespace SPTarkov.Server.Core.Constants;
|
||||
|
||||
public static class BodyParts
|
||||
{
|
||||
public const string Head = "Head";
|
||||
public const string LeftArm = "LeftArm";
|
||||
public const string RightArm = "RightArm";
|
||||
public const string Chest = "Chest";
|
||||
public const string Stomach = "Stomach";
|
||||
public const string LeftLeg = "LeftLeg";
|
||||
public const string RightLeg = "RightLeg";
|
||||
|
||||
// quest data
|
||||
public const string Legs = "Legs";
|
||||
public const string Arms = "Arms";
|
||||
}
|
||||
@@ -12,6 +12,7 @@ using SPTarkov.Server.Core.Utils;
|
||||
using SPTarkov.Server.Core.Utils.Cloners;
|
||||
using SPTarkov.Server.Core.Utils.Collections;
|
||||
using SPTarkov.Server.Core.Utils.Json;
|
||||
using BodyParts = SPTarkov.Server.Core.Constants.BodyParts;
|
||||
|
||||
namespace SPTarkov.Server.Core.Generators;
|
||||
|
||||
@@ -30,6 +31,36 @@ public class RepeatableQuestGenerator(
|
||||
ICloner _cloner
|
||||
)
|
||||
{
|
||||
/// <summary>
|
||||
/// Body parts to present to the client as opposed to the body part information in quest data.
|
||||
/// </summary>
|
||||
private static readonly Dictionary<string, List<string>> _bodyPartsToClient = new()
|
||||
{
|
||||
{
|
||||
BodyParts.Arms, [
|
||||
BodyParts.LeftArm,
|
||||
BodyParts.RightArm
|
||||
]
|
||||
},
|
||||
{
|
||||
BodyParts.Legs, [
|
||||
BodyParts.LeftLeg,
|
||||
BodyParts.RightLeg
|
||||
]
|
||||
},
|
||||
{
|
||||
BodyParts.Head, [
|
||||
BodyParts.Head
|
||||
]
|
||||
},
|
||||
{
|
||||
BodyParts.Chest, [
|
||||
BodyParts.Chest,
|
||||
BodyParts.Stomach
|
||||
]
|
||||
},
|
||||
};
|
||||
|
||||
protected int _maxRandomNumberAttempts = 6;
|
||||
protected QuestConfig _questConfig = _configServer.GetConfig<QuestConfig>();
|
||||
|
||||
@@ -218,7 +249,15 @@ public class RepeatableQuestGenerator(
|
||||
{
|
||||
// more than one part lead to an "OR" condition hence more parts reduce the difficulty
|
||||
probability += bodyPartsConfig.Probability(bodyPart).Value;
|
||||
bodyPartsToClient.Add(bodyPart);
|
||||
|
||||
if (_bodyPartsToClient.TryGetValue(bodyPart, out var bodyPartListToClient))
|
||||
{
|
||||
bodyPartsToClient.AddRange(bodyPartListToClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
bodyPartsToClient.Add(bodyPart);
|
||||
}
|
||||
}
|
||||
|
||||
bodyPartDifficulty = 1 / probability;
|
||||
|
||||
Reference in New Issue
Block a user