fix: Codegens resources (#1272)

This commit is contained in:
Kamron Batman 2022-11-23 13:45:32 -08:00 • committed by GitHub
parent 59ed0a5bb4
commit 82637a77cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 2435 additions and 2695 deletions

View file

@ -1,52 +1,51 @@
using ModernUO.Serialization;
using Server.Network;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
[Flippable(0xF95, 0xF96, 0xF97, 0xF98, 0xF99, 0xF9A, 0xF9B, 0xF9C)]
public partial class BoltOfCloth : Item, IScissorable, IDyable, ICommodity
{
[SerializationGenerator(0, false)]
[Flippable(0xF95, 0xF96, 0xF97, 0xF98, 0xF99, 0xF9A, 0xF9B, 0xF9C)]
public partial class BoltOfCloth : Item, IScissorable, IDyable, ICommodity
[Constructible]
public BoltOfCloth(int amount = 1) : base(0xF95)
{
[Constructible]
public BoltOfCloth(int amount = 1) : base(0xF95)
{
Stackable = true;
Weight = 5.0;
Amount = amount;
}
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
return false;
}
Hue = sender.DyedHue;
return true;
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
ScissorHelper(from, new Cloth(), 50);
return true;
}
public override void OnSingleClick(Mobile from)
{
var number = Amount == 1 ? 1049122 : 1049121;
var amount = (Amount * 50).ToString();
from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Label, 0x3B2, 3, number, "", amount);
}
Stackable = true;
Weight = 5.0;
Amount = amount;
}
}
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
return false;
}
Hue = sender.DyedHue;
return true;
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
ScissorHelper(from, new Cloth(), 50);
return true;
}
public override void OnSingleClick(Mobile from)
{
var number = Amount == 1 ? 1049122 : 1049121;
var amount = (Amount * 50).ToString();
from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Label, 0x3B2, 3, number, "", amount);
}
}

View file

@ -1,19 +1,18 @@
using ModernUO.Serialization;
namespace Server.Items
{
[SerializationGenerator(0, false)]
public partial class Bone : Item, ICommodity
{
[Constructible]
public Bone(int amount = 1) : base(0xf7e)
{
Stackable = true;
Amount = amount;
Weight = 1.0;
}
namespace Server.Items;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
[SerializationGenerator(0, false)]
public partial class Bone : Item, ICommodity
{
[Constructible]
public Bone(int amount = 1) : base(0xf7e)
{
Stackable = true;
Amount = amount;
Weight = 1.0;
}
}
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
}

View file

@ -1,52 +1,51 @@
using ModernUO.Serialization;
using Server.Network;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
[Flippable(0x1766, 0x1768)]
public partial class Cloth : Item, IScissorable, IDyable, ICommodity
{
[SerializationGenerator(0, false)]
[Flippable(0x1766, 0x1768)]
public partial class Cloth : Item, IScissorable, IDyable, ICommodity
[Constructible]
public Cloth(int amount = 1) : base(0x1766)
{
[Constructible]
public Cloth(int amount = 1) : base(0x1766)
{
Stackable = true;
Amount = amount;
}
public override double DefaultWeight => 0.1;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
return false;
}
Hue = sender.DyedHue;
return true;
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
ScissorHelper(from, new Bandage(), 1);
return true;
}
public override void OnSingleClick(Mobile from)
{
var number = Amount == 1 ? 1049124 : 1049123;
from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString());
}
Stackable = true;
Amount = amount;
}
}
public override double DefaultWeight => 0.1;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
return false;
}
Hue = sender.DyedHue;
return true;
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
ScissorHelper(from, new Bandage(), 1);
return true;
}
public override void OnSingleClick(Mobile from)
{
var number = Amount == 1 ? 1049124 : 1049123;
from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString());
}
}

View file

