public static void AddObjectToEntryList(uint id, ObjectFlags flags) { if (flags.HasFlag(ObjectFlags.Combat)) { CombatIds.Add(id); } if (flags.HasFlag(ObjectFlags.Loot)) { LootIds.Add(id); } if (flags.HasFlag(ObjectFlags.Quest)) { QuestNpcIds.Add(id); } }
/// <summary> /// Create the binary from the buffer /// </summary> /// <param name="binary">The binary</param> /// <param name="offset">The offset in the binary</param> public override void GetBinaryForm(byte[] binary, int offset) { int len = Size; binary[offset++] = (byte)this.AceType; binary[offset++] = (byte)this.AceFlags; DtypUtility.WriteUInt16ToByteArray((ushort)len, binary, offset); offset += 2; DtypUtility.WriteInt32ToByteArray(_AccessMask, binary, offset); offset += 4; DtypUtility.WriteInt32ToByteArray((int)ObjectFlags, binary, offset); offset += 4; if (ObjectFlags.HasFlag(_ObjectAceFlags.ObjectAceTypePresent)) { DtypUtility.WriteGuid(ObjectType, binary, offset); offset += 16; } if (ObjectFlags.HasFlag(_ObjectAceFlags.InheritedObjectAceTypePresent)) { DtypUtility.WriteGuid(InheritedObjectType, binary, offset); offset += 16; } _SecurityIdentifier.GetBinaryForm(binary, offset); offset += _SecurityIdentifier.Size; if (this.applicationData != null) { Array.Copy(this.applicationData, 0, binary, offset, this.applicationData.Length); offset += this.applicationData.Length; } }
public override string GetSddlForm() { return(string.Format(CultureInfo.InvariantCulture, "({0};{1};{2};{3};{4};{5})", DtypUtility.ConvertAceTypeToSDDL(AceType), DtypUtility.ConvertAceFlagToSDDL(AceFlags), DtypUtility.ConvertAccessMaskToSDDL(_AccessMask), ObjectFlags.HasFlag(_ObjectAceFlags.ObjectAceTypePresent) ? objectType.ToString("D") : string.Empty, ObjectFlags.HasFlag(_ObjectAceFlags.InheritedObjectAceTypePresent) ? inheridObjectType.ToString("D") : string.Empty, identifier.GetSddlForm())); }
/// <summary> /// The constructor /// </summary> /// <param name="binary">The input binary</param> /// <param name="offset">The offset in the binary</param> public _ObjectAce(byte[] binary, int offset) : base(binary, offset) { int length = BitConverter.ToUInt16(binary, offset + 2); if (offset > binary.Length - length) { throw new ArgumentException(nameof(offset)); } _AccessMask = BitConverter.ToInt32(binary, offset + DtypUtility.ACE_HEADER_LENGTH); ObjectFlags = (_ObjectAceFlags)BitConverter.ToInt32(binary, offset + DtypUtility.SHORT_FIXED_ACE_LENGTH); int pointer = DtypUtility.ACE_HEADER_LENGTH + DtypUtility.SHORT_FIXED_ACE_LENGTH; if (ObjectFlags.HasFlag(_ObjectAceFlags.ObjectAceTypePresent)) { ObjectType = DtypUtility.ReadGuid(binary, offset + pointer); pointer += 16; } if (ObjectFlags.HasFlag(_ObjectAceFlags.InheritedObjectAceTypePresent)) { InheritedObjectType = DtypUtility.ReadGuid(binary, offset + pointer); pointer += 16; } _SecurityIdentifier = new _SID(binary, offset + pointer); pointer += _SecurityIdentifier.Size; int appDataLength = length - pointer; if (appDataLength > 0) { this.applicationData = new byte[appDataLength]; Array.Copy(binary, offset + pointer, this.applicationData, 0, appDataLength); } }