public virtual void Read(BinaryReader reader, int buffVersion, Dictionary <ushort, StatModifier> idTable) { timer = BuffTimer.Read(reader); descriptor = BuffDescriptor.Read(reader); isOverriden = new Value <bool>(reader.ReadBoolean()); int statModifierListCount = reader.ReadByte(); statModifierList = new List <StatModifier>(); for (int i = 0; i < statModifierListCount; i++) { ushort key = reader.ReadUInt16(); StatModifier statModifier = idTable[key]; statModifierList.Add(statModifier); } int buffModiferListCount = reader.ReadByte(); buffModifierList = new List <BuffModifier>(); for (int j = 0; j < buffModiferListCount; j++) { BuffModifier buffModifier = BuffModifier.Read(reader); buffModifier.buff = this; buffModifierList.Add(buffModifier); } instigatorId = new Value <int>(reader.ReadInt32()); }
public static BuffModifier Read(BinaryReader reader) { buffModifierVersion = new Value <int>(reader.ReadInt32()); buffModifierClassId = new Value <int>((int)reader.ReadByte()); Type type; dictionary.TryGetValue((EnumBuffModifierClassId)buffModifierClassId.Get(), out type); BuffModifier buffModifier = Activator.CreateInstance(type, null) as BuffModifier; buffModifier.enumId = (EnumBuffModifierClassId)buffModifierClassId.Get(); buffModifier.Read(reader, buffModifierVersion.Get()); return(buffModifier); }