Terraria.Dust.GetAlpha C# (CSharp) Method

GetAlpha() public method

public GetAlpha ( Color newColor ) : Color
newColor Color
return Color
        public Color GetAlpha(Color newColor)
        {
            float num1 = (float)((int)byte.MaxValue - this.alpha) / (float)byte.MaxValue;
            if (this.type == 259)
                return new Color(230, 230, 230, 230);
            if (this.type == 261)
                return new Color(230, 230, 230, 115);
            if (this.type == 254 || this.type == (int)byte.MaxValue)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if (this.type == 258)
                return new Color(150, 50, 50, 0);
            if (this.type == 263 || this.type == 264)
                return new Color((int)this.color.R / 2 + (int)sbyte.MaxValue, (int)this.color.G + (int)sbyte.MaxValue, (int)this.color.B + (int)sbyte.MaxValue, (int)this.color.A / 8) * 0.5f;
            if (this.type == 235)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if ((this.type >= 86 && this.type <= 91 || this.type == 262) && !this.noLight)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if (this.type == 213 || this.type == 260)
            {
                int num2 = (int)((double)this.scale / 2.5 * (double)byte.MaxValue);
                return new Color(num2, num2, num2, num2);
            }
            if (this.type == 64 && this.alpha == (int)byte.MaxValue && this.noLight)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if (this.type == 197)
                return new Color(250, 250, 250, 150);
            if (this.type >= 110 && this.type <= 114)
                return new Color(200, 200, 200, 0);
            if (this.type == 204)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if (this.type == 181)
                return new Color(200, 200, 200, 0);
            if (this.type == 182 || this.type == 206)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if (this.type == 159)
                return new Color(250, 250, 250, 50);
            if (this.type == 163 || this.type == 205)
                return new Color(250, 250, 250, 0);
            if (this.type == 170)
                return new Color(200, 200, 200, 100);
            if (this.type == 180)
                return new Color(200, 200, 200, 0);
            if (this.type == 175)
                return new Color(200, 200, 200, 0);
            if (this.type == 183)
                return new Color(50, 0, 0, 0);
            if (this.type == 172)
                return new Color(250, 250, 250, 150);
            if (this.type == 160 || this.type == 162 || (this.type == 164 || this.type == 173))
            {
                int num2 = (int)(250.0 * (double)this.scale);
                return new Color(num2, num2, num2, 0);
            }
            if (this.type == 92 || this.type == 106 || this.type == 107)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if (this.type == 185)
                return new Color(200, 200, (int)byte.MaxValue, 125);
            if (this.type == (int)sbyte.MaxValue || this.type == 187)
                return new Color((int)newColor.R, (int)newColor.G, (int)newColor.B, 25);
            if (this.type == 156 || this.type == 230 || this.type == 234)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if (this.type == 6 || this.type == 242 || (this.type == 174 || this.type == 135) || (this.type == 75 || this.type == 20 || (this.type == 21 || this.type == 231)) || (this.type == 169 || this.type >= 130 && this.type <= 134 || this.type == 158))
                return new Color((int)newColor.R, (int)newColor.G, (int)newColor.B, 25);
            if (this.type >= 219 && this.type <= 223)
            {
                newColor = Color.Lerp(newColor, Color.White, 0.5f);
                return new Color((int)newColor.R, (int)newColor.G, (int)newColor.B, 25);
            }
            if (this.type == 226)
            {
                newColor = Color.Lerp(newColor, Color.White, 0.8f);
                return new Color((int)newColor.R, (int)newColor.G, (int)newColor.B, 25);
            }
            if (this.type == 228)
            {
                newColor = Color.Lerp(newColor, Color.White, 0.8f);
                return new Color((int)newColor.R, (int)newColor.G, (int)newColor.B, 25);
            }
            if (this.type == 229)
            {
                newColor = Color.Lerp(newColor, Color.White, 0.6f);
                return new Color((int)newColor.R, (int)newColor.G, (int)newColor.B, 25);
            }
            if ((this.type == 68 || this.type == 70) && this.noGravity)
                return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            if (this.type == 157)
            {
                int num2;
                int num3 = num2 = (int)byte.MaxValue;
                int num4 = num2;
                int num5 = num2;
                float num6 = (float)((double)Main.mouseTextColor / 100.0 - 1.60000002384186);
                int num7 = (int)((double)num5 * (double)num6);
                int num8 = (int)((double)num4 * (double)num6);
                int num9 = (int)((double)num3 * (double)num6);
                int a = (int)(100.0 * (double)num6);
                int r = num7 + 50;
                if (r > (int)byte.MaxValue)
                    r = (int)byte.MaxValue;
                int g = num8 + 50;
                if (g > (int)byte.MaxValue)
                    g = (int)byte.MaxValue;
                int b = num9 + 50;
                if (b > (int)byte.MaxValue)
                    b = (int)byte.MaxValue;
                return new Color(r, g, b, a);
            }
            if (this.type == 15 || this.type == 20 || (this.type == 21 || this.type == 29) || (this.type == 35 || this.type == 41 || (this.type == 44 || this.type == 27)) || (this.type == 45 || this.type == 55 || (this.type == 56 || this.type == 57) || (this.type == 58 || this.type == 73 || this.type == 74)))
                num1 = (float)(((double)num1 + 3.0) / 4.0);
            else if (this.type == 43)
            {
                num1 = (float)(((double)num1 + 9.0) / 10.0);
            }
            else
            {
                if (this.type >= 244 && this.type <= 247)
                    return new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
                if (this.type == 66)
                    return new Color((int)newColor.R, (int)newColor.G, (int)newColor.B, 0);
                if (this.type == 267)
                    return new Color((int)this.color.R, (int)this.color.G, (int)this.color.B, 0);
                if (this.type == 71)
                    return new Color(200, 200, 200, 0);
                if (this.type == 72)
                    return new Color(200, 200, 200, 200);
            }
            int r1 = (int)((double)newColor.R * (double)num1);
            int g1 = (int)((double)newColor.G * (double)num1);
            int b1 = (int)((double)newColor.B * (double)num1);
            int a1 = (int)newColor.A - this.alpha;
            if (a1 < 0)
                a1 = 0;
            if (a1 > (int)byte.MaxValue)
                a1 = (int)byte.MaxValue;
            return new Color(r1, g1, b1, a1);
        }