Esempio n. 1
0
        private AetheryteLocation GetClosestAetheryte()
        {
            var aetherytes = AetheryteDataManager.GetAetheryteLocationsByTerritoryId(TerritoryId, _plugin.Language);

            if (aetherytes.Count <= 0)
            {
                return(null);
            }
            return(aetherytes.Aggregate((curMin, x) => curMin == null || x.Distance2D(Location) < curMin.Distance2D(Location) ? x : curMin));
        }
        private void UpdateAetheryteList()
        {
            if (DateTime.UtcNow.Subtract(_lastAetheryteListUpdate).TotalMilliseconds < 5000)
            {
                return;
            }
            var list    = Plugin.Manager.AetheryteList.ToList();
            var mapList = new HashSet <string>();

            foreach (var location in list)
            {
                var locF = AetheryteDataManager.GetAetheryteLocationsByTerritoryId(location.ZoneId, Plugin.Language).FirstOrDefault();
                if (locF == null)
                {
                    continue;
                }
                mapList.Add(locF.TerritoryName);
            }
            _mapList                 = mapList.ToArray();
            _aetheryteList           = list.Select(a => a.Name).ToArray();
            _lastAetheryteListUpdate = DateTime.UtcNow;
        }