Example #1
0
        public void PaintWorld(WorldLayer layer)
        {
            DistYards = 0;
            var firstQuestMarker = true;
            var actors           = Hud.Game.Actors.Where(a => _actorList.Contains(a.SnoActor.Sno));

            foreach (var Actor in actors)
            {
                if (Actor == null)
                {
                    continue;
                }
                if (Actor.FloorCoordinate == null)
                {
                    continue;
                }
                if (Actor.IsDisabled || Actor.IsOperated)
                {
                    continue;
                }

                uint   ThatQuest = 0;
                string Name      = string.Empty;
                switch (Actor.SnoActor.Sno)
                {
                case ActorSnoEnum._px_spidercaves_camp_cocoon /*432770*/: Name = "Royal Cocoon"; ThatQuest = 432784; break;

                case ActorSnoEnum._px_wilderness_camp_templarprisoners /*430733*/: Name = "Captured Villager"; ThatQuest = 430723; break;

                case ActorSnoEnum._a2dun_zolt_ibstone_a_portalroulette_mini /*432885*/: Name = "Ancient Device"; ThatQuest = 433025; break;

                case ActorSnoEnum._px_caout_cage_bountycamp /*433051*/: Name = "Caldeum Villager"; ThatQuest = 433053; break;

                case ActorSnoEnum._px_ruins_frost_camp_cage /*435703*/: Name = "Captured Barbarian"; ThatQuest = 436280; break;

                case ActorSnoEnum._px_highlands_camp_resurgentcult_totem /*432259*/: Name = "Triune Monument"; ThatQuest = 432293; break;

                case ActorSnoEnum._px_bounty_death_orb_little /*433246*/: Name = "Death Orb"; ThatQuest = 433256; break;

                case ActorSnoEnum._px_bounty_ramparts_camp_switch /*433385*/: Name = "Catapult Winch"; ThatQuest = 433392; break;

                case ActorSnoEnum._px_bounty_camp_azmodan_fight_spawner /*433295*/: Name = "Demon Gate"; ThatQuest = 433309; break;

                case ActorSnoEnum._x1_westm_necro_jar_of_souls_camp_graveyard /*433316*/: Name = "Death Prison"; ThatQuest = 433339; break;

                case ActorSnoEnum._px_leorics_camp_worthammilitia_ex /*434366*/: Name = "Tortured Wortham Militia"; ThatQuest = 434378; break;

                case ActorSnoEnum._px_bridge_camp_lostpatrol /*433184*/: Name = "Captured Guard"; ThatQuest = 433217; break;

                case ActorSnoEnum._px_bounty_camp_trappedangels /*433124*/: Name = "Bone Cage"; ThatQuest = 433099; break;

                case ActorSnoEnum._px_bounty_camp_hellportals_frame /*433402*/: Name = "Hell Portal"; ThatQuest = 433422; break;

                case ActorSnoEnum._px_oasis_camp_ironwolves /*432331*/: Name = "Captured Iron Wolf"; ThatQuest = 432334; break;

                default: Name = string.Empty; break;
                }
                var quest = Hud.Game.Bounties.FirstOrDefault(x => x.SnoQuest.Sno == ThatQuest);
                if ((quest != null) && quest.State != QuestState.completed)
                {
                    QuestDecorator.Paint(layer, null, Actor.FloorCoordinate, Name);
                    firstQuestMarker = false;
                }
            }

            // Pools of reflection
            if (Pools)
            {
                var PoolsOfReflection = Hud.Game.Shrines.Where(p => !p.IsDisabled && !p.IsOperated && p.Type == ShrineType.PoolOfReflection);

                foreach (var PoolOfReflection in PoolsOfReflection)
                {
                    PoolDecorator.Paint(layer, null, PoolOfReflection.FloorCoordinate, PoolOfReflection.SnoActor.NameLocalized);
                }
            }

            // modified Xenthalon's AdvancedMarkerPlugin
            var markers = Hud.Game.Markers.OrderBy(i => Hud.Game.Me.FloorCoordinate.XYDistanceTo(i.FloorCoordinate));

            if (markers != null)
            {
                foreach (var marker in markers)
                {
                    if (marker == null)
                    {
                        continue;
                    }
                    if (marker.FloorCoordinate == null)
                    {
                        continue;
                    }
                    if (marker.Name == null)
                    {
                        continue;
                    }

                    var OnScreen = marker.FloorCoordinate.IsOnScreen(1);
                    QuestDecorator.ToggleDecorators <GroundLabelDecorator>(!OnScreen); // do not display ground labels when the marker is on the screen
                    KeywardenDecorator.ToggleDecorators <GroundLabelDecorator>(!OnScreen);
                    BossDecorator.ToggleDecorators <GroundLabelDecorator>(!OnScreen);

                    if (marker.SnoQuest != null && firstQuestMarker)
                    {
                        DistYards = (int)(marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate));
                        QuestDecorator.Paint(layer, null, marker.FloorCoordinate, marker.Name);
                        firstQuestMarker = false;
                    }
                    else if (marker.SnoActor != null)
                    {
                        if (marker.SnoActor.Code.Contains("_Boss_"))
                        {
                            BossDecorator.Paint(layer, null, marker.FloorCoordinate, marker.Name);
                        }
                        else if (marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) < 500)
                        {
                            KeywardenDecorator.Paint(layer, null, marker.FloorCoordinate, marker.Name);
                        }
                    }
                }
            }

            if (Hud.Game.NumberOfPlayersInGame == 1)
            {
                NameOther3 = string.Empty; Other3 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther3 = string.Empty;
                NameOther2 = string.Empty; Other2 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther2 = string.Empty;
                NameOther1 = string.Empty; Other1 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther1 = string.Empty;
                return;
            }

            // Strengh in numbers buff indicator
            var SiNBuff      = Hud.Game.Me.Powers.GetBuff(258199);
            int StrengthBuff = SiNBuff.IconCounts[0] * 10;

            if (StrengthBuff != 0 && !Hud.Game.Me.IsDead)
            {
                StrengthBuffText = "+" + StrengthBuff + "%";
                var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.minimap_dialog_backgroundScreen.minimap_dialog_pve.BoostWrapper.BoostsDifficultyStackPanel.clock").Rectangle;
                if (Hud.Game.Me.Hero.Seasonal)
                {
                    StrengthBuffDecorator.Paint(uiRect.Left - uiRect.Width * 1.14f, uiRect.Top + uiRect.Height * 1f, uiRect.Width, uiRect.Height, HorizontalAlign.Right);
                }
                else
                {
                    StrengthBuffDecorator.Paint(uiRect.Left - uiRect.Width * 0.96f, uiRect.Top + uiRect.Height * 1f, uiRect.Width, uiRect.Height, HorizontalAlign.Right);
                }
            }

            // Thread between players
            var players = Hud.Game.Players.Where(player => !player.IsMe).OrderBy(player => player.PortraitIndex);

            if (players != null)
            {
                foreach (var player in players)
                {
                    if (player == null)
                    {
                        continue;
                    }
                    else if (player.BattleTagAbovePortrait == null)
                    {
                        continue;
                    }
                    else if (player.FloorCoordinate == null)
                    {
                        continue;
                    }
                    else if (player.SnoArea == null)
                    {
                        continue;
                    }
                    else if (player.SnoArea.NameEnglish == null)
                    {
                        continue;
                    }
                    else if (double.IsNaN(player.NormalizedXyDistanceToMe))
                    {
                        continue;
                    }
                    else if (player.PortraitIndex == 1)
                    {
                        NameOther1 = player.BattleTagAbovePortrait; RealOther1 = player.FloorCoordinate; AreaOther1 = player.SnoArea.NameEnglish;
                        if (Hud.Game.NumberOfPlayersInGame == 2)
                        {
                            NameOther3 = string.Empty;
                        }
                        Other3 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther3 = string.Empty; NameOther2 = string.Empty; Other2 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther2 = string.Empty;
                        if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno && player.CoordinateKnown)
                        {
                            Other1 = player.FloorCoordinate;
                        }
                        else
                        {
                            Other1 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate);
                        }
                    }
                    else if (player.PortraitIndex == 2)
                    {
                        NameOther2 = player.BattleTagAbovePortrait; RealOther2 = player.FloorCoordinate; AreaOther2 = player.SnoArea.NameEnglish;
                        if (Hud.Game.NumberOfPlayersInGame == 3)
                        {
                            NameOther3 = string.Empty;
                        }
                        Other3 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther3 = string.Empty;
                        if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno && player.CoordinateKnown)
                        {
                            Other2 = player.FloorCoordinate;
                        }
                        else
                        {
                            Other2 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate);
                        }
                    }
                    else if (player.PortraitIndex == 3)
                    {
                        NameOther3 = player.BattleTagAbovePortrait; RealOther3 = player.FloorCoordinate; AreaOther3 = player.SnoArea.NameEnglish;
                        if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno && player.CoordinateKnown)
                        {
                            Other3 = player.FloorCoordinate;
                        }
                        else
                        {
                            Other3 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate);
                        }
                    }
                }
            }

            Hud.Render.GetMinimapCoordinates(Other1.X, Other1.Y, out float Other1OnMapX, out float Other1OnMapY);
            Hud.Render.GetMinimapCoordinates(Other2.X, Other2.Y, out float Other2OnMapX, out float Other2OnMapY);
            Hud.Render.GetMinimapCoordinates(Other3.X, Other3.Y, out float Other3OnMapX, out float Other3OnMapY);

            if (!Hud.Game.IsInTown && ThreadBetweenPlayers)
            {
                WhiteBrush.DrawLine(Other1OnMapX, Other1OnMapY, Other2OnMapX, Other2OnMapY);
                WhiteBrush.DrawLine(Other1OnMapX, Other1OnMapY, Other3OnMapX, Other3OnMapY);
                WhiteBrush.DrawLine(Other3OnMapX, Other3OnMapY, Other2OnMapX, Other2OnMapY);
            }

            // banners
            var banners = Hud.Game.Banners;

            if (banners != null)
            {
                foreach (var banner in banners)
                {
                    if (banner == null || banner.FloorCoordinate == null || !banner.FloorCoordinate.IsValid)
                    {
                        continue;
                    }
                    if (!BannersList.ContainsKey(banner.FloorCoordinate))
                    {
                        BannersList.Add(banner.FloorCoordinate, Hud.Game.CurrentRealTimeMilliseconds);
                    }
                }
            }

            float DistOther1;
            float DistOther2;
            float DistOther3;
            float ZDistOther1;
            float ZDistOther2;
            float ZDistOther3;
            float DistMe;
            float ZDistMe;

            if (BannersList != null)
            {
                foreach (var ListedBanner in BannersList.Where(b => Hud.Game.CurrentRealTimeMilliseconds < b.Value + 30000).OrderBy(b => b.Value).Take(5))
                {
                    var    BanCoord  = ListedBanner.Key;
                    long   Timeleft  = ((ListedBanner.Value + (BannerTimeSeconds * 1000) - Hud.Game.CurrentRealTimeMilliseconds) / 1000);
                    string Countdown = " " + Timeleft.ToString("f0") + "s";

                    var onScreen = BanCoord.IsOnScreen();
                    if (onScreen)
                    {
                        BannerDecorator.ToggleDecorators <GroundLabelDecorator>(false);
                    }
                    else
                    {
                        BannerDecorator.ToggleDecorators <GroundLabelDecorator>(true);
                    }

                    if (RealOther1 != null && Hud.Game.NumberOfPlayersInGame >= 2)
                    {
                        DistOther1 = RealOther1.XYDistanceTo(BanCoord); ZDistOther1 = RealOther1.ZDiffTo(BanCoord);
                    }
                    else
                    {
                        DistOther1 = float.MaxValue; ZDistOther1 = float.MaxValue;
                    }
                    if (RealOther2 != null && Hud.Game.NumberOfPlayersInGame >= 3)
                    {
                        DistOther2 = RealOther2.XYDistanceTo(BanCoord); ZDistOther2 = RealOther2.ZDiffTo(BanCoord);
                    }
                    else
                    {
                        DistOther2 = float.MaxValue; ZDistOther2 = float.MaxValue;
                    }
                    if (RealOther3 != null && Hud.Game.NumberOfPlayersInGame == 4)
                    {
                        DistOther3 = RealOther3.XYDistanceTo(BanCoord); ZDistOther3 = RealOther3.ZDiffTo(BanCoord);
                    }
                    else
                    {
                        DistOther3 = float.MaxValue; ZDistOther3 = float.MaxValue;
                    }
                    DistMe  = Hud.Game.Me.FloorCoordinate.XYDistanceTo(BanCoord);
                    ZDistMe = Hud.Game.Me.FloorCoordinate.ZDiffTo(BanCoord);

                    string NearestPlayer = string.Empty;
                    string BannerArea    = string.Empty;

                    if (!BannersAreas.ContainsKey(BanCoord))
                    {
                        if (DistOther1 < DistOther2 && DistOther1 < DistOther3 && DistOther1 < DistMe && DistOther1 < 200f && ZDistOther1 < 6f && NameOther1 != null)
                        {
                            NearestPlayer = "banner near " + NameOther1; BannerArea = AreaOther1;
                        }
                        else if (DistOther2 < DistOther1 && DistOther2 < DistOther3 && DistOther2 < DistMe && DistOther2 < 200f && ZDistOther2 < 6f && NameOther2 != null)
                        {
                            NearestPlayer = "banner near " + NameOther2; BannerArea = AreaOther2;
                        }
                        else if (DistOther3 < DistOther1 && DistOther3 < DistOther2 && DistOther3 < DistMe && DistOther3 < 200f && ZDistOther3 < 6f && NameOther3 != null)
                        {
                            NearestPlayer = "banner near " + NameOther3; BannerArea = AreaOther3;
                        }
                        else
                        {
                            NearestPlayer = "banner"; BannerArea = Hud.Game.Me.SnoArea.NameEnglish;
                        }
                    }
                    else
                    {
                        if (DistOther1 < DistOther2 && DistOther1 < DistOther3 && DistOther1 < DistMe && DistOther1 < 200f && ZDistOther1 < 6f && BannersAreas[BanCoord] == AreaOther1 && NameOther1 != null)
                        {
                            NearestPlayer = "banner near " + NameOther1;
                        }
                        else if (DistOther2 < DistOther1 && DistOther2 < DistOther3 && DistOther2 < DistMe && DistOther2 < 200f && ZDistOther2 < 6f && BannersAreas[BanCoord] == AreaOther2 && NameOther2 != null)
                        {
                            NearestPlayer = "banner near " + NameOther2;
                        }
                        else if (DistOther3 < DistOther1 && DistOther3 < DistOther2 && DistOther3 < DistMe && DistOther3 < 200f && ZDistOther3 < 6f && BannersAreas[BanCoord] == AreaOther3 && NameOther3 != null)
                        {
                            NearestPlayer = "banner near " + NameOther3;
                        }
                        else
                        {
                            NearestPlayer = "banner";
                        }
                    }

                    string RealBannerArea = string.Empty;
                    if (!BannersAreas.ContainsKey(BanCoord))
                    {
                        BannersAreas.Add(BanCoord, BannerArea);
                    }
                    else
                    {
                        RealBannerArea = BannersAreas[BanCoord];
                    }
                    bool SameArea = false;
                    if (Hud.Game.Me.SnoArea.NameEnglish == RealBannerArea)
                    {
                        SameArea = true;
                    }
                    else
                    {
                        SameArea = false;
                    }
                    if (!SameArea || Hud.Game.Me.IsInTown)
                    {
                        BannerDecorator.ToggleDecorators <MapShapeDecorator>(false);
                    }
                    else if (SameArea)
                    {
                        BannerDecorator.ToggleDecorators <MapShapeDecorator>(true);
                    }

                    if (NearestPlayer == "banner near ")
                    {
                        NearestPlayer = "banner";
                    }
                    if (RealBannerArea.Contains("[TEMP]"))
                    {
                        RealBannerArea = RealBannerArea.Replace("[TEMP]", string.Empty).Trim();
                    }
                    if (RealBannerArea.Contains("Loot Run"))
                    {
                        RealBannerArea = RealBannerArea.Replace("Loot Run", "Rift").Trim();
                    }

                    if (NearestPlayer != null && RealBannerArea != string.Empty)
                    {
                        if (SameArea)
                        {
                            BannerDecorator.Paint(layer, null, BanCoord, NearestPlayer + Countdown);
                        }
                        else if (NearestPlayer != "banner")
                        {
                            BannerDecorator.Paint(layer, null, BanCoord, NearestPlayer + " in " + RealBannerArea + Environment.NewLine + "teleport!" + Countdown);
                        }
                        else
                        {
                            BannerDecorator.Paint(layer, null, BanCoord, NearestPlayer + " in " + RealBannerArea + Countdown);
                        }
                    }
                }
            }
        }
