Exemplo n.º 1
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || IsDisposed)
            {
                return(false);
            }

            if (Texture == null || Texture.IsDisposed)
            {
                ArtTexture texture = FileManager.Art.GetTexture(Graphic);
                Texture = texture;
                Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                FrameInfo.Width  = texture.ImageRectangle.Width;
                FrameInfo.Height = texture.ImageRectangle.Height;

                FrameInfo.X = (Texture.Width >> 1) - 22 - texture.ImageRectangle.X;
                FrameInfo.Y = Texture.Height - 44 - texture.ImageRectangle.Y;
            }

            if (_isFoliage)
            {
                if (CharacterIsBehindFoliage)
                {
                    if (AlphaHue != 76)
                    {
                        ProcessAlpha(76);
                    }
                }
                else
                {
                    if (AlphaHue != 0xFF)
                    {
                        ProcessAlpha(0xFF);
                    }
                }
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(Constants.OUT_RANGE_COLOR, 1, HueVector.Z);
            }
            else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect)
            {
                HueVector = new Vector3(Constants.DEAD_RANGE_COLOR, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue);
            }

            //MessageOverHead(batcher, position, Bounds.Y - 44);
            Engine.DebugInfo.MultiRendered++;

            base.Draw(batcher, position, objectList);
            //if (_isFoliage)
            //{
            //    if (_texture == null)
            //    {
            //        _texture = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            //        _texture.SetData(new Color[] { Color.Red });
            //    }

            //    batcher.DrawRectangle(_texture, new Rectangle((int)position.X - FrameInfo.X, (int)position.Y - FrameInfo.Y, FrameInfo.Width, FrameInfo.Height), Vector3.Zero);
            //}

            if (ItemData.IsLight)
            {
                Engine.SceneManager.GetScene <GameScene>()
                .AddLight(this, this, (int)position.X + 22, (int)position.Y + 22);
            }

            return(true);
        }
Exemplo n.º 2
0
            public ShopItem
            (
                uint serial,
                ushort graphic,
                ushort hue,
                int count,
                uint price,
                string name
            )
            {
                LocalSerial = serial;
                Graphic     = graphic;
                Hue         = hue;
                Price       = price;
                Name        = name;

                Add
                (
                    new ResizePicLine(0x39)
                {
                    X     = 10,
                    Width = 190
                }
                );

                int offY = 15;

                string itemName = StringHelper.CapitalizeAllWords(Name);

                TextureControl control;

                if (SerialHelper.IsMobile(LocalSerial))
                {
                    ushort             hue2      = Hue;
                    AnimationDirection direction = GetMobileAnimationDirection(Graphic, ref hue2, 1);

                    Add
                    (
                        control = new TextureControl
                    {
                        Texture          = direction != null ? direction.FrameCount != 0 ? direction.Frames[0] : null : null,
                        X                = 5,
                        Y                = 5 + offY,
                        AcceptMouseInput = false,
                        Hue              = Hue == 0 ? hue2 : Hue,
                        IsPartial        = TileDataLoader.Instance.StaticData[Graphic].IsPartialHue
                    }
                    );

                    if (control.Texture != null)
                    {
                        control.Width  = control.Texture.Width;
                        control.Height = control.Texture.Height;
                    }
                    else
                    {
                        control.Width  = 35;
                        control.Height = 35;
                    }

                    if (control.Width > 35)
                    {
                        control.Width = 35;
                    }

                    if (control.Height > 35)
                    {
                        control.Height = 35;
                    }
                }
                else if (SerialHelper.IsItem(LocalSerial))
                {
                    ArtTexture texture = ArtLoader.Instance.GetTexture(Graphic);

                    Add
                    (
                        control = new TextureControl
                    {
                        Texture          = texture,
                        X                = 10 - texture?.ImageRectangle.X ?? 0,
                        Y                = 5 + offY + texture?.ImageRectangle.Y ?? 0,
                        Width            = texture?.ImageRectangle.Width ?? 0,
                        Height           = texture?.ImageRectangle.Height ?? 0,
                        AcceptMouseInput = false,
                        ScaleTexture     = false,
                        Hue              = Hue,
                        IsPartial        = TileDataLoader.Instance.StaticData[Graphic].IsPartialHue
                    }
                    );
                }
                else
                {
                    return;
                }

                string subname = string.Format(ResGumps.Item0Price1, itemName, Price);

                Add
                (
                    _name = new Label
                            (
                        subname,
                        true,
                        0x219,
                        110,
                        1,
                        FontStyle.None,
                        TEXT_ALIGN_TYPE.TS_LEFT,
                        true
                            )
                {
                    X = 55,
                    Y = offY
                }
                );

                int height = Math.Max(_name.Height, control.Height) + 10;

                Add
                (
                    _amountLabel = new Label
                                   (
                        count.ToString(),
                        true,
                        0x0219,
                        35,
                        1,
                        FontStyle.None,
                        TEXT_ALIGN_TYPE.TS_RIGHT
                                   )
                {
                    X = 168,
                    Y = offY + (height >> 2)
                }
                );

                Width  = 220;
                Height = Math.Max(50, height);

                WantUpdateSize = false;

                if (World.ClientFeatures.TooltipsEnabled)
                {
                    SetTooltip(LocalSerial);
                }

                Amount = count;
            }
