Beispiel #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;
         }
     }
 }
        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();
                    }
                }
            }
        }
Beispiel #3
0
        private ItemUsefulProperties EvaluateItem(EntityWrapper item)
        {
            ItemUsefulProperties ip = new ItemUsefulProperties();

            Mods    mods  = item.GetComponent <Mods>();
            Sockets socks = item.GetComponent <Sockets>();
            Map     map   = item.HasComponent <Map>() ? item.GetComponent <Map>() : null;
            Quality q     = item.HasComponent <Quality>() ? item.GetComponent <Quality>() : null;

            ip.Name        = model.Files.BaseItemTypes.Translate(item.Path);
            ip.ItemLevel   = mods.ItemLevel;
            ip.NumLinks    = socks.LargestLinkSize;
            ip.NumSockets  = socks.NumberOfSockets;
            ip.Rarity      = mods.ItemRarity;
            ip.MapLevel    = map == null ? 0 : 1;
            ip.IsCurrency  = item.Path.Contains("Currency");
            ip.IsSkillGem  = item.HasComponent <SkillGem>();
            ip.IsFlask     = item.HasComponent <Flask>();
            ip.Quality     = q == null ? 0 : q.ItemQuality;
            ip.WorthChrome = socks != null && socks.IsRGB;

            ip.IsVaalFragment = item.Path.Contains("VaalFragment");

            CraftingBase craftingBase;

            if (craftingBases.TryGetValue(ip.Name, out craftingBase) && Settings.AlertOfCraftingBases)
            {
                ip.IsCraftingBase = ip.ItemLevel >= craftingBase.MinItemLevel &&
                                    ip.Quality >= craftingBase.MinQuality &&
                                    (craftingBase.Rarities == null || craftingBase.Rarities.Contains(ip.Rarity));
            }

            return(ip);
        }
Beispiel #4
0
        private ItemUsefulProperties EvaluateItem(ExileBot.Entity item)
        {
            ItemUsefulProperties ip = new ItemUsefulProperties();

            Mods     mods  = item.GetComponent <Mods>();
            Sockets  socks = item.GetComponent <Sockets>();
            Map      map   = item.HasComponent <Map>() ? item.GetComponent <Map>() : null;
            SkillGem sk    = item.HasComponent <SkillGem>() ? item.GetComponent <SkillGem>() : null;
            Quality  q     = item.HasComponent <Quality>() ? item.GetComponent <Quality>() : null;

            ip.Name        = this.poe.Files.BaseItemTypes.Translate(item.Path);
            ip.ItemLevel   = mods.ItemLevel;
            ip.NumLinks    = socks.LargestLinkSize;
            ip.NumSockets  = socks.NumberOfSockets;
            ip.Rarity      = mods.ItemRarity;
            ip.MapLevel    = map == null ? 0 : 1;
            ip.IsCurrency  = item.Path.Contains("Currency");
            ip.IsSkillGem  = sk != null;
            ip.Quality     = q == null ? 0 : q.ItemQuality;
            ip.WorthChrome = socks != null && socks.IsRGB;

            CraftingBase craftingBase;

            if (craftingBases.TryGetValue(ip.Name, out craftingBase) && Settings.GetBool("ItemAlert.Crafting"))
            {
                ip.IsCraftingBase = ip.ItemLevel >= craftingBase.MinItemLevel && ip.Quality >= craftingBase.MinQuality;
            }

            return(ip);
        }
Beispiel #5
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();
            }
        }
        private ItemUsefulProperties EvaluateItem(IEntity item)
        {
            string       name             = GameController.Files.BaseItemTypes.Translate(item.Path);
            var          usefulProperties = new ItemUsefulProperties(name, item);
            CraftingBase craftingBase;

            if (craftingBases.TryGetValue(usefulProperties.Name, out craftingBase) && Settings.Crafting)
            {
                usefulProperties.SetCraftingBase(craftingBase);
            }
            return(usefulProperties);
        }
