SolvedClientless with K-Relay.

Posts 1–6 of 6 · Page 1 of 1
Clientless with K-Relay.
SOLVED: Lib_K_Relay.GameData.GameData.Load(); was needed before using Packets...

Hello,

I'm trying to make a clientless application using K-Relay library in C#.
But I'm pretty sure it's something I'm missing when using this lib, since I get:
Code:
An unhandled exception of type 'System.*********enceException' occurred in Lib K Relay.dll
Additional information: Object reference not set to an instance of an object.
And I know what this means but I'm not sure how to initialize things properly with K-Relay without making a plugin. Code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Lib_K_Relay;
using Lib_K_Relay.Utilities;
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.Server;
using Lib_K_Relay.Networking.Packets.DataObjects;

namespace RotmgBot {
    class Program {
        public static void Initialize (Proxy proxy) {
            proxy.ClientConnected += OnClientConnected;
        }
        public static void OnClientConnected (Client client) {
            Console.WriteLine("A Client connected!");
        }

       static void Main (string[] args) {
            System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient("54.154.210.40", 2050);
            Proxy proxy = new Proxy();
            proxy.Start();
            Initialize(proxy);
            HelloPacket helloP = Packet.Create<HelloPacket>(PacketType.HELLO); //Here is where error happens. Packet.Create throws error linked above.
            helloP.BuildVersion = "27.7.X10.2";
            helloP.GameId = -2;
            helloP.GUID = "email";
            helloP.Password = "pass";
            helloP.Random1 = new Random().Next(100, 1000);
            helloP.Random2 = new Random().Next(200, 200000);
            helloP.Secret = "";
            helloP.KeyTime = -1;
            helloP.Key = new byte[0];
            helloP.MapJSON = "";
            helloP.EntryTag = "";
            helloP.GameNet = "rotmg";
            helloP.GameNetUserId = "";
            helloP.PlayPlatform = "rotmg";
            helloP.PlatformToken = "";
            helloP.Send = true;
            helloP.UserToken = "";
            Client c = new Client(proxy, tcpClient);
            c.Connect(helloP);
            Console.Read();
        }
    }
}
Any help would be greatly appreciated.
Quote Originally Posted by teamfe View Post
Hello,

<...>
Any help would be greatly appreciated.
Try
Code:
HelloPacket hellop = (HelloPacket)Packet.Create(PacketType.HELLO);
Quote Originally Posted by New View Post

Try
Code:
HelloPacket hellop = (HelloPacket)Packet.Create(PacketType.HELLO);
Same issue, I'm pretty sure I'm just missing something because it's "Packet" class it's saying is null pretty much. :/

- - - Updated - - -

Solved... didn't Lib_K_Relay.GameData.GameData.Load(); before...
Don't forget to encrypt Pass and Email

Code:
private static HelloPacket CreateHello(string email, string pass)
        {
            HelloPacket hello = (HelloPacket)Packet.Create(PacketType.HELLO);
            hello.BuildVersion = "27.7.0";
            hello.GameId = -2;
            hello.GUID = RSAx.Encrypt(email);
            hello.Password = RSAx.Encrypt(pass);
            hello.Random1 = new Random().Next(0x186a0, 0xf4240);
            hello.Random2 = new Random().Next(0x30d40, 0x1312d00);
            hello.Secret = "";
            hello.KeyTime = -1;
            hello.Key = new byte[0];
            hello.MapJSON = "";
            hello.EntryTag = "";
            hello.GameNet = "rotmg";
            hello.GameNetUserId = "";
            hello.PlayPlatform = "rotmg";
            hello.PlatformToken = "";
            hello.Send = true;
            hello.UserToken = "";
            return hello;
        }
Yep, got a function like it pretty much. All good now.
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us