/// <summary>
        /// the callback for the enumerate visible objects function
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="guid"></param>
        /// <returns></returns>
        public int EnumerateVisibleObjectsCallback(int filter, ulong guid)
        {
            if (guid == 0)
            {
                return(0);
            }
            var pointer = memory.GetPointerForGuidAsync(guid).GetAwaiter().GetResult();

            if (pointer == IntPtr.Zero)
            {
                return(0);
            }
            var type = memory.GetWoWObjectTypeAsync(pointer).GetAwaiter().GetResult();

            if (Objects.ContainsKey(guid))
            {
                Objects[guid].Pointer   = pointer;
                Objects[guid].CanRemove = false;
            }
            else
            {
                switch (type)
                {
                case WoWObjectType.OT_CONTAINER:
                    break;

                case WoWObjectType.OT_CORPSE:
                    break;

                case WoWObjectType.OT_GAMEOBJ:
                    Objects.Add(guid, new WoWGameObject(guid, pointer, type));
                    break;

                case WoWObjectType.OT_ITEM:
                    Objects.Add(guid, new WoWItem(guid, pointer, type));
                    break;

                case WoWObjectType.OT_NONE:
                    break;

                case WoWObjectType.OT_PLAYER:
                    Objects.Add(guid, new WoWUnit(guid, pointer, type));
                    break;

                case WoWObjectType.OT_UNIT:
                    Objects.Add(guid, new WoWUnit(guid, pointer, type));
                    var owner = pointer.Add(Offsets.ObjectManager.DescriptorOffset)
                                .PointsTo()
                                .Add(Offsets.Descriptors.SummonedByGuid)
                                .ReadAs <ulong>();
                    if (LocalPlayer != null && owner == LocalPlayer.Guid)
                    {
                        if (LocalPet != null && LocalPet.Pointer == pointer)
                        {
                            break;
                        }
                        LocalPet = new LocalPet(guid, pointer, type);
                    }
                    break;

                default:
                    break;
                }
            }
            return(1);
        }
        /// <summary>
        ///     The callback for EnumVisibleObjects
        /// </summary>
        private int Callback(int filter, ulong guid)
        {
            if (guid == 0)
            {
                return(0);
            }
            var ptr = Functions.GetPtrForGuid(guid);

            if (ptr == IntPtr.Zero)
            {
                return(0);
            }
            if (_objects.ContainsKey(guid))
            {
                _objects[guid].Pointer   = ptr;
                _objects[guid].CanRemove = false;
            }
            else
            {
                var objType =
                    (Enums.WoWObjectTypes)
                    Memory.Reader.Read <byte>(IntPtr.Add(ptr, (int)Offsets.ObjectManager.ObjType));
                switch (objType)
                {
                case Enums.WoWObjectTypes.OT_CONTAINER:
                case Enums.WoWObjectTypes.OT_ITEM:
                    var tmpItem = new WoWItem(guid, ptr, objType);

                    _objects.Add(guid, tmpItem);
                    break;

                case Enums.WoWObjectTypes.OT_UNIT:

                    var owner = ptr.Add(0x8)
                                .PointsTo()
                                .Add(Offsets.Descriptors.SummonedByGuid)
                                .ReadAs <ulong>();

                    if (Player != null && owner == Player.Guid)
                    {
                        if (Pet != null && Pet.Pointer == ptr)
                        {
                            break;
                        }
                        Pet = new LocalPet(guid, ptr, Enums.WoWObjectTypes.OT_UNIT);
                    }
                    else
                    {
                        var tmpUnit = new WoWUnit(guid, ptr, objType);
                        _objects.Add(guid, tmpUnit);
                    }
                    break;

                case Enums.WoWObjectTypes.OT_PLAYER:
                    var tmpPlayer = new WoWUnit(guid, ptr, objType);
                    _objects.Add(guid, tmpPlayer);
                    break;

                case Enums.WoWObjectTypes.OT_GAMEOBJ:
                    var tmpGameObject = new WoWGameObject(guid, ptr, objType);
                    _objects.Add(guid, tmpGameObject);
                    break;
                }
            }
            return(1);
        }