Exemplo n.º 1
0
        public static EnhancedUseWaypointTag ToEnhanced(this UseWaypointTag tag)
        {
            var asyncVersion = new EnhancedUseWaypointTag();

            tag.CopyTo(asyncVersion);
            asyncVersion.X = tag.X;
            asyncVersion.Y = tag.Y;
            asyncVersion.Z = tag.Z;
            asyncVersion.WaypointNumber = tag.WaypointNumber;
            return(asyncVersion);
        }
Exemplo n.º 2
0
        internal static CacheObject GetInteractiveCachedObject(ProfileBehavior tag)
        {
            Type TagType = tag.GetType();

            if (InteractiveTags.Contains(TagType))
            {
                if (TagType == typeof(UseWaypointTag))
                {
                    UseWaypointTag tagWP           = (UseWaypointTag)tag;
                    var            WaypointObjects = Bot.Game.Profile.InteractableObjectCache.Values.Where(obj => obj.SNOID == 6442);
                    foreach (CacheObject item in WaypointObjects)
                    {
                        if (item.Position.Distance(tagWP.Position) < 100f)
                        {
                            //Found matching waypoint object!
                            return(item);
                        }
                    }
                }
                else if (TagType == typeof(UseObjectTag))
                {
                    UseObjectTag tagUseObj = (UseObjectTag)tag;
                    if (tagUseObj.ActorId > 0)
                    {                    //Using SNOID..
                        var Objects = Bot.Game.Profile.InteractableObjectCache.Values.Where(obj => obj.SNOID == tagUseObj.ActorId);
                        foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(Bot.Character.Data.Position)))
                        {
                            //Found matching object!
                            return(item);
                        }
                    }
                    else
                    {                    //use position to match object
                        Vector3 tagPosition = tagUseObj.Position;
                        var     Objects     = Bot.Game.Profile.InteractableObjectCache.Values.Where(obj => obj.Position.Distance(tagPosition) <= 100f);
                        foreach (CacheObject item in Objects)
                        {
                            //Found matching object!
                            return(item);
                        }
                    }
                }
                else if (TagType == typeof(UsePortalTag))
                {
                    UsePortalTag tagUsePortal = (UsePortalTag)tag;
                    if (tagUsePortal.ActorId > 0)
                    {                    //Using SNOID..
                        var Objects = Bot.Game.Profile.InteractableObjectCache.Values.Where(obj => obj.SNOID == tagUsePortal.ActorId);
                        foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(Bot.Character.Data.Position)))
                        {
                            //Found matching object!
                            return(item);
                        }
                    }
                    else
                    {                    //use position to match object
                        Vector3 tagPosition = tagUsePortal.Position;
                        var     Objects     = Bot.Game.Profile.InteractableObjectCache.Values.Where(obj => obj.Position.Distance(tagPosition) <= 100f);
                        foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(Bot.Character.Data.Position)))
                        {
                            //Found matching object!
                            return(item);
                        }
                    }
                }
            }

            return(null);
        }
Exemplo n.º 3
0
        internal CacheObject GetInteractiveCachedObject(Profile.ProfileBehaviorTypes type)
        {
            if (type == Profile.ProfileBehaviorTypes.UseWaypoint)
            {
                UseWaypointTag tagWP           = (UseWaypointTag)FunkyGame.Profile.CurrentProfileBehavior;
                var            WaypointObjects = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.SNOID == 6442);
                foreach (CacheObject item in WaypointObjects)
                {
                    if (item.Position.Distance(tagWP.Position) < 100f)
                    {
                        //Found matching waypoint object!
                        return(item);
                    }
                }
            }
            else if (type == Profile.ProfileBehaviorTypes.UseObject)
            {
                UseObjectTag tagUseObj = (UseObjectTag)FunkyGame.Profile.CurrentProfileBehavior;
                if (tagUseObj.ActorId > 0)
                {                //Using SNOID..
                    var Objects = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.SNOID == tagUseObj.ActorId);
                    foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(FunkyGame.Hero.Position)))
                    {
                        //Found matching object!
                        return(item);
                    }
                }
                else
                {                //use position to match object
                    Vector3 tagPosition = tagUseObj.Position;
                    var     Objects     = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.Position.Distance(tagPosition) <= 100f);
                    foreach (CacheObject item in Objects)
                    {
                        //Found matching object!
                        return(item);
                    }
                }
            }
            else if (type == Profile.ProfileBehaviorTypes.UsePortal)
            {
                UsePortalTag tagUsePortal = (UsePortalTag)FunkyGame.Profile.CurrentProfileBehavior;
                if (tagUsePortal.ActorId > 0)
                {                //Using SNOID..
                    var Objects = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.SNOID == tagUsePortal.ActorId);
                    foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(FunkyGame.Hero.Position)))
                    {
                        //Found matching object!
                        return(item);
                    }
                }
                else
                {                //use position to match object
                    Vector3 tagPosition = tagUsePortal.Position;
                    var     Objects     = ObjectCache.InteractableObjectCache.Values.Where(obj => obj.Position.Distance(tagPosition) <= 100f);
                    foreach (CacheObject item in Objects.OrderBy(obj => obj.Position.Distance(FunkyGame.Hero.Position)))
                    {
                        //Found matching object!
                        return(item);
                    }
                }
            }


            return(null);
        }