public ItemStatsData Read(DAIIO io)
 {
     xLength   = io.ReadBit2(LengthBits);
     StatsData = new ItemAsset().Read(io);
     Value     = io.ReadSingle();
     return(this);
 }
Example #2
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Abilities == null)
                {
                    Abilities = new ItemAsset[Count];

                    for (int xb = 0; xb < Count; xb++)
                    {
                        Abilities[xb] = new ItemAsset();
                    }
                }
                io.WriteInt16((short)Abilities.Length);
                foreach (ItemAsset t in Abilities)
                {
                    t.Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #3
0
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                StatData.Write(io);
                Script.Write(io);
                if (DelArgs == null)
                {
                    DelArgs = new ItemAsset[ArgsCount];

                    for (int xb = 0; xb < ArgsCount; xb++)
                    {
                        DelArgs[xb] = new ItemAsset();
                    }
                }
                io.WriteInt16((short)DelArgs.Length);
                foreach (ItemAsset t in DelArgs)
                {
                    t.Write(io);
                }
                io.WriteSingle(DefaultValue);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public ItemMaterial Read(DAIIO io)
 {
     xLength = io.ReadBit2(LengthBits);
     Index   = io.ReadInt32();
     Asset   = new ItemAsset().Read(io);
     return(this);
 }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (Abilities == null)
                {
                    Abilities = new ItemAsset[Count];

                    for (int xb = 0; xb < Count; xb++)
                    {
                        Abilities[xb] = new ItemAsset();
                    }
                }
                Count = (short)Abilities.Length;
                io.WriteInt16(Count);
                for (int i = 0; i < Count; i++)
                {
                    Abilities[i].Write(io);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public bool Write(DAIIO io, bool skiplength = false)
        {
            try
            {
                if (!skiplength)
                {
                    io.WriteBits(Length, LengthBits);
                }
                Offset = io.Position;
                io.WriteInt16(Version);
                if (StatsData == null)
                {
                    StatsData = new ItemAsset();
                }
                StatsData.Write(io);
                if (Version < 8)
                {
                    io.WriteInt32(Uid);
                }
                io.WriteBoolean(IsForSale);
                io.WriteBoolean(IsNew);
                io.WriteBoolean(IsCrafted);
                io.WriteInt32(StringId);
                if (StatsInstance != null)
                {
                    StatsInstance.Write(io);
                    if (Upgrades != null)
                    {
                        Upgrades.Write(io);
                        io.WriteBoolean(SuppressClassRestriction);
                        if (Version > 6)
                        {
                            io.WriteBoolean(IsPlaceHolder);
                        }
                        if (Version > 0xA)
                        {
                            io.WriteBoolean(HasSoundActionsReference);
                            if (HasSoundActionsReference)
                            {
                                SoundActionsReference.Write(io);
                            }
                        }
                    }
                }
                if (StackSize != 0xff)
                {
                    io.WriteBits(StackSize, 0x8);
                }
                if (MaxStackSize != 0xff)
                {
                    io.WriteBits(MaxStackSize, 0x8);
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
 public PotionBank Read(DAIIO io)
 {
     xLength = io.ReadBit2(LengthBits);
     Key     = new ItemAsset().Read(io);
     Value   = (byte)io.ReadBit2(0x8);
     return(this);
 }
Example #8
0
 public ItemAbilities Read(DAIIO io)
 {
     Count     = io.ReadInt16();
     Abilities = new ItemAsset[Count];
     for (int i = 0; i < Count; i++)
     {
         Abilities[i] = new ItemAsset().Read(io);
     }
     return(this);
 }
        public ItemStatsInstance Read(DAIIO io)
        {
            xLength   = io.ReadBit2(LengthBits);
            Offset    = io.Position;
            Version   = io.ReadInt16();
            StatsData = new ItemAsset().Read(io);
            if (Version < 8)
            {
                Uid = io.ReadInt32();
            }
            IsForSale = io.ReadBoolean();
            IsNew     = io.ReadBoolean();
            IsCrafted = io.ReadBoolean();
            StringId  = io.ReadInt32();
            if (xLength > 0x8a)
            {
                StatsInstance = new ItemStatInstance(this, IsCrafted).Read(io);
                if ((io.Position - Offset) < xLength)
                {
                    Upgrades = new ItemUpgrades().Read(io);
                    SuppressClassRestriction = io.ReadBoolean();
                    if (Version > 6)
                    {
                        IsPlaceHolder = io.ReadBoolean();
                    }
                    if (Version > 0xA)
                    {
                        HasSoundActionsReference = io.ReadBoolean();
                        if (HasSoundActionsReference)
                        {
                            SoundActionsReference = new ItemAsset().Read(io);
                        }
                    }
                }
            }

            if ((io.Position - Offset) + 8 <= xLength)
            {
                StackSize = (byte)io.ReadBit2(0x8);
            }
            else
            {
                StackSize = 0xff;
            }
            if (Version >= 9 && ((io.Position - Offset) + 8 <= xLength))
            {
                MaxStackSize = (byte)io.ReadBit2(0x8);
            }
            else
            {
                MaxStackSize = 0xff;
            }
            return(this);
        }
Example #10
0
 public CraftedItemStats Read(DAIIO io)
 {
     xLength   = io.ReadBit2(LengthBits);
     StatData  = new ItemAsset().Read(io);
     Script    = new ItemAsset().Read(io);
     ArgsCount = io.ReadInt16();
     DelArgs   = new ItemAsset[ArgsCount];
     for (int i = 0; i < ArgsCount; i++)
     {
         DelArgs[i] = new ItemAsset().Read(io);
     }
     DefaultValue = io.ReadSingle();
     return(this);
 }