User:Bewkaa

using System; using System.Collections.Generic; using System.Text; using Conquer.BasePackets;

namespace Conquer.NPCPacket {   class ButtonBar {       public static byte[] Packet(string Text, bool Password, int MaxLength) {           BasePacket Packet = new BasePacket;

Packet.AddShort(17 + Text.Length); Packet.AddShort(0x7F0); Packet.AddInt(0); Packet.AddByte(MaxLength); Packet.AddByte(Password ? 1 : 0); Packet.AddShort(0x300); Packet.AddByte(1); Packet.AddByte(Text.Length); Packet.AddText(Text); Packet.AddShort(0); Packet.AddByte(0);

return Packet.ReturnPacket; }   }    class SpawnNPC {       unsafe public static byte[] Packet(int NPCID, int X, int Y, int NPCType, int Direction, int Flags) {           #region New Packet byte[] Packet = new byte[0x14]; fixed(byte* Ptr = Packet) {               *((ushort*)(Ptr)) = 0x14; *((ushort*)(Ptr + 2)) = 0x7EE; *((uint*)(Ptr + 4)) = (ushort)NPCID; *((ushort*)(Ptr + 8)) = (ushort)X; *((ushort*)(Ptr + 10)) = (ushort)Y; *((ushort*)(Ptr + 12)) = (ushort)NPCType; *((ushort*)(Ptr + 14)) = (ushort)Direction; *((uint*)(Ptr + 16)) = (uint)Flags; }           return Packet; #endregion

#region Old Packet /*           BasePacket Packet = new BasePacket;

Packet.AddShort(20); Packet.AddShort(0x7EE); Packet.AddInt(NPCID); Packet.AddShort(X); Packet.AddShort(Y); Packet.AddShort(NPCType); Packet.AddShort(Direction); Packet.AddInt(Flags);

return Packet.ReturnPacket; */           #endregion }   }    class NPCTalk {       public static byte[] Packet(string Text) {           BasePacket Packet = new BasePacket;

Packet.AddShort(16 + Text.Length); Packet.AddShort(0x7F0); Packet.AddInt(0); Packet.AddShort(0); Packet.AddByte(255); Packet.AddByte(1); Packet.AddByte(1); Packet.AddByte(Text.Length); Packet.AddText(Text); Packet.AddShort(0);

return Packet.ReturnPacket; }   }    class NPCOpen {       unsafe public static byte[] Packet(int NPCHead) {           #region New Packet byte[] Packet = new byte[0x10]; fixed (byte* Ptr = Packet) {               *((ushort*)(Ptr)) = 0x10; *((ushort*)(Ptr + 2)) = 0x7F0; *((ushort*)(Ptr + 4)) = 0xA; *((ushort*)(Ptr + 6)) = 0xA; *((ushort*)(Ptr + 8)) = (ushort)NPCHead; *((byte*)(Ptr + 10)) = 0xFF; *((byte*)(Ptr + 11)) = 0x4; // 12           }            return Packet; #endregion

#region Old Packet /*           BasePacket Packet = new BasePacket;

Packet.AddShort(16); Packet.AddShort(0x7F0); Packet.AddShort(10); Packet.AddShort(10); Packet.AddShort(NPCHead); Packet.AddByte(255); Packet.AddByte(4); Packet.AddInt(0);

return Packet.ReturnPacket; */           #endregion }       unsafe public static byte[] Packet {           #region New Packet byte[] Packet = new byte[0x10]; fixed (byte* Ptr = Packet) {               *((ushort*)(Ptr)) = 0x10; *((ushort*)(Ptr + 2)) = 0x7F0; // 4               // 8                *((byte*)(Ptr + 10)) = 0xFF; *((byte*)(Ptr + 11)) = 0x64; // 12           }            return Packet; #endregion

#region Old Packet /*           BasePacket Packet = new BasePacket;

Packet.AddShort(16); Packet.AddShort(0x7F0); Packet.AddInt(0); Packet.AddShort(0); Packet.AddByte(255); Packet.AddByte(100); Packet.AddInt(0);

return Packet.ReturnPacket; */           #endregion }   }    class NPCButton {       public static byte[] Packet(string Text, int FollowNumber) {           BasePacket Packet = new BasePacket;

Packet.AddShort(16 + Text.Length); Packet.AddShort(0x7F0); Packet.AddInt(0); Packet.AddShort(0); Packet.AddByte(FollowNumber); Packet.AddByte(2); Packet.AddByte(1); Packet.AddByte(Text.Length); Packet.AddText(Text); Packet.AddShort(0);

return Packet.ReturnPacket; }   } }