@ -1,93 +1,92 @@
using ModernUO.Serialization;
using Server.Targeting;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class Cotton : Item, IDyable
{
[SerializationGenerator(0, false)]
public partial class Cotton : Item, IDyable
[Constructible]
public Cotton(int amount = 1) : base(0xDF9)
{
[Constructible]
public Cotton(int amount = 1) : base(0xDF9)
Stackable = true;
Weight = 4.0;
Amount = amount;
}
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
Stackable = true;
Weight = 4.0;
Amount = amount;
return false;
}
public bool Dye(Mobile from, DyeTub sender)
Hue = sender.DyedHue;
return true;
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
if (Deleted)
{
return false;
}
Hue = sender.DyedHue;
return true;
from.SendLocalizedMessage(502655); // What spinning wheel do you wish to spin this on?
from.Target = new PickWheelTarget(this);
}
public override void OnDoubleClick(Mobile from)
else
{
if (IsChildOf(from.Backpack))
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new SpoolOfThread(6);
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
}
private class PickWheelTarget : Target
{
private readonly Cotton m_Cotton;
public PickWheelTarget(Cotton cotton) : base(3, false, TargetFlags.None) => m_Cotton = cotton;
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Cotton.Deleted)
{
from.SendLocalizedMessage(502655); // What spinning wheel do you wish to spin this on?
from.Target = new PickWheelTarget(this);
return;
}
else
var wheel = targeted as ISpinningWheel;
if (wheel == null && targeted is AddonComponent component)
{
wheel = component.Addon as ISpinningWheel;
}
if (wheel is not Item)
{
from.SendLocalizedMessage(502658); // Use that on a spinning wheel.
return;
}
if (!m_Cotton.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new SpoolOfThread(6);
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
}
private class PickWheelTarget : Target
{
private readonly Cotton m_Cotton;
public PickWheelTarget(Cotton cotton) : base(3, false, TargetFlags.None) => m_Cotton = cotton;
protected override void OnTarget(Mobile from, object targeted)
else if (wheel.Spinning)
{
if (m_Cotton.Deleted)
{
return;
}
var wheel = targeted as ISpinningWheel;
if (wheel == null && targeted is AddonComponent component)
{
wheel = component.Addon as ISpinningWheel;
}
if (wheel is not Item)
{
from.SendLocalizedMessage(502658); // Use that on a spinning wheel.
return;
}
if (!m_Cotton.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else if (wheel.Spinning)
{
from.SendLocalizedMessage(502656); // That spinning wheel is being used.
}
else
{
m_Cotton.Consume();
wheel.BeginSpin(m_Cotton.OnSpun, from, m_Cotton.Hue);
}
from.SendLocalizedMessage(502656); // That spinning wheel is being used.
}
else
{
m_Cotton.Consume();
wheel.BeginSpin(m_Cotton.OnSpun, from, m_Cotton.Hue);
}
}
}
}
}

View file

@ -1,81 +1,80 @@
using ModernUO.Serialization;
using Server.Targeting;
namespace Server.Items
{
[SerializationGenerator(0, false)]
public partial class Flax : Item
{
[Constructible]
public Flax(int amount = 1) : base(0x1A9C)
{
Stackable = true;
Weight = 1.0;
Amount = amount;
}
namespace Server.Items;
public override void OnDoubleClick(Mobile from)
[SerializationGenerator(0, false)]
public partial class Flax : Item
{
[Constructible]
public Flax(int amount = 1) : base(0x1A9C)
{
Stackable = true;
Weight = 1.0;
Amount = amount;
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
if (IsChildOf(from.Backpack))
from.SendLocalizedMessage(502655); // What spinning wheel do you wish to spin this on?
from.Target = new PickWheelTarget(this);
}
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new SpoolOfThread(6);
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
}
private class PickWheelTarget : Target
{
private readonly Flax m_Flax;
public PickWheelTarget(Flax flax) : base(3, false, TargetFlags.None) => m_Flax = flax;
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Flax.Deleted)
{
from.SendLocalizedMessage(502655); // What spinning wheel do you wish to spin this on?
from.Target = new PickWheelTarget(this);
return;
}
else
var wheel = targeted as ISpinningWheel;
if (wheel == null && targeted is AddonComponent component)
{
wheel = component.Addon as ISpinningWheel;
}
if (wheel is not Item)
{
from.SendLocalizedMessage(502658); // Use that on a spinning wheel.
return;
}
if (!m_Flax.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new SpoolOfThread(6);
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010577); // You put the spools of thread in your backpack.
}
private class PickWheelTarget : Target
{
private readonly Flax m_Flax;
public PickWheelTarget(Flax flax) : base(3, false, TargetFlags.None) => m_Flax = flax;
protected override void OnTarget(Mobile from, object targeted)
else if (wheel.Spinning)
{
if (m_Flax.Deleted)
{
return;
}
var wheel = targeted as ISpinningWheel;
if (wheel == null && targeted is AddonComponent component)
{
wheel = component.Addon as ISpinningWheel;
}
if (wheel is not Item)
{
from.SendLocalizedMessage(502658); // Use that on a spinning wheel.
return;
}
if (!m_Flax.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else if (wheel.Spinning)
{
from.SendLocalizedMessage(502656); // That spinning wheel is being used.
}
else
{
m_Flax.Consume();
wheel.BeginSpin(m_Flax.OnSpun, from, m_Flax.Hue);
}
from.SendLocalizedMessage(502656); // That spinning wheel is being used.
}
else
{
m_Flax.Consume();
wheel.BeginSpin(m_Flax.OnSpun, from, m_Flax.Hue);
}
}
}
}
}

