Beispiel #1
0
        public static PopupMenuData Parse(ref StackDataReader p)
        {
            ushort mode        = p.ReadUInt16BE();
            bool   isNewCliloc = mode >= 2;
            uint   serial      = p.ReadUInt32BE();
            byte   count       = p.ReadUInt8();

            PopupMenuItem[] items = new PopupMenuItem[count];

            for (int i = 0; i < count; i++)
            {
                ushort hue = 0xFFFF, replaced = 0;
                int    cliloc;
                ushort index, flags;

                if (isNewCliloc)
                {
                    cliloc = (int)p.ReadUInt32BE();
                    index  = p.ReadUInt16BE();
                    flags  = p.ReadUInt16BE();
                }
                else
                {
                    index  = p.ReadUInt16BE();
                    cliloc = p.ReadUInt16BE() + 3000000;
                    flags  = p.ReadUInt16BE();

                    if ((flags & 0x84) != 0)
                    {
                        p.Skip(2);
                    }

                    if ((flags & 0x40) != 0)
                    {
                        p.Skip(2);
                    }

                    if ((flags & 0x20) != 0)
                    {
                        replaced = (ushort)(p.ReadUInt16BE());
                    }
                }

                if ((flags & 0x01) != 0)
                {
                    hue = 0x0386;
                }

                items[i] = new PopupMenuItem
                           (
                    cliloc,
                    index,
                    hue,
                    replaced,
                    flags
                           );
            }

            return(new PopupMenuData(serial, items));
        }
Beispiel #2
0
        public static PopupMenuData Parse(Packet p)
        {
            ushort mode        = p.ReadUShort();
            bool   isNewCliloc = mode >= 2;
            Serial serial      = p.ReadUInt();
            byte   count       = p.ReadByte();

            PopupMenuItem[] items = new PopupMenuItem[count];

            for (int i = 0; i < count; i++)
            {
                Hue    hue = 0xFFFF, replacedHue = 0;
                int    cliloc;
                ushort index, flags;

                if (isNewCliloc)
                {
                    cliloc = (int)p.ReadUInt();
                    index  = p.ReadUShort();
                    flags  = p.ReadUShort();
                }
                else
                {
                    index  = p.ReadUShort();
                    cliloc = p.ReadUShort() + 3000000;
                    flags  = p.ReadUShort();

                    if ((flags & 0x84) != 0)
                    {
                        p.Skip(2);
                    }

                    if ((flags & 0x40) != 0)
                    {
                        p.Skip(2);
                    }

                    if ((flags & 0x20) != 0)
                    {
                        replacedHue = (Hue)(p.ReadUShort() & 0x3FFF);
                    }
                }

                if ((flags & 0x01) != 0)
                {
                    hue = 0x0386;
                }

                items[i] = new PopupMenuItem(cliloc, index, hue, replacedHue, flags);
            }

            return(new PopupMenuData(serial, items));
        }
Beispiel #3
0
        public static PopupMenuData Parse(Packet p)
        {
            ushort mode        = p.ReadUShort();
            bool   isNewCliloc = mode >= 2;
            Serial serial      = p.ReadUInt();
            byte   count       = p.ReadByte();

            PopupMenuItem[] items = new PopupMenuItem[count];

            for (int i = 0; i < count; i++)
            {
                ref PopupMenuItem item = ref items[i];
                item.Hue = 0xFFFF;

                if (isNewCliloc)
                {
                    item.Cliloc = (int)p.ReadUInt();
                    item.Index  = p.ReadUShort();
                    item.Flags  = p.ReadUShort();
                }
                else
                {
                    item.Index  = p.ReadUShort();
                    item.Cliloc = p.ReadUShort() + 3000000;
                    item.Flags  = p.ReadUShort();

                    if ((item.Flags & 0x84) != 0)
                    {
                        p.Skip(2);
                    }

                    if ((item.Flags & 0x40) != 0)
                    {
                        p.Skip(2);
                    }

                    if ((item.Flags & 0x20) != 0)
                    {
                        item.ReplacedHue = (Hue)(p.ReadUShort() & 0x3FFF);
                    }
                }

                if ((item.Flags & 0x01) != 0)
                {
                    item.Hue = 0x0386;
                }
            }