Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Dust.cs
Go to the documentation of this file.
1using System;
7
8namespace Terraria;
9
10public class Dust
11{
12 public static float dCount;
13
14 public static int lavaBubbles;
15
16 public static int SandStormCount;
17
18 public int dustIndex;
19
21
23
24 public float fadeIn;
25
26 public bool noGravity;
27
28 public float scale;
29
30 public float rotation;
31
32 public bool noLight;
33
34 public bool noLightEmittence;
35
36 public bool active;
37
38 public int type;
39
40 public Color color;
41
42 public int alpha;
43
45
47
48 public object customData;
49
50 public bool firstFrame;
51
52 public static Dust NewDustPerfect(Vector2 Position, int Type, Vector2? Velocity = null, int Alpha = 0, Color newColor = default(Color), float Scale = 1f)
53 {
54 Dust dust = Main.dust[NewDust(Position, 0, 0, Type, 0f, 0f, Alpha, newColor, Scale)];
55 dust.position = Position;
56 if (Velocity.HasValue)
57 {
58 dust.velocity = Velocity.Value;
59 }
60 return dust;
61 }
62
63 public static Dust NewDustDirect(Vector2 Position, int Width, int Height, int Type, float SpeedX = 0f, float SpeedY = 0f, int Alpha = 0, Color newColor = default(Color), float Scale = 1f)
64 {
65 Dust dust = Main.dust[NewDust(Position, Width, Height, Type, SpeedX, SpeedY, Alpha, newColor, Scale)];
66 if (dust.velocity.HasNaNs())
67 {
68 dust.velocity = Vector2.Zero;
69 }
70 return dust;
71 }
72
73 public static int NewDust(Vector2 Position, int Width, int Height, int Type, float SpeedX = 0f, float SpeedY = 0f, int Alpha = 0, Color newColor = default(Color), float Scale = 1f)
74 {
75 if (Main.gameMenu)
76 {
77 return 6000;
78 }
79 if (Main.rand == null)
80 {
81 Main.rand = new UnifiedRandom((int)DateTime.Now.Ticks);
82 }
83 if (Main.gamePaused)
84 {
85 return 6000;
86 }
87 if (WorldGen.gen)
88 {
89 return 6000;
90 }
91 if (Main.netMode == 2)
92 {
93 return 6000;
94 }
95 int num = (int)(400f * (1f - dCount));
96 Rectangle rectangle = new Rectangle((int)(Main.screenPosition.X - (float)num), (int)(Main.screenPosition.Y - (float)num), Main.screenWidth + num * 2, Main.screenHeight + num * 2);
97 Rectangle value = new Rectangle((int)Position.X, (int)Position.Y, 10, 10);
98 if (!rectangle.Intersects(value))
99 {
100 return 6000;
101 }
102 int result = 6000;
103 for (int i = 0; i < 6000; i++)
104 {
105 Dust dust = Main.dust[i];
106 if (dust.active)
107 {
108 continue;
109 }
110 if ((double)i > (double)Main.maxDustToDraw * 0.9)
111 {
112 if (Main.rand.Next(4) != 0)
113 {
114 return 6000;
115 }
116 }
117 else if ((double)i > (double)Main.maxDustToDraw * 0.8)
118 {
119 if (Main.rand.Next(3) != 0)
120 {
121 return 6000;
122 }
123 }
124 else if ((double)i > (double)Main.maxDustToDraw * 0.7)
125 {
126 if (Main.rand.Next(2) == 0)
127 {
128 return 6000;
129 }
130 }
131 else if ((double)i > (double)Main.maxDustToDraw * 0.6)
132 {
133 if (Main.rand.Next(4) == 0)
134 {
135 return 6000;
136 }
137 }
138 else if ((double)i > (double)Main.maxDustToDraw * 0.5)
139 {
140 if (Main.rand.Next(5) == 0)
141 {
142 return 6000;
143 }
144 }
145 else
146 {
147 dCount = 0f;
148 }
149 int num2 = Width;
150 int num3 = Height;
151 if (num2 < 5)
152 {
153 num2 = 5;
154 }
155 if (num3 < 5)
156 {
157 num3 = 5;
158 }
159 result = i;
160 dust.fadeIn = 0f;
161 dust.active = true;
162 dust.type = Type;
163 dust.noGravity = false;
164 dust.color = newColor;
165 dust.alpha = Alpha;
166 dust.position.X = Position.X + (float)Main.rand.Next(num2 - 4) + 4f;
167 dust.position.Y = Position.Y + (float)Main.rand.Next(num3 - 4) + 4f;
168 dust.velocity.X = (float)Main.rand.Next(-20, 21) * 0.1f + SpeedX;
169 dust.velocity.Y = (float)Main.rand.Next(-20, 21) * 0.1f + SpeedY;
170 dust.frame.X = 10 * Type;
171 dust.frame.Y = 10 * Main.rand.Next(3);
172 dust.shader = null;
173 dust.customData = null;
174 dust.noLightEmittence = false;
175 int num4 = Type;
176 while (num4 >= 100)
177 {
178 num4 -= 100;
179 dust.frame.X -= 1000;
180 dust.frame.Y += 30;
181 }
182 dust.frame.Width = 8;
183 dust.frame.Height = 8;
184 dust.rotation = 0f;
185 dust.scale = 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
186 dust.scale *= Scale;
187 dust.noLight = false;
188 dust.firstFrame = true;
189 if (dust.type == 228 || dust.type == 279 || dust.type == 269 || dust.type == 135 || dust.type == 6 || dust.type == 242 || dust.type == 75 || dust.type == 169 || dust.type == 29 || (dust.type >= 59 && dust.type <= 65) || dust.type == 158 || dust.type == 293 || dust.type == 294 || dust.type == 295 || dust.type == 296 || dust.type == 297 || dust.type == 298 || dust.type == 302 || dust.type == 307 || dust.type == 310)
190 {
191 dust.velocity.Y = (float)Main.rand.Next(-10, 6) * 0.1f;
192 dust.velocity.X *= 0.3f;
193 dust.scale *= 0.7f;
194 }
195 if (dust.type == 127 || dust.type == 187)
196 {
197 dust.velocity *= 0.3f;
198 dust.scale *= 0.7f;
199 }
200 if (dust.type == 308)
201 {
202 dust.velocity *= 0.5f;
203 dust.velocity.Y += 1f;
204 }
205 if (dust.type == 33 || dust.type == 52 || dust.type == 266 || dust.type == 98 || dust.type == 99 || dust.type == 100 || dust.type == 101 || dust.type == 102 || dust.type == 103 || dust.type == 104 || dust.type == 105)
206 {
207 dust.alpha = 170;
208 dust.velocity *= 0.5f;
209 dust.velocity.Y += 1f;
210 }
211 if (dust.type == 41)
212 {
213 dust.velocity *= 0f;
214 }
215 if (dust.type == 80)
216 {
217 dust.alpha = 50;
218 }
219 if (dust.type == 34 || dust.type == 35 || dust.type == 152)
220 {
221 dust.velocity *= 0.1f;
222 dust.velocity.Y = -0.5f;
223 if (dust.type == 34 && !Collision.WetCollision(new Vector2(dust.position.X, dust.position.Y - 8f), 4, 4))
224 {
225 dust.active = false;
226 }
227 }
228 break;
229 }
230 return result;
231 }
232
233 public static Dust CloneDust(int dustIndex)
234 {
235 return CloneDust(Main.dust[dustIndex]);
236 }
237
238 public static Dust CloneDust(Dust rf)
239 {
240 if (rf.dustIndex == Main.maxDustToDraw)
241 {
242 return rf;
243 }
244 int num = NewDust(rf.position, 0, 0, rf.type);
245 Dust obj = Main.dust[num];
246 obj.position = rf.position;
247 obj.velocity = rf.velocity;
248 obj.fadeIn = rf.fadeIn;
249 obj.noGravity = rf.noGravity;
250 obj.scale = rf.scale;
251 obj.rotation = rf.rotation;
252 obj.noLight = rf.noLight;
253 obj.active = rf.active;
254 obj.type = rf.type;
255 obj.color = rf.color;
256 obj.alpha = rf.alpha;
257 obj.frame = rf.frame;
258 obj.shader = rf.shader;
259 obj.customData = rf.customData;
260 return obj;
261 }
262
263 public static Dust QuickDust(int x, int y, Color color)
264 {
265 return QuickDust(new Point(x, y), color);
266 }
267
268 public static Dust QuickDust(Point tileCoords, Color color)
269 {
270 return QuickDust(tileCoords.ToWorldCoordinates(), color);
271 }
272
273 public static void QuickBox(Vector2 topLeft, Vector2 bottomRight, int divisions, Color color, Action<Dust> manipulator)
274 {
275 float num = divisions + 2;
276 for (float num2 = 0f; num2 <= (float)(divisions + 2); num2 += 1f)
277 {
278 Dust obj = QuickDust(new Vector2(MathHelper.Lerp(topLeft.X, bottomRight.X, num2 / num), topLeft.Y), color);
279 manipulator?.Invoke(obj);
280 obj = QuickDust(new Vector2(MathHelper.Lerp(topLeft.X, bottomRight.X, num2 / num), bottomRight.Y), color);
281 manipulator?.Invoke(obj);
282 obj = QuickDust(new Vector2(topLeft.X, MathHelper.Lerp(topLeft.Y, bottomRight.Y, num2 / num)), color);
283 manipulator?.Invoke(obj);
284 obj = QuickDust(new Vector2(bottomRight.X, MathHelper.Lerp(topLeft.Y, bottomRight.Y, num2 / num)), color);
285 manipulator?.Invoke(obj);
286 }
287 }
288
289 public static void DrawDebugBox(Rectangle itemRectangle)
290 {
291 Vector2 vector = itemRectangle.TopLeft();
292 itemRectangle.BottomRight();
293 for (int i = 0; i <= itemRectangle.Width; i++)
294 {
295 for (int j = 0; j <= itemRectangle.Height; j++)
296 {
297 if (i == 0 || j == 0 || i == itemRectangle.Width - 1 || j == itemRectangle.Height - 1)
298 {
299 QuickDust(vector + new Vector2(i, j), Color.White).scale = 1f;
300 }
301 }
302 }
303 }
304
305 public static Dust QuickDust(Vector2 pos, Color color)
306 {
307 Dust obj = Main.dust[NewDust(pos, 0, 0, 267)];
308 obj.position = pos;
309 obj.velocity = Vector2.Zero;
310 obj.fadeIn = 1f;
311 obj.noLight = true;
312 obj.noGravity = true;
313 obj.color = color;
314 return obj;
315 }
316
317 public static Dust QuickDustSmall(Vector2 pos, Color color, bool floorPositionValues = false)
318 {
319 Dust dust = QuickDust(pos, color);
320 dust.fadeIn = 0f;
321 dust.scale = 0.35f;
322 if (floorPositionValues)
323 {
324 dust.position = dust.position.Floor();
325 }
326 return dust;
327 }
328
329 public static void QuickDustLine(Vector2 start, Vector2 end, float splits, Color color)
330 {
331 QuickDust(start, color).scale = 0.3f;
332 QuickDust(end, color).scale = 0.3f;
333 float num = 1f / splits;
334 for (float num2 = 0f; num2 < 1f; num2 += num)
335 {
336 QuickDust(Vector2.Lerp(start, end, num2), color).scale = 0.3f;
337 }
338 }
339
340 public static int dustWater()
341 {
342 return Main.waterStyle switch
343 {
344 2 => 98,
345 3 => 99,
346 4 => 100,
347 5 => 101,
348 6 => 102,
349 7 => 103,
350 8 => 104,
351 9 => 105,
352 10 => 123,
353 12 => 288,
354 _ => 33,
355 };
356 }
357
358 public static void UpdateDust()
359 {
360 int num = 0;
361 lavaBubbles = 0;
362 Main.snowDust = 0;
363 SandStormCount = 0;
365 for (int i = 0; i < 6000; i++)
366 {
367 Dust dust = Main.dust[i];
368 if (i < Main.maxDustToDraw)
369 {
370 if (!dust.active)
371 {
372 continue;
373 }
374 dCount += 1f;
375 if (dust.scale > 10f)
376 {
377 dust.active = false;
378 }
380 {
381 if (Main.rand.Next(2) == 0)
382 {
383 dust.firstFrame = false;
384 dust.type = 16;
385 dust.scale = Main.rand.NextFloat() * 1.6f + 0.3f;
386 dust.color = Color.Transparent;
387 dust.frame.X = 10 * dust.type;
388 dust.frame.Y = 10 * Main.rand.Next(3);
389 dust.shader = null;
390 dust.customData = null;
391 int num2 = dust.type / 100;
392 dust.frame.X -= 1000 * num2;
393 dust.frame.Y += 30 * num2;
394 dust.noGravity = true;
395 }
396 else
397 {
398 dust.active = false;
399 }
400 }
401 int num3 = dust.type;
402 if ((uint)(num3 - 299) <= 2u || num3 == 305)
403 {
404 dust.scale *= 0.96f;
405 dust.velocity.Y -= 0.01f;
406 }
407 if (dust.type == 35)
408 {
409 lavaBubbles++;
410 }
411 dust.position += dust.velocity;
412 if (dust.type == 258)
413 {
414 dust.noGravity = true;
415 dust.scale += 0.015f;
416 }
417 if (dust.type == 309)
418 {
419 float r = (float)(int)dust.color.R / 255f * dust.scale;
420 float g = (float)(int)dust.color.G / 255f * dust.scale;
421 float b = (float)(int)dust.color.B / 255f * dust.scale;
422 Lighting.AddLight(dust.position, r, g, b);
423 dust.scale *= 0.97f;
424 }
425 if (((dust.type >= 86 && dust.type <= 92) || dust.type == 286) && !dust.noLight && !dust.noLightEmittence)
426 {
427 float num4 = dust.scale * 0.6f;
428 if (num4 > 1f)
429 {
430 num4 = 1f;
431 }
432 int num5 = dust.type - 85;
433 float num6 = num4;
434 float num7 = num4;
435 float num8 = num4;
436 switch (num5)
437 {
438 case 3:
439 num6 *= 0f;
440 num7 *= 0.1f;
441 num8 *= 1.3f;
442 break;
443 case 5:
444 num6 *= 1f;
445 num7 *= 0.1f;
446 num8 *= 0.1f;
447 break;
448 case 4:
449 num6 *= 0f;
450 num7 *= 1f;
451 num8 *= 0.1f;
452 break;
453 case 1:
454 num6 *= 0.9f;
455 num7 *= 0f;
456 num8 *= 0.9f;
457 break;
458 case 6:
459 num6 *= 1.3f;
460 num7 *= 1.3f;
461 num8 *= 1.3f;
462 break;
463 case 2:
464 num6 *= 0.9f;
465 num7 *= 0.9f;
466 num8 *= 0f;
467 break;
468 }
469 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num4 * num6, num4 * num7, num4 * num8);
470 }
471 if ((dust.type >= 86 && dust.type <= 92) || dust.type == 286)
472 {
473 if (dust.customData != null && dust.customData is Player)
474 {
475 Player player = (Player)dust.customData;
476 dust.position += player.position - player.oldPosition;
477 }
478 else if (dust.customData != null && dust.customData is Projectile)
479 {
480 Projectile projectile = (Projectile)dust.customData;
481 if (projectile.active)
482 {
483 dust.position += projectile.position - projectile.oldPosition;
484 }
485 }
486 }
487 if (dust.type == 262 && !dust.noLight)
488 {
489 Vector3 rgb = new Vector3(0.9f, 0.6f, 0f) * dust.scale * 0.6f;
490 Lighting.AddLight(dust.position, rgb);
491 }
492 if (dust.type == 240 && dust.customData != null && dust.customData is Projectile)
493 {
494 Projectile projectile2 = (Projectile)dust.customData;
495 if (projectile2.active)
496 {
497 dust.position += projectile2.position - projectile2.oldPosition;
498 }
499 }
500 if ((dust.type == 259 || dust.type == 6 || dust.type == 158 || dust.type == 135) && dust.customData != null && dust.customData is int)
501 {
502 if ((int)dust.customData == 0)
503 {
504 if (Collision.SolidCollision(dust.position - Vector2.One * 5f, 10, 10) && dust.fadeIn == 0f)
505 {
506 dust.scale *= 0.9f;
507 dust.velocity *= 0.25f;
508 }
509 }
510 else if ((int)dust.customData == 1)
511 {
512 dust.scale *= 0.98f;
513 dust.velocity.Y *= 0.98f;
514 if (Collision.SolidCollision(dust.position - Vector2.One * 5f, 10, 10) && dust.fadeIn == 0f)
515 {
516 dust.scale *= 0.9f;
517 dust.velocity *= 0.25f;
518 }
519 }
520 }
521 if (dust.type == 263 || dust.type == 264)
522 {
523 if (!dust.noLight)
524 {
525 Vector3 rgb2 = dust.color.ToVector3() * dust.scale * 0.4f;
526 Lighting.AddLight(dust.position, rgb2);
527 }
528 if (dust.customData != null && dust.customData is Player)
529 {
530 Player player2 = (Player)dust.customData;
531 dust.position += player2.position - player2.oldPosition;
532 dust.customData = null;
533 }
534 else if (dust.customData != null && dust.customData is Projectile)
535 {
536 Projectile projectile3 = (Projectile)dust.customData;
537 dust.position += projectile3.position - projectile3.oldPosition;
538 }
539 }
540 if (dust.type == 230)
541 {
542 float num9 = dust.scale * 0.6f;
543 float num10 = num9;
544 float num11 = num9;
545 float num12 = num9;
546 num10 *= 0.5f;
547 num11 *= 0.9f;
548 num12 *= 1f;
549 dust.scale += 0.02f;
550 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num9 * num10, num9 * num11, num9 * num12);
551 if (dust.customData != null && dust.customData is Player)
552 {
553 Vector2 center = ((Player)dust.customData).Center;
554 Vector2 vector = dust.position - center;
555 float num13 = vector.Length();
556 vector /= num13;
557 dust.scale = Math.Min(dust.scale, num13 / 24f - 1f);
558 dust.velocity -= vector * (100f / Math.Max(50f, num13));
559 }
560 }
561 if (dust.type == 154 || dust.type == 218)
562 {
563 dust.rotation += dust.velocity.X * 0.3f;
564 dust.scale -= 0.03f;
565 }
566 if (dust.type == 172)
567 {
568 float num14 = dust.scale * 0.5f;
569 if (num14 > 1f)
570 {
571 num14 = 1f;
572 }
573 float num15 = num14;
574 float num16 = num14;
575 float num17 = num14;
576 num15 *= 0f;
577 num16 *= 0.25f;
578 num17 *= 1f;
579 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num14 * num15, num14 * num16, num14 * num17);
580 }
581 if (dust.type == 182)
582 {
583 dust.rotation += 1f;
584 if (!dust.noLight)
585 {
586 float num18 = dust.scale * 0.25f;
587 if (num18 > 1f)
588 {
589 num18 = 1f;
590 }
591 float num19 = num18;
592 float num20 = num18;
593 float num21 = num18;
594 num19 *= 1f;
595 num20 *= 0.2f;
596 num21 *= 0.1f;
597 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num18 * num19, num18 * num20, num18 * num21);
598 }
599 if (dust.customData != null && dust.customData is Player)
600 {
601 Player player3 = (Player)dust.customData;
602 dust.position += player3.position - player3.oldPosition;
603 dust.customData = null;
604 }
605 }
606 if (dust.type == 261)
607 {
608 if (!dust.noLight && !dust.noLightEmittence)
609 {
610 float num22 = dust.scale * 0.3f;
611 if (num22 > 1f)
612 {
613 num22 = 1f;
614 }
615 Lighting.AddLight(dust.position, new Vector3(0.4f, 0.6f, 0.7f) * num22);
616 }
617 if (dust.noGravity)
618 {
619 dust.velocity *= 0.93f;
620 if (dust.fadeIn == 0f)
621 {
622 dust.scale += 0.0025f;
623 }
624 }
625 dust.velocity *= new Vector2(0.97f, 0.99f);
626 dust.scale -= 0.0025f;
627 if (dust.customData != null && dust.customData is Player)
628 {
629 Player player4 = (Player)dust.customData;
630 dust.position += player4.position - player4.oldPosition;
631 }
632 }
633 if (dust.type == 254)
634 {
635 float num23 = dust.scale * 0.35f;
636 if (num23 > 1f)
637 {
638 num23 = 1f;
639 }
640 float num24 = num23;
641 float num25 = num23;
642 float num26 = num23;
643 num24 *= 0.9f;
644 num25 *= 0.1f;
645 num26 *= 0.75f;
646 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num23 * num24, num23 * num25, num23 * num26);
647 }
648 if (dust.type == 255)
649 {
650 float num27 = dust.scale * 0.25f;
651 if (num27 > 1f)
652 {
653 num27 = 1f;
654 }
655 float num28 = num27;
656 float num29 = num27;
657 float num30 = num27;
658 num28 *= 0.9f;
659 num29 *= 0.1f;
660 num30 *= 0.75f;
661 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num27 * num28, num27 * num29, num27 * num30);
662 }
663 if (dust.type == 211 && dust.noLight && Collision.SolidCollision(dust.position, 4, 4))
664 {
665 dust.active = false;
666 }
667 if (dust.type == 284 && Collision.SolidCollision(dust.position - Vector2.One * 4f, 8, 8) && dust.fadeIn == 0f)
668 {
669 dust.velocity *= 0.25f;
670 }
671 if (dust.type == 213 || dust.type == 260)
672 {
673 dust.rotation = 0f;
674 float num31 = dust.scale / 2.5f * 0.2f;
675 Vector3 vector2 = Vector3.Zero;
676 switch (dust.type)
677 {
678 case 213:
679 vector2 = new Vector3(255f, 217f, 48f);
680 break;
681 case 260:
682 vector2 = new Vector3(255f, 48f, 48f);
683 break;
684 }
685 vector2 /= 255f;
686 if (num31 > 1f)
687 {
688 num31 = 1f;
689 }
690 vector2 *= num31;
691 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), vector2.X, vector2.Y, vector2.Z);
692 }
693 if (dust.type == 157)
694 {
695 float num32 = dust.scale * 0.2f;
696 float num33 = num32;
697 float num34 = num32;
698 float num35 = num32;
699 num33 *= 0.25f;
700 num34 *= 1f;
701 num35 *= 0.5f;
702 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num32 * num33, num32 * num34, num32 * num35);
703 }
704 if (dust.type == 206)
705 {
706 dust.scale -= 0.1f;
707 float num36 = dust.scale * 0.4f;
708 float num37 = num36;
709 float num38 = num36;
710 float num39 = num36;
711 num37 *= 0.1f;
712 num38 *= 0.6f;
713 num39 *= 1f;
714 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num36 * num37, num36 * num38, num36 * num39);
715 }
716 if (dust.type == 163)
717 {
718 float num40 = dust.scale * 0.25f;
719 float num41 = num40;
720 float num42 = num40;
721 float num43 = num40;
722 num41 *= 0.25f;
723 num42 *= 1f;
724 num43 *= 0.05f;
725 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num40 * num41, num40 * num42, num40 * num43);
726 }
727 if (dust.type == 205)
728 {
729 float num44 = dust.scale * 0.25f;
730 float num45 = num44;
731 float num46 = num44;
732 float num47 = num44;
733 num45 *= 1f;
734 num46 *= 0.05f;
735 num47 *= 1f;
736 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num44 * num45, num44 * num46, num44 * num47);
737 }
738 if (dust.type == 170)
739 {
740 float num48 = dust.scale * 0.5f;
741 float num49 = num48;
742 float num50 = num48;
743 float num51 = num48;
744 num49 *= 1f;
745 num50 *= 1f;
746 num51 *= 0.05f;
747 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num48 * num49, num48 * num50, num48 * num51);
748 }
749 if (dust.type == 156)
750 {
751 float num52 = dust.scale * 0.6f;
752 _ = dust.type;
753 float num53 = num52;
754 float num54 = num52;
755 num53 *= 0.9f;
756 num54 *= 1f;
757 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 12, num52);
758 }
759 if (dust.type == 234)
760 {
761 float lightAmount = dust.scale * 0.6f;
762 _ = dust.type;
763 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 13, lightAmount);
764 }
765 if (dust.type == 175)
766 {
767 dust.scale -= 0.05f;
768 }
769 if (dust.type == 174)
770 {
771 dust.scale -= 0.01f;
772 float num55 = dust.scale * 1f;
773 if (num55 > 0.6f)
774 {
775 num55 = 0.6f;
776 }
777 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num55, num55 * 0.4f, 0f);
778 }
779 if (dust.type == 235)
780 {
781 Vector2 vector3 = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
782 vector3.Normalize();
783 vector3 *= 15f;
784 dust.scale -= 0.01f;
785 }
786 else if (dust.type == 228 || dust.type == 279 || dust.type == 229 || dust.type == 6 || dust.type == 242 || dust.type == 135 || dust.type == 127 || dust.type == 187 || dust.type == 75 || dust.type == 169 || dust.type == 29 || (dust.type >= 59 && dust.type <= 65) || dust.type == 158 || dust.type == 293 || dust.type == 294 || dust.type == 295 || dust.type == 296 || dust.type == 297 || dust.type == 298 || dust.type == 302 || dust.type == 307 || dust.type == 310)
787 {
788 if (!dust.noGravity)
789 {
790 dust.velocity.Y += 0.05f;
791 }
792 if (dust.type == 229 || dust.type == 228 || dust.type == 279)
793 {
794 if (dust.customData != null && dust.customData is NPC)
795 {
796 NPC nPC = (NPC)dust.customData;
797 dust.position += nPC.position - nPC.oldPos[1];
798 }
799 else if (dust.customData != null && dust.customData is Player)
800 {
801 Player player5 = (Player)dust.customData;
802 dust.position += player5.position - player5.oldPosition;
803 }
804 else if (dust.customData != null && dust.customData is Vector2)
805 {
806 Vector2 vector4 = (Vector2)dust.customData - dust.position;
807 if (vector4 != Vector2.Zero)
808 {
809 vector4.Normalize();
810 }
811 dust.velocity = (dust.velocity * 4f + vector4 * dust.velocity.Length()) / 5f;
812 }
813 }
814 if (!dust.noLight && !dust.noLightEmittence)
815 {
816 float num56 = dust.scale * 1.4f;
817 if (dust.type == 29)
818 {
819 if (num56 > 1f)
820 {
821 num56 = 1f;
822 }
823 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56 * 0.1f, num56 * 0.4f, num56);
824 }
825 else if (dust.type == 75)
826 {
827 if (num56 > 1f)
828 {
829 num56 = 1f;
830 }
831 if (dust.customData is float)
832 {
833 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 8, num56 * (float)dust.customData);
834 }
835 else
836 {
837 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 8, num56);
838 }
839 }
840 else if (dust.type == 169)
841 {
842 if (num56 > 1f)
843 {
844 num56 = 1f;
845 }
846 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 11, num56);
847 }
848 else if (dust.type == 135)
849 {
850 if (num56 > 1f)
851 {
852 num56 = 1f;
853 }
854 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 9, num56);
855 }
856 else if (dust.type == 158)
857 {
858 if (num56 > 1f)
859 {
860 num56 = 1f;
861 }
862 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 10, num56);
863 }
864 else if (dust.type == 228)
865 {
866 if (num56 > 1f)
867 {
868 num56 = 1f;
869 }
870 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56 * 0.7f, num56 * 0.65f, num56 * 0.3f);
871 }
872 else if (dust.type == 229)
873 {
874 if (num56 > 1f)
875 {
876 num56 = 1f;
877 }
878 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56 * 0.3f, num56 * 0.65f, num56 * 0.7f);
879 }
880 else if (dust.type == 242)
881 {
882 if (num56 > 1f)
883 {
884 num56 = 1f;
885 }
886 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 15, num56);
887 }
888 else if (dust.type == 293)
889 {
890 if (num56 > 1f)
891 {
892 num56 = 1f;
893 }
894 num56 *= 0.95f;
895 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 16, num56);
896 }
897 else if (dust.type == 294)
898 {
899 if (num56 > 1f)
900 {
901 num56 = 1f;
902 }
903 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 17, num56);
904 }
905 else if (dust.type >= 59 && dust.type <= 65)
906 {
907 if (num56 > 0.8f)
908 {
909 num56 = 0.8f;
910 }
911 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 1 + dust.type - 59, num56);
912 }
913 else if (dust.type == 127)
914 {
915 num56 *= 1.3f;
916 if (num56 > 1f)
917 {
918 num56 = 1f;
919 }
920 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56, num56 * 0.45f, num56 * 0.2f);
921 }
922 else if (dust.type == 187)
923 {
924 num56 *= 1.3f;
925 if (num56 > 1f)
926 {
927 num56 = 1f;
928 }
929 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56 * 0.2f, num56 * 0.45f, num56);
930 }
931 else if (dust.type == 295)
932 {
933 if (num56 > 1f)
934 {
935 num56 = 1f;
936 }
937 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 18, num56);
938 }
939 else if (dust.type == 296)
940 {
941 if (num56 > 1f)
942 {
943 num56 = 1f;
944 }
945 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 19, num56);
946 }
947 else if (dust.type == 297)
948 {
949 if (num56 > 1f)
950 {
951 num56 = 1f;
952 }
953 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 20, num56);
954 }
955 else if (dust.type == 298)
956 {
957 if (num56 > 1f)
958 {
959 num56 = 1f;
960 }
961 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 21, num56);
962 }
963 else if (dust.type == 307)
964 {
965 if (num56 > 1f)
966 {
967 num56 = 1f;
968 }
969 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 22, num56);
970 }
971 else if (dust.type == 310)
972 {
973 if (num56 > 1f)
974 {
975 num56 = 1f;
976 }
977 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 23, num56);
978 }
979 else
980 {
981 if (num56 > 0.6f)
982 {
983 num56 = 0.6f;
984 }
985 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56, num56 * 0.65f, num56 * 0.4f);
986 }
987 }
988 }
989 else if (dust.type == 306)
990 {
991 if (!dust.noGravity)
992 {
993 dust.velocity.Y += 0.05f;
994 }
995 dust.scale -= 0.04f;
996 if (Collision.SolidCollision(dust.position - Vector2.One * 5f, 10, 10) && dust.fadeIn == 0f)
997 {
998 dust.scale *= 0.9f;
999 dust.velocity *= 0.25f;
1000 }
1001 }
1002 else if (dust.type == 269)
1003 {
1004 if (!dust.noLight)
1005 {
1006 float num57 = dust.scale * 1.4f;
1007 if (num57 > 1f)
1008 {
1009 num57 = 1f;
1010 }
1011 Lighting.AddLight(rgb: new Vector3(0.7f, 0.65f, 0.3f) * num57, position: dust.position);
1012 }
1013 if (dust.customData != null && dust.customData is Vector2)
1014 {
1015 Vector2 vector5 = (Vector2)dust.customData - dust.position;
1016 dust.velocity.X += 1f * (float)Math.Sign(vector5.X) * dust.scale;
1017 }
1018 }
1019 else if (dust.type == 159)
1020 {
1021 float num58 = dust.scale * 1.3f;
1022 if (num58 > 1f)
1023 {
1024 num58 = 1f;
1025 }
1026 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num58, num58, num58 * 0.1f);
1027 if (dust.noGravity)
1028 {
1029 if (dust.scale < 0.7f)
1030 {
1031 dust.velocity *= 1.075f;
1032 }
1033 else if (Main.rand.Next(2) == 0)
1034 {
1035 dust.velocity *= -0.95f;
1036 }
1037 else
1038 {
1039 dust.velocity *= 1.05f;
1040 }
1041 dust.scale -= 0.03f;
1042 }
1043 else
1044 {
1045 dust.scale += 0.005f;
1046 dust.velocity *= 0.9f;
1047 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.02f;
1048 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.02f;
1049 if (Main.rand.Next(5) == 0)
1050 {
1051 int num59 = NewDust(dust.position, 4, 4, dust.type);
1052 Main.dust[num59].noGravity = true;
1053 Main.dust[num59].scale = dust.scale * 2.5f;
1054 }
1055 }
1056 }
1057 else if (dust.type == 164)
1058 {
1059 float num60 = dust.scale;
1060 if (num60 > 1f)
1061 {
1062 num60 = 1f;
1063 }
1064 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num60, num60 * 0.1f, num60 * 0.8f);
1065 if (dust.noGravity)
1066 {
1067 if (dust.scale < 0.7f)
1068 {
1069 dust.velocity *= 1.075f;
1070 }
1071 else if (Main.rand.Next(2) == 0)
1072 {
1073 dust.velocity *= -0.95f;
1074 }
1075 else
1076 {
1077 dust.velocity *= 1.05f;
1078 }
1079 dust.scale -= 0.03f;
1080 }
1081 else
1082 {
1083 dust.scale -= 0.005f;
1084 dust.velocity *= 0.9f;
1085 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.02f;
1086 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.02f;
1087 if (Main.rand.Next(5) == 0)
1088 {
1089 int num61 = NewDust(dust.position, 4, 4, dust.type);
1090 Main.dust[num61].noGravity = true;
1091 Main.dust[num61].scale = dust.scale * 2.5f;
1092 }
1093 }
1094 }
1095 else if (dust.type == 173)
1096 {
1097 float num62 = dust.scale;
1098 if (num62 > 1f)
1099 {
1100 num62 = 1f;
1101 }
1102 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num62 * 0.4f, num62 * 0.1f, num62);
1103 if (dust.noGravity)
1104 {
1105 dust.velocity *= 0.8f;
1106 dust.velocity.X += (float)Main.rand.Next(-20, 21) * 0.01f;
1107 dust.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.01f;
1108 dust.scale -= 0.01f;
1109 }
1110 else
1111 {
1112 dust.scale -= 0.015f;
1113 dust.velocity *= 0.8f;
1114 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.005f;
1115 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.005f;
1116 if (Main.rand.Next(10) == 10)
1117 {
1118 int num63 = NewDust(dust.position, 4, 4, dust.type);
1119 Main.dust[num63].noGravity = true;
1120 Main.dust[num63].scale = dust.scale;
1121 }
1122 }
1123 }
1124 else if (dust.type == 304)
1125 {
1126 dust.velocity.Y = (float)Math.Sin(dust.rotation) / 5f;
1127 dust.rotation += 0.015f;
1128 if (dust.scale < 1.15f)
1129 {
1130 dust.alpha = Math.Max(0, dust.alpha - 20);
1131 dust.scale += 0.0015f;
1132 }
1133 else
1134 {
1135 dust.alpha += 6;
1136 if (dust.alpha >= 255)
1137 {
1138 dust.active = false;
1139 }
1140 }
1141 if (dust.customData != null && dust.customData is Player)
1142 {
1143 Player player6 = (Player)dust.customData;
1144 float num64 = Utils.Remap(dust.scale, 1f, 1.05f, 1f, 0f);
1145 if (num64 > 0f)
1146 {
1147 dust.position += player6.velocity * num64;
1148 }
1149 float num65 = player6.Center.X - dust.position.X;
1150 if (Math.Abs(num65) > 20f)
1151 {
1152 float value = num65 * 0.01f;
1153 dust.velocity.X = MathHelper.Lerp(dust.velocity.X, value, num64 * 0.2f);
1154 }
1155 }
1156 }
1157 else if (dust.type == 184)
1158 {
1159 if (!dust.noGravity)
1160 {
1161 dust.velocity *= 0f;
1162 dust.scale -= 0.01f;
1163 }
1164 }
1165 else if (dust.type == 160 || dust.type == 162)
1166 {
1167 float num66 = dust.scale * 1.3f;
1168 if (num66 > 1f)
1169 {
1170 num66 = 1f;
1171 }
1172 if (dust.type == 162)
1173 {
1174 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num66, num66 * 0.7f, num66 * 0.1f);
1175 }
1176 else
1177 {
1178 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num66 * 0.1f, num66, num66);
1179 }
1180 if (dust.noGravity)
1181 {
1182 dust.velocity *= 0.8f;
1183 dust.velocity.X += (float)Main.rand.Next(-20, 21) * 0.04f;
1184 dust.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.04f;
1185 dust.scale -= 0.1f;
1186 }
1187 else
1188 {
1189 dust.scale -= 0.1f;
1190 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.02f;
1191 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.02f;
1192 if ((double)dust.scale > 0.3 && Main.rand.Next(50) == 0)
1193 {
1194 int num67 = NewDust(new Vector2(dust.position.X - 4f, dust.position.Y - 4f), 1, 1, dust.type);
1195 Main.dust[num67].noGravity = true;
1196 Main.dust[num67].scale = dust.scale * 1.5f;
1197 }
1198 }
1199 }
1200 else if (dust.type == 168)
1201 {
1202 float num68 = dust.scale * 0.8f;
1203 if ((double)num68 > 0.55)
1204 {
1205 num68 = 0.55f;
1206 }
1207 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num68, 0f, num68 * 0.8f);
1208 dust.scale += 0.03f;
1209 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.02f;
1210 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.02f;
1211 dust.velocity *= 0.99f;
1212 }
1213 else if (dust.type >= 139 && dust.type < 143)
1214 {
1215 dust.velocity.X *= 0.98f;
1216 dust.velocity.Y *= 0.98f;
1217 if (dust.velocity.Y < 1f)
1218 {
1219 dust.velocity.Y += 0.05f;
1220 }
1221 dust.scale += 0.009f;
1222 dust.rotation -= dust.velocity.X * 0.4f;
1223 if (dust.velocity.X > 0f)
1224 {
1225 dust.rotation += 0.005f;
1226 }
1227 else
1228 {
1229 dust.rotation -= 0.005f;
1230 }
1231 }
1232 else if (dust.type == 14 || dust.type == 16 || dust.type == 31 || dust.type == 46 || dust.type == 124 || dust.type == 186 || dust.type == 188 || dust.type == 303)
1233 {
1234 dust.velocity.Y *= 0.98f;
1235 dust.velocity.X *= 0.98f;
1236 if (dust.type == 31)
1237 {
1238 if (dust.customData != null && dust.customData is float)
1239 {
1240 float num69 = (float)dust.customData;
1241 dust.velocity.Y += num69;
1242 }
1243 if (dust.customData != null && dust.customData is NPC)
1244 {
1245 NPC nPC2 = (NPC)dust.customData;
1246 dust.position += nPC2.position - nPC2.oldPosition;
1247 if (dust.noGravity)
1248 {
1249 dust.velocity *= 1.02f;
1250 }
1251 dust.alpha -= 70;
1252 if (dust.alpha < 0)
1253 {
1254 dust.alpha = 0;
1255 }
1256 dust.scale *= 0.97f;
1257 if (dust.scale <= 0.01f)
1258 {
1259 dust.scale = 0.0001f;
1260 dust.alpha = 255;
1261 }
1262 }
1263 else if (dust.noGravity)
1264 {
1265 dust.velocity *= 1.02f;
1266 dust.scale += 0.02f;
1267 dust.alpha += 4;
1268 if (dust.alpha > 255)
1269 {
1270 dust.scale = 0.0001f;
1271 dust.alpha = 255;
1272 }
1273 }
1274 }
1275 if (dust.type == 303 && dust.noGravity)
1276 {
1277 dust.velocity *= 1.02f;
1278 dust.scale += 0.03f;
1279 if (dust.alpha < 90)
1280 {
1281 dust.alpha = 90;
1282 }
1283 dust.alpha += 4;
1284 if (dust.alpha > 255)
1285 {
1286 dust.scale = 0.0001f;
1287 dust.alpha = 255;
1288 }
1289 }
1290 }
1291 else if (dust.type == 32)
1292 {
1293 dust.scale -= 0.01f;
1294 dust.velocity.X *= 0.96f;
1295 if (!dust.noGravity)
1296 {
1297 dust.velocity.Y += 0.1f;
1298 }
1299 }
1300 else if (dust.type >= 244 && dust.type <= 247)
1301 {
1302 dust.rotation += 0.1f * dust.scale;
1303 Color color = Lighting.GetColor((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f));
1304 byte num70 = (byte)((color.R + color.G + color.B) / 3);
1305 float num71 = ((float)(int)num70 / 270f + 1f) / 2f;
1306 float num72 = ((float)(int)num70 / 270f + 1f) / 2f;
1307 float num73 = ((float)(int)num70 / 270f + 1f) / 2f;
1308 num71 *= dust.scale * 0.9f;
1309 num72 *= dust.scale * 0.9f;
1310 num73 *= dust.scale * 0.9f;
1311 if (dust.alpha < 255)
1312 {
1313 dust.scale += 0.09f;
1314 if (dust.scale >= 1f)
1315 {
1316 dust.scale = 1f;
1317 dust.alpha = 255;
1318 }
1319 }
1320 else
1321 {
1322 if ((double)dust.scale < 0.8)
1323 {
1324 dust.scale -= 0.01f;
1325 }
1326 if ((double)dust.scale < 0.5)
1327 {
1328 dust.scale -= 0.01f;
1329 }
1330 }
1331 float num74 = 1f;
1332 if (dust.type == 244)
1333 {
1334 num71 *= 0.8862745f;
1335 num72 *= 0.4627451f;
1336 num73 *= 0.29803923f;
1337 num74 = 0.9f;
1338 }
1339 else if (dust.type == 245)
1340 {
1341 num71 *= 0.5137255f;
1342 num72 *= 0.6745098f;
1343 num73 *= 0.6784314f;
1344 num74 = 1f;
1345 }
1346 else if (dust.type == 246)
1347 {
1348 num71 *= 0.8f;
1349 num72 *= 0.70980394f;
1350 num73 *= 24f / 85f;
1351 num74 = 1.1f;
1352 }
1353 else if (dust.type == 247)
1354 {
1355 num71 *= 0.6f;
1356 num72 *= 0.6745098f;
1357 num73 *= 37f / 51f;
1358 num74 = 1.2f;
1359 }
1360 num71 *= num74;
1361 num72 *= num74;
1362 num73 *= num74;
1363 if (!dust.noLightEmittence)
1364 {
1365 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num71, num72, num73);
1366 }
1367 }
1368 else if (dust.type == 43)
1369 {
1370 dust.rotation += 0.1f * dust.scale;
1371 Color color2 = Lighting.GetColor((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f));
1372 float num75 = (float)(int)color2.R / 270f;
1373 float num76 = (float)(int)color2.G / 270f;
1374 float num77 = (float)(int)color2.B / 270f;
1375 float num78 = (float)(int)dust.color.R / 255f;
1376 float num79 = (float)(int)dust.color.G / 255f;
1377 float num80 = (float)(int)dust.color.B / 255f;
1378 num75 *= dust.scale * 1.07f * num78;
1379 num76 *= dust.scale * 1.07f * num79;
1380 num77 *= dust.scale * 1.07f * num80;
1381 if (dust.alpha < 255)
1382 {
1383 dust.scale += 0.09f;
1384 if (dust.scale >= 1f)
1385 {
1386 dust.scale = 1f;
1387 dust.alpha = 255;
1388 }
1389 }
1390 else
1391 {
1392 if ((double)dust.scale < 0.8)
1393 {
1394 dust.scale -= 0.01f;
1395 }
1396 if ((double)dust.scale < 0.5)
1397 {
1398 dust.scale -= 0.01f;
1399 }
1400 }
1401 if ((double)num75 < 0.05 && (double)num76 < 0.05 && (double)num77 < 0.05)
1402 {
1403 dust.active = false;
1404 }
1405 else if (!dust.noLightEmittence)
1406 {
1407 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num75, num76, num77);
1408 }
1409 if (dust.customData != null && dust.customData is Player)
1410 {
1411 Player player7 = (Player)dust.customData;
1412 dust.position += player7.position - player7.oldPosition;
1413 }
1414 }
1415 else if (dust.type == 15 || dust.type == 57 || dust.type == 58 || dust.type == 274 || dust.type == 292)
1416 {
1417 dust.velocity.Y *= 0.98f;
1418 dust.velocity.X *= 0.98f;
1419 if (!dust.noLightEmittence)
1420 {
1421 float num81 = dust.scale;
1422 if (dust.type != 15)
1423 {
1424 num81 = dust.scale * 0.8f;
1425 }
1426 if (dust.noLight)
1427 {
1428 dust.velocity *= 0.95f;
1429 }
1430 if (num81 > 1f)
1431 {
1432 num81 = 1f;
1433 }
1434 if (dust.type == 15)
1435 {
1436 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num81 * 0.45f, num81 * 0.55f, num81);
1437 }
1438 else if (dust.type == 57)
1439 {
1440 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num81 * 0.95f, num81 * 0.95f, num81 * 0.45f);
1441 }
1442 else if (dust.type == 58)
1443 {
1444 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num81, num81 * 0.55f, num81 * 0.75f);
1445 }
1446 }
1447 }
1448 else if (dust.type == 204)
1449 {
1450 if (dust.fadeIn > dust.scale)
1451 {
1452 dust.scale += 0.02f;
1453 }
1454 else
1455 {
1456 dust.scale -= 0.02f;
1457 }
1458 dust.velocity *= 0.95f;
1459 }
1460 else if (dust.type == 110)
1461 {
1462 float num82 = dust.scale * 0.1f;
1463 if (num82 > 1f)
1464 {
1465 num82 = 1f;
1466 }
1467 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num82 * 0.2f, num82, num82 * 0.5f);
1468 }
1469 else if (dust.type == 111)
1470 {
1471 float num83 = dust.scale * 0.125f;
1472 if (num83 > 1f)
1473 {
1474 num83 = 1f;
1475 }
1476 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num83 * 0.2f, num83 * 0.7f, num83);
1477 }
1478 else if (dust.type == 112)
1479 {
1480 float num84 = dust.scale * 0.1f;
1481 if (num84 > 1f)
1482 {
1483 num84 = 1f;
1484 }
1485 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num84 * 0.8f, num84 * 0.2f, num84 * 0.8f);
1486 }
1487 else if (dust.type == 113)
1488 {
1489 float num85 = dust.scale * 0.1f;
1490 if (num85 > 1f)
1491 {
1492 num85 = 1f;
1493 }
1494 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num85 * 0.2f, num85 * 0.3f, num85 * 1.3f);
1495 }
1496 else if (dust.type == 114)
1497 {
1498 float num86 = dust.scale * 0.1f;
1499 if (num86 > 1f)
1500 {
1501 num86 = 1f;
1502 }
1503 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num86 * 1.2f, num86 * 0.5f, num86 * 0.4f);
1504 }
1505 else if (dust.type == 311)
1506 {
1507 float num87 = dust.scale * 0.1f;
1508 if (num87 > 1f)
1509 {
1510 num87 = 1f;
1511 }
1512 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 16, num87);
1513 }
1514 else if (dust.type == 312)
1515 {
1516 float num88 = dust.scale * 0.1f;
1517 if (num88 > 1f)
1518 {
1519 num88 = 1f;
1520 }
1521 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 9, num88);
1522 }
1523 else if (dust.type == 313)
1524 {
1525 float num89 = dust.scale * 0.25f;
1526 if (num89 > 1f)
1527 {
1528 num89 = 1f;
1529 }
1530 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num89 * 1f, num89 * 0.8f, num89 * 0.6f);
1531 }
1532 else if (dust.type == 66)
1533 {
1534 if (dust.velocity.X < 0f)
1535 {
1536 dust.rotation -= 1f;
1537 }
1538 else
1539 {
1540 dust.rotation += 1f;
1541 }
1542 dust.velocity.Y *= 0.98f;
1543 dust.velocity.X *= 0.98f;
1544 dust.scale += 0.02f;
1545 float num90 = dust.scale;
1546 if (dust.type != 15)
1547 {
1548 num90 = dust.scale * 0.8f;
1549 }
1550 if (num90 > 1f)
1551 {
1552 num90 = 1f;
1553 }
1554 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num90 * ((float)(int)dust.color.R / 255f), num90 * ((float)(int)dust.color.G / 255f), num90 * ((float)(int)dust.color.B / 255f));
1555 }
1556 else if (dust.type == 267)
1557 {
1558 if (dust.velocity.X < 0f)
1559 {
1560 dust.rotation -= 1f;
1561 }
1562 else
1563 {
1564 dust.rotation += 1f;
1565 }
1566 dust.velocity.Y *= 0.98f;
1567 dust.velocity.X *= 0.98f;
1568 dust.scale += 0.02f;
1569 float num91 = dust.scale * 0.8f;
1570 if (num91 > 1f)
1571 {
1572 num91 = 1f;
1573 }
1574 if (dust.noLight)
1575 {
1576 dust.noLight = false;
1577 }
1578 if (!dust.noLight && !dust.noLightEmittence)
1579 {
1580 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num91 * ((float)(int)dust.color.R / 255f), num91 * ((float)(int)dust.color.G / 255f), num91 * ((float)(int)dust.color.B / 255f));
1581 }
1582 }
1583 else if (dust.type == 20 || dust.type == 21 || dust.type == 231)
1584 {
1585 dust.scale += 0.005f;
1586 dust.velocity.Y *= 0.94f;
1587 dust.velocity.X *= 0.94f;
1588 float num92 = dust.scale * 0.8f;
1589 if (num92 > 1f)
1590 {
1591 num92 = 1f;
1592 }
1593 if (dust.type == 21 && !dust.noLightEmittence)
1594 {
1595 num92 = dust.scale * 0.4f;
1596 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num92 * 0.8f, num92 * 0.3f, num92);
1597 }
1598 else if (dust.type == 231)
1599 {
1600 num92 = dust.scale * 0.4f;
1601 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num92, num92 * 0.5f, num92 * 0.3f);
1602 }
1603 else
1604 {
1605 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num92 * 0.3f, num92 * 0.6f, num92);
1606 }
1607 }
1608 else if (dust.type == 27 || dust.type == 45)
1609 {
1610 if (dust.type == 27 && dust.fadeIn >= 100f)
1611 {
1612 if ((double)dust.scale >= 1.5)
1613 {
1614 dust.scale -= 0.01f;
1615 }
1616 else
1617 {
1618 dust.scale -= 0.05f;
1619 }
1620 if ((double)dust.scale <= 0.5)
1621 {
1622 dust.scale -= 0.05f;
1623 }
1624 if ((double)dust.scale <= 0.25)
1625 {
1626 dust.scale -= 0.05f;
1627 }
1628 }
1629 dust.velocity *= 0.94f;
1630 dust.scale += 0.002f;
1631 float num93 = dust.scale;
1632 if (dust.noLight)
1633 {
1634 num93 *= 0.1f;
1635 dust.scale -= 0.06f;
1636 if (dust.scale < 1f)
1637 {
1638 dust.scale -= 0.06f;
1639 }
1640 if (Main.player[Main.myPlayer].wet)
1641 {
1642 dust.position += Main.player[Main.myPlayer].velocity * 0.5f;
1643 }
1644 else
1645 {
1646 dust.position += Main.player[Main.myPlayer].velocity;
1647 }
1648 }
1649 if (num93 > 1f)
1650 {
1651 num93 = 1f;
1652 }
1653 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num93 * 0.6f, num93 * 0.2f, num93);
1654 }
1655 else if (dust.type == 55 || dust.type == 56 || dust.type == 73 || dust.type == 74)
1656 {
1657 dust.velocity *= 0.98f;
1658 if (!dust.noLightEmittence)
1659 {
1660 float num94 = dust.scale * 0.8f;
1661 if (dust.type == 55)
1662 {
1663 if (num94 > 1f)
1664 {
1665 num94 = 1f;
1666 }
1667 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num94, num94, num94 * 0.6f);
1668 }
1669 else if (dust.type == 73)
1670 {
1671 if (num94 > 1f)
1672 {
1673 num94 = 1f;
1674 }
1675 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num94, num94 * 0.35f, num94 * 0.5f);
1676 }
1677 else if (dust.type == 74)
1678 {
1679 if (num94 > 1f)
1680 {
1681 num94 = 1f;
1682 }
1683 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num94 * 0.35f, num94, num94 * 0.5f);
1684 }
1685 else
1686 {
1687 num94 = dust.scale * 1.2f;
1688 if (num94 > 1f)
1689 {
1690 num94 = 1f;
1691 }
1692 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num94 * 0.35f, num94 * 0.5f, num94);
1693 }
1694 }
1695 }
1696 else if (dust.type == 71 || dust.type == 72)
1697 {
1698 dust.velocity *= 0.98f;
1699 float num95 = dust.scale;
1700 if (num95 > 1f)
1701 {
1702 num95 = 1f;
1703 }
1704 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num95 * 0.2f, 0f, num95 * 0.1f);
1705 }
1706 else if (dust.type == 76)
1707 {
1708 Main.snowDust++;
1709 dust.scale += 0.009f;
1710 float y = Main.player[Main.myPlayer].velocity.Y;
1711 if (y > 0f && dust.fadeIn == 0f && dust.velocity.Y < y)
1712 {
1713 dust.velocity.Y = MathHelper.Lerp(dust.velocity.Y, y, 0.04f);
1714 }
1715 if (!dust.noLight && y > 0f)
1716 {
1717 dust.position.Y += Main.player[Main.myPlayer].velocity.Y * 0.2f;
1718 }
1719 if (Collision.SolidCollision(dust.position - Vector2.One * 5f, 10, 10) && dust.fadeIn == 0f)
1720 {
1721 dust.scale *= 0.9f;
1722 dust.velocity *= 0.25f;
1723 }
1724 }
1725 else if (dust.type == 270)
1726 {
1727 dust.velocity *= 1.0050251f;
1728 dust.scale += 0.01f;
1729 dust.rotation = 0f;
1730 if (Collision.SolidCollision(dust.position - Vector2.One * 5f, 10, 10) && dust.fadeIn == 0f)
1731 {
1732 dust.scale *= 0.95f;
1733 dust.velocity *= 0.25f;
1734 }
1735 else
1736 {
1737 dust.velocity.Y = (float)Math.Sin(dust.position.X * 0.0043982295f) * 2f;
1738 dust.velocity.Y -= 3f;
1739 dust.velocity.Y /= 20f;
1740 }
1741 }
1742 else if (dust.type == 271)
1743 {
1744 dust.velocity *= 1.0050251f;
1745 dust.scale += 0.003f;
1746 dust.rotation = 0f;
1747 dust.velocity.Y -= 4f;
1748 dust.velocity.Y /= 6f;
1749 }
1750 else if (dust.type == 268)
1751 {
1753 dust.velocity *= 1.0050251f;
1754 dust.scale += 0.01f;
1755 if (!flag)
1756 {
1757 dust.scale -= 0.05f;
1758 }
1759 dust.rotation = 0f;
1760 float y2 = Main.player[Main.myPlayer].velocity.Y;
1761 if (y2 > 0f && dust.fadeIn == 0f && dust.velocity.Y < y2)
1762 {
1763 dust.velocity.Y = MathHelper.Lerp(dust.velocity.Y, y2, 0.04f);
1764 }
1765 if (!dust.noLight && y2 > 0f)
1766 {
1767 dust.position.Y += y2 * 0.2f;
1768 }
1769 if (Collision.SolidCollision(dust.position - Vector2.One * 5f, 10, 10) && dust.fadeIn == 0f)
1770 {
1771 dust.scale *= 0.9f;
1772 dust.velocity *= 0.25f;
1773 }
1774 else
1775 {
1776 dust.velocity.Y = (float)Math.Sin(dust.position.X * 0.0043982295f) * 2f;
1777 dust.velocity.Y += 3f;
1778 }
1779 }
1780 else if (!dust.noGravity && dust.type != 41 && dust.type != 44 && dust.type != 309)
1781 {
1782 if (dust.type == 107)
1783 {
1784 dust.velocity *= 0.9f;
1785 }
1786 else
1787 {
1788 dust.velocity.Y += 0.1f;
1789 }
1790 }
1791 if (dust.type == 5 || (dust.type == 273 && dust.noGravity))
1792 {
1793 dust.scale -= 0.04f;
1794 }
1795 if (dust.type == 308 || dust.type == 33 || dust.type == 52 || dust.type == 266 || dust.type == 98 || dust.type == 99 || dust.type == 100 || dust.type == 101 || dust.type == 102 || dust.type == 103 || dust.type == 104 || dust.type == 105 || dust.type == 123 || dust.type == 288)
1796 {
1797 if (dust.velocity.X == 0f)
1798 {
1799 if (Collision.SolidCollision(dust.position, 2, 2))
1800 {
1801 dust.scale = 0f;
1802 }
1803 dust.rotation += 0.5f;
1804 dust.scale -= 0.01f;
1805 }
1806 if (Collision.WetCollision(new Vector2(dust.position.X, dust.position.Y), 4, 4))
1807 {
1808 dust.alpha += 20;
1809 dust.scale -= 0.1f;
1810 }
1811 dust.alpha += 2;
1812 dust.scale -= 0.005f;
1813 if (dust.alpha > 255)
1814 {
1815 dust.scale = 0f;
1816 }
1817 if (dust.velocity.Y > 4f)
1818 {
1819 dust.velocity.Y = 4f;
1820 }
1821 if (dust.noGravity)
1822 {
1823 if (dust.velocity.X < 0f)
1824 {
1825 dust.rotation -= 0.2f;
1826 }
1827 else
1828 {
1829 dust.rotation += 0.2f;
1830 }
1831 dust.scale += 0.03f;
1832 dust.velocity.X *= 1.05f;
1833 dust.velocity.Y += 0.15f;
1834 }
1835 }
1836 if (dust.type == 35 && dust.noGravity)
1837 {
1838 dust.scale += 0.03f;
1839 if (dust.scale < 1f)
1840 {
1841 dust.velocity.Y += 0.075f;
1842 }
1843 dust.velocity.X *= 1.08f;
1844 if (dust.velocity.X > 0f)
1845 {
1846 dust.rotation += 0.01f;
1847 }
1848 else
1849 {
1850 dust.rotation -= 0.01f;
1851 }
1852 float num96 = dust.scale * 0.6f;
1853 if (num96 > 1f)
1854 {
1855 num96 = 1f;
1856 }
1857 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f + 1f), num96, num96 * 0.3f, num96 * 0.1f);
1858 }
1859 else if (dust.type == 152 && dust.noGravity)
1860 {
1861 dust.scale += 0.03f;
1862 if (dust.scale < 1f)
1863 {
1864 dust.velocity.Y += 0.075f;
1865 }
1866 dust.velocity.X *= 1.08f;
1867 if (dust.velocity.X > 0f)
1868 {
1869 dust.rotation += 0.01f;
1870 }
1871 else
1872 {
1873 dust.rotation -= 0.01f;
1874 }
1875 }
1876 else if (dust.type == 67 || dust.type == 92)
1877 {
1878 float num97 = dust.scale;
1879 if (num97 > 1f)
1880 {
1881 num97 = 1f;
1882 }
1883 if (dust.noLight)
1884 {
1885 num97 *= 0.1f;
1886 }
1887 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 0f, num97 * 0.8f, num97);
1888 }
1889 else if (dust.type == 185)
1890 {
1891 float num98 = dust.scale;
1892 if (num98 > 1f)
1893 {
1894 num98 = 1f;
1895 }
1896 if (dust.noLight)
1897 {
1898 num98 *= 0.1f;
1899 }
1900 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num98 * 0.1f, num98 * 0.7f, num98);
1901 }
1902 else if (dust.type == 107)
1903 {
1904 float num99 = dust.scale * 0.5f;
1905 if (num99 > 1f)
1906 {
1907 num99 = 1f;
1908 }
1909 if (!dust.noLightEmittence)
1910 {
1911 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num99 * 0.1f, num99, num99 * 0.4f);
1912 }
1913 }
1914 else if (dust.type == 34 || dust.type == 35 || dust.type == 152)
1915 {
1916 if (!Collision.WetCollision(new Vector2(dust.position.X, dust.position.Y - 8f), 4, 4))
1917 {
1918 dust.scale = 0f;
1919 }
1920 else
1921 {
1922 dust.alpha += Main.rand.Next(2);
1923 if (dust.alpha > 255)
1924 {
1925 dust.scale = 0f;
1926 }
1927 dust.velocity.Y = -0.5f;
1928 if (dust.type == 34)
1929 {
1930 dust.scale += 0.005f;
1931 }
1932 else
1933 {
1934 dust.alpha++;
1935 dust.scale -= 0.01f;
1936 dust.velocity.Y = -0.2f;
1937 }
1938 dust.velocity.X += (float)Main.rand.Next(-10, 10) * 0.002f;
1939 if ((double)dust.velocity.X < -0.25)
1940 {
1941 dust.velocity.X = -0.25f;
1942 }
1943 if ((double)dust.velocity.X > 0.25)
1944 {
1945 dust.velocity.X = 0.25f;
1946 }
1947 }
1948 if (dust.type == 35)
1949 {
1950 float num100 = dust.scale * 0.3f + 0.4f;
1951 if (num100 > 1f)
1952 {
1953 num100 = 1f;
1954 }
1955 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num100, num100 * 0.5f, num100 * 0.3f);
1956 }
1957 }
1958 if (dust.type == 68)
1959 {
1960 float num101 = dust.scale * 0.3f;
1961 if (num101 > 1f)
1962 {
1963 num101 = 1f;
1964 }
1965 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num101 * 0.1f, num101 * 0.2f, num101);
1966 }
1967 if (dust.type == 70)
1968 {
1969 float num102 = dust.scale * 0.3f;
1970 if (num102 > 1f)
1971 {
1972 num102 = 1f;
1973 }
1974 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num102 * 0.5f, 0f, num102);
1975 }
1976 if (dust.type == 41)
1977 {
1978 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.01f;
1979 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.01f;
1980 if ((double)dust.velocity.X > 0.75)
1981 {
1982 dust.velocity.X = 0.75f;
1983 }
1984 if ((double)dust.velocity.X < -0.75)
1985 {
1986 dust.velocity.X = -0.75f;
1987 }
1988 if ((double)dust.velocity.Y > 0.75)
1989 {
1990 dust.velocity.Y = 0.75f;
1991 }
1992 if ((double)dust.velocity.Y < -0.75)
1993 {
1994 dust.velocity.Y = -0.75f;
1995 }
1996 dust.scale += 0.007f;
1997 float num103 = dust.scale * 0.7f;
1998 if (num103 > 1f)
1999 {
2000 num103 = 1f;
2001 }
2002 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num103 * 0.4f, num103 * 0.9f, num103);
2003 }
2004 else if (dust.type == 44)
2005 {
2006 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.003f;
2007 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.003f;
2008 if ((double)dust.velocity.X > 0.35)
2009 {
2010 dust.velocity.X = 0.35f;
2011 }
2012 if ((double)dust.velocity.X < -0.35)
2013 {
2014 dust.velocity.X = -0.35f;
2015 }
2016 if ((double)dust.velocity.Y > 0.35)
2017 {
2018 dust.velocity.Y = 0.35f;
2019 }
2020 if ((double)dust.velocity.Y < -0.35)
2021 {
2022 dust.velocity.Y = -0.35f;
2023 }
2024 dust.scale += 0.0085f;
2025 float num104 = dust.scale * 0.7f;
2026 if (num104 > 1f)
2027 {
2028 num104 = 1f;
2029 }
2030 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num104 * 0.7f, num104, num104 * 0.8f);
2031 }
2032 else if (dust.type != 304)
2033 {
2034 dust.velocity.X *= 0.99f;
2035 }
2036 if (dust.type == 322 && !dust.noGravity)
2037 {
2038 dust.scale *= 0.98f;
2039 }
2040 if (dust.type != 79 && dust.type != 268 && dust.type != 304)
2041 {
2042 dust.rotation += dust.velocity.X * 0.5f;
2043 }
2044 if (dust.fadeIn > 0f && dust.fadeIn < 100f)
2045 {
2046 if (dust.type == 235)
2047 {
2048 dust.scale += 0.007f;
2049 int num105 = (int)dust.fadeIn - 1;
2050 if (num105 >= 0 && num105 <= 255)
2051 {
2052 Vector2 vector6 = dust.position - Main.player[num105].Center;
2053 float num106 = vector6.Length();
2054 num106 = 100f - num106;
2055 if (num106 > 0f)
2056 {
2057 dust.scale -= num106 * 0.0015f;
2058 }
2059 vector6.Normalize();
2060 float num107 = (1f - dust.scale) * 20f;
2061 vector6 *= 0f - num107;
2062 dust.velocity = (dust.velocity * 4f + vector6) / 5f;
2063 }
2064 }
2065 else if (dust.type == 46)
2066 {
2067 dust.scale += 0.1f;
2068 }
2069 else if (dust.type == 213 || dust.type == 260)
2070 {
2071 dust.scale += 0.1f;
2072 }
2073 else
2074 {
2075 dust.scale += 0.03f;
2076 }
2077 if (dust.scale > dust.fadeIn)
2078 {
2079 dust.fadeIn = 0f;
2080 }
2081 }
2082 else if (dust.type != 304)
2083 {
2084 if (dust.type == 213 || dust.type == 260)
2085 {
2086 dust.scale -= 0.2f;
2087 }
2088 else
2089 {
2090 dust.scale -= 0.01f;
2091 }
2092 }
2093 if (dust.type >= 130 && dust.type <= 134)
2094 {
2095 float num108 = dust.scale;
2096 if (num108 > 1f)
2097 {
2098 num108 = 1f;
2099 }
2100 if (dust.type == 130)
2101 {
2102 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num108 * 1f, num108 * 0.5f, num108 * 0.4f);
2103 }
2104 if (dust.type == 131)
2105 {
2106 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num108 * 0.4f, num108 * 1f, num108 * 0.6f);
2107 }
2108 if (dust.type == 132)
2109 {
2110 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num108 * 0.3f, num108 * 0.5f, num108 * 1f);
2111 }
2112 if (dust.type == 133)
2113 {
2114 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num108 * 0.9f, num108 * 0.9f, num108 * 0.3f);
2115 }
2116 if (dust.noGravity)
2117 {
2118 dust.velocity *= 0.93f;
2119 if (dust.fadeIn == 0f)
2120 {
2121 dust.scale += 0.0025f;
2122 }
2123 }
2124 else if (dust.type == 131)
2125 {
2126 dust.velocity *= 0.98f;
2127 dust.velocity.Y -= 0.1f;
2128 dust.scale += 0.0025f;
2129 }
2130 else
2131 {
2132 dust.velocity *= 0.95f;
2133 dust.scale -= 0.0025f;
2134 }
2135 }
2136 else if (dust.type == 278)
2137 {
2138 float num109 = dust.scale;
2139 if (num109 > 1f)
2140 {
2141 num109 = 1f;
2142 }
2143 if (!dust.noLight && !dust.noLightEmittence)
2144 {
2145 Lighting.AddLight(dust.position, dust.color.ToVector3() * num109);
2146 }
2147 if (dust.noGravity)
2148 {
2149 dust.velocity *= 0.93f;
2150 if (dust.fadeIn == 0f)
2151 {
2152 dust.scale += 0.0025f;
2153 }
2154 }
2155 else
2156 {
2157 dust.velocity *= 0.95f;
2158 dust.scale -= 0.0025f;
2159 }
2160 if (WorldGen.SolidTile(Framing.GetTileSafely(dust.position)) && dust.fadeIn == 0f && !dust.noGravity)
2161 {
2162 dust.scale *= 0.9f;
2163 dust.velocity *= 0.25f;
2164 }
2165 }
2166 else if (dust.type >= 219 && dust.type <= 223)
2167 {
2168 float num110 = dust.scale;
2169 if (num110 > 1f)
2170 {
2171 num110 = 1f;
2172 }
2173 if (!dust.noLight)
2174 {
2175 if (dust.type == 219)
2176 {
2177 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num110 * 1f, num110 * 0.5f, num110 * 0.4f);
2178 }
2179 if (dust.type == 220)
2180 {
2181 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num110 * 0.4f, num110 * 1f, num110 * 0.6f);
2182 }
2183 if (dust.type == 221)
2184 {
2185 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num110 * 0.3f, num110 * 0.5f, num110 * 1f);
2186 }
2187 if (dust.type == 222)
2188 {
2189 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num110 * 0.9f, num110 * 0.9f, num110 * 0.3f);
2190 }
2191 }
2192 if (dust.noGravity)
2193 {
2194 dust.velocity *= 0.93f;
2195 if (dust.fadeIn == 0f)
2196 {
2197 dust.scale += 0.0025f;
2198 }
2199 }
2200 dust.velocity *= new Vector2(0.97f, 0.99f);
2201 dust.scale -= 0.0025f;
2202 if (dust.customData != null && dust.customData is Player)
2203 {
2204 Player player8 = (Player)dust.customData;
2205 dust.position += player8.position - player8.oldPosition;
2206 }
2207 }
2208 else if (dust.type == 226)
2209 {
2210 float num111 = dust.scale;
2211 if (num111 > 1f)
2212 {
2213 num111 = 1f;
2214 }
2215 if (!dust.noLight)
2216 {
2217 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num111 * 0.2f, num111 * 0.7f, num111 * 1f);
2218 }
2219 if (dust.noGravity)
2220 {
2221 dust.velocity *= 0.93f;
2222 if (dust.fadeIn == 0f)
2223 {
2224 dust.scale += 0.0025f;
2225 }
2226 }
2227 dust.velocity *= new Vector2(0.97f, 0.99f);
2228 if (dust.customData != null && dust.customData is Player)
2229 {
2230 Player player9 = (Player)dust.customData;
2231 dust.position += player9.position - player9.oldPosition;
2232 }
2233 dust.scale -= 0.01f;
2234 }
2235 else if (dust.type == 272)
2236 {
2237 float num112 = dust.scale;
2238 if (num112 > 1f)
2239 {
2240 num112 = 1f;
2241 }
2242 if (!dust.noLight)
2243 {
2244 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num112 * 0.5f, num112 * 0.2f, num112 * 0.8f);
2245 }
2246 if (dust.noGravity)
2247 {
2248 dust.velocity *= 0.93f;
2249 if (dust.fadeIn == 0f)
2250 {
2251 dust.scale += 0.0025f;
2252 }
2253 }
2254 dust.velocity *= new Vector2(0.97f, 0.99f);
2255 if (dust.customData != null && dust.customData is Player)
2256 {
2257 Player player10 = (Player)dust.customData;
2258 dust.position += player10.position - player10.oldPosition;
2259 }
2260 if (dust.customData != null && dust.customData is NPC)
2261 {
2262 NPC nPC3 = (NPC)dust.customData;
2263 dust.position += nPC3.position - nPC3.oldPosition;
2264 }
2265 dust.scale -= 0.01f;
2266 }
2267 else if (dust.type != 304 && dust.noGravity)
2268 {
2269 dust.velocity *= 0.92f;
2270 if (dust.fadeIn == 0f)
2271 {
2272 dust.scale -= 0.04f;
2273 }
2274 }
2275 if (dust.position.Y > Main.screenPosition.Y + (float)Main.screenHeight)
2276 {
2277 dust.active = false;
2278 }
2279 float num113 = 0.1f;
2280 if ((double)dCount == 0.5)
2281 {
2282 dust.scale -= 0.001f;
2283 }
2284 if ((double)dCount == 0.6)
2285 {
2286 dust.scale -= 0.0025f;
2287 }
2288 if ((double)dCount == 0.7)
2289 {
2290 dust.scale -= 0.005f;
2291 }
2292 if ((double)dCount == 0.8)
2293 {
2294 dust.scale -= 0.01f;
2295 }
2296 if ((double)dCount == 0.9)
2297 {
2298 dust.scale -= 0.02f;
2299 }
2300 if ((double)dCount == 0.5)
2301 {
2302 num113 = 0.11f;
2303 }
2304 if ((double)dCount == 0.6)
2305 {
2306 num113 = 0.13f;
2307 }
2308 if ((double)dCount == 0.7)
2309 {
2310 num113 = 0.16f;
2311 }
2312 if ((double)dCount == 0.8)
2313 {
2314 num113 = 0.22f;
2315 }
2316 if ((double)dCount == 0.9)
2317 {
2318 num113 = 0.25f;
2319 }
2320 if (dust.scale < num113)
2321 {
2322 dust.active = false;
2323 }
2324 }
2325 else
2326 {
2327 dust.active = false;
2328 }
2329 }
2330 int num114 = num;
2331 if ((double)num114 > (double)Main.maxDustToDraw * 0.9)
2332 {
2333 dCount = 0.9f;
2334 }
2335 else if ((double)num114 > (double)Main.maxDustToDraw * 0.8)
2336 {
2337 dCount = 0.8f;
2338 }
2339 else if ((double)num114 > (double)Main.maxDustToDraw * 0.7)
2340 {
2341 dCount = 0.7f;
2342 }
2343 else if ((double)num114 > (double)Main.maxDustToDraw * 0.6)
2344 {
2345 dCount = 0.6f;
2346 }
2347 else if ((double)num114 > (double)Main.maxDustToDraw * 0.5)
2348 {
2349 dCount = 0.5f;
2350 }
2351 else
2352 {
2353 dCount = 0f;
2354 }
2355 }
2356
2357 public Color GetAlpha(Color newColor)
2358 {
2359 float num = (float)(255 - alpha) / 255f;
2360 switch (type)
2361 {
2362 case 323:
2363 return Color.White;
2364 case 308:
2365 case 309:
2366 return new Color(225, 200, 250, 190);
2367 case 299:
2368 case 300:
2369 case 301:
2370 case 305:
2371 {
2372 Color color = default(Color);
2373 return type switch
2374 {
2375 299 => new Color(50, 255, 50, 200),
2376 300 => new Color(50, 200, 255, 255),
2377 301 => new Color(255, 50, 125, 200),
2378 305 => new Color(200, 50, 200, 200),
2379 _ => new Color(255, 150, 150, 200),
2380 };
2381 }
2382 default:
2383 {
2384 if (type == 304)
2385 {
2386 return Color.White * num;
2387 }
2388 if (type == 306)
2389 {
2390 return this.color * num;
2391 }
2392 if (type == 292)
2393 {
2394 return Color.White;
2395 }
2396 if (type == 259)
2397 {
2398 return new Color(230, 230, 230, 230);
2399 }
2400 if (type == 261)
2401 {
2402 return new Color(230, 230, 230, 115);
2403 }
2404 if (type == 254 || type == 255)
2405 {
2406 return new Color(255, 255, 255, 0);
2407 }
2408 if (type == 258)
2409 {
2410 return new Color(150, 50, 50, 0);
2411 }
2412 if (type == 263 || type == 264)
2413 {
2414 return new Color(this.color.R / 2 + 127, this.color.G + 127, this.color.B + 127, this.color.A / 8) * 0.5f;
2415 }
2416 if (type == 235)
2417 {
2418 return new Color(255, 255, 255, 0);
2419 }
2420 if (((type >= 86 && type <= 91) || type == 262 || type == 286) && !noLight)
2421 {
2422 return new Color(255, 255, 255, 0);
2423 }
2424 if (type == 213 || type == 260)
2425 {
2426 int num2 = (int)(scale / 2.5f * 255f);
2427 return new Color(num2, num2, num2, num2);
2428 }
2429 if (type == 64 && alpha == 255 && noLight)
2430 {
2431 return new Color(255, 255, 255, 0);
2432 }
2433 if (type == 197)
2434 {
2435 return new Color(250, 250, 250, 150);
2436 }
2437 if ((type >= 110 && type <= 114) || type == 311 || type == 312 || type == 313)
2438 {
2439 return new Color(200, 200, 200, 0);
2440 }
2441 if (type == 204)
2442 {
2443 return new Color(255, 255, 255, 0);
2444 }
2445 if (type == 181)
2446 {
2447 return new Color(200, 200, 200, 0);
2448 }
2449 if (type == 182 || type == 206)
2450 {
2451 return new Color(255, 255, 255, 0);
2452 }
2453 if (type == 159)
2454 {
2455 return new Color(250, 250, 250, 50);
2456 }
2457 if (type == 163 || type == 205)
2458 {
2459 return new Color(250, 250, 250, 0);
2460 }
2461 if (type == 170)
2462 {
2463 return new Color(200, 200, 200, 100);
2464 }
2465 if (type == 180)
2466 {
2467 return new Color(200, 200, 200, 0);
2468 }
2469 if (type == 175)
2470 {
2471 return new Color(200, 200, 200, 0);
2472 }
2473 if (type == 183)
2474 {
2475 return new Color(50, 0, 0, 0);
2476 }
2477 if (type == 172)
2478 {
2479 return new Color(250, 250, 250, 150);
2480 }
2481 if (type == 160 || type == 162 || type == 164 || type == 173)
2482 {
2483 int num3 = (int)(250f * scale);
2484 return new Color(num3, num3, num3, 0);
2485 }
2486 if (type == 92 || type == 106 || type == 107)
2487 {
2488 return new Color(255, 255, 255, 0);
2489 }
2490 if (type == 185)
2491 {
2492 return new Color(200, 200, 255, 125);
2493 }
2494 if (type == 127 || type == 187)
2495 {
2496 return new Color(newColor.R, newColor.G, newColor.B, 25);
2497 }
2498 if (type == 156 || type == 230 || type == 234)
2499 {
2500 return new Color(255, 255, 255, 0);
2501 }
2502 if (type == 270)
2503 {
2504 return new Color(newColor.R / 2 + 127, newColor.G / 2 + 127, newColor.B / 2 + 127, 25);
2505 }
2506 if (type == 271)
2507 {
2508 return new Color(newColor.R / 2 + 127, newColor.G / 2 + 127, newColor.B / 2 + 127, 127);
2509 }
2510 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)
2511 {
2512 return new Color(newColor.R, newColor.G, newColor.B, 25);
2513 }
2514 if (type == 278)
2515 {
2516 Color result = new Color(newColor.ToVector3() * this.color.ToVector3());
2517 result.A = 25;
2518 return result;
2519 }
2520 if (type >= 219 && type <= 223)
2521 {
2522 newColor = Color.Lerp(newColor, Color.White, 0.5f);
2523 return new Color(newColor.R, newColor.G, newColor.B, 25);
2524 }
2525 if (type == 226 || type == 272)
2526 {
2527 newColor = Color.Lerp(newColor, Color.White, 0.8f);
2528 return new Color(newColor.R, newColor.G, newColor.B, 25);
2529 }
2530 if (type == 228)
2531 {
2532 newColor = Color.Lerp(newColor, Color.White, 0.8f);
2533 return new Color(newColor.R, newColor.G, newColor.B, 25);
2534 }
2535 if (type == 279)
2536 {
2537 int a = newColor.A;
2538 newColor = Color.Lerp(newColor, Color.White, 0.8f);
2539 return new Color(newColor.R, newColor.G, newColor.B, a) * MathHelper.Min(scale, 1f);
2540 }
2541 if (type == 229 || type == 269)
2542 {
2543 newColor = Color.Lerp(newColor, Color.White, 0.6f);
2544 return new Color(newColor.R, newColor.G, newColor.B, 25);
2545 }
2546 if ((type == 68 || type == 70) && noGravity)
2547 {
2548 return new Color(255, 255, 255, 0);
2549 }
2550 int num6;
2551 int num5;
2552 int num4;
2553 if (type == 157)
2554 {
2555 num6 = (num5 = (num4 = 255));
2556 float num7 = (float)(int)Main.mouseTextColor / 100f - 1.6f;
2557 num6 = (int)((float)num6 * num7);
2558 num5 = (int)((float)num5 * num7);
2559 num4 = (int)((float)num4 * num7);
2560 int a2 = (int)(100f * num7);
2561 num6 += 50;
2562 if (num6 > 255)
2563 {
2564 num6 = 255;
2565 }
2566 num5 += 50;
2567 if (num5 > 255)
2568 {
2569 num5 = 255;
2570 }
2571 num4 += 50;
2572 if (num4 > 255)
2573 {
2574 num4 = 255;
2575 }
2576 return new Color(num6, num5, num4, a2);
2577 }
2578 if (type == 284)
2579 {
2580 Color result2 = new Color(newColor.ToVector4() * this.color.ToVector4());
2581 result2.A = this.color.A;
2582 return result2;
2583 }
2584 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)
2585 {
2586 num = (num + 3f) / 4f;
2587 }
2588 else if (type == 43)
2589 {
2590 num = (num + 9f) / 10f;
2591 }
2592 else
2593 {
2594 if (type >= 244 && type <= 247)
2595 {
2596 return new Color(255, 255, 255, 0);
2597 }
2598 if (type == 66)
2599 {
2600 return new Color(newColor.R, newColor.G, newColor.B, 0);
2601 }
2602 if (type == 267)
2603 {
2604 return new Color(this.color.R, this.color.G, this.color.B, 0);
2605 }
2606 if (type == 71)
2607 {
2608 return new Color(200, 200, 200, 0);
2609 }
2610 if (type == 72)
2611 {
2612 return new Color(200, 200, 200, 200);
2613 }
2614 }
2615 num6 = (int)((float)(int)newColor.R * num);
2616 num5 = (int)((float)(int)newColor.G * num);
2617 num4 = (int)((float)(int)newColor.B * num);
2618 int num8 = newColor.A - alpha;
2619 if (num8 < 0)
2620 {
2621 num8 = 0;
2622 }
2623 if (num8 > 255)
2624 {
2625 num8 = 255;
2626 }
2627 return new Color(num6, num5, num4, num8);
2628 }
2629 }
2630 }
2631
2632 public Color GetColor(Color newColor)
2633 {
2634 int num = type;
2635 if (num == 284)
2636 {
2637 return Color.Transparent;
2638 }
2639 int num2 = color.R - (255 - newColor.R);
2640 int num3 = color.G - (255 - newColor.G);
2641 int num4 = color.B - (255 - newColor.B);
2642 int num5 = color.A - (255 - newColor.A);
2643 if (num2 < 0)
2644 {
2645 num2 = 0;
2646 }
2647 if (num2 > 255)
2648 {
2649 num2 = 255;
2650 }
2651 if (num3 < 0)
2652 {
2653 num3 = 0;
2654 }
2655 if (num3 > 255)
2656 {
2657 num3 = 255;
2658 }
2659 if (num4 < 0)
2660 {
2661 num4 = 0;
2662 }
2663 if (num4 > 255)
2664 {
2665 num4 = 255;
2666 }
2667 if (num5 < 0)
2668 {
2669 num5 = 0;
2670 }
2671 if (num5 > 255)
2672 {
2673 num5 = 255;
2674 }
2675 return new Color(num2, num3, num4, num5);
2676 }
2677
2678 public float GetVisualRotation()
2679 {
2680 if (type == 304)
2681 {
2682 return 0f;
2683 }
2684 return rotation;
2685 }
2686
2687 public float GetVisualScale()
2688 {
2689 if (type == 304)
2690 {
2691 return 1f;
2692 }
2693 return scale;
2694 }
2695}
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static float Min(float value1, float value2)
Definition MathHelper.cs:36
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Abs(double value)
static double Sin(double a)
static int Sign(decimal value)
Definition Math.cs:1202
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static bool WetCollision(Vector2 Position, int Width, int Height)
static bool SolidCollision(Vector2 Position, int Width, int Height)
static float dCount
Definition Dust.cs:12
static int SandStormCount
Definition Dust.cs:16
Vector2 position
Definition Dust.cs:20
Color GetColor(Color newColor)
Definition Dust.cs:2632
static void QuickDustLine(Vector2 start, Vector2 end, float splits, Color color)
Definition Dust.cs:329
bool noGravity
Definition Dust.cs:26
static Dust QuickDustSmall(Vector2 pos, Color color, bool floorPositionValues=false)
Definition Dust.cs:317
static Dust CloneDust(int dustIndex)
Definition Dust.cs:233
int type
Definition Dust.cs:38
static Dust QuickDust(Vector2 pos, Color color)
Definition Dust.cs:305
bool noLightEmittence
Definition Dust.cs:34
int alpha
Definition Dust.cs:42
static void QuickBox(Vector2 topLeft, Vector2 bottomRight, int divisions, Color color, Action< Dust > manipulator)
Definition Dust.cs:273
Color GetAlpha(Color newColor)
Definition Dust.cs:2357
static int dustWater()
Definition Dust.cs:340
bool active
Definition Dust.cs:36
static void UpdateDust()
Definition Dust.cs:358
int dustIndex
Definition Dust.cs:18
static int NewDust(Vector2 Position, int Width, int Height, int Type, float SpeedX=0f, float SpeedY=0f, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:73
bool noLight
Definition Dust.cs:32
ArmorShaderData shader
Definition Dust.cs:46
float scale
Definition Dust.cs:28
float GetVisualScale()
Definition Dust.cs:2687
bool firstFrame
Definition Dust.cs:50
object customData
Definition Dust.cs:48
static void DrawDebugBox(Rectangle itemRectangle)
Definition Dust.cs:289
static Dust NewDustPerfect(Vector2 Position, int Type, Vector2? Velocity=null, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:52
static Dust NewDustDirect(Vector2 Position, int Width, int Height, int Type, float SpeedX=0f, float SpeedY=0f, int Alpha=0, Color newColor=default(Color), float Scale=1f)
Definition Dust.cs:63
Rectangle frame
Definition Dust.cs:44
static Dust CloneDust(Dust rf)
Definition Dust.cs:238
static Dust QuickDust(Point tileCoords, Color color)
Definition Dust.cs:268
Color color
Definition Dust.cs:40
float GetVisualRotation()
Definition Dust.cs:2678
float fadeIn
Definition Dust.cs:24
static int lavaBubbles
Definition Dust.cs:14
Vector2 velocity
Definition Dust.cs:22
float rotation
Definition Dust.cs:30
static Dust QuickDust(int x, int y, Color color)
Definition Dust.cs:263
Vector2 oldPosition
Definition Entity.cs:18
static Tile GetTileSafely(Vector2 position)
Definition Framing.cs:419
static bool DangerousDust(int id)
static Color GetColor(Point tileCoords)
Definition Lighting.cs:182
static void AddLight(Vector2 position, Vector3 rgb)
Definition Lighting.cs:137
static int maxDustToDraw
Definition Main.cs:1128
static int myPlayer
Definition Main.cs:1801
static int netMode
Definition Main.cs:2095
static int screenHeight
Definition Main.cs:1721
static Vector2 screenPosition
Definition Main.cs:1715
static int snowDust
Definition Main.cs:696
static UnifiedRandom rand
Definition Main.cs:1387
static int screenWidth
Definition Main.cs:1719
static bool gameMenu
Definition Main.cs:1926
static bool gamePaused
Definition Main.cs:1072
static Player[] player
Definition Main.cs:1803
static Dust[] dust
Definition Main.cs:1677
Vector2[] oldPos
Definition NPC.cs:155
static float Remap(float fromValue, float fromMin, float fromMax, float toMin, float toMax, bool clamped=true)
Definition Utils.cs:233
static volatile bool gen
Definition WorldGen.cs:972
static bool SolidTile(Tile testTile)
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
bool Intersects(Rectangle value)
Definition Rectangle.cs:129
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227
static DateTime Now
Definition DateTime.cs:103