Results 1 to 8 of 8
  1. #1
    pixelzerg's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    UK
    Posts
    188
    Reputation
    10
    Thanks
    1,113

    Move Packet in K Relay

    How the heck does one move in K Relay?

    The required variables are really confusing:
    TickId => Int32
    Time => Int32
    NewPosition => Location
    Records => LocationRecord[]
    Send => Boolean
    Id => Byte

    I, and probably a ton of people really would appreciate if someone made a K Relay move framework/ method.
    Something where I can just do:

    K-Relay-Move-Framework.Move(X,Y);
    Last edited by pixelzerg; 08-06-2015 at 06:26 AM.

  2. #2
    Psifour's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    28
    Reputation
    10
    Thanks
    5
    Movement is one of the more complex things that goes through the proxy. In all seriousness you would be better off implementing all movement in the client.

    I think you will need to spoof a series of move packets to get your character to the right spot server-side, inform the client to move with a goto, block the acknowledgement of the goto that the client tries to send back, and artificially tween the real and spoofed locations records until they are back in sync with each other.

    I will know later today probably though as I need to come up with a clean solution for another plugin I am making.

  3. #3
    AmejiOrape's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Posts
    184
    Reputation
    27
    Thanks
    99
    My Mood
    Relaxed
    Quote Originally Posted by Psifour View Post
    move with a goto,
    If I am correct, using the goto packet will insta-dc you. Autoloot bots still use it because the time for them to dc is enough to pick up loot.

  4. #4
    059's Avatar
    Join Date
    Mar 2011
    Gender
    male
    Location
    California
    Posts
    3,312
    Reputation
    700
    Thanks
    92,771
    Sending a move packet will move you server sided but your client will not move. To move your player and have your client change as well, you have to use GOTOs, then simply block the GOTOACK. It won't dc you and it works well. Just make sure you teleport within the range of legitimate movement.
    My Vouches
    Having an issue with RotMG? Check for the solution here.


    Need Realm items? Come to RealmStock!

    Accepting PayPal - Bitcoin - Giftcards
    Selling ST Sets, Class Top Sets, Life Pots, and much more!


    Find it here: MPGH Sales Thread

  5. #5
    Psifour's Avatar
    Join Date
    Jul 2015
    Gender
    male
    Posts
    28
    Reputation
    10
    Thanks
    5
    Thank you, 059, for confirming that for me. I was pretty confident in what I posted being the right answer, but I always like to hear it from someone more knowledgeable.

  6. #6
    pixelzerg's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    UK
    Posts
    188
    Reputation
    10
    Thanks
    1,113
    Thanks, guys, for all your help. I'm going to get started on a "move" class tomorrow that will hopefully significantly simplify the process of sending a move packet.

  7. #7
    pixelzerg's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    UK
    Posts
    188
    Reputation
    10
    Thanks
    1,113
    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--;
                }
            }
        }
    }

  8. #8
    pixelzerg's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Location
    UK
    Posts
    188
    Reputation
    10
    Thanks
    1,113
    turns out you don't need to send the MOVE packet at all in order to move - we now know thanks to jex, see this thread for the working movement framework: https://www.mpgh.net/forum/showthread...5#post10834805

Similar Threads

  1. [Help Request] Send "Trade Accept" Packet w/K Relay
    By pixelzerg in forum Realm of the Mad God Help & Requests
    Replies: 1
    Last Post: 06-20-2015, 01:34 PM
  2. New Packets for Realm Relay
    By congresses in forum Realm of the Mad God Tutorials & Source Code
    Replies: 6
    Last Post: 09-19-2014, 10:45 AM
  3. [Help Request] Realm relay MOVE packet
    By pieoewieoe in forum Realm of the Mad God Help & Requests
    Replies: 8
    Last Post: 07-07-2014, 12:39 PM
  4. [Solved] MOVE packet locationRecord, and another question
    By 059 in forum Realm of the Mad God Help & Requests
    Replies: 7
    Last Post: 03-12-2014, 08:16 AM
  5. [Solved] Artificially sending MOVE packet
    By Trollaux in forum Realm of the Mad God Help & Requests
    Replies: 1
    Last Post: 11-30-2013, 10:57 PM