示例#1
0
        public void PaintWorld(WorldLayer layer)
        {
            if (!init_mapping)
            {
                init();
            }
            if (Hud.Render.UiHidden)
            {
                return;
            }

            var itemGroups = Hud.Game.Items.Where(item => item.Location == ItemLocation.Floor).GroupBy(item => item.SnoItem.Sno);

            if (GroupGems)
            {
                itemGroups = Hud.Game.Items.Where(item => item.Location == ItemLocation.Floor && item.SnoItem.MainGroupCode != "gems").GroupBy(item => item.SnoItem.Sno);
                var gemGroups = Hud.Game.Items.Where(item => item.Location == ItemLocation.Floor && item.SnoItem.MainGroupCode == "gems").GroupBy(item => item.SnoItem.MainGroupCode);

                foreach (var items in gemGroups)
                {
                    var orderedItems = items.OrderBy(i => i.NormalizedXyDistanceToMe);
                    var firstItem    = orderedItems.FirstOrDefault();

                    if (firstItem == null)
                    {
                        continue;
                    }

                    if (SnoMapping.ContainsKey(firstItem.SnoItem.Sno)) //2979276674
                    {
                        var count = orderedItems.Where(i => i.FloorCoordinate.XYDistanceTo(firstItem.FloorCoordinate) <= 40).Sum(i => i.Quantity);
                        if (count > 1)
                        {
                            var Qtt = " (" + count + ")";
                            SnoMapping[firstItem.SnoItem.Sno].Paint(layer, firstItem, firstItem.FloorCoordinate, "Gems" + Qtt);
                            CountDecorator.Paint(layer, firstItem, firstItem.FloorCoordinate, count.ToString());
                        }
                        else
                        {
                            SnoMapping[firstItem.SnoItem.Sno].Paint(layer, firstItem, firstItem.FloorCoordinate, firstItem.SnoItem.NameLocalized);
                        }
                    }
                }
            }

            foreach (var items in itemGroups)
            {
                var orderedItems = items.OrderBy(i => i.NormalizedXyDistanceToMe);
                var firstItem    = orderedItems.FirstOrDefault();

                if (firstItem == null)
                {
                    continue;
                }

                if (SnoMapping.ContainsKey(items.Key))
                {
                    var count = orderedItems.Where(i => i.FloorCoordinate.XYDistanceTo(firstItem.FloorCoordinate) <= 40).Sum(i => i.Quantity);
                    if (count > 1)
                    {
                        var Qtt = " (" + count + ")";
                        SnoMapping[firstItem.SnoItem.Sno].Paint(layer, firstItem, firstItem.FloorCoordinate, firstItem.SnoItem.NameLocalized + Qtt);
                        CountDecorator.Paint(layer, firstItem, firstItem.FloorCoordinate, count.ToString());
                    }
                    else
                    {
                        SnoMapping[firstItem.SnoItem.Sno].Paint(layer, firstItem, firstItem.FloorCoordinate, firstItem.SnoItem.NameLocalized);
                    }
                }

                if (!firstItem.IsLegendary && !NoobGearMode)
                {
                    continue;
                }
                else if (!firstItem.IsLegendary && NoobGearMode && firstItem.Perfection != 0)
                {
                    if (DisplayItem((byte)firstItem.Quality))
                    {
                        if (firstItem.IsNormal)
                        {
                            NormalDecorator.Paint(layer, firstItem, firstItem.FloorCoordinate, "\u2605");
                        }
                        else if (firstItem.IsMagic)
                        {
                            MagicDecorator.Paint(layer, firstItem, firstItem.FloorCoordinate, "\u2605");
                        }
                        else if (firstItem.IsRare)
                        {
                            RareDecorator.Paint(layer, firstItem, firstItem.FloorCoordinate, "\u2605");
                        }
                    }
                }

                foreach (var item in items)
                {
                    var inKanaiCube  = Hud.Game.Me.IsCubed(item.SnoItem);
                    var canKanaiCube = !inKanaiCube && item.SnoItem.CanKanaiCube;

                    if (canKanaiCube)
                    {
                        var   cubeTexture = Hud.Texture.KanaiCubeTexture;
                        float radius;
                        Hud.Render.GetMinimapCoordinates(item.FloorCoordinate.X, item.FloorCoordinate.Y, out float mapX, out float mapY);
                        var RadiusTransformator = new StandardPingRadiusTransformator(Hud, 500)
                        {
                            RadiusMinimumMultiplier = 0.8f,
                        };
                        radius = 0.9f * Hud.Render.MinimapScale;
                        if (RadiusTransformator != null)
                        {
                            radius = RadiusTransformator.TransformRadius(radius);
                        }
                        var width  = cubeTexture.Width * radius;
                        var height = cubeTexture.Height * radius;
                        cubeTexture.Draw(mapX - width / 2, mapY - height / 2, width, height);
                    }

                    if (SameAsEquipped(item, false) && Equipped)
                    {
                        EquippedDecorator.Paint(layer, item, item.FloorCoordinate, "E");
                    }
                    else if (SameAsArmory(item) && Equipped)
                    {
                        EquippedDecorator.Paint(layer, item, item.FloorCoordinate, "\u2694");
                    }

                    if (item.AncientRank < 1 || !ShowAncientRank)
                    {
                        continue;
                    }
                    var ancientRankText = item.AncientRank == 1 ? "Ancient   ->                     <-   Ancient" : "Primal   ->                     <-   Primal";

                    if (item.SetSno != uint.MaxValue)
                    {
                        ancientRankSetDecorator.Paint(layer, item, item.FloorCoordinate, ancientRankText); // set color
                    }
                    else
                    {
                        ancientRankDecorator.Paint(layer, item, item.FloorCoordinate, ancientRankText); // legendary color
                    }
                }
            }

            /// Slain farmer
            if (SlainFarmers)
            {
                var SlainFarmer = Hud.Game.Actors.Where(x => !x.IsDisabled && !x.IsOperated && x.SnoActor.Sno >= ActorSnoEnum._loottype2_tristramvillager_male_a_corpse_01_farmer /*434676*/ && x.SnoActor.Sno <= ActorSnoEnum._tristramvillager_female_c_corpse_01_farmer /*434679*/);
                foreach (var actor in SlainFarmer)
                {
                    SlainFarmerDecorator.Paint(layer, actor, actor.FloorCoordinate, actor.SnoActor.NameLocalized);
                }
            }

            /// Horadric Cache
            if (HoradricCaches)
            {
                var HoradricCache = Hud.Game.Items.Where(item => item.Location == ItemLocation.Floor && item.SnoItem.MainGroupCode == "horadriccache");
                foreach (var cache in HoradricCache)
                {
                    HoradricCacheDecorator.Paint(layer, cache, cache.FloorCoordinate, cache.SnoItem.NameLocalized);
                    string HoradricCacheText = "Cache   ->                       <-   Cache";
                    ancientRankDecorator.Paint(layer, cache, cache.FloorCoordinate, HoradricCacheText);

                    HoradricTimer = NextHoradricSound - Hud.Game.CurrentRealTimeMilliseconds;
                    if (HoradricTimer < 0)
                    {
                        HoradricTimer = 0;
                    }
                    if (cache.NormalizedXyDistanceToMe <= 50 && HoradricTimer == 0)
                    {
                        if (!Hud.Sound.IsIngameSoundEnabled)
                        {
                            continue;
                        }
                        var soundPlayer = Hud.Sound.LoadSoundPlayer("Horadric-Cache-By-Resu.wav");

                        ThreadPool.QueueUserWorkItem(state =>
                        {
                            try
                            {
                                soundPlayer.PlaySync();
                            }
                            catch (Exception)
                            {
                            }
                        });
                        NextHoradricSound = Hud.Game.CurrentRealTimeMilliseconds + 20000;
                    }
                }
            }

            if (LoreChestsDisplay)
            {
                var loreChests = Hud.Game.Actors.Where(x => !x.IsDisabled && !x.IsOperated && x.GizmoType == GizmoType.LoreChest);
                foreach (var actor in loreChests)
                {
                    var LoreTexture = Hud.Texture.GetTexture(3651511087);
                    if (!Hud.Game.Me.IsInTown)
                    {
                        LoreTexture.Draw(actor.FloorCoordinate.X, actor.FloorCoordinate.Y, 31.5f, 49.5f, 1f);
                    }
                }
            }

            var Glow = Hud.Texture.GetTexture(1981524232);

            if (NormalChestsDisplay)
            {
                var normalChests = Hud.Game.Actors.Where(x => !x.IsDisabled && !x.IsOperated && x.SnoActor.Kind == ActorKind.ChestNormal);
                foreach (var actor in normalChests)
                {
                    var NormalTexture = Hud.Texture.GetTexture(4061587565);
                    Hud.Render.GetMinimapCoordinates(actor.FloorCoordinate.X, actor.FloorCoordinate.Y, out float textureX, out float textureY);
                    Glow.Draw(textureX - 11, textureY - 13, 28f, 33f, 1f);
                    NormalTexture.Draw(textureX - 11, textureY - 13, 22.77f, 27.06f, 1f);
                }
            }

            if (ResplendentChestsDisplay)
            {
                var resplendentChests = Hud.Game.Actors.Where(x => !x.IsDisabled && !x.IsOperated && x.SnoActor.Kind == ActorKind.Chest);
                foreach (var actor in resplendentChests)
                {
                    var RespendentTexture = Hud.Texture.GetTexture(4029005773);
                    Hud.Render.GetMinimapCoordinates(actor.FloorCoordinate.X, actor.FloorCoordinate.Y, out float textureX, out float textureY);
                    Glow.Draw(textureX - 11, textureY - 13, 31f, 36f, 1f);
                    RespendentTexture.Draw(textureX - 11, textureY - 13, 22.77f, 27.06f, 1f);
                }
            }
        }