Exemplo n.º 3
0
        public override void Update(double totalMS, double frameMS)
        {
            if (Item != null && Item.IsDestroyed)
            {
                Item = null;
                _itemGump.Dispose();
                _itemGump = null;
            }

            if (Item != _mobile.Equipment[(int)_layer])
            {
                if (_itemGump != null)
                {
                    _itemGump.Dispose();
                    _itemGump = null;
                }

                Item = _mobile.Equipment[(int)_layer];

                if (Item != null)
                {
                    Add(_itemGump = new ItemGumpFixed(Item, 18, 18)
                    {
                        HighlightOnMouseOver = false
                    });

                    ArtTexture texture = (ArtTexture)_itemGump.Texture;
                    //int offsetX = (13 - texture.ImageRectangle.Width) >> 1;
                    //int offsetY = (14 - texture.ImageRectangle.Height) >> 1;
                    int tileX = 2;
                    int tileY = 3;
                    //tileX -= texture.ImageRectangle.X - offsetX;
                    //tileY -= texture.ImageRectangle.Y - offsetY;

                    int imgW = texture.ImageRectangle.Width;
                    int imgH = texture.ImageRectangle.Height;

                    if (imgW < 14)
                    {
                        tileX += 7 - (imgW >> 1);
                    }
                    else
                    {
                        tileX -= 2;

                        if (imgW > 18)
                        {
                            imgW = 18;
                        }
                    }

                    if (imgH < 14)
                    {
                        tileY += 7 - (imgH >> 1);
                    }
                    else
                    {
                        tileY -= 2;

                        if (imgH > 18)
                        {
                            imgH = 18;
                        }
                    }


                    _itemGump.X      = tileX;
                    _itemGump.Y      = tileY;
                    _itemGump.Width  = imgW;
                    _itemGump.Height = imgH;
                }
            }

            if (Item != null)
            {
                //    if (_canDrag && totalMS >= _pickupTime)
                //    {
                //        _canDrag = false;
                //        AttempPickUp();
                //    }

                //    if (_sendClickIfNotDClick && totalMS >= _singleClickTime)
                //    {
                //        if (!World.ClientFlags.TooltipsEnabled)
                //            GameActions.SingleClick(Item);
                //        GameActions.OpenPopupMenu(Item);
                //        _sendClickIfNotDClick = false;
                //    }

                //if (_sendClickIfNotDClick && totalMS >= _singleClickTime)
                //{
                //    _sendClickIfNotDClick = false;
                //    GameActions.SingleClick(Item);
                //}
            }

            base.Update(totalMS, frameMS);
        }
