fix: Removes PoolOfAcid (#1310)

## BREAKING CHANGES
You will receive a deserialization error saying cannot find type PoolOfAcid. This is ok, just hit yes to delete all.
This commit is contained in:
Kamron Batman 2022-12-22 13:20:34 -08:00 committed by GitHub
parent 801f139568
commit e855ca1e61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 22 deletions

View file

@ -36,6 +36,7 @@ public class BufferReader : IGenericReader
private int _position; private int _position;
public long Position => _position; public long Position => _position;
public long BufferSize => _buffer.Length;
public BufferReader(byte[] buffer, Dictionary<ulong, string> typesDb = null, Encoding encoding = null) public BufferReader(byte[] buffer, Dictionary<ulong, string> typesDb = null, Encoding encoding = null)
{ {

View file

@ -94,7 +94,7 @@ namespace Server.Mobiles
} }
public override Item NewHarmfulItem() => public override Item NewHarmfulItem() =>
new PoolOfAcid(TimeSpan.FromSeconds(10), 25, 30) new Acid(TimeSpan.FromSeconds(10), 25, 30)
{ {
Name = "gooey nasty pumpkin hummus", Name = "gooey nasty pumpkin hummus",
Hue = 144 Hue = 144

View file

@ -1,26 +1,31 @@
using System; using System;
using ModernUO.Serialization;
using Server.Collections; using Server.Collections;
using Server.Mobiles; using Server.Mobiles;
namespace Server.Items; namespace Server.Items;
[ManualDirtyChecking] [SerializationGenerator(0)]
[TypeAlias("Server.Items.AcidSlime")] public partial class Acid : Item
public class PoolOfAcid : Item
{ {
private readonly TimeSpan _duration; private TimeSpan _duration;
private readonly int _maxDamage; private int _maxDamage;
private readonly int _minDamage; private int _minDamage;
private TimerExecutionToken _timerToken; private TimerExecutionToken _timerToken;
private bool _drying; private bool _drying;
[Constructible] [Constructible]
public PoolOfAcid() : this(TimeSpan.FromSeconds(10.0), 2, 5) public Acid() : this(TimeSpan.FromSeconds(10.0), 2, 5)
{ {
} }
[Constructible] [Constructible]
public PoolOfAcid(TimeSpan duration, int minDamage, int maxDamage) : base(0x122A) public Acid(TimeSpan duration, int minDamage, int maxDamage) : this(duration, TimeSpan.FromSeconds(1), minDamage, maxDamage)
{
}
[Constructible]
public Acid(TimeSpan duration, TimeSpan tickRate, int minDamage, int maxDamage) : base(0x122A)
{ {
Hue = 0x3F; Hue = 0x3F;
Movable = false; Movable = false;
@ -29,11 +34,7 @@ public class PoolOfAcid : Item
_maxDamage = maxDamage; _maxDamage = maxDamage;
_duration = duration; _duration = duration;
Timer.StartTimer(TimeSpan.Zero, TimeSpan.FromSeconds(1), OnTick, out _timerToken); Timer.StartTimer(TimeSpan.Zero, tickRate, OnTick, out _timerToken);
}
public PoolOfAcid(Serial serial) : base(serial)
{
} }
public override string DefaultName => "a pool of acid"; public override string DefaultName => "a pool of acid";
@ -54,6 +55,7 @@ public class PoolOfAcid : Item
return; return;
} }
// Dries half way through duration
if (!_drying && age > _duration - age) if (!_drying && age > _duration - age)
{ {
_drying = true; _drying = true;
@ -64,7 +66,8 @@ public class PoolOfAcid : Item
foreach (var m in GetMobilesInRange(0)) foreach (var m in GetMobilesInRange(0))
{ {
if (m.Alive && !m.IsDeadBondedPet && (m is not BaseCreature bc || bc.Controlled || bc.Summoned)) if (m.AccessLevel == AccessLevel.Player &&
m.Alive && !m.IsDeadBondedPet && (m is not BaseCreature bc || bc.Controlled || bc.Summoned))
{ {
queue.Enqueue(m); queue.Enqueue(m);
} }
@ -87,11 +90,9 @@ public class PoolOfAcid : Item
m.Damage(Utility.RandomMinMax(_minDamage, _maxDamage)); m.Damage(Utility.RandomMinMax(_minDamage, _maxDamage));
} }
public override void Serialize(IGenericWriter writer) [AfterDeserialization(false)]
{ private void AfterDeserialization()
}
public override void Deserialize(IGenericReader reader)
{ {
Delete();
} }
} }

View file

@ -4072,7 +4072,7 @@ namespace Server.Mobiles
kappa+acidslime, grizzles+whatever, etc. kappa+acidslime, grizzles+whatever, etc.
*/ */
public virtual Item NewHarmfulItem() => new PoolOfAcid(TimeSpan.FromSeconds(10), 30, 30); public virtual Item NewHarmfulItem() => new Acid(TimeSpan.FromSeconds(10), 30, 30);
public virtual void StopFlee() public virtual void StopFlee()
{ {

View file

@ -122,7 +122,7 @@ namespace Server.Mobiles
base.OnDamage(amount, from, willKill); base.OnDamage(amount, from, willKill);
} }
public override Item NewHarmfulItem() => new PoolOfAcid(TimeSpan.FromSeconds(10), 5, 10) public override Item NewHarmfulItem() => new Acid(TimeSpan.FromSeconds(10), 5, 10)
{ {
Name = "slime" Name = "slime"
}; };