Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Poi"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="type">The type.</param>
 /// <param name="coord">The coord.</param>
 /// <param name="id">The identifier.</param>
 public Poi(string name, PoiType type, List<double> coord, int id)
 {
     Name = name;
     Type = type;
     Coordinate = new Coordinate<double>(coord[0], coord[1]);
     Id = id;
 }
Ejemplo n.º 2
0
    protected PoiSettings createPoiSettings(PoiType type, string path)
    {
        var ps = new PoiSettings();

        ps.Type   = type;
        ps.Sprite = SpriteRepository.GetSpriteFromSheet(path);
        return(ps);
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Poi"/> class.
 /// </summary>
 /// <param name="name">The name of the point of interest.</param>
 /// <param name="type">The type. <see cref="PoiType"/> </param>
 /// <param name="coord">The coordinates of this object.</param>
 /// <param name="id">The point of interest id.</param>
 /// <param name="chat_link">The link that can be used ingame.</param>
 public Poi(string name, PoiType type, List <double> coord, int id, string chat_link)
 {
     Name       = name;
     Type       = type;
     Coordinate = new Coordinate <double>(coord[0], coord[1]);
     Id         = id;
     ChatLink   = chat_link;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Poi"/> class.
 /// </summary>
 /// <param name="name">The name of the point of interest.</param>
 /// <param name="type">The type. <see cref="PoiType"/> </param>
 /// <param name="coord">The coordinates of this object.</param>
 /// <param name="id">The point of interest id.</param>
 /// <param name="chat_link">The link that can be used ingame.</param>
 public Poi(string name, PoiType type, List<double> coord, int id, string chat_link)
 {
     Name = name;
     Type = type;
     Coordinate = new Coordinate<double>(coord[0], coord[1]);
     Id = id;
     ChatLink = chat_link;
 }
Ejemplo n.º 5
0
    protected PoiSettings createPoiSettings(PoiType type, string path)
    {
        //if (AppState.Instance.Config.InitalView.Mapzen.Contains(type.ToString()))
        //    {
        var ps = new PoiSettings();

        ps.Type   = type;
        ps.Sprite = SpriteRepository.GetSpriteFromSheet(path);
        return(ps);
        //}
        //return null;
    }
Ejemplo n.º 6
0
        public static bool IsPoiMatch(WoWObject wowObject, PoiType poiType, NavType?navType = null)
        {
            if (!IsViable(wowObject))
            {
                return(false);
            }

            return((BotPoi.Current != null) &&
                   (BotPoi.Current.Guid == wowObject.Guid) &&
                   (BotPoi.Current.Type == poiType) &&
                   ((navType == null) || (BotPoi.Current.NavType == navType)));
        }
Ejemplo n.º 7
0
        public bool TryGetPointsOfInterest(WowMapId mapId, PoiType poiType, Vector3 position, float maxRadius, out IEnumerable <Vector3> nodes)
        {
            KeyValuePair <WowMapId, PoiType> KeyValuePair = new(mapId, poiType);

            if (PointsOfInterest.ContainsKey(mapId) &&
                PointsOfInterest[mapId].ContainsKey(poiType))
            {
                nodes = PointsOfInterest[mapId][poiType].Where(e => e.GetDistance(position) < maxRadius);
                return(nodes.Any());
            }

            nodes = null;
            return(false);
        }
Ejemplo n.º 8
0
        // 30May2013-04:52UTC chinajade
        public static void Target(WoWObject wowObject, bool doFace = false, PoiType poiType = PoiType.None)
        {
            if (!Query.IsViable(wowObject))
            {
                return;
            }

            if (doFace && !StyxWoW.Me.IsSafelyFacing(wowObject.Location))
            {
                StyxWoW.Me.SetFacing(wowObject.Location);
            }

            var wowUnit = wowObject as WoWUnit;

            if (!Query.IsViable(wowUnit))
            {
                return;
            }

            if (StyxWoW.Me.CurrentTargetGuid != wowUnit.Guid)
            {
                wowUnit.Target();
            }

            // Set POI as needed...
            if ((poiType != PoiType.None) && !Query.IsPoiMatch(wowObject, poiType))
            {
                // accept targets that are within targeting collection range.
                if (wowUnit.Distance < Targeting.CollectionRange)
                {
                    BotPoi.Current = new BotPoi(wowUnit, poiType, QuestOrder.Instance.NavType);
                }

                else
                {
                    //QBCLog.DeveloperInfo("Unable to set POI({0}, {1})--unit is beyond PullDistance({2:F1}) (saw: {3:F1}).",
                    //  poiType, wowUnit.SafeName, CharacterSettings.Instance.PullDistance, wowUnit.Distance);
                }
            }
        }
Ejemplo n.º 9
0
 public void CachePoi(WowMapId mapId, PoiType poiType, Vector3 position)
 {
     if (!PointsOfInterest.ContainsKey(mapId))
     {
         PointsOfInterest.TryAdd(mapId, new Dictionary <PoiType, List <Vector3> >()
         {
             { poiType, new List <Vector3>()
               {
                   position
               } }
         });
     }
     else if (!PointsOfInterest[mapId].ContainsKey(poiType))
     {
         PointsOfInterest[mapId].Add(poiType, new List <Vector3>()
         {
             position
         });
     }
     else if (!PointsOfInterest[mapId][poiType].Any(e => e == position))
     {
         PointsOfInterest[mapId][poiType].Add(position);
     }
 }
Ejemplo n.º 10
0
        public async Task <bool> Run()
        {
            bool supportsCapabilities = RoutineManager.Current.SupportedCapabilities != CapabilityFlags.None;

            if (AvoidanceManager.IsRunningOutOfAvoid && Core.Me.IsCasting)
            {
                ActionManager.StopCasting();
                return(true);
            }

            if (AvoidanceManager.IsRunningOutOfAvoid && !supportsCapabilities)
            {
                return(true);
            }

            PoiType poiType = Poi.Current.Type;

            /* if (!Core.Me.InCombat)
             *   Poi.Clear("Clearing in SIDESTEP: " + poiType);
             */
            // taken from HB
            // Special case: Bot will do a lot of fast stop n go when avoiding a mob that moves slowly and trying to
            // do something near the mob. To fix, a delay is added to slow down the 'Stop n go' behavior
            //            if (poiType == PoiType.Collect || poiType == PoiType.Gather || poiType == PoiType.Hotspot)
            //                if (Core.Me.InCombat && AvoidanceManager.Avoids.Any(o => o.IsPointInAvoid(Poi.Current.Location)))
            //                {
            //                    TreeRoot.StatusText = "Waiting for 'avoid' to move before attempting to interact " +
            //                                          Poi.Current.Name;
            //                    var randomWaitTime = new Random().Next(200, 1000);
            //                    await Coroutine.Wait(randomWaitTime,
            //                        () => Core.Me.InCombat ||
            //                              !AvoidanceManager.Avoids.Any(o => o.IsPointInAvoid(Poi.Current.Location)));
            //                }

            return(false);
        }
Ejemplo n.º 11
0
 public PoiListModel(RouteJunction junction, IEnumerable <PoiOnJunction> pois, PoiType poiTypeToShow, string routeId)
 {
     this.Pois          = pois;
     this.RouteJunction = junction;
     this.PoiTypeToShow = poiTypeToShow;
     this.RouteId       = routeId;
 }
Ejemplo n.º 12
0
        public PoiType SavePOIType(PoiType type)
        {
            _poiTypesRepository.SaveOrUpdate(type);

            return(type);
        }
Ejemplo n.º 13
0
        public PoiGroupModel(string routePathId, RouteJunction routeJunction, PoiOnJunction[] pois, string poiGroupType, PoiType poiType, Location fromLocation, Location toLocation)
        {
            this.FromLocation  = fromLocation;
            this.ToLocation    = toLocation;
            this.RouteJunction = routeJunction;
            this.Pois          = pois;
            this.PoiGroupType  = poiGroupType;
            this.RoutePathId   = routePathId;
            this.PoiType       = poiType;

            if (Pois.Length > 0)
            {
                this.ClosestPoi = pois.OrderBy(p => p.DistanceFromJunction).First();
            }
        }
Ejemplo n.º 14
0
 public PoI()
 {
     Type = new PoiType();
     Description = string.Empty;
 }
Ejemplo n.º 15
0
 public async Task <PoiType> SavePOITypeAsync(PoiType type, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await _poiTypesRepository.SaveOrUpdateAsync(type, cancellationToken));
 }
Ejemplo n.º 16
0
 public PoiSettings()
 {
     Type = PoiType.Unknown;
 }
Ejemplo n.º 17
0
        public ActionResult PoiGroup(string id, string exitId, string poiTypeString)
        {
            long          osmId;
            RouteJunction routeJunction = null;

            StopByStop.Route route = GetRouteFromRoutePathId(id);

            if (route != null)
            {
                routeJunction = GetJunctionFromExitId(exitId, out osmId);
            }

            if (routeJunction == null)
            {
                if (route != null)
                {
                    routeJunction = route.RouteSegments
                                    .SelectMany(rs => rs.RouteJunctions)
                                    .SingleOrDefault(rj => rj.Junction.SBSID.Equals(exitId, StringComparison.OrdinalIgnoreCase));

                    if (routeJunction != null)
                    {
                        telemetryClient.TrackEvent("PoiGroupToOSMFormatRedirect");
                        string requestFullUrl = HttpContext.Request.Url.ToString();
                        string redirectUrl    = requestFullUrl
                                                .Substring(0, requestFullUrl.IndexOf("route")) +
                                                string.Format("route/{0}/exit/osm-{1}/{2}", id, routeJunction.Junction.OSMID, poiTypeString);

                        return(RedirectPermanent(redirectUrl));
                    }
                }
                else
                {
                    telemetryClient.TrackEvent("RouteNotFound",
                                               new Dictionary <string, string>()
                    {
                        { "MissingRoute", id }
                    });
                    telemetryClient.TrackException(
                        new InvalidOperationException(string.Format("PoiGroup Action - Cannot find route. id={0}, exitId={1}", id, exitId)));

                    return(RedirectToAction("Index", "Home"));
                }
            }


            PoiType poiType = PoiType.General;
            var     model   = new MainModel(this.Url)
            {
                Page    = ClientPage.Route,
                RouteId = id,
                Route   = route,
                ExitId  = exitId,
            };

            if (routeJunction != null)
            {
                switch (poiTypeString.ToLowerInvariant())
                {
                case "gas":
                    poiType = PoiType.Gas;
                    break;

                case "food":
                    poiType = PoiType.Food;
                    break;
                }

                model.Page    = ClientPage.Exit;
                model.ExitId  = exitId;
                model.PoiType = poiType;
            }
            else
            {
                if (route != null)
                {
                    telemetryClient.TrackEvent("ExitNotFound",
                                               new Dictionary <string, string>()
                    {
                        { "MissingExit", id + "/" + exitId }
                    });
                    telemetryClient.TrackException(
                        new InvalidOperationException(string.Format("PoiGroup Action - Cannot find exit. id={0}, exitId={1}", id, exitId)));
                    model.Page = ClientPage.Route;
                }
                else
                {
                    telemetryClient.TrackEvent("RouteNotFound",
                                               new Dictionary <string, string>()
                    {
                        { "MissingRoute", id }
                    });
                    telemetryClient.TrackException(
                        new InvalidOperationException(string.Format("PoiGroup Action - Cannot find route. id={0}, exitId={1}", id, exitId)));
                    model.Page = ClientPage.Home;
                }
            }

            return(View("~/client/Views/Main.cshtml", new MainModel(this.Url)
            {
                Page = ClientPage.Exit,
                RouteId = id,
                Route = route,
                ExitId = exitId,
                PoiType = poiType
            }));
        }
Ejemplo n.º 18
0
 public PoI(PoiType type, string description = "")
 {
     Type = type;
     Description = description;
 }
Ejemplo n.º 19
0
 public Ping(PoiType poiType, Location location)
 {
     _poiType  = poiType;
     _location = location;
 }