Exemple #1
0
        public void SendSpeech(string message, string name, ObjectId itemId, ModelId itemModel, SpeechType type, Color color)
        {
            SendSpeechPacket packet = new SendSpeechPacket
            {
                Id      = itemId,
                Model   = itemModel,
                Type    = type,
                Color   = color,
                Font    = 0x0003,
                Name    = string.IsNullOrEmpty(name) ? "<null>" : name,
                Message = string.IsNullOrEmpty(message) ? "<null>" : message,
            };

            packet.Serialize();

            Send(packet.RawPacket);
        }
Exemple #2
0
        public void Say(ObjectId id, string name, string message, Color?color = null, ModelId?modelId = null,
                        SpeechType type = SpeechType.Normal, ushort font = 0)
        {
            var packet = new SendSpeechPacket()
            {
                Id      = id,
                Name    = name,
                Message = message,
                Color   = color ?? (Color)0,
                Model   = modelId ?? 0,
                Font    = font,
                Type    = type,
            };

            packet.Serialize();

            sendPacket(packet.RawPacket.Payload);
        }
Exemple #3
0
        public void Can_serialize()
        {
            var packet = new SendSpeechPacket
            {
                Id      = new ObjectId(0x0006A12A),
                Model   = 0x000,
                Type    = SpeechType.Speech,
                Color   = (Color)0x0026,
                Font    = 0x0003,
                Name    = "Sedy vlk",
                Message = "Sedy vlk"
            };

            packet.Serialize();

            packet.RawPacket.Payload.Should().BeEquivalentTo(
                new byte[]
            {
                0x1C, 0x00, 0x35, 0x00, 0x06, 0xA1, 0x2A, 0x00, 0x00, 0x03, 0x00, 0x26, 0x00, 0x03, 0x53, 0x65,
                0x64, 0x79, 0x20, 0x76, 0x6C, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x65, 0x64, 0x79,
                0x20, 0x76, 0x6C, 0x6B, 0x00
            });
        }