WinkK Relay Move - A framework for simulating movement with K Relay

Posts 115 of 21 · Page 1 of 2
K Relay Move - A framework for simulating movement with K Relay
This is a release aimed at coders.
Introducing: KRelayMove!
This framework makes it much easier making your client move with K Relay.
The entire complex process is reduced down to one line:

KRelayMove.MoveClient(client, KRelayMove.Direction.up, 5)



Documentation
Moving the Client
Moving the client is simple and is done with the MoveClient method.
The required variables are:
(Client, Direction, int, float)
Client
The K Relay client object that you want to move
Direction
The K_RelayMove.KRelayMove.Direction variable; the direction that you want the client to move
int
The amount of "steps" you want the client to move.
float
The distance you want the client to move per "step" (basically speed) This variable is not necessary. If not defined, the highest possible amount will be used. If you define a value higher than the highest possible amount, the client will be disconnected.

mClient Class
This class contains all the data about every client connected.
To find the corresponding mClient object to any client:
mClient mclient = KRelayMove.clientlist[KRelayMove.IndexOfClient(client)];



Usage Tutorial
Step1:

Add a reference to your project


Click "browse" and refrence the attatched .dll file


Add the line of code "using K_RelayMove" at the top of your file


Remember you will need to put the K RelayMove.dll file in the K Relay plugin folder along with your .dll file for it to function.




Demo
Here's a quick demo that I made. It only supports 2 clients. Do /follow to proclaim yourself as the one to follow the other client.
Code:
using K_RelayMove;
using Lib_K_Relay;
using Lib_K_Relay.Interface;
using Lib_K_Relay.Networking;
using Lib_K_Relay.Networking.Packets;
using Lib_K_Relay.Utilities;
using System;
using System.Collections.Generic;

namespace K_RelayMoveDemo
{

    public class Follow : IPlugin
    {
        public static List<Client> clientlist = new List<Client>();
        public static bool Enabled = false;
        public static Client WhoFollow;

        public string GetAuthor(){return "PixelZerg";}

        public string[] GetCommands(){return new string[] { "/follow (proclaim yourself the follower)" };}

        public string GetDescription(){return "Make yourself follow another person";}

        public string GetName(){ return "Follow";}

        public void Initialize(Proxy proxy)
        {
            proxy.HookCommand("follow", new Proxy.CommandHandler(this.OnCommand));
            proxy.HookPacket(PacketType.NEWTICK, new Proxy.PacketHandler(this.NT));
            proxy.ClientConnected += new Proxy.ConnectionHandler(this.proxy_ClientConnected);
            proxy.ClientDisconnected += new Proxy.ConnectionHandler(this.proxy_ClientDisconnected);
        }

        private void NT(Client client, Packet packet)
        {
            foreach (Client client2 in clientlist)
            {
                if (client != WhoFollow)
                {
                    if (Math.Abs((float) (client2.PlayerData.Pos.X - WhoFollow.PlayerData.Pos.X)) > KRelayMove.clientlist[KRelayMove.IndexOfClient(client2)].Step)
                    {
                        if (client2.PlayerData.Pos.X > WhoFollow.PlayerData.Pos.X)
                        {
                            KRelayMove.MoveClient(client2, KRelayMove.Direction.right, 1, 8.332474E+09f);
                        }
                        else
                        {
                            KRelayMove.MoveClient(client2, KRelayMove.Direction.left, 1, 8.332474E+09f);
                        }
                    }
                    if (Math.Abs((float) (client2.PlayerData.Pos.Y - WhoFollow.PlayerData.Pos.Y)) > KRelayMove.clientlist[KRelayMove.IndexOfClient(client2)].Step)
                    {
                        if (client2.PlayerData.Pos.Y > WhoFollow.PlayerData.Pos.Y)
                        {
                            KRelayMove.MoveClient(client2, KRelayMove.Direction.down, 1, 8.332474E+09f);
                        }
                        else
                        {
                            KRelayMove.MoveClient(client2, KRelayMove.Direction.up, 1, 8.332474E+09f);
                        }
                    }
                }
            }
        }

        private void OnCommand(Client client, string command, string[] args)
        {
            Enabled = !Enabled;
            if (Enabled)
            {
                WhoFollow = client;
                PluginUtils.CreateNotification(client.ObjectId, "Now Following " + client.PlayerData.Name);
            }
            else
            {
                PluginUtils.CreateNotification(client.ObjectId, "Follow Plugin Disabled");
            }
        }

        private void proxy_ClientConnected(Client client)
        {
            clientlist.Add(client);
        }

        private void proxy_ClientDisconnected(Client client)
        {
            clientlist.Remove(client);
            KRelayMove.MoveClient(client, KRelayMove.Direction.up, 5);
        }
    }
}
The demo script in action:


In-Game Commands
If you place this .dll file in the plugin folder by itself, there are still a few commands you can do in game
to see how the plugin works:

/move up:down:left:right [amount]

This will move your client the specified direction the specified amount. But you probably won't find yourself using that command too often.
This file is meant to be used as a framework not as a standalone plugin :p

Credits:
jex4334
Psifour
059

for helping me figure out how to programatically make a client move.
I also used a method from Jex's code that calculates the client's speed in tiles per second.

