first commit
This commit is contained in:
23
NitroxServer/Resources/RandomSpawnSpoofer.cs
Normal file
23
NitroxServer/Resources/RandomSpawnSpoofer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using NitroxServer.Helper;
|
||||
|
||||
namespace NitroxServer.Resources;
|
||||
|
||||
public class RandomSpawnSpoofer
|
||||
{
|
||||
private readonly Dictionary<string, string[]> randomPossibilitiesByClassId;
|
||||
|
||||
public RandomSpawnSpoofer(Dictionary<string, string[]> randomPossibilitiesByClassId)
|
||||
{
|
||||
this.randomPossibilitiesByClassId = randomPossibilitiesByClassId;
|
||||
}
|
||||
|
||||
public void PickRandomClassIdIfRequired(ref string classId)
|
||||
{
|
||||
if (randomPossibilitiesByClassId.TryGetValue(classId, out string[] choices))
|
||||
{
|
||||
int randomIndex = XORRandom.NextIntRange(0, choices.Length);
|
||||
classId = choices[randomIndex];
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user