Exemplo n.º 4
0
        public void Draw(UltimaBatcher2D batcher)
        {
            if (IsDestroyed || _messages.Count == 0)
            {
                return;
            }

            int offY = 0;

            Point p = new Point();

            if (Parent != null)
            {
                p.X += Parent.RealScreenPosition.X;
                p.Y += Parent.RealScreenPosition.Y;

                _rectangle.X = Parent.RealScreenPosition.X;
                _rectangle.Y = Parent.RealScreenPosition.Y;

                if (Parent is Mobile m)
                {
                    if (m.IsGargoyle && m.IsFlying)
                    {
                        offY += 22;
                    }
                    else if (!m.IsMounted)
                    {
                        offY = -22;
                    }


                    AnimationsLoader.Instance.GetAnimationDimensions
                    (
                        m.AnimIndex,
                        m.GetGraphicForAnimation(),
                        /*(byte) m.GetDirectionForAnimation()*/
                        0,
                        /*Mobile.GetGroupForAnimation(m, isParent:true)*/
                        0,
                        m.IsMounted,
                        /*(byte) m.AnimIndex*/
                        0,
                        out int centerX,
                        out int centerY,
                        out int width,
                        out int height
                    );

                    p.X += (int)m.Offset.X + 22;
                    p.Y += (int)(m.Offset.Y - m.Offset.Z - (height + centerY + 8));
                }
                else
                {
                    ArtTexture texture = ArtLoader.Instance.GetTexture(Parent.Graphic);

                    if (texture != null)
                    {
                        p.X += 22;
                        int yValue = texture.Height >> 1;

                        if (Parent is Item it)
                        {
                            if (it.IsCorpse)
                            {
                                offY = -22;
                            }
                        }
                        else if (Parent is Static || Parent is Multi)
                        {
                            offY = -44;
                        }

                        p.Y -= yValue;
                    }
                }
            }

            p = Client.Game.Scene.Camera.WorldToScreen(p);

            foreach (TextObject item in _messages)
            {
                if (item.IsDestroyed || item.RenderedText == null || item.RenderedText.IsDestroyed)
                {
                    continue;
                }

                item.X = p.X - (item.RenderedText.Width >> 1);
                item.Y = p.Y - offY - item.RenderedText.Height - item.OffsetY;

                item.RenderedText.Draw(batcher, item.X, item.Y, item.Alpha);
                offY += item.RenderedText.Height;
            }
        }
Exemplo n.º 5
0
        public void Draw(UltimaBatcher2D batcher, int x, int y, float scale)
        {
            if (IsDestroyed || _messages.Count == 0)
            {
                return;
            }

            int screenX = ProfileManager.Current.GameWindowPosition.X;
            int screenY = ProfileManager.Current.GameWindowPosition.Y;
            int screenW = ProfileManager.Current.GameWindowSize.X;
            int screenH = ProfileManager.Current.GameWindowSize.Y;

            int offY = 0;


            if (Parent != null)
            {
                x += Parent.RealScreenPosition.X;
                y += Parent.RealScreenPosition.Y;

                _rectangle.X = Parent.RealScreenPosition.X;
                _rectangle.Y = Parent.RealScreenPosition.Y;

                if (Parent is Mobile m)
                {
                    if (m.IsGargoyle && m.IsFlying)
                    {
                        offY += 22;
                    }
                    else if (!m.IsMounted)
                    {
                        offY = -22;
                    }


                    AnimationsLoader.Instance.GetAnimationDimensions(m.AnimIndex,
                                                                     m.GetGraphicForAnimation(),
                                                                     /*(byte) m.GetDirectionForAnimation()*/ 0,
                                                                     /*Mobile.GetGroupForAnimation(m, isParent:true)*/ 0,
                                                                     m.IsMounted,
                                                                     /*(byte) m.AnimIndex*/ 0,
                                                                     out int centerX,
                                                                     out int centerY,
                                                                     out int width,
                                                                     out int height);
                    x += (int)m.Offset.X;
                    x += 22;
                    y += (int)(m.Offset.Y - m.Offset.Z - (height + centerY + 8));
                }
                else
                {
                    ArtTexture texture = ArtLoader.Instance.GetTexture(Parent.Graphic);

                    if (texture != null)
                    {
                        x += 22;
                        int yValue = texture.Height >> 1;

                        if (Parent is Item it)
                        {
                            if (it.IsCorpse)
                            {
                                offY = -22;
                            }
                        }
                        else if (Parent is Static || Parent is Multi)
                        {
                            offY = -44;
                        }

                        y -= yValue;
                    }
                }
            }


            x = (int)(x / scale);
            y = (int)(y / scale);

            x -= (int)(screenX / scale);
            y -= (int)(screenY / scale);

            x += screenX;
            y += screenY;


            foreach (var item in _messages)
            {
                ushort hue = 0;

                if (item.IsDestroyed || item.RenderedText == null || item.RenderedText.IsDestroyed)
                {
                    continue;
                }

                //if (ProfileManager.Current.HighlightGameObjects)
                //{
                //    if (SelectedObject.LastObject == item)
                //        hue = 23;
                //}
                //else if (SelectedObject.LastObject == item)
                //    hue = 23;

                item.X = x - (item.RenderedText.Width >> 1);
                item.Y = y - offY - item.RenderedText.Height - item.OffsetY;

                item.RenderedText.Draw(batcher, item.X, item.Y, item.Alpha, hue);
                offY += item.RenderedText.Height;
            }
        }
