public static void Init(string address) { Server = new LuServer(1001, 1000, address); Server.AddHandler((byte)RemoteConnection.Auth, (byte)MsgAuthLoginRequest, new LoginRequestHandler()); Server.Start(Config.Current.EncryptPackets); new Thread(Command).Start(); }
public static void Init(string address) { Server = new LuServer(2006, 1000, address); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientValidation, new ClientValidationHandler()); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientLoginRequest, new ClientLoginRequestHandler()); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientCharacterListRequest, new CharacterListRequestHandler()); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientCharacterCreateRequest, new ClientCharacterCreateRequestHandler()); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientCharacterDeleteRequest, new ClientCharacterDeleteRequestHandler()); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientCharacterRenameRequest, new ClientCharacterRenameRequestHandler()); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientLevelLoadComplete, new ClientLevelLoadCompleteHandler()); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientGameMsg, new ClientGameMsgHandler()); Server.AddHandler((ushort)RemoteConnection.World, (uint)MsgWorldClientRoutePacket, new ClientRoutePacketHandler()); Server.Start(Config.Current.EncryptPackets); }
public ConfirmVersionHandler(LuServer server, int port) { _server = server; _port = port; }
public override void Handle(BinaryReader reader, LuClient client) { using (var database = new DbUtils()) { if (!client.Authenticated) { return; } var zone = (ZoneId)reader.ReadUInt16(); var instance = reader.ReadUInt16(); var clone = reader.ReadInt32(); Console.WriteLine( $"Got clientside level load complete packet from {client.Username}. Zone: {zone}, Instance: {instance}, Clone: {clone}."); var account = database.GetAccount(client.Username); var character = database.GetCharacter(account.SelectedCharacter); using (var bitStream = new WBitStream()) { bitStream.WriteHeader(RemoteConnection.Client, (uint)MsgClientCreateCharacter); using (var ldf = new Ldf()) { // TODO: Improve LDF code here ldf.WriteS64("accountID", account.Id); ldf.WriteS32("chatmode", 0); ldf.WriteBool("editor_enabled", false); ldf.WriteS32("editor_level", 0); ldf.WriteBool("freetrial", false); ldf.WriteS32("gmlevel", character.GmLevel); ldf.WriteBool("legoclub", true); var levelid = character.ZoneId + (((long)character.MapInstance) << 16) + (((long)character.MapClone) << 32); ldf.WriteS64("levelid", levelid); ldf.WriteWString("name", character.Name); ldf.WriteId("objid", Character.GetObjectId(character)); ldf.WriteFloat("position.x", character.Position[0]); ldf.WriteFloat("position.y", character.Position[1]); ldf.WriteFloat("position.z", character.Position[2]); ldf.WriteS64("reputation", character.Reputation); ldf.WriteS32("template", 1); using (var xmlData = GenXmlData(character)) ldf.WriteBytes("xmlData", xmlData); bitStream.Write(ldf.GetSize() + 1); bitStream.Write((byte)0); ldf.WriteToPacket(bitStream); WorldServer.Server.Send(bitStream, WPacketPriority.SystemPriority, WPacketReliability.ReliableOrdered, 0, client.Address, false); File.WriteAllBytes("Temp/" + character.Name + ".world_2a.bin", bitStream.GetBytes()); } } WorldServer.Server.SendGameMessage(client.Address, Character.GetObjectId(character), 1642); WorldServer.Server.SendGameMessage(client.Address, Character.GetObjectId(character), 509); using (var gameMessage = LuServer.CreateGameMessage(Character.GetObjectId(character), 472)) { gameMessage.Write((uint)185); gameMessage.Write((byte)0); WorldServer.Server.Send(gameMessage, WPacketPriority.SystemPriority, WPacketReliability.ReliableOrdered, 0, client.Address, false); } var playerObject = new PlayerObject(Character.GetObjectId(character), character.Name); playerObject.Construct(WorldServer.Server, client.Address); } }
public ConfirmVersionHandler(LuServer server, int port) { _server = server; _port = port; }