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.