Beispiel #7
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();
            }
        }
Beispiel #8
0
        private void EntityList_OnEntityAdded(ExileBot.Entity entity)
        {
            if (!Settings.GetBool("ItemAlert") || this.currentAlerts.ContainsKey(entity))
            {
                return;
            }
            if (entity.HasComponent <WorldItem>())
            {
                ExileBot.Entity      item  = new ExileBot.Entity(this.poe, entity.GetComponent <WorldItem>().ItemEntity);
                ItemUsefulProperties props = this.EvaluateItem(item);

                if (props.IsWorthAlertingPlayer(currencyNames))
                {
                    this.DoAlert(entity, props);
                }
            }
        }
Beispiel #9
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();
                    }
                }
            }
        }
Beispiel #10
0
        private ItemUsefulProperties EvaluateItem(ExileBot.Entity item)
        {
            ItemUsefulProperties ip = new ItemUsefulProperties();

            Mods mods = item.GetComponent<Mods>();
            Sockets socks = item.GetComponent<Sockets>();
            Map map = item.HasComponent<Map>() ? item.GetComponent<Map>() : null;
            SkillGem sk = item.HasComponent<SkillGem>() ? item.GetComponent<SkillGem>() : null;
            Quality q = item.HasComponent<Quality>() ? item.GetComponent<Quality>() : null;

            ip.Name = this.poe.Files.BaseItemTypes.Translate(item.Path);
            ip.ItemLevel = mods.ItemLevel;
            ip.NumLinks = socks.LargestLinkSize;
            ip.NumSockets = socks.NumberOfSockets;
            ip.Rarity = mods.ItemRarity;
            ip.MapLevel = map == null ? 0 : 1;
            ip.IsCurrency = item.Path.Contains("Currency");
            ip.IsSkillGem = sk != null;
            ip.Quality = q == null ? 0 : q.ItemQuality;
            ip.WorthChrome = socks != null && socks.IsRGB;

            CraftingBase craftingBase;
            if (craftingBases.TryGetValue(ip.Name, out craftingBase) && Settings.GetBool("ItemAlert.Crafting"))
                ip.IsCraftingBase = ip.ItemLevel >= craftingBase.MinItemLevel && ip.Quality >= craftingBase.MinQuality;

            return ip;
        }
Beispiel #11
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();
     }
 }
Beispiel #12
0
        private ItemUsefulProperties EvaluateItem(EntityWrapper item)
        {
            ItemUsefulProperties ip = new ItemUsefulProperties();

            Mods mods = item.GetComponent<Mods>();
            Sockets socks = item.GetComponent<Sockets>();
            Map map = item.HasComponent<Map>() ? item.GetComponent<Map>() : null;
            Quality q = item.HasComponent<Quality>() ? item.GetComponent<Quality>() : null;

            ip.Name = model.Files.BaseItemTypes.Translate(item.Path);
            ip.ItemLevel = mods.ItemLevel;
            ip.NumLinks = socks.LargestLinkSize;
            ip.NumSockets = socks.NumberOfSockets;
            ip.Rarity = mods.ItemRarity;
            ip.MapLevel = map == null ? 0 : 1;
            ip.IsCurrency = item.Path.Contains("Currency");
            ip.IsSkillGem = item.HasComponent<SkillGem>();
            ip.IsFlask = item.HasComponent<Flask>();
            ip.Quality = q == null ? 0 : q.ItemQuality;
            ip.WorthChrome = socks != null && socks.IsRGB;

            ip.IsVaalFragment = item.Path.Contains("VaalFragment");

            CraftingBase craftingBase;
            if (craftingBases.TryGetValue(ip.Name, out craftingBase) && Settings.AlertOfCraftingBases)
                ip.IsCraftingBase = ip.ItemLevel >= craftingBase.MinItemLevel
                    && ip.Quality >= craftingBase.MinQuality
                    && (craftingBase.Rarities == null || craftingBase.Rarities.Contains(ip.Rarity));

            return ip;
        }