Ejemplo n.º 1
0
        private static void Pulse()
        {
            var objectManager  = _reader.ReadUInt((uint)Offsets.WowObjectManager.BASE);
            var currentObject  = _reader.ReadUInt(objectManager + (uint)Offsets.WowObjectManager.FIRST_OBJECT);
            var activeGuidList = new List <ulong>();

            while (currentObject != 0 && (currentObject & 1) == 0)
            {
                var objectType = _reader.ReadByte(currentObject + (uint)Offsets.WowObject.OBJECT_FIELD_TYPE);
                switch (objectType)
                {
                case (byte)ObjectType.Unit:
                {
                    var unit = new WowUnit(_reader, currentObject);
                    _objects.GetOrAdd(unit.Guid, unit);
                    activeGuidList.Add(unit.Guid);
                    break;
                }

                case (byte)ObjectType.Player:
                {
                    var player = new WowPlayer(_process, _reader, currentObject);
                    _objects.GetOrAdd(player.Guid, player);
                    activeGuidList.Add(player.Guid);
                    break;
                }

                case (byte)ObjectType.Item:
                {
                    break;
                }

                case (byte)ObjectType.GameObject:
                {
                    var obj = new WowGameObject(_reader, currentObject);
                    _objects.GetOrAdd(obj.Guid, obj);
                    activeGuidList.Add(obj.Guid);
                    break;
                }
                }

                var nextObject = _reader.ReadUInt(currentObject + (uint)Offsets.WowObjectManager.NEXT_OBJECT);

                if (nextObject == currentObject)
                {
                    break;
                }

                currentObject = nextObject;
            }

            var deadGuids = _objects.Keys.Where(k => !activeGuidList.Contains(k)).Select(k => k);

            foreach (var guid in deadGuids)
            {
                IWowObject deadObject;
                _objects.TryRemove(guid, out deadObject);
            }
        }
Ejemplo n.º 2
0
 public WowObject(ProcessMemoryReader reader, uint objectBaseAddress)
 {
     _reader           = reader;
     BaseAddress       = objectBaseAddress;
     UnitFieldsAddress = _reader.ReadUInt(BaseAddress + (uint)Offsets.WowObjectManager.DESCRIPTOR);
 }