示例#1
0
        public void Deserialize(BinaryReader data)
        {
            byte[] bytes;

            this.type = (UrwObjectType)data.ReadByte();

            data.ReadBytes(8); // Unknown

            bytes       = data.ReadBytes(40);
            this.name   = Encoding.UTF8.GetString(bytes, 0, Array.FindIndex(bytes, (b) => b == 0));
            bytes       = data.ReadBytes(27);
            this.group  = Encoding.UTF8.GetString(bytes, 0, Array.FindIndex(bytes, (b) => b == 0));
            bytes       = data.ReadBytes(13);
            this.sprite = Encoding.UTF8.GetString(bytes, 0, Array.FindIndex(bytes, (b) => b == 0));

            data.ReadBytes(1); // Unknown

            this.spriteIndex = data.ReadByte();

            data.ReadBytes(1); // Unknown

            this.value = data.ReadSingle();

            if (type == UrwObjectType.Weapon || type == UrwObjectType.Armor)
            {
                this.combatInfo = ReadCombatInfo(data);
            }
            else if (type == UrwObjectType.Food || type == UrwObjectType.Plant)
            {
                this.nutrition = ReadNutritionInfo(data);
                this.plantInfo = ReadPlantInfo(data);
            }
            else
            {
                data.ReadBytes(6);
            }

            data.ReadBytes(4); // Unknown

            if (type == UrwObjectType.Weapon)
            {
                this.h1Penalty = data.ReadByte();
                data.ReadBytes(1); // Unknown
                this.accuracy = data.ReadByte();
            }
            else
            {
                data.ReadBytes(3); // Unknown
            }

            data.ReadBytes(3);                // Unknown

            this.weight  = data.ReadSingle(); // weight for containers and wear?
            this.weight2 = data.ReadSingle(); // weight or capacity

            data.ReadBytes(22);               // Unknown

            this.water = data.ReadByte();

            data.ReadBytes(3); // Unknown

            this.valuePerLbs = data.ReadSingle();

            data.ReadBytes(15); // Unknown

            this.quality = (byte)(data.ReadByte() & 0x0F);

            data.ReadBytes(1); // Unknown

            if (type == UrwObjectType.Weapon)
            {
                int combatBonuses = data.ReadByte();
                this.attackBonus  = (byte)(combatBonuses & 0x0F);
                this.defenseBonus = (byte)(combatBonuses >> 4);
            }
            else
            {
                data.ReadBytes(1);
            }

            data.ReadBytes(4); // Unknown
        }
示例#2
0
        public void Deserialize(BinaryReader data)
        {
            byte[] bytes;

            this.type = (UrwObjectType)data.ReadByte();
            data.ReadBytes(8); // Unknown

            bytes = data.ReadBytes(40);
            this.name = Encoding.UTF8.GetString(bytes, 0, Array.FindIndex(bytes, (b)=>b==0));
            bytes = data.ReadBytes(40);
            this.group = Encoding.UTF8.GetString(bytes, 0, Array.FindIndex(bytes, (b)=>b==0));

            data.ReadBytes(1); // Unknown
            this.spriteIndex = data.ReadByte();
            data.ReadBytes(1); // Unknown

            this.value = data.ReadSingle();

            if (type == UrwObjectType.Weapon || type == UrwObjectType.Armor) {
                this.damageBlunt = data.ReadByte();
                this.damageEdge = data.ReadByte();
                this.damagePoint = data.ReadByte();

                this.tear = data.ReadByte();
                this.squeeze = data.ReadByte();
                this.warmth = data.ReadByte();
            } else if (type == UrwObjectType.Food || type == UrwObjectType.Plant) {
                this.carbohydrates = data.ReadByte();
                this.fat = data.ReadByte();
                this.proteins = data.ReadByte();

                this.mature = data.ReadByte();
                this.sprout = data.ReadByte();
                this.wither = data.ReadByte();
            } else {
                data.ReadBytes(6);
            }

            data.ReadBytes(10); // Unknown

            this.weight = data.ReadSingle();  // weight for containers and wear?
            this.weight2 = data.ReadSingle(); // weight or capacity

            data.ReadBytes(28); // Unknown

            this.water = data.ReadByte();

            data.ReadBytes(3); // Unknown

            this.valuePerLbs = data.ReadSingle();

            data.ReadBytes(9); // Unknown

            this.quality = (byte)(data.ReadByte() & 0x0F);

            data.ReadBytes(6); // Unknown
        }