Example #1
0
        public NpcIcon(Entity entity, GameController gameController, IconsBuilderSettings settings) : base(entity, settings)
        {
            if (!_HasIngameIcon)
            {
                MainTexture = new HudTexture("Icons.png");
            }

            MainTexture.Size = settings.SizeNpcIcon;
            var component = entity.GetComponent <Render>();

            Text = component?.Name.Split(',')[0];
            Show = () => entity.IsValid;
            if (_HasIngameIcon)
            {
                return;
            }

            if (entity.Path.StartsWith("Metadata/NPC/League/Cadiro"))
            {
                MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.QuestObject);
            }
            else if (entity.Path.StartsWith("Metadata/Monsters/LeagueBetrayal/MasterNinjaCop"))
            {
                MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.BetrayalSymbolDjinn);
            }
            else
            {
                MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.NPC);
            }
        }
Example #2
0
 public ShrineIcon(Entity entity, GameController gameController, IconsBuilderSettings settings) : base(entity, settings)
 {
     MainTexture      = new HudTexture("Icons.png");
     MainTexture.UV   = SpriteHelper.GetUV(MapIconsIndex.Shrine);
     Text             = entity.GetComponent <Render>()?.Name;
     MainTexture.Size = settings.SizeShrineIcon;
     Show             = () => entity.IsValid && entity.GetComponent <Shrine>().IsAvailable;
 }
Example #3
0
 public PlayerIcon(Entity entity, GameController gameController, IconsBuilderSettings settings, Dictionary <string, Size2> modIcons) :
     base(entity, settings)
 {
     Show = () => entity.IsValid && !settings.HidePlayers;
     if (_HasIngameIcon)
     {
         return;
     }
     MainTexture = new HudTexture("Icons.png")
     {
         UV = SpriteHelper.GetUV(MapIconsIndex.OtherPlayer)
     };
     Text = entity.GetComponent <Player>().PlayerName;
 }
        public MissionMarkerIcon(Entity entity, GameController gameController, IconsBuilderSettings settings) : base(entity, settings)
        {
            MainTexture          = new HudTexture();
            MainTexture.FileName = "Icons.png";
            MainTexture.UV       = SpriteHelper.GetUV(16, new Size2F(14, 14));
            Show = () =>
            {
                var switchState = entity.GetComponent <Transitionable>() != null
                    ? entity.GetComponent <Transitionable>().Flag1
                    : (byte?)null;

                var isTargetable = entity.IsTargetable;
                return(switchState == 1 || (bool)isTargetable);
            };
            MainTexture.Size = settings.SizeMiscIcon;
        }
Example #5
0
        public void Update(Entity entity, IconsBuilderSettings settings, Dictionary <string, Size2> modIcons)
        {
            Show = () => entity.IsAlive;
            if (entity.IsHidden && settings.HideBurriedMonsters)
            {
                Show = () => !entity.IsHidden && entity.IsAlive;
            }
            ID = entity.Id;

            if (!_HasIngameIcon)
            {
                MainTexture = new HudTexture("Icons.png");
            }

            switch (Rarity)
            {
            case MonsterRarity.White:
                MainTexture.Size = settings.SizeEntityWhiteIcon;
                break;

            case MonsterRarity.Magic:
                MainTexture.Size = settings.SizeEntityMagicIcon;
                break;

            case MonsterRarity.Rare:
                MainTexture.Size = settings.SizeEntityRareIcon;
                break;

            case MonsterRarity.Unique:
                MainTexture.Size = settings.SizeEntityUniqueIcon;
                break;

            default:
                throw new ArgumentException(
                          $"{nameof(MonsterIcon)} wrong rarity for {entity.Path}. Dump: {entity.GetComponent<ObjectMagicProperties>().DumpObject()}");

                break;
            }

            //if (_HasIngameIcon && entity.HasComponent<MinimapIcon>() && !entity.GetComponent<MinimapIcon>().Name.Equals("NPC") && entity.League != LeagueType.Heist)
            // return;

            if (!entity.IsHostile)
            {
                if (!_HasIngameIcon)
                {
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterSmallGreenCircle);
                    Priority       = IconPriority.Low;
                    Show           = () => !settings.HideMinions && entity.IsAlive;
                }

                //Spirits icon
            }
            else if (Rarity == MonsterRarity.Unique && entity.Path.Contains("Metadata/Monsters/Spirit/"))
            {
                MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeGreenHexagon);
            }
            else
            {
                string modName = null;

                if (entity.HasComponent <ObjectMagicProperties>())
                {
                    var objectMagicProperties = entity.GetComponent <ObjectMagicProperties>();

                    var mods = objectMagicProperties.Mods;

                    if (mods != null)
                    {
                        if (mods.Contains("MonsterConvertsOnDeath_"))
                        {
                            Show = () => entity.IsAlive && entity.IsHostile;
                        }

                        modName = mods.FirstOrDefaultF(modIcons.ContainsKey);
                    }
                }

                if (modName != null)
                {
                    MainTexture    = new HudTexture("sprites.png");
                    MainTexture.UV = SpriteHelper.GetUV(modIcons[modName], new Size2F(7, 8));
                    Priority       = IconPriority.VeryHigh;
                }
                else
                {
                    switch (Rarity)
                    {
                    case MonsterRarity.White:
                        MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeRedCircle);
                        if (settings.ShowWhiteMonsterName)
                        {
                            Text = RenderName.Split(',').FirstOrDefault();
                        }
                        break;

                    case MonsterRarity.Magic:
                        MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeBlueCircle);
                        if (settings.ShowMagicMonsterName)
                        {
                            Text = RenderName.Split(',').FirstOrDefault();
                        }

                        break;

                    case MonsterRarity.Rare:
                        MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeYellowCircle);
                        if (settings.ShowRareMonsterName)
                        {
                            Text = RenderName.Split(',').FirstOrDefault();
                        }
                        break;

                    case MonsterRarity.Unique:
                        MainTexture.UV    = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeCyanHexagon);
                        MainTexture.Color = Color.DarkOrange;
                        if (settings.ShowUniqueMonsterName)
                        {
                            Text = RenderName.Split(',').FirstOrDefault();
                        }
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(
                                  $"Rarity wrong was is {Rarity}. {entity.GetComponent<ObjectMagicProperties>().DumpObject()}");
                    }
                }
            }
        }