Example #2
0
        public void PaintWorld(WorldLayer layer)
        {
            DistYards = 0;
            bool FirstQuestMarker = true;
            var  Actors           = Hud.Game.Actors.Where(a => a.SnoActor.Sno == 432770 || a.SnoActor.Sno == 430733 || a.SnoActor.Sno == 432885 || a.SnoActor.Sno == 433051 ||
                                                          a.SnoActor.Sno == 432259 || a.SnoActor.Sno == 433246 || a.SnoActor.Sno == 433385 || a.SnoActor.Sno == 433295 || a.SnoActor.Sno == 433316 ||
                                                          a.SnoActor.Sno == 434366 || a.SnoActor.Sno == 433124 || a.SnoActor.Sno == 433184 || a.SnoActor.Sno == 433402 || a.SnoActor.Sno == 432331 ||
                                                          a.SnoActor.Sno == 435703);

            if (!Actors.Any())
            {
                FirstQuestMarker = true;
            }
            foreach (var Actor in Actors)
            {
                if (Actor == null)
                {
                    continue;
                }
                if (Actor.FloorCoordinate == null)
                {
                    continue;
                }
                if (Actor.IsDisabled || Actor.IsOperated)
                {
                    continue;
                }

                uint   ThatQuest = 0;
                string Name      = string.Empty;
                switch (Actor.SnoActor.Sno)
                {
                case 432770: Name = "Royal Cocoon"; ThatQuest = 432784; break;

                case 430733: Name = "Captured Villager"; ThatQuest = 430723; break;

                case 432885: Name = "Ancient Device"; ThatQuest = 433025; break;

                case 433051: Name = "Caldeum Villager"; ThatQuest = 433053; break;

                case 435703: Name = "Captured Barbarian"; ThatQuest = 436280; break;

                case 432259: Name = "Triune Monument"; ThatQuest = 432293;  break;

                case 433246: Name = "Death Orb"; ThatQuest = 433256; break;

                case 433385: Name = "Catapult Winch"; ThatQuest = 433392; break;

                case 433295: Name = "Demon Gate"; ThatQuest = 433309; break;

                case 433316: Name = "Death Prison"; ThatQuest = 433339; break;

                case 434366: Name = "Tortured Wortham Militia"; ThatQuest = 434378; break;

                case 433184: Name = "Captured Guard"; ThatQuest = 433217; break;

                case 433124: Name = "Bone Cage"; ThatQuest = 433099; break;

                case 433402: Name = "Hell Portal"; ThatQuest = 433422; break;

                case 432331: Name = "Captured Iron Wolf"; ThatQuest = 432334; break;

                default:  Name = string.Empty;  break;
                }
                var quest = Hud.Game.Bounties.FirstOrDefault(x => x.SnoQuest.Sno == ThatQuest);
                if ((quest != null) && quest.State != QuestState.completed)
                {
                    QuestDecorator.Paint(layer, null, Actor.FloorCoordinate, Name);
                    FirstQuestMarker = false;
                }
            }

            // modified Xenthalon's AdvancedMarkerPlugin
            var markers = Hud.Game.Markers.OrderBy(i => Hud.Game.Me.FloorCoordinate.XYDistanceTo(i.FloorCoordinate));

            if (markers != null)
            {
                foreach (var marker in markers)
                {
                    if (marker == null)
                    {
                        continue;
                    }
                    if (marker.FloorCoordinate == null)
                    {
                        continue;
                    }
                    if (marker.Name == null)
                    {
                        continue;
                    }

                    var OnScreen = marker.FloorCoordinate.IsOnScreen(1);
                    QuestDecorator.ToggleDecorators <GroundLabelDecorator>(!OnScreen); // do not display ground labels when the marker is on the screen
                    KeywardenDecorator.ToggleDecorators <GroundLabelDecorator>(!OnScreen);
                    BossDecorator.ToggleDecorators <GroundLabelDecorator>(!OnScreen);

                    if (marker.SnoQuest != null && FirstQuestMarker)
                    {
                        DistYards = (int)(marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate));
                        QuestDecorator.Paint(layer, null, marker.FloorCoordinate, marker.Name);
                        FirstQuestMarker = false;
                    }
                    else if (marker.SnoActor != null)
                    {
                        if (marker.SnoActor.Code.Contains("_Boss_"))
                        {
                            BossDecorator.Paint(layer, null, marker.FloorCoordinate, marker.Name);
                        }
                        else if (marker.FloorCoordinate.XYDistanceTo(Hud.Game.Me.FloorCoordinate) < 500)
                        {
                            KeywardenDecorator.Paint(layer, null, marker.FloorCoordinate, marker.Name);
                        }
                    }
                }
            }


            if (Hud.Game.NumberOfPlayersInGame == 1)
            {
                NameOther3 = string.Empty; Other3 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther3 = string.Empty; StrengthBuff3 = 0;
                NameOther2 = string.Empty; Other2 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther2 = string.Empty; StrengthBuff2 = 0;
                NameOther1 = string.Empty; Other1 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther1 = string.Empty; StrengthBuff1 = 0;
                return;
            }


            // Pools of reflection
            if (Pools)
            {
                var PoolsOfReflection = Hud.Game.Shrines.Where(p => !p.IsDisabled && !p.IsOperated && p.Type == ShrineType.PoolOfReflection);
                //var PoolsOfReflection = Hud.Game.Actors.Where(x => !x.IsDisabled && !x.IsOperated && x.SnoActor.Sno == 373463);

                foreach (var PoolOfReflection in PoolsOfReflection)
                {
                    PoolDecorator.Paint(layer, null, PoolOfReflection.FloorCoordinate, PoolOfReflection.SnoActor.NameLocalized);
                }
            }


            // Strengh in numbers buff indicator
            int StrengthBuff = StrengthBuff1 + StrengthBuff2 + StrengthBuff3;

            if (StrengthBuff != 0 && !Hud.Game.Me.IsDead)
            {
                StrengthBuffText = "+" + StrengthBuff + "%";
                var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.minimap_dialog_backgroundScreen.minimap_dialog_pve.BoostWrapper.BoostsDifficultyStackPanel.clock").Rectangle;
                StrengthBuffDecorator.Paint(uiRect.Left - uiRect.Width * 1.14f, uiRect.Top + uiRect.Height * 1f, uiRect.Width, uiRect.Height, HorizontalAlign.Right);
            }

            // Thread between players
            var players = Hud.Game.Players.Where(player => !player.IsMe).OrderBy(player => player.PortraitIndex);

            if (players != null)
            {
                foreach (var player in players)
                {
                    if (player == null)
                    {
                        continue;
                    }
                    else if (player.BattleTagAbovePortrait == null)
                    {
                        continue;
                    }
                    else if (player.FloorCoordinate == null)
                    {
                        continue;
                    }
                    else if (player.SnoArea == null)
                    {
                        continue;
                    }
                    else if (player.SnoArea.NameEnglish == null)
                    {
                        continue;
                    }
                    else if (double.IsNaN(player.NormalizedXyDistanceToMe))
                    {
                        continue;
                    }
                    else if (player.PortraitIndex == 1)
                    {
                        NameOther1 = player.BattleTagAbovePortrait; RealOther1 = player.FloorCoordinate; AreaOther1 = player.SnoArea.NameEnglish;
                        if (Hud.Game.NumberOfPlayersInGame == 2)
                        {
                            NameOther3 = string.Empty;
                        }
                        Other3 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther3 = string.Empty; StrengthBuff3 = 0; NameOther2 = string.Empty; Other2 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther2 = string.Empty; StrengthBuff2 = 0;
                        if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno)
                        {
                            Other1 = player.FloorCoordinate;
                            if (player.NormalizedXyDistanceToMe <= 186 && !player.IsDead)
                            {
                                StrengthBuff1 = 10;
                            }
                            else
                            {
                                StrengthBuff1 = 0;
                            }
                        }
                        else
                        {
                            Other1 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); StrengthBuff1 = 0;
                        }
                    }

                    else if (player.PortraitIndex == 2)
                    {
                        NameOther2 = player.BattleTagAbovePortrait; RealOther2 = player.FloorCoordinate; AreaOther2 = player.SnoArea.NameEnglish;
                        if (Hud.Game.NumberOfPlayersInGame == 3)
                        {
                            NameOther3 = string.Empty;
                        }
                        Other3 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); AreaOther3 = string.Empty; StrengthBuff3 = 0;
                        if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno)
                        {
                            Other2 = player.FloorCoordinate;
                            if (player.NormalizedXyDistanceToMe <= 186 && !player.IsDead)
                            {
                                StrengthBuff2 = 10;
                            }
                            else
                            {
                                StrengthBuff2 = 0;
                            }
                        }
                        else
                        {
                            Other2 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); StrengthBuff2 = 0;
                        }
                    }

                    else if (player.PortraitIndex == 3)
                    {
                        NameOther3 = player.BattleTagAbovePortrait; RealOther3 = player.FloorCoordinate; AreaOther3 = player.SnoArea.NameEnglish;
                        if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno)
                        {
                            Other3 = player.FloorCoordinate;
                            if (player.NormalizedXyDistanceToMe <= 186 && !player.IsDead)
                            {
                                StrengthBuff3 = 10;
                            }
                            else
                            {
                                StrengthBuff3 = 0;
                            }
                        }
                        else
                        {
                            Other3 = Hud.Window.CreateWorldCoordinate(Hud.Game.Me.FloorCoordinate); StrengthBuff3 = 0;
                        }
                    }
                }
            }

            float Other1OnMapX, Other1OnMapY, Other2OnMapX, Other2OnMapY, Other3OnMapX, Other3OnMapY;

            Hud.Render.GetMinimapCoordinates(Other1.X, Other1.Y, out Other1OnMapX, out Other1OnMapY);
            Hud.Render.GetMinimapCoordinates(Other2.X, Other2.Y, out Other2OnMapX, out Other2OnMapY);
            Hud.Render.GetMinimapCoordinates(Other3.X, Other3.Y, out Other3OnMapX, out Other3OnMapY);

            if (!Hud.Game.IsInTown && ThreadBetweenPlayers)
            {
                WhiteBrush.DrawLine(Other1OnMapX, Other1OnMapY, Other2OnMapX, Other2OnMapY);
                WhiteBrush.DrawLine(Other1OnMapX, Other1OnMapY, Other3OnMapX, Other3OnMapY);
                WhiteBrush.DrawLine(Other3OnMapX, Other3OnMapY, Other2OnMapX, Other2OnMapY);
            }

            // banners
            var banners = Hud.Game.Banners;

            if (banners != null)
            {
                foreach (var banner in banners)
                {
                    if (banner == null || banner.FloorCoordinate == null || !banner.FloorCoordinate.IsValid)
                    {
                        continue;
                    }
                    if (!BannersList.ContainsKey(banner.FloorCoordinate))
                    {
                        BannersList.Add(banner.FloorCoordinate, Hud.Game.CurrentRealTimeMilliseconds);
                    }
                }
            }

            float DistOther1;
            float DistOther2;
            float DistOther3;
            float ZDistOther1;
            float ZDistOther2;
            float ZDistOther3;
            float DistMe;
            float ZDistMe;

            if (BannersList != null)
            {
                foreach (var ListedBanner in BannersList.Where(b => Hud.Game.CurrentRealTimeMilliseconds < b.Value + 30000).OrderBy(b => b.Value).Take(5))
                {
                    var    BanCoord  = ListedBanner.Key;
                    long   Timeleft  = ((ListedBanner.Value + (BannerTimeSeconds * 1000) - Hud.Game.CurrentRealTimeMilliseconds) / 1000);
                    string Countdown = " " + Timeleft.ToString("f0") + "s";


                    var onScreen = BanCoord.IsOnScreen();
                    if (onScreen)
                    {
                        BannerDecorator.ToggleDecorators <GroundLabelDecorator>(false);
                    }
                    else
                    {
                        BannerDecorator.ToggleDecorators <GroundLabelDecorator>(true);
                    }


                    if (RealOther1 != null && Hud.Game.NumberOfPlayersInGame >= 2)
                    {
                        DistOther1 = RealOther1.XYDistanceTo(BanCoord); ZDistOther1 = RealOther1.ZDiffTo(BanCoord);
                    }
                    else
                    {
                        DistOther1 = float.MaxValue; ZDistOther1 = float.MaxValue;
                    }
                    if (RealOther2 != null && Hud.Game.NumberOfPlayersInGame >= 3)
                    {
                        DistOther2 = RealOther2.XYDistanceTo(BanCoord); ZDistOther2 = RealOther2.ZDiffTo(BanCoord);
                    }
                    else
                    {
                        DistOther2 = float.MaxValue; ZDistOther2 = float.MaxValue;
                    }
                    if (RealOther3 != null && Hud.Game.NumberOfPlayersInGame == 4)
                    {
                        DistOther3 = RealOther3.XYDistanceTo(BanCoord); ZDistOther3 = RealOther3.ZDiffTo(BanCoord);
                    }
                    else
                    {
                        DistOther3 = float.MaxValue; ZDistOther3 = float.MaxValue;
                    }
                    DistMe  = Hud.Game.Me.FloorCoordinate.XYDistanceTo(BanCoord);
                    ZDistMe = Hud.Game.Me.FloorCoordinate.ZDiffTo(BanCoord);

                    string NearestPlayer = string.Empty;
                    string BannerArea    = string.Empty;

                    if (!BannersAreas.ContainsKey(BanCoord))
                    {
                        if (DistOther1 < DistOther2 && DistOther1 < DistOther3 && DistOther1 < DistMe && DistOther1 < 200f && ZDistOther1 < 6f && NameOther1 != null)
                        {
                            NearestPlayer = "banner near " + NameOther1; BannerArea = AreaOther1;
                        }
                        else if (DistOther2 < DistOther1 && DistOther2 < DistOther3 && DistOther2 < DistMe && DistOther2 < 200f && ZDistOther2 < 6f && NameOther2 != null)
                        {
                            NearestPlayer = "banner near " + NameOther2; BannerArea = AreaOther2;
                        }
                        else if (DistOther3 < DistOther1 && DistOther3 < DistOther2 && DistOther3 < DistMe && DistOther3 < 200f && ZDistOther3 < 6f && NameOther3 != null)
                        {
                            NearestPlayer = "banner near " + NameOther3; BannerArea = AreaOther3;
                        }
                        else
                        {
                            NearestPlayer = "banner"; BannerArea = Hud.Game.Me.SnoArea.NameEnglish;
                        }
                    }
                    else
                    {
                        if (DistOther1 < DistOther2 && DistOther1 < DistOther3 && DistOther1 < DistMe && DistOther1 < 200f && ZDistOther1 < 6f && BannersAreas[BanCoord] == AreaOther1 && NameOther1 != null)
                        {
                            NearestPlayer = "banner near " + NameOther1;
                        }
                        else if (DistOther2 < DistOther1 && DistOther2 < DistOther3 && DistOther2 < DistMe && DistOther2 < 200f && ZDistOther2 < 6f && BannersAreas[BanCoord] == AreaOther2 && NameOther2 != null)
                        {
                            NearestPlayer = "banner near " + NameOther2;
                        }
                        else if (DistOther3 < DistOther1 && DistOther3 < DistOther2 && DistOther3 < DistMe && DistOther3 < 200f && ZDistOther3 < 6f && BannersAreas[BanCoord] == AreaOther3 && NameOther3 != null)
                        {
                            NearestPlayer = "banner near " + NameOther3;
                        }
                        else
                        {
                            NearestPlayer = "banner";
                        }
                    }

                    string RealBannerArea = string.Empty;
                    if (!BannersAreas.ContainsKey(BanCoord))
                    {
                        BannersAreas.Add(BanCoord, BannerArea);
                    }
                    else
                    {
                        RealBannerArea = BannersAreas[BanCoord];
                    }
                    bool SameArea = false;
                    if (Hud.Game.Me.SnoArea.NameEnglish == RealBannerArea)
                    {
                        SameArea = true;
                    }
                    else
                    {
                        SameArea = false;
                    }
                    if (!SameArea || Hud.Game.Me.IsInTown)
                    {
                        BannerDecorator.ToggleDecorators <MapShapeDecorator>(false);
                    }
                    else if (SameArea)
                    {
                        BannerDecorator.ToggleDecorators <MapShapeDecorator>(true);
                    }

                    if (NearestPlayer == "banner near ")
                    {
                        NearestPlayer = "banner";
                    }
                    if (RealBannerArea.Contains("[TEMP]"))
                    {
                        RealBannerArea = RealBannerArea.Replace("[TEMP]", string.Empty).Trim();
                    }
                    if (RealBannerArea.Contains("Loot Run"))
                    {
                        RealBannerArea = RealBannerArea.Replace("Loot Run", "Rift").Trim();
                    }

                    if (NearestPlayer != null && RealBannerArea != string.Empty)
                    {
                        if (SameArea)
                        {
                            BannerDecorator.Paint(layer, null, BanCoord, NearestPlayer + Countdown);
                        }
                        else if (NearestPlayer != "banner")
                        {
                            BannerDecorator.Paint(layer, null, BanCoord, NearestPlayer + " in " + RealBannerArea + Environment.NewLine + "teleport!" + Countdown);
                        }
                        else
                        {
                            BannerDecorator.Paint(layer, null, BanCoord, NearestPlayer + " in " + RealBannerArea + Countdown);
                        }
                    }
                }
            }
        }