K RelayMove_mpgh.net.zip4 KB · 223 downloads Clean
can this be used to evade shots? or to follow another person that is not using krelay?
Quote Originally Posted by mateo_gon View Post
can this be used to evade shots?
Probably, but I haven't personally found a way to find the location of projectiles. Once you know that, it's just a simple matter of moving to the side
Approved
Might wanna give @Juix some credit because you used some of his code
Quote Originally Posted by krazyshank View Post
Approved
Might wanna give @Juix some credit because you used some of his code
Added credits. I think I did use a small method from Jex that calculated movement speed.
Well I am very impressed. My current method of moving was ugly and behaved oddly in edge cases. I will give this a run in a bit to see how well it behaves. Also, please add my on Skype pixel as I would love to discuss some RoTMG related things with you.
This seems like a pretty cool release. Thank you for your time and effort
Nice and thanks for releasing. Your tiles per second equation seems much more accurate than mine.
Quote Originally Posted by NisuxenZ View Post
Nice and thanks for releasing. Your tiles per second equation seems much more accurate than mine.
You've got @Juix to thank for that
Thanks for sharing
Someone do EUNorth2 bots plz
Can you give me a few hints on how to add a third follower pls.
use logic.
No but seriously, the computer does everything EXACTLY as you tell it to.
Have a logical approach.
I would personally make an enumeration or a class with non-static variables as a type of Client.
Store the coordinates and data in that class.
Make a list of said classes.
Move each one to the main class.
Dunno if that made any sense :/
using K_RelayMove;
using Lib_K_Relay;
using Lib_K_Relay.Interface;
using Lib_K_Relay.Networking;
using Lib_K_Relay.Networking.Packets;
using Lib_K_Relay.Utilities;
using System;
using System.Collections.Generic;


namespace K_RelayMoveDemo
{


public class Followme : IPlugin
{
public static List<Client> clientlist = new List<Client>();
public static bool Enabled = false;
public static Client WhoFollowme;


public string GetAuthor(){return "x";}


public string[] GetCommands(){return new string[] { "/followme (proclaim yourself the leader)" };}


public string GetDescription(){return "Make clients follow me ";}


public string GetName(){ return "Followme";}


public void Initialize(Proxy proxy)
{
proxy.HookCommand("followme", new Proxy.CommandHandler(this.OnCommand));
proxy.HookPacket(PacketType.NEWTICK, new Proxy.PacketHandler(this.NT));
proxy.ClientConnected += new Proxy.ConnectionHandler(this.proxy_ClientConnected );
proxy.ClientDisconnected += new Proxy.ConnectionHandler(this.proxy_ClientDisconnec ted);
}


private void NT(Client client, Packet packet)
{
foreach (Client client2 in clientlist)
{
if (client != WhoFollowme)
{
if (Math.Abs((float) (WhoFollowme.PlayerData.Pos.X - client2.PlayerData.Pos.X)) > KRelayMove.clientlist[KRelayMove.IndexOfClient(client)].Step)
{
if (client2.PlayerData.Pos.X > WhoFollowme.PlayerData.Pos.X) //client2>client 1
{
KRelayMove.MoveClient(client2, KRelayMove.Direction.left, 1, 8.332474E+09f);
}
else
{
KRelayMove.MoveClient(client2, KRelayMove.Direction.right, 1, 8.332474E+09f);
}
}
if (Math.Abs((float) (WhoFollowme.PlayerData.Pos.X - client2.PlayerData.Pos.Y)) > KRelayMove.clientlist[KRelayMove.IndexOfClient(client)].Step)
{
if (client2.PlayerData.Pos.Y > WhoFollowme.PlayerData.Pos.Y)
{
KRelayMove.MoveClient(client2, KRelayMove.Direction.down, 1, 8.332474E+09f);
}
else
{
KRelayMove.MoveClient(client2, KRelayMove.Direction.up, 1, 8.332474E+09f);
}
}
}
}
}
private void NT(Client client, Packet packet)
{
foreach (Client client3 in clientlist)
{
if (client != WhoFollowme)
{
if (Math.Abs((float) (WhoFollowme.PlayerData.Pos.X – client3.PlayerData.Pos.X)) > KRelayMove.clientlist[KRelayMove.IndexOfClient(client)].Step)
{
if (client3.PlayerData.Pos.X > WhoFollowme.PlayerData.Pos.X) //client3>client 1
{
KRelayMove.MoveClient(client3, KRelayMove.Direction.left, 1, 8.332474E+09f);
}
else
{
KRelayMove.MoveClient(client3, KRelayMove.Direction.right, 1, 8.332474E+09f);
}
}
if (Math.Abs((float) (WhoFollowme.PlayerData.Pos.X – client3.PlayerData.Pos.Y)) > KRelayMove.clientlist[KRelayMove.IndexOfClient(client)].Step)
{
if (client3.PlayerData.Pos.Y > WhoFollowme.PlayerData.Pos.Y)
{
KRelayMove.MoveClient(client3, KRelayMove.Direction.down, 1, 8.332474E+09f);
}
else
{
KRelayMove.MoveClient(client3, KRelayMove.Direction.up, 1, 8.332474E+09f);
}
}
}
}
}
private void OnCommand(Client client, string command, string[] args)
{
Enabled = !Enabled;
if (Enabled)
{
WhoFollowme = client;
PluginUtils.CreateNotification(client.ObjectId, "Now Following " + client.PlayerData.Name);
}
else
{
PluginUtils.CreateNotification(client.ObjectId, "Followme Plugin Disabled");
}
}


private void proxy_ClientConnected(Client client)
{
clientlist.Add(client);
}


private void proxy_ClientDisconnected(Client client)
{
clientlist.Remove(client);
KRelayMove.MoveClient(client, KRelayMove.Direction.up, 5);
}
}
}

/client being leader/follow me,
/client 2,3 followers

/ and instead of doing /follow on all the clients that need to follow I think replace it w one /followme and set client2,client3,client4... to be folowers

*********************
**updated to FolowMe**
*********************
Quote Originally Posted by 102387 View Post
i personally cannot create the plugin myself(MVS won't start for me) but i will be happy to see if some one will do this, i don't care about the credit i just want this plugin.
If such a plugin was released publicly, it could have some severe effects on rotmg....
Posts 115 of 21 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?