예제 #1
0
        public void SendCopy(PacketOut Out)
        {
            Out.WritePacketLength();
            PacketOut packet = new PacketOut(0);

            packet.Position = 0;
            packet.Write(Out.ToArray(), 0, Out.ToArray().Length);
            SendPacket(packet);
        }
예제 #2
0
파일: Player.cs 프로젝트: uvbs/DoR
        public void SendCopy(PacketOut Out)
        {
            Out.WritePacketLength();
            byte[]    Buf    = Out.ToArray();
            PacketOut packet = new PacketOut(0);

            packet.Position = 0;
            packet.Write(Buf, 0, Buf.Length);
            SendPacket(packet);
        }
예제 #3
0
        public void SendTCP(PacketOut packet)
        {
            //Fix the packet size
            packet.WritePacketLength();
            packet = Crypt(packet);
            byte[] buf = packet.ToArray(); //packet.WritePacketLength sets the Capacity

            //Send the buffer

            socket.Send(buf);
        }
예제 #4
0
        private void SendBuffer(Player Plr, ref PacketOut Buffer, ref byte Count)
        {
            // On Envoi le Packet des items
            byte[]    ArrayBuf = Buffer.ToArray();
            PacketOut Packet   = new PacketOut((byte)Opcodes.F_GET_ITEM);

            Packet.WriteByte(Count);
            Packet.Fill(0, 3);
            Packet.Write(ArrayBuf, 0, ArrayBuf.Length);
            Packet.WritePacketLength();

            Plr.SendPacket(Packet);

            // On Remet le compteur a zero
            Count = 0;

            // On Initalise un nouveau buffer
            Buffer          = new PacketOut(0);
            Buffer.Position = 0;
        }
예제 #5
0
        public void SendCustomPacket(string hexStringBytes)
        {
            try
            {
                hexStringBytes = hexStringBytes.Replace(" ", "");

                byte opcode = Convert.ToByte(hexStringBytes.Substring(0, 2), 16);

                PacketOut packet = new PacketOut(opcode);
                packet.WriteHexStringBytes(hexStringBytes.Remove(0, 2));

                packet.WritePacketLength();
                packet = Crypt(packet);
                byte[] buf = packet.ToArray(); //packet.WritePacketLength sets the Capacity

                socket.Send(buf);
            }
            catch
            {
                Log.Error("SendCustomPacket: Failed to send packet");
            }
        }
예제 #6
0
        static public void F_REQUEST_CHAR(BaseClient client, PacketIn packet)
        {
            GameClient cclient = client as GameClient;

            cclient.State = (int)eClientState.CharScreen;

            UInt16 Operation = packet.GetUint16();

            if (Operation == 0x2D58)
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_ERROR);
                Out.WriteByte((byte)CharMgr.GetAccountRealm(cclient._Account.AccountId));
                cclient.SendPacket(Out);
            }
            else
            {
                PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_RESPONSE);
                Out.FillString(cclient._Account.Username, 21);
                Out.WriteByte(0);
                Out.WriteByte(0);
                Out.WriteByte(0);
                Out.WriteByte(4);

                if (cclient._Account.GmLevel == 0 && !Program.Config.CreateBothRealms)
                {
                    Out.WriteByte((byte)CharMgr.GetAccountRealm(cclient._Account.AccountId));
                }
                else
                {
                    Out.WriteByte(0);
                }

                byte[] Chars = CharMgr.BuildCharacters(cclient._Account.AccountId);
                Out.Write(Chars, 0, Chars.Length);
                Out.WritePacketLength();
                cclient.SendPacket(Out);
            }
        }
예제 #7
0
파일: Player.cs 프로젝트: uvbs/DoR
        public void SendSniff(string Str)
        {
            string Result = "";

            using (StringReader Reader = new StringReader(Str))
            {
                string Line;
                while ((Line = Reader.ReadLine()) != null)
                {
                    Result += Line.Substring(1, 48).Replace(" ", string.Empty);
                }
            }

            Result = Result.Remove(0, 4);
            byte Opcode = Convert.ToByte(Result.Substring(0, 2), 16);

            Result = Result.Remove(0, 2);

            PacketOut Out = new PacketOut(Opcode);

            Out.WriteHexStringBytes(Result);
            Out.WritePacketLength();
            SendPacket(Out);
        }