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); } }
/// <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); } }
//TODO: Doc public bool HasAnyType(EntityGuidMask guidType) { return((guidType & ObjectType) != 0); }
//TODO: Doc public bool HasType(EntityGuidMask guidType) { return((guidType & ObjectType) == guidType); }
/// <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); }