fix: Codegens BOD rewards. (#1361)

This commit is contained in:
Kamron Batman 2023-03-06 19:01:14 -08:00 committed by GitHub
parent 3097eb4fa7
commit 84b3e5cfdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 469 additions and 592 deletions

View file

@ -1,124 +1,93 @@
using ModernUO.Serialization;
using Server.Engines.Craft; using Server.Engines.Craft;
namespace Server.Items namespace Server.Items;
[SerializationGenerator(0, false)]
[Flippable(0x13E4, 0x13E3)]
public partial class AncientSmithyHammer : BaseTool
{ {
[Flippable(0x13E4, 0x13E3)] private SkillMod _skillMod;
public class AncientSmithyHammer : BaseTool
[Constructible]
public AncientSmithyHammer(int bonus, int uses = 600) : base(uses, 0x13E4)
{ {
private int m_Bonus; _bonus = bonus;
private SkillMod m_SkillMod; Weight = 8.0;
Layer = Layer.OneHanded;
Hue = 0x482;
}
[Constructible] [SerializableProperty(0)]
public AncientSmithyHammer(int bonus, int uses = 600) : base(uses, 0x13E4) [CommandProperty(AccessLevel.GameMaster)]
public int Bonus
{
get => _bonus;
set
{ {
m_Bonus = bonus; _bonus = value;
Weight = 8.0; InvalidateProperties();
Layer = Layer.OneHanded; this.MarkDirty();
Hue = 0x482;
}
public AncientSmithyHammer(Serial serial) : base(serial) if (_bonus == 0)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public int Bonus
{
get => m_Bonus;
set
{ {
m_Bonus = value; _skillMod?.Remove();
InvalidateProperties();
if (m_Bonus == 0) _skillMod = null;
{
m_SkillMod?.Remove();
m_SkillMod = null;
}
else if (m_SkillMod == null && Parent is Mobile mobile)
{
m_SkillMod = new DefaultSkillMod(SkillName.Blacksmith, "AncientSmithyHammer", true, m_Bonus);
mobile.AddSkillMod(m_SkillMod);
}
else if (m_SkillMod != null)
{
m_SkillMod.Value = m_Bonus;
}
} }
} else if (_skillMod == null && Parent is Mobile mobile)
public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem;
public override int LabelNumber => 1045127; // ancient smithy hammer
public override void OnAdded(IEntity parent)
{
base.OnAdded(parent);
if (m_Bonus != 0 && parent is Mobile mobile)
{ {
m_SkillMod?.Remove(); _skillMod = new DefaultSkillMod(SkillName.Blacksmith, "AncientSmithyHammer", true, _bonus);
mobile.AddSkillMod(_skillMod);
m_SkillMod = new DefaultSkillMod(SkillName.Blacksmith, "AncientSmithyHammer", true, m_Bonus);
mobile.AddSkillMod(m_SkillMod);
} }
} else if (_skillMod != null)
public override void OnRemoved(IEntity parent)
{
base.OnRemoved(parent);
m_SkillMod?.Remove();
m_SkillMod = null;
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (m_Bonus != 0)
{ {
list.Add(1060451, $"{1042354:#}\t{m_Bonus}"); // ~1_skillname~ +~2_val~ _skillMod.Value = _bonus;
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Bonus);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Bonus = reader.ReadInt();
break;
}
}
if (m_Bonus != 0 && Parent is Mobile mobile)
{
m_SkillMod?.Remove();
m_SkillMod = new DefaultSkillMod(SkillName.Blacksmith, "AncientSmithyHammer", true, m_Bonus);
mobile.AddSkillMod(m_SkillMod);
}
if (Hue == 0)
{
Hue = 0x482;
} }
} }
} }
public override CraftSystem CraftSystem => DefBlacksmithy.CraftSystem;
public override int LabelNumber => 1045127; // ancient smithy hammer
public override void OnAdded(IEntity parent)
{
base.OnAdded(parent);
if (_bonus != 0 && parent is Mobile mobile)
{
_skillMod?.Remove();
_skillMod = new DefaultSkillMod(SkillName.Blacksmith, "AncientSmithyHammer", true, _bonus);
mobile.AddSkillMod(_skillMod);
}
}
public override void OnRemoved(IEntity parent)
{
base.OnRemoved(parent);
_skillMod?.Remove();
_skillMod = null;
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (_bonus != 0)
{
list.Add(1060451, $"{1042354:#}\t{_bonus}"); // ~1_skillname~ +~2_val~
}
}
[AfterDeserialization]
private void AfterDeserialization()
{
if (_bonus != 0 && Parent is Mobile mobile)
{
_skillMod = new DefaultSkillMod(SkillName.Blacksmith, "AncientSmithyHammer", true, _bonus);
mobile.AddSkillMod(_skillMod);
}
}
} }

