ingame cmd update
Now commands are transfering via base64, and teleport command can increase/decreae position (+ before cords value to increase and -- to decrease)
This commit is contained in:
parent
209bd16248
commit
28674c0aed
@ -19,11 +19,6 @@ namespace Campofinale.Commands.Handlers
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i=0; i < args.Length; i++)
|
||||
{
|
||||
args[i] = Uri.UnescapeDataString(args[i]);
|
||||
}
|
||||
|
||||
target.nickname = string.Join(" ", args);
|
||||
target.Save();
|
||||
target.Send(new PacketScSetName(target, target.nickname));
|
||||
|
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using static Campofinale.Resource.ResourceManager;
|
||||
using Campofinale.Packets.Sc;
|
||||
using MongoDB.Bson;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Campofinale.Commands.Handlers
|
||||
{
|
||||
@ -21,17 +22,27 @@ namespace Campofinale.Commands.Handlers
|
||||
return;
|
||||
}
|
||||
|
||||
float x, y, z;
|
||||
for (int i=0; i < args.Length; i++)
|
||||
{
|
||||
args[i] = args[i].Replace(",", ".");
|
||||
}
|
||||
|
||||
x = args[0] == "~" ? target.position.x : float.Parse(args[0]);
|
||||
y = args[1] == "~" ? target.position.y : float.Parse(args[1]);
|
||||
z = args[2] == "~" ? target.position.z : float.Parse(args[2]);
|
||||
float[] pos = [target.position.x, target.position.y, target.position.z];
|
||||
|
||||
for (int i=0; i < args.Length; i++) {
|
||||
if(args[i] == "~") continue;
|
||||
|
||||
float curPos = pos[i];
|
||||
pos[i] = float.Parse(args[i].StartsWith("--") ? args[i].Trim('-') : args[i], CultureInfo.InvariantCulture);
|
||||
if (args[i].StartsWith('+')) pos[i] += curPos;
|
||||
if (args[i].StartsWith("--")) pos[i] = curPos - pos[i];
|
||||
}
|
||||
|
||||
Vector3f position = new Vector3f(new Vector()
|
||||
{
|
||||
X = x,
|
||||
Y = y,
|
||||
Z = z
|
||||
X = pos[0],
|
||||
Y = pos[1],
|
||||
Z = pos[2]
|
||||
});
|
||||
|
||||
target.position = position;
|
||||
|
@ -154,7 +154,7 @@
|
||||
|
||||
try {
|
||||
const url = new URL('%dispatchip%/pcSdk/console');
|
||||
url.searchParams.append('command', command);
|
||||
url.searchParams.append('command', btoa(unescape(encodeURIComponent(command))));
|
||||
url.searchParams.append('token', token);
|
||||
|
||||
const response = await fetch(url.toString(), {
|
||||
|
@ -30,7 +30,8 @@ namespace Campofinale.Http
|
||||
[StaticRoute(HttpServerLite.HttpMethod.GET, "/pcSdk/console")]
|
||||
public static async Task ConsoleResponce(HttpContext ctx)
|
||||
{
|
||||
string cmd = ctx.Request.Query.Elements["command"].Replace("+"," ");
|
||||
string encodedCmd = Uri.UnescapeDataString(ctx.Request.Query.Elements["command"]);
|
||||
string cmd = Encoding.UTF8.GetString(Convert.FromBase64String(encodedCmd));
|
||||
string token = ctx.Request.Query.Elements["token"];
|
||||
string message = "";
|
||||
string[] split = cmd.Split(" ");
|
||||
|
Loading…
Reference in New Issue
Block a user