ModernUO/Projects/UOContent/Items/Clothing/Waist.cs
Kamron Batman 8ffd5a5bd0
fix: Updates races to properly support gargoyle equipment. (#744)
* Adds `RaceFlag` to the `Race` object. This is `1 << RaceIndex`
* Replaces `RequiredRace`  with `RequiredRaces` for items.
* Adds convenience flags for `RequiredRaces`
  ```cs
  
  public const int AllowAllRaces = 0x7;      // Race.Human.RaceFlag | Race.Elf.RaceFlag | Race.Gargoyle.RaceFlag
  public const int AllowHumanOrElves = 0x3;  // Race.Human.RaceFlag | Race.Elf.RaceFlag
  public const int AllowElvesOnly = 0x2;     // Race.Elf.RaceFlag
  public const int AllowGargoylesOnly = 0x4; // Race.Gargoyle.RaceFlag
  ```
* Example usage on an item:
  ```cs
  public override int RequiredRaces => Race.AllowHumanOrElves;
  ```
* Adds Wood and Stone armor material types
* Updates Woodland armor to Wood
* Adds proper messaging for race restrictions
* Adds gargoyle only for object properties
* Adds `CheckRace` functions for validating if a race or mobile can use the item:
  ```cs
  bool CheckRace(Race race);
  bool CheckRace(Mobile from, bool message = true);
  ```
2021-08-29 00:43:55 -07:00

48 lines
1.3 KiB
C#

namespace Server.Items
{
[Serializable(0, false)]
public abstract partial class BaseWaist : BaseClothing
{
public BaseWaist(int itemID, int hue = 0) : base(itemID, Layer.Waist, hue)
{
}
}
[Flippable(0x153b, 0x153c)]
[Serializable(0, false)]
public partial class HalfApron : BaseWaist
{
[Constructible]
public HalfApron(int hue = 0) : base(0x153b, hue) => Weight = 2.0;
}
[Flippable(0x27A0, 0x27EB)]
[Serializable(0, false)]
public partial class Obi : BaseWaist
{
[Constructible]
public Obi(int hue = 0) : base(0x27A0, hue) => Weight = 1.0;
}
[Flippable(0x2B68, 0x315F)]
[Serializable(0)]
public partial class WoodlandBelt : BaseWaist
{
[Constructible]
public WoodlandBelt(int hue = 0) : base(0x2B68, hue) => Weight = 4.0;
public override int RequiredRaces => Race.AllowElvesOnly;
public override bool Dye(Mobile from, DyeTub sender)
{
from.SendLocalizedMessage(sender.FailMessage);
return false;
}
public override bool Scissor(Mobile from, Scissors scissors)
{
from.SendLocalizedMessage(502440); // Scissors can not be used on that to produce anything.
return false;
}
}
}