Beispiel #1
0
        public void Write(EnhancementEffect enhancementEffect)
        {
            _writer.Write(enhancementEffect.Mode);
            _writer.Write(enhancementEffect.BuffMode);
            _writer.Write(enhancementEffect.Id);
            _writer.Write(enhancementEffect.SubId);
            _writer.Write(enhancementEffect.Schedule);
            _writer.Write(enhancementEffect.Multiplier);

            var hasEffect = enhancementEffect.Effect != null;

            _writer.Write(hasEffect);
            if (hasEffect)
            {
                _effectWriter.Write(enhancementEffect.Effect);
            }
        }
        public EnhancementEffect Read()
        {
            var enhancementEffect = new EnhancementEffect();

            enhancementEffect.Mode       = _reader.ReadInt32();
            enhancementEffect.BuffMode   = _reader.ReadInt32();
            enhancementEffect.Id         = _reader.ReadInt32();
            enhancementEffect.SubId      = _reader.ReadInt32();
            enhancementEffect.Schedule   = _reader.ReadInt32();
            enhancementEffect.Multiplier = _reader.ReadSingle();

            var hasEffect = _reader.ReadBoolean();

            if (hasEffect)
            {
                enhancementEffect.Effect = _effectReader.Read();
            }

            return(enhancementEffect);
        }