View file

@ -1,40 +1,18 @@
using ModernUO.Serialization;
using Server.Engines.Craft; using Server.Engines.Craft;
namespace Server.Items namespace Server.Items;
[Anvil]
[SerializationGenerator(0, false)]
[Flippable(0xFAF, 0xFB0)]
public partial class ColoredAnvil : Item
{ {
[Anvil, Flippable(0xFAF, 0xFB0)] [Constructible]
public class ColoredAnvil : Item public ColoredAnvil() : base(0xFAF)
{ {
[Constructible] // TODO: Color weighted by rarity?
public ColoredAnvil() : this( Hue = CraftResources.GetRandomResource(CraftResource.DullCopper, CraftResource.Valorite)?.Hue ?? 0;
CraftResources.GetHue( Weight = 20;
(CraftResource)Utility.RandomMinMax((int)CraftResource.DullCopper, (int)CraftResource.Valorite)
)
)
{
}
[Constructible]
public ColoredAnvil(int hue) : base(0xFAF)
{
Hue = hue;
Weight = 20;
}
public ColoredAnvil(Serial serial) : base(serial)
{
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
} }
} }

View file

@ -1,242 +1,171 @@
namespace Server.Items using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
[Flippable(0x13c6, 0x13ce)]
public partial class LeatherGlovesOfMining : BaseGlovesOfMining
{ {
[Flippable(0x13c6, 0x13ce)] [Constructible]
public class LeatherGlovesOfMining : BaseGlovesOfMining public LeatherGlovesOfMining(int bonus) : base(bonus, 0x13C6) => Weight = 1;
public override int BasePhysicalResistance => 2;
public override int BaseFireResistance => 4;
public override int BaseColdResistance => 3;
public override int BasePoisonResistance => 3;
public override int BaseEnergyResistance => 3;
public override int InitMinHits => 30;
public override int InitMaxHits => 40;
public override int AosStrReq => 20;
public override int OldStrReq => 10;
public override int ArmorBase => 13;
public override ArmorMaterialType MaterialType => ArmorMaterialType.Leather;
public override CraftResource DefaultResource => CraftResource.RegularLeather;
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
public override int LabelNumber => 1045122; // leather blacksmith gloves of mining
}
[SerializationGenerator(0, false)]
[Flippable(0x13d5, 0x13dd)]
public partial class StuddedGlovesOfMining : BaseGlovesOfMining
{
[Constructible]
public StuddedGlovesOfMining(int bonus) : base(bonus, 0x13D5) => Weight = 2;
public override int BasePhysicalResistance => 2;
public override int BaseFireResistance => 4;
public override int BaseColdResistance => 3;
public override int BasePoisonResistance => 3;
public override int BaseEnergyResistance => 4;
public override int InitMinHits => 35;
public override int InitMaxHits => 45;
public override int AosStrReq => 25;
public override int OldStrReq => 25;
public override int ArmorBase => 16;
public override ArmorMaterialType MaterialType => ArmorMaterialType.Studded;
public override CraftResource DefaultResource => CraftResource.RegularLeather;
public override int LabelNumber => 1045123; // studded leather blacksmith gloves of mining
}
[SerializationGenerator(0, false)]
[Flippable(0x13eb, 0x13f2)]
public partial class RingmailGlovesOfMining : BaseGlovesOfMining
{
[Constructible]
public RingmailGlovesOfMining(int bonus) : base(bonus, 0x13EB) => Weight = 1;
public override int BasePhysicalResistance => 3;
public override int BaseFireResistance => 3;
public override int BaseColdResistance => 1;
public override int BasePoisonResistance => 5;
public override int BaseEnergyResistance => 3;
public override int InitMinHits => 40;
public override int InitMaxHits => 50;
public override int AosStrReq => 40;
public override int OldStrReq => 20;
public override int OldDexBonus => -1;
public override int ArmorBase => 22;
public override ArmorMaterialType MaterialType => ArmorMaterialType.Ringmail;
public override int LabelNumber => 1045124; // ringmail blacksmith gloves of mining
}
[SerializationGenerator(0, false)]
public abstract partial class BaseGlovesOfMining : BaseArmor
{
private SkillMod _skillMod;
public BaseGlovesOfMining(int bonus, int itemID) : base(itemID)
{ {
[Constructible] _bonus = bonus;
public LeatherGlovesOfMining(int bonus) : base(bonus, 0x13C6) => Weight = 1;
public LeatherGlovesOfMining(Serial serial) : base(serial) // TODO: Color weighted by rarity?
Hue = CraftResources.GetRandomResource(CraftResource.DullCopper, CraftResource.Valorite)?.Hue ?? 0;
}
[SerializableProperty(0)]
[CommandProperty(AccessLevel.GameMaster)]
public int Bonus
{
get => _bonus;
set
{ {
} _bonus = value;
InvalidateProperties();
this.MarkDirty();
public override int BasePhysicalResistance => 2; if (_bonus == 0)
public override int BaseFireResistance => 4; {
public override int BaseColdResistance => 3; _skillMod?.Remove();
public override int BasePoisonResistance => 3;
public override int BaseEnergyResistance => 3;
public override int InitMinHits => 30; _skillMod = null;
public override int InitMaxHits => 40; }
else if (_skillMod == null && Parent is Mobile mobile)
public override int AosStrReq => 20; {
public override int OldStrReq => 10; _skillMod = new DefaultSkillMod(SkillName.Mining, "MiningGloves", true, _bonus);
mobile.AddSkillMod(_skillMod);
public override int ArmorBase => 13; }
else if (_skillMod != null)
public override ArmorMaterialType MaterialType => ArmorMaterialType.Leather; {
public override CraftResource DefaultResource => CraftResource.RegularLeather; _skillMod.Value = _bonus;
}
public override ArmorMeditationAllowance DefMedAllowance => ArmorMeditationAllowance.All;
public override int LabelNumber => 1045122; // leather blacksmith gloves of mining
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
} }
} }
[Flippable(0x13d5, 0x13dd)] public override void OnAdded(IEntity parent)
public class StuddedGlovesOfMining : BaseGlovesOfMining
{ {
[Constructible] base.OnAdded(parent);
public StuddedGlovesOfMining(int bonus) : base(bonus, 0x13D5) => Weight = 2;
public StuddedGlovesOfMining(Serial serial) : base(serial) if (_bonus != 0 && parent is Mobile mobile)
{ {
} _skillMod?.Remove();
public override int BasePhysicalResistance => 2; _skillMod = new DefaultSkillMod(SkillName.Mining, "MiningGloves", true, _bonus);
public override int BaseFireResistance => 4; mobile.AddSkillMod(_skillMod);
public override int BaseColdResistance => 3;
public override int BasePoisonResistance => 3;
public override int BaseEnergyResistance => 4;
public override int InitMinHits => 35;
public override int InitMaxHits => 45;
public override int AosStrReq => 25;
public override int OldStrReq => 25;
public override int ArmorBase => 16;
public override ArmorMaterialType MaterialType => ArmorMaterialType.Studded;
public override CraftResource DefaultResource => CraftResource.RegularLeather;
public override int LabelNumber => 1045123; // studded leather blacksmith gloves of mining
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
} }
} }
[Flippable(0x13eb, 0x13f2)] public override void OnRemoved(IEntity parent)
public class RingmailGlovesOfMining : BaseGlovesOfMining
{ {
[Constructible] base.OnRemoved(parent);
public RingmailGlovesOfMining(int bonus) : base(bonus, 0x13EB) => Weight = 1;
public RingmailGlovesOfMining(Serial serial) : base(serial) _skillMod?.Remove();
_skillMod = null;
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (_bonus != 0)
{ {
} list.Add(1062005, _bonus); // mining bonus +~1_val~
public override int BasePhysicalResistance => 3;
public override int BaseFireResistance => 3;
public override int BaseColdResistance => 1;
public override int BasePoisonResistance => 5;
public override int BaseEnergyResistance => 3;
public override int InitMinHits => 40;
public override int InitMaxHits => 50;
public override int AosStrReq => 40;
public override int OldStrReq => 20;
public override int OldDexBonus => -1;
public override int ArmorBase => 22;
public override ArmorMaterialType MaterialType => ArmorMaterialType.Ringmail;
public override int LabelNumber => 1045124; // ringmail blacksmith gloves of mining
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
} }
} }
public abstract class BaseGlovesOfMining : BaseArmor [AfterDeserialization]
private void AfterDeserialization()
{ {
private int m_Bonus; if (_bonus != 0 && Parent is Mobile mobile)
private SkillMod m_SkillMod;
public BaseGlovesOfMining(int bonus, int itemID) : base(itemID)
{ {
m_Bonus = bonus; _skillMod = new DefaultSkillMod(SkillName.Mining, "MiningGloves", true, _bonus);
mobile.AddSkillMod(_skillMod);
Hue = CraftResources.GetHue(
(CraftResource)Utility.RandomMinMax((int)CraftResource.DullCopper, (int)CraftResource.Valorite)
);
}
public BaseGlovesOfMining(Serial serial) : base(serial)
{
}
[CommandProperty(AccessLevel.GameMaster)]
public int Bonus
{
get => m_Bonus;
set
{
m_Bonus = value;
InvalidateProperties();
if (m_Bonus == 0)
{
m_SkillMod?.Remove();
m_SkillMod = null;
}
else if (m_SkillMod == null && Parent is Mobile mobile)
{
m_SkillMod = new DefaultSkillMod(SkillName.Mining, "MiningGloves", true, m_Bonus);
mobile.AddSkillMod(m_SkillMod);
}
else if (m_SkillMod != null)
{
m_SkillMod.Value = m_Bonus;
}
}
}
public override void OnAdded(IEntity parent)
{
base.OnAdded(parent);
if (m_Bonus != 0 && parent is Mobile mobile)
{
m_SkillMod?.Remove();
m_SkillMod = new DefaultSkillMod(SkillName.Mining, "MiningGloves", true, m_Bonus);
mobile.AddSkillMod(m_SkillMod);
}
}
public override void OnRemoved(IEntity parent)
{
base.OnRemoved(parent);
m_SkillMod?.Remove();
m_SkillMod = null;
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
if (m_Bonus != 0)
{
list.Add(1062005, m_Bonus); // mining bonus +~1_val~
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
writer.Write(m_Bonus);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{
case 0:
{
m_Bonus = reader.ReadInt();
break;
}
}
if (m_Bonus != 0 && Parent is Mobile mobile)
{
m_SkillMod?.Remove();
m_SkillMod = new DefaultSkillMod(SkillName.Mining, "MiningGloves", true, m_Bonus);
mobile.AddSkillMod(m_SkillMod);
}
} }
} }
} }

