예제 #1
0
        public virtual void SendTCPRaw(PacketOut packet)
        {
            if (!packet.Finalized)
            {
                packet.WritePacketLength();
            }

            SendAsynchronousTCP2((byte[])packet.GetBuffer().Clone());
        }
예제 #2
0
        // Envoi un packet
        public void SendTCP(PacketOut packet)
        {
            //Fix the packet size
            packet.WritePacketLength();
            packet = Crypt(packet);

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

            //Send the buffer
            SendTCP(buf);
        }
예제 #3
0
        // Envoi un packet
        public virtual void SendPacket(PacketOut packet)
        {
            if (!packet.Finalized)
            {
                packet.WritePacketLength();
            }

            //Send the encrypted packet
            SendPacketNoBlock(packet);
            // Crypt(packet);
            // SendAsynchronousTCP(TLSendBuffer.Value);
        }
예제 #4
0
        public void SendToAll(PacketOut Packet)
        {
            Packet.WritePacketLength();

            lock (Clients.SyncRoot)
            {
                for (int i = 0; i < Clients.Length; ++i)
                {
                    if (Clients[i] != null)
                    {
                        Clients[i].SendTCP(Packet.ToArray());
                    }
                }
            }
        }
예제 #5
0
        public void SendToAll(PacketOut Packet)
        {
            Packet.WritePacketLength();

            LockReadClients();

            for (int i = 0; i < Clients.Length; ++i)
            {
                if (Clients[i] != null)
                {
                    Clients[i].SendTCP(Packet.ToArray());
                }
            }

            UnLockReadClients();
        }
        // Unused
        public void SendToAll(PacketOut Packet)
        {
            if (!Packet.Finalized)
            {
                Packet.WritePacketLength();
            }

            LockReadClients();

            for (int i = 0; i < Clients.Length; ++i)
            {
                if (Clients[i] != null)
                {
                    Clients[i].SendAsynchronousTCP(Packet.ToArray());
                }
            }

            UnLockReadClients();
        }
예제 #7
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);
            }
        }
예제 #8
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;
        }
예제 #9
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);
 }
예제 #10
0
파일: Player.cs 프로젝트: dzikun/WarEmu
 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);
     
 }
예제 #11
0
파일: Player.cs 프로젝트: dzikun/WarEmu
        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);
        }