Пример #1
0
        public void parseBytes(byte[] arr, bool withType)
        {
            byte[] rawbytes = arr;
            if (withType)
            {
                this.type = this.configTypeFromBytes(arr);
                rawbytes  = this.byteWithoutTypeByteFlag(arr);
            }

            if (this.type != ConfigType.None)
            {
                if (this.type == ConfigType.Fishing)
                {
                    this.fishingConfig = this.fishingConfigFromBytes(rawbytes);
                }
                else if (this.type == ConfigType.Combat)
                {
                    this.combatConfig = this.combatConfigFromBytes(rawbytes);
                }
                else if (this.type == ConfigType.Gathering)
                {
                    this.gatheringConfig = this.gatheringConfigFromBytes(rawbytes);
                }
            }
        }
Пример #2
0
        public FishingConfig fishingConfigFromBytes(byte[] arr)
        {
            FishingConfig str = new FishingConfig();

            int    size = Marshal.SizeOf(str);
            IntPtr ptr  = Marshal.AllocHGlobal(size);

            Marshal.Copy(arr, 0, ptr, size);

            str = (FishingConfig)Marshal.PtrToStructure(ptr, str.GetType());
            Marshal.FreeHGlobal(ptr);

            return(str);
        }
Пример #3
0
        public static FishingConfig defaultFishingConfig()
        {
            FishingConfig defaultFishing = new FishingConfig();

            defaultFishing.biteDelay = (int)0;

            GeneralKeys defaultGeneral = new GeneralKeys();

            defaultGeneral.forward     = UseableKeys.W;
            defaultGeneral.backward    = UseableKeys.S;
            defaultGeneral.rotateLeft  = UseableKeys.A;
            defaultGeneral.rotateRight = UseableKeys.D;
            defaultGeneral.action      = UseableKeys.Num0;
            defaultFishing.movement    = defaultGeneral;

            FishingKeys defaultFishKeys = new FishingKeys();

            defaultFishKeys.startFishing = UseableKeys.D2;
            defaultFishKeys.catchFish    = UseableKeys.D3;
            defaultFishing.fishing       = defaultFishKeys;

            return(defaultFishing);
        }