View file

@ -1,187 +1,186 @@
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(2, false)]
public abstract partial class BaseHides : Item, ICommodity
{
[SerializationGenerator(2, false)]
public abstract partial class BaseHides : Item, ICommodity
[InvalidateProperties]
[SerializedCommandProperty(AccessLevel.GameMaster)]
[SerializableField(0)]
private CraftResource _resource;
public BaseHides(CraftResource resource, int amount = 1) : base(0x1079)
{
[InvalidateProperties]
[SerializedCommandProperty(AccessLevel.GameMaster)]
[SerializableField(0)]
private CraftResource _resource;
Stackable = true;
Weight = 5.0;
Amount = amount;
Hue = CraftResources.GetHue(resource);
public BaseHides(CraftResource resource, int amount = 1) : base(0x1079)
_resource = resource;
}
public override int LabelNumber
{
get
{
Stackable = true;
Weight = 5.0;
Amount = amount;
Hue = CraftResources.GetHue(resource);
_resource = resource;
}
public override int LabelNumber
{
get
if (_resource >= CraftResource.SpinedLeather && _resource <= CraftResource.BarbedLeather)
{
if (_resource >= CraftResource.SpinedLeather && _resource <= CraftResource.BarbedLeather)
{
return 1049687 + (_resource - CraftResource.SpinedLeather);
}
return 1047023;
return 1049687 + (_resource - CraftResource.SpinedLeather);
}
return 1047023;
}
}
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
private void Deserialize(IGenericReader reader, int version)
private void Deserialize(IGenericReader reader, int version)
{
_resource = (CraftResource)reader.ReadInt();
}
public override void AddNameProperty(IPropertyList list)
{
if (Amount > 1)
{
_resource = (CraftResource)reader.ReadInt();
list.Add(1050039, $"{Amount}\t{1024216:#}"); // ~1_NUMBER~ ~2_ITEMNAME~
}
public override void AddNameProperty(IPropertyList list)
else
{
if (Amount > 1)
list.Add(1024216); // pile of hides
}
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (!CraftResources.IsStandard(_resource))
{
var num = CraftResources.GetLocalizationNumber(_resource);
if (num > 0)
{
list.Add(1050039, $"{Amount}\t{1024216:#}"); // ~1_NUMBER~ ~2_ITEMNAME~
list.Add(num);
}
else
{
list.Add(1024216); // pile of hides
list.Add(CraftResources.GetName(_resource));
}
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (!CraftResources.IsStandard(_resource))
{
var num = CraftResources.GetLocalizationNumber(_resource);
if (num > 0)
{
list.Add(num);
}
else
{
list.Add(CraftResources.GetName(_resource));
}
}
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1079, 0x1078)]
public partial class Hides : BaseHides, IScissorable
{
[Constructible]
public Hides(int amount = 1) : base(CraftResource.RegularLeather, amount)
{
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
if (Core.AOS && !IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
return false;
}
ScissorHelper(from, new Leather(), 1);
return true;
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1079, 0x1078)]
public partial class SpinedHides : BaseHides, IScissorable
{
[Constructible]
public SpinedHides(int amount = 1) : base(CraftResource.SpinedLeather, amount)
{
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
if (Core.AOS && !IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
return false;
}
ScissorHelper(from, new SpinedLeather(), 1);
return true;
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1079, 0x1078)]
public partial class HornedHides : BaseHides, IScissorable
{
[Constructible]
public HornedHides(int amount = 1) : base(CraftResource.HornedLeather, amount)
{
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
if (Core.AOS && !IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
return false;
}
ScissorHelper(from, new HornedLeather(), 1);
return true;
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1079, 0x1078)]
public partial class BarbedHides : BaseHides, IScissorable
{
[Constructible]
public BarbedHides(int amount = 1) : base(CraftResource.BarbedLeather, amount)
{
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
if (Core.AOS && !IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
return false;
}
ScissorHelper(from, new BarbedLeather(), 1);
return true;
}
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1079, 0x1078)]
public partial class Hides : BaseHides, IScissorable
{
[Constructible]
public Hides(int amount = 1) : base(CraftResource.RegularLeather, amount)
{
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
if (Core.AOS && !IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
return false;
}
ScissorHelper(from, new Leather(), 1);
return true;
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1079, 0x1078)]
public partial class SpinedHides : BaseHides, IScissorable
{
[Constructible]
public SpinedHides(int amount = 1) : base(CraftResource.SpinedLeather, amount)
{
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
if (Core.AOS && !IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
return false;
}
ScissorHelper(from, new SpinedLeather(), 1);
return true;
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1079, 0x1078)]
public partial class HornedHides : BaseHides, IScissorable
{
[Constructible]
public HornedHides(int amount = 1) : base(CraftResource.HornedLeather, amount)
{
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
if (Core.AOS && !IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
return false;
}
ScissorHelper(from, new HornedLeather(), 1);
return true;
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1079, 0x1078)]
public partial class BarbedHides : BaseHides, IScissorable
{
[Constructible]
public BarbedHides(int amount = 1) : base(CraftResource.BarbedLeather, amount)
{
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
if (Core.AOS && !IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(502437); // Items you wish to cut must be in your backpack
return false;
}
ScissorHelper(from, new BarbedLeather(), 1);
return true;
}
}