Exemplo n.º 6
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            //Engine.DebugInfo.ItemsRendered++;

            ResetHueVector();
            DrawTransparent = false;

            posX += (int)Offset.X;
            posY += (int)(Offset.Y + Offset.Z);

            if (ItemData.IsTranslucent)
            {
                HueVector.Z = 0.5f;
            }

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

            if (IsCorpse)
            {
                return(DrawCorpse(batcher, posX, posY - 3));
            }


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

            if (OnGround)
            {
                if (ItemData.IsAnimated)
                {
                    if (ProfileManager.CurrentProfile.FieldsType == 2)
                    {
                        if (StaticFilters.IsFireField(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x0020;
                        }
                        else if (StaticFilters.IsParalyzeField(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x0058;
                        }
                        else if (StaticFilters.IsEnergyField(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x0070;
                        }
                        else if (StaticFilters.IsPoisonField(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x0044;
                        }
                        else if (StaticFilters.IsWallOfStone(Graphic))
                        {
                            graphic = Constants.FIELD_REPLACE_GRAPHIC;
                            hue     = 0x038A;
                        }
                    }
                }

                if (ItemData.IsContainer && SelectedObject.SelectedContainer == this)
                {
                    hue     = 0x0035;
                    partial = false;
                }
            }

            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;
            }
            else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect)
            {
                hue = Constants.DEAD_RANGE_COLOR;
            }
            else
            {
                if (!IsLocked && !IsMulti && SelectedObject.LastObject == this)
                {
                    // TODO: check why i put this.
                    //isPartial = ItemData.Weight == 0xFF;
                    hue = 0x0035;
                }
                else if (IsHidden)
                {
                    hue = 0x038E;
                }
            }

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

            if (!IsMulti && !IsCoin && Amount > 1 && ItemData.IsStackable)
            {
                DrawStaticAnimated(batcher, graphic, posX - 5, posY - 5, ref HueVector, ref DrawTransparent);
            }

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

            if (!SerialHelper.IsValid(Serial) && IsMulti && TargetManager.TargetingState == CursorTarget.MultiPlacement)
            {
                HueVector.Z = 0.5f;
            }

            DrawStaticAnimated(batcher, graphic, posX, posY, ref HueVector, ref DrawTransparent);

            if (SelectedObject.Object == this || TargetManager.TargetingState == CursorTarget.MultiPlacement)
            {
                return(false);
            }

            ArtTexture texture = ArtLoader.Instance.GetTexture(graphic);

            if (texture != null)
            {
                ref UOFileIndex index = ref ArtLoader.Instance.GetValidRefEntry(graphic + 0x4000);

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

                if (SelectedObject.IsPointInStatic(texture, posX, posY))
                {
                    SelectedObject.Object = this;
                }
            }
Exemplo n.º 7
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            if (Texture == null || Texture.IsDisposed || _oldGraphic != Graphic)
            {
                _oldGraphic = Graphic;

                ArtTexture texture = FileManager.Art.GetTexture(Graphic);
                Texture = texture;
                Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                FrameInfo.Width  = texture.ImageRectangle.Width;
                FrameInfo.Height = texture.ImageRectangle.Height;

                FrameInfo.X = (Texture.Width >> 1) - 22 - texture.ImageRectangle.X;
                FrameInfo.Y = Texture.Height - 44 - texture.ImageRectangle.Y;
            }

            if (_isFoliage)
            {
                if (CharacterIsBehindFoliage)
                {
                    if (AlphaHue != 76)
                    {
                        ProcessAlpha(76);
                    }
                }
                else
                {
                    if (AlphaHue != 0xFF)
                    {
                        ProcessAlpha(0xFF);
                    }
                }
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector.X = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect)
            {
                HueVector.X = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else
            {
                ShaderHuesTraslator.GetHueVector(ref HueVector, Hue, _isPartialHue, 0);
            }

            Engine.DebugInfo.StaticsRendered++;
            base.Draw(batcher, position, objectList);

            if (ItemData.IsLight)
            {
                Engine.SceneManager.GetScene <GameScene>()
                .AddLight(this, this, (int)position.X + 22, (int)position.Y + 22);
            }

            if (_border)
            {
                if (_borderTexture == null)
                {
                    _borderTexture = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
                    _borderTexture.SetData(new Color[] { _borderColor });
                }
                batcher.DrawBorder(_borderTexture, new Rectangle((int)position.X - FrameInfo.X, (int)position.Y - FrameInfo.Y, FrameInfo.Width, FrameInfo.Height));
            }

            return(true);
        }
Exemplo n.º 8
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            ResetHueVector();

            if (Texture == null || Texture.IsDisposed)
            {
                ArtTexture texture = FileManager.Art.GetTexture(Graphic);
                Texture = texture;
                Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                FrameInfo.Width  = texture.ImageRectangle.Width;
                FrameInfo.Height = texture.ImageRectangle.Height;

                FrameInfo.X = (Texture.Width >> 1) - 22 - texture.ImageRectangle.X;
                FrameInfo.Y = Texture.Height - 44 - texture.ImageRectangle.Y;
            }

            if (_isFoliage)
            {
                if (CharacterIsBehindFoliage)
                {
                    if (AlphaHue != 76)
                    {
                        ProcessAlpha(76);
                    }
                }
                else
                {
                    if (AlphaHue != 0xFF)
                    {
                        ProcessAlpha(0xFF);
                    }
                }
            }


            if (Engine.Profile.Current.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                HueVector.X = 0x0023;
                HueVector.Y = 1;
            }
            else if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                HueVector.X = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && Engine.Profile.Current.EnableBlackWhiteEffect)
            {
                HueVector.X = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else
            {
                ShaderHuesTraslator.GetHueVector(ref HueVector, Hue);
            }

            Engine.DebugInfo.MultiRendered++;

            //SpriteRenderer.DrawStaticArt(Graphic, Hue, (int) position.X, (int) position.Y);
            base.Draw(batcher, posX, posY);

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

            return(true);
        }
Exemplo n.º 9
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            if (!AllowedToDraw || IsDestroyed)
            {
                return(false);
            }

            ResetHueVector();

            ushort hue   = Hue;
            float  alpha = 0;

            if (State != 0)
            {
                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_IGNORE_IN_RENDER) != 0)
                {
                    return(false);
                }

                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_INCORRECT_PLACE) != 0)
                {
                    hue = 0x002B;
                }

                if ((State & CUSTOM_HOUSE_MULTI_OBJECT_FLAGS.CHMOF_TRANSPARENT) != 0)
                {
                    if (AlphaHue >= 192)
                    {
                        alpha    = 0.25f;
                        AlphaHue = 0xFF;
                    }
                    else
                    {
                        ProcessAlpha(192);
                    }
                }
            }

            ushort graphic = Graphic;

            if (ItemData.IsFoliage)
            {
                if (CharacterIsBehindFoliage)
                {
                    if (AlphaHue != Constants.FOLIAGE_ALPHA)
                    {
                        ProcessAlpha(Constants.FOLIAGE_ALPHA);
                    }
                }
                else
                {
                    if (AlphaHue != 0xFF)
                    {
                        ProcessAlpha(0xFF);
                    }
                }
            }
            else if (ItemData.IsAnimated && _lastAnimationFrameTime < Time.Ticks)
            {
                IntPtr ptr = UOFileManager.AnimData.GetAddressToAnim(Graphic);

                if (ptr != IntPtr.Zero)
                {
                    unsafe
                    {
                        AnimDataFrame2 *animData = (AnimDataFrame2 *)ptr;

                        if (animData->FrameCount != 0)
                        {
                            graphic = (Graphic)(Graphic + animData->FrameData[AnimIndex++]);

                            if (AnimIndex >= animData->FrameCount)
                            {
                                AnimIndex = 0;
                            }

                            _lastAnimationFrameTime = Time.Ticks + (uint)(animData->FrameInterval != 0 ?
                                                                          animData->FrameInterval * Constants.ITEM_EFFECT_ANIMATION_DELAY + 25 : Constants.ITEM_EFFECT_ANIMATION_DELAY);
                        }
                    }
                }
            }


            if (Texture == null || Texture.IsDisposed || Graphic != graphic)
            {
                ArtTexture texture = UOFileManager.Art.GetTexture(graphic);
                Texture = texture;
                Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                FrameInfo.Width  = texture.ImageRectangle.Width;
                FrameInfo.Height = texture.ImageRectangle.Height;

                FrameInfo.X = (Texture.Width >> 1) - 22 - texture.ImageRectangle.X;
                FrameInfo.Y = Texture.Height - 44 - texture.ImageRectangle.Y;
            }

            if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                HueVector.X = 0x0023;
                HueVector.Y = 1;
            }
            else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                HueVector.X = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect)
            {
                HueVector.X = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else
            {
                ShaderHuesTraslator.GetHueVector(ref HueVector, hue, ItemData.IsPartialHue, alpha);
            }

            //Engine.DebugInfo.MultiRendered++;

            if (IsFromTarget)
            {
                HueVector.Z = 0.5f;
            }

            base.Draw(batcher, posX, posY);

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

            return(true);
        }
