Beispiel #1
0
        protected override void DrawSelf(SpriteBatch sb)
        {
            var ci  = GetInstance <Config>();
            var lp  = Terraria.Main.LocalPlayer;
            var con = "Always" == ci.blbv || 0 < lp.breath && lp.breath < lp.breathMax && 0 < lp.lavaTime && lp.lavaTime < lp.lavaMax || MP.pm;

            void DrawBar(bool _, Color a, float b, SpriteBatch c, Texture2D d, int e = 0)
            {
                c.Draw(GetTexture("Widgets/sprites/wp"), new Rectangle((int)tp.X + (_ ? 20 : 4), (int)tp.Y + 4 + e, 50, 10), Color.Black);
                c.Draw(GetTexture("Widgets/sprites/wp"), new Rectangle((int)tp.X + (_ ? 20 : 4), (int)tp.Y + 4 + e, (int)b, 10), a);
                c.Draw(GetTexture("Widgets/sprites/bfg"), new Vector2((_ ? 16 : 0) + tp.X, tp.Y + e), Color.White);
                if (_)
                {
                    c.Draw(d, new Vector2(tp.X, tp.Y + e), Color.White);
                }
            }

            Height.Set(con ? 34 : 18, 0);
            DrawBar(ci.blbi, Gradient(ci.lbrg, ci.lbsc, ci.lbec, Mod0.SD(lp.lavaTime, lp.lavaMax)), Mod0.SD(50 * lp.lavaTime, lp.lavaMax), sb, GetTexture("Widgets/sprites/bli"), con ? 16 : 0);
            if ("Always" == ci.blbv || 0 < lp.breath && lp.breath < lp.breathMax || MP.pm)
            {
                DrawBar(ci.blbi, Gradient(ci.bbrg, ci.bbsc, ci.bbec, Mod0.SD(lp.breath, lp.breathMax)), Mod0.SD(50 * lp.breath, lp.breathMax), sb, GetTexture("Widgets/sprites/bbi"));
            }
            base.DrawSelf(sb);
            Width.Set(ci.blbi ? 74 : 58, 0);
        }
Beispiel #2
0
        public Color Gradient(bool rg, Color start, Color end, float rate)
        {
            byte[] ec = { end.R, end.G, end.B }, sc = { start.R, start.G, start.B };
            float  eh = System.Drawing.Color.FromArgb(end.R, end.G, end.B).GetHue(), sh = System.Drawing.Color.FromArgb(start.R, start.G, start.B).GetHue(), hd = eh - sh, dc = -180 == hd && rg || -180 > hd ? 360 + eh : !rg && 180 == hd || 180 < hd ? eh - 360 : eh, rh = dc - (dc - sh) * rate, la = rh < 0 ? rh + 360 : (int)rh > 359 ? rh - 360 : rh, ha = la / 60 - (int)la / 60, rs = 1 - Mod0.SD(ec.Min() - (ec.Min() - sc.Min()) * rate, ec.Max() - (ec.Max() - sc.Max()) * rate);
            byte   ra = (byte)(end.A - (end.A - start.A) * rate), c1 = (byte)((ec.Max() - (ec.Max() - sc.Max()) * rate) * ra / 255), c2 = (byte)((1 - rs) * c1), c3 = (byte)((1 - ha * rs) * c1), c4 = (byte)((1 - (1 - ha) * rs) * c1);

            if (60 > la)
            {
                return(new Color(c1, c4, c2, ra));
            }
            else if (120 > la)
            {
                return(new Color(c3, c1, c2, ra));
            }
            else if (180 > la)
            {
                return(new Color(c2, c1, c4, ra));
            }
            else if (240 > la)
            {
                return(new Color(c2, c3, c1, ra));
            }
            else if (300 > la)
            {
                return(new Color(c4, c2, c1, ra));
            }
            else
            {
                return(new Color(c1, c2, c3, ra));
            }
        }