View file

@ -1,115 +1,114 @@
using ModernUO.Serialization;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(2, false)]
public abstract partial class BaseLeather : Item, ICommodity
{
[SerializationGenerator(2, false)]
public abstract partial class BaseLeather : Item, ICommodity
[InvalidateProperties]
[SerializedCommandProperty(AccessLevel.GameMaster)]
[SerializableField(0)]
private CraftResource _resource;
public BaseLeather(CraftResource resource, int amount = 1) : base(0x1081)
{
[InvalidateProperties]
[SerializedCommandProperty(AccessLevel.GameMaster)]
[SerializableField(0)]
private CraftResource _resource;
Stackable = true;
Weight = 1.0;
Amount = amount;
Hue = CraftResources.GetHue(resource);
public BaseLeather(CraftResource resource, int amount = 1) : base(0x1081)
_resource = resource;
}
public override int LabelNumber
{
get
{
Stackable = true;
Weight = 1.0;
Amount = amount;
Hue = CraftResources.GetHue(resource);
_resource = resource;
}
public override int LabelNumber
{
get
if (_resource >= CraftResource.SpinedLeather && _resource <= CraftResource.BarbedLeather)
{
if (_resource >= CraftResource.SpinedLeather && _resource <= CraftResource.BarbedLeather)
{
return 1049684 + (_resource - CraftResource.SpinedLeather);
}
return 1047022;
return 1049684 + (_resource - CraftResource.SpinedLeather);
}
return 1047022;
}
}
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
private void Deserialize(IGenericReader reader, int version)
private void Deserialize(IGenericReader reader, int version)
{
_resource = (CraftResource)reader.ReadInt();
}
public override void AddNameProperty(IPropertyList list)
{
if (Amount > 1)
{
_resource = (CraftResource)reader.ReadInt();
list.Add(1050039, $"{Amount}\t{1024199:#}"); // ~1_NUMBER~ ~2_ITEMNAME~
}
public override void AddNameProperty(IPropertyList list)
else
{
if (Amount > 1)
list.Add(1024199); // cut leather
}
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (!CraftResources.IsStandard(_resource))
{
var num = CraftResources.GetLocalizationNumber(_resource);
if (num > 0)
{
list.Add(1050039, $"{Amount}\t{1024199:#}"); // ~1_NUMBER~ ~2_ITEMNAME~
list.Add(num);
}
else
{
list.Add(1024199); // cut leather
list.Add(CraftResources.GetName(_resource));
}
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (!CraftResources.IsStandard(_resource))
{
var num = CraftResources.GetLocalizationNumber(_resource);
if (num > 0)
{
list.Add(num);
}
else
{
list.Add(CraftResources.GetName(_resource));
}
}
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1081, 0x1082)]
public partial class Leather : BaseLeather
{
[Constructible]
public Leather(int amount = 1) : base(CraftResource.RegularLeather, amount)
{
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1081, 0x1082)]
public partial class SpinedLeather : BaseLeather
{
[Constructible]
public SpinedLeather(int amount = 1) : base(CraftResource.SpinedLeather, amount)
{
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1081, 0x1082)]
public partial class HornedLeather : BaseLeather
{
[Constructible]
public HornedLeather(int amount = 1) : base(CraftResource.HornedLeather, amount)
{
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1081, 0x1082)]
public partial class BarbedLeather : BaseLeather
{
[Constructible]
public BarbedLeather(int amount = 1) : base(CraftResource.BarbedLeather, amount)
{
}
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1081, 0x1082)]
public partial class Leather : BaseLeather
{
[Constructible]
public Leather(int amount = 1) : base(CraftResource.RegularLeather, amount)
{
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1081, 0x1082)]
public partial class SpinedLeather : BaseLeather
{
[Constructible]
public SpinedLeather(int amount = 1) : base(CraftResource.SpinedLeather, amount)
{
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1081, 0x1082)]
public partial class HornedLeather : BaseLeather
{
[Constructible]
public HornedLeather(int amount = 1) : base(CraftResource.HornedLeather, amount)
{
}
}
[SerializationGenerator(0, false)]
[Flippable(0x1081, 0x1082)]
public partial class BarbedLeather : BaseLeather
{
[Constructible]
public BarbedLeather(int amount = 1) : base(CraftResource.BarbedLeather, amount)
{
}
}

