示例#1
0
        public override void OnAosSingleClick(Mobile from)
        {
            int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));
            ObjectPropertyList opl = PropertyList;

            if (opl.Header > 0)
            {
                from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, opl.Header, Name, opl.HeaderArgs));
            }
        }
示例#2
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (_gumpTexture == null || _gumpTexture.IsDisposed || IsDisposed)
            {
                return(false);
            }

            ResetHueVector();

            batcher.Draw2D(_gumpTexture, x, y, ref _hueVector);
            CreateMiniMapTexture();
            batcher.Draw2D(_mapTexture, x, y, ref _hueVector);

            if (_draw)
            {
                if (_playerIndicator == null)
                {
                    _playerIndicator = new Texture2D(batcher.GraphicsDevice, 1, 1);

                    _playerIndicator.SetData(new uint[1]
                    {
                        0xFFFFFFFF
                    });

                    _mobilesIndicator = new Texture2D(batcher.GraphicsDevice, 1, 1);
                    _mobilesIndicator.SetData(new[] { Color.White });
                }

                int w = Width >> 1;
                int h = Height >> 1;

                foreach (Mobile mob in World.Mobiles.Where(s => s != World.Player))
                {
                    int xx = mob.X - World.Player.X;
                    int yy = mob.Y - World.Player.Y;

                    int gx = xx - yy;
                    int gy = xx + yy;

                    _hueVector.Z = 0;

                    ShaderHuesTraslator.GetHueVector(ref _hueVector, Notoriety.GetHue(mob.NotorietyFlag));

                    batcher.Draw2D(_mobilesIndicator, x + w + gx, y + h + gy, 2, 2, ref _hueVector);
                }

                //DRAW DOT OF PLAYER
                ResetHueVector();
                batcher.Draw2D(_playerIndicator, x + w, y + h, 2, 2, ref _hueVector);
            }

            return(base.Draw(batcher, x, y));
        }
        public override void OnSingleClick(Mobile from)
        {
            int hue = Notoriety.GetHue(UltimaOnline.Misc.NotorietyHandlers.CorpseNotoriety(from, this));

            if (ItemID == 0x2006)                                                                              // Corpse form
            {
                from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049144, "", Name)); // the remains of ~1_NAME~ the apprentice
            }
            else
            {
                from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049145, "", "")); // the remains of a wizard's apprentice
            }
        }
示例#4
0
        public override void OnSingleClick(Mobile from)
        {
            int hue = Notoriety.GetHue(Server.Misc.NotorietyHandlers.CorpseNotoriety(from, this));

            if (ItemID == 0x2006)                                                                              // Corpse form
            {
                from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049318, "", Name)); // the remains of ~1_NAME~ the militia fighter
            }
            else
            {
                from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1049319, "", ""));                     // the remains of a militia fighter
            }
        }
示例#5
0
        public virtual void CompileEntryLayout(
            SuperGumpLayout layout, int length, int index, int pIndex, int yOffset, PlayerMobile entry)
        {
            int picID = (int)StatusGem.Pending;

            if (entry == null || entry.Deleted)
            {
                layout.Add(
                    "custom/entry/" + index,
                    () =>
                {
                    AddImage(65, 90 + (40 * pIndex), picID);
                    AddLabel(140, 94 + (40 * pIndex), 57, "[Removed]");
                    AddImageTiled(60, 120 + (40 * pIndex), 465, 10, 4201);
                    AddImage(100, 94 + (40 * pIndex), 4010);
                });

                return;
            }

            if (entry.NetState != null && entry.NetState.Running)
            {
                picID = (int)StatusGem.Claimed;
            }
            else
            {
                picID = (int)StatusGem.Void;
            }

            int textColor = Notoriety.GetHue(Notoriety.Compute(User, entry));

            layout.Add(
                "custom/entry/" + index,
                () =>
            {
                AddImage(65, 90 + (40 * pIndex), picID);
                AddLabel(
                    140,
                    94 + (40 * pIndex),
                    textColor,
                    String.Format(
                        "{0} [{1}] <{2}> ({3})",
                        entry.RawName,
                        entry.Name,
                        (entry.Guild != null) ? entry.Guild.Abbreviation : String.Empty,
                        entry.Location));

                AddImageTiled(60, 120 + (40 * pIndex), 465, 10, 4201);
                AddButton(100, 94 + (40 * pIndex), 4012, 4013, b => SelectEntry(entry));
            });
        }
示例#6
0
        protected override int GetLabelHue(int index, int pageIndex, PvPProfile entry)
        {
            if (index < 3)
            {
                return(HighlightHue);
            }

            if (entry != null)
            {
                return(Notoriety.GetHue(Notoriety.Compute(User, entry.Owner)));
            }

            return(base.GetLabelHue(index, pageIndex, null));
        }
示例#7
0
        private void BuildGump()
        {
            Entity entity = World.Get(LocalSerial);

            if (entity == null)
            {
                Dispose();
                return;
            }

            Add(_background = new AlphaBlendControl(.3f)
            {
                WantUpdateSize = false,
                Hue            = entity is Mobile m ? Notoriety.GetHue(m.NotorietyFlag) : (ushort)0x0481
            });
示例#8
0
        public override bool Draw(UltimaBatcher2D batcher, int x, int y)
        {
            if (_gumpTexture == null || _gumpTexture.IsDisposed || IsDisposed)
            {
                return(false);
            }

            ResetHueVector();

            batcher.Draw2D(_gumpTexture, x, y, ref HueVector);
            CreateMiniMapTexture();
            batcher.Draw2D(_mapTexture, x, y, ref HueVector);

            if (_draw)
            {
                int w = Width >> 1;
                int h = Height >> 1;

                Texture2D mobilesTextureDot = SolidColorTextureCache.GetTexture(Color.Red);

                foreach (Mobile mob in World.Mobiles)
                {
                    if (mob == World.Player)
                    {
                        continue;
                    }

                    int xx = mob.X - World.Player.X;
                    int yy = mob.Y - World.Player.Y;

                    int gx = xx - yy;
                    int gy = xx + yy;

                    HueVector.Z = 0;

                    ShaderHueTranslator.GetHueVector(ref HueVector, Notoriety.GetHue(mob.NotorietyFlag));

                    batcher.Draw2D(mobilesTextureDot, x + w + gx, y + h + gy, 2, 2, ref HueVector);
                }

                //DRAW DOT OF PLAYER
                ResetHueVector();
                batcher.Draw2D(SolidColorTextureCache.GetTexture(Color.White), x + w, y + h, 2, 2, ref HueVector);
            }

            return(base.Draw(batcher, x, y));
        }
示例#9
0
        public NameOverheadGump(Entity entity) : base(entity.Serial, 0)
        {
            CanMove                = false;
            AcceptMouseInput       = true;
            CanCloseWithRightClick = true;
            Entity = entity;

            Hue hue = entity is Mobile m?Notoriety.GetHue(m.NotorietyFlag) : (Hue)0x0481;

            _renderedText = RenderedText.Create(String.Empty, hue, 0xFF, true, FontStyle.BlackBorder, TEXT_ALIGN_TYPE.TS_CENTER, 100, 30, true);

            Add(_background = new AlphaBlendControl(.3f)
            {
                WantUpdateSize = false,
                Hue            = hue
            });
        }
示例#10
0
        public override void OnSingleClick(Mobile from)
        {
            int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));

            if (m_CorpseName != null)
            {
                from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", m_CorpseName));
            }
            else if (((Body)this.Amount).IsHuman || (this.Owner != null && this.Owner.Player))
            {
                from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", String.Format("a corpse of {0}", Name)));
            }
            else
            {
                from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", String.Format("remains of {0}", Name)));
            }
        }
