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:
parent
244fc6a136
commit
bf20800382
33 changed files with 175 additions and 1477 deletions
|
|
@ -471,13 +471,32 @@ namespace Server.Gumps
|
|||
private static bool HasAttribute(Type type, Type check, bool inherit) =>
|
||||
type.GetCustomAttributes(check, inherit).Length > 0;
|
||||
|
||||
private static bool HasImplicitCastTo(Type type, Type check)
|
||||
{
|
||||
foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static))
|
||||
{
|
||||
if (method.Name != "op_Implicit" || !IsType(method.ReturnType, check))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
if (parameters.Length == 1 && IsType(parameters[0].ParameterType, type))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsType(Type type, Type check) => type == check || type.IsSubclassOf(check);
|
||||
|
||||
private static bool IsType(Type type, Type[] check)
|
||||
{
|
||||
for (var i = 0; i < check.Length; ++i)
|
||||
{
|
||||
if (IsType(type, check[i]))
|
||||
if (IsType(type, check[i]) || HasImplicitCastTo(type, check[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue