Example #1
0
        protected override void serializeContent(ICustomDataWriter writer)
        {
            // SelectedServerData (42)
            writer.WriteVarShort(211);    // Server id
            writer.WriteUTF("127.0.0.1"); // Server address
            writer.WriteShort(1);         // Number of ports
            writer.WriteInt(5556);        // Game Server port
            writer.WriteBool(false);      // Can create new character
            var ticket = Guid.NewGuid().ToString().Replace("-", "");

            writer.WriteVarInt(ticket.Length); // Ticket length
            writer.WriteUTFBytes(ticket);      // Ticket

            //SelectedServerDataExtended
            writer.WriteUShort(1); // Number of servers

            // GameServerInformations
            var byteBox = new ByteBox();

            byteBox[0] = false;        // Is Mono account
            byteBox[1] = true;         // Is Selectable
            writer.WriteByte(byteBox.Value);
            writer.WriteVarShort(211); // Server id
            writer.WriteByte(0);       // Type
            writer.WriteByte(3);       // Status
            writer.WriteByte(0);       // Completion
            writer.WriteByte(1);       // Character count
            writer.WriteByte(5);       // Character slots
            writer.WriteDouble(0);     // Date
        }
Example #2
0
        public override void Serialize(ICustomDataWriter writer)
        {
            var box0 = new ByteBox();

            box0[0] = false; // Cant be aggressed
            box0[1] = false; // Cant be challenged
            box0[2] = false; // Cant trade
            box0[3] = false; // Cant be attacked by mutant
            box0[4] = false; // Cant run
            box0[5] = false; // Force slow walk
            box0[6] = false; // Cant minimize
            box0[7] = false; // Cant move
            writer.WriteByte(box0.Value);

            var box1 = new ByteBox();

            box1[0] = false; // Cant aggress
            box1[1] = false; // Cant challenge
            box1[2] = false; // Cant exchange
            box1[3] = false; // Cant attack
            box1[4] = false; // Cant chat
            box1[5] = false; // Cant be merchant
            box1[6] = false; // cant use object
            box1[7] = false; // Cant use tax collector
            writer.WriteByte(box1.Value);

            var box2 = new ByteBox();

            box2[0] = false; // Cant use interactive
            box2[1] = false; // Cant speak to npc
            box2[2] = false; // Cant change zone
            box2[3] = false; // Cant attack monster
            box2[4] = false; // Cant walk 8 direction
            writer.WriteByte(box2.Value);
        }
        public override void Deserialize(ICustomDataReader reader)
        {
            var byteBox = new ByteBox(reader.ReadByte());

            AutoConnect    = byteBox[0];
            UseCertificate = byteBox[1];
            UseLoginToken  = byteBox[2];
            Version.Deserialize(reader);
        }
Example #4
0
        public override void Deserialize(ICustomDataReader reader)
        {
            var byteBox = new ByteBox(reader.ReadByte());

            AutoConnect    = byteBox[0];
            UseCertificate = byteBox[1];
            UseLoginToken  = byteBox[2];
            Version.Deserialize(reader);
            Lang = reader.ReadUTF();
            var credentialsLength = reader.ReadVarInt();

            Credentials  = reader.ReadBytes(credentialsLength);
            ServerId     = reader.ReadShort();
            OptionalSalt = reader.ReadVarLong();
        }
Example #5
0
        /// <summary>
        /// Returns the control associated with this module property
        /// </summary>
        public Control GetControl()
        {
            Control control;
            long    max = (long)Math.Pow(2, Length);

            switch (ControlType)
            {
            case PropertyType.BOOL: control = new CheckBox()
            {
                    Size = new Size(20, 20),
            }; break;

            case PropertyType.TEXT: control = new TextBox()
            {
                    Size      = new Size(100, 20),
                    MaxLength = Length >> 3,
            }; break;

            case PropertyType.HEXT: control = new HexBox()
            {
                    Size = new Size(200, 50),
                    VScrollBarVisible = true
            }; break;

            case PropertyType.HEXU: control = new NumericUpDown()
            {
                    Size        = new Size(32 + Length, 20),
                    Minimum     = 0,
                    Maximum     = max,
                    Hexadecimal = true,
            }; break;

            case PropertyType.NUMU: control = new NumericUpDown()
            {
                    Size        = new Size(40 + Length, 20),
                    Minimum     = 0,
                    Maximum     = max,
                    Hexadecimal = false,
            }; break;

            case PropertyType.NUMS: control = new NumericUpDown()
            {
                    Size        = new Size(40 + Length, 20),
                    Minimum     = (max / 2) * -1,
                    Maximum     = (max / 2),
                    Hexadecimal = false,
            }; break;

            case PropertyType.LIST:
                if (FileName == null)
                {
                    control = new ByteBox()
                    {
                    }
                }
                ;
                else
                {
                    control = new ByteArrayBox()
                    {
                        AutoSize = true
                    };
                    ((ByteArrayBox)control).Load(FileName);
                } break;

            case PropertyType.POIN:
                if (FileName == null)
                {
                    control = new PointerBox()
                    {
                    }
                }
                ;
                else
                {
                    control = new PointerArrayBox()
                    {
                        AutoSize = true
                    };
                    ((PointerArrayBox)control).Load(FileName);
                } break;

            default: return(null);
            }
            control.Anchor = AnchorStyles.Left;
            return(control);
        }