TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ GetAlpha()

Color Terraria.Dust.GetAlpha ( Color newColor)
inline

Definition at line 2962 of file Dust.cs.

2963 {
2964 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
2965 //IL_00a9: Unknown result type (might be due to invalid IL or missing references)
2966 //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
2967 //IL_0023: Unknown result type (might be due to invalid IL or missing references)
2968 //IL_016d: Unknown result type (might be due to invalid IL or missing references)
2969 //IL_0173: Unknown result type (might be due to invalid IL or missing references)
2970 //IL_0087: Unknown result type (might be due to invalid IL or missing references)
2971 //IL_015d: Unknown result type (might be due to invalid IL or missing references)
2972 //IL_0187: Unknown result type (might be due to invalid IL or missing references)
2973 //IL_018d: Unknown result type (might be due to invalid IL or missing references)
2974 //IL_01a0: Unknown result type (might be due to invalid IL or missing references)
2975 //IL_01c7: Unknown result type (might be due to invalid IL or missing references)
2976 //IL_01eb: Unknown result type (might be due to invalid IL or missing references)
2977 //IL_021b: Unknown result type (might be due to invalid IL or missing references)
2978 //IL_0238: Unknown result type (might be due to invalid IL or missing references)
2979 //IL_0291: Unknown result type (might be due to invalid IL or missing references)
2980 //IL_029b: Unknown result type (might be due to invalid IL or missing references)
2981 //IL_02be: Unknown result type (might be due to invalid IL or missing references)
2982 //IL_030a: Unknown result type (might be due to invalid IL or missing references)
2983 //IL_0340: Unknown result type (might be due to invalid IL or missing references)
2984 //IL_039c: Unknown result type (might be due to invalid IL or missing references)
2985 //IL_0375: Unknown result type (might be due to invalid IL or missing references)
2986 //IL_03ed: Unknown result type (might be due to invalid IL or missing references)
2987 //IL_0410: Unknown result type (might be due to invalid IL or missing references)
2988 //IL_0433: Unknown result type (might be due to invalid IL or missing references)
2989 //IL_0463: Unknown result type (might be due to invalid IL or missing references)
2990 //IL_0487: Unknown result type (might be due to invalid IL or missing references)
2991 //IL_04b7: Unknown result type (might be due to invalid IL or missing references)
2992 //IL_04db: Unknown result type (might be due to invalid IL or missing references)
2993 //IL_04fe: Unknown result type (might be due to invalid IL or missing references)
2994 //IL_0521: Unknown result type (might be due to invalid IL or missing references)
2995 //IL_0539: Unknown result type (might be due to invalid IL or missing references)
2996 //IL_0560: Unknown result type (might be due to invalid IL or missing references)
2997 //IL_05aa: Unknown result type (might be due to invalid IL or missing references)
2998 //IL_05de: Unknown result type (might be due to invalid IL or missing references)
2999 //IL_0602: Unknown result type (might be due to invalid IL or missing references)
3000 //IL_0636: Unknown result type (might be due to invalid IL or missing references)
3001 //IL_0673: Unknown result type (might be due to invalid IL or missing references)
3002 //IL_06ac: Unknown result type (might be due to invalid IL or missing references)
3003 //IL_06e5: Unknown result type (might be due to invalid IL or missing references)
3004 //IL_0814: Unknown result type (might be due to invalid IL or missing references)
3005 //IL_082b: Unknown result type (might be due to invalid IL or missing references)
3006 //IL_0836: Unknown result type (might be due to invalid IL or missing references)
3007 //IL_083b: Unknown result type (might be due to invalid IL or missing references)
3008 //IL_084e: Unknown result type (might be due to invalid IL or missing references)
3009 //IL_08b4: Unknown result type (might be due to invalid IL or missing references)
3010 //IL_08b5: Unknown result type (might be due to invalid IL or missing references)
3011 //IL_08bf: Unknown result type (might be due to invalid IL or missing references)
3012 //IL_08c4: Unknown result type (might be due to invalid IL or missing references)
3013 //IL_08dd: Unknown result type (might be due to invalid IL or missing references)
3014 //IL_086b: Unknown result type (might be due to invalid IL or missing references)
3015 //IL_086c: Unknown result type (might be due to invalid IL or missing references)
3016 //IL_0876: Unknown result type (might be due to invalid IL or missing references)
3017 //IL_087b: Unknown result type (might be due to invalid IL or missing references)
3018 //IL_0894: Unknown result type (might be due to invalid IL or missing references)
3019 //IL_08f0: Unknown result type (might be due to invalid IL or missing references)
3020 //IL_08f1: Unknown result type (might be due to invalid IL or missing references)
3021 //IL_08fb: Unknown result type (might be due to invalid IL or missing references)
3022 //IL_0900: Unknown result type (might be due to invalid IL or missing references)
3023 //IL_0919: Unknown result type (might be due to invalid IL or missing references)
3024 //IL_0935: Unknown result type (might be due to invalid IL or missing references)
3025 //IL_0936: Unknown result type (might be due to invalid IL or missing references)
3026 //IL_0940: Unknown result type (might be due to invalid IL or missing references)
3027 //IL_0945: Unknown result type (might be due to invalid IL or missing references)
3028 //IL_095e: Unknown result type (might be due to invalid IL or missing references)
3029 //IL_0973: Unknown result type (might be due to invalid IL or missing references)
3030 //IL_0993: Unknown result type (might be due to invalid IL or missing references)
3031 //IL_0994: Unknown result type (might be due to invalid IL or missing references)
3032 //IL_099e: Unknown result type (might be due to invalid IL or missing references)
3033 //IL_09a3: Unknown result type (might be due to invalid IL or missing references)
3034 //IL_09bc: Unknown result type (might be due to invalid IL or missing references)
3035 //IL_09ee: Unknown result type (might be due to invalid IL or missing references)
3036 //IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
3037 //IL_0aba: Unknown result type (might be due to invalid IL or missing references)
3038 //IL_0abf: Unknown result type (might be due to invalid IL or missing references)
3039 //IL_0adb: Unknown result type (might be due to invalid IL or missing references)
3040 //IL_0a98: Unknown result type (might be due to invalid IL or missing references)
3041 //IL_0ce0: Unknown result type (might be due to invalid IL or missing references)
3042 //IL_0c0a: Unknown result type (might be due to invalid IL or missing references)
3043 //IL_0be4: Unknown result type (might be due to invalid IL or missing references)
3044 //IL_0c3f: Unknown result type (might be due to invalid IL or missing references)
3045 //IL_0c5f: Unknown result type (might be due to invalid IL or missing references)
3046 //IL_0c83: Unknown result type (might be due to invalid IL or missing references)
3048 if (modDust != null)
3049 {
3050 Color? modColor = modDust.GetAlpha(this, newColor);
3051 if (modColor.HasValue)
3052 {
3053 return modColor.Value;
3054 }
3055 }
3056 float num = (float)(255 - alpha) / 255f;
3057 switch (type)
3058 {
3059 case 323:
3060 return Color.White;
3061 case 308:
3062 case 309:
3063 return new Color(225, 200, 250, 190);
3064 case 299:
3065 case 300:
3066 case 301:
3067 case 305:
3068 {
3069 Color color = default(Color);
3070 switch (type)
3071 {
3072 default:
3073 ((Color)(ref color))._002Ector(255, 150, 150, 200);
3074 break;
3075 case 299:
3076 ((Color)(ref color))._002Ector(50, 255, 50, 200);
3077 break;
3078 case 300:
3079 ((Color)(ref color))._002Ector(50, 200, 255, 255);
3080 break;
3081 case 301:
3082 ((Color)(ref color))._002Ector(255, 50, 125, 200);
3083 break;
3084 case 305:
3085 ((Color)(ref color))._002Ector(200, 50, 200, 200);
3086 break;
3087 }
3088 return color;
3089 }
3090 default:
3091 {
3092 if (type == 304)
3093 {
3094 return Color.White * num;
3095 }
3096 if (type == 306)
3097 {
3098 return this.color * num;
3099 }
3100 if (type == 292)
3101 {
3102 return Color.White;
3103 }
3104 if (type == 259)
3105 {
3106 return new Color(230, 230, 230, 230);
3107 }
3108 if (type == 261)
3109 {
3110 return new Color(230, 230, 230, 115);
3111 }
3112 if (type == 254 || type == 255)
3113 {
3114 return new Color(255, 255, 255, 0);
3115 }
3116 if (type == 258)
3117 {
3118 return new Color(150, 50, 50, 0);
3119 }
3120 if (type == 263 || type == 264)
3121 {
3122 return new Color(((Color)(ref this.color)).R / 2 + 127, ((Color)(ref this.color)).G + 127, ((Color)(ref this.color)).B + 127, ((Color)(ref this.color)).A / 8) * 0.5f;
3123 }
3124 if (type == 235)
3125 {
3126 return new Color(255, 255, 255, 0);
3127 }
3128 if (((type >= 86 && type <= 91) || type == 262 || type == 286) && !noLight)
3129 {
3130 return new Color(255, 255, 255, 0);
3131 }
3132 if (type == 213 || type == 260)
3133 {
3134 int num7 = (int)(scale / 2.5f * 255f);
3135 return new Color(num7, num7, num7, num7);
3136 }
3137 if (type == 64 && alpha == 255 && noLight)
3138 {
3139 return new Color(255, 255, 255, 0);
3140 }
3141 if (type == 197)
3142 {
3143 return new Color(250, 250, 250, 150);
3144 }
3145 if ((type >= 110 && type <= 114) || type == 311 || type == 312 || type == 313)
3146 {
3147 return new Color(200, 200, 200, 0);
3148 }
3149 if (type == 204)
3150 {
3151 return new Color(255, 255, 255, 0);
3152 }
3153 if (type == 181)
3154 {
3155 return new Color(200, 200, 200, 0);
3156 }
3157 if (type == 182 || type == 206)
3158 {
3159 return new Color(255, 255, 255, 0);
3160 }
3161 if (type == 159)
3162 {
3163 return new Color(250, 250, 250, 50);
3164 }
3165 if (type == 163 || type == 205)
3166 {
3167 return new Color(250, 250, 250, 0);
3168 }
3169 if (type == 170)
3170 {
3171 return new Color(200, 200, 200, 100);
3172 }
3173 if (type == 180)
3174 {
3175 return new Color(200, 200, 200, 0);
3176 }
3177 if (type == 175)
3178 {
3179 return new Color(200, 200, 200, 0);
3180 }
3181 if (type == 183)
3182 {
3183 return new Color(50, 0, 0, 0);
3184 }
3185 if (type == 172)
3186 {
3187 return new Color(250, 250, 250, 150);
3188 }
3189 if (type == 160 || type == 162 || type == 164 || type == 173)
3190 {
3191 int num8 = (int)(250f * scale);
3192 return new Color(num8, num8, num8, 0);
3193 }
3194 if (type == 92 || type == 106 || type == 107)
3195 {
3196 return new Color(255, 255, 255, 0);
3197 }
3198 if (type == 185)
3199 {
3200 return new Color(200, 200, 255, 125);
3201 }
3202 if (type == 127 || type == 187)
3203 {
3204 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, 25);
3205 }
3206 if (type == 156 || type == 230 || type == 234)
3207 {
3208 return new Color(255, 255, 255, 0);
3209 }
3210 if (type == 270)
3211 {
3212 return new Color(((Color)(ref newColor)).R / 2 + 127, ((Color)(ref newColor)).G / 2 + 127, ((Color)(ref newColor)).B / 2 + 127, 25);
3213 }
3214 if (type == 271)
3215 {
3216 return new Color(((Color)(ref newColor)).R / 2 + 127, ((Color)(ref newColor)).G / 2 + 127, ((Color)(ref newColor)).B / 2 + 127, 127);
3217 }
3218 if (type == 6 || type == 242 || type == 174 || type == 135 || type == 75 || type == 20 || type == 21 || type == 231 || type == 169 || (type >= 130 && type <= 134) || type == 158 || type == 293 || type == 294 || type == 295 || type == 296 || type == 297 || type == 298 || type == 307 || type == 310)
3219 {
3220 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, 25);
3221 }
3222 if (type == 278)
3223 {
3224 Color result = default(Color);
3225 ((Color)(ref result))._002Ector(((Color)(ref newColor)).ToVector3() * ((Color)(ref this.color)).ToVector3());
3226 ((Color)(ref result)).A = 25;
3227 return result;
3228 }
3229 if (type >= 219 && type <= 223)
3230 {
3231 newColor = Color.Lerp(newColor, Color.White, 0.5f);
3232 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, 25);
3233 }
3234 if (type == 226 || type == 272)
3235 {
3236 newColor = Color.Lerp(newColor, Color.White, 0.8f);
3237 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, 25);
3238 }
3239 if (type == 228)
3240 {
3241 newColor = Color.Lerp(newColor, Color.White, 0.8f);
3242 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, 25);
3243 }
3244 if (type == 279)
3245 {
3246 int a = ((Color)(ref newColor)).A;
3247 newColor = Color.Lerp(newColor, Color.White, 0.8f);
3248 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, a) * MathHelper.Min(scale, 1f);
3249 }
3250 if (type == 229 || type == 269)
3251 {
3252 newColor = Color.Lerp(newColor, Color.White, 0.6f);
3253 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, 25);
3254 }
3255 if ((type == 68 || type == 70) && noGravity)
3256 {
3257 return new Color(255, 255, 255, 0);
3258 }
3259 int num4;
3260 int num3;
3261 int num2;
3262 if (type == 157)
3263 {
3264 num4 = (num3 = (num2 = 255));
3265 float num5 = (float)(int)Main.mouseTextColor / 100f - 1.6f;
3266 num4 = (int)((float)num4 * num5);
3267 num3 = (int)((float)num3 * num5);
3268 num2 = (int)((float)num2 * num5);
3269 int a2 = (int)(100f * num5);
3270 num4 += 50;
3271 if (num4 > 255)
3272 {
3273 num4 = 255;
3274 }
3275 num3 += 50;
3276 if (num3 > 255)
3277 {
3278 num3 = 255;
3279 }
3280 num2 += 50;
3281 if (num2 > 255)
3282 {
3283 num2 = 255;
3284 }
3285 return new Color(num4, num3, num2, a2);
3286 }
3287 if (type == 284)
3288 {
3289 Color result2 = default(Color);
3290 ((Color)(ref result2))._002Ector(((Color)(ref newColor)).ToVector4() * ((Color)(ref this.color)).ToVector4());
3291 ((Color)(ref result2)).A = ((Color)(ref this.color)).A;
3292 return result2;
3293 }
3294 if (type == 15 || type == 274 || type == 20 || type == 21 || type == 29 || type == 35 || type == 41 || type == 44 || type == 27 || type == 45 || type == 55 || type == 56 || type == 57 || type == 58 || type == 73 || type == 74)
3295 {
3296 num = (num + 3f) / 4f;
3297 }
3298 else if (type == 43)
3299 {
3300 num = (num + 9f) / 10f;
3301 }
3302 else
3303 {
3304 if (type >= 244 && type <= 247)
3305 {
3306 return new Color(255, 255, 255, 0);
3307 }
3308 if (type == 66)
3309 {
3310 return new Color((int)((Color)(ref newColor)).R, (int)((Color)(ref newColor)).G, (int)((Color)(ref newColor)).B, 0);
3311 }
3312 if (type == 267)
3313 {
3314 return new Color((int)((Color)(ref this.color)).R, (int)((Color)(ref this.color)).G, (int)((Color)(ref this.color)).B, 0);
3315 }
3316 if (type == 71)
3317 {
3318 return new Color(200, 200, 200, 0);
3319 }
3320 if (type == 72)
3321 {
3322 return new Color(200, 200, 200, 200);
3323 }
3324 }
3325 num4 = (int)((float)(int)((Color)(ref newColor)).R * num);
3326 num3 = (int)((float)(int)((Color)(ref newColor)).G * num);
3327 num2 = (int)((float)(int)((Color)(ref newColor)).B * num);
3328 int num6 = ((Color)(ref newColor)).A - alpha;
3329 if (num6 < 0)
3330 {
3331 num6 = 0;
3332 }
3333 if (num6 > 255)
3334 {
3335 num6 = 255;
3336 }
3337 return new Color(num4, num3, num2, num6);
3338 }
3339 }
3340 }
bool noGravity
Indicates if a dust should be affected by gravity or not. Not all vanilla dust have logic checking th...
Definition Dust.cs:45
int type
The Dust ID of this dust. The Dust ID will be equal to either a T:Terraria.ID.DustID entry or M:Terra...
Definition Dust.cs:69
int alpha
How transparent to draw this dust. 0 to 255. 255 is completely transparent. Used to fade dust out and...
Definition Dust.cs:79
bool noLight
If true, the dust will not emit light. The specific behavior depends on the dust type,...
Definition Dust.cs:60
float scale
The draw scale of the dust. Many dust rely on scale to determine when it should despawn....
Definition Dust.cs:50
Color color
A tinting to the color this dust is drawn. Works best with sprites with low saturation,...
Definition Dust.cs:74
static ModDust GetDust(int type)
Gets the ModDust instance with the given type. Returns null if no ModDust with the given type exists.
Definition DustLoader.cs:18
This class represents a type of dust that is added by a mod. Only one instance of this class will eve...
Definition ModDust.cs:14

References Terraria.Dust.alpha, Terraria.Dust.color, Terraria.ModLoader.DustLoader.GetDust(), Terraria.Dust.noGravity, Terraria.Dust.noLight, Terraria.Dust.scale, and Terraria.Dust.type.

+ Here is the call graph for this function: