Well I tried making a move class.
It currently gives you a protocol error
Any help is appreciated in making it work:
Code:
//class1.cs
using Lib_K_Relay;
using Lib_K_Relay.Interface;
using Lib_K_Relay.Networking;
using Lib_K_Relay.Networking.Packets;
using Lib_K_Relay.Networking.Packets.Client;
using Lib_K_Relay.Networking.Packets.DataObjects;
using Lib_K_Relay.Networking.Packets.Server;
using Lib_K_Relay.Utilities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows;
using System.Globalization;
using Move;
namespace KRelayMove
{
public partial class Move : IPlugin
{
public static int tickno = 0;
public static List<LocationRecord> locrecs = new List<LocationRecord>();
#region Define IPlugin
public string GetAuthor()
{ return "PixelZerg"; }
public string GetName()
{ return "Plugin"; }
public string GetDescription()
{ return "An awesome Plugin by " + GetAuthor(); }
public string[] GetCommands()
{ return new string[] { "*none*" }; }
#endregion
public void Initialize(Proxy proxy)
{
proxy.HookCommand("go", OnCommand);
proxy.HookPacket(PacketType.NEWTICK, NT);
proxy.HookPacket(PacketType.MOVE, MOVE);
}
private void MOVE(Client client, Packet packet)
{
// Console.WriteLine("Tickno = " + tickno);
MovePacket move = (MovePacket)packet;
// Console.WriteLine("Setting Up LocRec:");
LocationRecord add = new LocationRecord();
add.X = move.NewPosition.X;
add.Y = move.NewPosition.Y;
// Console.WriteLine("Loc: " +add.X + ", " + add.Y);
add.Time = client.Time;
// Console.WriteLine("Time = " +client.Time);
locrecs.Add(add);
}
private void OnCommand(Client client, string command, string[] args)
{
try
{
Up(client, tickno, locrecs,Int32.Parse(args[0]));
}
catch
{
Up(client, tickno,locrecs);
}
}
private void NT(Client client, Packet packet)
{
tickno++;
}
}
}
//Move.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lib_K_Relay;
using Lib_K_Relay.Interface;
using Lib_K_Relay.Networking;
using Lib_K_Relay.Networking.Packets;
using Lib_K_Relay.Networking.Packets.Client;
using Lib_K_Relay.Networking.Packets.DataObjects;
using Lib_K_Relay.Networking.Packets.Server;
using Lib_K_Relay.Utilities;
namespace KRelayMove
{
public partial class Move
{
public static void Up(Client client, int tickno, List<LocationRecord> locrecs, int amount = 1)
{
while (amount != 0)
{
Console.Clear();
Console.WriteLine("Current Pos: " + client.PlayerData.Pos.X + ", " + client.PlayerData.Pos.Y);
Console.WriteLine("Current Time: " + client.Time);
Console.WriteLine("=======================================");
MovePacket move = (MovePacket)Packet.Create(PacketType.MOVE);
/*
move.Records = new LocationRecord[]
{
new LocationRecord
{
Time = client.Time,
X = client.PlayerData.Pos.X,
Y =client.PlayerData.Pos.Y
}
};
*/
List<LocationRecord> a = new List<LocationRecord>();
a.Add(locrecs[locrecs.Count-2]);
Console.WriteLine("=======locrecs==========");
foreach (var item in a.ToArray())
{
Console.WriteLine("Time: " + item.Time);
Console.WriteLine("Pos: " + item.X + ", " + item.Y);
}
Console.WriteLine("======================");
move.Records = a.ToArray();
Location newpos = new Location();
newpos.X = client.PlayerData.Pos.X;
newpos.Y = client.PlayerData.Pos.Y + (float)0.1;
Console.WriteLine("NewPos = " + newpos.X + ", " + newpos.Y);
move.NewPosition = newpos;
move.TickId = tickno;
move.Time = client.Time;
Console.WriteLine("Time = " + move.Time);
client.SendToServer(move);
amount--;
}
}
}
}