Example #1
0
        private static bool EntityGuidMaskHasEntry(EntityGuidMask guidMask)
        {
            if (!Enum.IsDefined(typeof(EntityGuidMask), guidMask))
            {
                throw new InvalidEnumArgumentException(nameof(guidMask), (int)guidMask, typeof(EntityGuidMask));
            }

            switch (guidMask)
            {
            case EntityGuidMask.Item:
            case EntityGuidMask.Player:
            case EntityGuidMask.DynamicObject:
            case EntityGuidMask.Corpse:
            case EntityGuidMask.Mo_Transport:
            case EntityGuidMask.Instance:
            case EntityGuidMask.Group:
                return(false);

            case EntityGuidMask.GameObject:
            case EntityGuidMask.Transport:
            case EntityGuidMask.Unit:
            case EntityGuidMask.Pet:
            case EntityGuidMask.Vehicle:
            default:
                return(true);
            }
        }
Example #2
0
        /// <summary>
        /// Converts the provided <see cref="EntityGuidMask"/> to <see cref="EntityTypeId"/>.
        /// </summary>
        /// <param name="mask">The mask value.</param>
        /// <returns></returns>
        public static EntityTypeId MaskToTypeId(EntityGuidMask mask)
        {
            switch (mask)
            {
            case EntityGuidMask.Item:
                return(EntityTypeId.TYPEID_ITEM);

            //case HighGuid::Container:    return TYPEID_CONTAINER; HighGuid::Container == HighGuid::Item currently
            case EntityGuidMask.Unit:
                return(EntityTypeId.TYPEID_UNIT);

            case EntityGuidMask.Pet:
                return(EntityTypeId.TYPEID_UNIT);

            case EntityGuidMask.Player:
                return(EntityTypeId.TYPEID_PLAYER);

            case EntityGuidMask.GameObject:
                return(EntityTypeId.TYPEID_GAMEOBJECT);

            case EntityGuidMask.DynamicObject:
                return(EntityTypeId.TYPEID_DYNAMICOBJECT);

            case EntityGuidMask.Corpse:
                return(EntityTypeId.TYPEID_CORPSE);

            case EntityGuidMask.Mo_Transport:
                return(EntityTypeId.TYPEID_GAMEOBJECT);

            case EntityGuidMask.Vehicle:
                return(EntityTypeId.TYPEID_UNIT);

            // unknown
            case EntityGuidMask.Instance:
            case EntityGuidMask.Group:
            default:
                return(EntityTypeId.TYPEID_OBJECT);
            }
        }
Example #3
0
 //TODO: Doc
 public bool HasAnyType(EntityGuidMask guidType)
 {
     return((guidType & ObjectType) != 0);
 }
Example #4
0
 //TODO: Doc
 public bool HasType(EntityGuidMask guidType)
 {
     return((guidType & ObjectType) == guidType);
 }
Example #5
0
 /// <summary>
 /// Indicates if the <see cref="BaseGuid"/> is associated with an Object Type <paramref name="guidType"/>.
 /// </summary>
 /// <param name="guidType">Type of GUID.</param>
 /// <returns>True if <see cref="ObjectType"/> is the same as <paramref name="guidType"/>.</returns>
 public bool isType(EntityGuidMask guidType)
 {
     return(guidType == ObjectType);
 }