This commit is contained in:
D1GQ committed 2024-09-12 17:48:56 -05:00
1 parent be19a198e3
commit cfbc09f733
2 files changed
+33 -26

No files matched your search

+3 -3
View File
@@ -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;
}
}
+30 -23
View File
@@ -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);
}
}
}