View file

@ -1,52 +1,51 @@
using ModernUO.Serialization;
using Server.Network;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
[Flippable(0x1765, 0x1767)]
public partial class UncutCloth : Item, IScissorable, IDyable, ICommodity
{
[SerializationGenerator(0, false)]
[Flippable(0x1765, 0x1767)]
public partial class UncutCloth : Item, IScissorable, IDyable, ICommodity
[Constructible]
public UncutCloth(int amount = 1) : base(0x1767)
{
[Constructible]
public UncutCloth(int amount = 1) : base(0x1767)
{
Stackable = true;
Amount = amount;
}
public override double DefaultWeight => 0.1;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
return false;
}
Hue = sender.DyedHue;
return true;
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
ScissorHelper(from, new Bandage(), 1);
return true;
}
public override void OnSingleClick(Mobile from)
{
var number = Amount == 1 ? 1049124 : 1049123;
from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString());
}
Stackable = true;
Amount = amount;
}
}
public override double DefaultWeight => 0.1;
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => true;
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
return false;
}
Hue = sender.DyedHue;
return true;
}
public bool Scissor(Mobile from, Scissors scissors)
{
if (Deleted || !from.CanSee(this))
{
return false;
}
ScissorHelper(from, new Bandage(), 1);
return true;
}
public override void OnSingleClick(Mobile from)
{
var number = Amount == 1 ? 1049124 : 1049123;
from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString());
}
}

View file

