mirror of
https://github.com/SoDOff-Project/sodoff-mmo.git
synced 2025-10-11 08:18:49 -07:00
exploits protection bugfixes
This commit is contained in:
parent
158ac4ee21
commit
783d02d4b2
@ -50,8 +50,13 @@ class SetPositionVariablesHandler : CommandHandler {
|
||||
|
||||
// user event
|
||||
string? ue = spvData.Get<string>("UE");
|
||||
if (ue != null)
|
||||
vars.Add("UE", ue);
|
||||
if (ue != null) {
|
||||
long time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||
if ((time - client.PlayerData.last_ue_time) > 499 || Configuration.ServerConfiguration.AllowChaos) {
|
||||
vars.Add("UE", ue);
|
||||
client.PlayerData.last_ue_time = time;
|
||||
}
|
||||
}
|
||||
// pitch
|
||||
float? cup = spvData.Get<float?>("CUP");
|
||||
if (cup != null)
|
||||
|
@ -43,7 +43,7 @@ class SetUserVariablesHandler : CommandHandler {
|
||||
foreach (string varName in PlayerData.SupportedVariables) {
|
||||
string? value = suvData.Get<string>(varName);
|
||||
if (value != null) {
|
||||
client.PlayerData.SetVariable(varName, value);
|
||||
value = client.PlayerData.SetVariable(varName, value);
|
||||
updated = true;
|
||||
data.Add(varName, value);
|
||||
vl.Add(NetworkArray.Param(varName, value));
|
||||
|
@ -38,6 +38,8 @@ public class PlayerData {
|
||||
public string DiplayName { get; set; } = "placeholder";
|
||||
public Role Role { get; set; } = Role.User;
|
||||
|
||||
public long last_ue_time { get; set; } = 0;
|
||||
|
||||
public static readonly string[] SupportedVariables = {
|
||||
"A", // avatar data
|
||||
"FP", // raised pet data
|
||||
@ -69,18 +71,18 @@ public class PlayerData {
|
||||
return variables[varName];
|
||||
}
|
||||
|
||||
public void SetVariable(string varName, string value) {
|
||||
public string SetVariable(string varName, string value) {
|
||||
// do not store in variables directory
|
||||
if (varName == "UID") {
|
||||
return;
|
||||
return value;
|
||||
}
|
||||
if (varName == "R") {
|
||||
R = float.Parse(value, CultureInfo.InvariantCulture);
|
||||
return;
|
||||
return value;
|
||||
}
|
||||
if (varName == "F") {
|
||||
F = unchecked((int)Convert.ToUInt32(value, 16));
|
||||
return;
|
||||
return value;
|
||||
}
|
||||
|
||||
// fix variable value before store
|
||||
@ -90,6 +92,7 @@ public class PlayerData {
|
||||
|
||||
// store in directory
|
||||
variables[varName] = value;
|
||||
return value;
|
||||
}
|
||||
|
||||
public void InitFromNetworkData(NetworkObject suvData) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user