public bool Write(DAIIO io, bool skiplength = false) { try { if (_info.Version > 1) { io.WriteBoolean(HasDynamicStats); if (HasDynamicStats) { DynamicStats.Write(io); } else if (_info.Version > 3) { DynamicStats.Write(io); } } else if (_iscrafted) { CraftedStatIntances.Write(io); } if (_info.Version > 9) { ItemAbilities.Write(io); } if (_info.Version < 3) { ItemTimelines.Write(io); } ItemMaterials.Write(io); if (_info.Version < 5) { CompositionDisplay.Write(io); } else { io.WriteInt16((short)DisplayString.Length); io.WriteString(DisplayString); } io.WriteInt32(Level); io.WriteInt32(DamageType); io.WriteInt32(Quality); return(true); } catch (Exception) { return(false); } }
public ItemStatInstance Read(DAIIO io) { if (_info.Version > 1) { HasDynamicStats = io.ReadBoolean(); if (HasDynamicStats) { DynamicStats = new ItemDynamicStats().Read(io); } else if (_info.Version > 3) { DynamicStats = new ItemDynamicStats().Read(io); } } else if (_iscrafted) { CraftedStatIntances = new CraftedStatIntances().Read(io); } if (_info.Version > 9) { ItemAbilities = new ItemAbilities().Read(io); } if (_info.Version < 3) { ItemTimelines = new ItemTimelines().Read(io); } ItemMaterials = new ItemMaterials().Read(io); if (_info.Version < 5) { CompositionDisplay = new CompositionDisplay().Read(io); } else { short count = io.ReadInt16(); DisplayString = io.ReadString(count); } Level = io.ReadInt32(); DamageType = io.ReadInt32(); Quality = io.ReadInt32(); return(this); }