forked from SoDOff-Project/sodoff-mmo
patch baby dragon exploit
This commit is contained in:
parent
30cbc54eca
commit
912a022476
@ -18,7 +18,8 @@ class SetPositionVariablesHandler : ICommandHandler {
|
||||
this.client = client;
|
||||
spvData = receivedObject;
|
||||
UpdatePositionVariables();
|
||||
SendSPVCommand();
|
||||
if (Utils.VariablesValid(client))
|
||||
SendSPVCommand();
|
||||
}
|
||||
|
||||
private void UpdatePositionVariables() {
|
||||
|
@ -45,6 +45,10 @@ class SetUserVariablesHandler : ICommandHandler {
|
||||
client.PlayerData.J = suvData.Get<string>("J");
|
||||
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();
|
||||
@ -78,6 +82,10 @@ class SetUserVariablesHandler : ICommandHandler {
|
||||
data2.Add("L", client.PlayerData.L);
|
||||
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();
|
||||
|
23
src/Core/Utils.cs
Normal file
23
src/Core/Utils.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using sodoffmmo.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace sodoffmmo.Core;
|
||||
internal static class Utils {
|
||||
public static bool VariablesValid(Client client) {
|
||||
if (client.PlayerData.Fp != "" && (client.PlayerData.Mbf & 8) == 8
|
||||
&& (client.PlayerData.GeometryType == PetGeometryType.Default && client.PlayerData.PetAge < PetAge.Adult
|
||||
|| client.PlayerData.GeometryType == PetGeometryType.NightLight && 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;
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ public class PlayerData {
|
||||
public double R1 { get; set; }
|
||||
public double R2 { get; set; }
|
||||
public double R3 { get; set; }
|
||||
public string Fp { get; set; } = "";
|
||||
public double Mx { get; set; } = 6;
|
||||
public string Udt { get; set; } = "";
|
||||
public double P1 { get; set; }
|
||||
@ -27,6 +26,42 @@ public class PlayerData {
|
||||
public string M { get; set; } = "False";
|
||||
public string L { get; set; } = "";
|
||||
public string UNToken { get; set; } = "";
|
||||
public PetGeometryType GeometryType { get; set; } = PetGeometryType.Default;
|
||||
public PetAge PetAge { get; set; } = PetAge.Adult;
|
||||
public string Fp {
|
||||
get {
|
||||
return fp;
|
||||
}
|
||||
set {
|
||||
fp = value;
|
||||
string[] array = fp.Split('*');
|
||||
Dictionary<string, string> keyValPairs = new();
|
||||
foreach (string str in array) {
|
||||
string[] keyValPair = str.Split('$');
|
||||
if (keyValPair.Length == 2)
|
||||
keyValPairs[keyValPair[0]] = keyValPair[1];
|
||||
}
|
||||
GeometryType = PetGeometryType.Default;
|
||||
PetAge = PetAge.Adult;
|
||||
if (keyValPairs.TryGetValue("G", out string geometry)) {
|
||||
if (geometry.ToLower().Contains("nightlight"))
|
||||
GeometryType = PetGeometryType.NightLight;
|
||||
else if (geometry.ToLower().Contains("terribleterror"))
|
||||
GeometryType = PetGeometryType.Terror;
|
||||
}
|
||||
if (keyValPairs.TryGetValue("A", out string age)) {
|
||||
switch (age) {
|
||||
case "E": PetAge = PetAge.EggInHand; break;
|
||||
case "B": PetAge = PetAge.Baby; break;
|
||||
case "C": PetAge = PetAge.Child; break;
|
||||
case "T": PetAge = PetAge.Teen; break;
|
||||
case "A": PetAge = PetAge.Adult; break;
|
||||
case "Ti": PetAge = PetAge.Titan; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private string fp = "";
|
||||
|
||||
public NetworkArray GetNetworkData(int clientID) {
|
||||
NetworkArray arr = new();
|
||||
@ -64,3 +99,17 @@ public class PlayerData {
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
public enum PetGeometryType {
|
||||
Default,
|
||||
NightLight,
|
||||
Terror
|
||||
}
|
||||
public enum PetAge {
|
||||
EggInHand = 0,
|
||||
Baby = 1,
|
||||
Child = 2,
|
||||
Teen = 3,
|
||||
Adult = 4,
|
||||
Titan = 5
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user