Exemplo n.º 10
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || IsDisposed)
            {
                return(false);
            }

            if (Texture == null || Texture.IsDisposed || _oldGraphic != Graphic)
            {
                _oldGraphic = Graphic;

                ArtTexture texture = FileManager.Art.GetTexture(Graphic);
                Texture = texture;
                Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                FrameInfo.Width  = texture.ImageRectangle.Width;
                FrameInfo.Height = texture.ImageRectangle.Height;

                FrameInfo.X = (Texture.Width >> 1) - 22 - texture.ImageRectangle.X;
                FrameInfo.Y = Texture.Height - 44 - texture.ImageRectangle.Y;
            }

            if (_isFoliage)
            {
                if (CharacterIsBehindFoliage)
                {
                    if (AlphaHue != 76)
                    {
                        ProcessAlpha(76);
                    }
                }
                else
                {
                    if (AlphaHue != 0xFF)
                    {
                        ProcessAlpha(0xFF);
                    }
                }
            }

            //int distance = Distance;

            //if (Engine.Profile.Current.UseCircleOfTransparency)
            //{
            //    int z = World.Player.Z + 5;

            //    bool r = true;

            //    if (!_isFoliage)
            //    {
            //        if (Z <= z - ItemData.Height)
            //            r = false;
            //        else if (z < Z && (_canBeTransparent & 0xFF) == 0)
            //            r = false;
            //    }

            //    if (r)
            //    {
            //        int distanceMax = Engine.Profile.Current.CircleOfTransparencyRadius;

            //        if (distance <= distanceMax)
            //        {
            //            if (distance <= 0)
            //                distance = 1;

            //            ProcessAlpha((byte) (235 - (200 / distance)));
            //        }
            //        else if (AlphaHue != 0xFF)
            //            ProcessAlpha(0xFF);
            //    }
            //}


            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(0x038E, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue, _isPartialHue, 0, false);
            }
            MessageOverHead(batcher, position, Bounds.Y - 44);
            Engine.DebugInfo.StaticsRendered++;
            base.Draw(batcher, position, objectList);
            //if (_isFoliage)
            //{
            //    if (_texture == null)
            //    {
            //        _texture = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            //        _texture.SetData(new Color[] {Color.Red});
            //    }

            //    batcher.DrawRectangle(_texture, new Rectangle( (int) position.X - FrameInfo.X, (int)position.Y - FrameInfo.Y, FrameInfo.Width, FrameInfo.Height), Vector3.Zero);
            //}

            return(true);
        }
