diff --git a/RetakesAllocatorCore/Config/Configs.cs b/RetakesAllocatorCore/Config/Configs.cs index cfa2fb1..7e7abcb 100644 --- a/RetakesAllocatorCore/Config/Configs.cs +++ b/RetakesAllocatorCore/Config/Configs.cs @@ -218,6 +218,9 @@ public Dictionary< public bool EnableNextRoundTypeVoting { get; set; } = false; public int NumberOfExtraVipChancesForPreferredWeapon { get; set; } = 1; public bool AllowPreferredWeaponForEveryone { get; set; } = false; + + public double ChanceForPreferredWeapon { get; set; } = 100; + public Dictionary MaxPreferredWeaponsPerTeam { get; set; } = new() { {CsTeam.Terrorist, 1}, diff --git a/RetakesAllocatorCore/OnRoundPostStartHelper.cs b/RetakesAllocatorCore/OnRoundPostStartHelper.cs index 622fb82..27c6274 100644 --- a/RetakesAllocatorCore/OnRoundPostStartHelper.cs +++ b/RetakesAllocatorCore/OnRoundPostStartHelper.cs @@ -3,6 +3,7 @@ using RetakesAllocatorCore.Config; using RetakesAllocatorCore.Db; using RetakesAllocatorCore.Managers; +using System; namespace RetakesAllocatorCore; @@ -58,7 +59,11 @@ HashSet FilterByPreferredWeaponPreference(IEnumerable ps) => ICollection tPreferredPlayers = new List(); ICollection ctPreferredPlayers = new List(); - if (roundType == RoundType.FullBuy) + + Random random = new Random(); + double generatedChance = random.NextDouble() * 100; + + if (roundType == RoundType.FullBuy && generatedChance <= Configs.GetConfigData().ChanceForPreferredWeapon) { tPreferredPlayers = WeaponHelpers.SelectPreferredPlayers(FilterByPreferredWeaponPreference(tPlayers), isVip,