示例#11
0
        public override void OnSingleClick(Mobile from)
        {
            if (Deleted)
            {
                return;
            }

            string str = null;

            if (Blessed)
            {
                str = String.Format("{0} (invulnerable)", Name);
            }
            else
            {
                str = Name;
            }
            PrivateOverheadMessage(Network.MessageType.Label, Notoriety.GetHue(Notoriety.Compute(from, this)), Mobile.AsciiClickMessage, str, from.NetState);
        }
示例#12
0
        public override void OnSingleClick(Mobile from)
        {
            int nameHue;

            if (NameHue != -1)
            {
                nameHue = NameHue;
            }
            else if (AccessLevel > AccessLevel.Player)
            {
                nameHue = 11;
            }
            else
            {
                nameHue = Notoriety.GetHue(Notoriety.Compute(from, this));
            }

            PrivateOverheadMessage(MessageType.Label, nameHue, AsciiClickMessage, Name, from.NetState);
        }
示例#13
0
        public override void OnSingleClick(Mobile from)
        {
            var hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));

            if (ItemID == 0x2006) // Corpse form
            {
                if (m_CorpseName != null)
                {
                    from.NetState.SendMessage(Serial, ItemID, MessageType.Label, hue, 3, true, null, "", m_CorpseName);
                }
                else
                {
                    from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name);
                }
            }
            else // Bone form
            {
                from.NetState.SendMessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name);
            }
        }
示例#14
0
        public override void OnSingleClick(Mobile from)
        {
            int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));

            if (ItemID == 0x2006) // Corpse form
            {
                if (CorpseName != null)
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", CorpseName));
                }
                else
                {
                    from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name));
                }
            }
            else // Bone form
            {
                from.Send(new MessageLocalized(Serial, ItemID, MessageType.Label, hue, 3, 1046414, "", Name));
            }
        }
示例#15
0
        public NameOverheadGump(uint serial) : base(serial, 0)
        {
            CanMove                = false;
            AcceptMouseInput       = true;
            CanCloseWithRightClick = true;

            Entity entity = World.Get(serial);

            if (entity == null)
            {
                Dispose();
                return;
            }

            _renderedText = RenderedText.Create(String.Empty, entity is Mobile m ? Notoriety.GetHue(m.NotorietyFlag) : (ushort)0x0481, 0xFF, true, FontStyle.BlackBorder, TEXT_ALIGN_TYPE.TS_CENTER, 100, 30, true);

            SetTooltip(entity);

            BuildGump();
        }
示例#16
0
        public override void OnSingleClick(Mobile from)
        {
            int hue = Notoriety.GetHue(NotorietyHandlers.CorpseNotoriety(from, this));

            if (ItemID == 0x2006)               // Corpse form
            {
                if (m_CorpseName != null)
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, "", m_CorpseName));
                }
                else
                {
                    from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, null, "the corpse of " + Name));
                }
            }
            else             // Bone form
            {
                from.Send(new AsciiMessage(Serial, ItemID, MessageType.Label, hue, 3, null, "the remains of " + Name));
            }
        }
示例#17
0
        //MAIN LOOP METHODS
        private void UpdateUI()
        {
            //REFRESH THE COUNT
            //_uiLabelcount.Text = "Count: " + entryList.Count.ToString();

            //UPDATE LAST TARGET
            if (UCCL_ToggleLastTarget)
            {
                Entity _lasttarget       = World.Get(TargetManager.LastTargetInfo.Serial);
                Mobile _lasttargetmobile = World.GetOrCreateMobile(TargetManager.LastTargetInfo.Serial);
                if (_lasttarget != null && _lasttargetmobile != null)
                {
                    _uiLabelLasttarget.Text = _lasttarget.Name;
                    _uiLabelLasttarget.Hue  = Notoriety.GetHue(_lasttargetmobile.NotorietyFlag);
                }
            }
            else
            {
                _uiLabelLasttarget.Text = "";
            }
        }
示例#18
0
        public NameOverheadGump(Entity entity) : base(entity.Serial, 0)
        {
            CanMove                = false;
            AcceptMouseInput       = true;
            CanCloseWithRightClick = true;
            Entity = entity;

            Hue hue = entity is Mobile m?Notoriety.GetHue(m.NotorietyFlag) : (Hue)999;

            //_label = new Label(string.IsNullOrEmpty(entity.Name) ? "" : entity.Name, true, hue, style: FontStyle.BlackBorder, align: TEXT_ALIGN_TYPE.TS_CENTER)
            //{
            //    X = 2,
            //    Y = 2,
            //};


            _renderedText = new RenderedText()
            {
                IsUnicode = true,
                Font      = 0xFF,
                Hue       = hue,
                FontStyle = FontStyle.BlackBorder,
                Align     = TEXT_ALIGN_TYPE.TS_CENTER,
                IsHTML    = true,
            };


            Add(_background = new AlphaBlendControl(.3f)
            {
                WantUpdateSize = false,
                //Width = _label.Width + 4,
                //Height = _label.Height + 4
            });
            // Add(_label);

            //X = (int) entity.RealScreenPosition.X;
            //Y = (int) entity.RealScreenPosition.Y;
        }
示例#19
0
        private void DrawHealthLine(UltimaBatcher2D batcher, Entity entity, int x, int y, bool passive)
        {
            if (entity == null)
            {
                return;
            }

            int per = BAR_WIDTH * entity.HitsPercentage / 100;

            Mobile mobile = entity as Mobile;


            float  alpha = passive ? 0.5f : 1.0f;
            ushort hue   = mobile != null?Notoriety.GetHue(mobile.NotorietyFlag) : Notoriety.GetHue(NotorietyFlag.Gray);

            Vector3 hueVec = ShaderHueTranslator.GetHueVector(hue, false, alpha);

            if (mobile == null)
            {
                y += 22;
            }


            const int MULTIPLER = 1;

            var texture = GumpsLoader.Instance.GetGumpTexture(BACKGROUND_GRAPHIC, out var bounds);


            batcher.Draw
            (
                texture,
                new Rectangle
                (
                    x,
                    y,
                    bounds.Width * MULTIPLER,
                    bounds.Height * MULTIPLER
                ),
                bounds,
                hueVec
            );


            hueVec.X = 0x21;


            if (entity.Hits != entity.HitsMax || entity.HitsMax == 0)
            {
                int offset = 2;

                if (per >> 2 == 0)
                {
                    offset = per;
                }

                texture = GumpsLoader.Instance.GetGumpTexture(HP_GRAPHIC, out bounds);

                batcher.DrawTiled
                (
                    texture,
                    new Rectangle
                    (
                        x + per * MULTIPLER - offset,
                        y,
                        (BAR_WIDTH - per) * MULTIPLER - offset / 2,
                        bounds.Height * MULTIPLER
                    ),
                    bounds,
                    hueVec
                );
            }

            hue = 90;

            if (per > 0)
            {
                if (mobile != null)
                {
                    if (mobile.IsPoisoned)
                    {
                        hue = 63;
                    }
                    else if (mobile.IsYellowHits)
                    {
                        hue = 53;
                    }
                }

                hueVec.X = hue;

                texture = GumpsLoader.Instance.GetGumpTexture(HP_GRAPHIC, out bounds);

                batcher.DrawTiled
                (
                    texture,
                    new Rectangle
                    (
                        x,
                        y,
                        per * MULTIPLER,
                        bounds.Height * MULTIPLER
                    ),
                    bounds,
                    hueVec
                );
            }
        }