View file

@ -1,196 +1,157 @@
using ModernUO.Serialization;
using Server.Network; using Server.Network;
using Server.Targeting; using Server.Targeting;
namespace Server.Items namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class PowderOfTemperament : Item, IUsesRemaining
{ {
public class PowderOfTemperament : Item, IUsesRemaining [InvalidateProperties]
[SerializableField(0)]
[SerializedCommandProperty(AccessLevel.GameMaster)]
private int _usesRemaining;
[Constructible]
public PowderOfTemperament(int charges = 10) : base(4102)
{ {
private int m_UsesRemaining; Weight = 1.0;
Hue = 2419;
UsesRemaining = charges;
}
[Constructible] public override int LabelNumber => 1049082; // powder of fortifying
public PowderOfTemperament(int charges = 10) : base(4102)
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
set { }
}
public override void GetProperties(IPropertyList list)
{
base.GetProperties(list);
list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~
}
public virtual void DisplayDurabilityTo(Mobile m)
{
LabelToAffix(m, 1017323, AffixType.Append, $": {_usesRemaining}"); // Durability
}
public override void OnSingleClick(Mobile from)
{
DisplayDurabilityTo(from);
base.OnSingleClick(from);
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{ {
Weight = 1.0; from.Target = new InternalTarget(this);
Hue = 2419;
UsesRemaining = charges;
} }
else
public PowderOfTemperament(Serial serial) : base(serial)
{ {
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
} }
}
public override int LabelNumber => 1049082; // powder of fortifying private class InternalTarget : Target
{
private readonly PowderOfTemperament _powder;
[CommandProperty(AccessLevel.GameMaster)] public InternalTarget(PowderOfTemperament powder) : base(2, false, TargetFlags.None) => _powder = powder;
public int UsesRemaining
protected override void OnTarget(Mobile from, object targeted)
{ {
get => m_UsesRemaining; if (_powder?.Deleted != false || _powder.UsesRemaining <= 0)
set
{ {
m_UsesRemaining = value; from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
InvalidateProperties(); return;
} }
}
bool IUsesRemaining.ShowUsesRemaining if (targeted is not (Item item and IDurability wearable))
{
get => true;
set { }
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(m_UsesRemaining);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
switch (version)
{ {
case 0: from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
{ return;
m_UsesRemaining = reader.ReadInt();
break;
}
} }
}
public override void GetProperties(IPropertyList list) if (!wearable.CanFortify)
{
base.GetProperties(list);
list.Add(1060584, m_UsesRemaining); // uses remaining: ~1_val~
}
public virtual void DisplayDurabilityTo(Mobile m)
{
LabelToAffix(m, 1017323, AffixType.Append, $": {m_UsesRemaining}"); // Durability
}
public override void OnSingleClick(Mobile from)
{
DisplayDurabilityTo(from);
base.OnSingleClick(from);
}
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{ {
from.Target = new InternalTarget(this); from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
return;
}
if (!item.IsChildOf(from.Backpack) && (!Core.ML || item.Parent != from) ||
!_powder.IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
return;
}
var origMaxHP = wearable.MaxHitPoints;
var origCurHP = wearable.HitPoints;
if (origMaxHP <= 0)
{
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
return;
}
var initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;
wearable.UnscaleDurability();
if (wearable.MaxHitPoints >= initMaxHP)
{
from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
wearable.ScaleDurability();
return;
}
var bonus = initMaxHP - wearable.MaxHitPoints;
if (bonus > 10)
{
bonus = 10;
}
wearable.MaxHitPoints += bonus;
wearable.HitPoints += bonus;
wearable.ScaleDurability();
if (wearable.MaxHitPoints > 255)
{
wearable.MaxHitPoints = 255;
}
if (wearable.HitPoints > 255)
{
wearable.HitPoints = 255;
}
if (wearable.MaxHitPoints > origMaxHP)
{
from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
from.PlaySound(0x247);
--_powder.UsesRemaining;
if (_powder.UsesRemaining <= 0)
{
from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
_powder.Delete();
}
} }
else else
{ {
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. wearable.MaxHitPoints = origMaxHP;
} wearable.HitPoints = origCurHP;
} from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
private class InternalTarget : Target
{
private readonly PowderOfTemperament m_Powder;
public InternalTarget(PowderOfTemperament powder) : base(2, false, TargetFlags.None) => m_Powder = powder;
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Powder?.Deleted != false || m_Powder.UsesRemaining <= 0)
{
from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
return;
}
if (targeted is Item item && item is IDurability wearable)
{
if (!wearable.CanFortify)
{
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
return;
}
if ((item.IsChildOf(from.Backpack) || Core.ML && item.Parent == from) &&
m_Powder.IsChildOf(from.Backpack))
{
var origMaxHP = wearable.MaxHitPoints;
var origCurHP = wearable.HitPoints;
if (origMaxHP > 0)
{
var initMaxHP = Core.AOS ? 255 : wearable.InitMaxHits;
wearable.UnscaleDurability();
if (wearable.MaxHitPoints < initMaxHP)
{
var bonus = initMaxHP - wearable.MaxHitPoints;
if (bonus > 10)
{
bonus = 10;
}
wearable.MaxHitPoints += bonus;
wearable.HitPoints += bonus;
wearable.ScaleDurability();
if (wearable.MaxHitPoints > 255)
{
wearable.MaxHitPoints = 255;
}
if (wearable.HitPoints > 255)
{
wearable.HitPoints = 255;
}
if (wearable.MaxHitPoints > origMaxHP)
{
from.SendLocalizedMessage(1049084); // You successfully use the powder on the item.
from.PlaySound(0x247);
--m_Powder.UsesRemaining;
if (m_Powder.UsesRemaining <= 0)
{
from.SendLocalizedMessage(1049086); // You have used up your powder of fortifying.
m_Powder.Delete();
}
}
else
{
wearable.MaxHitPoints = origMaxHP;
wearable.HitPoints = origCurHP;
from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
}
}
else
{
from.SendLocalizedMessage(1049085); // The item cannot be improved any further.
wearable.ScaleDurability();
}
}
else
{
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
}
}
else
{
from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
}
}
else
{
from.SendLocalizedMessage(1049083); // You cannot use the powder on that item.
}
} }
} }
} }