@ -1,115 +1,114 @@
using ModernUO.Serialization;
using Server.Targeting;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class Wool : Item, IDyable
{
[SerializationGenerator(0, false)]
public partial class Wool : Item, IDyable
[Constructible]
public Wool(int amount = 1) : base(0xDF8)
{
[Constructible]
public Wool(int amount = 1) : base(0xDF8)
Stackable = true;
Weight = 4.0;
Amount = amount;
}
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
Stackable = true;
Weight = 4.0;
Amount = amount;
return false;
}
public bool Dye(Mobile from, DyeTub sender)
Hue = sender.DyedHue;
return true;
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
if (Deleted)
from.SendLocalizedMessage(502655); // What spinning wheel do you wish to spin this on?
from.Target = new PickWheelTarget(this);
}
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new DarkYarn(3);
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010576); // You put the balls of yarn in your backpack.
}
private class PickWheelTarget : Target
{
private readonly Wool m_Wool;
public PickWheelTarget(Wool wool) : base(3, false, TargetFlags.None) => m_Wool = wool;
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Wool.Deleted)
{
return false;
return;
}
Hue = sender.DyedHue;
var wheel = targeted as ISpinningWheel;
return true;
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
if (wheel == null && targeted is AddonComponent component)
{
from.SendLocalizedMessage(502655); // What spinning wheel do you wish to spin this on?
from.Target = new PickWheelTarget(this);
wheel = component.Addon as ISpinningWheel;
}
else
if (wheel is Item)
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
public virtual void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new DarkYarn(3);
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010576); // You put the balls of yarn in your backpack.
}
private class PickWheelTarget : Target
{
private readonly Wool m_Wool;
public PickWheelTarget(Wool wool) : base(3, false, TargetFlags.None) => m_Wool = wool;
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Wool.Deleted)
if (!m_Wool.IsChildOf(from.Backpack))
{
return;
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
var wheel = targeted as ISpinningWheel;
if (wheel == null && targeted is AddonComponent component)
else if (wheel.Spinning)
{
wheel = component.Addon as ISpinningWheel;
}
if (wheel is Item)
{
if (!m_Wool.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else if (wheel.Spinning)
{
from.SendLocalizedMessage(502656); // That spinning wheel is being used.
}
else
{
m_Wool.Consume();
wheel.BeginSpin(m_Wool.OnSpun, from, m_Wool.Hue);
}
from.SendLocalizedMessage(502656); // That spinning wheel is being used.
}
else
{
from.SendLocalizedMessage(502658); // Use that on a spinning wheel.
m_Wool.Consume();
wheel.BeginSpin(m_Wool.OnSpun, from, m_Wool.Hue);
}
}
else
{
from.SendLocalizedMessage(502658); // Use that on a spinning wheel.
}
}
}
[SerializationGenerator(0, false)]
public partial class TaintedWool : Wool
{
[Constructible]
public TaintedWool(int amount = 1) : base(0x101F)
{
Stackable = true;
Weight = 4.0;
Amount = amount;
}
public override void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new DarkYarn();
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010574); // You put a ball of yarn in your backpack.
}
}
}
[SerializationGenerator(0, false)]
public partial class TaintedWool : Wool
{
[Constructible]
public TaintedWool(int amount = 1) : base(0x101F)
{
Stackable = true;
Weight = 4.0;
Amount = amount;
}
public override void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new DarkYarn();
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010574); // You put a ball of yarn in your backpack.
}
}

View file