示例#20
0
 protected override int GetLabelHue(int index, int pageIndex, TrashProfile entry)
 {
     return(index < 3
                         ? HighlightHue
                         : (entry != null ? Notoriety.GetHue(Notoriety.Compute(User, entry.Owner)) : base.GetLabelHue(index, pageIndex, null)));
 }
示例#21
0
        public override void Update(double totalMS, double frameMS)
        {
            base.Update(totalMS, frameMS);

            if (IsDisposed)
            {
                return;
            }

            if (Mobile == null || Mobile.IsDestroyed)
            {
                Dispose();
                Engine.UI.RemoveTargetLineGump(Mobile);

                return;
            }

            int per = Mobile.HitsMax;

            if (per > 0)
            {
                per = Mobile.Hits * 100 / per;

                if (per > 100)
                {
                    per = 100;
                }

                if (per < 1)
                {
                    per = 0;
                }
                else
                {
                    per = 34 * per / 100;
                }
            }

            _hp.Percent = per;

            if (Mobile.IsPoisoned)
            {
                if (_hp.Hue != 63)
                {
                    _hp.Hue = 63;
                }
            }
            else if (Mobile.IsYellowHits)
            {
                if (_hp.Hue != 53)
                {
                    _hp.Hue = 53;
                }
            }
            else if (_hp.Hue != 90)
            {
                _hp.Hue = 90;
            }


            _background.Hue = Notoriety.GetHue(Mobile.NotorietyFlag);
            ;
        }
示例#22
0
        private void BuildGump()
        {
            LocalSerial = _partyMemeberSerial;

            CanBeSaved = _partyMemeberSerial == World.Player;

            WantUpdateSize = false;

            if (World.Party.GetPartyMember(_partyMemeberSerial) != null)
            {
                Add(_background = new GumpPic(0, 0, BACKGROUND_NORMAL, 0)
                {
                    IsVisible = false
                });
                Width  = 115;
                Height = 55;

                if (CanBeSaved)
                {
                    Add(_partyNameLabel = new Label("[* SELF *]", false, 0x0386, font: 3)
                    {
                        X = 0, Y = -2
                    });
                }
                else
                {
                    Add(_partyNameLabel = new Label(_name, false, Notoriety.GetHue(Mobile.NotorietyFlag), 150, 3, FontStyle.Fixed)
                    {
                        X = 0, Y = -2
                    });
                }

                Add(_buttonHeal1 = new Button((int)ButtonParty.Heal1, 0x0938, 0x093A, 0x0938)
                {
                    ButtonAction = ButtonAction.Activate, X = 0, Y = 20
                });
                Add(_buttonHeal2 = new Button((int)ButtonParty.Heal2, 0x0939, 0x093A, 0x0939)
                {
                    ButtonAction = ButtonAction.Activate, X = 0, Y = 33
                });

                Add(_hpLineRed   = new GumpPic(18, 20, LINE_RED_PARTY, 0));
                Add(_manaLineRed = new GumpPic(18, 33, LINE_RED_PARTY, 0));
                Add(_stamLineRed = new GumpPic(18, 45, LINE_RED_PARTY, 0));

                Add(_bars[0] = new GumpPicWithWidth(18, 20, LINE_BLUE_PARTY, 0, 96));
                Add(_bars[1] = new GumpPicWithWidth(18, 33, LINE_BLUE_PARTY, 0, 96));
                Add(_bars[2] = new GumpPicWithWidth(18, 45, LINE_BLUE_PARTY, 0, 96));
            }
            else
            {
                if (CanBeSaved)
                {
                    _oldWarMode     = World.Player.InWarMode;
                    Add(_background = new GumpPic(0, 0, _oldWarMode ? BACKGROUND_WAR : BACKGROUND_NORMAL, 0));

                    Width  = _background.Texture.Width;
                    Height = _background.Texture.Height;

                    // add backgrounds
                    Add(_hpLineRed = new GumpPic(34, 12, LINE_RED, 0));
                    Add(new GumpPic(34, 25, LINE_RED, 0));
                    Add(new GumpPic(34, 38, LINE_RED, 0));

                    // add over
                    Add(_bars[0] = new GumpPicWithWidth(34, 12, LINE_BLUE, 0, 0));
                    Add(_bars[1] = new GumpPicWithWidth(34, 25, LINE_BLUE, 0, 0));
                    Add(_bars[2] = new GumpPicWithWidth(34, 38, LINE_BLUE, 0, 0));
                }
                else
                {
                    Hue color     = 0;
                    Hue textColor = 0x0386;
                    Hue hitsColor = 0x0386;

                    if (Mobile != null)
                    {
                        hitsColor = 0;
                        color     = Notoriety.GetHue(Mobile.NotorietyFlag);

                        if (Mobile.NotorietyFlag == NotorietyFlag.Criminal || Mobile.NotorietyFlag == NotorietyFlag.Gray)
                        {
                            color = 0;
                        }

                        if (_canChangeName = Mobile.IsRenamable)
                        {
                            textColor = 0x000E;
                        }
                    }

                    Add(_background = new GumpPic(0, 0, 0x0804, color));
                    Add(_hpLineRed  = new GumpPic(34, 38, LINE_RED, hitsColor));
                    Add(_bars[0]    = new GumpPicWithWidth(34, 38, LINE_BLUE, 0, 0));

                    Width  = _background.Texture.Width;
                    Height = _background.Texture.Height;


                    Add(_textBox = new TextBox(1, width: 150, isunicode: false, hue: textColor)
                    {
                        X                   = 16,
                        Y                   = 14,
                        Width               = 150,
                        IsEditable          = false,
                        AcceptMouseInput    = _canChangeName,
                        AcceptKeyboardInput = _canChangeName,
                        Text                = _name
                    });

                    if (_canChangeName)
                    {
                        _textBox.MouseClick += TextBoxOnMouseClick;
                    }
                }
            }
        }
