Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Main.cs
Go to the documentation of this file.
1using System;
7using System.IO;
8using System.Linq;
11using System.Text;
15using System.Windows.Forms;
16using Microsoft.Win32;
18using Microsoft.Xna.Framework.Content;
20using Microsoft.Xna.Framework.Input;
21using Newtonsoft.Json.Linq;
22using ReLogic.Content;
26using ReLogic.OS;
30using Terraria.Audio;
31using Terraria.Chat;
34using Terraria.Enums;
62using Terraria.ID;
64using Terraria.IO;
66using Terraria.Map;
67using Terraria.Net;
69using Terraria.Social;
70using Terraria.UI;
75
76namespace Terraria;
77
78public class Main : Game
79{
81
82 public static class CurrentFrameFlags
83 {
84 public static class Hacks
85 {
87 }
88
89 public static int ActivePlayersCount;
90
91 public static int SleepingPlayersCount;
92
93 public static bool AnyActiveBossNPC;
94
96 }
97
99 {
102 Ready
103 }
104
105 internal static class NativeMethods
106 {
107 public const uint ES_CONTINUOUS = 2147483648u;
108
109 public const uint ES_SYSTEM_REQUIRED = 1u;
110
111 [DllImport("kernel32.dll")]
112 public static extern uint SetThreadExecutionState(uint esFlags);
113 }
114
115 private struct MouseTextCache
116 {
117 public bool noOverride;
118
119 public bool isValid;
120
121 public string cursorText;
122
123 public int rare;
124
125 public byte diff;
126
127 public int X;
128
129 public int Y;
130
132
134
135 public string buffTooltip;
136 }
137
138 protected class TextDisplayCache
139 {
140 private string _originalText;
141
142 private int _lastScreenWidth;
143
144 private int _lastScreenHeight;
145
147
148 public string[] TextLines { get; private set; }
149
150 public int AmountOfLines { get; private set; }
151
165 }
166
167 public struct SceneArea
168 {
170
171 public float totalWidth;
172
173 public float totalHeight;
174
175 public int bgTopY;
176 }
177
178 public struct InfoToSetBackColor
179 {
181
183
185
187
189
190 public float GraveyardInfluence;
191
192 public bool BloodMoonActive;
193
195 }
196
197 private const string versionStringBecauseTheyreTheSame = "v1.4.4.9";
198
199 public const int curRelease = 279;
200
201 public const string assemblyVersionNumber = "1.4.4.9";
202
203 public const string copyrightText = "Copyright © 2022 Re-Logic";
204
205 public const ulong WorldGeneratorVersion = 1198295875585uL;
206
207 public static int mapDelay = 2;
208
210
212
213 private volatile bool _musicLoaded;
214
215 private volatile bool _artLoaded;
216
217 private volatile bool _begunMainAsyncLoad;
218
219 public static int CurrentDrawnEntityShader;
220
222
223 private static bool GameAskedToQuit = false;
224
225 public static float ForcedMinimumZoom = 1f;
226
228
230
232
233 private static Matrix _uiScaleMatrix;
234
235 private static float _uiScaleWanted = 1f;
236
237 private static float _uiScaleUsed = 1f;
238
239 public static float GameZoomTarget = 1f;
240
241 public static bool LightingEveryFrame = true;
242
243 public static bool SettingsUnlock_WorldEvil;
244
245 public static bool SettingsEnabled_MinersWobble = true;
246
247 public static bool SettingsEnabled_AutoReuseAllItems = false;
248
250
251 public static bool SettingDontScaleMainMenuUp;
252
254
255 public static bool SettingMusicReplayDelayEnabled = false;
256
257 public static bool HidePassword;
258
260
262
263 public static bool MouseShowBuildingGrid;
264
266
267 public static bool InvisibleCursorForGamepad = true;
268
269 public static bool GamepadDisableCursorItemIconInner = true;
270
272
273 public static bool CrouchingEnabled = false;
274
276
277 public static float MouseBuildingGridAlpha;
278
279 public static bool CaptureModeDisabled = false;
280
281 public bool unityMouseOver;
282
283 public static Main instance;
284
285 public static ChromaEngine Chroma;
286
288
289 public static Camera Camera = new Camera();
290
292
294
296
298
300
302
303 public static string versionNumber = "v1.4.4.9";
304
305 public static string versionNumber2 = "v1.4.4.9";
306
307 public static bool AnnouncementBoxDisabled;
308
309 public static int AnnouncementBoxRange = -1;
310
311 public static string AutogenSeedName;
312
314
316 {
317 {
318 0,
319 GameModeData.NormalMode
320 },
321 {
322 1,
323 GameModeData.ExpertMode
324 },
325 {
326 2,
327 GameModeData.MasterMode
328 },
329 {
330 3,
331 GameModeData.CreativeMode
332 }
333 };
334
335 private static bool? _overrideForExpertMode = null;
336
337 private static bool? _overrideForMasterMode = null;
338
339 public static bool drunkWorld = false;
340
341 public static bool getGoodWorld = false;
342
343 public static bool tenthAnniversaryWorld = false;
344
345 public static bool dontStarveWorld = false;
346
347 public static bool notTheBeesWorld = false;
348
349 public static bool remixWorld = false;
350
351 public static bool noTrapsWorld = false;
352
353 public static bool zenithWorld = false;
354
355 public static Vector2 destroyerHB = new Vector2(0f, 0f);
356
357 public static FavoritesFile LocalFavoriteData = new FavoritesFile(SavePath + "/favorites.json", isCloud: false);
358
359 public static FavoritesFile CloudFavoritesData = new FavoritesFile("favorites.json", isCloud: true);
360
362
364
365 public static PingMapLayer Pings = new PingMapLayer();
366
368
369 public static CreativeUI CreativeMenu = new CreativeUI();
370
372
373 private static double _lastPingMouseDownTime = 0.0;
374
376
378
380
381 public static UserInterface MenuUI = new UserInterface();
382
383 public static UserInterface InGameUI = new UserInterface();
384
386
387 public static bool drawBackGore;
388
389 public static ulong LobbyId = 0uL;
390
392
394
396
397 public static bool ServerSideCharacter;
398
399 public static string clientUUID;
400
401 public static bool ContentLoaded = false;
402
403 private static int toolTipDistance = 6;
404
405 public static float GlobalTimeWrappedHourly;
406
407 public static bool GlobalTimerPaused = false;
408
409 public static GameTime gameTimeCache = new GameTime();
410
411 public static ulong TileFrameSeed = (ulong)Guid.NewGuid().GetHashCode();
412
413 private static ulong _drawCycleCounter;
414
416
418
420
421 public static Ref<Effect> TileShaderRef = new Ref<Effect>();
422
424
425 public static int WaveQuality = 3;
426
427 public static bool UseStormEffects = true;
428
429 public static bool UseHeatDistortion = true;
430
432
433 public static int npcStreamSpeed = 30;
434
435 public static int musicError;
436
437 public static bool dedServFPS;
438
439 public static int dedServCount1;
440
441 public static int dedServCount2;
442
443 public static bool superFast = false;
444
445 public static readonly int offLimitBorderTiles = 40;
446
447 public static readonly int maxMusic = 92;
448
449 public const int MaxBannerTypes = 290;
450
451 public static readonly int maxBackgrounds = 298;
452
453 public const int MaxShopIDs = 100;
454
455 private static float cameraLerp;
456
457 private static int cameraLerpTimer;
458
459 private static int cameraLerpTimeToggle;
460
461 private static bool cameraGamePadLerp;
462
463 public static Vector2[] OffsetsNPCOffhand = new Vector2[5]
464 {
465 new Vector2(14f, 34f),
466 new Vector2(14f, 32f),
467 new Vector2(14f, 26f),
468 new Vector2(14f, 22f),
469 new Vector2(14f, 18f)
470 };
471
472 public static Vector2[] OffsetsPlayerOffhand = new Vector2[20]
473 {
474 new Vector2(14f, 20f),
475 new Vector2(14f, 20f),
476 new Vector2(14f, 20f),
477 new Vector2(14f, 18f),
478 new Vector2(14f, 20f),
479 new Vector2(16f, 4f),
480 new Vector2(16f, 16f),
481 new Vector2(18f, 14f),
482 new Vector2(18f, 14f),
483 new Vector2(18f, 14f),
484 new Vector2(16f, 16f),
485 new Vector2(16f, 16f),
486 new Vector2(16f, 16f),
487 new Vector2(16f, 16f),
488 new Vector2(14f, 14f),
489 new Vector2(14f, 14f),
490 new Vector2(12f, 14f),
491 new Vector2(14f, 16f),
492 new Vector2(16f, 16f),
493 new Vector2(16f, 16f)
494 };
495
496 public static Vector2[] OffsetsPlayerOnhand = new Vector2[20]
497 {
498 new Vector2(6f, 19f),
499 new Vector2(5f, 10f),
500 new Vector2(12f, 10f),
501 new Vector2(13f, 17f),
502 new Vector2(12f, 19f),
503 new Vector2(5f, 10f),
504 new Vector2(7f, 17f),
505 new Vector2(6f, 16f),
506 new Vector2(6f, 16f),
507 new Vector2(6f, 16f),
508 new Vector2(6f, 17f),
509 new Vector2(7f, 17f),
510 new Vector2(7f, 17f),
511 new Vector2(7f, 17f),
512 new Vector2(8f, 17f),
513 new Vector2(9f, 16f),
514 new Vector2(9f, 12f),
515 new Vector2(8f, 17f),
516 new Vector2(7f, 17f),
517 new Vector2(7f, 17f)
518 };
519
520 public static Vector2[] OffsetsPlayerHeadgear = new Vector2[20]
521 {
522 new Vector2(0f, 2f),
523 new Vector2(0f, 2f),
524 new Vector2(0f, 2f),
525 new Vector2(0f, 2f),
526 new Vector2(0f, 2f),
527 new Vector2(0f, 2f),
528 new Vector2(0f, 2f),
529 new Vector2(0f, 0f),
530 new Vector2(0f, 0f),
531 new Vector2(0f, 0f),
532 new Vector2(0f, 2f),
533 new Vector2(0f, 2f),
534 new Vector2(0f, 2f),
535 new Vector2(0f, 2f),
536 new Vector2(0f, 0f),
537 new Vector2(0f, 0f),
538 new Vector2(0f, 0f),
539 new Vector2(0f, 2f),
540 new Vector2(0f, 2f),
541 new Vector2(0f, 2f)
542 };
543
545
546 public static float sunCircle;
547
548 public static int BlackFadeIn;
549
550 public static bool noWindowBorder = false;
551
553
554 private string _cachedTitle;
555
556 public static int undergroundBackground;
557
558 public static int oldUndergroundBackground;
559
560 public static bool skipMenu = false;
561
562 public static bool verboseNetplay = false;
563
564 public static bool stopTimeOuts = false;
565
566 public static bool showSpam = false;
567
568 public static bool showItemOwner = false;
569
570 public static bool[] townNPCCanSpawn = new bool[NPCID.Count];
571
572 public static int musicBox2 = -1;
573
574 public static int musicBoxNotModifiedByVolume = -1;
575
576 public static byte HealthBarDrawSettings = 1;
577
578 public static bool runningCollectorsEdition;
579
580 public static float wFrCounter;
581
582 public static float wFrame;
583
584 public static float upTimer;
585
586 public static float upTimerMax;
587
588 public static float upTimerMaxDelay;
589
590 public static bool drawDiag;
591
592 public static bool drawRelease;
593
594 public static bool drawBetterDebug;
595
596 public static bool betterDebugRelease;
597
598 public static bool renderNow;
599
600 public static bool drawToScreen;
601
602 public static bool targetSet;
603
604 public static int mouseX;
605
606 public static int mouseY;
607
608 public static int lastMouseX;
609
610 public static int lastMouseY;
611
613
614 public static bool mouseLeft;
615
616 public static bool mouseRight;
617
618 public static bool isMouseLeftConsumedByUI = false;
619
620 public static float essScale = 1f;
621
622 public static int essDir = -1;
623
624 public static float[] cloudBGX = new float[2];
625
626 public static float cloudBGAlpha;
627
628 public static float cloudBGActive;
629
630 public static int[] cloudBG = new int[2] { 112, 113 };
631
632 public static int[] treeMntBGSet1 = new int[2];
633
634 public static int[] treeMntBGSet2 = new int[2];
635
636 public static int[] treeMntBGSet3 = new int[2];
637
638 public static int[] treeMntBGSet4 = new int[2];
639
640 public static int[] treeBGSet1 = new int[3];
641
642 public static int[] treeBGSet2 = new int[3];
643
644 public static int[] treeBGSet3 = new int[3];
645
646 public static int[] treeBGSet4 = new int[3];
647
648 public static int[] corruptBG = new int[3];
649
650 public static int[] jungleBG = new int[3];
651
652 public static int[] snowMntBG = new int[2];
653
654 public static int[] snowBG = new int[3];
655
656 public static int[] hallowBG = new int[3];
657
658 public static int[] crimsonBG = new int[3];
659
660 public static int[] desertBG = new int[3];
661
662 public static int[] mushroomBG = new int[3];
663
664 public static int oceanBG;
665
666 public static int[] underworldBG = new int[5];
667
668 public static int[] treeX = new int[4];
669
670 public static int[] treeStyle = new int[4];
671
672 public static int[] caveBackX = new int[4];
673
674 public static int[] caveBackStyle = new int[4];
675
676 public static int iceBackStyle;
677
678 public static int hellBackStyle;
679
680 public static int jungleBackStyle;
681
682 public static string debugWords = "";
683
684 public static bool gamePad = false;
685
686 public static bool xMas;
687
688 public static bool halloween;
689
690 public static bool forceXMasForToday;
691
692 public static bool forceHalloweenForToday;
693
694 public static bool DisableIntenseVisualEffects = false;
695
696 public static int snowDust = 0;
697
698 public static bool changeTheTitle;
699
700 public static bool hairWindow;
701
702 public static bool clothesWindow;
703
704 public static bool ingameOptionsWindow = false;
705
706 public static bool inFancyUI = false;
707
708 public static int keyCount;
709
710 public static string[] keyString = new string[10];
711
712 public static int[] keyInt = new int[10];
713
714 public static byte gFade;
715
716 public static float gFader;
717
718 public static byte gFadeDir = 1;
719
720 public static bool shouldDrawNetDiagnosticsUI;
721
723
725
726 public static double UpdateTimeAccumulator;
727
728 public static bool drawSkip;
729
730 public static int fpsCount;
731
732 public static Stopwatch fpsTimer = new Stopwatch();
733
734 public bool gammaTest;
735
736 private const bool USE_ASYNC_LOAD = true;
737
738 private static bool _isAsyncLoadComplete;
739
740 public static bool showSplash = true;
741
742 public static bool ignoreErrors = true;
743
744 public static string defaultIP = "";
745
746 public static int dayRate = 1;
747
748 public static int desiredWorldTilesUpdateRate = 1;
749
750 public static int maxScreenW = 1920;
751
752 public static int maxScreenH = 1200;
753
754 public static int minScreenW = 800;
755
756 public static int minScreenH = 600;
757
758 public static float iS = 1f;
759
760 public static bool render;
761
762 public static int qaStyle;
763
764 public static int buffScanAreaWidth = (maxScreenW + 800) / 16 - 1;
765
766 public static int buffScanAreaHeight = (maxScreenH + 800) / 16 - 1;
767
768 public static float musicPitch = 0f;
769
770 public static bool[] projHostile = new bool[ProjectileID.Count];
771
772 public static bool[] projHook = new bool[ProjectileID.Count];
773
774 public static bool[] pvpBuff = new bool[BuffID.Count];
775
776 public static bool[] persistentBuff = new bool[BuffID.Count];
777
778 public static bool[] vanityPet = new bool[BuffID.Count];
779
780 public static bool[] lightPet = new bool[BuffID.Count];
781
782 public static bool[] meleeBuff = new bool[BuffID.Count];
783
784 public static bool[] debuff = new bool[BuffID.Count];
785
786 public static bool[] buffNoSave = new bool[BuffID.Count];
787
788 public static bool[] buffNoTimeDisplay = new bool[BuffID.Count];
789
790 public static bool[] buffDoubleApply = new bool[BuffID.Count];
791
792 public static int maxMP = 10;
793
794 public static string[] recentWorld = new string[maxMP];
795
796 public static string[] recentIP = new string[maxMP];
797
798 public static int[] recentPort = new int[maxMP];
799
800 public static bool shortRender = true;
801
802 public static bool BackgroundEnabled = true;
803
804 public static int instantBGTransitionCounter = 2;
805
806 public static int bgDelay;
807
808 public static int bgStyle;
809
810 private const int BG_STYLES_COUNT = 14;
811
812 public static float[] bgAlphaFrontLayer = new float[14];
813
814 public static float[] bgAlphaFarBackLayer = new float[14];
815
816 public static int[] bgFrame = new int[14];
817
818 public static int[] bgFrameCounter = new int[14];
819
820 public static int EquipPage;
821
822 public static int EquipPageSelected;
823
824 public int mouseNPCIndex = -1;
825
826 public int mouseNPCType = -1;
827
828 public static int wofNPCIndex = -1;
829
830 public static int wofDrawAreaTop;
831
832 public static int wofDrawAreaBottom;
833
834 public static int wofDrawFrameIndex;
835
836 public static int offScreenRange = 200;
837
839
841
843
845
847
849
851
853
855
856 public static int maxMapUpdates = 250000;
857
858 public static bool refreshMap;
859
860 public static int loadMapLastX;
861
862 public static bool loadMapLock;
863
864 public static bool loadMap;
865
866 public static bool mapReady;
867
868 public static int textureMaxWidth = 2000;
869
870 public static int textureMaxHeight = 1800;
871
872 public static bool updateMap;
873
874 public static int mapMinX = 0;
875
876 public static int mapMaxX = 0;
877
878 public static int mapMinY;
879
880 public static int mapMaxY;
881
882 public static int mapTimeMax = 30;
883
884 public static int mapTime = mapTimeMax;
885
886 public static bool clearMap;
887
888 public static int mapTargetX = 5;
889
890 public static int mapTargetY = 2;
891
893
895
896 public static bool[,] initMap = new bool[mapTargetX, mapTargetY];
897
898 public static bool[,] mapWasContentLost = new bool[mapTargetX, mapTargetY];
899
900 public const int numInfoIcons = 13;
901
903
904 public static bool mapInit;
905
906 public static bool mapEnabled = true;
907
908 public static int mapStyle = 1;
909
910 public static float grabMapX;
911
912 public static float grabMapY;
913
914 public static int miniMapX;
915
916 public static int miniMapY;
917
918 public static int miniMapWidth;
919
920 public static int miniMapHeight;
921
922 public static float mapMinimapDefaultScale = 1.05f;
923
925
926 public static float mapMinimapAlpha = 1f;
927
928 public static float mapOverlayScale = 2.5f;
929
930 public static float mapOverlayAlpha = 0.35f;
931
932 public static bool mapFullscreen;
933
934 public static bool resetMapFull;
935
936 public static float mapFullscreenScale = 4f;
937
938 public static Vector2 mapFullscreenPos = new Vector2(-1f, -1f);
939
940 private static bool IsEnginePreloaded;
941
942 private static bool IsEngineLoaded;
943
944 private static uint _gameUpdateCount;
945
946 public static bool SkipAssemblyLoad;
947
948 private int firstTileX;
949
950 private int lastTileX;
951
952 private int firstTileY;
953
954 private int lastTileY;
955
956 private double bgParallax;
957
958 private int bgStartX;
959
960 private int bgLoops;
961
962 private int bgStartY;
963
964 private int bgLoopsY;
965
966 private int bgTopY;
967
968 public static int renderCount = 99;
969
970 private const int MF_BYPOSITION = 1024;
971
973
975
976 public static TileBatch tileBatch;
977
979
981
983
984 private static Process tServer;
985
986 private static Stopwatch saveTime = new Stopwatch();
987
988 public static KeyboardState keyState;
989
991
993
994 public static Microsoft.Xna.Framework.Color hcColor = new Microsoft.Xna.Framework.Color(1f, 0.15f, 0.1f);
995
997
999
1001
1003
1004 public static bool craftingHide;
1005
1006 public static bool armorHide;
1007
1008 public static float shimmerAlpha = 0f;
1009
1010 public static float shimmerDarken = 0f;
1011
1012 public static float shimmerBrightenDelay = 0f;
1013
1014 public static float craftingAlpha = 1f;
1015
1016 public static float armorAlpha = 1f;
1017
1018 public static float[] buffAlpha = new float[BuffID.Count];
1019
1020 public static bool afterPartyOfDoom = false;
1021
1022 public static bool hardMode;
1023
1024 public float chestLootScale = 1f;
1025
1026 public bool chestLootHover;
1027
1028 public float chestStackScale = 1f;
1029
1030 public bool chestStackHover;
1031
1032 public float chestDepositScale = 1f;
1033
1035
1036 public float chestRenameScale = 1f;
1037
1038 public bool chestRenameHover;
1039
1040 public float chestCancelScale = 1f;
1041
1042 public bool chestCancelHover;
1043
1045
1047
1049
1051
1053
1054 public static bool maxQ = true;
1055
1056 public static float gfxQuality = 1f;
1057
1058 public static float gfxRate = 0.01f;
1059
1060 public int DiscoStyle;
1061
1062 public static int DiscoR = 255;
1063
1064 public static int DiscoB;
1065
1066 public static int DiscoG;
1067
1068 public static int teamCooldown;
1069
1070 public static int teamCooldownLen = 300;
1071
1072 public static bool gamePaused;
1073
1074 public static bool gameInactive;
1075
1076 public static int updatesCountedForFPS;
1077
1078 public static int drawsCountedForFPS;
1079
1080 public static int uCount;
1081
1082 public static int updateRate;
1083
1084 public static int frameRate;
1085
1086 public static bool RGBRelease;
1087
1088 public static bool qRelease = false;
1089
1090 public static bool netRelease;
1091
1092 public static bool frameRelease;
1093
1094 public static bool showFrameRate = false;
1095
1096 public static int magmaBGFrame;
1097
1098 public static int magmaBGFrameCounter;
1099
1100 public static int saveTimer = 0;
1101
1102 public static bool autoJoin;
1103
1104 public static bool serverStarting = false;
1105
1106 public static float leftWorld = 0f;
1107
1108 public static float rightWorld = 134400f;
1109
1110 public static float topWorld = 0f;
1111
1112 public static float bottomWorld = 38400f;
1113
1114 public static int maxTilesX = (int)rightWorld / 16 + 1;
1115
1116 public static int maxTilesY = (int)bottomWorld / 16 + 1;
1117
1118 public const int sectionWidth = 200;
1119
1120 public const int sectionHeight = 150;
1121
1122 public static int maxSectionsX = maxTilesX / 200;
1123
1124 public static int maxSectionsY = maxTilesY / 150;
1125
1126 public const int maxDust = 6000;
1127
1128 public static int maxDustToDraw = 6000;
1129
1130 public const int maxCombatText = 100;
1131
1132 public const int maxItemText = 20;
1133
1134 public const int maxPlayers = 255;
1135
1136 public static int maxNetPlayers = 255;
1137
1138 public const int maxChests = 8000;
1139
1140 public const int maxItems = 400;
1141
1142 public const int maxProjectiles = 1000;
1143
1144 public const int maxNPCs = 200;
1145
1147
1149
1151
1153
1154 public static int maxRain = 750;
1155
1156 public static int slimeWarningTime;
1157
1158 public static int slimeWarningDelay = 420;
1159
1160 public static float slimeRainNPCSlots = 0.65f;
1161
1162 public static bool[] slimeRainNPC = new bool[NPCID.Count];
1163
1164 public static double slimeRainTime;
1165
1166 public static bool slimeRain;
1167
1168 public static int slimeRainKillCount;
1169
1170 private const double slimeRainMaxTime = 54000.0;
1171
1172 private const double slimeRainMinTime = 32400.0;
1173
1174 private const double slimeRainMaxDelay = 604800.0;
1175
1176 private const double slimeRainMinDelay = 302400.0;
1177
1178 private const double LeinforsBalanceRequestForSlimeRainChance = 1.0416666666666667;
1179
1180 private const double slimeRainChance = 450000.00000000006;
1181
1182 public const int maxGore = 600;
1183
1184 public const int InventoryItemSlotsStart = 0;
1185
1186 public const int InventoryItemSlotsCount = 50;
1187
1188 public const int InventoryCoinSlotsStart = 50;
1189
1190 public const int InventoryCoinSlotsCount = 4;
1191
1192 public const int InventoryAmmoSlotsStart = 54;
1193
1194 public const int InventoryAmmoSlotsCount = 4;
1195
1196 public const int InventorySlotsTotal = 58;
1197
1198 public int invBottom = 210;
1199
1200 public const int maxLiquidTypes = 15;
1201
1202 public static float cameraX;
1203
1204 public static bool drewLava;
1205
1206 public static float[] liquidAlpha = new float[15];
1207
1208 public static int waterStyle;
1209
1210 public static int WorldRollingBackupsCountToKeep = 2;
1211
1212 private static bool TOWMusicUnlocked = false;
1213
1214 private static bool swapMusic = false;
1215
1216 public static float caveParallax = 0.88f;
1217
1218 public static int dungeonX;
1219
1220 public static int dungeonY;
1221
1222 public static Liquid[] liquid = new Liquid[Liquid.maxLiquid];
1223
1224 public static LiquidBuffer[] liquidBuffer = new LiquidBuffer[50000];
1225
1226 public static bool dedServ;
1227
1228 public static int spamCount = 0;
1229
1230 public static int curMusic;
1231
1232 public static int dayMusic;
1233
1234 public static int ugMusic;
1235
1236 public static int newMusic;
1237
1238 public static bool showItemText = true;
1239
1240 public static bool autoSave = true;
1241
1242 public static bool validateSaves = true;
1243
1244 public static bool bannerMouseOver;
1245
1246 public static string buffString = "";
1247
1248 public static string libPath = "";
1249
1250 public static int lo;
1251
1252 public static int LogoA = 255;
1253
1254 public static int LogoB;
1255
1256 public static bool LogoT;
1257
1258 public static string statusText = "";
1259
1260 public static string worldName = "";
1261
1262 public static int worldID;
1263
1264 public static int background;
1265
1266 public static int caveBackground = 0;
1267
1268 public static float ugBackTransition;
1269
1271
1272 public static double worldSurface;
1273
1274 public static double rockLayer;
1275
1277
1278 public const double dayLength = 54000.0;
1279
1280 public const double nightLength = 32400.0;
1281
1282 public static bool dayTime = true;
1283
1284 public static double time = 13500.0;
1285
1286 public static double timeForVisualEffects;
1287
1288 public static int moonPhase;
1289
1290 public static short sunModY;
1291
1292 public static short moonModY;
1293
1294 public static bool alreadyGrabbingSunOrMoon;
1295
1296 public static bool bloodMoon;
1297
1298 public static bool pumpkinMoon;
1299
1300 public static bool snowMoon;
1301
1302 public static float cloudAlpha;
1303
1304 public static float maxRaining;
1305
1306 public static float oldMaxRaining;
1307
1308 public static int rainTime;
1309
1310 public static bool raining;
1311
1312 public static bool eclipse;
1313
1314 public static float eclipseLight;
1315
1316 public static int checkForSpawns;
1317
1318 public static int helpText;
1319
1320 public static int BartenderHelpTextIndex = 0;
1321
1322 public static bool autoGen;
1323
1324 public static bool autoPause = false;
1325
1326 public static int[] projFrames = new int[ProjectileID.Count];
1327
1328 public static bool[] projPet = new bool[ProjectileID.Count];
1329
1330 public static float demonTorch = 1f;
1331
1332 public static int demonTorchDir = 1;
1333
1334 public static float martianLight = 1f;
1335
1336 public static int martianLightDir = 1;
1337
1338 public static float masterColor = 1f;
1339
1340 public static int masterColorDir = 1;
1341
1342 public static bool placementPreview = true;
1343
1345
1346 public const int maxStars = 400;
1347
1348 public static int numStars;
1349
1350 public const int maxStarTypes = 4;
1351
1352 public const int maxClouds = 200;
1353
1354 public static int weatherCounter;
1355
1356 public static int numClouds = 200;
1357
1358 public static int numCloudsTemp = numClouds;
1359
1360 public static float windSpeedCurrent;
1361
1362 public static float windSpeedTarget;
1363
1364 public static int windCounter;
1365
1366 public static int extremeWindCounter;
1367
1368 public static bool windPhysics = false;
1369
1370 public static float windPhysicsStrength = 0.1f;
1371
1372 public static bool SettingsEnabled_TilesSwayInWind = true;
1373
1374 public static Cloud[] cloud = new Cloud[200];
1375
1376 public static bool resetClouds = true;
1377
1379
1380 public static int fadeCounter;
1381
1382 public static float invAlpha = 1f;
1383
1384 public static float invDir = 1f;
1385
1386 [ThreadStatic]
1387 public static UnifiedRandom rand;
1388
1389 public static bool allChestStackHover;
1390
1391 public static bool inventorySortMouseOver;
1392
1393 public static float GraveyardVisualIntensity;
1394
1395 public const int maxMoons = 9;
1396
1397 public static int moonType = 0;
1398
1399 public const int numTileColors = 32;
1400
1401 public const int numTreeStyles = 32;
1402
1403 public const int numberOfHairstyles = 165;
1404
1405 public const int maxHairStyles = 165;
1406
1407 public const int maxCharSelectHair = 51;
1408
1409 public const int maxHairOfStylistDefault = 123;
1410
1411 public static bool UseExperimentalFeatures;
1412
1413 public static string DefaultSeed = "";
1414
1416
1417 public static bool[] musicNoCrossFade = new bool[maxMusic];
1418
1419 public static float[] musicFade = new float[maxMusic];
1420
1421 public static float musicVolume = 1f;
1422
1423 public static float ambientVolume = 1f;
1424
1425 public static float soundVolume = 1f;
1426
1427 public static ServerMode MenuServerMode = ServerMode.Lobby | ServerMode.FriendsCanJoin;
1428
1429 public static bool[] tileLighted = new bool[TileID.Count];
1430
1431 public static bool[] tileMergeDirt = new bool[TileID.Count];
1432
1433 public static bool[] tileCut = new bool[TileID.Count];
1434
1435 public static bool[] tileAlch = new bool[TileID.Count];
1436
1437 public static int[] tileShine = new int[TileID.Count];
1438
1439 public static bool[] tileShine2 = new bool[TileID.Count];
1440
1441 public static bool[] wallHouse = new bool[WallID.Count];
1442
1443 public static bool[] wallDungeon = new bool[WallID.Count];
1444
1445 public static bool[] wallLight = new bool[WallID.Count];
1446
1447 public static int[] wallBlend = new int[WallID.Count];
1448
1449 public static bool[] tileStone = new bool[TileID.Count];
1450
1451 public static bool[] tileAxe = new bool[TileID.Count];
1452
1453 public static bool[] tileHammer = new bool[TileID.Count];
1454
1455 public static bool[] tileWaterDeath = new bool[TileID.Count];
1456
1457 public static bool[] tileLavaDeath = new bool[TileID.Count];
1458
1459 public static bool[] tileTable = new bool[TileID.Count];
1460
1461 public static bool[] tileBlockLight = new bool[TileID.Count];
1462
1463 public static bool[] tileNoSunLight = new bool[TileID.Count];
1464
1465 public static bool[] tileDungeon = new bool[TileID.Count];
1466
1467 public static bool[] tileSpelunker = new bool[TileID.Count];
1468
1469 public static bool[] tileSolidTop = new bool[TileID.Count];
1470
1471 public static bool[] tileSolid = new bool[TileID.Count];
1472
1473 public static bool[] tileBouncy = new bool[TileID.Count];
1474
1475 public static short[] tileOreFinderPriority = new short[TileID.Count];
1476
1477 public static byte[] tileLargeFrames = new byte[TileID.Count];
1478
1479 public static byte[] wallLargeFrames = new byte[WallID.Count];
1480
1481 public static bool[] tileRope = new bool[TileID.Count];
1482
1483 public static bool[] tileBrick = new bool[TileID.Count];
1484
1485 public static bool[] tileMoss = new bool[TileID.Count];
1486
1487 public static bool[] tileNoAttach = new bool[TileID.Count];
1488
1489 public static bool[] tileNoFail = new bool[TileID.Count];
1490
1491 public static bool[] tileCracked = new bool[TileID.Count];
1492
1493 public static bool[] tileObsidianKill = new bool[TileID.Count];
1494
1495 public static bool[] tileFrameImportant = new bool[TileID.Count];
1496
1497 public static bool[] tilePile = new bool[TileID.Count];
1498
1499 public static bool[] tileBlendAll = new bool[TileID.Count];
1500
1501 public static short[] tileGlowMask = new short[TileID.Count];
1502
1503 public static bool[] tileContainer = new bool[TileID.Count];
1504
1505 public static bool[] tileSign = new bool[TileID.Count];
1506
1507 public static bool[][] tileMerge = new bool[TileID.Count][];
1508
1509 public static int cageFrames = 25;
1510
1511 public static bool critterCage;
1512
1513 public static int[] bunnyCageFrame = new int[cageFrames];
1514
1515 public static int[] bunnyCageFrameCounter = new int[cageFrames];
1516
1517 public static int[] squirrelCageFrame = new int[cageFrames];
1518
1519 public static int[] squirrelCageFrameCounter = new int[cageFrames];
1520
1521 public static int[] squirrelCageFrameOrange = new int[cageFrames];
1522
1523 public static int[] squirrelCageFrameCounterOrange = new int[cageFrames];
1524
1525 public static int[] mallardCageFrame = new int[cageFrames];
1526
1527 public static int[] mallardCageFrameCounter = new int[cageFrames];
1528
1529 public static int[] duckCageFrame = new int[cageFrames];
1530
1531 public static int[] duckCageFrameCounter = new int[cageFrames];
1532
1533 public static int[] grebeCageFrame = new int[cageFrames];
1534
1535 public static int[] grebeCageFrameCounter = new int[cageFrames];
1536
1537 public static int[] seagullCageFrame = new int[cageFrames];
1538
1539 public static int[] seagullCageFrameCounter = new int[cageFrames];
1540
1541 public static int[] birdCageFrame = new int[cageFrames];
1542
1543 public static int[] birdCageFrameCounter = new int[cageFrames];
1544
1545 public static int[] redBirdCageFrame = new int[cageFrames];
1546
1547 public static int[] redBirdCageFrameCounter = new int[cageFrames];
1548
1549 public static int[] blueBirdCageFrame = new int[cageFrames];
1550
1551 public static int[] blueBirdCageFrameCounter = new int[cageFrames];
1552
1553 public static int[] macawCageFrame = new int[cageFrames];
1554
1555 public static int[] macawCageFrameCounter = new int[cageFrames];
1556
1557 public static byte[,] butterflyCageMode = new byte[9, cageFrames];
1558
1559 public static int[,] butterflyCageFrame = new int[9, cageFrames];
1560
1561 public static int[,] butterflyCageFrameCounter = new int[9, cageFrames];
1562
1563 public static int[,] dragonflyJarFrameCounter = new int[7, cageFrames];
1564
1565 public static int[,] dragonflyJarFrame = new int[7, cageFrames];
1566
1567 public static int[,] scorpionCageFrame = new int[2, cageFrames];
1568
1569 public static int[,] scorpionCageFrameCounter = new int[2, cageFrames];
1570
1571 public static int[] snailCageFrame = new int[cageFrames];
1572
1573 public static int[] snailCageFrameCounter = new int[cageFrames];
1574
1575 public static int[] snail2CageFrame = new int[cageFrames];
1576
1577 public static int[] snail2CageFrameCounter = new int[cageFrames];
1578
1579 public static byte[] fishBowlFrameMode = new byte[cageFrames];
1580
1581 public static int[] fishBowlFrame = new int[cageFrames];
1582
1583 public static int[] fishBowlFrameCounter = new int[cageFrames];
1584
1585 public static int[] lavaFishBowlFrame = new int[cageFrames];
1586
1587 public static int[] lavaFishBowlFrameCounter = new int[cageFrames];
1588
1589 public static int[] frogCageFrame = new int[cageFrames];
1590
1591 public static int[] frogCageFrameCounter = new int[cageFrames];
1592
1593 public static int[] mouseCageFrame = new int[cageFrames];
1594
1595 public static int[] mouseCageFrameCounter = new int[cageFrames];
1596
1597 public static int[] turtleCageFrame = new int[cageFrames];
1598
1599 public static int[] turtleCageFrameCounter = new int[cageFrames];
1600
1601 public static int[] fairyJarFrame = new int[cageFrames];
1602
1603 public static int[] fairyJarFrameCounter = new int[cageFrames];
1604
1605 public static byte[,] jellyfishCageMode = new byte[3, cageFrames];
1606
1607 public static int[,] jellyfishCageFrame = new int[3, cageFrames];
1608
1609 public static int[,] jellyfishCageFrameCounter = new int[3, cageFrames];
1610
1611 public static int[] wormCageFrame = new int[cageFrames];
1612
1613 public static int[] wormCageFrameCounter = new int[cageFrames];
1614
1615 public static int[] maggotCageFrame = new int[cageFrames];
1616
1617 public static int[] maggotCageFrameCounter = new int[cageFrames];
1618
1619 public static int[] ratCageFrame = new int[cageFrames];
1620
1621 public static int[] ratCageFrameCounter = new int[cageFrames];
1622
1623 public static int[] ladybugCageFrame = new int[cageFrames];
1624
1625 public static int[] ladybugCageFrameCounter = new int[cageFrames];
1626
1627 public static int[] penguinCageFrame = new int[cageFrames];
1628
1629 public static int[] penguinCageFrameCounter = new int[cageFrames];
1630
1631 public static int[] waterStriderCageFrame = new int[cageFrames];
1632
1633 public static int[] waterStriderCageFrameCounter = new int[cageFrames];
1634
1635 public static int[] seahorseCageFrame = new int[cageFrames];
1636
1637 public static int[] seahorseCageFrameCounter = new int[cageFrames];
1638
1639 public static int[,] slugCageFrame = new int[3, cageFrames];
1640
1641 public static int[,] slugCageFrameCounter = new int[3, cageFrames];
1642
1643 public static int[] owlCageFrame = new int[cageFrames];
1644
1645 public static int[] owlCageFrameCounter = new int[cageFrames];
1646
1647 public static int[] grasshopperCageFrame = new int[cageFrames];
1648
1649 public static int[] grasshopperCageFrameCounter = new int[cageFrames];
1650
1651 public static bool[] tileSand = new bool[TileID.Count];
1652
1653 public static bool[] tileFlame = new bool[TileID.Count];
1654
1655 public static bool[] npcCatchable = new bool[NPCID.Count];
1656
1657 public static int[] tileFrame = new int[TileID.Count];
1658
1659 public static int[] tileFrameCounter = new int[TileID.Count];
1660
1661 public static byte[] wallFrame = new byte[WallID.Count];
1662
1663 public static byte[] wallFrameCounter = new byte[WallID.Count];
1664
1665 public static int[] backgroundWidth = new int[maxBackgrounds];
1666
1667 public static int[] backgroundHeight = new int[maxBackgrounds];
1668
1670
1671 public static bool tilesLoaded = false;
1672
1673 public static WorldMap Map;
1674
1675 public static Tile[,] tile = new Tile[maxTilesX, maxTilesY];
1676
1677 public static Dust[] dust = new Dust[6001];
1678
1679 public static Star[] star = new Star[400];
1680
1681 public static Item[] item = new Item[401];
1682
1683 public static int[] timeItemSlotCannotBeReusedFor = new int[401];
1684
1685 public static NPC[] npc = new NPC[201];
1686
1687 public static Gore[] gore = new Gore[601];
1688
1689 public static Rain[] rain = new Rain[maxRain + 1];
1690
1691 public static Projectile[] projectile = new Projectile[1001];
1692
1693 public static int[,] projectileIdentity = new int[256, 1001];
1694
1695 public static CombatText[] combatText = new CombatText[100];
1696
1697 public static PopupText[] popupText = new PopupText[20];
1698
1699 public static Chest[] chest = new Chest[8000];
1700
1701 public static Sign[] sign = new Sign[1000];
1702
1703 public static int[] itemFrame = new int[401];
1704
1705 public static int[] itemFrameCounter = new int[401];
1706
1708
1710
1712
1714
1716
1718
1719 public static int screenWidth = 1152;
1720
1721 public static int screenHeight = 864;
1722
1723 public static bool screenMaximized = true;
1724
1725 public static bool screenBorderless = true;
1726
1728
1729 public static int teamNamePlateDistance = 2000;
1730
1731 public static int multiplayerNPCSmoothingRange = 300;
1732
1733 public static bool Setting_UseReducedMaxLiquids = false;
1734
1736
1737 public static object CurrentInputTextTakerOverride;
1738
1739 public static bool drawingPlayerChat;
1740
1741 public static bool chatRelease;
1742
1743 public static string chatText = "";
1744
1745 public static bool inputTextEnter;
1746
1747 public static bool inputTextEscape;
1748
1749 public static float[] hotbarScale = new float[10] { 1f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f, 0.75f };
1750
1751 public static byte mouseTextColor;
1752
1753 public static int mouseTextColorChange = 1;
1754
1755 public static bool mouseLeftRelease;
1756
1757 public static bool mouseRightRelease;
1758
1759 public static bool playerInventory;
1760
1761 public static int stackSplit;
1762
1763 public static bool preventStackSplitReset;
1764
1765 public static int stackCounter;
1766
1767 public static int timesTriedToFastStack;
1768
1769 public static int stackDelay = 7;
1770
1771 public static int superFastStack;
1772
1773 public static Item mouseItem = new Item();
1774
1775 public static Item guideItem = new Item();
1776
1777 public static Item reforgeItem = new Item();
1778
1779 public static float inventoryScale = 0.75f;
1780
1781 public static bool hasFocus;
1782
1784
1785 public static bool recFastScroll;
1786
1787 public static bool recBigList;
1788
1789 public static int recStart;
1790
1791 public static Recipe[] recipe = new Recipe[Recipe.maxRecipes];
1792
1793 public static int[] availableRecipe = new int[Recipe.maxRecipes];
1794
1795 public static float[] availableRecipeY = new float[Recipe.maxRecipes];
1796
1797 public static int numAvailableRecipes;
1798
1799 public static int focusRecipe;
1800
1801 public static int myPlayer;
1802
1803 public static Player[] player = new Player[256];
1804
1805 public static Player[] playerVisualClone = new Player[256];
1806
1807 public static bool[] countsAsHostForGameplay = new bool[256];
1808
1809 public static int spawnTileX;
1810
1811 public static int spawnTileY;
1812
1813 public static bool npcChatRelease;
1814
1815 public static bool editSign;
1816
1817 public static bool editChest;
1818
1819 public static bool blockInput = false;
1820
1821 public static string blockKey = Microsoft.Xna.Framework.Input.Keys.None.ToString();
1822
1823 public static string defaultChestName = string.Empty;
1824
1825 public static string npcChatText = "";
1826
1827 public static bool npcChatFocus1;
1828
1829 public static bool npcChatFocus2;
1830
1831 public static bool npcChatFocus3;
1832
1833 public static bool npcChatFocus4;
1834
1835 public static int oldNPCShop;
1836
1837 public static int npcChatCornerItem;
1838
1839 public Chest[] shop = new Chest[100];
1840
1842
1843 public static int[] travelShop = new int[40];
1844
1846
1847 public static bool anglerQuestFinished;
1848
1849 public static int anglerQuest;
1850
1851 public static int[] anglerQuestItemNetIDs = new int[41]
1852 {
1853 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459,
1854 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469,
1855 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479,
1856 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 4393,
1857 4394
1858 };
1859
1861
1863
1865
1867
1869
1871
1873
1874 public static ShopHelper ShopHelper;
1875
1876 public static GolfState LocalGolfState = new GolfState();
1877
1879
1881
1883
1884 public static bool Support4K = true;
1885
1886 public static float MinimumZoomComparerX = 1920f;
1887
1888 public static float MinimumZoomComparerY = 1200f;
1889
1890 private static int _renderTargetMaxSize = 2048;
1891
1893
1895
1896 public static int LogicCheckScreenWidth = 1920;
1897
1898 public static int LogicCheckScreenHeight = 1200;
1899
1901
1902 public static float temporaryGUIScaleSlider = -1f;
1903
1904 public static bool temporaryGUIScaleSliderUpdate = false;
1905
1906 public static bool InGuideCraftMenu;
1907
1908 public static bool InReforgeMenu;
1909
1910 public static Item HoverItem = new Item();
1911
1912 private static int backSpaceCount;
1913
1914 private static float backSpaceRate;
1915
1916 public static string motd = "";
1917
1918 public static bool toggleFullscreen;
1919
1920 public static int numDisplayModes;
1921
1922 public static int[] displayWidth = new int[99];
1923
1924 public static int[] displayHeight = new int[99];
1925
1926 public static bool gameMenu = true;
1927
1928 public static bool menuBGChangedDay = false;
1929
1930 public static bool menuBGChangedNight = false;
1931
1932 public static bool lockMenuBGChange = false;
1933
1934 private static int maxLoadPlayer = 1000;
1935
1936 private static int maxLoadWorld = 1000;
1937
1939
1941
1942 public static Player PendingPlayer = null;
1943
1945
1947
1948 public static string WorldPath = Path.Combine(SavePath, "Worlds");
1949
1950 public static string CloudWorldPath = "worlds";
1951
1952 public static string PlayerPath = Path.Combine(SavePath, "Players");
1953
1954 public static string CloudPlayerPath = "players";
1955
1956 public static Preferences Configuration = new Preferences(SavePath + Path.DirectorySeparatorChar + "config.json");
1957
1958 public static Preferences InputProfiles = new Preferences(SavePath + Path.DirectorySeparatorChar + "input profiles.json");
1959
1961
1963
1964 public static int PendingResolutionWidth = 800;
1965
1966 public static int PendingResolutionHeight = 600;
1967
1968 public static bool PendingBorderlessState;
1969
1970 public static int invasionType;
1971
1972 public static double invasionX;
1973
1974 public static int invasionSize;
1975
1976 public static int invasionDelay;
1977
1978 public static int invasionWarn;
1979
1980 public static int invasionSizeStart;
1981
1983
1984 public static int invasionProgressMode = 2;
1985
1986 public static int invasionProgressIcon;
1987
1988 public static int invasionProgress;
1989
1990 public static int invasionProgressMax;
1991
1992 public static int invasionProgressWave;
1993
1995
1996 public static float invasionProgressAlpha;
1997
1998 public static bool HasInteractibleObjectThatIsNotATile = false;
1999
2001
2002 public static int[] npcFrameCount = new int[688]
2003 {
2004 1, 2, 2, 3, 6, 2, 2, 1, 1, 1,
2005 1, 1, 1, 1, 1, 1, 2, 25, 23, 25,
2006 21, 15, 26, 2, 10, 1, 16, 16, 16, 3,
2007 1, 15, 3, 1, 3, 1, 1, 21, 25, 1,
2008 1, 1, 3, 3, 15, 3, 7, 7, 6, 5,
2009 6, 5, 3, 3, 23, 6, 3, 6, 6, 2,
2010 5, 6, 5, 7, 7, 4, 5, 8, 1, 5,
2011 1, 2, 4, 16, 5, 4, 4, 15, 16, 16,
2012 16, 2, 4, 6, 6, 18, 16, 1, 1, 1,
2013 1, 1, 1, 4, 3, 1, 1, 1, 1, 1,
2014 1, 5, 6, 7, 16, 1, 1, 25, 23, 12,
2015 20, 21, 1, 2, 2, 3, 6, 1, 1, 1,
2016 15, 4, 11, 1, 23, 6, 6, 6, 1, 2,
2017 2, 1, 3, 4, 1, 2, 1, 4, 2, 1,
2018 15, 3, 25, 4, 5, 7, 3, 2, 12, 12,
2019 4, 4, 4, 8, 8, 13, 5, 6, 4, 15,
2020 23, 3, 15, 8, 5, 4, 13, 15, 12, 4,
2021 14, 14, 3, 2, 5, 3, 2, 3, 23, 5,
2022 14, 16, 5, 2, 2, 12, 3, 3, 3, 3,
2023 2, 2, 2, 2, 2, 7, 14, 15, 16, 8,
2024 3, 15, 15, 16, 2, 3, 20, 25, 23, 26,
2025 4, 4, 16, 16, 20, 20, 20, 2, 2, 2,
2026 2, 8, 12, 3, 4, 2, 4, 25, 26, 26,
2027 6, 3, 3, 3, 3, 3, 5, 4, 4, 5,
2028 4, 6, 7, 15, 4, 7, 6, 1, 1, 2,
2029 4, 3, 5, 3, 3, 3, 4, 5, 6, 4,
2030 2, 1, 8, 4, 4, 1, 8, 1, 4, 15,
2031 15, 15, 15, 15, 15, 16, 15, 15, 15, 15,
2032 15, 3, 3, 3, 3, 3, 3, 16, 3, 6,
2033 12, 21, 21, 20, 16, 15, 15, 5, 5, 6,
2034 6, 5, 2, 7, 2, 6, 6, 6, 6, 6,
2035 15, 15, 15, 15, 15, 11, 4, 2, 2, 3,
2036 3, 3, 16, 15, 16, 10, 14, 12, 1, 10,
2037 8, 3, 3, 2, 2, 2, 2, 7, 15, 15,
2038 15, 6, 3, 10, 10, 6, 9, 8, 9, 8,
2039 20, 10, 6, 23, 1, 4, 24, 2, 4, 6,
2040 6, 13, 15, 15, 15, 15, 4, 4, 26, 23,
2041 8, 2, 4, 4, 4, 4, 2, 2, 4, 12,
2042 12, 9, 9, 9, 1, 9, 11, 2, 2, 9,
2043 5, 6, 4, 18, 8, 11, 1, 4, 5, 8,
2044 4, 1, 1, 1, 1, 4, 2, 5, 4, 11,
2045 5, 11, 1, 1, 1, 10, 10, 15, 8, 17,
2046 6, 6, 1, 12, 12, 13, 15, 9, 5, 10,
2047 7, 7, 7, 7, 7, 7, 7, 4, 4, 16,
2048 16, 25, 5, 7, 3, 13, 2, 6, 2, 19,
2049 19, 19, 20, 26, 3, 1, 1, 1, 1, 1,
2050 16, 21, 9, 16, 7, 6, 18, 13, 20, 12,
2051 12, 20, 6, 14, 14, 14, 14, 6, 1, 3,
2052 25, 19, 20, 22, 2, 4, 4, 4, 11, 9,
2053 8, 1, 9, 1, 8, 8, 12, 12, 11, 11,
2054 11, 11, 11, 11, 11, 11, 11, 1, 6, 9,
2055 1, 1, 1, 1, 1, 1, 4, 1, 10, 1,
2056 8, 4, 1, 5, 8, 8, 8, 8, 9, 9,
2057 5, 4, 8, 16, 8, 2, 3, 3, 6, 6,
2058 7, 13, 4, 4, 4, 4, 1, 1, 1, 8,
2059 25, 11, 14, 14, 14, 17, 17, 17, 5, 5,
2060 5, 14, 14, 14, 9, 9, 9, 9, 17, 17,
2061 16, 16, 18, 18, 10, 10, 10, 10, 4, 1,
2062 6, 9, 6, 4, 4, 4, 14, 4, 25, 13,
2063 3, 7, 6, 6, 1, 4, 4, 4, 4, 4,
2064 4, 4, 15, 15, 8, 8, 2, 6, 15, 15,
2065 6, 13, 5, 5, 7, 5, 14, 14, 4, 6,
2066 21, 1, 1, 1, 11, 12, 6, 6, 17, 6,
2067 16, 21, 16, 23, 5, 16, 2, 28, 28, 6,
2068 6, 6, 6, 6, 6, 6, 7, 7, 7, 7,
2069 7, 7, 7, 3, 4, 6, 27, 16, 2, 2,
2070 4, 3, 4, 23, 6, 1, 1, 2, 8, 8,
2071 14, 6, 6, 6, 6, 6, 2, 4, 14, 14,
2072 14, 14, 14, 14, 14, 1, 1, 13
2073 };
2074
2076
2077 public static bool mouseExit;
2078
2079 public static float exitScale = 0.8f;
2080
2081 public static bool mouseReforge;
2082
2083 public static float reforgeScale = 0.8f;
2084
2085 public static Player clientPlayer = new Player();
2086
2087 public static string getIP = defaultIP;
2088
2089 public static string getPort = Convert.ToString(Netplay.ListenPort);
2090
2091 public static bool menuMultiplayer;
2092
2093 public static bool menuServer;
2094
2095 public static int netMode;
2096
2097 private static int _targetNetMode;
2098
2099 private static bool _hasPendingNetmodeChange;
2100
2101 public const int MaxTimeout = 120;
2102
2103 public static int netPlayCounter;
2104
2105 public static int lastNPCUpdate;
2106
2107 public static int lastItemUpdate;
2108
2109 public static int maxNPCUpdates = 5;
2110
2111 public static int maxItemUpdates = 5;
2112
2113 public static string cUp = "W";
2114
2115 public static string cLeft = "A";
2116
2117 public static string cDown = "S";
2118
2119 public static string cRight = "D";
2120
2121 public static string cJump = "Space";
2122
2123 public static string cThrowItem = "T";
2124
2125 public static string cHeal = "H";
2126
2127 public static string cMana = "J";
2128
2129 public static string cBuff = "B";
2130
2131 public static string cHook = "E";
2132
2133 public static string cTorch = "LeftShift";
2134
2135 public static string cInv = "Escape";
2136
2137 public static string cSmart = "LeftControl";
2138
2139 public static string cMount = "R";
2140
2141 public static string cFavoriteKey = "LeftAlt";
2142
2143 public static bool cSmartCursorModeIsToggleAndNotHold = true;
2144
2145 public static bool SmartCursorWanted_Mouse = false;
2146
2147 public static bool SmartCursorWanted_GamePad = false;
2148
2149 public static bool SmartCursorShowing = false;
2150
2151 public static int SmartCursorX;
2152
2153 public static int SmartCursorY;
2154
2156
2157 public static bool SmartInteractShowingFake;
2158
2159 public static int SmartInteractX;
2160
2161 public static int SmartInteractY;
2162
2163 public static int SmartInteractNPC;
2164
2165 public static int SmartInteractProj;
2166
2168
2170
2172
2173 public static int TileInteractionLX = -1;
2174
2175 public static int TileInteractionLY = -1;
2176
2177 public static int TileInteractionHX = -1;
2178
2179 public static int TileInteractionHY = -1;
2180
2181 public static int cursorOverride = -1;
2182
2183 public static int signHover = -1;
2184
2185 public static string cMapZoomIn = "Add";
2186
2187 public static string cMapZoomOut = "Subtract";
2188
2189 public static string cMapAlphaUp = "PageUp";
2190
2191 public static string cMapAlphaDown = "PageDown";
2192
2193 public static string cMapFull = "M";
2194
2195 public static string cMapStyle = "Tab";
2196
2197 public static Microsoft.Xna.Framework.Input.Keys FavoriteKey = Microsoft.Xna.Framework.Input.Keys.LeftAlt;
2198
2200
2202
2204
2206
2207 public static int cursorColorDirection = 1;
2208
2209 public static float cursorAlpha;
2210
2211 public static float cursorScale;
2212
2213 public static bool signBubble;
2214
2215 public static int signX = 0;
2216
2217 public static int signY = 0;
2218
2219 public static bool hideUI;
2220
2221 public static bool releaseUI;
2222
2224
2225 public static bool terrariasFixedTiming = true;
2226
2227 private int splashCounter;
2228
2230
2232
2234
2236
2238
2240
2242
2244
2246
2248
2250
2252
2254
2256
2258
2260
2262
2263 private static bool shouldSetDefaultUIScale = true;
2264
2265 private static float newDefaultUIScale = 0f;
2266
2268
2270
2271 public static bool startFullscreen = false;
2272
2273 public static string oldStatusText = "";
2274
2275 public static string autoGenFileLocation = null;
2276
2277 public static bool autoShutdown;
2278
2280
2281 public static bool fastForwardTimeToDawn;
2282
2283 public static int sundialCooldown;
2284
2285 public static bool fastForwardTimeToDusk;
2286
2287 public static int moondialCooldown;
2288
2289 private static Stopwatch splashTimer = new Stopwatch();
2290
2292
2293 private JArray _lastLoadedPacks;
2294
2295 public static bool PreventUpdatingTargets = true;
2296
2298
2299 public static bool _shouldUseWindyDayMusic = false;
2300
2301 public static bool _shouldUseStormMusic = false;
2302
2303 private int lastMusicPlayed = -1;
2304
2305 private bool playOldTile;
2306
2307 private static float _minWind = 0.34f;
2308
2309 private static float _maxWind = 0.4f;
2310
2311 private static float _minRain = 0.4f;
2312
2313 private static float _maxRain = 0.5f;
2314
2315 public static float ambientWaterfallX = -1f;
2316
2317 public static float ambientWaterfallY = -1f;
2318
2319 public static float ambientWaterfallStrength = 0f;
2320
2321 public static float ambientLavafallX = -1f;
2322
2323 public static float ambientLavafallY = -1f;
2324
2325 public static float ambientLavafallStrength = 0f;
2326
2327 public static float ambientLavaX = -1f;
2328
2329 public static float ambientLavaY = -1f;
2330
2331 public static float ambientLavaStrength;
2332
2333 public static int ambientCounter;
2334
2335 private static bool _isWaterfallMusicPlaying = false;
2336
2337 private static bool _isLavafallMusicPlaying = false;
2338
2340
2341 public static int ProjectileUpdateLoopIndex = -1;
2342
2344
2346
2348
2350
2351 public static int weatherVaneBobframe = 0;
2352
2353 private float logoRotation;
2354
2355 private float logoRotationDirection = -1f;
2356
2357 private float logoRotationSpeed = 1f;
2358
2359 private float logoScale = 1f;
2360
2361 private float logoScaleDirection = 1f;
2362
2363 private float logoScaleSpeed = 1f;
2364
2365 private static int maxMenuItems = 16;
2366
2367 private float[] menuItemScale = new float[maxMenuItems];
2368
2369 private int focusMenu = -1;
2370
2371 private int selectedMenu = -1;
2372
2373 private int selectedMenu2 = -1;
2374
2375 public static int selectedPlayer = 0;
2376
2377 public static int selectedWorld;
2378
2379 public static int menuMode;
2380
2381 public static int menuSkip;
2382
2383 private static bool _needsLanguageSelect = true;
2384
2385 private static Item tooltipPrefixComparisonItem = new Item();
2386
2388
2390
2392
2393 public static string newWorldName = "";
2394
2395 private static Vector3 shimmerShine = new Vector3(1f, 0.5f, 1f);
2396
2397 private static int[] specX = new int[1000];
2398
2399 private static int[] specY = new int[1000];
2400
2402
2404
2406
2408
2410
2412
2414
2416
2418
2419 private static BlendState _multiplyBlendState = null;
2420
2422
2424
2426
2428
2430
2431 private bool _imeToggle;
2432
2433 private static int _lastHoveredLoadoutIndex = -1;
2434
2436
2438
2440
2442
2443 private static int _currentRecipeBeingCrafted = -1;
2444
2445 private static bool hidePVPIcons = false;
2446
2447 public static bool HoveringOverAnNPC;
2448
2449 public static string hoverItemName = "";
2450
2452
2453 public static bool mouseText;
2454
2455 private static int mH;
2456
2457 private static int rare;
2458
2459 public static int hairStart;
2460
2461 private static int oldHairStyle;
2462
2464
2465 public static int selClothes;
2466
2468
2469 private static int oldClothesStyle;
2470
2471 public static int interactedDresserTopLeftX;
2472
2473 public static int interactedDresserTopLeftY;
2474
2476
2478
2480
2482
2484
2486
2487 private static bool _MouseOversCanClear;
2488
2490
2492
2493 private static int _itemIconCacheTime;
2494
2495 private static bool _cannotDrawAccessoriesHorizontally = false;
2496
2498
2499 public static int focusColor;
2500
2501 public static int colorDelay;
2502
2503 public static int setKey = -1;
2504
2505 public static int bgScroll;
2506
2507 public static bool autoPass;
2508
2509 public static int menuFocus = 0;
2510
2511 public static float hBar = -1f;
2512
2513 public static float sBar = -1f;
2514
2515 public static float lBar = 1f;
2516
2517 public static float aBar = 1f;
2518
2519 private int grabColorSlider;
2520
2521 public static bool blockMouse;
2522
2523 private static bool _blockFancyUIWhileLoading;
2524
2525 private bool[] menuWide = new bool[100];
2526
2527 public static float GamepadCursorAlpha = 0f;
2528
2530
2531 public static float MenuXMovement = 0f;
2532
2534
2535 private float _splashFrameCount;
2536
2537 private bool quickSplash;
2538
2539 private float hellBlackBoxBottom;
2540
2541 public static float InitialMapScale = 1f;
2542
2543 public static float MapScale = 1f;
2544
2546
2548
2549 public static bool cancelWormHole = false;
2550
2552
2554
2555 public static float lightning;
2556
2557 private static float lightningDecay = 1f;
2558
2559 private static float lightningSpeed = 0f;
2560
2561 private static int thunderDelay;
2562
2563 public static int thunderDistance;
2564
2565 private static string[] MonolithFilterNames = new string[5] { "MonolithVortex", "MonolithNebula", "MonolithStardust", "MonolithSolar", "MonolithMoonLord" };
2566
2567 private static string[] MonolithSkyNames = new string[5] { "MonolithVortex", "MonolithNebula", "MonolithStardust", "MonolithSolar", "MonolithMoonLord" };
2568
2569 private static float backgroundLayerTransitionSpeed = 0.05f;
2570
2571 public static float atmo;
2572
2573 private static float bgScale = 1f;
2574
2575 private static int bgWidthScaled = (int)(1024f * bgScale);
2576
2578
2580
2582
2583 private float screenOff;
2584
2585 private float scAdj;
2586
2587 private float cTop;
2588
2590
2592
2593 private static bool _cameraPanHasBlackTransition = false;
2594
2595 public CameraModifierStack CameraModifiers = new CameraModifierStack();
2596
2597 public static bool starGame = false;
2598
2599 public static int starsHit = 0;
2600
2601 private static string _oldNetplayStatusText;
2602
2604
2605 public static int ladyBugRainBoost = 0;
2606
2607 private static bool _canShowMeteorFall;
2608
2609 private static bool _isResizingAndRemakingTargets = false;
2610
2611 public static bool CanUpdateGameplay { get; private set; }
2612
2613 public static Vector2 ViewPosition => screenPosition + GameViewMatrix.Translation;
2614
2616
2618
2620
2621 public static float UIScaleWanted => _uiScaleWanted;
2622
2623 public static float UIScale
2624 {
2625 get
2626 {
2627 return _uiScaleUsed;
2628 }
2629 set
2630 {
2632 float uIScaleMax = instance.UIScaleMax;
2633 if (value > uIScaleMax)
2634 {
2635 value = uIScaleMax;
2636 }
2639 }
2640 }
2641
2642 public float UIScaleMax
2643 {
2644 get
2645 {
2647 float val2 = Math.Min(val2: (float)PlayerInput.RealScreenHeight / 600f, val1: (float)realScreenWidth / 800f);
2648 return Math.Max(1f, val2);
2649 }
2650 }
2651
2652 public static bool RenderTargetsRequired
2653 {
2654 get
2655 {
2656 if (!(GameZoomTarget > 1f))
2657 {
2658 return GameViewMatrix.TransformationMatrix.M11 > 1f;
2659 }
2660 return true;
2661 }
2662 }
2663
2664 public static bool IsItRaining => cloudAlpha > 0f;
2665
2667
2669 {
2670 get
2671 {
2673 {
2675 }
2676 return false;
2677 }
2678 }
2679
2680 public static string SavePath => Program.SavePath;
2681
2683
2684 public static int GameMode
2685 {
2686 get
2687 {
2688 if (ActiveWorldFileData == null)
2689 {
2690 return 0;
2691 }
2692 return ActiveWorldFileData.GameMode;
2693 }
2694 set
2695 {
2696 if (ActiveWorldFileData != null && RegisteredGameModes.TryGetValue(value, out var value2))
2697 {
2698 ActiveWorldFileData.GameMode = value;
2700 }
2701 }
2702 }
2703
2704 public static bool specialSeedWorld
2705 {
2706 get
2707 {
2709 {
2710 return zenithWorld;
2711 }
2712 return true;
2713 }
2714 }
2715
2716 public static bool masterMode
2717 {
2718 get
2719 {
2720 if (ActiveWorldFileData == null)
2721 {
2722 return false;
2723 }
2724 if (_overrideForMasterMode.HasValue)
2725 {
2726 return _overrideForMasterMode.Value;
2727 }
2728 if (getGoodWorld && _currentGameModeInfo.IsExpertMode)
2729 {
2730 return true;
2731 }
2732 return _currentGameModeInfo.IsMasterMode;
2733 }
2734 }
2735
2736 public static bool expertMode
2737 {
2738 get
2739 {
2740 if (ActiveWorldFileData == null)
2741 {
2742 return false;
2743 }
2744 if (_overrideForExpertMode.HasValue)
2745 {
2746 return _overrideForExpertMode.Value;
2747 }
2748 if (getGoodWorld)
2749 {
2750 return true;
2751 }
2752 return _currentGameModeInfo.IsExpertMode;
2753 }
2754 }
2755
2756 public static AchievementManager Achievements => instance._achievements;
2757
2758 public static AchievementAdvisor AchievementAdvisor => instance._achievementAdvisor;
2759
2760 public static ulong UnpausedUpdateSeed { get; private set; }
2761
2762 public static Effect screenShader => ScreenShaderRef.Value;
2763
2764 public static Effect pixelShader => PixelShaderRef.Value;
2765
2767
2768 public static Effect tileShader => TileShaderRef.Value;
2769
2770 [Old("Transform is deprecated. Please use GameViewMatrix & GUIViewMatrix")]
2771 public static Matrix Transform => GameViewMatrix.TransformationMatrix;
2772
2773 public static Vector2 MouseScreen => new Vector2(mouseX, mouseY);
2774
2775 public static Vector2 MouseWorld
2776 {
2777 get
2778 {
2780 if (player[myPlayer].gravDir == -1f)
2781 {
2782 result.Y = screenPosition.Y + (float)screenHeight - (float)mouseY;
2783 }
2784 return result;
2785 }
2786 }
2787
2810
2811 public static uint GameUpdateCount => _gameUpdateCount;
2812
2814 {
2815 get
2816 {
2817 if (!drawToScreen)
2818 {
2819 return SamplerState.PointClamp;
2820 }
2822 }
2823 }
2824
2825 public static int UnderworldLayer => maxTilesY - 200;
2826
2827 public static float WindForVisuals => windSpeedCurrent;
2828
2830
2832
2833 public static int npcShop { get; private set; }
2834
2835 public static string playerPathName => ActivePlayerFileData.Path;
2836
2837 public static string worldPathName => ActiveWorldFileData.Path;
2838
2839 public static bool SmartCursorWanted
2840 {
2841 get
2842 {
2844 {
2846 }
2848 {
2850 }
2852 }
2853 }
2854
2856
2857 public static bool HasSmartInteractTarget
2858 {
2859 get
2860 {
2861 if (SmartInteractNPC == -1 && (SmartInteractX == -1 || SmartInteractY == -1))
2862 {
2863 return SmartInteractProj != -1;
2864 }
2865 return true;
2866 }
2867 }
2868
2870
2871 public static bool IsItStorming => _shouldUseStormMusic;
2872
2874
2875 public static bool ShouldPVPDraw => netMode == 1;
2876
2878 {
2879 get
2880 {
2881 if (player[myPlayer].CanDemonHeartAccessoryBeShown())
2882 {
2883 return 610 + PlayerInput.SettingsForUI.PushEquipmentAreaUp.ToInt() * 30;
2884 }
2885 return 600;
2886 }
2887 }
2888
2890 {
2891 get
2892 {
2894 {
2895 return false;
2896 }
2897 if (mapStyle == 1 && mapEnabled && screenHeight < 820)
2898 {
2899 return false;
2900 }
2901 if (mapStyle != 1 && screenWidth < 855)
2902 {
2903 return false;
2904 }
2906 {
2907 return false;
2908 }
2909 return true;
2910 }
2911 }
2912
2913 public static bool CanShowInfoAccs
2914 {
2915 get
2916 {
2917 if (npcChatText == null || npcChatText == "" || player[myPlayer].chest > -1)
2918 {
2919 return player[myPlayer].sign < 0;
2920 }
2921 return false;
2922 }
2923 }
2924
2926
2927 public static bool IsGraphicsDeviceAvailable
2928 {
2929 get
2930 {
2931 if (!instance.GraphicsDevice.IsDisposed)
2932 {
2933 return instance.GraphicsDevice.GraphicsDeviceStatus == GraphicsDeviceStatus.Normal;
2934 }
2935 return false;
2936 }
2937 }
2938
2939 public static event Action OnEnginePreload;
2940
2942
2943 public static event Action OnEngineLoad;
2944
2945 public static event Action OnTickForThirdPartySoftwareOnly;
2946
2947 public static event Action OnTickForInternalCodeOnly;
2948
2949 public static event Action<GameTime> OnPreDraw;
2950
2951 public static event Action<GameTime> OnPostDraw;
2952
2954
2955 public static event Action OnRenderTargetsReleased;
2956
2958
2959 public static void ToggleGameplayUpdates(bool state)
2960 {
2962 }
2963
2964 public static void SetRecommendedZoomContext(Matrix matrix)
2965 {
2966 _currentWantedZoomMatrix = matrix;
2967 }
2968
2969 public static void FindAnnouncementBoxStatus()
2970 {
2971 AnnouncementBoxDisabled = Program.LaunchParameters.ContainsKey("-disableannouncementbox");
2972 if (Program.LaunchParameters.TryGetValue("-announcementboxrange", out var value) && int.TryParse(value, out var result))
2973 {
2974 AnnouncementBoxRange = result;
2975 }
2976 }
2977
2978 public static bool CanPlayCreditsRoll()
2979 {
2980 if (!gameMenu && LocalPlayer.hasCreditsSceneMusicBox)
2981 {
2982 return true;
2983 }
2984 if (gameMenu && menuMode == 3000)
2985 {
2986 return true;
2987 }
2989 }
2990
2991 public static void SetCameraLerp(float lerp, int time)
2992 {
2993 cameraLerp = lerp;
2994 cameraLerpTimer = 0;
2996 cameraGamePadLerp = false;
2997 }
2998
2999 public static void SetCameraGamepadLerp(float lerp)
3000 {
3001 _ = cameraLerp;
3002 _ = 0f;
3003 }
3004
3005 public static Vector2 ReverseGravitySupport(Vector2 pos, float height = 0f)
3006 {
3007 if (player[myPlayer].gravDir != -1f)
3008 {
3009 return pos;
3010 }
3011 pos.Y = (float)screenHeight - pos.Y - height;
3012 return pos;
3013 }
3014
3016 {
3017 if (player[myPlayer].gravDir != -1f)
3018 {
3019 return pos;
3020 }
3021 pos.Y = screenHeight - pos.Y - height;
3022 return pos;
3023 }
3024
3026 {
3027 if (player[myPlayer].gravDir != -1f)
3028 {
3029 return box;
3030 }
3031 box.Y = screenHeight - box.Y - box.Height;
3032 return box;
3033 }
3034
3035 public void SetMouseNPC(int index, int type)
3036 {
3039 }
3040
3042 {
3043 SetMouseNPC(-1, 0);
3044 }
3045
3046 [DllImport("User32")]
3047 private static extern int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags);
3048
3049 [DllImport("User32")]
3050 private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert);
3051
3052 [DllImport("User32")]
3053 private static extern int GetMenuItemCount(IntPtr hWnd);
3054
3055 [DllImport("kernel32.dll")]
3056 public static extern IntPtr LoadLibrary(string dllToLoad);
3057
3058 public static MoonPhase GetMoonPhase()
3059 {
3060 return (MoonPhase)moonPhase;
3061 }
3062
3063 public static Vector2 DrawPlayerItemPos(float gravdir, int itemtype)
3064 {
3065 float num = 10f;
3067 Vector2 result = r.Size() / 2f;
3068 switch (itemtype)
3069 {
3070 case 95:
3071 num = 6f;
3072 result.Y += 2f * gravdir;
3073 break;
3074 case 1295:
3075 num = 4f;
3076 break;
3077 case 3611:
3078 num = 2f;
3079 break;
3080 case 3350:
3081 num = 2f;
3082 break;
3083 case 2624:
3084 num = 4f;
3085 break;
3086 case 3018:
3087 num = 2f;
3088 break;
3089 case 3007:
3090 num = 4f;
3091 result.Y -= 1f * gravdir;
3092 break;
3093 case 3107:
3094 num = 4f;
3095 result.Y += 2f * gravdir;
3096 break;
3097 case 3008:
3098 num = -7f;
3099 result.Y += 2f * gravdir;
3100 break;
3101 case 1255:
3102 num = 6f;
3103 result.Y += 0f * gravdir;
3104 break;
3105 case 2269:
3106 num = 2f;
3107 result.Y += 2f * gravdir;
3108 break;
3109 case 1265:
3110 num = -8f;
3111 result.Y += 4f * gravdir;
3112 break;
3113 case 2272:
3114 num = 0f;
3115 result.Y += 4f * gravdir;
3116 break;
3117 case 3029:
3118 num = 4f;
3119 break;
3120 case 4381:
3121 num = 4f;
3122 break;
3123 case 2796:
3124 num = -28f;
3125 result.Y += 2f * gravdir;
3126 break;
3127 case 2797:
3128 num = 0f;
3129 break;
3130 case 2610:
3131 num = 0f;
3132 break;
3133 case 2623:
3134 num = -30f;
3135 result.Y -= 4f * gravdir;
3136 break;
3137 case 3546:
3138 num = -14f;
3139 result.Y -= 6f * gravdir;
3140 break;
3141 case 1835:
3142 num = -2f;
3143 result.Y += 2f * gravdir;
3144 break;
3145 default:
3146 switch (itemtype)
3147 {
3148 case 2624:
3149 num = -4f;
3150 break;
3151 case 3859:
3152 num = -2f;
3153 break;
3154 case 2888:
3155 num = 6f;
3156 break;
3157 case 2223:
3158 num = 2f;
3159 result.Y -= 2f * gravdir;
3160 break;
3161 case 1782:
3162 num = 0f;
3163 result.Y += 4f * gravdir;
3164 break;
3165 case 1929:
3166 num = 0f;
3167 result.Y += 2f * gravdir;
3168 break;
3169 case 2270:
3170 num = -4f;
3171 break;
3172 case 1784:
3173 num = 0f;
3174 result.Y += 4f * gravdir;
3175 break;
3176 case 1000:
3177 num = 6f;
3178 result.Y += 0f * gravdir;
3179 break;
3180 case 1178:
3181 num = 4f;
3182 result.Y += 0f * gravdir;
3183 break;
3184 case 1319:
3185 num = 0f;
3186 result.Y += 0f * gravdir;
3187 break;
3188 case 1297:
3189 num = -8f;
3190 result.Y += 0f * gravdir;
3191 break;
3192 case 1121:
3193 num = 6f;
3194 result.Y -= 2f * gravdir;
3195 break;
3196 case 1314:
3197 num = 2f;
3198 break;
3199 case 1258:
3200 num = 2f;
3201 result.Y -= 2f * gravdir;
3202 break;
3203 case 1155:
3204 num = -10f;
3205 result.Y -= 2f * gravdir;
3206 break;
3207 case 1156:
3208 num = -2f;
3209 break;
3210 case 4703:
3211 num = -3f;
3212 result.Y -= 2f * gravdir;
3213 break;
3214 case 5117:
3215 num = -1f;
3216 break;
3217 case 96:
3218 num = -8f;
3219 result.Y += 2f * gravdir;
3220 break;
3221 case 1870:
3222 num = -8f;
3223 result.Y += 2f * gravdir;
3224 break;
3225 case 1260:
3226 num = -8f;
3227 result.Y += 2f * gravdir;
3228 break;
3229 case 1254:
3230 num = -6f;
3231 result.Y += 2f * gravdir;
3232 break;
3233 case 98:
3234 num = -5f;
3235 result.Y -= 2f * gravdir;
3236 break;
3237 case 534:
3238 num = -2f;
3239 result.Y += 1f * gravdir;
3240 break;
3241 case 679:
3242 num = 0f;
3243 result.Y += 2f * gravdir;
3244 break;
3245 case 964:
3246 num = 0f;
3247 result.Y += 0f * gravdir;
3248 break;
3249 case 533:
3250 num = -7f;
3251 result.Y -= 2f * gravdir;
3252 break;
3253 case 1553:
3254 num = -10f;
3255 result.Y -= 2f * gravdir;
3256 break;
3257 case 506:
3258 num = 0f;
3259 result.Y -= 2f * gravdir;
3260 break;
3261 case 1910:
3262 num = 0f;
3263 result.Y -= 2f * gravdir;
3264 break;
3265 case 494:
3266 case 508:
3267 num = -2f;
3268 break;
3269 case 434:
3270 num = 0f;
3271 result.Y -= 2f * gravdir;
3272 break;
3273 case 514:
3274 num = 0f;
3275 result.Y += 3f * gravdir;
3276 break;
3277 case 435:
3278 case 436:
3279 case 481:
3280 case 578:
3281 case 1187:
3282 case 1194:
3283 case 1201:
3284 case 1229:
3285 num = -2f;
3286 result.Y -= 2f * gravdir;
3287 break;
3288 case 197:
3289 num = -5f;
3290 result.Y += 4f * gravdir;
3291 break;
3292 case 4060:
3293 num = -2f;
3294 result.Y += 4f * gravdir;
3295 break;
3296 case 126:
3297 num = 4f;
3298 result.Y += 4f * gravdir;
3299 break;
3300 case 800:
3301 num = 4f;
3302 result.Y += 2f * gravdir;
3303 break;
3304 case 127:
3305 num = 4f;
3306 result.Y += 2f * gravdir;
3307 break;
3308 case 157:
3309 num = 6f;
3310 result.Y += 2f * gravdir;
3311 break;
3312 case 160:
3313 num = -8f;
3314 break;
3315 case 164:
3316 case 219:
3317 num = 0f;
3318 result.Y += 2f * gravdir;
3319 break;
3320 case 165:
3321 case 272:
3322 num = 4f;
3323 result.Y += 4f * gravdir;
3324 break;
3325 case 3870:
3326 num = 4f;
3327 result.Y += 4f * gravdir;
3328 break;
3329 case 266:
3330 num = 0f;
3331 result.Y += 2f * gravdir;
3332 break;
3333 case 281:
3334 num = 6f;
3335 result.Y -= 6f * gravdir;
3336 break;
3337 case 986:
3338 num = 6f;
3339 result.Y -= 10f * gravdir;
3340 break;
3341 case 682:
3342 num = 4f;
3343 break;
3344 case 4953:
3345 num = -4f;
3346 break;
3347 case 758:
3348 num -= 20f;
3349 result.Y += 0f * gravdir;
3350 break;
3351 case 759:
3352 num -= 18f;
3353 result.Y += 2f * gravdir;
3354 break;
3355 case 760:
3356 num -= 12f;
3357 result.Y += 2f * gravdir;
3358 break;
3359 case 1946:
3360 num -= 12f;
3361 result.Y += 2f * gravdir;
3362 break;
3363 case 779:
3364 num = 0f;
3365 result.Y += 2f * gravdir;
3366 break;
3367 case 5134:
3368 num = 0f;
3369 result.Y += 2f * gravdir;
3370 break;
3371 case 905:
3372 num = -5f;
3373 result.Y += 0f * gravdir;
3374 break;
3375 case 930:
3376 num = 4f;
3377 result.Y += 2f * gravdir;
3378 break;
3379 case 3788:
3380 num = 2f;
3381 result.Y += 2f * gravdir;
3382 break;
3383 }
3384 break;
3385 }
3386 result.X = num;
3387 return result;
3388 }
3389
3390 public static void SetupTileMerge()
3391 {
3392 int count = TileID.Count;
3393 tileMerge = new bool[count][];
3394 for (int i = 0; i < tileMerge.Length; i++)
3395 {
3396 tileMerge[i] = new bool[count];
3397 }
3398 for (int j = 0; j < TileID.Count; j++)
3399 {
3400 bool flag = j == 10 || j == 387 || j == 541;
3402 }
3403 }
3404
3406 {
3407 if (!itemAnimationsRegistered.Contains(index))
3408 {
3410 }
3412 }
3413
3414 public static void InitializeItemAnimations()
3415 {
3416 for (int i = 0; i < itemAnimations.Length; i++)
3417 {
3418 itemAnimations[i] = null;
3419 }
3424 {
3425 PingPong = true
3426 });
3437 {
3438 NotActuallyAnimating = true
3439 });
3441 {
3442 NotActuallyAnimating = true
3443 });
3445 {
3446 NotActuallyAnimating = true
3447 });
3448 for (int j = 0; j < ItemID.Sets.IsFood.Length; j++)
3449 {
3450 if (ItemID.Sets.IsFood[j])
3451 {
3453 }
3454 }
3455 }
3456
3465
3466 private static void SetGraphicsProfileInternal()
3467 {
3469 graphics.GraphicsProfile = _selectedGraphicsProfile;
3471 {
3472 case GraphicsProfile.HiDef:
3473 maxScreenW = 4096;
3474 maxScreenH = 4096;
3475 _renderTargetMaxSize = 4096;
3477 break;
3478 case GraphicsProfile.Reach:
3479 maxScreenW = 1920;
3480 maxScreenH = 1200;
3481 _renderTargetMaxSize = 2048;
3482 break;
3483 }
3484 try
3485 {
3486 graphics.ApplyChanges();
3487 }
3489 {
3491 {
3494 }
3495 }
3496 instance.EnsureRenderTargetContent();
3497 }
3498
3499 private static void TrySupporting8K()
3500 {
3501 if (!Platform.IsWindows)
3502 {
3503 return;
3504 }
3505 instance.ReleaseTargets();
3506 Type type = Assembly.GetAssembly(typeof(GraphicsProfile)).GetType("Microsoft.Xna.Framework.Graphics.ProfileCapabilities", throwOnError: true);
3507 if (type != null)
3508 {
3509 FieldInfo field = type.GetField("MaxTextureSize", BindingFlags.Instance | BindingFlags.NonPublic);
3510 FieldInfo field2 = type.GetField("HiDef", BindingFlags.Static | BindingFlags.NonPublic);
3511 if (field != null && field2 != null)
3512 {
3513 field.SetValue(field2.GetValue(null), 8192);
3514 }
3515 }
3516 }
3517
3518 public static void AnglerQuestSwap()
3519 {
3520 if (netMode == 1)
3521 {
3522 return;
3523 }
3524 anglerWhoFinishedToday.Clear();
3525 anglerQuestFinished = false;
3526 bool flag = NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3 || hardMode || NPC.downedSlimeKing || NPC.downedQueenBee;
3527 bool flag2 = true;
3528 while (flag2)
3529 {
3530 flag2 = false;
3531 anglerQuest = rand.Next(anglerQuestItemNetIDs.Length);
3533 if (num == 2454 && (!hardMode || WorldGen.crimson))
3534 {
3535 flag2 = true;
3536 }
3537 if (num == 2457 && WorldGen.crimson)
3538 {
3539 flag2 = true;
3540 }
3541 if (num == 2462 && !hardMode)
3542 {
3543 flag2 = true;
3544 }
3545 if (num == 2463 && (!hardMode || !WorldGen.crimson))
3546 {
3547 flag2 = true;
3548 }
3549 if (num == 2465 && !hardMode)
3550 {
3551 flag2 = true;
3552 }
3553 if (num == 2468 && !hardMode)
3554 {
3555 flag2 = true;
3556 }
3557 if (num == 2471 && !hardMode)
3558 {
3559 flag2 = true;
3560 }
3561 if (num == 2473 && !hardMode)
3562 {
3563 flag2 = true;
3564 }
3565 if (num == 2477 && !WorldGen.crimson)
3566 {
3567 flag2 = true;
3568 }
3569 if (num == 2480 && !hardMode)
3570 {
3571 flag2 = true;
3572 }
3573 if (num == 2483 && !hardMode)
3574 {
3575 flag2 = true;
3576 }
3577 if (num == 2484 && !hardMode)
3578 {
3579 flag2 = true;
3580 }
3581 if (num == 2485 && WorldGen.crimson)
3582 {
3583 flag2 = true;
3584 }
3585 if ((num == 2476 || num == 2453 || num == 2473) && !flag)
3586 {
3587 flag2 = true;
3588 }
3589 }
3591 }
3592
3594 {
3597 }
3598
3600 {
3601 if (state == WorldPreparationState.ProcessingData)
3602 {
3604 }
3605 }
3606
3607 public static void UpdateWorldPreparationState()
3608 {
3609 if (netMode != 1)
3610 {
3612 return;
3613 }
3615 {
3617 }
3618 if (netMode == 1 && _worldPreparationState == WorldPreparationState.ProcessingData)
3619 {
3621 gameMenu = false;
3622 FixUIScale();
3625 }
3626 }
3627
3628 public static bool InSmartCursorHighlightArea(int x, int y, out bool actuallySelected)
3629 {
3631 if (hideUI)
3632 {
3633 return false;
3634 }
3636 {
3637 return SmartInteractTileCoords.Contains(new Microsoft.Xna.Framework.Point(x, y));
3638 }
3639 return false;
3640 }
3641
3642 public static void LoadWorlds()
3643 {
3644 WorldList.Clear();
3646 {
3647 return;
3648 }
3649 string[] files = Directory.GetFiles(WorldPath, "*.wld");
3650 int num = Math.Min(files.Length, maxLoadWorld);
3651 if (dedServ)
3652 {
3653 for (int i = 0; i < num; i++)
3654 {
3656 if (allMetadata != null)
3657 {
3659 }
3660 else
3661 {
3663 }
3664 }
3665 }
3666 else
3667 {
3668 for (int j = 0; j < num; j++)
3669 {
3671 if (allMetadata2 != null)
3672 {
3674 }
3675 else
3676 {
3678 }
3679 }
3680 }
3681 if (SocialAPI.Cloud != null)
3682 {
3683 foreach (string item in from path in SocialAPI.Cloud.GetFiles()
3684 where path.StartsWith(CloudWorldPath, StringComparison.CurrentCultureIgnoreCase) && path.EndsWith(".wld", StringComparison.CurrentCultureIgnoreCase)
3685 select path)
3686 {
3688 if (allMetadata3 != null)
3689 {
3691 }
3692 else
3693 {
3695 }
3696 }
3697 }
3699 }
3700
3701 private static int WorldListSortMethod(WorldFileData data1, WorldFileData data2)
3702 {
3703 if (data1 == null && data2 == null)
3704 {
3705 return 0;
3706 }
3707 if (data1 == null || data1.Name == null)
3708 {
3709 return 1;
3710 }
3711 if (data2 == null || data2.Name == null)
3712 {
3713 return -1;
3714 }
3715 return data1.Name.CompareTo(data2.Name);
3716 }
3717
3718 public static void LoadPlayers()
3719 {
3720 PlayerList.Clear();
3722 {
3723 return;
3724 }
3725 string[] files = Directory.GetFiles(PlayerPath, "*.plr");
3726 int num = Math.Min(maxLoadPlayer, files.Length);
3727 for (int i = 0; i < num; i++)
3728 {
3730 if (fileData != null)
3731 {
3732 PlayerList.Add(fileData);
3733 }
3734 }
3735 if (SocialAPI.Cloud != null)
3736 {
3737 foreach (string item in from path in SocialAPI.Cloud.GetFiles()
3738 where path.StartsWith(CloudPlayerPath, StringComparison.CurrentCultureIgnoreCase) && path.EndsWith(".plr", StringComparison.CurrentCultureIgnoreCase)
3739 select path)
3740 {
3742 if (fileData2 != null)
3743 {
3744 PlayerList.Add(fileData2);
3745 }
3746 }
3747 }
3749 }
3750
3751 private static int PlayerListSortMethod(PlayerFileData data1, PlayerFileData data2)
3752 {
3753 return data1.Name.CompareTo(data2.Name);
3754 }
3755
3756 protected void OpenRecent()
3757 {
3758 try
3759 {
3760 if (!File.Exists(SavePath + Path.DirectorySeparatorChar + "servers.dat"))
3761 {
3762 return;
3763 }
3764 using FileStream input = new FileStream(SavePath + Path.DirectorySeparatorChar + "servers.dat", FileMode.Open);
3766 binaryReader.ReadInt32();
3767 for (int i = 0; i < 10; i++)
3768 {
3769 recentWorld[i] = binaryReader.ReadString();
3770 recentIP[i] = binaryReader.ReadString();
3771 recentPort[i] = binaryReader.ReadInt32();
3772 }
3773 }
3774 catch
3775 {
3776 }
3777 }
3778
3779 public static void SaveRecent()
3780 {
3782 try
3783 {
3785 }
3786 catch
3787 {
3788 }
3789 try
3790 {
3791 using FileStream output = new FileStream(SavePath + Path.DirectorySeparatorChar + "servers.dat", FileMode.Create);
3793 binaryWriter.Write(279);
3794 for (int i = 0; i < 10; i++)
3795 {
3796 binaryWriter.Write(recentWorld[i]);
3797 binaryWriter.Write(recentIP[i]);
3798 binaryWriter.Write(recentPort[i]);
3799 }
3800 }
3801 catch
3802 {
3803 }
3804 }
3805
3806 public static bool SaveSettings()
3807 {
3808 Preferences configuration = Configuration;
3809 configuration.Clear();
3810 configuration.Put("ResetDefaultUIScale", false);
3811 configuration.Put("SmartCursorToggle", cSmartCursorModeIsToggleAndNotHold);
3812 configuration.Put("MapEnabled", mapEnabled);
3813 configuration.Put("InvasionBarMode", invasionProgressMode);
3814 configuration.Put("AutoSave", autoSave);
3815 configuration.Put("AutoPause", autoPause);
3816 configuration.Put("Language", Language.ActiveCulture.Name);
3817 configuration.Put("PlacementPreview", placementPreview);
3818 configuration.Put("GoreVisualsAllowed", ChildSafety.Disabled);
3819 configuration.Put("WorldRollbacksToKeep", WorldRollingBackupsCountToKeep);
3820 configuration.Put("TeamNameplateDistance", teamNamePlateDistance);
3821 configuration.Put("MultiplayerNPCSmoothingRange", multiplayerNPCSmoothingRange);
3822 configuration.Put("VolumeSound", soundVolume);
3823 configuration.Put("VolumeAmbient", ambientVolume);
3824 configuration.Put("VolumeMusic", musicVolume);
3825 configuration.Put("UnlockMusicSwap", TOWMusicUnlocked);
3826 configuration.Put("UseExperimentalFeatures", UseExperimentalFeatures);
3827 configuration.Put("KeyFavoriteModifier", cFavoriteKey);
3828 configuration.Put("Fullscreen", graphics.IsFullScreen);
3829 configuration.Put("WindowMaximized", screenMaximized);
3830 configuration.Put("WindowBorderless", screenBorderless);
3831 int num = graphics.PreferredBackBufferWidth;
3832 int num2 = graphics.PreferredBackBufferHeight;
3834 {
3835 if (LastLoadedResolution.X != 0)
3836 {
3837 num = LastLoadedResolution.X;
3838 }
3839 if (LastLoadedResolution.Y != 0)
3840 {
3842 }
3843 }
3844 configuration.Put("DisplayWidth", num);
3845 configuration.Put("DisplayHeight", num2);
3846 configuration.Put("GraphicsQuality", qaStyle);
3847 configuration.Put("BackgroundEnabled", BackgroundEnabled);
3848 configuration.Put("FrameSkipMode", FrameSkipMode);
3849 configuration.Put("LightingMode", Lighting.Mode);
3850 configuration.Put("BackgroundParallax", bgScroll);
3851 configuration.Put("ShowItemText", showItemText);
3852 configuration.Put("LastLaunchedVersion", 279);
3853 configuration.Put("ClientUUID", clientUUID);
3854 configuration.Put("UseSmartCursorForCommonBlocks", Player.SmartCursorSettings.SmartBlocksEnabled);
3855 configuration.Put("UseSmartAxeAfterSmartPickaxe", Player.SmartCursorSettings.SmartAxeAfterPickaxe);
3856 configuration.Put("SmartCursorHoldCanReleaseMidUse", Player.SmartCursorSettings.SmartCursorHoldCanReleaseMidUse);
3857 configuration.Put("DisableLeftShiftTrashCan", ItemSlot.Options.DisableLeftShiftTrashCan);
3858 configuration.Put("DisableQuickTrash", ItemSlot.Options.DisableQuickTrash);
3859 configuration.Put("HighlightNewItems", ItemSlot.Options.HighlightNewItems);
3860 configuration.Put("HidePasswords", HidePassword);
3861 configuration.Put("ReverseUpDownForArmorSetBonuses", ReversedUpDownArmorSetBonuses);
3862 configuration.Put("MouseShowBuildingGrid", MouseShowBuildingGrid);
3863 configuration.Put("AllowUnfocusedInputOnGamepad", AllowUnfocusedInputOnGamepad);
3864 configuration.Put("LockOnPriority", LockOnHelper.UseMode);
3865 configuration.Put("InvisibleCursorForGamepad", InvisibleCursorForGamepad);
3866 configuration.Put("GamepadDisableInstructionsDisplay", GamepadDisableInstructionsDisplay);
3867 configuration.Put("SettingsUnlock_WorldEvil", SettingsUnlock_WorldEvil);
3868 configuration.Put("SettingsEnabled_MinersWobble", SettingsEnabled_MinersWobble);
3869 configuration.Put("SettingBlockGamepadsEntirely", SettingBlockGamepadsEntirely);
3870 configuration.Put("SettingsEnabled_OpaqueBoxBehindTooltips", SettingsEnabled_OpaqueBoxBehindTooltips);
3871 configuration.Put("SettingDontScaleMainMenuUp", SettingDontScaleMainMenuUp);
3872 configuration.Put("SettingsEnabled_TilesSwayInWind", SettingsEnabled_TilesSwayInWind);
3873 configuration.Put("SettingsEnabled_AutoReuseAllItems", SettingsEnabled_AutoReuseAllItems);
3874 configuration.Put("UseStormEffect", UseStormEffects);
3875 configuration.Put("UseHeatDistortion", UseHeatDistortion);
3876 configuration.Put("WaveQuality", WaveQuality);
3877 configuration.Put("Support4K", Support4K);
3878 configuration.Put("MouseColor", new Dictionary<string, byte>
3879 {
3880 { "R", mouseColor.R },
3881 { "G", mouseColor.G },
3882 { "B", mouseColor.B }
3883 });
3884 configuration.Put("MouseBorderColor", new Dictionary<string, byte>
3885 {
3886 { "R", MouseBorderColor.R },
3887 { "G", MouseBorderColor.G },
3888 { "B", MouseBorderColor.B },
3889 { "A", MouseBorderColor.A }
3890 });
3891 configuration.Put("QuickLaunch", SkipAssemblyLoad);
3892 configuration.Put("Zoom", GameZoomTarget);
3893 configuration.Put("UIScale", _uiScaleWanted);
3894 configuration.Put("MapScale", MapScale);
3895 configuration.Put("FlashIconForEvents", Enum.GetName(typeof(GameNotificationType), _flashNotificationType));
3896 configuration.Put("Display", _windowMover.ScreenDeviceName);
3897 configuration.Put("DisplayScreen", _windowMover.ScreenDeviceName);
3898 configuration.Put("ThrottleWhenInactive", instance.InactiveSleepTime != TimeSpan.Zero);
3899 configuration.Put("DoorAutoOpeningMode", DoorOpeningHelper.PreferenceSettings);
3900 configuration.Put("HoverControlMode", Player.Settings.HoverControl);
3901 configuration.Put("WaterfallDrawLimit", instance.waterfallManager.maxWaterfallCount);
3902 configuration.Put("DisableIntenseVisualEffects", DisableIntenseVisualEffects);
3903 if (Configuration.Save())
3904 {
3905 return PlayerInput.Save();
3906 }
3907 return false;
3908 }
3909
3910 protected void CheckBunny()
3911 {
3912 try
3913 {
3914 RegistryKey currentUser = Registry.CurrentUser;
3915 currentUser = currentUser.CreateSubKey("Software\\Terraria");
3916 if (currentUser != null && currentUser.GetValue("Bunny") != null && currentUser.GetValue("Bunny").ToString() == "1")
3917 {
3919 }
3920 }
3921 catch
3922 {
3924 }
3925 }
3926
3927 private static void TryPickingDefaultUIScale(float displayHeight)
3928 {
3930 {
3931 newDefaultUIScale = displayHeight / 1080f * 1.1f;
3933 Configuration.Put("UIScale", newDefaultUIScale);
3934 Configuration.Save();
3935 }
3936 }
3937
3938 protected void LoadSettings()
3939 {
3940 if (File.Exists(SavePath + Path.DirectorySeparatorChar + "config.dat"))
3941 {
3943 if (SaveSettings())
3944 {
3946 }
3947 return;
3948 }
3950 Preferences configuration = Configuration;
3951 configuration.Load();
3952 int currentValue = 0;
3953 configuration.Get("LastLaunchedVersion", ref currentValue);
3954 bool flag = false;
3955 if (currentValue < 219)
3956 {
3957 flag = true;
3958 }
3959 if (!flag)
3960 {
3961 configuration.Get("ResetDefaultUIScale", ref shouldSetDefaultUIScale);
3962 configuration.Get("Fullscreen", ref startFullscreen);
3963 configuration.Get("WindowMaximized", ref screenMaximized);
3964 configuration.Get("WindowBorderless", ref screenBorderless);
3965 }
3968 if (Platform.IsWindows && !dedServ)
3969 {
3970 Form form = (Form)Control.FromHandle(instance.Window.Handle);
3971 if (screenBorderless)
3972 {
3974 }
3975 else if (screenMaximized)
3976 {
3977 form.FormBorderStyle = FormBorderStyle.Sizable;
3978 form.WindowState = FormWindowState.Maximized;
3979 }
3980 else
3981 {
3982 form.FormBorderStyle = FormBorderStyle.Sizable;
3983 }
3984 form.BringToFront();
3985 }
3986 int currentValue2 = graphics.PreferredBackBufferWidth;
3987 int currentValue3 = graphics.PreferredBackBufferHeight;
3988 configuration.Get("DisplayWidth", ref currentValue2);
3989 configuration.Get("DisplayHeight", ref currentValue3);
3991 if (!startFullscreen)
3992 {
3994 {
3996 }
3999 }
4000 configuration.Get("SmartCursorToggle", ref cSmartCursorModeIsToggleAndNotHold);
4001 configuration.Get("MapEnabled", ref mapEnabled);
4002 configuration.Get("InvasionBarMode", ref invasionProgressMode);
4003 configuration.Get("AutoSave", ref autoSave);
4004 configuration.Get("AutoPause", ref autoPause);
4005 _needsLanguageSelect = !configuration.Contains("Language");
4006 string text = configuration.Get("Language", "en-US");
4007 int result = 0;
4008 if (int.TryParse(text, out result))
4009 {
4010 LanguageManager.Instance.SetLanguage(result);
4011 SetTitle();
4012 }
4013 else
4014 {
4015 LanguageManager.Instance.SetLanguage(text);
4016 SetTitle();
4017 }
4018 configuration.Get("PlacementPreview", ref placementPreview);
4019 configuration.Get("GoreVisualsAllowed", ref ChildSafety.Disabled);
4020 configuration.Get("DisableIntenseVisualEffects", ref DisableIntenseVisualEffects);
4021 if (!flag)
4022 {
4023 configuration.Get("VolumeSound", ref soundVolume);
4024 configuration.Get("VolumeAmbient", ref ambientVolume);
4025 configuration.Get("VolumeMusic", ref musicVolume);
4026 }
4027 configuration.Get("KeyFavoriteModifier", ref cFavoriteKey);
4029 {
4031 }
4032 if (!flag)
4033 {
4034 configuration.Get("GraphicsQuality", ref qaStyle);
4035 configuration.Get("BackgroundEnabled", ref BackgroundEnabled);
4036 }
4037 if (configuration.GetAllKeys().Contains("FrameSkip"))
4038 {
4039 bool currentValue4 = false;
4040 configuration.Get("FrameSkip", ref currentValue4);
4043 {
4045 }
4046 else
4047 {
4049 }
4050 }
4051 int currentValue5 = (int)FrameSkipMode;
4052 configuration.Get("FrameSkipMode", ref currentValue5);
4053 if (currentValue5 < 0)
4054 {
4055 currentValue5 = 0;
4056 }
4057 if (currentValue5 > 2)
4058 {
4059 currentValue5 = 2;
4060 }
4062 int currentValue6 = (int)Lighting.Mode;
4063 if (!flag)
4064 {
4065 configuration.Get("LightingMode", ref currentValue6);
4066 }
4067 Lighting.Mode = (LightMode)currentValue6;
4068 configuration.Get("UnlockMusicSwap", ref TOWMusicUnlocked);
4069 configuration.Get("Parallax", ref caveParallax);
4070 bgScroll = (int)((1f - caveParallax) * 500f);
4071 configuration.Get("BackgroundParallax", ref bgScroll);
4072 caveParallax = 1f - (float)bgScroll / 500f;
4073 configuration.Get("ShowItemText", ref showItemText);
4074 configuration.Get("ClientUUID", ref clientUUID);
4075 configuration.Get("UseSmartCursorForCommonBlocks", ref Player.SmartCursorSettings.SmartBlocksEnabled);
4076 configuration.Get("UseSmartAxeAfterSmartPickaxe", ref Player.SmartCursorSettings.SmartAxeAfterPickaxe);
4077 configuration.Get("SmartCursorHoldCanReleaseMidUse", ref Player.SmartCursorSettings.SmartCursorHoldCanReleaseMidUse);
4078 if (!flag)
4079 {
4080 configuration.Get("DisableLeftShiftTrashCan", ref ItemSlot.Options.DisableLeftShiftTrashCan);
4081 }
4082 if (!flag)
4083 {
4084 configuration.Get("DisableQuickTrash", ref ItemSlot.Options.DisableQuickTrash);
4085 }
4086 configuration.Get("HidePasswords", ref HidePassword);
4087 configuration.Get("HighlightNewItems", ref ItemSlot.Options.HighlightNewItems);
4088 configuration.Get("ReverseUpDownForArmorSetBonuses", ref ReversedUpDownArmorSetBonuses);
4089 configuration.Get("MouseShowBuildingGrid", ref MouseShowBuildingGrid);
4090 configuration.Get("AllowUnfocusedInputOnGamepad", ref AllowUnfocusedInputOnGamepad);
4091 configuration.Get("GamepadDisableInstructionsDisplay", ref GamepadDisableInstructionsDisplay);
4092 configuration.Get("SettingDontScaleMainMenuUp", ref SettingDontScaleMainMenuUp);
4093 configuration.Get("WorldRollbacksToKeep", ref WorldRollingBackupsCountToKeep);
4094 configuration.Get("TeamNameplateDistance", ref teamNamePlateDistance);
4095 if (currentValue < 230)
4096 {
4097 configuration.Get("MultiplayerNPCSmoothingRange", ref multiplayerNPCSmoothingRange);
4098 }
4099 configuration.Get("UseStormEffect", ref UseStormEffects);
4100 configuration.Get("UseHeatDistortion", ref UseHeatDistortion);
4101 configuration.Get("WaveQuality", ref WaveQuality);
4102 if (WaveQuality > 3)
4103 {
4104 WaveQuality = 3;
4105 }
4106 if (WaveQuality < 0)
4107 {
4108 WaveQuality = 0;
4109 }
4111 configuration.Get("MouseColor", ref currentValue7);
4113 {
4114 mouseColor.R = value;
4115 }
4117 {
4118 mouseColor.G = value;
4119 }
4121 {
4122 mouseColor.B = value;
4123 }
4125 configuration.Get("MouseBorderColor", ref currentValue7);
4127 {
4128 MouseBorderColor.R = value;
4129 }
4131 {
4132 MouseBorderColor.G = value;
4133 }
4135 {
4136 MouseBorderColor.B = value;
4137 }
4139 {
4140 MouseBorderColor.A = value;
4141 }
4142 configuration.Get("QuickLaunch", ref SkipAssemblyLoad);
4143 if (!flag)
4144 {
4145 GameZoomTarget = configuration.Get("Zoom", 1f);
4146 }
4147 if (!flag)
4148 {
4149 UIScale = configuration.Get("UIScale", Platform.Get<IWindowService>().GetScaling());
4150 }
4151 if (newDefaultUIScale > 0f)
4152 {
4154 newDefaultUIScale = 0f;
4155 }
4156 MapScale = MathHelper.Clamp(configuration.Get("MapScale", InitialMapScale), 0.5f, 1f);
4157 int currentValue8 = -1;
4158 configuration.Get("LockOnPriority", ref currentValue8);
4159 if (currentValue8 < 0)
4160 {
4161 currentValue8 = 0;
4162 }
4163 if (currentValue8 > 2)
4164 {
4165 currentValue8 = 2;
4166 }
4167 LockOnHelper.UseMode = (LockOnHelper.LockOnMode)currentValue8;
4168 if (LockOnHelper.UseMode == LockOnHelper.LockOnMode.FocusTarget)
4169 {
4170 LockOnHelper.UseMode = LockOnHelper.LockOnMode.ThreeDS;
4171 }
4172 configuration.Get("InvisibleCursorForGamepad", ref InvisibleCursorForGamepad);
4173 if (Enum.TryParse<GameNotificationType>(configuration.Get("FlashIconForEvents", "All"), out var result3))
4174 {
4176 }
4177 if (!flag)
4178 {
4179 string screenDeviceName = configuration.Get("DisplayScreen", "");
4180 _windowMover.TryMovingToScreen(screenDeviceName);
4181 bool flag2 = configuration.Get("ThrottleWhenInactive", defaultValue: true);
4182 base.InactiveSleepTime = TimeSpan.FromMilliseconds(flag2 ? 20 : 0);
4183 }
4184 if (!flag)
4185 {
4186 configuration.Get("Support4K", ref Support4K);
4187 }
4188 configuration.Get("UseExperimentalFeatures", ref UseExperimentalFeatures);
4189 configuration.Get("SettingsUnlock_WorldEvil", ref SettingsUnlock_WorldEvil);
4190 configuration.Get("SettingsEnabled_MinersWobble", ref SettingsEnabled_MinersWobble);
4191 configuration.Get("SettingBlockGamepadsEntirely", ref SettingBlockGamepadsEntirely);
4192 configuration.Get("SettingsEnabled_OpaqueBoxBehindTooltips", ref SettingsEnabled_OpaqueBoxBehindTooltips);
4193 configuration.Get("SettingsEnabled_TilesSwayInWind", ref SettingsEnabled_TilesSwayInWind);
4194 configuration.Get("SettingsEnabled_AutoReuseAllItems", ref SettingsEnabled_AutoReuseAllItems);
4196 configuration.Get("DoorAutoOpeningMode", ref currentValue9);
4197 DoorOpeningHelper.PreferenceSettings = (DoorOpeningHelper.DoorAutoOpeningPreference)currentValue9;
4199 configuration.Get("HoverControlMode", ref currentValue10);
4200 Player.Settings.HoverControl = (Player.Settings.HoverControlMode)currentValue10;
4201 if (currentValue <= 147)
4202 {
4204 }
4205 if (currentValue <= 162)
4206 {
4207 bool currentValue11 = false;
4208 uint currentValue12 = 0u;
4209 configuration.Get("ThickMouseEdges", ref currentValue11);
4210 if (currentValue11)
4211 {
4212 configuration.Get("ThickMouseEdgesPackedColor", ref currentValue12);
4213 MouseBorderColor.PackedValue = currentValue12;
4214 mouseColor.R = configuration.Get("MouseColorR", mouseColor.R);
4215 mouseColor.G = configuration.Get("MouseColorG", mouseColor.G);
4216 mouseColor.B = configuration.Get("MouseColorB", mouseColor.B);
4217 }
4218 }
4219 if (currentValue <= 162)
4220 {
4221 configuration.Get("KeyUp", ref cUp);
4222 configuration.Get("KeyDown", ref cDown);
4223 configuration.Get("KeyLeft", ref cLeft);
4224 configuration.Get("KeyRight", ref cRight);
4225 configuration.Get("KeyJump", ref cJump);
4226 configuration.Get("KeyThrowItem", ref cThrowItem);
4227 configuration.Get("KeyInventory", ref cInv);
4228 configuration.Get("KeyQuickHeal", ref cHeal);
4229 configuration.Get("KeyQuickMana", ref cMana);
4230 configuration.Get("KeyQuickBuff", ref cBuff);
4231 configuration.Get("KeyUseHook", ref cHook);
4232 configuration.Get("KeyAutoSelect", ref cTorch);
4233 configuration.Get("KeySmartCursor", ref cSmart);
4234 configuration.Get("KeyMount", ref cMount);
4235 configuration.Get("KeyMapStyle", ref cMapStyle);
4236 configuration.Get("KeyFullscreenMap", ref cMapFull);
4237 configuration.Get("KeyMapZoomIn", ref cMapZoomIn);
4238 configuration.Get("KeyMapZoomOut", ref cMapZoomOut);
4239 configuration.Get("KeyMapAlphaUp", ref cMapAlphaUp);
4240 configuration.Get("KeyMapAlphaDown", ref cMapAlphaDown);
4241 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Up"] = new List<string> { cUp };
4242 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Down"] = new List<string> { cDown };
4243 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Left"] = new List<string> { cLeft };
4244 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Right"] = new List<string> { cRight };
4245 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Jump"] = new List<string> { cJump };
4246 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Throw"] = new List<string> { cThrowItem };
4247 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Inventory"] = new List<string> { cInv };
4248 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["QuickHeal"] = new List<string> { cHeal };
4249 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["QuickMana"] = new List<string> { cMana };
4250 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["QuickBuff"] = new List<string> { cBuff };
4251 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Grapple"] = new List<string> { cHook };
4252 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartSelect"] = new List<string> { cTorch };
4253 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartCursor"] = new List<string> { cSmart };
4254 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["QuickMount"] = new List<string> { cMount };
4255 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapStyle"] = new List<string> { cMapStyle };
4256 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapFull"] = new List<string> { cMapFull };
4257 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapZoomIn"] = new List<string> { cMapZoomIn };
4258 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapZoomOut"] = new List<string> { cMapZoomOut };
4259 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapAlphaUp"] = new List<string> { cMapAlphaUp };
4260 PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapAlphaDown"] = new List<string> { cMapAlphaDown };
4261 }
4262 PlayerInput.Load();
4263 if (currentValue < 165)
4264 {
4265 try
4266 {
4268 }
4269 catch (Exception)
4270 {
4271 }
4272 }
4275 mouseBorderColorSlider.Alpha = (float)(int)MouseBorderColor.A / 255f;
4276 if (currentValue != 279)
4277 {
4278 SaveSettings();
4279 }
4281 }
4282
4283 protected void OpenLegacySettings()
4284 {
4285 try
4286 {
4287 if (!File.Exists(SavePath + Path.DirectorySeparatorChar + "config.dat"))
4288 {
4289 return;
4290 }
4291 using FileStream input = new FileStream(SavePath + Path.DirectorySeparatorChar + "config.dat", FileMode.Open);
4293 int num = binaryReader.ReadInt32();
4294 if (num >= 68)
4295 {
4296 if (num >= 67)
4297 {
4298 clientUUID = binaryReader.ReadString();
4299 }
4300 bool flag = binaryReader.ReadBoolean();
4301 mouseColor.R = binaryReader.ReadByte();
4302 mouseColor.G = binaryReader.ReadByte();
4303 mouseColor.B = binaryReader.ReadByte();
4304 soundVolume = binaryReader.ReadSingle();
4305 if (num >= 90)
4306 {
4307 ambientVolume = binaryReader.ReadSingle();
4308 }
4309 musicVolume = binaryReader.ReadSingle();
4310 cUp = binaryReader.ReadString();
4311 cDown = binaryReader.ReadString();
4312 cLeft = binaryReader.ReadString();
4313 cRight = binaryReader.ReadString();
4314 cJump = binaryReader.ReadString();
4315 cThrowItem = binaryReader.ReadString();
4316 if (num >= 1)
4317 {
4318 cInv = binaryReader.ReadString();
4319 }
4320 if (num >= 12)
4321 {
4322 cHeal = binaryReader.ReadString();
4323 cMana = binaryReader.ReadString();
4324 cBuff = binaryReader.ReadString();
4325 }
4326 if (num >= 13)
4327 {
4328 cHook = binaryReader.ReadString();
4329 }
4330 caveParallax = binaryReader.ReadSingle();
4331 if (num >= 2)
4332 {
4333 terrariasFixedTiming = binaryReader.ReadBoolean();
4334 }
4335 if (num >= 91 && binaryReader.ReadBoolean() && !dedServ && Platform.IsWindows)
4336 {
4337 ((Form)Control.FromHandle(base.Window.Handle)).WindowState = FormWindowState.Maximized;
4338 }
4339 if (num >= 4)
4340 {
4341 int width = binaryReader.ReadInt32();
4342 int height = binaryReader.ReadInt32();
4343 SetDisplayMode(width, height, flag);
4344 }
4345 if (num >= 8)
4346 {
4347 autoSave = binaryReader.ReadBoolean();
4348 }
4349 if (num >= 9)
4350 {
4351 autoPause = binaryReader.ReadBoolean();
4352 }
4353 if (num >= 19)
4354 {
4355 showItemText = binaryReader.ReadBoolean();
4356 }
4357 if (num >= 30)
4358 {
4359 cTorch = binaryReader.ReadString();
4360 Lighting.Mode = (LightMode)binaryReader.ReadByte();
4361 qaStyle = binaryReader.ReadByte();
4362 }
4363 if (num >= 37)
4364 {
4365 BackgroundEnabled = binaryReader.ReadBoolean();
4366 }
4367 if (num >= 39)
4368 {
4369 byte b = binaryReader.ReadByte();
4370 _needsLanguageSelect = b == 0;
4371 LanguageManager.Instance.SetLanguage(b);
4372 }
4373 if (num >= 46)
4374 {
4375 mapEnabled = binaryReader.ReadBoolean();
4376 cMapStyle = binaryReader.ReadString();
4377 cMapFull = binaryReader.ReadString();
4378 cMapZoomIn = binaryReader.ReadString();
4379 cMapZoomOut = binaryReader.ReadString();
4380 cMapAlphaUp = binaryReader.ReadString();
4381 cMapAlphaDown = binaryReader.ReadString();
4382 }
4383 if (num >= 89)
4384 {
4385 binaryReader.ReadInt32();
4386 }
4387 if (num >= 100)
4388 {
4389 cSmart = binaryReader.ReadString();
4391 }
4392 if (num >= 107)
4393 {
4395 }
4396 if (num >= 111)
4397 {
4398 placementPreview = binaryReader.ReadBoolean();
4399 }
4400 if (num >= 111)
4401 {
4402 placementPreview = binaryReader.ReadBoolean();
4403 }
4404 SetFullScreen(flag);
4405 }
4406 binaryReader.Close();
4407 }
4408 catch
4409 {
4410 }
4411 }
4412
4413 private static void ErasePlayer(int i)
4414 {
4415 try
4416 {
4418 FileUtilities.Delete(PlayerList[i].Path + ".bak", PlayerList[i].IsCloudSave);
4419 }
4420 catch
4421 {
4422 }
4423 try
4424 {
4425 string text = PlayerList[i].Path.Substring(0, PlayerList[i].Path.Length - 4);
4426 if (text.Substring(text.Length - 1) != "." && text.Substring(text.Length - 1) != "\\" && Directory.Exists(text))
4427 {
4429 }
4430 LoadPlayers();
4431 }
4432 catch
4433 {
4434 }
4435 }
4436
4437 private static void EraseWorld(int i)
4438 {
4439 try
4440 {
4441 if (!WorldList[i].IsCloudSave)
4442 {
4443 Platform.Get<IPathService>().MoveToRecycleBin(WorldList[i].Path);
4444 Platform.Get<IPathService>().MoveToRecycleBin(WorldList[i].Path + ".bak");
4445 for (int j = 2; j <= 9; j++)
4446 {
4447 Platform.Get<IPathService>().MoveToRecycleBin(WorldList[i].Path + ".bak" + j);
4448 }
4449 }
4450 else if (SocialAPI.Cloud != null)
4451 {
4452 SocialAPI.Cloud.Delete(WorldList[i].Path);
4453 }
4454 LoadWorlds();
4455 }
4456 catch
4457 {
4458 }
4459 }
4460
4461 public static string GetPlayerPathFromName(string playerName, bool cloudSave)
4462 {
4464 string text = "";
4465 playerName = playerName.Replace(".", "_");
4466 playerName = playerName.Replace("*", "_");
4467 foreach (char c in playerName)
4468 {
4469 text += ((!invalidFileNameChars.Contains(c)) ? ((c != ' ') ? c : '_') : '-');
4470 }
4472 if (FileUtilities.GetFullPath(text2 + Path.DirectorySeparatorChar + text + ".plr", cloudSave).StartsWith("\\\\.\\", StringComparison.Ordinal))
4473 {
4474 text += "_";
4475 }
4477 {
4478 int num = 2;
4479 while (FileUtilities.Exists(text2 + Path.DirectorySeparatorChar.ToString() + text + num + ".plr", cloudSave))
4480 {
4481 num++;
4482 }
4483 text += num;
4484 }
4485 return text2 + Path.DirectorySeparatorChar + text + ".plr";
4486 }
4487
4488 public static string GetWorldPathFromName(string worldName, bool cloudSave)
4489 {
4491 string text = "";
4492 foreach (char c in worldName)
4493 {
4494 text += ((!invalidFileNameChars.Contains(c)) ? ((c != ' ') ? c : '_') : '-');
4495 }
4496 text = text.Replace(".", "_");
4497 text = text.Replace("*", "_");
4498 string text2 = (cloudSave ? CloudWorldPath : WorldPath);
4499 if (FileUtilities.GetFullPath(text2 + Path.DirectorySeparatorChar + text + ".wld", cloudSave).StartsWith("\\\\.\\", StringComparison.Ordinal))
4500 {
4501 text += "_";
4502 }
4504 {
4505 int num = 2;
4506 while (FileUtilities.Exists(text2 + Path.DirectorySeparatorChar.ToString() + text + num + ".wld", cloudSave))
4507 {
4508 num++;
4509 }
4510 text += num;
4511 }
4512 return text2 + Path.DirectorySeparatorChar + text + ".wld";
4513 }
4514
4519
4520 public void autoCreate(string worldSize)
4521 {
4522 switch (worldSize)
4523 {
4524 case "0":
4525 autoGen = false;
4526 break;
4527 case "1":
4528 maxTilesX = 4200;
4529 maxTilesY = 1200;
4530 autoGen = true;
4531 break;
4532 case "2":
4533 maxTilesX = 6400;
4534 maxTilesY = 1800;
4535 autoGen = true;
4536 break;
4537 case "3":
4538 maxTilesX = 8400;
4539 maxTilesY = 2400;
4540 autoGen = true;
4541 break;
4542 }
4543 }
4544
4545 public void NewMOTD(string newMOTD)
4546 {
4547 motd = newMOTD;
4548 }
4549
4550 public static string ConvertToSafeArgument(string arg)
4551 {
4552 return Uri.EscapeDataString(arg);
4553 }
4554
4555 public static string ConvertFromSafeArgument(string arg)
4556 {
4557 return Uri.UnescapeDataString(arg);
4558 }
4559
4560 public void LoadDedConfig(string configPath)
4561 {
4562 if (!File.Exists(configPath))
4563 {
4564 return;
4565 }
4567 string text;
4568 while ((text = streamReader.ReadLine()) != null)
4569 {
4570 try
4571 {
4572 if (text.Length > 6 && text.Substring(0, 6).ToLower() == "world=")
4573 {
4574 string text2 = text.Substring(6);
4575 try
4576 {
4577 string text3 = Platform.Get<IPathService>().ExpandPathVariables(text2);
4578 new FileInfo(text3);
4581 }
4582 catch
4583 {
4584 }
4585 }
4586 if (text.Length > 5 && text.Substring(0, 5).ToLower() == "port=")
4587 {
4588 string value = text.Substring(5);
4589 try
4590 {
4591 Netplay.ListenPort = Convert.ToInt32(value);
4592 }
4593 catch
4594 {
4595 }
4596 }
4597 if (text.Length > 21 && text.Substring(0, 21).ToLower() == "worldrollbackstokeep=")
4598 {
4599 string value2 = text.Substring(21);
4600 try
4601 {
4603 }
4604 catch
4605 {
4606 }
4607 }
4608 if (text.Length > 11 && text.Substring(0, 11).ToLower() == "maxplayers=")
4609 {
4610 string value3 = text.Substring(11);
4611 try
4612 {
4613 int num = Convert.ToInt32(value3);
4614 if (num <= 255 && num >= 1)
4615 {
4616 SetNetPlayers(num);
4617 }
4618 }
4619 catch
4620 {
4621 }
4622 }
4623 if (text.Length > 11 && text.Substring(0, 9).ToLower() == "priority=" && !Program.LaunchParameters.ContainsKey("-forcepriority"))
4624 {
4625 string value4 = text.Substring(9);
4626 try
4627 {
4628 int num2 = Convert.ToInt32(value4);
4629 if (num2 >= 0 && num2 <= 5)
4630 {
4632 switch (num2)
4633 {
4634 case 0:
4635 currentProcess.PriorityClass = ProcessPriorityClass.RealTime;
4636 break;
4637 case 1:
4638 currentProcess.PriorityClass = ProcessPriorityClass.High;
4639 break;
4640 case 2:
4641 currentProcess.PriorityClass = ProcessPriorityClass.AboveNormal;
4642 break;
4643 case 3:
4644 currentProcess.PriorityClass = ProcessPriorityClass.Normal;
4645 break;
4646 case 4:
4647 currentProcess.PriorityClass = ProcessPriorityClass.BelowNormal;
4648 break;
4649 case 5:
4650 currentProcess.PriorityClass = ProcessPriorityClass.Idle;
4651 break;
4652 }
4653 }
4654 }
4655 catch
4656 {
4657 }
4658 }
4659 if (text.Length > 9 && text.Substring(0, 9).ToLower() == "password=")
4660 {
4661 Netplay.ServerPassword = ConvertFromSafeArgument(text.Substring(9));
4662 }
4663 if (text.Length > 5 && text.Substring(0, 5).ToLower() == "motd=")
4664 {
4665 motd = text.Substring(5);
4666 }
4667 if (text.Length > 5 && text.Substring(0, 5).ToLower() == "lang=")
4668 {
4669 string value5 = text.Substring(5);
4671 }
4672 if (text.Length > 5 && text.Substring(0, 5).ToLower() == "language=")
4673 {
4674 string language = text.Substring(9);
4675 LanguageManager.Instance.SetLanguage(language);
4676 }
4677 if (text.Length >= 10 && text.Substring(0, 10).ToLower() == "worldpath=")
4678 {
4679 string text4 = text.Substring(10);
4680 WorldPath = Platform.Get<IPathService>().ExpandPathVariables(text4);
4681 }
4682 if (text.Length >= 10 && text.Substring(0, 10).ToLower() == "worldname=")
4683 {
4684 worldName = text.Substring(10);
4685 }
4686 if (text.Length >= 5 && text.Substring(0, 5).ToLower() == "seed=")
4687 {
4688 AutogenSeedName = text.Substring(5);
4689 }
4690 if (text.Length > 8 && text.Substring(0, 8).ToLower() == "banlist=")
4691 {
4692 string text5 = text.Substring(8);
4693 Netplay.BanFilePath = Platform.Get<IPathService>().ExpandPathVariables(text5);
4694 }
4695 if (text.Length > 11 && text.Substring(0, 11).ToLower() == "difficulty=")
4696 {
4697 switch (text.Substring(11))
4698 {
4699 case "0":
4700 GameMode = 0;
4701 break;
4702 case "1":
4703 GameMode = 1;
4704 break;
4705 case "2":
4706 GameMode = 2;
4707 break;
4708 case "3":
4709 GameMode = 3;
4710 break;
4711 }
4712 }
4713 if (text.Length > 11 && text.Substring(0, 11).ToLower() == "autocreate=")
4714 {
4715 string worldSize = text.Substring(11);
4717 }
4718 if (text.Length > 7 && text.Substring(0, 7).ToLower() == "secure=" && text.Substring(7) == "1")
4719 {
4720 Netplay.SpamCheck = true;
4721 }
4722 if (text.Length > 5 && text.Substring(0, 5).ToLower() == "upnp=" && text.Substring(5) != "1")
4723 {
4724 Netplay.UseUPNP = false;
4725 }
4726 string text6 = "slowliquids=";
4727 if (text.Length > text6.Length && text.Substring(0, text6.Length).ToLower() == text6 && text.Substring(text6.Length) == "1")
4728 {
4730 }
4731 if (text.Length > 10 && text.Substring(0, 10).ToLower() == "npcstream=")
4732 {
4733 string value6 = text.Substring(10);
4734 try
4735 {
4737 }
4738 catch
4739 {
4740 }
4741 }
4743 }
4744 catch
4745 {
4746 }
4747 }
4748 }
4749
4750 public void SetNetPlayers(int mPlayers)
4751 {
4753 }
4754
4755 public void SetWorld(string world, bool cloud)
4756 {
4758 }
4759
4760 public void SetWorldName(string world)
4761 {
4762 worldName = world;
4763 }
4764
4766 {
4767 autoShutdown = true;
4768 }
4769
4770 [DllImport("user32.dll")]
4771 public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
4772
4773 [DllImport("user32.dll")]
4774 private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
4775
4776 public void AutoPass()
4777 {
4778 autoPass = true;
4779 }
4780
4781 public void AutoJoin(string IP)
4782 {
4783 defaultIP = IP;
4784 getIP = IP;
4786 autoJoin = true;
4787 }
4788
4789 public void AutoHost()
4790 {
4791 menuMultiplayer = true;
4792 menuServer = true;
4794 menuMode = 1;
4795 }
4796
4797 public void loadLib(string path)
4798 {
4799 libPath = path;
4801 }
4802
4803 public void NeverSleep()
4804 {
4805 if (Platform.IsWindows)
4806 {
4808 }
4809 }
4810
4818
4819 public void DedServ()
4820 {
4821 NeverSleep();
4822 rand = new UnifiedRandom();
4823 if (autoShutdown)
4824 {
4825 string lpWindowName = (Console.Title = "terraria" + rand.Next(int.MaxValue));
4826 if (Platform.IsWindows)
4827 {
4829 if (intPtr != IntPtr.Zero)
4830 {
4831 ShowWindow(intPtr, 0);
4832 }
4833 }
4834 }
4835 else
4836 {
4837 Console.Title = "Terraria Server " + versionNumber2;
4838 }
4839 dedServ = true;
4840 showSplash = false;
4841 Initialize();
4842 while (worldPathName == null || worldPathName == "")
4843 {
4844 bool flag = true;
4845 while (flag)
4846 {
4847 LoadWorlds();
4849 Console.WriteLine("");
4850 for (int i = 0; i < WorldList.Count; i++)
4851 {
4852 Console.WriteLine(i + 1 + "\t\t" + WorldList[i].Name);
4853 }
4854 string textValue = Language.GetTextValue("CLI.NewWorld_Command");
4855 string textValue2 = Language.GetTextValue("CLI.DeleteWorld_Example");
4856 int num = (Math.Max(newWorldName.Length, textValue2.Length) + 1) / 8 + 1;
4857 textValue = textValue + new string('\t', num - textValue.Length / 8) + Language.GetTextValue("CLI.NewWorld_Description");
4858 textValue2 = textValue2 + new string('\t', num - textValue2.Length / 8) + Language.GetTextValue("CLI.DeleteWorld_Description");
4859 Console.WriteLine(textValue);
4861 Console.WriteLine("");
4862 Console.Write(Language.GetTextValue("CLI.ChooseWorld"));
4863 string text2 = ReadLineInput();
4864 if (text2 == null)
4865 {
4866 text2 = "";
4867 }
4868 try
4869 {
4870 Console.Clear();
4871 }
4872 catch
4873 {
4874 }
4875 if (text2.StartsWith(Language.GetTextValue("CLI.DeleteWorld_Command") + " "))
4876 {
4877 try
4878 {
4879 int length = Language.GetTextValue("CLI.DeleteWorld_Command").Length;
4880 int num2 = Convert.ToInt32(text2.Substring(length + 1)) - 1;
4881 if (num2 < WorldList.Count)
4882 {
4884 Console.WriteLine("");
4885 Console.WriteLine(Language.GetTextValue("CLI.DeleteConfirmation", WorldList[num2].Name));
4886 Console.Write("({0}/{1}): ", Language.GetTextValue("CLI.ShortYes"), Language.GetTextValue("CLI.ShortNo"));
4887 if (ReadLineInput().ToLower() == Language.GetTextValue("CLI.ShortYes").ToLower())
4888 {
4890 }
4891 }
4892 }
4893 catch
4894 {
4895 }
4896 try
4897 {
4898 Console.Clear();
4899 }
4900 catch
4901 {
4902 }
4903 continue;
4904 }
4905 if (text2 == "n" || text2 == "N")
4906 {
4907 bool flag2 = true;
4908 while (flag2)
4909 {
4911 Console.WriteLine("");
4912 Console.WriteLine("1\t" + Language.GetTextValue("UI.WorldSizeSmall"));
4913 Console.WriteLine("2\t" + Language.GetTextValue("UI.WorldSizeMedium"));
4914 Console.WriteLine("3\t" + Language.GetTextValue("UI.WorldSizeLarge"));
4915 Console.WriteLine("");
4916 Console.Write(Language.GetTextValue("CLI.ChooseSize"));
4917 string value = ReadLineInput();
4918 try
4919 {
4920 switch (Convert.ToInt32(value))
4921 {
4922 case 1:
4923 maxTilesX = 4200;
4924 maxTilesY = 1200;
4925 flag2 = false;
4926 break;
4927 case 2:
4928 maxTilesX = 6400;
4929 maxTilesY = 1800;
4930 flag2 = false;
4931 break;
4932 case 3:
4933 maxTilesX = 8400;
4934 maxTilesY = 2400;
4935 flag2 = false;
4936 break;
4937 }
4938 }
4939 catch
4940 {
4941 }
4942 try
4943 {
4944 Console.Clear();
4945 }
4946 catch
4947 {
4948 }
4949 }
4950 flag2 = true;
4951 while (flag2)
4952 {
4954 Console.WriteLine("");
4955 Console.WriteLine("1\t" + Language.GetTextValue("UI.Normal"));
4956 Console.WriteLine("2\t" + Language.GetTextValue("UI.Expert"));
4957 Console.WriteLine("3\t" + Language.GetTextValue("UI.Master"));
4958 Console.WriteLine("4\t" + Language.GetTextValue("UI.Creative"));
4959 Console.WriteLine("");
4960 Console.Write(Language.GetTextValue("CLI.ChooseDifficulty"));
4961 string value = ReadLineInput();
4962 try
4963 {
4964 switch (Convert.ToInt32(value))
4965 {
4966 case 1:
4967 GameMode = 0;
4968 flag2 = false;
4969 break;
4970 case 2:
4971 GameMode = 1;
4972 flag2 = false;
4973 break;
4974 case 3:
4975 GameMode = 2;
4976 flag2 = false;
4977 break;
4978 case 4:
4979 GameMode = 3;
4980 flag2 = false;
4981 break;
4982 }
4983 }
4984 catch
4985 {
4986 }
4987 try
4988 {
4989 Console.Clear();
4990 }
4991 catch
4992 {
4993 }
4994 }
4995 flag2 = true;
4996 while (flag2)
4997 {
4999 Console.WriteLine("");
5000 Console.WriteLine("1\t" + Language.GetTextValue("CLI.Random"));
5001 Console.WriteLine("2\t" + Language.GetTextValue("CLI.Corrupt"));
5002 Console.WriteLine("3\t" + Language.GetTextValue("CLI.Crimson"));
5003 Console.WriteLine("");
5004 Console.Write(Language.GetTextValue("CLI.ChooseEvil"));
5005 string value = ReadLineInput();
5006 try
5007 {
5008 switch (Convert.ToInt32(value))
5009 {
5010 case 1:
5011 WorldGen.WorldGenParam_Evil = -1;
5012 flag2 = false;
5013 break;
5014 case 2:
5015 WorldGen.WorldGenParam_Evil = 0;
5016 flag2 = false;
5017 break;
5018 case 3:
5019 WorldGen.WorldGenParam_Evil = 1;
5020 flag2 = false;
5021 break;
5022 }
5023 }
5024 catch
5025 {
5026 }
5027 try
5028 {
5029 Console.Clear();
5030 }
5031 catch
5032 {
5033 }
5034 }
5035 flag2 = true;
5037 while (flag2)
5038 {
5039 Console.WriteLine("");
5040 Console.Write(Language.GetTextValue("CLI.EnterWorldName"));
5042 if (newWorldName != null && newWorldName != "" && newWorldName != " ")
5043 {
5044 if (newWorldName.Length >= 27)
5045 {
5046 Console.WriteLine("");
5047 Console.WriteLine(Language.GetTextValue("CLI.WorldNameLengthTooLong", 26));
5048 continue;
5049 }
5050 flag2 = false;
5051 try
5052 {
5053 Console.Clear();
5054 }
5055 catch
5056 {
5057 }
5058 }
5059 else
5060 {
5061 try
5062 {
5063 Console.Clear();
5064 }
5065 catch
5066 {
5067 }
5069 }
5070 }
5071 string text3 = "";
5072 flag2 = true;
5074 while (flag2)
5075 {
5076 Console.WriteLine("");
5077 Console.Write(Language.GetTextValue("CLI.EnterSeed"));
5078 text3 = ReadLineInput();
5079 if (text3 != null)
5080 {
5081 if (text3.Length >= 40)
5082 {
5083 Console.WriteLine("");
5084 Console.WriteLine(Language.GetTextValue("CLI.SeedLengthTooLong", 39));
5085 continue;
5086 }
5087 flag2 = false;
5088 try
5089 {
5090 Console.Clear();
5091 }
5092 catch
5093 {
5094 }
5095 }
5096 else
5097 {
5098 text3 = "";
5099 }
5100 }
5103 text3 = text3.Trim();
5104 if (text3.Length == 0)
5105 {
5106 ActiveWorldFileData.SetSeedToRandom();
5107 }
5108 else
5109 {
5110 ActiveWorldFileData.SetSeed(text3);
5111 }
5113 menuMode = 10;
5116 flag2 = false;
5117 while (menuMode == 10)
5118 {
5120 {
5123 }
5124 }
5125 try
5126 {
5127 Console.Clear();
5128 }
5129 catch
5130 {
5131 }
5132 while (!task.IsCompleted)
5133 {
5134 statusText = string.Format("{0:0.0%} - " + generationProgress.Message + " - {1:0.0%}", generationProgress.TotalProgress, generationProgress.Value);
5136 {
5138 string value2 = statusText;
5140 {
5141 value2 = string.Format("{0:0.0%} - " + Language.GetTextValue("UI.WorldGenEasterEgg_GeneratingBees") + " - {1:0.0%}", generationProgress.TotalProgress, generationProgress.Value);
5142 }
5144 }
5145 }
5146 continue;
5147 }
5148 try
5149 {
5150 int num3 = Convert.ToInt32(text2);
5151 num3--;
5152 if (num3 < 0 || num3 >= WorldList.Count)
5153 {
5154 continue;
5155 }
5156 bool flag3 = true;
5157 while (flag3)
5158 {
5160 Console.WriteLine("");
5161 Console.Write(Language.GetTextValue("CLI.SetInitialMaxPlayers"));
5162 string text4 = ReadLineInput();
5163 try
5164 {
5165 if (text4 == "")
5166 {
5167 text4 = "16";
5168 }
5169 int num4 = Convert.ToInt32(text4);
5170 if (num4 <= 255 && num4 >= 1)
5171 {
5173 flag3 = false;
5174 }
5175 flag3 = false;
5176 }
5177 catch
5178 {
5179 }
5180 try
5181 {
5182 Console.Clear();
5183 }
5184 catch
5185 {
5186 }
5187 }
5188 flag3 = true;
5189 while (flag3)
5190 {
5192 Console.WriteLine("");
5193 Console.Write(Language.GetTextValue("CLI.SetInitialPort"));
5194 string text5 = ReadLineInput();
5195 try
5196 {
5197 if (text5 == "")
5198 {
5199 text5 = "7777";
5200 }
5201 int num5 = Convert.ToInt32(text5);
5202 if (num5 <= 65535)
5203 {
5204 Netplay.ListenPort = num5;
5205 flag3 = false;
5206 }
5207 }
5208 catch
5209 {
5210 }
5211 try
5212 {
5213 Console.Clear();
5214 }
5215 catch
5216 {
5217 }
5218 }
5219 flag3 = true;
5220 while (flag3)
5221 {
5223 Console.WriteLine("");
5224 Console.Write(Language.GetTextValue("CLI.AutomaticPortForward", Language.GetTextValue("CLI.ShortYes"), Language.GetTextValue("CLI.ShortNo")));
5225 string text6 = ReadLineInput();
5226 try
5227 {
5228 if (text6 == "" || text6.ToLower() == Language.GetTextValue("CLI.ShortYes").ToLower() || text6.ToLower() == Language.GetTextValue("CLI.Yes").ToLower())
5229 {
5230 Netplay.UseUPNP = true;
5231 flag3 = false;
5232 }
5233 else if (text6.ToLower() == Language.GetTextValue("CLI.ShortNo").ToLower() || text6.ToLower() == Language.GetTextValue("CLI.No").ToLower())
5234 {
5235 Netplay.UseUPNP = false;
5236 flag3 = false;
5237 }
5238 }
5239 catch
5240 {
5241 }
5242 try
5243 {
5244 Console.Clear();
5245 }
5246 catch
5247 {
5248 }
5249 }
5251 Console.WriteLine("");
5252 Console.Write(Language.GetTextValue("CLI.EnterServerPassword"));
5253 Netplay.ServerPassword = ReadLineInput();
5255 flag = false;
5256 try
5257 {
5258 Console.Clear();
5259 }
5260 catch
5261 {
5262 }
5263 }
5264 catch
5265 {
5266 }
5267 }
5268 }
5269 try
5270 {
5271 Console.Clear();
5272 }
5273 catch
5274 {
5275 }
5278 Console.WriteLine("");
5279 while (!task2.IsCompleted)
5280 {
5282 {
5283 if (AutogenProgress.TotalProgress != 0.0)
5284 {
5285 statusText = string.Format("{0:0.0%} - " + AutogenProgress.Message + " - {1:0.0%}", AutogenProgress.TotalProgress, AutogenProgress.Value);
5286 }
5288 {
5291 }
5292 }
5293 }
5294 try
5295 {
5297 {
5298 Console.Clear();
5299 }
5300 }
5301 catch
5302 {
5303 }
5305 {
5307 if (!autoShutdown)
5308 {
5309 Console.ReadKey();
5310 }
5312 return;
5313 }
5315 Console.WriteLine("");
5316 Console.WriteLine(Language.GetTextValue("CLI.ListeningOnPort", Netplay.ListenPort));
5317 Console.WriteLine(Language.GetTextValue("CLI.HelpHint"));
5318 Console.WriteLine("");
5319 Console.Title = "Terraria Server: " + worldName;
5321 if (!autoShutdown)
5322 {
5323 startDedInput();
5324 }
5325 stopwatch.Start();
5326 double num6 = 16.666666666666668;
5327 double num7 = 0.0;
5328 int num8 = 0;
5329 new Stopwatch().Start();
5331 gameMenu = false;
5332 while (!Netplay.Disconnect)
5333 {
5334 double totalMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
5335 if (totalMilliseconds + num7 >= num6)
5336 {
5337 num8++;
5339 stopwatch.Reset();
5340 stopwatch.Start();
5342 {
5345 }
5346 if (Netplay.HasClients)
5347 {
5348 Update(new GameTime());
5349 }
5350 else if (saveTime.IsRunning)
5351 {
5352 saveTime.Stop();
5353 }
5355 {
5357 }
5358 double num9 = stopwatch.Elapsed.TotalMilliseconds + num7;
5359 if (num9 < num6)
5360 {
5361 int num10 = (int)(num6 - num9) - 1;
5362 if (num10 > 1)
5363 {
5364 Thread.Sleep(num10 - 1);
5365 if (!Netplay.HasClients)
5366 {
5367 num7 = 0.0;
5368 Thread.Sleep(10);
5369 }
5370 }
5371 }
5372 }
5373 Thread.Sleep(0);
5374 }
5376 {
5377 Console.WriteLine(Language.GetTextValue("Net.ServerSavingOnExit"));
5379 }
5381 }
5382
5384 {
5387 }
5388
5389 public static void startDedInput()
5390 {
5392 thread.IsBackground = true;
5393 thread.Name = "Server Input Thread";
5394 thread.Start();
5395 }
5396
5397 public static void startDedInputCallBack()
5398 {
5399 while (!Netplay.Disconnect)
5400 {
5401 Console.Write(": ");
5402 string text = ReadLineInput();
5403 string text2 = text;
5404 text = text.ToLower();
5405 try
5406 {
5407 if (text == Language.GetTextValue("CLI.Help_Command"))
5408 {
5409 Console.WriteLine(Language.GetTextValue("CLI.AvailableCommands"));
5410 Console.WriteLine("");
5412 {
5413 "Help", "Playing", "Clear", "Exit", "ExitNoSave", "Save", "Kick", "Ban", "Password", "SetPassword",
5414 "Version", "Time", "Port", "MaxPlayers", "Say", "MOTD", "SetMOTD", "Dawn", "Noon", "Dusk",
5415 "Midnight", "Settle", "Seed"
5416 };
5417 int num = 0;
5418 for (int i = 0; i < list.Count; i++)
5419 {
5420 string text3 = (Language.Exists("CLI." + list[i] + "_Example") ? Language.GetTextValue("CLI." + list[i] + "_Example") : Language.GetTextValue("CLI." + list[i] + "_Command"));
5421 if (text3.Length > num)
5422 {
5423 num = text3.Length;
5424 }
5425 }
5426 int num2 = (num + 1) / 8;
5427 for (int j = 0; j < list.Count; j++)
5428 {
5429 string text4 = (Language.Exists("CLI." + list[j] + "_Example") ? Language.GetTextValue("CLI." + list[j] + "_Example") : Language.GetTextValue("CLI." + list[j] + "_Command"));
5430 Console.WriteLine(text4 + new string('\t', num2 - text4.Length / 8) + Language.GetTextValue("CLI." + list[j] + "_Description"));
5431 }
5432 }
5433 else if (text == Language.GetTextValue("CLI.Settle_Command"))
5434 {
5435 if (!Liquid.panicMode)
5436 {
5438 }
5439 else
5440 {
5441 Console.WriteLine(Language.GetTextValue("CLI.WaterIsAlreadySettling"));
5442 }
5443 }
5444 else if (text == Language.GetTextValue("CLI.Dawn_Command"))
5445 {
5446 dayTime = true;
5447 time = 0.0;
5449 }
5450 else if (text == Language.GetTextValue("CLI.Dusk_Command"))
5451 {
5452 dayTime = false;
5453 time = 0.0;
5455 }
5456 else if (text == Language.GetTextValue("CLI.Noon_Command"))
5457 {
5458 dayTime = true;
5459 time = 27000.0;
5461 }
5462 else if (text == Language.GetTextValue("CLI.Midnight_Command"))
5463 {
5464 dayTime = false;
5465 time = 16200.0;
5467 }
5468 else if (text == Language.GetTextValue("CLI.ExitNoSave_Command"))
5469 {
5470 Netplay.SaveOnServerExit = false;
5471 Netplay.Disconnect = true;
5472 }
5473 else if (text == Language.GetTextValue("CLI.Exit_Command"))
5474 {
5475 Netplay.Disconnect = true;
5477 }
5478 else if (text == Language.GetTextValue("CLI.FPS_Command"))
5479 {
5480 if (!dedServFPS)
5481 {
5482 dedServFPS = true;
5483 fpsTimer.Reset();
5484 }
5485 else
5486 {
5487 dedServCount1 = 0;
5488 dedServCount2 = 0;
5489 dedServFPS = false;
5490 }
5491 }
5492 else if (text == Language.GetTextValue("CLI.Save_Command"))
5493 {
5495 }
5496 else if (text == Language.GetTextValue("CLI.Time_Command"))
5497 {
5498 string textValue = Language.GetTextValue("GameUI.TimeAtMorning");
5499 double num3 = time;
5500 if (!dayTime)
5501 {
5502 num3 += 54000.0;
5503 }
5504 num3 = num3 / 86400.0 * 24.0;
5505 double num4 = 7.5;
5506 num3 = num3 - num4 - 12.0;
5507 if (num3 < 0.0)
5508 {
5509 num3 += 24.0;
5510 }
5511 if (num3 >= 12.0)
5512 {
5513 textValue = Language.GetTextValue("GameUI.TimePastMorning");
5514 }
5515 int num5 = (int)num3;
5516 double num6 = (int)((num3 - (double)num5) * 60.0);
5517 string text5 = string.Concat(num6);
5518 if (num6 < 10.0)
5519 {
5520 text5 = "0" + text5;
5521 }
5522 if (num5 > 12)
5523 {
5524 num5 -= 12;
5525 }
5526 if (num5 == 0)
5527 {
5528 num5 = 12;
5529 }
5530 Console.WriteLine(Language.GetTextValue("CLI.Time", num5 + ":" + text5 + " " + textValue));
5531 }
5532 else if (text == Language.GetTextValue("CLI.MaxPlayers_Command"))
5533 {
5535 }
5536 else if (text == Language.GetTextValue("CLI.Port_Command"))
5537 {
5539 }
5540 else if (text == Language.GetTextValue("CLI.Version_Command"))
5541 {
5543 }
5544 else if (text == Language.GetTextValue("CLI.Clear_Command"))
5545 {
5546 try
5547 {
5548 Console.Clear();
5549 }
5550 catch
5551 {
5552 }
5553 }
5554 else if (text == Language.GetTextValue("CLI.Playing_Command"))
5555 {
5556 int num7 = 0;
5557 for (int k = 0; k < 255; k++)
5558 {
5559 if (player[k].active)
5560 {
5561 num7++;
5562 Console.WriteLine(string.Concat(player[k].name, " (", Netplay.Clients[k].Socket.GetRemoteAddress(), ")"));
5563 }
5564 }
5565 switch (num7)
5566 {
5567 case 0:
5568 Console.WriteLine(Language.GetTextValue("CLI.NoPlayers"));
5569 break;
5570 case 1:
5571 Console.WriteLine(Language.GetTextValue("CLI.OnePlayerConnected"));
5572 break;
5573 default:
5574 Console.WriteLine(Language.GetTextValue("CLI.PlayersConnected", num7));
5575 break;
5576 }
5577 }
5578 else
5579 {
5580 if (text == "")
5581 {
5582 continue;
5583 }
5584 if (text == Language.GetTextValue("CLI.MOTD_Command"))
5585 {
5586 if (motd == "")
5587 {
5589 }
5590 else
5591 {
5593 }
5594 }
5595 else if (text.StartsWith(Language.GetTextValue("CLI.SetMOTD_Command") + " "))
5596 {
5597 motd = text2.Substring(Language.GetTextValue("CLI.SetMOTD_Command").Length + 1);
5598 }
5599 else if (text == Language.GetTextValue("CLI.Password_Command"))
5600 {
5601 if (Netplay.ServerPassword == "")
5602 {
5603 Console.WriteLine(Language.GetTextValue("CLI.NoPassword"));
5604 }
5605 else
5606 {
5608 }
5609 }
5610 else if (text.StartsWith(Language.GetTextValue("CLI.SetPassword_Command") + " "))
5611 {
5612 string text6 = text2.Substring(Language.GetTextValue("CLI.SetPassword_Command").Length + 1);
5613 if (text6 == "")
5614 {
5615 Netplay.ServerPassword = "";
5616 Console.WriteLine(Language.GetTextValue("CLI.PasswordDisabled"));
5617 }
5618 else
5619 {
5620 Netplay.ServerPassword = text6;
5622 }
5623 }
5624 else if (text == Language.GetTextValue("CLI.Say_Command"))
5625 {
5626 Console.WriteLine(Language.GetTextValue("CLI.Say_Usage"));
5627 }
5628 else if (text.StartsWith(Language.GetTextValue("CLI.Say_Command") + " "))
5629 {
5630 int length = Language.GetTextValue("CLI.Say_Command").Length;
5631 if (text.Length <= length + 1)
5632 {
5633 Console.WriteLine(Language.GetTextValue("CLI.Say_Usage"));
5634 continue;
5635 }
5636 string text7 = text2.Substring(length + 1);
5637 Console.WriteLine(Language.GetTextValue("CLI.ServerMessage", text7));
5638 ChatHelper.BroadcastChatMessage(NetworkText.FromKey("CLI.ServerMessage", text7), new Microsoft.Xna.Framework.Color(255, 240, 20));
5639 }
5640 else if (text == Language.GetTextValue("CLI.Kick_Command"))
5641 {
5642 Console.WriteLine(Language.GetTextValue("CLI.Kick_Usage"));
5643 }
5644 else if (text.StartsWith(Language.GetTextValue("CLI.Kick_Command") + " "))
5645 {
5646 int length2 = Language.GetTextValue("CLI.Kick_Command").Length;
5647 if (text.Length <= length2 + 1)
5648 {
5649 Console.WriteLine(Language.GetTextValue("CLI.Kick_Usage"));
5650 continue;
5651 }
5652 string text8 = text.Substring(length2 + 1);
5653 text8 = text8.ToLower();
5654 for (int l = 0; l < 255; l++)
5655 {
5656 if (player[l].active && player[l].name.ToLower() == text8)
5657 {
5658 NetMessage.SendData(2, l, -1, NetworkText.FromKey("CLI.KickMessage"));
5659 }
5660 }
5661 }
5662 else if (text == Language.GetTextValue("CLI.Seed_Command"))
5663 {
5664 if (ActiveWorldFileData == null || !ActiveWorldFileData.HasValidSeed)
5665 {
5666 Console.WriteLine(Language.GetTextValue("CLI.NoValidSeed"));
5667 }
5668 else
5669 {
5670 Console.WriteLine(Language.GetTextValue("CLI.DisplaySeed", ActiveWorldFileData.GetFullSeedText()));
5671 }
5672 }
5673 else if (text == Language.GetTextValue("CLI.Ban_Command"))
5674 {
5675 Console.WriteLine(Language.GetTextValue("CLI.Ban_Usage"));
5676 }
5677 else if (text.StartsWith(Language.GetTextValue("CLI.Ban_Command") + " "))
5678 {
5679 int length3 = Language.GetTextValue("CLI.Ban_Command").Length;
5680 if (text.Length <= length3 + 1)
5681 {
5682 Console.WriteLine(Language.GetTextValue("CLI.Ban_Usage"));
5683 continue;
5684 }
5685 string text9 = text.Substring(4);
5686 text9 = text9.ToLower();
5687 for (int m = 0; m < 255; m++)
5688 {
5689 if (player[m].active && player[m].name.ToLower() == text9)
5690 {
5691 Netplay.AddBan(m);
5692 NetMessage.SendData(2, m, -1, NetworkText.FromKey("CLI.BanMessage"));
5693 }
5694 }
5695 }
5696 else
5697 {
5698 Console.WriteLine(Language.GetTextValue("CLI.InvalidCommand"));
5699 }
5700 continue;
5701 }
5702 }
5703 catch
5704 {
5705 Console.WriteLine(Language.GetTextValue("CLI.InvalidCommand"));
5706 }
5707 }
5708 }
5709
5710 private static string ReadLineInput()
5711 {
5712 string text = null;
5713 do
5714 {
5715 text = Console.ReadLine();
5716 }
5717 while (text == null);
5718 return text;
5719 }
5720
5721 public static bool IsFastForwardingTime()
5722 {
5724 {
5725 return fastForwardTimeToDusk;
5726 }
5727 return true;
5728 }
5729
5730 public static void Sundialing()
5731 {
5732 if (sundialCooldown == 0)
5733 {
5734 if (netMode == 1)
5735 {
5736 NetMessage.SendData(51, -1, -1, null, myPlayer, 3f);
5737 return;
5738 }
5739 fastForwardTimeToDawn = true;
5740 sundialCooldown = 8;
5742 }
5743 }
5744
5745 public static void Moondialing()
5746 {
5747 if (moondialCooldown == 0)
5748 {
5749 if (netMode == 1)
5750 {
5751 NetMessage.SendData(51, -1, -1, null, myPlayer, 6f);
5752 return;
5753 }
5754 fastForwardTimeToDusk = true;
5755 moondialCooldown = 8;
5757 }
5758 }
5759
5760 public static void UpdateTimeRate()
5761 {
5763 {
5764 dayRate = 60;
5766 return;
5767 }
5768 bool enabled = CreativePowerManager.Instance.GetPower<CreativePowers.FreezeTime>().Enabled;
5770 bool flag = CurrentFrameFlags.SleepingPlayersCount == CurrentFrameFlags.ActivePlayersCount && CurrentFrameFlags.SleepingPlayersCount > 0;
5771 int num = targetTimeRate;
5772 if (!gameMenu && flag)
5773 {
5774 num *= 5;
5775 }
5776 if (enabled)
5777 {
5778 num = 0;
5779 }
5780 dayRate = num;
5782 if (gameMenu)
5783 {
5784 dayRate = 1;
5786 }
5787 }
5788
5789 public Main()
5790 {
5791 instance = this;
5792 UnpausedUpdateSeed = (ulong)Guid.NewGuid().GetHashCode();
5793 base.Exiting += Main_Exiting;
5794 if (!dedServ)
5795 {
5796 Map = new WorldMap(maxTilesX, maxTilesY);
5797 Configuration.Load();
5799 base.Content.RootDirectory = "Content";
5800 }
5801 }
5802
5803 private static void SetDisplayMonitor()
5804 {
5805 Configuration.Get("Display", "");
5806 if (Program.IsXna)
5807 {
5808 graphics.PreparingDeviceSettings += SetMonitorOnce;
5809 }
5810 }
5811
5812 private static void SetMonitorOnce(object sender, PreparingDeviceSettingsEventArgs e)
5813 {
5814 string displayName = Configuration.Get("Display", "");
5815 GraphicsAdapter graphicsAdapter = GraphicsAdapter.Adapters.Where((GraphicsAdapter adapter) => adapter.DeviceName == displayName).FirstOrDefault();
5816 if (graphicsAdapter != null)
5817 {
5818 e.GraphicsDeviceInformation.Adapter = graphicsAdapter;
5819 }
5820 graphics.PreparingDeviceSettings -= SetMonitorOnce;
5821 }
5822
5823 protected void SetTitle()
5824 {
5825 if (!dedServ)
5826 {
5828 Platform.Get<IWindowService>().SetUnicodeTitle(base.Window, _cachedTitle);
5829 }
5830 }
5831
5832 private static void SetTileValue()
5833 {
5834 tileOreFinderPriority[28] = 100;
5835 tileOreFinderPriority[407] = 150;
5836 tileOreFinderPriority[404] = 150;
5837 tileOreFinderPriority[7] = 200;
5838 tileOreFinderPriority[166] = 210;
5839 tileOreFinderPriority[6] = 220;
5840 tileOreFinderPriority[167] = 230;
5841 tileOreFinderPriority[9] = 240;
5842 tileOreFinderPriority[168] = 250;
5843 tileOreFinderPriority[8] = 260;
5844 tileOreFinderPriority[169] = 270;
5845 tileOreFinderPriority[22] = 300;
5846 tileOreFinderPriority[204] = 310;
5847 tileOreFinderPriority[37] = 400;
5848 tileOreFinderPriority[21] = 500;
5849 tileOreFinderPriority[467] = 500;
5850 tileOreFinderPriority[441] = 500;
5851 tileOreFinderPriority[468] = 500;
5852 tileOreFinderPriority[12] = 550;
5853 tileOreFinderPriority[665] = 550;
5854 tileOreFinderPriority[639] = 550;
5855 tileOreFinderPriority[107] = 600;
5856 tileOreFinderPriority[221] = 610;
5857 tileOreFinderPriority[108] = 620;
5858 tileOreFinderPriority[222] = 630;
5859 tileOreFinderPriority[111] = 640;
5860 tileOreFinderPriority[223] = 650;
5861 tileOreFinderPriority[129] = 675;
5862 tileOreFinderPriority[211] = 700;
5863 tileOreFinderPriority[227] = 750;
5864 tileOreFinderPriority[656] = 760;
5865 tileOreFinderPriority[236] = 810;
5866 }
5867
5868 private static void ResetGameCounter()
5869 {
5871 }
5872
5873 protected override void Initialize()
5874 {
5875 musicFade[50] = 1f;
5876 if (dedServ)
5877 {
5878 netMode = 2;
5879 }
5880 for (int i = 0; i < 10; i++)
5881 {
5882 recentWorld[i] = "";
5883 recentIP[i] = "";
5884 recentPort[i] = 0;
5885 }
5886 if (rand == null)
5887 {
5888 rand = new UnifiedRandom((int)DateTime.Now.Ticks);
5889 }
5890 SetTitle();
5891 lo = rand.Next(6);
5896 gameTips = new GameTipsDisplay();
5897 if (player[myPlayer] == null)
5898 {
5899 player[myPlayer] = new Player();
5900 }
5903 player[myPlayer] = new Player();
5904 WorldGen.Hooks.OnWorldLoad += delegate
5905 {
5907 LocalGolfState = new GolfState();
5908 if (!dedServ)
5909 {
5910 Lighting.Clear();
5911 }
5912 };
5916 PlayerInput.OnActionableInput += delegate
5917 {
5918 if (LocalGolfState != null)
5919 {
5920 LocalGolfState.CancelBallTracking();
5921 }
5922 };
5923 SceneMetrics = new SceneMetrics();
5924 BindSettingsTo(Configuration);
5925 if (dedServ)
5926 {
5928 return;
5929 }
5933 base.Initialize();
5934 }
5935
5937 {
5944 if (SocialAPI.Cloud != null)
5945 {
5946 SocialAPI.Cloud.BindTo(preferences);
5947 }
5948 preferences.OnSave += SaveResourcePacks;
5949 preferences.OnLoad += LoadResourcePacks;
5950 }
5951
5953 {
5954 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
5955 //IL_0011: Expected O, but got Unknown
5956 _lastLoadedPacks = prefs.Get<JArray>("ResourcePacks", new JArray());
5957 }
5958
5960 {
5961 JArray value = _lastLoadedPacks;
5962 if (AssetSourceController != null)
5963 {
5965 }
5966 prefs.Put("ResourcePacks", value);
5967 }
5968
5970 {
5975 LocalFavoriteData.Load();
5976 CloudFavoritesData.Load();
5983 Chest.Initialize();
5998 itemDropDatabase.Populate();
6004 ShopHelper = new ShopHelper();
6006 if (!dedServ)
6007 {
6010 }
6011 if (!dedServ)
6012 {
6015 }
6016 else
6017 {
6018 Mount.Initialize();
6020 }
6022 if (treeBGSet1[0] == 173)
6023 {
6025 }
6026 if (treeBGSet1[0] == 173)
6027 {
6029 }
6032 WorldGen.Hooks.OnWorldLoad += ResetGameCounter;
6033 bgAlphaFrontLayer[0] = 1f;
6034 bgAlphaFarBackLayer[0] = 1f;
6035 invBottom = 258;
6039 for (int i = 1; i < ProjectileID.Count; i++)
6040 {
6041 Projectile obj = new Projectile();
6042 obj.SetDefaults(i);
6043 if (obj.hostile)
6044 {
6045 projHostile[i] = true;
6046 }
6047 if (obj.aiStyle == 7)
6048 {
6049 projHook[i] = true;
6050 }
6051 }
6052 for (int j = 0; j < Recipe.maxRecipes; j++)
6053 {
6054 recipe[j] = new Recipe();
6055 availableRecipeY[j] = 65 * j;
6056 }
6059 for (int k = 0; k < Liquid.maxLiquid; k++)
6060 {
6061 liquid[k] = new Liquid();
6062 }
6063 for (int l = 0; l < 50000; l++)
6064 {
6065 liquidBuffer[l] = new LiquidBuffer();
6066 }
6067 shop[0] = new Chest();
6069 for (int m = 1; m < 100; m++)
6070 {
6071 shop[m] = new Chest();
6072 shop[m].SetupShop(m);
6073 }
6075 teamColor[1] = new Microsoft.Xna.Framework.Color(218, 59, 59);
6076 teamColor[2] = new Microsoft.Xna.Framework.Color(59, 218, 85);
6077 teamColor[3] = new Microsoft.Xna.Framework.Color(59, 149, 218);
6078 teamColor[4] = new Microsoft.Xna.Framework.Color(242, 221, 100);
6079 teamColor[5] = new Microsoft.Xna.Framework.Color(224, 100, 242);
6084 if (menuMode == 1)
6085 {
6086 LoadPlayers();
6087 }
6088 if (skipMenu)
6089 {
6091 gameMenu = false;
6092 LoadPlayers();
6093 PlayerList[0].SetAsActive();
6094 LoadWorlds();
6095 WorldGen.GenerateWorld(new UnifiedRandom().Next());
6097 player[myPlayer].Spawn(PlayerSpawnContext.SpawningIntoWorld);
6098 }
6099 else if (Platform.IsWindows && !dedServ)
6100 {
6101 IntPtr systemMenu = GetSystemMenu(base.Window.Handle, bRevert: false);
6104 }
6105 if (!dedServ)
6106 {
6108 Star.SpawnStars();
6110 }
6111 }
6112
6113 private void Initialize_Entities()
6114 {
6115 for (int i = 0; i < maxMenuItems; i++)
6116 {
6117 menuItemScale[i] = 0.8f;
6118 }
6119 for (int j = 0; j < 6001; j++)
6120 {
6121 dust[j] = new Dust();
6122 dust[j].dustIndex = j;
6123 }
6124 for (int k = 0; k < 401; k++)
6125 {
6126 item[k] = new Item();
6127 item[k].whoAmI = k;
6128 }
6129 for (int l = 0; l < 201; l++)
6130 {
6131 npc[l] = new NPC();
6132 npc[l].whoAmI = l;
6133 }
6134 for (int m = 0; m < 256; m++)
6135 {
6136 player[m] = new Player();
6137 player[m].whoAmI = m;
6138 }
6139 for (int n = 0; n < 1001; n++)
6140 {
6141 projectile[n] = new Projectile();
6142 projectile[n].whoAmI = n;
6143 }
6144 for (int num = 0; num < 601; num++)
6145 {
6146 gore[num] = new Gore();
6147 }
6148 for (int num2 = 0; num2 < maxRain + 1; num2++)
6149 {
6150 rain[num2] = new Rain();
6151 }
6152 for (int num3 = 0; num3 < 200; num3++)
6153 {
6154 cloud[num3] = new Cloud();
6155 }
6156 for (int num4 = 0; num4 < 100; num4++)
6157 {
6158 combatText[num4] = new CombatText();
6159 }
6160 for (int num5 = 0; num5 < 20; num5++)
6161 {
6162 popupText[num5] = new PopupText();
6163 }
6164 }
6165
6166 private static void Initialize_Items()
6167 {
6168 for (int i = 0; i < ItemID.Count; i++)
6169 {
6170 Item item = new Item();
6171 item.SetDefaults(i);
6172 if (item.headSlot > 0)
6173 {
6174 Item.headType[item.headSlot] = item.type;
6175 }
6176 if (item.bodySlot > 0)
6177 {
6178 Item.bodyType[item.bodySlot] = item.type;
6179 }
6180 if (item.legSlot > 0)
6181 {
6182 Item.legType[item.legSlot] = item.type;
6183 }
6184 switch (item.type)
6185 {
6186 case 683:
6187 case 723:
6188 case 726:
6189 case 739:
6190 case 740:
6191 case 741:
6192 case 742:
6193 case 743:
6194 case 744:
6195 case 788:
6196 case 1296:
6197 case 1308:
6198 case 1326:
6199 case 1444:
6200 case 1445:
6201 case 1446:
6202 case 1801:
6203 case 1930:
6204 case 1931:
6205 case 2188:
6206 case 2750:
6207 case 3006:
6208 case 3051:
6209 case 3209:
6210 case 3210:
6211 case 3377:
6212 case 3476:
6213 case 3569:
6214 case 3571:
6215 case 3787:
6216 case 3852:
6217 case 3870:
6218 case 4062:
6219 case 5065:
6220 Item.staff[item.type] = true;
6221 break;
6222 case 1827:
6223 Item.claw[item.type] = true;
6224 break;
6225 }
6226 }
6227 }
6228
6229 private static void Initialize_TileAndNPCData2()
6230 {
6231 critterCage = true;
6232 for (int i = 0; i < 3600; i++)
6233 {
6235 }
6236 critterCage = false;
6237 tileBlockLight[549] = true;
6238 tileBrick[477] = true;
6239 tileSolid[477] = true;
6240 tileBlockLight[477] = true;
6241 tileBrick[492] = true;
6242 tileSolid[492] = true;
6243 tileBlockLight[492] = true;
6244 tileSolidTop[275] = true;
6245 tileSolidTop[280] = true;
6246 tileSolidTop[276] = true;
6247 tileSolidTop[277] = true;
6248 tileSolidTop[278] = true;
6249 tileSolidTop[279] = true;
6250 tileSolidTop[281] = true;
6251 tileSolidTop[605] = true;
6252 tileSolidTop[604] = true;
6253 tileSolidTop[603] = true;
6254 tileSolidTop[602] = true;
6255 tileSolidTop[601] = true;
6256 tileSolidTop[599] = true;
6257 tileSolidTop[600] = true;
6258 tileSolidTop[612] = true;
6259 tileSolidTop[611] = true;
6260 tileSolidTop[610] = true;
6261 tileSolidTop[609] = true;
6262 tileSolidTop[608] = true;
6263 tileSolidTop[606] = true;
6264 tileSolidTop[607] = true;
6265 tileSolidTop[558] = true;
6266 tileSolidTop[554] = true;
6267 tileSolidTop[553] = true;
6268 tileSolidTop[551] = true;
6269 tileSolidTop[550] = true;
6270 tileSolidTop[542] = true;
6271 tileSolidTop[413] = true;
6272 tileSolidTop[309] = true;
6273 tileSolidTop[297] = true;
6274 tileSolidTop[296] = true;
6275 tileSolidTop[645] = true;
6276 tileSolidTop[643] = true;
6277 tileSolidTop[644] = true;
6278 tileSolidTop[632] = true;
6279 tileSolidTop[640] = true;
6280 tileSolidTop[559] = true;
6281 tileSolidTop[414] = true;
6282 tileSolidTop[359] = true;
6283 tileSolidTop[358] = true;
6284 tileSolidTop[285] = true;
6285 tileSolidTop[286] = true;
6286 tileSolidTop[582] = true;
6287 tileSolidTop[555] = true;
6288 tileSolidTop[538] = true;
6289 tileSolidTop[533] = true;
6290 tileSolidTop[532] = true;
6291 tileSolidTop[394] = true;
6292 tileSolidTop[393] = true;
6293 tileSolidTop[392] = true;
6294 tileSolidTop[391] = true;
6295 tileSolidTop[339] = true;
6296 tileSolidTop[310] = true;
6297 tileSolidTop[299] = true;
6298 tileSolidTop[298] = true;
6299 tileSolidTop[629] = true;
6300 tileSolidTop[619] = true;
6301 tileSolidTop[556] = true;
6302 tileSolidTop[544] = true;
6303 tileSolidTop[364] = true;
6304 tileSolidTop[363] = true;
6305 tileSolidTop[362] = true;
6306 tileSolidTop[361] = true;
6307 tileTable[280] = true;
6308 tileTable[275] = true;
6309 tileTable[276] = true;
6310 tileTable[277] = true;
6311 tileTable[278] = true;
6312 tileTable[279] = true;
6313 tileTable[281] = true;
6314 tileTable[605] = true;
6315 tileTable[604] = true;
6316 tileTable[603] = true;
6317 tileTable[602] = true;
6318 tileTable[601] = true;
6319 tileTable[599] = true;
6320 tileTable[600] = true;
6321 tileTable[612] = true;
6322 tileTable[611] = true;
6323 tileTable[610] = true;
6324 tileTable[609] = true;
6325 tileTable[608] = true;
6326 tileTable[606] = true;
6327 tileTable[607] = true;
6328 tileTable[558] = true;
6329 tileTable[554] = true;
6330 tileTable[553] = true;
6331 tileTable[551] = true;
6332 tileTable[550] = true;
6333 tileTable[542] = true;
6334 tileTable[413] = true;
6335 tileTable[309] = true;
6336 tileTable[297] = true;
6337 tileTable[296] = true;
6338 tileTable[645] = true;
6339 tileTable[643] = true;
6340 tileTable[644] = true;
6341 tileTable[632] = true;
6342 tileTable[640] = true;
6343 tileTable[559] = true;
6344 tileTable[414] = true;
6345 tileTable[359] = true;
6346 tileTable[358] = true;
6347 tileTable[285] = true;
6348 tileTable[286] = true;
6349 tileTable[582] = true;
6350 tileTable[555] = true;
6351 tileTable[538] = true;
6352 tileTable[533] = true;
6353 tileTable[532] = true;
6354 tileTable[394] = true;
6355 tileTable[393] = true;
6356 tileTable[392] = true;
6357 tileTable[391] = true;
6358 tileTable[339] = true;
6359 tileTable[310] = true;
6360 tileTable[299] = true;
6361 tileTable[298] = true;
6362 tileTable[629] = true;
6363 tileTable[619] = true;
6364 tileTable[556] = true;
6365 tileTable[544] = true;
6366 tileTable[364] = true;
6367 tileTable[363] = true;
6368 tileTable[362] = true;
6369 tileTable[361] = true;
6370 tileBrick[1] = true;
6371 tileBrick[54] = true;
6372 tileBrick[118] = true;
6373 tileBrick[119] = true;
6374 tileBrick[120] = true;
6375 tileBrick[121] = true;
6376 tileBrick[122] = true;
6377 tileBrick[140] = true;
6378 tileBrick[148] = true;
6379 tileBrick[150] = true;
6380 tileBrick[151] = true;
6381 tileBrick[152] = true;
6382 tileBrick[30] = true;
6383 tileBrick[38] = true;
6384 tileBrick[39] = true;
6385 tileBrick[41] = true;
6386 tileBrick[43] = true;
6387 tileBrick[44] = true;
6388 tileBrick[481] = true;
6389 tileBrick[482] = true;
6390 tileBrick[483] = true;
6391 tileBrick[45] = true;
6392 tileBrick[46] = true;
6393 tileBrick[47] = true;
6394 tileBrick[75] = true;
6395 tileBrick[76] = true;
6396 tileBrick[160] = true;
6397 tileBrick[2] = true;
6398 tileBrick[199] = true;
6399 tileBrick[23] = true;
6400 tileBrick[60] = true;
6401 tileBrick[70] = true;
6402 tileBrick[109] = true;
6403 tileBrick[53] = true;
6404 tileBrick[57] = true;
6405 tileBrick[116] = true;
6406 tileBrick[234] = true;
6407 tileBrick[112] = true;
6408 tileBrick[147] = true;
6409 tileBrick[153] = true;
6410 tileBrick[154] = true;
6411 tileBrick[155] = true;
6412 tileBrick[156] = true;
6413 tileBrick[157] = true;
6414 tileBrick[158] = true;
6415 tileBrick[159] = true;
6416 tileBrick[273] = true;
6417 tileBrick[274] = true;
6418 tileMergeDirt[202] = true;
6419 tileBrick[202] = true;
6420 tileSolid[202] = true;
6421 tileBlockLight[202] = true;
6422 tileMergeDirt[498] = true;
6423 tileBrick[161] = true;
6424 tileBlockLight[161] = true;
6425 tileBlockLight[163] = true;
6426 tileBlockLight[164] = true;
6427 tileSolid[188] = true;
6428 tileBlockLight[188] = true;
6429 tileBrick[188] = true;
6430 tileMergeDirt[188] = true;
6431 tileBrick[179] = true;
6432 tileSolid[179] = true;
6433 tileBlockLight[179] = true;
6434 tileMoss[179] = true;
6435 tileBrick[381] = true;
6436 tileSolid[381] = true;
6437 tileBlockLight[381] = true;
6438 tileMoss[381] = true;
6439 tileBrick[534] = true;
6440 tileSolid[534] = true;
6441 tileBlockLight[534] = true;
6442 tileMoss[534] = true;
6443 tileBrick[536] = true;
6444 tileSolid[536] = true;
6445 tileBlockLight[536] = true;
6446 tileMoss[536] = true;
6447 tileBrick[539] = true;
6448 tileSolid[539] = true;
6449 tileBlockLight[539] = true;
6450 tileMoss[539] = true;
6451 tileBrick[625] = true;
6452 tileSolid[625] = true;
6453 tileBlockLight[625] = true;
6454 tileMoss[625] = true;
6455 tileBrick[627] = true;
6456 tileSolid[627] = true;
6457 tileBlockLight[627] = true;
6458 tileMoss[627] = true;
6459 tileBrick[180] = true;
6460 tileSolid[180] = true;
6461 tileBlockLight[180] = true;
6462 tileMoss[180] = true;
6463 tileBrick[181] = true;
6464 tileSolid[181] = true;
6465 tileBlockLight[181] = true;
6466 tileMoss[181] = true;
6467 tileBrick[182] = true;
6468 tileSolid[182] = true;
6469 tileBlockLight[182] = true;
6470 tileMoss[182] = true;
6471 tileBrick[183] = true;
6472 tileSolid[183] = true;
6473 tileBlockLight[183] = true;
6474 tileMoss[183] = true;
6475 tileBrick[512] = true;
6476 tileSolid[512] = true;
6477 tileBlockLight[512] = true;
6478 tileBrick[513] = true;
6479 tileSolid[513] = true;
6480 tileBlockLight[513] = true;
6481 tileBrick[514] = true;
6482 tileSolid[514] = true;
6483 tileBlockLight[514] = true;
6484 tileBrick[515] = true;
6485 tileSolid[515] = true;
6486 tileBlockLight[515] = true;
6487 tileBrick[516] = true;
6488 tileSolid[516] = true;
6489 tileBlockLight[516] = true;
6490 tileBrick[517] = true;
6491 tileSolid[517] = true;
6492 tileBlockLight[517] = true;
6493 tileLighted[517] = true;
6494 tileBrick[687] = true;
6495 tileSolid[687] = true;
6496 tileBlockLight[687] = true;
6497 tileLighted[687] = true;
6498 tileBrick[535] = true;
6499 tileSolid[535] = true;
6500 tileBlockLight[535] = true;
6501 tileLighted[535] = true;
6502 tileBrick[689] = true;
6503 tileSolid[689] = true;
6504 tileBlockLight[689] = true;
6505 tileLighted[689] = true;
6506 tileBrick[537] = true;
6507 tileSolid[537] = true;
6508 tileBlockLight[537] = true;
6509 tileLighted[537] = true;
6510 tileBrick[690] = true;
6511 tileSolid[690] = true;
6512 tileBlockLight[690] = true;
6513 tileLighted[690] = true;
6514 tileBrick[540] = true;
6515 tileSolid[540] = true;
6516 tileBlockLight[540] = true;
6517 tileLighted[540] = true;
6518 tileBrick[688] = true;
6519 tileSolid[688] = true;
6520 tileBlockLight[688] = true;
6521 tileLighted[688] = true;
6522 tileBrick[626] = true;
6523 tileSolid[626] = true;
6524 tileBlockLight[626] = true;
6525 tileLighted[626] = true;
6526 tileBrick[691] = true;
6527 tileSolid[691] = true;
6528 tileBlockLight[691] = true;
6529 tileLighted[691] = true;
6530 tileBrick[628] = true;
6531 tileSolid[628] = true;
6532 tileBlockLight[628] = true;
6533 tileLighted[628] = true;
6534 tileBrick[692] = true;
6535 tileSolid[692] = true;
6536 tileBlockLight[692] = true;
6537 tileLighted[692] = true;
6538 tileLighted[592] = true;
6539 tileLighted[656] = true;
6540 tileLighted[356] = true;
6541 tileLighted[663] = true;
6542 tileMergeDirt[177] = true;
6543 tileMergeDirt[190] = true;
6544 tileSolid[196] = true;
6545 tileSolid[197] = true;
6546 tileMergeDirt[197] = true;
6547 tileBlockLight[197] = true;
6548 tileNoSunLight[197] = true;
6549 tileBrick[175] = true;
6550 tileSolid[175] = true;
6551 tileBlockLight[175] = true;
6552 tileBrick[176] = true;
6553 tileSolid[176] = true;
6554 tileBlockLight[176] = true;
6555 tileBrick[177] = true;
6556 tileSolid[177] = true;
6557 tileBlockLight[177] = true;
6558 tileBrick[225] = true;
6559 tileBrick[229] = true;
6560 tileShine[221] = 925;
6561 tileShine[222] = 875;
6562 tileShine[223] = 825;
6563 tileShine2[221] = true;
6564 tileShine2[222] = true;
6565 tileShine2[223] = true;
6566 tileMergeDirt[175] = true;
6567 tileMergeDirt[176] = true;
6568 tileMergeDirt[177] = true;
6569 tileMergeDirt[208] = true;
6570 tileBrick[162] = true;
6571 tileSolid[162] = true;
6572 tileBlockLight[162] = false;
6573 tileBrick[163] = true;
6574 tileSolid[163] = true;
6575 tileBrick[164] = true;
6576 tileSolid[164] = true;
6577 tileShine2[6] = true;
6578 tileShine2[7] = true;
6579 tileShine2[8] = true;
6580 tileShine2[9] = true;
6581 tileShine2[166] = true;
6582 tileShine2[167] = true;
6583 tileShine2[168] = true;
6584 tileShine2[169] = true;
6585 tileShine2[12] = true;
6586 tileShine2[21] = true;
6587 tileShine2[467] = true;
6588 tileShine2[441] = true;
6589 tileShine2[468] = true;
6590 tileShine2[22] = true;
6591 tileShine2[25] = true;
6592 tileShine2[45] = true;
6593 tileShine2[46] = true;
6594 tileShine2[47] = true;
6595 tileShine2[63] = true;
6596 tileShine2[64] = true;
6597 tileShine2[65] = true;
6598 tileShine2[66] = true;
6599 tileShine2[67] = true;
6600 tileShine2[68] = true;
6601 tileShine2[566] = true;
6602 tileShine2[107] = true;
6603 tileShine2[108] = true;
6604 tileShine2[111] = true;
6605 tileShine2[121] = true;
6606 tileShine2[122] = true;
6607 tileShine2[117] = true;
6608 tileShine2[211] = true;
6609 tileShine2[682] = true;
6610 tileShine2[681] = true;
6611 tileShine2[680] = true;
6612 tileShine2[685] = true;
6613 tileShine2[686] = true;
6614 tileShine[129] = 300;
6615 tileNoFail[81] = true;
6616 tileCracked[481] = true;
6617 tileCracked[482] = true;
6618 tileCracked[483] = true;
6619 tileNoFail[481] = true;
6620 tileNoFail[482] = true;
6621 tileNoFail[483] = true;
6622 tileNoFail[330] = true;
6623 tileNoFail[331] = true;
6624 tileNoFail[332] = true;
6625 tileNoFail[333] = true;
6626 tileNoFail[254] = true;
6627 tileNoFail[324] = true;
6628 tileNoFail[129] = true;
6629 tileNoFail[192] = true;
6630 tileHammer[26] = true;
6631 tileHammer[31] = true;
6632 tileAxe[5] = true;
6633 tileAxe[72] = true;
6634 tileAxe[80] = true;
6635 tileAxe[488] = true;
6636 tileAxe[323] = true;
6637 tileAxe[596] = true;
6638 tileAxe[616] = true;
6639 tileAxe[634] = true;
6640 tileAxe[589] = true;
6641 tileAxe[584] = true;
6642 tileAxe[588] = true;
6643 tileAxe[586] = true;
6644 tileAxe[587] = true;
6645 tileAxe[585] = true;
6646 tileAxe[583] = true;
6647 tileBrick[59] = true;
6648 tileBrick[234] = true;
6649 tileSolid[234] = true;
6650 tileMergeDirt[234] = true;
6651 tileSand[53] = true;
6652 tileSand[112] = true;
6653 tileSand[116] = true;
6654 tileSand[234] = true;
6655 tileFrameImportant[630] = true;
6656 tileLavaDeath[630] = true;
6657 tileNoSunLight[630] = true;
6658 tileFrameImportant[631] = true;
6659 tileLavaDeath[631] = true;
6660 tileNoSunLight[631] = true;
6661 tileFrameImportant[571] = true;
6662 tileLavaDeath[571] = true;
6663 tileFrameImportant[579] = true;
6664 tileLavaDeath[579] = true;
6665 tileFrameImportant[591] = true;
6666 tileLavaDeath[591] = true;
6667 tileFrameImportant[592] = true;
6668 tileLavaDeath[592] = false;
6669 tileFrameImportant[538] = true;
6670 tileLavaDeath[538] = true;
6671 tileFrameImportant[544] = true;
6672 tileLavaDeath[544] = true;
6673 tileFrameImportant[629] = true;
6674 tileLavaDeath[629] = true;
6675 tileFrameImportant[550] = true;
6676 tileLavaDeath[550] = true;
6677 tileFrameImportant[551] = true;
6678 tileLavaDeath[551] = true;
6679 tileFrameImportant[533] = true;
6680 tileLavaDeath[533] = true;
6681 tileFrameImportant[553] = true;
6682 tileLavaDeath[553] = true;
6683 tileFrameImportant[554] = true;
6684 tileLavaDeath[554] = true;
6685 tileFrameImportant[555] = true;
6686 tileLavaDeath[555] = true;
6687 tileFrameImportant[556] = true;
6688 tileLavaDeath[556] = true;
6689 tileFrameImportant[558] = true;
6690 tileLavaDeath[558] = true;
6691 tileFrameImportant[559] = true;
6692 tileLavaDeath[559] = true;
6693 tileFrameImportant[599] = true;
6694 tileLavaDeath[599] = true;
6695 tileFrameImportant[600] = true;
6696 tileLavaDeath[600] = true;
6697 tileFrameImportant[601] = true;
6698 tileLavaDeath[601] = true;
6699 tileFrameImportant[602] = true;
6700 tileLavaDeath[602] = true;
6701 tileFrameImportant[603] = true;
6702 tileLavaDeath[603] = true;
6703 tileFrameImportant[604] = true;
6704 tileLavaDeath[604] = true;
6705 tileFrameImportant[605] = true;
6706 tileLavaDeath[605] = true;
6707 tileFrameImportant[606] = true;
6708 tileLavaDeath[606] = true;
6709 tileFrameImportant[607] = true;
6710 tileLavaDeath[607] = true;
6711 tileFrameImportant[608] = true;
6712 tileLavaDeath[608] = true;
6713 tileFrameImportant[609] = true;
6714 tileLavaDeath[609] = true;
6715 tileFrameImportant[610] = true;
6716 tileLavaDeath[610] = true;
6717 tileFrameImportant[611] = true;
6718 tileLavaDeath[611] = true;
6719 tileFrameImportant[612] = true;
6720 tileLavaDeath[612] = true;
6721 tileFrameImportant[632] = true;
6722 tileLavaDeath[632] = true;
6723 tileFrameImportant[640] = true;
6724 tileLavaDeath[640] = true;
6725 tileFrameImportant[643] = true;
6726 tileLavaDeath[643] = true;
6727 tileFrameImportant[644] = true;
6728 tileLavaDeath[644] = true;
6729 tileFrameImportant[645] = true;
6730 tileLavaDeath[645] = true;
6731 tileFrameImportant[568] = true;
6732 tileNoAttach[568] = true;
6733 tileLavaDeath[568] = true;
6734 tileLighted[568] = true;
6735 tileFrameImportant[569] = true;
6736 tileNoAttach[569] = true;
6737 tileLavaDeath[569] = true;
6738 tileLighted[569] = true;
6739 tileFrameImportant[570] = true;
6740 tileNoAttach[570] = true;
6741 tileLavaDeath[570] = true;
6742 tileLighted[570] = true;
6743 tileFrameImportant[580] = true;
6744 tileNoAttach[580] = true;
6745 tileLavaDeath[580] = true;
6746 tileLighted[580] = true;
6747 tileFrameImportant[582] = true;
6748 tileLavaDeath[582] = true;
6749 tileLighted[582] = true;
6750 tileFrameImportant[619] = true;
6751 tileLavaDeath[619] = true;
6752 tileLighted[619] = true;
6753 tileFrameImportant[620] = true;
6754 tileNoAttach[620] = true;
6755 tileLavaDeath[620] = true;
6756 tileLighted[620] = true;
6757 tileFrameImportant[572] = true;
6758 tileNoAttach[572] = true;
6759 tileLavaDeath[572] = true;
6760 tileLighted[572] = true;
6761 tileFrameImportant[560] = true;
6762 tileLavaDeath[560] = true;
6763 tileFrameImportant[564] = true;
6764 tileNoAttach[564] = true;
6765 tileLavaDeath[564] = true;
6766 tileLighted[564] = true;
6767 tileFrameImportant[567] = true;
6768 tileLavaDeath[567] = true;
6769 tileFrameImportant[565] = true;
6770 tileNoAttach[565] = true;
6771 tileLavaDeath[565] = true;
6772 tileFrameImportant[593] = true;
6773 tileNoAttach[593] = true;
6774 tileLavaDeath[593] = false;
6775 tileLighted[593] = true;
6776 tileFrameImportant[594] = true;
6777 tileNoAttach[594] = true;
6778 tileLavaDeath[594] = false;
6779 tileLighted[594] = true;
6780 tileLighted[548] = true;
6781 tileLighted[613] = true;
6782 tileLighted[614] = true;
6783 tileFrameImportant[654] = true;
6784 tileCut[654] = true;
6785 tileNoFail[654] = true;
6786 tileLavaDeath[654] = true;
6787 tileFrameImportant[518] = true;
6788 tileCut[518] = true;
6789 tileNoFail[518] = true;
6790 tileFrameImportant[519] = true;
6791 tileCut[519] = true;
6792 tileNoFail[519] = true;
6793 tileLighted[519] = true;
6794 tileFrameImportant[549] = true;
6795 tileCut[549] = true;
6796 tileNoFail[549] = true;
6797 tileFrameImportant[529] = true;
6798 tileCut[529] = true;
6799 tileNoFail[529] = true;
6800 tileLavaDeath[529] = true;
6801 tileFrameImportant[637] = true;
6802 tileCut[637] = true;
6803 tileNoFail[637] = true;
6804 tileLavaDeath[637] = false;
6805 tileLighted[637] = true;
6806 tileFrameImportant[530] = true;
6807 tileNoFail[530] = true;
6808 tileLavaDeath[530] = true;
6809 tileFrameImportant[233] = true;
6810 tileFrameImportant[485] = true;
6811 tileLighted[215] = true;
6812 tileFrameImportant[227] = true;
6813 tileFrameImportant[228] = true;
6814 tileFrameImportant[231] = true;
6815 tileCut[231] = true;
6816 tileFrameImportant[216] = true;
6817 tileFrameImportant[217] = true;
6818 tileFrameImportant[218] = true;
6819 tileFrameImportant[219] = true;
6820 tileFrameImportant[642] = true;
6821 tileFrameImportant[220] = true;
6822 tileFrameImportant[338] = true;
6823 tileFrameImportant[453] = true;
6824 tileFrameImportant[456] = true;
6825 tileFrameImportant[165] = true;
6826 tileFrameImportant[209] = true;
6827 tileFrameImportant[215] = true;
6828 tileFrameImportant[210] = true;
6829 tileFrameImportant[212] = true;
6830 tileFrameImportant[207] = true;
6831 tileFrameImportant[178] = true;
6832 tileFrameImportant[184] = true;
6833 tileFrameImportant[185] = true;
6834 tileFrameImportant[186] = true;
6835 tileFrameImportant[187] = true;
6836 tileFrameImportant[173] = true;
6837 tileFrameImportant[174] = true;
6838 tileLighted[173] = true;
6839 tileLighted[174] = true;
6840 tileFrameImportant[139] = true;
6841 tileLighted[160] = true;
6842 tileLighted[149] = true;
6843 tileFrameImportant[149] = true;
6844 tileFrameImportant[142] = true;
6845 tileFrameImportant[143] = true;
6846 tileFrameImportant[144] = true;
6847 tileStone[131] = true;
6848 tileFrameImportant[136] = true;
6849 tileFrameImportant[137] = true;
6850 tileFrameImportant[138] = true;
6851 tileFrameImportant[664] = true;
6852 tileFrameImportant[665] = true;
6853 tileFrameImportant[484] = true;
6854 tileLavaDeath[484] = true;
6855 tileNoFail[484] = true;
6856 tileBlockLight[137] = true;
6857 tileSolid[137] = true;
6858 tileBlockLight[160] = true;
6859 tileSolid[160] = true;
6860 tileMergeDirt[160] = true;
6861 tileBlockLight[161] = true;
6862 tileSolid[161] = true;
6863 tileBlockLight[145] = true;
6864 tileSolid[145] = true;
6865 tileMergeDirt[145] = true;
6866 tileBlockLight[146] = true;
6867 tileSolid[146] = true;
6868 tileMergeDirt[146] = true;
6869 tileBlockLight[147] = true;
6870 tileSolid[147] = true;
6871 tileBlockLight[148] = true;
6872 tileSolid[148] = true;
6873 tileMergeDirt[148] = true;
6874 tileSolid[138] = true;
6875 tileSolid[664] = true;
6876 tileSolid[484] = true;
6877 tileCut[484] = true;
6878 tileBlockLight[140] = true;
6879 tileSolid[140] = true;
6880 tileBlockLight[151] = true;
6881 tileSolid[151] = true;
6882 tileMergeDirt[151] = true;
6883 tileBlockLight[152] = true;
6884 tileSolid[152] = true;
6885 tileMergeDirt[152] = true;
6886 tileBlockLight[153] = true;
6887 tileSolid[153] = true;
6888 tileMergeDirt[153] = true;
6889 tileBlockLight[154] = true;
6890 tileSolid[154] = true;
6891 tileMergeDirt[154] = true;
6892 tileBlockLight[155] = true;
6893 tileSolid[155] = true;
6894 tileMergeDirt[155] = true;
6895 tileBlockLight[156] = true;
6896 tileSolid[156] = true;
6897 tileMergeDirt[156] = true;
6898 tileMergeDirt[150] = true;
6899 tileBlockLight[157] = true;
6900 tileSolid[157] = true;
6901 tileMergeDirt[157] = true;
6902 tileBlockLight[158] = true;
6903 tileSolid[158] = true;
6904 tileMergeDirt[158] = true;
6905 tileBlockLight[159] = true;
6906 tileSolid[159] = true;
6907 tileMergeDirt[159] = true;
6908 tileFrameImportant[320] = true;
6909 tileFrameImportant[49] = true;
6910 tileShine[22] = 1150;
6911 tileShine[6] = 1150;
6912 tileShine[7] = 1100;
6913 tileShine[8] = 1000;
6914 tileShine[9] = 1050;
6915 tileShine[166] = 1125;
6916 tileShine[167] = 1075;
6917 tileShine[168] = 1025;
6918 tileShine[169] = 975;
6919 tileShine[617] = 400;
6920 tileShine[178] = 500;
6921 tileShine2[178] = true;
6922 tileShine[12] = 300;
6923 tileShine[21] = 1200;
6924 tileShine[467] = 1200;
6925 tileShine[441] = 1200;
6926 tileShine[468] = 1200;
6927 tileShine[63] = 900;
6928 tileShine[64] = 900;
6929 tileShine[65] = 900;
6930 tileShine[66] = 900;
6931 tileShine[67] = 900;
6932 tileShine[68] = 900;
6933 tileShine[566] = 900;
6934 tileShine[45] = 1900;
6935 tileShine[680] = 1900;
6936 tileShine[46] = 2000;
6937 tileShine[681] = 2000;
6938 tileShine[47] = 2100;
6939 tileShine[682] = 2100;
6940 tileShine[122] = 1800;
6941 tileShine[686] = 1800;
6942 tileShine[121] = 1850;
6943 tileShine[685] = 1850;
6944 tileShine[125] = 600;
6945 tileShine[109] = 9000;
6946 tileShine[110] = 9000;
6947 tileShine[116] = 9000;
6948 tileShine[117] = 9000;
6949 tileShine[118] = 8000;
6950 tileShine[107] = 950;
6951 tileShine[108] = 900;
6952 tileShine[111] = 850;
6953 tileShine[211] = 500;
6954 tileLighted[4] = true;
6955 tileLighted[17] = true;
6956 tileLighted[133] = true;
6957 tileLighted[31] = true;
6958 tileLighted[33] = true;
6959 tileLighted[34] = true;
6960 tileLighted[35] = true;
6961 tileLighted[37] = true;
6962 tileLighted[42] = true;
6963 tileLighted[49] = true;
6964 tileLighted[58] = true;
6965 tileLighted[61] = true;
6966 tileLighted[70] = true;
6967 tileLighted[71] = true;
6968 tileLighted[72] = true;
6969 tileLighted[76] = true;
6970 tileLighted[684] = true;
6971 tileLighted[77] = true;
6972 tileLighted[19] = true;
6973 tileLighted[22] = true;
6974 tileLighted[26] = true;
6975 tileLighted[83] = true;
6976 tileLighted[84] = true;
6977 tileLighted[92] = true;
6978 tileLighted[93] = true;
6979 tileLighted[95] = true;
6980 tileLighted[98] = true;
6981 tileLighted[100] = true;
6982 tileLighted[109] = true;
6983 tileLighted[125] = true;
6984 tileLighted[126] = true;
6985 tileLighted[129] = true;
6986 tileLighted[140] = true;
6987 tileLighted[270] = true;
6988 tileLighted[271] = true;
6989 tileLighted[581] = true;
6990 tileLighted[660] = true;
6991 tileLighted[578] = true;
6992 tileMergeDirt[1] = true;
6993 tileMergeDirt[6] = true;
6994 tileMergeDirt[7] = true;
6995 tileMergeDirt[8] = true;
6996 tileMergeDirt[9] = true;
6997 tileMergeDirt[166] = true;
6998 tileMergeDirt[167] = true;
6999 tileMergeDirt[168] = true;
7000 tileMergeDirt[169] = true;
7001 tileMergeDirt[22] = true;
7002 tileMergeDirt[25] = true;
7003 tileMergeDirt[30] = true;
7004 tileMergeDirt[37] = true;
7005 tileMergeDirt[38] = true;
7006 tileMergeDirt[40] = true;
7007 tileMergeDirt[53] = true;
7008 tileMergeDirt[56] = true;
7009 tileMergeDirt[107] = true;
7010 tileMergeDirt[108] = true;
7011 tileMergeDirt[111] = true;
7012 tileMergeDirt[112] = true;
7013 tileMergeDirt[116] = true;
7014 tileMergeDirt[117] = true;
7015 tileMergeDirt[123] = true;
7016 tileMergeDirt[140] = true;
7017 tileMergeDirt[39] = true;
7018 tileMergeDirt[122] = true;
7019 tileMergeDirt[121] = true;
7020 tileMergeDirt[120] = true;
7021 tileMergeDirt[119] = true;
7022 tileMergeDirt[118] = true;
7023 tileMergeDirt[47] = true;
7024 tileMergeDirt[46] = true;
7025 tileMergeDirt[45] = true;
7026 tileMergeDirt[41] = true;
7027 tileMergeDirt[43] = true;
7028 tileMergeDirt[44] = true;
7029 tileMergeDirt[481] = true;
7030 tileMergeDirt[482] = true;
7031 tileMergeDirt[483] = true;
7032 tileFrameImportant[380] = true;
7033 tileFrameImportant[201] = true;
7034 tileFrameImportant[3] = true;
7035 tileFrameImportant[4] = true;
7036 tileFrameImportant[5] = true;
7037 tileFrameImportant[10] = true;
7038 tileFrameImportant[11] = true;
7039 tileFrameImportant[12] = true;
7040 tileFrameImportant[13] = true;
7041 tileFrameImportant[14] = true;
7042 tileFrameImportant[469] = true;
7043 tileFrameImportant[486] = true;
7044 tileFrameImportant[488] = true;
7045 tileFrameImportant[487] = true;
7046 tileFrameImportant[489] = true;
7047 tileFrameImportant[490] = true;
7048 tileFrameImportant[15] = true;
7049 tileFrameImportant[497] = true;
7050 tileFrameImportant[16] = true;
7051 tileFrameImportant[17] = true;
7052 tileFrameImportant[18] = true;
7053 tileFrameImportant[19] = true;
7054 tileFrameImportant[20] = true;
7055 tileFrameImportant[21] = true;
7056 tileFrameImportant[467] = true;
7057 tileFrameImportant[441] = true;
7058 tileFrameImportant[468] = true;
7059 tileFrameImportant[24] = true;
7060 tileFrameImportant[26] = true;
7061 tileFrameImportant[27] = true;
7062 tileFrameImportant[28] = true;
7063 tileFrameImportant[29] = true;
7064 tileFrameImportant[31] = true;
7065 tileFrameImportant[33] = true;
7066 tileFrameImportant[34] = true;
7067 tileFrameImportant[35] = true;
7068 tileFrameImportant[42] = true;
7069 tileFrameImportant[50] = true;
7070 tileFrameImportant[55] = true;
7071 tileFrameImportant[61] = true;
7072 tileFrameImportant[71] = true;
7073 tileFrameImportant[72] = true;
7074 tileFrameImportant[73] = true;
7075 tileFrameImportant[74] = true;
7076 tileFrameImportant[77] = true;
7077 tileFrameImportant[78] = true;
7078 tileFrameImportant[79] = true;
7079 tileFrameImportant[81] = true;
7080 tileFrameImportant[82] = true;
7081 tileFrameImportant[83] = true;
7082 tileFrameImportant[84] = true;
7083 tileFrameImportant[85] = true;
7084 tileFrameImportant[86] = true;
7085 tileFrameImportant[87] = true;
7086 tileFrameImportant[88] = true;
7087 tileFrameImportant[89] = true;
7088 tileFrameImportant[90] = true;
7089 tileFrameImportant[91] = true;
7090 tileFrameImportant[92] = true;
7091 tileFrameImportant[93] = true;
7092 tileFrameImportant[94] = true;
7093 tileFrameImportant[95] = true;
7094 tileFrameImportant[96] = true;
7095 tileFrameImportant[97] = true;
7096 tileFrameImportant[98] = true;
7097 tileFrameImportant[99] = true;
7098 tileFrameImportant[101] = true;
7099 tileFrameImportant[102] = true;
7100 tileFrameImportant[103] = true;
7101 tileFrameImportant[104] = true;
7102 tileFrameImportant[105] = true;
7103 tileFrameImportant[100] = true;
7104 tileFrameImportant[106] = true;
7105 tileFrameImportant[110] = true;
7106 tileFrameImportant[113] = true;
7107 tileFrameImportant[114] = true;
7108 tileFrameImportant[125] = true;
7109 tileFrameImportant[287] = true;
7110 tileFrameImportant[126] = true;
7111 tileFrameImportant[128] = true;
7112 tileFrameImportant[129] = true;
7113 tileFrameImportant[132] = true;
7114 tileFrameImportant[133] = true;
7115 tileFrameImportant[134] = true;
7116 tileFrameImportant[135] = true;
7117 tileFrameImportant[172] = true;
7118 tileFrameImportant[319] = true;
7119 tileFrameImportant[323] = true;
7120 tileFrameImportant[335] = true;
7121 tileFrameImportant[337] = true;
7122 tileFrameImportant[349] = true;
7123 tileFrameImportant[376] = true;
7124 tileFrameImportant[378] = true;
7125 tileFrameImportant[425] = true;
7126 tileFrameImportant[465] = true;
7127 tileFrameImportant[506] = true;
7128 tileFrameImportant[510] = true;
7129 tileFrameImportant[511] = true;
7130 tileFrameImportant[531] = true;
7131 tileFrameImportant[545] = true;
7132 tileFrameImportant[547] = true;
7133 tileFrameImportant[548] = true;
7134 tileFrameImportant[552] = true;
7135 tileFrameImportant[573] = true;
7136 tileFrameImportant[613] = true;
7137 tileFrameImportant[614] = true;
7138 tileFrameImportant[621] = true;
7139 tileFrameImportant[622] = true;
7140 tileFrameImportant[623] = true;
7141 tileFrameImportant[624] = true;
7142 tileFrameImportant[656] = true;
7143 tileFrameImportant[141] = true;
7144 tileFrameImportant[270] = true;
7145 tileFrameImportant[271] = true;
7146 tileFrameImportant[581] = true;
7147 tileFrameImportant[660] = true;
7148 tileFrameImportant[314] = true;
7149 tileSolidTop[376] = true;
7150 tileTable[376] = true;
7151 tileTable[380] = true;
7152 tileFrameImportant[583] = true;
7153 tileFrameImportant[584] = true;
7154 tileFrameImportant[585] = true;
7155 tileFrameImportant[586] = true;
7156 tileFrameImportant[587] = true;
7157 tileFrameImportant[588] = true;
7158 tileFrameImportant[589] = true;
7159 tileFrameImportant[590] = true;
7160 tileNoAttach[590] = true;
7161 tileFrameImportant[595] = true;
7162 tileNoAttach[595] = true;
7163 tileFrameImportant[596] = true;
7164 tileFrameImportant[615] = true;
7165 tileNoAttach[615] = true;
7166 tileFrameImportant[616] = true;
7167 tileFrameImportant[634] = true;
7168 tileCut[201] = true;
7169 tileCut[3] = true;
7170 tileCut[24] = true;
7171 tileCut[28] = true;
7172 tileCut[32] = true;
7173 tileCut[51] = true;
7174 tileCut[52] = true;
7175 tileCut[61] = true;
7176 tileCut[62] = true;
7177 tileCut[69] = true;
7178 tileCut[655] = true;
7179 tileCut[71] = true;
7180 tileCut[73] = true;
7181 tileCut[74] = true;
7182 tileCut[82] = true;
7183 tileCut[83] = true;
7184 tileCut[84] = true;
7185 tileCut[110] = true;
7186 tileCut[113] = true;
7187 tileCut[115] = true;
7188 tileCut[184] = true;
7189 tileCut[205] = true;
7190 tileCut[352] = true;
7191 tileCut[382] = true;
7192 tileCut[528] = true;
7193 tileLighted[528] = true;
7194 tileCut[636] = true;
7195 tileCut[638] = true;
7196 tileCut[444] = true;
7197 tileCut[485] = true;
7198 tileAlch[82] = true;
7199 tileAlch[83] = true;
7200 tileAlch[84] = true;
7201 tileSolid[127] = true;
7202 tileSolid[130] = true;
7203 tileBlockLight[130] = true;
7204 tileBlockLight[131] = true;
7205 tileNoAttach[232] = true;
7206 tileSolid[107] = true;
7207 tileBlockLight[107] = true;
7208 tileSolid[108] = true;
7209 tileBlockLight[108] = true;
7210 tileSolid[111] = true;
7211 tileBlockLight[111] = true;
7212 tileSolid[109] = true;
7213 tileBlockLight[109] = true;
7214 tileSolid[110] = false;
7215 tileNoAttach[110] = true;
7216 tileNoFail[110] = true;
7217 tileSolid[112] = true;
7218 tileBlockLight[112] = true;
7219 tileSolid[116] = true;
7220 tileBlockLight[116] = true;
7221 tileBrick[117] = true;
7222 tileBrick[25] = true;
7223 tileBrick[203] = true;
7224 tileSolid[117] = true;
7225 tileBlockLight[117] = true;
7226 tileSolid[123] = true;
7227 tileBlockLight[123] = true;
7228 tileNoFail[165] = true;
7229 tileNoFail[184] = true;
7230 tileNoFail[185] = true;
7231 tileNoFail[186] = true;
7232 tileNoFail[187] = true;
7233 tileSolid[118] = true;
7234 tileBlockLight[118] = true;
7235 tileSolid[119] = true;
7236 tileBlockLight[119] = true;
7237 tileSolid[120] = true;
7238 tileBlockLight[120] = true;
7239 tileSolid[121] = true;
7240 tileBlockLight[121] = true;
7241 tileSolid[122] = true;
7242 tileBlockLight[122] = true;
7243 tileSolid[150] = true;
7244 tileBlockLight[150] = true;
7245 tileBlockLight[115] = true;
7246 tileSolid[199] = true;
7247 tileBlockLight[199] = true;
7248 tileNoFail[162] = true;
7249 tileSolid[0] = true;
7250 tileBlockLight[0] = true;
7251 tileSolid[1] = true;
7252 tileBlockLight[1] = true;
7253 tileSolid[2] = true;
7254 tileBlockLight[2] = true;
7255 tileSolid[3] = false;
7256 tileNoAttach[3] = true;
7257 tileNoFail[3] = true;
7258 tileNoFail[201] = true;
7259 tileSolid[4] = false;
7260 tileNoAttach[4] = true;
7261 tileNoFail[4] = true;
7262 tileNoFail[24] = true;
7263 tileSolid[5] = false;
7264 tileSolid[6] = true;
7265 tileBlockLight[6] = true;
7266 tileSolid[7] = true;
7267 tileBlockLight[7] = true;
7268 tileSolid[8] = true;
7269 tileBlockLight[8] = true;
7270 tileSolid[9] = true;
7271 tileBlockLight[9] = true;
7272 tileSolid[166] = true;
7273 tileBlockLight[166] = true;
7274 tileSolid[167] = true;
7275 tileBlockLight[167] = true;
7276 tileSolid[168] = true;
7277 tileBlockLight[168] = true;
7278 tileSolid[169] = true;
7279 tileBlockLight[169] = true;
7280 tileBlockLight[10] = true;
7281 tileSolid[10] = true;
7282 tileNoAttach[10] = true;
7283 tileBlockLight[10] = true;
7284 tileSolid[11] = false;
7285 tileSolidTop[19] = true;
7286 tileSolid[19] = true;
7287 tileSolid[22] = true;
7288 tileSolid[23] = true;
7289 tileSolid[25] = true;
7290 tileSolid[30] = true;
7291 tileNoFail[32] = true;
7292 tileBlockLight[32] = true;
7293 tileNoFail[352] = true;
7294 tileBlockLight[352] = true;
7295 tileSolid[37] = true;
7296 tileBlockLight[37] = true;
7297 tileSolid[38] = true;
7298 tileBlockLight[38] = true;
7299 tileSolid[39] = true;
7300 tileBlockLight[39] = true;
7301 tileSolid[40] = true;
7302 tileBlockLight[40] = true;
7303 tileSolid[41] = true;
7304 tileBlockLight[41] = true;
7305 tileSolid[43] = true;
7306 tileBlockLight[43] = true;
7307 tileSolid[44] = true;
7308 tileBlockLight[44] = true;
7309 tileSolid[481] = true;
7310 tileBlockLight[481] = true;
7311 tileSolid[482] = true;
7312 tileBlockLight[482] = true;
7313 tileSolid[483] = true;
7314 tileBlockLight[483] = true;
7315 tileSolid[634] = false;
7316 tileFrameImportant[634] = true;
7317 tileLavaDeath[634] = false;
7318 tileBlockLight[634] = false;
7319 tileLighted[634] = true;
7320 tileLighted[20] = true;
7321 tileSolid[45] = true;
7322 tileBlockLight[45] = true;
7323 tileSolid[46] = true;
7324 tileBlockLight[46] = true;
7325 tileSolid[47] = true;
7326 tileBlockLight[47] = true;
7327 tileSolid[48] = true;
7328 tileSolid[53] = true;
7329 tileBlockLight[53] = true;
7330 tileSolid[54] = true;
7331 tileBlockLight[52] = true;
7332 tileBlockLight[205] = true;
7333 tileSolid[56] = true;
7334 tileBlockLight[56] = true;
7335 tileSolid[57] = true;
7336 tileBlockLight[57] = true;
7337 tileSolid[58] = true;
7338 tileBlockLight[58] = true;
7339 tileBlockLight[382] = true;
7340 tileSolid[59] = true;
7341 tileBlockLight[59] = true;
7342 tileSolid[60] = true;
7343 tileBlockLight[60] = true;
7344 tileSolid[63] = true;
7345 tileBlockLight[63] = true;
7346 tileStone[63] = true;
7347 tileStone[130] = true;
7348 tileSolid[64] = true;
7349 tileBlockLight[64] = true;
7350 tileStone[64] = true;
7351 tileSolid[65] = true;
7352 tileBlockLight[65] = true;
7353 tileStone[65] = true;
7354 tileSolid[66] = true;
7355 tileBlockLight[66] = true;
7356 tileStone[66] = true;
7357 tileSolid[67] = true;
7358 tileBlockLight[67] = true;
7359 tileStone[67] = true;
7360 tileSolid[68] = true;
7361 tileBlockLight[68] = true;
7362 tileStone[68] = true;
7363 tileSolid[566] = true;
7364 tileBlockLight[566] = true;
7365 tileStone[566] = true;
7366 tileSolid[75] = true;
7367 tileBlockLight[75] = true;
7368 tileBrick[633] = true;
7369 tileSolid[633] = true;
7370 tileBlockLight[633] = true;
7371 tileLighted[633] = true;
7372 tileSolid[76] = true;
7373 tileBlockLight[76] = true;
7374 tileSolid[70] = true;
7375 tileBlockLight[70] = true;
7376 tileSolid[661] = true;
7377 tileBlockLight[661] = true;
7378 tileBrick[661] = true;
7379 tileSolid[662] = true;
7380 tileBlockLight[662] = true;
7381 tileBrick[662] = true;
7382 tileNoFail[50] = true;
7383 tileNoAttach[50] = true;
7384 tileDungeon[41] = true;
7385 tileDungeon[43] = true;
7386 tileDungeon[44] = true;
7387 tileBlockLight[30] = true;
7388 tileBlockLight[25] = true;
7389 tileBlockLight[23] = true;
7390 tileBlockLight[22] = true;
7391 tileBlockLight[62] = true;
7392 tileSolidTop[18] = true;
7393 tileSolidTop[14] = true;
7394 tileSolidTop[469] = true;
7395 tileSolidTop[16] = true;
7396 tileSolidTop[134] = true;
7397 tileSolidTop[114] = true;
7398 tileNoAttach[20] = true;
7399 tileNoAttach[19] = true;
7400 tileNoAttach[13] = true;
7401 tileNoAttach[14] = true;
7402 tileNoAttach[469] = true;
7403 tileNoAttach[486] = true;
7404 tileNoAttach[488] = true;
7405 tileNoAttach[487] = true;
7406 tileNoAttach[489] = true;
7407 tileNoAttach[490] = true;
7408 tileNoAttach[15] = true;
7409 tileNoAttach[497] = true;
7410 tileNoAttach[16] = true;
7411 tileNoAttach[134] = true;
7412 tileNoAttach[17] = true;
7413 tileNoAttach[18] = true;
7414 tileNoAttach[21] = true;
7415 tileNoAttach[467] = true;
7416 tileNoAttach[441] = true;
7417 tileNoAttach[468] = true;
7418 tileNoAttach[27] = true;
7419 tileNoAttach[114] = true;
7420 tileTable[14] = true;
7421 tileTable[469] = true;
7422 tileTable[18] = true;
7423 tileTable[19] = true;
7424 tileTable[114] = true;
7425 tileNoAttach[86] = true;
7426 tileNoAttach[87] = true;
7427 tileNoAttach[88] = true;
7428 tileNoAttach[89] = true;
7429 tileNoAttach[90] = true;
7430 tileTable[101] = true;
7431 tileNoAttach[101] = true;
7432 tileNoAttach[102] = true;
7433 tileNoAttach[94] = true;
7434 tileNoAttach[95] = true;
7435 tileNoAttach[96] = true;
7436 tileNoAttach[97] = true;
7437 tileNoAttach[98] = true;
7438 tileNoAttach[99] = true;
7439 tileTable[87] = true;
7440 tileTable[88] = true;
7441 tileSolidTop[87] = true;
7442 tileSolidTop[88] = true;
7443 tileSolidTop[101] = true;
7444 tileNoAttach[91] = true;
7445 tileNoAttach[92] = true;
7446 tileNoAttach[93] = true;
7447 tileLighted[190] = true;
7448 tileBlockLight[192] = true;
7449 tileWaterDeath[215] = true;
7450 tileWaterDeath[4] = true;
7451 tileWaterDeath[51] = true;
7452 tileWaterDeath[93] = true;
7453 tileWaterDeath[98] = true;
7454 tileWaterDeath[552] = true;
7455 tileLavaDeath[3] = true;
7456 tileLavaDeath[5] = true;
7457 tileLavaDeath[10] = true;
7458 tileLavaDeath[11] = true;
7459 tileLavaDeath[12] = true;
7460 tileLavaDeath[13] = true;
7461 tileLavaDeath[14] = true;
7462 tileLavaDeath[469] = true;
7463 tileLavaDeath[486] = true;
7464 tileLavaDeath[488] = true;
7465 tileLavaDeath[487] = true;
7466 tileLavaDeath[489] = true;
7467 tileLavaDeath[490] = true;
7468 tileLavaDeath[15] = true;
7469 tileLavaDeath[497] = true;
7470 tileLavaDeath[16] = true;
7471 tileLavaDeath[17] = true;
7472 tileLavaDeath[18] = true;
7473 tileLavaDeath[19] = true;
7474 tileLavaDeath[24] = true;
7475 tileLavaDeath[27] = true;
7476 tileLavaDeath[28] = true;
7477 tileLavaDeath[29] = true;
7478 tileLavaDeath[32] = true;
7479 tileLavaDeath[33] = true;
7480 tileLavaDeath[34] = true;
7481 tileLavaDeath[35] = true;
7482 tileLavaDeath[36] = true;
7483 tileLavaDeath[42] = true;
7484 tileLavaDeath[49] = true;
7485 tileLavaDeath[50] = true;
7486 tileLavaDeath[51] = true;
7487 tileLavaDeath[52] = true;
7488 tileLavaDeath[55] = true;
7489 tileLavaDeath[61] = true;
7490 tileLavaDeath[62] = true;
7491 tileLavaDeath[69] = true;
7492 tileLavaDeath[655] = true;
7493 tileLavaDeath[71] = true;
7494 tileLavaDeath[72] = true;
7495 tileLavaDeath[73] = true;
7496 tileLavaDeath[74] = true;
7497 tileLavaDeath[79] = true;
7498 tileLavaDeath[80] = true;
7499 tileLavaDeath[81] = true;
7500 tileLavaDeath[86] = true;
7501 tileLavaDeath[87] = true;
7502 tileLavaDeath[88] = true;
7503 tileLavaDeath[89] = true;
7504 tileLavaDeath[90] = true;
7505 tileLavaDeath[91] = true;
7506 tileLavaDeath[92] = true;
7507 tileLavaDeath[93] = true;
7508 tileLavaDeath[94] = true;
7509 tileLavaDeath[95] = true;
7510 tileLavaDeath[96] = true;
7511 tileLavaDeath[97] = true;
7512 tileLavaDeath[98] = true;
7513 tileLavaDeath[100] = true;
7514 tileLavaDeath[101] = true;
7515 tileLavaDeath[102] = true;
7516 tileLavaDeath[103] = true;
7517 tileLavaDeath[104] = true;
7518 tileLavaDeath[106] = true;
7519 tileLavaDeath[110] = true;
7520 tileLavaDeath[113] = true;
7521 tileLavaDeath[115] = true;
7522 tileLavaDeath[125] = true;
7523 tileLavaDeath[126] = true;
7524 tileLavaDeath[128] = true;
7525 tileLavaDeath[149] = true;
7526 tileLavaDeath[172] = true;
7527 tileLavaDeath[173] = true;
7528 tileLavaDeath[174] = true;
7529 tileLavaDeath[184] = true;
7530 tileLavaDeath[201] = true;
7531 tileLavaDeath[205] = true;
7532 tileLavaDeath[201] = true;
7533 tileLavaDeath[209] = true;
7534 tileLavaDeath[210] = true;
7535 tileLavaDeath[212] = true;
7536 tileLavaDeath[213] = true;
7537 tileLavaDeath[353] = true;
7538 tileLavaDeath[214] = false;
7539 tileLavaDeath[215] = true;
7540 tileLavaDeath[216] = true;
7541 tileLavaDeath[217] = true;
7542 tileLavaDeath[218] = true;
7543 tileLavaDeath[219] = true;
7544 tileLavaDeath[642] = true;
7545 tileLavaDeath[220] = true;
7546 tileLavaDeath[227] = true;
7547 tileLavaDeath[228] = true;
7548 tileLavaDeath[233] = true;
7549 tileLavaDeath[236] = true;
7550 tileLavaDeath[238] = true;
7551 tileLavaDeath[240] = true;
7552 tileLavaDeath[241] = true;
7553 tileLavaDeath[242] = true;
7554 tileLavaDeath[243] = true;
7555 tileLavaDeath[244] = true;
7556 tileLavaDeath[245] = true;
7557 tileLavaDeath[246] = true;
7558 tileLavaDeath[247] = true;
7559 tileLavaDeath[254] = true;
7560 tileLavaDeath[269] = true;
7561 tileLavaDeath[270] = true;
7562 tileLavaDeath[271] = true;
7563 tileLavaDeath[581] = true;
7564 tileLavaDeath[660] = true;
7565 tileLavaDeath[275] = true;
7566 tileLavaDeath[413] = true;
7567 tileLavaDeath[276] = true;
7568 tileLavaDeath[277] = true;
7569 tileLavaDeath[278] = true;
7570 tileLavaDeath[279] = true;
7571 tileLavaDeath[280] = true;
7572 tileLavaDeath[281] = true;
7573 tileLavaDeath[282] = true;
7574 tileLavaDeath[283] = true;
7575 tileLavaDeath[285] = true;
7576 tileLavaDeath[286] = true;
7577 tileLavaDeath[287] = true;
7578 tileLavaDeath[288] = true;
7579 tileLavaDeath[289] = true;
7580 tileLavaDeath[290] = true;
7581 tileLavaDeath[291] = true;
7582 tileLavaDeath[292] = true;
7583 tileLavaDeath[293] = true;
7584 tileLavaDeath[294] = true;
7585 tileLavaDeath[295] = true;
7586 tileLavaDeath[296] = true;
7587 tileLavaDeath[297] = true;
7588 tileLavaDeath[298] = true;
7589 tileLavaDeath[299] = true;
7590 tileLavaDeath[300] = true;
7591 tileLavaDeath[301] = true;
7592 tileLavaDeath[302] = true;
7593 tileLavaDeath[303] = true;
7594 tileLavaDeath[304] = true;
7595 tileLavaDeath[305] = true;
7596 tileLavaDeath[306] = true;
7597 tileLavaDeath[307] = true;
7598 tileLavaDeath[308] = true;
7599 tileLavaDeath[309] = true;
7600 tileLavaDeath[310] = true;
7601 tileLavaDeath[532] = true;
7602 tileLavaDeath[316] = true;
7603 tileLavaDeath[317] = true;
7604 tileLavaDeath[318] = true;
7605 tileLavaDeath[319] = true;
7606 tileLavaDeath[354] = true;
7607 tileLavaDeath[355] = true;
7608 tileLavaDeath[499] = true;
7609 tileLavaDeath[323] = true;
7610 tileLavaDeath[335] = true;
7611 tileLavaDeath[338] = true;
7612 tileLavaDeath[339] = true;
7613 tileLavaDeath[528] = true;
7614 tileLavaDeath[636] = true;
7615 tileLavaDeath[638] = false;
7616 tileLavaDeath[352] = true;
7617 tileLavaDeath[382] = true;
7618 tileLavaDeath[425] = true;
7619 tileLavaDeath[453] = true;
7620 tileLavaDeath[456] = true;
7621 tileLavaDeath[463] = true;
7622 tileLavaDeath[464] = true;
7623 tileLavaDeath[465] = true;
7624 tileLavaDeath[485] = true;
7625 tileLavaDeath[511] = true;
7626 tileLavaDeath[510] = true;
7627 tileLavaDeath[547] = true;
7628 tileLavaDeath[548] = true;
7629 tileLavaDeath[552] = true;
7630 tileLavaDeath[573] = true;
7631 tileLavaDeath[621] = true;
7632 tileLavaDeath[622] = true;
7633 tileLavaDeath[623] = true;
7634 tileLavaDeath[624] = true;
7635 tileLavaDeath[656] = true;
7636 tileLighted[316] = true;
7637 tileLighted[317] = true;
7638 tileLighted[318] = true;
7639 tileFrameImportant[493] = true;
7640 tileLavaDeath[493] = true;
7641 for (int j = 0; j < TileID.Count; j++)
7642 {
7643 if (tileLavaDeath[j])
7644 {
7645 tileObsidianKill[j] = true;
7646 }
7647 }
7648 tileObsidianKill[546] = true;
7649 tileObsidianKill[77] = true;
7650 tileObsidianKill[78] = true;
7651 tileObsidianKill[82] = true;
7652 tileObsidianKill[83] = true;
7653 tileObsidianKill[84] = true;
7654 tileObsidianKill[85] = true;
7655 tileObsidianKill[105] = true;
7656 tileObsidianKill[129] = true;
7657 tileObsidianKill[132] = true;
7658 tileObsidianKill[133] = true;
7659 tileObsidianKill[134] = true;
7660 tileObsidianKill[135] = true;
7661 tileObsidianKill[136] = true;
7662 tileObsidianKill[139] = true;
7663 tileObsidianKill[165] = true;
7664 tileObsidianKill[178] = true;
7665 tileObsidianKill[185] = true;
7666 tileObsidianKill[186] = true;
7667 tileObsidianKill[187] = true;
7668 tileObsidianKill[231] = true;
7669 tileObsidianKill[337] = true;
7670 tileObsidianKill[349] = true;
7671 tileObsidianKill[506] = true;
7672 tileObsidianKill[314] = true;
7673 tileSolid[384] = true;
7674 tileBlockLight[384] = true;
7675 tileNoFail[384] = true;
7676 tileFrameImportant[395] = true;
7677 tileLavaDeath[395] = true;
7678 tileFrameImportant[520] = true;
7679 tileLavaDeath[520] = true;
7680 tileLavaDeath[471] = true;
7681 tileFrameImportant[405] = true;
7682 tileLavaDeath[405] = true;
7683 tileSolidTop[405] = true;
7684 tileTable[405] = true;
7685 tileLighted[405] = true;
7686 tileWaterDeath[405] = true;
7687 tileFrameImportant[406] = true;
7688 tileLavaDeath[406] = true;
7689 tileFrameImportant[452] = true;
7690 tileLavaDeath[452] = true;
7691 tileFrameImportant[411] = true;
7692 tileLavaDeath[411] = false;
7693 tileFrameImportant[457] = true;
7694 tileLavaDeath[457] = true;
7695 tileFrameImportant[462] = true;
7696 tileFrameImportant[454] = true;
7697 tileLavaDeath[454] = true;
7698 tileCut[454] = true;
7699 tileFrameImportant[494] = true;
7700 tileLavaDeath[494] = true;
7701 tileFrameImportant[455] = true;
7702 tileFrameImportant[412] = true;
7703 for (int k = 0; k < WallID.Count; k++)
7704 {
7705 int num = WallID.Sets.BlendType[k];
7706 if (num >= 0 && num < WallID.Count)
7707 {
7708 wallBlend[k] = num;
7709 }
7710 else
7711 {
7712 wallBlend[k] = k;
7713 }
7714 }
7715 tileNoFail[24] = true;
7716 tileNoFail[3] = true;
7717 tileNoFail[52] = true;
7718 tileNoFail[62] = true;
7719 tileNoFail[32] = true;
7720 tileNoFail[61] = true;
7721 tileNoFail[69] = true;
7722 tileNoFail[655] = true;
7723 tileNoFail[73] = true;
7724 tileNoFail[74] = true;
7725 tileNoFail[82] = true;
7726 tileNoFail[83] = true;
7727 tileNoFail[84] = true;
7728 tileNoFail[110] = true;
7729 tileNoFail[113] = true;
7730 tileNoFail[115] = true;
7731 tileNoFail[165] = true;
7732 tileNoFail[184] = true;
7733 tileNoFail[201] = true;
7734 tileNoFail[205] = true;
7735 tileNoFail[227] = true;
7736 tileNoFail[233] = true;
7737 tileNoFail[624] = true;
7738 tileNoFail[352] = true;
7739 tileNoFail[382] = true;
7740 tileNoFail[528] = true;
7741 tileNoFail[485] = true;
7742 tileNoFail[636] = true;
7743 tileNoFail[638] = true;
7744 tileNoFail[656] = true;
7745 tileLighted[638] = true;
7746 tileFrameImportant[387] = true;
7747 tileSolid[387] = true;
7748 tileBlockLight[387] = true;
7749 tileNoAttach[387] = true;
7750 tileLavaDeath[387] = true;
7751 tileFrameImportant[386] = true;
7752 tileLavaDeath[386] = true;
7753 tileNoSunLight[386] = true;
7754 tileFrameImportant[388] = true;
7755 tileSolid[388] = true;
7756 tileBlockLight[388] = true;
7757 tileNoAttach[388] = true;
7758 tileLavaDeath[388] = true;
7759 tileFrameImportant[389] = true;
7760 tileLavaDeath[389] = true;
7761 tileNoSunLight[389] = true;
7762 for (int l = 0; l < TileID.Count; l++)
7763 {
7764 if (tileSolid[l])
7765 {
7766 tileNoSunLight[l] = true;
7767 }
7768 tileFrame[l] = 0;
7769 tileFrameCounter[l] = 0;
7770 }
7771 tileNoSunLight[546] = false;
7772 tileNoSunLight[379] = false;
7773 tileNoSunLight[54] = false;
7774 tileNoSunLight[328] = false;
7775 tileNoSunLight[459] = false;
7776 tileNoSunLight[19] = false;
7777 tileNoSunLight[11] = true;
7778 tileNoSunLight[189] = false;
7779 tileNoSunLight[196] = false;
7780 tileNoSunLight[48] = false;
7781 tileNoSunLight[232] = false;
7782 tileNoSunLight[460] = false;
7783 tileNoSunLight[541] = false;
7784 tileNoSunLight[388] = false;
7791 tileFrameImportant[653] = true;
7792 }
7793
7794 private static void AddEchoFurnitureTile(int tileId)
7795 {
7796 tileFrameImportant[tileId] = true;
7797 tileNoFail[tileId] = true;
7798 tileObsidianKill[tileId] = true;
7799 }
7800
7801 private static void Initialize_TileAndNPCData1()
7802 {
7803 for (int i = 0; i < TileID.Count; i++)
7804 {
7805 tileGlowMask[i] = -1;
7806 }
7807 for (int j = 0; j < ProjectileID.Count; j++)
7808 {
7809 projFrames[j] = 1;
7810 }
7811 projFrames[736] = 3;
7812 projFrames[737] = 3;
7813 projFrames[738] = 3;
7814 projFrames[779] = 4;
7815 projFrames[783] = 4;
7816 projFrames[862] = 4;
7817 projFrames[863] = 4;
7818 projFrames[820] = 4;
7819 projFrames[916] = 6;
7820 projFrames[34] = 6;
7821 projFrames[706] = 8;
7822 projFrames[712] = 8;
7823 projFrames[663] = 7;
7824 projFrames[665] = 9;
7825 projFrames[667] = 9;
7826 projFrames[677] = 6;
7827 projFrames[678] = 6;
7828 projFrames[679] = 6;
7829 projFrames[688] = 6;
7830 projFrames[689] = 6;
7831 projFrames[690] = 8;
7832 projFrames[691] = 4;
7833 projFrames[692] = 4;
7834 projFrames[693] = 4;
7835 projFrames[694] = 4;
7836 projFrames[695] = 4;
7837 projFrames[696] = 5;
7838 projFrames[700] = 4;
7839 projFrames[964] = 1;
7840 projFrames[965] = 1;
7841 projFrames[643] = 8;
7842 projFrames[566] = 4;
7843 projFrames[565] = 4;
7844 projFrames[525] = 5;
7845 projFrames[519] = 4;
7846 projFrames[509] = 2;
7847 projFrames[485] = 5;
7848 projFrames[492] = 8;
7849 projFrames[500] = 4;
7850 projFrames[499] = 12;
7851 projFrames[518] = 4;
7852 projFrames[585] = 4;
7853 projFrames[593] = 4;
7854 projFrames[595] = 28;
7855 projFrames[735] = 28;
7856 projFrames[596] = 4;
7857 projFrames[612] = 5;
7858 projFrames[978] = 5;
7859 projFrames[613] = 4;
7860 projFrames[614] = 4;
7861 projFrames[615] = 7;
7862 projFrames[623] = 19;
7863 projFrames[633] = 5;
7864 projFrames[645] = 7;
7865 projFrames[650] = 4;
7866 projFrames[652] = 6;
7867 projFrames[659] = 4;
7868 projFrames[714] = 7;
7869 projFrames[734] = 8;
7870 projFrames[755] = 5;
7871 projFrames[759] = 5;
7872 projFrames[765] = 10;
7873 projFrames[951] = 12;
7874 projFrames[953] = 5;
7875 projFrames[384] = 6;
7876 projFrames[385] = 3;
7877 projFrames[386] = 6;
7878 projFrames[390] = 11;
7879 projFrames[391] = 11;
7880 projFrames[392] = 11;
7881 projFrames[393] = 15;
7882 projFrames[394] = 15;
7883 projFrames[395] = 15;
7884 projFrames[398] = 10;
7885 projFrames[407] = 6;
7886 projFrames[408] = 2;
7887 projFrames[409] = 3;
7888 projFrames[387] = 3;
7889 projFrames[388] = 3;
7890 projFrames[334] = 11;
7891 projFrames[324] = 10;
7892 projFrames[351] = 2;
7893 projFrames[349] = 5;
7894 projFrames[423] = 4;
7895 projFrames[435] = 4;
7896 projFrames[682] = 4;
7897 projFrames[436] = 4;
7898 projFrames[439] = 6;
7899 projFrames[443] = 4;
7900 projFrames[447] = 4;
7901 projFrames[448] = 3;
7902 projFrames[450] = 5;
7903 projFrames[454] = 2;
7904 projFrames[456] = 4;
7905 projFrames[459] = 3;
7906 projFrames[462] = 5;
7907 projFrames[465] = 4;
7908 projFrames[467] = 4;
7909 projFrames[468] = 4;
7910 projFrames[533] = 21;
7911 projFrames[535] = 12;
7912 projFrames[539] = 4;
7913 projFrames[575] = 4;
7914 projFrames[574] = 2;
7915 projFrames[634] = 4;
7916 projFrames[635] = 4;
7917 projFrames[709] = 3;
7918 projFrames[353] = 14;
7919 projFrames[346] = 2;
7920 projFrames[347] = 2;
7921 projFrames[335] = 4;
7922 projFrames[344] = 3;
7923 projFrames[337] = 5;
7924 projFrames[317] = 8;
7925 projFrames[321] = 3;
7926 projFrames[308] = 10;
7927 projFrames[316] = 4;
7928 projFrames[275] = 2;
7929 projFrames[276] = 2;
7930 projFrames[254] = 5;
7931 projFrames[307] = 2;
7932 projFrames[72] = 4;
7933 projFrames[86] = 4;
7934 projFrames[87] = 4;
7935 projFrames[102] = 2;
7936 projFrames[111] = 8;
7937 projFrames[112] = 6;
7938 projFrames[127] = 16;
7939 projFrames[175] = 2;
7940 projFrames[181] = 4;
7941 projFrames[189] = 4;
7942 projFrames[191] = 18;
7943 projFrames[192] = 18;
7944 projFrames[193] = 18;
7945 projFrames[194] = 18;
7946 projFrames[190] = 4;
7947 projFrames[198] = 4;
7948 projFrames[199] = 8;
7949 projFrames[200] = 10;
7950 projFrames[206] = 5;
7951 projFrames[208] = 5;
7952 projFrames[209] = 12;
7953 projFrames[210] = 12;
7954 projFrames[211] = 10;
7955 projFrames[221] = 3;
7956 projFrames[237] = 4;
7957 projFrames[238] = 6;
7958 projFrames[221] = 3;
7959 projFrames[228] = 5;
7960 projFrames[229] = 4;
7961 projFrames[236] = 13;
7962 projFrames[243] = 4;
7963 projFrames[244] = 6;
7964 projFrames[249] = 5;
7965 projFrames[252] = 4;
7966 projFrames[266] = 6;
7967 projFrames[268] = 8;
7968 projFrames[269] = 7;
7969 projFrames[270] = 3;
7970 projFrames[313] = 12;
7971 projFrames[314] = 13;
7972 projFrames[319] = 11;
7973 projFrames[373] = 3;
7974 projFrames[375] = 8;
7975 projFrames[377] = 9;
7976 projFrames[379] = 4;
7977 projFrames[380] = 4;
7978 projFrames[601] = 2;
7979 projFrames[602] = 4;
7980 projFrames[703] = 8;
7981 projFrames[701] = 3;
7982 projFrames[702] = 4;
7983 projFrames[732] = 4;
7984 projFrames[731] = 4;
7985 projFrames[758] = 24;
7986 projFrames[766] = 4;
7987 projFrames[767] = 4;
7988 projFrames[768] = 4;
7989 projFrames[769] = 4;
7990 projFrames[770] = 4;
7991 projFrames[774] = 8;
7992 projFrames[773] = 4;
7993 projFrames[815] = 10;
7994 projFrames[816] = 17;
7995 projFrames[817] = 18;
7996 projFrames[821] = 23;
7997 projFrames[824] = 4;
7998 projFrames[825] = 26;
7999 projFrames[826] = 3;
8000 projFrames[828] = 2;
8001 projFrames[829] = 2;
8002 projFrames[831] = 6;
8003 projFrames[970] = 6;
8004 projFrames[833] = 10;
8005 projFrames[834] = 12;
8006 projFrames[835] = 12;
8007 projFrames[836] = 4;
8008 projFrames[837] = 3;
8009 projFrames[839] = 4;
8010 projFrames[840] = 4;
8011 projFrames[851] = 4;
8012 projFrames[853] = 4;
8013 projFrames[854] = 19;
8014 projFrames[855] = 4;
8015 projFrames[858] = 14;
8016 projFrames[859] = 24;
8017 projFrames[860] = 14;
8018 projFrames[861] = 4;
8019 projFrames[864] = 2;
8020 projFrames[866] = 4;
8021 projFrames[870] = 4;
8022 projFrames[875] = 11;
8023 projFrames[881] = 12;
8024 projFrames[882] = 20;
8025 projFrames[883] = 3;
8026 projFrames[884] = 14;
8027 projFrames[885] = 10;
8028 projFrames[886] = 8;
8029 projFrames[887] = 3;
8030 projFrames[888] = 36;
8031 projFrames[889] = 11;
8032 projFrames[890] = 12;
8033 projFrames[891] = 15;
8034 projFrames[892] = 6;
8035 projFrames[893] = 4;
8036 projFrames[894] = 8;
8037 projFrames[895] = 6;
8038 projFrames[896] = 16;
8039 projFrames[897] = 11;
8040 projFrames[898] = 16;
8041 projFrames[899] = 14;
8042 projFrames[900] = 14;
8043 projFrames[901] = 12;
8044 projFrames[908] = 12;
8045 projFrames[909] = 6;
8046 projFrames[920] = 3;
8047 projFrames[934] = 12;
8048 projFrames[880] = 8;
8049 projFrames[929] = 8;
8050 projFrames[956] = 11;
8051 projFrames[957] = 12;
8052 projFrames[958] = 17;
8053 projFrames[959] = 12;
8054 projFrames[960] = 20;
8055 projFrames[961] = 1;
8056 projFrames[962] = 3;
8057 projFrames[963] = 13;
8058 projFrames[966] = 3;
8059 projFrames[967] = 8;
8060 projFrames[968] = 24;
8061 projFrames[969] = 8;
8062 projFrames[994] = 16;
8063 projFrames[995] = 20;
8064 projFrames[998] = 10;
8065 projFrames[1003] = 16;
8066 projFrames[1004] = 15;
8067 projFrames[1014] = 11;
8068 projPet[492] = true;
8069 projPet[499] = true;
8070 projPet[653] = true;
8071 projPet[701] = true;
8072 projPet[703] = true;
8073 projPet[702] = true;
8074 projPet[764] = true;
8075 projPet[765] = true;
8076 projPet[319] = true;
8077 projPet[334] = true;
8078 projPet[324] = true;
8079 projPet[266] = true;
8080 projPet[313] = true;
8081 projPet[314] = true;
8082 projPet[317] = true;
8083 projPet[175] = true;
8084 projPet[111] = true;
8085 projPet[112] = true;
8086 projPet[127] = true;
8087 projPet[191] = true;
8088 projPet[192] = true;
8089 projPet[193] = true;
8090 projPet[194] = true;
8091 projPet[197] = true;
8092 projPet[198] = true;
8093 projPet[199] = true;
8094 projPet[200] = true;
8095 projPet[208] = true;
8096 projPet[209] = true;
8097 projPet[210] = true;
8098 projPet[211] = true;
8099 projPet[236] = true;
8100 projPet[268] = true;
8101 projPet[269] = true;
8102 projPet[353] = true;
8103 projPet[373] = true;
8104 projPet[375] = true;
8105 projPet[380] = true;
8106 projPet[387] = true;
8107 projPet[388] = true;
8108 projPet[390] = true;
8109 projPet[391] = true;
8110 projPet[392] = true;
8111 projPet[393] = true;
8112 projPet[394] = true;
8113 projPet[395] = true;
8114 projPet[398] = true;
8115 projPet[407] = true;
8116 projPet[423] = true;
8117 projPet[533] = true;
8118 projPet[613] = true;
8119 projPet[623] = true;
8120 projPet[625] = true;
8121 projPet[626] = true;
8122 projPet[627] = true;
8123 projPet[628] = true;
8124 projPet[755] = true;
8125 projPet[758] = true;
8126 projPet[759] = true;
8127 projPet[774] = true;
8128 projPet[815] = true;
8129 projPet[816] = true;
8130 projPet[817] = true;
8131 projPet[821] = true;
8132 projPet[825] = true;
8133 projPet[831] = true;
8134 projPet[833] = true;
8135 projPet[834] = true;
8136 projPet[835] = true;
8137 projPet[854] = true;
8138 projPet[858] = true;
8139 projPet[859] = true;
8140 projPet[860] = true;
8141 projPet[864] = true;
8142 projPet[875] = true;
8143 projPet[946] = true;
8144 projPet[951] = true;
8145 projPet[963] = true;
8146 projPet[970] = true;
8147 projPet[881] = true;
8148 projPet[882] = true;
8149 projPet[883] = true;
8150 projPet[884] = true;
8151 projPet[885] = true;
8152 projPet[886] = true;
8153 projPet[887] = true;
8154 projPet[888] = true;
8155 projPet[889] = true;
8156 projPet[890] = true;
8157 projPet[891] = true;
8158 projPet[892] = true;
8159 projPet[893] = true;
8160 projPet[894] = true;
8161 projPet[895] = true;
8162 projPet[896] = true;
8163 projPet[897] = true;
8164 projPet[898] = true;
8165 projPet[899] = true;
8166 projPet[900] = true;
8167 projPet[901] = true;
8168 projPet[934] = true;
8169 projPet[956] = true;
8170 projPet[957] = true;
8171 projPet[958] = true;
8172 projPet[959] = true;
8173 projPet[960] = true;
8174 projPet[994] = true;
8175 projPet[998] = true;
8176 projPet[1003] = true;
8177 projPet[1004] = true;
8178 projPet[1018] = true;
8179 tileLighted[237] = true;
8180 tileLighted[27] = true;
8181 tileLighted[381] = true;
8182 tileLighted[534] = true;
8183 tileLighted[536] = true;
8184 tileLighted[539] = true;
8185 tileLighted[625] = true;
8186 tileLighted[627] = true;
8187 tileLighted[184] = true;
8188 tileLighted[463] = true;
8189 tileLighted[491] = true;
8190 slimeRainNPC[1] = true;
8191 debuff[158] = true;
8192 debuff[160] = true;
8193 debuff[20] = true;
8194 debuff[21] = true;
8195 debuff[22] = true;
8196 debuff[23] = true;
8197 debuff[24] = true;
8198 debuff[25] = true;
8199 debuff[28] = true;
8200 debuff[30] = true;
8201 debuff[31] = true;
8202 debuff[32] = true;
8203 debuff[33] = true;
8204 debuff[34] = true;
8205 debuff[35] = true;
8206 debuff[36] = true;
8207 debuff[37] = true;
8208 debuff[38] = true;
8209 debuff[39] = true;
8210 debuff[44] = true;
8211 debuff[46] = true;
8212 debuff[47] = true;
8213 debuff[67] = true;
8214 debuff[68] = true;
8215 debuff[69] = true;
8216 debuff[70] = true;
8217 debuff[80] = true;
8218 debuff[86] = true;
8219 debuff[87] = true;
8220 debuff[88] = true;
8221 debuff[89] = true;
8222 debuff[94] = true;
8223 debuff[103] = true;
8224 debuff[119] = true;
8225 debuff[120] = true;
8226 debuff[137] = true;
8227 debuff[145] = true;
8228 debuff[146] = true;
8229 debuff[147] = true;
8230 debuff[148] = true;
8231 debuff[149] = true;
8232 debuff[156] = true;
8233 debuff[157] = true;
8234 debuff[350] = true;
8235 debuff[163] = true;
8236 debuff[164] = true;
8237 debuff[144] = true;
8238 debuff[194] = true;
8239 debuff[195] = true;
8240 debuff[196] = true;
8241 debuff[197] = true;
8242 debuff[199] = true;
8243 debuff[215] = true;
8244 debuff[320] = true;
8245 debuff[321] = true;
8246 debuff[332] = true;
8247 debuff[333] = true;
8248 debuff[334] = true;
8249 debuff[353] = true;
8250 pvpBuff[20] = true;
8251 pvpBuff[70] = true;
8252 pvpBuff[24] = true;
8253 pvpBuff[323] = true;
8254 pvpBuff[31] = true;
8255 pvpBuff[39] = true;
8256 pvpBuff[44] = true;
8257 pvpBuff[324] = true;
8258 pvpBuff[69] = true;
8259 pvpBuff[103] = true;
8260 pvpBuff[119] = true;
8261 pvpBuff[120] = true;
8262 pvpBuff[137] = true;
8263 pvpBuff[320] = true;
8264 meleeBuff[71] = true;
8265 meleeBuff[73] = true;
8266 meleeBuff[74] = true;
8267 meleeBuff[75] = true;
8268 meleeBuff[76] = true;
8269 meleeBuff[77] = true;
8270 meleeBuff[78] = true;
8271 meleeBuff[79] = true;
8272 buffNoSave[20] = true;
8273 buffNoSave[22] = true;
8274 buffNoSave[23] = true;
8275 buffNoSave[24] = true;
8276 buffNoSave[28] = true;
8277 buffNoSave[30] = true;
8278 buffNoSave[31] = true;
8279 buffNoSave[34] = true;
8280 buffNoSave[35] = true;
8281 buffNoSave[37] = true;
8282 buffNoSave[38] = true;
8283 buffNoSave[39] = true;
8284 buffNoSave[43] = true;
8285 buffNoSave[44] = true;
8286 buffNoSave[46] = true;
8287 buffNoSave[47] = true;
8288 buffNoSave[48] = true;
8289 buffNoSave[58] = true;
8290 buffNoSave[59] = true;
8291 buffNoSave[60] = true;
8292 buffNoSave[62] = true;
8293 buffNoSave[63] = true;
8294 buffNoSave[64] = true;
8295 buffNoSave[67] = true;
8296 buffNoSave[68] = true;
8297 buffNoSave[69] = true;
8298 buffNoSave[70] = true;
8299 buffNoSave[72] = true;
8300 buffNoSave[80] = true;
8301 buffNoSave[87] = true;
8302 buffNoSave[158] = true;
8303 buffNoSave[146] = true;
8304 buffNoSave[147] = true;
8305 buffNoSave[215] = true;
8306 buffNoSave[88] = true;
8307 buffNoSave[89] = true;
8308 buffNoSave[94] = true;
8309 buffNoSave[95] = true;
8310 buffNoSave[96] = true;
8311 buffNoSave[97] = true;
8312 buffNoSave[98] = true;
8313 buffNoSave[99] = true;
8314 buffNoSave[100] = true;
8315 buffNoSave[103] = true;
8316 buffNoSave[118] = true;
8317 buffNoSave[138] = true;
8318 buffNoSave[167] = true;
8319 buffNoSave[166] = true;
8320 buffNoSave[184] = true;
8321 buffNoSave[185] = true;
8322 buffNoSave[211] = true;
8323 buffNoSave[210] = true;
8324 buffNoSave[119] = true;
8325 buffNoSave[120] = true;
8326 buffNoSave[90] = true;
8327 buffNoSave[125] = true;
8328 buffNoSave[126] = true;
8329 buffNoSave[128] = true;
8330 buffNoSave[129] = true;
8331 buffNoSave[130] = true;
8332 buffNoSave[131] = true;
8333 buffNoSave[132] = true;
8334 buffNoSave[133] = true;
8335 buffNoSave[134] = true;
8336 buffNoSave[135] = true;
8337 buffNoSave[139] = true;
8338 buffNoSave[140] = true;
8339 buffNoSave[141] = true;
8340 buffNoSave[142] = true;
8341 buffNoSave[143] = true;
8342 buffNoSave[137] = true;
8343 buffNoSave[144] = true;
8344 buffNoSave[161] = true;
8345 buffNoSave[162] = true;
8346 buffNoSave[163] = true;
8347 buffNoSave[164] = true;
8348 buffNoSave[168] = true;
8349 buffNoSave[170] = true;
8350 buffNoSave[171] = true;
8351 buffNoSave[172] = true;
8352 buffNoSave[182] = true;
8353 buffNoSave[187] = true;
8354 buffNoSave[188] = true;
8355 buffNoSave[193] = true;
8356 buffNoSave[194] = true;
8357 buffNoSave[195] = true;
8358 buffNoSave[196] = true;
8359 buffNoSave[197] = true;
8360 buffNoSave[198] = true;
8361 buffNoSave[199] = true;
8362 buffNoSave[205] = true;
8363 buffNoSave[212] = true;
8364 buffNoSave[213] = true;
8365 buffNoSave[214] = true;
8366 buffNoSave[230] = true;
8367 buffNoSave[263] = true;
8368 buffNoSave[265] = true;
8369 buffNoSave[271] = true;
8370 buffNoSave[322] = true;
8371 buffNoSave[275] = true;
8372 buffNoSave[276] = true;
8373 buffNoSave[277] = true;
8374 buffNoSave[278] = true;
8375 buffNoSave[279] = true;
8376 buffNoSave[280] = true;
8377 buffNoSave[281] = true;
8378 buffNoSave[282] = true;
8379 buffNoSave[283] = true;
8380 buffNoSave[305] = true;
8381 buffNoSave[318] = true;
8382 buffNoSave[342] = true;
8383 buffNoSave[320] = true;
8384 buffNoSave[321] = true;
8385 buffNoSave[325] = true;
8386 buffNoSave[335] = true;
8387 buffNoSave[150] = true;
8388 buffNoSave[93] = true;
8389 buffNoSave[159] = true;
8390 buffNoSave[29] = true;
8391 buffNoSave[348] = true;
8392 buffNoSave[353] = true;
8393 for (int k = 173; k <= 181; k++)
8394 {
8395 buffNoSave[k] = true;
8396 }
8397 buffNoTimeDisplay[19] = true;
8398 buffNoTimeDisplay[27] = true;
8399 buffNoTimeDisplay[28] = true;
8400 buffNoTimeDisplay[34] = true;
8401 buffNoTimeDisplay[37] = true;
8402 buffNoTimeDisplay[38] = true;
8403 buffNoTimeDisplay[40] = true;
8404 buffNoTimeDisplay[41] = true;
8405 buffNoTimeDisplay[42] = true;
8406 buffNoTimeDisplay[43] = true;
8407 buffNoTimeDisplay[45] = true;
8408 buffNoTimeDisplay[49] = true;
8409 buffNoTimeDisplay[60] = true;
8410 buffNoTimeDisplay[62] = true;
8411 buffNoTimeDisplay[64] = true;
8412 buffNoTimeDisplay[68] = true;
8413 buffNoTimeDisplay[81] = true;
8414 buffNoTimeDisplay[82] = true;
8415 buffNoTimeDisplay[83] = true;
8416 buffNoTimeDisplay[90] = true;
8417 buffNoTimeDisplay[95] = true;
8418 buffNoTimeDisplay[96] = true;
8419 buffNoTimeDisplay[97] = true;
8420 buffNoTimeDisplay[98] = true;
8421 buffNoTimeDisplay[99] = true;
8422 buffNoTimeDisplay[100] = true;
8423 buffNoTimeDisplay[101] = true;
8424 buffNoTimeDisplay[102] = true;
8425 buffNoTimeDisplay[118] = true;
8426 buffNoTimeDisplay[138] = true;
8427 buffNoTimeDisplay[167] = true;
8428 buffNoTimeDisplay[166] = true;
8429 buffNoTimeDisplay[184] = true;
8430 buffNoTimeDisplay[185] = true;
8431 buffNoTimeDisplay[211] = true;
8432 buffNoTimeDisplay[210] = true;
8433 buffNoTimeDisplay[125] = true;
8434 buffNoTimeDisplay[126] = true;
8435 buffNoTimeDisplay[128] = true;
8436 buffNoTimeDisplay[129] = true;
8437 buffNoTimeDisplay[130] = true;
8438 buffNoTimeDisplay[131] = true;
8439 buffNoTimeDisplay[132] = true;
8440 buffNoTimeDisplay[133] = true;
8441 buffNoTimeDisplay[134] = true;
8442 buffNoTimeDisplay[135] = true;
8443 buffNoTimeDisplay[136] = true;
8444 buffNoTimeDisplay[139] = true;
8445 buffNoTimeDisplay[140] = true;
8446 buffNoTimeDisplay[141] = true;
8447 buffNoTimeDisplay[142] = true;
8448 buffNoTimeDisplay[143] = true;
8449 buffNoTimeDisplay[137] = true;
8450 buffNoTimeDisplay[200] = true;
8451 buffNoTimeDisplay[202] = true;
8452 buffNoTimeDisplay[201] = true;
8453 buffNoTimeDisplay[161] = true;
8454 buffNoTimeDisplay[162] = true;
8455 buffNoTimeDisplay[163] = true;
8456 buffNoTimeDisplay[168] = true;
8457 buffNoTimeDisplay[170] = true;
8458 buffNoTimeDisplay[171] = true;
8459 buffNoTimeDisplay[172] = true;
8460 buffNoTimeDisplay[182] = true;
8461 buffNoTimeDisplay[165] = true;
8462 buffNoTimeDisplay[186] = true;
8463 buffNoTimeDisplay[187] = true;
8464 buffNoTimeDisplay[188] = true;
8465 buffNoTimeDisplay[193] = true;
8466 buffNoTimeDisplay[199] = true;
8467 buffNoTimeDisplay[212] = true;
8468 buffNoTimeDisplay[213] = true;
8469 buffNoTimeDisplay[214] = true;
8470 buffNoTimeDisplay[216] = true;
8471 buffNoTimeDisplay[217] = true;
8472 buffNoTimeDisplay[219] = true;
8473 buffNoTimeDisplay[230] = true;
8474 buffNoTimeDisplay[258] = true;
8475 buffNoTimeDisplay[259] = true;
8476 buffNoTimeDisplay[260] = true;
8477 buffNoTimeDisplay[261] = true;
8478 buffNoTimeDisplay[262] = true;
8479 buffNoTimeDisplay[263] = true;
8480 buffNoTimeDisplay[264] = true;
8481 buffNoTimeDisplay[265] = true;
8482 buffNoTimeDisplay[266] = true;
8483 buffNoTimeDisplay[267] = true;
8484 buffNoTimeDisplay[268] = true;
8485 buffNoTimeDisplay[271] = true;
8486 buffNoTimeDisplay[322] = true;
8487 buffNoTimeDisplay[274] = true;
8488 buffNoTimeDisplay[275] = true;
8489 buffNoTimeDisplay[276] = true;
8490 buffNoTimeDisplay[277] = true;
8491 buffNoTimeDisplay[278] = true;
8492 buffNoTimeDisplay[279] = true;
8493 buffNoTimeDisplay[280] = true;
8494 buffNoTimeDisplay[281] = true;
8495 buffNoTimeDisplay[282] = true;
8496 buffNoTimeDisplay[283] = true;
8497 buffNoTimeDisplay[284] = true;
8498 buffNoTimeDisplay[285] = true;
8499 buffNoTimeDisplay[286] = true;
8500 buffNoTimeDisplay[287] = true;
8501 buffNoTimeDisplay[288] = true;
8502 buffNoTimeDisplay[289] = true;
8503 buffNoTimeDisplay[290] = true;
8504 buffNoTimeDisplay[291] = true;
8505 buffNoTimeDisplay[292] = true;
8506 buffNoTimeDisplay[293] = true;
8507 buffNoTimeDisplay[294] = true;
8508 buffNoTimeDisplay[295] = true;
8509 buffNoTimeDisplay[296] = true;
8510 buffNoTimeDisplay[297] = true;
8511 buffNoTimeDisplay[298] = true;
8512 buffNoTimeDisplay[299] = true;
8513 buffNoTimeDisplay[300] = true;
8514 buffNoTimeDisplay[301] = true;
8515 buffNoTimeDisplay[302] = true;
8516 buffNoTimeDisplay[303] = true;
8517 buffNoTimeDisplay[304] = true;
8518 buffNoTimeDisplay[305] = true;
8519 buffNoTimeDisplay[317] = true;
8520 buffNoTimeDisplay[318] = true;
8521 buffNoTimeDisplay[342] = true;
8522 buffNoTimeDisplay[320] = true;
8523 buffNoTimeDisplay[325] = true;
8524 buffNoTimeDisplay[335] = true;
8525 buffNoTimeDisplay[341] = true;
8526 buffNoTimeDisplay[327] = true;
8527 buffNoTimeDisplay[328] = true;
8528 buffNoTimeDisplay[329] = true;
8529 buffNoTimeDisplay[330] = true;
8530 buffNoTimeDisplay[331] = true;
8531 buffNoTimeDisplay[334] = true;
8532 buffNoTimeDisplay[345] = true;
8533 buffNoTimeDisplay[349] = true;
8534 buffNoTimeDisplay[351] = true;
8535 buffNoTimeDisplay[352] = true;
8536 buffNoTimeDisplay[354] = true;
8537 buffNoTimeDisplay[29] = true;
8538 buffNoTimeDisplay[159] = true;
8539 buffNoTimeDisplay[150] = true;
8540 buffNoTimeDisplay[93] = true;
8541 buffNoTimeDisplay[348] = true;
8542 buffNoTimeDisplay[353] = true;
8543 persistentBuff[71] = true;
8544 persistentBuff[73] = true;
8545 persistentBuff[74] = true;
8546 persistentBuff[75] = true;
8547 persistentBuff[76] = true;
8548 persistentBuff[77] = true;
8549 persistentBuff[78] = true;
8550 persistentBuff[79] = true;
8551 for (int l = 0; l < BuffID.Sets.BasicMountData.Length; l++)
8552 {
8553 if (BuffID.Sets.BasicMountData[l] != null)
8554 {
8555 buffNoTimeDisplay[l] = true;
8556 buffNoSave[l] = true;
8557 }
8558 }
8559 vanityPet[40] = true;
8560 vanityPet[41] = true;
8561 vanityPet[42] = true;
8562 vanityPet[45] = true;
8563 vanityPet[50] = true;
8564 vanityPet[51] = true;
8565 vanityPet[52] = true;
8566 vanityPet[53] = true;
8567 vanityPet[54] = true;
8568 vanityPet[55] = true;
8569 vanityPet[56] = true;
8570 vanityPet[61] = true;
8571 vanityPet[154] = true;
8572 vanityPet[65] = true;
8573 vanityPet[66] = true;
8574 vanityPet[81] = true;
8575 vanityPet[82] = true;
8576 vanityPet[84] = true;
8577 vanityPet[85] = true;
8578 vanityPet[91] = true;
8579 vanityPet[92] = true;
8580 vanityPet[127] = true;
8581 vanityPet[136] = true;
8582 vanityPet[191] = true;
8583 vanityPet[202] = true;
8584 vanityPet[200] = true;
8585 vanityPet[218] = true;
8586 vanityPet[219] = true;
8587 vanityPet[217] = true;
8588 vanityPet[258] = true;
8589 vanityPet[259] = true;
8590 vanityPet[260] = true;
8591 vanityPet[261] = true;
8592 vanityPet[262] = true;
8593 vanityPet[264] = true;
8594 vanityPet[266] = true;
8595 vanityPet[267] = true;
8596 vanityPet[268] = true;
8597 vanityPet[274] = true;
8598 vanityPet[284] = true;
8599 vanityPet[285] = true;
8600 vanityPet[286] = true;
8601 vanityPet[287] = true;
8602 vanityPet[288] = true;
8603 vanityPet[289] = true;
8604 vanityPet[290] = true;
8605 vanityPet[291] = true;
8606 vanityPet[292] = true;
8607 vanityPet[293] = true;
8608 vanityPet[295] = true;
8609 vanityPet[296] = true;
8610 vanityPet[297] = true;
8611 vanityPet[300] = true;
8612 vanityPet[301] = true;
8613 vanityPet[302] = true;
8614 vanityPet[303] = true;
8615 vanityPet[304] = true;
8616 vanityPet[317] = true;
8617 vanityPet[341] = true;
8618 vanityPet[327] = true;
8619 vanityPet[328] = true;
8620 vanityPet[329] = true;
8621 vanityPet[330] = true;
8622 vanityPet[331] = true;
8623 vanityPet[345] = true;
8624 vanityPet[349] = true;
8625 vanityPet[351] = true;
8626 vanityPet[352] = true;
8627 vanityPet[354] = true;
8628 lightPet[19] = true;
8629 lightPet[155] = true;
8630 lightPet[27] = true;
8631 lightPet[101] = true;
8632 lightPet[102] = true;
8633 lightPet[57] = true;
8634 lightPet[190] = true;
8635 lightPet[152] = true;
8636 lightPet[201] = true;
8637 lightPet[294] = true;
8638 lightPet[298] = true;
8639 lightPet[299] = true;
8640 tileFlame[4] = true;
8641 tileFlame[33] = true;
8642 tileFlame[34] = true;
8643 tileFlame[35] = true;
8644 tileFlame[42] = true;
8645 tileFlame[49] = true;
8646 tileFlame[93] = true;
8647 tileFlame[98] = true;
8648 tileFlame[100] = true;
8649 tileFlame[173] = true;
8650 tileFlame[174] = true;
8651 tileFlame[372] = true;
8652 tileFlame[646] = true;
8653 tileRope[213] = true;
8654 tileRope[214] = true;
8655 tileRope[353] = true;
8656 tileRope[365] = true;
8657 tileRope[366] = true;
8658 tileRope[504] = true;
8659 tileRope[449] = true;
8660 tileRope[450] = true;
8661 tileRope[451] = true;
8662 tilePile[330] = true;
8663 tilePile[331] = true;
8664 tilePile[332] = true;
8665 tilePile[333] = true;
8666 for (int m = 0; m < NPCID.Count; m++)
8667 {
8668 npcCatchable[m] = false;
8669 }
8670 npcCatchable[46] = true;
8671 npcCatchable[55] = true;
8672 npcCatchable[74] = true;
8673 npcCatchable[148] = true;
8674 npcCatchable[149] = true;
8675 npcCatchable[297] = true;
8676 npcCatchable[298] = true;
8677 npcCatchable[299] = true;
8678 npcCatchable[300] = true;
8679 npcCatchable[355] = true;
8680 npcCatchable[356] = true;
8681 npcCatchable[357] = true;
8682 npcCatchable[358] = true;
8683 npcCatchable[359] = true;
8684 npcCatchable[360] = true;
8685 npcCatchable[361] = true;
8686 npcCatchable[362] = true;
8687 npcCatchable[363] = true;
8688 npcCatchable[364] = true;
8689 npcCatchable[365] = true;
8690 npcCatchable[366] = true;
8691 npcCatchable[367] = true;
8692 npcCatchable[374] = true;
8693 npcCatchable[377] = true;
8694 npcCatchable[539] = true;
8695 npcCatchable[538] = true;
8696 npcCatchable[671] = true;
8697 npcCatchable[672] = true;
8698 npcCatchable[673] = true;
8699 npcCatchable[674] = true;
8700 npcCatchable[675] = true;
8701 npcCatchable[484] = true;
8702 npcCatchable[485] = true;
8703 npcCatchable[486] = true;
8704 npcCatchable[487] = true;
8705 npcCatchable[583] = true;
8706 npcCatchable[584] = true;
8707 npcCatchable[585] = true;
8708 npcCatchable[592] = true;
8709 npcCatchable[593] = true;
8710 npcCatchable[595] = true;
8711 npcCatchable[596] = true;
8712 npcCatchable[597] = true;
8713 npcCatchable[598] = true;
8714 npcCatchable[599] = true;
8715 npcCatchable[600] = true;
8716 npcCatchable[601] = true;
8717 npcCatchable[604] = true;
8718 npcCatchable[605] = true;
8719 npcCatchable[602] = true;
8720 npcCatchable[603] = true;
8721 npcCatchable[606] = true;
8722 npcCatchable[607] = true;
8723 npcCatchable[608] = true;
8724 npcCatchable[609] = true;
8725 npcCatchable[610] = true;
8726 npcCatchable[611] = true;
8727 npcCatchable[612] = true;
8728 npcCatchable[613] = true;
8729 npcCatchable[614] = true;
8730 npcCatchable[616] = true;
8731 npcCatchable[617] = true;
8732 npcCatchable[626] = true;
8733 npcCatchable[627] = true;
8734 npcCatchable[639] = true;
8735 npcCatchable[640] = true;
8736 npcCatchable[641] = true;
8737 npcCatchable[642] = true;
8738 npcCatchable[643] = true;
8739 npcCatchable[644] = true;
8740 npcCatchable[645] = true;
8741 npcCatchable[646] = true;
8742 npcCatchable[647] = true;
8743 npcCatchable[648] = true;
8744 npcCatchable[649] = true;
8745 npcCatchable[650] = true;
8746 npcCatchable[651] = true;
8747 npcCatchable[652] = true;
8748 npcCatchable[653] = true;
8749 npcCatchable[654] = true;
8750 npcCatchable[655] = true;
8751 npcCatchable[661] = true;
8752 npcCatchable[669] = true;
8753 npcCatchable[677] = true;
8754 for (int n = 442; n <= 448; n++)
8755 {
8756 npcCatchable[n] = true;
8757 }
8758 SetTileValue();
8759 tileSpelunker[6] = true;
8760 tileSpelunker[7] = true;
8761 tileSpelunker[8] = true;
8762 tileSpelunker[9] = true;
8763 tileSpelunker[12] = true;
8764 tileSpelunker[21] = true;
8765 tileSpelunker[467] = true;
8766 tileSpelunker[441] = true;
8767 tileSpelunker[468] = true;
8768 tileSpelunker[28] = true;
8769 tileSpelunker[107] = true;
8770 tileSpelunker[108] = true;
8771 tileSpelunker[111] = true;
8772 tileSpelunker[63] = true;
8773 tileSpelunker[64] = true;
8774 tileSpelunker[65] = true;
8775 tileSpelunker[66] = true;
8776 tileSpelunker[67] = true;
8777 tileSpelunker[68] = true;
8778 tileSpelunker[566] = true;
8779 tileSpelunker[166] = true;
8780 tileSpelunker[167] = true;
8781 tileSpelunker[168] = true;
8782 tileSpelunker[169] = true;
8783 tileSpelunker[178] = true;
8784 tileSpelunker[211] = true;
8785 tileSpelunker[221] = true;
8786 tileSpelunker[222] = true;
8787 tileSpelunker[223] = true;
8788 tileSpelunker[236] = true;
8789 tileSpelunker[37] = true;
8790 tileSpelunker[407] = true;
8791 tileSpelunker[227] = true;
8792 tileSpelunker[84] = true;
8793 tileSpelunker[83] = true;
8794 tileSpelunker[404] = true;
8795 tileSpelunker[242] = true;
8796 tileSpelunker[240] = true;
8797 tileSpelunker[246] = true;
8798 tileSpelunker[245] = true;
8799 tileSpelunker[105] = true;
8800 tileSpelunker[349] = true;
8801 tileSpelunker[337] = true;
8802 tileSpelunker[531] = true;
8803 tileSpelunker[506] = true;
8804 tileSolid[379] = true;
8805 tileMergeDirt[249] = true;
8806 tileBrick[268] = true;
8807 tileBrick[262] = true;
8808 tileBrick[267] = true;
8809 tileBrick[265] = true;
8810 tileBrick[266] = true;
8811 tileBrick[264] = true;
8812 tileBrick[263] = true;
8813 tileBrick[261] = true;
8814 tileBrick[255] = true;
8815 tileBrick[260] = true;
8816 tileBrick[258] = true;
8817 tileBrick[259] = true;
8818 tileBrick[257] = true;
8819 tileBrick[256] = true;
8820 tileSolid[371] = true;
8821 tileMergeDirt[371] = true;
8822 tileBlockLight[371] = true;
8823 tileBouncy[371] = true;
8824 tileBouncy[448] = true;
8825 tileBouncy[446] = true;
8826 tileBouncy[447] = true;
8827 tileFrameImportant[377] = true;
8828 tileFrameImportant[373] = true;
8829 tileFrameImportant[375] = true;
8830 tileFrameImportant[374] = true;
8831 tileFrameImportant[461] = true;
8832 tileLighted[646] = true;
8833 tileFrameImportant[646] = true;
8834 tileWaterDeath[646] = true;
8835 tileLavaDeath[646] = true;
8836 tileLighted[372] = true;
8837 tileFrameImportant[372] = true;
8838 tileWaterDeath[372] = true;
8839 tileLavaDeath[372] = true;
8840 tileSolid[357] = true;
8841 tileBrick[357] = true;
8842 tileBrick[311] = true;
8843 tileSolid[408] = true;
8844 tileMergeDirt[408] = true;
8845 tileBrick[408] = true;
8846 tileBlockLight[408] = true;
8847 tileSolid[409] = true;
8848 tileBrick[409] = true;
8849 tileBlockLight[409] = true;
8850 tileSolid[669] = true;
8851 tileBrick[669] = true;
8852 tileBlockLight[669] = true;
8853 tileSolid[670] = true;
8854 tileBrick[670] = true;
8855 tileBlockLight[670] = true;
8856 tileSolid[671] = true;
8857 tileBrick[671] = true;
8858 tileBlockLight[671] = true;
8859 tileSolid[672] = true;
8860 tileBrick[672] = true;
8861 tileBlockLight[672] = true;
8862 tileSolid[673] = true;
8863 tileBrick[673] = true;
8864 tileBlockLight[673] = true;
8865 tileSolid[674] = true;
8866 tileBrick[674] = true;
8867 tileBlockLight[674] = true;
8868 tileSolid[675] = true;
8869 tileBrick[675] = true;
8870 tileBlockLight[675] = true;
8871 tileSolid[676] = true;
8872 tileBrick[676] = true;
8873 tileBlockLight[676] = true;
8874 tileSolid[677] = true;
8875 tileBrick[677] = true;
8876 tileBlockLight[677] = true;
8877 tileMergeDirt[677] = true;
8878 tileSolid[678] = true;
8879 tileBrick[678] = true;
8880 tileBlockLight[678] = true;
8881 tileMergeDirt[678] = true;
8882 tileSolid[679] = true;
8883 tileBrick[679] = true;
8884 tileBlockLight[679] = true;
8885 tileMergeDirt[679] = true;
8886 tileSolid[680] = true;
8887 tileBrick[680] = true;
8888 tileBlockLight[680] = true;
8889 tileMergeDirt[680] = true;
8890 tileSolid[681] = true;
8891 tileBrick[681] = true;
8892 tileBlockLight[681] = true;
8893 tileMergeDirt[681] = true;
8894 tileSolid[682] = true;
8895 tileBrick[682] = true;
8896 tileBlockLight[682] = true;
8897 tileMergeDirt[682] = true;
8898 tileSolid[683] = true;
8899 tileBrick[683] = true;
8900 tileBlockLight[683] = true;
8901 tileMergeDirt[683] = true;
8902 tileSolid[684] = true;
8903 tileBrick[684] = true;
8904 tileBlockLight[684] = true;
8905 tileMergeDirt[684] = true;
8906 tileSolid[685] = true;
8907 tileBrick[685] = true;
8908 tileBlockLight[685] = true;
8909 tileMergeDirt[685] = true;
8910 tileSolid[686] = true;
8911 tileBrick[686] = true;
8912 tileBlockLight[686] = true;
8913 tileMergeDirt[686] = true;
8914 tileSolid[666] = true;
8915 tileBlockLight[666] = true;
8916 tileBrick[666] = true;
8917 tileMergeDirt[666] = true;
8918 tileNoFail[666] = true;
8919 tileSolid[415] = true;
8920 tileBrick[415] = true;
8921 tileLighted[415] = true;
8922 tileBlockLight[415] = true;
8923 tileSolid[416] = true;
8924 tileBrick[416] = true;
8925 tileLighted[416] = true;
8926 tileBlockLight[416] = true;
8927 tileSolid[417] = true;
8928 tileBrick[417] = true;
8929 tileLighted[417] = true;
8930 tileBlockLight[417] = true;
8931 tileSolid[418] = true;
8932 tileBrick[418] = true;
8933 tileLighted[418] = true;
8934 tileBlockLight[418] = true;
8935 tileSolid[498] = true;
8936 tileBrick[498] = true;
8937 tileBlockLight[498] = true;
8938 tileBrick[37] = true;
8939 tileBrick[117] = true;
8940 tileBrick[25] = true;
8941 tileBrick[203] = true;
8942 tileSolid[232] = true;
8943 tileSolid[311] = true;
8944 tileBlockLight[311] = true;
8945 tileSolid[312] = true;
8946 tileBlockLight[313] = true;
8947 tileSolid[313] = true;
8948 tileBlockLight[312] = true;
8949 tileMergeDirt[311] = true;
8950 tileSolid[315] = true;
8951 tileBlockLight[315] = true;
8952 tileMergeDirt[315] = true;
8953 tileBrick[315] = true;
8954 tileSolid[641] = true;
8955 tileBlockLight[641] = true;
8956 tileMergeDirt[641] = true;
8957 tileBrick[641] = true;
8958 tileSolid[659] = true;
8959 tileBlockLight[659] = true;
8960 tileLighted[659] = true;
8961 tileBrick[659] = true;
8962 tileSolid[667] = true;
8963 tileBlockLight[667] = true;
8964 tileBrick[667] = true;
8965 tileLighted[667] = true;
8966 tileSolid[321] = true;
8967 tileSolid[322] = true;
8968 tileBlockLight[321] = true;
8969 tileBlockLight[322] = true;
8970 tileMergeDirt[321] = true;
8971 tileMergeDirt[322] = true;
8972 tileBrick[321] = true;
8973 tileBrick[322] = true;
8974 tileSolid[635] = true;
8975 tileBlockLight[635] = true;
8976 tileMergeDirt[635] = true;
8977 tileBrick[635] = true;
8978 tileFrameImportant[639] = true;
8979 tileLavaDeath[639] = true;
8980 tileSpelunker[639] = true;
8981 tileShine[639] = 300;
8982 tileShine2[639] = true;
8983 tileLavaDeath[668] = true;
8984 tileSolid[668] = true;
8985 tileBlockLight[668] = true;
8986 tileShine[239] = 1100;
8987 tileSolid[239] = true;
8988 tileSolidTop[239] = true;
8989 tileSolid[380] = true;
8990 tileSolidTop[380] = true;
8991 tileFrameImportant[358] = true;
8992 tileFrameImportant[359] = true;
8993 tileFrameImportant[360] = true;
8994 tileFrameImportant[361] = true;
8995 tileFrameImportant[362] = true;
8996 tileFrameImportant[363] = true;
8997 tileFrameImportant[364] = true;
8998 tileFrameImportant[391] = true;
8999 tileLighted[391] = true;
9000 tileFrameImportant[392] = true;
9001 tileFrameImportant[393] = true;
9002 tileFrameImportant[394] = true;
9003 tileFrameImportant[542] = true;
9004 tileFrameImportant[505] = true;
9005 tileFrameImportant[521] = true;
9006 tileFrameImportant[522] = true;
9007 tileFrameImportant[523] = true;
9008 tileFrameImportant[524] = true;
9009 tileFrameImportant[525] = true;
9010 tileFrameImportant[526] = true;
9011 tileFrameImportant[527] = true;
9012 tileFrameImportant[543] = true;
9013 tileFrameImportant[568] = true;
9014 tileFrameImportant[569] = true;
9015 tileFrameImportant[570] = true;
9016 tileFrameImportant[598] = true;
9017 tileFrameImportant[356] = true;
9018 tileFrameImportant[663] = true;
9019 tileFrameImportant[334] = true;
9020 tileFrameImportant[440] = true;
9021 tileFrameImportant[471] = true;
9022 tileFrameImportant[300] = true;
9023 tileFrameImportant[301] = true;
9024 tileFrameImportant[302] = true;
9025 tileFrameImportant[303] = true;
9026 tileFrameImportant[304] = true;
9027 tileFrameImportant[305] = true;
9028 tileFrameImportant[306] = true;
9029 tileFrameImportant[307] = true;
9030 tileFrameImportant[308] = true;
9031 tileFrameImportant[354] = true;
9032 tileLighted[354] = true;
9033 tileFrameImportant[499] = true;
9034 tileFrameImportant[355] = true;
9035 tileFrameImportant[324] = true;
9036 tileObsidianKill[324] = true;
9037 tileLavaDeath[324] = true;
9038 tileFrameImportant[463] = true;
9039 tileFrameImportant[491] = true;
9040 tileFrameImportant[464] = true;
9041 tileFrameImportant[466] = true;
9042 tileFrameImportant[419] = true;
9043 tileFrameImportant[442] = true;
9044 tileFrameImportant[443] = true;
9045 tileFrameImportant[444] = true;
9046 tileFrameImportant[420] = true;
9047 tileFrameImportant[423] = true;
9048 tileFrameImportant[424] = true;
9049 tileFrameImportant[428] = true;
9050 tileFrameImportant[520] = true;
9051 tileFrameImportant[429] = true;
9052 tileFrameImportant[445] = true;
9053 tileFrameImportant[476] = true;
9054 tileFrameImportant[283] = true;
9055 tileFrameImportant[288] = true;
9056 tileFrameImportant[289] = true;
9057 tileFrameImportant[290] = true;
9058 tileFrameImportant[291] = true;
9059 tileFrameImportant[292] = true;
9060 tileFrameImportant[293] = true;
9061 tileFrameImportant[294] = true;
9062 tileFrameImportant[295] = true;
9063 tileFrameImportant[296] = true;
9064 tileFrameImportant[297] = true;
9065 tileFrameImportant[316] = true;
9066 tileFrameImportant[317] = true;
9067 tileFrameImportant[318] = true;
9068 tileLargeFrames[284] = 1;
9069 wallHouse[224] = true;
9070 wallLargeFrames[224] = 2;
9071 wallHouse[323] = true;
9072 wallLargeFrames[323] = 2;
9073 wallHouse[324] = true;
9074 wallLargeFrames[324] = 2;
9075 wallHouse[325] = true;
9076 wallLargeFrames[325] = 2;
9077 wallHouse[326] = true;
9078 wallLargeFrames[326] = 2;
9079 wallHouse[327] = true;
9080 wallLargeFrames[327] = 2;
9081 wallHouse[328] = true;
9082 wallLargeFrames[328] = 2;
9083 wallHouse[329] = true;
9084 wallLargeFrames[329] = 2;
9085 wallHouse[330] = true;
9086 wallLargeFrames[330] = 2;
9087 wallHouse[331] = true;
9088 wallHouse[332] = true;
9089 wallHouse[333] = true;
9090 wallHouse[334] = true;
9091 wallHouse[335] = true;
9092 wallHouse[336] = true;
9093 wallHouse[337] = true;
9094 wallHouse[338] = true;
9095 wallHouse[339] = true;
9096 wallHouse[340] = true;
9097 wallHouse[341] = true;
9098 wallHouse[342] = true;
9099 wallHouse[343] = true;
9100 wallHouse[344] = true;
9101 wallHouse[345] = true;
9102 wallHouse[346] = true;
9103 wallHouse[60] = true;
9104 wallHouse[225] = true;
9105 wallHouse[226] = true;
9106 wallHouse[227] = true;
9107 wallHouse[231] = true;
9108 wallHouse[232] = true;
9109 wallHouse[233] = true;
9110 wallHouse[235] = true;
9111 wallHouse[234] = true;
9112 wallHouse[312] = true;
9113 wallHouse[313] = true;
9114 wallHouse[237] = true;
9115 wallHouse[238] = true;
9116 wallHouse[239] = true;
9117 wallHouse[240] = true;
9118 tileLargeFrames[409] = 2;
9119 tileLargeFrames[669] = 2;
9120 tileLargeFrames[670] = 2;
9121 tileLargeFrames[671] = 2;
9122 tileLargeFrames[672] = 2;
9123 tileLargeFrames[673] = 2;
9124 tileLargeFrames[674] = 2;
9125 tileLargeFrames[675] = 2;
9126 tileLargeFrames[676] = 2;
9127 tileFrameImportant[410] = true;
9128 tileFrameImportant[480] = true;
9129 tileFrameImportant[509] = true;
9130 tileFrameImportant[657] = true;
9131 tileFrameImportant[658] = true;
9132 tileLighted[658] = true;
9133 wallHouse[173] = true;
9134 wallHouse[183] = true;
9135 wallHouse[179] = true;
9136 wallLargeFrames[179] = 1;
9137 tileSolid[367] = true;
9138 tileBlockLight[367] = true;
9139 tileMergeDirt[367] = true;
9140 tileSolid[357] = true;
9141 tileBlockLight[357] = true;
9142 tileLargeFrames[357] = 1;
9143 tileBlendAll[357] = true;
9144 wallHouse[184] = true;
9145 wallHouse[181] = true;
9146 tileSolid[368] = true;
9147 tileBlockLight[368] = true;
9148 tileMergeDirt[368] = true;
9149 tileSolid[369] = true;
9150 tileBlockLight[369] = true;
9151 tileBrick[369] = true;
9152 tileMergeDirt[369] = true;
9153 wallHouse[186] = true;
9154 tileLargeFrames[325] = 1;
9155 tileSolid[325] = true;
9156 tileBlockLight[325] = true;
9157 wallLargeFrames[146] = 1;
9158 wallLargeFrames[147] = 1;
9159 wallLargeFrames[167] = 1;
9160 wallLargeFrames[185] = 2;
9161 wallLargeFrames[274] = 2;
9162 tileSolid[460] = true;
9163 tileSolid[326] = true;
9164 tileBlockLight[326] = true;
9165 tileBrick[326] = true;
9166 tileSolid[458] = true;
9167 tileBlockLight[458] = true;
9168 tileBrick[458] = true;
9169 tileSolid[459] = true;
9170 tileBrick[459] = true;
9171 tileSolid[327] = true;
9172 tileBlockLight[327] = true;
9173 tileBrick[327] = true;
9174 tileSolid[345] = true;
9175 tileBlockLight[345] = true;
9176 tileBrick[345] = true;
9177 tileLighted[327] = true;
9178 tileSolid[328] = true;
9179 tileBrick[328] = true;
9180 tileSolid[329] = true;
9181 tileBrick[329] = true;
9182 tileBlockLight[329] = true;
9183 tileSolid[507] = true;
9184 tileBlockLight[507] = true;
9185 tileBrick[507] = true;
9186 tileSolid[508] = true;
9187 tileBlockLight[508] = true;
9188 tileBrick[508] = true;
9189 tileLighted[336] = true;
9190 tileLighted[340] = true;
9191 tileLighted[341] = true;
9192 tileLighted[342] = true;
9193 tileLighted[343] = true;
9194 tileLighted[344] = true;
9195 tileLighted[349] = true;
9196 tileLighted[598] = true;
9197 tileSolid[421] = true;
9198 tileBlockLight[421] = true;
9199 tileSolid[422] = true;
9200 tileBlockLight[422] = true;
9201 tileSolid[426] = true;
9202 tileBlockLight[426] = true;
9203 tileSolid[430] = true;
9204 tileBlockLight[430] = true;
9205 tileSolid[431] = true;
9206 tileBlockLight[431] = true;
9207 tileSolid[432] = true;
9208 tileBlockLight[432] = true;
9209 tileSolid[433] = true;
9210 tileBlockLight[433] = true;
9211 tileSolid[434] = true;
9212 tileBlockLight[434] = true;
9213 tileSolid[446] = true;
9214 tileSolid[447] = true;
9215 tileSolid[448] = true;
9216 tileFrameImportant[427] = true;
9217 tileSolidTop[427] = true;
9218 tileSolid[427] = true;
9219 tileNoAttach[427] = true;
9220 tileTable[427] = true;
9221 tileLavaDeath[427] = true;
9222 tileNoSunLight[427] = false;
9223 tileSolid[476] = true;
9224 for (int num = 435; num <= 439; num++)
9225 {
9226 tileFrameImportant[num] = true;
9227 tileSolidTop[num] = true;
9228 tileSolid[num] = true;
9229 tileNoAttach[num] = true;
9230 tileTable[num] = true;
9231 tileLavaDeath[num] = true;
9232 tileNoSunLight[num] = false;
9233 }
9234 tileSolid[284] = true;
9235 tileBlockLight[284] = true;
9236 tileSolid[346] = true;
9237 tileBlockLight[346] = true;
9238 tileLighted[346] = true;
9239 tileShine[346] = 2000;
9240 tileShine2[346] = true;
9241 tileBrick[346] = true;
9242 tileMergeDirt[346] = true;
9243 tileSolid[347] = true;
9244 tileBlockLight[347] = true;
9245 tileLighted[347] = true;
9246 tileShine[347] = 1900;
9247 tileShine2[347] = true;
9248 tileBrick[347] = true;
9249 tileMergeDirt[347] = true;
9250 tileSolid[348] = true;
9251 tileBlockLight[348] = true;
9252 tileLighted[348] = true;
9253 tileShine[348] = 1800;
9254 tileShine2[348] = true;
9255 tileBrick[348] = true;
9256 tileMergeDirt[348] = true;
9257 tileSolid[350] = true;
9258 tileBlockLight[350] = true;
9259 tileLighted[350] = true;
9260 tileBrick[350] = true;
9261 tileMergeDirt[350] = true;
9262 tileGlowMask[350] = 94;
9263 tileGlowMask[390] = 130;
9264 tileGlowMask[381] = 126;
9265 tileGlowMask[517] = 258;
9266 tileGlowMask[687] = 336;
9267 tileGlowMask[534] = 259;
9268 tileGlowMask[535] = 260;
9269 tileGlowMask[689] = 338;
9270 tileGlowMask[536] = 261;
9271 tileGlowMask[537] = 262;
9272 tileGlowMask[690] = 339;
9273 tileGlowMask[539] = 263;
9274 tileGlowMask[540] = 264;
9275 tileGlowMask[688] = 337;
9276 tileGlowMask[625] = 311;
9277 tileGlowMask[626] = 312;
9278 tileGlowMask[691] = 340;
9279 tileGlowMask[627] = 313;
9280 tileGlowMask[628] = 314;
9281 tileGlowMask[692] = 341;
9282 tileGlowMask[370] = 111;
9283 tileGlowMask[429] = 214;
9284 tileGlowMask[209] = 215;
9285 tileGlowMask[445] = 214;
9286 tileGlowMask[129] = -2;
9287 tileGlowMask[633] = 326;
9288 tileGlowMask[659] = 348;
9289 tileGlowMask[667] = 349;
9290 tileLighted[429] = true;
9291 tileLighted[209] = true;
9292 tileGlowMask[410] = 201;
9293 tileGlowMask[509] = 265;
9294 tileGlowMask[658] = 333;
9295 tileSolid[370] = true;
9296 tileBlockLight[370] = true;
9297 tileLighted[370] = true;
9298 tileShine[370] = 1900;
9299 tileShine2[370] = true;
9300 tileBrick[370] = true;
9301 tileMergeDirt[370] = true;
9302 tileContainer[21] = true;
9303 tileContainer[467] = true;
9304 tileContainer[88] = true;
9305 tileContainer[470] = true;
9306 tileContainer[475] = true;
9307 tileSign[55] = true;
9308 tileSign[85] = true;
9309 tileSign[425] = true;
9310 tileSign[573] = true;
9311 tileSolid[383] = true;
9312 tileBrick[383] = true;
9313 tileBlockLight[383] = true;
9314 tileSolid[385] = true;
9315 tileBrick[385] = true;
9316 tileBlockLight[385] = true;
9317 tileSolid[472] = true;
9318 tileBrick[472] = true;
9319 tileMergeDirt[472] = true;
9320 tileBlockLight[472] = true;
9321 tileSolid[473] = true;
9322 tileBrick[473] = true;
9323 tileMergeDirt[473] = true;
9324 tileBlockLight[473] = true;
9325 tileSolid[500] = true;
9326 tileBrick[500] = true;
9327 tileLighted[500] = true;
9328 tileMergeDirt[500] = true;
9329 tileBlockLight[500] = true;
9330 tileSolid[501] = true;
9331 tileBrick[501] = true;
9332 tileLighted[501] = true;
9333 tileMergeDirt[501] = true;
9334 tileBlockLight[501] = true;
9335 tileSolid[502] = true;
9336 tileBrick[502] = true;
9337 tileLighted[502] = true;
9338 tileMergeDirt[502] = true;
9339 tileBlockLight[502] = true;
9340 tileSolid[503] = true;
9341 tileBrick[503] = true;
9342 tileLighted[503] = true;
9343 tileMergeDirt[503] = true;
9344 tileBlockLight[503] = true;
9345 tileSolid[541] = true;
9346 tileBlockLight[541] = false;
9347 tileSolid[546] = true;
9348 tileBlockLight[546] = false;
9349 tileSolid[557] = true;
9350 tileBlockLight[557] = true;
9351 tileSolid[474] = true;
9352 tileBrick[474] = true;
9353 tileMergeDirt[474] = true;
9354 tileBlockLight[474] = true;
9355 tileSolid[478] = true;
9356 tileBrick[478] = true;
9357 tileMergeDirt[478] = true;
9358 tileBlockLight[478] = true;
9359 tileSolid[479] = true;
9360 tileBrick[479] = true;
9361 tileMergeDirt[479] = true;
9362 tileBlockLight[479] = true;
9363 tileSolid[562] = true;
9364 tileBrick[562] = true;
9365 tileBlockLight[562] = true;
9366 tileMergeDirt[562] = true;
9367 tileSolid[563] = true;
9368 tileBrick[563] = true;
9369 tileBlockLight[563] = true;
9370 tileMergeDirt[563] = true;
9371 tileSolid[496] = true;
9372 tileBrick[496] = true;
9373 tileMergeDirt[496] = true;
9374 tileBlockLight[496] = true;
9375 tileSolid[495] = true;
9376 tileBrick[495] = true;
9377 tileMergeDirt[495] = true;
9378 tileBlockLight[495] = true;
9379 tileSolid[396] = true;
9380 tileBlockLight[396] = true;
9381 tileSolid[397] = true;
9382 tileBlockLight[397] = true;
9383 tileSolid[399] = true;
9384 tileBlockLight[399] = true;
9385 tileSolid[401] = true;
9386 tileBlockLight[401] = true;
9387 tileSolid[398] = true;
9388 tileBlockLight[398] = true;
9389 tileSolid[400] = true;
9390 tileBlockLight[400] = true;
9391 tileSolid[402] = true;
9392 tileBlockLight[402] = true;
9393 tileSolid[403] = true;
9394 tileBlockLight[403] = true;
9395 tileSolid[404] = true;
9396 tileBlockLight[404] = true;
9397 tileSolid[407] = true;
9398 tileBlockLight[407] = true;
9399 tileShine2[407] = true;
9400 tileShine[407] = 1000;
9401 tileFrameImportant[36] = true;
9402 tileFrameImportant[275] = true;
9403 tileFrameImportant[276] = true;
9404 tileFrameImportant[277] = true;
9405 tileFrameImportant[278] = true;
9406 tileFrameImportant[279] = true;
9407 tileFrameImportant[280] = true;
9408 tileFrameImportant[281] = true;
9409 tileFrameImportant[282] = true;
9410 tileFrameImportant[285] = true;
9411 tileFrameImportant[286] = true;
9412 tileFrameImportant[414] = true;
9413 tileFrameImportant[413] = true;
9414 tileFrameImportant[309] = true;
9415 tileFrameImportant[310] = true;
9416 tileFrameImportant[339] = true;
9417 tileFrameImportant[532] = true;
9418 tileLighted[286] = true;
9419 tileLighted[302] = true;
9420 tileFrameImportant[298] = true;
9421 tileFrameImportant[299] = true;
9422 tileSolid[170] = true;
9423 tileBlockLight[170] = true;
9424 tileFrameImportant[171] = true;
9425 tileLighted[171] = true;
9426 tileFrameImportant[247] = true;
9427 tileFrameImportant[245] = true;
9428 tileFrameImportant[246] = true;
9429 tileFrameImportant[239] = true;
9430 tileFrameImportant[240] = true;
9431 tileFrameImportant[241] = true;
9432 tileFrameImportant[242] = true;
9433 tileFrameImportant[243] = true;
9434 tileFrameImportant[244] = true;
9435 tileFrameImportant[254] = true;
9436 tileSolid[221] = true;
9437 tileBlockLight[221] = true;
9438 tileMergeDirt[221] = true;
9439 tileLighted[96] = true;
9440 tileMergeDirt[250] = true;
9441 tileSolid[272] = true;
9442 tileBlockLight[272] = true;
9443 tileSolid[229] = true;
9444 tileBlockLight[229] = true;
9445 tileMergeDirt[229] = true;
9446 tileSolid[230] = true;
9447 tileBlockLight[230] = true;
9448 tileMergeDirt[230] = true;
9449 tileSolid[222] = true;
9450 tileBlockLight[222] = true;
9451 tileMergeDirt[222] = true;
9452 tileSolid[223] = true;
9453 tileBlockLight[223] = true;
9454 tileMergeDirt[223] = true;
9455 tileSolid[224] = true;
9456 tileBlockLight[224] = true;
9457 tileFrameImportant[237] = true;
9458 tileFrameImportant[238] = true;
9459 tileSolid[225] = true;
9460 tileBlockLight[225] = true;
9461 tileBrick[225] = true;
9462 tileSolid[226] = true;
9463 tileBlockLight[226] = true;
9464 tileBrick[226] = true;
9465 tileSolid[235] = true;
9466 tileBlockLight[235] = true;
9467 tileFrameImportant[235] = true;
9468 tileLighted[238] = true;
9469 tileCut[254] = true;
9470 tileFrameImportant[236] = true;
9471 tileCut[236] = true;
9472 tileSolid[191] = true;
9473 tileBrick[191] = true;
9474 tileBlockLight[191] = true;
9475 tileSolid[211] = true;
9476 tileBlockLight[211] = true;
9477 tileSolid[208] = true;
9478 tileBrick[208] = true;
9479 tileBlockLight[208] = true;
9480 tileSolid[192] = true;
9481 tileBlockLight[192] = true;
9482 tileSolid[193] = true;
9483 tileBrick[193] = true;
9484 tileBlockLight[193] = true;
9485 tileMergeDirt[193] = true;
9486 tileSolid[194] = true;
9487 tileBrick[194] = true;
9488 tileBlockLight[194] = true;
9489 tileSolid[195] = true;
9490 tileBrick[195] = true;
9491 tileMergeDirt[195] = true;
9492 tileBlockLight[195] = true;
9493 tileBlockLight[200] = true;
9494 tileSolid[200] = true;
9495 tileBrick[200] = true;
9496 tileBlockLight[203] = true;
9497 tileSolid[203] = true;
9498 tileMergeDirt[203] = true;
9499 tileBlockLight[204] = true;
9500 tileSolid[204] = true;
9501 tileMergeDirt[204] = true;
9502 tileBlockLight[165] = true;
9503 tileShine2[147] = true;
9504 tileShine2[161] = true;
9505 tileShine2[163] = true;
9506 tileShine2[164] = true;
9507 tileSolid[189] = true;
9508 tileBlockLight[51] = true;
9509 tileLighted[204] = true;
9510 tileShine[204] = 1150;
9511 tileShine2[204] = true;
9512 tileSolid[190] = true;
9513 tileBlockLight[190] = true;
9514 tileBrick[190] = true;
9515 tileSolid[198] = true;
9516 tileMergeDirt[198] = true;
9517 tileBrick[198] = true;
9518 tileBlockLight[198] = true;
9519 tileSolid[206] = true;
9520 tileBlockLight[206] = true;
9521 tileMergeDirt[206] = true;
9522 tileBrick[206] = true;
9523 tileBlockLight[234] = true;
9524 tileSolid[248] = true;
9525 tileSolid[249] = true;
9526 tileSolid[250] = true;
9527 tileBrick[248] = true;
9528 tileBrick[249] = true;
9529 tileBrick[250] = true;
9530 tileSolid[251] = true;
9531 tileSolid[252] = true;
9532 tileBrick[252] = true;
9533 tileSolid[253] = true;
9534 tileBrick[253] = true;
9535 tileMergeDirt[251] = true;
9536 tileMergeDirt[252] = true;
9537 tileMergeDirt[253] = true;
9538 tileBlockLight[251] = true;
9539 tileBlockLight[252] = true;
9540 tileBlockLight[253] = true;
9541 tileBlockLight[248] = true;
9542 tileBlockLight[249] = true;
9543 tileBlockLight[250] = true;
9544 tileLargeFrames[273] = 1;
9545 tileSolid[273] = true;
9546 tileBlockLight[273] = true;
9547 tileLargeFrames[274] = 1;
9548 tileSolid[274] = true;
9549 tileBlockLight[274] = true;
9550 tileLargeFrames[618] = 1;
9551 tileSolid[618] = true;
9552 tileBlockLight[618] = true;
9553 for (int num2 = 255; num2 <= 268; num2++)
9554 {
9555 tileSolid[num2] = true;
9556 if (num2 > 261)
9557 {
9558 tileLighted[num2] = true;
9559 tileShine2[num2] = true;
9560 }
9561 }
9562 tileFrameImportant[269] = true;
9563 tileFrameImportant[470] = true;
9564 tileFrameImportant[475] = true;
9565 tileFrameImportant[390] = true;
9566 tileFrameImportant[597] = true;
9567 tileLighted[597] = true;
9568 tileNoAttach[390] = true;
9569 tileLavaDeath[390] = true;
9570 tileLighted[390] = true;
9571 tileFrameImportant[617] = true;
9572 wallHouse[168] = true;
9573 wallHouse[169] = true;
9574 wallHouse[142] = true;
9575 wallHouse[143] = true;
9576 wallHouse[144] = true;
9577 wallHouse[149] = true;
9578 wallHouse[151] = true;
9579 wallHouse[150] = true;
9580 wallHouse[152] = true;
9581 wallHouse[145] = true;
9582 wallHouse[148] = true;
9583 wallHouse[175] = true;
9584 wallHouse[176] = true;
9585 wallHouse[182] = true;
9586 for (int num3 = 153; num3 < 167; num3++)
9587 {
9588 wallHouse[num3] = true;
9589 }
9590 wallHouse[146] = true;
9591 wallHouse[147] = true;
9592 wallHouse[149] = true;
9593 wallHouse[167] = true;
9594 wallHouse[168] = true;
9595 wallHouse[133] = true;
9596 wallHouse[134] = true;
9597 wallHouse[135] = true;
9598 wallHouse[136] = true;
9599 wallHouse[137] = true;
9600 wallHouse[75] = true;
9601 wallHouse[76] = true;
9602 wallHouse[78] = true;
9603 wallHouse[82] = true;
9604 wallHouse[77] = true;
9605 wallHouse[1] = true;
9606 wallHouse[4] = true;
9607 wallHouse[5] = true;
9608 wallHouse[6] = true;
9609 wallHouse[10] = true;
9610 wallHouse[11] = true;
9611 wallHouse[12] = true;
9612 wallHouse[16] = true;
9613 wallHouse[17] = true;
9614 wallHouse[18] = true;
9615 wallHouse[19] = true;
9616 wallHouse[20] = true;
9617 wallHouse[21] = true;
9618 wallHouse[22] = true;
9619 wallHouse[23] = true;
9620 wallHouse[24] = true;
9621 wallHouse[25] = true;
9622 wallHouse[26] = true;
9623 wallHouse[27] = true;
9624 wallHouse[29] = true;
9625 wallHouse[30] = true;
9626 wallHouse[31] = true;
9627 wallHouse[32] = true;
9628 wallHouse[33] = true;
9629 wallHouse[34] = true;
9630 wallHouse[35] = true;
9631 wallHouse[36] = true;
9632 wallHouse[37] = true;
9633 wallHouse[38] = true;
9634 wallHouse[39] = true;
9635 wallHouse[41] = true;
9636 wallHouse[42] = true;
9637 wallHouse[43] = true;
9638 wallHouse[44] = true;
9639 wallHouse[45] = true;
9640 wallHouse[46] = true;
9641 wallHouse[47] = true;
9642 wallHouse[66] = true;
9643 wallHouse[67] = true;
9644 wallHouse[68] = true;
9645 wallHouse[72] = true;
9646 wallHouse[73] = true;
9647 wallHouse[107] = true;
9648 wallHouse[106] = true;
9649 wallHouse[245] = true;
9650 wallHouse[315] = true;
9651 wallHouse[316] = true;
9652 wallHouse[317] = true;
9653 wallHouse[109] = true;
9654 wallHouse[110] = true;
9655 wallHouse[111] = true;
9656 wallHouse[112] = true;
9657 wallHouse[113] = true;
9658 wallHouse[114] = true;
9659 wallHouse[115] = true;
9660 wallHouse[116] = true;
9661 wallHouse[117] = true;
9662 wallHouse[118] = true;
9663 wallHouse[119] = true;
9664 wallHouse[120] = true;
9665 wallHouse[121] = true;
9666 wallHouse[122] = true;
9667 wallHouse[123] = true;
9668 wallHouse[124] = true;
9669 wallHouse[125] = true;
9670 wallHouse[108] = true;
9671 wallHouse[100] = true;
9672 wallHouse[101] = true;
9673 wallHouse[102] = true;
9674 wallHouse[103] = true;
9675 wallHouse[104] = true;
9676 wallHouse[105] = true;
9677 wallHouse[84] = true;
9678 wallHouse[74] = true;
9679 wallHouse[241] = true;
9680 wallHouse[85] = true;
9681 wallHouse[88] = true;
9682 wallHouse[89] = true;
9683 wallHouse[90] = true;
9684 wallHouse[91] = true;
9685 wallHouse[92] = true;
9686 wallHouse[93] = true;
9687 wallHouse[126] = true;
9688 wallHouse[127] = true;
9689 wallHouse[128] = true;
9690 wallHouse[129] = true;
9691 wallHouse[130] = true;
9692 wallHouse[131] = true;
9693 wallHouse[132] = true;
9694 wallHouse[138] = true;
9695 wallHouse[139] = true;
9696 wallHouse[140] = true;
9697 wallHouse[141] = true;
9698 wallHouse[177] = true;
9699 wallHouse[172] = true;
9700 wallHouse[242] = true;
9701 wallHouse[243] = true;
9702 wallHouse[174] = true;
9703 wallHouse[223] = true;
9704 wallHouse[230] = true;
9705 wallHouse[228] = true;
9706 wallHouse[229] = true;
9707 wallHouse[236] = true;
9708 wallHouse[319] = true;
9709 wallHouse[318] = true;
9710 wallHouse[321] = true;
9711 wallHouse[322] = true;
9712 wallHouse[320] = true;
9713 wallHouse[246] = true;
9714 wallHouse[247] = true;
9715 wallHouse[248] = true;
9716 wallHouse[249] = true;
9717 wallHouse[250] = true;
9718 wallHouse[251] = true;
9719 wallHouse[252] = true;
9720 wallHouse[253] = true;
9721 wallHouse[254] = true;
9722 wallHouse[255] = true;
9723 wallHouse[314] = true;
9724 wallHouse[256] = true;
9725 wallHouse[257] = true;
9726 wallHouse[258] = true;
9727 wallHouse[259] = true;
9728 wallHouse[260] = true;
9729 wallHouse[261] = true;
9730 wallHouse[262] = true;
9731 wallHouse[263] = true;
9732 wallHouse[264] = true;
9733 wallHouse[265] = true;
9734 wallHouse[266] = true;
9735 wallHouse[267] = true;
9736 wallHouse[268] = true;
9737 wallHouse[269] = true;
9738 wallHouse[270] = true;
9739 wallHouse[271] = true;
9740 wallHouse[272] = true;
9741 wallHouse[273] = true;
9742 wallHouse[274] = true;
9743 wallHouse[275] = true;
9744 wallHouse[276] = true;
9745 wallHouse[277] = true;
9746 wallHouse[278] = true;
9747 wallHouse[279] = true;
9748 wallHouse[280] = true;
9749 wallHouse[281] = true;
9750 wallHouse[282] = true;
9751 wallHouse[283] = true;
9752 wallHouse[284] = true;
9753 wallHouse[285] = true;
9754 wallHouse[286] = true;
9755 wallHouse[287] = true;
9756 wallHouse[288] = true;
9757 wallHouse[289] = true;
9758 wallHouse[290] = true;
9759 wallHouse[291] = true;
9760 wallHouse[292] = true;
9761 wallHouse[293] = true;
9762 wallHouse[294] = true;
9763 wallHouse[295] = true;
9764 wallHouse[296] = true;
9765 wallHouse[297] = true;
9766 wallHouse[298] = true;
9767 wallHouse[299] = true;
9768 wallHouse[300] = true;
9769 wallHouse[301] = true;
9770 wallHouse[302] = true;
9771 wallHouse[303] = true;
9772 wallHouse[304] = true;
9773 wallHouse[305] = true;
9774 wallHouse[306] = true;
9775 wallHouse[307] = true;
9776 wallHouse[308] = true;
9777 wallHouse[309] = true;
9778 wallHouse[310] = true;
9779 wallHouse[311] = true;
9780 wallLight[0] = true;
9781 wallLight[21] = true;
9782 wallLight[318] = true;
9783 wallLight[106] = true;
9784 wallLight[317] = true;
9785 wallLight[107] = true;
9786 wallLight[138] = true;
9787 wallLight[140] = true;
9788 wallLight[141] = true;
9789 wallLight[139] = true;
9790 wallLight[145] = true;
9791 wallLight[150] = true;
9792 wallLight[152] = true;
9793 wallLight[245] = true;
9794 wallLight[315] = true;
9795 wallLight[168] = true;
9796 for (int num4 = 0; num4 < WallID.Count; num4++)
9797 {
9798 wallDungeon[num4] = false;
9799 }
9800 wallDungeon[7] = true;
9801 wallDungeon[8] = true;
9802 wallDungeon[9] = true;
9803 wallDungeon[94] = true;
9804 wallDungeon[95] = true;
9805 wallDungeon[96] = true;
9806 wallDungeon[97] = true;
9807 wallDungeon[98] = true;
9808 wallDungeon[99] = true;
9810 }
9811
9812 private void ClientInitialize()
9813 {
9814 //IL_01cc: Unknown result type (might be due to invalid IL or missing references)
9815 //IL_01d6: Expected O, but got Unknown
9816 MessageBuffer.OnTileChangeReceived += OnTileChangeEvent;
9817 LanguageManager.Instance.OnLanguageChanged += delegate
9818 {
9820 };
9821 PlayerInput.OnBindingChange += ItemTooltip.InvalidateTooltips;
9822 clientUUID = Guid.NewGuid().ToString();
9824 Platform.Current.InitializeClientServices(base.Window.Handle);
9825 Platform.Get<IImeService>().AddKeyListener((Action<char>)delegate(char keyStroke)
9826 {
9827 if (keyCount < 10)
9828 {
9830 keyString[keyCount] = keyStroke.ToString() ?? "";
9831 keyCount++;
9832 }
9833 });
9834 base.Window.AllowUserResizing = true;
9835 LoadSettings();
9836 PreventUpdatingTargets = false;
9839 if (screenWidth > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width)
9840 {
9841 screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
9842 }
9843 if (screenHeight > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height)
9844 {
9845 screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
9846 }
9848 graphics.ApplyChanges();
9849 if (Main.OnResolutionChanged != null)
9850 {
9852 }
9853 CheckBunny();
9854 base.GraphicsDevice.DeviceLost += GraphicsDeviceLost;
9855 base.GraphicsDevice.DeviceReset += GraphicsDeviceLost;
9856 base.GraphicsDevice.DeviceResetting += GraphicsDeviceLost;
9858 {
9859 menuMode = 1212;
9860 }
9863 OpenRecent();
9865 Chroma = new ChromaEngine();
9867 ChromaPainter.CollectBoundKeys();
9869 if (autoJoin)
9870 {
9871 LoadPlayers();
9872 menuMode = 1;
9873 menuMultiplayer = true;
9874 }
9875 fpsTimer.Start();
9876 }
9877
9878 private static void CacheSupportedDisplaySizes()
9879 {
9880 numDisplayModes = 0;
9881 foreach (DisplayMode supportedDisplayMode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
9882 {
9884 {
9885 continue;
9886 }
9887 bool flag = true;
9888 for (int i = 0; i < numDisplayModes; i++)
9889 {
9891 {
9892 flag = false;
9893 break;
9894 }
9895 }
9896 if (flag)
9897 {
9901 }
9902 }
9903 }
9904
9905 public static void LoadTestLog(string logname)
9906 {
9907 }
9908
9913
9914 protected override void LoadContent()
9915 {
9916 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
9917 //IL_0043: Expected O, but got Unknown
9918 //IL_0108: Unknown result type (might be due to invalid IL or missing references)
9919 //IL_0112: Expected O, but got Unknown
9920 //IL_0167: Unknown result type (might be due to invalid IL or missing references)
9921 //IL_016d: Expected O, but got Unknown
9923 if (XnaExtensions.Get<IAssetRepository>((IServiceProvider)base.Services) == null)
9924 {
9926 }
9928 Assets.AssetLoadFailHandler = new FailedToLoadAssetCustomAction(OnceFailedLoadingAnAsset);
9929 mapSectionTexture = new RenderTarget2D(base.GraphicsDevice, 200, 150);
9930 ShaderContentManager = new ContentManager(base.Content.ServiceProvider, base.Content.RootDirectory);
9931 PixelShaderRef.Value = ShaderContentManager.Load<Effect>("PixelShader");
9932 VertexPixelShaderRef.Value = ShaderContentManager.Load<Effect>("PixelShader");
9933 TileShaderRef.Value = ShaderContentManager.Load<Effect>("TileShader");
9934 ScreenShaderRef.Value = ShaderContentManager.Load<Effect>("ScreenShader");
9935 spriteBatch = new SpriteBatch(base.GraphicsDevice);
9936 tileBatch = new TileBatch(base.GraphicsDevice);
9937 DebugDrawer = new BasicDebugDrawer(base.GraphicsDevice);
9938 GameViewMatrix = new SpriteViewMatrix(base.GraphicsDevice);
9939 BackgroundViewMatrix = new SpriteViewMatrix(base.GraphicsDevice);
9941 {
9943 }
9944 else
9945 {
9947 }
9949 VanillaContentValidator.Instance = new VanillaContentValidator("Terraria.IO.Data.ResourcePacksDefaultInfo.tsv");
9950 if (SocialAPI.Workshop != null)
9951 {
9952 SocialAPI.Workshop.LoadEarlyContent();
9953 }
9958 }
9959
9961 {
9962 Configuration.Load();
9963 Configuration.Get("UseExperimentalFeatures", ref UseExperimentalFeatures);
9964 Configuration.Get("Support4K", ref Support4K);
9965 bool flag = Support4K && base.GraphicsDevice.Adapter.IsProfileSupported(GraphicsProfile.HiDef);
9966 if (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width <= 1920 && GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height <= 1200)
9967 {
9968 flag = false;
9969 }
9970 if (Program.IsXna && Support4K && flag && base.GraphicsDevice.GraphicsProfile != GraphicsProfile.HiDef)
9971 {
9973 }
9974 else if (Program.IsFna)
9975 {
9977 }
9978 }
9979
9981 {
9982 yield return null;
9985 yield return null;
9986 bool doneLoadingMusic = false;
9988 while (!doneLoadingMusic)
9989 {
9990 try
9991 {
9992 if (!musicLoadProcedure.MoveNext())
9993 {
9994 doneLoadingMusic = true;
9995 }
9996 }
9997 catch
9998 {
9999 doneLoadingMusic = true;
10000 musicVolume = 0f;
10001 soundVolume = 0f;
10002 }
10003 yield return null;
10004 }
10005 _musicLoaded = true;
10006 splashTimer.Start();
10007 yield return null;
10008 _begunMainAsyncLoad = true;
10010 _artLoaded = true;
10015 }
10016
10017 private void TickLoadProcess()
10018 {
10020 }
10021
10042
10044 {
10045 yield return null;
10046 IEnumerator sub1 = audioSystem.PrepareWaveBank();
10047 while (sub1.MoveNext())
10048 {
10049 yield return sub1.Current;
10050 }
10051 for (int i = 1; i < maxMusic; i++)
10052 {
10053 audioSystem.LoadCue(i, "Music_" + i);
10054 yield return null;
10055 }
10056 audioSystem.LoadFromSources();
10057 }
10058
10059 protected override void UnloadContent()
10060 {
10061 }
10062
10064 {
10065 if (netMode != 1)
10066 {
10067 bool num = forceHalloweenForToday;
10068 bool flag = forceXMasForToday;
10069 forceXMasForToday = false;
10070 forceHalloweenForToday = false;
10071 int waveNumber = NPC.waveNumber;
10072 _ = NPC.waveKills;
10073 if (pumpkinMoon && waveNumber >= 15)
10074 {
10076 }
10077 if (snowMoon && waveNumber >= 15)
10078 {
10079 forceXMasForToday = true;
10080 }
10081 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(50, 255, 130);
10082 if (num != forceHalloweenForToday)
10083 {
10084 WorldGen.BroadcastText(NetworkText.FromKey(forceHalloweenForToday ? "Misc.StartedVictoryHalloween" : "Misc.EndedVictoryHalloween"), color);
10085 }
10086 if (flag != forceXMasForToday)
10087 {
10088 WorldGen.BroadcastText(NetworkText.FromKey(forceXMasForToday ? "Misc.StartedVictoryXmas" : "Misc.EndedVictoryXmas"), color);
10089 }
10090 }
10091 }
10092
10094 {
10095 if (netMode != 1 && (pumpkinMoon || snowMoon))
10096 {
10097 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(175, 75, 255);
10098 string key = "Misc.PumpkinMoonScore";
10099 if (snowMoon)
10100 {
10101 key = "Misc.FrostMoonScore";
10102 }
10104 }
10105 }
10106
10107 public static void stopMoonEvent()
10108 {
10109 _ = NPC.waveNumber;
10110 _ = NPC.waveKills;
10111 if (pumpkinMoon)
10112 {
10113 pumpkinMoon = false;
10114 if (netMode != 1)
10115 {
10116 NPC.totalInvasionPoints = 0f;
10117 NPC.waveKills = 0f;
10118 NPC.waveNumber = 0;
10119 }
10120 }
10121 if (snowMoon)
10122 {
10123 snowMoon = false;
10124 if (netMode != 1)
10125 {
10126 NPC.totalInvasionPoints = 0f;
10127 NPC.waveKills = 0f;
10128 NPC.waveNumber = 0;
10129 }
10130 }
10131 }
10132
10133 public static void startPumpkinMoon()
10134 {
10135 pumpkinMoon = true;
10136 snowMoon = false;
10137 bloodMoon = false;
10138 invasionProgress = -1;
10142 if (netMode != 1)
10143 {
10144 NPC.totalInvasionPoints = 0f;
10145 NPC.waveKills = 0f;
10146 NPC.waveNumber = 1;
10148 if (netMode == 0)
10149 {
10150 NewText(invasionWaveText.ToString(), 175, 75);
10151 }
10152 else if (netMode == 2)
10153 {
10155 }
10156 }
10157 }
10158
10159 public static void startSnowMoon()
10160 {
10161 snowMoon = true;
10162 pumpkinMoon = false;
10163 bloodMoon = false;
10164 invasionProgress = -1;
10168 if (netMode != 1)
10169 {
10170 NPC.totalInvasionPoints = 0f;
10171 NPC.waveKills = 0f;
10172 NPC.waveNumber = 1;
10174 if (netMode == 0)
10175 {
10176 NewText(invasionWaveText.ToString(), 175, 75);
10177 }
10178 else if (netMode == 2)
10179 {
10181 }
10182 }
10183 }
10184
10185 protected void UpdateAudio()
10186 {
10188 {
10189 return;
10190 }
10191 if (!dedServ && !showSplash)
10192 {
10194 }
10195 if (musicVolume == 0f)
10196 {
10197 curMusic = 0;
10198 }
10199 try
10200 {
10201 if (dedServ)
10202 {
10203 return;
10204 }
10205 bool flag = base.IsActive;
10206 if (!flag)
10207 {
10208 audioSystem.PauseAll();
10210 }
10211 else
10212 {
10213 audioSystem.ResumeAll();
10214 }
10215 if (drunkWorld)
10216 {
10217 TOWMusicUnlocked = true;
10218 }
10219 if (gameMenu)
10220 {
10221 swapMusic = false;
10222 }
10223 if (swapMusic)
10224 {
10225 if (drunkWorld && !remixWorld)
10226 {
10228 }
10229 else
10230 {
10232 }
10233 }
10234 else if (!gameMenu && drunkWorld && !remixWorld)
10235 {
10237 }
10238 else
10239 {
10241 }
10242 if (musicBox2 >= 0)
10243 {
10244 SceneMetrics.ActiveMusicBox = musicBox2;
10245 }
10247 {
10249 {
10250 newMusic = 1;
10251 }
10253 {
10254 newMusic = 2;
10255 }
10257 {
10258 newMusic = 3;
10259 }
10261 {
10262 newMusic = 4;
10263 }
10265 {
10266 newMusic = 5;
10267 }
10269 {
10270 newMusic = 6;
10271 }
10273 {
10274 newMusic = 7;
10275 }
10277 {
10278 newMusic = 8;
10279 }
10281 {
10282 newMusic = 9;
10283 }
10285 {
10286 newMusic = 10;
10287 }
10288 if (SceneMetrics.ActiveMusicBox == 11)
10289 {
10290 newMusic = 11;
10291 }
10292 if (SceneMetrics.ActiveMusicBox == 10)
10293 {
10294 newMusic = 12;
10295 }
10296 if (SceneMetrics.ActiveMusicBox == 12)
10297 {
10298 newMusic = 13;
10299 }
10300 if (SceneMetrics.ActiveMusicBox == 13)
10301 {
10302 newMusic = 14;
10303 }
10304 if (SceneMetrics.ActiveMusicBox == 14)
10305 {
10306 newMusic = 15;
10307 }
10308 if (SceneMetrics.ActiveMusicBox == 15)
10309 {
10310 newMusic = 16;
10311 }
10312 if (SceneMetrics.ActiveMusicBox == 16)
10313 {
10314 newMusic = 17;
10315 }
10316 if (SceneMetrics.ActiveMusicBox == 17)
10317 {
10318 newMusic = 18;
10319 }
10320 if (SceneMetrics.ActiveMusicBox == 18)
10321 {
10322 newMusic = 19;
10323 }
10324 if (SceneMetrics.ActiveMusicBox == 19)
10325 {
10326 newMusic = 20;
10327 }
10328 if (SceneMetrics.ActiveMusicBox == 20)
10329 {
10330 newMusic = 21;
10331 }
10332 if (SceneMetrics.ActiveMusicBox == 21)
10333 {
10334 newMusic = 22;
10335 }
10336 if (SceneMetrics.ActiveMusicBox == 22)
10337 {
10338 newMusic = 23;
10339 }
10340 if (SceneMetrics.ActiveMusicBox == 23)
10341 {
10342 newMusic = 24;
10343 }
10344 if (SceneMetrics.ActiveMusicBox == 24)
10345 {
10346 newMusic = 25;
10347 }
10348 if (SceneMetrics.ActiveMusicBox == 25)
10349 {
10350 newMusic = 26;
10351 }
10352 if (SceneMetrics.ActiveMusicBox == 26)
10353 {
10354 newMusic = 27;
10355 }
10356 if (SceneMetrics.ActiveMusicBox == 27)
10357 {
10358 newMusic = 29;
10359 }
10360 if (SceneMetrics.ActiveMusicBox == 28)
10361 {
10362 newMusic = 30;
10363 }
10364 if (SceneMetrics.ActiveMusicBox == 29)
10365 {
10366 newMusic = 31;
10367 }
10368 if (SceneMetrics.ActiveMusicBox == 30)
10369 {
10370 newMusic = 32;
10371 }
10372 if (SceneMetrics.ActiveMusicBox == 31)
10373 {
10374 newMusic = 33;
10375 }
10376 if (SceneMetrics.ActiveMusicBox == 32)
10377 {
10378 newMusic = 38;
10379 }
10380 if (SceneMetrics.ActiveMusicBox == 33)
10381 {
10382 newMusic = 37;
10383 }
10384 if (SceneMetrics.ActiveMusicBox == 34)
10385 {
10386 newMusic = 35;
10387 }
10388 if (SceneMetrics.ActiveMusicBox == 35)
10389 {
10390 newMusic = 36;
10391 }
10392 if (SceneMetrics.ActiveMusicBox == 36)
10393 {
10394 newMusic = 34;
10395 }
10396 if (SceneMetrics.ActiveMusicBox == 37)
10397 {
10398 newMusic = 39;
10399 }
10400 if (SceneMetrics.ActiveMusicBox == 38)
10401 {
10402 newMusic = 40;
10403 }
10404 if (SceneMetrics.ActiveMusicBox == 39)
10405 {
10406 newMusic = 41;
10407 }
10408 if (SceneMetrics.ActiveMusicBox == 40)
10409 {
10410 newMusic = 44;
10411 }
10412 if (SceneMetrics.ActiveMusicBox == 41)
10413 {
10414 newMusic = 48;
10415 }
10416 if (SceneMetrics.ActiveMusicBox == 42)
10417 {
10418 newMusic = 42;
10419 }
10420 if (SceneMetrics.ActiveMusicBox == 43)
10421 {
10422 newMusic = 43;
10423 }
10424 if (SceneMetrics.ActiveMusicBox == 44)
10425 {
10426 newMusic = 46;
10427 }
10428 if (SceneMetrics.ActiveMusicBox == 45)
10429 {
10430 newMusic = 47;
10431 }
10432 if (SceneMetrics.ActiveMusicBox == 46)
10433 {
10434 newMusic = 49;
10435 }
10436 if (SceneMetrics.ActiveMusicBox == 47)
10437 {
10438 newMusic = 51;
10439 }
10440 if (SceneMetrics.ActiveMusicBox == 48)
10441 {
10442 newMusic = 52;
10443 }
10444 if (SceneMetrics.ActiveMusicBox == 49)
10445 {
10446 newMusic = 53;
10447 }
10448 if (SceneMetrics.ActiveMusicBox == 50)
10449 {
10450 newMusic = 54;
10451 }
10452 if (SceneMetrics.ActiveMusicBox == 51)
10453 {
10454 newMusic = 55;
10455 }
10456 if (SceneMetrics.ActiveMusicBox == 52)
10457 {
10458 newMusic = 56;
10459 }
10460 if (SceneMetrics.ActiveMusicBox == 53)
10461 {
10462 newMusic = 57;
10463 }
10464 if (SceneMetrics.ActiveMusicBox == 54)
10465 {
10466 newMusic = 58;
10467 }
10468 if (SceneMetrics.ActiveMusicBox == 55)
10469 {
10470 newMusic = 59;
10471 }
10472 if (SceneMetrics.ActiveMusicBox == 56)
10473 {
10474 newMusic = 60;
10475 }
10476 if (SceneMetrics.ActiveMusicBox == 57)
10477 {
10478 newMusic = 61;
10479 }
10480 if (SceneMetrics.ActiveMusicBox == 58)
10481 {
10482 newMusic = 62;
10483 }
10484 if (SceneMetrics.ActiveMusicBox == 59)
10485 {
10486 newMusic = 63;
10487 }
10488 if (SceneMetrics.ActiveMusicBox == 60)
10489 {
10490 newMusic = 64;
10491 }
10492 if (SceneMetrics.ActiveMusicBox == 61)
10493 {
10494 newMusic = 65;
10495 }
10496 if (SceneMetrics.ActiveMusicBox == 62)
10497 {
10498 newMusic = 66;
10499 }
10500 if (SceneMetrics.ActiveMusicBox == 63)
10501 {
10502 newMusic = 67;
10503 }
10504 if (SceneMetrics.ActiveMusicBox == 64)
10505 {
10506 newMusic = 68;
10507 }
10508 if (SceneMetrics.ActiveMusicBox == 65)
10509 {
10510 newMusic = 69;
10511 }
10512 if (SceneMetrics.ActiveMusicBox == 66)
10513 {
10514 newMusic = 70;
10515 }
10516 if (SceneMetrics.ActiveMusicBox == 67)
10517 {
10518 newMusic = 71;
10519 }
10520 if (SceneMetrics.ActiveMusicBox == 68)
10521 {
10522 newMusic = 72;
10523 }
10524 if (SceneMetrics.ActiveMusicBox == 69)
10525 {
10526 newMusic = 73;
10527 }
10528 if (SceneMetrics.ActiveMusicBox == 70)
10529 {
10530 newMusic = 74;
10531 }
10532 if (SceneMetrics.ActiveMusicBox == 71)
10533 {
10534 newMusic = 75;
10535 }
10536 if (SceneMetrics.ActiveMusicBox == 72)
10537 {
10538 newMusic = 76;
10539 }
10540 if (SceneMetrics.ActiveMusicBox == 73)
10541 {
10542 newMusic = 77;
10543 }
10544 if (SceneMetrics.ActiveMusicBox == 74)
10545 {
10546 newMusic = 78;
10547 }
10548 if (SceneMetrics.ActiveMusicBox == 75)
10549 {
10550 newMusic = 79;
10551 }
10552 if (SceneMetrics.ActiveMusicBox == 76)
10553 {
10554 newMusic = 80;
10555 }
10556 if (SceneMetrics.ActiveMusicBox == 77)
10557 {
10558 newMusic = 81;
10559 }
10560 if (SceneMetrics.ActiveMusicBox == 78)
10561 {
10562 newMusic = 82;
10563 }
10564 if (SceneMetrics.ActiveMusicBox == 79)
10565 {
10566 newMusic = 83;
10567 }
10568 if (SceneMetrics.ActiveMusicBox == 80)
10569 {
10570 newMusic = 84;
10571 }
10572 if (SceneMetrics.ActiveMusicBox == 81)
10573 {
10574 newMusic = 85;
10575 }
10576 if (SceneMetrics.ActiveMusicBox == 82)
10577 {
10578 newMusic = 86;
10579 }
10580 if (SceneMetrics.ActiveMusicBox == 83)
10581 {
10582 newMusic = 87;
10583 }
10584 if (SceneMetrics.ActiveMusicBox == 84)
10585 {
10586 newMusic = 88;
10587 }
10588 if (SceneMetrics.ActiveMusicBox == 85)
10589 {
10590 newMusic = 89;
10591 }
10592 if (SceneMetrics.ActiveMusicBox == 86)
10593 {
10594 newMusic = 90;
10595 }
10596 if (SceneMetrics.ActiveMusicBox == 87)
10597 {
10598 newMusic = 91;
10599 }
10600 }
10601 if (gameMenu || musicVolume == 0f)
10602 {
10603 musicBox2 = -1;
10604 SceneMetrics.ActiveMusicBox = -1;
10605 }
10606 if (musicVolume == 0f)
10607 {
10608 newMusic = 0;
10609 }
10610 audioSystem.Update();
10611 audioSystem.UpdateMisc();
10613 float num = 1f;
10614 if (NPC.MoonLordCountdown > 0)
10615 {
10616 num = (float)NPC.MoonLordCountdown / (float)NPC.MaxMoonLordCountdown;
10617 num *= num;
10618 if ((float)NPC.MoonLordCountdown > (float)NPC.MaxMoonLordCountdown * 0.2f)
10619 {
10620 num = MathHelper.Lerp(0f, 1f, num);
10621 }
10622 else
10623 {
10624 num = 0f;
10625 curMusic = 0;
10626 }
10627 if (NPC.MoonLordCountdown == 1 && curMusic >= 1 && curMusic < maxMusic)
10628 {
10629 musicFade[curMusic] = 0f;
10630 }
10631 }
10632 bool isMainTrackAudible = musicFade[curMusic] > 0.25f;
10633 for (int i = 1; i < maxMusic; i++)
10634 {
10635 float num2 = musicFade[i] * musicVolume * num;
10636 if (i >= 62 && i <= 88)
10637 {
10638 num2 *= 0.9f;
10639 }
10640 else if (i == 52)
10641 {
10642 num2 *= 1.15f;
10643 if (num2 > 1f)
10644 {
10645 num2 = 1f;
10646 }
10647 }
10648 float num3 = shimmerAlpha;
10649 switch (i)
10650 {
10651 case 28:
10652 {
10653 float num7 = 0.5f;
10654 float num8 = cloudAlpha / 9f * 10f * num7 + (1f - num7);
10655 if (num3 > 0f)
10656 {
10657 num8 *= 1f - num3;
10658 }
10659 if (num8 > 1f)
10660 {
10661 num8 = 1f;
10662 }
10663 if (gameMenu)
10664 {
10665 num8 = 0f;
10666 }
10667 num8 *= (float)Math.Pow(atmo, 4.0);
10668 if (remixWorld)
10669 {
10670 if (cloudAlpha > 0f && (double)(player[myPlayer].position.Y / 16f) > rockLayer && player[myPlayer].position.Y / 16f < (float)(maxTilesY - 350) && !player[myPlayer].ZoneSnow && !player[myPlayer].ZoneDungeon)
10671 {
10672 float trackVolume5 = musicFade[i];
10673 audioSystem.UpdateAmbientCueState(i, flag, ref trackVolume5, ambientVolume * num8);
10675 }
10676 else
10677 {
10678 float trackVolume6 = musicFade[i];
10679 audioSystem.UpdateAmbientCueTowardStopping(i, 0.005f, ref trackVolume6, ambientVolume * num8);
10681 }
10682 }
10683 else if (cloudAlpha > 0f && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2) && !player[myPlayer].ZoneSnow)
10684 {
10685 float trackVolume7 = musicFade[i];
10686 audioSystem.UpdateAmbientCueState(i, flag, ref trackVolume7, ambientVolume * num8);
10688 }
10689 else
10690 {
10691 float trackVolume8 = musicFade[i];
10692 audioSystem.UpdateAmbientCueTowardStopping(i, 0.005f, ref trackVolume8, ambientVolume * num8);
10694 }
10695 break;
10696 }
10697 case 45:
10698 {
10699 float num4 = 0.7f;
10700 float num5 = Math.Abs(windSpeedCurrent) * num4 + (1f - num4);
10701 if (num3 > 0f)
10702 {
10703 num5 *= 1f - num3;
10704 }
10705 if (num5 > 1f)
10706 {
10707 num5 = 1f;
10708 }
10709 num5 *= 0.9f;
10710 float num6 = 20f;
10711 num5 *= (float)Math.Pow(atmo, 4.0);
10712 if (remixWorld)
10713 {
10714 if (!gameMenu && Math.Abs(windSpeedCurrent) >= num6 / 50f && (double)(player[myPlayer].position.Y / 16f) > rockLayer && player[myPlayer].position.Y / 16f < (float)(maxTilesY - 350) && !player[myPlayer].ZoneDungeon)
10715 {
10716 float trackVolume = musicFade[i];
10717 audioSystem.UpdateAmbientCueState(i, flag, ref trackVolume, ambientVolume * num5);
10719 }
10720 else
10721 {
10722 float trackVolume2 = musicFade[i];
10723 audioSystem.UpdateAmbientCueTowardStopping(i, 0.005f, ref trackVolume2, ambientVolume * num5);
10725 }
10726 }
10727 else if (!gameMenu && Math.Abs(windSpeedCurrent) >= num6 / 50f && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2))
10728 {
10729 float trackVolume3 = musicFade[i];
10730 audioSystem.UpdateAmbientCueState(i, flag, ref trackVolume3, ambientVolume * num5);
10732 }
10733 else
10734 {
10735 float trackVolume4 = musicFade[i];
10736 audioSystem.UpdateAmbientCueTowardStopping(i, 0.005f, ref trackVolume4, ambientVolume * num5);
10738 }
10739 break;
10740 }
10741 default:
10742 {
10743 float tempFade = musicFade[i];
10744 if (i == curMusic)
10745 {
10746 audioSystem.UpdateCommonTrack(flag, i, num2, ref tempFade);
10747 }
10748 else
10749 {
10750 audioSystem.UpdateCommonTrackTowardStopping(i, num2, ref tempFade, isMainTrackAudible);
10751 }
10752 musicFade[i] = tempFade;
10753 break;
10754 }
10755 }
10756 }
10757 audioSystem.UpdateAudioEngine();
10758 if (musicError > 0)
10759 {
10760 musicError--;
10761 }
10762 }
10763 catch
10764 {
10765 musicError++;
10766 if (musicError >= 100)
10767 {
10768 musicError = 0;
10769 musicVolume = 0f;
10770 }
10771 }
10772 }
10773
10775 {
10776 bool flag = false;
10777 bool flag2 = false;
10778 bool flag3 = false;
10779 bool flag4 = false;
10780 bool flag5 = false;
10781 bool flag6 = false;
10782 bool flag7 = false;
10783 bool flag8 = false;
10784 bool flag9 = false;
10785 bool flag10 = false;
10786 bool flag11 = false;
10787 bool flag12 = false;
10788 bool flag13 = false;
10789 bool flag14 = false;
10790 bool flag15 = false;
10791 bool flag16 = false;
10792 bool flag17 = false;
10793 if (!showSplash)
10794 {
10796 int num = 5000;
10797 for (int i = 0; i < 200; i++)
10798 {
10799 if (!npc[i].active)
10800 {
10801 continue;
10802 }
10803 num = 5000;
10804 int num2 = 0;
10805 switch (npc[i].type)
10806 {
10807 case 13:
10808 case 14:
10809 case 15:
10810 num2 = 1;
10811 break;
10812 case 26:
10813 case 27:
10814 case 28:
10815 case 29:
10816 case 111:
10817 case 471:
10818 num2 = 11;
10819 break;
10820 case 113:
10821 case 114:
10822 num2 = 3;
10823 break;
10824 case 125:
10825 case 126:
10826 num2 = 2;
10827 break;
10828 case 127:
10829 case 134:
10830 num2 = 2;
10831 break;
10832 case 143:
10833 case 144:
10834 case 145:
10835 num2 = 11;
10836 break;
10837 case 266:
10838 num2 = 1;
10839 break;
10840 case 212:
10841 case 213:
10842 case 214:
10843 case 215:
10844 case 216:
10845 case 491:
10846 num2 = 8;
10847 break;
10848 case 245:
10849 num2 = 2;
10850 break;
10851 case 222:
10852 num2 = 1;
10853 break;
10854 case 262:
10855 case 263:
10856 case 264:
10857 num2 = 6;
10858 break;
10859 case 381:
10860 case 382:
10861 case 383:
10862 case 385:
10863 case 386:
10864 case 388:
10865 case 389:
10866 case 390:
10867 case 391:
10868 case 395:
10869 case 520:
10870 num2 = 9;
10871 break;
10872 case 398:
10873 num2 = 7;
10874 break;
10875 case 422:
10876 case 493:
10877 case 507:
10878 case 517:
10879 num2 = 10;
10880 break;
10881 case 439:
10882 num2 = 2;
10883 break;
10884 case 438:
10885 if (npc[i].ai[1] == 1f)
10886 {
10887 num = 1600;
10888 num2 = 2;
10889 }
10890 break;
10891 case 657:
10892 num2 = 13;
10893 break;
10894 case 636:
10895 num2 = 14;
10896 break;
10897 case 370:
10898 num2 = 15;
10899 break;
10900 case 668:
10901 num2 = 16;
10902 break;
10903 }
10905 {
10906 num2 = 12;
10907 }
10908 if (remixWorld && getGoodWorld && (npc[i].type == 127 || npc[i].type == 134 || npc[i].type == 125 || npc[i].type == 126))
10909 {
10910 num2 = 17;
10911 }
10912 if (num2 == 0 && npc[i].boss)
10913 {
10914 num2 = 1;
10915 }
10916 if (num2 == 0)
10917 {
10918 continue;
10919 }
10920 Microsoft.Xna.Framework.Rectangle value = new Microsoft.Xna.Framework.Rectangle((int)(npc[i].position.X + (float)(npc[i].width / 2)) - num, (int)(npc[i].position.Y + (float)(npc[i].height / 2)) - num, num * 2, num * 2);
10921 if (rectangle.Intersects(value))
10922 {
10923 switch (num2)
10924 {
10925 case 1:
10926 flag = true;
10927 break;
10928 case 2:
10929 flag3 = true;
10930 break;
10931 case 3:
10932 flag4 = true;
10933 break;
10934 case 4:
10935 flag5 = true;
10936 break;
10937 case 5:
10938 flag6 = true;
10939 break;
10940 case 6:
10941 flag7 = true;
10942 break;
10943 case 7:
10944 flag8 = true;
10945 break;
10946 case 8:
10947 flag9 = true;
10948 break;
10949 case 9:
10950 flag10 = true;
10951 break;
10952 case 10:
10953 flag11 = true;
10954 break;
10955 case 11:
10956 flag12 = true;
10957 break;
10958 case 12:
10959 flag13 = true;
10960 break;
10961 case 13:
10962 flag14 = true;
10963 break;
10964 case 14:
10965 flag15 = true;
10966 break;
10967 case 15:
10968 flag16 = true;
10969 break;
10970 case 16:
10971 flag2 = true;
10972 break;
10973 case 17:
10974 flag17 = true;
10975 break;
10976 }
10977 break;
10978 }
10979 }
10980 }
10981 _ = (screenPosition.X + (float)(screenWidth / 2)) / 16f;
10982 if (musicVolume == 0f)
10983 {
10984 newMusic = 0;
10985 return;
10986 }
10987 float num3 = (float)maxTilesX / 4200f;
10988 num3 *= num3;
10989 float num4 = (float)((double)((screenPosition.Y + (float)(screenHeight / 2)) / 16f - (65f + 10f * num3)) / (worldSurface / 5.0));
10991 {
10992 newMusic = 89;
10993 }
10994 else if (player[myPlayer].happyFunTorchTime)
10995 {
10996 newMusic = 87;
10997 }
10998 else if (flag8)
10999 {
11000 newMusic = 84;
11001 }
11002 else if (flag17)
11003 {
11004 newMusic = 81;
11005 }
11006 else if (flag10)
11007 {
11008 newMusic = 82;
11009 }
11010 else if (flag11)
11011 {
11012 newMusic = 83;
11013 }
11014 else if (flag7)
11015 {
11016 newMusic = 85;
11017 }
11018 else if (flag15)
11019 {
11020 newMusic = 80;
11021 }
11022 else if (flag16)
11023 {
11024 newMusic = 80;
11025 }
11026 else if (flag3)
11027 {
11028 newMusic = 80;
11029 }
11030 else if (flag)
11031 {
11032 newMusic = 81;
11033 }
11034 else if (flag4)
11035 {
11036 newMusic = 87;
11037 }
11038 else if (flag5)
11039 {
11040 newMusic = 81;
11041 }
11042 else if (flag6)
11043 {
11044 newMusic = 81;
11045 }
11046 else if (flag14)
11047 {
11048 newMusic = 80;
11049 }
11050 else if (flag2)
11051 {
11052 newMusic = 80;
11053 }
11054 else if (flag9)
11055 {
11056 newMusic = 82;
11057 }
11058 else if (flag12)
11059 {
11060 newMusic = 82;
11061 }
11062 else if (flag13)
11063 {
11064 newMusic = 82;
11065 }
11066 else if (eclipse && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2))
11067 {
11068 newMusic = 79;
11069 }
11070 else if (eclipse && remixWorld)
11071 {
11072 newMusic = 79;
11073 }
11074 else if (remixWorld && bloodMoon && !player[myPlayer].ZoneCrimson && !player[myPlayer].ZoneCorrupt && (double)player[myPlayer].position.Y > rockLayer * 16.0 && player[myPlayer].position.Y <= (float)(UnderworldLayer * 16))
11075 {
11076 newMusic = 79;
11077 }
11078 else if (remixWorld && bloodMoon && player[myPlayer].position.Y > (float)(UnderworldLayer * 16) && (double)(player[myPlayer].Center.X / 16f) > (double)maxTilesX * 0.37 + 50.0 && (double)(player[myPlayer].Center.X / 16f) < (double)maxTilesX * 0.63)
11079 {
11080 newMusic = 79;
11081 }
11082 else if (player[myPlayer].ZoneShimmer)
11083 {
11084 newMusic = 72;
11085 }
11086 else if (player[myPlayer].ZoneSandstorm)
11087 {
11088 newMusic = 66;
11089 }
11090 else if (player[myPlayer].position.Y > (float)(UnderworldLayer * 16))
11091 {
11092 newMusic = 71;
11093 }
11094 else if (num4 < 1f)
11095 {
11096 newMusic = 70;
11097 }
11098 else if (tile[(int)(player[myPlayer].Center.X / 16f), (int)(player[myPlayer].Center.Y / 16f)].wall == 87)
11099 {
11100 newMusic = 69;
11101 }
11102 else if (player[myPlayer].ZoneDungeon)
11103 {
11104 newMusic = 69;
11105 }
11106 else if ((bgStyle == 9 && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2)) || undergroundBackground == 2)
11107 {
11108 newMusic = 68;
11109 }
11110 else if (player[myPlayer].ZoneCorrupt)
11111 {
11113 {
11114 if ((double)player[myPlayer].position.Y > worldSurface * 16.0 + (double)(screenHeight / 2))
11115 {
11116 newMusic = 76;
11117 }
11118 else
11119 {
11120 newMusic = 75;
11121 }
11122 }
11123 else if ((double)player[myPlayer].position.Y > worldSurface * 16.0 + (double)(screenHeight / 2))
11124 {
11125 newMusic = 74;
11126 }
11127 else
11128 {
11129 newMusic = 73;
11130 }
11131 }
11132 else if (player[myPlayer].ZoneCrimson)
11133 {
11134 if ((double)player[myPlayer].position.Y > worldSurface * 16.0 + (double)(screenHeight / 2))
11135 {
11136 newMusic = 76;
11137 }
11138 else
11139 {
11140 newMusic = 75;
11141 }
11142 }
11143 else if (player[myPlayer].ZoneMeteor)
11144 {
11145 newMusic = 79;
11146 }
11147 else if (player[myPlayer].ZoneGraveyard)
11148 {
11149 newMusic = 79;
11150 }
11151 else if (player[myPlayer].ZoneJungle)
11152 {
11153 if (remixWorld && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2))
11154 {
11155 newMusic = 70;
11156 }
11157 else
11158 {
11159 newMusic = 86;
11160 }
11161 }
11162 else if (player[myPlayer].ZoneSnow)
11163 {
11164 if (remixWorld)
11165 {
11166 if ((double)player[myPlayer].position.Y < rockLayer * 16.0 + (double)(screenHeight / 2))
11167 {
11168 if ((double)player[myPlayer].position.Y <= worldSurface * 16.0 + (double)(screenHeight / 2))
11169 {
11170 newMusic = 70;
11171 }
11172 else
11173 {
11174 newMusic = 77;
11175 }
11176 }
11177 else
11178 {
11179 newMusic = 72;
11180 }
11181 }
11182 else if ((double)player[myPlayer].position.Y > worldSurface * 16.0 + (double)(screenHeight / 2))
11183 {
11184 newMusic = 77;
11185 }
11186 else
11187 {
11188 newMusic = 72;
11189 }
11190 }
11191 else if ((double)player[myPlayer].position.Y >= worldSurface * 16.0 + (double)(screenHeight / 2) && !WorldGen.oceanDepths((int)(screenPosition.X + (float)(screenWidth / 2)) / 16, (int)(screenPosition.Y + (float)(screenHeight / 2)) / 16))
11192 {
11193 if (remixWorld && (double)player[myPlayer].position.Y >= rockLayer * 16.0 + (double)(screenHeight / 2))
11194 {
11195 if (player[myPlayer].ZoneUndergroundDesert)
11196 {
11197 newMusic = 66;
11198 }
11199 else if (cloudAlpha > 0f)
11200 {
11201 newMusic = 62;
11202 }
11203 else if (player[myPlayer].ZoneHallow)
11204 {
11205 newMusic = 88;
11206 }
11207 else if (player[myPlayer].ZoneDesert)
11208 {
11209 newMusic = 66;
11210 }
11211 else
11212 {
11213 newMusic = 62;
11214 }
11215 }
11216 else if (player[myPlayer].ZoneHallow)
11217 {
11218 newMusic = 78;
11219 }
11220 else if (player[myPlayer].ZoneUndergroundDesert)
11221 {
11222 newMusic = 66;
11223 }
11224 else
11225 {
11226 newMusic = 65;
11227 }
11228 }
11229 else if (dayTime && player[myPlayer].ZoneHallow)
11230 {
11231 if (cloudAlpha > 0f && !gameMenu)
11232 {
11233 newMusic = 62;
11234 }
11235 else
11236 {
11237 newMusic = 88;
11238 }
11239 }
11240 else if (_shouldUseStormMusic)
11241 {
11242 if (bloodMoon)
11243 {
11244 newMusic = 79;
11245 }
11246 else
11247 {
11248 newMusic = 62;
11249 }
11250 }
11251 else if (WorldGen.oceanDepths((int)(screenPosition.X + (float)(screenWidth / 2)) / 16, (int)(screenPosition.Y + (float)(screenHeight / 2)) / 16))
11252 {
11253 if (bloodMoon)
11254 {
11255 newMusic = 79;
11256 }
11257 else
11258 {
11259 newMusic = 67;
11260 }
11261 }
11262 else if (player[myPlayer].ZoneDesert)
11263 {
11264 newMusic = 66;
11265 }
11266 else if (remixWorld)
11267 {
11268 newMusic = 70;
11269 }
11270 else if (dayTime)
11271 {
11272 if (cloudAlpha > 0f && !gameMenu)
11273 {
11274 newMusic = 62;
11275 }
11276 else
11277 {
11278 newMusic = 63;
11279 }
11280 }
11281 else if (!dayTime)
11282 {
11283 if (bloodMoon)
11284 {
11285 newMusic = 79;
11286 }
11287 else if (cloudAlpha > 0f && !gameMenu)
11288 {
11289 newMusic = 64;
11290 }
11291 else
11292 {
11293 newMusic = 64;
11294 }
11295 }
11296 if (((double)(screenPosition.Y / 16f) < worldSurface + 10.0 || remixWorld) && pumpkinMoon)
11297 {
11298 newMusic = 82;
11299 }
11300 if (((double)(screenPosition.Y / 16f) < worldSurface + 10.0 || remixWorld) && snowMoon)
11301 {
11302 newMusic = 82;
11303 }
11304 }
11305
11307 {
11308 bool flag = false;
11309 bool flag2 = false;
11310 bool flag3 = false;
11311 bool flag4 = false;
11312 bool flag5 = false;
11313 bool flag6 = false;
11314 bool flag7 = false;
11315 bool flag8 = false;
11316 bool flag9 = false;
11317 bool flag10 = false;
11318 bool flag11 = false;
11319 bool flag12 = false;
11320 bool flag13 = false;
11321 bool flag14 = false;
11322 bool flag15 = false;
11323 bool flag16 = false;
11324 bool flag17 = false;
11325 bool flag18 = LocalPlayer.townNPCs > 2f;
11326 bool flag19 = slimeRain;
11327 if (SceneMetrics.ShadowCandleCount > 0 || LocalPlayer.inventory[LocalPlayer.selectedItem].type == 5322)
11328 {
11329 flag18 = false;
11330 }
11331 float num = 0f;
11332 for (int i = 0; i < maxMusic; i++)
11333 {
11334 if (musicFade[i] > num)
11335 {
11336 num = musicFade[i];
11337 if (num == 1f)
11338 {
11340 }
11341 }
11342 }
11343 if (lastMusicPlayed == 50)
11344 {
11345 musicNoCrossFade[51] = true;
11346 }
11347 if (!showSplash)
11348 {
11350 int num2 = 5000;
11351 for (int j = 0; j < 200; j++)
11352 {
11353 if (!npc[j].active)
11354 {
11355 continue;
11356 }
11357 num2 = 5000;
11358 int num3 = 0;
11359 switch (npc[j].type)
11360 {
11361 case 13:
11362 case 14:
11363 case 15:
11364 case 127:
11365 case 128:
11366 case 129:
11367 case 130:
11368 case 131:
11369 num3 = 1;
11370 break;
11371 case 26:
11372 case 27:
11373 case 28:
11374 case 29:
11375 case 111:
11376 case 471:
11377 num3 = 11;
11378 break;
11379 case 113:
11380 case 114:
11381 case 125:
11382 case 126:
11383 num3 = 2;
11384 break;
11385 case 134:
11386 case 135:
11387 case 136:
11388 case 143:
11389 case 144:
11390 case 145:
11391 case 266:
11392 num3 = 3;
11393 break;
11394 case 212:
11395 case 213:
11396 case 214:
11397 case 215:
11398 case 216:
11399 case 491:
11400 num3 = 8;
11401 break;
11402 case 245:
11403 num3 = 4;
11404 break;
11405 case 222:
11406 num3 = 5;
11407 break;
11408 case 262:
11409 case 263:
11410 case 264:
11411 num3 = 6;
11412 break;
11413 case 381:
11414 case 382:
11415 case 383:
11416 case 385:
11417 case 386:
11418 case 388:
11419 case 389:
11420 case 390:
11421 case 391:
11422 case 395:
11423 case 520:
11424 num3 = 9;
11425 break;
11426 case 398:
11427 num3 = 7;
11428 break;
11429 case 422:
11430 case 493:
11431 case 507:
11432 case 517:
11433 num3 = 10;
11434 break;
11435 case 439:
11436 num3 = 4;
11437 break;
11438 case 438:
11439 if (npc[j].ai[1] == 1f)
11440 {
11441 num2 = 1600;
11442 num3 = 4;
11443 }
11444 break;
11445 case 657:
11446 num3 = 13;
11447 break;
11448 case 636:
11449 num3 = 14;
11450 break;
11451 case 370:
11452 num3 = 15;
11453 break;
11454 case 668:
11455 num3 = 16;
11456 break;
11457 }
11459 {
11460 num3 = 12;
11461 }
11462 if (num3 == 0 && npc[j].boss)
11463 {
11464 num3 = 1;
11465 }
11466 if (remixWorld && getGoodWorld && (npc[j].type == 127 || npc[j].type == 134 || npc[j].type == 125 || npc[j].type == 126))
11467 {
11468 num3 = 17;
11469 }
11470 if (num3 == 0)
11471 {
11472 continue;
11473 }
11474 Microsoft.Xna.Framework.Rectangle value = new Microsoft.Xna.Framework.Rectangle((int)(npc[j].position.X + (float)(npc[j].width / 2)) - num2, (int)(npc[j].position.Y + (float)(npc[j].height / 2)) - num2, num2 * 2, num2 * 2);
11475 if (rectangle.Intersects(value))
11476 {
11477 switch (num3)
11478 {
11479 case 1:
11480 flag = true;
11481 break;
11482 case 2:
11483 flag3 = true;
11484 break;
11485 case 3:
11486 flag4 = true;
11487 break;
11488 case 4:
11489 flag5 = true;
11490 break;
11491 case 5:
11492 flag6 = true;
11493 break;
11494 case 6:
11495 flag7 = true;
11496 break;
11497 case 7:
11498 flag8 = true;
11499 break;
11500 case 8:
11501 flag9 = true;
11502 break;
11503 case 9:
11504 flag10 = true;
11505 break;
11506 case 10:
11507 flag11 = true;
11508 break;
11509 case 11:
11510 flag12 = true;
11511 break;
11512 case 12:
11513 flag13 = true;
11514 break;
11515 case 13:
11516 flag14 = true;
11517 break;
11518 case 14:
11519 flag15 = true;
11520 break;
11521 case 15:
11522 flag16 = true;
11523 break;
11524 case 16:
11525 flag2 = true;
11526 break;
11527 case 17:
11528 flag17 = true;
11529 break;
11530 }
11531 break;
11532 }
11533 }
11534 }
11535 _ = (screenPosition.X + (float)(screenWidth / 2)) / 16f;
11536 if (musicVolume == 0f)
11537 {
11538 newMusic = 0;
11539 return;
11540 }
11541 if (gameMenu)
11542 {
11543 if (netMode != 2)
11544 {
11546 {
11548 {
11549 newMusic = 70;
11550 }
11551 else
11552 {
11553 newMusic = 60;
11554 }
11555 }
11556 else if (WorldGen.remixWorldGen)
11557 {
11558 newMusic = 8;
11559 }
11560 else if (menuMode == 3000)
11561 {
11562 newMusic = 89;
11563 }
11565 {
11566 newMusic = 11;
11567 }
11568 else if (playOldTile)
11569 {
11570 newMusic = 6;
11571 }
11572 else if (!_isAsyncLoadComplete)
11573 {
11574 newMusic = 50;
11575 }
11576 else if (!audioSystem.IsTrackPlaying(50))
11577 {
11578 newMusic = 51;
11579 if (musicNoCrossFade[51])
11580 {
11581 musicFade[51] = 1f;
11582 }
11583 }
11584 }
11585 else
11586 {
11587 newMusic = 0;
11588 }
11589 return;
11590 }
11591 float num4 = (float)maxTilesX / 4200f;
11592 num4 *= num4;
11593 float num5 = (float)((double)((screenPosition.Y + (float)(screenHeight / 2)) / 16f - (65f + 10f * num4)) / (worldSurface / 5.0));
11595 {
11596 newMusic = 89;
11597 }
11598 else if (player[myPlayer].happyFunTorchTime)
11599 {
11600 newMusic = 13;
11601 }
11602 else if (flag8)
11603 {
11604 newMusic = 38;
11605 }
11606 else if (flag17)
11607 {
11608 newMusic = 81;
11609 }
11610 else if (flag10)
11611 {
11612 newMusic = 37;
11613 }
11614 else if (flag11)
11615 {
11616 newMusic = 34;
11617 }
11618 else if (flag7)
11619 {
11620 newMusic = 24;
11621 }
11622 else if (flag15)
11623 {
11624 newMusic = 57;
11625 }
11626 else if (flag16)
11627 {
11628 newMusic = 58;
11629 }
11630 else if (flag3)
11631 {
11632 newMusic = 12;
11633 }
11634 else if (flag)
11635 {
11636 newMusic = 5;
11637 }
11638 else if (flag4)
11639 {
11640 newMusic = 13;
11641 }
11642 else if (flag5)
11643 {
11644 newMusic = 17;
11645 }
11646 else if (flag6)
11647 {
11648 newMusic = 25;
11649 }
11650 else if (flag14)
11651 {
11652 newMusic = 56;
11653 }
11654 else if (flag2)
11655 {
11656 newMusic = 90;
11657 }
11658 else if (flag9)
11659 {
11660 newMusic = 35;
11661 }
11662 else if (flag12)
11663 {
11664 newMusic = 39;
11665 }
11666 else if (flag13)
11667 {
11668 newMusic = 41;
11669 }
11670 else if (eclipse && !remixWorld && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2))
11671 {
11672 newMusic = 27;
11673 }
11674 else if (eclipse && remixWorld && (double)player[myPlayer].position.Y > rockLayer * 16.0)
11675 {
11676 newMusic = 27;
11677 }
11678 else if (flag19 && !player[myPlayer].ZoneGraveyard && (!bloodMoon || dayTime) && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2))
11679 {
11680 newMusic = 48;
11681 }
11682 else if (remixWorld && bloodMoon && !player[myPlayer].ZoneCrimson && !player[myPlayer].ZoneCorrupt && (double)player[myPlayer].position.Y > rockLayer * 16.0 && player[myPlayer].position.Y <= (float)(UnderworldLayer * 16))
11683 {
11684 newMusic = 2;
11685 }
11686 else if (remixWorld && bloodMoon && player[myPlayer].position.Y > (float)(UnderworldLayer * 16) && (double)(player[myPlayer].Center.X / 16f) > (double)maxTilesX * 0.37 + 50.0 && (double)(player[myPlayer].Center.X / 16f) < (double)maxTilesX * 0.63)
11687 {
11688 newMusic = 2;
11689 }
11690 else if (player[myPlayer].ZoneShimmer)
11691 {
11692 newMusic = 91;
11693 }
11694 else if (flag18 && dayTime && ((cloudAlpha == 0f && !_shouldUseWindyDayMusic) || (double)player[myPlayer].position.Y >= worldSurface * 16.0 + (double)(screenHeight / 2)) && !player[myPlayer].ZoneGraveyard)
11695 {
11696 newMusic = 46;
11697 }
11698 else if (flag18 && !dayTime && ((!bloodMoon && cloudAlpha == 0f) || (double)player[myPlayer].position.Y >= worldSurface * 16.0 + (double)(screenHeight / 2)) && !player[myPlayer].ZoneGraveyard)
11699 {
11700 newMusic = 47;
11701 }
11702 else if (player[myPlayer].ZoneSandstorm)
11703 {
11704 newMusic = 40;
11705 }
11706 else if (player[myPlayer].position.Y > (float)(UnderworldLayer * 16))
11707 {
11708 newMusic = 36;
11709 }
11710 else if (num5 < 1f)
11711 {
11712 newMusic = (dayTime ? 42 : 15);
11713 }
11714 else if (tile[(int)(player[myPlayer].Center.X / 16f), (int)(player[myPlayer].Center.Y / 16f)].wall == 87)
11715 {
11716 newMusic = 26;
11717 }
11718 else if (player[myPlayer].ZoneDungeon)
11719 {
11720 newMusic = 23;
11721 }
11722 else if ((bgStyle == 9 && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2)) || undergroundBackground == 2)
11723 {
11724 newMusic = 29;
11725 }
11726 else if (player[myPlayer].ZoneCorrupt)
11727 {
11729 {
11730 if ((double)player[myPlayer].position.Y > worldSurface * 16.0 + (double)(screenHeight / 2))
11731 {
11732 newMusic = 33;
11733 }
11734 else
11735 {
11736 newMusic = 16;
11737 }
11738 }
11739 else if ((double)player[myPlayer].position.Y > worldSurface * 16.0 + (double)(screenHeight / 2))
11740 {
11741 newMusic = 10;
11742 }
11743 else
11744 {
11745 newMusic = 8;
11746 }
11747 }
11748 else if (player[myPlayer].ZoneCrimson)
11749 {
11750 if ((double)player[myPlayer].position.Y > worldSurface * 16.0 + (double)(screenHeight / 2))
11751 {
11752 newMusic = 33;
11753 }
11754 else
11755 {
11756 newMusic = 16;
11757 }
11758 }
11759 else if (player[myPlayer].ZoneMeteor)
11760 {
11761 newMusic = 2;
11762 }
11763 else if (player[myPlayer].ZoneGraveyard)
11764 {
11765 newMusic = 53;
11766 }
11767 else if (player[myPlayer].ZoneJungle)
11768 {
11769 if (remixWorld)
11770 {
11771 if ((double)player[myPlayer].position.Y > rockLayer * 16.0 + (double)(screenHeight / 2))
11772 {
11773 newMusic = 7;
11774 }
11775 else if (newMusic == 7 && (double)player[myPlayer].position.Y > (rockLayer - 50.0) * 16.0 + (double)(screenHeight / 2))
11776 {
11777 newMusic = 7;
11778 }
11779 else if ((double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2))
11780 {
11781 newMusic = (dayTime ? 42 : 15);
11782 }
11783 else
11784 {
11785 newMusic = 54;
11786 }
11787 }
11788 else if ((double)player[myPlayer].position.Y > rockLayer * 16.0 + (double)(screenHeight / 2))
11789 {
11790 newMusic = 54;
11791 }
11792 else if (newMusic == 54 && (double)player[myPlayer].position.Y > (rockLayer - 50.0) * 16.0 + (double)(screenHeight / 2))
11793 {
11794 newMusic = 54;
11795 }
11796 else if (_shouldUseStormMusic && (double)player[myPlayer].position.Y < worldSurface * 16.0 + (double)(screenHeight / 2))
11797 {
11798 newMusic = 52;
11799 }
11800 else if (dayTime)
11801 {
11802 newMusic = 7;
11803 }
11804 else
11805 {
11806 newMusic = 55;
11807 }
11808 }
11809 else if (player[myPlayer].ZoneSnow)
11810 {
11811 if ((double)player[myPlayer].position.Y > worldSurface * 16.0 + (double)(screenHeight / 2))
11812 {
11813 if (remixWorld && (double)player[myPlayer].position.Y > rockLayer * 16.0 + (double)(screenHeight / 2))
11814 {
11815 newMusic = 14;
11816 }
11817 else
11818 {
11819 newMusic = 20;
11820 }
11821 }
11822 else if (remixWorld)
11823 {
11824 newMusic = (dayTime ? 42 : 15);
11825 }
11826 else
11827 {
11828 newMusic = 14;
11829 }
11830 }
11831 else if ((double)player[myPlayer].position.Y >= worldSurface * 16.0 + (double)(screenHeight / 2) && (remixWorld || !WorldGen.oceanDepths((int)(screenPosition.X + (float)(screenWidth / 2)) / 16, (int)(screenPosition.Y + (float)(screenHeight / 2)) / 16)))
11832 {
11833 if (player[myPlayer].ZoneHallow)
11834 {
11835 if (remixWorld && (double)player[myPlayer].position.Y >= rockLayer * 16.0 + (double)(screenHeight / 2))
11836 {
11837 newMusic = 9;
11838 }
11839 else
11840 {
11841 newMusic = 11;
11842 }
11843 }
11844 else if (player[myPlayer].ZoneUndergroundDesert)
11845 {
11846 if ((double)player[myPlayer].position.Y >= worldSurface * 16.0 + (double)(screenHeight / 2))
11847 {
11848 newMusic = 61;
11849 }
11850 else
11851 {
11852 newMusic = 21;
11853 }
11854 }
11855 else
11856 {
11857 if (ugMusic == 0)
11858 {
11859 ugMusic = 4;
11860 }
11861 if (!audioSystem.IsTrackPlaying(4) && !audioSystem.IsTrackPlaying(31))
11862 {
11863 if (musicFade[4] == 1f)
11864 {
11865 musicFade[31] = 1f;
11866 }
11867 if (musicFade[31] == 1f)
11868 {
11869 musicFade[4] = 1f;
11870 }
11871 switch (rand.Next(2))
11872 {
11873 case 0:
11874 ugMusic = 4;
11875 musicFade[31] = 0f;
11876 break;
11877 case 1:
11878 ugMusic = 31;
11879 musicFade[4] = 0f;
11880 break;
11881 }
11882 }
11883 newMusic = ugMusic;
11884 if (remixWorld && (double)(player[myPlayer].position.Y / 16f) > rockLayer && player[myPlayer].position.Y / 16f < (float)(maxTilesY - 350))
11885 {
11886 if (cloudAlpha > 0f)
11887 {
11888 newMusic = 19;
11889 }
11890 else if (player[myPlayer].ZoneDesert)
11891 {
11892 newMusic = 21;
11893 }
11894 else if (_shouldUseWindyDayMusic)
11895 {
11896 newMusic = 44;
11897 }
11898 }
11899 }
11900 }
11901 else if (dayTime && player[myPlayer].ZoneHallow)
11902 {
11904 {
11905 newMusic = 52;
11906 }
11907 else if (cloudAlpha > 0f && !gameMenu)
11908 {
11909 newMusic = 19;
11910 }
11912 {
11913 newMusic = 44;
11914 }
11915 else
11916 {
11917 newMusic = 9;
11918 }
11919 }
11920 else if (_shouldUseStormMusic)
11921 {
11922 if (bloodMoon)
11923 {
11924 newMusic = 2;
11925 }
11926 else
11927 {
11928 newMusic = 52;
11929 }
11930 }
11931 else if (WorldGen.oceanDepths((int)(screenPosition.X + (float)(screenWidth / 2)) / 16, (int)(screenPosition.Y + (float)(screenHeight / 2)) / 16))
11932 {
11933 if (bloodMoon)
11934 {
11935 newMusic = 2;
11936 }
11937 else if (flag18)
11938 {
11939 if (dayTime)
11940 {
11941 newMusic = 46;
11942 }
11943 else
11944 {
11945 newMusic = 47;
11946 }
11947 }
11948 else
11949 {
11950 newMusic = (dayTime ? 22 : 43);
11951 }
11952 }
11953 else if (player[myPlayer].ZoneDesert)
11954 {
11955 if ((double)player[myPlayer].position.Y >= worldSurface * 16.0)
11956 {
11957 int num6 = (int)(player[myPlayer].Center.X / 16f);
11958 int num7 = (int)(player[myPlayer].Center.Y / 16f);
11960 {
11961 newMusic = 61;
11962 }
11963 else
11964 {
11965 newMusic = 21;
11966 }
11967 }
11968 else
11969 {
11970 newMusic = 21;
11971 }
11972 }
11973 else if (remixWorld)
11974 {
11975 newMusic = (dayTime ? 42 : 15);
11976 }
11977 else if (dayTime)
11978 {
11979 if (cloudAlpha > 0f && !gameMenu)
11980 {
11981 if (time < 10800.0)
11982 {
11983 newMusic = 59;
11984 }
11985 else
11986 {
11987 newMusic = 19;
11988 }
11989 }
11990 else
11991 {
11992 if (dayMusic == 0)
11993 {
11994 dayMusic = 1;
11995 }
11996 if (!audioSystem.IsTrackPlaying(1) && !audioSystem.IsTrackPlaying(18))
11997 {
11998 if (rand.Next(2) == 0)
11999 {
12000 dayMusic = 1;
12001 }
12002 else
12003 {
12004 dayMusic = 18;
12005 }
12006 }
12009 {
12010 newMusic = 44;
12011 }
12012 }
12013 }
12014 else if (!dayTime)
12015 {
12016 if (bloodMoon)
12017 {
12018 newMusic = 2;
12019 }
12020 else if (cloudAlpha > 0f && !gameMenu)
12021 {
12022 newMusic = 19;
12023 }
12024 else
12025 {
12026 newMusic = 3;
12027 }
12028 }
12029 if (((double)(screenPosition.Y / 16f) < worldSurface + 10.0 || remixWorld) && pumpkinMoon)
12030 {
12031 newMusic = 30;
12032 }
12033 if (((double)(screenPosition.Y / 16f) < worldSurface + 10.0 || remixWorld) && snowMoon)
12034 {
12035 newMusic = 32;
12036 }
12037 }
12038
12039 private void UpdateWindyDayState()
12040 {
12041 if (cloudAlpha == 0f)
12042 {
12043 _shouldUseStormMusic = false;
12044 if (time < 10800.0 || time > 43200.0 || !dayTime)
12045 {
12047 return;
12048 }
12050 {
12052 }
12054 {
12056 }
12057 }
12058 else
12059 {
12061 {
12062 _shouldUseStormMusic = false;
12063 }
12065 {
12066 _shouldUseStormMusic = true;
12067 }
12068 if (remixWorld)
12069 {
12070 _shouldUseStormMusic = false;
12071 }
12072 else
12073 {
12075 }
12076 }
12077 }
12078
12079 public static void snowing()
12080 {
12081 if (remixWorld)
12082 {
12083 return;
12084 }
12087 if (gamePaused || SceneMetrics.SnowTileCount <= 0 || (!((double)player[myPlayer].position.Y < worldSurface * 16.0) && (!remixWorld || !((double)player[myPlayer].position.Y > worldSurface * 16.0))))
12088 {
12089 return;
12090 }
12091 float num = (float)SceneMetrics.SnowTileCount / (float)SceneMetrics.SnowTileMax;
12092 num *= num;
12093 num *= num;
12094 float num2 = Camera.ScaledSize.X / (float)maxScreenW;
12095 int num3 = (int)(500f * num2);
12096 num3 = (int)((float)num3 * (1f + 2f * cloudAlpha));
12097 float num4 = 1f + 50f * cloudAlpha;
12098 bool flag = NPC.IsADeerclopsNearScreen();
12099 if (flag)
12100 {
12101 num /= 20f;
12102 num3 /= 3;
12103 }
12104 for (int i = 0; (float)i < num4; i++)
12105 {
12106 try
12107 {
12108 if (!((float)snowDust < (float)num3 * (gfxQuality / 2f + 0.5f) + (float)num3 * 0.1f))
12109 {
12110 break;
12111 }
12112 if (!(rand.NextFloat() < num))
12113 {
12114 continue;
12115 }
12116 int num5 = rand.Next((int)scaledSize.X + 1500) - 750;
12117 int num6 = (int)scaledPosition.Y - rand.Next(50);
12118 if (player[myPlayer].velocity.Y > 0f)
12119 {
12120 num6 -= (int)player[myPlayer].velocity.Y;
12121 }
12122 if (rand.Next(5) == 0)
12123 {
12124 num5 = rand.Next(500) - 500;
12125 }
12126 else if (rand.Next(5) == 0)
12127 {
12128 num5 = rand.Next(500) + (int)scaledSize.X;
12129 }
12130 if (num5 < 0 || (float)num5 > scaledSize.X)
12131 {
12132 num6 += rand.Next((int)((double)scaledSize.Y * 0.8)) + (int)((double)scaledSize.Y * 0.1);
12133 }
12134 num5 += (int)scaledPosition.X;
12135 int num7 = num5 / 16;
12136 int num8 = num6 / 16;
12137 if (WorldGen.InWorld(num7, num8) && tile[num7, num8] != null && !tile[num7, num8].nactive() && tile[num7, num8].wall == 0)
12138 {
12139 int num9 = Dust.NewDust(new Vector2(num5, num6), 10, 10, 76);
12140 dust[num9].scale += cloudAlpha * 0.2f;
12141 dust[num9].velocity.Y = 3f + (float)rand.Next(30) * 0.1f;
12142 dust[num9].velocity.Y *= dust[num9].scale;
12143 if (!raining)
12144 {
12145 dust[num9].velocity.X = windSpeedCurrent + (float)rand.Next(-10, 10) * 0.1f;
12146 dust[num9].velocity.X += windSpeedCurrent * 15f;
12147 }
12148 else
12149 {
12150 dust[num9].velocity.X = (float)Math.Sqrt(Math.Abs(windSpeedCurrent)) * (float)Math.Sign(windSpeedCurrent) * (cloudAlpha + 0.5f) * 10f + rand.NextFloat() * 0.2f - 0.1f;
12151 dust[num9].velocity.Y *= 0.5f;
12152 }
12153 dust[num9].velocity.Y *= 1f + 0.3f * cloudAlpha;
12154 dust[num9].scale += cloudAlpha * 0.2f;
12155 if (flag)
12156 {
12157 dust[num9].scale -= 0.5f;
12158 }
12159 dust[num9].velocity *= 1f + cloudAlpha * 0.5f;
12160 }
12161 continue;
12162 }
12163 catch
12164 {
12165 }
12166 }
12167 }
12168
12169 public static void checkXMas()
12170 {
12172 int day = now.Day;
12173 int month = now.Month;
12174 if (day >= 15 && month == 12)
12175 {
12176 xMas = true;
12177 }
12178 else
12179 {
12180 xMas = false;
12181 }
12183 {
12184 xMas = true;
12185 }
12186 }
12187
12188 public static void checkHalloween()
12189 {
12191 int day = now.Day;
12192 int month = now.Month;
12193 if (day >= 10 && month == 10)
12194 {
12195 halloween = true;
12196 }
12197 else if (day <= 1 && month == 11)
12198 {
12199 halloween = true;
12200 }
12201 else
12202 {
12203 halloween = false;
12204 }
12206 {
12207 halloween = true;
12208 }
12209 }
12210
12211 public void updateCloudLayer()
12212 {
12213 if (netMode == 1 || (netMode == 0 && gameMenu))
12214 {
12215 return;
12216 }
12217 int num = 86400;
12218 int num2 = num / 24;
12219 float num3 = Math.Max(1f, 1f + 4f * cloudAlpha);
12220 if (cloudBGActive > 0f)
12221 {
12222 if (cloudBGActive > 1f)
12223 {
12224 cloudBGActive -= (float)dayRate / num3;
12225 }
12226 if (cloudBGActive < 1f)
12227 {
12228 cloudBGActive = 1f;
12229 }
12230 if (cloudBGActive == 1f && rand.Next((int)((float)(num2 * 2 / Math.Max(dayRate, 1)) * num3)) == 0)
12231 {
12232 cloudBGActive = -rand.Next(num2 * 4, num * 4);
12233 if (netMode == 2)
12234 {
12236 }
12237 }
12238 return;
12239 }
12240 if (cloudBGActive < 0f)
12241 {
12242 cloudBGActive += (float)dayRate * num3;
12243 if (raining)
12244 {
12245 cloudBGActive += (float)(2 * dayRate) * num3;
12246 }
12247 }
12248 if (cloudBGActive > 0f)
12249 {
12250 cloudBGActive = 0f;
12251 }
12252 if (cloudBGActive == 0f && rand.Next((int)((float)(num2 * 12 / ((dayRate == 0) ? 1 : dayRate)) / num3)) == 0)
12253 {
12254 cloudBGActive = rand.Next(num2 * 3, num * 2);
12255 if (netMode == 2)
12256 {
12258 }
12259 }
12260 else if (IsItStorming)
12261 {
12262 cloudBGActive = rand.Next(num2, num2 * 4);
12263 if (netMode == 2)
12264 {
12266 }
12267 }
12268 }
12269
12271 {
12272 switch (Style)
12273 {
12274 case 0:
12275 {
12277 int num2 = effectRect.Width * effectRect.Height / 5;
12278 num2 = (int)((float)num2 * dustCountMult);
12279 for (int j = 0; j < num2; j++)
12280 {
12281 int num3 = Dust.NewDust(new Vector2(effectRect.X, effectRect.Y), effectRect.Width, effectRect.Height, 159);
12282 Main.dust[num3].scale = (float)rand.Next(20, 70) * 0.01f;
12283 if (j < 10)
12284 {
12285 Main.dust[num3].scale += 0.25f;
12286 }
12287 if (j < 5)
12288 {
12289 Main.dust[num3].scale += 0.25f;
12290 }
12291 }
12292 break;
12293 }
12294 case 1:
12295 {
12297 int num10 = effectRect.Width * effectRect.Height / 5;
12298 num10 = (int)((float)num10 * dustCountMult);
12299 for (int num11 = 0; num11 < num10; num11++)
12300 {
12301 int num12 = Dust.NewDust(new Vector2(effectRect.X, effectRect.Y), effectRect.Width, effectRect.Height, 164);
12302 Main.dust[num12].scale = (float)rand.Next(20, 70) * 0.01f;
12303 if (num11 < 10)
12304 {
12305 Main.dust[num12].scale += 0.25f;
12306 }
12307 if (num11 < 5)
12308 {
12309 Main.dust[num12].scale += 0.25f;
12310 }
12311 }
12312 break;
12313 }
12314 case 2:
12315 {
12316 int num15 = (int)(50f * dustCountMult);
12317 for (int num16 = 0; num16 < num15; num16++)
12318 {
12319 Main.dust[Dust.NewDust(new Vector2(effectRect.X, effectRect.Y), effectRect.Width, effectRect.Height, 58, 0f, 0f, 150, Microsoft.Xna.Framework.Color.GhostWhite, 1.2f)].velocity *= 0.5f;
12320 }
12321 break;
12322 }
12323 case 3:
12324 {
12326 int num5 = (int)(50f * dustCountMult);
12327 for (int l = 0; l < num5; l++)
12328 {
12329 int num6 = Dust.NewDust(new Vector2(effectRect.X, effectRect.Y), effectRect.Width, effectRect.Height, 180);
12330 Main.dust[num6].noGravity = true;
12331 for (int m = 0; m < 5; m++)
12332 {
12333 if (rand.Next(3) == 0)
12334 {
12335 Main.dust[num6].velocity *= 0.75f;
12336 }
12337 }
12338 if (rand.Next(3) == 0)
12339 {
12340 Main.dust[num6].velocity *= 2f;
12341 Main.dust[num6].scale *= 1.2f;
12342 }
12343 if (rand.Next(3) == 0)
12344 {
12345 Main.dust[num6].velocity *= 2f;
12346 Main.dust[num6].scale *= 1.2f;
12347 }
12348 if (rand.Next(2) == 0)
12349 {
12350 Main.dust[num6].fadeIn = (float)rand.Next(75, 100) * 0.01f;
12351 Main.dust[num6].scale = (float)rand.Next(25, 75) * 0.01f;
12352 }
12353 Main.dust[num6].scale *= 0.8f;
12354 }
12355 break;
12356 }
12357 case 4:
12358 {
12360 int num17 = effectRect.Width * effectRect.Height / 5;
12361 num17 = (int)((float)num17 * dustCountMult);
12362 for (int num18 = 0; num18 < num17; num18++)
12363 {
12364 Dust obj4 = Main.dust[Dust.NewDust(effectRect.TopLeft(), effectRect.Width, effectRect.Height, 263)];
12366 obj4.noLight = true;
12367 obj4.noGravity = true;
12368 obj4.scale = 1.2f;
12369 obj4.fadeIn = 0.4f;
12370 obj4.color.A = byte.MaxValue;
12371 }
12372 break;
12373 }
12374 case 5:
12375 {
12376 Vector2 position = effectRect.TopLeft();
12377 int num8 = (int)(100f * dustCountMult);
12378 for (int num9 = 0; num9 < num8; num9++)
12379 {
12380 Dust obj3 = Dust.NewDustDirect(position, effectRect.Width, effectRect.Height + 24, Dust.dustWater());
12381 obj3.velocity.Y *= 0f;
12382 obj3.velocity.Y -= 3.5f;
12383 obj3.velocity.X *= 1.5f;
12384 obj3.scale = 0.8f;
12385 obj3.alpha = 130;
12386 obj3.noGravity = true;
12387 obj3.fadeIn = 1.2f;
12388 }
12389 SoundEngine.PlaySound(19, effectRect.Center.ToVector2(), 0);
12390 break;
12391 }
12392 case 7:
12393 {
12394 Vector2 position2 = effectRect.TopLeft();
12395 int num19 = (int)(50f * dustCountMult);
12396 for (int num20 = 0; num20 < num19; num20++)
12397 {
12398 Dust obj5 = Dust.NewDustDirect(position2, effectRect.Width, effectRect.Height + 24, 35);
12399 obj5.velocity.Y *= 0f;
12400 obj5.velocity.Y -= 3.5f;
12401 obj5.velocity.X *= 1.5f;
12402 obj5.scale = 0.8f;
12403 obj5.alpha = 130;
12404 obj5.noGravity = true;
12405 obj5.fadeIn = 1.2f;
12406 }
12407 SoundEngine.PlaySound(SoundID.Item8, effectRect.Center.ToVector2());
12408 break;
12409 }
12410 case 9:
12411 {
12412 effectRect.Inflate(15, 15);
12413 int num13 = (int)(100f * dustCountMult);
12414 for (int num14 = 0; num14 < num13; num14++)
12415 {
12417 }
12419 break;
12420 }
12421 case 10:
12422 {
12423 effectRect.Inflate(15, 15);
12424 int num7 = (int)(60f * dustCountMult);
12425 Vector2 vector = otherPosition - effectRect.TopLeft();
12426 for (int n = 0; n < num7; n++)
12427 {
12428 float fadeIn = 0.4f + rand.NextFloat();
12429 float scale = 0.4f + rand.NextFloat();
12430 Microsoft.Xna.Framework.Color newColor = hslToRgb(0.66f + rand.NextFloat() * 0.24f, 1f, 0.5f);
12431 Dust dust = Dust.NewDustDirect(effectRect.TopLeft(), effectRect.Width, effectRect.Height, 267, 0f, 0f, 127, newColor);
12432 dust.scale = (float)rand.Next(20, 70) * 0.01f;
12433 if (n < 10)
12434 {
12435 dust.scale += 0.25f;
12436 }
12437 if (n < 5)
12438 {
12439 dust.scale += 0.25f;
12440 }
12441 if ((float)n < (float)num7 * 0.8f)
12442 {
12443 dust.velocity += vector * 0.1f * rand.NextFloat();
12444 }
12445 dust.noGravity = true;
12446 dust.noLight = true;
12447 dust.scale = scale;
12448 dust.fadeIn = fadeIn;
12449 if (dust.dustIndex != 6000)
12450 {
12452 obj2.scale *= 0.65f;
12453 obj2.fadeIn *= 0.65f;
12454 obj2.color = new Microsoft.Xna.Framework.Color(255, 255, 255, 255);
12455 }
12456 }
12458 break;
12459 }
12460 case 11:
12461 {
12462 for (int k = 0; k < 50; k++)
12463 {
12464 int num4 = rand.Next(4);
12466 switch (num4)
12467 {
12468 case 0:
12469 case 1:
12470 color = new Microsoft.Xna.Framework.Color(100, 255, 100);
12471 break;
12472 case 2:
12474 break;
12475 case 3:
12477 break;
12478 }
12479 Dust obj = Dust.NewDustPerfect(rand.NextVector2FromRectangle(effectRect), 267);
12480 obj.noGravity = true;
12481 obj.color = color;
12482 obj.velocity *= 2f;
12483 obj.scale = 0.8f + rand.NextFloat() * 0.6f;
12484 obj.fadeIn = 0.5f;
12485 }
12486 break;
12487 }
12488 case 13:
12489 {
12490 SoundEngine.PlaySound(SoundID.Item8, effectRect.Center.ToVector2());
12491 for (int i = 0; i < 21; i++)
12492 {
12493 int num = Dust.NewDust(rand.NextVector2FromRectangle(effectRect), 2, 2, 27, 0f, 0f, 100, default(Microsoft.Xna.Framework.Color), rand.Next(1, 3));
12494 Main.dust[num].velocity *= 1.75f;
12495 if (i % 3 == 0)
12496 {
12497 Main.dust[num].velocity *= 1.5f;
12498 }
12499 Main.dust[num].noLightEmittence = true;
12500 Main.dust[num].noGravity = true;
12501 }
12502 break;
12503 }
12504 }
12505 }
12506
12507 public static void Ambience()
12508 {
12510 if (ambientCounter < 15)
12511 {
12512 return;
12513 }
12514 ambientCounter = 0;
12515 Microsoft.Xna.Framework.Point point = LocalPlayer.Center.ToPoint();
12516 if (ambientWaterfallStrength > 0f)
12517 {
12520 }
12521 else
12522 {
12524 {
12525 SoundEngine.PlaySound(34, point.X, point.Y, 0);
12526 }
12528 }
12529 float num = Math.Abs(ambientLavaX - (screenPosition.X + (float)(screenWidth / 2))) + Math.Abs(ambientLavaY - (screenPosition.Y + (float)(screenHeight / 2)));
12530 float num2 = Math.Abs(ambientLavafallX - (screenPosition.X + (float)(screenWidth / 2))) + Math.Abs(ambientLavafallY - (screenPosition.Y + (float)(screenHeight / 2)));
12531 float num3 = ambientLavaX;
12532 float num4 = ambientLavaY;
12533 if (num2 < num)
12534 {
12537 }
12539 if (ambientLavafallStrength > 0f)
12540 {
12541 SoundEngine.PlaySound(35, (int)num3, (int)num4, (int)num5);
12543 return;
12544 }
12546 {
12547 SoundEngine.PlaySound(35, point.X, point.Y, 0);
12548 }
12550 }
12551
12552 public static void AnimateTiles_CritterCages()
12553 {
12554 if (!critterCage)
12555 {
12556 return;
12557 }
12558 for (int i = 0; i < cageFrames; i++)
12559 {
12560 if (bunnyCageFrame[i] == 0)
12561 {
12563 if (bunnyCageFrameCounter[i] <= rand.Next(30, 900))
12564 {
12565 continue;
12566 }
12567 if (rand.Next(3) != 0)
12568 {
12569 int num = rand.Next(7);
12570 if (num == 0)
12571 {
12572 bunnyCageFrame[i] = 4;
12573 }
12574 else if (num <= 2)
12575 {
12576 bunnyCageFrame[i] = 2;
12577 }
12578 else
12579 {
12580 bunnyCageFrame[i] = 1;
12581 }
12582 }
12584 }
12585 else if (bunnyCageFrame[i] == 1)
12586 {
12588 if (bunnyCageFrameCounter[i] >= 10)
12589 {
12591 bunnyCageFrame[i] = 0;
12592 }
12593 }
12594 else if (bunnyCageFrame[i] >= 2 && bunnyCageFrame[i] <= 3)
12595 {
12597 if (bunnyCageFrameCounter[i] >= 10)
12598 {
12600 bunnyCageFrame[i]++;
12601 }
12602 if (bunnyCageFrame[i] > 3)
12603 {
12604 bunnyCageFrame[i] = 0;
12605 }
12606 }
12607 else if (bunnyCageFrame[i] >= 4 && bunnyCageFrame[i] <= 10)
12608 {
12610 if (bunnyCageFrameCounter[i] >= 5)
12611 {
12613 bunnyCageFrame[i]++;
12614 }
12615 }
12616 else if (bunnyCageFrame[i] == 11)
12617 {
12619 if (bunnyCageFrameCounter[i] <= rand.Next(30, 900))
12620 {
12621 continue;
12622 }
12623 if (rand.Next(3) != 0)
12624 {
12625 if (rand.Next(7) == 0)
12626 {
12627 bunnyCageFrame[i] = 13;
12628 }
12629 else
12630 {
12631 bunnyCageFrame[i] = 12;
12632 }
12633 }
12635 }
12636 else if (bunnyCageFrame[i] == 12)
12637 {
12639 if (bunnyCageFrameCounter[i] >= 10)
12640 {
12642 bunnyCageFrame[i] = 11;
12643 }
12644 }
12645 else if (bunnyCageFrame[i] >= 13)
12646 {
12648 if (bunnyCageFrameCounter[i] >= 5)
12649 {
12651 bunnyCageFrame[i]++;
12652 }
12653 if (bunnyCageFrame[i] > 21)
12654 {
12655 bunnyCageFrame[i] = 0;
12656 }
12657 }
12658 }
12659 for (int j = 0; j < cageFrames; j++)
12660 {
12661 if (squirrelCageFrame[j] == 0)
12662 {
12664 if (squirrelCageFrameCounter[j] <= rand.Next(30, 900))
12665 {
12666 continue;
12667 }
12668 if (rand.Next(3) != 0)
12669 {
12670 int num = rand.Next(7);
12671 if (num == 0)
12672 {
12673 squirrelCageFrame[j] = 4;
12674 }
12675 else if (num <= 2)
12676 {
12677 squirrelCageFrame[j] = 2;
12678 }
12679 else
12680 {
12681 squirrelCageFrame[j] = 1;
12682 }
12683 }
12685 }
12686 else if (squirrelCageFrame[j] == 1)
12687 {
12689 if (squirrelCageFrameCounter[j] >= 10)
12690 {
12692 squirrelCageFrame[j] = 0;
12693 }
12694 }
12695 else if (squirrelCageFrame[j] >= 2 && squirrelCageFrame[j] <= 3)
12696 {
12698 if (squirrelCageFrameCounter[j] >= 5)
12699 {
12702 }
12703 if (squirrelCageFrame[j] > 3)
12704 {
12705 if (rand.Next(5) == 0)
12706 {
12707 squirrelCageFrame[j] = 0;
12708 }
12709 else
12710 {
12711 squirrelCageFrame[j] = 2;
12712 }
12713 }
12714 }
12715 else if (squirrelCageFrame[j] >= 4 && squirrelCageFrame[j] <= 8)
12716 {
12718 if (squirrelCageFrameCounter[j] >= 5)
12719 {
12722 }
12723 }
12724 else if (squirrelCageFrame[j] == 9)
12725 {
12727 if (squirrelCageFrameCounter[j] <= rand.Next(30, 900))
12728 {
12729 continue;
12730 }
12731 if (rand.Next(3) != 0)
12732 {
12733 int num = rand.Next(7);
12734 if (num == 0)
12735 {
12736 squirrelCageFrame[j] = 13;
12737 }
12738 else if (num <= 2)
12739 {
12740 squirrelCageFrame[j] = 11;
12741 }
12742 else
12743 {
12744 squirrelCageFrame[j] = 10;
12745 }
12746 }
12748 }
12749 else if (squirrelCageFrame[j] == 10)
12750 {
12752 if (squirrelCageFrameCounter[j] >= 10)
12753 {
12755 squirrelCageFrame[j] = 9;
12756 }
12757 }
12758 else if (squirrelCageFrame[j] == 11 || squirrelCageFrame[j] == 12)
12759 {
12761 if (squirrelCageFrameCounter[j] < 5)
12762 {
12763 continue;
12764 }
12766 if (squirrelCageFrame[j] > 12)
12767 {
12768 if (rand.Next(5) != 0)
12769 {
12770 squirrelCageFrame[j] = 11;
12771 }
12772 else
12773 {
12774 squirrelCageFrame[j] = 9;
12775 }
12776 }
12778 }
12779 else if (squirrelCageFrame[j] >= 13)
12780 {
12782 if (squirrelCageFrameCounter[j] >= 5)
12783 {
12786 }
12787 if (squirrelCageFrame[j] > 17)
12788 {
12789 squirrelCageFrame[j] = 0;
12790 }
12791 }
12792 }
12793 for (int k = 0; k < cageFrames; k++)
12794 {
12795 if (squirrelCageFrameOrange[k] == 0)
12796 {
12798 if (squirrelCageFrameCounterOrange[k] <= rand.Next(30, 900))
12799 {
12800 continue;
12801 }
12802 if (rand.Next(3) != 0)
12803 {
12804 int num = rand.Next(7);
12805 if (num == 0)
12806 {
12808 }
12809 else if (num <= 2)
12810 {
12812 }
12813 else
12814 {
12816 }
12817 }
12819 }
12820 else if (squirrelCageFrameOrange[k] == 1)
12821 {
12824 {
12827 }
12828 }
12829 else if (squirrelCageFrameOrange[k] >= 2 && squirrelCageFrameOrange[k] <= 3)
12830 {
12833 {
12836 }
12837 if (squirrelCageFrameOrange[k] > 3)
12838 {
12839 if (rand.Next(5) == 0)
12840 {
12842 }
12843 else
12844 {
12846 }
12847 }
12848 }
12849 else if (squirrelCageFrameOrange[k] >= 4 && squirrelCageFrameOrange[k] <= 8)
12850 {
12853 {
12856 }
12857 }
12858 else if (squirrelCageFrameOrange[k] == 9)
12859 {
12861 if (squirrelCageFrameCounterOrange[k] <= rand.Next(30, 900))
12862 {
12863 continue;
12864 }
12865 if (rand.Next(3) != 0)
12866 {
12867 int num = rand.Next(7);
12868 if (num == 0)
12869 {
12871 }
12872 else if (num <= 2)
12873 {
12875 }
12876 else
12877 {
12879 }
12880 }
12882 }
12883 else if (squirrelCageFrameOrange[k] == 10)
12884 {
12887 {
12890 }
12891 }
12892 else if (squirrelCageFrameOrange[k] == 11 || squirrelCageFrameOrange[k] == 12)
12893 {
12896 {
12897 continue;
12898 }
12900 if (squirrelCageFrameOrange[k] > 12)
12901 {
12902 if (rand.Next(5) != 0)
12903 {
12905 }
12906 else
12907 {
12909 }
12910 }
12912 }
12913 else if (squirrelCageFrameOrange[k] >= 13)
12914 {
12917 {
12920 }
12921 if (squirrelCageFrameOrange[k] > 17)
12922 {
12924 }
12925 }
12926 }
12927 for (int l = 0; l < cageFrames; l++)
12928 {
12929 if (mallardCageFrame[l] == 0 || mallardCageFrame[l] == 4)
12930 {
12932 if (mallardCageFrameCounter[l] <= rand.Next(45, 2700))
12933 {
12934 continue;
12935 }
12936 if ((mallardCageFrame[l] == 0 && rand.Next(3) != 0) || (mallardCageFrame[l] == 4 && rand.Next(5) == 0))
12937 {
12938 if (rand.Next(6) == 0)
12939 {
12940 mallardCageFrame[l] = 5;
12941 }
12942 else if (rand.Next(3) == 0)
12943 {
12944 if (mallardCageFrame[l] == 4)
12945 {
12946 mallardCageFrame[l] = 0;
12947 }
12948 else
12949 {
12950 mallardCageFrame[l] = 4;
12951 }
12952 }
12953 else
12954 {
12955 mallardCageFrame[l] = 1;
12956 }
12957 }
12959 }
12960 else if (mallardCageFrame[l] >= 1 && mallardCageFrame[l] <= 3)
12961 {
12963 if (mallardCageFrameCounter[l] >= 5)
12964 {
12967 }
12968 if (mallardCageFrame[l] > 3)
12969 {
12970 if (rand.Next(5) == 0)
12971 {
12972 mallardCageFrame[l] = 0;
12973 }
12974 else
12975 {
12976 mallardCageFrame[l] = 1;
12977 }
12978 }
12979 }
12980 else if (mallardCageFrame[l] >= 5 && mallardCageFrame[l] <= 11)
12981 {
12983 if (mallardCageFrameCounter[l] >= 5)
12984 {
12987 }
12988 }
12989 else if (mallardCageFrame[l] == 12 || mallardCageFrame[l] == 16)
12990 {
12992 if (mallardCageFrameCounter[l] <= rand.Next(45, 2700))
12993 {
12994 continue;
12995 }
12996 if ((mallardCageFrame[l] == 12 && rand.Next(3) != 0) || (mallardCageFrame[l] == 16 && rand.Next(5) == 0))
12997 {
12998 if (rand.Next(6) == 0)
12999 {
13000 mallardCageFrame[l] = 17;
13001 }
13002 else if (rand.Next(3) == 0)
13003 {
13004 if (mallardCageFrame[l] == 16)
13005 {
13006 mallardCageFrame[l] = 12;
13007 }
13008 else
13009 {
13010 mallardCageFrame[l] = 16;
13011 }
13012 }
13013 else
13014 {
13015 mallardCageFrame[l] = 13;
13016 }
13017 }
13019 }
13020 else if (mallardCageFrame[l] >= 13 && mallardCageFrame[l] <= 15)
13021 {
13023 if (mallardCageFrameCounter[l] < 5)
13024 {
13025 continue;
13026 }
13028 if (mallardCageFrame[l] > 15)
13029 {
13030 if (rand.Next(5) != 0)
13031 {
13032 mallardCageFrame[l] = 12;
13033 }
13034 else
13035 {
13036 mallardCageFrame[l] = 13;
13037 }
13038 }
13040 }
13041 else if (mallardCageFrame[l] >= 17)
13042 {
13044 if (mallardCageFrameCounter[l] >= 5)
13045 {
13048 }
13049 if (mallardCageFrame[l] > 23)
13050 {
13051 mallardCageFrame[l] = 0;
13052 }
13053 }
13054 }
13055 for (int m = 0; m < cageFrames; m++)
13056 {
13057 if (duckCageFrame[m] == 0 || duckCageFrame[m] == 4)
13058 {
13060 if (duckCageFrameCounter[m] <= rand.Next(45, 2700))
13061 {
13062 continue;
13063 }
13064 if ((duckCageFrame[m] == 0 && rand.Next(3) != 0) || (duckCageFrame[m] == 4 && rand.Next(5) == 0))
13065 {
13066 if (rand.Next(6) == 0)
13067 {
13068 duckCageFrame[m] = 5;
13069 }
13070 else if (rand.Next(3) == 0)
13071 {
13072 if (duckCageFrame[m] == 4)
13073 {
13074 duckCageFrame[m] = 0;
13075 }
13076 else
13077 {
13078 duckCageFrame[m] = 4;
13079 }
13080 }
13081 else
13082 {
13083 duckCageFrame[m] = 1;
13084 }
13085 }
13087 }
13088 else if (duckCageFrame[m] >= 1 && duckCageFrame[m] <= 3)
13089 {
13091 if (duckCageFrameCounter[m] >= 5)
13092 {
13094 duckCageFrame[m]++;
13095 }
13096 if (duckCageFrame[m] > 3)
13097 {
13098 if (rand.Next(5) == 0)
13099 {
13100 duckCageFrame[m] = 0;
13101 }
13102 else
13103 {
13104 duckCageFrame[m] = 1;
13105 }
13106 }
13107 }
13108 else if (duckCageFrame[m] >= 5 && duckCageFrame[m] <= 11)
13109 {
13111 if (duckCageFrameCounter[m] >= 5)
13112 {
13114 duckCageFrame[m]++;
13115 }
13116 }
13117 else if (duckCageFrame[m] == 12 || duckCageFrame[m] == 16)
13118 {
13120 if (duckCageFrameCounter[m] <= rand.Next(45, 2700))
13121 {
13122 continue;
13123 }
13124 if ((duckCageFrame[m] == 12 && rand.Next(3) != 0) || (duckCageFrame[m] == 16 && rand.Next(5) == 0))
13125 {
13126 if (rand.Next(6) == 0)
13127 {
13128 duckCageFrame[m] = 17;
13129 }
13130 else if (rand.Next(3) == 0)
13131 {
13132 if (duckCageFrame[m] == 16)
13133 {
13134 duckCageFrame[m] = 12;
13135 }
13136 else
13137 {
13138 duckCageFrame[m] = 16;
13139 }
13140 }
13141 else
13142 {
13143 duckCageFrame[m] = 13;
13144 }
13145 }
13147 }
13148 else if (duckCageFrame[m] >= 13 && duckCageFrame[m] <= 15)
13149 {
13151 if (duckCageFrameCounter[m] < 5)
13152 {
13153 continue;
13154 }
13155 duckCageFrame[m]++;
13156 if (duckCageFrame[m] > 15)
13157 {
13158 if (rand.Next(5) != 0)
13159 {
13160 duckCageFrame[m] = 12;
13161 }
13162 else
13163 {
13164 duckCageFrame[m] = 13;
13165 }
13166 }
13168 }
13169 else if (duckCageFrame[m] >= 17)
13170 {
13172 if (duckCageFrameCounter[m] >= 5)
13173 {
13175 duckCageFrame[m]++;
13176 }
13177 if (duckCageFrame[m] > 23)
13178 {
13179 duckCageFrame[m] = 0;
13180 }
13181 }
13182 }
13183 for (int n = 0; n < cageFrames; n++)
13184 {
13186 bool flag = grebeCageFrame[n] == 0 || grebeCageFrame[n] == 7;
13187 bool num2 = grebeCageFrame[n] == 16 || grebeCageFrame[n] == 20;
13188 int num3 = 5;
13189 if (flag)
13190 {
13191 num3 = rand.Next(300, 400);
13192 }
13193 if (num2)
13194 {
13195 num3 = rand.Next(480, 600);
13196 }
13198 {
13199 continue;
13200 }
13202 if (grebeCageFrame[n] >= 25 && grebeCageFrame[n] <= 27)
13203 {
13204 grebeCageFrame[n]++;
13205 if (grebeCageFrame[n] > 27)
13206 {
13207 if (rand.Next(5) == 0)
13208 {
13209 grebeCageFrame[n] = 7;
13210 }
13211 else
13212 {
13213 grebeCageFrame[n] = 25;
13214 }
13215 }
13216 }
13217 else if (grebeCageFrame[n] >= 22 && grebeCageFrame[n] <= 24)
13218 {
13219 grebeCageFrame[n]++;
13220 if (grebeCageFrame[n] > 24)
13221 {
13222 if (rand.Next(5) == 0)
13223 {
13224 grebeCageFrame[n] = 0;
13225 }
13226 else
13227 {
13228 grebeCageFrame[n] = 22;
13229 }
13230 }
13231 }
13232 else if (grebeCageFrame[n] == 0 && rand.Next(3) == 0)
13233 {
13234 grebeCageFrame[n] = ((rand.Next(2) == 0) ? 22 : 14);
13235 }
13236 else if (grebeCageFrame[n] == 7 && rand.Next(3) == 0)
13237 {
13238 grebeCageFrame[n] = ((rand.Next(2) == 0) ? 25 : 18);
13239 }
13240 else if (grebeCageFrame[n] == 13 || grebeCageFrame[n] == 17)
13241 {
13242 grebeCageFrame[n] = 0;
13243 }
13244 else if (grebeCageFrame[n] == 21)
13245 {
13246 grebeCageFrame[n] = 7;
13247 }
13248 else
13249 {
13250 grebeCageFrame[n]++;
13251 }
13252 }
13253 for (int num4 = 0; num4 < cageFrames; num4++)
13254 {
13256 bool flag2 = seagullCageFrame[num4] == 0 || seagullCageFrame[num4] == 14;
13257 bool flag3 = seagullCageFrame[num4] >= 15 && seagullCageFrame[num4] <= 18;
13258 bool num5 = seagullCageFrame[num4] >= 9 && seagullCageFrame[num4] <= 13;
13259 int num6 = 6;
13260 if (flag2)
13261 {
13262 num6 = rand.Next(180, 250);
13263 }
13264 if (flag3)
13265 {
13266 num6 = 66;
13267 }
13268 if (num5)
13269 {
13270 num6 = 78;
13271 }
13273 {
13275 if (seagullCageFrame[num4] == 0 && rand.Next(3) == 0)
13276 {
13278 continue;
13279 }
13280 if (seagullCageFrame[num4] == 14)
13281 {
13282 if (rand.Next(2) == 0)
13283 {
13284 seagullCageFrame[num4] = 15;
13285 }
13286 else
13287 {
13288 seagullCageFrame[num4] = 19;
13289 }
13290 continue;
13291 }
13292 if (seagullCageFrame[num4] == 9)
13293 {
13295 continue;
13296 }
13297 if (seagullCageFrame[num4] == 8 || seagullCageFrame[num4] == 15)
13298 {
13299 seagullCageFrame[num4] = 14;
13300 continue;
13301 }
13303 if (seagullCageFrame[num4] > 26)
13304 {
13306 }
13307 }
13308 else if (seagullCageFrame[num4] >= 15 && seagullCageFrame[num4] <= 18)
13309 {
13310 int num7 = seagullCageFrameCounter[num4] % 66;
13311 if (num7 > 60)
13312 {
13313 seagullCageFrame[num4] = 15;
13314 }
13315 else if (num7 > 54)
13316 {
13317 seagullCageFrame[num4] = 16;
13318 }
13319 else if (num7 > 48)
13320 {
13321 seagullCageFrame[num4] = 17;
13322 }
13323 else if (num7 > 42)
13324 {
13325 seagullCageFrame[num4] = 18;
13326 }
13327 else if (num7 > 36)
13328 {
13329 seagullCageFrame[num4] = 17;
13330 }
13331 else if (num7 > 30)
13332 {
13333 seagullCageFrame[num4] = 16;
13334 }
13335 else if (num7 > 24)
13336 {
13337 seagullCageFrame[num4] = 17;
13338 }
13339 else if (num7 > 18)
13340 {
13341 seagullCageFrame[num4] = 18;
13342 }
13343 else if (num7 > 12)
13344 {
13345 seagullCageFrame[num4] = 17;
13346 }
13347 else if (num7 > 6)
13348 {
13349 seagullCageFrame[num4] = 16;
13350 }
13351 else
13352 {
13353 seagullCageFrame[num4] = 15;
13354 }
13355 }
13356 else if (seagullCageFrame[num4] >= 9 && seagullCageFrame[num4] <= 13)
13357 {
13358 int num8 = seagullCageFrameCounter[num4] % 78;
13359 if (num8 > 72)
13360 {
13362 }
13363 else if (num8 > 66)
13364 {
13365 seagullCageFrame[num4] = 10;
13366 }
13367 else if (num8 > 60)
13368 {
13369 seagullCageFrame[num4] = 11;
13370 }
13371 else if (num8 > 54)
13372 {
13373 seagullCageFrame[num4] = 12;
13374 }
13375 else if (num8 > 48)
13376 {
13377 seagullCageFrame[num4] = 13;
13378 }
13379 else if (num8 > 42)
13380 {
13381 seagullCageFrame[num4] = 12;
13382 }
13383 else if (num8 > 36)
13384 {
13385 seagullCageFrame[num4] = 11;
13386 }
13387 else if (num8 > 30)
13388 {
13389 seagullCageFrame[num4] = 12;
13390 }
13391 else if (num8 > 24)
13392 {
13393 seagullCageFrame[num4] = 13;
13394 }
13395 else if (num8 > 18)
13396 {
13397 seagullCageFrame[num4] = 12;
13398 }
13399 else if (num8 > 12)
13400 {
13401 seagullCageFrame[num4] = 11;
13402 }
13403 else if (num8 > 6)
13404 {
13405 seagullCageFrame[num4] = 10;
13406 }
13407 else
13408 {
13410 }
13411 }
13412 }
13413 for (int num9 = 0; num9 < cageFrames; num9++)
13414 {
13415 if (birdCageFrame[num9] == 0)
13416 {
13418 if (birdCageFrameCounter[num9] <= rand.Next(30, 2700))
13419 {
13420 continue;
13421 }
13422 if (rand.Next(3) != 0)
13423 {
13424 if (rand.Next(3) != 0)
13425 {
13426 birdCageFrame[num9] = 2;
13427 }
13428 else
13429 {
13430 birdCageFrame[num9] = 1;
13431 }
13432 }
13434 }
13435 else if (birdCageFrame[num9] == 1)
13436 {
13438 if (birdCageFrameCounter[num9] > rand.Next(900, 18000) && rand.Next(3) == 0)
13439 {
13441 birdCageFrame[num9] = 0;
13442 }
13443 }
13444 else if (birdCageFrame[num9] >= 2 && birdCageFrame[num9] <= 5)
13445 {
13447 if (birdCageFrameCounter[num9] >= 5)
13448 {
13450 if (birdCageFrame[num9] == 3 && rand.Next(3) == 0)
13451 {
13452 birdCageFrame[num9] = 13;
13453 }
13454 else
13455 {
13457 }
13458 }
13459 }
13460 else if (birdCageFrame[num9] == 6)
13461 {
13463 if (birdCageFrameCounter[num9] <= rand.Next(45, 2700))
13464 {
13465 continue;
13466 }
13467 if (rand.Next(3) != 0)
13468 {
13469 if (rand.Next(6) == 0)
13470 {
13471 birdCageFrame[num9] = 7;
13472 }
13473 else if (rand.Next(6) == 0)
13474 {
13475 birdCageFrame[num9] = 11;
13476 }
13477 }
13479 }
13480 else if (birdCageFrame[num9] >= 7 && birdCageFrame[num9] <= 10)
13481 {
13483 if (birdCageFrameCounter[num9] >= 5)
13484 {
13486 if (birdCageFrame[num9] > 10)
13487 {
13488 birdCageFrame[num9] = 0;
13489 }
13491 }
13492 }
13493 else if (birdCageFrame[num9] >= 11 && birdCageFrame[num9] <= 13)
13494 {
13496 if (birdCageFrameCounter[num9] >= 5)
13497 {
13500 }
13501 }
13502 else if (birdCageFrame[num9] == 14)
13503 {
13505 if (birdCageFrameCounter[num9] > rand.Next(5, 600))
13506 {
13507 if (rand.Next(20) == 0)
13508 {
13509 birdCageFrame[num9] = 16;
13510 }
13511 else if (rand.Next(20) == 0)
13512 {
13513 birdCageFrame[num9] = 4;
13514 }
13515 else
13516 {
13517 birdCageFrame[num9] = 15;
13518 }
13520 }
13521 }
13522 else if (birdCageFrame[num9] == 15)
13523 {
13525 if (birdCageFrameCounter[num9] >= 10)
13526 {
13528 birdCageFrame[num9] = 14;
13529 }
13530 }
13531 else
13532 {
13533 if (birdCageFrame[num9] < 16 || birdCageFrame[num9] > 18)
13534 {
13535 continue;
13536 }
13538 if (birdCageFrameCounter[num9] >= 5)
13539 {
13541 if (birdCageFrame[num9] > 18)
13542 {
13543 birdCageFrame[num9] = 0;
13544 }
13546 }
13547 }
13548 }
13549 for (int num10 = 0; num10 < cageFrames; num10++)
13550 {
13551 if (blueBirdCageFrame[num10] == 0)
13552 {
13554 if (blueBirdCageFrameCounter[num10] <= rand.Next(30, 2700))
13555 {
13556 continue;
13557 }
13558 if (rand.Next(3) != 0)
13559 {
13560 if (rand.Next(3) != 0)
13561 {
13563 }
13564 else
13565 {
13567 }
13568 }
13570 }
13571 else if (blueBirdCageFrame[num10] == 1)
13572 {
13574 if (blueBirdCageFrameCounter[num10] > rand.Next(900, 18000) && rand.Next(3) == 0)
13575 {
13578 }
13579 }
13580 else if (blueBirdCageFrame[num10] >= 2 && blueBirdCageFrame[num10] <= 5)
13581 {
13584 {
13586 if (blueBirdCageFrame[num10] == 3 && rand.Next(3) == 0)
13587 {
13589 }
13590 else
13591 {
13593 }
13594 }
13595 }
13596 else if (blueBirdCageFrame[num10] == 6)
13597 {
13599 if (blueBirdCageFrameCounter[num10] <= rand.Next(45, 2700))
13600 {
13601 continue;
13602 }
13603 if (rand.Next(3) != 0)
13604 {
13605 if (rand.Next(6) == 0)
13606 {
13608 }
13609 else if (rand.Next(6) == 0)
13610 {
13612 }
13613 }
13615 }
13616 else if (blueBirdCageFrame[num10] >= 7 && blueBirdCageFrame[num10] <= 10)
13617 {
13620 {
13622 if (blueBirdCageFrame[num10] > 10)
13623 {
13625 }
13627 }
13628 }
13629 else if (blueBirdCageFrame[num10] >= 11 && blueBirdCageFrame[num10] <= 13)
13630 {
13633 {
13636 }
13637 }
13638 else if (blueBirdCageFrame[num10] == 14)
13639 {
13641 if (blueBirdCageFrameCounter[num10] > rand.Next(5, 600))
13642 {
13643 if (rand.Next(20) == 0)
13644 {
13646 }
13647 else if (rand.Next(20) == 0)
13648 {
13650 }
13651 else
13652 {
13654 }
13656 }
13657 }
13658 else if (blueBirdCageFrame[num10] == 15)
13659 {
13662 {
13665 }
13666 }
13667 else
13668 {
13670 {
13671 continue;
13672 }
13675 {
13677 if (blueBirdCageFrame[num10] > 18)
13678 {
13680 }
13682 }
13683 }
13684 }
13685 for (int num11 = 0; num11 < cageFrames; num11++)
13686 {
13687 if (redBirdCageFrame[num11] == 0)
13688 {
13690 if (redBirdCageFrameCounter[num11] <= rand.Next(30, 2700))
13691 {
13692 continue;
13693 }
13694 if (rand.Next(3) != 0)
13695 {
13696 if (rand.Next(3) != 0)
13697 {
13699 }
13700 else
13701 {
13703 }
13704 }
13706 }
13707 else if (redBirdCageFrame[num11] == 1)
13708 {
13710 if (redBirdCageFrameCounter[num11] > rand.Next(900, 18000) && rand.Next(3) == 0)
13711 {
13714 }
13715 }
13716 else if (redBirdCageFrame[num11] >= 2 && redBirdCageFrame[num11] <= 5)
13717 {
13720 {
13722 if (redBirdCageFrame[num11] == 3 && rand.Next(3) == 0)
13723 {
13724 redBirdCageFrame[num11] = 13;
13725 }
13726 else
13727 {
13729 }
13730 }
13731 }
13732 else if (redBirdCageFrame[num11] == 6)
13733 {
13735 if (redBirdCageFrameCounter[num11] <= rand.Next(45, 2700))
13736 {
13737 continue;
13738 }
13739 if (rand.Next(3) != 0)
13740 {
13741 if (rand.Next(6) == 0)
13742 {
13744 }
13745 else if (rand.Next(6) == 0)
13746 {
13747 redBirdCageFrame[num11] = 11;
13748 }
13749 }
13751 }
13752 else if (redBirdCageFrame[num11] >= 7 && redBirdCageFrame[num11] <= 10)
13753 {
13756 {
13758 if (redBirdCageFrame[num11] > 10)
13759 {
13761 }
13763 }
13764 }
13765 else if (redBirdCageFrame[num11] >= 11 && redBirdCageFrame[num11] <= 13)
13766 {
13769 {
13772 }
13773 }
13774 else if (redBirdCageFrame[num11] == 14)
13775 {
13777 if (redBirdCageFrameCounter[num11] > rand.Next(5, 600))
13778 {
13779 if (rand.Next(20) == 0)
13780 {
13781 redBirdCageFrame[num11] = 16;
13782 }
13783 else if (rand.Next(20) == 0)
13784 {
13786 }
13787 else
13788 {
13789 redBirdCageFrame[num11] = 15;
13790 }
13792 }
13793 }
13794 else if (redBirdCageFrame[num11] == 15)
13795 {
13797 if (redBirdCageFrameCounter[num11] >= 10)
13798 {
13800 redBirdCageFrame[num11] = 14;
13801 }
13802 }
13803 else
13804 {
13805 if (redBirdCageFrame[num11] < 16 || redBirdCageFrame[num11] > 18)
13806 {
13807 continue;
13808 }
13811 {
13813 if (redBirdCageFrame[num11] > 18)
13814 {
13816 }
13818 }
13819 }
13820 }
13821 for (int num12 = 0; num12 < cageFrames; num12++)
13822 {
13823 if (macawCageFrame[num12] == 0)
13824 {
13826 if (macawCageFrameCounter[num12] <= rand.Next(300, 2700))
13827 {
13828 continue;
13829 }
13830 if (rand.Next(3) != 0)
13831 {
13832 if (rand.Next(3) != 0)
13833 {
13834 macawCageFrame[num12] = 16;
13835 }
13836 else
13837 {
13838 macawCageFrame[num12] = 1;
13839 }
13840 }
13842 }
13843 else if (macawCageFrame[num12] >= 1 && macawCageFrame[num12] <= 5)
13844 {
13847 {
13850 if (macawCageFrame[num12] > 5)
13851 {
13852 macawCageFrame[num12] = 6;
13853 }
13854 }
13855 }
13856 else if (macawCageFrame[num12] >= 16 && macawCageFrame[num12] <= 19)
13857 {
13860 {
13863 if (macawCageFrame[num12] > 19)
13864 {
13865 macawCageFrame[num12] = ((rand.Next(3) != 0) ? 16 : 0);
13866 }
13867 }
13868 }
13869 else if (macawCageFrame[num12] == 6)
13870 {
13872 if (macawCageFrameCounter[num12] <= rand.Next(300, 2700))
13873 {
13874 continue;
13875 }
13876 if (rand.Next(3) != 0)
13877 {
13878 if (rand.Next(3) != 0)
13879 {
13880 macawCageFrame[num12] = 7;
13881 }
13882 else
13883 {
13884 macawCageFrame[num12] = 11;
13885 }
13886 }
13888 }
13889 else if (macawCageFrame[num12] >= 11 && macawCageFrame[num12] <= 15)
13890 {
13893 {
13896 if (macawCageFrame[num12] > 15)
13897 {
13898 macawCageFrame[num12] = 0;
13899 }
13900 }
13901 }
13902 else
13903 {
13904 if (macawCageFrame[num12] < 7 || macawCageFrame[num12] > 10)
13905 {
13906 continue;
13907 }
13910 {
13913 if (macawCageFrame[num12] > 10)
13914 {
13915 macawCageFrame[num12] = ((rand.Next(3) == 0) ? 6 : 7);
13916 }
13917 }
13918 }
13919 }
13920 for (int num13 = 0; num13 < 2; num13++)
13921 {
13922 for (int num14 = 0; num14 < cageFrames; num14++)
13923 {
13925 {
13927 if (scorpionCageFrameCounter[num13, num14] <= rand.Next(30, 3600))
13928 {
13929 continue;
13930 }
13931 if (scorpionCageFrame[num13, num14] == 7)
13932 {
13934 }
13935 else if (rand.Next(3) == 0)
13936 {
13937 if (rand.Next(7) == 0)
13938 {
13940 }
13941 else if (rand.Next(4) == 0)
13942 {
13944 }
13945 else if (rand.Next(3) == 0)
13946 {
13948 }
13949 else
13950 {
13952 }
13953 }
13955 }
13956 else if (scorpionCageFrame[num13, num14] >= 1 && scorpionCageFrame[num13, num14] <= 2)
13957 {
13960 {
13963 }
13964 }
13965 else if (scorpionCageFrame[num13, num14] >= 8 && scorpionCageFrame[num13, num14] <= 10)
13966 {
13969 {
13972 }
13973 }
13974 else if (scorpionCageFrame[num13, num14] == 11)
13975 {
13977 if (scorpionCageFrameCounter[num13, num14] > rand.Next(45, 5400))
13978 {
13979 if (rand.Next(6) == 0)
13980 {
13982 }
13984 }
13985 }
13986 else if (scorpionCageFrame[num13, num14] >= 12 && scorpionCageFrame[num13, num14] <= 13)
13987 {
13990 {
13993 if (scorpionCageFrame[num13, num14] > 13)
13994 {
13996 }
13997 }
13998 }
13999 else if (scorpionCageFrame[num13, num14] >= 14 && scorpionCageFrame[num13, num14] <= 15)
14000 {
14003 {
14006 if (scorpionCageFrame[num13, num14] > 15)
14007 {
14009 }
14010 if (rand.Next(5) == 0)
14011 {
14013 }
14014 }
14015 }
14016 else if (scorpionCageFrame[num13, num14] == 4 || scorpionCageFrame[num13, num14] == 3)
14017 {
14019 if (scorpionCageFrameCounter[num13, num14] <= rand.Next(30, 3600))
14020 {
14021 continue;
14022 }
14023 if (scorpionCageFrame[num13, num14] == 3)
14024 {
14026 }
14027 else if (rand.Next(3) == 0)
14028 {
14029 if (rand.Next(5) == 0)
14030 {
14032 }
14033 else if (rand.Next(3) == 0)
14034 {
14036 }
14037 else
14038 {
14040 }
14041 }
14043 }
14044 else if (scorpionCageFrame[num13, num14] >= 5 && scorpionCageFrame[num13, num14] <= 6)
14045 {
14048 {
14051 if (scorpionCageFrame[num13, num14] > 7)
14052 {
14054 }
14055 }
14056 }
14057 else
14058 {
14060 {
14061 continue;
14062 }
14065 {
14068 if (scorpionCageFrame[num13, num14] > 17)
14069 {
14071 }
14072 if (rand.Next(5) == 0)
14073 {
14075 }
14076 }
14077 }
14078 }
14079 }
14080 for (int num15 = 0; num15 < cageFrames; num15++)
14081 {
14082 if (penguinCageFrame[num15] == 0)
14083 {
14085 if (penguinCageFrameCounter[num15] <= rand.Next(30, 1800))
14086 {
14087 continue;
14088 }
14089 if (rand.Next(2) == 0)
14090 {
14091 if (rand.Next(10) == 0)
14092 {
14094 }
14095 else if (rand.Next(7) == 0)
14096 {
14097 penguinCageFrame[num15] = 15;
14098 }
14099 else if (rand.Next(3) == 0)
14100 {
14102 }
14103 else
14104 {
14106 }
14107 }
14109 }
14110 else if (penguinCageFrame[num15] == 1)
14111 {
14113 if (penguinCageFrameCounter[num15] >= 10)
14114 {
14117 }
14118 }
14119 else if (penguinCageFrame[num15] >= 2 && penguinCageFrame[num15] <= 3)
14120 {
14123 {
14124 continue;
14125 }
14128 if (penguinCageFrame[num15] > 3)
14129 {
14130 if (rand.Next(3) == 0)
14131 {
14133 }
14134 else
14135 {
14137 }
14138 }
14139 }
14140 else if (penguinCageFrame[num15] >= 4 && penguinCageFrame[num15] <= 6)
14141 {
14143 if (penguinCageFrameCounter[num15] >= 10)
14144 {
14147 }
14148 }
14149 else if (penguinCageFrame[num15] == 15)
14150 {
14152 if (penguinCageFrameCounter[num15] > rand.Next(10, 1800))
14153 {
14154 if (rand.Next(2) == 0)
14155 {
14157 }
14159 }
14160 }
14161 else if (penguinCageFrame[num15] == 8)
14162 {
14164 if (penguinCageFrameCounter[num15] <= rand.Next(30, 3600))
14165 {
14166 continue;
14167 }
14168 if (rand.Next(2) == 0)
14169 {
14170 if (rand.Next(10) == 0)
14171 {
14172 penguinCageFrame[num15] = 12;
14173 }
14174 else if (rand.Next(7) == 0)
14175 {
14177 }
14178 else if (rand.Next(3) == 0)
14179 {
14180 penguinCageFrame[num15] = 10;
14181 }
14182 else
14183 {
14185 }
14186 }
14188 }
14189 else if (penguinCageFrame[num15] == 9)
14190 {
14192 if (penguinCageFrameCounter[num15] >= 10)
14193 {
14196 }
14197 }
14198 else if (penguinCageFrame[num15] >= 10 && penguinCageFrame[num15] <= 11)
14199 {
14202 {
14203 continue;
14204 }
14207 if (penguinCageFrame[num15] > 3)
14208 {
14209 if (rand.Next(3) == 0)
14210 {
14212 }
14213 else
14214 {
14215 penguinCageFrame[num15] = 10;
14216 }
14217 }
14218 }
14219 else if (penguinCageFrame[num15] >= 12 && penguinCageFrame[num15] <= 14)
14220 {
14222 if (penguinCageFrameCounter[num15] >= 10)
14223 {
14226 }
14227 }
14228 else
14229 {
14230 if (penguinCageFrame[num15] != 7)
14231 {
14232 continue;
14233 }
14235 if (penguinCageFrameCounter[num15] > rand.Next(10, 3600))
14236 {
14237 if (rand.Next(2) == 0)
14238 {
14240 }
14242 }
14243 }
14244 }
14245 for (int num16 = 0; num16 < cageFrames; num16++)
14246 {
14248 bool num17 = turtleCageFrame[num16] == 0 || turtleCageFrame[num16] == 15 || turtleCageFrame[num16] == 31;
14249 int num18 = 8;
14250 if (num17)
14251 {
14252 num18 = rand.Next(180, 250);
14253 }
14255 {
14256 continue;
14257 }
14259 if (turtleCageFrame[num16] == 29)
14260 {
14262 continue;
14263 }
14264 if (turtleCageFrame[num16] == 15 && rand.Next(3) == 0)
14265 {
14266 turtleCageFrame[num16] = 30;
14267 continue;
14268 }
14270 if (turtleCageFrame[num16] > 32)
14271 {
14272 turtleCageFrame[num16] = 15;
14273 }
14274 }
14275 for (int num19 = 0; num19 < cageFrames; num19++)
14276 {
14278 bool flag4 = seahorseCageFrame[num19] == 0 || seahorseCageFrame[num19] == 13;
14280 bool flag5 = seahorseCageFrame[num19] >= 25;
14281 int num21 = 7;
14282 if (flag4)
14283 {
14284 num21 = rand.Next(220, 340);
14285 }
14286 if (num20)
14287 {
14288 num21 = 10;
14289 }
14290 if (flag5)
14291 {
14292 num21 = 6;
14293 }
14295 {
14296 continue;
14297 }
14299 if (seahorseCageFrame[num19] == 0 && rand.Next(2) == 0)
14300 {
14302 continue;
14303 }
14304 if (seahorseCageFrame[num19] == 24)
14305 {
14307 continue;
14308 }
14310 if (seahorseCageFrame[num19] > 33)
14311 {
14313 }
14314 }
14316 for (int num22 = 0; num22 < cageFrames; num22++)
14317 {
14318 if (snailCageFrame[num22] >= 0 && snailCageFrame[num22] <= 13)
14319 {
14321 if (snailCageFrameCounter[num22] <= rand.Next(45, 3600))
14322 {
14323 continue;
14324 }
14325 if (snailCageFrame[num22] == 8 && rand.Next(2) == 0)
14326 {
14327 snailCageFrame[num22] = 14;
14328 }
14329 else if (snailCageFrame[num22] == 1 && rand.Next(3) == 0)
14330 {
14331 snailCageFrame[num22] = 19;
14332 }
14333 else if (snailCageFrame[num22] == 1 && rand.Next(3) == 0)
14334 {
14335 snailCageFrame[num22] = 20;
14336 }
14337 else
14338 {
14340 if (snailCageFrame[num22] > 13)
14341 {
14342 snailCageFrame[num22] = 0;
14343 }
14344 }
14346 }
14347 else if (snailCageFrame[num22] >= 14 && snailCageFrame[num22] <= 18)
14348 {
14350 if (snailCageFrameCounter[num22] >= 5)
14351 {
14354 }
14355 if (snailCageFrame[num22] > 18)
14356 {
14357 snailCageFrame[num22] = 20;
14358 }
14359 }
14360 else
14361 {
14362 if (snailCageFrame[num22] != 19 && snailCageFrame[num22] != 20)
14363 {
14364 continue;
14365 }
14367 if (snailCageFrameCounter[num22] <= rand.Next(60, 7200))
14368 {
14369 continue;
14370 }
14372 if (rand.Next(4) == 0)
14373 {
14374 if (rand.Next(3) == 0)
14375 {
14376 snailCageFrame[num22] = 2;
14377 }
14378 else if (snailCageFrame[num22] == 19)
14379 {
14380 snailCageFrame[num22] = 20;
14381 }
14382 else
14383 {
14384 snailCageFrame[num22] = 19;
14385 }
14386 }
14387 }
14388 }
14389 for (int num23 = 0; num23 < cageFrames; num23++)
14390 {
14391 if (snail2CageFrame[num23] >= 0 && snail2CageFrame[num23] <= 13)
14392 {
14394 if (snail2CageFrameCounter[num23] <= rand.Next(30, 2700))
14395 {
14396 continue;
14397 }
14398 if (snail2CageFrame[num23] == 8 && rand.Next(2) == 0)
14399 {
14400 snail2CageFrame[num23] = 14;
14401 }
14402 else if (snail2CageFrame[num23] == 1 && rand.Next(3) == 0)
14403 {
14404 snail2CageFrame[num23] = 19;
14405 }
14406 else if (snail2CageFrame[num23] == 1 && rand.Next(3) == 0)
14407 {
14408 snail2CageFrame[num23] = 20;
14409 }
14410 else
14411 {
14413 if (snail2CageFrame[num23] > 13)
14414 {
14416 }
14417 }
14419 }
14420 else if (snail2CageFrame[num23] >= 14 && snail2CageFrame[num23] <= 18)
14421 {
14423 if (snail2CageFrameCounter[num23] >= 5)
14424 {
14427 }
14428 if (snail2CageFrame[num23] > 18)
14429 {
14430 snail2CageFrame[num23] = 20;
14431 }
14432 }
14433 else
14434 {
14435 if (snail2CageFrame[num23] != 19 && snail2CageFrame[num23] != 20)
14436 {
14437 continue;
14438 }
14440 if (snail2CageFrameCounter[num23] <= rand.Next(45, 5400))
14441 {
14442 continue;
14443 }
14445 if (rand.Next(4) == 0)
14446 {
14447 if (rand.Next(3) == 0)
14448 {
14450 }
14451 else if (snail2CageFrame[num23] == 19)
14452 {
14453 snail2CageFrame[num23] = 20;
14454 }
14455 else
14456 {
14457 snail2CageFrame[num23] = 19;
14458 }
14459 }
14460 }
14461 }
14462 for (int num24 = 0; num24 < cageFrames; num24++)
14463 {
14464 if (frogCageFrame[num24] == 0)
14465 {
14467 if (frogCageFrameCounter[num24] > rand.Next(45, 3600))
14468 {
14469 if (rand.Next(10) == 0)
14470 {
14471 frogCageFrame[num24] = 1;
14472 }
14473 else
14474 {
14475 frogCageFrame[num24] = 12;
14476 }
14478 }
14479 }
14480 else if (frogCageFrame[num24] >= 1 && frogCageFrame[num24] <= 5)
14481 {
14483 if (frogCageFrameCounter[num24] >= 5)
14484 {
14487 }
14488 }
14489 else if (frogCageFrame[num24] >= 12 && frogCageFrame[num24] <= 17)
14490 {
14492 if (frogCageFrameCounter[num24] >= 5)
14493 {
14496 }
14497 if (frogCageFrame[num24] > 17)
14498 {
14499 if (rand.Next(3) == 0)
14500 {
14501 frogCageFrame[num24] = 0;
14502 }
14503 else
14504 {
14505 frogCageFrame[num24] = 12;
14506 }
14507 }
14508 }
14509 else if (frogCageFrame[num24] == 6)
14510 {
14512 if (frogCageFrameCounter[num24] > rand.Next(45, 3600))
14513 {
14514 if (rand.Next(10) == 0)
14515 {
14516 frogCageFrame[num24] = 7;
14517 }
14518 else
14519 {
14520 frogCageFrame[num24] = 18;
14521 }
14523 }
14524 }
14525 else if (frogCageFrame[num24] >= 7 && frogCageFrame[num24] <= 11)
14526 {
14528 if (frogCageFrameCounter[num24] >= 5)
14529 {
14532 if (frogCageFrame[num24] > 11)
14533 {
14534 frogCageFrame[num24] = 0;
14535 }
14536 }
14537 }
14538 else
14539 {
14540 if (frogCageFrame[num24] < 18 || frogCageFrame[num24] > 23)
14541 {
14542 continue;
14543 }
14545 if (frogCageFrameCounter[num24] >= 5)
14546 {
14549 }
14550 if (frogCageFrame[num24] > 17)
14551 {
14552 if (rand.Next(3) == 0)
14553 {
14554 frogCageFrame[num24] = 6;
14555 }
14556 else
14557 {
14558 frogCageFrame[num24] = 18;
14559 }
14560 }
14561 }
14562 }
14563 for (int num25 = 0; num25 < cageFrames; num25++)
14564 {
14565 if (mouseCageFrame[num25] >= 0 && mouseCageFrame[num25] <= 1)
14566 {
14568 if (mouseCageFrameCounter[num25] >= 5)
14569 {
14571 if (mouseCageFrame[num25] > 1)
14572 {
14573 mouseCageFrame[num25] = 0;
14574 }
14576 if (rand.Next(15) == 0)
14577 {
14578 mouseCageFrame[num25] = 4;
14579 }
14580 }
14581 }
14582 else if (mouseCageFrame[num25] >= 4 && mouseCageFrame[num25] <= 7)
14583 {
14585 if (mouseCageFrameCounter[num25] >= 5)
14586 {
14589 }
14590 if (mouseCageFrame[num25] > 7)
14591 {
14592 mouseCageFrame[num25] = 2;
14593 }
14594 }
14595 else if (mouseCageFrame[num25] >= 2 && mouseCageFrame[num25] <= 3)
14596 {
14598 if (mouseCageFrameCounter[num25] >= 5)
14599 {
14601 if (mouseCageFrame[num25] > 3)
14602 {
14603 mouseCageFrame[num25] = 2;
14604 }
14606 if (rand.Next(15) == 0)
14607 {
14608 mouseCageFrame[num25] = 8;
14609 }
14610 else if (rand.Next(15) == 0)
14611 {
14612 mouseCageFrame[num25] = 12;
14613 }
14614 }
14615 }
14616 else if (mouseCageFrame[num25] >= 8 && mouseCageFrame[num25] <= 11)
14617 {
14619 if (mouseCageFrameCounter[num25] >= 5)
14620 {
14623 }
14624 if (mouseCageFrame[num25] > 11)
14625 {
14626 mouseCageFrame[num25] = 0;
14627 }
14628 }
14629 else if (mouseCageFrame[num25] >= 12 && mouseCageFrame[num25] <= 13)
14630 {
14632 if (mouseCageFrameCounter[num25] >= 5)
14633 {
14636 }
14637 }
14638 else if (mouseCageFrame[num25] >= 14 && mouseCageFrame[num25] <= 17)
14639 {
14641 if (mouseCageFrameCounter[num25] >= 5)
14642 {
14645 if (mouseCageFrame[num25] > 17 && rand.Next(20) != 0)
14646 {
14647 mouseCageFrame[num25] = 14;
14648 }
14649 }
14650 }
14651 else
14652 {
14653 if (mouseCageFrame[num25] < 18 || mouseCageFrame[num25] > 19)
14654 {
14655 continue;
14656 }
14658 if (mouseCageFrameCounter[num25] >= 5)
14659 {
14662 if (mouseCageFrame[num25] > 19)
14663 {
14664 mouseCageFrame[num25] = 0;
14665 }
14666 }
14667 }
14668 }
14669 for (int num26 = 0; num26 < cageFrames; num26++)
14670 {
14672 if (wormCageFrameCounter[num26] < rand.Next(30, 91))
14673 {
14674 continue;
14675 }
14677 if (rand.Next(4) != 0)
14678 {
14679 continue;
14680 }
14682 if (wormCageFrame[num26] == 9 && rand.Next(2) == 0)
14683 {
14684 wormCageFrame[num26] = 0;
14685 }
14686 if (wormCageFrame[num26] > 18)
14687 {
14688 if (rand.Next(2) == 0)
14689 {
14690 wormCageFrame[num26] = 9;
14691 }
14692 else
14693 {
14694 wormCageFrame[num26] = 0;
14695 }
14696 }
14697 }
14698 int num27 = 0;
14699 for (int num28 = 0; num28 < 3; num28++)
14700 {
14701 switch (num28)
14702 {
14703 case 0:
14704 num27 = 24;
14705 break;
14706 case 1:
14707 num27 = 31;
14708 break;
14709 case 2:
14710 num27 = 34;
14711 break;
14712 }
14713 for (int num29 = 0; num29 < cageFrames; num29++)
14714 {
14715 if (++slugCageFrameCounter[num28, num29] >= rand.Next(5, 15))
14716 {
14718 if (++slugCageFrame[num28, num29] >= num27)
14719 {
14721 }
14722 }
14723 }
14724 }
14725 for (int num30 = 0; num30 < cageFrames; num30++)
14726 {
14728 {
14731 {
14733 if (grasshopperCageFrame[num30] > 1)
14734 {
14736 }
14738 if (rand.Next(15) == 0)
14739 {
14741 }
14742 }
14743 }
14744 else if (grasshopperCageFrame[num30] >= 2 && grasshopperCageFrame[num30] <= 5)
14745 {
14748 {
14751 }
14752 if (grasshopperCageFrame[num30] > 5)
14753 {
14755 }
14756 }
14757 else if (grasshopperCageFrame[num30] >= 6 && grasshopperCageFrame[num30] <= 7)
14758 {
14761 {
14763 if (grasshopperCageFrame[num30] > 7)
14764 {
14766 }
14768 if (rand.Next(15) == 0)
14769 {
14771 }
14772 }
14773 }
14774 else if (grasshopperCageFrame[num30] >= 8 && grasshopperCageFrame[num30] <= 11)
14775 {
14778 {
14781 }
14782 if (grasshopperCageFrame[num30] > 11)
14783 {
14785 }
14786 }
14787 }
14788 for (int num31 = 0; num31 < cageFrames; num31++)
14789 {
14791 bool num32 = maggotCageFrame[num31] == 0 || maggotCageFrame[num31] == 6 || maggotCageFrame[num31] == 18;
14792 int num33 = 8;
14793 if (num32)
14794 {
14795 num33 = rand.Next(100, 140);
14796 }
14798 {
14799 continue;
14800 }
14802 if (maggotCageFrame[num31] == 0)
14803 {
14804 if (rand.Next(3) == 0)
14805 {
14806 maggotCageFrame[num31] = 13;
14807 }
14808 else
14809 {
14811 }
14812 continue;
14813 }
14814 if (maggotCageFrame[num31] == 12)
14815 {
14817 continue;
14818 }
14820 if (maggotCageFrame[num31] > 23)
14821 {
14823 }
14824 }
14825 for (int num34 = 0; num34 < cageFrames; num34++)
14826 {
14829 int num35 = rand.Next(10, 12);
14830 if (ladybugCageFrame[num34] == 18)
14831 {
14832 num35 = rand.Next(160, 241);
14833 }
14834 else if (flag6)
14835 {
14836 num35 = rand.Next(198, 206);
14837 }
14838 else if (ladybugCageFrame[num34] >= 8 && ladybugCageFrame[num34] <= 16)
14839 {
14840 num35 = 5;
14841 }
14843 {
14844 continue;
14845 }
14847 if (ladybugCageFrame[num34] < 18)
14848 {
14849 if ((ladybugCageFrame[num34] == 2 || ladybugCageFrame[num34] == 5) && rand.Next(3) == 0)
14850 {
14851 ladybugCageFrame[num34] = 17;
14852 }
14853 else if (ladybugCageFrame[num34] == 3 || ladybugCageFrame[num34] == 12)
14854 {
14855 switch (rand.Next(3))
14856 {
14857 case 0:
14858 case 1:
14860 break;
14861 case 2:
14862 ladybugCageFrame[num34] = 13;
14863 break;
14864 }
14865 }
14866 else if (ladybugCageFrame[num34] == 7 || ladybugCageFrame[num34] == 16)
14867 {
14868 switch (rand.Next(3))
14869 {
14870 case 0:
14871 case 1:
14873 break;
14874 case 2:
14876 break;
14877 }
14878 }
14879 else
14880 {
14882 }
14883 }
14884 else
14885 {
14886 ladybugCageFrame[num34] = ((rand.Next(2) == 0) ? 13 : 4);
14887 }
14888 }
14889 for (int num36 = 0; num36 < cageFrames; num36++)
14890 {
14892 bool flag7 = ratCageFrame[num36] == 0 || ratCageFrame[num36] == 4;
14893 bool num37 = ratCageFrame[num36] == 8 || ratCageFrame[num36] == 9 || ratCageFrame[num36] == 10 || ratCageFrame[num36] == 11;
14894 bool flag8 = ratCageFrame[num36] > 11;
14895 int num38 = 5;
14896 if (flag7)
14897 {
14898 num38 = rand.Next(40, 70);
14899 }
14900 if (num37)
14901 {
14902 num38 = rand.Next(70, 110);
14903 }
14904 if (flag8)
14905 {
14906 num38 = 180;
14907 }
14909 {
14911 if (ratCageFrame[num36] == 0 && rand.Next(2) == 0)
14912 {
14913 if (rand.Next(3) != 0)
14914 {
14915 ratCageFrame[num36] = 12;
14916 }
14917 else
14918 {
14919 ratCageFrame[num36] = 8;
14920 }
14921 continue;
14922 }
14923 if (ratCageFrame[num36] == 4 && rand.Next(2) == 0)
14924 {
14925 ratCageFrame[num36] = 10;
14926 continue;
14927 }
14928 if (ratCageFrame[num36] == 7 || ratCageFrame[num36] == 9 || ratCageFrame[num36] == 12)
14929 {
14930 ratCageFrame[num36] = 0;
14931 continue;
14932 }
14933 if (ratCageFrame[num36] == 11)
14934 {
14935 ratCageFrame[num36] = 4;
14936 continue;
14937 }
14939 if (ratCageFrame[num36] > 16)
14940 {
14941 ratCageFrame[num36] = 0;
14942 }
14943 }
14944 else if (ratCageFrame[num36] > 11)
14945 {
14946 int num39 = ratCageFrameCounter[num36] % 90;
14947 if (num39 > 80)
14948 {
14949 ratCageFrame[num36] = 12;
14950 }
14951 else if (num39 > 70)
14952 {
14953 ratCageFrame[num36] = 13;
14954 }
14955 else if (num39 > 60)
14956 {
14957 ratCageFrame[num36] = 14;
14958 }
14959 else if (num39 > 50)
14960 {
14961 ratCageFrame[num36] = 15;
14962 }
14963 else if (num39 > 40)
14964 {
14965 ratCageFrame[num36] = 16;
14966 }
14967 else if (num39 > 30)
14968 {
14969 ratCageFrame[num36] = 15;
14970 }
14971 else if (num39 > 20)
14972 {
14973 ratCageFrame[num36] = 14;
14974 }
14975 else if (num39 > 10)
14976 {
14977 ratCageFrame[num36] = 13;
14978 }
14979 else
14980 {
14981 ratCageFrame[num36] = 12;
14982 }
14983 }
14984 else if (ratCageFrameCounter[num36] % 10 == 0)
14985 {
14986 if (ratCageFrame[num36] == 8 || ratCageFrame[num36] == 10)
14987 {
14989 }
14990 else if (ratCageFrame[num36] == 9 || ratCageFrame[num36] == 11)
14991 {
14993 }
14994 }
14995 }
14996 for (int num40 = 0; num40 < cageFrames; num40++)
14997 {
15001 int num42 = 5;
15002 if (flag9)
15003 {
15004 num42 = rand.Next(110, 210);
15005 }
15006 if (num41)
15007 {
15008 num42 = rand.Next(150, 260);
15009 }
15011 {
15012 continue;
15013 }
15015 if (waterStriderCageFrame[num40] == 0 && rand.Next(2) == 0)
15016 {
15018 continue;
15019 }
15020 if (waterStriderCageFrame[num40] == 8 && rand.Next(2) == 0)
15021 {
15023 continue;
15024 }
15026 {
15028 continue;
15029 }
15031 if (waterStriderCageFrame[num40] > 21)
15032 {
15034 }
15035 }
15037 if (fairyJarFrameCounter[0] > 5)
15038 {
15039 fairyJarFrameCounter[0] = 0;
15040 fairyJarFrame[0]++;
15041 if (fairyJarFrame[0] > 11)
15042 {
15043 fairyJarFrame[0] = 0;
15044 }
15045 }
15046 for (int num43 = 1; num43 < cageFrames; num43++)
15047 {
15048 int num44 = fairyJarFrame[0] + num43 % 12;
15049 if (num43 % 2 == 0)
15050 {
15051 num44++;
15052 }
15053 if (num43 % 5 == 0)
15054 {
15055 num44++;
15056 }
15057 if (num43 % 8 == 0)
15058 {
15059 num44++;
15060 }
15061 while (num44 >= 12)
15062 {
15063 num44 -= 12;
15064 }
15066 }
15067 for (int num45 = 0; num45 < cageFrames; num45++)
15068 {
15069 byte maxValue = 5;
15070 if (fishBowlFrameMode[num45] == 1)
15071 {
15072 if (rand.Next(900) == 0)
15073 {
15074 fishBowlFrameMode[num45] = (byte)rand.Next(maxValue);
15075 }
15077 if (fishBowlFrameCounter[num45] < 5)
15078 {
15079 continue;
15080 }
15082 if (fishBowlFrame[num45] == 10)
15083 {
15084 if (rand.Next(20) == 0)
15085 {
15086 fishBowlFrame[num45] = 11;
15088 }
15089 else
15090 {
15091 fishBowlFrame[num45] = 1;
15092 }
15093 }
15094 else
15095 {
15097 }
15098 }
15099 else if (fishBowlFrameMode[num45] == 2)
15100 {
15101 if (rand.Next(3600) == 0)
15102 {
15103 fishBowlFrameMode[num45] = (byte)rand.Next(maxValue);
15104 }
15106 if (fishBowlFrameCounter[num45] < 20)
15107 {
15108 continue;
15109 }
15111 if (fishBowlFrame[num45] == 10)
15112 {
15113 if (rand.Next(20) == 0)
15114 {
15115 fishBowlFrame[num45] = 11;
15117 }
15118 else
15119 {
15120 fishBowlFrame[num45] = 1;
15121 }
15122 }
15123 else
15124 {
15126 }
15127 }
15128 else if (fishBowlFrameMode[num45] == 3)
15129 {
15130 if (rand.Next(3600) == 0)
15131 {
15132 fishBowlFrameMode[num45] = (byte)rand.Next(maxValue);
15133 }
15135 if (fishBowlFrameCounter[num45] < rand.Next(5, 3600))
15136 {
15137 continue;
15138 }
15140 if (fishBowlFrame[num45] == 10)
15141 {
15142 if (rand.Next(20) == 0)
15143 {
15144 fishBowlFrame[num45] = 11;
15146 }
15147 else
15148 {
15149 fishBowlFrame[num45] = 1;
15150 }
15151 }
15152 else
15153 {
15155 }
15156 }
15157 else if (fishBowlFrame[num45] <= 10)
15158 {
15159 if (rand.Next(3600) == 0)
15160 {
15161 fishBowlFrameMode[num45] = (byte)rand.Next(maxValue);
15162 }
15164 if (fishBowlFrameCounter[num45] < 10)
15165 {
15166 continue;
15167 }
15169 if (fishBowlFrame[num45] == 10)
15170 {
15171 if (rand.Next(12) == 0)
15172 {
15173 fishBowlFrame[num45] = 11;
15174 }
15175 else
15176 {
15177 fishBowlFrame[num45] = 1;
15178 }
15179 }
15180 else
15181 {
15183 }
15184 }
15185 else if (fishBowlFrame[num45] == 12 || fishBowlFrame[num45] == 13)
15186 {
15188 if (fishBowlFrameCounter[num45] < 10)
15189 {
15190 continue;
15191 }
15194 if (fishBowlFrame[num45] > 13)
15195 {
15196 if (rand.Next(20) == 0)
15197 {
15198 fishBowlFrame[num45] = 14;
15199 }
15200 else
15201 {
15202 fishBowlFrame[num45] = 12;
15203 }
15204 }
15205 }
15206 else
15207 {
15208 if (fishBowlFrame[num45] < 11)
15209 {
15210 continue;
15211 }
15213 if (fishBowlFrameCounter[num45] >= 10)
15214 {
15217 if (fishBowlFrame[num45] > 16)
15218 {
15219 fishBowlFrame[num45] = 4;
15220 }
15221 }
15222 }
15223 }
15224 for (int num46 = 0; num46 < cageFrames; num46++)
15225 {
15227 if (lavaFishBowlFrameCounter[num46] > 4 + rand.Next(3))
15228 {
15231 if (lavaFishBowlFrame[num46] > 26)
15232 {
15234 }
15235 }
15236 }
15237 for (int num47 = 0; num47 < 9; num47++)
15238 {
15239 for (int num48 = 0; num48 < cageFrames; num48++)
15240 {
15242 if (rand.Next(3600) == 0)
15243 {
15244 butterflyCageMode[num47, num48] = (byte)rand.Next(5);
15245 if (rand.Next(2) == 0)
15246 {
15248 }
15249 }
15250 int num49 = rand.Next(3, 16);
15252 {
15253 num49 = 3;
15254 }
15256 {
15257 num49 = 5;
15258 }
15260 {
15261 num49 = 10;
15262 }
15264 {
15265 num49 = 15;
15266 }
15267 if (butterflyCageMode[num47, num48] >= 10)
15268 {
15269 if (butterflyCageFrame[num47, num48] <= 7)
15270 {
15272 {
15273 continue;
15274 }
15277 if (butterflyCageFrame[num47, num48] < 0)
15278 {
15280 }
15282 {
15283 continue;
15284 }
15285 if (rand.Next(20) == 0)
15286 {
15288 }
15289 else if (rand.Next(6) == 0)
15290 {
15291 if (butterflyCageMode[num47, num48] >= 10)
15292 {
15294 }
15295 else
15296 {
15298 }
15299 }
15300 }
15301 else
15302 {
15304 {
15305 continue;
15306 }
15309 if (butterflyCageFrame[num47, num48] < 8)
15310 {
15312 }
15314 {
15315 continue;
15316 }
15317 if (rand.Next(20) == 0)
15318 {
15320 }
15321 else if (rand.Next(6) == 0)
15322 {
15323 if (butterflyCageMode[num47, num48] >= 10)
15324 {
15326 }
15327 else
15328 {
15330 }
15331 }
15332 }
15333 }
15334 else if (butterflyCageFrame[num47, num48] <= 7)
15335 {
15337 {
15340 if (butterflyCageFrame[num47, num48] > 7)
15341 {
15343 }
15344 if ((butterflyCageFrame[num47, num48] == 1 || butterflyCageFrame[num47, num48] == 4 || butterflyCageFrame[num47, num48] == 6) && rand.Next(10) == 0)
15345 {
15347 }
15348 }
15349 }
15351 {
15354 if (butterflyCageFrame[num47, num48] > 15)
15355 {
15357 }
15358 if ((butterflyCageFrame[num47, num48] == 9 || butterflyCageFrame[num47, num48] == 12 || butterflyCageFrame[num47, num48] == 14) && rand.Next(10) == 0)
15359 {
15361 }
15362 }
15363 }
15364 }
15366 for (int num50 = 0; num50 < 3; num50++)
15367 {
15368 for (int num51 = 0; num51 < cageFrames; num51++)
15369 {
15371 if (jellyfishCageMode[num50, num51] == 0 && rand.Next(1800) == 0)
15372 {
15374 }
15375 if (jellyfishCageMode[num50, num51] == 2 && rand.Next(60) == 0)
15376 {
15378 }
15379 int num52 = 1;
15380 if (jellyfishCageMode[num50, num51] == 0)
15381 {
15382 num52 = rand.Next(10, 20);
15383 }
15384 if (jellyfishCageMode[num50, num51] == 1)
15385 {
15386 num52 = rand.Next(15, 25);
15387 }
15388 if (jellyfishCageMode[num50, num51] == 2)
15389 {
15390 num52 = rand.Next(4, 9);
15391 }
15392 if (jellyfishCageMode[num50, num51] == 3)
15393 {
15394 num52 = rand.Next(15, 25);
15395 }
15397 {
15400 if (jellyfishCageFrame[num50, num51] >= 4)
15401 {
15403 }
15404 }
15406 {
15409 if (jellyfishCageFrame[num50, num51] >= 7)
15410 {
15412 }
15413 }
15415 {
15418 if (jellyfishCageFrame[num50, num51] >= 9)
15419 {
15421 }
15422 }
15424 {
15427 if (jellyfishCageFrame[num50, num51] >= 10)
15428 {
15431 }
15432 }
15433 }
15434 }
15435 }
15436
15437 private static void UpdateOwlCageFrames()
15438 {
15439 for (int i = 0; i < cageFrames; i++)
15440 {
15442 }
15443 }
15444
15445 private static void UpdateDragonflyJarFrames()
15446 {
15447 for (int i = 0; i < dragonflyJarFrameCounter.GetLength(0); i++)
15448 {
15449 for (int j = 0; j < cageFrames; j++)
15450 {
15452 }
15453 }
15454 }
15455
15456 private static void UpdateOwlCageFrame(int[] frames, int[] frameCounters, int style)
15457 {
15458 if (frameCounters[style] % 40 != 0 || rand.Next(80) == 0)
15459 {
15460 frameCounters[style]++;
15461 }
15462 if ((frameCounters[style] + 1) % 40 == 39)
15463 {
15464 frameCounters[style] = 40 * rand.Next(4);
15465 }
15466 int num = frameCounters[style] % 40 / 10;
15467 int num2 = frameCounters[style] / 40;
15468 int num3 = 0;
15469 switch (num2)
15470 {
15471 case 0:
15472 if (num == 3)
15473 {
15474 num = 1;
15475 }
15476 num3 = num;
15477 break;
15478 case 1:
15479 if (num == 3)
15480 {
15481 num = 1;
15482 }
15483 num3 = 0;
15484 if (num != 0)
15485 {
15486 num3 = 8 - num;
15487 }
15488 break;
15489 case 2:
15490 num3 = 0;
15491 if (num != 0)
15492 {
15493 num3 = 7 + num;
15494 }
15495 break;
15496 case 3:
15497 num3 = 0;
15498 if (num != 0)
15499 {
15500 num3 = 11 + num;
15501 }
15502 break;
15503 }
15504 frames[style] = num3;
15505 }
15506
15507 private static void UpdateDragonflyJarFrame(int[,] frames, int[,] frameCounters, int style, int variation)
15508 {
15509 frameCounters[style, variation]++;
15510 switch (frames[style, variation])
15511 {
15512 case 0:
15513 if (frameCounters[style, variation] >= 300 && rand.Next(60) == 0)
15514 {
15515 frameCounters[style, variation] = 0;
15516 frames[style, variation] = rand.NextFromList<int>(1, 5, 9);
15517 }
15518 break;
15519 case 1:
15520 case 5:
15521 case 9:
15522 if (frameCounters[style, variation] >= 100)
15523 {
15524 frameCounters[style, variation] = 0;
15525 if (frames[style, variation] == 1)
15526 {
15527 frames[style, variation] = rand.NextFromList<int>(0, 5, 5, 9, 9);
15528 }
15529 else
15530 {
15531 frames[style, variation] = 1;
15532 }
15533 }
15534 else if (frameCounters[style, variation] >= 6)
15535 {
15536 frameCounters[style, variation] = 0;
15537 frames[style, variation]++;
15538 }
15539 break;
15540 case 2:
15541 case 3:
15542 case 4:
15543 case 6:
15544 case 7:
15545 case 8:
15546 case 10:
15547 case 11:
15548 case 12:
15549 {
15550 int num = frames[style, variation] - 1;
15551 int num2 = num % 4;
15552 num2--;
15553 int num3 = frameCounters[style, variation] / 4 % 4;
15554 if (num3 > 2)
15555 {
15556 num3 = 4 - num3;
15557 }
15558 int num4 = num - num2 + 1 + num3;
15559 frames[style, variation] = num4;
15560 if (frameCounters[style, variation] >= 40 && rand.Next(30) == 0)
15561 {
15562 frameCounters[style, variation] = 100;
15563 frames[style, variation] = num - num2 + 1 - 1;
15564 }
15565 break;
15566 }
15567 }
15568 }
15569
15570 public static void DoUpdate_AnimateItemIcons()
15571 {
15572 for (int i = 0; i < itemAnimationsRegistered.Count; i++)
15573 {
15574 int num = itemAnimationsRegistered[i];
15575 if (itemAnimations[num] != null)
15576 {
15577 itemAnimations[num].Update();
15578 }
15579 }
15580 }
15581
15582 public static void QueueMainThreadAction(Action action)
15583 {
15584 _mainThreadActions.Enqueue(action);
15585 }
15586
15587 private static void ConsumeAllMainThreadActions()
15588 {
15589 Action result;
15590 while (_mainThreadActions.TryDequeue(out result))
15591 {
15592 result();
15593 }
15594 }
15595
15596 protected override void Update(GameTime gameTime)
15597 {
15598 if (!IsEnginePreloaded)
15599 {
15600 IsEnginePreloaded = true;
15601 if (Main.OnEnginePreload != null)
15602 {
15604 }
15605 }
15607 {
15608 _isDrawingOrUpdating = true;
15611 if (netMode == 2)
15612 {
15613 for (int i = 0; i < 256; i++)
15614 {
15615 if (Netplay.Clients[i].Socket != null)
15616 {
15617 Netplay.Clients[i].Socket.SendQueuedPackets();
15618 }
15619 }
15620 }
15621 else if (netMode == 1)
15622 {
15623 Netplay.Connection.Socket.SendQueuedPackets();
15624 }
15625 _isDrawingOrUpdating = false;
15626 }
15627 base.Update(gameTime);
15629 if (GameAskedToQuit)
15630 {
15631 QuitGame();
15632 }
15633 }
15634
15636 {
15637 if (!inFancyUI)
15638 {
15639 float num = 0.02f;
15640 if (PlayerInput.Triggers.Current.ViewZoomIn)
15641 {
15642 GameZoomTarget = Utils.Clamp(GameZoomTarget + num, 1f, 2f);
15643 }
15644 if (PlayerInput.Triggers.Current.ViewZoomOut)
15645 {
15646 GameZoomTarget = Utils.Clamp(GameZoomTarget - num, 1f, 2f);
15647 }
15648 }
15649 }
15650
15652 {
15653 if (!dedServ && !instance.IsActive && _flashNotificationType.HasFlag(type))
15654 {
15656 {
15657 Platform.Get<IWindowService>().StartFlashingIcon(instance.Window);
15658 });
15659 }
15660 }
15661
15663 {
15665 if (showSplash)
15666 {
15667 UpdateAudio();
15668 GlobalTimeWrappedHourly = (float)(gameTime.TotalGameTime.TotalSeconds % 3600.0);
15671 return;
15672 }
15673 PartySky.MultipleSkyWorkaroundFix = true;
15674 LocalPlayer.cursorItemIconReversed = false;
15675 if (!GlobalTimerPaused)
15676 {
15677 GlobalTimeWrappedHourly = (float)(gameTime.TotalGameTime.TotalSeconds % 3600.0);
15678 }
15682 {
15684 }
15686 for (int num = DelayedProcesses.Count - 1; num >= 0; num--)
15687 {
15689 if (!enumerator.MoveNext())
15690 {
15692 }
15693 }
15694 if (!gameMenu || menuMode != 888)
15695 {
15696 MenuUI.SetState(null);
15697 }
15698 else
15699 {
15700 InGameUI.SetState(null);
15701 }
15703 if (!dedServ)
15704 {
15706 }
15711 {
15713 }
15715 {
15718 }
15719 if (CaptureManager.Instance.IsCapturing)
15720 {
15721 return;
15722 }
15723 if (ActivePlayerFileData != null)
15724 {
15725 ActivePlayerFileData.UpdatePlayTimer();
15726 }
15728 gameInactive = !base.IsActive;
15729 if (changeTheTitle)
15730 {
15731 changeTheTitle = false;
15732 SetTitle();
15733 }
15735 if (!WorldGen.gen)
15736 {
15737 WorldGen.destroyObject = false;
15738 }
15739 if (gameMenu)
15740 {
15741 mapFullscreen = false;
15742 }
15744 if (dedServ)
15745 {
15746 if (dedServFPS)
15747 {
15749 if (!fpsTimer.IsRunning)
15750 {
15751 fpsTimer.Restart();
15752 }
15753 if (fpsTimer.ElapsedMilliseconds >= 1000)
15754 {
15756 dedServCount2++;
15757 float num2 = (float)dedServCount1 / (float)dedServCount2;
15760 fpsTimer.Restart();
15761 }
15762 }
15763 else
15764 {
15765 if (fpsTimer.IsRunning)
15766 {
15767 fpsTimer.Stop();
15768 }
15770 }
15771 }
15773 if (!dedServ)
15774 {
15777 if (superFast)
15778 {
15779 base.IsFixedTimeStep = false;
15780 graphics.SynchronizeWithVerticalRetrace = false;
15781 }
15782 else
15783 {
15785 {
15786 if (base.IsActive)
15787 {
15788 base.IsFixedTimeStep = false;
15789 }
15790 else
15791 {
15792 base.IsFixedTimeStep = true;
15793 }
15794 }
15795 else
15796 {
15797 base.IsFixedTimeStep = true;
15798 graphics.SynchronizeWithVerticalRetrace = true;
15799 }
15800 graphics.SynchronizeWithVerticalRetrace = true;
15801 }
15802 if (showSplash)
15803 {
15804 return;
15805 }
15807 if (fpsTimer.ElapsedMilliseconds >= 1000)
15808 {
15809 if ((float)fpsCount >= 30f + 30f * gfxQuality)
15810 {
15812 gfxRate += 0.005f;
15813 }
15814 else if ((float)fpsCount < 29f + 30f * gfxQuality)
15815 {
15816 gfxRate = 0.01f;
15817 gfxQuality -= 0.1f;
15818 }
15819 if (gfxQuality < 0f)
15820 {
15821 gfxQuality = 0f;
15822 }
15823 if (gfxQuality > 1f)
15824 {
15825 gfxQuality = 1f;
15826 }
15827 if (maxQ && base.IsActive)
15828 {
15829 gfxQuality = 1f;
15830 maxQ = false;
15831 }
15834 fpsCount = 0;
15835 fpsTimer.Restart();
15838 uCount = 0;
15839 if (gfxQuality < 0.8f)
15840 {
15841 mapTimeMax = (int)((1f - gfxQuality) * 60f);
15842 }
15843 else
15844 {
15845 mapTimeMax = 0;
15846 }
15847 }
15849 {
15850 UpdateTimeAccumulator += gameTime.ElapsedGameTime.TotalSeconds;
15851 if (UpdateTimeAccumulator < 0.01666666753590107 && !superFast)
15852 {
15853 if (FrameSkipMode == FrameSkipMode.Subtle)
15854 {
15855 instance.SuppressDraw();
15856 }
15857 return;
15858 }
15859 gameTime = new GameTime(gameTime.TotalGameTime, new TimeSpan(166666L));
15860 UpdateTimeAccumulator -= 0.01666666753590107;
15861 UpdateTimeAccumulator = Math.Min(UpdateTimeAccumulator, 0.01666666753590107);
15862 }
15863 uCount++;
15864 drawSkip = false;
15865 PlayerInput.AllowExecutionOfGamepadInstructions = true;
15871 Overlays.Scene.Update(gameTime);
15873 UpdateAudio();
15876 if (teamCooldown > 0)
15877 {
15878 teamCooldown--;
15879 }
15882 if (qaStyle == 1)
15883 {
15884 gfxQuality = 1f;
15885 }
15886 else if (qaStyle == 2)
15887 {
15888 gfxQuality = 0.5f;
15889 }
15890 else if (qaStyle == 3)
15891 {
15892 gfxQuality = 0f;
15893 }
15894 maxDustToDraw = (int)(6000f * (gfxQuality * 0.7f + 0.3f));
15895 if ((double)gfxQuality < 0.9)
15896 {
15897 maxDustToDraw = (int)((float)maxDustToDraw * gfxQuality);
15898 }
15899 if (maxDustToDraw < 1000)
15900 {
15901 maxDustToDraw = 1000;
15902 }
15903 Gore.goreTime = (int)(600f * gfxQuality);
15904 if (!WorldGen.gen)
15905 {
15906 Liquid.cycles = (int)(17f - 10f * gfxQuality);
15907 Liquid.curMaxLiquid = (int)((double)Liquid.maxLiquid * 0.25 + (double)Liquid.maxLiquid * 0.75 * (double)gfxQuality);
15909 {
15910 Liquid.curMaxLiquid = (int)(2500f + 2500f * gfxQuality);
15911 }
15912 }
15913 if (superFast)
15914 {
15915 graphics.SynchronizeWithVerticalRetrace = false;
15916 drawSkip = false;
15917 }
15918 if ((double)gfxQuality < 0.2)
15919 {
15920 LegacyLighting.RenderPhases = 8;
15921 }
15922 else if ((double)gfxQuality < 0.4)
15923 {
15924 LegacyLighting.RenderPhases = 7;
15925 }
15926 else if ((double)gfxQuality < 0.6)
15927 {
15928 LegacyLighting.RenderPhases = 6;
15929 }
15930 else if ((double)gfxQuality < 0.8)
15931 {
15932 LegacyLighting.RenderPhases = 5;
15933 }
15934 else
15935 {
15936 LegacyLighting.RenderPhases = 4;
15937 }
15939 {
15940 Liquid.curMaxLiquid = Liquid.maxLiquid;
15942 {
15943 Liquid.curMaxLiquid = 5000;
15944 }
15945 Liquid.cycles = 1;
15946 }
15948 {
15949 WorldGen.tenthAnniversaryWorldGen = false;
15950 }
15952 {
15953 if (!gameMenu)
15954 {
15955 WorldGen.drunkWorldGen = false;
15956 WorldGen.remixWorldGen = false;
15957 logoRotation = 0f;
15958 logoRotationSpeed = 0f;
15959 logoScale = 1f;
15960 }
15961 }
15962 else if (gameMenu && Math.Abs(logoRotationSpeed) > 1000f)
15963 {
15964 logoRotation = 0f;
15965 logoRotationSpeed = 0f;
15966 logoScale = 1f;
15967 }
15969 hasFocus = base.IsActive;
15970 if (Platform.IsWindows)
15971 {
15972 Form form = Control.FromHandle(base.Window.Handle) as Form;
15973 bool num3 = form.WindowState == FormWindowState.Minimized;
15974 bool flag = Form.ActiveForm == form;
15975 hasFocus |= flag;
15976 if (num3)
15977 {
15978 hasFocus = false;
15979 }
15980 }
15981 if (!hasFocus && netMode == 0)
15982 {
15983 if (!Platform.IsOSX)
15984 {
15985 base.IsMouseVisible = true;
15986 }
15987 if (netMode != 2 && myPlayer >= 0)
15988 {
15989 player[myPlayer].delayUseItem = true;
15990 }
15991 mouseLeftRelease = false;
15992 mouseRightRelease = false;
15993 if (gameMenu)
15994 {
15995 UpdateMenu();
15996 }
15997 gamePaused = true;
15998 return;
15999 }
16000 if (!Platform.IsOSX)
16001 {
16002 base.IsMouseVisible = false;
16003 }
16005 if (!gamePaused)
16006 {
16008 }
16018 AnimateTiles();
16029 if ((timeForVisualEffects += 1.0) >= 216000.0)
16030 {
16032 }
16033 if (gameMenu)
16034 {
16035 UpdateMenu();
16036 if (netMode != 2)
16037 {
16038 return;
16039 }
16040 gamePaused = false;
16041 }
16042 if (!CanUpdateGameplay && netMode != 2)
16043 {
16044 return;
16045 }
16047 }
16049 if (netMode == 2)
16050 {
16052 }
16053 bool flag2 = base.IsActive;
16054 if (netMode == 1)
16055 {
16057 }
16058 if (CanPauseGame())
16059 {
16061 gamePaused = true;
16062 return;
16063 }
16064 gamePaused = false;
16065 if (Main.OnTickForInternalCodeOnly != null)
16066 {
16068 }
16069 if ((dedServ || (netMode != 1 && !gameMenu && !gamePaused)) && AmbienceServer != null)
16070 {
16072 }
16073 WorldGen.BackgroundsCache.UpdateFlashValues();
16074 if (LocalGolfState != null)
16075 {
16076 LocalGolfState.Update();
16077 }
16078 if ((flag2 || netMode == 1) && cloudAlpha > 0f)
16079 {
16080 Rain.MakeRain();
16081 }
16082 if (netMode != 1)
16083 {
16085 }
16086 for (int i = 0; i < dayRate; i++)
16087 {
16089 }
16091 Ambience();
16092 if (netMode != 2)
16093 {
16094 try
16095 {
16096 snowing();
16097 }
16098 catch
16099 {
16100 if (!ignoreErrors)
16101 {
16102 throw;
16103 }
16104 }
16106 }
16107 if (netMode != 2)
16108 {
16109 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
16110 {
16111 Star.UpdateStars();
16113 }
16114 else if (shimmerAlpha > 0f)
16115 {
16116 Star.UpdateStars();
16117 int num4 = rand.Next(numStars);
16118 if (rand.Next(90) == 0)
16119 {
16120 if (star[num4] != null && !star[num4].hidden && !star[num4].falling)
16121 {
16122 star[num4].Fall();
16123 }
16124 for (int j = 0; j < numStars; j++)
16125 {
16126 if (star[j].hidden)
16127 {
16128 Star.SpawnStars(j);
16129 }
16130 }
16131 }
16132 }
16133 }
16137 {
16139 }
16140 if (netMode != 2)
16141 {
16142 ChromaPainter.Update();
16143 }
16144 }
16145
16146 internal static void UpdateCreativeGameModeOverride()
16147 {
16150 if (gameMenu || !_currentGameModeInfo.IsJourneyMode)
16151 {
16152 return;
16153 }
16155 if (power.GetIsUnlocked())
16156 {
16157 float num = power.StrengthMultiplierToGiveNPCs;
16158 if (getGoodWorld)
16159 {
16160 num += 1f;
16161 }
16162 if (num >= 2f)
16163 {
16165 }
16166 if (num >= 3f)
16167 {
16169 }
16170 }
16171 }
16172
16173 private static void TryPlayingCreditsRoll()
16174 {
16175 if (!gameMenu && CanPlayCreditsRoll() && !SkyManager.Instance["CreditsRoll"].IsActive())
16176 {
16177 SkyManager.Instance.Activate("CreditsRoll", Vector2.Zero);
16178 }
16179 }
16180
16181 private static bool CanPauseGame()
16182 {
16183 bool flag = false;
16184 if (netMode == 0)
16185 {
16186 flag |= ingameOptionsWindow;
16187 flag |= InGameUI.IsVisible && (InGameUI.CurrentState == ManageControlsMenu || InGameUI.CurrentState == AchievementsMenu);
16188 if (autoPause)
16189 {
16190 flag |= playerInventory;
16191 flag |= LocalPlayer.sign >= 0;
16192 flag |= InGameUI.IsVisible;
16193 }
16194 }
16195 return flag;
16196 }
16197
16198 private static void DoUpdate_WhilePaused()
16199 {
16201 {
16202 Main.player[myPlayer].controlInv = PlayerInput.Triggers.Current.Inventory;
16203 Main.player[myPlayer].controlCreativeMenu = PlayerInput.Triggers.Current.OpenCreativePowersMenu;
16205 if (player.controlCreativeMenu)
16206 {
16207 if (player.releaseCreativeMenu)
16208 {
16209 player.ToggleCreativeMenu();
16210 }
16211 player.releaseCreativeMenu = false;
16212 }
16213 else
16214 {
16215 player.releaseCreativeMenu = true;
16216 }
16217 if (player.controlInv)
16218 {
16219 if (player.releaseInventory)
16220 {
16221 player.ToggleInv();
16222 }
16223 player.releaseInventory = false;
16224 }
16225 else
16226 {
16227 player.releaseInventory = true;
16228 }
16229 }
16230 if (playerInventory)
16231 {
16232 Main.player[myPlayer].RefreshInfoAccs();
16234 int num = PlayerInput.ScrollWheelDelta / 120;
16235 bool flag = true;
16236 if (recBigList)
16237 {
16238 int num2 = 42;
16239 int num3 = 340;
16240 int num4 = 310;
16242 int num5 = (screenWidth - num4 - 280) / num2;
16243 int num6 = (screenHeight - num3 - 20) / num2;
16245 {
16246 int num7 = Math.Sign(num);
16247 while (num != 0)
16248 {
16249 if (num < 0)
16250 {
16251 recStart -= num5;
16252 if (recStart < 0)
16253 {
16254 recStart = 0;
16255 }
16256 }
16257 else
16258 {
16259 recStart += num5;
16262 {
16264 }
16265 }
16266 num -= num7;
16267 }
16268 }
16270 }
16271 if (flag)
16272 {
16273 focusRecipe += num;
16275 {
16277 }
16278 if (focusRecipe < 0)
16279 {
16280 focusRecipe = 0;
16281 }
16282 }
16283 Main.player[myPlayer].dropItemCheck();
16284 }
16285 Main.player[myPlayer].head = Main.player[myPlayer].armor[0].headSlot;
16286 Main.player[myPlayer].body = Main.player[myPlayer].armor[1].bodySlot;
16287 Main.player[myPlayer].legs = Main.player[myPlayer].armor[2].legSlot;
16288 if (!Main.player[myPlayer].hostile)
16289 {
16290 if (Main.player[myPlayer].armor[10].headSlot >= 0)
16291 {
16292 Main.player[myPlayer].head = Main.player[myPlayer].armor[10].headSlot;
16293 }
16294 if (Main.player[myPlayer].armor[11].bodySlot >= 0)
16295 {
16296 Main.player[myPlayer].body = Main.player[myPlayer].armor[11].bodySlot;
16297 }
16298 if (Main.player[myPlayer].armor[12].legSlot >= 0)
16299 {
16300 Main.player[myPlayer].legs = Main.player[myPlayer].armor[12].legSlot;
16301 }
16302 }
16303 if (editSign)
16304 {
16305 if (Main.player[myPlayer].sign == -1)
16306 {
16307 editSign = false;
16308 }
16309 else
16310 {
16311 InputTextSign();
16312 }
16313 }
16314 else if (editChest && Main.player[myPlayer].chest == -1)
16315 {
16316 editChest = false;
16317 }
16318 Player.tileTargetX = (int)(((float)mouseX + screenPosition.X) / 16f);
16319 Player.tileTargetY = (int)(((float)mouseY + screenPosition.Y) / 16f);
16320 Main.player[myPlayer].LookForTileInteractions();
16321 Main.player[myPlayer].lastChest = Main.player[myPlayer].chest;
16322 if (playerInventory)
16323 {
16324 Main.player[myPlayer].AdjTiles();
16325 }
16326 }
16327
16328 private static void UpdateUIStates(GameTime gameTime)
16329 {
16330 if (MenuUI != null)
16331 {
16332 MenuUI.Update(gameTime);
16333 }
16334 if (InGameUI != null)
16335 {
16336 InGameUI.Update(gameTime);
16337 }
16338 CreativeMenu.Update(gameTime);
16339 BigBossProgressBar.Update();
16340 }
16341
16342 private void DoDebugFunctions()
16343 {
16344 }
16345
16351
16353 {
16354 }
16355
16356 private static void TrySyncingMyPlayer()
16357 {
16359 bool syncedAnyInventoryContents = false;
16360 for (int i = 0; i < 59; i++)
16361 {
16362 if (Main.player[myPlayer].inventory[i].IsNotTheSameAs(player.inventory[i]))
16363 {
16365 NetMessage.SendData(5, -1, -1, null, myPlayer, PlayerItemSlotID.Inventory0 + i, (int)Main.player[myPlayer].inventory[i].prefix);
16366 }
16367 }
16374 if (Main.player[myPlayer].trashItem.IsNotTheSameAs(player.trashItem))
16375 {
16377 NetMessage.SendData(5, -1, -1, null, myPlayer, PlayerItemSlotID.TrashItem, (int)Main.player[myPlayer].trashItem.prefix);
16378 }
16387 if (Main.player[myPlayer].chest != player.chest && Main.player[myPlayer].chest < 0 && player.chest >= 0)
16388 {
16389 if (Main.player[myPlayer].editedChestName)
16390 {
16391 if (chest[player.chest] != null)
16392 {
16393 NetMessage.SendData(33, -1, -1, NetworkText.FromLiteral(chest[player.chest].name), Main.player[myPlayer].chest, 1f);
16394 }
16395 else
16396 {
16397 NetMessage.SendData(33, -1, -1, null, Main.player[myPlayer].chest);
16398 }
16399 Main.player[myPlayer].editedChestName = false;
16400 }
16401 else
16402 {
16403 NetMessage.SendData(33, -1, -1, null, Main.player[myPlayer].chest);
16404 }
16405 }
16406 if (Main.player[myPlayer].talkNPC != player.talkNPC)
16407 {
16408 NetMessage.SendData(40, -1, -1, null, myPlayer);
16409 }
16410 if (false | (Main.player[myPlayer].voidLensChest != player.voidLensChest) | (Main.player[myPlayer].piggyBankProjTracker != player.piggyBankProjTracker))
16411 {
16412 NetMessage.SendData(142, -1, -1, null, myPlayer);
16413 }
16414 if (LocalPlayer.tileEntityAnchor.interactEntityID != player.tileEntityAnchor.interactEntityID && LocalPlayer.tileEntityAnchor.interactEntityID < 0)
16415 {
16416 NetMessage.SendData(122, -1, -1, null, -1, myPlayer);
16417 }
16418 bool flag = false;
16419 if ((byte)Main.player[myPlayer].zone1 != (byte)player.zone1)
16420 {
16421 flag = true;
16422 }
16423 if ((byte)Main.player[myPlayer].zone2 != (byte)player.zone2)
16424 {
16425 flag = true;
16426 }
16427 if ((byte)Main.player[myPlayer].zone3 != (byte)player.zone3)
16428 {
16429 flag = true;
16430 }
16431 if ((byte)Main.player[myPlayer].zone4 != (byte)player.zone4)
16432 {
16433 flag = true;
16434 }
16435 if ((byte)Main.player[myPlayer].zone5 != (byte)player.zone5)
16436 {
16437 flag = true;
16438 }
16439 if (flag)
16440 {
16441 NetMessage.SendData(36, -1, -1, null, myPlayer);
16442 }
16443 if (Main.player[myPlayer].statLife != player.statLife || Main.player[myPlayer].statLifeMax != player.statLifeMax)
16444 {
16445 Main.player[myPlayer].netLife = true;
16446 }
16447 if (Main.player[myPlayer].netLifeTime > 0)
16448 {
16449 Main.player[myPlayer].netLifeTime--;
16450 }
16451 else if (Main.player[myPlayer].netLife)
16452 {
16453 Main.player[myPlayer].netLife = false;
16454 Main.player[myPlayer].netLifeTime = 60;
16455 NetMessage.SendData(16, -1, -1, null, myPlayer);
16456 }
16457 if (Main.player[myPlayer].statMana != player.statMana || Main.player[myPlayer].statManaMax != player.statManaMax)
16458 {
16459 Main.player[myPlayer].netMana = true;
16460 }
16461 if (Main.player[myPlayer].netManaTime > 0)
16462 {
16463 Main.player[myPlayer].netManaTime--;
16464 }
16465 else if (Main.player[myPlayer].netMana)
16466 {
16467 Main.player[myPlayer].netMana = false;
16468 Main.player[myPlayer].netManaTime = 60;
16469 NetMessage.SendData(42, -1, -1, null, myPlayer);
16470 }
16471 bool flag2 = false;
16472 for (int j = 0; j < Player.maxBuffs; j++)
16473 {
16474 if (Main.player[myPlayer].buffType[j] != player.buffType[j])
16475 {
16476 flag2 = true;
16477 break;
16478 }
16479 }
16480 if (flag2)
16481 {
16482 NetMessage.SendData(50, -1, -1, null, myPlayer);
16483 NetMessage.SendData(13, -1, -1, null, myPlayer);
16484 }
16485 bool flag3 = false;
16486 if (Main.player[myPlayer].MinionRestTargetPoint != player.MinionRestTargetPoint)
16487 {
16488 flag3 = true;
16489 }
16490 if (flag3)
16491 {
16492 NetMessage.SendData(99, -1, -1, null, myPlayer);
16493 }
16494 bool flag4 = false;
16495 if (Main.player[myPlayer].MinionAttackTargetNPC != player.MinionAttackTargetNPC)
16496 {
16497 flag4 = true;
16498 }
16499 if (flag4)
16500 {
16501 NetMessage.SendData(115, -1, -1, null, myPlayer);
16502 }
16503 if (player.shieldRaised != Main.player[myPlayer].shieldRaised)
16504 {
16505 NetMessage.SendData(13, -1, -1, null, myPlayer);
16506 }
16508 {
16509 NetMessage.SendData(138);
16510 }
16511 clientPlayer = Main.player[myPlayer].clientClone();
16512 }
16513
16515 {
16516 for (int i = 0; i < my.Length; i++)
16517 {
16518 if (my[i].IsNotTheSameAs(other[i]))
16519 {
16521 NetMessage.SendData(5, -1, -1, null, myPlayer, slotOffset + i, (int)my[i].prefix);
16522 }
16523 }
16524 }
16525
16527 {
16529 }
16530
16532 {
16534 tileSolid[379] = false;
16535 int num = 0;
16536 int num2 = 0;
16537 sittingManager.ClearPlayerAnchors();
16538 sleepingManager.ClearPlayerAnchors();
16539 for (int i = 0; i < 255; i++)
16540 {
16541 if (!player[i].active)
16542 {
16543 continue;
16544 }
16545 try
16546 {
16547 player[i].Update(i);
16548 if (player[i].active)
16549 {
16550 num++;
16551 if (player[i].sleeping.FullyFallenAsleep)
16552 {
16553 num2++;
16554 }
16555 }
16556 }
16557 catch
16558 {
16559 if (!ignoreErrors)
16560 {
16561 throw;
16562 }
16563 }
16564 }
16565 CurrentFrameFlags.ActivePlayersCount = num;
16566 CurrentFrameFlags.SleepingPlayersCount = num2;
16567 if (netMode != 2)
16568 {
16569 int num3 = myPlayer;
16570 if (player[num3].creativeGodMode)
16571 {
16572 player[num3].statLife = player[num3].statLifeMax2;
16573 player[num3].statMana = player[num3].statManaMax2;
16574 player[num3].breath = player[num3].breathMax;
16575 }
16576 }
16578 NPC.RevengeManager.Update();
16579 if (netMode != 1)
16580 {
16581 if (remixWorld)
16582 {
16583 NPC.SetRemixHax();
16584 }
16585 try
16586 {
16587 NPC.SpawnNPC();
16588 }
16589 catch
16590 {
16591 }
16592 if (remixWorld)
16593 {
16595 }
16596 }
16597 if (netMode != 1)
16598 {
16600 }
16601 for (int j = 0; j < 255; j++)
16602 {
16603 player[j].nearbyActiveNPCs = 0f;
16604 player[j].townNPCs = 0f;
16605 }
16607 sittingManager.ClearNPCAnchors();
16608 sleepingManager.ClearNPCAnchors();
16609 NPC.taxCollector = false;
16613 if (netMode != 1)
16614 {
16615 BestiaryTracker.Sights.ScanWorldForFinds();
16616 }
16617 bool anyActiveBossNPC = false;
16618 if (NPC.offSetDelayTime > 0)
16619 {
16621 }
16622 if (remixWorld && NPC.empressRageMode && !NPC.AnyNPCs(636))
16623 {
16624 NPC.empressRageMode = false;
16625 }
16627 {
16628 for (int k = 0; k < 200; k++)
16629 {
16630 NPC nPC = npc[k];
16631 if (nPC.active && nPC.townNPC && nPC.type != 37 && nPC.type != 453 && nPC.type != 368)
16632 {
16633 nPC.StrikeNPCNoInteraction(9999, 10f, -nPC.direction);
16634 if (netMode == 2)
16635 {
16636 NetMessage.SendData(28, -1, -1, null, k, 9999f, 10f, -nPC.direction);
16637 }
16638 }
16639 }
16640 NPC.unlockedPartyGirlSpawn = false;
16641 NPC.unlockedPrincessSpawn = false;
16642 NPC.unlockedSlimeRainbowSpawn = false;
16643 NPC.unlockedSlimeGreenSpawn = false;
16644 afterPartyOfDoom = false;
16645 }
16646 if (NPC.brainOfGravity >= 0 && NPC.brainOfGravity < 200 && (!npc[NPC.brainOfGravity].active || npc[NPC.brainOfGravity].type != 266))
16647 {
16648 NPC.brainOfGravity = -1;
16649 }
16650 for (int l = 0; l < 200; l++)
16651 {
16652 if (ignoreErrors)
16653 {
16654 try
16655 {
16656 npc[l].UpdateNPC(l);
16657 if (npc[l].active && (npc[l].boss || NPCID.Sets.DangerThatPreventsOtherDangers[npc[l].type]))
16658 {
16659 anyActiveBossNPC = true;
16660 }
16661 }
16662 catch (Exception)
16663 {
16664 npc[l] = new NPC();
16665 }
16666 }
16667 else
16668 {
16669 npc[l].UpdateNPC(l);
16670 }
16671 }
16672 CurrentFrameFlags.AnyActiveBossNPC = anyActiveBossNPC;
16673 for (int m = 0; m < 600; m++)
16674 {
16675 if (ignoreErrors)
16676 {
16677 try
16678 {
16679 gore[m].Update();
16680 }
16681 catch
16682 {
16683 gore[m] = new Gore();
16684 }
16685 }
16686 else
16687 {
16688 gore[m].Update();
16689 }
16690 }
16692 CurrentFrameFlags.HadAnActiveInteractibleProjectile = false;
16694 for (int n = 0; n < 1000; n++)
16695 {
16697 if (ignoreErrors)
16698 {
16699 try
16700 {
16701 projectile[n].Update(n);
16702 }
16703 catch
16704 {
16705 projectile[n] = new Projectile();
16706 }
16707 }
16708 else
16709 {
16710 projectile[n].Update(n);
16711 }
16712 }
16716 Item.numberOfNewItems = 0;
16717 for (int num4 = 0; num4 < 400; num4++)
16718 {
16719 if (ignoreErrors)
16720 {
16721 try
16722 {
16723 item[num4].UpdateItem(num4);
16724 }
16725 catch
16726 {
16727 item[num4] = new Item();
16728 }
16729 }
16730 else
16731 {
16732 item[num4].UpdateItem(num4);
16733 }
16734 }
16735 if (ignoreErrors)
16736 {
16737 try
16738 {
16739 Dust.UpdateDust();
16740 }
16741 catch
16742 {
16743 for (int num5 = 0; num5 < 6000; num5++)
16744 {
16745 dust[num5] = new Dust();
16746 dust[num5].dustIndex = num5;
16747 }
16748 }
16749 }
16750 else
16751 {
16752 Dust.UpdateDust();
16753 }
16754 if (netMode != 2)
16755 {
16758 }
16759 if (ignoreErrors)
16760 {
16761 try
16762 {
16763 UpdateTime();
16764 }
16765 catch
16766 {
16767 checkForSpawns = 0;
16768 }
16769 }
16770 else
16771 {
16772 UpdateTime();
16773 }
16774 tileSolid[379] = true;
16775 if (gameMenu && netMode != 2)
16776 {
16777 return;
16778 }
16779 if (netMode != 1)
16780 {
16781 if (ignoreErrors)
16782 {
16783 try
16784 {
16787 }
16788 catch
16789 {
16790 }
16791 }
16792 else
16793 {
16796 }
16797 }
16798 if (ignoreErrors)
16799 {
16800 try
16801 {
16802 if (netMode == 2)
16803 {
16804 UpdateServer();
16805 }
16806 if (netMode == 1)
16807 {
16808 UpdateClient();
16809 }
16810 }
16811 catch
16812 {
16813 _ = netMode;
16814 _ = 2;
16815 }
16816 }
16817 else
16818 {
16819 if (netMode == 2)
16820 {
16821 UpdateServer();
16822 }
16823 if (netMode == 1)
16824 {
16825 UpdateClient();
16826 }
16827 }
16828 chatMonitor.Update();
16829 upTimer = (float)sw.Elapsed.TotalMilliseconds;
16830 if (upTimerMaxDelay > 0f)
16831 {
16832 upTimerMaxDelay -= 1f;
16833 }
16834 else
16835 {
16836 upTimerMax = 0f;
16837 }
16838 if (upTimer > upTimerMax)
16839 {
16841 upTimerMaxDelay = 400f;
16842 }
16847 if (cameraLerp > 0f)
16848 {
16851 {
16852 cameraLerp += (float)((cameraLerpTimer - cameraLerpTimeToggle) / 3 + 1) * 0.001f;
16853 }
16854 if (cameraLerp > 1f)
16855 {
16856 cameraLerp = 1f;
16857 }
16858 }
16859 }
16860
16861 private static void CheckBossIndexes()
16862 {
16864 {
16865 wofNPCIndex = -1;
16866 }
16868 {
16869 NPC.golemBoss = -1;
16870 }
16872 {
16873 NPC.deerclopsBoss = -1;
16874 }
16876 {
16877 NPC.plantBoss = -1;
16878 }
16880 {
16881 NPC.crimsonBoss = -1;
16882 }
16883 }
16884
16885 public static bool IsNPCActiveAndOneOfTypes(int npcIndex, params int[] types)
16886 {
16887 if (npcIndex < 0)
16888 {
16889 return false;
16890 }
16891 NPC nPC = npc[npcIndex];
16892 if (!nPC.active)
16893 {
16894 return false;
16895 }
16896 for (int i = 0; i < types.Length; i++)
16897 {
16898 if (nPC.type == types[i])
16899 {
16900 return true;
16901 }
16902 }
16903 return false;
16904 }
16905
16906 private static void UpdateOldNPCShop()
16907 {
16908 if (npcShop != oldNPCShop)
16909 {
16911 shopSellbackHelper.Clear();
16912 }
16913 }
16914
16915 private static void DoUpdate_AnimateCursorColors()
16916 {
16917 CursorColor();
16919 if (mouseTextColor >= byte.MaxValue)
16920 {
16922 }
16923 if (mouseTextColor <= 190)
16924 {
16926 }
16927 masterColor += (float)masterColorDir * 0.05f;
16928 if (masterColor > 1f)
16929 {
16930 masterColor = 1f;
16931 masterColorDir = -1;
16932 }
16933 if (masterColor < 0f)
16934 {
16935 masterColor = 0f;
16936 masterColorDir = 1;
16937 }
16938 }
16939
16940 private static void DoUpdate_AnimateTileGlows()
16941 {
16942 demonTorch += (float)demonTorchDir * 0.01f;
16943 if (demonTorch > 1f)
16944 {
16945 demonTorch = 1f;
16946 demonTorchDir = -1;
16947 }
16948 if (demonTorch < 0f)
16949 {
16950 demonTorch = 0f;
16951 demonTorchDir = 1;
16952 }
16953 martianLight += (float)martianLightDir * 0.015f;
16954 if (martianLight > 1f)
16955 {
16956 martianLight = 1f;
16957 martianLightDir = -1;
16958 }
16959 if (martianLight < 0f)
16960 {
16961 martianLight = 0f;
16962 martianLightDir = 1;
16963 }
16964 }
16965
16966 private static void DoUpdate_Enter_ToggleChat()
16967 {
16968 if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter) && !keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) && !keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightAlt) && hasFocus)
16969 {
16970 if (chatRelease && !drawingPlayerChat && !editSign && !editChest && !gameMenu && !keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape))
16971 {
16974 chatText = "";
16975 }
16976 chatRelease = false;
16977 }
16978 else
16979 {
16980 chatRelease = true;
16981 }
16982 }
16983
16984 public static void OpenPlayerChat()
16985 {
16987 {
16988 drawingPlayerChat = true;
16989 clrInput();
16990 }
16991 }
16992
16993 public static void ClosePlayerChat()
16994 {
16995 drawingPlayerChat = false;
16996 PlayerInput.WritingText = false;
16997 player[myPlayer].releaseHook = false;
16998 player[myPlayer].releaseThrow = false;
16999 }
17000
17001 private static void DoUpdate_HandleChat()
17002 {
17004 {
17005 drawingPlayerChat = false;
17006 return;
17007 }
17008 if (editSign)
17009 {
17010 drawingPlayerChat = false;
17011 }
17013 {
17014 drawingPlayerChat = false;
17015 }
17016 if (!drawingPlayerChat)
17017 {
17018 chatMonitor.ResetOffset();
17019 return;
17020 }
17021 int linesOffset = 0;
17022 if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Up))
17023 {
17024 linesOffset = 1;
17025 }
17026 else if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Down))
17027 {
17028 linesOffset = -1;
17029 }
17030 chatMonitor.Offset(linesOffset);
17031 if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape))
17032 {
17033 drawingPlayerChat = false;
17034 }
17035 string text = chatText;
17037 int num = 470;
17038 num = (int)((float)screenWidth * (1f / UIScale)) - 330;
17039 if (text != chatText)
17040 {
17042 {
17043 int num2 = Math.Max(0, (int)(x - (float)num) / 100);
17044 chatText = chatText.Substring(0, chatText.Length - 1 - num2);
17045 }
17046 }
17047 if (text != chatText)
17048 {
17050 }
17051 if (!inputTextEnter || !chatRelease)
17052 {
17053 return;
17054 }
17055 if (chatText != "")
17056 {
17057 ChatMessage message = ChatManager.Commands.CreateOutgoingMessage(chatText);
17058 if (netMode == 1)
17059 {
17061 }
17062 else if (netMode == 0)
17063 {
17064 ChatManager.Commands.ProcessIncomingMessage(message, myPlayer);
17065 }
17066 }
17067 chatText = "";
17069 chatRelease = false;
17071 }
17072
17084
17086 {
17087 if ((keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) || keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightAlt)) && keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter) && hasFocus)
17088 {
17089 if (toggleFullscreen)
17090 {
17092 chatRelease = false;
17093 }
17094 toggleFullscreen = false;
17095 }
17096 else
17097 {
17098 toggleFullscreen = true;
17099 }
17100 }
17101
17102 private static void DoUpdate_F11_ToggleUI()
17103 {
17104 if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F11))
17105 {
17106 if (releaseUI)
17107 {
17108 if (hideUI)
17109 {
17110 hideUI = false;
17111 }
17112 else
17113 {
17114 hideUI = true;
17115 }
17117 }
17118 releaseUI = false;
17119 }
17120 else
17121 {
17122 releaseUI = true;
17123 }
17124 }
17125
17127 {
17128 if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F7) && !drawingPlayerChat && !editSign && !editChest)
17129 {
17130 if (drawRelease)
17131 {
17133 if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) || keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightAlt))
17134 {
17135 TimeLogger.Start();
17136 }
17137 else if (drawDiag)
17138 {
17139 drawDiag = false;
17140 }
17141 else
17142 {
17143 drawDiag = true;
17144 }
17145 }
17146 drawRelease = false;
17147 }
17148 else
17149 {
17150 drawRelease = true;
17151 }
17152 }
17153
17155 {
17156 if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F8) && !drawingPlayerChat && !editSign && !editChest)
17157 {
17158 if (netRelease)
17159 {
17162 }
17163 netRelease = false;
17164 }
17165 else
17166 {
17167 netRelease = true;
17168 }
17169 }
17170
17171 private static void DoUpdate_F9_ToggleLighting()
17172 {
17173 if (keyState.PressingShift() && keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F9) && !drawingPlayerChat && !editSign && !editChest)
17174 {
17175 if (RGBRelease)
17176 {
17179 }
17180 RGBRelease = false;
17181 }
17182 else
17183 {
17184 RGBRelease = true;
17185 }
17186 }
17187
17188 private static void DoUpdate_F10_ToggleFPS()
17189 {
17190 if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F10) && !drawingPlayerChat && !editSign && !editChest)
17191 {
17192 if (frameRelease)
17193 {
17195 if (showFrameRate)
17196 {
17197 showFrameRate = false;
17198 }
17199 else
17200 {
17201 showFrameRate = true;
17202 }
17203 }
17204 frameRelease = false;
17205 }
17206 else
17207 {
17208 frameRelease = true;
17209 }
17210 }
17211
17212 private static void AnimateTiles()
17213 {
17214 tileFrameCounter[12]++;
17215 if (tileFrameCounter[12] > 5)
17216 {
17217 tileFrameCounter[12] = 0;
17218 tileFrame[12]++;
17219 if (tileFrame[12] >= 10)
17220 {
17221 tileFrame[12] = 0;
17222 }
17223 }
17225 tileFrame[665] = tileFrame[12];
17226 tileFrameCounter[639]++;
17227 if (tileFrameCounter[639] > 5)
17228 {
17229 tileFrameCounter[639] = 0;
17230 tileFrame[639]++;
17231 if (tileFrame[639] >= 10)
17232 {
17233 tileFrame[639] = 0;
17234 }
17235 }
17236 tileFrameCounter[17]++;
17237 if (tileFrameCounter[17] > 5)
17238 {
17239 tileFrameCounter[17] = 0;
17240 tileFrame[17]++;
17241 if (tileFrame[17] >= 12)
17242 {
17243 tileFrame[17] = 0;
17244 }
17245 }
17246 if (++tileFrameCounter[133] >= 4)
17247 {
17248 tileFrameCounter[133] = 0;
17249 if (++tileFrame[133] >= 6)
17250 {
17251 tileFrame[133] = 0;
17252 }
17253 }
17254 tileFrameCounter[31]++;
17255 if (tileFrameCounter[31] > 10)
17256 {
17257 tileFrameCounter[31] = 0;
17258 tileFrame[31]++;
17259 if (tileFrame[31] > 1)
17260 {
17261 tileFrame[31] = 0;
17262 }
17263 }
17264 tileFrameCounter[77]++;
17265 if (tileFrameCounter[77] > 5)
17266 {
17267 tileFrameCounter[77] = 0;
17268 tileFrame[77]++;
17269 if (tileFrame[77] >= 12)
17270 {
17271 tileFrame[77] = 0;
17272 }
17273 }
17274 tileFrameCounter[106]++;
17275 if (tileFrameCounter[106] > 4)
17276 {
17277 tileFrameCounter[106] = 0;
17278 tileFrame[106]++;
17279 if (tileFrame[106] >= 2)
17280 {
17281 tileFrame[106] = 0;
17282 }
17283 }
17284 tileFrameCounter[207]++;
17285 if (tileFrameCounter[207] > 4)
17286 {
17287 tileFrameCounter[207] = 0;
17288 tileFrame[207]++;
17289 if (tileFrame[207] >= 6)
17290 {
17291 tileFrame[207] = 0;
17292 }
17293 }
17294 tileFrameCounter[215]++;
17295 if (tileFrameCounter[215] >= 4)
17296 {
17297 tileFrameCounter[215] = 0;
17298 tileFrame[215]++;
17299 if (tileFrame[215] >= 8)
17300 {
17301 tileFrame[215] = 0;
17302 }
17303 }
17304 tileFrameCounter[592]++;
17305 if (tileFrameCounter[592] >= 5)
17306 {
17307 tileFrameCounter[592] = 0;
17308 tileFrame[592]++;
17309 if (tileFrame[592] >= 8)
17310 {
17311 tileFrame[592] = 0;
17312 }
17313 }
17314 tileFrameCounter[217]++;
17315 if (tileFrameCounter[217] > 4)
17316 {
17317 tileFrameCounter[217] = 0;
17318 tileFrame[217]++;
17319 if (tileFrame[217] >= 5)
17320 {
17321 tileFrame[217] = 0;
17322 }
17323 }
17324 tileFrameCounter[218]++;
17325 if (tileFrameCounter[218] > 4)
17326 {
17327 tileFrameCounter[218] = 0;
17328 tileFrame[218]++;
17329 if (tileFrame[218] >= 2)
17330 {
17331 tileFrame[218] = 0;
17332 }
17333 }
17334 tileFrameCounter[219]++;
17335 if (tileFrameCounter[219] > 4)
17336 {
17337 tileFrameCounter[219] = 0;
17338 tileFrame[219]++;
17339 if (tileFrame[219] >= 10)
17340 {
17341 tileFrame[219] = 0;
17342 }
17343 }
17344 tileFrameCounter[642]++;
17345 if (tileFrameCounter[642] > 4)
17346 {
17347 tileFrameCounter[642] = 0;
17348 tileFrame[642]++;
17349 if (tileFrame[642] >= 6)
17350 {
17351 tileFrame[642] = 0;
17352 }
17353 }
17354 tileFrameCounter[220]++;
17355 if (tileFrameCounter[220] > 4)
17356 {
17357 tileFrameCounter[220] = 0;
17358 tileFrame[220]++;
17359 if (tileFrame[220] >= 4)
17360 {
17361 tileFrame[220] = 0;
17362 }
17363 }
17364 tileFrameCounter[231]++;
17365 if (tileFrameCounter[231] > 16)
17366 {
17367 tileFrameCounter[231] = 0;
17368 tileFrame[231]++;
17369 if (tileFrame[231] >= 7)
17370 {
17371 tileFrame[231] = 0;
17372 }
17373 }
17374 tileFrameCounter[235]++;
17375 if (tileFrameCounter[235] > 20)
17376 {
17377 tileFrameCounter[235] = 0;
17378 tileFrame[235]++;
17379 if (tileFrame[235] >= 4)
17380 {
17381 tileFrame[235] = 0;
17382 }
17383 }
17384 tileFrameCounter[238]++;
17385 if (tileFrameCounter[238] > 20)
17386 {
17387 tileFrameCounter[238] = 0;
17388 tileFrame[238]++;
17389 if (tileFrame[238] >= 4)
17390 {
17391 tileFrame[238] = 0;
17392 }
17393 }
17394 tileFrameCounter[243]++;
17395 if (tileFrameCounter[243] > 4)
17396 {
17397 tileFrameCounter[243] = 0;
17398 tileFrame[243]++;
17399 if (tileFrame[243] >= 6)
17400 {
17401 tileFrame[243] = 0;
17402 }
17403 }
17404 tileFrameCounter[244]++;
17405 if (tileFrameCounter[244] > 4)
17406 {
17407 tileFrameCounter[244] = 0;
17408 tileFrame[244]++;
17409 if (tileFrame[244] >= 6)
17410 {
17411 tileFrame[244] = 0;
17412 }
17413 }
17414 tileFrameCounter[247]++;
17415 if (tileFrameCounter[247] > 4)
17416 {
17417 tileFrameCounter[247] = 0;
17418 tileFrame[247]++;
17419 if (tileFrame[247] > 7)
17420 {
17421 tileFrame[247] = 0;
17422 }
17423 }
17424 tileFrameCounter[96]++;
17425 if (tileFrameCounter[96] > 4)
17426 {
17427 tileFrameCounter[96] = 0;
17428 tileFrame[96]++;
17429 if (tileFrame[96] > 3)
17430 {
17431 tileFrame[96] = 0;
17432 }
17433 }
17434 tileFrameCounter[171]++;
17435 if (tileFrameCounter[171] > 16)
17436 {
17437 tileFrameCounter[171] = 0;
17438 tileFrame[171]++;
17439 if (tileFrame[171] > 3)
17440 {
17441 tileFrame[171] = 0;
17442 }
17443 }
17444 tileFrameCounter[270]++;
17445 if (tileFrameCounter[270] > 8)
17446 {
17447 tileFrameCounter[270] = 0;
17448 tileFrame[270]++;
17449 if (tileFrame[270] > 5)
17450 {
17451 tileFrame[270] = 0;
17452 }
17453 }
17454 int num = tileFrame[270];
17455 tileFrame[271] = num;
17456 tileFrame[581] = num;
17457 tileFrameCounter[660]++;
17458 if (tileFrameCounter[660] > 8)
17459 {
17460 tileFrameCounter[660] = 0;
17461 tileFrame[660]++;
17462 if (tileFrame[660] > 4)
17463 {
17464 tileFrame[660] = 0;
17465 }
17466 }
17467 tileFrameCounter[272]++;
17468 if (tileFrameCounter[272] >= 10)
17469 {
17470 tileFrameCounter[272] = 0;
17471 tileFrame[272]++;
17472 if (tileFrame[272] > 1)
17473 {
17474 tileFrame[272] = 0;
17475 }
17476 }
17477 tileFrameCounter[300]++;
17478 if (tileFrameCounter[300] >= 5)
17479 {
17480 tileFrameCounter[300] = 0;
17481 tileFrame[300]++;
17482 if (tileFrame[300] > 6)
17483 {
17484 tileFrame[300] = 0;
17485 }
17486 }
17487 tileFrameCounter[301]++;
17488 if (tileFrameCounter[301] >= 5)
17489 {
17490 tileFrameCounter[301] = 0;
17491 tileFrame[301]++;
17492 if (tileFrame[301] > 7)
17493 {
17494 tileFrame[301] = 0;
17495 }
17496 }
17497 tileFrameCounter[302]++;
17498 if (tileFrameCounter[302] >= 5)
17499 {
17500 tileFrameCounter[302] = 0;
17501 tileFrame[302]++;
17502 if (tileFrame[302] > 3)
17503 {
17504 tileFrame[302] = 0;
17505 }
17506 }
17507 tileFrameCounter[303]++;
17508 if (tileFrameCounter[303] >= 5)
17509 {
17510 tileFrameCounter[303] = 0;
17511 tileFrame[303]++;
17512 if (tileFrame[303] > 4)
17513 {
17514 tileFrame[303] = 0;
17515 }
17516 }
17517 tileFrameCounter[305]++;
17518 if (tileFrameCounter[305] >= 5)
17519 {
17520 tileFrameCounter[305] = 0;
17521 tileFrame[305]++;
17522 if (tileFrame[305] > 11)
17523 {
17524 tileFrame[305] = 0;
17525 }
17526 }
17527 tileFrameCounter[306]++;
17528 if (tileFrameCounter[306] >= 5)
17529 {
17530 tileFrameCounter[306] = 0;
17531 tileFrame[306]++;
17532 if (tileFrame[306] > 11)
17533 {
17534 tileFrame[306] = 0;
17535 }
17536 }
17537 tileFrameCounter[307]++;
17538 if (tileFrameCounter[307] >= 5)
17539 {
17540 tileFrameCounter[307] = 0;
17541 tileFrame[307]++;
17542 if (tileFrame[307] > 1)
17543 {
17544 tileFrame[307] = 0;
17545 }
17546 }
17547 tileFrameCounter[308]++;
17548 if (tileFrameCounter[308] >= 5)
17549 {
17550 tileFrameCounter[308] = 0;
17551 tileFrame[308]++;
17552 if (tileFrame[308] > 7)
17553 {
17554 tileFrame[308] = 0;
17555 }
17556 }
17557 tileFrameCounter[314]++;
17558 if (tileFrameCounter[314] >= 10)
17559 {
17560 tileFrameCounter[314] = 0;
17561 tileFrame[314]++;
17562 if (tileFrame[314] > 4)
17563 {
17564 tileFrame[314] = 0;
17565 }
17566 }
17567 tileFrameCounter[326]++;
17568 if (tileFrameCounter[326] >= 5)
17569 {
17570 tileFrameCounter[326] = 0;
17571 tileFrame[326]++;
17572 if (tileFrame[326] > 7)
17573 {
17574 tileFrame[326] = 0;
17575 }
17576 }
17577 tileFrameCounter[327]++;
17578 if (tileFrameCounter[327] >= 10)
17579 {
17580 tileFrameCounter[327] = 0;
17581 tileFrame[327]++;
17582 if (tileFrame[327] > 7)
17583 {
17584 tileFrame[327] = 0;
17585 }
17586 }
17587 tileFrameCounter[345]++;
17588 if (tileFrameCounter[345] >= 10)
17589 {
17590 tileFrameCounter[345] = 0;
17591 tileFrame[345]++;
17592 if (tileFrame[345] > 7)
17593 {
17594 tileFrame[345] = 0;
17595 }
17596 }
17597 tileFrameCounter[458]++;
17598 if (tileFrameCounter[458] >= 10)
17599 {
17600 tileFrameCounter[458] = 0;
17601 tileFrame[458]++;
17602 if (tileFrame[458] > 7)
17603 {
17604 tileFrame[458] = 0;
17605 }
17606 }
17607 tileFrameCounter[459]++;
17608 if (tileFrameCounter[459] >= 10)
17609 {
17610 tileFrameCounter[459] = 0;
17611 tileFrame[459]++;
17612 if (tileFrame[459] > 7)
17613 {
17614 tileFrame[459] = 0;
17615 }
17616 }
17617 tileFrameCounter[336]++;
17618 if (tileFrameCounter[336] >= 5)
17619 {
17620 tileFrameCounter[336] = 0;
17621 tileFrame[336]++;
17622 if (tileFrame[336] > 3)
17623 {
17624 tileFrame[336] = 0;
17625 }
17626 }
17627 tileFrameCounter[328]++;
17628 if (tileFrameCounter[328] >= 5)
17629 {
17630 tileFrameCounter[328] = 0;
17631 tileFrame[328]++;
17632 if (tileFrame[328] > 7)
17633 {
17634 tileFrame[328] = 0;
17635 }
17636 }
17637 tileFrameCounter[329]++;
17638 if (tileFrameCounter[329] >= 5)
17639 {
17640 tileFrameCounter[329] = 0;
17641 tileFrame[329]++;
17642 if (tileFrame[329] > 7)
17643 {
17644 tileFrame[329] = 0;
17645 }
17646 }
17647 int num2 = 20;
17648 if (++tileFrameCounter[507] >= num2 * 8)
17649 {
17650 tileFrameCounter[507] = 0;
17651 }
17652 if (++tileFrameCounter[508] >= num2 * 8)
17653 {
17654 tileFrameCounter[508] = 0;
17655 }
17656 for (int i = 340; i <= 344; i++)
17657 {
17659 if (tileFrameCounter[i] >= 5)
17660 {
17661 tileFrameCounter[i] = 0;
17662 tileFrame[i]++;
17663 if (tileFrame[i] > 3)
17664 {
17665 tileFrame[i] = 0;
17666 }
17667 }
17668 }
17669 tileFrameCounter[351]++;
17670 if (tileFrameCounter[351] >= 5)
17671 {
17672 tileFrameCounter[351] = 0;
17673 tileFrame[351]++;
17674 if (tileFrame[351] > 2)
17675 {
17676 tileFrame[351] = 0;
17677 }
17678 }
17679 tileFrameCounter[354]++;
17680 if (tileFrameCounter[354] >= 5)
17681 {
17682 tileFrameCounter[354] = 0;
17683 tileFrame[354]++;
17684 if (tileFrame[354] >= 8)
17685 {
17686 tileFrame[354] = 0;
17687 }
17688 }
17689 tileFrame[355] = tileFrame[354];
17690 tileFrameCounter[377]++;
17691 if (tileFrameCounter[377] >= 5)
17692 {
17693 tileFrameCounter[377] = 0;
17694 tileFrame[377]++;
17695 if (tileFrame[377] >= 4)
17696 {
17697 tileFrame[377] = 0;
17698 }
17699 }
17700 tileFrameCounter[379]++;
17701 if (tileFrameCounter[379] >= 10)
17702 {
17703 tileFrameCounter[379] = 0;
17704 tileFrame[379]++;
17705 if (tileFrame[379] >= 4)
17706 {
17707 tileFrame[379] = 0;
17708 }
17709 }
17710 if (++tileFrameCounter[390] >= 8)
17711 {
17712 tileFrameCounter[390] = 0;
17713 if (++tileFrame[390] >= 7)
17714 {
17715 tileFrame[390] = 0;
17716 }
17717 }
17718 if (++tileFrameCounter[228] >= 5)
17719 {
17720 tileFrameCounter[228] = 0;
17721 if (++tileFrame[228] >= 3)
17722 {
17723 tileFrame[228] = 0;
17724 }
17725 }
17726 if (++tileFrameCounter[405] >= 5)
17727 {
17728 tileFrameCounter[405] = 0;
17729 if (++tileFrame[405] >= 8)
17730 {
17731 tileFrame[405] = 0;
17732 }
17733 }
17734 if (++tileFrameCounter[406] >= 8)
17735 {
17736 tileFrameCounter[406] = 0;
17737 if (++tileFrame[406] >= 6)
17738 {
17739 tileFrame[406] = 0;
17740 }
17741 }
17742 if (++tileFrameCounter[452] >= 5)
17743 {
17744 tileFrameCounter[452] = 0;
17745 if (++tileFrame[452] >= 15)
17746 {
17747 tileFrame[452] = 0;
17748 }
17749 }
17750 if (++tileFrameCounter[455] >= 5)
17751 {
17752 tileFrameCounter[455] = 0;
17753 if (++tileFrame[455] >= 6)
17754 {
17755 tileFrame[455] = 0;
17756 }
17757 }
17758 if (++tileFrameCounter[499] >= 5)
17759 {
17760 tileFrameCounter[499] = 0;
17761 if (++tileFrame[499] >= 8)
17762 {
17763 tileFrame[499] = 0;
17764 }
17765 }
17766 if (++tileFrameCounter[129] >= 8)
17767 {
17768 tileFrameCounter[129] = 0;
17769 if (++tileFrame[129] >= 6)
17770 {
17771 tileFrame[129] = 0;
17772 }
17773 }
17774 tileFrameCounter[453] += ((!WorldGen.gen) ? rand.Next(3) : 0);
17775 if (++tileFrameCounter[453] >= 60)
17776 {
17777 tileFrameCounter[453] = 0;
17778 }
17779 if (++tileFrame[412] >= 240)
17780 {
17781 tileFrame[412] = 0;
17782 }
17783 tileFrameCounter[456] += ((!WorldGen.gen) ? rand.Next(3) : 0);
17784 if (++tileFrameCounter[456] >= 80)
17785 {
17786 tileFrameCounter[456] = 0;
17787 }
17788 if (++tileFrame[456] >= 240)
17789 {
17790 tileFrame[456] = 0;
17791 }
17792 if (++tileFrameCounter[410] >= 8)
17793 {
17794 tileFrameCounter[410] = 0;
17795 if (++tileFrame[410] >= 8)
17796 {
17797 tileFrame[410] = 0;
17798 }
17799 }
17800 if (++tileFrameCounter[480] >= 8)
17801 {
17802 tileFrameCounter[480] = 0;
17803 if (++tileFrame[480] >= 8)
17804 {
17805 tileFrame[480] = 0;
17806 }
17807 }
17808 if (++tileFrameCounter[509] >= 8)
17809 {
17810 tileFrameCounter[509] = 0;
17811 if (++tileFrame[509] >= 8)
17812 {
17813 tileFrame[509] = 0;
17814 }
17815 }
17816 if (++tileFrameCounter[657] >= 8)
17817 {
17818 tileFrameCounter[657] = 0;
17819 if (++tileFrame[657] >= 8)
17820 {
17821 tileFrame[657] = 0;
17822 }
17823 }
17824 if (++tileFrameCounter[658] >= 4)
17825 {
17826 tileFrameCounter[658] = 0;
17827 if (++tileFrame[658] >= 10)
17828 {
17829 tileFrame[658] = 0;
17830 }
17831 }
17832 if (++tileFrameCounter[421] >= 4)
17833 {
17834 tileFrameCounter[421] = 0;
17835 if (++tileFrame[421] >= 4)
17836 {
17837 tileFrame[421] = 0;
17838 }
17839 }
17840 if (++tileFrameCounter[422] >= 4)
17841 {
17842 tileFrameCounter[422] = 0;
17843 if (--tileFrame[422] < 0)
17844 {
17845 tileFrame[422] = 3;
17846 }
17847 }
17848 if (++tileFrameCounter[463] >= 10)
17849 {
17850 tileFrameCounter[463] = 0;
17851 if (++tileFrame[463] >= 6)
17852 {
17853 tileFrame[463] = 0;
17854 }
17855 }
17856 if (++tileFrameCounter[464] >= 5)
17857 {
17858 tileFrameCounter[464] = 0;
17859 if (++tileFrame[464] >= 23)
17860 {
17861 tileFrame[464] = 0;
17862 }
17863 }
17864 if (++tileFrameCounter[485] >= 20)
17865 {
17866 tileFrameCounter[485] = 0;
17867 }
17868 if (++tileFrameCounter[491] >= 40)
17869 {
17870 tileFrameCounter[491] = 0;
17871 }
17872 if (++tileFrameCounter[564] >= 5)
17873 {
17874 tileFrameCounter[564] = 0;
17875 tileFrame[564]++;
17876 if (tileFrame[564] >= 36)
17877 {
17878 tileFrame[564] = 0;
17879 }
17880 }
17881 if (++tileFrameCounter[593] >= 5)
17882 {
17883 tileFrameCounter[593] = 0;
17884 tileFrame[593]++;
17885 if (tileFrame[593] >= 9)
17886 {
17887 tileFrame[593] = 5;
17888 }
17889 }
17890 if (++tileFrameCounter[594] >= 5)
17891 {
17892 tileFrameCounter[594] = 0;
17893 tileFrame[594]++;
17894 if (tileFrame[594] >= 9)
17895 {
17896 tileFrame[594] = 5;
17897 }
17898 }
17899 if (++tileFrameCounter[614] >= 5)
17900 {
17901 tileFrameCounter[614] = 0;
17902 tileFrame[614]++;
17903 if (tileFrame[614] >= 6)
17904 {
17905 tileFrame[614] = 0;
17906 }
17907 }
17908 if (++tileFrameCounter[565] >= 4)
17909 {
17910 tileFrameCounter[565] = 0;
17911 tileFrame[565]++;
17912 if (tileFrame[565] >= 5)
17913 {
17914 tileFrame[565] = 0;
17915 }
17916 }
17917 if (++tileFrameCounter[572] >= 6)
17918 {
17919 tileFrameCounter[572] = 0;
17920 if (++tileFrame[572] >= 4)
17921 {
17922 tileFrame[572] = 0;
17923 }
17924 }
17925 if (++tileFrameCounter[597] >= 64)
17926 {
17927 tileFrameCounter[597] = 0;
17928 }
17929 int num3 = (int)MathHelper.Clamp((float)Math.Floor(Math.Abs(WindForVisuals) * 10f) * (float)Math.Sign(WindForVisuals), -5f, 5f);
17930 tileFrameCounter[489] += num3;
17931 tileFrameCounter[489] %= 320;
17932 if (tileFrameCounter[489] < 0)
17933 {
17934 tileFrameCounter[489] += 320;
17935 }
17937 int num4 = (int)MathHelper.Clamp((float)Math.Floor(Math.Abs(WindForVisuals) * 10f) * (float)Math.Sign(WindForVisuals), -5f, 5f);
17938 tileFrameCounter[493] += num4;
17939 tileFrameCounter[493] %= 120;
17940 if (tileFrameCounter[493] < 0)
17941 {
17942 tileFrameCounter[493] += 120;
17943 }
17945 }
17946
17947 private static void AnimateTiles_WeatherVane()
17948 {
17949 int num = Math.Sign(WindForVisuals);
17950 int num2 = (int)MathHelper.Clamp((float)Math.Floor(Math.Abs(WindForVisuals) * 10f), -5f, 5f);
17951 int num3 = 6;
17952 tileFrameCounter[490] += num2;
17953 if (tileFrameCounter[490] < num3)
17954 {
17955 return;
17956 }
17957 tileFrameCounter[490] -= num3 * tileFrameCounter[490];
17958 if ((tileFrame[490] != 0 || num != -1) && (tileFrame[490] != 6 || num != 1))
17959 {
17960 if (++tileFrame[490] >= 12)
17961 {
17962 tileFrame[490] = 0;
17964 }
17965 }
17966 else if (rand.NextFloat() < Math.Abs(WindForVisuals) * 0.5f && ++weatherVaneBobframe == 8)
17967 {
17969 }
17970 }
17971
17972 private static void DoUpdate_AnimateWalls()
17973 {
17974 wallFrameCounter[136]++;
17975 if (wallFrameCounter[136] >= 5)
17976 {
17977 wallFrameCounter[136] = 0;
17978 wallFrame[136]++;
17979 if (wallFrame[136] > 7)
17980 {
17981 wallFrame[136] = 0;
17982 }
17983 }
17984 wallFrameCounter[137]++;
17985 if (wallFrameCounter[137] >= 10)
17986 {
17987 wallFrameCounter[137] = 0;
17988 wallFrame[137]++;
17989 if (wallFrame[137] > 7)
17990 {
17991 wallFrame[137] = 0;
17992 }
17993 }
17994 int num = 226;
17995 wallFrameCounter[num]++;
17996 if (wallFrameCounter[num] >= 10)
17997 {
17998 wallFrameCounter[num] = 0;
17999 wallFrame[num]++;
18000 if (wallFrame[num] > 7)
18001 {
18002 wallFrame[num] = 0;
18003 }
18004 }
18005 num = 227;
18006 wallFrameCounter[num]++;
18007 if (wallFrameCounter[num] >= 5)
18008 {
18009 wallFrameCounter[num] = 0;
18010 wallFrame[num]++;
18011 if (wallFrame[num] > 7)
18012 {
18013 wallFrame[num] = 0;
18014 }
18015 }
18016 num = 225;
18017 wallFrameCounter[num]++;
18018 if (wallFrameCounter[num] >= 5)
18019 {
18020 wallFrameCounter[num] = 0;
18021 wallFrame[num]++;
18022 if (wallFrame[num] > 1)
18023 {
18024 wallFrame[num] = 0;
18025 }
18026 }
18027 wallFrameCounter[172]++;
18028 if (wallFrameCounter[172] >= 10)
18029 {
18030 wallFrameCounter[172] = 0;
18031 wallFrame[172]++;
18032 if (wallFrame[172] > 7)
18033 {
18034 wallFrame[172] = 0;
18035 }
18036 }
18037 wallFrameCounter[168]++;
18038 if (wallFrameCounter[168] >= 5)
18039 {
18040 wallFrameCounter[168] = 0;
18041 wallFrame[168]++;
18042 if (wallFrame[168] > 7)
18043 {
18044 wallFrame[168] = 0;
18045 }
18046 }
18047 wallFrameCounter[169]++;
18048 if (wallFrameCounter[169] >= 5)
18049 {
18050 wallFrameCounter[169] = 0;
18051 wallFrame[169]++;
18052 if (wallFrame[169] > 7)
18053 {
18054 wallFrame[169] = 0;
18055 }
18056 }
18057 int num2 = 20;
18058 if (++wallFrameCounter[242] >= num2 * 8)
18059 {
18060 wallFrameCounter[242] = 0;
18061 }
18062 if (++wallFrameCounter[243] >= num2 * 8)
18063 {
18064 wallFrameCounter[243] = 0;
18065 }
18066 wallFrameCounter[144]++;
18067 int num3 = 5;
18068 int num4 = 10;
18069 if (wallFrameCounter[144] < num3)
18070 {
18071 wallFrame[144] = 0;
18072 return;
18073 }
18074 if (wallFrameCounter[144] < num3)
18075 {
18076 wallFrame[144] = 1;
18077 return;
18078 }
18079 if (wallFrameCounter[144] < num3 * 2)
18080 {
18081 wallFrame[144] = 2;
18082 return;
18083 }
18084 if (wallFrameCounter[144] < num3 * 3)
18085 {
18086 wallFrame[144] = 3;
18087 return;
18088 }
18089 if (wallFrameCounter[144] < num3 * 4)
18090 {
18091 wallFrame[144] = 4;
18092 return;
18093 }
18094 if (wallFrameCounter[144] < num3 * 5)
18095 {
18096 wallFrame[144] = 5;
18097 return;
18098 }
18099 if (wallFrameCounter[144] < num3 * 6)
18100 {
18101 wallFrame[144] = 6;
18102 return;
18103 }
18104 if (wallFrameCounter[144] < num3 * 7)
18105 {
18106 wallFrame[144] = 7;
18107 return;
18108 }
18109 if (wallFrameCounter[144] < num3 * (8 + num4))
18110 {
18111 wallFrame[144] = 8;
18112 return;
18113 }
18114 if (wallFrameCounter[144] < num3 * (9 + num4))
18115 {
18116 wallFrame[144] = 7;
18117 return;
18118 }
18119 if (wallFrameCounter[144] < num3 * (10 + num4))
18120 {
18121 wallFrame[144] = 6;
18122 return;
18123 }
18124 if (wallFrameCounter[144] < num3 * (11 + num4))
18125 {
18126 wallFrame[144] = 5;
18127 return;
18128 }
18129 if (wallFrameCounter[144] < num3 * (12 + num4))
18130 {
18131 wallFrame[144] = 4;
18132 return;
18133 }
18134 if (wallFrameCounter[144] < num3 * (13 + num4))
18135 {
18136 wallFrame[144] = 3;
18137 return;
18138 }
18139 if (wallFrameCounter[144] < num3 * (14 + num4))
18140 {
18141 wallFrame[144] = 2;
18142 return;
18143 }
18144 if (wallFrameCounter[144] < num3 * (15 + num4))
18145 {
18146 wallFrame[144] = 1;
18147 return;
18148 }
18149 wallFrame[144] = 0;
18150 if (wallFrameCounter[144] > num3 * (16 + num4 * 2))
18151 {
18152 wallFrameCounter[144] = 0;
18153 }
18154 }
18155
18157 {
18159 if (wFrCounter > 4f)
18160 {
18161 wFrCounter = 0f;
18162 wFrame += 1f;
18163 }
18164 if (wFrCounter < 0f)
18165 {
18166 wFrCounter = 4f;
18167 wFrame -= 1f;
18168 }
18169 if (wFrame > 16f)
18170 {
18171 wFrame = 1f;
18172 }
18173 if (wFrame < 1f)
18174 {
18175 wFrame = 16f;
18176 }
18178 }
18179
18181 {
18182 if (gFadeDir == 1)
18183 {
18184 gFader += 0.1f;
18185 gFade = (byte)gFader;
18186 if (gFade > 150)
18187 {
18188 gFadeDir = 0;
18189 }
18190 }
18191 else
18192 {
18193 gFader -= 0.1f;
18194 gFade = (byte)gFader;
18195 if (gFade < 100)
18196 {
18197 gFadeDir = 1;
18198 }
18199 }
18200 }
18201
18203 {
18204 int num = 7;
18205 if (DiscoStyle == 0)
18206 {
18207 DiscoG += num;
18208 if (DiscoG >= 255)
18209 {
18210 DiscoG = 255;
18211 DiscoStyle++;
18212 }
18213 }
18214 if (DiscoStyle == 1)
18215 {
18216 DiscoR -= num;
18217 if (DiscoR <= 0)
18218 {
18219 DiscoR = 0;
18220 DiscoStyle++;
18221 }
18222 }
18223 if (DiscoStyle == 2)
18224 {
18225 DiscoB += num;
18226 if (DiscoB >= 255)
18227 {
18228 DiscoB = 255;
18229 DiscoStyle++;
18230 }
18231 }
18232 if (DiscoStyle == 3)
18233 {
18234 DiscoG -= num;
18235 if (DiscoG <= 0)
18236 {
18237 DiscoG = 0;
18238 DiscoStyle++;
18239 }
18240 }
18241 if (DiscoStyle == 4)
18242 {
18243 DiscoR += num;
18244 if (DiscoR >= 255)
18245 {
18246 DiscoR = 255;
18247 DiscoStyle++;
18248 }
18249 }
18250 if (DiscoStyle == 5)
18251 {
18252 DiscoB -= num;
18253 if (DiscoB <= 0)
18254 {
18255 DiscoB = 0;
18256 DiscoStyle = 0;
18257 }
18258 }
18259 }
18260
18268
18270 {
18271 if (bgSet[1] == 94 || (bgSet[1] >= 114 && bgSet[1] <= 116))
18272 {
18274 if (bgFrameCounter[bgIndex] >= 6)
18275 {
18277 bgFrame[bgIndex]++;
18278 if (bgFrame[bgIndex] >= 4)
18279 {
18280 bgFrame[bgIndex] = 0;
18281 }
18282 }
18283 if (bgFrame[bgIndex] == 0)
18284 {
18285 bgSet[1] = 94;
18286 }
18287 else if (bgFrame[bgIndex] == 1)
18288 {
18289 bgSet[1] = 114;
18290 }
18291 else if (bgFrame[bgIndex] == 2)
18292 {
18293 bgSet[1] = 115;
18294 }
18295 else
18296 {
18297 bgSet[1] = 116;
18298 }
18299 if (bgFrame[bgIndex] == 0)
18300 {
18301 bgSet[0] = 93;
18302 }
18303 else if (bgFrame[bgIndex] == 1)
18304 {
18305 bgSet[0] = 168;
18306 }
18307 else if (bgFrame[bgIndex] == 2)
18308 {
18309 bgSet[0] = 169;
18310 }
18311 else
18312 {
18313 bgSet[0] = 170;
18314 }
18315 }
18316 if (bgSet[1] < 180 || bgSet[1] > 183)
18317 {
18318 return;
18319 }
18321 if (bgFrameCounter[bgIndex] >= 6)
18322 {
18324 bgFrame[bgIndex]++;
18325 if (bgFrame[bgIndex] >= 4)
18326 {
18327 bgFrame[bgIndex] = 0;
18328 }
18329 }
18330 if (bgFrame[bgIndex] == 0)
18331 {
18332 bgSet[1] = 180;
18333 }
18334 else if (bgFrame[bgIndex] == 1)
18335 {
18336 bgSet[1] = 181;
18337 }
18338 else if (bgFrame[bgIndex] == 2)
18339 {
18340 bgSet[1] = 182;
18341 }
18342 else
18343 {
18344 bgSet[1] = 183;
18345 }
18346 }
18347
18348 private static void DoUpdate_AutoSave()
18349 {
18350 if (!gameMenu && netMode == 1)
18351 {
18352 if (!saveTime.IsRunning)
18353 {
18354 saveTime.Start();
18355 }
18356 if (saveTime.ElapsedMilliseconds > 300000)
18357 {
18358 saveTime.Reset();
18360 }
18361 }
18362 else if (!gameMenu && (autoSave || netMode == 2))
18363 {
18364 if (!saveTime.IsRunning)
18365 {
18366 saveTime.Start();
18367 }
18368 if (saveTime.ElapsedMilliseconds > 600000)
18369 {
18370 saveTime.Reset();
18371 if (netMode != 2)
18372 {
18374 }
18376 }
18377 }
18378 else if (saveTime.IsRunning)
18379 {
18380 saveTime.Stop();
18381 }
18382 }
18383
18384 private static void UpdateSettingUnlocks()
18385 {
18387 {
18389 SaveSettings();
18390 }
18391 }
18392
18393 public static void InputTextSign()
18394 {
18396 {
18397 PlayerInput.WritingText = true;
18398 instance.HandleIME();
18400 if (inputTextEnter)
18401 {
18402 byte[] bytes = new byte[1] { 10 };
18403 npcChatText += Encoding.ASCII.GetString(bytes);
18404 }
18405 else if (inputTextEscape)
18406 {
18408 }
18409 }
18410 }
18411
18412 public static void InputTextChest()
18413 {
18415 {
18417 if (inputTextEnter)
18418 {
18420 }
18421 else if (inputTextEscape)
18422 {
18424 }
18425 }
18426 }
18427
18428 public static void InputTextSignCancel()
18429 {
18431 editSign = false;
18432 blockKey = Microsoft.Xna.Framework.Input.Keys.Escape.ToString();
18434 if (player[myPlayer].sign >= 0)
18435 {
18436 npcChatText = sign[player[myPlayer].sign].text;
18437 }
18438 }
18439
18440 private static void UpdateMenu()
18441 {
18443 {
18445 {
18446 screenPosition.X -= 20f;
18447 }
18449 {
18450 numClouds = rand.Next(100, 200);
18451 statusText = string.Concat(rand.Next(999999999));
18452 for (int i = 0; i < 3; i++)
18453 {
18454 if (rand.Next(2) == 0)
18455 {
18456 statusText += rand.Next(999999999);
18457 }
18458 }
18459 }
18460 }
18461 gamePaused = false;
18462 thunderDelay = 0;
18463 lightning = 0f;
18464 lightningSpeed = 0f;
18467 playerInventory = false;
18468 exitScale = 0.8f;
18469 if (netMode == 0)
18470 {
18471 if (instance.IsActive && hasFocus && (!dayTime || WorldGen.remixWorldGen) && (rand.Next(12) == 0 || (WorldGen.drunkWorldGen && !remixWorld)))
18472 {
18473 int num = rand.Next(numStars);
18474 if (star[num] != null && !star[num].hidden && !star[num].falling)
18475 {
18476 star[num].Fall();
18477 }
18478 }
18479 if (gameMenu)
18480 {
18481 if (WorldGen.gen)
18482 {
18483 lockMenuBGChange = true;
18484 }
18485 else if (menuMode == 0)
18486 {
18487 lockMenuBGChange = false;
18488 }
18489 if (!lockMenuBGChange)
18490 {
18491 if (dayTime)
18492 {
18493 menuBGChangedDay = false;
18494 }
18495 else if (!menuBGChangedDay && time >= 16200.0)
18496 {
18497 menuBGChangedDay = true;
18498 int style = WorldGen.corruptBG;
18500 if (treeBGSet1[0] == 173)
18501 {
18503 }
18504 if (treeBGSet1[0] == 173)
18505 {
18507 }
18508 WorldGen.setBG(1, style);
18509 }
18510 if (!dayTime)
18511 {
18512 menuBGChangedNight = false;
18513 }
18514 else if (!menuBGChangedNight && time >= 27000.0)
18515 {
18516 moonType = rand.Next(9);
18517 menuBGChangedNight = true;
18518 int treeBG = WorldGen.treeBG1;
18520 WorldGen.setBG(0, treeBG);
18521 }
18522 }
18523 else
18524 {
18525 menuBGChangedDay = true;
18526 menuBGChangedNight = true;
18527 }
18528 }
18530 {
18531 return;
18532 }
18534 {
18535 time -= 6.0;
18536 if (dayTime)
18537 {
18538 time -= 1000.0;
18539 }
18540 if (time < 0.0)
18541 {
18542 time = 32400.0;
18543 dayTime = false;
18544 }
18545 }
18546 else if (dayTime)
18547 {
18548 time += 33.88235294117647;
18549 }
18550 else
18551 {
18552 time += 30.857142857142858;
18553 }
18554 if (!dayTime)
18555 {
18556 if (time > 32400.0)
18557 {
18558 bloodMoon = false;
18559 time = 0.0;
18560 dayTime = true;
18561 if (starGame)
18562 {
18563 dayTime = false;
18564 }
18565 moonPhase++;
18566 if (moonPhase >= 7)
18567 {
18568 moonPhase = 0;
18569 }
18570 }
18571 }
18572 else if (time > 54000.0)
18573 {
18574 time = 0.0;
18575 dayTime = false;
18576 }
18577 }
18578 else if (netMode == 1)
18579 {
18580 UpdateTime();
18581 }
18582 }
18583
18584 public static void clrInput()
18585 {
18586 keyCount = 0;
18587 inputTextEscape = false;
18588 }
18589
18590 [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
18591 public static extern short GetKeyState(int keyCode);
18592
18593 public static string GetInputText(string oldString, bool allowMultiLine = false)
18594 {
18595 if (dedServ)
18596 {
18597 return "";
18598 }
18599 if (!hasFocus)
18600 {
18601 return oldString;
18602 }
18603 inputTextEnter = false;
18604 inputTextEscape = false;
18605 string text = oldString;
18606 string text2 = "";
18607 if (text == null)
18608 {
18609 text = "";
18610 }
18611 bool flag = false;
18612 if (inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) || inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightControl))
18613 {
18614 if (inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z) && !oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z))
18615 {
18616 text = "";
18617 }
18618 else if (inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.X) && !oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.X))
18619 {
18620 Platform.Get<IClipboard>().Value = oldString;
18621 text = "";
18622 }
18623 else if ((inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.C) && !oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.C)) || (inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert) && !oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert)))
18624 {
18625 Platform.Get<IClipboard>().Value = oldString;
18626 }
18627 else if (inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.V) && !oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.V))
18628 {
18630 }
18631 }
18632 else
18633 {
18634 if (inputText.PressingShift())
18635 {
18636 if (inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Delete) && !oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Delete))
18637 {
18638 Platform.Get<IClipboard>().Value = oldString;
18639 text = "";
18640 }
18641 if (inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert) && !oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert))
18642 {
18644 }
18645 }
18646 for (int i = 0; i < keyCount; i++)
18647 {
18648 int num = keyInt[i];
18649 string text3 = keyString[i];
18650 if (num == 13)
18651 {
18652 inputTextEnter = true;
18653 }
18654 else if (num == 27)
18655 {
18656 inputTextEscape = true;
18657 }
18658 else if (num >= 32 && num != 127)
18659 {
18660 text2 += text3;
18661 }
18662 }
18663 }
18664 keyCount = 0;
18665 text += text2;
18667 inputText = Keyboard.GetState();
18668 Microsoft.Xna.Framework.Input.Keys[] pressedKeys = inputText.GetPressedKeys();
18669 Microsoft.Xna.Framework.Input.Keys[] pressedKeys2 = oldInputText.GetPressedKeys();
18670 if (inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Back) && oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Back))
18671 {
18672 backSpaceRate -= 0.05f;
18673 if (backSpaceRate < 0f)
18674 {
18675 backSpaceRate = 0f;
18676 }
18677 if (backSpaceCount <= 0)
18678 {
18680 flag = true;
18681 }
18683 }
18684 else
18685 {
18686 backSpaceRate = 7f;
18687 backSpaceCount = 15;
18688 }
18689 for (int j = 0; j < pressedKeys.Length; j++)
18690 {
18691 bool flag2 = true;
18692 for (int k = 0; k < pressedKeys2.Length; k++)
18693 {
18694 if (pressedKeys[j] == pressedKeys2[k])
18695 {
18696 flag2 = false;
18697 }
18698 }
18699 if (string.Concat(pressedKeys[j]) == "Back" && (flag2 || flag) && text.Length > 0)
18700 {
18702 text = ((!array[array.Length - 1].DeleteWhole) ? text.Substring(0, text.Length - 1) : text.Substring(0, text.Length - array[array.Length - 1].TextOriginal.Length));
18703 }
18704 }
18705 return text;
18706 }
18707
18708 private static string PasteTextIn(bool allowMultiLine, string newKeys)
18709 {
18710 newKeys = ((!allowMultiLine) ? (newKeys + Platform.Get<IClipboard>().Value) : (newKeys + Platform.Get<IClipboard>().MultiLineValue));
18711 return newKeys;
18712 }
18713
18714 public void MouseTextHackZoom(string text, string buffTooltip = null)
18715 {
18716 MouseTextHackZoom(text, 0, 0, buffTooltip);
18717 }
18718
18719 public void MouseTextHackZoom(string text, int itemRarity, byte diff = 0, string buffTooltip = null)
18720 {
18721 MouseText(text, buffTooltip, itemRarity, diff);
18722 }
18723
18724 public void MouseTextNoOverride(string cursorText, int rare = 0, byte diff = 0, int hackedMouseX = -1, int hackedMouseY = -1, int hackedScreenWidth = -1, int hackedScreenHeight = -1, int pushWidthX = 0)
18725 {
18726 MouseText(cursorText, null, rare, diff, hackedMouseX, hackedMouseY, hackedScreenWidth, hackedScreenHeight, pushWidthX, noOverride: true);
18727 }
18728
18729 public void MouseText(string cursorText, int rare = 0, byte diff = 0, int hackedMouseX = -1, int hackedMouseY = -1, int hackedScreenWidth = -1, int hackedScreenHeight = -1, int pushWidthX = 0)
18730 {
18731 MouseText(cursorText, null, rare, diff, hackedMouseX, hackedMouseY, hackedScreenWidth, hackedScreenHeight, pushWidthX);
18732 }
18733
18734 public void MouseText(string cursorText, string buffTooltip, int rare = 0, byte diff = 0, int hackedMouseX = -1, int hackedMouseY = -1, int hackedScreenWidth = -1, int hackedScreenHeight = -1, int pushWidthX = 0, bool noOverride = false)
18735 {
18737 {
18739 {
18740 noOverride = noOverride,
18741 isValid = true,
18742 cursorText = cursorText,
18743 rare = rare,
18744 diff = diff,
18745 X = hackedMouseX,
18746 Y = hackedMouseY,
18747 hackedScreenWidth = hackedScreenWidth,
18748 hackedScreenHeight = hackedScreenHeight,
18749 buffTooltip = buffTooltip
18750 };
18751 }
18752 }
18753
18755 {
18756 string cursorText = info.cursorText;
18757 int num = info.rare;
18758 byte diff = info.diff;
18759 int x = info.X;
18760 int y = info.Y;
18761 int hackedScreenWidth = info.hackedScreenWidth;
18762 int hackedScreenHeight = info.hackedScreenHeight;
18763 if (mouseNPCType > -1 || cursorText == null)
18764 {
18765 return;
18766 }
18767 int X = mouseX + 14;
18768 int Y = mouseY + 14;
18769 if (x != -1 && y != -1)
18770 {
18771 X = x + 10;
18772 Y = y + 10;
18773 }
18774 if (ThickMouse)
18775 {
18776 X += 6;
18777 Y += 6;
18778 }
18779 if (!mouseItem.IsAir)
18780 {
18781 X += 34;
18782 }
18784 if (HoverItem.type > 0)
18785 {
18786 MouseText_DrawItemTooltip(info, num, diff, X, Y);
18787 return;
18788 }
18789 if (info.buffTooltip != null && info.buffTooltip != "")
18790 {
18791 MouseText_DrawBuffTooltip(info.buffTooltip, ref X, ref Y);
18792 }
18793 Vector2 vector = FontAssets.MouseText.Value.MeasureString(cursorText);
18794 if (hackedScreenHeight != -1 && hackedScreenWidth != -1)
18795 {
18796 if ((float)X + vector.X + 4f > (float)hackedScreenWidth)
18797 {
18798 X = (int)((float)hackedScreenWidth - vector.X - 4f);
18799 }
18800 if ((float)Y + vector.Y + 4f > (float)hackedScreenHeight)
18801 {
18802 Y = (int)((float)hackedScreenHeight - vector.Y - 4f);
18803 }
18804 }
18805 else
18806 {
18807 if ((float)X + vector.X + 4f > (float)screenWidth)
18808 {
18809 X = (int)((float)screenWidth - vector.X - 4f);
18810 }
18811 if ((float)Y + vector.Y + 4f > (float)screenHeight)
18812 {
18813 Y = (int)((float)screenHeight - vector.Y - 4f);
18814 }
18815 }
18816 float num2 = (float)(int)mouseTextColor / 255f;
18818 if (num == -13)
18819 {
18820 baseColor = new Microsoft.Xna.Framework.Color((byte)(255f * num2), (byte)(masterColor * 200f * num2), 0, mouseTextColor);
18821 }
18822 if (num == -11)
18823 {
18824 baseColor = new Microsoft.Xna.Framework.Color((byte)(255f * num2), (byte)(175f * num2), (byte)(0f * num2), mouseTextColor);
18825 }
18826 if (num == -10)
18827 {
18828 baseColor = new Microsoft.Xna.Framework.Color((byte)(65f * num2), (byte)(255f * num2), (byte)(110f * num2), mouseTextColor);
18829 }
18830 if (num == -1)
18831 {
18832 baseColor = new Microsoft.Xna.Framework.Color((byte)(130f * num2), (byte)(130f * num2), (byte)(130f * num2), mouseTextColor);
18833 }
18834 if (num == 1)
18835 {
18836 baseColor = new Microsoft.Xna.Framework.Color((byte)(150f * num2), (byte)(150f * num2), (byte)(255f * num2), mouseTextColor);
18837 }
18838 if (num == 2)
18839 {
18840 baseColor = new Microsoft.Xna.Framework.Color((byte)(150f * num2), (byte)(255f * num2), (byte)(150f * num2), mouseTextColor);
18841 }
18842 if (num == 3)
18843 {
18844 baseColor = new Microsoft.Xna.Framework.Color((byte)(255f * num2), (byte)(200f * num2), (byte)(150f * num2), mouseTextColor);
18845 }
18846 if (num == 4)
18847 {
18848 baseColor = new Microsoft.Xna.Framework.Color((byte)(255f * num2), (byte)(150f * num2), (byte)(150f * num2), mouseTextColor);
18849 }
18850 if (num == 5)
18851 {
18852 baseColor = new Microsoft.Xna.Framework.Color((byte)(255f * num2), (byte)(150f * num2), (byte)(255f * num2), mouseTextColor);
18853 }
18854 if (num == 6)
18855 {
18856 baseColor = new Microsoft.Xna.Framework.Color((byte)(210f * num2), (byte)(160f * num2), (byte)(255f * num2), mouseTextColor);
18857 }
18858 if (num == 7)
18859 {
18860 baseColor = new Microsoft.Xna.Framework.Color((byte)(150f * num2), (byte)(255f * num2), (byte)(10f * num2), mouseTextColor);
18861 }
18862 if (num == 8)
18863 {
18864 baseColor = new Microsoft.Xna.Framework.Color((byte)(255f * num2), (byte)(255f * num2), (byte)(10f * num2), mouseTextColor);
18865 }
18866 if (num == 9)
18867 {
18868 baseColor = new Microsoft.Xna.Framework.Color((byte)(5f * num2), (byte)(200f * num2), (byte)(255f * num2), mouseTextColor);
18869 }
18870 if (num == 10)
18871 {
18872 baseColor = new Microsoft.Xna.Framework.Color((byte)(255f * num2), (byte)(40f * num2), (byte)(100f * num2), mouseTextColor);
18873 }
18874 if (num >= 11)
18875 {
18876 baseColor = new Microsoft.Xna.Framework.Color((byte)(180f * num2), (byte)(40f * num2), (byte)(255f * num2), mouseTextColor);
18877 }
18878 if (HoverItem.expert || num == -12)
18879 {
18880 baseColor = new Microsoft.Xna.Framework.Color((byte)((float)DiscoR * num2), (byte)((float)DiscoG * num2), (byte)((float)DiscoB * num2), mouseTextColor);
18881 }
18882 if (diff == 1)
18883 {
18884 baseColor = new Microsoft.Xna.Framework.Color((byte)((float)(int)mcColor.R * num2), (byte)((float)(int)mcColor.G * num2), (byte)((float)(int)mcColor.B * num2), mouseTextColor);
18885 }
18886 if (diff == 2)
18887 {
18888 baseColor = new Microsoft.Xna.Framework.Color((byte)((float)(int)hcColor.R * num2), (byte)((float)(int)hcColor.G * num2), (byte)((float)(int)hcColor.B * num2), mouseTextColor);
18889 }
18891 }
18892
18893 private void MouseText_DrawItemTooltip(MouseTextCache info, int rare, byte diff, int X, int Y)
18894 {
18898 int yoyoLogo = -1;
18899 int researchLine = -1;
18900 rare = hoverItem.rare;
18901 float knockBack = hoverItem.knockBack;
18902 float num = 1f;
18903 if (hoverItem.melee && player[myPlayer].kbGlove)
18904 {
18905 num += 1f;
18906 }
18907 if (player[myPlayer].kbBuff)
18908 {
18909 num += 0.5f;
18910 }
18911 if (num != 1f)
18912 {
18913 hoverItem.knockBack *= num;
18914 }
18915 if (hoverItem.ranged && player[myPlayer].shroomiteStealth)
18916 {
18917 hoverItem.knockBack *= 1f + (1f - player[myPlayer].stealth) * 0.5f;
18918 }
18919 int num2 = 30;
18920 int numLines = 1;
18921 string[] array = new string[num2];
18922 bool[] array2 = new bool[num2];
18923 bool[] array3 = new bool[num2];
18924 for (int i = 0; i < num2; i++)
18925 {
18926 array2[i] = false;
18927 array3[i] = false;
18928 }
18930 float num3 = (float)(int)mouseTextColor / 255f;
18931 float num4 = num3;
18932 int a = mouseTextColor;
18933 if (npcShop > 0 && hoverItem.value >= 0 && (hoverItem.type < 71 || hoverItem.type > 74))
18934 {
18936 long num5 = ((hoverItem.isAShopItem || hoverItem.buyOnce) ? calcForBuying : calcForSelling);
18937 if (hoverItem.shopSpecialCurrency != -1)
18938 {
18940 color = new Microsoft.Xna.Framework.Color((byte)(255f * num4), (byte)(255f * num4), (byte)(255f * num4), a);
18941 }
18942 else if (num5 > 0)
18943 {
18944 string text = "";
18945 long num6 = 0L;
18946 long num7 = 0L;
18947 long num8 = 0L;
18948 long num9 = 0L;
18949 long num10 = num5 * hoverItem.stack;
18950 if (!hoverItem.buy)
18951 {
18952 num10 = num5 / 5;
18953 if (num10 < 1)
18954 {
18955 num10 = 1L;
18956 }
18957 long num11 = num10;
18958 num10 *= hoverItem.stack;
18959 int amount = shopSellbackHelper.GetAmount(hoverItem);
18960 if (amount > 0)
18961 {
18962 num10 += (-num11 + calcForBuying) * Math.Min(amount, hoverItem.stack);
18963 }
18964 }
18965 if (num10 < 1)
18966 {
18967 num10 = 1L;
18968 }
18969 if (num10 >= 1000000)
18970 {
18971 num6 = num10 / 1000000;
18972 num10 -= num6 * 1000000;
18973 }
18974 if (num10 >= 10000)
18975 {
18976 num7 = num10 / 10000;
18977 num10 -= num7 * 10000;
18978 }
18979 if (num10 >= 100)
18980 {
18981 num8 = num10 / 100;
18982 num10 -= num8 * 100;
18983 }
18984 if (num10 >= 1)
18985 {
18986 num9 = num10;
18987 }
18988 if (num6 > 0)
18989 {
18990 text = text + num6 + " " + Lang.inter[15].Value + " ";
18991 }
18992 if (num7 > 0)
18993 {
18994 text = text + num7 + " " + Lang.inter[16].Value + " ";
18995 }
18996 if (num8 > 0)
18997 {
18998 text = text + num8 + " " + Lang.inter[17].Value + " ";
18999 }
19000 if (num9 > 0)
19001 {
19002 text = text + num9 + " " + Lang.inter[18].Value + " ";
19003 }
19004 if (!hoverItem.buy)
19005 {
19006 array[numLines] = Lang.tip[49].Value + " " + text;
19007 }
19008 else
19009 {
19010 array[numLines] = Lang.tip[50].Value + " " + text;
19011 }
19012 numLines++;
19013 if (num6 > 0)
19014 {
19015 color = new Microsoft.Xna.Framework.Color((byte)(220f * num4), (byte)(220f * num4), (byte)(198f * num4), a);
19016 }
19017 else if (num7 > 0)
19018 {
19019 color = new Microsoft.Xna.Framework.Color((byte)(224f * num4), (byte)(201f * num4), (byte)(92f * num4), a);
19020 }
19021 else if (num8 > 0)
19022 {
19023 color = new Microsoft.Xna.Framework.Color((byte)(181f * num4), (byte)(192f * num4), (byte)(193f * num4), a);
19024 }
19025 else if (num9 > 0)
19026 {
19027 color = new Microsoft.Xna.Framework.Color((byte)(246f * num4), (byte)(138f * num4), (byte)(96f * num4), a);
19028 }
19029 }
19030 else if (hoverItem.type != 3817)
19031 {
19032 array[numLines] = Lang.tip[51].Value;
19033 numLines++;
19034 color = new Microsoft.Xna.Framework.Color((byte)(120f * num4), (byte)(120f * num4), (byte)(120f * num4), a);
19035 }
19036 }
19038 int num12 = 0;
19039 for (int j = 0; j < numLines; j++)
19040 {
19042 if (stringSize.X > zero.X)
19043 {
19044 zero.X = stringSize.X;
19045 }
19046 zero.Y += stringSize.Y + (float)num12;
19047 }
19048 if (yoyoLogo != -1)
19049 {
19050 zero.Y += 24f;
19051 }
19052 X += toolTipDistance;
19053 Y += toolTipDistance;
19054 int num13 = 4;
19056 {
19057 X += 8;
19058 Y += 2;
19059 num13 = 18;
19060 }
19061 int num14 = screenWidth;
19062 int num15 = screenHeight;
19063 if ((float)X + zero.X + (float)num13 > (float)num14)
19064 {
19065 X = (int)((float)num14 - zero.X - (float)num13);
19066 }
19067 if ((float)Y + zero.Y + (float)num13 > (float)num15)
19068 {
19069 Y = (int)((float)num15 - zero.Y - (float)num13);
19070 }
19071 int num16 = 0;
19072 num3 = (float)(int)mouseTextColor / 255f;
19074 {
19075 num3 = MathHelper.Lerp(num3, 1f, 1f);
19076 int num17 = 14;
19077 int num18 = 9;
19078 Utils.DrawInvBG(spriteBatch, new Microsoft.Xna.Framework.Rectangle(X - num17, Y - num18, (int)zero.X + num17 * 2, (int)zero.Y + num18 + num18 / 2), new Microsoft.Xna.Framework.Color(23, 25, 81, 255) * 0.925f);
19079 }
19080 for (int k = 0; k < numLines; k++)
19081 {
19082 if (k == yoyoLogo)
19083 {
19084 float num19 = 1f;
19085 int num20 = (int)((float)(int)mouseTextColor * num19);
19087 for (int l = 0; l < 5; l++)
19088 {
19089 int num21 = X;
19090 int num22 = Y + num16;
19091 if (l == 4)
19092 {
19094 }
19095 switch (l)
19096 {
19097 case 0:
19098 num21--;
19099 break;
19100 case 1:
19101 num21++;
19102 break;
19103 case 2:
19104 num22--;
19105 break;
19106 case 3:
19107 num22++;
19108 break;
19109 }
19110 spriteBatch.Draw(TextureAssets.OneDropLogo.Value, new Vector2(num21, num22), null, color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
19111 }
19112 }
19113 else
19114 {
19117 if (k == 0)
19118 {
19119 if (rare == -13)
19120 {
19121 black = new Microsoft.Xna.Framework.Color((byte)(255f * num4), (byte)(masterColor * 200f * num4), 0, a);
19122 }
19123 if (rare == -11)
19124 {
19125 black = new Microsoft.Xna.Framework.Color((byte)(255f * num4), (byte)(175f * num4), (byte)(0f * num4), a);
19126 }
19127 if (rare == -1)
19128 {
19129 black = new Microsoft.Xna.Framework.Color((byte)(130f * num4), (byte)(130f * num4), (byte)(130f * num4), a);
19130 }
19131 if (rare == 1)
19132 {
19133 black = new Microsoft.Xna.Framework.Color((byte)(150f * num4), (byte)(150f * num4), (byte)(255f * num4), a);
19134 }
19135 if (rare == 2)
19136 {
19137 black = new Microsoft.Xna.Framework.Color((byte)(150f * num4), (byte)(255f * num4), (byte)(150f * num4), a);
19138 }
19139 if (rare == 3)
19140 {
19141 black = new Microsoft.Xna.Framework.Color((byte)(255f * num4), (byte)(200f * num4), (byte)(150f * num4), a);
19142 }
19143 if (rare == 4)
19144 {
19145 black = new Microsoft.Xna.Framework.Color((byte)(255f * num4), (byte)(150f * num4), (byte)(150f * num4), a);
19146 }
19147 if (rare == 5)
19148 {
19149 black = new Microsoft.Xna.Framework.Color((byte)(255f * num4), (byte)(150f * num4), (byte)(255f * num4), a);
19150 }
19151 if (rare == 6)
19152 {
19153 black = new Microsoft.Xna.Framework.Color((byte)(210f * num4), (byte)(160f * num4), (byte)(255f * num4), a);
19154 }
19155 if (rare == 7)
19156 {
19157 black = new Microsoft.Xna.Framework.Color((byte)(150f * num4), (byte)(255f * num4), (byte)(10f * num4), a);
19158 }
19159 if (rare == 8)
19160 {
19161 black = new Microsoft.Xna.Framework.Color((byte)(255f * num4), (byte)(255f * num4), (byte)(10f * num4), a);
19162 }
19163 if (rare == 9)
19164 {
19165 black = new Microsoft.Xna.Framework.Color((byte)(5f * num4), (byte)(200f * num4), (byte)(255f * num4), a);
19166 }
19167 if (rare == 10)
19168 {
19169 black = new Microsoft.Xna.Framework.Color((byte)(255f * num4), (byte)(40f * num4), (byte)(100f * num4), a);
19170 }
19171 if (rare >= 11)
19172 {
19173 black = new Microsoft.Xna.Framework.Color((byte)(180f * num4), (byte)(40f * num4), (byte)(255f * num4), a);
19174 }
19175 if (diff == 1)
19176 {
19177 black = new Microsoft.Xna.Framework.Color((byte)((float)(int)mcColor.R * num4), (byte)((float)(int)mcColor.G * num4), (byte)((float)(int)mcColor.B * num4), a);
19178 }
19179 if (diff == 2)
19180 {
19181 black = new Microsoft.Xna.Framework.Color((byte)((float)(int)hcColor.R * num4), (byte)((float)(int)hcColor.G * num4), (byte)((float)(int)hcColor.B * num4), a);
19182 }
19183 if (hoverItem.expert || rare == -12)
19184 {
19185 black = new Microsoft.Xna.Framework.Color((byte)((float)DiscoR * num4), (byte)((float)DiscoG * num4), (byte)((float)DiscoB * num4), a);
19186 }
19187 }
19188 else if (array2[k])
19189 {
19190 black = ((!array3[k]) ? new Microsoft.Xna.Framework.Color((byte)(120f * num4), (byte)(190f * num4), (byte)(120f * num4), a) : new Microsoft.Xna.Framework.Color((byte)(190f * num4), (byte)(120f * num4), (byte)(120f * num4), a));
19191 }
19192 else if (k == numLines - 1)
19193 {
19194 black = color;
19195 }
19196 if (k == researchLine)
19197 {
19199 }
19201 }
19202 num16 += (int)(FontAssets.MouseText.Value.MeasureString(array[k]).Y + (float)num12);
19203 }
19204 }
19205
19207 {
19208 toolTipLine[0] = item.HoverName;
19209 if (item.favorited)
19210 {
19211 toolTipLine[numLines++] = Lang.tip[56].Value;
19212 toolTipLine[numLines++] = Lang.tip[57].Value;
19213 if (LocalPlayer.chest != -1)
19214 {
19217 {
19218 toolTipLine[numLines++] = Language.GetTextValue("UI.ItemCannotBePlacedInsideItself");
19219 }
19220 }
19221 }
19222 if (item.social)
19223 {
19224 toolTipLine[numLines] = Lang.tip[0].Value;
19225 numLines++;
19226 toolTipLine[numLines] = Lang.tip[1].Value;
19227 numLines++;
19228 }
19229 else
19230 {
19231 if (item.damage > 0 && (!item.notAmmo || item.useStyle != 0) && (item.type < 71 || item.type > 74 || player[myPlayer].HasItem(905)))
19232 {
19233 float num = 5E-06f;
19234 int damage = item.damage;
19235 damage = (int)((float)damage * ItemID.Sets.ToolTipDamageMultiplier[item.type]);
19236 if (item.melee)
19237 {
19238 toolTipLine[numLines] = string.Concat((int)(LocalPlayer.meleeDamage * (float)damage + num));
19239 toolTipLine[numLines] += Lang.tip[2].Value;
19240 }
19241 else if (item.ranged)
19242 {
19243 float num2 = LocalPlayer.rangedDamage;
19244 if (item.useAmmo == AmmoID.Arrow || item.useAmmo == AmmoID.Stake)
19245 {
19246 num2 = LocalPlayer.bowEffectiveDamage;
19247 if (LocalPlayer.archery)
19248 {
19249 num2 *= 1.1f;
19250 }
19251 }
19252 if (item.useAmmo == AmmoID.Bullet || item.useAmmo == AmmoID.CandyCorn)
19253 {
19254 num2 = LocalPlayer.gunEffectiveDamage;
19255 }
19256 if (item.useAmmo == AmmoID.Rocket || item.useAmmo == AmmoID.StyngerBolt || item.useAmmo == AmmoID.JackOLantern || item.useAmmo == AmmoID.NailFriendly || item.useAmmo == AmmoID.Coin || item.useAmmo == AmmoID.Flare || item.useAmmo == AmmoID.Dart || item.useAmmo == AmmoID.Snowball || item.useAmmo == AmmoID.Sand || item.useAmmo == AmmoID.FallenStar || item.useAmmo == AmmoID.Gel)
19257 {
19258 num2 = LocalPlayer.specialistEffectiveDamage;
19259 }
19260 if (item.type == 1156 || item.type == 3350 || item.type == 3210 || item.type == 160 || item.type == 3821)
19261 {
19262 num2 = LocalPlayer.specialistEffectiveDamage;
19263 }
19264 toolTipLine[numLines] = string.Concat((int)(num2 * (float)damage + num));
19265 toolTipLine[numLines] += Lang.tip[3].Value;
19266 }
19267 else if (item.magic)
19268 {
19269 toolTipLine[numLines] = string.Concat((int)(LocalPlayer.magicDamage * (float)damage + num));
19270 toolTipLine[numLines] += Lang.tip[4].Value;
19271 }
19272 else if (item.summon)
19273 {
19274 toolTipLine[numLines] = string.Concat((int)(LocalPlayer.minionDamage * (float)damage + num));
19275 toolTipLine[numLines] += Lang.tip[53].Value;
19276 }
19277 else
19278 {
19279 toolTipLine[numLines] = string.Concat(damage);
19280 toolTipLine[numLines] += Lang.tip[55].Value;
19281 }
19282 numLines++;
19283 if (item.melee)
19284 {
19285 int num3 = player[myPlayer].meleeCrit - player[myPlayer].inventory[player[myPlayer].selectedItem].crit + item.crit;
19286 toolTipLine[numLines] = num3 + Lang.tip[5].Value;
19287 numLines++;
19288 }
19289 else if (item.ranged)
19290 {
19291 int num4 = player[myPlayer].rangedCrit - player[myPlayer].inventory[player[myPlayer].selectedItem].crit + item.crit;
19292 toolTipLine[numLines] = num4 + Lang.tip[5].Value;
19293 numLines++;
19294 }
19295 else if (item.magic)
19296 {
19297 int num5 = player[myPlayer].magicCrit - player[myPlayer].inventory[player[myPlayer].selectedItem].crit + item.crit;
19298 toolTipLine[numLines] = num5 + Lang.tip[5].Value;
19299 numLines++;
19300 }
19301 if (item.useStyle != 0 && !item.summon)
19302 {
19303 if (item.useAnimation <= 8)
19304 {
19305 toolTipLine[numLines] = Lang.tip[6].Value;
19306 }
19307 else if (item.useAnimation <= 20)
19308 {
19309 toolTipLine[numLines] = Lang.tip[7].Value;
19310 }
19311 else if (item.useAnimation <= 25)
19312 {
19313 toolTipLine[numLines] = Lang.tip[8].Value;
19314 }
19315 else if (item.useAnimation <= 30)
19316 {
19317 toolTipLine[numLines] = Lang.tip[9].Value;
19318 }
19319 else if (item.useAnimation <= 35)
19320 {
19321 toolTipLine[numLines] = Lang.tip[10].Value;
19322 }
19323 else if (item.useAnimation <= 45)
19324 {
19325 toolTipLine[numLines] = Lang.tip[11].Value;
19326 }
19327 else if (item.useAnimation <= 55)
19328 {
19329 toolTipLine[numLines] = Lang.tip[12].Value;
19330 }
19331 else
19332 {
19333 toolTipLine[numLines] = Lang.tip[13].Value;
19334 }
19335 numLines++;
19336 }
19337 float num6 = item.knockBack;
19338 if (item.summon)
19339 {
19340 num6 += player[myPlayer].minionKB;
19341 }
19342 if ((player[myPlayer].magicQuiver && item.useAmmo == AmmoID.Arrow) || item.useAmmo == AmmoID.Stake)
19343 {
19344 num6 = (int)(num6 * 1.1f);
19345 }
19346 if (player[myPlayer].inventory[player[myPlayer].selectedItem].type == 3106 && item.type == 3106)
19347 {
19348 num6 += num6 * (1f - player[myPlayer].stealth);
19349 }
19350 if (num6 == 0f)
19351 {
19352 toolTipLine[numLines] = Lang.tip[14].Value;
19353 }
19354 else if ((double)num6 <= 1.5)
19355 {
19356 toolTipLine[numLines] = Lang.tip[15].Value;
19357 }
19358 else if (num6 <= 3f)
19359 {
19360 toolTipLine[numLines] = Lang.tip[16].Value;
19361 }
19362 else if (num6 <= 4f)
19363 {
19364 toolTipLine[numLines] = Lang.tip[17].Value;
19365 }
19366 else if (num6 <= 6f)
19367 {
19368 toolTipLine[numLines] = Lang.tip[18].Value;
19369 }
19370 else if (num6 <= 7f)
19371 {
19372 toolTipLine[numLines] = Lang.tip[19].Value;
19373 }
19374 else if (num6 <= 9f)
19375 {
19376 toolTipLine[numLines] = Lang.tip[20].Value;
19377 }
19378 else if (num6 <= 11f)
19379 {
19380 toolTipLine[numLines] = Lang.tip[21].Value;
19381 }
19382 else
19383 {
19384 toolTipLine[numLines] = Lang.tip[22].Value;
19385 }
19386 numLines++;
19387 }
19388 if (item.fishingPole > 0)
19389 {
19390 toolTipLine[numLines] = Language.GetTextValue("GameUI.PrecentFishingPower", item.fishingPole);
19391 numLines++;
19392 toolTipLine[numLines] = Language.GetTextValue("GameUI.BaitRequired");
19393 numLines++;
19394 }
19395 if (item.bait > 0)
19396 {
19397 toolTipLine[numLines] = Language.GetTextValue("GameUI.BaitPower", item.bait);
19398 numLines++;
19399 }
19400 if (item.headSlot > 0 || item.bodySlot > 0 || item.legSlot > 0 || item.accessory || projHook[item.shoot] || item.mountType != -1 || (item.buffType > 0 && (lightPet[item.buffType] || vanityPet[item.buffType])))
19401 {
19402 if ((item.type == 854 || item.type == 3035) && npcShop > 0)
19403 {
19404 toolTipLine[numLines] = Lang.tip[60].Value;
19405 }
19406 else
19407 {
19408 toolTipLine[numLines] = Lang.tip[23].Value;
19409 }
19410 numLines++;
19411 }
19412 if (item.tileWand > 0)
19413 {
19414 toolTipLine[numLines] = Lang.tip[52].Value + Lang.GetItemNameValue(item.tileWand);
19415 numLines++;
19416 }
19417 if (item.questItem)
19418 {
19419 toolTipLine[numLines] = Lang.inter[65].Value;
19420 numLines++;
19421 }
19422 if (item.vanity)
19423 {
19424 toolTipLine[numLines] = Lang.tip[24].Value;
19425 numLines++;
19426 }
19427 if (item.defense > 0)
19428 {
19429 toolTipLine[numLines] = item.defense + Lang.tip[25].Value;
19430 numLines++;
19431 }
19432 if (item.pick > 0)
19433 {
19434 toolTipLine[numLines] = item.pick + Lang.tip[26].Value;
19435 numLines++;
19436 }
19437 if (item.axe > 0)
19438 {
19439 toolTipLine[numLines] = item.axe * 5 + Lang.tip[27].Value;
19440 numLines++;
19441 }
19442 if (item.hammer > 0)
19443 {
19444 toolTipLine[numLines] = item.hammer + Lang.tip[28].Value;
19445 numLines++;
19446 }
19447 if (item.tileBoost != 0)
19448 {
19449 int tileBoost = item.tileBoost;
19450 if (tileBoost > 0)
19451 {
19452 toolTipLine[numLines] = "+" + tileBoost + Lang.tip[54].Value;
19453 }
19454 else
19455 {
19456 toolTipLine[numLines] = tileBoost + Lang.tip[54].Value;
19457 }
19458 numLines++;
19459 }
19460 if (item.healLife > 0)
19461 {
19462 if (item.type == 3001)
19463 {
19464 int healLife = item.healLife;
19465 int num7 = 120;
19466 toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.RestoresLifeRange", healLife, num7);
19467 }
19468 else
19469 {
19470 toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.RestoresLife", item.healLife);
19471 }
19472 numLines++;
19473 }
19474 if (item.healMana > 0)
19475 {
19476 toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.RestoresMana", item.healMana);
19477 numLines++;
19478 }
19479 if (item.mana > 0 && (item.type != 127 || !player[myPlayer].spaceGun))
19480 {
19481 toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.UsesMana", (int)((float)item.mana * player[myPlayer].manaCost));
19482 numLines++;
19483 }
19484 if (item.createWall > 0 || item.createTile > -1)
19485 {
19486 if (item.type != 213 && item.type != 5295 && item.tileWand < 1)
19487 {
19488 toolTipLine[numLines] = Lang.tip[33].Value;
19489 numLines++;
19490 }
19491 }
19492 else if (item.ammo > 0 && !item.notAmmo)
19493 {
19494 toolTipLine[numLines] = Lang.tip[34].Value;
19495 numLines++;
19496 }
19497 else if (item.consumable && !item.chlorophyteExtractinatorConsumable)
19498 {
19499 toolTipLine[numLines] = Lang.tip[35].Value;
19500 numLines++;
19501 }
19502 if (item.material)
19503 {
19504 toolTipLine[numLines] = Lang.tip[36].Value;
19505 numLines++;
19506 }
19507 if (item.ToolTip != null)
19508 {
19509 for (int i = 0; i < item.ToolTip.Lines; i++)
19510 {
19512 {
19513 toolTipLine[numLines] = Lang.tip[59].Value;
19514 numLines++;
19515 }
19516 else
19517 {
19518 toolTipLine[numLines] = item.ToolTip.GetLine(i);
19519 numLines++;
19520 }
19521 }
19522 }
19523 if (tenthAnniversaryWorld && item.type == 238)
19524 {
19525 toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.WizardHatDuringAnniversary");
19526 numLines++;
19527 }
19528 if (getGoodWorld && remixWorld)
19529 {
19530 if (item.type == 556 || item.type == 557 || item.type == 544)
19531 {
19532 numLines--;
19533 toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.MechSummonDuringEverything");
19534 numLines++;
19535 }
19536 }
19537 else if (item.type == 5334)
19538 {
19539 numLines--;
19540 toolTipLine[numLines] = "";
19541 numLines--;
19542 toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.MechdusaSummonNotDuringEverything");
19543 numLines++;
19544 }
19545 if ((item.type == 3818 || item.type == 3819 || item.type == 3820 || item.type == 3824 || item.type == 3825 || item.type == 3826 || item.type == 3829 || item.type == 3830 || item.type == 3831 || item.type == 3832 || item.type == 3833 || item.type == 3834) && !player[myPlayer].downedDD2EventAnyDifficulty)
19546 {
19547 toolTipLine[numLines] = Lang.misc[104].Value;
19548 numLines++;
19549 }
19550 if (item.buffType > 0 && BuffID.Sets.IsWellFed[item.buffType] && expertMode)
19551 {
19552 toolTipLine[numLines] = Lang.misc[40].Value;
19553 numLines++;
19554 }
19555 if (item.buffTime > 0)
19556 {
19557 string text = ((item.buffTime / 60 < 60) ? Language.GetTextValue("CommonItemTooltip.SecondDuration", Math.Round((double)item.buffTime / 60.0)) : Language.GetTextValue("CommonItemTooltip.MinuteDuration", Math.Round((double)(item.buffTime / 60) / 60.0)));
19559 numLines++;
19560 }
19561 if (item.type == 3262 || item.type == 3282 || item.type == 3283 || item.type == 3284 || item.type == 3285 || item.type == 3286 || item.type == 3316 || item.type == 3315 || item.type == 3317 || item.type == 3291 || item.type == 3389)
19562 {
19563 toolTipLine[numLines] = " ";
19565 numLines++;
19566 }
19567 if (item.prefix > 0)
19568 {
19570 if (item2 == null || item2.netID != item.netID)
19571 {
19572 item2 = new Item();
19573 item2.netDefaults(item.netID);
19574 }
19575 if (item2.damage != item.damage)
19576 {
19577 double num8 = (float)item.damage - (float)item2.damage;
19578 num8 = num8 / (double)item2.damage * 100.0;
19579 num8 = Math.Round(num8);
19580 if (num8 > 0.0)
19581 {
19582 toolTipLine[numLines] = "+" + num8 + Lang.tip[39].Value;
19583 }
19584 else
19585 {
19586 toolTipLine[numLines] = num8 + Lang.tip[39].Value;
19587 }
19588 if (num8 < 0.0)
19589 {
19590 badPreFixLine[numLines] = true;
19591 }
19592 preFixLine[numLines] = true;
19593 numLines++;
19594 }
19595 if (item2.useAnimation != item.useAnimation)
19596 {
19597 double num9 = (float)item.useAnimation - (float)item2.useAnimation;
19598 num9 = num9 / (double)item2.useAnimation * 100.0;
19599 num9 = Math.Round(num9);
19600 num9 *= -1.0;
19601 if (num9 > 0.0)
19602 {
19603 toolTipLine[numLines] = "+" + num9 + Lang.tip[40].Value;
19604 }
19605 else
19606 {
19607 toolTipLine[numLines] = num9 + Lang.tip[40].Value;
19608 }
19609 if (num9 < 0.0)
19610 {
19611 badPreFixLine[numLines] = true;
19612 }
19613 preFixLine[numLines] = true;
19614 numLines++;
19615 }
19616 if (item2.crit != item.crit)
19617 {
19618 double num10 = (float)item.crit - (float)item2.crit;
19619 if (num10 > 0.0)
19620 {
19621 toolTipLine[numLines] = "+" + num10 + Lang.tip[41].Value;
19622 }
19623 else
19624 {
19625 toolTipLine[numLines] = num10 + Lang.tip[41].Value;
19626 }
19627 if (num10 < 0.0)
19628 {
19629 badPreFixLine[numLines] = true;
19630 }
19631 preFixLine[numLines] = true;
19632 numLines++;
19633 }
19634 if (item2.mana != item.mana)
19635 {
19636 double num11 = (float)item.mana - (float)item2.mana;
19637 num11 = num11 / (double)item2.mana * 100.0;
19638 num11 = Math.Round(num11);
19639 if (num11 > 0.0)
19640 {
19641 toolTipLine[numLines] = "+" + num11 + Lang.tip[42].Value;
19642 }
19643 else
19644 {
19645 toolTipLine[numLines] = num11 + Lang.tip[42].Value;
19646 }
19647 if (num11 > 0.0)
19648 {
19649 badPreFixLine[numLines] = true;
19650 }
19651 preFixLine[numLines] = true;
19652 numLines++;
19653 }
19654 if (item2.scale != item.scale)
19655 {
19656 double num12 = item.scale - item2.scale;
19657 num12 = num12 / (double)item2.scale * 100.0;
19658 num12 = Math.Round(num12);
19659 if (num12 > 0.0)
19660 {
19661 toolTipLine[numLines] = "+" + num12 + Lang.tip[43].Value;
19662 }
19663 else
19664 {
19665 toolTipLine[numLines] = num12 + Lang.tip[43].Value;
19666 }
19667 if (num12 < 0.0)
19668 {
19669 badPreFixLine[numLines] = true;
19670 }
19671 preFixLine[numLines] = true;
19672 numLines++;
19673 }
19674 if (item2.shootSpeed != item.shootSpeed)
19675 {
19676 double num13 = item.shootSpeed - item2.shootSpeed;
19677 num13 = num13 / (double)item2.shootSpeed * 100.0;
19678 num13 = Math.Round(num13);
19679 if (num13 > 0.0)
19680 {
19681 toolTipLine[numLines] = "+" + num13 + Lang.tip[44].Value;
19682 }
19683 else
19684 {
19685 toolTipLine[numLines] = num13 + Lang.tip[44].Value;
19686 }
19687 if (num13 < 0.0)
19688 {
19689 badPreFixLine[numLines] = true;
19690 }
19691 preFixLine[numLines] = true;
19692 numLines++;
19693 }
19694 if (item2.knockBack != oldKB)
19695 {
19696 double num14 = oldKB - item2.knockBack;
19697 num14 = num14 / (double)item2.knockBack * 100.0;
19698 num14 = Math.Round(num14);
19699 if (num14 > 0.0)
19700 {
19701 toolTipLine[numLines] = "+" + num14 + Lang.tip[45].Value;
19702 }
19703 else
19704 {
19705 toolTipLine[numLines] = num14 + Lang.tip[45].Value;
19706 }
19707 if (num14 < 0.0)
19708 {
19709 badPreFixLine[numLines] = true;
19710 }
19711 preFixLine[numLines] = true;
19712 numLines++;
19713 }
19714 if (item.prefix == 62)
19715 {
19716 toolTipLine[numLines] = "+1" + Lang.tip[25].Value;
19717 preFixLine[numLines] = true;
19718 numLines++;
19719 }
19720 if (item.prefix == 63)
19721 {
19722 toolTipLine[numLines] = "+2" + Lang.tip[25].Value;
19723 preFixLine[numLines] = true;
19724 numLines++;
19725 }
19726 if (item.prefix == 64)
19727 {
19728 toolTipLine[numLines] = "+3" + Lang.tip[25].Value;
19729 preFixLine[numLines] = true;
19730 numLines++;
19731 }
19732 if (item.prefix == 65)
19733 {
19734 toolTipLine[numLines] = "+4" + Lang.tip[25].Value;
19735 preFixLine[numLines] = true;
19736 numLines++;
19737 }
19738 if (item.prefix == 66)
19739 {
19740 toolTipLine[numLines] = "+20 " + Lang.tip[31].Value;
19741 preFixLine[numLines] = true;
19742 numLines++;
19743 }
19744 if (item.prefix == 67)
19745 {
19746 toolTipLine[numLines] = "+2" + Lang.tip[5].Value;
19747 preFixLine[numLines] = true;
19748 numLines++;
19749 }
19750 if (item.prefix == 68)
19751 {
19752 toolTipLine[numLines] = "+4" + Lang.tip[5].Value;
19753 preFixLine[numLines] = true;
19754 numLines++;
19755 }
19756 if (item.prefix == 69)
19757 {
19758 toolTipLine[numLines] = "+1" + Lang.tip[39].Value;
19759 preFixLine[numLines] = true;
19760 numLines++;
19761 }
19762 if (item.prefix == 70)
19763 {
19764 toolTipLine[numLines] = "+2" + Lang.tip[39].Value;
19765 preFixLine[numLines] = true;
19766 numLines++;
19767 }
19768 if (item.prefix == 71)
19769 {
19770 toolTipLine[numLines] = "+3" + Lang.tip[39].Value;
19771 preFixLine[numLines] = true;
19772 numLines++;
19773 }
19774 if (item.prefix == 72)
19775 {
19776 toolTipLine[numLines] = "+4" + Lang.tip[39].Value;
19777 preFixLine[numLines] = true;
19778 numLines++;
19779 }
19780 if (item.prefix == 73)
19781 {
19782 toolTipLine[numLines] = "+1" + Lang.tip[46].Value;
19783 preFixLine[numLines] = true;
19784 numLines++;
19785 }
19786 if (item.prefix == 74)
19787 {
19788 toolTipLine[numLines] = "+2" + Lang.tip[46].Value;
19789 preFixLine[numLines] = true;
19790 numLines++;
19791 }
19792 if (item.prefix == 75)
19793 {
19794 toolTipLine[numLines] = "+3" + Lang.tip[46].Value;
19795 preFixLine[numLines] = true;
19796 numLines++;
19797 }
19798 if (item.prefix == 76)
19799 {
19800 toolTipLine[numLines] = "+4" + Lang.tip[46].Value;
19801 preFixLine[numLines] = true;
19802 numLines++;
19803 }
19804 if (item.prefix == 77)
19805 {
19806 toolTipLine[numLines] = "+1" + Lang.tip[47].Value;
19807 preFixLine[numLines] = true;
19808 numLines++;
19809 }
19810 if (item.prefix == 78)
19811 {
19812 toolTipLine[numLines] = "+2" + Lang.tip[47].Value;
19813 preFixLine[numLines] = true;
19814 numLines++;
19815 }
19816 if (item.prefix == 79)
19817 {
19818 toolTipLine[numLines] = "+3" + Lang.tip[47].Value;
19819 preFixLine[numLines] = true;
19820 numLines++;
19821 }
19822 if (item.prefix == 80)
19823 {
19824 toolTipLine[numLines] = "+4" + Lang.tip[47].Value;
19825 preFixLine[numLines] = true;
19826 numLines++;
19827 }
19828 }
19829 if (item.wornArmor && player[myPlayer].setBonus != "")
19830 {
19831 toolTipLine[numLines] = Lang.tip[48].Value + " " + player[myPlayer].setBonus;
19832 numLines++;
19833 }
19834 }
19835 if (item.expert)
19836 {
19837 toolTipLine[numLines] = Language.GetTextValue("GameUI.Expert");
19838 numLines++;
19839 }
19840 if (item.rare == -13)
19841 {
19842 toolTipLine[numLines] = Language.GetTextValue("GameUI.Master");
19843 numLines++;
19844 }
19845 if ((item.tooltipContext == 0 || item.tooltipContext == 2 || item.tooltipContext == 1 || item.tooltipContext == 3 || item.tooltipContext == 4 || item.tooltipContext == 32 || item.tooltipContext == 15 || item.tooltipContext == 6 || item.tooltipContext == 22 || item.tooltipContext == 7 || item.tooltipContext == 5) && LocalPlayer.difficulty == 3 && CreativeItemSacrificesCatalog.Instance.TryGetSacrificeCountCapToUnlockInfiniteItems(item.type, out var amountNeeded))
19846 {
19847 int sacrificeCount = LocalPlayerCreativeTracker.ItemSacrifices.GetSacrificeCount(item.type);
19848 if (amountNeeded - sacrificeCount > 0)
19849 {
19850 toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.CreativeSacrificeNeeded", amountNeeded - sacrificeCount);
19852 numLines++;
19853 }
19854 }
19855 string bestiaryNotes = item.BestiaryNotes;
19856 if (!string.IsNullOrWhiteSpace(bestiaryNotes))
19857 {
19858 string[] array = bestiaryNotes.Split('\n');
19859 foreach (string text2 in array)
19860 {
19862 }
19863 }
19864 }
19865
19866 private void MouseText_DrawBuffTooltip(string buffString, ref int X, ref int Y)
19867 {
19869 int num = 220;
19870 int num2 = 72;
19871 int num3 = -1;
19872 float num4 = 1f;
19874 Vector2 vector = FontAssets.MouseText.Value.MeasureString(buffString);
19875 list.Add(vector);
19876 int num5 = (int)((float)(screenHeight - Y - 24 - num2) * num4) / 20;
19877 if (num5 < 1)
19878 {
19879 num5 = 1;
19880 }
19881 if (bannerMouseOver)
19882 {
19883 int num6 = 0;
19884 for (int i = 0; i < 290; i++)
19885 {
19886 if (Item.BannerToNPC(i) != 0 && player[myPlayer].HasNPCBannerBuff(i))
19887 {
19888 num6++;
19890 Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(nPCNameValue);
19891 int num7 = X;
19892 int num8 = Y + (int)vector2.Y + num6 * 20 + 10;
19893 int num9 = 0;
19894 int num10 = num6 / num5;
19895 for (int j = 0; j < num10; j++)
19896 {
19897 num9++;
19898 num7 += num;
19899 num8 -= num5 * 20;
19900 }
19901 if ((float)(num7 - 24 - num) > (float)screenWidth * num4)
19902 {
19903 num3 = num6;
19904 break;
19905 }
19906 list.Add(new Vector2(num7, num8) + vector2 - p.ToVector2());
19907 }
19908 }
19909 }
19911 foreach (Vector2 item in list)
19912 {
19913 if (zero.X < item.X)
19914 {
19915 zero.X = item.X;
19916 }
19917 if (zero.Y < item.Y)
19918 {
19919 zero.Y = item.Y;
19920 }
19921 }
19922 if ((float)X + zero.X + 24f > (float)screenWidth * num4)
19923 {
19924 X = (int)((float)screenWidth * num4 - zero.X - 24f);
19925 }
19926 if ((float)Y + zero.Y + 4f > (float)screenHeight * num4)
19927 {
19928 Y = (int)((float)screenHeight * num4 - zero.Y - 4f);
19929 }
19930 for (int k = 0; k < 5; k++)
19931 {
19932 int num11 = X;
19933 int num12 = Y + (int)FontAssets.MouseText.Value.MeasureString(buffString).Y;
19935 switch (k)
19936 {
19937 case 0:
19938 num11 -= 2;
19939 break;
19940 case 1:
19941 num11 += 2;
19942 break;
19943 case 2:
19944 num12 -= 2;
19945 break;
19946 case 3:
19947 num12 += 2;
19948 break;
19949 default:
19951 break;
19952 }
19954 }
19955 if (!bannerMouseOver)
19956 {
19957 return;
19958 }
19959 int num13 = 0;
19960 for (int l = 0; l < 290; l++)
19961 {
19962 if (Item.BannerToNPC(l) == 0 || !player[myPlayer].HasNPCBannerBuff(l))
19963 {
19964 continue;
19965 }
19966 num13++;
19967 bool flag = false;
19968 for (int m = 0; m < 5; m++)
19969 {
19970 int num14 = X;
19971 int num15 = Y + (int)vector.Y + num13 * 20 + 10;
19972 int num16 = (num13 - 1) / num5;
19973 num14 += num * num16;
19974 num15 -= num5 * 20 * num16;
19976 if (num3 == num13)
19977 {
19978 text = Language.GetTextValue("UI.Ellipsis");
19979 flag = true;
19980 }
19982 switch (m)
19983 {
19984 case 0:
19985 num14 -= 2;
19986 break;
19987 case 1:
19988 num14 += 2;
19989 break;
19990 case 2:
19991 num15 -= 2;
19992 break;
19993 case 3:
19994 num15 += 2;
19995 break;
19996 default:
19997 {
19998 float num17 = (float)(int)mouseTextColor / 255f;
19999 color2 = new Microsoft.Xna.Framework.Color((byte)(80f * num17), (byte)(255f * num17), (byte)(120f * num17), mouseTextColor);
20000 break;
20001 }
20002 }
20004 }
20005 if (flag)
20006 {
20007 break;
20008 }
20009 }
20010 }
20011
20012 protected void DrawFPS()
20013 {
20014 if (showFrameRate)
20015 {
20016 string text = string.Concat(frameRate);
20017 text = text + " (" + (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer) + ")";
20018 text = text + " (" + (int)(gfxQuality * 100f) + "%)";
20019 string text2 = text + " " + debugWords;
20020 int num = 4;
20021 if (!gameMenu)
20022 {
20023 num = screenHeight - 24;
20024 }
20025 Vector2 vector = new Vector2(4f, num);
20026 Vector2 vector2 = new Vector2(0f, 0f);
20027 Vector2 vector3 = FontAssets.MouseText.Value.MeasureString(text2);
20029 {
20030 vector.X = (float)(screenWidth - 4) - vector3.X;
20031 }
20033 }
20034 }
20035
20036 public static void DrawGamepadInstructions()
20037 {
20039 {
20040 return;
20041 }
20043 PlayerInput.AllowExecutionOfGamepadInstructions = false;
20044 if (!GamepadDisableInstructionsDisplay && text.Length > 0 && (!player[myPlayer].dead || gameMenu))
20045 {
20046 float num = 35f;
20047 float num2 = 1f;
20049 if (gameMenu)
20050 {
20051 num = 55f;
20052 }
20053 if (menuMode == 0)
20054 {
20055 num += 32f;
20056 }
20058 float t = num2;
20062 }
20063 }
20064
20066 {
20067 int num = newColor.R;
20068 int num2 = newColor.G;
20069 int num3 = newColor.B;
20070 float num4 = 0.6f;
20071 switch (type)
20072 {
20073 case 25:
20074 num = (int)((float)(int)newColor.R * 0.95f);
20075 num2 = (int)((float)(int)newColor.G * 0.85f);
20076 num3 = (int)((double)(int)newColor.B * 1.1);
20077 break;
20078 case 117:
20079 num = (int)((float)(int)newColor.R * 1.1f);
20080 num2 = (int)((float)(int)newColor.G * 1f);
20081 num3 = (int)((double)(int)newColor.B * 1.2);
20082 break;
20083 case 204:
20084 num4 = 0.3f + (float)(int)mouseTextColor / 300f;
20085 num = (int)((float)(int)newColor.R * (1.3f * num4));
20086 if (num > 255)
20087 {
20088 num = 255;
20089 }
20090 return new Microsoft.Xna.Framework.Color(num, num2, num3, 255);
20091 case 211:
20092 num4 = 0.3f + (float)(int)mouseTextColor / 300f;
20093 num2 = (int)((float)(int)newColor.G * (1.5f * num4));
20094 num3 = (int)((float)(int)newColor.B * (1.1f * num4));
20095 break;
20096 case 147:
20097 case 161:
20098 num = (int)((float)(int)newColor.R * 1.1f);
20099 num2 = (int)((float)(int)newColor.G * 1.12f);
20100 num3 = (int)((double)(int)newColor.B * 1.15);
20101 break;
20102 case 163:
20103 num = (int)((float)(int)newColor.R * 1.05f);
20104 num2 = (int)((float)(int)newColor.G * 1.1f);
20105 num3 = (int)((double)(int)newColor.B * 1.15);
20106 break;
20107 case 164:
20108 num = (int)((float)(int)newColor.R * 1.1f);
20109 num2 = (int)((float)(int)newColor.G * 1.1f);
20110 num3 = (int)((double)(int)newColor.B * 1.2);
20111 break;
20112 case 178:
20113 num4 = 0.5f;
20114 num = (int)((float)(int)newColor.R * (1f + num4));
20115 num2 = (int)((float)(int)newColor.G * (1f + num4));
20116 num3 = (int)((float)(int)newColor.B * (1f + num4));
20117 break;
20118 case 185:
20119 case 186:
20120 num4 = 0.3f;
20121 num = (int)((float)(int)newColor.R * (1f + num4));
20122 num2 = (int)((float)(int)newColor.G * (1f + num4));
20123 num3 = (int)((float)(int)newColor.B * (1f + num4));
20124 break;
20125 case 262:
20126 case 263:
20127 case 264:
20128 case 265:
20129 case 266:
20130 case 267:
20131 case 268:
20132 num3 += 100;
20133 num += 100;
20134 num2 += 100;
20135 break;
20136 default:
20137 if (tileShine2[type])
20138 {
20139 num = (int)((float)(int)newColor.R * (1f + num4));
20140 num2 = (int)((float)(int)newColor.G * (1f + num4));
20141 num3 = (int)((float)(int)newColor.B * (1f + num4));
20142 }
20143 break;
20144 }
20145 float num5 = shimmerAlpha;
20146 if (num5 > 0f)
20147 {
20148 num = (int)((float)num * (1f - num5) + (float)num * shimmerShine.X * num5);
20149 num2 = (int)((float)num2 * (1f - num5) + (float)num2 * shimmerShine.Y * num5);
20150 num3 = (int)((float)num3 * (1f - num5) + (float)num3 * shimmerShine.Z * num5);
20151 }
20152 if (num > 255)
20153 {
20154 num = 255;
20155 }
20156 if (num2 > 255)
20157 {
20158 num2 = 255;
20159 }
20160 if (num3 > 255)
20161 {
20162 num3 = 255;
20163 }
20164 newColor.R = (byte)num;
20165 newColor.G = (byte)num2;
20166 newColor.B = (byte)num3;
20167 return new Microsoft.Xna.Framework.Color((byte)num, (byte)num2, (byte)num3, newColor.A);
20168 }
20169
20170 public static void shine(ref Vector3 newColor, int type)
20171 {
20172 float num = 0.6f;
20173 switch (type)
20174 {
20175 case 25:
20176 newColor.X *= 0.95f;
20177 newColor.Y *= 0.85f;
20178 newColor.Z *= 1.1f;
20179 break;
20180 case 117:
20181 newColor.X *= 1.1f;
20182 newColor.Z *= 1.2f;
20183 break;
20184 case 204:
20185 num = 0.3f + (float)(int)mouseTextColor / 300f;
20186 newColor.X *= 1.3f * num;
20187 break;
20188 case 211:
20189 num = 0.3f + (float)(int)mouseTextColor / 300f;
20190 newColor.Y *= 1.5f * num;
20191 newColor.Z *= 1.1f * num;
20192 break;
20193 case 147:
20194 case 161:
20195 newColor.X *= 1.1f;
20196 newColor.Y *= 1.12f;
20197 newColor.Z *= 1.15f;
20198 break;
20199 case 163:
20200 newColor.X *= 1.05f;
20201 newColor.Y *= 1.1f;
20202 newColor.Z *= 1.15f;
20203 break;
20204 case 164:
20205 newColor.X *= 1.1f;
20206 newColor.Y *= 1.1f;
20207 newColor.Z *= 1.2f;
20208 break;
20209 case 178:
20210 num = 0.5f;
20211 newColor.X *= 1f + num;
20212 newColor.Y *= 1f + num;
20213 newColor.Z *= 1f + num;
20214 break;
20215 case 185:
20216 case 186:
20217 num = 0.3f;
20218 newColor.X *= 1f + num;
20219 newColor.Y *= 1f + num;
20220 newColor.Z *= 1f + num;
20221 break;
20222 case 262:
20223 case 263:
20224 case 264:
20225 case 265:
20226 case 266:
20227 case 267:
20228 case 268:
20229 newColor.X += 0.39f;
20230 newColor.Y += 0.39f;
20231 newColor.Z += 0.39f;
20232 break;
20233 default:
20234 if (tileShine2[type])
20235 {
20236 newColor.X *= 1f + num;
20237 newColor.Y *= 1f + num;
20238 newColor.Z *= 1f + num;
20239 }
20240 break;
20241 }
20242 float num2 = shimmerAlpha;
20243 if (num2 > 0f)
20244 {
20245 shimmerShine.X = 1.2f;
20246 shimmerShine.Y = 1f;
20247 shimmerShine.Z = 1.6f;
20248 newColor.X = newColor.X * (1f - num2) + newColor.X * shimmerShine.X * num2;
20249 newColor.Y = newColor.Y * (1f - num2) + newColor.Y * shimmerShine.Y * num2;
20250 newColor.Z = newColor.Z * (1f - num2) + newColor.Z * shimmerShine.Z * num2;
20251 if (newColor.X > 1f)
20252 {
20253 newColor.X = 1f;
20254 }
20255 if (newColor.Y > 1f)
20256 {
20257 newColor.Y = 1f;
20258 }
20259 if (newColor.Z > 1f)
20260 {
20261 newColor.Z = 1f;
20262 }
20263 }
20264 }
20265
20270
20276
20278 {
20280 for (int i = 0; i < ContentThatNeedsRenderTargets.Count; i++)
20281 {
20283 }
20284 }
20285
20286 public static bool IsTileSpelunkable(Tile t)
20287 {
20288 return IsTileSpelunkable(t.type, t.frameX, t.frameY);
20289 }
20290
20291 public static bool IsTileSpelunkable(ushort typeCache, short tileFrameX, short tileFrameY)
20292 {
20293 if (tileSpelunker[typeCache])
20294 {
20295 return true;
20296 }
20297 if (typeCache == 185 && tileFrameY == 18 && tileFrameX >= 576 && tileFrameX <= 882)
20298 {
20299 return true;
20300 }
20301 if (typeCache == 186 && tileFrameX >= 864 && tileFrameX <= 1170)
20302 {
20303 return true;
20304 }
20305 return false;
20306 }
20307
20308 public static bool IsTileBiomeSightable(ushort type, short tileFrameX, short tileFrameY, ref Microsoft.Xna.Framework.Color sightColor)
20309 {
20310 if (TileID.Sets.CorruptBiomeSight[type] || (remixWorld && type == 474))
20311 {
20312 sightColor = new Microsoft.Xna.Framework.Color(200, 100, 240);
20313 return true;
20314 }
20315 if (TileID.Sets.CrimsonBiomeSight[type] || (remixWorld && type == 195))
20316 {
20317 sightColor = new Microsoft.Xna.Framework.Color(255, 100, 100);
20318 return true;
20319 }
20321 {
20322 sightColor = new Microsoft.Xna.Framework.Color(255, 160, 240);
20323 return true;
20324 }
20325 return false;
20326 }
20327
20332
20333 protected void DrawGoreBehind()
20334 {
20335 for (int i = 0; i < 600; i++)
20336 {
20337 if (!gore[i].active || gore[i].type <= 0)
20338 {
20339 continue;
20340 }
20341 bool flag = false;
20342 if (((gore[i].type >= 706 && gore[i].type <= 717) || gore[i].type == 943 || gore[i].type == 1147 || (gore[i].type >= 1160 && gore[i].type <= 1162)) && (gore[i].frame < 7 || gore[i].frame > 9))
20343 {
20344 flag = true;
20345 }
20346 if (flag)
20347 {
20348 LoadGore(gore[i].type);
20349 if (gore[i].Frame.ColumnCount > 1 || gore[i].Frame.RowCount > 1)
20350 {
20351 Microsoft.Xna.Framework.Rectangle sourceRectangle = gore[i].Frame.GetSourceRectangle(TextureAssets.Gore[gore[i].type].Value);
20352 Microsoft.Xna.Framework.Color alpha = gore[i].GetAlpha(Lighting.GetColor((int)((double)gore[i].position.X + (double)sourceRectangle.Width * 0.5) / 16, (int)(((double)gore[i].position.Y + (double)sourceRectangle.Height * 0.5) / 16.0)));
20353 spriteBatch.Draw(TextureAssets.Gore[gore[i].type].Value, new Vector2(gore[i].position.X - screenPosition.X + (float)(sourceRectangle.Width / 2), gore[i].position.Y - screenPosition.Y + (float)(sourceRectangle.Height / 2) - 2f), sourceRectangle, alpha, gore[i].rotation, new Vector2(sourceRectangle.Width / 2, sourceRectangle.Height / 2), gore[i].scale, SpriteEffects.None, 0f);
20354 }
20355 else
20356 {
20357 Microsoft.Xna.Framework.Color alpha2 = gore[i].GetAlpha(Lighting.GetColor((int)((double)gore[i].position.X + (double)TextureAssets.Gore[gore[i].type].Width() * 0.5) / 16, (int)(((double)gore[i].position.Y + (double)TextureAssets.Gore[gore[i].type].Height() * 0.5) / 16.0)));
20358 spriteBatch.Draw(TextureAssets.Gore[gore[i].type].Value, new Vector2(gore[i].position.X - screenPosition.X + (float)(TextureAssets.Gore[gore[i].type].Width() / 2), gore[i].position.Y - screenPosition.Y + (float)(TextureAssets.Gore[gore[i].type].Height() / 2)), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Gore[gore[i].type].Width(), TextureAssets.Gore[gore[i].type].Height()), alpha2, gore[i].rotation, new Vector2(TextureAssets.Gore[gore[i].type].Width() / 2, TextureAssets.Gore[gore[i].type].Height() / 2), gore[i].scale, SpriteEffects.None, 0f);
20359 }
20360 }
20361 }
20362 }
20363
20364 protected void DrawGore()
20365 {
20366 drawBackGore = false;
20367 for (int i = 0; i < 600; i++)
20368 {
20369 if (!gore[i].active || gore[i].type <= 0)
20370 {
20371 continue;
20372 }
20373 if (((gore[i].type >= 706 && gore[i].type <= 717) || gore[i].type == 943 || gore[i].type == 1147 || (gore[i].type >= 1160 && gore[i].type <= 1162)) && (gore[i].frame < 7 || gore[i].frame > 9))
20374 {
20375 drawBackGore = true;
20376 continue;
20377 }
20378 LoadGore(gore[i].type);
20379 if (gore[i].Frame.ColumnCount > 1 || gore[i].Frame.RowCount > 1)
20380 {
20381 Microsoft.Xna.Framework.Rectangle sourceRectangle = gore[i].Frame.GetSourceRectangle(TextureAssets.Gore[gore[i].type].Value);
20382 Vector2 vector = new Vector2(0f, 0f);
20383 if (gore[i].type == 1217)
20384 {
20385 vector.Y += 4f;
20386 }
20387 Microsoft.Xna.Framework.Color alpha = gore[i].GetAlpha(Lighting.GetColor((int)((double)gore[i].position.X + (double)sourceRectangle.Width * 0.5) / 16, (int)(((double)gore[i].position.Y + (double)sourceRectangle.Height * 0.5) / 16.0)));
20388 spriteBatch.Draw(TextureAssets.Gore[gore[i].type].Value, new Vector2(gore[i].position.X - screenPosition.X + (float)(sourceRectangle.Width / 2), gore[i].position.Y - screenPosition.Y + (float)(sourceRectangle.Height / 2) - 2f) + vector, sourceRectangle, alpha, gore[i].rotation, new Vector2(sourceRectangle.Width / 2, sourceRectangle.Height / 2), gore[i].scale, SpriteEffects.None, 0f);
20389 }
20390 else
20391 {
20392 Microsoft.Xna.Framework.Color alpha2 = gore[i].GetAlpha(Lighting.GetColor((int)((double)gore[i].position.X + (double)TextureAssets.Gore[gore[i].type].Width() * 0.5) / 16, (int)(((double)gore[i].position.Y + (double)TextureAssets.Gore[gore[i].type].Height() * 0.5) / 16.0)));
20393 spriteBatch.Draw(TextureAssets.Gore[gore[i].type].Value, new Vector2(gore[i].position.X - screenPosition.X + (float)(TextureAssets.Gore[gore[i].type].Width() / 2), gore[i].position.Y - screenPosition.Y + (float)(TextureAssets.Gore[gore[i].type].Height() / 2)), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Gore[gore[i].type].Width(), TextureAssets.Gore[gore[i].type].Height()), alpha2, gore[i].rotation, new Vector2(TextureAssets.Gore[gore[i].type].Width() / 2, TextureAssets.Gore[gore[i].type].Height() / 2), gore[i].scale, SpriteEffects.None, 0f);
20394 }
20395 }
20397 }
20398
20399 public void DrawHealthBar(float X, float Y, int Health, int MaxHealth, float alpha, float scale = 1f, bool noFlip = false)
20400 {
20401 if (Health <= 0)
20402 {
20403 return;
20404 }
20405 float num = (float)Health / (float)MaxHealth;
20406 if (num > 1f)
20407 {
20408 num = 1f;
20409 }
20410 int num2 = (int)(36f * num);
20411 float num3 = X - 18f * scale;
20412 float num4 = Y;
20413 if (player[myPlayer].gravDir == -1f && !noFlip)
20414 {
20415 num4 -= screenPosition.Y;
20416 num4 = screenPosition.Y + (float)screenHeight - num4;
20417 }
20418 float num5 = 0f;
20419 float num6 = 0f;
20420 float num7 = 0f;
20421 float num8 = 255f;
20422 num -= 0.1f;
20423 if ((double)num > 0.5)
20424 {
20425 num6 = 255f;
20426 num5 = 255f * (1f - num) * 2f;
20427 }
20428 else
20429 {
20430 num6 = 255f * num * 2f;
20431 num5 = 255f;
20432 }
20433 float num9 = 0.95f;
20434 num5 = num5 * alpha * num9;
20435 num6 = num6 * alpha * num9;
20436 num8 = num8 * alpha * num9;
20437 if (num5 < 0f)
20438 {
20439 num5 = 0f;
20440 }
20441 if (num5 > 255f)
20442 {
20443 num5 = 255f;
20444 }
20445 if (num6 < 0f)
20446 {
20447 num6 = 0f;
20448 }
20449 if (num6 > 255f)
20450 {
20451 num6 = 255f;
20452 }
20453 if (num8 < 0f)
20454 {
20455 num8 = 0f;
20456 }
20457 if (num8 > 255f)
20458 {
20459 num8 = 255f;
20460 }
20461 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((byte)num5, (byte)num6, (byte)num7, (byte)num8);
20462 if (num2 < 3)
20463 {
20464 num2 = 3;
20465 }
20466 if (num2 < 34)
20467 {
20468 if (num2 < 36)
20469 {
20470 spriteBatch.Draw(TextureAssets.Hb2.Value, new Vector2(num3 - screenPosition.X + (float)num2 * scale, num4 - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(2, 0, 2, TextureAssets.Hb2.Height()), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f);
20471 }
20472 if (num2 < 34)
20473 {
20474 spriteBatch.Draw(TextureAssets.Hb2.Value, new Vector2(num3 - screenPosition.X + (float)(num2 + 2) * scale, num4 - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(num2 + 2, 0, 36 - num2 - 2, TextureAssets.Hb2.Height()), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f);
20475 }
20476 if (num2 > 2)
20477 {
20478 spriteBatch.Draw(TextureAssets.Hb1.Value, new Vector2(num3 - screenPosition.X, num4 - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, num2 - 2, TextureAssets.Hb1.Height()), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f);
20479 }
20480 spriteBatch.Draw(TextureAssets.Hb1.Value, new Vector2(num3 - screenPosition.X + (float)(num2 - 2) * scale, num4 - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(32, 0, 2, TextureAssets.Hb1.Height()), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f);
20481 }
20482 else
20483 {
20484 if (num2 < 36)
20485 {
20486 spriteBatch.Draw(TextureAssets.Hb2.Value, new Vector2(num3 - screenPosition.X + (float)num2 * scale, num4 - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(num2, 0, 36 - num2, TextureAssets.Hb2.Height()), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f);
20487 }
20488 spriteBatch.Draw(TextureAssets.Hb1.Value, new Vector2(num3 - screenPosition.X, num4 - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, num2, TextureAssets.Hb1.Height()), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f);
20489 }
20490 }
20491
20492 public static float NPCAddHeight(NPC theNPC)
20493 {
20494 float num = 0f;
20495 if (theNPC.type == 125)
20496 {
20497 num = 30f;
20498 }
20499 else if (theNPC.type == 54)
20500 {
20501 num = 2f;
20502 }
20503 else if (theNPC.type == 205)
20504 {
20505 num = 8f;
20506 }
20507 else if (theNPC.type == 182)
20508 {
20509 num = 24f;
20510 }
20511 else if (theNPC.type == 178)
20512 {
20513 num = 2f;
20514 }
20515 else if (theNPC.type == 126)
20516 {
20517 num = 30f;
20518 }
20519 else if (theNPC.type == 6 || theNPC.type == 173)
20520 {
20521 num = 26f;
20522 }
20523 else if (theNPC.type == 94)
20524 {
20525 num = 14f;
20526 }
20527 else if (theNPC.type == 7 || theNPC.type == 8 || theNPC.type == 9)
20528 {
20529 num = 13f;
20530 }
20531 else if (theNPC.type == 98 || theNPC.type == 99 || theNPC.type == 100)
20532 {
20533 num = 13f;
20534 }
20535 else if (theNPC.type == 95 || theNPC.type == 96 || theNPC.type == 97)
20536 {
20537 num = 13f;
20538 }
20539 else if (theNPC.type == 10 || theNPC.type == 11 || theNPC.type == 12)
20540 {
20541 num = 8f;
20542 }
20543 else if (theNPC.type == 13 || theNPC.type == 14 || theNPC.type == 15)
20544 {
20545 num = 26f;
20546 }
20547 else if (theNPC.type == 175)
20548 {
20549 num = 4f;
20550 }
20551 else if (theNPC.type == 520)
20552 {
20553 num = 2f;
20554 }
20555 else if (theNPC.type >= 412 && theNPC.type <= 414)
20556 {
20557 num = 18f;
20558 }
20559 else if (theNPC.type == 48)
20560 {
20561 num = 32f;
20562 }
20563 else if (theNPC.type == 49 || theNPC.type == 51)
20564 {
20565 num = 4f;
20566 }
20567 else if (theNPC.type == 60)
20568 {
20569 num = 10f;
20570 }
20571 else if (theNPC.type == 62 || theNPC.type == 66 || theNPC.type == 156)
20572 {
20573 num = 14f;
20574 }
20575 else if (theNPC.type == 63 || theNPC.type == 64 || theNPC.type == 103)
20576 {
20577 num = 4f;
20578 }
20579 else if (theNPC.type == 65)
20580 {
20581 num = 5f;
20582 }
20583 else if (theNPC.type == 69)
20584 {
20585 num = 4f;
20586 }
20587 else if (theNPC.type == 70)
20588 {
20589 num = -4f;
20590 }
20591 else if (theNPC.type == 72)
20592 {
20593 num = -2f;
20594 }
20595 else if (theNPC.type == 83 || theNPC.type == 84)
20596 {
20597 num = 20f;
20598 }
20599 else if (theNPC.type == 150 || theNPC.type == 151 || theNPC.type == 158)
20600 {
20601 num = 10f;
20602 }
20603 else if (theNPC.type == 152)
20604 {
20605 num = 6f;
20606 }
20607 else if (theNPC.type == 153 || theNPC.type == 154)
20608 {
20609 num = 2f;
20610 }
20611 else if (theNPC.type == 165 || theNPC.type == 237 || theNPC.type == 238 || theNPC.type == 240 || theNPC.type == 531)
20612 {
20613 num = 10f;
20614 }
20615 else if (theNPC.type == 39 || theNPC.type == 40 || theNPC.type == 41)
20616 {
20617 num = 26f;
20618 }
20619 else if (theNPC.type >= 87 && theNPC.type <= 92)
20620 {
20621 num = 56f;
20622 }
20623 else if (theNPC.type >= 134 && theNPC.type <= 136)
20624 {
20625 num = 30f;
20626 }
20627 else if (theNPC.type == 169)
20628 {
20629 num = 8f;
20630 }
20631 else if (theNPC.type == 174)
20632 {
20633 num = 6f;
20634 }
20635 else if (theNPC.type == 369)
20636 {
20637 num = 2f;
20638 }
20639 else if (theNPC.type == 376)
20640 {
20641 num = 6f;
20642 }
20643 else if (theNPC.type == 579)
20644 {
20645 num = -2f;
20646 }
20647 else if (theNPC.type == 613 || theNPC.type == 612)
20648 {
20649 num = 2f;
20650 }
20651 switch (theNPC.type)
20652 {
20653 case 269:
20654 case 270:
20655 case 271:
20656 case 274:
20657 case 277:
20658 num -= 2f;
20659 break;
20660 }
20661 if (theNPC.townNPC && theNPC.ai[0] == 5f)
20662 {
20663 num -= 4f;
20664 if (theNPC.type == 637 || theNPC.type == 656 || NPCID.Sets.IsTownSlime[theNPC.type])
20665 {
20666 num -= 10f;
20667 }
20668 }
20669 if (theNPC.type == 671 || theNPC.type == 672 || theNPC.type == 673 || theNPC.type == 674 || theNPC.type == 675)
20670 {
20671 num += 10f;
20672 }
20673 return num * theNPC.scale;
20674 }
20675
20676 protected void DrawProjectiles()
20677 {
20680 int num = 0;
20681 CurrentDrawnEntity = null;
20683 if (ignoreErrors)
20684 {
20685 for (int i = 0; i < 1000; i++)
20686 {
20687 if (projectile[i].active && projectile[i].type > 0 && !projectile[i].hide)
20688 {
20689 num++;
20690 try
20691 {
20692 DrawProj(i);
20693 }
20694 catch (Exception e)
20695 {
20697 projectile[i].active = false;
20698 }
20699 }
20700 }
20701 }
20702 else
20703 {
20704 for (int j = 0; j < 1000; j++)
20705 {
20706 if (projectile[j].active && projectile[j].type > 0 && !projectile[j].hide)
20707 {
20708 DrawProj(j);
20709 }
20710 }
20711 }
20712 CurrentDrawnEntity = null;
20714 spriteBatch.End();
20716 }
20717
20719 {
20720 int result = 0;
20721 if (proj.minion && proj.owner != 255)
20722 {
20723 result = player[proj.owner].cMinion;
20724 }
20725 if (projHook[proj.type] && proj.owner != 255)
20726 {
20727 result = player[proj.owner].cGrapple;
20728 }
20729 if (projPet[proj.type] && !proj.minion && proj.owner != 255 && proj.damage == 0 && !ProjectileID.Sets.LightPet[proj.type])
20730 {
20731 result = player[proj.owner].cPet;
20732 }
20733 if (!proj.minion && proj.owner != 255 && proj.damage == 0 && ProjectileID.Sets.LightPet[proj.type])
20734 {
20735 result = player[proj.owner].cLight;
20736 }
20737 if (proj.owner != 255)
20738 {
20739 switch (proj.type)
20740 {
20741 case 623:
20742 case 1020:
20743 result = player[proj.owner].cPet;
20744 break;
20745 case 818:
20746 result = player[proj.owner].cMinion;
20747 break;
20748 }
20749 }
20750 return result;
20751 }
20752
20754 {
20757 if (gameMenu)
20758 {
20759 return;
20760 }
20761 Player player = null;
20762 for (int i = 0; i < 255; i++)
20763 {
20764 player = Main.player[i];
20765 if (i != myPlayer && player.active && !player.outOfRange)
20766 {
20767 if (player.isLockedToATile)
20768 {
20770 }
20771 else
20772 {
20774 }
20775 }
20776 }
20778 if (player.isLockedToATile)
20779 {
20781 }
20782 else
20783 {
20785 }
20786 }
20787
20788 protected void DrawPlayers_BehindNPCs()
20789 {
20792 }
20793
20799
20801 {
20802 Texture2D value = TextureAssets.Extra[78].Value;
20803 Vector2 origin = new Vector2(68f, 94f);
20804 Microsoft.Xna.Framework.Rectangle value2 = value.Frame(1, 8, 0, frameNumber);
20807 spriteBatch.Draw(value, position, value2, passedColor, 0f, origin, scale, SpriteEffects.None, 0f);
20808 }
20809
20810 protected void DrawNPCs(bool behindTiles = false)
20811 {
20812 bool flag = false;
20814 for (int num = 199; num >= 0; num--)
20815 {
20816 try
20817 {
20818 if (npc[num].active && npc[num].type > 0 && npc[num].type < NPCID.Count && !npc[num].hide)
20819 {
20820 npc[num].position += npc[num].netOffset;
20821 if (npc[num].behindTiles == behindTiles)
20822 {
20823 if (npc[num].type == 125 || npc[num].type == 126)
20824 {
20825 if (!NPC.IsMechQueenUp && !flag)
20826 {
20827 flag = true;
20828 for (int i = 0; i < 200; i++)
20829 {
20830 if (!npc[i].active || num == i || (npc[i].type != 125 && npc[i].type != 126))
20831 {
20832 continue;
20833 }
20834 float scale = npc[i].scale;
20835 float x = npc[i].Center.X;
20836 float num2 = npc[i].Bottom.Y - (float)npc[i].height * 0.5f * scale;
20837 float x2 = npc[num].Center.X;
20838 float y = npc[num].Bottom.Y - (float)npc[num].height * 0.5f * scale;
20839 Vector2 vector = new Vector2(x2, y);
20840 float num3 = x - vector.X;
20841 float num4 = num2 - vector.Y;
20842 float rotation = (float)Math.Atan2(num4, num3) - 1.57f;
20843 bool flag2 = true;
20844 float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
20845 if (num5 > 2000f)
20846 {
20847 flag2 = false;
20848 }
20849 float num6 = 40f * scale;
20850 while (flag2)
20851 {
20852 num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
20853 if (num5 < num6)
20854 {
20855 flag2 = false;
20856 continue;
20857 }
20858 num5 = (float)TextureAssets.Chain12.Height() * scale / num5;
20859 num3 *= num5;
20860 num4 *= num5;
20861 vector.X += num3;
20862 vector.Y += num4;
20863 num3 = x - vector.X;
20864 num4 = num2 - vector.Y;
20865 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f));
20866 spriteBatch.Draw(TextureAssets.Chain12.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain12.Width(), TextureAssets.Chain12.Height()), color, rotation, new Vector2((float)TextureAssets.Chain12.Width() * 0.5f, (float)TextureAssets.Chain12.Height() * 0.5f), scale, SpriteEffects.None, 0f);
20867 }
20868 }
20869 }
20870 }
20871 else if (npc[num].type == 263 && npc[num].aiStyle == 52 && NPC.plantBoss >= 0)
20872 {
20873 Vector2 vector2 = new Vector2(npc[num].position.X + (float)(npc[num].width / 2), npc[num].position.Y + (float)(npc[num].height / 2));
20874 float num7 = npc[NPC.plantBoss].Center.X - vector2.X;
20875 float num8 = npc[NPC.plantBoss].Center.Y - vector2.Y;
20876 float rotation2 = (float)Math.Atan2(num8, num7) - 1.57f;
20877 bool flag3 = true;
20878 while (flag3)
20879 {
20880 int num9 = 16;
20881 int num10 = 32;
20882 float num11 = (float)Math.Sqrt(num7 * num7 + num8 * num8);
20883 if (num11 < (float)num10)
20884 {
20885 num9 = (int)num11 - num10 + num9;
20886 flag3 = false;
20887 }
20888 num11 = (float)num9 / num11;
20889 num7 *= num11;
20890 num8 *= num11;
20891 vector2.X += num7;
20892 vector2.Y += num8;
20893 num7 = npc[NPC.plantBoss].Center.X - vector2.X + npc[NPC.plantBoss].netOffset.X;
20894 num8 = npc[NPC.plantBoss].Center.Y - vector2.Y + npc[NPC.plantBoss].netOffset.Y;
20895 Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)vector2.X / 16, (int)(vector2.Y / 16f));
20896 spriteBatch.Draw(TextureAssets.Chain26.Value, new Vector2(vector2.X - screenPosition.X, vector2.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain26.Width(), num9), color2, rotation2, new Vector2((float)TextureAssets.Chain26.Width() * 0.5f, (float)TextureAssets.Chain26.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
20897 }
20898 }
20899 else if (npc[num].type == 264 && npc[num].aiStyle == 53 && NPC.plantBoss >= 0)
20900 {
20901 int num12 = NPC.plantBoss;
20902 if (npc[num].ai[3] > 0f)
20903 {
20904 num12 = (int)npc[num].ai[3] - 1;
20905 }
20906 Vector2 vector3 = new Vector2(npc[num].position.X + (float)(npc[num].width / 2), npc[num].position.Y + (float)(npc[num].height / 2));
20907 float num13 = npc[num12].Center.X - vector3.X;
20908 float num14 = npc[num12].Center.Y - vector3.Y;
20909 float rotation3 = (float)Math.Atan2(num14, num13) - 1.57f;
20910 bool flag4 = true;
20911 while (flag4)
20912 {
20913 int num15 = 16;
20914 int num16 = 32;
20915 float num17 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
20916 if (num17 < (float)num16)
20917 {
20918 num15 = (int)num17 - num16 + num15;
20919 flag4 = false;
20920 }
20921 num17 = (float)num15 / num17;
20922 num13 *= num17;
20923 num14 *= num17;
20924 vector3.X += num13;
20925 vector3.Y += num14;
20926 num13 = npc[num12].Center.X - vector3.X + npc[num12].netOffset.X;
20927 num14 = npc[num12].Center.Y - vector3.Y + npc[num12].netOffset.Y;
20928 Microsoft.Xna.Framework.Color color3 = Lighting.GetColor((int)vector3.X / 16, (int)(vector3.Y / 16f));
20929 spriteBatch.Draw(TextureAssets.Chain27.Value, new Vector2(vector3.X - screenPosition.X, vector3.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain27.Width(), num15), color3, rotation3, new Vector2((float)TextureAssets.Chain27.Width() * 0.5f, (float)TextureAssets.Chain27.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
20930 }
20931 }
20932 if (NPCID.Sets.MustAlwaysDraw[npc[num].type] || rectangle.Intersects(new Microsoft.Xna.Framework.Rectangle((int)npc[num].position.X, (int)npc[num].position.Y, npc[num].width, npc[num].height)))
20933 {
20934 DrawNPCCheckAlt(npc[num]);
20935 DrawNPC(num, behindTiles);
20936 }
20937 }
20938 npc[num].position -= npc[num].netOffset;
20939 }
20940 }
20941 catch
20942 {
20943 npc[num].active = false;
20944 }
20945 }
20946 }
20947
20948 protected void DrawNPCCheckAlt(NPC n)
20949 {
20950 if (TownNPCProfiles.Instance.GetProfile(n.type, out var profile))
20951 {
20952 TextureAssets.Npc[n.type] = profile.GetTextureNPCShouldUse(n);
20953 }
20954 }
20955
20956 protected void DrawNPC(int iNPCIndex, bool behindTiles)
20957 {
20961 }
20962
20964 {
20965 Texture2D value = TextureAssets.Extra[185].Value;
20966 Microsoft.Xna.Framework.Rectangle rectangle = value.Frame(1, 4, 0, (int)rCurrentNPC.localAI[3] / 6);
20967 float scale = 0.8f;
20968 for (int i = 0; i < 2; i++)
20969 {
20970 float x = 1f;
20971 float num = 0f;
20972 SpriteEffects effects = SpriteEffects.None;
20973 if (i == 1)
20974 {
20975 x = 0f;
20976 num = 0f - num + 2f;
20977 effects = SpriteEffects.FlipHorizontally;
20978 }
20979 Vector2 origin = rectangle.Size() * new Vector2(x, 0.5f);
20980 Vector2 vector = new Vector2(drawCenter.X + num, drawCenter.Y);
20981 if (rCurrentNPC.rotation != 0f)
20982 {
20983 vector = vector.RotatedBy(rCurrentNPC.rotation, rCurrentNPC.Bottom);
20984 }
20985 vector -= screenPos;
20986 float num2 = MathHelper.Clamp(rCurrentNPC.velocity.Y, -6f, 6f) * -0.1f;
20987 if (i == 0)
20988 {
20989 num2 *= -1f;
20990 }
20991 mySpriteBatch.Draw(value, vector, rectangle, originColor, rCurrentNPC.rotation + num2, origin, scale, effects, 0f);
20992 }
20993 }
20994
20996 {
20997 int type = rCurrentNPC.type;
20998 rCurrentNPC.SetFrameSize();
20999 if (rCurrentNPC.realLife == -1 && rCurrentNPC.life >= rCurrentNPC.lifeMax && !rCurrentNPC.boss)
21000 {
21001 bool flag = Lighting.GetColor((int)((double)rCurrentNPC.position.X + (double)rCurrentNPC.width * 0.5) / 16, (int)(((double)rCurrentNPC.position.Y + (double)rCurrentNPC.height * 0.5) / 16.0)).ToVector3().Length() > 0.4325f;
21002 bool flag2 = false;
21004 {
21005 flag2 = true;
21006 }
21007 else if (rCurrentNPC.Distance(Main.player[myPlayer].Center) < 350f && flag)
21008 {
21009 flag2 = true;
21010 }
21011 if (flag2 && rCurrentNPC.lifeMax < 5)
21012 {
21013 flag2 = false;
21014 }
21015 if (flag2 && rCurrentNPC.aiStyle == 25 && rCurrentNPC.ai[0] == 0f)
21016 {
21017 flag2 = false;
21018 }
21019 if (flag2)
21020 {
21021 rCurrentNPC.nameOver = MathHelper.Clamp(rCurrentNPC.nameOver + 0.025f, 0f, 1f);
21022 }
21023 else
21024 {
21025 rCurrentNPC.nameOver = MathHelper.Clamp(rCurrentNPC.nameOver - 0.025f, 0f, 1f);
21026 }
21027 }
21028 else
21029 {
21030 rCurrentNPC.nameOver = MathHelper.Clamp(rCurrentNPC.nameOver - 0.025f, 0f, 1f);
21031 }
21032 if (type == 1 && rCurrentNPC.ai[0] == -999f)
21033 {
21034 return;
21035 }
21036 if (type == 101)
21037 {
21038 bool flag3 = true;
21039 Vector2 vector = new Vector2(rCurrentNPC.position.X + (float)(rCurrentNPC.width / 2), rCurrentNPC.position.Y + (float)(rCurrentNPC.height / 2));
21040 float num = rCurrentNPC.ai[0] * 16f + 8f - vector.X;
21041 float num2 = rCurrentNPC.ai[1] * 16f + 8f - vector.Y;
21042 float rotation = (float)Math.Atan2(num2, num) - 1.57f;
21043 bool flag4 = true;
21044 while (flag4)
21045 {
21046 float num3 = 0.75f;
21047 int height = 28;
21048 float num4 = (float)Math.Sqrt(num * num + num2 * num2);
21049 if (num4 < 28f * num3)
21050 {
21051 height = (int)num4 - 40 + 28;
21052 flag4 = false;
21053 }
21054 num4 = 20f * num3 / num4;
21055 num *= num4;
21056 num2 *= num4;
21057 vector.X += num;
21058 vector.Y += num2;
21059 num = rCurrentNPC.ai[0] * 16f + 8f - vector.X;
21060 num2 = rCurrentNPC.ai[1] * 16f + 8f - vector.Y;
21061 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f));
21062 if (rCurrentNPC.IsABestiaryIconDummy)
21063 {
21064 color = rCurrentNPC.GetBestiaryEntryColor();
21065 }
21066 if (!flag3)
21067 {
21068 flag3 = true;
21069 mySpriteBatch.Draw(TextureAssets.Chain10.Value, new Vector2(vector.X - screenPos.X, vector.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain10.Width(), height), color, rotation, new Vector2((float)TextureAssets.Chain10.Width() * 0.5f, (float)TextureAssets.Chain10.Height() * 0.5f), num3, SpriteEffects.None, 0f);
21070 }
21071 else
21072 {
21073 flag3 = false;
21074 mySpriteBatch.Draw(TextureAssets.Chain11.Value, new Vector2(vector.X - screenPos.X, vector.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain10.Width(), height), color, rotation, new Vector2((float)TextureAssets.Chain10.Width() * 0.5f, (float)TextureAssets.Chain10.Height() * 0.5f), num3, SpriteEffects.None, 0f);
21075 }
21076 }
21077 }
21078 else if (rCurrentNPC.aiStyle == 13)
21079 {
21080 Vector2 vector2 = new Vector2(rCurrentNPC.position.X + (float)(rCurrentNPC.width / 2), rCurrentNPC.position.Y + (float)(rCurrentNPC.height / 2));
21081 float num5 = rCurrentNPC.ai[0] * 16f + 8f - vector2.X;
21082 float num6 = rCurrentNPC.ai[1] * 16f + 8f - vector2.Y;
21083 float rotation2 = (float)Math.Atan2(num6, num5) - 1.57f;
21084 bool flag5 = true;
21085 while (flag5)
21086 {
21087 int num7 = 28;
21088 int num8 = 40;
21089 if (type == 259 || type == 260)
21090 {
21091 num8 = 20;
21092 num7 = 12;
21093 }
21094 float num9 = (float)Math.Sqrt(num5 * num5 + num6 * num6);
21095 if (num9 < (float)num8)
21096 {
21097 num7 = (int)num9 - num8 + num7;
21098 flag5 = false;
21099 }
21100 num9 = (float)num7 / num9;
21101 num5 *= num9;
21102 num6 *= num9;
21103 vector2.X += num5;
21104 vector2.Y += num6;
21105 num5 = rCurrentNPC.ai[0] * 16f + 8f - vector2.X;
21106 num6 = rCurrentNPC.ai[1] * 16f + 8f - vector2.Y;
21107 Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)vector2.X / 16, (int)(vector2.Y / 16f));
21108 if (rCurrentNPC.IsABestiaryIconDummy)
21109 {
21110 color2 = rCurrentNPC.GetBestiaryEntryColor();
21111 }
21112 if (type == 259 || type == 260)
21113 {
21114 color2.B = byte.MaxValue;
21115 if (color2.R < 100)
21116 {
21117 color2.R = 100;
21118 }
21119 if (color2.G < 150)
21120 {
21121 color2.G = 150;
21122 }
21123 }
21124 switch (type)
21125 {
21126 case 56:
21127 mySpriteBatch.Draw(TextureAssets.Chain5.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain4.Width(), num7), color2, rotation2, new Vector2((float)TextureAssets.Chain4.Width() * 0.5f, (float)TextureAssets.Chain4.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21128 break;
21129 case 175:
21130 mySpriteBatch.Draw(TextureAssets.Chain14.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain14.Width(), num7), color2, rotation2, new Vector2((float)TextureAssets.Chain14.Width() * 0.5f, (float)TextureAssets.Chain14.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21131 break;
21132 case 259:
21133 mySpriteBatch.Draw(TextureAssets.Chain24.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain24.Width(), num7), color2, rotation2, new Vector2((float)TextureAssets.Chain24.Width() * 0.5f, (float)TextureAssets.Chain24.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21134 break;
21135 case 260:
21136 mySpriteBatch.Draw(TextureAssets.Chain25.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain25.Width(), num7), color2, rotation2, new Vector2((float)TextureAssets.Chain25.Width() * 0.5f, (float)TextureAssets.Chain25.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21137 break;
21138 default:
21139 mySpriteBatch.Draw(TextureAssets.Chain4.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain4.Width(), num7), color2, rotation2, new Vector2((float)TextureAssets.Chain4.Width() * 0.5f, (float)TextureAssets.Chain4.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21140 break;
21141 }
21142 }
21143 }
21144 if (type == 327)
21145 {
21146 float rotation3 = 0f;
21147 Vector2 vector3 = new Vector2(rCurrentNPC.Center.X, rCurrentNPC.Center.Y + 80f);
21148 int num10 = (int)rCurrentNPC.localAI[1];
21151 }
21152 if (type == 328)
21153 {
21154 Vector2 vector4 = new Vector2(rCurrentNPC.position.X + (float)rCurrentNPC.width * 0.5f - 5f * rCurrentNPC.ai[0], rCurrentNPC.position.Y + 20f);
21155 for (int i = 0; i < 2; i++)
21156 {
21157 float num11 = npc[(int)rCurrentNPC.ai[1]].position.X + (float)(npc[(int)rCurrentNPC.ai[1]].width / 2) - vector4.X;
21158 float num12 = npc[(int)rCurrentNPC.ai[1]].position.Y + (float)(npc[(int)rCurrentNPC.ai[1]].height / 2) - 30f - vector4.Y;
21159 float num13 = 0f;
21160 if (i == 0)
21161 {
21162 num11 -= 200f * rCurrentNPC.ai[0];
21163 num12 += 130f;
21164 num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12);
21165 num13 = 92f / num13;
21166 vector4.X += num11 * num13;
21167 vector4.Y += num12 * num13;
21168 }
21169 else
21170 {
21171 num11 -= 50f * rCurrentNPC.ai[0];
21172 num12 += 80f;
21173 num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12);
21174 num13 = 60f / num13;
21175 vector4.X += num11 * num13;
21176 vector4.Y += num12 * num13;
21177 }
21178 float rotation4 = (float)Math.Atan2(num12, num11) - 1.57f;
21179 Microsoft.Xna.Framework.Color color4 = Lighting.GetColor((int)vector4.X / 16, (int)(vector4.Y / 16f));
21180 mySpriteBatch.Draw(TextureAssets.PumpkingArm.Value, new Vector2(vector4.X - screenPos.X, vector4.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PumpkingArm.Width(), TextureAssets.PumpkingArm.Height()), color4, rotation4, new Vector2((float)TextureAssets.PumpkingArm.Width() * 0.5f, (float)TextureAssets.PumpkingArm.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21181 if (i == 0)
21182 {
21183 vector4.X += num11 * num13 / 2f;
21184 vector4.Y += num12 * num13 / 2f;
21185 }
21186 }
21187 }
21188 if (type == 36)
21189 {
21190 Vector2 vector5 = new Vector2(rCurrentNPC.position.X + (float)rCurrentNPC.width * 0.5f - 5f * rCurrentNPC.ai[0], rCurrentNPC.position.Y + 20f);
21191 for (int j = 0; j < 2; j++)
21192 {
21193 float num14 = npc[(int)rCurrentNPC.ai[1]].position.X + (float)(npc[(int)rCurrentNPC.ai[1]].width / 2) - vector5.X;
21194 float num15 = npc[(int)rCurrentNPC.ai[1]].position.Y + (float)(npc[(int)rCurrentNPC.ai[1]].height / 2) - vector5.Y;
21195 float num16 = 0f;
21196 if (j == 0)
21197 {
21198 num14 -= 200f * rCurrentNPC.ai[0];
21199 num15 += 130f;
21200 num16 = (float)Math.Sqrt(num14 * num14 + num15 * num15);
21201 num16 = 92f / num16;
21202 vector5.X += num14 * num16;
21203 vector5.Y += num15 * num16;
21204 }
21205 else
21206 {
21207 num14 -= 50f * rCurrentNPC.ai[0];
21208 num15 += 80f;
21209 num16 = (float)Math.Sqrt(num14 * num14 + num15 * num15);
21210 num16 = 60f / num16;
21211 vector5.X += num14 * num16;
21212 vector5.Y += num15 * num16;
21213 }
21214 float rotation5 = (float)Math.Atan2(num15, num14) - 1.57f;
21215 Microsoft.Xna.Framework.Color color5 = Lighting.GetColor((int)vector5.X / 16, (int)(vector5.Y / 16f));
21216 mySpriteBatch.Draw(TextureAssets.BoneArm.Value, new Vector2(vector5.X - screenPos.X, vector5.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.BoneArm.Width(), TextureAssets.BoneArm.Height()), color5, rotation5, new Vector2((float)TextureAssets.BoneArm.Width() * 0.5f, (float)TextureAssets.BoneArm.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21217 if (j == 0)
21218 {
21219 vector5.X += num14 * num16 / 2f;
21220 vector5.Y += num15 * num16 / 2f;
21221 }
21222 else if (base.IsActive)
21223 {
21224 vector5.X += num14 * num16 - 16f;
21225 vector5.Y += num15 * num16 - 6f;
21226 int num17 = Dust.NewDust(new Vector2(vector5.X, vector5.Y), 30, 10, 5, num14 * 0.02f, num15 * 0.02f, 0, default(Microsoft.Xna.Framework.Color), 2f);
21227 dust[num17].noGravity = true;
21228 }
21229 }
21230 }
21231 if (rCurrentNPC.aiStyle == 47)
21232 {
21233 float scale = rCurrentNPC.scale;
21234 Vector2 vector6 = new Vector2(rCurrentNPC.Center.X, rCurrentNPC.Center.Y);
21235 Vector2 center = rCurrentNPC.Center;
21236 if (NPC.golemBoss != -1)
21237 {
21238 center = npc[NPC.golemBoss].Center;
21239 }
21240 float num18 = center.X - vector6.X;
21241 float num19 = center.Y - vector6.Y;
21242 num19 -= 7f * scale;
21243 num18 = ((type != 247) ? (num18 + 66f * scale) : (num18 - 70f * scale));
21244 float rotation6 = (float)Math.Atan2(num19, num18) - 1.57f;
21245 bool flag6 = true;
21246 while (flag6)
21247 {
21248 float num20 = (float)Math.Sqrt(num18 * num18 + num19 * num19);
21249 if (num20 < 16f)
21250 {
21251 flag6 = false;
21252 continue;
21253 }
21254 num20 = 16f * scale / num20;
21255 num18 *= num20;
21256 num19 *= num20;
21257 vector6.X += num18;
21258 vector6.Y += num19;
21259 num18 = center.X - vector6.X;
21260 num19 = center.Y - vector6.Y;
21261 num19 -= 7f * scale;
21262 num18 = ((type != 247) ? (num18 + 66f * scale) : (num18 - 70f * scale));
21263 if (getGoodWorld)
21264 {
21265 num19 += 8f;
21266 }
21267 Microsoft.Xna.Framework.Color color6 = Lighting.GetColor((int)vector6.X / 16, (int)(vector6.Y / 16f));
21268 mySpriteBatch.Draw(TextureAssets.Chain21.Value, new Vector2(vector6.X - screenPos.X, vector6.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain21.Width(), TextureAssets.Chain21.Height()), color6, rotation6, new Vector2((float)TextureAssets.Chain21.Width() * 0.5f, (float)TextureAssets.Chain21.Height() * 0.5f), scale, SpriteEffects.None, 0f);
21269 }
21270 }
21271 if (rCurrentNPC.aiStyle >= 33 && rCurrentNPC.aiStyle <= 36)
21272 {
21273 Vector2 vector7 = new Vector2(rCurrentNPC.position.X + (float)rCurrentNPC.width * 0.5f - 5f * rCurrentNPC.ai[0], rCurrentNPC.position.Y + 20f);
21274 for (int k = 0; k < 2; k++)
21275 {
21276 float num21 = npc[(int)rCurrentNPC.ai[1]].position.X + (float)(npc[(int)rCurrentNPC.ai[1]].width / 2) - vector7.X;
21277 float num22 = npc[(int)rCurrentNPC.ai[1]].position.Y + (float)(npc[(int)rCurrentNPC.ai[1]].height / 2) - vector7.Y;
21278 float num23 = 0f;
21279 if (k == 0)
21280 {
21281 num21 -= 200f * rCurrentNPC.ai[0];
21282 num22 += 130f;
21283 num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
21284 num23 = 92f / num23;
21285 vector7.X += num21 * num23;
21286 vector7.Y += num22 * num23;
21287 }
21288 else
21289 {
21290 num21 -= 50f * rCurrentNPC.ai[0];
21291 num22 += 80f;
21292 num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22);
21293 num23 = 60f / num23;
21294 vector7.X += num21 * num23;
21295 vector7.Y += num22 * num23;
21296 }
21297 float rotation7 = (float)Math.Atan2(num22, num21) - 1.57f;
21298 Microsoft.Xna.Framework.Color color7 = Lighting.GetColor((int)vector7.X / 16, (int)(vector7.Y / 16f));
21299 mySpriteBatch.Draw(TextureAssets.BoneArm2.Value, new Vector2(vector7.X - screenPos.X, vector7.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.BoneArm.Width(), TextureAssets.BoneArm.Height()), color7, rotation7, new Vector2((float)TextureAssets.BoneArm.Width() * 0.5f, (float)TextureAssets.BoneArm.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21300 if (k == 0)
21301 {
21302 vector7.X += num21 * num23 / 2f;
21303 vector7.Y += num22 * num23 / 2f;
21304 }
21305 else if (base.IsActive)
21306 {
21307 vector7.X += num21 * num23 - 16f;
21308 vector7.Y += num22 * num23 - 6f;
21309 int num24 = Dust.NewDust(new Vector2(vector7.X, vector7.Y), 30, 10, 6, num21 * 0.02f, num22 * 0.02f, 0, default(Microsoft.Xna.Framework.Color), 2.5f);
21310 dust[num24].noGravity = true;
21311 }
21312 }
21313 }
21314 if (rCurrentNPC.aiStyle == 20)
21315 {
21316 Vector2 vector8 = new Vector2(rCurrentNPC.position.X + (float)(rCurrentNPC.width / 2), rCurrentNPC.position.Y + (float)(rCurrentNPC.height / 2));
21317 float num25 = rCurrentNPC.ai[1] - vector8.X;
21318 float num26 = rCurrentNPC.ai[2] - vector8.Y;
21319 float num27 = (rCurrentNPC.rotation = (float)Math.Atan2(num26, num25) - 1.57f);
21320 bool flag7 = true;
21321 while (flag7)
21322 {
21323 int height2 = 12;
21324 float num28 = (float)Math.Sqrt(num25 * num25 + num26 * num26);
21325 if (num28 < 20f)
21326 {
21327 height2 = (int)num28 - 20 + 12;
21328 flag7 = false;
21329 }
21330 num28 = 12f / num28;
21331 num25 *= num28;
21332 num26 *= num28;
21333 vector8.X += num25;
21334 vector8.Y += num26;
21335 num25 = rCurrentNPC.ai[1] - vector8.X;
21336 num26 = rCurrentNPC.ai[2] - vector8.Y;
21337 Microsoft.Xna.Framework.Color color8 = Lighting.GetColor((int)vector8.X / 16, (int)(vector8.Y / 16f));
21338 mySpriteBatch.Draw(TextureAssets.Chain.Value, new Vector2(vector8.X - screenPos.X, vector8.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain.Width(), height2), color8, num27, new Vector2((float)TextureAssets.Chain.Width() * 0.5f, (float)TextureAssets.Chain.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21339 }
21340 mySpriteBatch.Draw(TextureAssets.SpikeBase.Value, new Vector2(rCurrentNPC.ai[1] - screenPos.X, rCurrentNPC.ai[2] - screenPos.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.SpikeBase.Width(), TextureAssets.SpikeBase.Height()), Lighting.GetColor((int)rCurrentNPC.ai[1] / 16, (int)(rCurrentNPC.ai[2] / 16f)), num27 - 0.75f, new Vector2((float)TextureAssets.SpikeBase.Width() * 0.5f, (float)TextureAssets.SpikeBase.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
21341 }
21342 Microsoft.Xna.Framework.Color npcColor = Lighting.GetColor((int)((double)rCurrentNPC.position.X + (double)rCurrentNPC.width * 0.5) / 16, (int)(((double)rCurrentNPC.position.Y + (double)rCurrentNPC.height * 0.5) / 16.0));
21343 if (rCurrentNPC.IsABestiaryIconDummy)
21344 {
21345 npcColor = rCurrentNPC.GetBestiaryEntryColor();
21346 }
21347 if (type >= 277 && type <= 280)
21348 {
21349 if (npcColor.R < byte.MaxValue)
21350 {
21351 npcColor.R = byte.MaxValue;
21352 }
21353 if (npcColor.G < 175)
21354 {
21355 npcColor.G = 175;
21356 }
21357 }
21358 if (type == -4)
21359 {
21360 int r = npcColor.R;
21361 int g = npcColor.G;
21362 int b = npcColor.B;
21363 r *= 2;
21364 if (r > 255)
21365 {
21366 r = 255;
21367 }
21368 g *= 2;
21369 if (g > 255)
21370 {
21371 g = 255;
21372 }
21373 b *= 2;
21374 if (b > 255)
21375 {
21376 b = 255;
21377 }
21378 npcColor = new Microsoft.Xna.Framework.Color(r, g, b);
21379 }
21380 if (behindTiles && type != 113 && type != 114)
21381 {
21382 int num29 = (int)((rCurrentNPC.position.X - 8f) / 16f);
21383 int num30 = (int)((rCurrentNPC.position.X + (float)rCurrentNPC.width + 8f) / 16f);
21384 int num31 = (int)((rCurrentNPC.position.Y - 8f) / 16f);
21385 int num32 = (int)((rCurrentNPC.position.Y + (float)rCurrentNPC.height + 8f) / 16f);
21386 for (int l = num29; l <= num30; l++)
21387 {
21388 for (int m = num31; m <= num32; m++)
21389 {
21390 if (Lighting.Brightness(l, m) == 0f)
21391 {
21393 }
21394 }
21395 }
21396 }
21397 npcColor = rCurrentNPC.GetNPCColorTintedByBuffs(npcColor);
21398 if (type == 50)
21399 {
21401 float num33 = 0f;
21402 zero.Y -= rCurrentNPC.velocity.Y;
21403 zero.X -= rCurrentNPC.velocity.X * 2f;
21404 num33 += rCurrentNPC.velocity.X * 0.05f;
21405 if (rCurrentNPC.frame.Y == 120)
21406 {
21407 zero.Y += 2f;
21408 }
21409 if (rCurrentNPC.frame.Y == 360)
21410 {
21411 zero.Y -= 2f;
21412 }
21413 if (rCurrentNPC.frame.Y == 480)
21414 {
21415 zero.Y -= 6f;
21416 }
21417 mySpriteBatch.Draw(TextureAssets.Ninja.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) + zero.X, rCurrentNPC.position.Y - screenPos.Y + (float)(rCurrentNPC.height / 2) + zero.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Ninja.Width(), TextureAssets.Ninja.Height()), npcColor, num33, new Vector2(TextureAssets.Ninja.Width() / 2, TextureAssets.Ninja.Height() / 2), 1f, SpriteEffects.None, 0f);
21418 }
21419 if (type == 71)
21420 {
21422 float num34 = 0f;
21423 zero2.Y -= rCurrentNPC.velocity.Y * 0.3f;
21424 zero2.X -= rCurrentNPC.velocity.X * 0.6f;
21425 num34 += rCurrentNPC.velocity.X * 0.09f;
21426 if (rCurrentNPC.frame.Y == 120)
21427 {
21428 zero2.Y += 2f;
21429 }
21430 if (rCurrentNPC.frame.Y == 360)
21431 {
21432 zero2.Y -= 2f;
21433 }
21434 if (rCurrentNPC.frame.Y == 480)
21435 {
21436 zero2.Y -= 6f;
21437 }
21439 mySpriteBatch.Draw(itemTexture, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) + zero2.X, rCurrentNPC.position.Y - screenPos.Y + (float)(rCurrentNPC.height / 2) + zero2.Y), rectangle, npcColor, num34, rectangle.Size() / 2f, 1f, SpriteEffects.None, 0f);
21440 }
21441 if (type == 69)
21442 {
21443 mySpriteBatch.Draw(TextureAssets.AntLion.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2), rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height + 14f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.AntLion.Width(), TextureAssets.AntLion.Height()), npcColor, (0f - rCurrentNPC.rotation) * 0.3f, new Vector2(TextureAssets.AntLion.Width() / 2, TextureAssets.AntLion.Height() / 2), 1f, SpriteEffects.None, 0f);
21444 }
21445 if (type == 1 && rCurrentNPC.ai[1] > 0f)
21446 {
21448 }
21449 float num35 = 0f;
21451 Vector2 halfSize = new Vector2(TextureAssets.Npc[type].Width() / 2, TextureAssets.Npc[type].Height() / npcFrameCount[type] / 2);
21452 if (type == 108 || type == 124 || type == 625)
21453 {
21454 num35 = 2f;
21455 }
21456 else if (type == 357)
21457 {
21458 num35 = rCurrentNPC.localAI[0];
21459 }
21460 else if (type == 467)
21461 {
21462 num35 = 7f;
21463 }
21464 else if (type == 537)
21465 {
21466 num35 = 2f;
21467 }
21468 else if (type == 581)
21469 {
21470 num35 = -6f;
21471 }
21472 else if (type == 490)
21473 {
21474 num35 = 4f;
21475 }
21476 else if (type == 484)
21477 {
21478 num35 = 2f;
21479 }
21480 else if (type == 483)
21481 {
21482 num35 = 14f;
21483 }
21484 else if (type == 477)
21485 {
21486 num36 = 22f;
21487 }
21488 else if (type == 478)
21489 {
21490 num35 -= 2f;
21491 }
21492 else if (type == 606)
21493 {
21494 num35 -= 2f;
21495 }
21496 else if (type == 612 || type == 613)
21497 {
21498 num35 -= 2f;
21499 }
21500 else if (type == 469 && rCurrentNPC.ai[2] == 1f)
21501 {
21502 num35 = 14f;
21503 }
21504 else
21505 {
21506 switch (type)
21507 {
21508 case 4:
21509 halfSize = new Vector2(55f, 107f);
21510 break;
21511 case 125:
21512 halfSize = new Vector2(55f, 107f);
21513 break;
21514 case 126:
21515 halfSize = new Vector2(55f, 107f);
21516 break;
21517 case 626:
21518 case 627:
21519 if (rCurrentNPC.wet)
21520 {
21521 num35 = -2f;
21522 halfSize = rCurrentNPC.frame.Size() * new Vector2(0.5f, 0.5f) + new Vector2(0f, -4f);
21523 }
21524 else
21525 {
21526 num35 = 2f;
21527 }
21528 break;
21529 case 63:
21530 case 64:
21531 case 103:
21532 halfSize.Y += 4f;
21533 break;
21534 case 69:
21535 halfSize.Y += 8f;
21536 break;
21537 case 262:
21538 halfSize.Y = 77f;
21539 num36 += 26f;
21540 break;
21541 case 264:
21542 halfSize.Y = 21f;
21543 num36 += 2f;
21544 break;
21545 case 266:
21546 num36 += 50f * rCurrentNPC.scale;
21547 break;
21548 case 268:
21549 num36 += 16f;
21550 break;
21551 case 288:
21552 num36 += 6f;
21553 break;
21554 }
21555 }
21556 if (rCurrentNPC.aiStyle == 10 || type == 72)
21557 {
21559 }
21561 if (rCurrentNPC.spriteDirection == 1)
21562 {
21563 spriteEffects = SpriteEffects.FlipHorizontally;
21564 }
21565 if (type == 124 && rCurrentNPC.localAI[0] == 0f)
21566 {
21567 int num37 = 0;
21568 if (rCurrentNPC.frame.Y > 56)
21569 {
21570 num37 += 4;
21571 }
21572 num37 += rCurrentNPC.frame.Y / 56;
21573 if (num37 >= OffsetsPlayerHeadgear.Length)
21574 {
21575 num37 = 0;
21576 }
21577 float y = OffsetsPlayerHeadgear[num37].Y;
21578 LoadProjectile(582);
21580 if (rCurrentNPC.townNpcVariationIndex == 1)
21581 {
21582 value = TextureAssets.Extra[263].Value;
21583 }
21584 Vector2 position = rCurrentNPC.Center - screenPos;
21585 position -= new Vector2(value.Width, value.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
21586 position += new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY + y);
21587 position += new Vector2(-rCurrentNPC.spriteDirection * 2, -2f);
21588 mySpriteBatch.Draw(value, position, null, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, value.Size() * new Vector2(0f, 0.5f), rCurrentNPC.scale, spriteEffects, 0f);
21589 }
21590 switch (type)
21591 {
21592 default:
21593 if (type != 546 && type != 552 && type != 553 && type != 554 && type != 561 && type != 562 && type != 563 && type != 555 && type != 556 && type != 557 && type != 558 && type != 559 && type != 560 && type != 574 && type != 575 && type != 568 && type != 569 && type != 572 && type != 573 && type != 566 && type != 567 && type != 570 && type != 578 && type != 571 && type != 583 && type != 584 && type != 585 && type != 618 && type != 620 && type != 661)
21594 {
21595 switch (type)
21596 {
21597 case 551:
21598 {
21600 Vector2 vector9 = rCurrentNPC.Center - screenPos;
21602 _ = frame.Size() / 2f;
21604 float rotation8 = rCurrentNPC.rotation;
21607 color10.A = 66;
21608 Vector2 vector10 = new Vector2(171f, 44f);
21609 Vector2 vector11 = new Vector2(230f, 52f);
21610 Vector2 vector12 = Vector2.Lerp(vector10, vector11, 0.5f) + new Vector2(-50f, 30f);
21611 int num38 = (int)rCurrentNPC.localAI[0] / 4;
21614 Texture2D value3 = TextureAssets.Extra[82].Value;
21615 if (spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally))
21616 {
21617 spinningpoint2.X *= -1f;
21618 }
21620 Vector2 origin = new Vector2(16f, 176f);
21621 if (spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally))
21622 {
21623 origin.X = (float)value4.Width - origin.X;
21624 }
21625 if (spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally))
21626 {
21627 vector12.X = (float)frame.Width - vector12.X;
21628 }
21629 Texture2D value5 = TextureAssets.Extra[81].Value;
21630 if (spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally))
21631 {
21632 spinningpoint.X *= -1f;
21633 }
21635 Vector2 origin2 = new Vector2(215f, 170f);
21636 if (spriteEffects2.HasFlag(SpriteEffects.FlipHorizontally))
21637 {
21638 origin2.X = (float)value6.Width - origin2.X;
21639 }
21640 float lerpValue = Utils.GetLerpValue(0f, 30f, rCurrentNPC.localAI[1], clamped: true);
21641 if (lerpValue == 1f)
21642 {
21643 lerpValue = Utils.GetLerpValue(60f, 30f, rCurrentNPC.localAI[1], clamped: true);
21644 }
21645 lerpValue = 2f;
21646 Vector2 vector13 = rCurrentNPC.Size / 2f - screenPos;
21647 int num39 = -3;
21648 int num40 = 0;
21649 byte b2 = 2;
21650 for (int n = 9; n > num40; n += num39)
21651 {
21653 float num41 = rCurrentNPC.oldRot[n];
21654 Microsoft.Xna.Framework.Color color11 = color9 * (1f - (float)n / 10f) * 0.35f;
21655 color11.A /= b2;
21656 mySpriteBatch.Draw(value3, vector14 + spinningpoint2.RotatedBy(num41), value4, color11, num41, origin, 1f, spriteEffects2, 0f);
21659 }
21662 mySpriteBatch.Draw(TextureAssets.GlowMask[226].Value, vector9, frame, color10 * (0.7f + 0.3f * lerpValue), rotation8, vector12, 1f, spriteEffects2, 0f);
21664 return;
21665 }
21666 case 657:
21667 {
21669 Vector2 position7 = rCurrentNPC.Bottom - screenPos;
21670 position7.Y += 2f;
21671 int num53 = npcFrameCount[rCurrentNPC.type];
21672 int num54 = rCurrentNPC.frame.Y / rCurrentNPC.frame.Height;
21674 rectangle3.Inflate(0, -2);
21675 Vector2 origin4 = rectangle3.Size() * new Vector2(0.5f, 1f);
21677 if (rCurrentNPC.life <= rCurrentNPC.lifeMax / 2)
21678 {
21680 }
21681 Texture2D value11 = TextureAssets.Extra[186].Value;
21683 Vector2 origin5 = rectangle4.Size() * new Vector2(0.5f, 0.5f);
21684 Vector2 vector16 = new Vector2(rCurrentNPC.Center.X, rCurrentNPC.Center.Y);
21685 float num55 = 0f;
21686 switch (num54)
21687 {
21688 case 1:
21689 case 6:
21690 num55 -= 10f;
21691 break;
21692 case 3:
21693 case 5:
21694 num55 += 10f;
21695 break;
21696 case 4:
21697 case 12:
21698 case 13:
21699 case 14:
21700 case 15:
21701 num55 += 18f;
21702 break;
21703 case 7:
21704 case 8:
21705 num55 -= 14f;
21706 break;
21707 case 9:
21708 num55 -= 16f;
21709 break;
21710 case 10:
21711 num55 -= 18f;
21712 break;
21713 case 11:
21714 num55 += 20f;
21715 break;
21716 case 20:
21717 num55 -= 14f;
21718 break;
21719 case 21:
21720 case 23:
21721 num55 -= 18f;
21722 break;
21723 case 22:
21724 num55 -= 22f;
21725 break;
21726 }
21727 vector16.Y += num55;
21728 if (rCurrentNPC.rotation != 0f)
21729 {
21730 vector16 = vector16.RotatedBy(rCurrentNPC.rotation, rCurrentNPC.Bottom);
21731 }
21733 if (!rCurrentNPC.IsABestiaryIconDummy)
21734 {
21735 mySpriteBatch.End();
21737 }
21738 GameShaders.Misc["QueenSlime"].Apply();
21739 if (rCurrentNPC.ai[0] == 4f && rCurrentNPC.velocity.Y != 0f)
21740 {
21741 float num56 = 1f;
21742 if (rCurrentNPC.ai[2] == 1f)
21743 {
21744 num56 = 6f;
21745 }
21746 for (int num57 = 7; num57 >= 0; num57--)
21747 {
21748 float num58 = 1f - (float)num57 / 8f;
21749 Vector2 vector17 = rCurrentNPC.oldPos[num57] + new Vector2((float)rCurrentNPC.width * 0.5f, rCurrentNPC.height);
21750 vector17 -= (rCurrentNPC.Bottom - Vector2.Lerp(vector17, rCurrentNPC.Bottom, 0.75f)) * num56;
21753 mySpriteBatch.Draw(value10, vector17, rectangle3, color16, rCurrentNPC.rotation, origin4, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
21754 }
21755 }
21756 if (!rCurrentNPC.IsABestiaryIconDummy)
21757 {
21758 mySpriteBatch.End();
21760 }
21761 pixelShader.CurrentTechnique.Passes[0].Apply();
21762 mySpriteBatch.Draw(value11, vector16, rectangle4, color15, rCurrentNPC.rotation, origin5, 1f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
21763 GameShaders.Misc["QueenSlime"].Apply();
21764 if (!rCurrentNPC.IsABestiaryIconDummy)
21765 {
21766 mySpriteBatch.End();
21768 }
21770 GameShaders.Misc["QueenSlime"].Apply(value12);
21771 value12.Draw(mySpriteBatch);
21772 pixelShader.CurrentTechnique.Passes[0].Apply();
21773 if (!rCurrentNPC.IsABestiaryIconDummy)
21774 {
21775 mySpriteBatch.End();
21777 }
21778 Texture2D value13 = TextureAssets.Extra[177].Value;
21779 rectangle3 = value13.Frame();
21780 origin4 = rectangle3.Size() * new Vector2(0.5f, 0.5f);
21781 position7 = new Vector2(rCurrentNPC.Center.X, rCurrentNPC.Top.Y - (float)rectangle3.Bottom + 44f);
21782 float num59 = 0f;
21783 switch (num54)
21784 {
21785 case 1:
21786 num59 -= 10f;
21787 break;
21788 case 3:
21789 case 5:
21790 case 6:
21791 num59 += 10f;
21792 break;
21793 case 4:
21794 case 12:
21795 case 13:
21796 case 14:
21797 case 15:
21798 num59 += 18f;
21799 break;
21800 case 7:
21801 case 8:
21802 num59 -= 14f;
21803 break;
21804 case 9:
21805 num59 -= 16f;
21806 break;
21807 case 10:
21808 num59 -= 18f;
21809 break;
21810 case 11:
21811 num59 += 20f;
21812 break;
21813 case 20:
21814 num59 -= 14f;
21815 break;
21816 case 21:
21817 case 23:
21818 num59 -= 18f;
21819 break;
21820 case 22:
21821 num59 -= 22f;
21822 break;
21823 }
21824 position7.Y += num59;
21825 if (rCurrentNPC.rotation != 0f)
21826 {
21827 position7 = position7.RotatedBy(rCurrentNPC.rotation, rCurrentNPC.Bottom);
21828 }
21830 mySpriteBatch.Draw(value13, position7, rectangle3, color15, rCurrentNPC.rotation, origin4, 1f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
21831 return;
21832 }
21833 case 576:
21834 case 577:
21835 {
21837 Vector2 vector18 = rCurrentNPC.Bottom - screenPos;
21838 Microsoft.Xna.Framework.Rectangle rectangle7 = value17.Frame(5, 10, rCurrentNPC.frame.Y / 10, rCurrentNPC.frame.Y % 10);
21839 Vector2 origin8 = rectangle7.Size() * new Vector2(0.5f, 1f);
21840 origin8.Y -= 4f;
21841 int num60 = 94;
21842 if (rCurrentNPC.spriteDirection == 1)
21843 {
21844 origin8.X = num60;
21845 }
21846 else
21847 {
21848 origin8.X = rectangle7.Width - num60;
21849 }
21851 float amount3 = 0f;
21852 float amount4 = 0f;
21853 int num61 = 0;
21854 float num62 = 0f;
21856 if (rCurrentNPC.localAI[3] < 60f)
21857 {
21858 _ = 8f;
21859 float num63 = rCurrentNPC.localAI[3] / 60f;
21860 num61 = 3;
21861 num62 = 1f - num63 * num63;
21862 value18 = new Microsoft.Xna.Framework.Color(127, 0, 255, 0);
21863 amount4 = 1f;
21865 }
21866 for (int num64 = 0; num64 < num61; num64++)
21867 {
21870 value19 = rCurrentNPC.GetAlpha(value19);
21872 value19 *= 1f - num62;
21874 position10 -= new Vector2(value17.Width, value17.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
21875 position10 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
21877 }
21878 mySpriteBatch.Draw(value17, vector18, rectangle7, rCurrentNPC.GetAlpha(color18), rCurrentNPC.rotation, origin8, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
21879 return;
21880 }
21881 case 594:
21882 {
21884 Vector2 position8 = rCurrentNPC.Top - screenPos;
21887 Vector2 origin6 = rectangle5.Size() * new Vector2(0.5f, 0f);
21889 float scale3 = 1f;
21890 NPC nPC = rCurrentNPC.AI_113_WindyBalloon_GetSlaveNPC();
21891 if (nPC != null)
21892 {
21893 scale3 = nPC.scale;
21894 if (nPC.ai[1] > 0f)
21895 {
21896 DrawNPC_SlimeItem(nPC, nPC.type, color17, rCurrentNPC.rotation);
21897 }
21900 }
21902 return;
21903 }
21904 case 686:
21905 {
21907 Vector2 position9 = rCurrentNPC.Top - screenPos;
21909 Vector2 origin7 = rectangle6.Size() * new Vector2(0.5f, 0f);
21912 return;
21913 }
21914 case 564:
21915 case 565:
21916 {
21918 Vector2 vector19 = rCurrentNPC.Bottom - screenPos;
21919 Microsoft.Xna.Framework.Rectangle rectangle8 = value20.Frame(5, 9, rCurrentNPC.frame.Y / 9, rCurrentNPC.frame.Y % 9);
21920 Vector2 origin9 = rectangle8.Size() * new Vector2(0.5f, 1f);
21921 origin9.Y -= 10f;
21922 int num65 = 52;
21923 if (rCurrentNPC.spriteDirection == 1)
21924 {
21925 origin9.X = num65;
21926 }
21927 else
21928 {
21929 origin9.X = rectangle8.Width - num65;
21930 }
21932 float amount5 = 0f;
21933 float amount6 = 0f;
21934 int num66 = 0;
21935 float num67 = 0f;
21936 float num68 = 0f;
21938 if (rCurrentNPC.localAI[3] < 60f)
21939 {
21940 float num69 = rCurrentNPC.localAI[3] / 60f;
21941 num66 = 3;
21942 num67 = 1f - num69 * num69;
21943 num68 = 8f;
21944 value21 = new Microsoft.Xna.Framework.Color(127, 0, 255, 0);
21945 amount6 = 1f;
21947 }
21948 for (int num70 = 0; num70 < num66; num70++)
21949 {
21952 value22 = rCurrentNPC.GetAlpha(value22);
21954 value22 *= 1f - num67;
21956 position11 -= new Vector2(value20.Width, value20.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
21957 position11 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
21958 position11 += ((float)num70 / (float)num66 * ((float)Math.PI * 2f)).ToRotationVector2() * num68 * num67;
21960 }
21962 num66 = 4;
21963 num68 = 4f;
21964 num67 = 0.625f + (float)Math.Sin(GlobalTimeWrappedHourly * ((float)Math.PI * 2f) * 0.75f + (float)Math.PI) * 0.125f;
21965 for (int num71 = 0; num71 < num66; num71++)
21966 {
21968 color20 *= 1f - num67;
21970 position12 -= new Vector2(value20.Width, value20.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
21971 position12 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
21972 position12 += ((float)num71 / (float)num66 * ((float)Math.PI * 2f)).ToRotationVector2() * num68 * num67;
21974 }
21975 mySpriteBatch.Draw(value20, vector19, rectangle8, alpha2, rCurrentNPC.rotation, origin9, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
21976 if (rCurrentNPC.Opacity > 0f)
21977 {
21979 white2.A /= 2;
21980 white2 *= rCurrentNPC.Opacity;
21981 mySpriteBatch.Draw(TextureAssets.GlowMask[225].Value, vector19, rectangle8, white2, rCurrentNPC.rotation, origin9, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
21982 num66 = 4;
21983 num68 = 4f;
21984 num67 = 0.5f + (float)Math.Sin(GlobalTimeWrappedHourly * ((float)Math.PI * 2f) * 0.75f) * 0.5f;
21985 for (int num72 = 0; num72 < num66; num72++)
21986 {
21988 color21 *= 1f - num67;
21990 position13 -= new Vector2(value20.Width, value20.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
21991 position13 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
21992 position13 += ((float)num72 / (float)num66 * ((float)Math.PI * 2f)).ToRotationVector2() * num68 * num67;
21993 mySpriteBatch.Draw(TextureAssets.GlowMask[225].Value, position13, rectangle8, color21, rCurrentNPC.rotation, origin9, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
21994 }
21995 }
21996 return;
21997 }
21998 case 548:
21999 {
22001 Vector2 vector15 = rCurrentNPC.Bottom - screenPos;
22003 Vector2 origin3 = rectangle2.Size() / 2f;
22004 origin3.Y += 30f;
22005 origin3.Y += 8f;
22006 origin3.X -= 1f;
22008 float amount = 0f;
22009 float amount2 = 0f;
22010 int num42 = 0;
22011 float num43 = 0f;
22012 float num44 = 0f;
22014 for (int num45 = 0; num45 < num42; num45++)
22015 {
22018 value9 = rCurrentNPC.GetAlpha(value9);
22020 value9 *= 1f - num43;
22022 position3 -= new Vector2(value8.Width, value8.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22023 position3 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22024 position3 += ((float)num45 / (float)num42 * ((float)Math.PI * 2f)).ToRotationVector2() * num44 * num43;
22025 mySpriteBatch.Draw(value8, position3, rectangle2, value9, rCurrentNPC.rotation, origin3, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22026 }
22028 num42 = 4;
22029 num44 = 4f;
22030 num43 = 0.625f + (float)Math.Sin(GlobalTimeWrappedHourly * ((float)Math.PI * 2f) * 0.75f + (float)Math.PI) * 0.125f;
22031 for (int num46 = 0; num46 < num42; num46++)
22032 {
22034 color12.A = 0;
22035 color12 *= 1f - num43;
22037 position4 -= new Vector2(value8.Width, value8.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22038 position4 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22039 position4 += ((float)num46 / (float)num42 * ((float)Math.PI * 2f)).ToRotationVector2() * num44 * num43;
22040 mySpriteBatch.Draw(value8, position4, rectangle2, color12, rCurrentNPC.rotation, origin3, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22041 }
22042 mySpriteBatch.Draw(value8, vector15, rectangle2, alpha, rCurrentNPC.rotation, origin3, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22043 if (rCurrentNPC.ai[1] == 2f)
22044 {
22045 float num47 = Math.Min(1f, rCurrentNPC.ai[0] / 120f);
22046 mySpriteBatch.Draw(value8, vector15, rectangle2, new Microsoft.Xna.Framework.Color(1f, 1f, 1f, 0f) * num47, rCurrentNPC.rotation, origin3, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22047 float progress = MathHelper.Clamp(rCurrentNPC.ai[0] / 450f, 0f, 1f);
22048 if (!Terraria.Graphics.Effects.Filters.Scene["CrystalWin"].IsActive())
22049 {
22050 Terraria.Graphics.Effects.Filters.Scene.Activate("CrystalWin", rCurrentNPC.Center);
22051 }
22052 else
22053 {
22054 Terraria.Graphics.Effects.Filters.Scene["CrystalWin"].GetShader().UseProgress(progress);
22055 }
22056 Terraria.Graphics.Effects.Filters.Scene["CrystalWin"].GetShader().UseTargetPosition(rCurrentNPC.Center);
22057 }
22058 num42 = 4;
22059 num44 = 4f;
22060 num43 = 0.625f + (float)Math.Sin(GlobalTimeWrappedHourly * ((float)Math.PI * 2f) * 0.75f) * 0.125f;
22061 for (int num48 = 0; num48 < num42; num48++)
22062 {
22064 color13.A = 0;
22065 color13 *= 0.3f;
22066 color13 *= 1f - num43;
22068 position5 -= new Vector2(value8.Width, value8.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22069 position5 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22070 position5 += ((float)num48 / (float)num42 * ((float)Math.PI * 2f)).ToRotationVector2() * num44 * num43;
22071 mySpriteBatch.Draw(value8, position5, rectangle2, color13, rCurrentNPC.rotation, origin3, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22072 }
22073 if (rCurrentNPC.alpha < 255)
22074 {
22075 float num49 = GlobalTimeWrappedHourly % 3f / 3f;
22076 float num50 = num49;
22077 if (num50 > 0.5f)
22078 {
22079 num50 = 1f - num49;
22080 }
22081 if (num50 < 0f)
22082 {
22083 num50 = 0f;
22084 }
22085 float num51 = (num49 + 0.5f) % 1f;
22086 float num52 = num51;
22087 if (num52 > 0.5f)
22088 {
22089 num52 = 1f - num51;
22090 }
22091 if (num52 < 0f)
22092 {
22093 num52 = 0f;
22094 }
22095 value8 = TextureAssets.GlowMask[239].Value;
22096 rectangle2 = value8.Frame();
22097 origin3 = rectangle2.Size() / 2f;
22098 Vector2 position6 = vector15 + new Vector2(0f, -40f);
22100 color14 *= 0.6f;
22101 mySpriteBatch.Draw(value8, position6, rectangle2, color14, rCurrentNPC.rotation, origin3, rCurrentNPC.scale * 0.75f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22102 num43 = 1f + num49 * 0.75f;
22103 mySpriteBatch.Draw(value8, position6, rectangle2, color14 * num50, rCurrentNPC.rotation, origin3, rCurrentNPC.scale * 0.75f * num43, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22104 num43 = 1f + num51 * 0.75f;
22105 mySpriteBatch.Draw(value8, position6, rectangle2, color14 * num52, rCurrentNPC.rotation, origin3, rCurrentNPC.scale * 0.75f * num43, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22106 value8 = TextureAssets.Extra[89].Value;
22107 rectangle2 = value8.Frame();
22108 origin3 = rectangle2.Size() / 2f;
22109 Vector2 scale2 = new Vector2(0.75f, 1f + num43) * 1.5f;
22110 num43 = 1f + num51 * 0.75f;
22111 if (rCurrentNPC.dontTakeDamageFromHostiles)
22112 {
22113 scale2.Y *= 0.6f;
22114 }
22115 position6.Y -= 6f;
22116 mySpriteBatch.Draw(value8, position6, rectangle2, color14 * num52, rCurrentNPC.rotation + (float)Math.PI / 2f, origin3, scale2, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
22118 }
22119 return;
22120 }
22121 default:
22122 if (type < 621 || type > 623)
22123 {
22124 break;
22125 }
22126 goto case 371;
22127 case 371:
22128 case 454:
22129 case 455:
22130 case 456:
22131 case 457:
22132 case 458:
22133 case 459:
22134 {
22136 Vector2 position2 = rCurrentNPC.Center - screenPos;
22137 position2 -= new Vector2(value7.Width, value7.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22138 position2 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22140 return;
22141 }
22142 }
22143 switch (type)
22144 {
22145 case 549:
22146 {
22148 Vector2 vector61 = rCurrentNPC.Center - screenPos;
22150 Vector2 origin22 = new Vector2(70f, 127f);
22151 origin22.Y += 8f;
22152 Vector2 scale6 = new Vector2(rCurrentNPC.scale);
22153 float num201 = rCurrentNPC.localAI[0];
22154 if (num201 < 120f)
22155 {
22156 scale6 *= num201 / 240f + 0.5f;
22157 }
22159 float lerpValue2 = Utils.GetLerpValue(0f, 120f, num201, clamped: true);
22160 float num202 = MathHelper.Lerp(32f, 0f, lerpValue2);
22162 color42.A = (byte)MathHelper.Lerp((int)color42.A, 0f, lerpValue2);
22164 if (num201 >= 120f)
22165 {
22166 color42 = alpha12;
22167 }
22169 float y3 = (((rCurrentNPC.ai[0] + 54f) % 180f - 120f) / 180f * 2f * ((float)Math.PI * 2f)).ToRotationVector2().Y;
22170 if (num201 >= 120f)
22171 {
22172 num202 = y3 * 0f;
22173 color42.A = (byte)((float)(int)color42.A * 0.5f);
22174 color42 *= y3 / 2f + 0.5f;
22175 float num203 = 1f;
22176 for (float num204 = 0f; num204 < num203; num204 += 1f)
22177 {
22178 mySpriteBatch.Draw(value58, vector61 + ((float)Math.PI * 2f / num203 * num204).ToRotationVector2() * num202, frame9, color42, rCurrentNPC.rotation, origin22, scale6, spriteEffects, 0f);
22179 }
22180 }
22181 float num205 = rCurrentNPC.ai[0] / 180f - 0.76f;
22182 if (num205 < 0f)
22183 {
22184 num205 += 1f;
22185 }
22186 float num206 = 0f;
22187 float num207 = 0f;
22188 float num208 = 0.6f;
22189 float num209 = 0.8f;
22190 if (num205 >= num208 && num205 <= num209)
22191 {
22193 num207 = MathHelper.Lerp(0.75f, 0.85f, num206);
22194 }
22195 num208 = num209;
22196 num209 = num208 + 0.13f;
22197 if (num205 >= num208 && num205 <= num209)
22198 {
22200 num207 = MathHelper.Lerp(1.3f, 0.85f, num206);
22201 }
22202 Vector2 vector62 = new Vector2(0f, -150f);
22203 int frameNumber = frame9.Y / frame9.Height;
22204 float num210 = MathHelper.Clamp((num201 - 100f) / 40f, 0f, 1f);
22205 DrawElderEye(mySpriteBatch, rCurrentNPC.Center + vector62, 0.75f * num210, 0.75f, frameNumber, Microsoft.Xna.Framework.Color.White);
22206 DrawElderEye(mySpriteBatch, rCurrentNPC.Center + vector62, 0.75f * num210, 0.75f, frameNumber, new Microsoft.Xna.Framework.Color(255, 255, 255, 127) * (y3 / 2f + 0.5f));
22207 if (num206 > 0f && num207 > 0f)
22208 {
22209 DrawElderEye(mySpriteBatch, rCurrentNPC.Center + vector62, num206 * 0.5f, num207, frameNumber, new Microsoft.Xna.Framework.Color(255, 255, 255, 127));
22210 }
22211 if (num201 < 120f)
22212 {
22213 float num211 = (float)Math.PI * 2f * lerpValue2 * (float)Math.Pow(lerpValue2, 2.0) * 2f + lerpValue2;
22214 color42.A = (byte)((float)(int)alpha12.A * (float)Math.Pow(lerpValue2, 2.0) * 0.5f);
22215 float num212 = 3f;
22216 for (float num213 = 0f; num213 < num212; num213 += 1f)
22217 {
22218 mySpriteBatch.Draw(value58, vector61 + (num211 + (float)Math.PI * 2f / num212 * num213).ToRotationVector2() * num202, frame9, color42, rCurrentNPC.rotation, origin22, scale6, spriteEffects, 0f);
22219 }
22220 }
22221 break;
22222 }
22223 case 636:
22225 break;
22226 case 677:
22228 break;
22229 case 668:
22231 break;
22232 case 422:
22233 case 493:
22234 case 507:
22235 case 517:
22236 {
22238 Vector2 vector65 = rCurrentNPC.Center - screenPos;
22239 Vector2 vector66 = vector65 - new Vector2(300f, 310f);
22240 vector65 -= new Vector2(value60.Width, value60.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22241 vector65 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22243 switch (type)
22244 {
22245 case 493:
22246 {
22247 value60 = TextureAssets.GlowMask[132].Value;
22248 float num228 = 4f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 4f;
22249 for (int num229 = 0; num229 < 4; num229++)
22250 {
22251 mySpriteBatch.Draw(value60, vector65 + rCurrentNPC.velocity.RotatedBy((float)num229 * ((float)Math.PI / 2f)) * num228, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * rCurrentNPC.Opacity, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
22252 }
22253 break;
22254 }
22255 case 507:
22256 {
22257 value60 = TextureAssets.GlowMask[143].Value;
22258 float num224 = 4f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 4f;
22259 for (int num225 = 0; num225 < 4; num225++)
22260 {
22261 mySpriteBatch.Draw(value60, vector65 + rCurrentNPC.velocity.RotatedBy((float)num225 * ((float)Math.PI / 2f)) * num224, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * rCurrentNPC.Opacity, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
22262 }
22263 break;
22264 }
22265 case 422:
22266 {
22267 value60 = TextureAssets.GlowMask[149].Value;
22268 float num226 = 4f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 4f;
22269 for (int num227 = 0; num227 < 4; num227++)
22270 {
22271 mySpriteBatch.Draw(value60, vector65 + rCurrentNPC.velocity.RotatedBy((float)num227 * ((float)Math.PI / 2f)) * num226, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * rCurrentNPC.Opacity, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
22272 }
22273 break;
22274 }
22275 case 517:
22276 {
22277 value60 = TextureAssets.GlowMask[162].Value;
22278 float num222 = 2f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 9f;
22279 for (int num223 = 0; num223 < 4; num223++)
22280 {
22281 mySpriteBatch.Draw(value60, vector65 + rCurrentNPC.velocity.RotatedBy((float)num223 * ((float)Math.PI / 2f)) * num222 + Vector2.UnitX * 2f, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * rCurrentNPC.Opacity, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
22282 }
22283 break;
22284 }
22285 }
22286 int num230 = 0;
22287 string key = "";
22288 switch (type)
22289 {
22290 case 422:
22292 key = "Vortex";
22293 break;
22294 case 507:
22296 key = "Nebula";
22297 break;
22298 case 517:
22300 key = "Solar";
22301 break;
22302 case 493:
22304 key = "Stardust";
22305 break;
22306 }
22307 float num231 = (float)num230 / (float)NPC.ShieldStrengthTowerMax;
22308 if (rCurrentNPC.IsABestiaryIconDummy)
22309 {
22310 break;
22311 }
22312 if (num230 > 0)
22313 {
22314 mySpriteBatch.End();
22316 float num232 = 0f;
22317 if (rCurrentNPC.ai[3] > 0f && rCurrentNPC.ai[3] <= 30f)
22318 {
22319 num232 = 1f - rCurrentNPC.ai[3] / 30f;
22320 }
22321 Terraria.Graphics.Effects.Filters.Scene[key].GetShader().UseIntensity(1f + num232).UseProgress(0f);
22322 DrawData value61 = new DrawData(Assets.Request<Texture2D>("Images/Misc/Perlin", (AssetRequestMode)1).Value, vector66 + new Vector2(300f, 300f), new Microsoft.Xna.Framework.Rectangle(0, 0, 600, 600), Microsoft.Xna.Framework.Color.White * (num231 * 0.8f + 0.2f), rCurrentNPC.rotation, new Vector2(300f, 300f), rCurrentNPC.scale * (1f + num232 * 0.05f), spriteEffects);
22323 GameShaders.Misc["ForceField"].UseColor(new Vector3(1f + num232 * 0.5f));
22324 GameShaders.Misc["ForceField"].Apply(value61);
22325 value61.Draw(mySpriteBatch);
22326 mySpriteBatch.End();
22328 }
22329 else if (rCurrentNPC.ai[3] > 0f)
22330 {
22331 mySpriteBatch.End();
22333 float num233 = rCurrentNPC.ai[3] / 120f;
22334 float num234 = Math.Min(rCurrentNPC.ai[3] / 30f, 1f);
22335 Terraria.Graphics.Effects.Filters.Scene[key].GetShader().UseIntensity(Math.Min(5f, 15f * num233) + 1f).UseProgress(num233);
22336 DrawData value62 = new DrawData(Assets.Request<Texture2D>("Images/Misc/Perlin", (AssetRequestMode)1).Value, vector66 + new Vector2(300f, 300f), new Microsoft.Xna.Framework.Rectangle(0, 0, 600, 600), new Microsoft.Xna.Framework.Color(new Vector4(1f - (float)Math.Sqrt(num234))), rCurrentNPC.rotation, new Vector2(300f, 300f), rCurrentNPC.scale * (1f + num234), spriteEffects);
22337 GameShaders.Misc["ForceField"].UseColor(new Vector3(2f));
22338 GameShaders.Misc["ForceField"].Apply(value62);
22339 value62.Draw(mySpriteBatch);
22340 mySpriteBatch.End();
22342 }
22343 else
22344 {
22345 Terraria.Graphics.Effects.Filters.Scene[key].GetShader().UseIntensity(0f).UseProgress(0f);
22346 }
22347 break;
22348 }
22349 case 402:
22350 {
22351 LoadNPC(403);
22352 LoadNPC(404);
22354 Vector2 vector63 = rCurrentNPC.Center - screenPos;
22355 vector63 -= new Vector2(value59.Width, value59.Height / npcFrameCount[rCurrentNPC.type]) * rCurrentNPC.scale / 2f;
22356 vector63 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22357 int num214 = 0;
22358 float num215 = 2f / (float)rCurrentNPC.oldPos.Length * 0.7f;
22359 float num216 = 600f;
22360 float num217 = num216 - 30f;
22361 float num218 = Utils.Remap(rCurrentNPC.ai[2], 0f, num216, 0f, 1f);
22362 float num219 = 1f - Utils.Remap(num218, 0.5f, num217 / num216, 0f, 1f) * Utils.Remap(num218, num217 / num216, 1f, 1f, 0f);
22363 int num220 = rCurrentNPC.oldPos.Length - 1;
22364 while ((float)num220 >= 1f)
22365 {
22366 for (int num221 = 0; num221 < 2; num221++)
22367 {
22368 value59 = ((num214 != 0) ? TextureAssets.Npc[403].Value : TextureAssets.Npc[404].Value);
22370 float rotation10 = rCurrentNPC.oldRot[num220];
22371 if (num220 >= 1 && num221 == 1)
22372 {
22373 Vector2 vector64 = Vector2.Lerp(rCurrentNPC.oldPos[num220], rCurrentNPC.oldPos[num220 - 1], 0.5f) - rCurrentNPC.oldPos[num220];
22374 rotation10 = MathHelper.WrapAngle(rCurrentNPC.oldRot[num220 - 1] * 0.5f + rCurrentNPC.oldRot[num220] * 0.5f);
22376 }
22377 float scale7 = rCurrentNPC.scale;
22378 mySpriteBatch.Draw(value59, position21, null, rCurrentNPC.GetAlpha(npcColor) * (0.8f - num215 * (float)num220 / 2f) * num219, rotation10, halfSize, scale7, spriteEffects, 0f);
22379 value59 = ((num214 != 0) ? TextureAssets.GlowMask[133].Value : TextureAssets.GlowMask[134].Value);
22380 mySpriteBatch.Draw(value59, position21, null, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * (1f - num215 * (float)num220 / 2f) * num219, rotation10, halfSize, scale7, spriteEffects, 0f);
22381 num214++;
22382 }
22383 num220 -= 2;
22384 }
22385 value59 = TextureAssets.Npc[rCurrentNPC.type].Value;
22387 value59 = TextureAssets.GlowMask[135].Value;
22388 mySpriteBatch.Draw(value59, vector63, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num219, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
22389 DrawPrettyStarSparkle(Utils.Remap(rCurrentNPC.ai[2], 0f, num216, 0f, 1f), SpriteEffects.None, vector63, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), Microsoft.Xna.Framework.Color.CornflowerBlue, num218, 0.5f, num217 / num216, num217 / num216, 1f, (float)Math.PI * 2f * num218, new Vector2(2f, 2f), new Vector2(2f, 2f));
22390 break;
22391 }
22392 case 519:
22393 {
22395 Vector2 vector67 = rCurrentNPC.Center - screenPos;
22396 vector67 -= new Vector2(value63.Width, value63.Height / npcFrameCount[rCurrentNPC.type]) * rCurrentNPC.scale / 2f;
22397 vector67 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22398 value63 = TextureAssets.Npc[rCurrentNPC.type].Value;
22400 int num235 = 0;
22401 float num236 = 1f / (float)rCurrentNPC.oldPos.Length * 0.7f;
22402 int num237 = rCurrentNPC.oldPos.Length - 1;
22403 while ((float)num237 >= 0f)
22404 {
22405 float num238 = (float)(rCurrentNPC.oldPos.Length - num237) / (float)rCurrentNPC.oldPos.Length;
22407 pink *= 1f - num236 * (float)num237 / 1f;
22408 pink.A = (byte)((float)(int)pink.A * (1f - num238));
22409 mySpriteBatch.Draw(value63, vector67 + rCurrentNPC.oldPos[num237] - rCurrentNPC.position, null, pink, rCurrentNPC.oldRot[num237], halfSize, rCurrentNPC.scale * MathHelper.Lerp(0.3f, 1.1f, num238), spriteEffects, 0f);
22410 num235++;
22411 num237--;
22412 }
22413 break;
22414 }
22415 case 522:
22416 {
22418 Vector2 vector68 = rCurrentNPC.Center - screenPos;
22419 vector68 -= new Vector2(value70.Width, value70.Height / npcFrameCount[rCurrentNPC.type]) * rCurrentNPC.scale / 2f;
22420 vector68 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22421 int num256 = 0;
22422 float num257 = 1f / (float)rCurrentNPC.oldPos.Length * 1.1f;
22423 int num258 = rCurrentNPC.oldPos.Length - 1;
22424 while ((float)num258 >= 0f)
22425 {
22426 float num259 = (float)(rCurrentNPC.oldPos.Length - num258) / (float)rCurrentNPC.oldPos.Length;
22428 white6 *= 1f - num257 * (float)num258 / 1f;
22429 white6.A = (byte)((float)(int)white6.A * (1f - num259));
22430 mySpriteBatch.Draw(value70, vector68 + rCurrentNPC.oldPos[num258] - rCurrentNPC.position, null, white6, rCurrentNPC.oldRot[num258], halfSize, rCurrentNPC.scale * MathHelper.Lerp(0.8f, 0.3f, num259), spriteEffects, 0f);
22431 num256++;
22432 num258--;
22433 }
22434 value70 = TextureAssets.Extra[57].Value;
22435 mySpriteBatch.Draw(value70, vector68, null, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), 0f, value70.Size() / 2f, rCurrentNPC.scale, spriteEffects, 0f);
22436 break;
22437 }
22438 case 370:
22439 case 372:
22440 case 373:
22441 {
22444 float amount8 = 0f;
22445 bool flag12 = type == 370 && rCurrentNPC.ai[0] > 4f;
22446 bool num239 = type == 370 && rCurrentNPC.ai[0] > 9f;
22447 int num240 = 120;
22448 int num241 = 60;
22450 if (num239)
22451 {
22452 npcColor = buffColor(npcColor, 0.4f, 0.8f, 0.4f, 1f);
22453 }
22454 else if (flag12)
22455 {
22456 npcColor = buffColor(npcColor, 0.5f, 0.7f, 0.5f, 1f);
22457 }
22458 else if (type == 370 && rCurrentNPC.ai[0] == 4f && rCurrentNPC.ai[2] > (float)num240)
22459 {
22460 float num242 = rCurrentNPC.ai[2] - (float)num240;
22461 num242 /= (float)num241;
22462 npcColor = buffColor(npcColor, 1f - 0.5f * num242, 1f - 0.3f * num242, 1f - 0.5f * num242, 1f);
22463 }
22464 int num243 = 10;
22465 int num244 = 2;
22466 switch (type)
22467 {
22468 case 370:
22469 if (rCurrentNPC.ai[0] == -1f)
22470 {
22471 num243 = 0;
22472 }
22473 if (rCurrentNPC.ai[0] == 0f || rCurrentNPC.ai[0] == 5f || rCurrentNPC.ai[0] == 10f)
22474 {
22475 num243 = 7;
22476 }
22477 if (rCurrentNPC.ai[0] == 1f)
22478 {
22480 amount8 = 0.5f;
22481 }
22482 else
22483 {
22484 color43 = npcColor;
22485 }
22486 break;
22487 case 372:
22488 case 373:
22489 if (rCurrentNPC.ai[0] == 1f)
22490 {
22492 amount8 = 0.5f;
22493 }
22494 break;
22495 }
22496 for (int num245 = 1; num245 < num243; num245 += num244)
22497 {
22498 _ = ref rCurrentNPC.oldPos[num245];
22501 value66 = rCurrentNPC.GetAlpha(value66);
22502 value66 *= (float)(num243 - num245) / 15f;
22503 Vector2 position22 = rCurrentNPC.oldPos[num245] + new Vector2(rCurrentNPC.width, rCurrentNPC.height) / 2f - screenPos;
22504 position22 -= new Vector2(value64.Width, value64.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22505 position22 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22507 }
22508 int num246 = 0;
22509 float num247 = 0f;
22510 float num248 = 0f;
22511 if (type == 370)
22512 {
22513 if (rCurrentNPC.ai[0] == -1f)
22514 {
22515 num246 = 0;
22516 }
22517 if (rCurrentNPC.ai[0] == 3f || rCurrentNPC.ai[0] == 8f)
22518 {
22519 int num249 = 60;
22520 int num250 = 30;
22521 if (rCurrentNPC.ai[2] > (float)num249)
22522 {
22523 num246 = 6;
22524 num247 = 1f - (float)Math.Cos((rCurrentNPC.ai[2] - (float)num249) / (float)num250 * ((float)Math.PI * 2f));
22525 num247 /= 3f;
22526 num248 = 40f;
22527 }
22528 }
22529 if (rCurrentNPC.ai[0] == 4f && rCurrentNPC.ai[2] > (float)num240)
22530 {
22531 num246 = 6;
22532 num247 = 1f - (float)Math.Cos((rCurrentNPC.ai[2] - (float)num240) / (float)num241 * ((float)Math.PI * 2f));
22533 num247 /= 3f;
22534 num248 = 60f;
22535 }
22536 if (rCurrentNPC.ai[0] == 9f && rCurrentNPC.ai[2] > (float)num240)
22537 {
22538 num246 = 6;
22539 num247 = 1f - (float)Math.Cos((rCurrentNPC.ai[2] - (float)num240) / (float)num241 * ((float)Math.PI * 2f));
22540 num247 /= 3f;
22541 num248 = 60f;
22542 }
22543 if (rCurrentNPC.ai[0] == 12f)
22544 {
22545 num246 = 6;
22546 num247 = 1f - (float)Math.Cos(rCurrentNPC.ai[2] / 30f * ((float)Math.PI * 2f));
22547 num247 /= 3f;
22548 num248 = 20f;
22549 }
22550 }
22551 for (int num251 = 0; num251 < num246; num251++)
22552 {
22555 value67 = rCurrentNPC.GetAlpha(value67);
22556 value67 *= 1f - num247;
22557 Vector2 position23 = rCurrentNPC.Center + ((float)num251 / (float)num246 * ((float)Math.PI * 2f) + rCurrentNPC.rotation).ToRotationVector2() * num248 * num247 - screenPos;
22558 position23 -= new Vector2(value64.Width, value64.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22559 position23 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22561 }
22562 Vector2 position24 = rCurrentNPC.Center - screenPos;
22563 position24 -= new Vector2(value64.Width, value64.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22564 position24 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22566 if (type != 370 || !(rCurrentNPC.ai[0] >= 4f))
22567 {
22568 break;
22569 }
22573 amount8 = 1f;
22574 num247 = 0.5f;
22575 num248 = 10f;
22576 num244 = 1;
22577 if (rCurrentNPC.ai[0] == 4f)
22578 {
22579 float num252 = rCurrentNPC.ai[2] - (float)num240;
22580 num252 /= (float)num241;
22581 value65 *= num252;
22582 color44 *= num252;
22583 }
22584 if (rCurrentNPC.ai[0] == 12f)
22585 {
22586 float num253 = rCurrentNPC.ai[2];
22587 num253 /= 30f;
22588 if (num253 > 0.5f)
22589 {
22590 num253 = 1f - num253;
22591 }
22592 num253 *= 2f;
22593 num253 = 1f - num253;
22594 value65 *= num253;
22595 color44 *= num253;
22596 }
22597 for (int num254 = 1; num254 < num243; num254 += num244)
22598 {
22599 _ = ref rCurrentNPC.oldPos[num254];
22602 value68 *= (float)(num243 - num254) / 15f;
22603 Vector2 position25 = rCurrentNPC.oldPos[num254] + new Vector2(rCurrentNPC.width, rCurrentNPC.height) / 2f - screenPos;
22604 position25 -= new Vector2(value64.Width, value64.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22605 position25 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22607 }
22608 for (int num255 = 1; num255 < num246; num255++)
22609 {
22612 value69 = rCurrentNPC.GetAlpha(value69);
22613 value69 *= 1f - num247;
22614 Vector2 position26 = rCurrentNPC.Center + ((float)num255 / (float)num246 * ((float)Math.PI * 2f) + rCurrentNPC.rotation).ToRotationVector2() * num248 * num247 - screenPos;
22615 position26 -= new Vector2(value64.Width, value64.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22616 position26 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22618 }
22620 break;
22621 }
22622 case 439:
22623 case 440:
22624 {
22625 int num260 = rCurrentNPC.frame.Y / (TextureAssets.Npc[type].Height() / npcFrameCount[type]);
22629 rectangle11.Height /= 2;
22630 if (num260 >= 4)
22631 {
22632 rectangle11.Y += rectangle11.Height;
22633 }
22635 float amount9 = 0f;
22637 int num261 = 0;
22638 int num262 = 0;
22639 int num263 = 0;
22640 if (rCurrentNPC.ai[0] == -1f)
22641 {
22642 if (rCurrentNPC.ai[1] >= 320f && rCurrentNPC.ai[1] < 960f)
22643 {
22645 amount9 = 0.5f;
22646 num261 = 6;
22647 num262 = 2;
22648 num263 = 1;
22649 }
22650 }
22651 else if (rCurrentNPC.ai[0] == 1f)
22652 {
22654 amount9 = 0.5f;
22655 num261 = 4;
22656 num262 = 2;
22657 num263 = 1;
22658 }
22659 else
22660 {
22661 color45 = npcColor;
22662 }
22663 for (int num264 = num263; num264 < num261; num264 += num262)
22664 {
22665 _ = ref rCurrentNPC.oldPos[num264];
22668 value73 = rCurrentNPC.GetAlpha(value73);
22669 value73 *= (float)(num261 - num264) / (float)num261;
22670 value73.A = 100;
22671 Vector2 position27 = rCurrentNPC.oldPos[num264] + new Vector2(rCurrentNPC.width, rCurrentNPC.height) / 2f - screenPos;
22672 position27 -= rectangle11.Size() * rCurrentNPC.scale / 2f;
22673 position27 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22675 }
22676 int num265 = 0;
22677 float num266 = 0f;
22678 float num267 = 0f;
22679 if (rCurrentNPC.ai[0] == 5f && rCurrentNPC.ai[1] >= 0f && rCurrentNPC.ai[1] < 30f)
22680 {
22681 num265 = 4;
22682 num266 = 1f - (float)Math.Cos((rCurrentNPC.ai[1] - 0f) / 30f * (float)Math.PI);
22683 num266 /= 2f;
22684 num267 = 70f;
22685 }
22686 for (int num268 = 0; num268 < num265; num268++)
22687 {
22690 value74 = rCurrentNPC.GetAlpha(value74);
22691 value74 *= 1f - num266;
22692 Vector2 position28 = rCurrentNPC.Center + ((float)num268 / (float)num265 * ((float)Math.PI * 2f) + rCurrentNPC.rotation).ToRotationVector2() * num267 * num266 - screenPos;
22693 position28 -= new Vector2(value71.Width, value71.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22694 position28 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22696 }
22697 Vector2 position29 = rCurrentNPC.Center - screenPos;
22698 position29 -= new Vector2(value71.Width, value71.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
22699 position29 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
22701 break;
22702 }
22703 case 392:
22704 case 393:
22705 case 394:
22706 case 395:
22707 {
22709 Vector2 vec = rCurrentNPC.Center - screenPos + Vector2.UnitY * rCurrentNPC.gfxOffY;
22710 vec = vec.Floor();
22711 float num269 = 0f;
22712 if (type == 393)
22713 {
22714 num269 = -8f;
22715 }
22717 if (type == 392)
22718 {
22719 mySpriteBatch.Draw(TextureAssets.GlowMask[48].Value, vec, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize + Vector2.UnitY * num269, rCurrentNPC.scale, spriteEffects, 0f);
22720 }
22721 if (type == 395)
22722 {
22723 mySpriteBatch.Draw(TextureAssets.GlowMask[49].Value, vec, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize + Vector2.UnitY * num269, rCurrentNPC.scale, spriteEffects, 0f);
22724 }
22725 if (type == 394)
22726 {
22727 mySpriteBatch.Draw(TextureAssets.GlowMask[50].Value, vec, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize + Vector2.UnitY * num269, rCurrentNPC.scale, spriteEffects, 0f);
22728 }
22729 break;
22730 }
22731 case 83:
22732 case 84:
22733 case 179:
22734 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35), rCurrentNPC.frame, Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
22735 break;
22736 case 87:
22737 case 88:
22738 case 89:
22739 case 90:
22740 case 91:
22741 case 92:
22742 {
22744 byte b3 = (byte)((tileColor.R + tileColor.G + tileColor.B) / 3);
22745 if (alpha13.R < b3)
22746 {
22747 alpha13.R = b3;
22748 }
22749 if (alpha13.G < b3)
22750 {
22751 alpha13.G = b3;
22752 }
22753 if (alpha13.B < b3)
22754 {
22755 alpha13.B = b3;
22756 }
22757 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35), rCurrentNPC.frame, alpha13, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
22758 break;
22759 }
22760 default:
22761 {
22762 switch (type)
22763 {
22764 case 491:
22765 {
22768 Vector2 origin15 = frame3.OriginFlip(new Vector2(208f, 460f), spriteEffects);
22769 Vector2 vector34 = rCurrentNPC.Center - screenPos;
22770 Vector2 vector35 = new Vector2((!spriteEffects.HasFlag(SpriteEffects.FlipHorizontally)) ? 1 : (-1), 1f);
22773 int num89 = (int)rCurrentNPC.localAI[3] / 8;
22774 value38 = TextureAssets.Extra[40].Value;
22775 frame3 = value38.Frame(1, 4, 0, num89 % 4);
22776 origin15 = frame3.Size() * new Vector2(0.5f, 1f);
22777 mySpriteBatch.Draw(value38, vector34 + (new Vector2(102f, -384f) * vector35).RotatedBy(rCurrentNPC.rotation), frame3, alpha7, rCurrentNPC.rotation, origin15, rCurrentNPC.scale, spriteEffects, 0f);
22778 value38 = TextureAssets.Extra[41].Value;
22779 frame3 = value38.Frame(1, 8, 0, num89 % 8);
22780 origin15 = frame3.Size() * new Vector2(0.5f, 0f) + new Vector2(0f, 10f);
22781 for (int num90 = 0; num90 < 5; num90++)
22782 {
22783 mySpriteBatch.Draw(value38, vector34 + (new Vector2(-96 + 34 * num90, 40f) * vector35).RotatedBy(rCurrentNPC.rotation), frame3, alpha7, rCurrentNPC.rotation, origin15, rCurrentNPC.scale, spriteEffects, 0f);
22784 }
22785 value38 = TextureAssets.Extra[42].Value;
22786 frame3 = value38.Frame(1, 4, 0, num89 % 4);
22787 origin15 = frame3.Size() * new Vector2(0.5f, 0f);
22788 for (int num91 = 0; num91 < 2; num91++)
22789 {
22790 mySpriteBatch.Draw(value38, vector34 + (new Vector2(158 - 106 * num91, -302f) * vector35).RotatedBy(rCurrentNPC.rotation), frame3, alpha7, rCurrentNPC.rotation, origin15, rCurrentNPC.scale, spriteEffects, 0f);
22791 }
22792 value38 = TextureAssets.Extra[43].Value;
22793 frame3 = value38.Frame(1, 4, 0, num89 % 4);
22794 origin15 = frame3.Size() * new Vector2(0.5f, 0f);
22795 for (int num92 = 0; num92 < 2; num92++)
22796 {
22797 mySpriteBatch.Draw(value38, vector34 + (new Vector2(42 - 178 * num92, -444f) * vector35).RotatedBy(rCurrentNPC.rotation), frame3, alpha7, rCurrentNPC.rotation, origin15, rCurrentNPC.scale, spriteEffects, 0f);
22798 }
22799 value38 = TextureAssets.Extra[44].Value;
22800 frame3 = value38.Frame(1, 4, 0, num89 % 4);
22801 origin15 = frame3.Size() * new Vector2(0.5f, 0f);
22802 mySpriteBatch.Draw(value38, vector34 + (new Vector2(-134f, -302f) * vector35).RotatedBy(rCurrentNPC.rotation), frame3, alpha7, rCurrentNPC.rotation, origin15, rCurrentNPC.scale, spriteEffects, 0f);
22803 value38 = TextureAssets.Extra[45].Value;
22804 frame3 = value38.Frame(1, 4, 0, (2 + num89) % 4);
22805 origin15 = frame3.Size() * new Vector2(0.5f, 0f);
22806 mySpriteBatch.Draw(value38, vector34 + (new Vector2(-60f, -330f) * vector35).RotatedBy(rCurrentNPC.rotation), frame3, alpha7, rCurrentNPC.rotation, origin15, rCurrentNPC.scale, spriteEffects, 0f);
22807 LoadNPC(492);
22808 if (!TextureAssets.Npc[492].IsLoaded)
22809 {
22810 return;
22811 }
22812 value38 = TextureAssets.Npc[492].Value;
22813 frame3 = value38.Frame(1, 9);
22814 origin15 = frame3.Size() * new Vector2(0.5f, 0f) + new Vector2(0f, 10f);
22815 for (int num93 = 0; num93 < 4; num93++)
22816 {
22817 int num94 = (int)rCurrentNPC.ai[num93];
22818 if (num94 >= 0)
22819 {
22820 frame3.Y = npc[num94].frame.Y;
22821 mySpriteBatch.Draw(value38, vector34 + (new Vector2(-122 + 68 * num93, -20f) * vector35).RotatedBy(rCurrentNPC.rotation), frame3, alpha7, rCurrentNPC.rotation, origin15, rCurrentNPC.scale, spriteEffects, 0f);
22822 }
22823 }
22824 return;
22825 }
22826 case 398:
22827 {
22828 bool flag8 = false;
22832 float num74 = 340f;
22833 float num75 = 0.5f;
22834 Vector2 vector20 = new Vector2(220f, -60f);
22835 Vector2 vector21 = new Vector2(76f, 66f);
22837 Vector2 origin10 = new Vector2(value26.Width, 278f);
22838 Vector2 origin11 = new Vector2(0f, 278f);
22839 Vector2 vector22 = new Vector2(0f, 76f);
22840 Vector2 center2 = rCurrentNPC.Center;
22841 Microsoft.Xna.Framework.Point point = (rCurrentNPC.Center + new Vector2(0f, -150f)).ToTileCoordinates();
22843 for (int num76 = 0; num76 < 2; num76++)
22844 {
22845 bool flag9 = num76 == 0;
22846 Vector2 vector23 = new Vector2((!flag9) ? 1 : (-1), 1f);
22847 int num77 = -1;
22848 for (int num78 = 0; num78 < 200; num78++)
22849 {
22850 if (npc[num78].active && npc[num78].type == 397 && npc[num78].ai[2] == (float)num76 && npc[num78].ai[3] == (float)rCurrentNPC.whoAmI)
22851 {
22852 num77 = num78;
22853 break;
22854 }
22855 }
22856 if (num77 != -1)
22857 {
22859 Vector2 vector25 = (npc[num77].Center + vector22 - vector24) * num75;
22860 if (flag8)
22861 {
22862 dust[Dust.NewDust(vector24 + vector25, 0, 0, 6)].noGravity = true;
22863 }
22864 float num79 = (float)Math.Acos(vector25.Length() / num74) * (0f - vector23.X);
22865 SpriteEffects effects = ((!flag9) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
22867 if (!flag9)
22868 {
22869 origin12.X = (float)value25.Width - origin12.X;
22870 }
22871 mySpriteBatch.Draw(value25, vector24 - screenPos, null, alpha4, vector25.ToRotation() - num79 - (float)Math.PI / 2f, origin12, 1f, effects, 0f);
22872 if (flag8)
22873 {
22874 dust[Dust.NewDust(vector24, 0, 0, 6)].noGravity = true;
22875 }
22876 if (flag8)
22877 {
22878 dust[Dust.NewDust(center2, 0, 0, 6)].noGravity = true;
22879 }
22880 if (flag8)
22881 {
22882 dust[Dust.NewDust(vector24 + new Vector2(0f, num74).RotatedBy(vector25.ToRotation() - num79 - (float)Math.PI / 2f), 0, 0, 6)].noGravity = true;
22883 }
22884 }
22885 }
22886 mySpriteBatch.Draw(value26, center2 - screenPos, null, alpha4, 0f, origin10, 1f, SpriteEffects.None, 0f);
22887 mySpriteBatch.Draw(value26, center2 - screenPos, null, alpha4, 0f, origin11, 1f, SpriteEffects.FlipHorizontally, 0f);
22888 mySpriteBatch.Draw(value24, center2 - screenPos, null, alpha4, 0f, new Vector2(112f, 101f), 1f, SpriteEffects.None, 0f);
22889 mySpriteBatch.Draw(value23, center2 - screenPos, rCurrentNPC.frame, alpha4, 0f, rCurrentNPC.frame.Size() / 2f, 1f, SpriteEffects.None, 0f);
22890 return;
22891 }
22892 case 397:
22893 {
22895 float num95 = 0.5f;
22896 Vector2 vector36 = new Vector2(220f, -60f);
22897 Vector2 vector37 = new Vector2(0f, 76f);
22899 Vector2 vector38 = new Vector2(60f, 30f);
22900 float num96 = 340f;
22901 Vector2 center3 = npc[(int)rCurrentNPC.ai[3]].Center;
22902 Microsoft.Xna.Framework.Point point4 = rCurrentNPC.Center.ToTileCoordinates();
22904 bool flag10 = rCurrentNPC.ai[2] == 0f;
22905 Vector2 vector39 = new Vector2((!flag10) ? 1 : (-1), 1f);
22906 Vector2 origin16 = new Vector2(120f, 180f);
22907 if (!flag10)
22908 {
22909 origin16.X = (float)value39.Width - origin16.X;
22910 }
22913 Vector2 vector40 = new Vector2(26f, 42f);
22914 if (!flag10)
22915 {
22916 vector40.X = (float)value41.Width - vector40.X;
22917 }
22918 Vector2 vector41 = new Vector2(30f, 66f);
22919 Vector2 vector42 = new Vector2(1f * (0f - vector39.X), 3f);
22922 value44.Height /= 4;
22924 Vector2 vector44 = rCurrentNPC.Center + vector37;
22926 v *= 1f - num95;
22928 if (!flag10)
22929 {
22930 origin17.X = (float)value40.Width - origin17.X;
22931 }
22932 float num97 = (float)Math.Acos(v.Length() / num96) * (0f - vector39.X);
22933 mySpriteBatch.Draw(value40, vector44 - screenPos, null, alpha8, v.ToRotation() + num97 - (float)Math.PI / 2f, origin17, 1f, spriteEffects, 0f);
22934 if (rCurrentNPC.ai[0] == -2f)
22935 {
22936 int num98 = (int)rCurrentNPC.ai[1];
22937 num98 /= 8;
22938 value44.Y += value44.Height * num98;
22939 mySpriteBatch.Draw(value43, rCurrentNPC.Center - screenPos, value44, alpha8, 0f, vector40 - new Vector2(4f, 4f), 1f, spriteEffects, 0f);
22940 }
22941 else
22942 {
22943 mySpriteBatch.Draw(value41, rCurrentNPC.Center - screenPos, null, alpha8, 0f, vector40, 1f, spriteEffects, 0f);
22944 Vector2 vector45 = Utils.Vector2FromElipse(rCurrentNPC.localAI[0].ToRotationVector2(), vector41 * rCurrentNPC.localAI[1]);
22945 mySpriteBatch.Draw(value42, rCurrentNPC.Center - screenPos + vector45 + vector42, null, alpha8, 0f, new Vector2(value42.Width, value42.Height) / 2f, 1f, SpriteEffects.None, 0f);
22946 }
22947 mySpriteBatch.Draw(value39, rCurrentNPC.Center - screenPos, rCurrentNPC.frame, alpha8, 0f, origin16, 1f, spriteEffects, 0f);
22948 return;
22949 }
22950 case 396:
22951 {
22953 Vector2 origin13 = new Vector2(191f, 130f);
22956 Vector2 vector26 = new Vector2(19f, 34f);
22957 Vector2 vector27 = new Vector2(27f, 59f);
22958 Vector2 vector28 = new Vector2(0f, 0f);
22960 Vector2 vector29 = new Vector2(0f, 214f).RotatedBy(rCurrentNPC.rotation);
22962 rectangle9.Height /= 3;
22963 rectangle9.Y += rectangle9.Height * (int)(rCurrentNPC.localAI[2] / 7f);
22965 Vector2 vector30 = new Vector2(0f, 4f).RotatedBy(rCurrentNPC.rotation);
22967 rectangle10.Height /= 4;
22968 rectangle10.Y += rectangle10.Height * (int)(rCurrentNPC.localAI[3] / 5f);
22971 value35.Height /= 4;
22972 _ = npc[(int)rCurrentNPC.ai[3]].Center;
22973 Microsoft.Xna.Framework.Point point2 = rCurrentNPC.Center.ToTileCoordinates();
22975 if (rCurrentNPC.ai[0] < 0f)
22976 {
22977 int num84 = (int)rCurrentNPC.ai[1];
22978 num84 /= 8;
22979 value35.Y += value35.Height * num84;
22980 mySpriteBatch.Draw(value34, rCurrentNPC.Center - screenPos, value35, alpha5, rCurrentNPC.rotation, vector26 + new Vector2(4f, 4f), 1f, spriteEffects, 0f);
22981 }
22982 else
22983 {
22984 mySpriteBatch.Draw(value30, rCurrentNPC.Center - screenPos, null, alpha5, rCurrentNPC.rotation, vector26, 1f, spriteEffects, 0f);
22985 Vector2 vector31 = Utils.Vector2FromElipse(rCurrentNPC.localAI[0].ToRotationVector2(), vector27 * rCurrentNPC.localAI[1]);
22986 mySpriteBatch.Draw(value31, rCurrentNPC.Center - screenPos + vector31 + vector28, null, alpha5, rCurrentNPC.rotation, new Vector2(value31.Width, value31.Height) / 2f, 1f, SpriteEffects.None, 0f);
22987 }
22989 mySpriteBatch.Draw(value33, (rCurrentNPC.Center - screenPos + vector30).Floor(), rectangle10, alpha5, rCurrentNPC.rotation, rectangle10.Size() / 2f, 1f, spriteEffects, 0f);
22990 mySpriteBatch.Draw(value32, (rCurrentNPC.Center - screenPos + vector29).Floor(), rectangle9, alpha5, rCurrentNPC.rotation, rectangle9.Size() / 2f, 1f, spriteEffects, 0f);
22991 return;
22992 }
22993 case 400:
22994 {
22997 Vector2 origin14 = new Vector2(40f, 40f);
22998 Vector2 vector32 = new Vector2(30f, 30f);
22999 _ = rCurrentNPC.Center;
23000 Microsoft.Xna.Framework.Point point3 = rCurrentNPC.Center.ToTileCoordinates();
23003 Vector2 vector33 = Utils.Vector2FromElipse(rCurrentNPC.localAI[0].ToRotationVector2(), vector32 * rCurrentNPC.localAI[1]);
23004 mySpriteBatch.Draw(value37, rCurrentNPC.Center - screenPos + vector33, null, alpha6, rCurrentNPC.rotation, value37.Size() / 2f, rCurrentNPC.localAI[2], SpriteEffects.None, 0f);
23005 return;
23006 }
23007 case 416:
23008 {
23009 int num85 = -1;
23010 int num86 = (int)rCurrentNPC.ai[0];
23011 Vector2 position15 = rCurrentNPC.position;
23013 if (npc[num86].active && npc[num86].type == 415)
23014 {
23015 num85 = num86;
23016 }
23017 if (num85 != -1)
23018 {
23019 Vector2 position16 = rCurrentNPC.position;
23020 rCurrentNPC.Bottom = npc[num85].Bottom;
23021 position15 = rCurrentNPC.position;
23022 rCurrentNPC.position = position16;
23023 rCurrentNPC.gfxOffY = npc[num85].gfxOffY;
23024 spinningpoint3 = npc[num85].velocity;
23025 }
23027 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(position15.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, position15.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame2, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23028 if (rCurrentNPC.color != default(Microsoft.Xna.Framework.Color))
23029 {
23030 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(position15.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, position15.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame2, rCurrentNPC.GetColor(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23031 }
23032 mySpriteBatch.Draw(TextureAssets.GlowMask[156].Value, position15 + rCurrentNPC.Size * new Vector2(0.5f, 1f) - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23033 float num87 = 0.5f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 0.5f;
23034 for (int num88 = 0; num88 < 4; num88++)
23035 {
23036 mySpriteBatch.Draw(TextureAssets.GlowMask[156].Value, position15 + rCurrentNPC.Size * new Vector2(0.5f, 1f) - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + spinningpoint3.RotatedBy((float)num88 * ((float)Math.PI / 2f)) * num87, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23037 }
23038 return;
23039 }
23040 case 399:
23041 {
23043 (rCurrentNPC.position - screenPos + Vector2.UnitY * rCurrentNPC.gfxOffY).Floor();
23044 float num80 = 5f;
23045 for (int num81 = 0; (float)num81 < num80; num81++)
23046 {
23047 float num82 = 1f - (GlobalTimeWrappedHourly + (float)num81) % num80 / num80;
23049 if (rCurrentNPC.ai[0] == 1f)
23050 {
23052 }
23053 if (rCurrentNPC.ai[0] == 2f)
23054 {
23056 }
23057 color22 *= 1f - num82;
23058 color22.A = 0;
23059 for (int num83 = 0; num83 < 2; num83++)
23060 {
23061 mySpriteBatch.Draw(TextureAssets.Extra[27].Value, rCurrentNPC.Center - screenPos + Vector2.UnitY * (rCurrentNPC.gfxOffY - 4f + 6f), null, color22, (float)Math.PI / 2f, new Vector2(10f, 48f), num82 * 4f, SpriteEffects.None, 0f);
23062 }
23063 }
23064 mySpriteBatch.Draw(value27, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23065 value27 = TextureAssets.GlowMask[100].Value;
23066 mySpriteBatch.Draw(value27, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(127 - rCurrentNPC.alpha / 2, 127 - rCurrentNPC.alpha / 2, 127 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23067 value27 = TextureAssets.Extra[20].Value;
23068 Microsoft.Xna.Framework.Rectangle value28 = value27.Frame(1, 4, 0, (int)rCurrentNPC.ai[0] + 1);
23069 Vector2 position14 = new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)value27.Width * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY + 18f + 6f);
23071 value27 = TextureAssets.GlowMask[101].Value;
23072 mySpriteBatch.Draw(value27, position14, value28, new Microsoft.Xna.Framework.Color(127 - rCurrentNPC.alpha / 2, 127 - rCurrentNPC.alpha / 2, 127 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23073 return;
23074 }
23075 case 94:
23076 {
23077 for (int num73 = 1; num73 < 6; num73 += 2)
23078 {
23079 _ = ref rCurrentNPC.oldPos[num73];
23081 alpha3.R = (byte)(alpha3.R * (10 - num73) / 15);
23082 alpha3.G = (byte)(alpha3.G * (10 - num73) / 15);
23083 alpha3.B = (byte)(alpha3.B * (10 - num73) / 15);
23084 alpha3.A = (byte)(alpha3.A * (10 - num73) / 15);
23085 alpha3 = rCurrentNPC.GetShimmerColor(alpha3);
23086 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num73].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num73].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, alpha3, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23087 }
23088 break;
23089 }
23090 case 384:
23091 return;
23092 }
23093 if (type == 125 || type == 126 || type == 127 || type == 128 || type == 129 || type == 130 || type == 131 || (type == 139 && rCurrentNPC.ai[3] == 0f) || type == 140)
23094 {
23095 for (int num99 = 9; num99 >= 0; num99 -= 2)
23096 {
23097 _ = ref rCurrentNPC.oldPos[num99];
23099 alpha9.R = (byte)(alpha9.R * (10 - num99) / 20);
23100 alpha9.G = (byte)(alpha9.G * (10 - num99) / 20);
23101 alpha9.B = (byte)(alpha9.B * (10 - num99) / 20);
23102 alpha9.A = (byte)(alpha9.A * (10 - num99) / 20);
23103 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num99].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num99].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, alpha9, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23104 }
23105 }
23106 if (type == 417 && rCurrentNPC.ai[0] >= 6f && rCurrentNPC.ai[0] <= 6f)
23107 {
23108 for (int num100 = 5; num100 >= 0; num100--)
23109 {
23110 _ = ref rCurrentNPC.oldPos[num100];
23112 alpha10.R = (byte)(alpha10.R * (10 - num100) / 20);
23113 alpha10.G = (byte)(alpha10.G * (10 - num100) / 20);
23114 alpha10.B = (byte)(alpha10.B * (10 - num100) / 20);
23115 alpha10.A = (byte)(alpha10.A * (10 - num100) / 20);
23116 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num100].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num100].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, alpha10, rCurrentNPC.oldRot[num100], halfSize, MathHelper.Lerp(0.5f, 1f, (5f - (float)num100) / 6f), spriteEffects, 0f);
23117 }
23118 }
23119 if (type == 419 && rCurrentNPC.ai[2] <= -9f)
23120 {
23121 int num101 = TextureAssets.GlowMask[154].Height() / npcFrameCount[type];
23122 int num102 = rCurrentNPC.frame.Y / num101;
23123 for (int num103 = 6; num103 >= 0; num103--)
23124 {
23125 _ = ref rCurrentNPC.oldPos[num103];
23127 white3.R = (byte)(255 * (10 - num103) / 20);
23128 white3.G = (byte)(255 * (10 - num103) / 20);
23129 white3.B = (byte)(255 * (10 - num103) / 20);
23130 white3.A = 0;
23132 int num104 = (num102 - 3 - num103) % 3;
23133 if (num104 < 0)
23134 {
23135 num104 += 3;
23136 }
23137 num104 += 5;
23138 frame4.Y = num101 * num104;
23139 mySpriteBatch.Draw(TextureAssets.GlowMask[154].Value, new Vector2(rCurrentNPC.oldPos[num103].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num103].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), frame4, white3, rCurrentNPC.oldRot[num103], halfSize, MathHelper.Lerp(0.75f, 1.2f, (10f - (float)num103) / 10f), spriteEffects, 0f);
23140 }
23141 }
23142 if (type == 418 && (rCurrentNPC.ai[0] == 2f || rCurrentNPC.ai[0] == 4f))
23143 {
23145 Vector2 origin18 = new Vector2(value45.Width / 2, value45.Height / 8 + 14);
23146 int num105 = (int)rCurrentNPC.ai[1] / 2;
23147 float num106 = -(float)Math.PI / 2f * (float)rCurrentNPC.spriteDirection;
23148 float num107 = rCurrentNPC.ai[1] / 45f;
23149 if (num107 > 1f)
23150 {
23151 num107 = 1f;
23152 }
23153 num105 %= 4;
23154 for (int num108 = 6; num108 >= 0; num108--)
23155 {
23156 _ = ref rCurrentNPC.oldPos[num108];
23159 value46.A = (byte)(64f * num107);
23160 value46.R = (byte)(value46.R * (10 - num108) / 20);
23161 value46.G = (byte)(value46.G * (10 - num108) / 20);
23162 value46.B = (byte)(value46.B * (10 - num108) / 20);
23163 value46.A = (byte)(value46.A * (10 - num108) / 20);
23164 value46 *= num107;
23165 int num109 = (num105 - num108) % 4;
23166 if (num109 < 0)
23167 {
23168 num109 += 4;
23169 }
23171 mySpriteBatch.Draw(value45, new Vector2(rCurrentNPC.oldPos[num108].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num108].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), value47, value46, rCurrentNPC.oldRot[num108] + num106, origin18, MathHelper.Lerp(0.1f, 1.2f, (10f - (float)num108) / 10f), spriteEffects, 0f);
23172 }
23173 }
23174 if (type == 516)
23175 {
23176 int num110 = TextureAssets.Npc[type].Height() / npcFrameCount[type];
23177 int num111 = rCurrentNPC.frame.Y / num110;
23178 for (int num112 = 6; num112 >= 0; num112--)
23179 {
23180 _ = ref rCurrentNPC.oldPos[num112];
23182 white4.R = (byte)(255 * (10 - num112) / 20);
23183 white4.G = (byte)(255 * (10 - num112) / 20);
23184 white4.B = (byte)(255 * (10 - num112) / 20);
23185 white4.A = (byte)(255 * (10 - num112) / 20);
23188 int num113 = (num111 - 4 - num112) % 4;
23189 if (num113 < 0)
23190 {
23191 num113 += 4;
23192 }
23193 frame5.Y = num110 * num113;
23194 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num112].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num112].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), frame5, white4, rCurrentNPC.rotation, halfSize, MathHelper.Lerp(0.35f, 1.2f, (10f - (float)num112) / 10f), spriteEffects, 0f);
23195 }
23196 }
23197 if (rCurrentNPC.type == 390 && rCurrentNPC.IsABestiaryIconDummy)
23198 {
23199 LoadNPC(391);
23200 Texture2D value48 = TextureAssets.Npc[391].Value;
23201 Microsoft.Xna.Framework.Rectangle value49 = value48.Frame(1, npcFrameCount[391], 0, (int)rCurrentNPC.localAI[3]);
23202 Vector2 vector46 = new Vector2(-rCurrentNPC.width - 8, 10f);
23203 mySpriteBatch.Draw(value48, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY) + vector46, value49, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23204 }
23206 if (type == 182 || type == 289)
23207 {
23208 frame6.Height -= 2;
23209 }
23210 switch (type)
23211 {
23212 case 420:
23213 case 421:
23214 case 423:
23215 case 424:
23216 {
23217 float num117 = 9f + 3f * (float)Math.Cos((float)Math.PI * 2f * GlobalTimeWrappedHourly);
23218 Vector2 spinningpoint5 = Vector2.UnitX * num117;
23219 Microsoft.Xna.Framework.Color color24 = Microsoft.Xna.Framework.Color.Teal * (num117 / 12f) * 0.8f;
23220 color24.A /= 2;
23221 for (float num118 = 0f; num118 < (float)Math.PI * 2f; num118 += (float)Math.PI / 2f)
23222 {
23223 Vector2 vector49 = rCurrentNPC.position + spinningpoint5.RotatedBy(num118);
23224 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(vector49.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, vector49.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, color24, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23225 }
23226 break;
23227 }
23228 case 662:
23229 {
23230 float num114 = 4f + 2f * (float)Math.Cos((float)Math.PI * 2f * GlobalTimeWrappedHourly);
23231 Vector2 spinningpoint4 = Vector2.UnitX * num114;
23232 Microsoft.Xna.Framework.Color color23 = Microsoft.Xna.Framework.Color.Cyan * (num114 / 12f) * 0.4f;
23233 color23.A /= 4;
23234 for (float num115 = 0.9f; num115 >= 0f; num115 -= 0.125f)
23235 {
23236 Vector2 vector47 = rCurrentNPC.position - rCurrentNPC.velocity * 10f * num115;
23237 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(vector47.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, vector47.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, color23 * (1f - num115), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23238 }
23239 for (float num116 = 0f; num116 < (float)Math.PI * 2f; num116 += (float)Math.PI / 2f)
23240 {
23241 Vector2 vector48 = rCurrentNPC.position + spinningpoint4.RotatedBy(num116);
23242 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(vector48.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, vector48.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, color23, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23243 }
23244 break;
23245 }
23246 }
23247 if (rCurrentNPC.aiStyle == 7)
23248 {
23250 }
23251 if (type == 346 && (double)rCurrentNPC.life < (double)rCurrentNPC.lifeMax * 0.5)
23252 {
23253 mySpriteBatch.Draw(TextureAssets.SantaTank.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23254 }
23255 else if (type == 356)
23256 {
23257 frame6.Height--;
23258 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23259 }
23260 else if (type == 360)
23261 {
23262 float num119 = 0f;
23263 if (rCurrentNPC.ai[2] == 0f)
23264 {
23265 if (rCurrentNPC.rotation == 3.14f || rCurrentNPC.rotation == -3.14f)
23266 {
23267 num36 = 2f;
23268 }
23269 if (rCurrentNPC.direction < 0 && (rCurrentNPC.rotation == 1.57f || rCurrentNPC.rotation == 4.71f))
23270 {
23271 num119 = 1f;
23272 }
23273 if (rCurrentNPC.direction > 0 && (rCurrentNPC.rotation == 1.57f || rCurrentNPC.rotation == 4.71f))
23274 {
23275 num119 = -1f;
23276 }
23277 }
23278 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale + num119, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23279 }
23280 else if (type == 655)
23281 {
23282 float num120 = 0f;
23283 if (rCurrentNPC.ai[2] == 0f)
23284 {
23285 if (rCurrentNPC.rotation == 3.14f || rCurrentNPC.rotation == -3.14f)
23286 {
23287 num36 = 2f;
23288 }
23289 if (rCurrentNPC.direction < 0 && (rCurrentNPC.rotation == 1.57f || rCurrentNPC.rotation == 4.71f))
23290 {
23291 num120 = 1f;
23292 }
23293 if (rCurrentNPC.direction > 0 && (rCurrentNPC.rotation == 1.57f || rCurrentNPC.rotation == 4.71f))
23294 {
23295 num120 = -1f;
23296 }
23297 }
23298 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale + num120, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.Orange), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23299 }
23300 else if (type == 266 && rCurrentNPC.life < rCurrentNPC.lifeMax && (expertMode || getGoodWorld))
23301 {
23303 float num121 = 1f - (float)rCurrentNPC.life / (float)rCurrentNPC.lifeMax;
23304 if (expertMode)
23305 {
23306 num121 *= 2f;
23307 }
23308 num121 *= num121;
23309 if (getGoodWorld)
23310 {
23311 num121 = 1f;
23312 }
23313 num121 = MathHelper.Clamp(num121, 0f, 1f);
23314 alpha11.R = (byte)((float)(int)alpha11.R * num121);
23315 alpha11.G = (byte)((float)(int)alpha11.G * num121);
23316 alpha11.B = (byte)((float)(int)alpha11.B * num121);
23317 alpha11.A = (byte)((float)(int)alpha11.A * num121);
23318 for (int num122 = 0; num122 < 4; num122++)
23319 {
23320 Vector2 position17 = rCurrentNPC.position;
23321 float num123 = Math.Abs(rCurrentNPC.Center.X - Main.player[myPlayer].Center.X);
23322 float num124 = Math.Abs(rCurrentNPC.Center.Y - Main.player[myPlayer].Center.Y);
23323 if (num122 == 0 || num122 == 2)
23324 {
23325 position17.X = Main.player[myPlayer].Center.X + num123;
23326 }
23327 else
23328 {
23329 position17.X = Main.player[myPlayer].Center.X - num123;
23330 }
23331 position17.X -= rCurrentNPC.width / 2;
23332 if (num122 == 0 || num122 == 1)
23333 {
23334 position17.Y = Main.player[myPlayer].Center.Y + num124;
23335 }
23336 else
23337 {
23338 position17.Y = Main.player[myPlayer].Center.Y - num124;
23339 }
23340 position17.Y -= rCurrentNPC.height / 2;
23341 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(position17.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, position17.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, alpha11, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23342 }
23343 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23344 }
23345 else if (type == 421 && rCurrentNPC.ai[0] == 5f)
23346 {
23348 if (player.gravDir == -1f)
23349 {
23350 spriteEffects |= SpriteEffects.FlipVertically;
23351 }
23352 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(player.direction * 4, player.gfxOffY) + ((player.gravDir == 1f) ? player.Top : player.Bottom) - screenPos, frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, frame6.Size() / 2f, rCurrentNPC.scale, spriteEffects, 0f);
23353 mySpriteBatch.Draw(TextureAssets.GlowMask[146].Value, new Vector2(player.direction * 4, player.gfxOffY) + ((player.gravDir == 1f) ? player.Top : player.Bottom) - screenPos, frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, frame6.Size() / 2f, rCurrentNPC.scale, spriteEffects, 0f);
23354 }
23355 else
23356 {
23357 switch (type)
23358 {
23359 case 518:
23360 {
23361 Vector2 vector53 = new Vector2(-10f, 0f);
23362 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize + vector53, rCurrentNPC.scale, spriteEffects, 0f);
23363 if (rCurrentNPC.color != default(Microsoft.Xna.Framework.Color))
23364 {
23365 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetColor(npcColor), rCurrentNPC.rotation, halfSize + vector53, rCurrentNPC.scale, spriteEffects, 0f);
23366 }
23367 break;
23368 }
23369 case 676:
23370 case 681:
23371 {
23372 if (!rCurrentNPC.IsABestiaryIconDummy)
23373 {
23374 mySpriteBatch.End();
23376 }
23377 DrawData value50 = new DrawData(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects);
23378 GameShaders.Misc["RainbowTownSlime"].Apply(value50);
23379 value50.Draw(mySpriteBatch);
23380 pixelShader.CurrentTechnique.Passes[0].Apply();
23381 if (!rCurrentNPC.IsABestiaryIconDummy)
23382 {
23383 mySpriteBatch.End();
23385 }
23386 break;
23387 }
23388 case 685:
23389 {
23390 Vector2 scale4 = new Vector2(rCurrentNPC.scale);
23391 float num131 = rCurrentNPC.rotation;
23392 int num132 = 9;
23394 if (vector50 != Vector2.Zero && rCurrentNPC.velocity.Y == 0f)
23395 {
23396 Vector2 position18 = rCurrentNPC.position;
23398 float num133 = (float)Math.Sin(vector51.X / 30f * ((float)Math.PI * 2f));
23399 float num134 = (float)Math.Sin(vector51.Y / 30f * ((float)Math.PI * 2f));
23400 float num135 = Utils.Remap(vector51.Length(), 0f, 30f, 0f, 1f);
23401 scale4.X += num133 * num135 * 0.25f;
23402 scale4.Y += num134 * num135 * 0.25f;
23403 float num136 = (float)Math.Sin(Utils.Remap(vector51.Length(), 0f, 20f, 0f, 1f) * ((float)Math.PI * 2f));
23404 num131 += num136 * ((float)Math.PI / 4f) * 0.1f * (float)rCurrentNPC.spriteDirection;
23405 }
23406 Vector2 vector52 = new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - 2f - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY);
23407 if (rCurrentNPC.velocity.Y == 0f)
23408 {
23409 vector52 = vector52.Floor();
23410 int num137 = 2;
23411 float num138 = vector52.X % 16f;
23412 if (num138 < (float)num137)
23413 {
23414 vector52.X -= num138;
23415 }
23416 if (num138 > (float)(16 - num137))
23417 {
23418 vector52.X += 16f - num138;
23419 }
23420 }
23422 break;
23423 }
23424 case 267:
23425 {
23426 Vector2 position19 = rCurrentNPC.Center + new Vector2(0f, num36 + num35 + rCurrentNPC.gfxOffY) - screenPos;
23428 if (rCurrentNPC.color != default(Microsoft.Xna.Framework.Color))
23429 {
23431 }
23432 break;
23433 }
23434 default:
23435 if (rCurrentNPC.aiStyle == 7 && rCurrentNPC.ai[0] == 25f)
23436 {
23437 int num125 = type;
23438 float num126 = Utils.Remap(rCurrentNPC.ai[1], 0f, 60f, 0f, 1f);
23439 mySpriteBatch.End();
23441 DrawData drawData = new DrawData(TextureAssets.Npc[num125].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, Microsoft.Xna.Framework.Color.White * Utils.Remap(num126, 0f, 1f, 0f, 1f) * ((float)(int)rCurrentNPC.GetAlpha(npcColor).A / 255f), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects);
23444 float num127 = Utils.Remap(rCurrentNPC.ai[1], 45f, 90f, 0f, 1f);
23445 for (float num128 = 0f; num128 < 1f; num128 += 1f / 6f)
23446 {
23448 drawData2.color = hslToRgb(num128, 0.9f, 0.65f) * num127 * 0.5f;
23449 drawData2.position += ((GlobalTimeWrappedHourly + num128) * ((float)Math.PI * 2f)).ToRotationVector2() * 4f * num127;
23451 }
23452 drawData.Draw(mySpriteBatch);
23453 pixelShader.CurrentTechnique.Passes[0].Apply();
23455 float num129 = (float)Math.Sin(timeForVisualEffects * 6.2831854820251465 / 20.0);
23456 DrawPrettyStarSparkle(num126, SpriteEffects.None, drawData.position, drawColor, hslToRgb(GlobalTimeWrappedHourly % 1f, 1f, 0.65f, 127), Utils.Remap(rCurrentNPC.ai[1], 30f, 60f, 0f, 30f), 0f, 30f, 30f, 36f, 0f, new Vector2(1.5f, 2.5f) * (1f + num129 * 0.025f), new Vector2(2f, 2f));
23457 DrawPrettyStarSparkle(num126, SpriteEffects.None, drawData.position, drawColor, hslToRgb(GlobalTimeWrappedHourly % 1f, 1f, 0.65f, 127), Utils.Remap(rCurrentNPC.ai[1], 30f, 60f, 0f, 30f), 0f, 30f, 30f, 36f, (float)Math.PI / 4f, new Vector2(2.5f, 2.5f) * (1f + num129 * 0.025f), new Vector2(1f, 1f));
23458 mySpriteBatch.End();
23460 }
23461 else
23462 {
23463 int num130 = type;
23464 if (NPC.IsMechQueenUp && num130 == 134)
23465 {
23466 num130 = 136;
23467 LoadNPC(num130);
23468 }
23469 mySpriteBatch.Draw(TextureAssets.Npc[num130].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23470 if (rCurrentNPC.color != default(Microsoft.Xna.Framework.Color))
23471 {
23472 mySpriteBatch.Draw(TextureAssets.Npc[num130].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetColor(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23473 }
23474 }
23475 break;
23476 }
23477 }
23478 if (rCurrentNPC.confused)
23479 {
23480 mySpriteBatch.Draw(TextureAssets.Confuse.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 - (float)TextureAssets.Confuse.Height() - 20f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Confuse.Width(), TextureAssets.Confuse.Height()), rCurrentNPC.GetShimmerColor(new Microsoft.Xna.Framework.Color(250, 250, 250, 70)), rCurrentNPC.velocity.X * -0.05f, new Vector2(TextureAssets.Confuse.Width() / 2, TextureAssets.Confuse.Height() / 2), essScale + 0.2f, SpriteEffects.None, 0f);
23481 }
23482 if (type == 247 || type == 248)
23483 {
23484 Vector2 vector54 = new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY);
23486 if (rCurrentNPC.ai[0] == 1f)
23487 {
23488 for (int num139 = 0; num139 < 3; num139++)
23489 {
23490 int num140 = num139 * 5;
23491 int num141 = num140 + 15;
23492 float num142 = Utils.Remap(rCurrentNPC.ai[1], num140, num141, 0f, 1f);
23493 if (num142 != 0f)
23494 {
23495 float num143 = Utils.Remap(num142, 0f, 1f, 2f, 1.1f + 0.1f * (float)num139);
23496 float num144 = num142;
23497 mySpriteBatch.Draw(color: new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num144, texture: value51, position: vector54, sourceRectangle: frame6, rotation: rCurrentNPC.rotation, origin: halfSize, scale: rCurrentNPC.scale * num143, effects: spriteEffects, layerDepth: 0f);
23498 }
23499 }
23500 }
23501 if (rCurrentNPC.ai[0] == 2f)
23502 {
23503 Microsoft.Xna.Framework.Color color26 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * Utils.Remap(rCurrentNPC.ai[1], 0f, 30f, 1f, 0f);
23504 for (int num145 = 0; num145 < 3; num145++)
23505 {
23506 float num146 = 1f;
23507 Vector2 position20 = vector54 + rCurrentNPC.velocity * num145 * -2f;
23508 float num147 = Utils.Remap(num145, 0f, 3f, 1f, 0f);
23510 }
23511 for (int num148 = 0; num148 < 3; num148++)
23512 {
23513 float num149 = 1.1f + 0.1f * (float)num148;
23515 }
23516 }
23517 }
23518 if (type >= 639 && type <= 645)
23519 {
23520 mySpriteBatch.Draw(TextureAssets.GlowMask[286].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.White), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23521 }
23522 if (type >= 646 && type <= 652)
23523 {
23524 mySpriteBatch.Draw(TextureAssets.GlowMask[287].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.White), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23525 }
23526 if (type >= 134 && type <= 136 && npcColor != Microsoft.Xna.Framework.Color.Black)
23527 {
23528 mySpriteBatch.Draw(TextureAssets.Dest[type - 134].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * (1f - (float)rCurrentNPC.alpha / 255f), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23529 }
23530 else if (type == 125)
23531 {
23532 mySpriteBatch.Draw(TextureAssets.EyeLaser.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23533 }
23534 else if (type == 139)
23535 {
23536 mySpriteBatch.Draw(TextureAssets.Probe.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23537 }
23538 else if (type == 127)
23539 {
23540 if (NPC.IsMechQueenUp)
23541 {
23542 rCurrentNPC.whoAmI = rCurrentNPC.whoAmI;
23543 for (int num150 = 0; num150 < 200; num150++)
23544 {
23545 if (!npc[num150].active || (npc[num150].type != 125 && npc[num150].type != 126))
23546 {
23547 continue;
23548 }
23549 float scale5 = npc[num150].scale;
23550 float x = npc[num150].Center.X;
23551 float y2 = npc[num150].Center.Y;
23552 Vector2 mechQueenCenter = rCurrentNPC.GetMechQueenCenter();
23553 Vector2 vector55 = new Vector2((npc[num150].type == 125) ? (-18) : 20, -18f);
23554 vector55 = vector55.RotatedBy(rCurrentNPC.rotation);
23556 float num151 = x - vector56.X;
23557 float num152 = y2 - vector56.Y;
23558 float rotation9 = (float)Math.Atan2(num152, num151) - 1.57f;
23559 bool flag11 = true;
23560 float num153 = (float)Math.Sqrt(num151 * num151 + num152 * num152);
23561 if (num153 > 2000f)
23562 {
23563 flag11 = false;
23564 }
23565 float num154 = 40f * scale5;
23566 while (flag11)
23567 {
23568 num153 = (float)Math.Sqrt(num151 * num151 + num152 * num152);
23569 if (num153 < num154)
23570 {
23571 flag11 = false;
23572 continue;
23573 }
23574 num153 = (float)TextureAssets.Chain12.Height() * scale5 / num153;
23575 num151 *= num153;
23576 num152 *= num153;
23577 Microsoft.Xna.Framework.Color color27 = Lighting.GetColor((int)vector56.X / 16, (int)(vector56.Y / 16f));
23579 vector56.X += num151;
23580 vector56.Y += num152;
23581 num151 = x - vector56.X;
23582 num152 = y2 - vector56.Y;
23583 }
23584 }
23585 }
23586 else
23587 {
23588 mySpriteBatch.Draw(TextureAssets.BoneEyes.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23589 }
23590 }
23591 else if (type == 131)
23592 {
23593 mySpriteBatch.Draw(TextureAssets.BoneLaser.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23594 }
23595 else if (type == 120)
23596 {
23597 for (int num155 = 1; num155 < rCurrentNPC.oldPos.Length; num155++)
23598 {
23599 _ = ref rCurrentNPC.oldPos[num155];
23601 newColor3.R = (byte)(150 * (10 - num155) / 15);
23602 newColor3.G = (byte)(100 * (10 - num155) / 15);
23603 newColor3.B = (byte)(150 * (10 - num155) / 15);
23604 newColor3.A = (byte)(50 * (10 - num155) / 15);
23605 newColor3 = rCurrentNPC.GetShimmerColor(newColor3);
23606 mySpriteBatch.Draw(TextureAssets.Chaos.Value, new Vector2(rCurrentNPC.oldPos[num155].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num155].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, newColor3, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23607 }
23608 }
23609 else if (type == 137 || type == 138)
23610 {
23611 for (int num156 = 1; num156 < rCurrentNPC.oldPos.Length; num156++)
23612 {
23613 _ = ref rCurrentNPC.oldPos[num156];
23615 newColor4.R = (byte)(150 * (10 - num156) / 15);
23616 newColor4.G = (byte)(100 * (10 - num156) / 15);
23617 newColor4.B = (byte)(150 * (10 - num156) / 15);
23618 newColor4.A = (byte)(50 * (10 - num156) / 15);
23619 newColor4 = rCurrentNPC.GetShimmerColor(newColor4);
23620 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num156].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num156].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, newColor4, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23621 }
23622 }
23623 else if (type == 327)
23624 {
23625 mySpriteBatch.Draw(TextureAssets.PumpkingFace.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23626 for (int num157 = 1; num157 < 10; num157++)
23627 {
23628 Microsoft.Xna.Framework.Color color28 = new Microsoft.Xna.Framework.Color(110 - num157 * 10, 110 - num157 * 10, 110 - num157 * 10, 110 - num157 * 10);
23629 Vector2 vector57 = new Vector2((float)rand.Next(-10, 11) * 0.2f, (float)rand.Next(-10, 11) * 0.2f);
23630 mySpriteBatch.Draw(TextureAssets.PumpkingFace.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36) + vector57, rCurrentNPC.frame, color28, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23631 }
23632 }
23633 else if (type == 325)
23634 {
23635 mySpriteBatch.Draw(TextureAssets.TreeFace.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23636 for (int num158 = 1; num158 < 10; num158++)
23637 {
23638 Microsoft.Xna.Framework.Color color29 = new Microsoft.Xna.Framework.Color(110 - num158 * 10, 110 - num158 * 10, 110 - num158 * 10, 110 - num158 * 10);
23639 Vector2 vector58 = new Vector2((float)rand.Next(-10, 11) * 0.2f, (float)rand.Next(-10, 11) * 0.2f);
23640 mySpriteBatch.Draw(TextureAssets.TreeFace.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36) + vector58, rCurrentNPC.frame, color29, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23641 }
23642 }
23643 else if (type == 345)
23644 {
23645 mySpriteBatch.Draw(TextureAssets.IceQueen.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23646 for (int num159 = 1; num159 < 5; num159++)
23647 {
23648 mySpriteBatch.Draw(color: new Microsoft.Xna.Framework.Color(100 - num159 * 10, 100 - num159 * 10, 100 - num159 * 10, 100 - num159 * 10), texture: TextureAssets.IceQueen.Value, position: new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36) - rCurrentNPC.velocity * num159 * 0.2f, sourceRectangle: rCurrentNPC.frame, rotation: rCurrentNPC.rotation, origin: halfSize, scale: rCurrentNPC.scale, effects: spriteEffects, layerDepth: 0f);
23649 }
23650 }
23651 else if (type == 355)
23652 {
23653 mySpriteBatch.Draw(TextureAssets.Firefly.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23654 }
23655 else if (type == 358)
23656 {
23657 mySpriteBatch.Draw(TextureAssets.Lightningbug.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23658 }
23659 else if (type == 654)
23660 {
23661 mySpriteBatch.Draw(TextureAssets.GlowMask[290].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23662 }
23663 else if (type == 653)
23664 {
23665 mySpriteBatch.Draw(TextureAssets.GlowMask[288].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 3f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23666 }
23667 else if (type == 82)
23668 {
23669 mySpriteBatch.Draw(TextureAssets.WraithEye.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23670 for (int num160 = 1; num160 < 10; num160++)
23671 {
23672 mySpriteBatch.Draw(color: new Microsoft.Xna.Framework.Color(110 - num160 * 10, 110 - num160 * 10, 110 - num160 * 10, 110 - num160 * 10), texture: TextureAssets.WraithEye.Value, position: new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36) - rCurrentNPC.velocity * num160 * 0.5f, sourceRectangle: rCurrentNPC.frame, rotation: rCurrentNPC.rotation, origin: halfSize, scale: rCurrentNPC.scale, effects: spriteEffects, layerDepth: 0f);
23673 }
23674 }
23675 else if (type == 253)
23676 {
23677 mySpriteBatch.Draw(TextureAssets.ReaperEye.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 3f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23678 for (int num161 = 1; num161 < 20; num161++)
23679 {
23680 mySpriteBatch.Draw(color: new Microsoft.Xna.Framework.Color(210 - num161 * 20, 210 - num161 * 20, 210 - num161 * 20, 210 - num161 * 20), texture: TextureAssets.ReaperEye.Value, position: new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 3f + halfSize.Y * rCurrentNPC.scale + num36) - rCurrentNPC.velocity * num161 * 0.5f, sourceRectangle: rCurrentNPC.frame, rotation: rCurrentNPC.rotation, origin: halfSize, scale: rCurrentNPC.scale, effects: spriteEffects, layerDepth: 0f);
23681 }
23682 }
23683 else if (type == 245 && rCurrentNPC.alpha == 0 && !getGoodWorld)
23684 {
23685 mySpriteBatch.Draw(color: new Microsoft.Xna.Framework.Color(mouseTextColor, mouseTextColor, mouseTextColor, 0), texture: TextureAssets.Golem[3].Value, position: new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), sourceRectangle: frame6, rotation: rCurrentNPC.rotation, origin: halfSize, scale: rCurrentNPC.scale, effects: spriteEffects, layerDepth: 0f);
23686 }
23687 else if (type == 246 && !getGoodWorld)
23688 {
23690 if (rCurrentNPC.frame.Y < 222)
23691 {
23692 if (!getGoodWorld)
23693 {
23694 mySpriteBatch.Draw(TextureAssets.Golem[1].Value, new Vector2(rCurrentNPC.Center.X - screenPos.X - 20f, rCurrentNPC.Center.Y - screenPos.Y - 27f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Golem[1].Width(), TextureAssets.Golem[1].Height() / 2), color34, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
23695 }
23697 value52.Y = 0;
23698 mySpriteBatch.Draw(TextureAssets.Extra[107].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), value52, color34, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23699 }
23700 else if (!getGoodWorld && rCurrentNPC.frame.Y < 444)
23701 {
23702 mySpriteBatch.Draw(TextureAssets.Golem[2].Value, new Vector2(rCurrentNPC.Center.X - screenPos.X + 26f, rCurrentNPC.Center.Y - screenPos.Y - 28f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Golem[2].Width(), TextureAssets.Golem[2].Height() / 4), color34, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
23703 }
23704 else if (!getGoodWorld)
23705 {
23706 mySpriteBatch.Draw(TextureAssets.Golem[2].Value, new Vector2(rCurrentNPC.Center.X - screenPos.X - 38f, rCurrentNPC.Center.Y - screenPos.Y - 28f), new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.Golem[2].Height() / 2, TextureAssets.Golem[2].Width(), TextureAssets.Golem[2].Height() / 4), color34, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
23707 }
23708 }
23709 else if (type == 249 && !getGoodWorld)
23710 {
23712 if (!getGoodWorld)
23713 {
23714 mySpriteBatch.Draw(TextureAssets.Golem[1].Value, new Vector2(rCurrentNPC.Center.X - screenPos.X - 20f, rCurrentNPC.Center.Y - screenPos.Y - 47f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Golem[1].Width(), TextureAssets.Golem[1].Height() / 2), color35, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
23715 }
23716 int num162 = (int)rCurrentNPC.frameCounter / 4;
23717 Texture2D value53 = TextureAssets.Extra[106].Value;
23720 value54.Y += value54.Height * 2 * num162 + frame6.Y;
23721 mySpriteBatch.Draw(value53, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), value54, color35, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23722 value53 = TextureAssets.Extra[107].Value;
23723 value54 = frame6;
23724 mySpriteBatch.Draw(value53, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), value54, color35, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23725 }
23726 else if (type == 383)
23727 {
23728 mySpriteBatch.Draw(TextureAssets.GlowMask[11].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23729 if (rCurrentNPC.ai[2] != 0f && npc[(int)rCurrentNPC.ai[2] - 1].active && npc[(int)rCurrentNPC.ai[2] - 1].type == 384)
23730 {
23731 _ = rCurrentNPC.ai[2];
23732 mySpriteBatch.Draw(TextureAssets.Npc[384].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), null, new Microsoft.Xna.Framework.Color(100, 100, 100, 0), rCurrentNPC.rotation, new Vector2(TextureAssets.Npc[384].Width(), TextureAssets.Npc[384].Height()) / 2f, rCurrentNPC.scale, spriteEffects, 0f);
23733 }
23734 }
23735 else if (type == 381)
23736 {
23739 int num163 = TextureAssets.Npc[type].Height() / npcFrameCount[type];
23740 int num164 = rCurrentNPC.frame.Y / num163;
23742 switch (num164)
23743 {
23744 case 0:
23745 zero3 += new Vector2(8f, 32f);
23746 break;
23747 case 1:
23748 zero3 += new Vector2(6f, 72f);
23749 break;
23750 case 2:
23751 zero3 += new Vector2(8f, 126f);
23752 break;
23753 case 3:
23754 zero3 += new Vector2(6f, 174f);
23755 break;
23756 case 4:
23757 zero3 += new Vector2(6f, 224f);
23758 break;
23759 case 5:
23760 zero3 += new Vector2(8f, 272f);
23761 break;
23762 case 6:
23763 zero3 += new Vector2(10f, 318f);
23764 break;
23765 case 7:
23766 zero3 += new Vector2(14f, 366f);
23767 break;
23768 case 8:
23769 zero3 += new Vector2(10f, 414f);
23770 break;
23771 }
23772 zero3.Y -= num163 * num164;
23773 zero3 -= halfSize;
23774 int num165 = 2;
23775 if (rCurrentNPC.ai[2] > 0f)
23776 {
23777 num165 = (int)rCurrentNPC.ai[2] - 1;
23778 }
23779 if (rCurrentNPC.velocity.Y != 0f)
23780 {
23781 num165 = 3;
23782 }
23783 value55.Y += 44 * num165;
23784 switch (num165)
23785 {
23786 case 0:
23787 origin19 = new Vector2(10f, 18f);
23788 break;
23789 case 1:
23790 origin19 = new Vector2(8f, 20f);
23791 break;
23792 case 2:
23793 origin19 = new Vector2(8f, 20f);
23794 break;
23795 case 3:
23796 origin19 = new Vector2(8f, 20f);
23797 break;
23798 case 4:
23799 origin19 = new Vector2(6f, 18f);
23800 break;
23801 }
23802 if (spriteEffects.HasFlag(SpriteEffects.FlipHorizontally))
23803 {
23804 zero3.X *= -1f;
23805 origin19.X = (float)value55.Width - origin19.X;
23806 }
23807 zero3 += rCurrentNPC.Center;
23808 zero3 -= screenPos;
23809 zero3.Y += rCurrentNPC.gfxOffY;
23811 mySpriteBatch.Draw(TextureAssets.GlowMask[24].Value, zero3, value55, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, origin19, rCurrentNPC.scale, spriteEffects, 0f);
23812 }
23813 else if (type == 382)
23814 {
23817 int num166 = TextureAssets.Npc[type].Height() / npcFrameCount[type];
23818 int num167 = rCurrentNPC.frame.Y / num166;
23820 switch (num167)
23821 {
23822 case 0:
23823 zero4 += new Vector2(8f, 30f);
23824 break;
23825 case 1:
23826 zero4 += new Vector2(6f, 68f);
23827 break;
23828 case 2:
23829 zero4 += new Vector2(8f, 120f);
23830 break;
23831 case 3:
23832 zero4 += new Vector2(6f, 166f);
23833 break;
23834 case 4:
23835 zero4 += new Vector2(6f, 214f);
23836 break;
23837 case 5:
23838 zero4 += new Vector2(8f, 260f);
23839 break;
23840 case 6:
23841 zero4 += new Vector2(14f, 304f);
23842 break;
23843 case 7:
23844 zero4 += new Vector2(14f, 350f);
23845 break;
23846 case 8:
23847 zero4 += new Vector2(10f, 396f);
23848 break;
23849 }
23850 zero4.Y -= num166 * num167;
23851 zero4 -= halfSize;
23852 int num168 = 2;
23853 if (rCurrentNPC.ai[2] > 0f)
23854 {
23855 num168 = (int)rCurrentNPC.ai[2] - 1;
23856 }
23857 if (rCurrentNPC.velocity.Y != 0f)
23858 {
23859 num168 = 3;
23860 }
23861 value56.Y += 44 * num168;
23862 switch (num168)
23863 {
23864 case 0:
23865 origin20 = new Vector2(10f, 18f);
23866 break;
23867 case 1:
23868 origin20 = new Vector2(8f, 20f);
23869 break;
23870 case 2:
23871 origin20 = new Vector2(8f, 20f);
23872 break;
23873 case 3:
23874 origin20 = new Vector2(8f, 20f);
23875 break;
23876 case 4:
23877 origin20 = new Vector2(6f, 18f);
23878 break;
23879 }
23880 if (spriteEffects.HasFlag(SpriteEffects.FlipHorizontally))
23881 {
23882 zero4.X *= -1f;
23883 origin20.X = (float)value56.Width - origin20.X;
23884 }
23885 zero4 += rCurrentNPC.Center;
23886 zero4 -= screenPos;
23887 zero4.Y += rCurrentNPC.gfxOffY;
23889 }
23890 else if (type == 520)
23891 {
23892 mySpriteBatch.Draw(TextureAssets.GlowMask[164].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23894 Vector2 origin21 = new Vector2(4f, 4f);
23895 int num169 = TextureAssets.Npc[type].Height() / npcFrameCount[type];
23896 _ = rCurrentNPC.frame.Y / num169;
23897 if (spriteEffects.HasFlag(SpriteEffects.FlipHorizontally))
23898 {
23899 zero5.X *= -1f;
23900 origin21.X = (float)TextureAssets.Extra[56].Width() - origin21.X;
23901 }
23902 zero5 += rCurrentNPC.Top + new Vector2(0f, 20f);
23903 zero5 -= screenPos;
23904 zero5.Y += rCurrentNPC.gfxOffY;
23905 float num170 = rCurrentNPC.localAI[3];
23906 if (spriteEffects.HasFlag(SpriteEffects.FlipHorizontally))
23907 {
23908 num170 += (float)Math.PI;
23909 }
23911 mySpriteBatch.Draw(TextureAssets.GlowMask[165].Value, zero5, null, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), num170, origin21, rCurrentNPC.scale, spriteEffects, 0f);
23912 }
23913 else if (type == 386)
23914 {
23915 mySpriteBatch.Draw(TextureAssets.GlowMask[31].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23916 }
23917 else if (type == 387)
23918 {
23919 Microsoft.Xna.Framework.Color color36 = new Microsoft.Xna.Framework.Color(1f, 1f, 1f, 1f) * 0.75f;
23920 if (rCurrentNPC.ai[0] > 0f)
23921 {
23922 float amount7 = (rCurrentNPC.ai[0] + 1f) / 60f;
23924 color36.A = (byte)MathHelper.Lerp((int)color36.A, 0f, amount7);
23925 }
23926 color36 *= (255f - (float)rCurrentNPC.alpha) / 255f;
23927 mySpriteBatch.Draw(TextureAssets.GlowMask[32].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, color36, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23928 }
23929 else if (type == 388)
23930 {
23931 mySpriteBatch.Draw(TextureAssets.GlowMask[33].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23932 }
23933 else if (type == 389)
23934 {
23935 mySpriteBatch.Draw(TextureAssets.GlowMask[34].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23936 }
23937 else if (type == 4 && rCurrentNPC.ai[1] >= 4f && rCurrentNPC.ai[0] == 3f)
23938 {
23939 for (int num171 = 1; num171 < rCurrentNPC.oldPos.Length; num171++)
23940 {
23941 _ = ref rCurrentNPC.oldPos[num171];
23943 color37.R = (byte)(0.5 * (double)(int)color37.R * (double)(10 - num171) / 20.0);
23944 color37.G = (byte)(0.5 * (double)(int)color37.G * (double)(10 - num171) / 20.0);
23945 color37.B = (byte)(0.5 * (double)(int)color37.B * (double)(10 - num171) / 20.0);
23946 color37.A = (byte)(0.5 * (double)(int)color37.A * (double)(10 - num171) / 20.0);
23947 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num171].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num171].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, color37, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23948 }
23949 }
23950 else if (type == 437)
23951 {
23953 white5.A = 200;
23954 mySpriteBatch.Draw(TextureAssets.GlowMask[109].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), frame6, white5, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23955 mySpriteBatch.Draw(TextureAssets.GlowMask[108].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + num35 + rCurrentNPC.gfxOffY), null, white5, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23956 }
23957 else if (type == 471 && rCurrentNPC.ai[3] < 0f)
23958 {
23959 for (int num172 = 1; num172 < rCurrentNPC.oldPos.Length; num172++)
23960 {
23961 _ = ref rCurrentNPC.oldPos[num172];
23963 color38.R = (byte)(0.5 * (double)(int)color38.R * (double)(10 - num172) / 20.0);
23964 color38.G = (byte)(0.5 * (double)(int)color38.G * (double)(10 - num172) / 20.0);
23965 color38.B = (byte)(0.5 * (double)(int)color38.B * (double)(10 - num172) / 20.0);
23966 color38.A = (byte)(0.5 * (double)(int)color38.A * (double)(10 - num172) / 20.0);
23967 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num172].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num172].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, color38, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23968 }
23969 }
23970 else if (type == 477 && rCurrentNPC.velocity.Length() > 9f)
23971 {
23972 for (int num173 = 1; num173 < rCurrentNPC.oldPos.Length; num173++)
23973 {
23974 _ = ref rCurrentNPC.oldPos[num173];
23976 color39.R = (byte)(0.5 * (double)(int)color39.R * (double)(10 - num173) / 20.0);
23977 color39.G = (byte)(0.5 * (double)(int)color39.G * (double)(10 - num173) / 20.0);
23978 color39.B = (byte)(0.5 * (double)(int)color39.B * (double)(10 - num173) / 20.0);
23979 color39.A = (byte)(0.5 * (double)(int)color39.A * (double)(10 - num173) / 20.0);
23981 int num174 = TextureAssets.Npc[type].Height() / npcFrameCount[type];
23982 frame7.Y -= num174 * num173;
23983 while (frame7.Y < 0)
23984 {
23985 frame7.Y += num174 * npcFrameCount[type];
23986 }
23987 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num173].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num173].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), frame7, color39, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
23988 }
23989 }
23990 if (type == 479 && (double)rCurrentNPC.velocity.Length() > 6.5)
23991 {
23992 for (int num175 = 1; num175 < rCurrentNPC.oldPos.Length; num175++)
23993 {
23994 _ = ref rCurrentNPC.oldPos[num175];
23996 color40.R = (byte)(0.5 * (double)(int)color40.R * (double)(10 - num175) / 20.0);
23997 color40.G = (byte)(0.5 * (double)(int)color40.G * (double)(10 - num175) / 20.0);
23998 color40.B = (byte)(0.5 * (double)(int)color40.B * (double)(10 - num175) / 20.0);
23999 color40.A = (byte)(0.5 * (double)(int)color40.A * (double)(10 - num175) / 20.0);
24001 int num176 = TextureAssets.Npc[type].Height() / npcFrameCount[type];
24002 frame8.Y -= num176 * num175;
24003 while (frame8.Y < 0)
24004 {
24005 frame8.Y += num176 * npcFrameCount[type];
24006 }
24007 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num175].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num175].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), frame8, color40, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24008 }
24009 }
24010 else if (type == 472)
24011 {
24012 mySpriteBatch.Draw(TextureAssets.GlowMask[110].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24013 }
24014 else if (rCurrentNPC.aiStyle == 87)
24015 {
24016 if ((int)rCurrentNPC.ai[0] == 4 || rCurrentNPC.ai[0] == 5f || rCurrentNPC.ai[0] == 6f)
24017 {
24018 for (int num177 = 1; num177 < rCurrentNPC.oldPos.Length; num177++)
24019 {
24020 _ = ref rCurrentNPC.oldPos[num177];
24022 newColor5.R = (byte)(0.5 * (double)(int)newColor5.R * (double)(10 - num177) / 20.0);
24023 newColor5.G = (byte)(0.5 * (double)(int)newColor5.G * (double)(10 - num177) / 20.0);
24024 newColor5.B = (byte)(0.5 * (double)(int)newColor5.B * (double)(10 - num177) / 20.0);
24025 newColor5.A = (byte)(0.5 * (double)(int)newColor5.A * (double)(10 - num177) / 20.0);
24026 newColor5 = rCurrentNPC.GetShimmerColor(newColor5);
24027 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2(rCurrentNPC.oldPos[num177].X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[type].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.oldPos[num177].Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[type].Height() * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36), rCurrentNPC.frame, newColor5, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24028 }
24029 }
24030 }
24031 else
24032 {
24033 switch (type)
24034 {
24035 case 50:
24036 {
24038 Vector2 center4 = rCurrentNPC.Center;
24039 float num199 = 0f;
24040 switch (rCurrentNPC.frame.Y / (TextureAssets.Npc[type].Height() / npcFrameCount[type]))
24041 {
24042 case 0:
24043 num199 = 2f;
24044 break;
24045 case 1:
24046 num199 = -6f;
24047 break;
24048 case 2:
24049 num199 = 2f;
24050 break;
24051 case 3:
24052 num199 = 10f;
24053 break;
24054 case 4:
24055 num199 = 2f;
24056 break;
24057 case 5:
24058 num199 = 0f;
24059 break;
24060 }
24061 center4.Y += rCurrentNPC.gfxOffY - (70f - num199) * rCurrentNPC.scale;
24062 mySpriteBatch.Draw(value57, center4 - screenPos, null, npcColor, 0f, value57.Size() / 2f, 1f, spriteEffects, 0f);
24063 break;
24064 }
24065 case 411:
24066 mySpriteBatch.Draw(TextureAssets.GlowMask[136].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24067 break;
24068 case 409:
24069 mySpriteBatch.Draw(TextureAssets.GlowMask[138].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24070 break;
24071 case 410:
24072 mySpriteBatch.Draw(TextureAssets.GlowMask[137].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24073 break;
24074 case 407:
24075 mySpriteBatch.Draw(TextureAssets.GlowMask[139].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24076 break;
24077 case 405:
24078 mySpriteBatch.Draw(TextureAssets.GlowMask[141].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24079 break;
24080 case 406:
24081 mySpriteBatch.Draw(TextureAssets.GlowMask[142].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24082 break;
24083 case 424:
24084 mySpriteBatch.Draw(TextureAssets.GlowMask[144].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24085 break;
24086 case 423:
24087 mySpriteBatch.Draw(TextureAssets.GlowMask[145].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24088 break;
24089 case 421:
24090 mySpriteBatch.Draw(TextureAssets.GlowMask[146].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24091 break;
24092 case 420:
24093 mySpriteBatch.Draw(TextureAssets.GlowMask[147].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24094 break;
24095 case 425:
24096 {
24097 Vector2 vector60 = rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY);
24098 mySpriteBatch.Draw(TextureAssets.GlowMask[150].Value, vector60, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24099 Vector2 drawpos = vector60 + new Vector2(27 * -rCurrentNPC.spriteDirection, 0f);
24100 float num200 = rCurrentNPC.ai[3];
24101 DrawPrettyStarSparkle(Utils.Remap(num200, 0f, 15f, 0f, 1f), SpriteEffects.None, drawpos, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), Microsoft.Xna.Framework.Color.Green, num200, 0f, 30f, 30f, 36f, 0f, new Vector2(3f, 1.5f), new Vector2(2f, 2f));
24102 break;
24103 }
24104 case 429:
24105 mySpriteBatch.Draw(TextureAssets.GlowMask[151].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24106 break;
24107 case 418:
24108 {
24109 mySpriteBatch.Draw(TextureAssets.GlowMask[161].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24110 float num197 = 0.25f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 0.25f;
24111 for (int num198 = 0; num198 < 4; num198++)
24112 {
24113 mySpriteBatch.Draw(TextureAssets.GlowMask[161].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((float)num198 * ((float)Math.PI / 2f)) * num197, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24114 }
24115 break;
24116 }
24117 case 412:
24118 case 413:
24119 case 414:
24120 {
24122 int num194 = 157 + type - 412;
24123 if (type == 414 && rCurrentNPC.localAI[2] != 0f)
24124 {
24125 int num195 = (int)rCurrentNPC.localAI[2];
24126 if (rCurrentNPC.localAI[2] < 0f)
24127 {
24128 num195 = 128 + (int)rCurrentNPC.localAI[2];
24129 }
24130 int num196 = 255 - num195;
24132 }
24133 mySpriteBatch.Draw(TextureAssets.GlowMask[num194].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, color41, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24134 break;
24135 }
24136 default:
24137 switch (type)
24138 {
24139 case 415:
24140 {
24141 mySpriteBatch.Draw(TextureAssets.GlowMask[155].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24142 float num178 = 0.5f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 0.5f;
24143 for (int num179 = 0; num179 < 4; num179++)
24144 {
24145 mySpriteBatch.Draw(TextureAssets.GlowMask[155].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((float)num179 * ((float)Math.PI / 2f)) * num178, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24146 }
24147 break;
24148 }
24149 case 419:
24150 mySpriteBatch.Draw(TextureAssets.GlowMask[154].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24151 if (rCurrentNPC.ai[2] >= -6f)
24152 {
24153 float num182 = 0.5f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 0.5f;
24154 for (int num183 = 0; num183 < 4; num183++)
24155 {
24156 mySpriteBatch.Draw(TextureAssets.GlowMask[154].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((float)num183 * ((float)Math.PI / 2f)) * num182, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24157 }
24158 }
24159 else
24160 {
24161 float num184 = 4f;
24162 for (int num185 = 0; num185 < 4; num185++)
24163 {
24164 mySpriteBatch.Draw(TextureAssets.GlowMask[154].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + Vector2.UnitX.RotatedBy((float)num185 * ((float)Math.PI / 2f)) * num184, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24165 }
24166 }
24167 break;
24168 case 417:
24169 {
24170 mySpriteBatch.Draw(TextureAssets.GlowMask[160].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24171 float num192 = 0.25f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 0.25f;
24172 for (int num193 = 0; num193 < 4; num193++)
24173 {
24174 mySpriteBatch.Draw(TextureAssets.GlowMask[160].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((float)num193 * ((float)Math.PI / 2f)) * num192, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24175 }
24176 break;
24177 }
24178 case 516:
24179 {
24180 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24181 float num186 = 0.5f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 0.5f;
24182 for (int num187 = 0; num187 < 4; num187++)
24183 {
24184 mySpriteBatch.Draw(TextureAssets.Npc[type].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((float)num187 * ((float)Math.PI / 2f)) * num186, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24185 }
24186 break;
24187 }
24188 case 518:
24189 {
24190 Vector2 vector59 = new Vector2(-10f, 0f);
24191 mySpriteBatch.Draw(TextureAssets.GlowMask[163].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize + vector59, rCurrentNPC.scale, spriteEffects, 0f);
24192 float num190 = 0.5f + (rCurrentNPC.GetAlpha(npcColor).ToVector3() - new Vector3(0.5f)).Length() * 0.5f;
24193 for (int num191 = 0; num191 < 4; num191++)
24194 {
24195 mySpriteBatch.Draw(TextureAssets.GlowMask[163].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((float)num191 * ((float)Math.PI / 2f)) * num190, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize + vector59, rCurrentNPC.scale, spriteEffects, 0f);
24196 }
24197 break;
24198 }
24199 case 344:
24200 mySpriteBatch.Draw(TextureAssets.GlowMask[253].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 100) * 0.5f, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24201 break;
24202 case 346:
24203 {
24204 float num180 = 4f;
24205 for (int num181 = 0; num181 < 4; num181++)
24206 {
24207 mySpriteBatch.Draw(TextureAssets.GlowMask[254].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + Vector2.UnitX.RotatedBy((float)num181 * ((float)Math.PI / 2f)) * num180, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24208 }
24209 mySpriteBatch.Draw(TextureAssets.GlowMask[254].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24210 break;
24211 }
24212 case 315:
24213 {
24214 float num188 = 2f;
24215 for (int num189 = 0; num189 < 4; num189++)
24216 {
24217 mySpriteBatch.Draw(TextureAssets.GlowMask[255].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY) + Vector2.UnitX.RotatedBy((float)num189 * ((float)Math.PI / 2f)) * num188, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24218 }
24219 mySpriteBatch.Draw(TextureAssets.GlowMask[255].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 200), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24220 break;
24221 }
24222 case 525:
24223 mySpriteBatch.Draw(TextureAssets.GlowMask[169].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24224 break;
24225 case 526:
24226 mySpriteBatch.Draw(TextureAssets.GlowMask[170].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24227 break;
24228 case 527:
24229 mySpriteBatch.Draw(TextureAssets.GlowMask[171].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(200, 200, 200, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24230 break;
24231 case 533:
24232 mySpriteBatch.Draw(TextureAssets.GlowMask[172].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24233 break;
24234 case 160:
24235 {
24236 Texture2D texture2D2 = null;
24237 texture2D2 = ((rCurrentNPC.townNpcVariationIndex != 1) ? TextureAssets.GlowMask[166].Value : TextureAssets.GlowMask[352].Value);
24238 mySpriteBatch.Draw(texture2D2, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24239 break;
24240 }
24241 case 209:
24242 {
24243 Texture2D texture2D = null;
24244 texture2D = ((rCurrentNPC.townNpcVariationIndex != 1) ? TextureAssets.GlowMask[167].Value : ((rCurrentNPC.altTexture != 1) ? TextureAssets.GlowMask[350].Value : TextureAssets.GlowMask[351].Value));
24245 mySpriteBatch.Draw(texture2D, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24246 break;
24247 }
24248 }
24249 break;
24250 }
24251 }
24252 if (rCurrentNPC.aiStyle == 7)
24253 {
24255 }
24256 break;
24257 }
24258 case 488:
24259 break;
24260 }
24261 break;
24262 }
24263 goto case 426;
24264 case 426:
24265 case 427:
24266 case 428:
24267 case 521:
24268 case 523:
24269 case 541:
24270 case 542:
24271 case 543:
24272 case 544:
24273 case 545:
24274 case 581:
24275 {
24278 float amount10 = 0f;
24279 float amount11 = 0f;
24280 int num270 = 0;
24281 int num271 = 0;
24282 int num272 = 1;
24283 int num273 = 15;
24284 int num274 = 0;
24285 float scale8 = rCurrentNPC.scale;
24286 float value77 = rCurrentNPC.scale;
24287 int num275 = 0;
24288 float num276 = 0f;
24289 float num277 = 0f;
24290 float num278 = 0f;
24293 switch (type)
24294 {
24295 case 558:
24296 case 559:
24297 case 560:
24298 case 574:
24299 case 575:
24300 if (rCurrentNPC.ai[0] != 2f)
24301 {
24302 num270 = 0;
24303 break;
24304 }
24305 num270 = 6;
24306 num271 = 2;
24307 num273 = num270 * 3;
24308 num274 = 1;
24309 break;
24310 case 566:
24311 case 567:
24312 case 578:
24313 num270 = 0;
24314 num36 = -2f;
24315 break;
24316 case 552:
24317 case 553:
24318 case 554:
24319 case 555:
24320 case 556:
24321 case 557:
24322 case 561:
24323 case 562:
24324 case 563:
24325 case 568:
24326 case 569:
24327 case 570:
24328 case 571:
24329 case 572:
24330 case 573:
24331 num270 = 0;
24332 if (type == 561 || type == 562 || type == 563)
24333 {
24334 num36 = -8f;
24335 }
24336 if (type == 555 || type == 556 || type == 557)
24337 {
24338 num36 = -5f;
24339 }
24340 if (type == 572 || type == 573)
24341 {
24342 num36 = -4f;
24343 }
24344 if (type == 570 || type == 571)
24345 {
24346 spriteEffects ^= SpriteEffects.FlipHorizontally;
24347 num36 = -2f;
24348 }
24349 if (type == 568 || type == 569)
24350 {
24351 spriteEffects ^= SpriteEffects.FlipHorizontally;
24352 num36 = -3f;
24353 num275 = 4;
24354 num277 = 4f;
24355 num276 = (float)Math.Cos(GlobalTimeWrappedHourly % 1.5f / 1.5f * ((float)Math.PI * 2f)) / 6f + 0.75f;
24357 color46.A = 127;
24358 amount10 = 0.5f;
24359 }
24360 if (rCurrentNPC.localAI[3] < 60f)
24361 {
24362 float num291 = rCurrentNPC.localAI[3] / 60f;
24363 num275 = 3;
24364 num276 = 1f - num291 * num291;
24365 num277 = 8f;
24366 color46 = new Microsoft.Xna.Framework.Color(127, 0, 255, 0);
24367 amount11 = 1f;
24369 }
24370 break;
24371 case 541:
24372 num275 = 4;
24373 num277 = 6f;
24374 num276 = (float)Math.Cos(GlobalTimeWrappedHourly % 2.4f / 2.4f * ((float)Math.PI * 2f)) / 2f + 0.5f;
24376 amount10 = 0.5f;
24377 break;
24378 case 661:
24379 num275 = 6;
24380 num277 = 6f;
24381 num276 = (float)Math.Cos(GlobalTimeWrappedHourly % 2.4f / 2.4f * ((float)Math.PI * 2f)) / 2f + 0.5f;
24382 num276 = MathHelper.Max(num276, Utils.GetLerpValue(0f, 60f, rCurrentNPC.ai[2], clamped: true));
24383 amount10 = 0.5f;
24384 break;
24385 case 426:
24386 num275 = 4;
24387 num277 = 4f;
24388 num276 = (float)Math.Cos(GlobalTimeWrappedHourly % 1.2f / 1.2f * ((float)Math.PI * 2f)) / 2f + 0.5f;
24390 amount10 = 0.5f;
24391 num270 = 6;
24392 num271 = 2;
24393 num273 = num270;
24394 break;
24395 case 427:
24396 num270 = 8;
24397 num271 = 2;
24398 num273 = num270 * 3;
24399 break;
24400 case 546:
24401 num270 = 8;
24402 num271 = 2;
24403 num273 = num270 * 3;
24404 break;
24405 case 542:
24406 case 543:
24407 case 544:
24408 case 545:
24409 num270 = 6;
24410 num271 = 3;
24411 num273 = num270 * 2;
24412 break;
24413 case 581:
24414 num270 = 6;
24415 num271 = 2;
24416 num273 = num270 * 3;
24417 break;
24418 case 521:
24419 num270 = 10;
24420 num271 = 2;
24421 num273 = num270;
24422 num274 = 1;
24423 value77 = 0.3f;
24424 break;
24425 case 523:
24426 num275 = 3;
24427 num277 = 10f * rCurrentNPC.scale;
24428 amount10 = 0.5f;
24429 amount11 = 0.8f;
24431 color46.A = 128;
24432 num278 = rCurrentNPC.localAI[0];
24433 num276 = rCurrentNPC.localAI[1];
24434 break;
24435 case 620:
24436 num36 = -9f;
24437 origin23 = rCurrentNPC.frame.Size() * new Vector2(0.5f, 0.5f) + new Vector2(-4 * rCurrentNPC.spriteDirection, 0f);
24438 num275 = 4;
24439 num277 = 6f;
24440 num276 = (float)Math.Cos(GlobalTimeWrappedHourly % 2.4f / 2.4f * ((float)Math.PI * 2f)) / 2f + 0.5f;
24442 amount10 = 0.5f;
24443 num270 = 6;
24444 num271 = 2;
24445 num273 = num270 * 3;
24446 num274 = 1;
24447 break;
24448 case 618:
24449 {
24450 float num279 = 90f;
24451 float num280 = 180f;
24452 if (rCurrentNPC.ai[0] == 1f && rCurrentNPC.ai[1] < num279)
24453 {
24454 int num281 = 3;
24455 float num282 = num279 / (float)num281;
24456 float num283 = rCurrentNPC.ai[1] % num282 / num282;
24457 num275 = 6;
24458 num277 = 15f;
24459 num276 = num283 * 0.8f + 0.2f;
24460 }
24461 if (rCurrentNPC.ai[0] == 3f && rCurrentNPC.ai[1] < num280)
24462 {
24463 int num284 = 1;
24464 float num285 = num280 / (float)num284;
24465 float num286 = rCurrentNPC.ai[1] % num285 / num285;
24466 num275 = 4;
24467 num277 = 25f;
24468 num276 = num286;
24469 Vector2 vector69 = rCurrentNPC.scale * new Vector2(1f, 0.5f + num286 * 0.75f);
24472 Vector2 origin24 = rectangle12.Size() * new Vector2(0.5f, 0.5f);
24473 for (int num287 = 0; num287 < num275; num287++)
24474 {
24476 white8 *= Utils.GetLerpValue(0f, 0.5f, num276) * Utils.GetLerpValue(1f, 0.5f, num276) * 0.25f;
24477 white8.A = 0;
24478 white8.G = 0;
24479 white8.B = 0;
24480 float num288 = (float)num287 / (float)num275 * ((float)Math.PI * 2f) + rCurrentNPC.rotation + num278;
24481 Vector2 position30 = rCurrentNPC.Center + num288.ToRotationVector2() * num277 * num276 - screenPos;
24482 position30 -= new Vector2(value76.Width, value76.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
24483 position30 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
24485 }
24486 for (int num289 = 0; num289 < num275; num289++)
24487 {
24489 white9 *= Utils.GetLerpValue(0f, 0.5f, num276) * Utils.GetLerpValue(1f, 0.5f, num276) * 0.25f;
24490 white9.A = 0;
24491 float num290 = (float)num289 / (float)num275 * ((float)Math.PI * 2f) + rCurrentNPC.rotation + num278;
24492 Vector2 position31 = rCurrentNPC.Center + num290.ToRotationVector2() * num277 * num276 - screenPos;
24493 position31 -= new Vector2(value76.Width, value76.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
24494 position31 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
24496 }
24497 }
24498 break;
24499 }
24500 }
24501 for (int num292 = num272; num292 < num270; num292 += num271)
24502 {
24503 _ = ref rCurrentNPC.oldPos[num292];
24506 value79 = rCurrentNPC.GetAlpha(value79);
24507 value79 *= (float)(num270 - num292) / (float)num273;
24508 _ = rCurrentNPC.rotation;
24509 if (num274 == 1)
24510 {
24511 _ = rCurrentNPC.oldRot[num292];
24512 }
24513 float scale9 = MathHelper.Lerp(scale8, value77, 1f - (float)(num270 - num292) / (float)num273);
24514 Vector2 position32 = rCurrentNPC.oldPos[num292] + new Vector2(rCurrentNPC.width, rCurrentNPC.height) / 2f - screenPos;
24515 position32 -= new Vector2(value76.Width, value76.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
24516 position32 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
24518 }
24519 for (int num293 = 0; num293 < num275; num293++)
24520 {
24523 value80 = rCurrentNPC.GetAlpha(value80);
24525 value80 *= 1f - num276;
24526 Vector2 position33 = rCurrentNPC.Center + ((float)num293 / (float)num275 * ((float)Math.PI * 2f) + rCurrentNPC.rotation + num278).ToRotationVector2() * num277 * num276 - screenPos;
24527 position33 -= new Vector2(value76.Width, value76.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
24528 position33 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
24530 }
24531 Vector2 vector70 = rCurrentNPC.Center - screenPos;
24532 vector70 -= new Vector2(value76.Width, value76.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
24533 vector70 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
24535 switch (type)
24536 {
24537 case 427:
24538 mySpriteBatch.Draw(TextureAssets.GlowMask[152].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 255 - rCurrentNPC.alpha, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24539 break;
24540 case 426:
24541 mySpriteBatch.Draw(TextureAssets.GlowMask[153].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float)(-TextureAssets.Npc[type].Width()) * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, (float)(-TextureAssets.Npc[type].Height()) * rCurrentNPC.scale / (float)npcFrameCount[type] + 4f + halfSize.Y * rCurrentNPC.scale + num36 + rCurrentNPC.gfxOffY), rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 128 - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24542 break;
24543 }
24544 if (type == 541)
24545 {
24547 for (int num294 = 0; num294 < num275; num294++)
24548 {
24550 newColor6 = rCurrentNPC.GetAlpha(newColor6);
24551 newColor6 *= 1f - num276;
24552 Vector2 position34 = rCurrentNPC.Center + ((float)num294 / (float)num275 * ((float)Math.PI * 2f) + rCurrentNPC.rotation + num278).ToRotationVector2() * (4f * num276 + 2f) - screenPos;
24553 position34 -= new Vector2(value76.Width, value76.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
24554 position34 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
24556 }
24558 }
24559 if (type == 661)
24560 {
24561 num278 = MathHelper.Lerp(0f, 3f, Utils.GetLerpValue(0f, 60f, rCurrentNPC.ai[2], clamped: true));
24562 for (int num295 = 0; num295 < num275; num295++)
24563 {
24564 Microsoft.Xna.Framework.Color newColor7 = new Microsoft.Xna.Framework.Color(127 - rCurrentNPC.alpha, 127 - rCurrentNPC.alpha, 127 - rCurrentNPC.alpha, 0).MultiplyRGBA(hslToRgb((GlobalTimeWrappedHourly + (float)num295 / (float)num275) % 1f, 1f, 0.5f));
24565 newColor7 = rCurrentNPC.GetAlpha(newColor7);
24566 newColor7 *= 1f - num276 * 0.5f;
24567 newColor7.A = 0;
24568 float num296 = 2f + rCurrentNPC.ai[2];
24569 Vector2 position35 = rCurrentNPC.Center + ((float)num295 / (float)num275 * ((float)Math.PI * 2f) + rCurrentNPC.rotation + num278).ToRotationVector2() * (num296 * num276 + 2f) - screenPos;
24570 position35 -= new Vector2(value76.Width, value76.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
24571 position35 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
24573 }
24574 mySpriteBatch.Draw(value76, vector70, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.1f, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24575 }
24576 if ((type == 568 || type == 569) && rCurrentNPC.localAI[3] >= 60f)
24577 {
24578 Microsoft.Xna.Framework.Color color49 = new Microsoft.Xna.Framework.Color(127 - rCurrentNPC.alpha, 127 - rCurrentNPC.alpha, 127 - rCurrentNPC.alpha, 0).MultiplyRGBA(color46);
24579 for (int num297 = 0; num297 < num275; num297++)
24580 {
24582 newColor8 = rCurrentNPC.GetAlpha(newColor8);
24583 newColor8 *= 1f - num276;
24584 Vector2 position36 = rCurrentNPC.Center + ((float)num297 / (float)num275 * ((float)Math.PI * 2f) + rCurrentNPC.rotation + num278).ToRotationVector2() * (4f * num276 + 2f) - screenPos;
24585 position36 -= new Vector2(value76.Width, value76.Height / npcFrameCount[type]) * rCurrentNPC.scale / 2f;
24586 position36 += halfSize * rCurrentNPC.scale + new Vector2(0f, num35 + num36 + rCurrentNPC.gfxOffY);
24588 }
24590 float num298 = rCurrentNPC.localAI[0];
24591 if (num298 > 0f)
24592 {
24593 byte a = (byte)((Math.Cos(num298 * ((float)Math.PI * 2f) / 60f) * 0.5 + 0.5) * 32.0 + 0.0);
24594 Microsoft.Xna.Framework.Color color50 = new Microsoft.Xna.Framework.Color(180, 90, 255, a) * 0.75f;
24595 float num299 = 1f;
24596 if (num298 < 60f)
24597 {
24598 float lerpValue3 = Utils.GetLerpValue(0f, 60f, num298);
24600 num299 = MathHelper.Lerp(1f, 0.5f, 1f - lerpValue3 * lerpValue3);
24601 }
24603 Vector2 origin25 = value81.Size() / 2f;
24605 float num300 = num298 * 0.0041887905f;
24606 float num301 = (float)Math.PI / 2f;
24607 scale10.Y *= 1f;
24608 scale10.X *= 1f;
24609 for (float num302 = 0f; num302 < 16f; num302 += 1f)
24610 {
24611 float num303 = num300 + (float)Math.PI * 2f * (num302 / 16f);
24612 Vector2 position37 = rCurrentNPC.Center - screenPos + num303.ToRotationVector2() * 400f * num299;
24613 mySpriteBatch.Draw(value81, position37, null, color50, num303 + (float)Math.PI / 2f + num301, origin25, scale10, SpriteEffects.None, 0f);
24614 }
24615 }
24616 }
24617 if (type == 546)
24618 {
24619 mySpriteBatch.Draw(TextureAssets.Extra[76].Value, vector70, rCurrentNPC.frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 200), MathHelper.Clamp(rCurrentNPC.velocity.X * 0.1f, -(float)Math.PI / 8f, (float)Math.PI / 8f), halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24620 }
24621 if ((type == 566 || type == 567) && rCurrentNPC.localAI[3] >= 115f)
24622 {
24623 int frameY = (int)(GlobalTimeWrappedHourly % 0.5f / 0.5f * 4f);
24625 Microsoft.Xna.Framework.Rectangle rectangle13 = value82.Frame(1, 4, 0, frameY);
24626 Vector2 vector71 = new Vector2(rCurrentNPC.spriteDirection * 8, -26f) * rCurrentNPC.scale;
24627 int num304 = rCurrentNPC.frame.Y / rCurrentNPC.frame.Height;
24628 int num305 = 0;
24629 switch (num304)
24630 {
24631 case 0:
24632 num305 = 6;
24633 break;
24634 case 1:
24635 num305 = 4;
24636 break;
24637 case 2:
24638 num305 = 2;
24639 break;
24640 case 3:
24641 num305 = 6;
24642 break;
24643 case 4:
24644 num305 = 8;
24645 break;
24646 case 5:
24647 num305 = 6;
24648 break;
24649 case 6:
24650 num305 = 4;
24651 break;
24652 case 7:
24653 num305 = 6;
24654 break;
24655 case 8:
24656 num305 = 2;
24657 break;
24658 }
24660 vector71.Y += num305;
24661 mySpriteBatch.Draw(value82, vector70 + vector71 * rCurrentNPC.scale, rectangle13, color51, MathHelper.Clamp(rCurrentNPC.velocity.X * 0.1f, -(float)Math.PI / 8f, (float)Math.PI / 8f), rectangle13.Size() / 2f, rCurrentNPC.scale * 0.7f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0f);
24662 }
24663 if (type == 618)
24664 {
24665 mySpriteBatch.Draw(TextureAssets.Extra[129].Value, vector70, rCurrentNPC.frame, rCurrentNPC.GetAlpha(color47), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0f);
24666 }
24667 break;
24668 }
24669 }
24670 }
24671
24673 {
24674 Texture2D value = TextureAssets.Npc[typeCache].Value;
24675 Vector2 vector = rCurrentNPC.Bottom - screenPos;
24676 Microsoft.Xna.Framework.Rectangle rectangle = value.Frame(5, 5, rCurrentNPC.frame.Y / 5, rCurrentNPC.frame.Y % 5, 2, 2);
24677 Vector2 origin = rectangle.Size() * new Vector2(0.5f, 1f);
24678 origin.Y -= 4f;
24679 int num = 106;
24680 if (rCurrentNPC.spriteDirection == 1)
24681 {
24682 origin.X = num;
24683 }
24684 else
24685 {
24686 origin.X = rectangle.Width - num;
24687 }
24689 float amount = 0f;
24690 float amount2 = 0f;
24691 int num2 = 0;
24692 float num3 = 0f;
24693 float num4 = 0f;
24694 float num5 = 10f;
24696 if (rCurrentNPC.localAI[3] > 0f)
24697 {
24698 float num6 = rCurrentNPC.localAI[3] / 36f;
24699 num2 = 2;
24700 num3 = num6 * num6;
24701 num4 = 20f;
24702 value2 = new Microsoft.Xna.Framework.Color(80, 0, 0, 255) * 0.5f;
24703 amount2 = 1f;
24705 }
24706 for (int i = 0; i < num2; i++)
24707 {
24710 value3 = rCurrentNPC.GetAlpha(value3);
24712 value3 *= 1f - num3 * 0.5f;
24714 mySpriteBatch.Draw(value, vector2 + new Vector2(0f, 1f).RotatedBy((float)i * ((float)Math.PI * 2f) / (float)num2 + GlobalTimeWrappedHourly * num5) * num3 * num4, rectangle, value3, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
24715 }
24718 float num7 = 0f;
24719 if (rCurrentNPC.localAI[3] > 0f)
24720 {
24721 float amount3 = Utils.Remap(rCurrentNPC.localAI[3], 0f, 20f, 0f, 1f);
24723 }
24724 if (rCurrentNPC.ai[0] == 7f || rCurrentNPC.ai[0] == 8f)
24725 {
24726 num7 = Utils.Remap(rCurrentNPC.ai[1], 20f, 60f, 0f, 2f);
24727 if (num7 > 1f)
24728 {
24729 num7 = 2f - num7;
24730 }
24732 color2 *= 1f - num7;
24733 float num8 = 5f;
24734 for (int j = 0; (float)j < num8; j++)
24735 {
24737 float num9 = num7 * num7;
24738 float num10 = 80f * num9;
24739 float num11 = 80f * num9 + (float)(30 * j) * num9;
24740 Vector2 vector4 = Vector2.UnitX.RotatedBy((float)j * ((float)Math.PI * 2f) / num8 + GlobalTimeWrappedHourly * 6f) * num10;
24741 Vector2 vector5 = Vector2.UnitX.RotatedBy((float)j * ((float)Math.PI * 2f) / num8 + GlobalTimeWrappedHourly * 3f * ((float)j * 0.5f)) * num11;
24742 mySpriteBatch.Draw(value, vector3 + vector4 + vector5, rectangle, color2 * 0.5f, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
24743 }
24744 }
24745 mySpriteBatch.Draw(value, vector, rectangle, color2, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
24746 if (rCurrentNPC.localAI[3] > 0f)
24747 {
24748 Texture2D value5 = TextureAssets.Extra[245].Value;
24749 float num12 = Utils.Remap(rCurrentNPC.localAI[3], 0f, 20f, 0f, 1f);
24750 Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(255, 30, 30, 66) * rCurrentNPC.Opacity * num12 * 0.25f * (1f - num7);
24751 for (int k = 0; k < num2; k++)
24752 {
24754 mySpriteBatch.Draw(value5, vector6 + new Vector2(0f, 1f).RotatedBy((float)k * ((float)Math.PI * 2f) / (float)num2 + GlobalTimeWrappedHourly * num5) * num3 * 4f, rectangle, color3, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
24755 }
24756 }
24757 }
24758
24760 {
24762 int num = 0;
24763 int num2 = 0;
24764 mySpriteBatch.Draw(TextureAssets.Npc[typeCache].Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float)(rCurrentNPC.width / 2) - (float)TextureAssets.Npc[typeCache].Width() * rCurrentNPC.scale / 2f + halfSize.X * rCurrentNPC.scale, rCurrentNPC.position.Y - screenPos.Y + (float)rCurrentNPC.height - (float)TextureAssets.Npc[typeCache].Height() * rCurrentNPC.scale / (float)npcFrameCount[typeCache] + 4f + halfSize.Y * rCurrentNPC.scale + (float)num2 + (float)num + rCurrentNPC.gfxOffY), sourceRectangle, rCurrentNPC.GetAlpha(npcColor), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24765 }
24766
24768 {
24769 Texture2D value = TextureAssets.Npc[typeCache].Value;
24770 Vector2 vector = rCurrentNPC.Center - screenPos;
24771 int num = 5;
24772 int horizontalFrames = 4;
24773 float num2 = ((float)rCurrentNPC.whoAmI * 0.11f + (float)timeForVisualEffects / 360f) % 1f;
24774 Microsoft.Xna.Framework.Color color = hslToRgb(num2, 1f, 0.65f);
24775 color.A /= 2;
24776 float rotation = rCurrentNPC.rotation;
24778 Vector2 origin = rectangle.Size() / 2f;
24779 float scale = rCurrentNPC.scale;
24781 Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 1f;
24782 int num3 = rCurrentNPC.oldPos.Length;
24783 int num4 = num3 - 1 - 5;
24784 int num5 = 5;
24785 int num6 = 3;
24786 float num7 = 32f;
24787 float num8 = 16f;
24788 float fromMax = new Vector2(num7, num8).Length();
24789 float num9 = Utils.Remap(Vector2.Distance(rCurrentNPC.oldPos[num4], rCurrentNPC.position), 0f, fromMax, 0f, 100f);
24790 num9 = (int)num9 / 5;
24791 num9 *= 5f;
24792 num9 /= 100f;
24793 num8 *= num9;
24794 num7 *= num9;
24795 float num10 = 9f;
24796 float num11 = 0.5f;
24797 float num12 = (float)Math.PI;
24798 for (int num13 = num4; num13 >= num5; num13 -= num6)
24799 {
24800 Vector2 vector2 = rCurrentNPC.oldPos[num13] - rCurrentNPC.position;
24801 float num14 = Utils.Remap(num13, 0f, num3, 1f, 0f);
24802 float num15 = 1f - num14;
24803 Vector2 spinningpoint = new Vector2((float)Math.Sin((double)((float)rCurrentNPC.whoAmI / 17f) + timeForVisualEffects / (double)num10 + (double)(num14 * 2f * ((float)Math.PI * 2f))) * num8, 0f - num7) * num15;
24804 vector2 += spinningpoint.RotatedBy(num12);
24806 color3.A = 0;
24807 mySpriteBatch.Draw(value, vector + vector2, value2, color3 * num14 * 0.16f, rotation, origin, scale * Utils.Remap(num14 * num14, 0f, 1f, 0f, 2.5f), npcSpriteEffect, 0f);
24808 }
24809 mySpriteBatch.Draw(value, vector, value2, color2, rotation, origin, scale, npcSpriteEffect, 0f);
24812 white.A /= 2;
24813 mySpriteBatch.Draw(value, vector, value3, white, rotation, origin, scale, npcSpriteEffect, 0f);
24814 mySpriteBatch.Draw(value, vector, rectangle, color, rotation, origin, scale, npcSpriteEffect, 0f);
24815 float num16 = MathHelper.Clamp((float)Math.Sin(timeForVisualEffects / 60.0) * 0.3f + 0.3f, 0f, 1f);
24816 float num17 = 0.8f + (float)Math.Sin(timeForVisualEffects / 15.0 * 6.2831854820251465) * 0.3f;
24819 mySpriteBatch.Draw(value, vector, value4, color4, rotation, origin, scale * num17, SpriteEffects.None, 0f);
24822 mySpriteBatch.Draw(value, vector, value5, color5, rotation, origin, scale * num17, SpriteEffects.None, 0f);
24823 }
24824
24826 {
24827 Texture2D value = TextureAssets.Npc[typeCache].Value;
24828 Vector2 vector = rCurrentNPC.Center - screenPos;
24829 bool flag = rCurrentNPC.AI_120_HallowBoss_IsInPhase2();
24830 int num = (int)rCurrentNPC.ai[0];
24831 Texture2D value2 = TextureAssets.Extra[159].Value;
24832 Microsoft.Xna.Framework.Rectangle rectangle = value2.Frame(1, 11, 0, (int)(rCurrentNPC.localAI[0] / 4f) % 11);
24834 Texture2D value3 = TextureAssets.Extra[158].Value;
24835 Texture2D value4 = TextureAssets.Extra[160].Value;
24836 Texture2D value5 = TextureAssets.Extra[157].Value;
24840 Vector2 origin = rectangle2.Size() / 2f;
24841 Vector2 origin2 = rectangle3.Size() / 2f;
24842 int num2 = 0;
24843 int num3 = 0;
24844 if (armFrameToUseLeft == 5)
24845 {
24846 num2 = 1;
24847 }
24848 if (armFrameToUseRight == 5)
24849 {
24850 num3 = 1;
24851 }
24852 float num4 = 1f;
24853 int num5 = 0;
24854 int num6 = 0;
24855 float num7 = 0f;
24856 float num8 = 0f;
24857 float num9 = 0f;
24858 if (num == 8 || num == 9)
24859 {
24860 num7 = Utils.GetLerpValue(0f, 30f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(90f, 30f, rCurrentNPC.ai[1], clamped: true);
24861 num8 = Utils.GetLerpValue(0f, 30f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(90f, 70f, rCurrentNPC.ai[1], clamped: true);
24862 num9 = Utils.GetLerpValue(0f, 15f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(45f, 30f, rCurrentNPC.ai[1], clamped: true);
24864 num4 *= 1f - num9;
24865 num5 = 4;
24866 num6 = 3;
24867 }
24868 if (num == 10)
24869 {
24870 num7 = Utils.GetLerpValue(30f, 90f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(165f, 90f, rCurrentNPC.ai[1], clamped: true);
24871 num8 = Utils.GetLerpValue(0f, 60f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(180f, 120f, rCurrentNPC.ai[1], clamped: true);
24872 num9 = Utils.GetLerpValue(0f, 60f, rCurrentNPC.ai[1], clamped: true) * Utils.GetLerpValue(180f, 120f, rCurrentNPC.ai[1], clamped: true);
24874 num4 *= 1f - num9;
24875 num6 = 4;
24876 }
24877 if (num6 + num5 > 0)
24878 {
24879 for (int i = -num6; i <= num6 + num5; i++)
24880 {
24881 if (i == 0)
24882 {
24883 continue;
24884 }
24886 Vector2 position = vector;
24887 if (num == 8 || num == 9)
24888 {
24889 float hue = ((float)i + 5f) / 10f;
24890 float num10 = 200f;
24891 float num11 = (float)timeForVisualEffects / 60f;
24892 Vector3 vector2 = Vector3.Transform(matrix: Matrix.CreateRotationX((num11 - 0.3f + (float)i * 0.1f) * 0.7f * ((float)Math.PI * 2f)) * Matrix.CreateRotationY((num11 - 0.8f + (float)i * 0.3f) * 0.7f * ((float)Math.PI * 2f)) * Matrix.CreateRotationZ((num11 + (float)i * 0.5f) * 0.1f * ((float)Math.PI * 2f)), position: Vector3.Forward);
24893 num10 += Utils.GetLerpValue(-1f, 1f, vector2.Z, clamped: true) * 150f;
24895 float lerpValue = Utils.GetLerpValue(90f, 0f, rCurrentNPC.ai[1], clamped: true);
24896 color2 = hslToRgb(hue, 1f, MathHelper.Lerp(0.5f, 1f, lerpValue)) * 0.8f * num8;
24897 color2.A /= 3;
24898 position += spinningpoint.RotatedBy(rCurrentNPC.ai[1] / 180f * ((float)Math.PI * 2f));
24899 }
24900 if (num == 10)
24901 {
24902 if (rCurrentNPC.ai[1] >= 90f)
24903 {
24904 float num12 = (float)timeForVisualEffects / 90f;
24905 int num13 = i;
24906 if (num13 < 0)
24907 {
24908 num13++;
24909 }
24910 Vector2 vector3 = (((float)num13 + 0.5f) * ((float)Math.PI / 4f) + (float)Math.PI * 2f * num12).ToRotationVector2();
24911 position += vector3 * new Vector2(600f * num7, 150f * num7);
24912 }
24913 else
24914 {
24915 position += 200f * new Vector2(i, 0f) * num7;
24916 }
24917 color2 = Microsoft.Xna.Framework.Color.White * 0.8f * num8 * num4;
24918 color2.A /= 3;
24919 }
24920 if (i > num6)
24921 {
24922 float lerpValue2 = Utils.GetLerpValue(30f, 70f, rCurrentNPC.ai[1], clamped: true);
24923 if (lerpValue2 == 0f)
24924 {
24925 continue;
24926 }
24927 position = vector + rCurrentNPC.velocity * -3f * ((float)i - 4f) * lerpValue2;
24928 color2 *= 1f - num9;
24929 }
24930 mySpriteBatch.Draw(value2, position, rectangle, color2, rCurrentNPC.rotation, rectangle.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0f);
24931 mySpriteBatch.Draw(value5, position, rectangle, color2, rCurrentNPC.rotation, rectangle.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0f);
24932 if (flag)
24933 {
24934 Texture2D value6 = TextureAssets.Extra[187].Value;
24935 Microsoft.Xna.Framework.Rectangle value7 = value6.Frame(1, 8, 0, (int)(rCurrentNPC.localAI[0] / 4f) % 8);
24936 mySpriteBatch.Draw(value6, position, value7, color2, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24937 }
24938 mySpriteBatch.Draw(value, position, rCurrentNPC.frame, color2, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24939 for (int j = 0; j < 2; j++)
24940 {
24941 if (j == num2)
24942 {
24943 mySpriteBatch.Draw(value3, position, rectangle2, color2, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect, 0f);
24944 }
24945 if (j == num3)
24946 {
24947 mySpriteBatch.Draw(value4, position, rectangle3, color2, rCurrentNPC.rotation, origin2, rCurrentNPC.scale, npcSpriteEffect, 0f);
24948 }
24949 }
24950 }
24951 }
24952 color *= num4;
24953 mySpriteBatch.Draw(value2, vector, rectangle, color, rCurrentNPC.rotation, rectangle.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0f);
24954 if (!rCurrentNPC.IsABestiaryIconDummy)
24955 {
24956 mySpriteBatch.End();
24958 }
24959 DrawData value8 = new DrawData(value5, vector, rectangle, color, rCurrentNPC.rotation, rectangle.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect);
24960 GameShaders.Misc["HallowBoss"].Apply(value8);
24961 value8.Draw(mySpriteBatch);
24962 pixelShader.CurrentTechnique.Passes[0].Apply();
24963 if (!rCurrentNPC.IsABestiaryIconDummy)
24964 {
24965 mySpriteBatch.End();
24967 }
24968 float num14 = (float)Math.Sin(GlobalTimeWrappedHourly * ((float)Math.PI * 2f) * 0.5f) * 0.5f + 0.5f;
24969 Microsoft.Xna.Framework.Color color3 = hslToRgb((num14 * 0.08f + 0.6f) % 1f, 1f, 0.5f);
24970 color3.A = 0;
24971 color3 *= 0.6f;
24973 {
24975 color3.A = 0;
24976 color3 *= 0.3f;
24977 }
24978 color3 *= num4 * rCurrentNPC.Opacity;
24979 if (flag)
24980 {
24981 Texture2D value9 = TextureAssets.Extra[187].Value;
24982 Microsoft.Xna.Framework.Rectangle value10 = value9.Frame(1, 8, 0, (int)(rCurrentNPC.localAI[0] / 4f) % 8);
24983 mySpriteBatch.Draw(value9, vector, value10, color, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24984 for (float num15 = 0f; num15 < 1f; num15 += 0.25f)
24985 {
24986 Vector2 vector4 = rCurrentNPC.rotation.ToRotationVector2().RotatedBy(num15 * ((float)Math.PI * 2f) + (float)Math.PI / 4f) * MathHelper.Lerp(2f, 8f, num14);
24988 }
24989 }
24990 mySpriteBatch.Draw(value, vector, rCurrentNPC.frame, color, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0f);
24991 if (flag)
24992 {
24993 Texture2D value11 = TextureAssets.Extra[188].Value;
24994 for (float num16 = 0f; num16 < 1f; num16 += 0.25f)
24995 {
24996 Vector2 vector5 = rCurrentNPC.rotation.ToRotationVector2().RotatedBy(num16 * ((float)Math.PI * 2f) + (float)Math.PI / 4f) * MathHelper.Lerp(2f, 8f, num14);
24998 }
24999 }
25000 for (int k = 0; k < 2; k++)
25001 {
25002 if (k == num2)
25003 {
25004 mySpriteBatch.Draw(value3, vector, rectangle2, color, rCurrentNPC.rotation, origin, rCurrentNPC.scale, npcSpriteEffect, 0f);
25005 }
25006 if (k == num3)
25007 {
25009 }
25010 }
25011 }
25012
25014 {
25015 int num = 0;
25016 int num2 = 1;
25017 int num3 = 2;
25018 int num4 = 3;
25019 int num5 = 4;
25020 int num6 = 5;
25021 int num7 = 6;
25022 armFrame_Count = 7;
25023 armFrameToUseLeft = num;
25024 armFrameToUseRight = num;
25025 float num8 = rCurrentNPC.ai[1];
25026 int num9 = num;
25027 switch ((int)rCurrentNPC.ai[0])
25028 {
25029 case 6:
25030 armFrameToUseRight = (armFrameToUseLeft = ((num8 < 6f) ? num3 : ((num8 < 174f) ? num4 : ((!(num8 < 180f)) ? num : num3))));
25031 break;
25032 case 0:
25033 armFrameToUseRight = (armFrameToUseLeft = ((num8 < 106f) ? num2 : ((!(num8 < 110f)) ? num : num3)));
25034 break;
25035 case 2:
25036 case 11:
25037 num9 = ((num8 < 5f) ? num3 : ((!(num8 < 65f)) ? num3 : num4));
25039 break;
25040 case 5:
25041 num9 = ((num8 < 6f) ? num3 : ((!(num8 < 54f)) ? num3 : num4));
25043 break;
25044 case 4:
25045 case 10:
25046 armFrameToUseRight = (armFrameToUseLeft = ((num8 < 6f) ? num3 : ((!(num8 < 54f)) ? num3 : num4)));
25047 break;
25048 case 8:
25049 case 9:
25050 {
25051 num9 = ((num8 < 10f) ? num3 : ((num8 < 20f) ? num4 : ((!(num8 < 30f)) ? num6 : num3)));
25052 int num13 = num9;
25053 int num14 = num9;
25054 int num15 = (int)rCurrentNPC.ai[3];
25055 int num16 = -1;
25056 if (num8 < 30f)
25057 {
25058 if (num15 == -1 * num16)
25059 {
25060 num14 = num2;
25061 }
25062 if (num15 == num16)
25063 {
25064 num13 = num2;
25065 }
25066 }
25067 int num17 = num6;
25068 int num18 = num7;
25069 if (num15 == num16 && num14 == num17)
25070 {
25071 num14 = num18;
25072 }
25073 if (num15 == -1 * num16 && num13 == num17)
25074 {
25075 num13 = num18;
25076 }
25079 break;
25080 }
25081 case 7:
25082 {
25083 bool isExpertMode = GameModeInfo.IsExpertMode;
25084 int num10 = (isExpertMode ? 40 : 60);
25085 int num11 = 0;
25086 int num12 = 5;
25087 if (num8 < (float)(num11 + num12))
25088 {
25090 break;
25091 }
25092 num11 += num12;
25093 if (num8 < (float)(num11 + num10 - num12))
25094 {
25096 break;
25097 }
25098 num11 += num10 - num12;
25099 if (num8 < (float)(num11 + num12))
25100 {
25103 break;
25104 }
25105 num11 += num12;
25106 if (num8 < (float)(num11 + num10 - num12))
25107 {
25110 break;
25111 }
25112 num11 += num10 - num12;
25113 if (num8 < (float)(num11 + num10))
25114 {
25117 break;
25118 }
25119 num11 += num10;
25120 if (num8 < (float)(num11 + num10))
25121 {
25124 break;
25125 }
25126 num11 += num10;
25127 if (isExpertMode)
25128 {
25129 if (num8 < (float)(num11 + num12))
25130 {
25133 break;
25134 }
25135 num11 += num12;
25136 if (num8 < (float)(num11 + num10 - num12))
25137 {
25140 break;
25141 }
25142 num11 += num10 - num12;
25143 if (num8 < (float)(num11 + num12))
25144 {
25147 break;
25148 }
25149 num11 += num12;
25150 if (num8 < (float)(num11 + num10 - num12))
25151 {
25154 break;
25155 }
25156 num11 += num10 - num12;
25157 }
25158 if (num8 >= (float)num11)
25159 {
25162 }
25163 break;
25164 }
25165 case 1:
25166 case 3:
25167 break;
25168 }
25169 }
25170
25172 {
25173 int num = (int)rCurrentNPC.ai[1];
25174 float num2 = 1f;
25175 float num3 = 22f * rCurrentNPC.scale;
25176 float num4 = 18f * rCurrentNPC.scale;
25178 float num5 = rectangle.Width;
25179 float num6 = rectangle.Height;
25180 bool num7 = (int)rCurrentNPC.ai[0] == -999;
25181 if (num7)
25182 {
25183 num3 = 14f * rCurrentNPC.scale;
25184 num4 = 14f * rCurrentNPC.scale;
25185 }
25186 if (num5 > num3)
25187 {
25188 num2 *= num3 / num5;
25189 num5 *= num2;
25190 num6 *= num2;
25191 }
25192 if (num6 > num4)
25193 {
25194 num2 *= num4 / num6;
25195 num5 *= num2;
25196 num6 *= num2;
25197 }
25198 float num8 = -1f;
25199 float num9 = 1f;
25200 int num10 = rCurrentNPC.frame.Y / (TextureAssets.Npc[typeCache].Height() / npcFrameCount[typeCache]);
25201 num9 -= (float)num10;
25202 num8 += (float)(num10 * 2);
25203 float num11 = 0.2f;
25204 num11 -= 0.3f * (float)num10;
25205 if (num7)
25206 {
25207 num11 = 0f;
25208 num9 -= 6f;
25209 num8 -= num5 * addedRotation;
25210 }
25211 if (num == 75)
25212 {
25213 npcColor = new Microsoft.Xna.Framework.Color(255, 255, 255, 0);
25214 num11 *= 0.3f;
25215 num9 -= 2f;
25216 }
25217 npcColor = rCurrentNPC.GetShimmerColor(npcColor);
25218 spriteBatch.Draw(itemTexture, new Vector2(rCurrentNPC.Center.X - screenPosition.X + num8, rCurrentNPC.Center.Y - screenPosition.Y + rCurrentNPC.gfxOffY + num9), rectangle, npcColor, num11, rectangle.Size() / 2f, num2, SpriteEffects.None, 0f);
25219 }
25220
25222 {
25223 instance.LoadItem(item);
25225 if (itemAnimations[item] != null)
25226 {
25228 }
25229 else
25230 {
25231 itemFrame = itemTexture.Frame();
25232 }
25233 }
25234
25236 {
25237 if (!beforeDraw && n.UsesPartyHat())
25238 {
25239 int num = n.frame.Y / n.frame.Height;
25241 if (num >= array.Length)
25242 {
25243 num = 0;
25244 }
25245 Texture2D value = TextureAssets.Extra[72].Value;
25246 int num2 = 0;
25247 switch (n.GetPartyHatColor())
25248 {
25249 case PartyHatColor.Pink:
25250 num2 = 16;
25251 break;
25252 case PartyHatColor.Cyan:
25253 num2 = 17;
25254 break;
25255 case PartyHatColor.Purple:
25256 num2 = 18;
25257 break;
25258 case PartyHatColor.White:
25259 num2 = 19;
25260 break;
25261 }
25263 rectangle.Width -= 2;
25264 rectangle.Height -= 2;
25265 int num3 = 0;
25266 int num4 = 0;
25267 int num5 = n.spriteDirection;
25268 if (n.type == 663)
25269 {
25270 num3 = 1;
25271 }
25272 if (n.type == 637)
25273 {
25274 num3 = 6;
25275 switch (num)
25276 {
25277 case 19:
25278 case 22:
25279 case 23:
25280 case 24:
25281 case 25:
25282 case 26:
25283 case 27:
25284 num3 -= 2;
25285 break;
25286 case 11:
25287 case 12:
25288 case 13:
25289 case 14:
25290 case 15:
25291 num3 += 2;
25292 break;
25293 }
25294 }
25295 if (n.type == 638)
25296 {
25297 num3 = 12;
25298 }
25299 if (n.type == 656)
25300 {
25301 num3 = 6;
25302 switch (num)
25303 {
25304 case 1:
25305 case 2:
25306 case 3:
25307 num3 -= 2;
25308 break;
25309 case 18:
25310 case 19:
25311 case 20:
25312 case 21:
25313 case 22:
25314 case 23:
25315 case 24:
25316 case 25:
25317 num3 -= 4;
25318 break;
25319 case 8:
25320 num3 -= 2;
25321 break;
25322 }
25323 }
25324 if (NPCID.Sets.IsTownSlime[n.type])
25325 {
25326 num5 *= -1;
25327 switch (n.type)
25328 {
25329 default:
25330 num3 = 1;
25331 break;
25332 case 670:
25333 num3 = -1;
25334 break;
25335 case 681:
25336 num3 = -2;
25337 break;
25338 case 682:
25339 num3 = -1;
25340 num4 = 2;
25341 break;
25342 case 683:
25343 num3 = -1;
25344 num4 = -2;
25345 break;
25346 case 684:
25347 num3 = -4;
25348 break;
25349 case 679:
25350 break;
25351 }
25352 }
25353 if (n.IsShimmerVariant)
25354 {
25355 switch (n.type)
25356 {
25357 case 38:
25358 num3 += 2;
25359 num4 = -2;
25360 break;
25361 case 178:
25362 case 228:
25363 num3 = -4;
25364 num4 = -4;
25365 break;
25366 case 107:
25367 num3 = 2;
25368 num4 = -6;
25369 break;
25370 case 54:
25371 num4 = -6;
25372 break;
25373 case 160:
25374 num4 = -2;
25375 break;
25376 case 108:
25377 case 124:
25378 case 208:
25379 case 209:
25380 case 227:
25381 num4 = -4;
25382 break;
25383 }
25384 }
25385 Vector2 vector = n.Top + new Vector2(-2 * num5, n.gfxOffY);
25386 vector.X += num3 * num5;
25387 vector.Y += array[num];
25388 vector.Y += num4;
25389 vector.Y += NPCID.Sets.HatOffsetY[n.type];
25390 int num6 = 0;
25391 if (n.ai[0] == 5f)
25392 {
25393 num6 = -4;
25394 if (n.type == 38)
25395 {
25396 num6 = -8;
25397 }
25398 if (n.type == 124)
25399 {
25400 num6 = -2;
25401 }
25402 if (n.type == 550)
25403 {
25404 num6 = -4;
25405 }
25406 if (n.type == 588)
25407 {
25408 num6 = -4;
25409 }
25410 if (n.type == 108 || n.type == 178)
25411 {
25412 num6 = -6;
25413 }
25414 if (n.type == 637)
25415 {
25416 num6 = -12;
25417 }
25418 if (n.type == 663)
25419 {
25420 num6 = -8;
25421 }
25422 }
25423 vector.Y += num6;
25424 if (n.type == 229 && n.ai[0] == 12f)
25425 {
25426 vector.X -= num5 * 4;
25427 }
25428 if (n.type == 550 && n.ai[0] == 5f)
25429 {
25430 vector.X += num5 * 7;
25431 }
25432 Vector2 origin = rectangle.Size() - new Vector2(rectangle.Width / 2, 12f);
25433 int num7 = 0;
25434 switch (n.type)
25435 {
25436 case 550:
25437 num7 = -4;
25438 break;
25439 case 588:
25440 num7 = 0;
25441 break;
25442 case 227:
25443 num7 = -4;
25444 break;
25445 case 228:
25446 num7 = -2;
25447 break;
25448 case 17:
25449 case 18:
25450 case 19:
25451 case 20:
25452 case 22:
25453 case 124:
25454 case 229:
25455 case 353:
25456 case 633:
25457 case 637:
25458 case 638:
25459 case 656:
25460 case 670:
25461 case 678:
25462 case 679:
25463 case 680:
25464 case 681:
25465 case 682:
25466 case 683:
25467 case 684:
25468 num7 = -1;
25469 break;
25470 case 37:
25471 case 38:
25472 case 54:
25473 case 107:
25474 case 108:
25475 case 160:
25476 case 207:
25477 case 209:
25478 num7 = -3;
25479 break;
25480 case 178:
25481 case 208:
25482 case 369:
25483 num7 = 1;
25484 break;
25485 }
25486 vector.X += num7 * num5;
25487 vector.X += 4 * num5;
25489 if (NPCID.Sets.IsTownSlime[n.type])
25490 {
25491 spriteEffects ^= SpriteEffects.FlipHorizontally;
25492 }
25493 float num8 = 1f;
25494 if (n.shimmerTransparency > 0f)
25495 {
25496 num8 *= 1f - n.shimmerTransparency;
25497 }
25498 spriteBatch.Draw(value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), rectangle, npcColor * n.Opacity * num8, 0f, origin, n.scale, spriteEffects, 0f);
25499 }
25500 if (!beforeDraw && n.type == 681)
25501 {
25502 spriteBatch.Draw(TextureAssets.Extra[250].Value, new Vector2(n.position.X - screenPosition.X + (float)(n.width / 2) - (float)TextureAssets.Npc[n.type].Width() * n.scale / 2f + halfSize.X * n.scale, n.position.Y - screenPosition.Y + (float)n.height - (float)TextureAssets.Npc[n.type].Height() * n.scale / (float)npcFrameCount[n.type] + 4f + halfSize.Y * n.scale + addHeight + addY + n.gfxOffY), n.frame, n.GetAlpha(npcColor), n.rotation, halfSize, n.scale, npcSpriteEffect, 0f);
25503 }
25504 if (NPCID.Sets.AttackType[n.type] == 1 && n.ai[0] == 12f && !beforeDraw)
25505 {
25506 if (n.type == 228 || n.type == 229 || n.type == 209)
25507 {
25508 return;
25509 }
25510 float num9 = n.ai[2];
25512 if (n.spriteDirection == 1)
25513 {
25514 vector2.X *= -1f;
25515 }
25516 Vector2 vector3 = n.Bottom - vector2;
25517 if (n.type == 22 && n.ai[2] > -0.1f)
25518 {
25519 vector3.Y += 4f;
25520 }
25521 if (n.type == 368 && hardMode && n.ai[2] > -0.1f)
25522 {
25523 vector3.Y += 4f;
25524 }
25525 if (n.type == 368 && !hardMode && n.ai[2] < -0.1f)
25526 {
25527 vector3.Y -= 8f;
25528 }
25529 float rotation = num9 * ((float)Math.PI / 2f) * (float)n.spriteDirection;
25530 float num10 = 1f;
25531 int itemtype = 0;
25532 int num11 = 4;
25533 if (n.type == 19)
25534 {
25535 itemtype = (hardMode ? 98 : 95);
25536 if (hardMode)
25537 {
25538 vector3.X -= 10 * n.direction;
25539 vector3.Y += 4f;
25540 }
25541 }
25542 else if (n.type == 22)
25543 {
25544 itemtype = 39;
25545 num11 = 18;
25546 }
25547 else if (n.type == 178)
25548 {
25549 itemtype = 434;
25550 }
25551 else if (n.type == 227)
25552 {
25553 itemtype = 3350;
25554 num11 = 16;
25555 num10 = 0.85f;
25556 }
25557 else if (n.type == 368)
25558 {
25559 itemtype = (hardMode ? 2223 : 2269);
25560 if (hardMode)
25561 {
25562 num11 = 18;
25563 }
25564 else
25565 {
25566 if (n.ai[2] < -0.1f)
25567 {
25568 num11 = 28;
25569 }
25570 num10 = 0.75f;
25571 }
25572 }
25575 int num12 = (int)vector4.X - num11;
25576 Vector2 origin2 = new Vector2(-num12, value2.Height / 2);
25577 if (n.spriteDirection == -1)
25578 {
25579 origin2 = new Vector2(value2.Width + num12, value2.Height / 2);
25580 }
25581 spriteBatch.Draw(itemTexture, new Vector2((int)(vector3.X - screenPosition.X), (int)(vector3.Y - screenPosition.Y)), value2, npcColor, rotation, origin2, n.scale * num10, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
25582 if (n.type == 22 && n.frame.Y / (TextureAssets.Npc[n.type].Height() / npcFrameCount[n.type]) >= 21)
25583 {
25584 Texture2D value3 = TextureAssets.Extra[52].Value;
25585 if (n.IsShimmerVariant)
25586 {
25587 value3 = TextureAssets.Extra[264].Value;
25588 }
25589 Microsoft.Xna.Framework.Rectangle value4 = value3.Frame(1, 5, 0, n.frame.Y / (TextureAssets.Npc[n.type].Height() / npcFrameCount[n.type]) - 21);
25590 spriteBatch.Draw(value3, new Vector2(n.position.X - screenPosition.X + (float)(n.width / 2) - (float)TextureAssets.Npc[n.type].Width() * n.scale / 2f + halfSize.X * n.scale, n.position.Y - screenPosition.Y + (float)n.height - (float)TextureAssets.Npc[n.type].Height() * n.scale / (float)npcFrameCount[n.type] + 4f + halfSize.Y * n.scale + addHeight + addY + n.gfxOffY), value4, n.GetAlpha(npcColor), n.rotation, halfSize, n.scale, npcSpriteEffect, 0f);
25591 }
25592 else if (n.type == 368 && n.frame.Y / (TextureAssets.Npc[n.type].Height() / npcFrameCount[n.type]) >= 21)
25593 {
25594 Texture2D value5 = TextureAssets.Extra[53].Value;
25595 if (n.IsShimmerVariant)
25596 {
25597 value5 = TextureAssets.Extra[265].Value;
25598 }
25599 Microsoft.Xna.Framework.Rectangle value6 = value5.Frame(1, 5, 0, n.frame.Y / (TextureAssets.Npc[n.type].Height() / npcFrameCount[n.type]) - 21);
25600 spriteBatch.Draw(value5, new Vector2(n.position.X - screenPosition.X + (float)(n.width / 2) - (float)TextureAssets.Npc[n.type].Width() * n.scale / 2f + halfSize.X * n.scale, n.position.Y - screenPosition.Y + (float)n.height - (float)TextureAssets.Npc[n.type].Height() * n.scale / (float)npcFrameCount[n.type] + 4f + halfSize.Y * n.scale + addHeight + addY + n.gfxOffY), value6, n.GetAlpha(npcColor), n.rotation, halfSize, n.scale, npcSpriteEffect, 0f);
25601 }
25602 }
25603 if (NPCID.Sets.AttackType[n.type] == 2 && (n.ai[0] == 14f || (n.ai[0] == 24f && n.frameCounter < 240.0)) && !beforeDraw)
25604 {
25605 Texture2D value7 = TextureAssets.Extra[51].Value;
25606 Vector2 vector5 = n.Bottom + new Vector2(0f, n.gfxOffY + 4f);
25607 Microsoft.Xna.Framework.Rectangle rectangle2 = value7.Frame(1, 4, 0, (int)n.frameCounter % 48 / 12);
25608 Vector2 origin3 = rectangle2.Size() * new Vector2(0.5f, 1f);
25609 spriteBatch.Draw(value7, new Vector2((int)(vector5.X - screenPosition.X), (int)(vector5.Y - screenPosition.Y)), rectangle2, n.GetMagicAuraColor(), 0f, origin3, n.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
25610 }
25611 if (NPCID.Sets.AttackType[n.type] == 3 && n.ai[0] == 15f)
25612 {
25613 int num13 = 32;
25614 float num14 = 0f;
25616 short num15 = 4;
25617 if (n.type == 207)
25618 {
25619 num15 = 3349;
25620 num14 = 0.15f;
25621 if (beforeDraw)
25622 {
25623 return;
25624 }
25625 if (n.ai[1] > (float)NPCID.Sets.AttackTime[n.type] * 0.66f)
25626 {
25627 zero.Y = 12f;
25628 }
25629 }
25630 else if (n.type == 353)
25631 {
25632 num15 = 3352;
25633 num14 = 0.15f;
25634 if (!beforeDraw)
25635 {
25636 return;
25637 }
25638 if (n.ai[1] > (float)NPCID.Sets.AttackTime[n.type] * 0.66f)
25639 {
25640 zero.Y = 12f;
25641 }
25642 }
25643 else if (n.type == 441)
25644 {
25645 num15 = 3351;
25646 num13 = 28;
25647 num14 = 0.1f;
25648 if (!beforeDraw)
25649 {
25650 return;
25651 }
25652 if (n.ai[1] > (float)NPCID.Sets.AttackTime[n.type] * 0.66f)
25653 {
25654 zero.Y = 12f;
25655 }
25656 }
25658 Tuple<Vector2, float> swingStats = n.GetSwingStats(NPCID.Sets.AttackTime[n.type] * 2, (int)n.ai[1], n.spriteDirection, num13, num13);
25659 Vector2 vector6 = swingStats.Item1 + (swingStats.Item1 - n.Center) * num14 + zero;
25660 Vector2 origin4 = rectangle3.Size() * new Vector2((n.spriteDirection != 1) ? 1 : 0, 1f);
25661 spriteBatch.Draw(itemTexture2, new Vector2((int)(vector6.X - screenPosition.X), (int)(vector6.Y - screenPosition.Y)), rectangle3, n.GetAlpha(npcColor), swingStats.Item2, origin4, n.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
25662 }
25663 if (n.type == 550 && n.ai[0] == 18f)
25664 {
25665 if (beforeDraw)
25666 {
25667 return;
25668 }
25669 instance.LoadItem(353);
25670 Texture2D value8 = TextureAssets.Item[353].Value;
25671 int num16 = 32;
25672 float num17 = 0.15f;
25675 int num18 = (int)n.ai[2];
25676 if (num18 >= 0 && num18 < 255)
25677 {
25679 bool flag = player.HeldItem.type == 353 && player.direction == Math.Sign(n.Center.X - player.Center.X);
25680 float num19 = player.Hitbox.Distance(n.Center);
25681 float num20 = n.localAI[3];
25682 if (num19 < 46f && flag)
25683 {
25684 n.localAI[3] = 1f;
25685 if (n.localAI[3] != num20)
25686 {
25687 Vector2 vector7 = n.Center + new Vector2(n.spriteDirection * 30, -6f);
25688 Vector2 vector8 = new Vector2(10f, 10f);
25689 for (int i = 0; i < 30; i++)
25690 {
25691 Dust obj = Dust.NewDustDirect(vector7 - vector8 / 2f, (int)vector8.X, (int)vector8.Y, 4, 0f, 0f, 50, new Microsoft.Xna.Framework.Color(245, 200, 30, 155), 0.7f);
25692 obj.noGravity = true;
25693 obj.velocity *= 1f;
25694 Dust.NewDustDirect(vector7 - vector8 / 2f, (int)vector8.X, (int)vector8.Y, 4, 0f, 0f, 50, new Microsoft.Xna.Framework.Color(245, 200, 30, 155), 0.6f).velocity *= 2f;
25695 }
25696 }
25697 }
25698 else if (n.localAI[3] == 1f)
25699 {
25700 n.localAI[3] = 2f;
25701 }
25702 }
25703 Tuple<Vector2, float> swingStats2 = n.GetSwingStats(40, 12, n.spriteDirection, num16, num16);
25704 Vector2 vector9 = swingStats2.Item1 + (swingStats2.Item1 - n.Center) * num17 + zero2;
25705 Vector2 origin5 = rectangle4.Size() * new Vector2((n.spriteDirection != 1) ? 1 : 0, 1f);
25706 spriteBatch.Draw(value8, new Vector2((int)(vector9.X - screenPosition.X), (int)(vector9.Y - screenPosition.Y)), rectangle4, n.GetAlpha(npcColor), swingStats2.Item2, origin5, n.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
25707 }
25708 if (beforeDraw || n.ai[0] != 23f)
25709 {
25710 return;
25711 }
25712 int num21 = (int)n.ai[2];
25714 {
25715 return;
25716 }
25718 int num22 = 0;
25719 num22 = (((int)n.frameCounter < 6) ? 1 : 2);
25720 if (n.ai[1] < 6f)
25721 {
25722 num22 = 1;
25723 }
25724 if (num22 == 0)
25725 {
25726 return;
25727 }
25729 if (num22 == 1)
25730 {
25731 vector10 = new Vector2(10f, 6f);
25732 }
25733 if (num22 == 2)
25734 {
25735 vector10 = new Vector2(16f, 0f);
25736 }
25737 if (!npcSpriteEffect.HasFlag(SpriteEffects.FlipHorizontally))
25738 {
25739 vector10.X *= -1f;
25740 }
25741 if (n.type == 369)
25742 {
25743 vector10.X *= 0.5f;
25744 vector10.Y += 4f;
25745 }
25746 if (n.type == 453)
25747 {
25748 vector10.Y += 8f;
25749 }
25750 if (n.type == 550)
25751 {
25752 if (num21 == 353)
25753 {
25754 rectangle5 = itemTexture3.Frame(1, 3, 0, 1);
25755 }
25756 vector10.Y += 6f;
25757 }
25758 Vector2 vector11 = n.Center + vector10;
25759 Vector2 origin6 = rectangle5.Size() * new Vector2((n.spriteDirection != 1) ? 1 : 0, 1f);
25760 Vector2 position = new Vector2((int)(vector11.X - screenPosition.X), (int)(vector11.Y - screenPosition.Y));
25761 Microsoft.Xna.Framework.Color alpha = n.GetAlpha(npcColor);
25762 spriteBatch.Draw(itemTexture3, position, rectangle5, alpha, 0f, origin6, n.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0f);
25763 }
25764
25766 {
25767 spriteBatch.End();
25768 if (_multiplyBlendState == null)
25769 {
25773 {
25774 ColorBlendFunction = BlendFunction.ReverseSubtract,
25775 ColorDestinationBlend = Blend.One,
25776 ColorSourceBlend = Blend.SourceAlpha,
25777 AlphaBlendFunction = BlendFunction.ReverseSubtract,
25778 AlphaDestinationBlend = Blend.One,
25779 AlphaSourceBlend = Blend.SourceAlpha
25780 };
25781 }
25784 Vector2 position = proj.Center - screenPosition;
25785 LoadProjectile(proj.type);
25787 Microsoft.Xna.Framework.Rectangle rectangle = val.Frame(1, 13, 0, proj.frame);
25788 Vector2 vector = rectangle.Size() / 2f;
25789 Vector2 vector2 = new Vector2(0.7f, 0.7f) * proj.scale;
25790 float num = Utils.Remap(proj.frame, 0f, 3f, 0f, 1f) * Utils.Remap(proj.frame, 4f, 12f, 1f, 0f);
25791 Microsoft.Xna.Framework.Rectangle value = val.Frame(1, 13, 0, 12);
25792 Vector2 origin = vector + new Vector2(0f, 0f);
25793 spriteBatch.Draw(val.Value, position, value, Microsoft.Xna.Framework.Color.White * 0.3f * num, proj.rotation, origin, new Vector2(1f, 6f) * vector2, SpriteEffects.None, 0f);
25794 spriteBatch.Draw(val.Value, position, value, Microsoft.Xna.Framework.Color.White * 0.3f * num, proj.rotation, origin, new Vector2(2f, 2f) * vector2, SpriteEffects.None, 0f);
25795 spriteBatch.Draw(val.Value, position, rectangle, Microsoft.Xna.Framework.Color.White, proj.rotation, vector, vector2, SpriteEffects.None, 0f);
25796 spriteBatch.Draw(val.Value, position, rectangle, Microsoft.Xna.Framework.Color.White, proj.rotation, vector, vector2, SpriteEffects.None, 0f);
25797 spriteBatch.Draw(val.Value, position, rectangle, Microsoft.Xna.Framework.Color.White, proj.rotation, vector, vector2, SpriteEffects.None, 0f);
25798 spriteBatch.Draw(val.Value, position, rectangle, Microsoft.Xna.Framework.Color.White, proj.rotation, vector, vector2, SpriteEffects.None, 0f);
25799 spriteBatch.End();
25801 spriteBatch.Draw(val.Value, position, rectangle, Microsoft.Xna.Framework.Color.Magenta, proj.rotation, vector, vector2, SpriteEffects.None, 0f);
25802 spriteBatch.Draw(val.Value, position, rectangle, Microsoft.Xna.Framework.Color.Magenta, proj.rotation, vector, vector2, SpriteEffects.None, 0f);
25803 spriteBatch.End();
25805 }
25806
25808 {
25809 Vector2 vector = proj.Center - screenPosition;
25812 Vector2 origin = rectangle.Size() / 2f;
25813 float num = proj.scale * 1.1f;
25814 SpriteEffects effects = ((!(proj.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None);
25815 float num2 = proj.localAI[0] / proj.ai[1];
25816 float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f);
25817 float num4 = 0.975f;
25818 float fromValue = Lighting.GetColor(proj.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3.0);
25819 fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f);
25821 spriteBatch.Draw(val.Value, vector, rectangle, color * fromValue * num3, proj.rotation + proj.ai[0] * ((float)Math.PI / 4f) * -1f * (1f - num2), origin, num * num4, effects, 0f);
25823 Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.White * num3 * 0.5f;
25824 color3.A = (byte)((float)(int)color3.A * (1f - fromValue));
25826 color4.G = (byte)((float)(int)color4.G * fromValue);
25827 color4.R = (byte)((float)(int)color4.R * (0.25f + fromValue * 0.75f));
25828 spriteBatch.Draw(val.Value, vector, rectangle, color4 * 0.15f, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25829 spriteBatch.Draw(val.Value, vector, rectangle, new Microsoft.Xna.Framework.Color(80, 30, 160) * fromValue * num3 * 0.3f, proj.rotation, origin, num * 0.8f, effects, 0f);
25830 spriteBatch.Draw(val.Value, vector, rectangle, color2 * fromValue * num3 * 0.7f, proj.rotation, origin, num * num4, effects, 0f);
25831 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.3f * num3 * (1f - fromValue * 0.7f), proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25832 Vector2 drawpos = vector + (proj.rotation + Utils.Remap(num2, 0f, 1f, 0f, (float)Math.PI / 2f) * proj.ai[0]).ToRotationVector2() * ((float)val.Width() * 0.5f - 4f) * num;
25833 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * 0.5f, color2, num2, 0f, 0.5f, 0.5f, 1f, (float)Math.PI / 4f, new Vector2(2f, 2f), Vector2.One);
25834 }
25835
25837 {
25838 Vector2 vector = proj.Center - screenPosition;
25841 Vector2 origin = rectangle.Size() / 2f;
25842 float num = proj.scale * 1.1f;
25843 SpriteEffects effects = ((!(proj.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None);
25844 float num2 = proj.localAI[0] / proj.ai[1];
25845 float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f);
25846 float num4 = 0.975f;
25847 float fromValue = Lighting.GetColor(proj.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3.0);
25848 fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f);
25849 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(180, 160, 60);
25850 spriteBatch.Draw(val.Value, vector, rectangle, color * fromValue * num3, proj.rotation + proj.ai[0] * ((float)Math.PI / 4f) * -1f * (1f - num2), origin, num, effects, 0f);
25853 Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White * num3 * 0.5f;
25854 color4.A = (byte)((float)(int)color4.A * (1f - fromValue));
25856 color5.G = (byte)((float)(int)color5.G * fromValue);
25857 color5.B = (byte)((float)(int)color5.R * (0.25f + fromValue * 0.75f));
25858 spriteBatch.Draw(val.Value, vector, rectangle, color5 * 0.15f, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25859 spriteBatch.Draw(val.Value, vector, rectangle, color3 * fromValue * num3 * 0.3f, proj.rotation, origin, num, effects, 0f);
25860 spriteBatch.Draw(val.Value, vector, rectangle, color2 * fromValue * num3 * 0.5f, proj.rotation, origin, num * num4, effects, 0f);
25861 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.6f * num3, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25862 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.5f * num3, proj.rotation + proj.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f);
25863 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.4f * num3, proj.rotation + proj.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f);
25864 for (float num5 = 0f; num5 < 8f; num5 += 1f)
25865 {
25866 float num6 = proj.rotation + proj.ai[0] * num5 * ((float)Math.PI * -2f) * 0.025f + Utils.Remap(num2, 0f, 1f, 0f, (float)Math.PI / 4f) * proj.ai[0];
25867 Vector2 drawpos = vector + num6.ToRotationVector2() * ((float)val.Width() * 0.5f - 6f) * num;
25868 float num7 = num5 / 9f;
25869 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * num7, color3, num2, 0f, 0.5f, 0.5f, 1f, num6, new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num, Vector2.One * num);
25870 }
25871 Vector2 drawpos2 = vector + (proj.rotation + Utils.Remap(num2, 0f, 1f, 0f, (float)Math.PI / 4f) * proj.ai[0]).ToRotationVector2() * ((float)val.Width() * 0.5f - 4f) * num;
25872 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos2, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * 0.5f, color3, num2, 0f, 0.5f, 0.5f, 1f, 0f, new Vector2(2f, Utils.Remap(num2, 0f, 1f, 4f, 1f)) * num, Vector2.One * num);
25873 }
25874
25876 {
25877 Vector2 vector = proj.Center - screenPosition;
25880 Vector2 origin = rectangle.Size() / 2f;
25881 float num = proj.scale * 1.1f;
25882 SpriteEffects effects = ((!(proj.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None);
25883 float num2 = proj.localAI[0] / proj.ai[1];
25884 float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f);
25885 float num4 = 0.975f;
25886 float fromValue = Lighting.GetColor(proj.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3.0);
25887 fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f);
25889 spriteBatch.Draw(val.Value, vector, rectangle, color * fromValue * num3, proj.rotation + proj.ai[0] * ((float)Math.PI / 4f) * -1f * (1f - num2), origin, num, effects, 0f);
25892 Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White * num3 * 0.5f;
25893 color4.A = (byte)((float)(int)color4.A * (1f - fromValue));
25895 color5.G = (byte)((float)(int)color5.G * fromValue);
25896 color5.B = (byte)((float)(int)color5.R * (0.25f + fromValue * 0.75f));
25897 spriteBatch.Draw(val.Value, vector, rectangle, color5 * 0.15f, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25898 spriteBatch.Draw(val.Value, vector, rectangle, color3 * fromValue * num3 * 0.3f, proj.rotation, origin, num, effects, 0f);
25899 spriteBatch.Draw(val.Value, vector, rectangle, color2 * fromValue * num3 * 0.5f, proj.rotation, origin, num * num4, effects, 0f);
25900 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.6f * num3, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25901 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.5f * num3, proj.rotation + proj.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f);
25902 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.4f * num3, proj.rotation + proj.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f);
25903 for (float num5 = 0f; num5 < 8f; num5 += 1f)
25904 {
25905 float num6 = proj.rotation + proj.ai[0] * num5 * ((float)Math.PI * -2f) * 0.025f + Utils.Remap(num2, 0f, 1f, 0f, (float)Math.PI / 4f) * proj.ai[0];
25906 Vector2 drawpos = vector + num6.ToRotationVector2() * ((float)val.Width() * 0.5f - 6f) * num;
25907 float num7 = num5 / 9f;
25908 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * num7, color3, num2, 0f, 0.5f, 0.5f, 1f, num6, new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num, Vector2.One * num);
25909 }
25910 Vector2 drawpos2 = vector + (proj.rotation + Utils.Remap(num2, 0f, 1f, 0f, (float)Math.PI / 4f) * proj.ai[0]).ToRotationVector2() * ((float)val.Width() * 0.5f - 4f) * num;
25911 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos2, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * 0.5f, color3, num2, 0f, 0.5f, 0.5f, 1f, (float)Math.PI / 4f, new Vector2(Utils.Remap(num2, 0f, 1f, 4f, 1f)) * num, Vector2.One * num);
25912 }
25913
25915 {
25916 Vector2 vector = proj.Center - screenPosition;
25919 Vector2 origin = rectangle.Size() / 2f;
25920 float num = proj.scale * 1.1f;
25921 SpriteEffects effects = ((!(proj.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None);
25922 float num2 = proj.localAI[0] / proj.ai[1];
25923 float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f);
25924 float num4 = 0.975f;
25925 float amount = num3;
25926 float fromValue = Lighting.GetColor(proj.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3.0);
25927 fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f);
25929 spriteBatch.Draw(val.Value, vector, rectangle, color * fromValue * num3, proj.rotation + proj.ai[0] * ((float)Math.PI / 4f) * -1f * (1f - num2), origin, num, effects, 0f);
25932 Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White * num3 * 0.5f;
25933 color4.A = (byte)((float)(int)color4.A * (1f - fromValue));
25935 color5.G = (byte)((float)(int)color5.G * fromValue);
25936 color5.B = (byte)((float)(int)color5.R * (0.25f + fromValue * 0.75f));
25937 spriteBatch.Draw(val.Value, vector, rectangle, color5 * 0.15f, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25938 spriteBatch.Draw(val.Value, vector, rectangle, color3 * fromValue * num3 * 0.3f, proj.rotation, origin, num, effects, 0f);
25939 spriteBatch.Draw(val.Value, vector, rectangle, color2 * fromValue * num3 * 0.5f, proj.rotation, origin, num * num4, effects, 0f);
25940 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.6f * num3, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25941 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.5f * num3, proj.rotation + proj.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f);
25942 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.4f * num3, proj.rotation + proj.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f);
25943 float num5 = num * 0.75f;
25944 for (float num6 = 0f; num6 < 12f; num6 += 1f)
25945 {
25946 float num7 = proj.rotation + proj.ai[0] * num6 * ((float)Math.PI * -2f) * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * proj.ai[0];
25947 Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)val.Width() * 0.5f - 6f) * num;
25948 float num8 = num6 / 12f;
25949 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * num8, color3, num2, 0f, 0.5f, 0.5f, 1f, num7, new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5, Vector2.One * num5);
25950 }
25951 Vector2 drawpos2 = vector + (proj.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * proj.ai[0]).ToRotationVector2() * ((float)val.Width() * 0.5f - 4f) * num;
25952 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos2, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * 0.5f, color3, num2, 0f, 0.5f, 0.5f, 1f, 0f, new Vector2(2f, Utils.Remap(num2, 0f, 1f, 4f, 1f)) * num5, Vector2.One * num5);
25953 }
25954
25956 {
25959 Vector2 origin = rectangle.Size() / 2f;
25960 float num = proj.scale * 1.1f;
25961 SpriteEffects effects = ((!(proj.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None);
25962 float num2 = 0.975f;
25963 float fromValue = Lighting.GetColor(proj.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3.0);
25964 fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f);
25965 float num3 = MathHelper.Min(0.15f + fromValue * 0.85f, Utils.Remap(proj.localAI[0], 30f, 96f, 1f, 0f));
25966 _ = proj.Size / 2f;
25967 float num4 = 2f;
25968 for (float num5 = num4; num5 >= 0f; num5 -= 1f)
25969 {
25970 if (!(proj.oldPos[(int)num5] == Vector2.Zero))
25971 {
25972 Vector2 vector = proj.Center - proj.velocity * 0.5f * num5;
25973 float num6 = proj.oldRot[(int)num5] + proj.ai[0] * ((float)Math.PI * 2f) * 0.1f * (0f - num5);
25974 Vector2 position = vector - screenPosition;
25975 float num7 = 1f - num5 / num4;
25976 float num8 = proj.Opacity * num7 * num7 * 0.85f;
25977 float amount = proj.Opacity * proj.Opacity;
25979 spriteBatch.Draw(val.Value, position, rectangle, color * num3 * num8, num6 + proj.ai[0] * ((float)Math.PI / 4f) * -1f, origin, num * num2, effects, 0f);
25981 Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.White * num8 * 0.5f;
25982 color3.A = (byte)((float)(int)color3.A * (1f - num3));
25984 color4.G = (byte)((float)(int)color4.G * num3);
25985 color4.R = (byte)((float)(int)color4.R * (0.25f + num3 * 0.75f));
25986 float num9 = 3f;
25987 for (float num10 = (float)Math.PI * -2f + (float)Math.PI * 2f / num9; num10 < 0f; num10 += (float)Math.PI * 2f / num9)
25988 {
25989 float num11 = Utils.Remap(num10, (float)Math.PI * -2f, 0f, 0f, 0.5f);
25990 spriteBatch.Draw(val.Value, position, rectangle, color4 * 0.15f * num11, num6 + proj.ai[0] * 0.01f + num10, origin, num, effects, 0f);
25991 spriteBatch.Draw(val.Value, position, rectangle, Microsoft.Xna.Framework.Color.Lerp(new Microsoft.Xna.Framework.Color(80, 30, 160), new Microsoft.Xna.Framework.Color(200, 255, 0), amount) * fromValue * num8 * num11, num6 + num10, origin, num * 0.8f, effects, 0f);
25992 spriteBatch.Draw(val.Value, position, rectangle, color2 * fromValue * num8 * MathHelper.Lerp(0.05f, 0.4f, fromValue) * num11, num6 + num10, origin, num * num2, effects, 0f);
25993 spriteBatch.Draw(val.Value, position, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * MathHelper.Lerp(0.05f, 0.5f, fromValue) * num8 * num11, num6 + num10, origin, num, effects, 0f);
25994 }
25995 spriteBatch.Draw(val.Value, position, rectangle, color4 * 0.15f, num6 + proj.ai[0] * 0.01f, origin, num, effects, 0f);
25996 spriteBatch.Draw(val.Value, position, rectangle, Microsoft.Xna.Framework.Color.Lerp(new Microsoft.Xna.Framework.Color(80, 30, 160), new Microsoft.Xna.Framework.Color(200, 255, 0), amount) * num3 * num8, num6, origin, num * 0.8f, effects, 0f);
25997 spriteBatch.Draw(val.Value, position, rectangle, color2 * fromValue * num8 * MathHelper.Lerp(0.05f, 0.4f, num3), num6, origin, num * num2, effects, 0f);
25998 spriteBatch.Draw(val.Value, position, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * MathHelper.Lerp(0.05f, 0.5f, num3) * num8, num6, origin, num, effects, 0f);
25999 }
26000 }
26001 float num12 = 1f - proj.localAI[0] * 1f / 80f;
26002 if (num12 < 0.5f)
26003 {
26004 num12 = 0.5f;
26005 }
26006 Vector2 drawpos = proj.Center - screenPosition + (proj.rotation + 0.47123894f * proj.ai[0]).ToRotationVector2() * ((float)val.Width() * 0.5f - 4f) * num * num12;
26007 float num13 = MathHelper.Min(num3, MathHelper.Lerp(1f, fromValue, Utils.Remap(proj.localAI[0], 0f, 80f, 0f, 1f)));
26008 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * proj.Opacity * 0.5f * num13, new Microsoft.Xna.Framework.Color(150, 255, 100) * num13, proj.Opacity, 0f, 1f, 1f, 2f, (float)Math.PI / 4f, new Vector2(2f, 2f), Vector2.One);
26009 }
26010
26012 {
26013 Vector2 vector = proj.Center - screenPosition;
26016 Vector2 origin = rectangle.Size() / 2f;
26017 float num = proj.scale * 1.1f;
26018 SpriteEffects effects = ((!(proj.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None);
26019 float num2 = proj.localAI[0] / proj.ai[1];
26020 float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f);
26021 float num4 = 0.975f;
26022 float num5 = Lighting.GetColor(proj.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3.0);
26023 num5 = 0.5f + num5 * 0.5f;
26024 num5 = Utils.Remap(num5, 0.2f, 1f, 0f, 1f);
26025 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(45, 124, 205);
26026 spriteBatch.Draw(val.Value, vector, rectangle, color * num5 * num3, proj.rotation + proj.ai[0] * ((float)Math.PI / 4f) * -1f * (1f - num2), origin, num * 0.95f, effects, 0f);
26029 Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White * num3 * 0.5f;
26030 color4.A = (byte)((float)(int)color4.A * (1f - num5));
26032 color5.G = (byte)((float)(int)color5.G * num5);
26033 color5.B = (byte)((float)(int)color5.R * (0.25f + num5 * 0.75f));
26034 spriteBatch.Draw(val.Value, vector, rectangle, color5 * 0.15f, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
26035 spriteBatch.Draw(val.Value, vector, rectangle, color3 * num5 * num3 * 0.3f, proj.rotation, origin, num, effects, 0f);
26036 spriteBatch.Draw(val.Value, vector, rectangle, color2 * num5 * num3 * 0.5f, proj.rotation, origin, num * num4, effects, 0f);
26037 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.6f * num3, proj.rotation + proj.ai[0] * 0.01f, origin, num, effects, 0f);
26038 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.5f * num3, proj.rotation + proj.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f);
26039 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.4f * num3, proj.rotation + proj.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f);
26040 for (float num6 = 0f; num6 < 12f; num6 += 1f)
26041 {
26042 float num7 = proj.rotation + proj.ai[0] * (num6 - 2f) * ((float)Math.PI * -2f) * 0.025f + Utils.Remap(num2, 0f, 1f, 0f, (float)Math.PI / 4f) * proj.ai[0];
26043 Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)val.Width() * 0.5f - 6f) * num;
26044 float num8 = num6 / 12f;
26045 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * num8, color3, num2, 0f, 0.5f, 0.5f, 1f, num7, new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num, Vector2.One * num);
26046 }
26047 Vector2 drawpos2 = vector + (proj.rotation + Utils.Remap(num2, 0f, 1f, 0f, (float)Math.PI / 4f) * proj.ai[0]).ToRotationVector2() * ((float)val.Width() * 0.5f - 4f) * num;
26048 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos2, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num3 * 0.5f, color3, num2, 0f, 0.5f, 0.5f, 1f, 0f, new Vector2(2f, Utils.Remap(num2, 0f, 1f, 4f, 1f)) * num, Vector2.One * num * 1.5f);
26049 }
26050
26052 {
26053 Vector2 vector = proj.Center - screenPosition;
26056 Vector2 origin = rectangle.Size() / 2f;
26057 float scale = proj.scale;
26058 SpriteEffects spriteEffects = ((!(proj.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None);
26059 SpriteEffects effects = spriteEffects ^ SpriteEffects.FlipVertically;
26060 float num = Utils.Remap(proj.localAI[0], 0f, proj.ai[1] + 30f, 0f, 1f);
26061 float opacity = proj.Opacity;
26062 float num2 = 0.975f;
26063 float num3 = Lighting.GetColor(proj.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3.0);
26064 num3 = 0.5f + num3 * 0.5f;
26065 num3 = Utils.Remap(num3, 0.2f, 1f, 0f, 1f);
26066 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(45, 124, 205);
26067 spriteBatch.Draw(val.Value, vector, rectangle, color * num3 * opacity, proj.rotation + proj.ai[0] * ((float)Math.PI / 4f) * 0.5f * -1f * (1f - num), origin, scale * 0.95f, spriteEffects, 0f);
26068 spriteBatch.Draw(val.Value, vector, rectangle, color * num3 * opacity, proj.rotation + proj.ai[0] * ((float)Math.PI / 4f) * 0.5f * 1f * (1f - num), origin, scale * 0.95f, effects, 0f);
26071 Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White * opacity * 0.5f;
26072 color4.A = (byte)((float)(int)color4.A * (1f - num3));
26074 color5.G = (byte)((float)(int)color5.G * num3);
26075 color5.B = (byte)((float)(int)color5.R * (0.25f + num3 * 0.75f));
26076 spriteBatch.Draw(val.Value, vector, rectangle, color5 * 0.15f, proj.rotation + proj.ai[0] * 0.01f, origin, scale, spriteEffects, 0f);
26077 spriteBatch.Draw(val.Value, vector, rectangle, color5 * 0.15f, proj.rotation + proj.ai[0] * -0.01f, origin, scale, effects, 0f);
26078 float num4 = 1f - num;
26079 float num5 = 0.25f;
26080 float num6 = 0.15f;
26081 float num7 = 0.05f;
26082 spriteBatch.Draw(val.Value, vector, rectangle, color3 * num3 * opacity * 0.3f, proj.rotation + proj.ai[0] * num5 * num4, origin, scale, spriteEffects, 0f);
26083 spriteBatch.Draw(val.Value, vector, rectangle, color3 * num3 * opacity * 0.3f, proj.rotation + (0f - proj.ai[0]) * num5 * num4, origin, scale, effects, 0f);
26084 spriteBatch.Draw(val.Value, vector, rectangle, color2 * num3 * opacity * 0.5f, proj.rotation + proj.ai[0] * num6 * num4, origin, scale * num2, spriteEffects, 0f);
26085 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.6f * opacity, proj.rotation + proj.ai[0] * num7 * num4, origin, scale, spriteEffects, 0f);
26086 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.5f * opacity, proj.rotation + proj.ai[0] * -0.05f, origin, scale * 0.8f, spriteEffects, 0f);
26087 spriteBatch.Draw(val.Value, vector, val.Frame(1, 4, 0, 3), Microsoft.Xna.Framework.Color.White * 0.4f * opacity, proj.rotation + proj.ai[0] * -0.1f, origin, scale * 0.6f, spriteEffects, 0f);
26088 for (float num8 = -9f; num8 < 9f; num8 += 1f)
26089 {
26090 float num9 = proj.rotation + proj.ai[0] * num8 * ((float)Math.PI * -2f) * 0.025f;
26091 Vector2 drawpos = vector + num9.ToRotationVector2() * ((float)val.Width() * 0.5f - 6f) * scale;
26092 float num10 = Math.Abs(num8) / 9f;
26093 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * opacity * num10, color3, num, 0f, 0.5f, 0.5f, 1f, num9, new Vector2(0f, Utils.Remap(num, 0f, 1f, 3f, 0f)) * scale, Vector2.One * scale);
26094 }
26095 for (float num11 = -1f; num11 <= 1f; num11 += 0.5f)
26096 {
26097 if (num11 != 0f)
26098 {
26099 Vector2 drawpos2 = vector + (proj.rotation + num11 * (float)Math.PI * 0.75f * num).ToRotationVector2() * ((float)val.Width() * 0.5f - 4f) * scale;
26100 float num12 = Utils.Remap(Math.Abs(num11), 0f, 1f, 1f, 0.5f);
26101 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos2, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * opacity * 0.5f, color3, num, 0f, 0.5f, 0.5f, 0.75f, (float)Math.PI / 4f, new Vector2(Utils.Remap(num, 0f, 1f, 4f, 1f)) * scale * num12, Vector2.One * scale * num12);
26102 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos2, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * opacity * 0.5f, color3, num, 0f, 0.5f, 0.5f, 0.75f, 0f, new Vector2(2f, Utils.Remap(num, 0f, 1f, 4f, 1f)) * scale * num12, Vector2.One * scale * num12);
26103 }
26104 }
26105 Vector2 drawpos3 = vector + proj.rotation.ToRotationVector2() * ((float)val.Width() * 0.5f - 4f) * scale;
26106 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos3, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * opacity * 0.5f, color3, num, 0f, 0.5f, 0.5f, 1f, (float)Math.PI / 4f, new Vector2(Utils.Remap(num, 0f, 1f, 4f, 1f)) * scale, Vector2.One * scale * 1.5f);
26107 DrawPrettyStarSparkle(proj.Opacity, SpriteEffects.None, drawpos3, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * opacity * 0.5f, color3, num, 0f, 0.5f, 0.5f, 1f, 0f, new Vector2(2f, Utils.Remap(num, 0f, 1f, 4f, 1f)) * scale, Vector2.One * scale * 1.5f);
26108 }
26109
26110 public void DrawProj(int i)
26111 {
26113 if (new Microsoft.Xna.Framework.Rectangle((int)Camera.ScaledPosition.X - num, (int)Camera.ScaledPosition.Y - num, (int)Camera.ScaledSize.X + num * 2, (int)Camera.ScaledSize.Y + num * 2).Intersects(projectile[i].Hitbox))
26114 {
26117 }
26118 }
26119
26121 {
26122 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(255, 255, 255, 255);
26123 bool flag = player[proj.owner].cPet == 0;
26124 DrawTrail(proj, new Vector2(10f, 2f), flag ? new Microsoft.Xna.Framework.Color(177, 255, 32, 127) : color);
26125 DrawTrail(proj, new Vector2(-10f, 2f), flag ? new Microsoft.Xna.Framework.Color(177, 255, 32, 127) : color);
26126 }
26127
26129 {
26130 Vector2 vector = proj.Size / 2f;
26133 Vector2[] oldPos = proj.oldPos;
26134 float[] oldRot = proj.oldRot;
26135 int num = oldPos.Length;
26136 for (int num2 = num - 1; num2 > 0; num2--)
26137 {
26138 if (!(oldPos[num2] == Vector2.Zero))
26139 {
26140 Vector2 vector2 = oldPos[num2] + vector + rotatableOffsetFromCenter.RotatedBy(oldRot[num2]);
26141 Vector2 v = oldPos[num2 - 1] + vector + rotatableOffsetFromCenter.RotatedBy(oldRot[num2 - 1]) - vector2;
26142 float y = v.Length();
26143 float num3 = v.ToRotation();
26144 float num4 = Utils.Remap(num2, 0f, num, 1f, 0f);
26145 EntitySpriteDraw(value, vector2 - screenPosition, value2, baseColor * num4, num3 + (float)Math.PI / 2f, new Vector2((float)value2.Width / 2f, value2.Height), new Vector2(4f, y), SpriteEffects.None);
26146 }
26147 }
26148 }
26149
26151 {
26153 if (proj.type == 734)
26154 {
26159 {
26161 {
26163 }
26164 return;
26165 }
26166 }
26167 float polePosX = 0f;
26168 float polePosY = 0f;
26169 LoadProjectile(proj.type);
26170 Vector2 mountedCenter = Main.player[proj.owner].MountedCenter;
26171 if (Main.player[proj.owner].mount.Active && Main.player[proj.owner].mount.Type == 52)
26172 {
26173 mountedCenter += new Vector2(Main.player[proj.owner].direction * 14, -10f);
26174 }
26175 if (proj.aiStyle == 99)
26176 {
26178 vector.Y += Main.player[proj.owner].gfxOffY;
26179 float num = proj.Center.X - vector.X;
26180 float num2 = proj.Center.Y - vector.Y;
26181 Math.Sqrt(num * num + num2 * num2);
26182 float num3 = (float)Math.Atan2(num2, num) - 1.57f;
26183 if (!proj.counterweight)
26184 {
26185 int num4 = -1;
26186 if (proj.position.X + (float)(proj.width / 2) < Main.player[proj.owner].position.X + (float)(Main.player[proj.owner].width / 2))
26187 {
26188 num4 = 1;
26189 }
26190 num4 *= -1;
26191 Main.player[proj.owner].itemRotation = (float)Math.Atan2(num2 * (float)num4, num * (float)num4);
26192 }
26193 bool flag = true;
26194 bool flag2 = true;
26195 if (num == 0f && num2 == 0f)
26196 {
26197 flag = false;
26198 }
26199 else
26200 {
26201 float num5 = (float)Math.Sqrt(num * num + num2 * num2);
26202 num5 = 12f / num5;
26203 num *= num5;
26204 num2 *= num5;
26205 vector.X -= num * 0.1f;
26206 vector.Y -= num2 * 0.1f;
26207 num = proj.position.X + (float)proj.width * 0.5f - vector.X;
26208 num2 = proj.position.Y + (float)proj.height * 0.5f - vector.Y;
26209 }
26210 while (flag)
26211 {
26212 float num6 = 12f;
26213 float num7 = (float)Math.Sqrt(num * num + num2 * num2);
26214 float num8 = num7;
26215 if (float.IsNaN(num7) || float.IsNaN(num8))
26216 {
26217 flag = false;
26218 continue;
26219 }
26220 if (num7 < 20f)
26221 {
26222 num6 = num7 - 8f;
26223 flag = false;
26224 }
26225 num7 = 12f / num7;
26226 num *= num7;
26227 num2 *= num7;
26228 if (flag2)
26229 {
26230 flag2 = false;
26231 }
26232 else
26233 {
26234 vector.X += num;
26235 vector.Y += num2;
26236 }
26237 num = proj.position.X + (float)proj.width * 0.5f - vector.X;
26238 num2 = proj.position.Y + (float)proj.height * 0.1f - vector.Y;
26239 if (num8 > 12f)
26240 {
26241 float num9 = 0.3f;
26242 float num10 = Math.Abs(proj.velocity.X) + Math.Abs(proj.velocity.Y);
26243 if (num10 > 16f)
26244 {
26245 num10 = 16f;
26246 }
26247 num10 = 1f - num10 / 16f;
26248 num9 *= num10;
26249 num10 = num8 / 80f;
26250 if (num10 > 1f)
26251 {
26252 num10 = 1f;
26253 }
26254 num9 *= num10;
26255 if (num9 < 0f)
26256 {
26257 num9 = 0f;
26258 }
26259 num9 *= num10;
26260 num9 *= 0.5f;
26261 if (num2 > 0f)
26262 {
26263 num2 *= 1f + num9;
26264 num *= 1f - num9;
26265 }
26266 else
26267 {
26268 num10 = Math.Abs(proj.velocity.X) / 3f;
26269 if (num10 > 1f)
26270 {
26271 num10 = 1f;
26272 }
26273 num10 -= 0.5f;
26274 num9 *= num10;
26275 if (num9 > 0f)
26276 {
26277 num9 *= 2f;
26278 }
26279 num2 *= 1f + num9;
26280 num *= 1f - num9;
26281 }
26282 }
26283 num3 = (float)Math.Atan2(num2, num) - 1.57f;
26285 white.A = (byte)((float)(int)white.A * 0.4f);
26286 white = TryApplyingPlayerStringColor(Main.player[proj.owner].stringColor, white);
26287 float num11 = 0.5f;
26288 white = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f), white);
26289 EntitySpriteDraw(color: new Microsoft.Xna.Framework.Color((byte)((float)(int)white.R * num11), (byte)((float)(int)white.G * num11), (byte)((float)(int)white.B * num11), (byte)((float)(int)white.A * num11)), texture: TextureAssets.FishingLine.Value, position: new Vector2(vector.X - screenPosition.X + (float)TextureAssets.FishingLine.Width() * 0.5f, vector.Y - screenPosition.Y + (float)TextureAssets.FishingLine.Height() * 0.5f) - new Vector2(6f, 0f), sourceRectangle: new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.FishingLine.Width(), (int)num6), rotation: num3, origin: new Vector2((float)TextureAssets.FishingLine.Width() * 0.5f, 0f), scale: 1f, effects: SpriteEffects.None);
26290 }
26291 }
26292 else
26293 {
26294 if (proj.aiStyle == 160)
26295 {
26296 DrawKite(proj);
26297 return;
26298 }
26299 if (proj.aiStyle == 165)
26300 {
26301 DrawWhip(proj);
26302 return;
26303 }
26304 }
26305 if (proj.type == 879 || proj.type == 877 || proj.type == 878)
26306 {
26307 proj.position.Y -= Main.player[proj.owner].gfxOffY;
26308 }
26309 if (proj.aiStyle == 174)
26310 {
26312 return;
26313 }
26314 if (proj.type == 1020)
26315 {
26317 }
26318 bool flag3 = true;
26319 switch (proj.type)
26320 {
26321 default:
26322 flag3 = false;
26323 break;
26324 case 932:
26326 break;
26327 case 919:
26329 break;
26330 case 974:
26332 break;
26333 case 972:
26335 break;
26336 case 973:
26338 break;
26339 case 982:
26341 break;
26342 case 997:
26344 break;
26345 case 984:
26347 break;
26348 case 985:
26350 break;
26351 case 983:
26353 break;
26354 case 995:
26355 _stardewAnimation.Draw(spriteBatch, (int)proj.ai[0], proj.Center - screenPosition);
26356 flag3 = false;
26357 break;
26358 }
26359 if (flag3)
26360 {
26361 return;
26362 }
26363 if (proj.type == 34)
26364 {
26365 default(FlameLashDrawer).Draw(proj);
26366 }
26367 if (proj.type == 16)
26368 {
26369 default(MagicMissileDrawer).Draw(proj);
26370 }
26371 if (proj.type == 106)
26372 {
26373 default(LightDiscDrawer).Draw(proj);
26374 }
26375 if (proj.type == 933)
26376 {
26377 default(FinalFractalHelper).Draw(proj);
26378 }
26379 if (proj.type == 79)
26380 {
26381 default(RainbowRodDrawer).Draw(proj);
26382 }
26383 if (proj.type == 946)
26384 {
26386 float num12 = GlobalTimeWrappedHourly % 3f / 3f;
26387 Player player = Main.player[proj.owner];
26388 float num13 = MathHelper.Max(1f, player.maxMinions);
26389 float num14 = (float)proj.identity % num13 / num13 + num12;
26390 Microsoft.Xna.Framework.Color fairyQueenWeaponsColor = proj.GetFairyQueenWeaponsColor(0f, 0f, num14 % 1f);
26391 Microsoft.Xna.Framework.Color fairyQueenWeaponsColor2 = proj.GetFairyQueenWeaponsColor(0f, 0f, (num14 + 0.5f) % 1f);
26392 empressBladeDrawer.ColorStart = fairyQueenWeaponsColor;
26393 empressBladeDrawer.ColorEnd = fairyQueenWeaponsColor2;
26396 return;
26397 }
26398 if (proj.type == 927)
26399 {
26401 return;
26402 }
26403 if (proj.type == 917)
26404 {
26406 return;
26407 }
26408 if (proj.type == 923)
26409 {
26410 Vector2 position = proj.Center - screenPosition;
26414 Vector2 origin = rectangle.Size() * new Vector2(0.03f, 0.5f);
26415 float num15 = 180f;
26416 float num16 = proj.ai[0] / ((float)Math.PI * 2f) + proj.localAI[0] / num15;
26417 float num17 = Utils.GetLerpValue(0f, 30f, proj.localAI[0], clamped: true) * Utils.GetLerpValue(num15, num15 - 30f, proj.localAI[0], clamped: true);
26419 float lerpValue = Utils.GetLerpValue(40f, 60f, proj.localAI[0], clamped: true);
26420 Vector2 vector2 = new Vector2(1f, MathHelper.Lerp(0.25f, 0.7f, lerpValue)) * proj.scale;
26421 Microsoft.Xna.Framework.Color value3 = hslToRgb((num16 + 0.3f) % 1f, 1f, MathHelper.Lerp(0.3f, 0.66f, lerpValue)) * num17;
26423 {
26425 }
26427 value3.A /= 2;
26428 spriteBatch.Draw(value, position, value2, value3, proj.rotation, origin, vector2 * 1.2f, SpriteEffects.None, 0f);
26429 Microsoft.Xna.Framework.Color value4 = hslToRgb((num16 + 0.15f) % 1f, 1f, MathHelper.Lerp(0.3f, 0.5f, lerpValue)) * num17;
26431 {
26433 }
26435 value4.A /= 2;
26436 spriteBatch.Draw(value, position, value2, value4, proj.rotation, origin, vector2 * 1.1f, SpriteEffects.None, 0f);
26437 spriteBatch.Draw(value, position, rectangle, color2 * 0.5f, proj.rotation, origin, vector2, SpriteEffects.None, 0f);
26438 spriteBatch.Draw(value, position, value2, color2 * lerpValue, proj.rotation, origin, vector2, SpriteEffects.None, 0f);
26439 return;
26440 }
26441 if (proj.type == 950)
26442 {
26443 Vector2 position2 = proj.Center - screenPosition;
26446 Vector2 origin2 = rectangle2.Size() * new Vector2(0.5f, 0.5f);
26447 Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * proj.Opacity;
26448 float hue = ((proj.ai[2] == 1f) ? 0.96f : 0.92f);
26449 if (proj.ai[2] == 1f)
26450 {
26451 color3 = new Microsoft.Xna.Framework.Color(255, 0, 30, 180) * proj.Opacity;
26452 }
26453 Microsoft.Xna.Framework.Color color4 = hslToRgb(hue, 1f, 0.5f) * proj.Opacity;
26454 color4.A = 0;
26455 color3 *= 0.6f;
26456 color4 *= 0.6f;
26457 float scale = proj.scale;
26458 float num18 = proj.localAI[0];
26460 spriteBatch.Draw(value5, position2, rectangle2, color4, proj.rotation, origin2, num18 * 0.95f, SpriteEffects.None, 0f);
26461 spriteBatch.Draw(value5, position2, rectangle2, color3, proj.rotation, origin2, scale, SpriteEffects.None, 0f);
26462 spriteBatch.Draw(value5, position2, rectangle2, color4, proj.rotation, origin2, scale * 0.95f, SpriteEffects.None, 0f);
26463 return;
26464 }
26465 if (proj.type == 888)
26466 {
26468 return;
26469 }
26470 if (proj.type == 874)
26471 {
26473 return;
26474 }
26475 if (proj.type == 871)
26476 {
26479 Vector2 origin3 = rectangle3.Size() / 2f;
26480 Microsoft.Xna.Framework.Color color5 = Microsoft.Xna.Framework.Color.White * proj.Opacity;
26481 SpriteEffects effects = SpriteEffects.None;
26482 color5.A /= 2;
26483 Microsoft.Xna.Framework.Color color6 = proj.AI_171_GetColor();
26484 color6.A /= 2;
26485 float num19 = proj.scale * 1.3f;
26486 float num20 = 1f;
26487 int num21 = proj.AI_172_GetPelletStormsCount();
26488 bool flag4 = false;
26489 float num22 = float.PositiveInfinity;
26490 for (int i = 0; i < num21; i++)
26491 {
26493 for (int j = 0; j < hallowBossPelletStormInfo.BulletsInStorm; j++)
26494 {
26495 float bulletProgress = hallowBossPelletStormInfo.GetBulletProgress(j);
26496 if (bulletProgress < num22)
26497 {
26499 }
26500 if (hallowBossPelletStormInfo.IsValid(j))
26501 {
26502 if (i == num21 - 1 && bulletProgress > 0f)
26503 {
26504 flag4 = true;
26505 }
26506 rectangle3 = value6.Frame(1, 4, 0, (int)((double)(j + i * 6) + timeForVisualEffects / 4.0) % 4);
26507 float num23 = Utils.GetLerpValue(0f, 0.1f, bulletProgress, clamped: true) * Utils.GetLerpValue(1f, 0.8f, bulletProgress, clamped: true);
26508 Vector2 bulletPosition = hallowBossPelletStormInfo.GetBulletPosition(j, proj.Center);
26509 EntitySpriteDraw(value6, bulletPosition - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle3, color6 * num23, proj.rotation, origin3, num19 * num20, effects);
26510 EntitySpriteDraw(value6, bulletPosition - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle3, color5 * num23, proj.rotation, origin3, proj.scale * num20, effects);
26511 }
26512 }
26513 }
26514 if (!flag4 && num22 <= 1f)
26515 {
26516 EntitySpriteDraw(value6, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle3, color6, proj.rotation, origin3, num19, effects);
26517 EntitySpriteDraw(value6, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle3, color5, proj.rotation, origin3, proj.scale, effects);
26518 }
26519 return;
26520 }
26521 if (proj.bobber && Main.player[proj.owner].inventory[Main.player[proj.owner].selectedItem].holdStyle != 0)
26522 {
26524 }
26525 else if (proj.type == 32)
26526 {
26527 Vector2 vector3 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26528 float num24 = mountedCenter.X - vector3.X;
26529 float num25 = mountedCenter.Y - vector3.Y;
26530 float rotation = (float)Math.Atan2(num25, num24) - 1.57f;
26531 bool flag5 = true;
26532 if (num24 == 0f && num25 == 0f)
26533 {
26534 flag5 = false;
26535 }
26536 else
26537 {
26538 float num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25);
26539 num26 = 8f / num26;
26540 num24 *= num26;
26541 num25 *= num26;
26542 vector3.X -= num24;
26543 vector3.Y -= num25;
26544 num24 = mountedCenter.X - vector3.X;
26545 num25 = mountedCenter.Y - vector3.Y;
26546 }
26547 while (flag5)
26548 {
26549 float num27 = (float)Math.Sqrt(num24 * num24 + num25 * num25);
26550 if (num27 < 28f)
26551 {
26552 flag5 = false;
26553 continue;
26554 }
26555 if (float.IsNaN(num27))
26556 {
26557 flag5 = false;
26558 continue;
26559 }
26560 num27 = 28f / num27;
26561 num24 *= num27;
26562 num25 *= num27;
26563 vector3.X += num24;
26564 vector3.Y += num25;
26565 num24 = mountedCenter.X - vector3.X;
26566 num25 = mountedCenter.Y - vector3.Y;
26567 Microsoft.Xna.Framework.Color color7 = Lighting.GetColor((int)vector3.X / 16, (int)(vector3.Y / 16f));
26568 EntitySpriteDraw(TextureAssets.Chain5.Value, new Vector2(vector3.X - screenPosition.X, vector3.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain5.Width(), TextureAssets.Chain5.Height()), color7, rotation, new Vector2((float)TextureAssets.Chain5.Width() * 0.5f, (float)TextureAssets.Chain5.Height() * 0.5f), 1f, SpriteEffects.None);
26569 }
26570 }
26571 else if (proj.type == 73)
26572 {
26573 Vector2 vector4 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26574 float num28 = mountedCenter.X - vector4.X;
26575 float num29 = mountedCenter.Y - vector4.Y;
26576 float rotation2 = (float)Math.Atan2(num29, num28) - 1.57f;
26577 bool flag6 = true;
26578 while (flag6)
26579 {
26580 float num30 = (float)Math.Sqrt(num28 * num28 + num29 * num29);
26581 if (num30 < 25f)
26582 {
26583 flag6 = false;
26584 continue;
26585 }
26586 if (float.IsNaN(num30))
26587 {
26588 flag6 = false;
26589 continue;
26590 }
26591 num30 = 12f / num30;
26592 num28 *= num30;
26593 num29 *= num30;
26594 vector4.X += num28;
26595 vector4.Y += num29;
26596 num28 = mountedCenter.X - vector4.X;
26597 num29 = mountedCenter.Y - vector4.Y;
26598 Microsoft.Xna.Framework.Color color8 = Lighting.GetColor((int)vector4.X / 16, (int)(vector4.Y / 16f));
26599 EntitySpriteDraw(TextureAssets.Chain8.Value, new Vector2(vector4.X - screenPosition.X, vector4.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain8.Width(), TextureAssets.Chain8.Height()), color8, rotation2, new Vector2((float)TextureAssets.Chain8.Width() * 0.5f, (float)TextureAssets.Chain8.Height() * 0.5f), 1f, SpriteEffects.None);
26600 }
26601 }
26602 else if (proj.type == 186)
26603 {
26604 Vector2 vector5 = new Vector2(proj.localAI[0], proj.localAI[1]);
26605 float num31 = Vector2.Distance(proj.Center, vector5) - proj.velocity.Length();
26606 float num32 = (float)TextureAssets.Chain17.Height() - num31;
26607 if (num31 > 0f && proj.ai[1] > 0f)
26608 {
26609 Microsoft.Xna.Framework.Color color9 = Lighting.GetColor((int)proj.position.X / 16, (int)proj.position.Y / 16);
26611 }
26612 }
26613 else if (proj.type == 74)
26614 {
26615 Vector2 vector6 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26616 float num33 = mountedCenter.X - vector6.X;
26617 float num34 = mountedCenter.Y - vector6.Y;
26618 float rotation3 = (float)Math.Atan2(num34, num33) - 1.57f;
26619 bool flag7 = true;
26620 while (flag7)
26621 {
26622 float num35 = (float)Math.Sqrt(num33 * num33 + num34 * num34);
26623 if (num35 < 25f)
26624 {
26625 flag7 = false;
26626 continue;
26627 }
26628 if (float.IsNaN(num35))
26629 {
26630 flag7 = false;
26631 continue;
26632 }
26633 num35 = 12f / num35;
26634 num33 *= num35;
26635 num34 *= num35;
26636 vector6.X += num33;
26637 vector6.Y += num34;
26638 num33 = mountedCenter.X - vector6.X;
26639 num34 = mountedCenter.Y - vector6.Y;
26640 Microsoft.Xna.Framework.Color color10 = Lighting.GetColor((int)vector6.X / 16, (int)(vector6.Y / 16f));
26642 }
26643 }
26644 else if (proj.type == 171)
26645 {
26646 Vector2 vector7 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26647 float num36 = 0f - proj.velocity.X;
26648 float num37 = 0f - proj.velocity.Y;
26649 float num38 = 1f;
26650 if (proj.ai[0] <= 17f)
26651 {
26652 num38 = proj.ai[0] / 17f;
26653 }
26654 int num39 = (int)(30f * num38);
26655 float num40 = 1f;
26656 if (proj.ai[0] <= 30f)
26657 {
26658 num40 = proj.ai[0] / 30f;
26659 }
26660 float num41 = 0.4f * num40;
26661 float num42 = num41;
26662 num37 += num42;
26663 Vector2[] array = new Vector2[num39];
26664 float[] array2 = new float[num39];
26665 for (int k = 0; k < num39; k++)
26666 {
26667 float num43 = (float)Math.Sqrt(num36 * num36 + num37 * num37);
26668 float num44 = 5.6f;
26669 if (Math.Abs(num36) + Math.Abs(num37) < 1f)
26670 {
26671 num44 *= Math.Abs(num36) + Math.Abs(num37) / 1f;
26672 }
26673 num43 = num44 / num43;
26674 num36 *= num43;
26675 num37 *= num43;
26676 float num45 = (float)Math.Atan2(num37, num36) - 1.57f;
26677 array[k].X = vector7.X;
26678 array[k].Y = vector7.Y;
26679 array2[k] = num45;
26680 vector7.X += num36;
26681 vector7.Y += num37;
26682 num36 = 0f - proj.velocity.X;
26683 num37 = 0f - proj.velocity.Y;
26684 num42 += num41;
26685 num37 += num42;
26686 }
26687 for (int num46 = --num39; num46 >= 0; num46--)
26688 {
26689 vector7.X = array[num46].X;
26690 vector7.Y = array[num46].Y;
26691 float rotation4 = array2[num46];
26692 Microsoft.Xna.Framework.Color color11 = Lighting.GetColor((int)vector7.X / 16, (int)(vector7.Y / 16f));
26694 }
26695 }
26696 else if (proj.type == 475)
26697 {
26698 Vector2 vector8 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26699 float num47 = 0f - proj.velocity.X;
26700 float num48 = 0f - proj.velocity.Y;
26701 float num49 = 1f;
26702 if (proj.ai[0] <= 17f)
26703 {
26704 num49 = proj.ai[0] / 17f;
26705 }
26706 int num50 = (int)(30f * num49);
26707 float num51 = 1f;
26708 if (proj.ai[0] <= 30f)
26709 {
26710 num51 = proj.ai[0] / 30f;
26711 }
26712 float num52 = 0.4f * num51;
26713 float num53 = num52;
26714 num48 += num53;
26715 Vector2[] array3 = new Vector2[num50];
26716 float[] array4 = new float[num50];
26717 for (int l = 0; l < num50; l++)
26718 {
26719 float num54 = (float)Math.Sqrt(num47 * num47 + num48 * num48);
26720 float num55 = 5.6f;
26721 if (Math.Abs(num47) + Math.Abs(num48) < 1f)
26722 {
26723 num55 *= Math.Abs(num47) + Math.Abs(num48) / 1f;
26724 }
26725 num54 = num55 / num54;
26726 num47 *= num54;
26727 num48 *= num54;
26728 float num56 = (float)Math.Atan2(num48, num47) - 1.57f;
26729 array3[l].X = vector8.X;
26730 array3[l].Y = vector8.Y;
26731 array4[l] = num56;
26732 vector8.X += num47;
26733 vector8.Y += num48;
26734 num47 = 0f - proj.velocity.X;
26735 num48 = 0f - proj.velocity.Y;
26736 num53 += num52;
26737 num48 += num53;
26738 }
26739 int num57 = 0;
26740 for (int num58 = --num50; num58 >= 0; num58--)
26741 {
26742 vector8.X = array3[num58].X;
26743 vector8.Y = array3[num58].Y;
26744 float rotation5 = array4[num58];
26745 Microsoft.Xna.Framework.Color color12 = Lighting.GetColor((int)vector8.X / 16, (int)(vector8.Y / 16f));
26746 if (num57 % 2 == 0)
26747 {
26749 }
26750 else
26751 {
26753 }
26754 num57++;
26755 }
26756 }
26757 else if (proj.type == 505 || proj.type == 506)
26758 {
26759 Vector2 vector9 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26760 float num59 = 0f - proj.velocity.X;
26761 float num60 = 0f - proj.velocity.Y;
26762 float num61 = 1f;
26763 if (proj.ai[0] <= 17f)
26764 {
26765 num61 = proj.ai[0] / 17f;
26766 }
26767 int num62 = (int)(30f * num61);
26768 float num63 = 1f;
26769 if (proj.ai[0] <= 30f)
26770 {
26771 num63 = proj.ai[0] / 30f;
26772 }
26773 float num64 = 0.4f * num63;
26774 float num65 = num64;
26775 num60 += num65;
26776 Vector2[] array5 = new Vector2[num62];
26777 float[] array6 = new float[num62];
26778 for (int m = 0; m < num62; m++)
26779 {
26780 float num66 = (float)Math.Sqrt(num59 * num59 + num60 * num60);
26781 float num67 = 5.6f;
26782 if (Math.Abs(num59) + Math.Abs(num60) < 1f)
26783 {
26784 num67 *= Math.Abs(num59) + Math.Abs(num60) / 1f;
26785 }
26786 num66 = num67 / num66;
26787 num59 *= num66;
26788 num60 *= num66;
26789 float num68 = (float)Math.Atan2(num60, num59) - 1.57f;
26790 array5[m].X = vector9.X;
26791 array5[m].Y = vector9.Y;
26792 array6[m] = num68;
26793 vector9.X += num59;
26794 vector9.Y += num60;
26795 num59 = 0f - proj.velocity.X;
26796 num60 = 0f - proj.velocity.Y;
26797 num65 += num64;
26798 num60 += num65;
26799 }
26800 int num69 = 0;
26801 for (int num70 = --num62; num70 >= 0; num70--)
26802 {
26803 vector9.X = array5[num70].X;
26804 vector9.Y = array5[num70].Y;
26805 float rotation6 = array6[num70];
26806 Microsoft.Xna.Framework.Color color13 = Lighting.GetColor((int)vector9.X / 16, (int)(vector9.Y / 16f));
26807 int num71 = 4;
26808 if (proj.type == 506)
26809 {
26810 num71 = 6;
26811 }
26812 num71 += num69 % 2;
26814 num69++;
26815 }
26816 }
26817 else if (proj.type == 165)
26818 {
26819 Vector2 vector10 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26820 float num72 = mountedCenter.X - vector10.X;
26821 float num73 = mountedCenter.Y - vector10.Y;
26822 float rotation7 = (float)Math.Atan2(num73, num72) - 1.57f;
26823 bool flag8 = true;
26824 while (flag8)
26825 {
26826 float num74 = (float)Math.Sqrt(num72 * num72 + num73 * num73);
26827 if (num74 < 25f)
26828 {
26829 flag8 = false;
26830 continue;
26831 }
26832 if (float.IsNaN(num74))
26833 {
26834 flag8 = false;
26835 continue;
26836 }
26837 num74 = 24f / num74;
26838 num72 *= num74;
26839 num73 *= num74;
26840 vector10.X += num72;
26841 vector10.Y += num73;
26842 num72 = mountedCenter.X - vector10.X;
26843 num73 = mountedCenter.Y - vector10.Y;
26844 Microsoft.Xna.Framework.Color color14 = Lighting.GetColor((int)vector10.X / 16, (int)(vector10.Y / 16f));
26846 }
26847 }
26848 else if (proj.type >= 230 && proj.type <= 235)
26849 {
26850 int num75 = proj.type - 229;
26851 Vector2 vector11 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26852 float num76 = mountedCenter.X - vector11.X;
26853 float num77 = mountedCenter.Y - vector11.Y;
26854 float rotation8 = (float)Math.Atan2(num77, num76) - 1.57f;
26855 bool flag9 = true;
26856 while (flag9)
26857 {
26858 float num78 = (float)Math.Sqrt(num76 * num76 + num77 * num77);
26859 if (num78 < 25f)
26860 {
26861 flag9 = false;
26862 continue;
26863 }
26864 if (float.IsNaN(num78))
26865 {
26866 flag9 = false;
26867 continue;
26868 }
26869 num78 = (float)TextureAssets.GemChain[num75].Height() / num78;
26870 num76 *= num78;
26871 num77 *= num78;
26872 vector11.X += num76;
26873 vector11.Y += num77;
26874 num76 = mountedCenter.X - vector11.X;
26875 num77 = mountedCenter.Y - vector11.Y;
26876 Microsoft.Xna.Framework.Color color15 = Lighting.GetColor((int)vector11.X / 16, (int)(vector11.Y / 16f));
26878 }
26879 }
26880 else if (proj.type == 753)
26881 {
26882 Vector2 vector12 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26883 float num79 = mountedCenter.X - vector12.X;
26884 float num80 = mountedCenter.Y - vector12.Y;
26885 float rotation9 = (float)Math.Atan2(num80, num79) - 1.57f;
26886 bool flag10 = true;
26887 Texture2D value7 = TextureAssets.Extra[95].Value;
26888 while (flag10)
26889 {
26890 float num81 = (float)Math.Sqrt(num79 * num79 + num80 * num80);
26891 if (num81 < 25f)
26892 {
26893 flag10 = false;
26894 continue;
26895 }
26896 if (float.IsNaN(num81))
26897 {
26898 flag10 = false;
26899 continue;
26900 }
26901 num81 = (float)value7.Height / num81;
26902 num79 *= num81;
26903 num80 *= num81;
26904 vector12.X += num79;
26905 vector12.Y += num80;
26906 num79 = mountedCenter.X - vector12.X;
26907 num80 = mountedCenter.Y - vector12.Y;
26910 }
26911 }
26912 else if (proj.type == 865)
26913 {
26914 Vector2 vector13 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26915 float num82 = mountedCenter.X - vector13.X;
26916 float num83 = mountedCenter.Y - vector13.Y;
26917 float rotation10 = (float)Math.Atan2(num83, num82) - 1.57f;
26918 bool flag11 = true;
26919 bool flag12 = true;
26920 Texture2D value8 = TextureAssets.Extra[154].Value;
26921 while (flag11)
26922 {
26923 float num84 = (float)Math.Sqrt(num82 * num82 + num83 * num83);
26924 if (num84 < 25f)
26925 {
26926 flag11 = false;
26927 continue;
26928 }
26929 if (float.IsNaN(num84))
26930 {
26931 flag11 = false;
26932 continue;
26933 }
26934 num84 = (float)value8.Height / num84;
26935 num82 *= num84;
26936 num83 *= num84;
26937 vector13.X += num82;
26938 vector13.Y += num83;
26939 num82 = mountedCenter.X - vector13.X;
26940 num83 = mountedCenter.Y - vector13.Y;
26941 if (!flag12)
26942 {
26945 }
26946 flag12 = false;
26947 }
26948 }
26949 else if (proj.type == 935)
26950 {
26951 Vector2 vector14 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26952 float num85 = mountedCenter.X - vector14.X;
26953 float num86 = mountedCenter.Y - vector14.Y;
26954 float rotation11 = (float)Math.Atan2(num86, num85) - 1.57f;
26955 bool flag13 = true;
26956 bool flag14 = true;
26957 Texture2D value9 = TextureAssets.Extra[208].Value;
26958 while (flag13)
26959 {
26960 float num87 = (float)Math.Sqrt(num85 * num85 + num86 * num86);
26961 if (num87 < 8f)
26962 {
26963 flag13 = false;
26964 continue;
26965 }
26966 if (float.IsNaN(num87))
26967 {
26968 flag13 = false;
26969 continue;
26970 }
26971 num87 = (float)value9.Height / num87;
26972 num85 *= num87;
26973 num86 *= num87;
26974 vector14.X += num85;
26975 vector14.Y += num86;
26976 num85 = mountedCenter.X - vector14.X;
26977 num86 = mountedCenter.Y - vector14.Y;
26978 if (!flag14)
26979 {
26982 }
26983 flag14 = false;
26984 }
26985 }
26986 else if (proj.type == 256)
26987 {
26988 Vector2 vector15 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
26989 float num88 = mountedCenter.X - vector15.X;
26990 float num89 = mountedCenter.Y - vector15.Y;
26991 float num90 = (float)Math.Atan2(num89, num88) - 1.57f;
26992 bool flag15 = true;
26993 while (flag15)
26994 {
26995 float num91 = (float)Math.Sqrt(num88 * num88 + num89 * num89);
26996 if (num91 < 26f)
26997 {
26998 flag15 = false;
26999 continue;
27000 }
27001 if (float.IsNaN(num91))
27002 {
27003 flag15 = false;
27004 continue;
27005 }
27006 num91 = 26f / num91;
27007 num88 *= num91;
27008 num89 *= num91;
27009 vector15.X += num88;
27010 vector15.Y += num89;
27011 num88 = Main.player[proj.owner].position.X + (float)(Main.player[proj.owner].width / 2) - vector15.X;
27012 num89 = Main.player[proj.owner].position.Y + (float)(Main.player[proj.owner].height / 2) - vector15.Y;
27013 Microsoft.Xna.Framework.Color color19 = Lighting.GetColor((int)vector15.X / 16, (int)(vector15.Y / 16f));
27014 EntitySpriteDraw(TextureAssets.Chain20.Value, new Vector2(vector15.X - screenPosition.X, vector15.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain20.Width(), TextureAssets.Chain20.Height()), color19, num90 - 0.785f, new Vector2((float)TextureAssets.Chain20.Width() * 0.5f, (float)TextureAssets.Chain20.Height() * 0.5f), 1f, SpriteEffects.None);
27015 }
27016 }
27017 else if (proj.type == 322)
27018 {
27019 Vector2 vector16 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
27020 float num92 = mountedCenter.X - vector16.X;
27021 float num93 = mountedCenter.Y - vector16.Y;
27022 float rotation12 = (float)Math.Atan2(num93, num92) - 1.57f;
27023 bool flag16 = true;
27024 while (flag16)
27025 {
27026 float num94 = (float)Math.Sqrt(num92 * num92 + num93 * num93);
27027 if (num94 < 22f)
27028 {
27029 flag16 = false;
27030 continue;
27031 }
27032 if (float.IsNaN(num94))
27033 {
27034 flag16 = false;
27035 continue;
27036 }
27037 num94 = 22f / num94;
27038 num92 *= num94;
27039 num93 *= num94;
27040 vector16.X += num92;
27041 vector16.Y += num93;
27042 num92 = mountedCenter.X - vector16.X;
27043 num93 = mountedCenter.Y - vector16.Y;
27044 Microsoft.Xna.Framework.Color color20 = Lighting.GetColor((int)vector16.X / 16, (int)(vector16.Y / 16f));
27046 }
27047 }
27048 else if (proj.type == 315)
27049 {
27050 Vector2 vector17 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
27051 float num95 = mountedCenter.X - vector17.X;
27052 float num96 = mountedCenter.Y - vector17.Y;
27053 float rotation13 = (float)Math.Atan2(num96, num95) - 1.57f;
27054 bool flag17 = true;
27055 while (flag17)
27056 {
27057 float num97 = (float)Math.Sqrt(num95 * num95 + num96 * num96);
27058 if (num97 < 50f)
27059 {
27060 flag17 = false;
27061 continue;
27062 }
27063 if (float.IsNaN(num97))
27064 {
27065 flag17 = false;
27066 continue;
27067 }
27068 num97 = 40f / num97;
27069 num95 *= num97;
27070 num96 *= num97;
27071 vector17.X += num95;
27072 vector17.Y += num96;
27073 num95 = mountedCenter.X - vector17.X;
27074 num96 = mountedCenter.Y - vector17.Y;
27075 Microsoft.Xna.Framework.Color color21 = Lighting.GetColor((int)vector17.X / 16, (int)(vector17.Y / 16f));
27077 }
27078 }
27079 else if (proj.type == 331)
27080 {
27081 Vector2 vector18 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
27082 float num98 = mountedCenter.X - vector18.X;
27083 float num99 = mountedCenter.Y - vector18.Y;
27084 float rotation14 = (float)Math.Atan2(num99, num98) - 1.57f;
27085 bool flag18 = true;
27086 while (flag18)
27087 {
27088 float num100 = (float)Math.Sqrt(num98 * num98 + num99 * num99);
27089 if (num100 < 30f)
27090 {
27091 flag18 = false;
27092 continue;
27093 }
27094 if (float.IsNaN(num100))
27095 {
27096 flag18 = false;
27097 continue;
27098 }
27099 num100 = 24f / num100;
27100 num98 *= num100;
27101 num99 *= num100;
27102 vector18.X += num98;
27103 vector18.Y += num99;
27104 num98 = mountedCenter.X - vector18.X;
27105 num99 = mountedCenter.Y - vector18.Y;
27106 Microsoft.Xna.Framework.Color color22 = Lighting.GetColor((int)vector18.X / 16, (int)(vector18.Y / 16f));
27108 }
27109 }
27110 else if (proj.type == 332)
27111 {
27112 int num101 = 0;
27113 Vector2 vector19 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
27114 float num102 = mountedCenter.X - vector19.X;
27115 float num103 = mountedCenter.Y - vector19.Y;
27116 float rotation15 = (float)Math.Atan2(num103, num102) - 1.57f;
27117 bool flag19 = true;
27118 while (flag19)
27119 {
27120 float num104 = (float)Math.Sqrt(num102 * num102 + num103 * num103);
27121 if (num104 < 30f)
27122 {
27123 flag19 = false;
27124 continue;
27125 }
27126 if (float.IsNaN(num104))
27127 {
27128 flag19 = false;
27129 continue;
27130 }
27131 int i2 = (int)vector19.X / 16;
27132 int j2 = (int)vector19.Y / 16;
27133 if (num101 == 0)
27134 {
27135 Lighting.AddLight(i2, j2, 0f, 0.2f, 0.2f);
27136 }
27137 if (num101 == 1)
27138 {
27139 Lighting.AddLight(i2, j2, 0.1f, 0.2f, 0f);
27140 }
27141 if (num101 == 2)
27142 {
27143 Lighting.AddLight(i2, j2, 0.2f, 0.1f, 0f);
27144 }
27145 if (num101 == 3)
27146 {
27147 Lighting.AddLight(i2, j2, 0.2f, 0f, 0.2f);
27148 }
27149 num104 = 16f / num104;
27150 num102 *= num104;
27151 num103 *= num104;
27152 vector19.X += num102;
27153 vector19.Y += num103;
27154 num102 = mountedCenter.X - vector19.X;
27155 num103 = mountedCenter.Y - vector19.Y;
27159 num101++;
27160 if (num101 > 3)
27161 {
27162 num101 = 0;
27163 }
27164 }
27165 }
27166 else if (proj.type == 372 || proj.type == 383 || proj.type == 396 || proj.type == 403 || proj.type == 404 || proj.type == 446 || (proj.type >= 486 && proj.type <= 489) || (proj.type >= 646 && proj.type <= 649) || proj.type == 652)
27167 {
27168 Texture2D texture2D = null;
27171 if (proj.type == 383)
27172 {
27174 }
27175 if (proj.type == 396)
27176 {
27178 }
27179 if (proj.type == 403)
27180 {
27182 }
27183 if (proj.type == 404)
27184 {
27186 }
27187 if (proj.type == 446)
27188 {
27189 value10 = TextureAssets.Extra[3].Value;
27190 }
27191 if (proj.type >= 486 && proj.type <= 489)
27192 {
27193 value10 = TextureAssets.Chains[proj.type - 486].Value;
27194 }
27195 if (proj.type >= 646 && proj.type <= 649)
27196 {
27197 value10 = TextureAssets.Chains[proj.type - 646 + 8].Value;
27198 texture2D = TextureAssets.Chains[proj.type - 646 + 12].Value;
27199 color24 = new Microsoft.Xna.Framework.Color(255, 255, 255, 127);
27200 }
27201 if (proj.type == 652)
27202 {
27203 value10 = TextureAssets.Chains[16].Value;
27204 }
27205 Vector2 center = proj.Center;
27207 Vector2 origin4 = new Vector2((float)value10.Width * 0.5f, (float)value10.Height * 0.5f);
27208 float num105 = value10.Height;
27209 float num106 = 0f;
27210 if (proj.type == 446)
27211 {
27212 int num107 = 7;
27213 int num108 = (int)proj.localAI[0] / num107;
27214 sourceRectangle = new Microsoft.Xna.Framework.Rectangle(0, value10.Height / 4 * num108, value10.Width, value10.Height / 4);
27215 origin4.Y /= 4f;
27216 num105 /= 4f;
27217 }
27218 switch (proj.type)
27219 {
27220 case 383:
27221 num106 = 14f;
27222 break;
27223 case 446:
27224 num106 = 20f;
27225 break;
27226 case 489:
27227 num106 = 10f;
27228 break;
27229 case 487:
27230 num106 = 8f;
27231 break;
27232 }
27233 if (num106 != 0f)
27234 {
27235 float num109 = -1.57f;
27236 Vector2 vector20 = new Vector2((float)Math.Cos(proj.rotation + num109), (float)Math.Sin(proj.rotation + num109));
27237 center -= vector20 * num106;
27239 vector20.Normalize();
27240 center -= vector20 * num105 / 2f;
27241 }
27243 float rotation16 = (float)Math.Atan2(vector21.Y, vector21.X) - 1.57f;
27244 bool flag20 = true;
27245 if (float.IsNaN(center.X) && float.IsNaN(center.Y))
27246 {
27247 flag20 = false;
27248 }
27249 if (float.IsNaN(vector21.X) && float.IsNaN(vector21.Y))
27250 {
27251 flag20 = false;
27252 }
27253 while (flag20)
27254 {
27255 if (vector21.Length() < num105 + 1f)
27256 {
27257 flag20 = false;
27258 continue;
27259 }
27261 vector22.Normalize();
27262 center += vector22 * num105;
27264 Microsoft.Xna.Framework.Color color25 = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f));
27265 if (proj.type == 396)
27266 {
27267 color25 *= (float)(255 - proj.alpha) / 255f;
27268 }
27269 if (proj.type == 446)
27270 {
27271 color25 = proj.GetAlpha(color25);
27272 }
27273 if (proj.type == 488)
27274 {
27275 Lighting.AddLight(center, 0.2f, 0f, 0.175f);
27276 color25 = new Microsoft.Xna.Framework.Color(255, 255, 255, 255);
27277 }
27278 if (proj.type >= 646 && proj.type <= 649)
27279 {
27280 color25 = proj.GetAlpha(color25);
27281 }
27283 if (texture2D != null)
27284 {
27286 }
27287 }
27288 }
27289 else if (proj.aiStyle == 7)
27290 {
27291 Vector2 vector23 = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
27292 float num110 = mountedCenter.X - vector23.X;
27293 float num111 = mountedCenter.Y - vector23.Y;
27294 float rotation17 = (float)Math.Atan2(num111, num110) - 1.57f;
27295 bool flag21 = true;
27296 while (flag21)
27297 {
27298 float num112 = (float)Math.Sqrt(num110 * num110 + num111 * num111);
27299 if (num112 < 25f)
27300 {
27301 flag21 = false;
27302 continue;
27303 }
27304 if (float.IsNaN(num112))
27305 {
27306 flag21 = false;
27307 continue;
27308 }
27309 num112 = 12f / num112;
27310 num110 *= num112;
27311 num111 *= num112;
27312 vector23.X += num110;
27313 vector23.Y += num111;
27314 num110 = mountedCenter.X - vector23.X;
27315 num111 = mountedCenter.Y - vector23.Y;
27316 Microsoft.Xna.Framework.Color color26 = Lighting.GetColor((int)vector23.X / 16, (int)(vector23.Y / 16f));
27317 EntitySpriteDraw(TextureAssets.Chain.Value, new Vector2(vector23.X - screenPosition.X, vector23.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain.Width(), TextureAssets.Chain.Height()), color26, rotation17, new Vector2((float)TextureAssets.Chain.Width() * 0.5f, (float)TextureAssets.Chain.Height() * 0.5f), 1f, SpriteEffects.None);
27318 }
27319 }
27320 else if (proj.type == 262)
27321 {
27322 float x = proj.Center.X;
27323 float y = proj.Center.Y;
27324 float x2 = proj.velocity.X;
27325 float y2 = proj.velocity.Y;
27326 float num113 = (float)Math.Sqrt(x2 * x2 + y2 * y2);
27327 num113 = 4f / num113;
27328 if (proj.ai[0] == 0f)
27329 {
27330 x -= proj.velocity.X * num113;
27331 y -= proj.velocity.Y * num113;
27332 }
27333 else
27334 {
27335 x += proj.velocity.X * num113;
27336 y += proj.velocity.Y * num113;
27337 }
27338 Vector2 vector24 = new Vector2(x, y);
27339 x2 = mountedCenter.X - vector24.X;
27340 y2 = mountedCenter.Y - vector24.Y;
27341 float rotation18 = (float)Math.Atan2(y2, x2) - 1.57f;
27342 if (proj.alpha == 0)
27343 {
27344 int num114 = -1;
27345 if (proj.position.X + (float)(proj.width / 2) < mountedCenter.X)
27346 {
27347 num114 = 1;
27348 }
27349 if (Main.player[proj.owner].direction == 1)
27350 {
27351 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y2 * (float)num114, x2 * (float)num114);
27352 }
27353 else
27354 {
27355 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y2 * (float)num114, x2 * (float)num114);
27356 }
27357 }
27358 bool flag22 = true;
27359 while (flag22)
27360 {
27361 float num115 = (float)Math.Sqrt(x2 * x2 + y2 * y2);
27362 if (num115 < 25f)
27363 {
27364 flag22 = false;
27365 continue;
27366 }
27367 if (float.IsNaN(num115))
27368 {
27369 flag22 = false;
27370 continue;
27371 }
27372 num115 = 12f / num115;
27373 x2 *= num115;
27374 y2 *= num115;
27375 vector24.X += x2;
27376 vector24.Y += y2;
27377 x2 = mountedCenter.X - vector24.X;
27378 y2 = mountedCenter.Y - vector24.Y;
27379 Microsoft.Xna.Framework.Color color27 = Lighting.GetColor((int)vector24.X / 16, (int)(vector24.Y / 16f));
27381 }
27382 }
27383 else if (proj.type == 273)
27384 {
27385 float x3 = proj.Center.X;
27386 float y3 = proj.Center.Y;
27387 float x4 = proj.velocity.X;
27388 float y4 = proj.velocity.Y;
27389 float num116 = (float)Math.Sqrt(x4 * x4 + y4 * y4);
27390 num116 = 4f / num116;
27391 if (proj.ai[0] == 0f)
27392 {
27393 x3 -= proj.velocity.X * num116;
27394 y3 -= proj.velocity.Y * num116;
27395 }
27396 else
27397 {
27398 x3 += proj.velocity.X * num116;
27399 y3 += proj.velocity.Y * num116;
27400 }
27401 Vector2 vector25 = new Vector2(x3, y3);
27402 x4 = mountedCenter.X - vector25.X;
27403 y4 = mountedCenter.Y - vector25.Y;
27404 float rotation19 = (float)Math.Atan2(y4, x4) - 1.57f;
27405 if (proj.alpha == 0)
27406 {
27407 int num117 = -1;
27408 if (proj.position.X + (float)(proj.width / 2) < mountedCenter.X)
27409 {
27410 num117 = 1;
27411 }
27412 if (Main.player[proj.owner].direction == 1)
27413 {
27414 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y4 * (float)num117, x4 * (float)num117);
27415 }
27416 else
27417 {
27418 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y4 * (float)num117, x4 * (float)num117);
27419 }
27420 }
27421 bool flag23 = true;
27422 while (flag23)
27423 {
27424 float num118 = (float)Math.Sqrt(x4 * x4 + y4 * y4);
27425 if (num118 < 25f)
27426 {
27427 flag23 = false;
27428 continue;
27429 }
27430 if (float.IsNaN(num118))
27431 {
27432 flag23 = false;
27433 continue;
27434 }
27435 num118 = 12f / num118;
27436 x4 *= num118;
27437 y4 *= num118;
27438 vector25.X += x4;
27439 vector25.Y += y4;
27440 x4 = mountedCenter.X - vector25.X;
27441 y4 = mountedCenter.Y - vector25.Y;
27442 Microsoft.Xna.Framework.Color color28 = Lighting.GetColor((int)vector25.X / 16, (int)(vector25.Y / 16f));
27444 }
27445 }
27446 else if (proj.type == 481)
27447 {
27448 float x5 = proj.Center.X;
27449 float y5 = proj.Center.Y;
27450 float x6 = proj.velocity.X;
27451 float y6 = proj.velocity.Y;
27452 float num119 = (float)Math.Sqrt(x6 * x6 + y6 * y6);
27453 num119 = 4f / num119;
27454 if (proj.ai[0] == 0f)
27455 {
27456 x5 -= proj.velocity.X * num119;
27457 y5 -= proj.velocity.Y * num119;
27458 }
27459 else
27460 {
27461 x5 += proj.velocity.X * num119;
27462 y5 += proj.velocity.Y * num119;
27463 }
27464 Vector2 origin5 = new Vector2(x5, y5);
27465 x6 = mountedCenter.X - origin5.X;
27466 y6 = mountedCenter.Y - origin5.Y;
27467 float rotation20 = (float)Math.Atan2(y6, x6) - 1.57f;
27468 if (proj.alpha == 0)
27469 {
27470 int num120 = -1;
27471 if (proj.position.X + (float)(proj.width / 2) < mountedCenter.X)
27472 {
27473 num120 = 1;
27474 }
27475 if (Main.player[proj.owner].direction == 1)
27476 {
27477 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y6 * (float)num120, x6 * (float)num120);
27478 }
27479 else
27480 {
27481 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y6 * (float)num120, x6 * (float)num120);
27482 }
27483 }
27484 bool flag24 = true;
27485 while (flag24)
27486 {
27487 float num121 = 0.85f;
27488 float num122 = origin5.Distance(mountedCenter);
27489 float num123 = num122;
27490 if ((double)num122 < (double)TextureAssets.Chain40.Height() * 1.5)
27491 {
27492 flag24 = false;
27493 continue;
27494 }
27495 if (float.IsNaN(num122))
27496 {
27497 flag24 = false;
27498 continue;
27499 }
27500 num122 = (float)TextureAssets.Chain40.Height() * num121 / num122;
27501 x6 *= num122;
27502 y6 *= num122;
27503 origin5.X += x6;
27504 origin5.Y += y6;
27505 x6 = mountedCenter.X - origin5.X;
27506 y6 = mountedCenter.Y - origin5.Y;
27507 if (num123 > (float)(TextureAssets.Chain40.Height() * 2))
27508 {
27509 for (int n = 0; n < 2; n++)
27510 {
27511 float num124 = 0.75f;
27512 float num125 = 1f;
27513 num125 = ((n != 0) ? Math.Abs(Main.player[proj.owner].velocity.Y) : Math.Abs(Main.player[proj.owner].velocity.X));
27514 if (num125 > 10f)
27515 {
27516 num125 = 10f;
27517 }
27518 num125 /= 10f;
27519 num124 *= num125;
27520 num125 = num123 / 80f;
27521 if (num125 > 1f)
27522 {
27523 num125 = 1f;
27524 }
27525 num124 *= num125;
27526 if (num124 < 0f)
27527 {
27528 num124 = 0f;
27529 }
27530 if (float.IsNaN(num124))
27531 {
27532 continue;
27533 }
27534 if (n == 0)
27535 {
27536 if (Main.player[proj.owner].velocity.X < 0f && proj.Center.X < mountedCenter.X)
27537 {
27538 y6 *= 1f - num124;
27539 }
27540 if (Main.player[proj.owner].velocity.X > 0f && proj.Center.X > mountedCenter.X)
27541 {
27542 y6 *= 1f - num124;
27543 }
27544 }
27545 else
27546 {
27547 if (Main.player[proj.owner].velocity.Y < 0f && proj.Center.Y < mountedCenter.Y)
27548 {
27549 x6 *= 1f - num124;
27550 }
27551 if (Main.player[proj.owner].velocity.Y > 0f && proj.Center.Y > mountedCenter.Y)
27552 {
27553 x6 *= 1f - num124;
27554 }
27555 }
27556 }
27557 }
27558 Microsoft.Xna.Framework.Color color29 = Lighting.GetColor((int)origin5.X / 16, (int)(origin5.Y / 16f));
27560 }
27561 }
27562 else if (proj.type == 271)
27563 {
27564 float x7 = proj.Center.X;
27565 float y7 = proj.Center.Y;
27566 float x8 = proj.velocity.X;
27567 float y8 = proj.velocity.Y;
27568 float num126 = (float)Math.Sqrt(x8 * x8 + y8 * y8);
27569 num126 = 4f / num126;
27570 if (proj.ai[0] == 0f)
27571 {
27572 x7 -= proj.velocity.X * num126;
27573 y7 -= proj.velocity.Y * num126;
27574 }
27575 else
27576 {
27577 x7 += proj.velocity.X * num126;
27578 y7 += proj.velocity.Y * num126;
27579 }
27580 Vector2 vector26 = new Vector2(x7, y7);
27581 x8 = mountedCenter.X - vector26.X;
27582 y8 = mountedCenter.Y - vector26.Y;
27583 float rotation21 = (float)Math.Atan2(y8, x8) - 1.57f;
27584 if (proj.alpha == 0)
27585 {
27586 int num127 = -1;
27587 if (proj.position.X + (float)(proj.width / 2) < mountedCenter.X)
27588 {
27589 num127 = 1;
27590 }
27591 if (Main.player[proj.owner].direction == 1)
27592 {
27593 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y8 * (float)num127, x8 * (float)num127);
27594 }
27595 else
27596 {
27597 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y8 * (float)num127, x8 * (float)num127);
27598 }
27599 }
27600 bool flag25 = true;
27601 while (flag25)
27602 {
27603 float num128 = (float)Math.Sqrt(x8 * x8 + y8 * y8);
27604 if (num128 < 25f)
27605 {
27606 flag25 = false;
27607 continue;
27608 }
27609 if (float.IsNaN(num128))
27610 {
27611 flag25 = false;
27612 continue;
27613 }
27614 num128 = 12f / num128;
27615 x8 *= num128;
27616 y8 *= num128;
27617 vector26.X += x8;
27618 vector26.Y += y8;
27619 x8 = mountedCenter.X - vector26.X;
27620 y8 = mountedCenter.Y - vector26.Y;
27621 Microsoft.Xna.Framework.Color color30 = Lighting.GetColor((int)vector26.X / 16, (int)(vector26.Y / 16f));
27623 }
27624 }
27625 else if (proj.aiStyle == 13)
27626 {
27627 float num129 = proj.position.X + 8f;
27628 float num130 = proj.position.Y + 2f;
27629 float x9 = proj.velocity.X;
27630 float num131 = proj.velocity.Y;
27631 if (x9 == 0f && num131 == 0f)
27632 {
27633 num131 = 0.0001f;
27634 num131 = 0.0001f;
27635 }
27636 float num132 = (float)Math.Sqrt(x9 * x9 + num131 * num131);
27637 num132 = 20f / num132;
27638 if (proj.ai[0] == 0f)
27639 {
27640 num129 -= proj.velocity.X * num132;
27641 num130 -= proj.velocity.Y * num132;
27642 }
27643 else
27644 {
27645 num129 += proj.velocity.X * num132;
27646 num130 += proj.velocity.Y * num132;
27647 }
27649 x9 = mountedCenter.X - vector27.X;
27650 num131 = mountedCenter.Y - vector27.Y;
27651 float rotation22 = (float)Math.Atan2(num131, x9) - 1.57f;
27652 if (proj.alpha == 0)
27653 {
27654 int num133 = -1;
27655 if (proj.position.X + (float)(proj.width / 2) < mountedCenter.X)
27656 {
27657 num133 = 1;
27658 }
27659 if (Main.player[proj.owner].direction == 1)
27660 {
27661 Main.player[proj.owner].itemRotation = (float)Math.Atan2(num131 * (float)num133, x9 * (float)num133);
27662 }
27663 else
27664 {
27665 Main.player[proj.owner].itemRotation = (float)Math.Atan2(num131 * (float)num133, x9 * (float)num133);
27666 }
27667 }
27668 bool flag26 = true;
27669 while (flag26)
27670 {
27671 float num134 = (float)Math.Sqrt(x9 * x9 + num131 * num131);
27672 if (num134 < 25f)
27673 {
27674 flag26 = false;
27675 continue;
27676 }
27677 if (float.IsNaN(num134))
27678 {
27679 flag26 = false;
27680 continue;
27681 }
27682 num134 = 12f / num134;
27683 x9 *= num134;
27684 num131 *= num134;
27685 vector27.X += x9;
27686 vector27.Y += num131;
27687 x9 = mountedCenter.X - vector27.X;
27688 num131 = mountedCenter.Y - vector27.Y;
27689 Microsoft.Xna.Framework.Color color31 = Lighting.GetColor((int)vector27.X / 16, (int)(vector27.Y / 16f));
27690 EntitySpriteDraw(TextureAssets.Chain.Value, new Vector2(vector27.X - screenPosition.X, vector27.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain.Width(), TextureAssets.Chain.Height()), color31, rotation22, new Vector2((float)TextureAssets.Chain.Width() * 0.5f, (float)TextureAssets.Chain.Height() * 0.5f), 1f, SpriteEffects.None);
27691 }
27692 }
27693 else if (proj.type == 190)
27694 {
27695 float x10 = proj.position.X + (float)(proj.width / 2);
27696 float y9 = proj.position.Y + (float)(proj.height / 2);
27697 float x11 = proj.velocity.X;
27698 float y10 = proj.velocity.Y;
27699 Math.Sqrt(x11 * x11 + y10 * y10);
27700 Vector2 vector28 = new Vector2(x10, y9);
27701 x11 = mountedCenter.X - vector28.X;
27702 y10 = mountedCenter.Y + Main.player[proj.owner].gfxOffY - vector28.Y;
27703 Math.Atan2(y10, x11);
27704 if (proj.alpha == 0)
27705 {
27706 int num135 = -1;
27707 if (proj.position.X + (float)(proj.width / 2) < mountedCenter.X)
27708 {
27709 num135 = 1;
27710 }
27711 if (Main.player[proj.owner].direction == 1)
27712 {
27713 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y10 * (float)num135, x11 * (float)num135);
27714 }
27715 else
27716 {
27717 Main.player[proj.owner].itemRotation = (float)Math.Atan2(y10 * (float)num135, x11 * (float)num135);
27718 }
27719 }
27720 }
27721 else if (proj.aiStyle == 15)
27722 {
27724 }
27725 Microsoft.Xna.Framework.Color projectileColor = Lighting.GetColor((int)((double)proj.position.X + (double)proj.width * 0.5) / 16, (int)(((double)proj.position.Y + (double)proj.height * 0.5) / 16.0));
27726 if (proj.hide && !ProjectileID.Sets.DontAttachHideToAlpha[proj.type])
27727 {
27728 projectileColor = Lighting.GetColor((int)mountedCenter.X / 16, (int)(mountedCenter.Y / 16f));
27729 }
27730 if (proj.type == 14)
27731 {
27733 }
27734 int num136 = 0;
27735 int num137 = 0;
27736 if (proj.type == 175)
27737 {
27738 num136 = 10;
27739 }
27740 if (proj.type == 392)
27741 {
27742 num136 = -2;
27743 }
27744 if (proj.type == 499)
27745 {
27746 num136 = 12;
27747 }
27748 if (proj.type == 765)
27749 {
27750 num136 = 22;
27751 num137 = -16;
27752 }
27753 if (proj.type == 966)
27754 {
27755 num136 = -26;
27756 num137 = -6;
27757 }
27758 if (proj.bobber)
27759 {
27760 num136 = 8;
27761 }
27762 if (proj.type == 519)
27763 {
27764 num136 = 6;
27765 num137 -= 6;
27766 }
27767 if (proj.type == 520)
27768 {
27769 num136 = 12;
27770 }
27771 if (proj.type == 492)
27772 {
27773 num137 -= 4;
27774 num136 += 5;
27775 }
27776 if (proj.type == 498)
27777 {
27778 num136 = 6;
27779 }
27780 if (proj.type == 489)
27781 {
27782 num136 = -2;
27783 }
27784 if (proj.type == 486)
27785 {
27786 num136 = -6;
27787 }
27788 if (proj.type == 525)
27789 {
27790 num136 = 5;
27791 }
27792 if (proj.type == 488)
27793 {
27794 num137 -= 8;
27795 }
27796 if (proj.type == 373)
27797 {
27798 num137 = -10;
27799 num136 = 6;
27800 }
27801 if (proj.type == 375)
27802 {
27803 num137 = -11;
27804 num136 = 12;
27805 }
27806 if (proj.type == 423)
27807 {
27808 num137 = -5;
27809 }
27810 if (proj.type == 346)
27811 {
27812 num136 = 4;
27813 }
27814 if (proj.type == 331)
27815 {
27816 num137 = -4;
27817 }
27818 if (proj.type == 254)
27819 {
27820 num136 = 3;
27821 }
27822 if (proj.type == 273)
27823 {
27824 num137 = 2;
27825 }
27826 if (proj.type == 335)
27827 {
27828 num136 = 6;
27829 }
27830 if (proj.type == 162)
27831 {
27832 num136 = 1;
27833 num137 = 1;
27834 }
27835 if (proj.type == 377)
27836 {
27837 num136 = -6;
27838 }
27839 if (proj.type == 353)
27840 {
27841 num136 = 36;
27842 num137 = -12;
27843 }
27844 if (proj.type == 324)
27845 {
27846 num136 = 22;
27847 num137 = -6;
27848 }
27849 if (proj.type == 266)
27850 {
27851 num136 = 10;
27852 num137 = -10;
27853 }
27854 if (proj.type == 319)
27855 {
27856 num136 = 10;
27857 num137 = -12;
27858 }
27859 if (proj.type == 315)
27860 {
27861 num136 = -13;
27862 num137 = -6;
27863 }
27864 if (proj.type == 313 && proj.height != 54)
27865 {
27866 num137 = -12;
27867 num136 = 20;
27868 }
27869 if (proj.type == 314)
27870 {
27871 num137 = -8;
27872 num136 = 0;
27873 }
27874 if (proj.type == 269)
27875 {
27876 num136 = 18;
27877 num137 = -14;
27878 }
27879 if (proj.type == 268)
27880 {
27881 num136 = 22;
27882 num137 = -2;
27883 }
27884 if (proj.type == 18)
27885 {
27886 num136 = 3;
27887 num137 = 3;
27888 }
27889 if (proj.type == 16)
27890 {
27891 num136 = 6;
27892 }
27893 if (proj.type == 17 || proj.type == 31)
27894 {
27895 num136 = 2;
27896 }
27897 if (proj.type == 25 || proj.type == 26 || proj.type == 35 || proj.type == 63 || proj.type == 154)
27898 {
27899 num136 = 6;
27900 num137 -= 6;
27901 }
27902 if (proj.type == 947 || proj.type == 948)
27903 {
27904 num136 = 4;
27905 num137 -= 4;
27906 }
27907 if (proj.type == 28 || proj.type == 37 || proj.type == 75)
27908 {
27909 num136 = 8;
27910 }
27911 if (proj.type == 29 || proj.type == 470 || proj.type == 637)
27912 {
27913 num136 = 11;
27914 }
27915 if (proj.type == 43)
27916 {
27917 num136 = 4;
27918 }
27919 if (proj.type == 208)
27920 {
27921 num136 = 2;
27922 num137 -= 12;
27923 }
27924 if (proj.type == 209)
27925 {
27926 num136 = 4;
27927 num137 -= 8;
27928 }
27929 if (proj.type == 210)
27930 {
27931 num136 = 2;
27932 num137 -= 22;
27933 }
27934 if (proj.type == 251)
27935 {
27936 num136 = 18;
27937 num137 -= 10;
27938 }
27939 if (proj.type == 163 || proj.type == 310 || proj.type == 1009 || proj.type == 1010 || proj.type == 1011 || proj.type == 1008)
27940 {
27941 num136 = 10;
27942 }
27943 if (proj.type == 69 || proj.type == 70)
27944 {
27945 num136 = 4;
27946 num137 = 4;
27947 }
27948 float num138 = (float)(TextureAssets.Projectile[proj.type].Width() - proj.width) * 0.5f + (float)proj.width * 0.5f;
27949 if (proj.type == 50 || proj.type == 53 || proj.type == 515 || proj.type == 870)
27950 {
27951 num137 = -8;
27952 }
27953 if (proj.type == 473)
27954 {
27955 num137 = -6;
27956 num136 = 2;
27957 }
27958 if (proj.type == 72 || proj.type == 86 || proj.type == 87)
27959 {
27960 num137 = -16;
27961 num136 = 8;
27962 }
27963 if (proj.type == 74)
27964 {
27965 num137 = -6;
27966 }
27967 if (proj.type == 99 || proj.type == 727 || proj.type == 1013 || proj.type == 1014)
27968 {
27969 num136 = 1;
27970 }
27971 if (proj.type == 655)
27972 {
27973 num136 = 1;
27974 }
27975 if (proj.type == 111)
27976 {
27977 num136 = 18;
27978 num137 = -16;
27979 }
27980 if (proj.type == 875)
27981 {
27982 num136 = 16;
27983 num137 = -16;
27984 }
27985 if (proj.type == 881)
27986 {
27987 num136 = 14;
27988 num137 = -8;
27989 }
27990 if (proj.type == 934)
27991 {
27992 num136 = 14;
27993 num137 = -20;
27994 }
27995 if (proj.type == 934)
27996 {
27997 num136 = 14;
27998 num137 = -20;
27999 }
28000 if (proj.type == 884)
28001 {
28002 num136 = 16;
28003 num137 = -12;
28004 }
28005 if (proj.type == 890)
28006 {
28007 num136 = 26;
28008 num137 = -9;
28009 }
28010 if (proj.type == 891)
28011 {
28012 num136 = 30;
28013 num137 = -12;
28014 }
28015 if (proj.type == 897)
28016 {
28017 num136 = 38;
28018 num137 = -13;
28019 }
28020 if (proj.type == 899)
28021 {
28022 num136 = 28;
28023 num137 = -12;
28024 }
28025 if (proj.type == 900)
28026 {
28027 num136 = 54;
28028 num137 = -30;
28029 }
28030 if (proj.type == 334)
28031 {
28032 num137 = -18;
28033 num136 = 8;
28034 }
28035 if (proj.type == 816)
28036 {
28037 num137 = -19;
28038 num136 = 6;
28039 }
28040 if (proj.type == 821)
28041 {
28042 num137 = -10;
28043 num136 = 6;
28044 }
28045 if (proj.type == 825)
28046 {
28047 num137 = -19;
28048 num136 = 14;
28049 }
28050 if (proj.type == 854)
28051 {
28052 num137 = -14;
28053 num136 = 10;
28054 }
28055 if (proj.type == 858)
28056 {
28057 num137 = -8;
28058 num136 = 16;
28059 }
28060 if (proj.type == 859)
28061 {
28062 num137 = -8;
28063 num136 = 8;
28064 }
28065 if (proj.type == 860)
28066 {
28067 num137 = -8;
28068 num136 = 34;
28069 }
28070 if (proj.type == 958)
28071 {
28072 num137 = -20;
28073 num136 = 48;
28074 }
28075 if (proj.type == 960)
28076 {
28077 num137 = -14;
28078 num136 = 24;
28079 }
28080 if (proj.type == 956)
28081 {
28082 num137 = -12;
28083 num136 = 16;
28084 }
28085 if (proj.type == 959)
28086 {
28087 num137 = -14 + ((proj.spriteDirection == -1) ? (-8) : 0);
28088 num136 = 40;
28089 }
28090 if (proj.type == 994)
28091 {
28092 num137 = -10;
28093 num136 = 18;
28094 }
28095 if (proj.type == 998)
28096 {
28097 num137 = -10;
28098 num136 = 14;
28099 }
28100 if (proj.type == 1003)
28101 {
28102 num137 = -18 + ((proj.spriteDirection == 1) ? 8 : 0);
28103 num136 = 22;
28104 }
28105 if (proj.type == 1004)
28106 {
28107 num137 = -18 + ((proj.spriteDirection == 1) ? 6 : 0);
28108 num136 = 26;
28109 }
28110 if (proj.type == 200)
28111 {
28112 num136 = 12;
28113 num137 = -12;
28114 }
28115 if (proj.type == 211)
28116 {
28117 num136 = 14;
28118 num137 = 0;
28119 }
28120 if (proj.type == 236)
28121 {
28122 num136 = 30;
28123 num137 = -14;
28124 }
28125 if (proj.type >= 191 && proj.type <= 194)
28126 {
28127 num136 = 26;
28128 num137 = ((proj.direction != 1) ? (-22) : (-10));
28129 }
28130 if (proj.type >= 390 && proj.type <= 392)
28131 {
28132 num137 = 4 * proj.direction;
28133 }
28134 if (proj.type == 112)
28135 {
28136 num136 = 14;
28137 num137 = -8 + 4 * proj.spriteDirection;
28138 }
28139 _ = proj.type;
28140 _ = 118;
28141 if (proj.type == 517 || proj.type == 681)
28142 {
28143 num136 = 6;
28144 }
28145 if (proj.type == 516)
28146 {
28147 num136 = 6;
28148 }
28149 if (proj.type == 127)
28150 {
28151 num136 = 8;
28152 }
28153 if (proj.type == 155)
28154 {
28155 num136 = 3;
28156 num137 = 3;
28157 }
28158 if (proj.type == 397)
28159 {
28160 num138 -= 1f;
28161 num136 = -2;
28162 num137 = -2;
28163 }
28164 if (proj.type == 398)
28165 {
28166 num136 = 8;
28167 }
28169 if (proj.spriteDirection == -1)
28170 {
28171 dir = SpriteEffects.FlipHorizontally;
28172 }
28173 if (proj.type == 681 && proj.velocity.X > 0f)
28174 {
28175 dir ^= SpriteEffects.FlipHorizontally;
28176 }
28177 if (proj.type == 221)
28178 {
28179 for (int num139 = 1; num139 < 10; num139++)
28180 {
28181 float num140 = proj.velocity.X * (float)num139 * 0.5f;
28182 float num141 = proj.velocity.Y * (float)num139 * 0.5f;
28184 float num142 = 0f;
28185 if (num139 == 1)
28186 {
28187 num142 = 0.9f;
28188 }
28189 if (num139 == 2)
28190 {
28191 num142 = 0.8f;
28192 }
28193 if (num139 == 3)
28194 {
28195 num142 = 0.7f;
28196 }
28197 if (num139 == 4)
28198 {
28199 num142 = 0.6f;
28200 }
28201 if (num139 == 5)
28202 {
28203 num142 = 0.5f;
28204 }
28205 if (num139 == 6)
28206 {
28207 num142 = 0.4f;
28208 }
28209 if (num139 == 7)
28210 {
28211 num142 = 0.3f;
28212 }
28213 if (num139 == 8)
28214 {
28215 num142 = 0.2f;
28216 }
28217 if (num139 == 9)
28218 {
28219 num142 = 0.1f;
28220 }
28221 alpha.R = (byte)((float)(int)alpha.R * num142);
28222 alpha.G = (byte)((float)(int)alpha.G * num142);
28223 alpha.B = (byte)((float)(int)alpha.B * num142);
28224 alpha.A = (byte)((float)(int)alpha.A * num142);
28225 int num143 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
28226 int y11 = num143 * proj.frame;
28227 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137 - num140, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY - num141), new Microsoft.Xna.Framework.Rectangle(0, y11, TextureAssets.Projectile[proj.type].Width(), num143), alpha, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
28228 }
28229 }
28230 if (proj.type == 408 || proj.type == 435 || proj.type == 436 || proj.type == 438 || proj.type == 452 || proj.type == 454 || proj.type == 459 || proj.type == 462 || proj.type == 503 || proj.type == 532 || proj.type == 533 || proj.type == 573 || proj.type == 582 || proj.type == 585 || proj.type == 592 || proj.type == 601 || proj.type == 636 || proj.type == 638 || proj.type == 640 || proj.type == 639 || proj.type == 424 || proj.type == 425 || proj.type == 426 || proj.type == 660 || proj.type == 661 || proj.type == 671 || proj.type == 664 || proj.type == 666 || proj.type == 668 || proj.type == 675 || proj.type == 680 || proj.type == 682 || proj.type == 684 || proj.type == 686 || proj.type == 700 || proj.type == 706 || proj.type == 709 || proj.type == 710 || proj.type == 711 || proj.type == 261 || ProjectileID.Sets.IsAGolfBall[proj.type] || proj.type == 729 || proj.type == 732 || proj.type == 731 || proj.type == 755 || proj.type == 811 || proj.type == 814 || proj.type == 819 || proj.type == 864 || proj.type == 873 || proj.type == 872 || proj.type == 833 || proj.type == 834 || proj.type == 835 || proj.type == 818 || proj.type == 902 || proj.type == 894 || proj.type == 901 || proj.type == 909 || proj.type == 916 || proj.type == 931 || proj.type == 933 || proj.type == 964 || proj.type == 965 || proj.type == 977 || proj.type == 976 || proj.type == 1001)
28231 {
28233 int num144 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
28234 int y12 = num144 * proj.frame;
28236 Vector2 origin6 = rectangle4.Size() / 2f;
28238 float num145 = 0f;
28239 if (proj.type == 503)
28240 {
28241 origin6.Y = 70f;
28242 }
28243 if (proj.type == 686 || proj.type == 711)
28244 {
28245 origin6.Y = rectangle4.Height - 70;
28246 }
28247 if (proj.type == 438)
28248 {
28249 rectangle4.Y = 0;
28250 }
28251 if (proj.type == 452)
28252 {
28253 rectangle4.Y = 0;
28254 }
28255 if (proj.type == 408)
28256 {
28257 rectangle4.Y = num144;
28258 }
28259 if (proj.type == 636)
28260 {
28261 origin6.Y = 10f;
28262 }
28263 if (proj.type == 638)
28264 {
28265 origin6.Y = 2f;
28266 }
28267 if (proj.type == 640 || proj.type == 639 || proj.type == 710)
28268 {
28269 origin6.Y = 5f;
28270 }
28271 if (proj.type == 700)
28272 {
28273 origin6.X = ((proj.spriteDirection == 1) ? (rectangle4.Width - 20) : 20);
28274 }
28275 if (proj.type == 965 || proj.type == 964)
28276 {
28277 origin6.X = ((proj.spriteDirection == 1) ? (rectangle4.Width - 20) : 20);
28278 }
28279 if (proj.type == 872)
28280 {
28281 rectangle4.Width /= 2;
28282 origin6.X /= 2f;
28283 }
28284 if (proj.type == 933)
28285 {
28286 int num146 = (int)proj.ai[1];
28287 if (TextureAssets.Item.IndexInRange(num146))
28288 {
28289 instance.LoadItem(num146);
28291 rectangle4 = value11.Frame();
28292 origin6 = rectangle4.Size() / 2f;
28293 num145 = -(float)Math.PI / 4f * (float)proj.spriteDirection;
28294 }
28295 }
28296 if (proj.type == 833 && proj.frame != 8)
28297 {
28298 zero.Y += proj.height / 2;
28299 origin6 = rectangle4.Size() * new Vector2(0.5f, 1f);
28300 origin6.Y -= 4f;
28301 origin6.X -= 7 * dir.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt();
28302 }
28303 if ((proj.type == 834 || proj.type == 835) && proj.frame != 10)
28304 {
28305 zero.Y += proj.height / 2;
28306 origin6 = rectangle4.Size() * new Vector2(0.5f, 1f);
28307 origin6.Y -= 4f;
28308 origin6.X -= 2 * dir.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt();
28309 }
28310 int num147 = 8;
28311 int num148 = 2;
28312 int num149 = 1;
28313 float value12 = 1f;
28314 float num150 = 15f;
28315 float num151 = 0f;
28318 if (proj.type == 909)
28319 {
28320 num149 = 5;
28321 num147 = 0;
28322 num148 = -1;
28323 }
28324 else if (proj.type == 503)
28325 {
28326 num147 = 9;
28327 num148 = 3;
28328 value12 = 0.5f;
28329 }
28330 else if (proj.type == 261)
28331 {
28332 num149 = 18;
28333 num147 = 0;
28334 num148 = -2;
28335 value12 = 1.3f;
28336 }
28337 else if (proj.type == 833 || proj.type == 834 || proj.type == 835)
28338 {
28339 num149 = 6;
28340 num147 = 0;
28341 num148 = -1;
28342 value12 = 1.5f;
28343 }
28344 else if (proj.type == 818)
28345 {
28346 num149 = 18;
28347 num147 = 0;
28348 num148 = -2;
28349 value12 = 1f;
28350 }
28351 else if (proj.type == 729)
28352 {
28353 num149 = 18;
28354 num147 = 0;
28355 num148 = -2;
28356 value12 = 1.3f;
28357 }
28358 else if (proj.type == 977)
28359 {
28360 num149 = 18;
28361 num147 = 0;
28362 num148 = -2;
28363 value12 = 1.3f;
28364 }
28365 else if (proj.type == 1001)
28366 {
28367 num149 = 10;
28368 num147 = 0;
28369 num148 = -2;
28370 value12 = 1.3f;
28371 dir = ((proj.spriteDirection != 1) ? SpriteEffects.FlipVertically : SpriteEffects.None);
28372 }
28373 else if (proj.type == 976)
28374 {
28375 num149 = 18;
28376 num147 = 0;
28377 num148 = -3;
28378 value12 = 1.3f;
28379 rectangle4 = new Microsoft.Xna.Framework.Rectangle(0, 20 * proj.frame, 32, 18);
28381 origin6 = rectangle4.Size() / 2f;
28382 }
28383 else if (proj.type == 686 || proj.type == 711)
28384 {
28385 num149 = 19;
28386 num147 = 0;
28387 num148 = -3;
28388 value12 = 0.5f;
28389 }
28390 else if (ProjectileID.Sets.IsAGolfBall[proj.type])
28391 {
28392 num149 = 0;
28393 num147 = 0;
28394 num148 = -1;
28395 value12 = 2f;
28396 }
28397 else if (proj.type == 671)
28398 {
28399 num149 = 5;
28400 num147 = 0;
28401 num148 = -1;
28402 value12 = 2.6f;
28403 }
28404 else if (proj.type == 811)
28405 {
28406 num149 = 5;
28407 num147 = 0;
28408 num148 = -1;
28409 value12 = 2.6f;
28411 }
28412 else if (proj.type == 814)
28413 {
28414 num149 = 18;
28415 num147 = 0;
28416 num148 = -1;
28417 value12 = 1f;
28419 }
28420 else if (proj.type == 755)
28421 {
28422 num149 = 5;
28423 num147 = 0;
28424 num148 = -1;
28425 value12 = 2.6f;
28426 }
28427 else if (proj.type == 700)
28428 {
28429 num147 = 5;
28430 num148 = 1;
28431 value12 = 2.6f;
28432 }
28433 else if (proj.type == 965 || proj.type == 964)
28434 {
28435 num147 = 5;
28436 num148 = 1;
28437 value12 = 2.6f;
28438 }
28439 else if (proj.type == 731)
28440 {
28441 num149 = 19;
28442 num147 = 0;
28443 num148 = -1;
28444 value12 = 0.5f;
28445 }
28446 else if (proj.type == 864)
28447 {
28448 num149 = 12;
28449 num147 = 0;
28450 num148 = -1;
28451 value12 = 1.4f;
28452 value13.Y += value13.Height;
28453 }
28454 else if (proj.type == 916)
28455 {
28456 num149 = 19;
28457 num147 = 0;
28458 num148 = -1;
28459 value12 = 1.4f;
28460 value13.Y += value13.Height;
28462 unifiedRandom.SetSeed(proj.timeLeft);
28463 }
28464 else if (proj.type == 873)
28465 {
28466 num149 = 39;
28467 num150 = 40f;
28468 num147 = 0;
28469 num148 = -1;
28470 value12 = 1.4f;
28471 }
28472 else if (proj.type == 931)
28473 {
28474 num149 = 19;
28475 num150 = 20f;
28476 num147 = 0;
28477 num148 = -1;
28478 value12 = 0.7f;
28479 }
28480 else if (proj.type == 933)
28481 {
28482 num149 = 60;
28483 num150 = 60f;
28484 num147 = 0;
28485 num148 = -15;
28486 value12 = 1f;
28487 }
28488 else if (proj.type == 872)
28489 {
28490 num149 = 79;
28491 num150 = 10f;
28492 num147 = 0;
28493 num148 = -1;
28494 value12 = 1f;
28495 value13.X += value13.Width;
28496 }
28497 else if (proj.type == 664 || proj.type == 666 || proj.type == 668)
28498 {
28499 num147 = 8;
28500 num148 = 2;
28501 value12 = 0.4f;
28502 }
28503 else if (proj.type == 582 || proj.type == 902)
28504 {
28505 if (proj.ai[2] == 1f)
28506 {
28507 value11 = TextureAssets.Extra[263].Value;
28508 }
28509 num147 = 10;
28510 num148 = 2;
28511 value12 = 0.7f;
28512 num151 = 0.2f;
28513 }
28514 else if (proj.type == 675)
28515 {
28516 num147 = 5;
28517 num148 = 1;
28518 value12 = 0.4f;
28519 }
28520 else if (proj.type == 638)
28521 {
28522 num147 = 5;
28523 num148 = 1;
28524 value12 = 1f;
28525 }
28526 else if (proj.type == 660)
28527 {
28528 num147 = 3;
28529 num148 = 1;
28530 value12 = 8f;
28531 rectangle4 = new Microsoft.Xna.Framework.Rectangle(38 * proj.frame, 0, 38, 38);
28533 origin6 = rectangle4.Size() / 2f;
28534 }
28535 else if (proj.type == 684)
28536 {
28537 num147 = 8;
28538 num148 = 1;
28539 value12 = 0.75f;
28540 }
28541 else if (proj.type == 639)
28542 {
28543 num147 = 10;
28544 num148 = 1;
28545 value12 = 1f;
28546 }
28547 else if (proj.type == 710)
28548 {
28549 num149 = 9;
28550 num147 = 0;
28551 num148 = -2;
28552 value12 = 0.5f;
28553 }
28554 else if (proj.type == 640)
28555 {
28556 num147 = 20;
28557 num148 = 1;
28558 value12 = 1f;
28559 }
28560 else if (proj.type == 436)
28561 {
28562 num148 = 2;
28563 value12 = 0.5f;
28564 }
28565 else if (proj.type == 424 || proj.type == 425 || proj.type == 426)
28566 {
28567 num147 = 10;
28568 num148 = 2;
28569 value12 = 0.6f;
28570 }
28571 else if (proj.type == 438)
28572 {
28573 num147 = 10;
28574 num148 = 2;
28575 value12 = 1f;
28576 }
28577 else if (proj.type == 452)
28578 {
28579 num147 = 10;
28580 num148 = 3;
28581 value12 = 0.5f;
28582 }
28583 else if (proj.type == 454)
28584 {
28585 num147 = 5;
28586 num148 = 1;
28587 value12 = 0.2f;
28588 }
28589 else if (proj.type == 462)
28590 {
28591 num147 = 7;
28592 num148 = 1;
28593 value12 = 0.2f;
28594 }
28595 else if (proj.type == 661)
28596 {
28597 num147 = 0;
28598 num148 = 1;
28599 value12 = 0.5f;
28600 }
28601 else if (proj.type == 706)
28602 {
28603 num149 = 9;
28604 num147 = 0;
28605 num148 = -2;
28606 value12 = 0.5f;
28607 }
28608 else if (proj.type == 585)
28609 {
28610 num147 = 7;
28611 num148 = 1;
28612 value12 = 0.2f;
28613 }
28614 else if (proj.type == 459)
28615 {
28616 num147 = (int)(proj.scale * 8f);
28617 num148 = num147 / 4;
28618 if (num148 < 1)
28619 {
28620 num148 = 1;
28621 }
28622 value12 = 0.3f;
28623 }
28624 else if (proj.type == 709)
28625 {
28626 num147 = 8;
28627 num148 = num147 / 4;
28628 if (num148 < 1)
28629 {
28630 num148 = 1;
28631 }
28632 value12 = 0.5f;
28633 }
28634 else if (proj.type == 532)
28635 {
28636 num147 = 10;
28637 num148 = 1;
28638 value12 = 0.7f;
28639 num151 = 0.2f;
28640 }
28641 else if (proj.type == 592)
28642 {
28643 num147 = 10;
28644 num148 = 2;
28645 value12 = 1f;
28646 }
28647 else if (proj.type == 601)
28648 {
28649 num147 = 8;
28650 num148 = 1;
28651 value12 = 0.3f;
28652 }
28653 else if (proj.type == 636)
28654 {
28655 num147 = 20;
28656 num148 = 3;
28657 value12 = 0.5f;
28658 }
28659 else if (proj.type == 680)
28660 {
28661 num147 = 9;
28662 num148 = 3;
28663 value12 = 0.5f;
28664 }
28665 else if (proj.type == 533)
28666 {
28667 if (proj.ai[0] >= 6f && proj.ai[0] <= 8f)
28668 {
28669 num147 = ((proj.ai[0] == 6f) ? 8 : 4);
28670 num148 = 1;
28671 if (proj.ai[0] != 7f)
28672 {
28673 num151 = 0.2f;
28674 }
28675 }
28676 else
28677 {
28678 num147 = (num148 = 0);
28679 }
28680 }
28681 for (int num152 = num149; (num148 > 0 && num152 < num147) || (num148 < 0 && num152 > num147); num152 += num148)
28682 {
28683 if (num152 >= proj.oldPos.Length)
28684 {
28685 continue;
28686 }
28688 if (proj.type == 408 || proj.type == 435 || proj.type == 682 || proj.type == 732 || proj.type == 731)
28689 {
28691 }
28692 else if (proj.type == 436)
28693 {
28695 }
28696 else if (proj.type >= 424 && proj.type <= 426)
28697 {
28699 }
28700 else if (proj.type == 640 || proj.type == 639)
28701 {
28702 color32.A = 127;
28703 }
28704 else if (proj.type == 671)
28705 {
28707 }
28708 else if (proj.type == 811)
28709 {
28711 }
28712 else if (proj.type == 814)
28713 {
28714 color32 = Microsoft.Xna.Framework.Color.Lerp(color32, color32 * 0.5f, (float)num152 / (float)num147);
28715 }
28716 else if (proj.type == 261)
28717 {
28718 color32 = Microsoft.Xna.Framework.Color.Lerp(color32, new Microsoft.Xna.Framework.Color(60, 60, 60, 60), (float)num152 / (float)num147);
28719 }
28720 else if (ProjectileID.Sets.IsAGolfBall[proj.type])
28721 {
28722 color32 = Microsoft.Xna.Framework.Color.Lerp(color32, new Microsoft.Xna.Framework.Color(255, 230, 40, 20), (float)num152 / (float)num147);
28723 }
28724 color32 = proj.GetAlpha(color32);
28725 if (proj.type == 438)
28726 {
28727 color32.G /= (byte)num152;
28728 color32.B /= (byte)num152;
28729 }
28730 else if (proj.type == 755)
28731 {
28732 color32 = proj.AI_156_GetColor();
28733 }
28734 else if (proj.type == 873)
28735 {
28736 color32 = proj.AI_171_GetColor();
28737 color32.A /= 2;
28738 color32 *= Utils.GetLerpValue(0f, 20f, proj.timeLeft, clamped: true);
28739 }
28740 else if (proj.type == 931)
28741 {
28742 color32 = proj.GetFairyQueenWeaponsColor(0.5f);
28743 color32 *= Utils.GetLerpValue(0f, 20f, proj.timeLeft, clamped: true);
28744 }
28745 else if (proj.type == 872)
28746 {
28747 color32 = proj.AI_173_GetColor();
28748 color32 *= 0.4f;
28749 color32.A = (byte)((float)(int)color32.A * 0.6f);
28750 if (num152 > 80)
28751 {
28752 color32 *= 0.15f * Utils.GetLerpValue(120f, 80f, num152, clamped: true);
28753 }
28754 }
28755 else if (proj.type == 864)
28756 {
28757 color32 = proj.GetFloatingDaggerMinionGlowColor();
28758 color32.A /= 4;
28759 }
28760 else if (proj.type == 682)
28761 {
28762 color32.G /= (byte)num152;
28763 }
28764 else if (proj.type == 686)
28765 {
28766 if (proj.oldPos[num152] == Vector2.Zero)
28767 {
28768 continue;
28769 }
28770 float num153 = (float)num152 / (float)num149;
28772 }
28773 else if (proj.type == 711)
28774 {
28775 if (proj.oldPos[num152] == Vector2.Zero)
28776 {
28777 continue;
28778 }
28779 float num154 = (float)num152 / (float)num149;
28781 }
28782 else if (proj.type == 684)
28783 {
28784 if (num152 == 1)
28785 {
28786 color32.B /= 2;
28787 color32.G /= 2;
28788 color32.A /= 2;
28789 }
28790 color32.B /= (byte)num152;
28791 color32.G /= (byte)num152;
28792 color32.A /= (byte)num152;
28793 }
28794 else if (proj.type == 706 || proj.type == 710)
28795 {
28796 color32.B /= (byte)num152;
28797 color32.G /= (byte)num152;
28798 color32.A /= (byte)num152;
28799 }
28800 else if (proj.type == 818)
28801 {
28802 float num155 = 0.3f;
28803 float num156 = Utils.GetLerpValue(0f, num155, proj.ai[0], clamped: true) * Utils.GetLerpValue(1f, 1f - num155, proj.ai[0], clamped: true);
28804 Utils.GetLerpValue(0f, num148 * -3, num152, clamped: true);
28808 ourFavoriteColor.A = 0;
28811 }
28812 else if (proj.type == 833 || proj.type == 834 || proj.type == 835)
28813 {
28814 float lerpValue2 = Utils.GetLerpValue(0f, 6f, proj.velocity.Length(), clamped: true);
28816 color32.A = 0;
28818 }
28819 else if (proj.type == 592)
28820 {
28821 color32.R /= (byte)num152;
28822 color32.G /= (byte)num152;
28823 }
28824 else if (proj.type == 640)
28825 {
28826 color32.R /= (byte)num152;
28827 color32.A /= (byte)num152;
28828 }
28829 else if (proj.type >= 424 && proj.type <= 426)
28830 {
28831 color32.B /= (byte)num152;
28832 color32.G /= (byte)num152;
28833 color32.A /= (byte)num152;
28834 }
28835 else if (proj.type == 964 || proj.type == 965)
28836 {
28837 color32 = Microsoft.Xna.Framework.Color.Black * proj.Opacity;
28838 }
28839 float num157 = num147 - num152;
28840 if (num148 < 0)
28841 {
28842 num157 = num149 - num152;
28843 }
28844 color32 *= num157 / ((float)ProjectileID.Sets.TrailCacheLength[proj.type] * 1.5f);
28845 Vector2 vector29 = proj.oldPos[num152];
28846 float num158 = proj.rotation;
28849 {
28850 num158 = proj.oldRot[num152];
28851 effects2 = ((proj.oldSpriteDirection[num152] == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
28852 }
28853 if (vector29 == Vector2.Zero)
28854 {
28855 continue;
28856 }
28857 if (proj.type == 916)
28858 {
28859 value13.Y += value13.Height;
28860 value13.Y %= value13.Height * projFrames[proj.type];
28861 _ = num157 / ((float)ProjectileID.Sets.TrailCacheLength[proj.type] * 1.5f);
28863 int num159 = unifiedRandom.Next(3);
28864 if (num159 == 2 || num159 == 1)
28865 {
28866 color33 = Microsoft.Xna.Framework.Color.Lerp(new Microsoft.Xna.Framework.Color(106, 90, 205, 127), Microsoft.Xna.Framework.Color.Black, 0.2f + 0.8f * unifiedRandom.NextFloat());
28867 }
28868 color32 = color33;
28869 float num160 = num157 / (float)ProjectileID.Sets.TrailCacheLength[proj.type];
28870 num160 = Utils.GetLerpValue(0f, (float)ProjectileID.Sets.TrailCacheLength[proj.type] * 0.75f, num157, clamped: true);
28871 color32 *= num160;
28872 vector29 += unifiedRandom.NextVector2Circular(8f, 8f);
28873 }
28874 if (proj.type == 976)
28875 {
28876 int num161 = value13.Height + 2;
28877 value13.Y += num161;
28878 value13.Y %= num161 * 7;
28879 color32 *= Lighting.GetColor((vector29 + zero + proj.Size / 2f).ToTileCoordinates()).ToVector3().Length() / 1.74f;
28880 }
28881 if (proj.type == 933)
28882 {
28883 float t = proj.localAI[0] - (float)num152;
28884 float num162 = Utils.GetLerpValue(0f, 20f, t, clamped: true) * Utils.GetLerpValue(68f, 60f, t, clamped: true);
28886 color32 = Microsoft.Xna.Framework.Color.White * lerpValue3 * proj.Opacity * num162;
28887 }
28888 Vector2 position3 = vector29 + zero + proj.Size / 2f - screenPosition + new Vector2(0f, proj.gfxOffY);
28889 EntitySpriteDraw(value11, position3, value13, color32, num158 + num145 + proj.rotation * num151 * (float)(num152 - 1) * (float)(-dir.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt()), origin6, MathHelper.Lerp(proj.scale, value12, (float)num152 / num150), effects2);
28890 }
28891 if (proj.type == 661)
28892 {
28894 for (int num163 = 0; num163 < 4; num163++)
28895 {
28896 EntitySpriteDraw(TextureAssets.Extra[75].Value, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY) + proj.rotation.ToRotationVector2().RotatedBy((float)Math.PI / 2f * (float)num163) * 4f, rectangle4, color34, proj.rotation, origin6, proj.scale, dir);
28897 }
28898 }
28899 if (proj.type == 864)
28900 {
28901 Microsoft.Xna.Framework.Color floatingDaggerMinionGlowColor = proj.GetFloatingDaggerMinionGlowColor();
28902 floatingDaggerMinionGlowColor.A /= 4;
28904 value15.Y += value15.Height;
28905 for (int num164 = 0; num164 < 4; num164++)
28906 {
28907 EntitySpriteDraw(value11, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY) + proj.rotation.ToRotationVector2().RotatedBy((float)Math.PI / 2f * (float)num164) * 2f, value15, floatingDaggerMinionGlowColor, proj.rotation, origin6, proj.scale, dir);
28908 }
28909 }
28910 if (proj.type == 873 || proj.type == 931)
28911 {
28912 Microsoft.Xna.Framework.Color color35 = proj.AI_171_GetColor() * 0.5f;
28913 color35.A = 0;
28914 if (proj.type == 931)
28915 {
28916 color35 = proj.GetFairyQueenWeaponsColor(0f);
28917 }
28918 Vector2 vector30 = proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY);
28919 EntitySpriteDraw(value11, vector30, rectangle4, color35, proj.rotation, origin6, proj.scale * 0.9f, dir);
28922 Vector2 origin7 = value16.Size() / 2f;
28924 float num165 = Utils.GetLerpValue(15f, 30f, proj.timeLeft, clamped: true) * Utils.GetLerpValue(240f, 200f, proj.timeLeft, clamped: true) * (1f + 0.2f * (float)Math.Cos(GlobalTimeWrappedHourly % 30f / 0.5f * ((float)Math.PI * 2f) * 3f)) * 0.8f;
28925 Vector2 vector31 = new Vector2(0.5f, 5f) * num165;
28926 Vector2 vector32 = new Vector2(0.5f, 2f) * num165;
28927 color36 *= num165;
28928 color37 *= num165;
28929 int num166 = 0;
28930 Vector2 position4 = vector30 + proj.velocity.SafeNormalize(Vector2.Zero) * MathHelper.Lerp(0.5f, 1f, proj.localAI[0] / 60f) * num166;
28931 if (proj.type == 931)
28932 {
28933 vector31 *= 0.4f;
28934 vector32 *= 0.4f;
28935 }
28938 EntitySpriteDraw(value16, position4, null, color37, (float)Math.PI / 2f, origin7, vector31 * 0.6f, dir);
28940 }
28941 if (proj.type == 755)
28942 {
28943 Microsoft.Xna.Framework.Color color38 = proj.AI_156_GetColor();
28944 color38.A = 120;
28945 for (int num167 = 0; num167 < 4; num167++)
28946 {
28947 EntitySpriteDraw(value11, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY) + proj.rotation.ToRotationVector2().RotatedBy((float)Math.PI / 2f * (float)num167) * 2f, rectangle4, color38, proj.rotation, origin6, proj.scale, dir);
28948 }
28949 }
28950 else if (proj.type == 684)
28951 {
28952 float x12 = (proj.localAI[0] * ((float)Math.PI * 2f) / 30f).ToRotationVector2().X;
28954 color39 *= 0.75f + 0.25f * x12;
28955 for (int num168 = 0; num168 < 8; num168++)
28956 {
28957 EntitySpriteDraw(value11, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY) + proj.rotation.ToRotationVector2().RotatedBy((float)Math.PI / 4f * (float)num168) * (4f + 1f * x12), rectangle4, color39, proj.rotation, origin6, proj.scale, dir);
28958 }
28959 }
28960 else if (ProjectileID.Sets.IsAGolfBall[proj.type])
28961 {
28962 Player player2 = Main.player[proj.owner];
28964 bool flag28 = false;
28965 if (flag27)
28966 {
28967 flag28 |= player2.ownedProjectileCounts[722] > 0 && player2.itemAnimation >= player2.itemAnimationMax;
28968 flag28 |= player2.itemAnimation == 0;
28969 flag28 &= player2.velocity.Y == 0f;
28970 }
28971 Vector2 shotVector = MouseWorld - proj.Center;
28973 {
28975 Projectile projectile = null;
28976 for (int num169 = 0; num169 < 1000; num169++)
28977 {
28979 if (projectile2.active && projectile2.owner == player2.whoAmI && projectile2.type == 722)
28980 {
28982 break;
28983 }
28984 }
28985 if (projectile != null)
28986 {
28989 if (impactVelocity.Length() > 0.05f)
28990 {
28991 GolfHelper.DrawPredictionLine(proj, impactVelocity, shotStrength.RelativeStrength, shotStrength.RoughLandResistance);
28992 }
28993 }
28994 }
28996 {
28998 float num170 = proj.velocity.Length() / 16f;
28999 if (num170 > 1f)
29000 {
29001 num170 = 1f;
29002 }
29004 if (proj.oldPos[4] != Vector2.Zero)
29005 {
29007 for (float num171 = 0f; num171 <= 1f; num171 += 0.04f)
29008 {
29009 EntitySpriteDraw(value11, Vector2.Lerp(proj.oldPos[4], proj.position, num171) + proj.Size / 2f - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle4, golfTrailColor * num171, proj.rotation, origin6, proj.scale * MathHelper.Lerp(0.7f, 1.5f, num171), dir);
29010 }
29011 }
29012 EntitySpriteDraw(value11, proj.position + proj.Size / 2f - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle4, golfTrailColor, proj.rotation, origin6, proj.scale * 1.5f, dir);
29013 }
29014 }
29015 if (proj.type == 964 || proj.type == 965)
29016 {
29018 if (proj.type == 965)
29019 {
29021 }
29023 float num172 = ((proj.type == 964) ? 60 : 30);
29024 for (int num173 = 0; num173 < 4; num173++)
29025 {
29026 EntitySpriteDraw(value11, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY) + proj.rotation.ToRotationVector2().RotatedBy(proj.ai[0] / num172 * ((float)Math.PI * 2f) + (float)Math.PI / 2f * (float)num173) * 6f, rectangle4, color41, proj.rotation, origin6, proj.scale, dir);
29027 }
29028 }
29030 float num174 = proj.scale;
29031 float rotation23 = proj.rotation + num145;
29032 if (proj.type == 640)
29033 {
29035 }
29036 if (proj.type == 684)
29037 {
29038 color42.A = 127;
29039 }
29040 if (proj.type == 873)
29041 {
29042 color42.A /= 2;
29043 }
29044 if (proj.type == 931)
29045 {
29046 color42.A /= 2;
29047 }
29048 if (proj.type == 872)
29049 {
29050 color42 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * proj.Opacity;
29051 num174 *= 0.9f;
29052 }
29053 if (proj.type == 818)
29054 {
29056 }
29057 if (proj.type == 916)
29058 {
29060 }
29061 if (proj.type == 964 || proj.type == 965)
29062 {
29063 color42 = Microsoft.Xna.Framework.Color.Black * proj.Opacity;
29064 }
29065 if (proj.type == 933)
29066 {
29067 float t2 = proj.localAI[0];
29068 float num175 = Utils.GetLerpValue(0f, 20f, t2, clamped: true) * Utils.GetLerpValue(68f, 60f, t2, clamped: true);
29069 color42 *= num175;
29070 }
29072 if (proj.type == 894)
29073 {
29074 float num176 = Utils.WrappedLerp(0.6f, 1f, (float)((int)timeForVisualEffects % 70) / 70f);
29075 EntitySpriteDraw(color: new Microsoft.Xna.Framework.Color(num176, num176, num176, 150f), texture: TextureAssets.GlowMask[282].Value, position: proj.Center + zero - screenPosition + new Vector2(0f, proj.gfxOffY), sourceRectangle: rectangle4, rotation: proj.rotation, origin: origin6, scale: proj.scale, effects: dir);
29076 }
29077 if (proj.type == 503)
29078 {
29079 EntitySpriteDraw(TextureAssets.Extra[36].Value, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle4, Microsoft.Xna.Framework.Color.White, proj.localAI[0], origin6, proj.scale, dir);
29080 }
29081 else if (proj.type == 533)
29082 {
29083 EntitySpriteDraw(TextureAssets.GlowMask[128].Value, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle4, Microsoft.Xna.Framework.Color.White * 0.3f, proj.rotation, origin6, proj.scale, dir);
29084 }
29085 else if (proj.type == 261)
29086 {
29087 float num177 = 0.7f;
29088 float num178 = proj.velocity.Length();
29089 if (num178 < 0.3f && proj.velocity.Y == 0f)
29090 {
29091 num177 = Utils.GetLerpValue(0.02f, 0.3f, num178, clamped: true) * 0.7f;
29092 }
29093 EntitySpriteDraw(TextureAssets.GlowMask[252].Value, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle4, Microsoft.Xna.Framework.Color.White * num177, proj.rotation, origin6, proj.scale, dir);
29094 }
29095 else if (proj.type == 601)
29096 {
29098 white2.A = 0;
29099 EntitySpriteDraw(value11, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle4, white2, proj.rotation, origin6, proj.scale * 0.7f, dir);
29100 }
29102 {
29104 }
29105 if (proj.type == 933)
29106 {
29107 float t3 = proj.localAI[0];
29108 float num179 = Utils.GetLerpValue(0f, 20f, t3, clamped: true) * Utils.GetLerpValue(68f, 60f, t3, clamped: true);
29109 EntitySpriteDraw(value11, proj.Center + zero - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle4, new Microsoft.Xna.Framework.Color(255, 255, 255, 127) * proj.Opacity * num179, rotation23, origin6, num174 * 1.25f, dir);
29111 Microsoft.Xna.Framework.Color trailColor = finalFractalProfile.trailColor;
29112 trailColor.A /= 2;
29113 DrawPrettyStarSparkle(proj.Opacity, dir, proj.Center + zero - screenPosition + new Vector2(0f, proj.gfxOffY) + (proj.rotation - (float)Math.PI / 2f).ToRotationVector2() * finalFractalProfile.trailWidth, Microsoft.Xna.Framework.Color.White * num179, trailColor * num179, proj.localAI[0], 15f, 30f, 30f, 45f, 0f, new Vector2(5f, 2f), Vector2.One);
29114 }
29115 }
29116 else if (proj.type == 672)
29117 {
29118 Vector2 position5 = proj.Center - screenPosition;
29119 if (proj.localAI[1] == 0f)
29120 {
29121 position5.Y += 60f;
29122 float num180 = proj.localAI[0] / 120f;
29123 for (int num181 = 0; num181 < 4; num181++)
29124 {
29125 float value17 = num180 * 2f - (float)num181 / 3f;
29126 value17 = MathHelper.Clamp(value17, 0f, 1f);
29127 float num182 = 1f - MathHelper.Clamp((num180 - 0.8f) / 0.2f, 0f, 1f);
29128 EntitySpriteDraw(TextureAssets.MagicPixel.Value, position5, null, new Microsoft.Xna.Framework.Color(0.4f, 0.17f, 0.4f, 0f) * (value17 * num182) * 1.3f, 0f, new Vector2((float)TextureAssets.MagicPixel.Width() / 2f, TextureAssets.MagicPixel.Height()), new Vector2((float)Math.Sqrt(value17) * 100f, value17 * 2f), SpriteEffects.None);
29129 }
29130 }
29131 else if (proj.localAI[1] == 1f)
29132 {
29133 _ = proj.localAI[0] / 300f;
29134 float num183 = Math.Min(1f, proj.localAI[0] / 30f);
29135 int num184 = (int)(GlobalTimeWrappedHourly * 10f) % 8;
29137 DrawElderEye(spriteBatch, proj.Center, 1f, 1f, (num184 + 1) % 8, new Microsoft.Xna.Framework.Color(0.2f, 0.2f, 0.2f, 0f) * num183);
29138 }
29139 else if (proj.localAI[1] == 2f)
29140 {
29141 int num185 = (int)(GlobalTimeWrappedHourly * 10f) % 8;
29143 DrawElderEye(spriteBatch, proj.Center, 1f, 1f, (num185 + 1) % 8, new Microsoft.Xna.Framework.Color(0.2f, 0.2f, 0.2f, 0f));
29144 }
29145 }
29146 else
29147 {
29148 if (proj.type == 713)
29149 {
29150 return;
29151 }
29152 if (proj.type == 754)
29153 {
29156 rectangle5.Width -= 2;
29157 rectangle5.Height -= 2;
29158 Vector2 origin8 = new Vector2(rectangle5.Width / 2, 0f);
29159 float y13 = proj.position.Y;
29160 float num186 = proj.ai[0] + 8f + 2f - (float)rectangle5.Height + 2f;
29162 Vector2 top = proj.Top;
29163 if (proj.ai[1] == 2f)
29164 {
29165 rectangle5 = value18.Frame(5, 2, 4);
29166 rectangle5.Width -= 2;
29167 rectangle5.Height -= 2;
29168 origin8 = new Vector2(rectangle5.Width / 2, 0f);
29169 alpha2 = proj.GetAlpha(Lighting.GetColor((int)(top.X + (float)(rectangle5.Width / 2)) / 16, (int)((num186 - 2f + (float)(rectangle5.Height / 2)) / 16f)));
29170 EntitySpriteDraw(value18, new Vector2(top.X, num186 - 2f) - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle5, alpha2, proj.rotation, origin8, proj.scale, dir);
29171 return;
29172 }
29173 for (float num187 = y13; num187 < num186; num187 += (float)rectangle5.Height)
29174 {
29175 Vector2 vector33 = top;
29176 vector33.Y = num187;
29178 float num188 = num186 - num187;
29179 if (num188 < (float)value19.Height)
29180 {
29181 value19.Height = (int)num188;
29182 }
29183 alpha2 = proj.GetAlpha(Lighting.GetColor((int)(vector33.X + (float)(value19.Width / 2)) / 16, (int)((vector33.Y + (float)(value19.Height / 2)) / 16f)));
29184 EntitySpriteDraw(value18, vector33 - screenPosition + new Vector2(0f, proj.gfxOffY), value19, alpha2, proj.rotation, origin8, proj.scale, dir);
29185 if (rectangle5.Y == 0)
29186 {
29187 rectangle5.Y += rectangle5.Height + 2;
29188 }
29189 }
29190 rectangle5 = value18.Frame(5, 2, 4);
29191 rectangle5.Width -= 2;
29192 rectangle5.Height -= 2;
29193 origin8 = new Vector2(rectangle5.Width / 2, 0f);
29194 alpha2 = proj.GetAlpha(Lighting.GetColor((int)(top.X + (float)(rectangle5.Width / 2)) / 16, (int)((num186 - 2f + (float)(rectangle5.Height / 2)) / 16f)));
29195 EntitySpriteDraw(value18, new Vector2(top.X, num186 - 2f) - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle5, alpha2, proj.rotation, origin8, proj.scale, dir);
29196 return;
29197 }
29198 if (proj.type == 12 || proj.type == 728 || proj.type == 955)
29199 {
29202 Vector2 origin9 = rectangle6.Size() / 2f;
29206 Vector2 origin10 = new Vector2((float)value22.Width / 2f, 10f);
29207 Vector2 vector34 = new Vector2(0f, proj.gfxOffY);
29208 Vector2 spinningpoint = new Vector2(0f, -10f);
29209 float num189 = (float)timeForVisualEffects / 60f;
29210 Vector2 vector35 = proj.Center + proj.velocity;
29211 Microsoft.Xna.Framework.Color color44 = Microsoft.Xna.Framework.Color.Blue * 0.2f;
29212 Microsoft.Xna.Framework.Color color45 = Microsoft.Xna.Framework.Color.White * 0.5f;
29213 color45.A = 0;
29214 float num190 = 0f;
29216 {
29217 color44 = Microsoft.Xna.Framework.Color.HotPink * 0.3f;
29218 color45 = Microsoft.Xna.Framework.Color.White * 0.75f;
29219 color45.A = 0;
29220 num190 = -0.1f;
29221 }
29222 if (proj.type == 728)
29223 {
29224 color44 = Microsoft.Xna.Framework.Color.Orange * 0.2f;
29225 color45 = Microsoft.Xna.Framework.Color.Gold * 0.5f;
29226 color45.A = 50;
29227 num190 = -0.2f;
29228 }
29230 color46.A = 0;
29232 color47.A = 0;
29234 color48.A = 0;
29235 EntitySpriteDraw(value21, vector35 - screenPosition + vector34 + spinningpoint.RotatedBy((float)Math.PI * 2f * num189), value22, color46, proj.velocity.ToRotation() + (float)Math.PI / 2f, origin10, 1.5f + num190, SpriteEffects.None);
29236 EntitySpriteDraw(value21, vector35 - screenPosition + vector34 + spinningpoint.RotatedBy((float)Math.PI * 2f * num189 + (float)Math.PI * 2f / 3f), value22, color47, proj.velocity.ToRotation() + (float)Math.PI / 2f, origin10, 1.1f + num190, SpriteEffects.None);
29237 EntitySpriteDraw(value21, vector35 - screenPosition + vector34 + spinningpoint.RotatedBy((float)Math.PI * 2f * num189 + 4.1887903f), value22, color48, proj.velocity.ToRotation() + (float)Math.PI / 2f, origin10, 1.3f + num190, SpriteEffects.None);
29238 Vector2 vector36 = proj.Center - proj.velocity * 0.5f;
29239 for (float num191 = 0f; num191 < 1f; num191 += 0.5f)
29240 {
29241 float num192 = num189 % 0.5f / 0.5f;
29242 num192 = (num192 + num191) % 1f;
29243 float num193 = num192 * 2f;
29244 if (num193 > 1f)
29245 {
29246 num193 = 2f - num193;
29247 }
29248 EntitySpriteDraw(value21, vector36 - screenPosition + vector34, value22, color45 * num193, proj.velocity.ToRotation() + (float)Math.PI / 2f, origin10, 0.3f + num192 * 0.5f, SpriteEffects.None);
29249 }
29250 EntitySpriteDraw(value20, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle6, alpha3, proj.rotation, origin9, proj.scale + 0.1f, dir);
29251 return;
29252 }
29253 if (proj.type == 756)
29254 {
29256 Microsoft.Xna.Framework.Rectangle value24 = value23.Frame(1, 6, 0, proj.frame);
29257 Vector2 origin11 = new Vector2(16f, value24.Height / 2);
29259 Vector2 scale2 = new Vector2(proj.scale);
29260 float lerpValue4 = Utils.GetLerpValue(35f, 35f - 5f, proj.ai[0], clamped: true);
29261 scale2.Y *= lerpValue4;
29262 Vector4 vector37 = projectileColor.ToVector4();
29264 vector38 *= vector37;
29265 EntitySpriteDraw(TextureAssets.Extra[98].Value, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY) - proj.velocity * proj.scale * 0.5f, null, proj.GetAlpha(new Microsoft.Xna.Framework.Color(vector38.X, vector38.Y, vector38.Z, vector38.W)) * 1f, proj.rotation + (float)Math.PI / 2f, TextureAssets.Extra[98].Value.Size() / 2f, proj.scale * 0.9f, dir);
29266 EntitySpriteDraw(value23, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), value24, alpha4, proj.rotation, origin11, scale2, dir);
29267 return;
29268 }
29269 if (proj.type == 961)
29270 {
29272 Microsoft.Xna.Framework.Rectangle value26 = value25.Frame(1, 5, 0, proj.frame);
29273 Vector2 origin12 = new Vector2(16f, value26.Height / 2);
29275 Vector2 vector39 = new Vector2(proj.scale);
29276 float lerpValue5 = Utils.GetLerpValue(30f, 25f, proj.ai[0], clamped: true);
29277 vector39.Y *= lerpValue5;
29278 Vector4 vector40 = projectileColor.ToVector4();
29280 vector41 *= vector40;
29281 EntitySpriteDraw(TextureAssets.Extra[98].Value, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY) - proj.velocity * proj.scale * 0.5f, null, proj.GetAlpha(new Microsoft.Xna.Framework.Color(vector41.X, vector41.Y, vector41.Z, vector41.W)) * 1f, proj.rotation + (float)Math.PI / 2f, TextureAssets.Extra[98].Value.Size() / 2f, proj.scale * 0.9f, dir);
29282 Microsoft.Xna.Framework.Color color49 = proj.GetAlpha(Microsoft.Xna.Framework.Color.White) * Utils.Remap(proj.ai[0], 0f, 20f, 0.5f, 0f);
29283 color49.A = 0;
29284 for (int num194 = 0; num194 < 4; num194++)
29285 {
29286 EntitySpriteDraw(value25, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY) + proj.rotation.ToRotationVector2().RotatedBy((float)Math.PI / 2f * (float)num194) * 2f * vector39, value26, color49, proj.rotation, origin12, vector39, dir);
29287 }
29288 EntitySpriteDraw(value25, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), value26, alpha5, proj.rotation, origin12, vector39, dir);
29289 return;
29290 }
29291 if (proj.type == 723 || proj.type == 726 || proj.type == 725 || proj.type == 724 || proj.type == 9)
29292 {
29295 Vector2 origin13 = rectangle7.Size() / 2f;
29299 Vector2 origin14 = new Vector2((float)value29.Width / 2f, 10f);
29300 _ = Microsoft.Xna.Framework.Color.White * 0.2f;
29301 Vector2 vector42 = new Vector2(0f, proj.gfxOffY);
29302 Vector2 spinningpoint2 = new Vector2(0f, -5f);
29303 float num195 = (float)timeForVisualEffects / 60f;
29304 Vector2 vector43 = proj.Center + proj.velocity;
29305 float num196 = 1.5f;
29306 float num197 = 1.1f;
29307 float num198 = 1.3f;
29308 Microsoft.Xna.Framework.Color color51 = Microsoft.Xna.Framework.Color.Blue * 0.1f;
29309 Microsoft.Xna.Framework.Color color52 = Microsoft.Xna.Framework.Color.White * 0.3f;
29310 color52.A = 0;
29311 byte a = 0;
29312 float num199 = 1f;
29313 bool flag29 = true;
29314 float num200 = proj.scale + 0.1f;
29315 if (proj.type == 726)
29316 {
29318 color51 = color53 * 0.3f;
29319 color52 = color53 * 0.3f;
29320 a = 60;
29321 float num201 = 0.6f;
29322 num196 -= num201;
29323 num197 -= num201;
29324 num198 -= num201;
29325 }
29326 if (proj.type == 725)
29327 {
29332 a = 50;
29333 float num202 = 0.5f;
29334 num196 -= num202;
29335 num197 -= num202;
29336 num198 -= num202;
29337 }
29338 if (proj.type == 724)
29339 {
29342 Microsoft.Xna.Framework.Color value32 = Microsoft.Xna.Framework.Color.Orange * 0.75f;
29343 color54 = Microsoft.Xna.Framework.Color.Yellow * 0.5f;
29346 a = 0;
29347 float num203 = 0.5f;
29348 num196 -= num203;
29349 num197 -= num203;
29350 num198 -= num203;
29351 }
29352 if (proj.type == 9)
29353 {
29354 num196 = 0.9f;
29355 num197 = 0f;
29356 num198 = 0f;
29357 flag29 = false;
29359 vector42 += proj.velocity.SafeNormalize(Vector2.Zero) * 8f;
29360 num199 *= 0.75f;
29361 vector43 -= proj.velocity;
29363 value33 *= 0.75f;
29364 value33.A /= 2;
29366 value34.A /= 4;
29367 value34 *= 0.85f;
29368 value34 *= 0.75f;
29370 gold.A = 180;
29372 Microsoft.Xna.Framework.Color value36 = new Microsoft.Xna.Framework.Color(180, 20, 255) * 0.75f * 0.3f;
29373 Microsoft.Xna.Framework.Color value37 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.5f * 0.3f;
29374 float num204 = 0.5f;
29375 float num205 = proj.rotation * num204 % ((float)Math.PI * 2f);
29376 if (num205 < 0f)
29377 {
29378 num205 += (float)Math.PI * 2f;
29379 }
29380 num205 /= (float)Math.PI * 2f;
29381 float num206 = Utils.Remap(num205, 0.15f, 0.5f, 0f, 1f) * Utils.Remap(num205, 0.5f, 0.85f, 1f, 0f);
29382 num206 = 1f - num206;
29386 num200 += num206 * 0.2f;
29387 }
29391 if (flag29)
29392 {
29393 color55.A = a;
29394 color56.A = a;
29395 color57.A = a;
29396 }
29397 EntitySpriteDraw(value28, vector43 - screenPosition + vector42 + spinningpoint2.RotatedBy((float)Math.PI * 2f * num195), value29, color55, proj.velocity.ToRotation() + (float)Math.PI / 2f, origin14, num196, SpriteEffects.None);
29398 EntitySpriteDraw(value28, vector43 - screenPosition + vector42 + spinningpoint2.RotatedBy((float)Math.PI * 2f * num195 + (float)Math.PI * 2f / 3f), value29, color56, proj.velocity.ToRotation() + (float)Math.PI / 2f, origin14, num197, SpriteEffects.None);
29399 EntitySpriteDraw(value28, vector43 - screenPosition + vector42 + spinningpoint2.RotatedBy((float)Math.PI * 2f * num195 + 4.1887903f), value29, color57, proj.velocity.ToRotation() + (float)Math.PI / 2f, origin14, num198, SpriteEffects.None);
29400 Vector2 vector44 = proj.Center - proj.velocity * 0.5f;
29401 for (float num207 = 0f; num207 < 1f; num207 += 0.5f)
29402 {
29403 float num208 = num195 % 0.5f / 0.5f;
29404 num208 = (num208 + num207) % 1f;
29405 float num209 = num208 * 2f;
29406 if (num209 > 1f)
29407 {
29408 num209 = 2f - num209;
29409 }
29410 EntitySpriteDraw(value28, vector44 - screenPosition + vector42, value29, color52 * num209, proj.velocity.ToRotation() + (float)Math.PI / 2f, origin14, (0.5f + num208 * 0.5f) * num199, SpriteEffects.None);
29411 }
29412 EntitySpriteDraw(value27, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), rectangle7, color50, proj.rotation, origin13, num200, dir);
29413 return;
29414 }
29415 if (proj.type == 674)
29416 {
29418 Vector2 origin15 = new Vector2(66f, 86f);
29419 Vector2 position6 = proj.Center - screenPosition;
29421 one = new Vector2(4f, 1f) * 1.4f;
29424 float num210 = 0f;
29425 if (proj.ai[0] < 30f)
29426 {
29427 num210 = Utils.GetLerpValue(0f, 30f, proj.ai[0], clamped: true);
29428 }
29429 else if (proj.ai[0] < 40f)
29430 {
29431 num210 = 1f + Utils.GetLerpValue(30f, 40f, proj.ai[0], clamped: true);
29432 }
29433 Vector2 vector45 = new Vector2(1f, 1f);
29434 Vector2 vector46 = new Vector2(0.8f, 2f);
29435 if (num210 < 1f)
29436 {
29437 vector45.X *= num210;
29438 }
29439 one *= num210;
29440 if (num210 < 1f)
29441 {
29442 color58 *= num210;
29443 color59 *= num210;
29444 }
29445 if (num210 > 1.5f)
29446 {
29447 float lerpValue6 = Utils.GetLerpValue(2f, 1.5f, num210, clamped: true);
29450 }
29451 float num211 = 0.42f;
29452 color58 *= num211;
29453 color59 *= num211;
29456 EntitySpriteDraw(TextureAssets.Extra[59].Value, position6, null, color58, 0f, origin15, one * vector45 * new Vector2(1f, 0.3f), SpriteEffects.None);
29457 return;
29458 }
29459 if (proj.type == 440 || proj.type == 449 || proj.type == 606)
29460 {
29462 if (proj.getRect().Intersects(value39))
29463 {
29464 Vector2 vector47 = new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY);
29465 float num212 = 100f;
29466 float num213 = 3f;
29467 if (proj.type == 606)
29468 {
29469 num212 = 150f;
29470 num213 = 3f;
29471 }
29472 if (proj.ai[1] == 1f)
29473 {
29474 num212 = (int)proj.localAI[0];
29475 }
29476 for (int num214 = 1; num214 <= (int)proj.localAI[0]; num214++)
29477 {
29480 alpha6 *= (num212 - (float)num214) / num212;
29481 alpha6.A = 0;
29482 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, vector47 - vector48, null, alpha6, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
29483 }
29484 }
29485 return;
29486 }
29487 if (proj.type == 85)
29488 {
29490 return;
29491 }
29492 if (proj.type == 687)
29493 {
29494 Vector2 center2 = proj.Center;
29496 float num215 = 40f;
29497 float num216 = num215 * 2f;
29498 float num217 = (float)proj.frameCounter / num215;
29504 ulong seed = 1uL;
29505 for (float num218 = 0f; num218 < 15f; num218 += 1f)
29506 {
29507 float num219 = Utils.RandomFloat(ref seed) * 0.25f - 0.125f;
29508 Vector2 vector49 = (proj.rotation + num219).ToRotationVector2();
29509 Vector2 value41 = center2 + vector49 * 400f;
29510 float num220 = num217 + num218 * (1f / 15f);
29511 int num221 = (int)(num220 / (1f / 15f));
29512 num220 %= 1f;
29513 if ((!(num220 > num217 % 1f) || !((float)proj.frameCounter < num215)) && (!(num220 < num217 % 1f) || !((float)proj.frameCounter >= num216 - num215)))
29514 {
29515 transparent = ((num220 < 0.1f) ? Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color60, Utils.GetLerpValue(0f, 0.1f, num220, clamped: true)) : ((num220 < 0.35f) ? color60 : ((num220 < 0.7f) ? Microsoft.Xna.Framework.Color.Lerp(color60, color61, Utils.GetLerpValue(0.35f, 0.7f, num220, clamped: true)) : ((num220 < 0.9f) ? Microsoft.Xna.Framework.Color.Lerp(color61, color62, Utils.GetLerpValue(0.7f, 0.9f, num220, clamped: true)) : ((!(num220 < 1f)) ? Microsoft.Xna.Framework.Color.Transparent : Microsoft.Xna.Framework.Color.Lerp(color62, Microsoft.Xna.Framework.Color.Transparent, Utils.GetLerpValue(0.9f, 1f, num220, clamped: true)))))));
29516 float num222 = 0.9f + num220 * 0.8f;
29517 num222 *= num222;
29518 num222 *= 0.8f;
29520 Microsoft.Xna.Framework.Rectangle rectangle8 = value40.Frame(1, 7, 0, (int)(num220 * 7f));
29521 EntitySpriteDraw(value40, position7, rectangle8, transparent, proj.rotation + (float)Math.PI * 2f * (num220 + GlobalTimeWrappedHourly * 1.2f) * 0.2f + (float)num221 * ((float)Math.PI * 2f / 5f), rectangle8.Size() / 2f, num222, SpriteEffects.None);
29522 }
29523 }
29524 return;
29525 }
29526 if (proj.type == 651)
29527 {
29528 if (proj.owner != myPlayer)
29529 {
29530 return;
29531 }
29532 Player player3 = Main.player[proj.owner];
29533 Microsoft.Xna.Framework.Point point = new Vector2(proj.ai[0], proj.ai[1]).ToPoint();
29534 Microsoft.Xna.Framework.Point point2 = proj.Center.ToTileCoordinates();
29537 int num223 = 1;
29538 float num224 = 0f;
29540 bool flag30 = toolMode.HasFlag(WiresUI.Settings.MultiToolMode.Actuator);
29541 if (toolMode.HasFlag(WiresUI.Settings.MultiToolMode.Red))
29542 {
29543 num224 += 1f;
29545 }
29546 if (toolMode.HasFlag(WiresUI.Settings.MultiToolMode.Blue))
29547 {
29548 num224 += 1f;
29550 }
29551 if (toolMode.HasFlag(WiresUI.Settings.MultiToolMode.Green))
29552 {
29553 num224 += 1f;
29555 }
29556 if (toolMode.HasFlag(WiresUI.Settings.MultiToolMode.Yellow))
29557 {
29558 num224 += 1f;
29560 }
29561 if (toolMode.HasFlag(WiresUI.Settings.MultiToolMode.Cutter))
29562 {
29563 color63 = new Microsoft.Xna.Framework.Color(50, 50, 50, 255);
29564 }
29565 color64.A = 0;
29566 if (point == point2)
29567 {
29568 Vector2 position8 = point2.ToVector2() * 16f - screenPosition;
29570 if (flag30)
29571 {
29573 }
29575 value42.Y = 18;
29577 return;
29578 }
29579 if (point.X == point2.X)
29580 {
29581 int num225 = point2.Y - point.Y;
29582 int num226 = Math.Sign(num225);
29583 Vector2 position9 = point.ToVector2() * 16f - screenPosition;
29585 if (flag30)
29586 {
29588 }
29590 value43.Y = 18;
29592 for (int num227 = point.Y + num226; num227 != point2.Y; num227 += num226)
29593 {
29594 position9 = new Vector2(point.X * 16, num227 * 16) - screenPosition;
29595 value43.Y = 0;
29596 value43.X = 90;
29597 if (flag30)
29598 {
29600 }
29602 value43.Y = 18;
29604 }
29605 position9 = point2.ToVector2() * 16f - screenPosition;
29606 value43 = new Microsoft.Xna.Framework.Rectangle((num225 * num223 > 0) ? 18 : 72, 0, 16, 16);
29607 if (flag30)
29608 {
29610 }
29612 value43.Y = 18;
29614 return;
29615 }
29616 if (point.Y == point2.Y)
29617 {
29618 int num228 = point2.X - point.X;
29619 int num229 = Math.Sign(num228);
29620 Vector2 position10 = point.ToVector2() * 16f - screenPosition;
29622 if (flag30)
29623 {
29625 }
29627 value44.Y = 18;
29629 for (int num230 = point.X + num229; num230 != point2.X; num230 += num229)
29630 {
29631 position10 = new Vector2(num230 * 16, point.Y * 16) - screenPosition;
29632 value44.Y = 0;
29633 value44.X = 180;
29634 if (flag30)
29635 {
29637 }
29639 value44.Y = 18;
29641 }
29642 position10 = point2.ToVector2() * 16f - screenPosition;
29643 value44 = new Microsoft.Xna.Framework.Rectangle((num228 > 0) ? 144 : 36, 0, 16, 16);
29644 if (flag30)
29645 {
29647 }
29649 value44.Y = 18;
29651 return;
29652 }
29653 Math.Abs(point.X - point2.X);
29654 Math.Abs(point.Y - point2.Y);
29655 int num231 = Math.Sign(point2.X - point.X);
29656 int num232 = Math.Sign(point2.Y - point.Y);
29658 bool flag31 = false;
29659 bool flag32 = player3.direction == 1;
29660 int num233;
29661 int num234;
29662 int num235;
29663 if (flag32)
29664 {
29665 p.X = point.X;
29666 num233 = point.Y;
29667 num234 = point2.Y;
29668 num235 = num232;
29669 }
29670 else
29671 {
29672 p.Y = point.Y;
29673 num233 = point.X;
29674 num234 = point2.X;
29675 num235 = num231;
29676 }
29677 Vector2 position11 = point.ToVector2() * 16f - screenPosition;
29679 if (!flag32)
29680 {
29681 value45.X = ((num235 > 0) ? 36 : 144);
29682 }
29683 else
29684 {
29685 value45.X = ((num235 > 0) ? 72 : 18);
29686 }
29687 if (flag30)
29688 {
29690 }
29692 value45.Y = 18;
29694 for (int num236 = num233 + num235; num236 != num234; num236 += num235)
29695 {
29696 if (flag31)
29697 {
29698 break;
29699 }
29700 if (flag32)
29701 {
29702 p.Y = num236;
29703 }
29704 else
29705 {
29706 p.X = num236;
29707 }
29708 if (WorldGen.InWorld(p.X, p.Y, 1) && tile[p.X, p.Y] != null)
29709 {
29710 position11 = p.ToVector2() * 16f - screenPosition;
29711 value45.Y = 0;
29712 if (!flag32)
29713 {
29714 value45.X = 180;
29715 }
29716 else
29717 {
29718 value45.X = 90;
29719 }
29720 if (flag30)
29721 {
29723 }
29725 value45.Y = 18;
29727 }
29728 }
29729 if (flag32)
29730 {
29731 p.Y = point2.Y;
29732 num233 = point.X;
29733 num234 = point2.X;
29734 num235 = num231;
29735 }
29736 else
29737 {
29738 p.X = point2.X;
29739 num233 = point.Y;
29740 num234 = point2.Y;
29741 num235 = num232;
29742 }
29743 position11 = p.ToVector2() * 16f - screenPosition;
29744 value45 = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16);
29745 if (!flag32)
29746 {
29747 value45.X += ((num231 > 0) ? 144 : 36);
29748 value45.X += ((num232 * num223 > 0) ? 72 : 18);
29749 }
29750 else
29751 {
29752 value45.X += ((num231 > 0) ? 36 : 144);
29753 value45.X += ((num232 * num223 > 0) ? 18 : 72);
29754 }
29755 if (flag30)
29756 {
29758 }
29760 value45.Y = 18;
29762 for (int num237 = num233 + num235; num237 != num234; num237 += num235)
29763 {
29764 if (flag31)
29765 {
29766 break;
29767 }
29768 if (!flag32)
29769 {
29770 p.Y = num237;
29771 }
29772 else
29773 {
29774 p.X = num237;
29775 }
29776 if (WorldGen.InWorld(p.X, p.Y, 1) && tile[p.X, p.Y] != null)
29777 {
29778 position11 = p.ToVector2() * 16f - screenPosition;
29779 value45.Y = 0;
29780 if (!flag32)
29781 {
29782 value45.X = 90;
29783 }
29784 else
29785 {
29786 value45.X = 180;
29787 }
29788 if (flag30)
29789 {
29791 }
29793 value45.Y = 18;
29795 }
29796 }
29797 position11 = point2.ToVector2() * 16f - screenPosition;
29798 value45 = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16);
29799 if (!flag32)
29800 {
29801 value45.X += ((num232 * num223 > 0) ? 18 : 72);
29802 }
29803 else
29804 {
29805 value45.X += ((num231 > 0) ? 144 : 36);
29806 }
29807 if (flag30)
29808 {
29810 }
29812 value45.Y = 18;
29814 return;
29815 }
29816 if (proj.type == 586)
29817 {
29818 float num238 = 300f;
29819 if (proj.ai[0] >= 100f)
29820 {
29821 num238 = MathHelper.Lerp(300f, 600f, (proj.ai[0] - 100f) / 200f);
29822 }
29823 if (num238 > 600f)
29824 {
29825 num238 = 600f;
29826 }
29827 if (proj.ai[0] >= 500f)
29828 {
29829 num238 = MathHelper.Lerp(600f, 1200f, (proj.ai[0] - 500f) / 100f);
29830 }
29831 float rotation24 = proj.rotation;
29833 int num239 = (int)(proj.ai[0] / 6f);
29834 Vector2 spinningpoint3 = new Vector2(0f, 0f - num238);
29835 for (int num240 = 0; (float)num240 < 10f; num240++)
29836 {
29838 float num241 = rotation24 + (float)Math.PI / 5f * (float)num240;
29839 Vector2 vector50 = spinningpoint3.RotatedBy(num241) / 3f + proj.Center;
29840 Microsoft.Xna.Framework.Color alpha7 = proj.GetAlpha(Lighting.GetColor(vector50.ToTileCoordinates()));
29841 alpha7.A /= 2;
29843 }
29844 for (int num242 = 0; (float)num242 < 20f; num242++)
29845 {
29847 float num243 = 0f - rotation24 + (float)Math.PI / 10f * (float)num242;
29848 num243 *= 2f;
29849 Vector2 vector51 = spinningpoint3.RotatedBy(num243) + proj.Center;
29850 Microsoft.Xna.Framework.Color alpha7 = proj.GetAlpha(Lighting.GetColor(vector51.ToTileCoordinates()));
29851 alpha7.A /= 2;
29853 }
29854 return;
29855 }
29856 if (proj.type == 536 || proj.type == 607)
29857 {
29859 Vector2 position12 = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
29860 EntitySpriteDraw(scale: new Vector2(1f, proj.velocity.Length() / (float)value47.Height), texture: value47, position: position12, sourceRectangle: null, color: proj.GetAlpha(projectileColor), rotation: proj.rotation, origin: value47.Frame().Bottom(), effects: dir);
29861 return;
29862 }
29863 if (proj.type == 591)
29864 {
29866 Vector2 position13 = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
29867 Vector2 scale4 = new Vector2(1f, proj.velocity.Length() / (float)value48.Height);
29868 LoadNPC(139);
29869 Texture2D value49 = TextureAssets.Npc[139].Value;
29870 bool num244 = proj.velocity.X >= 0f;
29871 float rotation25 = proj.velocity.ToRotation() + (float)Math.PI;
29872 SpriteEffects effects3 = (num244 ? SpriteEffects.FlipVertically : SpriteEffects.None);
29873 float fromValue = 1f - proj.Opacity;
29874 float num245 = Utils.Remap(fromValue, 0f, 0.2f, 0f, 1f) * Utils.Remap(fromValue, 0.2f, 1f, 1f, 0f);
29879 Vector2 origin16 = rectangle11.Bottom();
29881 rectangle11 = value48.Frame(2, 1, 1);
29883 return;
29884 }
29885 if (proj.type == 688 || proj.type == 689 || proj.type == 690)
29886 {
29888 Vector2 position14 = proj.Top + Vector2.UnitY * proj.gfxOffY - screenPosition;
29890 Vector2 origin17 = rectangle12.Size() * new Vector2(0.5f, 0f);
29893 color68.A = 127;
29894 Texture2D texture2D2 = null;
29895 Texture2D texture2D3 = null;
29896 switch (proj.type)
29897 {
29898 case 688:
29899 texture2D2 = TextureAssets.GlowMask[228].Value;
29900 texture2D3 = TextureAssets.Extra[86].Value;
29901 break;
29902 case 689:
29903 texture2D2 = TextureAssets.GlowMask[229].Value;
29904 texture2D3 = TextureAssets.Extra[87].Value;
29905 break;
29906 case 690:
29907 texture2D2 = TextureAssets.GlowMask[230].Value;
29908 texture2D3 = TextureAssets.Extra[88].Value;
29909 break;
29910 }
29912 if (texture2D2 != null)
29913 {
29915 }
29916 if (texture2D3 != null)
29917 {
29918 Vector2 position15 = proj.Center + Vector2.UnitY * proj.gfxOffY - screenPosition;
29919 rectangle12 = texture2D3.Frame();
29920 origin17 = rectangle12.Size() * new Vector2(0.5f, 1f);
29921 origin17.Y -= 2f;
29923 }
29924 return;
29925 }
29926 if (proj.type == 694 || proj.type == 695 || proj.type == 696)
29927 {
29929 Vector2 position16 = proj.Bottom + Vector2.UnitY * proj.gfxOffY - screenPosition;
29931 Vector2 origin18 = rectangle13.Size() * new Vector2(0.5f, 1f);
29932 origin18.Y -= 8f;
29933 int type = proj.type;
29934 if ((uint)(type - 694) <= 1u)
29935 {
29936 origin18.X += 3f;
29937 }
29940 EntitySpriteDraw(value51, position16, rectangle13, color69 * 0.3f, proj.rotation, origin18, proj.scale * 1.1f, dir);
29941 return;
29942 }
29943 if (proj.type == 409)
29944 {
29946 int num246 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
29947 int y14 = num246 * proj.frame;
29948 int num247 = 10;
29949 int num248 = 2;
29950 float value53 = 0.5f;
29951 for (int num249 = 1; num249 < num247; num249 += num248)
29952 {
29953 _ = ref proj.oldPos[num249];
29955 newColor = proj.GetAlpha(newColor);
29956 newColor *= (float)(num247 - num249) / 15f;
29957 _ = proj.oldPos[num249] - screenPosition + new Vector2(num138 + (float)num137, (float)(proj.height / 2) + proj.gfxOffY);
29958 EntitySpriteDraw(value52, proj.oldPos[num249] + new Vector2(proj.width, proj.height) / 2f - screenPosition + new Vector2(0f, proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y14, value52.Width, num246), newColor, proj.rotation, new Vector2((float)value52.Width / 2f, (float)num246 / 2f), MathHelper.Lerp(proj.scale, value53, (float)num249 / 15f), dir);
29959 }
29960 EntitySpriteDraw(value52, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y14, value52.Width, num246), proj.GetAlpha(projectileColor), proj.rotation, new Vector2((float)value52.Width / 2f, (float)num246 / 2f), proj.scale, dir);
29961 return;
29962 }
29963 if (proj.type == 437)
29964 {
29966 int num250 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
29967 int y15 = num250 * proj.frame;
29968 int num251 = 10;
29969 int num252 = 2;
29970 float value55 = 0.2f;
29971 for (int num253 = 1; num253 < num251; num253 += num252)
29972 {
29973 _ = ref proj.oldPos[num253];
29975 newColor2 = proj.GetAlpha(newColor2);
29976 newColor2 *= (float)(num251 - num253) / 15f;
29977 _ = proj.oldPos[num253] - screenPosition + new Vector2(num138 + (float)num137, (float)(proj.height / 2) + proj.gfxOffY);
29978 EntitySpriteDraw(value54, proj.oldPos[num253] + new Vector2(proj.width, proj.height) / 2f - screenPosition + new Vector2(0f, proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y15, value54.Width, num250), newColor2, proj.rotation, new Vector2((float)value54.Width / 2f, (float)num250 / 2f), MathHelper.Lerp(proj.scale, value55, (float)num253 / 15f), dir);
29979 }
29980 EntitySpriteDraw(value54, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y15, value54.Width, num250), Microsoft.Xna.Framework.Color.White, proj.rotation, new Vector2((float)value54.Width / 2f, (float)num250 / 2f), proj.scale + 0.2f, dir);
29981 EntitySpriteDraw(value54, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y15, value54.Width, num250), proj.GetAlpha(Microsoft.Xna.Framework.Color.White), proj.rotation, new Vector2((float)value54.Width / 2f, (float)num250 / 2f), proj.scale + 0.2f, dir);
29982 return;
29983 }
29984 if (proj.type == 384 || proj.type == 386)
29985 {
29987 int num254 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
29988 int y16 = num254 * proj.frame;
29989 EntitySpriteDraw(value56, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y16, value56.Width, num254), proj.GetAlpha(projectileColor), proj.rotation, new Vector2((float)value56.Width / 2f, (float)num254 / 2f), proj.scale, dir);
29990 return;
29991 }
29992 if (proj.type == 439 || proj.type == 460 || proj.type == 600 || proj.type == 615 || proj.type == 630 || proj.type == 633 || proj.type == 705 || proj.type == 714)
29993 {
29995 if (Main.player[proj.owner].gravDir == -1f)
29996 {
29997 if (proj.type == 705)
29998 {
29999 dir |= SpriteEffects.FlipVertically;
30000 }
30001 if (proj.type == 615 || proj.type == 714)
30002 {
30003 if (Main.player[proj.owner].direction == 1)
30004 {
30005 dir = SpriteEffects.FlipVertically;
30006 }
30007 else if (Main.player[proj.owner].direction == -1)
30008 {
30009 dir = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
30010 }
30011 }
30012 else if (proj.type == 600 || proj.type == 439)
30013 {
30014 if (Main.player[proj.owner].direction == 1)
30015 {
30016 dir = SpriteEffects.FlipHorizontally;
30017 }
30018 else if (Main.player[proj.owner].direction == -1)
30019 {
30020 dir = SpriteEffects.None;
30021 }
30022 }
30023 }
30024 int num255 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
30025 int y17 = num255 * proj.frame;
30026 Vector2 vector52 = (proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition).Floor();
30027 float num256 = 1f;
30028 if (Main.player[proj.owner].shroomiteStealth && Main.player[proj.owner].inventory[Main.player[proj.owner].selectedItem].ranged)
30029 {
30030 float num257 = Main.player[proj.owner].stealth;
30031 if ((double)num257 < 0.03)
30032 {
30033 num257 = 0.03f;
30034 }
30035 _ = (1f + num257 * 10f) / 11f;
30037 num256 = num257;
30038 }
30039 if (Main.player[proj.owner].setVortex && Main.player[proj.owner].inventory[Main.player[proj.owner].selectedItem].ranged)
30040 {
30041 float num258 = Main.player[proj.owner].stealth;
30042 if ((double)num258 < 0.03)
30043 {
30044 num258 = 0.03f;
30045 }
30046 _ = (1f + num258 * 10f) / 11f;
30047 projectileColor = projectileColor.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0f, 0.12f, 0.16f, 0f), 1f - num258)));
30048 num256 = num258;
30049 }
30050 if (proj.type == 714)
30051 {
30052 y17 = 0;
30053 instance.LoadItem(3930);
30054 value57 = TextureAssets.Item[3930].Value;
30055 }
30056 EntitySpriteDraw(value57, vector52, new Microsoft.Xna.Framework.Rectangle(0, y17, value57.Width, num255), proj.GetAlpha(projectileColor), proj.rotation, new Vector2((float)value57.Width / 2f, (float)num255 / 2f), proj.scale, dir);
30057 if (proj.type == 439)
30058 {
30059 EntitySpriteDraw(TextureAssets.GlowMask[35].Value, vector52, new Microsoft.Xna.Framework.Rectangle(0, y17, value57.Width, num255), new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * num256, proj.rotation, new Vector2((float)value57.Width / 2f, (float)num255 / 2f), proj.scale, dir);
30060 }
30061 else if (proj.type == 714)
30062 {
30063 y17 = num255 * proj.frame;
30064 Microsoft.Xna.Framework.Color color70 = hslToRgb(proj.ai[0] / 90f % 1f, 1f, 0.5f);
30065 color70.A = 120;
30066 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, vector52, new Microsoft.Xna.Framework.Rectangle(0, y17, value57.Width, num255), color70 * num256, proj.rotation, new Vector2((float)value57.Width / 2f, (float)num255 / 2f), proj.scale, dir);
30067 }
30068 else if (proj.type == 615)
30069 {
30070 EntitySpriteDraw(TextureAssets.GlowMask[192].Value, vector52, new Microsoft.Xna.Framework.Rectangle(0, y17, value57.Width, num255), new Microsoft.Xna.Framework.Color(255, 255, 255, 127) * num256, proj.rotation, new Vector2((float)value57.Width / 2f, (float)num255 / 2f), proj.scale, dir);
30071 }
30072 else if (proj.type == 630)
30073 {
30074 EntitySpriteDraw(TextureAssets.GlowMask[200].Value, vector52, new Microsoft.Xna.Framework.Rectangle(0, y17, value57.Width, num255), new Microsoft.Xna.Framework.Color(255, 255, 255, 127) * num256, proj.rotation, new Vector2((float)value57.Width / 2f, (float)num255 / 2f), proj.scale, dir);
30075 if (proj.localAI[0] > 0f)
30076 {
30077 int frameY = 6 - (int)(proj.localAI[0] / 1f);
30078 value57 = TextureAssets.Extra[65].Value;
30079 EntitySpriteDraw(value57, vector52 + Vector2.Normalize(proj.velocity) * 2f, value57.Frame(1, 6, 0, frameY), new Microsoft.Xna.Framework.Color(255, 255, 255, 127) * num256, proj.rotation, new Vector2(dir.HasFlag(SpriteEffects.FlipHorizontally) ? value57.Width : 0, (float)num255 / 2f - 2f), proj.scale, dir);
30080 }
30081 }
30082 else if (proj.type == 600)
30083 {
30085 portalColor.A = 70;
30086 EntitySpriteDraw(TextureAssets.GlowMask[173].Value, vector52, new Microsoft.Xna.Framework.Rectangle(0, y17, value57.Width, num255), portalColor, proj.rotation, new Vector2((float)value57.Width / 2f, (float)num255 / 2f), proj.scale, dir);
30087 }
30088 else if (proj.type == 460)
30089 {
30090 if (Math.Abs(proj.rotation - (float)Math.PI / 2f) > (float)Math.PI / 2f)
30091 {
30092 dir |= SpriteEffects.FlipVertically;
30093 }
30094 EntitySpriteDraw(TextureAssets.GlowMask[102].Value, vector52, new Microsoft.Xna.Framework.Rectangle(0, y17, value57.Width, num255), new Microsoft.Xna.Framework.Color(255, 255, 255, 0), proj.rotation - (float)Math.PI / 2f, new Vector2((float)value57.Width / 2f, (float)num255 / 2f), proj.scale, dir);
30095 if (proj.ai[0] > 180f && Main.projectile[(int)proj.ai[1]].type == 461)
30096 {
30097 DrawProj((int)proj.ai[1]);
30098 }
30099 }
30100 else if (proj.type == 633)
30101 {
30102 float num259 = (float)Math.Cos((float)Math.PI * 2f * (proj.ai[0] / 30f)) * 2f + 2f;
30103 if (proj.ai[0] > 120f)
30104 {
30105 num259 = 4f;
30106 }
30107 for (float num260 = 0f; num260 < 4f; num260 += 1f)
30108 {
30109 EntitySpriteDraw(value57, vector52 + Vector2.UnitY.RotatedBy(num260 * ((float)Math.PI * 2f) / 4f) * num259, new Microsoft.Xna.Framework.Rectangle(0, y17, value57.Width, num255), proj.GetAlpha(projectileColor).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0)) * 0.03f, proj.rotation, new Vector2((float)value57.Width / 2f, (float)num255 / 2f), proj.scale, dir);
30110 }
30111 }
30112 return;
30113 }
30114 if (proj.type == 442)
30115 {
30117 int num261 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
30118 int y18 = num261 * proj.frame;
30119 Vector2 position17 = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
30120 EntitySpriteDraw(value58, position17, new Microsoft.Xna.Framework.Rectangle(0, y18, value58.Width, num261), proj.GetAlpha(projectileColor), proj.rotation, new Vector2((float)value58.Width / 2f, (float)num261 / 2f), proj.scale, dir);
30121 EntitySpriteDraw(TextureAssets.GlowMask[37].Value, position17, new Microsoft.Xna.Framework.Rectangle(0, y18, value58.Width, num261), new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * (1f - (float)proj.alpha / 255f), proj.rotation, new Vector2((float)value58.Width / 2f, (float)num261 / 2f), proj.scale, dir);
30122 return;
30123 }
30124 if (proj.type == 447)
30125 {
30128 int num262 = value59.Height / projFrames[proj.type];
30129 int y19 = num262 * proj.frame;
30130 int num263 = value60.Height / projFrames[proj.type];
30131 int num264 = num263 * proj.frame;
30133 Vector2 vector53 = proj.position + new Vector2(proj.width, 0f) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
30134 EntitySpriteDraw(TextureAssets.Extra[4].Value, vector53, value61, proj.GetAlpha(projectileColor), proj.rotation, new Vector2(value60.Width / 2, 0f), proj.scale, dir);
30135 int num265 = proj.height - num262 - 14;
30136 if (num265 < 0)
30137 {
30138 num265 = 0;
30139 }
30140 if (num265 > 0)
30141 {
30142 if (num264 == num263 * 3)
30143 {
30144 num264 = num263 * 2;
30145 }
30146 EntitySpriteDraw(TextureAssets.Extra[4].Value, vector53 + Vector2.UnitY * (num263 - 1), new Microsoft.Xna.Framework.Rectangle(0, num264 + num263 - 1, value60.Width, 1), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(value60.Width / 2, 0f), new Vector2(1f, num265), dir);
30147 }
30148 value61.Width = value59.Width;
30149 value61.Y = y19;
30150 EntitySpriteDraw(value59, vector53 + Vector2.UnitY * (num263 - 1 + num265), value61, proj.GetAlpha(projectileColor), proj.rotation, new Vector2((float)value59.Width / 2f, 0f), proj.scale, dir);
30151 return;
30152 }
30153 if (proj.type == 455)
30154 {
30155 if (proj.velocity == Vector2.Zero)
30156 {
30157 return;
30158 }
30162 float num266 = proj.localAI[1];
30163 Microsoft.Xna.Framework.Color color71 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f;
30164 EntitySpriteDraw(value62, proj.Center - screenPosition, null, color71, proj.rotation, value62.Size() / 2f, proj.scale, SpriteEffects.None);
30165 num266 -= (float)(value62.Height / 2 + value64.Height) * proj.scale;
30166 Vector2 center3 = proj.Center;
30167 center3 += proj.velocity * proj.scale * value62.Height / 2f;
30168 if (num266 > 0f)
30169 {
30170 float num267 = 0f;
30171 Microsoft.Xna.Framework.Rectangle value65 = new Microsoft.Xna.Framework.Rectangle(0, 16 * (proj.timeLeft / 3 % 5), value63.Width, 16);
30172 while (num267 + 1f < num266)
30173 {
30174 if (num266 - num267 < (float)value65.Height)
30175 {
30176 value65.Height = (int)(num266 - num267);
30177 }
30178 EntitySpriteDraw(value63, center3 - screenPosition, value65, color71, proj.rotation, new Vector2(value65.Width / 2, 0f), proj.scale, SpriteEffects.None);
30179 num267 += (float)value65.Height * proj.scale;
30180 center3 += proj.velocity * value65.Height * proj.scale;
30181 value65.Y += 16;
30182 if (value65.Y + value65.Height > value63.Height)
30183 {
30184 value65.Y = 0;
30185 }
30186 }
30187 }
30188 EntitySpriteDraw(value64, center3 - screenPosition, null, color71, proj.rotation, value64.Frame().Top(), proj.scale, SpriteEffects.None);
30189 return;
30190 }
30191 if (proj.type == 461)
30192 {
30193 if (proj.velocity == Vector2.Zero)
30194 {
30195 return;
30196 }
30198 float num268 = proj.localAI[1];
30199 Microsoft.Xna.Framework.Color color72 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f;
30201 Vector2 vector54 = new Vector2(0f, Main.player[proj.owner].gfxOffY);
30202 EntitySpriteDraw(value66, proj.Center.Floor() - screenPosition + vector54, rectangle14, color72, proj.rotation, rectangle14.Size() / 2f, proj.scale, SpriteEffects.None);
30203 num268 -= 33f * proj.scale;
30204 Vector2 vector55 = proj.Center.Floor();
30205 vector55 += proj.velocity * proj.scale * 10.5f;
30206 rectangle14 = new Microsoft.Xna.Framework.Rectangle(0, 25, value66.Width, 28);
30207 if (num268 > 0f)
30208 {
30209 float num269 = 0f;
30210 while (num269 + 1f < num268)
30211 {
30212 if (num268 - num269 < (float)rectangle14.Height)
30213 {
30214 rectangle14.Height = (int)(num268 - num269);
30215 }
30217 num269 += (float)rectangle14.Height * proj.scale;
30218 vector55 += proj.velocity * rectangle14.Height * proj.scale;
30219 }
30220 }
30221 EntitySpriteDraw(sourceRectangle: new Microsoft.Xna.Framework.Rectangle(0, 56, value66.Width, 22), texture: value66, position: vector55 - screenPosition + vector54, color: color72, rotation: proj.rotation, origin: value66.Frame().Top(), scale: proj.scale, effects: SpriteEffects.None);
30222 return;
30223 }
30224 if (proj.type == 632)
30225 {
30226 if (!(proj.velocity == Vector2.Zero))
30227 {
30229 float num270 = proj.localAI[1];
30230 float laserLuminance = 0.5f;
30231 float laserAlphaMultiplier = 0f;
30233 color73.A = (byte)((float)(int)color73.A * laserAlphaMultiplier);
30234 Vector2 vector56 = proj.Center.Floor();
30235 vector56 += proj.velocity * proj.scale * 10.5f;
30236 num270 -= proj.scale * 14.5f * proj.scale;
30237 Vector2 vector57 = new Vector2(proj.scale);
30238 DelegateMethods.f_1 = 1f;
30239 DelegateMethods.c_1 = color73 * 0.75f * proj.Opacity;
30240 _ = proj.oldPos[0] + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
30242 DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 255, 255, 127) * 0.75f * proj.Opacity;
30244 }
30245 return;
30246 }
30247 if (proj.type == 642)
30248 {
30249 if (!(proj.velocity == Vector2.Zero))
30250 {
30252 float num271 = proj.localAI[1];
30253 Microsoft.Xna.Framework.Color c_ = new Microsoft.Xna.Framework.Color(255, 255, 255, 127);
30254 Vector2 vector58 = proj.Center.Floor();
30255 num271 -= proj.scale * 10.5f;
30256 Vector2 vector59 = new Vector2(proj.scale);
30257 DelegateMethods.f_1 = 1f;
30258 DelegateMethods.c_1 = c_;
30259 DelegateMethods.i_1 = 54000 - (int)time / 2;
30260 _ = proj.oldPos[0] + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
30262 DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 255, 255, 127) * 0.75f * proj.Opacity;
30264 }
30265 return;
30266 }
30267 if (proj.type == 611)
30268 {
30269 _ = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
30272 if (proj.velocity == Vector2.Zero)
30273 {
30274 return;
30275 }
30276 float num272 = proj.velocity.Length() + 16f;
30277 bool flag33 = num272 < 100f;
30280 Vector2 vector61 = new Vector2(0f, Main.player[proj.owner].gfxOffY);
30281 float rotation26 = proj.rotation + (float)Math.PI;
30283 num272 -= 40f * proj.scale;
30284 Vector2 vector62 = proj.Center.Floor();
30285 vector62 += vector60 * proj.scale * 24f;
30286 rectangle15 = new Microsoft.Xna.Framework.Rectangle(0, 68, value69.Width, 18);
30287 if (num272 > 0f)
30288 {
30289 float num273 = 0f;
30290 while (num273 + 1f < num272)
30291 {
30292 if (num272 - num273 < (float)rectangle15.Height)
30293 {
30294 rectangle15.Height = (int)(num272 - num273);
30295 }
30297 num273 += (float)rectangle15.Height * proj.scale;
30298 vector62 += vector60 * rectangle15.Height * proj.scale;
30299 }
30300 }
30302 vector62 = proj.Center.Floor();
30303 vector62 += vector60 * proj.scale * 24f;
30304 rectangle15 = new Microsoft.Xna.Framework.Rectangle(0, 46, value69.Width, 18);
30305 int num274 = 18;
30306 if (flag33)
30307 {
30308 num274 = 9;
30309 }
30310 float num275 = num272;
30311 if (num272 > 0f)
30312 {
30313 float num276 = 0f;
30314 float num277 = num275 / (float)num274;
30315 num276 += num277 * 0.25f;
30316 vector62 += vector60 * num277 * 0.25f;
30317 for (int num278 = 0; num278 < num274; num278++)
30318 {
30319 float num279 = num277;
30320 if (num278 == 0)
30321 {
30322 num279 *= 0.75f;
30323 }
30325 num276 += num279;
30327 }
30328 }
30329 EntitySpriteDraw(sourceRectangle: new Microsoft.Xna.Framework.Rectangle(0, 90, value69.Width, 48), texture: value69, position: vector63 - screenPosition + vector61, color: alpha8, rotation: rotation26, origin: value69.Frame().Top(), scale: proj.scale, effects: SpriteEffects.None);
30330 return;
30331 }
30332 if (proj.type == 537)
30333 {
30334 if (proj.velocity == Vector2.Zero)
30335 {
30336 return;
30337 }
30339 float num280 = proj.localAI[1];
30340 float fromValue2 = Utils.Remap(proj.localAI[0], 20f, 30f, 0f, 1f) * Utils.Remap(proj.localAI[0], 60f, 90f, 1f, 0f);
30341 float toMax = 1.5f;
30342 float num281 = Utils.Remap(fromValue2, 0f, 1f, 0.25f, toMax);
30343 Microsoft.Xna.Framework.Color color74 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.9f;
30345 Vector2 vector64 = new Vector2(0f, npc[(int)proj.ai[1]].gfxOffY);
30346 EntitySpriteDraw(value70, proj.Center.Floor() - screenPosition + vector64, rectangle16, color74, proj.rotation, rectangle16.Size() / 2f, num281, SpriteEffects.None);
30347 num280 -= 33f * proj.scale;
30348 Vector2 vector65 = proj.Center.Floor();
30349 vector65 += proj.velocity * num281 * 10.5f;
30350 rectangle16 = new Microsoft.Xna.Framework.Rectangle(0, 25, value70.Width, 28);
30351 if (num280 > 0f)
30352 {
30353 float num282 = 0f;
30354 while (num282 + 1f < num280)
30355 {
30356 if (num280 - num282 < (float)rectangle16.Height)
30357 {
30358 rectangle16.Height = (int)(num280 - num282);
30359 }
30361 num282 += (float)rectangle16.Height * num281;
30362 vector65 += proj.velocity * rectangle16.Height * num281;
30363 }
30364 }
30365 EntitySpriteDraw(sourceRectangle: new Microsoft.Xna.Framework.Rectangle(0, 56, value70.Width, 22), texture: value70, position: vector65 - screenPosition + vector64, color: color74, rotation: proj.rotation, origin: value70.Frame().Top(), scale: num281, effects: SpriteEffects.None);
30366 return;
30367 }
30368 if (proj.type == 456)
30369 {
30373 Vector2 vector66 = new Vector2(0f, 216f);
30374 Vector2 value74 = npc[(int)Math.Abs(proj.ai[0]) - 1].Center - proj.Center + vector66;
30375 float num283 = value74.Length();
30378 rectangle17.Height /= 4;
30379 rectangle17.Y += proj.frame * rectangle17.Height;
30380 EntitySpriteDraw(color: proj.GetAlpha(Microsoft.Xna.Framework.Color.Lerp(projectileColor, Microsoft.Xna.Framework.Color.White, 0.3f)), texture: value71, position: proj.Center - screenPosition, sourceRectangle: rectangle17, rotation: proj.rotation, origin: rectangle17.Size() / 2f, scale: proj.scale, effects: SpriteEffects.None);
30381 num283 -= (float)(rectangle17.Height / 2 + value73.Height) * proj.scale;
30382 Vector2 center4 = proj.Center;
30383 center4 += vector67 * proj.scale * rectangle17.Height / 2f;
30384 if (num283 > 0f)
30385 {
30386 float num284 = 0f;
30388 while (num284 + 1f < num283)
30389 {
30390 if (num283 - num284 < (float)rectangle18.Height)
30391 {
30392 rectangle18.Height = (int)(num283 - num284);
30393 }
30394 Microsoft.Xna.Framework.Point point3 = center4.ToTileCoordinates();
30397 EntitySpriteDraw(value72, center4 - screenPosition, rectangle18, proj.GetAlpha(color75), proj.rotation, rectangle18.Bottom(), proj.scale, SpriteEffects.None);
30398 num284 += (float)rectangle18.Height * proj.scale;
30399 center4 += vector67 * rectangle18.Height * proj.scale;
30400 }
30401 }
30402 Microsoft.Xna.Framework.Point point4 = center4.ToTileCoordinates();
30406 if (num283 < 0f)
30407 {
30408 value75.Height += (int)num283;
30409 }
30410 EntitySpriteDraw(value73, center4 - screenPosition, value75, color76, proj.rotation, new Vector2((float)value75.Width / 2f, value75.Height), proj.scale, SpriteEffects.None);
30411 return;
30412 }
30413 if (proj.type == 443)
30414 {
30416 float num285 = 30f;
30417 float num286 = num285 * 4f;
30418 float num287 = (float)Math.PI * 2f * proj.ai[0] / num285;
30419 float num288 = (float)Math.PI * 2f * proj.ai[0] / num286;
30420 Vector2 vector68 = -Vector2.UnitY.RotatedBy(num287);
30421 float scale5 = 0.75f + vector68.Y * 0.25f;
30422 float scale6 = 0.8f - vector68.Y * 0.2f;
30423 int num289 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
30424 int y20 = num289 * proj.frame;
30425 Vector2 position18 = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
30426 EntitySpriteDraw(value76, position18, new Microsoft.Xna.Framework.Rectangle(0, y20, value76.Width, num289), proj.GetAlpha(projectileColor), proj.rotation + num288, new Vector2((float)value76.Width / 2f, (float)num289 / 2f), scale5, dir);
30427 EntitySpriteDraw(value76, position18, new Microsoft.Xna.Framework.Rectangle(0, y20, value76.Width, num289), proj.GetAlpha(projectileColor), proj.rotation + ((float)Math.PI * 2f - num288), new Vector2((float)value76.Width / 2f, (float)num289 / 2f), scale6, dir);
30428 return;
30429 }
30430 if (proj.type == 656 || proj.type == 657)
30431 {
30432 float num290 = 900f;
30433 if (proj.type == 657)
30434 {
30435 num290 = 300f;
30436 }
30437 float num291 = 15f;
30438 float num292 = 15f;
30439 float num293 = proj.ai[0];
30440 float num294 = MathHelper.Clamp(num293 / 30f, 0f, 1f);
30441 if (num293 > num290 - 60f)
30442 {
30443 num294 = MathHelper.Lerp(1f, 0f, (num293 - (num290 - 60f)) / 60f);
30444 }
30445 Microsoft.Xna.Framework.Point point5 = proj.Center.ToTileCoordinates();
30447 topY++;
30448 bottomY--;
30449 float num295 = 0.2f;
30450 Vector2 value77 = new Vector2(point5.X, topY) * 16f + new Vector2(8f);
30451 Vector2 value78 = new Vector2(point5.X, bottomY) * 16f + new Vector2(8f);
30452 Vector2.Lerp(value77, value78, 0.5f);
30453 Vector2 vector69 = new Vector2(0f, value78.Y - value77.Y);
30454 vector69.X = vector69.Y * num295;
30455 new Vector2(value77.X - vector69.X / 2f, value77.Y);
30458 Vector2 origin19 = rectangle19.Size() / 2f;
30459 float num296 = -(float)Math.PI / 50f * num293;
30460 Vector2 spinningpoint4 = Vector2.UnitY.RotatedBy(num293 * 0.1f);
30461 float num297 = 0f;
30462 float num298 = 5.1f;
30464 for (float num299 = (int)value78.Y; num299 > (float)(int)value77.Y; num299 -= num298)
30465 {
30466 num297 += num298;
30467 float num300 = num297 / vector69.Y;
30468 float num301 = num297 * ((float)Math.PI * 2f) / -20f;
30469 float num302 = num300 - 0.15f;
30471 Vector2 vector70 = new Vector2(0f, num300 + 1f);
30472 vector70.X = vector70.Y * num295;
30474 if (num300 > 0.5f)
30475 {
30477 }
30478 color77.A = (byte)((float)(int)color77.A * 0.5f);
30479 color77 *= num294;
30480 position19 *= vector70 * 100f;
30481 position19.Y = 0f;
30482 position19.X = 0f;
30485 }
30486 return;
30487 }
30488 if (proj.type == 704)
30489 {
30490 float num303 = 300f;
30491 float num304 = proj.ai[0];
30492 float num305 = MathHelper.Clamp(num304 / 30f, 0f, 1f);
30493 if (num304 > num303 - 60f)
30494 {
30495 num305 = MathHelper.Lerp(1f, 0f, (num304 - (num303 - 60f)) / 60f);
30496 }
30497 float num306 = 0.2f;
30498 Vector2 top2 = proj.Top;
30499 Vector2 bottom = proj.Bottom;
30500 Vector2.Lerp(top2, bottom, 0.5f);
30501 Vector2 vector71 = new Vector2(0f, bottom.Y - top2.Y);
30502 vector71.X = vector71.Y * num306;
30503 new Vector2(top2.X - vector71.X / 2f, top2.Y);
30506 Vector2 origin20 = rectangle20.Size() / 2f;
30507 float num307 = -(float)Math.PI / 20f * num304 * (float)((!(proj.velocity.X > 0f)) ? 1 : (-1));
30508 SpriteEffects effects4 = ((proj.velocity.X > 0f) ? SpriteEffects.FlipVertically : SpriteEffects.None);
30509 bool flag34 = proj.velocity.X > 0f;
30510 Vector2 spinningpoint5 = Vector2.UnitY.RotatedBy(num304 * 0.14f);
30511 float num308 = 0f;
30512 float num309 = 5.01f + num304 / 150f * -0.9f;
30513 if (num309 < 4.11f)
30514 {
30515 num309 = 4.11f;
30516 }
30519 float num310 = num304 % 60f;
30520 if (num310 < 30f)
30521 {
30522 color78 *= Utils.GetLerpValue(22f, 30f, num310, clamped: true);
30523 }
30524 else
30525 {
30526 color78 *= Utils.GetLerpValue(38f, 30f, num310, clamped: true);
30527 }
30529 for (float num311 = (int)bottom.Y; num311 > (float)(int)top2.Y; num311 -= num309)
30530 {
30531 num308 += num309;
30532 float num312 = num308 / vector71.Y;
30533 float num313 = num308 * ((float)Math.PI * 2f) / -20f;
30534 if (flag34)
30535 {
30536 num313 *= -1f;
30537 }
30538 float num314 = num312 - 0.35f;
30540 Vector2 vector72 = new Vector2(0f, num312 + 1f);
30541 vector72.X = vector72.Y * num306;
30543 if (num312 > 0.5f)
30544 {
30546 }
30547 color79.A = (byte)((float)(int)color79.A * 0.5f);
30548 color79 *= num305;
30549 position20 *= vector72 * 100f;
30550 position20.Y = 0f;
30551 position20.X = 0f;
30552 position20 += new Vector2(bottom.X, num311) - screenPosition;
30553 if (flag35)
30554 {
30556 if (num312 > 0.5f)
30557 {
30559 }
30560 color80.A = (byte)((float)(int)color80.A * 0.5f);
30561 color80 *= num305;
30563 }
30565 }
30566 return;
30567 }
30568 if (proj.type == 444 || proj.type == 446 || proj.type == 490 || proj.type == 464 || proj.type == 502 || proj.type == 538 || proj.type == 540 || proj.type == 579 || proj.type == 578 || proj.type == 813 || proj.type == 583 || proj.type == 584 || proj.type == 616 || proj.type == 617 || proj.type == 618 || proj.type == 641 || (proj.type >= 646 && proj.type <= 649) || proj.type == 653 || proj.type == 186 || proj.type == 662 || proj.type == 685 || proj.type == 673 || proj.type == 676 || proj.type == 697 || proj.type == 699 || proj.type == 707 || proj.type == 708 || proj.type == 719 || proj.type == 761 || proj.type == 762 || proj.type == 763 || proj.type == 772 || proj.type == 802 || proj.type == 842 || proj.type == 865 || proj.type == 921 || proj.type == 926 || proj.type == 757 || proj.type == 25 || proj.type == 35 || proj.type == 63 || proj.type == 154 || proj.type == 247 || proj.type == 26 || proj.type == 928 || proj.type == 16 || proj.type == 34 || proj.type == 79 || proj.type == 936 || proj.type == 937 || proj.type == 938 || proj.type == 939 || proj.type == 940 || proj.type == 941 || proj.type == 942 || proj.type == 943 || proj.type == 944 || proj.type == 945 || proj.type == 971 || proj.type == 975 || proj.type == 1000 || proj.type == 1012 || proj.type == 1018 || proj.type == 1020 || (((proj.type >= 776 && proj.type <= 801) || (proj.type >= 803 && proj.type <= 810)) && proj.type != 779 && proj.type != 783 && proj.type != 862 && proj.type != 863))
30569 {
30570 Vector2 vector73 = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
30573 Vector2 origin21 = new Vector2(value83.Width, value83.Height) / 2f;
30574 float num315 = proj.rotation;
30575 Vector2 vector74 = Vector2.One * proj.scale;
30577 if (proj.type == 446)
30578 {
30579 origin21.Y = 4f;
30580 }
30581 if (proj.type == 1020)
30582 {
30583 origin21.Y = 14f;
30584 }
30585 if (proj.type == 865)
30586 {
30587 vector73 += new Vector2(1f, -1f);
30588 dir = ((proj.DirectionFrom(Main.player[proj.owner].Center).SafeNormalize(Vector2.Zero).X > 0f) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
30589 }
30590 if (proj.type == 16)
30591 {
30592 float lerpValue7 = Utils.GetLerpValue(0f, 8f, proj.velocity.Length(), clamped: true);
30593 num315 *= lerpValue7;
30594 vector74 *= 0.6f;
30595 vector74.Y *= MathHelper.Lerp(1f, 0.8f, lerpValue7);
30596 vector74.X *= MathHelper.Lerp(1f, 1.5f, lerpValue7);
30597 }
30598 if (proj.type == 34)
30599 {
30600 float lerpValue8 = Utils.GetLerpValue(0f, 8f, proj.velocity.Length(), clamped: true);
30601 num315 *= lerpValue8;
30602 vector74.X *= MathHelper.Lerp(1f, 0.8f, lerpValue8);
30603 num315 += -(float)Math.PI / 2f * lerpValue8;
30604 sourceRectangle5 = value83.Frame(1, projFrames[proj.type], 0, proj.frame);
30605 origin21 = sourceRectangle5.Value.Size() / 2f;
30606 vector73 -= proj.velocity * 1f;
30607 vector73 = proj.oldPos[0] + proj.Size / 2f - screenPosition - proj.velocity / 2f;
30608 }
30609 if (proj.type == 79)
30610 {
30611 num315 = 0f;
30612 vector74 *= Utils.GetLerpValue(32f, 0f, proj.position.Distance(proj.oldPos[12]), clamped: true);
30613 color81 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0);
30614 }
30615 if (proj.type == 761 || proj.type == 762)
30616 {
30617 dir = ((proj.spriteDirection <= 0) ? SpriteEffects.FlipVertically : SpriteEffects.None);
30618 }
30619 if (proj.type == 662 || proj.type == 685)
30620 {
30621 origin21 = new Vector2(6f, 6f);
30622 }
30623 if (proj.type == 699 || proj.type == 708)
30624 {
30625 Player player4 = Main.player[proj.owner];
30626 origin21 = new Vector2((proj.spriteDirection == 1) ? ((float)value83.Width - -8f) : (-8f), (player4.gravDir == 1f) ? (-8f) : ((float)value83.Height - -8f));
30627 if (player4.gravDir == -1f)
30628 {
30629 dir |= SpriteEffects.FlipVertically;
30630 num315 += (float)Math.PI / 2f * (float)(-proj.spriteDirection);
30631 }
30632 }
30633 if (proj.type == 938 || proj.type == 939 || proj.type == 940 || proj.type == 941 || proj.type == 942 || proj.type == 943 || proj.type == 944 || proj.type == 945)
30634 {
30635 num315 -= (float)Math.PI / 4f * (float)proj.spriteDirection;
30636 }
30637 if (proj.type == 502)
30638 {
30639 LoadProjectile(250);
30641 Vector2 origin22 = new Vector2(value84.Width / 2, 0f);
30642 Vector2 vector75 = new Vector2(proj.width, proj.height) / 2f;
30644 white3.A = 127;
30645 for (int num316 = proj.oldPos.Length - 1; num316 > 0; num316--)
30646 {
30647 Vector2 vector76 = proj.oldPos[num316] + vector75;
30648 if (!(vector76 == vector75))
30649 {
30650 Vector2 vector77 = proj.oldPos[num316 - 1] + vector75;
30651 float rotation27 = (vector77 - vector76).ToRotation() - (float)Math.PI / 2f;
30652 Vector2 scale7 = new Vector2(1f, Vector2.Distance(vector76, vector77) / (float)value84.Height);
30653 Microsoft.Xna.Framework.Color color82 = white3 * (1f - (float)num316 / (float)proj.oldPos.Length);
30655 }
30656 }
30657 }
30658 else if (proj.type == 540 && proj.velocity != Vector2.Zero)
30659 {
30660 float num317 = 0f;
30661 if (proj.ai[0] >= 10f)
30662 {
30663 num317 = (proj.ai[0] - 10f) / 10f;
30664 }
30665 if (proj.ai[0] >= 20f)
30666 {
30667 num317 = (20f - proj.ai[0]) / 10f;
30668 }
30669 if (num317 > 1f)
30670 {
30671 num317 = 1f;
30672 }
30673 if (num317 < 0f)
30674 {
30675 num317 = 0f;
30676 }
30677 if (num317 != 0f)
30678 {
30680 Vector2 origin23 = new Vector2(value85.Width / 2, 0f);
30682 Vector2 position21 = proj.Center - screenPosition;
30683 Vector2 vector78 = proj.velocity.ToRotation().ToRotationVector2() * value83.Width / 3f;
30686 float rotation28 = proj.velocity.ToRotation() - (float)Math.PI / 2f;
30687 Vector2 scale8 = new Vector2(1f, (proj.velocity.Length() - vector78.Length() * 2f) / (float)value85.Height);
30689 }
30690 }
30691 if (proj.type == 578 || proj.type == 579 || proj.type == 641 || proj.type == 813)
30692 {
30694 color84.A /= 2;
30696 color85.A = color81.A;
30697 float num318 = 0.95f + (proj.rotation * 0.75f).ToRotationVector2().Y * 0.1f;
30698 color85 *= num318;
30699 float scale9 = 0.6f + proj.scale * 0.6f * num318;
30701 bool flag36 = true;
30702 if (proj.type == 813)
30703 {
30704 flag36 = false;
30705 value86 = TextureAssets.Extra[131].Value;
30706 }
30707 Vector2 origin24 = value86.Size() / 2f;
30708 EntitySpriteDraw(value86, vector73, null, color85, 0f - num315 + 0.35f, origin24, scale9, dir ^ SpriteEffects.FlipHorizontally);
30709 EntitySpriteDraw(value86, vector73, null, color81, 0f - num315, origin24, proj.scale, dir ^ SpriteEffects.FlipHorizontally);
30710 if (flag36)
30711 {
30712 EntitySpriteDraw(value83, vector73, null, color84, (0f - num315) * 0.7f, origin21, proj.scale, dir ^ SpriteEffects.FlipHorizontally);
30713 }
30714 EntitySpriteDraw(value86, vector73, null, color81 * 0.8f, num315 * 0.5f, origin24, proj.scale * 0.9f, dir);
30715 color81.A = 0;
30716 if (proj.type == 813)
30717 {
30718 num315 = 0f;
30719 }
30720 }
30721 if (proj.type == 617)
30722 {
30724 color86.A /= 2;
30726 color87.A = color81.A;
30727 float num319 = 0.95f + (proj.rotation * 0.75f).ToRotationVector2().Y * 0.1f;
30728 color87 *= num319;
30729 float scale10 = 0.6f + proj.scale * 0.6f * num319;
30730 EntitySpriteDraw(TextureAssets.Extra[50].Value, vector73, null, color87, 0f - proj.rotation + 0.35f, origin21, scale10, dir ^ SpriteEffects.FlipHorizontally);
30731 EntitySpriteDraw(TextureAssets.Extra[50].Value, vector73, null, color81, 0f - proj.rotation, origin21, proj.scale, dir ^ SpriteEffects.FlipHorizontally);
30732 EntitySpriteDraw(value83, vector73, null, color86, (0f - proj.rotation) * 0.7f, origin21, proj.scale, dir ^ SpriteEffects.FlipHorizontally);
30733 EntitySpriteDraw(TextureAssets.Extra[50].Value, vector73, null, color81 * 0.8f, proj.rotation * 0.5f, origin21, proj.scale * 0.9f, dir);
30734 color81.A = 0;
30735 }
30736 if (proj.type == 757 || proj.type == 25 || proj.type == 35 || proj.type == 63 || proj.type == 154 || proj.type == 247 || proj.type == 26)
30737 {
30738 if (proj.ai[0] == 1f)
30739 {
30741 color88.A = 127;
30742 color88 *= 0.5f;
30743 int num320 = (int)proj.ai[1];
30744 if (num320 > 5)
30745 {
30746 num320 = 5;
30747 }
30748 for (float num321 = 1f; num321 >= 0f; num321 -= 0.125f)
30749 {
30750 float num322 = 1f - num321;
30751 Vector2 vector79 = proj.velocity * -num320 * num321;
30752 EntitySpriteDraw(value83, vector73 + vector79, null, color88 * num322, num315, origin21, proj.scale * 1.15f * MathHelper.Lerp(0.5f, 1f, num322), dir);
30753 }
30754 }
30755 }
30756 else if (proj.type == 79)
30757 {
30758 Vector2 scale11 = vector74 * 1.4f;
30759 Vector2 spinningpoint6 = new Vector2(2f * scale11.X + (float)Math.Cos(GlobalTimeWrappedHourly * ((float)Math.PI * 2f)) * 0.4f, 0f).RotatedBy(num315 + GlobalTimeWrappedHourly * ((float)Math.PI * 2f));
30760 for (float num323 = 0f; num323 < 1f; num323 += 1f / 6f)
30761 {
30763 color89.A = 0;
30764 EntitySpriteDraw(value83, vector73 + spinningpoint6.RotatedBy(num323 * ((float)Math.PI * 2f)), null, color89, num315, origin21, scale11, dir);
30765 }
30767 }
30768 if ((0u | ((proj.type == 464 && proj.ai[1] != 1f) ? 1u : 0u)) == 0)
30769 {
30771 }
30772 if (proj.type == 464 && proj.ai[1] != 1f)
30773 {
30774 value83 = TextureAssets.Extra[35].Value;
30776 origin21 = rectangle21.Size() / 2f;
30777 Vector2 vector80 = new Vector2(0f, -720f).RotatedBy(proj.velocity.ToRotation());
30778 float num324 = proj.ai[0] % 45f / 45f;
30780 for (int num325 = 0; num325 < 6; num325++)
30781 {
30782 float num326 = (float)num325 * ((float)Math.PI * 2f) / 6f;
30783 Vector2 vector81 = proj.Center + spinningpoint7.RotatedBy(num326);
30784 EntitySpriteDraw(value83, vector81 - screenPosition, rectangle21, color81, num326 + proj.velocity.ToRotation() + (float)Math.PI, origin21, proj.scale, dir);
30785 rectangle21.Y += rectangle21.Height;
30786 if (rectangle21.Y >= value83.Height)
30787 {
30788 rectangle21.Y = 0;
30789 }
30790 }
30791 }
30792 else if (proj.type == 490)
30793 {
30794 EntitySpriteDraw(TextureAssets.Extra[34].Value, vector73, null, color81, 0f - proj.rotation, TextureAssets.Extra[34].Value.Size() / 2f, proj.scale, dir);
30795 EntitySpriteDraw(value83, vector73, null, color81, proj.rotation, origin21, proj.scale * 0.42f, dir);
30796 EntitySpriteDraw(TextureAssets.Extra[34].Value, vector73, null, color81, 0f - proj.rotation, TextureAssets.Extra[34].Value.Size() / 2f, proj.scale * 0.42f, dir);
30797 }
30798 else if (proj.type == 616)
30799 {
30800 value83 = TextureAssets.GlowMask[193].Value;
30801 EntitySpriteDraw(value83, vector73, null, new Microsoft.Xna.Framework.Color(127, 127, 127, 0), proj.rotation, origin21, proj.scale, dir);
30802 }
30803 else if (proj.type >= 646 && proj.type <= 649)
30804 {
30805 value83 = TextureAssets.GlowMask[203 + proj.type - 646].Value;
30806 EntitySpriteDraw(value83, vector73, null, new Microsoft.Xna.Framework.Color(255, 255, 255, 127), proj.rotation, origin21, proj.scale, dir);
30807 }
30808 else if (proj.type == 699)
30809 {
30810 value83 = TextureAssets.GlowMask[231].Value;
30811 EntitySpriteDraw(value83, vector73, null, new Microsoft.Xna.Framework.Color(255, 255, 255, 127), num315, origin21, proj.scale, dir);
30812 }
30813 else if (proj.type == 707 || proj.type == 708)
30814 {
30815 float num327 = 0.5f;
30816 value83 = TextureAssets.GlowMask[232].Value;
30817 Microsoft.Xna.Framework.Rectangle value87 = value83.Frame(1, 3, 0, (int)(proj.ai[0] % 9f) / 3);
30818 if (proj.type == 708)
30819 {
30820 value87 = value83.Frame(1, 3, 0, Main.player[proj.owner].itemAnimation % 9 / 3);
30821 num327 = 0.75f;
30822 }
30824 Vector2 spinningpoint8 = new Vector2(2f, 0f).RotatedBy(proj.rotation);
30825 for (float num328 = 0f; num328 < 4f; num328 += 1f)
30826 {
30827 EntitySpriteDraw(value83, vector73 + spinningpoint8.RotatedBy(num328 * ((float)Math.PI / 2f)), value87, color90 * 0.5f, proj.rotation, origin21, proj.scale, dir);
30828 }
30830 }
30831 else if (proj.type == 719)
30832 {
30833 float num329 = 0.3f;
30835 float num330 = proj.scale * 1.5f;
30836 Vector2 spinningpoint9 = new Vector2(2f * num330, 0f).RotatedBy(proj.rotation);
30837 for (float num331 = 0f; num331 < 4f; num331 += 1f)
30838 {
30839 EntitySpriteDraw(value83, vector73 + -proj.velocity * num331 * 1.25f, null, color91 * 0.7f, proj.rotation, origin21, num330, dir);
30840 }
30841 for (float num332 = 0f; num332 < 3f; num332 += 1f)
30842 {
30843 EntitySpriteDraw(value83, vector73 + spinningpoint9.RotatedBy(num332 * ((float)Math.PI / 2f)), null, color91 * 0.9f, proj.rotation, origin21, num330, dir);
30844 }
30845 EntitySpriteDraw(value83, vector73, null, color81, proj.rotation, origin21, proj.scale, dir);
30846 }
30847 else if (proj.type == 16)
30848 {
30850 Vector2 scale12 = vector74 + vector74 * (float)Math.Cos(GlobalTimeWrappedHourly * ((float)Math.PI * 2f)) * 0.4f;
30851 Vector2 spinningpoint10 = new Vector2(2f * scale12.X, 0f).RotatedBy(num315);
30852 for (float num333 = 0f; num333 < 1f; num333 += 0.25f)
30853 {
30854 EntitySpriteDraw(value83, vector73 + spinningpoint10.RotatedBy(num333 * ((float)Math.PI * 2f)), null, color92, num315, origin21, scale12, dir);
30855 }
30857 }
30858 else if (proj.type == 34)
30859 {
30860 float lerpValue9 = Utils.GetLerpValue(0f, 6f, proj.localAI[0], clamped: true);
30861 Microsoft.Xna.Framework.Color color93 = new Microsoft.Xna.Framework.Color(255, 255, 255, 127) * 0.75f;
30863 Vector2 spinningpoint11 = new Vector2(4f * scale13.X, 0f).RotatedBy(num315);
30864 for (float num334 = 0f; num334 < 1f; num334 += 0.25f)
30865 {
30867 }
30868 }
30869 return;
30870 }
30871 if (proj.type == 465 || proj.type == 467 || proj.type == 468 || proj.type == 500 || proj.type == 518 || proj.type == 535 || proj.type == 539 || proj.type == 575 || proj.type == 574 || proj.type == 589 || proj.type == 590 || proj.type == 593 || proj.type == 602 || proj.type == 596 || proj.type == 612 || proj.type == 953 || proj.type == 613 || proj.type == 614 || proj.type == 623 || proj.type == 625 || proj.type == 626 || proj.type == 627 || proj.type == 628 || proj.type == 634 || proj.type == 635 || proj.type == 643 || proj.type == 644 || proj.type == 645 || proj.type == 650 || proj.type == 652 || proj.type == 658 || proj.type == 659 || proj.type == 663 || proj.type == 665 || proj.type == 667 || proj.type == 677 || proj.type == 678 || proj.type == 679 || proj.type == 691 || proj.type == 692 || proj.type == 693 || proj.type == 702 || proj.type == 703 || proj.type == 701 || proj.type == 712 || proj.type == 715 || proj.type == 716 || proj.type == 717 || proj.type == 718 || proj.type == 758 || proj.type == 759 || proj.type == 764 || proj.type == 779 || proj.type == 783 || proj.type == 773 || proj.type == 820 || proj.type == 831 || proj.type == 970 || proj.type == 836 || proj.type == 851 || proj.type == 855 || proj.type == 856 || proj.type == 857 || proj.type == 861 || proj.type == 862 || proj.type == 863 || proj.type == 866 || proj.type == 870 || proj.type == 882 || proj.type == 885 || proj.type == 889 || proj.type == 895 || proj.type == 896 || proj.type == 898 || proj.type == 903 || proj.type == 904 || proj.type == 905 || proj.type == 906 || proj.type == 908 || proj.type == 910 || proj.type == 911 || proj.type == 951 || proj.type == 957 || proj.type == 962 || proj.type == 963 || proj.type == 967 || proj.type == 968 || proj.type == 978 || proj.type == 995 || proj.type == 886 || proj.type == 892)
30872 {
30873 Vector2 vector82 = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
30876 if (proj.type == 963)
30877 {
30878 rectangle22 = texture2D4.Frame(4, projFrames[proj.type], 0, proj.frame);
30879 }
30880 if (proj.type == 957)
30881 {
30882 int horizontalFrames = 3;
30883 int frameX = proj.frame / projFrames[proj.type];
30884 int frameY2 = proj.frame % projFrames[proj.type];
30886 }
30887 if (proj.type == 962)
30888 {
30889 int verticalFrames = 4;
30890 int frameY3 = proj.frame / projFrames[proj.type];
30891 int frameX2 = proj.frame % projFrames[proj.type];
30893 }
30895 if (proj.type == 623 && CurrentDrawnEntityShader != 0)
30896 {
30897 color94.A = 127;
30898 }
30899 if (proj.type == 995)
30900 {
30902 vector82.Y -= 4f;
30903 vector82.Y += fall;
30904 float amount = Utils.Remap(timeSinceFall, 0f, 10f, 1f, 0f);
30906 }
30907 Vector2 origin25 = rectangle22.Size() / 2f;
30908 if (proj.type == 703)
30909 {
30910 rectangle22.Height -= 2;
30911 }
30912 if (proj.type == 957)
30913 {
30914 float num335 = (float)(Math.Cos((float)(int)mouseTextColor / 255f * ((float)Math.PI * 2f) * 2f) * 4.0);
30915 num335 *= Math.Max(0f, Math.Min(1f, proj.localAI[0] / 100f));
30916 float num336 = 0f;
30917 if (proj.frame > projFrames[proj.type] * 2)
30918 {
30919 switch (proj.frame % projFrames[proj.type])
30920 {
30921 case 5:
30922 case 11:
30923 num336 = 2f;
30924 break;
30925 case 6:
30926 case 10:
30927 num336 = 6f;
30928 break;
30929 case 7:
30930 num336 = 8f;
30931 break;
30932 case 8:
30933 case 9:
30934 num336 = 10f;
30935 break;
30936 }
30937 }
30938 vector82.Y += -2f + num335 + num336;
30939 }
30940 if (proj.type == 895 || proj.type == 896 || proj.type == 898 || proj.type == 963)
30941 {
30942 float num337 = 2f;
30943 if (proj.isAPreviewDummy)
30944 {
30945 num337 = 0.5f;
30946 }
30947 vector82.Y += 0f - num337 + (float)(Math.Cos((float)(int)mouseTextColor / 255f * ((float)Math.PI * 2f) * 2f) * (double)(num337 * 2f));
30948 }
30949 if (proj.type == 963 && proj.localAI[1] >= 0f)
30950 {
30951 float num338 = proj.localAI[1];
30952 float num339 = 1f - num338;
30953 Microsoft.Xna.Framework.Color color95 = proj.GetAlpha(new Microsoft.Xna.Framework.Color(255, 220, 220)) * num339 * num339 * 0.8f;
30954 color95.A = 0;
30955 short num340 = 536;
30958 Vector2 origin26 = value88.Size() * new Vector2(0.5f, 1f);
30959 float num341 = 9f;
30960 float num342 = proj.velocity.ToRotation();
30961 if (proj.velocity.Length() < 0.1f)
30962 {
30963 num342 = ((proj.direction == 1) ? 0f : ((float)Math.PI));
30964 }
30965 Vector2 value89 = (num342 + (float)Math.PI / 2f).ToRotationVector2();
30966 for (int num343 = 0; (float)num343 < num341; num343++)
30967 {
30968 float num344 = ((num343 % 2 != 0) ? 1 : (-1));
30969 float num345 = ((float)num343 + 1f) * num344 * 0.2f * (0.2f + 2f * num338) + num342 + (float)Math.PI / 2f;
30970 float num346 = Utils.Remap(Vector2.Dot(num345.ToRotationVector2(), value89), -1f, 1f, 0f, 1f);
30971 float num347 = proj.scale * (0.15f + 0.6f * (float)Math.Sin(GlobalTimeWrappedHourly + (float)num343 * 0.739f)) * num346;
30972 EntitySpriteDraw(value88, vector82 + proj.rotation.ToRotationVector2().RotatedBy((float)Math.PI * 2f * (1f / num341) * (float)num343 + GlobalTimeWrappedHourly) * 4f * proj.scale, null, color95 * num346, num345, origin26, new Vector2(num347 * 1.5f, num347), SpriteEffects.None);
30973 }
30974 }
30975 if (proj.type == 962)
30976 {
30977 float num348 = Utils.Remap(proj.ai[0], 0f, 30f, 1f, 0f);
30979 color96.A = 0;
30980 for (int num349 = 0; num349 < 4; num349++)
30981 {
30982 EntitySpriteDraw(texture2D4, vector82 + proj.rotation.ToRotationVector2().RotatedBy((float)Math.PI / 2f * (float)num349) * 2f * proj.scale, rectangle22, color96, proj.rotation, origin25, proj.scale, dir);
30983 }
30984 }
30985 if (proj.type == 855)
30986 {
30987 float y21 = (GlobalTimeWrappedHourly % 6f / 6f * ((float)Math.PI * 2f)).ToRotationVector2().Y;
30988 float num350 = y21 * 0.3f + 0.7f;
30990 for (int num351 = 0; num351 < 4; num351++)
30991 {
30992 float x13 = 0f;
30993 float y22 = 0f;
30994 switch (num351)
30995 {
30996 case 0:
30997 x13 = 4f;
30998 break;
30999 case 1:
31000 x13 = -4f;
31001 break;
31002 case 2:
31003 y22 = 4f;
31004 break;
31005 case 3:
31006 y22 = -4f;
31007 break;
31008 }
31009 Vector2 vector83 = new Vector2(x13, y22).RotatedBy(proj.rotation) * y21;
31010 spriteBatch.Draw(texture2D4, vector82 + vector83, rectangle22, color97, proj.rotation, rectangle22.Size() / 2f, 1f, SpriteEffects.None, 0f);
31011 }
31012 }
31013 else if (proj.type == 908)
31014 {
31016 vector82 += (GlobalTimeWrappedHourly * 8f + (float)proj.whoAmI).ToRotationVector2() * 4f;
31017 playerTitaniumStormBuff.Request();
31018 if (playerTitaniumStormBuff.IsReady)
31019 {
31020 texture2D4 = playerTitaniumStormBuff.GetTarget();
31021 }
31022 rectangle22 = texture2D4.Frame(projFrames[proj.type], 1, proj.frame);
31023 origin25 = rectangle22.Size() / 2f;
31024 }
31025 else if (proj.type == 764)
31026 {
31028 }
31029 else if (proj.type == 856)
31030 {
31032 }
31033 else if (proj.type == 857)
31034 {
31036 color94 = Microsoft.Xna.Framework.Color.White * proj.Opacity * 0.9f;
31037 color94.A /= 2;
31038 rectangle22 = texture2D4.Frame(15, 1, proj.frame);
31039 origin25 = rectangle22.Size() / 2f;
31040 DrawPrettyStarSparkle(proj.Opacity, dir, vector82, color94, proj.GetFirstFractalColor(), proj.localAI[0], 15f, 30f, 30f, 45f, 0f, new Vector2(5f, 2f), Vector2.One);
31041 }
31042 else if (proj.type == 539)
31043 {
31044 if (proj.ai[0] >= 210f)
31045 {
31046 float num352 = proj.ai[0] - 210f;
31047 num352 /= 20f;
31048 if (num352 > 1f)
31049 {
31050 num352 = 1f;
31051 }
31052 EntitySpriteDraw(TextureAssets.Extra[46].Value, vector82, null, new Microsoft.Xna.Framework.Color(255, 255, 255, 128) * num352, proj.rotation, new Vector2(17f, 22f), proj.scale, dir);
31053 }
31054 }
31055 else if (proj.type == 773)
31056 {
31057 origin25.Y = rectangle22.Height - 12;
31058 }
31059 else if (proj.type == 866)
31060 {
31061 origin25.X += 14f;
31062 }
31063 else if (proj.type == 759)
31064 {
31065 origin25.Y = rectangle22.Height - 2;
31066 origin25.X += (dir.HasFlag(SpriteEffects.FlipHorizontally) ? 1 : (-1));
31067 }
31068 else if (proj.type == 758)
31069 {
31070 vector82.Y += proj.height / 2;
31071 origin25 = rectangle22.Size() * new Vector2(0.5f, 1f);
31072 origin25.Y -= 4f;
31073 }
31074 else if (proj.type == 951)
31075 {
31076 vector82.Y += proj.height / 2;
31077 vector82.Y -= (float)rectangle22.Height * 0.5f;
31078 vector82.Y += 4f;
31079 origin25 = rectangle22.Size() * new Vector2(0.5f, 0.5f);
31080 }
31081 else if (proj.type == 833)
31082 {
31083 if (proj.frame != 8)
31084 {
31085 vector82.Y += proj.height / 2;
31086 origin25 = rectangle22.Size() * new Vector2(0.5f, 1f);
31087 origin25.Y -= 4f;
31088 origin25.X -= 7 * dir.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt();
31089 }
31090 }
31091 else if (proj.type == 834 || proj.type == 835)
31092 {
31093 if (proj.frame != 10)
31094 {
31095 vector82.Y += proj.height / 2;
31096 origin25 = rectangle22.Size() * new Vector2(0.5f, 1f);
31097 origin25.Y -= 4f;
31098 origin25.X -= 2 * dir.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt();
31099 }
31100 }
31101 else if (proj.type == 715 || proj.type == 716 || proj.type == 717 || proj.type == 718)
31102 {
31103 rectangle22 = texture2D4.Frame(3);
31104 origin25 = rectangle22.Size() / 2f;
31105 int num353 = (int)proj.ai[0];
31106 Vector2 origin27 = new Vector2(rectangle22.Width / 2, 0f);
31107 Vector2 vector84 = proj.Size / 2f;
31109 celeb2Color.A = 127;
31110 celeb2Color *= 0.8f;
31112 value90.X += value90.Width * 2;
31113 for (int num354 = proj.oldPos.Length - 1; num354 > 0; num354--)
31114 {
31115 Vector2 vector85 = proj.oldPos[num354] + vector84;
31116 if (!(vector85 == vector84))
31117 {
31118 Vector2 value91 = proj.oldPos[num354 - 1] + vector84;
31119 float num355 = proj.oldRot[num354];
31120 Vector2 scale14 = new Vector2(Vector2.Distance(vector85, value91) / (float)rectangle22.Width, 1f);
31121 Microsoft.Xna.Framework.Color color98 = celeb2Color * (1f - (float)num354 / (float)proj.oldPos.Length);
31122 switch (num353)
31123 {
31124 case 2:
31125 {
31126 Vector2 vector86 = num355.ToRotationVector2();
31127 int num356 = num354 + proj.timeLeft;
31128 if (num356 < 0)
31129 {
31130 num356 += 20 * (num356 / -20) + 20;
31131 }
31132 num356 %= 20;
31133 float num357 = 0f;
31134 scale14 *= 0.6f;
31135 switch (num356)
31136 {
31137 case 1:
31138 num357 = 1f;
31139 break;
31140 case 2:
31141 num357 = 2f;
31142 break;
31143 case 3:
31144 num357 = 3f;
31145 break;
31146 case 4:
31147 num357 = 2f;
31148 break;
31149 case 5:
31150 num357 = 1f;
31151 break;
31152 case 7:
31153 num357 = -1f;
31154 break;
31155 case 8:
31156 num357 = -2f;
31157 break;
31158 case 9:
31159 num357 = -3f;
31160 break;
31161 case 10:
31162 num357 = -2f;
31163 break;
31164 case 11:
31165 num357 = -1f;
31166 break;
31167 }
31168 vector85 += vector86 * num357 * 4f;
31169 break;
31170 }
31171 case 5:
31172 scale14 *= 0.5f;
31173 break;
31174 }
31176 }
31177 }
31178 }
31179 else if (proj.type == 663 || proj.type == 665 || proj.type == 667)
31180 {
31181 vector82 = proj.Bottom + Vector2.UnitY * proj.gfxOffY - screenPosition;
31182 origin25 = rectangle22.Size() * new Vector2(0.5f, 1f);
31183 origin25.Y -= 2f;
31184 origin25.Y -= 2f;
31185 }
31186 else if (proj.type == 691 || proj.type == 692 || proj.type == 693)
31187 {
31188 vector82 = proj.Bottom + Vector2.UnitY * proj.gfxOffY - screenPosition;
31189 origin25 = rectangle22.Size() * new Vector2(0.5f, 1f);
31190 origin25.Y -= 2f;
31191 origin25.Y -= 2f;
31192 }
31193 else if (proj.type == 677 || proj.type == 678 || proj.type == 679)
31194 {
31195 if (proj.spriteDirection == -1)
31196 {
31197 dir ^= SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
31198 }
31200 if (proj.type == 678)
31201 {
31202 value92 = TextureAssets.Extra[84].Value;
31203 }
31204 if (proj.type == 679)
31205 {
31206 value92 = TextureAssets.Extra[85].Value;
31207 }
31208 Vector2 position22 = proj.Bottom + Vector2.UnitY * proj.gfxOffY - screenPosition;
31209 Vector2 origin28 = value92.Size() * new Vector2(0.5f, 1f);
31210 origin28.Y -= 2f;
31211 EntitySpriteDraw(value92, position22, null, color94, 0f, origin28, 1f, dir & SpriteEffects.FlipHorizontally);
31212 origin25.X += dir.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt();
31213 vector82.Y += 1f;
31214 vector82.Y += 2f;
31215 if (proj.type == 678)
31216 {
31217 vector82.Y += -4f;
31218 }
31219 if (proj.type == 679)
31220 {
31221 vector82.Y -= 2f;
31222 if (!dir.HasFlag(SpriteEffects.FlipVertically))
31223 {
31224 origin25.Y += 4f;
31225 }
31226 else
31227 {
31228 origin25.Y -= 4f;
31229 }
31230 origin25.X += dir.HasFlag(SpriteEffects.FlipHorizontally).ToDirectionInt() * 4;
31231 }
31232 }
31233 else if (proj.type == 602)
31234 {
31235 origin25.X = rectangle22.Width - 6;
31236 origin25.Y -= 1f;
31237 rectangle22.Height -= 2;
31238 }
31239 else if (proj.type == 589)
31240 {
31241 rectangle22 = texture2D4.Frame(5, 1, (int)proj.ai[1]);
31242 origin25 = rectangle22.Size() / 2f;
31243 }
31244 else if (proj.type == 590)
31245 {
31246 if (proj.ai[2] == 1f && proj.frame < 3)
31247 {
31248 proj.frame = 3;
31249 }
31250 rectangle22 = texture2D4.Frame(6, 1, proj.frame);
31251 origin25 = rectangle22.Size() / 2f;
31252 }
31253 else if (proj.type == 836)
31254 {
31255 rectangle22 = texture2D4.Frame(4, 1, proj.frame);
31256 origin25 = rectangle22.Size() / 2f;
31257 }
31258 else if (proj.type == 650 || proj.type == 882 || proj.type == 888 || proj.type == 894 || proj.type == 895 || proj.type == 896 || proj.type == 898 || proj.type == 901 || proj.type == 957)
31259 {
31260 origin25.Y -= 4f;
31261 }
31262 else if (proj.type == 623)
31263 {
31264 if (!gamePaused && proj.ai[0] == 2f)
31265 {
31266 vector82 += rand.NextVector2Circular(2f, 2f);
31267 }
31268 if (CurrentDrawnEntityShader == 0)
31269 {
31270 color94.A /= 2;
31271 }
31272 }
31273 else if (proj.type >= 625 && proj.type <= 628)
31274 {
31275 color94.A /= 2;
31276 }
31277 else if (proj.type == 644)
31278 {
31279 Microsoft.Xna.Framework.Color color99 = hslToRgb(proj.ai[0], 1f, 0.5f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0));
31282 if (proj.ai[1] != -1f && proj.Opacity > 0.3f)
31283 {
31284 Vector2 vector87 = Main.projectile[(int)proj.ai[1]].Center - proj.Center;
31285 Vector2 vector88 = new Vector2(1f, vector87.Length() / (float)texture2D4.Height);
31286 float rotation29 = vector87.ToRotation() + (float)Math.PI / 2f;
31287 float value93 = MathHelper.Distance(30f, proj.localAI[1]) / 20f;
31288 value93 = MathHelper.Clamp(value93, 0f, 1f);
31289 if (value93 > 0f)
31290 {
31293 }
31294 }
31295 }
31296 else if (proj.type == 658)
31297 {
31298 Microsoft.Xna.Framework.Color color100 = hslToRgb(0.136f, 1f, 0.5f).MultiplyRGBA(new Microsoft.Xna.Framework.Color(255, 255, 255, 0));
31299 EntitySpriteDraw(texture2D4, vector82, rectangle22, color100, 0f, origin25, new Vector2(1f, 5f) * proj.scale * 2f, dir);
31300 }
31302 if (proj.type == 896)
31303 {
31306 for (int num358 = 0; num358 < 2; num358++)
31307 {
31308 Vector2 position23 = vector82 + new Vector2((float)rand.Next(-10, 11) * 0.1f, (float)rand.Next(-10, 11) * 0.1f);
31310 }
31312 }
31313 if (proj.type == 889)
31314 {
31316 Microsoft.Xna.Framework.Color color102 = Microsoft.Xna.Framework.Color.White * (int)mouseTextColor;
31318 if (!proj.isAPreviewDummy)
31319 {
31320 for (int num359 = 0; num359 < 4; num359++)
31321 {
31322 int num360 = 28;
31323 int num361 = 7 + num359;
31324 float num362 = 100f;
31325 bool flag37 = num361 == 8;
31330 float num363 = 0f;
31331 float num364 = GlobalTimeWrappedHourly * 2f;
31332 switch (num359)
31333 {
31334 case 1:
31335 num364 += (float)Math.PI / 2f;
31336 break;
31337 case 2:
31338 num364 += (float)Math.PI;
31339 break;
31340 case 3:
31341 num364 += 4.712389f;
31342 break;
31343 }
31344 num364 *= 3f;
31345 num363 = num364;
31346 vector89 += num364.ToRotationVector2() * num360;
31347 if (proj.localAI[0] == num362)
31348 {
31350 if (flag37)
31351 {
31353 }
31354 continue;
31355 }
31356 Vector2 vector90 = new Vector2(num360, -16f) + proj.velocity * 1.5f;
31357 float num365 = 4f;
31358 float num366 = -0.35f;
31359 switch (num359)
31360 {
31361 case 1:
31362 vector90.X *= -1f;
31363 effects5 = SpriteEffects.FlipHorizontally;
31364 num366 = 0.35f;
31365 num365 = -3f;
31366 break;
31367 case 2:
31368 vector90.Y = 16f;
31369 num366 = 0.35f;
31370 num365 = 2f;
31371 break;
31372 case 3:
31373 vector90.X *= -1f;
31374 vector90.Y = 16f;
31375 effects5 = SpriteEffects.FlipHorizontally;
31376 num366 = -0.35f;
31377 num365 = -1f;
31378 break;
31379 }
31380 vector90 += (GlobalTimeWrappedHourly * num365).ToRotationVector2() * 4f;
31381 value97 += vector90;
31382 float num367 = proj.localAI[0] / num362;
31384 num363 = ((num367 > 0.5f) ? num364 : num366);
31386 if (flag37)
31387 {
31389 }
31390 }
31391 }
31392 }
31393 if (proj.type == 885 && !proj.isAPreviewDummy)
31394 {
31395 for (int num368 = 0; num368 < 2; num368++)
31396 {
31398 int num369 = -30;
31399 if (num368 == 1)
31400 {
31401 num369 = 30;
31402 effects6 = SpriteEffects.FlipHorizontally;
31403 }
31404 int num370 = (int)proj.localAI[0];
31405 if (proj.frame == 6)
31406 {
31407 num370 = 0;
31408 }
31409 else if (num368 == 1)
31410 {
31411 num370 = 2 - num370;
31412 }
31413 num370 += 7;
31416 Vector2 vector91 = (GlobalTimeWrappedHourly * 2f).ToRotationVector2() * 4f;
31417 vector91 += proj.velocity * -1.5f;
31418 Vector2 vector92 = (GlobalTimeWrappedHourly * 1f).ToRotationVector2() * 3f;
31419 if (num368 == 1)
31420 {
31422 }
31423 else
31424 {
31426 }
31428 }
31429 }
31430 if (proj.type == 535)
31431 {
31432 for (int num371 = 0; num371 < 1000; num371++)
31433 {
31434 if (Main.projectile[num371].active && Main.projectile[num371].owner == proj.owner && Main.projectile[num371].type == 536)
31435 {
31437 }
31438 }
31439 }
31440 else if (proj.type == 715 || proj.type == 716 || proj.type == 717 || proj.type == 718)
31441 {
31442 rectangle22.X += rectangle22.Width;
31444 celeb2Color2.A = 80;
31446 }
31447 else if (proj.type == 702)
31448 {
31450 Vector2 origin29 = value99.Size() / 2f;
31451 Vector2 vector93 = new Vector2(5 * proj.spriteDirection, -10f).RotatedBy(proj.rotation);
31452 ulong seed2 = (ulong)(proj.localAI[0] / 4f);
31453 for (int num372 = 0; num372 < 5; num372++)
31454 {
31456 float x14 = (float)Utils.RandomInt(ref seed2, -10, 11) * 0.15f;
31457 float y23 = (float)Utils.RandomInt(ref seed2, -10, 1) * 0.35f;
31458 EntitySpriteDraw(value99, vector82 + vector93 + new Vector2(x14, y23), null, color103, proj.rotation, origin29, 1f, dir);
31459 }
31460 }
31461 else if (proj.type == 663 || proj.type == 665 || proj.type == 667)
31462 {
31464 switch (proj.type)
31465 {
31466 case 665:
31467 value100 = TextureAssets.GlowMask[222].Value;
31468 break;
31469 case 667:
31470 value100 = TextureAssets.GlowMask[223].Value;
31471 break;
31472 }
31473 float num373 = (proj.localAI[0] / 100f * ((float)Math.PI * 2f)).ToRotationVector2().X * 1f + 1f;
31474 Microsoft.Xna.Framework.Color color104 = new Microsoft.Xna.Framework.Color(140, 100, 40, 0) * (num373 / 4f + 0.5f) * 1f;
31475 for (float num374 = 0f; num374 < 4f; num374 += 1f)
31476 {
31477 EntitySpriteDraw(value100, vector82 + (num374 * ((float)Math.PI / 2f)).ToRotationVector2() * num373, rectangle22, color104, proj.rotation, origin25, proj.scale, dir);
31478 }
31479 }
31480 else if (proj.type == 644)
31481 {
31483 }
31484 else if (proj.type == 963)
31485 {
31486 int num375 = Main.player[proj.owner].ownedProjectileCounts[970] - 1;
31487 int num376 = (num375 + 3) % 3;
31488 int num377 = num375 / 3;
31489 Vector3 vector94 = rgbToHsl(new Microsoft.Xna.Framework.Color(250, 150, 180));
31490 vector94 = new Vector3(0f, 1f, 0.6f);
31491 if (num377 == 1)
31492 {
31494 vector94.Z += 0.1f;
31495 vector94.X -= 0.05f;
31496 }
31497 vector94.X = (vector94.X - (float)num377 * 0.13f + 1f) % 1f;
31499 Microsoft.Xna.Framework.Color color105 = Lighting.GetColor((int)(proj.Center.X / 16f), (int)(proj.Center.Y / 16f), oldColor);
31500 rectangle22.X += rectangle22.Width * (1 + num376);
31502 }
31503 else if (proj.type == 773 && proj.velocity.Length() == 0f)
31504 {
31505 EntitySpriteDraw(TextureAssets.GlowMask[266].Value, color: Microsoft.Xna.Framework.Color.White * (int)mouseTextColor, position: vector82, sourceRectangle: rectangle22, rotation: proj.rotation, origin: origin25, scale: proj.scale, effects: dir);
31506 }
31507 else if (proj.type == 658)
31508 {
31510 }
31511 else if (proj.type == 602)
31512 {
31513 texture2D4 = TextureAssets.Extra[60].Value;
31515 color107.A = 0;
31516 color107 *= 0.3f;
31517 origin25 = texture2D4.Size() / 2f;
31518 EntitySpriteDraw(texture2D4, vector82, null, color107, proj.rotation - (float)Math.PI / 2f, origin25, proj.scale, dir);
31519 texture2D4 = TextureAssets.Extra[59].Value;
31520 color107 = color94;
31521 color107.A = 0;
31522 color107 *= 0.13f;
31523 origin25 = texture2D4.Size() / 2f;
31524 EntitySpriteDraw(texture2D4, vector82, null, color107, proj.rotation - (float)Math.PI / 2f, origin25, proj.scale * 0.9f, dir);
31525 }
31526 else if (proj.type == 539)
31527 {
31528 EntitySpriteDraw(TextureAssets.GlowMask[140].Value, vector82, rectangle22, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), proj.rotation, origin25, proj.scale, dir);
31529 }
31530 else if (proj.type == 613)
31531 {
31532 EntitySpriteDraw(TextureAssets.GlowMask[189].Value, vector82, rectangle22, new Microsoft.Xna.Framework.Color(128 - proj.alpha / 2, 128 - proj.alpha / 2, 128 - proj.alpha / 2, 0), proj.rotation, origin25, proj.scale, dir);
31533 }
31534 else if (proj.type == 614)
31535 {
31536 EntitySpriteDraw(TextureAssets.GlowMask[190].Value, vector82, rectangle22, new Microsoft.Xna.Framework.Color(128 - proj.alpha / 2, 128 - proj.alpha / 2, 128 - proj.alpha / 2, 0), proj.rotation, origin25, proj.scale, dir);
31537 }
31538 else if (proj.type == 574)
31539 {
31540 EntitySpriteDraw(TextureAssets.GlowMask[148].Value, vector82, rectangle22, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), proj.rotation, origin25, proj.scale, dir);
31541 }
31542 else if (proj.type == 691 || proj.type == 692 || proj.type == 693)
31543 {
31545 switch (proj.type)
31546 {
31547 case 692:
31548 value102 = TextureAssets.GlowMask[236].Value;
31549 break;
31550 case 693:
31551 value102 = TextureAssets.GlowMask[237].Value;
31552 break;
31553 }
31554 EntitySpriteDraw(value102, vector82, rectangle22, new Microsoft.Xna.Framework.Color(255, 255, 255, 127), proj.rotation, origin25, proj.scale, dir);
31555 }
31556 else if (proj.type == 590)
31557 {
31558 EntitySpriteDraw(TextureAssets.GlowMask[168].Value, vector82, rectangle22, new Microsoft.Xna.Framework.Color(127 - proj.alpha / 2, 127 - proj.alpha / 2, 127 - proj.alpha / 2, 0), proj.rotation, origin25, proj.scale, dir);
31559 }
31560 else if (proj.type == 623 || (proj.type >= 625 && proj.type <= 628))
31561 {
31562 if (Main.player[proj.owner].ghostFade != 0f)
31563 {
31564 float num378 = Main.player[proj.owner].ghostFade * 5f;
31565 for (float num379 = 0f; num379 < 4f; num379 += 1f)
31566 {
31567 EntitySpriteDraw(texture2D4, vector82 + Vector2.UnitY.RotatedBy(num379 * ((float)Math.PI * 2f) / 4f) * num378, rectangle22, color94 * 0.1f, proj.rotation, origin25, proj.scale, dir);
31568 }
31569 }
31570 if (proj.type == 623 && proj.ai[0] == 2f && proj.frame >= 14)
31571 {
31573 }
31574 }
31575 else if (proj.type == 643)
31576 {
31577 float num380 = (float)Math.Cos((float)Math.PI * 2f * (proj.localAI[0] / 60f)) + 3f + 3f;
31578 for (float num381 = 0f; num381 < 4f; num381 += 1f)
31579 {
31580 EntitySpriteDraw(texture2D4, vector82 + Vector2.UnitY.RotatedBy(num381 * ((float)Math.PI / 2f)) * num380, rectangle22, color94 * 0.2f, proj.rotation, origin25, proj.scale, dir);
31581 }
31582 }
31583 else if (proj.type == 650)
31584 {
31585 int num382 = (int)(proj.localAI[0] / ((float)Math.PI * 2f));
31586 float f = proj.localAI[0] % ((float)Math.PI * 2f) - (float)Math.PI;
31587 float num383 = (float)Math.IEEERemainder(proj.localAI[1], 1.0);
31588 if (num383 < 0f)
31589 {
31590 num383 += 1f;
31591 }
31592 int num384 = (int)Math.Floor(proj.localAI[1]);
31593 float num385 = 1f;
31594 float num386 = 5f;
31595 num385 = 1f + (float)num384 * 0.02f;
31596 if ((float)num382 == 1f)
31597 {
31598 num386 = 7f;
31599 }
31600 Vector2 vector95 = f.ToRotationVector2() * num383 * num386 * proj.scale;
31601 texture2D4 = TextureAssets.Extra[66].Value;
31602 EntitySpriteDraw(texture2D4, vector82 + vector95, null, color94, proj.rotation, texture2D4.Size() / 2f, num385, SpriteEffects.None);
31603 }
31604 return;
31605 }
31606 if (proj.type == 466)
31607 {
31608 Vector2 end = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31610 proj.GetAlpha(projectileColor);
31611 Vector2 vector96 = new Vector2(proj.scale) / 2f;
31612 for (int num387 = 0; num387 < 3; num387++)
31613 {
31614 switch (num387)
31615 {
31616 case 0:
31617 vector96 = new Vector2(proj.scale) * 0.6f;
31618 DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(115, 204, 219, 0) * 0.5f;
31619 break;
31620 case 1:
31621 vector96 = new Vector2(proj.scale) * 0.4f;
31622 DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(113, 251, 255, 0) * 0.5f;
31623 break;
31624 default:
31625 vector96 = new Vector2(proj.scale) * 0.2f;
31626 DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.5f;
31627 break;
31628 }
31629 DelegateMethods.f_1 = 1f;
31630 for (int num388 = proj.oldPos.Length - 1; num388 > 0; num388--)
31631 {
31632 if (!(proj.oldPos[num388] == Vector2.Zero))
31633 {
31634 Vector2 start = proj.oldPos[num388] + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31635 Vector2 end2 = proj.oldPos[num388 - 1] + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31637 }
31638 }
31639 if (proj.oldPos[0] != Vector2.Zero)
31640 {
31641 DelegateMethods.f_1 = 1f;
31642 Vector2 start2 = proj.oldPos[0] + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31644 }
31645 }
31646 return;
31647 }
31648 if (proj.type == 580)
31649 {
31650 Vector2 end3 = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31652 proj.GetAlpha(projectileColor);
31653 Vector2 vector97 = new Vector2(proj.scale) / 2f;
31654 for (int num389 = 0; num389 < 2; num389++)
31655 {
31656 float num390 = ((proj.localAI[1] == -1f || proj.localAI[1] == 1f) ? (-0.2f) : 0f);
31657 if (num389 == 0)
31658 {
31659 vector97 = new Vector2(proj.scale) * (0.5f + num390);
31660 DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(115, 244, 219, 0) * 0.5f;
31661 }
31662 else
31663 {
31664 vector97 = new Vector2(proj.scale) * (0.3f + num390);
31665 DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.5f;
31666 }
31667 DelegateMethods.f_1 = 1f;
31668 for (int num391 = proj.oldPos.Length - 1; num391 > 0; num391--)
31669 {
31670 if (!(proj.oldPos[num391] == Vector2.Zero))
31671 {
31672 Vector2 start3 = proj.oldPos[num391] + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31673 Vector2 end4 = proj.oldPos[num391 - 1] + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31675 }
31676 }
31677 if (proj.oldPos[0] != Vector2.Zero)
31678 {
31679 DelegateMethods.f_1 = 1f;
31680 Vector2 start4 = proj.oldPos[0] + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31682 }
31683 }
31684 return;
31685 }
31686 if (proj.type == 445)
31687 {
31688 if (Main.player[proj.owner].gravDir == -1f)
31689 {
31690 dir |= SpriteEffects.FlipVertically;
31691 }
31692 Vector2 vector98 = proj.position + new Vector2(proj.width, proj.height) / 2f + Vector2.UnitY * proj.gfxOffY - screenPosition;
31695 Vector2 vector99 = Main.player[proj.owner].RotatedRelativePoint(mountedCenter) + Vector2.UnitY * Main.player[proj.owner].gfxOffY;
31698 float num392 = vector100.Length();
31699 float num393 = vector100.ToRotation() + (float)Math.PI / 2f;
31700 float num394 = -5f;
31701 float num395 = num394 + 30f;
31702 new Vector2(2f, num392 - num395);
31704 Vector2 vector103 = -Vector2.UnitY.RotatedBy(proj.localAI[0] / 60f * (float)Math.PI);
31705 Vector2[] array7 = new Vector2[4]
31706 {
31707 vector103,
31708 vector103.RotatedBy(1.5707963705062866),
31709 vector103.RotatedBy(3.1415927410125732),
31710 vector103.RotatedBy(4.71238899230957)
31711 };
31712 if (num392 > num395)
31713 {
31714 for (int num396 = 0; num396 < 2; num396++)
31715 {
31717 if (num396 % 2 == 0)
31718 {
31720 white4.A = 128;
31721 white4 *= 0.5f;
31722 }
31723 else
31724 {
31726 white4.A = 128;
31727 white4 *= 0.5f;
31728 }
31729 Vector2 vector104 = new Vector2(array7[num396].X, 0f).RotatedBy(num393) * 4f;
31731 }
31732 }
31733 int type2 = Main.player[proj.owner].inventory[Main.player[proj.owner].selectedItem].type;
31734 instance.LoadItem(type2);
31737 EntitySpriteDraw(value106, vector99 - screenPosition + vector101 * num394, null, color108, proj.rotation + (float)Math.PI / 2f + ((dir == SpriteEffects.None || dir == SpriteEffects.FlipVertically) ? ((float)Math.PI) : 0f), new Vector2((dir != 0 && dir != SpriteEffects.FlipVertically) ? value106.Width : 0, (float)value106.Height / 2f) + Vector2.UnitY * 1f, Main.player[proj.owner].inventory[Main.player[proj.owner].selectedItem].scale, dir);
31738 EntitySpriteDraw(TextureAssets.GlowMask[39].Value, vector99 - screenPosition + vector101 * num394, null, new Microsoft.Xna.Framework.Color(255, 255, 255, 0), proj.rotation + (float)Math.PI / 2f + ((dir == SpriteEffects.None || dir == SpriteEffects.FlipVertically) ? ((float)Math.PI) : 0f), new Vector2((dir != 0 && dir != SpriteEffects.FlipVertically) ? value106.Width : 0, (float)value106.Height / 2f) + Vector2.UnitY * 1f, Main.player[proj.owner].inventory[Main.player[proj.owner].selectedItem].scale, dir);
31739 if (num392 > num395)
31740 {
31741 for (int num397 = 2; num397 < 4; num397++)
31742 {
31744 if (num397 % 2 == 0)
31745 {
31747 white5.A = 128;
31748 white5 *= 0.5f;
31749 }
31750 else
31751 {
31753 white5.A = 128;
31754 white5 *= 0.5f;
31755 }
31756 Vector2 vector105 = new Vector2(array7[num397].X, 0f).RotatedBy(num393) * 4f;
31758 }
31759 }
31760 float num398 = proj.localAI[0] / 60f;
31761 if (num398 > 0.5f)
31762 {
31763 num398 = 1f - num398;
31764 }
31765 EntitySpriteDraw(value105, vector98, null, alpha10 * num398 * 2f, proj.rotation, new Vector2(value105.Width, value105.Height) / 2f, proj.scale, dir);
31766 EntitySpriteDraw(TextureAssets.GlowMask[40].Value, vector98, null, alpha10 * (0.5f - num398) * 2f, proj.rotation, new Vector2(value105.Width, value105.Height) / 2f, proj.scale, dir);
31767 return;
31768 }
31769 if ((proj.type >= 393 && proj.type <= 395) || proj.type == 398 || proj.type == 423 || proj.type == 450)
31770 {
31772 int num399 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
31773 int y24 = num399 * proj.frame;
31774 EntitySpriteDraw(value107, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle(0, y24, value107.Width, num399), proj.GetAlpha(projectileColor), proj.rotation, new Vector2((float)value107.Width / 2f, (float)num399 / 2f), proj.scale, dir);
31775 if (proj.type == 398)
31776 {
31778 EntitySpriteDraw(value107, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle(0, y24, value107.Width, num399), new Microsoft.Xna.Framework.Color(250, 250, 250, proj.alpha), proj.rotation, new Vector2((float)value107.Width / 2f, (float)num399 / 2f), proj.scale, dir);
31779 }
31780 if (proj.type == 423)
31781 {
31782 value107 = TextureAssets.GlowMask[0].Value;
31783 EntitySpriteDraw(value107, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle(0, y24, value107.Width, num399), new Microsoft.Xna.Framework.Color(250, 250, 250, proj.alpha), proj.rotation, new Vector2((float)value107.Width / 2f, (float)num399 / 2f), proj.scale, dir);
31784 }
31785 return;
31786 }
31787 if (proj.type == 385)
31788 {
31790 int num400 = value108.Height / projFrames[proj.type];
31791 int y25 = num400 * proj.frame;
31792 int num401 = 8;
31793 int num402 = 2;
31794 float value109 = 0.4f;
31795 for (int num403 = 1; num403 < num401; num403 += num402)
31796 {
31797 _ = ref proj.oldPos[num403];
31799 newColor3 = proj.GetAlpha(newColor3);
31800 newColor3 *= (float)(num401 - num403) / 15f;
31802 _ = proj.oldPos[num403] - screenPosition + new Vector2(num138 + (float)num137, (float)(proj.height / 2) + proj.gfxOffY);
31803 EntitySpriteDraw(value108, proj.oldPos[num403] + new Vector2(proj.width, proj.height) / 2f - screenPosition + new Vector2(0f, proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y25, value108.Width, num400), Microsoft.Xna.Framework.Color.Lerp(alpha11, newColor3, 0.3f), proj.rotation, new Vector2((float)value108.Width / 2f, (float)num400 / 2f), MathHelper.Lerp(proj.scale, value109, (float)num403 / 15f), dir);
31804 }
31805 EntitySpriteDraw(value108, proj.Center - screenPosition + new Vector2(0f, proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y25, value108.Width, num400), proj.GetAlpha(projectileColor), proj.rotation, new Vector2((float)value108.Width / 2f, (float)num400 / 2f), proj.scale, dir);
31806 return;
31807 }
31808 if (proj.type == 388)
31809 {
31811 int num404 = value110.Height / projFrames[proj.type];
31812 int y26 = num404 * proj.frame;
31813 int num405 = 0;
31814 int num406 = 0;
31815 if (proj.ai[0] == 2f)
31816 {
31817 num405 = 10;
31818 num406 = 1;
31819 }
31820 else
31821 {
31822 num405 = 3;
31823 num406 = 1;
31824 }
31825 for (int num407 = 1; num407 < num405; num407 += num406)
31826 {
31827 _ = ref proj.oldPos[num407];
31829 newColor4 = proj.GetAlpha(newColor4);
31830 newColor4 *= (float)(num405 - num407) / 15f;
31831 Vector2 position25 = proj.oldPos[num407] - screenPosition + new Vector2(num138 + (float)num137, (float)(proj.height / 2) + proj.gfxOffY);
31833 }
31834 EntitySpriteDraw(value110, proj.position - screenPosition + new Vector2(num138 + (float)num137, (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y26, value110.Width, num404), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31835 return;
31836 }
31837 if (projFrames[proj.type] > 1)
31838 {
31839 int num408 = TextureAssets.Projectile[proj.type].Height() / projFrames[proj.type];
31840 int y27 = num408 * proj.frame;
31841 if (proj.type == 111)
31842 {
31843 int r = Main.player[proj.owner].shirtColor.R;
31844 int g = Main.player[proj.owner].shirtColor.G;
31845 int b = Main.player[proj.owner].shirtColor.B;
31846 projectileColor = Lighting.GetColor(oldColor: new Microsoft.Xna.Framework.Color((byte)r, (byte)g, (byte)b), x: (int)((double)proj.position.X + (double)proj.width * 0.5) / 16, y: (int)(((double)proj.position.Y + (double)proj.height * 0.5) / 16.0));
31847 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31848 return;
31849 }
31851 if (proj.type == 211 && CurrentDrawnEntityShader != 0)
31852 {
31853 alpha12.A = 127;
31854 }
31855 if (proj.type == 344)
31856 {
31857 float num409 = MathHelper.Min(60f, proj.ai[0]) / 2f;
31858 for (float num410 = 0.9f; num410 > 0f; num410 -= 0.25f)
31859 {
31860 Vector2 vector106 = num410 * (proj.velocity * 0.33f) * num409;
31861 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY) - vector106, new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408 - 1), alpha12 * (1f - num410) * 0.75f, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale * (0.4f + (1f - num410) * 0.6f), dir);
31862 }
31863 }
31864 if (proj.type == 920 || proj.type == 921)
31865 {
31866 for (float num411 = 0.25f; num411 < 1f; num411 += 0.5f)
31867 {
31868 Vector2 vector107 = num411 * proj.velocity * 4f;
31869 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY) - vector107, new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408 - 1), alpha12 * (1f - num411) * 0.75f, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31870 }
31871 }
31872 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408 - 1), alpha12, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31873 if (proj.type == 966)
31874 {
31875 Vector2 vector108 = new Vector2(0f, -30f);
31876 vector108.Y += -1f + (float)(Math.Cos((float)(int)mouseTextColor / 255f * ((float)Math.PI * 2f) * 2f) * 2.0);
31877 Vector2 vector109 = new Vector2(-1f, -1f);
31878 float num412 = 3f;
31879 Vector2 vector110 = proj.Center + vector108;
31880 Vector2 vector111 = proj.Center;
31881 int num413 = (int)proj.ai[1];
31882 if (num413 >= 0)
31883 {
31884 if (npc[num413].active)
31885 {
31886 vector111 = npc[num413].Center;
31887 }
31888 else
31889 {
31890 num413 = -1;
31891 }
31892 }
31893 if (num413 <= -1)
31894 {
31895 Player player5 = Main.player[proj.owner];
31896 vector111 = ((!player5.dead) ? player5.Center : (vector110 + new Vector2(2f, 0f)));
31897 }
31898 vector109 += (vector111 - vector110).SafeNormalize(Vector2.Zero) * num412;
31899 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY) + vector108, new Microsoft.Xna.Framework.Rectangle(0, num408, TextureAssets.Projectile[proj.type].Width(), num408 - 1), alpha12, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31900 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY) + vector108 + vector109, new Microsoft.Xna.Framework.Rectangle(0, num408 * 2, TextureAssets.Projectile[proj.type].Width(), num408 - 1), alpha12, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31901 }
31902 if (proj.type == 335)
31903 {
31904 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408 - 1), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31905 }
31906 if (proj.type == 897 || proj.type == 899)
31907 {
31908 int num414 = 279;
31909 if (proj.type == 899)
31910 {
31911 num414 = 281;
31912 }
31913 EntitySpriteDraw(TextureAssets.GlowMask[num414].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408 - 1), Microsoft.Xna.Framework.Color.White, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31914 }
31915 if (proj.type == 891)
31916 {
31917 float num415 = Utils.WrappedLerp(0.6f, 1f, (float)((int)timeForVisualEffects % 100) / 100f);
31918 EntitySpriteDraw(color: new Microsoft.Xna.Framework.Color(num415, num415, num415, 150f), texture: TextureAssets.GlowMask[277].Value, position: new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), sourceRectangle: new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408 - 1), rotation: proj.rotation, origin: new Vector2(num138, proj.height / 2 + num136), scale: proj.scale, effects: dir);
31919 }
31920 if (proj.type == 595)
31921 {
31922 Player player6 = Main.player[proj.owner];
31923 if (player6.active && player6.body == 208)
31924 {
31925 for (float num416 = 0f; num416 <= 1f; num416 += 0.2f)
31926 {
31927 Microsoft.Xna.Framework.Color underShirtColor = player6.underShirtColor;
31928 underShirtColor.A = (byte)(120f * (1f - num416 * 0.5f));
31929 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408 - 1), underShirtColor, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale * MathHelper.Lerp(0.8f, 1.3f, num416), dir);
31930 }
31931 }
31932 }
31933 if (proj.type == 387)
31934 {
31935 EntitySpriteDraw(TextureAssets.EyeLaserSmall.Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408), new Microsoft.Xna.Framework.Color(255, 255, 255, 0), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
31936 }
31937 if (proj.type != 525 && proj.type != 960)
31938 {
31939 return;
31940 }
31942 if (num417 == 0)
31943 {
31944 return;
31945 }
31946 int num418 = (projectileColor.R + projectileColor.G + projectileColor.B) / 3;
31947 if (num418 > 10)
31948 {
31949 int num419 = 94;
31950 if (proj.type == 960)
31951 {
31952 num419 = 244;
31953 }
31955 EntitySpriteDraw(TextureAssets.Extra[num419].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, y27, TextureAssets.Projectile[proj.type].Width(), num408 - 1), selectionGlowColor, proj.rotation, new Vector2(num138, proj.height / 2 + num136), 1f, dir);
31956 }
31957 return;
31958 }
31959 if (proj.type == 383 || proj.type == 399)
31960 {
31962 EntitySpriteDraw(value111, proj.Center - screenPosition, null, proj.GetAlpha(projectileColor), proj.rotation, new Vector2(value111.Width, value111.Height) / 2f, proj.scale, dir);
31963 return;
31964 }
31965 if (proj.type == 157 || proj.type == 378)
31966 {
31967 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + (float)(proj.width / 2), proj.position.Y - screenPosition.Y + (float)(proj.height / 2)), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(TextureAssets.Projectile[proj.type].Width() / 2, TextureAssets.Projectile[proj.type].Height() / 2), proj.scale, dir);
31968 return;
31969 }
31970 if (proj.type == 306)
31971 {
31972 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + (float)(proj.width / 2), proj.position.Y - screenPosition.Y + (float)(proj.height / 2)), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(TextureAssets.Projectile[proj.type].Width() / 2, TextureAssets.Projectile[proj.type].Height() / 2), proj.scale, dir);
31973 return;
31974 }
31975 if (proj.type == 256)
31976 {
31977 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + (float)(proj.width / 2), proj.position.Y - screenPosition.Y + (float)(proj.height / 2)), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(TextureAssets.Projectile[proj.type].Width() / 2, TextureAssets.Projectile[proj.type].Height() / 2), proj.scale, dir);
31978 return;
31979 }
31980 if (proj.aiStyle == 27)
31981 {
31982 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + (float)(proj.width / 2), proj.position.Y - screenPosition.Y + (float)(proj.height / 2)), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(TextureAssets.Projectile[proj.type].Width(), 0f), proj.scale, dir);
31983 return;
31984 }
31985 if (proj.aiStyle == 19)
31986 {
31988 return;
31989 }
31990 if (proj.type == 451)
31991 {
31992 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, proj.Center - screenPosition, null, proj.GetAlpha(projectileColor), proj.rotation, new Vector2(TextureAssets.Projectile[proj.type].Width(), 0f), proj.scale, dir);
31993 return;
31994 }
31995 if (proj.type == 434)
31996 {
31997 Vector2 vector112 = new Vector2(proj.ai[0], proj.ai[1]);
31998 Vector2 v = proj.position - vector112;
31999 float num420 = (float)Math.Sqrt(v.X * v.X + v.Y * v.Y);
32000 new Vector2(4f, num420);
32001 float rotation30 = v.ToRotation() + (float)Math.PI / 2f;
32002 Vector2 vector113 = Vector2.Lerp(proj.position, vector112, 0.5f);
32004 red.A = 0;
32006 red *= proj.localAI[0];
32007 white6 *= proj.localAI[0];
32008 float num421 = (float)Math.Sqrt(proj.damage / 50);
32012 return;
32013 }
32014 if (proj.type == 94 && proj.ai[1] > 6f)
32015 {
32016 for (int num422 = 0; num422 < 10; num422++)
32017 {
32019 float num423 = (float)(9 - num422) / 9f;
32020 alpha13.R = (byte)((float)(int)alpha13.R * num423);
32021 alpha13.G = (byte)((float)(int)alpha13.G * num423);
32022 alpha13.B = (byte)((float)(int)alpha13.B * num423);
32023 alpha13.A = (byte)((float)(int)alpha13.A * num423);
32024 float num424 = (float)(9 - num422) / 9f;
32025 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.oldPos[num422].X - screenPosition.X + num138 + (float)num137, proj.oldPos[num422].Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), alpha13, proj.rotation, new Vector2(num138, proj.height / 2 + num136), num424 * proj.scale, dir);
32026 }
32027 }
32028 if (proj.type == 301)
32029 {
32030 for (int num425 = 0; num425 < 10; num425++)
32031 {
32033 float num426 = (float)(9 - num425) / 9f;
32034 alpha14.R = (byte)((float)(int)alpha14.R * num426);
32035 alpha14.G = (byte)((float)(int)alpha14.G * num426);
32036 alpha14.B = (byte)((float)(int)alpha14.B * num426);
32037 alpha14.A = (byte)((float)(int)alpha14.A * num426);
32038 float num427 = (float)(9 - num425) / 9f;
32039 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.oldPos[num425].X - screenPosition.X + num138 + (float)num137, proj.oldPos[num425].Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), alpha14, proj.rotation, new Vector2(num138, proj.height / 2 + num136), num427 * proj.scale, dir);
32040 }
32041 }
32042 if (proj.type == 323 && proj.alpha == 0)
32043 {
32044 for (int num428 = 1; num428 < 8; num428++)
32045 {
32046 float num429 = proj.velocity.X * (float)num428;
32047 float num430 = proj.velocity.Y * (float)num428;
32049 float num431 = 0f;
32050 if (num428 == 1)
32051 {
32052 num431 = 0.7f;
32053 }
32054 if (num428 == 2)
32055 {
32056 num431 = 0.6f;
32057 }
32058 if (num428 == 3)
32059 {
32060 num431 = 0.5f;
32061 }
32062 if (num428 == 4)
32063 {
32064 num431 = 0.4f;
32065 }
32066 if (num428 == 5)
32067 {
32068 num431 = 0.3f;
32069 }
32070 if (num428 == 6)
32071 {
32072 num431 = 0.2f;
32073 }
32074 if (num428 == 7)
32075 {
32076 num431 = 0.1f;
32077 }
32078 alpha15.R = (byte)((float)(int)alpha15.R * num431);
32079 alpha15.G = (byte)((float)(int)alpha15.G * num431);
32080 alpha15.B = (byte)((float)(int)alpha15.B * num431);
32081 alpha15.A = (byte)((float)(int)alpha15.A * num431);
32082 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137 - num429, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY - num430), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), alpha15, proj.rotation, new Vector2(num138, proj.height / 2 + num136), num431 + 0.2f, dir);
32083 }
32084 }
32085 if (proj.type == 117 && proj.ai[0] > 3f)
32086 {
32087 for (int num432 = 1; num432 < 5; num432++)
32088 {
32089 float num433 = proj.velocity.X * (float)num432;
32090 float num434 = proj.velocity.Y * (float)num432;
32092 float num435 = 0f;
32093 if (num432 == 1)
32094 {
32095 num435 = 0.4f;
32096 }
32097 if (num432 == 2)
32098 {
32099 num435 = 0.3f;
32100 }
32101 if (num432 == 3)
32102 {
32103 num435 = 0.2f;
32104 }
32105 if (num432 == 4)
32106 {
32107 num435 = 0.1f;
32108 }
32109 alpha16.R = (byte)((float)(int)alpha16.R * num435);
32110 alpha16.G = (byte)((float)(int)alpha16.G * num435);
32111 alpha16.B = (byte)((float)(int)alpha16.B * num435);
32112 alpha16.A = (byte)((float)(int)alpha16.A * num435);
32113 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137 - num433, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY - num434), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), alpha16, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32114 }
32115 }
32116 if (proj.bobber)
32117 {
32118 if (proj.ai[1] > 0f && proj.ai[1] < (float)ItemID.Count && proj.ai[0] == 1f)
32119 {
32120 int num436 = (int)proj.ai[1];
32121 Vector2 center5 = proj.Center;
32122 float rotation31 = proj.rotation;
32124 float num437 = polePosX - vector114.X;
32125 float num438 = polePosY - vector114.Y;
32126 rotation31 = (float)Math.Atan2(num438, num437);
32127 if (proj.velocity.X > 0f)
32128 {
32129 dir = SpriteEffects.None;
32130 rotation31 = (float)Math.Atan2(num438, num437);
32131 rotation31 += 0.785f;
32132 if (proj.ai[1] == 2342f)
32133 {
32134 rotation31 -= 0.785f;
32135 }
32136 }
32137 else
32138 {
32139 dir = SpriteEffects.FlipHorizontally;
32140 rotation31 = (float)Math.Atan2(0f - num438, 0f - num437);
32141 rotation31 -= 0.785f;
32142 if (proj.ai[1] == 2342f)
32143 {
32144 rotation31 += 0.785f;
32145 }
32146 }
32147 instance.LoadItem(num436);
32150 if (ItemID.Sets.IsFood[num436] && itemAnimations[num436] != null)
32151 {
32152 value113 = itemAnimations[num436].GetFrame(value112, 0);
32153 }
32155 }
32156 else if (proj.ai[0] <= 1f)
32157 {
32158 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32159 if (proj.glowMask != -1)
32160 {
32161 Texture2D value114 = TextureAssets.GlowMask[proj.glowMask].Value;
32163 if (proj.type == 993)
32164 {
32166 }
32167 EntitySpriteDraw(value114, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, 0, value114.Width, value114.Height), proj.GetAlpha(newColor5), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32168 }
32169 }
32170 }
32171 else
32172 {
32173 if (proj.ownerHitCheck && Main.player[proj.owner].gravDir == -1f)
32174 {
32175 if (Main.player[proj.owner].direction == 1)
32176 {
32177 dir = SpriteEffects.FlipHorizontally;
32178 }
32179 else if (Main.player[proj.owner].direction == -1)
32180 {
32181 dir = SpriteEffects.None;
32182 }
32183 }
32184 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), proj.GetAlpha(projectileColor), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32185 if (proj.glowMask != -1)
32186 {
32187 EntitySpriteDraw(TextureAssets.GlowMask[proj.glowMask].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), new Microsoft.Xna.Framework.Color(250, 250, 250, proj.alpha), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32188 }
32189 if (proj.type == 473)
32190 {
32191 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), new Microsoft.Xna.Framework.Color(255, 255, 0, 0), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32192 }
32193 if (proj.type >= 511 && proj.type <= 513)
32194 {
32195 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), proj.GetAlpha(projectileColor) * 0.25f, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale * (1f + proj.Opacity * 1.75f), dir);
32196 }
32197 if (proj.type == 312)
32198 {
32199 ulong seed3 = TileFrameSeed;
32200 for (int num439 = 0; num439 < 4; num439++)
32201 {
32203 EntitySpriteDraw(TextureAssets.GlowMask[proj.glowMask].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY) + vector115, new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), new Microsoft.Xna.Framework.Color(255, 255, 255, 255) * 0.2f, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32204 }
32205 }
32206 }
32207 if (proj.type == 106)
32208 {
32210 Vector2 position26 = new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2));
32212 EntitySpriteDraw(value115, position26, value116, new Microsoft.Xna.Framework.Color(200, 200, 200, 0), proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32213 }
32214 if (proj.type >= 326 && proj.type <= 328)
32215 {
32216 ulong seed4 = TileFrameSeed;
32217 for (int num440 = 0; num440 < 4; num440++)
32218 {
32220 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137, proj.position.Y - screenPosition.Y + (float)(proj.height / 2)) + vector116 - proj.velocity * 0.25f * num440, new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), new Microsoft.Xna.Framework.Color(120, 120, 120, 60) * 1f, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale - (float)num440 * 0.2f, dir);
32221 }
32222 }
32223 if (proj.type == 554 || proj.type == 603)
32224 {
32225 for (int num441 = 1; num441 < 5; num441++)
32226 {
32227 float num442 = proj.velocity.X * (float)num441 * 0.5f;
32228 float num443 = proj.velocity.Y * (float)num441 * 0.5f;
32230 float num444 = 0f;
32231 if (num441 == 1)
32232 {
32233 num444 = 0.4f;
32234 }
32235 if (num441 == 2)
32236 {
32237 num444 = 0.3f;
32238 }
32239 if (num441 == 3)
32240 {
32241 num444 = 0.2f;
32242 }
32243 if (num441 == 4)
32244 {
32245 num444 = 0.1f;
32246 }
32247 alpha17.R = (byte)((float)(int)alpha17.R * num444);
32248 alpha17.G = (byte)((float)(int)alpha17.G * num444);
32249 alpha17.B = (byte)((float)(int)alpha17.B * num444);
32250 alpha17.A = (byte)((float)(int)alpha17.A * num444);
32251 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137 - num442, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY - num443), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), alpha17, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32252 }
32253 }
32254 else if (proj.type == 604)
32255 {
32256 int num445 = (int)proj.ai[1] + 1;
32257 if (num445 > 7)
32258 {
32259 num445 = 7;
32260 }
32261 for (int num446 = 1; num446 < num445; num446++)
32262 {
32263 float num447 = proj.velocity.X * (float)num446 * 1.5f;
32264 float num448 = proj.velocity.Y * (float)num446 * 1.5f;
32266 float num449 = 0f;
32267 if (num446 == 1)
32268 {
32269 num449 = 0.4f;
32270 }
32271 if (num446 == 2)
32272 {
32273 num449 = 0.3f;
32274 }
32275 if (num446 == 3)
32276 {
32277 num449 = 0.2f;
32278 }
32279 if (num446 == 4)
32280 {
32281 num449 = 0.1f;
32282 }
32283 num449 = 0.4f - (float)num446 * 0.06f;
32284 num449 *= 1f - (float)proj.alpha / 255f;
32285 alpha18.R = (byte)((float)(int)alpha18.R * num449);
32286 alpha18.G = (byte)((float)(int)alpha18.G * num449);
32287 alpha18.B = (byte)((float)(int)alpha18.B * num449);
32288 alpha18.A = (byte)((float)(int)alpha18.A * num449 / 2f);
32289 float scale15 = proj.scale;
32290 scale15 -= (float)num446 * 0.1f;
32291 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137 - num447, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY - num448), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), alpha18, proj.rotation, new Vector2(num138, proj.height / 2 + num136), scale15, dir);
32292 }
32293 }
32294 else
32295 {
32296 if (proj.type != 553)
32297 {
32298 return;
32299 }
32300 for (int num450 = 1; num450 < 5; num450++)
32301 {
32302 float num451 = proj.velocity.X * (float)num450 * 0.4f;
32303 float num452 = proj.velocity.Y * (float)num450 * 0.4f;
32305 float num453 = 0f;
32306 if (num450 == 1)
32307 {
32308 num453 = 0.4f;
32309 }
32310 if (num450 == 2)
32311 {
32312 num453 = 0.3f;
32313 }
32314 if (num450 == 3)
32315 {
32316 num453 = 0.2f;
32317 }
32318 if (num450 == 4)
32319 {
32320 num453 = 0.1f;
32321 }
32322 alpha19.R = (byte)((float)(int)alpha19.R * num453);
32323 alpha19.G = (byte)((float)(int)alpha19.G * num453);
32324 alpha19.B = (byte)((float)(int)alpha19.B * num453);
32325 alpha19.A = (byte)((float)(int)alpha19.A * num453);
32326 EntitySpriteDraw(TextureAssets.Projectile[proj.type].Value, new Vector2(proj.position.X - screenPosition.X + num138 + (float)num137 - num451, proj.position.Y - screenPosition.Y + (float)(proj.height / 2) + proj.gfxOffY - num452), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[proj.type].Width(), TextureAssets.Projectile[proj.type].Height()), alpha19, proj.rotation, new Vector2(num138, proj.height / 2 + num136), proj.scale, dir);
32327 }
32328 }
32329 }
32330 }
32331
32333 {
32334 bool flag = proj.ai[0] == 1f;
32335 float num = 60f;
32336 float num2 = 12f;
32337 float fromMax = num + num2;
32340 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(255, 80, 20, 200);
32344 float num3 = 0.35f;
32345 float num4 = 0.7f;
32346 float num5 = 0.85f;
32347 float num6 = ((proj.localAI[0] > num - 10f) ? 0.175f : 0.2f);
32348 if (flag)
32349 {
32350 color = new Microsoft.Xna.Framework.Color(95, 120, 255, 200);
32351 color2 = new Microsoft.Xna.Framework.Color(50, 180, 255, 70);
32352 color3 = new Microsoft.Xna.Framework.Color(95, 160, 255, 100);
32353 color4 = new Microsoft.Xna.Framework.Color(33, 125, 202, 100);
32354 }
32355 int num7 = 3;
32356 int num8 = 2;
32357 int verticalFrames = 7;
32358 float num9 = Utils.Remap(proj.localAI[0], num, fromMax, 1f, 0f);
32359 float num10 = Math.Min(proj.localAI[0], 20f);
32360 float num11 = Utils.Remap(proj.localAI[0], 0f, fromMax, 0f, 1f);
32361 float num12 = Utils.Remap(num11, 0.2f, 0.5f, 0.25f, 1f);
32362 Microsoft.Xna.Framework.Rectangle rectangle = ((!flag) ? value.Frame(1, verticalFrames, 0, 3) : value.Frame(1, verticalFrames, 0, (int)Utils.Remap(num11, 0.5f, 1f, 3f, 5f)));
32363 if (!(num11 < 1f))
32364 {
32365 return;
32366 }
32367 for (int i = 0; i < 2; i++)
32368 {
32369 for (float num13 = 1f; num13 >= 0f; num13 -= num6)
32370 {
32372 float num14 = (1f - num13) * Utils.Remap(num11, 0f, 0.2f, 0f, 1f);
32373 Vector2 vector = proj.Center - screenPosition + proj.velocity * (0f - num10) * num13;
32376 if (!flag)
32377 {
32378 color6.G /= 2;
32379 color6.B /= 2;
32380 color6.A = (byte)Math.Min((float)(int)color5.A + 80f * num14, 255f);
32381 Utils.Remap(proj.localAI[0], 20f, fromMax, 0f, 1f);
32382 }
32383 float num15 = 1f / num6 * (num13 + 1f);
32384 float num16 = proj.rotation + num13 * ((float)Math.PI / 2f) + GlobalTimeWrappedHourly * num15 * 2f;
32385 float num17 = proj.rotation - num13 * ((float)Math.PI / 2f) - GlobalTimeWrappedHourly * num15 * 2f;
32386 switch (i)
32387 {
32388 case 0:
32389 EntitySpriteDraw(value, vector + proj.velocity * (0f - num10) * num6 * 0.5f, rectangle, color6 * num9 * 0.25f, num16 + (float)Math.PI / 4f, rectangle.Size() / 2f, num12, SpriteEffects.None);
32391 break;
32392 case 1:
32393 if (!flag)
32394 {
32395 EntitySpriteDraw(value, vector + proj.velocity * (0f - num10) * num6 * 0.2f, rectangle, color5 * num9 * 0.25f, num16 + (float)Math.PI / 2f, rectangle.Size() / 2f, num12 * 0.75f, SpriteEffects.None);
32396 EntitySpriteDraw(value, vector, rectangle, color5 * num9, num17 + (float)Math.PI / 2f, rectangle.Size() / 2f, num12 * 0.75f, SpriteEffects.None);
32397 }
32398 break;
32399 }
32400 }
32401 }
32402 }
32403
32405 {
32406 dir = SpriteEffects.None;
32407 float num = (float)Math.Atan2(proj.velocity.Y, proj.velocity.X) + 2.355f;
32409 Player player = Main.player[proj.owner];
32413 if (player.direction > 0)
32414 {
32415 dir = SpriteEffects.FlipHorizontally;
32416 vector.X = val.Width();
32417 num -= (float)Math.PI / 2f;
32418 }
32419 if (player.gravDir == -1f)
32420 {
32421 if (proj.direction == 1)
32422 {
32423 dir = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
32424 vector = new Vector2(val.Width(), val.Height());
32425 num -= (float)Math.PI / 2f;
32426 }
32427 else if (proj.direction == -1)
32428 {
32429 dir = SpriteEffects.FlipVertically;
32430 vector = new Vector2(0f, val.Height());
32431 num += (float)Math.PI / 2f;
32432 }
32433 }
32434 Vector2.Lerp(vector, value.Center.ToVector2(), 0.25f);
32435 float num2 = 0f;
32436 Vector2 vector2 = proj.Center + new Vector2(0f, proj.gfxOffY);
32437 if (proj.AI_019_Spears_GetExtensionHitbox(out var extensionBox))
32438 {
32439 Vector2 value2 = player.RotatedRelativePoint(player.MountedCenter, reverseRotation: false, addGfxOffY: false);
32440 float num3 = extensionBox.Size().Length() / proj.Hitbox.Size().Length();
32441 _ = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 1f;
32442 float num4 = Utils.Remap(player.itemAnimation, player.itemAnimationMax, (float)player.itemAnimationMax / 3f, 0f, 1f);
32443 float num5 = Utils.Remap(num4, 0f, 0.3f, 0f, 1f) * Utils.Remap(num4, 0.3f, 1f, 1f, 0f);
32444 num5 = 1f - (1f - num5) * (1f - num5);
32445 Vector2 vector3 = extensionBox.Center.ToVector2() + new Vector2(0f, proj.gfxOffY);
32446 Vector2.Lerp(value2, vector3, 1.1f);
32447 Texture2D value3 = TextureAssets.Extra[98].Value;
32448 Vector2 origin = value3.Size() / 2f;
32449 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.5f;
32450 switch (proj.type)
32451 {
32452 case 105:
32453 color = new Microsoft.Xna.Framework.Color(255, 220, 80, 0);
32454 break;
32455 case 46:
32456 color = new Microsoft.Xna.Framework.Color(180, 80, 255, 0);
32457 break;
32458 case 342:
32459 color = new Microsoft.Xna.Framework.Color(80, 140, 255, 0);
32460 break;
32461 case 153:
32462 color = new Microsoft.Xna.Framework.Color(255, 50, 30, 15);
32463 break;
32464 }
32465 float num6 = num - (float)Math.PI / 4f * (float)proj.spriteDirection;
32466 if (player.gravDir < 0f)
32467 {
32468 num6 -= (float)Math.PI / 2f * (float)proj.spriteDirection;
32469 }
32470 EntitySpriteDraw(value3, Vector2.Lerp(vector3, vector2, 0.5f) - screenPosition, null, color * num5, num6, origin, new Vector2(num5 * num3, num3) * proj.scale * num3, dir);
32471 EntitySpriteDraw(value3, Vector2.Lerp(vector3, vector2, 1f) - screenPosition, null, color * num5, num6, origin, new Vector2(num5 * num3, num3 * 1.5f) * proj.scale * num3, dir);
32472 EntitySpriteDraw(value3, Vector2.Lerp(value2, vector2, num4 * 1.5f - 0.5f) - screenPosition + new Vector2(0f, 2f), null, color * num5, num6, origin, new Vector2(num5 * num3 * 1f * num5, num3 * 2f * num5) * proj.scale * num3, dir);
32473 for (float num7 = 0.4f; num7 <= 1f; num7 += 0.1f)
32474 {
32476 EntitySpriteDraw(value3, vector4 - screenPosition + new Vector2(0f, 2f), null, color * num5 * 0.75f * num7, num6, origin, new Vector2(num5 * num3 * 1f * num5, num3 * 2f * num5) * proj.scale * num3, dir);
32477 }
32478 extensionBox.Offset((int)(0f - screenPosition.X), (int)(0f - screenPosition.Y));
32479 }
32480 EntitySpriteDraw(val.Value, vector2 - screenPosition, value, proj.GetAlpha(projectileColor), num, vector, proj.scale, dir);
32481 rect.Offset((int)(0f - screenPosition.X), (int)(0f - screenPosition.Y));
32483 }
32484
32486 {
32487 Texture2D value = TextureAssets.Extra[98].Value;
32489 color.A = 0;
32490 Vector2 origin = value.Size() / 2f;
32493 Vector2 vector = new Vector2(fatness.X * 0.5f, scale.X) * num;
32494 Vector2 vector2 = new Vector2(fatness.Y * 0.5f, scale.Y) * num;
32495 color *= num;
32496 color2 *= num;
32497 EntitySpriteDraw(value, drawpos, null, color, (float)Math.PI / 2f + rotation, origin, vector, dir);
32498 EntitySpriteDraw(value, drawpos, null, color, 0f + rotation, origin, vector2, dir);
32499 EntitySpriteDraw(value, drawpos, null, color2, (float)Math.PI / 2f + rotation, origin, vector * 0.6f, dir);
32500 EntitySpriteDraw(value, drawpos, null, color2, 0f + rotation, origin, vector2 * 0.6f, dir);
32501 }
32502
32504 {
32505 Player player = Main.player[proj.owner];
32507 playerArmPosition -= Vector2.UnitY * player.gfxOffY;
32508 Asset<Texture2D> val = null;
32510 float num = 0f;
32511 switch (proj.type)
32512 {
32513 default:
32514 val = TextureAssets.Chain3;
32515 break;
32516 case 25:
32517 val = TextureAssets.Chain2;
32518 break;
32519 case 35:
32520 val = TextureAssets.Chain6;
32521 break;
32522 case 63:
32523 val = TextureAssets.Chain7;
32524 break;
32525 case 154:
32526 val = TextureAssets.Chain13;
32527 break;
32528 case 247:
32529 val = TextureAssets.Chain19;
32530 break;
32531 case 757:
32532 val = TextureAssets.Extra[99];
32533 sourceRectangle = val.Frame(1, 6);
32534 num = -2f;
32535 break;
32536 case 947:
32537 val = TextureAssets.Chain41;
32538 break;
32539 case 948:
32540 val = TextureAssets.Chain43;
32541 break;
32542 }
32543 Vector2 origin = (sourceRectangle.HasValue ? (sourceRectangle.Value.Size() / 2f) : (val.Size() / 2f));
32544 Vector2 center = proj.Center;
32545 Vector2 v = playerArmPosition.MoveTowards(center, 4f) - center;
32546 Vector2 vector = v.SafeNormalize(Vector2.Zero);
32547 float num2 = (float)(sourceRectangle.HasValue ? sourceRectangle.Value.Height : val.Height()) + num;
32548 float rotation = vector.ToRotation() + (float)Math.PI / 2f;
32549 int num3 = 0;
32550 float num4 = v.Length() + num2 / 2f;
32551 int num5 = 0;
32552 while (num4 > 0f)
32553 {
32554 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)center.X / 16, (int)(center.Y / 16f));
32555 switch (proj.type)
32556 {
32557 case 757:
32558 sourceRectangle = val.Frame(1, 6, 0, num3 % 6);
32559 break;
32560 case 948:
32561 if (num5 >= 6)
32562 {
32563 val = (val = TextureAssets.Chain41);
32564 }
32565 else if (num5 >= 4)
32566 {
32567 val = (val = TextureAssets.Chain42);
32568 byte b = 140;
32569 if (color.R < b)
32570 {
32571 color.R = b;
32572 }
32573 if (color.G < b)
32574 {
32575 color.G = b;
32576 }
32577 if (color.B < b)
32578 {
32579 color.B = b;
32580 }
32581 }
32582 else
32583 {
32585 }
32586 num5++;
32587 break;
32588 }
32589 spriteBatch.Draw(val.Value, center - screenPosition, sourceRectangle, color, rotation, origin, 1f, SpriteEffects.None, 0f);
32590 center += vector * num2;
32591 num3++;
32592 num4 -= num2;
32593 }
32594 }
32595
32597 {
32598 Vector2 vector = new Vector2(proj.position.X + (float)proj.width * 0.5f, proj.position.Y + (float)proj.height * 0.5f);
32599 float num = mountedCenter.X - vector.X;
32600 float num2 = mountedCenter.Y - vector.Y;
32601 float rotation = (float)Math.Atan2(num2, num) - 1.57f;
32602 if (proj.alpha == 0)
32603 {
32604 int num3 = -1;
32605 if (proj.position.X + (float)(proj.width / 2) < mountedCenter.X)
32606 {
32607 num3 = 1;
32608 }
32609 if (player[proj.owner].direction == 1)
32610 {
32611 player[proj.owner].itemRotation = (float)Math.Atan2(num2 * (float)num3, num * (float)num3);
32612 }
32613 else
32614 {
32615 player[proj.owner].itemRotation = (float)Math.Atan2(num2 * (float)num3, num * (float)num3);
32616 }
32617 }
32618 bool flag = true;
32619 int num4 = 0;
32620 int num5 = 25;
32621 if (proj.type == 757)
32622 {
32623 num5 = 12;
32624 }
32625 while (flag)
32626 {
32627 float num6 = (float)Math.Sqrt(num * num + num2 * num2);
32628 if (num6 < (float)num5)
32629 {
32630 flag = false;
32631 }
32632 else if (float.IsNaN(num6))
32633 {
32634 flag = false;
32635 }
32636 else
32637 {
32638 num6 = ((proj.type == 154 || proj.type == 247) ? (18f / num6) : ((proj.type != 757) ? (12f / num6) : (16f / num6)));
32639 num *= num6;
32640 num2 *= num6;
32641 vector.X += num;
32642 vector.Y += num2;
32643 num = mountedCenter.X - vector.X;
32644 num2 = mountedCenter.Y - vector.Y;
32645 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f));
32646 if (proj.type == 25)
32647 {
32648 EntitySpriteDraw(TextureAssets.Chain2.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain2.Width(), TextureAssets.Chain2.Height()), color, rotation, new Vector2((float)TextureAssets.Chain2.Width() * 0.5f, (float)TextureAssets.Chain2.Height() * 0.5f), 1f, SpriteEffects.None);
32649 }
32650 else if (proj.type == 35)
32651 {
32652 EntitySpriteDraw(TextureAssets.Chain6.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain6.Width(), TextureAssets.Chain6.Height()), color, rotation, new Vector2((float)TextureAssets.Chain6.Width() * 0.5f, (float)TextureAssets.Chain6.Height() * 0.5f), 1f, SpriteEffects.None);
32653 }
32654 else if (proj.type == 757)
32655 {
32656 Texture2D value = TextureAssets.Extra[99].Value;
32657 Microsoft.Xna.Framework.Rectangle r = value.Frame(1, 6, 0, num4 % 6);
32658 EntitySpriteDraw(value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), value.Frame(1, 6, 0, num4 % 6), color, rotation, r.Size() / 2f, 1f, SpriteEffects.None);
32659 }
32660 else if (proj.type == 247)
32661 {
32662 EntitySpriteDraw(TextureAssets.Chain19.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain19.Width(), TextureAssets.Chain19.Height()), color, rotation, new Vector2((float)TextureAssets.Chain19.Width() * 0.5f, (float)TextureAssets.Chain19.Height() * 0.5f), 1f, SpriteEffects.None);
32663 }
32664 else if (proj.type == 63)
32665 {
32666 EntitySpriteDraw(TextureAssets.Chain7.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain7.Width(), TextureAssets.Chain7.Height()), color, rotation, new Vector2((float)TextureAssets.Chain7.Width() * 0.5f, (float)TextureAssets.Chain7.Height() * 0.5f), 1f, SpriteEffects.None);
32667 }
32668 else if (proj.type == 154)
32669 {
32670 EntitySpriteDraw(TextureAssets.Chain13.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain13.Width(), TextureAssets.Chain13.Height()), color, rotation, new Vector2((float)TextureAssets.Chain13.Width() * 0.5f, (float)TextureAssets.Chain13.Height() * 0.5f), 1f, SpriteEffects.None);
32671 }
32672 else
32673 {
32674 EntitySpriteDraw(TextureAssets.Chain3.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain3.Width(), TextureAssets.Chain3.Height()), color, rotation, new Vector2((float)TextureAssets.Chain3.Width() * 0.5f, (float)TextureAssets.Chain3.Height() * 0.5f), 1f, SpriteEffects.None);
32675 }
32676 }
32677 num4++;
32678 }
32679 }
32680
32682 {
32683 if (playerStringColor > 0)
32684 {
32685 stringColor = WorldGen.paintColor(playerStringColor);
32686 if (stringColor.R < 75)
32687 {
32688 stringColor.R = 75;
32689 }
32690 if (stringColor.G < 75)
32691 {
32692 stringColor.G = 75;
32693 }
32694 if (stringColor.B < 75)
32695 {
32696 stringColor.B = 75;
32697 }
32698 switch (playerStringColor)
32699 {
32700 case 13:
32701 stringColor = new Microsoft.Xna.Framework.Color(20, 20, 20);
32702 break;
32703 case 0:
32704 case 14:
32705 stringColor = new Microsoft.Xna.Framework.Color(200, 200, 200);
32706 break;
32707 case 28:
32708 stringColor = new Microsoft.Xna.Framework.Color(163, 116, 91);
32709 break;
32710 case 27:
32711 stringColor = new Microsoft.Xna.Framework.Color(DiscoR, DiscoG, DiscoB);
32712 break;
32713 }
32714 stringColor.A = (byte)((float)(int)stringColor.A * 0.4f);
32715 }
32716 return stringColor;
32717 }
32718
32720 {
32721 Player player = Main.player[proj.owner];
32724 polePosY += player.gfxOffY;
32725 if (player.mount.Active && player.mount.Type == 52)
32726 {
32727 polePosX -= player.direction * 14;
32728 polePosY -= -10f;
32729 }
32730 int type = player.inventory[player.selectedItem].type;
32731 Microsoft.Xna.Framework.Color stringColor = new Microsoft.Xna.Framework.Color(200, 200, 200, 100);
32732 if (type == 2294)
32733 {
32734 stringColor = new Microsoft.Xna.Framework.Color(100, 180, 230, 100);
32735 }
32736 if (type == 2295)
32737 {
32738 stringColor = new Microsoft.Xna.Framework.Color(250, 90, 70, 100);
32739 }
32740 if (type == 2293)
32741 {
32742 stringColor = new Microsoft.Xna.Framework.Color(203, 190, 210, 100);
32743 }
32744 if (type == 2421)
32745 {
32746 stringColor = new Microsoft.Xna.Framework.Color(183, 77, 112, 100);
32747 }
32748 if (type == 2422)
32749 {
32750 stringColor = new Microsoft.Xna.Framework.Color(255, 226, 116, 100);
32751 }
32752 if (type == 4325)
32753 {
32754 stringColor = new Microsoft.Xna.Framework.Color(200, 100, 100, 100);
32755 }
32756 if (type == 4442)
32757 {
32758 stringColor = new Microsoft.Xna.Framework.Color(100, 100, 200, 100);
32759 }
32760 stringColor = TryApplyingPlayerStringColor(Main.player[proj.owner].stringColor, stringColor);
32761 float gravDir = Main.player[proj.owner].gravDir;
32762 switch (type)
32763 {
32764 case 2289:
32765 polePosX += 43 * Main.player[proj.owner].direction;
32766 if (Main.player[proj.owner].direction < 0)
32767 {
32768 polePosX -= 13f;
32769 }
32770 polePosY -= 36f * gravDir;
32771 break;
32772 case 2291:
32773 polePosX += 43 * Main.player[proj.owner].direction;
32774 if (Main.player[proj.owner].direction < 0)
32775 {
32776 polePosX -= 13f;
32777 }
32778 polePosY -= 34f * gravDir;
32779 break;
32780 case 2292:
32781 polePosX += 46 * Main.player[proj.owner].direction;
32782 if (Main.player[proj.owner].direction < 0)
32783 {
32784 polePosX -= 13f;
32785 }
32786 polePosY -= 34f * gravDir;
32787 break;
32788 case 2293:
32789 polePosX += 43 * Main.player[proj.owner].direction;
32790 if (Main.player[proj.owner].direction < 0)
32791 {
32792 polePosX -= 13f;
32793 }
32794 polePosY -= 34f * gravDir;
32795 break;
32796 case 2294:
32797 polePosX += 43 * Main.player[proj.owner].direction;
32798 if (Main.player[proj.owner].direction < 0)
32799 {
32800 polePosX -= 13f;
32801 }
32802 polePosY -= 30f * gravDir;
32803 break;
32804 case 2295:
32805 polePosX += 43 * Main.player[proj.owner].direction;
32806 if (Main.player[proj.owner].direction < 0)
32807 {
32808 polePosX -= 13f;
32809 }
32810 polePosY -= 30f * gravDir;
32811 break;
32812 case 2296:
32813 polePosX += 43 * Main.player[proj.owner].direction;
32814 if (Main.player[proj.owner].direction < 0)
32815 {
32816 polePosX -= 13f;
32817 }
32818 polePosY -= 30f * gravDir;
32819 break;
32820 case 2421:
32821 polePosX += 47 * Main.player[proj.owner].direction;
32822 if (Main.player[proj.owner].direction < 0)
32823 {
32824 polePosX -= 13f;
32825 }
32826 polePosY -= 36f * gravDir;
32827 break;
32828 case 2422:
32829 polePosX += 47 * Main.player[proj.owner].direction;
32830 if (Main.player[proj.owner].direction < 0)
32831 {
32832 polePosX -= 13f;
32833 }
32834 polePosY -= 32f * gravDir;
32835 break;
32836 case 4325:
32837 polePosX += 44 * Main.player[proj.owner].direction;
32838 if (Main.player[proj.owner].direction < 0)
32839 {
32840 polePosX -= 13f;
32841 }
32842 polePosY -= 32f * gravDir;
32843 break;
32844 case 4442:
32845 polePosX += 44 * Main.player[proj.owner].direction;
32846 if (Main.player[proj.owner].direction < 0)
32847 {
32848 polePosX -= 13f;
32849 }
32850 polePosY -= 32f * gravDir;
32851 break;
32852 }
32853 if (gravDir == -1f)
32854 {
32855 polePosY -= 12f;
32856 }
32858 vector = Main.player[proj.owner].RotatedRelativePoint(vector + new Vector2(8f)) - new Vector2(8f);
32859 float num = proj.position.X + (float)proj.width * 0.5f - vector.X;
32860 float num2 = proj.position.Y + (float)proj.height * 0.5f - vector.Y;
32861 Math.Sqrt(num * num + num2 * num2);
32862 float num3 = (float)Math.Atan2(num2, num) - 1.57f;
32863 bool flag = true;
32864 if (num == 0f && num2 == 0f)
32865 {
32866 flag = false;
32867 }
32868 else
32869 {
32870 float num4 = (float)Math.Sqrt(num * num + num2 * num2);
32871 num4 = 12f / num4;
32872 num *= num4;
32873 num2 *= num4;
32874 vector.X -= num;
32875 vector.Y -= num2;
32876 num = proj.position.X + (float)proj.width * 0.5f - vector.X;
32877 num2 = proj.position.Y + (float)proj.height * 0.5f - vector.Y;
32878 }
32879 while (flag)
32880 {
32881 float num5 = 12f;
32882 float num6 = (float)Math.Sqrt(num * num + num2 * num2);
32883 float num7 = num6;
32884 if (float.IsNaN(num6) || float.IsNaN(num7))
32885 {
32886 flag = false;
32887 continue;
32888 }
32889 if (num6 < 20f)
32890 {
32891 num5 = num6 - 8f;
32892 flag = false;
32893 }
32894 num6 = 12f / num6;
32895 num *= num6;
32896 num2 *= num6;
32897 vector.X += num;
32898 vector.Y += num2;
32899 num = proj.position.X + (float)proj.width * 0.5f - vector.X;
32900 num2 = proj.position.Y + (float)proj.height * 0.1f - vector.Y;
32901 if (num7 > 12f)
32902 {
32903 float num8 = 0.3f;
32904 float num9 = Math.Abs(proj.velocity.X) + Math.Abs(proj.velocity.Y);
32905 if (num9 > 16f)
32906 {
32907 num9 = 16f;
32908 }
32909 num9 = 1f - num9 / 16f;
32910 num8 *= num9;
32911 num9 = num7 / 80f;
32912 if (num9 > 1f)
32913 {
32914 num9 = 1f;
32915 }
32916 num8 *= num9;
32917 if (num8 < 0f)
32918 {
32919 num8 = 0f;
32920 }
32921 num9 = 1f - proj.localAI[0] / 100f;
32922 num8 *= num9;
32923 if (num2 > 0f)
32924 {
32925 num2 *= 1f + num8;
32926 num *= 1f - num8;
32927 }
32928 else
32929 {
32930 num9 = Math.Abs(proj.velocity.X) / 3f;
32931 if (num9 > 1f)
32932 {
32933 num9 = 1f;
32934 }
32935 num9 -= 0.5f;
32936 num8 *= num9;
32937 if (num8 > 0f)
32938 {
32939 num8 *= 2f;
32940 }
32941 num2 *= 1f + num8;
32942 num *= 1f - num8;
32943 }
32944 }
32945 num3 = (float)Math.Atan2(num2, num) - 1.57f;
32946 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f), stringColor);
32947 EntitySpriteDraw(TextureAssets.FishingLine.Value, new Vector2(vector.X - screenPosition.X + (float)TextureAssets.FishingLine.Width() * 0.5f, vector.Y - screenPosition.Y + (float)TextureAssets.FishingLine.Height() * 0.5f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.FishingLine.Width(), (int)num5), color, num3, new Vector2((float)TextureAssets.FishingLine.Width() * 0.5f, 0f), 1f, SpriteEffects.None);
32948 }
32949 }
32950
32952 {
32953 if (!gamePaused)
32954 {
32955 int num = 6;
32956 Texture2D value = TextureAssets.Extra[46].Value;
32957 int num2 = 20;
32958 Vector2 vector = proj.Center - proj.rotation.ToRotationVector2() * num2 * proj.spriteDirection;
32959 for (int i = 0; i < num; i++)
32960 {
32961 float num3 = rand.NextFloat();
32962 float num4 = Utils.GetLerpValue(0f, 0.3f, num3, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num3, clamped: true);
32963 float amount = Utils.GetLerpValue(0f, 0.3f, num3, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num3, clamped: true);
32964 float num5 = MathHelper.Lerp(0.6f, 1f, amount);
32965 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(255, 255, 255, 127);
32966 color *= num4 * 0.5f;
32967 Vector2 origin = value.Size() / 2f;
32968 Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.White * num4;
32969 color2.A /= 2;
32971 float num6 = 1f;
32972 float num7 = 1f + rand.NextFloat() * 0.5f;
32973 float num8 = rand.NextFloatDirection();
32974 Vector2 vector2 = new Vector2(0.8f) * num7 * num6 * num5;
32975 float num9 = 20f + MathHelper.Lerp(0f, 20f, num3) + num7 * 16f;
32976 float num10 = proj.rotation + ((proj.direction == 1) ? 0f : ((float)Math.PI)) + num8 * ((float)Math.PI * 2f) * 0.04f;
32977 float rotation = num10 + (float)Math.PI / 2f;
32978 Vector2 position = vector + num10.ToRotationVector2() * num9 + rand.NextVector2Circular(20f, 20f) - screenPosition;
32979 color *= num6;
32980 color3 *= num6;
32981 SpriteEffects effects = SpriteEffects.None;
32982 spriteBatch.Draw(value, position, null, color, rotation, origin, vector2, effects, 0f);
32983 spriteBatch.Draw(value, position, null, color3, rotation, origin, vector2 * 0.8f, effects, 0f);
32984 }
32985 }
32986 }
32987
32989 {
32990 float num = proj.ai[1];
32991 if (num == 0f)
32992 {
32993 num = 1f;
32994 }
32995 int num2 = (int)Math.Ceiling(3f * num);
32996 LoadProjectile(proj.type);
32997 LoadItem(4923);
32998 int num3 = 2;
32999 Vector2 vector = proj.Center - proj.rotation.ToRotationVector2() * num3;
33000 for (int i = 0; i < 1; i++)
33001 {
33002 float num4 = rand.NextFloat();
33003 float num5 = Utils.GetLerpValue(0f, 0.3f, num4, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num4, clamped: true);
33004 Microsoft.Xna.Framework.Color color = proj.GetAlpha(Lighting.GetColor(proj.Center.ToTileCoordinates())) * num5;
33005 Texture2D value = TextureAssets.Item[4923].Value;
33006 Vector2 origin = value.Size() / 2f;
33007 float num6 = rand.NextFloatDirection();
33008 float num7 = 8f + MathHelper.Lerp(0f, 20f, num4) + rand.NextFloat() * 6f;
33009 float num8 = proj.rotation + num6 * ((float)Math.PI * 2f) * 0.04f;
33010 float num9 = num8 + (float)Math.PI / 4f;
33011 Vector2 position = vector + num8.ToRotationVector2() * num7 + rand.NextVector2Circular(8f, 8f) - screenPosition;
33013 if (proj.rotation < -(float)Math.PI / 2f || proj.rotation > (float)Math.PI / 2f)
33014 {
33015 num9 += (float)Math.PI / 2f;
33016 spriteEffects |= SpriteEffects.FlipHorizontally;
33017 }
33018 spriteBatch.Draw(value, position, null, color, num9, origin, 1f, spriteEffects, 0f);
33019 }
33020 for (int j = 0; j < num2; j++)
33021 {
33022 float num10 = rand.NextFloat();
33023 float num11 = Utils.GetLerpValue(0f, 0.3f, num10, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num10, clamped: true);
33024 float amount = Utils.GetLerpValue(0f, 0.3f, num10, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num10, clamped: true);
33025 float num12 = MathHelper.Lerp(0.6f, 1f, amount);
33026 Microsoft.Xna.Framework.Color fairyQueenWeaponsColor = proj.GetFairyQueenWeaponsColor(0.25f, 0f, (rand.NextFloat() * 0.33f + GlobalTimeWrappedHourly) % 1f);
33029 color2 *= num11 * 0.5f;
33030 Vector2 origin2 = value2.Size() / 2f;
33031 Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.White * num11;
33032 color3.A /= 2;
33034 float num13 = 1f;
33035 float num14 = (num - 1f) / 2f;
33036 float num15 = rand.NextFloat() * 2f * num;
33037 num15 += num14;
33038 float num16 = rand.NextFloatDirection();
33039 Vector2 vector2 = new Vector2(2.8f + num15 * (1f + num14), 1f) * num13 * num12;
33040 float value3 = 50f * num;
33041 Vector2 vector3 = proj.rotation.ToRotationVector2() * ((j >= 1) ? 56 : 0);
33042 float num17 = 0.03f - (float)j * 0.012f;
33043 num17 /= num;
33044 float num18 = 30f + MathHelper.Lerp(0f, value3, num10) + num15 * 16f;
33045 float num19 = proj.rotation + num16 * ((float)Math.PI * 2f) * num17;
33046 float rotation = num19;
33047 Vector2 position2 = vector + num19.ToRotationVector2() * num18 + rand.NextVector2Circular(20f, 20f) + vector3 - screenPosition;
33048 color2 *= num13;
33049 color4 *= num13;
33050 SpriteEffects effects = SpriteEffects.None;
33051 spriteBatch.Draw(value2, position2, null, color2, rotation, origin2, vector2, effects, 0f);
33052 spriteBatch.Draw(value2, position2, null, color4, rotation, origin2, vector2 * 0.6f, effects, 0f);
33053 }
33054 }
33055
33057 {
33058 Vector2 vector = proj.Center - screenPosition;
33059 int num = 40;
33060 int num2 = 180 * num;
33061 num2 /= 2;
33062 Microsoft.Xna.Framework.Color color = proj.AI_171_GetColor();
33064 color.A = 0;
33065 color2.A /= 2;
33066 Texture2D value = TextureAssets.Extra[178].Value;
33067 Vector2 origin = value.Frame().Size() * new Vector2(0f, 0.5f);
33068 Vector2 scale = new Vector2(num2 / value.Width, 2f);
33069 Vector2 scale2 = new Vector2((float)(num2 / value.Width) * 0.5f, 2f);
33070 Microsoft.Xna.Framework.Color color3 = color * Utils.GetLerpValue(60f, 55f, proj.localAI[0], clamped: true) * Utils.GetLerpValue(0f, 10f, proj.localAI[0], clamped: true);
33071 spriteBatch.Draw(value, vector, null, color3, proj.rotation, origin, scale2, SpriteEffects.None, 0f);
33072 spriteBatch.Draw(value, vector, null, color3 * 0.3f, proj.rotation, origin, scale, SpriteEffects.None, 0f);
33074 Vector2 origin2 = value2.Frame().Size() / 2f;
33075 Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White * Utils.GetLerpValue(0f, 20f, proj.localAI[0], clamped: true);
33076 color4.A /= 2;
33077 float num3 = MathHelper.Lerp(0.7f, 1f, Utils.GetLerpValue(55f, 60f, proj.localAI[0], clamped: true));
33078 float lerpValue = Utils.GetLerpValue(10f, 60f, proj.localAI[0]);
33079 if (lerpValue > 0f)
33080 {
33081 float lerpValue2 = Utils.GetLerpValue(0f, 1f, proj.velocity.Length(), clamped: true);
33082 for (float num4 = 1f; num4 > 0f; num4 -= 1f / 6f)
33083 {
33084 Vector2 vector2 = proj.rotation.ToRotationVector2() * -120f * num4 * lerpValue2;
33085 spriteBatch.Draw(value2, vector + vector2, null, color * lerpValue * (1f - num4), proj.rotation, origin2, num3, SpriteEffects.None, 0f);
33086 spriteBatch.Draw(value2, vector + vector2, null, new Microsoft.Xna.Framework.Color(255, 255, 255, 0) * 0.15f * lerpValue * (1f - num4), proj.rotation, origin2, num3 * 0.85f, SpriteEffects.None, 0f);
33087 }
33088 for (float num5 = 0f; num5 < 1f; num5 += 0.25f)
33089 {
33090 Vector2 vector3 = (num5 * ((float)Math.PI * 2f) + proj.rotation).ToRotationVector2() * 2f * num3;
33091 spriteBatch.Draw(value2, vector + vector3, null, color2 * lerpValue, proj.rotation, origin2, num3, SpriteEffects.None, 0f);
33092 }
33093 spriteBatch.Draw(value2, vector, null, color2 * lerpValue, proj.rotation, origin2, num3 * 1.1f, SpriteEffects.None, 0f);
33094 }
33095 spriteBatch.Draw(value2, vector, null, color4, proj.rotation, origin2, num3, SpriteEffects.None, 0f);
33096 }
33097
33099 {
33100 Vector2 vector = proj.Center - screenPosition;
33101 Microsoft.Xna.Framework.Color fairyQueenWeaponsColor = proj.GetFairyQueenWeaponsColor(0f);
33102 Microsoft.Xna.Framework.Color fairyQueenWeaponsColor2 = proj.GetFairyQueenWeaponsColor(0.5f);
33104 Vector2 origin = value.Frame().Size() / 2f;
33105 Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * proj.Opacity;
33106 color.A /= 2;
33107 float num = MathHelper.Lerp(0.7f, 1f, Utils.GetLerpValue(0f, 5f, proj.ai[0], clamped: true));
33108 float opacity = proj.Opacity;
33109 if (opacity > 0f)
33110 {
33111 float lerpValue = Utils.GetLerpValue(0f, 1f, proj.velocity.Length(), clamped: true);
33112 for (float num2 = 0f; num2 < 1f; num2 += 1f / 6f)
33113 {
33114 Vector2 vector2 = proj.rotation.ToRotationVector2() * -120f * num2 * lerpValue;
33115 spriteBatch.Draw(value, vector + vector2, null, fairyQueenWeaponsColor * opacity * (1f - num2), proj.rotation, origin, num, SpriteEffects.None, 0f);
33116 }
33117 for (float num3 = 0f; num3 < 1f; num3 += 0.25f)
33118 {
33119 Vector2 vector3 = (num3 * ((float)Math.PI * 2f) + proj.rotation).ToRotationVector2() * 4f * num;
33120 spriteBatch.Draw(value, vector + vector3, null, fairyQueenWeaponsColor2 * opacity, proj.rotation, origin, num, SpriteEffects.None, 0f);
33121 }
33122 }
33123 spriteBatch.Draw(value, vector, null, color, proj.rotation, origin, num, SpriteEffects.None, 0f);
33124 }
33125
33127 {
33130 Vector2 vector = proj.Center - screenPosition;
33131 proj.GetFairyQueenWeaponsColor(0f, 0f, hueOverride);
33132 Microsoft.Xna.Framework.Color fairyQueenWeaponsColor = proj.GetFairyQueenWeaponsColor(0.5f, 0f, hueOverride);
33134 Vector2 origin = value.Frame().Size() / 2f;
33135 Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * proj.Opacity;
33136 color.A = (byte)((float)(int)color.A * 0.7f);
33137 fairyQueenWeaponsColor.A /= 2;
33138 float scale = proj.scale;
33139 float num = proj.rotation - (float)Math.PI / 2f;
33140 float num2 = proj.Opacity * 0.3f;
33141 if (num2 > 0f)
33142 {
33143 float lerpValue = Utils.GetLerpValue(60f, 50f, proj.ai[0], clamped: true);
33144 float num3 = Utils.GetLerpValue(70f, 50f, proj.ai[0], clamped: true) * Utils.GetLerpValue(40f, 45f, proj.ai[0], clamped: true);
33145 for (float num4 = 0f; num4 < 1f; num4 += 1f / 6f)
33146 {
33147 Vector2 vector2 = num.ToRotationVector2() * -120f * num4 * lerpValue;
33148 EntitySpriteDraw(value, vector + vector2, null, fairyQueenWeaponsColor * num2 * (1f - num4) * num3, num, origin, scale * 1.5f, SpriteEffects.None);
33149 }
33150 for (float num5 = 0f; num5 < 1f; num5 += 0.25f)
33151 {
33152 Vector2 vector3 = (num5 * ((float)Math.PI * 2f) + num).ToRotationVector2() * 4f * scale;
33153 EntitySpriteDraw(value, vector + vector3, null, fairyQueenWeaponsColor * num2, num, origin, scale, SpriteEffects.None);
33154 }
33155 }
33156 EntitySpriteDraw(value, vector, null, color, num, origin, scale, SpriteEffects.None);
33157 EntitySpriteDraw(value, vector, null, fairyQueenWeaponsColor * num2 * 0.5f, num, origin, scale, SpriteEffects.None);
33158 }
33159
33161 {
33162 Vector2 vector = proj.Center - screenPosition;
33163 Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * 0.5f;
33164 color.A = 0;
33166 color2.A = 127;
33168 Vector2 origin = value.Frame().Size() / 2f;
33169 Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.White * proj.Opacity;
33170 color3.A /= 2;
33171 int num = 1;
33172 float opacity = proj.Opacity;
33173 if (opacity > 0f)
33174 {
33175 for (float num2 = 0f; num2 < 4f; num2 += 1f)
33176 {
33177 Vector2 vector2 = proj.velocity * (0f - num2);
33178 spriteBatch.Draw(value, vector + vector2, null, color * opacity * ((4f - num2) / 4f), proj.rotation, origin, num, SpriteEffects.None, 0f);
33179 }
33180 for (float num3 = 0f; num3 < 1f; num3 += 0.25f)
33181 {
33182 Vector2 vector3 = (num3 * ((float)Math.PI * 2f) + proj.rotation).ToRotationVector2() * 4f * num;
33183 spriteBatch.Draw(value, vector + vector3, null, color2 * opacity, proj.rotation, origin, num, SpriteEffects.None, 0f);
33184 }
33185 }
33186 spriteBatch.Draw(value, vector, null, color3, proj.rotation, origin, num, SpriteEffects.None, 0f);
33187 }
33188
33190 {
33192 Vector2 origin = value.Size() / 2f;
33193 float num = GlobalTimeWrappedHourly % 10f / 10f;
33194 Vector2 vector = proj.Center - screenPosition;
33195 float[] array = new float[15];
33196 float[] array2 = new float[15];
33197 float[] array3 = new float[15];
33198 float[] array4 = new float[15];
33199 float[] array5 = new float[15];
33200 float num2 = 0.5f;
33201 int num3 = 210;
33202 num2 = Utils.GetLerpValue(0f, 60f, proj.timeLeft, clamped: true) * Utils.GetLerpValue(num3, num3 - 60, proj.timeLeft, clamped: true);
33203 float amount = Utils.GetLerpValue(0f, 60f, proj.timeLeft, clamped: true) * Utils.GetLerpValue(num3, 90f, proj.timeLeft, clamped: true);
33204 amount = MathHelper.Lerp(0.2f, 0.5f, amount);
33205 float num4 = 800f / (float)value.Width;
33206 float num5 = num4 * 0.8f;
33207 float num6 = (num4 - num5) / 15f;
33208 float num7 = 30f;
33209 float num8 = 300f;
33210 Vector2 vector2 = new Vector2(3f, 6f);
33211 for (int i = 0; i < 15; i++)
33212 {
33213 _ = (float)(i + 1) / 50f;
33214 float num9 = (float)Math.Sin(num * ((float)Math.PI * 2f) + (float)Math.PI / 2f + (float)i / 2f);
33215 array[i] = num9 * (num8 - (float)i * 3f);
33216 array2[i] = (float)Math.Sin(num * ((float)Math.PI * 2f) * 2f + (float)Math.PI / 3f + (float)i) * num7;
33217 array2[i] -= (float)i * 3f;
33218 array3[i] = (float)i / 15f * 2f + num;
33219 array3[i] = (num9 * 0.5f + 0.5f) * 0.6f + num;
33220 array4[i] = (float)(1.0 - Math.Pow(1f * (float)i / 15f, 2.0));
33221 array5[i] = num5 + (float)(i + 1) * num6;
33222 array5[i] *= 0.3f;
33223 Microsoft.Xna.Framework.Color color = hslToRgb(array3[i] % 1f, 1f, 0.5f) * num2 * amount;
33224 color.A /= 4;
33225 float rotation = (float)Math.PI / 2f + num9 * ((float)Math.PI / 4f) * -0.3f + (float)Math.PI * (float)i;
33226 EntitySpriteDraw(value, vector + new Vector2(array[i], array2[i]), null, color, rotation, origin, new Vector2(array5[i], array5[i]) * vector2, SpriteEffects.None);
33227 }
33228 }
33229
33231 {
33236 Vector2 origin = new Vector2(value2.Width / 2, 2f);
33238 switch (proj.type)
33239 {
33240 case 847:
33242 break;
33243 case 849:
33246 break;
33247 case 848:
33249 break;
33250 case 912:
33252 break;
33253 case 913:
33255 break;
33256 case 914:
33258 break;
33259 case 915:
33261 break;
33262 case 952:
33264 break;
33265 }
33266 Vector2 vector = list[0];
33267 for (int i = 0; i < list.Count - 1; i++)
33268 {
33269 Vector2 vector2 = list[i];
33270 Vector2 vector3 = list[i + 1] - vector2;
33271 float rotation = vector3.ToRotation() - (float)Math.PI / 2f;
33273 Vector2 scale = new Vector2(1f, (vector3.Length() + 2f) / (float)value2.Height);
33274 spriteBatch.Draw(value, vector - screenPosition, value2, color, rotation, origin, scale, SpriteEffects.None, 0f);
33275 vector += vector3;
33276 }
33277 switch (proj.type)
33278 {
33279 case 847:
33281 break;
33282 case 841:
33284 break;
33285 case 848:
33287 break;
33288 case 849:
33290 break;
33291 case 912:
33293 break;
33294 case 913:
33296 break;
33297 case 914:
33299 break;
33300 case 915:
33302 break;
33303 case 952:
33305 break;
33306 }
33307 }
33308
33310 {
33313 int height = rectangle.Height;
33314 rectangle.Height -= 2;
33315 Vector2 vector = rectangle.Size() / 2f;
33317 for (int i = 0; i < controlPoints.Count - 1; i++)
33318 {
33319 bool flag = true;
33320 Vector2 origin = vector;
33321 switch (i)
33322 {
33323 case 0:
33324 origin.Y -= 4f;
33325 break;
33326 case 19:
33327 rectangle.Y = height * 4;
33328 break;
33329 default:
33330 rectangle.Y = height * (1 + i % 3);
33331 break;
33332 }
33335 if (flag)
33336 {
33337 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33338 Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector3.ToTileCoordinates());
33339 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color, rotation, origin, 1f, SpriteEffects.None, 0f);
33340 }
33341 vector2 += vector4;
33342 }
33343 return vector2;
33344 }
33345
33347 {
33350 int height = rectangle.Height;
33351 rectangle.Height -= 2;
33352 Vector2 vector = rectangle.Size() / 2f;
33354 for (int i = 0; i < controlPoints.Count - 1; i++)
33355 {
33356 bool flag = true;
33357 Vector2 origin = vector;
33358 switch (i)
33359 {
33360 case 0:
33361 origin.Y -= 4f;
33362 break;
33363 case 3:
33364 case 5:
33365 case 7:
33366 rectangle.Y = height;
33367 break;
33368 case 9:
33369 case 11:
33370 case 13:
33371 rectangle.Y = height * 2;
33372 break;
33373 case 15:
33374 case 17:
33375 rectangle.Y = height * 3;
33376 break;
33377 case 19:
33378 rectangle.Y = height * 4;
33379 break;
33380 default:
33381 flag = false;
33382 break;
33383 }
33386 if (flag)
33387 {
33388 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33389 Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(Lighting.GetColor(vector3.ToTileCoordinates()));
33390 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, alpha, rotation, origin, 1f, SpriteEffects.None, 0f);
33391 }
33392 vector2 += vector4;
33393 }
33394 return vector2;
33395 }
33396
33398 {
33401 int height = rectangle.Height;
33402 rectangle.Height -= 2;
33403 Vector2 vector = rectangle.Size() / 2f;
33405 for (int i = 0; i < controlPoints.Count - 1; i++)
33406 {
33407 bool flag = true;
33408 Vector2 origin = vector;
33409 switch (i)
33410 {
33411 case 0:
33412 origin.Y -= 4f;
33413 break;
33414 case 3:
33415 case 5:
33416 case 7:
33417 rectangle.Y = height;
33418 break;
33419 case 9:
33420 case 11:
33421 case 13:
33422 rectangle.Y = height * 2;
33423 break;
33424 case 15:
33425 case 17:
33426 rectangle.Y = height * 3;
33427 break;
33428 case 19:
33429 rectangle.Y = height * 4;
33430 break;
33431 default:
33432 flag = false;
33433 break;
33434 }
33437 if (flag)
33438 {
33439 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33440 Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(Lighting.GetColor(vector3.ToTileCoordinates()));
33441 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, alpha, rotation, origin, 1f, SpriteEffects.None, 0f);
33442 }
33443 vector2 += vector4;
33444 }
33445 return vector2;
33446 }
33447
33449 {
33452 int height = rectangle.Height;
33453 rectangle.Height -= 2;
33454 Vector2 vector = rectangle.Size() / 2f;
33456 float miscCounterNormalized = player[proj.owner].miscCounterNormalized;
33457 for (int i = 0; i < controlPoints.Count - 1; i++)
33458 {
33459 bool flag = true;
33460 Vector2 origin = vector;
33461 switch (i)
33462 {
33463 case 0:
33464 origin.Y -= 4f;
33465 break;
33466 case 39:
33467 rectangle.Y = height * 4;
33468 break;
33469 default:
33470 flag = i % 2 == 0;
33471 rectangle.Y = height * (1 + i % 3);
33472 break;
33473 }
33476 if (flag)
33477 {
33478 Microsoft.Xna.Framework.Color color = hslToRgb((miscCounterNormalized * 5f + (float)i * 0.05f) % 1f, 1f, 0.5f);
33481 float num = MathHelper.Lerp(1f, 1f, lerpValue);
33482 color2.A /= 2;
33483 color2.A = (byte)((float)(int)color2.A * lerpValue);
33484 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33486 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, Microsoft.Xna.Framework.Color.Lerp(color3, color2, 0.5f), rotation, origin, num, SpriteEffects.None, 0f);
33487 color2.A = 0;
33488 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color2 * 0.1f, rotation, origin, num * 1.2f, SpriteEffects.None, 0f);
33489 if (i == 39)
33490 {
33491 color2 = color;
33492 color2.A = 127;
33493 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color2 * 0.3f, rotation, origin, num * 1.4f, SpriteEffects.None, 0f);
33494 }
33495 }
33496 vector2 += vector4;
33497 }
33498 return vector2;
33499 }
33500
33502 {
33505 int height = rectangle.Height;
33506 rectangle.Height -= 2;
33507 Vector2 vector = rectangle.Size() / 2f;
33509 for (int i = 0; i < controlPoints.Count - 1; i++)
33510 {
33511 bool flag = true;
33512 Vector2 origin = vector;
33513 float scale = 1f;
33514 switch (i)
33515 {
33516 case 0:
33517 origin.Y -= 4f;
33518 break;
33519 case 19:
33520 rectangle.Y = height * 4;
33521 scale = 1.1f;
33522 break;
33523 default:
33524 rectangle.Y = height * (1 + i % 3);
33525 scale = 0.8f;
33526 break;
33527 }
33530 if (flag)
33531 {
33532 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33533 Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector3.ToTileCoordinates());
33534 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color, rotation, origin, scale, SpriteEffects.None, 0f);
33535 }
33536 vector2 += vector4;
33537 }
33538 return vector2;
33539 }
33540
33542 {
33545 int height = rectangle.Height;
33546 rectangle.Height -= 2;
33547 Vector2 vector = rectangle.Size() / 2f;
33549 for (int i = 0; i < controlPoints.Count - 1; i++)
33550 {
33551 bool flag = true;
33552 Vector2 origin = vector;
33553 switch (i)
33554 {
33555 case 0:
33556 origin.Y -= 4f;
33557 break;
33558 case 3:
33559 case 5:
33560 case 7:
33561 rectangle.Y = height;
33562 break;
33563 case 9:
33564 case 11:
33565 case 13:
33566 rectangle.Y = height * 2;
33567 break;
33568 case 15:
33569 case 17:
33570 rectangle.Y = height * 3;
33571 break;
33572 case 19:
33573 rectangle.Y = height * 4;
33574 break;
33575 default:
33576 flag = false;
33577 break;
33578 }
33581 if (flag)
33582 {
33583 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33584 Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector3.ToTileCoordinates());
33585 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color, rotation, origin, 1f, SpriteEffects.None, 0f);
33586 }
33587 vector2 += vector4;
33588 }
33589 return vector2;
33590 }
33591
33593 {
33595 if (proj.spriteDirection == 1)
33596 {
33597 spriteEffects ^= SpriteEffects.FlipHorizontally;
33598 }
33601 int height = rectangle.Height;
33602 rectangle.Height -= 2;
33603 Vector2 vector = rectangle.Size() / 2f;
33605 for (int i = 0; i < controlPoints.Count - 1; i++)
33606 {
33607 bool flag = false;
33608 Vector2 origin = vector;
33609 float scale = 1f;
33610 if (i == 0)
33611 {
33612 origin.Y -= 4f;
33613 flag = true;
33614 }
33615 else if (i % 2 == 0)
33616 {
33617 flag = true;
33618 int num = 1;
33619 if (i > 10)
33620 {
33621 num = 2;
33622 }
33623 if (i > 20)
33624 {
33625 num = 3;
33626 }
33627 rectangle.Y = height * num;
33628 }
33629 if (i == controlPoints.Count - 2)
33630 {
33631 flag = true;
33632 rectangle.Y = height * 4;
33633 scale = 1.3f;
33635 float t = proj.ai[0] / timeToFlyOut;
33636 float amount = Utils.GetLerpValue(0.1f, 0.7f, t, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t, clamped: true);
33637 scale = MathHelper.Lerp(0.5f, 2f, amount);
33638 }
33641 if (flag)
33642 {
33643 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33644 Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector3.ToTileCoordinates());
33645 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color, rotation, origin, scale, spriteEffects, 0f);
33646 }
33647 vector2 += vector4;
33648 }
33649 return vector2;
33650 }
33651
33653 {
33655 if (proj.spriteDirection == 1)
33656 {
33657 spriteEffects ^= SpriteEffects.FlipHorizontally;
33658 }
33661 int height = rectangle.Height;
33662 rectangle.Height -= 2;
33663 Vector2 vector = rectangle.Size() / 2f;
33665 for (int i = 0; i < controlPoints.Count - 1; i++)
33666 {
33667 bool flag = false;
33668 Vector2 origin = vector;
33669 float scale = 1f;
33670 if (i == 0)
33671 {
33672 origin.Y -= 4f;
33673 flag = true;
33674 }
33675 else if (i % 2 == 0)
33676 {
33677 flag = true;
33678 int num = 1;
33679 if (i > 10)
33680 {
33681 num = 2;
33682 }
33683 if (i > 20)
33684 {
33685 num = 3;
33686 }
33687 rectangle.Y = height * num;
33688 }
33689 if (i == controlPoints.Count - 2)
33690 {
33691 flag = true;
33692 rectangle.Y = height * 4;
33693 scale = 1.3f;
33695 float t = proj.ai[0] / timeToFlyOut;
33696 float amount = Utils.GetLerpValue(0.1f, 0.7f, t, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t, clamped: true);
33697 scale = MathHelper.Lerp(0.5f, 1.5f, amount);
33698 }
33701 if (flag)
33702 {
33703 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33704 Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector3.ToTileCoordinates());
33705 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color, rotation, origin, scale, spriteEffects, 0f);
33706 }
33707 vector2 += vector4;
33708 }
33709 return vector2;
33710 }
33711
33713 {
33715 if (proj.spriteDirection == 1)
33716 {
33717 spriteEffects ^= SpriteEffects.FlipHorizontally;
33718 }
33721 int height = rectangle.Height;
33722 rectangle.Height -= 2;
33723 Vector2 vector = rectangle.Size() / 2f;
33725 for (int i = 0; i < controlPoints.Count - 1; i++)
33726 {
33727 bool flag = false;
33728 Vector2 origin = vector;
33729 float scale = 1f;
33730 if (i == 0)
33731 {
33732 origin.Y -= 4f;
33733 flag = true;
33734 }
33735 else
33736 {
33737 flag = true;
33738 int num = 1;
33739 if (i > 10)
33740 {
33741 num = 2;
33742 }
33743 if (i > 20)
33744 {
33745 num = 3;
33746 }
33747 rectangle.Y = height * num;
33748 }
33749 if (i == controlPoints.Count - 2)
33750 {
33751 flag = true;
33752 rectangle.Y = height * 4;
33753 scale = 1.3f;
33755 float t = proj.ai[0] / timeToFlyOut;
33756 float amount = Utils.GetLerpValue(0.1f, 0.7f, t, clamped: true) * Utils.GetLerpValue(0.9f, 0.7f, t, clamped: true);
33757 scale = MathHelper.Lerp(0.5f, 1.5f, amount);
33758 }
33761 if (flag)
33762 {
33763 float rotation = vector4.ToRotation() - (float)Math.PI / 2f;
33764 Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector3.ToTileCoordinates());
33765 spriteBatch.Draw(value, vector2 - screenPosition, rectangle, color, rotation, origin, scale, spriteEffects, 0f);
33766 }
33767 vector2 += vector4;
33768 }
33769 return vector2;
33770 }
33771
33773 {
33775 SpriteEffects effects = ((proj.spriteDirection != 1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
33777 Vector2 origin = rectangle.Size() / 2f;
33778 Vector2 vector = proj.Center - screenPosition;
33779 Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(Lighting.GetColor(proj.Center.ToTileCoordinates()));
33780 float num = 18f;
33781 if (proj.isAPreviewDummy)
33782 {
33783 num = 8f;
33784 }
33785 Vector2 position = vector + (GlobalTimeWrappedHourly * 2f).ToRotationVector2() * num;
33786 EntitySpriteDraw(value, position, rectangle, alpha, proj.rotation, origin, proj.scale, effects);
33787 position = vector - (GlobalTimeWrappedHourly * 2f).ToRotationVector2() * num;
33788 rectangle = value.Frame(1, projFrames[proj.type], 0, proj.frame + 18);
33789 EntitySpriteDraw(value, position, rectangle, alpha, proj.rotation, origin, proj.scale, effects);
33790 }
33791
33793 {
33795 Texture2D texture2D = null;
33796 if (proj.type == 887)
33797 {
33798 texture2D = TextureAssets.GlowMask[275].Value;
33799 }
33800 int num = 5;
33801 int num2 = 16;
33802 switch (proj.type)
33803 {
33804 case 883:
33805 num = 5;
33806 num2 = 16;
33807 break;
33808 case 887:
33809 num = 6;
33810 num2 = 16;
33811 break;
33812 case 893:
33813 num = 8;
33814 num2 = 20;
33815 break;
33816 }
33817 SpriteEffects effects = ((proj.spriteDirection != 1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
33819 Vector2 origin = rectangle.Size() / 2f;
33820 Vector2 position = proj.Center - screenPosition;
33821 Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(Lighting.GetColor(proj.Center.ToTileCoordinates()));
33822 Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * ((float)(int)mouseTextColor / 255f);
33823 Vector2 vector = proj.Center;
33824 int num3 = 1;
33825 int num4 = projFrames[proj.type] - 1;
33826 for (int i = 1; i < num; i++)
33827 {
33828 int frameY = num3;
33829 if (i == num - 1)
33830 {
33831 frameY = num4;
33832 }
33833 else if (proj.type == 893 && i != 2 && i != 5)
33834 {
33835 frameY = 2;
33836 }
33837 Microsoft.Xna.Framework.Rectangle value2 = value.Frame(1, projFrames[proj.type], 0, frameY);
33838 Vector2 vector2 = proj.oldPos[i * 10] + proj.Size / 2f;
33839 float num5 = (vector - vector2).ToRotation();
33840 vector2 = vector - new Vector2(num2, 0f).RotatedBy(num5, Vector2.Zero);
33841 num5 = (vector - vector2).ToRotation() + (float)Math.PI / 2f;
33843 SpriteEffects effects2 = ((!(vector2.X < vector.X)) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
33844 vector = vector2;
33845 EntitySpriteDraw(value, position2, value2, proj.GetAlpha(Lighting.GetColor(vector2.ToTileCoordinates())), num5, origin, proj.scale, effects2);
33846 if (texture2D != null)
33847 {
33848 EntitySpriteDraw(texture2D, position2, value2, proj.GetAlpha(color), num5, origin, proj.scale, effects2);
33849 }
33850 }
33851 EntitySpriteDraw(value, position, rectangle, alpha, proj.rotation, origin, proj.scale, effects);
33852 if (texture2D != null)
33853 {
33854 EntitySpriteDraw(texture2D, position, rectangle, color, proj.rotation, origin, proj.scale, effects);
33855 }
33856 }
33857
33859 {
33861 Texture2D value2 = TextureAssets.Extra[103].Value;
33862 int num = 15;
33863 float num2 = 0f;
33864 int num3 = 10;
33865 int num4 = 5;
33866 float num5 = 10f;
33867 float num6 = 0f;
33868 int num7 = -14;
33869 int num8 = -2;
33870 int num9 = -1;
33871 int num10 = -1;
33872 int num11 = 8;
33873 int num12 = 0;
33874 int num13 = 1;
33875 int num14 = 0;
33876 int num15 = 0;
33877 bool flag = true;
33878 bool flag2 = false;
33879 switch (proj.type)
33880 {
33881 case 771:
33882 value2 = TextureAssets.Extra[104].Value;
33883 num = 12;
33884 num12 = 12;
33885 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
33886 num3 = 12;
33887 num5 = 22f;
33888 num6 += (float)Math.PI / 8f * (float)proj.spriteDirection;
33889 num7 = -8;
33890 num8 = -6;
33891 num9 = 10;
33892 num10 = 8;
33893 num11 = 12;
33894 break;
33895 case 822:
33896 value2 = TextureAssets.Extra[132].Value;
33897 num = 7;
33898 num12 = 7;
33899 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
33900 num3 = 7;
33901 num5 = 22f;
33902 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
33903 num7 = -20;
33904 num8 = -6;
33905 num11 = 12;
33906 break;
33907 case 850:
33908 value2 = TextureAssets.Extra[147].Value;
33909 num = 8;
33910 num12 = 8;
33911 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
33912 num3 = 8;
33913 num5 = 22f;
33914 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
33915 num7 = -20;
33916 num8 = -38;
33917 num11 = 12;
33918 num14 = 6;
33919 num15 = 2;
33920 flag = false;
33921 break;
33922 case 823:
33923 case 846:
33924 value2 = TextureAssets.Extra[133].Value;
33925 if (proj.type == 846)
33926 {
33927 value2 = TextureAssets.Extra[146].Value;
33928 }
33929 num = 6;
33930 num12 = 6;
33931 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
33932 num3 = 6;
33933 num5 = 40f;
33934 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
33935 num7 = -16;
33936 num8 = -10;
33937 num11 = 30;
33938 break;
33939 case 827:
33940 case 844:
33941 value2 = TextureAssets.Extra[135].Value;
33942 if (proj.type == 844)
33943 {
33944 value2 = TextureAssets.Extra[144].Value;
33945 }
33946 num = 4;
33947 num12 = 3;
33948 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
33949 num3 = 16;
33950 num5 = 10f;
33951 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
33952 num8 = -4;
33953 num4 = 4;
33954 flag2 = true;
33955 break;
33956 case 828:
33957 case 829:
33958 value2 = TextureAssets.Extra[136].Value;
33959 if (proj.type == 829)
33960 {
33961 value2 = TextureAssets.Extra[137].Value;
33962 }
33963 num = 2;
33964 num12 = 1;
33965 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
33966 num3 = 6;
33967 num5 = 10f;
33968 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
33969 num11 = 10;
33970 num8 = -4;
33971 num13 = 3;
33972 flag = false;
33973 flag2 = true;
33974 break;
33975 case 852:
33976 value2 = TextureAssets.Extra[148].Value;
33977 num = 2;
33978 num12 = 1;
33979 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
33980 num3 = 6;
33981 num5 = 10f;
33982 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
33983 num11 = 10;
33984 num8 = -4;
33985 num13 = 4;
33986 flag = false;
33987 flag2 = true;
33988 break;
33989 case 830:
33990 case 838:
33991 value2 = TextureAssets.Extra[138].Value;
33992 if (proj.type == 838)
33993 {
33994 value2 = TextureAssets.Extra[139].Value;
33995 }
33996 num = 3;
33997 num12 = 3;
33998 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
33999 num3 = 3;
34000 num5 = 60f;
34001 num10 = 40;
34002 num9 = 3;
34003 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
34004 num11 = 50;
34005 num8 = -20;
34006 num14 = -10;
34007 break;
34008 case 843:
34009 value2 = TextureAssets.Extra[140].Value;
34010 num = 2;
34011 num12 = 2;
34012 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
34013 num3 = 2;
34014 num5 = 30f;
34015 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
34016 num11 = 20;
34017 num8 = -16;
34018 num14 = -10;
34019 break;
34020 case 845:
34021 value2 = TextureAssets.Extra[145].Value;
34022 num = 3;
34023 num12 = 3;
34024 num2 = ((proj.spriteDirection == 1) ? ((float)Math.PI / 2f) : (-(float)Math.PI / 2f));
34025 num3 = 3;
34026 num5 = 42f;
34027 num10 = 50;
34028 num9 = 2;
34029 num6 += (float)Math.PI / 12f * (float)proj.spriteDirection;
34030 num11 = 30;
34031 num8 = -8;
34032 num14 = -10;
34033 break;
34034 case 824:
34035 case 826:
34036 case 839:
34037 case 840:
34038 case 853:
34039 num13 = 0;
34040 break;
34041 case 766:
34042 case 767:
34043 case 768:
34044 case 769:
34045 case 770:
34046 num12 = (proj.type - 766) * 3 + 3;
34047 break;
34048 }
34049 SpriteEffects effects = ((proj.spriteDirection != 1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None);
34051 Vector2 origin = rectangle.Size() / 2f;
34052 Vector2 position = proj.Center - screenPosition;
34053 Microsoft.Xna.Framework.Color color = Lighting.GetColor(proj.Center.ToTileCoordinates());
34054 Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(color);
34057 Vector2 origin2 = new Vector2(value4.Width / 2, 2f);
34059 int width = rectangle2.Width;
34060 rectangle2.Width -= 2;
34061 Vector2 origin3 = rectangle2.Size() / 2f;
34062 rectangle2.X = width * (num - 1);
34064 Vector2 center = proj.Center;
34066 float num16 = 12f;
34067 _ = (playerArmPosition - center).SafeNormalize(Vector2.Zero) * num16;
34070 Vector2 velocity = proj.velocity;
34071 if (Math.Abs(velocity.X) > Math.Abs(velocity.Y))
34072 {
34073 Utils.Swap(ref velocity.X, ref velocity.Y);
34074 }
34075 float num17 = vector2.Length();
34076 float num18 = 16f;
34077 float num19 = 80f;
34078 bool flag3 = true;
34079 if (num17 == 0f)
34080 {
34081 flag3 = false;
34082 }
34083 else
34084 {
34085 vector2 *= 12f / num17;
34086 vector -= vector2;
34087 vector2 = center - vector;
34088 }
34089 while (flag3)
34090 {
34091 float num20 = 12f;
34092 float num21 = vector2.Length();
34093 float num22 = num21;
34094 if (float.IsNaN(num21) || num21 == 0f)
34095 {
34096 flag3 = false;
34097 continue;
34098 }
34099 if (num21 < 20f)
34100 {
34101 num20 = num21 - 8f;
34102 flag3 = false;
34103 }
34104 num21 = 12f / num21;
34105 vector2 *= num21;
34106 vector += vector2;
34107 vector2 = center - vector;
34108 if (num22 > 12f)
34109 {
34110 float num23 = 0.3f;
34111 float num24 = Math.Abs(velocity.X) + Math.Abs(velocity.Y);
34112 if (num24 > num18)
34113 {
34114 num24 = num18;
34115 }
34116 num24 = 1f - num24 / num18;
34117 num23 *= num24;
34118 num24 = num22 / num19;
34119 if (num24 > 1f)
34120 {
34121 num24 = 1f;
34122 }
34123 num23 *= num24;
34124 if (num23 < 0f)
34125 {
34126 num23 = 0f;
34127 }
34128 num24 = 1f;
34129 num23 *= num24;
34130 if (vector2.Y > 0f)
34131 {
34132 vector2.Y *= 1f + num23;
34133 vector2.X *= 1f - num23;
34134 }
34135 else
34136 {
34137 num24 = Math.Abs(velocity.X) / 3f;
34138 if (num24 > 1f)
34139 {
34140 num24 = 1f;
34141 }
34142 num24 -= 0.5f;
34143 num23 *= num24;
34144 if (num23 > 0f)
34145 {
34146 num23 *= 2f;
34147 }
34148 vector2.Y *= 1f + num23;
34149 vector2.X *= 1f - num23;
34150 }
34151 }
34152 float rotation = vector2.ToRotation() - (float)Math.PI / 2f;
34153 if (!flag3)
34154 {
34155 value4.Height = (int)num20;
34156 }
34159 }
34160 Vector2 vector3 = proj.Size / 2f;
34161 float num25 = Math.Abs(WindForVisuals);
34162 float num26 = MathHelper.Lerp(0.5f, 1f, num25);
34163 float num27 = num25;
34164 if (vector2.Y >= -0.02f && vector2.Y < 1f)
34165 {
34166 num27 = Utils.GetLerpValue(0.2f, 0.5f, num25, clamped: true);
34167 }
34168 int num28 = num4;
34169 int num29 = num3 + 1;
34170 for (int i = 0; i < num13; i++)
34171 {
34172 rectangle2.X = width * (num - 1);
34174 Vector2 vector4 = new Vector2(num26 * (float)num11 * (float)proj.spriteDirection, (float)Math.Sin(timeForVisualEffects / 300.0 * 6.2831854820251465) * num27) * 2f;
34175 float num30 = num7 + num14;
34176 float num31 = num8 + num15;
34177 switch (i)
34178 {
34179 case 1:
34180 vector4 = new Vector2(num26 * (float)num11 * (float)proj.spriteDirection, (float)Math.Sin(timeForVisualEffects / 300.0 * 6.2831854820251465) * num27 + 0.5f) * 2f;
34181 num30 -= 8f;
34182 num31 -= 8f;
34183 break;
34184 case 2:
34185 vector4 = new Vector2(num26 * (float)num11 * (float)proj.spriteDirection, (float)Math.Sin(timeForVisualEffects / 300.0 * 6.2831854820251465) * num27 + 1f) * 2f;
34186 num30 -= 4f;
34187 num31 -= 4f;
34188 break;
34189 case 3:
34190 vector4 = new Vector2(num26 * (float)num11 * (float)proj.spriteDirection, (float)Math.Sin(timeForVisualEffects / 300.0 * 6.2831854820251465) * num27 + 1.5f) * 2f;
34191 num30 -= 12f;
34192 num31 -= 12f;
34193 break;
34194 }
34195 Vector2 vector5 = proj.Center + new Vector2(((float)rectangle.Width * 0.5f + num30) * (float)proj.spriteDirection, num31).RotatedBy(proj.rotation + num6);
34196 list.Add(vector5);
34197 int num32 = num28;
34198 int num33 = 1;
34199 while (num32 < num29 * num28)
34200 {
34201 if (num9 != -1 && num9 == num33)
34202 {
34203 num5 = num10;
34204 }
34205 Vector2 vector6 = proj.oldPos[num32];
34206 if (vector6.X == 0f && vector6.Y == 0f)
34207 {
34208 list.Add(vector5);
34209 }
34210 else
34211 {
34212 vector6 += vector3 + new Vector2(((float)rectangle.Width * 0.5f + num30) * (float)proj.oldSpriteDirection[num32], num31).RotatedBy(proj.oldRot[num32] + num6);
34213 vector6 += vector4 * (num33 + 1);
34215 float num34 = vector7.Length();
34216 if (num34 > num5)
34217 {
34218 vector7 *= num5 / num34;
34219 }
34221 list.Add(vector6);
34222 vector5 = vector6;
34223 }
34224 num32 += num28;
34225 num33++;
34226 }
34227 if (flag)
34228 {
34230 for (int num35 = list.Count - 2; num35 >= 0; num35--)
34231 {
34233 Vector2 v = list[num35 + 1] - vector8;
34234 float num36 = v.Length();
34235 if (!(num36 < 2f))
34236 {
34237 float rotation2 = v.ToRotation() - (float)Math.PI / 2f;
34239 }
34240 }
34241 }
34242 for (int num37 = list.Count - 2; num37 >= 0; num37--)
34243 {
34245 Vector2 vector10 = list[num37 + 1];
34247 v2.Length();
34248 float rotation3 = v2.ToRotation() - (float)Math.PI / 2f + num2;
34250 rectangle2.X -= width;
34251 if (rectangle2.X < 0)
34252 {
34253 int num38 = num12;
34254 if (flag2)
34255 {
34256 num38--;
34257 }
34258 rectangle2.X = num38 * width;
34259 }
34260 }
34261 }
34262 EntitySpriteDraw(value, position, rectangle, alpha, proj.rotation + num6, origin, proj.scale, effects);
34263 }
34264
34266 {
34267 Player player = Main.player[proj.owner];
34268 Vector2 vector = OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f;
34269 if (player.direction != 1)
34270 {
34271 vector.X = (float)player.bodyFrame.Width - vector.X;
34272 }
34273 if (player.gravDir != 1f)
34274 {
34275 vector.Y = (float)player.bodyFrame.Height - vector.Y;
34276 }
34277 vector -= new Vector2(player.bodyFrame.Width - player.width, player.bodyFrame.Height - 42) / 2f;
34278 Vector2 pos = player.MountedCenter - new Vector2(20f, 42f) / 2f + vector + Vector2.UnitY * player.gfxOffY;
34279 if (player.mount.Active && player.mount.Type == 52)
34280 {
34281 pos.Y -= player.mount.PlayerOffsetHitbox;
34282 pos += new Vector2(12 * player.direction, -12f);
34283 }
34284 return player.RotatedRelativePoint(pos);
34285 }
34286
34288 {
34289 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(255, 255, 255, projectileColor.A - proj.alpha);
34290 Vector2 vector = proj.velocity;
34291 Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Blue * 0.1f;
34292 Vector2 spinningpoint = new Vector2(0f, -4f);
34293 float num = 0f;
34294 float t = vector.Length();
34295 float num2 = Utils.GetLerpValue(3f, 5f, t, clamped: true);
34296 bool flag = true;
34297 if (proj.type == 856 || proj.type == 857)
34298 {
34299 vector = proj.position - proj.oldPos[1];
34300 float num3 = vector.Length();
34301 if (num3 == 0f)
34302 {
34304 }
34305 else
34306 {
34307 vector *= 5f / num3;
34308 }
34309 Vector2 origin = new Vector2(proj.ai[0], proj.ai[1]);
34310 Vector2 center = player[proj.owner].Center;
34311 float lerpValue = Utils.GetLerpValue(0f, 120f, origin.Distance(center), clamped: true);
34312 float num4 = 90f;
34313 if (proj.type == 857)
34314 {
34315 num4 = 60f;
34316 flag = false;
34317 }
34318 float lerpValue2 = Utils.GetLerpValue(num4, num4 * (5f / 6f), proj.localAI[0], clamped: true);
34319 float lerpValue3 = Utils.GetLerpValue(0f, 120f, proj.Center.Distance(center), clamped: true);
34321 lerpValue2 *= Utils.GetLerpValue(0f, 15f, proj.localAI[0], clamped: true);
34322 color2 = Microsoft.Xna.Framework.Color.HotPink * 0.15f * (lerpValue2 * lerpValue);
34323 if (proj.type == 857)
34324 {
34325 color2 = proj.GetFirstFractalColor() * 0.15f * (lerpValue2 * lerpValue);
34326 }
34327 spinningpoint = new Vector2(0f, -2f);
34328 float lerpValue4 = Utils.GetLerpValue(num4, num4 * (2f / 3f), proj.localAI[0], clamped: true);
34329 lerpValue4 *= Utils.GetLerpValue(0f, 20f, proj.localAI[0], clamped: true);
34330 num = -0.3f * (1f - lerpValue4);
34331 num += -1f * Utils.GetLerpValue(15f, 0f, proj.localAI[0], clamped: true);
34332 num *= lerpValue;
34334 }
34335 Vector2 vector2 = proj.Center + vector;
34337 _ = new Microsoft.Xna.Framework.Rectangle(0, 0, value.Width, value.Height).Size() / 2f;
34338 Texture2D value2 = TextureAssets.Extra[91].Value;
34340 Vector2 origin2 = new Vector2((float)value3.Width / 2f, 10f);
34341 _ = Microsoft.Xna.Framework.Color.Cyan * 0.5f * num2;
34342 Vector2 vector3 = new Vector2(0f, proj.gfxOffY);
34343 float num5 = (float)timeForVisualEffects / 60f;
34344 Vector2 vector4 = vector2 + vector * 0.5f;
34345 Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.White * 0.5f * num2;
34346 color3.A = 0;
34348 color4.A = 0;
34350 color5.A = 0;
34352 color6.A = 0;
34353 float num6 = vector.ToRotation();
34354 EntitySpriteDraw(value2, vector4 - screenPosition + vector3 + spinningpoint.RotatedBy((float)Math.PI * 2f * num5), value3, color4, num6 + (float)Math.PI / 2f, origin2, 1.5f + num, SpriteEffects.None);
34355 EntitySpriteDraw(value2, vector4 - screenPosition + vector3 + spinningpoint.RotatedBy((float)Math.PI * 2f * num5 + (float)Math.PI * 2f / 3f), value3, color5, num6 + (float)Math.PI / 2f, origin2, 1.1f + num, SpriteEffects.None);
34356 EntitySpriteDraw(value2, vector4 - screenPosition + vector3 + spinningpoint.RotatedBy((float)Math.PI * 2f * num5 + 4.1887903f), value3, color6, num6 + (float)Math.PI / 2f, origin2, 1.3f + num, SpriteEffects.None);
34357 Vector2 vector5 = vector2 - vector * 0.5f;
34358 for (float num7 = 0f; num7 < 1f; num7 += 0.5f)
34359 {
34360 float num8 = num5 % 0.5f / 0.5f;
34361 num8 = (num8 + num7) % 1f;
34362 float num9 = num8 * 2f;
34363 if (num9 > 1f)
34364 {
34365 num9 = 2f - num9;
34366 }
34367 EntitySpriteDraw(value2, vector5 - screenPosition + vector3, value3, color3 * num9, num6 + (float)Math.PI / 2f, origin2, 0.3f + num8 * 0.5f, SpriteEffects.None);
34368 }
34369 if (flag)
34370 {
34371 float rotation = proj.rotation + proj.localAI[1];
34372 _ = (float)timeForVisualEffects / 240f;
34377 if (globalTimeWrappedHourly >= 1f)
34378 {
34380 }
34382 Vector2 position = proj.Center - screenPosition;
34383 instance.LoadItem(75);
34384 Texture2D value4 = TextureAssets.Item[75].Value;
34386 EntitySpriteDraw(origin: rectangle.Size() / 2f, texture: value4, position: position, sourceRectangle: rectangle, color: color, rotation: rotation, scale: proj.scale, effects: SpriteEffects.None);
34387 }
34388 }
34389
34391 {
34392 if (gamePaused || gameMenu)
34393 {
34394 return 0;
34395 }
34398 Microsoft.Xna.Framework.Point point = proj.Center.ToTileCoordinates();
34400 if (!localPlayer.IsProjectileInteractibleAndInInteractionRange(proj, ref compareSpot))
34401 {
34402 return 0;
34403 }
34404 Matrix matrix = Matrix.Invert(GameViewMatrix.ZoomMatrix);
34407 Vector2 v = Vector2.Transform(position, matrix) + screenPosition;
34408 bool flag2 = proj.Hitbox.Contains(v.ToPoint());
34409 if (!((flag2 || SmartInteractProj == proj.whoAmI) & !localPlayer.lastMouseInterface))
34410 {
34411 if (!flag)
34412 {
34413 return 1;
34414 }
34415 return 0;
34416 }
34418 if (flag2)
34419 {
34420 localPlayer.noThrow = 2;
34421 localPlayer.cursorItemIconEnabled = true;
34422 localPlayer.cursorItemIconID = 4131;
34423 }
34425 {
34426 localPlayer.GamepadEnableGrappleCooldown();
34427 }
34429 {
34430 mouseRightRelease = false;
34431 localPlayer.tileInteractAttempted = true;
34432 localPlayer.tileInteractionHappened = true;
34433 localPlayer.releaseUseTile = false;
34434 if (localPlayer.chest == -5)
34435 {
34436 localPlayer.chest = -1;
34439 }
34440 else if (localPlayer.disableVoidBag < 0)
34441 {
34442 localPlayer.chest = -5;
34443 for (int i = 0; i < 40; i++)
34444 {
34445 ItemSlot.SetGlow(i, -1f, chest: true);
34446 }
34447 localPlayer.voidLensChest.Set(proj);
34448 localPlayer.chestX = point.X;
34449 localPlayer.chestY = point.Y;
34450 localPlayer.SetTalkNPC(-1);
34451 SetNPCShopIndex(0);
34452 playerInventory = true;
34455 }
34456 }
34458 {
34459 return 0;
34460 }
34461 if (!flag)
34462 {
34463 return 2;
34464 }
34465 return 0;
34466 }
34467
34469 {
34470 if (gamePaused || gameMenu)
34471 {
34472 return 0;
34473 }
34476 Microsoft.Xna.Framework.Point point = proj.Center.ToTileCoordinates();
34478 if (!localPlayer.IsProjectileInteractibleAndInInteractionRange(proj, ref compareSpot))
34479 {
34480 return 0;
34481 }
34482 Matrix matrix = Matrix.Invert(GameViewMatrix.ZoomMatrix);
34485 Vector2 v = Vector2.Transform(position, matrix) + screenPosition;
34486 bool flag2 = proj.Hitbox.Contains(v.ToPoint());
34487 if (!((flag2 || SmartInteractProj == proj.whoAmI) & !localPlayer.lastMouseInterface))
34488 {
34489 if (!flag)
34490 {
34491 return 1;
34492 }
34493 return 0;
34494 }
34496 if (flag2)
34497 {
34498 localPlayer.noThrow = 2;
34499 localPlayer.cursorItemIconEnabled = true;
34500 localPlayer.cursorItemIconID = 3213;
34501 if (proj.type == 960)
34502 {
34503 localPlayer.cursorItemIconID = 5098;
34504 }
34505 }
34507 {
34508 localPlayer.GamepadEnableGrappleCooldown();
34509 }
34511 {
34512 mouseRightRelease = false;
34513 localPlayer.tileInteractAttempted = true;
34514 localPlayer.tileInteractionHappened = true;
34515 localPlayer.releaseUseTile = false;
34516 if (localPlayer.chest == -2)
34517 {
34518 localPlayer.chest = -1;
34521 }
34522 else
34523 {
34524 localPlayer.chest = -2;
34525 for (int i = 0; i < 40; i++)
34526 {
34527 ItemSlot.SetGlow(i, -1f, chest: true);
34528 }
34529 localPlayer.piggyBankProjTracker.Set(proj);
34530 localPlayer.chestX = point.X;
34531 localPlayer.chestY = point.Y;
34532 localPlayer.SetTalkNPC(-1);
34533 SetNPCShopIndex(0);
34534 playerInventory = true;
34537 }
34538 }
34540 {
34541 return 0;
34542 }
34543 if (!flag)
34544 {
34545 return 2;
34546 }
34547 return 0;
34548 }
34549
34551 {
34552 switch (projType)
34553 {
34554 case 525:
34556 break;
34557 case 960:
34559 break;
34560 }
34561 }
34562
34563 public static void PrintTimedMessage(string message, params object[] arguments)
34564 {
34565 Console.WriteLine($"{(int)time} {string.Format(message, arguments)}");
34566 }
34567
34569 {
34570 if (gamePaused && !gameMenu)
34571 {
34572 return;
34573 }
34574 Vector2 vector = proj.position - screenPosition;
34575 if (!((float)mouseX > vector.X) || !((float)mouseX < vector.X + (float)proj.width) || !((float)mouseY > vector.Y) || !((float)mouseY < vector.Y + (float)proj.height))
34576 {
34577 return;
34578 }
34579 int num = (int)(player[myPlayer].Center.X / 16f);
34580 int num2 = (int)(player[myPlayer].Center.Y / 16f);
34581 int num3 = (int)proj.Center.X / 16;
34582 int num4 = (int)proj.Center.Y / 16;
34583 int lastTileRangeX = player[myPlayer].lastTileRangeX;
34584 int lastTileRangeY = player[myPlayer].lastTileRangeY;
34585 if (num < num3 - lastTileRangeX || num > num3 + lastTileRangeX + 1 || num2 < num4 - lastTileRangeY || num2 > num4 + lastTileRangeY + 1)
34586 {
34587 return;
34588 }
34590 player[myPlayer].noThrow = 2;
34591 player[myPlayer].cursorItemIconEnabled = true;
34592 player[myPlayer].cursorItemIconID = 3213;
34594 {
34595 player[myPlayer].GamepadEnableGrappleCooldown();
34596 }
34598 {
34599 mouseRightRelease = false;
34600 localPlayer.tileInteractAttempted = true;
34601 localPlayer.tileInteractionHappened = true;
34602 localPlayer.releaseUseTile = false;
34603 if (player[myPlayer].chest == -2)
34604 {
34606 player[myPlayer].chest = -1;
34608 return;
34609 }
34610 player[myPlayer].piggyBankProjTracker.Set(proj);
34611 player[myPlayer].chest = -2;
34612 player[myPlayer].chestX = (int)(proj.Center.X / 16f);
34613 player[myPlayer].chestY = (int)(proj.Center.Y / 16f);
34614 player[myPlayer].SetTalkNPC(-1);
34615 SetNPCShopIndex(0);
34616 playerInventory = true;
34619 }
34620 }
34621
34633
34635 {
34636 CurrentDrawnEntity = entity;
34637 Matrix transformMatrix = Transform;
34638 if (overrideMatrix.HasValue)
34639 {
34640 transformMatrix = overrideMatrix.Value;
34641 }
34642 if (intendedShader != 0)
34643 {
34645 {
34646 spriteBatch.End();
34647 spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, DefaultSamplerState, DepthStencilState.None, base.GraphicsDevice.RasterizerState, null, transformMatrix);
34648 }
34649 }
34651 {
34652 spriteBatch.End();
34653 spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, DefaultSamplerState, DepthStencilState.None, base.GraphicsDevice.RasterizerState, null, transformMatrix);
34654 }
34656 }
34657
34658 public static void EntitySpriteDraw(Texture2D texture, Vector2 position, Microsoft.Xna.Framework.Rectangle? sourceRectangle, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float worthless = 0f)
34659 {
34660 EntitySpriteDraw(texture, position, sourceRectangle, color, rotation, origin, new Vector2(scale), effects, worthless);
34661 }
34662
34663 public static void EntitySpriteDraw(Texture2D texture, Vector2 position, Microsoft.Xna.Framework.Rectangle? sourceRectangle, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float worthless = 0f)
34664 {
34666 {
34667 DrawData value = new DrawData(texture, position, sourceRectangle, color, rotation, origin, scale, effects, worthless);
34669 value.Draw(spriteBatch);
34670 }
34671 else
34672 {
34673 spriteBatch.Draw(texture, position, sourceRectangle, color, rotation, origin, scale, effects, worthless);
34674 }
34675 }
34676
34677 public static void EntitySpriteDraw(DrawData data)
34678 {
34680 {
34682 data.Draw(spriteBatch);
34683 }
34684 else
34685 {
34686 data.Draw(spriteBatch);
34687 }
34688 }
34689
34690 public static Microsoft.Xna.Framework.Color buffColor(Microsoft.Xna.Framework.Color newColor, float R, float G, float B, float A)
34691 {
34692 newColor.R = (byte)((float)(int)newColor.R * R);
34693 newColor.G = (byte)((float)(int)newColor.G * G);
34694 newColor.B = (byte)((float)(int)newColor.B * B);
34695 newColor.A = (byte)((float)(int)newColor.A * A);
34696 return newColor;
34697 }
34698
34699 protected void CacheNPCDraws()
34700 {
34705 for (int i = 0; i < 200; i++)
34706 {
34707 if (!npc[i].active)
34708 {
34709 continue;
34710 }
34711 if (npc[i].type == 398 && npc[i].ai[0] >= 0f)
34712 {
34713 int num = i;
34714 int num2 = -1;
34715 int num3 = -1;
34716 int num4 = -1;
34717 for (int j = 0; j < 200; j++)
34718 {
34719 if (npc[j].active && npc[j].ai[3] == (float)num)
34720 {
34721 if (num2 == -1 && npc[j].type == 397 && npc[j].ai[2] == 0f)
34722 {
34723 num2 = j;
34724 }
34725 if (num3 == -1 && npc[j].type == 397 && npc[j].ai[2] == 1f)
34726 {
34727 num3 = j;
34728 }
34729 if (num4 == -1 && npc[j].type == 396)
34730 {
34731 num4 = j;
34732 }
34733 if (num2 != -1 && num3 != -1 && num4 != -1)
34734 {
34735 break;
34736 }
34737 }
34738 }
34739 if (num2 != -1 && num3 != -1 && num4 != -1)
34740 {
34742 if (num2 != -1)
34743 {
34745 }
34746 if (num3 != -1)
34747 {
34749 }
34750 if (num4 != -1)
34751 {
34753 }
34754 }
34755 }
34756 else if (npc[i].type == 421 && npc[i].ai[0] == 5f)
34757 {
34759 }
34760 else if (npc[i].type == 516 || npc[i].type == 519)
34761 {
34763 }
34764 else if (npc[i].type == 548)
34765 {
34767 }
34768 }
34769 }
34770
34771 protected void CacheProjDraws()
34772 {
34779 for (int i = 0; i < 1000; i++)
34780 {
34781 if (!projectile[i].active)
34782 {
34783 continue;
34784 }
34785 if (projectile[i].type == 857)
34786 {
34788 }
34789 if (projectile[i].type == 578 || projectile[i].type == 579 || projectile[i].type == 641 || projectile[i].type == 617 || projectile[i].type == 813)
34790 {
34792 }
34793 if (projectile[i].type == 625 || projectile[i].type == 626 || projectile[i].type == 627 || projectile[i].type == 628 || projectile[i].type == 525 || projectile[i].type == 960 || projectile[i].type == 734 || projectile[i].type == 946 || (projectile[i].type == 908 && projectile[i].localAI[0] <= 0f))
34794 {
34796 }
34797 if (projectile[i].type == 759 || (projectile[i].type == 908 && projectile[i].localAI[0] > 0f))
34798 {
34800 }
34801 if (projectile[i].type == 651)
34802 {
34804 }
34805 if (projectile[i].type == 673 || projectile[i].type == 674 || projectile[i].type == 691 || projectile[i].type == 692 || projectile[i].type == 693 || projectile[i].type == 923)
34806 {
34808 }
34809 if (projectile[i].type != 636 && projectile[i].type != 598 && projectile[i].type != 971)
34810 {
34811 continue;
34812 }
34813 bool flag = true;
34814 if (projectile[i].ai[0] == 1f)
34815 {
34816 int num = (int)projectile[i].ai[1];
34817 if (num >= 0 && num < 200 && npc[num].active && npc[num].type != 492)
34818 {
34819 if (npc[num].behindTiles)
34820 {
34822 }
34823 else
34824 {
34826 }
34827 flag = false;
34828 }
34829 }
34830 if (flag)
34831 {
34833 }
34834 }
34835 }
34836
34837 protected void DrawCachedNPCs(List<int> npcCache, bool behindTiles)
34838 {
34839 for (int i = 0; i < npcCache.Count; i++)
34840 {
34841 try
34842 {
34843 DrawNPC(npcCache[i], behindTiles);
34844 }
34845 catch
34846 {
34847 npc[npcCache[i]].active = false;
34848 }
34849 }
34850 }
34851
34853 {
34854 if (startSpriteBatch)
34855 {
34857 }
34858 CurrentDrawnEntity = null;
34860 for (int i = 0; i < projCache.Count; i++)
34861 {
34862 try
34863 {
34865 }
34866 catch (Exception e)
34867 {
34869 projectile[projCache[i]].active = false;
34870 }
34871 }
34872 CurrentDrawnEntity = null;
34874 if (startSpriteBatch)
34875 {
34876 spriteBatch.End();
34877 }
34878 }
34879
34881 {
34882 if (startSpriteBatch)
34883 {
34885 }
34886 for (int i = 0; i < projCache.Count; i++)
34887 {
34888 try
34889 {
34890 int num = projCache[i];
34892 int owner = projectile.owner;
34893 Player other = Main.player[owner];
34894 if (playerVisualClone[owner] == null)
34895 {
34896 playerVisualClone[owner] = new Player();
34897 }
34899 player.CopyVisuals(other);
34900 player.isFirstFractalAfterImage = true;
34901 player.firstFractalAfterImageOpacity = projectile.Opacity * 1f;
34902 player.ResetEffects();
34903 player.ResetVisibleAccessories();
34904 player.UpdateDyes();
34905 player.DisplayDollUpdate();
34906 player.UpdateSocialShadow();
34907 player.itemAnimationMax = 60;
34908 player.itemAnimation = (int)projectile.localAI[0];
34909 player.itemRotation = projectile.velocity.ToRotation();
34910 player.heldProj = num;
34911 player.Center = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * 42f;
34912 player.direction = ((projectile.velocity.X > 0f) ? 1 : (-1));
34913 player.itemRotation = (float)Math.Atan2(projectile.velocity.Y * (float)player.direction, projectile.velocity.X * (float)player.direction);
34914 player.velocity.Y = 0.01f;
34915 player.wingFrame = 2;
34916 player.PlayerFrame();
34917 player.socialIgnoreLight = true;
34918 PlayerRenderer.DrawPlayer(Camera, player, player.position, 0f, player.fullRotationOrigin);
34919 }
34920 catch (Exception e)
34921 {
34923 Main.projectile[projCache[i]].active = false;
34924 }
34925 }
34926 if (startSpriteBatch)
34927 {
34928 spriteBatch.End();
34929 }
34930 }
34931
34937
34939 {
34940 List<int> list2 = new List<int>();
34941 for (int num = list.Count - 1; num >= 0; num--)
34942 {
34943 int num2 = list[num];
34944 if (Main.projectile[num2].type == 759)
34945 {
34946 list2.Add(num2);
34947 list.RemoveAt(num);
34949 Player master = player[projectile.owner];
34950 int stackedIndex = (int)projectile.localAI[0];
34951 if (projectile.frame == projFrames[projectile.type] - 1)
34952 {
34953 projectile.Center = Projectile.AI_158_GetHomeLocation(master, stackedIndex);
34954 projectile.velocity = Vector2.Zero;
34955 }
34956 }
34957 }
34958 list.AddRange(list2);
34959 list2.Clear();
34960 }
34961
34963 {
34965 for (int i = 0; i < list.Count; i++)
34966 {
34967 int num = list[i];
34968 if (Main.projectile[num].type == 628)
34969 {
34970 list.Remove(num);
34971 List<int> list3 = new List<int>();
34972 list3.Insert(0, num);
34973 int byUUID = Projectile.GetByUUID(Main.projectile[num].owner, Main.projectile[num].ai[0]);
34974 while (byUUID >= 0 && !list3.Contains(byUUID) && Main.projectile[byUUID].active && Main.projectile[byUUID].type >= 625 && Main.projectile[byUUID].type <= 627)
34975 {
34976 list3.Add(byUUID);
34979 }
34980 List<int> list4 = new List<int>();
34981 for (int num2 = list3.Count - 2; num2 >= 0; num2--)
34982 {
34983 list4.Add(list3[num2]);
34984 }
34985 list4.Add(list3[list3.Count - 1]);
34986 list2.Add(list4);
34987 i = -1;
34988 }
34989 }
34991 list2.Add(list5);
34992 list.Clear();
34993 for (int j = 0; j < list2.Count; j++)
34994 {
34995 for (int k = 0; k < list2[j].Count; k++)
34996 {
34997 list.Add(list2[j][k]);
34998 }
34999 }
35000 for (int l = 0; l < list.Count; l++)
35001 {
35003 int byUUID2 = Projectile.GetByUUID(projectile.owner, projectile.ai[0]);
35004 if (projectile.type < 626 || projectile.type > 628 || byUUID2 < 0 || !ProjectileID.Sets.StardustDragon[Main.projectile[byUUID2].type])
35005 {
35006 continue;
35007 }
35008 Vector2 vector = Main.projectile[byUUID2].Center - projectile.Center;
35009 if (vector != Vector2.Zero)
35010 {
35011 float num3 = Main.projectile[byUUID2].scale * 16f;
35012 float num4 = vector.Length();
35013 float num5 = num3 - num4;
35014 if (num5 != 0f)
35015 {
35016 projectile.Center += Vector2.Normalize(vector) * (0f - num5);
35017 }
35018 }
35019 }
35020 }
35021
35022 protected void DrawWoF()
35023 {
35024 if (wofNPCIndex < 0 || !npc[wofNPCIndex].active || npc[wofNPCIndex].life <= 0)
35025 {
35026 return;
35027 }
35028 for (int i = 0; i < 255; i++)
35029 {
35030 if (player[i].active && player[i].tongued && !player[i].dead)
35031 {
35033 }
35034 }
35035 for (int j = 0; j < 200; j++)
35036 {
35037 if (npc[j].active && npc[j].aiStyle == 29)
35038 {
35040 }
35041 }
35042 DrawWOFBody();
35043 }
35044
35045 private static void DrawWOFBody()
35046 {
35047 int num = TextureAssets.Wof.Height() / 3;
35048 float num2 = wofDrawAreaTop;
35049 float num3 = wofDrawAreaBottom;
35050 num3 = screenPosition.Y + (float)screenHeight;
35051 float num4 = (int)((num2 - screenPosition.Y) / (float)num) + 1;
35052 if (num4 > 12f)
35053 {
35054 return;
35055 }
35056 float num5 = num4 * (float)num;
35057 if (num5 > 0f)
35058 {
35059 num2 -= num5;
35060 }
35061 float num6 = npc[wofNPCIndex].position.X;
35062 if (npc[wofNPCIndex].direction > 0)
35063 {
35064 num6 -= 80f;
35065 }
35066 SpriteEffects effects = SpriteEffects.None;
35067 if (npc[wofNPCIndex].spriteDirection == 1)
35068 {
35069 effects = SpriteEffects.FlipHorizontally;
35070 }
35071 int num7 = wofDrawFrameIndex / 6 * num;
35072 if (!gamePaused && ++wofDrawFrameIndex >= 18)
35073 {
35075 }
35076 float num8 = num3 - num2;
35077 for (int i = (int)num2; (float)i < num3; i += num)
35078 {
35079 num8 = num3 - (float)i;
35080 if (num8 > (float)num)
35081 {
35082 num8 = num;
35083 }
35084 for (int j = 0; (float)j < num8; j += 16)
35085 {
35086 int x = (int)(num6 + (float)(TextureAssets.Wof.Width() / 2)) / 16;
35087 int y = (i + j) / 16;
35088 spriteBatch.Draw(TextureAssets.Wof.Value, new Vector2(num6 - screenPosition.X, (float)(i + j) - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, num7 + j, TextureAssets.Wof.Width(), 16), Lighting.GetColor(x, y), 0f, default(Vector2), 1f, effects, 0f);
35089 }
35090 }
35091 }
35092
35093 private static void DrawWOFRopeToTheHungry(int i)
35094 {
35095 float num = npc[wofNPCIndex].position.X + (float)(npc[wofNPCIndex].width / 2);
35096 float y = npc[wofNPCIndex].position.Y;
35098 bool flag = false;
35099 if (npc[i].frameCounter > 7.0)
35100 {
35101 flag = true;
35102 }
35103 y = (float)wofDrawAreaTop + num2 * npc[i].ai[0];
35104 float scale = npc[i].scale;
35105 float x = npc[i].Center.X;
35106 float y2 = npc[i].Bottom.Y - (float)npc[i].height * 0.5f * scale;
35107 Vector2 vector = new Vector2(x, y2);
35108 vector += npc[i].netOffset;
35109 float num3 = num - vector.X;
35110 float num4 = y - vector.Y;
35111 float rotation = (float)Math.Atan2(num4, num3) - 1.57f;
35112 bool flag2 = true;
35113 while (flag2)
35114 {
35115 SpriteEffects effects = SpriteEffects.None;
35116 if (flag)
35117 {
35118 effects = SpriteEffects.FlipHorizontally;
35119 flag = false;
35120 }
35121 else
35122 {
35123 flag = true;
35124 }
35125 int height = 28;
35126 int num5 = (int)(40f * scale);
35127 float num6 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
35128 if (num6 < (float)num5)
35129 {
35130 height = (int)num6 - num5 + 28;
35131 flag2 = false;
35132 }
35133 num6 = 28f * scale / num6;
35134 num3 *= num6;
35135 num4 *= num6;
35136 vector.X += num3;
35137 vector.Y += num4;
35138 num3 = num - vector.X;
35139 num4 = y - vector.Y;
35140 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f));
35141 spriteBatch.Draw(TextureAssets.Chain12.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain4.Width(), height), color, rotation, new Vector2((float)TextureAssets.Chain4.Width() * 0.5f, (float)TextureAssets.Chain4.Height() * 0.5f), scale, effects, 0f);
35142 }
35143 }
35144
35145 private static void DrawWOFTongueToPlayer(int i)
35146 {
35147 float num = npc[wofNPCIndex].position.X + (float)(npc[wofNPCIndex].width / 2);
35148 float num2 = npc[wofNPCIndex].position.Y + (float)(npc[wofNPCIndex].height / 2);
35149 Vector2 vector = new Vector2(player[i].position.X + (float)player[i].width * 0.5f, player[i].position.Y + (float)player[i].height * 0.5f);
35150 float num3 = num - vector.X;
35151 float num4 = num2 - vector.Y;
35152 float rotation = (float)Math.Atan2(num4, num3) - 1.57f;
35153 bool flag = true;
35154 while (flag)
35155 {
35156 float num5 = (float)Math.Sqrt(num3 * num3 + num4 * num4);
35157 if (num5 < 40f)
35158 {
35159 flag = false;
35160 continue;
35161 }
35162 num5 = (float)TextureAssets.Chain12.Height() / num5;
35163 num3 *= num5;
35164 num4 *= num5;
35165 vector.X += num3;
35166 vector.Y += num4;
35167 num3 = num - vector.X;
35168 num4 = num2 - vector.Y;
35169 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f));
35170 spriteBatch.Draw(TextureAssets.Chain12.Value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain12.Width(), TextureAssets.Chain12.Height()), color, rotation, new Vector2((float)TextureAssets.Chain12.Width() * 0.5f, (float)TextureAssets.Chain12.Height() * 0.5f), 1f, SpriteEffects.None, 0f);
35171 }
35172 }
35173
35175 {
35177 result.R = (byte)((float)(int)result.R * Alpha);
35178 result.G = (byte)((float)(int)result.G * Alpha);
35179 result.B = (byte)((float)(int)result.B * Alpha);
35180 result.A = (byte)((float)(int)result.A * Alpha);
35181 return result;
35182 }
35183
35185 {
35186 LoadItem(item.type);
35188 {
35189 DrawItem_AnimateSlot(slot, itemAnimations[item.type].TicksPerFrame, itemAnimations[item.type].FrameCount);
35190 texture = TextureAssets.Item[item.type].Value;
35191 }
35192 else if (ItemID.Sets.IsFood[item.type])
35193 {
35194 texture = TextureAssets.Item[item.type].Value;
35195 }
35196 else
35197 {
35198 switch (item.type)
35199 {
35200 case 5358:
35201 case 5359:
35202 case 5360:
35203 case 5361:
35204 LoadItem(5437);
35205 texture = TextureAssets.Item[5437].Value;
35206 break;
35207 case 71:
35208 case 72:
35209 case 73:
35210 case 74:
35211 {
35212 int num = item.type - 71;
35213 texture = TextureAssets.Coin[num].Value;
35215 frame = (glowmaskFrame = _coinOnWorldAnimation.GetFrame(texture, itemFrameCounter[slot]));
35216 return;
35217 }
35218 case 3858:
35219 texture = TextureAssets.Item[item.type].Value;
35221 frame = texture.Frame();
35222 glowmaskFrame = TextureAssets.GlowMask[233].Value.Frame(1, 3, 0, itemFrameCounter[slot] / 5);
35223 glowmaskFrame.Height -= 2;
35224 return;
35225 case 75:
35226 texture = TextureAssets.Item[item.type].Value;
35227 DrawItem_AnimateSlot(slot, itemAnimations[item.type].TicksPerFrame, itemAnimations[item.type].FrameCount * 2 - 1);
35228 break;
35229 default:
35230 texture = TextureAssets.Item[item.type].Value;
35231 break;
35232 }
35233 }
35234 if (itemAnimations[item.type] != null)
35235 {
35236 frame = (glowmaskFrame = itemAnimations[item.type].GetFrame(texture, itemFrameCounter[slot]));
35237 }
35238 else
35239 {
35240 frame = (glowmaskFrame = texture.Frame());
35241 }
35242 }
35243
35245 {
35247 {
35249 }
35250 }
35251
35252 protected void DrawItem(Item item, int whoami)
35253 {
35254 if (!item.active || item.IsAir)
35255 {
35256 return;
35257 }
35258 instance.LoadItem(item.type);
35260 Vector2 vector = frame.Size() / 2f;
35261 Vector2 vector2 = new Vector2((float)(item.width / 2) - vector.X, item.height - frame.Height);
35262 Vector2 vector3 = item.position - screenPosition + vector + vector2;
35263 float num = item.velocity.X * 0.2f;
35264 if (item.shimmered)
35265 {
35266 num = 0f;
35267 }
35268 float scale = 1f;
35269 Microsoft.Xna.Framework.Color color = Lighting.GetColor(item.Center.ToTileCoordinates());
35271 if (item.shimmered)
35272 {
35273 currentColor.R = (byte)(255f * (1f - item.shimmerTime));
35274 currentColor.G = (byte)(255f * (1f - item.shimmerTime));
35275 currentColor.B = (byte)(255f * (1f - item.shimmerTime));
35276 currentColor.A = (byte)(255f * (1f - item.shimmerTime));
35277 }
35278 else if (item.shimmerTime > 0f)
35279 {
35280 currentColor.R = (byte)((float)(int)currentColor.R * (1f - item.shimmerTime));
35281 currentColor.G = (byte)((float)(int)currentColor.G * (1f - item.shimmerTime));
35282 currentColor.B = (byte)((float)(int)currentColor.B * (1f - item.shimmerTime));
35283 currentColor.A = (byte)((float)(int)currentColor.A * (1f - item.shimmerTime));
35284 }
35286 int num2 = item.glowMask;
35287 if (!gamePaused && base.IsActive && (item.IsACoin || item.type == 58 || item.type == 109) && color.R > 60 && (float)rand.Next(500) - (Math.Abs(item.velocity.X) + Math.Abs(item.velocity.Y)) * 10f < (float)(color.R / 50))
35288 {
35289 int type = 43;
35291 int alpha = 254;
35292 float scale2 = 0.5f;
35293 if (item.IsACoin)
35294 {
35296 alpha = 0;
35297 scale2 = 1f;
35298 }
35299 switch (item.type)
35300 {
35301 case 71:
35302 type = 244;
35303 break;
35304 case 72:
35305 type = 245;
35306 break;
35307 case 73:
35308 type = 246;
35309 break;
35310 case 74:
35311 type = 247;
35312 break;
35313 }
35314 int num3 = Dust.NewDust(item.position, item.width, item.height, type, 0f, 0f, alpha, newColor, scale2);
35315 dust[num3].velocity *= 0f;
35316 }
35317 if (ItemID.Sets.BossBag[item.type])
35318 {
35319 float num4 = (float)item.timeSinceItemSpawned / 240f + GlobalTimeWrappedHourly * 0.04f;
35323 if (globalTimeWrappedHourly >= 1f)
35324 {
35326 }
35328 for (float num5 = 0f; num5 < 1f; num5 += 0.25f)
35329 {
35330 spriteBatch.Draw(texture, vector3 + new Vector2(0f, 8f).RotatedBy((num5 + num4) * ((float)Math.PI * 2f)) * globalTimeWrappedHourly, frame, new Microsoft.Xna.Framework.Color(90, 70, 255, 50), num, vector, scale, SpriteEffects.None, 0f);
35331 }
35332 for (float num6 = 0f; num6 < 1f; num6 += 0.34f)
35333 {
35334 spriteBatch.Draw(texture, vector3 + new Vector2(0f, 4f).RotatedBy((num6 + num4) * ((float)Math.PI * 2f)) * globalTimeWrappedHourly, frame, new Microsoft.Xna.Framework.Color(140, 120, 255, 77), num, vector, scale, SpriteEffects.None, 0f);
35335 }
35336 }
35337 else if (item.type == 75)
35338 {
35339 float num7 = (float)item.timeSinceItemSpawned / 240f + GlobalTimeWrappedHourly * 0.04f;
35343 if (globalTimeWrappedHourly2 >= 1f)
35344 {
35346 }
35348 for (float num8 = 0f; num8 < 1f; num8 += 0.25f)
35349 {
35350 spriteBatch.Draw(TextureAssets.Item[item.type].Value, vector3 + new Vector2(0f, 8f).RotatedBy((num8 + num7) * ((float)Math.PI * 2f)) * globalTimeWrappedHourly2, frame, new Microsoft.Xna.Framework.Color(50, 50, 255, 50), num, vector, scale, SpriteEffects.None, 0f);
35351 }
35352 for (float num9 = 0f; num9 < 1f; num9 += 0.34f)
35353 {
35354 spriteBatch.Draw(TextureAssets.Item[item.type].Value, vector3 + new Vector2(0f, 4f).RotatedBy((num9 + num7) * ((float)Math.PI * 2f)) * globalTimeWrappedHourly2, frame, new Microsoft.Xna.Framework.Color(120, 120, 255, 127), num, vector, scale, SpriteEffects.None, 0f);
35355 }
35356 }
35357 else if (item.type == 4143)
35358 {
35359 float num10 = (float)item.timeSinceItemSpawned / 240f + GlobalTimeWrappedHourly * 0.04f;
35363 if (globalTimeWrappedHourly3 >= 1f)
35364 {
35366 }
35368 for (float num11 = 0f; num11 < 1f; num11 += 0.34f)
35369 {
35370 spriteBatch.Draw(TextureAssets.Item[item.type].Value, vector3 + new Vector2(0f, 8f).RotatedBy((num11 + num10) * ((float)Math.PI * 2f)) * globalTimeWrappedHourly3, frame, new Microsoft.Xna.Framework.Color(30, 30, 155, 60), num, vector, scale, SpriteEffects.None, 0f);
35371 }
35372 for (float num12 = 0f; num12 < 1f; num12 += 0.34f)
35373 {
35374 spriteBatch.Draw(TextureAssets.Item[item.type].Value, vector3 + new Vector2(0f, 4f).RotatedBy((num12 + num10) * ((float)Math.PI * 2f)) * globalTimeWrappedHourly3, frame, new Microsoft.Xna.Framework.Color(60, 60, 127, 57), num, vector, scale, SpriteEffects.None, 0f);
35375 }
35376 spriteBatch.Draw(texture, vector3, frame, new Microsoft.Xna.Framework.Color(255, 255, 255, 128), num, vector, scale, SpriteEffects.None, 0f);
35377 }
35378 if ((item.type >= 1522 && item.type <= 1527) || item.type == 3643)
35379 {
35380 currentColor = ((!(item.shimmerTime > 0f)) ? new Microsoft.Xna.Framework.Color(250, 250, 250, mouseTextColor / 2) : new Microsoft.Xna.Framework.Color((int)(250f * (1f - item.shimmerTime)), (int)(250f * (1f - item.shimmerTime)), (int)(250f * (1f - item.shimmerTime)), (int)((float)(mouseTextColor / 2) * (1f - item.shimmerTime))));
35381 scale = (float)(int)mouseTextColor / 1000f + 0.8f;
35382 }
35383 if (item.type == 3779)
35384 {
35385 num2 = -1;
35386 }
35387 spriteBatch.Draw(texture, vector3, frame, currentColor, num, vector, scale, SpriteEffects.None, 0f);
35388 if (item.shimmered)
35389 {
35390 spriteBatch.Draw(texture, vector3, frame, new Microsoft.Xna.Framework.Color(currentColor.R, currentColor.G, currentColor.B, 0), num, vector, scale, SpriteEffects.None, 0f);
35391 }
35393 {
35394 spriteBatch.Draw(texture, vector3, frame, item.GetColor(color), num, vector, scale, SpriteEffects.None, 0f);
35395 }
35396 if (num2 != -1)
35397 {
35399 int type2 = item.type;
35400 if (type2 == 5146)
35401 {
35403 }
35404 spriteBatch.Draw(TextureAssets.GlowMask[num2].Value, vector3, frame, color2, num, vector, scale, SpriteEffects.None, 0f);
35405 }
35406 if (ItemID.Sets.TrapSigned[item.type])
35407 {
35408 spriteBatch.Draw(TextureAssets.Wire.Value, vector3 + frame.Size().RotatedBy(num) * 0.45f * item.scale, new Microsoft.Xna.Framework.Rectangle(4, 58, 8, 8), currentColor, 0f, new Vector2(4f), 1f, SpriteEffects.None, 0f);
35409 }
35410 if (item.type == 3858)
35411 {
35412 spriteBatch.Draw(TextureAssets.GlowMask[233].Value, vector3, glowmaskFrame, new Microsoft.Xna.Framework.Color(255, 255, 255, 63) * 0.75f, num, glowmaskFrame.Size() / 2f, scale, SpriteEffects.None, 0f);
35413 }
35415 {
35416 Vector2 vector4 = new Vector2(-4f, -4f) * scale;
35417 Texture2D value = TextureAssets.Extra[258].Value;
35419 spriteBatch.Draw(value, vector3 + vector4 + frame.Size().RotatedBy(num) * 0.45f * item.scale, rectangle, currentColor, num, rectangle.Size() / 2f, 1f, SpriteEffects.None, 0f);
35420 }
35421 }
35422
35423 public void DrawItems()
35424 {
35425 for (int i = 0; i < 400; i++)
35426 {
35427 DrawItem(item[i], i);
35428 }
35429 }
35430
35431 protected void DrawRain()
35432 {
35433 bool flag = base.IsActive || netMode == 1;
35437 for (int i = 0; i < maxRain; i++)
35438 {
35439 Rain rain = Main.rain[i];
35440 if (rain.active)
35441 {
35442 value.X = rain.type * 4;
35443 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)(rain.position.X + 4f) >> 4, (int)(rain.position.Y + 4f) >> 4) * 0.85f;
35444 if (shimmerAlpha > 0f)
35445 {
35446 color *= 1f - shimmerAlpha;
35447 }
35448 spriteBatch.Draw(value2, rain.position - screenPosition, value, color, rain.rotation, zero, rain.scale, SpriteEffects.None, 0f);
35449 if (flag)
35450 {
35451 rain.Update();
35452 }
35453 }
35454 }
35456 }
35457
35458 protected void DrawDust()
35459 {
35461 rectangle = new Microsoft.Xna.Framework.Rectangle((int)screenPosition.X - 1000, (int)screenPosition.Y - 1050, screenWidth + 2000, screenHeight + 2100);
35465 for (int i = 0; i < maxDustToDraw; i++)
35466 {
35467 Dust dust = Main.dust[i];
35468 if (!dust.active)
35469 {
35470 continue;
35471 }
35472 if ((dust.type >= 130 && dust.type <= 134) || (dust.type >= 219 && dust.type <= 223) || dust.type == 226 || dust.type == 278)
35473 {
35475 }
35476 if (new Microsoft.Xna.Framework.Rectangle((int)dust.position.X, (int)dust.position.Y, 4, 4).Intersects(rectangle))
35477 {
35478 float scale = dust.GetVisualScale();
35479 if (dust.shader != armorShaderData)
35480 {
35481 spriteBatch.End();
35482 armorShaderData = dust.shader;
35483 if (armorShaderData == null)
35484 {
35486 }
35487 else
35488 {
35490 dust.shader.Apply(null);
35491 }
35492 }
35493 if (dust.type >= 130 && dust.type <= 134)
35494 {
35495 float num = Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y);
35496 num *= 0.3f;
35497 num *= 10f;
35498 if (num > 10f)
35499 {
35500 num = 10f;
35501 }
35502 for (int j = 0; (float)j < num; j++)
35503 {
35504 Vector2 velocity = dust.velocity;
35505 Vector2 vector = dust.position - velocity * j;
35506 float scale2 = dust.scale * (1f - (float)j / 10f);
35507 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)((double)dust.position.X + 4.0) / 16, (int)((double)dust.position.Y + 4.0) / 16);
35508 color = dust.GetAlpha(color);
35509 spriteBatch.Draw(TextureAssets.Dust.Value, vector - screenPosition, dust.frame, color, dust.rotation, new Vector2(4f, 4f), scale2, SpriteEffects.None, 0f);
35510 }
35511 }
35512 else if (dust.type == 278)
35513 {
35514 float num2 = Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y);
35515 num2 *= 0.3f;
35516 num2 *= 10f;
35517 if (num2 > 10f)
35518 {
35519 num2 = 10f;
35520 }
35521 Vector2 origin = new Vector2(4f, 4f);
35522 for (int k = 0; (float)k < num2; k++)
35523 {
35524 Vector2 velocity2 = dust.velocity;
35525 Vector2 vector2 = dust.position - velocity2 * k;
35526 float scale3 = dust.scale * (1f - (float)k / 10f);
35527 Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int)(dust.position.X + 4f) / 16, (int)(dust.position.Y + 4f) / 16);
35528 color2 = dust.GetAlpha(color2);
35529 spriteBatch.Draw(TextureAssets.Dust.Value, vector2 - screenPosition, dust.frame, color2, dust.rotation, origin, scale3, SpriteEffects.None, 0f);
35530 }
35531 }
35532 else if (dust.type >= 219 && dust.type <= 223 && dust.fadeIn == 0f)
35533 {
35534 float num3 = Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y);
35535 num3 *= 0.3f;
35536 num3 *= 10f;
35537 if (num3 > 10f)
35538 {
35539 num3 = 10f;
35540 }
35541 for (int l = 0; (float)l < num3; l++)
35542 {
35543 Vector2 velocity3 = dust.velocity;
35544 Vector2 vector3 = dust.position - velocity3 * l;
35545 float scale4 = dust.scale * (1f - (float)l / 10f);
35546 Microsoft.Xna.Framework.Color color3 = Lighting.GetColor((int)((double)dust.position.X + 4.0) / 16, (int)((double)dust.position.Y + 4.0) / 16);
35547 color3 = dust.GetAlpha(color3);
35548 spriteBatch.Draw(TextureAssets.Dust.Value, vector3 - screenPosition, dust.frame, color3, dust.rotation, new Vector2(4f, 4f), scale4, SpriteEffects.None, 0f);
35549 }
35550 }
35551 else if (dust.type == 264 && dust.fadeIn == 0f)
35552 {
35553 float num4 = Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y);
35554 num4 *= 10f;
35555 if (num4 > 10f)
35556 {
35557 num4 = 10f;
35558 }
35559 for (int m = 0; (float)m < num4; m++)
35560 {
35561 Vector2 velocity4 = dust.velocity;
35562 Vector2 vector4 = dust.position - velocity4 * m;
35563 float scale5 = dust.scale * (1f - (float)m / 10f);
35564 Microsoft.Xna.Framework.Color color4 = Lighting.GetColor((int)((double)dust.position.X + 4.0) / 16, (int)((double)dust.position.Y + 4.0) / 16);
35565 color4 = dust.GetAlpha(color4) * 0.3f;
35566 spriteBatch.Draw(TextureAssets.Dust.Value, vector4 - screenPosition, dust.frame, color4, dust.rotation, new Vector2(5f), scale5, SpriteEffects.None, 0f);
35567 color4 = dust.GetColor(color4);
35568 spriteBatch.Draw(TextureAssets.Dust.Value, vector4 - screenPosition, dust.frame, color4, dust.rotation, new Vector2(5f), scale5, SpriteEffects.None, 0f);
35569 }
35570 }
35571 else if ((dust.type == 226 || dust.type == 272) && dust.fadeIn == 0f)
35572 {
35573 float num5 = Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y);
35574 num5 *= 0.3f;
35575 num5 *= 10f;
35576 if (num5 > 10f)
35577 {
35578 num5 = 10f;
35579 }
35580 for (int n = 0; (float)n < num5; n++)
35581 {
35582 Vector2 velocity5 = dust.velocity;
35583 Vector2 vector5 = dust.position - velocity5 * n;
35584 float scale6 = dust.scale * (1f - (float)n / 10f);
35585 Microsoft.Xna.Framework.Color color5 = Lighting.GetColor((int)((double)dust.position.X + 4.0) / 16, (int)((double)dust.position.Y + 4.0) / 16);
35586 color5 = dust.GetAlpha(color5);
35587 spriteBatch.Draw(TextureAssets.Dust.Value, vector5 - screenPosition, dust.frame, color5, dust.rotation, new Vector2(4f, 4f), scale6, SpriteEffects.None, 0f);
35588 }
35589 }
35590 Microsoft.Xna.Framework.Color newColor = Lighting.GetColor((int)((double)dust.position.X + 4.0) / 16, (int)((double)dust.position.Y + 4.0) / 16);
35591 if (dust.type == 6 || dust.type == 15 || (dust.type >= 59 && dust.type <= 64))
35592 {
35594 }
35595 newColor = dust.GetAlpha(newColor);
35596 if (dust.type == 213)
35597 {
35598 scale = 1f;
35599 }
35600 spriteBatch.Draw(TextureAssets.Dust.Value, dust.position - screenPosition, dust.frame, newColor, dust.GetVisualRotation(), new Vector2(4f, 4f), scale, SpriteEffects.None, 0f);
35601 if (dust.color.PackedValue != 0)
35602 {
35604 if (color6.PackedValue != 0)
35605 {
35606 spriteBatch.Draw(TextureAssets.Dust.Value, dust.position - screenPosition, dust.frame, color6, dust.GetVisualRotation(), new Vector2(4f, 4f), scale, SpriteEffects.None, 0f);
35607 }
35608 }
35610 {
35611 dust.active = false;
35612 }
35613 }
35614 else
35615 {
35616 dust.active = false;
35617 }
35618 }
35619 spriteBatch.End();
35620 pixelShader.CurrentTechnique.Passes[0].Apply();
35622 }
35623
35624 private static void HelpText()
35625 {
35626 bool flag = false;
35627 if (player[myPlayer].statLifeMax > 100)
35628 {
35629 flag = true;
35630 }
35631 bool flag2 = false;
35632 if (player[myPlayer].statManaMax > 20)
35633 {
35634 flag2 = true;
35635 }
35636 bool flag3 = true;
35637 bool flag4 = false;
35638 bool flag5 = false;
35639 bool flag6 = false;
35640 bool flag7 = false;
35641 bool flag8 = false;
35642 bool flag9 = false;
35643 bool flag10 = false;
35644 bool flag11 = false;
35645 bool flag12 = false;
35646 bool flag13 = false;
35647 for (int i = 0; i < 58; i++)
35648 {
35649 if (player[myPlayer].inventory[i].pick > 0 && player[myPlayer].inventory[i].Name != "Copper Pickaxe")
35650 {
35651 flag3 = false;
35652 }
35653 if (player[myPlayer].inventory[i].axe > 0 && player[myPlayer].inventory[i].Name != "Copper Axe")
35654 {
35655 flag3 = false;
35656 }
35657 if (player[myPlayer].inventory[i].hammer > 0)
35658 {
35659 flag3 = false;
35660 }
35661 if (player[myPlayer].inventory[i].type == 11 || player[myPlayer].inventory[i].type == 12 || player[myPlayer].inventory[i].type == 13 || player[myPlayer].inventory[i].type == 14 || player[myPlayer].inventory[i].type == 699 || player[myPlayer].inventory[i].type == 700 || player[myPlayer].inventory[i].type == 701 || player[myPlayer].inventory[i].type == 702)
35662 {
35663 flag4 = true;
35664 }
35665 if (player[myPlayer].inventory[i].type == 19 || player[myPlayer].inventory[i].type == 20 || player[myPlayer].inventory[i].type == 21 || player[myPlayer].inventory[i].type == 22 || player[myPlayer].inventory[i].type == 703 || player[myPlayer].inventory[i].type == 704 || player[myPlayer].inventory[i].type == 705 || player[myPlayer].inventory[i].type == 706)
35666 {
35667 flag5 = true;
35668 }
35669 if (player[myPlayer].inventory[i].type == 75)
35670 {
35671 flag6 = true;
35672 }
35673 if (player[myPlayer].inventory[i].type == 38)
35674 {
35675 flag7 = true;
35676 }
35677 if (player[myPlayer].inventory[i].type == 68 || player[myPlayer].inventory[i].type == 70 || player[myPlayer].inventory[i].type == 1330 || player[myPlayer].inventory[i].type == 1331 || player[myPlayer].inventory[i].type == 67 || player[myPlayer].inventory[i].type == 2886)
35678 {
35679 flag8 = true;
35680 }
35681 if (player[myPlayer].inventory[i].type == 84 || player[myPlayer].inventory[i].type == 1236 || player[myPlayer].inventory[i].type == 1237 || player[myPlayer].inventory[i].type == 1238 || player[myPlayer].inventory[i].type == 1239 || player[myPlayer].inventory[i].type == 1240 || player[myPlayer].inventory[i].type == 1241 || player[myPlayer].inventory[i].type == 939 || player[myPlayer].inventory[i].type == 1273 || player[myPlayer].inventory[i].type == 2585 || player[myPlayer].inventory[i].type == 2360 || player[myPlayer].inventory[i].type == 185 || player[myPlayer].inventory[i].type == 1800 || player[myPlayer].inventory[i].type == 1915)
35682 {
35683 flag9 = true;
35684 }
35685 if (player[myPlayer].inventory[i].type == 3347)
35686 {
35687 flag10 = true;
35688 }
35689 if (player[myPlayer].inventory[i].type == 174)
35690 {
35691 flag11 = true;
35692 }
35693 if (player[myPlayer].inventory[i].type == 1141)
35694 {
35695 flag12 = true;
35696 }
35697 if (player[myPlayer].inventory[i].type == 1533 || player[myPlayer].inventory[i].type == 1534 || player[myPlayer].inventory[i].type == 1535 || player[myPlayer].inventory[i].type == 1536 || player[myPlayer].inventory[i].type == 1537 || player[myPlayer].inventory[i].type == 4714)
35698 {
35699 flag13 = true;
35700 }
35701 }
35702 bool flag14 = false;
35703 bool flag15 = false;
35704 bool flag16 = false;
35705 bool flag17 = false;
35706 bool flag18 = false;
35707 bool flag19 = false;
35708 bool flag20 = false;
35709 bool flag21 = false;
35710 bool flag22 = false;
35711 bool flag23 = false;
35712 bool flag24 = false;
35713 bool flag25 = false;
35714 bool flag26 = false;
35715 bool flag27 = false;
35716 bool flag28 = false;
35717 bool flag29 = false;
35718 bool flag30 = false;
35719 bool flag31 = false;
35720 bool flag32 = false;
35721 bool flag33 = false;
35722 bool flag34 = false;
35723 bool flag35 = false;
35724 bool flag36 = false;
35725 bool flag37 = false;
35726 bool flag38 = false;
35727 int num = 0;
35728 for (int j = 0; j < 200; j++)
35729 {
35730 if (npc[j].active)
35731 {
35732 if (npc[j].townNPC && npc[j].type != 37)
35733 {
35734 num++;
35735 }
35736 if (npc[j].type == 17)
35737 {
35738 flag14 = true;
35739 }
35740 if (npc[j].type == 18)
35741 {
35742 flag15 = true;
35743 }
35744 if (npc[j].type == 19)
35745 {
35746 flag17 = true;
35747 }
35748 if (npc[j].type == 20)
35749 {
35750 flag16 = true;
35751 }
35752 if (npc[j].type == 54)
35753 {
35754 flag22 = true;
35755 }
35756 if (npc[j].type == 124)
35757 {
35758 flag19 = true;
35759 }
35760 if (npc[j].type == 38)
35761 {
35762 flag18 = true;
35763 }
35764 if (npc[j].type == 108)
35765 {
35766 flag20 = true;
35767 }
35768 if (npc[j].type == 107)
35769 {
35770 flag21 = true;
35771 }
35772 if (npc[j].type == 228)
35773 {
35774 flag23 = true;
35775 }
35776 if (npc[j].type == 178)
35777 {
35778 flag24 = true;
35779 }
35780 if (npc[j].type == 209)
35781 {
35782 flag25 = true;
35783 }
35784 if (npc[j].type == 353)
35785 {
35786 flag26 = true;
35787 }
35788 if (npc[j].type == 633)
35789 {
35790 flag38 = true;
35791 }
35792 if (npc[j].type == 369)
35793 {
35794 flag27 = true;
35795 }
35796 if (npc[j].type == 441)
35797 {
35798 flag28 = true;
35799 }
35800 if (npc[j].type == 229)
35801 {
35802 flag29 = true;
35803 }
35804 if (npc[j].type == 207)
35805 {
35806 flag30 = true;
35807 }
35808 if (npc[j].type == 160)
35809 {
35810 flag31 = true;
35811 }
35812 if (npc[j].type == 588)
35813 {
35814 flag32 = true;
35815 }
35816 if (npc[j].type == 227)
35817 {
35818 flag33 = true;
35819 }
35820 if (npc[j].type == 208)
35821 {
35822 flag34 = true;
35823 }
35824 if (npc[j].type == 550)
35825 {
35826 flag35 = true;
35827 }
35828 if (npc[j].type == 368)
35829 {
35830 flag36 = true;
35831 }
35832 if (npc[j].type == 453)
35833 {
35834 flag37 = true;
35835 }
35836 }
35837 }
35839 while (true)
35840 {
35841 helpText++;
35842 if (Language.Exists("GuideHelpText.Help_" + helpText))
35843 {
35844 LocalizedText text = Language.GetText("GuideHelpText.Help_" + helpText);
35845 if (text.CanFormatWith(obj))
35846 {
35847 npcChatText = text.FormatWith(obj);
35848 return;
35849 }
35850 }
35851 if (flag3)
35852 {
35853 if (helpText == 1)
35854 {
35855 npcChatText = Lang.dialog(177);
35856 return;
35857 }
35858 if (helpText == 2)
35859 {
35860 npcChatText = Lang.dialog(178);
35861 return;
35862 }
35863 if (helpText == 3)
35864 {
35865 npcChatText = Lang.dialog(179);
35866 return;
35867 }
35868 if (helpText == 4)
35869 {
35870 npcChatText = Lang.dialog(180);
35871 return;
35872 }
35873 if (helpText == 5)
35874 {
35875 npcChatText = Lang.dialog(181);
35876 return;
35877 }
35878 if (helpText == 6)
35879 {
35880 npcChatText = Lang.dialog(182);
35881 return;
35882 }
35883 }
35884 if (flag3 && !flag4 && !flag5 && helpText == 11)
35885 {
35886 npcChatText = Lang.dialog(183);
35887 return;
35888 }
35889 if (flag3 && flag4 && !flag5)
35890 {
35891 if (helpText == 21)
35892 {
35893 npcChatText = Lang.dialog(184);
35894 return;
35895 }
35896 if (helpText == 22)
35897 {
35898 npcChatText = Lang.dialog(185);
35899 return;
35900 }
35901 }
35902 if (flag3 && flag5)
35903 {
35904 if (helpText == 31)
35905 {
35906 npcChatText = Lang.dialog(186);
35907 return;
35908 }
35909 if (helpText == 32)
35910 {
35911 npcChatText = Lang.dialog(187);
35912 return;
35913 }
35914 }
35915 if (!flag && helpText == 41)
35916 {
35917 npcChatText = Lang.dialog(188);
35918 return;
35919 }
35920 if (!flag2 && helpText == 42)
35921 {
35922 npcChatText = Lang.dialog(189);
35923 return;
35924 }
35925 if (!flag2 && !flag6 && helpText == 43)
35926 {
35927 npcChatText = Lang.dialog(190);
35928 return;
35929 }
35930 if (!flag14 && !flag15)
35931 {
35932 if (helpText == 51)
35933 {
35934 npcChatText = Lang.dialog(191);
35935 return;
35936 }
35937 if (helpText == 52)
35938 {
35939 npcChatText = Lang.dialog(192);
35940 return;
35941 }
35942 if (helpText == 53)
35943 {
35944 npcChatText = Lang.dialog(193);
35945 return;
35946 }
35947 if (helpText == 54)
35948 {
35949 npcChatText = Lang.dialog(194);
35950 return;
35951 }
35952 if (helpText == 55)
35953 {
35954 npcChatText = Language.GetTextValue("GuideHelpText.Help_1065");
35955 return;
35956 }
35957 }
35958 if (!flag14 && helpText == 61)
35959 {
35960 npcChatText = Lang.dialog(195);
35961 return;
35962 }
35963 if (!flag15 && helpText == 62)
35964 {
35965 npcChatText = Lang.dialog(196);
35966 return;
35967 }
35968 if (!flag17 && helpText == 63)
35969 {
35970 npcChatText = Lang.dialog(197);
35971 return;
35972 }
35973 if (!flag16 && helpText == 64)
35974 {
35975 npcChatText = Lang.dialog(198);
35976 return;
35977 }
35978 if (!flag19 && helpText == 65 && NPC.downedBoss3)
35979 {
35980 npcChatText = Lang.dialog(199);
35981 return;
35982 }
35983 if (!flag22 && helpText == 66 && NPC.downedBoss3)
35984 {
35985 npcChatText = Lang.dialog(200);
35986 return;
35987 }
35988 if (!flag18 && helpText == 67)
35989 {
35990 npcChatText = Lang.dialog(201);
35991 return;
35992 }
35993 if (!flag21 && NPC.downedBoss2 && helpText == 68)
35994 {
35995 npcChatText = Lang.dialog(202);
35996 return;
35997 }
35998 if (!flag20 && hardMode && helpText == 69)
35999 {
36000 npcChatText = Lang.dialog(203);
36001 return;
36002 }
36003 if (!flag23 && helpText == 70 && NPC.downedBoss2)
36004 {
36005 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1100");
36006 return;
36007 }
36008 if (!flag24 && helpText == 71 && hardMode)
36009 {
36010 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1101");
36011 return;
36012 }
36014 {
36015 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1102");
36016 return;
36017 }
36018 if (!flag26 && helpText == 73)
36019 {
36020 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1103");
36021 return;
36022 }
36023 if (!flag27 && helpText == 74)
36024 {
36025 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1104");
36026 return;
36027 }
36028 if (!flag28 && helpText == 75 && hardMode)
36029 {
36030 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1105");
36031 return;
36032 }
36033 if (!flag29 && helpText == 76 && hardMode)
36034 {
36035 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1106");
36036 return;
36037 }
36038 if (!flag30 && helpText == 77)
36039 {
36040 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1107");
36041 return;
36042 }
36043 if (!flag31 && helpText == 78 && hardMode)
36044 {
36045 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1108");
36046 return;
36047 }
36048 if (!flag32 && helpText == 79)
36049 {
36050 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1109");
36051 return;
36052 }
36053 if (!flag33 && helpText == 80 && num >= 5)
36054 {
36055 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1110");
36056 return;
36057 }
36058 if (!flag34 && helpText == 81 && num >= 11)
36059 {
36060 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1111");
36061 return;
36062 }
36063 if (!flag35 && NPC.downedBoss2 && helpText == 82)
36064 {
36065 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1112");
36066 return;
36067 }
36068 if (!flag36 && helpText == 83 && flag14)
36069 {
36070 npcChatText = Language.GetTextValueWith("GuideHelpTextSpecific.Help_1113", obj);
36071 return;
36072 }
36073 if (!flag37 && helpText == 84 && !hardMode)
36074 {
36075 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1114");
36076 return;
36077 }
36078 if (!flag38 && helpText == 85 && !hardMode)
36079 {
36080 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1115");
36081 return;
36082 }
36083 if (flag7 && !WorldGen.crimson && helpText == 100)
36084 {
36085 npcChatText = Lang.dialog(204);
36086 return;
36087 }
36088 if (flag8 && helpText == 101)
36089 {
36090 npcChatText = Lang.dialog(WorldGen.crimson ? 403 : 205);
36091 return;
36092 }
36093 if ((flag7 || flag8) && helpText == 102)
36094 {
36095 npcChatText = Lang.dialog(WorldGen.crimson ? 402 : 206);
36096 return;
36097 }
36098 if (flag7 && WorldGen.crimson && helpText == 103)
36099 {
36100 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1159");
36101 return;
36102 }
36103 if (!flag9 && LocalPlayer.miscEquips[4].IsAir && helpText == 201 && !hardMode && !NPC.downedBoss3 && !NPC.downedBoss2)
36104 {
36105 npcChatText = Lang.dialog(207);
36106 return;
36107 }
36108 if (helpText == 202 && !hardMode && player[myPlayer].statLifeMax >= 140)
36109 {
36110 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1120");
36111 return;
36112 }
36113 if (helpText == 203 && hardMode && NPC.downedMechBossAny)
36114 {
36115 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1121");
36116 return;
36117 }
36118 if (helpText == 204 && !NPC.downedGoblins && player[myPlayer].statLifeMax >= 200 && WorldGen.shadowOrbSmashed)
36119 {
36120 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1122");
36121 return;
36122 }
36123 if (helpText == 205 && hardMode && !NPC.downedPirates && player[myPlayer].statLifeMax >= 200)
36124 {
36125 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1123");
36126 return;
36127 }
36129 {
36130 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1124");
36131 return;
36132 }
36133 if (helpText == 207 && (NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3))
36134 {
36135 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1125");
36136 return;
36137 }
36138 if (helpText == 208 && !hardMode)
36139 {
36140 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1130");
36141 return;
36142 }
36143 if (helpText == 209 && !hardMode)
36144 {
36145 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1131");
36146 return;
36147 }
36148 if (helpText == 210 && !hardMode)
36149 {
36150 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1132");
36151 return;
36152 }
36153 if (helpText == 211 && !hardMode)
36154 {
36155 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1133");
36156 return;
36157 }
36158 if (helpText == 212 && !hardMode)
36159 {
36160 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1134");
36161 return;
36162 }
36163 if (helpText == 213 && !hardMode)
36164 {
36165 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1135");
36166 return;
36167 }
36168 if (helpText == 214 && !hardMode && (flag4 || flag5))
36169 {
36170 npcChatText = Language.GetTextValueWith("GuideHelpTextSpecific.Help_1136", obj);
36171 return;
36172 }
36173 if (helpText == 215 && LocalPlayer.anglerQuestsFinished < 1)
36174 {
36175 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1137");
36176 return;
36177 }
36178 if (helpText == 216 && !hardMode)
36179 {
36180 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1138");
36181 return;
36182 }
36183 if (helpText == 1000 && !NPC.downedBoss1 && !NPC.downedBoss2)
36184 {
36185 npcChatText = Lang.dialog(208);
36186 return;
36187 }
36188 if (helpText == 1001 && !NPC.downedBoss1 && !NPC.downedBoss2)
36189 {
36190 npcChatText = Lang.dialog(209);
36191 return;
36192 }
36193 if (helpText == 1002 && !NPC.downedBoss2)
36194 {
36195 if (WorldGen.crimson)
36196 {
36197 npcChatText = Lang.dialog(331);
36198 }
36199 else
36200 {
36201 npcChatText = Lang.dialog(210);
36202 }
36203 return;
36204 }
36205 if (helpText == 1050 && !NPC.downedBoss1 && player[myPlayer].statLifeMax < 200)
36206 {
36207 npcChatText = Lang.dialog(211);
36208 return;
36209 }
36210 if (helpText == 1051 && !NPC.downedBoss1 && player[myPlayer].statDefense <= 10)
36211 {
36212 npcChatText = Lang.dialog(212);
36213 return;
36214 }
36215 if (helpText == 1052 && !NPC.downedBoss1 && player[myPlayer].statLifeMax >= 200 && player[myPlayer].statDefense > 10)
36216 {
36217 npcChatText = Lang.dialog(WorldGen.crimson ? 404 : 213);
36218 return;
36219 }
36220 if (helpText == 1053 && NPC.downedBoss1 && !NPC.downedBoss2 && player[myPlayer].statLifeMax < 300)
36221 {
36222 npcChatText = Lang.dialog(214);
36223 return;
36224 }
36225 if (helpText == 1054 && NPC.downedBoss1 && !NPC.downedBoss2 && !WorldGen.crimson && player[myPlayer].statLifeMax >= 300)
36226 {
36227 npcChatText = Lang.dialog(215);
36228 return;
36229 }
36230 if (helpText == 1055 && NPC.downedBoss1 && !NPC.downedBoss2 && !WorldGen.crimson && player[myPlayer].statLifeMax >= 300)
36231 {
36232 npcChatText = Lang.dialog(216);
36233 return;
36234 }
36235 if (helpText == 1056 && NPC.downedBoss1 && NPC.downedBoss2 && !NPC.downedBoss3)
36236 {
36237 npcChatText = Lang.dialog(217);
36238 return;
36239 }
36240 if (helpText == 1057 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !hardMode && player[myPlayer].statLifeMax < 400)
36241 {
36242 npcChatText = Lang.dialog(218);
36243 return;
36244 }
36245 if (helpText == 1058 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !hardMode && player[myPlayer].statLifeMax >= 400)
36246 {
36247 npcChatText = Lang.dialog(219);
36248 return;
36249 }
36250 if (helpText == 1059 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !hardMode && player[myPlayer].statLifeMax >= 400)
36251 {
36252 npcChatText = Lang.dialog(220);
36253 return;
36254 }
36255 if (helpText == 1060 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !hardMode && player[myPlayer].statLifeMax >= 400)
36256 {
36257 npcChatText = Lang.dialog(221);
36258 return;
36259 }
36260 if (helpText == 1061 && hardMode && !NPC.downedPlantBoss)
36261 {
36262 npcChatText = Lang.dialog(WorldGen.crimson ? 401 : 222);
36263 return;
36264 }
36265 if (helpText == 1062 && hardMode && !NPC.downedPlantBoss)
36266 {
36267 npcChatText = Lang.dialog(223);
36268 return;
36269 }
36270 if (helpText == 1140 && NPC.downedBoss1 && !NPC.downedBoss2 && WorldGen.crimson && player[myPlayer].statLifeMax >= 300)
36271 {
36272 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1140");
36273 return;
36274 }
36275 if (helpText == 1141 && NPC.downedBoss1 && !NPC.downedBoss2 && WorldGen.crimson && player[myPlayer].statLifeMax >= 300)
36276 {
36277 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1141");
36278 return;
36279 }
36280 if (helpText == 1142 && NPC.downedBoss2 && !hardMode)
36281 {
36282 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1142");
36283 return;
36284 }
36285 if (helpText == 1143 && NPC.downedBoss2 && !NPC.downedQueenBee && player[myPlayer].statLifeMax >= 300)
36286 {
36287 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1143");
36288 return;
36289 }
36290 if (helpText == 1144 && flag10)
36291 {
36292 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1144");
36293 return;
36294 }
36295 if (helpText == 1145 && flag11 && !hardMode)
36296 {
36297 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1145");
36298 return;
36299 }
36300 if (helpText == 1146 && hardMode && player[myPlayer].wingsLogic == 0 && !LocalPlayer.mount.Active && !NPC.downedPlantBoss)
36301 {
36302 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1146");
36303 return;
36304 }
36306 {
36307 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1147");
36308 return;
36309 }
36311 {
36312 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1148");
36313 return;
36314 }
36315 if (helpText == 1149 && hardMode && NPC.downedMechBossAny && player[myPlayer].statLifeMax < 500)
36316 {
36317 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1149");
36318 return;
36319 }
36321 {
36322 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1150");
36323 return;
36324 }
36326 {
36327 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1151");
36328 return;
36329 }
36330 if (helpText == 1152 && hardMode && NPC.downedPlantBoss && !NPC.downedGolemBoss && !flag12)
36331 {
36332 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1152");
36333 return;
36334 }
36335 if (helpText == 1153 && hardMode && flag13)
36336 {
36337 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1153");
36338 return;
36339 }
36340 if (helpText == 1154 && hardMode && !NPC.downedFishron)
36341 {
36342 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1154");
36343 return;
36344 }
36346 {
36347 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1155");
36348 return;
36349 }
36351 {
36352 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1156");
36353 return;
36354 }
36355 if (helpText == 1157 && hardMode && NPC.downedGolemBoss && NPC.AnyNPCs(437) && !NPC.downedMoonlord)
36356 {
36357 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1157");
36358 return;
36359 }
36361 {
36362 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1158");
36363 return;
36364 }
36366 {
36367 break;
36368 }
36369 if (helpText > 1200)
36370 {
36371 helpText = 0;
36372 }
36373 }
36374 npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1160");
36375 }
36376
36377 protected void GUIChatDrawInner()
36378 {
36379 if (player[myPlayer].talkNPC < 0 && player[myPlayer].sign == -1)
36380 {
36381 npcChatText = "";
36382 return;
36383 }
36384 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(200, 200, 200, 200);
36385 int num = (mouseTextColor * 2 + 255) / 3;
36387 bool flag = InGameUI.CurrentState is UIVirtualKeyboard && PlayerInput.UsingGamepad;
36388 string textValue = npcChatText;
36389 bool num2 = player[myPlayer].talkNPC != -1 && CanDryadPlayStardewAnimation(LocalPlayer, npc[player[myPlayer].talkNPC]);
36390 if (player[myPlayer].talkNPC != -1 && npc[player[myPlayer].talkNPC].ai[0] == 24f && NPC.RerollDryadText == 2)
36391 {
36392 NPC.RerollDryadText = 1;
36393 }
36394 if (num2 && NPC.RerollDryadText == 1 && npc[player[myPlayer].talkNPC].ai[0] != 24f && player[myPlayer].talkNPC != -1 && npc[player[myPlayer].talkNPC].active && npc[player[myPlayer].talkNPC].type == 20)
36395 {
36396 NPC.RerollDryadText = 0;
36397 npcChatText = npc[player[myPlayer].talkNPC].GetChat();
36398 NPC.PreventJojaColaDialog = true;
36399 }
36401 {
36402 textValue = Language.GetTextValue("StardewTalk.PlayerHasColaAndIsHoldingIt");
36403 }
36404 bool flag2 = player[myPlayer].talkNPC != -1;
36408 bool flag3 = false;
36409 if (editSign)
36410 {
36412 if (textBlinkerCount >= 20)
36413 {
36414 if (textBlinkerState == 0)
36415 {
36416 textBlinkerState = 1;
36417 }
36418 else
36419 {
36420 textBlinkerState = 0;
36421 }
36422 textBlinkerCount = 0;
36423 }
36424 if (textBlinkerState == 1)
36425 {
36426 flag3 = true;
36427 }
36428 instance.DrawWindowsIMEPanel(new Vector2(screenWidth / 2, 90f), 0.5f);
36429 }
36430 amountOfLines++;
36431 spriteBatch.Draw(TextureAssets.ChatBack.Value, new Vector2(screenWidth / 2 - TextureAssets.ChatBack.Width() / 2, 100f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.ChatBack.Width(), (amountOfLines + 1) * 30), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
36432 spriteBatch.Draw(TextureAssets.ChatBack.Value, new Vector2(screenWidth / 2 - TextureAssets.ChatBack.Width() / 2, 100 + (amountOfLines + 1) * 30), new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.ChatBack.Height() - 30, TextureAssets.ChatBack.Width(), 30), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
36433 for (int i = 0; i < amountOfLines; i++)
36434 {
36435 string text = textLines[i];
36436 if (text != null)
36437 {
36438 if (i == amountOfLines - 1 && flag3)
36439 {
36440 text += "|";
36441 }
36442 if (flag2)
36443 {
36445 }
36446 else
36447 {
36449 }
36450 }
36451 }
36453 int num3 = 120 + amountOfLines * 30 + 30;
36454 num3 -= 235;
36455 UIVirtualKeyboard.ShouldHideText = !PlayerInput.SettingsForUI.ShowGamepadHints;
36457 {
36458 num3 = 9999;
36459 }
36460 UIVirtualKeyboard.OffsetDown = num3;
36461 if (npcChatCornerItem != 0)
36462 {
36463 Vector2 position = new Vector2(screenWidth / 2 + TextureAssets.ChatBack.Width() / 2, 100 + (amountOfLines + 1) * 30 + 30);
36464 position -= Vector2.One * 8f;
36465 Item item = new Item();
36466 item.netDefaults(npcChatCornerItem);
36467 float num4 = 1f;
36469 if (rectangle2.Width > 32 || rectangle2.Height > 32)
36470 {
36471 num4 = ((rectangle2.Width <= rectangle2.Height) ? (32f / (float)rectangle2.Height) : (32f / (float)rectangle2.Width));
36472 }
36473 spriteBatch.Draw(itemTexture, position, rectangle2, item.GetAlpha(Microsoft.Xna.Framework.Color.White), 0f, rectangle2.Size(), num4, SpriteEffects.None, 0f);
36474 if (item.color != default(Microsoft.Xna.Framework.Color))
36475 {
36476 spriteBatch.Draw(itemTexture, position, rectangle2, item.GetColor(item.color), 0f, rectangle2.Size(), num4, SpriteEffects.None, 0f);
36477 }
36478 if (new Microsoft.Xna.Framework.Rectangle((int)position.X - (int)((float)rectangle2.Width * num4), (int)position.Y - (int)((float)rectangle2.Height * num4), (int)((float)rectangle2.Width * num4), (int)((float)rectangle2.Height * num4)).Contains(new Microsoft.Xna.Framework.Point(mouseX, mouseY)))
36479 {
36480 cursorOverride = 2;
36482 {
36483 if (!drawingPlayerChat)
36484 {
36486 }
36488 {
36490 }
36491 }
36492 MouseText(item.Name, -11, 0);
36493 }
36494 }
36495 num = mouseTextColor;
36496 color2 = new Microsoft.Xna.Framework.Color(num, (int)((double)num / 1.1), num / 2, num);
36497 string focusText = "";
36498 string focusText2 = "";
36499 int num5 = player[myPlayer].statLifeMax2 - player[myPlayer].statLife;
36500 for (int j = 0; j < Player.maxBuffs; j++)
36501 {
36502 int num6 = player[myPlayer].buffType[j];
36504 {
36505 num5 += 100;
36506 }
36507 }
36508 if (NPC.downedGolemBoss)
36509 {
36510 num5 *= 200;
36511 }
36512 else if (NPC.downedPlantBoss)
36513 {
36514 num5 *= 150;
36515 }
36516 else if (NPC.downedMechBossAny)
36517 {
36518 num5 *= 100;
36519 }
36520 else if (hardMode)
36521 {
36522 num5 *= 60;
36523 }
36524 else if (NPC.downedBoss3 || NPC.downedQueenBee)
36525 {
36526 num5 *= 25;
36527 }
36528 else if (NPC.downedBoss2)
36529 {
36530 num5 *= 10;
36531 }
36532 else if (NPC.downedBoss1)
36533 {
36534 num5 *= 3;
36535 }
36536 if (expertMode)
36537 {
36538 num5 *= 2;
36539 }
36540 num5 = (int)((double)num5 * player[myPlayer].currentShoppingSettings.PriceAdjustment);
36541 string text2 = null;
36542 string text3 = null;
36543 if (player[myPlayer].sign > -1)
36544 {
36545 focusText = ((!editSign) ? Lang.inter[48].Value : Lang.inter[47].Value);
36546 }
36547 else if (npc[player[myPlayer].talkNPC].type == 20)
36548 {
36549 focusText = Lang.inter[28].Value;
36550 focusText2 = Lang.inter[49].Value;
36552 {
36553 focusText2 = Language.GetTextValue("StardewTalk.GiveColaButtonText");
36554 }
36555 }
36556 else if (NPCID.Sets.IsTownPet[npc[player[myPlayer].talkNPC].type])
36557 {
36558 focusText = Language.GetTextValue("UI.PetTheAnimal");
36559 }
36560 else if (npc[player[myPlayer].talkNPC].type == 207)
36561 {
36562 focusText = Lang.inter[28].Value;
36563 if (hardMode)
36564 {
36565 focusText2 = Lang.inter[107].Value;
36566 }
36567 }
36568 else if (npc[player[myPlayer].talkNPC].type == 453)
36569 {
36570 focusText = Lang.inter[28].Value;
36571 }
36572 else if (npc[player[myPlayer].talkNPC].type == 550)
36573 {
36574 focusText = Lang.inter[28].Value;
36575 focusText2 = Language.GetTextValue("UI.BartenderHelp");
36576 }
36577 else if (npc[player[myPlayer].talkNPC].type == 588)
36578 {
36579 focusText = Lang.inter[28].Value;
36580 }
36581 else if (npc[player[myPlayer].talkNPC].type == 633)
36582 {
36583 focusText = Lang.inter[28].Value;
36584 }
36585 else if (npc[player[myPlayer].talkNPC].type == 663)
36586 {
36587 focusText = Lang.inter[28].Value;
36588 }
36589 else if (npc[player[myPlayer].talkNPC].type == 353)
36590 {
36591 focusText = Lang.inter[28].Value;
36592 focusText2 = Language.GetTextValue("GameUI.HairStyle");
36593 }
36594 else if (npc[player[myPlayer].talkNPC].type == 368)
36595 {
36596 focusText = Lang.inter[28].Value;
36597 }
36598 else if (npc[player[myPlayer].talkNPC].type == 369)
36599 {
36600 focusText = Lang.inter[64].Value;
36601 }
36602 else if (npc[player[myPlayer].talkNPC].type == 208)
36603 {
36604 focusText = Lang.inter[28].Value;
36605 if (TOWMusicUnlocked)
36606 {
36607 focusText2 = Language.GetTextValue("GameUI.Music");
36608 }
36609 }
36610 else if (npc[player[myPlayer].talkNPC].type == 227)
36611 {
36612 focusText = Lang.inter[28].Value;
36613 focusText2 = Language.GetTextValue("GameUI.PainterDecor");
36614 }
36615 else if (npc[player[myPlayer].talkNPC].type == 17 || npc[player[myPlayer].talkNPC].type == 19 || npc[player[myPlayer].talkNPC].type == 38 || npc[player[myPlayer].talkNPC].type == 54 || npc[player[myPlayer].talkNPC].type == 107 || npc[player[myPlayer].talkNPC].type == 108 || npc[player[myPlayer].talkNPC].type == 124 || npc[player[myPlayer].talkNPC].type == 142 || npc[player[myPlayer].talkNPC].type == 160 || npc[player[myPlayer].talkNPC].type == 178 || npc[player[myPlayer].talkNPC].type == 207 || npc[player[myPlayer].talkNPC].type == 209 || npc[player[myPlayer].talkNPC].type == 228 || npc[player[myPlayer].talkNPC].type == 229)
36616 {
36617 focusText = Lang.inter[28].Value;
36618 if (npc[player[myPlayer].talkNPC].type == 107)
36619 {
36620 focusText2 = Lang.inter[19].Value;
36621 }
36622 }
36623 else if (npc[player[myPlayer].talkNPC].type == 37)
36624 {
36625 if (!IsItDay())
36626 {
36627 focusText = Lang.inter[50].Value;
36628 }
36629 }
36630 else if (npc[player[myPlayer].talkNPC].type == 22)
36631 {
36632 focusText = Lang.inter[51].Value;
36633 focusText2 = Lang.inter[25].Value;
36634 }
36635 else if (npc[player[myPlayer].talkNPC].type == 441)
36636 {
36637 if (player[myPlayer].taxMoney <= 0)
36638 {
36639 focusText = Lang.inter[89].Value;
36640 }
36641 else
36642 {
36643 string text4 = "";
36644 int num7 = 0;
36645 int num8 = 0;
36646 int num9 = 0;
36647 int num10 = 0;
36648 int taxMoney = player[myPlayer].taxMoney;
36649 taxMoney = (int)((double)taxMoney / player[myPlayer].currentShoppingSettings.PriceAdjustment);
36650 if (taxMoney < 0)
36651 {
36652 taxMoney = 0;
36653 }
36654 num5 = taxMoney;
36655 if (taxMoney >= 1000000)
36656 {
36657 num7 = taxMoney / 1000000;
36658 taxMoney -= num7 * 1000000;
36659 }
36660 if (taxMoney >= 10000)
36661 {
36662 num8 = taxMoney / 10000;
36663 taxMoney -= num8 * 10000;
36664 }
36665 if (taxMoney >= 100)
36666 {
36667 num9 = taxMoney / 100;
36668 taxMoney -= num9 * 100;
36669 }
36670 if (taxMoney >= 1)
36671 {
36672 num10 = taxMoney;
36673 }
36674 if (num7 > 0)
36675 {
36676 text4 = text4 + num7 + " " + Lang.inter[15].Value + " ";
36677 }
36678 if (num8 > 0)
36679 {
36680 text4 = text4 + num8 + " " + Lang.inter[16].Value + " ";
36681 }
36682 if (num9 > 0)
36683 {
36684 text4 = text4 + num9 + " " + Lang.inter[17].Value + " ";
36685 }
36686 if (num10 > 0)
36687 {
36688 text4 = text4 + num10 + " " + Lang.inter[18].Value + " ";
36689 }
36690 float num11 = (float)(int)mouseTextColor / 255f;
36691 if (num7 > 0)
36692 {
36693 color2 = new Microsoft.Xna.Framework.Color((byte)(220f * num11), (byte)(220f * num11), (byte)(198f * num11), mouseTextColor);
36694 }
36695 else if (num8 > 0)
36696 {
36697 color2 = new Microsoft.Xna.Framework.Color((byte)(224f * num11), (byte)(201f * num11), (byte)(92f * num11), mouseTextColor);
36698 }
36699 else if (num9 > 0)
36700 {
36701 color2 = new Microsoft.Xna.Framework.Color((byte)(181f * num11), (byte)(192f * num11), (byte)(193f * num11), mouseTextColor);
36702 }
36703 else if (num10 > 0)
36704 {
36705 color2 = new Microsoft.Xna.Framework.Color((byte)(246f * num11), (byte)(138f * num11), (byte)(96f * num11), mouseTextColor);
36706 }
36707 if (text4 == "")
36708 {
36709 focusText = Lang.inter[89].Value;
36710 }
36711 else
36712 {
36713 text4 = text4.Substring(0, text4.Length - 1);
36714 focusText = Lang.inter[89].Value + " (" + text4 + ")";
36715 }
36716 focusText = Lang.inter[89].Value;
36717 text3 = focusText;
36718 text2 = "";
36719 for (int k = 0; k < focusText.Length; k++)
36720 {
36721 text2 += " ";
36722 }
36723 focusText = focusText + text2 + " ";
36724 }
36725 }
36726 else if (npc[player[myPlayer].talkNPC].type == 18)
36727 {
36728 string text5 = "";
36729 int num12 = 0;
36730 int num13 = 0;
36731 int num14 = 0;
36732 int num15 = 0;
36733 int num16 = num5;
36734 if (num16 > 0 && num16 < 1)
36735 {
36736 num16 = 1;
36737 }
36738 if (num16 < 0)
36739 {
36740 num16 = 0;
36741 }
36742 num5 = num16;
36743 if (num16 >= 1000000)
36744 {
36745 num12 = num16 / 1000000;
36746 num16 -= num12 * 1000000;
36747 }
36748 if (num16 >= 10000)
36749 {
36750 num13 = num16 / 10000;
36751 num16 -= num13 * 10000;
36752 }
36753 if (num16 >= 100)
36754 {
36755 num14 = num16 / 100;
36756 num16 -= num14 * 100;
36757 }
36758 if (num16 >= 1)
36759 {
36760 num15 = num16;
36761 }
36762 if (num12 > 0)
36763 {
36764 text5 = text5 + num12 + " " + Lang.inter[15].Value + " ";
36765 }
36766 if (num13 > 0)
36767 {
36768 text5 = text5 + num13 + " " + Lang.inter[16].Value + " ";
36769 }
36770 if (num14 > 0)
36771 {
36772 text5 = text5 + num14 + " " + Lang.inter[17].Value + " ";
36773 }
36774 if (num15 > 0)
36775 {
36776 text5 = text5 + num15 + " " + Lang.inter[18].Value + " ";
36777 }
36778 float num17 = (float)(int)mouseTextColor / 255f;
36779 if (num12 > 0)
36780 {
36781 color2 = new Microsoft.Xna.Framework.Color((byte)(220f * num17), (byte)(220f * num17), (byte)(198f * num17), mouseTextColor);
36782 }
36783 else if (num13 > 0)
36784 {
36785 color2 = new Microsoft.Xna.Framework.Color((byte)(224f * num17), (byte)(201f * num17), (byte)(92f * num17), mouseTextColor);
36786 }
36787 else if (num14 > 0)
36788 {
36789 color2 = new Microsoft.Xna.Framework.Color((byte)(181f * num17), (byte)(192f * num17), (byte)(193f * num17), mouseTextColor);
36790 }
36791 else if (num15 > 0)
36792 {
36793 color2 = new Microsoft.Xna.Framework.Color((byte)(246f * num17), (byte)(138f * num17), (byte)(96f * num17), mouseTextColor);
36794 }
36795 if (text5 == "")
36796 {
36797 focusText = Lang.inter[54].Value;
36798 }
36799 else
36800 {
36801 text5 = text5.Substring(0, text5.Length - 1);
36802 focusText = Lang.inter[54].Value + " (" + text5 + ")";
36803 }
36804 }
36805 if (!flag)
36806 {
36808 if (text2 != null)
36809 {
36810 float num18 = 130 + amountOfLines * 30;
36811 float num19 = 180 + (screenWidth - 800) / 2;
36812 num19 += ChatManager.GetStringSize(FontAssets.MouseText.Value, text3, new Vector2(0.9f)).X - 20f;
36813 int taxMoney2 = player[myPlayer].taxMoney;
36814 taxMoney2 = (int)((double)taxMoney2 / player[myPlayer].currentShoppingSettings.PriceAdjustment);
36815 ItemSlot.DrawMoney(spriteBatch, "", num19, num18 - 40f, Utils.CoinsSplit(taxMoney2), horizontal: true);
36816 }
36817 }
36819 {
36820 return;
36821 }
36823 {
36824 player[myPlayer].mouseInterface = true;
36825 }
36827 {
36828 return;
36829 }
36830 mouseLeftRelease = false;
36831 player[myPlayer].releaseUseItem = false;
36832 player[myPlayer].mouseInterface = true;
36833 if (npcChatFocus1)
36834 {
36836 }
36837 else if (npcChatFocus2)
36838 {
36839 if (player[myPlayer].sign != -1)
36840 {
36841 if (editSign)
36842 {
36844 }
36845 else
36846 {
36848 }
36849 }
36850 else if (NPCID.Sets.IsTownPet[npc[player[myPlayer].talkNPC].type])
36851 {
36852 player[myPlayer].PetAnimal(player[myPlayer].talkNPC);
36853 }
36854 else if (npc[player[myPlayer].talkNPC].type == 369)
36855 {
36858 bool flag4 = false;
36860 {
36862 if (num20 != -1)
36863 {
36864 player[myPlayer].inventory[num20].stack--;
36865 if (player[myPlayer].inventory[num20].stack <= 0)
36866 {
36867 player[myPlayer].inventory[num20] = new Item();
36868 }
36869 flag4 = true;
36871 player[myPlayer].anglerQuestsFinished++;
36872 player[myPlayer].GetAnglerReward(npc[player[myPlayer].talkNPC], anglerQuestItemNetIDs[anglerQuest]);
36873 }
36874 }
36876 if (flag4)
36877 {
36878 anglerQuestFinished = true;
36879 if (netMode == 1)
36880 {
36881 NetMessage.SendData(75);
36882 }
36883 else
36884 {
36886 }
36888 }
36889 }
36890 else if (npc[player[myPlayer].talkNPC].type == 17)
36891 {
36892 OpenShop(1);
36893 }
36894 else if (npc[player[myPlayer].talkNPC].type == 19)
36895 {
36896 OpenShop(2);
36897 }
36898 else if (npc[player[myPlayer].talkNPC].type == 124)
36899 {
36900 OpenShop(8);
36901 }
36902 else if (npc[player[myPlayer].talkNPC].type == 142)
36903 {
36904 OpenShop(9);
36905 }
36906 else if (npc[player[myPlayer].talkNPC].type == 37)
36907 {
36908 if (netMode == 0)
36909 {
36911 }
36912 else
36913 {
36914 NetMessage.SendData(51, -1, -1, null, myPlayer, 1f);
36915 }
36916 npcChatText = "";
36917 }
36918 else if (npc[player[myPlayer].talkNPC].type == 20)
36919 {
36920 OpenShop(3);
36921 }
36922 else if (npc[player[myPlayer].talkNPC].type == 38)
36923 {
36924 OpenShop(4);
36925 }
36926 else if (npc[player[myPlayer].talkNPC].type == 54)
36927 {
36928 OpenShop(5);
36929 }
36930 else if (npc[player[myPlayer].talkNPC].type == 107)
36931 {
36932 OpenShop(6);
36933 }
36934 else if (npc[player[myPlayer].talkNPC].type == 108)
36935 {
36936 OpenShop(7);
36937 }
36938 else if (npc[player[myPlayer].talkNPC].type == 160)
36939 {
36940 OpenShop(10);
36941 }
36942 else if (npc[player[myPlayer].talkNPC].type == 178)
36943 {
36944 OpenShop(11);
36945 }
36946 else if (npc[player[myPlayer].talkNPC].type == 207)
36947 {
36948 OpenShop(12);
36949 }
36950 else if (npc[player[myPlayer].talkNPC].type == 208)
36951 {
36952 OpenShop(13);
36953 }
36954 else if (npc[player[myPlayer].talkNPC].type == 209)
36955 {
36956 OpenShop(14);
36957 }
36958 else if (npc[player[myPlayer].talkNPC].type == 227)
36959 {
36960 OpenShop(15);
36961 }
36962 else if (npc[player[myPlayer].talkNPC].type == 228)
36963 {
36964 OpenShop(16);
36965 }
36966 else if (npc[player[myPlayer].talkNPC].type == 229)
36967 {
36968 OpenShop(17);
36969 }
36970 else if (npc[player[myPlayer].talkNPC].type == 353)
36971 {
36972 OpenShop(18);
36973 }
36974 else if (npc[player[myPlayer].talkNPC].type == 368)
36975 {
36976 OpenShop(19);
36977 }
36978 else if (npc[player[myPlayer].talkNPC].type == 453)
36979 {
36980 OpenShop(20);
36981 }
36982 else if (npc[player[myPlayer].talkNPC].type == 550)
36983 {
36984 OpenShop(21);
36985 }
36986 else if (npc[player[myPlayer].talkNPC].type == 588)
36987 {
36988 OpenShop(22);
36989 }
36990 else if (npc[player[myPlayer].talkNPC].type == 633)
36991 {
36992 OpenShop(23);
36993 }
36994 else if (npc[player[myPlayer].talkNPC].type == 663)
36995 {
36996 OpenShop(24);
36997 }
36998 else if (npc[player[myPlayer].talkNPC].type == 22)
36999 {
37001 HelpText();
37002 }
37003 else if (npc[player[myPlayer].talkNPC].type == 441)
37004 {
37005 if (player[myPlayer].taxMoney > 0)
37006 {
37007 int taxMoney3 = player[myPlayer].taxMoney;
37008 taxMoney3 = (int)((double)taxMoney3 / player[myPlayer].currentShoppingSettings.PriceAdjustment);
37009 while (taxMoney3 > 0)
37010 {
37012 if (taxMoney3 > 1000000)
37013 {
37014 int num21 = taxMoney3 / 1000000;
37015 taxMoney3 -= 1000000 * num21;
37016 int number = Item.NewItem(source, (int)player[myPlayer].position.X, (int)player[myPlayer].position.Y, player[myPlayer].width, player[myPlayer].height, 74, num21);
37017 if (netMode == 1)
37018 {
37019 NetMessage.SendData(21, -1, -1, null, number, 1f);
37020 }
37021 continue;
37022 }
37023 if (taxMoney3 > 10000)
37024 {
37025 int num22 = taxMoney3 / 10000;
37026 taxMoney3 -= 10000 * num22;
37027 int number2 = Item.NewItem(source, (int)player[myPlayer].position.X, (int)player[myPlayer].position.Y, player[myPlayer].width, player[myPlayer].height, 73, num22);
37028 if (netMode == 1)
37029 {
37030 NetMessage.SendData(21, -1, -1, null, number2, 1f);
37031 }
37032 continue;
37033 }
37034 if (taxMoney3 > 100)
37035 {
37036 int num23 = taxMoney3 / 100;
37037 taxMoney3 -= 100 * num23;
37038 int number3 = Item.NewItem(source, (int)player[myPlayer].position.X, (int)player[myPlayer].position.Y, player[myPlayer].width, player[myPlayer].height, 72, num23);
37039 if (netMode == 1)
37040 {
37041 NetMessage.SendData(21, -1, -1, null, number3, 1f);
37042 }
37043 continue;
37044 }
37045 int num24 = taxMoney3;
37046 if (num24 < 1)
37047 {
37048 num24 = 1;
37049 }
37050 taxMoney3 -= num24;
37051 int number4 = Item.NewItem(source, (int)player[myPlayer].position.X, (int)player[myPlayer].position.Y, player[myPlayer].width, player[myPlayer].height, 71, num24);
37052 if (netMode == 1)
37053 {
37054 NetMessage.SendData(21, -1, -1, null, number4, 1f);
37055 }
37056 }
37057 npcChatText = Lang.dialog(rand.Next(380, 382));
37058 player[myPlayer].taxMoney = 0;
37059 }
37060 else
37061 {
37062 npcChatText = Lang.dialog(rand.Next(390, 401));
37063 }
37064 }
37065 else
37066 {
37067 if (npc[player[myPlayer].talkNPC].type != 18)
37068 {
37069 return;
37070 }
37072 if (num5 > 0)
37073 {
37074 if (player[myPlayer].BuyItem(num5))
37075 {
37078 player[myPlayer].HealEffect(player[myPlayer].statLifeMax2 - player[myPlayer].statLife);
37079 if ((double)player[myPlayer].statLife < (double)player[myPlayer].statLifeMax2 * 0.25)
37080 {
37081 npcChatText = Lang.dialog(227);
37082 }
37083 else if ((double)player[myPlayer].statLife < (double)player[myPlayer].statLifeMax2 * 0.5)
37084 {
37085 npcChatText = Lang.dialog(228);
37086 }
37087 else if ((double)player[myPlayer].statLife < (double)player[myPlayer].statLifeMax2 * 0.75)
37088 {
37089 npcChatText = Lang.dialog(229);
37090 }
37091 else
37092 {
37093 npcChatText = Lang.dialog(230);
37094 }
37095 player[myPlayer].statLife = player[myPlayer].statLifeMax2;
37096 for (int l = 0; l < Player.maxBuffs; l++)
37097 {
37098 int num25 = player[myPlayer].buffType[l];
37100 {
37101 player[myPlayer].DelBuff(l);
37102 l = -1;
37103 }
37104 }
37105 }
37106 else
37107 {
37108 int num26 = rand.Next(3);
37109 if (num26 == 0)
37110 {
37111 npcChatText = Lang.dialog(52);
37112 }
37113 if (num26 == 1)
37114 {
37115 npcChatText = Lang.dialog(53);
37116 }
37117 if (num26 == 2)
37118 {
37119 npcChatText = Lang.dialog(54);
37120 }
37121 }
37122 }
37123 else
37124 {
37125 int num27 = rand.Next(3);
37126 if (!ChildSafety.Disabled)
37127 {
37128 num27 = rand.Next(1, 3);
37129 }
37130 switch (num27)
37131 {
37132 case 0:
37133 npcChatText = Lang.dialog(55);
37134 break;
37135 case 1:
37136 npcChatText = Lang.dialog(56);
37137 break;
37138 case 2:
37139 npcChatText = Lang.dialog(57);
37140 break;
37141 }
37142 }
37143 }
37144 }
37145 else if (npcChatFocus4)
37146 {
37149 npcChatText = player[myPlayer].currentShoppingSettings.HappinessReport;
37150 }
37151 else
37152 {
37153 if (!npcChatFocus3 || player[myPlayer].talkNPC < 0)
37154 {
37155 return;
37156 }
37157 if (npc[player[myPlayer].talkNPC].type == 20)
37158 {
37162 {
37163 NPC.PreventJojaColaDialog = true;
37164 NPC.RerollDryadText = 2;
37165 LocalPlayer.ConsumeItem(5275, reverseOrder: true);
37166 if (netMode == 1)
37167 {
37168 NetMessage.SendData(144);
37169 }
37170 else
37171 {
37173 }
37174 npcChatText = Language.GetTextValue("StardewTalk.PlayerGivesCola");
37175 }
37176 else if (worldIsEntirelyPure)
37177 {
37179 }
37180 }
37181 if (npc[player[myPlayer].talkNPC].type == 208)
37182 {
37184 int num28 = rand.Next(1, 4);
37185 npcChatText = Language.GetTextValue("PartyGirlSpecialText.Music" + num28);
37187 }
37188 else if (npc[player[myPlayer].talkNPC].type == 22)
37189 {
37190 playerInventory = true;
37191 npcChatText = "";
37193 InGuideCraftMenu = true;
37195 }
37196 else if (npc[player[myPlayer].talkNPC].type == 107)
37197 {
37198 playerInventory = true;
37199 npcChatText = "";
37201 InReforgeMenu = true;
37203 }
37204 else if (npc[player[myPlayer].talkNPC].type == 353)
37205 {
37207 }
37208 else if (npc[player[myPlayer].talkNPC].type == 207)
37209 {
37212 bool gotDye = false;
37214 if (num29 != -1)
37215 {
37216 player[myPlayer].inventory[num29].stack--;
37217 if (player[myPlayer].inventory[num29].stack <= 0)
37218 {
37219 player[myPlayer].inventory[num29] = new Item();
37220 }
37221 gotDye = true;
37223 player[myPlayer].GetDyeTraderReward(npc[player[myPlayer].talkNPC]);
37224 }
37226 }
37227 else if (npc[player[myPlayer].talkNPC].type == 550)
37228 {
37230 HelpText();
37232 }
37233 else if (npc[player[myPlayer].talkNPC].type == 227)
37234 {
37235 OpenShop(25);
37236 }
37237 }
37238 }
37239
37241 {
37242 Item heldItem = player.HeldItem;
37243 if (!heldItem.IsAir && heldItem.type == 5275)
37244 {
37245 return npc.ai[0] != 24f;
37246 }
37247 return false;
37248 }
37249
37250 private void OpenShop(int shopIndex)
37251 {
37252 playerInventory = true;
37253 stackSplit = 9999;
37254 npcChatText = "";
37258 }
37259
37260 public static void SetNPCShopIndex(int index)
37261 {
37262 npcShop = index;
37263 }
37264
37266 {
37267 float y = 130 + numLines * 30;
37268 int num = 180 + (screenWidth - 800) / 2;
37271 Vector2 vector = new Vector2(num, y);
37272 string text = focusText;
37275 Vector2 vector3 = new Vector2(0.9f);
37279 Vector2 vector4 = new Vector2(1f);
37281 float num2 = 1.2f;
37282 if (stringSize.X > 260f)
37283 {
37284 vector4.X *= 260f / stringSize.X;
37285 }
37287 {
37288 player.mouseInterface = true;
37289 player.releaseUseItem = false;
37290 vector3 *= num2;
37291 if (!npcChatFocus2)
37292 {
37294 }
37295 npcChatFocus2 = true;
37296 }
37297 else
37298 {
37299 if (npcChatFocus2)
37300 {
37302 }
37303 npcChatFocus2 = false;
37304 }
37307 if (text.Length > 0)
37308 {
37310 UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsLeft = true;
37311 }
37312 Vector2 vector5 = new Vector2((float)num + stringSize.X * vector4.X + 30f, y);
37313 text = Lang.inter[52].Value;
37314 value = FontAssets.MouseText.Value;
37315 vector2 = vector5;
37316 vector3 = new Vector2(0.9f);
37318 baseColor = new Microsoft.Xna.Framework.Color(superColor, (int)((double)superColor / 1.1), superColor / 2, superColor);
37319 vector4 = new Vector2(1f);
37321 {
37322 player.mouseInterface = true;
37323 player.releaseUseItem = false;
37324 vector3 *= num2;
37325 if (!npcChatFocus1)
37326 {
37328 }
37329 npcChatFocus1 = true;
37330 }
37331 else
37332 {
37333 if (npcChatFocus1)
37334 {
37336 }
37337 npcChatFocus1 = false;
37338 }
37341 if (text.Length > 0)
37342 {
37344 UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsMiddle = true;
37345 }
37346 if (string.IsNullOrWhiteSpace(focusText3))
37347 {
37348 npcChatFocus3 = false;
37349 UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight = false;
37350 }
37351 else
37352 {
37353 Vector2 vector6 = new Vector2(vector5.X + stringSize.X * vector4.X + 30f, y);
37354 text = focusText3;
37355 value = FontAssets.MouseText.Value;
37356 vector2 = vector6;
37357 vector3 = new Vector2(0.9f);
37360 vector4 = new Vector2(1f);
37361 vector5.X = vector6.X;
37363 {
37364 player.mouseInterface = true;
37365 player.releaseUseItem = false;
37366 vector3 *= num2;
37367 if (!npcChatFocus3)
37368 {
37370 }
37371 npcChatFocus3 = true;
37372 }
37373 else
37374 {
37375 if (npcChatFocus3)
37376 {
37378 }
37379 npcChatFocus3 = false;
37380 }
37384 UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight = true;
37385 }
37386 if (remixWorld)
37387 {
37388 return;
37389 }
37390 if (Main.player[myPlayer].currentShoppingSettings.HappinessReport == "")
37391 {
37392 npcChatFocus4 = false;
37393 UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight2 = false;
37394 return;
37395 }
37396 string textValue = Language.GetTextValue("UI.NPCCheckHappiness");
37397 Vector2 vector7 = new Vector2(vector5.X + stringSize.X * vector4.X + 30f, y);
37398 text = textValue;
37399 value = FontAssets.MouseText.Value;
37400 vector2 = vector7;
37401 vector3 = new Vector2(0.9f);
37403 baseColor = new Microsoft.Xna.Framework.Color(superColor, (int)((double)superColor / 1.1), superColor / 2, superColor);
37404 vector4 = new Vector2(1f);
37406 {
37407 player.mouseInterface = true;
37408 player.releaseUseItem = false;
37409 vector3 *= num2;
37410 if (!npcChatFocus4)
37411 {
37413 }
37414 npcChatFocus4 = true;
37415 }
37416 else
37417 {
37418 if (npcChatFocus4)
37419 {
37421 }
37422 npcChatFocus4 = false;
37423 }
37427 UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight2 = true;
37428 }
37429
37430 public static void CloseNPCChatOrSign()
37431 {
37432 player[myPlayer].sign = -1;
37433 editSign = false;
37434 player[myPlayer].SetTalkNPC(-1);
37436 npcChatText = "";
37438 player[myPlayer].releaseMount = false;
37439 }
37440
37441 public static void SubmitSignText()
37442 {
37444 int num = player[myPlayer].sign;
37446 editSign = false;
37447 if (netMode == 1)
37448 {
37449 NetMessage.SendData(47, -1, -1, null, num);
37450 }
37451 }
37452
37454 {
37455 return -npc[npcIndex1].housingCategory.CompareTo(npc[npcIndex2].housingCategory);
37456 }
37457
37458 protected void DrawNPCHousesInWorld()
37459 {
37462 for (int i = 0; i < 200; i++)
37463 {
37464 if (npc[i].active && npc[i].townNPC && !npc[i].homeless && npc[i].homeTileX > 0 && npc[i].homeTileY > 0 && npc[i].type != 37)
37465 {
37467 }
37468 }
37470 for (int j = 0; j < _npcsWithBannersToDraw.Count; j++)
37471 {
37472 int num = _npcsWithBannersToDraw[j];
37473 NPC nPC = npc[num];
37474 if (!nPC.active || !nPC.townNPC || nPC.homeless || nPC.homeTileX <= 0 || nPC.homeTileY <= 0 || nPC.type == 37)
37475 {
37476 continue;
37477 }
37478 int num2 = 0;
37479 int housingCategory = nPC.housingCategory;
37480 int homeTileX = nPC.homeTileX;
37481 int num3 = nPC.homeTileY - 1;
37482 WorldGen.TownManager.AddOccupantsToList(homeTileX, num3 + 1, _occupantsListToDrawNPCHouses);
37484 {
37485 num2 = 1;
37486 }
37487 int num4 = 0;
37488 for (int num5 = _npcsWithBannersToDraw.Count - 1; num5 > j; num5--)
37489 {
37491 if (npc[num6].homeTileX == homeTileX && npc[num6].homeTileY == num3 + 1)
37492 {
37493 num4++;
37494 }
37495 }
37496 int num7 = num4 * 26;
37497 if (tile[homeTileX, num3] == null)
37498 {
37499 continue;
37500 }
37501 bool flag = false;
37502 while (!tile[homeTileX, num3].active() || !tileSolid[tile[homeTileX, num3].type])
37503 {
37504 num3--;
37505 if (num3 < 10)
37506 {
37507 break;
37508 }
37509 if (tile[homeTileX, num3] == null)
37510 {
37511 flag = true;
37512 break;
37513 }
37514 }
37515 if (flag)
37516 {
37517 continue;
37518 }
37519 int num8 = 8;
37520 int num9 = 18;
37521 if (tile[homeTileX, num3].type == 19)
37522 {
37523 num9 -= 8;
37524 }
37525 num3++;
37526 int num10 = 0;
37527 float num11 = num3 * 16;
37528 num11 += (float)num7;
37529 SpriteEffects effects = SpriteEffects.None;
37532 if (num2 > 0)
37533 {
37534 value2.X += value2.Width * num2;
37535 }
37536 if (housingCategory > 0)
37537 {
37538 value2.Y += value2.Height * housingCategory;
37539 }
37540 if (player[myPlayer].gravDir == -1f)
37541 {
37542 num11 -= screenPosition.Y;
37543 num11 = screenPosition.Y + (float)screenHeight - num11;
37544 num11 -= (float)value2.Height;
37545 effects = SpriteEffects.FlipVertically;
37546 num10 = 4;
37547 }
37548 spriteBatch.Draw(value, new Vector2(homeTileX * 16 - (int)screenPosition.X + num8, num11 - (float)(int)screenPosition.Y + (float)num9 + (float)num10), value2, Lighting.GetColor(homeTileX, num3), 0f, new Vector2(value2.Width / 2, value2.Height / 2), 1f, effects, 0f);
37550 float scale = 1f;
37551 float num12 = 0f;
37553 if (num12 > 24f)
37554 {
37555 scale = 24f / num12;
37556 }
37557 spriteBatch.Draw(TextureAssets.NpcHead[headIndexSafe].Value, new Vector2(homeTileX * 16 - (int)screenPosition.X + num8, num11 - (float)(int)screenPosition.Y + (float)num9 + 2f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.NpcHead[headIndexSafe].Width(), TextureAssets.NpcHead[headIndexSafe].Height()), Lighting.GetColor(homeTileX, num3), 0f, new Vector2(TextureAssets.NpcHead[headIndexSafe].Width() / 2, TextureAssets.NpcHead[headIndexSafe].Height() / 2), scale, effects, 0f);
37558 homeTileX = homeTileX * 16 - (int)screenPosition.X + num8 - value2.Width / 2;
37559 num3 = (int)num11 - (int)screenPosition.Y + 4;
37560 int num13 = -8;
37562 {
37566 {
37567 mouseRightRelease = false;
37568 WorldGen.kickOut(num);
37570 }
37571 }
37572 }
37573 }
37574
37575 public void DrawWindowsIMEPanel(Vector2 position, float xAnchor = 0f)
37576 {
37578 {
37579 return;
37580 }
37582 for (uint num = 0u; num < Platform.Get<IImeService>().CandidateCount; num++)
37583 {
37584 string candidate = Platform.Get<IImeService>().GetCandidate(num);
37585 list.Add(candidate);
37586 }
37587 if (list.Count == 0)
37588 {
37589 return;
37590 }
37591 uint selectedCandidate = Platform.Get<IImeService>().SelectedCandidate;
37593 float num2 = 0.85f;
37594 float num3 = 14f;
37595 float num4 = 0f;
37596 int num5 = 32;
37597 num4 += num3;
37598 string text = "{0,2}: {1}";
37599 string text2 = " ";
37600 for (int i = 0; i < list.Count; i++)
37601 {
37602 int num6 = i + 1;
37603 string text3 = text;
37604 if (i < list.Count - 1)
37605 {
37606 text3 += text2;
37607 }
37608 num4 += value.MeasureString(string.Format(text3, num6, list[i])).X * num2;
37609 num4 += num3;
37610 }
37611 Vector2 vector = new Vector2(num4 * (0f - xAnchor), 0f);
37612 Utils.DrawSettings2Panel(spriteBatch, position + vector + new Vector2(0f, -num5), num4, new Microsoft.Xna.Framework.Color(63, 65, 151, 255) * 0.785f);
37613 Vector2 pos = position + new Vector2(10f, -num5 / 2) + vector;
37614 for (uint num7 = 0u; num7 < list.Count; num7++)
37615 {
37617 if (num7 == selectedCandidate)
37618 {
37620 }
37621 uint num8 = num7 + 1;
37622 string text4 = text;
37623 if (num7 < list.Count - 1)
37624 {
37625 text4 += text2;
37626 }
37627 string text5 = string.Format(text4, num8, list[(int)num7]);
37628 Vector2 vector2 = value.MeasureString(text5) * num2;
37629 Utils.DrawBorderString(spriteBatch, text5, pos, color, num2, 0f, 0.4f);
37630 pos.X += vector2.X + num3;
37631 }
37632 }
37633
37634 public void HandleIME()
37635 {
37637 {
37639 if (_imeToggle)
37640 {
37641 Platform.Get<IImeService>().Enable();
37642 }
37643 else
37644 {
37645 Platform.Get<IImeService>().Disable();
37646 }
37647 }
37648 }
37649
37650 protected void DrawPlayerChat()
37651 {
37652 TextSnippet[] array = null;
37654 {
37655 PlayerInput.WritingText = true;
37656 }
37657 HandleIME();
37659 {
37661 if (textBlinkerCount >= 20)
37662 {
37663 if (textBlinkerState == 0)
37664 {
37665 textBlinkerState = 1;
37666 }
37667 else
37668 {
37669 textBlinkerState = 0;
37670 }
37671 textBlinkerCount = 0;
37672 }
37673 string text = chatText;
37674 if (screenWidth > 800)
37675 {
37676 int num = screenWidth - 300;
37677 int num2 = 78;
37678 spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(num2, screenHeight - 36), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.TextBack.Width() - 100, TextureAssets.TextBack.Height()), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
37679 num -= 400;
37680 num2 += 400;
37681 while (num > 0)
37682 {
37683 if (num > 300)
37684 {
37685 spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(num2, screenHeight - 36), new Microsoft.Xna.Framework.Rectangle(100, 0, TextureAssets.TextBack.Width() - 200, TextureAssets.TextBack.Height()), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
37686 num -= 300;
37687 num2 += 300;
37688 }
37689 else
37690 {
37691 spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(num2, screenHeight - 36), new Microsoft.Xna.Framework.Rectangle(TextureAssets.TextBack.Width() - num, 0, TextureAssets.TextBack.Width() - (TextureAssets.TextBack.Width() - num), TextureAssets.TextBack.Height()), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
37692 num = 0;
37693 }
37694 }
37695 }
37696 else
37697 {
37698 spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(78f, screenHeight - 36), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.TextBack.Width(), TextureAssets.TextBack.Height()), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
37699 }
37700 int hoveredSnippet = -1;
37702 string compositionString = Platform.Get<IImeService>().CompositionString;
37703 if (compositionString != null && compositionString.Length > 0)
37704 {
37705 list.Add(new TextSnippet(compositionString, new Microsoft.Xna.Framework.Color(255, 240, 20)));
37706 }
37707 if (textBlinkerState == 1)
37708 {
37710 }
37711 array = list.ToArray();
37713 if (hoveredSnippet > -1)
37714 {
37715 array[hoveredSnippet].OnHover();
37717 {
37718 array[hoveredSnippet].OnClick();
37719 }
37720 }
37721 }
37723 if (drawingPlayerChat && array != null)
37724 {
37726 DrawWindowsIMEPanel(new Vector2(88f, screenHeight - 30) + new Vector2(stringSize.X + 10f, -6f));
37727 }
37729 }
37730
37731 protected void DrawInventory()
37732 {
37734 if (ShouldPVPDraw)
37735 {
37736 DrawPVPIcons();
37737 }
37738 int num = 0;
37739 int num2 = 0;
37740 int num3 = screenWidth;
37741 int num4 = 0;
37742 int num5 = screenWidth;
37743 int num6 = 0;
37744 Vector2 vector = new Vector2(num, num2);
37745 new Vector2(num3, num4);
37746 new Vector2(num5, num6);
37747 DrawBestiaryIcon(num, num2);
37749 DrawTrashItemSlot(num, num2);
37751 inventoryScale = 0.85f;
37752 if (mouseX > 20 && mouseX < (int)(20f + 560f * inventoryScale) && mouseY > 20 && mouseY < (int)(20f + 280f * inventoryScale) && !PlayerInput.IgnoreMouseInterface)
37753 {
37754 player[myPlayer].mouseInterface = true;
37755 }
37756 for (int i = 0; i < 10; i++)
37757 {
37758 for (int j = 0; j < 5; j++)
37759 {
37760 int num7 = (int)(20f + (float)(i * 56) * inventoryScale) + num;
37761 int num8 = (int)(20f + (float)(j * 56) * inventoryScale) + num2;
37762 int num9 = i + j * 10;
37763 new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
37764 if (mouseX >= num7 && (float)mouseX <= (float)num7 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num8 && (float)mouseY <= (float)num8 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
37765 {
37766 player[myPlayer].mouseInterface = true;
37767 ItemSlot.OverrideHover(player[myPlayer].inventory, 0, num9);
37768 if (player[myPlayer].inventoryChestStack[num9] && (player[myPlayer].inventory[num9].type == 0 || player[myPlayer].inventory[num9].stack == 0))
37769 {
37770 player[myPlayer].inventoryChestStack[num9] = false;
37771 }
37772 if (!player[myPlayer].inventoryChestStack[num9])
37773 {
37774 ItemSlot.LeftClick(player[myPlayer].inventory, 0, num9);
37775 ItemSlot.RightClick(player[myPlayer].inventory, 0, num9);
37777 {
37779 }
37780 }
37781 ItemSlot.MouseHover(player[myPlayer].inventory, 0, num9);
37782 }
37783 ItemSlot.Draw(spriteBatch, player[myPlayer].inventory, 0, num9, new Vector2(num7, num8));
37784 }
37785 }
37787 bool pushSideToolsUp = totalDrawnIcons >= 10;
37789 {
37791 }
37792 ItemSlot.DrawRadialDpad(spriteBatch, new Vector2(20f) + new Vector2(56f * inventoryScale * 10f, 56f * inventoryScale * 5f) + new Vector2(26f, 70f) + vector);
37794 {
37795 int num10 = (int)(20f + 560f * inventoryScale) + num;
37796 int num11 = (int)(20f + 0f * inventoryScale) + num2;
37798 }
37799 if (mapEnabled)
37800 {
37801 bool flag = false;
37802 int num12 = num3 - 440;
37803 int num13 = 40 + num4;
37804 if (screenWidth < 940)
37805 {
37806 flag = true;
37807 }
37808 if (flag)
37809 {
37810 num12 = num5 - 40;
37811 num13 = num6 - 200;
37812 }
37813 int num14 = 0;
37814 for (int k = 0; k < 4; k++)
37815 {
37816 int num15 = 255;
37817 int num16 = num12 + k * 32 - num14;
37818 int num17 = num13;
37819 if (flag)
37820 {
37821 num16 = num12;
37822 num17 = num13 + k * 32 - num14;
37823 }
37824 int num18 = k;
37825 num15 = 120;
37826 if (k > 0 && mapStyle == k - 1)
37827 {
37828 num15 = 200;
37829 }
37831 {
37832 num15 = 255;
37833 num18 += 4;
37834 player[myPlayer].mouseInterface = true;
37836 {
37837 if (k == 0)
37838 {
37839 playerInventory = false;
37840 player[myPlayer].SetTalkNPC(-1);
37843 mapFullscreenScale = 2.5f;
37844 mapFullscreen = true;
37845 resetMapFull = true;
37846 }
37847 if (k == 1)
37848 {
37849 mapStyle = 0;
37851 }
37852 if (k == 2)
37853 {
37854 mapStyle = 1;
37856 }
37857 if (k == 3)
37858 {
37859 mapStyle = 2;
37861 }
37862 }
37863 }
37865 }
37866 }
37867 if (armorHide)
37868 {
37869 armorAlpha -= 0.1f;
37870 if (armorAlpha < 0f)
37871 {
37872 armorAlpha = 0f;
37873 }
37874 }
37875 else
37876 {
37877 armorAlpha += 0.025f;
37878 if (armorAlpha > 1f)
37879 {
37880 armorAlpha = 1f;
37881 }
37882 }
37883 new Microsoft.Xna.Framework.Color((byte)((float)(int)mouseTextColor * armorAlpha), (byte)((float)(int)mouseTextColor * armorAlpha), (byte)((float)(int)mouseTextColor * armorAlpha), (byte)((float)(int)mouseTextColor * armorAlpha));
37884 armorHide = false;
37885 int num19 = 8 + player[myPlayer].GetAmountOfExtraAccessorySlotsToShow();
37886 int num20 = 174 + mH;
37887 int num21 = 950;
37890 {
37891 num20 -= (int)(56f * inventoryScale * (float)(num19 - 9));
37893 }
37894 int num22 = DrawPageIcons(num20 - 32);
37895 if (num22 > -1)
37896 {
37897 HoverItem = new Item();
37898 switch (num22)
37899 {
37900 case 1:
37901 hoverItemName = Lang.inter[80].Value;
37902 break;
37903 case 2:
37904 hoverItemName = Lang.inter[79].Value;
37905 break;
37906 case 3:
37907 hoverItemName = (CaptureModeDisabled ? Lang.inter[115].Value : Lang.inter[81].Value);
37908 break;
37909 }
37910 }
37911 if (EquipPage == 2)
37912 {
37915 Item[] inv = player[myPlayer].miscEquips;
37916 int num23 = screenWidth - 92;
37917 int num24 = mH + 174;
37918 for (int l = 0; l < 2; l++)
37919 {
37920 switch (l)
37921 {
37922 case 0:
37923 inv = player[myPlayer].miscEquips;
37924 break;
37925 case 1:
37926 inv = player[myPlayer].miscDyes;
37927 break;
37928 }
37929 r.X = num23 + l * -47;
37930 for (int m = 0; m < 5; m++)
37931 {
37932 int context = 0;
37933 int num25 = -1;
37934 bool flag2 = false;
37935 switch (m)
37936 {
37937 case 0:
37938 context = 19;
37939 num25 = 0;
37940 break;
37941 case 1:
37942 context = 20;
37943 num25 = 1;
37944 break;
37945 case 2:
37946 context = 18;
37947 flag2 = player[myPlayer].unlockedSuperCart;
37948 break;
37949 case 3:
37950 context = 17;
37951 break;
37952 case 4:
37953 context = 16;
37954 break;
37955 }
37956 if (l == 1)
37957 {
37958 context = 33;
37959 num25 = -1;
37960 flag2 = false;
37961 }
37962 r.Y = num24 + m * 47;
37963 bool flag3 = false;
37965 Microsoft.Xna.Framework.Rectangle r2 = new Microsoft.Xna.Framework.Rectangle(r.Left + 34, r.Top - 2, value2.Width, value2.Height);
37966 int num26 = 0;
37967 if (num25 != -1)
37968 {
37969 if (player[myPlayer].hideMisc[num25])
37970 {
37972 }
37974 {
37975 player[myPlayer].mouseInterface = true;
37976 flag3 = true;
37978 {
37979 if (num25 == 0)
37980 {
37981 player[myPlayer].TogglePet();
37982 }
37983 if (num25 == 1)
37984 {
37985 player[myPlayer].ToggleLight();
37986 }
37987 mouseLeftRelease = false;
37989 if (netMode == 1)
37990 {
37991 NetMessage.SendData(4, -1, -1, null, myPlayer);
37992 }
37993 }
37994 num26 = ((!player[myPlayer].hideMisc[num25]) ? 1 : 2);
37995 }
37996 }
37997 if (flag2)
37998 {
37999 value2 = TextureAssets.Extra[255].Value;
38000 if (!player[myPlayer].enabledSuperCart)
38001 {
38002 value2 = TextureAssets.Extra[256].Value;
38003 }
38004 r2 = new Microsoft.Xna.Framework.Rectangle(r2.X + r2.Width / 2, r2.Y + r2.Height / 2, r2.Width, r2.Height);
38005 r2.Offset(-r2.Width / 2, -r2.Height / 2);
38007 {
38008 player[myPlayer].mouseInterface = true;
38009 flag3 = true;
38011 {
38012 player[myPlayer].enabledSuperCart = !player[myPlayer].enabledSuperCart;
38013 mouseLeftRelease = false;
38015 if (netMode == 1)
38016 {
38017 NetMessage.SendData(4, -1, -1, null, myPlayer);
38018 }
38019 }
38020 num26 = ((!player[myPlayer].enabledSuperCart) ? 1 : 2);
38021 }
38022 }
38024 {
38025 player[myPlayer].mouseInterface = true;
38026 armorHide = true;
38027 ItemSlot.Handle(inv, context, m);
38028 }
38029 ItemSlot.Draw(spriteBatch, inv, context, m, r.TopLeft());
38030 if (num25 != -1)
38031 {
38032 spriteBatch.Draw(value2, r2.TopLeft(), Microsoft.Xna.Framework.Color.White * 0.7f);
38033 if (num26 > 0)
38034 {
38035 HoverItem = new Item();
38036 hoverItemName = Lang.inter[58 + num26].Value;
38037 }
38038 }
38039 if (flag2)
38040 {
38042 if (num26 > 0)
38043 {
38044 HoverItem = new Item();
38045 hoverItemName = Language.GetTextValue((num26 == 1) ? "GameUI.SuperCartDisabled" : "GameUI.SuperCartEnabled");
38046 }
38047 }
38048 }
38049 }
38050 num24 += 247;
38051 num23 += 8;
38052 int num27 = -1;
38053 int num28 = 0;
38054 int num29 = 3;
38055 int num30 = 260;
38056 if (screenHeight > 630 + num30 * (mapStyle == 1).ToInt())
38057 {
38058 num29++;
38059 }
38060 if (screenHeight > 680 + num30 * (mapStyle == 1).ToInt())
38061 {
38062 num29++;
38063 }
38064 if (screenHeight > 730 + num30 * (mapStyle == 1).ToInt())
38065 {
38066 num29++;
38067 }
38068 int num31 = 46;
38069 for (int n = 0; n < Player.maxBuffs; n++)
38070 {
38071 if (player[myPlayer].buffType[n] != 0)
38072 {
38073 int num32 = num28 / num29;
38074 int num33 = num28 % num29;
38076 num27 = DrawBuffIcon(num27, n, point.X, point.Y);
38077 UILinkPointNavigator.SetPosition(9000 + num28, new Vector2(point.X + 30, point.Y + 30));
38078 num28++;
38079 if (buffAlpha[n] < 0.65f)
38080 {
38081 buffAlpha[n] = 0.65f;
38082 }
38083 }
38084 }
38085 UILinkPointNavigator.Shortcuts.BUFFS_DRAWN = num28;
38086 UILinkPointNavigator.Shortcuts.BUFFS_PER_COLUMN = num29;
38087 if (num27 >= 0)
38088 {
38089 int num34 = player[myPlayer].buffType[num27];
38090 if (num34 > 0)
38091 {
38092 string buffName = Lang.GetBuffName(num34);
38093 string buffTooltip = GetBuffTooltip(player[myPlayer], num34);
38094 if (num34 == 147)
38095 {
38096 bannerMouseOver = true;
38097 }
38098 if (meleeBuff[num34])
38099 {
38100 MouseTextHackZoom(buffName, -10, 0, buffTooltip);
38101 }
38102 else
38103 {
38104 MouseTextHackZoom(buffName, buffTooltip);
38105 }
38106 }
38107 }
38108 }
38109 else if (EquipPage == 1)
38110 {
38112 }
38113 else
38114 {
38115 int num35 = 4;
38116 if (mouseX > screenWidth - 64 - 28 && mouseX < (int)((float)(screenWidth - 64 - 28) + 56f * inventoryScale) && mouseY > num20 && mouseY < (int)((float)num20 + 448f * inventoryScale) && !PlayerInput.IgnoreMouseInterface)
38117 {
38118 player[myPlayer].mouseInterface = true;
38119 }
38120 float num36 = inventoryScale;
38121 bool flag4 = false;
38122 int num37 = num19 - 1;
38123 bool flag5 = LocalPlayer.CanDemonHeartAccessoryBeShown();
38124 bool flag6 = LocalPlayer.CanMasterModeAccessoryBeShown();
38126 {
38127 num37--;
38128 }
38129 int num38 = num37 - 1;
38133 int num39 = -1;
38134 for (int num40 = 0; num40 < 10; num40++)
38135 {
38136 if ((num40 == 8 && !flag5) || (num40 == 9 && !flag6))
38137 {
38138 continue;
38139 }
38140 num39++;
38141 bool flag7 = LocalPlayer.IsItemSlotUnlockedAndUsable(num40);
38142 if (!flag7)
38143 {
38144 flag4 = true;
38145 }
38146 int num41 = screenWidth - 64 - 28;
38147 int num42 = (int)((float)num20 + (float)(num39 * 56) * inventoryScale);
38148 new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
38149 int num43 = screenWidth - 58;
38150 int num44 = (int)((float)(num20 - 2) + (float)(num39 * 56) * inventoryScale);
38151 int context2 = 8;
38152 if (num40 > 2)
38153 {
38154 num42 += num35;
38155 num44 += num35;
38156 context2 = 10;
38157 }
38159 {
38160 _achievementAdvisor.DrawOneAchievement(spriteBatch, new Vector2(num41 - 10 - 47 - 47 - 14 - 14, num42 + 8), large: false);
38161 UILinkPointNavigator.SetPosition(1570, new Vector2(num41 - 10 - 47 - 47 - 14 - 14, num42 + 8) + new Vector2(20f) * inventoryScale);
38162 }
38163 if (num39 == num37)
38164 {
38166 }
38168 if (player[myPlayer].hideVisibleAccessory[num40])
38169 {
38171 }
38173 int num45 = 0;
38175 {
38176 player[myPlayer].mouseInterface = true;
38178 {
38179 player[myPlayer].hideVisibleAccessory[num40] = !player[myPlayer].hideVisibleAccessory[num40];
38181 if (netMode == 1)
38182 {
38183 NetMessage.SendData(4, -1, -1, null, myPlayer);
38184 }
38185 }
38186 num45 = ((!player[myPlayer].hideVisibleAccessory[num40]) ? 1 : 2);
38187 }
38188 else if (mouseX >= num41 && (float)mouseX <= (float)num41 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num42 && (float)mouseY <= (float)num42 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38189 {
38190 armorHide = true;
38191 player[myPlayer].mouseInterface = true;
38193 if (flag7 || mouseItem.IsAir)
38194 {
38196 }
38198 }
38199 if (flag4)
38200 {
38202 }
38204 if (num40 > 2)
38205 {
38206 spriteBatch.Draw(value3, new Vector2(num43, num44), Microsoft.Xna.Framework.Color.White * 0.7f);
38207 if (num45 > 0)
38208 {
38209 HoverItem = new Item();
38210 hoverItemName = Lang.inter[58 + num45].Value;
38211 }
38212 }
38213 }
38214 inventoryBack = color;
38215 if (mouseX > screenWidth - 64 - 28 - 47 && mouseX < (int)((float)(screenWidth - 64 - 20 - 47) + 56f * inventoryScale) && mouseY > num20 && mouseY < (int)((float)num20 + 168f * inventoryScale) && !PlayerInput.IgnoreMouseInterface)
38216 {
38217 player[myPlayer].mouseInterface = true;
38218 }
38219 num39 = -1;
38220 for (int num46 = 10; num46 < 20; num46++)
38221 {
38222 if ((num46 == 18 && !flag5) || (num46 == 19 && !flag6))
38223 {
38224 continue;
38225 }
38226 num39++;
38227 bool num47 = LocalPlayer.IsItemSlotUnlockedAndUsable(num46);
38228 flag4 = !num47;
38229 bool flag8 = !num47 && !mouseItem.IsAir;
38230 int num48 = screenWidth - 64 - 28 - 47;
38231 int num49 = (int)((float)num20 + (float)(num39 * 56) * inventoryScale);
38232 new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
38233 if (num46 > 12)
38234 {
38235 num49 += num35;
38236 }
38237 int context3 = 9;
38238 if (num46 > 12)
38239 {
38240 context3 = 11;
38241 }
38242 if (mouseX >= num48 && (float)mouseX <= (float)num48 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num49 && (float)mouseY <= (float)num49 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38243 {
38244 player[myPlayer].mouseInterface = true;
38245 armorHide = true;
38247 if (!flag8)
38248 {
38251 }
38253 }
38254 if (flag4)
38255 {
38257 }
38259 }
38260 inventoryBack = color;
38261 if (mouseX > screenWidth - 64 - 28 - 47 && mouseX < (int)((float)(screenWidth - 64 - 20 - 47) + 56f * inventoryScale) && mouseY > num20 && mouseY < (int)((float)num20 + 168f * inventoryScale) && !PlayerInput.IgnoreMouseInterface)
38262 {
38263 player[myPlayer].mouseInterface = true;
38264 }
38265 num39 = -1;
38266 for (int num50 = 0; num50 < 10; num50++)
38267 {
38268 if ((num50 == 8 && !flag5) || (num50 == 9 && !flag6))
38269 {
38270 continue;
38271 }
38272 num39++;
38273 bool num51 = LocalPlayer.IsItemSlotUnlockedAndUsable(num50);
38274 flag4 = !num51;
38275 bool flag9 = !num51 && !mouseItem.IsAir;
38276 int num52 = screenWidth - 64 - 28 - 47 - 47;
38277 int num53 = (int)((float)num20 + (float)(num39 * 56) * inventoryScale);
38278 new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
38279 if (num50 > 2)
38280 {
38281 num53 += num35;
38282 }
38283 if (mouseX >= num52 && (float)mouseX <= (float)num52 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num53 && (float)mouseY <= (float)num53 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38284 {
38285 player[myPlayer].mouseInterface = true;
38286 armorHide = true;
38288 if (!flag9)
38289 {
38291 {
38293 }
38295 }
38297 }
38298 if (flag4)
38299 {
38301 }
38303 }
38304 inventoryBack = color;
38306 }
38307 int num54 = (screenHeight - 600) / 2;
38308 int num55 = (int)((float)screenHeight / 600f * 250f);
38309 if (screenHeight < 700)
38310 {
38311 num54 = (screenHeight - 508) / 2;
38312 num55 = (int)((float)screenHeight / 600f * 200f);
38313 }
38314 else if (screenHeight < 850)
38315 {
38316 num55 = (int)((float)screenHeight / 600f * 225f);
38317 }
38318 if (craftingHide)
38319 {
38320 craftingAlpha -= 0.1f;
38321 if (craftingAlpha < 0f)
38322 {
38323 craftingAlpha = 0f;
38324 }
38325 }
38326 else
38327 {
38328 craftingAlpha += 0.025f;
38329 if (craftingAlpha > 1f)
38330 {
38331 craftingAlpha = 1f;
38332 }
38333 }
38334 Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color((byte)((float)(int)mouseTextColor * craftingAlpha), (byte)((float)(int)mouseTextColor * craftingAlpha), (byte)((float)(int)mouseTextColor * craftingAlpha), (byte)((float)(int)mouseTextColor * craftingAlpha));
38335 craftingHide = false;
38336 if (InReforgeMenu)
38337 {
38338 if (mouseReforge)
38339 {
38340 if (reforgeScale < 1f)
38341 {
38342 reforgeScale += 0.02f;
38343 }
38344 }
38345 else if (reforgeScale > 1f)
38346 {
38347 reforgeScale -= 0.02f;
38348 }
38349 if (player[myPlayer].chest != -1 || npcShop != 0 || player[myPlayer].talkNPC == -1 || InGuideCraftMenu)
38350 {
38351 InReforgeMenu = false;
38352 player[myPlayer].dropItemCheck();
38354 }
38355 else
38356 {
38357 int num56 = 50;
38358 int num57 = 270;
38359 string text = Lang.inter[46].Value + ": ";
38360 if (reforgeItem.type > 0)
38361 {
38362 int num58 = reforgeItem.value;
38363 if (player[myPlayer].discountAvailable)
38364 {
38365 num58 = (int)((double)num58 * 0.8);
38366 }
38367 num58 = (int)((double)num58 * player[myPlayer].currentShoppingSettings.PriceAdjustment);
38368 num58 /= 3;
38369 string text2 = "";
38370 int num59 = 0;
38371 int num60 = 0;
38372 int num61 = 0;
38373 int num62 = 0;
38374 int num63 = num58;
38375 if (num63 < 1)
38376 {
38377 num63 = 1;
38378 }
38379 if (num63 >= 1000000)
38380 {
38381 num59 = num63 / 1000000;
38382 num63 -= num59 * 1000000;
38383 }
38384 if (num63 >= 10000)
38385 {
38386 num60 = num63 / 10000;
38387 num63 -= num60 * 10000;
38388 }
38389 if (num63 >= 100)
38390 {
38391 num61 = num63 / 100;
38392 num63 -= num61 * 100;
38393 }
38394 if (num63 >= 1)
38395 {
38396 num62 = num63;
38397 }
38398 if (num59 > 0)
38399 {
38400 text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinPlatinum).Hex3() + ":" + num59 + " " + Lang.inter[15].Value + "] ";
38401 }
38402 if (num60 > 0)
38403 {
38404 text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinGold).Hex3() + ":" + num60 + " " + Lang.inter[16].Value + "] ";
38405 }
38406 if (num61 > 0)
38407 {
38408 text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinSilver).Hex3() + ":" + num61 + " " + Lang.inter[17].Value + "] ";
38409 }
38410 if (num62 > 0)
38411 {
38412 text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinCopper).Hex3() + ":" + num62 + " " + Lang.inter[18].Value + "] ";
38413 }
38414 ItemSlot.DrawSavings(spriteBatch, num56 + 130, invBottom, horizontal: true);
38416 int num64 = num56 + 70;
38417 int num65 = num57 + 40;
38420 if (num66)
38421 {
38422 value4 = TextureAssets.Reforge[1].Value;
38423 }
38424 spriteBatch.Draw(value4, new Vector2(num64, num65), null, Microsoft.Xna.Framework.Color.White, 0f, value4.Size() / 2f, reforgeScale, SpriteEffects.None, 0f);
38425 UILinkPointNavigator.SetPosition(304, new Vector2(num64, num65) + value4.Size() / 4f);
38426 if (num66)
38427 {
38428 hoverItemName = Lang.inter[19].Value;
38429 if (!mouseReforge)
38430 {
38432 }
38433 mouseReforge = true;
38434 player[myPlayer].mouseInterface = true;
38435 if (mouseLeftRelease && mouseLeft && player[myPlayer].BuyItem(num58))
38436 {
38437 reforgeItem.ResetPrefix();
38438 reforgeItem.Prefix(-2);
38439 reforgeItem.position.X = player[myPlayer].position.X + (float)(player[myPlayer].width / 2) - (float)(reforgeItem.width / 2);
38440 reforgeItem.position.Y = player[myPlayer].position.Y + (float)(player[myPlayer].height / 2) - (float)(reforgeItem.height / 2);
38443 }
38444 }
38445 else
38446 {
38447 mouseReforge = false;
38448 }
38449 }
38450 else
38451 {
38452 text = Lang.inter[20].Value;
38453 }
38455 if (mouseX >= num56 && (float)mouseX <= (float)num56 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num57 && (float)mouseY <= (float)num57 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38456 {
38457 player[myPlayer].mouseInterface = true;
38458 craftingHide = true;
38461 {
38463 }
38466 }
38468 }
38469 }
38470 else if (InGuideCraftMenu)
38471 {
38472 if (player[myPlayer].chest != -1 || npcShop != 0 || player[myPlayer].talkNPC == -1 || InReforgeMenu)
38473 {
38474 InGuideCraftMenu = false;
38475 player[myPlayer].dropItemCheck();
38477 }
38478 else
38479 {
38481 new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
38482 if (mouseX >= inventoryX && (float)mouseX <= (float)inventoryX + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= inventoryY && (float)mouseY <= (float)inventoryY + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38483 {
38484 player[myPlayer].mouseInterface = true;
38485 craftingHide = true;
38489 {
38491 }
38494 }
38496 }
38497 }
38499 bool flag10 = CreativeMenu.Enabled && !CreativeMenu.Blocked;
38500 if (!InReforgeMenu && !LocalPlayer.tileEntityAnchor.InUse && !flag10)
38501 {
38502 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1;
38503 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1;
38504 if (numAvailableRecipes > 0)
38505 {
38506 DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, Lang.inter[25].Value, new Vector2(76f, 414 + num54), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
38507 }
38508 for (int num67 = 0; num67 < Recipe.maxRecipes; num67++)
38509 {
38510 inventoryScale = 100f / (Math.Abs(availableRecipeY[num67]) + 100f);
38511 if ((double)inventoryScale < 0.75)
38512 {
38513 inventoryScale = 0.75f;
38514 }
38515 if (recFastScroll)
38516 {
38517 inventoryScale = 0.75f;
38518 }
38519 if (availableRecipeY[num67] < (float)((num67 - focusRecipe) * 65))
38520 {
38521 if (availableRecipeY[num67] == 0f && !recFastScroll)
38522 {
38524 }
38525 availableRecipeY[num67] += 6.5f;
38526 if (recFastScroll)
38527 {
38528 availableRecipeY[num67] += 130000f;
38529 }
38530 if (availableRecipeY[num67] > (float)((num67 - focusRecipe) * 65))
38531 {
38533 }
38534 }
38535 else if (availableRecipeY[num67] > (float)((num67 - focusRecipe) * 65))
38536 {
38537 if (availableRecipeY[num67] == 0f && !recFastScroll)
38538 {
38540 }
38541 availableRecipeY[num67] -= 6.5f;
38542 if (recFastScroll)
38543 {
38544 availableRecipeY[num67] -= 130000f;
38545 }
38546 if (availableRecipeY[num67] < (float)((num67 - focusRecipe) * 65))
38547 {
38549 }
38550 }
38551 else
38552 {
38553 recFastScroll = false;
38554 }
38556 {
38557 continue;
38558 }
38559 int num68 = (int)(46f - 26f * inventoryScale);
38560 int num69 = (int)(410f + availableRecipeY[num67] * inventoryScale - 30f * inventoryScale + (float)num54);
38561 double num70 = inventoryBack.A + 50;
38562 double num71 = 255.0;
38563 if (Math.Abs(availableRecipeY[num67]) > (float)num55 - 100f)
38564 {
38565 num70 = (double)(150f * (100f - (Math.Abs(availableRecipeY[num67]) - ((float)num55 - 100f)))) * 0.01;
38566 num71 = (double)(255f * (100f - (Math.Abs(availableRecipeY[num67]) - ((float)num55 - 100f)))) * 0.01;
38567 }
38568 new Microsoft.Xna.Framework.Color((byte)num70, (byte)num70, (byte)num70, (byte)num70);
38569 Microsoft.Xna.Framework.Color lightColor = new Microsoft.Xna.Framework.Color((byte)num71, (byte)num71, (byte)num71, (byte)num71);
38570 if (!LocalPlayer.creativeInterface && mouseX >= num68 && (float)mouseX <= (float)num68 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num69 && (float)mouseY <= (float)num69 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38571 {
38573 }
38574 if (numAvailableRecipes <= 0)
38575 {
38576 continue;
38577 }
38578 num70 -= 50.0;
38579 if (num70 < 0.0)
38580 {
38581 num70 = 0.0;
38582 }
38583 if (num67 == focusRecipe)
38584 {
38585 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = 0;
38587 {
38588 ItemSlot.DrawGoldBGForCraftingMaterial = true;
38589 }
38590 }
38591 else
38592 {
38593 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1;
38594 }
38596 inventoryBack = new Microsoft.Xna.Framework.Color((byte)num70, (byte)num70, (byte)num70, (byte)num70);
38597 ItemSlot.Draw(spriteBatch, ref recipe[availableRecipe[num67]].createItem, 22, new Vector2(num68, num69), lightColor);
38599 }
38600 if (numAvailableRecipes > 0)
38601 {
38602 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1;
38603 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1;
38604 for (int num72 = 0; num72 < Recipe.maxRequirements; num72++)
38605 {
38606 if (recipe[availableRecipe[focusRecipe]].requiredItem[num72].type == 0)
38607 {
38608 UILinkPointNavigator.Shortcuts.CRAFT_CurrentIngredientsCount = num72 + 1;
38609 break;
38610 }
38611 int num73 = 80 + num72 * 40;
38612 int num74 = 380 + num54;
38613 double num75 = inventoryBack.A + 50;
38614 double num76 = 255.0;
38617 num75 = (float)(inventoryBack.A + 50) - Math.Abs(availableRecipeY[focusRecipe]) * 2f;
38618 num76 = 255f - Math.Abs(availableRecipeY[focusRecipe]) * 2f;
38619 if (num75 < 0.0)
38620 {
38621 num75 = 0.0;
38622 }
38623 if (num76 < 0.0)
38624 {
38625 num76 = 0.0;
38626 }
38627 white.R = (byte)num75;
38628 white.G = (byte)num75;
38629 white.B = (byte)num75;
38630 white.A = (byte)num75;
38631 white2.R = (byte)num76;
38632 white2.G = (byte)num76;
38633 white2.B = (byte)num76;
38634 white2.A = (byte)num76;
38635 inventoryScale = 0.6f;
38636 if (num75 == 0.0)
38637 {
38638 break;
38639 }
38640 if (mouseX >= num73 && (float)mouseX <= (float)num73 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num74 && (float)mouseY <= (float)num74 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38641 {
38642 craftingHide = true;
38643 player[myPlayer].mouseInterface = true;
38645 }
38646 num75 -= 50.0;
38647 if (num75 < 0.0)
38648 {
38649 num75 = 0.0;
38650 }
38651 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = 1 + num72;
38653 inventoryBack = new Microsoft.Xna.Framework.Color((byte)num75, (byte)num75, (byte)num75, (byte)num75);
38656 }
38657 }
38658 if (numAvailableRecipes == 0)
38659 {
38660 recBigList = false;
38661 }
38662 else
38663 {
38664 int num77 = 94;
38665 int num78 = 450 + num54;
38666 if (InGuideCraftMenu)
38667 {
38668 num78 -= 150;
38669 }
38671 int num79 = recBigList.ToInt() * 2 + flag11.ToInt();
38672 spriteBatch.Draw(TextureAssets.CraftToggle[num79].Value, new Vector2(num77, num78), null, Microsoft.Xna.Framework.Color.White, 0f, TextureAssets.CraftToggle[num79].Value.Size() / 2f, 1f, SpriteEffects.None, 0f);
38673 if (flag11)
38674 {
38675 MouseText(Language.GetTextValue("GameUI.CraftingWindow"), 0, 0);
38676 player[myPlayer].mouseInterface = true;
38678 {
38679 if (!recBigList)
38680 {
38681 recBigList = true;
38683 }
38684 else
38685 {
38686 recBigList = false;
38688 }
38689 }
38690 }
38691 }
38692 }
38693 if (recBigList && !flag10)
38694 {
38695 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1;
38696 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1;
38697 int num80 = 42;
38698 if ((double)inventoryScale < 0.75)
38699 {
38700 inventoryScale = 0.75f;
38701 }
38702 int num81 = 340;
38703 int num82 = 310;
38704 int num83 = (screenWidth - num82 - 280) / num80;
38705 int num84 = (screenHeight - num81 - 20) / num80;
38706 UILinkPointNavigator.Shortcuts.CRAFT_IconsPerRow = num83;
38707 UILinkPointNavigator.Shortcuts.CRAFT_IconsPerColumn = num84;
38708 int num85 = 0;
38709 int num86 = 0;
38710 int num87 = num82;
38711 int num88 = num81;
38712 int num89 = num82 - 20;
38713 int num90 = num81 + 2;
38715 {
38717 if (recStart < 0)
38718 {
38719 recStart = 0;
38720 }
38721 }
38722 if (recStart > 0)
38723 {
38725 {
38726 player[myPlayer].mouseInterface = true;
38728 {
38729 recStart -= num83;
38730 if (recStart < 0)
38731 {
38732 recStart = 0;
38733 }
38735 mouseLeftRelease = false;
38736 }
38737 }
38738 spriteBatch.Draw(TextureAssets.CraftUpButton.Value, new Vector2(num89, num90), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.CraftUpButton.Width(), TextureAssets.CraftUpButton.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
38739 }
38741 {
38742 num90 += 20;
38744 {
38745 player[myPlayer].mouseInterface = true;
38747 {
38748 recStart += num83;
38751 {
38753 }
38754 mouseLeftRelease = false;
38755 }
38756 }
38757 spriteBatch.Draw(TextureAssets.CraftDownButton.Value, new Vector2(num89, num90), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.CraftUpButton.Width(), TextureAssets.CraftUpButton.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
38758 }
38759 for (int num91 = recStart; num91 < Recipe.maxRecipes && num91 < numAvailableRecipes; num91++)
38760 {
38761 int num92 = num87;
38762 int num93 = num88;
38763 double num94 = inventoryBack.A + 50;
38764 double num95 = 255.0;
38765 new Microsoft.Xna.Framework.Color((byte)num94, (byte)num94, (byte)num94, (byte)num94);
38766 new Microsoft.Xna.Framework.Color((byte)num95, (byte)num95, (byte)num95, (byte)num95);
38767 if (mouseX >= num92 && (float)mouseX <= (float)num92 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num93 && (float)mouseY <= (float)num93 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38768 {
38769 player[myPlayer].mouseInterface = true;
38771 {
38773 recFastScroll = true;
38774 recBigList = false;
38776 mouseLeftRelease = false;
38778 {
38781 }
38782 }
38783 craftingHide = true;
38784 HoverItem = recipe[availableRecipe[num91]].createItem.Clone();
38785 ItemSlot.MouseHover(22);
38786 hoverItemName = recipe[availableRecipe[num91]].createItem.Name;
38787 if (recipe[availableRecipe[num91]].createItem.stack > 1)
38788 {
38789 hoverItemName = hoverItemName + " (" + recipe[availableRecipe[num91]].createItem.stack + ")";
38790 }
38791 }
38792 if (numAvailableRecipes > 0)
38793 {
38794 num94 -= 50.0;
38795 if (num94 < 0.0)
38796 {
38797 num94 = 0.0;
38798 }
38799 UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = num91 - recStart;
38801 inventoryBack = new Microsoft.Xna.Framework.Color((byte)num94, (byte)num94, (byte)num94, (byte)num94);
38804 }
38805 num87 += num80;
38806 num85++;
38807 if (num85 >= num83)
38808 {
38809 num87 = num82;
38810 num88 += num80;
38811 num85 = 0;
38812 num86++;
38813 if (num86 >= num84)
38814 {
38815 break;
38816 }
38817 }
38818 }
38819 }
38820 Vector2 vector2 = FontAssets.MouseText.Value.MeasureString("Coins");
38821 Vector2 vector3 = FontAssets.MouseText.Value.MeasureString(Lang.inter[26].Value);
38822 float num96 = vector2.X / vector3.X;
38824 inventoryScale = 0.6f;
38825 for (int num97 = 0; num97 < 4; num97++)
38826 {
38827 int num98 = 497;
38828 int num99 = (int)(85f + (float)(num97 * 56) * inventoryScale + 20f);
38829 int slot = num97 + 50;
38830 new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
38831 if (mouseX >= num98 && (float)mouseX <= (float)num98 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num99 && (float)mouseY <= (float)num99 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38832 {
38833 player[myPlayer].mouseInterface = true;
38834 ItemSlot.OverrideHover(player[myPlayer].inventory, 1, slot);
38835 ItemSlot.LeftClick(player[myPlayer].inventory, 1, slot);
38836 ItemSlot.RightClick(player[myPlayer].inventory, 1, slot);
38838 {
38840 }
38841 ItemSlot.MouseHover(player[myPlayer].inventory, 1, slot);
38842 }
38843 ItemSlot.Draw(spriteBatch, player[myPlayer].inventory, 1, slot, new Vector2(num98, num99));
38844 }
38845 Vector2 vector4 = FontAssets.MouseText.Value.MeasureString("Ammo");
38846 Vector2 vector5 = FontAssets.MouseText.Value.MeasureString(Lang.inter[27].Value);
38847 float num100 = vector4.X / vector5.X;
38849 inventoryScale = 0.6f;
38850 for (int num101 = 0; num101 < 4; num101++)
38851 {
38852 int num102 = 534;
38853 int num103 = (int)(85f + (float)(num101 * 56) * inventoryScale + 20f);
38854 int slot2 = 54 + num101;
38855 new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
38856 if (mouseX >= num102 && (float)mouseX <= (float)num102 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num103 && (float)mouseY <= (float)num103 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38857 {
38858 player[myPlayer].mouseInterface = true;
38859 ItemSlot.OverrideHover(player[myPlayer].inventory, 2, slot2);
38860 ItemSlot.LeftClick(player[myPlayer].inventory, 2, slot2);
38861 ItemSlot.RightClick(player[myPlayer].inventory, 2, slot2);
38863 {
38865 }
38866 ItemSlot.MouseHover(player[myPlayer].inventory, 2, slot2);
38867 }
38869 }
38870 if (npcShop > 0 && (!playerInventory || player[myPlayer].talkNPC == -1))
38871 {
38872 SetNPCShopIndex(0);
38873 }
38874 if (npcShop > 0 && !recBigList)
38875 {
38878 inventoryScale = 0.755f;
38879 if (mouseX > 73 && mouseX < (int)(73f + 560f * inventoryScale) && mouseY > invBottom && mouseY < (int)((float)invBottom + 224f * inventoryScale) && !PlayerInput.IgnoreMouseInterface)
38880 {
38881 player[myPlayer].mouseInterface = true;
38882 }
38883 for (int num104 = 0; num104 < 10; num104++)
38884 {
38885 for (int num105 = 0; num105 < 4; num105++)
38886 {
38887 int num106 = (int)(73f + (float)(num104 * 56) * inventoryScale);
38888 int num107 = (int)((float)invBottom + (float)(num105 * 56) * inventoryScale);
38889 int slot3 = num104 + num105 * 10;
38890 new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
38891 if (mouseX >= num106 && (float)mouseX <= (float)num106 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num107 && (float)mouseY <= (float)num107 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
38892 {
38894 player[myPlayer].mouseInterface = true;
38898 }
38900 }
38901 }
38902 }
38903 if (player[myPlayer].chest > -1 && !tileContainer[tile[player[myPlayer].chestX, player[myPlayer].chestY].type])
38904 {
38905 player[myPlayer].chest = -1;
38907 }
38908 int offsetDown = 0;
38909 UIVirtualKeyboard.ShouldHideText = !PlayerInput.SettingsForUI.ShowGamepadHints;
38911 {
38912 offsetDown = 9999;
38913 }
38914 UIVirtualKeyboard.OffsetDown = offsetDown;
38916 LocalPlayer.tileEntityAnchor.GetTileEntity()?.OnInventoryDraw(LocalPlayer, spriteBatch);
38917 if (player[myPlayer].chest == -1 && npcShop == 0)
38918 {
38919 int num108 = 0;
38920 int num109 = 498;
38921 int num110 = 244;
38922 int num111 = TextureAssets.ChestStack[num108].Width();
38923 int num112 = TextureAssets.ChestStack[num108].Height();
38924 UILinkPointNavigator.SetPosition(301, new Vector2((float)num109 + (float)num111 * 0.75f, (float)num110 + (float)num112 * 0.75f));
38926 {
38927 num108 = 1;
38928 if (!allChestStackHover)
38929 {
38931 allChestStackHover = true;
38932 }
38934 {
38935 mouseLeftRelease = false;
38936 player[myPlayer].QuickStackAllChests();
38938 }
38939 player[myPlayer].mouseInterface = true;
38940 }
38941 else if (allChestStackHover)
38942 {
38944 allChestStackHover = false;
38945 }
38947 if (!mouseText && num108 == 1)
38948 {
38949 MouseText(Language.GetTextValue("GameUI.QuickStackToNearby"), 0, 0);
38950 }
38951 }
38952 if (player[myPlayer].chest != -1 || npcShop != 0)
38953 {
38954 return;
38955 }
38956 int num113 = 0;
38957 int num114 = 534;
38958 int num115 = 244;
38959 int num116 = 30;
38960 int num117 = 30;
38961 UILinkPointNavigator.SetPosition(302, new Vector2((float)num114 + (float)num116 * 0.75f, (float)num115 + (float)num117 * 0.75f));
38962 bool flag12 = false;
38964 {
38965 num113 = 1;
38966 flag12 = true;
38967 player[myPlayer].mouseInterface = true;
38969 {
38970 mouseLeftRelease = false;
38973 }
38974 }
38976 {
38979 }
38981 spriteBatch.Draw(value5, new Vector2(num114, num115), null, Microsoft.Xna.Framework.Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
38982 if (!mouseText && num113 == 1)
38983 {
38984 MouseText(Language.GetTextValue("GameUI.SortInventory"), 0, 0);
38985 }
38986 }
38987
38989 {
38990 int num = 10;
38993 {
38994 num--;
38995 }
38997 {
38998 num--;
38999 }
39000 int x = screenWidth - 58 + 14;
39001 int num2 = (int)((float)(inventoryTop - 2) + 0f * inventoryScale);
39002 int num3 = (int)((float)(inventoryTop - 2) + (float)(num * 56) * inventoryScale);
39003 Texture2D value = TextureAssets.Extra[259].Value;
39005 ItemSlot.GetLoadoutColor(player.CurrentLoadoutIndex);
39006 int num4 = player.Loadouts.Length;
39007 int num5 = 32;
39008 int num6 = 4;
39009 int num7 = -1;
39010 _ = FontAssets.ItemStack.Value;
39011 for (int i = 0; i < num4; i++)
39012 {
39015 _ = player.Loadouts[i];
39016 int frameX = ((i == player.CurrentLoadoutIndex) ? 1 : 0);
39017 bool flag = false;
39018 if (rectangle2.Contains(MouseScreen.ToPoint()))
39019 {
39020 flag = true;
39022 player.mouseInterface = true;
39023 if (!mouseText)
39024 {
39025 instance.MouseText(Language.GetTextValue("UI.Loadout" + (i + 1)), 0, 0);
39026 mouseText = true;
39027 }
39029 {
39030 player.TrySwitchingLoadout(i);
39031 }
39032 }
39033 Microsoft.Xna.Framework.Rectangle rectangle3 = value.Frame(3, 3, frameX, i);
39034 spriteBatch.Draw(value, rectangle2.Center.ToVector2(), rectangle3, Microsoft.Xna.Framework.Color.White, 0f, rectangle3.Size() / 2f, 1f, SpriteEffects.None, 0f);
39035 if (flag)
39036 {
39037 rectangle3 = value.Frame(3, 3, 2, i);
39038 spriteBatch.Draw(value, rectangle2.Center.ToVector2(), rectangle3, OurFavoriteColor, 0f, rectangle3.Size() / 2f, 1f, SpriteEffects.None, 0f);
39039 }
39040 UILinkPointNavigator.SetPosition(312 + i, rectangle2.Center.ToVector2());
39041 }
39043 {
39046 }
39047 }
39048
39049 private void DrawNPCHousesInUI()
39050 {
39051 UILinkPointNavigator.Shortcuts.NPCS_LastHovered = -2;
39052 if (mouseX > screenWidth - 64 - 28 && mouseX < (int)((float)(screenWidth - 64 - 28) + 56f * inventoryScale) && mouseY > 174 + mH && mouseY < (int)((float)(174 + mH) + 448f * inventoryScale) && !PlayerInput.IgnoreMouseInterface)
39053 {
39054 player[myPlayer].mouseInterface = true;
39055 }
39056 int num = 0;
39057 string text = "";
39058 int num2 = 0;
39059 int num3 = 0;
39061 for (int i = 0; i < _npcIndexWhoHoldsHeadIndex.Length; i++)
39062 {
39064 }
39065 for (int j = 0; j < 200; j++)
39066 {
39067 if (npc[j].active && !_npcTypesThatAlreadyDrewAHead.Contains(npc[j].type))
39068 {
39071 {
39074 }
39075 }
39076 }
39077 hidePVPIcons = false;
39078 int num4 = 0;
39079 int num5 = 0;
39080 UILinkPointNavigator.Shortcuts.NPCS_IconsPerColumn = 1;
39081 for (int k = 0; k < TextureAssets.NpcHead.Length; k++)
39082 {
39083 if (k != 0 && _npcIndexWhoHoldsHeadIndex[k] == -1)
39084 {
39085 continue;
39086 }
39088 int num7 = screenWidth - 64 - 28 + num3;
39089 int num8 = (int)((float)(174 + mH) + (float)(num * 56) * inventoryScale) + num2;
39090 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(100, 100, 100, 100);
39091 if (num8 > screenHeight - 80)
39092 {
39093 num3 -= 48;
39094 num2 -= num8 - (174 + mH);
39095 num7 = screenWidth - 64 - 28 + num3;
39096 num8 = (int)((float)(174 + mH) + (float)(num * 56) * inventoryScale) + num2;
39097 UILinkPointNavigator.Shortcuts.NPCS_IconsPerColumn = num5;
39098 if (num3 <= -144)
39099 {
39100 hidePVPIcons = true;
39101 }
39102 num5 = 0;
39103 }
39104 if (mouseX >= num7 && (float)mouseX <= (float)num7 + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num8 && (float)mouseY <= (float)num8 + (float)TextureAssets.InventoryBack.Height() * inventoryScale)
39105 {
39106 UILinkPointNavigator.Shortcuts.NPCS_LastHovered = num6;
39107 mouseText = true;
39108 text = ((k != 0) ? npc[num6].FullName : Lang.inter[8].Value);
39110 {
39111 player[myPlayer].mouseInterface = true;
39113 {
39115 if (k == 0)
39116 {
39118 }
39119 else
39120 {
39122 }
39123 mouseLeftRelease = false;
39124 }
39125 }
39126 }
39127 UILinkPointNavigator.SetPosition(600 + num, new Vector2(num7, num8) + TextureAssets.InventoryBack.Value.Size() * 0.75f);
39130 if (UILinkPointNavigator.CurrentPoint - 600 == num)
39131 {
39134 }
39135 spriteBatch.Draw(value, new Vector2(num7, num8), null, white, 0f, default(Vector2), inventoryScale, SpriteEffects.None, 0f);
39137 int num9 = k;
39138 float scale = 1f;
39139 float num10 = 0f;
39140 num10 = ((TextureAssets.NpcHead[num9].Width() <= TextureAssets.NpcHead[num9].Height()) ? ((float)TextureAssets.NpcHead[num9].Height()) : ((float)TextureAssets.NpcHead[num9].Width()));
39141 if (num10 > 36f)
39142 {
39143 scale = 36f / num10;
39144 }
39145 spriteBatch.Draw(TextureAssets.NpcHead[num9].Value, new Vector2((float)num7 + 26f * inventoryScale, (float)num8 + 26f * inventoryScale), null, color, 0f, new Vector2(TextureAssets.NpcHead[num9].Width() / 2, TextureAssets.NpcHead[num9].Height() / 2), scale, SpriteEffects.None, 0f);
39146 num++;
39147 num4++;
39148 num5++;
39149 }
39150 UILinkPointNavigator.Shortcuts.NPCS_IconsTotal = num4;
39151 if (text != "" && mouseItem.type == 0)
39152 {
39153 MouseText(text, 0, 0);
39154 }
39155 }
39156
39157 private static void DrawDefenseCounter(int inventoryX, int inventoryY)
39158 {
39159 Vector2 vector = new Vector2(inventoryX - 10 - 47 - 47 - 14, (float)inventoryY + (float)TextureAssets.InventoryBack.Height() * 0.5f);
39160 spriteBatch.Draw(TextureAssets.Extra[58].Value, vector, null, Microsoft.Xna.Framework.Color.White, 0f, TextureAssets.Extra[58].Value.Size() / 2f, inventoryScale, SpriteEffects.None, 0f);
39161 Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(player[myPlayer].statDefense.ToString());
39164 {
39165 player[myPlayer].mouseInterface = true;
39166 string value = player[myPlayer].statDefense + " " + Lang.inter[10].Value;
39167 if (!string.IsNullOrEmpty(value))
39168 {
39170 }
39171 }
39173 }
39174
39176 {
39177 inventoryX = 73;
39178 inventoryY = 331;
39179 inventoryY += adjY;
39180 string text = null;
39182 if (guideItem.IsAir)
39183 {
39184 text = Lang.inter[24].Value;
39185 }
39186 else
39187 {
39188 text = Lang.inter[21].Value + " " + guideItem.Name;
39190 for (int i = 0; i < Recipe.maxRequirements; i++)
39191 {
39192 int num = recipe.requiredTile[i];
39193 if (num == -1)
39194 {
39195 break;
39196 }
39200 }
39201 if (recipe.needWater)
39202 {
39204 }
39205 if (recipe.needHoney)
39206 {
39208 }
39209 if (recipe.needLava)
39210 {
39212 }
39213 if (recipe.needSnowBiome)
39214 {
39216 }
39217 if (recipe.needGraveyardBiome)
39218 {
39220 }
39221 if (_requiredObjecsForCraftingText.Count == 0)
39222 {
39223 string value = Lang.inter[23].Value;
39225 }
39226 }
39228 Vector2 vector = new Vector2(inventoryX + 50, inventoryY + 12);
39230 if (_requiredObjecsForCraftingText.Count > 0)
39231 {
39232 vector.Y -= 14f;
39233 Vector2 vector2 = vector + new Vector2(0f, 26f);
39235 string value3 = Lang.inter[22].Value;
39236 string text2 = string.Join(", ", _requiredObjecsForCraftingText);
39237 string text3 = value3 + " " + text2;
39239 }
39241 }
39242
39244 {
39245 inventoryX = 73;
39246 inventoryY = 331;
39247 inventoryY += adjY;
39248 int num = 0;
39249 int num2 = 0;
39250 inventoryX += num;
39251 inventoryY += num2;
39252 string text;
39253 if (guideItem.type > 0)
39254 {
39255 text = Lang.inter[21].Value + " " + guideItem.Name;
39257 int num3 = focusRecipe;
39258 int num4 = 0;
39259 for (int i = 0; i < Recipe.maxRequirements; i++)
39260 {
39261 int num5 = (i + 1) * 26;
39262 if (recipe[availableRecipe[num3]].requiredTile[i] == -1)
39263 {
39264 if (i == 0 && !recipe[availableRecipe[num3]].needWater && !recipe[availableRecipe[num3]].needHoney && !recipe[availableRecipe[num3]].needLava && !recipe[availableRecipe[num3]].needSnowBiome && !recipe[availableRecipe[num3]].needGraveyardBiome)
39265 {
39267 }
39268 break;
39269 }
39270 num4++;
39271 int num6 = recipe[availableRecipe[num3]].requiredTile[i];
39273 }
39274 if (recipe[availableRecipe[num3]].needWater)
39275 {
39276 int num7 = (num4 + 1) * 26;
39278 }
39279 if (recipe[availableRecipe[num3]].needHoney)
39280 {
39281 int num8 = (num4 + 1) * 26;
39283 }
39284 if (recipe[availableRecipe[num3]].needLava)
39285 {
39286 int num9 = (num4 + 1) * 26;
39288 }
39289 if (recipe[availableRecipe[num3]].needSnowBiome)
39290 {
39291 int num10 = (num4 + 1) * 26;
39293 }
39294 if (recipe[availableRecipe[num3]].needGraveyardBiome)
39295 {
39296 int num11 = (num4 + 1) * 26;
39298 }
39299 }
39300 else
39301 {
39302 text = Lang.inter[24].Value;
39303 }
39304 inventoryX -= num;
39305 inventoryY -= num2;
39307 }
39308
39313
39315 {
39317 player[myPlayer].mouseInterface = true;
39318 bool flag = (mouseLeftRelease && mouseLeft) || (mouseRightRelease && mouseRight);
39319 bool flag2 = mouseLeft || mouseRight;
39320 if (focusRecipe == recipeIndex && guideItem.IsAir)
39321 {
39322 bool flag3 = LocalPlayer.ItemTimeIsZero && LocalPlayer.itemAnimation == 0 && !player[myPlayer].HasLockedInventory() && !_preventCraftingBecauseClickWasUsedToChangeFocusedRecipe;
39324 bool flag4 = _currentRecipeBeingCrafted != -1 && Main.recipe[_currentRecipeBeingCrafted].createItem.maxStack == 1;
39325 bool flag5 = num || flag4;
39326 if (flag2 && !flag5 && flag3 && stackSplit <= 1)
39327 {
39332 {
39334 }
39336 {
39338 {
39340 }
39343 }
39344 }
39345 }
39346 else if (flag)
39347 {
39349 stackSplit = 15;
39351 }
39352 craftingHide = true;
39353 HoverItem = recipe.createItem.Clone();
39354 ItemSlot.MouseHover(22);
39355 hoverItemName = recipe.createItem.Name;
39356 if (recipe.createItem.stack > 1)
39357 {
39358 hoverItemName = hoverItemName + " (" + recipe.createItem.stack + ")";
39359 }
39360 if (!flag2)
39361 {
39364 }
39365 }
39366
39368 {
39370 if (mouseItem.IsAir)
39371 {
39372 return true;
39373 }
39374 if (mouseItem.IsTheSameAs(currentRecipe.createItem) && mouseItem.stack + currentRecipe.createItem.stack <= mouseItem.maxStack)
39375 {
39376 return true;
39377 }
39378 if (tryFittingItemInInventoryToAllowCrafting && LocalPlayer.ItemSpace(mouseItem).CanTakeItemToPersonalInventory)
39379 {
39381 if (mouseItem.IsAir)
39382 {
39384 return true;
39385 }
39386 if (mouseItem.IsTheSameAs(currentRecipe.createItem) && mouseItem.stack + currentRecipe.createItem.stack <= mouseItem.maxStack)
39387 {
39389 return true;
39390 }
39391 }
39392 return false;
39393 }
39394
39395 private static void DrawTrashItemSlot(int pivotTopLeftX, int pivotTopLeftY)
39396 {
39397 inventoryScale = 0.85f;
39398 int num = 448 + pivotTopLeftX;
39399 int num2 = 258 + pivotTopLeftY;
39400 if ((player[myPlayer].chest != -1 || npcShop > 0) && !recBigList)
39401 {
39402 num2 += 168;
39403 inventoryScale = 0.755f;
39404 num += 5;
39405 }
39406 new Microsoft.Xna.Framework.Color(150, 150, 150, 150);
39407 if (mouseX >= num && (float)mouseX <= (float)num + (float)TextureAssets.InventoryBack.Width() * inventoryScale && mouseY >= num2 && (float)mouseY <= (float)num2 + (float)TextureAssets.InventoryBack.Height() * inventoryScale && !PlayerInput.IgnoreMouseInterface)
39408 {
39409 player[myPlayer].mouseInterface = true;
39410 ItemSlot.LeftClick(ref player[myPlayer].trashItem, 6);
39412 {
39414 }
39415 ItemSlot.MouseHover(ref player[myPlayer].trashItem, 6);
39416 }
39417 ItemSlot.Draw(spriteBatch, ref player[myPlayer].trashItem, 6, new Vector2(num, num2));
39418 }
39419
39421 {
39422 inventoryScale = 0.85f;
39423 int num = (int)((float)(450 + pivotTopLeftX) - 56f * inventoryScale);
39424 int num2 = 258 + pivotTopLeftY;
39425 int num3 = 244;
39426 int width = 30;
39427 int num4 = 30;
39428 num = 534;
39429 num2 = num3 + num4 + 4;
39430 if ((player[myPlayer].chest != -1 || npcShop > 0) && !recBigList)
39431 {
39432 num2 += 168;
39433 inventoryScale = 0.755f;
39434 num += 5;
39435 num3 += 24;
39436 }
39437 if (editChest)
39438 {
39439 num2 += 24;
39440 }
39442 rectangle = new Microsoft.Xna.Framework.Rectangle(num, num2, width, num4);
39443 bool flag = false;
39445 {
39446 player[myPlayer].mouseInterface = true;
39447 flag = true;
39449 {
39450 player[myPlayer].SetTalkNPC(-1);
39452 npcChatText = "";
39453 mouseLeftRelease = false;
39456 }
39457 }
39459 Vector2 position = rectangle.Center.ToVector2();
39460 Microsoft.Xna.Framework.Rectangle rectangle2 = value.Frame(2, 1, flag ? 1 : 0);
39461 rectangle2.Width -= 2;
39462 rectangle2.Height -= 2;
39463 Vector2 origin = rectangle2.Size() / 2f;
39465 spriteBatch.Draw(value, position, rectangle2, white, 0f, origin, 1f, SpriteEffects.None, 0f);
39466 UILinkPointNavigator.SetPosition(309, position);
39467 if (!mouseText && flag)
39468 {
39469 instance.MouseText(Language.GetTextValue("GameUI.Emote"), 0, 0);
39470 }
39471 }
39472
39473 private static void DrawBestiaryIcon(int pivotTopLeftX, int pivotTopLeftY)
39474 {
39475 inventoryScale = 0.85f;
39476 int num = (int)((float)(450 + pivotTopLeftX) - 56f * inventoryScale * 2f);
39477 int num2 = 258 + pivotTopLeftY;
39478 int num3 = 244;
39479 int width = 30;
39480 int num4 = 30;
39481 num3 = 244;
39482 num = 498;
39483 num2 = num3 + num4 + 4;
39484 if ((player[myPlayer].chest != -1 || npcShop > 0) && !recBigList)
39485 {
39486 num2 += 168;
39487 inventoryScale = 0.755f;
39488 num += 5;
39489 num3 += 24;
39490 }
39491 if (editChest)
39492 {
39493 num2 += 24;
39494 }
39496 rectangle = new Microsoft.Xna.Framework.Rectangle(num, num2, width, num4);
39497 bool flag = false;
39499 {
39500 player[myPlayer].mouseInterface = true;
39501 flag = true;
39503 {
39504 player[myPlayer].SetTalkNPC(-1);
39506 npcChatText = "";
39507 mouseLeftRelease = false;
39510 BestiaryUI.OnOpenPage();
39511 }
39512 }
39514 Vector2 position = rectangle.Center.ToVector2();
39515 Microsoft.Xna.Framework.Rectangle rectangle2 = value.Frame(2, 1, flag ? 1 : 0);
39516 rectangle2.Width -= 2;
39517 rectangle2.Height -= 2;
39518 Vector2 origin = rectangle2.Size() / 2f;
39520 spriteBatch.Draw(value, position, rectangle2, white, 0f, origin, 1f, SpriteEffects.None, 0f);
39521 UILinkPointNavigator.SetPosition(310, position);
39522 if (!mouseText && flag)
39523 {
39524 instance.MouseText(Language.GetTextValue("GameUI.Bestiary"), 0, 0);
39525 }
39526 }
39527
39528 private static void SetRecipeMaterialDisplayName(int i)
39529 {
39530 HoverItem = recipe[availableRecipe[focusRecipe]].requiredItem[i].Clone();
39531 ItemSlot.MouseHover(22);
39532 hoverItemName = recipe[availableRecipe[focusRecipe]].requiredItem[i].Name;
39533 if (recipe[availableRecipe[focusRecipe]].ProcessGroupsForText(recipe[availableRecipe[focusRecipe]].requiredItem[i].type, out var theText))
39534 {
39535 HoverItem.SetNameOverride(theText);
39536 }
39537 if (recipe[availableRecipe[focusRecipe]].anyIronBar && recipe[availableRecipe[focusRecipe]].requiredItem[i].type == 22)
39538 {
39539 HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.GetItemNameValue(22));
39540 }
39541 else if (recipe[availableRecipe[focusRecipe]].anyWood && recipe[availableRecipe[focusRecipe]].requiredItem[i].type == 9)
39542 {
39543 HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.GetItemNameValue(9));
39544 }
39545 else if (recipe[availableRecipe[focusRecipe]].anySand && recipe[availableRecipe[focusRecipe]].requiredItem[i].type == 169)
39546 {
39547 HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.GetItemNameValue(169));
39548 }
39549 else if (recipe[availableRecipe[focusRecipe]].anyFragment && recipe[availableRecipe[focusRecipe]].requiredItem[i].type == 3458)
39550 {
39551 HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.misc[51].Value);
39552 }
39553 else if (recipe[availableRecipe[focusRecipe]].anyPressurePlate && recipe[availableRecipe[focusRecipe]].requiredItem[i].type == 542)
39554 {
39555 HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.misc[38].Value);
39556 }
39557 if (recipe[availableRecipe[focusRecipe]].requiredItem[i].stack > 1)
39558 {
39559 hoverItemName = hoverItemName + " (" + recipe[availableRecipe[focusRecipe]].requiredItem[i].stack + ")";
39560 }
39561 }
39562
39564 {
39565 int num = 21 + pivotTopLeftY;
39566 _ = player[myPlayer];
39567 if (pushSideToolsUp)
39568 {
39569 num = pivotTopLeftY;
39570 }
39571 float num2 = 0.9f;
39572 Texture2D value = TextureAssets.HbLock[(!player[myPlayer].hbLocked) ? 1u : 0u].Value;
39574 bool flag = false;
39575 if (mouseX > pivotTopLeftX && (float)mouseX < (float)pivotTopLeftX + (float)value2.Width * num2 && mouseY > num && (float)mouseY < (float)num + (float)value2.Height * num2)
39576 {
39577 flag = true;
39578 player[myPlayer].mouseInterface = true;
39579 if (!player[myPlayer].hbLocked)
39580 {
39581 MouseText(Lang.inter[5].Value, 0, 0);
39582 }
39583 else
39584 {
39585 MouseText(Lang.inter[6].Value, 0, 0);
39586 }
39587 mouseText = true;
39589 {
39591 player[myPlayer].hbLocked = !player[myPlayer].hbLocked;
39592 }
39593 }
39595 if (flag)
39596 {
39597 spriteBatch.Draw(value, new Vector2(pivotTopLeftX, num), value.Frame(2, 1, 1), OurFavoriteColor, 0f, default(Vector2), num2, SpriteEffects.None, 0f);
39598 }
39599 }
39600
39602 {
39603 if (!playerInventory)
39604 {
39605 return;
39606 }
39607 int num = 44 + pivotTopLeftY;
39608 _ = player[myPlayer];
39609 if (pushSideToolsUp)
39610 {
39611 num = 23 + pivotTopLeftY;
39612 }
39613 float num2 = 0.9f;
39614 int num3 = 10;
39615 bool flag = player[myPlayer].builderAccStatus[num3] == 0;
39617 Microsoft.Xna.Framework.Rectangle rectangle = value.Frame(3, 1, (!flag) ? 1 : 0);
39618 bool flag2 = false;
39619 if (mouseX > pivotTopLeftX && (float)mouseX < (float)pivotTopLeftX + (float)rectangle.Width * num2 && mouseY > num && (float)mouseY < (float)num + (float)rectangle.Height * num2)
39620 {
39621 flag2 = true;
39622 player[myPlayer].mouseInterface = true;
39623 MouseText(flag ? Language.GetTextValue("GameUI.BlockReplacerOn") : Language.GetTextValue("GameUI.BlockReplacerOff"), 0, 0);
39624 mouseText = true;
39626 {
39628 player[myPlayer].builderAccStatus[num3] = (flag ? 1 : 0);
39629 }
39630 }
39631 Vector2 vector = new Vector2(pivotTopLeftX, num);
39633 if (flag2)
39634 {
39635 spriteBatch.Draw(value, vector, value.Frame(3, 1, 2), OurFavoriteColor, 0f, default(Vector2), num2, SpriteEffects.None, 0f);
39636 }
39638 }
39639
39641 {
39642 if (!playerInventory)
39643 {
39644 return;
39645 }
39646 int num = 68 + pivotTopLeftY;
39647 _ = player[myPlayer];
39648 if (pushSideToolsUp)
39649 {
39650 num = 47 + pivotTopLeftY;
39651 }
39652 float num2 = 0.9f;
39653 int num3 = 11;
39654 bool flag = player[myPlayer].builderAccStatus[num3] == 0;
39655 Texture2D value = TextureAssets.Extra[211].Value;
39656 Microsoft.Xna.Framework.Rectangle rectangle = value.Frame(4, 1, flag ? 1 : 0);
39657 bool flag2 = false;
39658 if (mouseX > pivotTopLeftX && (float)mouseX < (float)pivotTopLeftX + (float)rectangle.Width * num2 && mouseY > num && (float)mouseY < (float)num + (float)rectangle.Height * num2)
39659 {
39660 flag2 = true;
39661 player[myPlayer].mouseInterface = true;
39662 MouseText(flag ? Language.GetTextValue("GameUI.TorchTypeSwapperOn") : Language.GetTextValue("GameUI.TorchTypeSwapperOff"), 0, 0);
39663 mouseText = true;
39665 {
39667 player[myPlayer].builderAccStatus[num3] = (flag ? 1 : 0);
39668 }
39669 }
39670 Vector2 vector = new Vector2(pivotTopLeftX, num);
39672 if (flag2)
39673 {
39674 spriteBatch.Draw(value, vector, value.Frame(4, 1, flag ? 3 : 2), OurFavoriteColor, 0f, default(Vector2), num2, SpriteEffects.None, 0f);
39675 }
39677 }
39678
39679 public static void CraftItem(Recipe r)
39680 {
39681 int stack = mouseItem.stack;
39682 mouseItem = r.createItem.Clone();
39683 mouseItem.stack += stack;
39684 mouseItem.OnCreated(new RecipeItemCreationContext(r));
39685 if (stack <= 0)
39686 {
39687 mouseItem.Prefix(-1);
39688 }
39689 mouseItem.position.X = player[myPlayer].position.X + (float)(player[myPlayer].width / 2) - (float)(mouseItem.width / 2);
39690 mouseItem.position.Y = player[myPlayer].position.Y + (float)(player[myPlayer].height / 2) - (float)(mouseItem.height / 2);
39691 PopupText.NewText(PopupTextContext.ItemCraft, mouseItem, r.createItem.stack);
39692 r.Create();
39693 if (mouseItem.type > 0 || r.createItem.type > 0)
39694 {
39696 }
39697 }
39698
39699 private static void DrawPVPIcons()
39700 {
39701 if (EquipPage == 1)
39702 {
39703 if (hidePVPIcons)
39704 {
39705 return;
39706 }
39707 }
39708 else
39709 {
39710 hidePVPIcons = false;
39711 }
39712 inventoryScale = 0.6f;
39713 int num = (int)(52f * inventoryScale);
39714 int num2 = 707 - num * 4 + screenWidth - 800;
39715 int num3 = 114 + mH + num * 2 + num / 2 - 12;
39716 if (EquipPage == 2)
39717 {
39718 num2 += num + num / 2;
39719 }
39720 int num4 = (player[myPlayer].hostile ? 2 : 0);
39722 {
39723 player[myPlayer].mouseInterface = true;
39724 if (teamCooldown == 0)
39725 {
39726 num4++;
39727 }
39729 {
39732 player[myPlayer].hostile = !player[myPlayer].hostile;
39733 NetMessage.SendData(30, -1, -1, null, myPlayer);
39734 }
39735 }
39737 rectangle.Location = new Microsoft.Xna.Framework.Point(rectangle.Width * num4, rectangle.Height * player[myPlayer].team);
39738 rectangle.Width -= 2;
39739 rectangle.Height--;
39741 UILinkPointNavigator.SetPosition(1550, new Vector2(num2 - 10, num3) + rectangle.Size() * 0.75f);
39742 num3 += 60;
39743 num2 -= 10;
39744 rectangle = TextureAssets.Pvp[1].Frame(6);
39746 for (int i = 0; i < 6; i++)
39747 {
39748 r.Location = new Microsoft.Xna.Framework.Point(num2 + i % 2 * 20, num3 + i / 2 * 20);
39749 rectangle.X = rectangle.Width * i;
39750 bool flag = false;
39752 {
39753 player[myPlayer].mouseInterface = true;
39754 if (teamCooldown == 0)
39755 {
39756 flag = true;
39757 }
39758 if (mouseLeft && mouseLeftRelease && player[myPlayer].team != i && teamCooldown == 0)
39759 {
39760 if (!player[myPlayer].TeamChangeAllowed())
39761 {
39762 NewText(Lang.misc[84].Value, byte.MaxValue, 240, 20);
39763 }
39764 else
39765 {
39768 player[myPlayer].team = i;
39769 NetMessage.SendData(45, -1, -1, null, myPlayer);
39770 }
39771 }
39772 }
39773 r.Width = rectangle.Width - 2;
39774 if (flag)
39775 {
39776 spriteBatch.Draw(TextureAssets.Pvp[2].Value, r.Location.ToVector2() + new Vector2(-2f), Microsoft.Xna.Framework.Color.White);
39777 }
39779 value.Width -= 2;
39780 spriteBatch.Draw(TextureAssets.Pvp[1].Value, r.Location.ToVector2(), value, Microsoft.Xna.Framework.Color.White);
39781 UILinkPointNavigator.SetPosition(1550 + i + 1, r.Location.ToVector2() + r.Size() * 0.75f);
39782 }
39783 }
39784
39785 private static int DrawPageIcons(int yPos)
39786 {
39787 int num = -1;
39788 Vector2 vector = new Vector2(screenWidth - 162, yPos);
39789 vector.X += 82f;
39790 Texture2D value = TextureAssets.EquipPage[(EquipPage == 2) ? 3 : 2].Value;
39791 if (Collision.CheckAABBvAABBCollision(vector, value.Size(), new Vector2(mouseX, mouseY), Vector2.One) && (mouseItem.stack < 1 || mouseItem.dye > 0))
39792 {
39793 num = 2;
39794 }
39795 if (num == 2)
39796 {
39797 spriteBatch.Draw(TextureAssets.EquipPage[6].Value, vector, null, OurFavoriteColor, 0f, new Vector2(2f), 0.9f, SpriteEffects.None, 0f);
39798 }
39799 spriteBatch.Draw(value, vector, null, Microsoft.Xna.Framework.Color.White, 0f, Vector2.Zero, 0.9f, SpriteEffects.None, 0f);
39800 UILinkPointNavigator.SetPosition(305, vector + value.Size() * 0.75f);
39801 vector.X -= 48f;
39802 value = TextureAssets.EquipPage[(EquipPage == 1) ? 5 : 4].Value;
39804 {
39805 num = 1;
39806 }
39807 if (num == 1)
39808 {
39809 spriteBatch.Draw(TextureAssets.EquipPage[7].Value, vector, null, OurFavoriteColor, 0f, new Vector2(2f), 0.9f, SpriteEffects.None, 0f);
39810 }
39811 spriteBatch.Draw(value, vector, null, Microsoft.Xna.Framework.Color.White, 0f, Vector2.Zero, 0.9f, SpriteEffects.None, 0f);
39812 UILinkPointNavigator.SetPosition(306, vector + value.Size() * 0.75f);
39813 vector.X -= 48f;
39814 value = TextureAssets.EquipPage[(EquipPage == 3) ? 10 : 8].Value;
39816 {
39817 num = 3;
39818 }
39819 if (num == 3 && !CaptureModeDisabled)
39820 {
39821 spriteBatch.Draw(TextureAssets.EquipPage[9].Value, vector, null, OurFavoriteColor, 0f, Vector2.Zero, 0.9f, SpriteEffects.None, 0f);
39822 }
39824 UILinkPointNavigator.SetPosition(307, vector + value.Size() * 0.75f);
39825 if (num != -1)
39826 {
39827 player[myPlayer].mouseInterface = true;
39829 {
39830 bool flag = true;
39831 if (num == 3)
39832 {
39834 {
39835 flag = false;
39836 }
39837 else if (PlayerInput.UsingGamepad)
39838 {
39840 }
39841 else
39842 {
39843 CaptureManager.Instance.Active = true;
39844 blockMouse = true;
39845 }
39846 }
39847 else if (EquipPageSelected != num)
39848 {
39849 EquipPageSelected = num;
39850 }
39851 else
39852 {
39854 }
39855 if (flag)
39856 {
39858 }
39859 }
39860 }
39862 if (EquipPage == -1)
39863 {
39865 }
39866 return num;
39867 }
39868
39869 public void DrawMouseOver()
39870 {
39874 if (player[myPlayer].gravDir == -1f)
39875 {
39876 mouseRectangle.Y = (int)screenPosition.Y + screenHeight - mouseY;
39877 }
39879 if (!LocalPlayer.ghost)
39880 {
39881 ResourceSetsManager.TryToHoverOverResources();
39882 }
39886 if (!mouseText)
39887 {
39888 for (int i = 0; i < 400; i++)
39889 {
39890 if (!item[i].active)
39891 {
39892 continue;
39893 }
39895 Vector2 bottom = item[i].Bottom;
39896 Microsoft.Xna.Framework.Rectangle value = new Microsoft.Xna.Framework.Rectangle((int)(bottom.X - (float)drawHitbox.Width * 0.5f), (int)(bottom.Y - (float)drawHitbox.Height), drawHitbox.Width, drawHitbox.Height);
39897 if (mouseRectangle.Intersects(value))
39898 {
39899 player[myPlayer].cursorItemIconEnabled = false;
39900 string text = item[i].AffixName();
39901 if (item[i].stack > 1)
39902 {
39903 text = text + " (" + item[i].stack + ")";
39904 }
39905 if (item[i].playerIndexTheItemIsReservedFor < 255 && showItemOwner)
39906 {
39907 text = text + " <" + player[item[i].playerIndexTheItemIsReservedFor].name + ">";
39908 }
39909 rare = item[i].rare;
39910 if (item[i].expert)
39911 {
39912 rare = -12;
39913 }
39915 mouseText = true;
39916 break;
39917 }
39918 }
39919 }
39920 for (int j = 0; j < 255; j++)
39921 {
39922 if (!player[j].active || myPlayer == j || player[j].dead || player[j].ShouldNotDraw || !((double)player[j].stealth > 0.5))
39923 {
39924 continue;
39925 }
39926 Microsoft.Xna.Framework.Rectangle value2 = new Microsoft.Xna.Framework.Rectangle((int)((double)player[j].position.X + (double)player[j].width * 0.5 - 16.0), (int)(player[j].position.Y + (float)player[j].height - 48f), 32, 48);
39927 if (!mouseText && mouseRectangle.Intersects(value2))
39928 {
39929 player[myPlayer].cursorItemIconEnabled = false;
39930 int num = player[j].statLife;
39931 if (num < 0)
39932 {
39933 num = 0;
39934 }
39935 string text2 = player[j].name + ": " + num + "/" + player[j].statLifeMax2;
39936 if (player[j].hostile)
39937 {
39938 text2 = text2 + " " + Language.GetTextValue("Game.PvPFlag");
39939 }
39940 MouseTextHackZoom(text2, 0, player[j].difficulty);
39941 mouseText = true;
39942 }
39943 }
39944 HoveringOverAnNPC = false;
39945 if (!mouseText)
39946 {
39948 }
39949 if (!mouseText && signHover != -1 && sign[signHover] != null && !player[myPlayer].mouseInterface && !string.IsNullOrWhiteSpace(sign[signHover].text))
39950 {
39951 int lineAmount;
39953 lineAmount++;
39954 spriteBatch.End();
39955 spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, _uiScaleMatrix);
39957 int num2 = screenWidth;
39958 int num3 = screenHeight;
39959 int num4 = mouseX;
39960 int num5 = mouseY;
39963 float num6 = 0f;
39964 for (int k = 0; k < lineAmount; k++)
39965 {
39966 float x = FontAssets.MouseText.Value.MeasureString(array[k]).X;
39967 if (num6 < x)
39968 {
39969 num6 = x;
39970 }
39971 }
39972 if (num6 > 460f)
39973 {
39974 num6 = 460f;
39975 }
39977 Vector2 vector = new Vector2(num4, num5) + new Vector2(16f);
39979 {
39980 vector += new Vector2(8f, 2f);
39981 }
39982 if (vector.Y > (float)(num3 - 30 * lineAmount))
39983 {
39984 vector.Y = num3 - 30 * lineAmount;
39985 }
39986 if (vector.X > (float)num2 - num6)
39987 {
39988 vector.X = (float)num2 - num6;
39989 }
39992 {
39994 int num7 = 10;
39995 int num8 = 5;
39996 Utils.DrawInvBG(spriteBatch, new Microsoft.Xna.Framework.Rectangle((int)vector.X - num7, (int)vector.Y - num8, (int)num6 + num7 * 2, 30 * lineAmount + num8 + num8 / 2), new Microsoft.Xna.Framework.Color(23, 25, 81, 255) * 0.925f * 0.85f);
39997 }
39998 for (int l = 0; l < lineAmount; l++)
39999 {
40001 }
40002 mouseText = true;
40003 }
40005 }
40006
40008 {
40010 for (int i = 0; i < 200; i++)
40011 {
40012 NPC nPC = npc[i];
40013 if (!(nPC.active & (nPC.shimmerTransparency == 0f || nPC.CanApplyHunterPotionEffects())))
40014 {
40015 continue;
40016 }
40017 int type = nPC.type;
40018 LoadNPC(type);
40019 nPC.position += nPC.netOffset;
40020 Microsoft.Xna.Framework.Rectangle value = new Microsoft.Xna.Framework.Rectangle((int)nPC.Bottom.X - nPC.frame.Width / 2, (int)nPC.Bottom.Y - nPC.frame.Height, nPC.frame.Width, nPC.frame.Height);
40021 if (nPC.type >= 87 && nPC.type <= 92)
40022 {
40023 value = new Microsoft.Xna.Framework.Rectangle((int)((double)nPC.position.X + (double)nPC.width * 0.5 - 32.0), (int)((double)nPC.position.Y + (double)nPC.height * 0.5 - 32.0), 64, 64);
40024 }
40025 bool flag = mouseRectangle.Intersects(value);
40026 bool flag2 = flag || (SmartInteractShowingGenuine && SmartInteractNPC == i);
40027 if (flag2 && ((nPC.type != 85 && nPC.type != 341 && nPC.type != 629 && nPC.aiStyle != 87) || nPC.ai[0] != 0f) && nPC.type != 488)
40028 {
40029 if (nPC.type == 685)
40030 {
40031 player.cursorItemIconEnabled = true;
40032 player.cursorItemIconID = 327;
40033 player.cursorItemIconText = "";
40034 player.noThrow = 2;
40035 if (!player.dead)
40036 {
40039 {
40040 npcChatRelease = false;
40042 {
40043 player.releaseInventory = false;
40044 }
40045 if (player.talkNPC != i && !player.tileInteractionHappened && TryFreeingElderSlime(i))
40046 {
40049 }
40050 }
40051 }
40052 }
40053 else
40054 {
40056 if (nPC.townNPC || nPC.type == 105 || nPC.type == 106 || nPC.type == 123 || nPC.type == 354 || nPC.type == 376 || nPC.type == 579 || nPC.type == 453 || nPC.type == 589)
40057 {
40058 Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int)(player.position.X + (float)(player.width / 2) - (float)(Player.tileRangeX * 16)), (int)(player.position.Y + (float)(player.height / 2) - (float)(Player.tileRangeY * 16)), Player.tileRangeX * 16 * 2, Player.tileRangeY * 16 * 2);
40059 Microsoft.Xna.Framework.Rectangle value2 = new Microsoft.Xna.Framework.Rectangle((int)nPC.position.X, (int)nPC.position.Y, nPC.width, nPC.height);
40060 if (rectangle.Intersects(value2))
40061 {
40062 flag3 = true;
40063 }
40064 }
40065 if (player.ownedProjectileCounts[651] > 0)
40066 {
40067 flag3 = false;
40068 }
40069 if (flag3 && !player.dead)
40070 {
40072 HoveringOverAnNPC = true;
40075 {
40076 npcChatRelease = false;
40078 {
40079 player.releaseInventory = false;
40080 }
40081 if (player.talkNPC != i && !player.tileInteractionHappened)
40082 {
40084 SetNPCShopIndex(0);
40085 InGuideCraftMenu = false;
40086 player.dropItemCheck();
40088 player.sign = -1;
40089 editSign = false;
40090 player.SetTalkNPC(i);
40091 playerInventory = false;
40092 player.chest = -1;
40094 npcChatText = nPC.GetChat();
40096 }
40097 }
40098 }
40099 if (flag && !player.mouseInterface)
40100 {
40101 player.cursorItemIconEnabled = false;
40102 string text = nPC.GivenOrTypeName;
40103 int num = i;
40104 if (nPC.realLife >= 0)
40105 {
40106 num = nPC.realLife;
40107 }
40108 if (npc[num].lifeMax > 1 && !npc[num].dontTakeDamage)
40109 {
40110 text = text + ": " + npc[num].life + "/" + npc[num].lifeMax;
40111 }
40113 mouseText = true;
40114 nPC.position -= nPC.netOffset;
40115 break;
40116 }
40117 if (flag2)
40118 {
40119 nPC.position -= nPC.netOffset;
40120 break;
40121 }
40122 }
40123 }
40124 nPC.position -= nPC.netOffset;
40125 }
40126 }
40127
40128 private static bool TryFreeingElderSlime(int npcIndex)
40129 {
40131 short type = 327;
40132 bool inVoidBag = false;
40133 int num = player.FindItemInInventoryOrOpenVoidBag(type, out inVoidBag);
40134 if (num == -1)
40135 {
40136 return false;
40137 }
40138 Item item = null;
40139 item = ((!inVoidBag) ? player.inventory[num] : player.bank4.item[num]);
40140 if (--item.stack <= 0)
40141 {
40142 item.TurnToAir();
40143 }
40145 return true;
40146 }
40147
40148 private static void DrawNPCChatBubble(int i)
40149 {
40150 int num = -(npc[i].width / 2 + 8);
40151 float num2 = npc[i].position.Y - (float)TextureAssets.Chat.Height() - (float)(int)screenPosition.Y;
40152 if (npc[i].type == 637 && npc[i].ai[0] == 5f)
40153 {
40154 num2 -= 18f;
40155 }
40157 if (npc[i].spriteDirection == -1)
40158 {
40159 spriteEffects = SpriteEffects.FlipHorizontally;
40160 num = npc[i].width / 2 + 8;
40161 }
40162 if (player[myPlayer].gravDir != 1f)
40163 {
40164 spriteEffects |= SpriteEffects.FlipVertically;
40165 num2 = (float)screenHeight - num2 - (float)TextureAssets.Chat.Height();
40166 }
40167 Vector2 position = new Vector2(npc[i].position.X + (float)(npc[i].width / 2) - screenPosition.X - (float)(TextureAssets.Chat.Width() / 2) - (float)num, num2);
40168 spriteBatch.End();
40169 spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, GameViewMatrix.ZoomMatrix);
40172 spriteBatch.End();
40173 spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, _uiScaleMatrix);
40174 }
40175
40176 public void GUIBarsDraw()
40177 {
40178 if (ignoreErrors)
40179 {
40180 try
40181 {
40183 return;
40184 }
40185 catch (Exception e)
40186 {
40188 return;
40189 }
40190 }
40192 }
40193
40206
40208 {
40209 buffString = "";
40210 bannerMouseOver = false;
40211 if (!recBigList)
40212 {
40213 recStart = 0;
40214 }
40215 }
40216
40218 {
40219 recBigList = false;
40220 int num = -1;
40221 int num2 = 11;
40222 for (int i = 0; i < Player.maxBuffs; i++)
40223 {
40224 if (player[myPlayer].buffType[i] > 0)
40225 {
40226 _ = player[myPlayer].buffType[i];
40227 int x = 32 + i * 38;
40228 int num3 = 76;
40229 int num4 = i;
40230 while (num4 >= num2)
40231 {
40232 num4 -= num2;
40233 x = 32 + num4 * 38;
40234 num3 += 50;
40235 }
40236 num = DrawBuffIcon(num, i, x, num3);
40237 }
40238 else
40239 {
40240 buffAlpha[i] = 0.4f;
40241 }
40242 }
40243 if (num < 0)
40244 {
40245 return;
40246 }
40247 int num5 = player[myPlayer].buffType[num];
40248 if (num5 > 0)
40249 {
40250 string buffName = Lang.GetBuffName(num5);
40251 string buffTooltip = GetBuffTooltip(player[myPlayer], num5);
40252 if (num5 == 147)
40253 {
40254 bannerMouseOver = true;
40255 }
40256 if (meleeBuff[num5])
40257 {
40258 MouseTextHackZoom(buffName, -10, 0, buffTooltip);
40259 }
40260 else
40261 {
40262 MouseTextHackZoom(buffName, buffTooltip);
40263 }
40264 }
40265 }
40266
40267 public static string GetBuffTooltip(Player player, int buffType)
40268 {
40269 string text = Lang.GetBuffDescription(buffType);
40270 switch (buffType)
40271 {
40272 case 26:
40273 if (expertMode)
40274 {
40275 text = Language.GetTextValue("BuffDescription.WellFed_Expert");
40276 }
40277 break;
40278 case 206:
40279 if (expertMode)
40280 {
40281 text = Language.GetTextValue("BuffDescription.WellFed2_Expert");
40282 }
40283 break;
40284 case 207:
40285 if (expertMode)
40286 {
40287 text = Language.GetTextValue("BuffDescription.WellFed3_Expert");
40288 }
40289 break;
40290 case 94:
40291 {
40292 int num = (int)(player.manaSickReduction * 100f) + 1;
40293 text = text + num + "%";
40294 break;
40295 }
40296 }
40297 return text;
40298 }
40299
40301 {
40302 int num = player[myPlayer].buffType[buffSlotOnPlayer];
40303 buffTimeValue = 0;
40304 if (!vanityPet[num] && !lightPet[num] && !buffNoTimeDisplay[num] && (!player[myPlayer].honeyWet || num != 48) && (!player[myPlayer].wet || !expertMode || num != 46))
40305 {
40307 return true;
40308 }
40309 return false;
40310 }
40311
40312 public static int DrawBuffIcon(int drawBuffText, int buffSlotOnPlayer, int x, int y)
40313 {
40314 int num = player[myPlayer].buffType[buffSlotOnPlayer];
40315 if (num == 0)
40316 {
40317 return drawBuffText;
40318 }
40320 spriteBatch.Draw(TextureAssets.Buff[num].Value, new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Buff[num].Width(), TextureAssets.Buff[num].Height()), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
40322 {
40323 string text = Lang.LocalizedDuration(new TimeSpan(0, 0, buffTimeValue / 60), abbreviated: true, showAllAvailableUnits: false);
40324 DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.ItemStack.Value, text, new Vector2(x, y + TextureAssets.Buff[num].Height()), color, 0f, default(Vector2), 0.8f, SpriteEffects.None, 0f);
40325 }
40326 if (mouseX < x + TextureAssets.Buff[num].Width() && mouseY < y + TextureAssets.Buff[num].Height() && mouseX > x && mouseY > y)
40327 {
40329 buffAlpha[buffSlotOnPlayer] += 0.1f;
40330 bool flag = mouseRight && mouseRightRelease;
40332 {
40334 if (playerInventory)
40335 {
40336 player[myPlayer].mouseInterface = true;
40337 }
40338 }
40339 else
40340 {
40341 player[myPlayer].mouseInterface = true;
40342 }
40343 if (flag)
40344 {
40346 }
40347 }
40348 else
40349 {
40350 buffAlpha[buffSlotOnPlayer] -= 0.05f;
40351 }
40352 if (buffAlpha[buffSlotOnPlayer] > 1f)
40353 {
40355 }
40356 else if ((double)buffAlpha[buffSlotOnPlayer] < 0.4)
40357 {
40359 }
40361 {
40362 drawBuffText = -1;
40363 }
40364 return drawBuffText;
40365 }
40366
40367 public static void TryRemovingBuff(int i, int b)
40368 {
40369 bool flag = false;
40370 if (!debuff[b] && b != 60 && b != 151)
40371 {
40372 if (player[myPlayer].mount.Active && player[myPlayer].mount.CheckBuff(b))
40373 {
40374 player[myPlayer].mount.Dismount(player[myPlayer]);
40375 flag = true;
40376 }
40380 if (!flag)
40381 {
40382 player[myPlayer].DelBuff(i);
40383 }
40384 }
40385 }
40386
40387 public static void TryRemovingBuff_CheckBuffHideMisc(int slot, int buffID)
40388 {
40389 if (!player[myPlayer].hideMisc[slot])
40390 {
40391 bool flag = player[myPlayer].miscEquips[slot].buffType == buffID;
40392 if (!flag && (buffID == 102 || buffID == 101))
40393 {
40394 flag = player[myPlayer].miscEquips[slot].buffType == 27;
40395 }
40396 if (flag)
40397 {
40398 player[myPlayer].hideMisc[slot] = true;
40399 }
40400 }
40401 }
40402
40404 {
40405 bool flag = false;
40406 if (player[myPlayer].dead)
40407 {
40408 return;
40409 }
40410 if (player[myPlayer].lavaTime < player[myPlayer].lavaMax && player[myPlayer].lavaWet)
40411 {
40412 flag = true;
40413 }
40414 else if (player[myPlayer].lavaTime < player[myPlayer].lavaMax && player[myPlayer].breath == player[myPlayer].breathMax)
40415 {
40416 flag = true;
40417 }
40418 Vector2 vector = player[myPlayer].Top + new Vector2(0f, player[myPlayer].gfxOffY);
40419 if (playerInventory && screenHeight < 1000)
40420 {
40421 vector.Y += player[myPlayer].height - 20;
40422 }
40424 if (!playerInventory || screenHeight >= 1000)
40425 {
40426 vector.Y -= 100f;
40427 }
40428 vector /= UIScale;
40429 if (ingameOptionsWindow || InGameUI.IsVisible)
40430 {
40431 vector = new Vector2(screenWidth / 2, screenHeight / 2 + 236);
40432 if (InGameUI.IsVisible)
40433 {
40434 vector.Y = screenHeight - 64;
40435 }
40436 }
40437 if (player[myPlayer].breath < player[myPlayer].breathMax && !player[myPlayer].ghost && !flag)
40438 {
40439 _ = player[myPlayer].breathMax / 20;
40440 int num = 20;
40441 for (int i = 1; i < player[myPlayer].breathMax / num + 1; i++)
40442 {
40443 int num2 = 255;
40444 float num3 = 1f;
40445 if (player[myPlayer].breath >= i * num)
40446 {
40447 num2 = 255;
40448 }
40449 else
40450 {
40451 float num4 = (float)(player[myPlayer].breath - (i - 1) * num) / (float)num;
40452 num2 = (int)(30f + 225f * num4);
40453 if (num2 < 30)
40454 {
40455 num2 = 30;
40456 }
40457 num3 = num4 / 4f + 0.75f;
40458 if ((double)num3 < 0.75)
40459 {
40460 num3 = 0.75f;
40461 }
40462 }
40463 int num5 = 0;
40464 int num6 = 0;
40465 if (i > 10)
40466 {
40467 num5 -= 260;
40468 num6 += 26;
40469 }
40470 spriteBatch.Draw(TextureAssets.Bubble.Value, vector + new Vector2((float)(26 * (i - 1) + num5) - 125f, 32f + ((float)TextureAssets.Bubble.Height() - (float)TextureAssets.Bubble.Height() * num3) / 2f + (float)num6), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Bubble.Width(), TextureAssets.Bubble.Height()), new Microsoft.Xna.Framework.Color(num2, num2, num2, num2), 0f, default(Vector2), num3, SpriteEffects.None, 0f);
40471 }
40472 }
40473 if (!(player[myPlayer].lavaTime < player[myPlayer].lavaMax && !player[myPlayer].ghost && flag))
40474 {
40475 return;
40476 }
40477 int num7 = player[myPlayer].lavaMax / 10;
40478 _ = player[myPlayer].breathMax / num7;
40479 for (int j = 1; j < player[myPlayer].lavaMax / num7 + 1; j++)
40480 {
40481 int num8 = 255;
40482 float num9 = 1f;
40483 if (player[myPlayer].lavaTime >= j * num7)
40484 {
40485 num8 = 255;
40486 }
40487 else
40488 {
40489 float num10 = (float)(player[myPlayer].lavaTime - (j - 1) * num7) / (float)num7;
40490 num8 = (int)(30f + 225f * num10);
40491 if (num8 < 30)
40492 {
40493 num8 = 30;
40494 }
40495 num9 = num10 / 4f + 0.75f;
40496 if ((double)num9 < 0.75)
40497 {
40498 num9 = 0.75f;
40499 }
40500 }
40501 int num11 = 0;
40502 int num12 = 0;
40503 if (j > 10)
40504 {
40505 num11 -= 260;
40506 num12 += 26;
40507 }
40508 spriteBatch.Draw(TextureAssets.Flame.Value, vector + new Vector2((float)(26 * (j - 1) + num11) - 125f, 32f + ((float)TextureAssets.Flame.Height() - (float)TextureAssets.Flame.Height() * num9) / 2f + (float)num12), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Bubble.Width(), TextureAssets.Bubble.Height()), new Microsoft.Xna.Framework.Color(num8, num8, num8, num8), 0f, default(Vector2), num9, SpriteEffects.None, 0f);
40509 }
40510 }
40511
40513 {
40514 Projectile projectile = null;
40515 for (int i = 0; i < 1000; i++)
40516 {
40518 if (projectile2.active && projectile2.owner == myPlayer && projectile2.type == 722)
40519 {
40521 break;
40522 }
40523 }
40524 if (projectile == null)
40525 {
40526 return;
40527 }
40529 if (projectile3 != null)
40530 {
40532 if (!(relativeStrength < 0.001f))
40533 {
40534 Vector2 position = LocalPlayer.Bottom - Camera.ScaledPosition;
40535 position *= GameViewMatrix.Zoom;
40536 position /= UIScale;
40537 position.X -= 27f;
40538 position.Y += 14f;
40541 }
40542 }
40543 }
40544
40546 {
40547 if (!Item.IsAGolfingItem(LocalPlayer.HeldItem))
40548 {
40549 return;
40550 }
40551 Projectile lastHitBall = LocalGolfState.GetLastHitBall();
40553 {
40554 Vector2 vector = lastHitBall.Top - Camera.ScaledPosition;
40555 vector *= GameViewMatrix.Zoom;
40556 vector /= UIScale;
40557 float num = MathHelper.Clamp(((LocalPlayer.position - lastHitBall.position).Length() - 150f) / 50f, 0f, 1f);
40559 float num2 = 0f;
40560 if (vector2 != vector)
40561 {
40562 num2 = (vector2 - vector).ToRotation() + (float)Math.PI / 2f;
40563 }
40564 vector2 -= (num2 + (float)Math.PI / 2f).ToRotationVector2() * (((float)Math.Sin(GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f) * 5f + 14f);
40567 Vector2 origin = rectangle.Size() * new Vector2(0.5f, 1f);
40569 spriteBatch.Draw(TextureAssets.GolfBallArrowShadow.Value, vector2 + new Vector2(-4f, 4f) * 1.5f, rectangle, Microsoft.Xna.Framework.Color.White * num, num2, origin, 1.5f, SpriteEffects.None, 0f);
40570 float amount = (float)Math.Sin(GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f;
40571 for (float num3 = 0f; num3 < 1f; num3 += 0.25f)
40572 {
40573 spriteBatch.Draw(value, vector2 + ((float)Math.PI * 2f * num3 + num2).ToRotationVector2() * MathHelper.Lerp(2f, 2f, amount), value2, Microsoft.Xna.Framework.Color.Black * num * MathHelper.Lerp(1f, 1f, amount), num2, origin, 1.5f, SpriteEffects.None, 0f);
40574 }
40575 for (float num4 = 0f; num4 < 1f; num4 += 0.25f)
40576 {
40577 spriteBatch.Draw(value, vector2 + ((float)Math.PI * 2f * num4 + num2).ToRotationVector2() * MathHelper.Lerp(0f, 0f, amount), value2, Microsoft.Xna.Framework.Color.White * num * MathHelper.Lerp(0.8f, 0.8f, amount), num2, origin, 1.5f, SpriteEffects.None, 0f);
40578 }
40579 spriteBatch.Draw(value, vector2, rectangle, mouseColor * num, num2, origin, 1.5f, SpriteEffects.None, 0f);
40580 }
40581 }
40582
40583 protected void GUIHotbarDrawInner()
40584 {
40585 if (playerInventory || player[myPlayer].ghost)
40586 {
40587 return;
40588 }
40589 string text = Lang.inter[37].Value;
40590 if (player[myPlayer].inventory[player[myPlayer].selectedItem].Name != null && player[myPlayer].inventory[player[myPlayer].selectedItem].Name != "")
40591 {
40592 text = player[myPlayer].inventory[player[myPlayer].selectedItem].AffixName();
40593 }
40594 Vector2 vector = FontAssets.MouseText.Value.MeasureString(text) / 2f;
40596 int num = 20;
40597 for (int i = 0; i < 10; i++)
40598 {
40599 if (i == player[myPlayer].selectedItem)
40600 {
40601 if (hotbarScale[i] < 1f)
40602 {
40603 hotbarScale[i] += 0.05f;
40604 }
40605 }
40606 else if ((double)hotbarScale[i] > 0.75)
40607 {
40608 hotbarScale[i] -= 0.05f;
40609 }
40610 float num2 = hotbarScale[i];
40611 int num3 = (int)(20f + 22f * (1f - num2));
40612 int a = (int)(75f + 150f * num2);
40613 Microsoft.Xna.Framework.Color lightColor = new Microsoft.Xna.Framework.Color(255, 255, 255, a);
40614 if (!player[myPlayer].hbLocked && !PlayerInput.IgnoreMouseInterface && mouseX >= num && (float)mouseX <= (float)num + (float)TextureAssets.InventoryBack.Width() * hotbarScale[i] && mouseY >= num3 && (float)mouseY <= (float)num3 + (float)TextureAssets.InventoryBack.Height() * hotbarScale[i] && !player[myPlayer].channel)
40615 {
40616 player[myPlayer].mouseInterface = true;
40617 player[myPlayer].cursorItemIconEnabled = false;
40618 if (mouseLeft && !player[myPlayer].hbLocked && !blockMouse)
40619 {
40620 player[myPlayer].changeItem = i;
40621 }
40622 hoverItemName = player[myPlayer].inventory[i].AffixName();
40623 if (player[myPlayer].inventory[i].stack > 1)
40624 {
40625 hoverItemName = hoverItemName + " (" + player[myPlayer].inventory[i].stack + ")";
40626 }
40627 rare = player[myPlayer].inventory[i].rare;
40628 }
40629 float num4 = inventoryScale;
40631 ItemSlot.Draw(spriteBatch, player[myPlayer].inventory, 13, i, new Vector2(num, num3), lightColor);
40633 num += (int)((float)TextureAssets.InventoryBack.Width() * hotbarScale[i]) + 4;
40634 }
40635 int selectedItem = player[myPlayer].selectedItem;
40636 if (selectedItem >= 10 && (selectedItem != 58 || mouseItem.type > 0))
40637 {
40638 float num5 = 1f;
40639 int num6 = (int)(20f + 22f * (1f - num5));
40640 int a2 = (int)(75f + 150f * num5);
40642 float num7 = inventoryScale;
40644 ItemSlot.Draw(spriteBatch, player[myPlayer].inventory, 13, selectedItem, new Vector2(num, num6), lightColor2);
40646 }
40647 }
40648
40649 public static void OpenHairWindow()
40650 {
40651 hBar = -1f;
40652 lBar = -1f;
40653 sBar = -1f;
40654 playerInventory = false;
40655 npcChatText = "";
40657 oldHairColor = player[myPlayer].hairColor;
40658 hairWindow = true;
40660 }
40661
40662 public static void CancelHairWindow()
40663 {
40664 if (hairWindow)
40665 {
40667 player[myPlayer].hairColor = oldHairColor;
40668 hairWindow = false;
40669 if (player[myPlayer].talkNPC > -1 && npc[player[myPlayer].talkNPC].type == 353)
40670 {
40671 player[myPlayer].SetTalkNPC(-1);
40672 }
40674 }
40675 }
40676
40677 public static void BuyHairWindow()
40678 {
40680 hairWindow = false;
40681 player[myPlayer].SetTalkNPC(-1);
40683 NetMessage.SendData(4, -1, -1, null, myPlayer);
40684 }
40685
40686 public static int UnlockedMaxHair()
40687 {
40688 int num = 154;
40689 if (NPC.downedMartians)
40690 {
40691 num += 10;
40692 }
40694 {
40695 num++;
40696 }
40697 return num;
40698 }
40699
40700 protected void DrawHairWindow()
40701 {
40702 if (npcChatText != "" || playerInventory || player[myPlayer].chest != -1 || npcShop != 0 || player[myPlayer].talkNPC == -1 || InGuideCraftMenu)
40703 {
40705 return;
40706 }
40707 Hairstyles.UpdateUnlocks();
40708 int count = Hairstyles.AvailableHairstyles.Count;
40709 int num = screenHeight / 2 + 60;
40710 int num2 = screenWidth / 2 - TextureAssets.HairStyleBack.Width() / 2;
40711 int num3 = num + 42;
40712 int num4 = num2 + 22;
40713 int num5 = num2 + 234;
40714 int num6 = num + 18;
40715 selColor = player[myPlayer].hairColor;
40716 spriteBatch.Draw(TextureAssets.HairStyleBack.Value, new Vector2(num2, num), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.HairStyleBack.Width(), TextureAssets.HairStyleBack.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
40718 {
40719 int num7 = PlayerInput.ScrollWheelDelta / 120;
40720 num7 = -num7;
40721 int num8 = Math.Sign(num7);
40722 while (num7 != 0)
40723 {
40724 if (num7 < 0)
40725 {
40726 hairStart -= 5;
40728 }
40729 else
40730 {
40731 hairStart += 5;
40733 }
40734 num7 -= num8;
40735 }
40736 }
40737 if (mouseX > num2 && mouseX < num2 + TextureAssets.HairStyleBack.Width() && mouseY > num && mouseY < num + TextureAssets.HairStyleBack.Height())
40738 {
40739 player[myPlayer].mouseInterface = true;
40740 }
40741 int num9 = num5 - 18;
40742 int num10 = num6 + 74;
40743 if (hairStart > 1)
40744 {
40745 if (mouseX >= num9 && mouseX <= num9 + TextureAssets.CraftUpButton.Width() && mouseY >= num10 && mouseY <= num10 + TextureAssets.CraftUpButton.Height())
40746 {
40747 player[myPlayer].mouseInterface = true;
40749 {
40750 hairStart -= 15;
40752 }
40753 }
40754 spriteBatch.Draw(TextureAssets.ScrollLeftButton.Value, new Vector2(num9, num10), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.CraftUpButton.Width(), TextureAssets.CraftUpButton.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
40755 }
40756 if (hairStart + 15 < count)
40757 {
40758 num9 += 296;
40759 if (mouseX >= num9 && mouseX <= num9 + TextureAssets.CraftUpButton.Width() && mouseY >= num10 && mouseY <= num10 + TextureAssets.CraftUpButton.Height())
40760 {
40761 player[myPlayer].mouseInterface = true;
40763 {
40764 hairStart += 15;
40766 }
40767 }
40768 spriteBatch.Draw(TextureAssets.ScrollRightButton.Value, new Vector2(num9, num10), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.CraftUpButton.Width(), TextureAssets.CraftUpButton.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
40769 }
40770 if (hairStart + 15 >= count)
40771 {
40772 hairStart = count - 15;
40773 }
40774 if (hairStart < 0)
40775 {
40776 hairStart = 0;
40777 }
40778 int num11 = 0;
40779 if (oldHairStyle != player[myPlayer].hair)
40780 {
40781 num11 += 100000;
40782 }
40783 if (oldHairColor != player[myPlayer].hairColor)
40784 {
40785 num11 += 20000;
40786 }
40787 num11 = (int)((double)num11 * player[myPlayer].currentShoppingSettings.PriceAdjustment);
40788 num11 = (int)Math.Round((float)num11 / 10000f) * 10000;
40789 string text = "";
40790 string text2 = "";
40791 int num12 = 0;
40792 int num13 = 0;
40793 int num14 = 0;
40794 int num15 = 0;
40795 int num16 = num11;
40796 _ = 0;
40797 if (num16 < 0)
40798 {
40799 num16 = 0;
40800 }
40801 num11 = num16;
40802 if (num16 >= 1000000)
40803 {
40804 num12 = num16 / 1000000;
40805 num16 -= num12 * 1000000;
40806 }
40807 if (num16 >= 10000)
40808 {
40809 num13 = num16 / 10000;
40810 num16 -= num13 * 10000;
40811 }
40812 if (num16 >= 100)
40813 {
40814 num14 = num16 / 100;
40815 num16 -= num14 * 100;
40816 }
40817 if (num16 >= 1)
40818 {
40819 num15 = num16;
40820 }
40821 if (num12 > 0)
40822 {
40823 text2 = text2 + num12 + " " + Lang.inter[15].Value + " ";
40824 }
40825 if (num13 > 0)
40826 {
40827 text2 = text2 + num13 + " " + Lang.inter[16].Value + " ";
40828 }
40829 if (num14 > 0)
40830 {
40831 text2 = text2 + num14 + " " + Lang.inter[17].Value + " ";
40832 }
40833 if (num15 > 0)
40834 {
40835 text2 = text2 + num15 + " " + Lang.inter[18].Value + " ";
40836 }
40837 text = Language.GetTextValue("GameUI.BuyWithValue", text2);
40838 if (num11 == 0)
40839 {
40840 text = Language.GetTextValue("GameUI.Buy");
40841 }
40842 int num17 = (mouseTextColor * 2 + 255) / 3;
40843 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(num17, (int)((double)num17 / 1.1), num17 / 2, num17);
40844 float num18 = 0.9f;
40845 string text3 = text;
40846 int num19 = num2 + 18;
40847 int num20 = num + 156;
40848 bool flag = false;
40849 if (num11 > 0)
40850 {
40851 ItemSlot.DrawSavings(spriteBatch, num19, num20 - 70, horizontal: true);
40852 }
40853 if (num11 > 0 && mouseX > num19 && (float)mouseX < (float)num19 + FontAssets.MouseText.Value.MeasureString(text3).X && mouseY > num20 && (float)mouseY < (float)num20 + FontAssets.MouseText.Value.MeasureString(text3).Y)
40854 {
40855 flag = true;
40856 num18 = 1.1f;
40857 if (!npcChatFocus1)
40858 {
40860 }
40861 npcChatFocus1 = true;
40862 player[myPlayer].releaseUseItem = false;
40863 }
40864 else
40865 {
40866 if (npcChatFocus1)
40867 {
40869 }
40870 npcChatFocus1 = false;
40871 }
40872 Vector2 vector = FontAssets.MouseText.Value.MeasureString(text3);
40873 vector *= 0.5f;
40875 for (int i = 0; i < 5; i++)
40876 {
40877 int num21 = num19;
40878 int num22 = num20;
40880 if (flag)
40881 {
40883 }
40884 if (i == 0)
40885 {
40886 num21 -= 2;
40887 }
40888 if (i == 1)
40889 {
40890 num21 += 2;
40891 }
40892 if (i == 2)
40893 {
40894 num22 -= 2;
40895 }
40896 if (i == 3)
40897 {
40898 num22 += 2;
40899 }
40900 if (i == 4)
40901 {
40902 color2 = ((num11 != 0) ? color : new Microsoft.Xna.Framework.Color(100, 100, 100));
40903 }
40905 }
40906 num18 = 0.9f;
40907 string textValue = Language.GetTextValue("GameUI.Cancel");
40908 num19 += 130;
40909 flag = false;
40910 if (mouseX > num19 && (float)mouseX < (float)num19 + FontAssets.MouseText.Value.MeasureString(textValue).X && mouseY > num20 && (float)mouseY < (float)num20 + FontAssets.MouseText.Value.MeasureString(textValue).Y)
40911 {
40912 flag = true;
40913 num18 = 1.1f;
40914 if (!npcChatFocus2)
40915 {
40917 }
40918 npcChatFocus2 = true;
40919 player[myPlayer].releaseUseItem = false;
40920 }
40921 else
40922 {
40923 if (npcChatFocus2)
40924 {
40926 }
40927 npcChatFocus2 = false;
40928 }
40929 vector = FontAssets.MouseText.Value.MeasureString(textValue);
40930 vector *= 0.5f;
40932 for (int j = 0; j < 5; j++)
40933 {
40934 int num23 = num19;
40935 int num24 = num20;
40937 if (flag)
40938 {
40940 }
40941 if (j == 0)
40942 {
40943 num23 -= 2;
40944 }
40945 if (j == 1)
40946 {
40947 num23 += 2;
40948 }
40949 if (j == 2)
40950 {
40951 num24 -= 2;
40952 }
40953 if (j == 3)
40954 {
40955 num24 += 2;
40956 }
40957 if (j == 4)
40958 {
40959 color3 = color;
40960 }
40962 }
40964 {
40965 if (npcChatFocus1)
40966 {
40967 if (player[myPlayer].BuyItem(num11))
40968 {
40969 BuyHairWindow();
40970 return;
40971 }
40972 }
40973 else if (npcChatFocus2)
40974 {
40976 return;
40977 }
40978 }
40979 if (!mouseLeft)
40980 {
40981 grabColorSlider = 0;
40982 blockMouse = false;
40983 }
40984 int num25 = 167;
40986 float num26 = vector2.X;
40987 float num27 = vector2.Y;
40988 float z = vector2.Z;
40989 float num28 = (float)(int)selColor.A / 255f;
40990 if (hBar == -1f || sBar == -1f || lBar == -1f || aBar == -1f)
40991 {
40992 hBar = num26;
40993 sBar = num27;
40994 lBar = z;
40995 aBar = (float)(int)selColor.A / 255f;
40996 }
40997 else
40998 {
40999 num26 = hBar;
41000 num27 = sBar;
41001 z = lBar;
41002 aBar = num28;
41003 }
41004 UILinkPointNavigator.SetPosition(2600, new Vector2(num4, num3) + TextureAssets.Hue.Value.Size() / 2f);
41006 if ((mouseX > num4 - 4 && mouseX < num4 + TextureAssets.Hue.Width() + 4 && mouseY > num3 - 4 && mouseY < num3 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 1)
41007 {
41009 }
41010 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num4 + (float)(TextureAssets.Hue.Width() - 2) * hBar - (float)(TextureAssets.ColorSlider.Width() / 2), num3 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41011 if (((mouseX > num4 - 4 && mouseX < num4 + TextureAssets.Hue.Width() + 4 && mouseY > num3 - 4 && mouseY < num3 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 1) && mouseLeft && !blockMouse)
41012 {
41013 grabColorSlider = 1;
41014 num26 = mouseX - num4;
41015 num26 /= (float)TextureAssets.Hue.Width();
41016 if (num26 < 0f)
41017 {
41018 num26 = 0f;
41019 }
41020 if (num26 > 1f)
41021 {
41022 num26 = 1f;
41023 }
41024 hBar = num26;
41025 }
41026 num3 += 26;
41027 UILinkPointNavigator.SetPosition(2601, new Vector2(num4, num3) + TextureAssets.ColorBar.Value.Size() / 2f);
41029 for (int k = 0; k <= num25; k++)
41030 {
41031 float saturation = (float)k / (float)num25;
41033 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num4 + k + 5, num3 + 4), color4);
41034 }
41035 if ((mouseX > num4 - 4 && mouseX < num4 + TextureAssets.Hue.Width() + 4 && mouseY > num3 - 4 && mouseY < num3 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 2)
41036 {
41038 }
41039 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num4 + (float)(TextureAssets.Hue.Width() - 2) * sBar - (float)(TextureAssets.ColorSlider.Width() / 2), num3 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41040 if (((mouseX > num4 - 4 && mouseX < num4 + TextureAssets.Hue.Width() + 4 && mouseY > num3 - 4 && mouseY < num3 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 2) && mouseLeft && !blockMouse)
41041 {
41042 grabColorSlider = 2;
41043 num27 = mouseX - num4;
41044 num27 /= (float)TextureAssets.Hue.Width();
41045 if (num27 < 0f)
41046 {
41047 num27 = 0f;
41048 }
41049 if (num27 > 1f)
41050 {
41051 num27 = 1f;
41052 }
41053 sBar = num27;
41054 }
41055 num3 += 26;
41056 UILinkPointNavigator.SetPosition(2602, new Vector2(num4, num3) + TextureAssets.ColorBar.Value.Size() / 2f);
41058 float num29 = 0.15f;
41059 for (int l = 0; l <= num25; l++)
41060 {
41061 float luminosity = (float)l / (float)num25;
41063 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num4 + l + 5, num3 + 4), color5);
41064 }
41065 if ((mouseX > num4 - 4 && mouseX < num4 + TextureAssets.Hue.Width() + 4 && mouseY > num3 - 4 && mouseY < num3 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 3)
41066 {
41068 }
41069 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num4 + (float)(TextureAssets.Hue.Width() - 2) * ((lBar - num29) / (1f - num29)) - (float)(TextureAssets.ColorSlider.Width() / 2), num3 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41070 if (((mouseX > num4 - 4 && mouseX < num4 + TextureAssets.Hue.Width() + 4 && mouseY > num3 - 4 && mouseY < num3 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 3) && mouseLeft && !blockMouse)
41071 {
41072 grabColorSlider = 3;
41073 z = mouseX - num4;
41074 z /= (float)TextureAssets.Hue.Width();
41075 if (z < 0f)
41076 {
41077 z = 0f;
41078 }
41079 if (z > 1f)
41080 {
41081 z = 1f;
41082 }
41083 z = z * (1f - num29) + num29;
41084 lBar = z;
41085 }
41087 player[myPlayer].hairColor = selColor;
41088 int num30 = num5;
41089 int num31 = num6;
41090 _ = hairStart;
41091 int num32 = 0;
41092 int num33 = 0;
41093 for (int m = 0; m < 15; m++)
41094 {
41095 int num34 = Hairstyles.AvailableHairstyles[hairStart + m];
41096 UILinkPointNavigator.SetPosition(2605 + m, new Vector2(num30, num31) + TextureAssets.InventoryBack.Value.Size() * 0.75f);
41097 if (player[myPlayer].hair == num34)
41098 {
41099 spriteBatch.Draw(TextureAssets.InventoryBack14.Value, new Vector2(num30, num31), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41100 }
41101 else
41102 {
41103 spriteBatch.Draw(TextureAssets.InventoryBack8.Value, new Vector2(num30, num31), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41104 }
41106 {
41107 Asset<Texture2D> val = Assets.Request<Texture2D>("Images/UI/PanelBorder", (AssetRequestMode)1);
41108 Utils.DrawSplicedPanel(spriteBatch, val.Value, num30, num31, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height(), val.Width() / 2 - 1, val.Width() / 2 - 1, val.Height() / 2 - 1, val.Height() / 2 - 1, OurFavoriteColor);
41110 {
41111 mouseLeftRelease = false;
41112 player[myPlayer].hair = num34;
41114 }
41115 }
41116 LoadHair(num34);
41117 float x = num30 + TextureAssets.InventoryBack.Width() / 2 - TextureAssets.PlayerHair[num34].Width() / 2;
41118 float y = num31 + 4;
41119 spriteBatch.Draw(TextureAssets.Players[num32, 0].Value, new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PlayerHair[num34].Width(), 56), player[myPlayer].skinColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41120 spriteBatch.Draw(TextureAssets.Players[num32, 1].Value, new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PlayerHair[num34].Width(), 56), new Microsoft.Xna.Framework.Color(255, 255, 255, 255), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41121 spriteBatch.Draw(TextureAssets.Players[num32, 2].Value, new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PlayerHair[num34].Width(), 56), player[myPlayer].eyeColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41122 Vector2 vector3 = player[myPlayer].GetHairDrawOffset(num34, hatHair: false) * player[myPlayer].Directions;
41123 spriteBatch.Draw(TextureAssets.PlayerHair[num34].Value, new Vector2(x, y) + vector3, new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PlayerHair[num34].Width(), 56), selColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41124 num33++;
41125 num30 += 56;
41126 if (num33 >= 5)
41127 {
41128 num33 = 0;
41129 num30 = num5;
41130 num31 += 56;
41131 }
41132 }
41133 }
41134
41135 public static void OpenClothesWindow()
41136 {
41137 if (clothesWindow)
41138 {
41140 return;
41141 }
41142 hBar = -1f;
41143 lBar = -1f;
41144 sBar = -1f;
41145 playerInventory = false;
41146 npcChatText = "";
41147 clothesWindow = true;
41149 selClothes = 0;
41150 oldClothesColor[0] = player[myPlayer].shirtColor;
41151 oldClothesColor[1] = player[myPlayer].underShirtColor;
41152 oldClothesColor[2] = player[myPlayer].pantsColor;
41153 oldClothesColor[3] = player[myPlayer].shoeColor;
41154 oldClothesColor[4] = player[myPlayer].eyeColor;
41155 oldClothesColor[5] = player[myPlayer].skinColor;
41156 if (dresserInterfaceDummy == null)
41157 {
41159 }
41160 oldClothesStyle = player[myPlayer].skinVariant;
41161 }
41162
41163 public static void CancelClothesWindow(bool quiet = false)
41164 {
41165 if (clothesWindow)
41166 {
41167 clothesWindow = false;
41168 if (!quiet)
41169 {
41171 }
41172 player[myPlayer].shirtColor = oldClothesColor[0];
41173 player[myPlayer].underShirtColor = oldClothesColor[1];
41174 player[myPlayer].pantsColor = oldClothesColor[2];
41175 player[myPlayer].shoeColor = oldClothesColor[3];
41176 player[myPlayer].eyeColor = oldClothesColor[4];
41177 player[myPlayer].skinColor = oldClothesColor[5];
41178 dresserInterfaceDummy.skinVariant = oldClothesStyle;
41179 dresserInterfaceDummy.Male = player[myPlayer].Male;
41180 player[myPlayer].skinVariant = dresserInterfaceDummy.skinVariant;
41181 }
41182 }
41183
41184 public static void SaveClothesWindow()
41185 {
41187 clothesWindow = false;
41188 NetMessage.SendData(4, -1, -1, null, myPlayer);
41189 }
41190
41191 protected void DrawClothesWindow()
41192 {
41193 if (npcChatText != "" || playerInventory || player[myPlayer].chest != -1 || npcShop != 0 || player[myPlayer].talkNPC != -1 || InGuideCraftMenu)
41194 {
41196 return;
41197 }
41199 {
41201 return;
41202 }
41203 int num = 477;
41204 int num2 = num / 2;
41205 num2 = 180;
41206 num = 511;
41207 num -= num / 2 - num2 - 26;
41208 int num3 = screenHeight / 2 + 60;
41209 int num4 = screenWidth / 2 - num / 2;
41210 int num5 = num3 + 32;
41211 int num6 = num4 + 22;
41212 num5 -= 16;
41213 int num7 = num4 + num - num2;
41214 int num8 = num3 + 18;
41215 if (selClothes == 0)
41216 {
41217 selColor = player[myPlayer].shirtColor;
41218 }
41219 if (selClothes == 1)
41220 {
41221 selColor = player[myPlayer].underShirtColor;
41222 }
41223 if (selClothes == 2)
41224 {
41225 selColor = player[myPlayer].pantsColor;
41226 }
41227 if (selClothes == 3)
41228 {
41229 selColor = player[myPlayer].shoeColor;
41230 }
41231 if (selClothes == 4)
41232 {
41233 selColor = player[myPlayer].eyeColor;
41234 }
41235 if (selClothes == 5)
41236 {
41237 selColor = player[myPlayer].skinColor;
41238 }
41241 {
41242 player[myPlayer].mouseInterface = true;
41243 }
41244 Vector2 vector = new Vector2(num4 + num / 2 - 16 - 28, num3 + 66 + dresserInterfaceDummy.height / 2 - 20);
41245 vector.Y += 18f;
41246 vector.X += 58f;
41248 bool flag = r.Contains(MouseScreen.ToPoint());
41249 int num9 = selClothes;
41250 int num10 = (mouseTextColor * 2 + 255) / 3;
41251 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(num10, (int)((double)num10 / 1.1), num10 / 2, num10);
41252 float num11 = 0.9f;
41253 string textValue = Language.GetTextValue("GameUI.Change");
41254 int num12 = num4 + num - num2 + 22;
41255 num12 = num4 + 22;
41256 int num13 = num3 + 94;
41257 bool flag2 = false;
41258 if (oldClothesColor[0] != player[myPlayer].shirtColor || oldClothesColor[1] != player[myPlayer].underShirtColor || oldClothesColor[2] != player[myPlayer].pantsColor || oldClothesColor[3] != player[myPlayer].shoeColor || oldClothesColor[4] != player[myPlayer].eyeColor || oldClothesColor[5] != player[myPlayer].skinColor || oldClothesStyle != player[myPlayer].skinVariant)
41259 {
41260 flag2 = true;
41261 }
41262 Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(textValue);
41263 bool flag3 = false;
41265 if (flag2 && mouseX > num12 && (float)mouseX < (float)num12 + vector2.X && mouseY > num13 && (float)mouseY < (float)num13 + vector2.Y)
41266 {
41267 flag3 = true;
41268 num11 = 1.1f;
41269 if (!npcChatFocus1)
41270 {
41272 }
41273 npcChatFocus1 = true;
41274 player[myPlayer].releaseUseItem = false;
41275 }
41276 else
41277 {
41278 if (npcChatFocus1)
41279 {
41281 }
41282 npcChatFocus1 = false;
41283 }
41284 for (int i = 0; i < 5; i++)
41285 {
41286 int num14 = num12;
41287 int num15 = num13;
41289 if (flag3)
41290 {
41292 }
41293 if (i == 0)
41294 {
41295 num14 -= 2;
41296 }
41297 if (i == 1)
41298 {
41299 num14 += 2;
41300 }
41301 if (i == 2)
41302 {
41303 num15 -= 2;
41304 }
41305 if (i == 3)
41306 {
41307 num15 += 2;
41308 }
41309 if (i == 4)
41310 {
41311 color2 = (flag2 ? color : new Microsoft.Xna.Framework.Color(100, 100, 100));
41312 }
41313 Vector2 vector3 = FontAssets.MouseText.Value.MeasureString(textValue);
41314 vector3 *= 0.5f;
41316 }
41317 num11 = 0.9f;
41318 string textValue2 = Language.GetTextValue("GameUI.Cancel");
41319 num12 += 130;
41320 bool flag4 = false;
41321 vector2 = FontAssets.MouseText.Value.MeasureString(textValue2);
41323 if (mouseX > num12 && (float)mouseX < (float)num12 + vector2.X && mouseY > num13 && (float)mouseY < (float)num13 + vector2.Y)
41324 {
41325 flag4 = true;
41326 num11 = 1.1f;
41327 if (!npcChatFocus2)
41328 {
41330 }
41331 npcChatFocus2 = true;
41332 player[myPlayer].releaseUseItem = false;
41333 }
41334 else
41335 {
41336 if (npcChatFocus2)
41337 {
41339 }
41340 npcChatFocus2 = false;
41341 }
41342 for (int j = 0; j < 5; j++)
41343 {
41344 int num16 = num12;
41345 int num17 = num13;
41347 if (flag4)
41348 {
41350 }
41351 if (j == 0)
41352 {
41353 num16 -= 2;
41354 }
41355 if (j == 1)
41356 {
41357 num16 += 2;
41358 }
41359 if (j == 2)
41360 {
41361 num17 -= 2;
41362 }
41363 if (j == 3)
41364 {
41365 num17 += 2;
41366 }
41367 if (j == 4)
41368 {
41369 color3 = color;
41370 }
41371 Vector2 vector4 = FontAssets.MouseText.Value.MeasureString(textValue2);
41372 vector4 *= 0.5f;
41374 }
41376 {
41377 if (npcChatFocus1)
41378 {
41380 return;
41381 }
41382 if (npcChatFocus2)
41383 {
41385 return;
41386 }
41387 }
41388 if (!mouseLeft)
41389 {
41390 grabColorSlider = 0;
41391 blockMouse = false;
41392 }
41393 int num18 = 167;
41395 float num19 = vector5.X;
41396 float num20 = vector5.Y;
41397 float z = vector5.Z;
41398 if (hBar == -1f || sBar == -1f || lBar == -1f)
41399 {
41400 hBar = num19;
41401 sBar = num20;
41402 lBar = z;
41403 }
41404 else
41405 {
41406 num19 = hBar;
41407 num20 = sBar;
41408 z = lBar;
41409 }
41411 if ((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 1)
41412 {
41414 }
41415 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num6 + (float)(TextureAssets.Hue.Width() - 2) * hBar - (float)(TextureAssets.ColorSlider.Width() / 2), num5 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41416 if (((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 1) && mouseLeft && !blockMouse)
41417 {
41418 grabColorSlider = 1;
41419 num19 = mouseX - num6;
41420 num19 /= (float)TextureAssets.Hue.Width();
41421 if (num19 < 0f)
41422 {
41423 num19 = 0f;
41424 }
41425 if (num19 > 1f)
41426 {
41427 num19 = 1f;
41428 }
41429 hBar = num19;
41430 }
41431 UILinkPointNavigator.SetPosition(2800, new Vector2(num6, num5) + TextureAssets.Hue.Value.Size() / 2f);
41432 num5 += 26;
41434 for (int k = 0; k <= num18; k++)
41435 {
41436 float saturation = (float)k / (float)num18;
41438 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num6 + k + 5, num5 + 4), color4);
41439 }
41440 if ((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 2)
41441 {
41443 }
41444 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num6 + (float)(TextureAssets.Hue.Width() - 2) * sBar - (float)(TextureAssets.ColorSlider.Width() / 2), num5 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41445 if (((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 2) && mouseLeft && !blockMouse)
41446 {
41447 grabColorSlider = 2;
41448 num20 = mouseX - num6;
41449 num20 /= (float)TextureAssets.Hue.Width();
41450 if (num20 < 0f)
41451 {
41452 num20 = 0f;
41453 }
41454 if (num20 > 1f)
41455 {
41456 num20 = 1f;
41457 }
41458 sBar = num20;
41459 }
41460 UILinkPointNavigator.SetPosition(2801, new Vector2(num6, num5) + TextureAssets.Hue.Value.Size() / 2f);
41461 num5 += 26;
41463 float num21 = 0.15f;
41464 for (int l = 0; l <= num18; l++)
41465 {
41466 float luminosity = (float)l / (float)num18;
41468 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num6 + l + 5, num5 + 4), color5);
41469 }
41470 if ((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 3)
41471 {
41473 }
41474 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num6 + (float)(TextureAssets.Hue.Width() - 2) * ((lBar - num21) / (1f - num21)) - (float)(TextureAssets.ColorSlider.Width() / 2), num5 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
41475 if (((mouseX > num6 - 4 && mouseX < num6 + TextureAssets.Hue.Width() + 4 && mouseY > num5 - 4 && mouseY < num5 + TextureAssets.Hue.Height() + 4) || grabColorSlider == 3) && mouseLeft && !blockMouse)
41476 {
41477 grabColorSlider = 3;
41478 z = mouseX - num6;
41479 z /= (float)TextureAssets.Hue.Width();
41480 if (z < 0f)
41481 {
41482 z = 0f;
41483 }
41484 if (z > 1f)
41485 {
41486 z = 1f;
41487 }
41488 z = z * (1f - num21) + num21;
41489 lBar = z;
41490 }
41491 UILinkPointNavigator.SetPosition(2802, new Vector2(num6, num5) + TextureAssets.Hue.Value.Size() / 2f);
41493 if (selClothes == 0)
41494 {
41495 player[myPlayer].shirtColor = selColor;
41496 }
41497 if (selClothes == 1)
41498 {
41499 player[myPlayer].underShirtColor = selColor;
41500 }
41501 if (selClothes == 2)
41502 {
41503 player[myPlayer].pantsColor = selColor;
41504 }
41505 if (selClothes == 3)
41506 {
41507 player[myPlayer].shoeColor = selColor;
41508 }
41509 if (selClothes == 4)
41510 {
41511 player[myPlayer].eyeColor = selColor;
41512 }
41513 if (selClothes == 5)
41514 {
41515 player[myPlayer].skinColor = selColor;
41516 }
41517 int num22 = num7;
41518 int num23 = num8;
41519 num23 -= 8;
41520 for (int m = 0; m < 6; m++)
41521 {
41522 if (num9 == m)
41523 {
41524 spriteBatch.Draw(TextureAssets.InventoryBack14.Value, new Vector2(num22, num23), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41525 }
41526 else
41527 {
41528 spriteBatch.Draw(TextureAssets.InventoryBack8.Value, new Vector2(num22, num23), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height()), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41529 }
41531 {
41532 mouseLeftRelease = false;
41533 selClothes = m;
41535 hBar = -1f;
41536 lBar = -1f;
41537 sBar = -1f;
41538 }
41539 float x = num22 + TextureAssets.InventoryBack.Width() / 2 - TextureAssets.Clothes[m].Width() / 2;
41540 float y = num23 + TextureAssets.InventoryBack.Height() / 2 - TextureAssets.Clothes[m].Height() / 2;
41542 if (m == 0)
41543 {
41544 color6 = player[myPlayer].shirtColor;
41545 }
41546 if (m == 1)
41547 {
41548 color6 = player[myPlayer].underShirtColor;
41549 }
41550 if (m == 2)
41551 {
41552 color6 = player[myPlayer].pantsColor;
41553 }
41554 if (m == 3)
41555 {
41556 color6 = player[myPlayer].shoeColor;
41557 }
41558 if (m == 4)
41559 {
41560 color6 = player[myPlayer].eyeColor;
41561 }
41562 if (m == 5)
41563 {
41564 color6 = player[myPlayer].skinColor;
41565 }
41566 spriteBatch.Draw(TextureAssets.Clothes[m].Value, new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Clothes[m].Width(), TextureAssets.Clothes[m].Height()), color6, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41567 if (m == 4)
41568 {
41569 Texture2D value = Assets.Request<Texture2D>("Images/UI/CharCreation/ColorEyeBack", (AssetRequestMode)1).Value;
41570 spriteBatch.Draw(value, new Vector2(x, y), value.Frame(), Microsoft.Xna.Framework.Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
41571 }
41572 UILinkPointNavigator.SetPosition(2806 + m, new Vector2(x, y) + TextureAssets.Clothes[m].Value.Size() * 0.75f);
41573 num22 += 56;
41574 if (m == 1)
41575 {
41576 num22 -= 112;
41577 num23 += 56;
41578 }
41579 if (m == 3)
41580 {
41581 num23 -= 56;
41582 }
41583 if (m == 4)
41584 {
41585 num23 += 56;
41586 num22 -= 56;
41587 }
41588 }
41589 dresserInterfaceDummy.skinVariant = player[myPlayer].skinVariant;
41590 dresserInterfaceDummy.eyeColor = player[myPlayer].eyeColor;
41591 dresserInterfaceDummy.hairColor = player[myPlayer].hairColor;
41592 dresserInterfaceDummy.hair = player[myPlayer].hair;
41593 dresserInterfaceDummy.skinColor = player[myPlayer].skinColor;
41594 dresserInterfaceDummy.shirtColor = player[myPlayer].shirtColor;
41595 dresserInterfaceDummy.underShirtColor = player[myPlayer].underShirtColor;
41596 dresserInterfaceDummy.shoeColor = player[myPlayer].shoeColor;
41597 dresserInterfaceDummy.pantsColor = player[myPlayer].pantsColor;
41598 dresserInterfaceDummy.Bottom = screenPosition + vector;
41599 dresserInterfaceDummy.direction = -1;
41600 dresserInterfaceDummy.gravDir = 1f;
41601 dresserInterfaceDummy.PlayerFrame();
41602 dresserInterfaceDummy.socialIgnoreLight = true;
41603 Microsoft.Xna.Framework.Color c = new Microsoft.Xna.Framework.Color(46, 106, 98) * 0.6f;
41604 if (flag)
41605 {
41606 c = new Microsoft.Xna.Framework.Color(46, 106, 98) * 2f * 0.6f;
41608 {
41609 mouseLeftRelease = false;
41612 }
41613 }
41614 UILinkPointNavigator.SetPosition(2805, r.Center.ToVector2());
41616 spriteBatch.End();
41617 spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, UIScaleMatrix);
41619 }
41620
41621 private void DrawInterface_Tests()
41622 {
41623 }
41624
41626 {
41628 {
41632 {
41633 new LegacyGameInterfaceLayer("Vanilla: Interface Logic 1", delegate
41634 {
41636 return true;
41637 }),
41638 new LegacyGameInterfaceLayer("Vanilla: MP Player Names", delegate
41639 {
41641 return true;
41642 }),
41643 new LegacyGameInterfaceLayer("Vanilla: Emote Bubbles", delegate
41644 {
41646 return true;
41647 }),
41648 new LegacyGameInterfaceLayer("Vanilla: Entity Markers", delegate
41649 {
41651 return true;
41652 }),
41653 new LegacyGameInterfaceLayer("Vanilla: Smart Cursor Targets", delegate
41654 {
41656 return true;
41657 }),
41658 new LegacyGameInterfaceLayer("Vanilla: Laser Ruler", delegate
41659 {
41661 return true;
41662 }),
41663 new LegacyGameInterfaceLayer("Vanilla: Ruler", delegate
41664 {
41666 return true;
41667 }),
41668 new LegacyGameInterfaceLayer("Vanilla: Gamepad Lock On", delegate
41669 {
41671 return true;
41672 }),
41673 new LegacyGameInterfaceLayer("Vanilla: Tile Grid Option", delegate
41674 {
41676 return true;
41677 }),
41678 new LegacyGameInterfaceLayer("Vanilla: Town NPC House Banners", delegate
41679 {
41681 return true;
41682 }),
41684 new LegacyGameInterfaceLayer("Vanilla: Wire Selection", delegate
41685 {
41687 return true;
41688 }, InterfaceScaleType.UI),
41689 new LegacyGameInterfaceLayer("Vanilla: Capture Manager Check", DrawInterface_10_CheckCaptureManager),
41692 new LegacyGameInterfaceLayer("Vanilla: Achievement Complete Popups", delegate
41693 {
41695 return true;
41696 }, InterfaceScaleType.UI),
41697 new LegacyGameInterfaceLayer("Vanilla: Entity Health Bars", delegate
41698 {
41700 return true;
41701 }),
41702 new LegacyGameInterfaceLayer("Vanilla: Invasion Progress Bars", delegate
41703 {
41705 return true;
41706 }, InterfaceScaleType.UI),
41707 new LegacyGameInterfaceLayer("Vanilla: Map / Minimap", delegate
41708 {
41710 return true;
41711 }, InterfaceScaleType.UI),
41712 new LegacyGameInterfaceLayer("Vanilla: Diagnose Net", delegate
41713 {
41715 return true;
41716 }, InterfaceScaleType.UI),
41717 new LegacyGameInterfaceLayer("Vanilla: Diagnose Video", delegate
41718 {
41720 return true;
41721 }, InterfaceScaleType.UI),
41722 new LegacyGameInterfaceLayer("Vanilla: Sign Tile Bubble", delegate
41723 {
41725 return true;
41726 }),
41727 new LegacyGameInterfaceLayer("Vanilla: Hair Window", delegate
41728 {
41730 return true;
41731 }, InterfaceScaleType.UI),
41732 new LegacyGameInterfaceLayer("Vanilla: Dresser Window", delegate
41733 {
41735 return true;
41736 }, InterfaceScaleType.UI),
41737 new LegacyGameInterfaceLayer("Vanilla: NPC / Sign Dialog", delegate
41738 {
41740 return true;
41741 }, InterfaceScaleType.UI),
41742 new LegacyGameInterfaceLayer("Vanilla: Interface Logic 2", delegate
41743 {
41745 return true;
41746 }),
41747 new LegacyGameInterfaceLayer("Vanilla: Resource Bars", delegate
41748 {
41750 return true;
41751 }, InterfaceScaleType.UI),
41752 new LegacyGameInterfaceLayer("Vanilla: Interface Logic 3", delegate
41753 {
41755 return true;
41756 }),
41757 new LegacyGameInterfaceLayer("Vanilla: Inventory", delegate
41758 {
41760 return true;
41761 }, InterfaceScaleType.UI),
41762 new LegacyGameInterfaceLayer("Vanilla: Info Accessories Bar", delegate
41763 {
41765 return true;
41766 }, InterfaceScaleType.UI),
41767 new LegacyGameInterfaceLayer("Vanilla: Settings Button", delegate
41768 {
41770 return true;
41771 }, InterfaceScaleType.UI),
41772 new LegacyGameInterfaceLayer("Vanilla: Hotbar", delegate
41773 {
41775 return true;
41776 }, InterfaceScaleType.UI),
41777 new LegacyGameInterfaceLayer("Vanilla: Builder Accessories Bar", delegate
41778 {
41780 return true;
41781 }, InterfaceScaleType.UI),
41782 new LegacyGameInterfaceLayer("Vanilla: Radial Hotbars", delegate
41783 {
41785 return true;
41786 }, InterfaceScaleType.UI),
41787 new LegacyGameInterfaceLayer("Vanilla: Mouse Text", delegate
41788 {
41790 return true;
41791 }, InterfaceScaleType.UI),
41792 new LegacyGameInterfaceLayer("Vanilla: Player Chat", delegate
41793 {
41795 return true;
41796 }, InterfaceScaleType.UI),
41797 new LegacyGameInterfaceLayer("Vanilla: Death Text", delegate
41798 {
41800 return true;
41801 }, InterfaceScaleType.UI),
41802 new LegacyGameInterfaceLayer("Vanilla: Cursor", delegate
41803 {
41805 return true;
41806 }, InterfaceScaleType.UI),
41807 new LegacyGameInterfaceLayer("Vanilla: Debug Stuff", delegate
41808 {
41810 return true;
41811 }, InterfaceScaleType.UI),
41812 new LegacyGameInterfaceLayer("Vanilla: Mouse Item / NPC Head", delegate
41813 {
41815 return true;
41816 }, InterfaceScaleType.UI),
41817 new LegacyGameInterfaceLayer("Vanilla: Mouse Over", delegate
41818 {
41820 return true;
41821 }),
41822 new LegacyGameInterfaceLayer("Vanilla: Interact Item Icon", delegate
41823 {
41825 return true;
41826 }, InterfaceScaleType.UI),
41827 new LegacyGameInterfaceLayer("Vanilla: Interface Logic 4", delegate
41828 {
41830 return true;
41831 }, InterfaceScaleType.UI)
41832 });
41833 }
41834 }
41835
41837 {
41840 {
41842 }
41845 {
41846 while (enumerator.MoveNext() && enumerator.Current.Draw())
41847 {
41848 }
41849 }
41851 }
41852
41853 private static void DrawWallOfCopperShortswords()
41854 {
41855 UnifiedRandom r = new UnifiedRandom(5000);
41856 Texture2D value = TextureAssets.Cloud[28].Value;
41857 Vector2 vector = ScreenSize.ToVector2();
41858 spriteBatch.Begin();
41859 for (int i = 0; i < 20000; i++)
41860 {
41861 Vector2 vector2 = r.NextVector2Square(-0.1f, 1.1f);
41862 vector2.X -= 0.1f;
41863 vector2.X += GlobalTimeWrappedHourly % 10f / 10f * 1.2f;
41864 vector2.Y -= GlobalTimeWrappedHourly % 10f / 10f;
41865 if (vector2.Y < -0.2f)
41866 {
41867 vector2.Y += 1.4f;
41868 }
41869 if (vector2.X > 1.1f)
41870 {
41871 vector2.X -= 1.2f;
41872 }
41873 Vector2 position = vector2 * vector;
41875 }
41876 spriteBatch.End();
41877 }
41878
41879 private static void DrawWallOfBoulders()
41880 {
41881 UnifiedRandom r = new UnifiedRandom(5000);
41882 instance.LoadProjectile(99);
41884 Vector2 vector = ScreenSize.ToVector2();
41885 spriteBatch.Begin();
41886 for (int i = 0; i < 20000; i++)
41887 {
41888 Vector2 vector2 = r.NextVector2Square(-0.1f, 1.1f);
41889 vector2.X *= 0.1f;
41890 vector2.X -= 0.1f;
41891 vector2.X += GlobalTimeWrappedHourly % 10f / 10f * 1.2f;
41892 vector2.Y -= GlobalTimeWrappedHourly % 10f / 10f;
41893 if (vector2.Y < -0.2f)
41894 {
41895 vector2.Y += 1.4f;
41896 }
41897 if (vector2.X > 1.1f)
41898 {
41899 vector2.X -= 1.2f;
41900 }
41901 Vector2 position = vector2 * vector;
41903 }
41904 spriteBatch.End();
41905 }
41906
41908 {
41909 if (mouseRight)
41910 {
41911 npcChatRelease = false;
41912 }
41913 else
41914 {
41915 npcChatRelease = true;
41916 }
41917 _MouseOversCanClear = true;
41919 cursorOverride = -1;
41920 }
41921
41922 private static void DrawPendingMouseText()
41923 {
41925 if (instance._mouseTextCache.isValid)
41926 {
41927 instance.MouseTextInner(instance._mouseTextCache);
41929 instance._mouseTextCache.isValid = false;
41930 instance._mouseTextCache.noOverride = false;
41931 }
41932 }
41933
41935 {
41936 if (HoveringOverAnNPC || LocalPlayer.mouseInterface)
41937 {
41938 return;
41939 }
41940 Item item = player[myPlayer].inventory[player[myPlayer].selectedItem];
41941 int num = item.type;
41942 if (player[myPlayer].UsingBiomeTorches)
41943 {
41944 switch (num)
41945 {
41946 case 8:
41947 num = player[myPlayer].BiomeTorchHoldStyle(num);
41948 break;
41949 case 966:
41950 num = player[myPlayer].BiomeCampfireHoldStyle(num);
41951 break;
41952 }
41953 }
41954 if (player[myPlayer].cursorItemIconID != 0)
41955 {
41956 num = player[myPlayer].cursorItemIconID;
41957 }
41958 bool flag = player[myPlayer].cursorItemIconEnabled && (player[myPlayer].inventory[player[myPlayer].selectedItem].type > 0 || player[myPlayer].cursorItemIconID != 0);
41960 bool flag2 = _itemIconCacheTime > 0 && mouseItem.type < 1;
41961 if (!(flag || flag2))
41962 {
41963 return;
41964 }
41966 if (!flag)
41967 {
41968 Utils.Swap(ref t, ref player[myPlayer].cursorItemIconID);
41969 }
41971 Microsoft.Xna.Framework.Color color = player[myPlayer].inventory[player[myPlayer].selectedItem].GetColor(Microsoft.Xna.Framework.Color.White);
41972 if (player[myPlayer].cursorItemIconID != 0)
41973 {
41975 color = default(Microsoft.Xna.Framework.Color);
41976 }
41977 if (player[myPlayer].cursorItemIconID == 269)
41978 {
41979 currentColor = player[myPlayer].shirtColor;
41980 }
41981 float num2 = 1f;
41982 num2 = cursorScale;
41984 SpriteEffects effects = SpriteEffects.None;
41985 if (player[myPlayer].cursorItemIconReversed)
41986 {
41987 effects = SpriteEffects.FlipHorizontally;
41988 }
41989 if (num > 0)
41990 {
41991 int num3 = 10 + player[myPlayer].cursorItemIconPush;
41992 instance.LoadItem(num);
41993 spriteBatch.Draw(TextureAssets.Item[num].Value, new Vector2(mouseX + num3, mouseY + num3), Item.GetDrawHitbox(num, null), currentColor, 0f, default(Vector2), num2, effects, 0f);
41995 {
41996 float scale = num2 * ammoScale;
41997 int type = ammoItem.type;
41999 instance.LoadItem(type);
42000 spriteBatch.Draw(TextureAssets.Item[type].Value, new Vector2(mouseX + 10, mouseY + 10) + ammoOffset, Item.GetDrawHitbox(type, null), alpha, 0f, default(Vector2), scale, effects, 0f);
42001 }
42002 }
42003 if (player[myPlayer].cursorItemIconText != "")
42004 {
42005 MouseText(player[myPlayer].cursorItemIconText, 0, 0);
42006 }
42007 if (player[myPlayer].cursorItemIconID == 0 && player[myPlayer].inventory[player[myPlayer].selectedItem].color != default(Microsoft.Xna.Framework.Color))
42008 {
42009 instance.LoadItem(player[myPlayer].inventory[player[myPlayer].selectedItem].type);
42010 spriteBatch.Draw(TextureAssets.Item[player[myPlayer].inventory[player[myPlayer].selectedItem].type].Value, new Vector2(mouseX + 10, mouseY + 10), Item.GetDrawHitbox(player[myPlayer].inventory[player[myPlayer].selectedItem].type, null), color, 0f, default(Vector2), num2, SpriteEffects.None, 0f);
42011 }
42012 if (!flag)
42013 {
42014 Utils.Swap(ref t, ref player[myPlayer].cursorItemIconID);
42015 }
42016 }
42017
42019 {
42020 ammoItem = null;
42022 ammoScale = 0.8f;
42024 int type = sourceItem.type;
42025 if (type == 1071 || type == 1543 || type == 1072 || type == 1544)
42026 {
42027 int num = 22;
42028 int num2 = 22;
42029 if (type == 1072 || type == 1544)
42030 {
42031 num = 28;
42032 num2 = 28;
42033 }
42034 ammoOffset = new Vector2(num, num2);
42035 ammoItem = player[myPlayer].FindPaintOrCoating();
42036 return ammoItem != null;
42037 }
42038 FlexibleTileWand flexibleTileWand = sourceItem.GetFlexibleTileWand();
42040 {
42041 ammoOffset = new Vector2(28f, 28f);
42042 return true;
42043 }
42044 return false;
42045 }
42046
42048 {
42049 if (ignoreErrors)
42050 {
42051 try
42052 {
42053 DrawMouseOver();
42054 return;
42055 }
42056 catch (Exception e)
42057 {
42059 return;
42060 }
42061 }
42062 DrawMouseOver();
42063 }
42064
42066 {
42067 if (mouseItem.type > 0 && mouseItem.stack > 0)
42068 {
42069 SetMouseNPC(-1, -1);
42070 player[myPlayer].cursorItemIconEnabled = false;
42071 player[myPlayer].cursorItemIconID = 0;
42072 mouseText = true;
42073 float num = inventoryScale;
42076 inventoryScale = num;
42077 }
42078 else
42079 {
42080 if (mouseNPCType <= -1)
42081 {
42082 return;
42083 }
42084 float num2 = 1f;
42085 num2 *= cursorScale;
42086 if (mouseNPCIndex >= 0)
42087 {
42089 if (!nPC.active || nPC.type != mouseNPCType)
42090 {
42092 }
42093 }
42094 int type = mouseNPCType;
42097 spriteBatch.Draw(value, new Vector2((float)mouseX + 26f * num2 - (float)value.Width * 0.5f * num2, (float)mouseY + 26f * num2 - (float)value.Height * 0.5f * num2), null, Microsoft.Xna.Framework.Color.White, 0f, default(Vector2), num2, SpriteEffects.None, 0f);
42099 {
42100 return;
42101 }
42102 player[myPlayer].mouseInterface = true;
42103 mouseText = false;
42105 {
42107 SetMouseNPC(-1, -1);
42108 }
42109 if (!mouseLeft || !mouseLeftRelease)
42110 {
42111 return;
42112 }
42113 if (mouseNPCType == 0)
42114 {
42117 int x = (int)(((float)mouseX + screenPosition.X) / 16f);
42118 int y = (int)(((float)mouseY + screenPosition.Y) / 16f);
42119 if (player[myPlayer].gravDir == -1f)
42120 {
42121 y = (int)((screenPosition.Y + (float)screenHeight - (float)mouseY) / 16f);
42122 }
42124 int n = -1;
42125 if (WorldGen.MoveTownNPC(x, y, n))
42126 {
42127 NewText(Lang.inter[39].Value, byte.MaxValue, 240, 20);
42128 }
42129 return;
42130 }
42131 int num4 = mouseNPCIndex;
42132 if (num4 >= 0)
42133 {
42136 int x2 = (int)(((float)mouseX + screenPosition.X) / 16f);
42137 int y2 = (int)(((float)mouseY + screenPosition.Y) / 16f);
42139 if (WorldGen.MoveTownNPC(x2, y2, num4))
42140 {
42141 SetMouseNPC(-1, -1);
42144 }
42145 }
42146 }
42147 }
42148
42149 private static void DrawInterface_37_DebugStuff()
42150 {
42151 }
42152
42153 private static void DrawInterface_36_Cursor()
42154 {
42155 spriteBatch.End();
42157 if (cursorOverride != -1)
42158 {
42159 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int)((float)(int)cursorColor.R * 0.2f), (int)((float)(int)cursorColor.G * 0.2f), (int)((float)(int)cursorColor.B * 0.2f), (int)((float)(int)cursorColor.A * 0.5f));
42161 bool flag = true;
42162 bool flag2 = true;
42163 float rotation = 0f;
42164 Vector2 vector = default(Vector2);
42165 float num = 1f;
42166 if (cursorOverride == 2)
42167 {
42168 flag = false;
42170 num = 0.7f;
42171 vector = new Vector2(0.1f);
42172 }
42173 switch (cursorOverride)
42174 {
42175 case 2:
42176 flag = false;
42178 num = 0.7f;
42179 vector = new Vector2(0.1f);
42180 break;
42181 case 3:
42182 case 6:
42183 case 7:
42184 case 8:
42185 case 9:
42186 case 10:
42187 flag = false;
42189 break;
42190 }
42191 if (flag)
42192 {
42193 spriteBatch.Draw(TextureAssets.Cursors[cursorOverride].Value, new Vector2(mouseX + 1, mouseY + 1), null, color, rotation, vector * TextureAssets.Cursors[cursorOverride].Value.Size(), cursorScale * 1.1f * num, SpriteEffects.None, 0f);
42194 }
42195 if (flag2)
42196 {
42197 spriteBatch.Draw(TextureAssets.Cursors[cursorOverride].Value, new Vector2(mouseX, mouseY), null, white, rotation, vector * TextureAssets.Cursors[cursorOverride].Value.Size(), cursorScale * num, SpriteEffects.None, 0f);
42198 }
42199 }
42200 else if (SmartCursorIsUsed)
42201 {
42202 DrawCursor(DrawThickCursor(smart: true), smart: true);
42203 }
42204 else
42205 {
42207 }
42208 }
42209
42210 private static void DrawInterface_35_YouDied()
42211 {
42212 if (player[myPlayer].dead)
42213 {
42214 float num = -60f;
42215 string value = Lang.inter[38].Value;
42216 DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.DeathText.Value, value, new Vector2((float)(screenWidth / 2) - FontAssets.DeathText.Value.MeasureString(value).X / 2f, (float)(screenHeight / 2) + num), player[myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
42217 if (player[myPlayer].lostCoins > 0)
42218 {
42219 num += 50f;
42220 string textValue = Language.GetTextValue("Game.DroppedCoins", player[myPlayer].lostCoinString);
42221 DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, textValue, new Vector2((float)(screenWidth / 2) - FontAssets.MouseText.Value.MeasureString(textValue).X / 2f, (float)(screenHeight / 2) + num), player[myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
42222 }
42223 num += (float)((player[myPlayer].lostCoins > 0) ? 24 : 50);
42224 num += 20f;
42225 float num2 = 0.7f;
42226 string textValue2 = Language.GetTextValue("Game.RespawnInSuffix", ((float)(int)(1f + (float)player[myPlayer].respawnTimer / 60f)).ToString());
42227 DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.DeathText.Value, textValue2, new Vector2((float)(screenWidth / 2) - FontAssets.MouseText.Value.MeasureString(textValue2).X * num2 / 2f, (float)(screenHeight / 2) + num), player[myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0f, default(Vector2), num2, SpriteEffects.None, 0f);
42228 }
42229 }
42230
42232 {
42233 if (ignoreErrors)
42234 {
42235 try
42236 {
42238 return;
42239 }
42240 catch (Exception e)
42241 {
42243 return;
42244 }
42245 }
42247 }
42248
42250 {
42251 if (mouseItem.stack <= 0)
42252 {
42253 mouseItem.type = 0;
42254 }
42255 if (hoverItemName != null && hoverItemName != "" && mouseItem.type == 0)
42256 {
42257 player[myPlayer].cursorItemIconEnabled = false;
42259 {
42260 MouseText(hoverItemName, rare, 0, mouseX + 6, mouseY + 6);
42261 }
42262 else
42263 {
42265 }
42266 mouseText = true;
42267 }
42268 if (LocalPlayer.rulerLine && LocalPlayer.builderAccStatus[0] == 0 && LocalPlayer.velocity.Length() <= 6f)
42269 {
42270 int num = Math.Abs(rulerLineDisplayValues.X) + 1;
42271 int num2 = Math.Abs(rulerLineDisplayValues.Y) + 1;
42272 if (num > 1 || num2 > 1)
42273 {
42274 Utils.DrawBorderString(spriteBatch, num + "x" + num2, MouseScreen + new Vector2(16f, 0f), new Microsoft.Xna.Framework.Color(0.24f, 0.8f, 0.9f, 1f), GameZoomTarget, 0f, 0.8f);
42275 }
42276 }
42278 }
42279
42281 {
42283 if (_mouseTextCache.isValid || signHover > -1 || localPlayer.cursorItemIconID > 0 || localPlayer.selectedItem == 58 || (localPlayer.rulerLine && localPlayer.builderAccStatus[0] == 0) || localPlayer.mouseInterface)
42284 {
42286 return;
42287 }
42288 if (instrumentMouseFixHack > 0)
42289 {
42291 return;
42292 }
42293 int type = localPlayer.inventory[localPlayer.selectedItem].type;
42294 if (type == 4057 || type == 4372 || type == 4715 || type == 4673)
42295 {
42296 float musicDist = localPlayer.musicDist;
42297 string text = "GameUI.GuitarAm";
42298 if (type == 4673)
42299 {
42300 int num = 10;
42301 float num2 = 1f / (float)num;
42302 text = ((musicDist > num2 * 9f) ? "GameUI.DrumCymbol" : ((musicDist > num2 * 8f) ? "GameUI.DrumCymbol1" : ((musicDist > num2 * 7f) ? "GameUI.DrumHiHat" : ((musicDist > num2 * 6f) ? "GameUI.DrumClosedHiHat" : ((musicDist > num2 * 5f) ? "GameUI.DrumFloorTom" : ((musicDist > num2 * 4f) ? "GameUI.DrumTamaSnare" : ((musicDist > num2 * 3f) ? "GameUI.DrumTomHigh" : ((musicDist > num2 * 2f) ? "GameUI.DrumTomMid" : ((!(musicDist > num2 * 1f)) ? "GameUI.DrumKick" : "GameUI.DrumTomLow")))))))));
42303 }
42304 else
42305 {
42306 int num3 = 6;
42307 float num4 = 1f / (float)num3;
42308 text = ((musicDist > num4 * 5f) ? "GameUI.GuitarEm" : ((musicDist > num4 * 4f) ? "GameUI.GuitarD" : ((musicDist > num4 * 3f) ? "GameUI.GuitarC" : ((musicDist > num4 * 2f) ? "GameUI.GuitarBm" : ((!(musicDist > num4 * 1f)) ? "GameUI.GuitarG" : "GameUI.GuitarAm")))));
42309 }
42311 }
42312 }
42313
42319
42321 {
42322 DrawBuilderAccToggles(new Vector2(10f, 77f));
42323 }
42324
42326 {
42329 {
42330 string value = Lang.inter[62].Value;
42331 string textSizeMatcher = "Settings";
42332 int num = screenWidth - 110;
42333 int num2 = screenHeight - 20;
42334 int num3 = 620;
42335 int num4 = 870;
42336 int amountOfExtraAccessorySlotsToShow = player[myPlayer].GetAmountOfExtraAccessorySlotsToShow();
42338 {
42339 int num5 = (int)(56f * inventoryScale * (float)(amountOfExtraAccessorySlotsToShow - 1));
42340 num3 += num5;
42341 num4 += num5;
42342 }
42344 {
42345 num -= 140;
42348 }
42351 {
42353 }
42355 }
42356 }
42357
42358 public static void DrawSettingButton(ref bool mouseOver, ref float scale, int posX, int posY, string text, string textSizeMatcher, Action clickAction)
42359 {
42360 Vector2 vector = FontAssets.MouseText.Value.MeasureString(textSizeMatcher);
42361 Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(text);
42362 Vector2 vector3 = FontAssets.DeathText.Value.MeasureString(text);
42363 float num = vector.X / vector2.X;
42364 if (mouseOver)
42365 {
42366 if ((double)scale < 0.96)
42367 {
42368 scale += 0.02f;
42369 }
42370 }
42371 else if ((double)scale > 0.8)
42372 {
42373 scale -= 0.02f;
42374 }
42376 for (int i = 0; i < 5; i++)
42377 {
42378 int num2 = 0;
42379 int num3 = 0;
42381 if (i == 0)
42382 {
42383 num2 = -2;
42384 }
42385 if (i == 1)
42386 {
42387 num2 = 2;
42388 }
42389 if (i == 2)
42390 {
42391 num3 = -2;
42392 }
42393 if (i == 3)
42394 {
42395 num3 = 2;
42396 }
42397 if (i == 4)
42398 {
42400 }
42401 DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.DeathText.Value, text, new Vector2(posX + num2, posY + num3), color, 0f, new Vector2(vector3.X / 2f, vector3.Y / 2f), (scale - 0.2f) * num, SpriteEffects.None, 0f);
42402 }
42403 if ((float)mouseX > (float)posX - vector3.X / 2f && (float)mouseX < (float)posX + vector3.X / 2f && (float)mouseY > (float)posY - vector3.Y / 2f && (float)mouseY < (float)posY + vector3.Y / 2f - 10f && !LocalPlayer.mouseInterface)
42404 {
42406 {
42407 if (!mouseOver)
42408 {
42410 }
42411 mouseOver = true;
42412 player[myPlayer].mouseInterface = true;
42414 {
42415 mouseOver = false;
42416 scale = 0.8f;
42417 clickAction();
42418 }
42419 }
42420 }
42421 else
42422 {
42423 mouseOver = false;
42424 }
42425 }
42426
42428 {
42429 float num = inventoryScale;
42430 inventoryScale = 0.6f;
42431 DrawInfoAccs();
42432 inventoryScale = num;
42433 }
42434
42436 {
42438 {
42440 PlayerInput.AllowExecutionOfGamepadInstructions = false;
42441 }
42442 }
42443
42445 {
42447 if (playerInventory)
42448 {
42449 if (player[myPlayer].chest != -1)
42450 {
42451 CreativeMenu.CloseMenu();
42452 }
42453 if (ignoreErrors)
42454 {
42455 try
42456 {
42457 DrawInventory();
42458 return;
42459 }
42460 catch (Exception e)
42461 {
42463 return;
42464 }
42465 }
42466 DrawInventory();
42467 }
42468 else
42469 {
42470 CreativeMenu.CloseMenu();
42471 recFastScroll = true;
42472 SetMouseNPC(-1, -1);
42473 EquipPage = 0;
42474 }
42475 }
42476
42478 {
42479 bool flag = playerInventory;
42480 if (player[myPlayer].dead)
42481 {
42482 playerInventory = false;
42483 }
42484 if (!playerInventory)
42485 {
42486 player[myPlayer].chest = -1;
42487 InGuideCraftMenu = false;
42488 InReforgeMenu = false;
42489 if (flag)
42490 {
42492 }
42493 }
42494 hoverItemName = "";
42495 }
42496
42498 {
42499 GUIBarsDraw();
42500 }
42501
42503 {
42504 invAlpha += invDir * 0.2f;
42505 if (invAlpha > 240f)
42506 {
42507 invAlpha = 240f;
42508 invDir = -1f;
42509 }
42510 if (invAlpha < 180f)
42511 {
42512 invAlpha = 180f;
42513 invDir = 1f;
42514 }
42515 inventoryBack = new Microsoft.Xna.Framework.Color((byte)invAlpha, (byte)invAlpha, (byte)invAlpha, (byte)invAlpha);
42516 mouseText = false;
42517 rare = 0;
42518 }
42519
42521 {
42522 GUIChatDraw();
42523 }
42524
42526 {
42527 if (clothesWindow)
42528 {
42530 }
42531 }
42532
42534 {
42535 if (hairWindow)
42536 {
42538 }
42539 }
42540
42542 {
42544 }
42545
42547 {
42548 if (signBubble)
42549 {
42550 int num = (int)((float)signX - screenPosition.X);
42551 int num2 = (int)((float)signY - screenPosition.Y);
42552 if (player[myPlayer].gravDir == -1f)
42553 {
42554 num2 = screenHeight - (int)((float)signY - screenPosition.Y) - 32;
42555 }
42556 SpriteEffects effects = SpriteEffects.None;
42557 if ((float)signX > player[myPlayer].position.X + (float)player[myPlayer].width)
42558 {
42559 effects = SpriteEffects.FlipHorizontally;
42560 num += -8 - TextureAssets.Chat2.Width();
42561 }
42562 else
42563 {
42564 num += 8;
42565 }
42566 num2 -= 22;
42568 signBubble = false;
42569 }
42570 }
42571
42573 {
42574 if (!drawDiag)
42575 {
42576 return;
42577 }
42579 {
42580 for (int i = 0; i < 2; i++)
42581 {
42582 string text = "";
42583 int num = 20;
42584 int num2 = 160;
42585 num2 += i * 16;
42586 if (i == 0)
42587 {
42588 text = "Gamepad Left Thumbstick : " + string.Format("{0,-10} , {1,-10}", PlayerInput.GamepadThumbstickLeft.X.ToString("P2"), PlayerInput.GamepadThumbstickLeft.Y.ToString("P2"));
42589 }
42590 if (i == 1)
42591 {
42592 text = "Gamepad Right Thumbstick: " + string.Format("{0,-10} , {1,-10}", PlayerInput.GamepadThumbstickRight.X.ToString("P2"), PlayerInput.GamepadThumbstickRight.Y.ToString("P2"));
42593 }
42595 }
42596 }
42597 for (int j = 0; j < 7; j++)
42598 {
42599 string text2 = "";
42600 int num3 = 20;
42601 int num4 = 220;
42602 num4 += j * 16;
42603 if (j == 0)
42604 {
42605 text2 = "Solid Tiles:";
42606 }
42607 if (j == 1)
42608 {
42609 text2 = "Misc. Tiles:";
42610 }
42611 if (j == 2)
42612 {
42613 text2 = "Walls Tiles:";
42614 }
42615 if (j == 3)
42616 {
42617 text2 = "Background Tiles:";
42618 }
42619 if (j == 4)
42620 {
42621 text2 = "Water Tiles:";
42622 }
42623 if (j == 5)
42624 {
42625 text2 = "Black Tiles:";
42626 }
42627 if (j == 6)
42628 {
42629 text2 = "Total Render:";
42630 }
42632 }
42633 for (int k = 0; k < 7; k++)
42634 {
42635 string text3 = "";
42636 int num5 = 180;
42637 int num6 = 220;
42638 num6 += k * 16;
42639 float num7 = ((k != 6) ? TimeLogger.GetDrawTime(k) : TimeLogger.GetDrawTotal());
42640 text3 = $"{num7:F2}ms";
42642 }
42643 for (int l = 0; l < 6; l++)
42644 {
42645 string text4 = "";
42646 int num8 = 20;
42647 int num9 = 346;
42648 num9 += l * 16;
42649 if (l == 0)
42650 {
42651 text4 = "Lighting Init:";
42652 }
42653 if (l == 1)
42654 {
42655 text4 = "Lighting Phase #1:";
42656 }
42657 if (l == 2)
42658 {
42659 text4 = "Lighting Phase #2:";
42660 }
42661 if (l == 3)
42662 {
42663 text4 = "Lighting Phase #3";
42664 }
42665 if (l == 4)
42666 {
42667 text4 = "Lighting Phase #4";
42668 }
42669 if (l == 5)
42670 {
42671 text4 = "Total Lighting:";
42672 }
42674 }
42675 for (int m = 0; m < 6; m++)
42676 {
42677 string text5 = "";
42678 int num10 = 180;
42679 int num11 = 346;
42680 num11 += m * 16;
42682 text5 = $"{num12:F2}ms";
42684 }
42685 int num13 = 5;
42686 for (int n = 0; n < num13; n++)
42687 {
42688 string text6 = "";
42689 int num14 = 20;
42690 int num15 = 456;
42691 num15 += n * 16;
42692 text6 = "Render #" + n + ":";
42694 }
42695 for (int num16 = 0; num16 < num13; num16++)
42696 {
42697 string text7 = "";
42698 int num17 = 180;
42699 int num18 = 456;
42700 num18 += num16 * 16;
42701 text7 = $"{TimeLogger.GetRenderTime(num16):F2}ms";
42703 }
42704 for (int num19 = 0; num19 < num13; num19++)
42705 {
42706 string text8 = "";
42707 int num20 = 230;
42708 int num21 = 456;
42709 num21 += num19 * 16;
42710 num20 += 10;
42711 text8 = $"{TimeLogger.GetRenderMax(num19):F2}ms";
42713 }
42714 string text9 = "";
42715 int num22 = 20;
42716 int num23 = 456 + 16 * num13 + 16;
42717 text9 = "Update:";
42719 text9 = "";
42720 num22 = 180;
42721 text9 = $"{upTimer:F2}ms";
42723 text9 = "";
42724 num22 = 240;
42725 text9 = $"{upTimerMax:F2}ms";
42727 }
42728
42729 private static void DrawInterface_17_DiagnoseNet()
42730 {
42732 {
42734 }
42735 }
42736
42738 {
42739 mH = 0;
42740 if (!mapEnabled)
42741 {
42742 return;
42743 }
42744 if (!mapFullscreen && mapStyle == 1)
42745 {
42746 mH = 256;
42747 try
42748 {
42749 DrawMap(new GameTime());
42750 }
42751 catch (Exception e)
42752 {
42753 if (!ignoreErrors)
42754 {
42755 throw;
42756 }
42758 }
42759 }
42762 {
42764 }
42765 }
42766
42768 {
42770 if (HealthBarDrawSettings != 0)
42771 {
42773 }
42774 }
42775
42777 {
42778 if (HealthBarDrawSettings == 0)
42779 {
42780 return;
42781 }
42782 int num = -1;
42784 {
42786 for (int i = 0; i < 200; i++)
42787 {
42788 NPC nPC = npc[i];
42789 if ((nPC.life == nPC.lifeMax || nPC.dontTakeDamage) && !nPC.dontTakeDamage && nPC.nameOver > 0f && (num == -1 || nPC.Distance(localPlayer.Center) < npc[num].Distance(localPlayer.Center)))
42790 {
42791 num = i;
42792 }
42793 }
42794 }
42795 bool flag = false;
42796 for (int num2 = 199; num2 >= 0; num2--)
42797 {
42798 if (npc[num2].active && npc[num2].type > 0 && npc[num2].shimmerTransparency == 0f)
42799 {
42800 npc[num2].position += npc[num2].netOffset;
42801 if (npc[num2].life != npc[num2].lifeMax && !npc[num2].dontTakeDamage)
42802 {
42803 float scale = 1f;
42804 int type = npc[num2].type;
42805 if (type == 4)
42806 {
42807 scale = 1.5f;
42808 }
42809 if (type == 35)
42810 {
42811 scale = 1.5f;
42812 }
42813 if (type == 36)
42814 {
42815 scale = 1.5f;
42816 }
42817 if (type == 50)
42818 {
42819 scale = 1.5f;
42820 }
42821 if (type == 113)
42822 {
42823 scale = 1.5f;
42824 }
42825 if (type == 114)
42826 {
42827 scale = 1.5f;
42828 }
42829 if (type == 125)
42830 {
42831 scale = 1.5f;
42832 }
42833 if (type == 126)
42834 {
42835 scale = 1.5f;
42836 }
42837 if (type == 127)
42838 {
42839 scale = 1.5f;
42840 }
42841 if (type == 128)
42842 {
42843 scale = 1.5f;
42844 }
42845 if (type == 129)
42846 {
42847 scale = 1.5f;
42848 }
42849 if (type == 130)
42850 {
42851 scale = 1.5f;
42852 }
42853 if (type == 131)
42854 {
42855 scale = 1.5f;
42856 }
42857 if (type == 222)
42858 {
42859 scale = 1.5f;
42860 }
42861 if (type >= 245 && type <= 249)
42862 {
42863 scale = 1.5f;
42864 }
42865 if (type == 262)
42866 {
42867 scale = 1.5f;
42868 }
42869 if (type == 266)
42870 {
42871 scale = 1.5f;
42872 }
42873 if (type == 564 || type == 565 || type == 551 || type == 576 || type == 577)
42874 {
42875 scale = 1.5f;
42876 }
42877 if (type == 87)
42878 {
42879 scale = 1.5f;
42880 }
42881 if (type == 510 || type == 454 || type == 621)
42882 {
42883 scale = 1.5f;
42884 }
42885 if (type == 439 || type == 370)
42886 {
42887 scale = 1.5f;
42888 }
42889 float num3 = 10f;
42890 if (HealthBarDrawSettings == 2)
42891 {
42892 num3 -= 34f;
42893 }
42894 if ((!expertMode || type != 266) && ((type != 439 && type != 440) || npc[num2].ai[0] != 5f))
42895 {
42896 if (type >= 134 && type <= 136)
42897 {
42898 scale = 1.5f;
42899 if (!flag)
42900 {
42901 flag = true;
42902 Vector2 vector = default(Vector2);
42903 float num4 = 999999f;
42904 for (int j = 0; j < 200; j++)
42905 {
42906 if (npc[j].active && npc[j].type >= 134 && npc[j].type <= 136)
42907 {
42908 Vector2 vector2 = player[myPlayer].Center - npc[j].Center;
42909 if (vector2.Length() < num4 && Collision.CanHit(player[myPlayer].Center, 1, 1, npc[j].Center, 1, 1))
42910 {
42911 num4 = vector2.Length();
42912 vector = npc[j].position;
42913 }
42914 }
42915 }
42916 if (num4 < (float)screenWidth)
42917 {
42918 if (destroyerHB.X < 100f && destroyerHB.Y < 100f)
42919 {
42921 }
42922 else
42923 {
42924 destroyerHB = (destroyerHB * 49f + vector) / 50f;
42925 }
42927 int num5 = num2;
42928 if (type != 134 && npc[num2].realLife != -1)
42929 {
42930 num5 = npc[num2].realLife;
42931 }
42932 float num6 = Lighting.Brightness((int)((npc[num2].position.X + (float)(npc[num2].width / 2)) / 16f), (int)((npc[num2].position.Y + (float)(npc[num2].height / 2) + npc[num2].gfxOffY) / 16f));
42933 num6 = (num6 + 1f) / 2f;
42934 DrawHealthBar(vector.X + (float)(npc[num2].width / 2), vector.Y + (float)(npc[num2].height / 2), npc[num5].life, npc[num5].lifeMax, num6, scale);
42935 }
42936 else
42937 {
42938 destroyerHB = new Vector2(0f, 0f);
42939 }
42940 }
42941 }
42942 else
42943 {
42944 switch (type)
42945 {
42946 case 7:
42948 break;
42949 case 95:
42951 break;
42952 case 10:
42954 break;
42955 case 87:
42957 break;
42958 default:
42959 switch (type)
42960 {
42961 case 412:
42963 break;
42964 case 39:
42966 break;
42967 case 98:
42969 break;
42970 case 454:
42972 break;
42973 default:
42974 switch (type)
42975 {
42976 case 510:
42978 break;
42979 case 621:
42981 break;
42982 case 513:
42984 break;
42985 case 117:
42987 break;
42988 default:
42989 if (HealthBarDrawSettings == 1)
42990 {
42992 DrawHealthBar(npc[num2].position.X + (float)(npc[num2].width / 2), npc[num2].position.Y + (float)npc[num2].height + num3 + npc[num2].gfxOffY, npc[num2].life, npc[num2].lifeMax, Lighting.Brightness((int)((npc[num2].position.X + (float)(npc[num2].width / 2)) / 16f), (int)((npc[num2].position.Y + (float)(npc[num2].height / 2) + npc[num2].gfxOffY) / 16f)), scale);
42993 }
42994 else if (HealthBarDrawSettings == 2)
42995 {
42996 num3 -= NPCAddHeight(npc[num2]) / 2f;
42997 DrawHealthBar(npc[num2].position.X + (float)(npc[num2].width / 2), npc[num2].position.Y + num3 + npc[num2].gfxOffY, npc[num2].life, npc[num2].lifeMax, Lighting.Brightness((int)((npc[num2].position.X + (float)(npc[num2].width / 2)) / 16f), (int)((npc[num2].position.Y + (float)(npc[num2].height / 2) + npc[num2].gfxOffY) / 16f)), scale);
42998 }
42999 break;
43000 case 118:
43001 case 119:
43002 case 511:
43003 case 512:
43004 case 514:
43005 case 515:
43006 case 622:
43007 case 623:
43008 break;
43009 }
43010 break;
43011 case 40:
43012 case 41:
43013 case 99:
43014 case 100:
43015 case 413:
43016 case 414:
43017 case 455:
43018 case 456:
43019 case 457:
43020 case 458:
43021 case 459:
43022 break;
43023 }
43024 break;
43025 case 8:
43026 case 9:
43027 case 11:
43028 case 12:
43029 case 88:
43030 case 89:
43031 case 90:
43032 case 91:
43033 case 92:
43034 case 96:
43035 case 97:
43036 break;
43037 }
43038 }
43039 }
43040 }
43041 else if (!npc[num2].dontTakeDamage && npc[num2].nameOver > 0f && PlayerInput.UsingGamepad && num2 == num)
43042 {
43044 Vector2 vector3 = npc[num2].Bottom - screenPosition + new Vector2(0f, 10f);
43045 if (NPC.GetNPCLocation(num2, seekHead: true, averageDirection: true, out var _, out var pos))
43046 {
43047 vector3 = pos - screenPosition + new Vector2(0f, 10 + npc[num2].height / 2);
43048 if (player[myPlayer].gravDir == -1f)
43049 {
43050 vector3 = ReverseGravitySupport(vector3, -npc[num2].height - 20);
43051 }
43052 Vector2 origin = stringSize * new Vector2(0.5f, 0f);
43055 }
43056 }
43057 if (npc[num2].type == 548 && !npc[num2].dontTakeDamageFromHostiles && DD2Event.TimeLeftBetweenWaves > 0 && !hideUI)
43058 {
43059 Vector2 position = npc[num2].Bottom - screenPosition + new Vector2(0f, -100f);
43060 int num7 = DD2Event.TimeLeftBetweenWaves / 60;
43061 string text = $"{num7}";
43063 float num8 = 1f;
43064 Vector2 origin2 = value.MeasureString(text) * num8 * new Vector2(0.5f, 0.5f);
43066 }
43067 npc[num2].position -= npc[num2].netOffset;
43068 }
43069 }
43070 for (int k = 0; k < 255; k++)
43071 {
43072 if (k != myPlayer && player[k].active && !player[k].ghost && !player[k].dead && !player[k].invis && player[k].statLife != player[k].statLifeMax2)
43073 {
43074 if (HealthBarDrawSettings == 1)
43075 {
43076 int num9 = 10;
43077 DrawHealthBar(player[k].position.X + (float)(player[k].width / 2), player[k].position.Y + (float)player[k].height + (float)num9 + player[k].gfxOffY, player[k].statLife, player[k].statLifeMax2, player[k].stealth * Lighting.Brightness((int)((player[k].position.X + (float)(player[k].width / 2)) / 16f), (int)((player[k].position.Y + (float)(player[k].height / 2) + player[k].gfxOffY) / 16f)));
43078 }
43079 else if (HealthBarDrawSettings == 2)
43080 {
43081 int num10 = -20;
43082 DrawHealthBar(player[k].position.X + (float)(player[k].width / 2), player[k].position.Y + (float)num10 + player[k].gfxOffY, player[k].statLife, player[k].statLifeMax2, player[k].stealth * Lighting.Brightness((int)((player[k].position.X + (float)(player[k].width / 2)) / 16f), (int)((player[k].position.Y + (float)(player[k].height / 2) + player[k].gfxOffY) / 16f)));
43083 }
43084 }
43085 }
43086 }
43087
43088 private void DrawInterface_Healthbar_Worm(NPC head, int tailID, float scale)
43089 {
43090 NPC nPC = head;
43091 for (int i = head.whoAmI + 1; i < 200; i++)
43092 {
43093 if (npc[i].active && npc[i].type == tailID)
43094 {
43095 nPC = npc[i];
43096 break;
43097 }
43098 }
43099 Vector2 vector = (head.position + nPC.position) / 2f;
43100 DrawHealthBar(vector.X + (float)(head.width / 2), vector.Y + (float)(head.height / 2), head.life, head.lifeMax, Lighting.Brightness((int)((head.position.X + (float)(head.width / 2)) / 16f), (int)((head.position.Y + (float)(head.height / 2) + head.gfxOffY) / 16f)), scale);
43101 }
43102
43107
43109 {
43110 spriteBatch.End();
43113 bool result = true;
43115 {
43116 result = false;
43118 }
43119 return result;
43120 }
43121
43123 {
43124 bool result = true;
43126 {
43130 spriteBatch.End();
43131 spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, uIScaleMatrix);
43135 result = false;
43136 _MouseOversCanClear = true;
43137 }
43138 return result;
43139 }
43140
43142 {
43143 bool result = true;
43144 if (hideUI)
43145 {
43146 maxQ = true;
43147 result = false;
43148 _MouseOversCanClear = true;
43150 }
43151 return result;
43152 }
43153
43155 {
43156 bool result = true;
43157 PlayerInput.SetDesiredZoomContext(ZoomContext.Unscaled_MouseInWorld);
43158 CaptureManager.Instance.Update();
43159 if (CaptureManager.Instance.Active)
43160 {
43162 result = false;
43163 _MouseOversCanClear = true;
43166 spriteBatch.End();
43167 spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, uIScaleMatrix);
43169 }
43170 return result;
43171 }
43172
43173 private static void DrawInterface_9_WireSelection()
43174 {
43175 if (!hideUI)
43176 {
43179 }
43181 }
43182
43184 {
43185 if (player[myPlayer].selectedItem == 58 && player[myPlayer].itemAnimation > 0)
43186 {
43187 mouseLeftRelease = false;
43188 }
43189 }
43190
43192 {
43194 {
43195 return;
43196 }
43197 if (ignoreErrors)
43198 {
43199 try
43200 {
43202 return;
43203 }
43204 catch (Exception e)
43205 {
43207 return;
43208 }
43209 }
43211 }
43212
43214 {
43217 {
43219 }
43220 else
43221 _ = 0;
43222 if (flag && !player[myPlayer].dead && !PlayerInput.CursorIsBusy)
43223 {
43224 float num = player[myPlayer].velocity.Length();
43225 float num2 = 6f;
43226 float value = MathHelper.Lerp(0f, 0.7f, MathHelper.Clamp(1f - num / num2, 0f, 1f));
43229 if (value > 0f)
43230 {
43231 Vector2 position = MouseWorld.ToTileCoordinates().ToVector2() * 16f;
43233 _ = drawToScreen;
43234 position -= screenPosition;
43235 position += new Vector2(8f);
43236 if (player[myPlayer].gravDir == -1f)
43237 {
43238 position.Y = (float)screenHeight - position.Y;
43239 }
43241 spriteBatch.Draw(value2, position, null, Microsoft.Xna.Framework.Color.White * 0.5f * value, 0f, value2.Size() / 2f, 1f, SpriteEffects.None, 0f);
43242 }
43243 }
43244 else
43245 {
43247 }
43248 }
43249
43250 private static void DrawInterface_5_GamepadLockOn()
43251 {
43253 }
43254
43255 private static void DrawInterface_4_Ruler()
43256 {
43257 if (!player[myPlayer].rulerLine || player[myPlayer].builderAccStatus[0] != 0)
43258 {
43259 return;
43260 }
43261 float num = player[myPlayer].velocity.Length();
43262 float num2 = 6f;
43263 float num3 = 2f;
43264 if (!(num <= num2))
43265 {
43266 return;
43267 }
43268 float num4 = 1f;
43269 if (num >= num3)
43270 {
43271 num4 = 1f - (num - num3) / num2;
43272 }
43273 int num5 = 1;
43274 if ((float)mouseX + screenPosition.X < player[myPlayer].Center.X)
43275 {
43276 num5 = -1;
43277 }
43278 int num6 = (int)(player[myPlayer].position.X + (float)(player[myPlayer].width / 2)) / 16;
43279 int num7 = (int)(player[myPlayer].position.Y + (float)player[myPlayer].height - 2f) / 16;
43280 if (player[myPlayer].gravDir == -1f)
43281 {
43282 num7--;
43283 }
43285 if (Math.Abs(num6 - (int)(MouseWorld.X / 16f)) > 0)
43286 {
43287 num6 += num5;
43288 }
43289 if (player[myPlayer].gravDir == -1f)
43290 {
43291 mouseWorld.Y += 16f;
43292 }
43293 mouseWorld /= 16f;
43294 new Vector2(num6, num7);
43295 int num8 = (int)mouseWorld.X - num6;
43296 int num9 = (int)mouseWorld.Y - num7;
43297 Math.Abs(num8);
43298 Math.Abs(num9);
43299 rulerLineDisplayValues.X = num8;
43300 rulerLineDisplayValues.Y = num9;
43301 if (num8 == 0 && num9 == 0)
43302 {
43303 return;
43304 }
43307 int num10 = num6;
43308 int num11 = num7;
43309 if (player[myPlayer].gravDir == -1f)
43310 {
43311 num11--;
43312 }
43313 float r = 0.24f;
43314 float g = 0.8f;
43315 float b = 0.9f;
43316 float a = 1f;
43317 float num12 = 0.8f;
43319 spriteBatch.Draw(value, ReverseGravitySupport(new Vector2(num10, num11) * 16f - screenPosition, 16f), value2, color, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
43320 if (num8 != 0)
43321 {
43322 int num13 = Math.Sign(num8);
43323 value2.Y = ((num13 == 1) ? 16 : 32);
43324 while (num8 != 0)
43325 {
43326 num8 -= num13;
43327 num10 += num13;
43328 if (num8 == 0)
43329 {
43330 value2.Y = 0;
43331 }
43332 color = new Microsoft.Xna.Framework.Color(r, g, b, a) * num12 * num4;
43333 spriteBatch.Draw(value, ReverseGravitySupport(new Vector2(num10, num11) * 16f - screenPosition, 16f), value2, color, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
43334 }
43335 }
43336 if (num9 == 0)
43337 {
43338 return;
43339 }
43340 int num14 = Math.Sign(num9);
43341 value2.Y = ((num14 == 1) ? 48 : 64);
43342 while (num9 != 0)
43343 {
43344 num9 -= num14;
43345 num11 += num14;
43346 if (num9 == 0)
43347 {
43348 value2.Y = 0;
43349 }
43350 color = new Microsoft.Xna.Framework.Color(r, g, b, a) * num12 * num4;
43351 spriteBatch.Draw(value, ReverseGravitySupport(new Vector2(num10, num11) * 16f - screenPosition, 16f), value2, color, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
43352 }
43353 }
43354
43355 private static void DrawInterface_3_LaserRuler()
43356 {
43357 if (!player[myPlayer].rulerGrid || player[myPlayer].builderAccStatus[1] != 0)
43358 {
43359 return;
43360 }
43361 float num = player[myPlayer].velocity.Length();
43362 num = Vector2.Distance(player[myPlayer].position, player[myPlayer].shadowPos[2]);
43363 float num2 = 6f;
43364 Texture2D value = TextureAssets.Extra[68].Value;
43365 float num3 = MathHelper.Lerp(0.2f, 0.7f, MathHelper.Clamp(1f - num / num2, 0f, 1f));
43367 vec += new Vector2(-50f);
43368 vec = vec.ToTileCoordinates().ToVector2() * 16f;
43369 int num4 = (screenWidth + 100) / 16;
43370 int num5 = (screenHeight + 100) / 16;
43371 Microsoft.Xna.Framework.Point point = MouseWorld.ToTileCoordinates();
43372 point.X -= (int)vec.X / 16;
43373 point.Y -= (int)vec.Y / 16;
43374 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(0.24f, 0.8f, 0.9f, 0.5f) * 0.4f * num3;
43375 Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(1f, 0.8f, 0.9f, 0.5f) * 0.5f * num3;
43377 vec -= Vector2.One;
43378 for (int i = 0; i < num4; i++)
43379 {
43380 for (int j = 0; j < num5; j++)
43381 {
43384 if (i != point.X && j != point.Y)
43385 {
43386 if (i != point.X + 1)
43387 {
43388 value2.X = 0;
43389 value2.Width = 16;
43390 }
43391 else
43392 {
43393 value2.X = 2;
43394 value2.Width = 14;
43395 zero.X = 2f;
43396 }
43397 if (j != point.Y + 1)
43398 {
43399 value2.Y = 18;
43400 value2.Height = 16;
43401 }
43402 else
43403 {
43404 value2.Y = 2;
43405 value2.Height = 14;
43406 zero.Y = 2f;
43407 }
43408 spriteBatch.Draw(value, ReverseGravitySupport(new Vector2(i, j) * 16f - screenPosition + vec + zero, 16f), value2, color3, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
43409 }
43410 }
43411 }
43412 value2 = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 18);
43413 for (int k = 0; k < num4; k++)
43414 {
43415 if (k == point.X)
43416 {
43417 spriteBatch.Draw(value, ReverseGravitySupport(new Vector2(k, point.Y) * 16f - screenPosition + vec, 16f), new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16), color2, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
43418 }
43419 else
43420 {
43421 spriteBatch.Draw(value, ReverseGravitySupport(new Vector2(k, point.Y) * 16f - screenPosition + vec, 16f), value2, color2, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
43422 }
43423 }
43424 value2 = new Microsoft.Xna.Framework.Rectangle(0, 0, 18, 16);
43425 for (int l = 0; l < num5; l++)
43426 {
43427 if (l != point.Y)
43428 {
43429 spriteBatch.Draw(value, ReverseGravitySupport(new Vector2(point.X, l) * 16f - screenPosition + vec, 16f), value2, color2, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
43430 }
43431 }
43432 }
43433
43435 {
43437 }
43438
43440 {
43441 spriteBatch.End();
43442 spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, GameViewMatrix.ZoomMatrix);
43444 if (instance.currentNPCShowingChatBubble != -1)
43445 {
43446 DrawNPCChatBubble(instance.currentNPCShowingChatBubble);
43447 }
43448 instance.currentNPCShowingChatBubble = -1;
43449 }
43450
43452 {
43454 if (localPlayer.dead || !localPlayer.HeldItem.summon)
43455 {
43456 return;
43457 }
43458 spriteBatch.End();
43459 spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.PointClamp, null, null, null, GameViewMatrix.ZoomMatrix);
43460 Texture2D value = TextureAssets.Extra[199].Value;
43462 int minionAttackTargetNPC = localPlayer.MinionAttackTargetNPC;
43464 for (int i = 0; i < 200; i++)
43465 {
43466 NPC nPC = npc[i];
43467 if (nPC.active && nPC.Hitbox.Intersects(value2))
43468 {
43469 Vector2 vector = nPC.Center - screenPosition;
43470 if (player[myPlayer].gravDir == -1f)
43471 {
43472 vector.Y = (float)screenHeight - vector.Y;
43473 }
43474 Vector2 position = vector + zero;
43475 if (i == minionAttackTargetNPC)
43476 {
43477 int frameY = (int)(GlobalTimeWrappedHourly * 10f) % 4;
43478 Microsoft.Xna.Framework.Rectangle rectangle = value.Frame(1, 4, 0, frameY, 0, -2);
43479 Vector2 origin = rectangle.Size() / 2f;
43480 Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * 0.7f;
43481 color.A /= 2;
43482 spriteBatch.Draw(value, position, rectangle, color, 0f, origin, 1f, SpriteEffects.None, 0f);
43483 }
43484 }
43485 }
43486 }
43487
43488 private static void MouseOversTryToClear()
43489 {
43491 {
43492 _MouseOversCanClear = false;
43494 }
43495 }
43496
43497 private static void MouseOversClear()
43498 {
43499 player[myPlayer].cursorItemIconEnabled = false;
43500 player[myPlayer].cursorItemIconID = 0;
43501 player[myPlayer].cursorItemIconText = string.Empty;
43502 player[myPlayer].cursorItemIconPush = 0;
43503 signHover = -1;
43504 }
43505
43512
43513 public static void ItemIconCacheVerification()
43514 {
43515 if (_itemIconCacheTime > 0)
43516 {
43518 if (num != 0f)
43519 {
43521 }
43522 if (num > 4f)
43523 {
43525 }
43526 if (_itemIconCacheSelectedItemID != player[myPlayer].inventory[player[myPlayer].selectedItem].type)
43527 {
43529 }
43530 }
43531 }
43532
43533 public static void DrawWallOfFish()
43534 {
43535 List<int> list = new List<int>();
43536 for (int i = 2297; i <= 2321; i++)
43537 {
43538 list.Add(i);
43539 }
43540 for (int j = 2450; j <= 2488; j++)
43541 {
43542 list.Add(j);
43543 }
43544 for (int k = 0; k < 5; k++)
43545 {
43546 float num = 10f;
43547 Vector2 vector = new Vector2((float)screenWidth / num * (GlobalTimeWrappedHourly % num), -100f);
43548 vector.X += 14 * k;
43549 vector.Y += k % 2 * 14;
43550 int num2 = 30 * k;
43551 while (vector.Y < (float)(screenHeight + 100))
43552 {
43553 if (++num2 >= list.Count)
43554 {
43555 num2 = 0;
43556 }
43557 vector.Y += 26f;
43558 instance.LoadItem(list[num2]);
43560 Microsoft.Xna.Framework.Point point = (vector + screenPosition).ToTileCoordinates();
43561 spriteBatch.Draw(value, vector, null, Lighting.GetColor(point.X, point.Y), (float)Math.PI / 4f, value.Size() / 2f, 1f, SpriteEffects.None, 0f);
43562 }
43563 }
43564 }
43565
43566 public static void DrawWallOfStars()
43567 {
43568 bool flag = true;
43569 if (flag)
43570 {
43572 }
43575 for (int i = 0; i < 5; i++)
43576 {
43577 float num2 = 10f;
43578 Vector2 vector = new Vector2((float)screenWidth / num2 * (GlobalTimeWrappedHourly % num2), -100f);
43579 vector.X += 14 * i;
43580 vector.Y += i % 2 * 14;
43581 while (vector.Y < (float)(screenHeight + 100))
43582 {
43583 vector.Y += 26f;
43584 projectile.position = Vector2.One * 10f;
43585 projectile.velocity = Vector2.UnitX * 10f;
43586 projectile.rotation = GlobalTimeWrappedHourly * ((float)Math.PI * 2f);
43587 projectile.Update(num);
43588 projectile.position = vector + screenPosition;
43589 instance.DrawProj(num);
43590 }
43591 }
43592 projectile.position = Vector2.One * 10f;
43593 projectile.Kill();
43594 if (flag)
43595 {
43596 spriteBatch.End();
43597 }
43598 }
43599
43600 private static void DrawSmartCursor()
43601 {
43602 if (SmartCursorShowing && !player[myPlayer].dead)
43603 {
43606 _ = drawToScreen;
43608 if (player[myPlayer].gravDir == -1f)
43609 {
43610 vector.Y = (float)screenHeight - vector.Y - 16f;
43611 }
43614 float r = 1f;
43615 float g = 0.9f;
43616 float b = 0.1f;
43617 float a = 1f;
43618 float num = 0.6f;
43619 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, 8f, SpriteEffects.None, 0f);
43620 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitX * 8f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, 8f, SpriteEffects.None, 0f);
43621 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitY * 8f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, 8f, SpriteEffects.None, 0f);
43622 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.One * 8f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, 8f, SpriteEffects.None, 0f);
43623 b = 0.3f;
43624 g = 0.95f;
43625 a = (num = 1f);
43626 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitX * -2f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, new Vector2(2f, 16f), SpriteEffects.None, 0f);
43627 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitX * 16f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, new Vector2(2f, 16f), SpriteEffects.None, 0f);
43628 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitY * -2f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, new Vector2(16f, 2f), SpriteEffects.None, 0f);
43629 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitY * 16f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, new Vector2(16f, 2f), SpriteEffects.None, 0f);
43630 }
43631 }
43632
43633 private static void DrawSmartInteract()
43634 {
43636 {
43639 _ = drawToScreen;
43641 if (player[myPlayer].gravDir == -1f)
43642 {
43643 vector.Y = (float)screenHeight - vector.Y - 16f;
43644 }
43647 float r = 0.1f;
43648 float g = 0.9f;
43649 float b = 1f;
43650 float a = 1f;
43651 float num = 0.6f;
43652 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, 8f, SpriteEffects.None, 0f);
43653 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitX * 8f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, 8f, SpriteEffects.None, 0f);
43654 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitY * 8f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, 8f, SpriteEffects.None, 0f);
43655 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.One * 8f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, 8f, SpriteEffects.None, 0f);
43656 r = 0.3f;
43657 g = 0.95f;
43658 a = (num = 1f);
43659 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitX * -2f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, new Vector2(2f, 16f), SpriteEffects.None, 0f);
43660 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitX * 16f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, new Vector2(2f, 16f), SpriteEffects.None, 0f);
43661 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitY * -2f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, new Vector2(16f, 2f), SpriteEffects.None, 0f);
43662 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector + Vector2.UnitY * 16f, value, buffColor(newColor, r, g, b, a) * num, 0f, Vector2.Zero, new Vector2(16f, 2f), SpriteEffects.None, 0f);
43663 }
43664 }
43665
43667 {
43668 try
43669 {
43671 }
43672 catch (Exception e)
43673 {
43674 if (ignoreErrors)
43675 {
43677 return;
43678 }
43679 throw;
43680 }
43681 }
43682
43683 public void GUIChatDraw()
43684 {
43685 if (ignoreErrors)
43686 {
43687 try
43688 {
43689 if ((npcChatText != "" || player[myPlayer].sign != -1) && !editChest)
43690 {
43692 }
43693 return;
43694 }
43695 catch (Exception e)
43696 {
43698 return;
43699 }
43700 }
43701 if ((npcChatText != "" || player[myPlayer].sign != -1) && !editChest)
43702 {
43704 }
43705 }
43706
43717
43718 private void DrawInfoAccs()
43719 {
43720 if (!CanShowInfoAccs)
43721 {
43722 return;
43723 }
43724 bool flag = false;
43725 bool flag2 = false;
43726 bool flag3 = false;
43727 bool flag4 = false;
43728 bool flag5 = false;
43729 bool flag6 = false;
43730 bool flag7 = false;
43731 bool flag8 = false;
43732 bool flag9 = false;
43733 bool flag10 = false;
43734 bool flag11 = false;
43735 bool flag12 = false;
43736 int num = -1;
43737 int num2 = -10;
43738 int num3 = 0;
43739 string text = "";
43740 float num4 = 215f;
43741 int startX = 0;
43742 if (GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive)
43743 {
43744 startX = -50;
43745 num4 += 50f;
43746 }
43748 for (int i = 0; i < 12; i++)
43749 {
43750 string text2 = "";
43751 string text3 = "";
43754 if (player[myPlayer].accWatch > 0 && !flag && (!player[myPlayer].hideInfo[0] || playerInventory))
43755 {
43756 num = 0;
43757 text3 = Lang.inter[95].Value;
43758 string textValue = Language.GetTextValue("GameUI.TimeAtMorning");
43759 double num5 = time;
43760 if (!dayTime)
43761 {
43762 num5 += 54000.0;
43763 }
43764 num5 = num5 / 86400.0 * 24.0;
43765 double num6 = 7.5;
43766 num5 = num5 - num6 - 12.0;
43767 if (num5 < 0.0)
43768 {
43769 num5 += 24.0;
43770 }
43771 if (num5 >= 12.0)
43772 {
43773 textValue = Language.GetTextValue("GameUI.TimePastMorning");
43774 }
43775 int num7 = (int)num5;
43776 double num8 = num5 - (double)num7;
43777 num8 = (int)(num8 * 60.0);
43778 string text4 = string.Concat(num8);
43779 if (num8 < 10.0)
43780 {
43781 text4 = "0" + text4;
43782 }
43783 if (num7 > 12)
43784 {
43785 num7 -= 12;
43786 }
43787 if (num7 == 0)
43788 {
43789 num7 = 12;
43790 }
43791 if (player[myPlayer].accWatch == 1)
43792 {
43793 text4 = "00";
43794 }
43795 else if (player[myPlayer].accWatch == 2)
43796 {
43797 text4 = ((!(num8 < 30.0)) ? "30" : "00");
43798 }
43799 text2 = num7 + ":" + text4 + " " + textValue;
43800 flag = true;
43801 }
43802 else if (player[myPlayer].accWeatherRadio && !flag5 && (!player[myPlayer].hideInfo[1] || playerInventory))
43803 {
43804 num = 1;
43805 text3 = Lang.inter[96].Value;
43806 string text5 = "";
43807 text5 = (IsItStorming ? Language.GetTextValue("GameUI.Storm") : (((double)maxRaining > 0.6) ? Language.GetTextValue("GameUI.HeavyRain") : (((double)maxRaining >= 0.2) ? Language.GetTextValue("GameUI.Rain") : ((maxRaining > 0f) ? Language.GetTextValue("GameUI.LightRain") : ((cloudBGActive > 0f) ? Language.GetTextValue("GameUI.Overcast") : ((numClouds > 90) ? Language.GetTextValue("GameUI.MostlyCloudy") : ((numClouds > 55) ? Language.GetTextValue("GameUI.Cloudy") : ((numClouds <= 15) ? Language.GetTextValue("GameUI.Clear") : Language.GetTextValue("GameUI.PartlyCloudy")))))))));
43808 text2 = text5;
43809 int num9 = (int)(windSpeedCurrent * 50f);
43810 if (num9 < 0)
43811 {
43812 text2 += Language.GetTextValue("GameUI.EastWind", Math.Abs(num9));
43813 }
43814 else if (num9 > 0)
43815 {
43816 text2 += Language.GetTextValue("GameUI.WestWind", num9);
43817 }
43818 if (Sandstorm.Happening)
43819 {
43820 if (GlobalTimeWrappedHourly % 10f >= 5f)
43821 {
43822 text2 = Language.GetTextValue("GameUI.Sandstorm");
43823 }
43824 text2 += " +";
43825 }
43826 flag5 = true;
43827 }
43828 else if (player[myPlayer].accCalendar && !flag8 && (!player[myPlayer].hideInfo[7] || playerInventory))
43829 {
43830 num = ((bloodMoon && !dayTime) ? 8 : ((!eclipse || !dayTime) ? 7 : 8));
43831 text3 = Lang.inter[102].Value;
43832 if (moonPhase == 0)
43833 {
43834 text2 = Language.GetTextValue("GameUI.FullMoon");
43835 }
43836 else if (moonPhase == 1)
43837 {
43838 text2 = Language.GetTextValue("GameUI.WaningGibbous");
43839 }
43840 else if (moonPhase == 2)
43841 {
43842 text2 = Language.GetTextValue("GameUI.ThirdQuarter");
43843 }
43844 else if (moonPhase == 3)
43845 {
43846 text2 = Language.GetTextValue("GameUI.WaningCrescent");
43847 }
43848 else if (moonPhase == 4)
43849 {
43850 text2 = Language.GetTextValue("GameUI.NewMoon");
43851 }
43852 else if (moonPhase == 5)
43853 {
43854 text2 = Language.GetTextValue("GameUI.WaxingCrescent");
43855 }
43856 else if (moonPhase == 6)
43857 {
43858 text2 = Language.GetTextValue("GameUI.FirstQuarter");
43859 }
43860 else if (moonPhase == 7)
43861 {
43862 text2 = Language.GetTextValue("GameUI.WaxingGibbous");
43863 }
43864 flag8 = true;
43865 }
43866 else if (player[myPlayer].accFishFinder && !flag4 && (!player[myPlayer].hideInfo[2] || playerInventory))
43867 {
43868 bool flag13 = false;
43869 num = 2;
43870 text3 = Lang.inter[97].Value;
43871 for (int j = 0; j < 1000; j++)
43872 {
43873 if (projectile[j].active && projectile[j].owner == myPlayer && projectile[j].bobber)
43874 {
43875 flag13 = true;
43876 break;
43877 }
43878 }
43879 if (flag13)
43880 {
43881 text2 = player[myPlayer].displayedFishingInfo;
43882 }
43883 else
43884 {
43885 PlayerFishingConditions fishingConditions = player[myPlayer].GetFishingConditions();
43886 text2 = ((fishingConditions.BaitItemType != 2673) ? (player[myPlayer].displayedFishingInfo = Language.GetTextValue("GameUI.FishingPower", fishingConditions.FinalFishingLevel)) : Language.GetTextValue("GameUI.FishingWarning"));
43887 }
43888 flag4 = true;
43889 }
43890 else if (player[myPlayer].accOreFinder && !flag10 && (!player[myPlayer].hideInfo[10] || playerInventory))
43891 {
43892 num = 10;
43893 text3 = Lang.inter[104].Value;
43894 if (SceneMetrics.bestOre <= 0)
43895 {
43896 text2 = Language.GetTextValue("GameUI.NoTreasureNearby");
43897 infoTextColor = color;
43898 }
43899 else
43900 {
43901 int baseOption = 0;
43903 if (SceneMetrics.ClosestOrePosition.HasValue)
43904 {
43907 if (tileSafely.active())
43908 {
43910 num10 = tileSafely.type;
43912 {
43913 baseOption = 0;
43914 }
43915 }
43916 }
43918 }
43919 flag10 = true;
43920 }
43921 else if (player[myPlayer].accCritterGuide && !flag11 && (!player[myPlayer].hideInfo[11] || playerInventory))
43922 {
43923 flag11 = true;
43924 num = 11;
43925 text3 = Lang.inter[105].Value;
43926 int num11 = 1300;
43927 int num12 = 0;
43928 int num13 = -1;
43929 if (player[myPlayer].accCritterGuideCounter <= 0)
43930 {
43931 player[myPlayer].accCritterGuideCounter = 15;
43932 for (int k = 0; k < 200; k++)
43933 {
43934 if (npc[k].active && npc[k].rarity > num12 && (npc[k].Center - player[myPlayer].Center).Length() < (float)num11)
43935 {
43936 num13 = k;
43937 num12 = npc[k].rarity;
43938 }
43939 }
43940 player[myPlayer].accCritterGuideNumber = (byte)num13;
43941 }
43942 else
43943 {
43944 player[myPlayer].accCritterGuideCounter--;
43945 num13 = player[myPlayer].accCritterGuideNumber;
43946 }
43947 if (num13 >= 0 && num13 < 200 && npc[num13].active && npc[num13].rarity > 0)
43948 {
43949 text2 = npc[num13].GivenOrTypeName;
43951 }
43952 else
43953 {
43954 text2 = Language.GetTextValue("GameUI.NoRareCreatures");
43955 infoTextColor = color;
43956 }
43957 }
43958 else if (player[myPlayer].accThirdEye && !flag6 && (!player[myPlayer].hideInfo[5] || playerInventory))
43959 {
43960 flag6 = true;
43961 num = 5;
43962 text3 = Lang.inter[100].Value;
43963 int num14 = 2000;
43964 if (player[myPlayer].accThirdEyeCounter == 0)
43965 {
43966 player[myPlayer].accThirdEyeNumber = 0;
43967 player[myPlayer].accThirdEyeCounter = 15;
43968 for (int l = 0; l < 200; l++)
43969 {
43970 if (npc[l].active && !npc[l].friendly && npc[l].damage > 0 && npc[l].lifeMax > 5 && !npc[l].dontCountMe && (npc[l].Center - player[myPlayer].Center).Length() < (float)num14)
43971 {
43972 player[myPlayer].accThirdEyeNumber++;
43973 }
43974 }
43975 }
43976 else
43977 {
43978 player[myPlayer].accThirdEyeCounter--;
43979 }
43980 if (player[myPlayer].accThirdEyeNumber != 0)
43981 {
43982 text2 = ((player[myPlayer].accThirdEyeNumber != 1) ? Language.GetTextValue("GameUI.EnemiesNearby", player[myPlayer].accThirdEyeNumber) : Language.GetTextValue("GameUI.OneEnemyNearby"));
43983 }
43984 else
43985 {
43986 text2 = Language.GetTextValue("GameUI.NoEnemiesNearby");
43987 infoTextColor = color;
43988 }
43989 }
43990 else if (player[myPlayer].accJarOfSouls && !flag7 && (!player[myPlayer].hideInfo[6] || playerInventory))
43991 {
43992 flag7 = true;
43993 num = 6;
43994 text3 = Lang.inter[101].Value;
43995 int lastCreatureHit = player[myPlayer].lastCreatureHit;
43996 if (lastCreatureHit <= 0)
43997 {
43998 text2 = Language.GetTextValue("GameUI.NoKillCount");
43999 infoTextColor = color;
44000 }
44001 else
44002 {
44003 text2 = Lang.GetNPCNameValue(Item.BannerToNPC(lastCreatureHit)) + ": " + NPC.killCount[lastCreatureHit];
44004 }
44005 }
44006 else if (player[myPlayer].accDreamCatcher && !flag12 && (!player[myPlayer].hideInfo[12] || playerInventory))
44007 {
44008 num = 12;
44009 text3 = Lang.inter[106].Value;
44010 player[myPlayer].checkDPSTime();
44011 int dPS = player[myPlayer].getDPS();
44012 flag12 = true;
44013 if (dPS == 0)
44014 {
44015 text2 = Language.GetTextValue("GameUI.NoDPS");
44016 infoTextColor = color;
44017 }
44018 else
44019 {
44020 text2 = Language.GetTextValue("GameUI.DPS", player[myPlayer].getDPS());
44021 }
44022 }
44023 else if (player[myPlayer].accStopwatch && !flag9 && (!player[myPlayer].hideInfo[9] || playerInventory))
44024 {
44025 num = 9;
44026 text3 = Lang.inter[103].Value;
44027 Vector2 vector = player[myPlayer].velocity + player[myPlayer].instantMovementAccumulatedThisFrame;
44028 if (player[myPlayer].mount.Active && player[myPlayer].mount.IsConsideredASlimeMount && player[myPlayer].velocity.Y != 0f && !player[myPlayer].SlimeDontHyperJump)
44029 {
44030 vector.Y += player[myPlayer].velocity.Y;
44031 }
44032 int num15 = (int)(1f + vector.Length() * 6f);
44033 if (num15 > player[myPlayer].speedSlice.Length)
44034 {
44035 num15 = player[myPlayer].speedSlice.Length;
44036 }
44037 float num16 = 0f;
44038 for (int num17 = num15 - 1; num17 > 0; num17--)
44039 {
44040 player[myPlayer].speedSlice[num17] = player[myPlayer].speedSlice[num17 - 1];
44041 }
44042 player[myPlayer].speedSlice[0] = vector.Length();
44043 for (int m = 0; m < player[myPlayer].speedSlice.Length; m++)
44044 {
44045 if (m < num15)
44046 {
44047 num16 += player[myPlayer].speedSlice[m];
44048 }
44049 else
44050 {
44051 player[myPlayer].speedSlice[m] = num16 / (float)num15;
44052 }
44053 }
44054 num16 /= (float)num15;
44055 int num18 = 42240;
44056 int num19 = 216000;
44057 float num20 = num16 * (float)num19 / (float)num18;
44058 if (!player[myPlayer].merman && !player[myPlayer].ignoreWater)
44059 {
44060 if (player[myPlayer].honeyWet)
44061 {
44062 num20 /= 4f;
44063 }
44064 else if (player[myPlayer].wet)
44065 {
44066 num20 /= 2f;
44067 }
44068 }
44069 text2 = Language.GetTextValue("GameUI.Speed", Math.Round(num20));
44070 flag9 = true;
44071 }
44072 else if (player[myPlayer].accCompass > 0 && !flag3 && (!player[myPlayer].hideInfo[3] || playerInventory))
44073 {
44074 num = 3;
44075 text3 = Lang.inter[98].Value;
44076 int num21 = (int)((player[myPlayer].position.X + (float)(player[myPlayer].width / 2)) * 2f / 16f - (float)maxTilesX);
44077 text2 = ((num21 > 0) ? Language.GetTextValue("GameUI.CompassEast", num21) : ((num21 >= 0) ? Language.GetTextValue("GameUI.CompassCenter") : Language.GetTextValue("GameUI.CompassWest", -num21)));
44078 flag3 = true;
44079 }
44080 else if (player[myPlayer].accDepthMeter > 0 && !flag2 && (!player[myPlayer].hideInfo[4] || playerInventory))
44081 {
44082 num = 4;
44083 text3 = Lang.inter[99].Value;
44084 int num22 = (int)((double)((player[myPlayer].position.Y + (float)player[myPlayer].height) * 2f / 16f) - worldSurface * 2.0);
44085 string text6 = "";
44086 float num23 = (float)maxTilesX / 4200f;
44087 num23 *= num23;
44088 int num24 = 1200;
44089 float num25 = (float)((double)(player[myPlayer].Center.Y / 16f - (65f + 10f * num23)) / (worldSurface / 5.0));
44090 text6 = ((player[myPlayer].position.Y > (float)((maxTilesY - 204) * 16)) ? Language.GetTextValue("GameUI.LayerUnderworld") : (((double)player[myPlayer].position.Y > rockLayer * 16.0 + (double)(num24 / 2) + 16.0) ? Language.GetTextValue("GameUI.LayerCaverns") : ((num22 > 0) ? Language.GetTextValue("GameUI.LayerUnderground") : ((!(num25 >= 1f)) ? Language.GetTextValue("GameUI.LayerSpace") : Language.GetTextValue("GameUI.LayerSurface")))));
44091 string text7 = "";
44092 num22 = Math.Abs(num22);
44093 text7 = ((num22 != 0) ? Language.GetTextValue("GameUI.Depth", num22) : Language.GetTextValue("GameUI.DepthLevel"));
44094 text2 = text7 + " " + text6;
44095 flag2 = true;
44096 }
44097 if (!(text2 != ""))
44098 {
44099 continue;
44100 }
44102 if (num >= 0)
44103 {
44104 num3++;
44105 int num26 = 22;
44106 if (screenHeight < 650)
44107 {
44108 num26 = 20;
44109 }
44110 Vector2 vector2 = new Vector2(X, Y + 74 + num26 * i + 52);
44111 int num27 = num;
44112 if (num27 == 8)
44113 {
44114 num27 = 7;
44115 }
44117 bool flag14 = false;
44118 if (playerInventory)
44119 {
44120 vector2 = new Vector2(X, Y);
44121 if ((float)mouseX >= vector2.X && (float)mouseY >= vector2.Y && (float)mouseX <= vector2.X + (float)TextureAssets.InfoIcon[num].Width() && (float)mouseY <= vector2.Y + (float)TextureAssets.InfoIcon[num].Height() && !PlayerInput.IgnoreMouseInterface)
44122 {
44123 flag14 = true;
44124 player[myPlayer].mouseInterface = true;
44126 {
44128 mouseLeftRelease = false;
44129 player[myPlayer].hideInfo[num27] = !player[myPlayer].hideInfo[num27];
44130 }
44131 if (!mouseText)
44132 {
44133 text = text3;
44134 mouseText = true;
44135 }
44136 }
44137 if (player[myPlayer].hideInfo[num27])
44138 {
44139 color2 = new Microsoft.Xna.Framework.Color(80, 80, 80, 70);
44140 }
44141 }
44142 else if ((float)mouseX >= vector2.X && (float)mouseY >= vector2.Y && (float)mouseX <= vector2.X + (float)TextureAssets.InfoIcon[num].Width() && (float)mouseY <= vector2.Y + (float)TextureAssets.InfoIcon[num].Height() && !mouseText)
44143 {
44144 num2 = i;
44145 text = text3;
44146 mouseText = true;
44147 }
44148 UILinkPointNavigator.SetPosition(1558 + num3 - 1, vector2 + TextureAssets.InfoIcon[num].Value.Size() * 0.75f);
44149 spriteBatch.Draw(TextureAssets.InfoIcon[num].Value, vector2, new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InfoIcon[num].Width(), TextureAssets.InfoIcon[num].Height()), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
44150 if (flag14)
44151 {
44152 spriteBatch.Draw(TextureAssets.InfoIcon[13].Value, vector2 - Vector2.One * 2f, null, OurFavoriteColor, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
44153 }
44154 X += 20;
44155 }
44156 UILinkPointNavigator.Shortcuts.INFOACCCOUNT = num3;
44157 if (playerInventory)
44158 {
44159 continue;
44160 }
44161 Vector2 vector3 = new Vector2(1f);
44162 Vector2 vector4 = FontAssets.MouseText.Value.MeasureString(text2);
44163 if (vector4.X > num4)
44164 {
44165 vector3.X = num4 / vector4.X;
44166 }
44167 if (vector3.X < 0.58f)
44168 {
44169 vector3.Y = 1f - vector3.X / 3f;
44170 }
44171 for (int n = 0; n < 5; n++)
44172 {
44173 int num28 = 0;
44174 int num29 = 0;
44176 if (n == 0)
44177 {
44178 num28 = -2;
44179 }
44180 if (n == 1)
44181 {
44182 num28 = 2;
44183 }
44184 if (n == 2)
44185 {
44186 num29 = -2;
44187 }
44188 if (n == 3)
44189 {
44190 num29 = 2;
44191 }
44192 if (n == 4)
44193 {
44195 }
44196 if (i > num2 && i < num2 + 2)
44197 {
44198 color3 = new Microsoft.Xna.Framework.Color(color3.R / 3, color3.G / 3, color3.B / 3, color3.A / 3);
44199 }
44200 int num30 = 22;
44201 if (screenHeight < 650)
44202 {
44203 num30 = 20;
44204 }
44206 }
44207 }
44208 if (!string.IsNullOrEmpty(text))
44209 {
44210 if (playerInventory)
44211 {
44212 player[myPlayer].mouseInterface = true;
44213 }
44214 MouseText(text, 0, 0);
44215 }
44216 }
44217
44219 {
44220 for (int i = 0; i < NPCID.Sets.GoldCrittersCollection.Count; i++)
44221 {
44223 if (npc.type == num)
44224 {
44227 byte a = (infoTextShadowColor.A = mouseTextColor);
44228 infoTextColor.A = a;
44229 break;
44230 }
44231 }
44232 }
44233
44234 private static void GetInfoAccIconPosition(int drawnCount, int StartX, out int X, out int Y)
44235 {
44236 if (!playerInventory)
44237 {
44238 X = screenWidth - 280;
44239 Y = -32;
44240 if (mapStyle == 1 && mapEnabled)
44241 {
44242 Y += 261;
44243 }
44244 }
44246 {
44247 X = screenWidth - 280 + 20 * drawnCount - 10;
44248 Y = 94;
44249 if (mapStyle == 1 && mapEnabled)
44250 {
44251 Y += 261;
44252 }
44253 }
44254 else
44255 {
44256 int num = (int)(52f * inventoryScale);
44257 float num2 = 0.85f;
44258 int num3 = (int)(52f * num2);
44261 int num4 = (int)Math.Ceiling((float)nPCS_IconsTotal / (float)nPCS_IconsPerColumn);
44264 int num7 = Math.Max(0, num4 - 4);
44265 if (num4 >= 4 && num6 < 5)
44266 {
44267 num7++;
44268 }
44269 int num8 = num7 * (num3 + 4);
44270 if (EquipPage != 1)
44271 {
44272 num8 = 0;
44273 }
44274 X = 697 - num * 4 + screenWidth - 800 + 20 * (drawnCount % 2) - num8;
44275 Y = 114 + mH + num * 7 + num / 2 + 20 * (drawnCount / 2) + 8 * (drawnCount / 4) - 20;
44276 if (EquipPage == 2)
44277 {
44278 X += num + num / 2;
44279 Y -= num;
44280 }
44281 }
44282 X += StartX;
44283 }
44284
44286 {
44287 if (!playerInventory)
44288 {
44289 return;
44290 }
44291 string.IsNullOrEmpty(npcChatText);
44292 if (false || Main.player[myPlayer].sign >= 0)
44293 {
44294 return;
44295 }
44296 int num = 0;
44298 int[] builderAccStatus = Main.player[myPlayer].builderAccStatus;
44300 start.Y += 24 * torchGodIcons;
44301 bool flag = totalDrawnIcons >= 10;
44302 int num2 = 10;
44303 for (int i = 0; i < num2; i++)
44304 {
44305 int num3 = i - 2;
44306 switch (i)
44307 {
44308 case 0:
44309 num3 = 8;
44310 break;
44311 case 1:
44312 num3 = 9;
44313 break;
44314 }
44319 Vector2 vector = start + new Vector2(0f, num * 24);
44320 if (flag)
44321 {
44322 vector.Y -= 24f;
44323 }
44324 bool flag2 = Utils.CenteredRectangle(vector, new Vector2(14f)).Contains(MouseScreen.ToPoint()) && !PlayerInput.IgnoreMouseInterface;
44326 switch (num3)
44327 {
44328 case 8:
44329 if (!player.InfoAccMechShowWires)
44330 {
44331 continue;
44332 }
44333 rectangle.X = num3 * 16;
44334 color = ((builderAccStatus[num3] == 0) ? color : color2);
44335 if (flag2)
44336 {
44337 player.mouseInterface = true;
44338 MouseText((builderAccStatus[num3] == 0) ? Language.GetTextValue("GameUI.WireModeForced") : Language.GetTextValue("GameUI.WireModeNormal"), 0, 0);
44339 mouseText = true;
44340 }
44341 if (flag3)
44342 {
44343 builderAccStatus[num3] = ((builderAccStatus[num3] == 0) ? 1 : 0);
44345 mouseLeftRelease = false;
44346 }
44347 break;
44348 case 0:
44349 if (!player.rulerLine)
44350 {
44351 continue;
44352 }
44353 rectangle.X = num3 * 16;
44354 color = ((builderAccStatus[num3] == 0) ? color : color2);
44355 if (flag2)
44356 {
44357 player.mouseInterface = true;
44358 MouseText((builderAccStatus[num3] == 0) ? Language.GetTextValue("GameUI.RulerOn") : Language.GetTextValue("GameUI.RulerOff"), 0, 0);
44359 mouseText = true;
44360 }
44361 if (flag3)
44362 {
44363 builderAccStatus[num3] = ((builderAccStatus[num3] == 0) ? 1 : 0);
44365 mouseLeftRelease = false;
44366 }
44367 break;
44368 case 1:
44369 if (!player.rulerGrid)
44370 {
44371 continue;
44372 }
44373 rectangle.X = num3 * 16;
44374 color = ((builderAccStatus[num3] == 0) ? color : color2);
44375 if (flag2)
44376 {
44377 player.mouseInterface = true;
44378 MouseText((builderAccStatus[num3] == 0) ? Language.GetTextValue("GameUI.MechanicalRulerOn") : Language.GetTextValue("GameUI.MechanicalRulerOff"), 0, 0);
44379 mouseText = true;
44380 }
44381 if (flag3)
44382 {
44383 builderAccStatus[num3] = ((builderAccStatus[num3] == 0) ? 1 : 0);
44385 mouseLeftRelease = false;
44386 }
44387 break;
44388 case 3:
44389 if (!player.autoPaint)
44390 {
44391 continue;
44392 }
44393 rectangle.X = num3 * 16;
44394 color = ((builderAccStatus[num3] == 0) ? color : color2);
44395 if (flag2)
44396 {
44397 player.mouseInterface = true;
44398 MouseText((builderAccStatus[num3] == 0) ? Language.GetTextValue("GameUI.PaintSprayerOn") : Language.GetTextValue("GameUI.PaintSprayerOff"), 0, 0);
44399 mouseText = true;
44400 }
44401 if (flag3)
44402 {
44403 builderAccStatus[num3] = ((builderAccStatus[num3] == 0) ? 1 : 0);
44405 mouseLeftRelease = false;
44406 }
44407 break;
44408 case 2:
44409 if (!player.autoActuator)
44410 {
44411 continue;
44412 }
44413 rectangle.X = num3 * 16;
44414 color = ((builderAccStatus[num3] == 0) ? color : color2);
44415 if (flag2)
44416 {
44417 player.mouseInterface = true;
44418 MouseText((builderAccStatus[num3] == 0) ? Language.GetTextValue("GameUI.ActuationDeviceOn") : Language.GetTextValue("GameUI.ActuationDeviceOff"), 0, 0);
44419 mouseText = true;
44420 }
44421 if (flag3)
44422 {
44423 builderAccStatus[num3] = ((builderAccStatus[num3] == 0) ? 1 : 0);
44425 mouseLeftRelease = false;
44426 }
44427 break;
44428 case 4:
44429 case 5:
44430 case 6:
44431 case 7:
44432 case 9:
44433 if (!player.InfoAccMechShowWires)
44434 {
44435 continue;
44436 }
44437 rectangle.X = num3 * 16;
44438 color = ((builderAccStatus[num3] == 0) ? color : ((builderAccStatus[num3] == 1) ? color2 : ((builderAccStatus[num3] == 2) ? color2.MultiplyRGBA(new Microsoft.Xna.Framework.Color(0.66f, 0.66f, 0.66f, 0.66f)) : color2.MultiplyRGBA(new Microsoft.Xna.Framework.Color(0.33f, 0.33f, 0.33f, 0.33f)))));
44439 if (flag2)
44440 {
44441 player.mouseInterface = true;
44442 string arg = "";
44443 switch (num3)
44444 {
44445 case 4:
44446 arg = Language.GetTextValue("Game.RedWires");
44447 break;
44448 case 5:
44449 arg = Language.GetTextValue("Game.BlueWires");
44450 break;
44451 case 6:
44452 arg = Language.GetTextValue("Game.GreenWires");
44453 break;
44454 case 7:
44455 arg = Language.GetTextValue("Game.YellowWires");
44456 break;
44457 case 9:
44458 arg = Language.GetTextValue("Game.Actuators");
44459 break;
44460 }
44461 string arg2 = "";
44462 switch (builderAccStatus[num3])
44463 {
44464 case 0:
44465 arg2 = Language.GetTextValue("GameUI.Bright");
44466 break;
44467 case 1:
44468 arg2 = Language.GetTextValue("GameUI.Normal");
44469 break;
44470 case 2:
44471 arg2 = Language.GetTextValue("GameUI.Faded");
44472 break;
44473 case 3:
44474 arg2 = Language.GetTextValue("GameUI.Hidden");
44475 break;
44476 }
44477 MouseText($"{arg}: {arg2}", 0, 0);
44478 mouseText = true;
44479 }
44480 if (flag3)
44481 {
44482 builderAccStatus[num3]++;
44483 if (builderAccStatus[num3] >= 3)
44484 {
44485 builderAccStatus[num3] = 0;
44486 }
44488 mouseLeftRelease = false;
44489 }
44490 break;
44491 case 11:
44492 continue;
44493 }
44494 spriteBatch.Draw(value, vector, rectangle, color, 0f, rectangle.Size() / 2f, 1f, SpriteEffects.None, 0f);
44495 if (flag2)
44496 {
44497 spriteBatch.Draw(TextureAssets.InfoIcon[13].Value, vector, null, OurFavoriteColor, 0f, TextureAssets.InfoIcon[13].Value.Size() / 2f, 1f, SpriteEffects.None, 0f);
44498 }
44500 num++;
44501 }
44502 DrawBlockReplacementIcon(0, 0, flag, 0);
44503 num++;
44504 if (player.unlockedBiomeTorches)
44505 {
44506 DrawTorchBiomeSwapIcon(0, 0, flag, 1);
44507 num++;
44508 }
44509 UILinkPointNavigator.Shortcuts.BUILDERACCCOUNT = num;
44510 }
44511
44513 {
44515 torchGodIcons = (plr.unlockedBiomeTorches ? 1 : 0);
44516 totalDrawnIcons = plr.InfoAccMechShowWires.ToInt() * 6 + plr.rulerLine.ToInt() + plr.rulerGrid.ToInt() + plr.autoActuator.ToInt() + plr.autoPaint.ToInt() + blockReplaceIcons + torchGodIcons;
44517 }
44518
44519 public static void CheckInvasionProgressDisplay()
44520 {
44521 if (invasionProgressMode != 2)
44522 {
44524 return;
44525 }
44526 bool flag = false;
44529 int num = 5000;
44530 int num2 = 0;
44531 for (int i = 0; i < 200; i++)
44532 {
44533 if (!npc[i].active)
44534 {
44535 continue;
44536 }
44537 num2 = 0;
44538 switch (npc[i].type)
44539 {
44540 case 338:
44541 case 339:
44542 case 340:
44543 case 341:
44544 case 342:
44545 case 343:
44546 case 344:
44547 case 345:
44548 case 346:
44549 case 347:
44550 case 348:
44551 case 349:
44552 case 350:
44553 num2 = 1;
44554 break;
44555 case 305:
44556 case 306:
44557 case 307:
44558 case 308:
44559 case 309:
44560 case 310:
44561 case 311:
44562 case 312:
44563 case 313:
44564 case 314:
44565 case 315:
44566 case 325:
44567 case 326:
44568 case 327:
44569 case 329:
44570 case 330:
44571 num2 = 2;
44572 break;
44573 case 26:
44574 case 27:
44575 case 28:
44576 case 29:
44577 case 111:
44578 num2 = 4;
44579 break;
44580 case 143:
44581 case 144:
44582 case 145:
44583 num2 = 5;
44584 break;
44585 case 212:
44586 case 213:
44587 case 214:
44588 case 215:
44589 case 216:
44590 case 491:
44591 num2 = 6;
44592 break;
44593 case 381:
44594 case 382:
44595 case 383:
44596 case 385:
44597 case 386:
44598 case 388:
44599 case 389:
44600 case 390:
44601 case 391:
44602 case 395:
44603 num2 = 7;
44604 break;
44605 case 548:
44606 case 549:
44607 case 551:
44608 case 552:
44609 case 553:
44610 case 554:
44611 case 555:
44612 case 556:
44613 case 557:
44614 case 558:
44615 case 559:
44616 case 560:
44617 case 561:
44618 case 562:
44619 case 563:
44620 case 564:
44621 case 565:
44622 case 568:
44623 case 569:
44624 case 570:
44625 case 571:
44626 case 572:
44627 case 573:
44628 case 574:
44629 case 575:
44630 case 576:
44631 case 577:
44632 case 578:
44633 num2 = 3;
44634 break;
44635 }
44636 if (num2 != 0 && (num2 != 1 || (!((double)player.position.Y > worldSurface * 16.0) && !dayTime && snowMoon)) && (num2 != 2 || (!((double)player.position.Y > worldSurface * 16.0) && !dayTime && pumpkinMoon)) && (num2 != 3 || DD2Event.Ongoing) && (num2 <= 3 || (!((double)player.position.Y > worldSurface * 16.0) && invasionType == num2 - 3)))
44637 {
44638 Microsoft.Xna.Framework.Rectangle value = new Microsoft.Xna.Framework.Rectangle((int)(npc[i].position.X + (float)(npc[i].width / 2)) - num, (int)(npc[i].position.Y + (float)(npc[i].height / 2)) - num, num * 2, num * 2);
44639 if (rectangle.Intersects(value))
44640 {
44641 flag = true;
44642 break;
44643 }
44644 }
44645 }
44647 if (!flag || invasionProgressIcon != 0)
44648 {
44649 return;
44650 }
44651 int waveNumber = NPC.waveNumber;
44652 if (snowMoon)
44653 {
44655 ReportInvasionProgress((int)NPC.waveKills, progressMax, 1, waveNumber);
44656 return;
44657 }
44658 if (pumpkinMoon)
44659 {
44661 ReportInvasionProgress((int)NPC.waveKills, progressMax2, 2, waveNumber);
44662 return;
44663 }
44664 if (DD2Event.Ongoing)
44665 {
44667 return;
44668 }
44669 int progressMax3 = 1;
44670 if (invasionType != 0 && invasionSizeStart != 0)
44671 {
44673 }
44675 }
44676
44677 public static void SyncAnInvasion(int toWho)
44678 {
44679 int waveNumber = NPC.waveNumber;
44680 if (snowMoon)
44681 {
44682 int num = (new int[21]
44683 {
44684 0, 25, 15, 10, 30, 100, 160, 180, 200, 250,
44685 300, 375, 450, 525, 675, 850, 1025, 1325, 1550, 2000,
44686 0
44687 })[waveNumber];
44688 NetMessage.SendData(78, toWho, -1, null, (int)NPC.waveKills, num, 1f, waveNumber);
44689 }
44690 else if (pumpkinMoon)
44691 {
44692 int num2 = (new int[16]
44693 {
44694 0, 25, 40, 50, 80, 100, 160, 180, 200, 250,
44695 300, 375, 450, 525, 675, 0
44696 })[waveNumber];
44697 NetMessage.SendData(78, toWho, -1, null, (int)NPC.waveKills, num2, 2f, waveNumber);
44698 }
44699 else if (DD2Event.Ongoing)
44700 {
44702 }
44703 else if (invasionType > 0)
44704 {
44705 int num3 = 1;
44706 if (invasionType != 0 && invasionSizeStart != 0)
44707 {
44709 }
44711 }
44712 }
44713
44722
44723 public static void DrawInvasionProgress()
44724 {
44725 if (invasionProgress == -1)
44726 {
44727 return;
44728 }
44730 {
44732 }
44734 {
44736 }
44738 {
44739 invasionProgressAlpha += 0.05f;
44740 }
44741 else
44742 {
44743 invasionProgressAlpha -= 0.05f;
44744 }
44745 if (invasionProgressMode == 0)
44746 {
44749 }
44750 if (invasionProgressAlpha < 0f)
44751 {
44753 }
44754 if (invasionProgressAlpha > 1f)
44755 {
44757 }
44758 if (invasionProgressAlpha <= 0f)
44759 {
44760 return;
44761 }
44762 float num = 0.5f + invasionProgressAlpha * 0.5f;
44764 string text = "";
44766 if (invasionProgressIcon == 1)
44767 {
44768 value = TextureAssets.Extra[8].Value;
44769 text = Lang.inter[83].Value;
44770 c = new Microsoft.Xna.Framework.Color(64, 109, 164) * 0.5f;
44771 }
44772 else if (invasionProgressIcon == 2)
44773 {
44774 value = TextureAssets.Extra[12].Value;
44775 text = Lang.inter[84].Value;
44776 c = new Microsoft.Xna.Framework.Color(112, 86, 114) * 0.5f;
44777 }
44778 else if (invasionProgressIcon == 3)
44779 {
44780 value = TextureAssets.Extra[79].Value;
44781 text = Language.GetTextValue("DungeonDefenders2.InvasionProgressTitle");
44782 c = new Microsoft.Xna.Framework.Color(88, 0, 160) * 0.5f;
44783 }
44784 else if (invasionProgressIcon == 7)
44785 {
44786 value = TextureAssets.Extra[10].Value;
44787 text = Lang.inter[85].Value;
44788 c = new Microsoft.Xna.Framework.Color(165, 160, 155) * 0.5f;
44789 }
44790 else if (invasionProgressIcon == 6)
44791 {
44792 value = TextureAssets.Extra[11].Value;
44793 text = Lang.inter[86].Value;
44794 c = new Microsoft.Xna.Framework.Color(148, 122, 72) * 0.5f;
44795 }
44796 else if (invasionProgressIcon == 5)
44797 {
44798 value = TextureAssets.Extra[7].Value;
44799 text = Lang.inter[87].Value;
44800 c = new Microsoft.Xna.Framework.Color(173, 135, 140) * 0.5f;
44801 }
44802 else if (invasionProgressIcon == 4)
44803 {
44804 value = TextureAssets.Extra[9].Value;
44805 text = Lang.inter[88].Value;
44806 c = new Microsoft.Xna.Framework.Color(94, 72, 131) * 0.5f;
44807 }
44808 if (invasionProgressWave > 0)
44809 {
44810 int num2 = (int)(200f * num);
44811 int num3 = (int)(45f * num);
44812 Vector2 vector = new Vector2(screenWidth - 120, screenHeight - 40);
44813 Utils.DrawInvBG(R: new Microsoft.Xna.Framework.Rectangle((int)vector.X - num2 / 2, (int)vector.Y - num3 / 2, num2, num3), sb: spriteBatch, c: new Microsoft.Xna.Framework.Color(63, 65, 151, 255) * 0.785f);
44814 string text2 = "";
44815 text2 = Language.GetTextValue(arg1: (invasionProgressMax != 0) ? ((int)((float)invasionProgress * 100f / (float)invasionProgressMax) + "%") : Language.GetTextValue("Game.InvasionPoints", invasionProgress), key: "Game.WaveMessage", arg0: invasionProgressWave);
44817 _ = TextureAssets.ColorBlip.Value;
44818 float num4 = MathHelper.Clamp((float)invasionProgress / (float)invasionProgressMax, 0f, 1f);
44819 if (invasionProgressMax == 0)
44820 {
44821 num4 = 1f;
44822 }
44823 float num5 = 169f * num;
44824 float num6 = 8f * num;
44825 Vector2 vector2 = vector + Vector2.UnitY * num6 + Vector2.UnitX * 1f;
44827 spriteBatch.Draw(value2, vector, null, Microsoft.Xna.Framework.Color.White * invasionProgressAlpha, 0f, new Vector2(value2.Width / 2, 0f), num, SpriteEffects.None, 0f);
44828 vector2 += Vector2.UnitX * (num4 - 0.5f) * num5;
44829 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector2, new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1), new Microsoft.Xna.Framework.Color(255, 241, 51) * invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(num5 * num4, num6), SpriteEffects.None, 0f);
44830 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector2, new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1), new Microsoft.Xna.Framework.Color(255, 165, 0, 127) * invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, num6), SpriteEffects.None, 0f);
44831 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector2, new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1), Microsoft.Xna.Framework.Color.Black * invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(num5 * (1f - num4), num6), SpriteEffects.None, 0f);
44832 }
44833 else
44834 {
44835 int num7 = (int)(200f * num);
44836 int num8 = (int)(45f * num);
44837 Vector2 vector3 = new Vector2(screenWidth - 120, screenHeight - 40);
44838 Utils.DrawInvBG(R: new Microsoft.Xna.Framework.Rectangle((int)vector3.X - num7 / 2, (int)vector3.Y - num8 / 2, num7, num8), sb: spriteBatch, c: new Microsoft.Xna.Framework.Color(63, 65, 151, 255) * 0.785f);
44839 string text3 = "";
44840 text3 = ((invasionProgressMax != 0) ? ((int)((float)invasionProgress * 100f / (float)invasionProgressMax) + "%") : invasionProgress.ToString());
44841 text3 = Language.GetTextValue("Game.WaveCleared", text3);
44843 _ = TextureAssets.ColorBlip.Value;
44844 if (invasionProgressMax != 0)
44845 {
44846 spriteBatch.Draw(value3, vector3, null, Microsoft.Xna.Framework.Color.White * invasionProgressAlpha, 0f, new Vector2(value3.Width / 2, 0f), num, SpriteEffects.None, 0f);
44847 float num9 = MathHelper.Clamp((float)invasionProgress / (float)invasionProgressMax, 0f, 1f);
44848 Vector2 vector4 = FontAssets.MouseText.Value.MeasureString(text3);
44849 float num10 = num;
44850 if (vector4.Y > 22f)
44851 {
44852 num10 *= 22f / vector4.Y;
44853 }
44854 float num11 = 169f * num;
44855 float num12 = 8f * num;
44856 Vector2 vector5 = vector3 + Vector2.UnitY * num12 + Vector2.UnitX * 1f;
44857 Utils.DrawBorderString(spriteBatch, text3, vector5 + new Vector2(0f, -4f), Microsoft.Xna.Framework.Color.White * invasionProgressAlpha, num10, 0.5f, 1f);
44858 vector5 += Vector2.UnitX * (num9 - 0.5f) * num11;
44859 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector5, new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1), new Microsoft.Xna.Framework.Color(255, 241, 51) * invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(num11 * num9, num12), SpriteEffects.None, 0f);
44860 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector5, new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1), new Microsoft.Xna.Framework.Color(255, 165, 0, 127) * invasionProgressAlpha, 0f, new Vector2(1f, 0.5f), new Vector2(2f, num12), SpriteEffects.None, 0f);
44861 spriteBatch.Draw(TextureAssets.MagicPixel.Value, vector5, new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1), Microsoft.Xna.Framework.Color.Black * invasionProgressAlpha, 0f, new Vector2(0f, 0.5f), new Vector2(num11 * (1f - num9), num12), SpriteEffects.None, 0f);
44862 }
44863 }
44864 Vector2 vector6 = FontAssets.MouseText.Value.MeasureString(text);
44865 float num13 = 120f;
44866 if (vector6.X > 200f)
44867 {
44868 num13 += vector6.X - 200f;
44869 }
44872 spriteBatch.Draw(value, r3.Left() + Vector2.UnitX * num * 8f, null, Microsoft.Xna.Framework.Color.White * invasionProgressAlpha, 0f, new Vector2(0f, value.Height / 2), num * 0.8f, SpriteEffects.None, 0f);
44873 Utils.DrawBorderString(spriteBatch, text, r3.Right() + Vector2.UnitX * num * -22f, Microsoft.Xna.Framework.Color.White * invasionProgressAlpha, num * 0.9f, 1f, 0.4f);
44874 }
44875
44876 protected void QuitGame()
44877 {
44878 SaveSettings();
44879 if (!dedServ)
44880 {
44882 }
44883 Assets.TransferCompletedAssets();
44884 Exit();
44885 }
44886
44887 private void Main_Exiting(object sender, EventArgs e)
44888 {
44890 }
44891
44892 private static void TryDisposingEverything()
44893 {
44895 CaptureManager.Instance.Dispose();
44896 audioSystem.Dispose();
44897 }
44898
44900 {
44901 int num = 0;
44902 int num2 = 0;
44903 int num3 = 0;
44904 while (num + num3 + num2 <= 150)
44905 {
44906 num = rand.Next(256);
44907 num2 = rand.Next(256);
44908 num3 = rand.Next(256);
44909 }
44910 return new Microsoft.Xna.Framework.Color(num, num2, num3, 255);
44911 }
44912
44914 {
44915 return hslToRgb(hslVector.X, hslVector.Y, hslVector.Z);
44916 }
44917
44918 public static Microsoft.Xna.Framework.Color hslToRgb(float Hue, float Saturation, float Luminosity, byte a = byte.MaxValue)
44919 {
44920 byte r;
44921 byte g;
44922 byte b;
44923 if (Saturation == 0f)
44924 {
44925 r = (byte)Math.Round((double)Luminosity * 255.0);
44926 g = (byte)Math.Round((double)Luminosity * 255.0);
44927 b = (byte)Math.Round((double)Luminosity * 255.0);
44928 }
44929 else
44930 {
44931 double num = Hue;
44932 double num2 = ((!((double)Luminosity < 0.5)) ? ((double)(Luminosity + Saturation - Luminosity * Saturation)) : ((double)Luminosity * (1.0 + (double)Saturation)));
44933 double t = 2.0 * (double)Luminosity - num2;
44934 double c = num + 1.0 / 3.0;
44935 double c2 = num;
44936 double c3 = num - 1.0 / 3.0;
44937 c = hue2rgb(c, t, num2);
44938 c2 = hue2rgb(c2, t, num2);
44939 double num3 = hue2rgb(c3, t, num2);
44940 r = (byte)Math.Round(c * 255.0);
44941 g = (byte)Math.Round(c2 * 255.0);
44942 b = (byte)Math.Round(num3 * 255.0);
44943 }
44944 return new Microsoft.Xna.Framework.Color(r, g, b, a);
44945 }
44946
44947 public static double hue2rgb(double c, double t1, double t2)
44948 {
44949 if (c < 0.0)
44950 {
44951 c += 1.0;
44952 }
44953 if (c > 1.0)
44954 {
44955 c -= 1.0;
44956 }
44957 if (6.0 * c < 1.0)
44958 {
44959 return t1 + (t2 - t1) * 6.0 * c;
44960 }
44961 if (2.0 * c < 1.0)
44962 {
44963 return t2;
44964 }
44965 if (3.0 * c < 2.0)
44966 {
44967 return t1 + (t2 - t1) * (2.0 / 3.0 - c) * 6.0;
44968 }
44969 return t1;
44970 }
44971
44973 {
44974 float num = (int)newColor.R;
44975 float num2 = (int)newColor.G;
44976 float num3 = (int)newColor.B;
44977 num /= 255f;
44978 num2 /= 255f;
44979 num3 /= 255f;
44980 float val = Math.Max(num, num2);
44981 val = Math.Max(val, num3);
44982 float val2 = Math.Min(num, num2);
44983 val2 = Math.Min(val2, num3);
44984 float num4 = 0f;
44985 float num5 = (val + val2) / 2f;
44986 float y;
44987 if (val == val2)
44988 {
44989 num4 = (y = 0f);
44990 }
44991 else
44992 {
44993 float num6 = val - val2;
44994 y = (((double)num5 > 0.5) ? (num6 / (2f - val - val2)) : (num6 / (val + val2)));
44995 if (val == num)
44996 {
44997 num4 = (num2 - num3) / num6 + (float)((num2 < num3) ? 6 : 0);
44998 }
44999 if (val == num2)
45000 {
45001 num4 = (num3 - num) / num6 + 2f;
45002 }
45003 if (val == num3)
45004 {
45005 num4 = (num - num2) / num6 + 4f;
45006 }
45007 num4 /= 6f;
45008 }
45009 return new Vector3(num4, y, num5);
45010 }
45011
45012 public static void DrawCursor(Vector2 bonus, bool smart = false)
45013 {
45015 {
45016 return;
45017 }
45018 if (player[myPlayer].dead || player[myPlayer].mouseInterface)
45019 {
45022 }
45024 if (!gameMenu && LocalPlayer.hasRainbowCursor)
45025 {
45026 color = hslToRgb(GlobalTimeWrappedHourly * 0.25f % 1f, 1f, 0.5f);
45027 }
45028 bool flag = UILinkPointNavigator.Available && !PlayerInput.InBuildingMode;
45030 {
45032 {
45033 return;
45034 }
45035 Vector2 t = new Vector2(mouseX, mouseY);
45037 bool flag2 = SmartCursorIsUsed;
45038 if (flag2)
45039 {
45040 PlayerInput.smartSelectPointer.UpdateCenter(ScreenSize.ToVector2() / 2f);
45041 t2 = PlayerInput.smartSelectPointer.GetPointerPosition();
45042 if (Vector2.Distance(t2, t) < 1f)
45043 {
45044 flag2 = false;
45045 }
45046 else
45047 {
45048 Utils.Swap(ref t, ref t2);
45049 }
45050 }
45051 float num = 1f;
45052 if (flag2)
45053 {
45054 num = 0.3f;
45055 color = Microsoft.Xna.Framework.Color.White * GamepadCursorAlpha;
45056 int num2 = 17;
45057 int frameX = 0;
45058 spriteBatch.Draw(TextureAssets.Cursors[num2].Value, t2 + bonus, TextureAssets.Cursors[num2].Frame(1, 1, frameX), color, (float)Math.PI / 2f * GlobalTimeWrappedHourly, TextureAssets.Cursors[num2].Frame(1, 1, frameX).Size() / 2f, cursorScale, SpriteEffects.None, 0f);
45059 }
45060 if (smart && !flag)
45061 {
45062 color = Microsoft.Xna.Framework.Color.White * GamepadCursorAlpha * num;
45063 int num3 = 13;
45064 int frameX2 = 0;
45065 spriteBatch.Draw(TextureAssets.Cursors[num3].Value, t + bonus, TextureAssets.Cursors[num3].Frame(2, 1, frameX2), color, 0f, TextureAssets.Cursors[num3].Frame(2, 1, frameX2).Size() / 2f, cursorScale, SpriteEffects.None, 0f);
45066 }
45067 else
45068 {
45070 int num4 = 15;
45071 spriteBatch.Draw(TextureAssets.Cursors[num4].Value, new Vector2(mouseX, mouseY) + bonus, null, color, 0f, TextureAssets.Cursors[num4].Value.Size() / 2f, cursorScale, SpriteEffects.None, 0f);
45072 }
45073 }
45074 else
45075 {
45076 int num5 = smart.ToInt();
45077 spriteBatch.Draw(TextureAssets.Cursors[num5].Value, new Vector2(mouseX, mouseY) + bonus + Vector2.One, null, new Microsoft.Xna.Framework.Color((int)((float)(int)color.R * 0.2f), (int)((float)(int)color.G * 0.2f), (int)((float)(int)color.B * 0.2f), (int)((float)(int)color.A * 0.5f)), 0f, default(Vector2), cursorScale * 1.1f, SpriteEffects.None, 0f);
45078 spriteBatch.Draw(TextureAssets.Cursors[num5].Value, new Vector2(mouseX, mouseY) + bonus, null, color, 0f, default(Vector2), cursorScale, SpriteEffects.None, 0f);
45079 }
45080 }
45081
45082 public static void ClearSmartInteract()
45083 {
45086 SmartInteractNPC = -1;
45087 SmartInteractProj = -1;
45090 }
45091
45092 public static Vector2 DrawThickCursor(bool smart = false)
45093 {
45094 if (ThickMouse)
45095 {
45098 {
45099 return Vector2.Zero;
45100 }
45102 {
45103 return Vector2.Zero;
45104 }
45105 if (showGamepadCursor && player[myPlayer].dead && !player[myPlayer].ghost && !gameMenu)
45106 {
45107 return Vector2.Zero;
45108 }
45109 bool flag = UILinkPointNavigator.Available && !PlayerInput.InBuildingMode;
45111 int num = 11;
45112 num += smart.ToInt();
45113 for (int i = 0; i < 4; i++)
45114 {
45116 switch (i)
45117 {
45118 case 0:
45119 vector = new Vector2(0f, 1f);
45120 break;
45121 case 1:
45122 vector = new Vector2(1f, 0f);
45123 break;
45124 case 2:
45125 vector = new Vector2(0f, -1f);
45126 break;
45127 case 3:
45128 vector = new Vector2(-1f, 0f);
45129 break;
45130 }
45131 vector *= 1f;
45132 vector += Vector2.One * 2f;
45133 Vector2 origin = new Vector2(2f);
45135 float scale = cursorScale * 1.1f;
45137 {
45138 if (smart && !flag)
45139 {
45140 num = 13;
45141 int frameX = 0;
45142 vector = Vector2.One;
45143 sourceRectangle = TextureAssets.Cursors[num].Frame(2, 1, frameX);
45144 origin = TextureAssets.Cursors[num].Frame(2, 1, frameX).Size() / 2f;
45146 }
45147 else
45148 {
45149 num = 15;
45150 vector = Vector2.One;
45151 origin = TextureAssets.Cursors[num].Value.Size() / 2f;
45152 }
45153 }
45154 spriteBatch.Draw(TextureAssets.Cursors[num].Value, new Vector2(mouseX, mouseY) + vector, sourceRectangle, mouseBorderColor, 0f, origin, scale, SpriteEffects.None, 0f);
45155 }
45156 return new Vector2(2f);
45157 }
45158 return Vector2.Zero;
45159 }
45160
45161 private void OnCharacterNamed(string text)
45162 {
45163 PendingPlayer.name = text.Trim();
45165 LoadPlayers();
45166 menuMode = 1;
45167 }
45168
45169 private void OnSeedSelected(string text)
45170 {
45171 text = text.Trim();
45172 if (text.Length == 0)
45173 {
45174 ActiveWorldFileData.SetSeedToRandom();
45175 }
45176 else
45177 {
45178 ActiveWorldFileData.SetSeed(text);
45179 }
45180 menuMode = 10;
45182 }
45183
45184 private void OnWorldNamed(string text)
45185 {
45186 menuMode = 10;
45187 worldName = text.Trim();
45189 menuMode = 5000;
45190 }
45191
45192 private static Action CreateGoToMenuEvent(int menu)
45193 {
45194 return delegate
45195 {
45196 menuMode = menu;
45197 UILinkPointNavigator.Shortcuts.FANCYUI_SPECIAL_INSTRUCTIONS = 0;
45198 };
45199 }
45200
45201 public static void GoToWorldSelect()
45202 {
45203 menuMode = 888;
45204 MenuUI.SetState(_worldSelectMenu);
45205 }
45206
45207 public static void StartClientGameplay()
45208 {
45209 menuMode = 10;
45211 }
45212
45213 public static void ReleaseHostAndPlayProcess()
45214 {
45215 if (tServer != null)
45216 {
45217 tServer = null;
45218 }
45219 }
45220
45221 private string SanitizePathArgument(string argumentName, string argumentPath)
45222 {
45223 string input = Regex.Replace(argumentPath, "(\\\\*)\"", "$1$1\\\"");
45224 string text = "\"" + Regex.Replace(input, "(\\\\+)$", "$1$1") + "\"";
45225 return " -" + argumentName + " " + text;
45226 }
45227
45229 {
45230 if (!IsEngineLoaded)
45231 {
45232 IsEngineLoaded = true;
45233 if (Main.OnEngineLoad != null)
45234 {
45236 }
45237 }
45240 int num = menuMode;
45241 if (menuMode <= 1 && slimeRain)
45242 {
45243 StopSlimeRain();
45244 }
45245 render = false;
45247 drawingPlayerChat = false;
45248 chatMonitor.Clear();
45250 screenPosition.Y = (float)(worldSurface * 16.0 - (double)screenHeight);
45251 MenuXMovement = 4f;
45253 {
45254 playOldTile = true;
45255 if (starGame)
45256 {
45257 playOldTile = false;
45258 }
45259 }
45260 screenPosition.X += MenuXMovement;
45261 if (screenPosition.X > 2.1474835E+09f)
45262 {
45263 screenPosition.X = 0f;
45264 }
45265 if (screenPosition.X < -2.1474835E+09f)
45266 {
45267 screenPosition.X = 0f;
45268 }
45269 Star.UpdateStars();
45271 DrawFPS();
45272 background = 0;
45273 byte b = (byte)((255 + tileColor.R * 2) / 3);
45276 {
45278 if ((double)logoRotation < 3.04)
45279 {
45280 logoRotation += logoRotationSpeed * 0.0016f;
45281 if (logoRotationSpeed < 0f)
45282 {
45283 logoRotationSpeed = 0f;
45284 }
45285 }
45286 if ((double)logoRotation > 3.22)
45287 {
45289 }
45290 else if ((double)logoRotation < 3.06)
45291 {
45293 }
45294 if (logoRotationSpeed < 20f && logoRotationDirection == 1f)
45295 {
45296 logoRotationSpeed += 1f;
45297 }
45298 else if (logoRotationSpeed > -20f && logoRotationDirection == -1f)
45299 {
45300 logoRotationSpeed -= 1f;
45301 }
45302 logoScale += logoScaleSpeed * 9E-05f;
45303 if (logoScale > 1f)
45304 {
45305 logoScaleDirection = -1f;
45306 }
45307 else if (logoScale < 0.9f)
45308 {
45309 logoScaleDirection = 1f;
45310 }
45311 if (logoScaleSpeed < 50f && logoScaleDirection == 1f)
45312 {
45313 logoScaleSpeed += 1f;
45314 }
45315 else if (logoScaleSpeed > -50f && logoScaleDirection == -1f)
45316 {
45317 logoScaleSpeed -= 1f;
45318 }
45319 }
45320 else if (WorldGen.drunkWorldGen)
45321 {
45323 if (logoRotationSpeed > 0f)
45324 {
45325 logoRotationSpeed += 1500f;
45326 }
45327 else
45328 {
45329 logoRotationSpeed -= 1500f;
45330 }
45331 logoScale -= 0.05f;
45332 if (logoScale < 0f)
45333 {
45334 logoScale = 0f;
45335 }
45336 }
45337 else
45338 {
45339 if ((double)logoRotation > 0.09)
45340 {
45341 logoRotation += logoRotationSpeed * 0.0016f;
45342 if (logoRotationSpeed > 0f)
45343 {
45344 logoRotationSpeed = 0f;
45345 }
45346 }
45348 if ((double)logoRotation > 0.08)
45349 {
45351 }
45352 else if ((double)logoRotation < -0.08)
45353 {
45355 }
45356 if (logoRotationSpeed < 20f && logoRotationDirection == 1f)
45357 {
45358 logoRotationSpeed += 1f;
45359 }
45360 else if (logoRotationSpeed > -20f && logoRotationDirection == -1f)
45361 {
45362 logoRotationSpeed -= 1f;
45363 }
45364 logoScale += logoScaleSpeed * 9E-06f;
45365 if ((double)logoScale > 1.35)
45366 {
45367 logoScaleDirection = -1f;
45368 }
45369 else if (logoScale < 1f)
45370 {
45371 logoScaleDirection = 1f;
45372 }
45373 if (logoScaleSpeed < 50f && logoScaleDirection == 1f)
45374 {
45375 logoScaleSpeed += 1f;
45376 }
45377 else if (logoScaleSpeed > -50f && logoScaleDirection == -1f)
45378 {
45379 logoScaleSpeed -= 1f;
45380 }
45381 }
45382 Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((byte)((float)(int)color.R * ((float)LogoA / 255f)), (byte)((float)(int)color.G * ((float)LogoA / 255f)), (byte)((float)(int)color.B * ((float)LogoA / 255f)), (byte)((float)(int)color.A * ((float)LogoA / 255f)));
45383 Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color((byte)((float)(int)color.R * ((float)LogoB / 255f)), (byte)((float)(int)color.G * ((float)LogoB / 255f)), (byte)((float)(int)color.B * ((float)LogoB / 255f)), (byte)((float)(int)color.A * ((float)LogoB / 255f)));
45384 if (playOldTile)
45385 {
45386 spriteBatch.Draw(TextureAssets.Logo3.Value, new Vector2(screenWidth / 2, 100f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Logo.Width(), TextureAssets.Logo.Height()), color2, logoRotation, new Vector2(TextureAssets.Logo.Width() / 2, TextureAssets.Logo.Height() / 2), logoScale, SpriteEffects.None, 0f);
45387 spriteBatch.Draw(TextureAssets.Logo4.Value, new Vector2(screenWidth / 2, 100f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Logo.Width(), TextureAssets.Logo.Height()), color3, logoRotation, new Vector2(TextureAssets.Logo.Width() / 2, TextureAssets.Logo.Height() / 2), logoScale, SpriteEffects.None, 0f);
45388 }
45389 else
45390 {
45391 spriteBatch.Draw(TextureAssets.Logo.Value, new Vector2(screenWidth / 2, 100f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Logo.Width(), TextureAssets.Logo.Height()), color2, logoRotation, new Vector2(TextureAssets.Logo.Width() / 2, TextureAssets.Logo.Height() / 2), logoScale, SpriteEffects.None, 0f);
45392 spriteBatch.Draw(TextureAssets.Logo2.Value, new Vector2(screenWidth / 2, 100f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Logo.Width(), TextureAssets.Logo.Height()), color3, logoRotation, new Vector2(TextureAssets.Logo.Width() / 2, TextureAssets.Logo.Height() / 2), logoScale, SpriteEffects.None, 0f);
45393 }
45395 {
45396 LogoA += 2;
45397 if (LogoA > 255)
45398 {
45399 LogoA = 255;
45400 }
45401 LogoB--;
45402 if (LogoB < 0)
45403 {
45404 LogoB = 0;
45405 }
45406 }
45407 else
45408 {
45409 LogoB += 2;
45410 if (LogoB > 255)
45411 {
45412 LogoB = 255;
45413 }
45414 LogoA--;
45415 if (LogoA < 0)
45416 {
45417 LogoA = 0;
45418 LogoT = true;
45419 }
45420 }
45421 int num2 = 250;
45422 int num3 = screenWidth / 2;
45423 int num4 = 80;
45424 int num5 = 0;
45425 int num6 = menuMode;
45426 int num7 = 0;
45427 int num8 = 0;
45428 bool flag = false;
45429 bool flag2 = false;
45430 bool flag3 = false;
45431 int num9 = 0;
45432 bool[] array = new bool[maxMenuItems];
45433 bool[] array2 = new bool[maxMenuItems];
45434 bool[] array3 = new bool[maxMenuItems];
45435 int[] array4 = new int[maxMenuItems];
45436 int[] array5 = new int[maxMenuItems];
45437 byte[] array6 = new byte[maxMenuItems];
45438 float[] array7 = new float[maxMenuItems];
45439 bool[] array8 = new bool[maxMenuItems];
45440 bool flag4 = false;
45441 bool flag5 = UILinkPointNavigator.Shortcuts.BackButtonInUse && !UILinkPointNavigator.Shortcuts.BackButtonLock;
45442 for (int i = 0; i < maxMenuItems; i++)
45443 {
45444 array[i] = false;
45445 array2[i] = false;
45446 array4[i] = 0;
45447 array5[i] = 0;
45448 array7[i] = 1f;
45449 }
45450 string[] array9 = new string[maxMenuItems];
45451 if (menuMode == -1)
45452 {
45453 menuMode = 0;
45454 }
45456 {
45457 GamepadMainMenuHandler.CanRun = true;
45458 }
45459 if (menuMode == 1212)
45460 {
45461 array9[0] = Lang.menu[102].Value;
45462 num4 = 50;
45463 num2 = 200;
45464 num4 = 33;
45465 num2 = 200;
45466 array4[0] = -20;
45467 array4[1] = 25;
45468 array4[2] = 25;
45469 array4[3] = 25;
45470 array4[4] = 25;
45471 array4[5] = 25;
45472 array4[6] = 25;
45473 array4[7] = 25;
45474 array4[8] = 25;
45475 array4[9] = 25;
45476 array[0] = true;
45477 array9[1] = Language.GetTextValue("Language.English");
45478 array9[2] = Language.GetTextValue("Language.German");
45479 array9[3] = Language.GetTextValue("Language.Italian");
45480 array9[4] = Language.GetTextValue("Language.French");
45481 array9[5] = Language.GetTextValue("Language.Spanish");
45482 array9[6] = Language.GetTextValue("Language.Russian");
45483 array9[7] = Language.GetTextValue("Language.Chinese");
45484 array9[8] = Language.GetTextValue("Language.Portuguese");
45485 array9[9] = Language.GetTextValue("Language.Polish");
45486 num5 = 10;
45487 for (int j = 0; j < num5; j++)
45488 {
45489 array7[j] = 0.75f;
45490 }
45491 array7[0] = 1f;
45492 if (selectedMenu >= 1)
45493 {
45494 changeTheTitle = true;
45496 menuMode = 0;
45498 SaveSettings();
45499 }
45500 }
45501 else if (menuMode == 1213)
45502 {
45503 array9[0] = Lang.menu[102].Value;
45504 array[0] = true;
45505 array9[1] = Language.GetTextValue("Language.English");
45506 array9[2] = Language.GetTextValue("Language.German");
45507 array9[3] = Language.GetTextValue("Language.Italian");
45508 array9[4] = Language.GetTextValue("Language.French");
45509 array9[5] = Language.GetTextValue("Language.Spanish");
45510 array9[6] = Language.GetTextValue("Language.Russian");
45511 array9[7] = Language.GetTextValue("Language.Chinese");
45512 array9[8] = Language.GetTextValue("Language.Portuguese");
45513 array9[9] = Language.GetTextValue("Language.Polish");
45514 array9[10] = Lang.menu[5].Value;
45515 num5 = 11;
45516 if (selectedMenu == 10 || flag5)
45517 {
45518 flag5 = false;
45519 menuMode = 11;
45521 }
45522 else if (selectedMenu >= 1)
45523 {
45524 changeTheTitle = true;
45527 SaveSettings();
45528 }
45529 num4 = 33;
45530 num2 = 200;
45531 array4[0] = -20;
45532 array4[10] = 10;
45533 for (int k = 0; k < num5; k++)
45534 {
45535 array7[k] = 0.75f;
45536 }
45537 array7[0] = 0.85f;
45538 array7[10] = 0.95f;
45539 }
45540 else if (netMode == 2)
45541 {
45542 bool flag6 = true;
45543 for (int l = 0; l < 8; l++)
45544 {
45545 if (l >= 255)
45546 {
45547 continue;
45548 }
45549 try
45550 {
45551 array9[l] = Netplay.Clients[l].StatusText;
45552 if (Netplay.Clients[l].IsActive && showSpam)
45553 {
45554 ref string reference = ref array9[l];
45555 reference = reference + " (" + NetMessage.buffer[l].spamCount + ")";
45556 }
45557 }
45558 catch
45559 {
45560 array9[l] = "";
45561 }
45562 array[l] = true;
45563 if (array9[l] != "" && array9[l] != null)
45564 {
45565 flag6 = false;
45566 }
45567 }
45568 if (flag6)
45569 {
45570 array9[0] = Lang.menu[0].Value;
45571 array9[1] = Lang.menu[1].Value + Netplay.ListenPort + ".";
45572 }
45573 num5 = 11;
45574 array9[9] = statusText;
45575 array[9] = true;
45576 num2 = 170;
45577 num4 = 30;
45578 array4[10] = 20;
45579 array4[10] = 40;
45580 array9[10] = Lang.menu[2].Value;
45581 if (selectedMenu == 10 || flag5)
45582 {
45583 flag5 = false;
45584 Netplay.Disconnect = true;
45586 }
45587 }
45588 else if (menuMode == 31)
45589 {
45591 {
45593 uIVirtualKeyboard.HideContents = HidePassword;
45595 menuMode = 888;
45596 }
45598 PlayerInput.WritingText = true;
45599 instance.HandleIME();
45600 Netplay.ServerPassword = GetInputText(Netplay.ServerPassword);
45602 {
45604 }
45605 array9[0] = Lang.menu[3].Value;
45607 if (textBlinkerCount >= 20)
45608 {
45609 if (textBlinkerState == 0)
45610 {
45611 textBlinkerState = 1;
45612 }
45613 else
45614 {
45615 textBlinkerState = 0;
45616 }
45617 textBlinkerCount = 0;
45618 }
45620 if (HidePassword)
45621 {
45622 array9[1] = "";
45623 for (int m = 0; m < Netplay.ServerPassword.Length; m++)
45624 {
45625 array9[1] += "*";
45626 }
45627 }
45628 if (textBlinkerState == 1)
45629 {
45630 array9[1] += "|";
45631 array5[1] = 1;
45632 }
45633 else
45634 {
45635 array9[1] += " ";
45636 }
45637 array[0] = true;
45638 array[1] = true;
45639 array4[1] = -20;
45640 array4[2] = 20;
45641 array9[2] = Lang.menu[4].Value;
45642 array9[3] = Lang.menu[5].Value;
45643 num5 = 4;
45644 if (selectedMenu == 3 || flag5)
45645 {
45646 flag5 = false;
45648 }
45649 else if (selectedMenu == 2 || inputTextEnter)
45650 {
45652 }
45653 }
45654 else if ((netMode == 1 && menuMode != 888) || menuMode == 14)
45655 {
45656 num5 = 2;
45657 array9[0] = statusText;
45658 array[0] = true;
45659 num2 = 300;
45660 int num10 = statusText.Split('\n').Length - 1;
45661 array7[0] = 1f - (float)num10 * 0.04f;
45662 array4[0] = num10 * -18;
45663 array4[1] = num10 * 28;
45664 array9[1] = Lang.menu[6].Value;
45665 gameTips.Update();
45666 gameTips.Draw();
45667 if (selectedMenu == 1 || flag5)
45668 {
45669 flag5 = false;
45671 Netplay.Disconnect = true;
45672 Netplay.Connection.Socket.Close();
45674 menuMode = 0;
45675 netMode = 0;
45676 if (tServer != null)
45677 {
45678 try
45679 {
45680 tServer.Kill();
45681 tServer = null;
45682 }
45683 catch
45684 {
45685 }
45686 }
45687 }
45688 }
45689 else if (menuMode == 882)
45690 {
45691 num5 = 2;
45692 array[0] = true;
45693 num2 = 300;
45694 array9[0] = statusText;
45695 array9[1] = Lang.menu[6].Value;
45696 if (selectedMenu == 1 || flag5)
45697 {
45698 flag5 = false;
45700 menuMode = 0;
45701 netMode = 0;
45702 if (SocialAPI.Network != null)
45703 {
45704 SocialAPI.Network.CancelJoin();
45705 }
45706 }
45707 }
45708 else if (menuMode == 30)
45709 {
45711 {
45713 uIVirtualKeyboard2.HideContents = HidePassword;
45715 menuMode = 888;
45716 }
45718 PlayerInput.WritingText = true;
45719 instance.HandleIME();
45720 Netplay.ServerPassword = GetInputText(Netplay.ServerPassword);
45722 {
45724 }
45725 array9[0] = Lang.menu[7].Value;
45727 if (textBlinkerCount >= 20)
45728 {
45729 if (textBlinkerState == 0)
45730 {
45731 textBlinkerState = 1;
45732 }
45733 else
45734 {
45735 textBlinkerState = 0;
45736 }
45737 textBlinkerCount = 0;
45738 }
45740 if (HidePassword)
45741 {
45742 array9[1] = "";
45743 for (int n = 0; n < Netplay.ServerPassword.Length; n++)
45744 {
45745 array9[1] += "*";
45746 }
45747 }
45748 if (textBlinkerState == 1)
45749 {
45750 array9[1] += "|";
45751 array5[1] = 1;
45752 }
45753 else
45754 {
45755 array9[1] += " ";
45756 }
45757 array[0] = true;
45758 array[1] = true;
45759 array4[1] = -20;
45760 array4[2] = 20;
45761 array9[2] = Lang.menu[4].Value;
45762 array9[3] = Lang.menu[5].Value;
45763 num5 = 4;
45764 if (selectedMenu == 3 || flag5)
45765 {
45766 flag5 = false;
45768 }
45769 else if (selectedMenu == 2 || inputTextEnter || autoPass)
45770 {
45772 }
45773 }
45774 else if (menuMode == 889)
45775 {
45776 num2 = 200;
45777 num4 = 60;
45778 array4[1] = 30;
45779 array4[2] = 30;
45780 array4[3] = 30;
45781 array4[4] = 70;
45782 array4[5] = 70;
45783 num5 = 6;
45784 array9[0] = Lang.menu[135].Value;
45785 array9[4] = Lang.menu[144].Value;
45786 array9[5] = Lang.menu[5].Value;
45787 array[0] = true;
45788 if (!MenuServerMode.HasFlag(ServerMode.Lobby))
45789 {
45791 array[2] = true;
45792 array[3] = true;
45793 array9[1] = Lang.menu[136].Value;
45794 array9[2] = "";
45795 array9[3] = "";
45796 }
45797 else
45798 {
45799 array9[1] = Lang.menu[137].Value;
45800 if (MenuServerMode.HasFlag(ServerMode.FriendsCanJoin))
45801 {
45802 array9[2] = Lang.menu[139].Value;
45803 if (MenuServerMode.HasFlag(ServerMode.FriendsOfFriends))
45804 {
45805 array9[3] = Lang.menu[143].Value;
45806 }
45807 else
45808 {
45809 array9[3] = Lang.menu[142].Value;
45810 }
45811 }
45812 else
45813 {
45814 array9[2] = Lang.menu[138].Value;
45815 if (MenuServerMode.HasFlag(ServerMode.FriendsOfFriends))
45816 {
45817 array9[3] = Lang.menu[141].Value;
45818 }
45819 else
45820 {
45821 array9[3] = Lang.menu[140].Value;
45822 }
45823 }
45824 }
45825 if (flag5)
45826 {
45827 flag5 = false;
45828 selectedMenu = 5;
45829 }
45830 switch (selectedMenu)
45831 {
45832 case 1:
45833 MenuServerMode ^= ServerMode.Lobby;
45835 break;
45836 case 2:
45837 MenuServerMode ^= ServerMode.FriendsCanJoin;
45839 break;
45840 case 3:
45841 MenuServerMode ^= ServerMode.FriendsOfFriends;
45843 break;
45844 case 4:
45845 clrInput();
45846 Netplay.ServerPassword = "";
45847 GetInputText("");
45848 autoPass = false;
45849 menuMode = 30;
45851 break;
45852 case 5:
45853 menuMode = 6;
45855 break;
45856 }
45857 }
45858 else if (menuMode == 15)
45859 {
45860 num5 = 2;
45861 array9[0] = statusText;
45862 array[0] = true;
45863 num2 = 80;
45864 num4 = 400;
45865 array9[1] = Lang.menu[5].Value;
45866 if (selectedMenu == 1 || flag5)
45867 {
45868 flag5 = false;
45869 Netplay.Disconnect = true;
45871 menuMode = 0;
45872 netMode = 0;
45873 }
45874 }
45875 else if (menuMode == 200)
45876 {
45877 num5 = 3;
45878 array9[0] = Lang.menu[9].Value;
45879 array[0] = true;
45880 num2 -= 30;
45881 array4[1] = 70;
45882 array4[2] = 50;
45883 array9[1] = Lang.menu[10].Value;
45884 array9[2] = Lang.menu[6].Value;
45885 if (selectedMenu == 1)
45886 {
45887 if (FileUtilities.Exists(worldPathName + ".bak", ActiveWorldFileData.IsCloudSave))
45888 {
45893 menuMode = 10;
45894 }
45895 else
45896 {
45898 menuMode = 0;
45899 netMode = 0;
45900 }
45901 }
45902 if (selectedMenu == 2 || flag5)
45903 {
45904 flag5 = false;
45906 menuMode = 0;
45907 netMode = 0;
45908 }
45909 }
45910 else if (menuMode == 201)
45911 {
45912 num5 = 3;
45913 array9[0] = Lang.menu[9].Value;
45914 array[0] = true;
45915 array[1] = true;
45916 num2 -= 30;
45917 array4[1] = -30;
45918 array4[2] = 50;
45919 array9[1] = Lang.menu[11].Value;
45920 array9[2] = Lang.menu[5].Value;
45921 if (selectedMenu == 2 || flag5)
45922 {
45923 flag5 = false;
45925 menuMode = 0;
45926 netMode = 0;
45927 }
45928 }
45929 else if (menuMode == 10)
45930 {
45931 num5 = 1;
45932 array9[0] = statusText;
45933 array[0] = true;
45934 num2 = 300;
45935 gameTips.Update();
45936 gameTips.Draw();
45937 }
45938 else if (menuMode == 100)
45939 {
45940 num5 = 1;
45941 array9[0] = statusText;
45942 array[0] = true;
45943 num2 = 300;
45944 }
45945 else if (menuMode == 0)
45946 {
45949 DD2Event.Ongoing = false;
45950 eclipse = false;
45951 pumpkinMoon = false;
45952 snowMoon = false;
45953 ServerSideCharacter = false;
45954 menuMultiplayer = false;
45955 menuServer = false;
45956 netMode = 0;
45958 int num11 = 0;
45959 num2 = 220;
45960 num5 = 7;
45961 num4 = 52;
45962 array9[num11] = Lang.menu[12].Value;
45963 if (selectedMenu == num11)
45964 {
45967 menuMode = 1;
45968 }
45969 num11++;
45970 array9[num11] = Lang.menu[13].Value;
45971 if (selectedMenu == num11)
45972 {
45974 menuMode = 12;
45975 }
45976 num11++;
45977 array9[num11] = Lang.menu[131].Value;
45978 if (selectedMenu == num11)
45979 {
45981 menuMode = 888;
45982 MenuUI.SetState(AchievementsMenu);
45983 }
45984 num11++;
45985 if (SocialAPI.Workshop != null)
45986 {
45987 array9[num11] = Language.GetText("UI.Workshop").Value;
45988 if (selectedMenu == num11)
45989 {
45991 menuMode = 888;
45993 uIWorkshopHub.EnterHub();
45994 MenuUI.SetState(uIWorkshopHub);
45995 }
45996 }
45997 else
45998 {
45999 array9[num11] = Language.GetText("UI.ResourcePacks").Value;
46000 if (selectedMenu == num11)
46001 {
46004 }
46005 }
46006 num11++;
46007 array9[num11] = Lang.menu[14].Value;
46008 if (selectedMenu == num11)
46009 {
46011 menuMode = 11;
46012 }
46013 num11++;
46014 array9[num11] = Language.GetText("UI.Credits").Value;
46015 if (selectedMenu == num11)
46016 {
46018 menuMode = 3000;
46019 SkyManager.Instance.Activate("CreditsRoll", default(Vector2));
46020 }
46021 num11++;
46022 array9[num11] = Lang.menu[15].Value;
46023 if (selectedMenu == num11)
46024 {
46025 GameAskedToQuit = true;
46026 }
46027 num11++;
46028 }
46029 else if (menuMode == 1)
46030 {
46032 }
46033 else if (menuMode == 2)
46034 {
46035 flag4 = true;
46036 if (selectedMenu == 0)
46037 {
46038 menuMode = 17;
46040 selColor = PendingPlayer.hairColor;
46041 }
46042 if (selectedMenu == 1)
46043 {
46044 menuMode = 18;
46046 selColor = PendingPlayer.eyeColor;
46047 }
46048 if (selectedMenu == 2)
46049 {
46050 menuMode = 19;
46052 selColor = PendingPlayer.skinColor;
46053 }
46054 if (selectedMenu == 3)
46055 {
46056 menuMode = 20;
46058 }
46059 array9[0] = Lang.menu[18].Value;
46060 array9[1] = Lang.menu[19].Value;
46061 array9[2] = Lang.menu[20].Value;
46062 array9[3] = Lang.menu[21].Value;
46063 num2 = 220;
46064 for (int num12 = 0; num12 < 9; num12++)
46065 {
46066 if (num12 < 6)
46067 {
46068 array7[num12] = 0.75f;
46069 }
46070 else
46071 {
46072 array7[num12] = 0.9f;
46073 }
46074 }
46075 num4 = 38;
46076 array4[6] = 6;
46077 array4[7] = 12;
46078 array4[8] = 18;
46079 num7 = screenWidth / 2 - 16;
46080 num8 = 176;
46081 if (PendingPlayer.Male)
46082 {
46083 array9[4] = Lang.menu[22].Value;
46084 }
46085 else
46086 {
46087 array9[4] = Lang.menu[23].Value;
46088 }
46089 if (selectedMenu == 4)
46090 {
46091 if (PendingPlayer.Male)
46092 {
46094 PendingPlayer.Male = false;
46095 }
46096 else
46097 {
46099 PendingPlayer.Male = true;
46100 }
46101 }
46102 if (PendingPlayer.difficulty == 2)
46103 {
46104 array9[5] = Lang.menu[24].Value;
46105 array6[5] = PendingPlayer.difficulty;
46106 }
46107 else if (PendingPlayer.difficulty == 1)
46108 {
46109 array9[5] = Lang.menu[25].Value;
46110 array6[5] = PendingPlayer.difficulty;
46111 }
46112 else
46113 {
46114 array9[5] = Lang.menu[26].Value;
46115 }
46116 if (selectedMenu == 5)
46117 {
46119 menuMode = 222;
46120 }
46121 if (selectedMenu == 7)
46122 {
46124 PendingPlayer.hair = rand.Next(51);
46125 PendingPlayer.eyeColor = randColor();
46126 while (PendingPlayer.eyeColor.R + PendingPlayer.eyeColor.G + PendingPlayer.eyeColor.B > 300)
46127 {
46128 PendingPlayer.eyeColor = randColor();
46129 }
46130 PendingPlayer.hairColor = randColor();
46131 PendingPlayer.pantsColor = randColor();
46132 PendingPlayer.shirtColor = randColor();
46133 PendingPlayer.shoeColor = randColor();
46134 PendingPlayer.skinColor = randColor();
46135 float num13 = (float)rand.Next(60, 120) * 0.01f;
46136 if (num13 > 1f)
46137 {
46138 num13 = 1f;
46139 }
46140 PendingPlayer.skinColor.R = (byte)((float)rand.Next(240, 255) * num13);
46141 PendingPlayer.skinColor.G = (byte)((float)rand.Next(110, 140) * num13);
46142 PendingPlayer.skinColor.B = (byte)((float)rand.Next(75, 110) * num13);
46143 PendingPlayer.underShirtColor = randColor();
46144 int num14 = PendingPlayer.hair + 1;
46145 if (num14 == 5 || num14 == 6 || num14 == 7 || num14 == 10 || num14 == 12 || num14 == 19 || num14 == 22 || num14 == 23 || num14 == 26 || num14 == 27 || num14 == 30 || num14 == 33)
46146 {
46147 PendingPlayer.Male = false;
46148 }
46149 else
46150 {
46151 PendingPlayer.Male = true;
46152 }
46153 PendingPlayer.skinVariant = rand.Next(PlayerVariantID.Count);
46154 }
46155 array9[7] = Lang.menu[27].Value;
46156 array9[6] = Lang.menu[28].Value;
46157 array9[8] = Lang.menu[5].Value;
46158 num5 = 9;
46159 if (selectedMenu == 8 || flag5)
46160 {
46161 flag5 = false;
46163 menuMode = 1;
46164 }
46165 else if (selectedMenu == 6)
46166 {
46168 PendingPlayer.name = "";
46169 menuMode = 3;
46170 clrInput();
46171 }
46172 }
46173 else if (menuMode == 222)
46174 {
46175 if (focusMenu == 3)
46176 {
46177 array9[0] = Lang.menu[29].Value;
46178 }
46179 else if (focusMenu == 2)
46180 {
46181 array9[0] = Lang.menu[30].Value;
46182 }
46183 else if (focusMenu == 1)
46184 {
46185 array9[0] = Lang.menu[31].Value;
46186 }
46187 else
46188 {
46189 array9[0] = Lang.menu[32].Value;
46190 }
46191 num4 = 50;
46192 array4[1] = 25;
46193 array4[2] = 25;
46194 array4[3] = 25;
46195 array[0] = true;
46196 array9[1] = Lang.menu[26].Value;
46197 array9[2] = Lang.menu[25].Value;
46198 array6[2] = 1;
46199 array9[3] = Lang.menu[24].Value;
46200 array6[3] = 2;
46201 num5 = 4;
46202 if (selectedMenu == 1)
46203 {
46204 PendingPlayer.difficulty = 0;
46205 menuMode = 2;
46206 }
46207 else if (selectedMenu == 2)
46208 {
46209 menuMode = 2;
46210 PendingPlayer.difficulty = 1;
46211 }
46212 else if (selectedMenu == 3)
46213 {
46214 PendingPlayer.difficulty = 2;
46215 menuMode = 2;
46216 }
46217 }
46218 else if (menuMode == 20)
46219 {
46220 flag4 = true;
46221 if (selectedMenu == 0)
46222 {
46223 menuMode = 21;
46225 selColor = PendingPlayer.shirtColor;
46226 }
46227 if (selectedMenu == 1)
46228 {
46229 menuMode = 22;
46231 selColor = PendingPlayer.underShirtColor;
46232 }
46233 if (selectedMenu == 2)
46234 {
46235 menuMode = 23;
46237 selColor = PendingPlayer.pantsColor;
46238 }
46239 if (selectedMenu == 3)
46240 {
46241 selColor = PendingPlayer.shoeColor;
46242 menuMode = 24;
46244 }
46245 if (selectedMenu == 5 || flag5)
46246 {
46247 flag5 = false;
46249 menuMode = 2;
46250 }
46251 if (selectedMenu == 4)
46252 {
46255 }
46256 num7 = screenWidth / 2 - 16;
46257 num8 = 210;
46258 num2 = 260;
46259 num4 = 50;
46260 num5 = 6;
46261 array9[0] = Lang.menu[33].Value;
46262 array9[1] = Lang.menu[34].Value;
46263 array9[2] = Lang.menu[35].Value;
46264 array9[3] = Lang.menu[36].Value;
46265 array9[4] = Lang.menu[127].Value;
46266 array9[5] = Lang.menu[5].Value;
46267 array4[5] = 20;
46268 }
46269 else if (menuMode == 17)
46270 {
46271 flag4 = true;
46272 num7 = screenWidth / 2 - 16;
46273 num8 = 210;
46274 flag = true;
46275 num9 = 390;
46276 num2 = 260;
46277 num4 = 60;
46278 PendingPlayer.hairColor = selColor;
46279 num5 = 3;
46280 array9[0] = Lang.menu[37].Value + " " + (PendingPlayer.hair + 1);
46281 array9[1] = Lang.menu[38].Value;
46282 array[1] = true;
46283 array4[2] = 150;
46284 array4[1] = 10;
46285 array9[2] = Lang.menu[5].Value;
46286 int num15 = 51;
46287 if (focusMenu == 0)
46288 {
46289 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 9;
46290 }
46291 if (selectedMenu == 0)
46292 {
46294 PendingPlayer.hair++;
46295 if (PendingPlayer.hair >= num15)
46296 {
46297 PendingPlayer.hair = 0;
46298 }
46299 }
46300 else if (selectedMenu2 == 0)
46301 {
46303 PendingPlayer.hair--;
46304 if (PendingPlayer.hair < 0)
46305 {
46306 PendingPlayer.hair = num15 - 1;
46307 }
46308 }
46309 if (selectedMenu == 2 || flag5)
46310 {
46311 flag5 = false;
46312 menuMode = 2;
46314 }
46315 }
46316 else if (menuMode == 18)
46317 {
46318 flag4 = true;
46319 num7 = screenWidth / 2 - 16;
46320 num8 = 210;
46321 flag = true;
46322 num9 = 370;
46323 num2 = 240;
46324 num4 = 60;
46325 PendingPlayer.eyeColor = selColor;
46326 num5 = 3;
46327 array9[0] = "";
46328 array9[1] = Lang.menu[39].Value;
46329 array[1] = true;
46330 array4[2] = 170;
46331 array4[1] = 10;
46332 array9[2] = Lang.menu[5].Value;
46333 if (selectedMenu == 2 || flag5)
46334 {
46335 flag5 = false;
46336 menuMode = 2;
46338 }
46339 }
46340 else if (menuMode == 19)
46341 {
46342 flag4 = true;
46343 num7 = screenWidth / 2 - 16;
46344 num8 = 210;
46345 flag = true;
46346 num9 = 370;
46347 num2 = 240;
46348 num4 = 60;
46349 PendingPlayer.skinColor = selColor;
46350 num5 = 3;
46351 array9[0] = "";
46352 array9[1] = Lang.menu[40].Value;
46353 array[1] = true;
46354 array4[2] = 170;
46355 array4[1] = 10;
46356 array9[2] = Lang.menu[5].Value;
46357 if (selectedMenu == 2 || flag5)
46358 {
46359 flag5 = false;
46360 menuMode = 2;
46362 }
46363 }
46364 else if (menuMode == 21)
46365 {
46366 flag4 = true;
46367 num7 = screenWidth / 2 - 16;
46368 num8 = 210;
46369 flag = true;
46370 num9 = 370;
46371 num2 = 240;
46372 num4 = 60;
46373 PendingPlayer.shirtColor = selColor;
46374 num5 = 3;
46375 array9[0] = "";
46376 array9[1] = Lang.menu[41].Value;
46377 array[1] = true;
46378 array4[2] = 170;
46379 array4[1] = 10;
46380 array9[2] = Lang.menu[5].Value;
46381 if (selectedMenu == 2 || flag5)
46382 {
46383 flag5 = false;
46384 menuMode = 20;
46386 }
46387 }
46388 else if (menuMode == 22)
46389 {
46390 flag4 = true;
46391 num7 = screenWidth / 2 - 16;
46392 num8 = 210;
46393 flag = true;
46394 num9 = 370;
46395 num2 = 240;
46396 num4 = 60;
46397 PendingPlayer.underShirtColor = selColor;
46398 num5 = 3;
46399 array9[0] = "";
46400 array9[1] = Lang.menu[42].Value;
46401 array[1] = true;
46402 array4[2] = 170;
46403 array4[1] = 10;
46404 array9[2] = Lang.menu[5].Value;
46405 if (selectedMenu == 2 || flag5)
46406 {
46407 flag5 = false;
46408 menuMode = 20;
46410 }
46411 }
46412 else if (menuMode == 23)
46413 {
46414 flag4 = true;
46415 num7 = screenWidth / 2 - 16;
46416 num8 = 210;
46417 flag = true;
46418 num9 = 370;
46419 num2 = 240;
46420 num4 = 60;
46421 PendingPlayer.pantsColor = selColor;
46422 num5 = 3;
46423 array9[0] = "";
46424 array9[1] = Lang.menu[43].Value;
46425 array[1] = true;
46426 array4[2] = 170;
46427 array4[1] = 10;
46428 array9[2] = Lang.menu[5].Value;
46429 if (selectedMenu == 2 || flag5)
46430 {
46431 flag5 = false;
46432 menuMode = 20;
46434 }
46435 }
46436 else if (menuMode == 24)
46437 {
46438 flag4 = true;
46439 num7 = screenWidth / 2 - 16;
46440 num8 = 210;
46441 flag = true;
46442 num9 = 370;
46443 num2 = 240;
46444 num4 = 60;
46445 PendingPlayer.shoeColor = selColor;
46446 num5 = 3;
46447 array9[0] = "";
46448 array9[1] = Lang.menu[44].Value;
46449 array[1] = true;
46450 array4[2] = 170;
46451 array4[1] = 10;
46452 array9[2] = Lang.menu[5].Value;
46453 if (selectedMenu == 2 || flag5)
46454 {
46455 flag5 = false;
46456 menuMode = 20;
46458 }
46459 }
46460 else if (menuMode == 3)
46461 {
46463 uIVirtualKeyboard3.SetMaxInputLength(20);
46464 menuMode = 888;
46465 MenuUI.SetState(uIVirtualKeyboard3);
46466 }
46467 else if (menuMode != 4)
46468 {
46469 if (menuMode == 5)
46470 {
46471 array9[0] = Lang.menu[46].Value + " " + PlayerList[selectedPlayer].Player.name + "?";
46472 array[0] = true;
46473 array9[1] = Lang.menu[104].Value;
46474 array9[2] = Lang.menu[105].Value;
46475 num5 = 3;
46476 if (selectedMenu == 1)
46477 {
46480 menuMode = 1;
46481 }
46482 else if (selectedMenu == 2 || flag5)
46483 {
46484 flag5 = false;
46486 menuMode = 1;
46487 }
46488 }
46489 else if (menuMode == 6)
46490 {
46491 menuMode = 888;
46492 MenuUI.SetState(_worldSelectMenu);
46493 }
46494 else if (menuMode == -7)
46495 {
46496 num2 = 200;
46497 num4 = 60;
46498 array4[2] = 30;
46499 array4[3] = 30;
46500 array4[4] = 30;
46501 array6[3] = 1;
46502 array6[4] = 2;
46503 array4[5] = 70;
46504 if (focusMenu == 2)
46505 {
46506 array9[1] = Language.GetTextValue("UI.WorldDescriptionNormal");
46507 }
46508 else if (focusMenu == 3)
46509 {
46510 array9[1] = Language.GetTextValue("UI.WorldDescriptionExpert");
46511 }
46512 else if (focusMenu == 4)
46513 {
46514 array9[1] = Language.GetTextValue("UI.WorldDescriptionMaster");
46515 }
46516 array9[0] = Lang.menu[32].Value;
46517 array[0] = true;
46518 array[1] = true;
46519 array9[2] = Language.GetTextValue("UI.Normal");
46520 array9[3] = Language.GetTextValue("UI.Expert");
46521 array9[4] = Language.GetTextValue("UI.Master");
46522 array9[5] = Language.GetTextValue("UI.Back");
46523 num5 = 6;
46524 if (selectedMenu == 2)
46525 {
46526 GameMode = 0;
46528 menuMode = 7;
46530 {
46531 menuMode = -71;
46532 }
46533 }
46534 else if (selectedMenu == 3)
46535 {
46536 GameMode = 1;
46538 menuMode = 7;
46540 {
46541 menuMode = -71;
46542 }
46543 }
46544 else if (selectedMenu == 4)
46545 {
46546 GameMode = 2;
46548 menuMode = 7;
46550 {
46551 menuMode = -71;
46552 }
46553 }
46554 else if (selectedMenu == 5 || flag5)
46555 {
46556 flag5 = false;
46558 menuMode = 16;
46559 }
46560 clrInput();
46561 }
46562 else if (menuMode == -71)
46563 {
46564 num2 = 200;
46565 num4 = 60;
46566 array4[1] = 30;
46567 array4[2] = 30;
46568 array4[3] = 30;
46569 array4[4] = 70;
46570 num5 = 5;
46571 int num16 = 0;
46572 array9[num16] = Lang.misc[100].Value;
46573 array[num16] = true;
46574 num16++;
46575 array9[num16] = Lang.misc[101].Value;
46576 if (selectedMenu == num16)
46577 {
46578 WorldGen.WorldGenParam_Evil = 0;
46580 menuMode = 7;
46581 }
46582 num16++;
46583 array9[num16] = Lang.misc[102].Value;
46584 if (selectedMenu == num16)
46585 {
46586 WorldGen.WorldGenParam_Evil = 1;
46588 menuMode = 7;
46589 }
46590 num16++;
46591 array9[num16] = Lang.misc[103].Value;
46592 if (selectedMenu == num16)
46593 {
46594 WorldGen.WorldGenParam_Evil = -1;
46596 menuMode = 7;
46597 }
46598 num16++;
46599 array9[num16] = Language.GetTextValue("UI.Back");
46600 if (selectedMenu == num16 || flag5)
46601 {
46602 flag5 = false;
46604 menuMode = -7;
46605 }
46606 num16++;
46607 clrInput();
46608 }
46609 else if (menuMode == 7)
46610 {
46611 menuMode = 888;
46612 MenuUI.SetState(new UIVirtualKeyboard(Lang.menu[48].Value, "", OnWorldNamed, CreateGoToMenuEvent(-7)));
46613 }
46614 else if (menuMode == 5000)
46615 {
46616 menuMode = 888;
46617 MenuUI.SetState(new UIVirtualKeyboard(Language.GetTextValue("UI.EnterSeed"), "", OnSeedSelected, CreateGoToMenuEvent(7), 0, allowEmpty: true));
46618 }
46619 else if (menuMode == 8)
46620 {
46621 num2 = 180;
46622 num4 = 40;
46623 num5 = 8;
46624 array4[7] += 30;
46625 for (int num17 = 0; num17 < num5; num17++)
46626 {
46627 array7[num17] = 0.8f;
46628 }
46629 array9[7] = Lang.menu[5].Value;
46630 for (int num18 = 0; num18 < 7; num18++)
46631 {
46632 if (num18 < WorldList.Count)
46633 {
46634 array9[num18] = WorldList[num18 + menuSkip].Name;
46635 if (WorldList[num18 + menuSkip].GameMode == 1)
46636 {
46637 array6[num18] = 1;
46638 }
46639 else if (WorldList[num18 + menuSkip].GameMode == 2)
46640 {
46641 array6[num18] = 2;
46642 }
46643 }
46644 else
46645 {
46646 array9[num18] = null;
46647 }
46648 }
46649 if (WorldList.Count > 7 + menuSkip)
46650 {
46651 array9[6] = Language.GetTextValue("UI.More");
46652 array9[6] = "▼";
46653 array7[6] = 0.6f;
46654 array4[6] += 8;
46655 menuWide[6] = true;
46656 }
46657 if (menuSkip > 0)
46658 {
46659 array9[0] = "▲";
46660 array7[0] = 0.6f;
46661 array4[0] += 8;
46662 menuWide[0] = true;
46663 }
46664 if (selectedMenu == 0 && menuSkip > 0)
46665 {
46667 menuSkip -= 5;
46668 if (menuSkip < 0)
46669 {
46670 menuSkip = 0;
46671 }
46672 }
46673 else if (selectedMenu == 6 && menuSkip < WorldList.Count - 7)
46674 {
46676 menuSkip += 5;
46677 if (menuSkip >= PlayerList.Count - 7)
46678 {
46679 menuSkip = WorldList.Count - 7;
46680 }
46681 }
46682 else if (selectedMenu == 7 || flag5)
46683 {
46684 flag5 = false;
46686 menuMode = 6;
46687 }
46688 else if (selectedMenu >= 0)
46689 {
46692 menuMode = 9;
46693 }
46694 }
46695 else if (menuMode == 9)
46696 {
46697 array9[0] = Lang.menu[46].Value + " " + WorldList[selectedWorld].Name + "?";
46698 array[0] = true;
46699 array9[1] = Lang.menu[104].Value;
46700 array9[2] = Lang.menu[105].Value;
46701 num5 = 3;
46702 if (selectedMenu == 1)
46703 {
46706 menuMode = 6;
46707 }
46708 else if (selectedMenu == 2 || flag5)
46709 {
46711 menuMode = 6;
46712 }
46713 }
46714 else if (menuMode == 3000)
46715 {
46716 num5 = 1;
46717 num2 = 500;
46718 array7[0] = 0.9f;
46719 array9[0] = Lang.menu[5].Value;
46720 if (selectedMenu == 0 || flag5)
46721 {
46722 flag5 = false;
46724 menuMode = 0;
46725 }
46726 }
46727 else if (menuMode == 11)
46728 {
46729 num2 = 210;
46730 num4 = 37;
46731 num5 = 8;
46732 array4[num5 - 1] = 8;
46733 for (int num19 = 0; num19 < num5; num19++)
46734 {
46735 array7[num19] = 0.75f;
46736 }
46737 int num20 = 0;
46738 array9[num20] = Lang.menu[114].Value;
46739 if (selectedMenu == num20)
46740 {
46742 menuMode = 112;
46743 }
46744 num20++;
46745 array9[num20] = Lang.menu[210].Value;
46746 if (selectedMenu == num20)
46747 {
46749 menuMode = 1112;
46750 }
46751 num20++;
46752 array9[num20] = Lang.menu[63].Value;
46753 if (selectedMenu == num20)
46754 {
46756 menuMode = 1111;
46757 }
46758 num20++;
46759 array9[num20] = Lang.menu[65].Value;
46760 if (selectedMenu == num20)
46761 {
46763 menuMode = 26;
46764 }
46765 num20++;
46766 array9[num20] = Lang.menu[218].Value;
46767 if (selectedMenu == num20)
46768 {
46770 menuMode = 1125;
46771 }
46772 num20++;
46773 array9[num20] = Lang.menu[219].Value;
46774 if (selectedMenu == num20)
46775 {
46777 menuMode = 1127;
46778 }
46779 num20++;
46780 array9[num20] = Lang.menu[103].Value;
46781 if (selectedMenu == num20)
46782 {
46784 menuMode = 1213;
46785 }
46786 num20++;
46787 array9[num20] = Lang.menu[5].Value;
46788 if (selectedMenu == num20 || flag5)
46789 {
46790 flag5 = false;
46792 menuMode = 0;
46793 SaveSettings();
46794 }
46795 }
46796 else if (menuMode == 112)
46797 {
46798 num2 = 250;
46799 num4 = 52;
46800 num5 = 5;
46801 array4[num5 - 1] = 18;
46802 for (int num21 = 0; num21 < num5; num21++)
46803 {
46804 array7[num21] = 0.78f;
46805 }
46806 int num22 = 0;
46807 if (autoSave)
46808 {
46809 array9[num22] = Lang.menu[67].Value;
46810 }
46811 else
46812 {
46813 array9[num22] = Lang.menu[68].Value;
46814 }
46815 if (selectedMenu == num22)
46816 {
46818 if (autoSave)
46819 {
46820 autoSave = false;
46821 }
46822 else
46823 {
46824 autoSave = true;
46825 }
46826 }
46827 num22++;
46828 if (autoPause)
46829 {
46830 array9[num22] = Lang.menu[69].Value;
46831 }
46832 else
46833 {
46834 array9[num22] = Lang.menu[70].Value;
46835 }
46836 if (selectedMenu == num22)
46837 {
46839 if (autoPause)
46840 {
46841 autoPause = false;
46842 }
46843 else
46844 {
46845 autoPause = true;
46846 }
46847 }
46848 num22++;
46849 if (mapEnabled)
46850 {
46851 array9[num22] = Lang.menu[112].Value;
46852 }
46853 else
46854 {
46855 array9[num22] = Lang.menu[113].Value;
46856 }
46857 if (selectedMenu == num22)
46858 {
46860 if (mapEnabled)
46861 {
46862 mapEnabled = false;
46863 }
46864 else
46865 {
46866 mapEnabled = true;
46867 }
46868 }
46869 num22++;
46870 array9[num22] = (HidePassword ? Lang.menu[212].Value : Lang.menu[211].Value);
46871 if (selectedMenu == num22)
46872 {
46875 }
46876 num22++;
46877 array9[num22] = Lang.menu[5].Value;
46878 if (selectedMenu == num22 || flag5)
46879 {
46880 flag5 = false;
46881 menuMode = 11;
46883 }
46884 }
46885 else if (menuMode == 1112)
46886 {
46887 num2 = 210;
46888 num4 = 32;
46889 num5 = 10;
46890 array4[num5 - 1] = 18;
46891 for (int num23 = 0; num23 < num5; num23++)
46892 {
46893 array7[num23] = 0.7f;
46894 }
46895 int num24 = 0;
46896 if (showItemText)
46897 {
46898 array9[num24] = Lang.menu[71].Value;
46899 }
46900 else
46901 {
46902 array9[num24] = Lang.menu[72].Value;
46903 }
46904 if (selectedMenu == num24)
46905 {
46907 if (showItemText)
46908 {
46909 showItemText = false;
46910 }
46911 else
46912 {
46913 showItemText = true;
46914 }
46915 }
46916 num24++;
46917 array9[num24] = Lang.menu[123].Value + " " + Lang.menu[124 + invasionProgressMode].Value;
46918 if (selectedMenu == num24)
46919 {
46922 if (invasionProgressMode >= 3)
46923 {
46925 }
46926 }
46927 num24++;
46928 array9[num24] = (placementPreview ? Lang.menu[128].Value : Lang.menu[129].Value);
46929 if (selectedMenu == num24)
46930 {
46933 }
46934 num24++;
46935 array9[num24] = (ItemSlot.Options.HighlightNewItems ? Lang.inter[117].Value : Lang.inter[116].Value);
46936 if (selectedMenu == num24)
46937 {
46939 ItemSlot.Options.HighlightNewItems = !ItemSlot.Options.HighlightNewItems;
46940 }
46941 num24++;
46942 array9[num24] = (MouseShowBuildingGrid ? Lang.menu[229].Value : Lang.menu[230].Value);
46943 if (selectedMenu == num24)
46944 {
46947 }
46948 num24++;
46949 array9[num24] = (GamepadDisableInstructionsDisplay ? Lang.menu[241].Value : Lang.menu[242].Value);
46950 if (selectedMenu == num24)
46951 {
46954 }
46955 num24++;
46956 string textValue = Language.GetTextValue("UI.MinimapFrame_" + MinimapFrameManagerInstance.ActiveSelectionKeyName);
46957 array9[num24] = Language.GetTextValue("UI.SelectMapBorder", textValue);
46958 if (selectedMenu == num24)
46959 {
46960 MinimapFrameManagerInstance.CycleSelection();
46961 }
46962 num24++;
46963 string activeSetKeyName = ResourceSetsManager.ActiveSetKeyName;
46964 string textValue2 = Language.GetTextValue("UI.HealthManaStyle_" + activeSetKeyName);
46965 array9[num24] = Language.GetTextValue("UI.SelectHealthStyle", textValue2);
46966 if (selectedMenu == num24)
46967 {
46968 ResourceSetsManager.CycleResourceSet();
46969 }
46970 num24++;
46971 array9[num24] = Language.GetTextValue(BigProgressBarSystem.ShowText ? "UI.ShowBossLifeTextOn" : "UI.ShowBossLifeTextOff");
46972 if (selectedMenu == num24)
46973 {
46975 }
46976 num24++;
46977 array9[num24] = Lang.menu[5].Value;
46978 if (selectedMenu == num24 || flag5)
46979 {
46980 flag5 = false;
46981 menuMode = 11;
46983 }
46984 }
46985 else if (menuMode == 1111)
46986 {
46987 bgScroll = (int)Math.Round((1f - caveParallax) * 500f);
46988 int num25 = 0;
46989 array9[num25] = Lang.menu[51].Value;
46990 if (selectedMenu == num25)
46991 {
46993 menuMode = 111;
46994 }
46995 num25++;
46996 array9[num25] = Lang.menu[52].Value;
46997 if (selectedMenu == num25)
46998 {
47000 menuMode = 28;
47001 }
47002 num25++;
47003 array9[num25] = Lang.menu[(int)(247 + FrameSkipMode)].Value;
47004 if (selectedMenu == num25)
47005 {
47008 }
47009 num25++;
47010 array9[num25] = Language.GetTextValue("UI.LightMode_" + Lighting.Mode);
47011 if (selectedMenu == num25)
47012 {
47015 }
47016 num25++;
47017 switch (qaStyle)
47018 {
47019 case 0:
47020 array9[num25] = Lang.menu[59].Value;
47021 break;
47022 case 1:
47023 array9[num25] = Lang.menu[60].Value;
47024 break;
47025 case 2:
47026 array9[num25] = Lang.menu[61].Value;
47027 break;
47028 default:
47029 array9[num25] = Lang.menu[62].Value;
47030 break;
47031 }
47032 if (selectedMenu == num25)
47033 {
47035 if (++qaStyle > 3)
47036 {
47037 qaStyle = 0;
47038 }
47039 }
47040 num25++;
47041 array9[num25] = (BackgroundEnabled ? Lang.menu[100].Value : Lang.menu[101].Value);
47042 if (selectedMenu == num25)
47043 {
47046 }
47047 num25++;
47048 array9[num25] = (ChildSafety.Disabled ? Lang.menu[132].Value : Lang.menu[133].Value);
47049 if (selectedMenu == num25)
47050 {
47052 ChildSafety.Disabled = !ChildSafety.Disabled;
47053 }
47054 num25++;
47055 array9[num25] = (SettingsEnabled_MinersWobble ? Lang.menu[250].Value : Lang.menu[251].Value);
47056 if (selectedMenu == num25)
47057 {
47060 }
47061 num25++;
47062 array9[num25] = (SettingsEnabled_TilesSwayInWind ? Language.GetTextValue("UI.TilesSwayInWindOn") : Language.GetTextValue("UI.TilesSwayInWindOff"));
47063 if (selectedMenu == num25)
47064 {
47067 }
47068 num25++;
47069 array9[num25] = Language.GetTextValue("UI.Effects");
47070 if (selectedMenu == num25)
47071 {
47073 menuMode = 2008;
47074 }
47075 int num26 = num25;
47076 int num27 = num26;
47077 array9[num27] = Lang.menu[5].Value;
47078 array4[num27] = 8;
47079 if (selectedMenu == num27 || flag5)
47080 {
47081 flag5 = false;
47083 SaveSettings();
47084 menuMode = 11;
47085 }
47086 num2 = 186;
47087 num4 = 30;
47088 num5 = num27 + 1;
47089 for (int num28 = 0; num28 < num26; num28++)
47090 {
47091 array7[num28] = 0.6f;
47092 }
47093 }
47094 else if (menuMode == 2008)
47095 {
47096 num2 = 240;
47097 num4 = 60;
47098 num5 = 6;
47099 array9[0] = "";
47100 array9[1] = Language.GetTextValue("UI.Effects");
47101 array[1] = true;
47102 array4[1] = 10;
47103 array9[2] = Language.GetTextValue("GameUI.StormEffects", UseStormEffects ? Language.GetTextValue("GameUI.Enabled") : Language.GetTextValue("GameUI.Disabled"));
47104 array7[2] = 0.8f;
47105 array9[3] = Language.GetTextValue("GameUI.HeatDistortion", UseHeatDistortion ? Language.GetTextValue("GameUI.Enabled") : Language.GetTextValue("GameUI.Disabled"));
47106 array7[3] = 0.8f;
47107 array9[4] = Language.GetTextValue("GameUI.WaveQuality", WaveQuality switch
47108 {
47109 1 => Language.GetTextValue("GameUI.QualityLow"),
47110 2 => Language.GetTextValue("GameUI.QualityMedium"),
47111 3 => Language.GetTextValue("GameUI.QualityHigh"),
47112 _ => Language.GetTextValue("GameUI.QualityOff"),
47113 });
47114 array7[4] = 0.8f;
47115 array9[5] = Lang.menu[5].Value;
47116 if (selectedMenu == 2)
47117 {
47119 }
47120 if (selectedMenu == 3)
47121 {
47123 }
47124 if (selectedMenu == 4)
47125 {
47126 WaveQuality = (WaveQuality + 1) % 4;
47127 }
47128 if (selectedMenu == 5 || flag5)
47129 {
47130 flag5 = false;
47131 menuMode = 1111;
47133 }
47134 }
47135 else if (menuMode == 111)
47136 {
47137 for (int num29 = 0; num29 < 9; num29++)
47138 {
47139 array7[num29] = 0.85f;
47140 }
47141 num2 = 210;
47142 num4 = 55;
47143 int num30 = 0;
47145 if (selectedMenu == num30)
47146 {
47148 int num31 = 0;
47149 for (int num32 = 0; num32 < numDisplayModes; num32++)
47150 {
47152 {
47153 num31 = num32;
47154 break;
47155 }
47156 }
47157 num31 = (num31 + 1) % numDisplayModes;
47160 }
47161 num30++;
47163 {
47164 array9[num30] = Lang.menu[PendingBorderlessState ? 245 : 246].Value;
47165 if (selectedMenu == num30)
47166 {
47169 }
47170 num30++;
47171 }
47172 array9[num30] = (graphics.IsFullScreen ? Lang.menu[49].Value : Lang.menu[50].Value);
47173 if (selectedMenu == num30)
47174 {
47176 }
47177 num30++;
47178 array4[num30] = 100;
47179 array9[num30] = Lang.menu[134].Value;
47180 if (selectedMenu == num30)
47181 {
47183 {
47187 }
47189 menuMode = 1111;
47190 }
47191 num30++;
47192 array9[num30] = Lang.menu[5].Value;
47193 array4[num30] = 100;
47194 if (selectedMenu == num30 || flag5)
47195 {
47196 flag5 = false;
47197 PendingResolutionWidth = graphics.PreferredBackBufferWidth;
47198 PendingResolutionHeight = graphics.PreferredBackBufferHeight;
47200 menuMode = 1111;
47202 }
47203 num30++;
47204 num5 = num30;
47205 }
47206 else if (menuMode == 1125)
47207 {
47208 num2 = 232;
47209 num4 = 38;
47210 num5 = 7;
47211 array4[num5 - 1] = 18;
47212 for (int num33 = 0; num33 < num5; num33++)
47213 {
47214 array7[num33] = 0.73f;
47215 }
47216 int num34 = 0;
47217 array9[num34] = Lang.menu[64].Value;
47218 if (selectedMenu == num34)
47219 {
47223 menuMode = 25;
47224 }
47225 num34++;
47226 array9[num34] = Lang.menu[217].Value;
47227 if (selectedMenu == num34)
47228 {
47232 menuMode = 252;
47233 }
47234 num34++;
47235 array9[num34] = (cSmartCursorModeIsToggleAndNotHold ? Lang.menu[121].Value : Lang.menu[122].Value);
47236 if (selectedMenu == num34)
47237 {
47240 }
47241 num34++;
47242 array9[num34] = (Player.SmartCursorSettings.SmartAxeAfterPickaxe ? Lang.menu[214].Value : Lang.menu[213].Value);
47243 if (selectedMenu == num34)
47244 {
47246 Player.SmartCursorSettings.SmartAxeAfterPickaxe = !Player.SmartCursorSettings.SmartAxeAfterPickaxe;
47247 }
47248 num34++;
47249 array9[num34] = (Player.SmartCursorSettings.SmartBlocksEnabled ? Lang.menu[215].Value : Lang.menu[216].Value);
47250 if (selectedMenu == num34)
47251 {
47253 Player.SmartCursorSettings.SmartBlocksEnabled = !Player.SmartCursorSettings.SmartBlocksEnabled;
47254 }
47255 num34++;
47256 switch (LockOnHelper.UseMode)
47257 {
47258 case LockOnHelper.LockOnMode.FocusTarget:
47259 array9[num34] = Lang.menu[232].Value;
47260 break;
47261 case LockOnHelper.LockOnMode.TargetClosest:
47262 array9[num34] = Lang.menu[233].Value;
47263 break;
47264 case LockOnHelper.LockOnMode.ThreeDS:
47265 array9[num34] = Lang.menu[234].Value;
47266 break;
47267 }
47268 if (selectedMenu == num34)
47269 {
47272 }
47273 num34++;
47274 array9[num34] = Lang.menu[5].Value;
47275 if (selectedMenu == num34 || flag5)
47276 {
47277 flag5 = false;
47278 menuMode = 11;
47280 }
47281 }
47282 else if (menuMode == 25)
47283 {
47284 flag = true;
47285 num9 = 320;
47286 num2 = 200;
47287 num4 = 10;
47290 num5 = 3;
47291 array9[0] = "";
47292 array9[1] = Lang.menu[64].Value;
47293 array[1] = true;
47294 array4[2] = 250;
47295 array4[1] = 10;
47296 array9[2] = Lang.menu[5].Value;
47297 if (selectedMenu == 2 || flag5)
47298 {
47299 flag5 = false;
47300 menuMode = 1125;
47302 }
47303 }
47304 else if (menuMode == 252)
47305 {
47306 flag = true;
47307 num9 = 320;
47308 num2 = 200;
47309 num4 = 10;
47312 num5 = 3;
47313 array9[0] = "";
47314 array9[1] = Lang.menu[217].Value;
47315 array[1] = true;
47316 array4[2] = 250;
47317 array4[1] = 10;
47318 array9[2] = Lang.menu[5].Value;
47319 if (selectedMenu == 2 || flag5)
47320 {
47321 flag5 = false;
47322 menuMode = 1125;
47324 }
47325 }
47326 else if (menuMode == 26)
47327 {
47328 flag2 = true;
47329 num2 = 200;
47330 num4 = 10;
47331 num5 = 3;
47332 array9[0] = "";
47333 array9[1] = Lang.menu[65].Value;
47334 array[1] = true;
47335 array4[2] = 250;
47336 array4[1] = 10;
47337 array9[2] = Lang.menu[5].Value;
47338 if (selectedMenu == 2 || flag5)
47339 {
47340 flag5 = false;
47341 menuMode = 11;
47343 }
47344 }
47345 else if (menuMode == 28)
47346 {
47347 caveParallax = 1f - (float)bgScroll / 500f;
47348 flag3 = true;
47349 num2 = 240;
47350 num4 = 60;
47351 num5 = 3;
47352 array9[0] = "";
47353 array9[1] = Lang.menu[52].Value;
47354 array[1] = true;
47355 array4[2] = 170;
47356 array4[1] = 10;
47357 array9[2] = Lang.menu[5].Value;
47358 if (selectedMenu == 2 || flag5)
47359 {
47360 flag5 = false;
47361 menuMode = 1111;
47363 }
47364 }
47365 else if (menuMode == 272727)
47366 {
47367 num2 = 200;
47368 num4 = 30;
47369 num5 = 14;
47370 string[] array10 = new string[12]
47371 {
47373 null, null
47374 };
47375 if (setKey >= 0)
47376 {
47377 array10[setKey] = "_";
47378 }
47379 array9[0] = Lang.menu[106].Value + array10[0];
47380 array9[1] = Lang.menu[107].Value + array10[1];
47381 array9[2] = Lang.menu[108].Value + array10[2];
47382 array9[3] = Lang.menu[109].Value + array10[3];
47383 array9[4] = Lang.menu[110].Value + array10[4];
47384 array9[5] = Lang.menu[111].Value + array10[5];
47385 for (int num35 = 0; num35 < 6; num35++)
47386 {
47387 array8[num35] = true;
47388 array7[num35] = 0.55f;
47389 array5[num35] = -140;
47390 }
47391 array7[6] = 0.8f;
47392 array7[6] = 0.8f;
47393 array4[6] = 6;
47394 array9[6] = Lang.menu[86].Value;
47395 array4[7] = 16;
47396 array9[7] = Lang.menu[5].Value;
47397 if (selectedMenu == 7 || flag5)
47398 {
47399 flag5 = false;
47400 menuMode = 11;
47402 }
47403 else if (selectedMenu == 6)
47404 {
47405 cMapStyle = "Tab";
47406 cMapFull = "M";
47407 cMapZoomIn = "Add";
47408 cMapZoomOut = "Subtract";
47409 cMapAlphaUp = "PageUp";
47410 cMapAlphaDown = "PageDown";
47411 setKey = -1;
47413 }
47414 else if (selectedMenu >= 0)
47415 {
47417 }
47418 if (setKey >= 0)
47419 {
47421 if (pressedKeys.Count > 0)
47422 {
47423 string text = string.Concat(pressedKeys[0]);
47424 if (text != "None")
47425 {
47426 if (setKey == 0)
47427 {
47428 cMapStyle = text;
47429 }
47430 if (setKey == 1)
47431 {
47432 cMapFull = text;
47433 }
47434 if (setKey == 2)
47435 {
47436 cMapZoomIn = text;
47437 }
47438 if (setKey == 3)
47439 {
47440 cMapZoomOut = text;
47441 }
47442 if (setKey == 4)
47443 {
47444 cMapAlphaUp = text;
47445 }
47446 if (setKey == 5)
47447 {
47449 }
47450 setKey = -1;
47451 }
47452 }
47453 }
47454 }
47455 else if (menuMode == 27)
47456 {
47457 num2 = 176;
47458 num4 = 22;
47459 num5 = 16;
47460 string[] array11 = new string[14]
47461 {
47464 };
47465 if (setKey >= 0)
47466 {
47467 array11[setKey] = "_";
47468 }
47469 array9[0] = Lang.menu[74].Value + array11[0];
47470 array9[1] = Lang.menu[75].Value + array11[1];
47471 array9[2] = Lang.menu[76].Value + array11[2];
47472 array9[3] = Lang.menu[77].Value + array11[3];
47473 array9[4] = Lang.menu[78].Value + array11[4];
47474 array9[5] = Lang.menu[79].Value + array11[5];
47475 array9[6] = Lang.menu[80].Value + array11[6];
47476 array9[7] = Lang.menu[81].Value + array11[7];
47477 array9[8] = Lang.menu[82].Value + array11[8];
47478 array9[9] = Lang.menu[83].Value + array11[9];
47479 array9[10] = Lang.menu[84].Value + array11[10];
47480 array9[11] = Lang.menu[85].Value + array11[11];
47481 array9[12] = Lang.menu[120].Value + array11[12];
47482 array9[13] = Lang.menu[130].Value + array11[13];
47483 for (int num36 = 0; num36 < 14; num36++)
47484 {
47485 array8[num36] = true;
47486 array7[num36] = 0.45f;
47487 array5[num36] = -80;
47488 }
47489 array7[14] = 0.8f;
47490 array4[14] = 6;
47491 array9[14] = Lang.menu[86].Value;
47492 array7[15] = 0.8f;
47493 array4[15] = 16;
47494 array9[15] = Lang.menu[5].Value;
47495 if (selectedMenu == 15 || flag5)
47496 {
47497 flag5 = false;
47498 menuMode = 11;
47500 }
47501 else if (selectedMenu == 14)
47502 {
47504 setKey = -1;
47506 }
47507 else if (selectedMenu >= 0)
47508 {
47510 }
47511 if (setKey >= 0)
47512 {
47514 if (pressedKeys2.Count > 0)
47515 {
47516 string text2 = string.Concat(pressedKeys2[0]);
47517 if (text2 != "None")
47518 {
47519 if (setKey == 0)
47520 {
47521 cUp = text2;
47522 }
47523 if (setKey == 1)
47524 {
47525 cDown = text2;
47526 }
47527 if (setKey == 2)
47528 {
47529 cLeft = text2;
47530 }
47531 if (setKey == 3)
47532 {
47533 cRight = text2;
47534 }
47535 if (setKey == 4)
47536 {
47537 cJump = text2;
47538 }
47539 if (setKey == 5)
47540 {
47541 cThrowItem = text2;
47542 }
47543 if (setKey == 6)
47544 {
47545 cInv = text2;
47546 }
47547 if (setKey == 7)
47548 {
47549 cHeal = text2;
47550 }
47551 if (setKey == 8)
47552 {
47553 cMana = text2;
47554 }
47555 if (setKey == 9)
47556 {
47557 cBuff = text2;
47558 }
47559 if (setKey == 10)
47560 {
47561 cHook = text2;
47562 }
47563 if (setKey == 11)
47564 {
47565 cTorch = text2;
47566 }
47567 if (setKey == 12)
47568 {
47569 cSmart = text2;
47570 }
47571 if (setKey == 13)
47572 {
47573 cMount = text2;
47574 }
47575 setKey = -1;
47576 }
47577 }
47578 }
47579 }
47580 else if (menuMode == 1127)
47581 {
47582 num2 = 250;
47583 num4 = 52;
47584 num5 = 4;
47585 array4[num5 - 1] = 18;
47586 for (int num37 = 0; num37 < num5; num37++)
47587 {
47588 array7[num37] = 0.78f;
47589 }
47590 int num38 = 0;
47591 array9[num38] = (ReversedUpDownArmorSetBonuses ? Lang.menu[220].Value : Lang.menu[221].Value);
47592 if (selectedMenu == num38)
47593 {
47596 }
47597 num38++;
47599 {
47600 array9[num38] = Lang.menu[253].Value;
47601 }
47602 else
47603 {
47604 array9[num38] = (ItemSlot.Options.DisableLeftShiftTrashCan ? Lang.menu[224].Value : Lang.menu[223].Value);
47605 }
47606 if (selectedMenu == num38)
47607 {
47610 {
47611 ItemSlot.Options.DisableQuickTrash = false;
47612 ItemSlot.Options.DisableLeftShiftTrashCan = true;
47613 }
47615 {
47616 ItemSlot.Options.DisableLeftShiftTrashCan = false;
47617 }
47618 else
47619 {
47620 ItemSlot.Options.DisableQuickTrash = true;
47621 ItemSlot.Options.DisableLeftShiftTrashCan = false;
47622 }
47623 }
47624 num38++;
47625 array9[num38] = Lang.menu[222].Value;
47626 if (selectedMenu == num38)
47627 {
47629 menuMode = 888;
47630 MenuUI.SetState(ManageControlsMenu);
47631 }
47632 num38++;
47633 array9[num38] = Lang.menu[5].Value;
47634 if (selectedMenu == num38 || flag5)
47635 {
47636 flag5 = false;
47637 menuMode = 11;
47639 }
47640 }
47641 else if (menuMode == 12)
47642 {
47643 int num39 = ((SocialAPI.Network != null) ? 1 : 0);
47644 menuServer = false;
47645 array9[0] = Lang.menu[(SocialAPI.Network != null) ? 146 : 87].Value;
47646 array9[1] = Lang.menu[145].Value;
47647 array9[1 + num39] = Lang.menu[88].Value;
47648 array9[2 + num39] = Lang.menu[5].Value;
47649 if (selectedMenu == 0)
47650 {
47651 LoadPlayers();
47652 menuMultiplayer = true;
47655 menuMode = 1;
47656 }
47657 else if (selectedMenu == 1 + num39)
47658 {
47659 LoadPlayers();
47662 menuMode = 1;
47663 menuMultiplayer = true;
47664 menuServer = true;
47665 }
47666 else if (selectedMenu == 1)
47667 {
47669 SocialAPI.Friends.OpenJoinInterface();
47670 }
47671 else if (selectedMenu == 2 + num39 || flag5)
47672 {
47673 flag5 = false;
47675 menuMode = 0;
47676 }
47677 num5 = 3 + num39;
47678 }
47679 else if (menuMode == 13)
47680 {
47682 {
47683 num2 = 180;
47684 num4 = 30;
47685 int num40 = 0;
47686 array9[num40] = Lang.menu[89].Value.Replace(":", "");
47687 if (selectedMenu == num40)
47688 {
47691 menuMode = 888;
47692 }
47693 array7[num40] = 0.6f;
47694 array4[num40] = 40;
47695 num40++;
47696 for (int num41 = 0; num41 <= 6; num41++)
47697 {
47698 if (recentWorld[num41] != null && recentWorld[num41] != "")
47699 {
47700 array9[num40] = recentWorld[num41] + " (" + recentIP[num41] + ":" + recentPort[num41] + ")";
47701 }
47702 else
47703 {
47704 array9[num40] = "";
47705 array[num40] = true;
47706 }
47707 array7[num40] = 0.6f;
47708 array4[num40] = 40;
47709 if (selectedMenu == num40)
47710 {
47711 autoPass = false;
47712 Netplay.ListenPort = recentPort[num41];
47713 getIP = recentIP[num41];
47715 menuMode = 14;
47716 statusText = Language.GetTextValue("Net.ConnectingTo", getIP);
47717 }
47718 num40++;
47719 }
47720 array4[num40] = 64;
47721 array9[num40] = Lang.menu[5].Value;
47722 if (selectedMenu == num40 || flag5)
47723 {
47724 flag5 = false;
47726 menuMode = 1;
47727 }
47728 num40++;
47729 num5 = num40;
47730 }
47731 else
47732 {
47733 string text3 = getIP;
47734 PlayerInput.WritingText = true;
47735 instance.HandleIME();
47737 if (text3 != getIP)
47738 {
47740 }
47741 num5 = 11;
47742 num2 = 180;
47743 num4 = 30;
47744 array9[0] = Lang.menu[89].Value;
47745 array[0] = true;
47746 array9[1] = getIP;
47747 array4[1] = 19;
47748 if (textBlinkerState == 1)
47749 {
47750 array9[1] += "|";
47751 array5[1] = 1;
47752 }
47753 else
47754 {
47755 array9[1] += " ";
47756 }
47757 array[1] = true;
47758 array4[9] = 44;
47759 array9[9] = Lang.menu[4].Value;
47760 array2[9] = true;
47761 if (getIP != "")
47762 {
47763 if (getIP.Substring(0, 1) == " ")
47764 {
47765 getIP = "";
47766 }
47767 for (int num42 = 0; num42 < getIP.Length; num42++)
47768 {
47769 if (getIP != " ")
47770 {
47771 array2[9] = false;
47772 }
47773 }
47774 }
47775 array4[10] = 64;
47776 array9[10] = Lang.menu[5].Value;
47777 for (int num43 = 2; num43 <= 8; num43++)
47778 {
47779 int num44 = num43 - 2;
47780 if (recentWorld[num44] != null && recentWorld[num44] != "")
47781 {
47782 array9[num43] = recentWorld[num44] + " (" + recentIP[num44] + ":" + recentPort[num44] + ")";
47783 }
47784 else
47785 {
47786 array9[num43] = "";
47787 array[num43] = true;
47788 }
47789 array7[num43] = 0.6f;
47790 array4[num43] = 40;
47791 }
47792 if (selectedMenu >= 2 && selectedMenu < 9)
47793 {
47794 autoPass = false;
47795 int num45 = selectedMenu - 2;
47796 Netplay.ListenPort = recentPort[num45];
47797 getIP = recentIP[num45];
47799 menuMode = 14;
47800 statusText = Language.GetTextValue("Net.ConnectingTo", getIP);
47801 }
47802 if (selectedMenu == 10 || flag5)
47803 {
47804 flag5 = false;
47806 menuMode = 1;
47807 }
47808 if (selectedMenu == 9 || (!array2[2] && inputTextEnter))
47809 {
47811 }
47813 if (textBlinkerCount >= 20)
47814 {
47815 if (textBlinkerState == 0)
47816 {
47817 textBlinkerState = 1;
47818 }
47819 else
47820 {
47821 textBlinkerState = 0;
47822 }
47823 textBlinkerCount = 0;
47824 }
47825 }
47826 }
47827 else if (menuMode == 131)
47828 {
47830 {
47832 uIVirtualKeyboard4.CustomTextValidationForUpdate = IsGoodPortAddress;
47833 uIVirtualKeyboard4.CustomTextValidationForSubmit = IsGoodPortAddress;
47835 menuMode = 888;
47836 }
47837 int num46 = 7777;
47838 PlayerInput.WritingText = true;
47839 instance.HandleIME();
47840 string text4 = getPort;
47842 if (text4 != getPort)
47843 {
47845 }
47846 array9[0] = Lang.menu[90].Value;
47847 array2[2] = true;
47848 if (getPort != "")
47849 {
47850 bool flag7 = false;
47851 try
47852 {
47854 if (num46 > 0 && num46 <= 65535)
47855 {
47856 flag7 = true;
47857 }
47858 }
47859 catch
47860 {
47861 }
47862 if (flag7)
47863 {
47864 array2[2] = false;
47865 }
47866 }
47868 if (textBlinkerCount >= 20)
47869 {
47870 if (textBlinkerState == 0)
47871 {
47872 textBlinkerState = 1;
47873 }
47874 else
47875 {
47876 textBlinkerState = 0;
47877 }
47878 textBlinkerCount = 0;
47879 }
47880 array9[1] = getPort;
47881 if (textBlinkerState == 1)
47882 {
47883 array9[1] += "|";
47884 array5[1] = 1;
47885 }
47886 else
47887 {
47888 array9[1] += " ";
47889 }
47890 array[0] = true;
47891 array[1] = true;
47892 array4[1] = -20;
47893 array4[2] = 20;
47894 array9[2] = Lang.menu[4].Value;
47895 array9[3] = Lang.menu[5].Value;
47896 num5 = 4;
47897 if (selectedMenu == 3 || flag5)
47898 {
47899 flag5 = false;
47901 menuMode = 1;
47902 }
47903 if (selectedMenu == 2 || (!array2[2] && inputTextEnter))
47904 {
47906 }
47907 }
47908 else if (menuMode == 16)
47909 {
47910 num2 = 200;
47911 num4 = 60;
47912 array4[1] = 30;
47913 array4[2] = 30;
47914 array4[3] = 30;
47915 array4[4] = 70;
47916 array9[0] = Lang.menu[91].Value;
47917 array[0] = true;
47918 array9[1] = Lang.menu[92].Value;
47919 array9[2] = Lang.menu[93].Value;
47920 array9[3] = Lang.menu[94].Value;
47921 array9[4] = Lang.menu[5].Value;
47922 num5 = 5;
47923 if (selectedMenu == 4 || flag5)
47924 {
47925 flag5 = false;
47926 menuMode = 6;
47928 }
47929 else if (selectedMenu > 0)
47930 {
47931 if (selectedMenu == 1)
47932 {
47933 maxTilesX = 4200;
47934 maxTilesY = 1200;
47935 }
47936 else if (selectedMenu == 2)
47937 {
47938 maxTilesX = 6400;
47939 maxTilesY = 1800;
47940 }
47941 else
47942 {
47943 maxTilesX = 8400;
47944 maxTilesY = 8400;
47945 }
47946 clrInput();
47947 menuMode = -7;
47950 }
47951 }
47952 else if (menuMode == 1000000)
47953 {
47954 num5 = 2;
47955 array9[0] = statusText;
47956 array[0] = true;
47957 num2 = 220;
47958 num4 = 250;
47959 array9[1] = Lang.menu[5].Value;
47960 if (selectedMenu == 1 || flag5)
47961 {
47962 flag5 = false;
47964 menuMode = 6;
47965 netMode = 0;
47966 }
47967 }
47968 else if (menuMode == 1000001)
47969 {
47970 num5 = 2;
47971 array9[0] = statusText;
47972 array[0] = true;
47973 num2 = 220;
47974 num4 = 250;
47976 if (rejectionMenuInfo != null)
47977 {
47978 array9[0] = rejectionMenuInfo.TextToShow;
47979 }
47980 array9[1] = Lang.menu[5].Value;
47981 if (selectedMenu == 1 || flag5)
47982 {
47983 flag5 = false;
47984 ReturnFromRejectionMenuAction returnFromRejectionMenuAction = null;
47985 if (RejectionMenuInfo != null)
47986 {
47988 }
47990 {
47992 }
47993 else
47994 {
47996 menuMode = 0;
47997 netMode = 0;
47998 }
47999 }
48000 }
48001 }
48002 if (menuMode == 888)
48003 {
48005 {
48007 }
48008 }
48009 else
48010 {
48011 MenuUI.SetState(null);
48012 }
48014 {
48015 UILinkPointNavigator.Shortcuts.BackButtonLock = true;
48016 }
48017 int num47 = focusMenu;
48018 if (menuMode != num6)
48019 {
48020 if (menuMode == 10 || netMode == 1 || menuMode == 14)
48021 {
48022 gameTips.ClearTips();
48023 }
48024 blockMouse = true;
48025 menuSkip = 0;
48026 num5 = 0;
48028 {
48029 num47 = (focusMenu = -1);
48030 mouseX = (mouseY = (PlayerInput.MouseX = (PlayerInput.MouseY = 0)));
48031 }
48032 for (int num48 = 0; num48 < maxMenuItems; num48++)
48033 {
48034 menuItemScale[num48] = 0.8f;
48035 }
48036 }
48037 if (!mouseLeft)
48038 {
48039 blockMouse = true;
48040 }
48041 selectedMenu = -1;
48042 selectedMenu2 = -1;
48043 focusMenu = -1;
48045 if (!flag)
48046 {
48047 grabColorSlider = 0;
48048 hBar = -1f;
48049 sBar = -1f;
48050 lBar = -1f;
48051 aBar = -1f;
48052 }
48053 if (flag)
48054 {
48055 if (!mouseLeft)
48056 {
48057 grabColorSlider = 0;
48058 blockMouse = false;
48059 }
48060 int num49 = focusColor;
48061 focusColor = 0;
48062 int num50 = num9;
48063 int num51 = screenWidth / 2 - TextureAssets.Hue.Width() / 2;
48064 int num52 = 167;
48066 float num53 = vector.X;
48067 float num54 = vector.Y;
48068 float luminosity = vector.Z;
48069 float num55 = (float)(int)selColor.A / 255f;
48070 if (hBar == -1f || sBar == -1f || lBar == -1f || aBar == -1f)
48071 {
48072 hBar = num53;
48073 sBar = num54;
48074 lBar = luminosity;
48075 aBar = num55;
48076 }
48077 else
48078 {
48079 num53 = hBar;
48080 num54 = sBar;
48081 luminosity = lBar;
48082 num55 = aBar;
48083 }
48085 if ((mouseX > num51 - 4 && mouseX < num51 + TextureAssets.Hue.Width() + 4 && mouseY > num50 - 4 && mouseY < num50 + TextureAssets.Hue.Height() + 4 && grabColorSlider == 0) || grabColorSlider == 1)
48086 {
48088 }
48089 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num51 + (float)(TextureAssets.Hue.Width() - 2) * hBar - (float)(TextureAssets.ColorSlider.Width() / 2), num50 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
48090 if ((mouseX > num51 - 4 && mouseX < num51 + TextureAssets.Hue.Width() + 4 && mouseY > num50 - 4 && mouseY < num50 + TextureAssets.Hue.Height() + 4 && grabColorSlider == 0) || grabColorSlider == 1)
48091 {
48092 focusColor = 1;
48093 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 5;
48094 if (flag8 && !blockMouse)
48095 {
48096 grabColorSlider = 1;
48097 num53 = mouseX - num51;
48098 num53 /= (float)TextureAssets.Hue.Width();
48099 if (num53 < 0f)
48100 {
48101 num53 = 0f;
48102 }
48103 if (num53 > 1f)
48104 {
48105 num53 = 1f;
48106 }
48107 hBar = num53;
48108 }
48109 }
48111 num50 += 26;
48113 for (int num56 = 0; num56 <= num52; num56++)
48114 {
48115 float saturation = (float)num56 / (float)num52;
48117 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num51 + num56 + 5, num50 + 4), color4);
48118 }
48119 if ((mouseX > num51 - 4 && mouseX < num51 + TextureAssets.Hue.Width() + 4 && mouseY > num50 - 4 && mouseY < num50 + TextureAssets.Hue.Height() + 4 && grabColorSlider == 0) || grabColorSlider == 2)
48120 {
48122 }
48123 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num51 + (float)(TextureAssets.Hue.Width() - 2) * sBar - (float)(TextureAssets.ColorSlider.Width() / 2), num50 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
48124 if ((mouseX > num51 - 4 && mouseX < num51 + TextureAssets.Hue.Width() + 4 && mouseY > num50 - 4 && mouseY < num50 + TextureAssets.Hue.Height() + 4 && grabColorSlider == 0) || grabColorSlider == 2)
48125 {
48126 focusColor = 2;
48127 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 6;
48128 if (flag8 && !blockMouse)
48129 {
48130 grabColorSlider = 2;
48131 num54 = mouseX - num51;
48132 num54 /= (float)TextureAssets.Hue.Width();
48133 if (num54 < 0f)
48134 {
48135 num54 = 0f;
48136 }
48137 if (num54 > 1f)
48138 {
48139 num54 = 1f;
48140 }
48141 sBar = num54;
48142 }
48143 }
48145 num50 += 26;
48147 float num57 = 0.15f;
48148 if (menuMode == 252)
48149 {
48150 num57 = 0f;
48151 }
48152 for (int num58 = 0; num58 <= num52; num58++)
48153 {
48154 float luminosity2 = (float)num58 / (float)num52;
48156 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num51 + num58 + 5, num50 + 4), color5);
48157 }
48158 if ((mouseX > num51 - 4 && mouseX < num51 + TextureAssets.Hue.Width() + 4 && mouseY > num50 - 4 && mouseY < num50 + TextureAssets.Hue.Height() + 4 && grabColorSlider == 0) || grabColorSlider == 3)
48159 {
48161 }
48162 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num51 + (float)(TextureAssets.Hue.Width() - 2) * ((lBar - num57) / (1f - num57)) - (float)(TextureAssets.ColorSlider.Width() / 2), num50 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
48163 if ((mouseX > num51 - 4 && mouseX < num51 + TextureAssets.Hue.Width() + 4 && mouseY > num50 - 4 && mouseY < num50 + TextureAssets.Hue.Height() + 4 && grabColorSlider == 0) || grabColorSlider == 3)
48164 {
48165 focusColor = 3;
48166 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 7;
48167 if (flag8 && !blockMouse)
48168 {
48169 grabColorSlider = 3;
48171 luminosity /= (float)TextureAssets.Hue.Width();
48172 if (luminosity < 0f)
48173 {
48174 luminosity = 0f;
48175 }
48176 if (luminosity > 1f)
48177 {
48178 luminosity = 1f;
48179 }
48180 luminosity = (lBar = luminosity * (1f - num57) + num57);
48181 }
48182 }
48184 bool flag9 = false;
48185 if (menuMode == 252)
48186 {
48187 num50 += 26;
48188 flag9 = true;
48191 for (int num59 = 0; num59 <= num52; num59++)
48192 {
48193 float num60 = (float)num59 / (float)num52;
48195 spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2(num51 + num59 + 5, num50 + 4), color7);
48196 }
48197 if ((mouseX > num51 - 4 && mouseX < num51 + TextureAssets.Hue.Width() + 4 && mouseY > num50 - 4 && mouseY < num50 + TextureAssets.Hue.Height() + 4 && grabColorSlider == 0) || grabColorSlider == 4)
48198 {
48200 }
48201 spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float)num51 + (float)(TextureAssets.Hue.Width() - 2) * aBar - (float)(TextureAssets.ColorSlider.Width() / 2), num50 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2), Microsoft.Xna.Framework.Color.White);
48202 if ((mouseX > num51 - 4 && mouseX < num51 + TextureAssets.Hue.Width() + 4 && mouseY > num50 - 4 && mouseY < num50 + TextureAssets.Hue.Height() + 4 && grabColorSlider == 0) || grabColorSlider == 4)
48203 {
48204 focusColor = 4;
48205 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 8;
48206 if (mouseLeft && !blockMouse)
48207 {
48208 grabColorSlider = 4;
48209 num55 = mouseX - num51;
48210 num55 /= (float)TextureAssets.Hue.Width();
48211 if (num55 < 0f)
48212 {
48213 num55 = 0f;
48214 }
48215 if (num55 > 1f)
48216 {
48217 num55 = 1f;
48218 }
48219 aBar = num55;
48220 }
48221 }
48223 }
48224 if (num49 != focusColor)
48225 {
48227 }
48229 if (flag9)
48230 {
48231 selColor.A = (byte)(aBar * 255f);
48232 }
48233 }
48234 else if (flag)
48235 {
48236 string text5 = "";
48237 for (int num61 = 0; num61 < 6; num61++)
48238 {
48239 int num62 = num9;
48240 int num63 = 370 + screenWidth / 2 - 400;
48241 if (num61 == 0)
48242 {
48243 text5 = Lang.menu[95].Value;
48244 }
48245 if (num61 == 1)
48246 {
48247 text5 = Lang.menu[96].Value;
48248 num62 += 30;
48249 }
48250 if (num61 == 2)
48251 {
48252 text5 = Lang.menu[97].Value;
48253 num62 += 60;
48254 }
48255 if (num61 == 3)
48256 {
48257 text5 = string.Concat(selColor.R);
48258 num63 += 90;
48259 }
48260 if (num61 == 4)
48261 {
48262 text5 = string.Concat(selColor.G);
48263 num63 += 90;
48264 num62 += 30;
48265 }
48266 if (num61 == 5)
48267 {
48268 text5 = string.Concat(selColor.B);
48269 num63 += 90;
48270 num62 += 60;
48271 }
48272 for (int num64 = 0; num64 < 5; num64++)
48273 {
48275 if (num64 == 4)
48276 {
48277 color8 = color;
48278 color8.R = (byte)((255 + color8.R) / 2);
48279 color8.G = (byte)((255 + color8.R) / 2);
48280 color8.B = (byte)((255 + color8.R) / 2);
48281 }
48282 int num65 = 255;
48283 int num66 = color8.R - (255 - num65);
48284 if (num66 < 0)
48285 {
48286 num66 = 0;
48287 }
48288 color8 = new Microsoft.Xna.Framework.Color((byte)num66, (byte)num66, (byte)num66, (byte)num65);
48289 int num67 = 0;
48290 int num68 = 0;
48291 if (num64 == 0)
48292 {
48293 num67 = -2;
48294 }
48295 if (num64 == 1)
48296 {
48297 num67 = 2;
48298 }
48299 if (num64 == 2)
48300 {
48301 num68 = -2;
48302 }
48303 if (num64 == 3)
48304 {
48305 num68 = 2;
48306 }
48308 }
48309 }
48310 bool flag10 = false;
48311 for (int num69 = 0; num69 < 2; num69++)
48312 {
48313 for (int num70 = 0; num70 < 3; num70++)
48314 {
48315 int num71 = num9 + num70 * 30 - 12;
48316 int num72 = 360 + screenWidth / 2 - 400;
48317 float num73 = 0.9f;
48318 if (num69 == 0)
48319 {
48320 num72 -= 70;
48321 num71 += 2;
48322 }
48323 else
48324 {
48325 num72 -= 40;
48326 }
48327 text5 = "-";
48328 if (num69 == 1)
48329 {
48330 text5 = "+";
48331 }
48332 Vector2 vector2 = new Vector2(24f, 24f);
48333 int num74 = 142;
48334 if (mouseX > num72 && (float)mouseX < (float)num72 + vector2.X && mouseY > num71 + 13 && (float)mouseY < (float)(num71 + 13) + vector2.Y)
48335 {
48336 if (focusColor != (num69 + 1) * (num70 + 10))
48337 {
48339 }
48340 focusColor = (num69 + 1) * (num70 + 10);
48341 flag10 = true;
48342 num74 = 255;
48343 if (mouseLeft)
48344 {
48345 if (colorDelay <= 1)
48346 {
48347 if (colorDelay == 0)
48348 {
48349 colorDelay = 40;
48350 }
48351 else
48352 {
48353 colorDelay = 3;
48354 }
48355 int num75 = num69;
48356 if (num69 == 0)
48357 {
48358 num75 = -1;
48359 if (selColor.R + selColor.G + selColor.B <= 150)
48360 {
48361 num75 = 0;
48362 }
48363 }
48364 if (num70 == 0 && selColor.R + num75 >= 0 && selColor.R + num75 <= 255)
48365 {
48366 selColor.R = (byte)(selColor.R + num75);
48367 }
48368 if (num70 == 1 && selColor.G + num75 >= 0 && selColor.G + num75 <= 255)
48369 {
48370 selColor.G = (byte)(selColor.G + num75);
48371 }
48372 if (num70 == 2 && selColor.B + num75 >= 0 && selColor.B + num75 <= 255)
48373 {
48374 selColor.B = (byte)(selColor.B + num75);
48375 }
48376 }
48377 colorDelay--;
48378 }
48379 else
48380 {
48381 colorDelay = 0;
48382 }
48383 }
48384 for (int num76 = 0; num76 < 5; num76++)
48385 {
48387 if (num76 == 4)
48388 {
48389 color9 = color;
48390 color9.R = (byte)((255 + color9.R) / 2);
48391 color9.G = (byte)((255 + color9.R) / 2);
48392 color9.B = (byte)((255 + color9.R) / 2);
48393 }
48394 int num77 = color9.R - (255 - num74);
48395 if (num77 < 0)
48396 {
48397 num77 = 0;
48398 }
48399 color9 = new Microsoft.Xna.Framework.Color((byte)num77, (byte)num77, (byte)num77, (byte)num74);
48400 int num78 = 0;
48401 int num79 = 0;
48402 if (num76 == 0)
48403 {
48404 num78 = -2;
48405 }
48406 if (num76 == 1)
48407 {
48408 num78 = 2;
48409 }
48410 if (num76 == 2)
48411 {
48412 num79 = -2;
48413 }
48414 if (num76 == 3)
48415 {
48416 num79 = 2;
48417 }
48419 }
48420 }
48421 }
48422 if (!flag10)
48423 {
48424 focusColor = 0;
48425 colorDelay = 0;
48426 }
48427 }
48428 if (flag2)
48429 {
48430 float x = screenWidth / 2 - 40 + 37;
48431 int num80 = 320;
48432 string text6 = "";
48433 for (int num81 = 0; num81 < 6; num81++)
48434 {
48435 int num82 = num80;
48436 int num83 = 370 + screenWidth / 2 - 400 + 37;
48437 switch (num81)
48438 {
48439 case 0:
48440 text6 = Lang.menu[98].Value;
48441 num82 += 30;
48442 break;
48443 case 1:
48444 text6 = Lang.menu[99].Value;
48445 break;
48446 case 2:
48447 text6 = Lang.menu[119].Value;
48448 num82 += 60;
48449 break;
48450 case 3:
48451 text6 = Math.Round(musicVolume * 100f) + "%";
48452 num83 += 90;
48453 break;
48454 case 4:
48455 text6 = Math.Round(soundVolume * 100f) + "%";
48456 num83 += 90;
48457 num82 += 30;
48458 break;
48459 case 5:
48460 text6 = Math.Round(ambientVolume * 100f) + "%";
48461 num83 += 90;
48462 num82 += 60;
48463 break;
48464 }
48466 color10.R = (byte)((255 + color10.R) / 2);
48467 color10.G = (byte)((255 + color10.R) / 2);
48468 color10.B = (byte)((255 + color10.R) / 2);
48469 int num84 = 255;
48470 int num85 = color10.R - (255 - num84);
48471 if (num85 < 0)
48472 {
48473 num85 = 0;
48474 }
48476 }
48477 int rightHover = IngameOptions.rightHover;
48478 IngameOptions.rightHover = -1;
48479 if (!mouseLeft)
48480 {
48481 IngameOptions.rightLock = -1;
48482 }
48483 IngameOptions.valuePosition = new Vector2(x, num80 - 18 + 30);
48487 {
48488 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 2;
48489 IngameOptions.rightHover = 3;
48490 if (flag8 && IngameOptions.rightLock == 3)
48491 {
48493 }
48494 }
48495 IngameOptions.valuePosition = new Vector2(x, num80 - 18 + 60);
48499 {
48500 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 3;
48501 IngameOptions.rightHover = 2;
48502 if (flag8 && IngameOptions.rightLock == 2)
48503 {
48505 }
48506 }
48507 IngameOptions.valuePosition = new Vector2(x, num80 - 18 + 90);
48511 {
48512 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 4;
48513 IngameOptions.rightHover = 4;
48514 if (flag8 && IngameOptions.rightLock == 4)
48515 {
48517 }
48518 }
48519 if (IngameOptions.rightHover != -1)
48520 {
48521 IngameOptions.rightLock = IngameOptions.rightHover;
48522 }
48523 if (IngameOptions.rightHover != rightHover)
48524 {
48526 }
48527 }
48528 if (flag3)
48529 {
48530 int num89 = 400;
48531 string text7 = "";
48532 for (int num90 = 0; num90 < 4; num90++)
48533 {
48534 int num91 = num89;
48535 int num92 = 370 + screenWidth / 2 - 400;
48536 if (num90 == 0)
48537 {
48538 text7 = Lang.menu[52].Value + ": " + bgScroll;
48539 }
48540 for (int num93 = 0; num93 < 5; num93++)
48541 {
48543 if (num93 == 4)
48544 {
48545 color11 = color;
48546 color11.R = (byte)((255 + color11.R) / 2);
48547 color11.G = (byte)((255 + color11.R) / 2);
48548 color11.B = (byte)((255 + color11.R) / 2);
48549 }
48550 int num94 = 255;
48551 int num95 = color11.R - (255 - num94);
48552 if (num95 < 0)
48553 {
48554 num95 = 0;
48555 }
48556 color11 = new Microsoft.Xna.Framework.Color((byte)num95, (byte)num95, (byte)num95, (byte)num94);
48557 int num96 = 0;
48558 int num97 = 0;
48559 if (num93 == 0)
48560 {
48561 num96 = -2;
48562 }
48563 if (num93 == 1)
48564 {
48565 num96 = 2;
48566 }
48567 if (num93 == 2)
48568 {
48569 num97 = -2;
48570 }
48571 if (num93 == 3)
48572 {
48573 num97 = 2;
48574 }
48576 }
48577 }
48578 IngameOptions.rightHover = -1;
48579 if (!mouseLeft)
48580 {
48581 IngameOptions.rightLock = -1;
48582 }
48583 IngameOptions.valuePosition = new Vector2(screenWidth / 2 - 40, num89 + 12);
48585 float num98 = IngameOptions.DrawValueBar(spriteBatch, 1f, (float)bgScroll / 100f);
48587 {
48588 UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 1;
48589 IngameOptions.rightHover = 2;
48590 if (flag8 && IngameOptions.rightLock == 2)
48591 {
48592 bgScroll = (int)(num98 * 100f);
48593 caveParallax = 1f - (float)bgScroll / 500f;
48594 }
48595 }
48596 if (IngameOptions.rightHover != -1)
48597 {
48598 IngameOptions.rightLock = IngameOptions.rightHover;
48599 }
48600 }
48601 bool flag11 = false;
48602 for (int num99 = 0; num99 < num5; num99++)
48603 {
48604 if (array9[num99] == null)
48605 {
48606 continue;
48607 }
48608 Vector2 vector3 = FontAssets.DeathText.Value.MeasureString(array9[num99]);
48609 vector3.X *= 0.5f;
48610 vector3.Y *= 0.5f;
48611 for (int num100 = 0; num100 < 5; num100++)
48612 {
48614 if (num100 == 4)
48615 {
48616 switch (array6[num99])
48617 {
48618 case 0:
48619 color12 = color;
48620 break;
48621 case 1:
48622 color12 = mcColor;
48623 break;
48624 case 2:
48625 color12 = hcColor;
48626 break;
48627 case 3:
48629 break;
48630 case 4:
48631 case 5:
48632 case 6:
48634 break;
48635 default:
48636 color12 = color;
48637 break;
48638 }
48639 color12.R = (byte)((255 + color12.R) / 2);
48640 color12.G = (byte)((255 + color12.G) / 2);
48641 color12.B = (byte)((255 + color12.B) / 2);
48642 }
48643 int num101 = (int)(255f * (menuItemScale[num99] * 2f - 1f));
48644 if (array[num99])
48645 {
48646 num101 = 255;
48647 }
48648 int num102 = color12.R - (255 - num101);
48649 if (num102 < 0)
48650 {
48651 num102 = 0;
48652 }
48653 int num103 = color12.G - (255 - num101);
48654 if (num103 < 0)
48655 {
48656 num103 = 0;
48657 }
48658 int num104 = color12.B - (255 - num101);
48659 if (num104 < 0)
48660 {
48661 num104 = 0;
48662 }
48663 if (num47 == num99 && num100 == 4)
48664 {
48665 float num105 = (float)num101 / 255f;
48666 num102 = (int)((float)num102 * (1f - num105) + 255f * num105);
48667 num103 = (int)((float)num103 * (1f - num105) + 215f * num105);
48668 num104 = (int)((float)num104 * (1f - num105) + 0f * num105);
48669 }
48670 color12 = new Microsoft.Xna.Framework.Color((byte)num102, (byte)num103, (byte)num104, (byte)num101);
48671 if (array3[num99])
48672 {
48673 if (num100 == 4)
48674 {
48675 color12.R = (byte)(color12.R * mouseTextColor / 300);
48676 color12.G = (byte)(color12.G * mouseTextColor / 300);
48677 color12.B = (byte)(color12.B * mouseTextColor / 300);
48678 color12.A = (byte)(color12.A * mouseTextColor / 300);
48679 }
48680 else
48681 {
48682 color12.A -= (byte)(mouseTextColor / 5);
48683 }
48684 }
48685 int num106 = 0;
48686 int num107 = 0;
48687 if (num100 == 0)
48688 {
48689 num106 = -2;
48690 }
48691 if (num100 == 1)
48692 {
48693 num106 = 2;
48694 }
48695 if (num100 == 2)
48696 {
48697 num107 = -2;
48698 }
48699 if (num100 == 3)
48700 {
48701 num107 = 2;
48702 }
48703 float num108 = menuItemScale[num99];
48704 if (menuMode == 15 && num99 == 0)
48705 {
48706 num108 *= 0.35f;
48707 }
48708 else if (menuMode == 1000000 && num99 == 0)
48709 {
48710 num108 *= 0.75f;
48711 }
48712 else if (netMode == 2)
48713 {
48714 num108 *= 0.5f;
48715 }
48716 num108 *= array7[num99];
48717 if (!array8[num99])
48718 {
48720 }
48721 else
48722 {
48724 }
48725 }
48726 if (!array[num99] && !array2[num99])
48727 {
48729 }
48730 if (!array8[num99])
48731 {
48732 int num109 = 0;
48733 menuWide[num99] = false;
48734 Vector2 vector4 = FontAssets.DeathText.Value.MeasureString(array9[num99]) * array7[num99];
48735 if (!((float)mouseX > (float)num3 - vector4.X * 0.5f + (float)array5[num99] - (float)num109) || !((float)mouseX < (float)num3 + vector4.X * 0.5f * array7[num99] + (float)array5[num99] + (float)num109) || mouseY <= num2 + num4 * num99 + array4[num99] || !((float)mouseY < (float)(num2 + num4 * num99 + array4[num99]) + 50f * array7[num99]) || !hasFocus)
48736 {
48737 continue;
48738 }
48739 focusMenu = num99;
48740 if (array[num99] || array2[num99])
48741 {
48742 focusMenu = -1;
48743 continue;
48744 }
48745 if (num47 != focusMenu)
48746 {
48747 flag11 = true;
48748 }
48750 {
48752 }
48754 {
48756 }
48757 continue;
48758 }
48759 Vector2 vector5 = FontAssets.DeathText.Value.MeasureString(array9[num99]) * array7[num99];
48760 if (mouseX <= num3 + array5[num99] || !((float)mouseX < (float)num3 + vector5.X + (float)array5[num99]) || mouseY <= num2 + num4 * num99 + array4[num99] || !((float)mouseY < (float)(num2 + num4 * num99 + array4[num99]) + 50f * array7[num99]) || !hasFocus)
48761 {
48762 continue;
48763 }
48764 focusMenu = num99;
48765 if (array[num99] || array2[num99])
48766 {
48767 focusMenu = -1;
48768 continue;
48769 }
48770 if (num47 != focusMenu)
48771 {
48772 flag11 = true;
48773 }
48775 {
48777 }
48779 {
48781 }
48782 }
48783 if (flag11 && num47 != focusMenu)
48784 {
48786 }
48788 {
48789 Vector2 vector6 = new Vector2((float)Math.Cos(GlobalTimeWrappedHourly * ((float)Math.PI * 2f)), (float)Math.Sin(GlobalTimeWrappedHourly * ((float)Math.PI * 2f) * 2f)) * new Vector2(30f, 15f) + Vector2.UnitY * 20f;
48791 }
48792 for (int num110 = 0; num110 < maxMenuItems; num110++)
48793 {
48794 if (num110 == focusMenu)
48795 {
48796 if (menuItemScale[num110] < 1f)
48797 {
48798 menuItemScale[num110] += 0.02f;
48799 }
48800 if (menuItemScale[num110] > 1f)
48801 {
48802 menuItemScale[num110] = 1f;
48803 }
48804 }
48805 else if ((double)menuItemScale[num110] > 0.8)
48806 {
48807 menuItemScale[num110] -= 0.02f;
48808 }
48809 }
48810 if (flag4)
48811 {
48812 spriteBatch.End();
48815 pendingPlayer.PlayerFrame();
48816 pendingPlayer.position.X = (float)num7 + screenPosition.X;
48817 pendingPlayer.position.Y = (float)num8 + screenPosition.Y;
48818 PlayerRenderer.DrawPlayer(Camera, pendingPlayer, pendingPlayer.position, 0f, Vector2.Zero);
48819 spriteBatch.End();
48821 }
48822 float num111 = 0f;
48823 if (!WorldGen.drunkWorldGen && menuMode == 0)
48824 {
48826 num111 += 32f;
48827 }
48829 {
48830 DrawVersionNumber(color, num111);
48831 num111 += 20f;
48832 }
48833 spriteBatch.End();
48839 if (fadeCounter > 0)
48840 {
48842 byte b2 = 0;
48843 fadeCounter--;
48844 float num112 = (float)fadeCounter / 120f * 255f;
48845 if (quickSplash)
48846 {
48847 num112 = (float)fadeCounter / 75f * 255f;
48848 }
48849 b2 = (byte)num112;
48852 }
48853 spriteBatch.End();
48854 if (mouseLeft)
48855 {
48856 mouseLeftRelease = false;
48857 }
48858 else
48859 {
48860 mouseLeftRelease = true;
48861 }
48862 if (mouseRight)
48863 {
48864 mouseRightRelease = false;
48865 }
48866 else
48867 {
48868 mouseRightRelease = true;
48869 }
48870 if (menuMode == num)
48871 {
48872 GamepadMainMenuHandler.LastDrew = num;
48873 }
48874 }
48875
48876 public static void CycleFrameSkipMode()
48877 {
48878 int frameSkipMode = (int)FrameSkipMode;
48879 frameSkipMode++;
48881 {
48882 frameSkipMode = 0;
48883 }
48885 }
48886
48888 {
48889 Netplay.ServerPassword = passwordCandidate;
48891 }
48892
48894 {
48895 NetMessage.SendData(38);
48896 menuMode = 14;
48897 }
48898
48899 private static void CanceledGivingServerPassword()
48900 {
48902 menuMode = 0;
48903 Netplay.Disconnect = true;
48904 Netplay.ServerPassword = "";
48905 }
48906
48908 {
48909 Netplay.ServerPassword = passwordCandidate;
48911 }
48912
48914 {
48915 string text = "-autoshutdown -password \"" + ConvertToSafeArgument(Netplay.ServerPassword) + "\" -lang " + Language.ActiveCulture.LegacyId;
48916 if (Platform.IsLinux)
48917 {
48918 text = ((IntPtr.Size != 8) ? (text + " -x86") : (text + " -x64"));
48919 }
48920 text = ((!ActiveWorldFileData.IsCloudSave) ? (text + SanitizePathArgument("world", worldPathName)) : (text + SanitizePathArgument("cloudworld", worldPathName)));
48921 text = text + " -worldrollbackstokeep " + WorldRollingBackupsCountToKeep;
48922 tServer = new Process();
48923 if (Platform.IsLinux)
48924 {
48925 tServer.StartInfo.FileName = "TerrariaServer";
48926 }
48927 else if (Platform.IsOSX)
48928 {
48929 tServer.StartInfo.FileName = "../MacOS/TerrariaServer";
48930 }
48931 else
48932 {
48933 tServer.StartInfo.FileName = "TerrariaServer.exe";
48934 }
48935 tServer.StartInfo.Arguments = text;
48936 if (libPath != "")
48937 {
48939 startInfo.Arguments = startInfo.Arguments + " -loadlib " + libPath;
48940 }
48941 tServer.StartInfo.UseShellExecute = false;
48942 tServer.StartInfo.CreateNoWindow = true;
48943 if (SocialAPI.Network != null)
48944 {
48945 SocialAPI.Network.LaunchLocalServer(tServer, MenuServerMode);
48946 }
48947 else
48948 {
48949 tServer.Start();
48950 }
48951 Netplay.SetRemoteIP("127.0.0.1");
48952 autoPass = true;
48953 statusText = Lang.menu[8].Value;
48955 menuMode = 10;
48956 }
48957
48958 private static void ExitServerPasswordMenu()
48959 {
48960 if (SocialAPI.Network != null)
48961 {
48962 menuMode = 889;
48963 }
48964 else
48965 {
48966 menuMode = 6;
48967 }
48968 Netplay.ServerPassword = "";
48969 }
48970
48971 private static bool IsGoodPortAddress(string text)
48972 {
48973 if (string.IsNullOrWhiteSpace(text))
48974 {
48975 return false;
48976 }
48977 ushort result = 0;
48978 if (!ushort.TryParse(text, out result))
48979 {
48980 return false;
48981 }
48982 return true;
48983 }
48984
48985 private static void OnSubmitServerPort(string candidatePort)
48986 {
48987 Netplay.ListenPort = ushort.Parse(candidatePort);
48988 autoPass = false;
48990 menuMode = 14;
48991 statusText = Language.GetTextValue("Net.ConnectingTo", getIP);
48992 }
48993
48994 public static void OnSubmitServerIP(string inputText)
48995 {
48996 getIP = inputText;
48998 menuMode = 131;
48999 clrInput();
49000 }
49001
49003 {
49005 Vector2 anchorPosition = new Vector2(18f, (float)(screenHeight - 26) - upBump);
49006 for (int i = 0; i < titleLinks.Count; i++)
49007 {
49009 anchorPosition.X += 30f;
49010 }
49011 }
49012
49014 {
49015 string text = versionNumber;
49016 Vector2 vector = FontAssets.MouseText.Value.MeasureString(text);
49017 vector.X *= 0.5f;
49018 vector.Y *= 0.5f;
49019 for (int i = 0; i < 5; i++)
49020 {
49022 if (i == 4)
49023 {
49024 color = menuColor;
49025 color.R = (byte)((255 + color.R) / 2);
49026 color.G = (byte)((255 + color.R) / 2);
49027 color.B = (byte)((255 + color.R) / 2);
49028 }
49029 color.A = (byte)((float)(int)color.A * 0.3f);
49030 int num = 0;
49031 int num2 = 0;
49032 if (i == 0)
49033 {
49034 num = -2;
49035 }
49036 if (i == 1)
49037 {
49038 num = 2;
49039 }
49040 if (i == 2)
49041 {
49042 num2 = -2;
49043 }
49044 if (i == 3)
49045 {
49046 num2 = 2;
49047 }
49048 DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, FontAssets.MouseText.Value, text, new Vector2(vector.X + (float)num + 10f, (float)screenHeight - vector.Y + (float)num2 - 2f - upBump), color, 0f, vector, 1f, SpriteEffects.None, 0f);
49049 }
49050 }
49051
49052 private static void ClearVisualPostProcessEffects()
49053 {
49054 for (int i = 0; i < 13; i++)
49055 {
49056 string key = "";
49057 switch (i)
49058 {
49059 case 0:
49060 key = "Solar";
49061 break;
49062 case 1:
49063 key = "Vortex";
49064 break;
49065 case 2:
49066 key = "Nebula";
49067 break;
49068 case 3:
49069 key = "Stardust";
49070 break;
49071 case 4:
49072 key = "MoonLord";
49073 break;
49074 case 5:
49075 key = "MonolithSolar";
49076 break;
49077 case 6:
49078 key = "MonolithVortex";
49079 break;
49080 case 7:
49081 key = "MonolithNebula";
49082 break;
49083 case 8:
49084 key = "MonolithStardust";
49085 break;
49086 case 9:
49087 key = "Blizzard";
49088 break;
49089 case 10:
49090 key = "HeatDistortion";
49091 break;
49092 case 11:
49093 key = "Sandstorm";
49094 break;
49095 case 12:
49096 key = "MonolithMoonLord";
49097 break;
49098 }
49099 if (SkyManager.Instance[key] != null && SkyManager.Instance[key].IsActive())
49100 {
49101 SkyManager.Instance[key].Deactivate();
49102 }
49103 if (Overlays.Scene[key] != null && Overlays.Scene[key].IsVisible())
49104 {
49105 Overlays.Scene[key].Deactivate();
49106 }
49108 {
49109 Terraria.Graphics.Effects.Filters.Scene[key].Deactivate();
49110 }
49111 }
49112 if (Terraria.Graphics.Effects.Filters.Scene["BloodMoon"].IsActive())
49113 {
49114 Terraria.Graphics.Effects.Filters.Scene["BloodMoon"].Deactivate();
49115 }
49116 if (Terraria.Graphics.Effects.Filters.Scene["Graveyard"].IsActive())
49117 {
49118 Terraria.Graphics.Effects.Filters.Scene["Graveyard"].Deactivate();
49119 }
49120 if (Terraria.Graphics.Effects.Filters.Scene["Sepia"].IsActive())
49121 {
49122 Terraria.Graphics.Effects.Filters.Scene["Sepia"].Deactivate();
49123 }
49124 if (Terraria.Graphics.Effects.Filters.Scene["BloodMoon"].IsActive())
49125 {
49126 Terraria.Graphics.Effects.Filters.Scene["BloodMoon"].Deactivate();
49127 }
49128 if (Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].IsActive())
49129 {
49130 Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].Deactivate();
49131 }
49132 if (Terraria.Graphics.Effects.Filters.Scene["WaterDistortion"].IsActive())
49133 {
49134 Terraria.Graphics.Effects.Filters.Scene["WaterDistortion"].Deactivate();
49135 }
49136 if (SkyManager.Instance["Martian"].IsActive())
49137 {
49138 SkyManager.Instance["Martian"].Deactivate();
49139 }
49140 if (SkyManager.Instance["Party"].IsActive())
49141 {
49142 SkyManager.Instance["Party"].Deactivate();
49143 }
49144 if (SkyManager.Instance["Slime"].IsActive())
49145 {
49146 SkyManager.Instance["Slime"].Deactivate();
49147 }
49148 if (SkyManager.Instance["Ambience"].IsActive())
49149 {
49150 SkyManager.Instance["Ambience"].Deactivate();
49151 }
49152 slimeRain = false;
49153 slimeRainTime = 0.0;
49154 slimeWarningTime = 0;
49159 maxRaining = 0f;
49160 raining = false;
49161 }
49162
49164 {
49166 {
49167 screenPosition.Y -= screenSizeCache.Y - screenHeight;
49168 }
49169 }
49170
49172 {
49174 float num = (float)screenHeight / 900f;
49175 if (num < 1f)
49176 {
49177 num = 1f;
49178 }
49180 {
49181 num = 1f;
49182 }
49184 UIScale = num;
49188 {
49190 MenuUI.Recalculate();
49191 }
49193 }
49194
49195 private static bool IsBorderlessDisplayAvailable()
49196 {
49197 bool result = false;
49198 if (Platform.IsWindows)
49199 {
49200 result = true;
49201 }
49202 return result;
49203 }
49204
49205 private static void SetDisplayModeAsBorderless(ref int width, ref int height, Form form)
49206 {
49207 if (screenBorderless && !graphics.IsFullScreen && screenBorderlessPendingResizes > 0)
49208 {
49210 System.Drawing.Rectangle bounds = Screen.FromPoint(form.Location).Bounds;
49211 width = bounds.Width;
49212 height = bounds.Height;
49214 }
49215 }
49216
49217 private static void ApplyBorderlessResolution(Form form)
49218 {
49220 {
49222 System.Drawing.Rectangle bounds = Screen.FromPoint(form.Location).Bounds;
49223 form.Location = new System.Drawing.Point(bounds.X, bounds.Y);
49224 form.FormBorderStyle = FormBorderStyle.None;
49225 form.Width = bounds.Width;
49226 form.Height = bounds.Height;
49227 }
49228 }
49229
49230 private static void SetBorderlessFormStyle(Form form)
49231 {
49232 form.Location = new System.Drawing.Point(0, 0);
49233 form.FormBorderStyle = FormBorderStyle.None;
49234 }
49235
49236 public static void OpenCharacterSelectUI()
49237 {
49238 menuMode = 888;
49239 MenuUI.SetState(_characterSelectMenu);
49240 }
49241
49242 public static void OpenReportsMenu()
49243 {
49245 list.Add(IssueReporter);
49246 if (SocialAPI.Workshop != null)
49247 {
49248 list.Add(SocialAPI.Workshop.IssueReporter);
49249 }
49250 UIReportsPage state = new UIReportsPage(MenuUI.CurrentState, menuMode, list);
49251 menuMode = 888;
49252 MenuUI.SetState(state);
49253 }
49254
49255 public static void OpenWorldSelectUI()
49256 {
49257 menuMode = 888;
49258 MenuUI.SetState(_worldSelectMenu);
49259 }
49260
49266
49267 private static void CycleClothingStyle(Player plr)
49268 {
49270 while (!IsValidPlayerStyle(plr))
49271 {
49273 }
49274 }
49275
49276 private static bool IsValidPlayerStyle(Player plr)
49277 {
49278 int skinVariant = plr.skinVariant;
49279 if ((uint)(skinVariant - 10) <= 1u)
49280 {
49281 return false;
49282 }
49283 return true;
49284 }
49285
49287 {
49288 if (plr.Male)
49289 {
49290 int num = 0;
49292 for (int i = 0; i < variantOrderMale.Length; i++)
49293 {
49294 if (variantOrderMale[i] == plr.skinVariant)
49295 {
49296 num = i;
49297 break;
49298 }
49299 }
49300 if (num == variantOrderMale.Length - 1)
49301 {
49302 plr.skinVariant = variantOrderMale[0];
49303 }
49304 else
49305 {
49306 plr.skinVariant = variantOrderMale[num + 1];
49307 }
49308 return;
49309 }
49310 int num2 = 0;
49312 for (int j = 0; j < variantOrderFemale.Length; j++)
49313 {
49314 if (variantOrderFemale[j] == plr.skinVariant)
49315 {
49316 num2 = j;
49317 break;
49318 }
49319 }
49320 if (num2 == variantOrderFemale.Length - 1)
49321 {
49322 plr.skinVariant = variantOrderFemale[0];
49323 }
49324 else
49325 {
49326 plr.skinVariant = variantOrderFemale[num2 + 1];
49327 }
49328 }
49329
49330 public static void ResetKeyBindings()
49331 {
49332 cUp = "W";
49333 cDown = "S";
49334 cLeft = "A";
49335 cRight = "D";
49336 cJump = "Space";
49337 cThrowItem = "T";
49338 cInv = "Escape";
49339 cHeal = "H";
49340 cMana = "J";
49341 cBuff = "B";
49342 cHook = "E";
49343 cTorch = "LeftShift";
49344 cSmart = "LeftControl";
49345 cMount = "R";
49346 }
49347
49348 public static void CursorColor()
49349 {
49350 cursorAlpha += (float)cursorColorDirection * 0.015f;
49351 if (cursorAlpha >= 1f)
49352 {
49353 cursorAlpha = 1f;
49355 }
49356 if ((double)cursorAlpha <= 0.6)
49357 {
49358 cursorAlpha = 0.6f;
49360 }
49361 float num = cursorAlpha * 0.3f + 0.7f;
49362 byte r = (byte)((float)(int)mouseColor.R * cursorAlpha);
49363 byte g = (byte)((float)(int)mouseColor.G * cursorAlpha);
49364 byte b = (byte)((float)(int)mouseColor.B * cursorAlpha);
49365 byte a = (byte)(255f * num);
49367 cursorScale = cursorAlpha * 0.3f + 0.7f + 0.1f;
49368 }
49369
49371 {
49372 int num = 10000;
49373 base.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
49374 base.Draw(gameTime);
49376 long num2 = splashTimer.ElapsedMilliseconds;
49377 if (musicVolume == 0f)
49378 {
49379 quickSplash = true;
49380 num2 = 999999L;
49381 num = 0;
49382 }
49383 if (Assets.PendingAssets == 0 && _musicLoaded && _artLoaded && Program.LoadedEverything)
49384 {
49385 _isAsyncLoadComplete = true;
49386 }
49387 spriteBatch.Begin();
49388 splashCounter++;
49390 byte b = 0;
49391 if (quickSplash)
49392 {
49393 if (splashCounter <= 75)
49394 {
49395 b = (byte)((float)splashCounter / 75f * 255f);
49396 }
49397 else if (splashCounter <= 125)
49398 {
49399 b = byte.MaxValue;
49400 }
49401 else if (splashCounter <= 200)
49402 {
49404 {
49405 splashCounter = 125;
49406 }
49407 b = (byte)((float)(75 - (splashCounter - 125)) / 75f * 255f);
49408 }
49409 else
49410 {
49413 showSplash = false;
49414 fadeCounter = 75;
49415 splashTimer.Stop();
49416 }
49417 }
49418 else
49419 {
49420 int num3 = 90;
49421 int num4 = 410;
49422 int num5 = 620;
49423 int num6 = 60;
49424 if (splashCounter >= num3)
49425 {
49426 if (splashCounter <= num4)
49427 {
49428 float num7 = (float)(splashCounter - num3) / (float)(num4 - num3);
49429 num7 *= num7 * num7 * num7;
49430 num7 *= 255f;
49431 b = (byte)num7;
49432 }
49433 else if (splashCounter <= num5)
49434 {
49435 b = byte.MaxValue;
49436 if (splashCounter >= num5 - num6)
49437 {
49438 b = (byte)((float)(num6 - (splashCounter - (num5 - num6))) / (float)num6 * 255f);
49439 }
49440 }
49441 else if (!_isAsyncLoadComplete)
49442 {
49443 b = 0;
49444 num = 1;
49445 }
49446 else
49447 {
49450 showSplash = false;
49451 fadeCounter = 120;
49452 splashTimer.Stop();
49453 }
49454 }
49455 }
49456 white = new Microsoft.Xna.Framework.Color(b, b, b, b);
49458 if (splashTextureLegoBack.Width() > 0 && splashTextureLegoBack.Height() > 0)
49459 {
49460 Vector2 vector = new Vector2((float)screenWidth / (float)splashTextureLegoBack.Width(), (float)screenHeight / (float)splashTextureLegoBack.Height());
49461 _ = splashTextureLegoBack.Size() / 2f;
49462 Vector2 position = new Vector2(screenWidth, screenHeight) / 2f;
49463 Vector2 scale = vector;
49464 if (scale.X > scale.Y)
49465 {
49466 scale.X = scale.Y;
49467 }
49468 else
49469 {
49470 scale.Y = scale.X;
49471 }
49473 if (scale2.X < scale2.Y)
49474 {
49475 scale2.X = scale2.Y;
49476 }
49477 else
49478 {
49479 scale2.Y = scale2.X;
49480 }
49481 spriteBatch.Draw(splashTextureLegoBack.Value, position, null, white, 0f, splashTextureLegoBack.Size() / 2f, scale2, SpriteEffects.None, 0f);
49482 spriteBatch.Draw(TextureAssets.SplashTextureLegoTree.Value, ScreenSize.ToVector2(), null, white, 0f, TextureAssets.SplashTextureLegoTree.Size(), scale, SpriteEffects.None, 0f);
49483 spriteBatch.Draw(TextureAssets.SplashTextureLegoFront.Value, position, null, white, 0f, TextureAssets.SplashTextureLegoFront.Size() / 2f, scale, SpriteEffects.None, 0f);
49484 }
49485 int num8 = 70;
49486 if (num == 1)
49487 {
49489 }
49490 else if (num2 > num)
49491 {
49493 }
49494 _splashFrameCount += 1f;
49495 if (_splashFrameCount >= (float)num8)
49496 {
49497 _splashFrameCount = 0f;
49498 }
49499 spriteBatch.End();
49500 }
49501
49503 {
49504 float val = (float)screenWidth / MinimumZoomComparerX;
49505 float val2 = (float)screenHeight / MinimumZoomComparerY;
49506 float num = Math.Max(Math.Max(1f, val), val2);
49508 int num2 = 3;
49509 int num3 = 19;
49510 Vector2 position = new Vector2(screenWidth / 2, screenHeight) - new Vector2(0f, 50f) * num;
49511 int num4 = (int)_splashFrameCount / num2;
49512 if (num4 >= num3)
49513 {
49514 num4 = 0;
49515 }
49517 float rotation = 0f;
49518 Vector2 origin = rectangle.Size() / 2f;
49519 spriteBatch.Draw(value, position, rectangle, splashColor, rotation, origin, num, SpriteEffects.None, 0f);
49520 }
49521
49523 {
49524 int num = 4;
49525 Vector2 position = new Vector2(screenWidth, screenHeight) - new Vector2(30f);
49526 int num2 = (int)_splashFrameCount / num;
49527 if (num2 >= 15)
49528 {
49529 num2 = 0;
49530 }
49531 if (num2 >= 8)
49532 {
49533 num2 = 14 - num2;
49534 }
49536 rectangle.Height -= 2;
49537 float rotation = 0f;
49538 Vector2 origin = rectangle.Size() / 2f;
49539 origin.Y += 2f;
49540 spriteBatch.Draw(TextureAssets.Item[75].Value, position, rectangle, splashColor, rotation, origin, 1f, SpriteEffects.None, 0f);
49541 }
49542
49543 protected void DrawUnderworldBackground(bool flat)
49544 {
49545 if (!(screenPosition.Y + (float)screenHeight < (float)(maxTilesY - 220) * 16f))
49546 {
49548 float pushUp = (GameViewMatrix.Zoom.Y - 1f) * 0.5f * 200f;
49549 SkyManager.Instance.ResetDepthTracker();
49550 for (int num = 4; num >= 0; num--)
49551 {
49553 }
49554 if (!mapFullscreen)
49555 {
49556 SkyManager.Instance.DrawRemainingDepth(spriteBatch);
49557 }
49559 }
49560 }
49561
49563 {
49566 if (!val.IsLoaded)
49567 {
49568 Assets.Request<Texture2D>(val.Name, (AssetRequestMode)1);
49569 }
49570 Texture2D value = val.Value;
49571 Vector2 vec = new Vector2(value.Width, value.Height) * 0.5f;
49572 float num2 = (flat ? 1f : ((float)(layerTextureIndex * 2) + 3f));
49573 Vector2 vector = new Vector2(1f / num2);
49575 float num3 = 1.3f;
49577 int num4 = 0;
49578 switch (num)
49579 {
49580 case 1:
49581 {
49582 int num9 = (int)(GlobalTimeWrappedHourly * 8f) % 4;
49583 value2 = new Microsoft.Xna.Framework.Rectangle((num9 >> 1) * (value.Width >> 1), num9 % 2 * (value.Height >> 1), value.Width >> 1, value.Height >> 1);
49584 vec *= 0.5f;
49585 zero.Y += 175f;
49586 break;
49587 }
49588 case 2:
49589 zero.Y += 100f;
49590 break;
49591 case 3:
49592 zero.Y += 75f;
49593 break;
49594 case 4:
49595 num3 = 0.5f;
49596 zero.Y -= 0f;
49597 break;
49598 case 5:
49599 zero.Y += num4;
49600 break;
49601 case 6:
49602 {
49603 int num8 = (int)(GlobalTimeWrappedHourly * 8f) % 4;
49604 value2 = new Microsoft.Xna.Framework.Rectangle(num8 % 2 * (value.Width >> 1), (num8 >> 1) * (value.Height >> 1), value.Width >> 1, value.Height >> 1);
49605 vec *= 0.5f;
49606 zero.Y += num4;
49607 zero.Y += -60f;
49608 break;
49609 }
49610 case 7:
49611 {
49612 int num7 = (int)(GlobalTimeWrappedHourly * 8f) % 4;
49613 value2 = new Microsoft.Xna.Framework.Rectangle(num7 % 2 * (value.Width >> 1), (num7 >> 1) * (value.Height >> 1), value.Width >> 1, value.Height >> 1);
49614 vec *= 0.5f;
49615 zero.Y += num4;
49616 zero.X -= 400f;
49617 zero.Y += 90f;
49618 break;
49619 }
49620 case 8:
49621 {
49622 int num6 = (int)(GlobalTimeWrappedHourly * 8f) % 4;
49623 value2 = new Microsoft.Xna.Framework.Rectangle(num6 % 2 * (value.Width >> 1), (num6 >> 1) * (value.Height >> 1), value.Width >> 1, value.Height >> 1);
49624 vec *= 0.5f;
49625 zero.Y += num4;
49626 zero.Y += 90f;
49627 break;
49628 }
49629 case 9:
49630 zero.Y += num4;
49631 zero.Y -= 30f;
49632 break;
49633 case 10:
49634 zero.Y += 250f * num2;
49635 break;
49636 case 11:
49637 zero.Y += 100f * num2;
49638 break;
49639 case 12:
49640 zero.Y += 20f * num2;
49641 break;
49642 case 13:
49643 {
49644 zero.Y += 20f * num2;
49645 int num5 = (int)(GlobalTimeWrappedHourly * 8f) % 4;
49646 value2 = new Microsoft.Xna.Framework.Rectangle(num5 % 2 * (value.Width >> 1), (num5 >> 1) * (value.Height >> 1), value.Width >> 1, value.Height >> 1);
49647 vec *= 0.5f;
49648 break;
49649 }
49650 }
49651 if (flat)
49652 {
49653 num3 *= 1.5f;
49654 }
49655 vec *= num3;
49656 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / vector.X);
49657 if (flat)
49658 {
49659 zero.Y += (float)(TextureAssets.Underworld[0].Height() >> 1) * 1.3f - vec.Y;
49660 }
49661 zero.Y -= pushUp;
49662 float num10 = num3 * (float)value2.Width;
49663 int num11 = (int)((float)(int)(screenOffset.X * vector.X - vec.X + zero.X - (float)(screenWidth >> 1)) / num10);
49664 vec = vec.Floor();
49665 int num12 = (int)Math.Ceiling((float)screenWidth / num10);
49666 int num13 = (int)(num3 * ((float)(value2.Width - 1) / vector.X));
49668 vec2 = vec2.Floor();
49669 while (vec2.X + num10 < 0f)
49670 {
49671 num11++;
49672 vec2.X += num10;
49673 }
49674 for (int i = num11 - 2; i <= num11 + 4 + num12; i++)
49675 {
49677 if (layerTextureIndex == 0)
49678 {
49679 int num14 = (int)(vec2.Y + (float)value2.Height * num3);
49680 spriteBatch.Draw(TextureAssets.BlackTile.Value, new Microsoft.Xna.Framework.Rectangle((int)vec2.X, num14, (int)((float)value2.Width * num3), Math.Max(0, screenHeight - num14)), new Microsoft.Xna.Framework.Color(11, 3, 7));
49681 }
49682 vec2.X += num10;
49683 }
49684 }
49685
49686 protected void DrawBackground()
49687 {
49688 float num = shimmerAlpha;
49689 if (num == 1f)
49690 {
49691 ugBackTransition = 0f;
49692 return;
49693 }
49694 if (!BackgroundEnabled)
49695 {
49697 return;
49698 }
49701 stopwatch.Start();
49702 double num2 = maxTilesY - 330;
49703 double num3 = (int)((num2 - worldSurface) / 6.0) * 6;
49704 num2 = worldSurface + num3 - 5.0;
49705 int num4 = (int)(255f * (1f - gfxQuality) + 140f * gfxQuality);
49706 int num5 = (int)(200f * (1f - gfxQuality) + 40f * gfxQuality);
49707 int num6 = 128;
49709 Vector3 vector2 = new Vector3(0.9f);
49710 float num7 = MathHelper.Clamp((screenPosition.Y - (float)worldSurface * 16f) / 300f, 0f, 1f);
49712 Lighting.GlobalBrightness = globalBrightness * (1f - num7) + 1f * num7;
49713 float value = (float)((double)(screenPosition.Y - (float)(screenHeight / 2) + 200f) - rockLayer * 16.0) / 300f;
49714 value = MathHelper.Clamp(value, 0f, 1f);
49715 int num8 = (int)((screenPosition.X + (float)(screenWidth / 2)) / 16f);
49716 int num9 = 3;
49717 num9 = ((num8 <= caveBackX[0]) ? caveBackStyle[0] : ((num8 <= caveBackX[1]) ? caveBackStyle[1] : ((num8 > caveBackX[2]) ? caveBackStyle[3] : caveBackStyle[2])));
49718 num9 += 3;
49719 if (SceneMetrics.SnowTileCount > SceneMetrics.SnowTileThreshold && (screenPosition.Y + (float)screenHeight + 1200f) / 16f < (float)(maxTilesY - 250))
49720 {
49721 num9 = 1;
49722 }
49724 {
49725 if (num9 == 1)
49726 {
49728 {
49729 num9 = 11;
49730 }
49731 }
49732 else
49733 {
49734 num9 = 11;
49735 }
49736 }
49737 if (WorldGen.oceanDepths((int)(screenPosition.X + (float)(screenHeight / 2)) / 16, (int)(screenPosition.Y + (float)(screenHeight / 2)) / 16))
49738 {
49739 num9 = (player[myPlayer].ZoneCorrupt ? 19 : (player[myPlayer].ZoneCrimson ? 21 : ((!player[myPlayer].ZoneHallow) ? 18 : 20)));
49740 }
49741 else if ((double)(screenPosition.Y / 16f) > rockLayer + 60.0 && (double)(screenPosition.Y / 16f) < num2 - 60.0)
49742 {
49743 if (player[myPlayer].ZoneSnow)
49744 {
49745 if (player[myPlayer].ZoneCorrupt)
49746 {
49747 num9 = 15;
49748 }
49749 else if (player[myPlayer].ZoneCrimson)
49750 {
49751 num9 = 16;
49752 }
49753 else if (player[myPlayer].ZoneHallow)
49754 {
49755 num9 = 17;
49756 }
49757 }
49758 else if (player[myPlayer].ZoneCorrupt)
49759 {
49760 num9 = 12;
49761 }
49762 else if (player[myPlayer].ZoneCrimson)
49763 {
49764 num9 = 13;
49765 }
49766 else if (player[myPlayer].ZoneHallow)
49767 {
49768 num9 = 14;
49769 }
49770 }
49771 if (player[myPlayer].ZoneGlowshroom)
49772 {
49773 num9 = 2;
49774 }
49776 {
49779 ugBackTransition = 1f;
49780 }
49781 if (num > 0f)
49782 {
49783 ugBackTransition = 0f;
49784 }
49785 if (ugBackTransition > 0f)
49786 {
49787 ugBackTransition -= 0.25f;
49788 }
49789 if (ugBackTransition < 0f)
49790 {
49791 ugBackTransition = 0f;
49792 }
49793 int[] array = new int[7];
49794 int[] array2 = new int[7];
49795 for (int i = 0; i < 2; i++)
49796 {
49798 if (i == 1)
49799 {
49801 }
49802 int[] array3 = new int[7];
49803 switch (num10)
49804 {
49805 case 0:
49806 array3[0] = 1;
49807 array3[1] = 2;
49808 array3[2] = 4;
49809 array3[3] = 3;
49810 array3[4] = 6;
49811 array3[5] = 5;
49812 break;
49813 case 1:
49814 if (iceBackStyle == 0)
49815 {
49816 array3[1] = 33;
49817 array3[3] = 32;
49818 array3[0] = 40;
49819 array3[2] = 34;
49820 }
49821 else if (iceBackStyle == 1)
49822 {
49823 array3[1] = 118;
49824 array3[3] = 117;
49825 array3[0] = 160;
49826 array3[2] = 161;
49827 }
49828 else if (iceBackStyle == 2)
49829 {
49830 array3[1] = 165;
49831 array3[3] = 167;
49832 array3[0] = 164;
49833 array3[2] = 166;
49834 }
49835 else
49836 {
49837 array3[1] = 120;
49838 array3[3] = 119;
49839 array3[0] = 162;
49840 array3[2] = 163;
49841 }
49842 array3[4] = 128 + hellBackStyle;
49843 break;
49844 case 2:
49845 array3[0] = 62;
49846 array3[1] = 63;
49847 array3[2] = 64;
49848 array3[3] = 65;
49849 array3[4] = 143 + hellBackStyle;
49850 break;
49851 case 3:
49852 array3[0] = 66;
49853 array3[1] = 67;
49854 array3[2] = 68;
49855 array3[3] = 69;
49856 array3[4] = 128 + hellBackStyle;
49857 break;
49858 case 4:
49859 array3[0] = 70;
49860 array3[1] = 71;
49861 array3[2] = 68;
49862 array3[3] = 72;
49863 array3[4] = 128 + hellBackStyle;
49864 break;
49865 case 5:
49866 array3[0] = 73;
49867 array3[1] = 74;
49868 array3[2] = 75;
49869 array3[3] = 76;
49870 array3[4] = 131 + hellBackStyle;
49871 break;
49872 case 6:
49873 array3[0] = 77;
49874 array3[1] = 78;
49875 array3[2] = 79;
49876 array3[3] = 80;
49877 array3[4] = 134 + hellBackStyle;
49878 break;
49879 case 7:
49880 array3[0] = 77;
49881 array3[1] = 81;
49882 array3[2] = 79;
49883 array3[3] = 82;
49884 array3[4] = 134 + hellBackStyle;
49885 break;
49886 case 8:
49887 array3[0] = 83;
49888 array3[1] = 84;
49889 array3[2] = 85;
49890 array3[3] = 86;
49891 array3[4] = 137 + hellBackStyle;
49892 break;
49893 case 9:
49894 array3[0] = 83;
49895 array3[1] = 87;
49896 array3[2] = 88;
49897 array3[3] = 89;
49898 array3[4] = 137 + hellBackStyle;
49899 break;
49900 case 10:
49901 array3[0] = 121;
49902 array3[1] = 122;
49903 array3[2] = 123;
49904 array3[3] = 124;
49905 array3[4] = 140 + hellBackStyle;
49906 break;
49907 case 11:
49908 if (jungleBackStyle == 0)
49909 {
49910 array3[0] = 153;
49911 array3[1] = 147;
49912 array3[2] = 148;
49913 array3[3] = 149;
49914 array3[4] = 150 + hellBackStyle;
49915 }
49916 else
49917 {
49918 array3[0] = 146;
49919 array3[1] = 154;
49920 array3[2] = 155;
49921 array3[3] = 156;
49922 array3[4] = 157 + hellBackStyle;
49923 }
49924 break;
49925 case 12:
49926 case 13:
49927 case 14:
49928 array3[0] = 66;
49929 array3[1] = 67;
49930 array3[2] = 68;
49931 array3[4] = 128 + hellBackStyle;
49932 switch (num10)
49933 {
49934 case 12:
49935 array3[3] = 193 + worldID % 4;
49936 break;
49937 case 13:
49938 array3[3] = 188 + worldID % 5;
49939 break;
49940 case 14:
49941 array3[3] = 197 + worldID % 3;
49942 break;
49943 }
49944 break;
49945 default:
49946 if (num10 >= 15 && num10 <= 17)
49947 {
49948 array3[0] = 40;
49949 array3[1] = 33;
49950 array3[2] = 34;
49951 array3[4] = 128 + hellBackStyle;
49952 switch (num10)
49953 {
49954 case 15:
49955 array3[3] = 200;
49956 break;
49957 case 16:
49958 array3[3] = 201 + worldID % 2;
49959 break;
49960 case 17:
49961 array3[3] = 203 + worldID % 4;
49962 break;
49963 }
49964 break;
49965 }
49966 switch (num10)
49967 {
49968 case 18:
49969 array3[0] = 290;
49970 array3[1] = 291;
49971 break;
49972 case 19:
49973 array3[0] = 292;
49974 array3[1] = 293;
49975 break;
49976 case 20:
49977 array3[0] = 294;
49978 array3[1] = 295;
49979 break;
49980 case 21:
49981 array3[0] = 296;
49982 array3[1] = 297;
49983 break;
49984 }
49985 break;
49986 }
49987 if (hellBackStyle == 0)
49988 {
49989 array3[5] = 125;
49990 }
49991 if (hellBackStyle == 1)
49992 {
49993 array3[5] = 126;
49994 }
49995 if (hellBackStyle == 2)
49996 {
49997 array3[5] = 127;
49998 }
49999 array3[6] = 185 + hellBackStyle;
50007 if (i == 0)
50008 {
50009 for (int j = 0; j < 7; j++)
50010 {
50011 array[j] = array3[j];
50012 }
50013 }
50014 else
50015 {
50016 for (int k = 0; k < 7; k++)
50017 {
50018 array2[k] = array3[k];
50019 }
50020 }
50021 }
50022 globalBrightness = 1.2f - 0.2f * value;
50023 float x = vector2.X;
50024 float y = vector2.Y;
50025 float z = vector2.Z;
50026 num6 = TextureAssets.Background[array[0]].Width() - 32;
50028 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50029 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50030 bgTopY = (int)((float)((int)worldSurface * 16 - 16) - screenPosition.Y + 16f);
50031 for (int l = 0; l < bgLoops; l++)
50032 {
50033 for (int m = 0; m < num6 / 16; m++)
50034 {
50035 int num11 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
50036 if (num11 == -8)
50037 {
50038 num11 = 8;
50039 }
50040 float num12 = bgStartX + num6 * l + m * 16 + 8;
50041 float num13 = bgTopY;
50042 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)((num12 + screenPosition.X) / 16f), (int)((screenPosition.Y + num13) / 16f));
50043 color.R = (byte)((float)(int)color.R * x);
50044 color.G = (byte)((float)(int)color.G * y);
50045 color.B = (byte)((float)(int)color.B * z);
50046 if (num > 0f)
50047 {
50048 color *= 1f - num;
50049 }
50050 spriteBatch.Draw(TextureAssets.Background[array[0]].Value, new Vector2(bgStartX + num6 * l + 16 * m + num11, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * m + num11 + 16, 0, 16, 16), color);
50051 }
50052 }
50053 if (ugBackTransition > 0f)
50054 {
50055 num6 = TextureAssets.Background[array2[0]].Width() - 32;
50056 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50057 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50058 for (int n = 0; n < bgLoops; n++)
50059 {
50060 for (int num14 = 0; num14 < num6 / 16; num14++)
50061 {
50062 int num15 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
50063 if (num15 == -8)
50064 {
50065 num15 = 8;
50066 }
50067 float num16 = bgStartX + num6 * n + num14 * 16 + 8;
50068 float num17 = bgTopY;
50070 color2.R = (byte)((float)(int)color2.R * x);
50071 color2.G = (byte)((float)(int)color2.G * y);
50072 color2.B = (byte)((float)(int)color2.B * z);
50074 color3.R = (byte)((float)(int)color3.R * ugBackTransition);
50075 color3.G = (byte)((float)(int)color3.G * ugBackTransition);
50076 color3.B = (byte)((float)(int)color3.B * ugBackTransition);
50077 color3.A = (byte)((float)(int)color3.A * ugBackTransition);
50078 spriteBatch.Draw(TextureAssets.Background[array2[0]].Value, new Vector2(bgStartX + num6 * n + 16 * num14 + num15, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num14 + num15 + 16, 0, 16, 16), color3);
50079 }
50080 }
50081 }
50082 bool flag = false;
50083 bool flag2 = false;
50084 bgTopY = (int)((float)((int)worldSurface * 16) - screenPosition.Y + 16f);
50085 if (worldSurface * 16.0 <= (double)(screenPosition.Y + (float)screenHeight + (float)offScreenRange))
50086 {
50088 num6 = TextureAssets.Background[array[1]].Width() - 32;
50089 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50090 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50091 if (worldSurface * 16.0 < (double)(screenPosition.Y - 16f))
50092 {
50094 bgLoopsY = (screenHeight - bgStartY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
50095 }
50096 else
50097 {
50098 bgStartY = bgTopY;
50099 bgLoopsY = (screenHeight - bgTopY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
50100 }
50101 if (rockLayer * 16.0 < (double)(Camera.ScaledPosition.Y + 600f))
50102 {
50103 bgLoopsY = (int)(rockLayer * 16.0 - (double)screenPosition.Y + 600.0 - (double)bgStartY) / backgroundHeight[2];
50104 flag2 = true;
50105 }
50106 int num18 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
50107 if (num18 == -8)
50108 {
50109 num18 = 8;
50110 }
50111 for (int num19 = 0; num19 < bgLoops; num19++)
50112 {
50113 for (int num20 = 0; num20 < bgLoopsY; num20++)
50114 {
50115 for (int num21 = 0; num21 < num6 / 16; num21++)
50116 {
50117 for (int num22 = 0; num22 < 6; num22++)
50118 {
50119 float num23 = bgStartY + num20 * 96 + num22 * 16 + 8;
50120 int num24 = (int)(((float)(bgStartX + num6 * num19 + num21 * 16 + 8) + screenPosition.X) / 16f);
50121 int num25 = (int)((num23 + screenPosition.Y) / 16f);
50123 if (!WorldGen.InWorld(num24, num25))
50124 {
50125 continue;
50126 }
50127 if (tile[num24, num25] == null)
50128 {
50129 tile[num24, num25] = new Tile();
50130 }
50131 if (num == 0f && (color4.R > 0 || color4.G > 0 || color4.B > 0))
50132 {
50133 if (!drawToScreen)
50134 {
50136 vertices.BottomLeftColor = new Microsoft.Xna.Framework.Color(vertices.BottomLeftColor.ToVector3() * vector2);
50137 vertices.BottomRightColor = new Microsoft.Xna.Framework.Color(vertices.BottomRightColor.ToVector3() * vector2);
50138 tileBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num6 * num19 + 16 * num21 + num18, bgStartY + backgroundHeight[array2[1]] * num20 + 16 * num22) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num21 + num18 + 16, 16 * num22, 16, 16), vertices, Vector2.Zero, 1f, SpriteEffects.None);
50139 }
50140 else if ((color4.R > num4 || (double)(int)color4.G > (double)num4 * 1.1 || (double)(int)color4.B > (double)num4 * 1.2) && !tile[num24, num25].active() && WallLightAt(num24, num25) && ugBackTransition == 0f)
50141 {
50143 try
50144 {
50145 for (int num26 = 0; num26 < 9; num26++)
50146 {
50147 int num27 = 0;
50148 int num28 = 0;
50149 int width = 4;
50150 int height = 4;
50153 switch (num26)
50154 {
50155 case 0:
50156 if (!tile[num24 - 1, num25 - 1].active())
50157 {
50158 color6 = slices[num26];
50159 }
50160 break;
50161 case 1:
50162 width = 8;
50163 num27 = 4;
50164 if (!tile[num24, num25 - 1].active())
50165 {
50166 color6 = slices[num26];
50167 }
50168 break;
50169 case 2:
50170 num27 = 12;
50171 if (!tile[num24 + 1, num25 - 1].active())
50172 {
50173 color6 = slices[num26];
50174 }
50175 break;
50176 case 3:
50177 height = 8;
50178 num28 = 4;
50179 if (!tile[num24 - 1, num25].active())
50180 {
50181 color6 = slices[num26];
50182 }
50183 break;
50184 case 4:
50185 width = 8;
50186 height = 8;
50187 num27 = 4;
50188 num28 = 4;
50189 break;
50190 case 5:
50191 num27 = 12;
50192 num28 = 4;
50193 height = 8;
50194 if (!tile[num24 + 1, num25].active())
50195 {
50196 color6 = slices[num26];
50197 }
50198 break;
50199 case 6:
50200 num28 = 12;
50201 if (!tile[num24 - 1, num25 + 1].active())
50202 {
50203 color6 = slices[num26];
50204 }
50205 break;
50206 case 7:
50207 width = 8;
50208 height = 4;
50209 num27 = 4;
50210 num28 = 12;
50211 if (!tile[num24, num25 + 1].active())
50212 {
50213 color6 = slices[num26];
50214 }
50215 break;
50216 case 8:
50217 num27 = 12;
50218 num28 = 12;
50219 if (!tile[num24 + 1, num25 + 1].active())
50220 {
50221 color6 = slices[num26];
50222 }
50223 break;
50224 }
50225 color5.R = (byte)((color4.R + color6.R) / 2);
50226 color5.G = (byte)((color4.G + color6.G) / 2);
50227 color5.B = (byte)((color4.B + color6.B) / 2);
50228 color5.R = (byte)((float)(int)color5.R * x);
50229 color5.G = (byte)((float)(int)color5.G * y);
50230 color5.B = (byte)((float)(int)color5.B * z);
50231 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num6 * num19 + 16 * num21 + num27 + num18, bgStartY + backgroundHeight[array[1]] * num20 + 16 * num22 + num28) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num21 + num27 + num18 + 16, 16 * num22 + num28, width, height), color5);
50232 if (ugBackTransition > 0f)
50233 {
50235 color7.R = (byte)((float)(int)color7.R * ugBackTransition);
50236 color7.G = (byte)((float)(int)color7.G * ugBackTransition);
50237 color7.B = (byte)((float)(int)color7.B * ugBackTransition);
50238 color7.A = (byte)((float)(int)color7.A * ugBackTransition);
50239 spriteBatch.Draw(TextureAssets.Background[array2[1]].Value, new Vector2(bgStartX + num6 * num19 + 16 * num21 + num27 + num18, bgStartY + backgroundHeight[array2[1]] * num20 + 16 * num22 + num28) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num21 + num27 + num18 + 16, 16 * num22 + num28, width, height), color7);
50240 }
50241 }
50242 }
50243 catch
50244 {
50245 color4.R = (byte)((float)(int)color4.R * x);
50246 color4.G = (byte)((float)(int)color4.G * y);
50247 color4.B = (byte)((float)(int)color4.B * z);
50248 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num6 * num19 + 16 * num21 + num18, bgStartY + backgroundHeight[array[1]] * num20 + 16 * num22) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num21 + num18 + 16, 16 * num22, 16, 16), color4);
50249 }
50250 }
50251 else if ((color4.R > num5 || (double)(int)color4.G > (double)num5 * 1.1 || (double)(int)color4.B > (double)num5 * 1.2) && ugBackTransition == 0f)
50252 {
50254 for (int num29 = 0; num29 < 4; num29++)
50255 {
50256 int num30 = 0;
50257 int num31 = 0;
50260 switch (num29)
50261 {
50262 case 1:
50263 num30 = 8;
50264 break;
50265 case 2:
50266 num31 = 8;
50267 break;
50268 case 3:
50269 num30 = 8;
50270 num31 = 8;
50271 break;
50272 }
50273 color8.R = (byte)((color4.R + color9.R) / 2);
50274 color8.G = (byte)((color4.G + color9.G) / 2);
50275 color8.B = (byte)((color4.B + color9.B) / 2);
50276 color8.R = (byte)((float)(int)color8.R * x);
50277 color8.G = (byte)((float)(int)color8.G * y);
50278 color8.B = (byte)((float)(int)color8.B * z);
50279 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num6 * num19 + 16 * num21 + num30 + num18, bgStartY + backgroundHeight[array[1]] * num20 + 16 * num22 + num31) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num21 + num30 + num18 + 16, 16 * num22 + num31, 8, 8), color8);
50280 if (ugBackTransition > 0f)
50281 {
50283 color10.R = (byte)((float)(int)color10.R * ugBackTransition);
50284 color10.G = (byte)((float)(int)color10.G * ugBackTransition);
50285 color10.B = (byte)((float)(int)color10.B * ugBackTransition);
50286 color10.A = (byte)((float)(int)color10.A * ugBackTransition);
50288 }
50289 }
50290 }
50291 else
50292 {
50293 color4.R = (byte)((float)(int)color4.R * x);
50294 color4.G = (byte)((float)(int)color4.G * y);
50295 color4.B = (byte)((float)(int)color4.B * z);
50296 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num6 * num19 + 16 * num21 + num18, bgStartY + backgroundHeight[array[1]] * num20 + 16 * num22) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num21 + num18 + 16, 16 * num22, 16, 16), color4);
50297 if (ugBackTransition > 0f)
50298 {
50300 color11.R = (byte)((float)(int)color11.R * ugBackTransition);
50301 color11.G = (byte)((float)(int)color11.G * ugBackTransition);
50302 color11.B = (byte)((float)(int)color11.B * ugBackTransition);
50303 color11.A = (byte)((float)(int)color11.A * ugBackTransition);
50304 spriteBatch.Draw(TextureAssets.Background[array2[1]].Value, new Vector2(bgStartX + num6 * num19 + 16 * num21 + num18, bgStartY + backgroundHeight[array2[1]] * num20 + 16 * num22) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num21 + num18 + 16, 16 * num22, 16, 16), color11);
50305 }
50306 }
50307 }
50308 else
50309 {
50310 color4.R = (byte)((float)(int)color4.R * x);
50311 color4.G = (byte)((float)(int)color4.G * y);
50312 color4.B = (byte)((float)(int)color4.B * z);
50313 if (num > 0f)
50314 {
50315 color4 *= 1f - num;
50316 }
50317 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num6 * num19 + 16 * num21 + num18, bgStartY + backgroundHeight[array[1]] * num20 + 16 * num22) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num21 + num18 + 16, 16 * num22, 16, 16), color4);
50318 }
50319 }
50320 }
50321 }
50322 }
50323 if (ugBackTransition > 0f)
50324 {
50325 num6 = TextureAssets.Background[array2[1]].Width() - 32;
50326 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50327 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50328 num18 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
50329 if (num18 == -8)
50330 {
50331 num18 = 8;
50332 }
50333 for (int num32 = 0; num32 < bgLoops; num32++)
50334 {
50335 for (int num33 = 0; num33 < bgLoopsY; num33++)
50336 {
50337 for (int num34 = 0; num34 < num6 / 16; num34++)
50338 {
50339 for (int num35 = 0; num35 < 6; num35++)
50340 {
50341 float num36 = bgStartY + num33 * 96 + num35 * 16 + 8;
50342 int num37 = (int)(((float)(bgStartX + num6 * num32 + num34 * 16 + 8) + screenPosition.X) / 16f);
50343 int num38 = (int)((num36 + screenPosition.Y) / 16f);
50345 {
50347 if (tile[num37, num38] == null)
50348 {
50349 tile[num37, num38] = new Tile();
50350 }
50351 if (color12.R > 0 || color12.G > 0 || color12.B > 0)
50352 {
50354 byte a = (byte)(255f * ugBackTransition);
50355 vertices2.BottomLeftColor.A = a;
50356 vertices2.BottomRightColor.A = a;
50357 vertices2.TopLeftColor.A = a;
50358 vertices2.TopRightColor.A = a;
50360 }
50361 }
50362 }
50363 }
50364 }
50365 }
50366 }
50367 num6 = 128;
50368 if (flag2)
50369 {
50371 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50372 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50374 if (bgTopY > -32)
50375 {
50376 for (int num39 = 0; num39 < bgLoops; num39++)
50377 {
50378 for (int num40 = 0; num40 < num6 / 16; num40++)
50379 {
50380 float num41 = bgStartX + num6 * num39 + num40 * 16 + 8;
50381 float num42 = bgTopY;
50383 color13.R = (byte)((float)(int)color13.R * x);
50384 color13.G = (byte)((float)(int)color13.G * y);
50385 color13.B = (byte)((float)(int)color13.B * z);
50386 if (num > 0f)
50387 {
50388 color13 *= 1f - num;
50389 }
50390 spriteBatch.Draw(TextureAssets.Background[array[2]].Value, new Vector2(bgStartX + num6 * num39 + 16 * num40 + num18, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num40 + num18 + 16, 0, 16, 16), color13);
50391 if (ugBackTransition > 0f)
50392 {
50394 color14.R = (byte)((float)(int)color14.R * ugBackTransition);
50395 color14.G = (byte)((float)(int)color14.G * ugBackTransition);
50396 color14.B = (byte)((float)(int)color14.B * ugBackTransition);
50397 color14.A = (byte)((float)(int)color14.A * ugBackTransition);
50398 spriteBatch.Draw(TextureAssets.Background[array2[2]].Value, new Vector2(bgStartX + num6 * num39 + 16 * num40 + num18, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num40 + num18 + 16, 0, 16, 16), color14);
50399 }
50400 }
50401 }
50402 }
50403 }
50404 }
50405 if (num2 * 16.0 <= (double)(screenPosition.Y + (float)screenHeight) && (!remixWorld || maxTilesX >= 5000))
50406 {
50407 int y2 = 0;
50408 int x2 = 0;
50409 int num43 = screenHeight + 200;
50410 int width2 = screenWidth + 100;
50411 if ((float)UnderworldLayer * 16f < screenPosition.Y + (float)screenHeight)
50412 {
50413 int num44 = (int)(hellBlackBoxBottom - screenPosition.Y + vector.Y);
50414 if (num43 > num44)
50415 {
50416 num43 = num44;
50417 }
50418 }
50420 }
50421 hellBlackBoxBottom = screenPosition.Y + (float)screenHeight + 100f;
50422 bgTopY = (int)((float)((int)rockLayer * 16) - screenPosition.Y + 16f + 600f - 8f);
50423 if (rockLayer * 16.0 <= (double)(screenPosition.Y + (float)screenHeight))
50424 {
50426 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50427 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50428 if (rockLayer * 16.0 + (double)screenHeight < (double)(screenPosition.Y - 16f))
50429 {
50431 bgLoopsY = (screenHeight - bgStartY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
50432 }
50433 else
50434 {
50435 bgStartY = bgTopY;
50436 bgLoopsY = (screenHeight - bgTopY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
50437 }
50438 if (num2 * 16.0 < (double)(screenPosition.Y + (float)screenHeight))
50439 {
50440 bgLoopsY = (int)(num2 * 16.0 - (double)screenPosition.Y + 600.0 - (double)bgStartY) / backgroundHeight[2];
50441 flag = true;
50442 }
50443 int num45 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
50444 if (num45 == -8)
50445 {
50446 num45 = 8;
50447 }
50448 for (int num46 = 0; num46 < bgLoops; num46++)
50449 {
50450 for (int num47 = 0; num47 < bgLoopsY; num47++)
50451 {
50452 for (int num48 = 0; num48 < num6 / 16; num48++)
50453 {
50454 for (int num49 = 0; num49 < 6; num49++)
50455 {
50456 float num50 = bgStartY + num47 * 96 + num49 * 16 + 8;
50457 int num51 = (int)(((float)(bgStartX + num6 * num46 + num48 * 16 + 8) + screenPosition.X) / 16f);
50458 int num52 = (int)((num50 + screenPosition.Y) / 16f);
50459 if (!WorldGen.InWorld(num51, num52, 1))
50460 {
50461 continue;
50462 }
50464 if ((!ShouldDrawBackgroundTileAt(num51, num52) && color15.R != 0 && color15.G != 0 && color15.B != 0) || (color15.R <= 0 && color15.G <= 0 && color15.B <= 0) || (!WallLightAt(num51, num52) && caveParallax == 0f))
50465 {
50466 continue;
50467 }
50468 if (num == 0f && Lighting.NotRetro && color15.R < 230 && color15.G < 230 && color15.B < 230 && ugBackTransition == 0f)
50469 {
50470 if ((color15.R > num4 || (double)(int)color15.G > (double)num4 * 1.1 || (double)(int)color15.B > (double)num4 * 1.2) && !tile[num51, num52].active())
50471 {
50473 for (int num53 = 0; num53 < 9; num53++)
50474 {
50475 int num54 = 0;
50476 int num55 = 0;
50477 int width3 = 4;
50478 int height2 = 4;
50481 switch (num53)
50482 {
50483 case 0:
50484 if (!tile[num51 - 1, num52 - 1].active())
50485 {
50486 color17 = slices[num53];
50487 }
50488 break;
50489 case 1:
50490 width3 = 8;
50491 num54 = 4;
50492 if (!tile[num51, num52 - 1].active())
50493 {
50494 color17 = slices[num53];
50495 }
50496 break;
50497 case 2:
50498 num54 = 12;
50499 if (!tile[num51 + 1, num52 - 1].active())
50500 {
50501 color17 = slices[num53];
50502 }
50503 break;
50504 case 3:
50505 height2 = 8;
50506 num55 = 4;
50507 if (!tile[num51 - 1, num52].active())
50508 {
50509 color17 = slices[num53];
50510 }
50511 break;
50512 case 4:
50513 width3 = 8;
50514 height2 = 8;
50515 num54 = 4;
50516 num55 = 4;
50517 break;
50518 case 5:
50519 num54 = 12;
50520 num55 = 4;
50521 height2 = 8;
50522 if (!tile[num51 + 1, num52].active())
50523 {
50524 color17 = slices[num53];
50525 }
50526 break;
50527 case 6:
50528 num55 = 12;
50529 if (!tile[num51 - 1, num52 + 1].active())
50530 {
50531 color17 = slices[num53];
50532 }
50533 break;
50534 case 7:
50535 width3 = 8;
50536 height2 = 4;
50537 num54 = 4;
50538 num55 = 12;
50539 if (!tile[num51, num52 + 1].active())
50540 {
50541 color17 = slices[num53];
50542 }
50543 break;
50544 case 8:
50545 num54 = 12;
50546 num55 = 12;
50547 if (!tile[num51 + 1, num52 + 1].active())
50548 {
50549 color17 = slices[num53];
50550 }
50551 break;
50552 }
50553 color16.R = (byte)((color15.R + color17.R) / 2);
50554 color16.G = (byte)((color15.G + color17.G) / 2);
50555 color16.B = (byte)((color15.B + color17.B) / 2);
50556 color16.R = (byte)((float)(int)color16.R * x);
50557 color16.G = (byte)((float)(int)color16.G * y);
50558 color16.B = (byte)((float)(int)color16.B * z);
50560 if (ugBackTransition > 0f)
50561 {
50563 color18.R = (byte)((float)(int)color18.R * ugBackTransition);
50564 color18.G = (byte)((float)(int)color18.G * ugBackTransition);
50565 color18.B = (byte)((float)(int)color18.B * ugBackTransition);
50566 color18.A = (byte)((float)(int)color18.A * ugBackTransition);
50568 }
50569 }
50570 }
50571 else if (color15.R > num5 || (double)(int)color15.G > (double)num5 * 1.1 || (double)(int)color15.B > (double)num5 * 1.2)
50572 {
50574 for (int num56 = 0; num56 < 4; num56++)
50575 {
50576 int num57 = 0;
50577 int num58 = 0;
50580 switch (num56)
50581 {
50582 case 1:
50583 num57 = 8;
50584 break;
50585 case 2:
50586 num58 = 8;
50587 break;
50588 case 3:
50589 num57 = 8;
50590 num58 = 8;
50591 break;
50592 }
50593 color19.R = (byte)((color15.R + color20.R) / 2);
50594 color19.G = (byte)((color15.G + color20.G) / 2);
50595 color19.B = (byte)((color15.B + color20.B) / 2);
50596 color19.R = (byte)((float)(int)color19.R * x);
50597 color19.G = (byte)((float)(int)color19.G * y);
50598 color19.B = (byte)((float)(int)color19.B * z);
50600 if (ugBackTransition > 0f)
50601 {
50603 color21.R = (byte)((float)(int)color21.R * ugBackTransition);
50604 color21.G = (byte)((float)(int)color21.G * ugBackTransition);
50605 color21.B = (byte)((float)(int)color21.B * ugBackTransition);
50606 color21.A = (byte)((float)(int)color21.A * ugBackTransition);
50608 }
50609 }
50610 }
50611 else
50612 {
50613 color15.R = (byte)((float)(int)color15.R * x);
50614 color15.G = (byte)((float)(int)color15.G * y);
50615 color15.B = (byte)((float)(int)color15.B * z);
50616 spriteBatch.Draw(TextureAssets.Background[array[3]].Value, new Vector2(bgStartX + num6 * num46 + 16 * num48 + num45, bgStartY + backgroundHeight[array[3]] * num47 + 16 * num49) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num48 + num45 + 16, 16 * num49, 16, 16), color15);
50617 if (ugBackTransition > 0f)
50618 {
50620 color22.R = (byte)((float)(int)color22.R * ugBackTransition);
50621 color22.G = (byte)((float)(int)color22.G * ugBackTransition);
50622 color22.B = (byte)((float)(int)color22.B * ugBackTransition);
50623 color22.A = (byte)((float)(int)color22.A * ugBackTransition);
50624 spriteBatch.Draw(TextureAssets.Background[array2[3]].Value, new Vector2(bgStartX + num6 * num46 + 16 * num48 + num45, bgStartY + backgroundHeight[array2[3]] * num47 + 16 * num49) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num48 + num45 + 16, 16 * num49, 16, 16), color22);
50625 }
50626 }
50627 }
50628 else
50629 {
50630 color15.R = (byte)((float)(int)color15.R * x);
50631 color15.G = (byte)((float)(int)color15.G * y);
50632 color15.B = (byte)((float)(int)color15.B * z);
50633 if (num > 0f)
50634 {
50635 color15 *= 1f - num;
50636 }
50637 spriteBatch.Draw(TextureAssets.Background[array[3]].Value, new Vector2(bgStartX + num6 * num46 + 16 * num48 + num45, bgStartY + backgroundHeight[array[3]] * num47 + 16 * num49) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num48 + num45 + 16, 16 * num49, 16, 16), color15);
50638 if (ugBackTransition > 0f)
50639 {
50641 color23.R = (byte)((float)(int)color23.R * ugBackTransition);
50642 color23.G = (byte)((float)(int)color23.G * ugBackTransition);
50643 color23.B = (byte)((float)(int)color23.B * ugBackTransition);
50644 color23.A = (byte)((float)(int)color23.A * ugBackTransition);
50645 spriteBatch.Draw(TextureAssets.Background[array2[3]].Value, new Vector2(bgStartX + num6 * num46 + 16 * num48 + num45, bgStartY + backgroundHeight[array2[3]] * num47 + 16 * num49) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num48 + num45 + 16, 16 * num49, 16, 16), color23);
50646 }
50647 }
50648 }
50649 }
50650 }
50651 }
50652 num6 = 128;
50653 if (flag)
50654 {
50656 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50657 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50659 for (int num59 = 0; num59 < bgLoops; num59++)
50660 {
50661 for (int num60 = 0; num60 < num6 / 16; num60++)
50662 {
50663 float num61 = bgStartX + num6 * num59 + num60 * 16 + 8;
50664 float num62 = bgTopY;
50666 color24.R = (byte)((float)(int)color24.R * x);
50667 color24.G = (byte)((float)(int)color24.G * y);
50668 color24.B = (byte)((float)(int)color24.B * z);
50669 spriteBatch.Draw(TextureAssets.Background[array[4]].Value, new Vector2(bgStartX + num6 * num59 + 16 * num60 + num45, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num60 + num45 + 16, magmaBGFrame * 16, 16, 16), color24);
50670 if (ugBackTransition > 0f)
50671 {
50673 color25.R = (byte)((float)(int)color25.R * ugBackTransition);
50674 color25.G = (byte)((float)(int)color25.G * ugBackTransition);
50675 color25.B = (byte)((float)(int)color25.B * ugBackTransition);
50676 color25.A = (byte)((float)(int)color25.A * ugBackTransition);
50677 spriteBatch.Draw(TextureAssets.Background[array2[4]].Value, new Vector2(bgStartX + num6 * num59 + 16 * num60 + num45, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num60 + num45 + 16, magmaBGFrame * 16, 16, 16), color25);
50678 }
50679 }
50680 }
50681 }
50682 }
50683 bgTopY = (int)((float)((int)num2 * 16) - screenPosition.Y + 16f + 600f) - 8;
50684 bool flag3 = false;
50685 if (num2 * 16.0 <= (double)(screenPosition.Y + (float)screenHeight))
50686 {
50687 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50688 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50689 if (num2 * 16.0 + (double)screenHeight < (double)(screenPosition.Y - 16f))
50690 {
50692 bgLoopsY = (screenHeight - bgStartY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
50693 }
50694 else
50695 {
50696 bgStartY = bgTopY;
50697 bgLoopsY = (screenHeight - bgTopY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
50698 }
50699 if ((float)UnderworldLayer * 16f < screenPosition.Y + (float)screenHeight)
50700 {
50701 bgLoopsY = (int)Math.Ceiling(((float)UnderworldLayer * 16f - screenPosition.Y - (float)bgStartY) / (float)backgroundHeight[2]);
50702 flag3 = true;
50703 }
50704 num4 = (int)((double)num4 * 1.5);
50705 num5 = (int)((double)num5 * 1.5);
50706 int num63 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
50707 if (num63 == -8)
50708 {
50709 num63 = 8;
50710 }
50711 for (int num64 = 0; num64 < bgLoops; num64++)
50712 {
50713 for (int num65 = 0; num65 < bgLoopsY; num65++)
50714 {
50715 for (int num66 = 0; num66 < num6 / 16; num66++)
50716 {
50717 for (int num67 = 0; num67 < 6; num67++)
50718 {
50719 float num68 = bgStartY + num65 * 96 + num67 * 16 + 8;
50720 int num69 = (int)(((float)(bgStartX + num6 * num64 + num66 * 16 + 8) + screenPosition.X) / 16f);
50721 int num70 = (int)((num68 + screenPosition.Y) / 16f);
50722 if (!WorldGen.InWorld(num69, num70, 1))
50723 {
50724 continue;
50725 }
50727 if ((!ShouldDrawBackgroundTileAt(num69, num70) && color26.R != 0 && color26.G != 0 && color26.B != 0) || (color26.R <= 0 && color26.G <= 0 && color26.B <= 0 && num70 <= maxTilesY - 300) || (!WallLightAt(num69, num70) && caveParallax == 0f))
50728 {
50729 continue;
50730 }
50731 if (Lighting.NotRetro && color26.R < 230 && color26.G < 230 && color26.B < 230)
50732 {
50733 if ((color26.R > num4 || (double)(int)color26.G > (double)num4 * 1.1 || (double)(int)color26.B > (double)num4 * 1.2) && !tile[num69, num70].active())
50734 {
50736 for (int num71 = 0; num71 < 9; num71++)
50737 {
50738 int num72 = 0;
50739 int num73 = 0;
50740 int width4 = 4;
50741 int height3 = 4;
50744 switch (num71)
50745 {
50746 case 0:
50747 if (!tile[num69 - 1, num70 - 1].active())
50748 {
50749 color28 = slices[num71];
50750 }
50751 break;
50752 case 1:
50753 width4 = 8;
50754 num72 = 4;
50755 if (!tile[num69, num70 - 1].active())
50756 {
50757 color28 = slices[num71];
50758 }
50759 break;
50760 case 2:
50761 num72 = 12;
50762 if (!tile[num69 + 1, num70 - 1].active())
50763 {
50764 color28 = slices[num71];
50765 }
50766 break;
50767 case 3:
50768 height3 = 8;
50769 num73 = 4;
50770 if (!tile[num69 - 1, num70].active())
50771 {
50772 color28 = slices[num71];
50773 }
50774 break;
50775 case 4:
50776 width4 = 8;
50777 height3 = 8;
50778 num72 = 4;
50779 num73 = 4;
50780 break;
50781 case 5:
50782 num72 = 12;
50783 num73 = 4;
50784 height3 = 8;
50785 if (!tile[num69 + 1, num70].active())
50786 {
50787 color28 = slices[num71];
50788 }
50789 break;
50790 case 6:
50791 num73 = 12;
50792 if (!tile[num69 - 1, num70 + 1].active())
50793 {
50794 color28 = slices[num71];
50795 }
50796 break;
50797 case 7:
50798 width4 = 8;
50799 height3 = 4;
50800 num72 = 4;
50801 num73 = 12;
50802 if (!tile[num69, num70 + 1].active())
50803 {
50804 color28 = slices[num71];
50805 }
50806 break;
50807 case 8:
50808 num72 = 12;
50809 num73 = 12;
50810 if (!tile[num69 + 1, num70 + 1].active())
50811 {
50812 color28 = slices[num71];
50813 }
50814 break;
50815 }
50816 color27.R = (byte)((color26.R + color28.R) / 2);
50817 color27.G = (byte)((color26.G + color28.G) / 2);
50818 color27.B = (byte)((color26.B + color28.B) / 2);
50819 color27.R = (byte)((float)(int)color27.R * x);
50820 color27.G = (byte)((float)(int)color27.G * y);
50821 color27.B = (byte)((float)(int)color27.B * z);
50823 }
50824 }
50825 else if (color26.R > num5 || (double)(int)color26.G > (double)num5 * 1.1 || (double)(int)color26.B > (double)num5 * 1.2)
50826 {
50828 for (int num74 = 0; num74 < 4; num74++)
50829 {
50830 int num75 = 0;
50831 int num76 = 0;
50834 switch (num74)
50835 {
50836 case 1:
50837 num75 = 8;
50838 break;
50839 case 2:
50840 num76 = 8;
50841 break;
50842 case 3:
50843 num75 = 8;
50844 num76 = 8;
50845 break;
50846 }
50847 color29.R = (byte)((color26.R + color30.R) / 2);
50848 color29.G = (byte)((color26.G + color30.G) / 2);
50849 color29.B = (byte)((color26.B + color30.B) / 2);
50850 color29.R = (byte)((float)(int)color29.R * x);
50851 color29.G = (byte)((float)(int)color29.G * y);
50852 color29.B = (byte)((float)(int)color29.B * z);
50853 spriteBatch.Draw(TextureAssets.Background[array[5]].Value, new Vector2(bgStartX + num6 * num64 + 16 * num66 + num75 + num63, bgStartY + backgroundHeight[2] * num65 + 16 * num67 + num76) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num66 + num75 + num63 + 16, 16 * num67 + backgroundHeight[2] * magmaBGFrame + num76, 8, 8), color29, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
50854 }
50855 }
50856 else
50857 {
50858 color26.R = (byte)((float)(int)color26.R * x);
50859 color26.G = (byte)((float)(int)color26.G * y);
50860 color26.B = (byte)((float)(int)color26.B * z);
50861 spriteBatch.Draw(TextureAssets.Background[array[5]].Value, new Vector2(bgStartX + num6 * num64 + 16 * num66 + num63, bgStartY + backgroundHeight[2] * num65 + 16 * num67) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num66 + num63 + 16, 16 * num67 + backgroundHeight[2] * magmaBGFrame, 16, 16), color26, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
50862 }
50863 }
50864 else
50865 {
50866 color26.R = (byte)((float)(int)color26.R * x);
50867 color26.G = (byte)((float)(int)color26.G * y);
50868 color26.B = (byte)((float)(int)color26.B * z);
50869 spriteBatch.Draw(TextureAssets.Background[array[5]].Value, new Vector2(bgStartX + num6 * num64 + 16 * num66 + num63, bgStartY + backgroundHeight[2] * num65 + 16 * num67) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num66 + num63 + 16, 16 * num67 + backgroundHeight[2] * magmaBGFrame, 16, 16), color26, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
50870 }
50871 }
50872 }
50873 }
50874 }
50875 if (flag3)
50876 {
50878 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num6 + (double)screenPosition.X * bgParallax, num6) - (double)(num6 / 2)) - (int)vector.X;
50879 bgLoops = (screenWidth + (int)vector.X * 2) / num6 + 2;
50882 for (int num77 = 0; num77 < bgLoops; num77++)
50883 {
50884 for (int num78 = 0; num78 < num6 / 16; num78++)
50885 {
50886 float num79 = bgStartX + num6 * num77 + num78 * 16 + 8;
50887 float num80 = bgTopY;
50889 color31.R = (byte)((float)(int)color31.R * x);
50890 color31.G = (byte)((float)(int)color31.G * y);
50891 color31.B = (byte)((float)(int)color31.B * z);
50892 spriteBatch.Draw(TextureAssets.Background[array[6]].Value, new Vector2(bgStartX + num6 * num77 + 16 * num78 + num63, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num78 + num63 + 16, magmaBGFrame * 16, 16, 16), color31);
50893 if (ugBackTransition > 0f)
50894 {
50896 color32.R = (byte)((float)(int)color32.R * ugBackTransition);
50897 color32.G = (byte)((float)(int)color32.G * ugBackTransition);
50898 color32.B = (byte)((float)(int)color32.B * ugBackTransition);
50899 color32.A = (byte)((float)(int)color32.A * ugBackTransition);
50900 spriteBatch.Draw(TextureAssets.Background[array2[6]].Value, new Vector2(bgStartX + num6 * num77 + 16 * num78 + num63, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num78 + num63 + 16, magmaBGFrame * 16, 16, 16), color32);
50901 }
50902 }
50903 }
50904 }
50905 }
50906 Lighting.GlobalBrightness = globalBrightness;
50907 TimeLogger.DrawTime(3, stopwatch.Elapsed.TotalMilliseconds);
50908 }
50909
50911 {
50912 return (Camera.ScaledPosition - Camera.UnscaledPosition).ToTileCoordinates();
50913 }
50914
50915 protected void OldDrawBackground()
50916 {
50919 stopwatch.Start();
50920 int num = (int)(255f * (1f - gfxQuality) + 140f * gfxQuality);
50921 int num2 = (int)(200f * (1f - gfxQuality) + 40f * gfxQuality);
50922 int num3 = 128;
50924 if (drawToScreen)
50925 {
50927 }
50928 float num4;
50929 float num5;
50930 float num6 = (num5 = (num4 = 0.9f));
50931 float num7 = 0f;
50933 {
50935 }
50937 {
50939 }
50941 {
50943 }
50944 num7 = MathHelper.Clamp(num7 / 800f, 0f, 1f);
50945 float num8 = (float)((double)screenPosition.Y - worldSurface * 16.0) / 300f;
50946 if (num8 < 0f)
50947 {
50948 num8 = 0f;
50949 }
50950 else if (num8 > 1f)
50951 {
50952 num8 = 1f;
50953 }
50954 float num9 = 1f * (1f - num8) + num4 * num8;
50956 Lighting.GlobalBrightness = globalBrightness * (1f - num8) + 1f * num8;
50957 float value = (float)((double)(screenPosition.Y - (float)(screenHeight / 2) + 200f) - rockLayer * 16.0) / 300f;
50958 value = MathHelper.Clamp(value, 0f, 1f);
50960 {
50961 num4 = 1f * num7 + num4 * (1f - num7);
50962 num5 = 0.55f * num7 + num5 * (1f - num7);
50963 num6 = 0.5f * num7 + num6 * (1f - num7);
50964 }
50965 else if (SceneMetrics.EvilTileCount > 0)
50966 {
50967 num4 = 0.8f * num7 + num4 * (1f - num7);
50968 num5 = 0.75f * num7 + num5 * (1f - num7);
50969 num6 = 1.1f * num7 + num6 * (1f - num7);
50970 }
50971 else if (SceneMetrics.HolyTileCount > 0)
50972 {
50973 num4 = 1f * num7 + num4 * (1f - num7);
50974 num5 = 0.7f * num7 + num5 * (1f - num7);
50975 num6 = 0.9f * num7 + num6 * (1f - num7);
50976 }
50977 num4 = 1f * (num9 - value) + num4 * value;
50978 num5 = 1f * (num9 - value) + num5 * value;
50979 num6 = 1f * (num9 - value) + num6 * value;
50980 int num10 = (int)((screenPosition.X + (float)(screenWidth / 2)) / 16f);
50981 int num11 = 3;
50982 num11 = ((num10 <= caveBackX[0]) ? caveBackStyle[0] : ((num10 <= caveBackX[1]) ? caveBackStyle[1] : ((num10 > caveBackX[2]) ? caveBackStyle[3] : caveBackStyle[2])));
50983 num11 += 3;
50985 {
50986 num11 = 1;
50987 }
50989 {
50990 if (num11 == 1)
50991 {
50993 {
50994 num11 = 11;
50995 }
50996 }
50997 else
50998 {
50999 num11 = 11;
51000 }
51001 }
51003 {
51004 num11 = 2;
51005 }
51007 {
51010 ugBackTransition = 1f;
51011 }
51012 if (ugBackTransition > 0f)
51013 {
51014 ugBackTransition -= 0.25f;
51015 }
51016 if (ugBackTransition < 0f)
51017 {
51018 ugBackTransition = 0f;
51019 }
51020 int[] array = new int[6];
51021 int[] array2 = new int[6];
51022 for (int i = 0; i < 2; i++)
51023 {
51025 if (i == 1)
51026 {
51028 }
51029 int[] array3 = new int[6];
51030 switch (num12)
51031 {
51032 case 0:
51033 array3[0] = 1;
51034 array3[1] = 2;
51035 array3[2] = 4;
51036 array3[3] = 3;
51037 array3[4] = 6;
51038 array3[5] = 5;
51039 break;
51040 case 1:
51041 if (iceBackStyle == 0)
51042 {
51043 array3[1] = 33;
51044 array3[3] = 32;
51045 array3[0] = 40;
51046 array3[2] = 34;
51047 }
51048 else if (iceBackStyle == 1)
51049 {
51050 array3[1] = 118;
51051 array3[3] = 117;
51052 array3[0] = 160;
51053 array3[2] = 161;
51054 }
51055 else if (iceBackStyle == 2)
51056 {
51057 array3[1] = 165;
51058 array3[3] = 167;
51059 array3[0] = 164;
51060 array3[2] = 166;
51061 }
51062 else
51063 {
51064 array3[1] = 120;
51065 array3[3] = 119;
51066 array3[0] = 162;
51067 array3[2] = 163;
51068 }
51069 array3[4] = array3[3];
51070 break;
51071 case 2:
51072 array3[0] = 62;
51073 array3[1] = 63;
51074 array3[2] = 64;
51075 array3[3] = 65;
51076 array3[4] = 143 + hellBackStyle;
51077 break;
51078 case 3:
51079 array3[0] = 66;
51080 array3[1] = 67;
51081 array3[2] = 68;
51082 array3[3] = 69;
51083 array3[4] = 128 + hellBackStyle;
51084 break;
51085 case 4:
51086 array3[0] = 70;
51087 array3[1] = 71;
51088 array3[2] = 68;
51089 array3[3] = 72;
51090 array3[4] = 128 + hellBackStyle;
51091 break;
51092 case 5:
51093 array3[0] = 73;
51094 array3[1] = 74;
51095 array3[2] = 75;
51096 array3[3] = 76;
51097 array3[4] = 131 + hellBackStyle;
51098 break;
51099 case 6:
51100 array3[0] = 77;
51101 array3[1] = 78;
51102 array3[2] = 79;
51103 array3[3] = 80;
51104 array3[4] = 134 + hellBackStyle;
51105 break;
51106 case 7:
51107 array3[0] = 77;
51108 array3[1] = 81;
51109 array3[2] = 79;
51110 array3[3] = 82;
51111 array3[4] = 134 + hellBackStyle;
51112 break;
51113 case 8:
51114 array3[0] = 83;
51115 array3[1] = 84;
51116 array3[2] = 85;
51117 array3[3] = 86;
51118 array3[4] = 137 + hellBackStyle;
51119 break;
51120 case 9:
51121 array3[0] = 83;
51122 array3[1] = 87;
51123 array3[2] = 88;
51124 array3[3] = 89;
51125 array3[4] = 137 + hellBackStyle;
51126 break;
51127 case 10:
51128 array3[0] = 121;
51129 array3[1] = 122;
51130 array3[2] = 123;
51131 array3[3] = 124;
51132 array3[4] = 140 + hellBackStyle;
51133 break;
51134 case 11:
51135 if (jungleBackStyle == 0)
51136 {
51137 array3[0] = 153;
51138 array3[1] = 147;
51139 array3[2] = 148;
51140 array3[3] = 149;
51141 array3[4] = 150 + hellBackStyle;
51142 }
51143 else
51144 {
51145 array3[0] = 146;
51146 array3[1] = 154;
51147 array3[2] = 155;
51148 array3[3] = 156;
51149 array3[4] = 157 + hellBackStyle;
51150 }
51151 break;
51152 }
51153 if (hellBackStyle == 0)
51154 {
51155 array3[5] = 125;
51156 }
51157 if (hellBackStyle == 1)
51158 {
51159 array3[5] = 126;
51160 }
51161 if (hellBackStyle == 2)
51162 {
51163 array3[5] = 127;
51164 }
51171 if (i == 0)
51172 {
51173 for (int j = 0; j < 6; j++)
51174 {
51175 array[j] = array3[j];
51176 }
51177 }
51178 else
51179 {
51180 for (int k = 0; k < 6; k++)
51181 {
51182 array2[k] = array3[k];
51183 }
51184 }
51185 }
51186 globalBrightness = 1.2f * (1f - value) + 1f * value;
51188 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num3 + (double)screenPosition.X * bgParallax, num3) - (double)(num3 / 2)) - (int)vector.X;
51189 bgLoops = (screenWidth + (int)vector.X * 2) / num3 + 2;
51190 bgTopY = (int)((float)((int)worldSurface * 16 - 16) - screenPosition.Y + 16f);
51191 for (int l = 0; l < bgLoops; l++)
51192 {
51193 for (int m = 0; m < num3 / 16; m++)
51194 {
51195 int num13 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
51196 if (num13 == -8)
51197 {
51198 num13 = 8;
51199 }
51200 float num14 = bgStartX + num3 * l + m * 16 + 8;
51201 float num15 = bgTopY;
51202 Microsoft.Xna.Framework.Color color = Lighting.GetColor((int)((num14 + screenPosition.X) / 16f), (int)((screenPosition.Y + num15) / 16f));
51203 color.R = (byte)((float)(int)color.R * num4);
51204 color.G = (byte)((float)(int)color.G * num5);
51205 color.B = (byte)((float)(int)color.B * num6);
51206 spriteBatch.Draw(TextureAssets.Background[array[0]].Value, new Vector2(bgStartX + num3 * l + 16 * m + num13, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * m + num13 + 16, 0, 16, 16), color);
51207 if (ugBackTransition > 0f)
51208 {
51210 color2.R = (byte)((float)(int)color2.R * ugBackTransition);
51211 color2.G = (byte)((float)(int)color2.G * ugBackTransition);
51212 color2.B = (byte)((float)(int)color2.B * ugBackTransition);
51213 color2.A = (byte)((float)(int)color2.A * ugBackTransition);
51214 spriteBatch.Draw(TextureAssets.Background[array2[0]].Value, new Vector2(bgStartX + num3 * l + 16 * m + num13, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * m + num13 + 16, 0, 16, 16), color2);
51215 }
51216 }
51217 }
51218 double num16 = maxTilesY - 230;
51219 double num17 = (int)((num16 - worldSurface) / 6.0) * 6;
51220 num16 = worldSurface + num17 - 5.0;
51221 bool flag = false;
51222 bool flag2 = false;
51223 bgTopY = (int)((float)((int)worldSurface * 16) - screenPosition.Y + 16f);
51224 if (worldSurface * 16.0 <= (double)(screenPosition.Y + (float)screenHeight + (float)offScreenRange))
51225 {
51227 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num3 + (double)screenPosition.X * bgParallax, num3) - (double)(num3 / 2)) - (int)vector.X;
51228 bgLoops = (screenWidth + (int)vector.X * 2) / num3 + 2;
51229 if (worldSurface * 16.0 < (double)(screenPosition.Y - 16f))
51230 {
51232 bgLoopsY = (screenHeight - bgStartY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
51233 }
51234 else
51235 {
51236 bgStartY = bgTopY;
51237 bgLoopsY = (screenHeight - bgTopY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
51238 }
51239 if (rockLayer * 16.0 < (double)(Camera.ScaledPosition.Y + 600f))
51240 {
51241 bgLoopsY = (int)(rockLayer * 16.0 - (double)screenPosition.Y + 600.0 - (double)bgStartY) / backgroundHeight[2];
51242 flag2 = true;
51243 }
51244 int num18 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
51245 if (num18 == -8)
51246 {
51247 num18 = 8;
51248 }
51249 for (int n = 0; n < bgLoops; n++)
51250 {
51251 for (int num19 = 0; num19 < bgLoopsY; num19++)
51252 {
51253 for (int num20 = 0; num20 < num3 / 16; num20++)
51254 {
51255 for (int num21 = 0; num21 < 6; num21++)
51256 {
51257 float num22 = bgStartY + num19 * 96 + num21 * 16 + 8;
51258 int num23 = (int)(((float)(bgStartX + num3 * n + num20 * 16 + 8) + screenPosition.X) / 16f);
51259 int num24 = (int)((num22 + screenPosition.Y) / 16f);
51261 if (tile[num23, num24] == null)
51262 {
51263 tile[num23, num24] = new Tile();
51264 }
51265 if (color3.R > 0 || color3.G > 0 || color3.B > 0)
51266 {
51267 if (!drawToScreen)
51268 {
51270 tileBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num18, bgStartY + backgroundHeight[array2[1]] * num19 + 16 * num21) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num18 + 16, 16 * num21, 16, 16), vertices, Vector2.Zero, 1f, SpriteEffects.None);
51271 }
51272 else if ((color3.R > num || (double)(int)color3.G > (double)num * 1.1 || (double)(int)color3.B > (double)num * 1.2) && !tile[num23, num24].active() && WallLightAt(num23, num24) && ugBackTransition == 0f)
51273 {
51275 try
51276 {
51277 for (int num25 = 0; num25 < 9; num25++)
51278 {
51279 int num26 = 0;
51280 int num27 = 0;
51281 int width = 4;
51282 int height = 4;
51285 switch (num25)
51286 {
51287 case 0:
51288 if (!tile[num23 - 1, num24 - 1].active())
51289 {
51290 color5 = slices[num25];
51291 }
51292 break;
51293 case 1:
51294 width = 8;
51295 num26 = 4;
51296 if (!tile[num23, num24 - 1].active())
51297 {
51298 color5 = slices[num25];
51299 }
51300 break;
51301 case 2:
51302 num26 = 12;
51303 if (!tile[num23 + 1, num24 - 1].active())
51304 {
51305 color5 = slices[num25];
51306 }
51307 break;
51308 case 3:
51309 height = 8;
51310 num27 = 4;
51311 if (!tile[num23 - 1, num24].active())
51312 {
51313 color5 = slices[num25];
51314 }
51315 break;
51316 case 4:
51317 width = 8;
51318 height = 8;
51319 num26 = 4;
51320 num27 = 4;
51321 break;
51322 case 5:
51323 num26 = 12;
51324 num27 = 4;
51325 height = 8;
51326 if (!tile[num23 + 1, num24].active())
51327 {
51328 color5 = slices[num25];
51329 }
51330 break;
51331 case 6:
51332 num27 = 12;
51333 if (!tile[num23 - 1, num24 + 1].active())
51334 {
51335 color5 = slices[num25];
51336 }
51337 break;
51338 case 7:
51339 width = 8;
51340 height = 4;
51341 num26 = 4;
51342 num27 = 12;
51343 if (!tile[num23, num24 + 1].active())
51344 {
51345 color5 = slices[num25];
51346 }
51347 break;
51348 case 8:
51349 num26 = 12;
51350 num27 = 12;
51351 if (!tile[num23 + 1, num24 + 1].active())
51352 {
51353 color5 = slices[num25];
51354 }
51355 break;
51356 }
51357 color4.R = (byte)((color3.R + color5.R) / 2);
51358 color4.G = (byte)((color3.G + color5.G) / 2);
51359 color4.B = (byte)((color3.B + color5.B) / 2);
51360 color4.R = (byte)((float)(int)color4.R * num4);
51361 color4.G = (byte)((float)(int)color4.G * num5);
51362 color4.B = (byte)((float)(int)color4.B * num6);
51363 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num26 + num18, bgStartY + backgroundHeight[array[1]] * num19 + 16 * num21 + num27) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num26 + num18 + 16, 16 * num21 + num27, width, height), color4);
51364 if (ugBackTransition > 0f)
51365 {
51367 color6.R = (byte)((float)(int)color6.R * ugBackTransition);
51368 color6.G = (byte)((float)(int)color6.G * ugBackTransition);
51369 color6.B = (byte)((float)(int)color6.B * ugBackTransition);
51370 color6.A = (byte)((float)(int)color6.A * ugBackTransition);
51371 spriteBatch.Draw(TextureAssets.Background[array2[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num26 + num18, bgStartY + backgroundHeight[array2[1]] * num19 + 16 * num21 + num27) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num26 + num18 + 16, 16 * num21 + num27, width, height), color6);
51372 }
51373 }
51374 }
51375 catch
51376 {
51377 color3.R = (byte)((float)(int)color3.R * num4);
51378 color3.G = (byte)((float)(int)color3.G * num5);
51379 color3.B = (byte)((float)(int)color3.B * num6);
51380 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num18, bgStartY + backgroundHeight[array[1]] * num19 + 16 * num21) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num18 + 16, 16 * num21, 16, 16), color3);
51381 }
51382 }
51383 else if ((color3.R > num2 || (double)(int)color3.G > (double)num2 * 1.1 || (double)(int)color3.B > (double)num2 * 1.2) && ugBackTransition == 0f)
51384 {
51386 for (int num28 = 0; num28 < 4; num28++)
51387 {
51388 int num29 = 0;
51389 int num30 = 0;
51392 switch (num28)
51393 {
51394 case 1:
51395 num29 = 8;
51396 break;
51397 case 2:
51398 num30 = 8;
51399 break;
51400 case 3:
51401 num29 = 8;
51402 num30 = 8;
51403 break;
51404 }
51405 color7.R = (byte)((color3.R + color8.R) / 2);
51406 color7.G = (byte)((color3.G + color8.G) / 2);
51407 color7.B = (byte)((color3.B + color8.B) / 2);
51408 color7.R = (byte)((float)(int)color7.R * num4);
51409 color7.G = (byte)((float)(int)color7.G * num5);
51410 color7.B = (byte)((float)(int)color7.B * num6);
51411 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num29 + num18, bgStartY + backgroundHeight[array[1]] * num19 + 16 * num21 + num30) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num29 + num18 + 16, 16 * num21 + num30, 8, 8), color7);
51412 if (ugBackTransition > 0f)
51413 {
51415 color9.R = (byte)((float)(int)color9.R * ugBackTransition);
51416 color9.G = (byte)((float)(int)color9.G * ugBackTransition);
51417 color9.B = (byte)((float)(int)color9.B * ugBackTransition);
51418 color9.A = (byte)((float)(int)color9.A * ugBackTransition);
51419 spriteBatch.Draw(TextureAssets.Background[array2[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num29 + num18, bgStartY + backgroundHeight[array2[1]] * num19 + 16 * num21 + num30) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num29 + num18 + 16, 16 * num21 + num30, 8, 8), color9);
51420 }
51421 }
51422 }
51423 else
51424 {
51425 color3.R = (byte)((float)(int)color3.R * num4);
51426 color3.G = (byte)((float)(int)color3.G * num5);
51427 color3.B = (byte)((float)(int)color3.B * num6);
51428 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num18, bgStartY + backgroundHeight[array[1]] * num19 + 16 * num21) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num18 + 16, 16 * num21, 16, 16), color3);
51429 if (ugBackTransition > 0f)
51430 {
51432 color10.R = (byte)((float)(int)color10.R * ugBackTransition);
51433 color10.G = (byte)((float)(int)color10.G * ugBackTransition);
51434 color10.B = (byte)((float)(int)color10.B * ugBackTransition);
51435 color10.A = (byte)((float)(int)color10.A * ugBackTransition);
51436 spriteBatch.Draw(TextureAssets.Background[array2[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num18, bgStartY + backgroundHeight[array2[1]] * num19 + 16 * num21) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num18 + 16, 16 * num21, 16, 16), color10);
51437 }
51438 }
51439 }
51440 else
51441 {
51442 color3.R = (byte)((float)(int)color3.R * num4);
51443 color3.G = (byte)((float)(int)color3.G * num5);
51444 color3.B = (byte)((float)(int)color3.B * num6);
51445 spriteBatch.Draw(TextureAssets.Background[array[1]].Value, new Vector2(bgStartX + num3 * n + 16 * num20 + num18, bgStartY + backgroundHeight[array[1]] * num19 + 16 * num21) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num20 + num18 + 16, 16 * num21, 16, 16), color3);
51446 }
51447 }
51448 }
51449 }
51450 }
51451 if (ugBackTransition > 0f)
51452 {
51453 for (int num31 = 0; num31 < bgLoops; num31++)
51454 {
51455 for (int num32 = 0; num32 < bgLoopsY; num32++)
51456 {
51457 for (int num33 = 0; num33 < num3 / 16; num33++)
51458 {
51459 for (int num34 = 0; num34 < 6; num34++)
51460 {
51461 float num35 = bgStartY + num32 * 96 + num34 * 16 + 8;
51462 int num36 = (int)(((float)(bgStartX + num3 * num31 + num33 * 16 + 8) + screenPosition.X) / 16f);
51463 int num37 = (int)((num35 + screenPosition.Y) / 16f);
51465 if (tile[num36, num37] == null)
51466 {
51467 tile[num36, num37] = new Tile();
51468 }
51469 if (color11.R > 0 || color11.G > 0 || color11.B > 0)
51470 {
51472 byte a = (byte)(255f * ugBackTransition);
51473 vertices2.BottomLeftColor.A = a;
51474 vertices2.BottomRightColor.A = a;
51475 vertices2.TopLeftColor.A = a;
51476 vertices2.TopRightColor.A = a;
51478 }
51479 }
51480 }
51481 }
51482 }
51483 }
51484 if (flag2)
51485 {
51487 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num3 + (double)screenPosition.X * bgParallax, num3) - (double)(num3 / 2)) - (int)vector.X;
51488 bgLoops = (screenWidth + (int)vector.X * 2) / num3 + 2;
51490 if (bgTopY > -32)
51491 {
51492 for (int num38 = 0; num38 < bgLoops; num38++)
51493 {
51494 for (int num39 = 0; num39 < num3 / 16; num39++)
51495 {
51496 float num40 = bgStartX + num3 * num38 + num39 * 16 + 8;
51497 float num41 = bgTopY;
51499 color12.R = (byte)((float)(int)color12.R * num4);
51500 color12.G = (byte)((float)(int)color12.G * num5);
51501 color12.B = (byte)((float)(int)color12.B * num6);
51502 spriteBatch.Draw(TextureAssets.Background[array[2]].Value, new Vector2(bgStartX + num3 * num38 + 16 * num39 + num18, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num39 + num18 + 16, 0, 16, 16), color12);
51503 if (ugBackTransition > 0f)
51504 {
51506 color13.R = (byte)((float)(int)color13.R * ugBackTransition);
51507 color13.G = (byte)((float)(int)color13.G * ugBackTransition);
51508 color13.B = (byte)((float)(int)color13.B * ugBackTransition);
51509 color13.A = (byte)((float)(int)color13.A * ugBackTransition);
51510 spriteBatch.Draw(TextureAssets.Background[array2[2]].Value, new Vector2(bgStartX + num3 * num38 + 16 * num39 + num18, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num39 + num18 + 16, 0, 16, 16), color13);
51511 }
51512 }
51513 }
51514 }
51515 }
51516 }
51517 bgTopY = (int)((float)((int)rockLayer * 16) - screenPosition.Y + 16f + 600f - 8f);
51518 if (rockLayer * 16.0 <= (double)(screenPosition.Y + 600f))
51519 {
51521 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num3 + (double)screenPosition.X * bgParallax, num3) - (double)(num3 / 2)) - (int)vector.X;
51522 bgLoops = (screenWidth + (int)vector.X * 2) / num3 + 2;
51523 if (rockLayer * 16.0 + (double)screenHeight < (double)(screenPosition.Y - 16f))
51524 {
51526 bgLoopsY = (screenHeight - bgStartY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
51527 }
51528 else
51529 {
51530 bgStartY = bgTopY;
51531 bgLoopsY = (screenHeight - bgTopY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
51532 }
51533 if (num16 * 16.0 < (double)(screenPosition.Y + 600f))
51534 {
51535 bgLoopsY = (int)(num16 * 16.0 - (double)screenPosition.Y + 600.0 - (double)bgStartY) / backgroundHeight[2];
51536 flag = true;
51537 }
51538 int num42 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
51539 if (num42 == -8)
51540 {
51541 num42 = 8;
51542 }
51543 for (int num43 = 0; num43 < bgLoops; num43++)
51544 {
51545 for (int num44 = 0; num44 < bgLoopsY; num44++)
51546 {
51547 for (int num45 = 0; num45 < num3 / 16; num45++)
51548 {
51549 for (int num46 = 0; num46 < 6; num46++)
51550 {
51551 float num47 = bgStartY + num44 * 96 + num46 * 16 + 8;
51552 int num48 = (int)(((float)(bgStartX + num3 * num43 + num45 * 16 + 8) + screenPosition.X) / 16f);
51553 int num49 = (int)((num47 + screenPosition.Y) / 16f);
51555 if ((!ShouldDrawBackgroundTileAt(num48, num49) && color14.R != 0 && color14.G != 0 && color14.B != 0) || (color14.R <= 0 && color14.G <= 0 && color14.B <= 0) || (!WallLightAt(num48, num49) && caveParallax == 0f))
51556 {
51557 continue;
51558 }
51559 if (Lighting.NotRetro && color14.R < 230 && color14.G < 230 && color14.B < 230 && ugBackTransition == 0f)
51560 {
51561 if ((color14.R > num || (double)(int)color14.G > (double)num * 1.1 || (double)(int)color14.B > (double)num * 1.2) && !tile[num48, num49].active())
51562 {
51564 for (int num50 = 0; num50 < 9; num50++)
51565 {
51566 int num51 = 0;
51567 int num52 = 0;
51568 int width2 = 4;
51569 int height2 = 4;
51572 switch (num50)
51573 {
51574 case 0:
51575 if (!tile[num48 - 1, num49 - 1].active())
51576 {
51577 color16 = slices[num50];
51578 }
51579 break;
51580 case 1:
51581 width2 = 8;
51582 num51 = 4;
51583 if (!tile[num48, num49 - 1].active())
51584 {
51585 color16 = slices[num50];
51586 }
51587 break;
51588 case 2:
51589 num51 = 12;
51590 if (!tile[num48 + 1, num49 - 1].active())
51591 {
51592 color16 = slices[num50];
51593 }
51594 break;
51595 case 3:
51596 height2 = 8;
51597 num52 = 4;
51598 if (!tile[num48 - 1, num49].active())
51599 {
51600 color16 = slices[num50];
51601 }
51602 break;
51603 case 4:
51604 width2 = 8;
51605 height2 = 8;
51606 num51 = 4;
51607 num52 = 4;
51608 break;
51609 case 5:
51610 num51 = 12;
51611 num52 = 4;
51612 height2 = 8;
51613 if (!tile[num48 + 1, num49].active())
51614 {
51615 color16 = slices[num50];
51616 }
51617 break;
51618 case 6:
51619 num52 = 12;
51620 if (!tile[num48 - 1, num49 + 1].active())
51621 {
51622 color16 = slices[num50];
51623 }
51624 break;
51625 case 7:
51626 width2 = 8;
51627 height2 = 4;
51628 num51 = 4;
51629 num52 = 12;
51630 if (!tile[num48, num49 + 1].active())
51631 {
51632 color16 = slices[num50];
51633 }
51634 break;
51635 case 8:
51636 num51 = 12;
51637 num52 = 12;
51638 if (!tile[num48 + 1, num49 + 1].active())
51639 {
51640 color16 = slices[num50];
51641 }
51642 break;
51643 }
51644 color15.R = (byte)((color14.R + color16.R) / 2);
51645 color15.G = (byte)((color14.G + color16.G) / 2);
51646 color15.B = (byte)((color14.B + color16.B) / 2);
51647 color15.R = (byte)((float)(int)color15.R * num4);
51648 color15.G = (byte)((float)(int)color15.G * num5);
51649 color15.B = (byte)((float)(int)color15.B * num6);
51651 if (ugBackTransition > 0f)
51652 {
51654 color17.R = (byte)((float)(int)color17.R * ugBackTransition);
51655 color17.G = (byte)((float)(int)color17.G * ugBackTransition);
51656 color17.B = (byte)((float)(int)color17.B * ugBackTransition);
51657 color17.A = (byte)((float)(int)color17.A * ugBackTransition);
51659 }
51660 }
51661 }
51662 else if (color14.R > num2 || (double)(int)color14.G > (double)num2 * 1.1 || (double)(int)color14.B > (double)num2 * 1.2)
51663 {
51665 for (int num53 = 0; num53 < 4; num53++)
51666 {
51667 int num54 = 0;
51668 int num55 = 0;
51671 switch (num53)
51672 {
51673 case 1:
51674 num54 = 8;
51675 break;
51676 case 2:
51677 num55 = 8;
51678 break;
51679 case 3:
51680 num54 = 8;
51681 num55 = 8;
51682 break;
51683 }
51684 color18.R = (byte)((color14.R + color19.R) / 2);
51685 color18.G = (byte)((color14.G + color19.G) / 2);
51686 color18.B = (byte)((color14.B + color19.B) / 2);
51687 color18.R = (byte)((float)(int)color18.R * num4);
51688 color18.G = (byte)((float)(int)color18.G * num5);
51689 color18.B = (byte)((float)(int)color18.B * num6);
51691 if (ugBackTransition > 0f)
51692 {
51694 color20.R = (byte)((float)(int)color20.R * ugBackTransition);
51695 color20.G = (byte)((float)(int)color20.G * ugBackTransition);
51696 color20.B = (byte)((float)(int)color20.B * ugBackTransition);
51697 color20.A = (byte)((float)(int)color20.A * ugBackTransition);
51699 }
51700 }
51701 }
51702 else
51703 {
51704 color14.R = (byte)((float)(int)color14.R * num4);
51705 color14.G = (byte)((float)(int)color14.G * num5);
51706 color14.B = (byte)((float)(int)color14.B * num6);
51707 spriteBatch.Draw(TextureAssets.Background[array[3]].Value, new Vector2(bgStartX + num3 * num43 + 16 * num45 + num42, bgStartY + backgroundHeight[array[3]] * num44 + 16 * num46) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num45 + num42 + 16, 16 * num46, 16, 16), color14);
51708 if (ugBackTransition > 0f)
51709 {
51711 color21.R = (byte)((float)(int)color21.R * ugBackTransition);
51712 color21.G = (byte)((float)(int)color21.G * ugBackTransition);
51713 color21.B = (byte)((float)(int)color21.B * ugBackTransition);
51714 color21.A = (byte)((float)(int)color21.A * ugBackTransition);
51715 spriteBatch.Draw(TextureAssets.Background[array2[3]].Value, new Vector2(bgStartX + num3 * num43 + 16 * num45 + num42, bgStartY + backgroundHeight[array2[3]] * num44 + 16 * num46) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num45 + num42 + 16, 16 * num46, 16, 16), color21);
51716 }
51717 }
51718 }
51719 else
51720 {
51721 color14.R = (byte)((float)(int)color14.R * num4);
51722 color14.G = (byte)((float)(int)color14.G * num5);
51723 color14.B = (byte)((float)(int)color14.B * num6);
51724 spriteBatch.Draw(TextureAssets.Background[array[3]].Value, new Vector2(bgStartX + num3 * num43 + 16 * num45 + num42, bgStartY + backgroundHeight[array[3]] * num44 + 16 * num46) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num45 + num42 + 16, 16 * num46, 16, 16), color14);
51725 if (ugBackTransition > 0f)
51726 {
51728 color22.R = (byte)((float)(int)color22.R * ugBackTransition);
51729 color22.G = (byte)((float)(int)color22.G * ugBackTransition);
51730 color22.B = (byte)((float)(int)color22.B * ugBackTransition);
51731 color22.A = (byte)((float)(int)color22.A * ugBackTransition);
51732 spriteBatch.Draw(TextureAssets.Background[array2[3]].Value, new Vector2(bgStartX + num3 * num43 + 16 * num45 + num42, bgStartY + backgroundHeight[array2[3]] * num44 + 16 * num46) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num45 + num42 + 16, 16 * num46, 16, 16), color22);
51733 }
51734 }
51735 }
51736 }
51737 }
51738 }
51739 num3 = 128;
51740 if (flag)
51741 {
51743 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num3 + (double)screenPosition.X * bgParallax, num3) - (double)(num3 / 2)) - (int)vector.X;
51744 bgLoops = (screenWidth + (int)vector.X * 2) / num3 + 2;
51746 for (int num56 = 0; num56 < bgLoops; num56++)
51747 {
51748 for (int num57 = 0; num57 < num3 / 16; num57++)
51749 {
51750 float num58 = bgStartX + num3 * num56 + num57 * 16 + 8;
51751 float num59 = bgTopY;
51753 color23.R = (byte)((float)(int)color23.R * num4);
51754 color23.G = (byte)((float)(int)color23.G * num5);
51755 color23.B = (byte)((float)(int)color23.B * num6);
51756 spriteBatch.Draw(TextureAssets.Background[array[4]].Value, new Vector2(bgStartX + num3 * num56 + 16 * num57 + num42, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num57 + num42 + 16, magmaBGFrame * 16, 16, 16), color23);
51757 if (ugBackTransition > 0f)
51758 {
51760 color24.R = (byte)((float)(int)color24.R * ugBackTransition);
51761 color24.G = (byte)((float)(int)color24.G * ugBackTransition);
51762 color24.B = (byte)((float)(int)color24.B * ugBackTransition);
51763 color24.A = (byte)((float)(int)color24.A * ugBackTransition);
51764 spriteBatch.Draw(TextureAssets.Background[array2[4]].Value, new Vector2(bgStartX + num3 * num56 + 16 * num57 + num42, bgTopY) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num57 + num42 + 16, magmaBGFrame * 16, 16, 16), color24);
51765 }
51766 }
51767 }
51768 }
51769 }
51770 bgTopY = (int)((float)((int)num16 * 16) - screenPosition.Y + 16f + 600f) - 8;
51771 if (num16 * 16.0 <= (double)(screenPosition.Y + 600f))
51772 {
51773 bgStartX = (int)(0.0 - Math.IEEERemainder((double)num3 + (double)screenPosition.X * bgParallax, num3) - (double)(num3 / 2)) - (int)vector.X;
51774 bgLoops = (screenWidth + (int)vector.X * 2) / num3 + 2;
51775 if (num16 * 16.0 + (double)screenHeight < (double)(screenPosition.Y - 16f))
51776 {
51778 bgLoopsY = (screenHeight - bgStartY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
51779 }
51780 else
51781 {
51782 bgStartY = bgTopY;
51783 bgLoopsY = (screenHeight - bgTopY + (int)vector.Y * 2) / backgroundHeight[2] + 1;
51784 }
51785 num = (int)((double)num * 1.5);
51786 num2 = (int)((double)num2 * 1.5);
51787 int num60 = (int)(float)Math.Round(0f - (float)Math.IEEERemainder((float)bgStartX + screenPosition.X, 16.0));
51788 if (num60 == -8)
51789 {
51790 num60 = 8;
51791 }
51792 for (int num61 = 0; num61 < bgLoops; num61++)
51793 {
51794 for (int num62 = 0; num62 < bgLoopsY; num62++)
51795 {
51796 for (int num63 = 0; num63 < num3 / 16; num63++)
51797 {
51798 for (int num64 = 0; num64 < 6; num64++)
51799 {
51800 float num65 = bgStartY + num62 * 96 + num64 * 16 + 8;
51801 int num66 = (int)(((float)(bgStartX + num3 * num61 + num63 * 16 + 8) + screenPosition.X) / 16f);
51802 int num67 = (int)((num65 + screenPosition.Y) / 16f);
51804 if ((!ShouldDrawBackgroundTileAt(num66, num67) && color25.R != 0 && color25.G != 0 && color25.B != 0) || (color25.R <= 0 && color25.G <= 0 && color25.B <= 0) || (!WallLightAt(num66, num67) && caveParallax == 0f))
51805 {
51806 continue;
51807 }
51808 if (Lighting.NotRetro && color25.R < 230 && color25.G < 230 && color25.B < 230)
51809 {
51810 if ((color25.R > num || (double)(int)color25.G > (double)num * 1.1 || (double)(int)color25.B > (double)num * 1.2) && !tile[num66, num67].active())
51811 {
51813 for (int num68 = 0; num68 < 9; num68++)
51814 {
51815 int num69 = 0;
51816 int num70 = 0;
51817 int width3 = 4;
51818 int height3 = 4;
51821 switch (num68)
51822 {
51823 case 0:
51824 if (!tile[num66 - 1, num67 - 1].active())
51825 {
51826 color27 = slices[num68];
51827 }
51828 break;
51829 case 1:
51830 width3 = 8;
51831 num69 = 4;
51832 if (!tile[num66, num67 - 1].active())
51833 {
51834 color27 = slices[num68];
51835 }
51836 break;
51837 case 2:
51838 num69 = 12;
51839 if (!tile[num66 + 1, num67 - 1].active())
51840 {
51841 color27 = slices[num68];
51842 }
51843 break;
51844 case 3:
51845 height3 = 8;
51846 num70 = 4;
51847 if (!tile[num66 - 1, num67].active())
51848 {
51849 color27 = slices[num68];
51850 }
51851 break;
51852 case 4:
51853 width3 = 8;
51854 height3 = 8;
51855 num69 = 4;
51856 num70 = 4;
51857 break;
51858 case 5:
51859 num69 = 12;
51860 num70 = 4;
51861 height3 = 8;
51862 if (!tile[num66 + 1, num67].active())
51863 {
51864 color27 = slices[num68];
51865 }
51866 break;
51867 case 6:
51868 num70 = 12;
51869 if (!tile[num66 - 1, num67 + 1].active())
51870 {
51871 color27 = slices[num68];
51872 }
51873 break;
51874 case 7:
51875 width3 = 8;
51876 height3 = 4;
51877 num69 = 4;
51878 num70 = 12;
51879 if (!tile[num66, num67 + 1].active())
51880 {
51881 color27 = slices[num68];
51882 }
51883 break;
51884 case 8:
51885 num69 = 12;
51886 num70 = 12;
51887 if (!tile[num66 + 1, num67 + 1].active())
51888 {
51889 color27 = slices[num68];
51890 }
51891 break;
51892 }
51893 color26.R = (byte)((color25.R + color27.R) / 2);
51894 color26.G = (byte)((color25.G + color27.G) / 2);
51895 color26.B = (byte)((color25.B + color27.B) / 2);
51896 color26.R = (byte)((float)(int)color26.R * num4);
51897 color26.G = (byte)((float)(int)color26.G * num5);
51898 color26.B = (byte)((float)(int)color26.B * num6);
51900 }
51901 }
51902 else if (color25.R > num2 || (double)(int)color25.G > (double)num2 * 1.1 || (double)(int)color25.B > (double)num2 * 1.2)
51903 {
51905 for (int num71 = 0; num71 < 4; num71++)
51906 {
51907 int num72 = 0;
51908 int num73 = 0;
51911 switch (num71)
51912 {
51913 case 1:
51914 num72 = 8;
51915 break;
51916 case 2:
51917 num73 = 8;
51918 break;
51919 case 3:
51920 num72 = 8;
51921 num73 = 8;
51922 break;
51923 }
51924 color28.R = (byte)((color25.R + color29.R) / 2);
51925 color28.G = (byte)((color25.G + color29.G) / 2);
51926 color28.B = (byte)((color25.B + color29.B) / 2);
51927 color28.R = (byte)((float)(int)color28.R * num4);
51928 color28.G = (byte)((float)(int)color28.G * num5);
51929 color28.B = (byte)((float)(int)color28.B * num6);
51930 spriteBatch.Draw(TextureAssets.Background[array[5]].Value, new Vector2(bgStartX + num3 * num61 + 16 * num63 + num72 + num60, bgStartY + backgroundHeight[2] * num62 + 16 * num64 + num73) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num63 + num72 + num60 + 16, 16 * num64 + backgroundHeight[2] * magmaBGFrame + num73, 8, 8), color28, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
51931 }
51932 }
51933 else
51934 {
51935 color25.R = (byte)((float)(int)color25.R * num4);
51936 color25.G = (byte)((float)(int)color25.G * num5);
51937 color25.B = (byte)((float)(int)color25.B * num6);
51938 spriteBatch.Draw(TextureAssets.Background[array[5]].Value, new Vector2(bgStartX + num3 * num61 + 16 * num63 + num60, bgStartY + backgroundHeight[2] * num62 + 16 * num64) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num63 + num60 + 16, 16 * num64 + backgroundHeight[2] * magmaBGFrame, 16, 16), color25, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
51939 }
51940 }
51941 else
51942 {
51943 color25.R = (byte)((float)(int)color25.R * num4);
51944 color25.G = (byte)((float)(int)color25.G * num5);
51945 color25.B = (byte)((float)(int)color25.B * num6);
51946 spriteBatch.Draw(TextureAssets.Background[array[5]].Value, new Vector2(bgStartX + num3 * num61 + 16 * num63 + num60, bgStartY + backgroundHeight[2] * num62 + 16 * num64) + vector, new Microsoft.Xna.Framework.Rectangle(16 * num63 + num60 + 16, 16 * num64 + backgroundHeight[2] * magmaBGFrame, 16, 16), color25, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
51947 }
51948 }
51949 }
51950 }
51951 }
51952 }
51953 Lighting.GlobalBrightness = globalBrightness;
51954 TimeLogger.DrawTime(3, stopwatch.Elapsed.TotalMilliseconds);
51955 }
51956
51957 private static bool ShouldDrawBackgroundTileAt(int i, int j)
51958 {
51959 if (tile[i, j] == null)
51960 {
51961 tile[i, j] = new Tile();
51962 }
51963 if (caveParallax != 0f)
51964 {
51965 if (tile[i - 1, j] == null)
51966 {
51967 tile[i - 1, j] = new Tile();
51968 }
51969 if (tile[i + 1, j] == null)
51970 {
51971 tile[i + 1, j] = new Tile();
51972 }
51973 if (WallLightAt(i, j) || WallLightAt(i - 1, j) || WallLightAt(i + 1, j))
51974 {
51975 return true;
51976 }
51977 }
51978 else if (WallLightAt(i, j))
51979 {
51980 return true;
51981 }
51982 return false;
51983 }
51984
51985 public static bool WallLightAt(int i, int j)
51986 {
51988 }
51989
51990 public static bool WallLightAt(int i, int j, bool showInvisibleWalls)
51991 {
51992 Tile tile = Main.tile[i, j];
51993 if (!wallLight[tile.wall])
51994 {
51995 if (!showInvisibleWalls)
51996 {
51997 return tile.invisibleWall();
51998 }
51999 return false;
52000 }
52001 return true;
52002 }
52003
52004 protected void RenderBackground()
52005 {
52006 if (drawToScreen)
52007 {
52008 return;
52009 }
52010 base.GraphicsDevice.SetRenderTarget(backWaterTarget);
52012 spriteBatch.Begin();
52013 tileBatch.Begin();
52014 try
52015 {
52016 DrawWaters(isBackground: true);
52017 }
52018 catch
52019 {
52020 }
52021 tileBatch.End();
52022 spriteBatch.End();
52023 base.GraphicsDevice.SetRenderTarget(null);
52024 base.GraphicsDevice.SetRenderTarget(backgroundTarget);
52026 spriteBatch.Begin();
52027 tileBatch.Begin();
52028 if (ignoreErrors)
52029 {
52030 try
52031 {
52033 }
52034 catch (Exception e)
52035 {
52037 }
52038 }
52039 else
52040 {
52042 }
52044 tileBatch.End();
52045 spriteBatch.End();
52047 base.GraphicsDevice.SetRenderTarget(null);
52048 }
52049
52050 protected void DrawToMap()
52051 {
52052 if (!mapEnabled)
52053 {
52054 return;
52055 }
52056 int num = maxTilesX / textureMaxWidth;
52058 for (int i = 0; i <= num; i++)
52059 {
52060 for (int j = 0; j <= num2; j++)
52061 {
52062 if (!checkMap(i, j))
52063 {
52064 return;
52065 }
52066 }
52067 }
52068 if (clearMap)
52069 {
52070 for (int k = 0; k <= num; k++)
52071 {
52072 for (int l = 0; l <= num2; l++)
52073 {
52074 base.GraphicsDevice.SetRenderTarget(mapTarget[k, l]);
52076 base.GraphicsDevice.SetRenderTarget(null);
52077 }
52078 }
52079 clearMap = false;
52080 }
52081 int num3 = -1;
52082 int num4 = -1;
52083 bool flag = false;
52084 int num5 = 0;
52085 int num6 = mapMinY;
52086 int num7 = mapMinY;
52087 int num8 = mapMaxY;
52088 int num9 = mapMaxY;
52089 int num10 = 1;
52091 {
52094 num10 = 2;
52095 }
52096 for (int m = 0; m < num10; m++)
52097 {
52098 switch (m)
52099 {
52100 case 0:
52101 mapMinY = num6;
52102 mapMaxY = num8;
52103 break;
52104 case 1:
52105 mapMinY = num7;
52106 mapMaxY = num9;
52107 break;
52108 }
52109 if (mapMinX < 0)
52110 {
52111 mapMinX = 0;
52112 }
52113 if (mapMinX >= maxTilesX)
52114 {
52115 mapMinX = maxTilesX - 1;
52116 }
52117 if (mapMinY < 0)
52118 {
52119 mapMinY = 0;
52120 }
52121 if (mapMinY >= maxTilesY)
52122 {
52123 mapMinY = maxTilesY - 1;
52124 }
52125 for (int n = mapMinX; n < mapMaxX; n++)
52126 {
52127 for (int num11 = mapMinY; num11 < mapMaxY; num11++)
52128 {
52129 MapTile mapTile = Map[n, num11];
52131 {
52132 continue;
52133 }
52134 num5++;
52135 if (num5 >= maxMapUpdates)
52136 {
52137 continue;
52138 }
52139 if (loadMap)
52140 {
52141 loadMapLastX = n;
52142 }
52143 Map.ConsumeUpdate(n, num11);
52144 int num12 = n / textureMaxWidth;
52146 if (num12 != num3 || num13 != num4)
52147 {
52148 num3 = num12;
52149 num4 = num13;
52150 if (flag)
52151 {
52152 spriteBatch.End();
52153 base.GraphicsDevice.SetRenderTarget(null);
52154 }
52155 flag = true;
52156 base.GraphicsDevice.SetRenderTarget(mapTarget[num12, num13]);
52157 spriteBatch.Begin();
52158 }
52159 int num14 = n - num12 * textureMaxWidth;
52162 int num16 = 1;
52163 int num17 = 1;
52164 int num18 = num11 + 1;
52165 while (num18 < mapMaxY)
52166 {
52167 MapTile other;
52168 MapTile mapTile2 = (other = Map[n, num18]);
52169 if (!mapTile2.IsChanged || !mapTile.Equals(ref other) || num18 / textureMaxHeight != num13)
52170 {
52171 break;
52172 }
52173 Map.ConsumeUpdate(n, num18);
52174 num16++;
52175 num18++;
52176 num11++;
52177 }
52178 if (num16 == 1)
52179 {
52180 for (num18 = n + 1; num18 < mapMaxX; num18++)
52181 {
52182 MapTile other;
52183 MapTile mapTile2 = (other = Map[num18, num11]);
52184 if (!mapTile2.IsChanged || !mapTile.Equals(ref other) || num18 / textureMaxWidth != num12)
52185 {
52186 break;
52187 }
52188 Map.ConsumeUpdate(num18, num11);
52189 num17++;
52190 }
52191 }
52193 }
52194 }
52195 }
52196 for (int num19 = 0; num19 < MapHelper.numUpdateTile; num19++)
52197 {
52200 MapTile mapTile3 = Map[num20, num21];
52201 if (!mapTile3.IsChanged)
52202 {
52203 continue;
52204 }
52205 Map.ConsumeUpdate(num20, num21);
52206 int num22 = num20 / textureMaxWidth;
52208 if (num22 != num3 || num23 != num4)
52209 {
52210 num3 = num22;
52211 num4 = num23;
52212 if (flag)
52213 {
52214 spriteBatch.End();
52215 base.GraphicsDevice.SetRenderTarget(null);
52216 }
52217 flag = true;
52218 base.GraphicsDevice.SetRenderTarget(mapTarget[num22, num23]);
52219 spriteBatch.Begin();
52220 }
52221 int num24 = num20 - num22 * textureMaxWidth;
52224 spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2(num24, num25), new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1), mapTileXnaColor2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
52225 }
52226 MapHelper.numUpdateTile = 0;
52227 if (flag)
52228 {
52229 spriteBatch.End();
52230 base.GraphicsDevice.SetRenderTarget(null);
52231 }
52232 mapReady = true;
52233 loadMapLastX = 0;
52234 loadMap = false;
52235 loadMapLock = false;
52236 }
52237
52238 protected void DrawToMap_Section(int secX, int secY)
52239 {
52242 int num = secX * 200;
52243 int num2 = num + 200;
52244 int num3 = secY * 150;
52245 int num4 = num3 + 150;
52246 int num5 = num / textureMaxWidth;
52247 int num6 = num3 / textureMaxHeight;
52248 int num7 = num % textureMaxWidth;
52249 int num8 = num3 % textureMaxHeight;
52250 if (!checkMap(num5, num6))
52251 {
52252 return;
52253 }
52254 int num9 = 0;
52256 for (int i = num3; i < num4; i++)
52257 {
52258 for (int j = num; j < num2; j++)
52259 {
52260 MapTile mapTile = Map[j, i];
52262 num9++;
52263 }
52264 }
52265 try
52266 {
52267 base.GraphicsDevice.SetRenderTarget(mapTarget[num5, num6]);
52268 }
52270 {
52271 initMap[num5, num6] = false;
52272 return;
52273 }
52275 double totalMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
52277 _ = stopwatch.Elapsed.TotalMilliseconds;
52278 totalMilliseconds = stopwatch.Elapsed.TotalMilliseconds;
52280 spriteBatch.End();
52281 base.GraphicsDevice.SetRenderTarget(null);
52282 _ = stopwatch.Elapsed.TotalMilliseconds;
52283 stopwatch.Stop();
52284 }
52285
52286 public static string ValueToCoins(long value)
52287 {
52288 long num = value;
52289 long num2 = 0L;
52290 long num3 = 0L;
52291 long num4 = 0L;
52292 long num5 = 0L;
52293 while (num >= 1000000)
52294 {
52295 num -= 1000000;
52296 num2++;
52297 }
52298 while (num >= 10000)
52299 {
52300 num -= 10000;
52301 num3++;
52302 }
52303 while (num >= 100)
52304 {
52305 num -= 100;
52306 num4++;
52307 }
52308 num5 = num;
52309 string text = "";
52310 if (num2 > 0)
52311 {
52312 text += string.Format("{0} {1} ", num2, Language.GetTextValue("Currency.Platinum").ToLower());
52313 }
52314 if (num3 > 0)
52315 {
52316 text += string.Format("{0} {1} ", num3, Language.GetTextValue("Currency.Gold").ToLower());
52317 }
52318 if (num4 > 0)
52319 {
52320 text += string.Format("{0} {1} ", num4, Language.GetTextValue("Currency.Silver").ToLower());
52321 }
52322 if (num5 > 0)
52323 {
52324 text += string.Format("{0} {1} ", num5, Language.GetTextValue("Currency.Copper").ToLower());
52325 }
52326 if (text.Length > 0)
52327 {
52328 text = text.Substring(0, text.Length - 1);
52329 }
52330 return text;
52331 }
52332
52333 private static void UpdateMinimapAnchors()
52334 {
52335 int num = 240;
52336 int num2 = 240;
52339 _minimapTopRightAnchorOffsetTowardsLeft = (int)((float)(52 + num / 2) + MapScale * (float)num / 2f);
52340 _minimapTopRightAnchorOffsetTowardsBottom = (int)((float)(90 + num2 / 2) - MapScale * (float)num2 / 2f);
52343 }
52344
52345 protected void DrawMap(GameTime gameTime)
52346 {
52347 string text = "";
52348 if (!mapEnabled || !mapReady)
52349 {
52350 return;
52351 }
52352 float num = 0f;
52353 float num2 = 0f;
52354 float num3 = num;
52355 float num4 = num2;
52356 float num5 = 2f;
52357 byte b = byte.MaxValue;
52362 float num9 = maxTilesX - Lighting.OffScreenTiles - 1;
52363 float num10 = maxTilesY - Lighting.OffScreenTiles - 42;
52364 float num11 = 0f;
52365 float num12 = 0f;
52366 num7 = 10f;
52367 num8 = 10f;
52368 num9 = maxTilesX - 10;
52369 num10 = maxTilesY - 10;
52370 for (int i = 0; i < mapTarget.GetLength(0); i++)
52371 {
52372 for (int j = 0; j < mapTarget.GetLength(1); j++)
52373 {
52374 if (mapTarget[i, j] != null)
52375 {
52376 if (mapTarget[i, j].IsContentLost && !mapWasContentLost[i, j])
52377 {
52378 mapWasContentLost[i, j] = true;
52379 refreshMap = true;
52380 clearMap = true;
52381 }
52382 else if (!mapTarget[i, j].IsContentLost && mapWasContentLost[i, j])
52383 {
52384 mapWasContentLost[i, j] = false;
52385 }
52386 }
52387 }
52388 }
52389 num = 200f;
52390 num2 = 300f;
52391 float num13 = 0f;
52392 float num14 = 0f;
52393 float num15 = num9 - 1f;
52394 float num16 = num10 - 1f;
52396 bool flag = false;
52397 float mapScale = MapScale;
52398 float num17 = 1f / mapScale;
52399 int num18 = mouseX;
52400 int num19 = mouseY;
52402 Matrix transformMatrix = uIScaleMatrix;
52406 int num20 = -1;
52407 if (mapStyle != 1)
52408 {
52409 transformMatrix = Matrix.Identity;
52410 }
52411 if (mapFullscreen)
52412 {
52413 transformMatrix = Matrix.Identity;
52414 }
52415 if (!mapFullscreen && mapStyle == 1)
52416 {
52417 transformMatrix *= matrix;
52418 transformMatrix2 *= matrix;
52419 }
52420 if (!mapFullscreen)
52421 {
52422 spriteBatch.End();
52424 if (num5 > 1f)
52425 {
52426 flag = true;
52427 }
52428 }
52429 if (mapFullscreen)
52430 {
52431 if (mouseLeft && base.IsActive && !CaptureManager.Instance.UsingMap)
52432 {
52433 if (mouseLeftRelease)
52434 {
52435 grabMapX = mouseX;
52436 grabMapY = mouseY;
52437 }
52438 else
52439 {
52440 float num21 = (float)mouseX - grabMapX;
52441 float num22 = (float)mouseY - grabMapY;
52442 grabMapX = mouseX;
52443 grabMapY = mouseY;
52444 num21 *= 0.06255f;
52445 num22 *= 0.06255f;
52446 mapFullscreenPos.X -= num21 * (16f / mapFullscreenScale);
52447 mapFullscreenPos.Y -= num22 * (16f / mapFullscreenScale);
52448 }
52449 }
52450 player[myPlayer].mouseInterface = true;
52451 float num23 = (float)screenWidth / (float)maxTilesX * 0.599f;
52453 {
52455 }
52456 if (mapFullscreenScale > 31.2f)
52457 {
52458 mapFullscreenScale = 31.18f;
52459 }
52461 b = byte.MaxValue;
52462 if (mapFullscreenPos.X < num7)
52463 {
52464 mapFullscreenPos.X = num7;
52465 }
52466 if (mapFullscreenPos.X > num9)
52467 {
52468 mapFullscreenPos.X = num9;
52469 }
52470 if (mapFullscreenPos.Y < num8)
52471 {
52472 mapFullscreenPos.Y = num8;
52473 }
52474 if (mapFullscreenPos.Y > num10)
52475 {
52476 mapFullscreenPos.Y = num10;
52477 }
52478 float num24 = mapFullscreenPos.X;
52479 float num25 = mapFullscreenPos.Y;
52480 if (resetMapFull)
52481 {
52482 resetMapFull = false;
52483 num24 = (screenPosition.X + (float)(screenWidth / 2)) / 16f;
52484 num25 = (screenPosition.Y + (float)(screenHeight / 2)) / 16f;
52485 mapFullscreenPos.X = num24;
52486 mapFullscreenPos.Y = num25;
52487 }
52488 num24 *= num5;
52489 num25 *= num5;
52490 num = 0f - num24 + (float)(screenWidth / 2);
52491 num2 = 0f - num25 + (float)(screenHeight / 2);
52492 num += num7 * num5;
52493 num2 += num8 * num5;
52494 float num26 = maxTilesX / 840;
52496 float num27 = num;
52497 float num28 = num2;
52498 float num29 = TextureAssets.Map.Width();
52499 float num30 = TextureAssets.Map.Height();
52500 if (maxTilesX == 8400)
52501 {
52502 num26 *= 0.999f;
52503 num27 -= 40.6f * num26;
52504 num28 = num2 - 5f * num26;
52505 num29 -= 8.045f;
52506 num29 *= num26;
52507 num30 += 0.12f;
52508 num30 *= num26;
52509 if ((double)num26 < 1.2)
52510 {
52511 num30 += 1f;
52512 }
52513 }
52514 else if (maxTilesX == 6400)
52515 {
52516 num26 *= 1.09f;
52517 num27 -= 38.8f * num26;
52518 num28 = num2 - 3.85f * num26;
52519 num29 -= 13.6f;
52520 num29 *= num26;
52521 num30 -= 6.92f;
52522 num30 *= num26;
52523 if ((double)num26 < 1.2)
52524 {
52525 num30 += 2f;
52526 }
52527 }
52528 else if (maxTilesX == 6300)
52529 {
52530 num26 *= 1.09f;
52531 num27 -= 39.8f * num26;
52532 num28 = num2 - 4.08f * num26;
52533 num29 -= 26.69f;
52534 num29 *= num26;
52535 num30 -= 6.92f;
52536 num30 *= num26;
52537 if ((double)num26 < 1.2)
52538 {
52539 num30 += 2f;
52540 }
52541 }
52542 else if (maxTilesX == 4200)
52543 {
52544 num26 *= 0.998f;
52545 num27 -= 37.3f * num26;
52546 num28 -= 1.7f * num26;
52547 num29 -= 16f;
52548 num29 *= num26;
52549 num30 -= 8.31f;
52550 num30 *= num26;
52551 }
52552 spriteBatch.End();
52554 flag = true;
52556 Microsoft.Xna.Framework.Rectangle destinationRectangle = new Microsoft.Xna.Framework.Rectangle((int)num27, (int)num28, (int)num29, (int)num30);
52557 spriteBatch.Draw(TextureAssets.Map.Value, destinationRectangle, Microsoft.Xna.Framework.Color.White);
52559 {
52560 double totalSeconds = gameTime.TotalGameTime.TotalSeconds;
52562 {
52563 TriggerPing((MouseScreen - new Vector2(num - 10f * num5, num2 - 10f * num5)) / num5);
52564 }
52567 }
52568 if (num5 < 1f)
52569 {
52570 spriteBatch.End();
52571 spriteBatch.Begin();
52572 flag = false;
52573 }
52574 }
52575 else if (mapStyle == 1)
52576 {
52578 miniMapWidth = 240;
52579 miniMapHeight = 240;
52582 miniMapX = (int)((float)miniMapX * num17);
52583 miniMapY = (int)((float)miniMapY * num17);
52584 mouseX = (int)((float)mouseX * num17);
52585 mouseY = (int)((float)mouseY * num17);
52586 _ = (float)miniMapHeight / (float)maxTilesY;
52587 if ((double)mapMinimapScale < 0.2)
52588 {
52589 mapMinimapScale = 0.2f;
52590 }
52591 if (mapMinimapScale > 3f)
52592 {
52593 mapMinimapScale = 3f;
52594 }
52595 if ((double)mapMinimapAlpha < 0.01)
52596 {
52597 mapMinimapAlpha = 0.01f;
52598 }
52599 if (mapMinimapAlpha > 1f)
52600 {
52601 mapMinimapAlpha = 1f;
52602 }
52604 b = (byte)(255f * mapMinimapAlpha);
52605 num = miniMapX;
52606 num2 = miniMapY;
52607 num3 = num;
52608 num4 = num2;
52609 float num31 = (screenPosition.X + (float)(PlayerInput.RealScreenWidth / 2)) / 16f;
52610 float num32 = (screenPosition.Y + (float)(PlayerInput.RealScreenHeight / 2)) / 16f;
52611 num11 = (0f - (num31 - (float)(int)((screenPosition.X + (float)(PlayerInput.RealScreenWidth / 2)) / 16f))) * num5;
52612 num12 = (0f - (num32 - (float)(int)((screenPosition.Y + (float)(PlayerInput.RealScreenHeight / 2)) / 16f))) * num5;
52613 num15 = (float)miniMapWidth / num5;
52614 num16 = (float)miniMapHeight / num5;
52615 num13 = (float)(int)num31 - num15 / 2f;
52616 num14 = (float)(int)num32 - num16 / 2f;
52617 _ = (float)maxTilesY + num14;
52618 float num33 = num3 - 6f;
52619 float num34 = num4 - 6f;
52620 MinimapFrameManagerInstance.DrawTo(spriteBatch, new Vector2(num33 + 10f, num34 + 10f));
52621 }
52622 else if (mapStyle == 2)
52623 {
52624 float num35 = (float)screenWidth / (float)maxTilesX;
52625 if (mapOverlayScale < num35)
52626 {
52628 }
52629 if (mapOverlayScale > 16f * GameViewMatrix.Zoom.X)
52630 {
52631 mapOverlayScale = 16f * GameViewMatrix.Zoom.X;
52632 }
52633 if ((double)mapOverlayAlpha < 0.01)
52634 {
52635 mapOverlayAlpha = 0.01f;
52636 }
52637 if (mapOverlayAlpha > 1f)
52638 {
52639 mapOverlayAlpha = 1f;
52640 }
52642 b = (byte)(255f * mapOverlayAlpha);
52643 _ = maxTilesX;
52644 _ = maxTilesY;
52645 float num36 = (screenPosition.X + (float)(screenWidth / 2)) / 16f;
52646 float num37 = (screenPosition.Y + (float)(screenHeight / 2)) / 16f;
52647 num36 *= num5;
52648 float num38 = num37 * num5;
52649 num = 0f - num36 + (float)(screenWidth / 2);
52650 num2 = 0f - num38 + (float)(screenHeight / 2);
52651 num += num7 * num5;
52652 num2 += num8 * num5;
52653 }
52654 if (mapStyle == 1 && !mapFullscreen)
52655 {
52656 if (num13 < num7)
52657 {
52658 num -= (num13 - num7) * num5;
52659 }
52660 if (num14 < num8)
52661 {
52662 num2 -= (num14 - num8) * num5;
52663 }
52664 }
52665 num15 = num13 + num15;
52666 num16 = num14 + num16;
52667 if (num13 > num7)
52668 {
52669 num7 = num13;
52670 }
52671 if (num14 > num8)
52672 {
52673 num8 = num14;
52674 }
52675 if (num15 < num9)
52676 {
52677 num9 = num15;
52678 }
52679 if (num16 < num10)
52680 {
52681 num10 = num16;
52682 }
52683 float num39 = (float)textureMaxWidth * num5;
52684 float num40 = (float)textureMaxHeight * num5;
52685 float num41 = num;
52686 float num42 = 0f;
52687 for (int k = 0; k <= 4; k++)
52688 {
52689 if (!((float)((k + 1) * textureMaxWidth) > num7) || !((float)(k * textureMaxWidth) < num7 + num9))
52690 {
52691 continue;
52692 }
52693 for (int l = 0; l <= num6; l++)
52694 {
52695 if ((float)((l + 1) * textureMaxHeight) > num8 && (float)(l * textureMaxHeight) < num8 + num10)
52696 {
52697 float num43 = num + (float)(int)((float)k * num39);
52698 float num44 = num2 + (float)(int)((float)l * num40);
52699 float num45 = k * textureMaxWidth;
52700 float num46 = l * textureMaxHeight;
52701 float num47 = 0f;
52702 float num48 = 0f;
52703 if (num45 < num7)
52704 {
52705 num47 = num7 - num45;
52706 num43 = num;
52707 }
52708 else
52709 {
52710 num43 -= num7 * num5;
52711 }
52712 if (num46 < num8)
52713 {
52714 num48 = num8 - num46;
52715 num44 = num2;
52716 }
52717 else
52718 {
52719 num44 -= num8 * num5;
52720 }
52721 num43 = num41;
52722 float num49 = textureMaxWidth;
52723 float num50 = textureMaxHeight;
52724 float num51 = (k + 1) * textureMaxWidth;
52725 float num52 = (l + 1) * textureMaxHeight;
52726 if (num51 >= num9)
52727 {
52728 num49 -= num51 - num9;
52729 }
52730 if (num52 >= num10)
52731 {
52732 num50 -= num52 - num10;
52733 }
52734 num43 += num11;
52735 num44 += num12;
52736 if (num49 > num47)
52737 {
52739 spriteBatch.Draw(mapTarget[k, l], new Vector2(num43, num44), value, new Microsoft.Xna.Framework.Color(b, b, b, b), 0f, default(Vector2), num5, SpriteEffects.None, 0f);
52740 }
52741 num42 = (float)((int)num49 - (int)num47) * num5;
52742 }
52743 if (l == num6)
52744 {
52745 num41 += num42;
52746 }
52747 }
52748 }
52749 if (flag)
52750 {
52751 spriteBatch.End();
52753 }
52754 if (!mapFullscreen)
52755 {
52756 if (mapStyle == 2)
52757 {
52758 float num53 = (num5 * 0.2f * 2f + 1f) / 3f;
52759 if (num53 > 1f)
52760 {
52761 num53 = 1f;
52762 }
52763 num53 *= UIScale;
52764 MapIcons.Draw(Vector2.Zero, new Vector2(num - 10f * num5, num2 - 10f * num5), null, num5, num53, ref text);
52765 revengeMarker = NPC.RevengeManager.DrawMapIcons(spriteBatch, Vector2.Zero, new Vector2(num - 10f * num5, num2 - 10f * num5), null, num5, num53, ref text);
52766 DrawMiscMapIcons(spriteBatch, Vector2.Zero, new Vector2(num - 10f * num5, num2 - 10f * num5), null, num5, num53, ref text);
52767 spriteBatch.End();
52768 if (revengeMarker != null)
52769 {
52771 try
52772 {
52773 revengeMarker.UseMouseOver(spriteBatch, ref text, num53);
52774 }
52775 catch (Exception e)
52776 {
52778 }
52779 spriteBatch.End();
52780 }
52782 try
52783 {
52784 for (int m = 0; m < 200; m++)
52785 {
52786 if (npc[m].active && npc[m].townNPC)
52787 {
52789 if (headIndexSafe > 0)
52790 {
52792 if (npc[m].direction > 0)
52793 {
52794 dir = SpriteEffects.FlipHorizontally;
52795 }
52796 float num54 = (npc[m].position.X + (float)(npc[m].width / 2)) / 16f * num5;
52797 float num55 = (npc[m].position.Y + (float)(npc[m].height / 2)) / 16f * num5;
52798 num54 += num;
52799 num55 += num2;
52800 num54 -= 10f * num5;
52801 num55 -= 10f * num5;
52803 }
52804 }
52805 if (!npc[m].active || npc[m].GetBossHeadTextureIndex() == -1)
52806 {
52807 continue;
52808 }
52809 float bossHeadRotation = npc[m].GetBossHeadRotation();
52810 SpriteEffects bossHeadSpriteEffects = npc[m].GetBossHeadSpriteEffects();
52811 Vector2 vector = npc[m].Center + new Vector2(0f, npc[m].gfxOffY);
52812 if (npc[m].type == 134)
52813 {
52814 Vector2 center = npc[m].Center;
52815 int num56 = 1;
52816 int num57 = (int)npc[m].ai[0];
52817 while (num56 < 15 && npc[num57].active && npc[num57].type >= 134 && npc[num57].type <= 136)
52818 {
52819 num56++;
52820 center += npc[num57].Center;
52821 num57 = (int)npc[num57].ai[0];
52822 }
52823 center /= (float)num56;
52824 vector = center;
52825 }
52826 int bossHeadTextureIndex = npc[m].GetBossHeadTextureIndex();
52827 float num58 = vector.X / 16f * num5;
52828 float num59 = vector.Y / 16f * num5;
52829 num58 += num;
52830 num59 += num2;
52831 num58 -= 10f * num5;
52832 num59 -= 10f * num5;
52834 }
52835 }
52836 catch (Exception e2)
52837 {
52839 }
52840 spriteBatch.End();
52842 for (int n = 0; n < 255; n++)
52843 {
52844 if (player[n].active && !player[n].dead && n != myPlayer && ((!player[myPlayer].hostile && !player[n].hostile) || (player[myPlayer].team == player[n].team && player[n].team != 0) || n == myPlayer))
52845 {
52846 float num60 = (player[n].position.X + (float)(player[n].width / 2)) / 16f * num5;
52847 float num61 = player[n].position.Y / 16f * num5;
52848 num60 += num;
52849 num61 += num2;
52850 num60 -= 6f;
52851 num61 -= 2f;
52852 num61 -= 2f - num5 / 5f * 2f;
52853 num60 -= 10f * num5;
52854 num61 -= 10f * num5;
52856 MapPlayerRenderer.DrawPlayerHead(Camera, player[n], new Vector2(num60, num61), (float)(int)b / 255f, num53, playerHeadBordersColor);
52857 }
52858 }
52859 spriteBatch.End();
52860 spriteBatch.Begin();
52861 }
52862 if (mapStyle == 1)
52863 {
52864 float num62 = (num5 * 0.25f * 2f + 1f) / 3f;
52865 if (num62 > 1f)
52866 {
52867 num62 = 1f;
52868 }
52872 spriteBatch.End();
52874 for (int num63 = 0; num63 < 200; num63++)
52875 {
52876 if (npc[num63].active && npc[num63].townNPC)
52877 {
52879 if (headIndexSafe2 > 0)
52880 {
52882 if (npc[num63].direction > 0)
52883 {
52884 dir2 = SpriteEffects.FlipHorizontally;
52885 }
52886 float num64 = ((npc[num63].position.X + (float)npc[num63].width / 2f) / 16f - num13) * num5;
52887 float num65 = ((npc[num63].position.Y + npc[num63].gfxOffY + (float)npc[num63].height / 2f) / 16f - num14) * num5;
52888 num64 += num3;
52889 num65 += num4;
52890 num65 -= 2f * num5 / 5f;
52891 num64 += num11;
52892 num65 += num12;
52893 if (num64 > (float)(miniMapX + 12) && num64 < (float)(miniMapX + miniMapWidth - 16) && num65 > (float)(miniMapY + 10) && num65 < (float)(miniMapY + miniMapHeight - 14))
52894 {
52895 float num66 = num64 - (float)(TextureAssets.NpcHead[headIndexSafe2].Width() / 2) * num62;
52896 float num67 = num65 - (float)(TextureAssets.NpcHead[headIndexSafe2].Height() / 2) * num62;
52897 float num68 = num66 + (float)TextureAssets.NpcHead[headIndexSafe2].Width() * num62;
52898 float num69 = num67 + (float)TextureAssets.NpcHead[headIndexSafe2].Height() * num62;
52899 if ((float)mouseX >= num66 && (float)mouseX <= num68 && (float)mouseY >= num67 && (float)mouseY <= num69)
52900 {
52901 text = npc[num63].FullName;
52902 }
52904 }
52905 }
52906 }
52907 if (!npc[num63].active || npc[num63].GetBossHeadTextureIndex() == -1)
52908 {
52909 continue;
52910 }
52911 float bossHeadRotation2 = npc[num63].GetBossHeadRotation();
52912 SpriteEffects bossHeadSpriteEffects2 = npc[num63].GetBossHeadSpriteEffects();
52913 Vector2 vector2 = npc[num63].Center + new Vector2(0f, npc[num63].gfxOffY);
52914 if (npc[num63].type == 134)
52915 {
52916 Vector2 center2 = npc[num63].Center;
52917 int num70 = 1;
52918 int num71 = (int)npc[num63].ai[0];
52919 while (num70 < 15 && npc[num71].active && npc[num71].type >= 134 && npc[num71].type <= 136)
52920 {
52921 num70++;
52922 center2 += npc[num71].Center;
52923 num71 = (int)npc[num71].ai[0];
52924 }
52925 center2 /= (float)num70;
52926 vector2 = center2;
52927 }
52928 int bossHeadTextureIndex2 = npc[num63].GetBossHeadTextureIndex();
52929 float num72 = (vector2.X / 16f - num13) * num5;
52930 float num73 = (vector2.Y / 16f - num14) * num5;
52931 num72 += num3;
52932 num73 += num4;
52933 num73 -= 2f * num5 / 5f;
52934 num72 += num11;
52935 num73 += num12;
52936 if (num72 > (float)(miniMapX + 12) && num72 < (float)(miniMapX + miniMapWidth - 16) && num73 > (float)(miniMapY + 10) && num73 < (float)(miniMapY + miniMapHeight - 14))
52937 {
52938 float num74 = num72 - (float)(TextureAssets.NpcHeadBoss[bossHeadTextureIndex2].Width() / 2) * num62;
52939 float num75 = num73 - (float)(TextureAssets.NpcHeadBoss[bossHeadTextureIndex2].Height() / 2) * num62;
52940 float num76 = num74 + (float)TextureAssets.NpcHeadBoss[bossHeadTextureIndex2].Width() * num62;
52941 float num77 = num75 + (float)TextureAssets.NpcHeadBoss[bossHeadTextureIndex2].Height() * num62;
52942 if ((float)mouseX >= num74 && (float)mouseX <= num76 && (float)mouseY >= num75 && (float)mouseY <= num77)
52943 {
52944 text = npc[num63].GivenOrTypeName;
52945 }
52947 }
52948 }
52949 spriteBatch.End();
52951 for (int num78 = 0; num78 < 255; num78++)
52952 {
52953 if (!player[num78].active || ((player[myPlayer].hostile || player[num78].hostile) && (player[myPlayer].team != player[num78].team || player[num78].team == 0) && num78 != myPlayer))
52954 {
52955 continue;
52956 }
52957 float num79 = ((player[num78].position.X + (float)(player[num78].width / 2)) / 16f - num13) * num5;
52958 float num80 = ((player[num78].position.Y + player[num78].gfxOffY + (float)(player[num78].height / 2)) / 16f - num14) * num5;
52959 num79 += num3;
52960 num80 += num4;
52961 num79 -= 6f;
52962 num80 -= 6f;
52963 num80 -= 2f - num5 / 5f * 2f;
52964 num79 += num11;
52965 num80 += num12;
52966 if (!player[num78].dead && num79 > (float)(miniMapX + 6) && num79 < (float)(miniMapX + miniMapWidth - 16) && num80 > (float)(miniMapY + 6) && num80 < (float)(miniMapY + miniMapHeight - 14))
52967 {
52969 MapPlayerRenderer.DrawPlayerHead(Camera, player[num78], new Vector2(num79, num80), (float)(int)b / 255f, num62, playerHeadBordersColor2);
52970 if (num78 != myPlayer)
52971 {
52972 float num81 = num79 + 4f - 14f * num62;
52973 float num82 = num80 + 2f - 14f * num62;
52974 float num83 = num81 + 28f * num62;
52975 float num84 = num82 + 28f * num62;
52976 if ((float)mouseX >= num81 && (float)mouseX <= num83 && (float)mouseY >= num82 && (float)mouseY <= num84)
52977 {
52978 text = player[num78].name;
52979 }
52980 }
52981 }
52982 if (!player[num78].showLastDeath)
52983 {
52984 continue;
52985 }
52986 num79 = (player[num78].lastDeathPostion.X / 16f - num13) * num5;
52987 num80 = (player[num78].lastDeathPostion.Y / 16f - num14) * num5;
52988 num79 += num3;
52989 num80 += num4;
52990 num80 -= 2f - num5 / 5f * 2f;
52991 num79 += num11;
52992 num80 += num12;
52993 if (num79 > (float)(miniMapX + 8) && num79 < (float)(miniMapX + miniMapWidth - 18) && num80 > (float)(miniMapY + 8) && num80 < (float)(miniMapY + miniMapHeight - 16))
52994 {
52995 spriteBatch.Draw(TextureAssets.MapDeath.Value, new Vector2(num79, num80), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.MapDeath.Width(), TextureAssets.MapDeath.Height()), Microsoft.Xna.Framework.Color.White, 0f, new Vector2((float)TextureAssets.MapDeath.Width() * 0.5f, (float)TextureAssets.MapDeath.Height() * 0.5f), num62, SpriteEffects.None, 0f);
52996 float num85 = num79 + 4f - 14f * num62;
52997 float num86 = num80 + 2f - 14f * num62;
52998 num85 -= 4f;
52999 num86 -= 4f;
53000 float num87 = num85 + 28f * num62;
53001 float num88 = num86 + 28f * num62;
53002 if ((float)mouseX >= num85 && (float)mouseX <= num87 && (float)mouseY >= num86 && (float)mouseY <= num88)
53003 {
53004 num20 = num78;
53005 }
53006 }
53007 }
53008 spriteBatch.End();
53011 spriteBatch.End();
53013 if (num20 != -1)
53014 {
53015 TimeSpan timeSpan = DateTime.Now - player[num20].lastDeathTime;
53017 }
53018 else
53019 {
53020 revengeMarker?.UseMouseOver(spriteBatch, ref text);
53021 }
53022 }
53023 }
53024 if (mapFullscreen)
53025 {
53026 int num89 = (int)((0f - num + (float)mouseX) / num5 + num7);
53027 int num90 = (int)((0f - num2 + (float)mouseY) / num5 + num8);
53028 bool flag2 = false;
53029 if ((float)num89 < num7)
53030 {
53031 flag2 = true;
53032 }
53033 if ((float)num89 >= num9)
53034 {
53035 flag2 = true;
53036 }
53037 if ((float)num90 < num8)
53038 {
53039 flag2 = true;
53040 }
53041 if ((float)num90 >= num10)
53042 {
53043 flag2 = true;
53044 }
53045 if (!flag2 && Map[num89, num90].Light > 40)
53046 {
53047 int type = Map[num89, num90].Type;
53048 int num91 = MapHelper.tileLookup[21];
53049 int num92 = MapHelper.tileLookup[441];
53051 int num94 = MapHelper.tileLookup[467];
53052 int num95 = MapHelper.tileLookup[468];
53053 int num96 = MapHelper.tileOptionCounts[467];
53054 int num97 = MapHelper.tileLookup[88];
53056 LocalizedText[] chestType = Lang.chestType;
53057 LocalizedText[] chestType2 = Lang.chestType2;
53058 if (type >= num91 && type < num91 + num93)
53059 {
53061 if (tile != null)
53062 {
53063 int num99 = num89;
53064 int num100 = num90;
53065 if (tile.frameX % 36 != 0)
53066 {
53067 num99--;
53068 }
53069 if (tile.frameY % 36 != 0)
53070 {
53071 num100--;
53072 }
53073 text = DrawMap_FindChestName(chestType, tile, num99, num100);
53074 }
53075 }
53076 else if (type >= num94 && type < num94 + num96)
53077 {
53079 if (tile2 != null)
53080 {
53081 int num101 = num89;
53082 int num102 = num90;
53083 if (tile2.frameX % 36 != 0)
53084 {
53085 num101--;
53086 }
53087 if (tile2.frameY % 36 != 0)
53088 {
53089 num102--;
53090 }
53091 text = DrawMap_FindChestName(chestType2, tile2, num101, num102);
53092 }
53093 }
53094 else if (type >= num92 && type < num92 + num93)
53095 {
53097 if (tile3 != null)
53098 {
53099 int num103 = num89;
53100 int num104 = num90;
53101 if (tile3.frameX % 36 != 0)
53102 {
53103 num103--;
53104 }
53105 if (tile3.frameY % 36 != 0)
53106 {
53107 num104--;
53108 }
53109 text = chestType[tile3.frameX / 36].Value;
53110 }
53111 }
53112 else if (type >= num95 && type < num95 + num96)
53113 {
53115 if (tile4 != null)
53116 {
53117 int num105 = num89;
53118 int num106 = num90;
53119 if (tile4.frameX % 36 != 0)
53120 {
53121 num105--;
53122 }
53123 if (tile4.frameY % 36 != 0)
53124 {
53125 num106--;
53126 }
53127 text = chestType2[tile4.frameX / 36].Value;
53128 }
53129 }
53130 else if (type >= num97 && type < num97 + num98)
53131 {
53133 if (tile5 != null)
53134 {
53135 int num107 = num90;
53136 int x = num89 - tile5.frameX % 54 / 18;
53137 if (tile5.frameY % 36 != 0)
53138 {
53139 num107--;
53140 }
53141 int num108 = Chest.FindChest(x, num107);
53142 text = ((num108 < 0) ? Lang.dresserType[0].Value : ((!(chest[num108].name != "")) ? Lang.dresserType[tile5.frameX / 54].Value : (Lang.dresserType[tile5.frameX / 54].Value + ": " + chest[num108].name)));
53143 }
53144 }
53145 else
53146 {
53148 }
53149 }
53150 float num109 = (num5 * 0.25f * 2f + 1f) / 3f;
53151 if (num109 > 1f)
53152 {
53153 num109 = 1f;
53154 }
53155 num109 = 1f;
53156 num109 = UIScale;
53157 revengeMarker = NPC.RevengeManager.DrawMapIcons(spriteBatch, Vector2.Zero, new Vector2(num - 10f * num5, num2 - 10f * num5), null, num5, num109, ref text);
53158 DrawMiscMapIcons(spriteBatch, Vector2.Zero, new Vector2(num - 10f * num5, num2 - 10f * num5), null, num5, num109, ref text);
53159 spriteBatch.End();
53161 for (int num110 = 0; num110 < 200; num110++)
53162 {
53163 if (npc[num110].active && npc[num110].townNPC)
53164 {
53166 if (headIndexSafe3 > 0)
53167 {
53169 if (npc[num110].direction > 0)
53170 {
53171 dir3 = SpriteEffects.FlipHorizontally;
53172 }
53173 float num111 = (npc[num110].position.X + (float)(npc[num110].width / 2)) / 16f * num5;
53174 float num112 = (npc[num110].position.Y + npc[num110].gfxOffY + (float)(npc[num110].height / 2)) / 16f * num5;
53175 num111 += num;
53176 num112 += num2;
53177 num111 -= 10f * num5;
53178 num112 -= 10f * num5;
53179 float num113 = num111 - (float)(TextureAssets.NpcHead[headIndexSafe3].Width() / 2) * num109;
53180 float num114 = num112 - (float)(TextureAssets.NpcHead[headIndexSafe3].Height() / 2) * num109;
53181 float num115 = num113 + (float)TextureAssets.NpcHead[headIndexSafe3].Width() * num109;
53182 float num116 = num114 + (float)TextureAssets.NpcHead[headIndexSafe3].Height() * num109;
53183 if ((float)mouseX >= num113 && (float)mouseX <= num115 && (float)mouseY >= num114 && (float)mouseY <= num116)
53184 {
53185 text = npc[num110].FullName;
53186 }
53188 }
53189 }
53190 if (!npc[num110].active || npc[num110].GetBossHeadTextureIndex() == -1)
53191 {
53192 continue;
53193 }
53194 float bossHeadRotation3 = npc[num110].GetBossHeadRotation();
53195 SpriteEffects bossHeadSpriteEffects3 = npc[num110].GetBossHeadSpriteEffects();
53196 Vector2 vector3 = npc[num110].Center + new Vector2(0f, npc[num110].gfxOffY);
53197 if (npc[num110].type == 134)
53198 {
53199 Vector2 center3 = npc[num110].Center;
53200 int num117 = 1;
53201 int num118 = (int)npc[num110].ai[0];
53202 while (num117 < 15 && npc[num118].active && npc[num118].type >= 134 && npc[num118].type <= 136)
53203 {
53204 num117++;
53205 center3 += npc[num118].Center;
53206 num118 = (int)npc[num118].ai[0];
53207 }
53208 center3 /= (float)num117;
53209 vector3 = center3;
53210 }
53211 int bossHeadTextureIndex3 = npc[num110].GetBossHeadTextureIndex();
53212 float num119 = vector3.X / 16f * num5;
53213 float num120 = vector3.Y / 16f * num5;
53214 num119 += num;
53215 num120 += num2;
53216 num119 -= 10f * num5;
53217 num120 -= 10f * num5;
53219 float num121 = num119 - (float)(TextureAssets.NpcHeadBoss[bossHeadTextureIndex3].Width() / 2) * num109;
53220 float num122 = num120 - (float)(TextureAssets.NpcHeadBoss[bossHeadTextureIndex3].Height() / 2) * num109;
53223 if ((float)mouseX >= num121 && (float)mouseX <= num123 && (float)mouseY >= num122 && (float)mouseY <= num124)
53224 {
53225 text = npc[num110].GivenOrTypeName;
53226 }
53227 }
53228 bool flag3 = false;
53229 spriteBatch.End();
53231 for (int num125 = 0; num125 < 255; num125++)
53232 {
53233 if (player[num125].active && ((!player[myPlayer].hostile && !player[num125].hostile) || (player[myPlayer].team == player[num125].team && player[num125].team != 0) || num125 == myPlayer) && player[num125].showLastDeath && DrawPlayerDeathMarker(num, num2, num5, num13, num14, num109, num125))
53234 {
53235 num20 = num125;
53236 }
53237 }
53238 if (num20 != -1)
53239 {
53240 TimeSpan timeSpan2 = DateTime.Now - player[num20].lastDeathTime;
53242 }
53243 else if (revengeMarker != null)
53244 {
53245 spriteBatch.End();
53247 revengeMarker.UseMouseOver(spriteBatch, ref text, num109);
53248 spriteBatch.End();
53250 }
53251 for (int num126 = 0; num126 < 255; num126++)
53252 {
53253 if (!player[num126].active || ((player[myPlayer].hostile || player[num126].hostile) && (player[myPlayer].team != player[num126].team || player[num126].team == 0) && num126 != myPlayer))
53254 {
53255 continue;
53256 }
53257 float num127 = ((player[num126].position.X + (float)(player[num126].width / 2)) / 16f - num13) * num5;
53258 float num128 = ((player[num126].position.Y + player[num126].gfxOffY + (float)(player[num126].height / 2)) / 16f - num14) * num5;
53259 num127 += num;
53260 num128 += num2;
53261 num127 -= 6f;
53262 num128 -= 2f;
53263 num128 -= 2f - num5 / 5f * 2f;
53264 num127 -= 10f * num5;
53265 num128 -= 10f * num5;
53266 float num129 = num127 + 4f - 14f * num109;
53267 float num130 = num128 + 2f - 14f * num109;
53268 float num131 = num129 + 28f * num109;
53269 float num132 = num130 + 28f * num109;
53270 if (player[num126].dead)
53271 {
53272 continue;
53273 }
53275 MapPlayerRenderer.DrawPlayerHead(Camera, player[num126], new Vector2(num127, num128), (float)(int)b / 255f, num109, playerHeadBordersColor3);
53276 if (!((float)mouseX >= num129) || !((float)mouseX <= num131) || !((float)mouseY >= num130) || !((float)mouseY <= num132))
53277 {
53278 continue;
53279 }
53280 text = player[num126].name;
53281 if (num126 != myPlayer && player[myPlayer].team > 0 && player[myPlayer].team == player[num126].team && netMode == 1 && player[myPlayer].HasUnityPotion() && !flag3 && !cancelWormHole)
53282 {
53283 flag3 = true;
53284 if (!unityMouseOver)
53285 {
53287 }
53288 unityMouseOver = true;
53291 text = Language.GetTextValue("Game.TeleportTo", player[num126].name);
53293 {
53294 mouseLeftRelease = false;
53295 mapFullscreen = false;
53296 player[myPlayer].UnityTeleport(player[num126].position);
53297 player[myPlayer].TakeUnityPotion();
53298 }
53299 }
53300 }
53301 cancelWormHole = false;
53302 MapIcons.Draw(Vector2.Zero, new Vector2(num - 10f * num5, num2 - 10f * num5), null, num5, num109, ref text);
53303 if (!flag3 && unityMouseOver)
53304 {
53305 unityMouseOver = false;
53306 }
53307 spriteBatch.End();
53310 int num133 = 10;
53311 int num134 = screenHeight - 40;
53312 if (showFrameRate)
53313 {
53314 num134 -= 15;
53315 }
53316 int num135 = 0;
53317 int num136 = 130;
53319 {
53320 num136 = 255;
53321 num135 += 4;
53322 player[myPlayer].mouseInterface = true;
53324 {
53326 mapFullscreen = false;
53327 }
53328 }
53331 }
53332 mouseX = num18;
53333 mouseY = num19;
53334 float t = 3f;
53335 Utils.Swap(ref t, ref inventoryScale);
53336 if (text != "")
53337 {
53338 MouseText(text, 0, 0);
53339 }
53340 Utils.Swap(ref t, ref inventoryScale);
53341 spriteBatch.End();
53342 try
53343 {
53344 if (num13 < num7)
53345 {
53346 num += (num13 - num7) * num5;
53347 }
53348 if (num14 < num8)
53349 {
53350 num2 += (num14 - num8) * num5;
53351 }
53353 {
53355 }
53356 }
53357 catch (Exception e3)
53358 {
53360 }
53361 spriteBatch.Begin();
53364 }
53365
53367 {
53369 int num = -1;
53371 if (tile[(int)(player[myPlayer].Center.X / 16f), (int)(player[myPlayer].Center.Y / 16f)] == null)
53372 {
53373 return;
53374 }
53375 int wall = tile[(int)(player[myPlayer].Center.X / 16f), (int)(player[myPlayer].Center.Y / 16f)].wall;
53376 if (screenPosition.Y > (float)((maxTilesY - 232) * 16))
53377 {
53378 num = 2;
53379 }
53380 else if (player[myPlayer].ZoneDungeon)
53381 {
53382 num = 4;
53383 }
53384 else if (wall == 87)
53385 {
53386 num = 13;
53387 }
53388 else if ((double)screenPosition.Y > worldSurface * 16.0)
53389 {
53390 switch (wall)
53391 {
53392 case 86:
53393 case 108:
53394 num = 15;
53395 break;
53396 case 180:
53397 case 184:
53398 num = 16;
53399 break;
53400 case 178:
53401 case 183:
53402 num = 17;
53403 break;
53404 case 62:
53405 case 263:
53406 num = 18;
53407 break;
53408 default:
53409 num = ((!player[myPlayer].ZoneGlowshroom) ? ((!player[myPlayer].ZoneCorrupt) ? ((!player[myPlayer].ZoneCrimson) ? ((!player[myPlayer].ZoneHallow) ? ((!player[myPlayer].ZoneSnow) ? ((!player[myPlayer].ZoneJungle) ? ((!player[myPlayer].ZoneDesert) ? ((!player[myPlayer].ZoneRockLayerHeight) ? 1 : 31) : 14) : 12) : 3) : ((!player[myPlayer].ZoneDesert) ? ((!player[myPlayer].ZoneSnow) ? 21 : 35) : 41)) : ((!player[myPlayer].ZoneDesert) ? ((!player[myPlayer].ZoneSnow) ? 23 : 34) : 40)) : ((!player[myPlayer].ZoneDesert) ? ((!player[myPlayer].ZoneSnow) ? 22 : 33) : 39)) : 20);
53410 break;
53411 }
53412 }
53413 else if (player[myPlayer].ZoneGlowshroom)
53414 {
53415 num = 19;
53416 }
53417 else
53418 {
53419 color = ColorOfTheSkies;
53420 int num2 = (int)((screenPosition.X + (float)(screenWidth / 2)) / 16f);
53421 if (player[myPlayer].ZoneSkyHeight)
53422 {
53423 num = 32;
53424 }
53425 else if (player[myPlayer].ZoneCorrupt)
53426 {
53427 num = ((!player[myPlayer].ZoneDesert) ? 5 : 36);
53428 }
53429 else if (player[myPlayer].ZoneCrimson)
53430 {
53431 num = ((!player[myPlayer].ZoneDesert) ? 6 : 37);
53432 }
53433 else if (player[myPlayer].ZoneHallow)
53434 {
53435 num = ((!player[myPlayer].ZoneDesert) ? 7 : 38);
53436 }
53437 else if ((double)(screenPosition.Y / 16f) < worldSurface + 10.0 && (num2 < 380 || num2 > maxTilesX - 380))
53438 {
53439 num = 10;
53440 }
53441 else if (player[myPlayer].ZoneSnow)
53442 {
53443 num = 11;
53444 }
53445 else if (player[myPlayer].ZoneJungle)
53446 {
53447 num = 8;
53448 }
53449 else if (player[myPlayer].ZoneDesert)
53450 {
53451 num = 9;
53452 }
53453 else if (bloodMoon)
53454 {
53455 color *= 2f;
53456 num = 25;
53457 }
53458 else if (player[myPlayer].ZoneGraveyard)
53459 {
53460 num = 26;
53461 }
53462 }
53463 if (num > -1)
53464 {
53465 val = TextureAssets.MapBGs[num];
53466 }
53467 spriteBatch.Draw(val.Value, new Microsoft.Xna.Framework.Rectangle(0, 0, screenWidth, screenHeight), color);
53468 }
53469
53470 private static bool DrawPlayerDeathMarker(float X, float Y, float scale, float left, float top, float headScale, int i)
53471 {
53472 float num = (player[i].lastDeathPostion.X / 16f - left) * scale;
53473 float num2 = (player[i].lastDeathPostion.Y / 16f - top) * scale;
53474 num += X;
53475 num2 += Y;
53476 num2 -= 2f - scale / 5f * 2f;
53477 num -= 10f * scale;
53478 num2 -= 10f * scale;
53479 spriteBatch.Draw(TextureAssets.MapDeath.Value, new Vector2(num, num2), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.MapDeath.Width(), TextureAssets.MapDeath.Height()), Microsoft.Xna.Framework.Color.White, 0f, new Vector2((float)TextureAssets.MapDeath.Width() * 0.5f, (float)TextureAssets.MapDeath.Height() * 0.5f), headScale, SpriteEffects.None, 0f);
53480 float num3 = num + 4f - 14f * headScale;
53481 float num4 = num2 + 2f - 14f * headScale;
53482 float num5 = num3 + 28f * headScale;
53483 float num6 = num4 + 28f * headScale;
53484 if ((float)mouseX >= num3 && (float)mouseX <= num5 && (float)mouseY >= num4)
53485 {
53486 return (float)mouseY <= num6;
53487 }
53488 return false;
53489 }
53490
53497
53499 {
53500 Vector2? potionOfReturnOriginalUsePosition = LocalPlayer.PotionOfReturnOriginalUsePosition;
53502 {
53503 return;
53504 }
53505 Vector2 vec = (potionOfReturnOriginalUsePosition + new Vector2(0f, -LocalPlayer.height / 2)).Value / 16f - mapTopLeft;
53506 vec *= mapScale;
53507 vec += mapX2Y2AndOff;
53508 vec = vec.Floor();
53509 if (!mapRect.HasValue || mapRect.Value.Contains(vec.ToPoint()))
53510 {
53511 Texture2D value = TextureAssets.Extra[173].Value;
53514 if (Utils.CenteredRectangle(vec, rectangle.Size() * drawScale).Contains(MouseScreen.ToPoint()))
53515 {
53516 mouseTextString = Language.GetTextValue("GameUI.PotionOfReturnExitPortal");
53517 _ = MouseScreen + new Vector2(-28f) + new Vector2(4f, 0f);
53518 }
53519 }
53520 }
53521
53523 {
53524 Vector2? potionOfReturnHomePosition = LocalPlayer.PotionOfReturnHomePosition;
53525 if (!potionOfReturnHomePosition.HasValue)
53526 {
53527 return;
53528 }
53529 Vector2 vec = (potionOfReturnHomePosition + new Vector2(0f, -LocalPlayer.height / 2)).Value / 16f - mapTopLeft;
53530 vec *= mapScale;
53531 vec += mapX2Y2AndOff;
53532 vec = vec.Floor();
53533 if (!mapRect.HasValue || mapRect.Value.Contains(vec.ToPoint()))
53534 {
53535 Texture2D value = TextureAssets.Extra[175].Value;
53538 if (Utils.CenteredRectangle(vec, rectangle.Size() * drawScale).Contains(MouseScreen.ToPoint()))
53539 {
53540 mouseTextString = Language.GetTextValue("GameUI.PotionOfReturnHomePortal");
53541 _ = MouseScreen + new Vector2(-28f) + new Vector2(4f, 0f);
53542 }
53543 }
53544 }
53545
53547 {
53548 Projectile lastHitBall = LocalGolfState.GetLastHitBall();
53549 if (lastHitBall == null)
53550 {
53551 return;
53552 }
53553 Vector2 vec = lastHitBall.Center / 16f - mapTopLeft;
53554 vec *= mapScale;
53555 vec += mapX2Y2AndOff;
53556 vec = vec.Floor();
53557 if (!mapRect.HasValue || mapRect.Value.Contains(vec.ToPoint()))
53558 {
53559 Texture2D value = TextureAssets.Extra[176].Value;
53565 rectangle = value.Frame();
53567 if (rectangle2.Contains(MouseScreen.ToPoint()))
53568 {
53570 _ = MouseScreen + new Vector2(-28f) + new Vector2(4f, 0f);
53571 }
53572 }
53573 }
53574
53575 public static void TriggerPing(Vector2 position)
53576 {
53577 if (!dedServ)
53578 {
53579 Pings.Add(position);
53580 if (netMode == 1)
53581 {
53582 NetManager.Instance.SendToServer(NetPingModule.Serialize(position));
53583 }
53584 }
53585 }
53586
53587 private static void DrawNPCHeadFriendly(Entity theNPC, byte alpha, float headScale, SpriteEffects dir, int townHeadId, float x, float y)
53588 {
53589 TownNPCHeadRenderer.DrawWithOutlines(theNPC, townHeadId, new Vector2(x, y), new Microsoft.Xna.Framework.Color(alpha, alpha, alpha, alpha), 0f, headScale, dir);
53590 }
53591
53592 private static void DrawNPCHeadBoss(Entity theNPC, byte alpha, float headScale, float rotation, SpriteEffects effects, int bossHeadId, float x, float y)
53593 {
53594 BossNPCHeadRenderer.DrawWithOutlines(theNPC, bossHeadId, new Vector2(x, y), new Microsoft.Xna.Framework.Color(alpha, alpha, alpha, alpha), rotation, headScale, effects);
53595 }
53596
53597 private static void DrawWithOutlines(Entity entity, Texture2D tex, Vector2 position, Microsoft.Xna.Framework.Rectangle? rect, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects)
53598 {
53599 float num = 2f * scale;
53602 DrawData value = new DrawData(tex, position, rect, color, rotation, origin, scale, effects);
53605 black *= (float)(int)color.A / 255f;
53606 black *= (float)(int)color.A / 255f;
53608 color2 *= (float)(int)color.A / 255f;
53609 color2 *= (float)(int)color.A / 255f;
53610 int num2 = 2;
53612 for (int i = -num2; i <= num2; i++)
53613 {
53614 for (int j = -num2; j <= num2; j++)
53615 {
53616 if (Math.Abs(i) + Math.Abs(j) == num2)
53617 {
53618 vector = new Vector2((float)i * num, (float)j * num).RotatedBy(rotation);
53619 spriteBatch.Draw(tex, position + vector, rect, black, rotation, origin, scale, effects, 0f);
53620 }
53621 }
53622 }
53623 num2 = 1;
53625 for (int k = -num2; k <= num2; k++)
53626 {
53627 for (int l = -num2; l <= num2; l++)
53628 {
53629 if (Math.Abs(k) + Math.Abs(l) == num2)
53630 {
53631 vector = new Vector2((float)k * num, (float)l * num).RotatedBy(rotation);
53632 spriteBatch.Draw(tex, position + vector, rect, color2, rotation, origin, scale, effects, 0f);
53633 }
53634 }
53635 }
53636 pixelShader.CurrentTechnique.Passes[0].Apply();
53637 spriteBatch.Draw(tex, position, rect, color, rotation, origin, scale, effects, 0f);
53638 }
53639
53641 {
53642 if (plr.ghost || plr.dead)
53643 {
53645 }
53646 if (plr.whoAmI == myPlayer)
53647 {
53648 return teamColor[plr.team];
53649 }
53650 if (plr.hostile && (plr.team != LocalPlayer.team || plr.team == 0))
53651 {
53653 }
53654 return teamColor[plr.team];
53655 }
53656
53657 private static string DrawMap_FindChestName(LocalizedText[] chestNames, Tile chestTile, int x, int y, int fullTileWidth = 36)
53658 {
53659 int num = Chest.FindChestByGuessing(x, y);
53660 if (num < 0)
53661 {
53662 return chestNames[0].Value;
53663 }
53664 if (chest[num].name != "")
53665 {
53666 return string.Concat(chestNames[chestTile.frameX / fullTileWidth], ": ", chest[num].name);
53667 }
53668 return chestNames[chestTile.frameX / fullTileWidth].Value;
53669 }
53670
53672 {
53673 float num = (float)(worldSurface + 1.0) * 16f;
53674 float num2 = Math.Min(areaPosition.Y + (float)areaHeight, num) - areaPosition.Y;
53675 float y = areaPosition.Y;
53676 float num3 = areaPosition.Y + num2;
53677 Vector4 vector = ColorOfTheSkies.ToVector4();
53678 Vector4 value = new Microsoft.Xna.Framework.Color(53, 43, 243).ToVector4() * vector;
53679 Vector4 value2 = new Microsoft.Xna.Framework.Color(132, 170, 248).ToVector4() * vector;
53682 VertexColors colors = default(VertexColors);
53683 colors.TopLeftColor = color;
53684 colors.TopRightColor = color;
53685 colors.BottomLeftColor = color2;
53686 colors.BottomRightColor = color2;
53687 tileBatch.Draw(TextureAssets.BlackTile.Value, new Vector4(0f, 0f, areaWidth, num2), colors);
53688 float num4 = (float)areaHeight - num2;
53689 if (num4 > 0f)
53690 {
53691 colors.TopLeftColor = Microsoft.Xna.Framework.Color.Black;
53692 colors.TopRightColor = Microsoft.Xna.Framework.Color.Black;
53693 colors.BottomLeftColor = Microsoft.Xna.Framework.Color.Black;
53694 colors.BottomRightColor = Microsoft.Xna.Framework.Color.Black;
53696 }
53697 }
53698
53700 {
53701 float[] array = bgAlphaFrontLayer;
53702 bgAlphaFrontLayer = new float[array.Length];
53703 float[] array2 = bgAlphaFarBackLayer;
53704 bgAlphaFarBackLayer = new float[array2.Length];
53707 float[] array3 = liquidAlpha.ToArray();
53709 SceneMetrics.HolyTileCount = ((settings.Biome.BackgroundIndex == 6) ? SceneMetrics.HallowTileMax : 0);
53710 int num = offScreenRange;
53711 offScreenRange = 0;
53713 GameViewMatrix = new SpriteViewMatrix(base.GraphicsDevice);
53715 bool captureEntities = settings.CaptureEntities;
53716 bool captureBackground = settings.CaptureBackground;
53717 CaptureBiome biome = settings.Biome;
53719 int num2 = screenWidth;
53720 int num3 = screenHeight;
53721 float num4 = cloudAlpha;
53722 bool captureMech = settings.CaptureMech;
53723 screenWidth = area.Width << 4;
53724 screenHeight = area.Height << 4;
53725 screenPosition = new Vector2(area.X * 16, area.Y * 16);
53726 cloudAlpha = 0f;
53727 for (int i = 0; i <= 10; i++)
53728 {
53729 if (i != 1)
53730 {
53731 liquidAlpha[i] = ((i == biome.WaterStyle) ? 1f : 0f);
53732 }
53733 }
53734 int x = area.X;
53735 int y = area.Y;
53736 int num5 = area.X + screenWidth / 16;
53737 int num6 = area.Y + screenHeight / 16;
53738 float num7 = (biome.TileColor == CaptureBiome.TileColorStyle.Mushroom).ToInt();
53740 info.isInGameMenuOrIsServer = gameMenu || netMode == 2;
53741 info.CorruptionBiomeInfluence = (biome.TileColor == CaptureBiome.TileColorStyle.Corrupt).ToInt();
53742 info.CrimsonBiomeInfluence = (biome.TileColor == CaptureBiome.TileColorStyle.Crimson).ToInt();
53743 info.JungleBiomeInfluence = (biome.TileColor == CaptureBiome.TileColorStyle.Jungle).ToInt();
53744 info.MushroomBiomeInfluence = num7;
53745 info.GraveyardInfluence = GraveyardVisualIntensity;
53746 info.BloodMoonActive = biome.WaterStyle == 9;
53747 info.LanternNightActive = LanternNight.LanternsUp;
53751 bool flag = mapEnabled;
53752 mapEnabled = false;
53754 renderCount = 99;
53755 for (int j = 0; j < 4; j++)
53756 {
53757 Lighting.LightTiles(x, num5, y, num6);
53758 }
53759 mapEnabled = flag;
53760 if (!((float)(settings.Area.X * 16) > vector.X - 16f) || !((float)(settings.Area.Y * 16) > vector.Y - 16f) || !((float)((settings.Area.X + settings.Area.Width) * 16) < vector.X + (float)num2 + 16f) || !((float)((settings.Area.Y + settings.Area.Height) * 16) < vector.Y + (float)num3 + 16f))
53761 {
53762 for (int k = 0; k < dust.Length; k++)
53763 {
53764 if (dust[k].active && dust[k].type == 76)
53765 {
53766 dust[k].active = false;
53767 }
53768 }
53769 }
53771 int val = (int)((screenPosition.X - vector2.X) / 16f - 1f);
53772 int val2 = (int)((screenPosition.X + (float)screenWidth + vector2.X) / 16f) + 2;
53773 int val3 = (int)((screenPosition.Y - vector2.Y) / 16f - 1f);
53774 int val4 = (int)((screenPosition.Y + (float)screenHeight + vector2.Y) / 16f) + 5;
53776 val = Math.Max(val, 5) - 2;
53777 val3 = Math.Max(val3, 5);
53778 val2 = Math.Min(val2, maxTilesX - 5) + 2;
53779 val4 = Math.Min(val4, maxTilesY - 5) + 4;
53781 LiquidRenderer.Instance.PrepareDraw(drawArea);
53783 SceneArea sceneArea = default(SceneArea);
53785 {
53786 Matrix transform = Transform;
53787 int num8 = screenHeight;
53788 int num9 = screenWidth;
53790 bool flag2 = mapFullscreen;
53791 mapFullscreen = false;
53792 float num10 = scAdj;
53794 Vector2 vector5 = new Vector2(settings.Area.Width * 16, settings.Area.Height * 16) / vector4;
53795 vector5.X = Math.Max(1f, vector5.X);
53796 vector5.Y = Math.Max(1f, vector5.Y);
53798 for (int l = 0; l < numClouds; l++)
53799 {
53800 array4[l] = cloud[l].position;
53801 cloud[l].position *= vector5;
53802 }
53803 if ((float)(settings.Area.Height * 16) >= 2000f || (float)(settings.Area.Width * 16) >= 2000f)
53804 {
53805 scAdj = 0f;
53806 float num11 = 2048f;
53807 float num12 = MathHelper.Clamp((float)settings.Area.Height * 16f / num11, 1f, 3f);
53808 screenWidth = settings.Area.Width * 16;
53809 screenHeight = Math.Min(2048, settings.Area.Height * 16);
53810 screenPosition.X = settings.Area.X * 16;
53811 screenPosition.Y = settings.Area.Y * 16;
53812 screenPosition.Y += Math.Max(0f, Math.Min(settings.Area.Height, (float)worldSurface) * 16f - num11 * num12);
53813 transform *= Matrix.CreateScale(num12);
53814 transform.Translation += new Vector3((settings.Area.X - area.X) * 16, (settings.Area.Y - area.Y) * 16, 0f);
53815 transform.Translation += new Vector3(0f, Math.Max(0f, Math.Min(settings.Area.Height, (float)worldSurface) * 16f - num11 * num12) / num12, 0f);
53816 }
53817 else if ((float)(settings.Area.X * 16) > vector.X - 16f && (float)(settings.Area.Y * 16) > vector.Y - 16f && (float)((settings.Area.X + settings.Area.Width) * 16) < vector.X + (float)num2 + 16f && (float)((settings.Area.Y + settings.Area.Height) * 16) < vector.Y + (float)num3 + 16f)
53818 {
53820 screenWidth = num2;
53822 transform.Translation += new Vector3(vector.X - (float)area.X * 16f, vector.Y - (float)area.Y * 16f, 0f);
53823 }
53824 Vector2 areaPosition = new Vector2(area.X * 16, area.Y * 16);
53825 int areaWidth = area.Width * 16;
53826 int areaHeight = area.Height * 16;
53827 tileBatch.Begin();
53829 tileBatch.End();
53831 int num13 = screenWidth;
53832 int num14 = screenHeight;
53834 if (num13 < 800)
53835 {
53836 int num15 = 800 - num13;
53837 zero.X -= (float)num15 * 0.5f;
53838 num13 = 800;
53839 }
53840 if (num14 < 600)
53841 {
53842 int num16 = 600 - num14;
53843 zero.Y -= (float)num16 * 0.5f;
53844 num14 = 600;
53845 }
53846 SceneArea sceneArea2 = default(SceneArea);
53847 sceneArea2.bgTopY = 0;
53848 sceneArea2.totalWidth = num13;
53849 sceneArea2.totalHeight = num14;
53850 sceneArea2.SceneLocalScreenPositionOffset = zero;
53853 if (shimmerAlpha != 1f)
53854 {
53856 }
53857 if ((double)(screenPosition.Y / 16f) < worldSurface + 2.0)
53858 {
53860 }
53861 DrawSurfaceBG();
53862 spriteBatch.End();
53863 for (int m = 0; m < numClouds; m++)
53864 {
53865 cloud[m].position = array4[m];
53866 }
53867 scAdj = num10;
53869 screenWidth = num9;
53872 }
53874 {
53875 spriteBatch.Begin();
53877 spriteBatch.End();
53878 }
53879 if (captureEntities)
53880 {
53881 spriteBatch.Begin();
53882 CacheNPCDraws();
53884 DrawCachedNPCs(DrawCacheNPCsMoonMoon, behindTiles: true);
53885 spriteBatch.End();
53886 }
53887 if (shimmerAlpha > 0f && captureBackground)
53888 {
53889 spriteBatch.Begin();
53891 spriteBatch.End();
53892 }
53893 tileBatch.Begin();
53894 spriteBatch.Begin();
53895 DrawBlack(force: true);
53896 tileBatch.End();
53897 spriteBatch.End();
53898 tileBatch.Begin();
53899 spriteBatch.Begin();
53900 if (biome == null)
53901 {
53902 DrawLiquid(bg: true, waterStyle);
53903 }
53904 else
53905 {
53906 DrawLiquid(bg: true, bloodMoon ? 9 : biome.WaterStyle);
53907 }
53908 tileBatch.End();
53909 spriteBatch.End();
53910 if (shimmerAlpha > 0f && captureBackground)
53911 {
53912 spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, DefaultSamplerState, null, null, null);
53915 spriteBatch.End();
53917 }
53919 {
53920 tileBatch.Begin();
53921 spriteBatch.Begin();
53923 tileBatch.End();
53924 spriteBatch.End();
53925 }
53926 tileBatch.Begin();
53927 spriteBatch.Begin();
53928 DrawWalls();
53929 tileBatch.End();
53930 spriteBatch.End();
53931 if (captureEntities)
53932 {
53933 spriteBatch.Begin();
53934 DrawWoF();
53935 spriteBatch.End();
53936 }
53938 {
53939 spriteBatch.Begin();
53941 spriteBatch.End();
53942 drawBackGore = true;
53943 }
53944 if (captureEntities)
53945 {
53946 spriteBatch.Begin();
53949 spriteBatch.End();
53950 }
53951 bool flag3 = false;
53952 bool intoRenderTargets = false;
53953 bool intoRenderTargets2 = false;
53956 tileBatch.Begin();
53957 spriteBatch.Begin();
53959 int waterStyleOverride = (bloodMoon ? 9 : biome.WaterStyle);
53960 if (biome == null)
53961 {
53963 }
53964 else
53965 {
53967 }
53968 tileBatch.End();
53969 spriteBatch.End();
53971 if (captureEntities)
53972 {
53973 spriteBatch.Begin();
53974 tileBatch.Begin();
53977 tileBatch.End();
53978 spriteBatch.End();
53979 }
53980 if (captureEntities)
53981 {
53983 spriteBatch.Begin();
53984 DrawNPCs(behindTiles: true);
53985 spriteBatch.End();
53986 }
53988 tileBatch.Begin();
53989 spriteBatch.Begin();
53990 if (biome == null)
53991 {
53993 }
53994 else
53995 {
53997 }
53998 tileBatch.End();
53999 spriteBatch.End();
54001 if (captureEntities)
54002 {
54005 spriteBatch.Begin();
54006 DrawNPCs();
54007 spriteBatch.End();
54008 spriteBatch.Begin();
54009 DrawCachedNPCs(DrawCacheNPCProjectiles, behindTiles: false);
54010 spriteBatch.End();
54016 spriteBatch.Begin();
54017 DrawCachedNPCs(DrawCacheNPCsOverPlayers, behindTiles: false);
54018 spriteBatch.End();
54019 spriteBatch.Begin();
54020 DrawItems();
54021 spriteBatch.End();
54022 spriteBatch.Begin();
54023 DrawRain();
54024 spriteBatch.End();
54025 spriteBatch.Begin();
54026 DrawGore();
54027 spriteBatch.End();
54028 DrawDust();
54029 }
54030 tileBatch.Begin();
54031 spriteBatch.Begin();
54032 if (biome == null)
54033 {
54034 DrawLiquid(bg: false, waterStyle);
54035 }
54036 else
54037 {
54038 DrawLiquid(bg: false, biome.WaterStyle);
54039 }
54040 if (captureMech)
54041 {
54042 DrawWires();
54043 }
54044 tileBatch.End();
54045 spriteBatch.End();
54047 if (mapEnabled)
54048 {
54049 spriteBatch.Begin();
54050 for (int n = area.X; n < area.X + area.Width; n++)
54051 {
54052 for (int num17 = area.Y; num17 < area.Y + area.Height; num17++)
54053 {
54054 if (!Map.IsRevealed(n, num17))
54055 {
54056 spriteBatch.Draw(TextureAssets.BlackTile.Value, new Vector2((float)n * 16f, (float)num17 * 16f) - screenPosition, Microsoft.Xna.Framework.Color.Black);
54057 }
54058 }
54059 }
54060 spriteBatch.End();
54061 }
54062 renderCount = 99;
54063 screenWidth = num2;
54067 offScreenRange = num;
54068 cloudAlpha = num4;
54071 SceneMetrics.HolyTileCount = holyTileCount;
54074 }
54075
54076 protected void RenderTiles()
54077 {
54078 if (drawToScreen)
54079 {
54080 return;
54081 }
54082 RenderBlack();
54083 base.GraphicsDevice.SetRenderTarget(tileTarget);
54085 spriteBatch.Begin();
54086 tileBatch.Begin();
54087 try
54088 {
54091 }
54092 catch (Exception e)
54093 {
54094 if (!ignoreErrors)
54095 {
54096 throw;
54097 }
54099 }
54101 tileBatch.End();
54102 spriteBatch.End();
54105 base.GraphicsDevice.SetRenderTarget(null);
54106 }
54107
54108 protected void RenderTiles2()
54109 {
54110 if (drawToScreen)
54111 {
54112 return;
54113 }
54114 base.GraphicsDevice.SetRenderTarget(tile2Target);
54116 spriteBatch.Begin();
54117 tileBatch.Begin();
54118 try
54119 {
54122 }
54123 catch (Exception e)
54124 {
54125 if (!ignoreErrors)
54126 {
54127 throw;
54128 }
54130 }
54132 tileBatch.End();
54133 spriteBatch.End();
54136 base.GraphicsDevice.SetRenderTarget(null);
54137 }
54138
54139 protected void RenderWater()
54140 {
54141 if (!drawToScreen)
54142 {
54143 base.GraphicsDevice.SetRenderTarget(waterTarget);
54145 spriteBatch.Begin();
54146 try
54147 {
54148 DrawWaters();
54149 }
54150 catch
54151 {
54152 }
54154 spriteBatch.End();
54156 base.GraphicsDevice.SetRenderTarget(null);
54157 }
54158 }
54159
54160 public static int CalculateWaterStyle(bool ignoreFountains = false)
54161 {
54163 {
54165 }
54166 if (bloodMoon && !dayTime)
54167 {
54168 return 9;
54169 }
54170 switch (bgStyle)
54171 {
54172 case 1:
54173 return 2;
54174 case 5:
54176 {
54177 return 2;
54178 }
54180 {
54181 return 4;
54182 }
54183 return 10;
54184 case 3:
54185 return 3;
54186 case 8:
54187 return 10;
54188 case 6:
54189 return 4;
54190 case 7:
54191 return 5;
54192 case 2:
54193 if (remixWorld)
54194 {
54195 return 6;
54196 }
54197 if ((double)(player[myPlayer].position.Y / 16f) > worldSurface)
54198 {
54199 return 12;
54200 }
54201 return 6;
54202 case 4:
54203 return 13;
54204 default:
54205 if (remixWorld)
54206 {
54207 if ((double)(screenPosition.Y / 16f) > rockLayer)
54208 {
54209 return 7;
54210 }
54211 if ((double)(screenPosition.Y / 16f) > worldSurface)
54212 {
54213 return 8;
54214 }
54215 }
54216 else
54217 {
54218 if ((double)(screenPosition.Y / 16f) > rockLayer + 40.0)
54219 {
54220 if (player[myPlayer].ZoneGlowshroom)
54221 {
54222 return 7;
54223 }
54224 return 8;
54225 }
54226 if ((double)(screenPosition.Y / 16f) > worldSurface)
54227 {
54228 return 7;
54229 }
54230 }
54231 return 0;
54232 }
54233 }
54234
54235 public static bool IsLiquidStyleWater(int liquidStyle)
54236 {
54237 if (liquidStyle != 1)
54238 {
54239 return liquidStyle != 11;
54240 }
54241 return false;
54242 }
54243
54244 private void DrawWaters(bool isBackground = false)
54245 {
54246 drewLava = false;
54247 if (!isBackground)
54248 {
54250 for (int i = 0; i < 15; i++)
54251 {
54253 {
54254 if (waterStyle != i)
54255 {
54256 liquidAlpha[i] = Math.Max(liquidAlpha[i] - 0.2f, 0f);
54257 }
54258 else
54259 {
54260 liquidAlpha[i] = Math.Min(liquidAlpha[i] + 0.2f, 1f);
54261 }
54262 }
54263 }
54264 }
54265 if (!drawToScreen && !isBackground)
54266 {
54268 int val = (int)((Camera.ScaledPosition.X - vector.X) / 16f - 1f);
54269 int val2 = (int)((Camera.ScaledPosition.X + Camera.ScaledSize.X + vector.X) / 16f) + 2;
54270 int val3 = (int)((Camera.ScaledPosition.Y - vector.Y) / 16f - 1f);
54271 int val4 = (int)((Camera.ScaledPosition.Y + Camera.ScaledSize.Y + vector.Y) / 16f) + 5;
54272 val = Math.Max(val, 5) - 2;
54273 val3 = Math.Max(val3, 5);
54274 val2 = Math.Min(val2, maxTilesX - 5) + 2;
54275 val4 = Math.Min(val4, maxTilesY - 5) + 4;
54277 LiquidRenderer.Instance.PrepareDraw(drawArea);
54278 }
54279 bool flag = false;
54280 for (int j = 0; j < 15; j++)
54281 {
54282 if (IsLiquidStyleWater(j) && liquidAlpha[j] > 0f && j != waterStyle)
54283 {
54285 flag = true;
54286 }
54287 }
54289 }
54290
54291 protected void DrawLiquid(bool bg = false, int waterStyle = 0, float Alpha = 1f, bool drawSinglePassLiquids = true)
54292 {
54293 if (!Lighting.NotRetro)
54294 {
54296 return;
54297 }
54299 stopwatch.Start();
54301 if (bg)
54302 {
54304 }
54307 {
54309 }
54310 if (!bg)
54311 {
54312 TimeLogger.DrawTime(4, stopwatch.Elapsed.TotalMilliseconds);
54313 }
54314 }
54315
54316 public static void DrawTileInWater(Vector2 drawOffset, int x, int y)
54317 {
54318 if (Main.tile[x, y] != null && Main.tile[x, y].active() && Main.tile[x, y].type == 518)
54319 {
54320 instance.LoadTiles(Main.tile[x, y].type);
54321 Tile tile = Main.tile[x, y];
54322 int num = tile.liquid / 16;
54323 num -= 3;
54324 if (WorldGen.SolidTile(x, y - 1) && num > 8)
54325 {
54326 num = 8;
54327 }
54329 spriteBatch.Draw(TextureAssets.Tile[tile.type].Value, new Vector2(x * 16, y * 16 - num) + drawOffset, value, Lighting.GetColor(x, y), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
54330 }
54331 }
54332
54333 public void oldDrawWater(bool bg = false, int Style = 0, float Alpha = 1f)
54334 {
54335 float num = 0f;
54336 float num2 = 99999f;
54337 float num3 = 99999f;
54338 int num4 = -1;
54339 int num5 = -1;
54341 if (drawToScreen)
54342 {
54344 }
54345 _ = new Microsoft.Xna.Framework.Color[4];
54346 int num6 = (int)(255f * (1f - gfxQuality) + 40f * gfxQuality);
54347 _ = gfxQuality;
54348 _ = gfxQuality;
54349 int num7 = (int)((screenPosition.X - vector.X) / 16f - 1f);
54350 int num8 = (int)((screenPosition.X + (float)screenWidth + vector.X) / 16f) + 2;
54351 int num9 = (int)((screenPosition.Y - vector.Y) / 16f - 1f);
54352 int num10 = (int)((screenPosition.Y + (float)screenHeight + vector.Y) / 16f) + 5;
54353 if (num7 < 5)
54354 {
54355 num7 = 5;
54356 }
54357 if (num8 > maxTilesX - 5)
54358 {
54359 num8 = maxTilesX - 5;
54360 }
54361 if (num9 < 5)
54362 {
54363 num9 = 5;
54364 }
54365 if (num10 > maxTilesY - 5)
54366 {
54367 num10 = maxTilesY - 5;
54368 }
54369 for (int i = num9; i < num10 + 4; i++)
54370 {
54371 for (int j = num7 - 2; j < num8 + 2; j++)
54372 {
54373 if (tile[j, i] == null)
54374 {
54375 tile[j, i] = new Tile();
54376 }
54377 if (tile[j, i].liquid <= 0 || (tile[j, i].nactive() && tileSolid[tile[j, i].type] && !tileSolidTop[tile[j, i].type]) || !(Lighting.Brightness(j, i) > 0f || bg))
54378 {
54379 continue;
54380 }
54382 float num11 = 256 - tile[j, i].liquid;
54383 num11 /= 32f;
54384 bool flag = false;
54385 int num12 = 0;
54386 if (tile[j, i].lava())
54387 {
54388 if (drewLava)
54389 {
54390 continue;
54391 }
54392 float num13 = Math.Abs((float)(j * 16 + 8) - (screenPosition.X + (float)(screenWidth / 2)));
54393 float num14 = Math.Abs((float)(i * 16 + 8) - (screenPosition.Y + (float)(screenHeight / 2)));
54394 if (num13 < (float)(screenWidth * 2) && num14 < (float)(screenHeight * 2))
54395 {
54396 float num15 = (float)Math.Sqrt(num13 * num13 + num14 * num14);
54397 float num16 = 1f - num15 / ((float)screenWidth * 0.75f);
54398 if (num16 > 0f)
54399 {
54400 num += num16;
54401 }
54402 }
54403 if (num13 < num2)
54404 {
54405 num2 = num13;
54406 num4 = j * 16 + 8;
54407 }
54408 if (num14 < num3)
54409 {
54410 num3 = num13;
54411 num5 = i * 16 + 8;
54412 }
54413 num12 = 1;
54414 }
54415 else if (tile[j, i].honey())
54416 {
54417 num12 = 11;
54418 }
54419 else if (tile[j, i].shimmer())
54420 {
54421 num12 = 14;
54422 flag = true;
54423 }
54424 if (num12 == 0)
54425 {
54426 num12 = Style;
54427 }
54428 if ((num12 == 1 || num12 == 11) && drewLava)
54429 {
54430 continue;
54431 }
54432 float num17 = 0.5f;
54433 if (bg)
54434 {
54435 num17 = 1f;
54436 }
54437 if (num12 != 1 && num12 != 11)
54438 {
54439 num17 *= Alpha;
54440 }
54442 Vector2 vector2 = new Vector2(j * 16, i * 16 + (int)num11 * 2);
54444 bool flag2 = true;
54445 if (tile[j, i + 1].liquid < 245 && (!tile[j, i + 1].nactive() || !tileSolid[tile[j, i + 1].type] || tileSolidTop[tile[j, i + 1].type]))
54446 {
54447 float num18 = 256 - tile[j, i + 1].liquid;
54448 num18 /= 32f;
54449 num17 = 0.5f * (8f - num11) / 4f;
54450 if ((double)num17 > 0.55)
54451 {
54452 num17 = 0.55f;
54453 }
54454 if ((double)num17 < 0.35)
54455 {
54456 num17 = 0.35f;
54457 }
54458 float num19 = num11 / 2f;
54459 if (tile[j, i + 1].liquid < 200)
54460 {
54461 if (bg)
54462 {
54463 continue;
54464 }
54465 if (tile[j, i - 1].liquid > 0 && tile[j, i - 1].liquid > 0)
54466 {
54467 value = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16);
54468 num17 = 0.5f;
54469 }
54470 else if (tile[j, i - 1].liquid > 0)
54471 {
54472 vector2 = new Vector2(j * 16, i * 16 + 4);
54473 value = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 12);
54474 num17 = 0.5f;
54475 }
54476 else if (tile[j, i + 1].liquid > 0)
54477 {
54478 vector2 = new Vector2(j * 16, i * 16 + (int)num11 * 2 + (int)num18 * 2);
54479 value = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16 - (int)num11 * 2);
54480 }
54481 else
54482 {
54483 vector2 = new Vector2(j * 16 + (int)num19, i * 16 + (int)num19 * 2 + (int)num18 * 2);
54484 value = new Microsoft.Xna.Framework.Rectangle(0, 4, 16 - (int)num19 * 2, 16 - (int)num19 * 2);
54485 }
54486 }
54487 else
54488 {
54489 num17 = 0.5f;
54490 value = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16 - (int)num11 * 2 + (int)num18 * 2);
54491 }
54492 }
54493 else if (tile[j, i - 1].liquid > 32)
54494 {
54495 value = new Microsoft.Xna.Framework.Rectangle(0, 4, value.Width, value.Height);
54496 }
54497 else if (num11 < 1f && tile[j, i - 1].nactive() && tileSolid[tile[j, i - 1].type] && !tileSolidTop[tile[j, i - 1].type])
54498 {
54499 vector2 = new Vector2(j * 16, i * 16);
54500 value = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16);
54501 }
54502 else
54503 {
54504 for (int k = i + 1; k < i + 6 && (!tile[j, k].nactive() || !tileSolid[tile[j, k].type] || tileSolidTop[tile[j, k].type]); k++)
54505 {
54506 if (tile[j, k].liquid < 200)
54507 {
54508 flag2 = false;
54509 break;
54510 }
54511 }
54512 if (!flag2)
54513 {
54514 num17 = 0.5f;
54515 value = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16);
54516 }
54517 else if (tile[j, i - 1].liquid > 0)
54518 {
54519 value = new Microsoft.Xna.Framework.Rectangle(0, 2, value.Width, value.Height);
54520 }
54521 }
54522 if ((color.R > 20 || color.B > 20 || color.G > 20) && value.Y < 4)
54523 {
54524 int num20 = color.R;
54525 if (color.G > num20)
54526 {
54527 num20 = color.G;
54528 }
54529 if (color.B > num20)
54530 {
54531 num20 = color.B;
54532 }
54533 num20 /= 30;
54534 if (rand.Next(20000) < num20)
54535 {
54537 if (tile[j, i].honey())
54538 {
54539 newColor = new Microsoft.Xna.Framework.Color(255, 255, 50);
54540 }
54541 int num21 = Dust.NewDust(new Vector2(j * 16, vector2.Y - 2f), 16, 8, 43, 0f, 0f, 254, newColor, 0.75f);
54542 dust[num21].velocity *= 0f;
54543 }
54544 }
54545 if (tile[j, i].honey())
54546 {
54547 num17 *= 1.6f;
54548 if (num17 > 1f)
54549 {
54550 num17 = 1f;
54551 }
54552 }
54553 if (tile[j, i].lava())
54554 {
54555 num17 *= 1.8f;
54556 if (num17 > 1f)
54557 {
54558 num17 = 1f;
54559 }
54560 if (base.IsActive && !gamePaused && Dust.lavaBubbles < 200)
54561 {
54562 if (tile[j, i].liquid > 200 && rand.Next(700) == 0)
54563 {
54564 Dust.NewDust(new Vector2(j * 16, i * 16), 16, 16, 35);
54565 }
54566 if (value.Y == 0 && rand.Next(350) == 0)
54567 {
54568 int num22 = Dust.NewDust(new Vector2(j * 16, (float)(i * 16) + num11 * 2f - 8f), 16, 8, 35, 0f, 0f, 50, default(Microsoft.Xna.Framework.Color), 1.5f);
54569 dust[num22].velocity *= 0.8f;
54570 dust[num22].velocity.X *= 2f;
54571 dust[num22].velocity.Y -= (float)rand.Next(1, 7) * 0.1f;
54572 if (rand.Next(10) == 0)
54573 {
54574 dust[num22].velocity.Y *= rand.Next(2, 5);
54575 }
54576 dust[num22].noGravity = true;
54577 }
54578 }
54579 }
54580 float num23 = (float)(int)color.R * num17;
54581 float num24 = (float)(int)color.G * num17;
54582 float num25 = (float)(int)color.B * num17;
54583 float num26 = (float)(int)color.A * num17;
54584 color = new Microsoft.Xna.Framework.Color((byte)num23, (byte)num24, (byte)num25, (byte)num26);
54585 if (flag)
54586 {
54588 }
54589 if (Lighting.NotRetro && !bg)
54590 {
54592 if (num12 != 1 && ((double)(int)color2.R > (double)num6 * 0.6 || (double)(int)color2.G > (double)num6 * 0.65 || (double)(int)color2.B > (double)num6 * 0.7))
54593 {
54594 for (int l = 0; l < 4; l++)
54595 {
54596 int num27 = 0;
54597 int num28 = 0;
54598 int width = 8;
54599 int height = 8;
54602 if (l == 0)
54603 {
54604 color4 = Lighting.GetColor(j - 1, i - 1);
54605 if (value.Height < 8)
54606 {
54607 height = value.Height;
54608 }
54609 }
54610 if (l == 1)
54611 {
54612 color4 = Lighting.GetColor(j + 1, i - 1);
54613 num27 = 8;
54614 if (value.Height < 8)
54615 {
54616 height = value.Height;
54617 }
54618 }
54619 if (l == 2)
54620 {
54621 color4 = Lighting.GetColor(j - 1, i + 1);
54622 num28 = 8;
54623 height = 8 - (16 - value.Height);
54624 }
54625 if (l == 3)
54626 {
54627 color4 = Lighting.GetColor(j + 1, i + 1);
54628 num27 = 8;
54629 num28 = 8;
54630 height = 8 - (16 - value.Height);
54631 }
54632 num23 = (float)(int)color4.R * num17;
54633 num24 = (float)(int)color4.G * num17;
54634 num25 = (float)(int)color4.B * num17;
54635 num26 = (float)(int)color4.A * num17;
54636 color4 = new Microsoft.Xna.Framework.Color((byte)num23, (byte)num24, (byte)num25, (byte)num26);
54637 color3.R = (byte)((color2.R * 3 + color4.R * 2) / 5);
54638 color3.G = (byte)((color2.G * 3 + color4.G * 2) / 5);
54639 color3.B = (byte)((color2.B * 3 + color4.B * 2) / 5);
54640 color3.A = (byte)((color2.A * 3 + color4.A * 2) / 5);
54641 if (flag)
54642 {
54644 }
54645 spriteBatch.Draw(TextureAssets.Liquid[num12].Value, vector2 - screenPosition + new Vector2(num27, num28) + vector, new Microsoft.Xna.Framework.Rectangle(value.X + num27, value.Y + num28, width, height), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
54646 if (flag)
54647 {
54649 }
54650 }
54651 }
54652 else
54653 {
54654 spriteBatch.Draw(TextureAssets.Liquid[num12].Value, vector2 - screenPosition + vector, value, color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
54655 if (flag)
54656 {
54657 value.Y += 36;
54659 }
54660 }
54661 }
54662 else
54663 {
54664 if (value.Y < 4)
54665 {
54666 value.X += (int)(wFrame * 18f);
54667 }
54668 spriteBatch.Draw(TextureAssets.Liquid[num12].Value, vector2 - screenPosition + vector, value, color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
54669 if (flag)
54670 {
54671 value.Y += 36;
54673 }
54674 }
54675 if (!tile[j, i + 1].halfBrick())
54676 {
54677 continue;
54678 }
54679 color = Lighting.GetColor(j, i + 1);
54680 num23 = (float)(int)color.R * num17;
54681 num24 = (float)(int)color.G * num17;
54682 num25 = (float)(int)color.B * num17;
54683 num26 = (float)(int)color.A * num17;
54684 color = new Microsoft.Xna.Framework.Color((byte)num23, (byte)num24, (byte)num25, (byte)num26);
54685 if (flag)
54686 {
54688 }
54689 vector2 = new Vector2(j * 16, i * 16 + 16);
54690 spriteBatch.Draw(TextureAssets.Liquid[num12].Value, vector2 - screenPosition + vector, new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 8), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
54691 if (flag)
54692 {
54694 }
54695 float num29 = 6f;
54696 float num30 = 0.75f;
54697 if (num12 == 1 || num12 == 11)
54698 {
54699 num29 = 4f;
54700 num30 = 0.5f;
54701 }
54702 for (int m = 0; (float)m < num29; m++)
54703 {
54704 int num31 = i + 2 + m;
54705 if (WorldGen.SolidTile(j, num31))
54706 {
54707 break;
54708 }
54709 float num32 = 1f - (float)m / num29;
54710 num32 *= num30;
54711 vector2 = new Vector2(j * 16, num31 * 16 - 2);
54712 spriteBatch.Draw(TextureAssets.Liquid[num12].Value, vector2 - screenPosition + vector, new Microsoft.Xna.Framework.Rectangle(0, 18, 16, 16), color * num32, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
54713 if (flag)
54714 {
54716 }
54717 }
54718 }
54719 }
54720 if (!drewLava)
54721 {
54724 ambientLavaStrength = num;
54725 }
54726 drewLava = true;
54727 }
54728
54729 protected bool FullTile(int x, int y)
54730 {
54731 if (Main.tile[x - 1, y] == null || Main.tile[x - 1, y].blockType() != 0 || Main.tile[x + 1, y] == null || Main.tile[x + 1, y].blockType() != 0)
54732 {
54733 return false;
54734 }
54735 Tile tile = Main.tile[x, y];
54736 if (tile == null)
54737 {
54738 return false;
54739 }
54740 if (tile.active())
54741 {
54742 if (tile.type < TileID.Sets.DrawsWalls.Length && TileID.Sets.DrawsWalls[tile.type])
54743 {
54744 return false;
54745 }
54746 if (tileSolid[tile.type] && !tileSolidTop[tile.type])
54747 {
54748 int frameX = tile.frameX;
54749 int frameY = tile.frameY;
54750 if (tileLargeFrames[tile.type] > 0)
54751 {
54752 if (frameY == 18 || frameY == 108)
54753 {
54754 if (frameX >= 18 && frameX <= 54)
54755 {
54756 return true;
54757 }
54758 if (frameX >= 108 && frameX <= 144)
54759 {
54760 return true;
54761 }
54762 }
54763 }
54764 else if (frameY == 18)
54765 {
54766 if (frameX >= 18 && frameX <= 54)
54767 {
54768 return true;
54769 }
54770 if (frameX >= 108 && frameX <= 144)
54771 {
54772 return true;
54773 }
54774 }
54775 else if (frameY >= 90 && frameY <= 196)
54776 {
54777 if (frameX <= 70)
54778 {
54779 return true;
54780 }
54781 if (frameX >= 144 && frameX <= 232)
54782 {
54783 return true;
54784 }
54785 }
54786 }
54787 }
54788 return false;
54789 }
54790
54791 protected void DrawBlack(bool force = false)
54792 {
54793 if (shimmerAlpha == 1f)
54794 {
54795 return;
54796 }
54798 stopwatch.Start();
54800 int num = (tileColor.R + tileColor.G + tileColor.B) / 3;
54801 float num2 = (float)((double)num * 0.4) / 255f;
54802 if (Lighting.Mode == LightMode.Retro)
54803 {
54804 num2 = (float)(tileColor.R - 55) / 255f;
54805 if (num2 < 0f)
54806 {
54807 num2 = 0f;
54808 }
54809 }
54810 else if (Lighting.Mode == LightMode.Trippy)
54811 {
54812 num2 = (float)(num - 55) / 255f;
54813 if (num2 < 0f)
54814 {
54815 num2 = 0f;
54816 }
54817 }
54820 int num3 = (int)((screenPosition.X - vector.X) / 16f - 1f) + point.X;
54821 int num4 = (int)((screenPosition.X + (float)screenWidth + vector.X) / 16f) + 2 - point.X;
54822 int num5 = (int)((screenPosition.Y - vector.Y) / 16f - 1f) + point.Y;
54823 int num6 = (int)((screenPosition.Y + (float)screenHeight + vector.Y) / 16f) + 5 - point.Y;
54824 if (num3 < 0)
54825 {
54826 num3 = point.X;
54827 }
54828 if (num4 > maxTilesX)
54829 {
54830 num4 = maxTilesX - point.X;
54831 }
54832 if (num5 < 0)
54833 {
54834 num5 = point.Y;
54835 }
54836 if (num6 > maxTilesY)
54837 {
54838 num6 = maxTilesY - point.Y;
54839 }
54840 if (!force)
54841 {
54842 if (num5 < maxTilesY / 2)
54843 {
54844 num6 = Math.Min(num6, (int)worldSurface + 1);
54845 num5 = Math.Min(num5, (int)worldSurface + 1);
54846 }
54847 else
54848 {
54851 }
54852 }
54853 bool flag = ShouldShowInvisibleWalls();
54854 for (int i = num5; i < num6; i++)
54855 {
54856 bool flag2 = i >= UnderworldLayer;
54857 if (flag2)
54858 {
54859 num2 = 0.2f;
54860 }
54861 for (int j = num3; j < num4; j++)
54862 {
54863 int num7 = j;
54864 for (; j < num4; j++)
54865 {
54866 if (!WorldGen.InWorld(j, i))
54867 {
54868 return;
54869 }
54870 if (Main.tile[j, i] == null)
54871 {
54872 Main.tile[j, i] = new Tile();
54873 }
54874 Tile tile = Main.tile[j, i];
54875 float num8 = Lighting.Brightness(j, i);
54876 num8 = (float)Math.Floor(num8 * 255f) / 255f;
54877 byte b = tile.liquid;
54878 bool num9 = num8 <= num2 && ((!flag2 && b < 250) || WorldGen.SolidTile(tile) || (b >= 200 && num8 == 0f));
54879 bool flag3 = tile.active() && tileBlockLight[tile.type] && (!tile.invisibleBlock() || flag);
54880 bool flag4 = !WallID.Sets.Transparent[tile.wall] && (!tile.invisibleWall() || flag);
54881 if (!num9 || (!flag4 && !flag3) || (!drawToScreen && LiquidRenderer.Instance.HasFullWater(j, i) && tile.wall == 0 && !tile.halfBrick() && !((double)i <= worldSurface)))
54882 {
54883 break;
54884 }
54885 }
54886 if (j - num7 > 0)
54887 {
54889 }
54890 }
54891 }
54892 TimeLogger.DrawTime(5, stopwatch.Elapsed.TotalMilliseconds);
54893 }
54894
54895 public static bool ShouldShowInvisibleWalls()
54896 {
54898 {
54899 return LocalPlayer.CanSeeInvisibleBlocks;
54900 }
54901 return true;
54902 }
54903
54904 protected void RenderBlack()
54905 {
54906 if (!drawToScreen)
54907 {
54908 base.GraphicsDevice.SetRenderTarget(blackTarget);
54909 base.GraphicsDevice.DepthStencilState = new DepthStencilState
54910 {
54911 DepthBufferEnable = true
54912 };
54914 spriteBatch.Begin();
54915 DrawBlack();
54917 spriteBatch.End();
54919 base.GraphicsDevice.SetRenderTarget(null);
54920 }
54921 }
54922
54923 protected void DrawWalls()
54924 {
54926 }
54927
54928 protected void RenderWalls()
54929 {
54930 if (drawToScreen)
54931 {
54932 return;
54933 }
54934 base.GraphicsDevice.SetRenderTarget(wallTarget);
54935 base.GraphicsDevice.DepthStencilState = new DepthStencilState
54936 {
54937 DepthBufferEnable = true
54938 };
54941 tileBatch.Begin();
54942 if (ignoreErrors)
54943 {
54944 try
54945 {
54946 DrawWalls();
54947 }
54948 catch (Exception e)
54949 {
54951 }
54952 }
54953 else
54954 {
54955 DrawWalls();
54956 }
54958 tileBatch.End();
54959 spriteBatch.End();
54961 base.GraphicsDevice.SetRenderTarget(null);
54962 }
54963
54964 protected void ReleaseTargets()
54965 {
54966 try
54967 {
54968 if (!dedServ)
54969 {
54970 offScreenRange = 0;
54971 targetSet = false;
54972 if (waterTarget != null)
54973 {
54974 waterTarget.Dispose();
54975 }
54976 if (backWaterTarget != null)
54977 {
54979 }
54980 if (blackTarget != null)
54981 {
54983 }
54984 if (tileTarget != null)
54985 {
54987 }
54988 if (tile2Target != null)
54989 {
54991 }
54992 if (wallTarget != null)
54993 {
54995 }
54996 if (screenTarget != null)
54997 {
54998 screenTarget.Dispose();
54999 }
55000 if (screenTargetSwap != null)
55001 {
55002 screenTargetSwap.Dispose();
55003 }
55004 if (backgroundTarget != null)
55005 {
55007 }
55008 if (Main.OnRenderTargetsReleased != null)
55009 {
55011 }
55012 }
55013 }
55014 catch
55015 {
55016 }
55017 }
55018
55019 protected bool checkMap(int i, int j)
55020 {
55021 if (mapTarget[i, j] == null || mapTarget[i, j].IsDisposed)
55022 {
55023 initMap[i, j] = false;
55024 }
55025 if (!initMap[i, j])
55026 {
55027 try
55028 {
55029 int width = textureMaxWidth;
55030 int height = textureMaxHeight;
55031 if (i == mapTargetX - 1)
55032 {
55033 width = 400;
55034 }
55035 if (j == mapTargetY - 1)
55036 {
55037 height = 600;
55038 }
55039 mapTarget[i, j] = new RenderTarget2D(base.GraphicsDevice, width, height, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
55040 }
55041 catch
55042 {
55043 mapEnabled = false;
55044 for (int k = 0; k < mapTargetX; k++)
55045 {
55046 for (int l = 0; l < mapTargetY; l++)
55047 {
55048 try
55049 {
55050 initMap[k, l] = false;
55051 mapTarget[k, l].Dispose();
55052 }
55053 catch
55054 {
55055 }
55056 }
55057 }
55058 return false;
55059 }
55060 initMap[i, j] = true;
55061 }
55062 return true;
55063 }
55064
55065 protected void InitMap()
55066 {
55067 int num = mapTargetX;
55068 int num2 = mapTargetY;
55069 if (!mapEnabled)
55070 {
55071 return;
55072 }
55073 try
55074 {
55075 for (int i = 0; i < num; i++)
55076 {
55077 for (int j = 0; j < num2; j++)
55078 {
55079 mapTarget[i, j] = new RenderTarget2D(base.GraphicsDevice, textureMaxWidth, textureMaxHeight, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
55080 }
55081 }
55082 mapInit = true;
55083 }
55084 catch
55085 {
55086 mapEnabled = false;
55087 for (int k = 0; k < num; k++)
55088 {
55089 for (int l = 0; l < num2; l++)
55090 {
55091 try
55092 {
55093 if (mapTarget[k, l] != null)
55094 {
55095 mapTarget[k, l].Dispose();
55096 }
55097 }
55098 catch
55099 {
55100 }
55101 }
55102 }
55103 }
55104 }
55105
55106 protected void InitTargets()
55107 {
55109 {
55111 }
55112 InitTargets(base.GraphicsDevice.PresentationParameters.BackBufferWidth, base.GraphicsDevice.PresentationParameters.BackBufferHeight);
55113 }
55114
55116 {
55118 {
55119 InitTargets();
55120 }
55121 }
55122
55123 protected void InitTargets(int width, int height)
55124 {
55126 offScreenRange = 192;
55127 if (width + offScreenRange * 2 > _renderTargetMaxSize)
55128 {
55129 offScreenRange = (_renderTargetMaxSize - width) / 2;
55130 }
55131 width += offScreenRange * 2;
55132 height += offScreenRange * 2;
55133 try
55134 {
55135 if (!dedServ)
55136 {
55137 targetSet = true;
55138 waterTarget = new RenderTarget2D(base.GraphicsDevice, width, height, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55139 backWaterTarget = new RenderTarget2D(base.GraphicsDevice, width, height, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55140 blackTarget = new RenderTarget2D(base.GraphicsDevice, width, height, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55141 tileTarget = new RenderTarget2D(base.GraphicsDevice, width, height, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55142 tile2Target = new RenderTarget2D(base.GraphicsDevice, width, height, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55143 wallTarget = new RenderTarget2D(base.GraphicsDevice, width, height, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55144 backgroundTarget = new RenderTarget2D(base.GraphicsDevice, width, height, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55145 screenTarget = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth, base.GraphicsDevice.PresentationParameters.BackBufferHeight, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55146 screenTargetSwap = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth, base.GraphicsDevice.PresentationParameters.BackBufferHeight, mipMap: false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None);
55147 if (Main.OnRenderTargetsInitialized != null)
55148 {
55149 Main.OnRenderTargetsInitialized(base.GraphicsDevice.PresentationParameters.BackBufferWidth, base.GraphicsDevice.PresentationParameters.BackBufferHeight);
55150 }
55151 }
55152 }
55153 catch
55154 {
55155 Lighting.Mode = LightMode.Retro;
55156 mapEnabled = false;
55157 SaveSettings();
55158 try
55159 {
55161 }
55162 catch
55163 {
55164 }
55165 }
55166 }
55167
55168 protected void DrawWires()
55169 {
55173 bool flag = !WiresUI.Settings.HideWires;
55174 float num = 1f;
55176 {
55177 num = 0.5f;
55178 }
55179 int num2 = 1;
55180 int num3 = 1;
55181 int num4 = 1;
55182 int num5 = 1;
55183 int num6 = 1;
55184 if (player[myPlayer].InfoAccMechShowWires)
55185 {
55186 int[] builderAccStatus = player[myPlayer].builderAccStatus;
55187 num2 = builderAccStatus[4];
55188 num3 = builderAccStatus[5];
55189 num4 = builderAccStatus[6];
55190 num5 = builderAccStatus[7];
55191 num6 = builderAccStatus[9];
55192 }
55193 _ = gfxQuality;
55194 _ = gfxQuality;
55196 if (drawToScreen)
55197 {
55198 zero2 = Vector2.Zero;
55199 }
55200 int num7 = (int)((screenPosition.X - zero2.X) / 16f - 1f);
55201 int num8 = (int)((screenPosition.X + (float)screenWidth + zero2.X) / 16f) + 2;
55202 int num9 = (int)((screenPosition.Y - zero2.Y) / 16f - 1f);
55203 int num10 = (int)((screenPosition.Y + (float)screenHeight + zero2.Y) / 16f) + 5;
55204 if (num7 < 0)
55205 {
55206 num7 = 0;
55207 }
55208 if (num8 > maxTilesX)
55209 {
55210 num8 = maxTilesX;
55211 }
55212 if (num9 < 0)
55213 {
55214 num9 = 0;
55215 }
55216 if (num10 > maxTilesY)
55217 {
55218 num10 = maxTilesY;
55219 }
55221 for (int i = num9 + screenOverdrawOffset.Y; i < num10 - screenOverdrawOffset.Y; i++)
55222 {
55223 for (int j = num7 + screenOverdrawOffset.X; j < num8 - screenOverdrawOffset.X; j++)
55224 {
55225 bool flag2 = false;
55226 bool flag3 = false;
55227 bool flag4 = false;
55228 bool flag5 = false;
55229 bool flag6 = false;
55230 bool flag7 = false;
55231 bool flag8 = false;
55232 bool flag9 = false;
55233 bool flag10 = false;
55234 float num11 = 0f;
55235 Tile tile = Main.tile[j, i];
55236 if (flag && player[myPlayer].CanDoWireStuffHere(j, i))
55237 {
55238 int num12 = 0;
55239 if (tile.active())
55240 {
55241 if (tile.type == 424)
55242 {
55243 switch (tile.frameX / 18)
55244 {
55245 case 0:
55246 num12 += 72;
55247 break;
55248 case 1:
55249 num12 += 144;
55250 break;
55251 case 2:
55252 num12 += 216;
55253 break;
55254 }
55255 }
55256 else if (tile.type == 445)
55257 {
55258 num12 += 72;
55259 }
55260 }
55261 if (tile.wire())
55262 {
55263 num11 += 1f;
55264 int num13 = 0;
55265 if (Main.tile[j, i - 1].wire())
55266 {
55267 num13 += 18;
55268 flag4 = true;
55269 }
55270 if (Main.tile[j + 1, i].wire())
55271 {
55272 num13 += 36;
55273 flag3 = true;
55274 }
55275 if (Main.tile[j, i + 1].wire())
55276 {
55277 num13 += 72;
55278 flag5 = true;
55279 }
55280 if (Main.tile[j - 1, i].wire())
55281 {
55282 num13 += 144;
55283 flag2 = true;
55284 }
55285 value.Y = num12;
55286 value.X = num13;
55288 switch (num2)
55289 {
55290 case 0:
55292 break;
55293 case 2:
55294 color *= 0.5f;
55295 break;
55296 case 3:
55298 break;
55299 }
55301 {
55302 num11 -= 1f;
55303 }
55304 else
55305 {
55306 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, value, color, 0f, zero, 1f, SpriteEffects.None, 0f);
55307 }
55308 }
55309 if (tile.wire2())
55310 {
55311 flag6 = (flag7 = (flag8 = (flag9 = (flag10 = false))));
55312 num11 += 1f;
55313 int num14 = 0;
55314 if (Main.tile[j, i - 1].wire2())
55315 {
55316 num14 += 18;
55317 flag8 = true;
55318 if (flag4)
55319 {
55320 flag10 = true;
55321 }
55322 }
55323 if (Main.tile[j + 1, i].wire2())
55324 {
55325 num14 += 36;
55326 flag7 = true;
55327 if (flag3)
55328 {
55329 flag10 = true;
55330 }
55331 }
55332 if (Main.tile[j, i + 1].wire2())
55333 {
55334 num14 += 72;
55335 flag9 = true;
55336 if (flag5)
55337 {
55338 flag10 = true;
55339 }
55340 }
55341 if (Main.tile[j - 1, i].wire2())
55342 {
55343 num14 += 144;
55344 flag6 = true;
55345 if (flag2)
55346 {
55347 flag10 = true;
55348 }
55349 }
55350 if (num11 > 1f)
55351 {
55352 flag10 = true;
55353 }
55354 value.Y = num12 + 18;
55355 value.X = num14;
55357 switch (num3)
55358 {
55359 case 0:
55361 break;
55362 case 2:
55363 color2 *= 0.5f;
55364 break;
55365 case 3:
55367 break;
55368 }
55370 {
55371 num11 -= 1f;
55372 }
55373 else
55374 {
55375 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, value, color2 * (1f / num11), 0f, zero, 1f, SpriteEffects.None, 0f);
55376 if (flag8)
55377 {
55378 if (flag10 && !flag4)
55379 {
55380 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, new Microsoft.Xna.Framework.Rectangle(18, value.Y, 16, 6), color2, 0f, zero, 1f, SpriteEffects.None, 0f);
55381 }
55382 flag4 = true;
55383 }
55384 if (flag9)
55385 {
55386 if (flag10 && !flag5)
55387 {
55388 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2 + new Vector2(0f, 10f), new Microsoft.Xna.Framework.Rectangle(72, value.Y + 10, 16, 6), color2, 0f, zero, 1f, SpriteEffects.None, 0f);
55389 }
55390 flag5 = true;
55391 }
55392 if (flag7)
55393 {
55394 if (flag10 && !flag3)
55395 {
55396 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2 + new Vector2(10f, 0f), new Microsoft.Xna.Framework.Rectangle(46, value.Y, 6, 16), color2, 0f, zero, 1f, SpriteEffects.None, 0f);
55397 }
55398 flag3 = true;
55399 }
55400 if (flag6)
55401 {
55402 if (flag10 && !flag2)
55403 {
55404 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, new Microsoft.Xna.Framework.Rectangle(144, value.Y, 6, 16), color2, 0f, zero, 1f, SpriteEffects.None, 0f);
55405 }
55406 flag2 = true;
55407 }
55408 }
55409 }
55410 if (tile.wire3())
55411 {
55412 flag6 = (flag7 = (flag8 = (flag9 = (flag10 = false))));
55413 num11 += 1f;
55414 int num15 = 0;
55415 if (Main.tile[j, i - 1].wire3())
55416 {
55417 num15 += 18;
55418 flag8 = true;
55419 if (flag4)
55420 {
55421 flag10 = true;
55422 }
55423 }
55424 if (Main.tile[j + 1, i].wire3())
55425 {
55426 num15 += 36;
55427 flag7 = true;
55428 if (flag3)
55429 {
55430 flag10 = true;
55431 }
55432 }
55433 if (Main.tile[j, i + 1].wire3())
55434 {
55435 num15 += 72;
55436 flag9 = true;
55437 if (flag5)
55438 {
55439 flag10 = true;
55440 }
55441 }
55442 if (Main.tile[j - 1, i].wire3())
55443 {
55444 num15 += 144;
55445 flag6 = true;
55446 if (flag2)
55447 {
55448 flag10 = true;
55449 }
55450 }
55451 if (num11 > 1f)
55452 {
55453 flag10 = true;
55454 }
55455 value.Y = num12 + 36;
55456 value.X = num15;
55458 switch (num4)
55459 {
55460 case 0:
55462 break;
55463 case 2:
55464 color3 *= 0.5f;
55465 break;
55466 case 3:
55468 break;
55469 }
55471 {
55472 num11 -= 1f;
55473 }
55474 else
55475 {
55476 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, value, color3 * (1f / num11), 0f, zero, 1f, SpriteEffects.None, 0f);
55477 if (flag8)
55478 {
55479 if (flag10 && !flag4)
55480 {
55481 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, new Microsoft.Xna.Framework.Rectangle(18, value.Y, 16, 6), color3, 0f, zero, 1f, SpriteEffects.None, 0f);
55482 }
55483 flag4 = true;
55484 }
55485 if (flag9)
55486 {
55487 if (flag10 && !flag5)
55488 {
55489 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2 + new Vector2(0f, 10f), new Microsoft.Xna.Framework.Rectangle(72, value.Y + 10, 16, 6), color3, 0f, zero, 1f, SpriteEffects.None, 0f);
55490 }
55491 flag5 = true;
55492 }
55493 if (flag7)
55494 {
55495 if (flag10 && !flag3)
55496 {
55497 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2 + new Vector2(10f, 0f), new Microsoft.Xna.Framework.Rectangle(46, value.Y, 6, 16), color3, 0f, zero, 1f, SpriteEffects.None, 0f);
55498 }
55499 flag3 = true;
55500 }
55501 if (flag6)
55502 {
55503 if (flag10 && !flag2)
55504 {
55505 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, new Microsoft.Xna.Framework.Rectangle(144, value.Y, 6, 16), color3, 0f, zero, 1f, SpriteEffects.None, 0f);
55506 }
55507 flag2 = true;
55508 }
55509 }
55510 }
55511 if (tile.wire4())
55512 {
55513 flag6 = (flag7 = (flag8 = (flag9 = (flag10 = false))));
55514 num11 += 1f;
55515 int num16 = 0;
55516 if (Main.tile[j, i - 1].wire4())
55517 {
55518 num16 += 18;
55519 flag8 = true;
55520 if (flag4)
55521 {
55522 flag10 = true;
55523 }
55524 }
55525 if (Main.tile[j + 1, i].wire4())
55526 {
55527 num16 += 36;
55528 flag7 = true;
55529 if (flag3)
55530 {
55531 flag10 = true;
55532 }
55533 }
55534 if (Main.tile[j, i + 1].wire4())
55535 {
55536 num16 += 72;
55537 flag9 = true;
55538 if (flag5)
55539 {
55540 flag10 = true;
55541 }
55542 }
55543 if (Main.tile[j - 1, i].wire4())
55544 {
55545 num16 += 144;
55546 flag6 = true;
55547 if (flag2)
55548 {
55549 flag10 = true;
55550 }
55551 }
55552 if (num11 > 1f)
55553 {
55554 flag10 = true;
55555 }
55556 value.Y = num12 + 54;
55557 value.X = num16;
55559 switch (num5)
55560 {
55561 case 0:
55563 break;
55564 case 2:
55565 color4 *= 0.5f;
55566 break;
55567 case 3:
55569 break;
55570 }
55572 {
55573 num11 -= 1f;
55574 }
55575 else
55576 {
55577 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, value, color4 * (1f / num11), 0f, zero, 1f, SpriteEffects.None, 0f);
55578 if (flag8)
55579 {
55580 if (flag10 && !flag4)
55581 {
55582 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, new Microsoft.Xna.Framework.Rectangle(18, value.Y, 16, 6), color4, 0f, zero, 1f, SpriteEffects.None, 0f);
55583 }
55584 flag4 = true;
55585 }
55586 if (flag9)
55587 {
55588 if (flag10 && !flag5)
55589 {
55590 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2 + new Vector2(0f, 10f), new Microsoft.Xna.Framework.Rectangle(72, value.Y + 10, 16, 6), color4, 0f, zero, 1f, SpriteEffects.None, 0f);
55591 }
55592 flag5 = true;
55593 }
55594 if (flag7)
55595 {
55596 if (flag10 && !flag3)
55597 {
55598 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2 + new Vector2(10f, 0f), new Microsoft.Xna.Framework.Rectangle(46, value.Y, 6, 16), color4, 0f, zero, 1f, SpriteEffects.None, 0f);
55599 }
55600 flag3 = true;
55601 }
55602 if (flag6)
55603 {
55604 if (flag10 && !flag2)
55605 {
55606 spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, new Microsoft.Xna.Framework.Rectangle(144, value.Y, 6, 16), color4, 0f, zero, 1f, SpriteEffects.None, 0f);
55607 }
55608 flag2 = true;
55609 }
55610 }
55611 }
55612 }
55613 if (Main.tile[j, i].actuator() && (Lighting.Brightness(j, i) > 0f || num6 == 0))
55614 {
55616 switch (num6)
55617 {
55618 case 0:
55620 break;
55621 case 2:
55622 color5 *= 0.5f;
55623 break;
55624 case 3:
55626 break;
55627 }
55628 spriteBatch.Draw(TextureAssets.Actuator.Value, new Vector2(j * 16 - (int)screenPosition.X, i * 16 - (int)screenPosition.Y) + zero2, new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Actuator.Width(), TextureAssets.Actuator.Height()), color5 * num, 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
55629 }
55630 if (tile.active())
55631 {
55632 ushort type = tile.type;
55633 if (type == 423 && tile.frameY == 36)
55634 {
55635 DrawWiresSpecialTiles.Add(Tuple.Create(j, i, tile.type));
55636 }
55637 }
55638 }
55639 }
55640 for (int k = 0; k < DrawWiresSpecialTiles.Count; k++)
55641 {
55643 ushort type = tuple.Item3;
55644 if (type == 423)
55645 {
55646 Vector2 start = new Vector2(tuple.Item1 * 16 - 32 - 1, tuple.Item2 * 16 - 160 - 1) + zero2;
55647 Vector2 end = new Vector2(tuple.Item1 * 16 + 48 + 1, tuple.Item2 * 16 + 1) + zero2;
55649 }
55650 }
55652 }
55653
55655 {
55656 if (paintIndexOnTile == 31)
55657 {
55658 return 0;
55659 }
55661 {
55662 return 43;
55663 }
55664 if (paintIndexOnTile >= 28)
55665 {
55666 return paintIndexOnTile + 12;
55667 }
55669 {
55670 return paintIndexOnTile + 27;
55671 }
55672 return paintIndexOnTile;
55673 }
55674
55675 public static void ResetWindCounter(bool resetExtreme = false)
55676 {
55678 windCounter = fastRandom.Next(900, 2701);
55679 if (resetExtreme)
55680 {
55681 extremeWindCounter = fastRandom.Next(10, 31);
55682 }
55683 }
55684
55685 public static void NewLightning()
55686 {
55688 {
55689 if (rand.Next(3) == 0)
55690 {
55691 thunderDelay = rand.Next(1, 31);
55692 }
55693 else if (rand.Next(2) == 0)
55694 {
55695 thunderDelay = rand.Next(31, 121);
55696 }
55697 else
55698 {
55699 thunderDelay = rand.Next(11, 61);
55700 }
55702 lightningDecay = rand.NextFloat() * 0.05f + 0.008f;
55703 lightningSpeed = rand.NextFloat() * 0.05f + 0.05f;
55704 }
55705 }
55706
55708 {
55709 if (netMode != 2 && currentDayRateIteration == 0)
55710 {
55711 bool flag = base.IsActive;
55712 if (thunderDelay > 0)
55713 {
55714 thunderDelay--;
55715 if (thunderDelay == 0)
55716 {
55717 Vector2 center = player[myPlayer].Center;
55718 float num = thunderDistance * 15;
55719 if (rand.Next(2) == 0)
55720 {
55721 num *= -1f;
55722 }
55723 center.X += num;
55724 int num2 = (int)(worldSurface * 16.0) - 500;
55725 if (center.Y > (float)num2)
55726 {
55727 center.Y = num2;
55728 }
55729 if (flag)
55730 {
55732 }
55733 }
55734 }
55735 if (lightningSpeed > 0f)
55736 {
55738 if (lightning >= 1f)
55739 {
55740 lightning = 1f;
55741 lightningSpeed = 0f;
55742 }
55745 }
55746 else if (lightning > 0f)
55747 {
55751 }
55752 else if (thunderDelay <= 0 && (double)player[myPlayer].position.Y < rockLayer * 16.0 && atmo == 1f && !remixWorld)
55753 {
55754 if (IsItStorming)
55755 {
55756 float num3 = 600f;
55757 float num4 = 1600f;
55758 if ((double)maxRaining > 0.8)
55759 {
55760 num3 *= 0.6f;
55761 num4 *= 0.8f;
55762 }
55763 if ((double)maxRaining > 0.7)
55764 {
55765 num3 *= 0.7f;
55766 num4 *= 0.9f;
55767 }
55768 if ((double)maxRaining > 0.6)
55769 {
55770 num3 *= 0.8f;
55771 num4 *= 0.95f;
55772 }
55773 if ((double)Math.Abs(windSpeedTarget) > 0.7)
55774 {
55775 num3 *= 0.6f;
55776 num4 *= 0.8f;
55777 }
55778 if ((double)Math.Abs(windSpeedTarget) > 0.6)
55779 {
55780 num3 *= 0.7f;
55781 num4 *= 0.9f;
55782 }
55783 if ((double)Math.Abs(windSpeedTarget) > 0.5)
55784 {
55785 num3 *= 0.8f;
55786 num4 *= 0.95f;
55787 }
55788 float num5 = rand.Next((int)num3, (int)num4);
55789 num5 *= (1f - maxRaining + 1f) / 2f;
55790 num5 *= (1f - windSpeedTarget + 1f) / 2f;
55791 if (rand.Next((int)num5) == 0)
55792 {
55793 NewLightning();
55794 }
55795 }
55796 else if ((double)GraveyardVisualIntensity >= 0.9)
55797 {
55798 int maxValue = 120;
55799 if (rand.Next(maxValue) == 0)
55800 {
55801 NewLightning();
55802 }
55803 }
55804 }
55805 }
55806 float num6 = 0.8f;
55807 float num7 = 0.0003f;
55808 float num8 = windSpeedTarget * (1f + 5f / 9f * maxRaining);
55809 num7 += Math.Abs(num8 - windSpeedCurrent) * 0.0015f;
55810 if (windSpeedCurrent < num8)
55811 {
55813 if (windSpeedCurrent > num8)
55814 {
55816 }
55817 }
55818 else if (windSpeedCurrent > num8)
55819 {
55821 if (windSpeedCurrent < num8)
55822 {
55824 }
55825 }
55826 if (netMode == 1 || (netMode != 2 && gameMenu))
55827 {
55828 return;
55829 }
55831 {
55833 {
55834 return;
55835 }
55836 windCounter--;
55837 if (windCounter <= 0)
55838 {
55839 float num9 = 1f;
55840 if (windSpeedTarget < 0f)
55841 {
55842 num9 = -1f;
55843 }
55844 if (rand.Next(4) == 0)
55845 {
55846 windSpeedTarget += (float)rand.Next(-25, 26) * 0.001f;
55847 }
55848 else if (rand.Next(2) == 0)
55849 {
55850 windSpeedTarget += (float)rand.Next(-50, 51) * 0.001f;
55851 }
55852 else
55853 {
55854 windSpeedTarget += (float)rand.Next(-100, 101) * 0.001f;
55855 }
55857 if (extremeWindCounter <= 0)
55858 {
55860 if (rand.Next(30) < 13)
55861 {
55862 if (rand.Next(2) == 0)
55863 {
55864 windSpeedTarget = 0f;
55865 windCounter = rand.Next(7200, 28801);
55866 }
55867 else
55868 {
55869 windSpeedTarget = (float)rand.Next(-200, 201) * 0.001f;
55870 }
55871 }
55872 else if (rand.Next(20) < 13)
55873 {
55874 windSpeedTarget = (float)rand.Next(-400, 401) * 0.001f;
55875 }
55876 else
55877 {
55878 windSpeedTarget = (float)rand.Next(-850, 851) * 0.001f;
55879 }
55880 if ((double)Math.Abs(windSpeedTarget) > 0.3)
55881 {
55882 extremeWindCounter += rand.Next(5, 11);
55883 }
55884 if ((double)Math.Abs(windSpeedTarget) > 0.5)
55885 {
55886 extremeWindCounter += rand.Next(10, 21);
55887 }
55888 if ((double)Math.Abs(windSpeedTarget) > 0.7)
55889 {
55890 extremeWindCounter += rand.Next(15, 31);
55891 }
55892 }
55893 else
55894 {
55896 }
55897 if (rand.Next(3) != 0 && ((num9 < 0f && windSpeedTarget > 0f) || (num9 > 0f && windSpeedTarget < 0f)))
55898 {
55899 windSpeedTarget *= -1f;
55900 }
55901 }
55902 if (windSpeedTarget > num6)
55903 {
55905 }
55906 if (windSpeedTarget < 0f - num6)
55907 {
55908 windSpeedTarget = 0f - num6;
55909 }
55910 }
55911 if (rand.Next(60) == 0)
55912 {
55913 numCloudsTemp += rand.Next(-1, 2);
55914 }
55915 if ((float)rand.Next(1000) < 50f * cloudBGAlpha)
55916 {
55917 numCloudsTemp++;
55918 }
55919 if ((float)rand.Next(1300) < 25f * (1f - cloudBGAlpha))
55920 {
55921 numCloudsTemp--;
55922 }
55923 if ((float)rand.Next(1000) < 200f * cloudAlpha && numCloudsTemp < 100)
55924 {
55925 numCloudsTemp++;
55926 }
55927 if ((float)rand.Next(1000) < 50f * cloudAlpha)
55928 {
55929 numCloudsTemp++;
55930 }
55931 if (numCloudsTemp > 66 && rand.Next(100) == 0)
55932 {
55933 numCloudsTemp -= rand.Next(1, 3);
55934 }
55935 if (numCloudsTemp < 50 && rand.Next(100) == 0)
55936 {
55937 numCloudsTemp += rand.Next(1, 3);
55938 }
55940 {
55941 numCloudsTemp = 100;
55942 }
55943 if (numCloudsTemp < -20)
55944 {
55945 numCloudsTemp = -20;
55946 }
55947 if (cloudAlpha > 0f && (float)numClouds < 200f * cloudAlpha)
55948 {
55949 while ((float)numClouds < 200f * cloudAlpha)
55950 {
55951 numClouds += rand.Next(30);
55952 if (numClouds > 200)
55953 {
55954 numClouds = 200;
55955 }
55957 {
55959 }
55960 }
55961 if (netMode == 2)
55962 {
55964 }
55965 }
55967 if (weatherCounter > 0)
55968 {
55969 return;
55970 }
55971 if (rand.Next(2) == 0)
55972 {
55973 if (rand.Next(2) == 0)
55974 {
55975 numCloudsTemp += rand.Next(250);
55976 }
55977 else
55978 {
55979 numCloudsTemp += rand.Next(100);
55980 }
55981 }
55982 if (numCloudsTemp < 0)
55983 {
55984 numCloudsTemp = 0;
55985 }
55986 if (numCloudsTemp > 200)
55987 {
55988 numCloudsTemp = 200;
55989 }
55991 weatherCounter = rand.Next(3600, 10800);
55992 if (netMode == 2)
55993 {
55995 }
55996 }
55997
55998 public void LoadBackground(int i)
55999 {
56000 //IL_000e: Unknown result type (might be due to invalid IL or missing references)
56001 if (i >= 0 && (int)TextureAssets.Background[i].State == 0)
56002 {
56006 switch (i)
56007 {
56008 case 219:
56009 case 220:
56010 case 221:
56011 case 235:
56012 case 271:
56013 case 272:
56014 case 273:
56015 case 281:
56016 backgroundWidth[i] /= 2;
56017 backgroundHeight[i] /= 2;
56018 break;
56019 }
56020 }
56021 }
56022
56023 public void LoadItem(int i)
56024 {
56025 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56026 if ((int)TextureAssets.Item[i].State == 0)
56027 {
56029 }
56030 }
56031
56032 public void LoadNPC(int i)
56033 {
56034 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56035 if ((int)TextureAssets.Npc[i].State == 0)
56036 {
56037 Assets.Request<Texture2D>(TextureAssets.Npc[i].Name, (AssetRequestMode)1);
56038 }
56039 }
56040
56041 public void LoadProjectile(int i)
56042 {
56043 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56044 if ((int)TextureAssets.Projectile[i].State == 0)
56045 {
56047 }
56048 }
56049
56050 public void LoadGore(int i)
56051 {
56052 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56053 if ((int)TextureAssets.Gore[i].State == 0)
56054 {
56056 }
56057 }
56058
56059 public void LoadWall(int i)
56060 {
56061 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56062 if ((int)TextureAssets.Wall[i].State == 0)
56063 {
56065 }
56066 }
56067
56068 public void LoadTiles(int i)
56069 {
56070 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56071 if ((int)TextureAssets.Tile[i].State == 0)
56072 {
56074 }
56075 }
56076
56077 public void LoadItemFlames(int i)
56078 {
56079 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56080 if ((int)TextureAssets.ItemFlame[i].State == 0)
56081 {
56082 try
56083 {
56085 }
56086 catch
56087 {
56088 }
56089 }
56090 }
56091
56092 public void LoadWings(int i)
56093 {
56094 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56095 if ((int)TextureAssets.Wings[i].State == 0)
56096 {
56098 }
56099 }
56100
56101 public void LoadHair(int i)
56102 {
56103 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56104 if ((int)TextureAssets.PlayerHair[i].State == 0)
56105 {
56108 }
56109 }
56110
56111 public void LoadArmorHead(int i)
56112 {
56113 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56114 if ((int)TextureAssets.ArmorHead[i].State == 0)
56115 {
56117 }
56118 }
56119
56120 public void LoadArmorBody(int i)
56121 {
56122 //IL_0037: Unknown result type (might be due to invalid IL or missing references)
56123 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
56125 {
56126 if ((int)TextureAssets.ArmorBodyComposite[i].State == 0)
56127 {
56129 }
56130 }
56131 else if ((int)TextureAssets.ArmorBody[i].State == 0)
56132 {
56136 }
56137 }
56138
56139 public void LoadArmorLegs(int i)
56140 {
56141 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56142 if ((int)TextureAssets.ArmorLeg[i].State == 0)
56143 {
56145 }
56146 }
56147
56148 public void LoadAccHandsOn(int i)
56149 {
56150 //IL_0020: Unknown result type (might be due to invalid IL or missing references)
56151 //IL_004f: Unknown result type (might be due to invalid IL or missing references)
56152 bool flag = !ArmorIDs.HandOn.Sets.UsesNewFramingCode[i];
56154 {
56155 flag = true;
56156 }
56157 if (flag && (int)TextureAssets.AccHandsOn[i].State == 0)
56158 {
56160 }
56162 {
56164 }
56165 }
56166
56167 public void LoadAccHandsOff(int i)
56168 {
56169 //IL_0010: Unknown result type (might be due to invalid IL or missing references)
56170 //IL_003f: Unknown result type (might be due to invalid IL or missing references)
56172 {
56174 }
56176 {
56178 }
56179 }
56180
56181 public void LoadAccBack(int i)
56182 {
56183 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56184 if ((int)TextureAssets.AccBack[i].State == 0)
56185 {
56187 }
56188 }
56189
56190 public void LoadAccFront(int i)
56191 {
56192 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56193 if ((int)TextureAssets.AccFront[i].State == 0)
56194 {
56196 }
56197 }
56198
56199 public void LoadAccShoes(int i)
56200 {
56201 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56202 if ((int)TextureAssets.AccShoes[i].State == 0)
56203 {
56205 }
56206 }
56207
56208 public void LoadAccWaist(int i)
56209 {
56210 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56211 if ((int)TextureAssets.AccWaist[i].State == 0)
56212 {
56214 }
56215 }
56216
56217 public void LoadAccShield(int i)
56218 {
56219 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56220 if ((int)TextureAssets.AccShield[i].State == 0)
56221 {
56223 }
56224 }
56225
56226 public void LoadAccNeck(int i)
56227 {
56228 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56229 if ((int)TextureAssets.AccNeck[i].State == 0)
56230 {
56232 }
56233 }
56234
56235 public void LoadAccFace(int i)
56236 {
56237 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56238 if ((int)TextureAssets.AccFace[i].State == 0)
56239 {
56241 }
56242 }
56243
56244 public void LoadAccBalloon(int i)
56245 {
56246 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56247 if ((int)TextureAssets.AccBalloon[i].State == 0)
56248 {
56250 }
56251 }
56252
56253 public void LoadAccBeard(int i)
56254 {
56255 //IL_0007: Unknown result type (might be due to invalid IL or missing references)
56256 if ((int)TextureAssets.AccBeard[i].State == 0)
56257 {
56259 }
56260 }
56261
56262 public void LoadFlameRing()
56263 {
56264 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
56265 if ((int)TextureAssets.FlameRing.State == 0)
56266 {
56268 }
56269 }
56270
56271 protected void DrawSurfaceBG()
56272 {
56273 bool flag = false;
56275 {
56276 flag = true;
56277 }
56278 if (mapFullscreen)
56279 {
56280 flag = false;
56281 }
56283 int num = 30;
56284 if (gameMenu)
56285 {
56286 num = 0;
56287 }
56289 {
56290 num = -180;
56291 }
56292 float num2 = (float)worldSurface;
56293 if (num2 == 0f)
56294 {
56295 num2 = 1f;
56296 }
56297 _ = screenPosition;
56298 float num3 = screenPosition.Y + (float)(screenHeight / 2) - 600f;
56299 double num4 = (num3 - screenOff / 2f) / (num2 * 16f);
56300 num4 = 0f - MathHelper.Lerp((float)num4, 1f, 0f);
56301 num4 = (0f - num3 + screenOff / 2f) / (num2 * 16f);
56302 float num5 = 2f;
56303 int num6 = 0;
56304 float num7 = SkyManager.Instance.ProcessCloudAlpha() * atmo;
56305 if (flag && (double)screenPosition.Y < worldSurface * 16.0 + 16.0)
56306 {
56307 for (int i = 0; i < 200; i++)
56308 {
56309 if (cloud[i].active && cloud[i].scale < 1f)
56310 {
56312 float num8 = cloud[i].scale * 0.8f;
56313 float num9 = (cloud[i].scale + 1f) / 2f * 0.9f;
56314 color.R = (byte)((float)(int)color.R * num8);
56315 color.G = (byte)((float)(int)color.G * num9);
56316 float num10 = cloud[i].position.Y * ((float)screenHeight / 600f);
56317 num10 = cloud[i].position.Y + (float)(int)(num4 * 750.0 + 830.0) + (float)(int)scAdj + (float)num6;
56318 spriteBatch.Draw(TextureAssets.Cloud[cloud[i].type].Value, new Vector2(cloud[i].position.X + (float)TextureAssets.Cloud[cloud[i].type].Width() * 0.5f, num10 + (float)TextureAssets.Cloud[cloud[i].type].Height() * 0.5f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Cloud[cloud[i].type].Width(), TextureAssets.Cloud[cloud[i].type].Height()), color * num7, cloud[i].rotation, new Vector2((float)TextureAssets.Cloud[cloud[i].type].Width() * 0.5f, (float)TextureAssets.Cloud[cloud[i].type].Height() * 0.5f), cloud[i].scale, cloud[i].spriteDir, 0f);
56319 }
56320 }
56321 }
56322 if (invasionType == 4 && !SkyManager.Instance["Martian"].IsActive())
56323 {
56324 SkyManager.Instance.Activate("Martian", default(Vector2));
56325 }
56326 else if (invasionType != 4 && SkyManager.Instance["Martian"].IsActive())
56327 {
56328 SkyManager.Instance.Deactivate("Martian");
56329 }
56330 SkyManager.Instance.ResetDepthTracker();
56331 bgParallax = 0.15;
56332 int num11 = -180;
56333 bool flag2 = true;
56334 int num12 = 0;
56335 if (gameMenu)
56336 {
56337 num12 -= num11;
56338 }
56339 num6 = num12;
56340 num6 += num;
56341 if (!WorldGen.drunkWorldGen && flag && (double)(screenPosition.Y / 16f) <= worldSurface + 10.0)
56342 {
56344 {
56345 if (cloudBGActive > 0f)
56346 {
56347 cloudBGAlpha += 0.0005f * (float)dayRate;
56348 if (cloudBGAlpha > 1f)
56349 {
56350 cloudBGAlpha = 1f;
56351 }
56352 }
56353 else
56354 {
56355 cloudBGAlpha -= 0.0005f * (float)dayRate;
56356 if (cloudBGAlpha < 0f)
56357 {
56358 cloudBGAlpha = 0f;
56359 }
56360 }
56361 if (cloudBGAlpha > 0f)
56362 {
56365 float num13 = cloudBGAlpha;
56366 if (num13 > 1f)
56367 {
56368 num13 = 1f;
56369 }
56370 bgScale = 1.65f;
56371 bgParallax = 0.09000000357627869;
56372 if (base.IsActive && !gamePaused)
56373 {
56374 cloudBGX[0] += windSpeedCurrent * (float)bgParallax * 9f * (float)dayRate;
56375 }
56376 if (cloudBGX[0] > (float)backgroundWidth[cloudBG[0]] * bgScale)
56377 {
56378 cloudBGX[0] -= (float)backgroundWidth[cloudBG[0]] * bgScale;
56379 }
56380 if (cloudBGX[0] < (float)(-backgroundWidth[cloudBG[0]]) * bgScale)
56381 {
56382 cloudBGX[0] += (float)backgroundWidth[cloudBG[0]] * bgScale;
56383 }
56384 float num14 = (float)backgroundWidth[cloudBG[0]] * bgScale;
56385 bgTopY = (int)(num4 * 900.0 + 600.0) + (int)scAdj + num6;
56386 if (gameMenu)
56387 {
56388 bgTopY = -150 + num6;
56389 }
56390 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, num14) - (double)(num14 / 2f) - (double)num14);
56391 bgStartX += (int)cloudBGX[0];
56392 bgLoops = screenWidth / (int)num14 + 2 + 2;
56394 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
56395 for (int j = 0; j < bgLoops; j++)
56396 {
56398 }
56399 num13 = cloudBGAlpha * 1.5f;
56400 if (num13 > 1f)
56401 {
56402 num13 = 1f;
56403 }
56405 bgScale = 1.85f;
56406 bgParallax = 0.12;
56407 if (base.IsActive && !gamePaused)
56408 {
56409 cloudBGX[1] += windSpeedCurrent * (float)bgParallax * 9f * (float)dayRate;
56410 }
56411 if (cloudBGX[1] > (float)backgroundWidth[cloudBG[1]] * bgScale)
56412 {
56413 cloudBGX[1] -= (float)backgroundWidth[cloudBG[1]] * bgScale;
56414 }
56415 if (cloudBGX[1] < (float)(-backgroundWidth[cloudBG[1]]) * bgScale)
56416 {
56417 cloudBGX[1] += (float)backgroundWidth[cloudBG[1]] * bgScale;
56418 }
56419 num14 = (float)backgroundWidth[cloudBG[1]] * bgScale;
56420 bgTopY = (int)(num4 * 1100.0 + 750.0) + (int)scAdj + num6;
56421 if (gameMenu)
56422 {
56423 bgTopY = -50 + num6;
56424 }
56425 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, num14) - (double)(num14 / 2f) - (double)num14);
56426 bgStartX += (int)cloudBGX[1];
56427 bgLoops = screenWidth / (int)num14 + 2 + 2;
56428 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
56429 for (int k = 0; k < bgLoops; k++)
56430 {
56432 }
56433 }
56435 }
56436 cTop = bgTopY - 50;
56437 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
56438 {
56439 for (int l = 0; l < 200; l++)
56440 {
56441 if (cloud[l].active && (double)cloud[l].scale < 1.15 && cloud[l].scale >= 1f)
56442 {
56444 if (atmo < 1f)
56445 {
56446 color2 *= atmo;
56447 }
56448 float num15 = cloud[l].position.Y * ((float)screenHeight / 600f);
56449 float num16 = (float)((double)(screenPosition.Y / 16f - 24f) / worldSurface);
56450 if (num16 < 0f)
56451 {
56452 num16 = 0f;
56453 }
56454 if (num16 > 1f)
56455 {
56456 num16 = 1f;
56457 }
56458 if (gameMenu)
56459 {
56460 num16 = 1f;
56461 }
56462 spriteBatch.Draw(TextureAssets.Cloud[cloud[l].type].Value, new Vector2(cloud[l].position.X + (float)TextureAssets.Cloud[cloud[l].type].Width() * 0.5f, num15 + (float)TextureAssets.Cloud[cloud[l].type].Height() * 0.5f + cTop + 200f), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Cloud[cloud[l].type].Width(), TextureAssets.Cloud[cloud[l].type].Height()), color2 * num7, cloud[l].rotation, new Vector2((float)TextureAssets.Cloud[cloud[l].type].Width() * 0.5f, (float)TextureAssets.Cloud[cloud[l].type].Height() * 0.5f), cloud[l].scale, cloud[l].spriteDir, 0f);
56463 }
56464 }
56465 }
56467 {
56468 bgParallax = 0.17;
56469 bgScale = 1.1f;
56470 bgTopY = (int)(num4 * 1400.0 + 900.0) + (int)scAdj + num6;
56472 bgScale *= num5;
56473 bgWidthScaled = (int)((double)(2100f * bgScale) * 1.05);
56474 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
56476 if (gameMenu)
56477 {
56478 bgTopY = 230 + num6;
56479 bgStartX -= 500;
56480 }
56481 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
56484 if (num17 > 0.5f)
56485 {
56486 num17 = 0.5f;
56487 }
56488 else if (num17 < 0f)
56489 {
56490 num17 = 0f;
56491 }
56492 color3.R = (byte)((float)(int)color3.R * num17);
56493 color3.G = (byte)((float)(int)color3.G * num17);
56494 color3.B = (byte)((float)(int)color3.B * num17);
56495 color3.A = (byte)((float)(int)color3.A * num17 * 0.8f);
56496 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
56497 {
56498 LoadBackground(18);
56499 LoadBackground(19);
56500 for (int m = 0; m < bgLoops; m++)
56501 {
56503 spriteBatch.Draw(TextureAssets.Background[19].Value, new Vector2(bgStartX + bgWidthScaled * m + 1900, bgTopY + 100), new Microsoft.Xna.Framework.Rectangle(0, 0, backgroundWidth[19], backgroundHeight[19]), color3, 0f, default(Vector2), bgScale * 0.9f, SpriteEffects.None, 0f);
56504 }
56505 }
56506 }
56507 if (treeMntBGSet1[1] > -1)
56508 {
56510 bgParallax = 0.2;
56511 bgScale = 1.15f;
56512 bgScale *= num5;
56514 if (num18 == 0)
56515 {
56516 num18 = 1;
56517 }
56518 bgWidthScaled = (int)((float)num18 * bgScale);
56519 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
56521 if (treeMntBGSet1[1] == 172)
56522 {
56523 bgLoops++;
56524 }
56525 bgTopY = (int)(num4 * 1400.0 + 1260.0) + (int)scAdj + num6;
56526 }
56528 {
56530 }
56531 cTop = (float)bgTopY * 1.01f - 150f;
56532 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
56533 {
56534 for (int n = 0; n < 200; n++)
56535 {
56536 if (cloud[n].active && cloud[n].scale >= 1.15f)
56537 {
56539 if (atmo < 1f)
56540 {
56541 color4 *= atmo;
56542 }
56543 float num19 = cloud[n].position.Y * ((float)screenHeight / 600f) - 100f;
56544 float num20 = (float)((double)(screenPosition.Y / 16f - 24f) / worldSurface);
56545 if (num20 < 0f)
56546 {
56547 num20 = 0f;
56548 }
56549 if (num20 > 1f)
56550 {
56551 num20 = 1f;
56552 }
56553 if (gameMenu)
56554 {
56555 num20 = 1f;
56556 }
56557 spriteBatch.Draw(TextureAssets.Cloud[cloud[n].type].Value, new Vector2(cloud[n].position.X + (float)TextureAssets.Cloud[cloud[n].type].Width() * 0.5f, num19 + (float)TextureAssets.Cloud[cloud[n].type].Height() * 0.5f + cTop), new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Cloud[cloud[n].type].Width(), TextureAssets.Cloud[cloud[n].type].Height()), color4 * num7, cloud[n].rotation, new Vector2((float)TextureAssets.Cloud[cloud[n].type].Width() * 0.5f, (float)TextureAssets.Cloud[cloud[n].type].Height() * 0.5f), cloud[n].scale, cloud[n].spriteDir, 0f);
56558 }
56559 }
56560 }
56561 }
56562 if (flag2)
56563 {
56564 num6 += num11;
56565 }
56566 if (flag)
56567 {
56568 for (int num21 = 0; num21 < bgAlphaFrontLayer.Length; num21++)
56569 {
56571 {
56573 if (bgAlphaFrontLayer[num21] > 0f && num21 == 0)
56574 {
56577 }
56578 if (bgAlphaFrontLayer[num21] > 0f && num21 == 10)
56579 {
56582 }
56583 if (bgAlphaFrontLayer[num21] > 0f && num21 == 11)
56584 {
56587 }
56588 if (bgAlphaFrontLayer[num21] > 0f && num21 == 12)
56589 {
56592 }
56593 if (bgAlphaFrontLayer[num21] > 0f && num21 == 1)
56594 {
56595 int[] bgTexIndexes = corruptBG;
56598 }
56599 if (bgAlphaFrontLayer[num21] > 0f && num21 == 2)
56600 {
56601 int[] bgTexIndexes2 = desertBG;
56604 }
56605 if (bgAlphaFrontLayer[num21] > 0f && num21 == 3)
56606 {
56607 int[] bgTexIndexes3 = jungleBG;
56610 }
56611 if (bgAlphaFrontLayer[num21] > 0f && num21 == 4)
56612 {
56614 }
56615 if (bgAlphaFrontLayer[num21] > 0f && num21 == 5)
56616 {
56619 }
56620 if (bgAlphaFrontLayer[num21] > 0f && num21 == 6)
56621 {
56622 int[] bgTexIndexes4 = hallowBG;
56625 }
56626 if (bgAlphaFrontLayer[num21] > 0f && num21 == 7)
56627 {
56628 int[] bgTexIndexes5 = snowBG;
56631 }
56632 if (bgAlphaFrontLayer[num21] > 0f && num21 == 8)
56633 {
56634 int[] bgTexIndexes6 = crimsonBG;
56637 }
56638 if (bgAlphaFrontLayer[num21] > 0f && num21 == 9)
56639 {
56640 int[] bgTexIndexes7 = mushroomBG;
56643 }
56644 }
56645 }
56646 }
56647 if (flag2)
56648 {
56649 num6 -= num11;
56650 }
56652 if (flag && num22 > 0f && !gameMenu && (double)screenPosition.Y < worldSurface * 16.0 + 16.0)
56653 {
56654 bgParallax = 0.1;
56657 bgStartY = 0;
56658 bgLoopsY = 0;
56659 bgTopY = (int)((double)(0f - screenPosition.Y) / (worldSurface * 16.0 - 600.0) * 200.0);
56661 for (int num23 = 0; num23 < bgLoops; num23++)
56662 {
56663 bgStartX = 0;
56665 int height = Math.Max(screenHeight + 210, value.Height);
56666 spriteBatch.Draw(value, new Microsoft.Xna.Framework.Rectangle(bgStartX + value.Width * num23, bgTopY, value.Width, height), color5);
56667 }
56668 }
56669 if (!mapFullscreen)
56670 {
56671 SkyManager.Instance.DrawRemainingDepth(spriteBatch);
56672 }
56673 }
56674
56675 private static float DrawSurfaceBG_GetFogPower()
56676 {
56678 }
56679
56681 {
56682 if (bgTextureIndex >= 0)
56683 {
56686 bgTopY += num;
56687 for (int i = 0; i < bgLoops; i++)
56688 {
56690 }
56691 bgTopY -= num;
56692 }
56693 }
56694
56696 {
56697 switch (bgTextureIndex)
56698 {
56699 case 59:
56700 return -550;
56701 case 93:
56702 case 168:
56703 case 169:
56704 case 170:
56705 return -50;
56706 case 171:
56707 return -100;
56708 case 172:
56709 return 130;
56710 case 176:
56711 return -760;
56712 case 177:
56713 return -200;
56714 case 179:
56715 return -100;
56716 case 180:
56717 case 181:
56718 case 182:
56719 case 183:
56720 return -350;
56721 case 246:
56722 return -150;
56723 case 247:
56724 return -150;
56725 case 263:
56726 return -700;
56727 case 269:
56728 return -100;
56729 case 270:
56730 return -50;
56731 case 271:
56732 return -300;
56733 case 272:
56734 return -380;
56735 case 277:
56736 return -260;
56737 case 278:
56738 return -120;
56739 case 280:
56740 return -170;
56741 case 281:
56742 return -300;
56743 case 283:
56744 return -800;
56745 default:
56746 return 0;
56747 }
56748 }
56749
56751 {
56752 return (GlobalTimeWrappedHourly * ((float)Math.PI / 2f)).ToRotationVector2().X * 0.5f + 0.5f;
56753 }
56754
56756 {
56758 bgScale = 1f;
56759 bgTopY = (int)(backgroundTopMagicNumber * 1300.0 + 1090.0) + (int)scAdj + pushBGTopHack;
56761 bgParallax = 0.15;
56762 bgWidthScaled = (int)(1024f * bgScale);
56763 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
56764 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
56765 if (bgWidthScaled == 0)
56766 {
56767 bgWidthScaled = 1024;
56768 }
56770 if (gameMenu)
56771 {
56772 bgTopY = 100 + pushBGTopHack;
56773 }
56774 if (!((double)screenPosition.Y < worldSurface * 16.0 + 16.0))
56775 {
56776 return;
56777 }
56778 if (bgAlphaFarBackLayer[0] > 0f)
56779 {
56782 }
56783 if (bgAlphaFarBackLayer[10] > 0f)
56784 {
56787 }
56788 if (bgAlphaFarBackLayer[11] > 0f)
56789 {
56792 }
56793 if (bgAlphaFarBackLayer[12] > 0f)
56794 {
56797 }
56798 if (bgAlphaFarBackLayer[1] > 0f)
56799 {
56801 if (WorldGen.desertBG != 4)
56802 {
56804 }
56805 }
56806 if (bgAlphaFarBackLayer[2] > 0f)
56807 {
56810 }
56811 if (bgAlphaFarBackLayer[4] > 0f)
56812 {
56815 }
56816 if (bgAlphaFarBackLayer[5] > 0f)
56817 {
56819 if (WorldGen.crimsonBG != 5)
56820 {
56822 }
56823 }
56824 if (bgAlphaFarBackLayer[6] > 0f && WorldGen.hallowBG == 3)
56825 {
56828 }
56829 SkyManager.Instance.DrawToDepth(spriteBatch, 5f);
56830 }
56831
56833 {
56834 if (gameMenu)
56835 {
56836 bgTopY = 230 + pushBGTopHack;
56837 bgStartX -= 500;
56838 }
56841 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
56842 if (!((double)screenPosition.Y < worldSurface * 16.0 + 16.0))
56843 {
56844 return;
56845 }
56846 if (bgAlphaFarBackLayer[0] > 0f)
56847 {
56849 if (treeMntBGSet1[1] > -1)
56850 {
56852 }
56853 }
56854 if (bgAlphaFarBackLayer[1] > 0f)
56855 {
56857 if (WorldGen.desertBG != 4)
56858 {
56860 }
56861 }
56862 if (bgAlphaFarBackLayer[2] > 0f)
56863 {
56866 }
56867 if (bgAlphaFarBackLayer[3] > 0f)
56868 {
56871 }
56872 if (bgAlphaFarBackLayer[4] > 0f)
56873 {
56876 }
56877 if (bgAlphaFarBackLayer[5] > 0f)
56878 {
56880 if (WorldGen.crimsonBG != 5)
56881 {
56883 }
56884 }
56885 if (bgAlphaFarBackLayer[6] > 0f && WorldGen.hallowBG == 3)
56886 {
56889 }
56890 if (bgAlphaFarBackLayer[10] > 0f)
56891 {
56893 if (treeMntBGSet2[1] > -1)
56894 {
56896 }
56897 }
56898 if (bgAlphaFarBackLayer[11] > 0f)
56899 {
56901 if (treeMntBGSet3[1] > -1)
56902 {
56904 }
56905 }
56906 if (bgAlphaFarBackLayer[12] > 0f)
56907 {
56909 if (treeMntBGSet4[1] > -1)
56910 {
56912 }
56913 }
56914 }
56915
56917 {
56919 int num2 = 0;
56920 switch (oceanBG)
56921 {
56922 case 28:
56923 case 110:
56924 case 111:
56925 case 209:
56926 case 210:
56927 num2 = 102;
56928 break;
56929 case 283:
56930 num2 = 124;
56931 break;
56932 }
56933 float yScreenPosition = (float)(bgTopY + num) + (float)num2 * bgScale;
56935 }
56936
56938 {
56939 float num = 0.33f;
56940 Vector3 vector = new Vector3(0.1f, 0.15f, 0.3f);
56941 float num2 = 0.5f;
56942 Vector3 vector2 = new Vector3(0.1f, 0.175f, 0.3f);
56943 float num3 = 0.75f;
56944 Vector3 vector3 = new Vector3(0.125f, 0.2f, 0.3f);
56945 num = 0.5f;
56946 num2 = 0.625f;
56947 num3 = 0.75f;
56948 vector *= 3f;
56949 vector2 *= 3f;
56950 vector3 *= 3f;
56951 float num4 = (float)(int)ColorOfSurfaceBackgroundsModified.A / 255f;
56953 float num5 = (float)rand.Next(28, 42) * 0.001f;
56954 num5 += (float)(270 - mouseTextColor) / 5000f;
56955 float x = vector.X;
56956 float num6 = vector.Y + num5 / 2f;
56957 float num7 = vector.Z + num5;
56958 x *= 255f;
56959 num6 *= 255f;
56960 num7 *= 255f;
56961 x *= num * num4;
56962 num6 *= num * num4;
56963 num7 *= num * num4;
56964 if (x > 255f)
56965 {
56966 x = 255f;
56967 }
56968 if (num6 > 255f)
56969 {
56970 num6 = 255f;
56971 }
56972 if (num7 > 255f)
56973 {
56974 num7 = 255f;
56975 }
56976 if (x > (float)(int)colorOfSurfaceBackgroundsModified.R)
56977 {
56978 colorOfSurfaceBackgroundsModified.R = (byte)x;
56979 }
56980 if (num6 > (float)(int)colorOfSurfaceBackgroundsModified.G)
56981 {
56982 colorOfSurfaceBackgroundsModified.G = (byte)num6;
56983 }
56984 if (num7 > (float)(int)colorOfSurfaceBackgroundsModified.B)
56985 {
56986 colorOfSurfaceBackgroundsModified.B = (byte)num7;
56987 }
56988 bgScale = 1.25f;
56991 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[0]] * bgScale);
56992 bgParallax = 0.4;
56994 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
56995 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
56996 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1400.0) + (int)scAdj + pushBGTopHack;
56998 if (gameMenu)
56999 {
57000 bgTopY = 320 + pushBGTopHack;
57001 }
57002 if (bgWidthScaled != 0)
57003 {
57005 }
57006 if (TextureAssets.Background[bgTexIndexes[0]].Value == null)
57007 {
57008 return;
57009 }
57010 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57011 {
57012 for (int i = 0; i < bgLoops; i++)
57013 {
57015 }
57016 }
57018 num5 = (float)rand.Next(28, 42) * 0.001f;
57019 num5 += (float)(270 - mouseTextColor) / 5000f;
57020 x = vector2.X;
57021 num6 = vector2.Y + num5 / 2f;
57022 num7 = vector2.Z + num5;
57023 x *= 255f;
57024 num6 *= 255f;
57025 num7 *= 255f;
57026 x *= num2 * num4;
57027 num6 *= num2 * num4;
57028 num7 *= num2 * num4;
57029 if (x > 255f)
57030 {
57031 x = 255f;
57032 }
57033 if (num6 > 255f)
57034 {
57035 num6 = 255f;
57036 }
57037 if (num7 > 255f)
57038 {
57039 num7 = 255f;
57040 }
57041 if (x > (float)(int)colorOfSurfaceBackgroundsModified.R)
57042 {
57043 colorOfSurfaceBackgroundsModified.R = (byte)x;
57044 }
57045 if (num6 > (float)(int)colorOfSurfaceBackgroundsModified.G)
57046 {
57047 colorOfSurfaceBackgroundsModified.G = (byte)num6;
57048 }
57049 if (num7 > (float)(int)colorOfSurfaceBackgroundsModified.B)
57050 {
57051 colorOfSurfaceBackgroundsModified.B = (byte)num7;
57052 }
57053 bgScale = 1.32f;
57056 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
57057 bgParallax = 0.43;
57059 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57060 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57061 bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1675.0) + (int)scAdj + pushBGTopHack;
57063 if (gameMenu)
57064 {
57065 bgTopY = 400 + pushBGTopHack;
57066 bgStartX -= 80;
57067 }
57068 if (bgWidthScaled == 0)
57069 {
57070 return;
57071 }
57073 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57074 {
57075 for (int j = 0; j < bgLoops; j++)
57076 {
57078 }
57079 }
57081 num5 = (float)rand.Next(28, 42) * 0.001f;
57082 num5 += (float)(270 - mouseTextColor) / 3000f;
57083 x = vector3.X;
57084 num6 = vector3.Y + num5 / 2f;
57085 num7 = vector3.Z + num5;
57086 x *= 255f * num4 * num3;
57087 num6 *= 255f * num4 * num3;
57088 num7 *= 255f * num4 * num3;
57089 if (x > 255f)
57090 {
57091 x = 255f;
57092 }
57093 if (num6 > 255f)
57094 {
57095 num6 = 255f;
57096 }
57097 if (num7 > 255f)
57098 {
57099 num7 = 255f;
57100 }
57101 if (x > (float)(int)colorOfSurfaceBackgroundsModified.R)
57102 {
57103 colorOfSurfaceBackgroundsModified.R = (byte)x;
57104 }
57105 if (num6 > (float)(int)colorOfSurfaceBackgroundsModified.G)
57106 {
57107 colorOfSurfaceBackgroundsModified.G = (byte)num6;
57108 }
57109 if (num7 > (float)(int)colorOfSurfaceBackgroundsModified.B)
57110 {
57111 colorOfSurfaceBackgroundsModified.B = (byte)num7;
57112 }
57113 bgScale = 1.36f;
57116 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
57117 bgParallax = 0.49;
57119 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57120 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57121 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 1950.0) + (int)scAdj + pushBGTopHack;
57123 if (gameMenu)
57124 {
57125 bgTopY = 480 + pushBGTopHack;
57126 bgStartX -= 120;
57127 }
57128 if (bgWidthScaled == 0)
57129 {
57130 return;
57131 }
57133 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57134 {
57135 for (int k = 0; k < bgLoops; k++)
57136 {
57138 }
57139 }
57140 SkyManager.Instance.DrawToDepth(spriteBatch, 1f);
57141 }
57142
57144 {
57145 if (bgTexIndexes[0] > -1)
57146 {
57147 bgScale = 1.25f;
57148 bgParallax = 0.4;
57149 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack;
57153 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[0]] * bgScale);
57154 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57155 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57156 if (bgTexIndexes[0] == 105)
57157 {
57158 bgTopY += 50;
57159 }
57160 if (bgTexIndexes[0] == 174)
57161 {
57162 bgTopY -= 350;
57163 }
57164 if (gameMenu)
57165 {
57166 bgTopY = 320 + pushBGTopHack;
57167 }
57169 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57170 {
57171 for (int i = 0; i < bgLoops; i++)
57172 {
57174 }
57175 }
57176 }
57177 if (bgTexIndexes[1] > -1)
57178 {
57179 bgScale = 1.31f;
57180 bgParallax = 0.43;
57181 bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
57185 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
57186 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57187 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57188 if (gameMenu)
57189 {
57190 bgTopY = 400 + pushBGTopHack;
57191 bgStartX -= 80;
57192 }
57194 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57195 {
57196 for (int j = 0; j < bgLoops; j++)
57197 {
57199 }
57200 }
57201 }
57202 bgScale = 1.34f;
57203 bgParallax = 0.49;
57204 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack;
57208 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
57209 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57210 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57211 if (gameMenu)
57212 {
57213 bgTopY = 480 + pushBGTopHack;
57214 bgStartX -= 120;
57215 }
57217 if (bgTexIndexes[2] == 175)
57218 {
57219 bgStartX -= 1000;
57220 bgTopY -= 400;
57221 bgLoops++;
57222 }
57223 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57224 {
57225 for (int k = 0; k < bgLoops; k++)
57226 {
57228 }
57229 }
57230 }
57231
57233 {
57234 if (bgTexIndexes[0] >= 0)
57235 {
57236 bgScale = 1.25f;
57237 bgParallax = 0.4;
57238 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack;
57242 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[0]] * bgScale);
57243 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57244 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57245 if (gameMenu)
57246 {
57247 bgTopY = 320 + pushBGTopHack;
57248 }
57251 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57252 {
57253 for (int i = 0; i < bgLoops; i++)
57254 {
57256 }
57257 }
57258 }
57259 if (bgTexIndexes[1] >= 0)
57260 {
57261 bgScale = 1.31f;
57262 bgParallax = 0.43;
57263 bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
57267 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
57268 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57269 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57270 if (gameMenu)
57271 {
57272 bgTopY = 400 + pushBGTopHack;
57273 bgStartX -= 80;
57274 }
57277 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57278 {
57279 for (int j = 0; j < bgLoops; j++)
57280 {
57282 }
57283 }
57284 }
57285 if (bgTexIndexes[2] < 0)
57286 {
57287 return;
57288 }
57289 bgScale = 1.34f;
57290 bgParallax = 0.49;
57291 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack;
57295 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
57296 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57297 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57298 if (gameMenu)
57299 {
57300 bgTopY = 480 + pushBGTopHack;
57301 bgStartX -= 120;
57302 }
57305 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57306 {
57307 for (int k = 0; k < bgLoops; k++)
57308 {
57310 }
57311 }
57312 }
57313
57315 {
57316 int num = 0;
57317 int num2 = 0;
57318 switch (backgroundID)
57319 {
57320 case 18:
57321 if (WorldGen.hallowBG == 3)
57322 {
57323 bgParallax = 0.17;
57324 bgScale = 1.1f;
57325 num = 1400;
57326 num2 = 1100;
57327 }
57328 break;
57329 case 258:
57330 bgScale = 1.25f;
57331 bgParallax = 0.23;
57332 num = 1800;
57333 num2 = 850;
57334 break;
57335 case 259:
57336 bgScale = 1.31f;
57337 bgParallax = 0.33;
57338 num = 1950;
57339 num2 = 1500;
57340 break;
57341 case 260:
57342 bgScale = 1.34f;
57343 bgParallax = 0.4;
57344 num = 2100;
57345 num2 = 1650;
57346 break;
57347 case 263:
57348 bgScale = 1.25f;
57349 bgParallax = 0.23;
57350 num = 1800;
57351 num2 = 1450;
57352 break;
57353 case 264:
57354 bgScale = 1.31f;
57355 bgParallax = 0.33;
57356 num = 1950;
57357 num2 = 1700;
57358 break;
57359 case 265:
57360 bgScale = 1.34f;
57361 bgParallax = 0.4;
57362 num = 2100;
57363 num2 = 2000;
57364 break;
57365 case 267:
57366 bgScale = 1.25f;
57367 bgParallax = 0.23;
57368 num = 1700;
57369 num2 = 1300;
57370 break;
57371 case 266:
57372 bgScale = 1.31f;
57373 bgParallax = 0.33;
57374 num = 1950;
57375 num2 = 1600;
57376 break;
57377 case 268:
57378 bgScale = 1.34f;
57379 bgParallax = 0.41;
57380 num = 2100;
57381 num2 = 1850;
57382 break;
57383 case 248:
57384 bgScale = 1.3f;
57385 bgParallax = 0.37;
57386 num = 1800;
57387 num2 = 1100;
57388 break;
57389 case 249:
57390 bgScale = 1.4f;
57391 bgParallax = 0.43;
57392 num = 1950;
57393 num2 = 1200;
57394 break;
57395 case 250:
57396 bgScale = 1.7f;
57397 bgParallax = 0.49;
57398 num = 2000;
57399 num2 = 1000;
57400 break;
57401 case 255:
57402 bgScale = 1.15f;
57403 bgParallax = 0.25;
57404 num = 1800;
57405 num2 = 1450;
57406 break;
57407 case 256:
57408 bgScale = 1.21f;
57409 bgParallax = 0.32;
57410 num = 1950;
57411 num2 = 1550;
57412 break;
57413 case 257:
57414 bgScale = 1.34f;
57415 bgParallax = 0.4;
57416 num = 2100;
57417 num2 = 1550;
57418 break;
57419 case 240:
57420 bgScale = 1.15f;
57421 bgParallax = 0.3;
57422 num = 1800;
57423 num2 = 1500;
57424 break;
57425 case 241:
57426 bgScale = 1.21f;
57427 bgParallax = 0.43;
57428 num = 1950;
57429 num2 = 1300;
57430 break;
57431 case 242:
57432 bgScale = 1.34f;
57433 bgParallax = 0.49;
57434 num = 2100;
57435 num2 = 1400;
57436 break;
57437 case 243:
57438 bgScale = 1.15f;
57439 bgParallax = 0.25;
57440 num = 1800;
57441 num2 = 1400;
57442 break;
57443 case 244:
57444 bgScale = 1.21f;
57445 bgParallax = 0.35;
57446 num = 1950;
57447 num2 = 1550;
57448 break;
57449 case 245:
57450 bgScale = 1.24f;
57451 bgParallax = 0.45;
57452 num = 2100;
57453 num2 = 1650;
57454 break;
57455 case 273:
57456 bgParallax = 0.49000000953674316;
57457 num = 2100;
57458 num2 = 1560;
57459 break;
57460 case 234:
57461 bgParallax = 0.23;
57462 num = 1700;
57463 num2 = 1150;
57464 break;
57465 case 235:
57466 bgParallax = 0.33;
57467 num = 1950;
57468 num2 = 1550;
57469 break;
57470 case 236:
57471 bgParallax = 0.41;
57472 num = 2100;
57473 num2 = 2000;
57474 break;
57475 case 279:
57476 bgScale = 2.5f;
57477 bgParallax = 0.3499999940395355;
57478 num = 1850;
57479 num2 = 1750;
57480 break;
57481 case 282:
57482 bgScale = 2.6f;
57483 bgParallax = 0.25;
57484 num = 1800;
57485 num2 = 1340;
57486 break;
57487 case 261:
57488 bgParallax = 0.27;
57489 break;
57490 case 262:
57491 bgParallax = 0.4;
57492 break;
57493 case 219:
57494 bgParallax = 0.25;
57495 break;
57496 case 220:
57497 bgParallax = 0.34;
57498 break;
57499 case 221:
57500 bgParallax = 0.43;
57501 break;
57502 case 222:
57503 num = 1800;
57504 num2 = 1400;
57505 break;
57506 case 223:
57507 num = 2150;
57508 num2 = 1850;
57509 break;
57510 case 224:
57511 num = 2500;
57512 num2 = 2400;
57513 break;
57514 case 237:
57515 num = 1800;
57516 num2 = 1500;
57517 break;
57518 case 238:
57519 num = 1950;
57520 num2 = 1500;
57521 break;
57522 case 239:
57523 num = 2100;
57524 num2 = 1900;
57525 break;
57526 case 284:
57527 bgParallax = 0.23;
57528 num = 1600;
57529 num2 = 900;
57530 break;
57531 case 285:
57532 bgParallax = 0.36;
57533 num = 1900;
57534 num2 = 960;
57535 break;
57536 case 286:
57537 bgParallax = 0.42;
57538 num = 2100;
57539 num2 = 1200;
57540 break;
57541 case 287:
57542 bgParallax = 0.21;
57543 num = 1700;
57544 num2 = 1560;
57545 break;
57546 case 288:
57547 bgParallax = 0.33;
57548 num = 1950;
57549 num2 = 1730;
57550 break;
57551 case 289:
57552 bgParallax = 0.41;
57553 num = 2100;
57554 num2 = 1400;
57555 break;
57556 case 207:
57557 bgParallax = 0.32;
57558 break;
57559 }
57560 if (num != 0 || num2 != 0)
57561 {
57562 bgTopY = (int)(backgroundTopMagicNumber * (double)num + (double)num2) + (int)scAdj + pushBGTopHack;
57563 }
57564 }
57565
57567 {
57568 if (bgTexIndexes[0] > 0)
57569 {
57570 bgScale = 1.25f;
57571 bgParallax = 0.4;
57572 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack;
57576 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[0]] * bgScale);
57577 SkyManager.Instance.DrawToDepth(spriteBatch, 1.2f / (float)bgParallax);
57578 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57579 if (gameMenu)
57580 {
57581 bgTopY = 320 + pushBGTopHack;
57582 }
57584 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57585 {
57586 for (int i = 0; i < bgLoops; i++)
57587 {
57589 }
57590 }
57591 }
57592 if (bgTexIndexes[1] > 0)
57593 {
57594 bgScale = 1.31f;
57595 bgParallax = 0.43;
57596 bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
57600 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
57601 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57602 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57603 if (gameMenu)
57604 {
57605 bgTopY = 400 + pushBGTopHack;
57606 bgStartX -= 80;
57607 }
57609 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57610 {
57611 for (int j = 0; j < bgLoops; j++)
57612 {
57614 }
57615 }
57616 }
57617 if (bgTexIndexes[2] <= 0)
57618 {
57619 return;
57620 }
57621 bgScale = 1.34f;
57622 bgParallax = 0.49;
57623 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack;
57627 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
57628 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57629 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57630 if (gameMenu)
57631 {
57632 bgTopY = 480 + pushBGTopHack;
57633 bgStartX -= 120;
57634 }
57636 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57637 {
57638 for (int k = 0; k < bgLoops; k++)
57639 {
57641 }
57642 }
57643 }
57644
57646 {
57647 LoadBackground(26);
57648 bgScale = 1.25f;
57650 bgWidthScaled = (int)((float)backgroundWidth[26] * bgScale);
57651 bgParallax = 0.37;
57652 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57653 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57654 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1750.0) + (int)scAdj + pushBGTopHack;
57655 if (gameMenu)
57656 {
57657 bgTopY = 320 + pushBGTopHack;
57658 }
57660 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57661 {
57662 for (int i = 0; i < bgLoops; i++)
57663 {
57665 }
57666 }
57667 bgScale = 1.34f;
57669 LoadBackground(27);
57670 bgWidthScaled = (int)((float)backgroundWidth[27] * bgScale);
57671 bgParallax = 0.49;
57672 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57673 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57674 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2150.0) + (int)scAdj + pushBGTopHack;
57675 if (gameMenu)
57676 {
57677 bgTopY = 480 + pushBGTopHack;
57678 bgStartX -= 120;
57679 }
57681 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57682 {
57683 for (int j = 0; j < bgLoops; j++)
57684 {
57686 }
57687 }
57688 }
57689
57691 {
57693 bgScale = 1.25f;
57695 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[0]] * bgScale);
57696 bgParallax = 0.4;
57698 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57699 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57700 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1660.0) + (int)scAdj + pushBGTopHack;
57702 if (gameMenu)
57703 {
57704 bgTopY = 320 + pushBGTopHack;
57705 }
57706 if (bgTexIndexes[0] == 59)
57707 {
57708 bgTopY -= 200;
57709 }
57712 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57713 {
57714 for (int i = 0; i < bgLoops; i++)
57715 {
57717 }
57718 }
57720 bgScale = 1.31f;
57722 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
57723 bgParallax = 0.43;
57725 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57726 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57727 bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1840.0) + (int)scAdj + pushBGTopHack;
57729 if (gameMenu)
57730 {
57731 bgTopY = 400 + pushBGTopHack;
57732 bgStartX -= 80;
57733 }
57734 if (bgTexIndexes[1] == 60)
57735 {
57736 bgTopY -= 175;
57737 }
57740 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57741 {
57742 for (int j = 0; j < bgLoops; j++)
57743 {
57745 }
57746 }
57747 bgScale = 1.34f;
57750 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
57751 bgParallax = 0.49;
57753 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57754 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57755 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2060.0) + (int)scAdj + pushBGTopHack;
57757 if (gameMenu)
57758 {
57759 bgTopY = 480 + pushBGTopHack;
57760 bgStartX -= 120;
57761 }
57762 if (bgTexIndexes[2] == 61)
57763 {
57764 bgTopY -= 150;
57765 }
57768 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57769 {
57770 for (int k = 0; k < bgLoops; k++)
57771 {
57773 }
57774 }
57775 }
57776
57778 {
57779 if (bgTexIndexes[0] > 0)
57780 {
57781 bgScale = 1.25f;
57782 bgParallax = 0.37;
57783 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1750.0) + (int)scAdj + pushBGTopHack;
57787 float num = (float)backgroundWidth[bgTexIndexes[0]] * bgScale;
57788 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57789 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, num) - (double)(num / 2f));
57790 if (gameMenu)
57791 {
57792 bgTopY = 320 + pushBGTopHack;
57793 }
57794 bgLoops = screenWidth / (int)num + 2;
57795 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57796 {
57797 for (int i = 0; i < bgLoops; i++)
57798 {
57800 }
57801 }
57802 }
57803 if (bgTexIndexes[1] > 0)
57804 {
57805 bgScale = 1.34f;
57806 bgParallax = 0.49;
57807 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2150.0) + (int)scAdj + pushBGTopHack;
57811 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
57812 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57813 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57814 if (gameMenu)
57815 {
57816 bgTopY = 480 + pushBGTopHack;
57817 bgStartX -= 120;
57818 }
57820 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57821 {
57822 for (int j = 0; j < bgLoops; j++)
57823 {
57825 }
57826 }
57827 }
57828 if (bgTexIndexes[2] <= 0)
57829 {
57830 return;
57831 }
57832 bgScale = 1.34f;
57833 bgParallax = 0.49;
57834 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2150.0) + (int)scAdj + pushBGTopHack;
57838 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
57839 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57840 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57841 if (gameMenu)
57842 {
57843 bgTopY = 480 + pushBGTopHack;
57844 bgStartX -= 120;
57845 }
57847 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57848 {
57849 for (int k = 0; k < bgLoops; k++)
57850 {
57852 }
57853 }
57854 }
57855
57857 {
57860 Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black * flashPower;
57862 }
57863
57865 {
57866 bgScale = 1.25f;
57867 bgParallax = 0.4;
57868 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack;
57873 {
57874 return;
57875 }
57876 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[0]] * bgScale);
57877 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57878 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57879 if (gameMenu)
57880 {
57881 bgTopY = 320 + pushBGTopHack;
57882 }
57883 if (bgTexIndexes[0] == 56)
57884 {
57885 bgTopY -= 100;
57886 }
57888 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57889 {
57890 for (int i = 0; i < bgLoops; i++)
57891 {
57893 }
57894 }
57895 bgScale = 1.31f;
57896 bgParallax = 0.43;
57897 bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
57901 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
57902 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57903 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57904 if (gameMenu)
57905 {
57906 bgTopY = 400 + pushBGTopHack;
57907 bgStartX -= 80;
57908 }
57909 if (bgTexIndexes[0] == 56)
57910 {
57911 bgTopY -= 100;
57912 }
57913 if (bgWidthScaled == 0)
57914 {
57915 bgWidthScaled = 1;
57916 }
57918 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57919 {
57920 try
57921 {
57923 if (value != null)
57924 {
57925 for (int j = 0; j < bgLoops; j++)
57926 {
57928 }
57929 }
57930 }
57931 catch
57932 {
57934 }
57935 }
57936 bgScale = 1.34f;
57937 bgParallax = 0.49;
57938 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack;
57942 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
57943 if (bgWidthScaled == 0)
57944 {
57945 bgWidthScaled = 150;
57946 }
57947 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57948 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57949 if (gameMenu)
57950 {
57951 bgTopY = 480 + pushBGTopHack;
57952 bgStartX -= 120;
57953 }
57954 if (bgTexIndexes[0] == 56)
57955 {
57956 bgTopY -= 100;
57957 }
57959 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57960 {
57961 for (int k = 0; k < bgLoops; k++)
57962 {
57964 }
57965 }
57966 }
57967
57969 {
57970 int num = 0;
57972 switch (backgroundTextureIndex)
57973 {
57974 case 235:
57975 num = (int)(GetBackgroundCounter() / 20) % 4;
57976 rectangle = TextureAssets.Background[backgroundTextureIndex].Frame(2, 2, num % 2, num / 2);
57977 rectangle.Inflate(0, -2);
57978 return rectangle;
57979 case 219:
57980 case 220:
57981 case 221:
57982 case 271:
57983 case 272:
57984 case 273:
57985 num = (int)(GetBackgroundCounter() / 15) % 4;
57986 rectangle = TextureAssets.Background[backgroundTextureIndex].Frame(2, 2, num % 2, num / 2);
57987 rectangle.Inflate(0, -2);
57988 return rectangle;
57989 case 281:
57990 num = (int)(GetBackgroundCounter() / 5) % 4;
57991 rectangle = TextureAssets.Background[backgroundTextureIndex].Frame(2, 2, num % 2, num / 2);
57992 rectangle.Inflate(0, -2);
57993 return rectangle;
57994 default:
57995 return null;
57996 }
57997 }
57998
58000 {
58001 if (!gameMenu)
58002 {
58003 return GameUpdateCount;
58004 }
58005 return (uint)(GlobalTimeWrappedHourly * 40f);
58006 }
58007
58009 {
58010 bgScale = 1.25f;
58011 bgParallax = 0.4;
58012 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1500.0) + (int)scAdj + pushBGTopHack;
58013 if (bgTexIndexes[0] == 91)
58014 {
58015 bgParallax = 0.27000001072883606;
58016 bgScale = 1.2f;
58017 }
58018 if (bgTexIndexes[0] == 173)
58019 {
58020 bgParallax = 0.25;
58021 bgScale = 1.3f;
58022 }
58023 if (bgTexIndexes[0] == 178)
58024 {
58025 bgParallax = 0.30000001192092896;
58026 bgScale = 1.2f;
58027 }
58028 if (bgTexIndexes[0] == 184)
58029 {
58030 bgParallax = 0.25;
58031 bgScale = 1.2f;
58032 }
58033 if (bgTexIndexes[0] == 282)
58034 {
58035 bgScale = 1.4f;
58036 }
58039 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
58040 if (bgTexIndexes[0] >= 0)
58041 {
58044 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[0]] * bgScale);
58045 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
58046 if (bgTexIndexes[0] == 91)
58047 {
58048 bgTopY = (int)(backgroundTopMagicNumber * 1600.0 + 1400.0) + (int)scAdj + pushBGTopHack;
58049 }
58050 if (bgTexIndexes[0] == 173)
58051 {
58052 bgTopY = (int)(backgroundTopMagicNumber * 1600.0 + 1400.0) + (int)scAdj + pushBGTopHack;
58053 }
58054 if (bgTexIndexes[0] == 184)
58055 {
58056 bgTopY = (int)(backgroundTopMagicNumber * 1600.0 + 1400.0) + (int)scAdj + pushBGTopHack;
58057 }
58058 if (gameMenu)
58059 {
58060 bgTopY = 320 + pushBGTopHack;
58061 }
58062 if (bgTexIndexes[0] == 50)
58063 {
58064 bgTopY -= 50;
58065 }
58066 if (bgTexIndexes[0] == 53)
58067 {
58068 bgTopY -= 100;
58069 }
58070 if (bgTexIndexes[0] == 91)
58071 {
58072 bgTopY += 200;
58073 }
58074 if (bgTexIndexes[0] == 173)
58075 {
58076 bgTopY += 200;
58077 }
58078 if (bgTexIndexes[0] == 178)
58079 {
58080 bgTopY += 75;
58081 }
58083 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
58084 {
58085 for (int i = 0; i < bgLoops; i++)
58086 {
58087 if (bgTexIndexes[0] != -1)
58088 {
58090 int num = bgTexIndexes[0];
58091 if (num == 173)
58092 {
58093 int num2 = (int)(GetBackgroundCounter() / 10);
58094 num2 %= 4;
58095 int num3 = 251 + num2;
58098 }
58099 if (val.Value != null)
58100 {
58102 }
58103 }
58104 }
58105 }
58106 }
58107 if (bgTexIndexes[1] >= 0)
58108 {
58110 bgScale = 1.31f;
58112 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
58113 if (bgWidthScaled == 0)
58114 {
58115 bgWidthScaled = 1;
58116 }
58117 bgParallax = 0.43;
58119 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
58120 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
58121 bgTopY = (int)(backgroundTopMagicNumber * 1950.0 + 1750.0) + (int)scAdj + pushBGTopHack;
58122 if (gameMenu)
58123 {
58124 bgTopY = 400 + pushBGTopHack;
58125 bgStartX -= 80;
58126 }
58127 if (bgTexIndexes[1] == 51)
58128 {
58129 bgTopY -= 50;
58130 }
58131 if (bgTexIndexes[1] == 54)
58132 {
58133 bgTopY -= 100;
58134 }
58136 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
58137 {
58138 for (int j = 0; j < bgLoops; j++)
58139 {
58141 }
58142 }
58143 }
58144 if (bgTexIndexes[2] < 0)
58145 {
58146 return;
58147 }
58149 bgScale = 1.34f;
58151 bgParallax = 0.49;
58153 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
58154 if (bgTexIndexes[0] == 91)
58155 {
58156 bgScale = 1.3f;
58158 bgParallax = 0.42;
58159 }
58160 if (bgTexIndexes[2] < 0 && WorldGen.drunkWorldGen)
58161 {
58162 return;
58163 }
58164 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
58165 if (bgWidthScaled == 0)
58166 {
58167 bgWidthScaled = 1;
58168 }
58169 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
58170 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2000.0) + (int)scAdj + pushBGTopHack;
58171 if (gameMenu)
58172 {
58173 bgTopY = 480 + pushBGTopHack;
58174 bgStartX -= 120;
58175 }
58176 if (bgTexIndexes[2] == 52)
58177 {
58178 bgTopY -= 50;
58179 }
58180 if (bgTexIndexes[2] == 55)
58181 {
58182 bgTopY -= 100;
58183 }
58184 if (bgTexIndexes[2] == 92)
58185 {
58186 bgTopY += 150;
58187 }
58189 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
58190 {
58191 for (int k = 0; k < bgLoops; k++)
58192 {
58194 }
58195 }
58196 }
58197
58199 {
58200 float value = (float)(worldSurface + 2.0) * 16f - screenPosition.Y;
58201 float value2 = (float)maxTilesY * 16f - 2880f - (screenPosition.Y + (float)screenHeight);
58204 if (value2 - value > 0f)
58205 {
58207 }
58208 }
58209
58211 {
58213 if (drawToScreen)
58214 {
58216 }
58217 bool flag = ShouldShowInvisibleWalls();
58218 for (int i = 0; i < hitter.data.Length; i++)
58219 {
58220 if (hitter.data[i].type != crackType)
58221 {
58222 continue;
58223 }
58224 int damage = hitter.data[i].damage;
58225 if (damage < 20)
58226 {
58227 continue;
58228 }
58229 int x = hitter.data[i].X;
58230 int y = hitter.data[i].Y;
58231 if (!WorldGen.InWorld(x, y))
58232 {
58233 continue;
58234 }
58235 bool flag2 = tile[x, y] != null;
58236 if (flag2 && crackType == 1)
58237 {
58238 flag2 = flag2 && tile[x, y].active() && (flag || !tile[x, y].invisibleBlock());
58239 }
58240 if (flag2 && crackType == 2)
58241 {
58242 flag2 = flag2 && tile[x, y].wall != 0 && (flag || !tile[x, y].invisibleWall());
58243 }
58244 if (!flag2)
58245 {
58246 continue;
58247 }
58248 bool flag3 = false;
58249 bool flag4 = false;
58250 if (tile[x, y].type == 10)
58251 {
58252 flag3 = false;
58253 }
58254 else if (tileSolid[tile[x, y].type] && !tileSolidTop[tile[x, y].type])
58255 {
58256 flag3 = true;
58257 }
58258 else if (WorldGen.IsTreeType(tile[x, y].type))
58259 {
58260 flag4 = true;
58261 int num = tile[x, y].frameX / 22;
58262 int num2 = tile[x, y].frameY / 22;
58263 if (num2 < 9)
58264 {
58265 flag3 = ((num != 1 && num != 2) || num2 < 6 || num2 > 8) && (num != 3 || num2 > 2) && (num != 4 || num2 < 3 || num2 > 5) && ((num != 5 || num2 < 6 || num2 > 8) ? true : false);
58266 }
58267 }
58268 else if (tile[x, y].type == 72)
58269 {
58270 flag4 = true;
58271 if (tile[x, y].frameX <= 34)
58272 {
58273 flag3 = true;
58274 }
58275 }
58276 if (flag3 && tile[x, y].slope() == 0 && !tile[x, y].halfBrick())
58277 {
58278 int num3 = 0;
58279 if (damage >= 80)
58280 {
58281 num3 = 3;
58282 }
58283 else if (damage >= 60)
58284 {
58285 num3 = 2;
58286 }
58287 else if (damage >= 40)
58288 {
58289 num3 = 1;
58290 }
58291 else if (damage >= 20)
58292 {
58293 num3 = 0;
58294 }
58295 Microsoft.Xna.Framework.Rectangle value = new Microsoft.Xna.Framework.Rectangle(hitter.data[i].crackStyle * 18, num3 * 18, 16, 16);
58296 if (flag4)
58297 {
58298 value.X = (4 + hitter.data[i].crackStyle / 2) * 18;
58299 }
58300 spriteBatch.Draw(TextureAssets.TileCrack.Value, new Vector2(x * 16 - (int)screenPosition.X, y * 16 - (int)screenPosition.Y) + vector, value, Lighting.GetColor(x, y), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
58301 }
58302 }
58303 }
58304
58305 private static void CheckMonoliths()
58306 {
58307 if (dedServ)
58308 {
58309 return;
58310 }
58311 bool flag = player[myPlayer].ZoneTowerVortex || player[myPlayer].ZoneTowerNebula || player[myPlayer].ZoneTowerStardust || player[myPlayer].ZoneTowerSolar;
58312 bool stardustMonolithShader = player[myPlayer].stardustMonolithShader;
58313 bool nebulaMonolithShader = player[myPlayer].nebulaMonolithShader;
58314 bool vortexMonolithShader = player[myPlayer].vortexMonolithShader;
58315 bool solarMonolithShader = player[myPlayer].solarMonolithShader;
58316 bool moonLordMonolithShader = player[myPlayer].moonLordMonolithShader;
58317 for (int i = 0; i < MonolithFilterNames.Length; i++)
58318 {
58319 bool flag2 = !flag && i == SceneMetrics.ActiveMonolithType;
58320 if ((i == 0 && vortexMonolithShader) || (i == 1 && nebulaMonolithShader) || (i == 2 && stardustMonolithShader) || (i == 3 && solarMonolithShader) || (i == 4 && moonLordMonolithShader))
58321 {
58322 flag2 = true;
58323 }
58324 if (flag2)
58325 {
58327 {
58329 }
58330 if (!SkyManager.Instance[MonolithSkyNames[i]].IsActive())
58331 {
58332 SkyManager.Instance.Activate(MonolithSkyNames[i], default(Vector2));
58333 }
58334 }
58335 else
58336 {
58338 {
58340 }
58341 if (SkyManager.Instance[MonolithSkyNames[i]].IsActive())
58342 {
58344 }
58345 }
58346 }
58347 }
58348
58349 private void GraphicsDeviceLost(object sender, EventArgs evt)
58350 {
58351 }
58352
58353 protected override void Draw(GameTime gameTime)
58354 {
58356 {
58357 _isDrawingOrUpdating = true;
58360 if (Main.OnPostDraw != null)
58361 {
58363 }
58364 Assets.TransferCompletedAssets();
58365 _isDrawingOrUpdating = false;
58366 }
58367 }
58368
58370 {
58372 stopwatch.Start();
58373 if (showSplash)
58374 {
58376 TimeLogger.SplashDrawTime(stopwatch.Elapsed.TotalMilliseconds);
58378 return;
58379 }
58380 if (_drawCycleCounter == 0L)
58381 {
58383 }
58385 MenuUI.IsVisible = gameMenu && menuMode == 888;
58386 InGameUI.IsVisible = !gameMenu && InGameUI.CurrentState != null;
58389 CaptureManager.Instance.DrawTick();
58391 if (!gameMenu)
58392 {
58394 }
58395 for (int i = 0; i < ContentThatNeedsRenderTargets.Count; i++)
58396 {
58397 ContentThatNeedsRenderTargets[i].PrepareRenderTarget(base.GraphicsDevice, spriteBatch);
58398 }
58401 if (loadMap)
58402 {
58403 refreshMap = false;
58404 DrawToMap();
58406 }
58408 {
58409 drawToScreen = true;
58410 }
58411 else
58412 {
58413 drawToScreen = false;
58414 }
58415 if (drawToScreen && targetSet)
58416 {
58418 }
58419 if (!drawToScreen && !targetSet)
58420 {
58421 InitTargets();
58422 }
58423 fpsCount++;
58424 if (!base.IsActive)
58425 {
58426 maxQ = true;
58427 }
58428 if (!dedServ)
58429 {
58431 if (Main.OnPreDraw != null)
58432 {
58434 }
58435 }
58438 if (stackSplit == 0)
58439 {
58441 stackCounter = 0;
58442 stackDelay = 7;
58443 superFastStack = 0;
58444 }
58445 else
58446 {
58447 stackCounter++;
58448 int num = 30;
58449 num = ((stackDelay == 7) ? 30 : ((stackDelay == 6) ? 25 : ((stackDelay == 5) ? 20 : ((stackDelay == 4) ? 15 : ((stackDelay != 3) ? 5 : 10)))));
58450 if (stackCounter >= num)
58451 {
58452 stackDelay--;
58453 if (stackDelay < 2)
58454 {
58455 stackDelay = 2;
58457 }
58458 if (timesTriedToFastStack < 10)
58459 {
58460 superFastStack = 0;
58461 }
58463 stackCounter = 0;
58464 }
58465 }
58466 if (myPlayer >= 0)
58467 {
58468 player[myPlayer].lastMouseInterface = player[myPlayer].mouseInterface;
58469 player[myPlayer].mouseInterface = false;
58470 }
58471 if (mapTime > 0)
58472 {
58473 mapTime--;
58474 }
58475 if (gameMenu)
58476 {
58478 }
58479 HoverItem = new Item();
58482 sunCircle += 0.01f;
58483 if ((double)sunCircle > 6.285)
58484 {
58485 sunCircle -= 6.285f;
58486 }
58488 if (!gameMenu)
58489 {
58492 if (renderNow)
58493 {
58495 renderNow = false;
58496 renderCount = 99;
58497 Draw(gameTime);
58500 RenderTiles();
58501 sceneTilePos.X = screenPosition.X - (float)offScreenRange;
58502 sceneTilePos.Y = screenPosition.Y - (float)offScreenRange;
58504 sceneBackgroundPos.X = screenPosition.X - (float)offScreenRange;
58505 sceneBackgroundPos.Y = screenPosition.Y - (float)offScreenRange;
58506 RenderWalls();
58507 sceneWallPos.X = screenPosition.X - (float)offScreenRange;
58508 sceneWallPos.Y = screenPosition.Y - (float)offScreenRange;
58509 RenderTiles2();
58510 sceneTile2Pos.X = screenPosition.X - (float)offScreenRange;
58511 sceneTile2Pos.Y = screenPosition.Y - (float)offScreenRange;
58512 RenderWater();
58513 sceneWaterPos.X = screenPosition.X - (float)offScreenRange;
58514 sceneWaterPos.Y = screenPosition.Y - (float)offScreenRange;
58515 renderCount = 99;
58516 }
58517 else
58518 {
58519 if (renderCount == 3)
58520 {
58521 RenderTiles();
58522 sceneTilePos.X = screenPosition.X - (float)offScreenRange;
58523 sceneTilePos.Y = screenPosition.Y - (float)offScreenRange;
58524 }
58525 if (renderCount == 3)
58526 {
58527 RenderTiles2();
58528 sceneTile2Pos.X = screenPosition.X - (float)offScreenRange;
58529 sceneTile2Pos.Y = screenPosition.Y - (float)offScreenRange;
58530 }
58531 if (renderCount == 3)
58532 {
58533 RenderWalls();
58534 sceneWallPos.X = screenPosition.X - (float)offScreenRange;
58535 sceneWallPos.Y = screenPosition.Y - (float)offScreenRange;
58536 }
58537 if (renderCount == 2)
58538 {
58540 sceneBackgroundPos.X = screenPosition.X - (float)offScreenRange;
58541 sceneBackgroundPos.Y = screenPosition.Y - (float)offScreenRange;
58542 }
58543 if (renderCount == 1)
58544 {
58545 RenderWater();
58546 sceneWaterPos.X = screenPosition.X - (float)offScreenRange;
58547 sceneWaterPos.Y = screenPosition.Y - (float)offScreenRange;
58548 }
58549 }
58550 if (render && !gameMenu)
58551 {
58553 {
58554 RenderTiles();
58555 sceneTilePos.X = screenPosition.X - (float)offScreenRange;
58556 sceneTilePos.Y = screenPosition.Y - (float)offScreenRange;
58557 }
58559 {
58560 RenderTiles2();
58561 sceneTile2Pos.X = screenPosition.X - (float)offScreenRange;
58562 sceneTile2Pos.Y = screenPosition.Y - (float)offScreenRange;
58563 }
58565 {
58567 sceneBackgroundPos.X = screenPosition.X - (float)offScreenRange;
58568 sceneBackgroundPos.Y = screenPosition.Y - (float)offScreenRange;
58569 }
58571 {
58572 RenderWalls();
58573 sceneWallPos.X = screenPosition.X - (float)offScreenRange;
58574 sceneWallPos.Y = screenPosition.Y - (float)offScreenRange;
58575 }
58577 {
58578 RenderWater();
58579 sceneWaterPos.X = screenPosition.X - (float)offScreenRange;
58580 sceneWaterPos.Y = screenPosition.Y - (float)offScreenRange;
58581 }
58582 }
58583 }
58584 if (!loadMap)
58585 {
58586 if (!gameMenu)
58587 {
58590 stopwatch2.Start();
58591 int num2 = 0;
58592 int x;
58593 int y;
58594 while (stopwatch2.ElapsedMilliseconds < 5 && sectionManager.GetNextMapDraw(player[myPlayer].position, out x, out y))
58595 {
58596 DrawToMap_Section(x, y);
58597 num2++;
58598 }
58600 }
58601 if (updateMap)
58602 {
58603 if (base.IsActive || netMode == 1)
58604 {
58605 if (refreshMap)
58606 {
58607 refreshMap = false;
58608 sectionManager.ClearMapDraw();
58609 }
58610 DrawToMap();
58611 updateMap = false;
58612 }
58613 else if (MapHelper.numUpdateTile > 0)
58614 {
58615 DrawToMap();
58616 }
58618 }
58619 }
58620 bgParallax = 0.1;
58623 bgStartY = 0;
58624 bgLoopsY = 0;
58625 bgTopY = (int)((double)(0f - screenPosition.Y) / (worldSurface * 16.0 - 600.0) * 200.0);
58626 if (gameMenu || netMode == 2)
58627 {
58628 bgTopY = -200;
58629 }
58630 int num3 = dayRate;
58631 if (num3 < 1)
58632 {
58633 num3 = 1;
58634 }
58635 float num4 = 0.0005f * (float)num3;
58636 if (gameMenu)
58637 {
58638 num4 *= 20f;
58639 }
58640 if (raining)
58641 {
58642 if (cloudAlpha > maxRaining)
58643 {
58644 cloudAlpha -= num4;
58645 if (cloudAlpha < maxRaining)
58646 {
58648 }
58649 }
58650 else if (cloudAlpha < maxRaining)
58651 {
58652 cloudAlpha += num4;
58653 if (cloudAlpha > maxRaining)
58654 {
58656 }
58657 }
58658 }
58659 else
58660 {
58661 cloudAlpha -= num4;
58662 if (cloudAlpha < 0f)
58663 {
58664 cloudAlpha = 0f;
58665 }
58666 }
58667 if (gameMenu || netMode == 2)
58668 {
58669 bgDelay = 1000;
58670 SceneMetrics.EvilTileCount = (int)(bgAlphaFrontLayer[1] * (float)SceneMetrics.CorruptionTileMax);
58671 }
58674 float num5 = SceneMetrics.MushroomTileCount / SceneMetrics.MushroomTileMax;
58676 if (num5 > 0f)
58677 {
58678 if (num5 > num6)
58679 {
58680 num6 += 0.01f;
58681 }
58682 if (num5 < num6)
58683 {
58684 num6 -= 0.01f;
58685 }
58686 }
58687 else
58688 {
58689 num6 -= 0.02f;
58690 }
58691 if (num6 < 0f)
58692 {
58693 num6 = 0f;
58694 }
58695 if (num6 > 1f)
58696 {
58697 num6 = 1f;
58698 }
58701 info.isInGameMenuOrIsServer = gameMenu || netMode == 2;
58702 info.CorruptionBiomeInfluence = (float)SceneMetrics.EvilTileCount / (float)SceneMetrics.CorruptionTileMax;
58703 info.CrimsonBiomeInfluence = (float)SceneMetrics.BloodTileCount / (float)SceneMetrics.CrimsonTileMax;
58704 info.JungleBiomeInfluence = (float)SceneMetrics.JungleTileCount / (float)SceneMetrics.JungleTileMax;
58705 info.MushroomBiomeInfluence = SmoothedMushroomLightInfluence;
58706 info.GraveyardInfluence = GraveyardVisualIntensity;
58707 info.BloodMoonActive = bloodMoon || SceneMetrics.BloodMoonMonolith;
58708 info.LanternNightActive = LanternNight.LanternsUp;
58710 if (gameMenu || netMode == 2)
58711 {
58712 bgTopY = 0;
58713 }
58716 base.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
58717 base.Draw(gameTime);
58718 float val = (float)screenWidth / MinimumZoomComparerX;
58719 float val2 = (float)screenHeight / MinimumZoomComparerY;
58720 ForcedMinimumZoom = Math.Max(Math.Max(1f, val), val2);
58721 GameViewMatrix.Effects = ((!gameMenu && player[myPlayer].gravDir != 1f) ? SpriteEffects.FlipVertically : SpriteEffects.None);
58722 BackgroundViewMatrix.Effects = GameViewMatrix.Effects;
58723 BackgroundViewMatrix.Zoom = new Vector2(ForcedMinimumZoom);
58724 GameViewMatrix.Zoom = new Vector2(ForcedMinimumZoom * MathHelper.Clamp(GameZoomTarget, 1f, 2f));
58725 if (gameMenu || player[myPlayer].gravDir == 1f)
58726 {
58728 }
58729 else
58730 {
58732 }
58733 bool flag = gameMenu;
58735 {
58736 if (!Terraria.Graphics.Effects.Filters.Scene["Sepia"].IsActive())
58737 {
58738 Terraria.Graphics.Effects.Filters.Scene.Activate("Sepia", default(Vector2));
58739 }
58740 flag = false;
58741 }
58742 else if (flag && Terraria.Graphics.Effects.Filters.Scene["Sepia"].IsActive())
58743 {
58744 Terraria.Graphics.Effects.Filters.Scene.Deactivate("Sepia");
58745 }
58746 if (Terraria.Graphics.Effects.Filters.Scene["Sepia"].IsInUse())
58747 {
58748 flag = false;
58749 }
58750 bool flag2 = !(drawToScreen || netMode == 2 || flag) && !mapFullscreen && Lighting.NotRetro && Terraria.Graphics.Effects.Filters.Scene.CanCapture();
58751 if (flag2)
58752 {
58754 }
58757 SceneArea sceneArea = default(SceneArea);
58758 sceneArea.bgTopY = bgTopY;
58759 sceneArea.totalHeight = screenHeight;
58760 sceneArea.totalWidth = screenWidth;
58761 sceneArea.SceneLocalScreenPositionOffset = Vector2.Zero;
58763 if (!mapFullscreen)
58764 {
58765 unityMouseOver = false;
58766 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
58767 {
58770 if (destinationRectangle.Bottom < val3.Height())
58771 {
58772 int num7 = val3.Height() - destinationRectangle.Bottom;
58773 destinationRectangle.Height += num7;
58774 }
58775 if (false)
58776 {
58777 for (int j = 0; j < bgLoops; j++)
58778 {
58779 destinationRectangle.X = bgStartX + val3.Width() * j;
58780 spriteBatch.Draw(val3.Value, destinationRectangle, null, ColorOfTheSkies, 0f, Vector2.Zero, SpriteEffects.FlipVertically, 0f);
58781 }
58782 }
58783 else
58784 {
58785 for (int k = 0; k < bgLoops; k++)
58786 {
58787 destinationRectangle.X = bgStartX + val3.Width() * k;
58788 spriteBatch.Draw(val3.Value, destinationRectangle, ColorOfTheSkies);
58789 }
58790 }
58792 }
58793 spriteBatch.End();
58795 if (shimmerAlpha != 1f)
58796 {
58798 }
58799 if ((double)(screenPosition.Y / 16f) < worldSurface + 2.0)
58800 {
58802 }
58804 }
58806 spriteBatch.End();
58808 int num8 = screenWidth;
58809 int num9 = screenHeight;
58810 screenWidth = (int)((float)screenWidth / BackgroundViewMatrix.Zoom.X);
58811 screenHeight = (int)((float)screenHeight / BackgroundViewMatrix.Zoom.Y);
58812 screenPosition += BackgroundViewMatrix.Translation;
58813 Matrix transformationMatrix = BackgroundViewMatrix.TransformationMatrix;
58814 transformationMatrix.Translation -= BackgroundViewMatrix.ZoomMatrix.Translation * new Vector3(1f, BackgroundViewMatrix.Effects.HasFlag(SpriteEffects.FlipVertically) ? (-1f) : 1f, 1f);
58816 CurrentFrameFlags.Hacks.CurrentBackgroundMatrixForCreditsRoll = transformationMatrix;
58817 DrawBG();
58818 screenWidth = num8;
58821 spriteBatch.End();
58824 spriteBatch.End();
58825 Overlays.Scene.Draw(spriteBatch, RenderLayers.Landscape);
58827 if (gameMenu || netMode == 2)
58828 {
58829 spriteBatch.End();
58834 TimeLogger.MenuDrawTime(stopwatch.Elapsed.TotalMilliseconds);
58836 if (flag2)
58837 {
58839 }
58840 return;
58841 }
58842 spriteBatch.End();
58844 DoLightTiles();
58846 if (mapFullscreen)
58847 {
58848 if (player[myPlayer].talkNPC >= 0 || player[myPlayer].sign >= 0 || (playerInventory && !CaptureManager.Instance.Active))
58849 {
58850 player[myPlayer].ToggleInv();
58851 }
58853 spriteBatch.End();
58856 DrawFPS();
58861 spriteBatch.End();
58862 spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, DefaultSamplerState, null, null, null);
58863 TimeLogger.MapDrawTime(stopwatch.Elapsed.TotalMilliseconds);
58866 CaptureManager.Instance.Update();
58867 if (CaptureManager.Instance.Active)
58868 {
58870 }
58871 spriteBatch.End();
58872 if (mouseLeft)
58873 {
58874 mouseLeftRelease = false;
58875 }
58876 else
58877 {
58878 mouseLeftRelease = true;
58879 }
58880 return;
58881 }
58882 if (shimmerAlpha > 0f)
58883 {
58885 }
58886 Overlays.Scene.Draw(spriteBatch, RenderLayers.InWorldUI);
58888 if (drawToScreen)
58889 {
58890 DrawWaters(isBackground: true);
58891 }
58892 else
58893 {
58896 }
58897 Overlays.Scene.Draw(spriteBatch, RenderLayers.BackgroundWater);
58898 float x2 = (sceneBackgroundPos.X - screenPosition.X + (float)offScreenRange) * caveParallax - (float)offScreenRange;
58899 if (shimmerAlpha > 0f)
58900 {
58901 spriteBatch.End();
58902 spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, DefaultSamplerState, null, null, null);
58905 spriteBatch.End();
58908 }
58909 if (drawToScreen)
58910 {
58911 tileBatch.Begin();
58913 tileBatch.End();
58914 }
58915 else
58916 {
58919 }
58920 Overlays.Scene.Draw(spriteBatch, RenderLayers.Background);
58923 if (magmaBGFrameCounter >= 8)
58924 {
58926 magmaBGFrame++;
58927 if (magmaBGFrame >= 3)
58928 {
58929 magmaBGFrame = 0;
58930 }
58931 }
58933 Overlays.Scene.Draw(spriteBatch, RenderLayers.TilesAndNPCs);
58934 if (!mapFullscreen && mapStyle == 2)
58935 {
58936 try
58937 {
58939 }
58940 catch (Exception e)
58941 {
58942 if (!ignoreErrors)
58943 {
58944 throw;
58945 }
58947 }
58948 }
58950 spriteBatch.End();
58958 ParticleSystem_World_BehindPlayers.Settings.AnchorPosition = -screenPosition;
58960 spriteBatch.End();
58964 ParticleSystem_World_OverPlayers.Settings.AnchorPosition = -screenPosition;
58966 spriteBatch.End();
58968 DrawCachedNPCs(DrawCacheNPCsOverPlayers, behindTiles: false);
58969 if (!gamePaused)
58970 {
58971 essScale += (float)essDir * 0.01f;
58972 if (essScale > 1f)
58973 {
58974 essDir = -1;
58975 essScale = 1f;
58976 }
58977 if ((double)essScale < 0.7)
58978 {
58979 essDir = 1;
58980 essScale = 0.7f;
58981 }
58982 }
58983 DrawItems();
58985 DrawRain();
58986 if (ignoreErrors)
58987 {
58988 try
58989 {
58990 DrawGore();
58991 }
58992 catch (Exception e2)
58993 {
58995 }
58996 }
58997 else
58998 {
58999 DrawGore();
59000 }
59001 spriteBatch.End();
59002 DrawDust();
59004 Overlays.Scene.Draw(spriteBatch, RenderLayers.Entities);
59005 if (drawToScreen)
59006 {
59007 DrawWaters();
59009 {
59010 DrawWires();
59011 }
59012 }
59013 else
59014 {
59017 {
59018 DrawWires();
59019 }
59021 }
59022 if (shimmerAlpha > 0f)
59023 {
59024 spriteBatch.End();
59025 spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, DefaultSamplerState, null, null, null, BackgroundViewMatrix.EffectMatrix);
59028 spriteBatch.End();
59031 }
59032 Overlays.Scene.Draw(spriteBatch, RenderLayers.ForegroundWater);
59039 spriteBatch.End();
59041 if (flag2)
59042 {
59044 }
59046 if (!hideUI)
59047 {
59051 spriteBatch.End();
59052 spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, DefaultSamplerState, null, null, null, GameViewMatrix.ZoomMatrix);
59054 for (int l = 0; l < 100; l++)
59055 {
59056 if (!combatText[l].active)
59057 {
59058 continue;
59059 }
59060 int num10 = 0;
59061 if (combatText[l].crit)
59062 {
59063 num10 = 1;
59064 }
59065 Vector2 vector2 = FontAssets.CombatText[num10].Value.MeasureString(combatText[l].text);
59066 Vector2 vector3 = new Vector2(vector2.X * 0.5f, vector2.Y * 0.5f);
59067 float num11 = combatText[l].scale / targetScale;
59068 float num12 = (int)combatText[l].color.R;
59069 float num13 = (int)combatText[l].color.G;
59070 float num14 = (int)combatText[l].color.B;
59071 float num15 = (int)combatText[l].color.A;
59072 num12 *= num11 * combatText[l].alpha * 0.3f;
59073 num14 *= num11 * combatText[l].alpha * 0.3f;
59074 num13 *= num11 * combatText[l].alpha * 0.3f;
59075 num15 *= num11 * combatText[l].alpha;
59076 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int)num12, (int)num13, (int)num14, (int)num15);
59077 for (int m = 0; m < 5; m++)
59078 {
59079 float num16 = 0f;
59080 float num17 = 0f;
59081 switch (m)
59082 {
59083 case 0:
59084 num16 -= targetScale;
59085 break;
59086 case 1:
59087 num16 += targetScale;
59088 break;
59089 case 2:
59090 num17 -= targetScale;
59091 break;
59092 case 3:
59093 num17 += targetScale;
59094 break;
59095 default:
59096 num12 = (float)(int)combatText[l].color.R * num11 * combatText[l].alpha;
59097 num14 = (float)(int)combatText[l].color.B * num11 * combatText[l].alpha;
59098 num13 = (float)(int)combatText[l].color.G * num11 * combatText[l].alpha;
59099 num15 = (float)(int)combatText[l].color.A * num11 * combatText[l].alpha;
59100 color = new Microsoft.Xna.Framework.Color((int)num12, (int)num13, (int)num14, (int)num15);
59101 break;
59102 }
59103 if (player[myPlayer].gravDir == -1f)
59104 {
59105 float num18 = combatText[l].position.Y - screenPosition.Y;
59106 num18 = (float)screenHeight - num18;
59108 }
59109 else
59110 {
59112 }
59113 }
59114 }
59116 if (targetScale == 0f)
59117 {
59118 targetScale = 1f;
59119 }
59122 spriteBatch.End();
59125 DrawFPS();
59126 spriteBatch.End();
59127 spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, DefaultSamplerState, null, null, null, GameViewMatrix.ZoomMatrix);
59129 if (BlackFadeIn > 0)
59130 {
59131 if (BlackFadeIn < 0)
59132 {
59133 BlackFadeIn = 0;
59134 }
59135 int num19 = BlackFadeIn;
59136 if (num19 > 255)
59137 {
59138 num19 = 255;
59139 }
59140 BlackFadeIn -= 25;
59142 }
59143 spriteBatch.End();
59144 if (!mapFullscreen)
59145 {
59146 if (ignoreErrors)
59147 {
59148 try
59149 {
59151 }
59152 catch (Exception e3)
59153 {
59155 }
59156 }
59157 else
59158 {
59160 }
59161 }
59163 }
59164 else
59165 {
59166 maxQ = true;
59167 }
59169 if (mouseLeft)
59170 {
59171 mouseLeftRelease = false;
59172 }
59173 else
59174 {
59175 mouseLeftRelease = true;
59176 }
59177 if (mouseRight)
59178 {
59179 mouseRightRelease = false;
59180 }
59181 else
59182 {
59183 mouseRightRelease = true;
59184 }
59185 if (!PlayerInput.Triggers.Current.MouseRight && !PlayerInput.Triggers.Current.MouseLeft && !preventStackSplitReset)
59186 {
59187 stackSplit = 0;
59188 }
59189 if (stackSplit > 0)
59190 {
59191 stackSplit--;
59192 if (stackSplit == 0)
59193 {
59194 preventStackSplitReset = false;
59195 }
59196 }
59197 TimeLogger.RenderTime(renderCount, stopwatch.Elapsed.TotalMilliseconds);
59199 }
59200
59201 private static void DrawItemTextPopups(float scaleTarget)
59202 {
59203 for (int i = 0; i < 20; i++)
59204 {
59206 if (!popupText.active)
59207 {
59208 continue;
59209 }
59210 string text = popupText.name;
59211 if (popupText.stack > 1)
59212 {
59213 text = text + " (" + popupText.stack + ")";
59214 }
59215 Vector2 vector = FontAssets.MouseText.Value.MeasureString(text);
59216 Vector2 vector2 = new Vector2(vector.X * 0.5f, vector.Y * 0.5f);
59217 float num = popupText.scale / scaleTarget;
59218 int num2 = (int)(255f - 255f * num);
59219 float num3 = (int)popupText.color.R;
59220 float num4 = (int)popupText.color.G;
59221 float num5 = (int)popupText.color.B;
59222 float num6 = (int)popupText.color.A;
59223 num3 *= num * popupText.alpha * 0.3f;
59224 num5 *= num * popupText.alpha * 0.3f;
59225 num4 *= num * popupText.alpha * 0.3f;
59226 num6 *= num * popupText.alpha;
59227 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int)num3, (int)num4, (int)num5, (int)num6);
59229 float num7 = 1f;
59230 Texture2D texture2D = null;
59231 switch (popupText.context)
59232 {
59233 case PopupTextContext.ItemPickupToVoidContainer:
59234 color2 = new Microsoft.Xna.Framework.Color(127, 20, 255) * 0.4f;
59235 num7 = 0.8f;
59236 break;
59237 case PopupTextContext.SonarAlert:
59238 color2 = Microsoft.Xna.Framework.Color.Blue * 0.4f;
59239 if (popupText.npcNetID != 0)
59240 {
59241 color2 = Microsoft.Xna.Framework.Color.Red * 0.4f;
59242 }
59243 num7 = 1f;
59244 break;
59245 }
59246 float num8 = (float)num2 / 255f;
59247 for (int j = 0; j < 5; j++)
59248 {
59249 color = color2;
59250 float num9 = 0f;
59251 float num10 = 0f;
59252 switch (j)
59253 {
59254 case 0:
59255 num9 -= scaleTarget * 2f;
59256 break;
59257 case 1:
59258 num9 += scaleTarget * 2f;
59259 break;
59260 case 2:
59261 num10 -= scaleTarget * 2f;
59262 break;
59263 case 3:
59264 num10 += scaleTarget * 2f;
59265 break;
59266 default:
59267 color = popupText.color * num * popupText.alpha * num7;
59268 break;
59269 }
59270 if (j < 4)
59271 {
59272 num6 = (float)(int)popupText.color.A * num * popupText.alpha;
59273 color = new Microsoft.Xna.Framework.Color(0, 0, 0, (int)num6);
59274 }
59275 if (color2 != Microsoft.Xna.Framework.Color.Black && j < 4)
59276 {
59277 num9 *= 1.3f + 1.3f * num8;
59278 num10 *= 1.3f + 1.3f * num8;
59279 }
59280 float num11 = popupText.position.Y - screenPosition.Y + num10;
59281 if (player[myPlayer].gravDir == -1f)
59282 {
59283 num11 = (float)screenHeight - num11;
59284 }
59285 if (color2 != Microsoft.Xna.Framework.Color.Black && j < 4)
59286 {
59288 color3.A = (byte)MathHelper.Lerp(60f, 127f, Utils.GetLerpValue(0f, 255f, num6, clamped: true));
59291 }
59292 else
59293 {
59295 }
59296 if (texture2D != null)
59297 {
59298 float scale = (1.3f - num8) * popupText.scale * 0.7f;
59299 Vector2 vector3 = new Vector2(popupText.position.X - screenPosition.X + num9 + vector2.X, num11 + vector2.Y);
59301 if (j == 4)
59302 {
59303 color4 = Microsoft.Xna.Framework.Color.White * 0.6f;
59304 }
59305 color4.A = (byte)((float)(int)color4.A * 0.5f);
59306 int num12 = 25;
59307 spriteBatch.Draw(texture2D, vector3 + new Vector2(vector2.X * -0.5f - (float)num12 - texture2D.Size().X / 2f, 0f), null, color4 * popupText.scale, 0f, texture2D.Size() / 2f, scale, SpriteEffects.None, 0f);
59308 spriteBatch.Draw(texture2D, vector3 + new Vector2(vector2.X * 0.5f + (float)num12 + texture2D.Size().X / 2f, 0f), null, color4 * popupText.scale, 0f, texture2D.Size() / 2f, scale, SpriteEffects.None, 0f);
59309 }
59310 }
59311 }
59312 }
59313
59314 private static void DoDraw_UpdateCameraPosition()
59315 {
59316 Vector3 vector = new Vector3(1f, 1f, 1f);
59317 Vector3 vector2 = Vector3.One / vector;
59318 if (gameMenu || netMode == 2)
59319 {
59320 return;
59321 }
59322 int num = 21;
59323 if (cameraX != 0f && !Main.player[myPlayer].pulley)
59324 {
59325 cameraX = 0f;
59326 }
59327 if (cameraX > 0f)
59328 {
59329 cameraX -= 1f;
59330 if (cameraX < 0f)
59331 {
59332 cameraX = 0f;
59333 }
59334 }
59335 if (cameraX < 0f)
59336 {
59337 cameraX += 1f;
59338 if (cameraX > 0f)
59339 {
59340 cameraX = 0f;
59341 }
59342 }
59344 screenPosition.X = Main.player[myPlayer].position.X + (float)Main.player[myPlayer].width * 0.5f - (float)screenWidth * 0.5f * vector2.X + cameraX;
59345 screenPosition.Y = Main.player[myPlayer].position.Y + (float)Main.player[myPlayer].height - (float)num - (float)screenHeight * 0.5f * vector2.Y + Main.player[myPlayer].gfxOffY;
59347 float num2 = 0f;
59348 float num3 = 0f;
59349 float num4 = 36f;
59350 bool flag = false;
59352 if (!Main.player[myPlayer].dead)
59353 {
59355 {
59357 if (LocalPlayer.gravDir == -1f)
59358 {
59359 vector3.Y *= -1f;
59360 }
59361 vector4 = vector3;
59362 vector3 = CurrentPan * 0.87f + vector3 * 0.13f;
59363 flag = true;
59365 }
59366 else if (LocalGolfState != null && (LocalGolfState.ShouldCameraTrackBallLastKnownLocation || LocalGolfState.IsTrackingBall))
59367 {
59368 if (LocalGolfState.IsTrackingBall)
59369 {
59370 Projectile lastHitBall = LocalGolfState.GetLastHitBall();
59371 vector3 = lastHitBall.Center - LocalPlayer.Center;
59372 vector4 = vector3;
59374 if (lastHitBall.velocity.Length() > 20f)
59375 {
59376 num4 *= 2f;
59377 }
59378 vector3 = CurrentPan * 0.87f + vector3 * 0.13f;
59379 flag = true;
59380 }
59381 else if (LocalGolfState.ShouldCameraTrackBallLastKnownLocation)
59382 {
59383 Vector2? lastBallLocation = LocalGolfState.GetLastBallLocation();
59384 if (lastBallLocation.HasValue)
59385 {
59386 vector3 = lastBallLocation.Value - LocalPlayer.Center;
59387 vector4 = vector3;
59389 vector3 = CurrentPan * 0.87f + vector3 * 0.13f;
59390 flag = true;
59391 }
59392 }
59393 }
59394 else if ((Main.player[myPlayer].noThrow <= 0 && !Main.player[myPlayer].lastMouseInterface) || !(CurrentPan == Vector2.Zero))
59395 {
59397 {
59400 {
59401 float num5 = -1f;
59402 if (player.inventory[player.selectedItem].type == 1254 && player.scope)
59403 {
59404 num5 = 0.8f;
59405 }
59406 else if (player.inventory[player.selectedItem].type == 1254)
59407 {
59408 num5 = 2f / 3f;
59409 }
59410 else if (player.inventory[player.selectedItem].type == 1299)
59411 {
59412 num5 = 2f / 3f;
59413 }
59414 else if (player.scope)
59415 {
59416 num5 = 0.5f;
59417 }
59419 num4 = 48f;
59420 if (vector5 != Vector2.Zero && num5 != -1f)
59421 {
59423 vector3.X = vector6.X;
59424 vector3.Y = vector6.Y;
59425 flag = true;
59426 }
59427 }
59428 }
59429 else if (Main.player[myPlayer].inventory[Main.player[myPlayer].selectedItem].type == 1254 && Main.player[myPlayer].scope && mouseRight)
59430 {
59431 int num6 = mouseX;
59432 int num7 = mouseY;
59433 if (num6 > screenWidth)
59434 {
59435 num6 = screenWidth;
59436 }
59437 if (num6 < 0)
59438 {
59439 num6 = 0;
59440 }
59441 if (num7 > screenHeight)
59442 {
59444 }
59445 if (num7 < 0)
59446 {
59447 num7 = 0;
59448 }
59449 vector3.X = (float)(num6 - screenWidth / 2) / 1.25f;
59450 vector3.Y = (float)(num7 - screenHeight / 2) / 1.25f;
59451 flag = true;
59452 }
59453 else if (Main.player[myPlayer].inventory[Main.player[myPlayer].selectedItem].type == 1254 && mouseRight)
59454 {
59455 int num8 = mouseX;
59456 int num9 = mouseY;
59457 if (num8 > screenWidth)
59458 {
59459 num8 = screenWidth;
59460 }
59461 if (num8 < 0)
59462 {
59463 num8 = 0;
59464 }
59465 if (num9 > screenHeight)
59466 {
59468 }
59469 if (num9 < 0)
59470 {
59471 num9 = 0;
59472 }
59473 vector3.X = (float)(num8 - screenWidth / 2) / 1.5f;
59474 vector3.Y = (float)(num9 - screenHeight / 2) / 1.5f;
59475 flag = true;
59476 }
59477 else if (Main.player[myPlayer].inventory[Main.player[myPlayer].selectedItem].type == 1299 && Main.player[myPlayer].selectedItem != 58)
59478 {
59479 int num10 = mouseX;
59480 int num11 = mouseY;
59481 if (num10 > screenWidth)
59482 {
59484 }
59485 if (num10 < 0)
59486 {
59487 num10 = 0;
59488 }
59489 if (num11 > screenHeight)
59490 {
59492 }
59493 if (num11 < 0)
59494 {
59495 num11 = 0;
59496 }
59497 vector3.X = (float)(num10 - screenWidth / 2) / 1.5f;
59498 vector3.Y = (float)(num11 - screenHeight / 2) / 1.5f;
59499 flag = true;
59500 }
59501 else if (Main.player[myPlayer].scope && mouseRight)
59502 {
59503 int num12 = mouseX;
59504 int num13 = mouseY;
59505 if (num12 > screenWidth)
59506 {
59508 }
59509 if (num12 < 0)
59510 {
59511 num12 = 0;
59512 }
59513 if (num13 > screenHeight)
59514 {
59516 }
59517 if (num13 < 0)
59518 {
59519 num13 = 0;
59520 }
59521 vector3.X = (float)(num12 - screenWidth / 2) / 2f;
59522 vector3.Y = (float)(num13 - screenHeight / 2) / 2f;
59523 flag = true;
59524 }
59525 }
59526 }
59527 if (float.IsNaN(CurrentPan.X))
59528 {
59529 CurrentPan.X = 0f;
59530 }
59531 if (float.IsNaN(CurrentPan.Y))
59532 {
59533 CurrentPan.Y = 0f;
59534 }
59536 float num14 = value2.Length();
59537 float amount = 1f;
59538 if (num3 > num2 + 0.0001f)
59539 {
59540 amount = MathHelper.Clamp((num14 - num2) / (num3 - num2), 0f, 1f);
59541 }
59542 float value3 = MathHelper.SmoothStep(0f, num14, amount);
59545 {
59547 float num15 = Math.Abs(vector7.X);
59548 float num16 = Math.Abs(vector7.Y);
59549 float num17 = vector7.Length();
59550 if ((num15 >= (float)(screenWidth / 2) || num16 >= (float)(screenHeight / 2)) && num17 >= new Vector2(screenWidth, screenHeight).Length() / 2f + 100f)
59551 {
59552 renderNow = true;
59556 BlackFadeIn = 255;
59557 if (mapTime < 5)
59558 {
59559 mapTime = 5;
59560 }
59561 maxQ = true;
59562 Lighting.Clear();
59564 LocalPlayer.ForceUpdateBiomes();
59565 }
59566 }
59567 if (vector3 == Vector2.Zero && !flag)
59568 {
59569 float num18 = Math.Abs(value2.X);
59570 float num19 = Math.Abs(value2.Y);
59571 float num20 = value2.Length();
59572 if (num18 >= (float)(screenWidth / 2) || num19 >= (float)(screenHeight / 2))
59573 {
59574 renderNow = true;
59575 CurrentPan *= 0.9f;
59576 if (_cameraPanHasBlackTransition && num20 >= new Vector2(screenWidth, screenHeight).Length() / 2f + 100f)
59577 {
59580 BlackFadeIn = 255;
59581 if (mapTime < 5)
59582 {
59583 mapTime = 5;
59584 }
59585 maxQ = true;
59586 Lighting.Clear();
59589 LocalPlayer.ForceUpdateBiomes();
59590 }
59591 }
59592 else if (value3 > 0.0001f)
59593 {
59595 }
59596 }
59597 else if (value3 > 0.0001f)
59598 {
59600 }
59601 screenPosition.X += CurrentPan.X;
59602 screenPosition.Y += CurrentPan.Y * Main.player[myPlayer].gravDir;
59603 if (cameraLerp > 0f)
59604 {
59606 {
59607 cameraLerp = 0f;
59608 cameraGamePadLerp = false;
59609 }
59610 else
59611 {
59613 }
59614 }
59615 instance.CameraModifiers.ApplyTo(ref screenPosition);
59616 screenPosition.X = (int)screenPosition.X;
59617 screenPosition.Y = (int)screenPosition.Y;
59619 }
59620
59621 public static bool IsItDay()
59622 {
59623 if (remixWorld)
59624 {
59625 return false;
59626 }
59627 return dayTime;
59628 }
59629
59630 public static double starGameMath(double value = 1.0)
59631 {
59632 if (!starGame)
59633 {
59634 return 1.0;
59635 }
59636 double num = (double)starsHit / 200.0;
59637 if (num > 1.0)
59638 {
59639 num = 1.0;
59640 }
59641 return 1.0 + num * value;
59642 }
59643
59645 {
59647 int num = moonType;
59648 if (!TextureAssets.Moon.IndexInRange(num))
59649 {
59650 num = Utils.Clamp(num, 0, 8);
59651 }
59652 Texture2D value2 = TextureAssets.Moon[num].Value;
59653 int num2 = sceneArea.bgTopY;
59654 int num3 = (int)(time / 54000.0 * (double)(sceneArea.totalWidth + (float)(value.Width * 2))) - value.Width;
59655 int num4 = 0;
59656 float num5 = 1f;
59657 float rotation = (float)(time / 54000.0) * 2f - 7.3f;
59658 int num6 = (int)(time / 32400.0 * (double)(sceneArea.totalWidth + (float)(value2.Width * 2))) - value2.Width;
59659 int num7 = 0;
59660 float num8 = 1f;
59661 float num9 = (float)(time / 32400.0) * 2f - 7.3f;
59662 if (dayTime)
59663 {
59664 double num10;
59665 if (time < 27000.0)
59666 {
59667 num10 = Math.Pow(1.0 - time / 54000.0 * 2.0, 2.0);
59668 num4 = (int)((double)num2 + num10 * 250.0 + 180.0);
59669 }
59670 else
59671 {
59672 num10 = Math.Pow((time / 54000.0 - 0.5) * 2.0, 2.0);
59673 num4 = (int)((double)num2 + num10 * 250.0 + 180.0);
59674 }
59675 num5 = (float)(1.2 - num10 * 0.4);
59676 }
59677 else
59678 {
59679 double num11;
59680 if (time < 16200.0)
59681 {
59682 num11 = Math.Pow(1.0 - time / 32400.0 * 2.0, 2.0);
59683 num7 = (int)((double)num2 + num11 * 250.0 + 180.0);
59684 }
59685 else
59686 {
59687 num11 = Math.Pow((time / 32400.0 - 0.5) * 2.0, 2.0);
59688 num7 = (int)((double)num2 + num11 * 250.0 + 180.0);
59689 }
59690 num8 = (float)(1.2 - num11 * 0.4);
59691 }
59694 if (starGame)
59695 {
59697 {
59699 if (rand.Next(60) == 0)
59700 {
59701 for (int i = 0; i < numStars; i++)
59702 {
59703 if (star[i].hidden)
59704 {
59705 Star.SpawnStars(i);
59706 }
59707 }
59708 }
59709 if (dayTime)
59710 {
59711 dayTime = false;
59712 time = 0.0;
59713 }
59714 }
59715 else
59716 {
59717 starGame = false;
59718 }
59719 }
59720 else
59721 {
59722 starsHit = 0;
59723 }
59724 if (dayTime)
59725 {
59727 {
59728 return;
59729 }
59730 num5 *= 1.1f;
59731 float num12 = 1f - tempMushroomInfluence;
59732 num12 -= cloudAlpha * 1.5f * atmo;
59733 if (num12 < 0f)
59734 {
59735 num12 = 0f;
59736 }
59737 Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((byte)(255f * num12), (byte)((float)(int)sunColor.G * num12), (byte)((float)(int)sunColor.B * num12), (byte)(255f * num12));
59738 Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((byte)((float)(int)sunColor.R * num12), (byte)((float)(int)sunColor.G * num12), (byte)((float)(int)sunColor.B * num12), (byte)((float)(int)sunColor.B * num12));
59739 bool flag = false;
59740 if (eclipse)
59741 {
59742 value = TextureAssets.Sun3.Value;
59743 flag = true;
59744 }
59745 else if (!gameMenu && player[myPlayer].head == 12)
59746 {
59747 value = TextureAssets.Sun2.Value;
59748 flag = true;
59749 }
59750 if (flag)
59751 {
59752 color2 = new Microsoft.Xna.Framework.Color((byte)((float)(int)sunColor.R * num12), (byte)((float)(int)sunColor.G * num12), (byte)((float)(int)sunColor.B * num12), (byte)((float)(sunColor.B - 60) * num12));
59753 }
59754 Vector2 origin = value.Size() / 2f;
59755 Vector2 position = new Vector2(num3, num4 + sunModY) + sceneArea.SceneLocalScreenPositionOffset;
59756 spriteBatch.Draw(value, position, null, color, rotation, origin, num5, SpriteEffects.None, 0f);
59757 spriteBatch.Draw(value, position, null, color2, rotation, origin, num5, SpriteEffects.None, 0f);
59758 }
59759 if (!dayTime)
59760 {
59761 float num13 = 1f - cloudAlpha * 1.5f * atmo;
59762 if (num13 < 0f)
59763 {
59764 num13 = 0f;
59765 }
59766 moonColor *= num13;
59767 Vector2 position2 = new Vector2(num6, num7 + moonModY) + sceneArea.SceneLocalScreenPositionOffset;
59769 {
59771 }
59772 else if (pumpkinMoon)
59773 {
59775 }
59776 else if (snowMoon)
59777 {
59779 }
59780 else
59781 {
59782 spriteBatch.Draw(TextureAssets.Moon[num].Value, position2, new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.Moon[num].Width() * moonPhase, TextureAssets.Moon[num].Width(), TextureAssets.Moon[num].Width()), moonColor, num9, new Vector2(TextureAssets.Moon[num].Width() / 2, TextureAssets.Moon[num].Width() / 2), num8, SpriteEffects.None, 0f);
59783 }
59784 }
59785 Microsoft.Xna.Framework.Rectangle value3 = ((!dayTime) ? new Microsoft.Xna.Framework.Rectangle((int)((double)num6 - (double)TextureAssets.Moon[num].Width() * 0.5 * (double)num8), (int)((double)num7 - (double)TextureAssets.Moon[num].Width() * 0.5 * (double)num8 + (double)moonModY), (int)((float)TextureAssets.Moon[num].Width() * num8), (int)((float)TextureAssets.Moon[num].Width() * num8)) : new Microsoft.Xna.Framework.Rectangle((int)((double)num3 - (double)TextureAssets.Sun.Width() * 0.5 * (double)num5), (int)((double)num4 - (double)TextureAssets.Sun.Height() * 0.5 * (double)num5 + (double)sunModY), (int)((float)TextureAssets.Sun.Width() * num5), (int)((float)TextureAssets.Sun.Width() * num5)));
59786 value3.Offset((int)sceneArea.SceneLocalScreenPositionOffset.X, (int)sceneArea.SceneLocalScreenPositionOffset.Y);
59788 sunModY = (short)((double)sunModY * 0.999);
59789 moonModY = (short)((double)moonModY * 0.999);
59790 if (!gameMenu || netMode == 1)
59791 {
59792 return;
59793 }
59794 if (rectangle.Intersects(value3) || alreadyGrabbingSunOrMoon)
59795 {
59796 player[myPlayer].mouseInterface = true;
59797 }
59798 if ((mouseLeft || starGame) && hasFocus)
59799 {
59800 if (!rectangle.Intersects(value3) && !alreadyGrabbingSunOrMoon)
59801 {
59802 return;
59803 }
59804 if (dayTime)
59805 {
59806 time = 54000.0 * (double)((float)(mouseX + TextureAssets.Sun.Width()) / ((float)screenWidth + (float)(TextureAssets.Sun.Width() * 2)));
59807 sunModY = (short)(mouseY - num4);
59808 if (time > 53990.0)
59809 {
59810 time = 53990.0;
59811 }
59812 }
59813 else
59814 {
59815 time = 32400.0 * (double)((float)(mouseX + TextureAssets.Moon[num].Width()) / ((float)screenWidth + (float)(TextureAssets.Moon[num].Width() * 2)));
59816 moonModY = (short)(mouseY - num7);
59817 if (time > 32390.0)
59818 {
59819 time = 32390.0;
59820 }
59821 }
59822 if (time < 10.0)
59823 {
59824 time = 10.0;
59825 }
59827 }
59828 else
59829 {
59831 }
59832 }
59833
59835 {
59836 if (netMode == 2 || ((double)screenPosition.Y >= worldSurface * 16.0 + 16.0 && shimmerAlpha == 0f))
59837 {
59838 return;
59839 }
59840 float num = 1f;
59841 if (GraveyardVisualIntensity > 0f)
59842 {
59843 float num2 = 1f - GraveyardVisualIntensity * 1.4f;
59844 if (num2 <= 0f)
59845 {
59846 return;
59847 }
59848 num *= num2;
59849 }
59851 if (shimmerAlpha > 0f)
59852 {
59854 }
59855 if (remixWorld || !(255f * (1f - cloudAlpha * atmo) - (float)(int)colorOfTheSkies.R - 25f <= 0f))
59856 {
59857 for (int i = 0; i < numStars; i++)
59858 {
59860 }
59861 }
59862 }
59863
59865 {
59866 }
59867
59869 {
59870 if (theStar == null || theStar.hidden)
59871 {
59872 return;
59873 }
59874 float num = shimmerAlpha;
59876 float num2 = 1f - theStar.fadeIn;
59877 int num3 = (int)((float)(255 - bgColorForStars.R - 100) * theStar.twinkle * num2);
59878 int num4 = (int)((float)(255 - bgColorForStars.G - 100) * theStar.twinkle * num2);
59879 int num5 = (int)((float)(255 - bgColorForStars.B - 100) * theStar.twinkle * num2);
59880 num3 = (num3 + num5 + num4) / 3;
59881 if (num3 <= 0)
59882 {
59883 return;
59884 }
59885 num3 = (int)((double)num3 * 1.4);
59886 if (num3 > 255)
59887 {
59888 num3 = 255;
59889 }
59890 num4 = num3;
59891 num5 = num3;
59892 color.R = (byte)num3;
59893 color.G = (byte)num4;
59894 color.B = (byte)num5;
59895 color *= starOpacity;
59896 if (num > 0f)
59897 {
59899 if (i % 3 == 0)
59900 {
59901 value.G = (byte)((float)(int)color.G * (1f - num * 0f) * theStar.twinkle * theStar.twinkle);
59902 }
59903 else if (i % 3 == 1)
59904 {
59905 value.B = (byte)((float)(int)color.B * (1f - num * 0f) * theStar.twinkle * theStar.twinkle);
59906 }
59907 else if (i % 3 == 2)
59908 {
59909 value.R = (byte)((float)(int)color.R * (1f - num * 0f) * theStar.twinkle * theStar.twinkle);
59910 }
59911 color = Microsoft.Xna.Framework.Color.Lerp(color, value, num);
59912 if (artificial)
59913 {
59914 color *= num;
59915 }
59916 else
59917 {
59918 color *= 1f - num;
59919 }
59920 }
59921 Vector2 vector = new Vector2(theStar.position.X / 1920f, theStar.position.Y / 1200f) * new Vector2(sceneArea.totalWidth, sceneArea.totalHeight) + new Vector2(0f, sceneArea.bgTopY) + sceneArea.SceneLocalScreenPositionOffset;
59922 if (!theStar.falling)
59923 {
59924 if (vector.X < 0f)
59925 {
59926 vector.X += screenWidth;
59927 }
59928 if (vector.X > (float)screenWidth)
59929 {
59930 vector.X -= screenWidth;
59931 }
59932 if (vector.Y < 0f)
59933 {
59934 vector.Y += screenHeight;
59935 }
59936 if (vector.Y > (float)screenHeight)
59937 {
59938 vector.Y -= screenHeight;
59939 }
59940 }
59941 if (foreground)
59942 {
59943 Vector2 value2 = vector / ScreenSize.ToVector2();
59944 float fromMax = 0.35f;
59945 float num6 = Utils.Remap(Vector2.Distance(value2, new Vector2(0.5f, 0.5f)), 0f, fromMax, 0f, 1f);
59946 color *= num6;
59948 float num7 = (float)(int)Math.Max(Math.Max(color2.R, color2.G), color2.B) / 255f;
59949 color *= 1f - num7;
59950 }
59952 Vector2 origin = value3.Size() / 2f;
59953 if (theStar.falling)
59954 {
59955 theStar.fadeIn = 0f;
59956 int num8 = theStar.fallTime;
59957 float num9 = 30f;
59958 if ((float)num8 > num9)
59959 {
59960 num8 = (int)num9;
59961 }
59962 for (int j = 1; j < num8; j++)
59963 {
59964 Vector2 vector2 = theStar.fallSpeed * j * 0.4f;
59965 float num10 = theStar.scale * (1f - (float)j * 1f / num9);
59967 _ = theStar.rotation;
59968 color3 *= 1f - (float)j * 1f / num9;
59969 spriteBatch.Draw(value3, vector - vector2, null, color3, theStar.rotation, origin, num10 * theStar.twinkle * ForcedMinimumZoom, SpriteEffects.None, 0f);
59970 }
59971 if (starGame && theStar.fallSpeed.Y > 0f && Vector2.Distance(new Vector2(mouseX, mouseY), vector) < 70f)
59972 {
59973 starsHit++;
59974 theStar.fallSpeed = vector - new Vector2(mouseX, mouseY);
59975 theStar.fallSpeed.Normalize();
59976 theStar.fallSpeed *= 10f;
59977 if (theStar.fallSpeed.Y > 0f)
59978 {
59979 theStar.fallSpeed.Y *= -1f;
59980 }
59983 }
59984 }
59985 spriteBatch.Draw(value3, vector, null, color, theStar.rotation, origin, theStar.scale * theStar.twinkle * ForcedMinimumZoom, SpriteEffects.None, 0f);
59986 }
59987
59988 private static void ApplyColorOfTheSkiesToTiles()
59989 {
59991 tileColor.A = byte.MaxValue;
59992 tileColor.R = (byte)((colorOfTheSkies.R + colorOfTheSkies.G + colorOfTheSkies.B + colorOfTheSkies.R * 7) / 10);
59993 tileColor.G = (byte)((colorOfTheSkies.R + colorOfTheSkies.G + colorOfTheSkies.B + colorOfTheSkies.G * 7) / 10);
59994 tileColor.B = (byte)((colorOfTheSkies.R + colorOfTheSkies.G + colorOfTheSkies.B + colorOfTheSkies.B * 7) / 10);
59995 tileColor = SkyManager.Instance.ProcessTileColor(tileColor);
59996 }
59997
59999 {
60000 float num = (float)maxTilesX / 4200f;
60001 num *= num;
60002 atmo = (float)((double)((screenPosition.Y + (float)(screenHeight / 2)) / 16f - (65f + 10f * num)) / (worldSurface / 5.0));
60003 if (atmo < 0f)
60004 {
60005 atmo = 0f;
60006 }
60007 if (atmo > 1f)
60008 {
60009 atmo = 1f;
60010 }
60011 if (gameMenu || netMode == 2)
60012 {
60013 atmo = 1f;
60014 }
60016 colorOfTheSkies.R = (byte)((float)(int)colorOfTheSkies.R * atmo);
60017 colorOfTheSkies.G = (byte)((float)(int)colorOfTheSkies.G * atmo);
60018 colorOfTheSkies.B = (byte)((float)(int)colorOfTheSkies.B * atmo);
60019 if ((double)atmo <= 0.01)
60020 {
60022 }
60024 }
60025
60026 private void Debug_PrettifyMap()
60027 {
60028 }
60029
60030 private static void DrawNetplayStatusText()
60031 {
60032 if (netMode == 1 && !string.IsNullOrWhiteSpace(Netplay.Connection.StatusText))
60033 {
60034 string text = Netplay.Connection.StatusText;
60035 if (!Netplay.Connection.HideStatusTextPercent)
60036 {
60037 text = text + ": " + (int)((float)Netplay.Connection.StatusCount / (float)Netplay.Connection.StatusMax * 100f) + "%";
60038 }
60040 {
60043 }
60044 Vector2 position = new Vector2(628f - ChatManager.GetStringSize(FontAssets.MouseText.Value, _netplayStatusTextSnippets, Vector2.One).X * 0.5f + (float)(screenWidth - 800), 84f);
60045 int hoveredSnippet;
60046 if (Netplay.Connection.StatusTextHasShadows)
60047 {
60049 }
60050 else
60051 {
60053 }
60054 }
60055 }
60056
60058 {
60059 for (int i = 0; i < 255; i++)
60060 {
60061 if (player[i].active && player[i].chatOverhead.timeLeft > 0 && !player[i].dead)
60062 {
60063 Vector2 messageSize = player[i].chatOverhead.messageSize;
60064 Vector2 vec = player[i].Top.ToScreenPosition();
60065 vec.Y -= messageSize.Y + 2f;
60066 if (player[myPlayer].gravDir == -1f)
60067 {
60068 vec.Y += 2f;
60069 }
60070 vec.X -= messageSize.X / 2f;
60071 vec.Y += player[i].gfxOffY;
60072 vec = vec.Floor();
60073 int hoveredSnippet = 0;
60075 }
60076 }
60077 }
60078
60079 private void DrawRainInMenu()
60080 {
60081 bool flag = base.IsActive;
60083 for (int i = 0; i < array.Length; i++)
60084 {
60085 array[i] = new Microsoft.Xna.Framework.Rectangle(i * 4, 0, 2, 40);
60086 }
60088 for (int j = 0; j < maxRain; j++)
60089 {
60090 if (Main.rain[j].active)
60091 {
60092 Rain rain = Main.rain[j];
60093 spriteBatch.Draw(TextureAssets.Rain.Value, rain.position - screenPosition, array[rain.type], color, rain.rotation, Vector2.Zero, rain.scale, SpriteEffects.None, 0f);
60094 if (flag)
60095 {
60096 rain.Update();
60097 }
60098 }
60099 }
60100 }
60101
60103 {
60104 try
60105 {
60106 CacheNPCDraws();
60108 DrawCachedNPCs(DrawCacheNPCsMoonMoon, behindTiles: true);
60110 DrawWoF();
60111 DrawBackGore();
60118 tileBatch.End();
60119 }
60120 catch (Exception e)
60121 {
60123 }
60124 spriteBatch.End();
60125 try
60126 {
60127 bool detectCreature = player[myPlayer].detectCreature;
60128 if (!detectCreature)
60129 {
60131 }
60133 if (detectCreature)
60134 {
60136 }
60140 }
60141 catch (Exception e2)
60142 {
60144 }
60146 }
60147
60148 private void DoDraw_Waterfalls()
60149 {
60152 }
60153
60154 private void DoDraw_Tiles_Solid()
60155 {
60159 try
60160 {
60161 if (drawToScreen)
60162 {
60164 }
60165 else
60166 {
60169 }
60170 }
60171 catch (Exception e)
60172 {
60174 }
60175 tileBatch.End();
60176 spriteBatch.End();
60179 try
60180 {
60181 player[myPlayer].hitReplace.DrawFreshAnimations(spriteBatch);
60182 player[myPlayer].hitTile.DrawFreshAnimations(spriteBatch);
60183 }
60184 catch (Exception e2)
60185 {
60187 }
60188 spriteBatch.End();
60189 }
60190
60192 {
60194 if (drawToScreen)
60195 {
60198 }
60199 else
60200 {
60203 }
60204 spriteBatch.End();
60205 try
60206 {
60208 }
60209 catch (Exception e)
60210 {
60212 }
60214 }
60215
60217 {
60220 try
60221 {
60222 DrawNPCs();
60223 DrawCachedNPCs(DrawCacheNPCProjectiles, behindTiles: false);
60225 }
60226 catch (Exception e)
60227 {
60229 }
60230 spriteBatch.End();
60231 }
60232
60234 {
60237 try
60238 {
60239 DrawNPCs(behindTiles: true);
60241 }
60242 catch (Exception e)
60243 {
60245 }
60246 spriteBatch.End();
60247 }
60248
60249 private void DrawBackGore()
60250 {
60251 if (!drawBackGore)
60252 {
60253 return;
60254 }
60255 drawBackGore = false;
60256 if (ignoreErrors)
60257 {
60258 try
60259 {
60261 return;
60262 }
60263 catch (Exception e)
60264 {
60266 return;
60267 }
60268 }
60270 }
60271
60273 {
60274 if (drawToScreen)
60275 {
60276 DrawBlack();
60277 tileBatch.Begin();
60278 DrawWalls();
60279 tileBatch.End();
60280 }
60281 else
60282 {
60287 }
60289 }
60290
60292 {
60293 double num = time;
60297 float num2 = 0f;
60298 bool isInGameMenuOrIsServer = info.isInGameMenuOrIsServer;
60299 if (dayTime)
60300 {
60301 if (num < 13500.0)
60302 {
60303 num2 = (float)(num / 13500.0);
60304 sunColor.R = (byte)(num2 * 200f + 55f);
60305 sunColor.G = (byte)(num2 * 180f + 75f);
60306 sunColor.B = (byte)(num2 * 250f + 5f);
60307 bgColorToSet.R = (byte)(num2 * 230f + 25f);
60308 bgColorToSet.G = (byte)(num2 * 220f + 35f);
60309 bgColorToSet.B = (byte)(num2 * 220f + 35f);
60310 }
60311 if (num > 45900.0)
60312 {
60313 num2 = (float)(1.0 - (num / 54000.0 - 0.85) * 6.666666666666667);
60314 sunColor.R = (byte)(num2 * 120f + 55f);
60315 sunColor.G = (byte)(num2 * 100f + 25f);
60316 sunColor.B = (byte)(num2 * 120f + 55f);
60317 bgColorToSet.R = (byte)(num2 * 200f + 35f);
60318 bgColorToSet.G = (byte)(num2 * 85f + 35f);
60319 bgColorToSet.B = (byte)(num2 * 135f + 35f);
60320 }
60321 else if (num > 37800.0)
60322 {
60323 num2 = (float)(1.0 - (num / 54000.0 - 0.7) * 6.666666666666667);
60324 sunColor.R = (byte)(num2 * 80f + 175f);
60325 sunColor.G = (byte)(num2 * 130f + 125f);
60326 sunColor.B = (byte)(num2 * 100f + 155f);
60327 bgColorToSet.R = (byte)(num2 * 20f + 235f);
60328 bgColorToSet.G = (byte)(num2 * 135f + 120f);
60329 bgColorToSet.B = (byte)(num2 * 85f + 170f);
60330 }
60331 }
60332 if (!dayTime)
60333 {
60334 if (info.BloodMoonActive)
60335 {
60336 if (num < 16200.0)
60337 {
60338 num2 = (float)(1.0 - num / 16200.0);
60339 moonColor.R = (byte)(num2 * 10f + 205f);
60340 moonColor.G = (byte)(num2 * 170f + 55f);
60341 moonColor.B = (byte)(num2 * 200f + 55f);
60342 bgColorToSet.R = (byte)(40f - num2 * 40f + 35f);
60343 bgColorToSet.G = (byte)(num2 * 20f + 15f);
60344 bgColorToSet.B = (byte)(num2 * 20f + 15f);
60345 }
60346 else if (num >= 16200.0)
60347 {
60348 num2 = (float)((num / 32400.0 - 0.5) * 2.0);
60349 moonColor.R = (byte)(num2 * 50f + 205f);
60350 moonColor.G = (byte)(num2 * 100f + 155f);
60351 moonColor.B = (byte)(num2 * 100f + 155f);
60352 moonColor.R = (byte)(num2 * 10f + 205f);
60353 moonColor.G = (byte)(num2 * 170f + 55f);
60354 moonColor.B = (byte)(num2 * 200f + 55f);
60355 bgColorToSet.R = (byte)(40f - num2 * 40f + 35f);
60356 bgColorToSet.G = (byte)(num2 * 20f + 15f);
60357 bgColorToSet.B = (byte)(num2 * 20f + 15f);
60358 }
60359 }
60360 else if (num < 16200.0)
60361 {
60362 num2 = (float)(1.0 - num / 16200.0);
60363 moonColor.R = (byte)(num2 * 10f + 205f);
60364 moonColor.G = (byte)(num2 * 70f + 155f);
60365 moonColor.B = (byte)(num2 * 100f + 155f);
60366 bgColorToSet.R = (byte)(num2 * 30f + 5f);
60367 bgColorToSet.G = (byte)(num2 * 30f + 5f);
60368 bgColorToSet.B = (byte)(num2 * 30f + 5f);
60369 }
60370 else if (num >= 16200.0)
60371 {
60372 num2 = (float)((num / 32400.0 - 0.5) * 2.0);
60373 moonColor.R = (byte)(num2 * 50f + 205f);
60374 moonColor.G = (byte)(num2 * 100f + 155f);
60375 moonColor.B = (byte)(num2 * 100f + 155f);
60376 bgColorToSet.R = (byte)(num2 * 20f + 5f);
60377 bgColorToSet.G = (byte)(num2 * 30f + 5f);
60378 bgColorToSet.B = (byte)(num2 * 30f + 5f);
60379 }
60380 if (dontStarveWorld)
60381 {
60383 }
60384 }
60385 if (cloudAlpha > 0f && !remixWorld)
60386 {
60387 float num3 = 1f - cloudAlpha * 0.9f * atmo;
60388 bgColorToSet.R = (byte)((float)(int)bgColorToSet.R * num3);
60389 bgColorToSet.G = (byte)((float)(int)bgColorToSet.G * num3);
60390 bgColorToSet.B = (byte)((float)(int)bgColorToSet.B * num3);
60391 }
60392 if (info.GraveyardInfluence > 0f && !remixWorld)
60393 {
60394 float num4 = 1f - info.GraveyardInfluence * 0.6f;
60395 bgColorToSet.R = (byte)((float)(int)bgColorToSet.R * num4);
60396 bgColorToSet.G = (byte)((float)(int)bgColorToSet.G * num4);
60397 bgColorToSet.B = (byte)((float)(int)bgColorToSet.B * num4);
60398 }
60399 if (isInGameMenuOrIsServer && !dayTime)
60400 {
60401 bgColorToSet.R = 35;
60402 bgColorToSet.G = 35;
60403 bgColorToSet.B = 35;
60404 }
60405 if (info.CorruptionBiomeInfluence > 0f)
60406 {
60407 float num5 = info.CorruptionBiomeInfluence;
60408 if (num5 > 1f)
60409 {
60410 num5 = 1f;
60411 }
60412 int r = bgColorToSet.R;
60413 int g = bgColorToSet.G;
60414 int b = bgColorToSet.B;
60415 r -= (int)(90f * num5 * ((float)(int)bgColorToSet.R / 255f));
60416 g -= (int)(140f * num5 * ((float)(int)bgColorToSet.G / 255f));
60417 b -= (int)(70f * num5 * ((float)(int)bgColorToSet.B / 255f));
60418 if (r < 15)
60419 {
60420 r = 15;
60421 }
60422 if (g < 15)
60423 {
60424 g = 15;
60425 }
60426 if (b < 15)
60427 {
60428 b = 15;
60429 }
60431 bgColorToSet.R = (byte)r;
60432 bgColorToSet.G = (byte)g;
60433 bgColorToSet.B = (byte)b;
60434 r = sunColor.R;
60435 g = sunColor.G;
60436 b = sunColor.B;
60437 r -= (int)(100f * num5 * ((float)(int)sunColor.R / 255f));
60438 g -= (int)(100f * num5 * ((float)(int)sunColor.G / 255f));
60439 b -= (int)(0f * num5 * ((float)(int)sunColor.B / 255f));
60440 if (r < 15)
60441 {
60442 r = 15;
60443 }
60444 if (g < 15)
60445 {
60446 g = 15;
60447 }
60448 if (b < 15)
60449 {
60450 b = 15;
60451 }
60452 sunColor.R = (byte)r;
60453 sunColor.G = (byte)g;
60454 sunColor.B = (byte)b;
60455 }
60456 if (info.CrimsonBiomeInfluence > 0f)
60457 {
60458 float num6 = info.CrimsonBiomeInfluence;
60459 if (num6 > 1f)
60460 {
60461 num6 = 1f;
60462 }
60463 int r2 = bgColorToSet.R;
60464 int g2 = bgColorToSet.G;
60465 int b2 = bgColorToSet.B;
60466 r2 -= (int)(40f * num6 * ((float)(int)bgColorToSet.G / 255f));
60467 g2 -= (int)(110f * num6 * ((float)(int)bgColorToSet.G / 255f));
60468 b2 -= (int)(140f * num6 * ((float)(int)bgColorToSet.B / 255f));
60469 if (r2 < 15)
60470 {
60471 r2 = 15;
60472 }
60473 if (g2 < 15)
60474 {
60475 g2 = 15;
60476 }
60477 if (b2 < 15)
60478 {
60479 b2 = 15;
60480 }
60482 bgColorToSet.R = (byte)r2;
60483 bgColorToSet.G = (byte)g2;
60484 bgColorToSet.B = (byte)b2;
60485 r2 = sunColor.R;
60486 g2 = sunColor.G;
60487 b2 = sunColor.B;
60488 g2 -= (int)(90f * num6 * ((float)(int)sunColor.G / 255f));
60489 b2 -= (int)(110f * num6 * ((float)(int)sunColor.B / 255f));
60490 if (r2 < 15)
60491 {
60492 r2 = 15;
60493 }
60494 if (g2 < 15)
60495 {
60496 g2 = 15;
60497 }
60498 if (b2 < 15)
60499 {
60500 b2 = 15;
60501 }
60502 sunColor.R = (byte)r2;
60503 sunColor.G = (byte)g2;
60504 sunColor.B = (byte)b2;
60505 }
60506 if (info.JungleBiomeInfluence > 0f)
60507 {
60508 float num7 = info.JungleBiomeInfluence;
60509 if (num7 > 1f)
60510 {
60511 num7 = 1f;
60512 }
60513 int r3 = bgColorToSet.R;
60514 int G = bgColorToSet.G;
60515 int b3 = bgColorToSet.B;
60516 r3 -= (int)(40f * num7 * ((float)(int)bgColorToSet.R / 255f));
60517 b3 -= (int)(70f * num7 * ((float)(int)bgColorToSet.B / 255f));
60518 if (G > 255)
60519 {
60520 G = 255;
60521 }
60522 if (G < 15)
60523 {
60524 G = 15;
60525 }
60526 if (r3 > 255)
60527 {
60528 r3 = 255;
60529 }
60530 if (r3 < 15)
60531 {
60532 r3 = 15;
60533 }
60534 if (b3 < 15)
60535 {
60536 b3 = 15;
60537 }
60539 bgColorToSet.R = (byte)r3;
60540 bgColorToSet.G = (byte)G;
60541 bgColorToSet.B = (byte)b3;
60542 r3 = sunColor.R;
60543 G = sunColor.G;
60544 b3 = sunColor.B;
60545 r3 -= (int)(30f * num7 * ((float)(int)sunColor.R / 255f));
60546 b3 -= (int)(10f * num7 * ((float)(int)sunColor.B / 255f));
60547 if (r3 < 15)
60548 {
60549 r3 = 15;
60550 }
60551 if (G < 15)
60552 {
60553 G = 15;
60554 }
60555 if (b3 < 15)
60556 {
60557 b3 = 15;
60558 }
60559 sunColor.R = (byte)r3;
60560 sunColor.G = (byte)G;
60561 sunColor.B = (byte)b3;
60562 }
60563 if (info.MushroomBiomeInfluence > 0f)
60564 {
60565 float mushroomBiomeInfluence = info.MushroomBiomeInfluence;
60566 int r4 = bgColorToSet.R;
60567 int g3 = bgColorToSet.G;
60568 int b4 = bgColorToSet.B;
60569 g3 -= (int)(250f * mushroomBiomeInfluence * ((float)(int)bgColorToSet.G / 255f));
60570 r4 -= (int)(250f * mushroomBiomeInfluence * ((float)(int)bgColorToSet.R / 255f));
60571 b4 -= (int)(250f * mushroomBiomeInfluence * ((float)(int)bgColorToSet.B / 255f));
60572 if (g3 < 15)
60573 {
60574 g3 = 15;
60575 }
60576 if (r4 < 15)
60577 {
60578 r4 = 15;
60579 }
60580 if (b4 < 15)
60581 {
60582 b4 = 15;
60583 }
60585 bgColorToSet.R = (byte)r4;
60586 bgColorToSet.G = (byte)g3;
60587 bgColorToSet.B = (byte)b4;
60588 r4 = sunColor.R;
60589 g3 = sunColor.G;
60590 b4 = sunColor.B;
60591 g3 -= (int)(10f * mushroomBiomeInfluence * ((float)(int)sunColor.G / 255f));
60592 r4 -= (int)(30f * mushroomBiomeInfluence * ((float)(int)sunColor.R / 255f));
60593 b4 -= (int)(10f * mushroomBiomeInfluence * ((float)(int)sunColor.B / 255f));
60594 if (r4 < 15)
60595 {
60596 r4 = 15;
60597 }
60598 if (g3 < 15)
60599 {
60600 g3 = 15;
60601 }
60602 if (b4 < 15)
60603 {
60604 b4 = 15;
60605 }
60606 sunColor.R = (byte)r4;
60607 sunColor.G = (byte)g3;
60608 sunColor.B = (byte)b4;
60609 r4 = moonColor.R;
60610 g3 = moonColor.G;
60611 b4 = moonColor.B;
60612 g3 -= (int)(140f * mushroomBiomeInfluence * ((float)(int)moonColor.R / 255f));
60613 r4 -= (int)(170f * mushroomBiomeInfluence * ((float)(int)moonColor.G / 255f));
60614 b4 -= (int)(190f * mushroomBiomeInfluence * ((float)(int)moonColor.B / 255f));
60615 if (r4 < 15)
60616 {
60617 r4 = 15;
60618 }
60619 if (g3 < 15)
60620 {
60621 g3 = 15;
60622 }
60623 if (b4 < 15)
60624 {
60625 b4 = 15;
60626 }
60627 moonColor.R = (byte)r4;
60628 moonColor.G = (byte)g3;
60629 moonColor.B = (byte)b4;
60630 }
60631 byte minimalLight = 15;
60632 switch (GetMoonPhase())
60633 {
60634 case MoonPhase.Empty:
60635 minimalLight = 11;
60636 break;
60637 case MoonPhase.QuarterAtLeft:
60638 case MoonPhase.QuarterAtRight:
60639 minimalLight = 13;
60640 break;
60641 case MoonPhase.HalfAtLeft:
60642 case MoonPhase.HalfAtRight:
60643 minimalLight = 15;
60644 break;
60645 case MoonPhase.ThreeQuartersAtLeft:
60646 case MoonPhase.ThreeQuartersAtRight:
60647 minimalLight = 17;
60648 break;
60649 case MoonPhase.Full:
60650 minimalLight = 19;
60651 break;
60652 }
60653 if (dontStarveWorld)
60654 {
60656 }
60657 if (bgColorToSet.R < minimalLight)
60658 {
60659 bgColorToSet.R = minimalLight;
60660 }
60661 if (bgColorToSet.G < minimalLight)
60662 {
60663 bgColorToSet.G = minimalLight;
60664 }
60665 if (bgColorToSet.B < minimalLight)
60666 {
60667 bgColorToSet.B = minimalLight;
60668 }
60669 if (info.BloodMoonActive)
60670 {
60671 if (bgColorToSet.R < 25)
60672 {
60673 bgColorToSet.R = 25;
60674 }
60675 if (bgColorToSet.G < 25)
60676 {
60677 bgColorToSet.G = 25;
60678 }
60679 if (bgColorToSet.B < 25)
60680 {
60681 bgColorToSet.B = 25;
60682 }
60683 }
60684 if (eclipse && dayTime)
60685 {
60686 float num8 = 1242f;
60687 eclipseLight = (float)(num / (double)num8);
60688 if (eclipseLight > 1f)
60689 {
60690 eclipseLight = 1f;
60691 }
60692 }
60693 else if (eclipseLight > 0f)
60694 {
60695 eclipseLight -= 0.01f;
60696 if (eclipseLight < 0f)
60697 {
60698 eclipseLight = 0f;
60699 }
60700 }
60701 if (eclipseLight > 0f)
60702 {
60703 float num9 = 1f - 0.925f * eclipseLight;
60704 float num10 = 1f - 0.96f * eclipseLight;
60705 float num11 = 1f - 1f * eclipseLight;
60706 int num12 = (int)((float)(int)bgColorToSet.R * num9);
60707 int num13 = (int)((float)(int)bgColorToSet.G * num10);
60708 int num14 = (int)((float)(int)bgColorToSet.B * num11);
60709 bgColorToSet.R = (byte)num12;
60710 bgColorToSet.G = (byte)num13;
60711 bgColorToSet.B = (byte)num14;
60712 sunColor.R = byte.MaxValue;
60713 sunColor.G = 127;
60714 sunColor.B = 67;
60715 if (bgColorToSet.R < 20)
60716 {
60717 bgColorToSet.R = 20;
60718 }
60719 if (bgColorToSet.G < 10)
60720 {
60721 bgColorToSet.G = 10;
60722 }
60723 if (!Lighting.NotRetro)
60724 {
60725 if (bgColorToSet.R < 20)
60726 {
60727 bgColorToSet.R = 20;
60728 }
60729 if (bgColorToSet.G < 14)
60730 {
60731 bgColorToSet.G = 14;
60732 }
60733 if (bgColorToSet.B < 6)
60734 {
60735 bgColorToSet.B = 6;
60736 }
60737 }
60738 }
60740 {
60741 bgColorToSet.R = 1;
60742 bgColorToSet.G = 1;
60743 bgColorToSet.B = 1;
60744 }
60745 if (lightning > 0f)
60746 {
60747 float value = (float)(int)bgColorToSet.R / 255f;
60748 float value2 = (float)(int)bgColorToSet.G / 255f;
60749 float value3 = (float)(int)bgColorToSet.B / 255f;
60753 bgColorToSet.R = (byte)(value * 255f);
60754 bgColorToSet.G = (byte)(value2 * 255f);
60755 bgColorToSet.B = (byte)(value3 * 255f);
60756 }
60757 if (!info.BloodMoonActive)
60758 {
60760 }
60762 }
60763
60764 private void DoLightTiles()
60765 {
60767 if (!drawSkip)
60768 {
60770 }
60771 }
60772
60773 public static void GetAreaToLight(out int firstTileX, out int lastTileX, out int firstTileY, out int lastTileY)
60774 {
60778 {
60781 }
60782 firstTileX = (int)Math.Floor(vector.X / 16f) - 1;
60783 lastTileX = (int)Math.Floor((vector.X + vector2.X) / 16f) + 2;
60784 firstTileY = (int)Math.Floor(vector.Y / 16f) - 1;
60785 lastTileY = (int)Math.Floor((vector.Y + vector2.Y) / 16f) + 2;
60786 }
60787
60788 private static void ClampScreenPositionToWorld()
60789 {
60790 Vector2 input = new Vector2(leftWorld + 656f, topWorld + 656f) - GameViewMatrix.Translation;
60791 Vector2 input2 = new Vector2(rightWorld - (float)screenWidth / GameViewMatrix.Zoom.X - 672f, bottomWorld - (float)screenHeight / GameViewMatrix.Zoom.Y - 672f) - GameViewMatrix.Translation;
60795 }
60796
60797 private void DrawBG()
60798 {
60800 float num2 = screenPosition.Y + (float)(screenHeight / 2) - num / 2f;
60801 scAdj = (float)(worldSurface * 16.0) / (num2 + num);
60802 float num3 = (float)maxTilesY * 0.15f * 16f;
60803 num3 -= num2;
60804 if (num3 < 0f)
60805 {
60806 num3 = 0f;
60807 }
60808 num3 *= 0.00025f;
60809 float num4 = num3 * num3;
60810 scAdj *= 0.45f - num4;
60811 if (maxTilesY <= 1200)
60812 {
60813 scAdj *= -500f;
60814 }
60815 else if (maxTilesY <= 1800)
60816 {
60817 scAdj *= -300f;
60818 }
60819 else
60820 {
60821 scAdj *= -150f;
60822 }
60823 float num5 = screenHeight;
60824 screenOff = num5 - 600f;
60825 bgTopY = (int)((double)(0f - screenPosition.Y + screenOff / 2f) / (worldSurface * 16.0) * 1200.0 + 1190.0) + (int)scAdj;
60826 cTop = bgTopY - 50;
60827 if (resetClouds)
60828 {
60830 resetClouds = false;
60831 }
60832 bgScale = 1f;
60833 bgWidthScaled = (int)((float)backgroundWidth[treeMntBGSet1[0]] * bgScale);
60837 int num6 = 30;
60840 {
60841 num6 = 60;
60842 }
60843 if (bgDelay < 0)
60844 {
60845 bgDelay++;
60846 }
60848 {
60849 bgDelay++;
60850 if (bgDelay > num6)
60851 {
60852 bgDelay = -60;
60855 {
60856 bgDelay = 0;
60857 }
60858 }
60859 }
60860 else if (bgDelay > 0)
60861 {
60862 bgDelay--;
60863 }
60864 if (gameMenu)
60865 {
60867 if (!dayTime)
60868 {
60869 bgStyle = 1;
60870 }
60871 else
60872 {
60873 bgStyle = 0;
60874 }
60877 {
60878 bgStyle = 9;
60879 }
60880 }
60882 {
60886 }
60887 UpdateBGVisibility_BackLayer(null, null);
60889 try
60890 {
60891 DrawSurfaceBG();
60893 {
60895 }
60896 }
60897 catch (Exception ex)
60898 {
60899 if (!ignoreErrors)
60900 {
60901 throw ex;
60902 }
60904 }
60906 }
60907
60909 {
60910 int value = bgStyle;
60911 if (targetBiomeOverride.HasValue)
60912 {
60913 value = targetBiomeOverride.Value;
60914 }
60916 if (transitionAmountOverride.HasValue)
60917 {
60919 }
60920 for (int i = 0; i < bgAlphaFrontLayer.Length; i++)
60921 {
60922 if (value == i)
60923 {
60925 if (bgAlphaFrontLayer[i] > 1f)
60926 {
60927 bgAlphaFrontLayer[i] = 1f;
60928 }
60929 }
60930 else
60931 {
60933 if (bgAlphaFrontLayer[i] < 0f)
60934 {
60935 bgAlphaFrontLayer[i] = 0f;
60936 }
60937 }
60938 }
60939 }
60940
60942 {
60943 int value = bgStyle;
60944 if (targetBiomeOverride.HasValue)
60945 {
60946 value = targetBiomeOverride.Value;
60947 }
60949 if (transitionAmountOverride.HasValue)
60950 {
60952 }
60953 switch (value)
60954 {
60955 case 2:
60957 break;
60958 case 3:
60959 if (WorldGen.jungleBG == 5)
60960 {
60962 }
60963 else
60964 {
60966 }
60967 break;
60968 case 1:
60969 case 5:
60971 break;
60972 case 6:
60973 if (WorldGen.hallowBG == 3)
60974 {
60976 }
60977 else
60978 {
60980 }
60981 break;
60982 case 4:
60984 break;
60985 case 7:
60987 break;
60988 case 8:
60990 break;
60991 case 9:
60993 break;
60994 case 10:
60995 case 11:
60996 case 12:
60998 break;
60999 default:
61001 break;
61002 }
61003 }
61004
61006 {
61007 int num = bgStyle;
61008 int num2 = (int)((screenPosition.X + (float)(screenWidth / 2)) / 16f);
61009 if (WorldGen.oceanDepths((int)(screenPosition.X + (float)(screenWidth / 2)) / 16, (int)(screenPosition.Y + (float)(screenHeight / 2)) / 16))
61010 {
61011 num = (player[myPlayer].ZoneHallow ? 6 : (player[myPlayer].ZoneCorrupt ? ((SceneMetrics.BloodTileCount <= SceneMetrics.EvilTileCount) ? 1 : 8) : (player[myPlayer].ZoneCrimson ? 8 : ((SceneMetrics.HoneyBlockCount <= 400) ? 4 : 3))));
61012 }
61013 else if (player[myPlayer].ZoneGlowshroom)
61014 {
61015 num = 9;
61016 }
61017 else if (player[myPlayer].ZoneDesert)
61018 {
61019 num = (player[myPlayer].ZoneCorrupt ? 5 : (player[myPlayer].ZoneCrimson ? 5 : ((!player[myPlayer].ZoneHallow) ? 2 : 5)));
61020 }
61021 else if (player[myPlayer].ZoneHallow)
61022 {
61023 num = 6;
61024 }
61025 else if (player[myPlayer].ZoneCorrupt)
61026 {
61027 num = ((SceneMetrics.BloodTileCount <= SceneMetrics.EvilTileCount) ? 1 : 8);
61028 }
61029 else if (player[myPlayer].ZoneCrimson)
61030 {
61031 num = 8;
61032 }
61033 else if (player[myPlayer].ZoneJungle)
61034 {
61035 num = 3;
61036 }
61037 else if (player[myPlayer].ZoneSnow)
61038 {
61039 num = 7;
61040 }
61041 else
61042 {
61043 num = 0;
61044 if (num2 >= treeX[0])
61045 {
61046 if (WorldGen.treeBG1 != WorldGen.treeBG2 && num2 < treeX[1])
61047 {
61048 num = 10;
61049 }
61050 else if (WorldGen.treeBG1 != WorldGen.treeBG3 && num2 < treeX[2])
61051 {
61052 num = 11;
61053 }
61054 else if (WorldGen.treeBG1 != WorldGen.treeBG4)
61055 {
61056 num = 12;
61057 }
61058 }
61059 }
61060 return num;
61061 }
61062
61064 {
61066 if (transitionAmountOverride.HasValue)
61067 {
61069 }
61070 for (int i = 0; i < bgAlphaFarBackLayer.Length; i++)
61071 {
61072 bool flag = desiredBG == i;
61073 flag |= desiredBG2.HasValue && desiredBG2 == i;
61074 bgAlphaFarBackLayer[i] = MathHelper.Clamp(bgAlphaFarBackLayer[i] + (flag ? value : (0f - value)), 0f, 1f);
61075 }
61076 }
61077
61078 public void DrawInfernoRings()
61079 {
61080 for (int i = 0; i < 255; i++)
61081 {
61082 if (!player[i].active || player[i].outOfRange || !player[i].inferno || player[i].dead)
61083 {
61084 continue;
61085 }
61086 LoadFlameRing();
61087 float num = 1f;
61088 float num2 = 0.1f;
61089 float num3 = 0.9f;
61090 if (!gamePaused && base.IsActive)
61091 {
61092 player[i].flameRingScale += 0.004f;
61093 }
61094 if (player[i].flameRingScale < 1f)
61095 {
61096 num = player[i].flameRingScale;
61097 }
61098 else
61099 {
61100 player[i].flameRingScale = 0.8f;
61101 num = player[i].flameRingScale;
61102 }
61103 if (!gamePaused && base.IsActive)
61104 {
61105 player[i].flameRingRot += 0.05f;
61106 }
61107 if (player[i].flameRingRot > (float)Math.PI * 2f)
61108 {
61109 player[i].flameRingRot -= (float)Math.PI * 2f;
61110 }
61111 if (player[i].flameRingRot < (float)Math.PI * -2f)
61112 {
61113 player[i].flameRingRot += (float)Math.PI * 2f;
61114 }
61115 for (int j = 0; j < 3; j++)
61116 {
61117 float num4 = num + num2 * (float)j;
61118 if (num4 > 1f)
61119 {
61120 num4 -= num2 * 2f;
61121 }
61122 float num5 = MathHelper.Lerp(0.8f, 0f, Math.Abs(num4 - num3) * 10f);
61123 spriteBatch.Draw(TextureAssets.FlameRing.Value, player[i].Center - screenPosition, new Microsoft.Xna.Framework.Rectangle(0, 400 * j, 400, 400), new Microsoft.Xna.Framework.Color(num5, num5, num5, num5 / 2f), player[i].flameRingRot + (float)Math.PI / 3f * (float)j, new Vector2(200f, 200f), num4, SpriteEffects.None, 0f);
61124 }
61125 }
61126 }
61127
61128 private static void UpdateInvasion()
61129 {
61130 if (invasionType <= 0)
61131 {
61132 return;
61133 }
61134 if (invasionSize <= 0)
61135 {
61136 if (invasionType == 1)
61137 {
61139 if (netMode == 2)
61140 {
61142 }
61144 }
61145 else if (invasionType == 2)
61146 {
61149 }
61150 else if (invasionType == 3)
61151 {
61154 }
61155 else if (invasionType == 4)
61156 {
61159 }
61161 invasionType = 0;
61162 invasionDelay = 0;
61163 }
61164 if (invasionX == (double)spawnTileX)
61165 {
61166 return;
61167 }
61168 float num = dayRate;
61169 if (num < 1f)
61170 {
61171 num = 1f;
61172 }
61173 if (invasionX > (double)spawnTileX)
61174 {
61175 invasionX -= num;
61176 if (invasionX <= (double)spawnTileX)
61177 {
61180 }
61181 else if (num > 0f)
61182 {
61183 invasionWarn--;
61184 }
61185 }
61186 else if (invasionX < (double)spawnTileX)
61187 {
61188 invasionX += num;
61189 if (invasionX >= (double)spawnTileX)
61190 {
61193 }
61194 else if (num > 0f)
61195 {
61196 invasionWarn--;
61197 }
61198 }
61199 if (invasionWarn <= 0)
61200 {
61201 invasionWarn = 3600;
61203 }
61204 }
61205
61206 private static void InvasionWarning()
61207 {
61209 empty = ((invasionSize <= 0) ? ((invasionType == 2) ? Lang.misc[4] : ((invasionType == 3) ? Lang.misc[24] : ((invasionType != 4) ? (empty = Lang.misc[0]) : Lang.misc[42]))) : ((invasionX < (double)spawnTileX) ? ((invasionType == 2) ? Lang.misc[5] : ((invasionType == 3) ? Lang.misc[25] : ((invasionType != 4) ? (empty = Lang.misc[1]) : LocalizedText.Empty))) : ((invasionX > (double)spawnTileX) ? ((invasionType == 2) ? Lang.misc[6] : ((invasionType == 3) ? Lang.misc[26] : ((invasionType != 4) ? (empty = Lang.misc[2]) : LocalizedText.Empty))) : ((invasionType == 2) ? Lang.misc[7] : ((invasionType == 3) ? Lang.misc[27] : ((invasionType != 4) ? (empty = Lang.misc[3]) : Lang.misc[41]))))));
61210 if (netMode == 0)
61211 {
61212 NewText(empty.ToString(), 175, 75);
61213 }
61214 else if (netMode == 2 && empty.Value != "")
61215 {
61217 }
61218 }
61219
61220 public static bool CanStartInvasion(int type = 1, bool ignoreDelay = false)
61221 {
61222 if (invasionType != 0)
61223 {
61224 return false;
61225 }
61226 if (invasionDelay != 0 && !ignoreDelay)
61227 {
61228 return false;
61229 }
61230 int num = 0;
61231 for (int i = 0; i < 255; i++)
61232 {
61233 if (player[i].active && player[i].statLifeMax >= 200)
61234 {
61235 num++;
61236 }
61237 }
61238 return num > 0;
61239 }
61240
61241 public static void StartInvasion(int type = 1)
61242 {
61243 if (invasionType != 0 && invasionSize == 0)
61244 {
61245 invasionType = 0;
61246 }
61247 if (invasionType != 0)
61248 {
61249 return;
61250 }
61251 int num = 0;
61252 for (int i = 0; i < 255; i++)
61253 {
61254 if (player[i].active && player[i].statLifeMax >= 200)
61255 {
61256 num++;
61257 }
61258 }
61259 if (num > 0)
61260 {
61262 invasionSize = 80 + 40 * num;
61263 if (type == 3)
61264 {
61265 invasionSize += 40 + 20 * num;
61266 }
61267 if (type == 4)
61268 {
61269 invasionSize = 160 + 40 * num;
61270 }
61272 invasionProgress = 0;
61276 invasionWarn = 0;
61277 if (type == 4)
61278 {
61279 invasionX = spawnTileX - 1;
61280 invasionWarn = 2;
61281 }
61282 else if (rand.Next(2) == 0)
61283 {
61284 invasionX = 0.0;
61285 }
61286 else
61287 {
61289 }
61290 }
61291 }
61292
61293 public static void FakeLoadInvasionStart()
61294 {
61295 int num = 0;
61296 int num2 = 0;
61297 switch (invasionType)
61298 {
61299 case 1:
61300 case 2:
61301 num = 80;
61302 num2 = 40;
61303 break;
61304 case 3:
61305 num = 120;
61306 num2 = 60;
61307 break;
61308 case 4:
61309 num = 160;
61310 num2 = 40;
61311 break;
61312 }
61313 int num3 = (int)Math.Ceiling((float)(invasionSize - num) / (float)num2);
61314 invasionSizeStart = num;
61315 if (num3 > 0)
61316 {
61318 }
61319 }
61320
61321 private static void UpdateClient()
61322 {
61323 if (myPlayer == 255)
61324 {
61325 Netplay.Disconnect = true;
61326 }
61328 if (netPlayCounter > 3600)
61329 {
61330 netPlayCounter = 0;
61331 }
61332 if (netPlayCounter % 420 == 0)
61333 {
61334 NetMessage.SendData(13, -1, -1, null, myPlayer);
61335 }
61336 if (netPlayCounter % 900 == 0)
61337 {
61338 NetMessage.SendData(36, -1, -1, null, myPlayer);
61339 NetMessage.SendData(16, -1, -1, null, myPlayer);
61340 NetMessage.SendData(40, -1, -1, null, myPlayer);
61341 }
61342 if (Netplay.Connection.IsActive)
61343 {
61344 Netplay.Connection.TimeOutTimer++;
61345 if (!stopTimeOuts && Netplay.Connection.TimeOutTimer > 7200)
61346 {
61347 statusText = Lang.inter[43].Value;
61348 Netplay.Disconnect = true;
61349 }
61350 }
61351 for (int i = 0; i < 400; i++)
61352 {
61353 if (item[i].active && item[i].playerIndexTheItemIsReservedFor == myPlayer)
61354 {
61355 item[i].FindOwner(i);
61356 }
61357 }
61358 }
61359
61360 private static void UpdateServer()
61361 {
61363 if (netPlayCounter % 3600 == 0)
61364 {
61366 netPlayCounter = 0;
61367 }
61368 for (int i = 0; i < maxNetPlayers; i++)
61369 {
61370 if (player[i].active && Netplay.Clients[i].IsActive)
61371 {
61372 Netplay.Clients[i].SpamUpdate();
61373 }
61374 }
61375 if (Math.IEEERemainder(netPlayCounter, 900.0) == 0.0)
61376 {
61377 bool flag = true;
61378 int num = lastItemUpdate;
61379 int num2 = 0;
61380 while (flag)
61381 {
61382 num++;
61383 if (num >= 400)
61384 {
61385 num = 0;
61386 }
61387 num2++;
61388 if (!Main.item[num].active || Main.item[num].playerIndexTheItemIsReservedFor == 255)
61389 {
61390 NetMessage.SendData(21, -1, -1, null, num);
61391 }
61392 if (num2 >= maxItemUpdates || num == lastItemUpdate)
61393 {
61394 flag = false;
61395 }
61396 }
61397 lastItemUpdate = num;
61398 }
61399 for (int j = 0; j < 400; j++)
61400 {
61401 Item item = Main.item[j];
61402 if (item.active && (item.playerIndexTheItemIsReservedFor == 255 || !player[item.playerIndexTheItemIsReservedFor].active))
61403 {
61404 item.FindOwner(j);
61405 }
61406 }
61407 for (int k = 0; k < 255; k++)
61408 {
61409 if (Netplay.Clients[k].IsActive)
61410 {
61411 Netplay.Clients[k].TimeOutTimer++;
61412 if (Netplay.Clients[k].State == 0)
61413 {
61414 Netplay.Clients[k].TimeOutTimer += 3;
61415 }
61416 if (!stopTimeOuts && Netplay.Clients[k].TimeOutTimer > 7200)
61417 {
61418 Netplay.Clients[k].PendingTermination = true;
61419 Netplay.Clients[k].PendingTerminationApproved = true;
61420 }
61421 }
61422 if (player[k].active)
61423 {
61424 RemoteClient.CheckSection(k, player[k].position);
61425 }
61426 }
61427 }
61428
61429 public static void NewText(string newText, byte R = byte.MaxValue, byte G = byte.MaxValue, byte B = byte.MaxValue)
61430 {
61431 chatMonitor.NewText(newText, R, G, B);
61433 }
61434
61435 public static void NewTextMultiline(string text, bool force = false, Microsoft.Xna.Framework.Color c = default(Microsoft.Xna.Framework.Color), int WidthLimit = -1)
61436 {
61437 chatMonitor.NewTextMultiline(text, force, c, WidthLimit);
61439 }
61440
61441 public static void StopRain()
61442 {
61443 rainTime = 0;
61444 raining = false;
61445 maxRaining = 0f;
61446 }
61447
61448 public static void StartRain()
61449 {
61450 int num = 86400;
61451 int num2 = num / 24;
61452 int num3 = rand.Next(num2 * 8, num);
61453 if (rand.Next(3) == 0)
61454 {
61455 num3 += rand.Next(0, num2);
61456 }
61457 if (rand.Next(4) == 0)
61458 {
61459 num3 += rand.Next(0, num2 * 2);
61460 }
61461 if (rand.Next(5) == 0)
61462 {
61463 num3 += rand.Next(0, num2 * 2);
61464 }
61465 if (rand.Next(6) == 0)
61466 {
61467 num3 += rand.Next(0, num2 * 3);
61468 }
61469 if (rand.Next(7) == 0)
61470 {
61471 num3 += rand.Next(0, num2 * 4);
61472 }
61473 if (rand.Next(8) == 0)
61474 {
61475 num3 += rand.Next(0, num2 * 5);
61476 }
61477 float num4 = 1f;
61478 if (rand.Next(2) == 0)
61479 {
61480 num4 += 0.05f;
61481 }
61482 if (rand.Next(3) == 0)
61483 {
61484 num4 += 0.1f;
61485 }
61486 if (rand.Next(4) == 0)
61487 {
61488 num4 += 0.15f;
61489 }
61490 if (rand.Next(5) == 0)
61491 {
61492 num4 += 0.2f;
61493 }
61494 rainTime = (int)((float)num3 * num4);
61495 ChangeRain();
61496 raining = true;
61497 }
61498
61499 private static void ChangeRain()
61500 {
61501 float num = ((cloudBGActive >= 1f || (double)numClouds > 150.0) ? ((rand.Next(3) != 0) ? ((float)rand.Next(40, 91) * 0.01f) : ((float)rand.Next(20, 91) * 0.01f)) : (((double)numClouds > 100.0) ? ((rand.Next(3) != 0) ? ((float)rand.Next(20, 61) * 0.01f) : ((float)rand.Next(10, 71) * 0.01f)) : ((rand.Next(3) != 0) ? ((float)rand.Next(5, 31) * 0.01f) : ((float)rand.Next(5, 41) * 0.01f))));
61502 maxRaining = num;
61503 }
61504
61505 public static void StartSlimeRain(bool announce = true)
61506 {
61507 if (remixWorld || slimeRain)
61508 {
61509 return;
61510 }
61511 if (netMode == 1)
61512 {
61513 slimeRainTime = 54000.0;
61514 slimeRain = true;
61515 SkyManager.Instance.Activate("Slime", default(Vector2));
61516 }
61517 else
61518 {
61519 if (raining)
61520 {
61521 return;
61522 }
61523 if (slimeRainTime <= 0.0)
61524 {
61525 slimeRainTime = rand.Next(32400, 54000);
61526 }
61527 slimeRain = true;
61529 if (netMode == 0)
61530 {
61531 SkyManager.Instance.Activate("Slime", default(Vector2));
61532 if (announce)
61533 {
61535 }
61536 }
61537 else if (announce)
61538 {
61541 }
61542 }
61543 }
61544
61545 public static void StopSlimeRain(bool announce = true)
61546 {
61547 if (!slimeRain)
61548 {
61549 return;
61550 }
61551 if (netMode == 1)
61552 {
61553 slimeRainTime = 0.0;
61554 slimeRain = false;
61555 SkyManager.Instance.Deactivate("Slime");
61556 return;
61557 }
61558 int num = 86400 * 7;
61559 if (hardMode)
61560 {
61561 num *= 2;
61562 }
61563 slimeRainTime = -rand.Next(3024, 6048) * 100;
61564 slimeRain = false;
61565 if (netMode == 0)
61566 {
61567 if (announce)
61568 {
61570 }
61571 SkyManager.Instance.Deactivate("Slime");
61572 }
61573 else if (announce)
61574 {
61577 }
61578 }
61579
61580 private static void UpdateTime()
61581 {
61583 {
61584 cloudBGActive = 0f;
61585 if (numClouds > 30)
61586 {
61587 numClouds = 30;
61588 }
61589 }
61590 if (ladyBugRainBoost > 0)
61591 {
61593 }
61594 if (pumpkinMoon)
61595 {
61596 bloodMoon = false;
61597 snowMoon = false;
61598 }
61599 if (snowMoon)
61600 {
61601 bloodMoon = false;
61602 }
61603 if ((netMode != 1 && !gameMenu) || netMode == 2)
61604 {
61605 if (slimeRainTime > 0.0)
61606 {
61608 if (slimeRainTime <= 0.0)
61609 {
61610 StopSlimeRain();
61611 }
61612 }
61613 else if (slimeRainTime < 0.0)
61614 {
61616 if (slimeRainTime > 0.0)
61617 {
61618 slimeRainTime = 0.0;
61619 }
61620 }
61621 if (raining)
61622 {
61624 {
61626 {
61627 StopRain();
61628 }
61629 else
61630 {
61631 rainTime -= dayRate;
61632 if (dayRate > 0)
61633 {
61634 int num = 86400 / dayRate / 24;
61635 if (rainTime <= 0)
61636 {
61637 StopRain();
61638 }
61639 else if (rand.Next(num * 2) == 0)
61640 {
61641 ChangeRain();
61642 }
61643 }
61644 }
61645 }
61646 }
61648 {
61649 int num2 = 86400;
61650 num2 /= ((dayRate == 0) ? 1 : dayRate);
61652 {
61653 if (rand.Next((int)((double)num2 * 5.75)) == 0)
61654 {
61655 StartRain();
61656 }
61657 else if (cloudBGActive >= 1f && rand.Next((int)((double)num2 * 4.25)) == 0)
61658 {
61659 StartRain();
61660 }
61661 else if (ladyBugRainBoost > 0 && rand.Next(num2) == 0)
61662 {
61663 StartRain();
61664 }
61665 }
61667 {
61668 int num3 = (int)(450000.00000000006 / (double)dayRate);
61669 if (!NPC.downedSlimeKing)
61670 {
61671 num3 /= 2;
61672 }
61673 if (hardMode)
61674 {
61675 num3 = (int)((double)num3 * 1.5);
61676 }
61677 bool flag = AnyPlayerReadyToFightKingSlime();
61678 if (!flag)
61679 {
61680 num3 *= 5;
61681 }
61682 if (num3 > 0 && (flag || expertMode) && rand.Next(num3) == 0)
61683 {
61685 }
61686 }
61687 }
61688 }
61690 {
61691 if (netMode == 2)
61692 {
61694 }
61696 }
61698 double num4 = time;
61699 time += dayRate;
61706 WorldGen.mysticLogsEvent.UpdateTime();
61707 PylonSystem.Update();
61708 if (!dedServ)
61709 {
61710 if (NPC.MoonLordCountdown > 0)
61711 {
61712 float num5 = MathHelper.Clamp((float)Math.Sin((float)NPC.MoonLordCountdown / 60f * 0.5f) * 2f, 0f, 1f);
61713 num5 *= 0.75f - 0.5f * ((float)NPC.MoonLordCountdown / (float)NPC.MaxMoonLordCountdown);
61714 if (!Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].IsActive())
61715 {
61716 Terraria.Graphics.Effects.Filters.Scene.Activate("MoonLordShake", Main.player[myPlayer].position);
61717 }
61718 Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].GetShader().UseIntensity(num5);
61719 }
61720 else if (Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].IsActive())
61721 {
61722 Terraria.Graphics.Effects.Filters.Scene.Deactivate("MoonLordShake");
61723 }
61724 }
61725 if (NPC.MoonLordCountdown > 0)
61726 {
61728 if (NPC.MoonLordCountdown <= 0 && netMode != 1)
61729 {
61730 NPC.SpawnOnPlayer(Player.FindClosest(new Vector2(maxTilesX / 2, (float)worldSurface / 2f) * 16f, 0, 0), 398);
61731 }
61732 }
61733 if (NPC.taxCollector && netMode != 2 && !gameMenu)
61734 {
61735 Main.player[myPlayer].taxTimer += dayRate;
61736 if (Main.player[myPlayer].taxTimer >= Player.taxRate)
61737 {
61738 Main.player[myPlayer].taxTimer -= Player.taxRate;
61739 Main.player[myPlayer].CollectTaxes();
61740 }
61741 }
61742 if (netMode != 1)
61743 {
61745 }
61746 if (netMode != 1)
61747 {
61748 if (NPC.travelNPC)
61749 {
61750 if (!dayTime || time > 48600.0)
61751 {
61753 }
61754 }
61755 else if (!IsFastForwardingTime() && dayTime && time < 27000.0)
61756 {
61757 int num6 = dayRate;
61758 if (num6 < 1)
61759 {
61760 num6 = 1;
61761 }
61762 int num7 = (int)(27000.0 / (double)num6);
61763 num7 *= 4;
61764 if (rand.Next(num7) == 0)
61765 {
61766 int num8 = 0;
61767 for (int i = 0; i < 200; i++)
61768 {
61769 if (npc[i].active && npc[i].townNPC && npc[i].type != 37 && npc[i].type != 453)
61770 {
61771 num8++;
61772 }
61773 }
61774 if (num8 >= 2)
61775 {
61777 }
61778 }
61779 }
61780 NPC.travelNPC = false;
61781 }
61783 if (!dayTime)
61784 {
61785 eclipse = false;
61787 {
61788 if (WorldGen.spawnEye && netMode != 1 && time > 4860.0)
61789 {
61790 for (int j = 0; j < 255; j++)
61791 {
61792 if (Main.player[j].active && !Main.player[j].dead && ((double)Main.player[j].position.Y < worldSurface * 16.0 || remixWorld))
61793 {
61794 NPC.SpawnOnPlayer(j, 4);
61795 WorldGen.spawnEye = false;
61796 break;
61797 }
61798 }
61799 }
61800 if (WorldGen.spawnHardBoss > 0 && netMode != 1 && time > 4860.0)
61801 {
61802 bool flag2 = false;
61803 for (int k = 0; k < 200; k++)
61804 {
61805 if (npc[k].active && npc[k].boss)
61806 {
61807 flag2 = true;
61808 }
61809 }
61810 if (!flag2)
61811 {
61812 for (int l = 0; l < 255; l++)
61813 {
61814 if (Main.player[l].active && !Main.player[l].dead && ((double)Main.player[l].position.Y < worldSurface * 16.0 || remixWorld))
61815 {
61816 if (remixWorld && getGoodWorld)
61817 {
61819 }
61820 else if (WorldGen.spawnHardBoss == 1)
61821 {
61822 NPC.SpawnOnPlayer(l, 134);
61823 }
61824 else if (WorldGen.spawnHardBoss == 2)
61825 {
61826 NPC.SpawnOnPlayer(l, 125);
61827 NPC.SpawnOnPlayer(l, 126);
61828 }
61829 else if (WorldGen.spawnHardBoss == 3)
61830 {
61831 NPC.SpawnOnPlayer(l, 127);
61832 }
61833 break;
61834 }
61835 }
61836 }
61837 WorldGen.spawnHardBoss = 0;
61838 }
61839 if (netMode != 1)
61840 {
61841 double num9 = 16200.0;
61843 bool flag3 = raining;
61844 if (num10 && flag3 && (!NPC.downedDeerclops || rand.Next(4) == 0))
61845 {
61846 for (int m = 0; m < 255; m++)
61847 {
61849 if (player.active && !player.dead && !((double)player.position.Y >= worldSurface * 16.0) && player.ZoneSnow && !(player.townNPCs > 0f) && (player.statLifeMax2 >= 200 || player.statDefense >= 9) && !NPC.AnyDanger())
61850 {
61851 NPC.SpawnOnPlayer(m, 668);
61852 break;
61853 }
61854 }
61855 }
61856 }
61857 }
61858 if (time > 32400.0)
61859 {
61861 }
61863 }
61864 else
61865 {
61866 WorldGen.spawnHardBoss = 0;
61867 WorldGen.spawnEye = false;
61868 bloodMoon = false;
61869 stopMoonEvent();
61870 if (time > 54000.0)
61871 {
61873 }
61875 }
61876 }
61877
61879 {
61880 for (int i = 0; i < 255; i++)
61881 {
61882 if (player[i].active && player[i].statLifeMax > 140 && player[i].statDefense > 8)
61883 {
61884 return true;
61885 }
61886 }
61887 return false;
61888 }
61889
61890 public static void SkipToTime(int timeToSet, bool setIsDayTime)
61891 {
61892 _ = time;
61893 _ = dayTime;
61894 while (setIsDayTime != dayTime)
61895 {
61897 if (dayTime)
61898 {
61900 }
61901 else
61902 {
61904 }
61905 }
61906 time = timeToSet;
61907 if (netMode == 2)
61908 {
61910 }
61911 }
61912
61914 {
61916 {
61917 return LanternNight.LanternsUp;
61918 }
61919 return true;
61920 }
61921
61922 public static void UpdateTime_StartNight(ref bool stopEvents)
61923 {
61925 {
61926 fastForwardTimeToDusk = false;
61928 }
61929 if (moondialCooldown > 0)
61930 {
61932 }
61934 NPC.freeCake = false;
61935 Star.NightSetup();
61939 WorldGen.mysticLogsEvent.StartNight();
61940 WorldGen.prioritizedTownNPCType = 0;
61941 checkForSpawns = 0;
61942 if (rand.Next(50) == 0 && netMode != 1 && NPC.downedBoss2)
61943 {
61944 WorldGen.spawnMeteor = true;
61945 }
61947 {
61948 stopEvents = true;
61949 }
61950 if (eclipse && netMode != 1)
61951 {
61953 }
61954 eclipse = false;
61955 if (netMode != 1)
61956 {
61958 }
61960 {
61961 if (!NPC.downedBoss1 && netMode != 1)
61962 {
61963 bool flag = false;
61964 for (int i = 0; i < 255; i++)
61965 {
61966 if (player[i].active && player[i].statLifeMax >= 200 && player[i].statDefense > 10)
61967 {
61968 flag = true;
61969 break;
61970 }
61971 }
61972 if (flag && rand.Next(3) == 0)
61973 {
61974 int num = 0;
61975 for (int j = 0; j < 200; j++)
61976 {
61977 if (npc[j].active && npc[j].townNPC)
61978 {
61979 num++;
61980 }
61981 }
61982 if (num >= 4)
61983 {
61984 WorldGen.spawnEye = true;
61985 if (netMode == 0)
61986 {
61987 NewText(Lang.misc[9].Value, 50, byte.MaxValue, 130);
61988 }
61989 else if (netMode == 2)
61990 {
61991 ChatHelper.BroadcastChatMessage(Lang.misc[9].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
61992 }
61993 }
61994 }
61995 }
61996 if (netMode != 1 && !pumpkinMoon && !DD2Event.Ongoing && !snowMoon && WorldGen.altarCount > 0 && hardMode && !WorldGen.spawnEye && rand.Next(10) == 0)
61997 {
61998 bool flag2 = false;
61999 for (int k = 0; k < 200; k++)
62000 {
62001 if (npc[k].active && npc[k].boss)
62002 {
62003 flag2 = true;
62004 }
62005 }
62007 {
62008 if (remixWorld && getGoodWorld)
62009 {
62010 if (rand.Next(2) == 0)
62011 {
62012 WorldGen.spawnHardBoss = rand.Next(3) + 1;
62013 if (netMode == 0)
62014 {
62015 NewText(Lang.misc[108].Value, 50, byte.MaxValue, 130);
62016 }
62017 else if (netMode == 2)
62018 {
62019 ChatHelper.BroadcastChatMessage(Lang.misc[108].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62020 }
62021 }
62022 }
62023 else
62024 {
62025 for (int l = 0; l < 1000; l++)
62026 {
62027 int num2 = rand.Next(3) + 1;
62028 if (num2 == 1 && !NPC.downedMechBoss1)
62029 {
62030 WorldGen.spawnHardBoss = num2;
62031 if (netMode == 0)
62032 {
62033 NewText(Lang.misc[28].Value, 50, byte.MaxValue, 130);
62034 }
62035 else if (netMode == 2)
62036 {
62037 ChatHelper.BroadcastChatMessage(Lang.misc[28].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62038 }
62039 break;
62040 }
62041 if (num2 == 2 && !NPC.downedMechBoss2)
62042 {
62043 WorldGen.spawnHardBoss = num2;
62044 if (netMode == 0)
62045 {
62046 NewText(Lang.misc[29].Value, 50, byte.MaxValue, 130);
62047 }
62048 else if (netMode == 2)
62049 {
62050 ChatHelper.BroadcastChatMessage(Lang.misc[29].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62051 }
62052 break;
62053 }
62054 if (num2 == 3 && !NPC.downedMechBoss3)
62055 {
62056 WorldGen.spawnHardBoss = num2;
62057 if (netMode == 0)
62058 {
62059 NewText(Lang.misc[30].Value, 50, byte.MaxValue, 130);
62060 }
62061 else if (netMode == 2)
62062 {
62063 ChatHelper.BroadcastChatMessage(Lang.misc[30].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62064 }
62065 break;
62066 }
62067 }
62068 }
62069 }
62070 }
62071 int maxValue = 9;
62073 {
62074 maxValue = 6;
62075 }
62076 if (!WorldGen.spawnEye && moonPhase != 4 && rand.Next(maxValue) == 0 && netMode != 1)
62077 {
62078 for (int m = 0; m < 255; m++)
62079 {
62080 if (player[m].active && player[m].statLifeMax > 120)
62081 {
62082 bloodMoon = true;
62083 break;
62084 }
62085 }
62086 if (bloodMoon)
62087 {
62088 sundialCooldown = 0;
62089 moondialCooldown = 0;
62091 if (netMode == 0)
62092 {
62093 NewText(Lang.misc[8].Value, 50, byte.MaxValue, 130);
62094 }
62095 else if (netMode == 2)
62096 {
62097 ChatHelper.BroadcastChatMessage(Lang.misc[8].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62098 }
62099 }
62100 }
62101 }
62102 time = 0.0;
62103 dayTime = false;
62104 if (netMode == 2)
62105 {
62107 }
62108 }
62109
62110 public static void UpdateTime_StartDay(ref bool stopEvents)
62111 {
62114 {
62115 fastForwardTimeToDawn = false;
62117 }
62121 if (invasionDelay > 0)
62122 {
62123 invasionDelay--;
62124 }
62125 WorldGen.prioritizedTownNPCType = 0;
62126 checkForSpawns = 0;
62127 time = 0.0;
62128 if (bloodMoon && netMode != 1)
62129 {
62131 }
62132 bloodMoon = false;
62135 checkXMas();
62137 stopMoonEvent();
62138 dayTime = true;
62139 if (sundialCooldown > 0)
62140 {
62142 }
62143 moonPhase++;
62144 if (moonPhase >= 8)
62145 {
62146 moonPhase = 0;
62147 }
62148 if (drunkWorld && netMode != 1)
62149 {
62150 WorldGen.crimson = !WorldGen.crimson;
62151 }
62152 if (netMode == 2)
62153 {
62155 }
62156 if (netMode == 1)
62157 {
62158 return;
62159 }
62161 if (stopEvents)
62162 {
62163 return;
62164 }
62165 if (hardMode && NPC.downedMechBossAny && rand.Next(20) == 0)
62166 {
62167 sundialCooldown = 0;
62168 moondialCooldown = 0;
62169 eclipse = true;
62171 if (eclipse)
62172 {
62173 if (remixWorld)
62174 {
62175 if (netMode == 0)
62176 {
62177 NewText(Lang.misc[106].Value, 50, byte.MaxValue, 130);
62178 }
62179 else if (netMode == 2)
62180 {
62181 ChatHelper.BroadcastChatMessage(Lang.misc[106].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62182 }
62183 }
62184 else if (netMode == 0)
62185 {
62186 NewText(Lang.misc[20].Value, 50, byte.MaxValue, 130);
62187 }
62188 else if (netMode == 2)
62189 {
62190 ChatHelper.BroadcastChatMessage(Lang.misc[20].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, 255, 130));
62191 }
62192 }
62193 if (netMode == 2)
62194 {
62196 }
62197 }
62198 else
62199 {
62201 {
62202 return;
62203 }
62205 {
62206 if (!NPC.downedGoblins)
62207 {
62208 if (rand.Next(3) == 0)
62209 {
62210 StartInvasion();
62211 }
62212 }
62213 else if ((hardMode && rand.Next(60) == 0) || (!hardMode && rand.Next(30) == 0))
62214 {
62215 StartInvasion();
62216 }
62217 }
62218 if (invasionType == 0 && hardMode && WorldGen.altarCount > 0 && ((NPC.downedPirates && rand.Next(60) == 0) || (!NPC.downedPirates && rand.Next(30) == 0)))
62219 {
62220 StartInvasion(3);
62221 }
62222 }
62223 }
62224
62225 private static void HandleMeteorFall()
62226 {
62227 if (netMode != 1 && WorldGen.spawnMeteor)
62228 {
62229 if (time < 15000.0)
62230 {
62231 _canShowMeteorFall = true;
62232 }
62233 else
62234 {
62235 if (_canShowMeteorFall && time <= 16200.0)
62236 {
62238 {
62239 skyEntityType = SkyEntityType.Meteor,
62240 targetPlayer = -1
62241 });
62242 }
62243 _canShowMeteorFall = false;
62244 }
62245 }
62246 if (time > 16200.0 && WorldGen.spawnMeteor)
62247 {
62248 WorldGen.spawnMeteor = false;
62250 }
62251 }
62252
62253 private static void UpdateSlimeRainWarning()
62254 {
62255 if (slimeWarningTime <= 0)
62256 {
62257 return;
62258 }
62260 if (slimeWarningTime > 0)
62261 {
62262 return;
62263 }
62264 if (netMode == 0)
62265 {
62266 if (slimeRainTime > 0.0)
62267 {
62268 NewText(Lang.gen[74].Value, 50, byte.MaxValue, 130);
62269 }
62270 else
62271 {
62272 NewText(Lang.gen[75].Value, 50, byte.MaxValue, 130);
62273 }
62274 }
62275 else if (slimeRainTime > 0.0)
62276 {
62278 }
62279 else
62280 {
62282 }
62283 }
62284
62286 {
62287 float num = 0f;
62288 int num2 = 0;
62290 for (int i = 0; i < entries.Count; i++)
62291 {
62292 int num3 = ((entries[i].UIInfoProvider.GetEntryUICollectionInfo().UnlockState > BestiaryEntryUnlockState.NotKnownAtAll_0) ? 1 : 0);
62293 num2++;
62294 num += (float)num3;
62295 }
62297 result.EntriesTotal = num2;
62298 result.CompletionAmountTotal = num;
62299 return result;
62300 }
62301
62302 private static void UpdateTime_SpawnTownNPCs()
62303 {
62305 if (netMode == 1 || worldUpdateRate <= 0)
62306 {
62307 return;
62308 }
62310 if (checkForSpawns < 7200 / worldUpdateRate)
62311 {
62312 return;
62313 }
62314 checkForSpawns = 0;
62315 int num = 0;
62316 for (int i = 0; i < 255; i++)
62317 {
62318 if (player[i].active)
62319 {
62320 num++;
62321 }
62322 }
62323 for (int j = 0; j < NPCID.Count; j++)
62324 {
62325 townNPCCanSpawn[j] = false;
62326 }
62327 WorldGen.prioritizedTownNPCType = 0;
62328 int num2 = 0;
62329 int num3 = 0;
62330 int num4 = 0;
62331 int num5 = 0;
62332 int num6 = 0;
62333 int num7 = 0;
62334 int num8 = 0;
62335 int num9 = 0;
62336 int num10 = 0;
62337 int num11 = 0;
62338 int num12 = 0;
62339 int num13 = 0;
62340 int num14 = 0;
62341 int num15 = 0;
62342 int num16 = 0;
62343 int num17 = 0;
62344 int num18 = 0;
62345 int num19 = 0;
62346 int num20 = 0;
62347 int num21 = 0;
62348 int num22 = 0;
62349 int num23 = 0;
62350 int num24 = 0;
62351 int num25 = 0;
62352 int num26 = 0;
62353 int num27 = 0;
62354 int num28 = 0;
62355 int num29 = 0;
62356 int num30 = 0;
62357 int num31 = 0;
62358 int num32 = 0;
62359 int num33 = 0;
62360 int num34 = 0;
62361 int num35 = 0;
62362 int num36 = 0;
62363 int num37 = 0;
62364 int num38 = 0;
62365 int num39 = 0;
62366 int num40 = 0;
62367 for (int k = 0; k < 200; k++)
62368 {
62369 if (npc[k].active && npc[k].townNPC)
62370 {
62371 if (npc[k].type != 368 && npc[k].type != 37 && npc[k].type != 453 && !npc[k].homeless)
62372 {
62374 }
62375 if (npc[k].type == 37)
62376 {
62377 num7++;
62378 }
62379 if (npc[k].type == 17)
62380 {
62381 num2++;
62382 }
62383 if (npc[k].type == 18)
62384 {
62385 num3++;
62386 }
62387 if (npc[k].type == 19)
62388 {
62389 num5++;
62390 }
62391 if (npc[k].type == 20)
62392 {
62393 num4++;
62394 }
62395 if (npc[k].type == 22)
62396 {
62397 num6++;
62398 }
62399 if (npc[k].type == 38)
62400 {
62401 num8++;
62402 }
62403 if (npc[k].type == 54)
62404 {
62405 num9++;
62406 }
62407 if (npc[k].type == 107)
62408 {
62409 num11++;
62410 }
62411 if (npc[k].type == 108)
62412 {
62413 num10++;
62414 }
62415 if (npc[k].type == 124)
62416 {
62417 num12++;
62418 }
62419 if (npc[k].type == 142)
62420 {
62421 num13++;
62422 }
62423 if (npc[k].type == 160)
62424 {
62425 num14++;
62426 }
62427 if (npc[k].type == 178)
62428 {
62429 num15++;
62430 }
62431 if (npc[k].type == 207)
62432 {
62433 num16++;
62434 }
62435 if (npc[k].type == 208)
62436 {
62437 num17++;
62438 }
62439 if (npc[k].type == 209)
62440 {
62441 num18++;
62442 }
62443 if (npc[k].type == 227)
62444 {
62445 num19++;
62446 }
62447 if (npc[k].type == 228)
62448 {
62449 num20++;
62450 }
62451 if (npc[k].type == 229)
62452 {
62453 num21++;
62454 }
62455 if (npc[k].type == 353)
62456 {
62457 num22++;
62458 }
62459 if (npc[k].type == 369)
62460 {
62461 num23++;
62462 }
62463 if (npc[k].type == 441)
62464 {
62465 num24++;
62466 }
62467 if (npc[k].type == 550)
62468 {
62469 num25++;
62470 }
62471 if (npc[k].type == 588)
62472 {
62473 num26++;
62474 }
62475 if (npc[k].type == 633)
62476 {
62477 num27++;
62478 }
62479 if (npc[k].type == 637)
62480 {
62481 num28++;
62482 }
62483 if (npc[k].type == 638)
62484 {
62485 num29++;
62486 }
62487 if (npc[k].type == 656)
62488 {
62489 num30++;
62490 }
62491 if (npc[k].type == 670)
62492 {
62493 num31++;
62494 }
62495 if (npc[k].type == 678)
62496 {
62497 num32++;
62498 }
62499 if (npc[k].type == 679)
62500 {
62501 num33++;
62502 }
62503 if (npc[k].type == 680)
62504 {
62505 num34++;
62506 }
62507 if (npc[k].type == 681)
62508 {
62509 num35++;
62510 }
62511 if (npc[k].type == 682)
62512 {
62513 num36++;
62514 }
62515 if (npc[k].type == 683)
62516 {
62517 num37++;
62518 }
62519 if (npc[k].type == 684)
62520 {
62521 num38++;
62522 }
62523 if (npc[k].type == 663)
62524 {
62525 num39++;
62526 }
62527 num40++;
62528 }
62529 }
62531 {
62532 bool flag = NPC.SpawnAllowed_Merchant();
62534 bool flag3 = NPC.SpawnAllowed_Nurse();
62538 if (!NPC.downedBoss3 && num7 == 0)
62539 {
62540 int num41 = NPC.NewNPC(NPC.GetSpawnSourceForTownSpawn(), dungeonX * 16 + 8, dungeonY * 16, 37);
62541 npc[num41].homeless = false;
62542 npc[num41].homeTileX = dungeonX;
62543 npc[num41].homeTileY = dungeonY;
62544 }
62545 bool flag6 = false;
62546 if (rand.Next(40) == 0)
62547 {
62548 flag6 = true;
62549 }
62550 bool flag7 = flag6 && num40 >= 14;
62552 {
62553 flag7 = true;
62554 }
62557 {
62558 flag8 = true;
62559 }
62560 if (num6 < 1)
62561 {
62562 townNPCCanSpawn[22] = true;
62563 }
62564 if (flag && num2 < 1)
62565 {
62566 townNPCCanSpawn[17] = true;
62567 }
62568 if (flag3 && num3 < 1 && num2 > 0)
62569 {
62570 townNPCCanSpawn[18] = true;
62571 }
62572 if (flag2 && num5 < 1)
62573 {
62574 townNPCCanSpawn[19] = true;
62575 }
62576 if ((NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3) && num4 < 1)
62577 {
62578 townNPCCanSpawn[20] = true;
62579 }
62580 if (flag5 && num2 > 0 && num8 < 1)
62581 {
62582 townNPCCanSpawn[38] = true;
62583 }
62584 if (NPC.savedStylist && num22 < 1)
62585 {
62586 townNPCCanSpawn[353] = true;
62587 }
62588 if (NPC.savedAngler && num23 < 1)
62589 {
62590 townNPCCanSpawn[369] = true;
62591 }
62592 if (NPC.downedBoss3 && num9 < 1)
62593 {
62594 townNPCCanSpawn[54] = true;
62595 }
62596 if (NPC.savedGoblin && num11 < 1)
62597 {
62598 townNPCCanSpawn[107] = true;
62599 }
62600 if (NPC.savedTaxCollector && num24 < 1)
62601 {
62602 townNPCCanSpawn[441] = true;
62603 }
62604 if (NPC.savedWizard && num10 < 1)
62605 {
62606 townNPCCanSpawn[108] = true;
62607 }
62608 if (NPC.savedMech && num12 < 1)
62609 {
62610 townNPCCanSpawn[124] = true;
62611 }
62612 if (NPC.downedFrost && num13 < 1 && xMas)
62613 {
62614 townNPCCanSpawn[142] = true;
62615 }
62617 {
62618 townNPCCanSpawn[178] = true;
62619 }
62620 if (flag4 && num16 < 1 && num40 >= 4)
62621 {
62622 townNPCCanSpawn[207] = true;
62623 }
62624 if (NPC.downedQueenBee && num20 < 1)
62625 {
62626 townNPCCanSpawn[228] = true;
62627 }
62628 if (NPC.downedPirates && num21 < 1)
62629 {
62630 townNPCCanSpawn[229] = true;
62631 }
62632 if (num14 < 1 && hardMode)
62633 {
62634 townNPCCanSpawn[160] = true;
62635 }
62636 if (hardMode && NPC.downedPlantBoss && num18 < 1)
62637 {
62638 townNPCCanSpawn[209] = true;
62639 }
62640 if (num40 >= 8 && num19 < 1)
62641 {
62642 townNPCCanSpawn[227] = true;
62643 }
62644 if (flag7 && num17 < 1)
62645 {
62646 townNPCCanSpawn[208] = true;
62647 }
62648 if (NPC.savedBartender && num25 < 1)
62649 {
62650 townNPCCanSpawn[550] = true;
62651 }
62652 if (NPC.savedGolfer && num26 < 1)
62653 {
62654 townNPCCanSpawn[588] = true;
62655 }
62656 if (bestiaryProgressReport.CompletionPercent >= 0.1f && num27 < 1)
62657 {
62658 townNPCCanSpawn[633] = true;
62659 }
62660 if (NPC.boughtCat && num28 < 1)
62661 {
62662 townNPCCanSpawn[637] = true;
62663 }
62664 if (NPC.boughtDog && num29 < 1)
62665 {
62666 townNPCCanSpawn[638] = true;
62667 }
62668 if (NPC.boughtBunny && num30 < 1)
62669 {
62670 townNPCCanSpawn[656] = true;
62671 }
62672 if (NPC.unlockedSlimeBlueSpawn && num31 < 1)
62673 {
62674 townNPCCanSpawn[670] = true;
62675 }
62676 if (flag8 && num32 < 1)
62677 {
62678 townNPCCanSpawn[678] = true;
62679 }
62680 if (NPC.unlockedSlimeOldSpawn && num33 < 1)
62681 {
62682 townNPCCanSpawn[679] = true;
62683 }
62685 {
62686 townNPCCanSpawn[680] = true;
62687 }
62689 {
62690 townNPCCanSpawn[681] = true;
62691 }
62692 if (NPC.unlockedSlimeRedSpawn && num36 < 1)
62693 {
62694 townNPCCanSpawn[682] = true;
62695 }
62697 {
62698 townNPCCanSpawn[683] = true;
62699 }
62701 {
62702 townNPCCanSpawn[684] = true;
62703 }
62704 bool flag9 = num2 > 0 && num3 > 0 && num4 > 0 && num5 > 0 && num6 > 0 && num8 > 0 && num9 > 0 && num10 > 0 && num11 > 0 && num12 > 0 && num14 > 0 && num15 > 0 && num16 > 0 && num17 > 0 && num18 > 0 && num19 > 0 && num20 > 0 && num21 > 0 && num22 > 0 && num23 > 0 && num24 > 0 && num25 > 0 && num26 > 0 && num27 > 0;
62706 {
62707 flag9 = true;
62708 }
62710 {
62711 flag9 = true;
62712 }
62713 if (flag9 && num39 < 1)
62714 {
62715 townNPCCanSpawn[663] = true;
62716 }
62718 if (num42 == 0 && NPC.boughtCat && num28 < 1)
62719 {
62720 num42 = 637;
62721 }
62722 if (num42 == 0 && NPC.boughtDog && num29 < 1)
62723 {
62724 num42 = 638;
62725 }
62726 if (num42 == 0 && NPC.boughtBunny && num30 < 1)
62727 {
62728 num42 = 656;
62729 }
62730 if (num42 == 0 && NPC.unlockedSlimeBlueSpawn && num31 < 1)
62731 {
62732 num42 = 670;
62733 }
62734 if (num42 == 0 && flag8 && num32 < 1)
62735 {
62736 num42 = 678;
62737 }
62738 if (num42 == 0 && NPC.unlockedSlimeOldSpawn && num33 < 1)
62739 {
62740 num42 = 679;
62741 }
62742 if (num42 == 0 && NPC.unlockedSlimePurpleSpawn && num34 < 1)
62743 {
62744 num42 = 680;
62745 }
62746 if (num42 == 0 && NPC.unlockedSlimeRainbowSpawn && num35 < 1)
62747 {
62748 num42 = 681;
62749 }
62750 if (num42 == 0 && NPC.unlockedSlimeRedSpawn && num36 < 1)
62751 {
62752 num42 = 682;
62753 }
62754 if (num42 == 0 && NPC.unlockedSlimeYellowSpawn && num37 < 1)
62755 {
62756 num42 = 683;
62757 }
62758 if (num42 == 0 && NPC.unlockedSlimeCopperSpawn && num38 < 1)
62759 {
62760 num42 = 684;
62761 }
62762 if (num42 == 0 && num6 < 1)
62763 {
62764 num42 = 22;
62765 }
62766 if (num42 == 0 && flag && num2 < 1)
62767 {
62768 num42 = 17;
62769 }
62770 if (num42 == 0 && flag3 && num3 < 1 && num2 > 0)
62771 {
62772 num42 = 18;
62773 }
62774 if (num42 == 0 && flag2 && num5 < 1)
62775 {
62776 num42 = 19;
62777 }
62778 if (num42 == 0 && NPC.savedGoblin && num11 < 1)
62779 {
62780 num42 = 107;
62781 }
62782 if (num42 == 0 && NPC.savedTaxCollector && num24 < 1)
62783 {
62784 num42 = 441;
62785 }
62786 if (num42 == 0 && NPC.savedWizard && num10 < 1)
62787 {
62788 num42 = 108;
62789 }
62790 if (num42 == 0 && hardMode && num14 < 1)
62791 {
62792 num42 = 160;
62793 }
62794 if (num42 == 0 && (NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3) && num4 < 1)
62795 {
62796 num42 = 20;
62797 }
62798 if (num42 == 0 && flag5 && num2 > 0 && num8 < 1)
62799 {
62800 num42 = 38;
62801 }
62802 if (num42 == 0 && NPC.downedQueenBee && num20 < 1)
62803 {
62804 num42 = 228;
62805 }
62806 if (num42 == 0 && NPC.downedMechBossAny && num15 < 1)
62807 {
62808 num42 = 178;
62809 }
62810 if (num42 == 0 && NPC.savedMech && num12 < 1)
62811 {
62812 num42 = 124;
62813 }
62814 if (num42 == 0 && NPC.savedAngler && num23 < 1)
62815 {
62816 num42 = 369;
62817 }
62818 if (num42 == 0 && hardMode && NPC.downedPlantBoss && num18 < 1)
62819 {
62820 num42 = 209;
62821 }
62822 if (num42 == 0 && NPC.downedPirates && num21 < 1)
62823 {
62824 num42 = 229;
62825 }
62826 if (num42 == 0 && NPC.downedBoss3 && num9 < 1)
62827 {
62828 num42 = 54;
62829 }
62830 if (num42 == 0 && NPC.savedStylist && num22 < 1)
62831 {
62832 num42 = 353;
62833 }
62834 if (num42 == 0 && num40 >= 4 && flag4 && num16 < 1)
62835 {
62836 num42 = 207;
62837 }
62838 if (num42 == 0 && num40 >= 8 && num19 < 1)
62839 {
62840 num42 = 227;
62841 }
62842 if (num42 == 0 && flag7 && num17 < 1)
62843 {
62844 num42 = 208;
62845 }
62846 if (num42 == 0 && NPC.downedFrost && num13 < 1 && xMas)
62847 {
62848 num42 = 142;
62849 }
62850 if (num42 == 0 && NPC.savedBartender && num25 < 1)
62851 {
62852 num42 = 550;
62853 }
62854 if (num42 == 0 && NPC.savedGolfer && num26 < 1)
62855 {
62856 num42 = 588;
62857 }
62858 if (num42 == 0 && bestiaryProgressReport.CompletionPercent >= 0.1f && num27 < 1)
62859 {
62860 num42 = 633;
62861 }
62862 if (num42 == 0 && flag9 && num39 < 1)
62863 {
62864 num42 = 663;
62865 }
62866 WorldGen.prioritizedTownNPCType = num42;
62867 }
62868 }
62869
62870 public static int DamageVar(float dmg, float luck = 0f)
62871 {
62872 float num = dmg * (1f + (float)rand.Next(-15, 16) * 0.01f);
62873 if (luck > 0f)
62874 {
62875 if (rand.NextFloat() < luck)
62876 {
62877 float num2 = dmg * (1f + (float)rand.Next(-15, 16) * 0.01f);
62878 if (num2 > num)
62879 {
62880 num = num2;
62881 }
62882 }
62883 }
62884 else if (luck < 0f && rand.NextFloat() < 0f - luck)
62885 {
62886 float num3 = dmg * (1f + (float)rand.Next(-15, 16) * 0.01f);
62887 if (num3 < num)
62888 {
62889 num = num3;
62890 }
62891 }
62892 return (int)Math.Round(num);
62893 }
62894
62895 public static double CalculateDamageNPCsTake(int Damage, int Defense)
62896 {
62897 double num = (double)Damage - (double)Defense * 0.5;
62898 if (num < 1.0)
62899 {
62900 num = 1.0;
62901 }
62902 return num;
62903 }
62904
62905 public static double CalculateDamagePlayersTakeInPVP(int Damage, int Defense)
62906 {
62907 double num = (double)Damage - (double)Defense * 0.5;
62908 if (num < 1.0)
62909 {
62910 num = 1.0;
62911 }
62912 return num;
62913 }
62914
62915 public static double CalculateDamagePlayersTake(int Damage, int Defense)
62916 {
62917 double num = (double)Damage - (double)Defense * 0.5;
62918 if (masterMode)
62919 {
62920 num = Damage - Defense;
62921 }
62922 else if (expertMode)
62923 {
62924 num = (double)Damage - (double)Defense * 0.75;
62925 }
62926 if (num < 1.0)
62927 {
62928 num = 1.0;
62929 }
62930 return num;
62931 }
62932
62933 public void OnTileChangeEvent(int x, int y, int count, TileChangeType eventType)
62934 {
62935 WorldGen.PlayLiquidChangeSound(eventType, x, y, count);
62936 }
62937
62939 {
62941 }
62942
62943 public static void SelectPlayer(PlayerFileData data)
62944 {
62945 if (_pendingCharacterSelect != null)
62946 {
62949 }
62950 else if (menuMultiplayer)
62951 {
62952 ServerSideCharacter = false;
62953 data.SetAsActive();
62955 if (autoJoin)
62956 {
62958 {
62959 menuMode = 10;
62961 }
62962 autoJoin = false;
62963 }
62964 else if (menuServer)
62965 {
62966 LoadWorlds();
62967 menuMode = 6;
62968 }
62969 else
62970 {
62971 menuMode = 13;
62972 clrInput();
62973 }
62974 }
62975 else
62976 {
62977 ServerSideCharacter = false;
62978 myPlayer = 0;
62979 data.SetAsActive();
62980 player[myPlayer].position = Vector2.Zero;
62981 LoadWorlds();
62983 menuMode = 6;
62984 }
62985 }
62986
62987 public static void ToggleFullScreen()
62988 {
62989 SetFullScreen(!graphics.IsFullScreen);
62990 }
62991
62996
62997 public static void SetResolution(int width, int height)
62998 {
62999 SetDisplayMode(width, height, graphics.IsFullScreen);
63000 }
63001
63002 public static void SetDisplayMode(int width, int height, bool fullscreen)
63003 {
63004 bool flag = false;
63005 Form form = null;
63006 if (Platform.IsWindows)
63007 {
63008 form = (Form)Control.FromHandle(instance.Window.Handle);
63009 screenMaximized = form.WindowState == FormWindowState.Maximized;
63010 if (screenBorderless && screenMaximized && !graphics.IsFullScreen)
63011 {
63012 screenMaximized = false;
63013 form.WindowState = FormWindowState.Normal;
63014 }
63015 flag = form.FormBorderStyle == FormBorderStyle.None;
63016 }
63017 else
63018 {
63019 screenMaximized = false;
63020 }
63021 bool flag2 = false;
63022 int num3;
63023 int num4;
63024 if (screenBorderless || screenMaximized || graphics.IsFullScreen || fullscreen)
63025 {
63026 bool flag3 = false;
63028 {
63029 flag3 = true;
63030 if (!fullscreen && !graphics.IsFullScreen)
63031 {
63032 width = 1280;
63033 height = 800;
63035 }
63036 }
63037 if (Platform.IsWindows)
63038 {
63039 form.MinimumSize = new Size(0, 0);
63040 if (!fullscreen && !flag3)
63041 {
63042 SetDisplayModeAsBorderless(ref width, ref height, form);
63043 }
63044 }
63045 if (width > maxScreenW)
63046 {
63047 float num = (float)height / (float)width;
63048 width = maxScreenW;
63049 height = (int)(num * (float)width);
63050 }
63051 if (height > maxScreenH)
63052 {
63053 float num2 = (float)width / (float)height;
63054 height = maxScreenH;
63055 width = (int)(num2 * (float)height);
63056 }
63057 PlayerInput.RawMouseScale = new Vector2((float)width / (float)instance.Window.ClientBounds.Width, (float)height / (float)instance.Window.ClientBounds.Height);
63058 if (!graphics.IsFullScreen)
63059 {
63060 num3 = Math.Max(graphics.PreferredBackBufferWidth, graphics.GraphicsDevice.Viewport.Width);
63061 num4 = Math.Max(graphics.PreferredBackBufferHeight, graphics.GraphicsDevice.Viewport.Height);
63062 if (num3 != graphics.PreferredBackBufferWidth || num4 != graphics.PreferredBackBufferHeight)
63063 {
63064 flag2 = true;
63065 }
63066 }
63067 else
63068 {
63069 num3 = graphics.PreferredBackBufferWidth;
63070 num4 = graphics.PreferredBackBufferHeight;
63071 }
63072 }
63073 else
63074 {
63075 PlayerInput.RawMouseScale = Vector2.One;
63076 if (Platform.IsWindows)
63077 {
63078 form.MinimumSize = new Size(minScreenW, minScreenH);
63079 if (flag)
63080 {
63081 width = displayWidth[0];
63082 height = displayHeight[0];
63083 }
63084 }
63085 width = Math.Min(width, maxScreenW);
63086 height = Math.Min(height, maxScreenH);
63087 num3 = graphics.GraphicsDevice.Viewport.Width;
63088 num4 = graphics.GraphicsDevice.Viewport.Height;
63089 flag2 = graphics.PreferredBackBufferWidth != graphics.GraphicsDevice.Viewport.Width || graphics.PreferredBackBufferHeight != graphics.GraphicsDevice.Viewport.Height;
63090 }
63091 if (Platform.IsWindows && !fullscreen && !flag2)
63092 {
63093 if (form.ClientSize.Width < graphics.PreferredBackBufferWidth)
63094 {
63095 width = form.ClientSize.Width;
63096 flag2 = true;
63097 }
63098 if (form.ClientSize.Height < graphics.PreferredBackBufferHeight)
63099 {
63100 height = form.ClientSize.Height;
63101 flag2 = true;
63102 }
63103 }
63104 width &= 0x7FFFFFFE;
63105 height &= 0x7FFFFFFE;
63106 width = Math.Max(width, minScreenW);
63107 height = Math.Max(height, minScreenH);
63108 if (graphics.IsFullScreen != fullscreen)
63109 {
63110 graphics.PreferredBackBufferWidth = width;
63111 graphics.PreferredBackBufferHeight = height;
63112 graphics.ApplyChanges();
63113 graphics.ToggleFullScreen();
63114 }
63115 if (width != num3 || height != num4 || flag2)
63116 {
63117 mapTime = 0;
63118 if (gamePaused)
63119 {
63120 renderNow = true;
63121 }
63122 screenWidth = width;
63123 screenHeight = height;
63124 graphics.PreferredBackBufferWidth = screenWidth;
63125 graphics.PreferredBackBufferHeight = screenHeight;
63126 graphics.ApplyChanges();
63128 FixUIScale();
63129 if (Main.OnResolutionChanged != null)
63130 {
63132 }
63137 {
63138 if (screenBorderless)
63139 {
63141 form.FormBorderStyle = FormBorderStyle.None;
63142 }
63143 else
63144 {
63145 form.FormBorderStyle = FormBorderStyle.Sizable;
63146 }
63147 form.SendToBack();
63148 form.BringToFront();
63149 }
63152 {
63154 instance.InitTargets();
63156 }
63157 UserInterface.ActiveInstance.Recalculate();
63158 instance._needsMenuUIRecalculation = true;
63159 Console.WriteLine(Language.GetTextValue("Misc.ResolutionChanged", width, height));
63160 chatMonitor.OnResolutionChange();
63161 }
63162 if (!graphics.SynchronizeWithVerticalRetrace)
63163 {
63164 graphics.SynchronizeWithVerticalRetrace = true;
63165 graphics.ApplyChanges();
63166 }
63167 }
63168
63169 public static void FixUIScale()
63170 {
63172 }
63173
63174 public void FullscreenStartup()
63175 {
63176 startFullscreen = false;
63177 int currentValue = graphics.PreferredBackBufferWidth;
63178 int currentValue2 = graphics.PreferredBackBufferHeight;
63179 Configuration.Get("DisplayWidth", ref currentValue);
63180 Configuration.Get("DisplayHeight", ref currentValue2);
63181 SetDisplayMode(currentValue, currentValue2, fullscreen: true);
63182 }
63183
63185 {
63186 if (startFullscreen)
63187 {
63189 }
63190 SetResolution(base.GraphicsDevice.Viewport.Width, base.GraphicsDevice.Viewport.Height);
63191 }
63192
63194 {
63195 if ((gameMenu && (menuMode == 10 || menuMode == 14)) || WorldGen.gen)
63196 {
63197 return;
63198 }
63199 if (!gameMenu)
63200 {
63202 {
63203 menuMode = 888;
63205 LoadPlayers();
63206 MenuUI.SetState(_characterSelectMenu);
63209 });
63210 }
63211 else
63212 {
63213 menuMode = 888;
63215 LoadPlayers();
63216 MenuUI.SetState(_characterSelectMenu);
63219 }
63220 }
63221
63222 public static void SwitchNetMode(int mode)
63223 {
63224 if (mode >= 0 && mode <= 2)
63225 {
63226 _targetNetMode = mode;
63228 }
63229 }
63230
63231 public static void WeGameRequireExitGame()
63232 {
63233 GameAskedToQuit = true;
63234 }
63235}
static readonly BlendState AlphaBlend
Definition BlendState.cs:36
static readonly BlendState Additive
Definition BlendState.cs:38
static ReadOnlyCollection< GraphicsAdapter > Adapters
static readonly RasterizerState CullCounterClockwise
static readonly RasterizerState CullClockwise
override void Dispose([MarshalAs(UnmanagedType.U1)] bool P_0)
static readonly SamplerState PointWrap
static readonly SamplerState AnisotropicClamp
static readonly SamplerState PointClamp
static readonly SamplerState LinearClamp
static float Lerp(float value1, float value2, float amount)
Definition MathHelper.cs:53
static float WrapAngle(float angle)
Definition MathHelper.cs:87
static float Distance(float value1, float value2)
Definition MathHelper.cs:31
static float Max(float value1, float value2)
Definition MathHelper.cs:41
static float SmoothStep(float value1, float value2, float amount)
Definition MathHelper.cs:63
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
static float Min(float value1, float value2)
Definition MathHelper.cs:36
static void DrawString(this SpriteBatch spriteBatch, DynamicSpriteFont spriteFont, string text, Vector2 position, Color color)
static bool IsOSX
Definition Platform.cs:21
static bool IsWindows
Definition Platform.cs:19
static bool IsLinux
Definition Platform.cs:23
static readonly Platform Current
Definition Platform.cs:11
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
void AddRange(IEnumerable< T > collection)
Definition List.cs:275
static void Write(string format, object? arg0)
Definition Console.cs:850
static void WriteLine()
Definition Console.cs:733
static ConsoleKeyInfo ReadKey()
Definition Console.cs:514
static void Clear()
Definition Console.cs:602
static ? string ReadLine()
Definition Console.cs:727
static ? string ToString(object? value)
Definition Convert.cs:2321
static int ToInt32(object? value)
Definition Convert.cs:1320
static Process GetCurrentProcess()
Definition Process.cs:1107
static Stopwatch StartNew()
Definition Stopwatch.cs:41
static bool TryParse(Type enumType, string? value, out object? result)
Definition Enum.cs:416
static ? string GetName(Type enumType, object value)
Definition Enum.cs:281
static void Delete(string path)
Definition Directory.cs:355
static string[] GetFiles(string path)
Definition Directory.cs:136
static bool Exists([NotNullWhen(true)] string? path)
Definition Directory.cs:43
static void SetAttributes(string path, FileAttributes fileAttributes)
Definition File.cs:230
static bool Exists([NotNullWhen(true)] string? path)
Definition File.cs:97
static void Delete(string path)
Definition File.cs:88
static string Combine(string path1, string path2)
Definition Path.cs:304
static char[] GetInvalidFileNameChars()
Definition Path.cs:858
static readonly char DirectorySeparatorChar
Definition Path.cs:71
static double Acos(double d)
static double Cos(double d)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static double Atan2(double y, double x)
static double Sqrt(double d)
static double Pow(double x, double y)
static decimal Round(decimal d)
Definition Math.cs:1096
static double Ceiling(double a)
static double IEEERemainder(double x, double y)
Definition Math.cs:679
static double Abs(double value)
static double Sin(double a)
const double PI
Definition Math.cs:16
static double Floor(double d)
static int Sign(decimal value)
Definition Math.cs:1202
static byte Max(byte val1, byte val2)
Definition Math.cs:738
static ? Assembly GetAssembly(Type type)
Definition Assembly.cs:472
static Encoding ASCII
Definition Encoding.cs:511
static string Replace(string input, string pattern, string replacement)
Definition Regex.cs:514
static void Sleep(int millisecondsTimeout)
Definition Thread.cs:658
static string EscapeDataString(string stringToEscape)
Definition Uri.cs:4087
static string UnescapeDataString(string stringToUnescape)
Definition Uri.cs:4058
static void Initialize()
Definition Animation.cs:32
static void UpdateAll()
Definition Animation.cs:129
static void PlaySound(int type, Vector2 position, int style=1)
static void StopAmbientSounds()
static void SendChatMessageFromClient(ChatMessage message)
Definition ChatHelper.cs:69
static void ShowCachedMessages()
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:46
static void ClearDelayedMessagesCache()
static void UpdateChestFrames()
Definition Chest.cs:3540
void SetupShop(int type)
Definition Chest.cs:1400
static int FindChestByGuessing(int X, int Y)
Definition Chest.cs:558
static void Initialize()
Definition Chest.cs:79
static void SetupTravelShop()
Definition Chest.cs:1303
static int FindChest(int X, int Y)
Definition Chest.cs:546
static void resetClouds()
Definition Cloud.cs:36
static void UpdateClouds()
Definition Cloud.cs:246
static bool CanHit(Entity source, Entity target)
Definition Collision.cs:344
static bool InTileBounds(int x, int y, int lx, int ly, int hx, int hy)
static void ExpandVertically(int startX, int startY, out int topY, out int bottomY, int maxExpandUp=100, int maxExpandDown=100)
static bool CheckAABBvAABBCollision(Vector2 position1, Vector2 dimensions1, Vector2 position2, Vector2 dimensions2)
Definition Collision.cs:157
static void UpdateCombatText()
static float TargetScale
Definition CombatText.cs:52
bool TryTracking(out Vector2 cameraPosition)
static readonly GameModeData NormalMode
ReturnFromRejectionMenuAction ExitAction
static void LightningLaserDraw(int stage, Vector2 currentPosition, float distanceLeft, Rectangle lastFrame, out float distCovered, out Rectangle frame, out Vector2 origin, out Color color)
static void RainbowLaserDraw(int stage, Vector2 currentPosition, float distanceLeft, Rectangle lastFrame, out float distCovered, out Rectangle frame, out Vector2 origin, out Color color)
static void TurretLaserDraw(int stage, Vector2 currentPosition, float distanceLeft, Rectangle lastFrame, out float distCovered, out Rectangle frame, out Vector2 origin, out Color color)
static Dust CloneDust(int dustIndex)
Definition Dust.cs:233
static int dustWater()
Definition Dust.cs:340
static void UpdateDust()
Definition Dust.cs:358
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
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
static int lavaBubbles
Definition Dust.cs:14
Vector2 position
Definition Entity.cs:14
static void Initialize()
Definition Framing.cs:49
static Tile GetTileSafely(Vector2 position)
Definition Framing.cs:419
static void HandleSpecialEvent(Player player, int eventID)
void ForceEntitySpawn(AmbienceSpawnInfo info)
void UseResourcePacks(ResourcePackList resourcePacks)
static void ModifyNightColor(ref Color bgColorToSet, ref Color moonColor)
static void FixBiomeDarkness(ref Color bgColor, ref int R, ref int G, ref int B)
static void ModifyMinimumLightColorAtNight(ref byte minimalLight)
static DoorAutoOpeningPreference PreferenceSettings
void Draw(bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride=-1)
void PostDrawTiles(bool solidLayer, bool forRenderTargets, bool intoRenderTargets)
void DrawLiquidBehindTiles(int waterStyleOverride=-1)
void PreDrawTiles(bool solidLayer, bool forRenderTargets, bool intoRenderTargets)
static void SyncInvasionProgress(int toWho)
Definition DD2Event.cs:161
static void DrawExplosions(SpriteBatch spriteBatch)
static void DrawPieces(SpriteBatch spriteBatch)
static void DrawWhite(SpriteBatch spriteBatch)
static void DrawBack(SpriteBatch spriteBatch)
static void DrawFront(SpriteBatch spriteBatch)
static void Draw(SpriteBatch spriteBatch)
static Asset< DynamicSpriteFont > ItemStack
Definition FontAssets.cs:8
static Asset< DynamicSpriteFont > DeathText
Definition FontAssets.cs:12
static Asset< DynamicSpriteFont >[] CombatText
Definition FontAssets.cs:14
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
static bool ValidateShot(Entity golfBall, Player player, ref Vector2 shotVector)
static ShotStrength CalculateShotStrength(Vector2 shotVector, ClubProperties clubProperties)
static Projectile FindGolfBallForHelper(Projectile golfHelper)
static void DrawPredictionLine(Entity golfBall, Vector2 impactVelocity, float chargeProgress, float roughLandResistance)
static bool IsGolfBallResting(Projectile golfBall)
static bool IsGolfShotValid(Entity golfBall, Player player)
static bool IsPlayerHoldingClub(Player player)
static Vector4 GetShimmerBaseColor(float worldPositionX, float worldPositionY)
static Color GetShimmerGlitterColor(bool top, float worldPositionX, float worldPositionY)
static NetPacket Serialize(Vector2 position)
static Color GetPortalColor(int colorIndex)
static void SpawnInWorldDust(int tileStyle, Rectangle dustBox)
static PlayerTitaniumStormBuffTextureContent PlayerTitaniumStormBuff
static Asset< Texture2D >[] Liquid
static Asset< Texture2D >[] Reforge
static Asset< Texture2D > AntLion
static Asset< Texture2D >[] CraftToggle
static Asset< Texture2D > ColorHighlight
static Asset< Texture2D >[] InfoIcon
static Asset< Texture2D >[] AccWaist
static Asset< Texture2D > Map
static Asset< Texture2D > Chain9
static Asset< Texture2D > Chat2
static Asset< Texture2D > Chain28
static Asset< Texture2D > Wof
static Asset< Texture2D >[] PlayerHair
static Asset< Texture2D > Chain27
static Asset< Texture2D > FlameRing
static Asset< Texture2D > Logo3
static Asset< Texture2D >[] AccHandsOffComposite
static Asset< Texture2D > Chain29
static Asset< Texture2D >[] ArmorHead
static Asset< Texture2D > Chain5
static Asset< Texture2D > Chain35
static Asset< Texture2D > Chain2
static Asset< Texture2D > ReaperEye
static Asset< Texture2D >[] Npc
static Asset< Texture2D > SplashTexture16x9
static Asset< Texture2D > Fade
static Asset< Texture2D > Ninja
static Asset< Texture2D > Chain6
static Asset< Texture2D > Chain4
static Asset< Texture2D > InventoryBack8
static Asset< Texture2D >[] AccHandsOnComposite
static Asset< Texture2D > Chain40
static Asset< Texture2D >[] AccShoes
static Asset< Texture2D > Chain15
static Asset< Texture2D > SpikeBase
static Asset< Texture2D > InventoryBack
static Asset< Texture2D >[] FemaleBody
static Asset< Texture2D >[] AccShield
static Asset< Texture2D >[] ArmorBodyComposite
static Asset< Texture2D > Sun3
static Asset< Texture2D > DukeFishron
static Asset< Texture2D >[] Projectile
static Asset< Texture2D > TreeFace
static Asset< Texture2D > Hue
static Asset< Texture2D > MiniMinotaur
static Asset< Texture2D > Chain7
static Asset< Texture2D >[] AccBalloon
static Asset< Texture2D > ScrollRightButton
static Asset< Texture2D > HairStyleBack
static Asset< Texture2D >[] GlowMask
static Asset< Texture2D > Chain24
static Asset< Texture2D > OneDropLogo
static Asset< Texture2D > IceQueen
static Asset< Texture2D > WireNew
static Asset< Texture2D >[] Wings
static Asset< Texture2D > Firefly
static Asset< Texture2D > Chain10
static Asset< Texture2D > Chain31
static Asset< Texture2D > ClothesStyleBack
static Asset< Texture2D > PumpkingFace
static Asset< Texture2D > ColorSlider
static Asset< Texture2D >[] Tile
static Asset< Texture2D > InventoryTickOff
static Asset< Texture2D >[] Gore
static Asset< Texture2D > Hb2
static Asset< Texture2D > Chain11
static Asset< Texture2D > FishingLine
static Asset< Texture2D > GolfSwingBarPanel
static Asset< Texture2D >[] Star
static Asset< Texture2D > BoneArm2
static Asset< Texture2D > CursorRadial
static Asset< Texture2D > SplashTextureLegoFront
static Asset< Texture2D >[] Pvp
static Asset< Texture2D >[] NpcHeadBoss
static Asset< Texture2D > InventoryBack14
static Asset< Texture2D > BoneEyes
static Asset< Texture2D >[] InventorySort
static Asset< Texture2D >[] AccFront
static Asset< Texture2D > Chain30
static Asset< Texture2D > InventoryBack11
static Asset< Texture2D > EmoteMenuButton
static Asset< Texture2D > Actuator
static Asset< Texture2D > SmileyMoon
static Asset< Texture2D >[] blockReplaceIcon
static Asset< Texture2D > BuilderAcc
static Asset< Texture2D > CraftUpButton
static Asset< Texture2D > Chain17
static Asset< Texture2D > Chain19
static Asset< Texture2D >[] Underworld
static Asset< Texture2D >[] MapIcon
static Asset< Texture2D > EyeLaserSmall
static Asset< Texture2D >[] Item
static Asset< Texture2D >[] ArmorLeg
static Asset< Texture2D > GolfSwingBarFill
static Asset< Texture2D > Chain16
static Asset< Texture2D > Rain
static Asset< Texture2D > Chain20
static Asset< Texture2D >[] Extra
static Asset< Texture2D >[] PlayerHairAlt
static Asset< Texture2D > LightDisc
static Asset< Texture2D >[] NpcHead
static Asset< Texture2D >[] Flames
static Asset< Texture2D >[] Background
static Asset< Texture2D > GolfBallArrowShadow
static Asset< Texture2D > SplashTextureLegoTree
static Asset< Texture2D >[] Chains
static Asset< Texture2D >[] ChestStack
static Asset< Texture2D > Sun
static Asset< Texture2D > Sun2
static Asset< Texture2D >[,] Players
static Asset< Texture2D > Chain12
static Asset< Texture2D >[] ArmorArm
static Asset< Texture2D >[] ItemFlame
static Asset< Texture2D > ColorBlip
static Asset< Texture2D > PumpkinMoon
static Asset< Texture2D > Chain26
static Asset< Texture2D > TextBack
static Asset< Texture2D > GolfBallOutline
static Asset< Texture2D > Chain38
static Asset< Texture2D > Chain39
static Asset< Texture2D >[] HbLock
static Asset< Texture2D > Confuse
static Asset< Texture2D >[] AccHandsOff
static Asset< Texture2D > Wire
static Asset< Texture2D > Dust
static Asset< Texture2D > Logo
static Asset< Texture2D >[] AccBeard
static Asset< Texture2D > BoneArm
static Asset< Texture2D >[] AccHandsOn
static Asset< Texture2D > Chain3
static Asset< Texture2D >[] Cloud
static Asset< Texture2D > Chain13
static Asset< Texture2D > SantaTank
static Asset< Texture2D > EyeLaser
static Asset< Texture2D > MapDeath
static Asset< Texture2D >[] MapBGs
static Asset< Texture2D >[] AccFace
static Asset< Texture2D >[] Buff
static Asset< Texture2D > Chain23
static Asset< Texture2D > WraithEye
static Asset< Texture2D > Chaos
static Asset< Texture2D > BestiaryMenuButton
static Asset< Texture2D > Lightningbug
static Asset< Texture2D > Chain33
static Asset< Texture2D > Chain25
static Asset< Texture2D > Chain8
static Asset< Texture2D > HouseBanner
static Asset< Texture2D > BlackTile
static Asset< Texture2D >[] Cursors
static Asset< Texture2D >[] AccBack
static Asset< Texture2D > Chain
static Asset< Texture2D > SnowMoon
static Asset< Texture2D > Bubble
static Asset< Texture2D > Chain14
static Asset< Texture2D > PumpkingArm
static Asset< Texture2D > Logo2
static Asset< Texture2D > ScrollLeftButton
static Asset< Texture2D >[] Wall
static Asset< Texture2D >[] Golem
static Asset< Texture2D >[] WireUi
static Asset< Texture2D >[] GemChain
static Asset< Texture2D > InventoryTickOn
static Asset< Texture2D >[] Moon
static Asset< Texture2D >[] Clothes
static Asset< Texture2D > Chain36
static Asset< Texture2D >[] EquipPage
static Asset< Texture2D > BoneLaser
static Asset< Texture2D > Chain42
static Asset< Texture2D > PumpkingCloak
static Asset< Texture2D > Chain22
static Asset< Texture2D >[] Dest
static Asset< Texture2D > SplashTextureLegoBack
static Asset< Texture2D > CraftDownButton
static Asset< Texture2D > MagicPixel
static Asset< Texture2D > Chain21
static Asset< Texture2D >[] Coin
static Asset< Texture2D > GolfBallArrow
static Asset< Texture2D > Probe
static Asset< Texture2D > Chain32
static Asset< Texture2D > LoadingSunflower
static Asset< Texture2D > ChatBack
static Asset< Texture2D > Chain43
static Asset< Texture2D > Chain41
static Asset< Texture2D >[] ArmorBody
static Asset< Texture2D > TileCrack
static Asset< Texture2D > ColorBar
static Asset< Texture2D > Chain37
static Asset< Texture2D > Logo4
static Asset< Texture2D > Hb1
static Asset< Texture2D > Flame
static Asset< Texture2D > Chain18
static Asset< Texture2D > Chat
static Asset< Texture2D >[] AccNeck
static Asset< Texture2D > Chain34
static void GetPriceText(int currencyIndex, string[] lines, ref int currentLine, long price)
static void DrawAll(SpriteBatch sb)
static void ProcessSpecialWorldSeeds(string processedSeed)
static void HandleWiresUI(SpriteBatch spriteBatch)
Definition WiresUI.cs:680
static void Draw(SpriteBatch spriteBatch)
static TriggersPack Triggers
static void CacheOriginalScreenDimensions()
static List< Keys > GetPressedKeys()
static InputMode CurrentInputMode
static Vector2 GamepadThumbstickLeft
static void CacheMousePositionForZoom()
static SmartSelectGamepadPointer smartSelectPointer
static PlayerInputProfile CurrentProfile
static void ResetInputsOnActiveStateChange()
static void SetDesiredZoomContext(ZoomContext context)
static Vector2 GamepadThumbstickRight
static string ComposeInstructionsForGamepad()
Vector2 UnscaledPosition
Definition Camera.cs:8
static FilterManager Scene
Definition Filters.cs:5
static OverlayManager Scene
Definition Overlays.cs:5
static Dictionary< string, MiscShaderData > Misc
static ArmorShaderDataSet Armor
Definition GameShaders.cs:7
static int Bullet
Definition AmmoID.cs:114
static int Sand
Definition AmmoID.cs:116
static int CandyCorn
Definition AmmoID.cs:130
static int Flare
Definition AmmoID.cs:124
static int Dart
Definition AmmoID.cs:118
static int FallenStar
Definition AmmoID.cs:112
static int Gel
Definition AmmoID.cs:106
static int Arrow
Definition AmmoID.cs:108
static int Rocket
Definition AmmoID.cs:120
static int Snowball
Definition AmmoID.cs:126
static int Coin
Definition AmmoID.cs:110
static int JackOLantern
Definition AmmoID.cs:132
static int StyngerBolt
Definition AmmoID.cs:128
static int Stake
Definition AmmoID.cs:134
static int NailFriendly
Definition AmmoID.cs:136
static bool[] UsesNewFramingCode
Definition ArmorIDs.cs:641
static bool[] UsesOldFramingTexturesForWalking
Definition ArmorIDs.cs:1481
static bool[] IsWellFed
Definition BuffID.cs:18
static BuffMountData[] BasicMountData
Definition BuffID.cs:32
static bool[] NurseCannotRemoveDebuff
Definition BuffID.cs:30
static readonly int Count
Definition BuffID.cs:1069
static Color GetSelectionGlowColor(bool isTileSelected, int averageTileLighting)
Definition Colors.cs:127
static Color AlphaDarken(Color input)
Definition Colors.cs:122
static readonly Color CoinGold
Definition Colors.cs:33
static readonly Color CoinPlatinum
Definition Colors.cs:31
static readonly Color CoinSilver
Definition Colors.cs:35
static readonly Color CoinCopper
Definition Colors.cs:37
static readonly Color JourneyMode
Definition Colors.cs:41
static void RebuildItemCreativeSortingIDsAfterRecipesAreSetUp()
static void FixItemsAfterRecipesAreAdded()
static void RebuildBestiarySortingIDsByBestiaryDatabaseContents(BestiaryDatabase database)
static bool[] UsesCursedByPlanteraTooltip
Definition ItemID.cs:128
static float[] ToolTipDamageMultiplier
Definition ItemID.cs:221
static bool[] AnimatesAsSoul
Definition ItemID.cs:1060
static bool[] BossBag
Definition ItemID.cs:1123
static bool[] NebulaPickup
Definition ItemID.cs:1058
static bool[] ExoticPlantsForDyeTrade
Definition ItemID.cs:1056
static bool[] IsFood
Definition ItemID.cs:233
static bool[] TrapSigned
Definition ItemID.cs:1040
static bool[] DrawUnsafeIndicator
Definition ItemID.cs:59
static readonly short Count
Definition ItemID.cs:12138
static bool[] CannotBeDrawnInHousingUI
Definition NPCHeadID.cs:9
static readonly int Count
Definition NPCHeadID.cs:174
static bool[] BelongsToInvasionOldOnesArmy
Definition NPCID.cs:4166
static int[][] TownNPCsFramingGroups
Definition NPCID.cs:4256
static bool[] IsTownPet
Definition NPCID.cs:4099
static List< int > GoldCrittersCollection
Definition NPCID.cs:4105
static bool[] MustAlwaysDraw
Definition NPCID.cs:4248
static int[] AttackTime
Definition NPCID.cs:4224
static bool[] IsTownSlime
Definition NPCID.cs:4101
static int[] AttackType
Definition NPCID.cs:4228
static int[] HatOffsetY
Definition NPCID.cs:4206
static bool[] DangerThatPreventsOtherDangers
Definition NPCID.cs:4246
static int[] NPCFramingGroup
Definition NPCID.cs:4252
static readonly short Count
Definition NPCID.cs:11744
static readonly int Loadout1_Armor_0
static readonly int Loadout3_Dye_0
static readonly int Loadout2_Dye_0
static readonly int Loadout1_Dye_0
static readonly int Loadout3_Armor_0
static readonly int Loadout2_Armor_0
static readonly int TrashItem
static readonly int Inventory0
static readonly int Count
static readonly short Count
static readonly LegacySoundStyle Item130
Definition SoundID.cs:674
static readonly LegacySoundStyle ChesterClose
Definition SoundID.cs:974
static readonly LegacySoundStyle Item37
Definition SoundID.cs:488
static readonly LegacySoundStyle ChesterOpen
Definition SoundID.cs:972
static readonly LegacySoundStyle Item4
Definition SoundID.cs:422
static readonly LegacySoundStyle Item6
Definition SoundID.cs:426
static void FillAccessMap()
Definition SoundID.cs:1043
static readonly LegacySoundStyle Item8
Definition SoundID.cs:430
static readonly LegacySoundStyle Item59
Definition SoundID.cs:532
static bool[] CrimsonBiomeSight
Definition TileID.cs:247
static bool[] HallowBiomeSight
Definition TileID.cs:239
static bool[] DrawsWalls
Definition TileID.cs:171
static bool[] CorruptBiomeSight
Definition TileID.cs:233
static bool[] BlockMergesWithMergeAllBlock
Definition TileID.cs:291
static bool[] BasicChest
Definition TileID.cs:223
static bool[] BasicChestFake
Definition TileID.cs:225
static readonly ushort Count
Definition TileID.cs:1698
static void Initialize()
Definition TorchID.cs:134
static int[] BlendType
Definition WallID.cs:56
static bool[] Transparent
Definition WallID.cs:40
static readonly ushort Count
Definition WallID.cs:753
static PlayerFileData CreateAndSave(Player player)
bool Contains(string name)
List< string > GetAllKeys()
void Put(string name, object value)
static WorldFileData FromInvalidWorld(string path, bool cloudSave)
static WorldFileData CreateMetadata(string name, bool cloudSave, int GameMode)
Definition WorldFile.cs:523
static void SaveWorld()
Definition WorldFile.cs:780
static WorldFileData GetAllMetadata(string file, bool cloudSave)
Definition WorldFile.cs:243
static Exception LastThrownLoadException
Definition WorldFile.cs:183
static void Draw(Main mainInstance, SpriteBatch sb)
static float DrawValueBar(SpriteBatch sb, float scale, float perc, int lockState=0, Utils.ColorLerpMethod colorMethod=null)
static Vector2 valuePosition
static void CreateAssetServices(GameServiceContainer services)
static ResourcePackList CreateResourcePackList(IServiceProvider services)
static void LoadSplashAssets(bool asyncLoadForSounds)
static void BindTo(Preferences preferences)
static bool IsAGolfingItem(Item item)
Definition Item.cs:46650
int stack
Definition Item.cs:149
static bool[] staff
Definition Item.cs:75
bool IsAir
Definition Item.cs:377
static bool[] claw
Definition Item.cs:77
static int[] legType
Definition Item.cs:73
static int[] headType
Definition Item.cs:69
static int[] bodyType
Definition Item.cs:71
static Rectangle GetDrawHitbox(int type, Player user)
Definition Item.cs:49662
static int NewItem(IEntitySource source, Vector2 pos, Vector2 randomBox, int Type, int Stack=1, bool noBroadcast=false, int prefixGiven=0, bool noGrabDelay=false, bool reverseLookup=false)
Definition Item.cs:49697
static int BannerToNPC(int i)
Definition Item.cs:2040
static object CreateDialogSubstitutionObject(NPC npc=null)
Definition Lang.cs:74
static string GetNPCHouseBannerText(NPC npc, int bannerStyle)
Definition Lang.cs:379
static LocalizedText[] inter
Definition Lang.cs:28
static LocalizedText[] gen
Definition Lang.cs:22
static LocalizedText[] dresserType
Definition Lang.cs:40
static string GetNPCNameValue(int netID)
Definition Lang.cs:143
static LocalizedText[] menu
Definition Lang.cs:19
static string GetMapObjectName(int id)
Definition Lang.cs:65
static string dialog(int l, bool english=false)
Definition Lang.cs:138
static LocalizedText[] chestType2
Definition Lang.cs:43
static string DyeTraderQuestChat(bool gotDye=false)
Definition Lang.cs:250
static LocalizedText[] chestType
Definition Lang.cs:37
static LocalizedText[] misc
Definition Lang.cs:25
static string GetBuffName(int id)
Definition Lang.cs:190
static string GetItemNameValue(int id)
Definition Lang.cs:185
static string AnglerQuestChat(bool turnIn=false)
Definition Lang.cs:398
static string GetRandomGameTitle()
Definition Lang.cs:245
static string LocalizedDuration(TimeSpan time, bool abbreviated, bool showAllAvailableUnits)
Definition Lang.cs:1136
static string BartenderHelpText(NPC npc)
Definition Lang.cs:263
static string GetDryadWorldStatusDialog(out bool worldIsEntirelyPure)
Definition Lang.cs:200
static string GetBuffDescription(int id)
Definition Lang.cs:195
static LocalizedText[] tip
Definition Lang.cs:31
static string SupportGlyphs(string tooltip)
Definition Lang.cs:522
static NetworkText GetInvasionWaveText(int wave, params short[] npcIds)
Definition Lang.cs:1112
static void GetCornerColors(int centerX, int centerY, out VertexColors vertices, float scale=1f)
Definition Lighting.cs:295
static Color GetColor(Point tileCoords)
Definition Lighting.cs:182
static void Initialize()
Definition Lighting.cs:89
static void NextLightMode()
Definition Lighting.cs:167
static void GetColor9Slice(int centerX, int centerY, ref Color[] slices)
Definition Lighting.cs:250
static bool UsingNewLighting
Definition Lighting.cs:75
static bool NotRetro
Definition Lighting.cs:64
static void Clear()
Definition Lighting.cs:177
static void GetColor4Slice(int centerX, int centerY, ref Color[] slices)
Definition Lighting.cs:382
static LightMode Mode
Definition Lighting.cs:30
static void LightTiles(int firstX, int lastX, int firstY, int lastY)
Definition Lighting.cs:100
static bool UpdateEveryFrame
Definition Lighting.cs:78
static float Brightness(int x, int y)
Definition Lighting.cs:116
static float GlobalBrightness
Definition Lighting.cs:27
static int OffScreenTiles
Definition Lighting.cs:17
static void AddLight(Vector2 position, Vector3 rgb)
Definition Lighting.cs:137
static int numLiquidBuffer
static int maxLiquid
Definition Liquid.cs:15
static void StartPanic()
Definition Liquid.cs:966
static bool panicMode
Definition Liquid.cs:39
static bool quickSettle
Definition Liquid.cs:33
static GameCulture FromCultureName(CultureName name)
static GameCulture ActiveCulture
Definition Language.cs:8
static LocalizedText GetText(string key)
Definition Language.cs:10
static bool Exists(string key)
Definition Language.cs:45
static string GetTextValue(string key)
Definition Language.cs:15
static string GetTextValueWith(string key, object obj)
Definition Language.cs:40
static readonly LocalizedText Empty
static NetworkText FromLiteral(string text)
static NetworkText FromKey(string key, params object[] substitutions)
static Matrix CurrentBackgroundMatrixForCreditsRoll
Definition Main.cs:86
static bool HadAnActiveInteractibleProjectile
Definition Main.cs:95
static int SleepingPlayersCount
Definition Main.cs:91
static int ActivePlayersCount
Definition Main.cs:89
static bool AnyActiveBossNPC
Definition Main.cs:93
static uint SetThreadExecutionState(uint esFlags)
const uint ES_CONTINUOUS
Definition Main.cs:107
const uint ES_SYSTEM_REQUIRED
Definition Main.cs:109
void PrepareCache(string text)
Definition Main.cs:152
void DrawItem_GetBasics(Item item, int slot, out Texture2D texture, out Microsoft.Xna.Framework.Rectangle frame, out Microsoft.Xna.Framework.Rectangle glowmaskFrame)
Definition Main.cs:35184
int grabColorSlider
Definition Main.cs:2519
static Microsoft.Xna.Framework.Color ColorOfTheSkies
Definition Main.cs:2577
static bool HasSmartInteractTarget
Definition Main.cs:2858
static bool drawBackGore
Definition Main.cs:387
static string versionNumber
Definition Main.cs:303
static int AnnouncementBoxRange
Definition Main.cs:309
static string CloudWorldPath
Definition Main.cs:1950
static string GetWorldPathFromName(string worldName, bool cloudSave)
Definition Main.cs:4488
static bool IsItAHappyWindyDay
Definition Main.cs:2869
static int keyCount
Definition Main.cs:708
static int[] blueBirdCageFrameCounter
Definition Main.cs:1551
static Vector2 DrawWhip_WhipScythe(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33652
static int rainTime
Definition Main.cs:1308
AchievementManager _achievements
Definition Main.cs:375
static int invasionProgressIcon
Definition Main.cs:1986
static void AnglerQuestSwap()
Definition Main.cs:3518
IEnumerator LoadContent_Deferred()
Definition Main.cs:9980
void DrawSurfaceBG_BackMountainsStep1(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack)
Definition Main.cs:56755
static float temporaryGUIScaleSlider
Definition Main.cs:1902
void DrawWindowsIMEPanel(Vector2 position, float xAnchor=0f)
Definition Main.cs:37575
static CreativeUnlocksTracker LocalPlayerCreativeTracker
Definition Main.cs:2831
static bool showFrameRate
Definition Main.cs:1094
static Cloud[] cloud
Definition Main.cs:1374
bool quickSplash
Definition Main.cs:2537
static int cameraLerpTimeToggle
Definition Main.cs:459
static void DrawWOFRopeToTheHungry(int i)
Definition Main.cs:35093
static int musicBox2
Definition Main.cs:572
static Microsoft.Xna.Framework.Rectangle ReverseGravitySupport(Microsoft.Xna.Framework.Rectangle box)
Definition Main.cs:3025
void DrawProj_StardustGuardianPunching(Projectile proj)
Definition Main.cs:32951
byte instrumentMouseFixHack
Definition Main.cs:2483
static SceneMetrics SceneMetrics
Definition Main.cs:1344
static string PasteTextIn(bool allowMultiLine, string newKeys)
Definition Main.cs:18708
static readonly int maxMusic
Definition Main.cs:447
static bool render
Definition Main.cs:760
static int WaveQuality
Definition Main.cs:425
static int[,] butterflyCageFrameCounter
Definition Main.cs:1561
void EnsureRenderTargetContent()
Definition Main.cs:55115
static int TryInteractingWithVoidLens(Projectile proj)
Definition Main.cs:34390
void RenderBlack()
Definition Main.cs:54904
static int wofDrawAreaBottom
Definition Main.cs:832
static void PrintTimedMessage(string message, params object[] arguments)
Definition Main.cs:34563
static WorldPreparationState _worldPreparationState
Definition Main.cs:1900
static float mapFullscreenScale
Definition Main.cs:936
static void AnimateTiles()
Definition Main.cs:17212
static bool ingameOptionsWindow
Definition Main.cs:704
void DrawToMap()
Definition Main.cs:52050
static int TileInteractionLX
Definition Main.cs:2173
static int _targetNetMode
Definition Main.cs:2097
static void DrawInterface_1_1_DrawEmoteBubblesInWorld()
Definition Main.cs:43439
float scAdj
Definition Main.cs:2585
static bool[] buffDoubleApply
Definition Main.cs:790
static int focusColor
Definition Main.cs:2499
static bool DrawInterface_12_IngameFancyUI()
Definition Main.cs:43108
static float invAlpha
Definition Main.cs:1382
static DrawAnimation _coinOnWorldAnimation
Definition Main.cs:1709
static WorkshopPublishingIndicator WorkshopPublishingIndicator
Definition Main.cs:1880
static float InitialMapScale
Definition Main.cs:2541
static void DoUpdate_AutoSave()
Definition Main.cs:18348
static bool mapInit
Definition Main.cs:904
float logoRotationDirection
Definition Main.cs:2355
static bool halloween
Definition Main.cs:688
static float MouseBuildingGridAlpha
Definition Main.cs:277
double bgParallax
Definition Main.cs:956
static void DoUpdate_AnimateBackgrounds()
Definition Main.cs:18261
float screenOff
Definition Main.cs:2583
static bool autoPause
Definition Main.cs:1324
static int checkForSpawns
Definition Main.cs:1316
static bool SettingsUnlock_WorldEvil
Definition Main.cs:243
static float cameraX
Definition Main.cs:1202
static float windPhysicsStrength
Definition Main.cs:1370
static void TrySyncingMyPlayer()
Definition Main.cs:16356
static Stopwatch fpsTimer
Definition Main.cs:732
static void OpenClothesWindow()
Definition Main.cs:41135
static bool[] tileBlockLight
Definition Main.cs:1461
static int maxSectionsY
Definition Main.cs:1124
static string GetInputText(string oldString, bool allowMultiLine=false)
Definition Main.cs:18593
static bool[] tileCracked
Definition Main.cs:1491
bool _needToSetupDrawInterfaceLayers
Definition Main.cs:2477
static bool dedServFPS
Definition Main.cs:437
static void TriggerPing(Vector2 position)
Definition Main.cs:53575
static float lBar
Definition Main.cs:2515
static int musicBoxNotModifiedByVolume
Definition Main.cs:574
static Vector2 sceneTilePos
Definition Main.cs:1046
static int npcStreamSpeed
Definition Main.cs:433
static int[] turtleCageFrame
Definition Main.cs:1597
static bool LogoT
Definition Main.cs:1256
static int[] bunnyCageFrameCounter
Definition Main.cs:1515
static int[] seahorseCageFrame
Definition Main.cs:1635
static int caveBackground
Definition Main.cs:1266
static GameTipsDisplay gameTips
Definition Main.cs:2343
static bool[] vanityPet
Definition Main.cs:778
static bool InvisibleCursorForGamepad
Definition Main.cs:267
const double slimeRainChance
Definition Main.cs:1180
static bool[] tileDungeon
Definition Main.cs:1465
static int cameraLerpTimer
Definition Main.cs:457
static float windSpeedCurrent
Definition Main.cs:1360
static bool raining
Definition Main.cs:1310
void LoadResourcePacks(Preferences prefs)
Definition Main.cs:5952
static void DrawNPCHeadBoss(Entity theNPC, byte alpha, float headScale, float rotation, SpriteEffects effects, int bossHeadId, float x, float y)
Definition Main.cs:53592
RenderTarget2D tile2Target
Definition Main.cs:846
static void OnSubmitServerIP(string inputText)
Definition Main.cs:48994
static int selectedPlayer
Definition Main.cs:2375
float chestDepositScale
Definition Main.cs:1032
static float SmoothedMushroomLightInfluence
Definition Main.cs:1378
void MouseTextHackZoom(string text, string buffTooltip=null)
Definition Main.cs:18714
static bool clearMap
Definition Main.cs:886
static void SetDisplayMonitor()
Definition Main.cs:5803
static void TrySyncingItemArray(ref bool syncedAnyInventoryContents, Item[] my, Item[] other, int slotOffset)
Definition Main.cs:16514
void setServerWorldRollbacks(string rollBacksToKeep)
Definition Main.cs:4515
static List< INeedRenderTargetContent > ContentThatNeedsRenderTargets
Definition Main.cs:2591
static List< WorldFileData > WorldList
Definition Main.cs:1944
void DrawTiles(bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride=-1)
Definition Main.cs:20328
static int mapDelay
Definition Main.cs:207
static bool toggleFullscreen
Definition Main.cs:1918
static bool releaseUI
Definition Main.cs:2221
const int sectionWidth
Definition Main.cs:1118
static float lightningDecay
Definition Main.cs:2557
static bool[] tileNoSunLight
Definition Main.cs:1463
float chestStackScale
Definition Main.cs:1028
static bool IsEnginePreloaded
Definition Main.cs:940
static double time
Definition Main.cs:1284
void CheckBunny()
Definition Main.cs:3910
static bool IsItRaining
Definition Main.cs:2664
static bool IsInTheMiddleOfLoadingSettings
Definition Main.cs:2267
static byte[,] jellyfishCageMode
Definition Main.cs:1605
static Recipe[] recipe
Definition Main.cs:1791
static bool[] tileMergeDirt
Definition Main.cs:1431
static int LogoA
Definition Main.cs:1252
static bool netRelease
Definition Main.cs:1090
void DrawInterface_16_MapOrMinimap()
Definition Main.cs:42737
static bool verboseNetplay
Definition Main.cs:562
static Star[] star
Definition Main.cs:1679
void DrawBG_ModifyBGFarBackLayerAlpha(int desiredBG, int? desiredBG2=null, float? transitionAmountOverride=null)
Definition Main.cs:61063
static void WriteFancyWorldLoadErrorToConsole()
Definition Main.cs:5383
static bool slimeRain
Definition Main.cs:1166
static string cMapZoomIn
Definition Main.cs:2185
static float bottomWorld
Definition Main.cs:1112
static int invasionProgressDisplayLeft
Definition Main.cs:1994
static int maxSectionsX
Definition Main.cs:1122
void DrawBackGore()
Definition Main.cs:60249
static bool critterCage
Definition Main.cs:1511
static int musicError
Definition Main.cs:435
static bool[,] mapWasContentLost
Definition Main.cs:898
const int numTreeStyles
Definition Main.cs:1401
static int maxTilesY
Definition Main.cs:1116
static bool windPhysics
Definition Main.cs:1368
void OpenRecent()
Definition Main.cs:3756
static bool temporaryGUIScaleSliderUpdate
Definition Main.cs:1904
static void DrawInterface_18_DiagnoseVideo()
Definition Main.cs:42572
static FavoritesFile CloudFavoritesData
Definition Main.cs:359
static void UpdateClient()
Definition Main.cs:61321
static int essDir
Definition Main.cs:622
static FrameSkipMode FrameSkipMode
Definition Main.cs:2223
static string DrawMap_FindChestName(LocalizedText[] chestNames, Tile chestTile, int x, int y, int fullTileWidth=36)
Definition Main.cs:53657
static int GetProjectileDesiredShader(Projectile proj)
Definition Main.cs:20718
bool checkMap(int i, int j)
Definition Main.cs:55019
static int[] treeBGSet1
Definition Main.cs:640
Microsoft.Xna.Framework.Color randColor()
Definition Main.cs:44899
static float craftingAlpha
Definition Main.cs:1014
static int lo
Definition Main.cs:1250
static float shimmerDarken
Definition Main.cs:1010
static float _uiScaleWanted
Definition Main.cs:235
void DrawInterface_39_MouseOver()
Definition Main.cs:42047
static float ambientWaterfallX
Definition Main.cs:2315
static string _oldNetplayStatusText
Definition Main.cs:2601
static bool GamepadDisableCursorItemIcon
Definition Main.cs:2669
static bool inputTextEscape
Definition Main.cs:1747
static int mapTargetY
Definition Main.cs:890
void DrawDust()
Definition Main.cs:35458
const int MaxShopIDs
Definition Main.cs:453
static Vector2 DrawWhip_WhipBland(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33712
static void DoUpdate_WhilePaused()
Definition Main.cs:16198
static void DoUpdate_AnimateItemIcons()
Definition Main.cs:15570
void DrawSuperSpecialProjectiles(List< int > projCache, bool startSpriteBatch=true)
Definition Main.cs:34880
static void UpdateTime()
Definition Main.cs:61580
static byte[] wallLargeFrames
Definition Main.cs:1479
static PingMapLayer Pings
Definition Main.cs:365
void DrawWires()
Definition Main.cs:55168
static int[] seagullCageFrame
Definition Main.cs:1537
float logoScaleDirection
Definition Main.cs:2361
static NPCHeadRenderer TownNPCHeadRenderer
Definition Main.cs:297
static float cursorAlpha
Definition Main.cs:2209
static bool UseHeatDistortion
Definition Main.cs:429
static ulong _drawCycleCounter
Definition Main.cs:413
static bool drawingPlayerChat
Definition Main.cs:1739
static int[] ratCageFrameCounter
Definition Main.cs:1621
static void DrawInterface_Resources_Breath()
Definition Main.cs:40403
static int maxDustToDraw
Definition Main.cs:1128
List< int > DrawCacheNPCProjectiles
Definition Main.cs:2233
static int colorDelay
Definition Main.cs:2501
static ColorSlidersSet mouseBorderColorSlider
Definition Main.cs:2201
static void DrawNPCDirect_Deerclops(SpriteBatch mySpriteBatch, NPC rCurrentNPC, ref Vector2 screenPos, int typeCache, ref Microsoft.Xna.Framework.Color npcColor, ref Vector2 halfSize, SpriteEffects npcSpriteEffect)
Definition Main.cs:24672
static int bgWidthScaled
Definition Main.cs:2575
static int SmartInteractProj
Definition Main.cs:2165
static MoonPhase GetMoonPhase()
Definition Main.cs:3058
uint GetBackgroundCounter()
Definition Main.cs:57999
static Vector2 DrawWhip_ThornWhip(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33501
static int[] penguinCageFrame
Definition Main.cs:1627
const int InventoryCoinSlotsStart
Definition Main.cs:1188
static float ambientLavafallStrength
Definition Main.cs:2325
static bool serverStarting
Definition Main.cs:1104
static void DrawGuideCraftText(int adjY, Microsoft.Xna.Framework.Color craftingTipColor, out int inventoryX, out int inventoryY)
Definition Main.cs:39175
static int numStars
Definition Main.cs:1348
static void DrawTrail(Projectile proj, Vector2 rotatableOffsetFromCenter, Microsoft.Xna.Framework.Color baseColor)
Definition Main.cs:26128
TilePaintSystemV2 TilePaintSystem
Definition Main.cs:2401
static string cTorch
Definition Main.cs:2133
static int WorldListSortMethod(WorldFileData data1, WorldFileData data2)
Definition Main.cs:3701
static int[,] slugCageFrame
Definition Main.cs:1639
static double starGameMath(double value=1.0)
Definition Main.cs:59630
static void SetGraphicsProfile(GraphicsProfile profile, bool forceSet)
Definition Main.cs:3457
static void DrawWOFTongueToPlayer(int i)
Definition Main.cs:35145
static float masterColor
Definition Main.cs:1338
void DrawSurfaceBG_Corrupt(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes)
Definition Main.cs:57864
static GameTime gameTimeCache
Definition Main.cs:409
static void HandleMeteorFall()
Definition Main.cs:62225
void DrawClothesWindow()
Definition Main.cs:41191
static bool autoShutdown
Definition Main.cs:2277
static bool shortRender
Definition Main.cs:800
void LoadFlameRing()
Definition Main.cs:56262
static int[] treeBGSet3
Definition Main.cs:644
static float ambientLavafallY
Definition Main.cs:2323
void DrawLiquid(bool bg=false, int waterStyle=0, float Alpha=1f, bool drawSinglePassLiquids=true)
Definition Main.cs:54291
static float cameraLerp
Definition Main.cs:455
static GolfState LocalGolfState
Definition Main.cs:1876
static int mapTimeMax
Definition Main.cs:882
static void UpdateDragonflyJarFrames()
Definition Main.cs:15445
static bool gameInactive
Definition Main.cs:1074
static float cloudAlpha
Definition Main.cs:1302
static bool[] townNPCCanSpawn
Definition Main.cs:570
static byte[] wallFrame
Definition Main.cs:1661
static UIBestiaryTest BestiaryUI
Definition Main.cs:1870
void DoDebugFunctions()
Definition Main.cs:16342
static int spawnTileY
Definition Main.cs:1811
static void NotifyOfEvent(GameNotificationType type)
Definition Main.cs:15651
static void DrawMapFullscreenBackground(Vector2 screenPosition, int screenWidth, int screenHeight)
Definition Main.cs:53366
static void Initialize_TileAndNPCData1()
Definition Main.cs:7801
static int[] duckCageFrame
Definition Main.cs:1529
static bool frameRelease
Definition Main.cs:1092
static float sBar
Definition Main.cs:2513
static bool npcChatFocus1
Definition Main.cs:1827
static bool blockInput
Definition Main.cs:1819
static float windSpeedTarget
Definition Main.cs:1362
static Vector2[] OffsetsNPCOffhand
Definition Main.cs:463
void InitTargets(int width, int height)
Definition Main.cs:55123
void PostUpdateAllProjectiles()
Definition Main.cs:16352
static void DrawVersionNumber(Microsoft.Xna.Framework.Color menuColor, float upBump)
Definition Main.cs:49013
static ShopHelper ShopHelper
Definition Main.cs:1874
static int[] underworldBG
Definition Main.cs:666
const ulong WorldGeneratorVersion
Definition Main.cs:205
static bool resetClouds
Definition Main.cs:1376
static string ReadLineInput()
Definition Main.cs:5710
static float GraveyardVisualIntensity
Definition Main.cs:1393
static void DrawItemIcon(SpriteBatch spriteBatch, Item theItem, Vector2 screenPositionForItemCenter, Microsoft.Xna.Framework.Color itemLightColor, float sizeLimit)
Definition Main.cs:43707
static int interactedDresserTopLeftX
Definition Main.cs:2471
static ResolutionChangeEvent OnRenderTargetsInitialized
Definition Main.cs:2957
static int maxMapUpdates
Definition Main.cs:856
static int[] frogCageFrameCounter
Definition Main.cs:1591
static bool[] tileSolidTop
Definition Main.cs:1469
void UpdateBGVisibility_BackLayer(int? targetBiomeOverride, float? transitionAmountOverride)
Definition Main.cs:60941
static Effect tileShader
Definition Main.cs:2768
static Microsoft.Xna.Framework.Color[] oldClothesColor
Definition Main.cs:2467
static Vector2 sceneWaterPos
Definition Main.cs:1044
void DrawSurfaceBG_Crimson(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes)
Definition Main.cs:57143
static List< int > itemAnimationsRegistered
Definition Main.cs:1713
const int BG_STYLES_COUNT
Definition Main.cs:810
void ClientInitialize()
Definition Main.cs:9812
static FileMetadata MapFileMetadata
Definition Main.cs:363
const int maxGore
Definition Main.cs:1182
const int maxStarTypes
Definition Main.cs:1350
static bool npcChatFocus2
Definition Main.cs:1829
static bool[] npcCatchable
Definition Main.cs:1655
static float cloudBGAlpha
Definition Main.cs:626
static UIManageControls ManageControlsMenu
Definition Main.cs:1150
static int numCloudsTemp
Definition Main.cs:1358
static int desiredWorldTilesUpdateRate
Definition Main.cs:748
static double invasionX
Definition Main.cs:1972
void DrawInterface_Tests()
Definition Main.cs:41621
float GetForestToForestBackgroundLerperValue()
Definition Main.cs:56750
void DrawStarsInBackground(SceneArea sceneArea, bool artificial)
Definition Main.cs:59834
void DoUpdate_HandleInput()
Definition Main.cs:17073
static void ClearPendingPlayerSelectCallbacks()
Definition Main.cs:62938
static bool forceXMasForToday
Definition Main.cs:690
static float musicPitch
Definition Main.cs:768
static string npcChatText
Definition Main.cs:1825
static int npcChatCornerItem
Definition Main.cs:1837
static void DrawItemTextPopups(float scaleTarget)
Definition Main.cs:59201
static bool[] tileWaterDeath
Definition Main.cs:1455
static int maxItemUpdates
Definition Main.cs:2111
static Chest[] chest
Definition Main.cs:1699
static int selectedWorld
Definition Main.cs:2377
static WorldFileData ActiveWorldFileData
Definition Main.cs:1946
int mouseNPCType
Definition Main.cs:826
static bool npcChatRelease
Definition Main.cs:1813
void DrawProj_FairyQueenLance(Projectile proj)
Definition Main.cs:33056
static Microsoft.Xna.Framework.Color hcColor
Definition Main.cs:994
void RenderTiles()
Definition Main.cs:54076
void DrawInterface_40_InteractItemIcon()
Definition Main.cs:41934
void DrawPlayers_BehindNPCs()
Definition Main.cs:20788
static int TileInteractionLY
Definition Main.cs:2175
static bool cSmartCursorModeIsToggleAndNotHold
Definition Main.cs:2143
static int[] travelShop
Definition Main.cs:1843
static int loadMapLastX
Definition Main.cs:860
int firstTileY
Definition Main.cs:952
static float ambientWaterfallY
Definition Main.cs:2317
static int[] birdCageFrameCounter
Definition Main.cs:1543
void HackForGamepadInputHell()
Definition Main.cs:42435
static bool _shouldUseWindyDayMusic
Definition Main.cs:2299
const int maxMoons
Definition Main.cs:1395
void LoadProjectile(int i)
Definition Main.cs:56041
delegate void OnPlayerSelected(PlayerFileData player)
static void RegisterItemAnimation(int index, DrawAnimation animation)
Definition Main.cs:3405
static bool SettingDontScaleMainMenuUp
Definition Main.cs:251
static string motd
Definition Main.cs:1916
static int[,] scorpionCageFrame
Definition Main.cs:1567
static int maxLoadWorld
Definition Main.cs:1936
static float ambientVolume
Definition Main.cs:1423
static bool[] tileCut
Definition Main.cs:1433
static int[] npcFrameCount
Definition Main.cs:2002
const string copyrightText
Definition Main.cs:203
static string ValueToCoins(long value)
Definition Main.cs:52286
static bool menuBGChangedNight
Definition Main.cs:1930
static bool[] projPet
Definition Main.cs:1328
static void DrawNPC_SlimeItem(NPC rCurrentNPC, int typeCache, Microsoft.Xna.Framework.Color npcColor, float addedRotation)
Definition Main.cs:25171
const double dayLength
Definition Main.cs:1278
static UIWorldSelect _worldSelectMenu
Definition Main.cs:1148
static int PlayerOverheadChatMessageDisplayTime
Definition Main.cs:1735
static int updatesCountedForFPS
Definition Main.cs:1076
void SetMouseNPC_ToHousingQuery()
Definition Main.cs:3041
const int numInfoIcons
Definition Main.cs:900
static bool[] projHostile
Definition Main.cs:770
static float upTimer
Definition Main.cs:584
static bool targetSet
Definition Main.cs:602
static void SkipToTime(int timeToSet, bool setIsDayTime)
Definition Main.cs:61890
void DoDraw_WallsTilesNPCs()
Definition Main.cs:60102
static int stackCounter
Definition Main.cs:1765
void oldDrawWater(bool bg=false, int Style=0, float Alpha=1f)
Definition Main.cs:54333
static bool Setting_UseReducedMaxLiquids
Definition Main.cs:1733
void DrawProj_TrueNightsEdge(Projectile proj)
Definition Main.cs:25955
static FavoritesFile LocalFavoriteData
Definition Main.cs:357
static bool SmartCursorWanted_GamePad
Definition Main.cs:2147
static int LogoB
Definition Main.cs:1254
static UserInterface InGameUI
Definition Main.cs:383
static int[,] jellyfishCageFrameCounter
Definition Main.cs:1609
void LoadNPC(int i)
Definition Main.cs:56032
static Ref< Effect > VertexPixelShaderRef
Definition Main.cs:423
static void DrawWOFBody()
Definition Main.cs:35045
static void DrawInterface_26_InterfaceLogic3()
Definition Main.cs:42477
static AnchoredEntitiesCollection sleepingManager
Definition Main.cs:2257
static void GetBuilderAccsCountToShow(Player plr, out int blockReplaceIcons, out int torchGodIcons, out int totalDrawnIcons)
Definition Main.cs:44512
static Microsoft.Xna.Framework.Color cursorColor
Definition Main.cs:2205
static bool menuBGChangedDay
Definition Main.cs:1928
static Vector2 GetPlayerArmPosition(Projectile proj)
Definition Main.cs:34265
static int DrawPageIcons(int yPos)
Definition Main.cs:39785
static float[] buffAlpha
Definition Main.cs:1018
static void ResetGameCounter()
Definition Main.cs:5868
static void OpenResourcePacksMenu(UIState uiStateToGoBackTo)
Definition Main.cs:49261
static bool SmartInteractShowingGenuine
Definition Main.cs:2155
static bool _preventCraftingBecauseClickWasUsedToChangeFocusedRecipe
Definition Main.cs:2441
void LoadBackground(int i)
Definition Main.cs:55998
static bool ShouldShowInvisibleWalls()
Definition Main.cs:54895
static void DrawPrettyStarSparkle(float opacity, SpriteEffects dir, Vector2 drawpos, Microsoft.Xna.Framework.Color drawColor, Microsoft.Xna.Framework.Color shineColor, float flareCounter, float fadeInStart, float fadeInEnd, float fadeOutStart, float fadeOutEnd, float rotation, Vector2 scale, Vector2 fatness)
Definition Main.cs:32485
static int minScreenW
Definition Main.cs:754
static Item[] item
Definition Main.cs:1681
void DrawNPC(int iNPCIndex, bool behindTiles)
Definition Main.cs:20956
static int[] frogCageFrame
Definition Main.cs:1589
static bool screenMaximized
Definition Main.cs:1723
static float oldMaxRaining
Definition Main.cs:1306
static bool[] tileTable
Definition Main.cs:1459
static void SetRecommendedZoomContext(Matrix matrix)
Definition Main.cs:2964
static void InputTextSignCancel()
Definition Main.cs:18428
void DrawItems()
Definition Main.cs:35423
static int invasionSizeStart
Definition Main.cs:1980
static bool mouseExit
Definition Main.cs:2077
static INetDiagnosticsUI _activeNetDiagnosticsUI
Definition Main.cs:722
static void OnSubmitServerPort(string candidatePort)
Definition Main.cs:48985
void FullscreenStartup()
Definition Main.cs:63174
static float DrawSurfaceBG_GetFogPower()
Definition Main.cs:56675
static bool[] slimeRainNPC
Definition Main.cs:1162
static Vector2 DrawWhip_FireWhip(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33397
RenderTarget2D[,] mapTarget
Definition Main.cs:892
static bool[] countsAsHostForGameplay
Definition Main.cs:1807
static int lastNPCUpdate
Definition Main.cs:2105
static void LoadWorlds()
Definition Main.cs:3642
static float essScale
Definition Main.cs:620
static float ambientLavaStrength
Definition Main.cs:2331
void DrawRain()
Definition Main.cs:35431
void DoDraw_Tiles_NonSolid()
Definition Main.cs:60191
static bool TryFreeingElderSlime(int npcIndex)
Definition Main.cs:40128
static UICharacterSelect _characterSelectMenu
Definition Main.cs:1146
static void StartClientGameplay()
Definition Main.cs:45207
static bool betterDebugRelease
Definition Main.cs:596
static bool autoPass
Definition Main.cs:2507
static UIAchievementsMenu AchievementsMenu
Definition Main.cs:1152
Stopwatch _worldUpdateTimeTester
Definition Main.cs:2345
void DrawInterface(GameTime gameTime)
Definition Main.cs:41836
static int[] grasshopperCageFrameCounter
Definition Main.cs:1649
static bool[] tileSpelunker
Definition Main.cs:1467
static bool[] pvpBuff
Definition Main.cs:774
static int buffScanAreaWidth
Definition Main.cs:764
void DrawInterface_21_HairWindow()
Definition Main.cs:42533
RenderTarget2D backgroundTarget
Definition Main.cs:850
static KeyboardState inputText
Definition Main.cs:1960
static int[] squirrelCageFrameCounterOrange
Definition Main.cs:1523
static int stackDelay
Definition Main.cs:1769
WaterfallManager waterfallManager
Definition Main.cs:393
static bool SettingBlockGamepadsEntirely
Definition Main.cs:249
static SpriteBatch spriteBatch
Definition Main.cs:974
static uint GameUpdateCount
Definition Main.cs:2811
static float invasionProgressAlpha
Definition Main.cs:1996
static Effect pixelShader
Definition Main.cs:2764
static bool gamePad
Definition Main.cs:684
static IAudioSystem audioSystem
Definition Main.cs:1415
static bool anglerQuestFinished
Definition Main.cs:1847
void DoUpdateInWorld(Stopwatch sw)
Definition Main.cs:16531
static bool[] meleeBuff
Definition Main.cs:782
static string cHook
Definition Main.cs:2131
static VertexColors _glowPaintColors
Definition Main.cs:2551
void DrawMap(GameTime gameTime)
Definition Main.cs:52345
static void LockCraftingForThisCraftClickDuration()
Definition Main.cs:39309
static bool[] buffNoTimeDisplay
Definition Main.cs:788
static GraphicsProfile _currentGraphicsProfile
Definition Main.cs:1894
void DrawMiscMapIcons(SpriteBatch spriteBatch, Vector2 mapTopLeft, Vector2 mapX2Y2AndOff, Microsoft.Xna.Framework.Rectangle? mapRect, float mapScale, float drawScale, ref string mouseTextString)
Definition Main.cs:53491
static UserInterface MenuUI
Definition Main.cs:381
static void OpenPlayerSelect(OnPlayerSelected method)
Definition Main.cs:63193
static int _itemIconCacheTime
Definition Main.cs:2493
static double worldSurface
Definition Main.cs:1272
static int numClouds
Definition Main.cs:1356
static string cInv
Definition Main.cs:2135
void AutoHost()
Definition Main.cs:4789
static void DrawSmartCursor()
Definition Main.cs:43600
static string playerPathName
Definition Main.cs:2835
void DrawProjWithStarryTrail(Projectile proj, Microsoft.Xna.Framework.Color projectileColor, SpriteEffects dir)
Definition Main.cs:34287
void DrawPlayerChat()
Definition Main.cs:37650
static void AnimateTiles_CritterCages()
Definition Main.cs:12552
static void ResetKeyBindings()
Definition Main.cs:49330
static int[] ladybugCageFrameCounter
Definition Main.cs:1625
static bool IsLiquidStyleWater(int liquidStyle)
Definition Main.cs:54235
void DrawItem_AnimateSlot(int slot, int gameFramesPerSpriteFrame, int spriteFramesAmount)
Definition Main.cs:35244
float logoRotation
Definition Main.cs:2353
void OnTileChangeEvent(int x, int y, int count, TileChangeType eventType)
Definition Main.cs:62933
float _splashFrameCount
Definition Main.cs:2535
static int minScreenH
Definition Main.cs:756
static bool CanPlayCreditsRoll()
Definition Main.cs:2978
void DrawInventory()
Definition Main.cs:37731
void SortStardustDragonProjectiles(List< int > list)
Definition Main.cs:34962
static SpriteViewMatrix BackgroundViewMatrix
Definition Main.cs:229
static int fpsCount
Definition Main.cs:730
static void SyncAnInvasion(int toWho)
Definition Main.cs:44677
static void LoadPlayers()
Definition Main.cs:3718
static bool bannerMouseOver
Definition Main.cs:1244
static int waterStyle
Definition Main.cs:1208
static int[] ladybugCageFrame
Definition Main.cs:1623
TileDrawing TilesRenderer
Definition Main.cs:2403
static float grabMapX
Definition Main.cs:910
static Microsoft.Xna.Framework.Color highVersionColor
Definition Main.cs:1000
static bool forceHalloweenForToday
Definition Main.cs:692
static ItemShopSellbackHelper shopSellbackHelper
Definition Main.cs:1841
const int curRelease
Definition Main.cs:199
static bool inventorySortMouseOver
Definition Main.cs:1391
volatile bool _artLoaded
Definition Main.cs:215
static bool[] tileContainer
Definition Main.cs:1503
const int maxItems
Definition Main.cs:1140
static float[] liquidAlpha
Definition Main.cs:1206
void DrawBlack(bool force=false)
Definition Main.cs:54791
static bool isMouseLeftConsumedByUI
Definition Main.cs:618
void DrawNPCHousesInWorld()
Definition Main.cs:37458
void OnSubmitServerPassword()
Definition Main.cs:48913
void LoadArmorBody(int i)
Definition Main.cs:56120
void OnSubmitServerPassword(string passwordCandidate)
Definition Main.cs:48907
static int myPlayer
Definition Main.cs:1801
static void DoUpdate_F7_ToggleGraphicsDiagnostics()
Definition Main.cs:17126
AchievementAdvisor _achievementAdvisor
Definition Main.cs:377
static int[] treeX
Definition Main.cs:668
float logoRotationSpeed
Definition Main.cs:2357
static IntPtr FindWindow(string lpClassName, string lpWindowName)
static bool[] tilePile
Definition Main.cs:1497
static void UpdateOwlCageFrames()
Definition Main.cs:15437
static int DiscoR
Definition Main.cs:1062
static Vector2 ReverseGravitySupport(Vector2 pos, float height=0f)
Definition Main.cs:3005
void ClearCachedTileDraws()
Definition Main.cs:20271
static int[] lavaFishBowlFrameCounter
Definition Main.cs:1587
static int[,] projectileIdentity
Definition Main.cs:1693
static int demonTorchDir
Definition Main.cs:1332
static float lightning
Definition Main.cs:2555
static int screenBorderlessPendingResizes
Definition Main.cs:1727
void OnceFailedLoadingAnAsset(string assetPath, Exception e)
Definition Main.cs:9909
static int netMode
Definition Main.cs:2095
List< GameInterfaceLayer > _gameInterfaceLayers
Definition Main.cs:2479
static bool editSign
Definition Main.cs:1815
static string cBuff
Definition Main.cs:2129
static void Ambience()
Definition Main.cs:12507
static Microsoft.Xna.Framework.Color creativeModeColor
Definition Main.cs:996
void DrawRainInMenu()
Definition Main.cs:60079
static void DrawProj_Flamethrower(Projectile proj)
Definition Main.cs:32332
static Microsoft.Xna.Framework.Color tileColor
Definition Main.cs:1270
static int[] macawCageFrameCounter
Definition Main.cs:1555
static void ResetWindCounter(bool resetExtreme=false)
Definition Main.cs:55675
static void PostDrawMenu(Microsoft.Xna.Framework.Point screenSizeCache, Microsoft.Xna.Framework.Point screenSizeCacheAfterScaling)
Definition Main.cs:49163
static int spamCount
Definition Main.cs:1228
void YouCanSleepNow()
Definition Main.cs:4811
static bool skipMenu
Definition Main.cs:560
static float gfxQuality
Definition Main.cs:1056
static void DoUpdate_F10_ToggleFPS()
Definition Main.cs:17188
static float[] cloudBGX
Definition Main.cs:624
List< Player > _playersThatDrawAfterProjectiles
Definition Main.cs:2411
static bool inFancyUI
Definition Main.cs:706
static bool WallLightAt(int i, int j)
Definition Main.cs:51985
static int[] waterStriderCageFrameCounter
Definition Main.cs:1633
void DoDraw(GameTime gameTime)
Definition Main.cs:58369
static bool CanDryadPlayStardewAnimation(Player player, NPC npc)
Definition Main.cs:37240
static int[] squirrelCageFrame
Definition Main.cs:1517
static bool starGame
Definition Main.cs:2597
static double rockLayer
Definition Main.cs:1274
static int[] displayHeight
Definition Main.cs:1924
static Vector2[] OffsetsPlayerHeadgear
Definition Main.cs:520
void TickLoadProcess()
Definition Main.cs:10017
static bool drawToScreen
Definition Main.cs:600
static Vector3 shimmerShine
Definition Main.cs:2395
static int superFastStack
Definition Main.cs:1771
static Action< Vector2, float > OnPostFullscreenMapDraw
Definition Main.cs:2953
static int[] snailCageFrame
Definition Main.cs:1571
static float ambientLavaY
Definition Main.cs:2329
void RenderBackground()
Definition Main.cs:52004
static int bgDelay
Definition Main.cs:806
override void Update(GameTime gameTime)
Definition Main.cs:15596
List< DrawData > _voidLensData
Definition Main.cs:2413
static void SetResolution(int width, int height)
Definition Main.cs:62997
static float demonTorch
Definition Main.cs:1330
static bool[] wallDungeon
Definition Main.cs:1443
RenderTarget2D wallTarget
Definition Main.cs:848
static byte[] fishBowlFrameMode
Definition Main.cs:1579
const int InventoryAmmoSlotsCount
Definition Main.cs:1194
const int maxItemText
Definition Main.cs:1132
static bool[] tileLighted
Definition Main.cs:1429
static Vector2 ViewSize
Definition Main.cs:2615
static Gore[] gore
Definition Main.cs:1687
static int focusRecipe
Definition Main.cs:1799
static void DoDraw_UpdateCameraPosition()
Definition Main.cs:59314
static void DrawEmoteBubblesButton(int pivotTopLeftX, int pivotTopLeftY)
Definition Main.cs:39420
static bool SmartInteractShowingFake
Definition Main.cs:2157
static Process tServer
Definition Main.cs:984
static bool[] wallHouse
Definition Main.cs:1441
static void ReportInvasionProgress(int progress, int progressMax, int icon, int progressWave)
Definition Main.cs:44714
const int InventoryCoinSlotsCount
Definition Main.cs:1190
static Microsoft.Xna.Framework.Color selColor
Definition Main.cs:2497
static bool expertMode
Definition Main.cs:2737
static bool SettingsEnabled_AutoReuseAllItems
Definition Main.cs:247
void BindSettingsTo(Preferences preferences)
Definition Main.cs:5936
static CreativeUI CreativeMenu
Definition Main.cs:369
static int[] squirrelCageFrameOrange
Definition Main.cs:1521
static Microsoft.Xna.Framework.Color legendaryModeColor
Definition Main.cs:998
static string oldStatusText
Definition Main.cs:2273
static bool hasFocus
Definition Main.cs:1781
static Microsoft.Xna.Framework.Color shine(Microsoft.Xna.Framework.Color newColor, int type)
Definition Main.cs:20065
void DrawStar(ref SceneArea sceneArea, float starOpacity, Microsoft.Xna.Framework.Color bgColorForStars, int i, Star theStar, bool artificial, bool foreground=false)
Definition Main.cs:59868
static IPlayerRenderer PlayerRenderer
Definition Main.cs:291
void DrawBackgroundBlackFill()
Definition Main.cs:58198
static int _currentRecipeBeingCrafted
Definition Main.cs:2443
static string cMapAlphaUp
Definition Main.cs:2189
static void ClearVisualPostProcessEffects()
Definition Main.cs:49052
static string versionNumber2
Definition Main.cs:305
static void UpdateInvasion()
Definition Main.cs:61128
void DrawWalls()
Definition Main.cs:54923
static bool masterMode
Definition Main.cs:2717
void LoadItem(int i)
Definition Main.cs:56023
static bool IsFastForwardingTime()
Definition Main.cs:5721
void RefreshPlayerDrawOrder()
Definition Main.cs:20753
static float[] musicFade
Definition Main.cs:1419
static bool mouseRight
Definition Main.cs:616
static bool dayTime
Definition Main.cs:1282
static float grabMapY
Definition Main.cs:912
static Action< GameTime > OnPreDraw
Definition Main.cs:2949
int DiscoStyle
Definition Main.cs:1060
int invBottom
Definition Main.cs:1198
static bool CrouchingEnabled
Definition Main.cs:273
static int mouseTextColorChange
Definition Main.cs:1753
static void DrawInterface_37_DebugStuff()
Definition Main.cs:42149
static int martianLightDir
Definition Main.cs:1336
static DrawAnimation[] itemAnimations
Definition Main.cs:1707
static List< Microsoft.Xna.Framework.Point > SmartInteractTileCoordsSelected
Definition Main.cs:2171
static Vector2[] OffsetsPlayerOffhand
Definition Main.cs:472
static bool[] musicNoCrossFade
Definition Main.cs:1417
static void DrawWallOfCopperShortswords()
Definition Main.cs:41853
static Dictionary< int, byte > npcLifeBytes
Definition Main.cs:2075
static bool _hasPendingNetmodeChange
Definition Main.cs:2099
static int signY
Definition Main.cs:2217
static int thunderDistance
Definition Main.cs:2563
override void Draw(GameTime gameTime)
Definition Main.cs:58353
static bool _MouseOversCanClear
Definition Main.cs:2487
static int rare
Definition Main.cs:2457
static bool dedServ
Definition Main.cs:1226
static Microsoft.Xna.Framework.Color buffColor(Microsoft.Xna.Framework.Color newColor, float R, float G, float B, float A)
Definition Main.cs:34690
static int recStart
Definition Main.cs:1789
int lastTileY
Definition Main.cs:954
void DrawInterface_38_MouseCarriedObject()
Definition Main.cs:42065
static int PendingResolutionHeight
Definition Main.cs:1966
static void UpdateSlimeRainWarning()
Definition Main.cs:62253
static short moonModY
Definition Main.cs:1292
static void DrawSettingButton(ref bool mouseOver, ref float scale, int posX, int posY, string text, string textSizeMatcher, Action clickAction)
Definition Main.cs:42358
static void SubmitSignText()
Definition Main.cs:37441
void DrawInfoAccs()
Definition Main.cs:43718
void DrawSimpleSurfaceBackground(Vector2 areaPosition, int areaWidth, int areaHeight)
Definition Main.cs:53671
static void TryPlayingCreditsRoll()
Definition Main.cs:16173
RejectionMenuInfo RejectionMenuInfo
Definition Main.cs:2533
static bool[] tileMoss
Definition Main.cs:1485
void DoDraw_Waterfalls()
Definition Main.cs:60148
static ? bool _overrideForExpertMode
Definition Main.cs:335
bool FullTile(int x, int y)
Definition Main.cs:54729
static int[] snailCageFrameCounter
Definition Main.cs:1573
void LoadAccShield(int i)
Definition Main.cs:56217
static byte HealthBarDrawSettings
Definition Main.cs:576
float logoScaleSpeed
Definition Main.cs:2363
void DrawInfoAccs_AdjustInfoTextColorsForNPC(NPC npc, ref Microsoft.Xna.Framework.Color infoTextColor, ref Microsoft.Xna.Framework.Color infoTextShadowColor)
Definition Main.cs:44218
static void ApplyColorOfTheSkiesToTiles()
Definition Main.cs:59988
static int magmaBGFrame
Definition Main.cs:1096
static int TryInteractingWithMoneyTrough(Projectile proj)
Definition Main.cs:34468
void OpenShop(int shopIndex)
Definition Main.cs:37250
static bool refreshMap
Definition Main.cs:858
void Initialize_Entities()
Definition Main.cs:6113
static int oldUndergroundBackground
Definition Main.cs:558
static bool SettingsEnabled_MinersWobble
Definition Main.cs:245
static double CalculateDamageNPCsTake(int Damage, int Defense)
Definition Main.cs:62895
static bool[] tileSign
Definition Main.cs:1505
static Vector2 screenLastPosition
Definition Main.cs:1717
static int cursorOverride
Definition Main.cs:2181
void RenderWater()
Definition Main.cs:54139
static void SetNPCShopIndex(int index)
Definition Main.cs:37260
static bool GamepadDisableCursorItemIconInner
Definition Main.cs:269
void EnableAutoShutdown()
Definition Main.cs:4765
static bool _shouldUseStormMusic
Definition Main.cs:2301
const int sectionHeight
Definition Main.cs:1120
static BasicDebugDrawer DebugDrawer
Definition Main.cs:978
static void DrawInterface_36_Cursor()
Definition Main.cs:42153
static void DoUpdate_AnimateBackgrounds_UpdateForest(int bgIndex, int[] bgSet)
Definition Main.cs:18269
static bool changeTheTitle
Definition Main.cs:698
static int wofNPCIndex
Definition Main.cs:828
static int[] projFrames
Definition Main.cs:1326
static void EraseWorld(int i)
Definition Main.cs:4437
static void GetAreaToLight(out int firstTileX, out int lastTileX, out int firstTileY, out int lastTileY)
Definition Main.cs:60773
static string blockKey
Definition Main.cs:1821
static string clientUUID
Definition Main.cs:399
static bool IsItDay()
Definition Main.cs:59621
void AutoJoin(string IP)
Definition Main.cs:4781
List< int > DrawCacheNPCsBehindNonSolidTiles
Definition Main.cs:2235
static Stopwatch saveTime
Definition Main.cs:986
bool TryGetAmmo(Item sourceItem, out Item ammoItem, out Microsoft.Xna.Framework.Color ammoColor, out float ammoScale, out Vector2 ammoOffset)
Definition Main.cs:42018
static bool cancelWormHole
Definition Main.cs:2549
static bool terrariasFixedTiming
Definition Main.cs:2225
static void DrawNPCChatButtons(int superColor, Microsoft.Xna.Framework.Color chatColor, int numLines, string focusText, string focusText3)
Definition Main.cs:37265
Microsoft.Xna.Framework.? Rectangle GetBackgroundRect(int backgroundTextureIndex)
Definition Main.cs:57968
static void OnSubmitServerPasswordFromRequest(string passwordCandidate)
Definition Main.cs:48887
void DrawSplash_LoadingStar(Microsoft.Xna.Framework.Color splashColor)
Definition Main.cs:49522
const double slimeRainMinTime
Definition Main.cs:1172
static Vector2 DrawWhip_RainbowWhip(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33448
static PlayerResourceSetsManager ResourceSetsManager
Definition Main.cs:2261
static float UIScale
Definition Main.cs:2624
int bgTopY
Definition Main.cs:966
static string cMapFull
Definition Main.cs:2193
static float upTimerMax
Definition Main.cs:586
static int[] caveBackStyle
Definition Main.cs:674
void DrawInterface_34_PlayerChat()
Definition Main.cs:42231
const int InventoryItemSlotsCount
Definition Main.cs:1186
static Vector2 DrawThickCursor(bool smart=false)
Definition Main.cs:45092
static void HoverOverCraftingItemButton(int recipeIndex)
Definition Main.cs:39314
void DrawProj_TerraBlade2Shot(Projectile proj)
Definition Main.cs:26051
static void DrawInterface_5_GamepadLockOn()
Definition Main.cs:43250
void DrawWoF()
Definition Main.cs:35022
static int miniMapY
Definition Main.cs:916
static bool bloodMoon
Definition Main.cs:1296
MouseTextCache _mouseTextCache
Definition Main.cs:2387
List< int > DrawCacheFirstFractals
Definition Main.cs:2247
static void checkHalloween()
Definition Main.cs:12188
static bool CanShowInfoAccs
Definition Main.cs:2914
static float mapOverlayScale
Definition Main.cs:928
static int[] grebeCageFrameCounter
Definition Main.cs:1535
List< int > _npcTypesThatAlreadyDrewAHead
Definition Main.cs:2435
static int PlayerListSortMethod(PlayerFileData data1, PlayerFileData data2)
Definition Main.cs:3751
static bool InSmartCursorHighlightArea(int x, int y, out bool actuallySelected)
Definition Main.cs:3628
bool chestCancelHover
Definition Main.cs:1042
int RecommendedEquipmentAreaPushUp
Definition Main.cs:2878
static bool IsGraphicsDeviceAvailable
Definition Main.cs:2928
void DrawBlockReplacementIcon(int pivotTopLeftX, int pivotTopLeftY, bool pushSideToolsUp, int gamepadPointOffset)
Definition Main.cs:39601
static int[,] dragonflyJarFrame
Definition Main.cs:1565
static StardewValleyAnimation _stardewAnimation
Definition Main.cs:2421
static bool zenithWorld
Definition Main.cs:353
static bool xMas
Definition Main.cs:686
static void CloseNPCChatOrSign()
Definition Main.cs:37430
static bool ShouldDrawInfoIconsHorizontally
Definition Main.cs:2890
void LoadArmorHead(int i)
Definition Main.cs:56111
static int lastMouseY
Definition Main.cs:610
static void DrawInterface_Resources_ClearBuffs()
Definition Main.cs:40207
static bool updateMap
Definition Main.cs:872
static bool mouseLeftRelease
Definition Main.cs:1755
void LoadAccBack(int i)
Definition Main.cs:56181
static Action OnEngineLoad
Definition Main.cs:2943
static int _minimapTopRightAnchorOffsetTowardsBottom
Definition Main.cs:2547
static string cDown
Definition Main.cs:2117
void DrawProj_Excalibur(Projectile proj)
Definition Main.cs:25836
float chestLootScale
Definition Main.cs:1024
SpelunkerProjectileHelper SpelunkerProjectileHelper
Definition Main.cs:2347
List< int > DrawCacheProjsBehindNPCsAndTiles
Definition Main.cs:2237
bool gammaTest
Definition Main.cs:734
void DrawInfernoRings()
Definition Main.cs:61078
static Effect screenShader
Definition Main.cs:2762
static TextSnippet[] _netplayStatusTextSnippets
Definition Main.cs:2603
void OnSeedSelected(string text)
Definition Main.cs:45169
void DrawHealthBar(float X, float Y, int Health, int MaxHealth, float alpha, float scale=1f, bool noFlip=false)
Definition Main.cs:20399
static Microsoft.Xna.Framework.Color mcColor
Definition Main.cs:992
static float WindForVisuals
Definition Main.cs:2827
static void CancelHairWindow()
Definition Main.cs:40662
static float mapMinimapAlpha
Definition Main.cs:926
static double timeForVisualEffects
Definition Main.cs:1286
void SetupDrawInterfaceLayers()
Definition Main.cs:41625
static void SetFullScreen(bool fullscreen)
Definition Main.cs:62992
static string DefaultSeed
Definition Main.cs:1413
static int slimeRainKillCount
Definition Main.cs:1168
Chest[] shop
Definition Main.cs:1839
static bool _canShowMeteorFall
Definition Main.cs:2607
void HandleIME()
Definition Main.cs:37634
static bool TryAllowingToCraftRecipe(Recipe currentRecipe, bool tryFittingItemInInventoryToAllowCrafting, out bool movedAnItemToAllowCrafting)
Definition Main.cs:39367
static Main instance
Definition Main.cs:283
static string GetPlayerPathFromName(string playerName, bool cloudSave)
Definition Main.cs:4461
static void DoUpdate_AnimateVisualPlayerAura()
Definition Main.cs:18180
static bool PendingBorderlessState
Definition Main.cs:1968
void LoadWings(int i)
Definition Main.cs:56092
IEnumerator LoadMusic_InSteps()
Definition Main.cs:10043
static bool SmartCursorWanted_Mouse
Definition Main.cs:2145
void NewMOTD(string newMOTD)
Definition Main.cs:4545
static GameModeData _currentGameModeInfo
Definition Main.cs:313
static IssueReportsIndicator IssueReporterIndicator
Definition Main.cs:1882
static Microsoft.Xna.Framework.Color hslToRgb(float Hue, float Saturation, float Luminosity, byte a=byte.MaxValue)
Definition Main.cs:44918
static Vector2 MouseWorld
Definition Main.cs:2776
void autoCreate(string worldSize)
Definition Main.cs:4520
static void startSnowMoon()
Definition Main.cs:10159
static int[] crimsonBG
Definition Main.cs:658
void LoadAccHandsOn(int i)
Definition Main.cs:56148
static bool autoJoin
Definition Main.cs:1102
static Microsoft.Xna.Framework.Color[] _mapColorCacheArray
Definition Main.cs:391
static Microsoft.Xna.Framework.Color TryApplyingPlayerStringColor(int playerStringColor, Microsoft.Xna.Framework.Color stringColor)
Definition Main.cs:32681
static bool DrawInterface_8_CheckF11UIHideToggle()
Definition Main.cs:43141
static BestiaryUnlockProgressReport GetBestiaryProgressReport()
Definition Main.cs:62285
static string chatText
Definition Main.cs:1743
static bool UseStormEffects
Definition Main.cs:427
void UpdateParticleSystems()
Definition Main.cs:3593
static bool[] tileHammer
Definition Main.cs:1453
static bool _blockFancyUIWhileLoading
Definition Main.cs:2523
static void DrawTrashItemSlot(int pivotTopLeftX, int pivotTopLeftY)
Definition Main.cs:39395
int NPCBannerSorter(int npcIndex1, int npcIndex2)
Definition Main.cs:37453
static uint _gameUpdateCount
Definition Main.cs:944
static object CurrentInputTextTakerOverride
Definition Main.cs:1737
static int SmartCursorX
Definition Main.cs:2151
static bool[] tileBrick
Definition Main.cs:1483
static void FixUIScale()
Definition Main.cs:63169
static bool AnyPlayerReadyToFightKingSlime()
Definition Main.cs:61878
static float ugBackTransition
Definition Main.cs:1268
static bool ShowWindow(IntPtr hWnd, int nCmdShow)
static void DrawNPCDirect_GetHallowBossArmFrame(NPC rCurrentNPC, out int armFrame_Count, out int armFrameToUseLeft, out int armFrameToUseRight)
Definition Main.cs:25013
static int[,] slugCageFrameCounter
Definition Main.cs:1641
static void shine(ref Vector3 newColor, int type)
Definition Main.cs:20170
static bool blockMouse
Definition Main.cs:2521
void RenderTiles2()
Definition Main.cs:54108
static Ref< Effect > ScreenShaderRef
Definition Main.cs:417
static void CycleClothingStyle_Inner(Player plr)
Definition Main.cs:49286
static bool hideUI
Definition Main.cs:2219
static string worldPathName
Definition Main.cs:2837
int lastMusicPlayed
Definition Main.cs:2303
static int signHover
Definition Main.cs:2183
static void Sundialing()
Definition Main.cs:5730
List< int > DrawCacheNPCsOverPlayers
Definition Main.cs:2231
static int[] redBirdCageFrame
Definition Main.cs:1545
static NPCHeadRenderer BossNPCHeadRenderer
Definition Main.cs:299
static double hue2rgb(double c, double t1, double t2)
Definition Main.cs:44947
void Main_Exiting(object sender, EventArgs e)
Definition Main.cs:44887
List< DrawData > _voidLensDataSillouette2
Definition Main.cs:2417
void CacheProjDraws()
Definition Main.cs:34771
static string defaultIP
Definition Main.cs:744
static OnPlayerSelected _pendingCharacterSelect
Definition Main.cs:385
void OldDrawBackground()
Definition Main.cs:50915
static void DrawNPCDirect_HallowBoss(SpriteBatch mySpriteBatch, NPC rCurrentNPC, ref Vector2 screenPos, int typeCache, ref Microsoft.Xna.Framework.Color npcColor, ref Vector2 halfSize, SpriteEffects npcSpriteEffect)
Definition Main.cs:24825
static float _minWind
Definition Main.cs:2307
static int DamageVar(float dmg, float luck=0f)
Definition Main.cs:62870
static bool armorHide
Definition Main.cs:1006
static short GetKeyState(int keyCode)
static int screenHeight
Definition Main.cs:1721
static void ClampScreenPositionToWorld()
Definition Main.cs:60788
void DrawInterface_25_ResourceBars()
Definition Main.cs:42497
static Vector2 DrawWhip_BoneWhip(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33309
static Vector2 screenPosition
Definition Main.cs:1715
void loadLib(string path)
Definition Main.cs:4797
static WorldSections sectionManager
Definition Main.cs:395
static bool loadMapLock
Definition Main.cs:862
void DrawProjDirect(Projectile proj)
Definition Main.cs:26150
static TeleportPylonsSystem PylonSystem
Definition Main.cs:1872
static int backSpaceCount
Definition Main.cs:1912
static void startDedInput()
Definition Main.cs:5389
static void DrawWallOfFish()
Definition Main.cs:43533
static ChromaEngine Chroma
Definition Main.cs:285
void DrawSurfaceBG_Desert(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes)
Definition Main.cs:57777
static void DrawCursor(Vector2 bonus, bool smart=false)
Definition Main.cs:45012
void LoadDedConfig(string configPath)
Definition Main.cs:4560
void DrawInterface_27_Inventory()
Definition Main.cs:42444
const int maxStars
Definition Main.cs:1346
static void DrawProj_FlailChains_Old(Projectile proj, Vector2 mountedCenter)
Definition Main.cs:32596
static bool[] tileStone
Definition Main.cs:1449
void DrawSurfaceBG()
Definition Main.cs:56271
static Action OnRenderTargetsReleased
Definition Main.cs:2955
static int[] corruptBG
Definition Main.cs:648
void SortDrawCacheWorms()
Definition Main.cs:34932
static void DrawWallOfBoulders()
Definition Main.cs:41879
static Matrix Transform
Definition Main.cs:2771
static int moonPhase
Definition Main.cs:1288
static int CurrentDrawnEntityShader
Definition Main.cs:219
static void DrawBestiaryIcon(int pivotTopLeftX, int pivotTopLeftY)
Definition Main.cs:39473
static int GetMenuItemCount(IntPtr hWnd)
static int SmartInteractNPC
Definition Main.cs:2163
static bool qRelease
Definition Main.cs:1088
static IPlayerRenderer PotionOfReturnRenderer
Definition Main.cs:293
static bool SkipAssemblyLoad
Definition Main.cs:946
static void SetTileValue()
Definition Main.cs:5832
void DrawNPCDirect_QueenSlimeWings(NPC rCurrentNPC, SpriteBatch mySpriteBatch, Vector2 screenPos, Vector2 drawCenter, Microsoft.Xna.Framework.Color originColor)
Definition Main.cs:20963
static void DrawInterface_13_AchievementCompletePopups()
Definition Main.cs:43103
static Vector2 MouseScreen
Definition Main.cs:2773
static void StartInvasion(int type=1)
Definition Main.cs:61241
static void MouseOversClear()
Definition Main.cs:43497
static Microsoft.Xna.Framework.Color inventoryBack
Definition Main.cs:2451
const int InventoryItemSlotsStart
Definition Main.cs:1184
static int oldNPCShop
Definition Main.cs:1835
static string cMount
Definition Main.cs:2139
static float MenuXMovement
Definition Main.cs:2531
static void CycleFrameSkipMode()
Definition Main.cs:48876
static int[] backgroundWidth
Definition Main.cs:1665
static int[] itemFrame
Definition Main.cs:1703
static void SetMonitorOnce(object sender, PreparingDeviceSettingsEventArgs e)
Definition Main.cs:5812
static void InitializeItemAnimations()
Definition Main.cs:3414
static string worldName
Definition Main.cs:1260
static int setKey
Definition Main.cs:2503
static int[] treeMntBGSet3
Definition Main.cs:636
void DrawProj_EmpressBlade(Projectile proj, float hueOverride)
Definition Main.cs:33126
static bool stopTimeOuts
Definition Main.cs:564
static void TryRemovingBuff_CheckBuffHideMisc(int slot, int buffID)
Definition Main.cs:40387
static bool HasInteractibleObjectThatIsNotATile
Definition Main.cs:1998
static bool IsGoodPortAddress(string text)
Definition Main.cs:48971
void SetWorld(string world, bool cloud)
Definition Main.cs:4755
void GUIChatDrawInner()
Definition Main.cs:36377
void SetBackgroundOffsets(int backgroundID, double backgroundTopMagicNumber, int pushBGTopHack)
Definition Main.cs:57314
static bool mouseText
Definition Main.cs:2453
void DrawKite(Projectile proj)
Definition Main.cs:33858
static Item mouseItem
Definition Main.cs:1773
static int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags)
static KeyboardState oldInputText
Definition Main.cs:1962
const int MaxBannerTypes
Definition Main.cs:449
List< Player > _playersThatDrawBehindNPCs
Definition Main.cs:2409
static int weatherCounter
Definition Main.cs:1354
static int magmaBGFrameCounter
Definition Main.cs:1098
static int slimeWarningTime
Definition Main.cs:1156
static void DoUpdate_AltEnter_ToggleFullscreen()
Definition Main.cs:17085
static int[] fairyJarFrameCounter
Definition Main.cs:1603
static bool npcChatFocus4
Definition Main.cs:1833
static int TileInteractionHY
Definition Main.cs:2179
static bool preventStackSplitReset
Definition Main.cs:1763
static bool menuServer
Definition Main.cs:2093
static int maxMP
Definition Main.cs:792
static int mapStyle
Definition Main.cs:908
static int dedServCount2
Definition Main.cs:441
static void OnSubmitServerPasswordFromRequest()
Definition Main.cs:48893
static byte mouseTextColor
Definition Main.cs:1751
void DrawProj_PiercingStarlight(Projectile proj)
Definition Main.cs:32988
static void StopSlimeRain(bool announce=true)
Definition Main.cs:61545
void DrawInterface_23_NPCSignsDialog()
Definition Main.cs:42520
void DrawProj_LightsBane(Projectile proj)
Definition Main.cs:25765
static float iS
Definition Main.cs:758
static int[] redBirdCageFrameCounter
Definition Main.cs:1547
static void DrawInterface_0_InterfaceLogic1()
Definition Main.cs:43183
static void NewText(string newText, byte R=byte.MaxValue, byte G=byte.MaxValue, byte B=byte.MaxValue)
Definition Main.cs:61429
static string cLeft
Definition Main.cs:2115
static int[] recentPort
Definition Main.cs:798
static bool BackgroundEnabled
Definition Main.cs:802
static List< PlayerFileData > PlayerList
Definition Main.cs:1938
float chestCancelScale
Definition Main.cs:1040
const double nightLength
Definition Main.cs:1280
static bool UseExperimentalFeatures
Definition Main.cs:1411
static Camera Camera
Definition Main.cs:289
static void DrawInterface_17_DiagnoseNet()
Definition Main.cs:42729
static int undergroundBackground
Definition Main.cs:556
static Matrix UIScaleMatrix
Definition Main.cs:2619
const int InventorySlotsTotal
Definition Main.cs:1196
static Microsoft.Xna.Framework.Color OurFavoriteColor
Definition Main.cs:902
static bool _cameraPanHasBlackTransition
Definition Main.cs:2593
static void SaveRecent()
Definition Main.cs:3779
static bool WindyEnoughForKiteDrops
Definition Main.cs:2873
static void OpenWorldSelectUI()
Definition Main.cs:49255
static float atmo
Definition Main.cs:2571
static void SetDisplayModeAsBorderless(ref int width, ref int height, Form form)
Definition Main.cs:49205
static void UpdateCreativeGameModeOverride()
Definition Main.cs:16146
static int maxTilesX
Definition Main.cs:1114
static int[] treeMntBGSet2
Definition Main.cs:634
static bool GameAskedToQuit
Definition Main.cs:223
void DrawPlayers_AfterProjectiles()
Definition Main.cs:20794
void LoadArmorLegs(int i)
Definition Main.cs:56139
static void DrawInterface_4_Ruler()
Definition Main.cs:43255
void DrawBG()
Definition Main.cs:60797
static bool maxQ
Definition Main.cs:1054
static short[] tileOreFinderPriority
Definition Main.cs:1475
static int dungeonX
Definition Main.cs:1218
static DrawAnimation _monkStaffT3OnWorldAnimation
Definition Main.cs:1711
const int maxClouds
Definition Main.cs:1352
void SetNetPlayers(int mPlayers)
Definition Main.cs:4750
static bool[] tileSand
Definition Main.cs:1651
static int[] fishBowlFrame
Definition Main.cs:1581
static int[] hallowBG
Definition Main.cs:656
static void UpdateMenu()
Definition Main.cs:18440
static int GameMode
Definition Main.cs:2685
string SanitizePathArgument(string argumentName, string argumentPath)
Definition Main.cs:45221
void SetMouseNPC(int index, int type)
Definition Main.cs:3035
void DrawCachedNPCs(List< int > npcCache, bool behindTiles)
Definition Main.cs:34837
static SpriteViewMatrix GameViewMatrix
Definition Main.cs:227
static Vector2 DrawPlayerItemPos(float gravdir, int itemtype)
Definition Main.cs:3063
static void SaveClothesWindow()
Definition Main.cs:41184
static GameTime _drawInterfaceGameTime
Definition Main.cs:2481
static Microsoft.Xna.Framework.Color quickAlpha(Microsoft.Xna.Framework.Color oldColor, float Alpha)
Definition Main.cs:35174
static int DiscoG
Definition Main.cs:1066
static int offScreenRange
Definition Main.cs:836
bool playOldTile
Definition Main.cs:2305
static AmbienceServer AmbienceServer
Definition Main.cs:1860
static void OpenHairWindow()
Definition Main.cs:40649
void DrawSurfaceBG_Snow(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes)
Definition Main.cs:57232
static bool signBubble
Definition Main.cs:2213
override void UnloadContent()
Definition Main.cs:10059
static string debugWords
Definition Main.cs:682
static bool GlobalTimerPaused
Definition Main.cs:407
static void DrawInterface_41_InterfaceLogic4()
Definition Main.cs:41907
static Vector2[] OffsetsPlayerOnhand
Definition Main.cs:496
float cTop
Definition Main.cs:2587
static int starsHit
Definition Main.cs:2599
void DrawInterface_InstrumentMouseText()
Definition Main.cs:42280
static bool[] tileRope
Definition Main.cs:1481
static Player clientPlayer
Definition Main.cs:2085
static void DrawInterface_1_2_DrawEntityMarkersInWorld()
Definition Main.cs:43451
static bool[] tileBouncy
Definition Main.cs:1473
int bgLoops
Definition Main.cs:960
static bool CanPauseGame()
Definition Main.cs:16181
static void GoToWorldSelect()
Definition Main.cs:45201
static int[] macawCageFrame
Definition Main.cs:1553
static Item tooltipPrefixComparisonItem
Definition Main.cs:2385
void SetTitle()
Definition Main.cs:5823
void Initialize_AlmostEverything()
Definition Main.cs:5969
static int LogicCheckScreenWidth
Definition Main.cs:1896
static bool invasionProgressNearInvasion
Definition Main.cs:1982
bool ShouldUpdateEntities()
Definition Main.cs:16526
static bool[] tileAlch
Definition Main.cs:1435
void DrawMapIcons_LastGolfballHit(SpriteBatch spriteBatch, Vector2 mapTopLeft, Vector2 mapX2Y2AndOff, Microsoft.Xna.Framework.Rectangle? mapRect, float mapScale, float drawScale, ref string mouseTextString)
Definition Main.cs:53546
static bool getGoodWorld
Definition Main.cs:341
static int hairStart
Definition Main.cs:2459
static GraphicsProfile _selectedGraphicsProfile
Definition Main.cs:1892
static Microsoft.Xna.Framework.Point rulerLineDisplayValues
Definition Main.cs:1783
static Entity CurrentDrawnEntity
Definition Main.cs:221
static void UpdateTime_StartNight(ref bool stopEvents)
Definition Main.cs:61922
static bool validateSaves
Definition Main.cs:1242
static float _maxRain
Definition Main.cs:2313
static void TryPickingDefaultUIScale(float displayHeight)
Definition Main.cs:3927
static void CheckInvasionProgressDisplay()
Definition Main.cs:44519
static int[] treeMntBGSet1
Definition Main.cs:632
static Action< GameTime > OnPostDraw
Definition Main.cs:2951
void DrawGore()
Definition Main.cs:20364
static int CalculateWaterStyle(bool ignoreFountains=false)
Definition Main.cs:54160
static int numAvailableRecipes
Definition Main.cs:1797
static bool Support4K
Definition Main.cs:1884
static float _uiScaleUsed
Definition Main.cs:237
static bool showItemText
Definition Main.cs:1238
void DrawProj_TrueExcalibur(Projectile proj)
Definition Main.cs:25914
static int snowDust
Definition Main.cs:696
int firstTileX
Definition Main.cs:948
static float topWorld
Definition Main.cs:1110
static bool swapMusic
Definition Main.cs:1214
static int[] maggotCageFrameCounter
Definition Main.cs:1617
static float wFrCounter
Definition Main.cs:580
static void OpenReportsMenu()
Definition Main.cs:49242
void SetWorldName(string world)
Definition Main.cs:4760
static bool clothesWindow
Definition Main.cs:702
static string SavePath
Definition Main.cs:2680
static int[] seahorseCageFrameCounter
Definition Main.cs:1637
ChumBucketProjectileHelper ChumBucketProjectileHelper
Definition Main.cs:2349
static bool DrawPlayerDeathMarker(float X, float Y, float scale, float left, float top, float headScale, int i)
Definition Main.cs:53470
static float MinimumZoomComparerX
Definition Main.cs:1886
static ulong TileFrameSeed
Definition Main.cs:411
static float inventoryScale
Definition Main.cs:1779
static int[] wallBlend
Definition Main.cs:1447
static void DrawSmartInteract()
Definition Main.cs:43633
static bool[] tileShine2
Definition Main.cs:1439
static int[] specY
Definition Main.cs:2399
static int maxScreenW
Definition Main.cs:750
bool chestLootHover
Definition Main.cs:1026
static void snowing()
Definition Main.cs:12079
static Vector2 _lastPingMousePosition
Definition Main.cs:371
static IChatMonitor chatMonitor
Definition Main.cs:2339
static int[] bunnyCageFrame
Definition Main.cs:1513
static bool showSplash
Definition Main.cs:740
static Vector2 sceneWallPos
Definition Main.cs:1050
static bool[] tileSolid
Definition Main.cs:1471
static float ambientLavaX
Definition Main.cs:2327
static int[] owlCageFrame
Definition Main.cs:1643
void LoadAccShoes(int i)
Definition Main.cs:56199
void DrawProj_TerraBlade2(Projectile proj)
Definition Main.cs:26011
static Microsoft.Xna.Framework.Color mouseColor
Definition Main.cs:2203
static bool InReforgeMenu
Definition Main.cs:1908
static float shimmerBrightenDelay
Definition Main.cs:1012
void UpdateDisplaySettings()
Definition Main.cs:63184
void NeverSleep()
Definition Main.cs:4803
static List< string > anglerWhoFinishedToday
Definition Main.cs:1845
static Tile[,] tile
Definition Main.cs:1675
static void DrawInterface_GolfBallIndicator()
Definition Main.cs:40545
static string cRight
Definition Main.cs:2119
static BestiaryUnlocksTracker BestiaryTracker
Definition Main.cs:1868
static void SelectPlayer(PlayerFileData data)
Definition Main.cs:62943
static void AnimateTiles_WeatherVane()
Definition Main.cs:17947
static void DoUpdate_F11_ToggleUI()
Definition Main.cs:17102
static float ambientLavafallX
Definition Main.cs:2321
static int hellBackStyle
Definition Main.cs:678
static void DrawDefenseCounter(int inventoryX, int inventoryY)
Definition Main.cs:39157
static bool tilesLoaded
Definition Main.cs:1671
static int instantBGTransitionCounter
Definition Main.cs:804
static BlendState _multiplyBlendState
Definition Main.cs:2419
static int spawnTileX
Definition Main.cs:1809
static int WorldRollingBackupsCountToKeep
Definition Main.cs:1210
static int[] keyInt
Definition Main.cs:712
static void OpenPlayerChat()
Definition Main.cs:16984
static bool IsEngineLoaded
Definition Main.cs:942
int currentNPCShowingChatBubble
Definition Main.cs:2000
static Vector2 destroyerHB
Definition Main.cs:355
static int masterColorDir
Definition Main.cs:1340
static SamplerState SamplerStateForCursor
Definition Main.cs:980
static KeyboardState oldKeyState
Definition Main.cs:990
static int[] turtleCageFrameCounter
Definition Main.cs:1599
static void TryRemovingBuff(int i, int b)
Definition Main.cs:40367
void DrawPlayerChatBubbles()
Definition Main.cs:60057
static void ToggleGameplayUpdates(bool state)
Definition Main.cs:2959
void DrawNPCCheckAlt(NPC n)
Definition Main.cs:20948
static void DrawPendingMouseText()
Definition Main.cs:41922
static bool[] tileLavaDeath
Definition Main.cs:1457
static bool editChest
Definition Main.cs:1817
static float mapMinimapScale
Definition Main.cs:924
AmbientWindSystem _ambientWindSys
Definition Main.cs:2407
static int mapMinY
Definition Main.cs:878
int bgLoopsY
Definition Main.cs:964
static int maxNPCUpdates
Definition Main.cs:2109
static bool _settingsButtonIsPushedToSide
Definition Main.cs:2485
static Action< Vector2 > OnResolutionChanged
Definition Main.cs:2941
static void UpdateTime_StartDay(ref bool stopEvents)
Definition Main.cs:62110
static void DrawNPCHeadFriendly(Entity theNPC, byte alpha, float headScale, SpriteEffects dir, int townHeadId, float x, float y)
Definition Main.cs:53587
static WorldMap Map
Definition Main.cs:1673
static bool DrawInterface_10_CheckCaptureManager()
Definition Main.cs:43154
static int dungeonY
Definition Main.cs:1220
List< int > DrawCacheProjsBehindNPCs
Definition Main.cs:2239
static Matrix CurrentWantedZoomMatrix
Definition Main.cs:2617
static PlayerFileData ActivePlayerFileData
Definition Main.cs:1940
static Item HoverItem
Definition Main.cs:1910
static bool[] lightPet
Definition Main.cs:780
void MouseTextHackZoom(string text, int itemRarity, byte diff=0, string buffTooltip=null)
Definition Main.cs:18719
static int[] availableRecipe
Definition Main.cs:1793
static void DrawSocialMediaButtons(Microsoft.Xna.Framework.Color menuColor, float upBump)
Definition Main.cs:49002
static float gFader
Definition Main.cs:716
static int[] birdCageFrame
Definition Main.cs:1541
const int numTileColors
Definition Main.cs:1399
static int oceanBG
Definition Main.cs:664
static bool hidePVPIcons
Definition Main.cs:2445
static int moondialCooldown
Definition Main.cs:2287
static void stopMoonEvent()
Definition Main.cs:10107
static DroneCameraTracker DroneCameraTracker
Definition Main.cs:1878
static int[] tileShine
Definition Main.cs:1437
static bool fastForwardTimeToDawn
Definition Main.cs:2281
static int[] grasshopperCageFrame
Definition Main.cs:1647
static bool drawBetterDebug
Definition Main.cs:594
void DrawElderEye(SpriteBatch spriteBatch, Vector2 worldPosition, float opacity, float scale, int frameNumber, Microsoft.Xna.Framework.Color passedColor)
Definition Main.cs:20800
const int InventoryAmmoSlotsStart
Definition Main.cs:1192
static int wofDrawFrameIndex
Definition Main.cs:834
void DoUpdate(ref GameTime gameTime)
Definition Main.cs:15662
static Microsoft.Xna.Framework.Point ScreenSize
Definition Main.cs:2925
void UpdateAudio_DecideOnTOWMusic()
Definition Main.cs:10774
List< int > _occupantsListToDrawNPCHouses
Definition Main.cs:2427
void ReleaseTargets()
Definition Main.cs:54964
int selectedMenu
Definition Main.cs:2371
static float[] bgAlphaFrontLayer
Definition Main.cs:812
const string versionStringBecauseTheyreTheSame
Definition Main.cs:197
void DrawProj_NightsEdge(Projectile proj)
Definition Main.cs:25807
RenderTarget2D blackTarget
Definition Main.cs:844
static string cJump
Definition Main.cs:2121
List< int > DrawCacheProjsOverWiresUI
Definition Main.cs:2243
static bool _isLavafallMusicPlaying
Definition Main.cs:2337
static int[] tileFrameCounter
Definition Main.cs:1659
static int mapMaxX
Definition Main.cs:876
void DrawProj(int i)
Definition Main.cs:26110
static void DoUpdate_F8_ToggleNetDiagnostics()
Definition Main.cs:17154
static TileBatch tileBatch
Definition Main.cs:976
int textBlinkerCount
Definition Main.cs:2389
static int jungleBackStyle
Definition Main.cs:680
void UpdateOceanWaterLineForAmbience()
Definition Main.cs:56916
static bool allChestStackHover
Definition Main.cs:1389
static Action OnTickForThirdPartySoftwareOnly
Definition Main.cs:2945
static bool RenderTargetsRequired
Definition Main.cs:2653
void DrawStarsInForeground(SceneArea sceneArea)
Definition Main.cs:59864
static Action OnEnginePreload
Definition Main.cs:2939
static bool mouseRightRelease
Definition Main.cs:1757
bool _needsMenuUIRecalculation
Definition Main.cs:2529
static int mapMinX
Definition Main.cs:874
static float invDir
Definition Main.cs:1384
static void DrawInterface_20_MultiplayerPlayerNames()
Definition Main.cs:42541
static float backSpaceRate
Definition Main.cs:1914
static bool craftingHide
Definition Main.cs:1004
void DrawWhip(Projectile proj)
Definition Main.cs:33230
static float hBar
Definition Main.cs:2511
static int lastMouseX
Definition Main.cs:608
static bool shouldDrawNetDiagnosticsUI
Definition Main.cs:720
volatile bool _musicLoaded
Definition Main.cs:213
static int slimeWarningDelay
Definition Main.cs:1158
static bool eclipse
Definition Main.cs:1312
static int UnlockedMaxHair()
Definition Main.cs:40686
static bool HidePassword
Definition Main.cs:257
static Projectile[] projectile
Definition Main.cs:1691
int bgStartX
Definition Main.cs:958
static float exitScale
Definition Main.cs:2079
List< int > DrawCacheNPCsMoonMoon
Definition Main.cs:2229
void PrepareDrawnEntityDrawing(Entity entity, int intendedShader, Matrix? overrideMatrix)
Definition Main.cs:34634
static void DrawInvasionProgress()
Definition Main.cs:44723
void DrawSurfaceBG_GoodEvilDesert(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack)
Definition Main.cs:57645
static int[] treeBGSet2
Definition Main.cs:642
static IMultiplayerClosePlayersOverlay ActiveClosePlayersTeamOverlay
Definition Main.cs:724
void DrawInterface_Resources_Buffs()
Definition Main.cs:40217
static void DrawInterface_9_WireSelection()
Definition Main.cs:43173
static float MapScale
Definition Main.cs:2543
static bool _isResizingAndRemakingTargets
Definition Main.cs:2609
void LoadAccBalloon(int i)
Definition Main.cs:56244
static int miniMapHeight
Definition Main.cs:920
static Microsoft.Xna.Framework.Color ColorOfSurfaceBackgroundsModified
Definition Main.cs:2581
static bool[] tileBlendAll
Definition Main.cs:1499
static int qaStyle
Definition Main.cs:762
static bool[] buffNoSave
Definition Main.cs:786
static Microsoft.Xna.Framework.Color oldHairColor
Definition Main.cs:2463
static string[] recentIP
Definition Main.cs:796
static void OpenCharacterSelectUI()
Definition Main.cs:49236
static int fadeCounter
Definition Main.cs:1380
static void TryDisposingEverything()
Definition Main.cs:44892
void DoDraw_DrawNPCsOverTiles()
Definition Main.cs:60216
static GameModeData GameModeInfo
Definition Main.cs:2682
static byte gFadeDir
Definition Main.cs:718
static void DoUpdate_F9_ToggleLighting()
Definition Main.cs:17171
static int[] mouseCageFrame
Definition Main.cs:1593
static bool alreadyGrabbingSunOrMoon
Definition Main.cs:1294
static LiquidBuffer[] liquidBuffer
Definition Main.cs:1224
static bool shouldSetDefaultUIScale
Definition Main.cs:2263
WorldPreparationState
Definition Main.cs:99
List< int > _npcsWithBannersToDraw
Definition Main.cs:2429
static int[] mouseCageFrameCounter
Definition Main.cs:1595
static Microsoft.Xna.Framework.Input.Keys FavoriteKey
Definition Main.cs:2197
float[] menuItemScale
Definition Main.cs:2367
void DrawCapture(Microsoft.Xna.Framework.Rectangle area, CaptureSettings settings)
Definition Main.cs:53699
static int npcShop
Definition Main.cs:2833
void DrawNPCHousesInUI()
Definition Main.cs:39049
static KeyboardState keyState
Definition Main.cs:988
static int invasionType
Definition Main.cs:1970
static int maxLoadPlayer
Definition Main.cs:1934
static bool resetMapFull
Definition Main.cs:934
static Vector2 DrawWhip_CoolWhip(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33346
static Item reforgeItem
Definition Main.cs:1777
static Vector2 mapFullscreenPos
Definition Main.cs:938
static int moonType
Definition Main.cs:1397
static BestiaryDatabase BestiaryDB
Definition Main.cs:1864
static int[] ratCageFrame
Definition Main.cs:1619
static void DrawProj_FlailChains(Projectile proj, Vector2 mountedCenter)
Definition Main.cs:32503
static string GetBuffTooltip(Player player, int buffType)
Definition Main.cs:40267
static void DrawInterface_15_InvasionProgressBars()
Definition Main.cs:42767
static int saveTimer
Definition Main.cs:1100
static int textureMaxHeight
Definition Main.cs:870
static string AutogenSeedName
Definition Main.cs:311
static void DrawInterface_6_TileGridOption()
Definition Main.cs:43213
static void CheckForMoonEventsStartingTemporarySeasons()
Definition Main.cs:10063
static bool CanStartInvasion(int type=1, bool ignoreDelay=false)
Definition Main.cs:61220
static int[] owlCageFrameCounter
Definition Main.cs:1645
static Vector2 CurrentPan
Definition Main.cs:544
static int teamNamePlateDistance
Definition Main.cs:1729
static int BlackFadeIn
Definition Main.cs:548
static void DrawPVPIcons()
Definition Main.cs:39699
static float _maxWind
Definition Main.cs:2309
float UIScaleMax
Definition Main.cs:2643
static string getPort
Definition Main.cs:2089
static string ConvertFromSafeArgument(string arg)
Definition Main.cs:4555
static bool SettingsEnabled_TilesSwayInWind
Definition Main.cs:1372
static int invasionDelay
Definition Main.cs:1976
static void Initialize_Items()
Definition Main.cs:6166
static Microsoft.Xna.Framework.Color errorColor
Definition Main.cs:1002
void MouseTextNoOverride(string cursorText, int rare=0, byte diff=0, int hackedMouseX=-1, int hackedMouseY=-1, int hackedScreenWidth=-1, int hackedScreenHeight=-1, int pushWidthX=0)
Definition Main.cs:18724
void DrawHairWindow()
Definition Main.cs:40700
static string defaultChestName
Definition Main.cs:1823
static int[,] dragonflyJarFrameCounter
Definition Main.cs:1563
static bool drawSkip
Definition Main.cs:728
static int DiscoB
Definition Main.cs:1064
static bool IsNPCActiveAndOneOfTypes(int npcIndex, params int[] types)
Definition Main.cs:16885
static SamplerState DefaultSamplerState
Definition Main.cs:2814
static string cMapAlphaDown
Definition Main.cs:2191
static ItemDropResolver ItemDropSolver
Definition Main.cs:1866
static int _itemIconCacheSelectedItemID
Definition Main.cs:2491
static bool ShouldNormalEventsBeAbleToStart()
Definition Main.cs:61913
static int textureMaxWidth
Definition Main.cs:868
static void SetBackColor(InfoToSetBackColor info, out Microsoft.Xna.Framework.Color sunColor, out Microsoft.Xna.Framework.Color moonColor)
Definition Main.cs:60291
const int maxHairOfStylistDefault
Definition Main.cs:1409
static readonly int offLimitBorderTiles
Definition Main.cs:445
static int uCount
Definition Main.cs:1080
static int extremeWindCounter
Definition Main.cs:1366
static int[] squirrelCageFrameCounter
Definition Main.cs:1519
void DrawInterface_30_Hotbar()
Definition Main.cs:43666
static List< string > _requiredObjecsForCraftingText
Definition Main.cs:2439
static bool InGuideCraftMenu
Definition Main.cs:1906
static Vector2 sceneTile2Pos
Definition Main.cs:1048
int bgStartY
Definition Main.cs:962
static int teamCooldownLen
Definition Main.cs:1070
static int _lastHoveredLoadoutIndex
Definition Main.cs:2433
const int maxPlayers
Definition Main.cs:1134
void LoadAccBeard(int i)
Definition Main.cs:56253
static int windCounter
Definition Main.cs:1364
static int[] snowMntBG
Definition Main.cs:652
static void DrawInterface_3_LaserRuler()
Definition Main.cs:43355
static int lastItemUpdate
Definition Main.cs:2107
static int signX
Definition Main.cs:2215
static Microsoft.Xna.Framework.Color[] teamColor
Definition Main.cs:1276
static int mapTargetX
Definition Main.cs:888
void DoDraw_WallsAndBlacks()
Definition Main.cs:60272
static bool cameraGamePadLerp
Definition Main.cs:461
static bool autoSave
Definition Main.cs:1240
static int[] backgroundHeight
Definition Main.cs:1667
void LoadAccNeck(int i)
Definition Main.cs:56226
static void LoadTestLog(string logname)
Definition Main.cs:9905
const double slimeRainMinDelay
Definition Main.cs:1176
static Vector2 ViewPosition
Definition Main.cs:2613
int DrawSurfaceBG_GetLayerYOffset(int bgTextureIndex)
Definition Main.cs:56695
static bool ignoreErrors
Definition Main.cs:742
void DrawGoreBehind()
Definition Main.cs:20333
static bool drewLava
Definition Main.cs:1204
const int maxChests
Definition Main.cs:1138
static string newWorldName
Definition Main.cs:2393
static int LogicCheckScreenHeight
Definition Main.cs:1898
static ConcurrentQueue< Action > _mainThreadActions
Definition Main.cs:612
static void CacheSupportedDisplaySizes()
Definition Main.cs:9878
static void ErasePlayer(int i)
Definition Main.cs:4413
static float cursorScale
Definition Main.cs:2211
static int thunderDelay
Definition Main.cs:2561
static ParticleRenderer ParticleSystem_World_OverPlayers
Definition Main.cs:2249
static MapHeadRenderer MapPlayerRenderer
Definition Main.cs:295
bool DrawInterface_11_IngameOptionsMenu()
Definition Main.cs:43122
void MouseTextInner(MouseTextCache info)
Definition Main.cs:18754
void DrawSurfaceBG_BackMountainsStep2(int pushBGTopHack)
Definition Main.cs:56832
static int dedServCount1
Definition Main.cs:439
static float MinimumZoomComparerY
Definition Main.cs:1888
static ChromaHotkeyPainter ChromaPainter
Definition Main.cs:287
static void DrawInterface_Resources_GolfPower()
Definition Main.cs:40512
static int menuFocus
Definition Main.cs:2509
static void DoUpdate_HandleChat()
Definition Main.cs:17001
static void clrInput()
Definition Main.cs:18584
static void Moondialing()
Definition Main.cs:5745
void DrawInterface_14_EntityHealthBars()
Definition Main.cs:42776
void DrawProj_CoolWhipMinion(Projectile proj)
Definition Main.cs:33160
void GUIBarsDraw()
Definition Main.cs:40176
void AutoPass()
Definition Main.cs:4776
static void HelpText()
Definition Main.cs:35624
static void DrawInterface_35_YouDied()
Definition Main.cs:42210
const int maxCharSelectHair
Definition Main.cs:1407
static bool TOWMusicUnlocked
Definition Main.cs:1212
static void SetupTileMerge()
Definition Main.cs:3390
static Microsoft.Xna.Framework.Point ReverseGravitySupport(Microsoft.Xna.Framework.Point pos, int height=0)
Definition Main.cs:3015
static UnifiedRandom rand
Definition Main.cs:1387
static float bgScale
Definition Main.cs:2573
static RasterizerState Rasterizer
Definition Main.cs:552
void DrawInterface_28_InfoAccs()
Definition Main.cs:42427
static void DoUpdate_Enter_ToggleChat()
Definition Main.cs:16966
const int MaxTimeout
Definition Main.cs:2101
static Microsoft.Xna.Framework.Color GetPlayerHeadBordersColor(Player plr)
Definition Main.cs:53640
void GUIBarsDrawInner()
Definition Main.cs:40194
static void CheckMonoliths()
Definition Main.cs:58305
static bool notTheBeesWorld
Definition Main.cs:347
static void UpdateMinimapAnchors()
Definition Main.cs:52333
float logoScale
Definition Main.cs:2359
void LoadContent_TryEnteringHiDef()
Definition Main.cs:9960
static int worldID
Definition Main.cs:1262
static byte gFade
Definition Main.cs:714
TextDisplayCache _textDisplayCache
Definition Main.cs:2425
static bool npcChatFocus3
Definition Main.cs:1831
static void UpdateUIStates(GameTime gameTime)
Definition Main.cs:16328
void DrawInterface_7_TownNPCHouseBanners()
Definition Main.cs:43191
static int miniMapX
Definition Main.cs:914
void PreUpdateAllProjectiles()
Definition Main.cs:16346
void DrawCachedProjs(List< int > projCache, bool startSpriteBatch=true)
Definition Main.cs:34852
static Matrix _currentWantedZoomMatrix
Definition Main.cs:231
static float rightWorld
Definition Main.cs:1108
int[] _npcIndexWhoHoldsHeadIndex
Definition Main.cs:2437
static int[] bgFrame
Definition Main.cs:816
static int frameRate
Definition Main.cs:1084
static bool TryGetBuffTime(int buffSlotOnPlayer, out int buffTimeValue)
Definition Main.cs:40300
void DrawContinuousTrail(Projectile proj)
Definition Main.cs:26120
static NPC[] npc
Definition Main.cs:1685
static int[] displayWidth
Definition Main.cs:1922
static int maxNetPlayers
Definition Main.cs:1136
void GraphicsDeviceLost(object sender, EventArgs evt)
Definition Main.cs:58349
static bool lockMenuBGChange
Definition Main.cs:1932
static int multiplayerNPCSmoothingRange
Definition Main.cs:1731
static float newDefaultUIScale
Definition Main.cs:2265
static bool noTrapsWorld
Definition Main.cs:351
static AchievementAdvisor AchievementAdvisor
Definition Main.cs:2758
static bool recFastScroll
Definition Main.cs:1785
static string[] keyString
Definition Main.cs:710
void LoadGore(int i)
Definition Main.cs:56050
static float backgroundLayerTransitionSpeed
Definition Main.cs:2569
static float armorAlpha
Definition Main.cs:1016
void UpdateWeather(GameTime gameTime, int currentDayRateIteration)
Definition Main.cs:55707
static float GameZoomTarget
Definition Main.cs:239
static float sunCircle
Definition Main.cs:546
RenderTarget2D mapSectionTexture
Definition Main.cs:894
static GameNotificationType _flashNotificationType
Definition Main.cs:275
static void UpdateTimeRate()
Definition Main.cs:5760
static int numDisplayModes
Definition Main.cs:1920
static void MouseText_DrawItemTooltip_GetLinesInfo(Item item, ref int yoyoLogo, ref int researchLine, float oldKB, ref int numLines, string[] toolTipLine, bool[] preFixLine, bool[] badPreFixLine)
Definition Main.cs:19206
static string PlayerPath
Definition Main.cs:1952
static UnifiedRandom _tempSeededRandom
Definition Main.cs:2423
static void EntitySpriteDraw(DrawData data)
Definition Main.cs:34677
static string hoverItemName
Definition Main.cs:2449
static bool afterPartyOfDoom
Definition Main.cs:1020
static IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert)
static void TrySetPreparationState(WorldPreparationState state)
Definition Main.cs:3599
static Vector3 rgbToHsl(Microsoft.Xna.Framework.Color newColor)
Definition Main.cs:44972
static float mapOverlayAlpha
Definition Main.cs:930
void LoadHair(int i)
Definition Main.cs:56101
bool _isDrawingOrUpdating
Definition Main.cs:2589
WallDrawing WallsRenderer
Definition Main.cs:2405
static int miniMapWidth
Definition Main.cs:918
static string CloudPlayerPath
Definition Main.cs:1954
static void DrawInterface_32_GamepadRadialHotbars()
Definition Main.cs:42314
static void UpdateDragonflyJarFrame(int[,] frames, int[,] frameCounters, int style, int variation)
Definition Main.cs:15507
RenderTarget2D backWaterTarget
Definition Main.cs:838
static void NewTextMultiline(string text, bool force=false, Microsoft.Xna.Framework.Color c=default(Microsoft.Xna.Framework.Color), int WidthLimit=-1)
Definition Main.cs:61435
static int DrawBuffIcon(int drawBuffText, int buffSlotOnPlayer, int x, int y)
Definition Main.cs:40312
static float GamepadCursorAlpha
Definition Main.cs:2527
void InitTargets()
Definition Main.cs:55106
static void FakeLoadInvasionStart()
Definition Main.cs:61293
static float UIScaleWanted
Definition Main.cs:2621
static float caveParallax
Definition Main.cs:1216
static void DrawWallOfStars()
Definition Main.cs:43566
static double _lastPingMouseDownTime
Definition Main.cs:373
static int[] wormCageFrameCounter
Definition Main.cs:1613
static bool recBigList
Definition Main.cs:1787
void DrawBuilderAccToggles(Vector2 start)
Definition Main.cs:44285
static void DrawInterface_2_SmartCursorTargets()
Definition Main.cs:43434
void HoverOverNPCs(Microsoft.Xna.Framework.Rectangle mouseRectangle)
Definition Main.cs:40007
static void startDedInputCallBack()
Definition Main.cs:5397
static int netPlayCounter
Definition Main.cs:2103
static bool dontStarveWorld
Definition Main.cs:345
static GenerationProgress AutogenProgress
Definition Main.cs:982
void DrawProj_TheHorsemansBlade(Projectile proj)
Definition Main.cs:25875
void DrawMultisegmentPet(Projectile proj)
Definition Main.cs:33792
void DoUpdate_AnimateWaterfalls()
Definition Main.cs:18156
static void UpdateTime_SpawnTownNPCs()
Definition Main.cs:62302
static void SetCameraLerp(float lerp, int time)
Definition Main.cs:2991
void DrawInterface_33_MouseText()
Definition Main.cs:42249
static short[] tileGlowMask
Definition Main.cs:1501
void DrawMurderAurora(Projectile proj)
Definition Main.cs:33189
void DrawItem(Item item, int whoami)
Definition Main.cs:35252
void GUIChatDraw()
Definition Main.cs:43683
static string ConvertToSafeArgument(string arg)
Definition Main.cs:4550
static void ReleaseHostAndPlayProcess()
Definition Main.cs:45213
static int[] fishBowlFrameCounter
Definition Main.cs:1583
override void LoadContent()
Definition Main.cs:9914
static int newMusic
Definition Main.cs:1236
static bool CaptureModeDisabled
Definition Main.cs:279
static int GetPreferredBGStyleForPlayer()
Definition Main.cs:61005
static int[] blueBirdCageFrame
Definition Main.cs:1549
static int ProjectileUpdateLoopIndex
Definition Main.cs:2341
static int interactedDresserTopLeftY
Definition Main.cs:2473
static int helpText
Definition Main.cs:1318
static int _renderTargetMaxSize
Definition Main.cs:1890
float chestRenameScale
Definition Main.cs:1036
static bool screenBorderless
Definition Main.cs:1725
static void DrawNPCDirect_Faeling(SpriteBatch mySpriteBatch, NPC rCurrentNPC, ref Vector2 screenPos, int typeCache, ref Microsoft.Xna.Framework.Color npcColor, ref Vector2 halfSize, SpriteEffects npcSpriteEffect)
Definition Main.cs:24767
static void UpdateOldNPCShop()
Definition Main.cs:16906
static string cThrowItem
Definition Main.cs:2123
static int[] itemFrameCounter
Definition Main.cs:1705
static ColorSlidersSet mouseColorSlider
Definition Main.cs:2199
static int toolTipDistance
Definition Main.cs:403
static void StartRain()
Definition Main.cs:61448
static int menuSkip
Definition Main.cs:2381
static float maxRaining
Definition Main.cs:1304
static int SmartCursorY
Definition Main.cs:2153
int splashCounter
Definition Main.cs:2227
static bool renderNow
Definition Main.cs:598
void DrawInterface_Healthbar_Worm(NPC head, int tailID, float scale)
Definition Main.cs:43088
static void UpdateOwlCageFrame(int[] frames, int[] frameCounters, int style)
Definition Main.cs:15456
static byte[] tileLargeFrames
Definition Main.cs:1477
static bool ThickMouse
Definition Main.cs:2666
static void DrawGuideCraftText_Old(int adjY, Microsoft.Xna.Framework.Color craftingTipColor, out int inventoryX, out int inventoryY)
Definition Main.cs:39243
static bool AnnouncementBoxDisabled
Definition Main.cs:307
static bool[] tileObsidianKill
Definition Main.cs:1493
static float lightningSpeed
Definition Main.cs:2559
static void DrawInterface_29_SettingsButton()
Definition Main.cs:42325
void PrepareDrawnProjectileDrawing(Projectile proj)
Definition Main.cs:34622
static void DrawLoadoutButtons(int inventoryTop, bool demonHeartSlotAvailable, bool masterModeSlotAvailable)
Definition Main.cs:38988
void SaveResourcePacks(Preferences prefs)
Definition Main.cs:5959
static bool mapEnabled
Definition Main.cs:906
static float slimeRainNPCSlots
Definition Main.cs:1160
void DrawMouseOver()
Definition Main.cs:39869
void DoDraw_DrawNPCsBehindTiles()
Definition Main.cs:60233
static int[] timeItemSlotCannotBeReusedFor
Definition Main.cs:1683
static Action OnTickForInternalCodeOnly
Definition Main.cs:2947
void DrawNPCs(bool behindTiles=false)
Definition Main.cs:20810
static Microsoft.Xna.Framework.Color ColorOfSurfaceBackgroundsBase
Definition Main.cs:2579
void UpdateAudio_DecideOnNewMusic()
Definition Main.cs:11306
static int stackSplit
Definition Main.cs:1761
static Microsoft.Xna.Framework.Point GetScreenOverdrawOffset()
Definition Main.cs:50910
static void Initialize_TileAndNPCData2()
Definition Main.cs:6229
static int[] maggotCageFrame
Definition Main.cs:1615
static bool SmartInteractPotionOfReturn
Definition Main.cs:2167
static string getIP
Definition Main.cs:2087
static byte[] wallFrameCounter
Definition Main.cs:1663
string _cachedTitle
Definition Main.cs:554
static int cageFrames
Definition Main.cs:1509
bool chestDepositHover
Definition Main.cs:1034
static int ugMusic
Definition Main.cs:1234
static int[] mushroomBG
Definition Main.cs:662
static int invasionProgressWave
Definition Main.cs:1992
static void ToggleFullScreen()
Definition Main.cs:62987
static bool ContentLoaded
Definition Main.cs:401
static RenderTarget2D screenTarget
Definition Main.cs:852
static int maxRain
Definition Main.cs:1154
static List< TitleLinkButton > TitleLinks
Definition Main.cs:301
void updateCloudLayer()
Definition Main.cs:12211
static int[] waterStriderCageFrame
Definition Main.cs:1631
static bool tenthAnniversaryWorld
Definition Main.cs:343
static void ChangeRain()
Definition Main.cs:61499
static void CanceledGivingServerPassword()
Definition Main.cs:48899
static GeneralIssueReporter IssueReporter
Definition Main.cs:2291
static ulong LobbyId
Definition Main.cs:389
void RenderWalls()
Definition Main.cs:54928
static bool noWindowBorder
Definition Main.cs:550
static string WorldPath
Definition Main.cs:1948
static void DrawProj_FishingLine(Projectile proj, ref float polePosX, ref float polePosY, Vector2 mountedCenter)
Definition Main.cs:32719
const double LeinforsBalanceRequestForSlimeRainChance
Definition Main.cs:1178
static bool[,] initMap
Definition Main.cs:896
static int[] treeStyle
Definition Main.cs:670
static double slimeRainTime
Definition Main.cs:1164
static string buffString
Definition Main.cs:1246
void OnWorldNamed(string text)
Definition Main.cs:45184
static int[] desertBG
Definition Main.cs:660
static bool[] wallLight
Definition Main.cs:1445
void UpdateBGVisibility_FrontLayer(int? targetBiomeOverride, float? transitionAmountOverride)
Definition Main.cs:60908
static bool _isWaterfallMusicPlaying
Definition Main.cs:2335
void DrawHotbarLockIcon(int pivotTopLeftX, int pivotTopLeftY, bool pushSideToolsUp)
Definition Main.cs:39563
void DrawSplash_LoadingFlower(Microsoft.Xna.Framework.Color splashColor)
Definition Main.cs:49502
static bool chatRelease
Definition Main.cs:1741
static bool _needsLanguageSelect
Definition Main.cs:2383
static int invasionProgress
Definition Main.cs:1988
static void InvasionWarning()
Definition Main.cs:61206
List< DrawData > _voidLensDataSillouette
Definition Main.cs:2415
int focusMenu
Definition Main.cs:2369
static AssetSourceController AssetSourceController
Definition Main.cs:211
static int invasionProgressMode
Definition Main.cs:1984
static int sundialCooldown
Definition Main.cs:2283
void DrawSunAndMoon(SceneArea sceneArea, Microsoft.Xna.Framework.Color moonColor, Microsoft.Xna.Framework.Color sunColor, float tempMushroomInfluence)
Definition Main.cs:59644
static float ambientWaterfallStrength
Definition Main.cs:2319
static void DrawNetplayStatusText()
Definition Main.cs:60030
static Vector2 sceneBackgroundPos
Definition Main.cs:1052
void DedServ()
Definition Main.cs:4819
static Action CreateGoToMenuEvent(int menu)
Definition Main.cs:45192
static int[,] butterflyCageFrame
Definition Main.cs:1559
static int SmartInteractY
Definition Main.cs:2161
static bool playerInventory
Definition Main.cs:1759
static bool RGBRelease
Definition Main.cs:1086
static IntPtr LoadLibrary(string dllToLoad)
const string assemblyVersionNumber
Definition Main.cs:201
static int dayRate
Definition Main.cs:746
static void DoUpdate_AnimateTileGlows()
Definition Main.cs:16940
static float upTimerMaxDelay
Definition Main.cs:588
static ? bool _overrideForMasterMode
Definition Main.cs:337
void SortBabyBirdProjectiles(List< int > list)
Definition Main.cs:34938
void LoadAccHandsOff(int i)
Definition Main.cs:56167
static ParticleRenderer ParticleSystem_World_BehindPlayers
Definition Main.cs:2251
static bool drawDiag
Definition Main.cs:590
static Ref< Effect > TileShaderRef
Definition Main.cs:421
static string cMapStyle
Definition Main.cs:2195
static bool SmartCursorIsUsed
Definition Main.cs:2855
static void EntitySpriteDraw(Texture2D texture, Vector2 position, Microsoft.Xna.Framework.Rectangle? sourceRectangle, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float worthless=0f)
Definition Main.cs:34663
static int[] snail2CageFrame
Definition Main.cs:1575
void CacheNPCDraws()
Definition Main.cs:34699
const int maxNPCs
Definition Main.cs:1144
static void DrawNPCDirect_DeerclopsLeg(SpriteBatch mySpriteBatch, NPC rCurrentNPC, ref Vector2 screenPos, int typeCache, ref Microsoft.Xna.Framework.Color npcColor, ref Vector2 halfSize, SpriteEffects npcSpriteEffect)
Definition Main.cs:24759
static void DrawTileInWater(Vector2 drawOffset, int x, int y)
Definition Main.cs:54316
const int maxProjectiles
Definition Main.cs:1142
static int BartenderHelpTextIndex
Definition Main.cs:1320
static int[] duckCageFrameCounter
Definition Main.cs:1531
static MinimapFrameManager MinimapFrameManagerInstance
Definition Main.cs:2259
static int mapMaxY
Definition Main.cs:880
static int screenWidth
Definition Main.cs:1719
static float cloudBGActive
Definition Main.cs:628
static int[] bgFrameCounter
Definition Main.cs:818
static Liquid[] liquid
Definition Main.cs:1222
static ItemDropDatabase ItemDropsDB
Definition Main.cs:1862
static int[] grebeCageFrame
Definition Main.cs:1533
static float[] bgAlphaFarBackLayer
Definition Main.cs:814
static void SetRecipeMaterialDisplayName(int i)
Definition Main.cs:39528
static int[] specX
Definition Main.cs:2397
static int[] penguinCageFrameCounter
Definition Main.cs:1629
static void ConsumeAllMainThreadActions()
Definition Main.cs:15587
static void SetDisplayMode(int width, int height, bool fullscreen)
Definition Main.cs:63002
IEnumerator _gameContentLoadProcess
Definition Main.cs:2297
static string cSmart
Definition Main.cs:2137
void DrawTileEntities(bool solidLayer, bool overRenderTargets, bool intoRenderTargets)
Definition Main.cs:20266
static bool IsBorderlessDisplayAvailable()
Definition Main.cs:49195
static void SetGraphicsProfileInternal()
Definition Main.cs:3466
static float[] availableRecipeY
Definition Main.cs:1795
static void GetItemDrawFrame(int item, out Texture2D itemTexture, out Microsoft.Xna.Framework.Rectangle itemFrame)
Definition Main.cs:25221
static void DrawWithOutlines(Entity entity, Texture2D tex, Vector2 position, Microsoft.Xna.Framework.Rectangle? rect, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects)
Definition Main.cs:53597
JArray _lastLoadedPacks
Definition Main.cs:2293
static void CycleClothingStyle(Player plr)
Definition Main.cs:49267
void MouseText(string cursorText, string buffTooltip, int rare=0, byte diff=0, int hackedMouseX=-1, int hackedMouseY=-1, int hackedScreenWidth=-1, int hackedScreenHeight=-1, int pushWidthX=0, bool noOverride=false)
Definition Main.cs:18734
const int MF_BYPOSITION
Definition Main.cs:970
int textBlinkerState
Definition Main.cs:2391
static short sunModY
Definition Main.cs:1290
void Debug_PrettifyMap()
Definition Main.cs:60026
static int mH
Definition Main.cs:2455
static bool SettingsEnabled_OpaqueBoxBehindTooltips
Definition Main.cs:253
static Player dresserInterfaceDummy
Definition Main.cs:2475
static int[] cloudBG
Definition Main.cs:630
static int[] snowBG
Definition Main.cs:654
static bool drunkWorld
Definition Main.cs:339
static void ApplyBorderlessResolution(Form form)
Definition Main.cs:49217
static int selClothes
Definition Main.cs:2465
static void TryInteractingWithMoneyTrough2(Projectile proj)
Definition Main.cs:34568
static void DrawInterface_19_SignTileBubble()
Definition Main.cs:42546
static void NewLightning()
Definition Main.cs:55685
static float gfxRate
Definition Main.cs:1058
static int UnderworldLayer
Definition Main.cs:2825
void LoadAccFace(int i)
Definition Main.cs:56235
void LoadItemFlames(int i)
Definition Main.cs:56077
void UpdateAudio()
Definition Main.cs:10185
static bool IsValidPlayerStyle(Player plr)
Definition Main.cs:49276
static double CalculateDamagePlayersTake(int Damage, int Defense)
Definition Main.cs:62915
void LoadAccWaist(int i)
Definition Main.cs:56208
const int maxCombatText
Definition Main.cs:1130
static bool HoveringOverAnNPC
Definition Main.cs:2447
static bool startFullscreen
Definition Main.cs:2271
static double CalculateDamagePlayersTakeInPVP(int Damage, int Defense)
Definition Main.cs:62905
static Matrix _uiScaleMatrix
Definition Main.cs:233
static void DrawProj_Spear(Projectile proj, ref Microsoft.Xna.Framework.Color projectileColor, ref SpriteEffects dir)
Definition Main.cs:32404
static Vector2 DrawWhip_WhipMace(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33592
static bool drawRelease
Definition Main.cs:592
static int invasionProgressMax
Definition Main.cs:1990
static bool loadMap
Definition Main.cs:864
static void FindAnnouncementBoxStatus()
Definition Main.cs:2969
static bool LightingEveryFrame
Definition Main.cs:241
const int maxLiquidTypes
Definition Main.cs:1200
void ResetAllContentBasedRenderTargets()
Definition Main.cs:20277
static int PendingResolutionWidth
Definition Main.cs:1964
static void UpdateSettingUnlocks()
Definition Main.cs:18384
static void SetBorderlessFormStyle(Form form)
Definition Main.cs:49230
void DrawProjectiles()
Definition Main.cs:20676
void LoadAccFront(int i)
Definition Main.cs:56190
static float eclipseLight
Definition Main.cs:1314
static double UpdateTimeAccumulator
Definition Main.cs:726
void DrawSurfaceBG_Jungle(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes)
Definition Main.cs:57690
static void UpdateServer()
Definition Main.cs:61360
static Stopwatch splashTimer
Definition Main.cs:2289
static void ItemIconCacheUpdate(int selectedItemID)
Definition Main.cs:43506
void DrawSurfaceBG_Hallow(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes)
Definition Main.cs:57566
static string autoGenFileLocation
Definition Main.cs:2275
static int SmartInteractX
Definition Main.cs:2159
static RenderTarget2D waterTarget
Definition Main.cs:840
void DrawMapIcons_PotionOfReturnAppearAfterUsePosition(SpriteBatch spriteBatch, Vector2 mapTopLeft, Vector2 mapX2Y2AndOff, Microsoft.Xna.Framework.Rectangle? mapRect, float mapScale, float drawScale, ref string mouseTextString)
Definition Main.cs:53498
static CombatText[] combatText
Definition Main.cs:1695
static void ClearSmartInteract()
Definition Main.cs:45082
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
void DrawNPCExtras(NPC n, bool beforeDraw, float addHeight, float addY, Microsoft.Xna.Framework.Color npcColor, Vector2 halfSize, SpriteEffects npcSpriteEffect, Vector2 screenPosition)
Definition Main.cs:25235
void MouseText_DrawBuffTooltip(string buffString, ref int X, ref int Y)
Definition Main.cs:19866
static int iceBackStyle
Definition Main.cs:676
static void DrawNPCChatBubble(int i)
Definition Main.cs:40148
static int drawsCountedForFPS
Definition Main.cs:1078
static float musicVolume
Definition Main.cs:1421
void DrawSurfaceBG_DrawChangeOverlay(int backgroundAreaId)
Definition Main.cs:57856
static int TileInteractionHX
Definition Main.cs:2177
static bool ShouldDrawBackgroundTileAt(int i, int j)
Definition Main.cs:51957
static bool snowMoon
Definition Main.cs:1300
float hellBlackBoxBottom
Definition Main.cs:2539
void DrawTwinsPet(Projectile proj)
Definition Main.cs:33772
static bool pumpkinMoon
Definition Main.cs:1298
static void startPumpkinMoon()
Definition Main.cs:10133
static string cHeal
Definition Main.cs:2125
static void UpdateWorldPreparationState()
Definition Main.cs:3607
static readonly int maxBackgrounds
Definition Main.cs:451
static int oldHairStyle
Definition Main.cs:2461
static int teamCooldown
Definition Main.cs:1068
void DrawProj_FairyQueenRangedItemShot(Projectile proj)
Definition Main.cs:33098
bool chestRenameHover
Definition Main.cs:1038
static bool placementPreview
Definition Main.cs:1342
void DoLightTiles()
Definition Main.cs:60764
static void CheckForMoonEventsScoreDisplay()
Definition Main.cs:10093
static float leftWorld
Definition Main.cs:1106
bool[] menuWide
Definition Main.cs:2525
static int mouseY
Definition Main.cs:606
static int[] mallardCageFrameCounter
Definition Main.cs:1527
static void InputTextChest()
Definition Main.cs:18412
static void AddEchoFurnitureTile(int tileId)
Definition Main.cs:7794
static int mapTime
Definition Main.cs:884
static bool[] tileFrameImportant
Definition Main.cs:1495
static bool ReversedUpDownArmorSetBonuses
Definition Main.cs:259
static float mapMinimapDefaultScale
Definition Main.cs:922
static bool IsTileBiomeSightable(ushort type, short tileFrameX, short tileFrameY, ref Microsoft.Xna.Framework.Color sightColor)
Definition Main.cs:20308
void GUIHotbarDrawInner()
Definition Main.cs:40583
void LoadTiles(int i)
Definition Main.cs:56068
static void QueueMainThreadAction(Action action)
Definition Main.cs:15582
static bool autoGen
Definition Main.cs:1322
void PreDrawMenu(out Microsoft.Xna.Framework.Point screenSizeCache, out Microsoft.Xna.Framework.Point screenSizeCacheAfterScaling)
Definition Main.cs:49171
static float NPCAddHeight(NPC theNPC)
Definition Main.cs:20492
static void WeGameRequireExitGame()
Definition Main.cs:63231
static Ref< Effect > PixelShaderRef
Definition Main.cs:419
static bool[][] tileMerge
Definition Main.cs:1507
static void GetInfoAccIconPosition(int drawnCount, int StartX, out int X, out int Y)
Definition Main.cs:44234
static int[] caveBackX
Definition Main.cs:672
static int wofDrawAreaTop
Definition Main.cs:830
static int menuMode
Definition Main.cs:2379
static Player PendingPlayer
Definition Main.cs:1942
void DoDraw_Tiles_Solid()
Definition Main.cs:60154
static bool showItemOwner
Definition Main.cs:568
static float[] hotbarScale
Definition Main.cs:1749
static bool mapReady
Definition Main.cs:866
void DrawSurfaceBG_Mushroom(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes)
Definition Main.cs:56937
static string cMapZoomOut
Definition Main.cs:2187
static IAssetRepository Assets
Definition Main.cs:209
static string[] MonolithFilterNames
Definition Main.cs:2565
static ulong UnpausedUpdateSeed
Definition Main.cs:2760
static Vector2 DrawWhip_WhipSword(Projectile proj, List< Vector2 > controlPoints)
Definition Main.cs:33541
void DrawInterface_22_DresserWindow()
Definition Main.cs:42525
static int ConvertPaintIdToTileShaderIndex(int paintIndexOnTile, bool isUsedForPaintingGrass, bool useWallShaderHacks)
Definition Main.cs:55654
static bool gameMenu
Definition Main.cs:1926
static int[] snail2CageFrameCounter
Definition Main.cs:1577
static bool ShouldPVPDraw
Definition Main.cs:2875
void DrawMenu(GameTime gameTime)
Definition Main.cs:45228
static bool[] tileNoFail
Definition Main.cs:1489
const int maxHairStyles
Definition Main.cs:1405
static Preferences Configuration
Definition Main.cs:1956
void DrawWaters(bool isBackground=false)
Definition Main.cs:54244
static bool SmartCursorShowing
Definition Main.cs:2149
void UpdateViewZoomKeys()
Definition Main.cs:15635
static string[] recentWorld
Definition Main.cs:794
static int[] wormCageFrame
Definition Main.cs:1611
static float shimmerAlpha
Definition Main.cs:1008
RenderTarget2D tileTarget
Definition Main.cs:842
static int[] fairyJarFrame
Definition Main.cs:1601
static bool _isAsyncLoadComplete
Definition Main.cs:738
static void UpdateAtmosphereTransparencyToSkyColor()
Definition Main.cs:59998
static Player LocalPlayer
Definition Main.cs:2829
static bool[] tileNoAttach
Definition Main.cs:1487
static List< Microsoft.Xna.Framework.Point > SmartInteractTileCoords
Definition Main.cs:2169
static float _minRain
Definition Main.cs:2311
const int maxDust
Definition Main.cs:1126
static WindowStateController _windowMover
Definition Main.cs:2253
void DrawUnderworldBackground(bool flat)
Definition Main.cs:49543
static bool SaveSettings()
Definition Main.cs:3806
static void DoUpdate_AnimateCursorColors()
Definition Main.cs:16915
static bool inputTextEnter
Definition Main.cs:1745
static int[] jungleBG
Definition Main.cs:650
static bool mapFullscreen
Definition Main.cs:932
static bool[] persistentBuff
Definition Main.cs:776
static MapIconOverlay MapIcons
Definition Main.cs:367
static Vector2 _itemIconCacheScreenPosition
Definition Main.cs:2489
void DrawSplash(GameTime gameTime)
Definition Main.cs:49370
void LoadWall(int i)
Definition Main.cs:56059
void OpenLegacySettings()
Definition Main.cs:4283
List< int > DrawCacheProjsBehindProjectiles
Definition Main.cs:2241
void DrawNPCDirect(SpriteBatch mySpriteBatch, NPC rCurrentNPC, bool behindTiles, Vector2 screenPos)
Definition Main.cs:20995
void DoUpdate_AnimateDiscoRGB()
Definition Main.cs:18202
void DrawToMap_Section(int secX, int secY)
Definition Main.cs:52238
uint previousExecutionState
Definition Main.cs:2279
static string cFavoriteKey
Definition Main.cs:2141
const double slimeRainMaxTime
Definition Main.cs:1170
static int[] mallardCageFrame
Definition Main.cs:1525
static Effect vertexPixelShader
Definition Main.cs:2766
static int maxMenuItems
Definition Main.cs:2365
List< Tuple< int, int, ushort > > DrawWiresSpecialTiles
Definition Main.cs:2553
static ServerMode MenuServerMode
Definition Main.cs:1427
static void TrySupporting8K()
Definition Main.cs:3499
static bool ServerSideCharacter
Definition Main.cs:397
static AnchoredEntitiesCollection sittingManager
Definition Main.cs:2255
static bool hardMode
Definition Main.cs:1022
override void Initialize()
Definition Main.cs:5873
static bool CanUpdateGameplay
Definition Main.cs:2611
static int updateRate
Definition Main.cs:1082
static void ClosePlayerChat()
Definition Main.cs:16993
static void DrawUnderworldBackgroudLayer(bool flat, Vector2 screenOffset, float pushUp, int layerTextureIndex)
Definition Main.cs:49562
static float soundVolume
Definition Main.cs:1425
static void PlayInteractiveProjectileOpenCloseSound(int projType, bool open)
Definition Main.cs:34550
static bool gamePaused
Definition Main.cs:1072
void DrawSurfaceBG_Forest(double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes)
Definition Main.cs:58008
static void checkXMas()
Definition Main.cs:12169
static Item guideItem
Definition Main.cs:1775
static void DoUpdate_AnimateWalls()
Definition Main.cs:17972
static Sign[] sign
Definition Main.cs:1701
static int background
Definition Main.cs:1264
static void CraftItem(Recipe r)
Definition Main.cs:39679
static FileMetadata WorldFileMetadata
Definition Main.cs:361
static bool AllowUnfocusedInputOnGamepad
Definition Main.cs:265
void DrawTileCracks(int crackType, HitTile hitter)
Definition Main.cs:58210
static bool SmartCursorWanted
Definition Main.cs:2840
static void ItemIconCacheVerification()
Definition Main.cs:43513
static bool GamepadDisableInstructionsDisplay
Definition Main.cs:271
void DrawInterface_31_BuilderAccToggles()
Definition Main.cs:42320
static HairstyleUnlocksHelper Hairstyles
Definition Main.cs:1669
bool _imeToggle
Definition Main.cs:2431
static int buffScanAreaHeight
Definition Main.cs:766
void DrawTorchBiomeSwapIcon(int pivotTopLeftX, int pivotTopLeftY, bool pushSideToolsUp, int gamepadPointOffset)
Definition Main.cs:39640
static Preferences InputProfiles
Definition Main.cs:1958
const bool USE_ASYNC_LOAD
Definition Main.cs:736
static int oldClothesStyle
Definition Main.cs:2469
static BigProgressBarSystem BigBossProgressBar
Definition Main.cs:379
static string libPath
Definition Main.cs:1248
bool unityMouseOver
Definition Main.cs:281
static INetDiagnosticsUI ActiveNetDiagnosticsUI
Definition Main.cs:2789
static bool specialSeedWorld
Definition Main.cs:2705
int mouseNPCIndex
Definition Main.cs:824
static void DrawGamepadInstructions()
Definition Main.cs:20036
static Microsoft.Xna.Framework.Point LastLoadedResolution
Definition Main.cs:2269
static int ladyBugRainBoost
Definition Main.cs:2605
static bool IsTileSpelunkable(ushort typeCache, short tileFrameX, short tileFrameY)
Definition Main.cs:20291
static byte[,] butterflyCageMode
Definition Main.cs:1557
static int invasionWarn
Definition Main.cs:1978
static Player[] player
Definition Main.cs:1803
static int EquipPage
Definition Main.cs:820
int lastTileX
Definition Main.cs:950
void LoadSettings()
Definition Main.cs:3938
static int timesTriedToFastStack
Definition Main.cs:1767
void UpdateWindyDayState()
Definition Main.cs:12039
static bool DisableIntenseVisualEffects
Definition Main.cs:694
static string statusText
Definition Main.cs:1258
static float wFrame
Definition Main.cs:582
void MouseText(string cursorText, int rare=0, byte diff=0, int hackedMouseX=-1, int hackedMouseY=-1, int hackedScreenWidth=-1, int hackedScreenHeight=-1, int pushWidthX=0)
Definition Main.cs:18729
static void CancelClothesWindow(bool quiet=false)
Definition Main.cs:41163
const double slimeRainMaxDelay
Definition Main.cs:1174
static float reforgeScale
Definition Main.cs:2083
static int[] treeMntBGSet4
Definition Main.cs:638
void OnCharacterNamed(string text)
Definition Main.cs:45161
static PopupText[] popupText
Definition Main.cs:1697
static void ExitServerPasswordMenu()
Definition Main.cs:48958
static void BuyHairWindow()
Definition Main.cs:40677
static void CheckBossIndexes()
Definition Main.cs:16861
static int[] anglerQuestItemNetIDs
Definition Main.cs:1851
static string cUp
Definition Main.cs:2113
static int[] treeBGSet4
Definition Main.cs:646
static void SwitchNetMode(int mode)
Definition Main.cs:63222
static float aBar
Definition Main.cs:2517
static int weatherVaneBobframe
Definition Main.cs:2351
static int dayMusic
Definition Main.cs:1232
static bool showSpam
Definition Main.cs:566
void QuitGame()
Definition Main.cs:44876
static bool[] projHook
Definition Main.cs:772
static void DrawInterface_24_InterfaceLogic2()
Definition Main.cs:42502
static int ambientCounter
Definition Main.cs:2333
static ContentManager ShaderContentManager
Definition Main.cs:415
const int numberOfHairstyles
Definition Main.cs:1403
static void StartSlimeRain(bool announce=true)
Definition Main.cs:61505
static void MouseOversTryToClear()
Definition Main.cs:43488
static bool runningCollectorsEdition
Definition Main.cs:578
static bool PreventUpdatingTargets
Definition Main.cs:2295
bool chestStackHover
Definition Main.cs:1030
static int mouseX
Definition Main.cs:604
static bool[] tileFlame
Definition Main.cs:1653
static int bgStyle
Definition Main.cs:808
static float GlobalTimeWrappedHourly
Definition Main.cs:405
static int maxScreenH
Definition Main.cs:752
static GraphicsDeviceManager graphics
Definition Main.cs:972
static bool mouseReforge
Definition Main.cs:2081
static bool WallLightAt(int i, int j, bool showInvisibleWalls)
Definition Main.cs:51990
static RenderTarget2D screenTargetSwap
Definition Main.cs:854
void DrawBackground()
Definition Main.cs:49686
static bool superFast
Definition Main.cs:443
static void SetCameraGamepadLerp(float lerp)
Definition Main.cs:2999
static int[,] jellyfishCageFrame
Definition Main.cs:1607
static int anglerQuest
Definition Main.cs:1849
static void CursorColor()
Definition Main.cs:49348
static List< IEnumerator > DelayedProcesses
Definition Main.cs:431
static int invasionSize
Definition Main.cs:1974
static float martianLight
Definition Main.cs:1334
static bool fastForwardTimeToDusk
Definition Main.cs:2285
static int[] lavaFishBowlFrame
Definition Main.cs:1585
static bool IsTileSpelunkable(Tile t)
Definition Main.cs:20286
void MouseText_DrawItemTooltip(MouseTextCache info, int rare, byte diff, int X, int Y)
Definition Main.cs:18893
static bool[] debuff
Definition Main.cs:784
static Player[] playerVisualClone
Definition Main.cs:1805
static bool MouseShowBuildingGrid
Definition Main.cs:263
static int renderCount
Definition Main.cs:968
static int _minimapTopRightAnchorOffsetTowardsLeft
Definition Main.cs:2545
void DrawFPS()
Definition Main.cs:20012
volatile bool _begunMainAsyncLoad
Definition Main.cs:217
static bool SettingMusicReplayDelayEnabled
Definition Main.cs:255
static Microsoft.Xna.Framework.Color MouseBorderColor
Definition Main.cs:261
void DrawMapIcons_PotionOfReturnHomePosition(SpriteBatch spriteBatch, Vector2 mapTopLeft, Vector2 mapX2Y2AndOff, Microsoft.Xna.Framework.Rectangle? mapRect, float mapScale, float drawScale, ref string mouseTextString)
Definition Main.cs:53522
static bool IsItStorming
Definition Main.cs:2871
void DrawSurfaceBG_DrawBackMountainsLayer(int bgTextureIndex)
Definition Main.cs:56680
static string cMana
Definition Main.cs:2127
static void PostContentLoadInitialize()
Definition Main.cs:10022
static float ForcedMinimumZoom
Definition Main.cs:225
static int EquipPageSelected
Definition Main.cs:822
static bool remixWorld
Definition Main.cs:349
static int bgScroll
Definition Main.cs:2505
static Dust[] dust
Definition Main.cs:1677
static bool[] tileAxe
Definition Main.cs:1451
static void EntitySpriteDraw(Texture2D texture, Vector2 position, Microsoft.Xna.Framework.Rectangle? sourceRectangle, Microsoft.Xna.Framework.Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float worthless=0f)
Definition Main.cs:34658
int selectedMenu2
Definition Main.cs:2373
static bool mouseLeft
Definition Main.cs:614
static bool menuMultiplayer
Definition Main.cs:2091
static int curMusic
Definition Main.cs:1230
static int[] seagullCageFrameCounter
Definition Main.cs:1539
static Rain[] rain
Definition Main.cs:1689
static Dictionary< int, GameModeData > RegisteredGameModes
Definition Main.cs:315
static void StopRain()
Definition Main.cs:61441
static bool _cannotDrawAccessoriesHorizontally
Definition Main.cs:2495
static int[,] scorpionCageFrameCounter
Definition Main.cs:1569
static bool hairWindow
Definition Main.cs:700
List< int > DrawCacheProjsOverPlayers
Definition Main.cs:2245
static void TeleportEffect(Microsoft.Xna.Framework.Rectangle effectRect, int Style, int extraInfo=0, float dustCountMult=1f, TeleportationSide side=TeleportationSide.Entry, Vector2 otherPosition=default(Vector2))
Definition Main.cs:12270
void InitMap()
Definition Main.cs:55065
static void InputTextSign()
Definition Main.cs:18393
static string[] MonolithSkyNames
Definition Main.cs:2567
static int[] tileFrame
Definition Main.cs:1657
static int cursorColorDirection
Definition Main.cs:2207
static short[] updateTileY
Definition MapHelper.cs:172
static Color GetMapTileXnaColor(ref MapTile tile)
static int TileToLookup(int tileType, int option)
static int numUpdateTile
Definition MapHelper.cs:168
static void GetTileBaseOption(int x, int y, int tileType, Tile tileCache, ref int baseOption)
static int[] tileOptionCounts
Definition MapHelper.cs:176
static ushort[] tileLookup
Definition MapHelper.cs:180
static void Initialize()
Definition MapHelper.cs:208
static short[] updateTileX
Definition MapHelper.cs:170
MapIconOverlay AddLayer(IMapLayer layer)
static void Initialize()
Definition Minecart.cs:91
static void Initialize()
Definition Mount.cs:575
static bool GetNPCLocation(int i, bool seekHead, bool averageDirection, out int index, out Vector2 pos)
Definition NPC.cs:12664
static bool downedChristmasSantank
Definition NPC.cs:379
static int TypeToDefaultHeadIndex(int type)
Definition NPC.cs:1651
static CoinLossRevengeSystem RevengeManager
Definition NPC.cs:439
static bool downedFrost
Definition NPC.cs:357
static bool savedAngler
Definition NPC.cs:293
static void ResetNetOffsets()
Definition NPC.cs:87083
static bool SpawnAllowed_Nurse()
Definition NPC.cs:1194
static void UpdateFoundActiveNPCs()
Definition NPC.cs:1265
static bool boughtCat
Definition NPC.cs:301
static void ResetRemixHax()
Definition NPC.cs:72554
static bool unlockedSlimeRainbowSpawn
Definition NPC.cs:315
static bool unlockedSlimeGreenSpawn
Definition NPC.cs:309
static bool downedMechBoss2
Definition NPC.cs:425
static bool downedFishron
Definition NPC.cs:369
static bool unlockedSlimePurpleSpawn
Definition NPC.cs:313
static int ShieldStrengthTowerNebula
Definition NPC.cs:403
static bool savedTaxCollector
Definition NPC.cs:285
static bool downedBoss2
Definition NPC.cs:347
static void setFireFlyChance()
Definition NPC.cs:90049
static int waveNumber
Definition NPC.cs:77
static int ShieldStrengthTowerSolar
Definition NPC.cs:399
static bool savedGolfer
Definition NPC.cs:299
int lifeMax
Definition NPC.cs:479
static int crimsonBoss
Definition NPC.cs:165
static int ShieldStrengthTowerMax
Definition NPC.cs:785
static bool SpawnAllowed_Demolitionist()
Definition NPC.cs:1103
static void HaveDryadDoStardewAnimation()
Definition NPC.cs:12987
float gfxOffY
Definition NPC.cs:125
static int[] killCount
Definition NPC.cs:71
static bool savedMech
Definition NPC.cs:291
static bool SpawnAllowed_ArmsDealer()
Definition NPC.cs:1128
static bool ShouldEmpressBeEnraged()
Definition NPC.cs:39121
static bool unlockedSlimeBlueSpawn
Definition NPC.cs:307
static bool downedMechBossAny
Definition NPC.cs:421
static bool savedWizard
Definition NPC.cs:289
static int[] MoonEventRequiredPointsPerWaveLookup
Definition NPC.cs:605
static void ResetBadgerHatTime()
Definition NPC.cs:71189
static bool travelNPC
Definition NPC.cs:539
static bool downedHalloweenKing
Definition NPC.cs:373
static bool boughtDog
Definition NPC.cs:303
static int MaxMoonLordCountdown
Definition NPC.cs:53
static bool downedBoss1
Definition NPC.cs:345
static bool downedSlimeKing
Definition NPC.cs:353
static bool unlockedPrincessSpawn
Definition NPC.cs:337
static bool savedGoblin
Definition NPC.cs:287
static bool empressRageMode
Definition NPC.cs:585
static bool taxCollector
Definition NPC.cs:111
static float totalInvasionPoints
Definition NPC.cs:73
static bool unlockedSlimeRedSpawn
Definition NPC.cs:317
static bool downedMechBoss3
Definition NPC.cs:427
static bool BusyWithAnyInvasionOfSorts()
Definition NPC.cs:1048
static int ShieldStrengthTowerStardust
Definition NPC.cs:405
static bool downedPirates
Definition NPC.cs:359
static int ShieldStrengthTowerVortex
Definition NPC.cs:401
static bool downedMoonlord
Definition NPC.cs:383
static bool unlockedPartyGirlSpawn
Definition NPC.cs:327
static bool PreventJojaColaDialog
Definition NPC.cs:636
static bool IsMechQueenUp
Definition NPC.cs:834
static bool AnyDanger(bool quickBossNPCCheck=false, bool ignorePillarsAndMoonlordCountdown=false)
Definition NPC.cs:77014
static bool AnyNPCs(int Type)
Definition NPC.cs:86689
static bool IsADeerclopsNearScreen()
Definition NPC.cs:37649
static void SetRemixHax()
Definition NPC.cs:72561
static bool downedQueenBee
Definition NPC.cs:351
static bool downedHalloweenTree
Definition NPC.cs:371
static bool downedChristmasTree
Definition NPC.cs:377
static int RerollDryadText
Definition NPC.cs:638
static int deerclopsBoss
Definition NPC.cs:167
static bool unlockedSlimeOldSpawn
Definition NPC.cs:311
static bool downedGoblins
Definition NPC.cs:355
static float waveKills
Definition NPC.cs:75
static void SpawnSkeletron(int onWho)
Definition NPC.cs:77174
static int NewNPC(IEntitySource source, int X, int Y, int Type, int Start=0, float ai0=0f, float ai1=0f, float ai2=0f, float ai3=0f, int Target=255)
Definition NPC.cs:77654
static void SpawnOnPlayer(int plr, int Type)
Definition NPC.cs:77311
static int offSetDelayTime
Definition NPC.cs:634
static bool SpawnMechQueen(int onWhichPlayer)
Definition NPC.cs:13579
static bool SpawnAllowed_Merchant()
Definition NPC.cs:1211
static void ClearFoundActiveNPCs()
Definition NPC.cs:1257
static int MoonLordCountdown
Definition NPC.cs:51
static void SetEventFlagCleared(ref bool eventFlag, int gameEventId)
Definition NPC.cs:71077
static bool downedGolemBoss
Definition NPC.cs:365
static void SpawnNPC()
Definition NPC.cs:72591
static bool LunarApocalypseIsUp
Definition NPC.cs:419
static bool downedMartians
Definition NPC.cs:367
static bool boughtBunny
Definition NPC.cs:305
static bool downedChristmasIceQueen
Definition NPC.cs:375
static int golemBoss
Definition NPC.cs:161
static bool downedBoss3
Definition NPC.cs:349
int life
Definition NPC.cs:477
static IEntitySource GetSpawnSourceForTownSpawn()
Definition NPC.cs:87541
static bool unlockedSlimeYellowSpawn
Definition NPC.cs:319
static bool downedPlantBoss
Definition NPC.cs:363
static bool savedBartender
Definition NPC.cs:297
static bool SpawnAllowed_DyeTrader()
Definition NPC.cs:1153
static void TransformElderSlime(int npcIndex)
Definition NPC.cs:12933
static int brainOfGravity
Definition NPC.cs:583
static bool downedMechBoss1
Definition NPC.cs:423
static bool downedDeerclops
Definition NPC.cs:397
static bool unlockedSlimeCopperSpawn
Definition NPC.cs:321
static int plantBoss
Definition NPC.cs:163
static bool savedStylist
Definition NPC.cs:295
static void SendData(int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0)
Definition NetMessage.cs:88
static void SendAnglerQuest(int remoteClient)
static bool TrySendData(int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0)
Definition NetMessage.cs:75
static MessageBuffer[] buffer
Definition NetMessage.cs:61
static readonly NetManager Instance
Definition NetManager.cs:18
static void SetRemoteIPAsync(string remoteAddress, Action successCallBack)
Definition Netplay.cs:673
static bool Disconnect
Definition Netplay.cs:55
static void Initialize()
Definition Netplay.cs:744
static bool HasClients
Definition Netplay.cs:59
static RemoteClient[] Clients
Definition Netplay.cs:37
static void InvalidateAllOngoingIPSetAttempts()
Definition Netplay.cs:699
static void StartTcpClient()
Definition Netplay.cs:633
static string ServerPassword
Definition Netplay.cs:35
static int ListenPort
Definition Netplay.cs:47
static void AddBan(int plr)
Definition Netplay.cs:118
static void StartServer()
Definition Netplay.cs:231
static void UpdateInMainThread()
Definition Netplay.cs:762
static bool SaveOnServerExit
Definition Netplay.cs:53
static RemoteServer Connection
Definition Netplay.cs:39
static bool SetRemoteIP(string remoteAddress)
Definition Netplay.cs:641
static HoverControlMode HoverControl
Definition Player.cs:343
static bool SmartCursorHoldCanReleaseMidUse
Definition Player.cs:332
static int FlexibleWandCycleOffset
Definition Player.cs:2703
static readonly int maxBuffs
Definition Player.cs:1191
Vector2? PotionOfReturnOriginalUsePosition
Definition Player.cs:2063
static int FlexibleWandRandomSeed
Definition Player.cs:2701
static int taxRate
Definition Player.cs:627
static int tileRangeX
Definition Player.cs:2075
static int BlockInteractionWithProjectiles
Definition Player.cs:2575
static PlayerFileData GetFileData(string file, bool cloudSave)
Definition Player.cs:52273
static int tileRangeY
Definition Player.cs:2077
static byte FindClosest(Vector2 Position, int Width, int Height)
Definition Player.cs:4011
static float TargetScale
Definition PopupText.cs:68
static int NewText(AdvancedPopupRequest request, Vector2 position)
Definition PopupText.cs:95
static void UpdateItemText()
Definition PopupText.cs:676
static bool IsFna
Definition Program.cs:23
static bool IsXna
Definition Program.cs:21
static bool LoadedEverything
Definition Program.cs:39
static string SavePath
Definition Program.cs:31
static Dictionary< string, string > LaunchParameters
Definition Program.cs:29
static void AI_192_GetJuminoFall(Projectile proj, out float timeSinceFall, out float fall)
static void InitializeStaticThings()
static void FillWhipControlPoints(Projectile proj, List< Vector2 > controlPoints)
static Vector2 AI_158_GetHomeLocation(Player master, int stackedIndex)
static IEntitySource GetNoneSource()
static Color GetGolfTrailColor(Projectile proj)
static int GetByUUID(int owner, float uuid)
static void GetWhipSettings(Projectile proj, out float timeToFlyOut, out int segments, out float rangeMultiplier)
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)
static void MakeRain()
Definition Rain.cs:31
static void GetThroughDelayedFindRecipes()
Definition Recipe.cs:444
Item createItem
Definition Recipe.cs:27
static int maxRequirements
Definition Recipe.cs:19
static int GetRequiredTileStyle(int tileID)
Definition Recipe.cs:15779
static void SetupRecipes()
Definition Recipe.cs:774
static int maxRecipes
Definition Recipe.cs:21
static void FindRecipes(bool canDelayCheck=false)
Definition Recipe.cs:453
static void CheckSection(int playerIndex, Vector2 position, int fluff=1)
static int MushroomTileMax
static int JungleTileThreshold
static int CrimsonTileMax
static int HallowTileThreshold
static int SnowTileThreshold
static int CorruptionTileMax
static void TextSign(int i, string text)
Definition Sign.cs:63
static void Shutdown()
Definition SocialAPI.cs:60
static Terraria.Social.Base.CloudSocialModule Cloud
Definition SocialAPI.cs:18
static Terraria.Social.Base.NetSocialModule Network
Definition SocialAPI.cs:20
static Terraria.Social.Base.WorkshopSocialModule Workshop
Definition SocialAPI.cs:24
static Terraria.Social.Base.FriendsSocialModule Friends
Definition SocialAPI.cs:14
static void NightSetup()
Definition Star.cs:39
static void SpawnStars(int s=-1)
Definition Star.cs:84
static void UpdateStars()
Definition Star.cs:233
short frameY
Definition Tile.cs:24
ushort type
Definition Tile.cs:8
short frameX
Definition Tile.cs:22
static float GetDrawTime(int drawType)
static void Initialize()
Definition TimeLogger.cs:52
static void EndDrawFrame()
static void MapDrawTime(double timeElapsed)
static void DetailedDrawReset()
static float GetDrawTotal()
static void DetailedDrawTime(int detailedDrawType)
static float GetLightingTime(int lightingType)
static void NewDrawFrame()
static void RenderTime(int renderType, double timeElapsed)
static float GetLightingTotal()
static void DrawTime(int drawType, double timeElapsed)
static void MenuDrawTime(double timeElapsed)
static void Start()
static void SplashDrawTime(double timeElapsed)
static void DrawException(Exception e)
void DrawOneAchievement(SpriteBatch spriteBatch, Vector2 position, bool large)
static void DrawColorCodedStringShadow(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, float maxWidth=-1f, float spread=2f)
static bool AddChatText(DynamicSpriteFont font, string text, Vector2 baseScale)
static readonly ChatCommandProcessor Commands
static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth, bool ignoreColors=false)
static Vector2 DrawColorCodedStringWithShadow(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth=-1f, float spread=2f)
static Vector2 GetStringSize(DynamicSpriteFont font, string text, Vector2 baseScale, float maxWidth=-1f)
static List< TextSnippet > ParseMessage(string text, Color baseColor)
static void RenameChestCancel()
Definition ChestUI.cs:933
static bool IsBlockedFromTransferIntoChest(Item item, Item[] container)
Definition ChestUI.cs:1380
static void RenameChestSubmit(Player player)
Definition ChestUI.cs:910
static void Draw(SpriteBatch spritebatch)
Definition ChestUI.cs:72
static void GetContainerUsageInfo(out bool sync, out Item[] chestinv)
Definition ChestUI.cs:1352
static void ShowFailedToLoadAssetError(Exception exception, string filePath)
static void GoToDefaultPage(int specialFlag=0)
static void SetPosition(int ID, Vector2 Position)
static bool Draw(SpriteBatch spriteBatch, GameTime gameTime)
static bool CanShowVirtualKeyboard(int context)
static void OpenVirtualKeyboard(int keyboardContext)
static void OpenUIState(UIState uiState)
static bool HighlightNewItems
Definition ItemSlot.cs:26
static bool DisableLeftShiftTrashCan
Definition ItemSlot.cs:22
static bool DisableQuickTrash
Definition ItemSlot.cs:24
static void Draw(SpriteBatch spriteBatch, ref Item inv, int context, Vector2 position, Color lightColor=default(Color))
Definition ItemSlot.cs:1777
static void SetGlow(int index, float hue, bool chest)
Definition ItemSlot.cs:249
static void OverrideHover(ref Item inv, int context=0)
Definition ItemSlot.cs:322
static void DrawRadialDpad(SpriteBatch sb, Vector2 position)
Definition ItemSlot.cs:3065
static void DrawMoney(SpriteBatch sb, string text, float shopx, float shopy, int[] coinsArray, bool horizontal=false)
Definition ItemSlot.cs:2829
static void DrawSavings(SpriteBatch sb, float shopx, float shopy, bool horizontal=false)
Definition ItemSlot.cs:2859
static void RightClick(ref Item inv, int context=0)
Definition ItemSlot.cs:1313
static void LeftClick(ref Item inv, int context=0)
Definition ItemSlot.cs:630
static void DrawRadialQuicks(SpriteBatch sb, Vector2 position)
Definition ItemSlot.cs:2992
static void DrawItem_GetColorAndScale(Item item, float scale, ref Color currentWhite, float sizeLimit, ref Rectangle frame, out Color itemLight, out float finalDrawScale)
Definition ItemSlot.cs:2320
static void SelectEquipPage(Item item)
Definition ItemSlot.cs:3626
static void UpdateInterface()
Definition ItemSlot.cs:271
static void RefreshStackSplitCooldown()
Definition ItemSlot.cs:1478
static Color GetLoadoutColor(int loadoutIndex)
Definition ItemSlot.cs:2268
static void GetItemLight(ref Color currentColor, Item item, bool outInTheWorld=false)
Definition ItemSlot.cs:2899
static void MouseHover(int context=0)
Definition ItemSlot.cs:2445
static void DrawRadialCircular(SpriteBatch sb, Vector2 position, Player.SelectionRadial radial, Item[] items)
Definition ItemSlot.cs:2955
static void Handle(ref Item inv, int context=0)
Definition ItemSlot.cs:302
static void SortInventory()
static void SetupWhiteLists()
static void InvalidateTooltips()
static UserInterface ActiveInstance
static bool Exists(string path, bool cloud)
static void Move(string source, string destination, bool cloud, bool overwrite=true, bool forceDeleteSourceFile=false)
static string GetFullPath(string path, bool cloud)
static void Delete(string path, bool cloud, bool forceDeleteFile=false)
static Vector2 Vector2FromElipse(Vector2 angleVector, Vector2 elipseSizes)
Definition Utils.cs:609
static float Remap(float fromValue, float fromMin, float fromMax, float toMin, float toMax, bool clamped=true)
Definition Utils.cs:233
static int[] CoinsSplit(long count)
Definition Utils.cs:665
static bool TryCreatingDirectory(string folderPath)
Definition Utils.cs:754
static float WrappedLerp(float value1, float value2, float percent)
Definition Utils.cs:193
static void DrawSplicedPanel(SpriteBatch sb, Texture2D texture, int x, int y, int w, int h, int leftEnd, int rightEnd, int topEnd, int bottomEnd, Color c)
Definition Utils.cs:1964
static void DrawInvBG(SpriteBatch sb, Rectangle R, Color c=default(Color))
Definition Utils.cs:1921
static string[] WordwrapString(string text, DynamicSpriteFont font, int maxWidth, int maxLines, out int lineAmount)
Definition Utils.cs:522
static int RandomInt(ref ulong seed, int max)
Definition Utils.cs:1648
static float RandomFloat(ref ulong seed)
Definition Utils.cs:1643
static void DrawBorderStringFourWay(SpriteBatch sb, DynamicSpriteFont font, string text, float x, float y, Color textColor, Color borderColor, Vector2 origin, float scale=1f)
Definition Utils.cs:1857
static Vector2 Round(Vector2 input)
Definition Utils.cs:69
static float GetLerpValue(float from, float to, float t, bool clamped=false)
Definition Utils.cs:203
static Vector2 DrawBorderString(SpriteBatch sb, string text, Vector2 pos, Color color, float scale=1f, float anchorx=0f, float anchory=0f, int maxCharactersDisplayed=-1)
Definition Utils.cs:1891
static void DrawRectangle(SpriteBatch sb, Vector2 start, Vector2 end, Color colorStart, Color colorEnd, float width)
Definition Utils.cs:2002
static void DrawLaser(SpriteBatch sb, Texture2D tex, Vector2 start, Vector2 end, Vector2 scale, LaserLineFraming framing)
Definition Utils.cs:2010
static ulong RandomNextSeed(ulong seed)
Definition Utils.cs:1638
static Rectangle CenteredRectangle(Vector2 center, Vector2 size)
Definition Utils.cs:604
static void DrawSettings2Panel(SpriteBatch spriteBatch, Vector2 position, float width, Color color)
Definition Utils.cs:1990
void Draw(SpriteBatch spriteBatch)
void FindWaterfalls(bool forced=false)
void BindTo(Preferences preferences)
static void Initialize()
Definition Wiring.cs:80
static void Initialize()
Definition WorldGen.cs:67
static int hallowBG
Definition WorldGen.cs:914
static void UpdateWorld()
static bool loadFailed
Definition WorldGen.cs:982
static void setWorldSize()
Definition WorldGen.cs:3013
static bool IsTreeType(int tree)
static int jungleBG
Definition WorldGen.cs:910
static bool remixWorldGen
Definition WorldGen.cs:1148
static volatile bool gen
Definition WorldGen.cs:972
static void GenerateWorld(int seed, GenerationProgress customProgressObject=null)
Definition WorldGen.cs:7175
static int treeBG2
Definition WorldGen.cs:902
static bool SolidTile(Tile testTile)
static void SectionTileFrameWithCheck(int startX, int startY, int endX, int endY)
static int treeBG3
Definition WorldGen.cs:904
static TownRoomManager TownManager
Definition WorldGen.cs:892
static void SpawnTravelNPC()
Definition WorldGen.cs:1782
static int treeBG4
Definition WorldGen.cs:906
static void BroadcastText(NetworkText text, Vector4 color)
static void moveRoom(int x, int y, int n)
Definition WorldGen.cs:1575
static void saveAndPlay()
Definition WorldGen.cs:3298
static int GetWorldUpdateRate()
static int prioritizedTownNPCType
Definition WorldGen.cs:1024
static Task serverLoadWorld()
Definition WorldGen.cs:3368
static bool tenthAnniversaryWorldGen
Definition WorldGen.cs:1160
static void setBG(int bg, int style)
Definition WorldGen.cs:3660
static void SaveAndQuit(Action callback=null)
Definition WorldGen.cs:3146
static void RandomizeBackgrounds(UnifiedRandom random)
Definition WorldGen.cs:4313
static int corruptBG
Definition WorldGen.cs:908
static bool loadSuccess
Definition WorldGen.cs:984
static bool crimson
Definition WorldGen.cs:932
static bool MoveTownNPC(int x, int y, int n)
Definition WorldGen.cs:1478
static MysticLogFairiesEvent mysticLogsEvent
Definition WorldGen.cs:1100
static bool spawnEye
Definition WorldGen.cs:968
static bool drunkWorldGenText
Definition WorldGen.cs:1166
static bool oceanDepths(int x, int y)
Definition WorldGen.cs:7142
static Task CreateNewWorld(GenerationProgress progress=null)
Definition WorldGen.cs:3048
static void clearWorld()
Definition WorldGen.cs:3373
static void EveryTileFrame()
static void QuickFindHome(int npc)
Definition WorldGen.cs:2227
static bool generatingWorld
Definition WorldGen.cs:1122
static void playWorld()
Definition WorldGen.cs:3288
static int altarCount
Definition WorldGen.cs:978
static int spawnHardBoss
Definition WorldGen.cs:970
static void PlayLiquidChangeSound(TileChangeType eventType, int x, int y, int count=1)
Definition WorldGen.cs:1424
static int desertBG
Definition WorldGen.cs:918
static int crimsonBG
Definition WorldGen.cs:916
static void saveToonWhilePlaying()
Definition WorldGen.cs:3308
static int treeBG1
Definition WorldGen.cs:900
static void UnspawnTravelNPC()
Definition WorldGen.cs:1737
static void RandomizeCaveBackgrounds()
Definition WorldGen.cs:4515
static void dropMeteor()
Definition WorldGen.cs:2739
static void ResetTreeShakes()
static bool drunkWorldGen
Definition WorldGen.cs:1154
static BackgroundChangeFlashInfo BackgroundsCache
Definition WorldGen.cs:1180
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816
static bool shadowOrbSmashed
Definition WorldGen.cs:974
static bool notTheBees
Definition WorldGen.cs:1164
static bool spawnMeteor
Definition WorldGen.cs:980
static bool getGoodWorldGen
Definition WorldGen.cs:1156
static void kickOut(int n)
Definition WorldGen.cs:1601
static Color paintColor(int color)
delegate void FailedToLoadAssetCustomAction(string assetName, Exception e)
delegate void ResolutionChangeEvent(int width, int height)
static Color LightSeaGreen
Definition Color.cs:220
static Color CornflowerBlue
Definition Color.cs:112
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static Matrix Invert(Matrix matrix)
Definition Matrix.cs:1694
static Matrix CreateRotationX(float radians)
Definition Matrix.cs:654
static Matrix CreateScale(float xScale, float yScale, float zScale)
Definition Matrix.cs:522
static Matrix CreateRotationY(float radians)
Definition Matrix.cs:700
static Matrix CreateRotationZ(float radians)
Definition Matrix.cs:746
bool Intersects(Rectangle value)
Definition Rectangle.cs:129
bool Contains(int x, int y)
Definition Rectangle.cs:92
static float Dot(Vector2 value1, Vector2 value2)
Definition Vector2.cs:121
static Vector2 Clamp(Vector2 value1, Vector2 min, Vector2 max)
Definition Vector2.cs:201
static Vector2 Transform(Vector2 position, Matrix matrix)
Definition Vector2.cs:317
static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:255
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91
static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
Definition Vector2.cs:227
static Vector3 Transform(Vector3 position, Matrix matrix)
Definition Vector3.cs:407
static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
Definition Vector4.cs:277
static DateTime Now
Definition DateTime.cs:103
static Guid NewGuid()
Definition Guid.cs:1283
static readonly IntPtr Zero
Definition IntPtr.cs:18
static TimeSpan FromMilliseconds(double value)
Definition TimeSpan.cs:228
static readonly TimeSpan Zero
Definition TimeSpan.cs:21
void Draw(SpriteBatch sb)
Definition DrawData.cs:146
static GetItemSettings InventoryUIToInventorySettingsShowAsNew
static FinalFractalProfile GetFinalFractalProfile(int usedSwordId)
Vector2 SceneLocalScreenPositionOffset
Definition Main.cs:169
static FastRandom CreateWithRandomSeed()
Definition FastRandom.cs:37