Exemplo n.º 1
0
        public void PaintWorld(WorldLayer layer)
        {
            var monsters = Hud.Game.AliveMonsters;
            var goblins  = Hud.Game.AliveMonsters.Where(x => x.SnoMonster.Priority == MonsterPriority.goblin);

            foreach (var monster in goblins)
            {
                GoblinDecorator.Paint(layer, monster, monster.FloorCoordinate, null);
            }

            List <IMonster> monstersElite = new List <IMonster>();

            foreach (var monster in monsters)
            {
                if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
                {
                    monstersElite.Add(monster);
                }

                if (monster.Rarity == ActorRarity.RareMinion)
                {
                    // RareMinionDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                }

                if (monster.Rarity == ActorRarity.Unique)
                {
                    UniqueDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                }

                if (monster.Rarity == ActorRarity.Boss)
                {
                    BossDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                }
            }
            foreach (var monster in monstersElite)
            {
                if (monster.SummonerAcdDynamicId == 0)
                {
                    bool flag = true;
                    foreach (var snoMonsterAffix in monster.AffixSnoList)
                    {
                        string affixName = null;
                        if (CustomAffixNames.ContainsKey(snoMonsterAffix.Affix))
                        {
                            affixName = CustomAffixNames[snoMonsterAffix.Affix];
                        }
                        else
                        {
                            affixName = snoMonsterAffix.NameLocalized;
                        }
                        if (snoMonsterAffix.Affix == MonsterAffix.Juggernaut)
                        {
                            flag = false;
                        }

                        WorldDecoratorCollection decorator;
                        if (!AffixDecorators.TryGetValue(snoMonsterAffix.Affix, out decorator))
                        {
                            continue;
                        }
                        decorator.Paint(layer, monster, monster.FloorCoordinate, affixName);
                    }
                    if (monster.Rarity == ActorRarity.Rare)
                    {
                        if (flag)
                        {
                            RareDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                        }
                        else
                        {
                            JuggernautDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                        }
                    }
                    if (monster.Rarity == ActorRarity.Champion)
                    {
                        ChampionDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                    }
                }
            }

            monstersElite.Clear();
        }
Exemplo n.º 2
0
        public void DrawEliteCirclePlugin(WorldLayer layer)
        {
            bool flagNeedShowSteadyAimYard = false;

            if (Hud.Game.Me.HeroClassDefinition.HeroClass == HeroClass.DemonHunter)
            {
                var dhSteadyAimBuff = Hud.Game.Me.Powers.GetBuff(Hud.Sno.SnoPowers.DemonHunter_Passive_SteadyAim.Sno);
                if (dhSteadyAimBuff != null)
                {
                    flagNeedShowSteadyAimYard = true;
                }

                //??
            }



            var alivemonsters = Hud.Game.AliveMonsters;
            var goblins       = Hud.Game.AliveMonsters.Where(x => x.SnoMonster.Priority == MonsterPriority.goblin);

            foreach (var monster in goblins)
            {
                GoblinDecorator.Paint(layer, monster, monster.FloorCoordinate, null);
            }
            List <IMonster> monstersElite = new List <IMonster>();

            foreach (var monster in alivemonsters)
            {
                if (monster.Rarity == ActorRarity.Champion || monster.Rarity == ActorRarity.Rare)
                {
                    monstersElite.Add(monster);
                }
                if (monster.Rarity == ActorRarity.Unique)
                {
                    UniqueDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                }

                if (monster.Rarity == ActorRarity.Boss)
                {
                    BossDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                }
            }
            foreach (var monster in monstersElite)
            {
                if (monster.SummonerAcdDynamicId == 0)
                {
                    var currentMonsterHealthPercent = monster.CurHealth * 100.0 / monster.MaxHealth;

                    bool flagIsNotJuggernaut = true;
                    foreach (var snoMonsterAffix in monster.AffixSnoList)
                    {
                        string affixName = null;
                        affixName = snoMonsterAffix.NameLocalized;
                        if (snoMonsterAffix.Affix == MonsterAffix.Juggernaut)
                        {
                            flagIsNotJuggernaut = false;
                        }
                    }
                    if (monster.Rarity == ActorRarity.Rare)
                    {
                        if (flagIsNotJuggernaut)
                        {
                            RareDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                        }
                        else
                        {
                            JuggernautDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                        }
                    }
                    if (monster.Rarity == ActorRarity.Champion)
                    {
                        ChampionDecorator.Paint(layer, monster, monster.FloorCoordinate, monster.SnoMonster.NameLocalized);
                    }

                    var monsterScreenCoordinate = monster.FloorCoordinate.ToScreenCoordinate();

                    if (IsGuardianAlive())
                    {
                        if (flagNeedShowSteadyAimYard)
                        {
                            string yardStr = monster.NormalizedXyDistanceToMe.ToString("0") + "Yard";
                            EliteHealthDecorator.TextFunc = () => yardStr;
                            EliteHealthDecorator.Paint(monsterScreenCoordinate.X, monsterScreenCoordinate.Y - EliteHealthBlockSize, EliteHealthBlockSize, EliteHealthBlockSize, HorizontalAlign.Center);
                        }
                    }
                    else
                    {
                        if (currentMonsterHealthPercent < 40.0)
                        {
                            string monsterHealthPercentStr = "HP:" + currentMonsterHealthPercent.ToString("0.0") + "%";
                            EliteHealthDecorator.TextFunc = () => monsterHealthPercentStr;
                            EliteHealthDecorator.Paint(monsterScreenCoordinate.X, monsterScreenCoordinate.Y - EliteHealthBlockSize, EliteHealthBlockSize, EliteHealthBlockSize, HorizontalAlign.Center);
                        }
                    }
                    if (currentMonsterHealthPercent < 20.0)
                    {
                        Hud.Render.CreateBrush(192, 255, 255, 55, -1).DrawLine(monsterScreenCoordinate.X, monsterScreenCoordinate.Y, Hud.Game.Me.ScreenCoordinate.X, Hud.Game.Me.ScreenCoordinate.Y + 60, 1.0f);
                    }
                }
            }

            bool StrickenActive = false;

            foreach (var StrickenLocation in Hud.Game.Items.Where(x => x.Location == ItemLocation.LeftRing || x.Location == ItemLocation.RightRing || x.Location == ItemLocation.Neck))
            {
                if (StrickenLocation.SocketCount != 1 || StrickenLocation.ItemsInSocket == null)
                {
                    continue;
                }
                var Stricken = StrickenLocation.ItemsInSocket.FirstOrDefault();
                if (Stricken == null)
                {
                    continue;
                }
                if (Stricken.SnoItem.Sno == 3249948847)
                {
                    StrickenActive = true; break;
                }
                else
                {
                    continue;
                }
            }
            if (StrickenActive)
            {
                var Texture = Hud.Texture.GetItemTexture(Hud.Sno.SnoItems.Unique_Gem_018_x1);
                foreach (var monster in monstersElite)
                {
                    if (monster.IsAlive)
                    {
                        var monsterScreenCoordinate = monster.FloorCoordinate.ToScreenCoordinate();
                        Tuple <double, int> valuesOut;
                        if (StrickenMonsterStatus.TryGetValue(monster.AcdId, out valuesOut))
                        {
                            double monHealth  = monster.CurHealth;
                            double prevHealth = valuesOut.Item1;
                            int    prevStacks = valuesOut.Item2;

                            if (prevHealth > monHealth && Hud.Game.Me.Powers.BuffIsActive(Hud.Sno.SnoPowers.BaneOfTheStrickenPrimary.Sno, 2) && StrickenMonsterCount == 0 && !StrickenInCooldown)
                            {
                                int Stacks = (int)(prevStacks + 1);
                                Tuple <double, int> updateValues = new Tuple <double, int>(monster.CurHealth, Stacks);
                                StrickenMonsterStatus[monster.AcdId] = updateValues;
                                StrickenMonsterCount++;
                                StrickenInCooldown = true;
                            }

                            else if (!Hud.Game.Me.Powers.BuffIsActive(Hud.Sno.SnoPowers.BaneOfTheStrickenPrimary.Sno, 2) && StrickenInCooldown)
                            {
                                StrickenInCooldown   = false;
                                StrickenMonsterCount = 0;
                                if (prevHealth > monHealth)
                                {
                                    int Stacks = (int)(prevStacks);
                                    Tuple <double, int> updateValues = new Tuple <double, int>(monster.CurHealth, Stacks);
                                    StrickenMonsterStatus[monster.AcdId] = updateValues;
                                }
                            }
                            if (prevStacks > 0)
                            {
                                Texture.Draw(monsterScreenCoordinate.X, monsterScreenCoordinate.Y, StrickenPropSquare, StrickenPropSquare);
                                StrickenStackDecorator.TextFunc = () => prevStacks.ToString();
                                StrickenStackDecorator.Paint(monsterScreenCoordinate.X, monsterScreenCoordinate.Y, StrickenPropSquare, StrickenPropSquare, HorizontalAlign.Center);
                            }
                        }
                        else
                        {
                            Tuple <double, int> valuesIn = new Tuple <double, int>(monster.CurHealth, (int)(0));
                            StrickenMonsterStatus.Add(monster.AcdId, valuesIn);
                        }
                    }
                    else
                    {
                        StrickenMonsterStatus.Remove(monster.AcdId);
                    }
                }
            }


            var shrines = Hud.Game.Shrines.Where(s => (s.Type == ShrineType.PoolOfReflection || s.Type == ShrineType.BanditShrine));

            foreach (var shrine in shrines)
            {
                if (shrine.IsDisabled == false && shrine.IsOperated == false)
                {
                    var monsterScreenCoordinate = shrine.FloorCoordinate.ToScreenCoordinate();
                    Hud.Render.CreateBrush(192, 255, 255, 55, -1).DrawLine(monsterScreenCoordinate.X, monsterScreenCoordinate.Y, Hud.Game.Me.ScreenCoordinate.X, Hud.Game.Me.ScreenCoordinate.Y + 60, 1.0f);
                }
            }

            double minDistanceToMe = 999999.0;
            var    oculusActors    = Hud.Game.Actors.Where(x => x.SnoActor.Sno == ActorSnoEnum._generic_proxy && x.GetAttributeValueAsInt(Hud.Sno.Attributes.Power_Buff_1_Visual_Effect_None, Hud.Sno.SnoPowers.OculusRing.Sno) == 1);

            foreach (var actor in oculusActors)
            {
                if (minDistanceToMe > actor.NormalizedXyDistanceToMe)
                {
                    minDistanceToMe = actor.NormalizedXyDistanceToMe;
                }
            }
            foreach (var actor in oculusActors)
            {
                if (minDistanceToMe == actor.NormalizedXyDistanceToMe && actor.NormalizedXyDistanceToMe < 100)
                {
                    var actorScreenCoordinate = actor.FloorCoordinate.ToScreenCoordinate();
                    Hud.Render.CreateBrush(192, 234, 60, 83, -1).DrawLine(actorScreenCoordinate.X, actorScreenCoordinate.Y, Hud.Game.Me.ScreenCoordinate.X, Hud.Game.Me.ScreenCoordinate.Y + 60, 1.0f);


                    //  StrickenStackDecorator.TextFunc = () => ("(" + (int)(actorScreenCoordinate.X) + "," + (int)(actorScreenCoordinate.Y) + ")");
                    //  StrickenStackDecorator.Paint(actorScreenCoordinate.X, actorScreenCoordinate.Y, StrickenPropSquare, StrickenPropSquare, HorizontalAlign.Center);
                }
            }


            foreach (var actor in Hud.Game.Actors)
            {
                switch (actor.SnoActor.Sno)
                {
                case ActorSnoEnum._x1_monsteraffix_teleportmines:
                    if (actor.NormalizedXyDistanceToMe <= 6)
                    {
                        WormholeWarningDecorator.Paint(layer, actor, actor.FloorCoordinate, "Wormhole!");
                    }
                    else
                    {
                        WormholeDecorator.Paint(layer, actor, actor.FloorCoordinate, "Wormhole");
                    }
                    break;
                }
            }



            monstersElite.Clear();
        }