示例#23
0
        //public MobileView(Mobile mobile) : base(mobile)
        //{

        //}

        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (IsDisposed)
            {
                return(false);
            }

            //mobile.AnimIndex = 0;

            bool mirror = false;
            byte dir    = (byte)GetDirectionForAnimation();

            FileManager.Animations.GetAnimDirection(ref dir, ref mirror);
            IsFlipped = mirror;
            SetupLayers(dir, this, out int mountOffset);

            if (Graphic == 0)
            {
                return(false);
            }

            AnimationFrameTexture bodyFrame = _frames[0].Hash; // FileManager.Animations.GetTexture(_frames[0].Hash);

            if (bodyFrame == null)
            {
                return(false);
            }

            int drawCenterY = bodyFrame.CenterY;
            int drawX;
            int drawY = mountOffset + drawCenterY + (int)(Offset.Z / 4) - 22 - (int)(Offset.Y - Offset.Z - 3);

            if (IsFlipped)
            {
                drawX = -22 + (int)Offset.X;
            }
            else
            {
                drawX = -22 - (int)Offset.X;
            }


            /*if (_frames[0].IsSitting)
             * {
             *  int x1 = 0, y1 = 0;
             *  FileManager.Animations.FixSittingDirection(ref dir, ref mirror, ref x1, ref y1);
             * }*/

            FrameInfo = Rectangle.Empty;
            Rectangle rect = Rectangle.Empty;

            Hue hue = 0, targetColor = 0;

            if (Engine.Profile.Current.HighlightMobilesByFlags)
            {
                if (IsPoisoned)
                {
                    hue = 0x0044;
                }

                if (IsParalyzed)
                {
                    hue = 0x014C;
                }

                if (NotorietyFlag != NotorietyFlag.Invulnerable && IsYellowHits)
                {
                    hue = 0x0030;
                }
            }

            bool isAttack     = Serial == World.LastAttack;
            bool isUnderMouse = IsSelected && (TargetManager.IsTargeting || World.Player.InWarMode);
            bool needHpLine   = false;

            if (this != World.Player && (isAttack || isUnderMouse || TargetManager.LastGameObject == Serial))
            {
                targetColor = Notoriety.GetHue(NotorietyFlag);

                if (isAttack || this == TargetManager.LastGameObject)
                {
                    Engine.UI.SetTargetLineGump(this);

                    //if (TargetLineGump.TTargetLineGump?.Mobile != this)
                    //{
                    //    if (TargetLineGump.TTargetLineGump == null || TargetLineGump.TTargetLineGump.IsDisposed)
                    //    {
                    //        TargetLineGump.TTargetLineGump = new TargetLineGump();
                    //        Engine.UI.Add(TargetLineGump.TTargetLineGump);
                    //    }
                    //    else
                    //    {
                    //        TargetLineGump.TTargetLineGump.SetMobile(this);
                    //    }
                    //}

                    needHpLine = true;
                }

                if (isAttack || isUnderMouse)
                {
                    hue = targetColor;
                }
            }

            for (int i = 0; i < _layerCount; i++)
            {
                ViewLayer             vl    = _frames[i];
                AnimationFrameTexture frame = vl.Hash; //FileManager.Animations.GetTexture(vl.Hash);

                if (frame.IsDisposed)
                {
                    continue;
                }
                int x = drawX + frame.CenterX;
                int y = -drawY - (frame.Height + frame.CenterY) + drawCenterY - vl.OffsetY;

                int yy = -(frame.Height + frame.CenterY + 3);
                int xx = -frame.CenterX;

                if (mirror)
                {
                    xx = -(frame.Width - frame.CenterX);
                }

                if (xx < rect.X)
                {
                    rect.X = xx;
                }

                if (yy < rect.Y)
                {
                    rect.Y = yy;
                }

                if (rect.Width < xx + frame.Width)
                {
                    rect.Width = xx + frame.Width;
                }

                if (rect.Height < yy + frame.Height)
                {
                    rect.Height = yy + frame.Height;
                }

                Texture = frame;
                Bounds  = new Rectangle(x, -y, frame.Width, frame.Height);

                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(IsHidden ? 0x038E : hue == 0 ? vl.Hue : hue, vl.IsPartial, 0, false);
                }

                base.Draw(batcher, position, objectList);
                Pick(frame, Bounds, position, objectList);
            }

            FrameInfo.X      = Math.Abs(rect.X);
            FrameInfo.Y      = Math.Abs(rect.Y);
            FrameInfo.Width  = FrameInfo.X + rect.Width;
            FrameInfo.Height = FrameInfo.Y + rect.Height;


            //if (needHpLine)
            //{
            //    //position.X += Engine.Profile.Current.GameWindowPosition.X + 9;
            //    //position.Y += Engine.Profile.Current.GameWindowPosition.Y + 30;

            //    //TargetLineGump.TTargetLineGump.X = (int)(position.X /*+ 22*/ + Offset.X);
            //    //TargetLineGump.TTargetLineGump.Y = (int)(position.Y /*+ 22 + (mobile.IsMounted ? 22 : 0) */+ Offset.Y - Offset.Z - 3);
            //    //TargetLineGump.TTargetLineGump.BackgroudHue = targetColor;

            //    //if (IsPoisoned)
            //    //    TargetLineGump.TTargetLineGump.HpHue = 63;
            //    //else if (IsYellowHits)
            //    //    TargetLineGump.TTargetLineGump.HpHue = 53;

            //    //else
            //    //    TargetLineGump.TTargetLineGump.HpHue = 90;

            //    Engine.UI.SetTargetLineGumpHue(targetColor);
            //}

            //if (_edge == null)
            //{
            //    _edge = new Texture2D(batcher.GraphicsDevice, 1, 1);
            //    _edge.SetData(new Color[] { Color.LightBlue });
            //}

            //batcher.DrawRectangle(_edge, GetOnScreenRectangle(), Vector3.Zero);
            Engine.DebugInfo.MobilesRendered++;
            return(true);
        }
示例#24
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (IsDisposed)
            {
                return(false);
            }

            bool mirror = false;
            byte dir    = (byte)GetDirectionForAnimation();

            FileManager.Animations.GetAnimDirection(ref dir, ref mirror);
            IsFlipped = mirror;

            if (Graphic == 0)
            {
                return(false);
            }


            /*if (_frames[0].IsSitting)
             * {
             *  int x1 = 0, y1 = 0;
             *  FileManager.Animations.FixSittingDirection(ref dir, ref mirror, ref x1, ref y1);
             * }*/

            FrameInfo = Rectangle.Empty;
            Rectangle rect = Rectangle.Empty;

            Hue hue = 0, targetColor = 0;

            if (Engine.Profile.Current.HighlightMobilesByFlags)
            {
                if (IsPoisoned)
                {
                    hue = 0x0044;
                }

                if (IsParalyzed)
                {
                    hue = 0x014C;
                }

                if (NotorietyFlag != NotorietyFlag.Invulnerable && IsYellowHits)
                {
                    hue = 0x0030;
                }
            }

            bool isAttack     = Serial == World.LastAttack;
            bool isUnderMouse = IsSelected && (TargetManager.IsTargeting || World.Player.InWarMode);
            bool needHpLine   = false;

            if (this != World.Player && (isAttack || isUnderMouse || TargetManager.LastGameObject == Serial))
            {
                targetColor = Notoriety.GetHue(NotorietyFlag);

                if (isAttack || this == TargetManager.LastGameObject)
                {
                    Engine.UI.SetTargetLineGump(this);
                    needHpLine = true;
                }

                if (isAttack || isUnderMouse)
                {
                    hue = targetColor;
                }
            }

            bool drawShadow = !IsDead && !IsHidden;

            DrawBody(batcher, position, objectList, dir, out int drawX, out int drawY, out int drawCenterY, ref rect, ref mirror, hue, drawShadow);

            if (IsHuman)
            {
                DrawEquipment(batcher, position, objectList, dir, ref drawX, ref drawY, ref drawCenterY, ref rect, ref mirror, hue);
            }

            FrameInfo.X      = Math.Abs(rect.X);
            FrameInfo.Y      = Math.Abs(rect.Y);
            FrameInfo.Width  = FrameInfo.X + rect.Width;
            FrameInfo.Height = FrameInfo.Y + rect.Height;


            //if (_edge == null)
            //{
            //    _edge = new Texture2D(batcher.GraphicsDevice, 1, 1);
            //    _edge.SetData(new Color[] { Color.LightBlue });
            //}

            //batcher.DrawRectangle(_edge, GetOnScreenRectangle(), Vector3.Zero);
            Engine.DebugInfo.MobilesRendered++;
            return(true);
        }
