fix: Optimizes items to use default weights. (Part 4) (#2243)

This commit is contained in:
Kamron Batman 2025-07-24 23:29:29 -07:00 • committed by GitHub
parent 40ba85d7b8
commit fa0b67ec29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
109 changed files with 250 additions and 391 deletions

View file

@ -16,7 +16,11 @@ public partial class PotionKeg : Item
private PotionEffect _type;
[Constructible]
public PotionKeg() : base(0x1940) => UpdateWeight();
public PotionKeg() : base(0x1940)
{
}
public override double DefaultWeight => 20 + Math.Clamp(_held, 0, 100) * 0.8;
[SerializableProperty(1)]
[CommandProperty(AccessLevel.GameMaster)]
@ -28,7 +32,6 @@ public partial class PotionKeg : Item
if (_held != value)
{
_held = value;
UpdateWeight();
InvalidateProperties();
this.MarkDirty();
}
@ -48,13 +51,6 @@ public partial class PotionKeg : Item
}
}
public virtual void UpdateWeight()
{
var held = Math.Max(0, Math.Min(_held, 100));
Weight = 20 + held * 80 / 100;
}
private void Deserialize(IGenericReader reader, int version)
{
_type = (PotionEffect)reader.ReadInt();