Beispiel #1
0
 public static byte[] CastSpell(byte spell)
 {
     PacketWriter writer = new PacketWriter(0x12);
     writer.WriteBlockSize();
     writer.Write((byte)0x56);
     writer.WriteAsciiString(spell.ToString());
     return writer.GetBytes();
 }
Beispiel #2
0
        public static byte[] CharacterSpeechAscii(uint serial, ushort model, string name, SpeechType type, SpeechFont font, ushort color, string text)
        {
            // For security reasons
            if (text.Length > Core.MaxSpeechLenght)
                text = text.Remove(Core.MaxSpeechLenght);

            PacketWriter writer = new PacketWriter(0x1C);

            writer.WriteBlockSize();
            writer.Write(serial);
            writer.Write(model);
            writer.Write((byte)type);
            writer.Write(color);
            writer.Write((ushort)font);
            writer.WriteAsciiString(name, 30);
            writer.WriteAsciiString(text);

            return writer.GetBytes();
        }
Beispiel #3
0
        /// <summary>
        /// Packet will not contain passwords and starting locations. Flags will be set to 0x00.
        /// </summary>
        /// <param name="characters">List of characters.</param>
        public static byte[] CharacterList(params string[] characters)
        {
            PacketWriter writer = new PacketWriter(0xA9);

            writer.WriteBlockSize();
            writer.Write((byte)5);

            for (int i = 0; i < 5; i++) {
                if (i < characters.Length) {
                    writer.WriteAsciiString(characters[i], 30);
                    writer.WriteBytes(0, 30);
                }
                else {
                    writer.WriteBytes(0, 60);
                }
            }

            writer.WriteBytes(0, 2);

            return writer.GetBytes();
        }
Beispiel #4
0
 public static byte[] UseSkill(ushort skill)
 {
     PacketWriter writer = new PacketWriter(0x12);
     writer.WriteBlockSize();
     writer.Write((byte)0x24);
     writer.WriteAsciiString(String.Format("{0} 0", skill));
     return writer.GetBytes();
 }
Beispiel #5
0
        public static byte[] SpeechRequestUnicode(SpeechType type, SpeechFont font, ushort color, string text)
        {
            // For security reasons
            if (text.Length > Core.MaxSpeechLenght)
                text = text.Remove(Core.MaxSpeechLenght);

            PacketWriter writer = new PacketWriter(0xAD);

            writer.WriteBlockSize();
            writer.Write((byte)type);
            writer.Write(color);
            writer.Write((ushort)font);
            writer.WriteAsciiString("CSY", 4);
            writer.WriteUnicodeString(text);

            return writer.GetBytes();
        }
Beispiel #6
0
 /// <summary>
 /// Used only for "bow" and "salute" animations.
 /// </summary>
 public static byte[] PerformAnimation(string animationName)
 {
     PacketWriter writer = new PacketWriter(0x12);
     writer.WriteBlockSize();
     writer.Write((byte)0xC7);
     writer.WriteAsciiString(animationName.ToLowerInvariant());
     return writer.GetBytes();
 }