2021-11-23 18:26:33 -05:00
|
|
|
|
using System;
|
2018-03-18 22:25:11 -04:00
|
|
|
|
using System.Collections.Generic;
|
2021-11-23 18:26:33 -05:00
|
|
|
|
using IW4MAdmin.Plugins.Stats.Config;
|
|
|
|
|
using SharedLibraryCore;
|
|
|
|
|
using SharedLibraryCore.Interfaces;
|
2019-09-27 16:53:52 -04:00
|
|
|
|
using static IW4MAdmin.Plugins.Stats.Cheat.Detection;
|
2018-03-18 22:25:11 -04:00
|
|
|
|
|
2021-11-23 18:26:33 -05:00
|
|
|
|
namespace Stats.Config
|
2018-03-18 22:25:11 -04:00
|
|
|
|
{
|
2018-05-28 21:30:31 -04:00
|
|
|
|
public class StatsConfiguration : IBaseConfiguration
|
2018-03-18 22:25:11 -04:00
|
|
|
|
{
|
2021-03-22 12:09:25 -04:00
|
|
|
|
[Obsolete] public bool? EnableAntiCheat { get; set; }
|
2018-03-18 22:25:11 -04:00
|
|
|
|
public List<StreakMessageConfiguration> KillstreakMessages { get; set; }
|
|
|
|
|
public List<StreakMessageConfiguration> DeathstreakMessages { get; set; }
|
2018-08-22 21:25:34 -04:00
|
|
|
|
public int TopPlayersMinPlayTime { get; set; }
|
2018-09-16 16:34:16 -04:00
|
|
|
|
public bool StoreClientKills { get; set; }
|
2020-05-05 19:49:30 -04:00
|
|
|
|
public int MostKillsMaxInactivityDays { get; set; } = 30;
|
|
|
|
|
public int MostKillsClientLimit { get; set; } = 5;
|
2021-03-22 12:09:25 -04:00
|
|
|
|
public bool EnableAdvancedMetrics { get; set; } = true;
|
|
|
|
|
|
|
|
|
|
public WeaponNameParserConfiguration[] WeaponNameParserConfigurations { get; set; } = new[]
|
|
|
|
|
{
|
2021-03-23 17:01:48 -04:00
|
|
|
|
new WeaponNameParserConfiguration()
|
|
|
|
|
{
|
|
|
|
|
Game = Server.Game.IW3,
|
|
|
|
|
WeaponSuffix = "mp",
|
|
|
|
|
Delimiters = new[] {'_'}
|
|
|
|
|
},
|
2021-03-22 12:09:25 -04:00
|
|
|
|
new WeaponNameParserConfiguration()
|
|
|
|
|
{
|
|
|
|
|
Game = Server.Game.IW4,
|
|
|
|
|
WeaponSuffix = "mp",
|
|
|
|
|
Delimiters = new[] {'_'}
|
|
|
|
|
},
|
|
|
|
|
new WeaponNameParserConfiguration()
|
2021-03-23 17:01:48 -04:00
|
|
|
|
{
|
|
|
|
|
Game = Server.Game.IW5,
|
|
|
|
|
WeaponSuffix = "mp",
|
|
|
|
|
WeaponPrefix = "iw5",
|
|
|
|
|
Delimiters = new[] {'_'}
|
|
|
|
|
},
|
|
|
|
|
new WeaponNameParserConfiguration()
|
2021-03-22 12:09:25 -04:00
|
|
|
|
{
|
|
|
|
|
Game = Server.Game.T6,
|
|
|
|
|
WeaponSuffix = "mp",
|
|
|
|
|
Delimiters = new[] {'_', '+'}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
[Obsolete] public IDictionary<long, DetectionType[]> ServerDetectionTypes { get; set; }
|
2020-09-30 18:15:47 -04:00
|
|
|
|
public AnticheatConfiguration AnticheatConfiguration { get; set; } = new AnticheatConfiguration();
|
|
|
|
|
|
|
|
|
|
#pragma warning disable CS0612 // Type or member is obsolete
|
|
|
|
|
public void ApplyMigration()
|
|
|
|
|
{
|
|
|
|
|
if (ServerDetectionTypes != null)
|
|
|
|
|
{
|
|
|
|
|
AnticheatConfiguration.ServerDetectionTypes = ServerDetectionTypes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ServerDetectionTypes = null;
|
|
|
|
|
|
|
|
|
|
if (EnableAntiCheat != null)
|
|
|
|
|
{
|
|
|
|
|
AnticheatConfiguration.Enable = EnableAntiCheat.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EnableAntiCheat = null;
|
|
|
|
|
}
|
|
|
|
|
#pragma warning restore CS0612 // Type or member is obsolete
|
2019-09-27 16:53:52 -04:00
|
|
|
|
|
2020-02-11 17:44:06 -05:00
|
|
|
|
public string Name() => "StatsPluginSettings";
|
2021-03-22 12:09:25 -04:00
|
|
|
|
|
2018-03-18 22:25:11 -04:00
|
|
|
|
public IBaseConfiguration Generate()
|
|
|
|
|
{
|
2021-03-22 12:09:25 -04:00
|
|
|
|
AnticheatConfiguration.Enable =
|
2021-11-23 18:26:33 -05:00
|
|
|
|
Utilities.CurrentLocalization.LocalizationIndex["PLUGIN_STATS_SETUP_ENABLEAC"].PromptBool();
|
|
|
|
|
KillstreakMessages = new List<StreakMessageConfiguration>
|
2018-03-18 22:25:11 -04:00
|
|
|
|
{
|
2021-11-23 18:26:33 -05:00
|
|
|
|
new StreakMessageConfiguration
|
2021-03-22 12:09:25 -04:00
|
|
|
|
{
|
2018-03-18 22:25:11 -04:00
|
|
|
|
Count = -1,
|
2021-11-23 18:26:33 -05:00
|
|
|
|
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_SUICIDE"]
|
2018-03-18 22:25:11 -04:00
|
|
|
|
},
|
2021-11-23 18:26:33 -05:00
|
|
|
|
new StreakMessageConfiguration
|
2021-03-22 12:09:25 -04:00
|
|
|
|
{
|
|
|
|
|
Count = 5,
|
2021-11-23 18:26:33 -05:00
|
|
|
|
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_5"]
|
2021-03-22 12:09:25 -04:00
|
|
|
|
},
|
2021-11-23 18:26:33 -05:00
|
|
|
|
new StreakMessageConfiguration
|
2021-03-22 12:09:25 -04:00
|
|
|
|
{
|
|
|
|
|
Count = 10,
|
2021-11-23 18:26:33 -05:00
|
|
|
|
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_10"]
|
2021-03-22 12:09:25 -04:00
|
|
|
|
},
|
2021-11-23 18:26:33 -05:00
|
|
|
|
new StreakMessageConfiguration
|
2021-03-22 12:09:25 -04:00
|
|
|
|
{
|
|
|
|
|
Count = 25,
|
2021-11-23 18:26:33 -05:00
|
|
|
|
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_STREAK_MESSAGE_25"]
|
2021-03-22 12:09:25 -04:00
|
|
|
|
}
|
2018-03-18 22:25:11 -04:00
|
|
|
|
};
|
|
|
|
|
|
2018-05-08 00:58:46 -04:00
|
|
|
|
DeathstreakMessages = new List<StreakMessageConfiguration>()
|
2018-03-18 22:25:11 -04:00
|
|
|
|
{
|
2021-03-22 12:09:25 -04:00
|
|
|
|
new StreakMessageConfiguration()
|
|
|
|
|
{
|
|
|
|
|
Count = 5,
|
2021-11-23 18:26:33 -05:00
|
|
|
|
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_DEATH_STREAK_MESSAGE_5"]
|
2021-03-22 12:09:25 -04:00
|
|
|
|
},
|
|
|
|
|
new StreakMessageConfiguration()
|
|
|
|
|
{
|
|
|
|
|
Count = 10,
|
2021-11-23 18:26:33 -05:00
|
|
|
|
Message = Utilities.CurrentLocalization.LocalizationIndex["STATS_DEATH_STREAK_MESSAGE_10"]
|
2021-03-22 12:09:25 -04:00
|
|
|
|
},
|
2018-03-18 22:25:11 -04:00
|
|
|
|
};
|
|
|
|
|
|
2018-08-22 21:25:34 -04:00
|
|
|
|
TopPlayersMinPlayTime = 3600 * 3;
|
2018-09-16 16:34:16 -04:00
|
|
|
|
StoreClientKills = false;
|
2020-09-30 18:15:47 -04:00
|
|
|
|
|
2018-05-08 00:58:46 -04:00
|
|
|
|
return this;
|
2018-03-18 22:25:11 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-22 12:09:25 -04:00
|
|
|
|
}
|