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

@ -9,10 +9,11 @@ public partial class BlankScroll : Item, ICommodity
public BlankScroll(int amount = 1) : base(0xEF3)
{
Stackable = true;
Weight = 1.0;
Amount = amount;
}
public override double DefaultWeight => 1.0;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => Core.ML;
}

View file

@ -9,10 +9,11 @@ public partial class Bottle : Item, ICommodity
public Bottle(int amount = 1) : base(0xF0E)
{
Stackable = true;
Weight = 1.0;
Amount = amount;
}
public override double DefaultWeight => 1.0;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => Core.ML;
}

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();

View file

@ -21,10 +21,11 @@ public partial class RecallRune : Item
[Constructible]
public RecallRune() : base(0x1F14)
{
Weight = 1.0;
CalculateHue();
}
public override double DefaultWeight => 1.0;
[SerializableProperty(0)]
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
public BaseHouse House