Exemple #1
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            ushort graphic = Graphic;
            ushort hue     = Hue;
            bool   partial = ItemData.IsPartialHue;

            ResetHueVector();

            if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                hue     = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE;
                partial = false;
            }
            else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                hue     = Constants.OUT_RANGE_COLOR;
                partial = false;
            }
            else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect)
            {
                hue     = Constants.DEAD_RANGE_COLOR;
                partial = false;
            }

            ShaderHueTranslator.GetHueVector(ref HueVector, hue, partial, 0);

            // ## BEGIN - END ## //
            if (ProfileManager.CurrentProfile.HighlightTileAtRange && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRange)
            {
                HueVector.X = ProfileManager.CurrentProfile.HighlightTileRangeHue;
                HueVector.Y = 1;
            }
            if (ProfileManager.CurrentProfile.HighlightTileAtRangeSpell)
            {
                if (GameCursor._spellTime >= 1 && Distance == ProfileManager.CurrentProfile.HighlightTileAtRangeRangeSpell)
                {
                    HueVector.X = ProfileManager.CurrentProfile.HighlightTileRangeHueSpell;
                    HueVector.Y = 1;
                }
            }
            if (ProfileManager.CurrentProfile.PreviewFields)
            {
                if (UOClassicCombatCollection.StaticFieldPreview(this))
                {
                    HueVector.X = 0x0040;
                    HueVector.Y = 1;
                }
                if (SelectedObject.LastObject == this)
                {
                    HueVector.X = 0x0023;
                    HueVector.Y = 1;
                }
            }
            // ## BEGIN - END ## //
            // ## BEGIN - END ## // ORIG

            /*
             * bool isTree = StaticFilters.IsTree(graphic, out _);
             *
             * if (isTree && ProfileManager.CurrentProfile.TreeToStumps)
             * {
             *  graphic = Constants.TREE_REPLACE_GRAPHIC;
             * }
             */
            // ## BEGIN - END ## // ORIG
            graphic = UOClassicCombatCollection.ArtloaderFilters(graphic);

            bool isTree = StaticFilters.IsTree(graphic, out _);

            // ## BEGIN - END ## //

            if (AlphaHue != 255)
            {
                HueVector.Z = 1f - AlphaHue / 255f;
            }

            DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector, ref DrawTransparent, ProfileManager.CurrentProfile.ShadowsEnabled && ProfileManager.CurrentProfile.ShadowsStatics && (isTree || ItemData.IsFoliage || StaticFilters.IsRock(graphic)));

            if (ItemData.IsLight)
            {
                Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22);
            }

            if (!(SelectedObject.Object == this ||
                  FoliageIndex != -1 && Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex))
            {
                if (DrawTransparent)
                {
                    return(true);
                }

                ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000);

                posX -= index.Width;
                posY -= index.Height;

                if (SelectedObject.IsPointInStatic(ArtLoader.Instance.GetTexture(graphic), posX, posY))
                {
                    SelectedObject.Object = this;
                }
            }
Exemple #2
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY, ref Vector3 hueVec)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            ushort graphic = Graphic;
            ushort hue     = Hue;
            bool   partial = ItemData.IsPartialHue;

            hueVec = Vector3.Zero;

            if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                hue     = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE;
                partial = false;
            }
            else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                hue     = Constants.OUT_RANGE_COLOR;
                partial = false;
            }
            else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect)
            {
                hue     = Constants.DEAD_RANGE_COLOR;
                partial = false;
            }

            ShaderHueTranslator.GetHueVector(ref hueVec, hue, partial, 0);

            bool isTree = StaticFilters.IsTree(graphic, out _);

            if (isTree && ProfileManager.CurrentProfile.TreeToStumps)
            {
                graphic = Constants.TREE_REPLACE_GRAPHIC;
            }

            if (AlphaHue != 255)
            {
                hueVec.Z = 1f - AlphaHue / 255f;
            }

            DrawStaticAnimated
            (
                batcher,
                graphic,
                posX,
                posY,
                ref hueVec,
                ref DrawTransparent,
                ProfileManager.CurrentProfile.ShadowsEnabled && ProfileManager.CurrentProfile.ShadowsStatics && (isTree || ItemData.IsFoliage || StaticFilters.IsRock(graphic))
            );

            if (ItemData.IsLight)
            {
                Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22);
            }

            if (!(SelectedObject.Object == this || FoliageIndex != -1 && Client.Game.GetScene <GameScene>().FoliageIndex == FoliageIndex))
            {
                if (DrawTransparent)
                {
                    return(true);
                }

                ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000);

                posX -= index.Width;
                posY -= index.Height;

                if (ArtLoader.Instance.PixelCheck
                    (
                        graphic,
                        SelectedObject.TranslatedMousePositionByViewport.X - posX,
                        SelectedObject.TranslatedMousePositionByViewport.Y - posY
                    ))
                {
                    SelectedObject.Object = this;
                }
            }
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY, float depth)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            ushort graphic = Graphic;
            ushort hue     = Hue;
            bool   partial = ItemData.IsPartialHue;

            if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                hue     = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE;
                partial = false;
            }
            else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                hue     = Constants.OUT_RANGE_COLOR;
                partial = false;
            }
            else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect)
            {
                hue     = Constants.DEAD_RANGE_COLOR;
                partial = false;
            }

            Vector3 hueVec = ShaderHueTranslator.GetHueVector(hue, partial, AlphaHue / 255f);

            bool isTree = StaticFilters.IsTree(graphic, out _);

            if (isTree && ProfileManager.CurrentProfile.TreeToStumps)
            {
                graphic = Constants.TREE_REPLACE_GRAPHIC;
            }

            DrawStaticAnimated
            (
                batcher,
                graphic,
                posX,
                posY,
                hueVec,
                ProfileManager.CurrentProfile.ShadowsEnabled && ProfileManager.CurrentProfile.ShadowsStatics && (isTree || ItemData.IsFoliage || StaticFilters.IsRock(graphic)),
                depth
            );

            if (ItemData.IsLight)
            {
                Client.Game.GetScene <GameScene>().AddLight(this, this, posX + 22, posY + 22);
            }

            return(true);
        }