AppendByteArray() public méthode

public AppendByteArray ( byte buffer, int count ) : void
buffer byte
count int
Résultat void
Exemple #1
0
        private static void OnChatPublic(PacketReader reader_, int Index_)
        {
            ushort msglen = reader_.ReadWord();

            byte[] bmsg = reader_.ReadByteArray(msglen * 2);

            if (Player.Flags[Index_].GM == 1)
            {
                string msg = Encoding.Unicode.GetString(bmsg);
                if (msg.ToCharArray()[0] == '.' && msg.Contains("level"))
                {
                    string[] tmpString = msg.Split(' ');
                    Stats.GetXP(Index_, Convert.ToUInt64(tmpString[1]), Convert.ToUInt64(tmpString[2]));
                }
            }

            PacketWriter writer = new PacketWriter();

            writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_CHAT);
            writer.AppendByte(1);
            writer.AppendDword(Player.General[Index_].UniqueID);
            writer.AppendWord(msglen);
            writer.AppendByteArray(bmsg, bmsg.Length);
            ServerSocket.SendPacketInRange(writer.getWorkspace(), Index_);
        }
Exemple #2
0
        private static void OnChatWhisper(PacketReader reader_, int Index_)
        {
            ushort charlen = reader_.ReadWord();
            string name    = reader.ReadString(false, charlen);

            if (name.ToCharArray(0, 1)[0] == '[')
            {
                name = name.Substring(3);
            }

            ushort msglen = reader_.ReadWord();

            byte[] bmsg = reader_.ReadByteArray(msglen * 2);


            if (DatabaseCore.Character.GetIndexByName(name) != -1)
            {
                PacketWriter writer = new PacketWriter();
                writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_CHAT);
                writer.AppendByte(2);
                writer.AppendWord((ushort)Player.General[Index_].CharacterName.Length);
                writer.AppendString(false, Player.General[Index_].CharacterName);
                writer.AppendWord((ushort)(msglen / 2));
                writer.AppendByteArray(bmsg, bmsg.Length);
                for (int i = 0; i <= Player.PlayersOnline; i++)
                {
                    if (Player.General[i].CharacterName == name)
                    {
                        ServerSocket.Send(writer.getWorkspace(), i);
                        break;
                    }
                }
            }
        }
Exemple #3
0
        public static void SendExternNotice(string msg)
        {
            byte[] bmsg = Encoding.Unicode.GetBytes(msg);

            PacketWriter writer = new PacketWriter();

            writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_CHAT);
            writer.AppendByte(7);
            writer.AppendWord((ushort)(bmsg.Length / 2));
            writer.AppendByteArray(bmsg, bmsg.Length);
            ServerSocket.SendToAllIngame(writer.getWorkspace());
        }
Exemple #4
0
        private static void OnChatNotice(PacketReader reader_)
        {
            ushort msglen = reader_.ReadWord();

            byte[] bmsg = reader_.ReadByteArray(msglen * 2);

            PacketWriter writer = new PacketWriter();

            writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_CHAT);
            writer.AppendByte(7);
            writer.AppendWord(msglen);
            writer.AppendByteArray(bmsg, bmsg.Length);
            ServerSocket.SendToAllIngame(writer.getWorkspace());
        }
Exemple #5
0
        private static void OnChatNotice(PacketReader reader_)
        {
            ushort msglen = reader_.ReadWord();

            byte[] bmsg = reader_.ReadByteArray(msglen * 2);

            PacketWriter writer = new PacketWriter();
            writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_CHAT);
            writer.AppendByte(7);
            writer.AppendWord(msglen);
            writer.AppendByteArray(bmsg, bmsg.Length);
            ServerSocket.SendToAllIngame(writer.getWorkspace());
        }
Exemple #6
0
        public static void SendExternNotice(string msg)
        {
            byte[] bmsg = Encoding.Unicode.GetBytes(msg);

            PacketWriter writer = new PacketWriter();
            writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_CHAT);
            writer.AppendByte(7);
            writer.AppendWord((ushort)(bmsg.Length / 2));
            writer.AppendByteArray(bmsg, bmsg.Length);
            ServerSocket.SendToAllIngame(writer.getWorkspace());
        }
Exemple #7
0
        private static void OnChatWhisper(PacketReader reader_, int Index_)
        {
            ushort charlen = reader_.ReadWord();
            string name = reader.ReadString(false, charlen);

            if (name.ToCharArray(0, 1)[0] == '[')
                name = name.Substring(3);

            ushort msglen = reader_.ReadWord();
            byte[] bmsg = reader_.ReadByteArray(msglen * 2);

            if (DatabaseCore.Character.GetIndexByName(name) != -1)
            {
                PacketWriter writer = new PacketWriter();
                writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_CHAT);
                writer.AppendByte(2);
                writer.AppendWord((ushort)Player.General[Index_].CharacterName.Length);
                writer.AppendString(false, Player.General[Index_].CharacterName);
                writer.AppendWord((ushort)(msglen / 2));
                writer.AppendByteArray(bmsg, bmsg.Length);
                for (int i = 0; i <= Player.PlayersOnline; i++)
                {
                    if (Player.General[i].CharacterName == name)
                    {
                        ServerSocket.Send(writer.getWorkspace(), i);
                        break;
                    }
                }
            }
        }
Exemple #8
0
        private static void OnChatPublic(PacketReader reader_, int Index_)
        {
            ushort msglen = reader_.ReadWord();
            byte[] bmsg = reader_.ReadByteArray(msglen * 2);

            if (Player.Flags[Index_].GM == 1)
            {
                string msg = Encoding.Unicode.GetString(bmsg);
                if (msg.ToCharArray()[0] == '.' && msg.Contains("level"))
                {
                    string[] tmpString = msg.Split(' ');
                    Stats.GetXP(Index_, Convert.ToUInt64(tmpString[1]), Convert.ToUInt64(tmpString[2]));
                }
            }

            PacketWriter writer = new PacketWriter();
            writer.SetOpcode(SERVER_OPCODES.GAME_SERVER_CHAT);
            writer.AppendByte(1);
            writer.AppendDword(Player.General[Index_].UniqueID);
            writer.AppendWord(msglen);
            writer.AppendByteArray(bmsg, bmsg.Length);
            ServerSocket.SendPacketInRange(writer.getWorkspace(), Index_);
        }