fix: Removes BodyValue and fixes modifying Body and BodyMod in props gump. (#743)

* Removes BodyValue
* Removes BodyPicker gump
* Fixes setting Body and BodyMod in props gump
* Props will now look for an `implicit cast` in order to find a way to allow you to modify values with the props gump.
* Fixed `[self set body 0x190` so it works too.
This commit is contained in:
Kamron Batman 2021-08-28 22:56:00 -07:00 committed by GitHub
parent 244fc6a136
commit bf20800382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 175 additions and 1477 deletions

View file

@ -9,11 +9,6 @@ namespace Server
{
}
[AttributeUsage(AttributeTargets.Property)]
public class BodyAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
public class PropertyObjectAttribute : Attribute
{

View file

@ -1051,6 +1051,11 @@ namespace Server
}
}
public void MoveToWorld(WorldLocation worldLocation)
{
MoveToWorld(worldLocation.Location, worldLocation.Map);
}
/// <summary>
/// Moves the Item to a given <paramref name="location" /> and <paramref name="map" />.
/// </summary>
@ -2306,18 +2311,12 @@ namespace Server
doubled = false;
if (m_Amount <= 1)
itemID = m_Amount switch
{
itemID = coinBase;
}
else if (m_Amount <= 5)
{
itemID = coinBase + 1;
}
else // m_Amount > 5
{
itemID = coinBase + 2;
}
<= 1 => coinBase,
<= 5 => coinBase + 1,
_ => coinBase + 2
};
}
var bounds = ItemBounds.Table[itemID & 0x3FFF];

View file

@ -14,7 +14,8 @@ namespace Server
Equipment
}
public readonly struct Body : IEquatable<object>, IEquatable<Body>, IEquatable<int>
[Parsable]
public readonly struct Body : IEquatable<object>, IEquatable<Body>, IEquatable<int>, IComparable<int>, IComparable<Body>
{
private static readonly BodyType[] m_Types = Array.Empty<BodyType>();
@ -70,38 +71,13 @@ namespace Server
&& BodyID != 695
&& BodyID != 970;
public bool IsGargoyle => BodyID == 666
|| BodyID == 667
|| BodyID == 694
|| BodyID == 695;
public bool IsGargoyle => BodyID is 666 or 667 or 694 or 695;
public bool IsMale => BodyID == 183
|| BodyID == 185
|| BodyID == 400
|| BodyID == 402
|| BodyID == 605
|| BodyID == 607
|| BodyID == 666
|| BodyID == 694
|| BodyID == 750;
public bool IsMale => BodyID is 183 or 185 or 400 or 402 or 605 or 607 or 666 or 694 or 750;
public bool IsFemale => BodyID == 184
|| BodyID == 186
|| BodyID == 401
|| BodyID == 403
|| BodyID == 606
|| BodyID == 608
|| BodyID == 667
|| BodyID == 695
|| BodyID == 751;
public bool IsFemale => BodyID is 184 or 186 or 401 or 403 or 606 or 608 or 667 or 695 or 751;
public bool IsGhost => BodyID == 402
|| BodyID == 403
|| BodyID == 607
|| BodyID == 608
|| BodyID == 694
|| BodyID == 695
|| BodyID == 970;
public bool IsGhost => BodyID is 402 or 403 or 607 or 608 or 694 or 695 or 970;
public bool IsMonster => BodyID >= 0
&& BodyID < m_Types.Length
@ -151,5 +127,11 @@ namespace Server
public static bool operator <(Body l, Body r) => l.BodyID < r.BodyID;
public static bool operator <=(Body l, Body r) => l.BodyID <= r.BodyID;
public int CompareTo(Body other) => BodyID.CompareTo(other.BodyID);
public int CompareTo(int other) => BodyID.CompareTo(other);
public static Body Parse(string value) => Utility.ToInt32(value);
}
}

View file

@ -1702,7 +1702,6 @@ namespace Server
}
}
[Body]
[CommandProperty(AccessLevel.GameMaster)]
public Body Body
{
@ -1721,14 +1720,6 @@ namespace Server
}
}
[Body]
[CommandProperty(AccessLevel.GameMaster)]
public int BodyValue
{
get => Body.BodyID;
set => Body = value;
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
public Point3D LogoutLocation { get; set; }

View file

@ -119,7 +119,7 @@ namespace Server.Network
else if (entity is Mobile mobile)
{
type = 1;
gfx = mobile.BodyValue;
gfx = mobile.Body;
hue = mobile.Hue;
flags = mobile.GetPacketFlags(true);
}