Exemplo n.º 11
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || IsDisposed)
            {
                return(false);
            }

            if (Texture == null || Texture.IsDisposed)
            {
                ArtTexture texture = FileManager.Art.GetTexture(Graphic);
                Texture = texture;
                Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                FrameInfo.X      = texture.ImageRectangle.X;
                FrameInfo.Y      = texture.ImageRectangle.Y;
                FrameInfo.Width  = texture.ImageRectangle.Width;
                FrameInfo.Height = texture.ImageRectangle.Height;
            }

            int distance = Distance;

            if (Engine.Profile.Current.UseCircleOfTransparency)
            {
                int z = World.Player.Z + 5;

                bool r = true;

                if (Z <= z - ItemData.Height)
                {
                    r = false;
                }
                else if (z < Z && (_canBeTransparent & 0xFF) == 0)
                {
                    r = false;
                }

                if (r)
                {
                    int distanceMax = Engine.Profile.Current.CircleOfTransparencyRadius;

                    if (distance <= distanceMax)
                    {
                        if (distance <= 0)
                        {
                            distance = 1;
                        }

                        ProcessAlpha((byte)(235 - (200 / distance)));
                    }
                    else if (AlphaHue != 0xFF)
                    {
                        ProcessAlpha(0xFF);
                    }
                }
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && distance > World.ViewRange)
            {
                HueVector = new Vector3(0x038E, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue);
            }

            MessageOverHead(batcher, position, Bounds.Y - 44);
            Engine.DebugInfo.MultiRendered++;
            return(base.Draw(batcher, position, objectList));
        }
