mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
add Replace : to # in friend codes (just in case)
This commit is contained in:
1 parent
e5f4d6f9c7
commit
44ca294f1e
4 files changed
+26
-13
No files matched your search
+15
-8
@@ -96,15 +96,17 @@ namespace EHR
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || player == null) return;
|
||||
|
||||
if (!CheckBanList(player.FriendCode, player.GetHashedPuid()) && !TempBanWhiteList.Contains(player.GetHashedPuid()))
|
||||
string friendCode = player.FriendCode.Replace(':', '#');
|
||||
|
||||
if (!CheckBanList(friendCode, player.GetHashedPuid()) && !TempBanWhiteList.Contains(player.GetHashedPuid()))
|
||||
{
|
||||
if (player.GetHashedPuid() != "" && player.GetHashedPuid() != null && player.GetHashedPuid() != "e3b0cb855")
|
||||
{
|
||||
File.AppendAllText(BanListPath, $"{player.FriendCode},{player.GetHashedPuid()},{player.PlayerName.RemoveHtmlTags()}\n");
|
||||
File.AppendAllText(BanListPath, $"{friendCode},{player.GetHashedPuid()},{player.PlayerName.RemoveHtmlTags()}\n");
|
||||
Logger.SendInGame(string.Format(GetString("Message.AddedPlayerToBanList"), player.PlayerName));
|
||||
}
|
||||
else
|
||||
Logger.Info($"Failed to add player {player.PlayerName.RemoveHtmlTags()}/{player.FriendCode}/{player.GetHashedPuid()} to ban list!", "AddBanPlayer");
|
||||
Logger.Info($"Failed to add player {player.PlayerName.RemoveHtmlTags()}/{friendCode}/{player.GetHashedPuid()} to ban list!", "AddBanPlayer");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +147,7 @@ namespace EHR
|
||||
{
|
||||
if (!AmongUsClient.Instance.AmHost || !Options.ApplyBanList.GetBool() || player == null) return;
|
||||
|
||||
string friendcode = player.FriendCode;
|
||||
string friendcode = player.FriendCode.Replace(':', '#');
|
||||
|
||||
if (friendcode.Length < 7) // #1234 is 5 chars, and it's impossible for a friend code to only have 3
|
||||
{
|
||||
@@ -155,7 +157,7 @@ namespace EHR
|
||||
return;
|
||||
}
|
||||
|
||||
if (friendcode.Count(c => c == '#') > 1)
|
||||
if (friendcode.Count(c => c == '#') != 1)
|
||||
{
|
||||
// This is part of eac, so that's why it will say banned by EAC list.
|
||||
AmongUsClient.Instance.KickPlayer(player.Id, true);
|
||||
@@ -175,7 +177,7 @@ namespace EHR
|
||||
return;
|
||||
}
|
||||
|
||||
if (CheckBanList(player.FriendCode, player.GetHashedPuid()))
|
||||
if (CheckBanList(friendcode, player.GetHashedPuid()))
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(player.Id, true);
|
||||
Logger.SendInGame(string.Format(GetString("Message.BanedByBanList"), player.PlayerName));
|
||||
@@ -183,7 +185,7 @@ namespace EHR
|
||||
return;
|
||||
}
|
||||
|
||||
if (CheckEACList(player.FriendCode, player.GetHashedPuid()))
|
||||
if (CheckEACList(friendcode, player.GetHashedPuid()))
|
||||
{
|
||||
AmongUsClient.Instance.KickPlayer(player.Id, true);
|
||||
Logger.SendInGame(string.Format(GetString("Message.BanedByEACList"), player.PlayerName));
|
||||
@@ -200,6 +202,8 @@ namespace EHR
|
||||
|
||||
public static bool CheckBanList(string code, string hashedpuid = "")
|
||||
{
|
||||
code = code.Replace(':', '#');
|
||||
|
||||
var OnlyCheckPuid = false;
|
||||
|
||||
switch (code)
|
||||
@@ -239,6 +243,8 @@ namespace EHR
|
||||
|
||||
public static bool CheckEACList(string code, string hashedPuid)
|
||||
{
|
||||
code = code.Replace(':', '#');
|
||||
|
||||
var OnlyCheckPuid = false;
|
||||
|
||||
switch (code)
|
||||
@@ -262,7 +268,8 @@ namespace EHR
|
||||
ClientData recentClient = AmongUsClient.Instance.GetRecentClient(clientId);
|
||||
if (recentClient == null) return;
|
||||
|
||||
if (!BanManager.CheckBanList(recentClient.FriendCode, recentClient.GetHashedPuid())) __instance.BanButton.GetComponent<ButtonRolloverHandler>().SetEnabledColors();
|
||||
if (!BanManager.CheckBanList(recentClient.FriendCode, recentClient.GetHashedPuid()))
|
||||
__instance.BanButton.GetComponent<ButtonRolloverHandler>().SetEnabledColors();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,6 +131,7 @@ namespace EHR
|
||||
new("strangeant#6543", isUp: true), // after.edits
|
||||
new("ninjanice#3990", isUp: true), // void_daora
|
||||
new("magicmill#4146", isUp: true), // Sr.Angel
|
||||
new("grassyprey#9593", isUp: true), // LucasCarr
|
||||
new("blessedtes#6684", "#ff0000", "YouTuber", true), // Gabriel So Capa
|
||||
|
||||
// Sponsor
|
||||
@@ -159,6 +160,7 @@ namespace EHR
|
||||
|
||||
public static DevUser GetDevUser(this string code)
|
||||
{
|
||||
code = code.Replace(':', '#');
|
||||
return code.IsDevUser() ? DevUserList.Find(x => x.Code == code) : DefaultDevUser;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +192,8 @@ namespace EHR
|
||||
// Function to check if a player is a moderator
|
||||
public static bool IsPlayerModerator(string friendCode)
|
||||
{
|
||||
friendCode = friendCode.Replace(':', '#');
|
||||
|
||||
if (friendCode == "" || friendCode == string.Empty || !Options.ApplyModeratorList.GetBool()) return false;
|
||||
|
||||
const string friendCodesFilePath = "./EHR_DATA/Moderators.txt";
|
||||
@@ -209,6 +211,8 @@ namespace EHR
|
||||
// Function to check if a player is a VIP
|
||||
public static bool IsPlayerVIP(string friendCode)
|
||||
{
|
||||
friendCode = friendCode.Replace(':', '#');
|
||||
|
||||
if (friendCode == "" || friendCode == string.Empty || !Options.ApplyVIPList.GetBool()) return false;
|
||||
|
||||
const string friendCodesFilePath = "./EHR_DATA/VIPs.txt";
|
||||
@@ -555,7 +559,7 @@ namespace EHR
|
||||
PlayerControl VIPPc = Utils.GetPlayerById(VIPId);
|
||||
if (VIPPc == null) return;
|
||||
|
||||
string fc = VIPPc.FriendCode;
|
||||
string fc = VIPPc.FriendCode.Replace(':', '#');
|
||||
if (!IsPlayerVIP(fc)) Utils.SendMessage(GetString("PlayerNotVIP"), player.PlayerId);
|
||||
|
||||
string[] lines = File.ReadAllLines("./EHR_DATA/VIPs.txt").Where(line => !line.Contains(fc)).ToArray();
|
||||
@@ -570,7 +574,7 @@ namespace EHR
|
||||
PlayerControl newVIPPc = Utils.GetPlayerById(newVIPId);
|
||||
if (newVIPPc == null) return;
|
||||
|
||||
string fc = newVIPPc.FriendCode;
|
||||
string fc = newVIPPc.FriendCode.Replace(':', '#');
|
||||
if (IsPlayerVIP(fc)) Utils.SendMessage(GetString("PlayerAlreadyVIP"), player.PlayerId);
|
||||
|
||||
File.AppendAllText("./EHR_DATA/VIPs.txt", $"\n{fc}");
|
||||
@@ -1453,7 +1457,7 @@ namespace EHR
|
||||
PlayerControl remModPc = Utils.GetPlayerById(remModId);
|
||||
if (remModPc == null) return;
|
||||
|
||||
string remFc = remModPc.FriendCode;
|
||||
string remFc = remModPc.FriendCode.Replace(':', '#');
|
||||
if (!IsPlayerModerator(remFc)) Utils.SendMessage(GetString("PlayerNotMod"), player.PlayerId);
|
||||
|
||||
File.WriteAllLines("./EHR_DATA/Moderators.txt", File.ReadAllLines("./EHR_DATA/Moderators.txt").Where(x => !x.Contains(remFc)));
|
||||
@@ -1467,7 +1471,7 @@ namespace EHR
|
||||
PlayerControl newModPc = Utils.GetPlayerById(newModId);
|
||||
if (newModPc == null) return;
|
||||
|
||||
string fc = newModPc.FriendCode;
|
||||
string fc = newModPc.FriendCode.Replace(':', '#');
|
||||
if (IsPlayerModerator(fc)) Utils.SendMessage(GetString("PlayerAlreadyMod"), player.PlayerId);
|
||||
|
||||
File.AppendAllText("./EHR_DATA/Moderators.txt", $"\n{fc}");
|
||||
|
||||
@@ -464,7 +464,7 @@ namespace EHR.Crewmate
|
||||
|
||||
public override string GetMessage(PlayerControl killer, bool showStageClue)
|
||||
{
|
||||
string friendCode = killer.Data.FriendCode;
|
||||
string friendCode = killer.Data.FriendCode.Replace(':', '#');
|
||||
return string.Format(GetString("EnigmaClueFriendCode"), friendCode);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user