change baby dragon exploit approach

- fix invalid FP insted of disconnect
This commit is contained in:
Robert Paciorek 2024-01-19 21:36:32 +00:00 committed by Spirtix
parent 89191a53ff
commit 3f49b895b9
4 changed files with 12 additions and 24 deletions

View File

@ -18,8 +18,7 @@ class SetPositionVariablesHandler : ICommandHandler {
this.client = client;
spvData = receivedObject;
UpdatePositionVariables();
if (Utils.VariablesValid(client))
SendSPVCommand();
SendSPVCommand();
}
private void UpdatePositionVariables() {

View File

@ -46,9 +46,6 @@ class SetUserVariablesHandler : ICommandHandler {
client.PlayerData.Bu = suvData.Get<string>("BU");
client.PlayerData.Fp = suvData.Get<string>("FP");
if (!Utils.VariablesValid(client))
return;
Console.WriteLine($"SUV {client.Room.Name} IID: {client.ClientID}");
client.Room.AddClient(client);
UpdatePlayersInRoom();
@ -83,9 +80,6 @@ class SetUserVariablesHandler : ICommandHandler {
vl.Add(NetworkArray.StringParam("L", client.PlayerData.L));
}
if (!Utils.VariablesValid(client))
return;
data.Add("vl", vl);
NetworkPacket packet = NetworkObject.WrapObject(0, 12, data).Serialize();

View File

@ -9,19 +9,6 @@ using sodoffmmo.Data;
namespace sodoffmmo.Core;
internal static class Utils {
public static bool VariablesValid(Client client) {
if (client.PlayerData.Fp != "" && (client.PlayerData.PetMounted || (client.PlayerData.Mbf & 8) == 8)
&& (client.PlayerData.GeometryType == PetGeometryType.Default && client.PlayerData.PetAge < PetAge.Teen
|| client.PlayerData.GeometryType == PetGeometryType.Terror && client.PlayerData.PetAge < PetAge.Titan)) {
NetworkObject obj = new NetworkObject();
obj.Add("dr", (byte)1);
client.Send(NetworkObject.WrapObject(0, 1005, obj).Serialize());
client.SheduleDisconnect();
return false;
}
return true;
}
public static NetworkPacket VlNetworkPacket(NetworkArray vl, int roomID) {
NetworkObject obj = new();
obj.Add("r", roomID);

View File

@ -1,4 +1,5 @@
using sodoffmmo.Core;
using System.Text.RegularExpressions;
using sodoffmmo.Core;
namespace sodoffmmo.Data;
public class PlayerData {
@ -61,8 +62,7 @@ public class PlayerData {
return fp;
}
set {
fp = value;
string[] array = fp.Split('*');
string[] array = value.Split('*');
Dictionary<string, string> keyValPairs = new();
foreach (string str in array) {
string[] keyValPair = str.Split('$');
@ -87,6 +87,14 @@ public class PlayerData {
if (keyValPairs.TryGetValue("U", out string userdata)) {
PetMounted = (userdata == "0");
}
if (PetMounted &&
(GeometryType == PetGeometryType.Default && PetAge < PetAge.Teen
|| GeometryType == PetGeometryType.Terror && PetAge < PetAge.Titan)
) {
fp = Regex.Replace(value, "^U\\$0\\*", "U$-1*");
} else {
fp = value;
}
}
}
private string fp = "";