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); ```
This commit is contained in:
parent
bf20800382
commit
8ffd5a5bd0
58 changed files with 147 additions and 125 deletions
|
|
@ -114,9 +114,6 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public virtual Race RequiredRace =>
|
||||
null; // On OSI, there are no weapons with race requirements, this is for custom stuff
|
||||
|
||||
public virtual bool UseSkillMod => !Core.AOS;
|
||||
|
||||
public static bool InDoubleStrike { get; set; }
|
||||
|
|
@ -915,17 +912,8 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
if (RequiredRace != null && from.Race != RequiredRace)
|
||||
if (!CheckRace(from))
|
||||
{
|
||||
if (RequiredRace == Race.Elf)
|
||||
{
|
||||
from.SendLocalizedMessage(1072203); // Only Elves may use this.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("Only {0} may use this.", RequiredRace.PluralName);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2945,11 +2933,16 @@ namespace Server.Items
|
|||
list.Add(1060636); // exceptional
|
||||
}
|
||||
|
||||
if (RequiredRace == Race.Elf)
|
||||
if (RequiredRaces == Race.AllowElvesOnly)
|
||||
{
|
||||
list.Add(1075086); // Elves Only
|
||||
}
|
||||
|
||||
if (RequiredRaces == Race.AllowGargoylesOnly)
|
||||
{
|
||||
list.Add(1111709); // Gargoyles Only
|
||||
}
|
||||
|
||||
if (ArtifactRarity > 0)
|
||||
{
|
||||
list.Add(1061078, ArtifactRarity.ToString()); // artifact rarity ~1_val~
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue