protected override void WriteData(ESPWriter writer) { writer.Write((UInt16)Flags); writer.Write((UInt16)Type); writer.Write(Gravity); writer.Write(Speed); writer.Write(Range); Light.WriteBinary(writer); MuzzleFlashLight.WriteBinary(writer); writer.Write(TracerChance); writer.Write(ExplosionAltTriggerProximity); writer.Write(ExplosionAltTriggerTimer); Explosion.WriteBinary(writer); Sound.WriteBinary(writer); writer.Write(MuzzleFlashDuration); writer.Write(FadeDuration); writer.Write(ImpactForce); SoundCountdown.WriteBinary(writer); Sounddisable.WriteBinary(writer); DefaultWeaponSource.WriteBinary(writer); writer.Write(XRotation); writer.Write(YRotation); writer.Write(ZRotation); writer.Write(BouncyMult); }
protected override void ReadData(ESPReader reader) { using (MemoryStream stream = new MemoryStream(reader.ReadBytes(size))) using (ESPReader subReader = new ESPReader(stream, reader.Plugin)) { try { Flags = subReader.ReadEnum <ProjectileFlags>(); Type = subReader.ReadEnum <ProjectileType>(); Gravity = subReader.ReadSingle(); Speed = subReader.ReadSingle(); Range = subReader.ReadSingle(); Light.ReadBinary(subReader); MuzzleFlashLight.ReadBinary(subReader); TracerChance = subReader.ReadSingle(); ExplosionAltTriggerProximity = subReader.ReadSingle(); ExplosionAltTriggerTimer = subReader.ReadSingle(); Explosion.ReadBinary(subReader); Sound.ReadBinary(subReader); MuzzleFlashDuration = subReader.ReadSingle(); FadeDuration = subReader.ReadSingle(); ImpactForce = subReader.ReadSingle(); SoundCountdown.ReadBinary(subReader); Sounddisable.ReadBinary(subReader); DefaultWeaponSource.ReadBinary(subReader); XRotation = subReader.ReadSingle(); YRotation = subReader.ReadSingle(); ZRotation = subReader.ReadSingle(); BouncyMult = subReader.ReadSingle(); } catch { return; } } }
protected override void ReadDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; if (ele.TryPathTo("Flags", false, out subEle)) { Flags = subEle.ToEnum <ProjectileFlags>(); } if (ele.TryPathTo("Type", false, out subEle)) { Type = subEle.ToEnum <ProjectileType>(); } if (ele.TryPathTo("Gravity", false, out subEle)) { Gravity = subEle.ToSingle(); } if (ele.TryPathTo("Speed", false, out subEle)) { Speed = subEle.ToSingle(); } if (ele.TryPathTo("Range", false, out subEle)) { Range = subEle.ToSingle(); } if (ele.TryPathTo("Light", false, out subEle)) { Light.ReadXML(subEle, master); } if (ele.TryPathTo("MuzzleFlash/Light", false, out subEle)) { MuzzleFlashLight.ReadXML(subEle, master); } if (ele.TryPathTo("TracerChance", false, out subEle)) { TracerChance = subEle.ToSingle(); } if (ele.TryPathTo("Explosion/AltTrigger/Proximity", false, out subEle)) { ExplosionAltTriggerProximity = subEle.ToSingle(); } if (ele.TryPathTo("Explosion/AltTrigger/Timer", false, out subEle)) { ExplosionAltTriggerTimer = subEle.ToSingle(); } if (ele.TryPathTo("Explosion/Form", false, out subEle)) { Explosion.ReadXML(subEle, master); } if (ele.TryPathTo("Sound", false, out subEle)) { Sound.ReadXML(subEle, master); } if (ele.TryPathTo("MuzzleFlash/Duration", false, out subEle)) { MuzzleFlashDuration = subEle.ToSingle(); } if (ele.TryPathTo("FadeDuration", false, out subEle)) { FadeDuration = subEle.ToSingle(); } if (ele.TryPathTo("ImpactForce", false, out subEle)) { ImpactForce = subEle.ToSingle(); } if (ele.TryPathTo("Sound/Countdown", false, out subEle)) { SoundCountdown.ReadXML(subEle, master); } if (ele.TryPathTo("Sound/Disable", false, out subEle)) { Sounddisable.ReadXML(subEle, master); } if (ele.TryPathTo("DefaultWeaponSource", false, out subEle)) { DefaultWeaponSource.ReadXML(subEle, master); } if (ele.TryPathTo("XRotation", false, out subEle)) { XRotation = subEle.ToSingle(); } if (ele.TryPathTo("YRotation", false, out subEle)) { YRotation = subEle.ToSingle(); } if (ele.TryPathTo("ZRotation", false, out subEle)) { ZRotation = subEle.ToSingle(); } if (ele.TryPathTo("BouncyMult", false, out subEle)) { BouncyMult = subEle.ToSingle(); } }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("Flags", true, out subEle); subEle.Value = Flags.ToString(); ele.TryPathTo("Type", true, out subEle); subEle.Value = Type.ToString(); ele.TryPathTo("Gravity", true, out subEle); subEle.Value = Gravity.ToString("G15"); ele.TryPathTo("Speed", true, out subEle); subEle.Value = Speed.ToString("G15"); ele.TryPathTo("Range", true, out subEle); subEle.Value = Range.ToString("G15"); ele.TryPathTo("Light", true, out subEle); Light.WriteXML(subEle, master); ele.TryPathTo("MuzzleFlash/Light", true, out subEle); MuzzleFlashLight.WriteXML(subEle, master); ele.TryPathTo("TracerChance", true, out subEle); subEle.Value = TracerChance.ToString("G15"); ele.TryPathTo("Explosion/AltTrigger/Proximity", true, out subEle); subEle.Value = ExplosionAltTriggerProximity.ToString("G15"); ele.TryPathTo("Explosion/AltTrigger/Timer", true, out subEle); subEle.Value = ExplosionAltTriggerTimer.ToString("G15"); ele.TryPathTo("Explosion/Form", true, out subEle); Explosion.WriteXML(subEle, master); ele.TryPathTo("Sound", true, out subEle); Sound.WriteXML(subEle, master); ele.TryPathTo("MuzzleFlash/Duration", true, out subEle); subEle.Value = MuzzleFlashDuration.ToString("G15"); ele.TryPathTo("FadeDuration", true, out subEle); subEle.Value = FadeDuration.ToString("G15"); ele.TryPathTo("ImpactForce", true, out subEle); subEle.Value = ImpactForce.ToString("G15"); ele.TryPathTo("Sound/Countdown", true, out subEle); SoundCountdown.WriteXML(subEle, master); ele.TryPathTo("Sound/Disable", true, out subEle); Sounddisable.WriteXML(subEle, master); ele.TryPathTo("DefaultWeaponSource", true, out subEle); DefaultWeaponSource.WriteXML(subEle, master); ele.TryPathTo("XRotation", true, out subEle); subEle.Value = XRotation.ToString("G15"); ele.TryPathTo("YRotation", true, out subEle); subEle.Value = YRotation.ToString("G15"); ele.TryPathTo("ZRotation", true, out subEle); subEle.Value = ZRotation.ToString("G15"); ele.TryPathTo("BouncyMult", true, out subEle); subEle.Value = BouncyMult.ToString("G15"); }