示例#2
0
        public void PaintWorld(WorldLayer layer)
        {
            if (!init_mapping)
            {
                init();
            }
            if (Hud.Render.UiHidden)
            {
                return;
            }


            var itemGroups = Hud.Game.Items.Where(item => item.Location == ItemLocation.Floor).GroupBy(item => item.SnoItem.Sno);

            foreach (var items in itemGroups)
            {
                var orderedItems = items.OrderBy(i => i.NormalizedXyDistanceToMe);
                var firstItem    = orderedItems.FirstOrDefault();

                if (firstItem == null)
                {
                    continue;
                }

                if (SnoMapping.ContainsKey(items.Key))
                {
                    var count = orderedItems.Where(i => i.FloorCoordinate.XYDistanceTo(firstItem.FloorCoordinate) <= 40).Sum(i => i.Quantity);
                    if (count > 1)
                    {
                        var Qtt = " (" + count + ")";
                        SnoMapping[firstItem.SnoItem.Sno].Paint(layer, firstItem, firstItem.FloorCoordinate, firstItem.SnoItem.NameLocalized + Qtt);
                        CountDecorator.Paint(layer, firstItem, firstItem.FloorCoordinate, count.ToString());
                    }
                    else
                    {
                        SnoMapping[firstItem.SnoItem.Sno].Paint(layer, firstItem, firstItem.FloorCoordinate, firstItem.SnoItem.NameLocalized);
                    }
                }

                if (!firstItem.IsLegendary)
                {
                    continue;
                }
                foreach (var item in items)
                {
                    var inKanaiCube  = Hud.Game.Me.IsCubed(item.SnoItem);
                    var canKanaiCube = !inKanaiCube && item.SnoItem.CanKanaiCube;

                    if (canKanaiCube)
                    {
                        var   cubeTexture = Hud.Texture.KanaiCubeTexture;
                        float mapX, mapY, radius;
                        Hud.Render.GetMinimapCoordinates(item.FloorCoordinate.X, item.FloorCoordinate.Y, out mapX, out mapY);
                        var RadiusTransformator = new StandardPingRadiusTransformator(Hud, 500)
                        {
                            RadiusMinimumMultiplier = 0.8f,
                        };
                        radius = 0.9f * Hud.Render.MinimapScale;
                        if (RadiusTransformator != null)
                        {
                            radius = RadiusTransformator.TransformRadius(radius);
                        }
                        var width  = cubeTexture.Width * radius;
                        var height = cubeTexture.Height * radius;
                        cubeTexture.Draw(mapX - width / 2, mapY - height / 2, width, height);
                    }

                    if (SameAsEquipped(item.SnoItem.Sno) && Equipped)
                    {
                        EquippedDecorator.Paint(layer, item, item.FloorCoordinate, "E");
                    }

                    if (item.AncientRank < 1 || !ShowAncientRank)
                    {
                        continue;
                    }
                    var ancientRankText = item.AncientRank == 1 ? "Ancient   ->                     <-   Ancient" : "Primal   ->                     <-   Primal";

                    if (item.SetSno != uint.MaxValue)
                    {
                        ancientRankSetDecorator.Paint(layer, item, item.FloorCoordinate, ancientRankText); // set color
                    }
                    else
                    {
                        ancientRankDecorator.Paint(layer, item, item.FloorCoordinate, ancientRankText); // legendary color
                    }
                }
            }

            /// Slain farmer
            if (SlainFarmers)
            {
                var SlainFarmer = Hud.Game.Actors.Where(x => !x.IsDisabled && !x.IsOperated && x.SnoActor.Sno >= 434676 && x.SnoActor.Sno <= 434679);
                foreach (var actor in SlainFarmer)
                {
                    SlainFarmerDecorator.Paint(layer, actor, actor.FloorCoordinate, actor.SnoActor.NameLocalized);
                }
            }

            /// Horadric Cache
            if (HoradricCaches)
            {
                var HoradricCache = Hud.Game.Items.Where(item => item.Location == ItemLocation.Floor && item.SnoItem.MainGroupCode == "horadriccache");
                foreach (var cache in HoradricCache)
                {
                    HoradricCacheDecorator.Paint(layer, cache, cache.FloorCoordinate, cache.SnoItem.NameLocalized);
                    string HoradricCacheText = "Cache   ->                       <-   Cache";
                    ancientRankDecorator.Paint(layer, cache, cache.FloorCoordinate, HoradricCacheText);

                    HoradricTimer = NextHoradricSound - Hud.Game.CurrentRealTimeMilliseconds;
                    if (HoradricTimer < 0)
                    {
                        HoradricTimer = 0;
                    }
                    if (cache.NormalizedXyDistanceToMe <= 50 && HoradricTimer == 0)
                    {
                        if (!Hud.Sound.IsIngameSoundEnabled)
                        {
                            continue;
                        }
                        var soundPlayer = Hud.Sound.LoadSoundPlayer("Horadric-Cache-By-Resu.wav");

                        ThreadPool.QueueUserWorkItem(state =>
                        {
                            try
                            {
                                soundPlayer.PlaySync();
                            }
                            catch (Exception)
                            {
                            }
                        });
                        NextHoradricSound = Hud.Game.CurrentRealTimeMilliseconds + 20000;
                    }
                }
            }
        }