Esempio n. 1
0
        public void UpdateGems(int greaterRiftLevel, bool prioritizeEquipedGems)
        {
            var gemsInInventory = new List <AdventurerGem>();
            var result          = SafeFrameLock.ExecuteWithinFrameLock(() =>
            {
                if (!ZetaDia.IsInGame || ZetaDia.Me == null || !ZetaDia.Me.IsValid)
                {
                    return;
                }
                gemsInInventory = ZetaDia.Actors.GetActorsOfType <ACDItem>()
                                  .Where(i => i.IsValid && i.ItemType == ItemType.LegendaryGem)
                                  .Select(i => new AdventurerGem(i, greaterRiftLevel))
                                  .Distinct(new AdventurerGemComparer())
                                  .OrderByDescending(i => i.Rank)
                                  .ToList();
            }, true);

            if (!result.Success)
            {
                Logger.Debug("[UpdateGems] " + result.Exception.Message);
                return;
            }

            if (gemsInInventory.Count == 0)
            {
                return;
            }
            if (Gems == null)
            {
                Gems = gemsInInventory;
            }
            else
            {
                var updatedList = new List <AdventurerGem>();
                foreach (var gem in Gems)
                {
                    var inventoryGem = GetMatchingInventoryGem(gem, gemsInInventory);
                    if (inventoryGem != null)
                    {
                        updatedList.Add(inventoryGem);
                        gemsInInventory.Remove(inventoryGem);
                    }
                }
                updatedList.AddRange(gemsInInventory);

                Gems = updatedList;
            }

            Gems = Gems.OrderBy(i => i.MaxRank ? 1 : 0).ToList();
            if (prioritizeEquipedGems)
            {
                Gems = Gems.OrderByDescending(i => i.IsEquiped ? 1 : 0).ToList();
            }
        }
Esempio n. 2
0
        private static void InternalTimerTick(object sender, EventArgs e)
        {
            try
            {
                if (_radarWindow == null)
                {
                    return;
                }

                if (!DataModel.Enabled && DataModel.IsLazyCacheVisible)
                {
                    return;
                }
                //Update();

                if (BotEvents.IsBotRunning)
                {
                    Update();
                }
                else
                {
                    //AdvDia.Update();
                    SafeFrameLock.ExecuteWithinFrameLock(() =>
                    {
                        ScenesStorage.Update();
                        Update();
                    }, true);
                }
                var userControl = _radarWindow.Content as UserControl;
                if (userControl == null)
                {
                    return;
                }

                var canvas = userControl.Content as RadarCanvas.RadarCanvas;
                if (canvas != null)
                {
                    canvas.UpdateData();
                }
            }
            catch (Exception ex)
            {
                if (!ex.Message.Contains("ReadProcessMemory"))
                {
                    Logger.Debug("Exception in CacheUI.InternalTimerTick(). {0} {1} {2}", ex.Message, ex.InnerException,
                                 ex);
                }
            }
        }