@ -1,130 +1,129 @@
using ModernUO.Serialization;
using Server.Targeting;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public abstract partial class BaseClothMaterial : Item, IDyable
{
[SerializationGenerator(0, false)]
public abstract partial class BaseClothMaterial : Item, IDyable
public BaseClothMaterial(int itemID, int amount = 1) : base(itemID)
{
public BaseClothMaterial(int itemID, int amount = 1) : base(itemID)
Stackable = true;
Weight = 1.0;
Amount = amount;
}
public bool Dye(Mobile from, DyeTub sender)
{
if (Deleted)
{
Stackable = true;
Weight = 1.0;
Amount = amount;
return false;
}
public bool Dye(Mobile from, DyeTub sender)
Hue = sender.DyedHue;
return true;
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
if (Deleted)
{
return false;
}
Hue = sender.DyedHue;
return true;
from.SendLocalizedMessage(500366); // Select a loom to use that on.
from.Target = new PickLoomTarget(this);
}
public override void OnDoubleClick(Mobile from)
else
{
if (IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(500366); // Select a loom to use that on.
from.Target = new PickLoomTarget(this);
}
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
private class PickLoomTarget : Target
private class PickLoomTarget : Target
{
private readonly BaseClothMaterial m_Material;
public PickLoomTarget(BaseClothMaterial material) : base(3, false, TargetFlags.None) => m_Material = material;
protected override void OnTarget(Mobile from, object targeted)
{
private readonly BaseClothMaterial m_Material;
public PickLoomTarget(BaseClothMaterial material) : base(3, false, TargetFlags.None) => m_Material = material;
protected override void OnTarget(Mobile from, object targeted)
if (m_Material.Deleted)
{
if (m_Material.Deleted)
return;
}
var loom = targeted as ILoom;
if (loom == null && targeted is AddonComponent component)
{
loom = component.Addon as ILoom;
}
if (loom != null)
{
if (!m_Material.IsChildOf(from.Backpack))
{
return;
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
var loom = targeted as ILoom;
if (loom == null && targeted is AddonComponent component)
else if (loom.Phase < 4)
{
loom = component.Addon as ILoom;
}
m_Material.Consume();
if (loom != null)
{
if (!m_Material.IsChildOf(from.Backpack))
if (targeted is Item item)
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
else if (loom.Phase < 4)
{
m_Material.Consume();
if (targeted is Item item)
{
item.SendLocalizedMessageTo(from, 1010001 + loom.Phase++);
}
}
else
{
Item create = new BoltOfCloth();
create.Hue = m_Material.Hue;
m_Material.Consume();
loom.Phase = 0;
from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
from.AddToBackpack(create);
item.SendLocalizedMessageTo(from, 1010001 + loom.Phase++);
}
}
else
{
from.SendLocalizedMessage(500367); // Try using that on a loom.
Item create = new BoltOfCloth();
create.Hue = m_Material.Hue;
m_Material.Consume();
loom.Phase = 0;
from.SendLocalizedMessage(500368); // You create some cloth and put it in your backpack.
from.AddToBackpack(create);
}
}
else
{
from.SendLocalizedMessage(500367); // Try using that on a loom.
}
}
}
}
[SerializationGenerator(0, false)]
public partial class DarkYarn : BaseClothMaterial
[SerializationGenerator(0, false)]
public partial class DarkYarn : BaseClothMaterial
{
[Constructible]
public DarkYarn(int amount = 1) : base(0xE1D, amount)
{
[Constructible]
public DarkYarn(int amount = 1) : base(0xE1D, amount)
{
}
}
[SerializationGenerator(0, false)]
public partial class LightYarn : BaseClothMaterial
{
[Constructible]
public LightYarn(int amount = 1) : base(0xE1E, amount)
{
}
}
[SerializationGenerator(0, false)]
public partial class LightYarnUnraveled : BaseClothMaterial
{
[Constructible]
public LightYarnUnraveled(int amount = 1) : base(0xE1F, amount)
{
}
}
[SerializationGenerator(0, false)]
public partial class SpoolOfThread : BaseClothMaterial
{
[Constructible]
public SpoolOfThread(int amount = 1) : base(0xFA0, amount)
{
}
}
}
[SerializationGenerator(0, false)]
public partial class LightYarn : BaseClothMaterial
{
[Constructible]
public LightYarn(int amount = 1) : base(0xE1E, amount)
{
}
}
[SerializationGenerator(0, false)]
public partial class LightYarnUnraveled : BaseClothMaterial
{
[Constructible]
public LightYarnUnraveled(int amount = 1) : base(0xE1F, amount)
{
}
}
[SerializationGenerator(0, false)]
public partial class SpoolOfThread : BaseClothMaterial
{
[Constructible]
public SpoolOfThread(int amount = 1) : base(0xFA0, amount)
{
}
}