Exemplo n.º 1
0
 protected override void OnEntityAdded(EntityWrapper entity)
 {
     if (Settings.Enable && entity != null && !GameController.Area.CurrentArea.IsTown &&
         !currentAlerts.ContainsKey(entity) && entity.HasComponent <WorldItem>())
     {
         IEntity item = entity.GetComponent <WorldItem>().ItemEntity;
         if (Settings.Alternative && !string.IsNullOrEmpty(Settings.FilePath))
         {
             var result = visitor.Visit(item);
             if (result != null)
             {
                 AlertDrawStyle drawStyle = result;
                 PrepareForDrawingAndPlaySound(entity, drawStyle);
             }
         }
         else
         {
             ItemUsefulProperties props = initItem(item);
             if (props == null)
             {
                 return;
             }
             if (props.ShouldAlert(currencyNames, Settings))
             {
                 AlertDrawStyle drawStyle = props.GetDrawStyle();
                 PrepareForDrawingAndPlaySound(entity, drawStyle);
             }
             Settings.Alternative.Value = false;
         }
     }
 }
Exemplo n.º 2
0
        protected override void OnEntityAdded(EntityWrapper entity)
        {
            if (!Settings.Enable || currentAlerts.ContainsKey(entity))
            {
                return;
            }
            if (entity.HasComponent <WorldItem>())
            {
                IEntity item = entity.GetComponent <WorldItem>().ItemEntity;
                ItemUsefulProperties props = EvaluateItem(item);

                if (props.IsWorthAlertingPlayer(currencyNames, Settings))
                {
                    AlertDrawStyle drawStyle = props.GetDrawStyle();
                    currentAlerts.Add(entity, drawStyle);
                    CurrentIcons[entity] = new MapIcon(entity, new HudTexture("minimap_default_icon.png", drawStyle.Color),
                                                       () => Settings.ShowItemOnMap, 8);

                    if (Settings.PlaySound && !playedSoundsCache.Contains(entity.LongId))
                    {
                        playedSoundsCache.Add(entity.LongId);
                        Sounds.AlertSound.Play();
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void EntityAdded(EntityWrapper entity)
        {
            if (!Settings.Enabled || currentAlerts.ContainsKey(entity))
            {
                return;
            }
            if (!entity.HasComponent <WorldItem>())
            {
                return;
            }

            EntityWrapper        item  = new EntityWrapper(model, entity.GetComponent <WorldItem>().ItemEntity);
            ItemUsefulProperties props = EvaluateItem(item);

            if (!props.IsWorthAlertingPlayer(Settings, currencyNames))
            {
                return;
            }

            AlertDrawStyle drawStyle = props.GetDrawStyle();

            currentAlerts.Add(entity, drawStyle);
            drawStyle.IconForMap = new MapIcon(entity, new HudTexture("minimap_default_icon.png", drawStyle.color), 8)
            {
                Type = MapIcon.IconType.Item
            };

            if (Settings.PlaySound && drawStyle.soundToPlay != null && !playedSoundsCache.Contains(entity.LongId))
            {
                playedSoundsCache.Add(entity.LongId);
                drawStyle.soundToPlay.Play();
            }
        }
Exemplo n.º 4
0
        private void DoAlert(ExileBot.Entity entity, ItemUsefulProperties ip)
        {
            AlertDrawStyle drawStyle = ip.GetDrawStyle();

            this.currentAlerts.Add(entity, drawStyle);
            this.overlay.MinimapRenderer.AddIcon(new ItemMinimapIcon(entity, "minimap_default_icon.png", drawStyle.color, 8));
            if (Settings.GetBool("ItemAlert.PlaySound") && !this.playedSoundsCache.Contains(entity.LongId))
            {
                this.playedSoundsCache.Add(entity.LongId);
                Sounds.AlertSound.Play();
            }
        }
Exemplo n.º 5
0
        protected override void OnEntityAdded(EntityWrapper entity)
        {
            if (Settings.Enable && entity != null && !GameController.Area.CurrentArea.IsTown && !currentAlerts.ContainsKey(entity) && entity.HasComponent <WorldItem>())
            {
                IEntity item = entity.GetComponent <WorldItem>().ItemEntity;
                ItemUsefulProperties props = initItem(item);

                if (props.ShouldAlert(currencyNames, Settings))
                {
                    AlertDrawStyle drawStyle = props.GetDrawStyle();
                    currentAlerts.TryAdd(entity, drawStyle);
                    CurrentIcons[entity] = new MapIcon(entity, new HudTexture("minimap_default_icon.png", drawStyle.AlertColor), () => Settings.ShowItemOnMap, 8);

                    if (Settings.PlaySound && !playedSoundsCache.Contains(entity.LongId))
                    {
                        playedSoundsCache.Add(entity.LongId);
                        Sounds.AlertSound.Play();
                    }
                }
            }
        }
Exemplo n.º 6
0
 private void DoAlert(ExileBot.Entity entity, ItemUsefulProperties ip)
 {
     AlertDrawStyle drawStyle = ip.GetDrawStyle();
     this.currentAlerts.Add(entity, drawStyle);
     this.overlay.MinimapRenderer.AddIcon(new ItemMinimapIcon(entity, "minimap_default_icon.png", drawStyle.color, 8));
     if (Settings.GetBool("ItemAlert.PlaySound") && !this.playedSoundsCache.Contains(entity.LongId))
     {
         this.playedSoundsCache.Add(entity.LongId);
         Sounds.AlertSound.Play();
     }
 }