Example #6
0
 public MonsterIcon(Entity entity, GameController gameController, IconsBuilderSettings settings, Dictionary <string, Size2> modIcons)
     : base(entity, settings)
 {
     Update(entity, settings, modIcons);
 }
Example #7
0
        public void Update(Entity entity, IconsBuilderSettings settings)
        {
            if (Entity.Path.Contains("BreachChest"))
            {
                CType = ChestType.Breach;
            }
            else if (Entity.Path.Contains("Metadata/Chests/AbyssChest") ||
                     Entity.Path.Contains("Metadata/MiscellaneousObjects/Abyss/AbyssFinal") ||
                     Entity.Path.Contains("Metadata/Chests/Abyss/AbyssFinal"))
            {
                CType = ChestType.Abyss;
            }
            else if (Entity.Path.Contains("Metadata/Chests/Incursion"))
            {
                CType = ChestType.Incursion;
            }
            else if (Entity.Path.Contains("Fossil"))
            {
                CType = ChestType.Fossil;
            }
            else if (Entity.Path.Contains("Metadata/Chests/Delve"))
            {
                CType = ChestType.Delve;
            }
            else if (Entity.Path.Contains("Perandus"))
            {
                CType = ChestType.Perandus;
            }
            else if (Entity.Path.Contains("Metadata/Chests/StrongBoxes"))
            {
                CType = ChestType.Strongbox;
            }
            else if (Entity.Path.Contains("Metadata/Chests/Labyrinth/Labyrinth"))
            {
                CType = ChestType.Labyrinth;
            }
            else if (Entity.Path.Contains("Metadata/Chests/SynthesisChests/Synthesis"))
            {
                CType = ChestType.Synthesis;
            }
            else if (Entity.League == LeagueType.Legion)
            {
                CType = ChestType.Legion;
            }
            else if (Entity.League == LeagueType.Heist)
            {
                CType = ChestType.Heist;
            }
            else
            {
                CType = ChestType.SmallChest;
            }

            Show = () => !Entity.IsOpened;

            if (CType != ChestType.Heist)
            {
                if (!_HasIngameIcon)
                {
                    MainTexture = new HudTexture {
                        FileName = "sprites.png"
                    };
                }
                else
                {
                    MainTexture.Size = settings.SizeChestIcon;
                    Text             = Entity.GetComponent <Render>()?.Name ?? "";
                    return;
                }
            }
            switch (Rarity)
            {
            case MonsterRarity.White:
                MainTexture.Color = Color.White;
                break;

            case MonsterRarity.Magic:
                MainTexture.Color = HudSkin.MagicColor;
                break;

            case MonsterRarity.Rare:
                MainTexture.Color = HudSkin.RareColor;
                break;

            case MonsterRarity.Unique:
                MainTexture.Color = HudSkin.UniqueColor;
                break;

            default:
                MainTexture.Color = Color.Purple;
                break;
            }

            switch (CType)
            {
            case ChestType.Breach:
                MainTexture.Size = settings.SizeBreachChestIcon;

                if (Entity.Path.Contains("Large"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(strongboxesUV["Metadata/Chests/StrongBoxes/StrongboxDivination"],
                                                        new Size2F(7, 8));

                    MainTexture.Color = new ColorBGRA(240, 100, 255, 255);
                    Text = "Big Breach";
                }
                else
                {
                    MainTexture.UV    = SpriteHelper.GetUV(strongboxesUV["Metadata/Chests/StrongBoxes/Large"], new Size2F(7, 8));
                    MainTexture.Color = new ColorBGRA(240, 100, 255, 255);
                    Text = "Breach chest";
                }

                break;

            case ChestType.Abyss:
                MainTexture.Size = settings.SizeChestIcon;

                if (Entity.Path.Contains("AbyssFinalChest"))
                {
                    MainTexture.UV    = SpriteHelper.GetUV(strongboxesUV["Metadata/Chests/AbyssChest"], new Size2F(7, 8));
                    MainTexture.Color = Color.GreenYellow;
                    Text = Entity.GetComponent <Render>()?.Name;
                }
                else if (Entity.Path.Contains("AbyssChest"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(strongboxesUV["Metadata/Chests/StrongBoxes/StrongboxDivination"],
                                                        new Size2F(7, 8));

                    MainTexture.Color = Color.GreenYellow;
                }

                break;

            case ChestType.Incursion:
                MainTexture.Size  = settings.SizeChestIcon;
                MainTexture.UV    = SpriteHelper.GetUV(strongboxesUV["Metadata/Chests/StrongBoxes/StrongboxDivination"], new Size2F(7, 8));
                MainTexture.Color = Color.OrangeRed;
                Text = Entity.Path.Replace("Metadata/Chests/IncursionChest", "").Replace("s/IncursionChest", "");
                break;

            case ChestType.Delve:
                Priority          = IconPriority.High;
                MainTexture.Size  = settings.SizeChestIcon;
                MainTexture.Color = Color.GreenYellow;
                Text = Entity.Path.Replace("Metadata/Chests/DelveChests/", "");

                //Text = Text.Replace("ChestCurrency", "Cur");
                //  Text = Text.Replace("Delve", "");
                if (Text.EndsWith("NoDrops"))
                {
                    Text = "";
                }

                if (Entity.Path.Equals("Metadata/Chests/DelveChests/OffPathCurrency", StringComparison.Ordinal) ||
                    Entity.Path.Equals("Metadata/Chests/DelveChests/PathCurrency", StringComparison.Ordinal))
                {
                    MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Arcanist);
                    MainTexture.Color = Color.Orange;
                    Text = "Currency";
                }
                else if (Entity.Path.Equals("Metadata/Chests/DelveChests/OffPathTrinkets", StringComparison.Ordinal) ||
                         Entity.Path.Equals("Metadata/Chests/DelveChests/PathTrinkets", StringComparison.Ordinal))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Jeweller);
                    Text           = "Jew";
                }
                else if (PathCheck(entity, "Metadata/Chests/DelveChests/OffPathArmour", "Metadata/Chests/DelveChests/PathArmour"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Armoury);

                    Text =
                        $"{Entity.Path.Substring(Entity.Path.IndexOf("PathArmour", StringComparison.Ordinal) + "PathArmour".Length)}";

                    Text = Text.Trim();
                }
                else if (PathCheck(entity, "Metadata/Chests/DelveChests/OffPathWeapon", "Metadata/Chests/DelveChests/PathWeapon"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Artisan);

                    Text =
                        $"{Entity.Path.Substring(Entity.Path.IndexOf("PathWeapon", StringComparison.Ordinal) + "PathWeapon".Length)}";

                    Text = Text.Trim();
                }
                else if (PathCheck(entity, "Metadata/Chests/DelveChests/PathGeneric", "Metadata/Chests/DelveChests/OffPathGeneric"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Strongbox);

                    Text =
                        $"{Entity.Path.Substring(Entity.Path.IndexOf("PathGeneric", StringComparison.Ordinal) + "PathGeneric".Length)}";

                    Text = Text.Trim();
                }
                else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveAzuriteVein"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Divination);
                    Text           = Entity.GetComponent <Render>().Name.Replace("<rgb(175,238,238)>{", "").Replace("}", "");
                }
                else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveMiningSuppliesDynamite"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Artisan);
                    Text           = Entity.GetComponent <Render>().Name.Replace("<rgb(218,165,32)>{", "").Replace("}", "");
                }
                else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveMiningSuppliesFlares"))
                {
                    MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.WhiteTexturedEllipse);
                    MainTexture.Color = Color.Yellow;
                    Text = Entity.RenderName.Replace("<rgb(218,165,32)>{", "").Replace("}", "");
                }
                else if (Entity.Path.Contains("Metadata/Chests/DelveChests/Dynamite"))
                {
                    if (PathCheck(entity, "Metadata/Chests/DelveChests/DynamiteWeapon"))
                    {
                        MainTexture.Color = Color.LightGray;
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Arsenal);
                        Text = $"{Entity.Path.Replace("Metadata/Chests/DelveChests/DynamiteWeapon", "W ")}";
                    }
                    else if (PathCheck(entity, "Metadata/Chests/DelveChests/DynamiteTrinkets"))
                    {
                        MainTexture.Color = Color.GreenYellow;
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Jeweller);
                        Text = $"{Entity.Path.Replace("Metadata/Chests/DelveChests/DynamiteTrinkets", "J ")}";
                    }
                    else if (PathCheck(entity, "Metadata/Chests/DelveChests/DynamiteArmour"))
                    {
                        MainTexture.Color = Color.LightGray;
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Armoury);
                        Text = $"{Entity.Path.Replace("Metadata/Chests/DelveChests/DynamiteArmour", "A ")}";
                    }
                    else if (PathCheck(entity, "Metadata/Chests/DelveChests/DynamiteGeneric"))
                    {
                        MainTexture.Color = Color.WhiteSmoke;
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Strongbox);
                        Text = $"{Entity.Path.Replace("Metadata/Chests/DelveChests/DynamiteGeneric", "G ")}";
                    }
                    else if (PathCheck(entity, "Metadata/Chests/DelveChests/DynamiteCurrency"))
                    {
                        MainTexture.Color = Color.Orange;
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Arcanist);
                        Text = $"{Entity.Path.Replace("Metadata/Chests/DelveChests/DynamiteCurrency", "$")}";
                    }
                    else
                    {
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Cartographer);
                        Text              = Entity.GetComponent <Render>().Name.Replace("Hidden", "");
                        MainTexture.Color = Color.Aqua;
                    }
                }
                else if (Entity.Path.Contains("DelveChestGem"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Gemcutter);
                }
                else if (Entity.Path.Contains("Resonator"))
                {
                    if (Entity.Path.EndsWith("3"))
                    {
                        Priority = IconPriority.Critical;
                    }

                    MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Divination);
                    MainTexture.Color = Color.Orange;
                }
                else if (Entity.Path.Contains("Metadata/Chests/DelveChests/"))
                {
                    if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveChestTrinkets"))
                    {
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Jeweller);
                        MainTexture.Color = Color.Yellow;
                        Text = $"Jew {Entity.Path.Replace("Metadata/Chests/DelveChests/DelveChestTrinkets", "")}";
                    }
                    else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveChestMap"))
                    {
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Cartographer);
                        MainTexture.Color = Color.Aqua;
                        Text = $"Maps {Entity.Path.Replace("Metadata/Chests/DelveChests/DelveChestMap", "")}";
                    }
                    else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveChestGenericDivination"))
                    {
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Divination);
                        MainTexture.Color = Color.OrangeRed;
                        Text = $"Div {Entity.Path.Replace("Metadata/Chests/DelveChests/DelveChestGenericDivination", "")}";
                    }
                    else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveChestWeapon"))
                    {
                        MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Artisan);
                        Text           = $"W {Entity.Path.Replace("Metadata/Chests/DelveChests/DelveChestWeapon", "")}";
                    }
                    else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveChestGeneric"))
                    {
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Strongbox);
                        Text              = $"G {Entity.Path.Replace("Metadata/Chests/DelveChests/DelveChestGeneric", "")}";
                        MainTexture.Color = Color.WhiteSmoke;
                    }
                    else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveChestArmour"))
                    {
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Armoury);
                        Text              = $"A {Entity.Path.Replace("Metadata/Chests/DelveChests/DelveChestArmour", "")}";
                        MainTexture.Color = Color.GreenYellow;
                    }
                    else if (Entity.Path.Contains("Metadata/Chests/DelveChests/DelveChestCurrency"))
                    {
                        MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Arcanist);
                        Text              = $"Cur {Entity.Path.Replace("Metadata/Chests/DelveChests/DelveChestCurrency", "")}";
                        MainTexture.Color = Color.Yellow;
                    }
                }

                else
                {
                    MainTexture.UV = SpriteHelper.GetUV(strongboxesUV["Metadata/Chests/StrongBoxes/Large"], new Size2F(7, 8));
                }

                if (Entity.Path.EndsWith("3") || Entity.Path.EndsWith("2_1"))
                {
                    MainTexture.Color = Color.Magenta;
                }

                break;

            case ChestType.Strongbox:
                MainTexture.Size = settings.SizeChestIcon;

                if (strongboxesUV.TryGetValue(Entity.Path, out var result))
                {
                    MainTexture.UV = SpriteHelper.GetUV(result, new Size2F(7, 8));
                    Text           = Entity.GetComponent <Render>()?.Name;
                }
                else
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Strongbox);
                    Text           = Entity.GetComponent <Render>()?.Name;
                }

                break;

            case ChestType.SmallChest:

                MainTexture.Size = settings.SizeSmallChestIcon;

                if (Entity.Path.Contains("VaultTreasurePile"))
                {
                    MainTexture.UV    = SpriteHelper.GetUV(strongboxesUV["Metadata/Chests/StrongBoxes/Arcanist"], new Size2F(7, 8));
                    MainTexture.Color = Color.Yellow;
                }
                else if (Entity.Path.Contains("SideArea/SideAreaChest"))
                {
                    MainTexture.FileName = "Icons.png";
                    MainTexture.UV       = SpriteHelper.GetUV(new Size2(4, 6), Constants.MapIconsSize);
                }
                else
                {
                    MainTexture.FileName = "Icons.png";
                    MainTexture.UV       = SpriteHelper.GetUV(MapIconsIndex.LootFilterSmallCyanSquare);
                    Show = () => Entity.IsValid && settings.ShowSmallChest && !Entity.IsOpened;
                }

                break;

            case ChestType.Fossil:
                Priority         = IconPriority.Critical;
                MainTexture.Size = settings.SizeChestIcon;
                MainTexture.UV   = SpriteHelper.GetUV(MyMapIconsIndex.Divination);
                var name = Entity.GetComponent <Render>().Name;
                Text = name.Substring(0, name.IndexOf(" ", StringComparison.Ordinal));
                MainTexture.Color = Color.Pink;
                if (FossilRarity.TryGetValue(Text, out var clr))
                {
                    MainTexture.Color = clr;
                }

                MainTexture.Color = MainTexture.Color;
                break;

            case ChestType.Perandus:
                MainTexture.Size  = settings.SizeChestIcon;
                MainTexture.UV    = SpriteHelper.GetUV(strongboxesUV["Metadata/Chests/StrongBoxes/Large"], new Size2F(7, 8));
                MainTexture.Color = Color.LightGreen;
                Text = Entity.GetComponent <Render>()?.Name;
                break;

            case ChestType.Labyrinth:
                MainTexture.Size  = settings.SizeChestIcon;
                MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Divination);
                Text              = Entity.Path.Replace("Metadata/Chests/Labyrinth/Labyrinth", "");
                MainTexture.Color = Color.ForestGreen;
                break;

            case ChestType.Heist:
                //DebugWindow.LogMsg(Entity.Path + " [ChestType.Fossil]");
                //MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Divination);
                Text = Entity.Path.Replace("Metadata/Chests/LeagueHeist/HeistChest", "").Replace("Thug", "")
                       .Replace("Science", "").Replace("Military", "").Replace("Robot", "")
                       .Replace("Secondary", "").Replace("RewardRoom", "");

                //MainTexture.Color = Color.HotPink;
                break;

            case ChestType.Synthesis:
                Priority          = IconPriority.Critical;
                MainTexture.Size  = settings.SizeChestIcon;
                MainTexture.UV    = SpriteHelper.GetUV(MyMapIconsIndex.Divination);
                Text              = Entity.Path.Split('/').Last();
                MainTexture.Color = Color.Aquamarine;
                break;

            case ChestType.Legion:
                MainTexture.FileName = "Icons.png";
                Priority             = IconPriority.Critical;
                MainTexture.Size     = settings.SizeChestIcon;

                if (Entity.GetComponent <Stats>().StatDictionary.TryGetValue(GameStat.MonsterMinimapIcon, out var minimapIconIndex))
                {
                    MainTexture.UV = SpriteHelper.GetUV((MapIconsIndex)minimapIconIndex);
                }
                else
                {
                    MainTexture.UV = SpriteHelper.GetUV(MyMapIconsIndex.Divination);
                }

                Text = ((MapIconsIndex)minimapIconIndex).ToString().Replace("Legion", "");
                MainTexture.Color = Color.White;
                break;

            default:
                throw new ArgumentOutOfRangeException("Chest type not found.");
            }

            //Debug, useful for delve chests
            if (settings.LogDebugInformation && Show())
            {
                Logger.Log.Information(
                    $"Chest debug -> CType:{CType} Path: {Entity.Path} #\t\tText: {Text} #\t\tRender Name: {Entity.GetComponent<Render>()?.Name ?? "Entity null"}");

                if (Entity.HasComponent <Stats>())
                {
                    var stats = Entity.GetComponent <Stats>()?.StatDictionary ?? null;
                    foreach (var i in stats)
                    {
                        Logger.Log.Information($"Stat: {i.Key} = {i.Value}");
                    }
                }

                if (Entity.GetComponent <ObjectMagicProperties>() != null)
                {
                    var mods = Entity.GetComponent <ObjectMagicProperties>()?.Mods ?? null;
                    foreach (var mod in mods)
                    {
                        Logger.Log.Information($"Mods: {mod}");
                    }
                }
            }
        }