示例#25
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            ResetHueVector();

            int sittigIndex = 0;

            _equipConvData   = null;
            _transform       = false;
            FrameInfo.X      = 0;
            FrameInfo.Y      = 0;
            FrameInfo.Width  = 0;
            FrameInfo.Height = 0;

            posY -= 3;
            int drawX = posX + (int)Offset.X;
            int drawY = posY + (int)(Offset.Y - Offset.Z);

            drawX += 22;
            drawY += 22;

            bool hasShadow = !IsDead && !IsHidden && ProfileManager.CurrentProfile.ShadowsEnabled;

            if (AuraManager.IsEnabled)
            {
                AuraManager.Draw(batcher, drawX, drawY, ProfileManager.CurrentProfile.PartyAura && World.Party.Contains(this) ? ProfileManager.CurrentProfile.PartyAuraHue : Notoriety.GetHue(NotorietyFlag));
            }

            bool isHuman = IsHuman;

            bool isGargoyle = Client.Version >= ClientVersion.CV_7000 && (Graphic == 666 || Graphic == 667 || Graphic == 0x02B7 || Graphic == 0x02B6);

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

            if (ProfileManager.CurrentProfile.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                _viewHue    = Constants.HIGHLIGHT_CURRENT_OBJECT_HUE;
                HueVector.Y = 1;
            }
            else if (SelectedObject.HealthbarObject == this)
            {
                _viewHue = Notoriety.GetHue(NotorietyFlag);
            }
            else if (ProfileManager.CurrentProfile.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                _viewHue    = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && ProfileManager.CurrentProfile.EnableBlackWhiteEffect)
            {
                _viewHue    = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (IsHidden)
            {
                _viewHue = 0x038E;
            }
            else
            {
                _viewHue = 0;

                if (IsDead)
                {
                    if (!isHuman)
                    {
                        _viewHue = 0x0386;
                    }
                }
                else if (ProfileManager.CurrentProfile.HighlightMobilesByFlags)
                {
                    if (IsPoisoned)
                    {
                        _viewHue = ProfileManager.CurrentProfile.PoisonHue;
                    }

                    if (IsParalyzed)
                    {
                        _viewHue = ProfileManager.CurrentProfile.ParalyzedHue;
                    }

                    if (NotorietyFlag != NotorietyFlag.Invulnerable && IsYellowHits)
                    {
                        _viewHue = ProfileManager.CurrentProfile.InvulnerableHue;
                    }
                }
            }


            bool isAttack     = Serial == TargetManager.LastAttack;
            bool isUnderMouse = TargetManager.IsTargeting && SelectedObject.LastObject == this;

            if (Serial != World.Player.Serial)
            {
                if (isAttack || isUnderMouse)
                {
                    _viewHue = Notoriety.GetHue(NotorietyFlag);
                }
            }


            ProcessSteps(out byte dir);
            byte layerDir = dir;

            AnimationsLoader.Instance.GetAnimDirection(ref dir, ref IsFlipped);

            ushort graphic   = GetGraphicForAnimation();
            byte   animGroup = GetGroupForAnimation(this, graphic, true);
            sbyte  animIndex = AnimIndex;

            Item mount = FindItemByLayer(Layer.Mount);

            if (isHuman && mount != null)
            {
                ushort mountGraphic   = mount.GetGraphicForAnimation();
                byte   animGroupMount = 0;

                if (mountGraphic != 0xFFFF)
                {
                    if (hasShadow)
                    {
                        DrawInternal
                        (
                            batcher,
                            this,
                            null,
                            drawX,
                            drawY + 10,
                            IsFlipped,
                            animIndex,
                            true,
                            graphic,
                            animGroup,
                            dir,
                            isHuman,
                            alpha: HueVector.Z
                        );

                        animGroupMount = GetGroupForAnimation(this, mountGraphic);

                        DrawInternal
                        (
                            batcher,
                            this,
                            mount,
                            drawX,
                            drawY,
                            IsFlipped,
                            animIndex,
                            true,
                            mountGraphic,
                            animGroupMount,
                            dir,
                            isHuman,
                            alpha: HueVector.Z
                        );
                    }
                    else
                    {
                        animGroupMount = GetGroupForAnimation(this, mountGraphic);
                    }

                    drawY += DrawInternal
                             (
                        batcher,
                        this,
                        mount,
                        drawX,
                        drawY,
                        IsFlipped,
                        animIndex,
                        false,
                        mountGraphic,
                        animGroupMount,
                        dir,
                        isHuman,
                        isMount: true,
                        alpha: HueVector.Z
                             );
                }
            }
            else
            {
                if ((sittigIndex = IsSitting()) != 0)
                {
                    animGroup = (byte)PEOPLE_ANIMATION_GROUP.PAG_STAND;
                    animIndex = 0;

                    ProcessSteps(out dir);

                    AnimationsLoader.Instance.FixSittingDirection
                    (
                        ref dir,
                        ref IsFlipped,
                        ref drawX,
                        ref drawY,
                        sittigIndex
                    );

                    drawY += SIT_OFFSET_Y;

                    if (dir == 3)
                    {
                        if (IsGargoyle)
                        {
                            drawY    -= 30 - SIT_OFFSET_Y;
                            animGroup = 42;
                        }
                        else
                        {
                            animGroup = 25;
                        }
                    }
                    else if (IsGargoyle)
                    {
                        animGroup = 42;
                    }
                    else
                    {
                        _transform = true;
                    }
                }
                else if (hasShadow)
                {
                    DrawInternal
                    (
                        batcher,
                        this,
                        null,
                        drawX,
                        drawY,
                        IsFlipped,
                        animIndex,
                        true,
                        graphic,
                        animGroup,
                        dir,
                        isHuman,
                        alpha: HueVector.Z
                    );
                }
            }

            DrawInternal
            (
                batcher,
                this,
                null,
                drawX,
                drawY,
                IsFlipped,
                animIndex,
                false,
                graphic,
                animGroup,
                dir,
                isHuman,
                alpha: HueVector.Z,
                forceUOP: isGargoyle
            );

            if (!IsEmpty)
            {
                for (int i = 0; i < Constants.USED_LAYER_COUNT; i++)
                {
                    Layer layer = LayerOrder.UsedLayers[layerDir, i];

                    Item item = FindItemByLayer(layer);

                    if (item == null)
                    {
                        continue;
                    }

                    if (IsDead && (layer == Layer.Hair || layer == Layer.Beard))
                    {
                        continue;
                    }

                    if (isHuman)
                    {
                        if (IsCovered(this, layer))
                        {
                            continue;
                        }

                        if (item.ItemData.AnimID != 0)
                        {
                            graphic = item.ItemData.AnimID;

                            if (isGargoyle)
                            {
                                switch (graphic)
                                {
                                // gargoyle robe
                                case 0x01D5:
                                    graphic = 0x0156;

                                    break;

                                // gargoyle dead shroud
                                case 0x03CA:
                                    graphic = 0x0223;

                                    break;

                                // gargoyle spellbook
                                case 0x03D8:
                                    graphic = 329;

                                    break;

                                // gargoyle necrobook
                                case 0x0372:
                                    graphic = 330;

                                    break;

                                // gargoyle chivalry book
                                case 0x0374:
                                    graphic = 328;

                                    break;

                                // gargoyle bushido book
                                case 0x036F:
                                    graphic = 327;

                                    break;

                                // gargoyle ninjitsu book
                                case 0x036E:
                                    graphic = 328;

                                    break;

                                // gargoyle masteries book
                                case 0x0426:
                                    graphic = 0x042B;

                                    break;


                                    // gargoyle mysticism book seems ok. Mha!
                                }
                            }


                            if (AnimationsLoader.Instance.EquipConversions.TryGetValue(Graphic, out Dictionary <ushort, EquipConvData> map))
                            {
                                if (map.TryGetValue(item.ItemData.AnimID, out EquipConvData data))
                                {
                                    _equipConvData = data;
                                    graphic        = data.Graphic;
                                }
                            }

                            // Seems like all Gargoyle equipment has the 'IsWeapon' flag
                            if (sittigIndex == 0 && IsGargoyle /*&& item.ItemData.IsWeapon*/)
                            {
                                DrawInternal
                                (
                                    batcher,
                                    this,
                                    item,
                                    drawX,
                                    drawY,
                                    IsFlipped,
                                    animIndex,
                                    false,
                                    graphic,
                                    GetGroupForAnimation(this, graphic, true),
                                    dir,
                                    isHuman,
                                    true,
                                    alpha: HueVector.Z,
                                    forceUOP: true
                                );
                            }
                            else
                            {
                                DrawInternal
                                (
                                    batcher,
                                    this,
                                    item,
                                    drawX,
                                    drawY,
                                    IsFlipped,
                                    animIndex,  //item.AnimIndex,
                                    false,
                                    graphic,
                                    animGroup,
                                    dir,
                                    isHuman,
                                    false,
                                    alpha: HueVector.Z
                                );
                            }
                        }
                        else
                        {
                            if (item.ItemData.IsLight)
                            {
                                Client.Game.GetScene <GameScene>().AddLight(this, this, drawX, drawY);
                            }
                        }

                        _equipConvData = null;
                    }
                    else
                    {
                        if (item.ItemData.IsLight)
                        {
                            Client.Game.GetScene <GameScene>().AddLight(this, this, drawX, drawY);

                            /*DrawInternal
                             * (
                             *  batcher,
                             *  this,
                             *  item,
                             *  drawX,
                             *  drawY,
                             *  IsFlipped,
                             *  animIndex,
                             *  false,
                             *  graphic,
                             *  animGroup,
                             *  dir,
                             *  isHuman,
                             *  false,
                             *  alpha: HueVector.Z
                             * );
                             */
                            //break;
                        }
                    }
                }
            }


            //if (FileManager.Animations.SittingValue != 0)
            //{
            //    ref var sittingData = ref FileManager.Animations.SittingInfos[FileManager.Animations.SittingValue - 1];

            //    if (FileManager.Animations.Direction == 3 && sittingData.DrawBack &&
            //        HasEquipment && Equipment[(int) Layer.Cloak] == null)
            //    {

            //    }
            //}
            //

            FrameInfo.X      = Math.Abs(FrameInfo.X);
            FrameInfo.Y      = Math.Abs(FrameInfo.Y);
            FrameInfo.Width  = FrameInfo.X + FrameInfo.Width;
            FrameInfo.Height = FrameInfo.Y + FrameInfo.Height;

            return(true);
        }
