mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-20 01:46:19 +00:00
fix
This commit is contained in:
1 parent
be19a198e3
commit
cfbc09f733
2 files changed
+33
-26
No files matched your search
@@ -258,16 +258,16 @@ class AntiCheat
|
||||
{
|
||||
uint level = reader.ReadPackedUInt32();
|
||||
|
||||
if (level > BetterGameSettings.DetectedLevelAbove.GetInt())
|
||||
if (level + 1 > BetterGameSettings.DetectedLevelAbove.GetInt())
|
||||
{
|
||||
BetterNotificationManager.NotifyCheat(player, $"Invalid Level: {level}");
|
||||
Logger.LogCheat($"{player.BetterData().RealName} {Enum.GetName((RpcCalls)callId)}: {level > BetterGameSettings.DetectedLevelAbove.GetInt()}");
|
||||
}
|
||||
|
||||
if (level <= 0)
|
||||
if (level + 1 <= 0)
|
||||
{
|
||||
var betterData = player.BetterData();
|
||||
player.Kick(false, "{0}" + $" due to {level} being invalid level", bypassDataCheck: true);
|
||||
player.Kick(false, "{0}" + $" due to {level + 1} being invalid level", bypassDataCheck: true);
|
||||
betterData.AntiCheatInfo.BannedByAntiCheat = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,31 +76,38 @@ class BetterDataManager
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the existing JSON data
|
||||
string json = File.ReadAllText(filePath);
|
||||
var jsonData = JsonSerializer.Deserialize<Dictionary<string, Dictionary<string, Dictionary<string, string>>>>(json) ?? new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
|
||||
try
|
||||
{
|
||||
// Load the existing JSON data
|
||||
string json = File.ReadAllText(filePath);
|
||||
var jsonData = JsonSerializer.Deserialize<Dictionary<string, Dictionary<string, Dictionary<string, string>>>>(json) ?? new Dictionary<string, Dictionary<string, Dictionary<string, string>>>();
|
||||
|
||||
// Check and add missing categories
|
||||
if (!jsonData.ContainsKey("Data"))
|
||||
{
|
||||
jsonData["Data"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
}
|
||||
if (!jsonData.ContainsKey("cheatData"))
|
||||
{
|
||||
jsonData["cheatData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
}
|
||||
if (!jsonData.ContainsKey("sickoData"))
|
||||
{
|
||||
jsonData["sickoData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
}
|
||||
if (!jsonData.ContainsKey("aumData"))
|
||||
{
|
||||
jsonData["aumData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
}
|
||||
// Check and add missing categories
|
||||
if (!jsonData.ContainsKey("Data"))
|
||||
{
|
||||
jsonData["Data"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
}
|
||||
if (!jsonData.ContainsKey("cheatData"))
|
||||
{
|
||||
jsonData["cheatData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
}
|
||||
if (!jsonData.ContainsKey("sickoData"))
|
||||
{
|
||||
jsonData["sickoData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
}
|
||||
if (!jsonData.ContainsKey("aumData"))
|
||||
{
|
||||
jsonData["aumData"] = new Dictionary<string, Dictionary<string, string>>();
|
||||
}
|
||||
|
||||
// Write the updated JSON data back to the file
|
||||
json = JsonSerializer.Serialize(jsonData, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(filePath, json);
|
||||
// Write the updated JSON data back to the file
|
||||
json = JsonSerializer.Serialize(jsonData, new JsonSerializerOptions { WriteIndented = true });
|
||||
File.WriteAllText(filePath, json);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user