fix(cleanup): Consolidate the duplicate code in Properties, PropsGump, and PropsConfig (#540)

This commit is contained in:
Kamron Batman 2021-04-14 22:58:56 -07:00 committed by GitHub
parent 98ce65083a
commit dd2933a9ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 335 additions and 761 deletions

View file

@ -1,13 +1,12 @@
using System;
using System.Collections.Generic;
using static Server.Types;
namespace Server.Commands.Generic
{
public sealed class ObjectConditional
{
private static readonly Type typeofItem = typeof(Item);
private static readonly Type typeofMobile = typeof(Mobile);
public static readonly ObjectConditional Empty = new(null, null);
private readonly ICondition[][] m_Conditions;
@ -22,9 +21,9 @@ namespace Server.Commands.Generic
public Type Type { get; }
public bool IsItem => Type == null || Type == typeofItem || Type.IsSubclassOf(typeofItem);
public bool IsItem => Type == null || Type.IsAssignableTo(OfItem);
public bool IsMobile => Type == null || Type == typeofMobile || Type.IsSubclassOf(typeofMobile);
public bool IsMobile => Type == null || Type.IsAssignableTo(OfMobile);
public bool HasCompiled => m_Conditionals != null;