Example #8
0
 public ChestIcon(Entity entity, GameController gameController, IconsBuilderSettings settings) : base(entity, settings)
 {
     Update(entity, settings);
 }
Example #9
0
        public void Update(Entity entity, IconsBuilderSettings settings)
        {
            if (!_HasIngameIcon)
            {
                MainTexture          = new HudTexture();
                MainTexture.FileName = "Icons.png";
                MainTexture.Size     = settings.SizeMiscIcon;
            }
            else
            {
                MainTexture.Size = settings.SizeDefaultIcon;
                Text             = RenderName;
                Priority         = IconPriority.VeryHigh;
                if (entity.GetComponent <MinimapIcon>()?.Name.Equals("DelveRobot", StringComparison.Ordinal) ?? false)
                {
                    Text = "Follow Me";
                }

                return;
            }

            if (entity.HasComponent <Targetable>())
            {
                if (entity.Path.Equals("Metadata/Terrain/Leagues/Synthesis/Objects/SynthesisPortal", StringComparison.Ordinal))
                {
                    Show = () => entity.IsValid;
                }
                else
                {
                    Show = () =>
                    {
                        var isVisible = false;

                        if (entity.HasComponent <MinimapIcon>())
                        {
                            var minimapIcon = entity.GetComponent <MinimapIcon>();
                            isVisible = minimapIcon?.IsVisible ?? false && !minimapIcon.IsHide;
                        }

                        return(entity.IsValid && isVisible && entity.IsTargetable);
                    };
                }
            }
            else
            {
                Show = () => entity.IsValid && (entity.GetComponent <MinimapIcon>()?.IsVisible ?? false);
            }

            if (entity.HasComponent <Transitionable>() && entity.HasComponent <MinimapIcon>())
            {
                if (entity.Path.Equals("Metadata/MiscellaneousObjects/Abyss/AbyssCrackSpawners/AbyssCrackSkeletonSpawner"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.AbyssCrack);

                    Show = () => entity.IsValid && (entity.GetComponent <MinimapIcon>()?.IsHide ?? true == false ||
                                                    (entity.GetComponent <Transitionable>()?.Flag1 ?? 0) == 1);
                }

                else if (entity.Path.Equals("Metadata/MiscellaneousObjects/Abyss/AbyssStartNode"))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.Abyss);

                    Show = () => entity.IsValid && (entity.GetComponent <MinimapIcon>()?.IsHide ?? true == false ||
                                                    (entity.GetComponent <Transitionable>()?.Flag1 ?? 0) == 1);
                }
                else if (entity.Path.Equals("Metadata/MiscellaneousObjects/Abyss/AbyssNodeSmall", StringComparison.Ordinal) ||
                         entity.Path.Equals("Metadata/MiscellaneousObjects/Abyss/AbyssNodeLarge", StringComparison.Ordinal) ||
                         entity.Path.StartsWith("Metadata/MiscellaneousObjects/Abyss/AbyssFinalNodeChest"))
                {
                    Show = () => entity.IsValid && (entity.GetComponent <MinimapIcon>()?.IsHide ?? true == false ||
                                                    (entity.GetComponent <Transitionable>()?.Flag1 ?? 0) == 1);
                }
                else if (entity.Path.StartsWith("Metadata/Terrain/Leagues/Incursion/Objects/IncursionPortal", StringComparison.Ordinal))
                {
                    Show = () => entity.IsValid && (entity.GetComponent <Transitionable>()?.Flag1 ?? 4) < 3;
                }
                else
                {
                    Priority = IconPriority.Critical;
                    Show     = () => false;
                }
            }
            else if (entity.HasComponent <Targetable>())
            {
                if (entity.Path.Contains("Metadata/Terrain/Leagues/Delve/Objects/DelveMineral"))
                {
                    Priority       = IconPriority.High;
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.DelveMineralVein);
                    Text           = "Sulphite";
                    Show           = () => entity.IsValid && entity.IsTargetable;
                }
                else if (entity.Path.Contains("Metadata/Terrain/Leagues/Delve/Objects/EncounterControlObjects/AzuriteEncounterController"))
                {
                    Priority       = IconPriority.High;
                    Text           = "Start";
                    Show           = () => entity.IsValid && (entity.GetComponent <Transitionable>()?.Flag1 ?? 4) < 3;
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.PartyLeader);
                }
            }
            //delve paths
            if (entity.Path.Contains("Objects/DelveLight") && entity.HasComponent <Preload>())
            {
                MainTexture.Size = settings.SizeDelvePaths;
                MainTexture.UV   = SpriteHelper.GetUV(MapIconsIndex.LootFilterSmallYellowCircle);
                Show             = () => entity.IsAlive && settings.ShowDelvePaths;
            }
        }
