2 new roles & fixes

This commit is contained in:
Gurge44 committed 2025-05-29 19:11:42 +02:00
1 parent 6fcc461abf
commit 1a0d9b0170
105 files changed
+535 -463

No files matched your search

+104 -220
View File
@@ -12,25 +12,25 @@ namespace EHR;
public static class SpamManager
{
private const string BannedwordsFilePath = "./EHR_DATA/BanWords.txt";
private const string BannedWordsFilePath = "./EHR_DATA/BanWords.txt";
private static List<string> BanWords = [];
public static void Init()
{
CreateIfNotExists();
BanWords = ReturnAllNewLinesInFile(BannedwordsFilePath);
BanWords = ReturnAllNewLinesInFile(BannedWordsFilePath);
}
private static void CreateIfNotExists()
{
if (!File.Exists(BannedwordsFilePath))
if (!File.Exists(BannedWordsFilePath))
{
try
{
if (!Directory.Exists("EHR_DATA")) Directory.CreateDirectory("EHR_DATA");
if (File.Exists("./BanWords.txt"))
File.Move("./BanWords.txt", BannedwordsFilePath);
File.Move("./BanWords.txt", BannedWordsFilePath);
else
{
string fileName;
@@ -49,7 +49,7 @@ public static class SpamManager
fileName = "English";
Logger.Warn($"Creating new BanWords file: {fileName}", "SpamManager");
File.WriteAllText(BannedwordsFilePath, GetResourcesTxt($"EHR.Resources.Config.BanWords.{fileName}.txt"));
File.WriteAllText(BannedWordsFilePath, GetResourcesTxt($"EHR.Resources.Config.BanWords.{fileName}.txt"));
}
}
catch (Exception ex) { Logger.Exception(ex, "SpamManager"); }
@@ -92,7 +92,7 @@ public static class SpamManager
{
if (ContainsStart(text) && GameStates.IsLobby)
{
if (!Main.SayStartTimes.ContainsKey(player.OwnerId)) Main.SayStartTimes.Add(player.OwnerId, 0);
Main.SayStartTimes.TryAdd(player.OwnerId, 0);
Main.SayStartTimes[player.OwnerId]++;
msg = string.Format(GetString("Message.WarnWhoSayStart"), name, Main.SayStartTimes[player.OwnerId]);
@@ -119,7 +119,7 @@ public static class SpamManager
if (Options.AutoKickStopWords.GetBool())
{
if (!Main.SayBanwordsTimes.ContainsKey(player.OwnerId)) Main.SayBanwordsTimes.Add(player.OwnerId, 0);
Main.SayBanwordsTimes.TryAdd(player.OwnerId, 0);
Main.SayBanwordsTimes[player.OwnerId]++;
msg = string.Format(GetString("Message.WarnWhoSayBanWordTimes"), name, Main.SayBanwordsTimes[player.OwnerId]);
@@ -137,8 +137,9 @@ public static class SpamManager
Utils.SendMessage(msg, sendOption: SendOption.None);
else
{
foreach (PlayerControl pc in Main.AllPlayerControls.Where(x => x.IsAlive() == player.IsAlive()).ToArray())
Utils.SendMessage(msg, pc.PlayerId, sendOption: SendOption.None);
foreach (PlayerControl pc in Main.AllPlayerControls)
if (pc.IsAlive() == player.IsAlive())
Utils.SendMessage(msg, pc.PlayerId, sendOption: SendOption.None);
}
}
@@ -156,257 +157,140 @@ public static class SpamManager
for (var i = 0; i < text.Length; i++)
{
if (text[i..].Equals("k")) stNum++;
if (text[i..].Equals("开")) stNum++;
}
if (stNum >= 3) return true;
if (text == "Start") return true;
switch (text)
{
case "Start":
case "start":
case "/Start":
case "/Start/":
case "Start/":
case "/start":
case "/start/":
case "start/":
case "plsstart":
case "pls start":
case "please start":
case "pleasestart":
case "Plsstart":
case "Pls start":
case "Please start":
case "Pleasestart":
case "plsStart":
case "pls Start":
case "please Start":
case "pleaseStart":
case "PlsStart":
case "Pls Start":
case "Please Start":
case "PleaseStart":
case "sTart":
case "stArt":
case "staRt":
case "starT":
case "s t a r t":
case "S t a r t":
case "started":
case "Started":
case "s t a r t e d":
case "S t a r t e d":
case "Го":
case "гО":
case "го":
case "Гоу":
case "гоу":
case "Старт":
case "старт":
case "/Старт":
case "/Старт/":
case "Старт/":
case "/старт":
case "/старт/":
case "старт/":
case "пжстарт":
case "пж старт":
case "пжСтарт":
case "пж Старт":
case "Пжстарт":
case "Пж старт":
case "ПжСтарт":
case "Пж Старт":
case "сТарт":
case "стАрт":
case "стаРт":
case "старТ":
case "с т а р т":
case "С т а р т":
case "начни":
case "Начни":
case "начинай":
case "начинай уже":
case "Начинай":
case "Начинай уже":
case "Начинай Уже":
case "н а ч и н а й":
case "Н а ч и н а й":
case "пж го":
case "пжго":
case "Пж Го":
case "Пж го":
case "пж Го":
case "ПжГо":
case "Пжго":
case "пжГо":
case "ГоПж":
case "гоПж":
case "Гопж":
case "开":
case "快开":
case "开始":
case "开啊":
case "开阿":
case "kai":
case "kaishi":
return true;
}
if (text.Length > 30) return false;
if (text == "start") return true;
if (text == "/Start") return true;
if (text == "/Start/") return true;
if (text == "Start/") return true;
if (text == "/start") return true;
if (text == "/start/") return true;
if (text == "start/") return true;
if (text == "plsstart") return true;
if (text == "pls start") return true;
if (text == "please start") return true;
if (text == "pleasestart") return true;
if (text == "Plsstart") return true;
if (text == "Pls start") return true;
if (text == "Please start") return true;
if (text == "Pleasestart") return true;
if (text == "plsStart") return true;
if (text == "pls Start") return true;
if (text == "please Start") return true;
if (text == "pleaseStart") return true;
if (text == "PlsStart") return true;
if (text == "Pls Start") return true;
if (text == "Please Start") return true;
if (text == "PleaseStart") return true;
if (text == "sTart") return true;
if (text == "stArt") return true;
if (text == "staRt") return true;
if (text == "starT") return true;
if (text == "s t a r t") return true;
if (text == "S t a r t") return true;
if (text == "started") return true;
if (text == "Started") return true;
if (text == "s t a r t e d") return true;
if (text == "S t a r t e d") return true;
if (text == "Го") return true;
if (text == "гО") return true;
if (text == "го") return true;
if (text == "Гоу") return true;
if (text == "гоу") return true;
if (text == "Старт") return true;
if (text == "старт") return true;
if (text == "/Старт") return true;
if (text == "/Старт/") return true;
if (text == "Старт/") return true;
if (text == "/старт") return true;
if (text == "/старт/") return true;
if (text == "старт/") return true;
if (text == "пжстарт") return true;
if (text == "пж старт") return true;
if (text == "пжСтарт") return true;
if (text == "пж Старт") return true;
if (text == "Пжстарт") return true;
if (text == "Пж старт") return true;
if (text == "ПжСтарт") return true;
if (text == "Пж Старт") return true;
if (text == "сТарт") return true;
if (text == "стАрт") return true;
if (text == "стаРт") return true;
if (text == "старТ") return true;
if (text == "с т а р т") return true;
if (text == "С т а р т") return true;
if (text == "начни") return true;
if (text == "Начни") return true;
if (text == "начинай") return true;
if (text == "начинай уже") return true;
if (text == "Начинай") return true;
if (text == "Начинай уже") return true;
if (text == "Начинай Уже") return true;
if (text == "н а ч и н а й") return true;
if (text == "Н а ч и н а й") return true;
if (text == "пж го") return true;
if (text == "пжго") return true;
if (text == "Пж Го") return true;
if (text == "Пж го") return true;
if (text == "пж Го") return true;
if (text == "ПжГо") return true;
if (text == "Пжго") return true;
if (text == "пжГо") return true;
if (text == "ГоПж") return true;
if (text == "гоПж") return true;
if (text == "Гопж") return true;
if (text == "开") return true;
if (text == "快开") return true;
if (text == "开始") return true;
if (text == "开啊") return true;
if (text == "开阿") return true;
if (text == "kai") return true;
if (text == "kaishi") return true;
//if (text.Length >= 3) return false;
if (text.Contains("start")) return true;
if (text.Contains("Start")) return true;
if (text.Contains("STart")) return true;
if (text.Contains("s t a r t")) return true;
if (text.Contains("begin")) return true;
if (text.Contains('了')) return false;
if (text.Contains('没')) return false;
if (text.Contains('吗')) return false;
if (text.Contains('哈')) return false;
if (text.Contains('还')) return false;
if (text.Contains('现')) return false;
if (text.Contains('不')) return false;
if (text.Contains('可')) return false;
if (text.Contains('刚')) return false;
if (text.Contains('的')) return false;
if (text.Contains('打')) return false;
if (text.Contains('门')) return false;
if (text.Contains('关')) return false;
if (text.Contains('怎')) return false;
if (text.Contains('要')) return false;
if (text.Contains('摆')) return false;
if (text.Contains('啦')) return false;
if (text.Contains('咯')) return false;
if (text.Contains('嘞')) return false;
if (text.Contains('勒')) return false;
if (text.Contains('心')) return false;
if (text.Contains('呢')) return false;
if (text.Contains('门')) return false;
if (text.Contains('总')) return false;
if (text.Contains('哥')) return false;
if (text.Contains('姐')) return false;
if (text.Contains('《')) return false;
if (text.Contains('?')) return false;
if (text.Contains('?')) return false;
return text.Contains('开') || text.Contains("kai");
}
}