示例#26
0
        private void DrawHealthLine(UltimaBatcher2D batcher, Entity entity, int x, int y, bool passive)
        {
            if (entity == null)
            {
                return;
            }

            int per = BAR_WIDTH * entity.HitsPercentage / 100;

            Mobile mobile = entity as Mobile;


            float alpha = passive ? 0.5f : 0.0f;

            _vectorHue.X = mobile != null?Notoriety.GetHue(mobile.NotorietyFlag) : Notoriety.GetHue(NotorietyFlag.Gray);

            _vectorHue.Y = 1;
            _vectorHue.Z = alpha;

            if (mobile == null)
            {
                y += 22;
            }


            const int MULTIPLER = 1;

            batcher.Draw2D(_background_texture,
                           x, y,
                           _background_texture.Width * MULTIPLER,
                           _background_texture.Height * MULTIPLER,
                           ref _vectorHue);


            _vectorHue.X = 0x21;



            if (entity.Hits != entity.HitsMax || entity.HitsMax == 0)
            {
                int offset = 2;

                if (per >> 2 == 0)
                {
                    offset = per;
                }

                batcher.Draw2DTiled(_hp_texture,
                                    x + per * MULTIPLER - offset, y,
                                    (BAR_WIDTH - per) * MULTIPLER - offset / 2,
                                    _hp_texture.Height * MULTIPLER,
                                    ref _vectorHue);
            }

            ushort hue = 90;

            if (per > 0)
            {
                if (mobile != null)
                {
                    if (mobile.IsPoisoned)
                    {
                        hue = 63;
                    }
                    else if (mobile.IsYellowHits)
                    {
                        hue = 53;
                    }
                }

                _vectorHue.X = hue;


                batcher.Draw2DTiled(_hp_texture,
                                    x, y,
                                    per * MULTIPLER,
                                    _hp_texture.Height * MULTIPLER,
                                    ref _vectorHue);
            }
        }