View file

@ -1,46 +1,30 @@
namespace Server.Items using ModernUO.Serialization;
namespace Server.Items;
[SerializationGenerator(0, false)]
public partial class JesterHatofChuckles : BaseHat
{ {
public class JesterHatofChuckles : BaseHat [Constructible]
public JesterHatofChuckles() : this(Utility.RandomList(0x13e, 0x03, 0x172, 0x3f))
{ {
[Constructible]
public JesterHatofChuckles() : this(Utility.RandomList(0x13e, 0x03, 0x172, 0x3f))
{
}
[Constructible]
public JesterHatofChuckles(int hue) : base(0x171C, hue)
{
Attributes.Luck = 150;
Weight = 1.0;
}
public JesterHatofChuckles(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1073256; // Jester Hat of Chuckles - Museum of Vesper Replica 1073256
public override int BasePhysicalResistance => 12;
public override int BaseFireResistance => 12;
public override int BaseColdResistance => 12;
public override int BasePoisonResistance => 12;
public override int BaseEnergyResistance => 12;
public override int InitMinHits => 100;
public override int InitMaxHits => 100;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
} }
[Constructible]
public JesterHatofChuckles(int hue) : base(0x171C, hue)
{
Attributes.Luck = 150;
Weight = 1.0;
}
public override int LabelNumber => 1073256; // Jester Hat of Chuckles - Museum of Vesper Replica 1073256
public override int BasePhysicalResistance => 12;
public override int BaseFireResistance => 12;
public override int BaseColdResistance => 12;
public override int BasePoisonResistance => 12;
public override int BaseEnergyResistance => 12;
public override int InitMinHits => 100;
public override int InitMaxHits => 100;
} }

View file

@ -0,0 +1,14 @@
{
"version": 0,
"type": "Server.Items.AncientSmithyHammer",
"properties": [
{
"name": "Bonus",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

@ -0,0 +1,14 @@
{
"version": 0,
"type": "Server.Items.BaseGlovesOfMining",
"properties": [
{
"name": "Bonus",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.ColoredAnvil"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.JesterHatofChuckles"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.LeatherGlovesOfMining"
}

View file

@ -0,0 +1,14 @@
{
"version": 0,
"type": "Server.Items.PowderOfTemperament",
"properties": [
{
"name": "UsesRemaining",
"type": "int",
"rule": "PrimitiveTypeMigrationRule",
"ruleArguments": [
""
]
}
]
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.RingmailGlovesOfMining"
}

View file

@ -0,0 +1,4 @@
{
"version": 0,
"type": "Server.Items.StuddedGlovesOfMining"
}

View file

@ -773,32 +773,17 @@ namespace Server.Items
} }
/// <summary> /// <summary>
/// Returns a <see cref="CraftResourceType" /> value indiciating the type of '<paramref name="resource" />'. /// Returns a <see cref="CraftResourceType" /> value indicating the type of '<paramref name="resource" />'.
/// </summary> /// </summary>
public static CraftResourceType GetType(CraftResource resource) public static CraftResourceType GetType(CraftResource resource) =>
{ resource switch
if (resource >= CraftResource.Iron && resource <= CraftResource.Valorite)
{ {
return CraftResourceType.Metal; >= CraftResource.Iron and <= CraftResource.Valorite => CraftResourceType.Metal,
} >= CraftResource.RegularLeather and <= CraftResource.BarbedLeather => CraftResourceType.Leather,
>= CraftResource.RedScales and <= CraftResource.BlueScales => CraftResourceType.Scales,
if (resource >= CraftResource.RegularLeather && resource <= CraftResource.BarbedLeather) >= CraftResource.RegularWood and <= CraftResource.Frostwood => CraftResourceType.Wood,
{ _ => CraftResourceType.None
return CraftResourceType.Leather; };
}
if (resource >= CraftResource.RedScales && resource <= CraftResource.BlueScales)
{
return CraftResourceType.Scales;
}
if (resource >= CraftResource.RegularWood && resource <= CraftResource.Frostwood)
{
return CraftResourceType.Wood;
}
return CraftResourceType.None;
}
/// <summary> /// <summary>
/// Returns the first <see cref="CraftResource" /> in the series of resources for which '<paramref name="resource" />' /// Returns the first <see cref="CraftResource" /> in the series of resources for which '<paramref name="resource" />'
@ -851,6 +836,15 @@ namespace Server.Items
return info?.Hue ?? 0; return info?.Hue ?? 0;
} }
/// <summary>
/// Returns the <see cref="CraftResourceInfo" /> of a random '<paramref name="resource" />' -or- null if an invalid
/// resource was specified.
/// </summary>
public static CraftResourceInfo GetRandomResource(CraftResource startResource, CraftResource endResource) =>
GetInfo(
(CraftResource)Utility.RandomMinMax((int)startResource, (int)endResource)
);
/// <summary> /// <summary>
/// Returns the <see cref="CraftResourceInfo.Name" /> property of '<paramref name="resource" />' -or- an empty string if the /// Returns the <see cref="CraftResourceInfo.Name" /> property of '<paramref name="resource" />' -or- an empty string if the
/// resource specified was invalid. /// resource specified was invalid.