Beispiel #3
0
        protected override void DrawSelf(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            var ci = GetInstance <Config>();
            var lp = LocalPlayer;
            var ct = lp.carpetTime;
            var wt = lp.wingTime;

            Height.Set(ci.ftbi ? 22 : 18, 0);
            if ((0 < lp.jump || lp.releaseJump) && 1 < Mod0.jc)
            {
                Terraria.Utils.DrawBorderString(sb, "" + Mod0.jc, new Vector2((ci.ftbi ? 85 : 63) + tp.X, tp.Y), Color.White);
            }
            sb.Draw(GetTexture("Widgets/sprites/wp"), new Rectangle((ci.ftbi ? 26 : 4) + (int)tp.X, (ci.ftbi ? 6 : 4) + (int)tp.Y, 50, 10), Color.Black);
            if (0 == lp.velocity.Y && lp.releaseJump || Mod0.ftbc)
            {
                sb.Draw(GetTexture("Widgets/sprites/wp"), new Rectangle((ci.ftbi ? 26 : 4) + (int)tp.X, (ci.ftbi ? 6 : 4) + (int)tp.Y, Mod0.ftbc2 ? 50 : 0 < lp.jump ? (int)Mod0.SD(50 * lp.jump, lp.jump + Mod0.tft) : lp.mount.Active ? (int)Mod0.SD(50 * lp.mount.FlyTime, lp.mount.FlyTime + Mod0.tft) : 0 < wt ? (int)Mod0.SD(50 * wt, Mod0.tft + wt) : 0 < lp.rocketTime ? (int)Mod0.SD(50 * lp.rocketTime, lp.rocketTimeMax) : (int)Mod0.SD(50 * ct, ct + Mod0.tft), 10), Gradient(ci.ftbrg, ci.ftbsc, ci.ftbec, Mod0.ftbc2 ? 1 : 0 < lp.jump ? Mod0.SD(lp.jump, lp.jump + Mod0.tft) : lp.mount.Active ? Mod0.SD(lp.mount.FlyTime, lp.mount.FlyTime + Mod0.tft) : 0 < wt ? Mod0.SD(wt, Mod0.tft + wt) : 0 < lp.rocketTime ? Mod0.SD(lp.rocketTime, lp.rocketTimeMax) : Mod0.SD(ct, ct + Mod0.tft)));
            }
            sb.Draw(GetTexture("Widgets/sprites/bfg"), new Vector2((ci.ftbi ? 22 : 0) + tp.X, (ci.ftbi ? 2 : 0) + tp.Y), Color.White);
            if (ci.ftbi)
            {
                sb.Draw((0 < Mod0.jc || 0 == lp.velocity.Y) && lp.releaseJump || 0 < lp.jump ? GetTexture("Widgets/sprites/ftbi2") : Mod0.ftbc ? 0 < wt || lp.mount.Active ? GetTexture("Widgets/sprites/ftbi4") : 0 < lp.rocketBoots && 0 < lp.rocketTime ? GetTexture("Widgets/sprites/ftbi3") : GetTexture("Widgets/sprites/ftbi") : GetTexture("Widgets/sprites/ftbi5"), new Vector2(tp.X, tp.Y), Color.White);
            }
            base.DrawSelf(sb);
            Width.Set((1 < Mod0.jc ? 5 + fontMouseText.MeasureString("" + Mod0.jc).X : 0) + (ci.ftbi ? 80 : 58), 0);
        }
Beispiel #4
0
        protected override void DrawSelf(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            var ci = GetInstance <Config>();
            var lp = Terraria.Main.LocalPlayer;

            Height.Set(ci.itbi ? 22 : 18, 0);
            sb.Draw(GetTexture("Widgets/sprites/wp"), new Rectangle((ci.itbi ? 22 : 4) + (int)tp.X, (ci.itbi ? 6 : 4) + (int)tp.Y, 50, 10), Color.Black);
            if (!lp.dead)
            {
                sb.Draw(GetTexture("Widgets/sprites/wp"), new Rectangle((ci.itbi ? 22 : 4) + (int)tp.X, (ci.itbi ? 6 : 4) + (int)tp.Y, (int)Mod0.SD(50 * lp.immuneTime, 0 == MP.it ? lp.immuneTime + Mod0.tit : MP.it), 10), Gradient(ci.itbrg, ci.itbsc, ci.itbec, Mod0.SD(lp.immuneTime, 0 == MP.it ? lp.immuneTime + Mod0.tit : MP.it)));
            }
            sb.Draw(GetTexture("Widgets/sprites/bfg"), new Vector2((ci.itbi ? 18 : 0) + tp.X, (ci.itbi ? 2 : 0) + tp.Y), Color.White);
            if (ci.itbi)
            {
                sb.Draw(GetTexture("Widgets/sprites/itbi"), new Vector2(tp.X, tp.Y), Color.White);
            }
            base.DrawSelf(sb);
            Width.Set(ci.itbi ? 76 : 58, 0);
        }