示例#27
0
        public override bool Draw(UltimaBatcher2D batcher, int posX, int posY)
        {
            _equipConvData = null;
            _transform     = false;
            AnimationsLoader.Instance.SittingValue = 0;
            FrameInfo.X      = 0;
            FrameInfo.Y      = 0;
            FrameInfo.Width  = 0;
            FrameInfo.Height = 0;

            posY -= 3;
            int drawX = posX + (int)Offset.X;
            int drawY = posY + (int)(Offset.Y - Offset.Z);

            drawX += 22;
            drawY += 22;

            bool hasShadow = !IsDead && !IsHidden && ProfileManager.Current.ShadowsEnabled;

            if (AuraManager.IsEnabled)
            {
                AuraManager.Draw(batcher, drawX, drawY, ProfileManager.Current.PartyAura && World.Party.Contains(this) ? ProfileManager.Current.PartyAuraHue : Notoriety.GetHue(NotorietyFlag));
            }

            bool isHuman    = IsHuman;
            bool isGargoyle = Client.Version >= ClientVersion.CV_7000 && (Graphic == 666 || Graphic == 667 || Graphic == 0x02B7 || Graphic == 0x02B6);


            if (ProfileManager.Current.HighlightGameObjects && SelectedObject.LastObject == this)
            {
                _viewHue    = 0x0023;
                HueVector.Y = 1;
            }
            else if (ProfileManager.Current.NoColorObjectsOutOfRange && Distance > World.ClientViewRange)
            {
                _viewHue    = Constants.OUT_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (World.Player.IsDead && ProfileManager.Current.EnableBlackWhiteEffect)
            {
                _viewHue    = Constants.DEAD_RANGE_COLOR;
                HueVector.Y = 1;
            }
            else if (IsHidden)
            {
                _viewHue = 0x038E;
            }
            else if (SelectedObject.HealthbarObject == this)
            {
                _viewHue = Notoriety.GetHue(NotorietyFlag);
            }
            else
            {
                _viewHue = 0;

                if (IsDead)
                {
                    if (!isHuman)
                    {
                        _viewHue = 0x0386;
                    }
                }
                else if (ProfileManager.Current.HighlightMobilesByFlags)
                {
                    if (IsPoisoned)
                    {
                        _viewHue = ProfileManager.Current.PoisonHue;
                    }

                    if (IsParalyzed)
                    {
                        _viewHue = ProfileManager.Current.ParalyzedHue;
                    }

                    if (NotorietyFlag != NotorietyFlag.Invulnerable && IsYellowHits)
                    {
                        _viewHue = ProfileManager.Current.InvulnerableHue;
                    }
                }
            }


            bool isAttack     = Serial == TargetManager.LastAttack;
            bool isUnderMouse = TargetManager.IsTargeting && SelectedObject.LastObject == this;

            //bool needHpLine = false;

            if (this != World.Player)
            {
                if (isAttack || isUnderMouse)
                {
                    _viewHue = Notoriety.GetHue(NotorietyFlag);
                }

                //if (this == TargetManager.LastTarget)
                //{
                //    UIManager.SetTargetLineGump(this);
                //    //needHpLine = true;
                //}
            }



            ProcessSteps(out byte dir);
            byte layerDir = dir;

            AnimationsLoader.Instance.GetAnimDirection(ref dir, ref IsFlipped);

            ushort graphic   = GetGraphicForAnimation();
            byte   animGroup = GetGroupForAnimation(this, graphic, true);
            sbyte  animIndex = AnimIndex;

            AnimationsLoader.Instance.Direction = dir;
            AnimationsLoader.Instance.AnimGroup = animGroup;

            Item mount = FindItemByLayer(Layer.Mount);

            if (isHuman && mount != null)
            {
                AnimationsLoader.Instance.SittingValue = 0;

                ushort mountGraphic = mount.GetGraphicForAnimation();

                if (mountGraphic != 0xFFFF)
                {
                    if (hasShadow)
                    {
                        DrawInternal(batcher, this, null, drawX, drawY + 10, IsFlipped, ref animIndex, true, graphic, isHuman);
                        AnimationsLoader.Instance.AnimGroup = GetGroupForAnimation(this, mountGraphic);
                        DrawInternal(batcher, this, mount, drawX, drawY, IsFlipped, ref animIndex, true, mountGraphic, isHuman);
                    }
                    else
                    {
                        AnimationsLoader.Instance.AnimGroup = GetGroupForAnimation(this, mountGraphic);
                    }

                    drawY += DrawInternal(batcher, this, mount, drawX, drawY, IsFlipped, ref animIndex, false, mountGraphic, isHuman, isMount: true);
                }
            }
            else
            {
                if ((AnimationsLoader.Instance.SittingValue = IsSitting()) != 0)
                {
                    animGroup = (byte)PEOPLE_ANIMATION_GROUP.PAG_STAND;
                    animIndex = 0;

                    ProcessSteps(out dir);
                    AnimationsLoader.Instance.Direction = dir;
                    AnimationsLoader.Instance.FixSittingDirection(ref dir, ref IsFlipped, ref drawX, ref drawY);

                    if (AnimationsLoader.Instance.Direction == 3)
                    {
                        if (IsGargoyle)
                        {
                            drawY    -= 30;
                            animGroup = 42;
                        }
                        else
                        {
                            animGroup = 25;
                        }
                    }
                    else if (IsGargoyle)
                    {
                        animGroup = 42;
                    }
                    else
                    {
                        _transform = true;
                    }
                }
                else if (hasShadow)
                {
                    DrawInternal(batcher, this, null, drawX, drawY, IsFlipped, ref animIndex, true, graphic, isHuman);
                }
            }

            AnimationsLoader.Instance.AnimGroup = animGroup;


            DrawInternal(batcher, this, null, drawX, drawY, IsFlipped, ref animIndex, false, graphic, isHuman);

            for (int i = 0; i < Constants.USED_LAYER_COUNT; i++)
            {
                Layer layer = LayerOrder.UsedLayers[layerDir, i];

                Item item = FindItemByLayer(layer);

                if (item == null)
                {
                    continue;
                }

                if (IsDead && (layer == Layer.Hair || layer == Layer.Beard))
                {
                    continue;
                }

                if (isHuman)
                {
                    if (IsCovered(this, layer))
                    {
                        continue;
                    }

                    if (item.ItemData.AnimID != 0)
                    {
                        graphic = item.ItemData.AnimID;

                        if (isGargoyle)
                        {
                            if (graphic == 469)
                            {
                                // gargoyle robe
                                graphic = 342;
                            }
                            else if (graphic == 0x03CA)
                            {
                                // gargoyle dead shroud
                                graphic = 0x0223;
                            }
                        }

                        if (AnimationsLoader.Instance.EquipConversions.TryGetValue(Graphic, out Dictionary <ushort, EquipConvData> map))
                        {
                            if (map.TryGetValue(item.ItemData.AnimID, out EquipConvData data))
                            {
                                _equipConvData = data;
                                graphic        = data.Graphic;
                            }
                        }

                        if (AnimationsLoader.Instance.SittingValue == 0 && IsGargoyle && item.ItemData.IsWeapon)
                        {
                            AnimationsLoader.Instance.AnimGroup = GetGroupForAnimation(this, graphic);
                            DrawInternal(batcher, this, item, drawX, drawY, IsFlipped, ref animIndex, false, graphic, isHuman, false);
                            AnimationsLoader.Instance.AnimGroup = animGroup;
                        }
                        else
                        {
                            DrawInternal(batcher, this, item, drawX, drawY, IsFlipped, ref animIndex, false, graphic, isHuman, false);
                        }
                    }
                    else
                    {
                        if (item.ItemData.IsLight)
                        {
                            Client.Game.GetScene <GameScene>().AddLight(this, this, drawX, drawY);
                        }
                    }

                    _equipConvData = null;
                }
                else
                {
                    if (item.ItemData.IsLight)
                    {
                        Client.Game.GetScene <GameScene>().AddLight(this, this, drawX, drawY);
                        break;
                    }
                }
            }

            //if (FileManager.Animations.SittingValue != 0)
            //{
            //    ref var sittingData = ref FileManager.Animations.SittingInfos[FileManager.Animations.SittingValue - 1];

            //    if (FileManager.Animations.Direction == 3 && sittingData.DrawBack &&
            //        HasEquipment && Equipment[(int) Layer.Cloak] == null)
            //    {

            //    }
            //}
            //

            FrameInfo.X      = Math.Abs(FrameInfo.X);
            FrameInfo.Y      = Math.Abs(FrameInfo.Y);
            FrameInfo.Width  = FrameInfo.X + FrameInfo.Width;
            FrameInfo.Height = FrameInfo.Y + FrameInfo.Height;

            return(true);
        }
示例#28
0
        private ushort GetVarHue(InfoBarVars var)
        {
            float percent;

            switch (var)
            {
            case InfoBarVars.HP:
                percent = World.Player.Hits / (float)World.Player.HitsMax;
                if (percent <= 0.25)
                {
                    return(0x0021);
                }
                else if (percent <= 0.5)
                {
                    return(0x0030);
                }
                else if (percent <= 0.75)
                {
                    return(0x0035);
                }
                else
                {
                    return(0x0481);
                }

            case InfoBarVars.Mana:
                percent = World.Player.Mana / (float)World.Player.ManaMax;
                if (percent <= 0.25)
                {
                    return(0x0021);
                }
                else if (percent <= 0.5)
                {
                    return(0x0030);
                }
                else if (percent <= 0.75)
                {
                    return(0x0035);
                }
                else
                {
                    return(0x0481);
                }

            case InfoBarVars.Stamina:
                percent = World.Player.Stamina / (float)World.Player.StaminaMax;
                if (percent <= 0.25)
                {
                    return(0x0021);
                }
                else if (percent <= 0.5)
                {
                    return(0x0030);
                }
                else if (percent <= 0.75)
                {
                    return(0x0035);
                }
                else
                {
                    return(0x0481);
                }

            case InfoBarVars.Weight:
                percent = World.Player.Weight / (float)World.Player.WeightMax;
                if (percent >= 1)
                {
                    return(0x0021);
                }
                else if (percent >= 0.75)
                {
                    return(0x0030);
                }
                else if (percent >= 0.5)
                {
                    return(0x0035);
                }
                else
                {
                    return(0x0481);
                }

            case InfoBarVars.NameNotoriety:
                return(Notoriety.GetHue(World.Player.NotorietyFlag));

            default:
                return(0x0481);
            }
        }
示例#29
0
        private void DrawHealthLine(UltimaBatcher2D batcher, Mobile mobile, int x, int y, bool passive)
        {
            if (mobile == null)
            {
                return;
            }

            int per = mobile.HitsMax;

            if (per > 0)
            {
                per = mobile.Hits * 100 / per;

                if (per > 100)
                {
                    per = 100;
                }

                if (per < 1)
                {
                    per = 0;
                }
                else
                {
                    per = 34 * per / 100;
                }
            }

            _vectorHue.X = 0;
            _vectorHue.Y = 0;
            _vectorHue.Z = 0;

            float alpha = passive ? 0.5f : 0.0f;

            ShaderHuesTraslator.GetHueVector(ref _vectorHue, Notoriety.GetHue(mobile.NotorietyFlag), false, alpha);

            batcher.Draw2D(_background_texture,
                           x, y,
                           _background_texture.Width,
                           _background_texture.Height,
                           ref _vectorHue);

            _vectorHue.X = 0;
            _vectorHue.Y = 0;
            _vectorHue.Z = 0;

            ushort hue = 23;

            alpha = passive ? 0.5f : 0.0f;

            ShaderHuesTraslator.GetHueVector(ref _vectorHue, hue, false, alpha);

            batcher.Draw2DTiled(_hp_texture,
                                x, y,
                                BAR_WIDTH,
                                _hp_texture.Height,
                                ref _vectorHue);

            _vectorHue.X = 0;
            _vectorHue.Y = 0;
            _vectorHue.Z = 0;


            if (mobile.IsPoisoned)
            {
                hue = 63;
            }
            else if (mobile.IsYellowHits)
            {
                hue = 53;
            }
            else
            {
                hue = 90;
            }

            ShaderHuesTraslator.GetHueVector(ref _vectorHue, hue, false, alpha);

            batcher.Draw2DTiled(_hp_texture,
                                x, y,
                                per,
                                _hp_texture.Height,
                                ref _vectorHue);
        }
示例#30
0
        public override void Update(double totalMS, double frameMS)
        {
            base.Update(totalMS, frameMS);

            if (IsDisposed)
            {
                return;
            }

            bool inparty = World.Party.GetPartyMember(_partyMemeberSerial) != null;

            Hue color     = 0;
            Hue textColor = 0x0386;
            Hue hitsColor = 0x0386;

            if (Mobile == null || Mobile.IsDisposed)
            {
                Mobile = World.Mobiles.Get(LocalSerial);

                if (!_outOfRange && Mobile == null)
                {
                    _poisoned   = false;
                    _yellowHits = false;
                    _normalHits = true;

                    _outOfRange = true;

                    if (inparty)
                    {
                        hitsColor = textColor = 912;

                        if (_partyNameLabel.Hue != textColor)
                        {
                            _partyNameLabel.Hue = textColor;
                        }

                        _buttonHeal1.IsVisible = _buttonHeal2.IsVisible = false;

                        _bars[1].IsVisible = false;
                        _bars[2].IsVisible = false;
                    }
                    else
                    {
                        if (_textBox.Hue != textColor)
                        {
                            _textBox.Hue = textColor;
                        }

                        if (_canChangeName)
                        {
                            _textBox.MouseClick -= TextBoxOnMouseClick;
                        }
                    }

                    if (_background.Hue != color)
                    {
                        _background.Hue = color;
                    }

                    if (_hpLineRed.Hue != hitsColor)
                    {
                        _hpLineRed.Hue = hitsColor;

                        if (_manaLineRed != null && _stamLineRed != null)
                        {
                            _manaLineRed.Hue = _stamLineRed.Hue = hitsColor;
                        }
                    }


                    _bars[0].IsVisible = false;
                }
            }

            if (Mobile != null && Mobile.HitsMax > 0)
            {
                if (_outOfRange)
                {
                    _outOfRange = false;

                    if (_name != Mobile.Name && !string.IsNullOrEmpty(Mobile.Name))
                    {
                        _name = Mobile.Name;
                    }

                    hitsColor = 0;
                    color     = Notoriety.GetHue(Mobile.NotorietyFlag);

                    if (Mobile.NotorietyFlag == NotorietyFlag.Criminal || Mobile.NotorietyFlag == NotorietyFlag.Gray)
                    {
                        color = 0;
                    }

                    if (inparty)
                    {
                        textColor = color;
                    }
                    else
                    {
                        _canChangeName = Mobile.IsRenamable;

                        if (_canChangeName)
                        {
                            textColor = 0x000E;

                            _textBox.MouseClick += TextBoxOnMouseClick;
                        }
                    }


                    if (_background.Hue != color)
                    {
                        _background.Hue = color;
                    }

                    if (inparty)
                    {
                        if (_partyNameLabel.Hue != textColor)
                        {
                            _partyNameLabel.Hue = textColor;
                        }

                        _buttonHeal1.IsVisible = _buttonHeal2.IsVisible = true;

                        _bars[1].IsVisible = true;
                        _bars[2].IsVisible = true;
                    }
                    else
                    {
                        if (_textBox.Hue != textColor)
                        {
                            _textBox.Hue = textColor;
                        }

                        if (_textBox.Text != _name)
                        {
                            _textBox.Text = _name;
                        }
                    }

                    if (_hpLineRed.Hue != hitsColor)
                    {
                        _hpLineRed.Hue = hitsColor;

                        if (_manaLineRed != null && _stamLineRed != null)
                        {
                            _manaLineRed.Hue = _stamLineRed.Hue = hitsColor;
                        }
                    }

                    _bars[0].IsVisible = true;
                }



                if (Mobile.IsPoisoned && !_poisoned)
                {
                    if (inparty)
                    {
                        _bars[0].Hue = 63;
                    }
                    else
                    {
                        _bars[0].Graphic = LINE_POISONED;
                    }

                    _poisoned   = true;
                    _normalHits = false;
                }
                else if (Mobile.IsYellowHits && !_yellowHits)
                {
                    if (inparty)
                    {
                        _bars[0].Hue = 353;
                    }
                    else
                    {
                        _bars[0].Graphic = LINE_YELLOWHITS;
                    }
                    _yellowHits = true;
                    _normalHits = false;
                }
                else if (!_normalHits && !Mobile.IsPoisoned && !Mobile.IsYellowHits && (_poisoned || _yellowHits))
                {
                    if (inparty)
                    {
                        _bars[0].Hue = 0;
                    }
                    else
                    {
                        _bars[0].Graphic = LINE_BLUE;
                    }
                    _poisoned   = false;
                    _yellowHits = false;
                    _normalHits = true;
                }

                int hits = CalculatePercents(Mobile.HitsMax, Mobile.Hits, inparty ? 96 : 109);

                if (hits != _oldHits)
                {
                    _bars[0].Percent = hits;
                    _oldHits         = hits;
                }
            }


            if (CanBeSaved)
            {
                if (World.Player.InWarMode != _oldWarMode)
                {
                    _oldWarMode = !_oldWarMode;

                    _background.Graphic = World.Player.InWarMode ? BACKGROUND_WAR : BACKGROUND_NORMAL;
                }

                int mana = CalculatePercents(World.Player.ManaMax, World.Player.Mana, inparty ? 96 : 109);
                int stam = CalculatePercents(World.Player.StaminaMax, World.Player.Stamina, inparty ? 96 : 109);

                if (mana != _oldMana)
                {
                    _bars[1].Percent = mana;
                    _oldMana         = mana;
                }

                if (stam != _oldStam)
                {
                    _bars[2].Percent = stam;
                    _oldStam         = stam;
                }
            }
        }