Example #10
0
        public void Update(Entity entity, IconsBuilderSettings settings, Dictionary <string, Size2> modIcons)
        {
            MainTexture = new HudTexture("Icons.png");
            if (!_HasIngameIcon)
            {
                MainTexture = new HudTexture("Icons.png");
            }
            switch (Rarity)
            {
            case MonsterRarity.White:
                MainTexture.Size = settings.SizeEntityWhiteIcon;
                break;

            case MonsterRarity.Magic:
                MainTexture.Size = settings.SizeEntityMagicIcon;
                break;

            case MonsterRarity.Rare:
                MainTexture.Size = settings.SizeEntityRareIcon;
                break;

            case MonsterRarity.Unique:
                MainTexture.Size = settings.SizeEntityUniqueIcon;
                Text             = entity.RenderName;
                break;

            default:
                throw new ArgumentException("Legion icon rarity corrupted.");
                break;
            }

            if (entity.Path.StartsWith("Metadata/Monsters/LegionLeague/MonsterChest", StringComparison.Ordinal) || Rarity == MonsterRarity.Unique)
            {
                MainTexture.UV    = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeGreenSquare);
                MainTexture.Color = Color.LimeGreen;
                Hidden            = () => false;
                Text = entity.RenderName;
                Show = () =>
                {
                    if (Entity.IsValid)
                    {
                        return(Entity.GetComponent <Life>().HPPercentage > 0.02);
                    }
                    return(Entity.IsAlive);
                };
            }
            else
            {
                string modName = null;
                if (entity.HasComponent <ObjectMagicProperties>())
                {
                    var objectMagicProperties = entity.GetComponent <ObjectMagicProperties>();

                    var mods = objectMagicProperties.Mods;
                    if (mods.Contains("MonsterConvertsOnDeath_"))
                    {
                        Show = () => entity.IsValid && entity.IsAlive && entity.IsHostile;
                    }

                    modName = mods.FirstOrDefaultF(modIcons.ContainsKey);
                    if (modName != null)
                    {
                        MainTexture    = new HudTexture("sprites.png");
                        MainTexture.UV = SpriteHelper.GetUV(modIcons[modName], new Size2F(7, 8));
                        Priority       = IconPriority.VeryHigh;
                    }
                    else
                    {
                        switch (Rarity)
                        {
                        case MonsterRarity.White:
                            MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeRedCircle);
                            break;

                        case MonsterRarity.Magic:
                            MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeBlueCircle);

                            break;

                        case MonsterRarity.Rare:
                            MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeYellowCircle);
                            break;

                        case MonsterRarity.Unique:
                            MainTexture.UV    = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeCyanHexagon);
                            MainTexture.Color = Color.DarkOrange;
                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }
                    }
                }


                var statDictionary = Entity.Stats;
                if (statDictionary.Count == 0)
                {
                    statDictionary = entity.GetComponentFromMemory <Stats>().ParseStats();
                    if (statDictionary.Count == 0)
                    {
                        Text = "Error";
                    }
                }

                if (statDictionary.TryGetValue(GameStat.MonsterMinimapIcon, out var indexMinimapIcon))
                {
                    var name = (MapIconsIndex)indexMinimapIcon;
                    Text     = name.ToString().Replace("Legion", "");
                    Priority = IconPriority.Critical;
                    var frozenCheck = new TimeCache <bool>(() =>
                    {
                        var stats = Entity.Stats;
                        if (stats.Count == 0)
                        {
                            return(false);
                        }
                        stats.TryGetValue(GameStat.FrozenInTime, out var FrozenInTime);
                        stats.TryGetValue(GameStat.MonsterHideMinimapIcon, out var MonsterHideMinimapIcon);
                        return(FrozenInTime == 1 && MonsterHideMinimapIcon == 1 || FrozenInTime == 0 && MonsterHideMinimapIcon == 0);
                    }, 75);

                    Show = () => Entity.IsAlive && frozenCheck.Value;
                }
                else
                {
                    Show = () => !Hidden() && Entity.GetComponent <Life>().HPPercentage > 0.02;
                }
            }
        }
