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,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.
}
}