Example #3
0
        public void PaintWorld(WorldLayer layer)
        {
            if (Hud.Game.IsInTown || Hud.Game.NumberOfPlayersInGame == 1)
            {
                return;
            }

            int StrengthBuff = StrengthBuff1 + StrengthBuff2 + StrengthBuff3;

            if (StrengthBuff != 0 && !Hud.Game.Me.IsDead)
            {
                StrengthBuffText = "+" + StrengthBuff + "%";
                var uiRect = Hud.Render.GetUiElement("Root.NormalLayer.minimap_dialog_backgroundScreen.minimap_dialog_pve.BoostWrapper.BoostsDifficultyStackPanel.clock").Rectangle;
                StrengthBuffDecorator.Paint(uiRect.Left - uiRect.Width * 1.14f, uiRect.Top + uiRect.Height * 1f, uiRect.Width, uiRect.Height, HorizontalAlign.Right);
            }

            var players = Hud.Game.Players.Where(player => !player.IsMe).OrderBy(player => player.PortraitIndex);

            foreach (var player in players)
            {
                if (player.Index == null)
                {
                    continue;
                }
                else if (player.PortraitIndex == 1)
                {
                    if (Hud.Game.NumberOfPlayersInGame == 2)
                    {
                        Other3 = Hud.Game.Me.FloorCoordinate;
                    }
                    AreaOther3 = 0; StrengthBuff3 = 0; Other2 = Hud.Game.Me.FloorCoordinate; AreaOther2 = 0; StrengthBuff2 = 0;
                    if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno && player.CoordinateKnown)
                    {
                        Other1 = player.FloorCoordinate; AreaOther1 = player.SnoArea.Sno;
                        if (player.NormalizedXyDistanceToMe <= 186.5 && !player.IsDead)
                        {
                            StrengthBuff1 = 10;
                        }
                        else
                        {
                            StrengthBuff1 = 0;
                        }
                    }
                    else
                    {
                        Other1 = Hud.Game.Me.FloorCoordinate; AreaOther1 = player.SnoArea.Sno; StrengthBuff1 = 0;
                    }
                }

                else if (player.PortraitIndex == 2)
                {
                    if (Hud.Game.NumberOfPlayersInGame == 3)
                    {
                        Other3 = Hud.Game.Me.FloorCoordinate;
                    }
                    AreaOther3 = 0; StrengthBuff3 = 0;
                    if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno && player.CoordinateKnown)
                    {
                        Other2 = player.FloorCoordinate; AreaOther2 = player.SnoArea.Sno;
                        if (player.NormalizedXyDistanceToMe <= 186.5 && !player.IsDead)
                        {
                            StrengthBuff2 = 10;
                        }
                        else
                        {
                            StrengthBuff2 = 0;
                        }
                    }
                    else
                    {
                        Other2 = Hud.Game.Me.FloorCoordinate; AreaOther2 = player.SnoArea.Sno; StrengthBuff2 = 0;
                    }
                }

                else if (player.PortraitIndex == 3)
                {
                    if (Hud.Game.Me.SnoArea.Sno == player.SnoArea.Sno && player.CoordinateKnown)
                    {
                        Other3 = player.FloorCoordinate; AreaOther3 = player.SnoArea.Sno;
                        if (player.NormalizedXyDistanceToMe <= 186.5 && !player.IsDead)
                        {
                            StrengthBuff3 = 10;
                        }
                        else
                        {
                            StrengthBuff3 = 0;
                        }
                    }
                    else
                    {
                        Other3 = Hud.Game.Me.FloorCoordinate; AreaOther3 = player.SnoArea.Sno; StrengthBuff3 = 0;
                    }
                }
            }

            float Other1OnMapX, Other1OnMapY;
            float Other2OnMapX, Other2OnMapY;
            float Other3OnMapX, Other3OnMapY;

            Hud.Render.GetMinimapCoordinates(Other1.X, Other1.Y, out Other1OnMapX, out Other1OnMapY);
            Hud.Render.GetMinimapCoordinates(Other2.X, Other2.Y, out Other2OnMapX, out Other2OnMapY);
            Hud.Render.GetMinimapCoordinates(Other3.X, Other3.Y, out Other3OnMapX, out Other3OnMapY);

            WhiteBrush.DrawLine(Other1OnMapX, Other1OnMapY, Other2OnMapX, Other2OnMapY);
            WhiteBrush.DrawLine(Other1OnMapX, Other1OnMapY, Other3OnMapX, Other3OnMapY);
            WhiteBrush.DrawLine(Other3OnMapX, Other3OnMapY, Other2OnMapX, Other2OnMapY);
        }