Example #11
0
 public LegionIcon(Entity entity, GameController gameController, IconsBuilderSettings settings, Dictionary <string, Size2> modIcons) :
     base(entity, settings) =>
Example #12
0
 public PortalIcon(Entity entity, GameController gameController, IconsBuilderSettings settings) : base(entity, settings)
 {
 }
Example #13
0
 public LegionIcon(Entity entity, IconsBuilderSettings settings, Dictionary <string, Size2> modIcons)
     : base(entity, settings)
 {
     Update(entity, settings, modIcons);
 }
Example #14
0
        public void Update(Entity entity, IconsBuilderSettings settings, Dictionary <string, Size2> modIcons)
        {
            Show = () => Entity.IsAlive;

            MainTexture = new HudTexture("Icons.png");
            if (!_HasIngameIcon)
            {
                MainTexture = new HudTexture("Icons.png");
            }

            switch (Rarity)
            {
            case MonsterRarity.White:
                MainTexture.Size = settings.SizeEntityWhiteIcon;
                break;

            case MonsterRarity.Magic:
                MainTexture.Size = settings.SizeEntityMagicIcon;
                break;

            case MonsterRarity.Rare:
                MainTexture.Size = settings.SizeEntityRareIcon;
                break;

            case MonsterRarity.Unique:
                MainTexture.Size = settings.SizeEntityUniqueIcon;
                Text             = entity.RenderName;
                break;

            default:
                throw new ArgumentException("Delirium icon rarity corrupted.");
            }

            if (_HasIngameIcon && entity.HasComponent <MinimapIcon>() && !entity.GetComponent <MinimapIcon>().Name.Equals("NPC"))
            {
                return;
            }

            if (entity.Path.StartsWith("Metadata/Monsters/LeagueAffliction/DoodadDaemons", StringComparison.Ordinal))
            {
                var pathstring = "Metadata/Monsters/LeagueAffliction/DoodadDaemons/DoodadDaemon";
                //proximity spawning volatile ->bad
                if (entity.Path.StartsWith(pathstring + "BloodBag", StringComparison.Ordinal))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.RedFlag);
                    Text           = settings.DeliriumText.Value? "Avoid" : "";
                }
                else if (entity.Path.StartsWith(pathstring + "EggFodder", StringComparison.Ordinal))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.NPC);
                }
                else if (entity.Path.StartsWith(pathstring + "GlobSpawn", StringComparison.Ordinal))
                {
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.MyPlayer);
                }
                else
                {
                    Show           = () => false;
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.QuestObject);
                    return;
                }
                MainTexture.Size = settings.SizeEntityProximityMonsterIcon;
                Hidden           = () => false;

                Priority = IconPriority.Medium;
                return;
            }
            if (!entity.IsHostile)
            {
                if (!_HasIngameIcon)
                {
                    MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterSmallGreenCircle);
                    Priority       = IconPriority.Low;
                    Show           = () => !settings.HideMinions && entity.IsAlive;
                }

                //Spirits icon
            }
            else if (Rarity == MonsterRarity.Unique && entity.Path.Contains("Metadata/Monsters/Spirit/"))
            {
                MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeGreenHexagon);
            }
            else
            {
                string modName = null;

                if (entity.HasComponent <ObjectMagicProperties>())
                {
                    var objectMagicProperties = entity.GetComponent <ObjectMagicProperties>();

                    var mods = objectMagicProperties.Mods;

                    if (mods != null)
                    {
                        if (mods.Contains("MonsterConvertsOnDeath_"))
                        {
                            Show = () => entity.IsAlive && entity.IsHostile;
                        }

                        modName = mods.FirstOrDefaultF(modIcons.ContainsKey);
                    }
                }

                if (modName != null)
                {
                    MainTexture = new HudTexture("sprites.png")
                    {
                        UV = SpriteHelper.GetUV(modIcons[modName], new Size2F(7, 8))
                    };
                    Priority = IconPriority.VeryHigh;
                }
                else
                {
                    switch (Rarity)
                    {
                    case MonsterRarity.White:
                        MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeRedCircle);
                        break;

                    case MonsterRarity.Magic:
                        MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeBlueCircle);

                        break;

                    case MonsterRarity.Rare:
                        MainTexture.UV = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeYellowCircle);
                        break;

                    case MonsterRarity.Unique:
                        MainTexture.UV    = SpriteHelper.GetUV(MapIconsIndex.LootFilterLargeCyanHexagon);
                        MainTexture.Color = Color.DarkOrange;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(
                                  $"Rarity wrong was is {Rarity}. {entity.GetComponent<ObjectMagicProperties>().DumpObject()}");
                    }
                }
            }
        }
Example #15
0
 public MiscIcon(Entity entity, GameController gameController, IconsBuilderSettings settings) : base(entity, settings) =>