Пример #1
0
        private static void OnC2SAskDeleteCharacter(ByteBuffer buffer, Connection connection)
        {
            var packet = new CharacterPackets.C2SAskDeleteCharacter(buffer, connection);
            var userID = CCM.GetClientConnection(connection).UserID;

            DBConnection.connection.SendObject("DeleteCharacter", new[] { userID, packet.charSlot });
        }
Пример #2
0
        private static void OnC2SAskDuplicateName(ByteBuffer buffer, Connection connection)
        {
            var incPacket = new CharacterPackets.C2SAskDublicateNameCheck(buffer, connection);
            var userID    = CCM.GetClientConnection(connection).UserID;

            DBConnection.connection.SendObject("AskDuplicateName", new[] { incPacket.name, userID.ToString() });
        }
Пример #3
0
 public static void RegisterAuthPackets()
 {
     connection.AppendIncomingPacketHandler <string[]>("UserLoginSucces", (header, connection, content) =>
     {
         ClientConnection conn = CCM.GetClientConnection(content[1]);
         conn.UserID           = Int32.Parse(content[0]);
         var packet            = new AuthPackets.S2CAnsLogin(true);
         packet.Send(conn.AuthConnection);
     });
 }
Пример #4
0
        private static void OnC2SAskServerSelect(ByteBuffer buffer, Connection connection)
        {
            var    incPacket = new AuthPackets.C2SAskServerSelect(buffer, connection);
            int    userID    = CCM.GetClientConnection(connection).UserID;
            string ip        = "127.0.0.1";
            int    port      = 8000;
            //AgentConnection.connection.SendObject("UserEnterCharSelect",userID);
            var outPacket = new AuthPackets.S2CAnsServerSelect(userID, ip, port);

            outPacket.Send(connection);
        }
Пример #5
0
        private static void OnC2SAskEnterGame(ByteBuffer buffer, Connection connection)
        {
            //byte charSlot=0;
            var   selectedCharSlot = buffer.ReadByte();
            short charSlot         = buffer.ReadInt16();
            var   x      = charSlot / 128;
            var   packet = new ConnectionPackets.C2SAskEnterGame((byte)x, connection);
            var   userID = CCM.GetClientConnection(connection).UserID;

            DBConnection.connection.SendObject("GetFullCharacter", new[] { userID, packet.charSlot });
        }
Пример #6
0
        private static void OnC2SAskCreateCharacter(ByteBuffer buffer, Connection connection)
        {
            var incPacket = new CharacterPackets.C2SAskCreateCharacter(buffer, connection);
            var userId    = CCM.GetClientConnection(connection).UserID;
            var chaInfo   = new string[]
            {
                userId.ToString(),
                incPacket.CharName,
                incPacket.ClassCode.ToString(),
                incPacket.HeightCode.ToString(),
                incPacket.FaceCode.ToString(),
                incPacket.HairCode.ToString()
            };

            DBConnection.connection.SendObject("CreateCharacter", chaInfo);
        }
Пример #7
0
        private static void OnC2SAskEnterWorld(ByteBuffer buffer, Connection connection)
        {
            var incPacket = new SyncPackets.C2SAskEnterWorld(buffer);
            var cc        = CCM.GetClientConnection(connection);

            var positionInfoPacket = new SyncPackets.S2CAnsPlayerPositionInfo(cc.Character);

            positionInfoPacket.Send(connection);

            var guildInformationPacket = new SyncPackets.S2CAnsGuildInfo(cc.Character);

            guildInformationPacket.Send(connection);

            var equipInformationPacket = new SyncPackets.S2CAnsEquipInfo(cc.Character);

            equipInformationPacket.Send(connection);
        }
Пример #8
0
        public static void RegisterDBPackets()
        {
            connection.AppendIncomingPacketHandler <byte[]>("CharacterCreateSuccess",
                                                            (header, connection, character) =>
            {
                ByteBuffer buffer  = new ByteBuffer(character);
                var userID         = BitConverter.ToInt32(buffer.ReadBlock(5), 0);
                var characterbytes = buffer.ReadBlock(buffer.Data.Length - 5);
                var cc             = CCM.GetClientConnection(userID);
                //var charstruct = new PacketStructs.CharacterInfo(character);
                var packet = new CharacterPackets.S2CAnsCreateCharacter(characterbytes, cc.AgentConnection);
                packet.Send(cc.AgentConnection);
            });
            connection.AppendIncomingPacketHandler <byte[]>("CharacterList", ((header, connection1, bytes) =>
            {
                ByteBuffer buffer = new ByteBuffer(bytes);
                var userID = BitConverter.ToInt32(buffer.ReadBlock(4), 0);
                var cc = CCM.GetClientConnection(userID);
                var packet = new ConnectionPackets.S2CAnsEnterCharSelect(buffer.Data);
                packet.Send(cc.AgentConnection);
            }));
            connection.AppendIncomingPacketHandler <int>("CharacterDeleteSuccess", (
                                                             (header, connection1, userID) =>
            {
                var conn = CCM.GetClientConnection(userID).AgentConnection;
                var packet = new CharacterPackets.S2CAnsDeleteCharacter(conn);
                packet.Send(conn);
            }));
            connection.AppendIncomingPacketHandler <int[]>("CharacterDeleteFailed", (
                                                               (header, connection1, incomingObject) =>
            {
                var conn = CCM.GetClientConnection(incomingObject[1]).AgentConnection;
                var errorCode = incomingObject[0];
                var packet = new CharacterPackets.S2CErrCharacterPacket(errorCode, conn);
                packet.Send(conn);
            }));
            connection.AppendIncomingPacketHandler <int>("CheckDuplicateNameSuccess", (
                                                             (header, connection1, incomingObject) =>
            {
            }));
            connection.AppendIncomingPacketHandler <int>("CheckDuplicateNameFailed", (
                                                             (header, connection1, incomingObject) =>
            {
                var conn = CCM.GetClientConnection(incomingObject).AgentConnection;
                var packet = new CharacterPackets.S2CAnsDuplicateNameCheck(0, connection);     //0 oder 5
                packet.Send(conn);
            }));
            connection.AppendIncomingPacketHandler <byte[]>("FullCharacterBytes", ((header, connection1,
                                                                                    fullCharacterBytes) =>
            {
                var userID = BitConverter.ToInt32(ByteUtils.SlicedBytes(fullCharacterBytes, 4, 8), 0);
                var conn = CCM.GetClientConnection(userID);
                var character = new Character(fullCharacterBytes);
                conn.Character = character;
                var playerInfoPacket = new CharacterPackets.S2CCharacterInfo(character);
                playerInfoPacket.Send(conn.AgentConnection);

                var skillInfoPacket = new CharacterPackets.S2CSkillInfo(character);
                skillInfoPacket.Send(conn.AgentConnection);

                var quickInfoPacket = new CharacterPackets.S2CQuickInfo(character);
                quickInfoPacket.Send(conn.AgentConnection);

                var styleInfoPacket = new CharacterPackets.S2CStyleInfo(character);
                styleInfoPacket.Send(conn.AgentConnection);

                var stateInfoPacket = new CharacterPackets.S2CStatePacket(character);
                stateInfoPacket.Send(conn.AgentConnection);

                var packet = new ConnectionPackets.S2CAnsEnterGame(character.Id);
                packet.Send(conn.AgentConnection);
            }));
        }