Exemplo n.º 12
0
        public override bool Draw(SpriteBatch3D spriteBatch, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || GameObject.IsDisposed)
            {
                return(false);
            }
            Static st = (Static)GameObject;

            if (st.Effect == null)
            {
                if (Texture == null || Texture.IsDisposed)
                {
                    ArtTexture texture = Art.GetStaticTexture(GameObject.Graphic);
                    Texture = texture;
                    Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                    FrameInfo.X      = texture.ImageRectangle.X;
                    FrameInfo.Y      = texture.ImageRectangle.Y;
                    FrameInfo.Width  = texture.ImageRectangle.Width;
                    FrameInfo.Height = texture.ImageRectangle.Height;
                }

                if (_isFoliage)
                {
                    bool check = World.Player.Position.X <= st.Position.X && World.Player.Position.Y <= st.Position.Y;

                    if (!check)
                    {
                        check = World.Player.Position.Y <= st.Position.Y && World.Player.Position.X <= st.Position.X + 1;

                        if (!check)
                        {
                            check = World.Player.Position.X <= st.Position.X && World.Player.Position.Y <= st.Position.Y + 1;
                        }
                    }

                    if (check)
                    {
                        Rectangle fol = Rectangle.Empty;
                        fol.X = (int)position.X - Bounds.X + 22;
                        fol.Y = (int)position.Y - Bounds.Y + 22;

                        fol.Width  = FrameInfo.Width;
                        fol.Height = FrameInfo.Height;

                        if (fol.InRect(World.Player.View.GetOnScreenRectangle()))
                        {
                            if (_timeToProcessAlpha < CoreGame.Ticks)
                            {
                                _timeToProcessAlpha = CoreGame.Ticks + Constants.ALPHA_TIME;
                                if (!_isProcessingAlpha)
                                {
                                    _alpha += .1f;
                                }

                                if (_alpha >= Constants.FOLIAGE_ALPHA)
                                {
                                    _isProcessingAlpha = true;
                                    _alpha             = Constants.FOLIAGE_ALPHA;
                                }
                            }
                        }
                        else
                        {
                            if (_alpha != 0.0f && _isProcessingAlpha)
                            {
                                if (_timeToProcessAlpha < CoreGame.Ticks)
                                {
                                    _timeToProcessAlpha = CoreGame.Ticks + Constants.ALPHA_TIME;


                                    if (_isProcessingAlpha)
                                    {
                                        _alpha -= .1f;
                                    }

                                    if (_alpha <= 0.0f)
                                    {
                                        _isProcessingAlpha = false;
                                        _alpha             = 0;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        if (_alpha != 0.0f && _isProcessingAlpha)
                        {
                            if (_timeToProcessAlpha < CoreGame.Ticks)
                            {
                                _timeToProcessAlpha = CoreGame.Ticks + Constants.ALPHA_TIME;


                                if (_isProcessingAlpha)
                                {
                                    _alpha -= .1f;
                                }

                                if (_alpha <= 0.0f)
                                {
                                    _isProcessingAlpha = false;
                                    _alpha             = 0;
                                }
                            }
                        }
                    }
                }

                HueVector = ShaderHuesTraslator.GetHueVector(GameObject.Hue, false, _alpha, false);
                MessageOverHead(spriteBatch, position, Bounds.Y);

                return(base.Draw(spriteBatch, position, objectList));
            }

            return(!st.Effect.IsDisposed && st.Effect.View.Draw(spriteBatch, position, objectList));
        }
Exemplo n.º 13
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || IsDisposed)
            {
                return(false);
            }

            if (Texture == null || Texture.IsDisposed || _oldGraphic != Graphic)
            {
                _oldGraphic = Graphic;

                ArtTexture texture = FileManager.Art.GetTexture(Graphic);
                Texture = texture;
                Bounds  = new Rectangle((Texture.Width >> 1) - 22, Texture.Height - 44, Texture.Width, Texture.Height);

                FrameInfo.Width  = texture.ImageRectangle.Width;
                FrameInfo.Height = texture.ImageRectangle.Height;

                FrameInfo.X = (Texture.Width >> 1) - 22 - texture.ImageRectangle.X;
                FrameInfo.Y = Texture.Height - 44 - texture.ImageRectangle.Y;
            }

            if (_isFoliage)
            {
                if (CharacterIsBehindFoliage)
                {
                    if (AlphaHue != 76)
                    {
                        ProcessAlpha(76);
                    }
                }
                else
                {
                    if (AlphaHue != 0xFF)
                    {
                        ProcessAlpha(0xFF);
                    }
                }
            }

            if (Engine.Profile.Current.NoColorObjectsOutOfRange && Distance > World.ViewRange)
            {
                HueVector = new Vector3(0x038E, 1, HueVector.Z);
            }
            else
            {
                HueVector = ShaderHuesTraslator.GetHueVector(Hue, _isPartialHue, 0, false);
            }

            Engine.DebugInfo.StaticsRendered++;
            base.Draw(batcher, position, objectList);

            if (_border)
            {
                if (_borderTexture == null)
                {
                    _borderTexture = new Texture2D(batcher.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
                    _borderTexture.SetData(new Color[] { _borderColor });
                }
                batcher.DrawBorder(_borderTexture, new Rectangle((int)position.X - FrameInfo.X, (int)position.Y - FrameInfo.Y, FrameInfo.Width, FrameInfo.Height));
            }

            return(true);
        }